Prev: 52766 Up: Map Next: 52920
52769: Choose Door Character
Used by the routine at 51943.
The characters available on a particular level are determined by Chooser_Routine_Buffer.
Initialisation Routine Door
Choose_Default_Set Door 1
Choose_Bandit_05 Door 2
53642 Door 3
Character_Chooser 52769 LD HL,52766 Decrease 52766 by one.
52772 LD A,(HL)
52773 DEC A
52774 LD (HL),A
52775 RET NZ Return if not zero.
52776 LD A,(52763) Copies 52763 into 52766.
52779 LD (HL),A
52780 LD A,(IX+9) Decrease ????? by one.
Address Door
53614 Door 1
53628 Door 2
53642 Door 3
52783 DEC A
52784 LD (IX+9),A
52787 RET NZ Return if not zero.
f
Chooser 52788 CALL Random_Number Call Random_Number.
52791 AND 31 Keep bits 0-4 (so 0-31).
52793 OR 8 Set bit 3 and write the resulting value to;
Address Door
53614 Door 1
53628 Door 2
53642 Door 3
52795 LD (IX+9),A
52798 LD HL,(52767) Jump to the memory address contained at Chooser_Routine_Buffer.
52801 JP (HL)
Handles choosing one of the initial "default" characters. A character is always chosen here, so this is the end of the choosing routine.
Choose_Default_Set 52802 CALL 56047 Call 56047.
52805 AND 3 Keep only bits 0 and 1 (which determine the type of character).
52807 JR Z,Init_Bandit_Open Determines which character initialisation to run;
A Initialisation Routine
0 Init_Bandit_Open
1 Init_Bowie
2 Init_Customer_Close
3 Init_Customer_Open
52809 DEC A
52810 JP Z,Init_Bowie
52813 DEC A
52814 JP Z,Init_Customer_Close
52817 DEC A
52818 JP Init_Customer_Open
Handles whether or not to choose Julius. Only active on phase 3 and above.
Choose_Julius 52821 CALL Random_Number Call Random_Number.
52824 AND 12 Keep only bits 2 and 3. Jump to the next character "test" if this is a non-zero number at Choose_Bandit_02.
52826 JR NZ,Choose_Bandit_02
52828 JP Init_Julius_Open Jump to Init_Julius_Open.
Handles whether or not to choose Bandit 2. Only active on phase 3 and above.
Choose_Bandit_02 52831 CALL Random_Number Call Random_Number.
52834 AND 152 Keep only bits 3, 4 and 7. Jump to the next character "test" if this is a non-zero number at Choose_Bandit_03.
52836 JR NZ,Choose_Bandit_03
52838 LD HL,53529 Set source character data to 53529.
52841 LD DE,53540 Set target character buffer to 53540.
52844 JP Choose_Action Jump to Choose_Action.
Handles whether or not to choose Bandit 3. Only active on phase 2 and above.
Choose_Bandit_03 52847 CALL Random_Number Call Random_Number.
52850 AND 49 Keep only bits 0, 4 and 5. Jump to the next character "test" if this is a non-zero number then jump back to the Choose_Default_Set.
52852 JR NZ,Choose_Default_Set
52854 LD HL,53441 Set source character data to 53441.
52857 LD DE,53452 Set target character buffer to 53452.
52860 JR Choose_Action Jump to Choose_Action.
Handles whether or not to choose Bandit 4. Only active on phase 4 and above.
Choose_Bandit_04 52862 CALL Random_Number Call Random_Number.
52865 AND 131 Keep only bits 0, 1 and 7. Jump to the next character "test" if this is a non-zero number Choose_Julius.
52867 JR NZ,Choose_Julius
52869 LD HL,53463 Set source character data to 53463.
52872 LD DE,53474 Set target character buffer to 53474.
52875 JR Choose_Action Jump to Choose_Action.
Handles whether or not to choose Bandit 5. Only active on phase 5 and above.
Choose_Bandit_05 52877 CALL Random_Number Call Random_Number.
52880 AND 88 Keep only bits 3, 4 and 6. Jump to the next character "test" if this is a non-zero number Choose_Bandit_04.
52882 JR NZ,Choose_Bandit_04
52884 LD HL,53485 Set source character data to 53485.
52887 LD DE,53496 Set target character buffer to 53496.
52890 JR Choose_Action Jump to Choose_Action.
Handles whether or not to choose Bandit 6. Only active on phase 6 and above.
Choose_Bandit_06 52892 CALL Random_Number Call Random_Number.
52895 AND 113 Keep only bits 0, 4, 5 and 6. Jump to the next character "test" if this is a non-zero number Choose_Bandit_05.
52897 JR NZ,Choose_Bandit_05
52899 LD HL,53507 Set source character data to 53507.
52902 LD DE,53518 Set target character buffer to 53518.
Stashes the chosen character source/ buffer to the door state buffer.
Choose_Action 52905 LD (IX+12),L Writes the character source memory address to one of the following (depending on which door is currently being actioned);
Address Door
Door_Char_Source_01 Door 1
Door_Char_Source_02 Door 2
Door_Char_Source_03 Door 3
52908 LD (IX+13),H
52911 LD (IX+10),E Writes the character target/ buffer memory address to one of the following (depending on which door is currently being actioned);
Address Door
Door_Char_Buffer_01 Door 1
Door_Char_Buffer_02 Door 2
Door_Char_Buffer_03 Door 3
52914 LD (IX+11),D
52917 JP 53273 Jump to 53273.
Prev: 52766 Up: Map Next: 52920