Prev: D664 Up: Map Next: D7C5
D71E: Generic Bandit in Door Frame Logic
Character state variables/ flags.
Bandit_State_Reference D71E DEFB $04 The current character state.
Bandit_Timer_01 D71F DEFB $08 Character timer 1.
Bandit_Timer_02 D720 DEFB $08 Character timer 2.
Bandit_Timer_03 D721 DEFB $00 Character timer 3.
Bandit_Timer_04 D722 DEFB $55 Character timer 4.
D723 DEFB $08
D724 DEFB $08
This routine looks at the current character state and routes to the correct subroutine.
Bandit_Open_Routing D725 LD HL,$D71E A=Bandit_State_Reference.
D728 LD A,(HL)
D729 DEC A Work out which routine to use based on the current state.
A Routine
01 Bandit_Open_01
02 Bandit_Open_02
03 Bandit_Open_03
04 Bandit_Open_04
D72A JR Z,Bandit_Open_01
D72C DEC A
D72D JR Z,Bandit_Open_02
D72F DEC A
D730 JR Z,Bandit_Open_03
D732 JR Bandit_Open_04
Handle door frame 1 countdown/ transition to door frame 2.
Bandit_Open_01 D734 LD A,($D71F) Decrease Bandit_Timer_01 by one, return if result is not zero.
D737 DEC A
D738 LD ($D71F),A
D73B RET NZ
D73C INC (HL) Move onto next character state.
D73D CALL Draw_DoorFrame02 Pass character frame index (draw | 00) to Draw_DoorFrame02 and return.
D740 RET
Handle door frame 2 countdown/ transition to door frame 3.
Bandit_Open_02 D741 LD A,($D720) Decrease Bandit_Timer_02 by one, return if result is not zero.
D744 DEC A
D745 LD ($D720),A
D748 RET NZ
D749 INC (HL) Move onto next character state.
D74A CALL Draw_DoorFrame03 Pass character frame index (draw | 00) to Draw_DoorFrame03 and return.
D74D RET
Handle door frame 3 countdown/ transition to door frame 4.
Bandit_Open_03 D74E LD A,($D721) Decrease Bandit_Timer_03 by one, return if result is not zero.
D751 DEC A
D752 LD ($D721),A
D755 RET NZ
D756 INC (HL) Move onto next character state.
D757 CALL Draw_DoorFrame04 Pass character frame index (draw | 00) to Draw_DoorFrame04 and return.
D75A RET
Handle door frame 4 timer...
Bandit_Open_04 D75B LD DE,$CED8 Calls Hit_Detection with DE=$CED8.
D75E CALL Hit_Detection
D761 LD A,($D722) Decrease Bandit_Timer_04 by one, return if result is not zero.
D764 DEC A
D765 LD ($D722),A
D768 RET NZ
D769 INC A Writes $01 to D2FE.
D76A LD ($D2FE),A
D76D CALL Reset___ Call Reset___.
D770 RET Return.
This routine looks at the current character state and routes to the correct subroutine.
Bandit_Close_Routing D771 LD HL,$D71E A=Bandit_State_Reference.
D774 LD A,(HL)
D775 DEC A Work out which routine to use based on the current state.
A Routine
01 Bandit_Shot_Action
02 Bandit_Close_04
03 Bandit_Close_03
04 Bandit_Close_02
05 Bandit_Close_01
D776 JR Z,Bandit_Shot_Action
D778 DEC A
D779 JR Z,Bandit_Close_04
D77B DEC A
D77C JR Z,Bandit_Close_03
D77E DEC A
D77F JR Z,Bandit_Close_02
D781 JR Bandit_Close_01
Handles the transition to the (shot | 01) frame in the open doorway.
Bandit_Shot_Action D783 INC (HL) Move onto next character state.
D784 INC A Move onto next character frame (i.e. shot | 01).
D785 CALL Draw_DoorFrame04 Call Draw_DoorFrame04 and return.
D788 RET
Handle "floor frame in open doorway" countdown.
Bandit_Close_04 D789 LD A,($D71F) Decrease Bandit_Timer_01 by one, return if result is not zero.
D78C DEC A
D78D LD ($D71F),A
D790 RET NZ
D791 INC (HL) Move onto next character state.
D792 LD A,$02 Pass character frame index (floor | 02) to Draw_DoorFrame04 and return.
D794 CALL Draw_DoorFrame04
D797 RET
Handle door frame 4 countdown/ transition to door frame 3.
Bandit_Close_03 D798 LD A,($D720) Decrease Bandit_Timer_02 by one, return if result is not zero.
D79B DEC A
D79C LD ($D720),A
D79F RET NZ
D7A0 INC (HL) Move onto next character state.
D7A1 LD A,$02 Pass character frame index (floor | 02), pass it to Draw_DoorFrame03 and return.
D7A3 CALL Draw_DoorFrame03
D7A6 RET
Handle door frame 3 countdown/ transition to door frame 2.
Bandit_Close_02 D7A7 LD A,($D721) Decrease Bandit_Timer_03 by one, return if result is not zero.
D7AA DEC A
D7AB LD ($D721),A
D7AE RET NZ
D7AF INC (HL) Move onto next character state.
D7B0 LD A,$02 Pass character frame index (floor | 02), pass it to Draw_DoorFrame02 and return.
D7B2 CALL Draw_DoorFrame02
D7B5 RET
Handle door frame 2 countdown/ transition to door frame 1.
Bandit_Close_01 D7B6 LD A,($D722) Decrease Bandit_Timer_04 by one, return if result is not zero.
D7B9 DEC A
D7BA LD ($D722),A
D7BD RET NZ
D7BE CALL Draw_DoorFrame1 Call Draw_DoorFrame1 (i.e. no character/ door is shut).
D7C1 CALL Reset___ Call Reset___.
D7C4 RET Return.
Prev: D664 Up: Map Next: D7C5