Prev: 44151 Up: Map Next: 44358
44295: Handler: Rhino
Handles a rhino (sprite IDs 48 to 51). Bit 1 of the sprite ID is set when the rhino is facing right.
The rhino moves with its X velocity (see MoveActor) and stops and turns around if it is blocked, when its speed is also reset. If it touches the player then the player is hurt and the rhino turns around, unless the player is attacking, in which case the rhino is knocked back instead (see KnockBackRhino).
Input
IX Actor record of the rhino
HandlerRhino 44295 CALL StoreEntity Remember the previous position of the rhino.
44298 CALL AnimateRhino Animate the rhino.
44301 LD A,32 Set the width of the rhino in Actor_Width to 32.
44303 LD (38573),A
44306 CALL MoveActor Work out the new position of the rhino.
Stop the rhino moving through objects in the room. If it did not manage to move then turn it around.
44309 LD BC,5919 Set the height of the rhino in B to 23 and the width in C to 31.
44312 CALL SlideActorPastObjects Stop the rhino passing through objects in the room.
44315 CALL TestPositionUnchanged Test whether the rhino has stayed where it was.
44318 JR NZ,HandlerRhino_Position Jump to HandlerRhino_Position if the rhino has moved.
44320 LD A,48 Set the speed of the rhino in A to 48.
44322 CALL SetVelocityMagnitude Set the speed of the rhino, keeping its direction.
44325 CALL TurnRhinoAround Turn the rhino around.
This entry point is used by the routine at HandlerHippoWarthog.
HandlerRhino_Position 44328 LD (IX+3),E Set the X position of the rhino.
44331 LD (IX+4),D Set the Y position of the rhino.
Test whether the rhino has touched the player.
44334 LD A,(IX+0) Fetch the sprite ID of the rhino.
44337 RRCA Rotate right, so bit 1 is now in bit 0.
44338 AND %00000001 Keep only bit 0.
44340 LD D,A Store the result in D (the hit direction for TestActorHurtingPlayer).
44341 LD BC,3868 Set the reach used to test whether the rhino is touching the player in BC to 3868.
44344 CALL TestActorHurtingPlayer Test whether the rhino is hurting the player.
44347 JR NC,UpdateActor Jump to UpdateActor if the rhino is not touching the player.
44349 LD A,(38660) Fetch the hit direction of the player from 38660.
44352 AND A Jump to KnockBackRhino if the player was not hit, which means the rhino was hit by the sword.
44353 JR Z,KnockBackRhino
44355 CALL TurnRhinoAround Turn the rhino around.
Prev: 44151 Up: Map Next: 44358