Prev: 50563 Up: Map Next: 50667
50571: Run the state machine on a dueller
This entry point is used by the routine in Duel_Start.
Input
IX Pointer to dueller data.
50571 LD A,(IX+8) If the dueller is shot and has hit the floor, there's nothing to do.
50574 AND A
50575 RET Z
50576 LD A,(IX+9) If state 1 (stand off) then jump to 50593.
50579 DEC A
50580 JR Z,50593
50582 DEC A If state 2 (draw) then jump to 50613.
50583 JR Z,50613
50585 DEC A If state 3 (shooting) then jump to 50621.
50586 JR Z,50621
50588 DEC A If state 4 (bonus) then jump to 50639.
50589 JR Z,50639
50591 JR 50653 State must be 5 (shot) so jump to 50653.
State 1
50593 LD HL,50917 If the player shot this dueller, call Dueller_Shot and exit. Oops, too early!
50596 CALL Dueller_Down
50599 DEC (IX+1) Decrease the time left in this state.
50602 RET NZ Return if not there yet.
50603 INC (IX+9) Otherwise move to the next state.
50606 LD A,(IX+11) Redraw the dueller as drawing and return.
50609 CALL Duel_Draw_Bandit_Prep
50612 RET
State 2
50613 DEC (IX+16) Decrease the time left in this state.
50616 RET NZ Return if not there yet.
50617 INC (IX+9) Move to the next state.
50620 RET
State 3
50621 LD HL,50678 If the player shot this dueller, call Print_BonusScore and exit. Nice one!
50624 CALL Dueller_Down
50627 DEC (IX+2) Decrease the time left in this state.
50630 RET NZ Return if not there yet.
50631 LD (IX+8),A Reset the "dueller standing" flag
50634 INC A Set the "player shot" flag which will cause a BANG! then return
50635 LD (50914),A
50638 RET
State 4
50639 DEC (IX+14) Decrease the time left in this state.
50642 RET NZ Return if not there yet.
50643 INC (IX+9) Move state between draw and shot.
50646 LD A,(IX+12) Redraw the dueller as shot and return.
50649 CALL Duel_Draw_Bandit_Prep
50652 RET
State 5
50653 DEC (IX+15) Decrease the time left in this state.
50656 RET NZ Return if not there yet.
50657 LD A,2 Redraw the dueller as "floor" All characters use the same sprite ID 2.
50659 CALL Duel_Draw_Bandit_Prep
50662 LD (IX+8),0 Reset the "dueller still standing" flag and return.
50666 RET
Prev: 50563 Up: Map Next: 50667