Prev: 56865 Up: Map Next: 57164
57098: PLAYER_MOVEMENT
Used by the routine PLAY_GAME.
PLAYER_MOVEMENT 57098 LD A,(59651) This is pointless - get PLAYER_INPUT_DATA and don't use it.
57101 RRA
57102 CALL GET_PLAYER_FIRING_POSITION If Megalaser is off, this is CALL 57164. If it's on, it's CALL C,57164
57105 LD HL,(59649) PLAYER_X_COORD contains X position (8-?), PLAYER_Y_COORD contains Y position (0-29) The player moves in Y in 8p increments
57108 LD DE,(59649)
57112 LD A,(59651) Get PLAYER_INPUT_DATA
57115 RRA
57116 RRA
57117 JR NC,PLAYER_MOVEMENT_0
57119 DEC H Move player left
PLAYER_MOVEMENT_0 57120 RRA
57121 JR NC,PLAYER_MOVEMENT_1 If we haven't looped, skip over moving right
57123 INC H Move player right
PLAYER_MOVEMENT_1 57124 RRA
57125 JR NC,PLAYER_MOVEMENT_2
57127 INC L Move player down
PLAYER_MOVEMENT_2 57128 RRA
57129 JR NC,PLAYER_MOVEMENT_3
57131 DEC L Move player up
PLAYER_MOVEMENT_3 57132 LD A,H
57133 CP 30
57135 JR C,PLAYER_MOVEMENT_4
57137 LD H,D Player is too far right; return to previous horizontal position
PLAYER_MOVEMENT_4 57138 LD A,L
57139 CP 8
57141 JR C,PLAYER_MOVEMENT_5
57143 LD D,A
57144 LD A,(59675)
57147 CP 6
57149 JP C,PLAYER_MOVEMENT_6
57152 LD A,D
57153 CP 45
57155 JR NC,PLAYER_MOVEMENT_5
57157 JR PLAYER_MOVEMENT_6
PLAYER_MOVEMENT_5 57159 LD L,E Move player back to previous vertical position
PLAYER_MOVEMENT_6 57160 LD (59649),HL Store player position to PLAYER_X_COORD and PLAYER_Y_COORD
57163 RET
Prev: 56865 Up: Map Next: 57164