Prev: 51447 Up: Map Next: 51504
51472: Handle Mounted Sheriff
Type 21: the sheriff on a horse. On every fourth frame it counts RidingTimer down. When that reaches zero, TopSpeed is set to 10 the speed to 8 and the type to 1.
Input
IX The address of the sheriff
Jump to HandleSheriff unless it is time to count down.
HandleMountedSheriff 51472 LD A,(41494) Fetch FrameCounter.
51475 ADD A,2 Add 2.
51477 AND %00000011 Keep the lowest two bits.
51479 JR NZ,HandleSheriff Jump to HandleSheriff if this is not every fourth frame.
Count down RidingTimer.
51481 LD HL,41481 Point HL at RidingTimer.
51484 LD A,(HL) Jump to HandleSheriff if RidingTimer is zero.
51485 AND A
51486 JR Z,HandleSheriff
51488 DEC (HL) Count RidingTimer down.
51489 JR NZ,HandleSheriff Jump to HandleSheriff if it is not zero.
Get off the horse.
51491 LD A,10 Set TopSpeed to 10.
51493 LD (41503),A
51496 LD (IX+5),8 Set the speed to 8.
51500 LD (IX+0),1 Make the type 1.
Continue on to HandleSheriff.
Prev: 51447 Up: Map Next: 51504