Prev: 54472 Up: Map Next: 54608
54476: Goldfish Game: Update Player
Used by the routine at GoldfishGame.
Applies movement, animates and reprints the goldfish player at GoldfishGame_PlayerAttributes.
GoldfishGame_UpdatePlayer 54476 LD IX,56334 Point IX at GoldfishGame_PlayerAttributes.
54480 LD A,17 Set PAPER: BLUE (1).
54482 RST 16
54483 LD A,1
54485 RST 16
54486 LD A,(IX+5) Jump to GoldfishGame_UpdatePlayer_ApplyDeltas if there is no vertical movement.
54489 CP 0
54491 JR Z,GoldfishGame_UpdatePlayer_ApplyDeltas
54493 LD (IX+4),0 Cancel horizontal movement while moving vertically.
GoldfishGame_UpdatePlayer_ApplyDeltas 54497 CALL Handler_SeaCreatureMovement Apply the player's movement deltas.
54500 LD A,C Jump to GoldfishGame_UpdatePlayer_HitEdge if the player hit the right edge.
54501 CP 25
54503 JP Z,GoldfishGame_UpdatePlayer_HitEdge
54506 CP 13 Jump to GoldfishGame_UpdatePlayer_HitEdge if the player hit the left edge.
54508 JP Z,GoldfishGame_UpdatePlayer_HitEdge
54511 LD A,B Jump to GoldfishGame_UpdatePlayer_HitEdge if the player hit the bottom.
54512 CP 17
54514 JP Z,GoldfishGame_UpdatePlayer_HitEdge
54517 CP 5 Jump to GoldfishGame_UpdatePlayer_HitEdge if the player hit the top.
54519 JP Z,GoldfishGame_UpdatePlayer_HitEdge
54522 LD A,C Jump to GoldfishGame_UpdatePlayer_StorePosition if the column changed.
54523 CP (IX+0)
54526 JR NZ,GoldfishGame_UpdatePlayer_StorePosition
54528 LD A,B Jump to GoldfishGame_UpdatePlayer_StorePosition if the row changed.
54529 CP (IX+1)
54532 JR NZ,GoldfishGame_UpdatePlayer_StorePosition
54534 LD A,(IX+3) Jump to GoldfishGame_UpdatePlayer_StorePosition if the vertical offset did not change.
54537 CP D
54538 JR Z,GoldfishGame_UpdatePlayer_StorePosition
GoldfishGame_UpdatePlayer_StorePosition 54540 LD (IX+0),C Write the new horizontal co-ordinate back to the player.
54543 LD (IX+1),B Write the new vertical co-ordinate back to the player.
54546 LD (IX+2),E Write the new horizontal offset back to the player.
54549 LD (IX+3),D Write the new vertical offset back to the player.
54552 PUSH DE Stash the offsets on the stack.
54553 CALL Handler_SeaCreatureAnimation Animate the player frames.
54556 POP DE Restore the offsets from the stack.
54557 LD (IX+2),E Write the horizontal offset back after animation.
54560 LD (IX+3),D Write the vertical offset back after animation.
54563 LD HL,37708 Does nothing; this is overwritten on the next line.
54566 LD HL,40684 Write 40684 to *CHARS.
54569 LD (23606),HL
54572 CALL GoldfishGame_PrintShiftedSprite Print the shifted player sprite.
54575 LD A,(IX+0) Copy the horizontal co-ordinate to the previous-horizontal slot.
54578 LD (IX+13),A
54581 LD A,(IX+1) Copy the vertical co-ordinate to the previous-vertical slot.
54584 LD (IX+14),A
54587 LD A,(IX+3) Copy the vertical offset to the previous-vertical-offset slot.
54590 LD (IX+15),A
54593 LD A,(IX+2) Copy the horizontal offset to the previous-offset slot.
54596 LD (IX+11),A
GoldfishGame_UpdatePlayer_HitEdge 54599 LD (IX+4),0 Clear horizontal movement.
54603 LD (IX+5),0 Clear vertical movement.
54607 RET Return.
Prev: 54472 Up: Map Next: 54608