Actions

SCHG How-to

Difference between revisions of "Extend the level index past $10 in Sonic 2"

From Sonic Retro

Line 37: Line 37:
 
dc.w $240, $120, $B8
 
dc.w $240, $120, $B8
  
dc.b  $A,  $40, $40, $1C;  Use index $40 to load the "ZONE" string
+
dc.b  $A,  $21, $40, $1C;  Use index $21 to load the "ZONE" string
 
dc.w  $28, $148, $D0
 
dc.w  $28, $148, $D0
  
dc.b  $C,  $41, $18, $1C;  Use index $41 as the index for act 1, $42 for act 2, $43 for act 3
+
dc.b  $C,  $22, $18, $1C;  Use index $22 as the index for act 1, $23 for act 2, $24 for act 3
 
dc.w  $68, $188, $D0
 
dc.w  $68, $188, $D0
  
Line 46: Line 46:
 
dc.w    0,    0,  0
 
dc.w    0,    0,  0
  
dc.b    4,  $44, $48,  8;  Use index $44 for "SONIC THE HEDGEHOG" string
+
dc.b    4,  $25, $48,  8;  Use index $25 for "SONIC THE HEDGEHOG" string
 
dc.w $2A8, $168,$120
 
dc.w $2A8, $168,$120
  
dc.b    6,  $45,  8, $15;  Use index $45 for red panel edge
+
dc.b    6,  $26,  8, $15;  Use index $26 for red panel edge
 
dc.w  $80,  $F0, $F0
 
dc.w  $80,  $F0, $F0
 
</asm>
 
</asm>
Line 66: Line 66:
 
lea (a0,d0.w),a0
 
lea (a0,d0.w),a0
 
move.l #$7BC00002,d0
 
move.l #$7BC00002,d0
 +
</asm>
 +
 +
and replace it with:
 +
<asm>
 +
 
</asm>
 
</asm>

Revision as of 04:07, 29 April 2008

WARNING: I strongly recommend you port the sonic1 sound driver first before proceeding. A lot of major data shifting will occur in this tutorial and it will make the rom size a lot bigger than it was before. This will break the sonic2 or even sonic2 beta sound driver, thus so you definitely want the sonic 1 sound driver due to the fact that it can take the shifting and still work properly.


You probably noticed that all the indexes in the game stop at $10 and when you try to extend it, by extending the MLLB, you get weird glitches or even crashes, that is because you haven't extended all the indexes that need to be extended.

first we will look at the data that defines the titlecard layout:

<asm>

word_13CD4

Obj34_TitleCardData: dc.b 8, 0, $80, $1B dc.w $240, $120, $B8

dc.b $A, $11, $40, $1C dc.w $28, $148, $D0

dc.b $C, $12, $18, $1C dc.w $68, $188, $D0

dc.b 2, 0, 0, 0 dc.w 0, 0, 0

dc.b 4, $15, $48, 8 dc.w $2A8, $168,$120

dc.b 6, $16, 8, $15 dc.w $80, $F0, $F0 </asm>

we want to change it to:

<asm>

word_13CD4

Obj34_TitleCardData: dc.b 8, 0, $80, $1B; Index 0 is the start of Zone names dc.w $240, $120, $B8

dc.b $A, $21, $40, $1C; Use index $21 to load the "ZONE" string dc.w $28, $148, $D0

dc.b $C, $22, $18, $1C; Use index $22 as the index for act 1, $23 for act 2, $24 for act 3 dc.w $68, $188, $D0

dc.b 2, 0, 0, 0; I have no idea what this is. dc.w 0, 0, 0

dc.b 4, $25, $48, 8; Use index $25 for "SONIC THE HEDGEHOG" string dc.w $2A8, $168,$120

dc.b 6, $26, 8, $15; Use index $26 for red panel edge dc.w $80, $F0, $F0 </asm>

That change allows us to make room for our 64 expanded level IDs, leaving $40 as the special stage.

Next we locate: <asm>

loc_157D2

LoadTitleCard: bsr.s LoadTitleCard0 moveq #0,d0 move.b (Current_Zone).w,d0 move.b byte_15820(pc,d0.w),d0 lea word_15832(pc),a0 lea (a0,d0.w),a0 move.l #$7BC00002,d0 </asm>

and replace it with: <asm>

</asm>