Prev: D4C8 Up: Map Next: D550
D4CC: Goldfish Game: Update Player
Used by the routine at GoldfishGame.
Applies movement, animates and reprints the goldfish player at GoldfishGame_PlayerAttributes.
GoldfishGame_UpdatePlayer D4CC LD IX,$DC0E Point IX at GoldfishGame_PlayerAttributes.
D4D0 LD A,$11 Set PAPER: BLUE (01).
D4D2 RST $10
D4D3 LD A,$01
D4D5 RST $10
D4D6 LD A,(IX+$05) Jump to GoldfishGame_UpdatePlayer_ApplyDeltas if there is no vertical movement.
D4D9 CP $00
D4DB JR Z,GoldfishGame_UpdatePlayer_ApplyDeltas
D4DD LD (IX+$04),$00 Cancel horizontal movement while moving vertically.
GoldfishGame_UpdatePlayer_ApplyDeltas D4E1 CALL Handler_SeaCreatureMovement Apply the player's movement deltas.
D4E4 LD A,C Jump to GoldfishGame_UpdatePlayer_HitEdge if the player hit the right edge.
D4E5 CP $19
D4E7 JP Z,GoldfishGame_UpdatePlayer_HitEdge
D4EA CP $0D Jump to GoldfishGame_UpdatePlayer_HitEdge if the player hit the left edge.
D4EC JP Z,GoldfishGame_UpdatePlayer_HitEdge
D4EF LD A,B Jump to GoldfishGame_UpdatePlayer_HitEdge if the player hit the bottom.
D4F0 CP $11
D4F2 JP Z,GoldfishGame_UpdatePlayer_HitEdge
D4F5 CP $05 Jump to GoldfishGame_UpdatePlayer_HitEdge if the player hit the top.
D4F7 JP Z,GoldfishGame_UpdatePlayer_HitEdge
D4FA LD A,C Jump to GoldfishGame_UpdatePlayer_StorePosition if the column changed.
D4FB CP (IX+$00)
D4FE JR NZ,GoldfishGame_UpdatePlayer_StorePosition
D500 LD A,B Jump to GoldfishGame_UpdatePlayer_StorePosition if the row changed.
D501 CP (IX+$01)
D504 JR NZ,GoldfishGame_UpdatePlayer_StorePosition
D506 LD A,(IX+$03) Jump to GoldfishGame_UpdatePlayer_StorePosition if the vertical offset did not change.
D509 CP D
D50A JR Z,GoldfishGame_UpdatePlayer_StorePosition
GoldfishGame_UpdatePlayer_StorePosition D50C LD (IX+$00),C Write the new horizontal co-ordinate back to the player.
D50F LD (IX+$01),B Write the new vertical co-ordinate back to the player.
D512 LD (IX+$02),E Write the new horizontal offset back to the player.
D515 LD (IX+$03),D Write the new vertical offset back to the player.
D518 PUSH DE Stash the offsets on the stack.
D519 CALL Handler_SeaCreatureAnimation Animate the player frames.
D51C POP DE Restore the offsets from the stack.
D51D LD (IX+$02),E Write the horizontal offset back after animation.
D520 LD (IX+$03),D Write the vertical offset back after animation.
D523 LD HL,$934C Does nothing; this is overwritten on the next line.
D526 LD HL,$9EEC Write 9EEC to *CHARS.
D529 LD ($5C36),HL
D52C CALL GoldfishGame_PrintShiftedSprite Print the shifted player sprite.
D52F LD A,(IX+$00) Copy the horizontal co-ordinate to the previous-horizontal slot.
D532 LD (IX+$0D),A
D535 LD A,(IX+$01) Copy the vertical co-ordinate to the previous-vertical slot.
D538 LD (IX+$0E),A
D53B LD A,(IX+$03) Copy the vertical offset to the previous-vertical-offset slot.
D53E LD (IX+$0F),A
D541 LD A,(IX+$02) Copy the horizontal offset to the previous-offset slot.
D544 LD (IX+$0B),A
GoldfishGame_UpdatePlayer_HitEdge D547 LD (IX+$04),$00 Clear horizontal movement.
D54B LD (IX+$05),$00 Clear vertical movement.
D54F RET Return.
Prev: D4C8 Up: Map Next: D550