Prev: 60815 Up: Map Next: 60936
60826: Handler: Ladders Descending
Used by the routines at PlayerControls_Kempston and PlayerControls.
Input
IX On entry will be set to TablePlayerAttributes
Handler_LaddersDescending 60826 LD A,(IX+17) Jump to Handler_LaddersDescending_0 if *IX+17 is equal to 3.
60829 CP 3
60831 JR Z,Handler_LaddersDescending_0
60833 LD C,(IX+0) C=*IX+0.
60836 LD B,(IX+1) B=*IX+1.
60839 LD HL,(23512) HL=*ReferenceLadders.
Handler_LaddersDescending_Loop 60842 LD A,(HL) Return if *HL is equal to 255.
60843 CP 255
60845 RET Z
60846 INC HL Increment HL by one.
60847 CP C Jump to Action_LadderDescend if A is equal to C.
60848 JR Z,Action_LadderDescend
60850 INC HL Increment HL by one.
60851 JR Handler_LaddersDescending_Loop Jump to Handler_LaddersDescending_Loop.
Action_LadderDescend 60853 LD A,(HL) A=*HL.
60854 DEC A Decrease A by two.
60855 DEC A
60856 LD (IX+19),A Write A to *IX+19.
60859 ADD A,5 A+=5.
60861 LD (IX+18),A Write A to *IX+18.
60864 INC HL Increment HL by one.
60865 SUB B A-=B.
60866 CP 4 Jump to Handler_LaddersDescending_Loop if A is higher than 4.
60868 JR NC,Handler_LaddersDescending_Loop
60870 LD A,(IX+17) Jump to AnimateDescending if *IX+17 is equal to 3.
60873 CP 3
60875 JR Z,AnimateDescending
Write the frame before the player sprite we actually want (128) to be the active frame. This is because the first thing to occur is to add 6 to it, so it'll then be correct.
60877 LD (IX+6),122 Write 122 to *IX+6 (*PlayerSpriteID).
60881 LD (IX+17),3 Write 3 to *IX+17.
AnimateDescending 60885 LD A,(IX+6) Increment *IX+6 (*PlayerSpriteID) by 6.
60888 ADD A,6
60890 LD (IX+6),A
60893 CP 152 Jump to SkipResetDescendingFrame if the frame is within the boundaries of the frames available for this animation (frame ID 152 is the first frame of the next animation).
60895 JR NZ,SkipResetDescendingFrame
Reset the climbing-down player sprite to the first frame in the animation.
60897 LD (IX+6),128 Write 128 to *IX+6 (*PlayerSpriteID).
SkipResetDescendingFrame 60901 DEC (IX+5) Decrease *IX+5 by one.
60904 LD (IX+2),3 Write 3 to *IX+2.
60908 RET Return.
Handler_LaddersDescending_0 60909 LD A,(IX+1) Jump to AnimateDescending if *IX+1 is not equal to *IX+19.
60912 CP (IX+19)
60915 JR NZ,AnimateDescending
60917 RET Return.
This entry point is used by the routine at Handler_LaddersAscending.
Handler_LaddersDescending_1 60918 LD A,(IX+18) Jump to AnimateAscending if *IX+1 is not equal to *IX+18.
60921 LD B,A
60922 LD A,(IX+1)
60925 CP B
60926 JR NZ,AnimateAscending
60928 LD A,(IX+3) Jump to AnimateAscending if *IX+3 is not equal to 3.
60931 CP 3
60933 JR NZ,AnimateAscending
60935 RET Return.
Prev: 60815 Up: Map Next: 60936