Prev: 63873 Up: Map Next: 64168
63935: Change Controls
Used by the routine at SelectionScreen.
ChangeControls 63935 CALL GetKeypress Call GetKeypress.
63938 JR NZ,ChangeControls Loop back to ChangeControls until a key is pressed.
Reset the control type for all monsters.
63940 LD A,255 Write 255 to:
63942 LD (53216),A
63945 LD (53263),A
63948 LD (53310),A
Set up a count for how many players will be using the keyboard (see ChangeControls_Keyboard).
63951 LD A,3 Write 3 to *Keyboard_Control_Count.
63953 LD (64346),A
Create a "change controls" page for George:
controls-george
63956 CALL CreateAdminPageTemplate Call CreateAdminPageTemplate.
63959 LD HL,53343 HL=Messaging_George.
63962 LD IX,53202 IX=George_State.
63966 CALL ChangeControls_Action Call ChangeControls_Action.
Create a "change controls" page for Lizzy.
controls-lizzy
63969 CALL CreateAdminPageTemplate Call CreateAdminPageTemplate.
63972 LD IX,53249 IX=Lizzy_State.
63976 LD HL,53357 HL=Messaging_Lizzy.
63979 CALL ChangeControls_Action Call ChangeControls_Action.
Create a "change controls" page for Ralph.
controls-ralph
63982 CALL CreateAdminPageTemplate Call CreateAdminPageTemplate.
63985 LD IX,53296 IX=Ralph_State.
63989 LD HL,53371 HL=Messaging_Ralph.
63992 CALL ChangeControls_Action Call ChangeControls_Action.
63995 RET Return.
Print the monster name.
ChangeControls_Action 63996 LD BC,2052 BC=2052 (screen co-ordinates).
63999 CALL PrintString Call PrintString.
Prints "SELECT THE CONTROLS FOR".
64002 LD HL,53461 HL=Messaging_ChangeControls.
64005 LD BC,771 BC=771 (screen co-ordinates).
64008 CALL PrintString Call PrintString.
64011 INC HL Move onto the start of the next message.
64012 LD BC,1282 BC=1282 (screen co-ordinates).
64015 CALL PrintString Call PrintString.
Programmatically display all the Messaging_ChooseControls options.
64018 LD HL,53555 HL=Messaging_ChooseControls.
64021 XOR A A=0 (option counter).
ChangeControls_PrintLoop 64022 PUSH AF Stash the option counter on the stack.
The options are two lines apart and start from row 11.
64023 ADD A,A B=11+A*2.
64024 ADD A,11
64026 LD B,A
64027 LD C,1 C=1 (screen co-ordinates).
64029 CALL PrintString Call PrintString.
64032 INC HL Move onto the start of the next message.
64033 POP AF Restore the option counter from the stack.
64034 INC A Increment the option counter by one.
Note we only show five options "N - NO MONSTER" is never used.
64035 CP 5 Jump to ChangeControls_PrintLoop until the option counter is equal to 5.
64037 JR NZ,ChangeControls_PrintLoop
Prints the last line manually " CONTROLLED" (as it's the second line of the option before it).
64039 LD BC,5121 BC=5121 (screen co-ordinates).
64042 CALL PrintString Call PrintString.
Output to the screen buffer.
64045 CALL ScreenBuffer_Update Call ScreenBuffer_Update.
64048 CALL AttributeBuffer_Update Call AttributeBuffer_Update.
ChangeControls_Input 64051 CALL ChooseControlType Call ChooseControlType.
64054 JR NZ,ChangeControls_Input Loop back to ChangeControls_Input until an option has been selected.
Process the selected option.
64056 LD A,D A=control option.
64057 CP 255 Jump to ChangeControls_Input if the control option is invalid.
64059 JR Z,ChangeControls_Input
64061 CP 17 Jump to ChangeControls_Keyboard if "K" was pressed.
64063 JR Z,ChangeControls_Keyboard
64065 CP 36 Jump to ChangeControls_Sinclair1 if "1" was pressed.
64067 JR Z,ChangeControls_Sinclair1
64069 CP 28 Jump to ChangeControls_Sinclair2 if "2" was pressed.
64071 JR Z,ChangeControls_Sinclair2
64073 CP 20 Jump to ChangeControls_Kempston if "3" was pressed.
64075 JR Z,ChangeControls_Kempston
64077 CP 15 Jump to ChangeControls_Computer if "C" was pressed.
64079 JR Z,ChangeControls_Computer
64081 JR ChangeControls_Input Jump to ChangeControls_Input.
Set "Keyboard" as the control method.
ChangeControls_Keyboard 64083 CALL UserDefinedKeys Call UserDefinedKeys.
Each set of user defined keys will have a different control method ID starting from 4.
64086 LD A,(64346) A=*Keyboard_Control_Count.
64089 INC A Increment A by one.
64090 LD (64346),A Write A to *Keyboard_Control_Count.
64093 LD (IX+14),A Write A to *IX+14 (monster control type).
Calculate where the user defined keys will be stored.
64096 SUB 4 A-=4.
64098 ADD A,A A*=2.
64099 LD D,A D=A.
64100 ADD A,A A*=4.
64101 ADD A,A
64102 ADD A,D A+=D.
64103 LD H,0 Create an offset using HL.
64105 LD L,A
64106 LD DE,51280 HL+=UserDefinedKeys_Set1.
64109 ADD HL,DE
64110 EX DE,HL Exchange the DE and HL registers.
64111 LD HL,64334 HL=UserDefinedKeys_Buffer.
64114 LD BC,10 BC=0010.
64117 LDIR Copy selected keys to monster config.
64119 RET Return.
Set "Sinclair Interface 2" (port 1) as the control method.
ChangeControls_Sinclair1 64120 LD D,2 D=2.
64122 JR SetControlType Jump to SetControlType.
Set "Sinclair Interface 2" (port 2) as the control method.
ChangeControls_Sinclair2 64124 LD D,1 D=1.
64126 JR SetControlType Jump to SetControlType.
Set "Kempston Joystick" as the control method.
ChangeControls_Kempston 64128 LD D,3 D=3.
SetControlType 64130 CALL CheckExistingControls Call CheckExistingControls.
64133 JR Z,ChangeControls_Input Jump to ChangeControls_Input if the control type is already selected by another monster.
64135 LD (IX+14),D Write the control type to *IX+14 (monster control type).
64138 RET Return.
Set "Computer Controlled" as the control method.
ChangeControls_Computer 64139 LD (IX+14),0 Write 0 to *IX+14 (monster control type).
ChangeControls_Computer_KeyPress 64143 CALL GetKeypress Call GetKeypress.
64146 JR NZ,ChangeControls_Computer_KeyPress Loop back to ChangeControls_Computer_KeyPress until a key has been pressed.
64148 RET Return.
Monsters can't use the same controllers, this is verified here.
CheckExistingControls 64149 LD A,(53216) Return if *George_Control_Type is equal to the currently selected control method.
64152 CP D
64153 RET Z
64154 LD A,(53263) Return if *Lizzy_Control_Type is equal to the currently selected control method.
64157 CP D
64158 RET Z
64159 LD A,(53310) Return if *Ralph_Control_Type is equal to the currently selected control method.
64162 CP D
64163 RET Z
Ensure ZERO flag is not set for the return.
64164 LD A,1 A=1.
64166 OR A Set the bits from A.
64167 RET Return.
Prev: 63873 Up: Map Next: 64168