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
Loading News Feed...
 

Some changes and fixes for Sonic 2

#76 User is offline KingofHarts 

Posted 21 June 2012 - 11:18 PM

  • Resident windbag
  • Posts: 833
  • Joined: 07-August 10
  • Gender:Male
  • Location:China (NO, I'm not Chinese...)
  • Project:Triad, STE Engine, REV C hacks, SCHG
  • Wiki edits:1
@redhotsonic. I agree with Overlord. Pinning this defeats the purpose of a SCHG wiki in some respect.
That being said...

KingofHarts Page update!
http://info.sonicret...Z_Tornado_death - I made a small error in the page title... I wanted it to say "Prevent SCZ Tornado spin dash death" If an admin, wiki sysop, or someone could fix that, would be good... or if its not a big deal, then leave it
http://info.sonicret...ion_while_dying - Added the fix to allow Silver Sonic to land on the floor
http://info.sonicret...r_collision_bug

And about this...

View PostEsrael, on 18 June 2012 - 08:13 PM, said:

And Another bug with Miles in ARZ Boss.
If you stand in one arrow with Sonic the arrow will fall, but not with Miles.
How To fix

Find:
  loc_30CCC:     	......     	btst	#3,status(a0) 	beq.s	 return_30D02 	move.w	#$1F,objoff_30(a0) loc_30CF4: 


and change to

  loc_30CCC:        ......  ;-------------------------------------------------------------------------------          btst    #$04,  status(A0)     	beq.s   Not_Miles_In_Arrow     	move.w  #$001F,  objoff_30(A0)   Not_Miles_In_Arrow:  ;-------------------------------------------------------------------------------          btst     #3,status(a0) 	beq.s	return_30D02 	move.w	 #$1F,objoff_30(a0) loc_30CF4: 

Done.


Isn't this to prevent Tails from fucking you over on the boss? I'm not against this fix, but if its to be performed, it should be more of a design choice, and while we are at it... should have some kind of guide that allows Tails to do other stuff... like break monitors, etc. I would think putting that all together into one guide would be sufficient.
This post has been edited by KingofHarts: 22 June 2012 - 12:39 AM

#77 User is offline flamewing 

Posted 22 June 2012 - 04:51 AM

  • Posts: 563
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12

View PostEsrael, on 21 June 2012 - 08:42 PM, said:

View PostEsrael, on 19 June 2012 - 08:19 PM, said:

View PostKingofHarts, on 19 June 2012 - 01:19 AM, said:

I wanna touch back on the CPZ boss for a second. There is a minor bug that occurs when you die against the boss. If you or Tails die against the boss, and are under the solid floor, the character will hit the floor and just drop, instead of the proper behavior. Now, I have no problem with said bug... but just noting that its there.


...

 ; loc_1E596:
Floor_ChkTile:
 	move.w	d2,d0
 		....
 	movea.l	d1,a1
 	cmpi.b  #$06, $0024(A0)
 	bne.s   Player_Not_Death
 	move.l  #$FFFF0000, A1

Player_Not_Death:
 	rts

; ===========================================================================
; precalculated values for Floor_ChkTile
; (Sonic 1 calculated it every time instead of using a table) word_1E5D0: 


This code will point to the first tile in RAM which have no solidity. Since Sonic object can't find solidity will show the dying animation.

Edit: Correct check. The Current Character is in A0


View PostKingofHarts, on 20 June 2012 - 01:10 AM, said:

Sweet deal, Esrael! BTW should the address be A0? or a0?
You have A0 and A1 with capital letters. Shouldn't they be lower case? or it doesn't matter?


While testing and playing I have found a bug with Metal Sonic. He will fall forever since he can't detect the floor, because his initial animation use same id as Sonic and Miles while dying. To fix add the following lines to code:

 ; loc_1E596:
Floor_ChkTile:
 	move.w	d2,d0
 		....
 	movea.l	d1,a1

;--------------------------------------
 	cmpi.b  #$06, $0024(A0)
 	bne.s   Player_Not_Death
 	cmpi.b  #$01, (A0)          ; Is Sonic
 	beq.s   Player_Death
 	cmpi.b  #$02, (A0)          ;  Is Miles
 	bne.s   Player_Not_Death

Player_Death:
  	move.l  #$FFFF0000, A1

 Player_Not_Death:
  	rts
 
 ; ===========================================================================
 ; precalculated values for Floor_ChkTile
 ; (Sonic 1 calculated it every time instead of using a table) word_1E5D0: 


From what I can tell, the bug mentioned only happens when Sonic (or Tails) is on the air and dies due to falling of the bottom of the screen; if I am wrong, please ignore me. This is the only case when there are physics checks (collision, movement) on the same frame as Sonic (or Tails dies) due to the location where it happens in code. So there is a neater fix that also does not cause the problem with Metal Sonic (and who knows how many other problems -- maybe with animals?).

I will give the labels for the SVN disassembly, and the nearest 2007 label I can find. For Sonic, find this block of code:
Sonic_Boundary_Bottom: ;;
 	bra.w	JmpTo_KillCharacter
; ===========================================================================
; loc_1A9BA:

and change it to this:
Sonic_Boundary_Bottom: ;;
 	addq.l    #4,sp
 	bra.w	JmpTo_KillCharacter
; ===========================================================================
; loc_1A9BA:

For Tails, the relevant code block is this:
Tails_Boundary_Bottom: ;;
 	bra.w	JmpTo2_KillCharacter
; ===========================================================================
; loc_1C5A0:

Do the same change as for Sonic.

These changes will cause Sonic (and Tails) to skip some subroutines for the current control mode; this includes some that move Sonic (or Tails) and either make Sonic/Tails follow the ground or collide with the level. This will only happen during one frame; starting the next frame will work as normal since a different subroutine will be used. Being crushed by objects, drowning and being killed by badniks don't need to be changed because they all happen after the physics updates, and will only make effect on the next frame.
This post has been edited by flamewing: 22 June 2012 - 04:51 AM

#78 User is offline Esrael 

Posted 22 June 2012 - 08:20 AM

  • Posts: 169
  • Joined: 24-July 03
  • Gender:Male
  • Location:Brazil, São Paulo, Guarulhos
  • Project:Esrael Neto Assembler Editor / Sonic 2 Delta

View PostKingofHarts, on 21 June 2012 - 11:18 PM, said:

@redhotsonic. I agree with Overlord. Pinning this defeats the purpose of a SCHG wiki in some respect.
That being said...

KingofHarts Page update!
....

View PostEsrael, on 18 June 2012 - 08:13 PM, said:

.....



Isn't this to prevent Tails from fucking you over on the boss? I'm not against this fix, but if its to be performed, it should be more of a design choice, and while we are at it... should have some kind of guide that allows Tails to do other stuff... like break monitors, etc. I would think putting that all together into one guide would be sufficient.



For Miles breaking Monitors do the following changes:

Find and delete:

; sub_12768:
SolidObject_Monitor_Tails:
	btst	d6,status(a0)
	bne.s	loc_12782
	tst.w	(Two_player_mode).w    ; <--- Comment or delete this line
	beq.w	loc_199F0              ; <--- Comment or delete this line
	cmpi.b	#2,anim(a1)
	bne.w	loc_199F0
	rts
; End of function SolidObject_Monitor_Tails

; ---------------------------------------------------------------------------




as result
; sub_12768:
SolidObject_Monitor_Tails:
	btst	d6,status(a0)
	bne.s	loc_12782
	cmpi.b	#2,anim(a1)
	bne.w	loc_199F0
	rts
; End of function SolidObject_Monitor_Tails

; ---------------------------------------------------------------------------




and find:
loc_3F768:
	cmpa.w	#MainCharacter,a0      ; <--- Comment or delete this line
	beq.s	+                      ; <--- Comment or delete this line
	tst.w	(Two_player_mode).w    ; <--- Comment or delete this line
	beq.s	return_3F78A           ; <--- Comment or delete this line
+                                      ; <--- Comment or delete this line
	cmpi.b	#2,anim(a0)
	bne.s	return_3F78A
	neg.w	y_vel(a0)	; reverse Sonic's y-motion
	move.b	#4,routine(a1)
	move.w	a0,parent(a1)

return_3F78A:
	rts



as result
loc_3F768:
	cmpi.b	#2,anim(a0)
	bne.s	return_3F78A
	neg.w	y_vel(a0)	; reverse Sonic's y-motion
	move.b	#4,routine(a1)
	move.w	a0,parent(a1)

return_3F78A:
	rts



This will allow Miles breaking monitors, but now Miles will be awarded with Monitor contents.
If you don't want Miles getting monitors rewards you will need do some changes code as example Super Rings:

Find:
super_ring:
	addq.w	#1,(a2)
	lea	(Ring_count).w,a2
	lea	(Update_HUD_rings).w,a3
	lea	(Extra_life_flags).w,a4
	lea	($FFFFFEF0).w,a5
	cmpa.w	#MainCharacter,a1
	beq.s	loc_12992
	lea	(Ring_count_2P).w,a2
	lea	(Update_HUD_rings_2P).w,a3
	lea	(Extra_life_flags_2P).w,a4
	lea	($FFFFFEF2).w,a5

loc_12992:



and add the following lines
super_ring:
	addq.w	#1,(a2)
	lea	(Ring_count).w,a2
	lea	(Update_HUD_rings).w,a3
	lea	(Extra_life_flags).w,a4
	lea	($FFFFFEF0).w,a5
	cmpa.w	#MainCharacter,a1
	beq.s	loc_12992
        tst.w	(Two_player_mode).w    ; Add this line
	beq.s	loc_12992              ; Add this line
	lea	(Ring_count_2P).w,a2
	lea	(Update_HUD_rings_2P).w,a3
	lea	(Extra_life_flags_2P).w,a4
	lea	($FFFFFEF2).w,a5

loc_12992:



This will be necessary for all items which you want Main player to be rewarded.
This post has been edited by Esrael: 22 June 2012 - 08:29 AM

#79 User is offline redhotsonic 

Posted 22 June 2012 - 11:22 AM

  • Also known as RHS
  • Posts: 984
  • Joined: 31-January 05
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic 2 Recreation
  • Wiki edits:24

View PostOverlord, on 21 June 2012 - 02:38 PM, said:

To be fair, this is the sort of thing the SCHG is for...


That's true. Thought I'd suggest =P




Anyway, another bug fix:




How to fix the CPZ pipes bug


From Sonic retro wiki page said:

Chemical Plant Zone

Should you get knocked into a transportation pipe by getting hurt, The pipe will glitch As seen here



So here's the demonstration of the glitch from another user on YouTube. This only happens when you've got hurt and land straight into the pipe's entrance. To be honest, this is very rare that you'll pull this bug off. But if you want to fix it anyway, it's extremely simple to.



Go to "loc_225FC:" and look for these commands:

	moveq	#0,d3
	cmpi.w	#$A0,d2
	beq.s	+



Just above the "moveq #0,d3", add this line:

	move.b	#2,routine(a1)	; In case character was hurt, make him okay again, fixes bug



So, you end up with this:

loc_225FC:
	tst.w	(Debug_placement_mode).w
	bne.w	return_22718
	move.w	objoff_2A(a0),d2
	move.w	x_pos(a1),d0
	sub.w	x_pos(a0),d0
	cmp.w	d2,d0
	bcc.w	return_22718
	move.w	y_pos(a1),d1
	sub.w	y_pos(a0),d1
	cmpi.w	#$80,d1
	bcc.w	return_22718
	cmpi.b	#$20,anim(a1)
	beq.w	return_22718

	move.b	#2,routine(a1)	; In case character was hurt, make him okay again, fixes bug
	moveq	#0,d3
	cmpi.w	#$A0,d2
	beq.s	+
	moveq	#8,d3
	cmpi.w	#$120,d2
	beq.s	+
	moveq	#4,d3
	neg.w	d0
	addi.w	#$100,d0
+



Done! You should now end up with this:




Cheers,
redhotsonic



EDIT: Forgot to mention, this will also fix it for the sidekick.
This post has been edited by redhotsonic: 22 June 2012 - 11:25 AM

#80 User is offline MoDule 

Posted 22 June 2012 - 01:17 PM

  • Posts: 305
  • Joined: 03-October 07
  • Gender:Male
  • Project:Procrastinating from writing bug-fix guides
  • Wiki edits:52
I've had that one lying around for a while, too. Only difference is I put the fix here:
loc_22688:
	move.b	d2,1(a4)
	add.w	d3,d2
	add.w	d2,d2
	andi.w	#$1E,d2
	lea	off_22980(pc),a2
	adda.w	(a2,d2.w),a2
	move.w	(a2)+,4(a4)
	subq.w	#4,4(a4)
	move.w	(a2)+,d4
	add.w	x_pos(a0),d4
	move.w	d4,x_pos(a1)
	move.w	(a2)+,d5
	add.w	y_pos(a0),d5
	move.w	d5,y_pos(a1)
	move.l	a2,6(a4)
	move.w	(a2)+,d4
	add.w	x_pos(a0),d4
	move.w	(a2)+,d5
	add.w	y_pos(a0),d5
	addq.b	#2,(a4)

	move.b	#2,routine(a1)	; <---

	move.b	#$81,obj_control(a1)
	move.b	#AniIDSonAni_Roll,anim(a1)
	move.w	#$800,inertia(a1)

But as far as I can tell, it doesn't make a difference.

I'll contribute one:
Fix Tails interacting with forced roll switchers while flying bug

Most commonly seen in CNZ, when you lose Tails and he starts flying after you, sometimes he'll be stuck in an odd animation and when he lands will be in forced rolling mode.

So, to fix this, first we go to Obj84_MainY (loc_212F6) and we'll see this:
; loc_212F6:
Obj84_MainY:

	tst.w	(Debug_placement_mode).w
	bne.s	return_21350
	move.w	y_pos(a0),d1
	lea	objoff_34(a0),a2 ; a2=object
	lea	(MainCharacter).w,a1 ; a1=character
	bsr.s	+
	lea	(Sidekick).w,a1 ; a1=character
+
	tst.b	(a2)+
	bne.s	Obj84_MainY_Alt
	cmp.w	y_pos(a1),d1
	bhi.s	return_21350
	move.b	#1,-1(a2)
	move.w	x_pos(a0),d2
	move.w	d2,d3
	move.w	objoff_32(a0),d4
	sub.w	d4,d2
	add.w	d4,d3
	move.w	x_pos(a1),d4
	cmp.w	d2,d4
	blo.s	return_21350
	cmp.w	d3,d4
	bhs.s	return_21350
	btst	#0,render_flags(a0)
	bne.s	+
	move.b	#1,spindash_flag(a1)
	bra.w	loc_212C4
; ---------------------------------------------------------------------------
+	move.b	#0,spindash_flag(a1)

return_21350:
	rts

Now, after the line
	lea	(Sidekick).w,a1 ; a1=character

add this:
	cmpi.w	#4,(Tails_CPU_routine).w	; TailsCPU_Flying
	beq.s	return_21350

which should leave us with this:
; loc_212F6:
Obj84_MainY:

	tst.w	(Debug_placement_mode).w
	bne.s	return_21350
	move.w	y_pos(a0),d1
	lea	objoff_34(a0),a2 ; a2=object
	lea	(MainCharacter).w,a1 ; a1=character
	bsr.s	+
	lea	(Sidekick).w,a1 ; a1=character

	cmpi.w	#4,(Tails_CPU_routine).w	; TailsCPU_Flying
	beq.s	return_21350

+
	(...)


Done.

What we're doing here is simply skipping the collision check with the pinball mode switcher object for the second player if he's currently flying.

#81 User is offline jasonchrist 

Posted 22 June 2012 - 02:41 PM

  • Give Us A Wank
  • Posts: 1893
  • Joined: 22-July 08
  • Gender:Male
  • Project:Sonic Classic Hybrid Project
Know what Sonic 2 needs? A bad ending.

#82 User is offline redhotsonic 

Posted 22 June 2012 - 03:23 PM

  • Also known as RHS
  • Posts: 984
  • Joined: 31-January 05
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic 2 Recreation
  • Wiki edits:24

View PostMoDule, on 22 June 2012 - 01:17 PM, said:

Fix Tails interacting with forced roll switchers while flying bug



This is probably the best/funniest bug in the whole game. It always made me laugh when Tails would just move left and right in his "waiting" animation, just yawning =P


Either way, nice fix. I will apply this one!

#83 User is offline Esrael 

Posted 22 June 2012 - 06:23 PM

  • Posts: 169
  • Joined: 24-July 03
  • Gender:Male
  • Location:Brazil, São Paulo, Guarulhos
  • Project:Esrael Neto Assembler Editor / Sonic 2 Delta
Browsing in to How-tos I have found one which need be some fixes:
SCHG How-to:Retain Rings when returning at a Star Post
If you use this feature and had 100 or 200 rings which already gives 2 lifes and enter to Special Stage after returning you will be awarded with 2 lifes again.

If you want this does not occur you will need comment or remove the next line after

; continue from a starpost / load checkpoint
; loc_1F35E:
Obj79_LoadData:
        ......
 	clr.w	(Ring_count).w       ; <---- This lines was commented or deleted by guide.
	clr.b	(Extra_life_flags).w ; <---- Comment or Delete this line too if don't want rewarded after returning from Special Stage.






If you want something like Retain rings only when entering on Special Stage and not after death.
First create a new variable -> $FFFFF100 to $FFFFF5FF is safe since is not used in Sonic 2.
Ex:
Bonus_Stage_Flag equ $FFFFF48E ; Sonic 2 Delta Bonus Flag as Example
You can use other variable name and other free Ram Address.

Setting the new variable when entering on Special Stage from Star Post:
Insert "move.b #01, (Bonus_Stage_Flag).w in the following routine:
; loc_1F536:
Obj79_Star:
	move.b	collision_property(a0),d0
	beq.w	loc_1F554
	andi.b	#1,d0
	beq.s	+
	move.b	#1,($FFFFF7CD).w
	move.b	#$10,(Game_Mode).w ; => SpecialStage
        move.b  #01, (Bonus_Stage_Flag).w   ; <----- Insert this line to initialize our new variable
+
	clr.b	collision_property(a0)



and make the following chages into:

Obj79_LoadData:
	move.b	(Saved_Last_star_pole_hit).w,(Last_star_pole_hit).w
	move.w	(Saved_x_pos).w,(MainCharacter+x_pos).w
	move.w	(Saved_y_pos).w,(MainCharacter+y_pos).w                  
	move.w	(Saved_Ring_count).w,(Ring_count).w
	move.b	(Saved_Extra_life_flags).w,(Extra_life_flags).w

        tst.b   (Bonus_Stage_Flag).w   ; <----- Insert this line                
        bne.s   Exit_Bonus_Stage     ; <----- Insert this line   

	clr.w	(Ring_count).w
	clr.b	(Extra_life_flags).w

Exit_Bonus_Stage:                    ; <----- Insert this line   
        clr.b   (Bonus_Stage_Flag).w   ; <----- Insert this line  

	move.l	(Saved_Timer).w,(Timer).w
	move.b	#59,(Timer_centisecond).w


Done, now your rings will be retained if you are returning from Special Stage.
Is recommended to clear the variable before loading new level.
This post has been edited by Esrael: 22 June 2012 - 06:30 PM

#84 User is offline Machenstein 

Posted 23 June 2012 - 10:01 PM

  • Posts: 605
  • Joined: 17-August 07
  • Gender:Male
It's about time the bugs in Sonic 2 got squashed. While you guys are updating the wiki, how about adding this to the guide. Just credit vladikcomper since he was the one who wrote the instructions I posted.

Is there a way to fix how Super Sonic falls through the floor in Metropolis Zone after using a transporter while holding left or right?

#85 User is offline MoDule 

Posted 24 June 2012 - 05:23 PM

  • Posts: 305
  • Joined: 03-October 07
  • Gender:Male
  • Project:Procrastinating from writing bug-fix guides
  • Wiki edits:52

View PostJayextee, on 15 June 2012 - 10:21 AM, said:

I don't recall, has anyone ever fixed the collision? -- when Sonic (or Tails) is colliding with two objects at once, only one registers? This is why Sonic walks through certain badniks in ARZ when he's scattering leaves, and why he can't collect dropped rings in lava without jumping.

Like I said earlier, it probably wouldn't be good performance-wise to check every object each frame, but there's another way to get around this problem:

Fix collisions with the lava collision maker object

The Bug:
The way object collisions work, it's impossible to collide with two objects at once unless the object itself does the collision checks. That's what we're going to do here.

The Fix:
We're going to be editing object 31, the lava collision maker. First locate the label Obj31_Init (loc_20E02):
; byte_20DFE:
Obj31_CollisionFlagsBySubtype:
	dc.b $96	; 0
	dc.b $94	; 1
	dc.b $95	; 2
	dc.b   0	; 3
; ===========================================================================
; loc_20E02:
Obj31_Init:
	addq.b	#2,routine(a0) ; => Obj31_Main
	moveq	#0,d0
	move.b	subtype(a0),d0
	move.b	Obj31_CollisionFlagsBySubtype(pc,d0.w),collision_flags(a0)	; <-------
	move.l	#Obj31_MapUnc_20E6C,mappings(a0)
	tst.w	(Debug_placement_mode).w
	beq.s	+
	move.l	#Obj31_MapUnc_20E74,mappings(a0)
+
	move.w	#make_art_tile(ArtTile_ArtNem_Powerups,0,1),art_tile(a0)
	move.b	#$84,render_flags(a0)
	move.b	#$80,width_pixels(a0)
	move.b	#4,priority(a0)
	move.b	subtype(a0),mapping_frame(a0)

Now, we replace the data table Obj31_CollisionFlagsBySubtype and the line that uses it with the following:
Obj31_Widths:
	dc.b $20	; 0
	dc.b $40	; 1
	dc.b $80	; 2
	dc.b   4	; 3
; ===========================================================================

	(...)
	move.b	Obj31_Widths(pc,d0.w),x_radius(a0)

Next, we need to add our own collision check. Here's the routine, place it anywhere close to the object's code. I put it between Obj31_Main and the object's mappings.
Obj31_TestCollisions:
	lea	(MainCharacter).w,a1
	bsr.s	+
	lea	(Sidekick).w,a1
+
	; test horizontal
	moveq	#0,d1
	move.b	x_radius(a0),d1
	; left edge
	move.w	x_pos(a1),d0
	sub.w	x_pos(a0),d0
	add.w	d1,d0
	bmi.s	Obj31_NoCollision
	; right edge
	add.w	d1,d1
	cmp.w	d1,d0
	bcc.s	Obj31_NoCollision
	; test vertical
	moveq	#$20,d1	; we assume a constant y_radius of 32 pixels
	add.b	y_radius(a1),d1
	; top edge
	move.w	y_pos(a1),d0
	sub.w	y_pos(a0),d0
	add.w	d1,d0
	bmi.s	Obj31_NoCollision
	; bottom edge
	add.w	d1,d1
	cmp.w	d1,d0
	bcc.s	Obj31_NoCollision
	; hurt player
	move.l	a0,-(sp)	; save object address
	exg	a0,a1		; switch object and player addresses
	jsr	Touch_ChkHurt
	movea.l	(sp)+,a0 ; load 0bj address

Obj31_NoCollision:
	rts
; ===========================================================================

Now we need the object to call this routine. Right after the label Obj31_Main, add this:
	tst.w	(Debug_placement_mode).w
	bne.s	+		; skip collision checks if in object placement mode mode
	bsr.s	Obj31_TestCollisions
+

Done.

Now, I'm no expert on coding bounding box checks, so if someone can come up with a better collision checking routine that uses less cycles, post away. This does have the potential to slow the game down a little, so every little bit helps.
What really helps is s3k's collision checking routine. Instead of going through the entire object list, it only checks objects that add themselves to a specific list. This means objects that have no collisions or ones that do the checks themselves will be skipped.
The fix for the ARZ leaf makers should work the same way, but I'd need to check first to be sure.

#86 User is offline KingofHarts 

Posted 26 June 2012 - 12:20 AM

  • Resident windbag
  • Posts: 833
  • Joined: 07-August 10
  • Gender:Male
  • Location:China (NO, I'm not Chinese...)
  • Project:Triad, STE Engine, REV C hacks, SCHG
  • Wiki edits:1

View PostMachenstein, on 23 June 2012 - 10:01 PM, said:

It's about time the bugs in Sonic 2 got squashed. While you guys are updating the wiki, how about adding this to the guide. Just credit vladikcomper since he was the one who wrote the instructions I posted. Is there a way to fix how Super Sonic falls through the floor in Metropolis Zone after using a transporter while holding left or right?


I've used your Super Sonic fix, and will place this in Design Choices: http://info.sonicret...vior_in_Sonic_2
I only put in what I used for adding this, and have added the fix for the WFZ glitch by RHS.

Secondly, ask flamewing about your Super Sonic fix. I recall him mentioning this bug in particular at some point. I know he knows how to do it.
This post has been edited by KingofHarts: 26 June 2012 - 02:01 AM

#87 User is offline KingofHarts 

Posted 26 June 2012 - 02:16 AM

  • Resident windbag
  • Posts: 833
  • Joined: 07-August 10
  • Gender:Male
  • Location:China (NO, I'm not Chinese...)
  • Project:Triad, STE Engine, REV C hacks, SCHG
  • Wiki edits:1

View PostMoDule, on 24 June 2012 - 05:23 PM, said:

View PostJayextee, on 15 June 2012 - 10:21 AM, said:

I don't recall, has anyone ever fixed the collision? -- when Sonic (or Tails) is colliding with two objects at once, only one registers? This is why Sonic walks through certain badniks in ARZ when he's scattering leaves, and why he can't collect dropped rings in lava without jumping.

Like I said earlier, it probably wouldn't be good performance-wise to check every object each frame, but there's another way to get around this problem:

Fix collisions with the lava collision maker object

The Bug:
The way object collisions work, it's impossible to collide with two objects at once unless the object itself does the collision checks. That's what we're going to do here.

The Fix:
We're going to be editing object 31, the lava collision maker. First locate the label Obj31_Init (loc_20E02):
; byte_20DFE: Obj31_CollisionFlagsBySubtype: 	dc.b $96	; 0 	dc.b $94	; 1 	dc.b $95	; 2 	dc.b   0	; 3 ; =========================================================================== ; loc_20E02: Obj31_Init: 	addq.b	#2,routine(a0) ; => Obj31_Main 	moveq	#0,d0 	move.b	subtype(a0),d0 	move.b	Obj31_CollisionFlagsBySubtype(pc,d0.w),collision_flags(a0)	; <------- 	move.l	#Obj31_MapUnc_20E6C,mappings(a0) 	tst.w	(Debug_placement_mode).w 	beq.s	+ 	move.l	#Obj31_MapUnc_20E74,mappings(a0) + 	move.w	#make_art_tile(ArtTile_ArtNem_Powerups,0,1),art_tile(a0) 	move.b	#$84,render_flags(a0) 	move.b	#$80,width_pixels(a0) 	move.b	#4,priority(a0) 	move.b	subtype(a0),mapping_frame(a0)

Now, we replace the data table Obj31_CollisionFlagsBySubtype and the line that uses it with the following:
Obj31_Widths: 	dc.b $20	; 0 	dc.b $40	; 1 	dc.b $80	; 2 	dc.b   4	; 3 ; =========================================================================== 	(...) 	move.b	Obj31_Widths(pc,d0.w),x_radius(a0)

Next, we need to add our own collision check. Here's the routine, place it anywhere close to the object's code. I put it between Obj31_Main and the object's mappings.
Obj31_TestCollisions: 	lea	(MainCharacter).w,a1 	bsr.s	+ 	lea	(Sidekick).w,a1 + 	; test horizontal 	moveq	#0,d1 	move.b	x_radius(a0),d1 	; left edge 	move.w	x_pos(a1),d0 	sub.w	x_pos(a0),d0 	add.w	d1,d0 	bmi.s	Obj31_NoCollision 	; right edge 	add.w	d1,d1 	cmp.w	d1,d0 	bcc.s	Obj31_NoCollision 	; test vertical 	moveq	#$20,d1	; we assume a constant y_radius of 32 pixels 	add.b	y_radius(a1),d1 	; top edge 	move.w	y_pos(a1),d0 	sub.w	y_pos(a0),d0 	add.w	d1,d0 	bmi.s	Obj31_NoCollision 	; bottom edge 	add.w	d1,d1 	cmp.w	d1,d0 	bcc.s	Obj31_NoCollision 	; hurt player 	move.l	a0,-(sp)	; save object address 	exg	a0,a1		; switch object and player addresses 	jsr	Touch_ChkHurt 	movea.l	(sp)+,a0 ; load 0bj address Obj31_NoCollision: 	rts ; ===========================================================================

Now we need the object to call this routine. Right after the label Obj31_Main, add this:
	tst.w	(Debug_placement_mode).w 	bne.s	+		; skip collision checks if in object placement mode mode 	bsr.s	Obj31_TestCollisions +

Done.

Now, I'm no expert on coding bounding box checks, so if someone can come up with a better collision checking routine that uses less cycles, post away. This does have the potential to slow the game down a little, so every little bit helps.
What really helps is s3k's collision checking routine. Instead of going through the entire object list, it only checks objects that add themselves to a specific list. This means objects that have no collisions or ones that do the checks themselves will be skipped.
The fix for the ARZ leaf makers should work the same way, but I'd need to check first to be sure.


Could this also be applied to the CNZ blue blocks? Or is that a different bug? (I question because in S2K I climbed onto a wall and let a blue block move into me sideways, and it did nothing.)
That is a fix I'd like to see, as would anyone with custom CNZ layouts.

#88 User is offline MoDule 

Posted 26 June 2012 - 05:12 AM

  • Posts: 305
  • Joined: 03-October 07
  • Gender:Male
  • Project:Procrastinating from writing bug-fix guides
  • Wiki edits:52

View PostKingofHarts, on 26 June 2012 - 02:16 AM, said:

Could this also be applied to the CNZ blue blocks? Or is that a different bug? (I question because in S2K I climbed onto a wall and let a blue block move into me sideways, and it did nothing.)
That is a fix I'd like to see, as would anyone with custom CNZ layouts.

That would be object solidity, which is something different altogether. There's a whole bunch of problems with this that I'd like to see fixed, too.

#89 User is offline KingofHarts 

Posted 29 June 2012 - 01:00 AM

  • Resident windbag
  • Posts: 833
  • Joined: 07-August 10
  • Gender:Male
  • Location:China (NO, I'm not Chinese...)
  • Project:Triad, STE Engine, REV C hacks, SCHG
  • Wiki edits:1
http://info.sonicret...fect_in_Sonic_2 - Porting the LZ water ripple effect into Sonic 2.
http://info.sonicret...er_into_Sonic_2 - Porting S3K Object Manager

Hey MoDule! I did a little digging, after putting together the rhs SST guide, and found these two gems... I am adding them to the SCHG, as they are quite worthy... and its a crime that they never got put up.

I simply copy and pasted these... I don't have much time to really look too much into them at the moment, so unless anyone else can edit wiki pages, what you see is what you get until I return.

These guides are old though, and need to be fixed up. I possess no such skills to do so, but perhaps if anyone (I'm looking at you Esrael, RHS or MoDule) could fix them up, we can revive these guides and make them more serviceable for use.

I might not be back for a little while... maybe later today or tomorrow, but after that I'm taking the weekend off. When I return, I would like to start some ground work on that Sonic 3 section of the SCHG I was crowing about a couple weeks back.
This post has been edited by KingofHarts: 29 June 2012 - 01:49 AM

#90 User is offline KingofHarts 

Posted 26 July 2012 - 01:23 AM

  • Resident windbag
  • Posts: 833
  • Joined: 07-August 10
  • Gender:Male
  • Location:China (NO, I'm not Chinese...)
  • Project:Triad, STE Engine, REV C hacks, SCHG
  • Wiki edits:1
Watch this video walkthrough.
Check out this YouTube video. Skip EVERYTHING up until 7:55, and watch Tails closely. You will notice a bug. When Tails flies past the cylinder, he goes into that animation. Has this been fixed in any revision/hack?

Esrael, RHS, this sounds like a job for you two.
This post has been edited by KingofHarts: 26 July 2012 - 01:24 AM

  • 9 Pages +
  • ◄ First
  • 4
  • 5
  • 6
  • 7
  • 8
  • Last ►
    Locked
    Locked Forum

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