![]() |
Routines |
| Prev: 39484 | Up: Map | Next: 39608 |
|
Used by the routine at SpawnNastie.
Turns an empty nastie record into a nastie which is just appearing, unless the player's room already holds the maximum number of nasties (ActivePlayer_NastieLimit) or the position chosen by ChoosePosition is unsuitable. The nastie starts as the first of the five "appearing" sprites (sprite ID 1), in one of four colours chosen from the table at NastieColours using the low bits of the counter at GameTimer.
|
||||||||
|
Count the nasties which are already in the player's room.
|
||||||||
| StartNastie | 39528 | LD HL,38802 | Point HL at the first nastie record at NastieData. | |||||
| 39531 | LD B,6 | Set the nastie record counter in B to 6. | ||||||
| 39533 | LD D,0 | Set the number of nasties in the player's room in D to 0. | ||||||
| 39535 | LD A,(38659) | Fetch the player's room from 38659 into E. | ||||||
| 39538 | LD E,A | |||||||
| StartNastie_CountLoop | 39539 | LD A,(HL) | Fetch the sprite ID of the nastie. | |||||
| 39540 | AND A | Jump to StartNastie_NextRecord if the record is empty. | ||||||
| 39541 | JR Z,StartNastie_NextRecord | |||||||
| 39543 | INC HL | Move onto the room of the nastie. | ||||||
| 39544 | LD A,E | Compare the room of the nastie with the player's room. | ||||||
| 39545 | CP (HL) | |||||||
| 39546 | DEC HL | Move back to the sprite ID. | ||||||
| 39547 | JR NZ,StartNastie_NextRecord | Jump to StartNastie_NextRecord if the nastie is in a different room. | ||||||
| 39549 | INC D | Count the nastie. | ||||||
| StartNastie_NextRecord | 39550 | LD A,12 | Set the size of an actor record in A to 12. | |||||
| 39552 | CALL AddAToHL | Move HL onto the next nastie record. | ||||||
| 39555 | DJNZ StartNastie_CountLoop | Decrease the nastie record counter by one and loop back to StartNastie_CountLoop until all six records have been checked. | ||||||
|
Return if the room already holds the maximum number of nasties.
|
||||||||
| 39557 | LD A,(38590) | Fetch the maximum number of nasties allowed in a room from ActivePlayer_NastieLimit. | ||||||
| 39560 | CP D | Return if the room already holds the maximum number of nasties. | ||||||
| 39561 | RET Z | |||||||
|
Choose where the nastie will appear and return if the position is not suitable (the carry flag is set).
|
||||||||
| 39562 | CALL ChoosePosition | Choose a position for the nastie. | ||||||
| 39565 | RET C | Return if the position is unsuitable. | ||||||
|
Choose a colour for the nastie from the four in the table.
|
||||||||
| 39566 | LD A,(38547) | Fetch the low byte of the game timer from GameTimer. | ||||||
| 39569 | AND %00000011 | Keep only bits 0-1. | ||||||
| 39571 | LD L,A | Use it as the offset into the colour table. | ||||||
| 39572 | LD H,0 | |||||||
| 39574 | LD BC,39608 | Add the address of the colour table to get the address of the colour. | ||||||
| 39577 | ADD HL,BC | |||||||
| 39578 | LD A,(HL) | Fetch the colour of the nastie from the table. | ||||||
| 39579 | LD (IX+5),A | Set the colour of the nastie. | ||||||
|
Start the nastie as the first "appearing" sprite.
|
||||||||
| 39582 | LD (IX+0),1 | Set the sprite ID of the nastie to 1 (appearing). | ||||||
|
This entry point is used by the routine at SpawnFlame.
Clear the movement and state bytes of the new actor and draw it.
|
||||||||
| StartActor_Reset | 39586 | XOR A | Clear the velocities and counters of the actor. | |||||
| 39587 | LD (IX+6),A | |||||||
| 39590 | LD (IX+7),A | |||||||
| 39593 | LD (IX+8),A | |||||||
| 39596 | LD (IX+9),A | |||||||
| 39599 | LD (IX+10),A | |||||||
| 39602 | LD (IX+11),A | |||||||
| 39605 | JP DrawEntity | Draw the actor. | ||||||
| Prev: 39484 | Up: Map | Next: 39608 |