Difference between revisions of "Have a functional Eggman monitor in Sonic 1"
From Sonic Retro
Scarred Sun (talk | contribs) m (Text replace - '[[Category:SCHG How-tos|' to '{{S1Howtos}} [[Category:SCHG How-tos|') |
m (ASM code colours) |
||
Line 3: | Line 3: | ||
Find this code: | Find this code: | ||
− | < | + | <asm>Obj2E_ChkEggman: ; XREF: Obj2E_Move |
addq.b #2,$24(a0) | addq.b #2,$24(a0) | ||
move.w #29,$1E(a0) | move.w #29,$1E(a0) | ||
Line 9: | Line 9: | ||
cmpi.b #1,d0; does monitor contain Eggman? | cmpi.b #1,d0; does monitor contain Eggman? | ||
bne.s Obj2E_ChkSonic | bne.s Obj2E_ChkSonic | ||
− | rts ; Eggman monitor does nothing</ | + | rts ; Eggman monitor does nothing</asm>And replace it with this: |
− | < | + | <asm>Obj2E_ChkEggman: ; XREF: Obj2E_Move |
addq.b #2,$24(a0) | addq.b #2,$24(a0) | ||
move.w #29,$1E(a0) | move.w #29,$1E(a0) | ||
Line 21: | Line 21: | ||
jsr Touch_ChkHurt ; run the Touch_ChkHurt routine | jsr Touch_ChkHurt ; run the Touch_ChkHurt routine | ||
move.l (sp)+,a0 ; pop the previous value of a0 from the stack, and increment stack pointer | move.l (sp)+,a0 ; pop the previous value of a0 from the stack, and increment stack pointer | ||
− | rts ; The Eggman monitor now does something!</ | + | rts ; The Eggman monitor now does something!</asm>Simple, isn't it? And it's set up in a way to use the regular "Touch_ChkHurt" routine, so shields and invincibilities are already taken in account by existing code, and the Eggman monitor will damage you like every other hazard would.{{S1Howtos}} |
[[Category:SCHG How-tos|Have_a_functional_Eggman_monitor_in_Sonic_1]] | [[Category:SCHG How-tos|Have_a_functional_Eggman_monitor_in_Sonic_1]] |
Revision as of 08:45, 30 April 2013
(Original guide by nineko) This very simple guide will tell you how to get a functional Eggman monitor in Sonic 1. It targets the Hivebrain 2005 Disassembly.
Find this code: <asm>Obj2E_ChkEggman: ; XREF: Obj2E_Move
addq.b #2,$24(a0) move.w #29,$1E(a0) move.b $1C(a0),d0 cmpi.b #1,d0; does monitor contain Eggman? bne.s Obj2E_ChkSonic rts ; Eggman monitor does nothing</asm>And replace it with this:
<asm>Obj2E_ChkEggman: ; XREF: Obj2E_Move
addq.b #2,$24(a0) move.w #29,$1E(a0) move.b $1C(a0),d0 cmpi.b #1,d0; does monitor contain Eggman? bne.s Obj2E_ChkSonic ; if not, go and check for the next monitor type (1-up icon) move.l a0,a1 ; move a0 to a1, because Touch_ChkHurt wants the damaging object to be in a1 move.l a0,-(sp) ; push a0 on the stack, and decrement stack pointer lea ($FFFFD000).w,a0 ; put Sonic's ram address in a0, because Touch_ChkHurt wants the damaged object to be in a0 jsr Touch_ChkHurt ; run the Touch_ChkHurt routine move.l (sp)+,a0 ; pop the previous value of a0 from the stack, and increment stack pointer rts ; The Eggman monitor now does something!</asm>Simple, isn't it? And it's set up in a way to use the regular "Touch_ChkHurt" routine, so shields and invincibilities are already taken in account by existing code, and the Eggman monitor will damage you like every other hazard would.