Prev: C910 Up: Map Next: C967
C930: Handle Sheriff
Used by the routine at HandleMountedSheriff.
Type 01: the sheriff in the town. It counts down ProtectionTimer, calls ReloadRevolver, reads the controls, then turns, moves and fires. The sprites are written to SheriffSpriteList.
Input
IX The address of the sheriff
Count down ProtectionTimer.
HandleSheriff C930 LD HL,$A208 Point HL at ProtectionTimer.
C933 LD A,(HL) Jump to HandleSheriff_Reload if ProtectionTimer is zero.
C934 AND A
C935 JR Z,HandleSheriff_Reload
C937 DEC (HL) Count ProtectionTimer down.
Reload the revolver and read the controls.
HandleSheriff_Reload C938 CALL ReloadRevolver Call ReloadRevolver.
C93B CALL ReadControls Call ReadControls.
C93E LD A,($A21C) Fetch Options.
C941 RRCA Move the bits for the controls into the lowest bits.
C942 AND %00000011 Keep the two bits.
C944 JR NZ,HandleSheriff_Act Jump to HandleSheriff_Act if the controls are not the keyboard.
Copy the keyboard fire bit into bit 3.
C946 LD A,C Fetch the controls.
C947 RRCA Move bit 4 into bit 3.
C948 AND %00001000 Keep only that bit.
C94A OR C Combine it with the controls.
C94B LD C,A
This entry point is used by the routine at HandleSheriffEntrance.
Turn, move, fire and draw. C is the controls, and is zero when the sheriff has just arrived.
HandleSheriff_Act C94C LD E,C Copy the controls into E.
C94D CALL CheckRotateKey Call CheckRotateKey.
C950 CALL TurnSheriff Call TurnSheriff.
C953 PUSH DE Stash the controls on the stack.
C954 CALL MovePlayer Call MovePlayer.
C957 POP DE Restore the controls from the stack.
C958 CALL FireRevolver Call FireRevolver.
C95B CALL ChooseFigureSprites Call ChooseFigureSprites.
C95E LD HL,$A228 Point HL at SheriffSpriteList.
C961 CALL BuildFigureSpriteList Call BuildFigureSpriteList.
C964 JP ShowFiringPose Jump to ShowFiringPose.
Prev: C910 Up: Map Next: C967