![]() |
Routines |
| Prev: 40548 | Up: Map | Next: 40627 |
|
Handles a hippo (sprite IDs 160-163) or a warthog (sprite IDs 168-171) which is awake. The animal walks along (see MoveActor), animating as it goes, and stays in the same direction until it is blocked by something in the room, at which point it falls asleep (bit 2 of the sprite ID is set, see HandlerSleepingHippoWarthog). If the animal has bumped into the player then it stands still for a short while (the counter in *IX+2 is counted down) and, if the player is hurt, the player is hit.
|
||||||||
| HandlerHippoWarthog | 40562 | CALL StoreEntity | Remember the previous position of the animal. | |||||
| 40565 | CALL AnimateRhino | Animate the animal. | ||||||
| 40568 | LD A,32 | Write 32 to Actor_Width (the width of the animal). | ||||||
| 40570 | LD (38573),A | |||||||
|
Stand still while the pause counter is running.
|
||||||||
| 40573 | LD A,(IX+2) | Fetch the pause counter of the animal. | ||||||
| 40576 | AND A | Jump to HandlerHippoWarthog_Pause if the animal is still paused. | ||||||
| 40577 | JR NZ,HandlerHippoWarthog_Pause | |||||||
|
Work out the new position of the animal and stop it walking through objects in the room.
|
||||||||
| 40579 | CALL MoveActor | Move the animal. | ||||||
| 40582 | LD BC,5919 | Set the height of the animal in B to 23 and the width in C to 31. | ||||||
| 40585 | CALL SlideActorPastObjects | Stop the animal passing through objects in the room. | ||||||
|
Carry on if the animal moved. If it is stuck then put it to sleep.
|
||||||||
| 40588 | CALL TestPositionUnchanged | Test whether the animal has stayed where it was. | ||||||
| 40591 | JP NZ,HandlerRhino_Position | Jump to HandlerRhino_Position if the animal has moved. | ||||||
| 40594 | SET 2,(IX+0) | Set bit 2 of the sprite ID to put the animal to sleep. | ||||||
| 40598 | JP UpdateActor | Jump to UpdateActor to update the animal. | ||||||
|
Count down the pause and test whether the animal has hit the player.
|
||||||||
| HandlerHippoWarthog_Pause | 40601 | DEC A | Decrease the pause counter by one. | |||||
| 40602 | LD (IX+2),A | Store the pause counter. | ||||||
| 40605 | LD E,(IX+3) | Fetch the X position of the animal into E. | ||||||
| 40608 | LD D,(IX+4) | Fetch the Y position of the animal into D. | ||||||
| 40611 | LD A,(IX+0) | Fetch the sprite ID of the animal. | ||||||
| 40614 | RRCA | Rotate the direction bit (bit 1) into bit 0. | ||||||
| 40615 | AND %00000001 | Keep only bit 0. | ||||||
| 40617 | LD D,A | Set the direction the animal is facing in D. | ||||||
| 40618 | LD BC,3868 | Set how far above and to the right of the animal the player can be in BC to 3868. | ||||||
| 40621 | CALL TestActorHurtingPlayer | Test whether the animal has hurt the player. | ||||||
| 40624 | JP UpdateActor | Jump to UpdateActor to update the animal. | ||||||
| Prev: 40548 | Up: Map | Next: 40627 |