Debian Codegraph @

Descent3/controls.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/controls.h $
21 * $Revision: 36 $
22 * $Date: 10/21/99 6:04p $
23 * $Author: Matt $
24 *
25 * Game controls header
26 *
27 * $Log: /DescentIII/Main/controls.h $
28 *
29 * 36 10/21/99 6:04p Matt
30 * Mac merge
31 *
32 * 35 7/15/99 5:39p Samir
33 * upped max joystick sensitivity to 4.0 from 2.0.
34 *
35 * 34 4/30/99 10:52p Samir
36 * fixed energy-to-shield usage and made Load and Save COnfig take a
37 * pilot.
38 *
39 * 33 4/24/99 6:29p Jason
40 * changed mouse sensitivity
41 *
42 * 32 3/22/99 6:20p Jeff
43 * added 2 more audio taunts. a mulitplayer event when someone plays an
44 * audio taunt. option to disable audio taunts.
45 *
46 * 31 2/26/99 2:13a Samir
47 * added audio taunt keys.
48 *
49 * 30 2/16/99 12:07p Samir
50 * redid controller config with new ui.
51 *
52 * 29 1/13/99 6:37a Jeff
53 * fixed object.h. There were numerous struct declarations that were the
54 * same name as the instance of the struct (gcc doesn't like this).
55 * Changed the struct name. Also added some #ifdef's for linux build,
56 * along with fixing case-sensitive includes
57 *
58 * 28 12/09/98 1:09p Jason
59 * second draft of automap
60 *
61 * 27 12/02/98 11:39a Samir
62 * added better code to handle changes in controller function list for
63 * pilot files (needed to have a constant giving number of controller
64 * functions in demo 1.0)
65 *
66 * 26 11/30/98 4:54p Samir
67 * added rear view config item.
68 *
69 * 25 11/30/98 1:09p Samir
70 * added rear view toggle.
71 *
72 * 24 10/21/98 10:36a Samir
73 * added code to turn on or off joystick or mouse.
74 *
75 * 23 10/08/98 10:52a Samir
76 * added countermeasure and weapon cycling.
77 *
78 * 22 9/17/98 3:24p Samir
79 * added headlight configuration.
80 *
81 * 21 8/31/98 6:49p Jeff
82 * made inventory and countermeasure keys customizable
83 *
84 * 20 8/31/98 12:39p Samir
85 * added code to resume controllers when restoring game mode.
86 *
87 * 19 6/18/98 4:44p Samir
88 * added changes for multiple configs for joystick controls.
89 *
90 * 18 5/19/98 3:36p Samir
91 * added automap key.
92 *
93 * 17 5/12/98 3:04p Samir
94 * added button control for pbh.
95 *
96 * 16 4/27/98 7:24p Samir
97 * poll controller at specified rate.
98 *
99 * 15 4/09/98 2:23p Jason
100 * added guided/afterburner stuff
101 *
102 * 14 4/08/98 3:44p Samir
103 * added toggle bank and configuration for afterburner
104 *
105 * 13 4/02/98 7:58p Samir
106 * Fixed up control setting saving and restoring.
107 *
108 * 12 3/13/98 8:55p Jeff
109 * Various changes to move control configuration into Pilot file
110 *
111 * 11 2/16/98 7:15p Matt
112 * Added fire_secondary_down_state
113 *
114 * 10 2/16/98 3:01p Samir
115 * Added fire_primary_down_state and changed some configuration.
116 *
117 * 9 2/15/98 7:06p Samir
118 * Added functions to save controller state.
119 *
120 * 8 2/12/98 8:48p Matt
121 * Changed controls system to keep the reading of the controls seperate
122 * from using the results. Got rid of the Controls global.
123 *
124 * 7 1/12/98 6:28p Samir
125 * New keys for sliding and use RCTRL for firing too.
126 *
127 * 6 12/05/97 10:59a Samir
128 * Somewhat revised controls for keyboard. Joystick now has variable
129 * sensitivity.
130 *
131 * 5 12/03/97 7:32p Samir
132 * More D2 like keyboard movement.
133 *
134 * 4 11/05/97 3:45p Samir
135 * InitControls will close the previous call to InitControls.
136 *
137 * 3 10/30/97 4:02p Matt
138 * Added the flare
139 *
140 * 2 8/29/97 1:49p Samir
141 * Added toggliing slide.
142 *
143 * 8 4/24/97 12:10p Samir
144 * Added weapon firing for primary and secondary weapons.
145 *
146 * 7 4/23/97 1:06p Samir
147 * Implemented Suspend and Resume Controls as well as newer control system
148 *
149 * 6 4/17/97 2:48p Samir
150 * ReadFlyingControls renamed from read_flying_controls to match naming
151 * convention rules.
152 *
153 * 5 4/16/97 1:03p Samir
154 * Added fire primary button information
155 *
156 * 4 4/14/97 3:29p Samir
157 * Implemented game controls structure.
158 *
159 * 3 4/14/97 12:55p Samir
160 * Added primary fire button
161 *
162 * 2 4/11/97 2:15p Samir
163 * game controls functions defined for movement.
164 *
165 * $NoKeywords: $
166 */
167
168 #ifndef CONTROLS_H
169 #define CONTROLS_Hcxx . . $ `Descent3/controls.h:169:9`!
170
171 #include "object.h"cxx . . $ `<file>/Descent3/object.h`/
172 #include "Controller.h"cxx . . $ `<file>/lib/Controller.h`/
173
174 class gameControllercxx . . $ gameController#;
175 class pilotcxx . . $ pilot#;
176
177 #define READF_MOUSEcxx . . $ `Descent3/controls.h:177:9`! 0x2
178 #define READF_JOYcxx . . $ `Descent3/controls.h:178:9`! 0x1
179 #define JOY_AXIS_SENS_RANGEcxx . . $ `Descent3/controls.h:179:9`! 4.0f
180 #define MSE_AXIS_SENS_RANGEcxx . . $ `Descent3/controls.h:180:9`! 4.0f
181
182 // used to set or get axis sensitivity
183 #define HEADING_AXIScxx . . $ `Descent3/controls.h:183:9`! 0
184 #define PITCH_AXIScxx . . $ `Descent3/controls.h:184:9`! 1
185 #define BANK_AXIScxx . . $ `Descent3/controls.h:185:9`! 2
186 #define HORIZONTAL_AXIScxx . . $ `Descent3/controls.h:186:9`! 3
187 #define VERTICAL_AXIScxx . . $ `Descent3/controls.h:187:9`! 4
188 #define THROTTLE_AXIScxx . . $ `Descent3/controls.h:188:9`! 5
189
190 // Controller functions
191 const int NUM_CTLFUNCS_DEMOv1_0cxx . . $ NUM_CTLFUNCS_DEMOv1_0. = 63;
192 const int NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS. = 73;
193
194 const int ctfFORWARD_THRUSTAXIScxx . . $ ctfFORWARD_THRUSTAXIS. = 0, ctfFORWARD_THRUSTKEYcxx . . $ ctfFORWARD_THRUSTKEY. = 1, ctfREVERSE_THRUSTKEYcxx . . $ ctfREVERSE_THRUSTKEY. = 2, ctfUP_THRUSTAXIScxx . . $ ctfUP_THRUSTAXIS. = 3,
195 ctfUP_THRUSTKEYcxx . . $ ctfUP_THRUSTKEY. = 4, ctfDOWN_THRUSTKEYcxx . . $ ctfDOWN_THRUSTKEY. = 5, ctfRIGHT_THRUSTAXIScxx . . $ ctfRIGHT_THRUSTAXIS. = 6, ctfRIGHT_THRUSTKEYcxx . . $ ctfRIGHT_THRUSTKEY. = 7,
196 ctfLEFT_THRUSTKEYcxx . . $ ctfLEFT_THRUSTKEY. = 8, ctfPITCH_DOWNAXIScxx . . $ ctfPITCH_DOWNAXIS. = 9, ctfPITCH_DOWNKEYcxx . . $ ctfPITCH_DOWNKEY. = 10, ctfPITCH_UPKEYcxx . . $ ctfPITCH_UPKEY. = 11,
197 ctfBANK_RIGHTAXIScxx . . $ ctfBANK_RIGHTAXIS. = 12, ctfBANK_RIGHTKEYcxx . . $ ctfBANK_RIGHTKEY. = 13, ctfBANK_LEFTKEYcxx . . $ ctfBANK_LEFTKEY. = 14, ctfHEADING_RIGHTAXIScxx . . $ ctfHEADING_RIGHTAXIS. = 15,
198 ctfHEADING_RIGHTKEYcxx . . $ ctfHEADING_RIGHTKEY. = 16, ctfHEADING_LEFTKEYcxx . . $ ctfHEADING_LEFTKEY. = 17, ctfFIREPRIMARY_BUTTONcxx . . $ ctfFIREPRIMARY_BUTTON. = 18, ctfFIREPRIMARY_KEYcxx . . $ ctfFIREPRIMARY_KEY. = 19,
199 ctfFIREPRIMARY_KEY2cxx . . $ ctfFIREPRIMARY_KEY2. = 20, ctfFIRESECONDARY_BUTTONcxx . . $ ctfFIRESECONDARY_BUTTON. = 21, ctfFIRESECONDARY_KEYcxx . . $ ctfFIRESECONDARY_KEY. = 22, ctfTOGGLE_SLIDEKEYcxx . . $ ctfTOGGLE_SLIDEKEY. = 23,
200 ctfTOGGLE_SLIDEBUTTONcxx . . $ ctfTOGGLE_SLIDEBUTTON. = 24, ctfFIREFLARE_KEYcxx . . $ ctfFIREFLARE_KEY. = 25, ctfFIREFLARE_BUTTONcxx . . $ ctfFIREFLARE_BUTTON. = 26, ctfUP_BUTTONcxx . . $ ctfUP_BUTTON. = 27,
201 ctfDOWN_BUTTONcxx . . $ ctfDOWN_BUTTON. = 28, ctfLEFT_BUTTONcxx . . $ ctfLEFT_BUTTON. = 29, ctfRIGHT_BUTTONcxx . . $ ctfRIGHT_BUTTON. = 30, ctfAFTERBURN_KEYcxx . . $ ctfAFTERBURN_KEY. = 31,
202 ctfAFTERBURN_BUTTONcxx . . $ ctfAFTERBURN_BUTTON. = 32, ctfFORWARD_BUTTONcxx . . $ ctfFORWARD_BUTTON. = 33, ctfREVERSE_BUTTONcxx . . $ ctfREVERSE_BUTTON. = 34, ctfTOGGLE_BANKKEYcxx . . $ ctfTOGGLE_BANKKEY. = 35,
203 ctfTOGGLE_BANKBUTTONcxx . . $ ctfTOGGLE_BANKBUTTON. = 36, ctfHEADING_LEFTBUTTONcxx . . $ ctfHEADING_LEFTBUTTON. = 37, ctfHEADING_RIGHTBUTTONcxx . . $ ctfHEADING_RIGHTBUTTON. = 38, ctfPITCH_UPBUTTONcxx . . $ ctfPITCH_UPBUTTON. = 39,
204 ctfPITCH_DOWNBUTTONcxx . . $ ctfPITCH_DOWNBUTTON. = 40, ctfBANK_LEFTBUTTONcxx . . $ ctfBANK_LEFTBUTTON. = 41, ctfBANK_RIGHTBUTTONcxx . . $ ctfBANK_RIGHTBUTTON. = 42, ctfAUTOMAP_KEYcxx . . $ ctfAUTOMAP_KEY. = 43,
205 ctfPREV_INVKEYcxx . . $ ctfPREV_INVKEY. = 44, ctfNEXT_INVKEYcxx . . $ ctfNEXT_INVKEY. = 45, ctfINV_USEKEYcxx . . $ ctfINV_USEKEY. = 46, ctfPREV_CNTMSKEYcxx . . $ ctfPREV_CNTMSKEY. = 47, ctfNEXT_CNTMSKEYcxx . . $ ctfNEXT_CNTMSKEY. = 48,
206 ctfCNTMS_USEKEYcxx . . $ ctfCNTMS_USEKEY. = 49, ctfHEADLIGHT_KEYcxx . . $ ctfHEADLIGHT_KEY. = 50, ctfHEADLIGHT_BUTTONcxx . . $ ctfHEADLIGHT_BUTTON. = 51, ctfAUTOMAP_BUTTONcxx . . $ ctfAUTOMAP_BUTTON. = 52,
207 ctfPREV_INVBTNcxx . . $ ctfPREV_INVBTN. = 53, ctfNEXT_INVBTNcxx . . $ ctfNEXT_INVBTN. = 54, ctfINV_USEBTNcxx . . $ ctfINV_USEBTN. = 55, ctfPREV_CNTMSBTNcxx . . $ ctfPREV_CNTMSBTN. = 56, ctfNEXT_CNTMSBTNcxx . . $ ctfNEXT_CNTMSBTN. = 57,
208 ctfCNTMS_USEBTNcxx . . $ ctfCNTMS_USEBTN. = 58, ctfWPNSEL_PCYCLEKEYcxx . . $ ctfWPNSEL_PCYCLEKEY. = 59, ctfWPNSEL_PCYCLEBTNcxx . . $ ctfWPNSEL_PCYCLEBTN. = 60, ctfWPNSEL_SCYCLEKEYcxx . . $ ctfWPNSEL_SCYCLEKEY. = 61,
209 ctfWPNSEL_SCYCLEBTNcxx . . $ ctfWPNSEL_SCYCLEBTN. = 62, ctfREARVIEW_KEYcxx . . $ ctfREARVIEW_KEY. = 63, ctfREARVIEW_BTNcxx . . $ ctfREARVIEW_BTN. = 64, ctfAUDIOTAUNT1_KEYcxx . . $ ctfAUDIOTAUNT1_KEY. = 65,
210 ctfAUDIOTAUNT1_BTNcxx . . $ ctfAUDIOTAUNT1_BTN. = 66, ctfAUDIOTAUNT2_KEYcxx . . $ ctfAUDIOTAUNT2_KEY. = 67, ctfAUDIOTAUNT2_BTNcxx . . $ ctfAUDIOTAUNT2_BTN. = 68, ctfAUDIOTAUNT3_KEYcxx . . $ ctfAUDIOTAUNT3_KEY. = 69,
211 ctfAUDIOTAUNT3_BTNcxx . . $ ctfAUDIOTAUNT3_BTN. = 70, ctfAUDIOTAUNT4_KEYcxx . . $ ctfAUDIOTAUNT4_KEY. = 71, ctfAUDIOTAUNT4_BTNcxx . . $ ctfAUDIOTAUNT4_BTN. = 72;
212
213 struct game_controlscxx . . $ game_controls# {
214 // movement values
215 // these values are from -1.0 to 1.0.-
216 float pitch_thrustcxx . . $ game_controls#pitch_thrust.;
217 float heading_thrustcxx . . $ game_controls#heading_thrust.;
218 float bank_thrustcxx . . $ game_controls#bank_thrust.;
219 float vertical_thrustcxx . . $ game_controls#vertical_thrust.;
220 float sideways_thrustcxx . . $ game_controls#sideways_thrust.;
221 float forward_thrustcxx . . $ game_controls#forward_thrust.;
222 float afterburn_thrustcxx . . $ game_controls#afterburn_thrust.;
223
224 // these values modify thrust
225 bool toggle_slidecxx . . $ game_controls#toggle_slide.;
226 bool toggle_bankcxx . . $ game_controls#toggle_bank.;
227
228 // this is for weapon control
229 int fire_primary_down_countcxx . . $ game_controls#fire_primary_down_count.;
230 bool fire_primary_down_statecxx . . $ game_controls#fire_primary_down_state.;
231 float fire_primary_down_timecxx . . $ game_controls#fire_primary_down_time.;
232 int fire_secondary_down_countcxx . . $ game_controls#fire_secondary_down_count.;
233 bool fire_secondary_down_statecxx . . $ game_controls#fire_secondary_down_state.;
234 float fire_secondary_down_timecxx . . $ game_controls#fire_secondary_down_time.;
235
236 // The flare
237 int fire_flare_down_countcxx . . $ game_controls#fire_flare_down_count.;
238 int rearview_down_countcxx . . $ game_controls#rearview_down_count.;
239 bool rearview_down_statecxx . . $ game_controls#rearview_down_state.;
240 };
241
242 // This value should be set at initialization time. Use for remote controlling.
243 extern char *Controller_ipcxx . . $ Controller_ip.;
244
245 // Controller object.
246 extern gameControllercxx . . $ gameController# *Controllercxx . . $ Controller.;
247
248 // determines if controller is being polled.
249 extern bool Control_poll_flagcxx . . $ Control_poll_flag.;
250
251 //
252 extern ct_functioncxx . . $ ct_function# Controller_needscxx . . $ Controller_needs.[NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS.];
253
254 // initializes control system
255 void InitControlscxx . . $ InitControls(49f6e7a06ebc5aa8).();
256 void CloseControlscxx . . $ CloseControls(49f6e7a06ebc5aa8).();
257
258 // polls controller at a certain framerate.
259 void PollControlscxx . . $ PollControls(49f6e7a06ebc5aa8).();
260
261 // suspends and or resumes the control system. this deactivates or reactivates any
262 // preemptive controller polling we setup.
263 void SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).();
264 void ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).();
265
266 // Read the keyboard & other controllers. Fills in the specified structure.
267 void ReadPlayerControlscxx . . $ ReadPlayerControls(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls);
268
269 // reinits the controller, hence restoring default controller configurations
270 void RestoreDefaultControlscxx . . $ RestoreDefaultControls(49f6e7a06ebc5aa8).();
271
272 // load in controller configurations
273 void LoadControlConfigcxx . . $ LoadControlConfig(1794bc617d3f3266).(pilotcxx . . $ pilot# *plt = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
274
275 // save controller configurations.
276 void SaveControlConfigcxx . . $ SaveControlConfig(1794bc617d3f3266).(pilotcxx . . $ pilot# *plt = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
277
278 // Reads movement only
279 void DoMovementcxx . . $ DoMovement(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls);
280
281 #endif