| 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/hud.h $ |
| 21 | * $Revision: 67 $ |
| 22 | * $Date: 7/13/99 12:22a $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * <hud.h> |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/hud.h $ |
| 28 | * |
| 29 | * 67 7/13/99 12:22a Jeff |
| 30 | * correctly externed HudInputMessage, increased size for new tokenized |
| 31 | * text macros |
| 32 | * |
| 33 | * 66 5/21/99 11:15p Samir |
| 34 | * savegames save hud timer and special text states. restore too. |
| 35 | * |
| 36 | * 65 5/21/99 4:06p Matt |
| 37 | * For customtext2 HUD items, store the buffer length in the HUD item. |
| 38 | * |
| 39 | * 64 5/21/99 2:58p Matt |
| 40 | * Fixed mis-defined flag that caused the multiplayer menus to not render. |
| 41 | * |
| 42 | * 63 5/20/99 5:48p Matt |
| 43 | * Added a HUD item flag, for use by Dallas-created items, that makes a |
| 44 | * HUD item persisitent for the duration of one level, but get cleared |
| 45 | * between levels. |
| 46 | * |
| 47 | * 62 5/19/99 11:25a Matt |
| 48 | * Added multisafe functions & Dallas actions for showing a timer on the |
| 49 | * screen and adding custom HUD messages. |
| 50 | * |
| 51 | * 61 5/17/99 6:22p Jeff |
| 52 | * added filtered HUD messages |
| 53 | * |
| 54 | * 60 5/08/99 1:04a Samir |
| 55 | * added timers for key presses in message list boxes. |
| 56 | * |
| 57 | * 59 5/07/99 10:48p Matt |
| 58 | * Made add-HUD functions return true if the message was added, and false |
| 59 | * if it wasn't (because the previous message was the same). |
| 60 | * |
| 61 | * 58 4/28/99 2:14a Samir |
| 62 | * save and load Game messages in savegame. |
| 63 | * |
| 64 | * 57 4/24/99 8:43p Samir |
| 65 | * when shrinking screen hud messages get rendered in black region. |
| 66 | * |
| 67 | * 56 4/06/99 11:39a Samir |
| 68 | * added more formatting options for hud items (added two other full |
| 69 | * screen hud infs for different ships) |
| 70 | * |
| 71 | * 55 3/30/99 2:39p Samir |
| 72 | * added custom config file for fullscreen hud and hacked mass driver |
| 73 | * reticle in special reticle code. |
| 74 | * |
| 75 | * 54 3/26/99 12:46p Samir |
| 76 | * configurable reticle. |
| 77 | * |
| 78 | * 53 3/04/99 7:39p Matt |
| 79 | * Added sound effects to FreeSpace-style persistent HUD messages. |
| 80 | * |
| 81 | * 52 3/03/99 5:34p Matt |
| 82 | * Added fade-out for goal complete messages |
| 83 | * |
| 84 | * 51 2/19/99 2:18p Samir |
| 85 | * AddGameMessage implicitly figures out time and level of message. |
| 86 | * |
| 87 | * 50 2/18/99 5:27p Matt |
| 88 | * Added color parm to AddPersistentHUDMessage() and fixed the timeout. |
| 89 | * |
| 90 | * 49 2/16/99 6:15p Jeff |
| 91 | * pause hud messages when in cinematics |
| 92 | * |
| 93 | * 48 2/06/99 6:59p Jeff |
| 94 | * created RenderHUDGetTextLineWidth and RenderHUDGetTextHeight |
| 95 | * |
| 96 | * 47 1/31/99 7:26p Matt |
| 97 | * Renamed a bunch of functions to have HUD capitalized |
| 98 | * |
| 99 | * 46 1/29/99 6:29p Samir |
| 100 | * implemented hud scrollback for hud messages. |
| 101 | * |
| 102 | * 45 1/27/99 6:05p Samir |
| 103 | * added scrollback for game messages on HUD. |
| 104 | * |
| 105 | * 44 1/23/99 2:33p Kevin |
| 106 | * Increased hud message length, because we clip to the real width of the |
| 107 | * hud. Also fixed up the multiline code a bit |
| 108 | * |
| 109 | * 43 1/22/99 4:06p Jeff |
| 110 | * added hud messages that can be sent to just teammates or individual |
| 111 | * people |
| 112 | * |
| 113 | * 42 1/11/99 4:08p Jason |
| 114 | * added multiplayer taunt macros |
| 115 | * |
| 116 | * 41 10/22/98 2:40p Samir |
| 117 | * redid HUD sequencing so multiplayer hud stuff works. |
| 118 | * |
| 119 | * 40 10/19/98 11:22p Samir |
| 120 | * added hud observer mode and fixed problems with hud switching and |
| 121 | * screen size. |
| 122 | * |
| 123 | * 39 10/14/98 4:26p Samir |
| 124 | * added persistent hud messages. |
| 125 | * |
| 126 | * 38 10/05/98 11:08a Jason |
| 127 | * implemented player message log |
| 128 | * |
| 129 | * 37 9/08/98 10:28a Samir |
| 130 | * added function to reset hud messages. |
| 131 | * |
| 132 | * 36 8/15/98 10:51p Matt |
| 133 | * Added function ToggleHUDMode(), and made StartHudInputMessage() public. |
| 134 | * |
| 135 | * 35 7/28/98 3:17p Jason |
| 136 | * fixed buffer overrun problem |
| 137 | * |
| 138 | * 34 7/06/98 7:34p Samir |
| 139 | * added countermeasures. |
| 140 | * |
| 141 | * 33 6/24/98 7:38p Samir |
| 142 | * redid graphical/text/cockpit hud item management. |
| 143 | * |
| 144 | * 32 6/17/98 6:31p Samir |
| 145 | * Added anti-grav warning when dying. |
| 146 | * |
| 147 | * 31 6/15/98 6:54p Samir |
| 148 | * added invulnerability and cloak effect. |
| 149 | * |
| 150 | * 30 6/15/98 2:14p Samir |
| 151 | * afterburner hud image scale modified. |
| 152 | * |
| 153 | * 29 5/26/98 5:05p Samir |
| 154 | * cockpit and hud config file now 'unified'. cockpit adds to hudconfig |
| 155 | * load's funtionality, so cockpit info files can contain same syntax as |
| 156 | * hud file. |
| 157 | * |
| 158 | * 28 5/25/98 8:30p Samir |
| 159 | * guided missile reticle and added a hud timer. |
| 160 | * |
| 161 | * 27 5/22/98 6:25p Samir |
| 162 | * implemented a lot of hud items. |
| 163 | * |
| 164 | * 26 5/07/98 6:01p Samir |
| 165 | * allow for certain hud items to not be resettable. |
| 166 | * |
| 167 | * 25 5/07/98 12:23p Samir |
| 168 | * RenderHudText functions added to hud.h |
| 169 | * |
| 170 | * 24 5/06/98 4:33p Samir |
| 171 | * added fixed screen width and height to grdefs.h (default res.) |
| 172 | * |
| 173 | * 23 5/05/98 6:27p Samir |
| 174 | * added hud aspect ratio values and reticle is scaled correctly. |
| 175 | * |
| 176 | * 22 4/28/98 4:26p Samir |
| 177 | * brightened hud., |
| 178 | * |
| 179 | * 21 4/24/98 5:32p Samir |
| 180 | * added reset reticle function. |
| 181 | * |
| 182 | * 20 4/24/98 8:01a Samir |
| 183 | * don't pass zoom argument to Render functions. |
| 184 | * |
| 185 | * 19 4/23/98 4:13a Samir |
| 186 | * new hud system. |
| 187 | * |
| 188 | * 18 4/14/98 9:19p Samir |
| 189 | * made hacked good looking reticle for mag demo. |
| 190 | * |
| 191 | * 17 4/13/98 7:02p Samir |
| 192 | * beginning reticle code. |
| 193 | * |
| 194 | * 16 3/25/98 11:59a Samir |
| 195 | * implemented energy analog fully. |
| 196 | * |
| 197 | * 15 3/23/98 5:36p Jason |
| 198 | * changed number of hud messages displayed at once |
| 199 | * |
| 200 | * 14 3/23/98 4:51p Jason |
| 201 | * incremental checkin for multiplay |
| 202 | * |
| 203 | * 13 3/20/98 8:23p Samir |
| 204 | * new hud and cockpit customization system. |
| 205 | * |
| 206 | * 12 3/19/98 9:19p Samir |
| 207 | * created a hud item type. |
| 208 | * |
| 209 | * 11 3/18/98 6:25p Samir |
| 210 | * Added new STAT_ constants/ |
| 211 | * |
| 212 | * 10 3/17/98 2:37p Samir |
| 213 | * reorg of hud/gauge/cockpit dependencies. |
| 214 | * |
| 215 | * 9 3/16/98 3:53p Jason |
| 216 | * added hud input message stuff |
| 217 | * |
| 218 | * 8 3/16/98 3:30p Samir |
| 219 | * incremental checkin. |
| 220 | * |
| 221 | * 7 3/13/98 12:09p Samir |
| 222 | * made changes to reflect new cockpit.cpp and cockpit.h |
| 223 | * |
| 224 | * 6 12/29/97 5:44p Samir |
| 225 | * Took out references to grViewport and old 2d library. |
| 226 | * |
| 227 | * 5 11/11/97 1:26p Samir |
| 228 | * Added function to modify a hud gauge and initialized some gauges for |
| 229 | * first cockpit. |
| 230 | * |
| 231 | * 4 11/04/97 6:23p Samir |
| 232 | * Lighting cockpit, initializes gauges. |
| 233 | * |
| 234 | * 3 10/28/97 6:37p Samir |
| 235 | * 3d Cockpit draws, bad lighting and no gauges. |
| 236 | * |
| 237 | * 5 5/14/97 11:29a Jason |
| 238 | * added energy and shield gauges to hud |
| 239 | * |
| 240 | * 4 3/05/97 3:03p Jason |
| 241 | * added blinking messages |
| 242 | * |
| 243 | * 3 3/04/97 12:58p Jason |
| 244 | * made hud messages scroll and fade |
| 245 | * |
| 246 | * 2 2/13/97 4:12p Jason |
| 247 | * added hud message test |
| 248 | * |
| 249 | * $NoKeywords: $ |
| 250 | */ |
| 251 | |
| 252 | #ifndef HUD_H |
| 253 | #define HUD_Hcxx . . $ `Descent3/hud.h:253:9`! |
| 254 | |
| 255 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 256 | #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/ |
| 257 | |
| 258 | #define MAX_HUD_MESSAGEScxx . . $ `Descent3/hud.h:258:9`! 3 |
| 259 | #define HUD_MESSAGE_LENGTHcxx . . $ `Descent3/hud.h:259:9`! 200 |
| 260 | #define HUD_TEXT_LENGTHcxx . . $ `Descent3/hud.h:260:9`! 32 |
| 261 | #define DEFAULT_HUD_WIDTHcxx . . $ `Descent3/hud.h:261:9`! (float)FIXED_SCREEN_WIDTHcxx . . $ `lib/grdefs.h:65:9`! |
| 262 | #define DEFAULT_HUD_HEIGHTcxx . . $ `Descent3/hud.h:262:9`! (float)FIXED_SCREEN_HEIGHTcxx . . $ `lib/grdefs.h:66:9`! |
| 263 | |
| 264 | struct objectcxx . . $ object#; |
| 265 | struct poly_modelcxx . . $ poly_model#; |
| 266 | struct bsp_infocxx . . $ bsp_info#; |
| 267 | struct g3Pointcxx . . $ g3Point#; |
| 268 | |
| 269 | // type to pass to functions that draw stats |
| 270 | typedef uint16_tcxx . . $ uint16_t# tStatMaskcxx . . $ tStatMask#; |
| 271 | |
| 272 | struct CFILEcxx . . $ CFILE#; |
| 273 | |
| 274 | // hud (or gauge) stat flag. |
| 275 | #define STAT_FPScxx . . $ `Descent3/hud.h:275:9`! 0x0001 |
| 276 | #define STAT_SHIELDScxx . . $ `Descent3/hud.h:276:9`! 0x0002 |
| 277 | #define STAT_ENERGYcxx . . $ `Descent3/hud.h:277:9`! 0x0004 |
| 278 | #define STAT_PRIMARYLOADcxx . . $ `Descent3/hud.h:278:9`! 0x0008 |
| 279 | #define STAT_SECONDARYLOADcxx . . $ `Descent3/hud.h:279:9`! 0x0010 |
| 280 | #define STAT_MESSAGEScxx . . $ `Descent3/hud.h:280:9`! 0x0020 |
| 281 | #define STAT_INVENTORYcxx . . $ `Descent3/hud.h:281:9`! 0x0040 |
| 282 | #define STAT_SHIPcxx . . $ `Descent3/hud.h:282:9`! 0x0080 |
| 283 | #define STAT_AFTERBURNcxx . . $ `Descent3/hud.h:283:9`! 0x0100 |
| 284 | #define STAT_WARNINGcxx . . $ `Descent3/hud.h:284:9`! 0x0200 |
| 285 | #define STAT_GOALScxx . . $ `Descent3/hud.h:285:9`! 0x0400 |
| 286 | #define STAT_TIMERcxx . . $ `Descent3/hud.h:286:9`! 0x0800 |
| 287 | #define STAT_CUSTOMcxx . . $ `Descent3/hud.h:287:9`! 0x1000 |
| 288 | #define STAT_CNTRMEASUREcxx . . $ `Descent3/hud.h:288:9`! 0x2000 |
| 289 | #define STAT_STANDARDcxx . . $ `Descent3/hud.h:289:9`! 0x3ffe |
| 290 | #define STAT_ALLcxx . . $ `Descent3/hud.h:290:9`! 0x3fff |
| 291 | |
| 292 | // is this the special version? (defined by huddisplay.cpp or user equiv.) |
| 293 | #define STAT_SPECIALcxx . . $ `Descent3/hud.h:293:9`! 0x4000 |
| 294 | // is this the graphical version? |
| 295 | #define STAT_GRAPHICALcxx . . $ `Descent3/hud.h:295:9`! 0x8000 |
| 296 | |
| 297 | // hud modes |
| 298 | enum tHUDModecxx . . $ tHUDMode# { |
| 299 | |
| 300 | HUD_FULLSCREENcxx . . $ HUD_FULLSCREEN., |
| 301 | HUD_LETTERBOXcxx . . $ HUD_LETTERBOX., |
| 302 | HUD_COCKPITcxx . . $ HUD_COCKPIT., |
| 303 | HUD_OBSERVERcxx . . $ HUD_OBSERVER. |
| 304 | }; |
| 305 | |
| 306 | #define MAX_HUD_ITEMScxx . . $ `Descent3/hud.h:306:9`! 32 |
| 307 | #define HUD_COLORcxx . . $ `Descent3/hud.h:307:9`! GR_RGB(0, 255, 0) |
| 308 | #define HUD_ALPHAcxx . . $ `Descent3/hud.h:308:9`! 192 |
| 309 | #define HUD_ZOOMcxx . . $ `Descent3/hud.h:309:9`! 0.56f |
| 310 | |
| 311 | #define HUD_MSG_PERSISTENT_INFINITEcxx . . $ `Descent3/hud.h:311:9`! 10000.0f |
| 312 | #define HUD_MSG_PERSISTENT_CENTERcxx . . $ `Descent3/hud.h:312:9`! -1 |
| 313 | |
| 314 | ///////////////////////////////////////////////////////////////////////////////// |
| 315 | |
| 316 | // Max characters in a hud input message |
| 317 | #define MAX_HUD_INPUT_LENcxx . . $ `Descent3/hud.h:317:9`! 80 |
| 318 | |
| 319 | extern char HudInputMessagecxx . . $ HudInputMessage.[MAX_HUD_INPUT_LENcxx . . $ `Descent3/hud.h:317:9`!]; |
| 320 | extern int HudInputMessageLencxx . . $ HudInputMessageLen.; |
| 321 | |
| 322 | extern char Hud_messagescxx . . $ Hud_messages.[MAX_HUD_MESSAGEScxx . . $ `Descent3/hud.h:258:9`!][HUD_MESSAGE_LENGTHcxx . . $ `Descent3/hud.h:259:9`!]; |
| 323 | extern int Num_hud_messagescxx . . $ Num_hud_messages.; |
| 324 | |
| 325 | // Whether or not we're in a input message frame |
| 326 | extern int Doing_input_messagecxx . . $ Doing_input_message.; |
| 327 | |
| 328 | // determines what's displayable on the hud |
| 329 | extern tStatMaskcxx . . $ tStatMask# Hud_stat_maskcxx . . $ Hud_stat_mask.; |
| 330 | |
| 331 | // hud aspect ratio |
| 332 | extern float Hud_aspect_xcxx . . $ Hud_aspect_x.; |
| 333 | extern float Hud_aspect_ycxx . . $ Hud_aspect_y.; |
| 334 | |
| 335 | extern bool Hud_show_controlscxx . . $ Hud_show_controls.; |
| 336 | |
| 337 | // normalize hud coordinates |
| 338 | #define HUD_Xcxx . . $ `Descent3/hud.h:338:9`!(_x) ((float)(_x) * Hud_aspect_x) |
| 339 | #define HUD_Ycxx . . $ `Descent3/hud.h:339:9`!(_y) ((float)(_y) * Hud_aspect_y) |
| 340 | |
| 341 | // number of shield frames in gauge |
| 342 | #define NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`! 5 |
| 343 | #define SHIELD_GAUGE_FRAME_FULLcxx . . $ `Descent3/hud.h:343:9`! 0 |
| 344 | #define SHIELD_GAUGE_FRAME_PARTIALcxx . . $ `Descent3/hud.h:344:9`! 1 |
| 345 | #define SHIELD_GAUGE_FRAME_HALFcxx . . $ `Descent3/hud.h:345:9`! 2 |
| 346 | #define SHIELD_GAUGE_FRAME_SERIOUScxx . . $ `Descent3/hud.h:346:9`! 3 |
| 347 | #define SHIELD_GAUGE_FRAME_CRITICALcxx . . $ `Descent3/hud.h:347:9`! 4 |
| 348 | |
| 349 | ///////////////////////////////////////////////////////////////////////////////// |
| 350 | |
| 351 | // Adds a message to the HUD message list. If the list is already full, punt the |
| 352 | // top one and move the others up |
| 353 | // Returns true if message added, or false if message not (because the previous message was the same) |
| 354 | bool AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(const char *format, ...); |
| 355 | bool AddBlinkingHUDMessagecxx . . $ AddBlinkingHUDMessage(f90d95ab21fd6d97).(const char *format, ...); |
| 356 | |
| 357 | // Adds a HUD message (similar to AddHUDMessage), however can be filtered out by |
| 358 | // a "-playermessages" command line. |
| 359 | bool AddFilteredHUDMessagecxx . . $ AddFilteredHUDMessage(f90d95ab21fd6d97).(const char *format, ...); |
| 360 | |
| 361 | // initializes other hud stuff |
| 362 | void SetHUDEnergyImagecxx . . $ SetHUDEnergyImage(85c52e162fed56f9).(const char *energy_img); |
| 363 | void SetHUDAfterburnImagecxx . . $ SetHUDAfterburnImage(85c52e162fed56f9).(const char *afterburn_img); |
| 364 | |
| 365 | // Renders all the messages we have in the message list. If HUD_MESSAGE_TIME has |
| 366 | // elapsed, then punt the oldest message and move the others up one |
| 367 | void RenderHUDMessagescxx . . $ RenderHUDMessages(49f6e7a06ebc5aa8).(); |
| 368 | |
| 369 | // renders ship stats |
| 370 | void RenderHUDStatscxx . . $ RenderHUDStats(ed53e3bbd3fa2f69).(tStatMaskcxx . . $ tStatMask# stat_mask); |
| 371 | |
| 372 | // Handles all incoming keys for an inputted hud message |
| 373 | void DoHUDInputMessageKeycxx . . $ DoHUDInputMessageKey(d4f767463ce0a6b3).(int key); |
| 374 | |
| 375 | // Called when the player hit the Multiplayer message key. |
| 376 | // Puts the player in input mode, or if already inputting resets the hud input message. |
| 377 | void StartHUDInputMessagecxx . . $ StartHUDInputMessage(49f6e7a06ebc5aa8).(); |
| 378 | |
| 379 | // Called when the player hits the Multiplayer team-message key. |
| 380 | // Puts the player in input mode, or if already inputting resets the hud input message. |
| 381 | void StartTeamHUDInputMessagecxx . . $ StartTeamHUDInputMessage(49f6e7a06ebc5aa8).(); |
| 382 | |
| 383 | // Adds a colored message to the hud |
| 384 | // Returns true if message added, or false if message not (because the previous message was the same) |
| 385 | bool AddColoredHUDMessagecxx . . $ AddColoredHUDMessage(7778decf30f5fc42).(ddgr_colorcxx . . $ ddgr_color# color, const char *format, ...); |
| 386 | |
| 387 | // Adds a HUD message (similar to AddColoredHUDMessage), however can be filtered out by |
| 388 | // a "-playermessages" command line. |
| 389 | bool AddFilteredColoredHUDMessagecxx . . $ AddFilteredColoredHUDMessage(7778decf30f5fc42).(ddgr_colorcxx . . $ ddgr_color# color, const char *format, ...); |
| 390 | |
| 391 | // Initializes Reticle on Hud. Usually called when weapon changes. |
| 392 | void InitReticlecxx . . $ InitReticle(3e454b8ccf442868).(int primary_slots, int secondary_slots); |
| 393 | |
| 394 | // resets reticle to current weapon. |
| 395 | void ResetReticlecxx . . $ ResetReticle(49f6e7a06ebc5aa8).(); |
| 396 | |
| 397 | // frees up reticle bitmaps |
| 398 | void FreeReticlecxx . . $ FreeReticle(49f6e7a06ebc5aa8).(); |
| 399 | |
| 400 | // Flags for persistent HUD messages |
| 401 | #define HPF_FADEOUTcxx . . $ `Descent3/hud.h:401:9`! 1 // message fades out when done |
| 402 | #define HPF_FREESPACE_DRAWcxx . . $ `Descent3/hud.h:402:9`! 2 // message draws with the FreeSpace briefing effect |
| 403 | |
| 404 | // adds a persistent hud message that is timed, or infinite until removed |
| 405 | // for infinite, time = HUD_MSG_PERSISTENT_INFINITE |
| 406 | // for centering on an axis,set either x or y to HUD_MSG_PERSISTENT_CENTER |
| 407 | void AddPersistentHUDMessagecxx . . $ AddPersistentHUDMessage(2c96e75cbf2ca747).(ddgr_colorcxx . . $ ddgr_color# color, int x, int y, float time, int flags, int sound_index, const char *fmt, |
| 408 | ...); |
| 409 | |
| 410 | // removes persistent hud message |
| 411 | void ResetPersistentHUDMessagecxx . . $ ResetPersistentHUDMessage(49f6e7a06ebc5aa8).(); |
| 412 | |
| 413 | // Given a hud message, it will determine who should get this message. |
| 414 | // "name: message" = the player with the callsign name should get the message |
| 415 | // "team: message" = the Player_num's team should get the message |
| 416 | // "0-32: message" = the player with player num of 0-32 should get the message |
| 417 | // all other messages are for everyone else |
| 418 | // |
| 419 | // returns the starting position of the real message (past the :) |
| 420 | // destination will receive one of the following values: |
| 421 | // MULTI_SEND_MESSAGE_ALL = everyone should get this message |
| 422 | // MULTI_SEND_MESSAGE_RED_TEAM = only red team (0) should get this message |
| 423 | // MULTI_SEND_MESSAGE_BLUE_TEAM = only blue team (1) should get this message |
| 424 | // MULTI_SEND_MESSAGE_GREEN_TEAM = only green team (2) should get this message |
| 425 | // MULTI_SEND_MESSAGE_YELLOW_TEAM = only yellow team (3) should get this message |
| 426 | // 0-32 = player num of the player to get the message |
| 427 | const char *GetMessageDestinationcxx . . $ GetMessageDestination(6a735779416056db).(const char *message, int *destination); |
| 428 | |
| 429 | // HUD System |
| 430 | |
| 431 | // predefined types (tHUDItem::type) |
| 432 | #define HUD_ITEM_PRIMARYcxx . . $ `Descent3/hud.h:432:9`! 1 |
| 433 | #define HUD_ITEM_SECONDARYcxx . . $ `Descent3/hud.h:433:9`! 2 |
| 434 | #define HUD_ITEM_SHIELDcxx . . $ `Descent3/hud.h:434:9`! 3 |
| 435 | #define HUD_ITEM_ENERGYcxx . . $ `Descent3/hud.h:435:9`! 4 |
| 436 | #define HUD_ITEM_AFTERBURNERcxx . . $ `Descent3/hud.h:436:9`! 5 |
| 437 | #define HUD_ITEM_INVENTORYcxx . . $ `Descent3/hud.h:437:9`! 6 |
| 438 | #define HUD_ITEM_SHIPSTATUScxx . . $ `Descent3/hud.h:438:9`! 7 |
| 439 | #define HUD_ITEM_WARNINGScxx . . $ `Descent3/hud.h:439:9`! 8 |
| 440 | #define HUD_ITEM_GOALScxx . . $ `Descent3/hud.h:440:9`! 9 |
| 441 | #define HUD_ITEM_GOALSTATEScxx . . $ `Descent3/hud.h:441:9`! 10 |
| 442 | #define HUD_ITEM_CNTRMEASUREcxx . . $ `Descent3/hud.h:442:9`! 11 |
| 443 | #define HUD_ITEM_SCOREcxx . . $ `Descent3/hud.h:443:9`! 12 |
| 444 | #define HUD_ITEM_CUSTOMTEXTcxx . . $ `Descent3/hud.h:444:9`! 20 |
| 445 | #define HUD_ITEM_CUSTOMIMAGEcxx . . $ `Descent3/hud.h:445:9`! 21 |
| 446 | #define HUD_ITEM_TIMERcxx . . $ `Descent3/hud.h:446:9`! 22 |
| 447 | #define HUD_ITEM_CUSTOMTEXT2cxx . . $ `Descent3/hud.h:447:9`! 23 // like custom text, keeps string pointer passed in |
| 448 | |
| 449 | #define HUD_FLAG_PERSISTANTcxx . . $ `Descent3/hud.h:449:9`! 1 // this hud item will not be resetted. |
| 450 | #define HUD_FLAG_SMALLcxx . . $ `Descent3/hud.h:450:9`! 2 // when small version of hud is rendered, this will render in the AUX frame |
| 451 | #define HUD_FLAG_LEVELcxx . . $ `Descent3/hud.h:451:9`! 4 // persistent for the current level, but cleared between levels |
| 452 | |
| 453 | #define HUD_INVALID_IDcxx . . $ `Descent3/hud.h:453:9`! 255 // hud invalid id constant. |
| 454 | |
| 455 | struct t_dirty_rectcxx . . $ t_dirty_rect# { |
| 456 | structcxx . . $ t_dirty_rect#$anonymous_type_0# { |
| 457 | int16_t lcxx . . $ t_dirty_rect#$anonymous_type_0#l., tcxx . . $ t_dirty_rect#$anonymous_type_0#t., rcxx . . $ t_dirty_rect#$anonymous_type_0#r., bcxx . . $ t_dirty_rect#$anonymous_type_0#b.; |
| 458 | } rcxx . . $ t_dirty_rect#r.[3]; // three rectangles for each frame buffer (3 max) |
| 459 | |
| 460 | void setcxx . . $ t_dirty_rect#set(6f3a90be462c391b).(int16_t l0, int16_t t0, int16_t r0, int16_t b0) { |
| 461 | rcxx . . $ t_dirty_rect#r.[0].lcxx . . $ t_dirty_rect#$anonymous_type_0#l. = l0; |
| 462 | rcxx . . $ t_dirty_rect#r.[0].tcxx . . $ t_dirty_rect#$anonymous_type_0#t. = t0; |
| 463 | rcxx . . $ t_dirty_rect#r.[0].rcxx . . $ t_dirty_rect#$anonymous_type_0#r. = r0; |
| 464 | rcxx . . $ t_dirty_rect#r.[0].bcxx . . $ t_dirty_rect#$anonymous_type_0#b. = b0; |
| 465 | }; |
| 466 | void resetcxx . . $ t_dirty_rect#reset(49f6e7a06ebc5aa8).(); |
| 467 | void fillcxx . . $ t_dirty_rect#fill(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# col); |
| 468 | }; // dirty rectangle for hud item (small hud version) |
| 469 | |
| 470 | struct tHUDItemcxx . . $ tHUDItem# { |
| 471 | int16_t xcxx . . $ tHUDItem#x., ycxx . . $ tHUDItem#y.; |
| 472 | int16_t xacxx . . $ tHUDItem#xa., yacxx . . $ tHUDItem#ya.; // auxillary points |
| 473 | int16_t xbcxx . . $ tHUDItem#xb., ybcxx . . $ tHUDItem#yb.; |
| 474 | int16_t txcxx . . $ tHUDItem#tx., tycxx . . $ tHUDItem#ty.; // text version x and y. |
| 475 | float grscalexcxx . . $ tHUDItem#grscalex., grscaleycxx . . $ tHUDItem#grscaley.; // used to scale graphics. |
| 476 | |
| 477 | uint8_tcxx . . $ uint8_t# idcxx . . $ tHUDItem#id.; // id number. |
| 478 | uint8_tcxx . . $ uint8_t# typecxx . . $ tHUDItem#type.; // custom of predefined hud item type. |
| 479 | uint16_tcxx . . $ uint16_t# statcxx . . $ tHUDItem#stat.; // stat mask (what class of hud items does this one belong to) |
| 480 | |
| 481 | uint16_tcxx . . $ uint16_t# flagscxx . . $ tHUDItem#flags.; // more flags. |
| 482 | uint8_tcxx . . $ uint8_t# alphacxx . . $ tHUDItem#alpha.; // alpha of hud item |
| 483 | uint8_tcxx . . $ uint8_t# saturation_countcxx . . $ tHUDItem#saturation_count.; // how saturated is this hud item (how bright). |
| 484 | |
| 485 | ddgr_colorcxx . . $ ddgr_color# colorcxx . . $ tHUDItem#color.; // color of hud item. |
| 486 | ddgr_colorcxx . . $ ddgr_color# tcolorcxx . . $ tHUDItem#tcolor.; // text color of item. |
| 487 | |
| 488 | void (*render_fncxx . . $ tHUDItem#render_fn.)(struct tHUDItemcxx . . $ tHUDItem# *); // called by hud system to draw the hud item. |
| 489 | |
| 490 | int buffer_sizecxx . . $ tHUDItem#buffer_size.; // for customtext2 item |
| 491 | |
| 492 | // data is initialized depending on 'type'. |
| 493 | // custom types must have either element of data already initialized. |
| 494 | // all predefined types can ignore this data field externally. |
| 495 | unioncxx . . $ tHUDItem#$anonymous_type_1# { |
| 496 | int bm_handlecxx . . $ tHUDItem#$anonymous_type_1#bm_handle.; // custom images |
| 497 | int timer_handlecxx . . $ tHUDItem#$anonymous_type_1#timer_handle.; // timer |
| 498 | char *textcxx . . $ tHUDItem#$anonymous_type_1#text.; // custom text. |
| 499 | } datacxx . . $ tHUDItem#data.; |
| 500 | |
| 501 | t_dirty_rectcxx . . $ t_dirty_rect# dirty_rectcxx . . $ tHUDItem#dirty_rect.; // used in small version of hud to clear only 'dirty' area |
| 502 | }; |
| 503 | |
| 504 | // hud resources |
| 505 | struct sHUDResourcescxx . . $ sHUDResources# { |
| 506 | char hud_inf_namecxx . . $ sHUDResources#hud_inf_name.[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 507 | int arrow_bmpcxx . . $ sHUDResources#arrow_bmp.; |
| 508 | int goal_complete_bmpcxx . . $ sHUDResources#goal_complete_bmp.; |
| 509 | int goal_bmpcxx . . $ sHUDResources#goal_bmp.; |
| 510 | int lock_bmpcxx . . $ sHUDResources#lock_bmp.[2]; |
| 511 | int wpn_bmpcxx . . $ sHUDResources#wpn_bmp.; |
| 512 | int ship_bmpcxx . . $ sHUDResources#ship_bmp.; |
| 513 | int energy_bmpcxx . . $ sHUDResources#energy_bmp.; |
| 514 | int shield_bmpcxx . . $ sHUDResources#shield_bmp.[NUM_SHIELD_GAUGE_FRAMEScxx . . $ `Descent3/hud.h:342:9`!]; |
| 515 | int invpulse_bmpcxx . . $ sHUDResources#invpulse_bmp.; |
| 516 | int dot_bmpcxx . . $ sHUDResources#dot_bmp.; |
| 517 | int afterburn_bmpcxx . . $ sHUDResources#afterburn_bmp.; |
| 518 | int antigrav_bmpcxx . . $ sHUDResources#antigrav_bmp.[2]; |
| 519 | }; |
| 520 | |
| 521 | #define HUD_ARROW_SCALEcxx . . $ `Descent3/hud.h:521:9`! 0.20f |
| 522 | #define HUD_WPN_SCALEcxx . . $ `Descent3/hud.h:522:9`! 0.75f |
| 523 | #define HUD_SHIP_SCALEcxx . . $ `Descent3/hud.h:523:9`! 0.33f |
| 524 | #define HUD_ENERGY_SCALEcxx . . $ `Descent3/hud.h:524:9`! 0.50f |
| 525 | #define HUD_SHIELD_SCALEcxx . . $ `Descent3/hud.h:525:9`! 0.625f |
| 526 | #define HUD_DOT_SCALEcxx . . $ `Descent3/hud.h:526:9`! 0.20f |
| 527 | #define HUD_LOCK_SCALEcxx . . $ `Descent3/hud.h:527:9`! 0.5f |
| 528 | #define HUD_BURN_SCALEcxx . . $ `Descent3/hud.h:528:9`! 0.5f |
| 529 | |
| 530 | #define HUD_CLOAKEND_TIMEcxx . . $ `Descent3/hud.h:530:9`! 3.0f |
| 531 | |
| 532 | extern struct sHUDResourcescxx . . $ sHUDResources# HUD_resourcescxx . . $ HUD_resources.; |
| 533 | extern bool Small_hud_flagcxx . . $ Small_hud_flag.; |
| 534 | |
| 535 | // initializes hud system. |
| 536 | void InitHUDcxx . . $ InitHUD(49f6e7a06ebc5aa8).(); |
| 537 | |
| 538 | // initializes hud for ship. |
| 539 | void InitShipHUDcxx . . $ InitShipHUD(d4f767463ce0a6b3).(int ship); |
| 540 | |
| 541 | // closes hud. |
| 542 | void CloseHUDcxx . . $ CloseHUD(49f6e7a06ebc5aa8).(); |
| 543 | |
| 544 | // closes hud for current ship |
| 545 | void CloseShipHUDcxx . . $ CloseShipHUD(49f6e7a06ebc5aa8).(); |
| 546 | |
| 547 | // manually sets the cockpit display. |
| 548 | void SetHUDModecxx . . $ SetHUDMode(1efe68d6753032ab).(tHUDModecxx . . $ tHUDMode# mode); |
| 549 | |
| 550 | // toggle the hud between cockput & fullscreen modes |
| 551 | void ToggleHUDModecxx . . $ ToggleHUDMode(49f6e7a06ebc5aa8).(); |
| 552 | |
| 553 | // sets the hud item state(what's visible, how it's drawn, etc) |
| 554 | void SetHUDStatecxx . . $ SetHUDState(161476d40f03fa8c).(uint16_tcxx . . $ uint16_t# hud_mask, uint16_tcxx . . $ uint16_t# hud_gr_mask); |
| 555 | |
| 556 | // the current cockpit mode; |
| 557 | tHUDModecxx . . $ tHUDMode# GetHUDModecxx . . $ GetHUDMode(d2d05048dda10524).(); |
| 558 | |
| 559 | // places an item on the hud |
| 560 | void AddHUDItemcxx . . $ AddHUDItem(c7a20e4e05358911).(tHUDItemcxx . . $ tHUDItem# *item); |
| 561 | |
| 562 | // frees hud items based off their type class. |
| 563 | void FreeHUDItemcxx . . $ FreeHUDItem(d4f767463ce0a6b3).(int item); |
| 564 | |
| 565 | // Updates the customtext2 item, if there is one |
| 566 | void UpdateCustomtext2HUDItemcxx . . $ UpdateCustomtext2HUDItem(fda57c8427c60377).(char *text); |
| 567 | |
| 568 | // Returns the item number if there's a customtext2 item, else -1 |
| 569 | int FindCustomtext2HUDItemcxx . . $ FindCustomtext2HUDItem(b126dc7c1de90089).(); |
| 570 | |
| 571 | // resets hud |
| 572 | void ResetHUDcxx . . $ ResetHUD(49f6e7a06ebc5aa8).(); |
| 573 | |
| 574 | // loads in hud configuration file, adds hud items. |
| 575 | void LoadHUDConfigcxx . . $ LoadHUDConfig(7fb9cb4cf7d8fbd3).(const char *filename, bool (*fn)(const char *, const char *, void *) = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, void *data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 576 | |
| 577 | // render cockpit and gauges frame |
| 578 | void RenderHUDFramecxx . . $ RenderHUDFrame(49f6e7a06ebc5aa8).(); |
| 579 | |
| 580 | // renders hud frame before any graphics are drawn |
| 581 | void RenderPreHUDFramecxx . . $ RenderPreHUDFrame(49f6e7a06ebc5aa8).(); |
| 582 | |
| 583 | // render auxillary hud |
| 584 | void RenderAuxHUDFramecxx . . $ RenderAuxHUDFrame(49f6e7a06ebc5aa8).(); |
| 585 | |
| 586 | // savegame system hooks |
| 587 | void SGSHudStatecxx . . $ SGSHudState(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp); |
| 588 | bool LGSHudStatecxx . . $ LGSHudState(254217fab7598d49).(CFILEcxx . . $ CFILE# *fp); |
| 589 | |
| 590 | // returns scaled line width |
| 591 | int RenderHUDGetTextLineWidthcxx . . $ RenderHUDGetTextLineWidth(5c4306d8553b3696).(const char *string); |
| 592 | |
| 593 | // returns scaled text height |
| 594 | int RenderHUDGetTextHeightcxx . . $ RenderHUDGetTextHeight(5c4306d8553b3696).(const char *string); |
| 595 | |
| 596 | // renders a bitmap onto the hud |
| 597 | void RenderHUDQuadcxx . . $ RenderHUDQuad(fc69324a5ac6b910).(int x, int y, int w, int h, float u0, float v0, float u1, float v1, int bm, uint8_tcxx . . $ uint8_t# alpha, |
| 598 | int sat_count = 0); |
| 599 | |
| 600 | // renders text, scaled, alphaed, saturated, |
| 601 | void RenderHUDTextcxx . . $ RenderHUDText(e69f8330415a42f1).(ddgr_colorcxx . . $ ddgr_color# col, uint8_tcxx . . $ uint8_t# alpha, int sat_count, int x, int y, const char *fmt, ...); |
| 602 | |
| 603 | // flags for RenderHudText. |
| 604 | #define HUDTEXT_CENTEREDcxx . . $ `Descent3/hud.h:604:9`! 1 |
| 605 | |
| 606 | // renders text, scaled, alphaed, saturated, |
| 607 | void RenderHUDTextFlagscxx . . $ RenderHUDTextFlags(15b906afa0252220).(int flags, ddgr_colorcxx . . $ ddgr_color# col, uint8_tcxx . . $ uint8_t# alpha, int sat_count, int x, int y, const char *fmt, ...); |
| 608 | |
| 609 | // reset hud messages. |
| 610 | void ResetHUDMessagescxx . . $ ResetHUDMessages(49f6e7a06ebc5aa8).(); |
| 611 | |
| 612 | // Sends off the input message the player was typing |
| 613 | void SendOffHUDInputMessagecxx . . $ SendOffHUDInputMessage(49f6e7a06ebc5aa8).(); |
| 614 | |
| 615 | // reset hud message list. |
| 616 | void ResetHUDMessagescxx . . $ ResetHUDMessages(49f6e7a06ebc5aa8).(); |
| 617 | |
| 618 | // opens a hud rollback console. |
| 619 | void OpenHUDMessageConsolecxx . . $ OpenHUDMessageConsole(49f6e7a06ebc5aa8).(); |
| 620 | |
| 621 | // closes hud rollback console |
| 622 | void CloseHUDMessageConsolecxx . . $ CloseHUDMessageConsole(49f6e7a06ebc5aa8).(); |
| 623 | |
| 624 | // toggles hud rollback console |
| 625 | void ToggleHUDMessageConsolecxx . . $ ToggleHUDMessageConsole(49f6e7a06ebc5aa8).(); |
| 626 | |
| 627 | // resets game message list to no messages |
| 628 | void ResetGameMessagescxx . . $ ResetGameMessages(49f6e7a06ebc5aa8).(); |
| 629 | void AddGameMessagecxx . . $ AddGameMessage(85c52e162fed56f9).(const char *msg); |
| 630 | void SGSGameMessagescxx . . $ SGSGameMessages(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp); |
| 631 | void LGSGameMessagescxx . . $ LGSGameMessages(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp); |
| 632 | |
| 633 | // toggles game message console (you usually call this.) |
| 634 | void ToggleGameMessageConsolecxx . . $ ToggleGameMessageConsole(49f6e7a06ebc5aa8).(); |
| 635 | |
| 636 | // game message console |
| 637 | void OpenGameMessageConsolecxx . . $ OpenGameMessageConsole(49f6e7a06ebc5aa8).(); |
| 638 | void CloseGameMessageConsolecxx . . $ CloseGameMessageConsole(49f6e7a06ebc5aa8).(); |
| 639 | |
| 640 | // pause/unpause hud message rendering |
| 641 | void HUDPauseMessagescxx . . $ HUDPauseMessages(49f6e7a06ebc5aa8).(void); |
| 642 | void HUDUnpauseMessagescxx . . $ HUDUnpauseMessages(49f6e7a06ebc5aa8).(void); |
| 643 | |
| 644 | ///////////////////////////////////////////////////////////////////////// |
| 645 | // Message Console System |
| 646 | ///////////////////////////////////////////////////////////////////////// |
| 647 | |
| 648 | struct tMsgListcxx . . $ tMsgList# { |
| 649 | int m_nmsgcxx . . $ tMsgList#m_nmsg., m_limitcxx . . $ tMsgList#m_limit.; |
| 650 | char **m_msgcxx . . $ tMsgList#m_msg.; |
| 651 | |
| 652 | tMsgListcxx . . $ tMsgList#tMsgList(49f6e7a06ebc5aa8).(); |
| 653 | void set_limitcxx . . $ tMsgList#set_limit(d4f767463ce0a6b3).(int limit) { m_limitcxx . . $ tMsgList#m_limit. = limit; }; |
| 654 | bool addcxx . . $ tMsgList#add(8b3ed2aaeef03f3f).(const char *msg, uint8_tcxx . . $ uint8_t# lvl = 0, uint8_tcxx . . $ uint8_t# hr = 0, uint8_tcxx . . $ uint8_t# min = 0, uint8_tcxx . . $ uint8_t# sec = 0); |
| 655 | const char *getcxx . . $ tMsgList#get(f7ae7e56280f18ae).(int i); |
| 656 | void resetcxx . . $ tMsgList#reset(49f6e7a06ebc5aa8).(); |
| 657 | }; |
| 658 | |
| 659 | ////////////////////////////////////////////////////////////////////////////// |
| 660 | |
| 661 | class MsgListConsolecxx . . $ MsgListConsole# { |
| 662 | tMsgListcxx . . $ tMsgList# *m_listcxx . . $ MsgListConsole#m_list.; |
| 663 | int m_xcxx . . $ MsgListConsole#m_x., m_ycxx . . $ MsgListConsole#m_y., m_wcxx . . $ MsgListConsole#m_w., m_hcxx . . $ MsgListConsole#m_h.; |
| 664 | int m_buflinecxx . . $ MsgListConsole#m_bufline., m_buflencxx . . $ MsgListConsole#m_buflen., m_curmsgscxx . . $ MsgListConsole#m_curmsgs., m_numlinescxx . . $ MsgListConsole#m_numlines.; |
| 665 | bool m_openedcxx . . $ MsgListConsole#m_opened.; |
| 666 | char *m_buffercxx . . $ MsgListConsole#m_buffer.; |
| 667 | char m_titlecxx . . $ MsgListConsole#m_title.[32]; |
| 668 | char **m_conlinescxx . . $ MsgListConsole#m_conlines.; |
| 669 | int n_conlinescxx . . $ MsgListConsole#n_conlines.; |
| 670 | int m_keydownstatecxx . . $ MsgListConsole#m_keydownstate.; // -1 for up key, 1 for down key, 0 for none. |
| 671 | float m_keydowntimecxx . . $ MsgListConsole#m_keydowntime.; |
| 672 | |
| 673 | public: |
| 674 | MsgListConsolecxx . . $ MsgListConsole#MsgListConsole(49f6e7a06ebc5aa8).(); |
| 675 | ~cxx . . $ MsgListConsole#`~MsgListConsole`(49f6e7a06ebc5aa8).MsgListConsolecxx . . $ MsgListConsole#(); |
| 676 | bool Opencxx . . $ MsgListConsole#Open(80f7bbf7fc8b8824).(const char *title, int x, int y, int w, int h); // registers dimensions of box |
| 677 | void Closecxx . . $ MsgListConsole#Close(49f6e7a06ebc5aa8).(); |
| 678 | void AttachMsgListcxx . . $ MsgListConsole#AttachMsgList(df01d1f481ab84b9).(tMsgListcxx . . $ tMsgList# *msglist); |
| 679 | void Drawcxx . . $ MsgListConsole#Draw(49f6e7a06ebc5aa8).(); |
| 680 | void DoInputcxx . . $ MsgListConsole#DoInput(49f6e7a06ebc5aa8).(); // do scrolling ui on this console |
| 681 | }; |
| 682 | |
| 683 | #endif |