Sonic and Sega Retro Message Board: Spindash questions - Sonic and Sega Retro Message Board

Jump to content

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

Spindash questions

#1 User is offline Quickman 

Posted 18 December 2006 - 02:20 AM

  • Posts: 5584
  • Joined: 03-December 03
  • Gender:Male
  • Location::x
  • Project:omg porjcet
  • Wiki edits:10
So I drag'n'dropped the spindash code from the Nick Arcade Prototype (which, by the way, is unashamedly incomplete - there's a nop to indicate where further code was being implemented) and it worked straight off (all I did was comment it to make sure I understood what it was doing). However, I have some questions. First the code. (Feel free to use and abuse, since nothing here is actually mine.)

; ---------------------------------------------------------------------------
; Subroutine to allow Sonic to spindash
; ---------------------------------------------------------------------------

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

Sonic_Spindash:
		tst.b	$39(a0)	; are we charging a spindash?
		bne.s	Sonic_Spindashing; if so, go to the spindash charge code
		cmpi.b	#8,$1C(a0); are we using animation 8 (ducking)?
		bne.s	Sonic_NoSpindash; if not, don't do anything
		move.b	($FFFFF603).w,d0; check currently held buttons
		andi.b	#$70,d0	; are A, B or C pressed?
		beq.w	Sonic_NoSpindash; if not, don't do anything
		move.b	#9,$1C(a0); start using animation 9 (spindash, actually warp 1)
		move.w	#$BE,d0
		jsr	(PlaySound_Special).l; play sound BE (spin sound)
		addq.l	#4,sp
		move.b	#1,$39(a0); set spindash charge flag

Sonic_NoSpindash:
		rts
; ===========================================================================

Sonic_Spindashing:
		move.b	($FFFFF602).w,d0
		btst	#1,d0	; has down been released yet?
		bne.s	Sonic_ChargeSpindash; if not, go to charging code
		move.b	#$E,$16(a0); set height/2 to $E
		move.b	#7,$17(a0); set width/2 to $7
		move.b	#2,$1C(a0); use animation 2 (rolling)
		addq.w	#5,$C(a0); add 5 to upper byte of playfield Y coordinate (?)
		move.b	#0,$39(a0); unset spindash charge flag
		move.w	#$2000,($FFFFEED0).w; *
		move.w	#$800,$14(a0); set Sonic's speed to $800
		btst	#0,$22(a0); which way are we facing?
		beq.s	loc_103D4; if we're facing left, don't do anything
		neg.w	$14(a0)	; set speed in other direction if we're facing right

loc_103D4:
		bset	#2,$22(a0); set roll flag
		rts
; ===========================================================================

Sonic_ChargeSpindash:
		move.b	($FFFFF603).w,d0
		andi.b	#$70,d0	; are A, B or C pressed?
		beq.w	Sonic_SkipCharging; if not, don't do anything
		nop		; charging code is missing

Sonic_SkipCharging:
		addq.l	#4,sp
		rts
; End of function Sonic_Spindash


Questions:
1) What is the purpose of the adding five to the playfield Y coordinate on line 32?
2) What is the purpose of moving $2000 into ($FFFFEED0).w on line 34? Does this have any bearing on question 3?
3) Why does the camera lock vertically when spindashing past the point at which the dynamic level resizing kicks in?
This post has been edited by Quickman: 18 December 2006 - 02:21 AM

#2 User is offline Aurochs 

Posted 18 December 2006 - 02:32 AM

  • Единый, могучий Советский Союз!
  • Posts: 2343
  • Joined: 09-January 05
  • Gender:Male
  • Project:Whatever catches my fancy
  • Wiki edits:325
1) may be a problem with the animation that requires moving the object to correct.

$EED0 is very close to the screen stack, so I would assume that that write does lock the screen. However, I don't know much about the screen stuff, other than that they seem to have called it a stack.

To check what it does, try patching the relevant instructions with NOP and see what happens.

#3 User is offline Tweaker 

Posted 18 December 2006 - 02:34 AM

  • Posts: 12389
  • Joined: 27-June 04
  • Gender:Male
Why does everybody keep using the nick arcade spindash? Use S2F, ffs.

#4 User is offline Quickman 

Posted 18 December 2006 - 02:42 AM

  • Posts: 5584
  • Joined: 03-December 03
  • Gender:Male
  • Location::x
  • Project:omg porjcet
  • Wiki edits:10

Aurochs, on Dec 18 2006, 07:32 AM, said:

$EED0 is very close to the screen stack, so I would assume that that write does lock the screen. However, I don't know much about the screen stuff, other than that they seem to have called it a stack.

To check what it does, try patching the relevant instructions with NOP and see what happens.

I have already tried that - it has no obvious effect. $EED0 is unreferenced elsewhere in the ROM.

Tweaker, on Dec 18 2006, 07:34 AM, said:

Why does everybody keep using the nick arcade spindash? Use S2F, ffs.

I used the Nick Arcade spindash for its incompletion - what I plan on doing is far easier if I'm working with this unashamedly incomplete code compared to the complete code in S2F.
This post has been edited by Quickman: 18 December 2006 - 02:43 AM

#5 User is offline Stealth 

Posted 18 December 2006 - 02:44 AM

  • Posts: 546
  • Joined: 31-July 05
  • Gender:Male
  • Project:HCGE, Project HC, Sonic Megamix, SonED2, [...]
  • Wiki edits:19
1) The spinning frames are drawn at a different offset than the standing and spindashing ones (the height is different). The offset is to correct for the height difference and keep Sonic on the ground
2) FFFFEED0 isn't used in Sonic 1, so it shouldn't be affecting anything else. Sonic 2 is using it as a timer for the spindash, The screen scrolling code is supposed to test it and subtract $100 if it's nonzero, keeping the screen frozen horizontally until it becomes zero. After that, the next two bytes are used as an index into the "recorded positions" array to pick up Sonic's last few positions and use them to give the effect of the screen "catching up"
3) I don't see anything here that should be affecting the screen boundary positioning

#6 User is offline Aurochs 

Posted 18 December 2006 - 02:55 AM

  • Единый, могучий Советский Союз!
  • Posts: 2343
  • Joined: 09-January 05
  • Gender:Male
  • Project:Whatever catches my fancy
  • Wiki edits:325

Quote

FFFFEED0 isn't used in Sonic 1, so it shouldn't be affecting anything else. Sonic 2 is using it as a timer for the spindash, The screen scrolling code is supposed to test it and subtract $100 if it's nonzero, keeping the screen frozen horizontally until it becomes zero. After that, the next two bytes are used as an index into the "recorded positions" array to pick up Sonic's last few positions and use them to give the effect of the screen "catching up"

Heh, clever. I thought it was just used to calculate the character's speed, given the way that it rapidly counts down after reving.

#7 User is offline Quickman 

Posted 18 December 2006 - 05:37 PM

  • Posts: 5584
  • Joined: 03-December 03
  • Gender:Male
  • Location::x
  • Project:omg porjcet
  • Wiki edits:10
Ninja update:

I've done some more testing; it's not actually locking the Y position, but the Y position isn't changing fast enough and it can't keep up with Sonic's movement.

I'm going to assume this is a preventable problem since spindash was implemented correctly in Sonic 2, complete with pipes to run through; what do I need to do?

#8 User is offline Quickman 

Posted 18 December 2006 - 07:57 PM

  • Posts: 5584
  • Joined: 03-December 03
  • Gender:Male
  • Location::x
  • Project:omg porjcet
  • Wiki edits:10
Ninja doublepost.

Stealth helped me realise where the problem is - the code for ducking is still being run, so the camera is being shifted down, which causes problems. Adding a delay identical to the one implemented in Sonic 2 final fixed the problem. (Now I know why they implemented that. :P)

Spindashing after that delay still causes problems at the moment, but I can deal with that fairly easily.

#9 User is offline SMTP 

Posted 19 December 2006 - 10:01 AM

  • Posts: 2145
  • Joined: 27-April 04
  • Gender:Male
  • Location:Ohio
  • Wiki edits:59
that's what I told you to do on IRC a couple days ago.. =P

Page 1 of 1
    Locked
    Locked Forum

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