Actions

SCHG How-to

Extend the level index past $10 in Sonic 2

From Sonic Retro

Revision as of 03:17, 29 April 2008 by Kram1024 (talk | contribs) (New page: '''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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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, $40, $40, $1C; Use index $40 to load the "ZONE" string 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.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, $44, $48, 8  ; Use index $44 for "SONIC THE HEDGEHOG" string dc.w $2A8, $168,$120

dc.b 6, $45, 8, $15  ; Use index $45 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.