![]() |
Routines |
| Prev: 55070 | Up: Map | Next: 55457 |
|
Handles all the logic around drawing Bowie and handling his "special" logic.
|
|||||||||||||||||
|
Bowie state variables/ flags.
|
|||||||||||||||||
| Bowie_Good_Bad | 55237 | DEFB 1 | If this is $00 then Bowie is "good". If this is $01 then he is "bad" (i.e. there's a bomb under his hat). | ||||||||||||||
| Bowie_Frame_Reference | 55238 | DEFB 34 | The current character frame index reference. | ||||||||||||||
| Bowie_State_Reference | 55239 | DEFB 6 | The current character state. | ||||||||||||||
| Bowie_Timer_01 | 55240 | DEFB 0 | Character timer 1. | ||||||||||||||
| Bowie_Timer_02 | 55241 | DEFB 0 | Character timer 2. | ||||||||||||||
| Bowie_Timer_03 | 55242 | DEFB 0 | Character timer 3. | ||||||||||||||
| Bowie_Timer_04 | 55243 | DEFB 0 | Character timer 4. | ||||||||||||||
| Bowie_Timer_05 | 55244 | DEFB 0 | Character timer 5. | ||||||||||||||
| Bowie_Timer_06 | 55245 | DEFB 0 | Character timer 6. | ||||||||||||||
|
This routine looks at the current character state and routes to the correct subroutine.
|
|||||||||||||||||
| Bowie_Routing | 55246 | LD HL,55239 | A=Bowie_State_Reference. | ||||||||||||||
| 55249 | LD A,(HL) | ||||||||||||||||
| 55250 | DEC A | Work out which routine to jump to based on the current state.
|
|||||||||||||||
| 55251 | JR Z,Bowie_Open_01 | ||||||||||||||||
| 55253 | DEC A | ||||||||||||||||
| 55254 | JR Z,Bowie_Open_02 | ||||||||||||||||
| 55256 | DEC A | ||||||||||||||||
| 55257 | JR Z,Bowie_Open_03 | ||||||||||||||||
| 55259 | DEC A | ||||||||||||||||
| 55260 | JR Z,Bowie_Open_04 | ||||||||||||||||
| 55262 | DEC A | ||||||||||||||||
| 55263 | JR Z,Bowie_Close_02 | ||||||||||||||||
| 55265 | JR Bowie_Close_01 | ||||||||||||||||
|
Handle door frame 1 countdown/ transition to door frame 2.
|
|||||||||||||||||
| Bowie_Open_01 | 55267 | LD A,(55240) | Decrease Bowie_Timer_01 by one, return if result is not zero. | ||||||||||||||
| 55270 | DEC A | ||||||||||||||||
| 55271 | LD (55240),A | ||||||||||||||||
| 55274 | RET NZ | ||||||||||||||||
| 55275 | INC (HL) | Move onto next character state. | |||||||||||||||
| 55276 | LD A,27 | Pass character index $1B to Draw_DoorFrame02 and return. | |||||||||||||||
| 55278 | CALL Draw_DoorFrame02 | ||||||||||||||||
| 55281 | RET | ||||||||||||||||
|
Handle door frame 2 countdown/ transition to door frame 3.
|
|||||||||||||||||
| Bowie_Open_02 | 55282 | LD A,(55241) | Decrease Bowie_Timer_02 by one, return if result is not zero. | ||||||||||||||
| 55285 | DEC A | ||||||||||||||||
| 55286 | LD (55241),A | ||||||||||||||||
| 55289 | RET NZ | ||||||||||||||||
| 55290 | INC (HL) | Move onto next character state. | |||||||||||||||
| 55291 | LD A,27 | Pass character index $1B to Draw_DoorFrame03 and return. | |||||||||||||||
| 55293 | CALL Draw_DoorFrame03 | ||||||||||||||||
| 55296 | RET | ||||||||||||||||
|
Handle door frame 3 countdown/ transition to door frame 4.
|
|||||||||||||||||
| Bowie_Open_03 | 55297 | LD A,(55242) | Decrease Bowie_Timer_03 by one, return if result is not zero. | ||||||||||||||
| 55300 | DEC A | ||||||||||||||||
| 55301 | LD (55242),A | ||||||||||||||||
| 55304 | RET NZ | ||||||||||||||||
| 55305 | INC (HL) | Move onto next character state. | |||||||||||||||
| 55306 | LD A,27 | Pass character frame index $1B to Draw_DoorFrame04 and return. | |||||||||||||||
| 55308 | CALL Draw_DoorFrame04 | ||||||||||||||||
| 55311 | RET | ||||||||||||||||
|
Handle door frame 4 countdown/ transition to door frame 3.
|
|||||||||||||||||
| Bowie_Open_04 | 55312 | LD E,(IX+4) | Call Hit_Detection with a callback to either Bowie_Cash_Action or Bowie_Bomb_Action. | ||||||||||||||
| 55315 | LD D,(IX+5) | ||||||||||||||||
| 55318 | CALL Hit_Detection | ||||||||||||||||
| 55321 | LD A,(55243) | Decrease Bowie_Timer_04 by one, return if result is not zero. | |||||||||||||||
| 55324 | DEC A | ||||||||||||||||
| 55325 | LD (55243),A | ||||||||||||||||
| 55328 | RET NZ | ||||||||||||||||
| Bowie_Close_03 | 55329 | LD HL,55239 | Move onto next character state (Bowie_State_Reference). | ||||||||||||||
| 55332 | INC (HL) | ||||||||||||||||
| 55333 | LD A,(55238) | Load the character frame index from Bowie_Frame_Reference, pass it to Draw_DoorFrame03 and return. | |||||||||||||||
| 55336 | CALL Draw_DoorFrame03 | ||||||||||||||||
| 55339 | RET | ||||||||||||||||
|
Handle door frame 3 countdown/ transition to door frame 2.
|
|||||||||||||||||
| Bowie_Close_02 | 55340 | LD A,(55244) | Decrease Bowie_Timer_05 by one, return if result is not zero. | ||||||||||||||
| 55343 | DEC A | ||||||||||||||||
| 55344 | LD (55244),A | ||||||||||||||||
| 55347 | RET NZ | ||||||||||||||||
| 55348 | INC (HL) | Move onto next character state. | |||||||||||||||
| 55349 | LD A,(55238) | Load the character frame index from Bowie_Frame_Reference, pass it to Draw_DoorFrame02 and return. | |||||||||||||||
| 55352 | CALL Draw_DoorFrame02 | ||||||||||||||||
| 55355 | RET | ||||||||||||||||
|
Handle door frame 2 countdown/ transition to door frame 1.
|
|||||||||||||||||
| Bowie_Close_01 | 55356 | LD A,(55245) | Decrease Bowie_Timer_06 by one, return if result is not zero. | ||||||||||||||
| 55359 | DEC A | ||||||||||||||||
| 55360 | LD (55245),A | ||||||||||||||||
| 55363 | RET NZ | ||||||||||||||||
| 55364 | CALL Draw_DoorFrame1 | Call Draw_DoorFrame1 (i.e. no character/ door is shut). | |||||||||||||||
| 55367 | CALL Reset___ | Call Reset___. | |||||||||||||||
| 55370 | RET | Return. | |||||||||||||||
|
Handles marking this as something shootable.
|
|||||||||||||||||
| Bowie_Cash_Action | 55371 | LD (IX+6),5 | Writes $05 to IX+$06 and $01 to IX+$07. | ||||||||||||||
| 55375 | LD (IX+7),1 | ||||||||||||||||
| 55379 | LD A,1 | Writes $01 to IX+$08 and 53648. | |||||||||||||||
| 55381 | LD (IX+8),A | ||||||||||||||||
| 55384 | LD (53648),A | ||||||||||||||||
| 55387 | JR Bowie_Close_03 | Jump to Bowie_Close_03. | |||||||||||||||
|
Handles marking this as something unshootable.
|
|||||||||||||||||
| Bowie_Bomb_Action | 55389 | LD A,5 | Writes $05 to 54014 and return. | ||||||||||||||
| 55391 | LD (54014),A | ||||||||||||||||
| 55394 | RET | ||||||||||||||||
|
Handles both shooting the hats off Bowie's head, and checking/ routing on the last frame for the "surprise".
|
|||||||||||||||||
| Bowie_Shot_Action | 55395 | LD HL,55238 | A=Bowie_Frame_Reference. | ||||||||||||||
| 55398 | LD A,(HL) | ||||||||||||||||
| 55399 | CP 33 | Is it character frame reference (1 hat | 33)? | |||||||||||||||
| 55401 | LD (IX+6),1 | Writes $01 to IX+$06. | |||||||||||||||
| 55405 | JR NC,Bowie_Check | If Bowie is on the last frame then jump forward to Bowie_Check. | |||||||||||||||
| 55407 | INC A | Else update Bowie_Frame_Reference to point at the next frame, call Draw_DoorFrame04 and return. | |||||||||||||||
| 55408 | LD (HL),A | ||||||||||||||||
| 55409 | CALL Draw_DoorFrame04 | ||||||||||||||||
| 55412 | RET | ||||||||||||||||
|
Checks the "good/ bad" flag and routes the gameplay accordingly.
|
|||||||||||||||||
| Bowie_Check | 55413 | LD A,(55237) | If Bowie_Good_Bad is zero jump to Bowie_State_Cash. | ||||||||||||||
| 55416 | AND A | ||||||||||||||||
| 55417 | JR Z,Bowie_State_Cash | ||||||||||||||||
| 55419 | JR Bowie_State_Bomb | Jump to Bowie_State_Bomb. | |||||||||||||||
|
Handle displaying cash character frame.
|
|||||||||||||||||
| Bowie_State_Cash | 55421 | LD A,35 | Writes character frame reference cash | 35 to Bowie_Frame_Reference, and pass it to Draw_DoorFrame04. | ||||||||||||||
| 55423 | LD (55238),A | ||||||||||||||||
| 55426 | CALL Draw_DoorFrame04 | ||||||||||||||||
| 55429 | LD HL,55371 | Writes Bowie_Cash_Action to the current door flags (e.g. Door_Bowie_Action_01, Door_Bowie_Action_02 or Door_Bowie_Action_03). | |||||||||||||||
| 55432 | LD (IX+4),L | ||||||||||||||||
| 55435 | LD (IX+5),H | ||||||||||||||||
| 55438 | RET | Return. | |||||||||||||||
|
Handle displaying bomb character frame.
|
|||||||||||||||||
| Bowie_State_Bomb | 55439 | LD A,34 | Writes character frame reference bomb | 34 to Bowie_Frame_Reference, and pass it to Draw_DoorFrame04. | ||||||||||||||
| 55441 | LD (55238),A | ||||||||||||||||
| 55444 | CALL Draw_DoorFrame04 | ||||||||||||||||
| 55447 | LD HL,55389 | Writes Bowie_Bomb_Action to the current door flags (e.g. Door_Bowie_Action_01, Door_Bowie_Action_02 or Door_Bowie_Action_03). | |||||||||||||||
| 55450 | LD (IX+4),L | ||||||||||||||||
| 55453 | LD (IX+5),H | ||||||||||||||||
| 55456 | RET | Return. | |||||||||||||||
| Prev: 55070 | Up: Map | Next: 55457 |