Prev: ED9A Up: Map Next: EE5B
EE08: Handler: Ladders Ascending
Used by the routines at PlayerControls_Kempston and PlayerControls.
Input
IX On entry will be set to TablePlayerAttributes
Handler_LaddersAscending EE08 LD A,(IX+$11) Jump to Handler_LaddersDescending_1 if *PlayerActionState is already on a ladder.
EE0B CP $03
EE0D JR Z,Handler_LaddersDescending_1
EE0F LD C,(IX+$00) C=*TablePlayerAttributes.
EE12 LD B,(IX+$01) B=*F232.
EE15 LD HL,($5BD8) HL=*ReferenceLadders.
Handler_LaddersAscending_Loop EE18 LD A,(HL) Return if this ladder entry is the terminator (FF).
EE19 CP $FF
EE1B RET Z
EE1C INC HL Advance to the ladder vertical.
EE1D CP C Jump to Action_LadderAscend if this ladder is in the player's column.
EE1E JR Z,Action_LadderAscend
EE20 INC HL Advance to the next ladder entry.
EE21 JR Handler_LaddersAscending_Loop Jump to Handler_LaddersAscending_Loop.
Action_LadderAscend EE23 LD A,(HL) A=the ladder vertical.
EE24 INC HL Advance past this ladder's vertical.
EE25 DEC A Move two rows up for the bottom bound.
EE26 DEC A
EE27 CP B Jump to Handler_LaddersAscending_Loop if the player is not at the foot of this ladder.
EE28 JR NZ,Handler_LaddersAscending_Loop
EE2A LD (IX+$13),A Write the lower ladder bound to *PlayerLadderBoundLower.
EE2D ADD A,$05 Add 05 for the top bound.
EE2F LD (IX+$12),A Write the upper ladder bound to *PlayerLadderBoundUpper.
EE32 INC HL Advance to the next ladder entry.
EE33 LD A,(IX+$11) Jump to AnimateAscending if *PlayerActionState is already on a ladder.
EE36 CP $03
EE38 JR Z,AnimateAscending
Write the frame after the climb-up sprite we actually want (92) to *PlayerSpriteID. The next step subtracts 06 so the first drawn frame is correct.
EE3A LD (IX+$06),$98 Write 98 to *PlayerSpriteID.
EE3E LD (IX+$11),$03 Set *PlayerActionState to on a ladder.
This entry point is used by the routine at Handler_LaddersDescending.
AnimateAscending EE42 LD A,(IX+$06) Step *PlayerSpriteID back by one climb-up frame.
EE45 SUB $06
EE47 LD (IX+$06),A
EE4A CP $7A Jump to SkipResetAscendingFrame if the climb-up frames have not wrapped (frame 7A begins the next animation).
EE4C JR NZ,SkipResetAscendingFrame
Reset the climbing-up player sprite to the first frame.
EE4E LD (IX+$06),$92 Write 92 to *PlayerSpriteID.
SkipResetAscendingFrame EE52 LD (IX+$05),$01 Set *F236 to move up.
EE56 LD (IX+$02),$03 Centre *F233 on the ladder.
EE5A RET Return.
Prev: ED9A Up: Map Next: EE5B