Debian Codegraph @

netgames/dmfc/dmfcinternal.h

raw symbols SCIP
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/dmfcinternal.h $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003/08/26 03:57:21 $
23 * $Author: kevinb $
24 *
25 * Internal DMFC header
26 *
27 * $Log: dmfcinternal.h,v $
28 * Revision 1.1.1.1 2003/08/26 03:57:21 kevinb
29 * initial 1.5 import
30 *
31 *
32 * 76 9/05/01 6:04p Matt
33 * Added code to save the user's preferred HUD name level setting even if
34 * the server bashes it down.
35 *
36 * 75 9/28/99 10:55a Jeff
37 * changed size of pointer for mastertracker game from uint8_t* to int*
38 *
39 * 74 8/21/99 12:32a Jeff
40 * Changed the name of the GetRealGametime function to
41 * GetRealGametimePacket since it was confusing some compilers with the
42 * other GetRealGametime function.
43 *
44 * 73 8/15/99 4:36p Jeff
45 * finished exporting all inventory class functions. export object_info
46 * array. added check for -nooutragelogo to display Outrage logo display.
47 *
48 * 72 8/11/99 1:47p Jeff
49 * interface functions
50 *
51 * 71 7/16/99 2:43p Jeff
52 * changed CreateMenuItemWArgs function
53 *
54 * 70 7/14/99 11:47a Jeff
55 * localized text for patch fixes
56 *
57 * 69 7/13/99 10:05a Jeff
58 * text taunt token decoding
59 *
60 * 68 7/11/99 3:31p Jeff
61 * exported game arguments, made command line option to specify
62 * autoexec.dmfc
63 *
64 * 67 7/09/99 7:02p Jeff
65 * put in countdown timer for when a level is about to end
66 *
67 * 66 7/09/99 6:18p Jeff
68 * added $remoteadminlogout and $wait commands
69 *
70 * 65 7/09/99 2:54p Jeff
71 * handle gametime better (pause it when needed) if the server is 'waiting
72 * for players'
73 *
74 * 64 7/08/99 9:55p Jeff
75 * added event handler for weapon fired event
76 *
77 * 63 7/08/99 6:25p Jeff
78 * remote admin in and working
79 *
80 * 62 7/08/99 2:39a Jeff
81 * rough implementation of remote administration checked in. Still needs
82 * some polishing, but should work basically.
83 *
84 * 61 7/07/99 6:10p Jeff
85 * don't count the time that a player is in observer mode for death/kill
86 * messages
87 *
88 * 60 7/07/99 5:00p Jeff
89 * removed vararg functions from interface functions, just made different
90 * versions of them
91 *
92 * 59 7/07/99 12:16p Jeff
93 * all mangles symbol names fixed. Finished making interface functions.
94 *
95 * 58 6/10/99 5:42p Jeff
96 * fixed mprintf define
97 *
98 * 57 6/10/99 11:10a Jeff
99 * don't display the Outrage logo for non-Outrage games
100 *
101 * 56 5/22/99 1:12a Jeff
102 * correctly handle Viewer_object
103 *
104 * 55 5/19/99 11:51p Jeff
105 * set version number for 1.0 for release
106 *
107 * 54 5/13/99 11:46a Jeff
108 * increased version number
109 *
110 * 53 5/12/99 11:04p Jeff
111 * dmfc and multiplayer games now have endian friendly packets (*whew*)
112 *
113 * 52 5/10/99 2:44a Jeff
114 * handle new scheme of player's joining in a team game, where the team is
115 * set before player enters game in the main code, but the team is
116 * determined via event call to dmfc
117 *
118 * 51 5/09/99 6:20a Jeff
119 * improved Entropy (added sounds, max virii per room). Fixed rendering
120 * bugs for other multiplayer dlls.
121 *
122 * 50 5/08/99 11:06a Jeff
123 *
124 * 49 5/07/99 12:52p Jeff
125 * audio taunt icon is ppic if available. coop has hard max team set of 4
126 *
127 * 48 5/04/99 8:46p Jeff
128 * display icon when someone plays an audio taunt
129 *
130 * 47 4/30/99 10:53p Jeff
131 * added $warp command
132 *
133 * 46 4/30/99 7:36p Jeff
134 * exported vis_effects to dmfc
135 *
136 * 45 4/25/99 7:19p Jeff
137 * added code to handle suicides in pinfo
138 *
139 * 44 4/23/99 6:15p Jeff
140 * fixed double calls to GameClose
141 *
142 * 43 4/19/99 3:54a Jeff
143 * got compiling for Linux
144 *
145 * 42 4/14/99 1:15a Jeff
146 * fixed case mismatched #includes
147 *
148 * 41 4/12/99 11:36a Jeff
149 * added permissable cs string
150 *
151 * 40 4/04/99 4:56p Jeff
152 * added functionality to call osiris functions from multiplayer d3ms
153 *
154 * 39 4/03/99 4:06p Jeff
155 * added loss/ping gauge
156 *
157 * 38 3/30/99 9:01p Jeff
158 * exported polymodels
159 *
160 * 37 3/30/99 7:42p Jeff
161 * fixed a misspelling on a function name
162 *
163 * 36 3/27/99 4:53p Jeff
164 * player rankings in multiplayer games implemented. Fixed join message
165 * so it doesn't get cut off
166 *
167 * 35 3/22/99 6:20p Jeff
168 * added 2 more audio taunts. a mulitplayer event when someone plays an
169 * audio taunt. option to disable audio taunts.
170 *
171 * 34 3/22/99 1:55p Jeff
172 * make sure initialization happens (possible crashing)
173 *
174 * 33 3/17/99 12:24p Jeff
175 * converted DMFC to be COM interface
176 *
177 * 32 1/19/99 3:55a Jeff
178 * all strings localized out
179 *
180 * 31 1/18/99 7:27p Jeff
181 * localized strings in dmfcbase.cpp
182 *
183 * 30 1/10/99 7:41p Jeff
184 * added initial version of waitforplayers dialog
185 *
186 * 29 1/04/99 12:21p Jeff
187 * added support for hosts.allow/deny and updates stats manager a little
188 *
189 * 28 12/08/98 12:17p Jeff
190 * various changes that include an improved Team Control dialog (doesn't
191 * switch teams until exit..) and spew/respawn players that change teams
192 *
193 * 27 11/19/98 5:56p Jeff
194 * added slider exported and improved Hoard
195 *
196 * 26 11/17/98 6:29p Jeff
197 * mod can specify whether or not to display the team setup dialog on team
198 * game start. Added a menu item to display team setup dialog in mid-game
199 *
200 * 25 11/16/98 5:35p Jeff
201 * removed log functions, added support for changing team names, fixed ctf
202 * to work better with different team names
203 *
204 * 24 11/11/98 7:19p Jeff
205 * changed version number
206 *
207 * 23 11/11/98 7:19p Jeff
208 * changes made so that a dedicated server's team is always -1 (team game
209 * or not)
210 *
211 * 22 10/29/98 7:01p Jeff
212 * creation of team placement dialog. Moved TranslateEvent into DMFC
213 *
214 * 21 10/20/98 4:35p Jeff
215 * added a flag for menu to add a <None> to MIT_PLIST...
216 *
217 * 20 10/20/98 12:16p Jeff
218 * added death message filter, hud callsign filter
219 *
220 * 19 10/18/98 7:59p Jeff
221 * functions added to dmfc for client->server objnum matching. Banning
222 * now uses tracker id when available.
223 *
224 * 18 10/15/98 1:34p Jeff
225 * added scrollable onscreen menu. Remove ban in dmfc. prejoin event
226 *
227 * 17 10/08/98 3:37p Jeff
228 * general improvements (Netgame info things, save to registry). Changes
229 * so it would send packets on NETSEQ_OBJECTS
230 *
231 * 16 10/05/98 2:50p Jeff
232 *
233 * 15 9/30/98 3:50p Jeff
234 * general improvements (many)
235 *
236 * 14 9/29/98 3:04p Jeff
237 * added time in game and start_time support
238 *
239 * 13 9/28/98 5:05p Jeff
240 * made the statisitical death messages an option in the menu
241 *
242 * 12 9/24/98 5:52p Jeff
243 * starting adding statistical death messages, checked in for testing
244 *
245 * 11 9/21/98 7:11p Jeff
246 * made InputCommand interface API and moved existing input commands to
247 * the interface. Changed mprintf/ASSERT so they are valid in DMFC
248 *
249 * $NoKeywords: $
250 */
251
252 #ifndef __DMFC_INTERNAL_H
253 #define __DMFC_INTERNAL_H
254
255 #include <stdio.h>
256 #include <stdarg.h>
257 #include <time.h>
258 #include "idmfc.h"
259 #include "DMFC.h"
260 #include "gamedll_header.h"
261 #include "DMFCKeyCodes.h"
262
263 #define DMFC_VERSION_MAJOR 1
264 #define DMFC_VERSION_MINOR 0
265
266 // DEMO 1.0
267 // #define DMFC_VERSION_MAJOR 0
268 // #define DMFC_VERSION_MINOR 60
269
270 class DMFCBase;
271
272 #ifdef mprintf // undefine mprintf and redirect it to use DLLmprintf
273 #undef mprintf
274 #endif
275 #define mprintf(...) DLLmprintf(__VA_ARGS__)
276
277 #define MAX_DBNAME_SIZE 32
278 #define MAX_DBLABEL_SIZE 128
279
280 // DMFC Control Messages
281 #define CM_KICKED 0xFF // tell the player he is kicked
282 #define CM_BANNED 0xFE // tell the player he is banned
283 #define CM_TEAMCHANGEDENIED 0xFD // tell the player change team request denied
284 #define CM_SIGNALSTART 0xFC // tell the player he can start moving
285 #define CM_SIGNALWAIT 0xFB // tell the player to stop moving
286 #define CM_PAUSETIME 0xFA // tell the player to pause gametime
287 #define CM_UNPAUSETIME 0xF9 // tell the player to unpause gametime
288
289 struct tDeathMsg {
290 char *message; // pointer to the actual message
291 bool inuse; // whether the node is being used
292 bool victim_first; // whether the victim is listed first or second in the message
293 };
294
295 struct tSPHandler {
296 void (*func)(uint8_t *); // Function handler to handle the packet
297 void (DMFCBase::*DMFCfunc)(uint8_t *);
298 tSPHandler *next; // Pointer to next handler
299 int type;
300 uint8_t ID; // ID of special packet
301 };
302
303 // Struct for Input Command nodes (commands that begin with $)
304 struct tInputCommandNode {
305 char *data;
306 char *desc;
307 tInputCommandNode *next;
308 void (*handler)(const char *);
309 bool allow_remote;
310 };
311
312 struct tPKillerInfo {
313 uint8_t slot;
314 int kills;
315 tPKillerInfo *next;
316 };
317
318 struct tPExtraInfo {
319 float last_kill_time; // Game time of the last kill for this player (previous kill)
320 float last_death_time; // Game time of the last time this player was killed (previous death)
321 float kill_time; // time of latest kill
322 float death_time; // time of latest death
323 float observer_time; // time the player entered observer mode (or 0 if not)
324 uint16_t kills_in_a_row; // Number of kills in a row for this player
325 uint16_t deaths_in_a_row; // Number of deaths in a row for this player
326 int8_t last_kill_num; // Player record num of last person this player killed
327 int8_t last_death_num; // Player record num of the player that last killed this player
328 char got_revenge; // 1 if revenge has been made on last killer
329 };
330
331 class PInfo {
332 public:
333 PInfo(int slot);
334 ~PInfo();
335 tPKillerInfo *GetKillerInfo(int slot);
336 void Update(int slot, tPKillerInfo *amount);
337 tPKillerInfo *GetFirstKiller(void);
338 tPKillerInfo *GetNextKiller(void);
339 void RemoveKiller(int slot);
340 void ResetAll(void);
341 int GetSizeOfData(void);
342 int GetExtraInfoSize(void);
343 void PackData(uint8_t *buffer);
344 bool UnpackData(uint8_t *buffer, int buffsize);
345 tPExtraInfo *GetExtraInfo(void);
346 void HandleKill(int killer_num);
347 void HandleDeath(int victim_num);
348 void HandleSuicide(void);
349 void EnterObserverMode(void);
350 void ExitObserverMode(void);
351
352 private:
353 tPKillerInfo *FindKiller(int slot, tPKillerInfo **prev = NULL);
354 tPKillerInfo *CreateKiller(int slot);
355 tPKillerInfo *killer_list;
356 tPKillerInfo *curr;
357 tPExtraInfo extra_info;
358 int m_slot;
359 };
360
361 class MenuItem : public IMenuItem {
362 public:
363 MenuItem();
364 MenuItem(const char *title, char type, uint8_t flags, void (*fp)(int), ...); // the last parameters are the state items, which
365 // is an int (the number of states), followed by
366 // an int (the initial state), followed by a
367 // a list of char * to the names of the items
368 // this is required for MIT_STATE type only
369 ~MenuItem();
370
371 bool AddSubMenu(IMenuItem *p);
372 bool DetachSubMenu(IMenuItem *p);
373
374 bool Forward(void);
375 bool Back(void);
376 bool Up(void);
377 bool Down(void);
378
379 void Execute(void);
380 void Draw(int x, int y, int height, int backgroundbmp, float *ratio = NULL);
381
382 void SetInputFocus(void);
383 void LoseInputFocus(void);
384 bool GetFocus(void);
385
386 const char *GetTitle(void);
387 int GetCustomSubMenuCount(void);
388
389 void CallFunc(int value);
390 bool HasSubMenus(void);
391 char GetType(void);
392
393 void SetState(int state);
394 bool SetStateItemList(int count, ...);
395 bool SetStateItemListArray(int count, char **array);
396
397 public:
398 void Delete(void);
399 void *Dynamic_Cast(const char *pszType);
400 void DuplicatePointer(void);
401 void DestroyPointer(void);
402
403 private:
404 int m_cPtrs;
405 // How many submenus this has
406 int SubMenuCount;
407 // Points to the currently active submenu (-1 if none)
408 int CurrSubMenu;
409 // State of the menu (only for MIT_STATE)
410 int m_iState;
411 // List of player nums according to the submenu index
412 int Pnums[DLLMAX_PLAYERS];
413 // The array of Submenus
414 IMenuItem **SubMenus;
415 // The title for this Menu
416 char m_sTitle[MAX_STRING_LEN];
417 // Handler for execute
418 void (*func)(int);
419 // true is this menu currently has input focus
420 bool HasInputFocus;
421 // What type of submenus this has
422 // only if this is set to MIT_NORMAL can it have submenus of its submenus
423 // no submenus are allowed to be added to a MIT_PLIST, as this is automatically handled
424 // no submenus are allowed for MIT_STATEITEM as they are specific ends for a MIT_STATE submenu
425 char m_cType;
426 uint8_t m_iFlags;
427 uint8_t m_Alpha;
428 bool m_AlphaDir;
429 int m_iTopIndex;
430 bool m_bMoreToScroll, m_bAtBottom;
431 tCustomMenu m_cmInfo;
432 };
433
434 struct tDMFCTimerInfo {
435 bool inuse;
436 void (*handler)(void);
437 void (*onkill)(void);
438 float starttime;
439 float longevity;
440 float nexttime;
441 float intval;
442 };
443
444 struct tWeaponKillMsg {
445 bool inuse;
446 bool victim_first;
447 char *message;
448 };
449
450 struct tBanItem {
451 network_address addr;
452 char callsign[MAX_CALLSIGN_SIZE];
453 char tracker_id[24];
454 tBanItem *next;
455 };
456
457 // This class handles displaying and processing a customizable and detailed stats screen (in-game)
458 class CDmfcStats : public IDmfcStats {
459 public:
460 // constuctor/destructor
461 CDmfcStats();
462 ~CDmfcStats();
463
464 // initialization member function, must be called first
465 bool Initialize(tDmfcStatsInit *init_info);
466
467 // enables/disables the displaying of the stats screen
468 void Enable(bool enable);
469 // returns the state of the stats manager
470 bool IsEnabled();
471
472 // the do-it-all function, call once per frame
473 void DoFrame();
474 // scrolls the player list down one
475 void ScrollDown();
476 // scrolls the player list up one
477 void ScrollUp();
478 // returns true if the player list can scroll down any more
479 bool CanScrollDown();
480 // returns true if the player list can scroll up any more
481 bool CanScrollUp();
482
483 public:
484 void Delete(void);
485 void *Dynamic_Cast(const char *pszType);
486 void DuplicatePointer(void);
487 void DestroyPointer(void);
488
489 protected:
490 int m_cPtrs;
491
492 // true if initialized
493 bool m_init;
494 int m_flags;
495 // array of sorted prec numbers
496 int *m_SortedPRecs;
497 // pointer to the max number displayed (if the flag is set)
498 int *m_pMaxNumberDisplayed;
499 // number of players to be displayed for this frame
500 int m_MaxCount;
501 // number of columns for the player lists
502 int m_iPLColCount;
503 // number of columns for the detailed list
504 int m_iDColCount;
505 // information for the player list columns
506 tDmfcStatsColumnInfo *m_PLColInfo;
507 // information for the detailed columns
508 tDmfcStatsColumnInfo *m_DColInfo;
509 // callback for DSCOL_CUSTOM column types for Player list
510 void (*m_PLColCallback)(int precord_num, int column_num, char *buffer, int buffer_size);
511 // callback for DSCOL_CUSTOM column types for detailed
512 void (*m_DColCallback)(int precord_num, int column_num, char *buffer, int buffer_size);
513 // callback for DSCOL_BMP column types for Player list (bitmaps)
514 void (*m_PLColCallbackBMP)(int precord_num, int column_num, int x, int y, int w, int h, uint8_t alpha_to_use);
515 // callback for DSCOL_BMP column types for detailed (bitmaps)
516 void (*m_DColCallbackBMP)(int precord_num, int column_num, int x, int y, int w, int h, uint8_t alpha_to_use);
517 // callback for team data
518 void (*m_TeamCallback)(int team, char *buffer, int buffer_size);
519 // name of the multiplayer game
520 char *m_GameName;
521
522 // starting scroll index
523 int m_top_index;
524 // selected index
525 int m_selected_index;
526 // bottom index value
527 int m_bottom_index;
528 // true if the stats is enabled
529 bool m_enabled;
530 // height of the font
531 int m_font_height;
532 // starting y value of player list data
533 int m_y_start_plist;
534 // starting y value of detailed list data
535 int m_y_start_detail;
536 // starting x value of player list data
537 int m_x_start_plist;
538 // starting x value of detailed list data
539 int m_x_start_detail;
540 // selected prec num
541 int m_selected_prec;
542 // translatation index->prec
543 int m_translate[MAX_PLAYER_RECORDS];
544
545 // bmp handle to highlight bar
546 int m_highlight_bmp;
547 // bmp handle to window background
548 int m_background_bmp;
549 // what page of who-killed-who stats are we on
550 int m_page_index;
551 // how many items can we fit on the who-killed-who stats
552 int m_can_fit_count;
553 // how long has the current page been displayed
554 float m_page_display_time;
555 // does this guy have multiple pages?
556 bool m_has_multiple_pages;
557 // alpha of the items
558 uint8_t m_alpha;
559 float alpha_in_time;
560
561 // validates all the variables
562 void ValidateInfo();
563
564 // renders the stats screen
565 void Render();
566
567 // displays in a window the view of the viewer object
568 void DisplayPlayerView(int x, int y, int w, int h, object *viewer);
569 };
570
571 struct tHostsNode {
572 uint32_t ip;
573 uint32_t mask;
574 tHostsNode *next;
575 }; // Allow/Deny IP address nodes
576
577 // DMFCBase class
578 // This is the base class that the DMFCApp class is based off of. This just handles general
579 // functions, and handling default events.
580 class DMFCBase : public IDMFC {
581 public:
582 DMFCBase(void);
583 ~DMFCBase(void);
584
585 // ##################Setup and processing functions#######################
586
587 // DMGFBase::LoadFunctions
588 //
589 // Initializes all the functions for a multiplayer game...must be first thing called
590 void LoadFunctions(int *api_func);
591
592 // DMFCBase::GameInit
593 //
594 // Sets up all the DLL functions and pointers and preps the class for use. This ABSOLUTLY must be
595 // called, so if you override DMFCApp::GameInit, make sure that you put a call to this somewhere in
596 // the override.
597 void GameInit(int teams);
598
599 // DMFCBase::GameClose
600 //
601 // Closes up any needed DLL and DMFC tasks. This ABSOLUTLY must be called, so if you override
602 // DMFCApp::GameClose, make sure that you put a call to this somewhere in the override
603 void GameClose(void);
604
605 // ###################Server Only functions################################
606
607 // DMFCBase::OnServerPlayerKilled
608 //
609 // Event handler for when a player gets killed, either by another player or some other way
610 // killer_obj = object pointer to the object that killed the player
611 // victim_pnum = player number of the player that got killed
612 virtual void OnServerPlayerKilled(object *killer_obj, int victim_pnum);
613
614 // DMFCBase::OnServerPlayerExploded
615 //
616 // Event handler for when a player explodes. Gets called after a EVT_GAMEPLAYERKILLED event.
617 // player_num = player number of the player exploding
618 virtual void OnServerPlayerExploded(int player_num);
619
620 // DMFCBase::OnServerCollide
621 //
622 // Event handler for when two objects collide. At least one of the two objects is a player or a robot.
623 // Be aware that this event will be called twice per collision, the second time it is called the me and
624 // it objects will be flipped.
625 // me_obj = object pointer to the me object
626 // it_obj = object pointer to the it object
627 virtual void OnServerCollide(object *me_obj, object *it_obj);
628 virtual void OnServerCollide(object *me_obj, object *it_obj, vector *point, vector *normal);
629
630 // DMFCBase::OnServerPlayerChangeSegment
631 //
632 // Event handler for when a player changes rooms or a "large" terrain cell
633 // (8x8 Terrain block).
634 // player_num = player number of the player who just changed the room/segment
635 // newseg = New room/cell location
636 // oldseg = Old room/cell location
637 virtual void OnServerPlayerChangeSegment(int player_num, int newseg, int oldseg);
638
639 // DMFCBase::OnServerObjectChangeSegment (Only called if server tells client to execute)
640 //
641 // Event handler for when a player changes rooms or a "large" terrain cell
642 // (8x8 Terrain block).
643 // obj = Object pointer of the object who just changed the room/segment
644 // newseg = New room/cell location
645 // oldseg = Old room/cell location
646 virtual void OnServerObjectChangeSegment(object *obj, int newseg, int oldseg);
647
648 // DMFCBase::OnServerPlayerEntersGame
649 //
650 // Event handler for when a player enters the game. This will only get called once per
651 // player, it usually gets called right after they connect to the server to start playing.
652 // player_num = player number of the player entering the game
653 virtual void OnServerPlayerEntersGame(int player_num);
654
655 // DMFCBase::OnServerPlayerDisconnect
656 //
657 // Event handler for when a player disconnects from the server.
658 // player_num = player number of the player that just disconnected
659 virtual void OnServerPlayerDisconnect(int player_num);
660
661 // DMFCBase::OnServerGameCreated
662 //
663 // Event handler when the server's game first gets started. This will only be called once
664 // while the server is running, and that is when the server first starts up.
665 virtual void OnServerGameCreated(void);
666
667 // DMFCBase::OnServerLevelChange
668 //
669 // Event handler when the server changes levels. This will get called after a level ends and a server
670 // is starting a new level.
671 virtual void OnServerLevelChange(void);
672
673 // DMFCBase::OnServerLevelStart
674 //
675 // Event handler for when a multiplayer level is starting up. This will get called right before the level
676 // starts.
677 virtual void OnServerLevelStart(void);
678
679 // DMFCBase::OnServerLevelEnd
680 //
681 // Event handler for when a multiplayer level is ending.
682 virtual void OnServerLevelEnd(void);
683
684 // DMFCBase::OnServerObjectShieldsChanged
685 //
686 // Event handler for when an objects shield's change
687 virtual void OnServerObjectShieldsChanged(object *obj, float amount);
688
689 // DMFCBase::OnServerIsAddressBanned
690 //
691 // Called by the game to determine if the given network address is banned from the game
692 virtual bool OnServerIsAddressBanned(network_address *addr, const char *tracker_id);
693
694 // DMFCBase::OnServerWallCollide
695 //
696 // Called by the game when their is a collision between an object and a wall
697 virtual void OnServerWallCollide(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt,
698 vector *wall_normal, float hit_dot);
699
700 // DMFCBase::OnServerObjectKilled
701 //
702 // Called when an object is being killed
703 // Not automatically sent to clients (OnClientObjectKilled)
704 // killer might not be valid (NULL)
705 virtual void OnServerObjectKilled(object *obj, object *killer);
706
707 // DMFCBase::OnServerObjectDestroyed
708 //
709 // Called when an object is about to be deleted
710 // Not automatically sent to clients
711 virtual void OnServerObjectDestroyed(object *obj);
712
713 // ######################### Client allowed event handlers############################
714
715 // DMFCBase::OnClientPlayerKilled (Only called if server tells client to execute)
716 //
717 // Event handler for when a player gets killed, either by another player or some other way.
718 // killer_obj = object pointer to the object that killed the player
719 // victim_pnum = player number of the player that got killed
720 virtual void OnClientPlayerKilled(object *killer_obj, int victim_pnum);
721
722 // DMFCBase::OnClientPlayerExploded (Only called if server tells client to execute)
723 //
724 // Event handler for when a player explodes. Gets called after a EVT_GAMEPLAYERKILLED event.
725 // player_num = player number of the player exploding
726 virtual void OnClientPlayerExploded(int player_num);
727
728 // DMFCBase::OnClientCollide (Only called if server tells client to execute)
729 //
730 // Event handler for when two objects collide. At least one of the two objects is a player or a robot.
731 // Be aware that this event will be called twice per collision, the second time it is called the me and
732 // it objects will be flipped.
733 // ALSO NOTE: In order for the OnClientCollide() that passes the point and normal to have valid values
734 // the server must pass true to the parameter to send arguments in CallClientEvent().
735 // me_obj = object pointer to the me object
736 // it_obj = object pointer to the it object
737 virtual void OnClientCollide(object *me_obj, object *it_obj);
738 virtual void OnClientCollide(object *me_obj, object *it_obj, vector *point, vector *normal);
739
740 // DMFCBase::OnClientPlayerChangeSegment (Only called if server tells client to execute)
741 //
742 // Event handler for when a player changes rooms or a "large" terrain cell
743 // (8x8 Terrain block).
744 // player_num = player number of the player who just changed the room/segment
745 // newseg = New room/cell location
746 // oldseg = Old room/cell location
747 virtual void OnClientPlayerChangeSegment(int player_num, int newseg, int oldseg);
748
749 // DMFCBase::OnClientObjectChangeSegment (Only called if server tells client to execute)
750 //
751 // Event handler for when a player changes rooms or a "large" terrain cell
752 // (8x8 Terrain block).
753 // obj = Object pointer of the object who just changed the room/segment
754 // newseg = New room/cell location
755 // oldseg = Old room/cell location
756 virtual void OnClientObjectChangeSegment(object *obj, int newseg, int oldseg);
757
758 // DMFCBase::OnClientPlayerEntersGame (Only called if server tells client to execute)
759 //
760 // Event handler for when a player enters the game. This will only get called once per
761 // player, it usually gets called right after they connect to the server to start playing.
762 // player_num = player number of the player entering the game
763 virtual void OnClientPlayerEntersGame(int player_num);
764
765 // DMFCBase::OnClientPlayerDisconnect (Only called if server tells client to execute)
766 //
767 // Event handler for when a player disconnects from the server.
768 // player_num = player number of the player that just disconnected
769 virtual void OnClientPlayerDisconnect(int player_num);
770
771 // DMFCBase::OnMeDisconnectFromServer
772 //
773 // Event handler that gets called if we disconnect from the server for some reason (not purposesly quit)
774 virtual void OnMeDisconnectFromServer(void);
775
776 // DMFCBase::OnClientGameCreated (Only called if server tells client to execute)
777 //
778 // Event handler when the server's game first gets started. This will only be called once
779 // while the server is running, and that is when the server first starts up.
780 virtual void OnClientGameCreated(void);
781
782 // DMFCBase::OnClientObjectShieldsChanged
783 //
784 // Event handler for when an objects shield's change
785 virtual void OnClientObjectShieldsChanged(object *obj, float amount);
786
787 // DMFCBase::OnWeaponFired
788 //
789 // Event handler for when an object fires a weapon
790 virtual void OnWeaponFired(object *weapon_obj, object *shooter);
791
792 // DMFCBase::OnClientLevelChange (Only called if server tells client to execute)
793 //
794 // Event handler when the server changes levels. This will get called after a level ends and a server
795 // is starting a new level.
796 virtual void OnClientLevelChange(void);
797
798 // DMFCBase::OnClientLevelStart (Only called if server tells client to execute)
799 //
800 // Event handler for when a multiplayer level is starting up. This will get called right before the level
801 // starts.
802 virtual void OnClientLevelStart(void);
803
804 // DMFCBase::OnClientLevelEnd (Only called if server tells client to execute)
805 //
806 // Event handler for when a multiplayer level is ending.
807 virtual void OnClientLevelEnd(void);
808
809 // DMFCBase::OnClientWallCollide
810 //
811 // Called by the game when their is a collision between an object and a wall
812 virtual void OnClientWallCollide(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt,
813 vector *wall_normal, float hit_dot);
814
815 // DMFCBase::OnClientObjectKilled
816 //
817 // Called when an object is being killed
818 // Not automatically sent to clients (OnClientObjectKilled)
819 // killer might not be valid (NULL)
820 virtual void OnClientObjectKilled(object *obj, object *killer);
821
822 // DMFCBase::OnClientObjectDestroyed
823 //
824 // Called when an object is about to be deleted
825 // Not automatically sent to clients
826 virtual void OnClientObjectDestroyed(object *obj);
827
828 // DMFCBase::OnPlayerEntersObserver
829 //
830 // Event handler when a player becomes an observer mode
831 // If they are piggybacking another player than piggy is the object pointer, else it's NULL
832 virtual void OnPlayerEntersObserver(int pnum, object *piggy);
833
834 // DMFCBase::OnPlayerExitsObserver
835 //
836 // Event handler when a player is leaving observer mode
837 virtual void OnPlayerExitsObserver(int pnum);
838
839 // DMFCBase::OnCanChangeTeam
840 //
841 // Called to determine if a player can change teams, you can override this so the server won't
842 // let a player change teams if it is not desired (for that player)
843 virtual bool OnCanChangeTeam(int pnum, int newteam);
844
845 // DMFCBase::OnSpecialPacket
846 //
847 // Event handler for when a special packet arrives and needs to be processed.
848 // Both the server and client can get this event, although it is more common for the
849 // client to recieve these.
850 virtual void OnSpecialPacket(void);
851
852 // DMFCBase::OnInterval
853 //
854 // Event handler that gets called once a frame
855 virtual void OnInterval(void);
856
857 // DMFCBase::OnHUDInterval
858 //
859 // Event handler that gets called once a frame when it's time to render the HUD images
860 virtual void OnHUDInterval(void);
861
862 // DMFCBase::OnPLRInterval
863 //
864 // Event handler that gets called once a frame when the Post Level Results screen is being display
865 virtual void OnPLRInterval(void);
866
867 // DMFCBase::OnPLRInit
868 //
869 // Event handler that gets called the first frame of the PLR screen for each level
870 virtual void OnPLRInit(void);
871
872 // DMFCBase::OnKeypress
873 //
874 // Event handler for when a user presses a key while in the game
875 // key = Key code of the key being pressed
876 virtual void OnKeypress(int key);
877
878 // DMFCBase::OnInputString
879 //
880 // Event handler for when the user types a message at the console (F8) that begins with a $
881 // input_string = string that was typed
882 virtual void OnInputString(char *input_string);
883
884 // DMFCBase::OnPlayerChangeTeam
885 //
886 // Called when a player changes team
887 // if announce is true than it is a change in the middle of the game, else it's an initial assignment change
888 virtual void OnPlayerChangeTeam(int player_num, int newteam, bool announce, bool spew_everything);
889
890 // DMFCBase::OnGameStateRequest
891 //
892 // Server only. Override this to listen for Game state requests from the clients
893 // When this function is called a client (who's player number is passed in) is requesting
894 // game state information. Do what you need to do to send game state information to that player
895 virtual void OnGameStateRequest(int pnum);
896
897 // DMFCBase::OnSaveStatsToFile
898 //
899 //
900 // The user is requesting the game stats to be saved to file, you must handle this completly on
901 // the game's side, nothing is done in DMFC
902 virtual void OnSaveStatsToFile(void);
903
904 // DMFCBase::OnPlayerReconnect
905 //
906 //
907 // This player is reconnecting to the game
908 virtual void OnPlayerReconnect(int player_num);
909
910 // DMFCBase::OnPlayerConnect
911 //
912 //
913 // This player is connecting to the game for the first time
914 virtual void OnPlayerConnect(int player_num);
915
916 // DMFCBase::OnControlMessage
917 //
918 //
919 // There is a control message sent from someone
920 virtual void OnControlMessage(uint8_t msg, int from_pnum);
921
922 // DMFCBase::OnAllowObserverChange
923 //
924 //
925 // returns true if the requested change for observer mode should go through
926 virtual bool OnAllowObserverChange(bool turnonobserver);
927
928 // DMFCBase::OnClientShowUI
929 //
930 //
931 // The game is saying it's ok to do any UI. Only handle the id's that belong to you and pass the rest
932 // to DMFCBase::OnClientShowUI().
933 virtual void OnClientShowUI(int id, void *user_data);
934
935 // DMFCBase::OnPrintScores
936 //
937 //
938 // The user is requesting that the scores be printed out (For Dedicated Server use). Use DPrintf
939 // level: -1 Requesting all the available scores
940 // n Print only the top n scores
941 // Override this to how you see fit, but it should conform to the above.
942 virtual void OnPrintScores(int level);
943
944 // DMFCBase::OnDisconnectSaveStatsToFile
945 //
946 //
947 // The game should save the stats because the player (only ourself as the client in the game),
948 // has disconnected.
949 virtual void OnDisconnectSaveStatsToFile(void);
950
951 // DMFCBase::OnLevelEndSaveStatsToFile
952 //
953 //
954 // The game should save the "End of Level" stats to file. You must handle this completly on
955 // the game's side, nothing is done in DMFC
956 virtual void OnLevelEndSaveStatsToFile(void);
957
958 // DMFCBase::OnGetHudCallSignColor
959 //
960 // This is an event sent in by the game requesting what color it should draw the HUD callsign
961 // of the passed in playernum. Using GR_RGB return the color from the function. This function
962 // gets called every frame that the player is on the clients HUD.
963 virtual ddgr_color OnGetHudCallSignColor(int playernum);
964
965 // DMFCBase::TranslateEvent
966 //
967 // Translates the event passed in to handle, calls the appropriate handler function. If a function isn't
968 // created to handle the event, then it calls the default handler. Handler functions should call the default
969 // handler unless it absolutly shouldn't
970 virtual void TranslateEvent(int eventnum, dllinfo *data);
971
972 // DMFCBase::OnTeamChangeName
973 //
974 // This event occurs on the client when a team's name has just changed
975 virtual void OnTeamChangeName(int team, char *oldname, char *newname);
976
977 // DMFCBase::OnDoControls
978 //
979 // This event occurs when there is a new back of game controls data
980 virtual void OnDoControls(game_controls *controls);
981
982 // DMFCBase::OnPlayAudioTaunt
983 //
984 // This event occurs when a player plays an audio taunt
985 virtual void OnPlayAudioTaunt(int pnum);
986
987 // DMFCBase::OnGetTokenString
988 //
989 // This event occurs when a text macro is being used that has tokens
990 // in it, if you have a specific token, override this event to handle it.
991 virtual void OnGetTokenString(char *src, char *dest, int dest_size);
992
993 void DrawMenu(void);
994
995 void DisplayPlayerInfo(int background_bmp = -1, bool dedicated_server = false);
996
997 // DMFCBase::SwitchPlayerInfoDisplay
998 //
999 // Switches on/off displaying a Playerinfo
1000 void SwitchPlayerInfoDisplay(int pnum);
1001
1002 // DMFCBase::DisplayingPlayerInfo
1003 //
1004 // Returns the pnum of who you are currently displaying, -1 if noone
1005 int DisplayingPlayerInfo(void);
1006
1007 // DMFCBase::GetTeamFromString
1008 //
1009 // Returns the int value of a team based on a string, -1 if not a team
1010 int GetTeamFromString(char *str);
1011
1012 // DMFCBase::GetPlayerNum
1013 //
1014 // Returns your playernum, useful when finding out if an event is referring to you (by looking at
1015 // the playernum passed to the event handler, compared to your playernum
1016 int GetPlayerNum(void);
1017
1018 // DMFCBase::GetLocalRole
1019 //
1020 // Returns your role in the multiplayer game. The result returned will be either LR_SERVER or LR_CLIENT
1021 int GetLocalRole(void);
1022
1023 // DMFCBase::CheckPlayerNum
1024 //
1025 // Returns true if the player number passed in is a valid player number (the player is connected)
1026 bool CheckPlayerNum(int player_num);
1027
1028 // DMFCBase::PacketCheckPlayerNum
1029 //
1030 // Returns true if it's ok to send a packet to this player
1031 bool PacketCheckPlayerNum(int player_num);
1032
1033 // DMFCBase::CallClientEvent
1034 //
1035 // Server Only. This will send an event to a client for it to execute.
1036 // event = An EVT_CLIENT_*
1037 // me_objnum,it_objnum = Object numbers of the objects to be me and it for the event
1038 // destination = Player number of the client to send to, or -1 if to send to all
1039 void CallClientEvent(int event, int me_objnum, int it_objnum, int destination, bool parms = false);
1040
1041 // DMFCBase::GetTimeLeft
1042 //
1043 // Server Only. This will fill in the float pointer passed to it with how much time is
1044 // left in the multiplayer game. The value placed in the float is only valid if GetTimeLeft
1045 // returns true. If it returns false it was because either it is not a game with a time limit
1046 // or it is being called on a client.
1047 bool GetTimeLeft(float *time);
1048
1049 // DMFCBase::EndLevel
1050 //
1051 // Server Only. This will end the current multiplayer level, and will go on to the next level.
1052 void EndLevel(void);
1053
1054 // DMFCBase::WarpToLevel
1055 //
1056 // Warps to another level in the mission. Pass a level number (1 to Current_mission.num_levels)
1057 // It will end the level and go to that level.
1058 void WarpToLevel(int lev);
1059
1060 // DMFCBase::GetScoreLimit
1061 //
1062 // Server Only. This will fill in the int pointer passed to it with what the scoring limit
1063 // is, set in in the multiplayer options. The value point into the int is only valid if
1064 // GetScoreLimit returns true. If it returns false it is because you are either not the
1065 // server or this option wasn't set in the multiplayer options
1066 bool GetScoreLimit(int *limit);
1067
1068 // DMFCBase::AutoTimeLimit
1069 //
1070 // Server Only. This turns off or on the automatic level ending by DMFC of a timed multiplayer game.
1071 // If you turn it off, it is your responsibility to end a time multiplayer game when it's time
1072 // is up. If it is turned on, DMFC will automatically handle ending the game. By default it is on.
1073 void AutoTimeLimit(bool turnon);
1074
1075 // DMFCBase::AutoDeathMessage
1076 //
1077 // This turns on or off DMFC's automatic handling of death messages. If it is turned on (Default)
1078 // then when a player dies it will display a random death message from the list added by you using
1079 // AddDeathMessage. If it is turned off, then it is your responsibility to handle the messages, you
1080 // can use DoRandomDeathMessage to display one when appropriate.
1081 void AutoDeathMessage(bool turnon);
1082
1083 // DMFCBase::AddDeathMessage
1084 //
1085 // This will add a death message to DMFC.
1086 // format = string in a "printf" type format (using %s for player callsigns) of the message
1087 // victim_first = Set this to true if the victim is listed first in the format
1088 void AddDeathMessage(const char *string, bool victim_first = true);
1089
1090 // DMFCBase::AddSuicideMessage
1091 //
1092 // This will add a death message to DMFC.
1093 // format = string in a "printf" type format (using %s for player callsigns) of the message
1094 void AddSuicideMessage(const char *string);
1095
1096 // DMFCBase::DoRandomDeathMessage
1097 //
1098 // DMFC will display a death message (or suicide message if killer and victim are the same) when
1099 // this function is called, based on the strings added with AddDeathMessage or AddSuicideMessage.
1100 // killernum = object number of the killer
1101 // victimnum = object number of the victim
1102 // hash = hash index of the weapon killer, -1 if none
1103 void DoRandomDeathMessage(int killernum, int victimnum, uint32_t hash = -1);
1104
1105 // DMFCBase::GetItObjNum
1106 //
1107 // Returns the it object number of the current event for use.
1108 int GetItObjNum(void);
1109
1110 // DMFCBase::GetMeObjNum
1111 //
1112 // Returns the me object number of the current event for use.
1113 int GetMeObjNum(void);
1114
1115 // DMFCBase::RegisterPacketReceiver
1116 //
1117 // Sets up a handler for a Special Packet ID. When a special packet is recieved it's ID is compared
1118 // to the ID's given to this function. If any match than it calls the handler given to process
1119 // the packet.
1120 // id = ID of the packet
1121 // func = Function handler to handle the packet. Must be declared like void MyFunction(uint8_t *data);
1122 void RegisterPacketReceiver(uint8_t id, void (*func)(uint8_t *));
1123 void RegisterPacketReceiver(uint8_t id, void (DMFCBase::*func)(uint8_t *));
1124
1125 // DMFCBase::StartPacket
1126 //
1127 // Initializes a packet so it is ready to be sent out.
1128 // data = pointer to buffer of data for packet. This buffer should be MAX_GAME_DATA_SIZE in size, even
1129 // if you don't plan on using all that data, there is header information that is added
1130 // in this function.
1131 // id = ID of the Special packet. When the packet is recieved by whomever, this is the ID that determines which
1132 // handler to
1133 // call.
1134 // count = pointer to your packet index pointer
1135 void StartPacket(uint8_t *data, uint8_t id, int *count);
1136
1137 // DMFCBase::SendPacket
1138 //
1139 // Ships a Special Packet away to the destination. This call must be preceeded by a StartPacket call
1140 // data = buffer of data to be sent out (same buffer that was passed to StartPacket
1141 // size = size (in bytes) of the packet
1142 // destination = either a player number, SP_ALL for all the players or SP_SERVER to send to the server (if you are a
1143 // client)
1144 void SendPacket(uint8_t *data, int size, int destination);
1145
1146 // DMFCBase::GetTeamForNewPlayer
1147 //
1148 // A Helper function (Server only), which will give you the optimum team assignment (whoever has the
1149 // lowest amount of players on their team, for a new player.
1150 // player_num = player number of the new player
1151 // num_teams = The number of teams in your game
1152 int GetTeamForNewPlayer(int player_num, int num_teams);
1153
1154 // DMFCBase::SetNumberOfTeams
1155 //
1156 // Sets the number of teams to be used in the game. By default there is 1 team (everyone against everyone).
1157 // You can set up to a maximum of 4 teams. Call this function as soon as possible.
1158 // teams = number of teams
1159 void SetNumberOfTeams(int teams);
1160
1161 // DMFCBase::AutoTeamSelect
1162 //
1163 // Turns on or off DMFC's auto team assignment. If it is on, then when a new player joins, they will
1164 // be placed on the team with fewest players. If it is off, then you must handle that. Defualt on.
1165 void AutoTeamSelect(bool turnon);
1166
1167 // DMFCBase::SendTeamAssignment
1168 //
1169 // A DMFC Special Packet function, this sends a team assignment packet to all the players. Server only.
1170 // playernum = player to change teams
1171 // team = new team
1172 void SendTeamAssignment(int playernum, int team, bool spew_on_respawn);
1173
1174 // DMFCBase::GetTeamAssignmentPacket
1175 //
1176 // Reciever for the team assignment packet.
1177 void GetTeamAssignmentPacket(uint8_t *data);
1178
1179 // DMFCBase::GetChangeTeamPacket
1180 //
1181 // Reciever for the change team packet.(Server Only)
1182 void GetChangeTeamPacket(uint8_t *data);
1183
1184 // DMFCBase::GetGameStateRequest
1185 //
1186 // Receiver for the server from a client asking for the state of the game
1187 void GetGameStateRequest(uint8_t *data);
1188
1189 // DMFCBase::SendChangeTeamRequest
1190 //
1191 // Sends a request to the server to change teams (Client Only)
1192 // spew_onchange should be true if you want the client the spew his inventory on the change
1193 void SendChangeTeamRequest(int newteam, bool spew_onchange);
1194
1195 // DMFCBase::GetDMFCGameInfo
1196 //
1197 // Receives information about the DMFC game
1198 void GetDMFCGameInfo(uint8_t *data);
1199
1200 // DMFCBase::SendDMFCGameInfo
1201 //
1202 // Sends information about the DMFC game
1203 void SendDMFCGameInfo(int player);
1204
1205 // DMFCBase::GetRemoteKey
1206 //
1207 // Handles a new remote key from the server
1208 void GetRemoteKey(uint8_t *data);
1209
1210 // DMFCBase::SendRemoteKey
1211 //
1212 // Sends out the players remote admin key
1213 void SendRemoteKey(int pnum);
1214
1215 // DMFCBase::ChangeTeams
1216 //
1217 // If you are the server it will make the player change teams. If you
1218 // are a client then it sends a request to the server to change teams
1219 // spew_on_repsawn is true if the player should spew his inventory before he respawns
1220 void RequestTeamChange(int team, int pnum, bool spew_on_respawn);
1221
1222 // DMFCBase::RequestGameState
1223 //
1224 // Sends a request to the server for the game state
1225 void RequestGameState(void);
1226
1227 // DMFCBase::AddHudItemCallback
1228 //
1229 // Adds an item to the hud. Everytime the hud needs to be updated, it will call the
1230 // handler passed in. The handler must be declared as:
1231 // void func(struct tHudItem *item);
1232 // type = HI_BITMAP for bitmap, HI_TEXT for a text item
1233 // func = function callback
1234 void AddHUDItemCallback(int type, void (*func)(struct tHUDItem *));
1235
1236 // DMFCBase::GetMyTeam
1237 //
1238 // Returns the int value of the team you are on...only useful in a team game.
1239 int GetMyTeam(void);
1240
1241 // DMFCBase::GetTeamString
1242 //
1243 // Returns a pointer to a string name of a team
1244 // team = integer value of the team
1245 const char *GetTeamString(int team);
1246
1247 // DMFCBase::GetTeamColor
1248 //
1249 // Returns the color components of a team
1250 // team = integer value of the team
1251 ddgr_color GetTeamColor(int team);
1252
1253 // DMFCBase::GetNumTeams
1254 //
1255 // Returns the number of teams in the game
1256 int GetNumTeams(void);
1257
1258 // DMFCBase::AllowTeamChange
1259 //
1260 // Returns true if team changing is allowed
1261 bool AllowTeamChange(void);
1262
1263 // DMFCBase::SwitchAllowTeamChange
1264 //
1265 // Turns on/off allowing of team changing
1266 void SwitchAllowTeamChange(bool turnon);
1267
1268 // DMFCBase::GetSortedPlayerSlots
1269 //
1270 // Fills in the passed array (of size maxsize) with the playernums sorted by (kills-suicides)
1271 void GetSortedPlayerSlots(int *sortedindex, int maxsize);
1272
1273 // DMFCBase::GetSortedPlayerSlotsByEfficiency
1274 //
1275 // Fills in the passed array (of size maxsize) with the playernums sorted by kills/(kills+deaths+suicides)
1276 void GetSortedPlayerSlotsByEfficiency(int *sortedindex, int maxsize);
1277
1278 // DMFCBase::IsMenuUp
1279 //
1280 // Returns true if the on screen menu is being shown
1281 bool IsMenuUp(void);
1282
1283 // DMFCBase::ConvertHUDAlpha
1284 //
1285 // Returns a converted alpha based on what you give, it will be a more transparent if the onscreen menu is up
1286 float ConvertHUDAlpha(float normal);
1287 uint8_t ConvertHUDAlpha(uint8_t normal);
1288
1289 // DMFCBase::ClipString
1290 //
1291 // Given a width, the string will be clipped to that width. If you pass true for arrow, then an arrow will be
1292 // appended if the string has been clipped. Based off current font
1293 void ClipString(int width, char *string, bool arrow);
1294
1295 // DMFCBase::DisplayOutrageLogo(void)
1296 //
1297 // Displays the Outrage Logo for 5 seconds (call repeatedly, after 5 seconds it will just short circuit)
1298 // Does nothing for non-Outrage releases
1299 void DisplayOutrageLogo(void);
1300
1301 // DMFCBase::InitTimers
1302 //
1303 // Inializes the timers
1304 void InitTimers(void);
1305
1306 // DMFCBase::KillAllTimers
1307 //
1308 // Kills all running timers
1309 void KillAllTimers(void);
1310
1311 // DMFCBase::SetTimerInterval
1312 //
1313 // Starts a timer event running
1314 int SetTimerInterval(void (*func)(void), float intval, float longevity, void (*onkill)(void) = NULL);
1315
1316 // DMFCBase::KillTimer
1317 //
1318 // Kills a timer
1319 void KillTimer(int handle);
1320
1321 // DMFCBase::ProcessTimers
1322 //
1323 // Goes through all the timers and updates them if they need to be updated
1324 void ProcessTimers(void);
1325
1326 // DMFCBase::SwitchShowHudCallsignLevel
1327 //
1328 //
1329 // Sets the level for displaying of Player's Callsigns on the HUD
1330 void SwitchShowHudCallsignLevel(uint8_t level, bool announce = true);
1331
1332 // DMFCBase::SwitchServerHudCallsignLevel
1333 //
1334 //
1335 // Sets the max level of HUD callsign displayage...determined by the server
1336 void SwitchServerHudCallsignLevel(uint8_t level);
1337
1338 // DMFCBase::GetCounterMeasureOwner
1339 //
1340 //
1341 // Given a counter measure it will determine the pnum of it's owner...if it can't find it, it returns -1
1342 int GetCounterMeasureOwner(object *robot);
1343
1344 // DMFCBase::CFGOpen
1345 //
1346 // Opens the registry/cfg information for the DMFC game, see error codes for return values
1347 int CFGOpen(char *filename);
1348
1349 // DMFCBase::CFGClose
1350 //
1351 // Closes the registry information for the game.
1352 void CFGClose(void);
1353
1354 // DMFCBase::CFGFlush
1355 //
1356 // Flushes out the registry information to fall
1357 int CFGFlush(void);
1358
1359 // DMFCBase::CFGCreateKey
1360 //
1361 // Creates a key in the registry
1362 int CFGCreateKey(char *name);
1363
1364 // DMFCBase::CFGLookupKey
1365 //
1366 // Sets the active key in the registry
1367 int CFGLookupKey(char *name);
1368
1369 // DMFCBase::CFGLookupRecord
1370 //
1371 // Looks up a record in the active key
1372 int CFGLookupRecord(char *record, void *data);
1373
1374 // DMFCBase::CFGCreateRecord
1375 //
1376 // Create/overwrites a record in the active key. Type is either REGT_DWORD or REGT_STRING
1377 int CFGCreateRecord(char *name, char type, void *data);
1378
1379 // DMFCBase::DecryptData
1380 //
1381 // Decrypts a buffer of data
1382 void DecryptData(uint8_t *data, int size);
1383
1384 // DMFCBase::EncryptData
1385 //
1386 // Encrypts (weak) a buffer of data
1387 void EncryptData(uint8_t *data, int size);
1388
1389 // DMFCBase::VersionCheck
1390 //
1391 // Makes sure Client has same DMFC version
1392 void VersionCheck(int pnum);
1393
1394 // DMFCBase::FindPInfo
1395 //
1396 // Given a player number it will search the list and find that player, returning the pointer, or NULL if it
1397 // can't be found or created
1398 PInfo *FindPInfo(int pnum);
1399
1400 // DMFCBase::UpdatePInfo
1401 //
1402 //
1403 // Updates a victim's pinfo stat
1404 void UpdatePInfo(int victim, int killer, int amount);
1405
1406 // DMFCBase::ResetPInfo
1407 //
1408 //
1409 // Resets all the PInfo stats (and frees memory)
1410 void ResetPInfo(void);
1411
1412 // DMFCBase::WriteDMFCStatsToFile
1413 //
1414 //
1415 // This function will write out DMFC's stats to the file given (it must be opened for writing)
1416 void WriteDMFCStatsToFile(CFILE *file);
1417
1418 // DMFCBase::SetWeaponDeathMessage
1419 //
1420 // Sets a death message for a weapon kill (you only need to pass in one version of the weapon if it
1421 // consists of multiple weapons...make sure AddWeaponHash has been called before this for this weapon)
1422 bool SetWeaponDeathMessage(const char *weapon_name, const char *message, bool victim_first);
1423
1424 // DMFCBase::GetWeaponDeathMessage
1425 //
1426 // Returns the format string for a weapon death message, NULL if it doesn't exist
1427 char *GetWeaponDeathMessage(int index, bool *victim_first);
1428
1429 // DMFCBase::AddWeaponHash
1430 //
1431 // Since one weapon may actually consist of many weapons, in order to save space you can create
1432 // one weapon where all those other weapon id's will be mapped to it...use WeaponHash[id] to
1433 // get the actual weapon. End list of children with a NULL
1434 void AddWeaponHash(const char *parent, ...);
1435
1436 // DMFCBase::AddWeaponHashArray
1437 //
1438 // Since one weapon may actually consist of many weapons, in order to save space you can create
1439 // one weapon where all those other weapon id's will be mapped to it...use WeaponHash[id] to
1440 // get the actual weapon.
1441 void AddWeaponHashArray(const char *parent, int count, char **array);
1442
1443 // DMFCBase::SetupPlayerRecord
1444 //
1445 // Sets up memory for multiplayer mod user defined data in the Player Records. Pass in the size (in bytes)
1446 // of 1 struct (each player will get one). Use GetPlayerRecordData to retrieve a pointer to the data.
1447 //
1448 // pack_callback : callback function called when data from the struct needs to be packed
1449 // into a packet. It is SUPER important that this function packs the data
1450 // in little endian format. This function gets a pointer to the struct that
1451 // needs to be packed (user_info), and a buffer in which to pack it to. This
1452 // function is to return the number of bytes it has packed.
1453 // unpack_callback : callback function called when data from the struct needs to be unpacket
1454 // from a packet. This data will be in little endian format. Returns the number of
1455 // bytes unpacked.
1456 // returns: 1 if size given was <=0 (if so all previous user stats will be removed)
1457 // 0 all went ok
1458 // -1 out of memory (all user stats memory will be freed)
1459 int SetupPlayerRecord(int sizeof_individual_data, int (*pack_callback)(void *user_info, uint8_t *data),
1460 int (*unpack_callback)(void *user_info, uint8_t *data));
1461
1462 // DMFCBase::GetPlayerRecordData
1463 //
1464 // Returns a pointer to the memory set aside for a particular player (NULL on error)
1465 void *GetPlayerRecordData(int pnum);
1466
1467 // DMFCBase::GetPlayerRecord
1468 //
1469 // Returns a pointer to the player record at the given slot (passed in slot must be in the range
1470 // 0<=slot<MAX_PLAYER_RECORDS)
1471 player_record *GetPlayerRecord(int slot);
1472
1473 // DMFCBase::GetPlayerRecordByPnum
1474 //
1475 // Same as above, but you can specify by a player's pnum, return NULL on error
1476 player_record *GetPlayerRecordByPnum(int pnum);
1477
1478 // DMFCBase::SendRequestForPlayerRecords
1479 //
1480 //
1481 // Sends a request to the server to send the player records
1482 void SendRequestForPlayerRecords(void);
1483
1484 // DMFCBase::ReceiveRequestForPlayerRecords
1485 //
1486 //
1487 // Recieves and processes a request for a player record
1488 void ReceiveRequestForPlayerRecords(uint8_t *data);
1489
1490 // DMFCBase::IsPlayerBanned
1491 //
1492 // returns true is the given pnum is banned from the game
1493 bool IsPlayerBanned(int pnum);
1494
1495 // DMFCBase::IsAddressBanned
1496 //
1497 // returns true if the given address is banned from the game
1498 bool IsAddressBanned(network_address *addr, const char *tracker_id);
1499
1500 // DMFCBase::RemoveAllBans
1501 //
1502 // Removes all the temp bans
1503 void RemoveAllBans(void);
1504
1505 // DMFCBase::RemoveBan
1506 //
1507 // Removes a temp ban on given the ban #...returns true on success
1508 bool RemoveBan(int index);
1509
1510 // DMCBase::GetBannedPlayerCallsign
1511 //
1512 // Returns the callsign of the banned player at position index, NULL on error
1513 char *GetBannedPlayerCallsign(int index);
1514
1515 // DMFCBase::GetNumBannedPlayers
1516 //
1517 // Returns the number of players banned from the server
1518 int GetNumBannedPlayers(void);
1519
1520 // DMFCBase::BanPlayerFromGame
1521 //
1522 // Puts a temp ban on a player which will only last the duration of the game
1523 void BanPlayerFromGame(int pnum);
1524
1525 // DMFCBase::IsPlayerAlive
1526 //
1527 // Returns true is the given pnum is a player, flying around the level (not dying,
1528 // dead or observing)
1529 bool IsPlayerAlive(int pnum);
1530
1531 // DMFCBase::SendControlMessageToPlayer
1532 //
1533 //
1534 // Sends a [1 byte] control message to a player
1535 void SendControlMessageToPlayer(int pnum, uint8_t msg);
1536
1537 // DMFCBase::ReceiveControlMessage
1538 //
1539 //
1540 // Handles a control message
1541 void ReceiveControlMessage(uint8_t *data);
1542
1543 // DMFCBase::SendRealGametime
1544 //
1545 // Updates a player about the 'real' game time
1546 void SendRealGametime(int pnum);
1547
1548 // DMFCBase::GetRealGametime
1549 //
1550 // handles a packet about updating the real game time
1551 void GetRealGametimePacket(uint8_t *data);
1552
1553 // DMFCBase::FindPInfoStatFirst
1554 //
1555 // Fills in a tPInfoStat that contains information about a given player record slot. Returns true on success, false
1556 // if there is no information available for the given slot. Call this first, then follow with repeated calls to
1557 // FindPInfoStatNext until you get a false value returned...call FindPInfoStatClose when done.
1558 bool FindPInfoStatFirst(int slot, tPInfoStat *stat);
1559
1560 // DMFCBase::FindPInfoStatNext
1561 //
1562 // Call this repeatedly until you get a value of false, finish by calling FindPInfoStatClose
1563 bool FindPInfoStatNext(tPInfoStat *stat);
1564
1565 // DMFCBase::FindPInfoStatClose
1566 //
1567 // Closes up a FindPInfo series of calls
1568 void FindPInfoStatClose(void);
1569
1570 // DMFCBase::DoDamageToPlayer
1571 //
1572 // Server only...applies damage to player
1573 void DoDamageToPlayer(int pnum, int type, float amount, bool playsound = true);
1574
1575 // DMFCBase::StartUIWindow
1576 //
1577 // Prepares the game so that you can display UI stuff, give a unique id in which will be passed
1578 // to the OnClientShowUI(). In your OnClientShowUI() you must ONLY handle id's which belong to you
1579 // and pass the others to DMFCBase::OnClientShowUI().
1580 void StartUIWindow(int id, void *user_data);
1581
1582 // DMFCBase::DisconnectMe
1583 //
1584 // Disconnects yourself from the game. It should be called when you are kicked or banned to make the
1585 // whole process a bit nicer/cleaner. Even if it doesn't get called when kicked, you will still
1586 // eventually disconnect.
1587 void DisconnectMe(void);
1588
1589 /* Input Command Functions */
1590 // DMFCBase::AddInputCommand
1591 //
1592 // When the client (or dedicated server) types a message that begins with a $, DMFC will look through
1593 // all the values you passed to AddInputCommand() and see if any match. If so it passes the entire
1594 // command string to the given function handler. Returns 1 on success, -1 if out of memory, 0 if it already
1595 // exists. These commands are not case sensitive.
1596 // Ex. AddInputCommand("team"); //this handles all the '$team' passed in
1597 // allow_remotely : if set true, this input command can be called remotely via remote administration
1598 int8_t AddInputCommand(const char *command, const char *description, void (*handler)(const char *), bool allow_remotely = false);
1599
1600 // DMFCBase::CanInputCommandBeUsedRemotely
1601 //
1602 // Returns 1 if the input command can be called remotely
1603 // Returns -1 if the input command is not found
1604 // Returns 0 if the input command can be called remotely
1605 int CanInputCommandBeUsedRemotely(char *command);
1606
1607 // Does a check on on the pinfo info making sure it is valid
1608 void CheckPInfo();
1609
1610 // DMFCBase::EnableStatisticalMessages
1611 //
1612 // Turns on or off the statistical HUD messages that appear due to a player death
1613 void EnableStatisticalMessages(bool on);
1614
1615 // DMFCBase::EnableOnScreenMenu
1616 //
1617 // Turns on/off the onscreen menu
1618 void EnableOnScreenMenu(bool turn_on);
1619
1620 // DMFCBase::EnableAutoSaveLevelEnd
1621 //
1622 // Disables/Enables the autosaving of game stats to file on level end
1623 void EnableAutoSaveLevelEnd(bool enable);
1624
1625 // DMFCBase::EnableAutoSaveDisconnect
1626 //
1627 // Disables/Enables the autosaving of game stats to file on disconnect from the game
1628 void EnableAutoSaveDisconnect(bool enable);
1629
1630 // DMFCBase::GenerateStatFilename
1631 //
1632 // Given the following information it will return a full path to what
1633 // the recommended filename to save stats to should be.
1634 // root = Multiplayer DLL Name (filename will start with this)
1635 // end_of_level = pass true if this is the end of a level stats
1636 void GenerateStatFilename(char *filename, const char *root, bool end_of_level);
1637
1638 // DMFCBase::IsPlayerObserver
1639 //
1640 // Returns true if the given pnum is currently an observer in the game, else returns false.
1641 // If an invalid pnum is given, then it returns false
1642 bool IsPlayerObserver(int pnum);
1643
1644 // DMFCBase::EnableOnScreenMenuBackground
1645 //
1646 // Enables/disables the onscreen menu background
1647 void EnableOnScreenMenuBackground(bool enable);
1648
1649 // DMFCBase::GetTimeInGame
1650 //
1651 // Returns the totaltime the player has been in the game at the moment you call
1652 // this function. Pass in the player record slot.
1653 float GetTimeInGame(int slot);
1654
1655 // DMFCBase::GetTimeString
1656 //
1657 // Returns a string that contains a formated time (i.e. 32 seconds, 1:15 minutes, 3:21:23 hours)
1658 char *GetTimeString(float sec);
1659
1660 // DMFCBase::DisplayNetGameInfo
1661 //
1662 // Displays information about the Netgame that is currently being played
1663 // on to the screen.
1664 void DisplayNetGameInfo(int background_bmp = -1, bool dedicated_server = false);
1665
1666 // DMFCBase::SwitchNetGameInfoDisplay
1667 //
1668 // Switches on/off displaying netgame info
1669 void SwitchNetGameInfoDisplay(int on);
1670
1671 // DMFCBase::IsDisplayingNetGameInfo
1672 //
1673 // returns true if we are currently displaying netgame info
1674 bool IsDisplayingNetGameInfo(void);
1675
1676 // DatabaseRegister
1677 // Registers your multiplayer game with the database. This must be
1678 // called before any other database function, or they will fail until this
1679 // is called.
1680 void DatabaseRegister(char *name);
1681 // DatabaseRead
1682 // Reads a string from the database
1683 bool DatabaseRead(const char *label, char *entry, int *entrylen);
1684 // DatabaseRead
1685 // Reads wordsize bytes from the database
1686 bool DatabaseRead(const char *label, void *entry, int wordsize);
1687 // DatabaseRead
1688 // Reads a bool from the database
1689 bool DatabaseRead(const char *label, bool *entry);
1690 // DatabaseWrite
1691 // Writes/Updates a string to the database
1692 bool DatabaseWrite(const char *label, const char *entry, int entrylen);
1693 // DatabaseWrite
1694 // Writes/Updates a value to the database
1695 bool DatabaseWrite(const char *label, int entry);
1696 // DMFCBase::SendNetGameInfoSync
1697 //
1698 // Sends out a NetGame info sync packet to all the players
1699 void SendNetGameInfoSync(int to_who = SP_ALL);
1700 // DMFCBase::SetMaxPlayerHardLimit
1701 //
1702 // Sets a hard limit to the max number of players allowed in the game
1703 // changing the number of players can never go above this...defaults
1704 // to DLLMAX_PLAYERS
1705 void SetMaxPlayerHardLimit(int max);
1706
1707 // CompareNetworkAddress
1708 //
1709 // Compare's two network addresses, returns true if they are the same, false if not.
1710 // use_port: if this is true, than it will consider the port part of the network address
1711 bool CompareNetworkAddress(network_address *one, network_address *two, bool use_port = true);
1712
1713 // IsMasterTrackerGame
1714 //
1715 // returns true if this game is being played on the master tracker
1716 bool IsMasterTrackerGame(void);
1717
1718 // ConvertLocalToServerObjnum
1719 //
1720 // Given an objnum, it will convert the number from your local objnum to the server's objnum
1721 // It will return -1 on error
1722 int ConvertLocalToServerObjnum(int objnum);
1723
1724 // ConvertServerToLocalObjnum
1725 //
1726 // Given an objnum from the server, this function will convert the objnum to your local objnum
1727 // It will return -1 on error
1728 int ConvertServerToLocalObjnum(int objnum);
1729
1730 // DMFCBase::ShouldIDisplayHUDName
1731 //
1732 // Given a player num, it will determine if the callsign should be drawn on the HUD
1733 bool ShouldIDisplayHUDName(int pnum);
1734
1735 // DMFCBase::SetDeathMessageFilter
1736 //
1737 // Sets the death message filter
1738 void SetDeathMessageFilter(int level);
1739
1740 // DMFCBase::IAmDedicatedServer
1741 //
1742 // Returns true if we are a dedicated server
1743 bool IAmDedicatedServer(void);
1744
1745 // DMFCBase::IsPlayerDedicatedServer
1746 //
1747 // Returns true if the passed in pnum/playerrecord is a dedicated server
1748 bool IsPlayerDedicatedServer(int pnum);
1749 bool IsPlayerDedicatedServer(player_record *pr);
1750
1751 // Displays dedicated server help
1752 void DisplayInputCommandHelp(const char *s);
1753
1754 // DMFCBase::GetPlayerTeam
1755 //
1756 // Returns the team of the player...call this instead of accessing .team directly
1757 int GetPlayerTeam(int pnum);
1758
1759 // DMFCBase::GetConnectingPlayerTeam
1760 //
1761 // Returns the team of a player just connecting, this is to be set by the
1762 // game and is DMFC assumes that all players have the correct team on join
1763 int GetConnectingPlayerTeam(int slot);
1764
1765 // DMFCBase::SetTeamName
1766 //
1767 // Sets the team name for a given team
1768 // team: integer value of the team to change
1769 // name: new name for the team
1770 // announce: if this is true, and we are the server, it will tell all the clients about the change
1771 bool SetTeamName(int team, const char *name, bool announce);
1772
1773 // DMFCBase::ConvertHUDCoord
1774 //
1775 // Given an x,y based on a virtual 640x480 screen, this will convert it to the x,y that should be
1776 // used based on the current screen size
1777 void ConvertHUDCoord(int x, int y, int *rx, int *ry);
1778
1779 // DMFCBase::GetPlayerLogoBmp
1780 //
1781 // Given a player_num, it will return a bitmap handle to that player's ship logo, or
1782 // -1 if they don't have a logo for their ship.
1783 // if is_vclip comes back as true, than it is not a bitmap handle, but a handle
1784 // to a vclip (animated bitmap). It is an index into the DLLGameVClips[].
1785 int GetPlayerLogoBmp(int player_num, bool *is_vclip);
1786
1787 // DMFCBase::EnableShipLogos
1788 //
1789 // Disables or enables logo displaying for the client
1790 void EnableShipLogos(bool enable);
1791
1792 // DMFCBase::AreLogosEnabled
1793 //
1794 // returns true if ship logos are enabled
1795 bool AreLogosEnabled(void);
1796
1797 // DMFCBase::EnableAudioTaunts
1798 //
1799 // Disables or enables audio taunts
1800 void EnableAudioTaunts(bool enable);
1801
1802 // DMFCBase::AreTauntsEnabled(void)
1803 //
1804 // returns true if audio taunts are enabled
1805 bool AreTauntsEnabled(void);
1806
1807 // DMFCBase::EnableTimelimitCountdown
1808 //
1809 // Enables/Disables the timelimit countdown (if there is a level time limit)
1810 // Optionally you can specify what time to start the count down.
1811 void EnableTimelimitCountdown(bool enable, int seconds = 10);
1812
1813 // DMFCBase::RespawnPlayer
1814 //
1815 // Takes the given player and respawns his at a random start point (in a team game, team respawn
1816 // points are taken into consideration, so make sure the player is on the correct team before you
1817 // respawn him. spew_everything, if false, will override spew_energy_and_shields
1818 void RespawnPlayer(int pnum, bool spew_energy_and_shield, bool spew_everything);
1819
1820 // If you are going to create submenus you MUST use this function. along with:
1821 // void SetState(int state);
1822 // bool SetStateItemList(int count, ... ); for MIT_STATE items
1823 MenuItem *CreateMenuItem(const char *title, char type, uint8_t flags, void (*fp)(int), ...);
1824
1825 // DMFCBase::ReadInHostsAllowDeny
1826 //
1827 // Reads in the hosts.allow and hosts.deny files (if available)
1828 void ReadInHostsAllowDeny(void);
1829
1830 // DMFCBase::FreeHostsLists
1831 //
1832 // Frees all the memory allocated for the host allow/deny lists
1833 void FreeHostsLists(void);
1834
1835 // DMFCBase::RehashAllowDeny
1836 //
1837 // Flushes and reloads the hosts.allow/.deny lists
1838 void RehashAllowDeny(void);
1839
1840 // DMFCBase::AnnounceTeamChangeDeny
1841 //
1842 // Tells a player that team change request was denied
1843 void AnnounceTeamChangeDeny(int pnum);
1844
1845 // DMFCBase::EnableLossGuage
1846 //
1847 // Turns on/off the Loss guage on the screen
1848 void EnableLossGuage(bool enable);
1849
1850 // DMFCBase::WasPlayerInGameAtLevelEnd
1851 //
1852 // Given a player record it returns the pnum of the player at that slot
1853 // IF (and only if) the player was in the game at level end, else it
1854 // returns -1.
1855 int WasPlayerInGameAtLevelEnd(int prec);
1856
1857 // DMFCBase::SelectNextCameraView
1858 //
1859 // This function, given which window (corresponds to left, middle, right), switches the
1860 // current view of the small camera windows on the screen
1861 void SelectNextCameraView(int window);
1862
1863 // DMFCBase::ResetPlayersInGame
1864 //
1865 // Resets the Players-in-game list
1866 void ResetPlayersInGame(void);
1867
1868 // DMFCBase::MarkPlayersInGame
1869 //
1870 // Goes through all the player records and marks those that are in the game
1871 // This is needed because at level end, all clients disconnect, so we lose
1872 // that information.
1873 void MarkPlayersInGame(void);
1874
1875 // DMFCBase::InputCommandHandle
1876 //
1877 // Goes through the list of input commands and calls the associated handle (if it exists). Returns
1878 // true if it called a handler, else false.
1879 bool InputCommandHandle(char *command_string);
1880
1881 // DMFCBase::PauseRealGameTime
1882 //
1883 // Pauses/unpauses the realgame time
1884 void PauseRealGameTime(bool enable);
1885
1886 // DMFCBase::MakeClientsWait
1887 //
1888 // If passed true than all joining clients are forced to wait until they are given the signal to
1889 // join, either through SignalClientStart() or by passing false to MakeClientsWait
1890 void MakeClientsWait(bool wait);
1891
1892 // DMFCBase::SetDedicatedWait
1893 //
1894 // Sets the level wait time for the dedicated server. A dedicated server will make all
1895 // clients wait until this time (in seconds) is up each level.
1896 void SetDedicatedWait(float time_secs);
1897
1898 // DMFCBase::TranslateTextMacro
1899 //
1900 // Given a macro with tokens, this function will replace the tokens
1901 // and create a new string for display.
1902 // All tokens begin with $$ (i.e. $$TEAMBASE)
1903 void TranslateTextMacro(const char *src, char *destination, int dest_size);
1904
1905 dllinfo *GetDLLInfoCallData(void);
1906 int GetHighestRoomIndex(void);
1907 int GetGameWindowW(void);
1908 int GetGameWindowH(void);
1909 int GetGameWindowX(void);
1910 int GetGameWindowY(void);
1911 int *GetGameFontTranslateArray(void);
1912 int GetObserverModeBitmap(void);
1913 float GetFrametime(void);
1914 float GetGametime(void);
1915 float GetRealGametime(bool *ispaused = NULL);
1916 float *GetShieldDeltaArray(void);
1917 float GetHudAspectX(void);
1918 float GetHudAspectY(void);
1919 const char *GetLocalD3Dir(void);
1920 const tMission *GetCurrentMission(void);
1921 room *GetRooms(void);
1922 object *GetObjects(void);
1923 terrain_segment *GetTerrainSegs(void);
1924 netgame_info *GetNetgameInfo(void);
1925 player *GetPlayers(void);
1926 netplayer *GetNetPlayers(void);
1927 ship *GetShips(void);
1928 weapon *GetWeapons(void);
1929 texture *GetGameTextures(void);
1930 vclip *GetGameVClips(void);
1931 ddgr_color *GetPlayerColors(void);
1932 poly_model *GetGamePolyModels(void);
1933 game_controls GetLastGameControls(void);
1934 int *GetPilotPicBitmapHandles(void);
1935 void GetViewerObjectPtr(object **v_obj);
1936 void SetViewerObjectPtr(object *v_obj);
1937 float GetRenderZoom(void);
1938 IMenuItem *GetOnScreenMenu(void);
1939 tOSIRISModuleInit *GetOsirisModuleData(void);
1940 vis_effect *GetVisEffectArray(int **Highest_viseffect_index_ptr = NULL);
1941 level_info *GetLevelInfo(void);
1942 char *GetGameArg(int index);
1943 int GetCameraViewType(int window);
1944 object_info *GetObjectInfo(int objinfoid);
1945
1946 public:
1947 void Delete(void);
1948 void *Dynamic_Cast(const char *pszType);
1949 void DuplicatePointer(void);
1950 void DestroyPointer(void);
1951
1952 public:
1953 dllinfo *Data; // Current event's data
1954 int *Player_num; // Your player num
1955 int *Highest_room_index; // the highest room index (for room number validation)
1956 int *Game_window_w; // visible screen width
1957 int *Game_window_h; // visible screen height
1958 int *Game_window_x; // visible screen top-left x
1959 int *Game_window_y; // visible screen top-left y
1960 int *Game_fonts; // array of fonts
1961 int hBitmapObserver; // Bitmap handle for the 'in observer mode' icon
1962 float *Frametime; // how long it took the last frame to display
1963 float *Gametime; // how long the game has been running
1964 float *ShieldDelta; // array of player's...server update's their shields based on this array
1965 float *Hud_aspect_x, *Hud_aspect_y;
1966 char *LocalD3Dir; // Path to the root of the Descent3 installation directory
1967 tMission *Current_mission; // the current mission
1968 game_api API;
1969 room *Rooms; // rooms array
1970 object *Objects; // objects array
1971 terrain_segment *Terrain_seg; // Terrain segment array
1972 netgame_info *Netgame; // Netgame info
1973 player *Players; // Player's array
1974 netplayer *NetPlayers; // NetPlayer's array
1975 ship *Ships; // Ship's array
1976 weapon *Weapons; // Weapon's array
1977 texture *GameTextures; // Texture's array
1978 vclip *GameVClips; // VClip array
1979 ddgr_color *Player_colors;
1980 poly_model *Poly_models; // polymodel array
1981 game_controls Last_game_controls; // The last frame's set of control data
1982 int PilotPicBmpHandles[DLLMAX_PLAYERS];
1983 MenuItem Menu;
1984 object **Viewer_object; // object the player's view is from
1985 float *Render_zoom;
1986 vis_effect *VisEffects;
1987 int *Highest_vis_effect_index;
1988 int *Multi_next_level;
1989 level_info *Level_info;
1990 void *GameArgs;
1991 object_info *Object_info;
1992
1993 int Hard_max_players;
1994
1995 protected:
1996 void SetPlayerInfo(int pnum);
1997 void SendVersionToClient(int pnum);
1998 void GetDMFCVersionCheck(uint8_t *data);
1999 bool DMFC_compare_slots(int a, int b);
2000 bool DMFC_compare_slots_efficiency(int a, int b);
2001
2002 // DMFCBase::InputCommandFree
2003 //
2004 // Frees up all memory allocated for the input commands ($ messages)
2005 void InputCommandFree(void);
2006 // DMFCBase::InputCommandInit
2007 //
2008 // Initializes the variables and data for the input commands. Default DMFC commands are to
2009 // be placed in here.
2010 void InputCommandInit(void);
2011 // DMFCBase::GetStatisticalDeathMessage
2012 //
2013 // Generates a statistical death message about the deaths
2014 void GetStatisticalDeathMessage(int knum, int vnum);
2015 // DMFCBase::GetStatisticalSuicideMessage
2016 //
2017 // Generates a statistical suicide message about the suicide
2018 char *GetStatisticalSuicideMessage(int pnum);
2019
2020 // DMFCBase::DoDMFCUITeamPlacement
2021 //
2022 // Displays the dialog for doing team placement in DMFC
2023 void DoDMFCUITeamPlacement(bool make_clients_wait, bool called_by_level_start = true);
2024
2025 // DMFCBase::DoDMFCUIWaitForPlayers
2026 //
2027 // Displays the dialog for in the beginning of the level, waiting for all the players
2028 void DoDMFCUIWaitForPlayers(bool clients_wait);
2029
2030 // DMFCBase::SignalClientStart
2031 //
2032 // Given a player num, it tells the client that they can start moving and playing
2033 void SignalClientStart(int pnum);
2034
2035 // DMFCBase::WaitForServer
2036 //
2037 // Call this to start waiting, until the server tells us to stop (by passing false as a parm)
2038 void WaitForServer(bool wait);
2039
2040 // DMFCBase::WaitingForServerLoop
2041 //
2042 // Called per frame while waiting for the server to signal go
2043 void WaitingForServerLoop(void);
2044
2045 // DMFCBase::DisplayTimelimitCountdown
2046 //
2047 // Displays (if needed) the time limit countdown
2048 void DisplayTimelimitCountdown(void);
2049
2050 int m_iProtectedFlags;
2051 int m_iDeathMsgCount;
2052 int m_iSuicideMsgCount;
2053 int m_iNumTeams; // how many teams there are
2054 int m_iPlayerDisplayed; // the pnum of the player's info being displayed (if above is true)
2055 int MenuBackgroundBMP;
2056
2057 int *Game_interface_mode;
2058 tSPHandler *SPRoot; // Root node of the Special packet handler list
2059 tBanItem *m_BanList; // root node of ban addresses
2060 tInputCommandNode *m_InputCommandRootNode; // root node for input commands ($ messages)
2061
2062 MenuItem *TeamMenuItem;
2063 MenuItem *AutoBalanceItem;
2064 MenuItem *AllowTeamChangeItem;
2065 MenuItem *ObserverItem;
2066 MenuItem *HUDCallsignsItem;
2067 MenuItem *ServerHUDCallsignsItem;
2068 MenuItem *StatisticMessagesItem;
2069 MenuItem *SaveStatsLevelEndItem;
2070 MenuItem *SaveStatsDisconnectItem;
2071 MenuItem *MenuBackgroundItem;
2072 MenuItem *NetGameInfoItem;
2073 MenuItem *DeathMessageFilterItem;
2074 MenuItem *ShipLogosItem;
2075 MenuItem *AudioTauntsItem;
2076 MenuItem *HUDIndicatorItem;
2077
2078 tDMFCTimerInfo Timers[MAX_DMFC_TIMERS];
2079 tWeaponKillMsg WeaponMessages[MAX_WEAPONS];
2080 int WeaponHash[MAX_WEAPONS];
2081 tDeathMsg DeathMsgs[MAX_DEATH_MSGS];
2082 tDeathMsg SuicideMsgs[MAX_DEATH_MSGS];
2083 char DMFC_team_names[DLLMAX_TEAMS][MAX_TEAMNAME_LEN]; // strings that are the team names
2084 private:
2085 int m_cPtrs;
2086 bool m_bMakeClientsWait;
2087 bool m_bHasInitialized;
2088 bool m_bDisplayOutrageLogo;
2089 int *m_bTrackerGame;
2090 bool *Dedicated_server;
2091 uint8_t m_iServerHUDCallsignLevel;
2092 uint8_t m_iMyPreferredHUDCallsignLevel; // what the user selected for callsign level
2093 uint8_t m_iMyCurrentHUDCallsignLevel; // might be lower than preferred level if limited by server
2094 uint8_t m_iDeathMessageFilter;
2095 int m_iNumBanPlayers;
2096 int m_iUIWindowID;
2097 void *m_UIUserData;
2098 uint16_t *Local_object_list;
2099 uint16_t *Server_object_list;
2100 tHostsNode *m_DenyList;
2101 tHostsNode *m_AllowList;
2102 bool LossGuageEnabled;
2103 bool DMFCInit;
2104 bool DisplayTauntIndicator;
2105 bool m_bDisplayTimelimitCountdown;
2106 int TauntIndicatorPlayerNum;
2107 int TauntIndicatorBMP;
2108 float TauntIndicatorStartTime;
2109 float RealGametime;
2110 float DedicatedLevelWait;
2111 int m_iTimeLimitCountdown;
2112 int *Camera_view_mode;
2113
2114 char DatabaseRegisteredName[MAX_DBNAME_SIZE];
2115 int16_t players_in_game[MAX_PLAYER_RECORDS];
2116
2117 // DMFCBase::InitializeForLevel
2118 //
2119 //
2120 void InitializeForLevel(void);
2121
2122 // DMFCBase::LoadSettings
2123 //
2124 // Loads the settings of DMFC from the registry and initializes those variables
2125 void LoadSettings(void);
2126 // DMFCBase::SaveSettings
2127 //
2128 // Saves out the settings of DMFC to the registry
2129 void SaveSettings(void);
2130 // DMFCBase::ReceiveNetGameInfoSync
2131 //
2132 // Receives a NetGame info sync packet from the server
2133 void ReceiveNetGameInfoSync(uint8_t *data);
2134 // DMFCBase::SendNewTeamName
2135 //
2136 // Tells the clients about a team's new name
2137 void SendNewTeamName(int team);
2138 // DMFCBase::ReceiveNewTeamName
2139 //
2140 // The server is telling us about a new team name
2141 void ReceiveNewTeamName(uint8_t *data);
2142
2143 // DMFCBase::ParseStartupScript
2144 //
2145 //
2146 // Loads up the startup script and sets variables accordingly
2147 void ParseStartupScript(void);
2148
2149 // DMFCBase::LossGuageFrame
2150 //
2151 // Processes the Loss guage for the frame
2152 void LossGuageFrame(void);
2153
2154 // DMFCBase::SetPlayerTauntIndicator
2155 //
2156 // Sets up a taunt indicator for display
2157 void SetPlayerTauntIndicator(int pnum);
2158
2159 // DMFCBase::DisplayTauntIndicatorFrame
2160 //
2161 // Performs any needed actions to display taunt indicator
2162 void DisplayTauntIndicatorFrame(void);
2163
2164 //---------------------------------------------------------------------------------
2165 //---------------------------------------------------------------------------------
2166 //---------------------------------------------------------------------------------
2167 //------------------ VIRTUAL EVENT HANDLER FUNCTIONS ----------------------------
2168 //---------------------------------------------------------------------------------
2169 //---------------------------------------------------------------------------------
2170 //---------------------------------------------------------------------------------
2171 public:
2172 void Set_OnServerPlayerKilled(void (*callback)(object *killer_obj, int victim_pnum));
2173 void Set_OnServerPlayerExploded(void (*callback)(int player_num));
2174 void Set_OnServerCollide(void (*callback)(object *me_obj, object *it_obj));
2175 void Set_OnServerCollide(void (*callback)(object *me_obj, object *it_obj, vector *point, vector *normal));
2176 void Set_OnServerPlayerChangeSegment(void (*callback)(int player_num, int newseg, int oldseg));
2177 void Set_OnServerObjectChangeSegment(void (*callback)(object *obj, int newseg, int oldseg));
2178 void Set_OnServerPlayerEntersGame(void (*callback)(int player_num));
2179 void Set_OnServerPlayerDisconnect(void (*callback)(int player_num));
2180 void Set_OnServerGameCreated(void (*callback)(void));
2181 void Set_OnServerLevelChange(void (*callback)(void));
2182 void Set_OnServerLevelStart(void (*callback)(void));
2183 void Set_OnServerLevelEnd(void (*callback)(void));
2184 void Set_OnServerObjectShieldsChanged(void (*callback)(object *obj, float amount));
2185 void Set_OnServerIsAddressBanned(bool (*callback)(network_address *addr, const char *tracker_id));
2186 void Set_OnServerWallCollide(void (*callback)(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt,
2187 vector *wall_normal, float hit_dot));
2188 void Set_OnServerObjectKilled(void (*callback)(object *obj, object *killer));
2189 void Set_OnServerObjectDestroyed(void (*callback)(object *obj));
2190 void Set_OnClientPlayerKilled(void (*callback)(object *killer_obj, int victim_pnum));
2191 void Set_OnClientPlayerExploded(void (*callback)(int player_num));
2192 void Set_OnClientCollide(void (*callback)(object *me_obj, object *it_obj));
2193 void Set_OnClientCollide(void (*callback)(object *me_obj, object *it_obj, vector *point, vector *normal));
2194 void Set_OnClientPlayerChangeSegment(void (*callback)(int player_num, int newseg, int oldseg));
2195 void Set_OnClientObjectChangeSegment(void (*callback)(object *obj, int newseg, int oldseg));
2196 void Set_OnClientPlayerEntersGame(void (*callback)(int player_num));
2197 void Set_OnClientPlayerDisconnect(void (*callback)(int player_num));
2198 void Set_OnMeDisconnectFromServer(void (*callback)(void));
2199 void Set_OnClientGameCreated(void (*callback)(void));
2200 void Set_OnClientObjectShieldsChanged(void (*callback)(object *obj, float amount));
2201 void Set_OnWeaponFired(void (*callback)(object *weapon_obj, object *shooter));
2202 void Set_OnClientLevelChange(void (*callback)(void));
2203 void Set_OnClientLevelStart(void (*callback)(void));
2204 void Set_OnClientLevelEnd(void (*callback)(void));
2205 void Set_OnClientWallCollide(void (*callback)(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt,
2206 vector *wall_normal, float hit_dot));
2207 void Set_OnClientObjectKilled(void (*callback)(object *obj, object *killer));
2208 void Set_OnClientObjectDestroyed(void (*callback)(object *obj));
2209 void Set_OnPlayerEntersObserver(void (*callback)(int pnum, object *piggy));
2210 void Set_OnPlayerExitsObserver(void (*callback)(int pnum));
2211 void Set_OnCanChangeTeam(bool (*callback)(int pnum, int newteam));
2212 void Set_OnSpecialPacket(void (*callback)(void));
2213 void Set_OnInterval(void (*callback)(void));
2214 void Set_OnHUDInterval(void (*callback)(void));
2215 void Set_OnPLRInterval(void (*callback)(void));
2216 void Set_OnPLRInit(void (*callback)(void));
2217 void Set_OnKeypress(void (*callback)(int key));
2218 void Set_OnInputString(void (*callback)(char *input_string));
2219 void Set_OnPlayerChangeTeam(void (*callback)(int player_num, int newteam, bool announce, bool spew_everything));
2220 void Set_OnGameStateRequest(void (*callback)(int pnum));
2221 void Set_OnSaveStatsToFile(void (*callback)(void));
2222 void Set_OnPlayerReconnect(void (*callback)(int player_num));
2223 void Set_OnPlayerConnect(void (*callback)(int player_num));
2224 void Set_OnControlMessage(void (*callback)(uint8_t msg, int from_pnum));
2225 void Set_OnAllowObserverChange(bool (*callback)(bool turnonobserver));
2226 void Set_OnClientShowUI(void (*callback)(int id, void *user_data));
2227 void Set_OnPrintScores(void (*callback)(int level));
2228 void Set_OnDisconnectSaveStatsToFile(void (*callback)(void));
2229 void Set_OnLevelEndSaveStatsToFile(void (*callback)(void));
2230 void Set_OnGetHudCallSignColor(ddgr_color (*callback)(int playernum));
2231 void Set_OnTeamChangeName(void (*callback)(int team, char *oldname, char *newname));
2232 void Set_OnDoControls(void (*callback)(game_controls *controls));
2233 void Set_OnPlayAudioTaunt(void (*callback)(int pnum));
2234 void Set_OnGetTokenString(void (*callback)(char *src, char *dest, int dest_size));
2235
2236 void CallOnServerPlayerKilled(object *killer_obj, int victim_pnum);
2237 void CallOnServerPlayerExploded(int player_num);
2238 void CallOnServerCollide(object *me_obj, object *it_obj);
2239 void CallOnServerCollide(object *me_obj, object *it_obj, vector *point, vector *normal);
2240 void CallOnServerPlayerChangeSegment(int player_num, int newseg, int oldseg);
2241 void CallOnServerObjectChangeSegment(object *obj, int newseg, int oldseg);
2242 void CallOnServerPlayerEntersGame(int player_num);
2243 void CallOnServerPlayerDisconnect(int player_num);
2244 void CallOnServerGameCreated(void);
2245 void CallOnServerLevelChange(void);
2246 void CallOnServerLevelStart(void);
2247 void CallOnServerLevelEnd(void);
2248 void CallOnServerObjectShieldsChanged(object *obj, float amount);
2249 bool CallOnServerIsAddressBanned(network_address *addr, const char *tracker_id);
2250 void CallOnServerWallCollide(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt, vector *wall_normal,
2251 float hit_dot);
2252 void CallOnServerObjectKilled(object *obj, object *killer);
2253 void CallOnServerObjectDestroyed(object *obj);
2254 void CallOnClientPlayerKilled(object *killer_obj, int victim_pnum);
2255 void CallOnClientPlayerExploded(int player_num);
2256 void CallOnClientCollide(object *me_obj, object *it_obj);
2257 void CallOnClientCollide(object *me_obj, object *it_obj, vector *point, vector *normal);
2258 void CallOnClientPlayerChangeSegment(int player_num, int newseg, int oldseg);
2259 void CallOnClientObjectChangeSegment(object *obj, int newseg, int oldseg);
2260 void CallOnClientPlayerEntersGame(int player_num);
2261 void CallOnClientPlayerDisconnect(int player_num);
2262 void CallOnMeDisconnectFromServer(void);
2263 void CallOnClientGameCreated(void);
2264 void CallOnClientObjectShieldsChanged(object *obj, float amount);
2265 void CallOnWeaponFired(object *weapon_obj, object *shooter);
2266 void CallOnClientLevelChange(void);
2267 void CallOnClientLevelStart(void);
2268 void CallOnClientLevelEnd(void);
2269 void CallOnClientWallCollide(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt, vector *wall_normal,
2270 float hit_dot);
2271 void CallOnClientObjectKilled(object *obj, object *killer);
2272 void CallOnClientObjectDestroyed(object *obj);
2273 void CallOnPlayerEntersObserver(int pnum, object *piggy);
2274 void CallOnPlayerExitsObserver(int pnum);
2275 bool CallOnCanChangeTeam(int pnum, int newteam);
2276 void CallOnSpecialPacket(void);
2277 void CallOnInterval(void);
2278 void CallOnHUDInterval(void);
2279 void CallOnPLRInterval(void);
2280 void CallOnPLRInit(void);
2281 void CallOnKeypress(int key);
2282 void CallOnInputString(char *input_string);
2283 void CallOnPlayerChangeTeam(int player_num, int newteam, bool announce, bool spew_everything);
2284 void CallOnGameStateRequest(int pnum);
2285 void CallOnSaveStatsToFile(void);
2286 void CallOnPlayerReconnect(int player_num);
2287 void CallOnPlayerConnect(int player_num);
2288 void CallOnControlMessage(uint8_t msg, int from_pnum);
2289 bool CallOnAllowObserverChange(bool turnonobserver);
2290 void CallOnClientShowUI(int id, void *user_data);
2291 void CallOnPrintScores(int level);
2292 void CallOnDisconnectSaveStatsToFile(void);
2293 void CallOnLevelEndSaveStatsToFile(void);
2294 ddgr_color CallOnGetHudCallSignColor(int playernum);
2295 void CallOnTeamChangeName(int team, char *oldname, char *newname);
2296 void CallOnDoControls(game_controls *controls);
2297 void CallOnPlayAudioTaunt(int pnum);
2298 void CallOnGetTokenString(char *src, char *dest, int dest_size);
2299
2300 private:
2301 // DMFCBase::InitializeVirtualHandles
2302 //
2303 // Prepares the virtual handles
2304 void InitializeVirtualHandles(void);
2305
2306 void (*UserOnServerPlayerKilled)(object *killer_obj, int victim_pnum);
2307 void (*UserOnServerPlayerExploded)(int player_num);
2308 void (*UserOnServerCollide)(object *me_obj, object *it_obj);
2309 void (*UserOnServerCollide2)(object *me_obj, object *it_obj, vector *point, vector *normal);
2310 void (*UserOnServerPlayerChangeSegment)(int player_num, int newseg, int oldseg);
2311 void (*UserOnServerObjectChangeSegment)(object *obj, int newseg, int oldseg);
2312 void (*UserOnServerPlayerEntersGame)(int player_num);
2313 void (*UserOnServerPlayerDisconnect)(int player_num);
2314 void (*UserOnServerGameCreated)(void);
2315 void (*UserOnServerLevelChange)(void);
2316 void (*UserOnServerLevelStart)(void);
2317 void (*UserOnServerLevelEnd)(void);
2318 void (*UserOnServerObjectShieldsChanged)(object *obj, float amount);
2319 bool (*UserOnServerIsAddressBanned)(network_address *addr, const char *tracker_id);
2320 void (*UserOnServerWallCollide)(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt,
2321 vector *wall_normal, float hit_dot);
2322 void (*UserOnServerObjectKilled)(object *obj, object *killer);
2323 void (*UserOnServerObjectDestroyed)(object *obj);
2324 void (*UserOnClientPlayerKilled)(object *killer_obj, int victim_pnum);
2325 void (*UserOnClientPlayerExploded)(int player_num);
2326 void (*UserOnClientCollide)(object *me_obj, object *it_obj);
2327 void (*UserOnClientCollide2)(object *me_obj, object *it_obj, vector *point, vector *normal);
2328 void (*UserOnClientPlayerChangeSegment)(int player_num, int newseg, int oldseg);
2329 void (*UserOnClientObjectChangeSegment)(object *obj, int newseg, int oldseg);
2330 void (*UserOnClientPlayerEntersGame)(int player_num);
2331 void (*UserOnClientPlayerDisconnect)(int player_num);
2332 void (*UserOnMeDisconnectFromServer)(void);
2333 void (*UserOnClientGameCreated)(void);
2334 void (*UserOnClientObjectShieldsChanged)(object *obj, float amount);
2335 void (*UserOnWeaponFired)(object *weapon_obj, object *shooter);
2336 void (*UserOnClientLevelChange)(void);
2337 void (*UserOnClientLevelStart)(void);
2338 void (*UserOnClientLevelEnd)(void);
2339 void (*UserOnClientWallCollide)(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt,
2340 vector *wall_normal, float hit_dot);
2341 void (*UserOnClientObjectKilled)(object *obj, object *killer);
2342 void (*UserOnClientObjectDestroyed)(object *obj);
2343 void (*UserOnPlayerEntersObserver)(int pnum, object *piggy);
2344 void (*UserOnPlayerExitsObserver)(int pnum);
2345 bool (*UserOnCanChangeTeam)(int pnum, int newteam);
2346 void (*UserOnSpecialPacket)(void);
2347 void (*UserOnInterval)(void);
2348 void (*UserOnHUDInterval)(void);
2349 void (*UserOnPLRInterval)(void);
2350 void (*UserOnPLRInit)(void);
2351 void (*UserOnKeypress)(int key);
2352 void (*UserOnInputString)(char *input_string);
2353 void (*UserOnPlayerChangeTeam)(int player_num, int newteam, bool announce, bool spew_everything);
2354 void (*UserOnGameStateRequest)(int pnum);
2355 void (*UserOnSaveStatsToFile)(void);
2356 void (*UserOnPlayerReconnect)(int player_num);
2357 void (*UserOnPlayerConnect)(int player_num);
2358 void (*UserOnControlMessage)(uint8_t msg, int from_pnum);
2359 bool (*UserOnAllowObserverChange)(bool turnonobserver);
2360 void (*UserOnClientShowUI)(int id, void *user_data);
2361 void (*UserOnPrintScores)(int level);
2362 void (*UserOnDisconnectSaveStatsToFile)(void);
2363 void (*UserOnLevelEndSaveStatsToFile)(void);
2364 ddgr_color (*UserOnGetHudCallSignColor)(int playernum);
2365 void (*UserOnTeamChangeName)(int team, char *oldname, char *newname);
2366 void (*UserOnDoControls)(game_controls *controls);
2367 void (*UserOnPlayAudioTaunt)(int pnum);
2368 void (*UserOnGetTokenString)(char *src, char *dest, int dest_size);
2369 };
2370
2371 #define ENABLE_FLAGS(f, i) (f |= (i))
2372 #define DISABLE_FLAGS(f, i) (f &= ~(i))
2373
2374 #define DMFC_PRF_PLRFIRSTTIME 0x00000001 // This flag will be enabled if the Post Level Results has had one frame shown
2375 #define DMFC_PRF_AUTOTIMELIMIT 0x00000002 // Enabled: DMFC should handle ending a timed multiplayer game
2376 #define DMFC_PRF_AUTODEATHMSG 0x00000004 // Enabled: DMFC should handle displaying death messages
2377 #define DMFC_PRF_AUTOTEAMSELECT 0x00000008 // Enabled: DMFC should handle initial team assignments
2378 #define DMFC_PRF_DISPPLAYERINFO 0x00000010 // Enabled: DMFC is currently displaying a player's info on the screen
2379 #define DMFC_PRF_DISPNETGAMEINFO 0x00000020 // Enabled: DMFC is currently displaying net game info
2380 #define DMFC_PRF_DISPSTATHUDMSGS 0x00000040 // Enabled: DMFC should display random statistical messages
2381 #define DMFC_PRF_AUTOSAVELEVELEND 0x00000080 // Enabled: DMFC should signal an auto-save when the level ends
2382 #define DMFC_PRF_AUTOSAVEDISC 0x00000100 // Enabled: DMFC should signal an auto-save if the player gets disconnected
2383 #define DMFC_PRF_DISPMENUBACKGR 0x00000200 // Enabled: DMFC should put a background on the On-Screen menu
2384 #define DMFC_PRF_INOPTIONS 0x00000400 // Enabled: DMFC is currently displayed the On-Screen menu
2385 #define DMFC_PRF_CANTEAMCHANGE 0x00000800 // Enabled: The server is allowing client specified team changing
2386 #define DMFC_PRF_NOTEAMSELECTONSTART \
2387 0x00001000 // Enabled: DMFC should NOT display the Team Select dialog on startup of a team game level
2388 #define DMFC_PRF_SHIPLOGOSENABLED 0x00002000 // Enabled: Display ship logos
2389 #define DMFC_PRF_NOWAITFORPLAYERS \
2390 0x00004000 // Enabled: DMFC should NOT display the wait for players dialog on startup of a single player game
2391 #define DMFC_PRF_PAUSETIME 0x00008000 // Enabled: Real game time (used for endlevel) is not updated
2392
2393 const char *DMFCGetString(int d);
2394
2395 ///////////////////////////////////////////////
2396 // localization info
2397 #define DTXT(d) DMFCGetString(d)
2398 #define DTXT_KILLED1 DTXT(0) //"%s was killed by %s"
2399 #define DTXT_SUICIDE1 DTXT(1) //"%s blasts themself"
2400 #define DTXT_MNUSRVRCOMMAND DTXT(2) //"Server Commands"
2401 #define DTXT_MNUKICK DTXT(3) //"Kick"
2402 #define DTXT_MNUBAN DTXT(4) //"Ban"
2403 #define DTXT_MNUENDLEVEL DTXT(5) //"End Level"
2404 #define DTXT_MNUTEAMCONTROL DTXT(6) //"Team Control"
2405 #define DTXT_MNUBALANCE DTXT(7) //"Balance Teams"
2406 #define DTXT_MNUAUTOBALANCE DTXT(8) //"AutoTeam Balance"
2407 #define DTXT_MNUALLOWTEAMCNG DTXT(9) //"Allow Team Changing"
2408 #define DTXT_MNUON DTXT(10) //"On"
2409 #define DTXT_MNUOFF DTXT(11) //"Off"
2410 #define DTXT_MNUGETPLYRINFO DTXT(12) //"Get Player Info"
2411 #define DTXT_MNUOBSERVER DTXT(13) //"Observer Mode"
2412 #define DTXT_MNUCHANGETEAMS DTXT(14) //"Change Teams"
2413 #define DTXT_RED DTXT(15) //"Red"
2414 #define DTXT_BLUE DTXT(16) //"Blue"
2415 #define DTXT_GREEN DTXT(17) //"Green"
2416 #define DTXT_YELLOW DTXT(18) //"Yellow"
2417 #define DTXT_SERVER DTXT(19) //"Server"
2418 #define DTXT_CLIENT DTXT(20) //"Client"
2419 #define DTXT_TEAMFORMAT DTXT(21) //"Team: %s"
2420 #define DTXT_PLRNUMFORMAT DTXT(22) //"PlayerNum: %d"
2421 #define DTXT_TCPIPADDRFORM DTXT(23) //"TCP/IP Address: %s"
2422 #define DTXT_SHIPFORM DTXT(24) //"Ship: %s"
2423 #define DTXT_STRAYFIREFORM DTXT(25) //"%s was killed by a U.F.O."
2424 #define DTXT_LONER DTXT(26) //"Loner"
2425 #define DTXT_SAVESTATS DTXT(27) //"Save Stats To File"
2426 #define DTXT_ROBOTKILL DTXT(28) //"%s was killed by a robot"
2427 #define DTXT_MNUSHOWCALLSIGNS DTXT(29) //"HUD Callsign Level"
2428 #define DTXT_KICKEDMSG DTXT(30) //"You've Been Kicked From The Game"
2429 #define DTXT_BANNEDMSG DTXT(31) //"You've Been Banned From This Game"
2430 #define DTXT_MNUSSHOWCALLSIGNS DTXT(32) //"Max HUD Callsign Level"
2431 #define DTXT_NONE DTXT(33) //"<None>"
2432 #define DTXT_DEATHLASER DTXT(34) //%s's Laser blasts %s to smithereens"
2433 #define DTXT_DEATHVAUSS DTXT(35) //"%s punctures %s's ship with the Vauss"
2434 #define DTXT_DEATHMICROWAVE DTXT(36) //"%s is vaporized by %s's Microwave beam"
2435 #define DTXT_DEATHPLASMA DTXT(37) //"%s pulverizes %s with Plasma power"
2436 #define DTXT_DEATHFUSION DTXT(38) //"%s disintigrates %s's hull with the fusion"
2437 #define DTXT_DEATHSUPERLASER DTXT(39) //"%s's Super Laser blasts %s to smithereens"
2438 #define DTXT_DEATHMASS DTXT(40) //"%s targets %s for Mass destruction"
2439 #define DTXT_DEATHNAPALM DTXT(41) //"%s's Napalm burns %s beyond recognition"
2440 #define DTXT_DEATHEMD DTXT(42) //"%s's EMD electrocutes %s!"
2441 #define DTXT_DEATHOMEGA DTXT(43) //"%s's Omega peels off %s's shields"
2442 #define DTXT_DEATHCONC DTXT(44) //%s takes a pounding from %s's Concussion"
2443 #define DTXT_DEATHHOMING DTXT(45) //"%s's Homer swoops down on %s for the kill"
2444 #define DTXT_DEATHSMART DTXT(46) //"%s can't shake %s's Smart missile"
2445 #define DTXT_DEATHMEGA DTXT(47) //"%s's Mega reduces %s to smoldering scrap"
2446 #define DTXT_DEATHFRAG DTXT(48) //"%s catches shrapnel from %s's Frag"
2447 #define DTXT_DEATHGUIDED DTXT(49) //"%s's Guided hunts down %s"
2448 #define DTXT_DEATHNAPALMROCKET DTXT(50) //"%s is incinerated by %s's Napalm Rocket"
2449 #define DTXT_DEATHCYCLONE DTXT(51) //%s's Cyclone overwhelms %s's defenses"
2450 #define DTXT_DEATHFLARE DTXT(52) //"%s's Flare ignites %s's fuel leak"
2451 #define DTXT_OSM_REMOVEBAN DTXT(53) //"Remove Ban"
2452 #define DTXT_OSM_REHASHLIST DTXT(54) //"Rehash Allow/Deny List"
2453 #define DTXT_OSM_MAXHUDNAME DTXT(55) //"Max HUD Name Level"
2454 #define DTXT_PLAIN_NONE DTXT(56) //"None"
2455 #define DTXT_OSM_TEAMONLY DTXT(57) //"Team Only"
2456 #define DTXT_OSM_FULL DTXT(58) //"Full"
2457 #define DTXT_OSM_TEAMCONFIG DTXT(59) //"Show Team Config Dialog"
2458 #define DTXT_OSM_PIGGYBACK DTXT(60) //"PiggyBack Observer"
2459 #define DTXT_OSM_BACKGROUND DTXT(61) //"OnScreen Menu Background"
2460 #define DTXT_OSM_HUDNAMELEVEL DTXT(62) //"HUD Name Level"
2461 #define DTXT_OSM_SHIPLOGOS DTXT(63) //"Ship Logos"
2462 #define DTXT_OSM_STATSTOFILE DTXT(64) //"Game Stats To File"
2463 #define DTXT_OSM_STATLEVELEND DTXT(65) //"AutoSave On Level End"
2464 #define DTXT_OSM_STATDISCONNECT DTXT(66) //"AutoSave On Disconnect"
2465 #define DTXT_OSM_NETGAMEINFO DTXT(67) //"NetGame Info"
2466 #define DTXT_OSM_HUDFILTER DTXT(68) //"HUD Message Filters"
2467 #define DTXT_OSM_KILLMESSAGES DTXT(69) //"Kill Messages"
2468 #define DTXT_OSM_SIMPLE DTXT(70) //"Simple"
2469 #define DTXT_OSM_STATMESSAGES DTXT(71) //"Statistical Messages"
2470 #define DTXT_OSM_EXIT DTXT(72) //"Exit Menu"
2471 #define DTXT_PI_TIMEINGAME DTXT(73) //"Total Time In Game: %s\n"
2472 #define DTXT_SETTEAMNAME DTXT(74) //"%s changed team name to %s"
2473 #define DTXT_HUDLEVEL_FULL DTXT(75) //"Personal HUD Name Level: Full"
2474 #define DTXT_HUDLEVEL_TEAM DTXT(76) //"Personal HUD Name Level: Team Only"
2475 #define DTXT_HUDLEVEL_NONE DTXT(77) //"Personal HUD Name Level: None"
2476 #define DTXT_SHUDLEVEL_FULL DTXT(78) //"Server Max HUD Name Level: Full"
2477 #define DTXT_SHUDLEVEL_TEAM DTXT(79) //"Server Max HUD Name Level: Team Only"
2478 #define DTXT_SHUDLEVEL_NONE DTXT(80) //"Server Max HUD Name Level: None"
2479 #define DTXT_DMFC_STAT_HEADER DTXT(81) //"Callsign: Kills: Deaths:"
2480 #define DTXT_DEDS_BAN DTXT(82) //"Banning %s\n"
2481 #define DTXT_DEDS_BAN_ERROR DTXT(83) //"Unable to ban player...pnum not valid\n"
2482 #define DTXT_TIME_HOUR DTXT(84) //"01:00:00 hour"
2483 #define DTXT_TIME_HOURS DTXT(85) //"%d:%.2d:%.2d hours"
2484 #define DTXT_TIME_MINUTE DTXT(86) //"1:00 minute"
2485 #define DTXT_TIME_MINUTES DTXT(87) //"%d:%.2d minutes"
2486 #define DTXT_TIME_SECOND DTXT(88) //"1 second"
2487 #define DTXT_TIME_SECONDS DTXT(89) //"%d seconds"
2488 #define DTXT_IC_ALLOWTEAMCHANGE DTXT(90) //"allowteamchange"
2489 #define DTXT_IC_ALLOWTEAMCHANGED \
2490 DTXT(91) //"[Server Only]\nTurns off/on allowing clients to change their team.\nUsage: \"$allowteamchange <off/on>\""
2491 #define DTXT_IC_AUTOBALANCE DTXT(92) //"autobalance"
2492 #define DTXT_IC_AUTOBALANCED \
2493 DTXT(93) //"[Server Only]\nTurns off/on allowing the automatic team placement of new players by the server.\nUsage:
2494 //\"$autobalance <off/on>\""
2495 #define DTXT_IC_AUTOSAVEDISC DTXT(94) //"autosavedisconnect"
2496 #define DTXT_IC_AUTOSAVEDISCD \
2497 DTXT(95) //"Enables/Disables the automatic saving of the game stats if you disconnect from the server.\nUsage:
2498 //\"$autosavedisconnect <on/off>\""
2499 #define DTXT_IC_AUTOSAVELEVEL DTXT(96) //"autosavelevel"
2500 #define DTXT_IC_AUTOSAVELEVELD \
2501 DTXT(97) //"Enables/Disables the automatic saving of the game stats when the level ends.\nUsage: \"$autosavelevel
2502 //<on/off>\""
2503 #define DTXT_IC_BALANCE DTXT(98) //"balance"
2504 #define DTXT_IC_BALANCED \
2505 DTXT(99) //"[Server Only]\nAutomatically balances the teams, based on senority.\nUsage: \"$balance\""
2506 #define DTXT_IC_BAN DTXT(100) //"ban"
2507 #define DTXT_IC_BAND DTXT(101) //"[Server Only]\nBans a player from the game.\nUsage: \"$ban <pnum>\""
2508 #define DTXT_IC_BANLIST DTXT(102) //"banlist"
2509 #define DTXT_IC_BANLISTD \
2510 DTXT(103) //"[Dedicated Server Only]\nLists the players banned from the game along with their ban number, which can be
2511 // used to remove the ban.\nUsage: \"$banlist\""
2512 #define DTXT_IC_CHANGETEAM DTXT(104) //"changeteam"
2513 #define DTXT_IC_CHANGETEAMD \
2514 DTXT(105) //"[Server Only]\nForces a player to a team.\nUsage: \"$changeteam <pnum> <team_name>\""
2515 #define DTXT_IC_ENDLEVEL DTXT(106) //"endlevel"
2516 #define DTXT_IC_ENDLEVELD DTXT(107) //"[Server Only]\nEnds the level.\nUsage: \"$endlevel\""
2517 #define DTXT_IC_HELP DTXT(108) //"help"
2518 #define DTXT_IC_HELPD DTXT(109) //"Displays help information for the input commands.\nUsage: \"$help [command]\""
2519 #define DTXT_IC_HUDNAME DTXT(110) //"hudnames"
2520 #define DTXT_IC_HUDNAMED \
2521 DTXT(111) //"Sets your personal level for the HUD name filter.\nUsage: \"$hudnames <full/team/none>\"\nNOTE: You can
2522 // only set your HUD Callsign level up to the level that the server is. So if the server is only allowing
2523 // up to teammates, you won't be able to set to full"
2524 #define DTXT_IC_KICK DTXT(112) //"kick"
2525 #define DTXT_IC_KICKD DTXT(113) //"[Server Only]\nKicks a player from the game.\nUsage: \"$kick <pnum>\""
2526 #define DTXT_IC_KILLMSGFILTER DTXT(114) //"killmsgfilter"
2527 #define DTXT_IC_KILLMSGFILTERD \
2528 DTXT(115) //"Sets the kill message filter, for what style of messages you want.\nUsage: \"$killmsgfilter
2529 //<full/simple/none>\""
2530 #define DTXT_IC_NETGAMEINFO DTXT(116) //"netgameinfo"
2531 #define DTXT_IC_NETGAMEINFOD DTXT(117) //"Displays information about the net game.\nUsage: \"$netgameinfo\""
2532 #define DTXT_IC_OBSERVER DTXT(118) //"observer"
2533 #define DTXT_IC_OBSERVERD \
2534 DTXT(119) //"If you pass specify 'on', it puts you into observer mode, else it will return you back to normal
2535 // mode.\nUsage: \"$observer <on/off>\""
2536 #define DTXT_IC_PIGGYBACK DTXT(120) //"piggyback"
2537 #define DTXT_IC_PIGGYBACKD DTXT(121) //"Puts you into Piggyback Observer mode.\"$piggyback <pnum>\""
2538 #define DTXT_IC_PLAYERINFO DTXT(122) //"playerinfo"
2539 #define DTXT_IC_PLAYERINFOD DTXT(123) //"Displays information about a player.\nUsage: \"$playerinfo <pnum>\""
2540 #define DTXT_IC_PLAYERS DTXT(124) //"players"
2541 #define DTXT_IC_PLAYERSD \
2542 DTXT(125) //"[Dedicated Server Only]\nDisplays a list of the players in the game, with their player numbers.\nUsage:
2543 //\"$players\""
2544 #define DTXT_IC_REHASH DTXT(126) //"rehash"
2545 #define DTXT_IC_REHASHD \
2546 DTXT(127) //"[Server Only]\nRehashes the hosts.allow and hosts.deny files. First it flushes the old, and reloads
2547 // them.\nUsages: \"$rehash\""
2548 #define DTXT_IC_REMOVEBAN DTXT(128) //"removeban"
2549 #define DTXT_IC_REMOVEBAND \
2550 DTXT(129) //"[Dedicated Server Only]\nRemoves a ban from a player, given the number associated with them from
2551 //$banlist.\nUsage: \"$removeban <player>\""
2552 #define DTXT_IC_SAVESTATS DTXT(130) //"savestats"
2553 #define DTXT_IC_SAVESTATSD DTXT(131) //"Saves the game stats to file immediatly.\nUsage: \"$savestats\""
2554 #define DTXT_IC_SCORES DTXT(132) //"scores"
2555 #define DTXT_IC_SCORESD DTXT(133) //"Displays the scores or stats of the game.\nUsage: \"$scores\""
2556 #define DTXT_IC_SERVERHUDNAMES DTXT(134) //"serverhudnames"
2557 #define DTXT_IC_SERVERHUDNAMESD \
2558 DTXT(135) //"[Server Only]\nSets the highest HUD name filter permitted for the clients.\nUsage: \"$serverhudnames
2559 //<full/team/none>\""
2560 #define DTXT_IC_SETGOALLIMIT DTXT(136) //"setgoallimit"
2561 #define DTXT_IC_SETGOALLIMITD \
2562 DTXT(137) //"[Server Only]\nChanges the goal limit for the level.\nUsage: \"$setgoallimit <points>\""
2563 #define DTXT_IC_SETMAXPLAYERS DTXT(138) //"setmaxplayers"
2564 #define DTXT_IC_SETMAXPLAYERSD \
2565 DTXT(139) //"[Server Only]\nSets the maximum number of players allowed in the game.\nUsage: \"$setmaxplayers
2566 //<count>\""
2567 #define DTXT_IC_SETPPS DTXT(140) //"setpps"
2568 #define DTXT_IC_SETPPSD \
2569 DTXT(141) //"[Server Only]\nChanges the Packets Per Second (PPS) threshold of the game\nUsage: \"$setpps <pps>\""
2570 #define DTXT_IC_SETRESPAWNTIME DTXT(142) //"setrespawntime"
2571 #define DTXT_IC_SETRESPAWNTIMED \
2572 DTXT(143) //"[Server Only]\nChanges the respawn time of the powerups in the level.\nUsage: \"$setrespawntime
2573 //<seconds>\""
2574 #define DTXT_IC_SETTEAMNAME DTXT(144) //"setteamname"
2575 #define DTXT_IC_SETTEAMNAMED \
2576 DTXT(145) //"[Server Only]\nChanges the name of a team.\nUsage: \"$setteamname <team_num> <new_team_name>\""
2577 #define DTXT_IC_SETTIMELIMIT DTXT(146) //"settimelimit"
2578 #define DTXT_IC_SETTIMELIMITD \
2579 DTXT(147) //"[Server Only]\nChanges the time limit for the level.\nUsage: \"$settimelimit <minutes>\""
2580 #define DTXT_IC_STATMSGS DTXT(148) //"statmsgs"
2581 #define DTXT_IC_STATMSGSD DTXT(149) //"Enables/Disables random statistical messages.\nUsage: \"$statmsgs <on/off>\""
2582 #define DTXT_IC_TEAM DTXT(150) //"team"
2583 #define DTXT_IC_TEAMD DTXT(151) //"Change teams for yourself.\nUsage: \"$team <team_name>\""
2584 #define DTXT_IC_HEADEERLIST DTXT(152) //"Input Command List:\n"
2585 #define DTXT_IC_HEADERINSTRUCT \
2586 DTXT(153) //"Prefix a '$' before the commands listed below. To get more detailed help\nabout a command, type '$help
2587 //<command>'\n"
2588 #define DTXT_IC_NOADDITIONALINFO DTXT(154) //"No additional information is available\n"
2589 #define DTXT_IC_COMMANDNOTFOUND DTXT(155) //"Command not found\n"
2590 #define DTXT_SUNDAY DTXT(156) //"Sun"
2591 #define DTXT_MONDAY DTXT(157) //"Mon"
2592 #define DTXT_TUESDAY DTXT(158) //"Tue"
2593 #define DTXT_WEDNESDAY DTXT(159) //"Wed"
2594 #define DTXT_THURSDAY DTXT(160) //"Thur"
2595 #define DTXT_FRIDAY DTXT(161) //"Fri"
2596 #define DTXT_SATURDAY DTXT(162) //"Sat"
2597 #define DTXT_JANUARY DTXT(163) //"Jan"
2598 #define DTXT_FEBRUARY DTXT(164) //"Feb"
2599 #define DTXT_MARCH DTXT(165) //"March"
2600 #define DTXT_APRIL DTXT(166) //"April"
2601 #define DTXT_MAY DTXT(167) //"May"
2602 #define DTXT_JUNE DTXT(168) //"June"
2603 #define DTXT_JULY DTXT(169) //"July"
2604 #define DTXT_AUGUST DTXT(170) //"Aug"
2605 #define DTXT_SEPTEMBER DTXT(171) //"Sept"
2606 #define DTXT_OCTOBER DTXT(172) //"Oct"
2607 #define DTXT_NOVEMBER DTXT(173) //"Nov"
2608 #define DTXT_DECEMBER DTXT(174) //"Dec"
2609 #define DTXT_ENDOFLEVELCONCAT DTXT(175) //"End_Of_Level_"
2610 #define DTXT_NGI_HEADING DTXT(176) //"NetGame Information\n"
2611 #define DTXT_NGI_GAMENAME DTXT(177) //"Game Name: %s\n"
2612 #define DTXT_NGI_MISSIONNAME DTXT(178) //"Mission Name: %s\n"
2613 #define DTXT_NGI_SCRIPTNAME DTXT(179) //"Script Name: %s\n"
2614 #define DTXT_NGI_PPS DTXT(180) //"PPS: %d\n"
2615 #define DTXT_NGI_PPSSERVER DTXT(181) //"PPS (Server/You): %d/%d\n"
2616 #define DTXT_NGI_MAXPLAYERS DTXT(182) //"Max Players: %d\n"
2617 #define DTXT_NGI_ACCURATECOLL DTXT(183) //"Accurate Weapon Collisions: %s\n"
2618 #define DTXT_NGI_SENDROTATIONAL DTXT(184) //"Send Rotational Velocity: %s\n"
2619 #define DTXT_NGI_TIMELIMIT DTXT(185) //"Time Limit: %d %s\n"
2620 #define DTXT_MINUTE DTXT(186) //"minute"
2621 #define DTXT_MINUTES DTXT(187) //"minutes"
2622 #define DTXT_NGI_TIMELEFT DTXT(188) //"Time Left: %s\n"
2623 #define DTXT_NGI_NOTIMELIMIT DTXT(189) //"Time Limit: None"
2624 #define DTXT_NGI_GOALLIMIT DTXT(190) //"Goal: %d points\n"
2625 #define DTXT_NGI_NOGOAL DTXT(191) //"Goal: None\n"
2626 #define DTXT_NGI_RESPAWNTIME DTXT(192) //"Respawn Time: %s\n"
2627 #define DTXT_NGI_PACKETLOSSNA DTXT(193) //"Packet Loss: N/A\n"
2628 #define DTXT_NGI_PACKETLOSS DTXT(194) //"Packet Loss: %.1f%%\n"
2629 #define DTXT_NGI_NETWORKMODEL DTXT(195) //"Network Model: %s\n"
2630 #define DTXT_PEERTOPEER DTXT(196) //"Peer-To-Peer"
2631 #define DTXT_CLIENTSERVER DTXT(197) //"Client/Server"
2632 #define DTXT_NGI_MOVEMENTSMOOTHING DTXT(198) //"Movement Smoothing: %s\n"
2633 #define DTXT_CHANGETEAMDENIED DTXT(199) //"Team Change Was Denied"
2634 #define DTXT_KILLMSGFULL DTXT(200) //"Kill Message Filter: Full"
2635 #define DTXT_KILLMSGSIMPLE DTXT(201) //"Kill Message Filter: Simple"
2636 #define DTXT_KILLMSGNONE DTXT(202) //"Kill Message Filter: None"
2637 #define DTXT_WAITFORSERVER DTXT(203) //"Waiting For Server..."
2638 #define DTXT_PRESSPRNTSCRN DTXT(204) //"Press PrintScreen For A ScreenShot"
2639 #define DTXT_CHANGETEAM DTXT(205) //"%s changes teams to the %s team\n"
2640 #define DTXT_NOKILLERDEATHMSG DTXT(206) //"%s was killed"
2641 #define DTXT_SIMPLESUICIDEMSG DTXT(207) //"%s went suicidal"
2642 #define DTXT_HM_KILLSINAROW DTXT(208) //"That's %d kills in a row for %s!"
2643 #define DTXT_HM_DEATHSINAROW DTXT(209) //"That's %d deaths in a row for %s!"
2644 #define DTXT_HM_TIMESINCELASTKILL DTXT(210) //"It's %s's first kill in %s"
2645 #define DTXT_HM_TIMESINCELASTDEATH DTXT(211) //"%s lasted %s without being killed!"
2646 #define DTXT_HM_HIGHEFFICENCY DTXT(212) //"%s has an awesome efficiency of %.2f!!"
2647 #define DTXT_HM_GOODEFFICENCY DTXT(213) //"%s has an efficiency of %.2f"
2648 #define DTXT_HM_TIMESKILLED DTXT(214) //"%s has killed %s %d times!"
2649 #define DTXT_HM_REVENGE DTXT(215) //"%s got revenge on %s!"
2650 #define DTXT_TEAMCHANGEATTEMPT DTXT(216) //"Attempting to change teams to %s team"
2651 #define DTXT_STEAMCHANGEATTEMPT DTXT(217) //"Attempting to change %s to %s team"
2652 #define DTXT_GETPLAYERINFO DTXT(218) //"Getting Playerinfo for %s"
2653 #define DTXT_BALANCETEAMMSG DTXT(219) //"Balancing Teams"
2654 #define DTXT_AUTOTEAMBALANCEMSG DTXT(220) //"Auto Team Balance: %s"
2655 #define DTXT_ALLOWTEAMCHANGEMSG DTXT(221) //"Allow Team Changing: %s"
2656 #define DTXT_KICKMSG DTXT(222) //"Kicking %s from game"
2657 #define DTXT_BANMSG DTXT(223) //"Banning %s from game"
2658 #define DTXT_ENDLEVELMSG DTXT(224) //"Ending the level"
2659 #define DTXT_STATSMSGSET DTXT(225) //"Statistical Messages: %s"
2660 #define DTXT_AUTOSAVELEVELMSG DTXT(226) //"AutoSave Stats on Level End: %s"
2661 #define DTXT_AUTOSAVEDISCMSG DTXT(227) //"AutoSave Stats on Disconnect: %s"
2662 #define DTXT_TIMELIMITSETMSG DTXT(228) //"Time Limit: %d"
2663 #define DTXT_TIMELIMITOFFMSG DTXT(229) //"Time Limit: Off"
2664 #define DTXT_GOALLIMITSETMSG DTXT(230) //"Goal Limit: %d"
2665 #define DTXT_GOALLIMITOFFMSG DTXT(231) //"Goal Limit: None"
2666 #define DTXT_MAXPLAYERSSETMSG DTXT(232) //"Max Players: %d"
2667 #define DTXT_RESPAWNTIMEMSG DTXT(233) //"Respawn Time: %d"
2668 #define DTXT_PPSSETMSG DTXT(234) //"Max PPS: %d"
2669 #define DTXT_BANREMOVEDMSG DTXT(235) //"Ban Removed\n"
2670 #define DTXT_BANNOTREMOVEDMSG DTXT(236) //"Couldn't remove ban\n"
2671 #define DTXT_NOTINDEDICATED DTXT(237) //"Command Not Available To Dedicated Server\n"
2672 #define DTXT_OBSERVERDENIED DTXT(238) //"Observer mode request denied"
2673 #define DTXT_INVALIDPNUM DTXT(239) //"Invalid Player Number"
2674 #define DTXT_PLAYERLISTHEADER DTXT(240) //"PNum Name\n"
2675 #define DTXT_INVALIDTEAM DTXT(241) //"Invalid Team, Must be between 0 and %d"
2676 #define DTXT_SERVERCANTKICK DTXT(242) //"Server can't kick themself\n"
2677 #define DTXT_SERVERCANTBAN DTXT(243) //"Server can't ban themself\n"
2678 #define DTXT_BALANCINGTEAMS DTXT(244) //"Balancing Teams\n"
2679 #define DTXT_NODEDICATEDTEAM DTXT(245) //"Dedicated Server Can't Change Teams\n"
2680 #define DTXT_SAMETEAMCHANGE DTXT(246) //"You're already on the %s team\n"
2681 #define DTXT_SHIPLOGOSMSG DTXT(247) //"Ship Logos: %s"
2682 #define DTXT_ENABLED DTXT(248) //"Enabled"
2683 #define DTXT_DISABLED DTXT(249) //"Disabled"
2684 #define DTXT_REHASHINGMSG DTXT(250) //"Rehashing Hosts.allow and Hosts.deny"
2685 #define DTXT_STAT_STATUS DTXT(251) //"Status:"
2686 #define DTXT_STAT_TEAM DTXT(252) //"Team:"
2687 #define DTXT_STAT_PLAYTIME DTXT(253) //"Play Time:"
2688 #define DTXT_STAT_STREAK DTXT(254) //"Streak:"
2689 #define DTXT_STAT_LASTVICTIM DTXT(255) //"Last Victim:"
2690 #define DTXT_STAT_LASTKILLER DTXT(256) //"Last Killer:"
2691 #define DTXT_STAT_SERVER DTXT(257) //"Server"
2692 #define DTXT_STAT_OBSERVER DTXT(258) //"Observing"
2693 #define DTXT_STAT_PLAYING DTXT(259) //"Playing"
2694 #define DTXT_STAT_DISCONNECTED DTXT(260) //"Disconnected"
2695 #define DTXT_STAT_KILL DTXT(261) //"Kill"
2696 #define DTXT_STAT_KILLS DTXT(262) //"Kills"
2697 #define DTXT_STAT_DEATH DTXT(263) //"Death"
2698 #define DTXT_STAT_DEATHS DTXT(264) //"Deaths"
2699 #define DTXT_STAT_PILOTNAMELABEL DTXT(265) //"Pilot Name"
2700 #define DTXT_UI_STARTGAME DTXT(266) //"Start Game"
2701 #define DTXT_UI_RETURNTOGAME DTXT(267) //"Return to Game"
2702 #define DTXT_UI_CLIENTSWAIT DTXT(268) //"Make Clients Wait"
2703 #define DTXT_UI_TEAMSETUP DTXT(269) //"Team Setup"
2704 #define DTXT_UI_WAITFORPLAYERS DTXT(270) //"Waiting For Players"
2705 #define DTXT_UI_KICKPLAYER DTXT(271) //"Kick Player"
2706 #define DTXT_UI_BANPLAYER DTXT(272) //"Ban Player"
2707 #define DTXT_OSM_AUDIOTAUNTS DTXT(273) //"Audio Taunts"
2708 #define DTXT_AUDIOTAUNTSMSG DTXT(274) //"Audio Taunts: %s"
2709 #define DTXT_RANK DTXT(275) //"Rank:"
2710 #define DTXT_NETWORK_LOSS DTXT(276) //"Network Loss"
2711 #define DTXT_NETWORK_PING DTXT(277) //"Network Ping"
2712 #define DTXT_LOSSPINGIND DTXT(278) //"Loss/Ping HUD Indicator"
2713 #define DTXT_LOSSINDICATOR DTXT(279) //"Loss/Ping Indicator: %s"
2714 #define DTXT_PERMISSABLE DTXT(280) //"Permissable C/S"
2715 #define DTXT_IC_WARP DTXT(281) //"warp"
2716 #define DTXT_IC_WARPD \
2717 DTXT(282) //"[Server Only]\nChanges the current level to another level in the mission.\nUsage: \"$warp <level>\""
2718 //---------------------
2719 #define DTXT_REMOTELOGGEDOUT DTXT(283) //"Remote Admin Logged Out"
2720 #define DTXT_HUDMSGLOGGEDOUT DTXT(284) //"==%s has logged out=="
2721 #define DTXT_HUDMSGLOGGEDIN DTXT(285) //"==%s is remote administrating=="
2722 #define DTXT_REMOTELOGGEDIN DTXT(286) //"Remote Admin Logged In"
2723 #define DTXT_REMOTEEXECUTE DTXT(287) //"==%s executed "%s""
2724 #define DTXT_REMOTESUCCESS DTXT(288) //"Remote Command Successful"
2725 #define DTXT_REMOTENOTSUCCESS DTXT(289) //"Remote Command Not Successful"
2726 #define DTXT_REMOTENOTALLOWED DTXT(290) //"Remote Command Not Allowed"
2727 #define DTXT_REMOTENOTFOUND DTXT(291) //"Remote Command Not Found"
2728 #define DTXT_UNABLETOREMOTE DTXT(292) //"Unable to enable remote administration (no password?)"
2729 #define DTXT_REMOTEADMINENABLE DTXT(293) //"Remote Administration: %s"
2730 #define DTXT_REMOTEADMINPASS DTXT(294) //"Remote Administration Password Set"
2731 #define DTXT_WAITSECS DTXT(295) //"Making Clients Wait %.2f seconds\n"
2732 #define DTXT_WAITOFF DTXT(296) //"Turning Off Client Wait Time\n"
2733 #define DTXT_WAITON DTXT(297) //"Making Clients Wait\n"
2734 #define DTXT_WAITNOLONGER DTXT(298) //"No Longer Making Clients Wait\n"
2735 #define DTXT_TEAMLABEL DTXT(299) //"%s Team:"
2736 #define DTXT_IC_REMOTE DTXT(300) //"remote"
2737 #define DTXT_IC_REMOTED \
2738 DTXT(301) //"[Client Only]\nhandles a remote admin command\nUsage: \"$remote <command> <option parms> <...>\""
2739 #define DTXT_IC_REMOTEADMIN DTXT(302) //"remoteadmin"
2740 #define DTXT_IC_REMOTEADMIND \
2741 DTXT(303) //"[Server Only]\nhandles enable/disable remote administration\nUsage: \"$remoteadmin <on/off>\""
2742 #define DTXT_IC_REMOTEADMINLOGOUT DTXT(304) //"remoteadminlogout"
2743 #define DTXT_IC_REMOTEADMINLOGOUTD \
2744 DTXT(305) //"[Server Only]\nhandles seeing who is logged in, and allows the server to log them out\nIf no parameter is
2745 // given it lists all the players logged in.\nTo log out a player give the login-id as a parameter\nUsage:
2746 //\"$remoteadminlogout [login-id]\""
2747 #define DTXT_IC_REMOTEADMINPASS DTXT(306) //"remoteadminpass"
2748 #define DTXT_IC_REMOTEADMINPASSD \
2749 DTXT(307) //"[Server Only]\nhandles setting/changing the remote administration password\nUsage: \"$remoteadminpass
2750 //<password>\""
2751 #define DTXT_IC_WAIT DTXT(308) //"wait"
2752 #define DTXT_IC_WAITD \
2753 DTXT(309) //"[Dedicated Server Only]\nhandles a request to make all clients wait/or stop waiting. If a time is
2754 // giving, the server will wait that long each level until it lets clients to play.\nUsage: \"$wait <on/off
2755 // or time-in-seconds>\""
2756
2757 #define GAME_DLL_INTERFACE 9
2758
2759 // DMFC Special Packet definer
2760 #define SPID_TEAMASSIGNMENT 0xE0
2761 #define SPID_CHANGETEAM 0xE1
2762 #define SPID_REQGAMESTATE 0xE2
2763 #define SPID_DMFCGAMEINFO 0xE3
2764 #define SPID_VERSIONID 0xE4
2765 #define SPID_PRECORD 0xE5
2766 #define SPID_PRECORDREQ 0xE6
2767 #define SPID_CONTROLMSG 0xE7
2768 #define SPID_NETGAMESYNC 0xE8
2769 #define SPID_NEWTEAMNAME 0xE9
2770 #define SPID_REMOTETOSERVER 0xEA
2771 #define SPID_REMOTETOCLIENT 0xEB
2772 #define SPID_SERVERREMOTEMSG 0xEC
2773 #define SPID_REMOTEKEY 0xED
2774 #define SPID_REALGAMETIME 0xEE
2775
2776 #define HUD_CALLSIGN_LEVEL_FULL 2
2777 #define HUD_CALLSIGN_LEVEL_TEAM 1
2778 #define HUD_CALLSIGN_LEVEL_NONE 0
2779
2780 #define DM_FILTER_FULL 2
2781 #define DM_FILTER_SIMPLE 1
2782 #define DM_FILTER_NONE 0
2783
2784 #define UIID_TEAMPLACEMENT 0xEEE0
2785 #define UIID_WAITFORPLAYERS 0xEEE1
2786
2787 // Uncomment the following define to put a black background on the in-game menus
2788 // #define DMFC_MENUBACKGROUND
2789
2790 #define PINFO_CLEAR -2
2791 #define PINFO_INUSE -1
2792
2793 #define MAX_STATE_SUBMENUS 64 // maximum number of state menu items a MIT_STATE menu can have
2794
2795 int GetBanPlayerList(void);
2796 char *GetBannedPlayerString(int index);
2797
2798 // Menu Function handlers
2799 void KickPlayer(int pnum);
2800 void EndMultiLevel(int i);
2801 void BanPlayer(int pnum);
2802 // Removes a ban for a player, give the ban index #
2803 void RemoveBanByIndex(int index);
2804 void BalanceTeams(int i);
2805 void SwitchAutoTeamSelect(int i);
2806 void SwitchPlayerInfo(int pnum);
2807 void ChangeTeams(int team);
2808 void SwitchTeamChange(int i);
2809 void SwitchHudPlayerNum(int i);
2810 void SaveStatsToFile(int i);
2811 void SwitchStatHUDMessages(int i);
2812 // Turns on/off Observer Mode
2813 void SwitchObserverMode(int i);
2814 // Turns on/off PiggyBack mode
2815 void SwitchPiggyBack(int pnum);
2816 // Exits the on-screen menu
2817 void MenuExitMenu(int i);
2818 // Switches on/off auto saving of the stats to file on level end
2819 void SwitchSaveStatsLevelEnd(int i);
2820 // Switches on/off auto saving of the stats to file on disconnect from the game
2821 void SwitchSaveStatsDisconnect(int i);
2822 // Switches on/off displaying the background
2823 void SwitchMenuBackground(int i);
2824 // Switches on/off displaying the netgame info
2825 void SwitchNetGameInfo(int i);
2826 // Switch the server's Max HUD Callsign level
2827 void SwitchServerHudPlayerName(int i);
2828 // Switches the death message filter
2829 void SwitchDeathMessageFilter(int i);
2830 // brings up the team config dialog for the server
2831 void OnScreenDisplayTeamConfig(int i);
2832 // Switches turning on/off displaying ship logos
2833 void SwitchShipLogoEnable(int i);
2834 // Switches turning on/off audio taunts
2835 void SwitchAudioTauntsEnable(int i);
2836 // Change the pps for a client
2837 void DecreasePacketsPerSecond(int i);
2838 void IncreasePacketsPerSecond(int i);
2839 // Rehashs the hosts.allow/deny lists
2840 void RehashAllowDenyLists(int i);
2841 void SwitchLossPingIndicator(int i);
2842
2843 /*
2844 ****************************************
2845 Remote administration
2846 ****************************************
2847 */
2848 // Initializes the remote administration system
2849 void Remote_Initialize(void);
2850 // Processes remote administration for the frame
2851 void Remote_ProcessFrame(void);
2852 // Gets the key for the given player record
2853 uint8_t *Remote_GetKey(int prec);
2854 // Enables/Disables remote administration
2855 void Remote_Enable(bool enable);
2856 // sets the administration password for the server
2857 // pass in an unencrypted password
2858 void Remote_SetPassword(char *password);
2859 // Sets a clients key
2860 void Remote_SetMyKey(uint8_t key[8]);
2861 // handles a remote command (client side)
2862 void Remote_ClientProcess(const char *command);
2863 // Lists the players logged in
2864 void Remote_ListLogins(void);
2865 // Logs a player out from being an administrator
2866 void Remote_Logout(int precnum);
2867
2868 #define MAX_RECORD_NAME 256
2869
2870 struct tRecord {
2871 char name[MAX_RECORD_NAME];
2872 char type;
2873 void *data;
2874 tRecord *next;
2875 };
2876
2877 struct tKey {
2878 char name[MAX_RECORD_NAME];
2879 tKey *next;
2880 tRecord *records;
2881 };
2882
2883 class CRegistry {
2884 public:
2885 CRegistry(const char *name);
2886 ~CRegistry();
2887 void Export();
2888 bool Import();
2889 void CreateKey(const char *name);
2890 bool LookupKey(const char *name);
2891 bool CreateRecord(const char *name, char type, void *data);
2892 tRecord *LookupRecord(const char *record, void *data);
2893 int GetDataSize(const char *record);
2894
2895 private:
2896 void Destroy(void);
2897 void DestroyKey(tKey *key);
2898 void DestroyRecord(tRecord *record);
2899 void ExportKey(tKey *key, CFILE *file);
2900 void ExportRecord(tRecord *record, CFILE *file);
2901 char *SkipWhite(char *p);
2902 char *ParseString(char *p, char *buf, int bufsize, char sdelim, char edelim);
2903 char *ParseToken(char *p, char *buf, int bufsize);
2904 char name[MAX_RECORD_NAME];
2905 tKey *root;
2906 tKey *currentkey;
2907 };
2908
2909 // Initializes the Player records
2910 void PRec_Init(void);
2911 // Frees up and closes the Player records
2912 void PRec_Close(void);
2913 // Sets up the Player records so they can be used for Multiplayer user defined stats
2914 // sizeof_user_stats : size of the struct for each player's stats
2915 // pack_callback : callback function called when data from the struct needs to be packed
2916 // into a packet. It is SUPER important that this function packs the data
2917 // in little endian format. This function gets a pointer to the struct that
2918 // needs to be packed (user_info), and a buffer in which to pack it to. This
2919 // function is to return the number of bytes it has packed.
2920 // unpack_callback : callback function called when data from the struct needs to be unpacket
2921 // from a packet. This data will be in little endian format. Returns the number of
2922 // bytes unpacked.
2923 // returns: 1 if size given was <=0 (if so all previous user stats will be removed)
2924 // 0 all went ok
2925 // -1 out of memory (all user stats memory will be freed)
2926 // -2 invalid callbacks
2927 int PRec_SetupUserPRec(int sizeof_user_stats, int (*pack_callback)(void *user_info, uint8_t *data),
2928 int (*unpack_callback)(void *user_info, uint8_t *data));
2929 // Given a pnum it will return the PRec slot of that player, or -1 if it's not a valid player
2930 int PRec_GetPlayerSlot(int pnum);
2931 // Given a PRec slot, it returns a pointer to the user stats struct, NULL if error, or PRec_SetupUserPRec
2932 // hasn't been called yet
2933 void *PRec_GetUserStats(int slot);
2934 // Returns a pointer to a player_record for the requested slot, NULL if error
2935 player_record *PRec_GetPRecord(int slot);
2936
2937 // Sets a disconnect time for a player
2938 void PRec_SetDisconnectTime(int slot, float time);
2939
2940 // Returns the PRec slot of a player who matches the given info, -1 if none
2941 // addr = network address (can be NULL)
2942 // tracker_id = Mastertracker ID (can be NULL)
2943 int PRec_FindPlayer(const char *callsign, network_address *addr, const char *tracker_id);
2944
2945 // Gets the first available free slot (STATE_EMPTY), if none are available it clears and returns
2946 // the oldest disconnected player (STATE_DISCONNECTED)
2947 int PRec_GetFreeSlot(void);
2948 // Assigns a player to a specified slot (fills in the info, and prepares the slot for action)
2949 // Do Not use this for a reconnecting player
2950 bool PRec_AssignPlayerToSlot(int pnum, int slot, player *players_array, netplayer *netplayers_array);
2951 // Reconnects a player to a STATE_DISCONNECTED slot
2952 bool PRec_ReconnectPlayerToSlot(int pnum, int slot, player *players_array, netplayer *netplayers_array);
2953 // Disconnects a player from the Player records
2954 bool PRec_DisconnectPlayer(int pnum);
2955 // Clear all the level volatile (things that reset with the change of levels) things
2956 void PRec_LevelReset(void);
2957 // Sends the Player records info to the given client
2958 void PRec_SendPRecToPlayer(int pnum);
2959 // Receives the Player records info from the server
2960 void PRec_ReceivePRecFromServer(uint8_t *data);
2961 // Sets the team of a player given the pnum
2962 void PRec_SetPlayerTeam(int pnum, int team);
2963 // Gets the team of a player given the pnum
2964 int PRec_GetPlayerTeam(int pnum);
2965 // Returns a pointer to a player_record of a player, NULL if error
2966 player_record *PRec_GetPRecordByPnum(int pnum);
2967 int translate_precptr_to_index(player_record *pr);
2968
2969 #endif