Sonic and Sega Retro Message Board: Sonic 2 Timer Reversal - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

Sonic 2 Timer Reversal count down from 9:59

#1 User is offline xenoSonic 

Posted 11 June 2005 - 03:30 PM

  • Posts: 25
  • Joined: 13-April 04
  • Wiki edits:9
I figured out, with some help, how to do this a while back. It makes sense that if there's a time limit, the time remaining on that limit should be displayed, not the time elapsed.

I had wanted to keep it as a unique feature for my hack, but I've decided to share my notes on how to do this ^_^ And yes, this requires use of hex :P


Part 1: Setting things up

This is where everything is set to respond to the timer reaching 0:00, instead of 9:59.
Simply make the following changes to your ROM:

$040816:0000 }
$04082E:0000 } timer flashes
$04086C:0000 } at minute 0
$040884:0000 }
$040DEC:0000 = 0 mins for time over
$040DEE:003B = 0 secs for time over


Part 2: Starting the timer at 9:59

This simply initialises the timer to 9:59. The code also takes into account star posts, so they remember the time at which they were activated.
Find a blank space in your ROM, 40 (28 in hex) bytes long, where XXXXXX is the offset of this blank space.

$004234: 4EF900XXXXXX       //jump to offset $XXXXXX

At offset $XXXXXX, add the following data (one continuous data string; I split it into separate lines to explain the code):

$XXXXXX: 4EB900017AA4       //do the code what was replaced

0C780000FE2266140C780000FE24660C   //check if time is 0:00 before updating (for starposts)
31FC3C3CFE2431FC0009FE22     //copy 9 to mins, 59 to secs, if the above is true
4EF90000423A       //return to start point

EDIT: The reason for checking the time is 0:00 is so that the star posts "remember" the time you passed them. If this check wasn't in place, the time would always restart at 9:59 (thus allowing the player to pass one at 0:01 left, die, then get a fresh 9:59). As the game clears the timer to 0:00 before loading a level, the code sets the time to 9:59 only when a level loads.


Part 3: The Countdown

This bit starts the timer counting backwards. Find another blank space in your ROM, 18 (12 in hex) bytes long, where YYYYYY is the offset of this space.

$040E12: 4EF900YYYYYY

At offset $YYYYYY, add the following data:

0C780000FE2431FC3C3CFE244EF900040E18     //restarts the seconds at 59 after reaching 00

Then finally, make the following changes:

$040E00:5321 = seconds count down
$040E0C:5321 = minutes count down


This may seem obvious, but when adding data, make sure you are overwriting what's there, and ALWAYS make a backup!

Hope this helps anyone who wishes to utilise a countdown timer.


EDIT: Corrections made to code/data; incompatabilities with Kega now resolved.


EDIT: A minor 'bug' exists that causes the timer to not update correctly when resuming at a starpost after a time-over. The game clears the stored time on a time-over event, and thus the timer isn't set properly. To prevent the game clearing the stored time after a time-over, go to offset $014034 and write "4E714E71".
This post has been edited by xenoSonic: 08 October 2005 - 06:22 PM

#2 User is offline Kles 

Posted 11 June 2005 - 07:09 PM

  • Posts: 2460
  • Joined: 14-March 04
  • Gender:Male
  • Location:Ontario
  • Wiki edits:5
Didn't LOst do something like this in his one hack?

#3 User is offline Tweaker 

Posted 11 June 2005 - 07:15 PM

  • Posts: 12389
  • Joined: 27-June 04
  • Gender:Male
Nope. But LOst helped Xeno do this, and it's some excellent work.

xenoSonic for member pls.
This post has been edited by Tweaker: 11 June 2005 - 07:18 PM

#4 User is offline Shadow Fire 

Posted 11 June 2005 - 09:38 PM

  • Ultimate victory!
  • Posts: 1557
  • Joined: 05-February 05
  • Gender:Male
  • Location:The Land of Darkness
  • Project:Sonic: The Lost Land (Series), The GCN (site)
  • Wiki edits:60

Tweaker, on Jun 11 2005, 07:15 PM, said:

xenoSonic for member pls.

Screw that...

xeno for Techie! XD

#5 User is offline Tweaker 

Posted 11 June 2005 - 09:47 PM

  • Posts: 12389
  • Joined: 27-June 04
  • Gender:Male

Shadow Fire, on Jun 11 2005, 10:38 PM, said:

Tweaker, on Jun 11 2005, 07:15 PM, said:

xenoSonic for member pls.

Screw that...

xeno for Techie! XD

Nope.

Not yet, anyway. Only time will tell...

#6 User is offline Syren 

Posted 12 June 2005 - 07:34 AM

  • Posts: 4331
  • Joined: 20-March 04
  • Gender:Male
  • Location:Teesside, UK
  • Project:Reintergration
Hey, this is handy for people who know nothing about ASM, it kinda gives an insight on something slightly easy. ^_^ Thanks! I might actually do something with this!

#7 User is offline xenoSonic 

Posted 12 June 2005 - 09:53 AM

  • Posts: 25
  • Joined: 13-April 04
  • Wiki edits:9
Additional info:

http://forums.sonicr...?showtopic=4692
This post has been edited by xenoSonic: 13 June 2005 - 12:15 PM

#8 User is offline Tweaker 

Posted 12 June 2005 - 09:57 AM

  • Posts: 12389
  • Joined: 27-June 04
  • Gender:Male
Okay, I concur. xenoSonic for Tech Member!

This is some great work, seriously. As if there wasn't enough in your hack, you take it even further. Great job. :thumbsup:

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users