![]() |
Routines |
| Prev: 56857 | Up: Map | Next: 58334 |
|
Used by the routine at Dispatch_Handlers.
Moves, collides and draws the player entity at Player.
|
||||
| Handler_Player | 57804 | LD A,(25711) | Return if *GameActiveFlag is set (demo / intro). | |
| 57807 | OR A | |||
| 57808 | RET NZ | |||
| 57809 | LD HL,46513 | Write Graphics_PlayerFont to *CHARS. | ||
| 57812 | LD (23606),HL | |||
| 57815 | LD IX,25764 | IX=Player. | ||
| 57819 | LD A,(25737) | Erase the player while *ActionTimer is running. | ||
| 57822 | OR A | |||
| 57823 | PUSH AF | |||
| 57824 | CALL NZ,JumpTable_DrawEntity | |||
| 57827 | POP AF | |||
| 57828 | RET NZ | |||
| 57829 | LD A,(25653) | Jump to Player_Hit if *Player_HitTimer is set. | ||
| 57832 | OR A | |||
| 57833 | JP NZ,Player_Hit | |||
| 57836 | LD A,(25616) | Jump to Player_JumpAnim if *Player_JumpTimer is set. | ||
| 57839 | OR A | |||
| 57840 | JP NZ,Player_JumpAnim | |||
| 57843 | LD A,(25738) | Call Player_ClimbStop if *ClimbRow is set. | ||
| 57846 | OR A | |||
| 57847 | CALL NZ,Player_ClimbStop | |||
| 57850 | CALL Build_PlayerMask | Call Build_PlayerMask. | ||
| 57853 | LD A,(25652) | Start a fall if *CollisionState is not a collision. | ||
| 57856 | CP 3 | |||
| 57858 | JR Z,Handler_Player_Apply | |||
| 57860 | LD (IX+9),252 | |||
| 57864 | PUSH IY | Stash IY on the stack. | ||
| 57866 | LD IY,(25648) | IY=*ReferenceActors. | ||
| Handler_Player_ActorLoop | 57870 | LD A,(IY+0) | Jump to Handler_Player_ActorsDone if the terminator 255 is reached. | |
| 57873 | CP 255 | |||
| 57875 | JR Z,Handler_Player_ActorsDone | |||
| 57877 | BIT 7,A | Jump to Handler_Player_ActorNext if this actor is inactive. | ||
| 57879 | JR NZ,Handler_Player_ActorNext | |||
| 57881 | CALL Test_ActorCollision | Call Test_ActorCollision. | ||
| 57884 | LD A,(25652) | Stop scanning once *CollisionState is a collision. | ||
| 57887 | CP 3 | |||
| 57889 | JR Z,Handler_Player_ActorsDone | |||
| Handler_Player_ActorNext | 57891 | LD DE,13 | IY+=0013. | |
| 57894 | ADD IY,DE | |||
| 57896 | JR Handler_Player_ActorLoop | Jump to Handler_Player_ActorLoop. | ||
| Handler_Player_ActorsDone | 57898 | POP IY | Restore IY from the stack. | |
| Handler_Player_Apply | 57900 | LD A,(IX+9) | Probe the ceiling while the vertical delta is negative. | |
| 57903 | OR A | |||
| 57904 | JR Z,Handler_Player_Stand | |||
| 57906 | CP 128 | |||
| 57908 | JR C,Handler_Player_Stand | |||
| 57910 | CALL Probe_Ceiling | |||
| 57913 | LD A,(25656) | Increase *Player_StandTimer and honour a collision. | ||
| 57916 | INC A | |||
| 57917 | LD (25656),A | |||
| 57920 | LD A,(25652) | |||
| 57923 | OR A | |||
| 57924 | JR Z,Handler_Player_Resolve | |||
| Handler_Player_Stand | 57926 | LD A,(25656) | Start a hit if *Player_StandTimer reaches 10. | |
| 57929 | CP 10 | |||
| 57931 | JP NC,Player_StartHit | |||
| 57934 | XOR A | Clear *Player_StandTimer. | ||
| 57935 | LD (25656),A | |||
| 57938 | LD A,(25726) | Jump to Controls_Kempston if Kempston is selected. | ||
| 57941 | OR A | |||
| 57942 | JP NZ,Controls_Kempston | |||
| 57945 | CALL 654 | Call KEY_SCAN. | ||
| 57948 | LD A,E | A=the keypress. | ||
| 57949 | LD IX,25764 | IX=Player. | ||
| 57953 | LD HL,25727 | Call Player_MoveLeft if the left key matches. | ||
| 57956 | CP (HL) | |||
| 57957 | PUSH AF | |||
| 57958 | CALL Z,Player_MoveLeft | |||
| 57961 | POP AF | |||
| 57962 | PUSH AF | Call Player_MoveRight if the right key matches. | ||
| 57963 | LD HL,25728 | |||
| 57966 | CP (HL) | |||
| 57967 | CALL Z,Player_MoveRight | |||
| 57970 | POP AF | |||
| 57971 | PUSH AF | Call Player_ClimbUp if the up key matches. | ||
| 57972 | LD HL,25729 | |||
| 57975 | CP (HL) | |||
| 57976 | CALL Z,Player_ClimbUp | |||
| 57979 | POP AF | |||
| 57980 | PUSH AF | Call Player_ClimbDown if the down key matches. | ||
| 57981 | LD HL,25730 | |||
| 57984 | CP (HL) | |||
| 57985 | CALL Z,Player_ClimbDown | |||
| 57988 | POP AF | |||
| 57989 | LD HL,25731 | Call Player_Action if the action key matches. | ||
| 57992 | CP (HL) | |||
| 57993 | CALL Z,Player_Action | |||
|
This entry point is used by the routine at Handler_Housekeeping.
|
||||
| Handler_Player_Resolve | 57996 | LD A,(25738) | Fall through to Handler_Player_Draw when *ClimbRow is set. | |
| 57999 | OR A | |||
| 58000 | JR NZ,Handler_Player_Draw | |||
|
This entry point is used by the routine at Handler_Combination.
|
||||
| Handler_Player_Draw | 58002 | CALL JumpTable_AdvanceEntity | Call JumpTable_AdvanceEntity. | |
|
Start a fall if the new row is off the bottom of the room.
|
||||
| 58005 | LD A,B | Jump to Handler_Player_Collision unless the new row is 27. | ||
| 58006 | CP 27 | |||
| 58008 | JR NZ,Handler_Player_Collision | |||
| 58010 | LD (IX+9),252 | Write 252 as the vertical delta. | ||
| 58014 | XOR A | Write 0 to *CollisionState and *Player_JumpTimer. | ||
| 58015 | LD (25652),A | |||
| 58018 | LD (25616),A | |||
| 58021 | LD A,12 | Write 12 to *Player_StandTimer. | ||
| 58023 | LD (25656),A | |||
| Handler_Player_Collision | 58026 | LD A,(25652) | Jump to Handler_Player_Commit if *CollisionState is a collision. | |
| 58029 | CP 3 | |||
| 58031 | JP Z,Handler_Player_Commit | |||
|
Probe the tiles above while the player is jumping.
|
||||
| 58034 | LD A,(25616) | Jump to Handler_Player_Horizontal if *Player_JumpTimer is zero. | ||
| 58037 | OR A | |||
| 58038 | JR Z,Handler_Player_Horizontal | |||
| 58040 | LD A,B | Jump to Handler_Player_Horizontal if the row has not changed. | ||
| 58041 | CP (IX+1) | |||
| 58044 | JR Z,Handler_Player_Horizontal | |||
| 58046 | LD A,E | A=3 or 2 when fine-Y is 7. | ||
| 58047 | CP 7 | |||
| 58049 | LD A,0 | |||
| 58051 | ADC A,2 | |||
| 58053 | PUSH AF | |||
| 58054 | CALL JumpTable_ConvertCoordinate | Convert that cell into a Buffer_RoomTiles pointer. | ||
| 58057 | LD DE,24014 | |||
| 58060 | ADD HL,DE | |||
| 58061 | POP AF | |||
| 58062 | LD B,A | |||
| Handler_Player_ProbeUp | 58063 | LD A,(HL) | Jump to Handler_Player_ProbeUpNext if this tile is solid (16 or higher). | |
| 58064 | CP 16 | |||
| 58066 | JR NC,Handler_Player_ProbeUpNext | |||
| 58068 | XOR A | Clear the vertical delta. | ||
| 58069 | LD (IX+9),A | |||
| 58072 | INC BC | Jump to Handler_Player_ProbeLeftTest until the probe count is zero, then clear the sprite. | ||
| 58073 | DJNZ Handler_Player_ProbeLeftTest | |||
| 58075 | LD (IX+6),0 | |||
| Handler_Player_ProbeUpNext | 58079 | INC HL | Advance the tile pointer and loop back to Handler_Player_ProbeUp. | |
| 58080 | DJNZ Handler_Player_ProbeUp | |||
|
Probe the tiles to the right while moving right.
|
||||
| Handler_Player_Horizontal | 58082 | CALL JumpTable_AdvanceEntity | Call JumpTable_AdvanceEntity. | |
| 58085 | LD A,(IX+8) | Jump to Handler_Player_Left if the horizontal delta is negative. | ||
| 58088 | CP 128 | |||
| 58090 | JR NC,Handler_Player_Left | |||
| 58092 | LD A,C | Jump to Handler_Player_Commit if the column has not changed. | ||
| 58093 | CP (IX+0) | |||
| 58096 | JR Z,Handler_Player_Commit | |||
| 58098 | LD A,D | A=4 or 3 when fine-Y is 7. | ||
| 58099 | CP 7 | |||
| 58101 | LD A,0 | |||
| 58103 | ADC A,3 | |||
| 58105 | PUSH AF | |||
| 58106 | CALL JumpTable_ConvertCoordinate | Convert that cell into a Buffer_RoomTiles pointer. | ||
| 58109 | LD DE,24014 | |||
| 58112 | ADD HL,DE | |||
| 58113 | POP AF | |||
| 58114 | LD B,A | |||
| 58115 | LD DE,32 | |||
| Handler_Player_ProbeRight | 58118 | LD A,(HL) | Jump to Handler_Player_ProbeRightNext if this tile is solid (16 or higher). | |
| 58119 | CP 16 | |||
| 58121 | JR NC,Handler_Player_ProbeRightNext | |||
| 58123 | XOR A | Clear the horizontal delta. | ||
| 58124 | LD (IX+8),A | |||
| 58127 | LD A,(25616) | Jump to Handler_Player_ProbeRightNext if *Player_JumpTimer is zero. | ||
| 58130 | OR A | |||
| 58131 | JR Z,Handler_Player_ProbeRightNext | |||
| 58133 | XOR A | Write 0 to *Player_JumpTimer and clear the sprite. | ||
| 58134 | LD (25616),A | |||
| 58137 | LD (IX+6),0 | |||
| Handler_Player_ProbeRightNext | 58141 | ADD HL,DE | Step down one row and loop back to Handler_Player_ProbeRight, then jump to Handler_Player_Commit. | |
| 58142 | DJNZ Handler_Player_ProbeRight | |||
| 58144 | JR Handler_Player_Commit | |||
|
Probe the tiles to the left while moving left.
|
||||
| Handler_Player_Left | 58146 | LD A,C | Jump to Handler_Player_Commit if the column has not changed. | |
| 58147 | CP (IX+0) | |||
| 58150 | JR Z,Handler_Player_Commit | |||
| 58152 | DEC C | Point two columns left; A=4 or 3 when fine-Y is 7. | ||
| 58153 | DEC C | |||
| 58154 | LD A,D | |||
| 58155 | CP 7 | |||
| 58157 | LD A,0 | |||
| 58159 | ADC A,3 | |||
| 58161 | PUSH AF | |||
| 58162 | CALL JumpTable_ConvertCoordinate | Convert that cell into a Buffer_RoomTiles pointer. | ||
| 58165 | LD DE,24014 | |||
| 58168 | ADD HL,DE | |||
| 58169 | POP AF | |||
| 58170 | LD B,A | |||
| 58171 | LD DE,32 | |||
| Handler_Player_ProbeLeft | 58174 | LD A,(HL) | Jump to Handler_Player_ProbeLeftNext if this tile is solid (16 or higher). | |
| Handler_Player_ProbeLeftTest | 58175 | CP 16 | ||
| 58177 | JR NC,Handler_Player_ProbeLeftNext | |||
| 58179 | XOR A | Clear the horizontal delta. | ||
| 58180 | LD (IX+8),A | |||
| 58183 | LD A,(25616) | Jump to Handler_Player_ProbeLeftNext if *Player_JumpTimer is zero. | ||
| 58186 | OR A | |||
| 58187 | JR Z,Handler_Player_ProbeLeftNext | |||
| 58189 | XOR A | Write 0 to *Player_JumpTimer and clear the sprite. | ||
| 58190 | LD (25616),A | |||
| 58193 | LD (IX+6),0 | |||
| Handler_Player_ProbeLeftNext | 58197 | ADD HL,DE | Step down one row and loop back to Handler_Player_ProbeLeft. | |
| 58198 | DJNZ Handler_Player_ProbeLeft | |||
|
This entry point is used by the routines at Handler_Housekeeping and Handler_Combination.
|
||||
| Handler_Player_Commit | 58200 | CALL JumpTable_AdvanceEntity | Call JumpTable_AdvanceEntity. | |
| 58203 | LD A,C | Jump to Handler_Player_ClearDeltas if the new column is off-screen. | ||
| 58204 | CP 34 | |||
| 58206 | JP Z,Handler_Player_ClearDeltas | |||
| 58209 | CP 3 | |||
| 58211 | JP Z,Handler_Player_ClearDeltas | |||
| 58214 | LD A,B | Start a fall if the new row is 26. | ||
| 58215 | CP 26 | |||
| 58217 | JR NZ,Handler_Player_Paint | |||
| 58219 | XOR A | |||
| 58220 | LD (25616),A | |||
| 58223 | LD (IX+9),252 | |||
|
Store, move and draw the player.
|
||||
| Handler_Player_Paint | 58227 | CALL JumpTable_StorePosition | Call JumpTable_StorePosition. | |
| 58230 | CALL JumpTable_MoveEntity | Call JumpTable_MoveEntity. | ||
| 58233 | CALL JumpTable_DrawEntity | Call JumpTable_DrawEntity. | ||
| 58236 | LD A,(25652) | Draw a collided actor through JumpTable_DrawActor. | ||
| 58239 | CP 3 | |||
| 58241 | JR NZ,Handler_Player_Reset | |||
| 58243 | LD IX,(25675) | |||
| 58247 | CALL JumpTable_DrawActor | |||
| Handler_Player_Reset | 58250 | LD IX,25764 | Clear movement when the player is not jumping. | |
| 58254 | XOR A | |||
| 58255 | LD (25652),A | |||
| 58258 | LD A,(25616) | |||
| 58261 | OR A | |||
| 58262 | JR NZ,Handler_Player_Floor | |||
| Handler_Player_ClearDeltas | 58264 | XOR A | ||
| 58265 | LD (25616),A | |||
| 58268 | LD (IX+8),0 | |||
| 58272 | LD (IX+9),0 | |||
| Handler_Player_Floor | 58276 | LD A,(IX+1) | Jump to Award_Action when standing on the floor. | |
| 58279 | CP 3 | |||
| 58281 | JR Z,Handler_Player_Award | |||
| 58283 | LD A,(25617) | |||
| 58286 | OR A | |||
| 58287 | RET Z | |||
| Handler_Player_Award | 58288 | JP Award_Action | Jump to Award_Action. | |
|
This entry point is used by the routine at Initialise_Game.
Clear the play area and the room buffers.
|
||||
| Clear_PlayArea | 58291 | XOR A | Write BLACK to *ATTR_T. | |
| 58292 | LD (23695),A | |||
| 58295 | CALL 7341 | Call CL_ALL. | ||
| 58298 | LD HL,24014 | Write 0 to the 800 bytes at Buffer_RoomTiles. | ||
| 58301 | LD BC,800 | |||
| Clear_PlayArea_TileLoop | 58304 | XOR A | ||
| 58305 | LD (HL),A | |||
| 58306 | INC HL | |||
| 58307 | DEC BC | |||
| 58308 | LD A,B | |||
| 58309 | OR C | |||
| 58310 | JR NZ,Clear_PlayArea_TileLoop | |||
| 58312 | LD BC,800 | Fill Buffer_RoomAttributes with *ATTR_T. | ||
| 58315 | LD HL,24814 | |||
| Clear_PlayArea_AttributeLoop | 58318 | LD A,(23695) | ||
| 58321 | LD (HL),A | |||
| 58322 | INC HL | |||
| 58323 | DEC BC | |||
| 58324 | LD A,B | |||
| 58325 | OR C | |||
| 58326 | JR NZ,Clear_PlayArea_AttributeLoop | |||
| 58328 | LD B,24 | Call CL_LINE for 24 lines. | ||
| 58330 | CALL 3652 | |||
| 58333 | RET | Return. | ||
|
View the equivalent code in Booty.
|
||||
| Prev: 56857 | Up: Map | Next: 58334 |