don't click here

"Zone Agnostic" objects in Sonic 1

Discussion in 'Engineering & Reverse Engineering' started by Mercury, Jun 3, 2010.

Thread Status:
Not open for further replies.
  1. Mercury

    Mercury

    His Name Is Sonic Tech Member
    1,740
    21
    18
    Location Location
    AeStHete
    You know those Pushable Green Blocks from Marble Zone? Well, I was somewhat surprised when I learned that you can place the same object in Labyrinth Zone and they'll function perfectly, complete with a pretty Labyrinth-style block graphic. One assumes that the level designers originally intended to use them in Labyrinth, but never did for one reason or another.

    It got me to thinking that it would be nice if - for the benefit of layout hackers - you could place Pushable Blocks in any of the Zones. For that matter, why stop at Pushables? Why not include Breakable Blocks, and all the Moving Platforms, too?

    The trouble is that, though these objects function physically in any Zone in which they're placed, they won't load the correct graphics.

    Well, though I'm still an ASM beginner, I aimed to fix that. I've managed to get a bunch of them working - I want to add more as I get time, but this is a start at least.

    In the meantime, here's the result (I don't think I should Wiki-ise it until I'm further along).

    Notes:
    • We'll need to add some graphics to LZ. The only reasonable LZ tiles for smashable blocks/walls/floors are part of the Zone background tiles. Unfortunately, these tiles aren't situated nicely for object mappings. The solution is to just add correctly arranged duplicates in a free area. To make this easy, I'll just provide the file.

      Replace "artnem\LZ Gargoyle & Fireball.bin" with this: download


    Pushable Blocks

    Adding Pushable Blocks to SYZ, SLZ, SBZ and Pushable Rocks to GHZ

    Open "_incObj\33 Pushable Blocks.asm". Find the following:

    Code (ASM):
    1.  
    2.         move.l  #Map_Push,obMap(a0)
    3.         move.w  #$42B8,obGfx(a0) ; MZ specific code
    4.         cmpi.b  #1,(v_zone).w
    5.         bne.s   @notLZ
    6.         move.w  #$43DE,obGfx(a0) ; LZ specific code
    7.  
    8.     @notLZ:
    9.         move.b  #4,obRender(a0)
    10.         move.b  #3,obPriority(a0)
    11.  
    And replace it with this:

    Code (ASM):
    1.  
    2.         move.l  #Map_Push,obMap(a0)
    3.         move.w  #$42B8,obGfx(a0) ; MZ specific code
    4.         cmpi.b  #1,(v_zone).w
    5.         bne.s   @notLZ
    6.         move.w  #$43DE,obGfx(a0) ; LZ specific code
    7.  
    8.     @notLZ:
    9.         cmpi.b  #id_GHZ,(v_zone).w
    10.         bne.s   @notGHZ
    11.         move.l  #Map_PRock,obMap(a0)
    12.         move.w  #$63D0,obGfx(a0) ; GHZ specific code
    13.    
    14.     @notGHZ:
    15.         cmpi.b  #id_SLZ,(v_zone).w
    16.         bne.s   @notSLZ
    17.         move.l  #Map_Stair,obMap(a0)
    18.         move.w  #$4000,obGfx(a0) ; SLZ specific code
    19.    
    20.     @notSLZ:
    21.         cmpi.b  #id_SBZ,(v_zone).w
    22.         bne.s   @notSBZ
    23.         move.l  #Map_Push,obMap(a0)
    24.         move.w  #$44BB,obGfx(a0) ; SBZ specific code
    25.    
    26.     @notSBZ:
    27.         cmpi.b  #id_SYZ,(v_zone).w
    28.         bne.s   @notSYZ
    29.         move.l  #Map_FBlock,obMap(a0)
    30.         move.w  #$4000,obGfx(a0) ; SYZ specific code
    31.    
    32.     @notSYZ:
    33.         move.b  #4,obRender(a0)
    34.         move.b  #3,obPriority(a0)
    35.  
    Now find this:

    Code (ASM):
    1.  
    2.         move.w  obX(a0),$34(a0)
    3.         move.w  obY(a0),$36(a0)
    4.         moveq   #0,d0
    5.         move.b  obSubtype(a0),d0
    6.         add.w   d0,d0
    7.         andi.w  #$E,d0
    8.         lea PushB_Var(pc,d0.w),a2
    9.         move.b  (a2)+,obActWid(a0)
    10.         move.b  (a2)+,obFrame(a0)
    11.         tst.b   obSubtype(a0)
    12.         beq.s   @chkgone
    13.         move.w  #$C2B8,obGfx(a0)
    14.  
    and replace it with this:

    Code (ASM):
    1.  
    2.         move.w  obX(a0),$34(a0)
    3.         move.w  obY(a0),$36(a0)
    4.         move.b  #$10,obActWid(a0)
    5.         move.b  #0,obFrame(a0)
    6.         moveq   #0,d0
    7.         move.b  obSubtype(a0),d0
    8.         andi.b  #$F,d0
    9.         tst.b   d0
    10.         beq.s   @notsetoffour
    11.         move.b  #$40,obActWid(a0)
    12.         move.b  #$01,obFrame(a0)
    13.        
    14.     @notsetoffour:
    15.         tst.b   obSubtype(a0)
    16.         beq.s   @chkgone
    17.         move.w  #$C2B8,obGfx(a0)
    18.  
    Finally, find this:

    Code (ASM):
    1.  
    2. PushB_Var:  dc.b $10, 0 ; object width, frame number
    3.         dc.b $40, 1
    4.  
    and either delete those lines or comment them out.

    That's all there is to it! Placing object 33 in GHZ, SYZ, SLZ, and SBZ will now work.

    Breakable Blocks

    Adding Breakable Blocks to SYZ, LZ, SLZ, SBZ

    Open "_incObj\51 Smashable Green Block.asm" and find this:

    Code (ASM):
    1.  
    2.         move.l  #Map_Smab,obMap(a0)
    3.         move.w  #$42B8,obGfx(a0)
    4.         move.b  #4,obRender(a0)
    5.         move.b  #$10,obActWid(a0)
    6.         move.b  #4,obPriority(a0)
    7.         move.b  obSubtype(a0),obFrame(a0)
    8.  
    and replace it with this:

    Code (ASM):
    1.  
    2.         move.l  #Map_Smab,obMap(a0)
    3.         move.w  #$42B8,obGfx(a0)
    4.         cmpi.b  #id_SYZ,(v_zone).w
    5.         bne.s   @notSYZ
    6.         move.l  #Map_BossBlock,obMap(a0)
    7.         move.w  #$4000,obGfx(a0)
    8.     @notSYZ:
    9.         cmpi.b  #id_LZ,(v_zone).w
    10.         bne.s   @notLZ
    11.         move.l  #Map_Smab2,obMap(a0)
    12.         move.w  #$42FA,obGfx(a0)
    13.     @notLZ:
    14.         cmpi.b  #id_SLZ,(v_zone).w
    15.         bne.s   @notSLZ
    16.         move.w  #$4513,obGfx(a0)
    17.     @notSLZ:
    18.         cmpi.b  #id_SBZ,(v_zone).w
    19.         bne.s   @notSBZ
    20.         move.w  #$43F5,obGfx(a0)
    21.     @notSBZ:
    22.         move.b  #4,obRender(a0)
    23.         move.b  #$10,obActWid(a0)
    24.         move.b  #4,obPriority(a0)
    25.         move.b  obSubtype(a0),obFrame(a0)
    26.  
    Now open "_incObj\76 SYZ Boss Blocks.asm" and either delete or comment out the following lines:

    Code (ASM):
    1.  
    2.         lea Obj76_FragPos(pc),a5
    3.  
    Code (ASM):
    1.  
    2.         move.w  (a5)+,d3
    3.         add.w   d3,obX(a1)
    4.         move.w  (a5)+,d3
    5.         add.w   d3,obY(a1)
    6.  
    Code (ASM):
    1.  
    2. Obj76_FragPos:  dc.w -8, -8
    3.         dc.w $10, 0
    4.         dc.w 0, $10
    5.         dc.w $10, $10
    6.  
    and replace this:

    Code (ASM):
    1.  
    2. Obj76_FragSpeed:dc.w -$180, -$200
    3.         dc.w $180, -$200
    4.         dc.w -$100, -$100
    5.         dc.w $100, -$100
    6.  
    with this:

    Code (ASM):
    1.  
    2. Obj76_FragSpeed:dc.w -$180, -$200
    3.         dc.w -$100, -$100
    4.         dc.w $180, -$200
    5.         dc.w $100, -$100
    6.  
    Now open "_maps\Smashable Green Block.asm" and find this:

    Code (ASM):
    1.  
    2. Map_Smab:   dc.w @two-Map_Smab
    3.         dc.w @four-Map_Smab
    4.  
    5. @two:       dc.b 2
    6.         dc.b $F0, $D, 0, 0, $F0 ; two fragments, arranged vertically
    7.         dc.b 0, $D, 0, 0, $F0
    8. @four:      dc.b 4
    9.         dc.b $F0, 5, $80, 0, $F0 ; four fragments
    10.  
    11.         dc.b 0, 5, $80, 0, $F0
    12.  
    13.         dc.b $F0, 5, $80, 0, 0
    14.  
    15.         dc.b 0, 5, $80, 0, 0
    16.         even
    17.  
    and replace it with this:

    Code (ASM):
    1.  
    2. Map_Smab:   dc.w @two-Map_Smab, @topleft-Map_Smab
    3.         dc.w @bottomleft-Map_Smab, @topright-Map_Smab
    4.         dc.w @bottomright-Map_Smab
    5. @two:       dc.b 2
    6.         dc.b $F0, $D, 0, 0, $F0 ; two fragments, arranged vertically
    7.         dc.b 0, $D, 0, 0, $F0
    8. @topleft:       dc.b 1
    9.         dc.b $F0, 5, $80, 0, $F0 ; four fragments
    10. @bottomleft:    dc.b 1
    11.         dc.b 0, 5, $80, 0, $F0
    12. @topright:  dc.b 1
    13.         dc.b $F0, 5, $80, 0, 0
    14. @bottomright:   dc.b 1
    15.         dc.b 0, 5, $80, 0, 0
    16.         even
    17.  
    18. Map_Smab2:  dc.w @full-Map_Smab2, @topleft-Map_Smab2
    19.         dc.w @bottomleft-Map_Smab2, @topright-Map_Smab2
    20.         dc.w @bottomright-Map_Smab2
    21. @full:      dc.b 4
    22.         dc.b $F0, 5, $80, 0, $F0 ; four fragments
    23.         dc.b 0, 5, $80, 0, $F0
    24.         dc.b $F0, 5, $80, 0, 0
    25.         dc.b 0, 5, $80, 0, 0
    26. @topleft:       dc.b 1
    27.         dc.b $F0, 5, $80, 0, $F0 ; four fragments
    28. @bottomleft:    dc.b 1
    29.         dc.b 0, 5, $80, 0, $F0
    30. @topright:  dc.b 1
    31.         dc.b $F0, 5, $80, 0, 0
    32. @bottomright:   dc.b 1
    33.         dc.b 0, 5, $80, 0, 0
    34.         even
    35.  
    Now open "_maps\SYZ Boss Blocks.asm" and find this:

    Code (ASM):
    1.  
    2. Map_BossBlock:  dc.w @wholeblock-Map_BossBlock, @topleft-Map_BossBlock
    3.         dc.w @topright-Map_BossBlock, @bottomleft-Map_BossBlock
    4.         dc.w @bottomright-Map_BossBlock
    5. @wholeblock:    dc.b 2
    6.         dc.b $F0, $D, 0, $71, $F0
    7.         dc.b 0, $D, 0, $79, $F0
    8.         dc.b 0
    9. @topleft:   dc.b 1
    10.         dc.b $F8, 5, 0, $71, $F8
    11. @topright:  dc.b 1
    12.         dc.b $F8, 5, 0, $75, $F8
    13. @bottomleft:    dc.b 1
    14.         dc.b $F8, 5, 0, $79, $F8
    15. @bottomright:   dc.b 1
    16.         dc.b $F8, 5, 0, $7D, $F8
    17.         even
    18.  
    and replace it with this:

    Code (ASM):
    1.  
    2. Map_BossBlock:  dc.w @wholeblock-Map_BossBlock, @topleft-Map_BossBlock
    3.         dc.w @bottomleft-Map_BossBlock, @topright-Map_BossBlock
    4.         dc.w @bottomright-Map_BossBlock
    5. @wholeblock:    dc.b 2
    6.         dc.b $F0, $D, 0, $71, $F0
    7.         dc.b 0, $D, 0, $79, $F0
    8.         dc.b 0
    9. @topleft:   dc.b 1
    10.         dc.b $F0, 5, 0, $71, $F0
    11. @bottomleft:    dc.b 1
    12.         dc.b 0, 5, 0,   $79, $F0
    13. @topright:  dc.b 1
    14.         dc.b $F0, 5, 0, $75, 0
    15. @bottomright:   dc.b 1
    16.         dc.b 0, 5, 0,   $7D, 0
    17.         even
    18.  
    Finally, open "_incObj\sub SmashObject.asm" and find this:

    Code (ASM):
    1.  
    2. @loop:
    3.         bsr.w   FindFreeObj
    4.         bne.s   @playsnd
    5.         addq.w  #5,a3
    6.  
    and replace it with this:

    Code (ASM):
    1.  
    2. @loop:
    3.         bsr.w   FindFreeObj
    4.         bne.s   @playsnd
    5.         cmpi.b  #id_SmashWall,0(a0)
    6.         beq.s   @insteaduse5
    7.         addq.w  #6,a3
    8.         bra.s   @loadfrag
    9.     @insteaduse5:
    10.         addq.w  #5,a3
    11.  
    And that's that! Placing object 51 in SYZ, LZ, SLZ, and SBZ will now work.

    Smashable Walls

    Add Smashable Walls to MZ, LZ, SBZ

    Open "_maps\Smashable Walls.asm" and replace all the code with this:

    Code (ASM):
    1.  
    2. ; ---------------------------------------------------------------------------
    3. ; Sprite mappings - smashable walls (GHZ, SLZ, LZ)
    4. ; ---------------------------------------------------------------------------
    5. Map_Smash:  dc.w @left-Map_Smash
    6.         dc.w @middle-Map_Smash
    7.         dc.w @right-Map_Smash
    8.         dc.w @laby-Map_Smash
    9. @left:      dc.b 8
    10.         dc.b $E0, 5, 0, 0, $F0
    11.         dc.b $F0, 5, 0, 0, $F0
    12.         dc.b 0, 5, 0, 0, $F0
    13.         dc.b $10, 5, 0, 0, $F0
    14.         dc.b $E0, 5, 0, 4, 0
    15.         dc.b $F0, 5, 0, 4, 0
    16.         dc.b 0, 5, 0, 4, 0
    17.         dc.b $10, 5, 0, 4, 0
    18. @middle:    dc.b 8
    19.         dc.b $E0, 5, 0, 4, $F0
    20.         dc.b $F0, 5, 0, 4, $F0
    21.         dc.b 0, 5, 0, 4, $F0
    22.         dc.b $10, 5, 0, 4, $F0
    23.         dc.b $E0, 5, 0, 4, 0
    24.         dc.b $F0, 5, 0, 4, 0
    25.         dc.b 0, 5, 0, 4, 0
    26.         dc.b $10, 5, 0, 4, 0
    27. @right:     dc.b 8
    28.         dc.b $E0, 5, 0, 4, $F0
    29.         dc.b $F0, 5, 0, 4, $F0
    30.         dc.b 0, 5, 0, 4, $F0
    31.         dc.b $10, 5, 0, 4, $F0
    32.         dc.b $E0, 5, 0, 8, 0
    33.         dc.b $F0, 5, 0, 8, 0
    34.         dc.b 0, 5, 0, 8, 0
    35.         dc.b $10, 5, 0, 8, 0
    36. @laby:      dc.b 8
    37.         dc.b $E0, 5, 0, 0, $F0
    38.         dc.b $F0, 5, 0, 0, $F0
    39.         dc.b 0, 5, 0, 0, $F0
    40.         dc.b $10, 5, 0, 0, $F0
    41.         dc.b $E0, 5, 0, 0, 0
    42.         dc.b $F0, 5, 0, 0, 0
    43.         dc.b 0, 5, 0, 0, 0
    44.         dc.b $10, 5, 0, 0, 0
    45.         even
    46.  
    Now open "_incObj\3C Smashable Wall.asm" and replace this:

    Code (ASM):
    1.  
    2.         move.b  #4,obRender(a0)
    3.         move.b  #$10,obActWid(a0)
    4.         move.b  #4,obPriority(a0)
    5.         move.b  obSubtype(a0),obFrame(a0)
    6.  
    with this:

    Code (ASM):
    1.  
    2.     move.b  #4,obRender(a0)
    3.         move.b  #$10,obActWid(a0)
    4.         move.b  #4,obPriority(a0)
    5.         move.b  obSubtype(a0),obFrame(a0)
    6.         cmpi.b  #id_LZ,(v_zone).w ; check if level is LZ
    7.         bne.s   @notLZ
    8.         move.w  #$42FA,obGfx(a0) ; LZ specific code
    9.         move.b  #3,obFrame(a0)
    10.     @notLZ:
    11.         cmpi.b  #id_MZ,(v_zone).w ; check if level is MZ
    12.         bne.s   @notMZ
    13.         move.w  #$42B8,obGfx(a0) ; MZ specific code
    14.         move.b  #3,obFrame(a0)
    15.     @notMZ:
    16.         cmpi.b  #id_SBZ,(v_zone).w ; check if level is SBZ
    17.         bne.s   @notSBZ
    18.         move.w  #$43F5,obGfx(a0) ; SBZ specific code
    19.         move.b  #3,obFrame(a0)
    20.     @notSBZ:
    21.  
    Object 3C will now work in MZ, LZ, and SBZ!

    Swinging Platforms

    Adding those swinging platforms from GHZ and MZ to LZ.

    Open "_maps\Swinging Platforms (GHZ).asm" and add this to the end, after the "even".

    Code (ASM):
    1.  
    2. Map_Swing_LZ:   dc.w @block-Map_Swing_LZ
    3.         dc.w @chain-Map_Swing_LZ
    4.         dc.w @anchor-Map_Swing_LZ
    5. @block: dc.b 1
    6.         dc.b $F8, $D, 1, $26, $F0
    7. @chain:     dc.b 1
    8.         dc.b $F8, 5, 0, 0, $F8
    9. @anchor:    dc.b 1
    10.         dc.b $F8, 5, 0, $14, $F8
    11.         even
    12.  
    You might also want to alter the comment at the top of the file to mention LZ as well as GHZ and MZ.

    Now open "_incObj\15 Swinging Platforms (part 1).asm".

    Replace this:

    Code (ASM):
    1.  
    2.         move.w  obY(a0),origY(a0)
    3.         move.w  obX(a0),origX(a0)
    4.         cmpi.b  #id_SLZ,(v_zone).w ; check if level is SLZ
    5.         bne.s   @notSLZ
    6.  
    with this:

    Code (ASM):
    1.  
    2.         move.w  obY(a0),origY(a0)
    3.         move.w  obX(a0),origX(a0)
    4.        
    5.         cmpi.b  #id_LZ,(v_zone).w
    6.         bne.s   @notLZ
    7.         move.w  #$4310,obGfx(a0)
    8.         move.l  #Map_Swing_LZ,obMap(a0)
    9.         move.b  #$10,obActWid(a0)
    10.        
    11.     @notLZ:
    12.         cmpi.b  #id_SLZ,(v_zone).w ; check if level is SLZ
    13.         bne.s   @notSLZ
    14.  
    Also, replace this:

    Code (ASM):
    1.  
    2.         bcc.s   @notanchor
    3.         move.b  #2,obFrame(a1)
    4.         move.b  #3,obPriority(a1)
    5.         bset    #6,obGfx(a1)
    6.  
    with this:

    Code (ASM):
    1.  
    2.         bcc.s   @notanchor
    3.         move.b  #2,obFrame(a1)
    4.         move.b  #3,obPriority(a1)
    5.         cmpi.b  #id_LZ,(v_zone).w
    6.         beq.s   @notanchor
    7.         bset    #6,obGfx(a1)
    8.  
    Object 15 will now work in LZ!

    Collapsing Floors

    Adding Collapsing Floors to LZ

    Open "_maps\Collapsing Floor.asm" and replace the entire text with this:

    Code (ASM):
    1.  
    2. ; ---------------------------------------------------------------------------
    3. ; Sprite mappings - collapsing floors (MZ, SLZ, LZ, SBZ)
    4. ; ---------------------------------------------------------------------------
    5. Map_CFlo:   dc.w @mzsbzfull-Map_CFlo, @mzsbzcrumble-Map_CFlo
    6.         dc.w @slzfull-Map_CFlo, @slzcrumble-Map_CFlo
    7.         dc.w @lzfull-Map_CFlo, @lzcrumble-Map_CFlo
    8. @mzsbzfull: dc.b 4
    9.         dc.b $F8, $D, 0, 0, $E0 ; MZ and SBZ blocks
    10.         dc.b 8, $D, 0, 0, $E0
    11.         dc.b $F8, $D, 0, 0, 0
    12.         dc.b 8, $D, 0, 0, 0
    13. @mzsbzcrumble:  dc.b 8
    14.         dc.b $F8, 5, 0, 0, $E0
    15.         dc.b $F8, 5, 0, 0, $F0
    16.         dc.b $F8, 5, 0, 0, 0
    17.         dc.b $F8, 5, 0, 0, $10
    18.         dc.b 8, 5, 0, 0, $E0
    19.         dc.b 8, 5, 0, 0, $F0
    20.         dc.b 8, 5, 0, 0, 0
    21.         dc.b 8, 5, 0, 0, $10
    22. @slzfull:   dc.b 4
    23.         dc.b $F8, $D, 0, 0, $E0 ; SLZ blocks
    24.         dc.b 8, $D, 0, 8, $E0
    25.         dc.b $F8, $D, 0, 0, 0
    26.         dc.b 8, $D, 0, 8, 0
    27. @slzcrumble:    dc.b 8
    28.         dc.b $F8, 5, 0, 0, $E0
    29.         dc.b $F8, 5, 0, 4, $F0
    30.         dc.b $F8, 5, 0, 0, 0
    31.         dc.b $F8, 5, 0, 4, $10
    32.         dc.b 8, 5, 0, 8, $E0
    33.         dc.b 8, 5, 0, $C, $F0
    34.         dc.b 8, 5, 0, 8, 0
    35.         dc.b 8, 5, 0, $C, $10
    36. @lzfull:    dc.b 8              ;LZ blocks
    37.         dc.b $F8, 5, 0, 0, $E0
    38.         dc.b $F8, 5, 0, 0, $F0
    39.         dc.b $F8, 5, 0, 0, 0
    40.         dc.b $F8, 5, 0, 0, $10
    41.         dc.b 8, 5, 0, 0, $E0
    42.         dc.b 8, 5, 0, 0, $F0
    43.         dc.b 8, 5, 0, 0, 0
    44.         dc.b 8, 5, 0, 0, $10
    45. @lzcrumble: dc.b 8
    46.         dc.b $F8, 5, 0, 0, $E0
    47.         dc.b $F8, 5, 0, 0, $F0
    48.         dc.b $F8, 5, 0, 0, 0
    49.         dc.b $F8, 5, 0, 0, $10
    50.         dc.b 8, 5, 0, 0, $E0
    51.         dc.b 8, 5, 0, 0, $F0
    52.         dc.b 8, 5, 0, 0, 0
    53.         dc.b 8, 5, 0, 0, $10
    54.         even
    55.  
    Open "_incObj\53 Collapsing Floors.asm" and replace this:

    Code (ASM):
    1.  
    2.     @notSLZ:
    3.         cmpi.b  #id_SBZ,(v_zone).w ; check if level is SBZ
    4.         bne.s   @notSBZ
    5.         move.w  #$43F5,obGfx(a0) ; SBZ specific code
    6.  
    with this:

    Code (ASM):
    1.  
    2.     @notSLZ:
    3.         cmpi.b  #id_LZ,(v_zone).w ; check if level is LZ
    4.         bne.s   @notLZ
    5.         move.w  #$42FA,obGfx(a0) ; LZ specific code
    6.         addq.b  #4,obFrame(a0)
    7.    
    8.     @notLZ:
    9.         cmpi.b  #id_SBZ,(v_zone).w ; check if level is SBZ
    10.         bne.s   @notSBZ
    11.         move.w  #$43F5,obGfx(a0) ; SBZ specific code
    12.  
    Object 53 will now work in LZ!

    Modifying the Debug List

    In order to quickly and easily test out these new objects without having to edit the layouts, you can add the object IDs to the Debug List, allowing you to place them using Debug Mode.

    Open "_inc\DebugList.asm" and add these lines in the GHZ list:

    Code (ASM):
    1.  
    2.     dbug    Map_PRock,  id_PushBlock,   00$63D0
    3.  
    ...in the MZ list:

    Code (ASM):
    1.  
    2.     dbug    Map_Smash,  id_SmashWall,   03$42B8
    3.  
    ...in the SYZ list:

    Code (ASM):
    1.  
    2.     dbug    Map_FBlock, id_PushBlock, 0,    0$4000
    3.     dbug    Map_BossBlock,  id_SmashBlock, 0,   0$4000
    4.  
    ...in the LZ list:

    Code (ASM):
    1.  
    2.     dbug    Map_CFlo,   id_CollapseFloor,   04$42FA
    3.     dbug    Map_Swing_LZ,   id_SwingingPlatform, 4, 0, $4310
    4.     dbug    Map_Smab2,  id_SmashBlock,  00$42FA
    5.     dbug    Map_Smash,  id_SmashWall, 0,    3$42FA
    6.  
    ...in the SLZ list:

    Code (ASM):
    1.  
    2.     dbug    Map_Stair,  id_PushBlock,   00$4000
    3.     dbug    Map_Smab,   id_SmashBlock,  00$4513
    4.  
    ...in the SBZ list:

    Code (ASM):
    1.  
    2.     dbug    Map_Push,   id_PushBlock,   00$44BB
    3.     dbug    Map_Smab,   id_SmashBlock,  00$43F5
    4.     dbug    Map_Smash,  id_SmashWall,   03$43F5
    5.  
    Wrap-Up

    All of these edits will cause some branch out of range errors. To fix them:

    Open "_incObj\89 Ending Sequence STH.asm" and replace this code (both times it appears):

    Code (ASM):
    1.  
    2.         if Revision=0
    3.         bra.w   DisplaySprite
    4.         else
    5.         rts
    6.         endc
    7.  
    with this:

    Code (ASM):
    1.  
    2.         if Revision=0
    3.         jmp DisplaySprite
    4.         else
    5.         rts
    6.         endc
    7.  
    Open "_incObj\sub SolidObject.asm" and replace this code (both times it appears):

    Code (ASM):
    1.  
    2.     @stand:
    3.         move.w  d4,d2
    4.         bsr.w   MvSonicOnPtfm
    5.         moveq   #0,d4
    6.         rts
    7.  
    with this:

    Code (ASM):
    1.  
    2.     @stand:
    3.         move.w  d4,d2
    4.         jsr MvSonicOnPtfm
    5.         moveq   #0,d4
    6.         rts
    7.  
    The Debug Cheat

    Also, am I the only one who hates entering the Debug Cheat? To make things easier (while testing, at least), open "sonic.asm" and replace this:

    Code (ASM):
    1.  
    2.     Level_ChkDebug:
    3.         tst.b   (f_debugcheat).w ; has debug cheat been entered?
    4.  
    with this:

    Code (ASM):
    1.  
    2.     Level_ChkDebug:
    3.         tst.b   (f_levselcheat).w ; has debug cheat been entered?
    4.  
    5.  
    Now all you have to do is enter the level select cheat (up, down, left, right, hold A and press start) on the title screen, and hold A while a Zone loads to have Debug Mode active.



    Here is a .zip archive of both the split disasm and the built rom: Download

    These are the old files from the original post. I've left them here in case someone needs them; if you don't, just ignore them.
    Please let me know if you find any mistakes or otherwise suboptimal code in this guide.

    Thanks, and enjoy! :)
     
  2. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    I like where this is going.

    Unfortunately you can't do the same with the badniks because of VRAM limitations, but since suitable graphics for blocks are usually already loaded in VRAM for other reasons (e.g. platforms or whatever), I'm sure you can develop many universal object in this way.

    Actually I'm surprised nobody ever thought of this before, this is a simple idea, yet it's really neat and can provide some more variety to the mix.
     
  3. Ell678

    Ell678

    Am I Annoying You? Member
    2,378
    25
    28
    Barrow, England
    Sonic Incursion
    This is such a fantastic idea, and as Ninkeo said, surprising nobody has thought of it before. Good work!
     
  4. FuzzballFox

    FuzzballFox

    Hmmmmm Member
    575
    0
    0
    UK - Hampshire
    Nothing anymore
    Pushing rocks eh? Makes me think of LBP...
    I can imagine finding a rock high up that you can push off a cliff and about to let you find secret areas you couldn't normally reach by mearly jumping~ :3
     
  5. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,202
    432
    63
    Japan
    haha, someone's been busy with research =P

    Impressive and a clever idea at that, should be worth implementing somewhere at sometime.
     
  6. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    I tested this a bit, there are some things which should be refined.

    The new blocks don't interact with other objects, so they fall through bridges and collapsing platforms...
    [​IMG] [​IMG]

    [​IMG]
    ... and through switches as well, even though the original MZ block can be used to trigger switches.

    There seem to be some problems with slopes as well:
    [​IMG] [​IMG]
    Depending on the direction you're pushing the block from, it might even disappear into the slope and reappear somewhere near.

    This made me laugh instead:
    [​IMG]
    Yes, it works, and it's not a bug. It just made me laugh :)
     
  7. Hanoch

    Hanoch

    Also known as TheKnock, Birashot Member
    491
    0
    0
    Israel
    everything
    I always thought the LZ block was used to move along the water.
     
  8. stormislandgal

    stormislandgal

    It's not a phase! Tech Member
    4,534
    10
    18
    Married life <3
    Incorrect, if I'm reading your idea correctly. I once set up a system where the badniks would load their own graphics in their creation event, where the graphics would be loaded into different areas of the VRAM based on what zone they were in. It required taking the art and leaving it uncompressed, but it was actually pretty snazzy. With proper and well thought out placement of badniks, I was able to have every badnik in the game show up in Green Hill, though things did get a bit dicey if I slowed down to allow the badniks to get out of their intended range. (IE, I had a Motobug and a Ball Hog fighting for VRAM space when I allowed the Motobug to tail me to a different section of the level.)

    Still, neat idea, Mercury. I intended to try this at one point but didn't know where to start. By the time I'd figured it out, I didn't care anymore. Keep it up, I have a feeling there's a bright future in store for you.
     
  9. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,202
    432
    63
    Japan
    Doesn't S3&K do something similar in that regard? Something about decompressing tiles on the fly, unless I'm mistaken of course. On the subject of having two different objects aquiring the same VRam space for art, you could set up some sort of cue in VRam where if one object is on screen and using the specific art, the second object should dump the art to an alternate location, and change its sprite values, though I'd imagine the processing time would be terrible. Still it would be worth trying for some sort of POC hack.
     
  10. Mercury

    Mercury

    His Name Is Sonic Tech Member
    1,740
    21
    18
    Location Location
    AeStHete
    Curse you, Yuji Naka, these things wouldn't happen in my GM engine! :argh:

    It looks like this is going to be a long-lasting project if I want to iron out all of those bugs.

    Both Sonic and Tails can deform the bridges in Sonic 2, so maybe getting the rocks to do so won't be impossible...? I'll look into it if I get time.
     
  11. Hanoch

    Hanoch

    Also known as TheKnock, Birashot Member
    491
    0
    0
    Israel
    everything
    Why rerwrite the object collision engine for the rock if you could just make an object check looping (See touchresponse) and if the rock finds a bridge or anything solid, make the rock set its position with the object (like the floor collision works)
     
  12. Mercury

    Mercury

    His Name Is Sonic Tech Member
    1,740
    21
    18
    Location Location
    AeStHete
    Uh-oh! I made a bit of a mistake here:

    I should have said this:

    Otherwise, the GHZ/SLZ Smashable Walls will have screwy mappings.

    I've fixed the OP and the download link (for the asm .zip, not the built rom).
     
  13. Mercury

    Mercury

    His Name Is Sonic Tech Member
    1,740
    21
    18
    Location Location
    AeStHete
    Bump for big update!

    I've added...

    • Smashable Walls to MZ, LZ, and SBZ
    • Collapsing Floors and Swinging Platforms to LZ
    • Breakable Blocks to LZ, SLZ, and SBZ
    • Pushable Blocks to SLZ and SBZ


    Make sure to re-read the guide carefully - there's quite a bit I had to change to get it all working. Also, LZ needs some new graphics, so don't neglect to download the small file I provide!
     
  14. dsrb

    dsrb

    Member
    3,149
    0
    16
    Just wondering, is there anyone who's implemented these and could make a video? I'd be interested to see them in action.
     
  15. Mercury

    Mercury

    His Name Is Sonic Tech Member
    1,740
    21
    18
    Location Location
    AeStHete
    I provide a built rom in the download. You can use level select and debug mode and try them out for yourself. :)
     
  16. Fred

    Fred

    Taking a break Oldbie
    1,563
    117
    43
    Portugal
    Sonic 3 Unlocked
    Out of curiosity, does the built ROM work for you?
     
  17. dsrb

    dsrb

    Member
    3,149
    0
    16
    Gah, silly me! I kinda TL;DRd at all the code, and didn't notice that bit. However, it doesn't work in Fusion; I get a black screen, Checksum Incorrect message, nonsense title, etc.
     
  18. DigitalDuck

    DigitalDuck

    Arriving four years late. Member
    5,351
    438
    63
    Lincs, UK
    TurBoa, S1RL
    Options --> Set Config --> Genesis --> AutoFix Checksums.
     
  19. dsrb

    dsrb

    Member
    3,149
    0
    16
    …which will do nothing to address the more important issue of the ROM not booting at all.

    That said, I left it on for a few seconds and Fusion eventually emitted 4 weird static-y tones, though I doubt that narrows the problem down.
     
  20. Alan

    Alan

    Member
    141
    0
    0
Thread Status:
Not open for further replies.