![]() |
Routines |
| Prev: 46663 | Up: Map | Next: 46797 |
|
Used by the routine at CreateTownObjects.
Called every frame in the town. Looks for a free slot among the tenth to thirteenth object slots, and if there is one puts a bystander (an object of type 6) in it, one cell away from the sheriff.
|
||||
| CreateBystander | 46737 | LD IY,41741 | Point IY at the tenth object slot. | |
| 46741 | LD DE,16 | Set the size of an object slot. | ||
| 46744 | LD B,4 | Set the number of slots to four. | ||
| CreateBystander_Loop | 46746 | LD A,(IY+0) | Fetch the type of the object in the slot. | |
| 46749 | AND A | Jump to CreateBystander_Found if the slot is free. | ||
| 46750 | JR Z,CreateBystander_Found | |||
| 46752 | ADD IY,DE | Move on to the next slot. | ||
| 46754 | DJNZ CreateBystander_Loop | Loop back until all four slots have been checked. | ||
| 46756 | RET | Return. | ||
|
Place a bystander in the free slot.
|
||||
| CreateBystander_Found | 46757 | LD B,1 | Set the distance from the sheriff to one cell. | |
| 46759 | CALL PlaceNearSheriff | Place the bystander one cell away from the sheriff. | ||
| 46762 | RET NZ | Return if that cell is blocked. | ||
| 46763 | CALL SetPositionInCell | Set the position of the bystander within its cell. | ||
| 46766 | LD A,(41498) | Fetch a random number. | ||
| 46769 | AND %00000110 | Keep bits 1 and 2. | ||
| 46771 | ADD A,4 | Add four to give a speed of four, six, eight or ten. | ||
| 46773 | LD (IY+5),A | Set the speed of the bystander. | ||
| 46776 | LD (IY+0),6 | Turn the slot into a bystander. | ||
| 46780 | LD (IY+6),1 | Set the direction of the bystander. | ||
| 46784 | LD (IY+8),16 | Set the horizontal size of the bystander. | ||
| 46788 | LD (IY+9),16 | Set the vertical size of the bystander. | ||
| 46792 | LD (IY+13),0 | Clear the counter used for slowing down changes of sprite. | ||
| 46796 | RET | Return. | ||
| Prev: 46663 | Up: Map | Next: 46797 |