![]() |
Routines |
| Prev: 55525 | Up: Map | Next: 56047 |
|
|
|||||||||||||||
|
Character state variables/ flags.
|
|||||||||||||||
| Bandit_Draw | 55820 | DEFB 0 | |||||||||||||
| Bandit_Draw_Frame_01 | 55821 | DEFB 8 | Character frame index 1. | ||||||||||||
| Bandit_Draw_Frame_02 | 55822 | DEFB 8 | Character frame index 2. | ||||||||||||
| Bandit_Draw_Frame_03 | 55823 | DEFB 9 | Character frame index 3. | ||||||||||||
| Bandit_Draw_Frame_04 | 55824 | DEFB 7 | Character frame index 4. | ||||||||||||
| Bandit_Draw_State_Reference | 55825 | DEFB 5 | The current character state. | ||||||||||||
| Bandit_Draw_Timer_01 | 55826 | DEFB 0 | Character timer 1. | ||||||||||||
| Bandit_Draw_Timer_02 | 55827 | DEFB 0 | Character timer 2. | ||||||||||||
| Bandit_Draw_Timer_03 | 55828 | DEFB 0 | Character timer 3. | ||||||||||||
| Bandit_Draw_Timer_04 | 55829 | DEFB 0 | Character timer 4. | ||||||||||||
| Bandit_Draw_Timer_05 | 55830 | DEFB 0 | Character timer 5. | ||||||||||||
|
This routine looks at the current character state and routes to the correct subroutine.
|
|||||||||||||||
| Bandit_Draw_Open_Routing | 55831 | LD HL,55825 | A=Bandit_Draw_State_Reference. | ||||||||||||
| 55834 | LD A,(HL) | ||||||||||||||
| 55835 | DEC A | Work out which routine to use based on the current state.
|
|||||||||||||
| 55836 | JR Z,Bandit_Draw_Open_01 | ||||||||||||||
| 55838 | DEC A | ||||||||||||||
| 55839 | JR Z,Bandit_Draw_Open_02 | ||||||||||||||
| 55841 | DEC A | ||||||||||||||
| 55842 | JR Z,Bandit_Draw_Open_03 | ||||||||||||||
| 55844 | DEC A | ||||||||||||||
| 55845 | JR Z,Bandit_Draw_Open_04 | ||||||||||||||
| 55847 | JR Bandit_Draw_Open_05 | ||||||||||||||
|
Handle door frame 1 countdown/ transition to door frame 2.
|
|||||||||||||||
| Bandit_Draw_Open_01 | 55849 | LD A,(55826) | Decrease Bandit_Draw_Timer_01 by one, return if result is not zero. | ||||||||||||
| 55852 | DEC A | ||||||||||||||
| 55853 | LD (55826),A | ||||||||||||||
| 55856 | RET NZ | ||||||||||||||
| 55857 | INC (HL) | Move onto next character state. | |||||||||||||
| 55858 | LD A,(55821) | Grab the character frame index from Bandit_Draw_Frame_01. | |||||||||||||
| 55861 | CALL Draw_DoorFrame02 | Call Draw_DoorFrame02 and return. | |||||||||||||
| 55864 | RET | ||||||||||||||
|
Handle door frame 2 countdown/ transition to door frame 3.
|
|||||||||||||||
| Bandit_Draw_Open_02 | 55865 | LD A,(55827) | Decrease Bandit_Draw_Timer_02 by one, return if result is not zero. | ||||||||||||
| 55868 | DEC A | ||||||||||||||
| 55869 | LD (55827),A | ||||||||||||||
| 55872 | RET NZ | ||||||||||||||
| 55873 | INC (HL) | Move onto next character state. | |||||||||||||
| 55874 | LD A,(55821) | Grab the character frame index from Bandit_Draw_Frame_01. | |||||||||||||
| 55877 | CALL Draw_DoorFrame03 | Call Draw_DoorFrame03 and return. | |||||||||||||
| 55880 | RET | ||||||||||||||
|
Handle door frame 3 countdown/ transition to door frame 4.
|
|||||||||||||||
| Bandit_Draw_Open_03 | 55881 | LD A,(55828) | Decrease Bandit_Draw_Timer_03 by one, return if result is not zero. | ||||||||||||
| 55884 | DEC A | ||||||||||||||
| 55885 | LD (55828),A | ||||||||||||||
| 55888 | RET NZ | ||||||||||||||
| 55889 | INC (HL) | Move onto next character state. | |||||||||||||
| 55890 | LD A,(55821) | Grab the character frame index from Bandit_Draw_Frame_01. | |||||||||||||
| 55893 | CALL Draw_DoorFrame04 | Call Draw_DoorFrame04 and return. | |||||||||||||
| 55896 | RET | ||||||||||||||
|
Handles state countdown.
|
|||||||||||||||
| Bandit_Draw_Open_04 | 55897 | LD DE,53303 | Call Hit_Detection with a callback to Todo_Door_Reset. | ||||||||||||
| 55900 | CALL Hit_Detection | ||||||||||||||
| 55903 | LD A,(55829) | Decrease Bandit_Draw_Timer_04 by one, return if result is not zero. | |||||||||||||
| 55906 | DEC A | ||||||||||||||
| 55907 | LD (55829),A | ||||||||||||||
| 55910 | RET NZ | ||||||||||||||
| 55911 | INC (HL) | Move onto next character state. | |||||||||||||
| 55912 | LD A,(55822) | Grab the character frame index from Bandit_Draw_Frame_02. | |||||||||||||
| 55915 | CALL Draw_DoorFrame04 | Call Draw_DoorFrame04 and return. | |||||||||||||
| 55918 | RET | ||||||||||||||
|
Handles state countdown.
|
|||||||||||||||
| Bandit_Draw_Open_05 | 55919 | LD DE,53312 | Call Hit_Detection with a callback to 53312. | ||||||||||||
| 55922 | CALL Hit_Detection | ||||||||||||||
| 55925 | LD A,(55830) | Decrease Bandit_Draw_Timer_05 by one, return if result is not zero. | |||||||||||||
| 55928 | DEC A | ||||||||||||||
| 55929 | LD (55830),A | ||||||||||||||
| 55932 | RET NZ | ||||||||||||||
| 55933 | INC A | Else write $01 to 54014, call Reset___ and return. | |||||||||||||
| 55934 | LD (54014),A | ||||||||||||||
| 55937 | CALL Reset___ | ||||||||||||||
| 55940 | RET | ||||||||||||||
|
This routine looks at the current character state and routes to the correct subroutine.
|
|||||||||||||||
| Bandit_Draw_Close_Routing | 55941 | LD HL,55825 | A=Bandit_Draw_State_Reference. | ||||||||||||
| 55944 | LD A,(HL) | ||||||||||||||
| 55945 | DEC A | Work out which routine to use based on the current state.
|
|||||||||||||
| 55946 | JR Z,Bandit_Draw_Close_01 | ||||||||||||||
| 55948 | DEC A | ||||||||||||||
| 55949 | JR Z,Bandit_Draw_Close_02 | ||||||||||||||
| 55951 | DEC A | ||||||||||||||
| 55952 | JR Z,Bandit_Draw_Close_03 | ||||||||||||||
| 55954 | DEC A | ||||||||||||||
| 55955 | JR Z,Bandit_Draw_Close_04 | ||||||||||||||
| 55957 | JR Bandit_Draw_Close_05 | ||||||||||||||
|
Handles state countdown.
|
|||||||||||||||
| Bandit_Draw_Close_01 | 55959 | LD A,(55826) | Decrease Bandit_Draw_Timer_01 by one, return if result is not zero. | ||||||||||||
| 55962 | DEC A | ||||||||||||||
| 55963 | LD (55826),A | ||||||||||||||
| 55966 | RET NZ | ||||||||||||||
| 55967 | INC (HL) | Move onto next character state. | |||||||||||||
| 55968 | LD A,(55823) | Grab the character frame index from Bandit_Draw_Frame_03. | |||||||||||||
| 55971 | CALL Draw_DoorFrame04 | Call Draw_DoorFrame04 and return. | |||||||||||||
| 55974 | RET | ||||||||||||||
|
Handles state countdown.
|
|||||||||||||||
| Bandit_Draw_Close_02 | 55975 | LD A,(55827) | Decrease Bandit_Draw_Timer_02 by one, return if result is not zero. | ||||||||||||
| 55978 | DEC A | ||||||||||||||
| 55979 | LD (55827),A | ||||||||||||||
| 55982 | RET NZ | ||||||||||||||
| 55983 | INC (HL) | Move onto next character state. | |||||||||||||
| 55984 | LD A,(55824) | Grab the character frame index from Bandit_Draw_Frame_04. | |||||||||||||
| 55987 | CALL Draw_DoorFrame04 | Call Draw_DoorFrame04. | |||||||||||||
| 55990 | LD A,(55820) | Return if Bandit_Draw is zero. | |||||||||||||
| 55993 | AND A | ||||||||||||||
| 55994 | RET Z | ||||||||||||||
| 55995 | INC A | Else write $01 to 54014 and return. | |||||||||||||
| 55996 | LD (54014),A | ||||||||||||||
| 55999 | RET | ||||||||||||||
|
Handle door frame 4 countdown/ transition to door frame 3.
|
|||||||||||||||
| Bandit_Draw_Close_03 | 56000 | LD A,(55828) | Decrease Bandit_Draw_Timer_03 by one, return if result is not zero. | ||||||||||||
| 56003 | DEC A | ||||||||||||||
| 56004 | LD (55828),A | ||||||||||||||
| 56007 | RET NZ | ||||||||||||||
| 56008 | INC (HL) | Move onto next character state. | |||||||||||||
| 56009 | LD A,(55824) | Grab the character frame index from Bandit_Draw_Frame_04. | |||||||||||||
| 56012 | CALL Draw_DoorFrame03 | Call Draw_DoorFrame03 and return. | |||||||||||||
| 56015 | RET | ||||||||||||||
|
Handle door frame 3 countdown/ transition to door frame 2.
|
|||||||||||||||
| Bandit_Draw_Close_04 | 56016 | LD A,(55829) | Decrease Bandit_Draw_Timer_04 by one, return if result is not zero. | ||||||||||||
| 56019 | DEC A | ||||||||||||||
| 56020 | LD (55829),A | ||||||||||||||
| 56023 | RET NZ | ||||||||||||||
| 56024 | INC (HL) | Move onto next character state. | |||||||||||||
| 56025 | LD A,(55824) | Grab the character frame index from Bandit_Draw_Frame_04. | |||||||||||||
| 56028 | CALL Draw_DoorFrame02 | Call Draw_DoorFrame02 and return. | |||||||||||||
| 56031 | RET | ||||||||||||||
|
Handle door frame 2 countdown/ transition to door frame 1.
|
|||||||||||||||
| Bandit_Draw_Close_05 | 56032 | LD A,(55830) | Decrease Bandit_Draw_Timer_05 by one, return if result is not zero. | ||||||||||||
| 56035 | DEC A | ||||||||||||||
| 56036 | LD (55830),A | ||||||||||||||
| 56039 | RET NZ | ||||||||||||||
| 56040 | CALL Draw_DoorFrame1 | Call Draw_DoorFrame1 (i.e. no character/ door is shut). | |||||||||||||
| 56043 | CALL Reset___ | Call Reset___ and return. | |||||||||||||
| 56046 | RET | ||||||||||||||
| Prev: 55525 | Up: Map | Next: 56047 |