Prev: ED8F Up: Map Next: EE08
ED9A: Handler: Ladders Descending
Used by the routines at PlayerControls_Kempston and PlayerControls.
Input
IX On entry will be set to TablePlayerAttributes
Handler_LaddersDescending ED9A LD A,(IX+$11) Jump to Handler_LaddersDescending_0 if *IX+11 is equal to 03.
ED9D CP $03
ED9F JR Z,Handler_LaddersDescending_0
EDA1 LD C,(IX+$00) C=*IX+00.
EDA4 LD B,(IX+$01) B=*IX+01.
EDA7 LD HL,($5BD8) HL=*ReferenceLadders.
Handler_LaddersDescending_Loop EDAA LD A,(HL) Return if *HL is equal to FF.
EDAB CP $FF
EDAD RET Z
EDAE INC HL Increment HL by one.
EDAF CP C Jump to Action_LadderDescend if A is equal to C.
EDB0 JR Z,Action_LadderDescend
EDB2 INC HL Increment HL by one.
EDB3 JR Handler_LaddersDescending_Loop Jump to Handler_LaddersDescending_Loop.
Action_LadderDescend EDB5 LD A,(HL) A=*HL.
EDB6 DEC A Decrease A by two.
EDB7 DEC A
EDB8 LD (IX+$13),A Write A to *IX+13.
EDBB ADD A,$05 A+=05.
EDBD LD (IX+$12),A Write A to *IX+12.
EDC0 INC HL Increment HL by one.
EDC1 SUB B A-=B.
EDC2 CP $04 Jump to Handler_LaddersDescending_Loop if A is higher than 04.
EDC4 JR NC,Handler_LaddersDescending_Loop
EDC6 LD A,(IX+$11) Jump to AnimateDescending if *IX+11 is equal to 03.
EDC9 CP $03
EDCB JR Z,AnimateDescending
Write the frame before the player sprite we actually want (80) to be the active frame. This is because the first thing to occur is to add 06 to it, so it'll then be correct.
EDCD LD (IX+$06),$7A Write 7A to *IX+06 (*PlayerSpriteID).
EDD1 LD (IX+$11),$03 Write 03 to *IX+11.
AnimateDescending EDD5 LD A,(IX+$06) Increment *IX+06 (*PlayerSpriteID) by 06.
EDD8 ADD A,$06
EDDA LD (IX+$06),A
EDDD CP $98 Jump to SkipResetDescendingFrame if the frame is within the boundaries of the frames available for this animation (frame ID 98 is the first frame of the next animation).
EDDF JR NZ,SkipResetDescendingFrame
Reset the climbing-down player sprite to the first frame in the animation.
EDE1 LD (IX+$06),$80 Write 80 to *IX+06 (*PlayerSpriteID).
SkipResetDescendingFrame EDE5 DEC (IX+$05) Decrease *IX+05 by one.
EDE8 LD (IX+$02),$03 Write 03 to *IX+02.
EDEC RET Return.
Handler_LaddersDescending_0 EDED LD A,(IX+$01) Jump to AnimateDescending if *IX+01 is not equal to *IX+13.
EDF0 CP (IX+$13)
EDF3 JR NZ,AnimateDescending
EDF5 RET Return.
This entry point is used by the routine at Handler_LaddersAscending.
Handler_LaddersDescending_1 EDF6 LD A,(IX+$12) Jump to AnimateAscending if *IX+01 is not equal to *IX+12.
EDF9 LD B,A
EDFA LD A,(IX+$01)
EDFD CP B
EDFE JR NZ,AnimateAscending
EE00 LD A,(IX+$03) Jump to AnimateAscending if *IX+03 is not equal to 03.
EE03 CP $03
EE05 JR NZ,AnimateAscending
EE07 RET Return.
Prev: ED8F Up: Map Next: EE08