Actions

SCHG How-to

Difference between revisions of "Have a functional Eggman monitor in Sonic 1"

From Sonic Retro

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:
<pre>Obj2E_ChkEggman:    ; XREF: Obj2E_Move
+
<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</pre>And replace it with this:
+
         rts    ; Eggman monitor does nothing</asm>And replace it with this:
<pre>Obj2E_ChkEggman:    ; XREF: Obj2E_Move
+
<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!</pre>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}}
+
         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.
SCHG How-To Guide: Sonic the Hedgehog (16-bit)
Fixing Bugs
Fix Demo Playback | Fix a Race Condition with Pattern Load Cues | Fix the SEGA Sound | Display the Press Start Button Text | Fix the Level Select Menu | Fix the Hidden Points Bug | Fix Accidental Deletion of Scattered Rings | Fix Ring Timers | Fix the Walk-Jump Bug | Correct Drowning Bugs | Fix the Death Boundary Bug | Fix the Camera Follow Bug | Fix Song Restoration Bugs | Fix the HUD Blinking | Fix the Level Select Graphics Bug | Fix a remember sprite related bug
Changing Design Choices
Change Spike Behavior | Collide with Water After Being Hurt | Fix Special Stage Jumping Physics | Improve the Fade In\Fade Out Progression Routines | Fix Scattered Rings' Underwater Physics | Remove the Speed Cap | Port the REV01 Background Effects | Port Sonic 2's Level Art Loader | Retain Rings Between Acts | Add Sonic 2 (Simon Wai Prototype) Level Select | Improve ObjectMove Subroutines | Port Sonic 2 Level Select
Adding Features
Add Spin Dash ( Part 1 / Part 2 / Part 3 / Part 4 ) | Add Eggman Monitor | Add Super Sonic | Add the Air Roll
Sound Features
Expand the Sound Index | Play Different Songs Per Act | Port Sonic 2 Final Sound Driver | Port Sonic 3's Sound Driver | Port Flamewing's Sonic 3 & Knuckles Sound Driver | Change The SEGA Sound
Extending the Game
Load Chunks From ROM | Add Extra Characters | Make an Alternative Title Screen | Use Dynamic Tilesets | Make GHZ Load Alternate Art | Make Ending Load Alternate Art | Add a New Zone | Set Up the Goggle Monitor | Add New Moves | Add a Dynamic Collision System | Dynamic Special Stage Walls System | Extend Sprite Mappings and Art Limit | Enigma Credits | Use Dynamic Palettes
Miscellaneous
Convert the Hivebrain 2005 Disassembly to ASM68K
Split Disassembly Guides
Set Up a Split Disassembly | Basic Level Editing | Basic Art Editing | Basic ASM Editing (Spin Dash)