Routines |
Prev: 57139 | Up: Map | Next: 57293 |
|
||||||||||
Identifies if the servant/cursor is moving, in which direction, and adds/subtracts movement speed accordingly. Deals with both vertical and horizontal movement.
Returns the calculated value (either zero for no movement, or a positive/negative value) in the H register. This is later used to calculate the sprite's new vertical/horizontal position.
Called from 59743 (horizontal movement) and 59790 (vertical movement).
|
||||||||||
57276 | CP 0 | Is there any movement in the direction being checked (horizontal/vertical)? | ||||||||
57278 | JR Z,57290 | If there isn't, set movement offset to 0 and RET | ||||||||
57280 | NEG | Positive/negative values stored are the opposite of Maroc's movement, so make negative (otherwise player controls will appear reversed) | ||||||||
57282 | LD B,A | Temp store in B register | ||||||||
57283 | ADD A,C | Add the speed to the direction | ||||||||
57284 | LD H,A | ...and store in H | ||||||||
The next 3 instructions set a 'terminal velocity' speed. It ensures speed is reset to 0 when a certain speed (128) is reached:
|
||||||||||
57285 | XOR B | Compare with adjusted speed (retain where bits are different) | ||||||||
57286 | AND 128 | Check bit 7 - if this bit is set, the servant has reached terminal speed (in either direction) | ||||||||
57288 | JR Z,57292 | However, the screen size means this speed can't be reached, so a NZ (non-zero) result shouldn't normally happen | ||||||||
57290 | LD H,0 | If terminal velocity has been reached, set movement/speed back to zero | ||||||||
57292 | RET |
Prev: 57139 | Up: Map | Next: 57293 |