Sonic and Sega Retro Message Board: Some changes and fixes for Sonic 2 - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 15 Pages +
  • ◄ First
  • 13
  • 14
  • 15
    Locked
    Locked Forum

Some changes and fixes for Sonic 2

#211 User is offline Caverns 4 

Posted 26 December 2016 - 02:20 PM

  • Posts: 321
  • Joined: 07-December 12
  • Gender:Male
  • Project:Sanik Quest: Journey To The Right

View PostClownacy, on 12 October 2016 - 11:25 AM, said:

Thanks to this guy, I learned of another bug: starting the game through the options menu doesn't clear your emerald count, meaning you can soft-reset and replay EHZ over and over, and collect all the emeralds within the first act. If I remember right, I once read of a similar bug, involving emeralds not being cleared in 2-player mode, allowing Sonic to go Super.


If my memory serves me, this isn't a "bug", but was intended behavior. I don't really have the place where that was said on hand though, and it would take me a while to find it.
It's also not really worth debating over, since it also could be considered a design preference depending on the scope of your hack.

#212 User is offline Clownacy 

Posted 26 December 2016 - 02:46 PM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 631
  • Joined: 06-July 13
  • Gender:Male
  • Location:Englandland
...then why bring it up? It seems obvious that Sonic Team were duplicating code (which is considered bad practice for leading to bugs just like this), and simply stopped at the checks, not noticing the additional clears after it. What reason would this be intentional?
This post has been edited by Clownacy: 26 December 2016 - 02:58 PM

#213 User is offline Neo 

Posted 26 December 2016 - 03:36 PM

  • Clackerjack
  • Posts: 1212
  • Joined: 10-December 04
  • Gender:Male
  • Location:Portugal
  • Project:Sonic 3 Unlocked
  • Wiki edits:1
It's weird inconsistent behavior to be sure, but it's also the only way to play EHZ1 as Super Sonic without using cheats.

I'd rather have the emerald count clear when you reset the game or run out of continues, though.

#214 User is offline Clownacy 

Posted 09 January 2017 - 02:53 PM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 631
  • Joined: 06-July 13
  • Gender:Male
  • Location:Englandland
So, apparently the DEZ music was meant to resume between the Silver Sonic and Final Boss fights.

loc_39BA4:
	move.w	#$1000,(Camera_Max_X_pos).w
	addq.b	#2,(Dynamic_Resize_Routine).w
	move.b	(Level_Music).w,d0
	jsrto	(PlayMusic).l, JmpTo5_PlayMusic
	bra.w	JmpTo65_DeleteObject


The problem here is that Level_Music is actually a word long, meaning all that 'move.b' does is try to play Sound 0, which doesn't do anything, thus the Boss music just continues until the Final Boss music interrupts it. To fix this, just change the 'move.b' to 'move.w'

#215 User is offline Overlord 

Posted 09 January 2017 - 03:18 PM

  • Substitute Meerkovo IT Chief
  • Posts: 16207
  • Joined: 12-January 03
  • Gender:Male
  • Location:Berkshire, England
  • Project:VGDB
  • Wiki edits:3,204
That track is still underused though. Even in a scenario where it'd be working, you'd hear it again while playing normally for what, 5 seconds? 10 at most?

#216 User is offline DigitalDuck 

Posted 09 January 2017 - 03:44 PM

  • Arriving four years late.
  • Posts: 4391
  • Joined: 23-June 08
  • Gender:Male
  • Location:Lincs, UK
  • Project:TurBoa, S1RL

View PostOverlord, on 09 January 2017 - 03:18 PM, said:

That track is still underused though. Even in a scenario where it'd be working, you'd hear it again while playing normally for what, 5 seconds? 10 at most?


Yeah, you wouldn't even get to the melody in normal gameplay. There are people who've completed the game lots of times that don't even know it has a melody.

#217 User is online Dark Sonic 

Posted 09 January 2017 - 04:20 PM

  • Posts: 10172
  • Joined: 21-April 06
  • Gender:Male
  • Project:Sonic Lost World: Nonexistent Six/Fixed Edition; Sonic Genesis Adventure (Let's see how long this lasts :V)
  • Wiki edits:10
I always thought it would have been better if you fought Mecha Sonic to the Death Egg melody rather than the boss music. Actually give the song a chance to be heard.

#218 User is offline Mercury 

Posted 22 March 2017 - 12:19 AM

  • His Name Is Sonic
  • Posts: 1725
  • Joined: 13-November 08
  • Gender:Not Telling
  • Location:Location Location
  • Project:AeStHete
  • Wiki edits:130
Was having a conversation about the minutiae of how 1-ups are awarded in the classic games and discovered this:

Flags are set when you get a life at 100 and 200 rings, so you can't re-get those lives when your rings count down from being Super Sonic (they didn't want you to e.g. collect 100 rings, wait a second for them to count down to 99, grab one more ring and get a free life, rinse and repeat).

However, these flags are not cleared when you revert to normal (by dropping to 0 rings). They are only cleared when Sonic is hit and loses his rings, or when the level is loaded. (Search "Sonic_RevertToNormal" and "Extra_life_flags" in the github disasm for the relevant stuff.)

#219 User is offline DigitalDuck 

Posted 22 March 2017 - 11:42 AM

  • Arriving four years late.
  • Posts: 4391
  • Joined: 23-June 08
  • Gender:Male
  • Location:Lincs, UK
  • Project:TurBoa, S1RL

View PostMercury, on 22 March 2017 - 12:19 AM, said:

However, these flags are not cleared when you revert to normal (by dropping to 0 rings). They are only cleared when Sonic is hit and loses his rings, or when the level is loaded. (Search "Sonic_RevertToNormal" and "Extra_life_flags" in the github disasm for the relevant stuff.)


Design pondering:

Should they even be cleared when Sonic is hit? If you wanted to farm lives from rings, you could collect 100, get hit, and then start afresh with up to 32 (meaning you only need to hunt for another 68 rings instead of another 100). Doesn't make that much of a difference, but it's food for thought.

#220 User is offline Ralakimus 

Posted 12 June 2017 - 06:20 PM

  • a.k.a. Novedicus
  • Posts: 141
  • Joined: 16-April 13
  • Gender:Male
  • Project:Secret stuff
So, notice how bridges in Sonic 2 can only have an even amount of segments? Well, here's how you can allow for odd number of segments.

In "Obj11_Init", there's this little segment of code:

	lsr.w    #1,d0
	lsl.w    #4,d0    ; (d0 div 2) * 16


This basically forces the number of segments to be even and then shifts it to what it needs to be. What you need to do is just change that to:

	lsl.w	#3,d0	; d0 * 8


But, we aren't done yet. There's a little segment of code that appears to be an incorrect calculation for calculating the X position of the second set of bridge segments (for when it's needed) (although, this could be intentional, but I'm not quite sure). Take a look at this in the same routine:

	move.w	d4,d0
	add.w	d0,d0
	add.w	d4,d0	; d0*3
	move.w	sub2_x_pos(a1,d0.w),d0


For one thing, it's mutliplying the offset used to get the X position value in the sub sprite data by 3, which is wrong. Sub sprite data each take up 6 bytes, not 3. So, what we need to do is just make it:

	move.w	d4,d0
	add.w	d0,d0
	add.w	d4,d0
	add.w	d0,d0	; d0*6
	move.w	sub2_x_pos(a1,d0.w),d0


But there's still one more thing: because the segment count is based on 1 instead of 0 (meaning 1 = 1 segment, instead of 0 = 1 segment), it's getting the wrong data. For example, with 1 segment, it will multiply 1 by 6, and get the data from sub3_x_pos, since sub2_x_pos+6 = sub3_x_pos, which isn't used with only 1 segment. So, all we need to do is this, so that it will point to the correct data:

	move.w	d4,d0
	add.w	d0,d0
	add.w	d4,d0
	add.w	d0,d0	; d0*6
	move.w	sub2_x_pos-next_subspr(a1,d0.w),d0


And that's it! I can't seem to find any issues with doing this, but if any of you find any, let me know.
This post has been edited by Ralakimus: 12 June 2017 - 06:29 PM

#221 User is offline flamewing 

Posted 13 June 2017 - 12:55 AM

  • Emerald Hunter
  • Posts: 1088
  • Joined: 11-October 10
  • Gender:Male
  • Location:🇫🇷 France
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
The second bit of code did its job correctly in the case of even logs only: subtype would be always even, so multiplying by 3 would be enough to get the correct offset. When you edited to allow an odd number of logs you broke that assumption.

The low bit of subtype does not seem to be used anywhere, so there should not be any issues.

#222 User is offline Ralakimus 

Posted 13 June 2017 - 01:42 AM

  • a.k.a. Novedicus
  • Posts: 141
  • Joined: 16-April 13
  • Gender:Male
  • Project:Secret stuff
So, a small update. So, with the new calculation I added is actually incorrect. The multiplication by 3 is intentional, since 2 segments is supposed to use sub3_x_pos and 4 segments use sub4_x_pos, etc, rather than 2 using sub4_x_pos, 4 using sub6_x_pos, etc. Here's a fixed version of it that handles odd numbered segments, by rounding down the offset:
	move.w  d4,d0
        add.w   d0,d0
        add.w   d4,d0	; d0*3
        btst	#0,d0	; align the offset for odd numbered segments
        beq.s	.getX
        subq.w	#3,d0
.getX:
        move.w  sub2_x_pos(a1,d0.w),d0


This post has been edited by Ralakimus: 13 June 2017 - 01:51 AM

  • 15 Pages +
  • ◄ First
  • 13
  • 14
  • 15
    Locked
    Locked Forum

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