; we're already in a swooping stage, so update swoop action (for not holding a direction first) ; NOTE: this is skipped if previous swoop action was to terminate flight ; X: swoop action ; $02 if neutral or neutral from upward tilt ; $03 if being lifted by air or neutral from downward tilt CODE_00D824: CPY.B #$02 ; \ if neutral swoop stage BCC + ; | JSR SetNextCapeLift ; / update max dive based on downward speed + LDX.W PrevSwoopAction ; \ if we previously entered swoop action 4 CPX.B #$04 ; | stay at swoop action 4 BEQ CODE_00D856 ; / and continue going through swoop stages LDX.B #$03 ; \ set swoop action to 3 LDY.B PlayerYSpeed ; | BMI CODE_00D856 ; | if moving upward (being lifted by air) LDA.B byetudlrHold ; | AND.B #$03 ; | and if releasing a direction TAY ; | BNE CODE_00D849 ; | > (go check holding direction otherwise) LDA.W PlyrSwoopStage ; | CMP.B #$04 ; | while diving BCS CODE_00D856 ; / DEX ; \ if not diving, set swoop action to 2 BRA CODE_00D856 ; / go check if time to change swoop stage ; we're holding left or right, check if we're holding forward or backward and update swoop action ; NOTE: this is not skipped if previous swoop action was to terminate flight (likely an oversight) ; X: swoop action ; $00 if holding backward ; $01 if holding forward CODE_00D849: LSR A ; \ LDY.B PlayerDirection ; | BEQ + ; | set swoop action to 0 if holding backward EOR.B #$01 ; | and 1 if holding forward + TAX ; / CPX.W PrevSwoopAction ; \ if holding different direction since last frame BNE CODE_00D85B ; / change stage regardless of swoop stage timer here we check if it's time to update swoop stage CODE_00D856: LDA.W SwoopStageTimer ; \ dont change swoop stage BNE CODE_00D87E ; / if swoop stage timer is nonzero ; we're either starting swooping flight or updating swoop stage, check for holding X/Y and update swoop stage ; X: swoop action ; $00 if holding backward ; $01 if holding forward ; $02 if neutral or neutral from upward tilt ; $03 if being lifted by air or neutral from downward tilt ; $04 if released X/Y (or if prev swoop action was 4) CODE_00D85B: BIT.B byetudlrHold ; \ if not holding X/Y BVS + ; | LDX.B #$04 ; / set swoop action to 4 + LDA.W PlyrSwoopStage ; \ if we havent reached our target swoop stage CMP.W SwoopTargetStage,X ; | BEQ CODE_00D87E ; | CLC ; | ADC.W SwoopStageShift,X ; | shift current stage by 1 STA.W PlyrSwoopStage ; / toward target stage LDA.B #$08 ; > perpare duration of each stage to 8 frames LDY.W CapeLiftMaxYSpd ; \ but if we dived enough CPY.B #$C8 ; | we get a huge lift from the wind BNE + ; | LDA.B #$02 ; / prepare stage duration to 2 frames instead + STA.W SwoopStageTimer ; > set duration of each stage