Prev: 51680 Up: Map Next: 51760
51692: Fire Revolver
Used by the routines at HandleCrosshair and HandleSheriff.
Fires the revolver if the fire control is pressed, BulletsLoaded is not zero, and neither ReloadingFlag nor FireHeldFlag is set. It calls MakeShot, takes one from BulletsLoaded, and colours the chamber unless there were six. FireTimer and FireHeldFlag are then set.
Input
E The controls
IX The address of the object which fires
Return unless a new shot can be made.
FireRevolver 51692 LD A,(41540) Jump to FireRevolver_Held if FireHeldFlag is set.
51695 AND A
51696 JR NZ,FireRevolver_Held
51698 BIT 3,E Return if the fire control is not pressed.
51700 RET Z
51701 LD A,(41542) Return if ReloadingFlag is set.
51704 AND A
51705 RET NZ
51706 LD A,(41570) Return if BulletsLoaded is zero.
51709 AND A
51710 RET Z
Make the shot and take a bullet.
51711 CALL MakeShot Call MakeShot.
51714 RET NC Return if no shot was made.
51715 LD A,(41570) Take one from BulletsLoaded.
51718 DEC A
51719 LD (41570),A
51722 INC A Make it the number there were.
51723 CP 6 Jump to FireRevolver_Fired if there were six.
51725 JR Z,FireRevolver_Fired
Colour the chamber for the number there were.
51727 LD BC,51680 Point BC at ChamberAddresses.
51730 CALL GetTableEntry Call GetTableEntry.
51733 CALL AddTownOffsetToHL Call AddTownOffsetToHL.
51736 LD A,65 Call FillChamber with BLUE (BRIGHT).
51738 CALL FillChamber
Start the firing pose and hold the fire control.
FireRevolver_Fired 51741 LD A,5 Set FireTimer to 5.
51743 LD (41541),A
51746 LD A,1 Set FireHeldFlag to 1 and return.
51748 LD (41540),A
51751 RET
Clear FireHeldFlag when the fire control is released.
FireRevolver_Held 51752 BIT 3,E Return if the fire control is still pressed.
51754 RET NZ
51755 XOR A Clear FireHeldFlag and return.
51756 LD (41540),A
51759 RET
Prev: 51680 Up: Map Next: 51760