| 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.h $ |
| 21 | * $Revision: 9 $ |
| 22 | * $Date: 1/28/99 12:09p $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * High Level Force Feedback implementation |
| 26 | * |
| 27 | * $Log: /DescentIII/main/D3ForceFeedback.h $ |
| 28 | * |
| 29 | * 9 1/28/99 12:09p Jeff |
| 30 | * added force feedback to player shake...fixed spelling error in define |
| 31 | * for forcefeedback |
| 32 | * |
| 33 | * 8 11/18/98 5:50p Jeff |
| 34 | * added some cheap recoil effects for ForceFeedback...not fully |
| 35 | * implemented |
| 36 | * |
| 37 | * 7 11/10/98 5:16p Jeff |
| 38 | * updated forcefeedback system...pretty complete now |
| 39 | * |
| 40 | * 6 11/06/98 7:00p Jeff |
| 41 | * first round of new force feedback installed |
| 42 | * |
| 43 | * 5 11/03/98 6:43p Jeff |
| 44 | * new low-level & high level Force Feedback system implemented, handles |
| 45 | * window losing focus, etc. |
| 46 | * |
| 47 | * 4 10/12/98 3:49p Jeff |
| 48 | * struct changes |
| 49 | * |
| 50 | * 3 9/21/98 11:10a Jeff |
| 51 | * general update, new low level, small high level implementation |
| 52 | * |
| 53 | * 2 9/18/98 7:38p Jeff |
| 54 | * creation of low-level forcefeedback and beginning of high-level |
| 55 | * forcefeedback |
| 56 | * |
| 57 | * $NoKeywords: $ |
| 58 | */ |
| 59 | |
| 60 | #ifndef __D3FORCEFEEDBACK_H_ |
| 61 | #define __D3FORCEFEEDBACK_H_ |
| 62 | |
| 63 | #include "forcefeedback.h" |
| 64 | #include "vecmat.h" |
| 65 | #include "object.h" |
| 66 | |
| 67 | // D3Use_force_feedback |
| 68 | // true if the user wants force feedback during play (if available) |
| 69 | extern bool D3Use_force_feedback; |
| 70 | // D3Force_auto_center |
| 71 | // true if the user wants his joystick to be autocentered (if available) |
| 72 | extern bool D3Force_auto_center; |
| 73 | // D3Force_gain |
| 74 | // the gain setting of the ForceFeedback system |
| 75 | extern float D3Force_gain; |
| 76 | |
| 77 | #define FORCE_TEST_FORCE 0 |
| 78 | #define FORCE_MICROWAVE 1 |
| 79 | #define FORCE_WALLHIT 2 |
| 80 | #define FORCE_WEAPON_RECOIL 3 |
| 81 | #define FORCE_VAUSS_RECOIL 4 |
| 82 | #define FORCE_AFTERBURNER 5 |
| 83 | #define FORCE_SHIPSHAKE 6 |
| 84 | |
| 85 | // ----------------------------------------------------------------- |
| 86 | // ForceInit |
| 87 | // Purpose: |
| 88 | // Initializes the Hi-Level Force Feedback system, creating all |
| 89 | // of the effects so they are ready to be used. |
| 90 | // ----------------------------------------------------------------- |
| 91 | void ForceInit(void); |
| 92 | |
| 93 | // ----------------------------------------------------------------- |
| 94 | // ForceClose |
| 95 | // Purpose: |
| 96 | // Shutsdown the Hi-Level Force Feedback system |
| 97 | // ----------------------------------------------------------------- |
| 98 | void ForceClose(void); |
| 99 | |
| 100 | // ----------------------------------------------------------------- |
| 101 | // ForceShutdown |
| 102 | // Purpose: |
| 103 | // Puts the Force Feedback system on pause while the application |
| 104 | // is doing other things (like it lost focus) |
| 105 | // ----------------------------------------------------------------- |
| 106 | void ForceShutdown(void); |
| 107 | |
| 108 | // ------------------------------------------------------------------ |
| 109 | // ForceRestart |
| 110 | // Purpose: |
| 111 | // Restores the Force Feedback system that has been put on pause |
| 112 | // from ForceShutdown. |
| 113 | // ------------------------------------------------------------------ |
| 114 | void ForceRestart(void); |
| 115 | |
| 116 | // ------------------------------------------------------------------ |
| 117 | // ForceDisable |
| 118 | // Purpose: |
| 119 | // Disables Force Feedback on a Force Feedback system |
| 120 | // ------------------------------------------------------------------ |
| 121 | void ForceDisable(void); |
| 122 | |
| 123 | // ------------------------------------------------------------------ |
| 124 | // ForceEnable |
| 125 | // Purpose: |
| 126 | // Enables Force Feedback that has been previously disabled |
| 127 | // ------------------------------------------------------------------ |
| 128 | void ForceEnable(void); |
| 129 | |
| 130 | // ------------------------------------------------------------------ |
| 131 | // ForceIsEnabled |
| 132 | // Purpose: |
| 133 | // Returns true if Force Feedback is enabled on the system |
| 134 | // ------------------------------------------------------------------ |
| 135 | bool ForceIsEnabled(void); |
| 136 | |
| 137 | // ------------------------------------------------------------------ |
| 138 | // ForceEnableAutoCenter |
| 139 | // Purpose: |
| 140 | // Enables autocentering on the joystick |
| 141 | // ------------------------------------------------------------------ |
| 142 | void ForceEnableAutoCenter(void); |
| 143 | |
| 144 | // ------------------------------------------------------------------ |
| 145 | // ForceDisableAutoCenter |
| 146 | // Purpose: |
| 147 | // Disables autocentering on the joystick |
| 148 | // ------------------------------------------------------------------ |
| 149 | void ForceDisableAutoCenter(void); |
| 150 | |
| 151 | // ------------------------------------------------------------------ |
| 152 | // ForceIsAutoCenter |
| 153 | // Purpose: |
| 154 | // Returns true if Force Feedback joystick is autocentering |
| 155 | // ------------------------------------------------------------------ |
| 156 | bool ForceIsAutoCenter(void); |
| 157 | |
| 158 | // ------------------------------------------------------------------ |
| 159 | // ForceSetGain |
| 160 | // Purpose: |
| 161 | // Sets the gain of the ForceFeedback system (0 -> 1) |
| 162 | // ------------------------------------------------------------------ |
| 163 | void ForceSetGain(float val); |
| 164 | |
| 165 | // ------------------------------------------------------------------ |
| 166 | // ForceGetGain |
| 167 | // Purpose: |
| 168 | // Returns the current gain setting of the ForceFeedback system (0-1) |
| 169 | // ------------------------------------------------------------------ |
| 170 | float ForceGetGain(void); |
| 171 | |
| 172 | // ------------------------------------------------------------------ |
| 173 | // ForceEffectsInit |
| 174 | // Purpose: |
| 175 | // Initializes the force feedback effects for Descent 3 |
| 176 | // ------------------------------------------------------------------ |
| 177 | void ForceEffectsInit(void); |
| 178 | |
| 179 | // ----------------------------------------------------------------- |
| 180 | // ForceEffectsClose |
| 181 | // Purpose: |
| 182 | // Destroys all the effects created |
| 183 | // ----------------------------------------------------------------- |
| 184 | void ForceEffectsClose(void); |
| 185 | |
| 186 | // ----------------------------------------------------------------- |
| 187 | // ForceEffectsPlay |
| 188 | // Purpose: |
| 189 | // Plays an effect |
| 190 | // ----------------------------------------------------------------- |
| 191 | void ForceEffectsPlay(int id, float *scale, int *direction); |
| 192 | void ForceEffectsPlay(int id, float *scale, vector *direction); |
| 193 | |
| 194 | void DoForceForWeapon(object *me_obj, object *it_obj, vector *force); |
| 195 | void DoForceForWall(object *playerobj, float hitspeed, int hitseg, int hitwall, vector *wall_normal); |
| 196 | void DoForceForRecoil(object *playerobj, object *weap); |
| 197 | void DoForceForShake(float magnitude); |
| 198 | |
| 199 | extern bool D3Use_force_feedback; |
| 200 | |
| 201 | #endif |