![]() |
Routines |
| Prev: ED8F | Up: Map | Next: EE08 |
|
Used by the routines at PlayerControls_Kempston and PlayerControls.
|
||||||||
| Handler_LaddersDescending | ED9A | LD A,(IX+$11) | Jump to Handler_LaddersDescending_AlreadyOnLadder if *PlayerActionState is already on a ladder. | |||||
| ED9D | CP $03 | |||||||
| ED9F | JR Z,Handler_LaddersDescending_AlreadyOnLadder | |||||||
| EDA1 | LD C,(IX+$00) | C=*TablePlayerAttributes. | ||||||
| EDA4 | LD B,(IX+$01) | B=*PlayerVerticalCoordinate. | ||||||
| EDA7 | LD HL,($5BD8) | HL=*ReferenceLadders. | ||||||
| Handler_LaddersDescending_Loop | EDAA | LD A,(HL) | Return if this ladder entry is the terminator (FF). | |||||
| EDAB | CP $FF | |||||||
| EDAD | RET Z | |||||||
| EDAE | INC HL | Advance to the ladder vertical. | ||||||
| EDAF | CP C | Jump to Action_LadderDescend if this ladder is in the player's column. | ||||||
| EDB0 | JR Z,Action_LadderDescend | |||||||
| EDB2 | INC HL | Advance to the next ladder entry. | ||||||
| EDB3 | JR Handler_LaddersDescending_Loop | Jump to Handler_LaddersDescending_Loop. | ||||||
| Action_LadderDescend | EDB5 | LD A,(HL) | A=the ladder vertical. | |||||
| EDB6 | DEC A | Move two rows up for the bottom bound. | ||||||
| EDB7 | DEC A | |||||||
| EDB8 | LD (IX+$13),A | Write the lower ladder bound to *PlayerLadderBoundLower. | ||||||
| EDBB | ADD A,$05 | Add 05 for the top bound. | ||||||
| EDBD | LD (IX+$12),A | Write the upper ladder bound to *PlayerLadderBoundUpper. | ||||||
| EDC0 | INC HL | Advance to the next ladder entry. | ||||||
| EDC1 | SUB B | Compare that span with the player's vertical. | ||||||
| EDC2 | CP $04 | Jump to Handler_LaddersDescending_Loop if the player is not on this ladder. | ||||||
| EDC4 | JR NC,Handler_LaddersDescending_Loop | |||||||
| EDC6 | LD A,(IX+$11) | Jump to AnimateDescending if *PlayerActionState is already on a ladder. | ||||||
| EDC9 | CP $03 | |||||||
| EDCB | JR Z,AnimateDescending | |||||||
|
Write the frame before the climb-down sprite we actually want (80) to *PlayerSpriteID. The next step adds 06 so the first drawn frame is correct.
|
||||||||
| EDCD | LD (IX+$06),$7A | Write 7A to *PlayerSpriteID. | ||||||
| EDD1 | LD (IX+$11),$03 | Set *PlayerActionState to on a ladder. | ||||||
| AnimateDescending | EDD5 | LD A,(IX+$06) | Advance *PlayerSpriteID by one climb-down frame. | |||||
| EDD8 | ADD A,$06 | |||||||
| EDDA | LD (IX+$06),A | |||||||
| EDDD | CP $98 | Jump to SkipResetDescendingFrame if the climb-down frames have not wrapped (frame 98 begins the next animation). | ||||||
| EDDF | JR NZ,SkipResetDescendingFrame | |||||||
|
Reset the climbing-down player sprite to the first frame.
|
||||||||
| EDE1 | LD (IX+$06),$80 | Write 80 to *PlayerSpriteID. | ||||||
| SkipResetDescendingFrame | EDE5 | DEC (IX+$05) | Set *PlayerVerticalMovement to move down. | |||||
| EDE8 | LD (IX+$02),$03 | Centre *PlayerHorizontalPosition on the ladder. | ||||||
| EDEC | RET | Return. | ||||||
|
Already climbing down; stop at the bottom bound.
|
||||||||
| Handler_LaddersDescending_AlreadyOnLadder | EDED | LD A,(IX+$01) | Jump to AnimateDescending if *PlayerVerticalCoordinate has not reached *PlayerLadderBoundLower. | |||||
| EDF0 | CP (IX+$13) | |||||||
| EDF3 | JR NZ,AnimateDescending | |||||||
| EDF5 | RET | Return. | ||||||
|
This entry point is used by the routine at Handler_LaddersAscending.
Already climbing up; stop at the top bound.
|
||||||||
| Handler_LaddersAscending_AlreadyOnLadder | EDF6 | LD A,(IX+$12) | Jump to AnimateAscending if *PlayerVerticalCoordinate has not reached *PlayerLadderBoundUpper. | |||||
| 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 *PlayerVerticalPosition is not 03. | ||||||
| EE03 | CP $03 | |||||||
| EE05 | JR NZ,AnimateAscending | |||||||
| EE07 | RET | Return. | ||||||
| Prev: ED8F | Up: Map | Next: EE08 |