Prev: 60826 Up: Map Next: 61019
60936: Handler: Ladders Ascending
Used by the routines at PlayerControls_Kempston and PlayerControls.
Input
IX On entry will be set to TablePlayerAttributes
Handler_LaddersAscending 60936 LD A,(IX+17) Jump to Handler_LaddersDescending_1 if *IX+17 is equal to 3.
60939 CP 3
60941 JR Z,Handler_LaddersDescending_1
60943 LD C,(IX+0) C=*IX+0.
60946 LD B,(IX+1) B=*IX+1.
60949 LD HL,(23512) HL=*ReferenceLadders.
Handler_LaddersAscending_Loop 60952 LD A,(HL) Return if *HL is equal to 255.
60953 CP 255
60955 RET Z
60956 INC HL Increment HL by one.
60957 CP C Jump to Action_LadderAscend if A is equal to C.
60958 JR Z,Action_LadderAscend
60960 INC HL Increment HL by one.
60961 JR Handler_LaddersAscending_Loop Jump to Handler_LaddersAscending_Loop.
Action_LadderAscend 60963 LD A,(HL) A=*HL.
60964 INC HL Increment HL by one.
60965 DEC A Decrease A by two.
60966 DEC A
60967 CP B Jump to Handler_LaddersAscending_Loop if A is not equal to B.
60968 JR NZ,Handler_LaddersAscending_Loop
60970 LD (IX+19),A Write A to *IX+19.
60973 ADD A,5 A+=5.
60975 LD (IX+18),A Write A to *IX+18.
60978 INC HL Increment HL by one.
60979 LD A,(IX+17) Jump to AnimateAscending if *IX+17 is equal to 3.
60982 CP 3
60984 JR Z,AnimateAscending
Write the frame after the player sprite we actually want (146) to be the active frame. This is because the first thing to occur is to subtract 6 from it, so it'll then be correct.
60986 LD (IX+6),152 Write 152 to *IX+6 (*PlayerSpriteID).
60990 LD (IX+17),3 Write 3 to *IX+17.
This entry point is used by the routine at Handler_LaddersDescending.
AnimateAscending 60994 LD A,(IX+6) Decrease *IX+6 (*PlayerSpriteID) by 6.
60997 SUB 6
60999 LD (IX+6),A
61002 CP 122 Jump to SkipResetAscendingFrame if the frame is within the boundaries of the frames available for this animation (frame ID 122 is the first frame of the next animation).
61004 JR NZ,SkipResetAscendingFrame
Reset the climbing-up player sprite to the first frame in the animation.
61006 LD (IX+6),146 Write 146 to *IX+6 (*PlayerSpriteID).
SkipResetAscendingFrame 61010 LD (IX+5),1 Write 1 to *IX+5 (*62006).
61014 LD (IX+2),3 Write 3 to *IX+2 (*62003).
61018 RET Return.
Prev: 60826 Up: Map Next: 61019