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.)
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?
; --------------------------------------------------------------------------- ; 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


00