| 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/loadstate.cpp $ |
| 21 | * $Revision: 74 $ |
| 22 | * $Date: 9/05/01 12:19p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Load a saved game |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/loadstate.cpp $ |
| 28 | * |
| 29 | * 74 9/05/01 12:19p Matt |
| 30 | * When loading a saved game, load the add-on data before the level so the |
| 31 | * textures get mapped properly. |
| 32 | * |
| 33 | * 73 4/21/00 3:23p Matt |
| 34 | * Check for bad vis effect structure on load, which probably means a game |
| 35 | * saved with a prior to version 1.3. If found, convert old struct to new |
| 36 | * struct. |
| 37 | * |
| 38 | * 72 4/19/00 5:07p Matt |
| 39 | * From Duane for 1.4 |
| 40 | * Added checks, asserts, and fixes for bad return values |
| 41 | * |
| 42 | * 71 4/07/00 5:51p Matt |
| 43 | * Do id translation on dummy objects that are really generics, etc. |
| 44 | * |
| 45 | * 70 3/20/00 12:13p Matt |
| 46 | * Merge of Duane's post-1.3 changes. |
| 47 | * Fixed mem leak. |
| 48 | * Added check for object type. |
| 49 | * |
| 50 | * 69 9/18/99 9:23p Jeff |
| 51 | * re initialize objects' position history (for motion blur) |
| 52 | * |
| 53 | * 68 7/22/99 11:47a Chris |
| 54 | * |
| 55 | * 67 7/21/99 7:17p Chris |
| 56 | * Fixed an attach related crash in the load/save game code |
| 57 | * |
| 58 | * 66 7/08/99 10:30a Kevin |
| 59 | * when loading a save game >level 4 from a minimal install, don't ask for |
| 60 | * CD1 |
| 61 | * |
| 62 | * 65 5/21/99 11:15p Samir |
| 63 | * savegames save hud timer and special text states. restore too. |
| 64 | * |
| 65 | * 64 5/20/99 2:48a Matt |
| 66 | * Auto-waypoints now stored & used per player. Manual waypoints will all |
| 67 | * players, once Jason makes it work. |
| 68 | * |
| 69 | * 63 5/17/99 10:38a Samir |
| 70 | * reset player ship and reset camera views before starting new level. may |
| 71 | * fix some sequencing problems with ship reticle and inventory too. |
| 72 | * |
| 73 | * 62 5/12/99 6:02p Jeff |
| 74 | * flip order of saving/loading objects and players |
| 75 | * |
| 76 | * 61 5/12/99 12:25p Kevin |
| 77 | * save & restore Current_mission.game_state_flags |
| 78 | * |
| 79 | * 60 5/12/99 11:40a Matt |
| 80 | * Changed some arrays to be malloc'd instead of declared locally on the |
| 81 | * stack, because the Mac limits local data to 32K. |
| 82 | * |
| 83 | * 59 5/10/99 10:22p Ardussi |
| 84 | * changes to compile on Mac |
| 85 | * |
| 86 | * 58 5/06/99 6:11p Kevin |
| 87 | * fixes for save/load game syste. Also require CD again and added some |
| 88 | * heat.net stuff |
| 89 | * |
| 90 | * 57 4/30/99 3:03p Kevin |
| 91 | * improved times restored count |
| 92 | * |
| 93 | * 56 4/29/99 11:25a Kevin |
| 94 | * Added room damage to save game |
| 95 | * |
| 96 | * 55 4/28/99 2:14a Samir |
| 97 | * save and load Game messages in savegame. |
| 98 | * |
| 99 | * 54 4/23/99 10:23p Kevin |
| 100 | * Fixed savegame doorways bug! |
| 101 | * |
| 102 | * 53 4/23/99 8:28p Kevin |
| 103 | * trying to get doors working in save/load games |
| 104 | * |
| 105 | * 52 4/23/99 7:33p Kevin |
| 106 | * save weather effects and reset the HUD to show the correct ship |
| 107 | * |
| 108 | * 51 4/23/99 4:50p Jeff |
| 109 | * fixed page in polymodel problem |
| 110 | * |
| 111 | * 50 4/22/99 4:13p Matt |
| 112 | * Deleted sounds array from the object struct, since it was never used. |
| 113 | * |
| 114 | * 49 4/16/99 12:33a Matt |
| 115 | * Disable Soar on non-Windows systems. |
| 116 | * |
| 117 | * 48 4/15/99 5:41p Samir |
| 118 | * save current music region and restore it. |
| 119 | * |
| 120 | * 47 4/15/99 1:40a Jeff |
| 121 | * changes for linux compile |
| 122 | * |
| 123 | * 46 4/14/99 2:51a Jeff |
| 124 | * fixed some case mismatched #includes |
| 125 | * |
| 126 | * 45 4/05/99 10:54a Matt |
| 127 | * Added auto-waypoint system |
| 128 | * |
| 129 | * 44 3/23/99 6:09p Kevin |
| 130 | * Marker text saved |
| 131 | * |
| 132 | * 43 3/23/99 12:33p Kevin |
| 133 | * More post level results improvements |
| 134 | * |
| 135 | * 42 3/22/99 5:12p Samir |
| 136 | * added snapshot to savegame. |
| 137 | * |
| 138 | * 41 3/11/99 9:09p Jeff |
| 139 | * fixed remaining known bugs in demo system (DemoWriteObjCreate being |
| 140 | * called twice and </<= problems with |
| 141 | * Highest_room_index/Highest_object_index). |
| 142 | * |
| 143 | * 40 3/10/99 6:20p Jeff |
| 144 | * many fixes to demo system. Fixed IGC so cameras move...fixed osiris to |
| 145 | * be restored correctly, and it handles errors on restore |
| 146 | * |
| 147 | * 39 3/10/99 2:25p Kevin |
| 148 | * Save/Load and Demo file fixes |
| 149 | * |
| 150 | * 38 3/08/99 11:05a Jason |
| 151 | * added saving/loading of texture changes |
| 152 | * |
| 153 | * 37 3/04/99 6:58p Jeff |
| 154 | * fixed microwave assert |
| 155 | * |
| 156 | * 36 3/04/99 6:30p Jeff |
| 157 | * saves out current waypoint and matcens |
| 158 | * |
| 159 | * 35 3/03/99 7:20p Jeff |
| 160 | * save/restore some ai path information |
| 161 | * |
| 162 | * 34 3/02/99 6:39p Jeff |
| 163 | * level goals working in save/load game |
| 164 | * |
| 165 | * 33 3/02/99 4:42p Jeff |
| 166 | * Fixed inventory save/load |
| 167 | * |
| 168 | * 32 3/02/99 1:48p Kevin |
| 169 | * Fixed collision with external rooms |
| 170 | * |
| 171 | * 31 3/01/99 9:03p Kevin |
| 172 | * OEM Beta 4 |
| 173 | * |
| 174 | * 30 3/01/99 11:41a Kevin |
| 175 | * More progress... |
| 176 | * |
| 177 | * 29 2/28/99 10:50p Kevin |
| 178 | * |
| 179 | * $NoKeywords: $ |
| 180 | */ |
| 181 | |
| 182 | #include "gamesave.h"cxx . . $ `<file>/Descent3/gamesave.h`/ |
| 183 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 184 | #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/ |
| 185 | #include "Mission.h"cxx . . $ `<file>/Descent3/Mission.h`/ |
| 186 | #include "gamesequence.h"cxx . . $ `<file>/Descent3/gamesequence.h`/ |
| 187 | #include "gameevent.h"cxx . . $ `<file>/Descent3/gameevent.h`/ |
| 188 | #include "gameloop.h"cxx . . $ `<file>/Descent3/gameloop.h`/ |
| 189 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 190 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 191 | #include "objinfo.h"cxx . . $ `<file>/Descent3/objinfo.h`/ |
| 192 | #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/ |
| 193 | #include "bitmap.h"cxx . . $ `<file>/lib/bitmap.h`/ |
| 194 | #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/ |
| 195 | #include "door.h"cxx . . $ `<file>/Descent3/door.h`/ |
| 196 | #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/ |
| 197 | #include "soar.h"cxx . . $ `<file>/Descent3/soar.h`/ |
| 198 | #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/ |
| 199 | #include "vclip.h"cxx . . $ `<file>/Descent3/vclip.h`/ |
| 200 | #include "viseffect.h"cxx . . $ `<file>/Descent3/viseffect.h`/ |
| 201 | #include "room.h"cxx . . $ `<file>/Descent3/room.h`/ |
| 202 | #include "trigger.h"cxx . . $ `<file>/Descent3/trigger.h`/ |
| 203 | #include "spew.h"cxx . . $ `<file>/Descent3/spew.h`/ |
| 204 | #include "doorway.h"cxx . . $ `<file>/Descent3/doorway.h`/ |
| 205 | #include "AIMain.h"cxx . . $ `<file>/Descent3/AIMain.h`/ |
| 206 | #include "mem.h"cxx . . $ `<file>/mem/mem.h`/ |
| 207 | #include "osiris_dll.h"cxx . . $ `<file>/Descent3/osiris_dll.h`/ |
| 208 | #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/ |
| 209 | #include <string.h> |
| 210 | #include "levelgoal.h"cxx . . $ `<file>/Descent3/levelgoal.h`/ |
| 211 | #include "aistruct.h"cxx . . $ `<file>/Descent3/aistruct.h`/ |
| 212 | #include "matcen.h"cxx . . $ `<file>/Descent3/matcen.h`/ |
| 213 | #include "pilot.h"cxx . . $ `<file>/Descent3/pilot.h`/ |
| 214 | #include "marker.h"cxx . . $ `<file>/Descent3/marker.h`/ |
| 215 | #include "d3music.h"cxx . . $ `<file>/Descent3/d3music.h`/ |
| 216 | #include "weather.h"cxx . . $ `<file>/Descent3/weather.h`/ |
| 217 | #include "cockpit.h"cxx . . $ `<file>/Descent3/cockpit.h`/ |
| 218 | #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/ |
| 219 | |
| 220 | #include <algorithm> |
| 221 | |
| 222 | extern void PageInAllDatacxx . . $ PageInAllData(49f6e7a06ebc5aa8).(); |
| 223 | |
| 224 | // dynamically allocated to be efficient (only needed during save/load) |
| 225 | |
| 226 | static int LGSSnapshotcxx . . $ LGSSnapshot(413716a422df0036).(CFILEcxx . . $ CFILE# *fp); |
| 227 | static void IncreaseRestoreCountcxx . . $ IncreaseRestoreCount(85c52e162fed56f9).(const char *file); |
| 228 | |
| 229 | int Times_game_restoredcxx . . $ Times_game_restored. = 0; |
| 230 | // static gs_tables *gs_Xlates = NULL; |
| 231 | |
| 232 | gs_tablescxx . . $ gs_tables# *gs_Xlatescxx . . $ gs_Xlates. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 233 | // int Gamesave_read_version=0; |
| 234 | |
| 235 | void IncreaseRestoreCountcxx . . $ IncreaseRestoreCount(85c52e162fed56f9).(const char *file) { |
| 236 | // Open the file up in read more, read the current count, then incease it |
| 237 | // and write the increased value back out. |
| 238 | |
| 239 | char countpath[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`! * 2]; |
| 240 | CFILEcxx . . $ CFILE# *cfp; |
| 241 | |
| 242 | strcpy(countpath, file); |
| 243 | strcat(countpath, ".cnt"); |
| 244 | |
| 245 | cfp = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(countpathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb"); |
| 246 | if (cfp) { |
| 247 | Times_game_restoredcxx . . $ Times_game_restored. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(cfp); |
| 248 | cfclosecxx . . $ cfclose(3639e799710acb68).(cfp); |
| 249 | } else { |
| 250 | Times_game_restoredcxx . . $ Times_game_restored. = 0; |
| 251 | } |
| 252 | Times_game_restoredcxx . . $ Times_game_restored.++; |
| 253 | |
| 254 | cfp = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(countpathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wb"); |
| 255 | if (cfp) { |
| 256 | cf_WriteIntcxx . . $ cf_WriteInt(966989f25543eb13).(cfp, Times_game_restoredcxx . . $ Times_game_restored.); |
| 257 | cfclosecxx . . $ cfclose(3639e799710acb68).(cfp); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | extern bool IsRestoredGamecxx . . $ IsRestoredGame.; |
| 262 | /////////////////////////////////////////////////////////////////////////////// |
| 263 | // loads a game from a given slot. |
| 264 | int LoadGameStatecxx . . $ LoadGameState(5c4306d8553b3696).(const char *pathname) { |
| 265 | CFILEcxx . . $ CFILE# *fp; |
| 266 | int retval = LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 267 | char desc[GAMESAVE_DESCLENcxx . . $ `Descent3/gamesave.h:102:9`! + 1]; |
| 268 | char path[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 269 | uint16_tcxx . . $ uint16_t# version; |
| 270 | uint16_tcxx . . $ uint16_t# curlevel; |
| 271 | int16_t pending_music_region; |
| 272 | IsRestoredGamecxx . . $ IsRestoredGame. = true; |
| 273 | // load in stuff |
| 274 | fp = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(pathnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb"); |
| 275 | if (!fp) { |
| 276 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 277 | return LGS_FILENOTFOUNDcxx . . $ `Descent3/gamesave.h:137:9`!; |
| 278 | } |
| 279 | |
| 280 | START_VERIFY_SAVEFILEcxx . . $ `Descent3/gamesave.h:167:9`!(fp); |
| 281 | gs_Xlatescxx . . $ gs_Xlates. = new gs_tablescxx . . $ gs_tables#; |
| 282 | |
| 283 | // read in header and do version check. |
| 284 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)desc, sizeof(desc), fp); |
| 285 | version = (uint16_tcxx . . $ uint16_t#)cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 286 | if (version < GAMESAVE_OLDVERcxx . . $ `Descent3/gamesave.h:123:9`!) { |
| 287 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 288 | retval = LGS_OUTDATEDVERcxx . . $ `Descent3/gamesave.h:138:9`!; |
| 289 | goto loadsg_error; |
| 290 | } |
| 291 | |
| 292 | retval = LGSSnapshotcxx . . $ LGSSnapshot(413716a422df0036).(fp); // read and clear snapshot. |
| 293 | if (retval > 0) { |
| 294 | bm_FreeBitmapcxx . . $ bm_FreeBitmap(d4f767463ce0a6b3).(retval); |
| 295 | } |
| 296 | |
| 297 | // Gamesave_read_version=version; |
| 298 | |
| 299 | // read translation tables |
| 300 | retval = LGSXlateTablescxx . . $ LGSXlateTables(413716a422df0036).(fp); |
| 301 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 302 | goto loadsg_error; |
| 303 | // read in gamemode info. |
| 304 | |
| 305 | // read in mission level info. |
| 306 | curlevel = (uint16_tcxx . . $ uint16_t#)cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 307 | cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(path, sizeof(path), fp); |
| 308 | |
| 309 | if ((curlevel > 4) && (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(path, "d3.mn3") == 0)) { |
| 310 | strcpy(path, "d3_2.mn3"); |
| 311 | } |
| 312 | |
| 313 | // must load mission and initialize level before reading in other data. |
| 314 | retval = LGSMissioncxx . . $ LGSMission(cb7559238bb26814).(path, curlevel); |
| 315 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 316 | goto loadsg_error; |
| 317 | |
| 318 | Current_missioncxx . . $ Current_mission..game_state_flagscxx . . $ tMission#game_state_flags. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 319 | // Increase count for how many times this file was restored |
| 320 | IncreaseRestoreCountcxx . . $ IncreaseRestoreCount(85c52e162fed56f9).(pathname); |
| 321 | |
| 322 | // read in information after level's been loaded. |
| 323 | Gametimecxx . . $ Gametime. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 324 | FrameCountcxx . . $ FrameCount. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 325 | Current_waypointcxx . . $ Current_waypoint. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 326 | pending_music_region = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 327 | D3MusicSetRegioncxx . . $ D3MusicSetRegion(472b8ebd11b2ca81).(pending_music_region); |
| 328 | |
| 329 | // Times_game_restored = cf_ReadInt(fp); |
| 330 | // Read Weather |
| 331 | { |
| 332 | int weather_size = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 333 | if (weather_size != sizeof(Weathercxx . . $ Weather.)) { |
| 334 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 335 | retval = LGS_OUTDATEDVERcxx . . $ `Descent3/gamesave.h:138:9`!; |
| 336 | goto loadsg_error; |
| 337 | } |
| 338 | } |
| 339 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)&Weathercxx . . $ Weather., sizeof(Weathercxx . . $ Weather.), fp); |
| 340 | |
| 341 | // Restore active doorways |
| 342 | { |
| 343 | int num_active_dw = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 344 | Num_active_doorwayscxx . . $ Num_active_doorways. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 345 | |
| 346 | for (int d = 0; d < num_active_dw; d++) { |
| 347 | Active_doorwayscxx . . $ Active_doorways.[d] = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | // read in room info |
| 352 | retval = LGSRoomscxx . . $ LGSRooms(413716a422df0036).(fp); |
| 353 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 354 | goto loadsg_error; |
| 355 | |
| 356 | // read in trigger info |
| 357 | retval = LGSTriggerscxx . . $ LGSTriggers(413716a422df0036).(fp); |
| 358 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 359 | goto loadsg_error; |
| 360 | |
| 361 | // read in object info. |
| 362 | retval = LGSObjectscxx . . $ LGSObjects(3041dee38160abc0).(fp, version); |
| 363 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 364 | goto loadsg_error; |
| 365 | |
| 366 | // read in players info |
| 367 | retval = LGSPlayerscxx . . $ LGSPlayers(413716a422df0036).(fp); |
| 368 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 369 | goto loadsg_error; |
| 370 | |
| 371 | // read in matcen info. |
| 372 | retval = LGSMatcenscxx . . $ LGSMatcens(413716a422df0036).(fp); |
| 373 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 374 | goto loadsg_error; |
| 375 | |
| 376 | // read in viseffecsts |
| 377 | retval = LGSVisEffectscxx . . $ LGSVisEffects(413716a422df0036).(fp); |
| 378 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 379 | goto loadsg_error; |
| 380 | |
| 381 | // read in spew |
| 382 | retval = LGSSpewcxx . . $ LGSSpew(413716a422df0036).(fp); |
| 383 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 384 | goto loadsg_error; |
| 385 | |
| 386 | // Load OSIRIS Stuff |
| 387 | if (!Osiris_RestoreSystemStatecxx . . $ Osiris_RestoreSystemState(254217fab7598d49).(fp)) { |
| 388 | goto loadsg_error; |
| 389 | } |
| 390 | |
| 391 | // Load Level goal info |
| 392 | Level_goalscxx . . $ Level_goals..LoadLevelGoalInfocxx . . $ levelgoals#LoadLevelGoalInfo(254217fab7598d49).(fp); |
| 393 | |
| 394 | // read in game messages for console. (must occur AFTER players are read in!!!) |
| 395 | LGSGameMessagescxx . . $ LGSGameMessages(3639e799710acb68).(fp); |
| 396 | |
| 397 | // loads and restores hud state. |
| 398 | if (!LGSHudStatecxx . . $ LGSHudState(254217fab7598d49).(fp)) { |
| 399 | retval = LGS_OBJECTSCORRUPTcxx . . $ `Descent3/gamesave.h:141:9`!; |
| 400 | goto loadsg_error; |
| 401 | } |
| 402 | |
| 403 | loadsg_error: |
| 404 | delete gs_Xlatescxx . . $ gs_Xlates.; |
| 405 | |
| 406 | END_VERIFY_SAVEFILEcxx . . $ `Descent3/gamesave.h:168:9`!(fp, "Total load"); |
| 407 | cfclosecxx . . $ cfclose(3639e799710acb68).(fp); |
| 408 | |
| 409 | // Page everything in here! |
| 410 | PageInAllDatacxx . . $ PageInAllData(49f6e7a06ebc5aa8).(); |
| 411 | |
| 412 | IncrementPilotRestoredGamesForMissioncxx . . $ IncrementPilotRestoredGamesForMission(6dcf1a44d382ef6d).(&Current_pilotcxx . . $ Current_pilot., Current_missioncxx . . $ Current_mission..namecxx . . $ tMission#name.); |
| 413 | |
| 414 | return retval; |
| 415 | } |
| 416 | |
| 417 | // retreive gamesave file header info. description must be a buffer of length GAMESAVE_DESCLEN+1 |
| 418 | // returns true if it's a valid savegame file. false if corrupted somehow |
| 419 | bool GetGameStateInfocxx . . $ GetGameStateInfo(3bcbb53201fcdcb8).(const char *pathname, char *description, int *bm_handle) { |
| 420 | CFILEcxx . . $ CFILE# *fp; |
| 421 | int bitmap; |
| 422 | char desc[GAMESAVE_DESCLENcxx . . $ `Descent3/gamesave.h:102:9`! + 1]; |
| 423 | |
| 424 | fp = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(pathnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rb"); |
| 425 | if (!fp) |
| 426 | return false; |
| 427 | |
| 428 | if (!cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)desc, GAMESAVE_DESCLENcxx . . $ `Descent3/gamesave.h:102:9`! + 1, fp)) { |
| 429 | strcpy(description, TXT_ILLEGALSAVEGAMEcxx . . $ `Descent3/stringtable.h:364:9`!); |
| 430 | goto savesg_error; |
| 431 | } |
| 432 | |
| 433 | strcpy(description, desc); |
| 434 | |
| 435 | if (bm_handle) { |
| 436 | cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); // skip version. |
| 437 | bitmap = LGSSnapshotcxx . . $ LGSSnapshot(413716a422df0036).(fp); |
| 438 | *bm_handle = bitmap; |
| 439 | } |
| 440 | |
| 441 | cfclosecxx . . $ cfclose(3639e799710acb68).(fp); |
| 442 | return true; |
| 443 | |
| 444 | savesg_error: |
| 445 | cfclosecxx . . $ cfclose(3639e799710acb68).(fp); |
| 446 | return false; |
| 447 | } |
| 448 | |
| 449 | ////////////////////////////////////////////////////////////////////////////// |
| 450 | #define BUILD_XLATE_TABLEcxx . . $ `Descent3/loadstate.cpp:450:9`!(_table, _maxtable, _fn) \ |
| 451 | do { \ |
| 452 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, num); \ |
| 453 | for (i = 0; i < num; i++) { \ |
| 454 | cf_ReadString(name, sizeof(name), fp); \ |
| 455 | index = _fn(name); \ |
| 456 | _table[i] = (index == -1) ? 0 : index; \ |
| 457 | } \ |
| 458 | for (; i < _maxtable; i++) \ |
| 459 | _table[i] = 0; \ |
| 460 | } while (0) |
| 461 | |
| 462 | #define BUILD_MINI_XLATE_TABLEcxx . . $ `Descent3/loadstate.cpp:462:9`!(_table, _fn) \ |
| 463 | memset(_table, 0, sizeof(_table)); \ |
| 464 | do { \ |
| 465 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, i); \ |
| 466 | cf_ReadString(name, sizeof(name), fp); \ |
| 467 | if (i == -1 && name[0] == 0) \ |
| 468 | break; \ |
| 469 | index = _fn(name); \ |
| 470 | _table[i] = (index == -1) ? 0 : index; \ |
| 471 | } while (1) |
| 472 | |
| 473 | // reads in translation tables |
| 474 | int LGSXlateTablescxx . . $ LGSXlateTables(413716a422df0036).(CFILEcxx . . $ CFILE# *fp) { |
| 475 | START_VERIFY_SAVEFILEcxx . . $ `Descent3/gamesave.h:167:9`!(fp); |
| 476 | int retval = LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 477 | int16_t i, num, index; |
| 478 | char name[64]; |
| 479 | |
| 480 | // load object info translation table |
| 481 | BUILD_XLATE_TABLEcxx . . $ `Descent3/loadstate.cpp:450:9`!(gs_Xlates->obji_indices, MAX_OBJECT_IDScxx . . $ `Descent3/objinfo.h:327:9`!, FindObjectIDName); |
| 482 | |
| 483 | // load polymodel translation list. |
| 484 | BUILD_XLATE_TABLEcxx . . $ `Descent3/loadstate.cpp:450:9`!(gs_Xlates->model_handles, MAX_POLY_MODELScxx . . $ `lib/polymodel_external.h:66:9`!, FindPolyModelName); |
| 485 | |
| 486 | // load doar translation list. |
| 487 | BUILD_XLATE_TABLEcxx . . $ `Descent3/loadstate.cpp:450:9`!(gs_Xlates->door_handles, MAX_DOORScxx . . $ `Descent3/door.h:143:9`!, FindDoorName); |
| 488 | |
| 489 | // load ship translation list. |
| 490 | BUILD_XLATE_TABLEcxx . . $ `Descent3/loadstate.cpp:450:9`!(gs_Xlates->ship_handles, MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`!, FindShipName); |
| 491 | |
| 492 | // build weapon translation list |
| 493 | BUILD_XLATE_TABLEcxx . . $ `Descent3/loadstate.cpp:450:9`!(gs_Xlates->wpn_handles, MAX_WEAPONScxx . . $ `Descent3/weapon.h:208:9`!, FindWeaponName); |
| 494 | |
| 495 | // read in limited texture name list. |
| 496 | BUILD_XLATE_TABLEcxx . . $ `Descent3/loadstate.cpp:450:9`!(gs_Xlates->tex_handles, MAX_TEXTUREScxx . . $ `Descent3/gametexture.h:244:9`!, FindTextureName); |
| 497 | |
| 498 | // read in limited bitmap name list. this is a slightly diff format than above to save space |
| 499 | BUILD_MINI_XLATE_TABLEcxx . . $ `Descent3/loadstate.cpp:462:9`!(gs_Xlates->bm_handles, bm_FindBitmapName); |
| 500 | |
| 501 | END_VERIFY_SAVEFILEcxx . . $ `Descent3/gamesave.h:168:9`!(fp, "Xlate load"); |
| 502 | return retval; |
| 503 | } |
| 504 | |
| 505 | // loads in level's mission and level. |
| 506 | int LGSMissioncxx . . $ LGSMission(cb7559238bb26814).(const char *msnname, int level) { |
| 507 | // we will free the mission. |
| 508 | // Free any game objects/etc that needs to be done when ending a level here. |
| 509 | FreeScriptsForLevelcxx . . $ FreeScriptsForLevel(49f6e7a06ebc5aa8).(); |
| 510 | |
| 511 | Osiris_DisableCreateEventscxx . . $ Osiris_DisableCreateEvents(49f6e7a06ebc5aa8).(); |
| 512 | if (LoadMissioncxx . . $ LoadMission(c5f7da30cbc0f4e9).((const char *)msnname)) { |
| 513 | SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(level); |
| 514 | Player_numcxx . . $ Player_num. = 0; // Reset player num |
| 515 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index. = FindShipNamecxx . . $ FindShipName(5c4306d8553b3696).(DEFAULT_SHIPcxx . . $ `Descent3/ship.h:127:9`!); |
| 516 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Players[Player_num].ship_index != -1); |
| 517 | |
| 518 | // Load any addon data |
| 519 | mng_LoadAddonPagescxx . . $ mng_LoadAddonPages(49f6e7a06ebc5aa8).(); |
| 520 | |
| 521 | InitPlayerNewShipcxx . . $ InitPlayerNewShip(3e454b8ccf442868).(Player_numcxx . . $ Player_num., INVRESET_ALLcxx . . $ `Descent3/Inventory.h:201:9`!); |
| 522 | InitCameraViewscxx . . $ InitCameraViews(b45ddcbc8423892c).(1); // Turn off all camera views, including rear views |
| 523 | |
| 524 | if (!LoadAndStartCurrentLevelcxx . . $ LoadAndStartCurrentLevel(c9857a73d68e59ba).()) { |
| 525 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 526 | Osiris_EnableCreateEventscxx . . $ Osiris_EnableCreateEvents(49f6e7a06ebc5aa8).(); |
| 527 | return LGS_STARTLVLFAILEDcxx . . $ `Descent3/gamesave.h:139:9`!; |
| 528 | } |
| 529 | } else { |
| 530 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 531 | Osiris_EnableCreateEventscxx . . $ Osiris_EnableCreateEvents(49f6e7a06ebc5aa8).(); |
| 532 | return LGS_MISSIONFAILEDcxx . . $ `Descent3/gamesave.h:140:9`!; |
| 533 | } |
| 534 | Osiris_EnableCreateEventscxx . . $ Osiris_EnableCreateEvents(49f6e7a06ebc5aa8).(); |
| 535 | // mng_LoadAddonPages (); |
| 536 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 537 | } |
| 538 | |
| 539 | extern uint8_tcxx . . $ uint8_t# AutomapVisMapcxx . . $ AutomapVisMap.[MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!]; |
| 540 | |
| 541 | // initializes rooms |
| 542 | int LGSRoomscxx . . $ LGSRooms(413716a422df0036).(CFILEcxx . . $ CFILE# *fp) { |
| 543 | int retval = LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 544 | int16_t i, p, highest_index; |
| 545 | |
| 546 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, highest_index); |
| 547 | if (highest_index != (int16_t)Highest_room_indexcxx . . $ Highest_room_index.) { |
| 548 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 549 | return LGS_CORRUPTLEVELcxx . . $ `Descent3/gamesave.h:142:9`!; |
| 550 | } |
| 551 | |
| 552 | int16_t num_rooms; |
| 553 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, num_rooms); |
| 554 | |
| 555 | for (i = 0; i < num_rooms; i++) { |
| 556 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, AutomapVisMap[i]); |
| 557 | } |
| 558 | |
| 559 | for (i = 0; i <= highest_index; i++) { |
| 560 | uint8_tcxx . . $ uint8_t# used; |
| 561 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, used); |
| 562 | if (used) { |
| 563 | // reset lists |
| 564 | Roomscxx . . $ Rooms.[i].objectscxx . . $ room#objects. = -1; |
| 565 | Roomscxx . . $ Rooms.[i].vis_effectscxx . . $ room#vis_effects. = -1; |
| 566 | |
| 567 | // we need to save some room info out. |
| 568 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, Rooms[i].flags); |
| 569 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, Rooms[i].pulse_time); |
| 570 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, Rooms[i].pulse_offset); |
| 571 | gs_ReadVectorcxx . . $ `Descent3/gamesave.h:170:9`!(fp, Rooms[i].wind); |
| 572 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, Rooms[i].last_render_time); |
| 573 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, Rooms[i].fog_depth); |
| 574 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, Rooms[i].fog_r); |
| 575 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, Rooms[i].fog_g); |
| 576 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, Rooms[i].fog_b); |
| 577 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, Rooms[i].damage); |
| 578 | // gs_ReadInt(fp, Rooms[i].objects); |
| 579 | //?? gs_WriteFloat(fp, Rooms[i].ambient_sound); // need to save an index of sounds. |
| 580 | |
| 581 | // Find out about texture changes |
| 582 | // if (Gamesave_read_version>=1) |
| 583 | //{ |
| 584 | int num_changed = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 585 | |
| 586 | for (int t = 0; t < num_changed; t++) { |
| 587 | int facenum = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 588 | Roomscxx . . $ Rooms.[i].facescxx . . $ room#faces.[facenum].tmapcxx . . $ face#tmap. = gs_Xlatescxx . . $ gs_Xlates.->tex_handlescxx . . $ gs_tables#tex_handles.[cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp)]; |
| 589 | Roomscxx . . $ Rooms.[i].facescxx . . $ room#faces.[facenum].flagscxx . . $ face#flags. |= FF_TEXTURE_CHANGEDcxx . . $ `Descent3/room_external.h:115:9`!; |
| 590 | } |
| 591 | //} |
| 592 | for (p = 0; p < Roomscxx . . $ Rooms.[i].num_portalscxx . . $ room#num_portals.; p++) { |
| 593 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, Rooms[i].portals[p].flags); |
| 594 | } |
| 595 | |
| 596 | // load doorway info |
| 597 | if (Roomscxx . . $ Rooms.[i].flagscxx . . $ room#flags. & RF_DOORcxx . . $ `Descent3/room_external.h:176:9`!) { |
| 598 | doorwaycxx . . $ doorway# *dp = Roomscxx . . $ Rooms.[i].doorway_datacxx . . $ room#doorway_data.; |
| 599 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(dp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 600 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, dp->state); |
| 601 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, dp->flags); |
| 602 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, dp->keys_needed); |
| 603 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, dp->position); |
| 604 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, dp->dest_pos); |
| 605 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, dp->sound_handle); |
| 606 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, dp->activenum); |
| 607 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, dp->doornum); |
| 608 | } |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | // Rebuild the active doorway list |
| 613 | // DoorwayRebuildActiveList(); |
| 614 | |
| 615 | return retval; |
| 616 | } |
| 617 | |
| 618 | // TODO: MTS: unused? |
| 619 | // loads in and sets these events |
| 620 | int LGSEventscxx . . $ LGSEvents(413716a422df0036).(CFILEcxx . . $ CFILE# *fp) { |
| 621 | int retval = LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 622 | |
| 623 | // clear events |
| 624 | ClearAllEventscxx . . $ ClearAllEvents(49f6e7a06ebc5aa8).(); |
| 625 | |
| 626 | return retval; |
| 627 | } |
| 628 | |
| 629 | // loads in and sets these triggers |
| 630 | int LGSTriggerscxx . . $ LGSTriggers(413716a422df0036).(CFILEcxx . . $ CFILE# *fp) { |
| 631 | int16_t i, n_trigs = 0; |
| 632 | |
| 633 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, n_trigs); |
| 634 | if (n_trigs != (int16_t)Num_triggerscxx . . $ Num_triggers.) { |
| 635 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 636 | return LGS_CORRUPTLEVELcxx . . $ `Descent3/gamesave.h:142:9`!; |
| 637 | } |
| 638 | |
| 639 | for (i = 0; i < n_trigs; i++) { |
| 640 | |
| 641 | // must free current trigger script if there's one allocated. |
| 642 | FreeTriggerScriptcxx . . $ FreeTriggerScript(2141560ee082416a).(&Triggerscxx . . $ Triggers.[i]); |
| 643 | |
| 644 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, Triggers[i].flags); |
| 645 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, Triggers[i].activator); |
| 646 | |
| 647 | // read script info |
| 648 | //@@ script_info script; |
| 649 | //@@ |
| 650 | //@@ scrmem = LGSScript(fp, &script, &is_scripted, &scrmemsize); |
| 651 | //@@ if (is_scripted) { |
| 652 | //@@ ReinitTriggerScripts(&Triggers[i], &script, scrmemsize, scrmem); |
| 653 | //@@ } |
| 654 | //@@ if (scrmem) |
| 655 | //@@ delete[] scrmem; |
| 656 | //@@ script.set_name(NULL); |
| 657 | //@@ script.set_parms(0, NULL); |
| 658 | } |
| 659 | |
| 660 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 661 | } |
| 662 | |
| 663 | struct old_vis_attach_infocxx . . $ old_vis_attach_info# { |
| 664 | int obj_handlecxx . . $ old_vis_attach_info#obj_handle., dest_objhandlecxx . . $ old_vis_attach_info#dest_objhandle.; |
| 665 | uint8_tcxx . . $ uint8_t# subnumcxx . . $ old_vis_attach_info#subnum., subnum2cxx . . $ old_vis_attach_info#subnum2.; |
| 666 | |
| 667 | uint16_tcxx . . $ uint16_t# modelnumcxx . . $ old_vis_attach_info#modelnum.; |
| 668 | uint16_tcxx . . $ uint16_t# vertnumcxx . . $ old_vis_attach_info#vertnum., end_vertnumcxx . . $ old_vis_attach_info#end_vertnum.; |
| 669 | }; |
| 670 | |
| 671 | struct old_vis_effectcxx . . $ old_vis_effect# { |
| 672 | uint8_tcxx . . $ uint8_t# typecxx . . $ old_vis_effect#type.; |
| 673 | uint8_tcxx . . $ uint8_t# idcxx . . $ old_vis_effect#id.; |
| 674 | |
| 675 | vectorcxx . . $ vector# poscxx . . $ old_vis_effect#pos.; |
| 676 | |
| 677 | vectorcxx . . $ vector# velocitycxx . . $ old_vis_effect#velocity.; |
| 678 | float masscxx . . $ old_vis_effect#mass.; |
| 679 | float dragcxx . . $ old_vis_effect#drag.; |
| 680 | float sizecxx . . $ old_vis_effect#size.; |
| 681 | float lifeleftcxx . . $ old_vis_effect#lifeleft.; |
| 682 | float lifetimecxx . . $ old_vis_effect#lifetime.; |
| 683 | float creation_timecxx . . $ old_vis_effect#creation_time.; |
| 684 | |
| 685 | int roomnumcxx . . $ old_vis_effect#roomnum.; |
| 686 | uint16_tcxx . . $ uint16_t# flagscxx . . $ old_vis_effect#flags.; |
| 687 | int phys_flagscxx . . $ old_vis_effect#phys_flags.; |
| 688 | uint8_tcxx . . $ uint8_t# movement_typecxx . . $ old_vis_effect#movement_type.; |
| 689 | int16_t custom_handlecxx . . $ old_vis_effect#custom_handle.; |
| 690 | uint16_tcxx . . $ uint16_t# lighting_colorcxx . . $ old_vis_effect#lighting_color.; |
| 691 | |
| 692 | vis_attach_infocxx . . $ vis_attach_info# attach_infocxx . . $ old_vis_effect#attach_info.; |
| 693 | axis_billboard_infocxx . . $ axis_billboard_info# billboard_infocxx . . $ old_vis_effect#billboard_info.; |
| 694 | |
| 695 | vectorcxx . . $ vector# end_poscxx . . $ old_vis_effect#end_pos.; |
| 696 | |
| 697 | int16_t nextcxx . . $ old_vis_effect#next.; |
| 698 | int16_t prevcxx . . $ old_vis_effect#prev.; |
| 699 | }; |
| 700 | |
| 701 | void CopyVisStructcxx . . $ CopyVisStruct(68e2fe88cd5f440d).(vis_effectcxx . . $ vis_effect# *vis, old_vis_effectcxx . . $ old_vis_effect# *old_vis) { |
| 702 | // Copy fields over |
| 703 | vis->typecxx . . $ vis_effect#type. = old_vis->typecxx . . $ old_vis_effect#type.; |
| 704 | vis->idcxx . . $ vis_effect#id. = old_vis->idcxx . . $ old_vis_effect#id.; |
| 705 | vis->poscxx . . $ vis_effect#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). old_vis->poscxx . . $ old_vis_effect#pos.; |
| 706 | |
| 707 | vis->velocitycxx . . $ vis_effect#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). old_vis->velocitycxx . . $ old_vis_effect#velocity.; |
| 708 | vis->masscxx . . $ vis_effect#mass. = old_vis->masscxx . . $ old_vis_effect#mass.; |
| 709 | vis->dragcxx . . $ vis_effect#drag. = old_vis->dragcxx . . $ old_vis_effect#drag.; |
| 710 | vis->sizecxx . . $ vis_effect#size. = old_vis->sizecxx . . $ old_vis_effect#size.; |
| 711 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = old_vis->lifeleftcxx . . $ old_vis_effect#lifeleft.; |
| 712 | vis->lifetimecxx . . $ vis_effect#lifetime. = old_vis->lifetimecxx . . $ old_vis_effect#lifetime.; |
| 713 | vis->creation_timecxx . . $ vis_effect#creation_time. = old_vis->creation_timecxx . . $ old_vis_effect#creation_time.; |
| 714 | |
| 715 | vis->roomnumcxx . . $ vis_effect#roomnum. = old_vis->roomnumcxx . . $ old_vis_effect#roomnum.; |
| 716 | vis->flagscxx . . $ vis_effect#flags. = old_vis->flagscxx . . $ old_vis_effect#flags.; |
| 717 | vis->phys_flagscxx . . $ vis_effect#phys_flags. = old_vis->phys_flagscxx . . $ old_vis_effect#phys_flags.; |
| 718 | vis->movement_typecxx . . $ vis_effect#movement_type. = old_vis->movement_typecxx . . $ old_vis_effect#movement_type.; |
| 719 | vis->custom_handlecxx . . $ vis_effect#custom_handle. = old_vis->custom_handlecxx . . $ old_vis_effect#custom_handle.; |
| 720 | vis->lighting_colorcxx . . $ vis_effect#lighting_color. = old_vis->lighting_colorcxx . . $ old_vis_effect#lighting_color.; |
| 721 | |
| 722 | vis->attach_infocxx . . $ vis_effect#attach_info..obj_handlecxx . . $ vis_attach_info#obj_handle. = old_vis->attach_infocxx . . $ old_vis_effect#attach_info..obj_handlecxx . . $ vis_attach_info#obj_handle.; |
| 723 | vis->attach_infocxx . . $ vis_effect#attach_info..dest_objhandlecxx . . $ vis_attach_info#dest_objhandle. = old_vis->attach_infocxx . . $ old_vis_effect#attach_info..dest_objhandlecxx . . $ vis_attach_info#dest_objhandle.; |
| 724 | vis->attach_infocxx . . $ vis_effect#attach_info..subnumcxx . . $ vis_attach_info#subnum. = old_vis->attach_infocxx . . $ old_vis_effect#attach_info..subnumcxx . . $ vis_attach_info#subnum.; |
| 725 | vis->attach_infocxx . . $ vis_effect#attach_info..subnum2cxx . . $ vis_attach_info#subnum2. = old_vis->attach_infocxx . . $ old_vis_effect#attach_info..subnum2cxx . . $ vis_attach_info#subnum2.; |
| 726 | vis->attach_infocxx . . $ vis_effect#attach_info..modelnumcxx . . $ vis_attach_info#modelnum. = old_vis->attach_infocxx . . $ old_vis_effect#attach_info..modelnumcxx . . $ vis_attach_info#modelnum.; |
| 727 | vis->attach_infocxx . . $ vis_effect#attach_info..vertnumcxx . . $ vis_attach_info#vertnum. = old_vis->attach_infocxx . . $ old_vis_effect#attach_info..vertnumcxx . . $ vis_attach_info#vertnum.; |
| 728 | vis->attach_infocxx . . $ vis_effect#attach_info..end_vertnumcxx . . $ vis_attach_info#end_vertnum. = old_vis->attach_infocxx . . $ old_vis_effect#attach_info..end_vertnumcxx . . $ vis_attach_info#end_vertnum.; |
| 729 | |
| 730 | vis->billboard_infocxx . . $ vis_effect#billboard_info. =cxx . . $ axis_billboard_info#`operator=`(458086661073b199). old_vis->billboard_infocxx . . $ old_vis_effect#billboard_info.; |
| 731 | vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). old_vis->end_poscxx . . $ old_vis_effect#end_pos.; |
| 732 | } |
| 733 | |
| 734 | // save viseffects |
| 735 | int LGSVisEffectscxx . . $ LGSVisEffects(413716a422df0036).(CFILEcxx . . $ CFILE# *fp) { |
| 736 | int16_t i, count = 0; |
| 737 | |
| 738 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, count); |
| 739 | |
| 740 | // reassemble viseffect list. |
| 741 | for (i = 0; i < count; i++) { |
| 742 | int roomnum, v; |
| 743 | vis_effectcxx . . $ vis_effect# vis; |
| 744 | |
| 745 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)&vis, sizeof(vis_effectcxx . . $ vis_effect#), fp); |
| 746 | roomnum = vis.roomnumcxx . . $ vis_effect#roomnum.; |
| 747 | |
| 748 | // Check for old struct, and if found, fix it |
| 749 | if ((vis.typecxx . . $ vis_effect#type. != VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!) || (roomnum == -1) || |
| 750 | (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum) && ((roomnum > Highest_room_indexcxx . . $ Highest_room_index.) || !Roomscxx . . $ Rooms.[roomnum].usedcxx . . $ room#used.)) || |
| 751 | ((ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum) && (CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum) > 65535)))) { |
| 752 | old_vis_effectcxx . . $ old_vis_effect# old_vis; |
| 753 | |
| 754 | // Copy new into old |
| 755 | memcpy((uint8_tcxx . . $ uint8_t# *)&old_vis, (uint8_tcxx . . $ uint8_t# *)&vis, sizeof(vis_effectcxx . . $ vis_effect#)); |
| 756 | |
| 757 | // Read extra data from old |
| 758 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).(((uint8_tcxx . . $ uint8_t# *)&old_vis) + sizeof(vis_effectcxx . . $ vis_effect#), sizeof(old_vis_effectcxx . . $ old_vis_effect#) - sizeof(vis_effectcxx . . $ vis_effect#), fp); |
| 759 | |
| 760 | // Copy from old to new struct |
| 761 | CopyVisStructcxx . . $ CopyVisStruct(68e2fe88cd5f440d).(&vis, &old_vis); |
| 762 | |
| 763 | // Reset new room number |
| 764 | roomnum = vis.roomnumcxx . . $ vis_effect#roomnum.; |
| 765 | } |
| 766 | |
| 767 | vis.roomnumcxx . . $ vis_effect#roomnum. = vis.prevcxx . . $ vis_effect#prev. = vis.nextcxx . . $ vis_effect#next. = -1; |
| 768 | v = VisEffectAllocatecxx . . $ VisEffectAllocate(b126dc7c1de90089).(); |
| 769 | if (v >= 0) { // DAJ -1FIX |
| 770 | memcpy(&VisEffectscxx . . $ VisEffects.[v], &vis, sizeof(vis_effectcxx . . $ vis_effect#)); |
| 771 | VisEffectLinkcxx . . $ VisEffectLink(3e454b8ccf442868).(v, roomnum); |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 776 | } |
| 777 | |
| 778 | // players |
| 779 | int LGSPlayerscxx . . $ LGSPlayers(413716a422df0036).(CFILEcxx . . $ CFILE# *fp) { |
| 780 | playercxx . . $ player# *plr = &Playerscxx . . $ Players.[0]; |
| 781 | int16_t size; |
| 782 | |
| 783 | // must do this if we read player struct as whole. |
| 784 | plr->inventorycxx . . $ player#inventory..Resetcxx . . $ Inventory#Reset(b994e01f1c45a386).(false, INVRESET_ALLcxx . . $ `Descent3/Inventory.h:201:9`!); |
| 785 | plr->counter_measurescxx . . $ player#counter_measures..Resetcxx . . $ Inventory#Reset(b994e01f1c45a386).(false, INVRESET_ALLcxx . . $ `Descent3/Inventory.h:201:9`!); |
| 786 | |
| 787 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, size); |
| 788 | if (size != sizeof(playercxx . . $ player#)) { |
| 789 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 790 | return LGS_OUTDATEDVERcxx . . $ `Descent3/gamesave.h:138:9`!; |
| 791 | } else { |
| 792 | int guided_handle; |
| 793 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)plr, sizeof(playercxx . . $ player#), fp); |
| 794 | if (plr->guided_objcxx . . $ player#guided_obj.) { |
| 795 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, guided_handle); |
| 796 | plr->guided_objcxx . . $ player#guided_obj. = &Objectscxx . . $ Objects.[guided_handle & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!]; |
| 797 | } |
| 798 | // save inventory and countermeasures |
| 799 | // must do this if we read player struct as whole. |
| 800 | plr->inventorycxx . . $ player#inventory..ReadInventorycxx . . $ Inventory#ReadInventory(413716a422df0036).(fp); |
| 801 | plr->counter_measurescxx . . $ player#counter_measures..ReadInventorycxx . . $ Inventory#ReadInventory(413716a422df0036).(fp); |
| 802 | } |
| 803 | |
| 804 | int ship_index = Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index.; |
| 805 | |
| 806 | if (ship_index < 0) |
| 807 | ship_index = 0; |
| 808 | |
| 809 | FreeCockpitcxx . . $ FreeCockpit(49f6e7a06ebc5aa8).(); |
| 810 | CloseShipHUDcxx . . $ CloseShipHUD(49f6e7a06ebc5aa8).(); |
| 811 | InitShipHUDcxx . . $ InitShipHUD(d4f767463ce0a6b3).(ship_index); |
| 812 | InitCockpitcxx . . $ InitCockpit(d4f767463ce0a6b3).(ship_index); |
| 813 | |
| 814 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 815 | } |
| 816 | |
| 817 | extern int Physics_NumLinkedcxx . . $ Physics_NumLinked.; |
| 818 | extern int PhysicsLinkListcxx . . $ PhysicsLinkList.[MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!]; |
| 819 | |
| 820 | int inreadobjcxx . . $ inreadobj. = 0; |
| 821 | |
| 822 | void VerifySaveGamecxx . . $ VerifySaveGame(3639e799710acb68).(CFILEcxx . . $ CFILE# *fp) { |
| 823 | int testint; |
| 824 | testint = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 825 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(testint == 0xF00D4B0B); |
| 826 | } |
| 827 | |
| 828 | #define VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`! |
| 829 | // VerifySaveGame(fp) |
| 830 | extern char MarkerMessagescxx . . $ MarkerMessages.[MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`! * 2][MAX_MARKER_MESSAGE_LENGTHcxx . . $ `Descent3/marker.h:24:9`!]; |
| 831 | extern int Marker_messagecxx . . $ Marker_message.; |
| 832 | // loads in and sets these objects |
| 833 | int LGSObjectscxx . . $ LGSObjects(3041dee38160abc0).(CFILEcxx . . $ CFILE# *fp, int version) { |
| 834 | |
| 835 | inreadobjcxx . . $ inreadobj. = 1; |
| 836 | int retval = LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 837 | vectorcxx . . $ vector# pos, last_pos; |
| 838 | int roomnum; |
| 839 | int i, j, highest_index; |
| 840 | int max_terr; |
| 841 | |
| 842 | matrixcxx . . $ matrix# *objmat = (matrixcxx . . $ matrix# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(*objmat) * MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!); |
| 843 | |
| 844 | Osiris_DisableCreateEventscxx . . $ Osiris_DisableCreateEvents(49f6e7a06ebc5aa8).(); |
| 845 | // we must reset some data before continuing. |
| 846 | InitBigObjectscxx . . $ InitBigObjects(49f6e7a06ebc5aa8).(); |
| 847 | |
| 848 | START_VERIFY_SAVEFILEcxx . . $ `Descent3/gamesave.h:167:9`!(fp); |
| 849 | Marker_messagecxx . . $ Marker_message. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 850 | int num_marker_msgs = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 851 | for (i = 0; i < num_marker_msgs; i++) { |
| 852 | int msg_len = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 853 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)MarkerMessagescxx . . $ MarkerMessages.[i], msg_len, fp); |
| 854 | } |
| 855 | |
| 856 | highest_index = (int)cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 857 | |
| 858 | // load what objects are stuck to each other |
| 859 | int max_num_linked = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 860 | Physics_NumLinkedcxx . . $ Physics_NumLinked. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 861 | for (i = 0; i < max_num_linked; i++) { |
| 862 | PhysicsLinkListcxx . . $ PhysicsLinkList.[i] = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 863 | } |
| 864 | |
| 865 | // load AI information |
| 866 | ////////////////////////////////// |
| 867 | int num_read_max_dynamic_paths = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 868 | int num_read_max_nodes = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 869 | |
| 870 | int num_dp_to_read = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(MAX_DYNAMIC_PATHScxx . . $ `Descent3/aistruct.h:858:9`!, num_read_max_dynamic_paths); |
| 871 | int num_dp_to_skip = |
| 872 | (MAX_DYNAMIC_PATHScxx . . $ `Descent3/aistruct.h:858:9`! < num_read_max_dynamic_paths) ? num_read_max_dynamic_paths - MAX_DYNAMIC_PATHScxx . . $ `Descent3/aistruct.h:858:9`! : 0; |
| 873 | |
| 874 | int num_n_to_read = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(MAX_NODEScxx . . $ `Descent3/aistruct.h:859:9`!, num_read_max_nodes); |
| 875 | int num_n_to_skip = (MAX_NODEScxx . . $ `Descent3/aistruct.h:859:9`! < num_read_max_nodes) ? num_read_max_nodes - MAX_NODEScxx . . $ `Descent3/aistruct.h:859:9`! : 0; |
| 876 | |
| 877 | int s; |
| 878 | for (i = 0; i < num_dp_to_read; i++) { |
| 879 | AIDynamicPathcxx . . $ AIDynamicPath.[i].num_nodescxx . . $ ai_dynamic_path#num_nodes. = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 880 | AIDynamicPathcxx . . $ AIDynamicPath.[i].use_countcxx . . $ ai_dynamic_path#use_count. = cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 881 | AIDynamicPathcxx . . $ AIDynamicPath.[i].owner_handlecxx . . $ ai_dynamic_path#owner_handle. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 882 | |
| 883 | for (s = 0; s < num_n_to_read; s++) { |
| 884 | AIDynamicPathcxx . . $ AIDynamicPath.[i].poscxx . . $ ai_dynamic_path#pos.[s].xcxx . . $ vector#x. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 885 | AIDynamicPathcxx . . $ AIDynamicPath.[i].poscxx . . $ ai_dynamic_path#pos.[s].ycxx . . $ vector#y. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 886 | AIDynamicPathcxx . . $ AIDynamicPath.[i].poscxx . . $ ai_dynamic_path#pos.[s].zcxx . . $ vector#z. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 887 | AIDynamicPathcxx . . $ AIDynamicPath.[i].roomnumcxx . . $ ai_dynamic_path#roomnum.[s] = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 888 | } |
| 889 | |
| 890 | for (s = 0; s < num_n_to_skip; s++) { |
| 891 | cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 892 | cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 893 | cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 894 | cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | for (i = 0; i < num_dp_to_skip; i++) { |
| 899 | cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 900 | cf_ReadShortcxx . . $ cf_ReadShort(30b00389b433b379).(fp); |
| 901 | cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 902 | |
| 903 | for (s = 0; s < num_n_to_read; s++) { |
| 904 | cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 905 | cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 906 | cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 907 | cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 908 | } |
| 909 | |
| 910 | for (s = 0; s < num_n_to_skip; s++) { |
| 911 | cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 912 | cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 913 | cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 914 | cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 915 | } |
| 916 | } |
| 917 | |
| 918 | int num_read_rooms = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 919 | int num_r_to_read = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!, num_read_rooms); |
| 920 | int num_r_to_skip = (MAX_ROOMScxx . . $ `Descent3/room.h:377:9`! < num_read_rooms) ? num_read_rooms - MAX_ROOMScxx . . $ `Descent3/room.h:377:9`! : 0; |
| 921 | |
| 922 | AIAltPathNumNodescxx . . $ AIAltPathNumNodes. = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 923 | for (i = 0; i < num_r_to_read; i++) { |
| 924 | AIAltPathcxx . . $ AIAltPath.[i] = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 925 | } |
| 926 | |
| 927 | for (i = 0; i < num_r_to_skip; i++) { |
| 928 | cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 929 | } |
| 930 | |
| 931 | ////////////////////////////////// |
| 932 | |
| 933 | Osiris_DisableEventscxx . . $ Osiris_DisableEvents(ac50b47256ae7414).(OEM_OBJECTScxx . . $ `Descent3/osiris_dll.h:319:9`! | OEM_TRIGGERScxx . . $ `Descent3/osiris_dll.h:320:9`! | OEM_LEVELScxx . . $ `Descent3/osiris_dll.h:321:9`!); |
| 934 | for (i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) { |
| 935 | if (Objectscxx . . $ Objects.[i].lighting_render_typecxx . . $ object#lighting_render_type. != LRT_LIGHTMAPScxx . . $ `Descent3/object.h:651:9`!) { |
| 936 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) { |
| 937 | Objectscxx . . $ Objects.[i].nextcxx . . $ object#next. = -1; |
| 938 | Objectscxx . . $ Objects.[i].prevcxx . . $ object#prev. = -1; |
| 939 | ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(i); |
| 940 | } |
| 941 | } else { |
| 942 | Objectscxx . . $ Objects.[i].nextcxx . . $ object#next. = -1; |
| 943 | Objectscxx . . $ Objects.[i].prevcxx . . $ object#prev. = -1; |
| 944 | ObjUnlinkcxx . . $ ObjUnlink(d4f767463ce0a6b3).(i); |
| 945 | } |
| 946 | } |
| 947 | Osiris_EnableEventscxx . . $ Osiris_EnableEvents(ac50b47256ae7414).(OEM_OBJECTScxx . . $ `Descent3/osiris_dll.h:319:9`! | OEM_TRIGGERScxx . . $ `Descent3/osiris_dll.h:320:9`! | OEM_LEVELScxx . . $ `Descent3/osiris_dll.h:321:9`!); |
| 948 | for (i = 0; i <= highest_index; i++) { |
| 949 | objectcxx . . $ object# *op; |
| 950 | weaponcxx . . $ weapon# *wpn; |
| 951 | shipcxx . . $ ship# *shp; |
| 952 | object_infocxx . . $ object_info# *obji; |
| 953 | doorcxx . . $ door# *door; |
| 954 | int index, nattach, new_model, handle; |
| 955 | uint8_tcxx . . $ uint8_t# type, dummy_type; |
| 956 | int16_t sindex, size; |
| 957 | |
| 958 | // if((i==98)||(i==100)) |
| 959 | // Int3(); |
| 960 | int sig; |
| 961 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, sig); |
| 962 | |
| 963 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(sig == 0xBADB0B); |
| 964 | |
| 965 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, type); |
| 966 | |
| 967 | // skip rooms and deleted objects. if this slot currently contains a real object, it should be |
| 968 | // destroyed (unlinked, deallocated, etc) to match the new object list. |
| 969 | if (type == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) { |
| 970 | Osiris_DisableEventscxx . . $ Osiris_DisableEvents(ac50b47256ae7414).(OEM_OBJECTScxx . . $ `Descent3/osiris_dll.h:319:9`! | OEM_TRIGGERScxx . . $ `Descent3/osiris_dll.h:320:9`! | OEM_LEVELScxx . . $ `Descent3/osiris_dll.h:321:9`!); |
| 971 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) |
| 972 | ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(i); |
| 973 | Osiris_EnableEventscxx . . $ Osiris_EnableEvents(ac50b47256ae7414).(OEM_OBJECTScxx . . $ `Descent3/osiris_dll.h:319:9`! | OEM_TRIGGERScxx . . $ `Descent3/osiris_dll.h:320:9`! | OEM_LEVELScxx . . $ `Descent3/osiris_dll.h:321:9`!); |
| 974 | continue; |
| 975 | } |
| 976 | uint8_tcxx . . $ uint8_t# l_rend_type; |
| 977 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, l_rend_type); |
| 978 | |
| 979 | // See if the object has changed from it's original lightmap type |
| 980 | // DAJ added check for type |
| 981 | if ((Objectscxx . . $ Objects.[i].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) && (Objectscxx . . $ Objects.[i].lighting_render_typecxx . . $ object#lighting_render_type. == LRT_LIGHTMAPScxx . . $ `Descent3/object.h:651:9`!) && |
| 982 | (l_rend_type != LRT_LIGHTMAPScxx . . $ `Descent3/object.h:651:9`!)) { |
| 983 | Osiris_DisableEventscxx . . $ Osiris_DisableEvents(ac50b47256ae7414).(OEM_OBJECTScxx . . $ `Descent3/osiris_dll.h:319:9`! | OEM_TRIGGERScxx . . $ `Descent3/osiris_dll.h:320:9`! | OEM_LEVELScxx . . $ `Descent3/osiris_dll.h:321:9`!); |
| 984 | ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(i); |
| 985 | Osiris_EnableEventscxx . . $ Osiris_EnableEvents(ac50b47256ae7414).(OEM_OBJECTScxx . . $ `Descent3/osiris_dll.h:319:9`! | OEM_TRIGGERScxx . . $ `Descent3/osiris_dll.h:320:9`! | OEM_LEVELScxx . . $ `Descent3/osiris_dll.h:321:9`!); |
| 986 | } |
| 987 | |
| 988 | op = &Objectscxx . . $ Objects.[i]; |
| 989 | op->lighting_render_typecxx . . $ object#lighting_render_type. = l_rend_type; |
| 990 | |
| 991 | // Store whether or not we have a pointer to lighting_info |
| 992 | uint8_tcxx . . $ uint8_t# has_lightinfo; |
| 993 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, has_lightinfo); |
| 994 | if (has_lightinfo) { |
| 995 | if (!op->lighting_infocxx . . $ object#lighting_info.) { |
| 996 | op->lighting_infocxx . . $ object#lighting_info. = (light_infocxx . . $ light_info# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(*op->lighting_info)); |
| 997 | } |
| 998 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)op->lighting_infocxx . . $ object#lighting_info., sizeof(*op->lighting_infocxx . . $ object#lighting_info.), fp); |
| 999 | } |
| 1000 | |
| 1001 | // validate handle. |
| 1002 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, handle); |
| 1003 | if ((handle & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!) != i) { |
| 1004 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 1005 | retval = LGS_OBJECTSCORRUPTcxx . . $ `Descent3/gamesave.h:141:9`!; |
| 1006 | goto done; |
| 1007 | } |
| 1008 | |
| 1009 | // read in the rest. |
| 1010 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, dummy_type); |
| 1011 | |
| 1012 | // positional information (not assigned to object 'cause of Unlink) |
| 1013 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, roomnum); |
| 1014 | gs_ReadVectorcxx . . $ `Descent3/gamesave.h:170:9`!(fp, pos); |
| 1015 | gs_ReadVectorcxx . . $ `Descent3/gamesave.h:170:9`!(fp, last_pos); |
| 1016 | gs_ReadMatrixcxx . . $ `Descent3/gamesave.h:176:9`!(fp, objmat[i]); |
| 1017 | |
| 1018 | // object name |
| 1019 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, j); |
| 1020 | if (j > 0) { |
| 1021 | if (op->namecxx . . $ object#name.) |
| 1022 | mem_freecxx . . $ `mem/mem.h:80:9`!(op->name); |
| 1023 | op->namecxx . . $ object#name. = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(j + 1); |
| 1024 | if (!op->namecxx . . $ object#name.) |
| 1025 | Errorcxx . . $ Error(326aeb464d16410c).("Out of memory"); |
| 1026 | |
| 1027 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)op->namecxx . . $ object#name., j, fp); |
| 1028 | op->namecxx . . $ object#name.[j] = '\0'; |
| 1029 | } else { |
| 1030 | op->namecxx . . $ object#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1031 | } |
| 1032 | |
| 1033 | // Kill any script thread associated with this object. |
| 1034 | |
| 1035 | if (op->typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) { |
| 1036 | if (Objectscxx . . $ Objects.[i].lighting_render_typecxx . . $ object#lighting_render_type. != LRT_LIGHTMAPScxx . . $ `Descent3/object.h:651:9`!) |
| 1037 | FreeObjectScriptscxx . . $ FreeObjectScripts(674fac047436fc5b).(op, false); |
| 1038 | |
| 1039 | // Free up effects memory |
| 1040 | if (op->effect_infocxx . . $ object#effect_info.) { |
| 1041 | mem_freecxx . . $ `mem/mem.h:80:9`!(op->effect_info); |
| 1042 | op->effect_infocxx . . $ object#effect_info. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1043 | } |
| 1044 | if (op->ai_infocxx . . $ object#ai_info. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 1045 | AIDestroyObjcxx . . $ AIDestroyObj(419c470199a90a97).(op); |
| 1046 | mem_freecxx . . $ `mem/mem.h:80:9`!(op->ai_info); |
| 1047 | op->ai_infocxx . . $ object#ai_info. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1048 | } |
| 1049 | if (op->dynamic_wbcxx . . $ object#dynamic_wb. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 1050 | mem_freecxx . . $ `mem/mem.h:80:9`!(op->dynamic_wb); |
| 1051 | op->dynamic_wbcxx . . $ object#dynamic_wb. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1052 | } |
| 1053 | if (op->attach_childrencxx . . $ object#attach_children. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 1054 | mem_freecxx . . $ `mem/mem.h:80:9`!(op->attach_children); |
| 1055 | op->attach_childrencxx . . $ object#attach_children. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1056 | } |
| 1057 | } |
| 1058 | op->typecxx . . $ object#type. = type; |
| 1059 | op->handlecxx . . $ object#handle. = handle; |
| 1060 | op->dummy_typecxx . . $ object#dummy_type. = dummy_type; |
| 1061 | |
| 1062 | op->roomnumcxx . . $ object#roomnum. = roomnum; |
| 1063 | op->poscxx . . $ object#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pos; |
| 1064 | op->last_poscxx . . $ object#last_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). last_pos; |
| 1065 | |
| 1066 | // data universal to all objects |
| 1067 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, op->id); |
| 1068 | |
| 1069 | // Get type, and xlate if dummy |
| 1070 | if (type == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!) |
| 1071 | type = op->dummy_typecxx . . $ object#dummy_type.; |
| 1072 | |
| 1073 | // xlate id to new id. |
| 1074 | switch (type) { |
| 1075 | case OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!: |
| 1076 | case OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!: |
| 1077 | case OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!: |
| 1078 | case OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!: |
| 1079 | op->idcxx . . $ object#id. = gs_Xlatescxx . . $ gs_Xlates.->obji_indicescxx . . $ gs_tables#obji_indices.[op->idcxx . . $ object#id.]; |
| 1080 | obji = &Object_infocxx . . $ Object_info.[op->idcxx . . $ object#id.]; |
| 1081 | break; |
| 1082 | case OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!: |
| 1083 | op->idcxx . . $ object#id. = gs_Xlatescxx . . $ gs_Xlates.->door_handlescxx . . $ gs_tables#door_handles.[op->idcxx . . $ object#id.]; |
| 1084 | door = &Doorscxx . . $ Doors.[op->idcxx . . $ object#id.]; |
| 1085 | break; |
| 1086 | case OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!: |
| 1087 | op->idcxx . . $ object#id. = gs_Xlatescxx . . $ gs_Xlates.->wpn_handlescxx . . $ gs_tables#wpn_handles.[op->idcxx . . $ object#id.]; |
| 1088 | wpn = &Weaponscxx . . $ Weapons.[op->idcxx . . $ object#id.]; |
| 1089 | break; |
| 1090 | case OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!: |
| 1091 | shp = &Shipscxx . . $ Ships.[Playerscxx . . $ Players.[op->idcxx . . $ object#id.].ship_indexcxx . . $ player#ship_index.]; |
| 1092 | break; |
| 1093 | } |
| 1094 | |
| 1095 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, op->flags); |
| 1096 | |
| 1097 | op->flagscxx . . $ object#flags. |= OF_SERVER_OBJECTcxx . . $ `Descent3/object_external.h:291:9`!; |
| 1098 | |
| 1099 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, op->control_type); |
| 1100 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, op->movement_type); |
| 1101 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, op->render_type); |
| 1102 | |
| 1103 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, op->renderframe); |
| 1104 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->size); |
| 1105 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->shields); |
| 1106 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, op->contains_type); |
| 1107 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, op->contains_id); |
| 1108 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, op->contains_count); |
| 1109 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->creation_time); |
| 1110 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->lifeleft); |
| 1111 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->lifetime); |
| 1112 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, op->parent_handle); |
| 1113 | |
| 1114 | // attachment info. free old info and load in new. |
| 1115 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, op->attach_ultimate_handle); |
| 1116 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, op->attach_parent_handle); |
| 1117 | |
| 1118 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, nattach); |
| 1119 | if (nattach) { |
| 1120 | int f_allocated; |
| 1121 | |
| 1122 | if (version >= 2) |
| 1123 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, f_allocated); |
| 1124 | else |
| 1125 | f_allocated = 1; |
| 1126 | |
| 1127 | if (f_allocated) { |
| 1128 | // mprintf(0,"Object %d has %d attach points.\n",i,nattach); |
| 1129 | op->attach_childrencxx . . $ object#attach_children. = (int *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(int) * nattach); |
| 1130 | for (j = 0; j < nattach; j++) |
| 1131 | gs_ReadIntcxx . . $ `Descent3/gamesave.h:186:9`!(fp, op->attach_children[j]); |
| 1132 | } |
| 1133 | } |
| 1134 | |
| 1135 | VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`!; |
| 1136 | |
| 1137 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, op->attach_type); |
| 1138 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, op->attach_index); |
| 1139 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->attach_dist); |
| 1140 | gs_ReadVectorcxx . . $ `Descent3/gamesave.h:170:9`!(fp, op->min_xyz); |
| 1141 | gs_ReadVectorcxx . . $ `Descent3/gamesave.h:170:9`!(fp, op->max_xyz); |
| 1142 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->impact_size); |
| 1143 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->impact_time); |
| 1144 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->impact_player_damage); |
| 1145 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->impact_generic_damage); |
| 1146 | gs_ReadFloatcxx . . $ `Descent3/gamesave.h:187:9`!(fp, op->impact_force); |
| 1147 | |
| 1148 | // custom default script info |
| 1149 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, j); |
| 1150 | if (j > 0) { |
| 1151 | op->custom_default_script_namecxx . . $ object#custom_default_script_name. = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(j + 1); |
| 1152 | if (!op->custom_default_script_namecxx . . $ object#custom_default_script_name.) |
| 1153 | Errorcxx . . $ Error(326aeb464d16410c).("Out of memory"); |
| 1154 | |
| 1155 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)op->custom_default_script_namecxx . . $ object#custom_default_script_name., j, fp); |
| 1156 | op->custom_default_script_namecxx . . $ object#custom_default_script_name.[j] = '\0'; |
| 1157 | } else { |
| 1158 | op->custom_default_script_namecxx . . $ object#custom_default_script_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1159 | } |
| 1160 | |
| 1161 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, j); |
| 1162 | if (j > 0) { |
| 1163 | op->custom_default_module_namecxx . . $ object#custom_default_module_name. = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(j + 1); |
| 1164 | if (!op->custom_default_module_namecxx . . $ object#custom_default_module_name.) |
| 1165 | Errorcxx . . $ Error(326aeb464d16410c).("Out of memory"); |
| 1166 | |
| 1167 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)op->custom_default_module_namecxx . . $ object#custom_default_module_name., j, fp); |
| 1168 | op->custom_default_module_namecxx . . $ object#custom_default_module_name.[j] = '\0'; |
| 1169 | } else { |
| 1170 | op->custom_default_module_namecxx . . $ object#custom_default_module_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1171 | } |
| 1172 | |
| 1173 | VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`!; |
| 1174 | |
| 1175 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, op->position_counter); |
| 1176 | |
| 1177 | VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`!; |
| 1178 | |
| 1179 | // write out all structures here. |
| 1180 | // movement info. |
| 1181 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, size); |
| 1182 | if (size != sizeof(op->mtypecxx . . $ object#mtype.)) { |
| 1183 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 1184 | retval = LGS_OUTDATEDVERcxx . . $ `Descent3/gamesave.h:138:9`!; |
| 1185 | goto done; |
| 1186 | } |
| 1187 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)&op->mtypecxx . . $ object#mtype., size, fp); |
| 1188 | |
| 1189 | VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`!; |
| 1190 | // Control info, determined by CONTROL_TYPE |
| 1191 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, size); |
| 1192 | if (size != sizeof(op->ctypecxx . . $ object#ctype.)) { |
| 1193 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 1194 | retval = LGS_OUTDATEDVERcxx . . $ `Descent3/gamesave.h:138:9`!; |
| 1195 | goto done; |
| 1196 | } |
| 1197 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)&op->ctypecxx . . $ object#ctype., size, fp); |
| 1198 | |
| 1199 | VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`!; |
| 1200 | // remap bitmap handle if this is a fireball! |
| 1201 | if (type == OBJ_FIREBALLcxx . . $ `Descent3/object_external.h:161:9`!) { |
| 1202 | index = op->ctypecxx . . $ object#ctype..blast_infocxx . . $ object#$anonymous_type_9#blast_info..bm_handlecxx . . $ blast_info_s#bm_handle.; |
| 1203 | op->ctypecxx . . $ object#ctype..blast_infocxx . . $ object#$anonymous_type_9#blast_info..bm_handlecxx . . $ blast_info_s#bm_handle. = (index > -1) ? gs_Xlatescxx . . $ gs_Xlates.->bm_handlescxx . . $ gs_tables#bm_handles.[index] : -1; |
| 1204 | } |
| 1205 | |
| 1206 | // save ai information. |
| 1207 | retval = LGSObjAIcxx . . $ LGSObjAI(b3643b3a423eaee).(fp, &op->ai_infocxx . . $ object#ai_info.); |
| 1208 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 1209 | goto lgsobjs_fail; |
| 1210 | |
| 1211 | VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`!; |
| 1212 | |
| 1213 | // save out rendering information |
| 1214 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, size); |
| 1215 | if (size != sizeof(op->rtypecxx . . $ object#rtype.)) { |
| 1216 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 1217 | retval = LGS_OUTDATEDVERcxx . . $ `Descent3/gamesave.h:138:9`!; |
| 1218 | goto done; |
| 1219 | } |
| 1220 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)&op->rtypecxx . . $ object#rtype., size, fp); |
| 1221 | |
| 1222 | op->sizecxx . . $ object#size. = cf_ReadFloatcxx . . $ cf_ReadFloat(9a03a00aead0d542).(fp); |
| 1223 | |
| 1224 | // page in correct graphical data now. |
| 1225 | switch (op->render_typecxx . . $ object#render_type.) { |
| 1226 | case RT_NONEcxx . . $ `Descent3/object_external.h:257:9`!: |
| 1227 | case RT_EDITOR_SPHEREcxx . . $ `Descent3/object_external.h:265:9`!: |
| 1228 | case RT_FIREBALLcxx . . $ `Descent3/object_external.h:259:9`!: |
| 1229 | case RT_LINEcxx . . $ `Descent3/object_external.h:261:9`!: |
| 1230 | case RT_PARTICLEcxx . . $ `Descent3/object_external.h:262:9`!: |
| 1231 | case RT_SPLINTERcxx . . $ `Descent3/object_external.h:263:9`!: |
| 1232 | case RT_ROOMcxx . . $ `Descent3/object_external.h:264:9`!: |
| 1233 | break; |
| 1234 | case RT_WEAPONcxx . . $ `Descent3/object_external.h:260:9`!: |
| 1235 | if (!(op->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!)) { |
| 1236 | if (!(Weaponscxx . . $ Weapons.[op->idcxx . . $ object#id.].flagscxx . . $ weapon#flags. & WF_IMAGE_BITMAPcxx . . $ `Descent3/weapon.h:219:9`!)) { |
| 1237 | PageInVClipcxx . . $ PageInVClip(d4f767463ce0a6b3).(Weaponscxx . . $ Weapons.[op->idcxx . . $ object#id.].fire_image_handlecxx . . $ weapon#fire_image_handle.); |
| 1238 | } |
| 1239 | break; |
| 1240 | } |
| 1241 | break; |
| 1242 | case RT_POLYOBJcxx . . $ `Descent3/object_external.h:258:9`!: // be sure to use translated handles for polyobjs and textures |
| 1243 | { |
| 1244 | // the paging mess. must update size of object accordingly. |
| 1245 | sindex = (int16_t)op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.; |
| 1246 | new_model = (sindex > -1) ? gs_Xlatescxx . . $ gs_Xlates.->model_handlescxx . . $ gs_tables#model_handles.[sindex] : -1; |
| 1247 | if ((new_model != op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.) || (Poly_modelscxx . . $ Poly_models.[new_model].flagscxx . . $ poly_model#flags. & PMF_NOT_RESIDENTcxx . . $ `lib/polymodel_external.h:225:9`!)) { |
| 1248 | switch (type) { |
| 1249 | case OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!: |
| 1250 | PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(new_model); |
| 1251 | ComputeDefaultSizecxx . . $ ComputeDefaultSize(30915566dd087c6c).(OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!, new_model, &op->sizecxx . . $ object#size.); |
| 1252 | break; |
| 1253 | case OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!: |
| 1254 | case OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!: |
| 1255 | case OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!: |
| 1256 | case OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!: |
| 1257 | PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(new_model, type, &obji->sizecxx . . $ object_info#size.); |
| 1258 | op->sizecxx . . $ object#size. = obji->sizecxx . . $ object_info#size.; |
| 1259 | break; |
| 1260 | case OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!: |
| 1261 | PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(new_model, OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, &wpn->sizecxx . . $ weapon#size.); |
| 1262 | op->sizecxx . . $ object#size. = wpn->sizecxx . . $ weapon#size.; |
| 1263 | break; |
| 1264 | case OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!: |
| 1265 | PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(new_model, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, &shp->sizecxx . . $ ship#size.); |
| 1266 | op->sizecxx . . $ object#size. = shp->sizecxx . . $ ship#size.; |
| 1267 | break; |
| 1268 | case OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!: |
| 1269 | op->sizecxx . . $ object#size. = ComputeRoomBoundingSpherecxx . . $ ComputeRoomBoundingSphere(5e6b5241f0239b19).(&pos, &Roomscxx . . $ Rooms.[op->idcxx . . $ object#id.]); |
| 1270 | break; |
| 1271 | |
| 1272 | default: |
| 1273 | PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(new_model); |
| 1274 | } |
| 1275 | } |
| 1276 | op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num. = new_model; |
| 1277 | |
| 1278 | sindex = (int16_t)op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..dying_model_numcxx . . $ polyobj_info#dying_model_num.; |
| 1279 | new_model = (sindex > -1) ? gs_Xlatescxx . . $ gs_Xlates.->model_handlescxx . . $ gs_tables#model_handles.[sindex] : -1; |
| 1280 | if (new_model != op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..dying_model_numcxx . . $ polyobj_info#dying_model_num.) { |
| 1281 | switch (type) { |
| 1282 | case OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!: |
| 1283 | PageInPolymodelcxx . . $ PageInPolymodel(726816c99d57134).(new_model, OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!, &shp->sizecxx . . $ ship#size.); |
| 1284 | op->sizecxx . . $ object#size. = shp->sizecxx . . $ ship#size.; |
| 1285 | break; |
| 1286 | } |
| 1287 | } |
| 1288 | op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..dying_model_numcxx . . $ polyobj_info#dying_model_num. = new_model; |
| 1289 | |
| 1290 | index = op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..tmap_overridecxx . . $ polyobj_info#tmap_override.; |
| 1291 | op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..tmap_overridecxx . . $ polyobj_info#tmap_override. = (index > -1) ? gs_Xlatescxx . . $ gs_Xlates.->tex_handlescxx . . $ gs_tables#tex_handles.[index] : -1; |
| 1292 | |
| 1293 | memset(&op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..multi_turret_infocxx . . $ polyobj_info#multi_turret_info., 0, sizeof(multi_turretcxx . . $ multi_turret#)); |
| 1294 | poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.]; |
| 1295 | |
| 1296 | if (pm->n_attachcxx . . $ poly_model#n_attach.) { |
| 1297 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "*Object %d has %d attach points.\n", i, pm->n_attach); |
| 1298 | } |
| 1299 | |
| 1300 | polyobj_infocxx . . $ polyobj_info# *p_info = &op->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.; |
| 1301 | int num_wbs = pm->num_wbscxx . . $ poly_model#num_wbs.; |
| 1302 | int count = 0; |
| 1303 | for (int j = 0; j < num_wbs; j++) { |
| 1304 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(pm->poly_wb[j].num_turrets >= 0 && pm->poly_wb[j].num_turrets <= 6400); |
| 1305 | count += pm->poly_wbcxx . . $ poly_model#poly_wb.[j].num_turretscxx . . $ poly_wb_info#num_turrets.; |
| 1306 | } |
| 1307 | |
| 1308 | p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..num_turretscxx . . $ multi_turret#num_turrets. = count; |
| 1309 | |
| 1310 | if ((count > 0) && (p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) { |
| 1311 | int cur = 0; |
| 1312 | |
| 1313 | p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..timecxx . . $ multi_turret#time. = 0; |
| 1314 | p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes. = (float *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(float) * count); |
| 1315 | p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_keyframescxx . . $ multi_turret#last_keyframes. = (float *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(float) * count); |
| 1316 | p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..flagscxx . . $ multi_turret#flags. = 0; |
| 1317 | } |
| 1318 | // Do Animation stuff |
| 1319 | custom_animcxx . . $ custom_anim# multi_anim_info; |
| 1320 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)&multi_anim_info, sizeof(multi_anim_info), fp); |
| 1321 | ObjSetAnimUpdatecxx . . $ ObjSetAnimUpdate(fed6272ca188c09c).(i, &multi_anim_info); |
| 1322 | break; |
| 1323 | } |
| 1324 | |
| 1325 | case RT_SHARDcxx . . $ `Descent3/object_external.h:266:9`!: |
| 1326 | sindex = (int16_t)op->rtypecxx . . $ object#rtype..shard_infocxx . . $ object#$anonymous_type_10#shard_info..tmapcxx . . $ shard_info_s#tmap.; |
| 1327 | op->rtypecxx . . $ object#rtype..shard_infocxx . . $ object#$anonymous_type_10#shard_info..tmapcxx . . $ shard_info_s#tmap. = (sindex > -1) ? gs_Xlatescxx . . $ gs_Xlates.->tex_handlescxx . . $ gs_tables#tex_handles.[sindex] : -1; |
| 1328 | break; |
| 1329 | |
| 1330 | default: |
| 1331 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 1332 | } |
| 1333 | |
| 1334 | VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`!; |
| 1335 | |
| 1336 | //!! dynamic weapon battery info!! |
| 1337 | retval = LGSObjWBcxx . . $ LGSObjWB(31a7d9c7d80230b4).(fp, op); |
| 1338 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 1339 | goto lgsobjs_fail; |
| 1340 | |
| 1341 | VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`!; |
| 1342 | |
| 1343 | // save effect info! |
| 1344 | retval = LGSObjEffectscxx . . $ LGSObjEffects(31a7d9c7d80230b4).(fp, op); |
| 1345 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 1346 | goto lgsobjs_fail; |
| 1347 | |
| 1348 | VERIFY_SAVEFILEcxx . . $ `Descent3/loadstate.cpp:828:9`!; |
| 1349 | |
| 1350 | // save script stuff. |
| 1351 | if (Objectscxx . . $ Objects.[i].lighting_render_typecxx . . $ object#lighting_render_type. != LRT_LIGHTMAPScxx . . $ `Descent3/object.h:651:9`!) { |
| 1352 | // Don't init the scripts for an object with lightmaps, because it was never destroyed! |
| 1353 | InitObjectScriptscxx . . $ InitObjectScripts(674fac047436fc5b).(op); |
| 1354 | } |
| 1355 | |
| 1356 | // special case saves |
| 1357 | retval = LGSObjSpecialcxx . . $ LGSObjSpecial(31a7d9c7d80230b4).(fp, op); |
| 1358 | if (retval != LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!) |
| 1359 | goto lgsobjs_fail; |
| 1360 | |
| 1361 | // link into mine. |
| 1362 | // turn off big object flags if its a big object. (ObjLink will take care of this.) |
| 1363 | if (op->flagscxx . . $ object#flags. & OF_BIG_OBJECTcxx . . $ `Descent3/object_external.h:280:9`!) |
| 1364 | op->flagscxx . . $ object#flags. &= (~OF_BIG_OBJECTcxx . . $ `Descent3/object_external.h:280:9`!); |
| 1365 | |
| 1366 | op->roomnumcxx . . $ object#roomnum. = roomnum; //-1; |
| 1367 | // ObjLink(OBJNUM(op), roomnum); |
| 1368 | // ObjSetOrient(op, &objmat); |
| 1369 | } |
| 1370 | for (; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) { |
| 1371 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) { |
| 1372 | Osiris_DisableEventscxx . . $ Osiris_DisableEvents(ac50b47256ae7414).(OEM_OBJECTScxx . . $ `Descent3/osiris_dll.h:319:9`! | OEM_TRIGGERScxx . . $ `Descent3/osiris_dll.h:320:9`! | OEM_LEVELScxx . . $ `Descent3/osiris_dll.h:321:9`!); |
| 1373 | ObjDeletecxx . . $ ObjDelete(d4f767463ce0a6b3).(i); |
| 1374 | Osiris_EnableEventscxx . . $ Osiris_EnableEvents(ac50b47256ae7414).(OEM_OBJECTScxx . . $ `Descent3/osiris_dll.h:319:9`! | OEM_TRIGGERScxx . . $ `Descent3/osiris_dll.h:320:9`! | OEM_LEVELScxx . . $ `Descent3/osiris_dll.h:321:9`!); |
| 1375 | } |
| 1376 | } |
| 1377 | |
| 1378 | for (i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) { |
| 1379 | Objectscxx . . $ Objects.[i].nextcxx . . $ object#next. = -1; |
| 1380 | Objectscxx . . $ Objects.[i].prevcxx . . $ object#prev. = -1; |
| 1381 | } |
| 1382 | for (i = 0; i < MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!; i++) { |
| 1383 | Roomscxx . . $ Rooms.[i].objectscxx . . $ room#objects. = -1; |
| 1384 | } |
| 1385 | max_terr = TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!; |
| 1386 | for (i = 0; i < max_terr; i++) { |
| 1387 | Terrain_segcxx . . $ Terrain_seg.[i].objectscxx . . $ terrain_segment#objects. = -1; |
| 1388 | } |
| 1389 | inreadobjcxx . . $ inreadobj. = 0; |
| 1390 | Highest_object_indexcxx . . $ Highest_object_index. = highest_index; |
| 1391 | |
| 1392 | // CreateRoomObjects(); |
| 1393 | |
| 1394 | for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) { |
| 1395 | objectcxx . . $ object# *op = &Objectscxx . . $ Objects.[i]; |
| 1396 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) { |
| 1397 | int newroom = op->roomnumcxx . . $ object#roomnum.; |
| 1398 | op->roomnumcxx . . $ object#roomnum. = -1; |
| 1399 | ObjLinkcxx . . $ ObjLink(3e454b8ccf442868).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(op), newroom); |
| 1400 | ObjSetOrientcxx . . $ ObjSetOrient(e1367e0f901c991f).(op, &objmat[i]); |
| 1401 | if (op->typecxx . . $ object#type. == OBJ_ROOMcxx . . $ `Descent3/object_external.h:178:9`!) { |
| 1402 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Object %d is a room and Is%s a big object. Size=%f\n", i, (op->flags & OF_BIG_OBJECT) ? "" : "n't", op->size); |
| 1403 | if ((op->sizecxx . . $ object#size. >= ((TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`! * (float)1))) && !(op->flagscxx . . $ object#flags. & OF_BIG_OBJECTcxx . . $ `Descent3/object_external.h:280:9`!)) { |
| 1404 | BigObjAddcxx . . $ BigObjAdd(d4f767463ce0a6b3).(i); |
| 1405 | } |
| 1406 | |
| 1407 | ObjSetAABBcxx . . $ ObjSetAABB(419c470199a90a97).(op); |
| 1408 | } |
| 1409 | } |
| 1410 | /* |
| 1411 | if ((op->attach_ultimate_handle) && (OBJECT_HANDLE_NONE != op->attach_ultimate_handle)) { |
| 1412 | mprintf(0, "Object %d has an ultimate parent of %d (%d)\n", |
| 1413 | i, |
| 1414 | OBJNUM(ObjGet(op->attach_ultimate_handle)), |
| 1415 | op->attach_parent_handle); |
| 1416 | ASSERT(op->flags & OF_ATTACHED); |
| 1417 | } |
| 1418 | if ((op->attach_ultimate_handle) && (OBJECT_HANDLE_NONE != op->attach_parent_handle)) { |
| 1419 | mprintf(0, "Object %d has a parent of %d (%d)\n", |
| 1420 | i, |
| 1421 | OBJNUM(ObjGet(op->attach_parent_handle)), |
| 1422 | op->attach_parent_handle); |
| 1423 | ASSERT(op->flags & OF_ATTACHED); |
| 1424 | } |
| 1425 | */ |
| 1426 | } |
| 1427 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Objects[121].prev=%d\n", Objects[121].prev); |
| 1428 | ResetFreeObjectscxx . . $ ResetFreeObjects(49f6e7a06ebc5aa8).(); |
| 1429 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "highest obj index = %d, ", Highest_object_index); |
| 1430 | ObjReInitPositionHistorycxx . . $ ObjReInitPositionHistory(49f6e7a06ebc5aa8).(); |
| 1431 | |
| 1432 | END_VERIFY_SAVEFILEcxx . . $ `Descent3/gamesave.h:168:9`!(fp, "Objects load"); |
| 1433 | lgsobjs_fail: |
| 1434 | |
| 1435 | Osiris_EnableCreateEventscxx . . $ Osiris_EnableCreateEvents(49f6e7a06ebc5aa8).(); |
| 1436 | |
| 1437 | done:; |
| 1438 | |
| 1439 | mem_freecxx . . $ `mem/mem.h:80:9`!(objmat); |
| 1440 | |
| 1441 | return retval; |
| 1442 | } |
| 1443 | |
| 1444 | // loads ai |
| 1445 | int LGSObjAIcxx . . $ LGSObjAI(b3643b3a423eaee).(CFILEcxx . . $ CFILE# *fp, ai_framecxx . . $ ai_frame# **pai) { |
| 1446 | ai_framecxx . . $ ai_frame# *ai; |
| 1447 | int16_t size; |
| 1448 | int8_t read_ai; |
| 1449 | |
| 1450 | *pai = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1451 | |
| 1452 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, read_ai); |
| 1453 | if (!read_ai) |
| 1454 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 1455 | |
| 1456 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, size); |
| 1457 | if (size != sizeof(ai_framecxx . . $ ai_frame#)) |
| 1458 | return LGS_OUTDATEDVERcxx . . $ `Descent3/gamesave.h:138:9`!; |
| 1459 | |
| 1460 | *pai = (ai_framecxx . . $ ai_frame# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(size); |
| 1461 | ai = *pai; |
| 1462 | |
| 1463 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)ai, size, fp); |
| 1464 | |
| 1465 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 1466 | } |
| 1467 | |
| 1468 | // loads fx |
| 1469 | int LGSObjEffectscxx . . $ LGSObjEffects(31a7d9c7d80230b4).(CFILEcxx . . $ CFILE# *fp, objectcxx . . $ object# *op) { |
| 1470 | int16_t size; |
| 1471 | int8_t do_read; |
| 1472 | |
| 1473 | op->effect_infocxx . . $ object#effect_info. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1474 | |
| 1475 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, do_read); |
| 1476 | if (do_read) { |
| 1477 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, size); |
| 1478 | if (size != sizeof(effect_info_scxx . . $ effect_info_s#)) |
| 1479 | return LGS_OUTDATEDVERcxx . . $ `Descent3/gamesave.h:138:9`!; |
| 1480 | |
| 1481 | op->effect_infocxx . . $ object#effect_info. = (effect_info_scxx . . $ effect_info_s# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(size); |
| 1482 | effect_info_scxx . . $ effect_info_s# *ei = op->effect_infocxx . . $ object#effect_info.; |
| 1483 | |
| 1484 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)ei, size, fp); |
| 1485 | } |
| 1486 | |
| 1487 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 1488 | } |
| 1489 | |
| 1490 | //@@// loads script |
| 1491 | //@@vector *LGSScript(CFILE *fp, script_info *script, uint8_t *is_scripted, int *memsize) |
| 1492 | //@@{ |
| 1493 | //@@ int i; |
| 1494 | //@@ char name[64]; |
| 1495 | //@@ uint16_t nparms; |
| 1496 | //@@ tScriptParm *parms = NULL; |
| 1497 | //@@ |
| 1498 | //@@// ugh, write out script info. |
| 1499 | //@@ gs_ReadByte(fp, (*is_scripted)); |
| 1500 | //@@ |
| 1501 | //@@ cf_ReadString(name, sizeof(name), fp); |
| 1502 | //@@ if (name[0]) |
| 1503 | //@@ script->set_name(name); |
| 1504 | //@@ |
| 1505 | //@@ gs_ReadShort(fp, nparms); |
| 1506 | //@@ gs_ReadShort(fp, script->is_custom); |
| 1507 | //@@ if (nparms) |
| 1508 | //@@ parms = new tScriptParm[nparms]; |
| 1509 | //@@ |
| 1510 | //@@ for (i = 0; i < nparms; i++) |
| 1511 | //@@ { |
| 1512 | //@@ gs_ReadByte(fp, parms[i].type); |
| 1513 | //@@ gs_ReadFloat(fp, parms[i].val.x); |
| 1514 | //@@ gs_ReadFloat(fp, parms[i].val.y); |
| 1515 | //@@ gs_ReadFloat(fp, parms[i].val.z); |
| 1516 | //@@ } |
| 1517 | //@@ |
| 1518 | //@@ script->set_parms(nparms, parms); |
| 1519 | //@@ if (parms) |
| 1520 | //@@ delete[] parms; |
| 1521 | //@@ |
| 1522 | //@@// write out thread data if necessary |
| 1523 | //@@ vector *mem = NULL; |
| 1524 | //@@ *memsize = 0; |
| 1525 | //@@ if (*is_scripted) { |
| 1526 | //@@ int mem_size=0,j; |
| 1527 | //@@ |
| 1528 | //@@ gs_ReadShort(fp, mem_size); |
| 1529 | //@@ *memsize = mem_size; |
| 1530 | //@@ |
| 1531 | //@@ if (mem_size) { |
| 1532 | //@@ mem = new vector[mem_size]; |
| 1533 | //@@ for (j = 0; j < mem_size; j++) |
| 1534 | //@@ gs_ReadVector(fp, mem[j]); |
| 1535 | //@@ } |
| 1536 | //@@ } |
| 1537 | //@@ |
| 1538 | //@@ return mem; |
| 1539 | //@@} |
| 1540 | |
| 1541 | // loads fx |
| 1542 | int LGSObjWBcxx . . $ LGSObjWB(31a7d9c7d80230b4).(CFILEcxx . . $ CFILE# *fp, objectcxx . . $ object# *op) { |
| 1543 | dynamic_wb_infocxx . . $ dynamic_wb_info# *dwba = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1544 | int i; |
| 1545 | int8_t num_wbs; |
| 1546 | |
| 1547 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, num_wbs); |
| 1548 | if (!num_wbs) |
| 1549 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 1550 | |
| 1551 | dwba = (dynamic_wb_infocxx . . $ dynamic_wb_info# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(dynamic_wb_info) * num_wbs); |
| 1552 | |
| 1553 | for (i = 0; i < num_wbs; i++) { |
| 1554 | dynamic_wb_infocxx . . $ dynamic_wb_info# *dwb = &dwba[i]; |
| 1555 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)dwb, sizeof(dynamic_wb_infocxx . . $ dynamic_wb_info#), fp); |
| 1556 | } |
| 1557 | op->dynamic_wbcxx . . $ object#dynamic_wb. = dwba; |
| 1558 | |
| 1559 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 1560 | } |
| 1561 | |
| 1562 | // loads special object info |
| 1563 | int LGSObjSpecialcxx . . $ LGSObjSpecial(31a7d9c7d80230b4).(CFILEcxx . . $ CFILE# *fp, objectcxx . . $ object# *op) { |
| 1564 | int retval = LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 1565 | |
| 1566 | return retval; |
| 1567 | } |
| 1568 | |
| 1569 | // load spew |
| 1570 | int LGSSpewcxx . . $ LGSSpew(413716a422df0036).(CFILEcxx . . $ CFILE# *fp) { |
| 1571 | int i, count = 0; |
| 1572 | |
| 1573 | // read GLOBAL value |
| 1574 | gs_ReadShortcxx . . $ `Descent3/gamesave.h:185:9`!(fp, spew_count); |
| 1575 | |
| 1576 | for (i = 0; i < MAX_SPEW_EFFECTScxx . . $ `Descent3/spew.h:131:9`!; i++) { |
| 1577 | uint8_tcxx . . $ uint8_t# used; |
| 1578 | gs_ReadBytecxx . . $ `Descent3/gamesave.h:184:9`!(fp, used); |
| 1579 | if (used) |
| 1580 | cf_ReadBytescxx . . $ cf_ReadBytes(de6325ef3380a744).((uint8_tcxx . . $ uint8_t# *)&SpewEffectscxx . . $ SpewEffects.[i], sizeof(spewinfocxx . . $ spewinfo#), fp); |
| 1581 | } |
| 1582 | |
| 1583 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 1584 | } |
| 1585 | |
| 1586 | int LGSMatcenscxx . . $ LGSMatcens(413716a422df0036).(CFILEcxx . . $ CFILE# *fp) { |
| 1587 | int num_matcens = cf_ReadIntcxx . . $ cf_ReadInt(d60d6f5e30f0c96a).(fp); |
| 1588 | |
| 1589 | for (int i = 0; i < num_matcens; i++) { |
| 1590 | Matcencxx . . $ Matcen.[i]->LoadDatacxx . . $ matcen#LoadData(3639e799710acb68).(fp); |
| 1591 | } |
| 1592 | |
| 1593 | return LGS_OKcxx . . $ `Descent3/gamesave.h:136:9`!; |
| 1594 | } |
| 1595 | |
| 1596 | int LGSSnapshotcxx . . $ LGSSnapshot(413716a422df0036).(CFILEcxx . . $ CFILE# *fp) { |
| 1597 | int bm_handle = -1; |
| 1598 | int8_t valid_snapshot = 0; |
| 1599 | |
| 1600 | // get snapshot byte |
| 1601 | valid_snapshot = cf_ReadBytecxx . . $ cf_ReadByte(dcbbf0b0e13758ec).(fp); |
| 1602 | |
| 1603 | // if valid, read it in, otherwise just return |
| 1604 | if (valid_snapshot) { |
| 1605 | bm_handle = bm_AllocLoadBitmapcxx . . $ bm_AllocLoadBitmap(9615a1d56f56ba5b).(fp, 0); |
| 1606 | } |
| 1607 | |
| 1608 | return bm_handle; |
| 1609 | } |
| 1610 | |
| 1611 | //@@ // movement info. |
| 1612 | //@@ switch (op->movement_type) |
| 1613 | //@@ { |
| 1614 | //@@ case MT_SHOCKWAVE: |
| 1615 | //@@ { |
| 1616 | //@@ int16_t bound; |
| 1617 | //@@ gs_ReadShort(fp, bound); |
| 1618 | //@@ if (bound < (sizeof(op_wave->damaged_list)/sizeof(uint32_t))) { |
| 1619 | //@@ Int3(); |
| 1620 | //@@ retval = LGS_OUTDATEDVER; |
| 1621 | //@@ goto lgsobjs_fail; |
| 1622 | //@@ } |
| 1623 | //@@ for (j = 0; j < sizeof(op_wave->damaged_list)/sizeof(uint32_t); j++) |
| 1624 | //@@ gs_ReadInt(fp, (uint32_t)op_wave->damaged_list[j]); |
| 1625 | //@@ } |
| 1626 | //@@ break; |
| 1627 | //@@ default: |
| 1628 | //@@ gs_ReadVector(fp, op_phys->velocity); |
| 1629 | //@@ gs_ReadVector(fp, op_phys->thrust); |
| 1630 | //@@ gs_ReadVector(fp, op_phys->rotvel); |
| 1631 | //@@ gs_ReadVector(fp, op_phys->rotthrust); |
| 1632 | //@@ gs_ReadAngle(fp, op_phys->turnroll); |
| 1633 | //@@ gs_ReadFloat(fp, op_phys->last_still_time); |
| 1634 | //@@ gs_ReadInt(fp, op_phys->num_bounces); |
| 1635 | //@@ gs_ReadFloat(fp, op_phys->coeff_restitution); |
| 1636 | //@@ gs_ReadFloat(fp, op_phys->mass); |
| 1637 | //@@ gs_ReadFloat(fp, op_phys->drag); |
| 1638 | //@@ gs_ReadFloat(fp, op_phys->rotdrag); |
| 1639 | //@@ gs_ReadFloat(fp, op_phys->full_thrust); |
| 1640 | //@@ gs_ReadFloat(fp, op_phys->full_rotthrust); |
| 1641 | //@@ gs_ReadFloat(fp, op_phys->max_turnroll_rate); |
| 1642 | //@@ gs_ReadFloat(fp, op_phys->turnroll_ratio); |
| 1643 | //@@ gs_ReadFloat(fp, op_phys->wiggle_amplitude); |
| 1644 | //@@ gs_ReadFloat(fp, op_phys->wiggles_per_sec); |
| 1645 | //@@ gs_ReadVector(fp, op_phys->dest_pos); |
| 1646 | //@@ gs_ReadFloat(fp, op_phys->hit_die_dot); |
| 1647 | //@@ gs_ReadFloat(fp, op_phys->max_speed_time); |
| 1648 | //@@ gs_ReadInt(fp, op_phys->flags); |
| 1649 | //@@ } |
| 1650 | //@@ |
| 1651 | //@@ // don't need to load lightmap infomation. should be in object already at loadtime |
| 1652 | //@@ |
| 1653 | //@@ //Control info, determined by CONTROL_TYPE |
| 1654 | //@@ switch (op->control_type) |
| 1655 | //@@ { |
| 1656 | //@@ case CT_NONE: |
| 1657 | //@@ case CT_AI: |
| 1658 | //@@ case CT_FLYING: //the player is flying |
| 1659 | //@@ case CT_FLYTHROUGH: //the flythrough system |
| 1660 | //@@ case CT_SLEW: //slewing |
| 1661 | //@@ case CT_PARTICLE: //Particle |
| 1662 | //@@ break; |
| 1663 | //@@ case CT_EXPLOSION: //explosion sequencer |
| 1664 | //@@ gs_ReadFloat(fp, op_expl->spawn_time); |
| 1665 | //@@ gs_ReadFloat(fp, op_expl->delete_time); |
| 1666 | //@@ gs_ReadShort(fp, op_expl->delete_objnum); |
| 1667 | //@@ gs_ReadShort(fp, op_expl->attach_parent); |
| 1668 | //@@ gs_ReadShort(fp, op_expl->prev_attach); |
| 1669 | //@@ gs_ReadShort(fp, op_expl->next_attach); |
| 1670 | //@@ break; |
| 1671 | //@@ case CT_DEBRIS: //this is a piece of debris |
| 1672 | //@@ gs_ReadFloat(fp, op->ctype.dying_info.delay_time); |
| 1673 | //@@ gs_ReadBool(fp, op->ctype.dying_info.f_death_anim); |
| 1674 | //@@ break; |
| 1675 | //@@ case CT_POWERUP: //animating powerup blob |
| 1676 | //@@ gs_ReadInt(fp, op->ctype.powerup_info.count); |
| 1677 | //@@ gs_ReadInt(fp, op->ctype.powerup_info.flags); |
| 1678 | //@@ break; |
| 1679 | //@@ case CT_SPLINTER: //Splinter |
| 1680 | //@@ gs_ReadByte(fp, op_splint->subobj_num); |
| 1681 | //@@ gs_ReadShort(fp, op_splint->facenum); |
| 1682 | //@@ for (j = 0; j < MAX_VERTS_PER_SPLINTER; j++) |
| 1683 | //@@ gs_ReadVector(fp, op_splint->verts[j]); |
| 1684 | //@@ gs_ReadVector(fp, op_splint->center); |
| 1685 | //@@ break; |
| 1686 | //@@ case CT_WEAPON: //laser, etc. |
| 1687 | //@@ gs_ReadShort(fp, op_wpn->parent_type); |
| 1688 | //@@ gs_ReadShort(fp, op_wpn->src_gun_num); |
| 1689 | //@@ gs_ReadInt(fp, op_wpn->last_hit_handle); |
| 1690 | //@@ gs_ReadInt(fp, op_wpn->track_handle); |
| 1691 | //@@ gs_ReadInt(fp, op_wpn->hit_status); |
| 1692 | //@@ gs_ReadVector(fp, op_wpn->hit_pnt); |
| 1693 | //@@ gs_ReadVector(fp, op_wpn->hit_wall_pnt); |
| 1694 | //@@ gs_ReadVector(fp, op_wpn->hit_wall_normal); |
| 1695 | //@@ gs_ReadInt(fp, op_wpn->hit_room); |
| 1696 | //@@ gs_ReadInt(fp, op_wpn->hit_pnt_room); |
| 1697 | //@@ gs_ReadShort(fp, op_wpn->hit_face); |
| 1698 | //@@ gs_ReadFloat(fp, op_wpn->multiplier); |
| 1699 | //@@ gs_ReadFloat(fp, op_wpn->thrust_left); |
| 1700 | //@@ gs_ReadFloat(fp, op_wpn->last_drop_time); |
| 1701 | //@@ break; |
| 1702 | //@@ |
| 1703 | //@@ default: |
| 1704 | //@@ Int3(); |
| 1705 | //@@ } |
| 1706 | //@@ |
| 1707 | //@@ if (op->type == OBJ_FIREBALL) { |
| 1708 | //@@ gs_ReadFloat(fp,op->ctype.blast_info.max_size); |
| 1709 | //@@ gs_ReadInt(fp,index); |
| 1710 | //@@ op->ctype.blast_info.bm_handle = (index > -1) ? gs_Xlates->bm_handles[index] : -1; |
| 1711 | //@@ } |
| 1712 | |
| 1713 | // RENDER |
| 1714 | //@@ const int N_SHARD_VERTS = 3; |
| 1715 | //@@ switch (op->render_type) |
| 1716 | //@@ { |
| 1717 | //@@ case RT_NONE: |
| 1718 | //@@ case RT_EDITOR_SPHERE: |
| 1719 | //@@ case RT_FIREBALL: |
| 1720 | //@@ case RT_LINE: |
| 1721 | //@@ case RT_PARTICLE: |
| 1722 | //@@ case RT_SPLINTER: |
| 1723 | //@@ case RT_ROOM: |
| 1724 | //@@ break; |
| 1725 | //@@ case RT_WEAPON: |
| 1726 | //@@ if (!(op->flags & OF_POLYGON_OBJECT)) { |
| 1727 | //@@ PageInVClip (Weapons[op->id].fire_image_handle); |
| 1728 | //@@ break; |
| 1729 | //@@ } |
| 1730 | //@@ case RT_POLYOBJ: // be sure to use translated handles for |
| 1731 | // polyobjs and textures |
| 1732 | //@@ gs_ReadShort(fp, sindex); |
| 1733 | //@@ new_model = (sindex > -1) ? gs_Xlates->model_handles[sindex] : -1; |
| 1734 | //@@ if (new_model != pobji->model_num) |
| 1735 | //@@ PageInPolymodel (new_model, op->type, &op->size); |
| 1736 | //@@ pobji->model_num = new_model; |
| 1737 | //@@ |
| 1738 | //@@ gs_ReadShort(fp, sindex); |
| 1739 | //@@ new_model = (sindex > -1) ? gs_Xlates->model_handles[sindex] : -1; |
| 1740 | //@@ if (new_model != pobji->dying_model_num) |
| 1741 | //@@ PageInPolymodel (new_model, op->type, &op->size); |
| 1742 | //@@ pobji->dying_model_num = new_model; |
| 1743 | //@@ |
| 1744 | //@@ gs_ReadFloat(fp, pobji->anim_start_frame); |
| 1745 | //@@ gs_ReadFloat(fp, pobji->anim_frame); |
| 1746 | //@@ gs_ReadFloat(fp, pobji->anim_end_frame); |
| 1747 | //@@ gs_ReadFloat(fp, pobji->anim_time); |
| 1748 | //@@ gs_ReadInt(fp, pobji->anim_flags); |
| 1749 | //@@ gs_ReadFloat(fp, pobji->max_speed); |
| 1750 | //@@ gs_ReadInt(fp, pobji->subobj_flags); |
| 1751 | //@@ |
| 1752 | //@@ gs_ReadInt(fp, index); |
| 1753 | //@@ pobji->tmap_override = (index>-1) ? gs_Xlates->tex_handles[index] : -1; |
| 1754 | //@@ |
| 1755 | //@@ //!! multi_anim_save here |
| 1756 | //@@ // !@$()*# SAVE MULTI ANIM TURRET INFORMATION HERE $*#)(*)(! |
| 1757 | //@@ break; |
| 1758 | //@@ |
| 1759 | //@@ case RT_SHARD: |
| 1760 | //@@ for (j = 0; j < N_SHARD_VERTS; j++) |
| 1761 | //@@ gs_ReadVector(fp, op->rtype.shard_info.points[j]); |
| 1762 | //@@ for (j = 0; j < N_SHARD_VERTS; j++) |
| 1763 | //@@ gs_ReadFloat(fp, op->rtype.shard_info.u[j]); |
| 1764 | //@@ for (j = 0; j < N_SHARD_VERTS; j++) |
| 1765 | //@@ gs_ReadFloat(fp, op->rtype.shard_info.v[j]); |
| 1766 | //@@ gs_ReadVector(fp, op->rtype.shard_info.normal); |
| 1767 | //@@ gs_ReadShort(fp, sindex); |
| 1768 | //@@ op->rtype.shard_info.tmap = (sindex>-1) ? gs_Xlates->tex_handles[sindex] : -1; |
| 1769 | //@@ break; |
| 1770 | //@@ |
| 1771 | //@@ default: |
| 1772 | //@@ Int3(); |
| 1773 | //@@ } |
| 1774 | //@@ |
| 1775 | |
| 1776 | // AI |
| 1777 | //@@// the FUN begins. |
| 1778 | //@@ gs_ReadByte(fp, ai->ai_class); |
| 1779 | //@@ gs_ReadByte(fp, ai->ai_type); |
| 1780 | //@@ |
| 1781 | //@@// write path info |
| 1782 | //@@ ai_path_info *path = &ai->path; |
| 1783 | //@@ gs_ReadInt(fp, path->flags); |
| 1784 | //@@ gs_ReadShort(fp, path->cur_path); |
| 1785 | //@@ gs_ReadShort(fp, path->cur_node); |
| 1786 | //@@ gs_ReadShort(fp, path->num_paths); |
| 1787 | //@@ gs_ReadShort(fp, path->goal_index); |
| 1788 | //@@ |
| 1789 | //@@ for (i = 0; i < MAX_JOINED_PATHS; i++) |
| 1790 | //@@ { |
| 1791 | //@@ gs_ReadByte(fp, path->path_id[i]); |
| 1792 | //@@ gs_ReadByte(fp, path->path_type[i]); |
| 1793 | //@@ gs_ReadShort(fp, path->path_start_node[i]); |
| 1794 | //@@ gs_ReadShort(fp, path->path_end_node[i]); |
| 1795 | //@@ gs_ReadShort(fp, path->path_flags[i]); |
| 1796 | //@@ } |
| 1797 | //@@ |
| 1798 | //@@// continue |
| 1799 | //@@ gs_ReadFloat(fp, ai->max_velocity); |
| 1800 | //@@ gs_ReadFloat(fp, ai->max_delta_velocity); |
| 1801 | //@@ gs_ReadFloat(fp, ai->max_turn_rate); |
| 1802 | //@@ gs_ReadFloat(fp, ai->max_delta_turn_rate); |
| 1803 | //@@ gs_ReadFloat(fp, ai->attack_vel_percent); |
| 1804 | //@@ gs_ReadFloat(fp, ai->flee_vel_percent); |
| 1805 | //@@ gs_ReadFloat(fp, ai->dodge_vel_percent); |
| 1806 | //@@ gs_ReadFloat(fp, ai->circle_distance); |
| 1807 | //@@ gs_ReadFloat(fp, ai->dodge_percent); |
| 1808 | //@@ |
| 1809 | //@@ for (i = 0; i < 2; i++) |
| 1810 | //@@ { |
| 1811 | //@@ gs_ReadFloat(fp, ai->melee_damage[i]); |
| 1812 | //@@ gs_ReadFloat(fp, ai->melee_latency[i]); |
| 1813 | //@@ } |
| 1814 | //@@ |
| 1815 | //@@ for (i = 0; i < MAX_AI_SOUNDS; i++) |
| 1816 | //@@ { |
| 1817 | //@@ gs_ReadInt(fp, ai->sound[i]); |
| 1818 | //@@ gs_ReadFloat(fp, ai->last_sound_time[i]); |
| 1819 | //@@ } |
| 1820 | //@@ gs_ReadShort(fp, ai->last_played_sound_index); |
| 1821 | //@@ |
| 1822 | //@@ gs_ReadByte(fp, ai->movement_type); |
| 1823 | //@@ gs_ReadByte(fp, ai->movement_subtype); |
| 1824 | //@@ gs_ReadByte(fp, ai->animation_type); |
| 1825 | //@@ gs_ReadByte(fp, ai->next_animation_type); |
| 1826 | //@@ gs_ReadByte(fp, ai->next_movement); |
| 1827 | //@@ gs_ReadByte(fp, ai->current_wb_firing); |
| 1828 | //@@ gs_ReadByte(fp, ai->last_wb_firing); |
| 1829 | //@@ |
| 1830 | //@@// goals |
| 1831 | //@@ for (i = 0;i < MAX_GOALS; i++) |
| 1832 | //@@ { |
| 1833 | //@@ retval = LGSObjAIGoal(fp, &ai->goals[i]); |
| 1834 | //@@ if (retval != LGS_OK) goto lgsaigoal_fail; |
| 1835 | //@@ } |
| 1836 | //@@ |
| 1837 | //@@// continue |
| 1838 | //@@ gs_ReadInt(fp, ai->target_handle); |
| 1839 | //@@ gs_ReadFloat(fp, ai->next_target_update_time); |
| 1840 | //@@ gs_ReadFloat(fp, ai->dist_to_target); |
| 1841 | //@@ gs_ReadVector(fp, ai->vec_to_target); |
| 1842 | //@@ gs_ReadFloat(fp, ai->last_check_see_target_time); |
| 1843 | //@@ gs_ReadVector(fp, ai->last_see_target_pos); |
| 1844 | //@@ gs_ReadFloat(fp, ai->last_see_target_time); |
| 1845 | //@@ gs_ReadFloat(fp, ai->weapon_speed); |
| 1846 | //@@ gs_ReadFloat(fp, ai->next_melee_time); |
| 1847 | //@@ gs_ReadFloat(fp, ai->last_render_time); |
| 1848 | //@@ gs_ReadFloat(fp, ai->next_flinch_time); |
| 1849 | //@@ gs_ReadInt(fp, ai->status_reg); |
| 1850 | //@@ gs_ReadInt(fp, ai->flags); |
| 1851 | //@@ gs_ReadInt(fp, ai->notify_flags); |
| 1852 | //@@ |
| 1853 | //@@// notify events (MUST BE WRITTEN OUT AT A LATER DATE) |
| 1854 | //@@ |
| 1855 | //@@// Normalized movement and facing information |
| 1856 | //@@ gs_ReadVector(fp, ai->movement_dir); |
| 1857 | //@@ gs_ReadVector(fp, ai->rot_thrust_vector); |
| 1858 | //@@ gs_ReadFloat(fp, ai->fov); |
| 1859 | //@@ gs_ReadInt(fp, ai->anim_sound_handle); |
| 1860 | //@@ gs_ReadFloat(fp, ai->frustration); |
| 1861 | //@@ gs_ReadFloat(fp, ai->curiousity); |
| 1862 | //@@ gs_ReadFloat(fp, ai->fire_spread); |
| 1863 | //@@ gs_ReadFloat(fp, ai->agression); |
| 1864 | //@@ gs_ReadFloat(fp, ai->night_vision); |
| 1865 | //@@ gs_ReadFloat(fp, ai->fog_vision); |
| 1866 | //@@ gs_ReadFloat(fp, ai->lead_accuracy); |
| 1867 | //@@ gs_ReadFloat(fp, ai->lead_varience); |
| 1868 | //@@ gs_ReadFloat(fp, ai->fight_team); |
| 1869 | //@@ gs_ReadFloat(fp, ai->fight_same); |
| 1870 | //@@ gs_ReadFloat(fp, ai->hearing); |
| 1871 | //@@ gs_ReadFloat(fp, ai->roaming); |
| 1872 | //@@ gs_ReadFloat(fp, ai->life_preservation); |
| 1873 | //@@ gs_ReadShort(fp, ai->awareness); |
| 1874 | //@@ |
| 1875 | |
| 1876 | // saves ai goals |
| 1877 | //@@int LGSObjAIGoal(CFILE *fp, goal *g) |
| 1878 | //@@{ |
| 1879 | //@@ int i; |
| 1880 | //@@ int8_t used; |
| 1881 | //@@ |
| 1882 | //@@ gs_ReadByte(fp, used); |
| 1883 | //@@ g->used = used ? true : false; |
| 1884 | //@@ if (!g->used) |
| 1885 | //@@ return LGS_OK; |
| 1886 | //@@ |
| 1887 | //@@ gs_ReadInt(fp, g->type); |
| 1888 | //@@ gs_ReadByte(fp, g->activation_level); |
| 1889 | //@@ gs_ReadShort(fp, g->influence); |
| 1890 | //@@ |
| 1891 | //@@// write goal info |
| 1892 | //@@ switch (g->type) |
| 1893 | //@@ { |
| 1894 | //@@ case AIG_HIDE_FROM_OBJ: |
| 1895 | //@@ gs_ReadInt(fp, g->g_info.handle); |
| 1896 | //@@ gs_ReadFloat(fp, g->g_info.time); |
| 1897 | //@@ break; |
| 1898 | //@@ |
| 1899 | //@@ case AIG_WANDER_AROUND: |
| 1900 | //@@ gs_ReadInt(fp, g->g_info.roomnum); |
| 1901 | //@@ break; |
| 1902 | //@@ |
| 1903 | //@@ case AIG_DODGE_OBJ: |
| 1904 | //@@ case AIG_MOVE_RELATIVE_OBJ: |
| 1905 | //@@ gs_ReadInt(fp, g->g_info.handle); |
| 1906 | //@@ break; |
| 1907 | //@@ |
| 1908 | //@@ case AIG_MOVE_RELATIVE_OBJ_VEC: |
| 1909 | //@@ gs_ReadInt(fp, g->g_info.handle); |
| 1910 | //@@ gs_ReadInt(fp, g->g_info.subtype); |
| 1911 | //@@ break; |
| 1912 | //@@ |
| 1913 | //@@ case AIG_GUARD_AREA: |
| 1914 | //@@ gs_ReadVector(fp, g->g_info.pos); |
| 1915 | //@@ break; |
| 1916 | //@@ |
| 1917 | //@@ case AIG_GET_TO_OBJ: |
| 1918 | //@@ gs_ReadInt(fp, g->g_info.handle); |
| 1919 | //@@ gs_ReadVector(fp, g->g_info.pos); |
| 1920 | //@@ break; |
| 1921 | //@@ |
| 1922 | //@@ case AIG_GET_TO_POS: |
| 1923 | //@@ gs_ReadInt(fp, g->g_info.roomnum); |
| 1924 | //@@ gs_ReadVector(fp, g->g_info.pos); |
| 1925 | //@@ break; |
| 1926 | //@@ |
| 1927 | //@@ case AIG_FOLLOW_PATH: // This must be fixed -- chrishack |
| 1928 | //@@ gs_ReadInt(fp, g->g_info.id); |
| 1929 | //@@ break; |
| 1930 | //@@ } |
| 1931 | //@@ |
| 1932 | //@@// write goal enabler |
| 1933 | //@@ gs_ReadByte(fp, g->num_enablers); |
| 1934 | //@@ for (i = 0; i < g->num_enablers; i++) |
| 1935 | //@@ { |
| 1936 | //@@ gs_ReadByte(fp, g->enabler[i].enabler_type); |
| 1937 | //@@ |
| 1938 | //@@ switch (g->enabler[i].enabler_type) |
| 1939 | //@@ { |
| 1940 | //@@ case AIE_AI_STATUS_FLAG: |
| 1941 | //@@ gs_ReadInt(fp, g->enabler[i].flags); |
| 1942 | //@@ break; |
| 1943 | //@@ } |
| 1944 | //@@ |
| 1945 | //@@ gs_ReadFloat(fp, g->enabler[i].percent_enable); |
| 1946 | //@@ gs_ReadFloat(fp, g->enabler[i].check_interval); |
| 1947 | //@@ gs_ReadFloat(fp, g->enabler[i].last_check_time); |
| 1948 | //@@ gs_ReadByte(fp, g->enabler[i].bool_next_enabler_op); |
| 1949 | //@@ } |
| 1950 | //@@ |
| 1951 | //@@// continue |
| 1952 | //@@ gs_ReadFloat(fp, g->circle_distance); |
| 1953 | //@@ gs_ReadInt(fp, g->status_reg); |
| 1954 | //@@ gs_ReadFloat(fp, g->start_time); |
| 1955 | //@@ gs_ReadFloat(fp, g->next_path_time); |
| 1956 | //@@ gs_ReadFloat(fp, g->dist_to_goal); |
| 1957 | //@@ gs_ReadVector(fp, g->vec_to_target); |
| 1958 | //@@ gs_ReadFloat(fp, g->last_check_see_target_time); |
| 1959 | //@@ gs_ReadVector(fp, g->last_see_target_pos); |
| 1960 | //@@ gs_ReadFloat(fp, g->last_see_target_time); |
| 1961 | //@@ gs_ReadFloat(fp, g->next_target_update_time); |
| 1962 | //@@ gs_ReadShort(fp, g->flags); |
| 1963 | //@@ |
| 1964 | //@@ return LGS_OK; |
| 1965 | //@@} |
| 1966 | |
| 1967 | // Object effect_info |
| 1968 | //@@ gs_ReadInt(fp, ei->type_flags); |
| 1969 | //@@ gs_ReadFloat(fp, ei->alpha); |
| 1970 | //@@ |
| 1971 | //@@// if (op->type == OBJ_POWERUP) { |
| 1972 | //@@ gs_ReadFloat(fp, ei->last_object_hit_time); |
| 1973 | //@@ gs_ReadInt(fp, ei->last_object_hit); |
| 1974 | //@@// } |
| 1975 | //@@// if (ei->type_flags & EF_DEFORM) { |
| 1976 | //@@ gs_ReadFloat(fp, ei->deform_range); |
| 1977 | //@@ gs_ReadFloat(fp, ei->deform_time); |
| 1978 | //@@// } |
| 1979 | //@@// if (ei->type_flags & EF_VOLUME_CHANGING) { |
| 1980 | //@@ gs_ReadFloat(fp, ei->volume_change_time); |
| 1981 | //@@ gs_ReadVector(fp, ei->volume_old_pos); |
| 1982 | //@@ gs_ReadFloat(fp, ei->volume_old_room); |
| 1983 | //@@// } |
| 1984 | //@@// if (ei->type_flags & EF_VOLUME_LIT) { |
| 1985 | //@@ gs_ReadByte(fp, ei->dynamic_this_frame); |
| 1986 | //@@ gs_ReadFloat(fp, ei->dynamic_red); |
| 1987 | //@@ gs_ReadFloat(fp, ei->dynamic_green); |
| 1988 | //@@ gs_ReadFloat(fp, ei->dynamic_blue); |
| 1989 | //@@// } |
| 1990 | //@@// if (ei->type_flags & EF_CLOAKED) { |
| 1991 | //@@ gs_ReadFloat(fp, ei->cloak_time); |
| 1992 | //@@// } |
| 1993 | //@@// if (ei->type_flags & EF_COLORED) { |
| 1994 | //@@ gs_ReadFloat(fp, ei->color_time); |
| 1995 | //@@ gs_ReadFloat(fp, ei->r); |
| 1996 | //@@ gs_ReadFloat(fp, ei->g); |
| 1997 | //@@ gs_ReadFloat(fp, ei->b); |
| 1998 | //@@// } |
| 1999 | //@@// if (ei->type_flags & EF_NAPALMED) { |
| 2000 | //@@ gs_ReadFloat(fp, ei->damage_time); |
| 2001 | //@@ gs_ReadFloat(fp, ei->damage_per_second); |
| 2002 | //@@ gs_ReadFloat(fp, ei->last_damage_time); |
| 2003 | //@@ gs_ReadInt(fp, ei->damage_handle); |
| 2004 | //@@// } |
| 2005 | //@@// if (ei->type_flags & EF_FREEZE) { |
| 2006 | //@@ gs_ReadFloat(fp, ei->freeze_scalar); |
| 2007 | //@@// } |
| 2008 | //@@// if (ei->type_flags & EF_LINE_ATTACH) { |
| 2009 | //@@ gs_ReadInt(fp, ei->attach_line_handle); |
| 2010 | //@@// } |
| 2011 | //@@ } |
| 2012 | |
| 2013 | // Object WBs |
| 2014 | //@@ gs_ReadFloat(fp, dwb->last_fire_time); |
| 2015 | //@@ gs_ReadByte(fp, dwb->cur_firing_mask); |
| 2016 | //@@ |
| 2017 | //@@ for (j = 0; j < MAX_WB_TURRETS;j++) |
| 2018 | //@@ { |
| 2019 | //@@ gs_ReadFloat(fp, dwb->norm_turret_angle[j]); |
| 2020 | //@@ gs_ReadFloat(fp, dwb->turret_next_think_time[j]); |
| 2021 | //@@ gs_ReadByte(fp, dwb->turret_direction[j]); |
| 2022 | //@@ } |
| 2023 | //@@ |
| 2024 | //@@ gs_ReadByte(fp, dwb->wb_anim_mask); |
| 2025 | //@@ gs_ReadFloat(fp, dwb->wb_anim_frame); |
| 2026 | //@@ gs_ReadVector(fp, dwb->cur_target); |
| 2027 | //@@ gs_ReadByte(fp, dwb->upgrade_level); |
| 2028 | //@@ gs_ReadInt(fp, dwb->flags); |