![]() |
Routines |
| Prev: 51801 | Up: Map | Next: 51906 |
|
Used by the routine at FireRevolver.
Makes a shot. It plays PlayRumble. If TownOffset is zero it jumps to MakeFlash. In the town it puts a type 2 bullet in ObjectSlot_02, ObjectSlot_03 or ObjectSlot_04: a free slot, or a slot that is not a bullet, or a bullet that is not drawn. The bullet copies the firer's position and heading, and has speed 12.
|
||||||||||||
|
Play the rumble, or make a flash outside the town.
|
||||||||||||
| MakeShot | 51805 | CALL PlayRumble | Call PlayRumble. | |||||||||
| 51808 | LD A,(41575) | Fetch TownOffset. | ||||||||||
| 51811 | AND A | Jump to MakeFlash if it is zero. | ||||||||||
| 51812 | JR Z,MakeFlash | |||||||||||
|
Look for a free slot among the next three.
|
||||||||||||
| 51814 | LD HL,41613 | Point HL at ObjectSlot_02. | ||||||||||
| 51817 | LD DE,16 | Set the size of a slot to 16. | ||||||||||
| 51820 | LD B,3 | Set a count of 3. | ||||||||||
| 51822 | PUSH BC | Stash the count and the slot on the stack. | ||||||||||
| 51823 | PUSH HL | |||||||||||
|
Use a slot if its type is zero.
|
||||||||||||
| MakeShot_FindFree | 51824 | LD A,(HL) | Jump to MakeShot_UseSlot if the slot is free. | |||||||||
| 51825 | AND A | |||||||||||
| 51826 | JR Z,MakeShot_UseSlot | |||||||||||
| 51828 | ADD HL,DE | Move on to the next slot. | ||||||||||
| 51829 | DJNZ MakeShot_FindFree | Jump to MakeShot_FindFree. | ||||||||||
|
Look for a slot that is not a bullet.
|
||||||||||||
| 51831 | POP HL | Restore the slot and the count from the stack. | ||||||||||
| 51832 | POP BC | |||||||||||
| 51833 | PUSH BC | Stash the count and the slot on the stack. | ||||||||||
| 51834 | PUSH HL | |||||||||||
| MakeShot_FindOther | 51835 | LD A,(HL) | Jump to MakeShot_UseSlot if the type is not 2. | |||||||||
| 51836 | CP 2 | |||||||||||
| 51838 | JR NZ,MakeShot_UseSlot | |||||||||||
| 51840 | ADD HL,DE | Move on to the next slot. | ||||||||||
| 51841 | DJNZ MakeShot_FindOther | Jump to MakeShot_FindOther. | ||||||||||
|
Look for a bullet that is not drawn.
|
||||||||||||
| 51843 | POP IY | Point IY at the first slot. | ||||||||||
| 51845 | POP BC | Restore the count from the stack. | ||||||||||
| MakeShot_FindHidden | 51846 | BIT 1,(IY+7) | Jump to MakeShot_UseHidden if bit 1 of the flags is not set. | |||||||||
| 51850 | JR Z,MakeShot_UseHidden | |||||||||||
| 51852 | ADD IY,DE | Move on to the next slot. | ||||||||||
| 51854 | DJNZ MakeShot_FindHidden | Jump to MakeShot_FindHidden. | ||||||||||
| 51856 | AND A | Clear the carry flag and return. | ||||||||||
| 51857 | RET | |||||||||||
|
Use this slot.
|
||||||||||||
| MakeShot_UseHidden | 51858 | PUSH IY | Copy IY to HL (using the stack). | |||||||||
| 51860 | POP HL | |||||||||||
| 51861 | JR MakeShot_Bullet | Jump to MakeShot_Bullet. | ||||||||||
| MakeShot_UseSlot | 51863 | POP BC | Throw away the count and the slot. | |||||||||
| 51864 | POP BC | |||||||||||
|
Fill the slot as a bullet.
|
||||||||||||
| MakeShot_Bullet | 51865 | LD (HL),2 | Make the type 2. | |||||||||
| 51867 | INC HL | Move on to the position. | ||||||||||
| 51868 | PUSH IX | Copy IX to DE (using the stack). | ||||||||||
| 51870 | POP DE | |||||||||||
| 51871 | INC DE | Move on to the position. | ||||||||||
| 51872 | EX DE,HL | Exchange DE and HL. | ||||||||||
| 51873 | LD BC,4 | Set a count of 4. | ||||||||||
| 51876 | LDIR | Copy the position. | ||||||||||
| 51878 | LD A,12 | Set the speed to 12 and move on past the speed of the firer. | ||||||||||
| 51880 | LD (DE),A | |||||||||||
| 51881 | INC DE | |||||||||||
| 51882 | INC HL | |||||||||||
| 51883 | LD C,2 | Set a count of 2. | ||||||||||
| 51885 | LDIR | Copy the heading and flags. | ||||||||||
| 51887 | LD A,12 | Set the horizontal size to 12. | ||||||||||
| 51889 | LD (DE),A | |||||||||||
| 51890 | INC DE | Move on. | ||||||||||
| 51891 | LD (DE),A | Set the vertical size to 12. | ||||||||||
| 51892 | INC DE | Move on to the sprite list. | ||||||||||
| 51893 | INC DE | |||||||||||
| 51894 | INC DE | |||||||||||
| 51895 | INC DE | |||||||||||
| 51896 | INC DE | |||||||||||
| 51897 | EX DE,HL | Exchange DE and HL. | ||||||||||
| 51898 | LD DE,51906 | Point DE at BulletSpriteList. | ||||||||||
| 51901 | LD (HL),E | Set the sprite list. | ||||||||||
| 51902 | INC HL | |||||||||||
| 51903 | LD (HL),D | |||||||||||
| 51904 | SCF | Set the carry flag and return. | ||||||||||
| 51905 | RET | |||||||||||
| Prev: 51801 | Up: Map | Next: 51906 |