Prev: 54884 Up: Map Next: 55237
55070: Generic Bandit in Door Frame Logic
Character state variables/ flags.
Bandit_State_Reference 55070 DEFB 4 The current character state.
Bandit_Timer_01 55071 DEFB 8 Character timer 1.
Bandit_Timer_02 55072 DEFB 8 Character timer 2.
Bandit_Timer_03 55073 DEFB 0 Character timer 3.
Bandit_Timer_04 55074 DEFB 85 Character timer 4.
55075 DEFB 8
55076 DEFB 8
This routine looks at the current character state and routes to the correct subroutine.
Bandit_Open_Routing 55077 LD HL,55070 A=Bandit_State_Reference.
55080 LD A,(HL)
55081 DEC A Work out which routine to use based on the current state.
A Routine
1 Bandit_Open_01
2 Bandit_Open_02
3 Bandit_Open_03
4 Bandit_Open_04
55082 JR Z,Bandit_Open_01
55084 DEC A
55085 JR Z,Bandit_Open_02
55087 DEC A
55088 JR Z,Bandit_Open_03
55090 JR Bandit_Open_04
Handle door frame 1 countdown/ transition to door frame 2.
Bandit_Open_01 55092 LD A,(55071) Decrease Bandit_Timer_01 by one, return if result is not zero.
55095 DEC A
55096 LD (55071),A
55099 RET NZ
55100 INC (HL) Move onto next character state.
55101 CALL Draw_DoorFrame02 Pass character frame index (draw | 0) to Draw_DoorFrame02 and return.
55104 RET
Handle door frame 2 countdown/ transition to door frame 3.
Bandit_Open_02 55105 LD A,(55072) Decrease Bandit_Timer_02 by one, return if result is not zero.
55108 DEC A
55109 LD (55072),A
55112 RET NZ
55113 INC (HL) Move onto next character state.
55114 CALL Draw_DoorFrame03 Pass character frame index (draw | 0) to Draw_DoorFrame03 and return.
55117 RET
Handle door frame 3 countdown/ transition to door frame 4.
Bandit_Open_03 55118 LD A,(55073) Decrease Bandit_Timer_03 by one, return if result is not zero.
55121 DEC A
55122 LD (55073),A
55125 RET NZ
55126 INC (HL) Move onto next character state.
55127 CALL Draw_DoorFrame04 Pass character frame index (draw | 0) to Draw_DoorFrame04 and return.
55130 RET
Handle door frame 4 timer...
Bandit_Open_04 55131 LD DE,52952 Calls Hit_Detection with DE=$CED8.
55134 CALL Hit_Detection
55137 LD A,(55074) Decrease Bandit_Timer_04 by one, return if result is not zero.
55140 DEC A
55141 LD (55074),A
55144 RET NZ
55145 INC A Writes $01 to 54014.
55146 LD (54014),A
55149 CALL Reset___ Call Reset___.
55152 RET Return.
This routine looks at the current character state and routes to the correct subroutine.
Bandit_Close_Routing 55153 LD HL,55070 A=Bandit_State_Reference.
55156 LD A,(HL)
55157 DEC A Work out which routine to use based on the current state.
A Routine
1 Bandit_Shot_Action
2 Bandit_Close_04
3 Bandit_Close_03
4 Bandit_Close_02
5 Bandit_Close_01
55158 JR Z,Bandit_Shot_Action
55160 DEC A
55161 JR Z,Bandit_Close_04
55163 DEC A
55164 JR Z,Bandit_Close_03
55166 DEC A
55167 JR Z,Bandit_Close_02
55169 JR Bandit_Close_01
Handles the transition to the (shot | 1) frame in the open doorway.
Bandit_Shot_Action 55171 INC (HL) Move onto next character state.
55172 INC A Move onto next character frame (i.e. shot | 1).
55173 CALL Draw_DoorFrame04 Call Draw_DoorFrame04 and return.
55176 RET
Handle "floor frame in open doorway" countdown.
Bandit_Close_04 55177 LD A,(55071) Decrease Bandit_Timer_01 by one, return if result is not zero.
55180 DEC A
55181 LD (55071),A
55184 RET NZ
55185 INC (HL) Move onto next character state.
55186 LD A,2 Pass character frame index (floor | 2) to Draw_DoorFrame04 and return.
55188 CALL Draw_DoorFrame04
55191 RET
Handle door frame 4 countdown/ transition to door frame 3.
Bandit_Close_03 55192 LD A,(55072) Decrease Bandit_Timer_02 by one, return if result is not zero.
55195 DEC A
55196 LD (55072),A
55199 RET NZ
55200 INC (HL) Move onto next character state.
55201 LD A,2 Pass character frame index (floor | 2), pass it to Draw_DoorFrame03 and return.
55203 CALL Draw_DoorFrame03
55206 RET
Handle door frame 3 countdown/ transition to door frame 2.
Bandit_Close_02 55207 LD A,(55073) Decrease Bandit_Timer_03 by one, return if result is not zero.
55210 DEC A
55211 LD (55073),A
55214 RET NZ
55215 INC (HL) Move onto next character state.
55216 LD A,2 Pass character frame index (floor | 2), pass it to Draw_DoorFrame02 and return.
55218 CALL Draw_DoorFrame02
55221 RET
Handle door frame 2 countdown/ transition to door frame 1.
Bandit_Close_01 55222 LD A,(55074) Decrease Bandit_Timer_04 by one, return if result is not zero.
55225 DEC A
55226 LD (55074),A
55229 RET NZ
55230 CALL Draw_DoorFrame1 Call Draw_DoorFrame1 (i.e. no character/ door is shut).
55233 CALL Reset___ Call Reset___.
55236 RET Return.
Prev: 54884 Up: Map Next: 55237