![]() |
Routines |
| Prev: 55472 | Up: Map | Next: 55820 |
|
|
|||||||||||||||||||
|
Handles all the logic around drawing Julius and handling his "special" logic.
|
|||||||||||||||||||
| Julius_Good_Bad | 55525 | DEFB 0 | If this is $00 then Julius is "good". If this is $01 then he is "bad" (i.e. will draw on you). | ||||||||||||||||
| 55526 | DEFB 0 | ||||||||||||||||||
| Julius_State_Reference | 55527 | DEFB 4 | The current character state. | ||||||||||||||||
| Julius_Timer_01 | 55528 | DEFB 0 | Character timer 1. | ||||||||||||||||
| Julius_Timer_02 | 55529 | DEFB 0 | Character timer 2. | ||||||||||||||||
| Julius_Timer_03 | 55530 | DEFB 0 | Character timer 3. | ||||||||||||||||
| Julius_Timer_04 | 55531 | DEFB 27 | Character timer 4. | ||||||||||||||||
| Julius_Timer_05 | 55532 | DEFB 8 | Character timer 5. | ||||||||||||||||
| Julius_Timer_06 | 55533 | DEFB 8 | Character timer 6. | ||||||||||||||||
| Julius_Timer_07 | 55534 | DEFB 128 | Character timer 7. | ||||||||||||||||
|
This routine looks at the current character state and routes to the correct subroutine.
|
|||||||||||||||||||
| Julius_Open_Routing | 55535 | LD HL,55527 | A=Julius_State_Reference. | ||||||||||||||||
| 55538 | LD A,(HL) | ||||||||||||||||||
| 55539 | DEC A | Work out which routine to use based on the current state.
|
|||||||||||||||||
| 55540 | JR Z,Julius_Open_01 | ||||||||||||||||||
| 55542 | DEC A | ||||||||||||||||||
| 55543 | JR Z,Julius_Open_02 | ||||||||||||||||||
| 55545 | DEC A | ||||||||||||||||||
| 55546 | JR Z,Julius_Open_03 | ||||||||||||||||||
| 55548 | DEC A | ||||||||||||||||||
| 55549 | JR Z,Julius_Open_04 | ||||||||||||||||||
| 55551 | DEC A | ||||||||||||||||||
| 55552 | JR Z,Julius_Open_05 | ||||||||||||||||||
| 55554 | DEC A | ||||||||||||||||||
| 55555 | JR Z,Julius_Open_06 | ||||||||||||||||||
| 55557 | JR Julius_Open_07 | ||||||||||||||||||
|
Handle door frame 1 countdown/ transition to door frame 2.
|
|||||||||||||||||||
| Julius_Open_01 | 55559 | LD A,(55528) | Decrease Julius_Timer_01 by one, return if result is not zero. | ||||||||||||||||
| 55562 | DEC A | ||||||||||||||||||
| 55563 | LD (55528),A | ||||||||||||||||||
| 55566 | RET NZ | ||||||||||||||||||
| 55567 | INC (HL) | Move onto next character state. | |||||||||||||||||
| 55568 | LD A,36 | Pass character index (stand off | 36) to Draw_DoorFrame02 and return. | |||||||||||||||||
| 55570 | CALL Draw_DoorFrame02 | ||||||||||||||||||
| 55573 | RET | ||||||||||||||||||
|
Handle door frame 2 countdown/ transition to door frame 3.
|
|||||||||||||||||||
| Julius_Open_02 | 55574 | LD A,(55529) | Decrease Julius_Timer_02 by one, return if result is not zero. | ||||||||||||||||
| 55577 | DEC A | ||||||||||||||||||
| 55578 | LD (55529),A | ||||||||||||||||||
| 55581 | RET NZ | ||||||||||||||||||
| 55582 | INC (HL) | Move onto next character state. | |||||||||||||||||
| 55583 | LD A,36 | Pass character index (stand off | 36) to Draw_DoorFrame03 and return. | |||||||||||||||||
| 55585 | CALL Draw_DoorFrame03 | ||||||||||||||||||
| 55588 | RET | ||||||||||||||||||
|
Handle door frame 3 countdown/ transition to door frame 4.
|
|||||||||||||||||||
| Julius_Open_03 | 55589 | LD A,(55530) | Decrease Julius_Timer_03 by one, return if result is not zero. | ||||||||||||||||
| 55592 | DEC A | ||||||||||||||||||
| 55593 | LD (55530),A | ||||||||||||||||||
| 55596 | RET NZ | ||||||||||||||||||
| 55597 | INC (HL) | Move onto next character state. | |||||||||||||||||
| 55598 | LD A,36 | Pass character index (stand off | 36) to Draw_DoorFrame04 and return. | |||||||||||||||||
| 55600 | CALL Draw_DoorFrame04 | ||||||||||||||||||
| 55603 | RET | ||||||||||||||||||
|
Handle door frame 4 countdown.
|
|||||||||||||||||||
| Julius_Open_04 | 55604 | LD DE,53213 | Call Hit_Detection with a callback to Init_Julius_Close. | ||||||||||||||||
| 55607 | CALL Hit_Detection | ||||||||||||||||||
| 55610 | LD A,(55531) | Decrease Julius_Timer_04 by one, return if result is not zero. | |||||||||||||||||
| 55613 | DEC A | ||||||||||||||||||
| 55614 | LD (55531),A | ||||||||||||||||||
| 55617 | RET NZ | ||||||||||||||||||
| 55618 | INC (HL) | Move onto next character state. | |||||||||||||||||
| 55619 | LD A,(55525) | Jump to Julius_State_04_Close if Julius_Good_Bad is zero (Julius is "good"). | |||||||||||||||||
| 55622 | AND A | ||||||||||||||||||
| 55623 | JR Z,Julius_State_04_Close | ||||||||||||||||||
|
Changes the frame to show Julius drawing his pistol.
|
|||||||||||||||||||
| 55625 | LD (HL),7 | Writes "07" to Julius_State_Reference. | |||||||||||||||||
| 55627 | LD A,37 | Pass character index (draw | 37) to Draw_DoorFrame04 and return. | |||||||||||||||||
| 55629 | CALL Draw_DoorFrame04 | ||||||||||||||||||
| 55632 | RET | ||||||||||||||||||
|
Set up (and begin) closing the door.
|
|||||||||||||||||||
| Julius_State_04_Close | 55633 | LD A,36 | Pass character index (stand off | 36) to Draw_DoorFrame03. | ||||||||||||||||
| 55635 | CALL Draw_DoorFrame03 | ||||||||||||||||||
| 55638 | LD A,1 | Writes $01 to 53648 and IX+8. Writes $05 to IX+6 and return. | |||||||||||||||||
| 55640 | LD (53648),A | ||||||||||||||||||
| 55643 | LD (IX+8),A | ||||||||||||||||||
| 55646 | LD (IX+6),5 | ||||||||||||||||||
| 55650 | RET | ||||||||||||||||||
|
Handle door frame 3 countdown/ transition to door frame 2.
|
|||||||||||||||||||
| Julius_Open_05 | 55651 | LD A,(55532) | Decrease Julius_Timer_05 by one, return if result is not zero. | ||||||||||||||||
| 55654 | DEC A | ||||||||||||||||||
| 55655 | LD (55532),A | ||||||||||||||||||
| 55658 | RET NZ | ||||||||||||||||||
| 55659 | INC (HL) | Move onto next character state. | |||||||||||||||||
| 55660 | LD A,36 | Pass character index (stand off | 36) to Draw_DoorFrame02 and return. | |||||||||||||||||
| 55662 | CALL Draw_DoorFrame02 | ||||||||||||||||||
| 55665 | RET | ||||||||||||||||||
|
Handle door frame 2 countdown/ transition to door frame 1.
|
|||||||||||||||||||
| Julius_Open_06 | 55666 | LD A,(55533) | Decrease Julius_Timer_06 by one, return if result is not zero. | ||||||||||||||||
| 55669 | DEC A | ||||||||||||||||||
| 55670 | LD (55533),A | ||||||||||||||||||
| 55673 | RET NZ | ||||||||||||||||||
| 55674 | CALL Draw_DoorFrame1 | Call Draw_DoorFrame1 (i.e. no character/ door is shut). | |||||||||||||||||
| 55677 | CALL Reset___ | Call Reset___. | |||||||||||||||||
| 55680 | RET | Return. | |||||||||||||||||
|
???
|
|||||||||||||||||||
| Julius_Open_07 | 55681 | LD DE,53218 | Call Hit_Detection with a callback to 53218. | ||||||||||||||||
| 55684 | CALL Hit_Detection | ||||||||||||||||||
| 55687 | LD A,(55534) | Decrease Julius_Timer_07 by one, return if result is not zero. | |||||||||||||||||
| 55690 | DEC A | ||||||||||||||||||
| 55691 | LD (55534),A | ||||||||||||||||||
| 55694 | RET NZ | ||||||||||||||||||
| 55695 | INC A | Move onto next character state. | |||||||||||||||||
| 55696 | LD (54014),A | Write $01 to 54014. | |||||||||||||||||
| 55699 | CALL Reset___ | Call Reset___. | |||||||||||||||||
| 55702 | RET | Return. | |||||||||||||||||
|
This routine looks at the current character state and routes to the correct subroutine.
|
|||||||||||||||||||
| Julius_Close_Routing | 55703 | LD HL,55527 | A=Julius_State_Reference. | ||||||||||||||||
| 55706 | LD A,(HL) | ||||||||||||||||||
| 55707 | DEC A | Work out which routine to use based on the current state.
|
|||||||||||||||||
| 55708 | JR Z,Julius_Close_01 | ||||||||||||||||||
| 55710 | DEC A | ||||||||||||||||||
| 55711 | JR Z,Julius_Close_02 | ||||||||||||||||||
| 55713 | DEC A | ||||||||||||||||||
| 55714 | JR Z,Julius_Close_03 | ||||||||||||||||||
| 55716 | DEC A | ||||||||||||||||||
| 55717 | JR Z,Julius_Close_04 | ||||||||||||||||||
| 55719 | JR Julius_Close_05 | ||||||||||||||||||
|
Handles state countdown/ transition to character frame $26.
|
|||||||||||||||||||
| Julius_Close_01 | 55721 | LD A,(55528) | Decrease Julius_Timer_01 by one, return if result is not zero. | ||||||||||||||||
| 55724 | DEC A | ||||||||||||||||||
| 55725 | LD (55528),A | ||||||||||||||||||
| 55728 | RET NZ | ||||||||||||||||||
| 55729 | INC (HL) | Move onto next character state. | |||||||||||||||||
| 55730 | LD A,38 | Pass character index shot | 38 to Draw_DoorFrame04 and return. | |||||||||||||||||
| 55732 | CALL Draw_DoorFrame04 | ||||||||||||||||||
| 55735 | RET | ||||||||||||||||||
|
Handles state countdown/ transition to character frame $27.
|
|||||||||||||||||||
| Julius_Close_02 | 55736 | LD A,(55529) | Decrease Julius_Timer_02 by one, return if result is not zero. | ||||||||||||||||
| 55739 | DEC A | ||||||||||||||||||
| 55740 | LD (55529),A | ||||||||||||||||||
| 55743 | RET NZ | ||||||||||||||||||
| 55744 | INC (HL) | Move onto next character state. | |||||||||||||||||
| 55745 | LD A,39 | Pass character index floor | 39 to Draw_DoorFrame04. | |||||||||||||||||
| 55747 | CALL Draw_DoorFrame04 | ||||||||||||||||||
| 55750 | LD A,(55526) | Return if 55526 is zero. | |||||||||||||||||
| 55753 | AND A | ||||||||||||||||||
| 55754 | RET Z | ||||||||||||||||||
| 55755 | INC A | Else write 55526+1 to 54014, call Reset___ and return. | |||||||||||||||||
| 55756 | LD (54014),A | ||||||||||||||||||
| 55759 | CALL Reset___ | ||||||||||||||||||
| 55762 | RET | ||||||||||||||||||
|
Handle door frame 4 countdown/ transition to door frame 3.
|
|||||||||||||||||||
| Julius_Close_03 | 55763 | LD A,(55530) | Decrease Julius_Timer_03 by one, return if result is not zero. | ||||||||||||||||
| 55766 | DEC A | ||||||||||||||||||
| 55767 | LD (55530),A | ||||||||||||||||||
| 55770 | RET NZ | ||||||||||||||||||
| 55771 | INC (HL) | Move onto next character state. | |||||||||||||||||
| 55772 | LD A,39 | Pass character index floor | 39 to Draw_DoorFrame03 and return. | |||||||||||||||||
| 55774 | CALL Draw_DoorFrame03 | ||||||||||||||||||
| 55777 | RET | ||||||||||||||||||
|
Handle door frame 3 countdown/ transition to door frame 2.
|
|||||||||||||||||||
| Julius_Close_04 | 55778 | LD A,(55531) | Decrease Julius_Timer_04 by one, return if result is not zero. | ||||||||||||||||
| 55781 | DEC A | ||||||||||||||||||
| 55782 | LD (55531),A | ||||||||||||||||||
| 55785 | RET NZ | ||||||||||||||||||
| 55786 | INC (HL) | Move onto next character state. | |||||||||||||||||
| 55787 | LD A,39 | Pass character index floor | 39 to Draw_DoorFrame02 and return. | |||||||||||||||||
| 55789 | CALL Draw_DoorFrame02 | ||||||||||||||||||
| 55792 | RET | ||||||||||||||||||
|
Handle door frame 2 countdown/ transition to door frame 1.
|
|||||||||||||||||||
| Julius_Close_05 | 55793 | LD A,(55532) | Decrease Julius_Timer_05 by one, return if result is not zero. | ||||||||||||||||
| 55796 | DEC A | ||||||||||||||||||
| 55797 | LD (55532),A | ||||||||||||||||||
| 55800 | RET NZ | ||||||||||||||||||
| 55801 | CALL Draw_DoorFrame1 | Call Draw_DoorFrame1 (i.e. no character/ door is shut). | |||||||||||||||||
| 55804 | CALL Reset___ | Call Reset___. | |||||||||||||||||
| 55807 | LD A,1 | Writes $01 to 53648 and IX+8. Writes $05 to IX+6 and return. | |||||||||||||||||
| 55809 | LD (53648),A | ||||||||||||||||||
| 55812 | LD (IX+8),A | ||||||||||||||||||
| 55815 | LD (IX+6),5 | ||||||||||||||||||
| 55819 | RET | ||||||||||||||||||
| Prev: 55472 | Up: Map | Next: 55820 |