![]() |
Routines |
| Prev: 9F06 | Up: Map | Next: 9F6A |
|
Handles the guardian (sprite IDs 94-95). Nothing happens unless the guardian is in the same room as the player.
Until all four pieces of the amulet have been collected (see 970D) the guardian is animated, and if it touches the player (see TestActorHurtingPlayer_Room) then the player is hit with a hit direction of 80 which makes the player fall straight down.
Once all four pieces have been collected the guardian steps aside to let the player past. It walks to the left if the X position of the player is 80 or more, but it does not move further left than 40. Otherwise it walks to the right, but it does not move further right than BF.
|
||||||||
| HandlerGuardian | 9F16 | LD A,($9703) | Fetch the room of the player from 9703. | |||||
| 9F19 | CP (IX+$01) | Compare with the room of the guardian. | ||||||
| 9F1C | RET NZ | Return if the guardian is in a different room. | ||||||
| 9F1D | CALL StoreEntity | Remember the previous position of the guardian. | ||||||
| 9F20 | LD A,($970D) | Fetch the amulet pieces collected from 970D. | ||||||
| 9F23 | AND %00001111 | Keep only bits 0-3. | ||||||
| 9F25 | CP $0F | Jump to HandlerGuardian_StepAside if all four amulet pieces have been collected. | ||||||
| 9F27 | JR Z,HandlerGuardian_StepAside | |||||||
| 9F29 | CALL AnimateRhino | Animate the guardian. | ||||||
| 9F2C | LD BC,$170F | Set how far above and to the right of the guardian the player can be in BC to 170F. | ||||||
| 9F2F | CALL TestActorHurtingPlayer_Room | Test whether the guardian is touching the player. | ||||||
| 9F32 | JP NC,DisplayActor | Jump to DisplayActor to display the guardian if the player is not touching it. | ||||||
| 9F35 | LD A,$80 | Set the hit direction of the player in 9704 to 80. | ||||||
| 9F37 | LD ($9704),A | |||||||
| 9F3A | CALL PlayWarbleSound | Play the warble sound. | ||||||
| 9F3D | JP DisplayActor | Jump to DisplayActor to display the guardian. | ||||||
|
All four pieces have been collected. Walk to the left if the player is in the right half of the screen.
|
||||||||
| HandlerGuardian_StepAside | 9F40 | LD A,($9705) | Fetch the X position of the player from 9705. | |||||
| 9F43 | BIT 7,A | Jump to HandlerGuardian_Right if the player is in the left half of the screen. | ||||||
| 9F45 | JR Z,HandlerGuardian_Right | |||||||
| 9F47 | LD (IX+$06),$E0 | Set the X velocity of the guardian to E0 (walking to the left). | ||||||
| 9F4B | CALL MoveActor | Work out the new position of the guardian. | ||||||
| 9F4E | LD A,E | Fetch the new X position of the guardian. | ||||||
| 9F4F | CP $40 | Compare with 40. | ||||||
| HandlerGuardian_Limit | 9F51 | JP C,DisplayActor | Jump to DisplayActor to display the guardian if it has reached the limit of its walk. | |||||
| 9F54 | LD (IX+$03),E | Set the new X position of the guardian. | ||||||
| 9F57 | CALL AnimateRhino | Animate the guardian. | ||||||
| 9F5A | JP DisplayActor | Jump to DisplayActor to display the guardian. | ||||||
|
Walk to the right.
|
||||||||
| HandlerGuardian_Right | 9F5D | LD (IX+$06),$20 | Set the X velocity of the guardian to 20 (walking to the right). | |||||
| 9F61 | CALL MoveActor | Work out the new position of the guardian. | ||||||
| 9F64 | LD A,E | Fetch the new X position of the guardian. | ||||||
| 9F65 | CP $C0 | Compare with C0. | ||||||
| 9F67 | CCF | Invert the carry flag. | ||||||
| 9F68 | JR HandlerGuardian_Limit | Jump to HandlerGuardian_Limit. | ||||||
| Prev: 9F06 | Up: Map | Next: 9F6A |