![]() |
Routines |
| Prev: 34914 | Up: Map | Next: 35197 |
|
The handler for Dracula (sprite IDs 124 to 127). If Dracula touches the player then TakeEnergyFromPlayer_Small takes some energy. When the player is holding the crucifix (sprite ID 138 with attribute 70) Dracula heads away from the player, otherwise he heads towards the player when they are in the same room. If they are not, then about once every 256 frames he goes to a random room, if the shape of that room (see GetRoomValue) is less than 3.
|
||||||||
| HandlerDracula | 35078 | CALL StoreEntity | Call StoreEntity to save the position of Dracula. | |||||
| 35081 | CALL CheckPlayerTouch | Call CheckPlayerTouch to check whether the entity is touching the player. | ||||||
| 35084 | DEC E | Call TakeEnergyFromPlayer_Small if Dracula touched the player. | ||||||
| 35085 | CALL Z,TakeEnergyFromPlayer_Small | |||||||
|
See if the player is holding the crucifix.
|
||||||||
| 35088 | LD DE,18058 | DE=18058 (the attribute and the sprite ID of the crucifix). | ||||||
| 35091 | CALL FindInventoryItem | Call FindInventoryItem to look for the crucifix in the inventory. | ||||||
| 35094 | JR NZ,HandlerDracula_CheckRoom | Jump to HandlerDracula_CheckRoom if the player is not holding it. | ||||||
|
The player has the crucifix, so steer towards the player and then reverse the velocities to run away.
|
||||||||
| 35096 | LD DE,(60051) | Fetch the position of the player from 60051. | ||||||
| 35100 | CALL SteerCreature | Call SteerCreature to steer the creature towards its target. | ||||||
| 35103 | LD A,(IX+8) | Fetch the X velocity. | ||||||
| 35106 | NEG | Reverse the direction of the X velocity. | ||||||
| 35108 | LD (IX+8),A | Update the X velocity. | ||||||
| 35111 | LD A,(IX+9) | Fetch the Y velocity. | ||||||
| 35114 | NEG | Reverse the direction of the Y velocity. | ||||||
| 35116 | LD (IX+9),A | Update the Y velocity. | ||||||
| 35119 | JR HandlerDracula_SetSprite | Jump to HandlerDracula_SetSprite to choose the sprite of Dracula. | ||||||
|
Check whether Dracula is in the same room as the player.
|
||||||||
| HandlerDracula_CheckRoom | 35121 | LD A,(60049) | Fetch the room of the player from PlayerRoom. | |||||
| 35124 | CP (IX+1) | Jump to HandlerDracula_OtherRoom if Dracula is in a different room. | ||||||
| 35127 | JR NZ,HandlerDracula_OtherRoom | |||||||
| 35129 | LD DE,(60051) | Fetch the position of the player from 60051. | ||||||
| 35133 | CALL SteerCreature | Call SteerCreature to steer the creature towards its target. | ||||||
|
Choose the sprite and the area that Dracula can move in.
|
||||||||
| HandlerDracula_SetSprite | 35136 | LD A,(24082) | Fetch the counter from CounterLow. | |||||
| 35139 | RRA | Divide the counter by four. | ||||||
| 35140 | RRA | |||||||
| 35141 | AND %00000011 | Keep only bits 0-1. | ||||||
| 35143 | ADD A,124 | Add 124 to get the sprite ID of Dracula. | ||||||
| 35145 | LD (IX+0),A | Update the sprite ID of Dracula. | ||||||
| 35148 | LD DE,13364 | DE=13364 (the area). | ||||||
| 35151 | JP HandlerBoss_Move | Jump to HandlerBoss_Move to move the boss. | ||||||
|
Dracula is in a different room, so every so often send him to a random one.
|
||||||||
| HandlerDracula_OtherRoom | 35154 | LD (IX+11),104 | Set the X position of the waypoint to 104. | |||||
| 35158 | LD (IX+12),104 | Set the Y position of the waypoint to 104. | ||||||
| 35162 | CALL SteerCreature | Call SteerCreature to steer the creature towards its target. | ||||||
| 35165 | LD A,(23672) | Fetch the low byte of FRAMES. | ||||||
| 35168 | AND A | Jump to HandlerDracula_SetSprite unless the low byte of FRAMES is zero, which happens once in every 256 frames. | ||||||
| 35169 | JP NZ,HandlerDracula_SetSprite | |||||||
| 35172 | LD A,R | Fetch a random number (from the refresh register). | ||||||
| 35174 | AND %01111111 | Keep only bits 0-6. | ||||||
| 35176 | LD C,A | Keep the random room in C. | ||||||
| 35177 | CALL GetRoomValue | Call GetRoomValue to look up the value for the room. | ||||||
| 35180 | CP 3 | Jump to HandlerDracula_SetSprite if the value for the room is 3 or more. | ||||||
| 35182 | JP NC,HandlerDracula_SetSprite | |||||||
| 35185 | LD A,(60049) | Fetch the room of the player from PlayerRoom. | ||||||
| 35188 | CP C | Jump to HandlerDracula_SetSprite if the random room is the room of the player. | ||||||
| 35189 | JP Z,HandlerDracula_SetSprite | |||||||
| 35192 | LD (IX+1),C | Update the room of Dracula. | ||||||
| 35195 | JR HandlerDracula_SetSprite | Jump to HandlerDracula_SetSprite to choose the sprite of Dracula. | ||||||
| Prev: 34914 | Up: Map | Next: 35197 |