| 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/DMFC.h $ |
| 21 | * $Revision: 1.3 $ |
| 22 | * $Date: 2004/02/09 04:14:49 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Major header file for DMFC |
| 26 | * |
| 27 | * $Log: DMFC.h,v $ |
| 28 | * Revision 1.3 2004/02/09 04:14:49 kevinb |
| 29 | * Added newlines to all headers to reduce number of warnings printed |
| 30 | * |
| 31 | * Made some small changes to get everything compiling. |
| 32 | * |
| 33 | * All Ready to merge the 1.5 tree. |
| 34 | * |
| 35 | * Revision 1.2 2000/09/22 18:50:30 icculus |
| 36 | * Removing some x86 ASM for non-x86 builds. |
| 37 | * |
| 38 | * Revision 1.1.1.1 2000/04/18 00:00:30 icculus |
| 39 | * initial checkin |
| 40 | * |
| 41 | * |
| 42 | * 125 10/21/99 3:32p Matt |
| 43 | * Mac merge |
| 44 | * |
| 45 | * 124 8/11/99 1:21p Jeff |
| 46 | * exported needed functions for camera windows |
| 47 | * |
| 48 | * 123 7/16/99 2:43p Jeff |
| 49 | * changed CreateMenuItemWArgs function |
| 50 | * |
| 51 | * 122 7/11/99 3:32p Jeff |
| 52 | * exported game arguments, made command line option to specify |
| 53 | * autoexec.dmfc |
| 54 | * |
| 55 | * 121 7/07/99 12:16p Jeff |
| 56 | * all mangles symbol names fixed. Finished making interface functions. |
| 57 | * |
| 58 | * 120 6/12/99 10:59p Jeff |
| 59 | * fixed messed up #ifdef for __LINUX__ |
| 60 | * |
| 61 | * 119 6/10/99 6:31p Jeff |
| 62 | * fixed mprintf define |
| 63 | * |
| 64 | * 118 5/12/99 11:04p Jeff |
| 65 | * dmfc and multiplayer games now have endian friendly packets (*whew*) |
| 66 | * |
| 67 | * 117 5/10/99 10:21p Ardussi |
| 68 | * changes to compile on Mac |
| 69 | * |
| 70 | * 116 4/27/99 12:36p Jeff |
| 71 | * fixed flags |
| 72 | * |
| 73 | * 115 4/24/99 11:13p Jeff |
| 74 | * added flags for creating a newui window for a title bar |
| 75 | * |
| 76 | * 114 4/20/99 7:27p Jeff |
| 77 | * fixed new MAX_PLAYERS |
| 78 | * |
| 79 | * 113 4/19/99 6:02p Jeff |
| 80 | * fixed macros (mprintf and Debug_break) for Linux |
| 81 | * |
| 82 | * 112 4/19/99 5:46p Jeff |
| 83 | * added int3/assert macros for Linux |
| 84 | * |
| 85 | * 111 4/03/99 9:26p Jeff |
| 86 | * changed dialogs that weren't using UID_OK and UID_CANCEL to use and |
| 87 | * handle them properly |
| 88 | * |
| 89 | * 110 3/17/99 12:23p Jeff |
| 90 | * converted DMFC to be COM interface |
| 91 | * |
| 92 | * 109 3/11/99 6:30p Jeff |
| 93 | * numerous fixes to demo system in multiplayer games (when |
| 94 | * recording/playback a demo in a multiplayer game) |
| 95 | * |
| 96 | * 108 3/05/99 12:02p Kevin |
| 97 | * New color scheme for new art |
| 98 | * |
| 99 | * 107 2/28/99 11:05p Jeff |
| 100 | * fixed ASSERT define in Release builds |
| 101 | * |
| 102 | * 106 2/28/99 3:06a Jeff |
| 103 | * adjust ok/cancel y offset for new ui artwork |
| 104 | * |
| 105 | * 105 2/11/99 12:54a Jeff |
| 106 | * changed names of exported variables |
| 107 | * |
| 108 | * 103 2/07/99 1:19a Jeff |
| 109 | * added new multiplayer game events EVT_GAMEOBJKILLED and |
| 110 | * EVT_GAMEOBJDESTROYED |
| 111 | * |
| 112 | * 102 2/03/99 4:09p Jeff |
| 113 | * moved function pointers to seperate file. created autoexec.dmfc |
| 114 | * |
| 115 | * 101 1/31/99 7:25p Matt |
| 116 | * Renamed a bunch of functions to have HUD capitalized |
| 117 | * |
| 118 | * 100 1/24/99 8:31p Jeff |
| 119 | * updated stat manager to print team scores |
| 120 | * |
| 121 | * 98 1/15/99 3:50a Jeff |
| 122 | * new events required new handlers |
| 123 | * |
| 124 | * 96 1/07/99 5:01p Jeff |
| 125 | * added Int3's and updated all net games to use stats manager...correctly |
| 126 | * too |
| 127 | * |
| 128 | * 95 1/06/99 7:02p Jeff |
| 129 | * added a multiplayer event for game controls |
| 130 | * |
| 131 | * 94 1/04/99 12:21p Jeff |
| 132 | * added support for hosts.allow/deny and updates stats manager a little |
| 133 | * |
| 134 | * 93 12/13/98 5:32p Jeff |
| 135 | * fixed ugly crash due to freeing memory allocated in another heap |
| 136 | * |
| 137 | * 92 12/08/98 4:47p Jeff |
| 138 | * umm, various changes, fixed pilot pics so that they work for everyone |
| 139 | * now |
| 140 | * |
| 141 | * 91 12/08/98 3:29p Jeff |
| 142 | * updated the team control dialog so the server can determine if they |
| 143 | * want to make the clients wait |
| 144 | * |
| 145 | * 90 12/08/98 12:17p Jeff |
| 146 | * various changes that include an improved Team Control dialog (doesn't |
| 147 | * switch teams until exit..) and spew/respawn players that change teams |
| 148 | * |
| 149 | * 89 12/04/98 7:04p Jeff |
| 150 | * almost finished up dmfc stat manager |
| 151 | * |
| 152 | * 88 12/03/98 7:05p Jeff |
| 153 | * updated new stats |
| 154 | * |
| 155 | * 87 12/01/98 6:56p Jeff |
| 156 | * put in quick and dirty implementation of pilot pics for testing |
| 157 | * |
| 158 | * 86 11/20/98 5:52p Jeff |
| 159 | * updated hyper anarchy and hoard a little |
| 160 | * |
| 161 | * 85 11/19/98 5:56p Jeff |
| 162 | * added slider exported and improved Hoard |
| 163 | * |
| 164 | * 84 11/18/98 5:48p Jeff |
| 165 | * added function/struct to get information from the DLL before it loads |
| 166 | * |
| 167 | * 83 11/17/98 6:29p Jeff |
| 168 | * mod can specify whether or not to display the team setup dialog on team |
| 169 | * game start. Added a menu item to display team setup dialog in mid-game |
| 170 | * |
| 171 | * 82 11/16/98 5:35p Jeff |
| 172 | * removed log functions, added support for changing team names, fixed ctf |
| 173 | * to work better with different team names |
| 174 | * |
| 175 | * 81 11/13/98 6:36p Jeff |
| 176 | * created dmfc_dll (a DLL version of DMFC) and converted current mods to |
| 177 | * use it |
| 178 | * |
| 179 | * 80 11/12/98 12:16p Jeff |
| 180 | * more changes to handle (ignore) dedicated server |
| 181 | * |
| 182 | * 79 11/11/98 7:18p Jeff |
| 183 | * changes made so that a dedicated server's team is always -1 (team game |
| 184 | * or not) |
| 185 | * |
| 186 | * 78 11/09/98 11:54a Jeff |
| 187 | * Added Player_colors |
| 188 | * |
| 189 | * 77 11/02/98 4:38p Jeff |
| 190 | * added ability to sort and display by efficiency |
| 191 | * |
| 192 | * 76 11/01/98 1:59a Jeff |
| 193 | * made a $help inputcommand for help in a dedicated server environment |
| 194 | * |
| 195 | * 75 10/30/98 12:46p Jeff |
| 196 | * cut down a couple bytes on memory usage |
| 197 | * |
| 198 | * 74 10/29/98 7:01p Jeff |
| 199 | * creation of team placement dialog. Moved TranslateEvent into DMFC |
| 200 | * |
| 201 | * 73 10/24/98 2:18p Jeff |
| 202 | * |
| 203 | * 72 10/23/98 11:22a Jeff |
| 204 | * changes to handle mixcase, and display the client netgame info |
| 205 | * correctly |
| 206 | * |
| 207 | * 71 10/20/98 4:35p Jeff |
| 208 | * added a flag for menu to add a <None> to MIT_PLIST... |
| 209 | * |
| 210 | * 70 10/20/98 12:17p Jeff |
| 211 | * |
| 212 | * 69 10/19/98 7:18p Matt |
| 213 | * Added system to support different types of damage to the player and |
| 214 | * have these different types make different sounds. |
| 215 | * |
| 216 | * 68 10/18/98 7:59p Jeff |
| 217 | * functions added to dmfc for client->server objnum matching. Banning |
| 218 | * now uses tracker id when available. |
| 219 | * |
| 220 | * 67 10/17/98 7:30p Jeff |
| 221 | * network_address compares don't compare port on somethings |
| 222 | * |
| 223 | * 66 10/15/98 6:18p Jeff |
| 224 | * created the is player banned event, removed prejoin event |
| 225 | * |
| 226 | * 65 10/15/98 1:34p Jeff |
| 227 | * added scrollable onscreen menu. Remove ban in dmfc. prejoin event |
| 228 | * |
| 229 | * 64 10/14/98 11:26p Jeff |
| 230 | * added scrollable menus |
| 231 | * |
| 232 | * 63 10/13/98 12:03p Kevin |
| 233 | * Changed use of preprocessors for debug, etc. |
| 234 | * |
| 235 | * 62 10/13/98 2:15a Jeff |
| 236 | * created new event for when a player leaves a multiplayer game. Fixed |
| 237 | * some 'english' bugs in the network games. |
| 238 | * |
| 239 | * 61 10/11/98 2:57a Jeff |
| 240 | * added new multiplayer event EVT_GAME_INTERVAL, which is to be called on |
| 241 | * interval, and EVT_HUD_INTERVAL is only to be called when the hud is to |
| 242 | * be rendered |
| 243 | * |
| 244 | * 60 10/08/98 3:37p Jeff |
| 245 | * general improvements (Netgame info things, save to registry). Changes |
| 246 | * so it would send packets on NETSEQ_OBJECTS |
| 247 | * |
| 248 | * 59 10/05/98 2:49p Jeff |
| 249 | * |
| 250 | * 58 10/01/98 7:02p Jeff |
| 251 | * implemented colored HUD callsigns |
| 252 | * |
| 253 | * 57 10/01/98 11:30a Jeff |
| 254 | * made the observer mode events into just a client event |
| 255 | * |
| 256 | * 56 9/30/98 4:21p Jeff |
| 257 | * team changing is handled correctly |
| 258 | * |
| 259 | * 55 9/30/98 3:50p Jeff |
| 260 | * general improvements (many) |
| 261 | * |
| 262 | * 54 9/29/98 3:04p Jeff |
| 263 | * added time in game and start_time support |
| 264 | * |
| 265 | * 53 9/28/98 5:05p Jeff |
| 266 | * made the statisitical death messages an option in the menu |
| 267 | * |
| 268 | * 52 9/25/98 7:25p Jeff |
| 269 | * |
| 270 | * 51 9/25/98 4:50p Jeff |
| 271 | * |
| 272 | * 50 9/24/98 6:54p Jeff |
| 273 | * added DisconnectMe() and made use of it when you get kicked/banned |
| 274 | * |
| 275 | * 49 9/24/98 5:52p Jeff |
| 276 | * starting adding statistical death messages, checked in for testing |
| 277 | * |
| 278 | * 48 9/23/98 4:17p Jeff |
| 279 | * basic changes/improvements, started changing death messages |
| 280 | * |
| 281 | * 47 9/21/98 7:11p Jeff |
| 282 | * made InputCommand interface API and moved existing input commands to |
| 283 | * the interface. Changed mprintf/ASSERT so they are valid in DMFC |
| 284 | * |
| 285 | * $NoKeywords: $ |
| 286 | */ |
| 287 | |
| 288 | #ifndef __DMFC_H__ |
| 289 | #define __DMFC_H__ |
| 290 | |
| 291 | #include <stdio.h> |
| 292 | #include <stdarg.h> |
| 293 | #include <time.h> |
| 294 | #include "gamedll_header.h" |
| 295 | #include "DMFCKeyCodes.h" |
| 296 | |
| 297 | #if ((defined POSIX) && (!defined __i386__)) |
| 298 | #include <signal.h> |
| 299 | #endif |
| 300 | |
| 301 | #ifndef RELEASE |
| 302 | |
| 303 | #ifdef WIN32 |
| 304 | #ifdef DEBUG_BREAK |
| 305 | #undef DEBUG_BREAK |
| 306 | #endif |
| 307 | #define DEBUG_BREAK() \ |
| 308 | do { \ |
| 309 | if (DLLDebugBreak_callback_stop) \ |
| 310 | DLLDebugBreak_callback_stop(); \ |
| 311 | debug_break(); \ |
| 312 | if (DebugBreak_callback_resume) \ |
| 313 | DebugBreak_callback_resume(); \ |
| 314 | } while (0) |
| 315 | |
| 316 | #define DLLASSERT(x) \ |
| 317 | do { \ |
| 318 | DLLassert(x, #x, __FILE__, __LINE__); \ |
| 319 | } while (0) |
| 320 | #define DLLmprintf(...) DLLDebug_ConsolePrintf(__VA_ARGS__) |
| 321 | #ifdef ASSERT |
| 322 | #undef ASSERT |
| 323 | #endif |
| 324 | #define ASSERT(x) \ |
| 325 | do { \ |
| 326 | DLLassert(x, #x, __FILE__, __LINE__); \ |
| 327 | } while (0) |
| 328 | |
| 329 | #ifdef Int3 |
| 330 | #undef Int3 |
| 331 | #endif |
| 332 | #define Int3() \ |
| 333 | do { \ |
| 334 | mprintf(0, "Int3 at %s line %d.\n", __FILE__, __LINE__); \ |
| 335 | if (DLLDebugBreak_callback_stop) \ |
| 336 | DLLDebugBreak_callback_stop(); \ |
| 337 | debug_break(); \ |
| 338 | if (DLLDebugBreak_callback_resume) \ |
| 339 | DLLDebugBreak_callback_resume(); \ |
| 340 | } while (0) |
| 341 | #elif defined(POSIX) |
| 342 | // For some reason Linux doesn't like the \ continuation character, so I have to uglify this |
| 343 | #define DLLmprintf(...) DLLDebug_ConsolePrintf(__VA_ARGS__) |
| 344 | #ifdef DEBUG_BREAK |
| 345 | #undef DEBUG_BREAK |
| 346 | #endif |
| 347 | #if (defined __i386__) || defined(__x86_64__) |
| 348 | #define DEBUG_BREAK() \ |
| 349 | do { \ |
| 350 | if (DLLDebugBreak_callback_stop) \ |
| 351 | DLLDebugBreak_callback_stop(); \ |
| 352 | __asm__ __volatile__("int $3"); \ |
| 353 | if (DLLDebugBreak_callback_resume) \ |
| 354 | DLLDebugBreak_callback_resume(); \ |
| 355 | } while (0) |
| 356 | #else |
| 357 | #define DEBUG_BREAK() \ |
| 358 | do { \ |
| 359 | if (DLLDebugBreak_callback_stop) \ |
| 360 | DLLDebugBreak_callback_stop(); \ |
| 361 | raise(SIGTRAP); \ |
| 362 | if (DLLDebugBreak_callback_resume) \ |
| 363 | DLLDebugBreak_callback_resume(); \ |
| 364 | } while (0) |
| 365 | #endif |
| 366 | |
| 367 | #ifdef ASSERT |
| 368 | #undef ASSERT |
| 369 | #endif |
| 370 | #define ASSERT(x) \ |
| 371 | do { \ |
| 372 | DLLassert(x, #x, __FILE__, __LINE__); \ |
| 373 | } while (0) |
| 374 | #define DLLASSERT(x) ASSERT(x) |
| 375 | #ifdef Int3 |
| 376 | #undef Int3 |
| 377 | #endif |
| 378 | #define Int3() \ |
| 379 | do { \ |
| 380 | mprintf(0, "Int3 at %s line %d.\n", __FILE__, __LINE__); \ |
| 381 | DEBUG_BREAK(); \ |
| 382 | } while (0) |
| 383 | #define HEAPCHECK() |
| 384 | #else |
| 385 | #ifdef DEBUG_BREAK |
| 386 | #undef DEBUG_BREAK |
| 387 | #define DEBUG_BREAK() |
| 388 | #endif |
| 389 | #define DLLASSERT(x) |
| 390 | #define DLLmprintf(...) |
| 391 | #ifdef Int3 |
| 392 | #undef Int3 |
| 393 | #define Int3() |
| 394 | #endif |
| 395 | #define Int3() |
| 396 | #ifdef ASSERT |
| 397 | #undef ASSERT |
| 398 | #define ASSERT(x) |
| 399 | #endif |
| 400 | #endif // OS check |
| 401 | |
| 402 | #else // Release build |
| 403 | #ifdef DEBUG_BREAK |
| 404 | #undef DEBUG_BREAK |
| 405 | #define DEBUG_BREAK() |
| 406 | #endif |
| 407 | #define DLLASSERT(x) |
| 408 | #define DLLmprintf(...) |
| 409 | #ifdef Int3 |
| 410 | #undef Int3 |
| 411 | #define Int3() |
| 412 | #endif |
| 413 | #define Int3() |
| 414 | #ifdef ASSERT |
| 415 | #undef ASSERT |
| 416 | #define ASSERT(x) |
| 417 | #endif |
| 418 | #endif |
| 419 | |
| 420 | #ifdef mprintf // undefine mprintf and redirect it to use DLLmprintf |
| 421 | #undef mprintf |
| 422 | #endif |
| 423 | #define mprintf DLLmprintf |
| 424 | |
| 425 | #define DLLMAX_PLAYERS MAX_PLAYERS |
| 426 | #define DLLMAX_TEAMS 4 |
| 427 | #define RED_TEAM 0 |
| 428 | #define BLUE_TEAM 1 |
| 429 | #define GREEN_TEAM 2 |
| 430 | #define YELLOW_TEAM 3 |
| 431 | |
| 432 | #define GR_GREY GR_RGB(128, 128, 128) |
| 433 | #define GR_GRAY GR_GREY |
| 434 | |
| 435 | #define SP_ALL -1 |
| 436 | #define SP_SERVER -2 |
| 437 | #define SPH_DMFCFUNC 0 |
| 438 | #define SPH_FUNC 1 |
| 439 | |
| 440 | #define HI_TEXT 0 |
| 441 | #define HI_BITMAP 1 |
| 442 | |
| 443 | #define MAX_TEAMNAME_LEN 16 |
| 444 | |
| 445 | // Defines for the window camera views |
| 446 | #define CV_NONE 0 // View not active |
| 447 | #define CV_REARVIEW 1 // Rear view |
| 448 | #define CV_MARKER1 2 // Marker view |
| 449 | #define CV_MARKER2 3 // Marker view |
| 450 | #define CV_MARKER3 4 // Marker view |
| 451 | #define CV_MARKER4 5 // Marker view |
| 452 | #define CV_MARKER5 6 // Marker view |
| 453 | #define CV_MARKER6 7 // Marker view |
| 454 | #define CV_MARKER7 8 // Last marker view |
| 455 | #define CV_MARKER8 9 // Last marker view |
| 456 | #define CV_GUIDEBOT 10 // Guide-Bot |
| 457 | #define NUM_CAMERA_VIEWS 3 |
| 458 | |
| 459 | /// special characters in the fonts |
| 460 | #define CHAR_LEFT_ARROW 24 |
| 461 | #define CHAR_UP_ARROW 25 |
| 462 | #define CHAR_RIGHT_ARROW 26 |
| 463 | #define CHAR_DOWN_ARROW 27 |
| 464 | #define CHAR_CHECKBOX_OFF 28 |
| 465 | #define CHAR_CHECKBOX_ON 29 |
| 466 | #define CHAR_RADIO_OFF 30 |
| 467 | #define CHAR_RADIO_ON 31 |
| 468 | |
| 469 | // The following defines are RGB definitions for colors that should be used throughout the UI for text |
| 470 | #define UICOL_HOTSPOT_LO \ |
| 471 | GR_RGB(85, 234, 3) // Color for a hotspot when it isn't in focus//GR_RGB(50,50,255) // Color for a hotspot |
| 472 | // when it isn't in focus |
| 473 | #define UICOL_HOTSPOT_HI GR_RGB(207, 248, 105) // Color for a hotspot when it is in focus |
| 474 | #define UICOL_TEXT_NORMAL GR_RGB(206, 254, 241) // Color for text that is used for labels |
| 475 | #define UICOL_WINDOW_TITLE GR_RGB(207, 248, 105) // Color for window title text |
| 476 | #define UICOL_TEXT_AUX GR_RGB(200, 200, 200) // Color for auxillary text (text that isn't a label) |
| 477 | #define UICOL_LISTBOX_LO GR_RGB(85, 234, 3) // Color for listbox text that isn't in focus |
| 478 | #define UICOL_LISTBOX_HI GR_RGB(207, 248, 105) // Color for listbox text that is in focus |
| 479 | #define UICOL_BUTTON_LO GR_RGB(85, 234, 3) // Color for text on a button that isn't in focus |
| 480 | #define UICOL_BUTTON_HI GR_RGB(207, 248, 105) // Color for text on a button that is in focus |
| 481 | #define UIALPHA_HOTSPOT_LO 192 // Alpha value for hotspots not in focus |
| 482 | #define UIALPHA_HOTSPOT_HI 255 // Alpha value for hotspots in focus |
| 483 | #define OKCANCEL_YOFFSET 50 // subtract this from the height of the window |
| 484 | |
| 485 | // additional flags for creating a newui window |
| 486 | #define NUWF_TITLENONE 0x00000000 // don't display a title bar |
| 487 | #define NUWF_TITLESMALL 0x00100000 // display a small title bar |
| 488 | #define NUWF_TITLEMED 0x00200000 // display a medium size title bar |
| 489 | #define NUWF_TITLELARGE 0x00300000 // display a large title bar |
| 490 | #define NUWF_TITLEBARMASK 0x00300000 // mask to use with flags to get title bar flags |
| 491 | |
| 492 | // predefined return values for DLLDoUI/DLLPollUI...exit the dialog immediatly!! |
| 493 | #define NEWUIRES_FORCEQUIT -2 |
| 494 | #define UID_OK 0xEE |
| 495 | #define UID_CANCEL 0xEF |
| 496 | |
| 497 | #define MAX_MENUNAME 32 |
| 498 | #define MF_SERVER 0x0001 |
| 499 | #define MF_CLIENT 0x0002 |
| 500 | #define MF_ALL 0x0003 |
| 501 | |
| 502 | #define REGT_STRING 0 |
| 503 | #define REGT_DWORD 1 |
| 504 | #define CFG_NOERROR 0 // There was no error |
| 505 | #define CFG_ALREADYOPEN 1 // The registry/cfg is already open |
| 506 | #define CFG_OUTOFMEMORY 2 // Out of memory |
| 507 | #define CFG_NOCFGFILE 3 // You didn't give a config file name |
| 508 | #define CFG_NOTOPEN 4 // You haven't opened the config file yet |
| 509 | #define CFG_KEYNOTFOUND 5 // The key you're looking up hasn't been created or isn't in the registry |
| 510 | #define CFG_RECORDNOTFOUND 6 // The record you're lookup up isn't in the active key |
| 511 | #define CFG_CANTCREATE 7 // There was an error trying to create a record |
| 512 | |
| 513 | #define MIT_NORMAL 0 // Allowed to have submenus |
| 514 | #define MIT_PLIST 1 // A Player List |
| 515 | #define MIT_STATE 2 // Radio Button like submenu list |
| 516 | #define MIT_STATEITEM 3 // Given to the submenu list items of the above |
| 517 | #define MIT_CUSTOM \ |
| 518 | 4 // use this along with filled in tCustomMenu* (as the only parm in the variable parms section |
| 519 | // of MenuItem constructor to create a user defined menu list |
| 520 | |
| 521 | #define MAX_STRING_LEN 32 // Maximum string length for a menu title |
| 522 | #define MAX_DMFC_TIMERS 16 |
| 523 | #define MAX_DEATH_MSGS 32 |
| 524 | |
| 525 | #define MAX_CALLSIGN_SIZE 25 |
| 526 | #define MAX_PLAYER_RECORDS 64 |
| 527 | #define DSTAT_LEVEL 0 |
| 528 | #define DSTAT_OVERALL 1 |
| 529 | |
| 530 | #define MAX_DBNAME_SIZE 32 |
| 531 | #define MAX_DBLABEL_SIZE 128 |
| 532 | |
| 533 | struct tCustomMenu { |
| 534 | int (*GetListCount)(void); // this function should return the number of items in the list |
| 535 | char *(*GetItem)(int index); // this function should return a string of the item at the given index, NULL on error |
| 536 | }; |
| 537 | |
| 538 | struct tPInfoStat { |
| 539 | int slot; // player record slot |
| 540 | int kills; // number of times you killed this player |
| 541 | int deaths; // number of times this player killed you |
| 542 | }; |
| 543 | |
| 544 | enum slot_state { STATE_EMPTY, STATE_INGAME, STATE_DISCONNECTED }; |
| 545 | |
| 546 | struct t_dstat { |
| 547 | int kills[2], deaths[2], suicides[2]; |
| 548 | }; |
| 549 | |
| 550 | class PInfo; |
| 551 | |
| 552 | struct player_record { |
| 553 | slot_state state; // state of this slot |
| 554 | char callsign[MAX_CALLSIGN_SIZE]; // Player's callsign |
| 555 | char *tracker_id; // Player's master tracker ID, NULL if there isn't one |
| 556 | network_address net_addr; // Player's address |
| 557 | int pnum; // Player's pnum |
| 558 | union { |
| 559 | float disconnect_time; // Time player disconnected |
| 560 | float start_time; // Time the player entered the game |
| 561 | }; |
| 562 | float total_time_in_game; // Total time the player has been in the game |
| 563 | t_dstat dstats; // DMFC's stats |
| 564 | void *user_info; // Multiplayer Mod user defined struct pointer |
| 565 | int user_info_size; // Size of user_info; |
| 566 | |
| 567 | int8_t team; // The player's team (for when they reconnect) |
| 568 | PInfo *pinfo; // Pointer to player info (who killed whom) |
| 569 | }; |
| 570 | |
| 571 | #define MIF_INCLUDENONE \ |
| 572 | 0x01 // for MIT_PSTATE, this will place a <None> at the top, it will send a -1 to the function, if selected |
| 573 | // #define MIF_IGNORESERVER 0x02 //for MIT_PSTATE, this will keep the server out of the list |
| 574 | // #define MIF_IGNOREME 0x04 //for MIT_PSTATE, this will keep your pnum out of the list |
| 575 | |
| 576 | #define MAX_COLUMN_TITLE_SIZE 15 |
| 577 | |
| 578 | enum tColumnType{ |
| 579 | DSCOL_KILLS_LEVEL, |
| 580 | DSCOL_KILLS_OVERALL, |
| 581 | DSCOL_KILLS_BOTH, |
| 582 | DSCOL_DEATHS_LEVEL, |
| 583 | DSCOL_DEATHS_OVERALL, |
| 584 | DSCOL_DEATHS_BOTH, |
| 585 | DSCOL_SUICIDES_LEVEL, |
| 586 | DSCOL_SUICIDES_OVERALL, |
| 587 | DSCOL_SUICIDES_BOTH, |
| 588 | DSCOL_PILOT_NAME, |
| 589 | DSCOL_PILOT_TEAM, |
| 590 | DSCOL_PING, |
| 591 | DSCOL_CUSTOM, |
| 592 | DSCOL_BLANK, |
| 593 | DSCOL_BMP |
| 594 | }; |
| 595 | |
| 596 | enum tColorType { DSCOLOR_NORMAL, DSCOLOR_TEAM, DSCOLOR_SHIPCOLOR, DSCOLOR_CUSTOM }; |
| 597 | |
| 598 | struct tDmfcStatsColumnInfo { |
| 599 | // what type of information should be displayed in this column, use custom if you want |
| 600 | // the callback to fill in your own data |
| 601 | tColumnType type; |
| 602 | // what type of color to use |
| 603 | tColorType color_type; |
| 604 | // title for column |
| 605 | char title[MAX_COLUMN_TITLE_SIZE]; |
| 606 | // width of the column (note: columns will not be rendered if the total width of the |
| 607 | // columns exceeds the width of the display) |
| 608 | int width; |
| 609 | // color of the text for this column (if color type is custom) |
| 610 | ddgr_color color; |
| 611 | }; |
| 612 | |
| 613 | //===================================================================== |
| 614 | // tDmfcStatsInit flags |
| 615 | #define DSIF_SEPERATE_BY_TEAM \ |
| 616 | 0x00000001 // this tells the stats manager to seperate the players by |
| 617 | // team (useful only in a team game). By default it will |
| 618 | // list all the players in a straight list |
| 619 | #define DSIF_SHOW_PIC \ |
| 620 | 0x00000002 // The pilot's picture (if available else logo if available) should |
| 621 | // be shown in the detailed section |
| 622 | #define DSIF_ONLY_X_PLAYERS_SHOWN \ |
| 623 | 0x000004 // If set, than the MaxNumberDisplayed member of tDmfcStatsInit |
| 624 | // must also be valid (throughout the lifetime of the stats |
| 625 | // being displayed). The stat manager will only display |
| 626 | // (*MaxNumberDisplayed) stats (checked each frame). |
| 627 | #define DSIF_SHOW_OBSERVERICON \ |
| 628 | 0x00000008 // if this flag is given, the observer mode icon will be |
| 629 | // displayed as the first item in the column |
| 630 | #define DSIF_NOLASTKILLER 0x00000010 // don't display the "Last Killer" |
| 631 | #define DSIF_NOLASTVICTIM 0x00000020 // don't display the "Last Victim" |
| 632 | #define DSIF_NODETAILEDINFO 0x00000040 // don't display the detailed stats |
| 633 | #define DSIF_SHOWPLAYERVIEW \ |
| 634 | 0x00000080 // display the current view of the selected player (only available if DSIF_NODETAILEDINFO is also set) |
| 635 | |
| 636 | //===================================================================== |
| 637 | struct tDmfcStatsInit { |
| 638 | // see the DSIF_* for the list of available flags and descriptions |
| 639 | int flags; |
| 640 | // points to an array of player record numbers, sorted to however you want them sorted. Each |
| 641 | // frame this array will be used when displaying the stats. |
| 642 | int *SortedPlayerRecords; |
| 643 | // the number of columns you want printed in the player list column for each player |
| 644 | int cColumnCountPlayerList; |
| 645 | // the number of columns you want printed in the detailed player info |
| 646 | int cColumnCountDetailed; |
| 647 | // Informtaion for the player list columns (array of tDmfcStatsColumnInfo structs) |
| 648 | tDmfcStatsColumnInfo *PlayerListColumns; |
| 649 | // Information for the detailed columns (array of tDmfcStatsColumnInfo structs) |
| 650 | tDmfcStatsColumnInfo *DetailedColumns; |
| 651 | // Callback function when the stats manager needs to get information when displaying a playerlist column |
| 652 | // precord_num: contains the player record number of the player it needs information about |
| 653 | // column_num: which column (index into the PlayerListColumns array) it is working on |
| 654 | // buffer: buffer to fill in for your data |
| 655 | // buffer_size: number of bytes you can use for your data (IT MUST BE NULL TERMINATED STRING) |
| 656 | void (*clbPlayerColumn)(int precord_num, int column_num, char *buffer, int buffer_size); |
| 657 | // Callback function when the stats manager needs to get information when displaying a detailed column |
| 658 | // precord_num: contains the player record number of the player it needs information about |
| 659 | // column_num: which column (index into the DetailedColumns array) it is working on |
| 660 | // buffer: buffer to fill in for your data |
| 661 | // buffer_size: number of bytes you can use for your data (IT MUST BE NULL TERMINATED STRING) |
| 662 | void (*clbDetailedColumn)(int precord_num, int column_num, char *buffer, int buffer_size); |
| 663 | // Callback function when the stats manager needs to draw the custom bitmap on the playerlist column |
| 664 | // precord_num: contains the player record number of the player it displaying |
| 665 | // column_num: which column (index into the PlayerListColumns array) it is working on |
| 666 | // x,y,w,h: the (x,y) position of the upper left corner of the area, and the allowed width/height |
| 667 | // handle the drawing in this function |
| 668 | void (*clbPlayerColumnBMP)(int precord_num, int column_num, int x, int y, int w, int h, uint8_t alpha_to_use); |
| 669 | // Callback function when the stats manager needs to draw the custom bitmap on the detailed column |
| 670 | // precord_num: contains the player record number of the player it displaying |
| 671 | // column_num: which column (index into the DetailedColumns array) it is working on |
| 672 | // x,y,w,h: the (x,y) position of the upper left corner of the area, and the allowed width/height |
| 673 | // handle the drawing in this function |
| 674 | void (*clbDetailedColumnBMP)(int precord_num, int column_num, int x, int y, int w, int h, uint8_t alpha_to_use); |
| 675 | // Callback function when the stats manager needs to display team info for a particular team |
| 676 | // team: contains the team it's displaying about (0 = red, ... 3 = yellow) |
| 677 | // buffer: buffer to fill in for your data |
| 678 | // buffer_size: number of bytes you can use for your data (IT MUST BE NULL TERMINATED STRING) |
| 679 | void (*clTeamLine)(int team, char *buffer, int buffer_size); |
| 680 | // Points to a buffer that contains the name of the multiplayer game (NULL TERMINATED STRING) |
| 681 | char *GameName; |
| 682 | // if the DSIF_ONLY_X_PLAYERS_SHOWN flag is set, than the stat manager checks this value (dereferenced) every frame |
| 683 | // and will only show this many players |
| 684 | int *MaxNumberDisplayed; |
| 685 | }; |
| 686 | |
| 687 | #endif |