![]() |
Routines |
| Prev: 47299 | Up: Map | Next: 47454 |
|
Type 14: the gun of the outlaw in the duel, which is in the slot after the outlaw. It stays with the outlaw. When the outlaw is waiting it is not drawn, and when he has drawn it goes through its six frames, which raise the gun, and then it fires: it makes a muzzle flash (type 15) in the next slot, and counts the shot in ShotsFiredCount. The duel ends when the outlaw has fired six shots. The gun is removed when the outlaw is dying.
|
||||
| HandleOutlawGun | 47335 | LD A,(IX-16) | Fetch the type of the outlaw. | |
| 47338 | CP 18 | Jump to HandleBody_Remove to remove the gun if the outlaw is dying. | ||
| 47340 | JP Z,HandleBody_Remove | |||
| 47343 | CP 17 | Jump to HandleOutlawGun_Place if the outlaw has been shot. | ||
| 47345 | JR Z,HandleOutlawGun_Place | |||
| 47347 | CP 12 | Jump to HandleOutlawGun_Place if the outlaw is waiting. | ||
| 47349 | JR Z,HandleOutlawGun_Place | |||
| 47351 | LD A,(IX+12) | Fetch the frame of the gun. | ||
| 47354 | CP 5 | Jump to HandleOutlawGun_Fire if the gun is fully raised. | ||
| 47356 | JR Z,HandleOutlawGun_Fire | |||
| 47358 | CALL AdvanceGunFrame | Advance the frame when it is time. | ||
| 47361 | LD A,(IX+12) | Fetch the frame of the gun. | ||
| 47364 | LD BC,47299 | Point BC at GunSpriteLists. | ||
| 47367 | CALL GetTableEntry | Point HL at the sprite list for the frame. | ||
| 47370 | LD (IX+14),L | Store the low byte of the address. | ||
| 47373 | LD (IX+15),H | Store the high byte of the address. | ||
|
Put the gun next to the outlaw and draw it.
|
||||
| HandleOutlawGun_Place | 47376 | LD A,(IX-14) | Fetch the horizontal position of the outlaw. | |
| 47379 | SUB 8 | Move eight pixels to the left. | ||
| 47381 | LD (IX+2),A | Set the horizontal position of the gun. | ||
| 47384 | LD A,(IX-16) | Fetch the type of the outlaw. | ||
| 47387 | CP 17 | Compare it with the type of a shot outlaw. | ||
| 47389 | LD A,(IX-12) | Fetch the vertical position of the outlaw. | ||
| 47392 | JR Z,HandleOutlawGun_SetPosition | Jump to HandleOutlawGun_SetPosition if he has been shot. | ||
| 47394 | ADD A,12 | Move the gun down twelve pixels. | ||
| HandleOutlawGun_SetPosition | 47396 | LD (IX+4),A | Set the vertical position of the gun. | |
| 47399 | JP DrawObject | Jump to DrawObject. | ||
|
The gun is fully raised, so fire it unless it has already fired.
|
||||
| HandleOutlawGun_Fire | 47402 | LD A,(IX+16) | Fetch the type of the object in the next slot. | |
| 47405 | AND A | Test whether the slot is in use. | ||
| 47406 | JR NZ,HandleOutlawGun_Place | Jump to HandleOutlawGun_Place if it is. | ||
| 47408 | LD HL,41490 | Point HL at ShotsFiredCount. | ||
| 47411 | LD A,(HL) | Fetch the count. | ||
| 47412 | AND A | Return if the outlaw has been hit. | ||
| 47413 | RET M | |||
| 47414 | INC A | Add one to the count. | ||
| 47415 | CP 7 | Jump to EndDuel to end the duel if the outlaw has fired six shots. | ||
| 47417 | JR Z,EndDuel | |||
| 47419 | LD (HL),A | Store the count. | ||
| 47420 | PUSH IX | Copy IX to HL (using the stack). | ||
| 47422 | POP HL | |||
| 47423 | LD BC,16 | Set the size of an object slot. | ||
| 47426 | ADD HL,BC | Point HL at the next slot. | ||
| 47427 | PUSH HL | Copy HL to IY (using the stack). | ||
| 47428 | POP IY | |||
| 47430 | EX DE,HL | Swap the address of the slot into DE. | ||
| 47431 | LD HL,47454 | Point HL at MuzzleFlashTemplate. | ||
| 47434 | LDIR | Copy the template into the slot. | ||
| 47436 | LD A,(IX+2) | Fetch the horizontal position of the gun. | ||
| 47439 | ADD A,8 | Move eight pixels to the right. | ||
| 47441 | LD (IY+2),A | Set the horizontal position of the flash. | ||
| 47444 | LD A,(IX+4) | Fetch the vertical position of the gun. | ||
| 47447 | ADD A,6 | Move six pixels down. | ||
| 47449 | LD (IY+4),A | Set the vertical position of the flash. | ||
|
Place and draw the gun.
|
||||
| 47452 | JR HandleOutlawGun_Place | Jump to HandleOutlawGun_Place. | ||
| Prev: 47299 | Up: Map | Next: 47454 |