Alternating

by circlefriendo

Game: SMW

Description: Alternating Double Jump (Motor Skills Double Jump)

;#Freeram
!Freeram_JumpCharges = $7f9e06

!NJumpYSpeed = $B0
!SJumpYSpeed = $B6

!NJumpSound = $01
!NJumpSoundPort = $1DFA|!addr
!SJumpSound = $04
!SJumpSoundPort = $1DFC|!addr

!SparkleTimer = $18D3|!addr
!FlyingFlag = $1407|!addr
!RidingYoshiFlag = $187A|!addr
!SpinJumpFlag = $140D|!addr

!ContactFlags = $77
!Down = %00000100
!ClimbingFlags = $74
!WaterFlag = $75
!MarioAnimation = $71
!PauseFlag = $13D4|!addr

LDA !PauseFlag	;can't jump when paused
BNE Return	;

LDA !ContactFlags   ; If on ground
AND.b #!Down
ORA !ClimbingFlags  ; or climbing
ORA !WaterFlag      ; or swimming
BNE RestoreJumps    ; Restore jump charge

LDA !MarioAnimation  ; If animation (dying, etc.)
ORA !FlyingFlag      ; or flying
ORA !RidingYoshiFlag ; or riding yoshi
BNE DisableSparkles  ; disable jumps

LDA !Freeram_JumpCharges
BEQ Return

LDA !SparkleTimer
BNE CheckJumpType

LDA #$80
STA !SparkleTimer

CheckJumpType:
LDA $16     ; If B is pressed
BMI NormalJump
LDA $18     ; If A is pressed
BPL Return

SpinJump:
LDA !SpinJumpFlag
BNE Return

LDA #$01
STA !SpinJumpFlag

LDA #!SJumpYSpeed
STA $7D

LDA #!SJumpSound
STA !SJumpSoundPort

BRA ConsumeJump

NormalJump:
LDA !SpinJumpFlag
BEQ Return

STZ !SpinJumpFlag
LDA #!NJumpYSpeed
STA $7D

LDA #!NJumpSound
STA !NJumpSoundPort

ConsumeJump:
LDA !Freeram_JumpCharges
DEC A
STA !Freeram_JumpCharges
BEQ DisableSparkles
RTL

RestoreJumps:
LDA #$01
STA !Freeram_JumpCharges

DisableSparkles:
STZ !SparkleTimer

Return:
RTL




back to listings