| 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.cpp $ |
| 21 | * $Revision: 106 $ |
| 22 | * $Date: 4/19/00 5:28p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Game controls processor |
| 26 | * |
| 27 | * $Log: /DescentIII/main/Controls.cpp $ |
| 28 | * |
| 29 | * 106 4/19/00 5:28p Matt |
| 30 | * From Duane for 1.4 |
| 31 | * Changed "ifdef Mac" to "ifndef Mac" |
| 32 | * |
| 33 | * 105 3/20/00 12:03p Matt |
| 34 | * Merge of Duane's post-1.3 changes. |
| 35 | * Misc Mac controller stuff (Mac only) |
| 36 | * |
| 37 | * 104 1/25/00 12:11a Jason |
| 38 | * Fixed keyboard ramping that got commented out during a mac merge. |
| 39 | * |
| 40 | * 103 10/22/99 1:16p Matt |
| 41 | * Fixed bug from previous integration. |
| 42 | * |
| 43 | * 102 10/22/99 1:12p Matt |
| 44 | * Mac merge |
| 45 | * |
| 46 | * 101 10/22/99 12:50p Matt |
| 47 | * Restored whitespace removed in version 99, and changed the controller |
| 48 | * table to its version 1.0 state. (This actually removes all the changes |
| 49 | * made for version 99.) |
| 50 | * |
| 51 | * 100 8/11/99 6:06p Samir |
| 52 | * mouse invert toggle slide functional. |
| 53 | * |
| 54 | * 99 7/28/99 4:20p Kevin |
| 55 | * Mac |
| 56 | * |
| 57 | * 98 7/20/99 4:53p Samir |
| 58 | * added ability to manually set the deadzone for a controller. |
| 59 | * |
| 60 | * 97 7/16/99 11:16a Samir |
| 61 | * fixed afterburner thrust clipping bug. |
| 62 | * |
| 63 | * 96 5/10/99 9:25p Jeff |
| 64 | * first phase of Rock 'n' Ride support added |
| 65 | * |
| 66 | * 95 4/30/99 10:52p Samir |
| 67 | * fixed energy-to-shield usage and made Load and Save COnfig take a |
| 68 | * pilot. |
| 69 | * |
| 70 | * 94 4/24/99 6:44p Jeff |
| 71 | * added functions for theif so he can steal things other than weapons |
| 72 | * |
| 73 | * 93 4/14/99 2:50a Jeff |
| 74 | * fixed some case mismatched #includes |
| 75 | * |
| 76 | * 92 4/01/99 11:27a Samir |
| 77 | * added default mouse button bindings. |
| 78 | * |
| 79 | * 91 3/25/99 9:57a Kevin |
| 80 | * Fixed the way toggle slide works |
| 81 | * |
| 82 | * 90 3/22/99 6:20p Jeff |
| 83 | * added 2 more audio taunts. a mulitplayer event when someone plays an |
| 84 | * audio taunt. option to disable audio taunts. |
| 85 | * |
| 86 | * 89 3/05/99 5:23p Samir |
| 87 | * joystick button audio taunt control fixed. |
| 88 | * |
| 89 | * 88 3/05/99 2:44p Samir |
| 90 | * needs to be cleaned up later, but mouse and joystick sensitivities are |
| 91 | * read in always, and set by the controller system. A cancel method |
| 92 | * needs to be implemented for these functions. |
| 93 | * |
| 94 | * 87 3/04/99 8:07p Samir |
| 95 | * pre assignment of r axis enabled once again. |
| 96 | * |
| 97 | * 86 3/01/99 12:19a Samir |
| 98 | * mask controller states on create controller. |
| 99 | * |
| 100 | * 85 2/26/99 2:13a Samir |
| 101 | * added audio taunt keys. |
| 102 | * |
| 103 | * 84 2/23/99 7:33p Samir |
| 104 | * don't configure bank through joystick by default. |
| 105 | * |
| 106 | * 83 2/23/99 2:00p Samir |
| 107 | * added keyboard ramping slider. |
| 108 | * |
| 109 | * 82 2/15/99 7:48p Jeff |
| 110 | * new pilot file class and read/write system checked in...should be more |
| 111 | * robust than old |
| 112 | * |
| 113 | * 81 2/09/99 1:28a Jeff |
| 114 | * added code to let D3 process multiplayer games in the background if |
| 115 | * game is not in focus. |
| 116 | * |
| 117 | * 80 2/06/99 6:58p Jeff |
| 118 | * removed mprintf for suspend/resume (annoying in automap) |
| 119 | * |
| 120 | * 79 2/04/99 4:22p Jeff |
| 121 | * put in sanity mprintf's in suspend/resume controls |
| 122 | * |
| 123 | * 78 1/31/99 7:25p Matt |
| 124 | * Renamed a bunch of functions to have HUD capitalized |
| 125 | * |
| 126 | * 77 1/28/99 3:58p Jeff |
| 127 | * localization update |
| 128 | * |
| 129 | * 76 1/06/99 6:45p Kevin |
| 130 | * |
| 131 | * 75 12/14/98 11:06a Jason |
| 132 | * changes for 1.1 |
| 133 | * |
| 134 | * 74 12/08/98 10:27a Samir |
| 135 | * default player controls include mouse controls. |
| 136 | * |
| 137 | * 73 12/07/98 5:37p Jason |
| 138 | * first pass at automap |
| 139 | * |
| 140 | * 72 12/03/98 11:06a Samir |
| 141 | * added axis sensitivity |
| 142 | * |
| 143 | * 71 12/02/98 7:02p Samir |
| 144 | * reduces key pitch and heading ramp times. |
| 145 | * |
| 146 | * 70 12/02/98 12:23p Samir |
| 147 | * fixed behavior of bank and slide toggles so they are read before both |
| 148 | * keyboard and joystick. |
| 149 | * |
| 150 | * 69 12/02/98 11:37a Samir |
| 151 | * improved ramping of keyboard. |
| 152 | * |
| 153 | * 68 11/30/98 4:56p Samir |
| 154 | * oops. took out mprintf. |
| 155 | * |
| 156 | * 67 11/30/98 4:54p Samir |
| 157 | * added rear view config item. |
| 158 | * |
| 159 | * 66 11/30/98 1:09p Samir |
| 160 | * added rear view toggle. |
| 161 | * |
| 162 | * 65 10/24/98 2:16p Samir |
| 163 | * moved pollcontrols to controls.cpp, readplayercontrols. |
| 164 | * |
| 165 | * 64 10/22/98 4:11p Samir |
| 166 | * put inventory keys back in. |
| 167 | * |
| 168 | * 63 10/22/98 2:40p Samir |
| 169 | * took out inventory keys for demo. |
| 170 | * |
| 171 | * 62 10/21/98 11:55p Samir |
| 172 | * added sensitivity slider functionality. |
| 173 | * |
| 174 | * 61 10/21/98 7:03p Samir |
| 175 | * D2 Default controls |
| 176 | * |
| 177 | * 60 10/21/98 10:36a Samir |
| 178 | * added code to turn on or off joystick or mouse. |
| 179 | * |
| 180 | * 59 10/18/98 7:24p Samir |
| 181 | * cycle down weapons, use Frametime for controller buttons. |
| 182 | * |
| 183 | * 58 10/17/98 7:32p Samir |
| 184 | * added to controller needs, the extra flags section per function. |
| 185 | * |
| 186 | * 57 10/14/98 1:02p Jason |
| 187 | * fixed FindSoundName issues |
| 188 | * |
| 189 | * 56 10/12/98 5:12p Samir |
| 190 | * toggle bank key works. |
| 191 | * |
| 192 | * 55 10/11/98 2:58a Jeff |
| 193 | * hooked in Automap key |
| 194 | * |
| 195 | * 54 10/08/98 6:43p Samir |
| 196 | * took out mprintf. |
| 197 | * |
| 198 | * 53 10/08/98 1:24p Samir |
| 199 | * use ramping technique for keyboard pitch and heading. |
| 200 | * |
| 201 | * 52 10/08/98 10:52a Samir |
| 202 | * added countermeasure and weapon cycling. |
| 203 | * |
| 204 | * 51 9/28/98 10:07a Jason |
| 205 | * fixed MISC keyboard input while inputting messages |
| 206 | * |
| 207 | * 50 9/21/98 3:21p Jason |
| 208 | * bound headlight to a key |
| 209 | * |
| 210 | * 49 9/17/98 3:24p Samir |
| 211 | * added headlight configuration. |
| 212 | * |
| 213 | * 48 9/01/98 5:11p Samir |
| 214 | * no additvie afterburner control. |
| 215 | * |
| 216 | * 47 8/31/98 6:49p Jeff |
| 217 | * made inventory and countermeasure keys customizable |
| 218 | * |
| 219 | * 46 8/31/98 12:39p Samir |
| 220 | * added code to resume controllers when restoring game mode. |
| 221 | * |
| 222 | * 45 8/15/98 2:45p Matt |
| 223 | * Took out unneeded include |
| 224 | * |
| 225 | * 44 6/29/98 7:17p Samir |
| 226 | * took out annoying mprintf |
| 227 | * |
| 228 | * 43 6/29/98 6:42p Samir |
| 229 | * Properly handle controller pausing and resumption. |
| 230 | * |
| 231 | * 42 6/18/98 4:44p Samir |
| 232 | * added changes for multiple configs for joystick controls. |
| 233 | * |
| 234 | * 41 6/16/98 10:38a Jeff |
| 235 | * localization, strings pulled out to stringtable.h and d3.str |
| 236 | * |
| 237 | * 40 5/28/98 1:08p Samir |
| 238 | * flipped bank button calcs. |
| 239 | * |
| 240 | * 39 5/26/98 7:09p Samir |
| 241 | * pitch now 75% of maximum instead of 50% as asked by Chris and Craig. |
| 242 | * |
| 243 | * 38 5/19/98 3:36p Samir |
| 244 | * added automap key. |
| 245 | * |
| 246 | * 37 5/12/98 3:04p Samir |
| 247 | * added button control for pbh. |
| 248 | * |
| 249 | * 36 5/12/98 10:38a Samir |
| 250 | * pitch rate halved. |
| 251 | * |
| 252 | * 35 5/11/98 4:53p Samir |
| 253 | * added axis sliding, config. |
| 254 | * |
| 255 | * 34 5/01/98 3:52p Samir |
| 256 | * fixed up hat and keyboard sliding. |
| 257 | * |
| 258 | * 33 4/30/98 7:00p Samir |
| 259 | * reset afterburner thrust every frame. |
| 260 | * |
| 261 | * 32 4/28/98 11:45a Samir |
| 262 | * make keyboard controls match to framerate. |
| 263 | * |
| 264 | * 31 4/27/98 7:24p Samir |
| 265 | * poll controller at specified rate. |
| 266 | * |
| 267 | * 30 4/09/98 2:22p Jason |
| 268 | * added guided/afterburner stuff |
| 269 | * |
| 270 | * 29 4/08/98 3:44p Samir |
| 271 | * added toggle bank and configuration for afterburner |
| 272 | * |
| 273 | * 28 4/02/98 7:58p Samir |
| 274 | * Fixed up control setting saving and restoring. |
| 275 | * |
| 276 | * 27 3/24/98 11:21a Samir |
| 277 | * adjusted key sensitivity. |
| 278 | * |
| 279 | * 26 3/20/98 1:19p Jeff |
| 280 | * Changes made to use Default_pilot string for pilot filename to use. |
| 281 | * |
| 282 | * 25 3/16/98 3:53p Jason |
| 283 | * added hud input message stuff |
| 284 | * |
| 285 | * 24 3/16/98 3:26p Samir |
| 286 | * Fixed controller need ID and index discrepancy. |
| 287 | * |
| 288 | * 23 3/16/98 11:03a Luke |
| 289 | * Don't reset controls again., |
| 290 | * |
| 291 | * 22 3/13/98 8:55p Jeff |
| 292 | * Various changes to move control configuration into Pilot file |
| 293 | * |
| 294 | * 21 3/10/98 5:21p Samir |
| 295 | * banking should be proper. |
| 296 | * |
| 297 | * 20 3/02/98 5:54p Samir |
| 298 | * Don't run any controls if not in game interface mode. |
| 299 | * |
| 300 | * 19 2/16/98 9:27p Samir |
| 301 | * Added banking. |
| 302 | * |
| 303 | * 18 2/16/98 3:01p Samir |
| 304 | * Added fire_primary_down_state and changed some configuration. |
| 305 | * |
| 306 | * 17 2/15/98 7:06p Samir |
| 307 | * Added functions to save controller state. |
| 308 | * |
| 309 | * 16 2/12/98 8:48p Matt |
| 310 | * Changed controls system to keep the reading of the controls seperate |
| 311 | * from using the results. Got rid of the Controls global. |
| 312 | * |
| 313 | * 15 1/23/98 6:25p Jason |
| 314 | * Got spray weapons working |
| 315 | * |
| 316 | * 14 1/12/98 6:28p Samir |
| 317 | * New keys for sliding and use RCTRL for firing too. |
| 318 | * |
| 319 | * 13 12/10/97 12:18p Samir |
| 320 | * Tooke oute annoiing printe Fs. |
| 321 | * |
| 322 | * 12 12/10/97 11:16a Samir |
| 323 | * Joystick button timing should be fixed. |
| 324 | * |
| 325 | * 11 12/05/97 12:49p Samir |
| 326 | * Much better hat sliding. |
| 327 | * |
| 328 | * 10 12/05/97 10:59a Samir |
| 329 | * Somewhat revised controls for keyboard. Joystick now has variable |
| 330 | * sensitivity. |
| 331 | * |
| 332 | * 9 12/03/97 7:32p Samir |
| 333 | * More D2 like keyboard movement. |
| 334 | * |
| 335 | * 8 11/12/97 1:13p Jason |
| 336 | * added weapons that can ramp up |
| 337 | * |
| 338 | * 7 11/05/97 3:45p Samir |
| 339 | * InitControls will close the previous call to InitControls. |
| 340 | * |
| 341 | * 6 11/04/97 4:20p Samir |
| 342 | * replaced ctDigital with ctDownCount in some joystick button functions. |
| 343 | * |
| 344 | * 5 10/30/97 4:02p Matt |
| 345 | * Added the flare |
| 346 | * |
| 347 | * 4 9/04/97 4:01p Samir |
| 348 | * This should fix slide toggling with joystick. |
| 349 | * |
| 350 | * 3 8/29/97 1:49p Samir |
| 351 | * Added toggling slide. |
| 352 | * |
| 353 | * 2 8/20/97 5:03p Samir |
| 354 | * Fixed banking controls. |
| 355 | * |
| 356 | * 24 5/21/97 3:53p Samir |
| 357 | * changed ct_need to ct_function. |
| 358 | * |
| 359 | * 23 5/12/97 1:22p Samir |
| 360 | * Don't use timer hook functions anymore. taken care of in controller |
| 361 | * library. |
| 362 | * |
| 363 | * 22 4/24/97 2:09p Samir |
| 364 | * Fixed firing key problems. |
| 365 | * |
| 366 | * 21 4/24/97 12:32p Samir |
| 367 | * Fixed booboo in controls structure. |
| 368 | * |
| 369 | * 20 4/24/97 12:10p Samir |
| 370 | * Added weapon firing for primary and secondary weapons. |
| 371 | * |
| 372 | * 19 4/23/97 1:06p Samir |
| 373 | * Implemented Suspend and Resume Controls as well as newer control system |
| 374 | * |
| 375 | * 18 4/17/97 2:48p Samir |
| 376 | * ReadFlyingControls renamed from read_flying_controls to match naming |
| 377 | * convention rules. |
| 378 | * |
| 379 | * 17 4/16/97 3:28p Samir |
| 380 | * Poll twice for better keeping track of buttons. Should find a lot |
| 381 | * better way of doing this. |
| 382 | * |
| 383 | * 16 4/16/97 1:03p Samir |
| 384 | * Added fire primary button information |
| 385 | * |
| 386 | * 15 4/14/97 3:29p Samir |
| 387 | * Implemented game controls structure. |
| 388 | * |
| 389 | * 14 4/14/97 12:55p Samir |
| 390 | * Added primary fire button |
| 391 | * |
| 392 | * 13 4/11/97 5:11p Samir |
| 393 | * Added external controller throttle control. |
| 394 | * |
| 395 | * 12 4/11/97 4:54p Samir |
| 396 | * Fixed joystick pitch translation (invert for real flight stick control) |
| 397 | * |
| 398 | * 11 4/11/97 4:09 PM Jeremy |
| 399 | * changed include of "stdlib.h" to <stdlib.h> |
| 400 | * |
| 401 | * 10 4/11/97 2:14p Samir |
| 402 | * Revamped input of controller data. |
| 403 | * |
| 404 | * $NoKeywords: $ |
| 405 | */ |
| 406 | |
| 407 | #include "controls.h"cxx . . $ `<file>/Descent3/controls.h`/ |
| 408 | |
| 409 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 410 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 411 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 412 | #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/ |
| 413 | #include "joystick.h"cxx . . $ `<file>/lib/joystick.h`/ |
| 414 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 415 | #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/ |
| 416 | #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/ |
| 417 | #include "Controller.h"cxx . . $ `<file>/lib/Controller.h`/ |
| 418 | #include "Macros.h"cxx . . $ `<file>/lib/Macros.h`/ |
| 419 | #include "gamesequence.h"cxx . . $ `<file>/Descent3/gamesequence.h`/ |
| 420 | #include "pilot.h"cxx . . $ `<file>/Descent3/pilot.h`/ |
| 421 | #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/ |
| 422 | #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/ |
| 423 | #include "TelCom.h"cxx . . $ `<file>/Descent3/TelCom.h`/ |
| 424 | #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/ |
| 425 | #include "args.h"cxx . . $ `<file>/Descent3/args.h`/ |
| 426 | |
| 427 | #include "player.h"cxx . . $ `<file>/Descent3/player.h`/ |
| 428 | |
| 429 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 430 | #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/ |
| 431 | #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/ |
| 432 | |
| 433 | #include <stdlib.h> |
| 434 | #include <memory.h> |
| 435 | |
| 436 | float Key_ramp_speedcxx . . $ Key_ramp_speed. = 0.5f; |
| 437 | |
| 438 | #define CONTROL_POLL_RATEcxx . . $ `Descent3/Controls.cpp:438:9`! (1.0f / 25.0f) |
| 439 | #define KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`! Key_ramp_speed |
| 440 | #define POV_SENSITIVITYcxx . . $ `Descent3/Controls.cpp:440:9`! 1.3f |
| 441 | #define LIMIT_PITCHcxx . . $ `Descent3/Controls.cpp:441:9`! 0.75f |
| 442 | #define LIMIT_HEADINGcxx . . $ `Descent3/Controls.cpp:442:9`! 1.0f |
| 443 | #define LIMIT_BANKcxx . . $ `Descent3/Controls.cpp:443:9`! 1.0f |
| 444 | #define LIMIT_HORIZcxx . . $ `Descent3/Controls.cpp:444:9`! 1.0f |
| 445 | #define LIMIT_VERTcxx . . $ `Descent3/Controls.cpp:445:9`! 1.0f |
| 446 | #define LIMIT_FORWARDcxx . . $ `Descent3/Controls.cpp:446:9`! 1.0f |
| 447 | |
| 448 | struct tSensitivitycxx . . $ tSensitivity# { |
| 449 | float pcxx . . $ tSensitivity#p., bcxx . . $ tSensitivity#b., hcxx . . $ tSensitivity#h., xcxx . . $ tSensitivity#x., ycxx . . $ tSensitivity#y., zcxx . . $ tSensitivity#z.; |
| 450 | float opcxx . . $ tSensitivity#op., obcxx . . $ tSensitivity#ob., ohcxx . . $ tSensitivity#oh., oxcxx . . $ tSensitivity#ox., oycxx . . $ tSensitivity#oy., ozcxx . . $ tSensitivity#oz.; |
| 451 | }; |
| 452 | |
| 453 | // GLOBALS |
| 454 | |
| 455 | char *Controller_ipcxx . . $ Controller_ip. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; // IP of controller, if any. |
| 456 | gameControllercxx . . $ gameController# *Controllercxx . . $ Controller. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 457 | bool Control_poll_flagcxx . . $ Control_poll_flag. = false; // determines if system is polling controls now. |
| 458 | |
| 459 | static bool Control_system_initcxx . . $ Control_system_init. = false; |
| 460 | static float Control_interval_timecxx . . $ Control_interval_time. = 0.0f; |
| 461 | static float Control_current_timecxx . . $ Control_current_time.; |
| 462 | static float Control_frametimecxx . . $ Control_frametime.; |
| 463 | static float Key_pitch_ramp_timecxx . . $ Key_pitch_ramp_time. = 0.0f; |
| 464 | static float Key_heading_ramp_timecxx . . $ Key_heading_ramp_time. = 0.0f; |
| 465 | |
| 466 | static tSensitivitycxx . . $ tSensitivity# Key_rampcxx . . $ Key_ramp.; |
| 467 | |
| 468 | // PROTOTYPES |
| 469 | |
| 470 | static void DoKeyboardMovementcxx . . $ DoKeyboardMovement(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls); |
| 471 | static void DoControllerMovementcxx . . $ DoControllerMovement(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls); |
| 472 | static void DoWeaponscxx . . $ DoWeapons(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls); |
| 473 | static void DoKeyboardWeaponscxx . . $ DoKeyboardWeapons(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls); |
| 474 | static void DoControllerWeaponscxx . . $ DoControllerWeapons(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls); |
| 475 | static void DoMisccxx . . $ DoMisc(728771fc1cd83448).(game_controlscxx . . $ game_controls# *contols); |
| 476 | static void DoKeyboardMisccxx . . $ DoKeyboardMisc(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls); |
| 477 | static void DoControllerMisccxx . . $ DoControllerMisc(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls); |
| 478 | // MTS: no implementation! |
| 479 | void DoCommandscxx . . $ DoCommands(49f6e7a06ebc5aa8).(); |
| 480 | |
| 481 | static void ToggleHeadlightControlStatecxx . . $ ToggleHeadlightControlState(49f6e7a06ebc5aa8).(); |
| 482 | |
| 483 | // LIST OF NEEDS |
| 484 | ct_functioncxx . . $ ct_function# Controller_needscxx . . $ Controller_needs.[NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS.] = { |
| 485 | {ctfFORWARD_THRUSTAXIScxx . . $ ctfFORWARD_THRUSTAXIS., ctAnalogcxx . . $ ctAnalog., ctAxiscxx . . $ ctAxis., ctAxiscxx . . $ ctAxis., 0, 0, 0, 0}, |
| 486 | {ctfFORWARD_THRUSTKEYcxx . . $ ctfFORWARD_THRUSTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_Acxx . . $ `ddio/ddio_common.h:229:9`!, 0, 0, 0}, |
| 487 | {ctfREVERSE_THRUSTKEYcxx . . $ ctfREVERSE_THRUSTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_Zcxx . . $ `ddio/ddio_common.h:254:9`!, 0, 0, 0}, |
| 488 | {ctfFORWARD_BUTTONcxx . . $ ctfFORWARD_BUTTON., ctTimecxx . . $ ctTime., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 489 | {ctfREVERSE_BUTTONcxx . . $ ctfREVERSE_BUTTON., ctTimecxx . . $ ctTime., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 490 | {ctfUP_THRUSTAXIScxx . . $ ctfUP_THRUSTAXIS., ctAnalogcxx . . $ ctAnalog., ctAxiscxx . . $ ctAxis., ctAxiscxx . . $ ctAxis., CT_V_AXIScxx . . $ CT_V_AXIS., 0, 0, 0}, |
| 491 | {ctfUP_BUTTONcxx . . $ ctfUP_BUTTON., ctDigitalcxx . . $ ctDigital., ctPOVcxx . . $ ctPOV., ctButtoncxx . . $ ctButton., JOYPOV_UPcxx . . $ `lib/joystick.h:89:9`!, 0, 0, 0}, |
| 492 | {ctfUP_THRUSTKEYcxx . . $ ctfUP_THRUSTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_PADMINUScxx . . $ `ddio/ddio_common.h:305:9`!, 0, 0, 0}, |
| 493 | {ctfDOWN_BUTTONcxx . . $ ctfDOWN_BUTTON., ctDigitalcxx . . $ ctDigital., ctPOVcxx . . $ ctPOV., ctButtoncxx . . $ ctButton., JOYPOV_DOWNcxx . . $ `lib/joystick.h:91:9`!, 0, 0, 0}, |
| 494 | {ctfDOWN_THRUSTKEYcxx . . $ ctfDOWN_THRUSTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_PADPLUScxx . . $ `ddio/ddio_common.h:306:9`!, 0, 0, 0}, |
| 495 | {ctfRIGHT_THRUSTAXIScxx . . $ ctfRIGHT_THRUSTAXIS., ctAnalogcxx . . $ ctAnalog., ctAxiscxx . . $ ctAxis., ctAxiscxx . . $ ctAxis., CT_U_AXIScxx . . $ CT_U_AXIS., 0, 0, 0}, |
| 496 | {ctfRIGHT_BUTTONcxx . . $ ctfRIGHT_BUTTON., ctDigitalcxx . . $ ctDigital., ctPOVcxx . . $ ctPOV., ctButtoncxx . . $ ctButton., JOYPOV_RIGHTcxx . . $ `lib/joystick.h:90:9`!, 0, 0, 0}, |
| 497 | {ctfRIGHT_THRUSTKEYcxx . . $ ctfRIGHT_THRUSTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_PAD3cxx . . $ `ddio/ddio_common.h:298:9`!, 0, 0, 0}, |
| 498 | {ctfLEFT_BUTTONcxx . . $ ctfLEFT_BUTTON., ctDigitalcxx . . $ ctDigital., ctPOVcxx . . $ ctPOV., ctButtoncxx . . $ ctButton., JOYPOV_LEFTcxx . . $ `lib/joystick.h:92:9`!, 0, 0, 0}, |
| 499 | {ctfLEFT_THRUSTKEYcxx . . $ ctfLEFT_THRUSTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_PAD1cxx . . $ `ddio/ddio_common.h:296:9`!, 0, 0, 0}, |
| 500 | {ctfPITCH_DOWNAXIScxx . . $ ctfPITCH_DOWNAXIS., ctAnalogcxx . . $ ctAnalog., ctAxiscxx . . $ ctAxis., ctMouseAxiscxx . . $ ctMouseAxis., CT_Y_AXIScxx . . $ CT_Y_AXIS., CT_Y_AXIScxx . . $ CT_Y_AXIS., 0, 0}, |
| 501 | {ctfPITCH_DOWNKEYcxx . . $ ctfPITCH_DOWNKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_UPcxx . . $ `ddio/ddio_common.h:318:9`!, KEY_PAD8cxx . . $ `ddio/ddio_common.h:303:9`!, 0, 0}, |
| 502 | {ctfPITCH_DOWNBUTTONcxx . . $ ctfPITCH_DOWNBUTTON., ctDigitalcxx . . $ ctDigital., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 503 | {ctfPITCH_UPKEYcxx . . $ ctfPITCH_UPKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_DOWNcxx . . $ `ddio/ddio_common.h:319:9`!, KEY_PAD2cxx . . $ `ddio/ddio_common.h:297:9`!, 0, 0}, |
| 504 | {ctfPITCH_UPBUTTONcxx . . $ ctfPITCH_UPBUTTON., ctDigitalcxx . . $ ctDigital., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 505 | {ctfBANK_RIGHTAXIScxx . . $ ctfBANK_RIGHTAXIS., ctAnalogcxx . . $ ctAnalog., ctAxiscxx . . $ ctAxis., ctAxiscxx . . $ ctAxis., CT_R_AXIScxx . . $ CT_R_AXIS., 0, 0, 0}, |
| 506 | {ctfBANK_RIGHTKEYcxx . . $ ctfBANK_RIGHTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_Ecxx . . $ `ddio/ddio_common.h:233:9`!, KEY_PAD9cxx . . $ `ddio/ddio_common.h:304:9`!, 0, 0}, |
| 507 | {ctfBANK_RIGHTBUTTONcxx . . $ ctfBANK_RIGHTBUTTON., ctDigitalcxx . . $ ctDigital., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 508 | {ctfBANK_LEFTKEYcxx . . $ ctfBANK_LEFTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_Qcxx . . $ `ddio/ddio_common.h:245:9`!, KEY_PAD7cxx . . $ `ddio/ddio_common.h:302:9`!, 0, 0}, |
| 509 | {ctfBANK_LEFTBUTTONcxx . . $ ctfBANK_LEFTBUTTON., ctDigitalcxx . . $ ctDigital., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 510 | {ctfHEADING_RIGHTAXIScxx . . $ ctfHEADING_RIGHTAXIS., ctAnalogcxx . . $ ctAnalog., ctAxiscxx . . $ ctAxis., ctMouseAxiscxx . . $ ctMouseAxis., CT_X_AXIScxx . . $ CT_X_AXIS., CT_X_AXIScxx . . $ CT_X_AXIS., 0, 0}, |
| 511 | {ctfHEADING_RIGHTKEYcxx . . $ ctfHEADING_RIGHTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_RIGHTcxx . . $ `ddio/ddio_common.h:321:9`!, KEY_PAD6cxx . . $ `ddio/ddio_common.h:301:9`!, 0, 0}, |
| 512 | {ctfHEADING_RIGHTBUTTONcxx . . $ ctfHEADING_RIGHTBUTTON., ctDigitalcxx . . $ ctDigital., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 513 | {ctfHEADING_LEFTKEYcxx . . $ ctfHEADING_LEFTKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_LEFTcxx . . $ `ddio/ddio_common.h:320:9`!, KEY_PAD4cxx . . $ `ddio/ddio_common.h:299:9`!, 0, 0}, |
| 514 | {ctfHEADING_LEFTBUTTONcxx . . $ ctfHEADING_LEFTBUTTON., ctDigitalcxx . . $ ctDigital., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 515 | {ctfFIREPRIMARY_BUTTONcxx . . $ ctfFIREPRIMARY_BUTTON., ctTimecxx . . $ ctTime., ctButtoncxx . . $ ctButton., ctMouseButtoncxx . . $ ctMouseButton., 1, 1, 0, 0}, |
| 516 | {ctfFIREPRIMARY_KEYcxx . . $ ctfFIREPRIMARY_KEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_LCTRLcxx . . $ `ddio/ddio_common.h:279:9`!, KEY_RCTRLcxx . . $ `ddio/ddio_common.h:280:9`!, 0, 0}, |
| 517 | {ctfFIREPRIMARY_KEY2cxx . . $ ctfFIREPRIMARY_KEY2., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., 0, 0, 0, 0}, |
| 518 | {ctfFIRESECONDARY_BUTTONcxx . . $ ctfFIRESECONDARY_BUTTON., ctTimecxx . . $ ctTime., ctButtoncxx . . $ ctButton., ctMouseButtoncxx . . $ ctMouseButton., 2, 2, 0, 0}, |
| 519 | {ctfFIRESECONDARY_KEYcxx . . $ ctfFIRESECONDARY_KEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_SPACEBARcxx . . $ `ddio/ddio_common.h:271:9`!, 0, 0, 0}, |
| 520 | {ctfTOGGLE_SLIDEBUTTONcxx . . $ ctfTOGGLE_SLIDEBUTTON., ctTimecxx . . $ ctTime., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 521 | {ctfTOGGLE_SLIDEKEYcxx . . $ ctfTOGGLE_SLIDEKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_LALTcxx . . $ `ddio/ddio_common.h:277:9`!, 0, 0, 0}, |
| 522 | {ctfTOGGLE_BANKBUTTONcxx . . $ ctfTOGGLE_BANKBUTTON., ctTimecxx . . $ ctTime., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 523 | {ctfTOGGLE_BANKKEYcxx . . $ ctfTOGGLE_BANKKEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., 0, 0, 0, 0}, |
| 524 | {ctfFIREFLARE_BUTTONcxx . . $ ctfFIREFLARE_BUTTON., ctTimecxx . . $ ctTime., ctButtoncxx . . $ ctButton., ctMouseButtoncxx . . $ ctMouseButton., 3, 3, 0, 0}, |
| 525 | {ctfFIREFLARE_KEYcxx . . $ ctfFIREFLARE_KEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_Fcxx . . $ `ddio/ddio_common.h:234:9`!, 0, 0, 0}, |
| 526 | {ctfAFTERBURN_BUTTONcxx . . $ ctfAFTERBURN_BUTTON., ctTimecxx . . $ ctTime., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 527 | {ctfAFTERBURN_KEYcxx . . $ ctfAFTERBURN_KEY., ctTimecxx . . $ ctTime., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_Scxx . . $ `ddio/ddio_common.h:247:9`!, 0, 0, 0}, |
| 528 | {ctfAUTOMAP_KEYcxx . . $ ctfAUTOMAP_KEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_TABcxx . . $ `ddio/ddio_common.h:270:9`!, 0, 0, 0}, |
| 529 | {ctfPREV_INVKEYcxx . . $ ctfPREV_INVKEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_LBRACKETcxx . . $ `ddio/ddio_common.h:263:9`!, 0, 0, 0}, |
| 530 | {ctfNEXT_INVKEYcxx . . $ ctfNEXT_INVKEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_RBRACKETcxx . . $ `ddio/ddio_common.h:264:9`!, 0, 0, 0}, |
| 531 | {ctfINV_USEKEYcxx . . $ ctfINV_USEKEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_BACKSLASHcxx . . $ `ddio/ddio_common.h:258:9`!, 0, 0, 0}, |
| 532 | {ctfPREV_CNTMSKEYcxx . . $ ctfPREV_CNTMSKEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_SEMICOLcxx . . $ `ddio/ddio_common.h:262:9`!, 0, 0, 0}, |
| 533 | {ctfNEXT_CNTMSKEYcxx . . $ ctfNEXT_CNTMSKEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_RAPOSTROcxx . . $ `ddio/ddio_common.h:265:9`!, 0, 0, 0}, |
| 534 | {ctfCNTMS_USEKEYcxx . . $ ctfCNTMS_USEKEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_ENTERcxx . . $ `ddio/ddio_common.h:268:9`!, 0, 0, 0}, |
| 535 | {ctfHEADLIGHT_KEYcxx . . $ ctfHEADLIGHT_KEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_Hcxx . . $ `ddio/ddio_common.h:236:9`!, 0, 0, 0}, |
| 536 | {ctfHEADLIGHT_BUTTONcxx . . $ ctfHEADLIGHT_BUTTON., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 537 | {ctfAUTOMAP_BUTTONcxx . . $ ctfAUTOMAP_BUTTON., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 538 | {ctfPREV_INVBTNcxx . . $ ctfPREV_INVBTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 539 | {ctfNEXT_INVBTNcxx . . $ ctfNEXT_INVBTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 540 | {ctfINV_USEBTNcxx . . $ ctfINV_USEBTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 541 | {ctfPREV_CNTMSBTNcxx . . $ ctfPREV_CNTMSBTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 542 | {ctfNEXT_CNTMSBTNcxx . . $ ctfNEXT_CNTMSBTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 543 | {ctfCNTMS_USEBTNcxx . . $ ctfCNTMS_USEBTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctMouseButtoncxx . . $ ctMouseButton., 4, 4, 0, 0}, |
| 544 | {ctfWPNSEL_PCYCLEKEYcxx . . $ ctfWPNSEL_PCYCLEKEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_COMMAcxx . . $ `ddio/ddio_common.h:260:9`!, 0, 0, 0}, |
| 545 | {ctfWPNSEL_PCYCLEBTNcxx . . $ ctfWPNSEL_PCYCLEBTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctMouseButtoncxx . . $ ctMouseButton., 0, 5, 0, 0}, |
| 546 | {ctfWPNSEL_SCYCLEKEYcxx . . $ ctfWPNSEL_SCYCLEKEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_PERIODcxx . . $ `ddio/ddio_common.h:261:9`!, 0, 0, 0}, |
| 547 | {ctfWPNSEL_SCYCLEBTNcxx . . $ ctfWPNSEL_SCYCLEBTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctMouseButtoncxx . . $ ctMouseButton., 0, 6, 0, 0}, |
| 548 | {ctfREARVIEW_KEYcxx . . $ ctfREARVIEW_KEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., KEY_Rcxx . . $ `ddio/ddio_common.h:246:9`!, 0, 0, 0}, |
| 549 | {ctfREARVIEW_BTNcxx . . $ ctfREARVIEW_BTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 550 | {ctfAUDIOTAUNT1_KEYcxx . . $ ctfAUDIOTAUNT1_KEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., 0, 0, 0, 0}, |
| 551 | {ctfAUDIOTAUNT1_BTNcxx . . $ ctfAUDIOTAUNT1_BTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 552 | {ctfAUDIOTAUNT2_KEYcxx . . $ ctfAUDIOTAUNT2_KEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., 0, 0, 0, 0}, |
| 553 | {ctfAUDIOTAUNT2_BTNcxx . . $ ctfAUDIOTAUNT2_BTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 554 | {ctfAUDIOTAUNT3_KEYcxx . . $ ctfAUDIOTAUNT3_KEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., 0, 0, 0, 0}, |
| 555 | {ctfAUDIOTAUNT3_BTNcxx . . $ ctfAUDIOTAUNT3_BTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}, |
| 556 | {ctfAUDIOTAUNT4_KEYcxx . . $ ctfAUDIOTAUNT4_KEY., ctDownCountcxx . . $ ctDownCount., ctKeycxx . . $ ctKey., ctKeycxx . . $ ctKey., 0, 0, 0, 0}, |
| 557 | {ctfAUDIOTAUNT4_BTNcxx . . $ ctfAUDIOTAUNT4_BTN., ctDownCountcxx . . $ ctDownCount., ctButtoncxx . . $ ctButton., ctButtoncxx . . $ ctButton., 0, 0, 0, 0}}; |
| 558 | |
| 559 | // ramping macros |
| 560 | static inline float ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(float val, float limit, float &ramp_state, float &old_ramp_delta) { |
| 561 | float sign = val / fabscxx . . $ fabs(fbcf3211dfe1bfd1).(val), old_sign = old_ramp_delta / fabscxx . . $ fabs(fbcf3211dfe1bfd1).(old_ramp_delta); |
| 562 | if (sign != old_sign) |
| 563 | ramp_state = -ramp_state; |
| 564 | ramp_state = (val != 0) ? (ramp_state + val) : 0.0f; |
| 565 | ramp_state = (ramp_state > limit) ? limit : (ramp_state < -limit) ? (-limit) : ramp_state; |
| 566 | old_ramp_delta = val; |
| 567 | |
| 568 | return ramp_state; |
| 569 | } |
| 570 | |
| 571 | // INITIALIZATION FUNCTIONS |
| 572 | |
| 573 | void InitControlscxx . . $ InitControls(49f6e7a06ebc5aa8).() { |
| 574 | // Create controller object |
| 575 | if (Control_system_initcxx . . $ Control_system_init.) |
| 576 | return; |
| 577 | |
| 578 | Control_system_initcxx . . $ Control_system_init. = true; |
| 579 | |
| 580 | Controllercxx . . $ Controller. = CreateControllercxx . . $ CreateController(81c4a189a587b469).(NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS., Controller_needscxx . . $ Controller_needs., Controller_ipcxx . . $ Controller_ip.); |
| 581 | if (Controllercxx . . $ Controller. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 582 | Errorcxx . . $ Error(326aeb464d16410c).(TXT_ERRUNINITCNTcxx . . $ `Descent3/stringtable.h:114:9`!); |
| 583 | Controllercxx . . $ Controller.->mask_controllerscxx . . $ gameController#mask_controllers(b0b38cda41d4ede4).(false, false); |
| 584 | Controllercxx . . $ Controller.->mask_controllerscxx . . $ gameController#mask_controllers(b0b38cda41d4ede4).(true, true); |
| 585 | |
| 586 | Controllercxx . . $ Controller.->mask_controllerscxx . . $ gameController#mask_controllers(b0b38cda41d4ede4).((Current_pilotcxx . . $ Current_pilot..read_controllercxx . . $ pilot#read_controller. & READF_JOYcxx . . $ `Descent3/controls.h:178:9`!) ? true : false, |
| 587 | (Current_pilotcxx . . $ Current_pilot..read_controllercxx . . $ pilot#read_controller. & READF_MOUSEcxx . . $ `Descent3/controls.h:177:9`!) ? true : false); |
| 588 | |
| 589 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., CT_X_AXIScxx . . $ CT_X_AXIS., Current_pilotcxx . . $ Current_pilot..mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[0]); |
| 590 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., CT_Y_AXIScxx . . $ CT_Y_AXIS., Current_pilotcxx . . $ Current_pilot..mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[1]); |
| 591 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., CT_Z_AXIScxx . . $ CT_Z_AXIS., Current_pilotcxx . . $ Current_pilot..mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[0]); |
| 592 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_X_AXIScxx . . $ CT_X_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[0]); |
| 593 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_Y_AXIScxx . . $ CT_Y_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[1]); |
| 594 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_Z_AXIScxx . . $ CT_Z_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[2]); |
| 595 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_R_AXIScxx . . $ CT_R_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[3]); |
| 596 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_U_AXIScxx . . $ CT_U_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[4]); |
| 597 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_V_AXIScxx . . $ CT_V_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[5]); |
| 598 | |
| 599 | int i; |
| 600 | i = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-deadzone0"); |
| 601 | if (i > 0) { |
| 602 | Controllercxx . . $ Controller.->set_controller_deadzonecxx . . $ gameController#set_controller_deadzone(43c79ee2f1b9aefe).(0, atof(GameArgscxx . . $ GameArgs.[i + 1])); |
| 603 | } |
| 604 | i = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-deadzone1"); |
| 605 | if (i > 0) { |
| 606 | Controllercxx . . $ Controller.->set_controller_deadzonecxx . . $ gameController#set_controller_deadzone(43c79ee2f1b9aefe).(1, atof(GameArgscxx . . $ GameArgs.[i + 1])); |
| 607 | } |
| 608 | |
| 609 | Key_ramp_speedcxx . . $ Key_ramp_speed. = Current_pilotcxx . . $ Current_pilot..key_rampingcxx . . $ pilot#key_ramping.; // DAJ added to restore ramping |
| 610 | |
| 611 | SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).(); |
| 612 | |
| 613 | // start controller time. |
| 614 | Control_current_timecxx . . $ Control_current_time. = Control_interval_timecxx . . $ Control_interval_time. = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!(); |
| 615 | Key_rampcxx . . $ Key_ramp..opcxx . . $ tSensitivity#op. = Key_rampcxx . . $ Key_ramp..pcxx . . $ tSensitivity#p. = 0.0f; |
| 616 | Key_rampcxx . . $ Key_ramp..obcxx . . $ tSensitivity#ob. = Key_rampcxx . . $ Key_ramp..bcxx . . $ tSensitivity#b. = 0.0f; |
| 617 | Key_rampcxx . . $ Key_ramp..ohcxx . . $ tSensitivity#oh. = Key_rampcxx . . $ Key_ramp..hcxx . . $ tSensitivity#h. = 0.0f; |
| 618 | Key_rampcxx . . $ Key_ramp..oxcxx . . $ tSensitivity#ox. = Key_rampcxx . . $ Key_ramp..xcxx . . $ tSensitivity#x. = 0.0f; |
| 619 | Key_rampcxx . . $ Key_ramp..oycxx . . $ tSensitivity#oy. = Key_rampcxx . . $ Key_ramp..ycxx . . $ tSensitivity#y. = 0.0f; |
| 620 | Key_rampcxx . . $ Key_ramp..ozcxx . . $ tSensitivity#oz. = Key_rampcxx . . $ Key_ramp..zcxx . . $ tSensitivity#z. = 0.0f; |
| 621 | |
| 622 | // Initialize preemptive controller system for non-positonal data. |
| 623 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Initialized control system.\n"); |
| 624 | } |
| 625 | |
| 626 | void CloseControlscxx . . $ CloseControls(49f6e7a06ebc5aa8).() { |
| 627 | if (!Control_system_initcxx . . $ Control_system_init.) |
| 628 | return; |
| 629 | ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).(); |
| 630 | DestroyControllercxx . . $ DestroyController(66dd5cf3e0c6b3e1).(Controllercxx . . $ Controller.); |
| 631 | Controllercxx . . $ Controller. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 632 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Closing control system.\n"); |
| 633 | Control_system_initcxx . . $ Control_system_init. = false; |
| 634 | } |
| 635 | |
| 636 | // reinits the controller, hence restoring default controller configurations |
| 637 | void RestoreDefaultControlscxx . . $ RestoreDefaultControls(49f6e7a06ebc5aa8).() { |
| 638 | ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).(); |
| 639 | DestroyControllercxx . . $ DestroyController(66dd5cf3e0c6b3e1).(Controllercxx . . $ Controller.); |
| 640 | Controllercxx . . $ Controller. = CreateControllercxx . . $ CreateController(81c4a189a587b469).(NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS., Controller_needscxx . . $ Controller_needs., Controller_ipcxx . . $ Controller_ip.); |
| 641 | if (Controllercxx . . $ Controller. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 642 | Errorcxx . . $ Error(326aeb464d16410c).(TXT_ERRUNINITCNTcxx . . $ `Descent3/stringtable.h:114:9`!); |
| 643 | SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).(); |
| 644 | |
| 645 | Controllercxx . . $ Controller.->mask_controllerscxx . . $ gameController#mask_controllers(b0b38cda41d4ede4).((Current_pilotcxx . . $ Current_pilot..read_controllercxx . . $ pilot#read_controller. & READF_JOYcxx . . $ `Descent3/controls.h:178:9`!) ? true : false, |
| 646 | (Current_pilotcxx . . $ Current_pilot..read_controllercxx . . $ pilot#read_controller. & READF_MOUSEcxx . . $ `Descent3/controls.h:177:9`!) ? true : false); |
| 647 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., CT_X_AXIScxx . . $ CT_X_AXIS., Current_pilotcxx . . $ Current_pilot..mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[0]); |
| 648 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., CT_Y_AXIScxx . . $ CT_Y_AXIS., Current_pilotcxx . . $ Current_pilot..mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[1]); |
| 649 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., CT_Z_AXIScxx . . $ CT_Z_AXIS., Current_pilotcxx . . $ Current_pilot..mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[0]); |
| 650 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_X_AXIScxx . . $ CT_X_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[0]); |
| 651 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_Y_AXIScxx . . $ CT_Y_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[1]); |
| 652 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_Z_AXIScxx . . $ CT_Z_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[2]); |
| 653 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_R_AXIScxx . . $ CT_R_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[3]); |
| 654 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_U_AXIScxx . . $ CT_U_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[4]); |
| 655 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_V_AXIScxx . . $ CT_V_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[5]); |
| 656 | } |
| 657 | |
| 658 | void SuspendControlscxx . . $ SuspendControls(49f6e7a06ebc5aa8).() { |
| 659 | if (!Controllercxx . . $ Controller.) |
| 660 | return; |
| 661 | |
| 662 | Control_poll_flagcxx . . $ Control_poll_flag. = false; |
| 663 | Controllercxx . . $ Controller.->suspendcxx . . $ gameController#suspend(49f6e7a06ebc5aa8).(); |
| 664 | } |
| 665 | |
| 666 | void ResumeControlscxx . . $ ResumeControls(49f6e7a06ebc5aa8).() { |
| 667 | if (!Controllercxx . . $ Controller.) |
| 668 | return; |
| 669 | |
| 670 | Controllercxx . . $ Controller.->resumecxx . . $ gameController#resume(49f6e7a06ebc5aa8).(); |
| 671 | Controllercxx . . $ Controller.->flushcxx . . $ gameController#flush(49f6e7a06ebc5aa8).(); |
| 672 | ddio_KeyFlushcxx . . $ ddio_KeyFlush(49f6e7a06ebc5aa8).(); |
| 673 | ddio_MouseQueueFlushcxx . . $ ddio_MouseQueueFlush(49f6e7a06ebc5aa8).(); |
| 674 | |
| 675 | Control_poll_flagcxx . . $ Control_poll_flag. = true; |
| 676 | |
| 677 | // set pilot defaults for controller outside of assignment |
| 678 | Controllercxx . . $ Controller.->mask_controllerscxx . . $ gameController#mask_controllers(b0b38cda41d4ede4).((Current_pilotcxx . . $ Current_pilot..read_controllercxx . . $ pilot#read_controller. & READF_JOYcxx . . $ `Descent3/controls.h:178:9`!) ? true : false, |
| 679 | (Current_pilotcxx . . $ Current_pilot..read_controllercxx . . $ pilot#read_controller. & READF_MOUSEcxx . . $ `Descent3/controls.h:177:9`!) ? true : false); |
| 680 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., CT_X_AXIScxx . . $ CT_X_AXIS., Current_pilotcxx . . $ Current_pilot..mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[0]); |
| 681 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., CT_Y_AXIScxx . . $ CT_Y_AXIS., Current_pilotcxx . . $ Current_pilot..mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[1]); |
| 682 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., CT_Z_AXIScxx . . $ CT_Z_AXIS., Current_pilotcxx . . $ Current_pilot..mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[0]); |
| 683 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_X_AXIScxx . . $ CT_X_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[0]); |
| 684 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_Y_AXIScxx . . $ CT_Y_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[1]); |
| 685 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_Z_AXIScxx . . $ CT_Z_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[2]); |
| 686 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_R_AXIScxx . . $ CT_R_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[3]); |
| 687 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_U_AXIScxx . . $ CT_U_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[4]); |
| 688 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., CT_V_AXIScxx . . $ CT_V_AXIS., Current_pilotcxx . . $ Current_pilot..joy_sensitivitycxx . . $ pilot#joy_sensitivity.[5]); |
| 689 | |
| 690 | int i; |
| 691 | i = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-deadzone0"); |
| 692 | if (i > 0) { |
| 693 | Controllercxx . . $ Controller.->set_controller_deadzonecxx . . $ gameController#set_controller_deadzone(43c79ee2f1b9aefe).(0, atof(GameArgscxx . . $ GameArgs.[i + 1])); |
| 694 | } |
| 695 | i = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-deadzone1"); |
| 696 | if (i > 0) { |
| 697 | Controllercxx . . $ Controller.->set_controller_deadzonecxx . . $ gameController#set_controller_deadzone(43c79ee2f1b9aefe).(1, atof(GameArgscxx . . $ GameArgs.[i + 1])); |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | // INTERFACE FUNCTIONS |
| 702 | |
| 703 | void PollControlscxx . . $ PollControls(49f6e7a06ebc5aa8).() { |
| 704 | // only read at the specified rate to keep things consistant. manager control system timer |
| 705 | if (!Control_poll_flagcxx . . $ Control_poll_flag.) |
| 706 | return; |
| 707 | if (Controllercxx . . $ Controller.) |
| 708 | Controllercxx . . $ Controller.->pollcxx . . $ gameController#poll(49f6e7a06ebc5aa8).(); |
| 709 | /* |
| 710 | Control_current_time += Frametime; |
| 711 | Control_frametime = Control_current_time - Control_interval_time; |
| 712 | if (Control_frametime >= CONTROL_POLL_RATE) { |
| 713 | Control_interval_time = Control_current_time; |
| 714 | if (Controller) |
| 715 | Controller->poll(); |
| 716 | } |
| 717 | */ |
| 718 | } |
| 719 | |
| 720 | // Read the keyboard & other controllers. Fills in the specified structure. |
| 721 | void ReadPlayerControlscxx . . $ ReadPlayerControls(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 722 | if (!Control_system_initcxx . . $ Control_system_init.) { |
| 723 | memset(controls, 0, sizeof(game_controlscxx . . $ game_controls#)); |
| 724 | return; |
| 725 | } |
| 726 | //@@ Control_frametime = Frametime; |
| 727 | // keyboard uses game frametime |
| 728 | // controller uses polled control frametime |
| 729 | |
| 730 | if (!Control_poll_flagcxx . . $ Control_poll_flag.) { |
| 731 | memset(controls, 0, sizeof(game_controlscxx . . $ game_controls#)); |
| 732 | return; |
| 733 | } |
| 734 | |
| 735 | PollControlscxx . . $ PollControls(49f6e7a06ebc5aa8).(); |
| 736 | DoWeaponscxx . . $ DoWeapons(728771fc1cd83448).(controls); // controls for weapon firing operations |
| 737 | DoMisccxx . . $ DoMisc(728771fc1cd83448).(controls); |
| 738 | DoMovementcxx . . $ DoMovement(728771fc1cd83448).(controls); // controls for moving the object |
| 739 | |
| 740 | // only read at the specified rate to keep things consistant. manager control system timer |
| 741 | // Control_current_time += Frametime; |
| 742 | // Control_frametime = Control_current_time - Control_interval_time; |
| 743 | // if (Control_frametime >= CONTROL_POLL_RATE) { |
| 744 | // Control_interval_time = Control_current_time; |
| 745 | // DoMovement(controls); // controls for moving the object |
| 746 | // return 1; |
| 747 | //} |
| 748 | // else |
| 749 | // return 0; |
| 750 | } |
| 751 | |
| 752 | // --------------------------------------------------------------------------- |
| 753 | // CONTROL FUNCTIONS |
| 754 | // MOVEMENT |
| 755 | // --------------------------------------------------------------------------- |
| 756 | |
| 757 | void DoMovementcxx . . $ DoMovement(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 758 | controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. = 0.0f; |
| 759 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. = 0.0f; |
| 760 | controls->forward_thrustcxx . . $ game_controls#forward_thrust. = 0.0f; |
| 761 | controls->pitch_thrustcxx . . $ game_controls#pitch_thrust. = 0.0f; |
| 762 | controls->bank_thrustcxx . . $ game_controls#bank_thrust. = 0.0f; |
| 763 | controls->heading_thrustcxx . . $ game_controls#heading_thrust. = 0.0f; |
| 764 | controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. = 0.0f; |
| 765 | |
| 766 | // only read controls in game interface mode. |
| 767 | if (Game_interface_modecxx . . $ Game_interface_mode. != GAME_INTERFACEcxx . . $ `Descent3/gamesequence.h:129:9`!) |
| 768 | return; |
| 769 | |
| 770 | // keyboard (always do this first.) |
| 771 | if (!Doing_input_messagecxx . . $ Doing_input_message.) |
| 772 | DoKeyboardMovementcxx . . $ DoKeyboardMovement(728771fc1cd83448).(controls); |
| 773 | |
| 774 | // controller |
| 775 | DoControllerMovementcxx . . $ DoControllerMovement(728771fc1cd83448).(controls); |
| 776 | |
| 777 | // clip controller values |
| 778 | if (controls->pitch_thrustcxx . . $ game_controls#pitch_thrust. > LIMIT_PITCHcxx . . $ `Descent3/Controls.cpp:441:9`!) |
| 779 | controls->pitch_thrustcxx . . $ game_controls#pitch_thrust. = LIMIT_PITCHcxx . . $ `Descent3/Controls.cpp:441:9`!; |
| 780 | if (controls->pitch_thrustcxx . . $ game_controls#pitch_thrust. < -LIMIT_PITCHcxx . . $ `Descent3/Controls.cpp:441:9`!) |
| 781 | controls->pitch_thrustcxx . . $ game_controls#pitch_thrust. = -LIMIT_PITCHcxx . . $ `Descent3/Controls.cpp:441:9`!; |
| 782 | if (controls->heading_thrustcxx . . $ game_controls#heading_thrust. > LIMIT_HEADINGcxx . . $ `Descent3/Controls.cpp:442:9`!) |
| 783 | controls->heading_thrustcxx . . $ game_controls#heading_thrust. = LIMIT_HEADINGcxx . . $ `Descent3/Controls.cpp:442:9`!; |
| 784 | if (controls->heading_thrustcxx . . $ game_controls#heading_thrust. < -LIMIT_HEADINGcxx . . $ `Descent3/Controls.cpp:442:9`!) |
| 785 | controls->heading_thrustcxx . . $ game_controls#heading_thrust. = -LIMIT_HEADINGcxx . . $ `Descent3/Controls.cpp:442:9`!; |
| 786 | if (controls->bank_thrustcxx . . $ game_controls#bank_thrust. > LIMIT_BANKcxx . . $ `Descent3/Controls.cpp:443:9`!) |
| 787 | controls->bank_thrustcxx . . $ game_controls#bank_thrust. = LIMIT_BANKcxx . . $ `Descent3/Controls.cpp:443:9`!; |
| 788 | if (controls->bank_thrustcxx . . $ game_controls#bank_thrust. < -LIMIT_BANKcxx . . $ `Descent3/Controls.cpp:443:9`!) |
| 789 | controls->bank_thrustcxx . . $ game_controls#bank_thrust. = -LIMIT_BANKcxx . . $ `Descent3/Controls.cpp:443:9`!; |
| 790 | if (controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. > LIMIT_HORIZcxx . . $ `Descent3/Controls.cpp:444:9`!) |
| 791 | controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. = LIMIT_HORIZcxx . . $ `Descent3/Controls.cpp:444:9`!; |
| 792 | if (controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. < -LIMIT_HORIZcxx . . $ `Descent3/Controls.cpp:444:9`!) |
| 793 | controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. = -LIMIT_HORIZcxx . . $ `Descent3/Controls.cpp:444:9`!; |
| 794 | if (controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. > LIMIT_VERTcxx . . $ `Descent3/Controls.cpp:445:9`!) |
| 795 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. = LIMIT_VERTcxx . . $ `Descent3/Controls.cpp:445:9`!; |
| 796 | if (controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. < -LIMIT_VERTcxx . . $ `Descent3/Controls.cpp:445:9`!) |
| 797 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. = -LIMIT_VERTcxx . . $ `Descent3/Controls.cpp:445:9`!; |
| 798 | |
| 799 | if (controls->forward_thrustcxx . . $ game_controls#forward_thrust. > LIMIT_FORWARDcxx . . $ `Descent3/Controls.cpp:446:9`!) |
| 800 | controls->forward_thrustcxx . . $ game_controls#forward_thrust. = LIMIT_FORWARDcxx . . $ `Descent3/Controls.cpp:446:9`!; |
| 801 | if (controls->forward_thrustcxx . . $ game_controls#forward_thrust. < -LIMIT_FORWARDcxx . . $ `Descent3/Controls.cpp:446:9`!) |
| 802 | controls->forward_thrustcxx . . $ game_controls#forward_thrust. = -LIMIT_FORWARDcxx . . $ `Descent3/Controls.cpp:446:9`!; |
| 803 | |
| 804 | if (controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. > LIMIT_FORWARDcxx . . $ `Descent3/Controls.cpp:446:9`!) |
| 805 | controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. = LIMIT_FORWARDcxx . . $ `Descent3/Controls.cpp:446:9`!; |
| 806 | if (controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. < -LIMIT_FORWARDcxx . . $ `Descent3/Controls.cpp:446:9`!) |
| 807 | controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. = -LIMIT_FORWARDcxx . . $ `Descent3/Controls.cpp:446:9`!; |
| 808 | |
| 809 | mprintf_atcxx . . $ `ddebug/mono.h:83:9`!(1, 5, 30, "ch:%.2f ", controls->heading_thrust); |
| 810 | |
| 811 | // if (controls->pitch_thrust || controls->heading_thrust) |
| 812 | // mprintf(0, "p:%.2f h:%.2f\n", controls->pitch_thrust, controls->heading_thrust); |
| 813 | } |
| 814 | |
| 815 | void DoKeyboardMovementcxx . . $ DoKeyboardMovement(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 816 | float dx, dy, dz, dp, dh, db, d_afterburn; |
| 817 | ct_packetcxx . . $ ct_packet# key_x1, key_x0, key_y1, key_y0, key_z1, key_z0; |
| 818 | ct_packetcxx . . $ ct_packet# key_p1, key_p0, key_h1, key_h0, key_b1, key_b0; |
| 819 | ct_packetcxx . . $ ct_packet# key_afterburn; |
| 820 | |
| 821 | // read controls |
| 822 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFORWARD_THRUSTKEYcxx . . $ ctfFORWARD_THRUSTKEY., &key_z1); |
| 823 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfREVERSE_THRUSTKEYcxx . . $ ctfREVERSE_THRUSTKEY., &key_z0); |
| 824 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfUP_THRUSTKEYcxx . . $ ctfUP_THRUSTKEY., &key_y1); |
| 825 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfDOWN_THRUSTKEYcxx . . $ ctfDOWN_THRUSTKEY., &key_y0); |
| 826 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfRIGHT_THRUSTKEYcxx . . $ ctfRIGHT_THRUSTKEY., &key_x1); |
| 827 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfLEFT_THRUSTKEYcxx . . $ ctfLEFT_THRUSTKEY., &key_x0); |
| 828 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfPITCH_DOWNKEYcxx . . $ ctfPITCH_DOWNKEY., &key_p1); |
| 829 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfPITCH_UPKEYcxx . . $ ctfPITCH_UPKEY., &key_p0); |
| 830 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfBANK_RIGHTKEYcxx . . $ ctfBANK_RIGHTKEY., &key_b1); |
| 831 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfBANK_LEFTKEYcxx . . $ ctfBANK_LEFTKEY., &key_b0); |
| 832 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfHEADING_RIGHTKEYcxx . . $ ctfHEADING_RIGHTKEY., &key_h1); |
| 833 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfHEADING_LEFTKEYcxx . . $ ctfHEADING_LEFTKEY., &key_h0); |
| 834 | |
| 835 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAFTERBURN_KEYcxx . . $ ctfAFTERBURN_KEY., &key_afterburn); |
| 836 | |
| 837 | // check keyboard controls first. |
| 838 | |
| 839 | // do thrust and orientation controls. since packet contains time since last call, frametime is taken into |
| 840 | // account. note that the ctDigital packets are for those rare cases where a key is down, but there is no key down |
| 841 | // time registered as of yet, which happens on some systems. |
| 842 | dx = (key_x1.valuecxx . . $ ct_packet#value. - key_x0.valuecxx . . $ ct_packet#value.); |
| 843 | dy = (key_y1.valuecxx . . $ ct_packet#value. - key_y0.valuecxx . . $ ct_packet#value.); |
| 844 | dz = (key_z1.valuecxx . . $ ct_packet#value. - key_z0.valuecxx . . $ ct_packet#value.); |
| 845 | dp = (key_p1.valuecxx . . $ ct_packet#value. - key_p0.valuecxx . . $ ct_packet#value.); |
| 846 | db = (key_b0.valuecxx . . $ ct_packet#value. - key_b1.valuecxx . . $ ct_packet#value.); |
| 847 | dh = (key_h1.valuecxx . . $ ct_packet#value. - key_h0.valuecxx . . $ ct_packet#value.); |
| 848 | |
| 849 | d_afterburn = (key_afterburn.valuecxx . . $ ct_packet#value.); |
| 850 | |
| 851 | controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. += |
| 852 | (KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) ? (ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(dx, KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!, Key_rampcxx . . $ Key_ramp..xcxx . . $ tSensitivity#x., Key_rampcxx . . $ Key_ramp..oxcxx . . $ tSensitivity#ox.) / KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) : dx; |
| 853 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. += |
| 854 | (KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) ? (ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(dy, KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!, Key_rampcxx . . $ Key_ramp..ycxx . . $ tSensitivity#y., Key_rampcxx . . $ Key_ramp..oycxx . . $ tSensitivity#oy.) / KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) : dy; |
| 855 | controls->forward_thrustcxx . . $ game_controls#forward_thrust. += |
| 856 | (KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) ? (ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(dz, KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!, Key_rampcxx . . $ Key_ramp..zcxx . . $ tSensitivity#z., Key_rampcxx . . $ Key_ramp..ozcxx . . $ tSensitivity#oz.) / KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) : dz; |
| 857 | |
| 858 | controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. += d_afterburn / Frametimecxx . . $ Frametime.; |
| 859 | |
| 860 | if (!controls->toggle_slidecxx . . $ game_controls#toggle_slide. && !controls->toggle_bankcxx . . $ game_controls#toggle_bank.) { |
| 861 | // clamp pitch ramp time to limits. |
| 862 | controls->pitch_thrustcxx . . $ game_controls#pitch_thrust. += |
| 863 | (KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) ? (ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(dp, KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!, Key_rampcxx . . $ Key_ramp..pcxx . . $ tSensitivity#p., Key_rampcxx . . $ Key_ramp..opcxx . . $ tSensitivity#op.) / KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) : dp; |
| 864 | controls->heading_thrustcxx . . $ game_controls#heading_thrust. += |
| 865 | (KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) ? (ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(dh, KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!, Key_rampcxx . . $ Key_ramp..hcxx . . $ tSensitivity#h., Key_rampcxx . . $ Key_ramp..ohcxx . . $ tSensitivity#oh.) / KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) : dh; |
| 866 | } |
| 867 | |
| 868 | if (controls->toggle_slidecxx . . $ game_controls#toggle_slide.) { |
| 869 | controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. += |
| 870 | (KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) ? (ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(dh, KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!, Key_rampcxx . . $ Key_ramp..hcxx . . $ tSensitivity#h., Key_rampcxx . . $ Key_ramp..ohcxx . . $ tSensitivity#oh.) / KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) : dh; |
| 871 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. += |
| 872 | (KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) ? (ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(dp, KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!, Key_rampcxx . . $ Key_ramp..pcxx . . $ tSensitivity#p., Key_rampcxx . . $ Key_ramp..opcxx . . $ tSensitivity#op.) / KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) : dp; |
| 873 | } |
| 874 | if (controls->toggle_bankcxx . . $ game_controls#toggle_bank.) { |
| 875 | controls->bank_thrustcxx . . $ game_controls#bank_thrust. += |
| 876 | (KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) ? (ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(dh, KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!, Key_rampcxx . . $ Key_ramp..hcxx . . $ tSensitivity#h., Key_rampcxx . . $ Key_ramp..ohcxx . . $ tSensitivity#oh.) / KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) : dh; |
| 877 | } else { |
| 878 | controls->bank_thrustcxx . . $ game_controls#bank_thrust. += |
| 879 | (KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) ? (ramp_control_valuecxx . . $ ramp_control_value(ecc2bb654b394234).(db, KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!, Key_rampcxx . . $ Key_ramp..bcxx . . $ tSensitivity#b., Key_rampcxx . . $ Key_ramp..obcxx . . $ tSensitivity#ob.) / KEY_RAMPUP_TIMEcxx . . $ `Descent3/Controls.cpp:439:9`!) : db; |
| 880 | } |
| 881 | } |
| 882 | |
| 883 | // VERY IMPORTANT: All the movement thrust values are set in the keyboard movement |
| 884 | // handler. So we adjust those values in this function based off of the remaining |
| 885 | // controller element stataes. |
| 886 | |
| 887 | void DoControllerMovementcxx . . $ DoControllerMovement(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 888 | ct_packetcxx . . $ ct_packet# ctl_x, ctl_y, ctl_z, ctl_p, ctl_b, ctl_h; |
| 889 | ct_packetcxx . . $ ct_packet# ctl_povl, ctl_povr, ctl_povu, ctl_povd, ctl_fb, ctl_rb; |
| 890 | ct_packetcxx . . $ ct_packet# ctl_afterburn; |
| 891 | ct_packetcxx . . $ ct_packet# ctl_pub, ctl_pdb, ctl_hlb, ctl_hrb, ctl_blb, ctl_brb; |
| 892 | |
| 893 | // read controls |
| 894 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFORWARD_THRUSTAXIScxx . . $ ctfFORWARD_THRUSTAXIS., &ctl_z); |
| 895 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfUP_THRUSTAXIScxx . . $ ctfUP_THRUSTAXIS., &ctl_y); |
| 896 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfRIGHT_THRUSTAXIScxx . . $ ctfRIGHT_THRUSTAXIS., &ctl_x); |
| 897 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfPITCH_DOWNAXIScxx . . $ ctfPITCH_DOWNAXIS., &ctl_p); |
| 898 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfBANK_RIGHTAXIScxx . . $ ctfBANK_RIGHTAXIS., &ctl_b); |
| 899 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfHEADING_RIGHTAXIScxx . . $ ctfHEADING_RIGHTAXIS., &ctl_h); |
| 900 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfUP_BUTTONcxx . . $ ctfUP_BUTTON., &ctl_povu); |
| 901 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfDOWN_BUTTONcxx . . $ ctfDOWN_BUTTON., &ctl_povd); |
| 902 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfRIGHT_BUTTONcxx . . $ ctfRIGHT_BUTTON., &ctl_povr); |
| 903 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfLEFT_BUTTONcxx . . $ ctfLEFT_BUTTON., &ctl_povl); |
| 904 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFORWARD_BUTTONcxx . . $ ctfFORWARD_BUTTON., &ctl_fb); |
| 905 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfREVERSE_BUTTONcxx . . $ ctfREVERSE_BUTTON., &ctl_rb); |
| 906 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAFTERBURN_BUTTONcxx . . $ ctfAFTERBURN_BUTTON., &ctl_afterburn); |
| 907 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfHEADING_LEFTBUTTONcxx . . $ ctfHEADING_LEFTBUTTON., &ctl_hlb); |
| 908 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfHEADING_RIGHTBUTTONcxx . . $ ctfHEADING_RIGHTBUTTON., &ctl_hrb); |
| 909 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfPITCH_UPBUTTONcxx . . $ ctfPITCH_UPBUTTON., &ctl_pub); |
| 910 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfPITCH_DOWNBUTTONcxx . . $ ctfPITCH_DOWNBUTTON., &ctl_pdb); |
| 911 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfBANK_LEFTBUTTONcxx . . $ ctfBANK_LEFTBUTTON., &ctl_blb); |
| 912 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfBANK_RIGHTBUTTONcxx . . $ ctfBANK_RIGHTBUTTON., &ctl_brb); |
| 913 | |
| 914 | // check for joystick movement |
| 915 | // mprintf(0, "p:%f h:%f b:%f\n", ctl_p.value, ctl_h.value, ctl_b.value); |
| 916 | // mprintf(0, "u:%d d:%d l:%d r:%d\n", (int)ctl_povu.value, (int)ctl_povd.value, (int)ctl_povl.value, (int)ctl_povr.value); |
| 917 | |
| 918 | // do x and y thrust |
| 919 | controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. += ctl_x.valuecxx . . $ ct_packet#value.; |
| 920 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. += -ctl_y.valuecxx . . $ ct_packet#value.; |
| 921 | |
| 922 | // invert throttle alue for real flight model controls |
| 923 | controls->forward_thrustcxx . . $ game_controls#forward_thrust. += -ctl_z.valuecxx . . $ ct_packet#value.; |
| 924 | |
| 925 | // do banking |
| 926 | if (controls->toggle_bankcxx . . $ game_controls#toggle_bank.) { |
| 927 | controls->bank_thrustcxx . . $ game_controls#bank_thrust. += -ctl_h.valuecxx . . $ ct_packet#value.; |
| 928 | } else { |
| 929 | controls->bank_thrustcxx . . $ game_controls#bank_thrust. += -ctl_b.valuecxx . . $ ct_packet#value.; |
| 930 | } |
| 931 | |
| 932 | // do slide if toggled |
| 933 | if (controls->toggle_slidecxx . . $ game_controls#toggle_slide.) { |
| 934 | controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. += ctl_h.valuecxx . . $ ct_packet#value.; |
| 935 | if ((ctl_p.flagscxx . . $ ct_packet#flags. & CTPK_MOUSEcxx . . $ `lib/Controller.h:163:9`!) && !FindArgcxx . . $ FindArg(5c4306d8553b3696).("-invertmouseslide")) { |
| 936 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. += (-ctl_p.valuecxx . . $ ct_packet#value.); |
| 937 | } else { |
| 938 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. += ctl_p.valuecxx . . $ ct_packet#value.; |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | // do standard pitch and heading. |
| 943 | if (!controls->toggle_slidecxx . . $ game_controls#toggle_slide. && !controls->toggle_bankcxx . . $ game_controls#toggle_bank.) { |
| 944 | controls->pitch_thrustcxx . . $ game_controls#pitch_thrust. += -ctl_p.valuecxx . . $ ct_packet#value.; |
| 945 | controls->heading_thrustcxx . . $ game_controls#heading_thrust. += ctl_h.valuecxx . . $ ct_packet#value.; |
| 946 | } |
| 947 | |
| 948 | // do afterburn button control |
| 949 | if (!controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust.) { |
| 950 | // mprintf(0, "aft=%.4f\n", ctl_afterburn.value); |
| 951 | controls->afterburn_thrustcxx . . $ game_controls#afterburn_thrust. = ((ctl_afterburn.valuecxx . . $ ct_packet#value.) / Frametimecxx . . $ Frametime.); |
| 952 | } |
| 953 | |
| 954 | // do button heading |
| 955 | if (ctl_hlb.valuecxx . . $ ct_packet#value.) |
| 956 | controls->heading_thrustcxx . . $ game_controls#heading_thrust. += (-1.0f); |
| 957 | if (ctl_hrb.valuecxx . . $ ct_packet#value.) |
| 958 | controls->heading_thrustcxx . . $ game_controls#heading_thrust. += (1.0f); |
| 959 | |
| 960 | // do button pitch |
| 961 | if (ctl_pub.valuecxx . . $ ct_packet#value.) |
| 962 | controls->pitch_thrustcxx . . $ game_controls#pitch_thrust. += (-1.0f); |
| 963 | if (ctl_pdb.valuecxx . . $ ct_packet#value.) |
| 964 | controls->pitch_thrustcxx . . $ game_controls#pitch_thrust. += (1.0f); |
| 965 | |
| 966 | // do forward thrust based off of button values. |
| 967 | controls->forward_thrustcxx . . $ game_controls#forward_thrust. += ((ctl_fb.valuecxx . . $ ct_packet#value. - ctl_rb.valuecxx . . $ ct_packet#value.) / Frametimecxx . . $ Frametime.); |
| 968 | |
| 969 | // do button banking |
| 970 | if (ctl_blb.valuecxx . . $ ct_packet#value.) |
| 971 | controls->bank_thrustcxx . . $ game_controls#bank_thrust. += (1.0f); |
| 972 | if (ctl_brb.valuecxx . . $ ct_packet#value.) |
| 973 | controls->bank_thrustcxx . . $ game_controls#bank_thrust. += (-1.0f); |
| 974 | |
| 975 | // do button sliding. use control frametime to set sliding times per frame. |
| 976 | // note that vertical and sideways thrusts are dependent on what the keyboard controller |
| 977 | // set these values to. so we save our own slidetimes. |
| 978 | if (ctl_povu.valuecxx . . $ ct_packet#value.) { |
| 979 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. += (1.0f); |
| 980 | } |
| 981 | if (ctl_povd.valuecxx . . $ ct_packet#value.) { |
| 982 | controls->vertical_thrustcxx . . $ game_controls#vertical_thrust. -= (1.0f); |
| 983 | } |
| 984 | if (ctl_povr.valuecxx . . $ ct_packet#value.) { |
| 985 | controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. += (1.0f); |
| 986 | } |
| 987 | if (ctl_povl.valuecxx . . $ ct_packet#value.) { |
| 988 | controls->sideways_thrustcxx . . $ game_controls#sideways_thrust. -= (1.0f); |
| 989 | } |
| 990 | } |
| 991 | |
| 992 | // --------------------------------------------------------------------------- |
| 993 | // CONTROL FUNCTIONS |
| 994 | // WEAPONS |
| 995 | // --------------------------------------------------------------------------- |
| 996 | |
| 997 | void DoWeaponscxx . . $ DoWeapons(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 998 | // reset some values |
| 999 | controls->fire_primary_down_countcxx . . $ game_controls#fire_primary_down_count. = 0; |
| 1000 | controls->fire_primary_down_timecxx . . $ game_controls#fire_primary_down_time. = 0; |
| 1001 | controls->fire_primary_down_statecxx . . $ game_controls#fire_primary_down_state. = false; |
| 1002 | controls->fire_secondary_down_countcxx . . $ game_controls#fire_secondary_down_count. = 0; |
| 1003 | controls->fire_secondary_down_timecxx . . $ game_controls#fire_secondary_down_time. = 0; |
| 1004 | controls->fire_flare_down_countcxx . . $ game_controls#fire_flare_down_count. = 0; |
| 1005 | |
| 1006 | // only read controls in game interface mode. |
| 1007 | if (Game_interface_modecxx . . $ Game_interface_mode. != GAME_INTERFACEcxx . . $ `Descent3/gamesequence.h:129:9`!) |
| 1008 | return; |
| 1009 | |
| 1010 | // Reads in values to Controls structure |
| 1011 | if (!Doing_input_messagecxx . . $ Doing_input_message.) |
| 1012 | DoKeyboardWeaponscxx . . $ DoKeyboardWeapons(728771fc1cd83448).(controls); |
| 1013 | |
| 1014 | DoControllerWeaponscxx . . $ DoControllerWeapons(728771fc1cd83448).(controls); |
| 1015 | } |
| 1016 | |
| 1017 | void DoKeyboardWeaponscxx . . $ DoKeyboardWeapons(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 1018 | ct_packetcxx . . $ ct_packet# fire_primary_key_time; |
| 1019 | ct_packetcxx . . $ ct_packet# fire_secondary_key_time; |
| 1020 | ct_packetcxx . . $ ct_packet# fire_flare_key_count; |
| 1021 | ct_packetcxx . . $ ct_packet# automap_key; |
| 1022 | ct_packetcxx . . $ ct_packet# cycle_prim, cycle_sec; |
| 1023 | int i; |
| 1024 | |
| 1025 | // read controls |
| 1026 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFIREPRIMARY_KEYcxx . . $ ctfFIREPRIMARY_KEY., &fire_primary_key_time); |
| 1027 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFIRESECONDARY_KEYcxx . . $ ctfFIRESECONDARY_KEY., &fire_secondary_key_time); |
| 1028 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFIREFLARE_KEYcxx . . $ ctfFIREFLARE_KEY., &fire_flare_key_count); |
| 1029 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUTOMAP_KEYcxx . . $ ctfAUTOMAP_KEY., &automap_key); |
| 1030 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfWPNSEL_PCYCLEKEYcxx . . $ ctfWPNSEL_PCYCLEKEY., &cycle_prim); |
| 1031 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfWPNSEL_SCYCLEKEYcxx . . $ ctfWPNSEL_SCYCLEKEY., &cycle_sec); |
| 1032 | |
| 1033 | // weapon fire |
| 1034 | if (fire_primary_key_time.valuecxx . . $ ct_packet#value. > 0) { |
| 1035 | controls->fire_primary_down_statecxx . . $ game_controls#fire_primary_down_state. = true; |
| 1036 | controls->fire_primary_down_countcxx . . $ game_controls#fire_primary_down_count. = 1; |
| 1037 | controls->fire_primary_down_timecxx . . $ game_controls#fire_primary_down_time. = fire_primary_key_time.valuecxx . . $ ct_packet#value.; |
| 1038 | } |
| 1039 | |
| 1040 | if (fire_secondary_key_time.valuecxx . . $ ct_packet#value. > 0) { |
| 1041 | controls->fire_secondary_down_countcxx . . $ game_controls#fire_secondary_down_count. = 1; |
| 1042 | controls->fire_secondary_down_timecxx . . $ game_controls#fire_secondary_down_time. = fire_secondary_key_time.valuecxx . . $ ct_packet#value.; |
| 1043 | } |
| 1044 | |
| 1045 | // flare |
| 1046 | controls->fire_flare_down_countcxx . . $ game_controls#fire_flare_down_count. = fire_flare_key_count.valuecxx . . $ ct_packet#value.; |
| 1047 | |
| 1048 | // automap |
| 1049 | if (automap_key.valuecxx . . $ ct_packet#value.) { |
| 1050 | Game_interface_modecxx . . $ Game_interface_mode. = GAME_TELCOM_AUTOMAPcxx . . $ `Descent3/gamesequence.h:135:9`!; |
| 1051 | } |
| 1052 | |
| 1053 | // do cycling weapons |
| 1054 | for (i = 0; i < (int)cycle_prim.valuecxx . . $ ct_packet#value.; i++) |
| 1055 | SwitchPlayerWeaponcxx . . $ SwitchPlayerWeapon(7864480464b09eea).(PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!); |
| 1056 | |
| 1057 | for (i = 0; i < (int)cycle_sec.valuecxx . . $ ct_packet#value.; i++) |
| 1058 | SwitchPlayerWeaponcxx . . $ SwitchPlayerWeapon(7864480464b09eea).(PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!); |
| 1059 | } |
| 1060 | |
| 1061 | void DoControllerWeaponscxx . . $ DoControllerWeapons(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 1062 | ct_packetcxx . . $ ct_packet# fire_primary_count, fire_primary_time; |
| 1063 | ct_packetcxx . . $ ct_packet# fire_secondary_count, fire_secondary_time; |
| 1064 | ct_packetcxx . . $ ct_packet# fire_flare_count; |
| 1065 | ct_packetcxx . . $ ct_packet# cycle_prim, cycle_sec; |
| 1066 | ct_packetcxx . . $ ct_packet# automap_key; |
| 1067 | int i; |
| 1068 | |
| 1069 | // read controls |
| 1070 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFIREPRIMARY_BUTTONcxx . . $ ctfFIREPRIMARY_BUTTON., &fire_primary_time); |
| 1071 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFIREPRIMARY_BUTTONcxx . . $ ctfFIREPRIMARY_BUTTON., &fire_primary_count, ctDownCountcxx . . $ ctDownCount.); |
| 1072 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFIRESECONDARY_BUTTONcxx . . $ ctfFIRESECONDARY_BUTTON., &fire_secondary_time); |
| 1073 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFIRESECONDARY_BUTTONcxx . . $ ctfFIRESECONDARY_BUTTON., &fire_secondary_count, ctDownCountcxx . . $ ctDownCount.); |
| 1074 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfFIREFLARE_BUTTONcxx . . $ ctfFIREFLARE_BUTTON., &fire_flare_count, ctDownCountcxx . . $ ctDownCount.); |
| 1075 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfWPNSEL_PCYCLEBTNcxx . . $ ctfWPNSEL_PCYCLEBTN., &cycle_prim); |
| 1076 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfWPNSEL_SCYCLEBTNcxx . . $ ctfWPNSEL_SCYCLEBTN., &cycle_sec); |
| 1077 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUTOMAP_BUTTONcxx . . $ ctfAUTOMAP_BUTTON., &automap_key); |
| 1078 | |
| 1079 | // weapon fire |
| 1080 | if (fire_primary_count.valuecxx . . $ ct_packet#value. > 0 || fire_primary_time.valuecxx . . $ ct_packet#value.) { |
| 1081 | controls->fire_primary_down_statecxx . . $ game_controls#fire_primary_down_state. = true; |
| 1082 | controls->fire_primary_down_countcxx . . $ game_controls#fire_primary_down_count. = (int)fire_primary_count.valuecxx . . $ ct_packet#value.; |
| 1083 | controls->fire_primary_down_timecxx . . $ game_controls#fire_primary_down_time. = fire_primary_time.valuecxx . . $ ct_packet#value.; |
| 1084 | } |
| 1085 | if (fire_secondary_count.valuecxx . . $ ct_packet#value. > 0 || fire_secondary_time.valuecxx . . $ ct_packet#value.) { |
| 1086 | controls->fire_secondary_down_countcxx . . $ game_controls#fire_secondary_down_count. = (int)fire_secondary_count.valuecxx . . $ ct_packet#value.; |
| 1087 | controls->fire_secondary_down_timecxx . . $ game_controls#fire_secondary_down_time. = fire_secondary_time.valuecxx . . $ ct_packet#value.; |
| 1088 | } |
| 1089 | |
| 1090 | // Flare |
| 1091 | if (fire_flare_count.valuecxx . . $ ct_packet#value. > 0) |
| 1092 | controls->fire_flare_down_countcxx . . $ game_controls#fire_flare_down_count. = (int)fire_flare_count.valuecxx . . $ ct_packet#value.; |
| 1093 | |
| 1094 | // automap |
| 1095 | if (automap_key.valuecxx . . $ ct_packet#value.) { |
| 1096 | Game_interface_modecxx . . $ Game_interface_mode. = GAME_TELCOM_AUTOMAPcxx . . $ `Descent3/gamesequence.h:135:9`!; |
| 1097 | } |
| 1098 | |
| 1099 | // do cycling weapons |
| 1100 | for (i = 0; i < (int)cycle_prim.valuecxx . . $ ct_packet#value.; i++) |
| 1101 | SwitchPlayerWeaponcxx . . $ SwitchPlayerWeapon(7864480464b09eea).(PW_PRIMARYcxx . . $ `Descent3/player_external.h:108:9`!); |
| 1102 | |
| 1103 | for (i = 0; i < (int)cycle_sec.valuecxx . . $ ct_packet#value.; i++) |
| 1104 | SwitchPlayerWeaponcxx . . $ SwitchPlayerWeapon(7864480464b09eea).(PW_SECONDARYcxx . . $ `Descent3/player_external.h:109:9`!); |
| 1105 | } |
| 1106 | |
| 1107 | void DoMisccxx . . $ DoMisc(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 1108 | controls->toggle_slidecxx . . $ game_controls#toggle_slide. = false; |
| 1109 | controls->toggle_bankcxx . . $ game_controls#toggle_bank. = false; |
| 1110 | controls->rearview_down_countcxx . . $ game_controls#rearview_down_count. = 0; |
| 1111 | controls->rearview_down_statecxx . . $ game_controls#rearview_down_state. = false; |
| 1112 | |
| 1113 | if (!Doing_input_messagecxx . . $ Doing_input_message.) |
| 1114 | DoKeyboardMisccxx . . $ DoKeyboardMisc(728771fc1cd83448).(controls); |
| 1115 | DoControllerMisccxx . . $ DoControllerMisc(728771fc1cd83448).(controls); |
| 1116 | |
| 1117 | //@@ if (!toggle_rearview_switch.value && Rearview_key_down) { |
| 1118 | //@@ Rearview_key_down = false; |
| 1119 | //@@ ToggleRearView(0); |
| 1120 | //@@ } |
| 1121 | //@@ else if (toggle_rearview_switch.value && !Rearview_key_down) { |
| 1122 | //@@ Rearview_key_down = true; |
| 1123 | //@@ ToggleRearView(1); |
| 1124 | //@@ } |
| 1125 | //@@ else if (!Rearview_key_down) { |
| 1126 | //@@ for (i = 0; i < (int)toggle_rearview.value; i++) |
| 1127 | //@@ ToggleRearView(); |
| 1128 | //@@ } |
| 1129 | } |
| 1130 | |
| 1131 | // use the currently selected inventory item |
| 1132 | extern bool UseInventoryItemcxx . . $ UseInventoryItem(c9857a73d68e59ba).(); |
| 1133 | // use the currently selected countermeasure |
| 1134 | extern bool UseCountermeasurecxx . . $ UseCountermeasure(c9857a73d68e59ba).(); |
| 1135 | |
| 1136 | // Inventory/CounterMeasure states |
| 1137 | void DoKeyboardMisccxx . . $ DoKeyboardMisc(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 1138 | static int energy_to_shields_id = -1; |
| 1139 | int type, id, i; |
| 1140 | |
| 1141 | ct_packetcxx . . $ ct_packet# prev_inv_key, next_inv_key; |
| 1142 | ct_packetcxx . . $ ct_packet# prev_cntm_key, next_cntm_key; |
| 1143 | ct_packetcxx . . $ ct_packet# use_inv_key, use_inv_key_digital, use_cntm_key, use_taunt[4]; |
| 1144 | ct_packetcxx . . $ ct_packet# toggle_headlight; |
| 1145 | ct_packetcxx . . $ ct_packet# toggle_rearview, toggle_rearview_switch; |
| 1146 | ct_packetcxx . . $ ct_packet# key_slide1, key_bank; |
| 1147 | |
| 1148 | // read controls |
| 1149 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfPREV_INVKEYcxx . . $ ctfPREV_INVKEY., &prev_inv_key); |
| 1150 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfNEXT_INVKEYcxx . . $ ctfNEXT_INVKEY., &next_inv_key); |
| 1151 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfPREV_CNTMSKEYcxx . . $ ctfPREV_CNTMSKEY., &prev_cntm_key); |
| 1152 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfNEXT_CNTMSKEYcxx . . $ ctfNEXT_CNTMSKEY., &next_cntm_key); |
| 1153 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfINV_USEKEYcxx . . $ ctfINV_USEKEY., &use_inv_key); |
| 1154 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfINV_USEKEYcxx . . $ ctfINV_USEKEY., &use_inv_key_digital, ctDigitalcxx . . $ ctDigital.); |
| 1155 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfCNTMS_USEKEYcxx . . $ ctfCNTMS_USEKEY., &use_cntm_key); |
| 1156 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfHEADLIGHT_KEYcxx . . $ ctfHEADLIGHT_KEY., &toggle_headlight); |
| 1157 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfREARVIEW_KEYcxx . . $ ctfREARVIEW_KEY., &toggle_rearview); |
| 1158 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfREARVIEW_KEYcxx . . $ ctfREARVIEW_KEY., &toggle_rearview_switch, ctDigitalcxx . . $ ctDigital.); |
| 1159 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUDIOTAUNT1_KEYcxx . . $ ctfAUDIOTAUNT1_KEY., &use_taunt[0]); |
| 1160 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUDIOTAUNT2_KEYcxx . . $ ctfAUDIOTAUNT2_KEY., &use_taunt[1]); |
| 1161 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUDIOTAUNT3_KEYcxx . . $ ctfAUDIOTAUNT3_KEY., &use_taunt[2]); |
| 1162 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUDIOTAUNT4_KEYcxx . . $ ctfAUDIOTAUNT4_KEY., &use_taunt[3]); |
| 1163 | |
| 1164 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfTOGGLE_SLIDEKEYcxx . . $ ctfTOGGLE_SLIDEKEY., &key_slide1); |
| 1165 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfTOGGLE_BANKKEYcxx . . $ ctfTOGGLE_BANKKEY., &key_bank); |
| 1166 | |
| 1167 | // check modifiers like toggles |
| 1168 | if (key_slide1.valuecxx . . $ ct_packet#value.) { |
| 1169 | controls->toggle_slidecxx . . $ game_controls#toggle_slide. = true; |
| 1170 | } |
| 1171 | if (key_bank.valuecxx . . $ ct_packet#value.) { |
| 1172 | controls->toggle_bankcxx . . $ game_controls#toggle_bank. = true; |
| 1173 | } |
| 1174 | |
| 1175 | // downcount, only once for audiotaunts |
| 1176 | if (use_taunt[0].valuecxx . . $ ct_packet#value. != 0.0f) { |
| 1177 | MultiSendRequestPlayTauntcxx . . $ MultiSendRequestPlayTaunt(d4f767463ce0a6b3).(0); |
| 1178 | } |
| 1179 | if (use_taunt[1].valuecxx . . $ ct_packet#value. != 0.0f) { |
| 1180 | MultiSendRequestPlayTauntcxx . . $ MultiSendRequestPlayTaunt(d4f767463ce0a6b3).(1); |
| 1181 | } |
| 1182 | if (use_taunt[2].valuecxx . . $ ct_packet#value. != 0.0f) { |
| 1183 | MultiSendRequestPlayTauntcxx . . $ MultiSendRequestPlayTaunt(d4f767463ce0a6b3).(2); |
| 1184 | } |
| 1185 | if (use_taunt[3].valuecxx . . $ ct_packet#value. != 0.0f) { |
| 1186 | MultiSendRequestPlayTauntcxx . . $ MultiSendRequestPlayTaunt(d4f767463ce0a6b3).(3); |
| 1187 | } |
| 1188 | |
| 1189 | // these are all down count values (so do operation X times) |
| 1190 | for (i = 0; i < (int)prev_cntm_key.valuecxx . . $ ct_packet#value.; i++) |
| 1191 | CounterMeasuresSwitchcxx . . $ CounterMeasuresSwitch(b45ddcbc8423892c).(false); |
| 1192 | |
| 1193 | for (i = 0; i < (int)next_cntm_key.valuecxx . . $ ct_packet#value.; i++) |
| 1194 | CounterMeasuresSwitchcxx . . $ CounterMeasuresSwitch(b45ddcbc8423892c).(true); |
| 1195 | |
| 1196 | for (i = 0; i < (int)use_cntm_key.valuecxx . . $ ct_packet#value.; i++) |
| 1197 | UseCountermeasurecxx . . $ UseCountermeasure(c9857a73d68e59ba).(); |
| 1198 | |
| 1199 | for (i = 0; i < (int)prev_inv_key.valuecxx . . $ ct_packet#value.; i++) { |
| 1200 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..Sizecxx . . $ Inventory#Size(b126dc7c1de90089).() == 1) { |
| 1201 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosNamecxx . . $ Inventory#GetPosName(41208ce6ca65dd58).()) |
| 1202 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNSELECTcxx . . $ `Descent3/stringtable.h:273:9`!, Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosNamecxx . . $ Inventory#GetPosName(41208ce6ca65dd58).()); |
| 1203 | } |
| 1204 | InventorySwitchcxx . . $ InventorySwitch(b45ddcbc8423892c).(false); |
| 1205 | } |
| 1206 | |
| 1207 | for (i = 0; i < (int)next_inv_key.valuecxx . . $ ct_packet#value.; i++) { |
| 1208 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..Sizecxx . . $ Inventory#Size(b126dc7c1de90089).() == 1) { |
| 1209 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosNamecxx . . $ Inventory#GetPosName(41208ce6ca65dd58).()) |
| 1210 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNSELECTcxx . . $ `Descent3/stringtable.h:273:9`!, Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosNamecxx . . $ Inventory#GetPosName(41208ce6ca65dd58).()); |
| 1211 | } |
| 1212 | InventorySwitchcxx . . $ InventorySwitch(b45ddcbc8423892c).(true); |
| 1213 | } |
| 1214 | |
| 1215 | // do energy to shield hack |
| 1216 | if (energy_to_shields_id == -1) { |
| 1217 | energy_to_shields_id = FindObjectIDNamecxx . . $ FindObjectIDName(5c4306d8553b3696).("Converter"); |
| 1218 | } |
| 1219 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosTypeIDcxx . . $ Inventory#GetPosTypeID(8a990ad1ed500b42).(type, id); |
| 1220 | if (use_inv_key_digital.valuecxx . . $ ct_packet#value.) { |
| 1221 | if (type == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && id == energy_to_shields_id) { |
| 1222 | // the player has an energy->shields converter |
| 1223 | DoEnergyToShieldscxx . . $ DoEnergyToShields(d4f767463ce0a6b3).(Player_numcxx . . $ Player_num.); |
| 1224 | } |
| 1225 | } |
| 1226 | |
| 1227 | // do standard inventory use. |
| 1228 | for (i = 0; i < (int)use_inv_key.valuecxx . . $ ct_packet#value.; i++) { |
| 1229 | // Inventory use is special cased for Energy->Shields converter |
| 1230 | if (type == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && id == energy_to_shields_id) { |
| 1231 | continue; |
| 1232 | } else { |
| 1233 | // handle use inventory keypress |
| 1234 | UseInventoryItemcxx . . $ UseInventoryItem(c9857a73d68e59ba).(); |
| 1235 | } |
| 1236 | } |
| 1237 | |
| 1238 | for (i = 0; i < (int)toggle_headlight.valuecxx . . $ ct_packet#value.; i++) |
| 1239 | ToggleHeadlightControlStatecxx . . $ ToggleHeadlightControlState(49f6e7a06ebc5aa8).(); |
| 1240 | |
| 1241 | // rear view toggling. |
| 1242 | controls->rearview_down_countcxx . . $ game_controls#rearview_down_count. += toggle_rearview.valuecxx . . $ ct_packet#value.; |
| 1243 | controls->rearview_down_statecxx . . $ game_controls#rearview_down_state. = toggle_rearview_switch.valuecxx . . $ ct_packet#value. ? true : false; |
| 1244 | } |
| 1245 | |
| 1246 | void DoControllerMisccxx . . $ DoControllerMisc(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 1247 | static int energy_to_shields_id = -1; |
| 1248 | int i; |
| 1249 | |
| 1250 | ct_packetcxx . . $ ct_packet# prev_inv, next_inv; |
| 1251 | ct_packetcxx . . $ ct_packet# prev_cntm, next_cntm; |
| 1252 | ct_packetcxx . . $ ct_packet# use_inv, use_cntm; |
| 1253 | ct_packetcxx . . $ ct_packet# toggle_headlight; |
| 1254 | ct_packetcxx . . $ ct_packet# toggle_rearview, toggle_rearview_switch; |
| 1255 | ct_packetcxx . . $ ct_packet# ctl_bank, ctl_slide, use_taunt[4]; |
| 1256 | |
| 1257 | // read controls |
| 1258 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfPREV_INVBTNcxx . . $ ctfPREV_INVBTN., &prev_inv); |
| 1259 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfNEXT_INVBTNcxx . . $ ctfNEXT_INVBTN., &next_inv); |
| 1260 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfPREV_CNTMSBTNcxx . . $ ctfPREV_CNTMSBTN., &prev_cntm); |
| 1261 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfNEXT_CNTMSBTNcxx . . $ ctfNEXT_CNTMSBTN., &next_cntm); |
| 1262 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfINV_USEBTNcxx . . $ ctfINV_USEBTN., &use_inv); |
| 1263 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfCNTMS_USEBTNcxx . . $ ctfCNTMS_USEBTN., &use_cntm); |
| 1264 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfHEADLIGHT_BUTTONcxx . . $ ctfHEADLIGHT_BUTTON., &toggle_headlight); |
| 1265 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfREARVIEW_BTNcxx . . $ ctfREARVIEW_BTN., &toggle_rearview); |
| 1266 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfREARVIEW_BTNcxx . . $ ctfREARVIEW_BTN., &toggle_rearview_switch, ctDigitalcxx . . $ ctDigital.); |
| 1267 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUDIOTAUNT1_BTNcxx . . $ ctfAUDIOTAUNT1_BTN., &use_taunt[0]); |
| 1268 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUDIOTAUNT2_BTNcxx . . $ ctfAUDIOTAUNT2_BTN., &use_taunt[1]); |
| 1269 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUDIOTAUNT3_BTNcxx . . $ ctfAUDIOTAUNT3_BTN., &use_taunt[2]); |
| 1270 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfAUDIOTAUNT4_BTNcxx . . $ ctfAUDIOTAUNT4_BTN., &use_taunt[3]); |
| 1271 | |
| 1272 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfTOGGLE_SLIDEBUTTONcxx . . $ ctfTOGGLE_SLIDEBUTTON., &ctl_slide); |
| 1273 | Controllercxx . . $ Controller.->get_packetcxx . . $ gameController#get_packet(c1da47aee99b4b74).(ctfTOGGLE_BANKBUTTONcxx . . $ ctfTOGGLE_BANKBUTTON., &ctl_bank); |
| 1274 | |
| 1275 | // check modifiers like toggles |
| 1276 | if (ctl_slide.valuecxx . . $ ct_packet#value.) { |
| 1277 | controls->toggle_slidecxx . . $ game_controls#toggle_slide. = true; |
| 1278 | } |
| 1279 | if (ctl_bank.valuecxx . . $ ct_packet#value.) { |
| 1280 | controls->toggle_bankcxx . . $ game_controls#toggle_bank. = true; |
| 1281 | } |
| 1282 | |
| 1283 | // downcount, only once for audiotaunts |
| 1284 | if (use_taunt[0].valuecxx . . $ ct_packet#value. != 0.0f) { |
| 1285 | MultiSendRequestPlayTauntcxx . . $ MultiSendRequestPlayTaunt(d4f767463ce0a6b3).(0); |
| 1286 | } |
| 1287 | if (use_taunt[1].valuecxx . . $ ct_packet#value. != 0.0f) { |
| 1288 | MultiSendRequestPlayTauntcxx . . $ MultiSendRequestPlayTaunt(d4f767463ce0a6b3).(1); |
| 1289 | } |
| 1290 | if (use_taunt[2].valuecxx . . $ ct_packet#value. != 0.0f) { |
| 1291 | MultiSendRequestPlayTauntcxx . . $ MultiSendRequestPlayTaunt(d4f767463ce0a6b3).(2); |
| 1292 | } |
| 1293 | if (use_taunt[3].valuecxx . . $ ct_packet#value. != 0.0f) { |
| 1294 | MultiSendRequestPlayTauntcxx . . $ MultiSendRequestPlayTaunt(d4f767463ce0a6b3).(3); |
| 1295 | } |
| 1296 | |
| 1297 | // these are all down count values (so do operation X times) |
| 1298 | for (i = 0; i < (int)prev_cntm.valuecxx . . $ ct_packet#value.; i++) |
| 1299 | CounterMeasuresSwitchcxx . . $ CounterMeasuresSwitch(b45ddcbc8423892c).(false); |
| 1300 | |
| 1301 | for (i = 0; i < (int)next_cntm.valuecxx . . $ ct_packet#value.; i++) |
| 1302 | CounterMeasuresSwitchcxx . . $ CounterMeasuresSwitch(b45ddcbc8423892c).(true); |
| 1303 | |
| 1304 | for (i = 0; i < (int)use_cntm.valuecxx . . $ ct_packet#value.; i++) |
| 1305 | UseCountermeasurecxx . . $ UseCountermeasure(c9857a73d68e59ba).(); |
| 1306 | |
| 1307 | for (i = 0; i < (int)prev_inv.valuecxx . . $ ct_packet#value.; i++) { |
| 1308 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..Sizecxx . . $ Inventory#Size(b126dc7c1de90089).() == 1) { |
| 1309 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosNamecxx . . $ Inventory#GetPosName(41208ce6ca65dd58).()) |
| 1310 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNSELECTcxx . . $ `Descent3/stringtable.h:273:9`!, Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosNamecxx . . $ Inventory#GetPosName(41208ce6ca65dd58).()); |
| 1311 | } |
| 1312 | InventorySwitchcxx . . $ InventorySwitch(b45ddcbc8423892c).(false); |
| 1313 | } |
| 1314 | |
| 1315 | for (i = 0; i < (int)next_inv.valuecxx . . $ ct_packet#value.; i++) { |
| 1316 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..Sizecxx . . $ Inventory#Size(b126dc7c1de90089).() == 1) { |
| 1317 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosNamecxx . . $ Inventory#GetPosName(41208ce6ca65dd58).()) |
| 1318 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_WPNSELECTcxx . . $ `Descent3/stringtable.h:273:9`!, Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosNamecxx . . $ Inventory#GetPosName(41208ce6ca65dd58).()); |
| 1319 | } |
| 1320 | InventorySwitchcxx . . $ InventorySwitch(b45ddcbc8423892c).(true); |
| 1321 | } |
| 1322 | |
| 1323 | for (i = 0; i < (int)use_inv.valuecxx . . $ ct_packet#value.; i++) { |
| 1324 | int type, id; |
| 1325 | |
| 1326 | if (energy_to_shields_id == -1) |
| 1327 | energy_to_shields_id = FindObjectIDNamecxx . . $ FindObjectIDName(5c4306d8553b3696).("Converter"); |
| 1328 | |
| 1329 | // Inventory use is special cased for Energy->Shields converter |
| 1330 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].inventorycxx . . $ player#inventory..GetPosTypeIDcxx . . $ Inventory#GetPosTypeID(8a990ad1ed500b42).(type, id); |
| 1331 | if (type == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && id == energy_to_shields_id) { |
| 1332 | // the player has an energy->shields converter |
| 1333 | DoEnergyToShieldscxx . . $ DoEnergyToShields(d4f767463ce0a6b3).(Player_numcxx . . $ Player_num.); |
| 1334 | } else { |
| 1335 | // handle use inventory keypress |
| 1336 | UseInventoryItemcxx . . $ UseInventoryItem(c9857a73d68e59ba).(); |
| 1337 | } |
| 1338 | } |
| 1339 | |
| 1340 | for (i = 0; i < (int)toggle_headlight.valuecxx . . $ ct_packet#value.; i++) |
| 1341 | ToggleHeadlightControlStatecxx . . $ ToggleHeadlightControlState(49f6e7a06ebc5aa8).(); |
| 1342 | |
| 1343 | // rear view toggling. |
| 1344 | controls->rearview_down_countcxx . . $ game_controls#rearview_down_count. += toggle_rearview.valuecxx . . $ ct_packet#value.; |
| 1345 | if (!controls->rearview_down_statecxx . . $ game_controls#rearview_down_state.) |
| 1346 | controls->rearview_down_statecxx . . $ game_controls#rearview_down_state. = toggle_rearview_switch.valuecxx . . $ ct_packet#value. ? true : false; |
| 1347 | } |
| 1348 | |
| 1349 | // sets the internal controller config to the current pilot's configuration. |
| 1350 | void LoadControlConfigcxx . . $ LoadControlConfig(1794bc617d3f3266).(pilotcxx . . $ pilot# *plt) { |
| 1351 | int j; |
| 1352 | if (!plt) |
| 1353 | plt = &Current_pilotcxx . . $ Current_pilot.; |
| 1354 | |
| 1355 | for (int i = 0; i < NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS.; i++) { |
| 1356 | int id = Current_pilotcxx . . $ Current_pilot..controlscxx . . $ pilot#controls.[i].idcxx . . $ cntrldata#id.; |
| 1357 | ct_typecxx . . $ ct_type# type[2]; |
| 1358 | ct_config_datacxx . . $ ct_config_data# ccfgdata; |
| 1359 | uint8_tcxx . . $ uint8_t# flags[2]; |
| 1360 | |
| 1361 | type[0] = plt->controlscxx . . $ pilot#controls.[i].typecxx . . $ cntrldata#type.[0]; |
| 1362 | type[1] = plt->controlscxx . . $ pilot#controls.[i].typecxx . . $ cntrldata#type.[1]; |
| 1363 | ccfgdata = plt->controlscxx . . $ pilot#controls.[i].valuecxx . . $ cntrldata#value.; |
| 1364 | flags[0] = plt->controlscxx . . $ pilot#controls.[i].flagscxx . . $ cntrldata#flags.[0]; |
| 1365 | flags[1] = plt->controlscxx . . $ pilot#controls.[i].flagscxx . . $ cntrldata#flags.[1]; |
| 1366 | |
| 1367 | Controllercxx . . $ Controller.->set_controller_functioncxx . . $ gameController#set_controller_function(a87bf4975f40b925).(id, type, ccfgdata, flags); |
| 1368 | } |
| 1369 | for (j = 0; j < N_MOUSE_AXIScxx . . $ `Descent3/pilot_class.h:128:9`!; j++) { |
| 1370 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctMouseAxiscxx . . $ ctMouseAxis., j + 1, plt->mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[j]); |
| 1371 | } |
| 1372 | for (j = 0; j < N_JOY_AXIScxx . . $ `Descent3/pilot_class.h:129:9`!; j++) { |
| 1373 | Controllercxx . . $ Controller.->set_axis_sensitivitycxx . . $ gameController#set_axis_sensitivity(b979151824fed4c4).(ctAxiscxx . . $ ctAxis., j + 1, plt->joy_sensitivitycxx . . $ pilot#joy_sensitivity.[j]); |
| 1374 | } |
| 1375 | |
| 1376 | Key_ramp_speedcxx . . $ Key_ramp_speed. = plt->key_rampingcxx . . $ pilot#key_ramping.; |
| 1377 | } |
| 1378 | |
| 1379 | // saves the internal controller config of current pilot. if the controller changes, then calling |
| 1380 | // LoadControlConfig will restore ONLY VALID configurations. |
| 1381 | void SaveControlConfigcxx . . $ SaveControlConfig(1794bc617d3f3266).(pilotcxx . . $ pilot# *plt) { |
| 1382 | int j; |
| 1383 | if (!plt) |
| 1384 | plt = &Current_pilotcxx . . $ Current_pilot.; |
| 1385 | |
| 1386 | for (int i = 0; i < NUM_CONTROLLER_FUNCTIONScxx . . $ NUM_CONTROLLER_FUNCTIONS.; i++) { |
| 1387 | ct_typecxx . . $ ct_type# ctype[2]; |
| 1388 | ct_config_datacxx . . $ ct_config_data# ccfgdata; |
| 1389 | uint8_tcxx . . $ uint8_t# flags[2]; |
| 1390 | Controllercxx . . $ Controller.->get_controller_functioncxx . . $ gameController#get_controller_function(c004c324aa6068e0).(Controller_needscxx . . $ Controller_needs.[i].idcxx . . $ ct_function#id., ctype, &ccfgdata, flags); |
| 1391 | |
| 1392 | plt->controlscxx . . $ pilot#controls.[i].idcxx . . $ cntrldata#id. = Controller_needscxx . . $ Controller_needs.[i].idcxx . . $ ct_function#id.; |
| 1393 | plt->controlscxx . . $ pilot#controls.[i].typecxx . . $ cntrldata#type.[0] = ctype[0]; |
| 1394 | plt->controlscxx . . $ pilot#controls.[i].typecxx . . $ cntrldata#type.[1] = ctype[1]; |
| 1395 | plt->controlscxx . . $ pilot#controls.[i].valuecxx . . $ cntrldata#value. = ccfgdata; |
| 1396 | plt->controlscxx . . $ pilot#controls.[i].flagscxx . . $ cntrldata#flags.[0] = flags[0]; |
| 1397 | plt->controlscxx . . $ pilot#controls.[i].flagscxx . . $ cntrldata#flags.[1] = flags[1]; |
| 1398 | } |
| 1399 | |
| 1400 | for (j = 0; j < N_MOUSE_AXIScxx . . $ `Descent3/pilot_class.h:128:9`!; j++) { |
| 1401 | float sens = Controllercxx . . $ Controller.->get_axis_sensitivitycxx . . $ gameController#get_axis_sensitivity(13d73da2a9b3a1ee).(ctMouseAxiscxx . . $ ctMouseAxis., j + 1); |
| 1402 | plt->mouse_sensitivitycxx . . $ pilot#mouse_sensitivity.[j] = sens; |
| 1403 | } |
| 1404 | for (j = 0; j < N_JOY_AXIScxx . . $ `Descent3/pilot_class.h:129:9`!; j++) { |
| 1405 | float sens = Controllercxx . . $ Controller.->get_axis_sensitivitycxx . . $ gameController#get_axis_sensitivity(13d73da2a9b3a1ee).(ctAxiscxx . . $ ctAxis., j + 1); |
| 1406 | plt->joy_sensitivitycxx . . $ pilot#joy_sensitivity.[j] = sens; |
| 1407 | } |
| 1408 | |
| 1409 | plt->key_rampingcxx . . $ pilot#key_ramping. = Key_ramp_speedcxx . . $ Key_ramp_speed.; |
| 1410 | } |
| 1411 | |
| 1412 | void ToggleHeadlightControlStatecxx . . $ ToggleHeadlightControlState(49f6e7a06ebc5aa8).() { |
| 1413 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_HEADLIGHT_STOLENcxx . . $ `Descent3/player_external.h:91:9`!) { |
| 1414 | // player has no headlight right now |
| 1415 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_DONTHAVEHEADLIGHTcxx . . $ `Descent3/stringtable.h:844:9`!); |
| 1416 | return; |
| 1417 | } |
| 1418 | |
| 1419 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_HEADLIGHTcxx . . $ `Descent3/player_external.h:90:9`!) |
| 1420 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. &= ~PLAYER_FLAGS_HEADLIGHTcxx . . $ `Descent3/player_external.h:90:9`!; |
| 1421 | else |
| 1422 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. |= PLAYER_FLAGS_HEADLIGHTcxx . . $ `Descent3/player_external.h:90:9`!; |
| 1423 | |
| 1424 | Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(SOUND_HEADLIGHTcxx . . $ `Descent3/sounds.h:123:9`!); |
| 1425 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_HEADLIGHTTURNEDcxx . . $ `Descent3/stringtable.h:531:9`!, |
| 1426 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].flagscxx . . $ player#flags. & PLAYER_FLAGS_HEADLIGHTcxx . . $ `Descent3/player_external.h:90:9`! ? TXT_STRING_ONcxx . . $ `Descent3/stringtable.h:532:9`! : TXT_STRING_OFFcxx . . $ `Descent3/stringtable.h:533:9`!); |
| 1427 | } |