![]() |
Routines |
| Prev: C967 | Up: Map | Next: C9CF |
|
Used by the routines at HandleCrosshair and HandleSheriff.
Loads one bullet on every even frame while FireTimer is zero and BulletUnpaidFlag is clear. Reloading starts when BulletsLoaded is empty and ReloadingFlag is then set until the cylinder holds six. Each bullet takes BulletPrice from Bounty. If the bounty cannot pay, BulletUnpaidFlag is set.
|
||||
|
Return unless it is time to load a bullet.
|
||||
| ReloadRevolver | C977 | LD A,($A269) | Return if BulletUnpaidFlag is set. | |
| C97A | AND A | |||
| C97B | RET NZ | |||
| C97C | LD A,($A216) | Fetch FrameCounter. | ||
| C97F | AND %00000001 | Keep the lowest bit. | ||
| C981 | RET NZ | Return if this is an odd frame. | ||
| C982 | LD A,($A245) | Return if FireTimer is set. | ||
| C985 | AND A | |||
| C986 | RET NZ | |||
|
Start reloading if the cylinder is empty.
|
||||
| C987 | LD HL,$A246 | Point HL at ReloadingFlag. | ||
| C98A | LD A,(HL) | Fetch ReloadingFlag and test it. | ||
| C98B | AND A | |||
| C98C | LD A,($A262) | Fetch BulletsLoaded. | ||
| C98F | JR NZ,ReloadRevolver_Bullet | Jump to ReloadRevolver_Bullet if ReloadingFlag is set. | ||
| C991 | AND A | Return if BulletsLoaded is not zero. | ||
| C992 | RET NZ | |||
| C993 | LD (HL),$01 | Set ReloadingFlag to 01. | ||
|
Take the price and add a bullet.
|
||||
| ReloadRevolver_Bullet | C995 | LD BC,($A25E) | Fetch BulletPrice. | |
| C999 | CALL SubtractFromBounty | Call SubtractFromBounty. | ||
| C99C | JR C,ReloadRevolver_TooPoor | Jump to ReloadRevolver_TooPoor if there is not enough. | ||
| C99E | LD A,($A262) | Add one to BulletsLoaded. | ||
| C9A1 | INC A | |||
| C9A2 | LD ($A262),A | |||
| C9A5 | CP $06 | Jump to ReloadRevolver_Show if it is not six. | ||
| C9A7 | JR NZ,ReloadRevolver_Show | |||
| C9A9 | LD HL,$A246 | Clear ReloadingFlag. | ||
| C9AC | LD (HL),$00 | |||
|
Colour the chamber and draw the bounty.
|
||||
| ReloadRevolver_Show | C9AE | DEC A | Make it the chamber number. | |
| C9AF | LD BC,$C9E0 | Point BC at ChamberAddresses. | ||
| C9B2 | CALL GetTableEntry | Call GetTableEntry. | ||
| C9B5 | CALL AddTownOffsetToHL | Call AddTownOffsetToHL. | ||
| C9B8 | LD A,$71 | Call FillChamber with INK:BLUE, PAPER:YELLOW (BRIGHT). | ||
| C9BA | CALL FillChamber | |||
| C9BD | CALL PlayBuzz | Call PlayBuzz. | ||
| C9C0 | JP DrawBountyDigits | Jump to DrawBountyDigits. | ||
|
Put the price back and stop reloading.
|
||||
| ReloadRevolver_TooPoor | C9C3 | CALL AddToBounty | Call AddToBounty. | |
| C9C6 | XOR A | Clear ReloadingFlag. | ||
| C9C7 | LD ($A246),A | |||
| C9CA | INC A | Set BulletUnpaidFlag to 01 and return. | ||
| C9CB | LD ($A269),A | |||
| C9CE | RET | |||
| Prev: C967 | Up: Map | Next: C9CF |