![]() |
Routines |
| Prev: CA59 | Up: Map | Next: CAC2 |
|
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 02 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 0C.
|
||||||||||||
|
Play the rumble, or make a flash outside the town.
|
||||||||||||
| MakeShot | CA5D | CALL PlayRumble | Call PlayRumble. | |||||||||
| CA60 | LD A,($A267) | Fetch TownOffset. | ||||||||||
| CA63 | AND A | Jump to MakeFlash if it is zero. | ||||||||||
| CA64 | JR Z,MakeFlash | |||||||||||
|
Look for a free slot among the next three.
|
||||||||||||
| CA66 | LD HL,$A28D | Point HL at ObjectSlot_02. | ||||||||||
| CA69 | LD DE,$0010 | Set the size of a slot to 10. | ||||||||||
| CA6C | LD B,$03 | Set a count of 03. | ||||||||||
| CA6E | PUSH BC | Stash the count and the slot on the stack. | ||||||||||
| CA6F | PUSH HL | |||||||||||
|
Use a slot if its type is zero.
|
||||||||||||
| MakeShot_FindFree | CA70 | LD A,(HL) | Jump to MakeShot_UseSlot if the slot is free. | |||||||||
| CA71 | AND A | |||||||||||
| CA72 | JR Z,MakeShot_UseSlot | |||||||||||
| CA74 | ADD HL,DE | Move on to the next slot. | ||||||||||
| CA75 | DJNZ MakeShot_FindFree | Jump to MakeShot_FindFree. | ||||||||||
|
Look for a slot that is not a bullet.
|
||||||||||||
| CA77 | POP HL | Restore the slot and the count from the stack. | ||||||||||
| CA78 | POP BC | |||||||||||
| CA79 | PUSH BC | Stash the count and the slot on the stack. | ||||||||||
| CA7A | PUSH HL | |||||||||||
| MakeShot_FindOther | CA7B | LD A,(HL) | Jump to MakeShot_UseSlot if the type is not 02. | |||||||||
| CA7C | CP $02 | |||||||||||
| CA7E | JR NZ,MakeShot_UseSlot | |||||||||||
| CA80 | ADD HL,DE | Move on to the next slot. | ||||||||||
| CA81 | DJNZ MakeShot_FindOther | Jump to MakeShot_FindOther. | ||||||||||
|
Look for a bullet that is not drawn.
|
||||||||||||
| CA83 | POP IY | Point IY at the first slot. | ||||||||||
| CA85 | POP BC | Restore the count from the stack. | ||||||||||
| MakeShot_FindHidden | CA86 | BIT 1,(IY+$07) | Jump to MakeShot_UseHidden if bit 1 of the flags is not set. | |||||||||
| CA8A | JR Z,MakeShot_UseHidden | |||||||||||
| CA8C | ADD IY,DE | Move on to the next slot. | ||||||||||
| CA8E | DJNZ MakeShot_FindHidden | Jump to MakeShot_FindHidden. | ||||||||||
| CA90 | AND A | Clear the carry flag and return. | ||||||||||
| CA91 | RET | |||||||||||
|
Use this slot.
|
||||||||||||
| MakeShot_UseHidden | CA92 | PUSH IY | Copy IY to HL (using the stack). | |||||||||
| CA94 | POP HL | |||||||||||
| CA95 | JR MakeShot_Bullet | Jump to MakeShot_Bullet. | ||||||||||
| MakeShot_UseSlot | CA97 | POP BC | Throw away the count and the slot. | |||||||||
| CA98 | POP BC | |||||||||||
|
Fill the slot as a bullet.
|
||||||||||||
| MakeShot_Bullet | CA99 | LD (HL),$02 | Make the type 02. | |||||||||
| CA9B | INC HL | Move on to the position. | ||||||||||
| CA9C | PUSH IX | Copy IX to DE (using the stack). | ||||||||||
| CA9E | POP DE | |||||||||||
| CA9F | INC DE | Move on to the position. | ||||||||||
| CAA0 | EX DE,HL | Exchange DE and HL. | ||||||||||
| CAA1 | LD BC,$0004 | Set a count of 04. | ||||||||||
| CAA4 | LDIR | Copy the position. | ||||||||||
| CAA6 | LD A,$0C | Set the speed to 0C and move on past the speed of the firer. | ||||||||||
| CAA8 | LD (DE),A | |||||||||||
| CAA9 | INC DE | |||||||||||
| CAAA | INC HL | |||||||||||
| CAAB | LD C,$02 | Set a count of 02. | ||||||||||
| CAAD | LDIR | Copy the heading and flags. | ||||||||||
| CAAF | LD A,$0C | Set the horizontal size to 0C. | ||||||||||
| CAB1 | LD (DE),A | |||||||||||
| CAB2 | INC DE | Move on. | ||||||||||
| CAB3 | LD (DE),A | Set the vertical size to 0C. | ||||||||||
| CAB4 | INC DE | Move on to the sprite list. | ||||||||||
| CAB5 | INC DE | |||||||||||
| CAB6 | INC DE | |||||||||||
| CAB7 | INC DE | |||||||||||
| CAB8 | INC DE | |||||||||||
| CAB9 | EX DE,HL | Exchange DE and HL. | ||||||||||
| CABA | LD DE,$CAC2 | Point DE at BulletSpriteList. | ||||||||||
| CABD | LD (HL),E | Set the sprite list. | ||||||||||
| CABE | INC HL | |||||||||||
| CABF | LD (HL),D | |||||||||||
| CAC0 | SCF | Set the carry flag and return. | ||||||||||
| CAC1 | RET | |||||||||||
| Prev: CA59 | Up: Map | Next: CAC2 |