Debian Codegraph @

netgames/roboanarchy/roboAnarchy.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/roboanarchy/roboAnarchy.h $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003/08/26 03:59:03 $
23 * $Author: kevinb $
24 *
25 * <insert description of file here>
26 *
27 * $Log: roboAnarchy.h,v $
28 * Revision 1.1.1.1 2003/08/26 03:59:03 kevinb
29 * initial 1.5 import
30 *
31 *
32 * 28 10/21/99 3:20p Kevin
33 * Macintosh merge
34 *
35 * 27 5/12/99 11:28a Jeff
36 * added sourcesafe comment block
37 *
38 * $NoKeywords: $
39 */
40
41 #ifndef __DMFC_APP_H_
42 #define __DMFC_APP_H_
43
44 #include "osiris_share.h"
45 #include "d3events.h"
46
47 // Setup and processing functions
48 void AnarchyGameInit(int teams);
49 void AnarchyGameClose(void);
50
51 void OnKeypress(int key);
52 void OnHUDInterval(void);
53 void OnInterval(void);
54 void OnClientPlayerKilled(object *killer_obj, int victim_pnum);
55 void OnClientPlayerEntersGame(int player_num);
56 void OnClientLevelStart(void);
57 void OnClientLevelEnd(void);
58 void OnServerGameCreated(void);
59 void OnPLRInterval(void);
60 void OnPLRInit(void);
61 void OnSaveStatsToFile(void);
62 void OnLevelEndSaveStatsToFile(void);
63 void OnDisconnectSaveStatsToFile(void);
64 void OnPrintScores(int level);
65 extern IDMFC *DMFCBase;
66
67 /*************************************************************************************************
68 *The following functions and declaration are needed to connect the DLL to the game. These must *
69 *stay here and must call the functions that are in them. You can not delete from here, but you *
70 *can add to it no problem
71 **
72 *************************************************************************************************
73 */
74 // These next two function prototypes MUST appear in the extern "C" block if called
75 // from a CPP file.
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
79 DLLEXPORT void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_use);
80 DLLEXPORT void DLLFUNCCALL DLLGameCall(int eventnum, dllinfo *data);
81 DLLEXPORT void DLLFUNCCALL DLLGameClose();
82 DLLEXPORT void DLLFUNCCALL DLLGetGameInfo(tDLLOptions *options);
83 DLLEXPORT int DLLFUNCCALL GetGOScriptID(const char *name, uint8_t isdoor);
84 DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id);
85 DLLEXPORT void DLLFUNCCALL DestroyInstance(int id, void *ptr);
86 DLLEXPORT int16_t DLLFUNCCALL CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfo *data);
87 DLLEXPORT int DLLFUNCCALL SaveRestoreState(void *file_ptr, uint8_t saving_state);
88 #ifdef __cplusplus
89 }
90 #endif
91
92
93 // The main entry point where the game calls the dll
94 void DLLFUNCCALL DLLGameCall(int eventnum, dllinfo *data) {
95 if ((eventnum < EVT_CLIENT_INTERVAL) && (DMFCBase->GetLocalRole() != LR_SERVER)) {
96 return;
97 }
98
99 DMFCBase->TranslateEvent(eventnum, data);
100 }
101
102 // GetGOScriptID
103 // Purpose:
104 // Given the name of the object (from it's pagename), this function will search through it's
105 // list of General Object Scripts for a script with a matching name (to see if there is a script
106 // for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID
107 // is to be returned back to Descent 3. This ID will be used from here on out for all future
108 // interaction with the DLL. Since doors are not part of the generic object's, it's possible
109 // for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER
110 // or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a
111 // door, else it is a 0. The return value is the unique identifier, else -1 if the script
112 // does not exist in the DLL.
113 int DLLFUNCCALL GetGOScriptID(const char *name, uint8_t isdoor) { return -1; }
114
115 // CreateInstance
116 // Purpose:
117 // Given an ID from a call to GetGOScriptID(), this function will create a new instance for that
118 // particular script (by allocating and initializing memory, etc.). A pointer to this instance
119 // is to be returned back to Descent 3. This pointer will be passed around, along with the ID
120 // for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error.
121 void DLLFUNCCALLPTR CreateInstance(int id) { return NULL; }
122
123 // DestroyInstance
124 // Purpose:
125 // Given an ID, and a pointer to a particular instance of a script, this function will delete and
126 // destruct all information associated with that script, so it will no longer exist.
127 void DLLFUNCCALL DestroyInstance(int id, void *ptr) {}
128
129 // CallInstanceEvent
130 // Purpose:
131 // Given an ID, a pointer to a script instance, an event and a pointer to the struct of
132 // information about the event, this function will translate who this event belongs to and
133 // passes the event to that instance of the script to be handled. Return a combination of
134 // CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the
135 // event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level
136 // script, mission script, and finally default script). If CONTINUE_CHAIN is not specified,
137 // than the chain is broken and those scripts of lower priority will never get the event. Return
138 // CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into
139 // the game for that event. This only pertains to certain events. If the chain continues
140 // after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority
141 // scripts return value.
142 int16_t DLLFUNCCALL CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfo *data) {
143 return CONTINUE_CHAIN | CONTINUE_DEFAULT;
144 }
145
146 // SaveRestoreState
147 // Purpose:
148 // This function is called when Descent 3 is saving or restoring the game state. In this function
149 // you should save/restore any global data that you want preserved through load/save (which includes
150 // demos). You must be very careful with this function, corrupting the file (reading or writing too
151 // much or too little) may be hazardous to the game (possibly making it impossible to restore the
152 // state). It would be best to use version information to keep older versions of saved states still
153 // able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE
154 // TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should
155 // write data to the file_ptr, 0 when you should read in the data.
156 int DLLFUNCCALL SaveRestoreState(void *file_ptr, uint8_t saving_state) { return 0; }
157
158 #endif