Debian Codegraph @

Descent3/gamesave.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/gamesave.h $
21 * $Revision: 16 $
22 * $Date: 7/21/99 7:17p $
23 * $Author: Chris $
24 *
25 *
26 *
27 * $Log: /DescentIII/main/gamesave.h $
28 *
29 * 16 7/21/99 7:17p Chris
30 * Fixed an attach related crash in the load/save game code
31 *
32 * 15 4/20/99 11:45a Samir
33 * added autosave
34 *
35 * 14 4/14/99 3:56a Jeff
36 * fixed case mismatch in #includes
37 *
38 * 13 3/22/99 5:12p Samir
39 * added snapshot to savegame.
40 *
41 * 12 3/08/99 11:04a Jason
42 * added versioning for texture changes
43 *
44 * 11 3/04/99 6:30p Jeff
45 * saves out current waypoint and matcens
46 *
47 * 10 1/29/99 12:47p Matt
48 * Rewrote the doorway system
49 *
50 * 9 1/21/99 11:15p Jeff
51 * pulled out some structs and defines from header files and moved them
52 * into seperate header files so that multiplayer dlls don't require major
53 * game headers, just those new headers. Side effect is a shorter build
54 * time. Also cleaned up some header file #includes that weren't needed.
55 * This affected polymodel.h, object.h, player.h, vecmat.h, room.h,
56 * manage.h and multi.h
57 *
58 * 8 1/08/99 2:55p Samir
59 * Ripped out OSIRIS1.
60 *
61 * 7 10/08/98 12:00p Kevin
62 * Demo system work
63 *
64 * 6 10/06/98 5:45p Kevin
65 * Added new configuration for demo
66 *
67 * 5 8/20/98 10:52a Samir
68 * fixed some ui probs
69 *
70 * 4 8/19/98 5:35p Samir
71 * saved triggers, spew, viseffects, weapons, room data xcept texture per
72 * face changes, one real strange bug where robots in the same room as you
73 * don't appear but fire at you.
74 *
75 * 3 8/18/98 3:05p Samir
76 * save game with no weapons or fireballs.
77 *
78 * 2 8/18/98 1:12a Samir
79 * rudimentary savegame. pretty damn buggy when loading.
80 *
81 * $NoKeywords: $
82 */
83
84 #ifndef GAMESAVE_H
85 #define GAMESAVE_Hcxx . . $ `Descent3/gamesave.h:85:9`!
86
87 #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/
88 #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/
89 #include "object.h"cxx . . $ `<file>/Descent3/object.h`/
90 #include "objinfo.h"cxx . . $ `<file>/Descent3/objinfo.h`/
91
92 #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/
93 #include "bitmap.h"cxx . . $ `<file>/lib/bitmap.h`/
94 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
95 #include "door.h"cxx . . $ `<file>/Descent3/door.h`/
96 #include "doorway.h"cxx . . $ `<file>/Descent3/doorway.h`/
97 #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/
98 #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/
99 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
100
101 #define GAMESAVE_SLOTScxx . . $ `Descent3/gamesave.h:101:9`! 8 // maximum number of savegames
102 #define GAMESAVE_DESCLENcxx . . $ `Descent3/gamesave.h:102:9`! 31 // gamesave description maximum length.
103
104 struct gs_tablescxx . . $ gs_tables# {
105 int16_t model_handlescxx . . $ gs_tables#model_handles.[MAX_POLY_MODELScxx . . $ `lib/polymodel_external.h:66:9`!];
106 int16_t obji_indicescxx . . $ gs_tables#obji_indices.[MAX_OBJECT_IDScxx . . $ `Descent3/objinfo.h:327:9`!];
107 int16_t bm_handlescxx . . $ gs_tables#bm_handles.[MAX_BITMAPScxx . . $ `lib/bitmap.h:30:9`!];
108 int16_t tex_handlescxx . . $ gs_tables#tex_handles.[MAX_TEXTUREScxx . . $ `Descent3/gametexture.h:244:9`!];
109 int16_t door_handlescxx . . $ gs_tables#door_handles.[MAX_DOORScxx . . $ `Descent3/door.h:143:9`!];
110 int16_t ship_handlescxx . . $ gs_tables#ship_handles.[MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`!];
111 int16_t wpn_handlescxx . . $ gs_tables#wpn_handles.[MAX_WEAPONScxx . . $ `Descent3/weapon.h:208:9`!];
112 };
113
114 // savegame version info.
115 // this should be handled like level file version, as to prevent invalidating old savegames
116 // please record a table of changes here.
117
118 // 0 samir-initial version
119 // 1 Added saving/loading of changed textures
120 // 2 Added correct saving and restoring of attach points
121
122 #define GAMESAVE_VERSIONcxx . . $ `Descent3/gamesave.h:122:9`! 2
123 #define GAMESAVE_OLDVERcxx . . $ `Descent3/gamesave.h:123:9`! 0 // any version before this value is obsolete.
124
125 void SaveGameDialogcxx . . $ SaveGameDialog(49f6e7a06ebc5aa8).();
126 bool LoadGameDialogcxx . . $ LoadGameDialog(c9857a73d68e59ba).(); // returns true if ok, false if canceled.
127 void QuickSaveGamecxx . . $ QuickSaveGame(49f6e7a06ebc5aa8).();
128
129 bool LoadCurrentSaveGamecxx . . $ LoadCurrentSaveGame(c9857a73d68e59ba).(); // loads savegame as specified from LoadGameDialog (false fails)
130
131 extern int Quicksave_game_slotcxx . . $ Quicksave_game_slot.; // externed so gamesequencing can reset this value starting new game.
132
133 // internal.
134
135 // loads a game from a given slot. returns a code below.
136 #define LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`! 0
137 #define LGS_FILENOTFOUNDcxx . . $ `Descent3/gamesave.h:137:9`! 1
138 #define LGS_OUTDATEDVERcxx . . $ `Descent3/gamesave.h:138:9`! 2
139 #define LGS_STARTLVLFAILEDcxx . . $ `Descent3/gamesave.h:139:9`! 3 // level failed to load or startup
140 #define LGS_MISSIONFAILEDcxx . . $ `Descent3/gamesave.h:140:9`! 4 // mission failed to load.
141 #define LGS_OBJECTSCORRUPTcxx . . $ `Descent3/gamesave.h:141:9`! 5 // object list is corrupt (or out of date with level)
142 #define LGS_CORRUPTLEVELcxx . . $ `Descent3/gamesave.h:142:9`! 6 // either level is out of date, or list is corrupted.
143
144 int LoadGameStatecxx . . $ LoadGameState(5c4306d8553b3696).(const char *pathname);
145
146 // Easy IO routines for repetitive tasks.
147
148 #define gs_WriteVectorcxx . . $ `Descent3/gamesave.h:148:9`!(_f, _v) \
149 do { \
150 cf_WriteFloat((_f), (_v).x); \
151 cf_WriteFloat((_f), (_v).y); \
152 cf_WriteFloat((_f), (_v).z); \
153 } while (0)
154 #define gs_WriteMatrixcxx . . $ `Descent3/gamesave.h:154:9`!(_f, _m) \
155 do { \
156 gs_WriteVectorcxx . . $ `Descent3/gamesave.h:148:9`!((_f), (_m).rvec); \
157 gs_WriteVectorcxx . . $ `Descent3/gamesave.h:148:9`!((_f), (_m).uvec); \
158 gs_WriteVectorcxx . . $ `Descent3/gamesave.h:148:9`!((_f), (_m).fvec); \
159 } while (0)
160 #define gs_WriteAnglecxx . . $ `Descent3/gamesave.h:160:9`!(_f, _a) cf_WriteShort(_f, (int16_t)(_a))
161 #define gs_WriteBytecxx . . $ `Descent3/gamesave.h:161:9`!(_f, _b) cf_WriteByte(_f, _b)
162 #define gs_WriteShortcxx . . $ `Descent3/gamesave.h:162:9`!(_f, _s) cf_WriteShort(_f, _s)
163 #define gs_WriteIntcxx . . $ `Descent3/gamesave.h:163:9`!(_f, _i) cf_WriteInt(_f, _i)
164 #define gs_WriteFloatcxx . . $ `Descent3/gamesave.h:164:9`!(_f, _fl) cf_WriteFloat(_f, _fl)
165 #define gs_WriteBoolcxx . . $ `Descent3/gamesave.h:165:9`!(_f, _b) cf_WriteByte(_f, _b)
166
167 #define START_VERIFY_SAVEFILEcxx . . $ `Descent3/gamesave.h:167:9`!(f) int cur_file_pos = cftell(f)
168 #define END_VERIFY_SAVEFILEcxx . . $ `Descent3/gamesave.h:168:9`!(f, s) mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "%s =%d bytes\n", s, cftell(f) - cur_file_pos)
169
170 #define gs_ReadVectorcxx . . $ `Descent3/gamesave.h:170:9`!(_f, _v) \
171 do { \
172 (_v).x = cf_ReadFloat(_f); \
173 (_v).y = cf_ReadFloat(_f); \
174 (_v).z = cf_ReadFloat(_f); \
175 } while (0)
176 #define gs_ReadMatrixcxx . . $ `Descent3/gamesave.h:176:9`!(_f, _m) \
177 do { \
178 gs_ReadVectorcxx . . $ `Descent3/gamesave.h:170:9`!((_f), (_m).rvec); \
179 gs_ReadVectorcxx . . $ `Descent3/gamesave.h:170:9`!((_f), (_m).uvec); \
180 gs_ReadVectorcxx . . $ `Descent3/gamesave.h:170:9`!((_f), (_m).fvec); \
181 } while (0)
182 #define gs_ReadAnglecxx . . $ `Descent3/gamesave.h:182:9`!(_f, _a) ((_a) = (angle)cf_ReadShort(_f))
183 #define gs_ReadBoolcxx . . $ `Descent3/gamesave.h:183:9`!(_f, _b) ((_b) = (bool)cf_ReadByte(_f))
184 #define gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(_f, _b) ((_b) = cf_ReadByte(_f))
185 #define gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(_f, _s) ((_s) = cf_ReadShort(_f))
186 #define gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(_f, _i) ((_i) = cf_ReadInt(_f))
187 #define gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(_f, _fl) ((_fl) = cf_ReadFloat(_f))
188
189 // writes out translation tables.
190 void SGSXlateTablescxx . . $ SGSXlateTables(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp);
191
192 // initializes rooms
193 void SGSRoomscxx . . $ SGSRooms(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp);
194
195 // saves out events
196 void SGSEventscxx . . $ SGSEvents(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp);
197
198 // saves out triggers
199 void SGSTriggerscxx . . $ SGSTriggers(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp);
200
201 // save viseffects
202 void SGSVisEffectscxx . . $ SGSVisEffects(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp);
203
204 // players
205 void SGSPlayerscxx . . $ SGSPlayers(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp);
206
207 // saves out objects
208 void SGSObjectscxx . . $ SGSObjects(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp);
209
210 // saves ai
211 void SGSObjAIcxx . . $ SGSObjAI(c32be398de915cb1).(CFILEcxx . . $ CFILE# *fp, const ai_framecxx . . $ ai_frame# *ai);
212
213 // saves fx
214 void SGSObjEffectscxx . . $ SGSObjEffects(b160c87ac8ed4668).(CFILEcxx . . $ CFILE# *fp, const objectcxx . . $ object# *op);
215
216 // saves script
217 //@@void SGSScript(CFILE *fp, const script_info *script);
218
219 // saves wb
220 void SGSObjWBcxx . . $ SGSObjWB(12961102d09f19c6).(CFILEcxx . . $ CFILE# *fp, objectcxx . . $ object# *op, int num_wbs);
221
222 // saves special object info
223 void SGSObjSpecialcxx . . $ SGSObjSpecial(b160c87ac8ed4668).(CFILEcxx . . $ CFILE# *fp, const objectcxx . . $ object# *op);
224
225 // load spew
226 void SGSSpewcxx . . $ SGSSpew(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp);
227
228 //@@// saves ai goals
229 //@@void SGSObjAIGoal(CFILE *fp, const goal *g);
230
231 // load matcens
232 void SGSMatcenscxx . . $ SGSMatcens(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp);
233
234 // give a description and slot number (0 to GAMESAVE_SLOTS-1)
235 bool SaveGameStatecxx . . $ SaveGameState(b7a7aa4a824b7595).(const char *pathname, const char *description);
236
237 // retreive gamesave file header info. description must be a buffer of length GAMESAVE_DESCLEN+1
238 // returns true if it's a valid savegame file. false if corrupted somehow
239 // pointer to bm_handle will return a bitmap handle to the snapshot for game. (*bm_handle) can be invalid.
240 bool GetGameStateInfocxx . . $ GetGameStateInfo(3bcbb53201fcdcb8).(const char *pathname, char *description, int *bm_handle = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
241
242 ///////////////////////////////////////////////////////////////////////////////
243 // reads in translation tables
244 int LGSXlateTablescxx . . $ LGSXlateTables(413716a422df0036).(CFILEcxx . . $ CFILE# *fp);
245
246 // loads in level's mission and level.
247 int LGSMissioncxx . . $ LGSMission(cb7559238bb26814).(const char *msnname, int level);
248
249 // initializes rooms
250 int LGSRoomscxx . . $ LGSRooms(413716a422df0036).(CFILEcxx . . $ CFILE# *fp);
251
252 // loads in and sets these events
253 int LGSEventscxx . . $ LGSEvents(413716a422df0036).(CFILEcxx . . $ CFILE# *fp);
254
255 // loads in and sets these triggers
256 int LGSTriggerscxx . . $ LGSTriggers(413716a422df0036).(CFILEcxx . . $ CFILE# *fp);
257
258 // players
259 int LGSPlayerscxx . . $ LGSPlayers(413716a422df0036).(CFILEcxx . . $ CFILE# *fp);
260
261 // loads in and sets these objects
262 int LGSObjectscxx . . $ LGSObjects(3041dee38160abc0).(CFILEcxx . . $ CFILE# *fp, int version);
263
264 // load viseffects
265 int LGSVisEffectscxx . . $ LGSVisEffects(413716a422df0036).(CFILEcxx . . $ CFILE# *fp);
266
267 // load spew
268 int LGSSpewcxx . . $ LGSSpew(413716a422df0036).(CFILEcxx . . $ CFILE# *fp);
269
270 // loads ai
271 int LGSObjAIcxx . . $ LGSObjAI(b3643b3a423eaee).(CFILEcxx . . $ CFILE# *fp, ai_framecxx . . $ ai_frame# **pai);
272
273 // saves ai goals
274 int LGSObjAIGoalcxx . . $ LGSObjAIGoal(7d4932a8fa174484).(CFILEcxx . . $ CFILE# *fp, goalcxx . . $ goal# *g);
275
276 // loads fx
277 int LGSObjEffectscxx . . $ LGSObjEffects(31a7d9c7d80230b4).(CFILEcxx . . $ CFILE# *fp, objectcxx . . $ object# *op);
278
279 // loads weapon batter info
280 int LGSObjWBcxx . . $ LGSObjWB(31a7d9c7d80230b4).(CFILEcxx . . $ CFILE# *fp, objectcxx . . $ object# *op);
281
282 // loads script
283 //@@vector *LGSScript(CFILE *fp, script_info *script, uint8_t *is_scripted, int *memsize);
284
285 // loads special object info
286 int LGSObjSpecialcxx . . $ LGSObjSpecial(31a7d9c7d80230b4).(CFILEcxx . . $ CFILE# *fp, objectcxx . . $ object# *op);
287
288 // load matcens
289 int LGSMatcenscxx . . $ LGSMatcens(413716a422df0036).(CFILEcxx . . $ CFILE# *fp);
290
291 //////////////////////////////////////////////////////////////////////////////
292 // Game Save/Load User interface
293
294 #define SAVEGAMEDLG_WIDTHcxx . . $ `Descent3/gamesave.h:294:9`! (512)
295 #define SAVEGAMEDLG_HEIGHTcxx . . $ `Descent3/gamesave.h:295:9`! (384)
296 #define SAVEGAMEDLG_Xcxx . . $ `Descent3/gamesave.h:296:9`! ((Max_window_w - SAVEGAMEDLG_WIDTH) / 2)
297 #define SAVEGAMEDLG_Ycxx . . $ `Descent3/gamesave.h:297:9`! ((Max_window_h - SAVEGAMEDLG_HEIGHT) / 2)
298 #define SAVEGAMELB_WIDTHcxx . . $ `Descent3/gamesave.h:298:9`! (32 * 14)
299 #define SAVEGAMELB_HEIGHTcxx . . $ `Descent3/gamesave.h:299:9`! (32 * 6)
300 #define SAVEGAMELB_Xcxx . . $ `Descent3/gamesave.h:300:9`! ((SAVEGAMEDLG_WIDTH - SAVEGAMELB_WIDTH) / 2)
301 #define SAVEGAMELB_Ycxx . . $ `Descent3/gamesave.h:301:9`! ((SAVEGAMEDLG_HEIGHT - SAVEGAMELB_HEIGHT + 32) / 2)
302 #define SAVEGAMEBTN_Wcxx . . $ `Descent3/gamesave.h:302:9`! 96
303 #define SAVEGAMEBTN_Xcxx . . $ `Descent3/gamesave.h:303:9`! ((SAVEGAMEDLG_WIDTH / 4) - (SAVEGAMEBTN_W / 2))
304 #define SAVEGAMEBTN_X2cxx . . $ `Descent3/gamesave.h:304:9`! ((3 * SAVEGAMEDLG_WIDTH / 4) - (SAVEGAMEBTN_W / 2))
305 #define SAVEGAMEBTN_Ycxx . . $ `Descent3/gamesave.h:305:9`! (SAVEGAMEDLG_HEIGHT - 64)
306
307 #define UID_SAVELBcxx . . $ `Descent3/gamesave.h:307:9`! 100
308 #define UID_LOADLBcxx . . $ `Descent3/gamesave.h:308:9`! 100
309
310 #endif