| 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/D3ForceFeedback.cpp $ |
| 21 | * $Revision: 19 $ |
| 22 | * $Date: 5/10/99 9:25p $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * High level force-feedback implementation |
| 26 | * |
| 27 | * $Log: /DescentIII/main/D3ForceFeedback.cpp $ |
| 28 | * |
| 29 | * 19 5/10/99 9:25p Jeff |
| 30 | * first phase of Rock 'n' Ride support added |
| 31 | * |
| 32 | * 18 4/24/99 7:45p Jeff |
| 33 | * fixed recoil |
| 34 | * |
| 35 | * 17 4/21/99 11:05a Kevin |
| 36 | * new ps_rand and ps_srand to replace rand & srand |
| 37 | * |
| 38 | * 16 4/15/99 1:38a Jeff |
| 39 | * changes for linux compile |
| 40 | * |
| 41 | * 15 4/12/99 1:06p Jeff |
| 42 | * hooked force feedback into recoil of weapon struct |
| 43 | * |
| 44 | * 14 3/28/99 5:53p Jeff |
| 45 | * fixed iforce crashes |
| 46 | * |
| 47 | * 13 2/09/99 3:32p Jeff |
| 48 | * table file parser takes quotes strings for force keywords |
| 49 | * |
| 50 | * 12 2/05/99 7:04p Jeff |
| 51 | * table file parsing macros put in |
| 52 | * |
| 53 | * 11 1/30/99 11:27p Jeff |
| 54 | * added immersion support |
| 55 | * |
| 56 | * 10 1/28/99 12:09p Jeff |
| 57 | * added force feedback to player shake...fixed spelling error in define |
| 58 | * for forcefeedback |
| 59 | * |
| 60 | * 9 1/25/99 7:28p Jeff |
| 61 | * fixed alt-tab bug (finally)...wasn't releasing effects on alt-tab out, |
| 62 | * and re-creating them on restart |
| 63 | * |
| 64 | * 8 11/18/98 5:50p Jeff |
| 65 | * added some cheap recoil effects for ForceFeedback...not fully |
| 66 | * implemented |
| 67 | * |
| 68 | * 7 11/10/98 5:16p Jeff |
| 69 | * updated forcefeedback system...pretty complete now |
| 70 | * |
| 71 | * 6 11/06/98 7:00p Jeff |
| 72 | * first round of new force feedback installed |
| 73 | * |
| 74 | * 5 11/03/98 6:43p Jeff |
| 75 | * new low-level & high level Force Feedback system implemented, handles |
| 76 | * window losing focus, etc. |
| 77 | * |
| 78 | * 4 10/12/98 3:49p Jeff |
| 79 | * struct changes |
| 80 | * |
| 81 | * 3 9/21/98 11:09a Jeff |
| 82 | * general update, new low level, small high level implementation |
| 83 | * |
| 84 | * 2 9/18/98 7:38p Jeff |
| 85 | * creation of low-level forcefeedback and beginning of high-level |
| 86 | * forcefeedback |
| 87 | * |
| 88 | * $NoKeywords: $ |
| 89 | */ |
| 90 | |
| 91 | #include <stdlib.h> |
| 92 | |
| 93 | #include "forcefeedback.h"cxx . . $ `<file>/lib/forcefeedback.h`/ |
| 94 | #include "D3ForceFeedback.h"cxx . . $ `<file>/Descent3/D3ForceFeedback.h`/ |
| 95 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 96 | #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/ |
| 97 | #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/ |
| 98 | #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/ |
| 99 | #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/ |
| 100 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 101 | |
| 102 | extern float Gametimecxx . . $ Gametime.; |
| 103 | |
| 104 | // D3Force_init |
| 105 | // true if ForceInit() has been called, meaning hi-level ForceFeedback has been initialized |
| 106 | // and any of the Hi-Level ForceFeedback commands can be called. |
| 107 | bool D3Force_initcxx . . $ D3Force_init. = false; |
| 108 | |
| 109 | // D3Force_pause |
| 110 | // true if the ForceFeedback effects are currently being paused. ForceContinue() must be called |
| 111 | // before any other ForceFeedback functions are called. |
| 112 | bool D3Force_pausecxx . . $ D3Force_pause. = false; |
| 113 | |
| 114 | // D3Force_auto_center |
| 115 | // true if the user wants his joystick to be autocentered (if available) |
| 116 | bool D3Force_auto_centercxx . . $ D3Force_auto_center. = false; |
| 117 | |
| 118 | // D3Force_gain |
| 119 | // the gain setting of the ForceFeedback system |
| 120 | float D3Force_gaincxx . . $ D3Force_gain. = 1.0f; |
| 121 | |
| 122 | // D3Use_force_feedback |
| 123 | // true if the user wants force feedback during play (if available) |
| 124 | bool D3Use_force_feedbackcxx . . $ D3Use_force_feedback. = true; |
| 125 | |
| 126 | int Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[DDIO_FF_MAXEFFECTScxx . . $ `lib/forcefeedback.h:82:9`!]; |
| 127 | |
| 128 | // ----------------------------------------------------------------- |
| 129 | // ForceInit |
| 130 | // Purpose: |
| 131 | // Initializes the Hi-Level Force Feedback system, creating all |
| 132 | // of the effects so they are ready to be used. |
| 133 | // ----------------------------------------------------------------- |
| 134 | void ForceInitcxx . . $ ForceInit(49f6e7a06ebc5aa8).(void) { |
| 135 | static bool first_call = true; |
| 136 | |
| 137 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(!D3Force_init); |
| 138 | |
| 139 | bool dd_found, dd_enabled; |
| 140 | ddio_ff_GetInfocxx . . $ ddio_ff_GetInfo(4bbb0be6c29741a8).(&dd_found, &dd_enabled); |
| 141 | |
| 142 | if (dd_found) { |
| 143 | D3Force_initcxx . . $ D3Force_init. = true; |
| 144 | D3Force_pausecxx . . $ D3Force_pause. = false; |
| 145 | |
| 146 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Force: High Level Force Feedback system initialized\n"); |
| 147 | } else { |
| 148 | D3Force_initcxx . . $ D3Force_init. = false; |
| 149 | D3Force_pausecxx . . $ D3Force_pause. = false; |
| 150 | |
| 151 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Force: Force Feedback System Not Found\n"); |
| 152 | } |
| 153 | |
| 154 | for (int i = 0; i < DDIO_FF_MAXEFFECTScxx . . $ `lib/forcefeedback.h:82:9`!; i++) { |
| 155 | Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[i] = -1; |
| 156 | } |
| 157 | |
| 158 | ForceEffectsInitcxx . . $ ForceEffectsInit(49f6e7a06ebc5aa8).(); |
| 159 | |
| 160 | if (D3Force_initcxx . . $ D3Force_init.) { |
| 161 | // Enable/Disable the force feedback |
| 162 | // --------------------------------- |
| 163 | if (D3Use_force_feedbackcxx . . $ D3Use_force_feedback.) |
| 164 | ForceEnablecxx . . $ ForceEnable(49f6e7a06ebc5aa8).(); |
| 165 | else |
| 166 | ForceDisablecxx . . $ ForceDisable(49f6e7a06ebc5aa8).(); |
| 167 | |
| 168 | // Enable/Disable AutoCentering |
| 169 | // ---------------------------- |
| 170 | if (D3Force_auto_centercxx . . $ D3Force_auto_center.) |
| 171 | ForceEnableAutoCentercxx . . $ ForceEnableAutoCenter(49f6e7a06ebc5aa8).(); |
| 172 | else |
| 173 | ForceDisableAutoCentercxx . . $ ForceDisableAutoCenter(49f6e7a06ebc5aa8).(); |
| 174 | |
| 175 | // Set ForceFeedback Gain |
| 176 | // ---------------------- |
| 177 | ForceSetGaincxx . . $ ForceSetGain(9364e6e7bff7660).(D3Force_gaincxx . . $ D3Force_gain.); |
| 178 | } |
| 179 | |
| 180 | if (first_call) { |
| 181 | first_call = false; |
| 182 | atexitcxx . . $ atexit(cc8c495369588262).(ForceClosecxx . . $ ForceClose(49f6e7a06ebc5aa8).); |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | // ----------------------------------------------------------------- |
| 187 | // ForceClose |
| 188 | // Purpose: |
| 189 | // Shutsdown the Hi-Level Force Feedback system |
| 190 | // ----------------------------------------------------------------- |
| 191 | void ForceClosecxx . . $ ForceClose(49f6e7a06ebc5aa8).(void) { |
| 192 | if (!D3Force_initcxx . . $ D3Force_init.) |
| 193 | return; |
| 194 | |
| 195 | D3Force_pausecxx . . $ D3Force_pause. = false; |
| 196 | D3Force_initcxx . . $ D3Force_init. = false; |
| 197 | |
| 198 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Force: Shutting down high level force feedback\n"); |
| 199 | ForceEffectsClosecxx . . $ ForceEffectsClose(49f6e7a06ebc5aa8).(); |
| 200 | |
| 201 | for (int i = 0; i < DDIO_FF_MAXEFFECTScxx . . $ `lib/forcefeedback.h:82:9`!; i++) { |
| 202 | Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[i] = -1; |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | // ----------------------------------------------------------------- |
| 207 | // ForceShutdown |
| 208 | // Purpose: |
| 209 | // Puts the Force Feedback system on pause while the application |
| 210 | // is doing other things (like it lost focus) |
| 211 | // ----------------------------------------------------------------- |
| 212 | void ForceShutdowncxx . . $ ForceShutdown(49f6e7a06ebc5aa8).(void) { |
| 213 | D3Force_pausecxx . . $ D3Force_pause. = true; |
| 214 | |
| 215 | ForceClosecxx . . $ ForceClose(49f6e7a06ebc5aa8).(); |
| 216 | if (D3Force_initcxx . . $ D3Force_init.) { |
| 217 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Force: Shutting down Force Feedback System\n"); |
| 218 | ddio_ffb_Pausecxx . . $ ddio_ffb_Pause(f43dad817d2338e0).(kJoy1cxx . . $ kJoy1.); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | // ------------------------------------------------------------------ |
| 223 | // ForceRestart |
| 224 | // Purpose: |
| 225 | // Restores the Force Feedback system that has been put on pause |
| 226 | // from ForceShutdown. |
| 227 | // ------------------------------------------------------------------ |
| 228 | void ForceRestartcxx . . $ ForceRestart(49f6e7a06ebc5aa8).(void) { |
| 229 | D3Force_pausecxx . . $ D3Force_pause. = false; |
| 230 | |
| 231 | if (D3Force_initcxx . . $ D3Force_init.) { |
| 232 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Force: Restarting Force Feedback System\n"); |
| 233 | ddio_ff_Acquirecxx . . $ ddio_ff_Acquire(26fe897a51c542a4).(kJoy1cxx . . $ kJoy1.); |
| 234 | ddio_ffb_Continuecxx . . $ ddio_ffb_Continue(f43dad817d2338e0).(kJoy1cxx . . $ kJoy1.); |
| 235 | |
| 236 | // Enable/Disable the force feedback |
| 237 | // --------------------------------- |
| 238 | if (D3Use_force_feedbackcxx . . $ D3Use_force_feedback.) |
| 239 | ForceEnablecxx . . $ ForceEnable(49f6e7a06ebc5aa8).(); |
| 240 | else |
| 241 | ForceDisablecxx . . $ ForceDisable(49f6e7a06ebc5aa8).(); |
| 242 | |
| 243 | // Enable/Disable AutoCentering |
| 244 | // ---------------------------- |
| 245 | if (D3Force_auto_centercxx . . $ D3Force_auto_center.) |
| 246 | ForceEnableAutoCentercxx . . $ ForceEnableAutoCenter(49f6e7a06ebc5aa8).(); |
| 247 | else |
| 248 | ForceDisableAutoCentercxx . . $ ForceDisableAutoCenter(49f6e7a06ebc5aa8).(); |
| 249 | |
| 250 | // Set ForceFeedback Gain |
| 251 | // ---------------------- |
| 252 | ForceSetGaincxx . . $ ForceSetGain(9364e6e7bff7660).(D3Force_gaincxx . . $ D3Force_gain.); |
| 253 | } |
| 254 | |
| 255 | ForceInitcxx . . $ ForceInit(49f6e7a06ebc5aa8).(); |
| 256 | } |
| 257 | |
| 258 | // ------------------------------------------------------------------ |
| 259 | // ForceDisable |
| 260 | // Purpose: |
| 261 | // Disables Force Feedback on a Force Feedback system |
| 262 | // ------------------------------------------------------------------ |
| 263 | void ForceDisablecxx . . $ ForceDisable(49f6e7a06ebc5aa8).(void) { |
| 264 | if (D3Force_initcxx . . $ D3Force_init.) { |
| 265 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Force: Disabling Force Feedback System\n"); |
| 266 | //@@ddio_ffb_Disable(kJoy1); |
| 267 | D3Use_force_feedbackcxx . . $ D3Use_force_feedback. = false; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | // ------------------------------------------------------------------ |
| 272 | // ForceEnable |
| 273 | // Purpose: |
| 274 | // Enables Force Feedback that has been previously disabled |
| 275 | // ------------------------------------------------------------------ |
| 276 | void ForceEnablecxx . . $ ForceEnable(49f6e7a06ebc5aa8).(void) { |
| 277 | if (D3Force_initcxx . . $ D3Force_init.) { |
| 278 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Force: Enabling Force Feedback System\n"); |
| 279 | //@@ddio_ffb_Enable(kJoy1); |
| 280 | D3Use_force_feedbackcxx . . $ D3Use_force_feedback. = true; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | // ------------------------------------------------------------------ |
| 285 | // ForceDisableAutoCenter |
| 286 | // Purpose: |
| 287 | // Disables autocentering on the joystick |
| 288 | // ------------------------------------------------------------------ |
| 289 | void ForceDisableAutoCentercxx . . $ ForceDisableAutoCenter(49f6e7a06ebc5aa8).(void) { |
| 290 | if (D3Force_initcxx . . $ D3Force_init.) { |
| 291 | D3Force_auto_centercxx . . $ D3Force_auto_center. = false; |
| 292 | |
| 293 | ddio_ffjoy_EnableAutoCentercxx . . $ ddio_ffjoy_EnableAutoCenter(d995ce785ab4d998).(kJoy1cxx . . $ kJoy1., false); |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | // ------------------------------------------------------------------ |
| 298 | // ForceEnableAutoCenter |
| 299 | // Purpose: |
| 300 | // Enables autocentering on the joystick |
| 301 | // ------------------------------------------------------------------ |
| 302 | void ForceEnableAutoCentercxx . . $ ForceEnableAutoCenter(49f6e7a06ebc5aa8).(void) { |
| 303 | if (D3Force_initcxx . . $ D3Force_init.) { |
| 304 | D3Force_auto_centercxx . . $ D3Force_auto_center. = true; |
| 305 | |
| 306 | ddio_ffjoy_EnableAutoCentercxx . . $ ddio_ffjoy_EnableAutoCenter(d995ce785ab4d998).(kJoy1cxx . . $ kJoy1., true); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | // ------------------------------------------------------------------ |
| 311 | // ForceIsEnabled |
| 312 | // Purpose: |
| 313 | // Returns true if Force Feedback is enabled on the system |
| 314 | // ------------------------------------------------------------------ |
| 315 | bool ForceIsEnabledcxx . . $ ForceIsEnabled(c9857a73d68e59ba).(void) { return D3Use_force_feedbackcxx . . $ D3Use_force_feedback.; } |
| 316 | |
| 317 | // ------------------------------------------------------------------ |
| 318 | // ForceIsAutoCenter |
| 319 | // Purpose: |
| 320 | // Returns true if Force Feedback joystick is autocentering |
| 321 | // ------------------------------------------------------------------ |
| 322 | bool ForceIsAutoCentercxx . . $ ForceIsAutoCenter(c9857a73d68e59ba).(void) { return D3Force_auto_centercxx . . $ D3Force_auto_center.; } |
| 323 | |
| 324 | // ------------------------------------------------------------------ |
| 325 | // ForceSetGain |
| 326 | // Purpose: |
| 327 | // Sets the gain of the ForceFeedback system (0 -> 1) |
| 328 | // ------------------------------------------------------------------ |
| 329 | void ForceSetGaincxx . . $ ForceSetGain(9364e6e7bff7660).(float val) { |
| 330 | if (val < 0.0f) |
| 331 | val = 0.0f; |
| 332 | if (val > 1.0f) |
| 333 | val = 1.0f; |
| 334 | |
| 335 | D3Force_gaincxx . . $ D3Force_gain. = val; |
| 336 | ddio_ffjoy_SetGaincxx . . $ ddio_ffjoy_SetGain(95a5e220a55e1aa2).(kJoy1cxx . . $ kJoy1., D3Force_gaincxx . . $ D3Force_gain.); |
| 337 | } |
| 338 | |
| 339 | // ------------------------------------------------------------------ |
| 340 | // ForceGetGain |
| 341 | // Purpose: |
| 342 | // Returns the current gain setting of the ForceFeedback system (0-1) |
| 343 | // ------------------------------------------------------------------ |
| 344 | float ForceGetGaincxx . . $ ForceGetGain(9b8c9e39889c762c).(void) { return D3Force_gaincxx . . $ D3Force_gain.; } |
| 345 | |
| 346 | /* |
| 347 | ============================================================================= |
| 348 | */ |
| 349 | |
| 350 | // ----------------------------------------------------------------- |
| 351 | // ForceEffectsClose |
| 352 | // Purpose: |
| 353 | // Destroys all the effects created |
| 354 | // ----------------------------------------------------------------- |
| 355 | void ForceEffectsClosecxx . . $ ForceEffectsClose(49f6e7a06ebc5aa8).(void) { ddio_ffb_DestroyAllcxx . . $ ddio_ffb_DestroyAll(49f6e7a06ebc5aa8).(); } |
| 356 | |
| 357 | // ----------------------------------------------------------------- |
| 358 | // ForceEffectsPlay |
| 359 | // Purpose: |
| 360 | // Plays an effect |
| 361 | // ----------------------------------------------------------------- |
| 362 | void ForceEffectsPlaycxx . . $ ForceEffectsPlay(7f0b50ce5e93e2bf).(int id, float *scale, int *direction) { |
| 363 | if (!D3Force_initcxx . . $ D3Force_init. || !D3Use_force_feedbackcxx . . $ D3Use_force_feedback.) |
| 364 | return; |
| 365 | |
| 366 | if (id < 0 || id >= DDIO_FF_MAXEFFECTScxx . . $ `lib/forcefeedback.h:82:9`!) |
| 367 | return; |
| 368 | |
| 369 | int low_id = Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[id]; |
| 370 | if (low_id == -1) |
| 371 | return; |
| 372 | |
| 373 | if (scale || direction) { |
| 374 | uint32_tcxx . . $ uint32_t# *ns = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 375 | uint32_tcxx . . $ uint32_t# new_gain; |
| 376 | |
| 377 | if (scale) { |
| 378 | new_gain = (uint32_tcxx . . $ uint32_t#)(10000.0f * (*scale)); |
| 379 | ns = &new_gain; |
| 380 | } |
| 381 | |
| 382 | ddio_ffb_effectModifycxx . . $ ddio_ffb_effectModify(8430b8f3687e862e).(low_id, direction, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, ns, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 383 | } |
| 384 | |
| 385 | ddio_ffb_effectPlaycxx . . $ ddio_ffb_effectPlay(68e3ae50fe6578a9).(low_id); |
| 386 | } |
| 387 | void ForceEffectsPlaycxx . . $ ForceEffectsPlay(7a6f7eb6ea9dc250).(int id, float *scale, vectorcxx . . $ vector# *direction) { |
| 388 | if (!D3Force_initcxx . . $ D3Force_init. || !D3Use_force_feedbackcxx . . $ D3Use_force_feedback.) |
| 389 | return; |
| 390 | |
| 391 | if (id < 0 || id >= DDIO_FF_MAXEFFECTScxx . . $ `lib/forcefeedback.h:82:9`!) |
| 392 | return; |
| 393 | |
| 394 | int low_id = Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[id]; |
| 395 | if (low_id == -1) |
| 396 | return; |
| 397 | |
| 398 | int new_dir = -1; |
| 399 | |
| 400 | if (direction) { |
| 401 | matrixcxx . . $ matrix# mat = Identity_matrixcxx . . $ Identity_matrix.; |
| 402 | angveccxx . . $ angvec# ag; |
| 403 | |
| 404 | vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&mat, direction); |
| 405 | vm_ExtractAnglesFromMatrixcxx . . $ vm_ExtractAnglesFromMatrix(5f9a6d6f613ae256).(&ag, &mat); |
| 406 | |
| 407 | new_dir = ((((float)ag.hcxx . . $ angvec#h.) / 65535.0f) * 360.0f); |
| 408 | |
| 409 | new_dir = (new_dir)*FF_DEGREEScxx . . $ `lib/forcefeedback.h:90:9`!; |
| 410 | } |
| 411 | |
| 412 | if (scale || direction) { |
| 413 | int *d = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 414 | uint32_tcxx . . $ uint32_t# *ns = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 415 | uint32_tcxx . . $ uint32_t# new_gain; |
| 416 | |
| 417 | if (direction) |
| 418 | d = &new_dir; |
| 419 | |
| 420 | if (scale) { |
| 421 | new_gain = (uint32_tcxx . . $ uint32_t#)(10000.0f * (*scale)); |
| 422 | ns = &new_gain; |
| 423 | } |
| 424 | |
| 425 | ddio_ffb_effectModifycxx . . $ ddio_ffb_effectModify(8430b8f3687e862e).(low_id, d, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, ns, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 426 | } |
| 427 | |
| 428 | ddio_ffb_effectPlaycxx . . $ ddio_ffb_effectPlay(68e3ae50fe6578a9).(low_id); |
| 429 | } |
| 430 | |
| 431 | void DoForceForWeaponcxx . . $ DoForceForWeapon(a24d58fc7aeaec6).(objectcxx . . $ object# *me_obj, objectcxx . . $ object# *it_obj, vectorcxx . . $ vector# *force_vec) { |
| 432 | if (it_obj->idcxx . . $ object#id. < 0 || it_obj->idcxx . . $ object#id. >= MAX_WEAPONScxx . . $ `Descent3/weapon.h:208:9`!) |
| 433 | return; |
| 434 | |
| 435 | weaponcxx . . $ weapon# *weap = &Weaponscxx . . $ Weapons.[it_obj->idcxx . . $ object#id.]; |
| 436 | |
| 437 | if (weap->flagscxx . . $ weapon#flags. & WF_MICROWAVEcxx . . $ `Descent3/weapon.h:237:9`!) { |
| 438 | vectorcxx . . $ vector# local_norm, v; |
| 439 | float scale = 1.00f; |
| 440 | v.xcxx . . $ vector#x. = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10; |
| 441 | v.ycxx . . $ vector#y. = 0; |
| 442 | v.zcxx . . $ vector#z. = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10; |
| 443 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&v); |
| 444 | vm_MatrixMulVectorcxx . . $ vm_MatrixMulVector(76352432a16beb64).(&local_norm, &v, &me_obj->orientcxx . . $ object#orient.); |
| 445 | |
| 446 | local_norm *=cxx . . $ `operator*=`(f132838b2cd11d6). -1.0f; |
| 447 | |
| 448 | ForceEffectsPlaycxx . . $ ForceEffectsPlay(7a6f7eb6ea9dc250).(FORCE_MICROWAVEcxx . . $ `Descent3/D3ForceFeedback.h:78:9`!, &scale, &local_norm); |
| 449 | return; |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | void DoForceForWallcxx . . $ DoForceForWall(13f0d3ae53d6a4f9).(objectcxx . . $ object# *playerobj, float hitspeed, int hitseg, int hitwall, vectorcxx . . $ vector# *wall_normal) { |
| 454 | vectorcxx . . $ vector# local_norm; |
| 455 | float scale = 1.00f; |
| 456 | |
| 457 | if (hitspeed < 20) |
| 458 | return; |
| 459 | |
| 460 | scale = hitspeed / 80.0f; |
| 461 | if (scale < 0.0f) |
| 462 | scale = 0.0f; |
| 463 | if (scale > 1.0f) |
| 464 | scale = 1.0f; |
| 465 | |
| 466 | vm_MatrixMulVectorcxx . . $ vm_MatrixMulVector(76352432a16beb64).(&local_norm, wall_normal, &playerobj->orientcxx . . $ object#orient.); |
| 467 | local_norm *=cxx . . $ `operator*=`(f132838b2cd11d6). -1.0f; |
| 468 | |
| 469 | ForceEffectsPlaycxx . . $ ForceEffectsPlay(7a6f7eb6ea9dc250).(FORCE_WALLHITcxx . . $ `Descent3/D3ForceFeedback.h:79:9`!, &scale, &local_norm); |
| 470 | } |
| 471 | |
| 472 | void DoForceForRecoilcxx . . $ DoForceForRecoil(6273fa812ac58a8).(objectcxx . . $ object# *playerobj, objectcxx . . $ object# *weap) { |
| 473 | weaponcxx . . $ weapon# *w_ptr = &Weaponscxx . . $ Weapons.[weap->idcxx . . $ object#id.]; |
| 474 | |
| 475 | vectorcxx . . $ vector# local_norm; |
| 476 | float scale; |
| 477 | #define MIN_RECOILcxx . . $ `Descent3/D3ForceFeedback.cpp:477:9`! 1000.0f |
| 478 | #define MAX_RECOILcxx . . $ `Descent3/D3ForceFeedback.cpp:478:9`! 5000.0f |
| 479 | #define RECOIL_THRESHOLDcxx . . $ `Descent3/D3ForceFeedback.cpp:479:9`! 1100.0f |
| 480 | |
| 481 | if (w_ptr->recoil_forcecxx . . $ weapon#recoil_force. < RECOIL_THRESHOLDcxx . . $ `Descent3/D3ForceFeedback.cpp:479:9`!) |
| 482 | return; |
| 483 | |
| 484 | vectorcxx . . $ vector# offset = weap->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). playerobj->poscxx . . $ object#pos.; |
| 485 | vm_MatrixMulVectorcxx . . $ vm_MatrixMulVector(76352432a16beb64).(&local_norm, &offset, &playerobj->orientcxx . . $ object#orient.); |
| 486 | |
| 487 | if (weap->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) |
| 488 | return; |
| 489 | |
| 490 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(w_ptr->recoil_force >= MIN_RECOILcxx . . $ `Descent3/D3ForceFeedback.cpp:477:9`! && w_ptr->recoil_force <= MAX_RECOILcxx . . $ `Descent3/D3ForceFeedback.cpp:478:9`!); |
| 491 | scale = (w_ptr->recoil_forcecxx . . $ weapon#recoil_force. - MIN_RECOILcxx . . $ `Descent3/D3ForceFeedback.cpp:477:9`!) / (MAX_RECOILcxx . . $ `Descent3/D3ForceFeedback.cpp:478:9`! - MIN_RECOILcxx . . $ `Descent3/D3ForceFeedback.cpp:477:9`!); |
| 492 | |
| 493 | ForceEffectsPlaycxx . . $ ForceEffectsPlay(7a6f7eb6ea9dc250).(FORCE_WEAPON_RECOILcxx . . $ `Descent3/D3ForceFeedback.h:80:9`!, &scale, &local_norm); |
| 494 | } |
| 495 | |
| 496 | float Force_time_since_last_shakecxx . . $ Force_time_since_last_shake.; |
| 497 | #define SHAKE_TIMEcxx . . $ `Descent3/D3ForceFeedback.cpp:497:9`! 0.2f |
| 498 | void DoForceForShakecxx . . $ DoForceForShake(9364e6e7bff7660).(float magnitude) { |
| 499 | if (Force_time_since_last_shakecxx . . $ Force_time_since_last_shake. + SHAKE_TIMEcxx . . $ `Descent3/D3ForceFeedback.cpp:497:9`! > Gametimecxx . . $ Gametime.) { |
| 500 | if (Force_time_since_last_shakecxx . . $ Force_time_since_last_shake. < Gametimecxx . . $ Gametime.) { |
| 501 | return; |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | Force_time_since_last_shakecxx . . $ Force_time_since_last_shake. = Gametimecxx . . $ Gametime.; |
| 506 | |
| 507 | vectorcxx . . $ vector# local_norm; |
| 508 | |
| 509 | if (magnitude < 0.0f) |
| 510 | magnitude = 0.0f; |
| 511 | if (magnitude > 1.0f) |
| 512 | magnitude = 1.0f; |
| 513 | |
| 514 | local_norm.xcxx . . $ vector#x. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 5); |
| 515 | local_norm.ycxx . . $ vector#y. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 5); |
| 516 | local_norm.zcxx . . $ vector#z. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 5); |
| 517 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&local_norm); |
| 518 | |
| 519 | ForceEffectsPlaycxx . . $ ForceEffectsPlay(7a6f7eb6ea9dc250).(FORCE_SHIPSHAKEcxx . . $ `Descent3/D3ForceFeedback.h:83:9`!, &magnitude, &local_norm); |
| 520 | } |
| 521 | |
| 522 | //************************************************************************ |
| 523 | |
| 524 | void FFECreate_Testcxx . . $ FFECreate_Test(4bdf064ef2440822).(tFFB_Effectcxx . . $ tFFB_Effect# *ef) { |
| 525 | memset(ef, 0, sizeof(tFFB_Effectcxx . . $ tFFB_Effect#)); |
| 526 | |
| 527 | ef->Typecxx . . $ tFFB_Effect#Type. = kConstantcxx . . $ kConstant.; |
| 528 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Constantcxx . . $ tEffInfo#Constant..Magcxx . . $ tEffConstant#Mag. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 529 | ef->Durationcxx . . $ tFFB_Effect#Duration. = 0.1 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 530 | ef->Gaincxx . . $ tFFB_Effect#Gain. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 531 | ef->Periodcxx . . $ tFFB_Effect#Period. = 0; |
| 532 | ef->Axiscxx . . $ tFFB_Effect#Axis. = kBothAxescxx . . $ kBothAxes.; |
| 533 | ef->Triggercxx . . $ tFFB_Effect#Trigger. = kNoButtoncxx . . $ kNoButton.; |
| 534 | ef->Directioncxx . . $ tFFB_Effect#Direction. = 0; |
| 535 | } |
| 536 | |
| 537 | void FFECreate_Microwavecxx . . $ FFECreate_Microwave(4bdf064ef2440822).(tFFB_Effectcxx . . $ tFFB_Effect# *ef) { |
| 538 | memset(ef, 0, sizeof(tFFB_Effectcxx . . $ tFFB_Effect#)); |
| 539 | |
| 540 | ef->Flagscxx . . $ tFFB_Effect#Flags. = FF_USEENVELOPEcxx . . $ `lib/forcefeedback.h:80:9`!; |
| 541 | ef->Typecxx . . $ tFFB_Effect#Type. = kWave_Sinecxx . . $ kWave_Sine.; |
| 542 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Magcxx . . $ tEffWave#Mag. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 543 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Offsetcxx . . $ tEffWave#Offset. = 0; |
| 544 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Phasecxx . . $ tEffWave#Phase. = 0; |
| 545 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Periodcxx . . $ tEffWave#Period. = 0.2 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 546 | |
| 547 | ef->Durationcxx . . $ tFFB_Effect#Duration. = 0.6 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 548 | ef->Gaincxx . . $ tFFB_Effect#Gain. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 549 | ef->Periodcxx . . $ tFFB_Effect#Period. = 0; |
| 550 | ef->Axiscxx . . $ tFFB_Effect#Axis. = kBothAxescxx . . $ kBothAxes.; |
| 551 | ef->Triggercxx . . $ tFFB_Effect#Trigger. = kNoButtoncxx . . $ kNoButton.; |
| 552 | ef->Directioncxx . . $ tFFB_Effect#Direction. = 0; |
| 553 | |
| 554 | ef->Envelopecxx . . $ tFFB_Effect#Envelope..AttackLevelcxx . . $ tEffEnvelope#AttackLevel. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`! * 0.5f; |
| 555 | ef->Envelopecxx . . $ tFFB_Effect#Envelope..AttackTimecxx . . $ tEffEnvelope#AttackTime. = 0; |
| 556 | ef->Envelopecxx . . $ tFFB_Effect#Envelope..FadeLevelcxx . . $ tEffEnvelope#FadeLevel. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`! * 0.1f; |
| 557 | ef->Envelopecxx . . $ tFFB_Effect#Envelope..FadeTimecxx . . $ tEffEnvelope#FadeTime. = 0.6 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 558 | } |
| 559 | |
| 560 | void FFECreate_Wallhitcxx . . $ FFECreate_Wallhit(4bdf064ef2440822).(tFFB_Effectcxx . . $ tFFB_Effect# *ef) { |
| 561 | memset(ef, 0, sizeof(tFFB_Effectcxx . . $ tFFB_Effect#)); |
| 562 | |
| 563 | ef->Typecxx . . $ tFFB_Effect#Type. = kConstantcxx . . $ kConstant.; |
| 564 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Constantcxx . . $ tEffInfo#Constant..Magcxx . . $ tEffConstant#Mag. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 565 | ef->Durationcxx . . $ tFFB_Effect#Duration. = 0.1 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 566 | ef->Gaincxx . . $ tFFB_Effect#Gain. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 567 | ef->Periodcxx . . $ tFFB_Effect#Period. = 0; |
| 568 | ef->Axiscxx . . $ tFFB_Effect#Axis. = kBothAxescxx . . $ kBothAxes.; |
| 569 | ef->Triggercxx . . $ tFFB_Effect#Trigger. = kNoButtoncxx . . $ kNoButton.; |
| 570 | ef->Directioncxx . . $ tFFB_Effect#Direction. = 0; |
| 571 | } |
| 572 | |
| 573 | void FFECreate_WeaponRecoilcxx . . $ FFECreate_WeaponRecoil(4bdf064ef2440822).(tFFB_Effectcxx . . $ tFFB_Effect# *ef) { |
| 574 | memset(ef, 0, sizeof(tFFB_Effectcxx . . $ tFFB_Effect#)); |
| 575 | |
| 576 | ef->Typecxx . . $ tFFB_Effect#Type. = kConstantcxx . . $ kConstant.; |
| 577 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Constantcxx . . $ tEffInfo#Constant..Magcxx . . $ tEffConstant#Mag. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 578 | ef->Durationcxx . . $ tFFB_Effect#Duration. = 0.1 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 579 | ef->Gaincxx . . $ tFFB_Effect#Gain. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 580 | ef->Periodcxx . . $ tFFB_Effect#Period. = 0; |
| 581 | ef->Axiscxx . . $ tFFB_Effect#Axis. = kBothAxescxx . . $ kBothAxes.; |
| 582 | ef->Triggercxx . . $ tFFB_Effect#Trigger. = kNoButtoncxx . . $ kNoButton.; |
| 583 | ef->Directioncxx . . $ tFFB_Effect#Direction. = 0; |
| 584 | } |
| 585 | |
| 586 | void FFECreate_VaussRecoilcxx . . $ FFECreate_VaussRecoil(4bdf064ef2440822).(tFFB_Effectcxx . . $ tFFB_Effect# *ef) { |
| 587 | memset(ef, 0, sizeof(tFFB_Effectcxx . . $ tFFB_Effect#)); |
| 588 | |
| 589 | ef->Typecxx . . $ tFFB_Effect#Type. = kWave_Squarecxx . . $ kWave_Square.; |
| 590 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Magcxx . . $ tEffWave#Mag. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 591 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Offsetcxx . . $ tEffWave#Offset. = 0; |
| 592 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Phasecxx . . $ tEffWave#Phase. = 0; |
| 593 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Periodcxx . . $ tEffWave#Period. = 0.05 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 594 | |
| 595 | ef->Durationcxx . . $ tFFB_Effect#Duration. = 0.2 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 596 | ef->Gaincxx . . $ tFFB_Effect#Gain. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 597 | ef->Periodcxx . . $ tFFB_Effect#Period. = 0; |
| 598 | ef->Axiscxx . . $ tFFB_Effect#Axis. = kBothAxescxx . . $ kBothAxes.; |
| 599 | ef->Triggercxx . . $ tFFB_Effect#Trigger. = kNoButtoncxx . . $ kNoButton.; |
| 600 | ef->Directioncxx . . $ tFFB_Effect#Direction. = 0; |
| 601 | } |
| 602 | |
| 603 | void FFECreate_Afterburnercxx . . $ FFECreate_Afterburner(4bdf064ef2440822).(tFFB_Effectcxx . . $ tFFB_Effect# *ef) { |
| 604 | memset(ef, 0, sizeof(tFFB_Effectcxx . . $ tFFB_Effect#)); |
| 605 | |
| 606 | ef->Typecxx . . $ tFFB_Effect#Type. = kWave_Squarecxx . . $ kWave_Square.; |
| 607 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Magcxx . . $ tEffWave#Mag. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 608 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Offsetcxx . . $ tEffWave#Offset. = 0; |
| 609 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Phasecxx . . $ tEffWave#Phase. = 0; |
| 610 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Periodcxx . . $ tEffWave#Period. = 0.05 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 611 | |
| 612 | ef->Durationcxx . . $ tFFB_Effect#Duration. = 0.2 * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 613 | ef->Gaincxx . . $ tFFB_Effect#Gain. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 614 | ef->Periodcxx . . $ tFFB_Effect#Period. = 0; |
| 615 | ef->Axiscxx . . $ tFFB_Effect#Axis. = kBothAxescxx . . $ kBothAxes.; |
| 616 | ef->Triggercxx . . $ tFFB_Effect#Trigger. = kNoButtoncxx . . $ kNoButton.; |
| 617 | ef->Directioncxx . . $ tFFB_Effect#Direction. = 0; |
| 618 | } |
| 619 | |
| 620 | void FFECreate_ShipShakecxx . . $ FFECreate_ShipShake(4bdf064ef2440822).(tFFB_Effectcxx . . $ tFFB_Effect# *ef) { |
| 621 | memset(ef, 0, sizeof(tFFB_Effectcxx . . $ tFFB_Effect#)); |
| 622 | |
| 623 | ef->Typecxx . . $ tFFB_Effect#Type. = kWave_Sinecxx . . $ kWave_Sine.; |
| 624 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Magcxx . . $ tEffWave#Mag. = (FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`! / 3); |
| 625 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Offsetcxx . . $ tEffWave#Offset. = 0; |
| 626 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Phasecxx . . $ tEffWave#Phase. = 0; |
| 627 | ef->TypeInfocxx . . $ tFFB_Effect#TypeInfo..Wavecxx . . $ tEffInfo#Wave..Periodcxx . . $ tEffWave#Period. = (SHAKE_TIMEcxx . . $ `Descent3/D3ForceFeedback.cpp:497:9`! / 2) * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 628 | |
| 629 | ef->Durationcxx . . $ tFFB_Effect#Duration. = SHAKE_TIMEcxx . . $ `Descent3/D3ForceFeedback.cpp:497:9`! * FF_SECONDScxx . . $ `lib/forcefeedback.h:92:9`!; |
| 630 | ef->Gaincxx . . $ tFFB_Effect#Gain. = FF_NOMINALMAXcxx . . $ `lib/forcefeedback.h:91:9`!; |
| 631 | ef->Periodcxx . . $ tFFB_Effect#Period. = 0; |
| 632 | ef->Axiscxx . . $ tFFB_Effect#Axis. = kBothAxescxx . . $ kBothAxes.; |
| 633 | ef->Triggercxx . . $ tFFB_Effect#Trigger. = kNoButtoncxx . . $ kNoButton.; |
| 634 | ef->Directioncxx . . $ tFFB_Effect#Direction. = 0; |
| 635 | } |
| 636 | |
| 637 | //************************************************************* |
| 638 | // ------------------------------------------------------------------ |
| 639 | // ForceEffectsInit |
| 640 | // Purpose: |
| 641 | // Initializes the force feedback effects for Descent 3 |
| 642 | // ------------------------------------------------------------------ |
| 643 | void ForceEffectsInitcxx . . $ ForceEffectsInit(49f6e7a06ebc5aa8).(void) { |
| 644 | tFFB_Effectcxx . . $ tFFB_Effect# eff; |
| 645 | int lowid; |
| 646 | Force_time_since_last_shakecxx . . $ Force_time_since_last_shake. = 0; |
| 647 | FORCEPROJECTcxx . . $ `lib/forcefeedback.h:94:9`! prj; |
| 648 | char path[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 649 | |
| 650 | if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).("D3Force.ifr"cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) { |
| 651 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(path, Descent3_temp_directorycxx . . $ Descent3_temp_directory., "D3Force.ifr", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 652 | cf_CopyFilecxx . . $ cf_CopyFile(773c05b60430b9f6).(pathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "D3Force.ifr"cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., 0); |
| 653 | prj = ddio_ForceLoadProjectcxx . . $ ddio_ForceLoadProject(a4cb1b1855214071).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(path), kJoy1cxx . . $ kJoy1.); |
| 654 | } else { |
| 655 | prj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 656 | } |
| 657 | /* |
| 658 | $$TABLE_GAMEFILE "D3Force.ifr" |
| 659 | */ |
| 660 | lowid = ddio_CreateForceFromProjectcxx . . $ ddio_CreateForceFromProject(f53b6be6549e6d95).(prj, "Test"); |
| 661 | if (lowid == -1) { |
| 662 | FFECreate_Testcxx . . $ FFECreate_Test(4bdf064ef2440822).(&eff); |
| 663 | lowid = ddio_ffb_effectCreatecxx . . $ ddio_ffb_effectCreate(a1a9b5f9dbd44d87).(kJoy1cxx . . $ kJoy1., &eff); |
| 664 | } |
| 665 | Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[FORCE_TEST_FORCEcxx . . $ `Descent3/D3ForceFeedback.h:77:9`!] = lowid; |
| 666 | |
| 667 | lowid = ddio_CreateForceFromProjectcxx . . $ ddio_CreateForceFromProject(f53b6be6549e6d95).(prj, "Microwave"); |
| 668 | if (lowid == -1) { |
| 669 | FFECreate_Microwavecxx . . $ FFECreate_Microwave(4bdf064ef2440822).(&eff); |
| 670 | lowid = ddio_ffb_effectCreatecxx . . $ ddio_ffb_effectCreate(a1a9b5f9dbd44d87).(kJoy1cxx . . $ kJoy1., &eff); |
| 671 | } |
| 672 | Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[FORCE_MICROWAVEcxx . . $ `Descent3/D3ForceFeedback.h:78:9`!] = lowid; |
| 673 | |
| 674 | lowid = ddio_CreateForceFromProjectcxx . . $ ddio_CreateForceFromProject(f53b6be6549e6d95).(prj, "WallHit"); |
| 675 | if (lowid == -1) { |
| 676 | FFECreate_Wallhitcxx . . $ FFECreate_Wallhit(4bdf064ef2440822).(&eff); |
| 677 | lowid = ddio_ffb_effectCreatecxx . . $ ddio_ffb_effectCreate(a1a9b5f9dbd44d87).(kJoy1cxx . . $ kJoy1., &eff); |
| 678 | } |
| 679 | Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[FORCE_WALLHITcxx . . $ `Descent3/D3ForceFeedback.h:79:9`!] = lowid; |
| 680 | |
| 681 | lowid = ddio_CreateForceFromProjectcxx . . $ ddio_CreateForceFromProject(f53b6be6549e6d95).(prj, "Recoil"); |
| 682 | if (lowid == -1) { |
| 683 | FFECreate_WeaponRecoilcxx . . $ FFECreate_WeaponRecoil(4bdf064ef2440822).(&eff); |
| 684 | lowid = ddio_ffb_effectCreatecxx . . $ ddio_ffb_effectCreate(a1a9b5f9dbd44d87).(kJoy1cxx . . $ kJoy1., &eff); |
| 685 | } |
| 686 | Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[FORCE_WEAPON_RECOILcxx . . $ `Descent3/D3ForceFeedback.h:80:9`!] = lowid; |
| 687 | |
| 688 | lowid = ddio_CreateForceFromProjectcxx . . $ ddio_CreateForceFromProject(f53b6be6549e6d95).(prj, "VaussRecoil"); |
| 689 | if (lowid == -1) { |
| 690 | FFECreate_VaussRecoilcxx . . $ FFECreate_VaussRecoil(4bdf064ef2440822).(&eff); |
| 691 | lowid = ddio_ffb_effectCreatecxx . . $ ddio_ffb_effectCreate(a1a9b5f9dbd44d87).(kJoy1cxx . . $ kJoy1., &eff); |
| 692 | } |
| 693 | Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[FORCE_VAUSS_RECOILcxx . . $ `Descent3/D3ForceFeedback.h:81:9`!] = lowid; |
| 694 | |
| 695 | lowid = ddio_CreateForceFromProjectcxx . . $ ddio_CreateForceFromProject(f53b6be6549e6d95).(prj, "Afterburner"); |
| 696 | if (lowid == -1) { |
| 697 | FFECreate_Afterburnercxx . . $ FFECreate_Afterburner(4bdf064ef2440822).(&eff); |
| 698 | lowid = ddio_ffb_effectCreatecxx . . $ ddio_ffb_effectCreate(a1a9b5f9dbd44d87).(kJoy1cxx . . $ kJoy1., &eff); |
| 699 | } |
| 700 | Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[FORCE_AFTERBURNERcxx . . $ `Descent3/D3ForceFeedback.h:82:9`!] = lowid; |
| 701 | |
| 702 | lowid = ddio_CreateForceFromProjectcxx . . $ ddio_CreateForceFromProject(f53b6be6549e6d95).(prj, "ShipShake"); |
| 703 | if (lowid == -1) { |
| 704 | FFECreate_ShipShakecxx . . $ FFECreate_ShipShake(4bdf064ef2440822).(&eff); |
| 705 | lowid = ddio_ffb_effectCreatecxx . . $ ddio_ffb_effectCreate(a1a9b5f9dbd44d87).(kJoy1cxx . . $ kJoy1., &eff); |
| 706 | } |
| 707 | Force_hi_to_low_mapcxx . . $ Force_hi_to_low_map.[FORCE_SHIPSHAKEcxx . . $ `Descent3/D3ForceFeedback.h:83:9`!] = lowid; |
| 708 | |
| 709 | ddio_ForceUnloadProjectcxx . . $ ddio_ForceUnloadProject(5d22bdacc48458e8).(prj); |
| 710 | if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).(pathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) { |
| 711 | ddio_DeleteFilecxx . . $ ddio_DeleteFile(5c4306d8553b3696).(path); |
| 712 | } |
| 713 | } |