Sonic and Sega Retro Message Board: Sonic 2 Time Bonuses - 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 Time Bonuses how to edit

#1 User is offline xenoSonic 

Posted 13 June 2005 - 12:14 PM

  • Posts: 27
  • Joined: 13-April 04
  • Wiki edits:9
If you've implemented the reverse timer, and finished a level, you'll notice that the time bonus still operates as if the timer was still counting upwards. There is a routine at offset $019480 that handles the time bonuses.

I have tried to figure out how to get this to follow the timer backwards, but it's proving tricky, so I've come up with another solution that will allow the editing and setting of time bonuses whichever direction the timer is going. Again, this will require the use of hex, and some thinking.

The following are my notes, and are much less of a 'guide' than how to set the timer going backwards.


$019480 - time bonus code starts here
$019494:00XX - XX-second interval per point-break
$019496:72YY - There are YY point-breaks
$0194D2 to $0194FC - The values for the bonuses.  These values are multiplied by 10 (0A in hex), to get the true point allocation.

The default values for XX and YY are 0F and 14 respectively, and the amount of values between $0194D2 and $0194FC reflect this. If you wish to add more, then a little bit of programming will be required.

To do this, find a blank space in your ROM, large enough to house your new point value 'array' (if you require point breaks every 10 seconds, and need this to happen for the full 10 minutes, you will need 60 (3C in hex) bytes of free space, plus an additional 6 bytes (which will be explained later)), where ZZZZZZ is the offset of this blank space.

$0194A0: add 4EF900ZZZZZZ - this adds a pointer to offset $ZZZZZZ.
$ZZZZZZ: add 31FB00##F7D24EF9000194A6 - ## = how many bytes to skip to get to the bonus point list.
$ZZZZZZ + ##: this is where the values for the bonuses go.  Make sure you add enough values to cover the time period you wish to allocate bonuses for, and  remember, the value you input is multiplied by 10 (0A)!.

IMPORTANT NOTE: if you are using the reverse timer, you will need to put this list in reverse order, and pad the beginning with 0000's until the full 10 minutes are accounted for (example below). This is due to how the code for allocating the bonuses works - it always starts from 0:00 and counts upwards (I haven't yet figured out how to get this code to follow the timer backwards).

Now, when you've input all the relevant values, you need to point the game back to the original programming (this is where that extra 6 bytes of free space comes in). Add the following data here:
4EF9000194FC


Reverse Timer bonus example

Here, I'm using a 20-second interval between point breaks, and I'm only allocating bonuses for finishing between 9:59 and 5:00 on the timer.

$019494:0014 - 20-second interval
$019496:721E - 30 intervals (the full 10 minutes)
$0194D2 - $0194FC - ignored, a new list is required.


$0194A0: 4EF9000EBEA0 - points to offset $0EBEA0.
$0EBEA0: 31FB000EF7D24EF9000194A6 - jump 0E bytes to the bonus point list


The following data is the point value list. Make sure all the data is one continuous string, I've separated it to different lines so you can see what's going on:

$0EBEB0: 
  000000000000 //0:00 to 1:00 (breaks at 0:20, 0:40, 1:00)
  000000000000 //1:00 to 2:00 (breaks at 1:20, 1:40, 2:00)
  000000000000 //2:00 to 3:00 (breaks at 2:20, 2:40, 3:00)
  000000000000 //3:00 to 4:00 (breaks at 3:20, 3:40, 4:00)
  000000000000 //4:00 to 5:00 (breaks at 4:20, 4:40, 5:00)
  000A0014001E //5:00 to 6:00 (breaks at 5:20, 5:40, 6:00)
  00280032003C //6:00 to 7:00 (breaks at 6:20, 6:40, 7:00)
  00460050005A //7:00 to 8:00 (breaks at 7:20, 7:40, 8:00)
  006400FA01F4 //8:00 to 9:00 (breaks at 8:20, 8:40, 9:00)
  03E809C41388 //9:00 to 9:59 (breaks at 9:20, 9:40, 9:59)


This achieves the following break system:

9:59 - 9:40: 50,000 pts
9:39 - 9:20: 25,000 pts
9:19 - 9:00: 10,000 pts
8:59 - 8:40: 5,000 pts
8:39 - 8:20: 2,500 pts
8:19 - 8:00: 1,000 pts
7:59 - 7:40: 900 pts
7:39 - 7:20: 800 pts
7:19 - 7:00: 700 pts
6:59 - 6:40: 600 pts
6:39 - 6:20: 500 pts
6:19 - 6:00: 400 pts
5:59 - 5:40: 300 pts
5:39 - 5:20: 200 pts
5:19 - 5:00: 100 pts
4:59 - 0:00: 0 pts



This is not easy to explain, but I've done the best I can. I hope this helps!


EDIT (10th March 2006): A typo has been corrected that caused the new time bonuses code to crash the game: 4EF0000194A6 was wrong, it should read 4EF9000194A6
This post has been edited by xenoSonic: 10 March 2006 - 03:24 PM

Page 1 of 1
    Locked
    Locked Forum

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