Actions

SCHG How-to

Difference between revisions of "Extend the water tables in Sonic 2"

From Sonic Retro

m (Hg disassembly: you sir, are doing it wrong)
Line 103: Line 103:
  
 
==Hg disassembly==
 
==Hg disassembly==
Now with 90% more easy!
+
Near the top of s2.asm, you should see the following:
 
+
<asm>useFullWaterTables = 0
First, find WaterHeight, which should look like this:
+
; | If 1, zone offset tables for water levels cover all level slots instead of only slots 8-$F
<asm>
+
; | Set to 1 if you've shifted level IDs around or you want water in levels with a level slot below 8</asm>
WaterHeight:
+
Simply change the 0 to 1 and you're done. You can then use the WaterHeight table inbetween the lines "if useFullWaterTables" and "else", which has slots for all the levels.
dc.w  $600, $600 ; HPZ
 
dc.w  $600, $600 ; Zone 9
 
dc.w  $600, $600 ; OOZ
 
dc.w  $600, $600 ; MCZ
 
dc.w  $600, $600 ; CNZ
 
dc.w  $600, $710 ; CPZ
 
dc.w  $600, $600 ; DEZ
 
dc.w  $410, $510 ; ARZ
 
    endif
 
</asm>
 
Change it to this:
 
<asm>
 
WaterHeight:
 
        dc.w  $600, $600        ; 0  ; EHZ
 
        dc.w  $600, $600        ; 1
 
        dc.w  $600, $600        ; 2  ; WZ
 
        dc.w  $600, $600        ; 3
 
        dc.w  $600, $600        ; 4  ; MTZ
 
        dc.w  $600, $600        ; 5  ; MTZ3
 
        dc.w  $600, $600        ; 6  ; WFZ
 
        dc.w  $600, $600        ; 7  ; HTZ
 
        dc.w  $600, $600        ; 8  ; HPZ
 
        dc.w  $600, $600        ; 9
 
        dc.w  $600, $600        ; $A  ; OOZ
 
        dc.w  $600, $600        ; $B  ; MCZ
 
        dc.w  $600, $600        ; $C  ; CNZ
 
        dc.w  $600, $710        ; $D  ; CPZ
 
        dc.w  $600, $600        ; $E  ; DEZ
 
        dc.w  $410, $510        ; $F  ; ARZ
 
        dc.w  $600, $600        ; $10 ; SCZ
 
    endif
 
</asm>
 
Done. Wasn't that easy?
 
 
 
  
 
{{S2Howtos}}
 
{{S2Howtos}}
 
[[Category:SCHG How-tos|Extend the water tables in Sonic 2]]
 
[[Category:SCHG How-tos|Extend the water tables in Sonic 2]]

Revision as of 14:48, 2 February 2013

(Original guide by Dani)

If you have tried to add water to a zone ID between $00 and $07, you may have noticed strange effects with the water, such as the entire level filling with water or no water showing up at all (only the water line). To correct this problem, several changes need to be done to your disassembly. (This guide will use the Xenowhirl 2007 Sonic 2 disassembly; other disassemblies may vary.)

Xenowhirl's 2007 disassembly

First, find the section marked loc_402C and find the following line: <asm> subi.w #$800,d0</asm>

and either comment it out or delete it entirely.

Next, locate the following: <asm> WaterHeight:

   dc.w  $600, $600, $600, $600
   dc.w  $600, $600, $600, $600
   dc.w  $600, $600, $600, $710
   dc.w  $600, $600, $410, $510

</asm>

and change it to: <asm>WaterHeight:

   dc.w  $600, $600; EHZ
   dc.w  $600, $600; Zone 01
   dc.w  $600, $600; WZ
   dc.w  $600, $600; Zone 03
   dc.w  $600, $600; MZ
   dc.w  $600, $600; MZ3
   dc.w  $600, $600; WFZ
   dc.w  $600, $600; HTZ
   dc.w  $600, $600; HPZ
   dc.w  $600, $600; Zone 09
   dc.w  $600, $600; OOZ
   dc.w  $600, $600; MCZ
   dc.w  $600, $600; CNZ
   dc.w  $600, $710; CPZ
   dc.w  $600, $600; DEZ
   dc.w  $410, $510; ARZ
   dc.w  $600, $600; SCZ</asm>

Next, in the section marked DynamicWater, locate the following line: <asm> subi.w #$800,d0</asm>

and either comment it out or delete it entirely.

Next, locate this section: <asm>Dynamic_water_routine_table:

   dc.w DynamicWaterNull - Dynamic_water_routine_table; 0
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 3
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 4
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 5
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 6
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 7
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 8
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 9
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 10
   dc.w DynamicWaterCPZ2 - Dynamic_water_routine_table; 11 ; the only one that does anything
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 12
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 13
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 14
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 15</asm>

and replace the section with: <asm>Dynamic_water_routine_table:

   dc.w DynamicWaterNull - Dynamic_water_routine_table; EHZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; EHZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 01-1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 01-2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; WZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; WZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 03-1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 03-2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; MZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; MZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; MZ3
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 05-2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; WFZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; WFZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; HTZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; HTZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; HPZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; HPZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 09-1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; 09-2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; OOZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; OOZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; MCZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; MCZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; CNZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; CNZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; CPZ1
   dc.w DynamicWaterCPZ2 - Dynamic_water_routine_table; CPZ2 ; the only one that does anything
   dc.w DynamicWaterNull - Dynamic_water_routine_table; DEZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; DEZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; ARZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; ARZ2
   dc.w DynamicWaterNull - Dynamic_water_routine_table; SCZ1
   dc.w DynamicWaterNull - Dynamic_water_routine_table; SCZ2</asm>

Once these changes have been made, you will be able to add water to any zone in Sonic the Hedgehog 2. If you run into any problems, please let me know and/or get it working and edit this article.

Hg disassembly

Near the top of s2.asm, you should see the following: <asm>useFullWaterTables = 0

| If 1, zone offset tables for water levels cover all level slots instead of only slots 8-$F
| Set to 1 if you've shifted level IDs around or you want water in levels with a level slot below 8</asm>

Simply change the 0 to 1 and you're done. You can then use the WaterHeight table inbetween the lines "if useFullWaterTables" and "else", which has slots for all the levels.

SCHG How-To Guide: Sonic the Hedgehog 2 (16-bit)
Fixing Bugs
Fix Demo Playback | Fix a Race Condition with Pattern Load Cues | Fix Super Sonic Bugs | Use Correct Height When Roll Jumping | Fix Jump Height Bug When Exiting Water | Fix Screen Boundary Spin Dash Bug | Correct Drowning Bugs | Fix Camera Y Position for Tails | Fix Tails Subanimation Error | Fix Tails' Respawn Speeds | Fix Accidental Deletion of Scattered Rings | Fix Ring Timers | Fix Rexon Crash | Fix Monitor Collision Bug | Fix EHZ Deformation Bug | Correct CPZ Boss Attack Behavior | Fix Bug in ARZ Boss Arrow's Platform Behavior | Fix ARZ Boss Walking on Air Glitch | Fix ARZ Boss Sprite Behavior | Fix Multiple CNZ Boss Bugs | Fix HTZ Background Scrolling Mountains | Fix OOZ Launcher Speed Up Glitch | Fix DEZ Giant Mech Collision Glitch | Fix Boss Deconstruction Behavior | Fix Speed Bugs | Fix 14 Continues Cheat | Fix Debug Mode Crash | Fix 99+ Lives | Fix Sonic 2's Sega Screen
Design Choices
Remove the Air Speed Cap | Disable Floor Collision While Dying | Modify Super Sonic Transformation Methods & Behavior | Enable/Disable Tails in Certain Levels | Collide with Water After Being Hurt | Retain Rings When Returning at a Star Post | Improve the Fade In\Fade Out Progression Routines | Fix Scattered Rings' Underwater Physics | Insert LZ Water Ripple Effect | Restore Lost CPZ Boss Feature | Prevent SCZ Tornado Spin Dash Death | Improve ObjectMove Subroutines | Port S3K Rings Manager | Port S3K Object Manager | Port S3K Priority Manager | Edit Level Order with ASM‎ | Alter Ring Requirements in Special Stages | Make Special Stage Characters Use Normal DPLCs | Speed Up Ring Loss Process | Change spike behaviour in Sonic 2
Adding Features
Create Insta-kill and High Jump Monitors | Create Clone and Special Stage Monitors | Port Knuckles
Sound Features
Expand Music Index to Start at $00 | Port Sonic 1 Sound Driver | Port Sonic 2 Clone Driver | Port Sonic 3 Sound Driver | Port Flamewing's Sonic 3 & Knuckles Sound Driver | Expand the Music Index to Start at $00 (Sonic 2 Clone Driver Version) | Play Different Songs Per Act
Extending the Game
Extend the Level Index Past $10 | Extend the Level Select | Extend Water Tables | Add Extra Characters | Free Up 2 Universal SSTs