| 1 |
/* Emacs style mode select -*- C -*- |
| 2 |
*----------------------------------------------------------------------------- |
| 3 |
* |
| 4 |
* |
| 5 |
* PrBoom: a Doom port merged with LxDoom and LSDLDoom |
| 6 |
* based on BOOM, a modified and improved DOOM engine |
| 7 |
* Copyright (C) 1999 by |
| 8 |
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman |
| 9 |
* Copyright (C) 1999-2000 by |
| 10 |
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze |
| 11 |
* Copyright 2005, 2006 by |
| 12 |
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko |
| 13 |
* |
| 14 |
* This program is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU General Public License |
| 16 |
* as published by the Free Software Foundation; either version 2 |
| 17 |
* of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 27 |
* 02111-1307, USA. |
| 28 |
* |
| 29 |
* DESCRIPTION: |
| 30 |
* Archiving: SaveGame I/O. |
| 31 |
* |
| 32 |
*-----------------------------------------------------------------------------*/ |
| 33 |
|
| 34 |
#include <stdint.h> |
| 35 |
|
| 36 |
#include "doomstat.h" |
| 37 |
#include "r_main.h" |
| 38 |
#include "p_maputl.h" |
| 39 |
#include "p_spec.h" |
| 40 |
#include "p_tick.h" |
| 41 |
#include "p_saveg.h" |
| 42 |
#include "m_random.h" |
| 43 |
#include "am_map.h" |
| 44 |
#include "p_enemy.h" |
| 45 |
#include "lprintf.h" |
| 46 |
#include "s_advsound.h" |
| 47 |
#include "e6y.h"//e6y |
| 48 |
|
| 49 |
#include "hexen/a_action.h" |
| 50 |
#include "hexen/p_acs.h" |
| 51 |
#include "hexen/p_anim.h" |
| 52 |
#include "hexen/po_man.h" |
| 53 |
#include "hexen/sn_sonix.h" |
| 54 |
#include "hexen/sv_save.h" |
| 55 |
|
| 56 |
#include "dsda/ambient.h" |
| 57 |
#include "dsda/map_format.h" |
| 58 |
#include "dsda/msecnode.h" |
| 59 |
#include "dsda/scroll.h" |
| 60 |
#include "dsda/tranmap.h" |
| 61 |
#include "dsda/utility.h" |
| 62 |
|
| 63 |
#define MARKED_FOR_DELETION -2 |
| 64 |
|
| 65 |
#define SAVEGAMESIZE 0x20000 |
| 66 |
|
| 67 |
byte *save_p; |
| 68 |
byte *savebuffer; |
| 69 |
static int savegamesize; |
| 70 |
|
| 71 |
// Check for overrun and realloc if necessary -- Lee Killough 1/22/98 |
| 72 |
void CheckSaveGame(size_t size) |
| 73 |
{ |
| 74 |
size_t offset = save_p - savebuffer; |
| 75 |
|
| 76 |
if (offset + size <= savegamesize) |
| 77 |
{ |
| 78 |
return; |
| 79 |
} |
| 80 |
|
| 81 |
while (offset + size > savegamesize) |
| 82 |
{ |
| 83 |
savegamesize *= 2; |
| 84 |
} |
| 85 |
|
| 86 |
savebuffer = Z_Realloc(savebuffer, savegamesize); |
| 87 |
save_p = savebuffer + offset; |
| 88 |
} |
| 89 |
|
| 90 |
void P_InitSaveBuffer(void) |
| 91 |
{ |
| 92 |
savegamesize = SAVEGAMESIZE; |
| 93 |
save_p = savebuffer = Z_Malloc(savegamesize); |
| 94 |
} |
| 95 |
|
| 96 |
void P_ForgetSaveBuffer(void) |
| 97 |
{ |
| 98 |
save_p = savebuffer = NULL; |
| 99 |
} |
| 100 |
|
| 101 |
void P_FreeSaveBuffer(void) |
| 102 |
{ |
| 103 |
Z_Free(savebuffer); |
| 104 |
P_ForgetSaveBuffer(); |
| 105 |
} |
| 106 |
|
| 107 |
// |
| 108 |
// P_ArchivePlayers |
| 109 |
// |
| 110 |
void P_ArchivePlayers (void) |
| 111 |
{ |
| 112 |
int i; |
| 113 |
|
| 114 |
for (i = 0; i < g_maxplayers; i++) |
| 115 |
if (playeringame[i]) |
| 116 |
{ |
| 117 |
int j; |
| 118 |
player_t *dest; |
| 119 |
|
| 120 |
P_SAVE_TYPE_REF(&players[i], dest, player_t); |
| 121 |
for (j=0; j<NUMPSPRITES; j++) |
| 122 |
if (dest->psprites[j].state) |
| 123 |
dest->psprites[j].state = |
| 124 |
(state_t *)(dest->psprites[j].state-states); |
| 125 |
} |
| 126 |
} |
| 127 |
|
| 128 |
// |
| 129 |
// P_UnArchivePlayers |
| 130 |
// |
| 131 |
void P_UnArchivePlayers (void) |
| 132 |
{ |
| 133 |
int i; |
| 134 |
|
| 135 |
for (i = 0; i < g_maxplayers; i++) |
| 136 |
if (playeringame[i]) |
| 137 |
{ |
| 138 |
int j; |
| 139 |
|
| 140 |
P_LOAD_X(players[i]); |
| 141 |
|
| 142 |
// will be set when unarc thinker |
| 143 |
players[i].mo = NULL; |
| 144 |
players[i].attacker = NULL; |
| 145 |
// HERETIC_TODO: does the rain need to be remembered? |
| 146 |
players[i].rain1 = NULL; |
| 147 |
players[i].rain2 = NULL; |
| 148 |
|
| 149 |
// hexen_note: poisoner not reloaded |
| 150 |
players[i].poisoner = NULL; |
| 151 |
|
| 152 |
for (j=0 ; j<NUMPSPRITES ; j++) |
| 153 |
if (players[i]. psprites[j].state) |
| 154 |
players[i]. psprites[j].state = |
| 155 |
&states[ (size_t)players[i].psprites[j].state ]; |
| 156 |
} |
| 157 |
} |
| 158 |
|
| 159 |
|
| 160 |
// |
| 161 |
// P_ArchiveWorld |
| 162 |
// |
| 163 |
void P_ArchiveWorld (void) |
| 164 |
{ |
| 165 |
int i; |
| 166 |
const sector_t *sec; |
| 167 |
const line_t *li; |
| 168 |
const side_t *si; |
| 169 |
|
| 170 |
for (i = 0, sec = sectors; i < numsectors; i++, sec++) |
| 171 |
{ |
| 172 |
P_SAVE_X(sec->floorheight); |
| 173 |
P_SAVE_X(sec->ceilingheight); |
| 174 |
P_SAVE_X(sec->floorpic); |
| 175 |
P_SAVE_X(sec->ceilingpic); |
| 176 |
P_SAVE_X(sec->lightlevel); |
| 177 |
P_SAVE_X(sec->special); |
| 178 |
P_SAVE_X(sec->tag); |
| 179 |
P_SAVE_X(sec->seqType); |
| 180 |
P_SAVE_X(sec->flags); |
| 181 |
|
| 182 |
// zdoom |
| 183 |
P_SAVE_X(sec->gravity); |
| 184 |
P_SAVE_X(sec->damage); |
| 185 |
P_SAVE_X(sec->lightlevel_floor); |
| 186 |
P_SAVE_X(sec->lightlevel_ceiling); |
| 187 |
P_SAVE_X(sec->floor_rotation); |
| 188 |
P_SAVE_X(sec->ceiling_rotation); |
| 189 |
P_SAVE_X(sec->floor_xscale); |
| 190 |
P_SAVE_X(sec->floor_yscale); |
| 191 |
P_SAVE_X(sec->ceiling_xscale); |
| 192 |
P_SAVE_X(sec->ceiling_yscale); |
| 193 |
P_SAVE_X(sec->floor_xoffs); |
| 194 |
P_SAVE_X(sec->floor_yoffs); |
| 195 |
P_SAVE_X(sec->ceiling_xoffs); |
| 196 |
P_SAVE_X(sec->ceiling_yoffs); |
| 197 |
} |
| 198 |
|
| 199 |
for (i = 0, li = lines; i < numlines; i++, li++) |
| 200 |
{ |
| 201 |
int j; |
| 202 |
|
| 203 |
P_SAVE_X(li->flags); |
| 204 |
P_SAVE_X(li->special); |
| 205 |
P_SAVE_X(li->tag); |
| 206 |
P_SAVE_BYTE(li->player_activations); |
| 207 |
P_SAVE_ARRAY(li->special_args); |
| 208 |
|
| 209 |
// zdoom |
| 210 |
P_SAVE_X(li->automap_style); |
| 211 |
P_SAVE_X(li->health); |
| 212 |
P_SAVE_X(li->alpha); |
| 213 |
|
| 214 |
for (j = 0; j < 2; j++) |
| 215 |
if (li->sidenum[j] != NO_INDEX) |
| 216 |
{ |
| 217 |
si = &sides[li->sidenum[j]]; |
| 218 |
|
| 219 |
P_SAVE_X(si->textureoffset); |
| 220 |
P_SAVE_X(si->rowoffset); |
| 221 |
P_SAVE_X(si->toptexture); |
| 222 |
P_SAVE_X(si->bottomtexture); |
| 223 |
P_SAVE_X(si->midtexture); |
| 224 |
|
| 225 |
if (map_format.zdoom) |
| 226 |
{ |
| 227 |
P_SAVE_X(si->textureoffset_top); |
| 228 |
P_SAVE_X(si->textureoffset_mid); |
| 229 |
P_SAVE_X(si->textureoffset_bottom); |
| 230 |
P_SAVE_X(si->rowoffset_top); |
| 231 |
P_SAVE_X(si->rowoffset_mid); |
| 232 |
P_SAVE_X(si->rowoffset_bottom); |
| 233 |
P_SAVE_X(si->scalex_top); |
| 234 |
P_SAVE_X(si->scaley_top); |
| 235 |
P_SAVE_X(si->scalex_mid); |
| 236 |
P_SAVE_X(si->scaley_mid); |
| 237 |
P_SAVE_X(si->scalex_bottom); |
| 238 |
P_SAVE_X(si->scaley_bottom); |
| 239 |
P_SAVE_X(si->lightlevel); |
| 240 |
P_SAVE_X(si->lightlevel_top); |
| 241 |
P_SAVE_X(si->lightlevel_mid); |
| 242 |
P_SAVE_X(si->lightlevel_bottom); |
| 243 |
P_SAVE_X(si->flags); |
| 244 |
} |
| 245 |
} |
| 246 |
} |
| 247 |
|
| 248 |
P_SAVE_X(musinfo.current_item); |
| 249 |
} |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
// |
| 254 |
// P_UnArchiveWorld |
| 255 |
// |
| 256 |
void P_UnArchiveWorld (void) |
| 257 |
{ |
| 258 |
int i; |
| 259 |
sector_t *sec; |
| 260 |
line_t *li; |
| 261 |
|
| 262 |
for (i = 0, sec = sectors; i < numsectors; i++, sec++) |
| 263 |
{ |
| 264 |
P_LOAD_X(sec->floorheight); |
| 265 |
P_LOAD_X(sec->ceilingheight); |
| 266 |
P_LOAD_X(sec->floorpic); |
| 267 |
P_LOAD_X(sec->ceilingpic); |
| 268 |
P_LOAD_X(sec->lightlevel); |
| 269 |
P_LOAD_X(sec->special); |
| 270 |
P_LOAD_X(sec->tag); |
| 271 |
P_LOAD_X(sec->seqType); |
| 272 |
P_LOAD_X(sec->flags); |
| 273 |
|
| 274 |
// zdoom |
| 275 |
P_LOAD_X(sec->gravity); |
| 276 |
P_LOAD_X(sec->damage); |
| 277 |
P_LOAD_X(sec->lightlevel_floor); |
| 278 |
P_LOAD_X(sec->lightlevel_ceiling); |
| 279 |
P_LOAD_X(sec->floor_rotation); |
| 280 |
P_LOAD_X(sec->ceiling_rotation); |
| 281 |
P_LOAD_X(sec->floor_xscale); |
| 282 |
P_LOAD_X(sec->floor_yscale); |
| 283 |
P_LOAD_X(sec->ceiling_xscale); |
| 284 |
P_LOAD_X(sec->ceiling_yscale); |
| 285 |
P_LOAD_X(sec->floor_xoffs); |
| 286 |
P_LOAD_X(sec->floor_yoffs); |
| 287 |
P_LOAD_X(sec->ceiling_xoffs); |
| 288 |
P_LOAD_X(sec->ceiling_yoffs); |
| 289 |
|
| 290 |
sec->ceilingdata = 0; //jff 2/22/98 now three thinker fields, not two |
| 291 |
sec->floordata = 0; |
| 292 |
sec->lightingdata = 0; |
| 293 |
sec->soundtarget = 0; |
| 294 |
} |
| 295 |
|
| 296 |
// do lines |
| 297 |
for (i = 0, li = lines; i < numlines; i++, li++) |
| 298 |
{ |
| 299 |
int j; |
| 300 |
|
| 301 |
P_LOAD_X(li->flags); |
| 302 |
P_LOAD_X(li->special); |
| 303 |
P_LOAD_X(li->tag); |
| 304 |
P_LOAD_BYTE(li->player_activations); |
| 305 |
P_LOAD_ARRAY(li->special_args); |
| 306 |
|
| 307 |
// zdoom |
| 308 |
P_LOAD_X(li->automap_style); |
| 309 |
P_LOAD_X(li->health); |
| 310 |
P_LOAD_X(li->alpha); |
| 311 |
|
| 312 |
if (li->alpha < 1.f) |
| 313 |
li->tranmap = dsda_TranMap(dsda_FloatToPercent(li->alpha)); |
| 314 |
|
| 315 |
for (j = 0; j < 2; j++) |
| 316 |
if (li->sidenum[j] != NO_INDEX) |
| 317 |
{ |
| 318 |
side_t *si = &sides[li->sidenum[j]]; |
| 319 |
|
| 320 |
P_LOAD_X(si->textureoffset); |
| 321 |
P_LOAD_X(si->rowoffset); |
| 322 |
P_LOAD_X(si->toptexture); |
| 323 |
P_LOAD_X(si->bottomtexture); |
| 324 |
P_LOAD_X(si->midtexture); |
| 325 |
|
| 326 |
// zdoom |
| 327 |
if (map_format.zdoom) |
| 328 |
{ |
| 329 |
P_LOAD_X(si->textureoffset_top); |
| 330 |
P_LOAD_X(si->textureoffset_mid); |
| 331 |
P_LOAD_X(si->textureoffset_bottom); |
| 332 |
P_LOAD_X(si->rowoffset_top); |
| 333 |
P_LOAD_X(si->rowoffset_mid); |
| 334 |
P_LOAD_X(si->rowoffset_bottom); |
| 335 |
P_LOAD_X(si->scalex_top); |
| 336 |
P_LOAD_X(si->scaley_top); |
| 337 |
P_LOAD_X(si->scalex_mid); |
| 338 |
P_LOAD_X(si->scaley_mid); |
| 339 |
P_LOAD_X(si->scalex_bottom); |
| 340 |
P_LOAD_X(si->scaley_bottom); |
| 341 |
P_LOAD_X(si->lightlevel); |
| 342 |
P_LOAD_X(si->lightlevel_top); |
| 343 |
P_LOAD_X(si->lightlevel_mid); |
| 344 |
P_LOAD_X(si->lightlevel_bottom); |
| 345 |
P_LOAD_X(si->flags); |
| 346 |
} |
| 347 |
} |
| 348 |
} |
| 349 |
|
| 350 |
P_LOAD_X(musinfo.current_item); |
| 351 |
} |
| 352 |
|
| 353 |
// |
| 354 |
// Thinkers |
| 355 |
// |
| 356 |
|
| 357 |
// phares 9/13/98: Moved this code outside of P_ArchiveThinkers so the |
| 358 |
// thinker indices could be used by the code that saves sector info. |
| 359 |
|
| 360 |
static int number_of_thinkers; |
| 361 |
|
| 362 |
static dboolean P_IsMobjThinker(thinker_t* thinker) |
| 363 |
{ |
| 364 |
return thinker->function == P_MobjThinker || |
| 365 |
thinker->function == P_BlasterMobjThinker || |
| 366 |
(thinker->function == P_RemoveThinkerDelayed && thinker->references); |
| 367 |
} |
| 368 |
|
| 369 |
static void P_ReplaceMobjWithIndex(mobj_t **mobj) |
| 370 |
{ |
| 371 |
if (*mobj) |
| 372 |
{ |
| 373 |
*mobj = P_IsMobjThinker(&(*mobj)->thinker) ? |
| 374 |
(mobj_t *) (*mobj)->thinker.prev : |
| 375 |
NULL; |
| 376 |
} |
| 377 |
} |
| 378 |
|
| 379 |
/* |
| 380 |
* killough 11/98 |
| 381 |
* |
| 382 |
* Same as P_SetTarget() in p_tick.c, except that the target is nullified |
| 383 |
* first, so that no old target's reference count is decreased (when loading |
| 384 |
* savegames, old targets are indices, not really pointers to targets). |
| 385 |
*/ |
| 386 |
|
| 387 |
static void P_SetNewTarget(mobj_t **mop, mobj_t *targ) |
| 388 |
{ |
| 389 |
*mop = NULL; |
| 390 |
P_SetTarget(mop, targ); |
| 391 |
} |
| 392 |
|
| 393 |
// savegame file stores ints in the corresponding * field; this function |
| 394 |
// safely casts them back to int. |
| 395 |
int P_GetMobj(mobj_t* mi, size_t s) |
| 396 |
{ |
| 397 |
size_t i = (size_t)mi; |
| 398 |
if (i >= s) |
| 399 |
I_Error("Corrupt savegame"); |
| 400 |
return i; |
| 401 |
} |
| 402 |
|
| 403 |
static void P_ReplaceIndexWithMobj(mobj_t **mobj, mobj_t **mobj_p, int mobj_count) |
| 404 |
{ |
| 405 |
P_SetNewTarget( |
| 406 |
mobj, |
| 407 |
mobj_p[ |
| 408 |
P_GetMobj(*mobj, mobj_count + 1) |
| 409 |
] |
| 410 |
); |
| 411 |
} |
| 412 |
|
| 413 |
void P_ThinkerToIndex(void) |
| 414 |
{ |
| 415 |
thinker_t *th; |
| 416 |
|
| 417 |
// killough 2/14/98: |
| 418 |
// count the number of thinkers, and mark each one with its index, using |
| 419 |
// the prev field as a placeholder, since it can be restored later. |
| 420 |
|
| 421 |
number_of_thinkers = 0; |
| 422 |
for (th = thinkercap.next ; th != &thinkercap ; th=th->next) |
| 423 |
if (P_IsMobjThinker(th)) |
| 424 |
th->prev = (thinker_t *)(intptr_t) ++number_of_thinkers; |
| 425 |
} |
| 426 |
|
| 427 |
// phares 9/13/98: Moved this code outside of P_ArchiveThinkers so the |
| 428 |
// thinker indices could be used by the code that saves sector info. |
| 429 |
|
| 430 |
void P_IndexToThinker(void) |
| 431 |
{ |
| 432 |
// killough 2/14/98: restore prev pointers |
| 433 |
thinker_t *th; |
| 434 |
thinker_t *prev = &thinkercap; |
| 435 |
|
| 436 |
for (th = thinkercap.next ; th != &thinkercap ; prev=th, th=th->next) |
| 437 |
th->prev = prev; |
| 438 |
} |
| 439 |
|
| 440 |
// killough 2/16/98: save/restore random number generator state information |
| 441 |
|
| 442 |
void P_ArchiveRNG(void) |
| 443 |
{ |
| 444 |
P_SAVE_X(rng); |
| 445 |
} |
| 446 |
|
| 447 |
void P_UnArchiveRNG(void) |
| 448 |
{ |
| 449 |
P_LOAD_X(rng); |
| 450 |
} |
| 451 |
|
| 452 |
// killough 2/22/98: Save/restore automap state |
| 453 |
// killough 2/22/98: Save/restore automap state |
| 454 |
void P_ArchiveMap(void) |
| 455 |
{ |
| 456 |
int i; |
| 457 |
|
| 458 |
P_SAVE_X(automap_active); |
| 459 |
P_SAVE_X(markpointnum); |
| 460 |
|
| 461 |
for (i = 0; i < markpointnum; i++) |
| 462 |
{ |
| 463 |
P_SAVE_X(markpoints[i].x); |
| 464 |
P_SAVE_X(markpoints[i].y); |
| 465 |
} |
| 466 |
} |
| 467 |
|
| 468 |
void P_UnArchiveMap(void) |
| 469 |
{ |
| 470 |
P_LOAD_X(automap_active); |
| 471 |
|
| 472 |
if (automap_active) |
| 473 |
AM_Start(true); |
| 474 |
|
| 475 |
P_LOAD_X(markpointnum); |
| 476 |
|
| 477 |
if (markpointnum) |
| 478 |
{ |
| 479 |
int i; |
| 480 |
while (markpointnum >= markpointnum_max) |
| 481 |
markpoints = Z_Realloc(markpoints, sizeof *markpoints * |
| 482 |
(markpointnum_max = markpointnum_max ? markpointnum_max*2 : 16)); |
| 483 |
|
| 484 |
for (i = 0; i < markpointnum; i++) |
| 485 |
{ |
| 486 |
P_LOAD_X(markpoints[i].x); |
| 487 |
P_LOAD_X(markpoints[i].y); |
| 488 |
|
| 489 |
AM_setMarkParams(i); |
| 490 |
} |
| 491 |
} |
| 492 |
} |
| 493 |
|
| 494 |
void P_ArchiveThinkerSubclass(th_class class) |
| 495 |
{ |
| 496 |
int count; |
| 497 |
thinker_t *cap, *th; |
| 498 |
|
| 499 |
count = 0; |
| 500 |
cap = &thinkerclasscap[class]; |
| 501 |
for (th = cap->cnext; th != cap; th = th->cnext) |
| 502 |
count++; |
| 503 |
|
| 504 |
P_SAVE_X(count); |
| 505 |
|
| 506 |
for (th = cap->cnext; th != cap; th = th->cnext) |
| 507 |
{ |
| 508 |
P_SAVE_X(th->prev); |
| 509 |
} |
| 510 |
} |
| 511 |
|
| 512 |
void P_ArchiveThinkerSubclasses(void) |
| 513 |
{ |
| 514 |
// Other subclass ordering is not relevant |
| 515 |
P_ArchiveThinkerSubclass(th_friends); |
| 516 |
P_ArchiveThinkerSubclass(th_enemies); |
| 517 |
} |
| 518 |
|
| 519 |
void P_UnArchiveThinkerSubclass(th_class class, mobj_t** mobj_p, int mobj_count) |
| 520 |
{ |
| 521 |
int i; |
| 522 |
int count; |
| 523 |
|
| 524 |
// Reset thinker subclass list |
| 525 |
thinkerclasscap[class].cprev->cnext = thinkerclasscap[class].cnext; |
| 526 |
thinkerclasscap[class].cnext->cprev = thinkerclasscap[class].cprev; |
| 527 |
thinkerclasscap[class].cprev = |
| 528 |
thinkerclasscap[class].cnext = &thinkerclasscap[class]; |
| 529 |
|
| 530 |
P_LOAD_X(count); |
| 531 |
|
| 532 |
for (i = 0; i < count; ++i) |
| 533 |
{ |
| 534 |
thinker_t* th; |
| 535 |
mobj_t* mobj; |
| 536 |
|
| 537 |
P_LOAD_X(mobj); |
| 538 |
|
| 539 |
mobj = mobj_p[P_GetMobj(mobj, mobj_count + 1)]; |
| 540 |
|
| 541 |
if (mobj) |
| 542 |
{ |
| 543 |
// remove mobj from current subclass list |
| 544 |
th = mobj->thinker.cnext; |
| 545 |
if (th != NULL) |
| 546 |
{ |
| 547 |
th->cprev = mobj->thinker.cprev; |
| 548 |
th->cprev->cnext = th; |
| 549 |
} |
| 550 |
|
| 551 |
th = &thinkerclasscap[class]; |
| 552 |
th->cprev->cnext = &mobj->thinker; |
| 553 |
mobj->thinker.cnext = th; |
| 554 |
mobj->thinker.cprev = th->cprev; |
| 555 |
th->cprev = &mobj->thinker; |
| 556 |
} |
| 557 |
else |
| 558 |
{ |
| 559 |
I_Error("P_UnArchiveThinkerSubclass: mobj does not exist!\n"); |
| 560 |
} |
| 561 |
} |
| 562 |
} |
| 563 |
|
| 564 |
void P_UnArchiveThinkerSubclasses(mobj_t** mobj_p, int mobj_count) |
| 565 |
{ |
| 566 |
P_UnArchiveThinkerSubclass(th_friends, mobj_p, mobj_count); |
| 567 |
P_UnArchiveThinkerSubclass(th_enemies, mobj_p, mobj_count); |
| 568 |
} |
| 569 |
|
| 570 |
extern mobj_t** blocklinks; |
| 571 |
extern int blocklinks_count; |
| 572 |
extern int bmapwidth; |
| 573 |
extern int bmapheight; |
| 574 |
|
| 575 |
void P_ArchiveBlockLinks(void) |
| 576 |
{ |
| 577 |
int i; |
| 578 |
|
| 579 |
for (i = 0; i < blocklinks_count; ++i) |
| 580 |
{ |
| 581 |
int count = 0; |
| 582 |
mobj_t* mobj; |
| 583 |
|
| 584 |
mobj = blocklinks[i]; |
| 585 |
while (mobj) |
| 586 |
{ |
| 587 |
++count; |
| 588 |
mobj = mobj->bnext; |
| 589 |
} |
| 590 |
|
| 591 |
P_SAVE_X(count); |
| 592 |
|
| 593 |
mobj = blocklinks[i]; |
| 594 |
while (mobj) |
| 595 |
{ |
| 596 |
P_SAVE_X(mobj->thinker.prev); |
| 597 |
mobj = mobj->bnext; |
| 598 |
} |
| 599 |
} |
| 600 |
} |
| 601 |
|
| 602 |
void P_UnArchiveBlockLinks(mobj_t** mobj_p, int mobj_count) |
| 603 |
{ |
| 604 |
int i; |
| 605 |
int size; |
| 606 |
|
| 607 |
size = bmapwidth * bmapheight; |
| 608 |
|
| 609 |
for (i = 0; i < size; ++i) |
| 610 |
{ |
| 611 |
int j; |
| 612 |
int count; |
| 613 |
mobj_t* mobj; |
| 614 |
mobj_t** bprev; |
| 615 |
|
| 616 |
P_LOAD_X(count); |
| 617 |
|
| 618 |
blocklinks[i] = NULL; |
| 619 |
bprev = &blocklinks[i]; |
| 620 |
for (j = 0; j < count; ++j) |
| 621 |
{ |
| 622 |
P_LOAD_X(mobj); |
| 623 |
|
| 624 |
mobj = mobj_p[P_GetMobj(mobj, mobj_count + 1)]; |
| 625 |
|
| 626 |
if (mobj) |
| 627 |
{ |
| 628 |
*bprev = mobj; |
| 629 |
mobj->bprev = bprev; |
| 630 |
mobj->bnext = NULL; |
| 631 |
bprev = &mobj->bnext; |
| 632 |
} |
| 633 |
else |
| 634 |
{ |
| 635 |
I_Error("P_UnArchiveBlockLinks: mobj does not exist!\n"); |
| 636 |
} |
| 637 |
} |
| 638 |
} |
| 639 |
} |
| 640 |
|
| 641 |
static dboolean P_IsPolyObjThinker(thinker_t *th) |
| 642 |
{ |
| 643 |
return th->function == T_RotatePoly || th->function == T_MovePoly || th->function == T_PolyDoor; |
| 644 |
} |
| 645 |
|
| 646 |
void P_ArchivePolyObjSpecialData(void) |
| 647 |
{ |
| 648 |
thinker_t *th; |
| 649 |
|
| 650 |
if (!map_format.polyobjs) return; |
| 651 |
|
| 652 |
for (th = thinkercap.next ; th != &thinkercap ; th=th->next) |
| 653 |
{ |
| 654 |
if (P_IsPolyObjThinker(th)) |
| 655 |
{ |
| 656 |
int i; |
| 657 |
int count = 0; |
| 658 |
|
| 659 |
for (i = 0; i < po_NumPolyobjs; ++i) |
| 660 |
{ |
| 661 |
if (polyobjs[i].specialdata == th) |
| 662 |
++count; |
| 663 |
} |
| 664 |
|
| 665 |
P_SAVE_X(count); |
| 666 |
|
| 667 |
for (i = 0; i < po_NumPolyobjs; ++i) |
| 668 |
{ |
| 669 |
if (polyobjs[i].specialdata == th) |
| 670 |
{ |
| 671 |
P_SAVE_X(i); |
| 672 |
} |
| 673 |
} |
| 674 |
} |
| 675 |
} |
| 676 |
} |
| 677 |
|
| 678 |
void P_UnArchivePolyObjSpecialData(void) |
| 679 |
{ |
| 680 |
thinker_t *th; |
| 681 |
|
| 682 |
if (!map_format.polyobjs) return; |
| 683 |
|
| 684 |
for (th = thinkercap.next ; th != &thinkercap ; th=th->next) |
| 685 |
{ |
| 686 |
if (P_IsPolyObjThinker(th)) |
| 687 |
{ |
| 688 |
int i; |
| 689 |
int count; |
| 690 |
|
| 691 |
P_LOAD_X(count); |
| 692 |
|
| 693 |
for (i = 0; i < count; ++i) |
| 694 |
{ |
| 695 |
int j; |
| 696 |
|
| 697 |
P_LOAD_X(j); |
| 698 |
|
| 699 |
polyobjs[j].specialdata = th; |
| 700 |
} |
| 701 |
} |
| 702 |
} |
| 703 |
} |
| 704 |
|
| 705 |
// dsda - fix save / load synchronization |
| 706 |
// merges thinkerclass_t and specials_e |
| 707 |
typedef enum { |
| 708 |
tc_mobj, |
| 709 |
tc_ceiling, |
| 710 |
tc_door, |
| 711 |
tc_floor, |
| 712 |
tc_plat, |
| 713 |
tc_flash, |
| 714 |
tc_strobe, |
| 715 |
tc_glow, |
| 716 |
tc_zdoom_glow, |
| 717 |
tc_elevator, |
| 718 |
tc_scroll_side, |
| 719 |
tc_scroll_side_control, |
| 720 |
tc_scroll_floor, |
| 721 |
tc_scroll_floor_control, |
| 722 |
tc_scroll_ceiling, |
| 723 |
tc_scroll_ceiling_control, |
| 724 |
tc_scroll_floor_carry, |
| 725 |
tc_scroll_floor_carry_control, |
| 726 |
tc_zdoom_scroll_floor, |
| 727 |
tc_zdoom_scroll_ceiling, |
| 728 |
tc_thrust, |
| 729 |
tc_pusher, |
| 730 |
tc_flicker, |
| 731 |
tc_zdoom_flicker, |
| 732 |
tc_friction, |
| 733 |
tc_light, |
| 734 |
tc_phase, |
| 735 |
tc_acs, |
| 736 |
tc_pillar, |
| 737 |
tc_floor_waggle, |
| 738 |
tc_ceiling_waggle, |
| 739 |
tc_poly_rotate, |
| 740 |
tc_poly_move, |
| 741 |
tc_poly_door, |
| 742 |
tc_quake, |
| 743 |
tc_ambient_source, |
| 744 |
tc_button, |
| 745 |
tc_end |
| 746 |
} true_thinkerclass_t; |
| 747 |
|
| 748 |
// dsda - fix save / load synchronization |
| 749 |
// merges P_ArchiveThinkers & P_ArchiveSpecials |
| 750 |
void P_ArchiveThinkers(void) { |
| 751 |
thinker_t *th; |
| 752 |
|
| 753 |
P_SAVE_X(brain); |
| 754 |
|
| 755 |
// save off the current thinkers |
| 756 |
for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { |
| 757 |
if (!th->function) |
| 758 |
{ |
| 759 |
platlist_t *pl; |
| 760 |
ceilinglist_t *cl; //jff 2/22/98 add iter variable for ceilings |
| 761 |
|
| 762 |
// killough 2/8/98: fix plat original height bug. |
| 763 |
// Since acv==NULL, this could be a plat in stasis. |
| 764 |
// so check the active plats list, and save this |
| 765 |
// plat (jff: or ceiling) even if it is in stasis. |
| 766 |
|
| 767 |
for (pl=activeplats; pl; pl=pl->next) |
| 768 |
if (pl->plat == (plat_t *) th) // killough 2/14/98 |
| 769 |
goto plat; |
| 770 |
|
| 771 |
for (cl=activeceilings; cl; cl=cl->next) |
| 772 |
if (cl->ceiling == (ceiling_t *) th) //jff 2/22/98 |
| 773 |
goto ceiling; |
| 774 |
|
| 775 |
continue; |
| 776 |
} |
| 777 |
|
| 778 |
if (th->function == T_MoveCeiling) |
| 779 |
{ |
| 780 |
ceiling_t *ceiling; |
| 781 |
ceiling: // killough 2/14/98 |
| 782 |
P_SAVE_BYTE(tc_ceiling); |
| 783 |
P_SAVE_TYPE_REF(th, ceiling, ceiling_t); |
| 784 |
ceiling->sector = (sector_t *)(intptr_t)(ceiling->sector->iSectorID); |
| 785 |
continue; |
| 786 |
} |
| 787 |
|
| 788 |
if (th->function == T_VerticalDoor) |
| 789 |
{ |
| 790 |
vldoor_t *door; |
| 791 |
P_SAVE_BYTE(tc_door); |
| 792 |
P_SAVE_TYPE_REF(th, door, vldoor_t); |
| 793 |
door->sector = (sector_t *)(intptr_t)(door->sector->iSectorID); |
| 794 |
//jff 1/31/98 archive line remembered by door as well |
| 795 |
door->line = (line_t *) (door->line ? door->line-lines : -1); |
| 796 |
continue; |
| 797 |
} |
| 798 |
|
| 799 |
if (th->function == T_MoveFloor) |
| 800 |
{ |
| 801 |
floormove_t *floor; |
| 802 |
P_SAVE_BYTE(tc_floor); |
| 803 |
P_SAVE_TYPE_REF(th, floor, floormove_t); |
| 804 |
floor->sector = (sector_t *)(intptr_t)(floor->sector->iSectorID); |
| 805 |
continue; |
| 806 |
} |
| 807 |
|
| 808 |
if (th->function == T_PlatRaise) |
| 809 |
{ |
| 810 |
plat_t *plat; |
| 811 |
plat: // killough 2/14/98: added fix for original plat height above |
| 812 |
P_SAVE_BYTE(tc_plat); |
| 813 |
P_SAVE_TYPE_REF(th, plat, plat_t); |
| 814 |
plat->sector = (sector_t *)(intptr_t)(plat->sector->iSectorID); |
| 815 |
continue; |
| 816 |
} |
| 817 |
|
| 818 |
if (th->function == T_LightFlash) |
| 819 |
{ |
| 820 |
lightflash_t *flash; |
| 821 |
P_SAVE_BYTE(tc_flash); |
| 822 |
P_SAVE_TYPE_REF(th, flash, lightflash_t); |
| 823 |
flash->sector = (sector_t *)(intptr_t)(flash->sector->iSectorID); |
| 824 |
continue; |
| 825 |
} |
| 826 |
|
| 827 |
if (th->function == T_StrobeFlash) |
| 828 |
{ |
| 829 |
strobe_t *strobe; |
| 830 |
P_SAVE_BYTE(tc_strobe); |
| 831 |
P_SAVE_TYPE_REF(th, strobe, strobe_t); |
| 832 |
strobe->sector = (sector_t *)(intptr_t)(strobe->sector->iSectorID); |
| 833 |
continue; |
| 834 |
} |
| 835 |
|
| 836 |
if (th->function == T_Glow) |
| 837 |
{ |
| 838 |
glow_t *glow; |
| 839 |
P_SAVE_BYTE(tc_glow); |
| 840 |
P_SAVE_TYPE_REF(th, glow, glow_t); |
| 841 |
glow->sector = (sector_t *)(intptr_t)(glow->sector->iSectorID); |
| 842 |
continue; |
| 843 |
} |
| 844 |
|
| 845 |
if (th->function == T_ZDoom_Glow) |
| 846 |
{ |
| 847 |
zdoom_glow_t *glow; |
| 848 |
P_SAVE_BYTE(tc_zdoom_glow); |
| 849 |
P_SAVE_TYPE_REF(th, glow, zdoom_glow_t); |
| 850 |
glow->sector = (sector_t *)(intptr_t)(glow->sector->iSectorID); |
| 851 |
continue; |
| 852 |
} |
| 853 |
|
| 854 |
// killough 10/4/98: save flickers |
| 855 |
if (th->function == T_FireFlicker) |
| 856 |
{ |
| 857 |
fireflicker_t *flicker; |
| 858 |
P_SAVE_BYTE(tc_flicker); |
| 859 |
P_SAVE_TYPE_REF(th, flicker, fireflicker_t); |
| 860 |
flicker->sector = (sector_t *)(intptr_t)(flicker->sector->iSectorID); |
| 861 |
continue; |
| 862 |
} |
| 863 |
|
| 864 |
if (th->function == T_ZDoom_Flicker) |
| 865 |
{ |
| 866 |
zdoom_flicker_t *flicker; |
| 867 |
P_SAVE_BYTE(tc_zdoom_flicker); |
| 868 |
P_SAVE_TYPE_REF(th, flicker, zdoom_flicker_t); |
| 869 |
flicker->sector = (sector_t *)(intptr_t)(flicker->sector->iSectorID); |
| 870 |
continue; |
| 871 |
} |
| 872 |
|
| 873 |
//jff 2/22/98 new case for elevators |
| 874 |
if (th->function == T_MoveElevator) |
| 875 |
{ |
| 876 |
elevator_t *elevator; //jff 2/22/98 |
| 877 |
P_SAVE_BYTE(tc_elevator); |
| 878 |
P_SAVE_TYPE_REF(th, elevator, elevator_t); |
| 879 |
elevator->sector = (sector_t *)(intptr_t)(elevator->sector->iSectorID); |
| 880 |
continue; |
| 881 |
} |
| 882 |
|
| 883 |
if (th->function == dsda_UpdateSideScroller) |
| 884 |
{ |
| 885 |
P_SAVE_BYTE(tc_scroll_side); |
| 886 |
P_SAVE_TYPE(th, scroll_t); |
| 887 |
continue; |
| 888 |
} |
| 889 |
|
| 890 |
if (th->function == dsda_UpdateFloorScroller) |
| 891 |
{ |
| 892 |
P_SAVE_BYTE(tc_scroll_floor); |
| 893 |
P_SAVE_TYPE(th, scroll_t); |
| 894 |
continue; |
| 895 |
} |
| 896 |
|
| 897 |
if (th->function == dsda_UpdateCeilingScroller) |
| 898 |
{ |
| 899 |
P_SAVE_BYTE(tc_scroll_ceiling); |
| 900 |
P_SAVE_TYPE(th, scroll_t); |
| 901 |
continue; |
| 902 |
} |
| 903 |
|
| 904 |
if (th->function == dsda_UpdateFloorCarryScroller) |
| 905 |
{ |
| 906 |
P_SAVE_BYTE(tc_scroll_floor_carry); |
| 907 |
P_SAVE_TYPE(th, scroll_t); |
| 908 |
continue; |
| 909 |
} |
| 910 |
|
| 911 |
if (th->function == dsda_UpdateZDoomFloorScroller) |
| 912 |
{ |
| 913 |
P_SAVE_BYTE(tc_zdoom_scroll_floor); |
| 914 |
P_SAVE_TYPE(th, scroll_t); |
| 915 |
continue; |
| 916 |
} |
| 917 |
|
| 918 |
if (th->function == dsda_UpdateZDoomCeilingScroller) |
| 919 |
{ |
| 920 |
P_SAVE_BYTE(tc_zdoom_scroll_ceiling); |
| 921 |
P_SAVE_TYPE(th, scroll_t); |
| 922 |
continue; |
| 923 |
} |
| 924 |
|
| 925 |
if (th->function == dsda_UpdateThruster) |
| 926 |
{ |
| 927 |
P_SAVE_BYTE(tc_thrust); |
| 928 |
P_SAVE_TYPE(th, scroll_t); |
| 929 |
continue; |
| 930 |
} |
| 931 |
|
| 932 |
if (th->function == dsda_UpdateControlSideScroller) |
| 933 |
{ |
| 934 |
P_SAVE_BYTE(tc_scroll_side_control); |
| 935 |
P_SAVE_TYPE(th, control_scroll_t); |
| 936 |
continue; |
| 937 |
} |
| 938 |
|
| 939 |
if (th->function == dsda_UpdateControlFloorScroller) |
| 940 |
{ |
| 941 |
P_SAVE_BYTE(tc_scroll_floor_control); |
| 942 |
P_SAVE_TYPE(th, control_scroll_t); |
| 943 |
continue; |
| 944 |
} |
| 945 |
|
| 946 |
if (th->function == dsda_UpdateControlCeilingScroller) |
| 947 |
{ |
| 948 |
P_SAVE_BYTE(tc_scroll_ceiling_control); |
| 949 |
P_SAVE_TYPE(th, control_scroll_t); |
| 950 |
continue; |
| 951 |
} |
| 952 |
|
| 953 |
if (th->function == dsda_UpdateControlFloorCarryScroller) |
| 954 |
{ |
| 955 |
P_SAVE_BYTE(tc_scroll_floor_carry_control); |
| 956 |
P_SAVE_TYPE(th, control_scroll_t); |
| 957 |
continue; |
| 958 |
} |
| 959 |
|
| 960 |
// phares 3/22/98: Push/Pull effect thinkers |
| 961 |
|
| 962 |
if (th->function == T_Pusher) |
| 963 |
{ |
| 964 |
P_SAVE_BYTE(tc_pusher); |
| 965 |
P_SAVE_TYPE(th, pusher_t); |
| 966 |
continue; |
| 967 |
} |
| 968 |
|
| 969 |
if (th->function == T_Friction) |
| 970 |
{ |
| 971 |
P_SAVE_BYTE(tc_friction); |
| 972 |
P_SAVE_TYPE(th, friction_t); |
| 973 |
continue; |
| 974 |
} |
| 975 |
|
| 976 |
if (th->function == T_Light) |
| 977 |
{ |
| 978 |
light_t *light; |
| 979 |
P_SAVE_BYTE(tc_light); |
| 980 |
P_SAVE_TYPE_REF(th, light, light_t); |
| 981 |
light->sector = (sector_t *)(intptr_t)(light->sector->iSectorID); |
| 982 |
continue; |
| 983 |
} |
| 984 |
|
| 985 |
if (th->function == T_Phase) |
| 986 |
{ |
| 987 |
phase_t *phase; |
| 988 |
P_SAVE_BYTE(tc_phase); |
| 989 |
P_SAVE_TYPE_REF(th, phase, phase_t); |
| 990 |
phase->sector = (sector_t *)(intptr_t)(phase->sector->iSectorID); |
| 991 |
continue; |
| 992 |
} |
| 993 |
|
| 994 |
if (th->function == T_InterpretACS) |
| 995 |
{ |
| 996 |
acs_t *acs; |
| 997 |
P_SAVE_BYTE(tc_acs); |
| 998 |
P_SAVE_TYPE_REF(th, acs, acs_t); |
| 999 |
P_ReplaceMobjWithIndex(&acs->activator); |
| 1000 |
acs->line = (line_t *) (acs->line ? acs->line - lines : -1); |
| 1001 |
|
| 1002 |
continue; |
| 1003 |
} |
| 1004 |
|
| 1005 |
if (th->function == T_BuildPillar) |
| 1006 |
{ |
| 1007 |
pillar_t *pillar; |
| 1008 |
P_SAVE_BYTE(tc_pillar); |
| 1009 |
P_SAVE_TYPE_REF(th, pillar, pillar_t); |
| 1010 |
pillar->sector = (sector_t *)(intptr_t)(pillar->sector->iSectorID); |
| 1011 |
continue; |
| 1012 |
} |
| 1013 |
|
| 1014 |
if (th->function == T_FloorWaggle) |
| 1015 |
{ |
| 1016 |
planeWaggle_t *floor_waggle; |
| 1017 |
P_SAVE_BYTE(tc_floor_waggle); |
| 1018 |
P_SAVE_TYPE_REF(th, floor_waggle, planeWaggle_t); |
| 1019 |
floor_waggle->sector = (sector_t *)(intptr_t)(floor_waggle->sector->iSectorID); |
| 1020 |
continue; |
| 1021 |
} |
| 1022 |
|
| 1023 |
if (th->function == T_CeilingWaggle) |
| 1024 |
{ |
| 1025 |
planeWaggle_t *ceiling_waggle; |
| 1026 |
P_SAVE_BYTE(tc_ceiling_waggle); |
| 1027 |
P_SAVE_TYPE_REF(th, ceiling_waggle, planeWaggle_t); |
| 1028 |
ceiling_waggle->sector = (sector_t *)(intptr_t)(ceiling_waggle->sector->iSectorID); |
| 1029 |
continue; |
| 1030 |
} |
| 1031 |
|
| 1032 |
if (th->function == T_RotatePoly) |
| 1033 |
{ |
| 1034 |
P_SAVE_BYTE(tc_poly_rotate); |
| 1035 |
P_SAVE_TYPE(th, polyevent_t); |
| 1036 |
continue; |
| 1037 |
} |
| 1038 |
|
| 1039 |
if (th->function == T_MovePoly) |
| 1040 |
{ |
| 1041 |
P_SAVE_BYTE(tc_poly_move); |
| 1042 |
P_SAVE_TYPE(th, polyevent_t); |
| 1043 |
continue; |
| 1044 |
} |
| 1045 |
|
| 1046 |
if (th->function == T_PolyDoor) |
| 1047 |
{ |
| 1048 |
P_SAVE_BYTE(tc_poly_door); |
| 1049 |
P_SAVE_TYPE(th, polydoor_t); |
| 1050 |
continue; |
| 1051 |
} |
| 1052 |
|
| 1053 |
if (th->function == dsda_UpdateQuake) |
| 1054 |
{ |
| 1055 |
quake_t *quake; |
| 1056 |
P_SAVE_BYTE(tc_quake); |
| 1057 |
P_SAVE_TYPE_REF(th, quake, quake_t); |
| 1058 |
P_ReplaceMobjWithIndex(&quake->location); |
| 1059 |
continue; |
| 1060 |
} |
| 1061 |
|
| 1062 |
if (th->function == dsda_UpdateAmbientSource) |
| 1063 |
{ |
| 1064 |
ambient_source_t *ambient_source; |
| 1065 |
P_SAVE_BYTE(tc_ambient_source); |
| 1066 |
P_SAVE_TYPE_REF(th, ambient_source, ambient_source_t); |
| 1067 |
P_ReplaceMobjWithIndex(&ambient_source->mobj); |
| 1068 |
continue; |
| 1069 |
} |
| 1070 |
|
| 1071 |
if (P_IsMobjThinker(th)) |
| 1072 |
{ |
| 1073 |
mobj_t *mobj; |
| 1074 |
|
| 1075 |
P_SAVE_BYTE(tc_mobj); |
| 1076 |
P_SAVE_TYPE_REF(th, mobj, mobj_t); |
| 1077 |
|
| 1078 |
mobj->state = (state_t *)(mobj->state - states); |
| 1079 |
|
| 1080 |
// Example: |
| 1081 |
// - Archvile is attacking a lost soul |
| 1082 |
// - The lost soul dies before the attack hits |
| 1083 |
// - The lost soul is marked for deletion |
| 1084 |
// - The archvile will still attack the spot where the lost soul was |
| 1085 |
// - We need to save such objects and remember they are marked for deletion |
| 1086 |
if (mobj->thinker.function == P_RemoveThinkerDelayed) |
| 1087 |
mobj->index = MARKED_FOR_DELETION; |
| 1088 |
|
| 1089 |
// killough 2/14/98: convert pointers into indices. |
| 1090 |
// Fixes many savegame problems, by properly saving |
| 1091 |
// target and tracer fields. Note: we store NULL if |
| 1092 |
// the thinker pointed to by these fields is not a |
| 1093 |
// mobj thinker. |
| 1094 |
|
| 1095 |
P_ReplaceMobjWithIndex(&mobj->target); |
| 1096 |
P_ReplaceMobjWithIndex(&mobj->tracer); |
| 1097 |
|
| 1098 |
// killough 2/14/98: new field: save last known enemy. Prevents |
| 1099 |
// monsters from going to sleep after killing monsters and not |
| 1100 |
// seeing player anymore. |
| 1101 |
|
| 1102 |
P_ReplaceMobjWithIndex(&mobj->lastenemy); |
| 1103 |
|
| 1104 |
// killough 2/14/98: end changes |
| 1105 |
|
| 1106 |
if (raven) |
| 1107 |
{ |
| 1108 |
P_ReplaceMobjWithIndex(&mobj->special1.m); |
| 1109 |
P_ReplaceMobjWithIndex(&mobj->special2.m); |
| 1110 |
} |
| 1111 |
|
| 1112 |
if (mobj->player) |
| 1113 |
mobj->player = (player_t *)((mobj->player-players) + 1); |
| 1114 |
} |
| 1115 |
} |
| 1116 |
|
| 1117 |
for (int i = 0; i < MAXBUTTONS; i++) |
| 1118 |
{ |
| 1119 |
if (buttonlist[i].btimer != 0) |
| 1120 |
{ |
| 1121 |
button_t *button; |
| 1122 |
P_SAVE_BYTE(tc_button); |
| 1123 |
P_SAVE_TYPE_REF(&buttonlist[i], button, button_t); |
| 1124 |
button->line = (line_t *)(button->line - lines); |
| 1125 |
} |
| 1126 |
} |
| 1127 |
|
| 1128 |
// add a terminating marker |
| 1129 |
P_SAVE_BYTE(tc_end); |
| 1130 |
|
| 1131 |
P_ArchivePolyObjSpecialData(); |
| 1132 |
|
| 1133 |
// killough 9/14/98: save soundtargets |
| 1134 |
{ |
| 1135 |
int i; |
| 1136 |
for (i = 0; i < numsectors; i++) |
| 1137 |
{ |
| 1138 |
mobj_t *target = sectors[i].soundtarget; |
| 1139 |
// Fix crash on reload when a soundtarget points to a removed corpse |
| 1140 |
// (prboom bug #1590350) |
| 1141 |
P_ReplaceMobjWithIndex(&target); |
| 1142 |
P_SAVE_X(target); |
| 1143 |
} |
| 1144 |
} |
| 1145 |
|
| 1146 |
P_ArchiveBlockLinks(); |
| 1147 |
P_ArchiveThinkerSubclasses(); |
| 1148 |
|
| 1149 |
dsda_ArchiveMSecNodes(); |
| 1150 |
} |
| 1151 |
|
| 1152 |
// dsda - fix save / load synchronization |
| 1153 |
// merges P_UnArchiveThinkers & P_UnArchiveSpecials |
| 1154 |
void P_UnArchiveThinkers(void) { |
| 1155 |
thinker_t *th; |
| 1156 |
mobj_t **mobj_p; // killough 2/14/98: Translation table |
| 1157 |
int mobj_count; // killough 2/14/98: size of or index into table |
| 1158 |
true_thinkerclass_t tc; |
| 1159 |
|
| 1160 |
totallive = 0; |
| 1161 |
|
| 1162 |
// killough 3/26/98: Load boss brain state |
| 1163 |
P_LOAD_X(brain); |
| 1164 |
|
| 1165 |
// remove all the current thinkers |
| 1166 |
for (th = thinkercap.next; th != &thinkercap; ) |
| 1167 |
{ |
| 1168 |
thinker_t *next = th->next; |
| 1169 |
if (P_IsMobjThinker(th)) |
| 1170 |
{ |
| 1171 |
P_RemoveMobj ((mobj_t *) th); |
| 1172 |
P_RemoveThinkerDelayed(th); // fix mobj leak |
| 1173 |
} |
| 1174 |
else |
| 1175 |
Z_Free (th); |
| 1176 |
th = next; |
| 1177 |
} |
| 1178 |
P_InitThinkers (); |
| 1179 |
|
| 1180 |
// killough 2/14/98: count number of thinkers by skipping through them |
| 1181 |
{ |
| 1182 |
byte *sp; // save pointer and skip header |
| 1183 |
|
| 1184 |
sp = save_p; |
| 1185 |
mobj_count = 0; |
| 1186 |
|
| 1187 |
while (true) |
| 1188 |
{ |
| 1189 |
P_LOAD_BYTE(tc); |
| 1190 |
if (tc == tc_end) |
| 1191 |
break; |
| 1192 |
|
| 1193 |
if (tc == tc_mobj) mobj_count++; |
| 1194 |
save_p += |
| 1195 |
tc == tc_ceiling ? sizeof(ceiling_t) : |
| 1196 |
tc == tc_door ? sizeof(vldoor_t) : |
| 1197 |
tc == tc_floor ? sizeof(floormove_t) : |
| 1198 |
tc == tc_plat ? sizeof(plat_t) : |
| 1199 |
tc == tc_flash ? sizeof(lightflash_t) : |
| 1200 |
tc == tc_strobe ? sizeof(strobe_t) : |
| 1201 |
tc == tc_glow ? sizeof(glow_t) : |
| 1202 |
tc == tc_zdoom_glow ? sizeof(zdoom_glow_t) : |
| 1203 |
tc == tc_elevator ? sizeof(elevator_t) : |
| 1204 |
tc == tc_scroll_side ? sizeof(scroll_t) : |
| 1205 |
tc == tc_scroll_floor ? sizeof(scroll_t) : |
| 1206 |
tc == tc_scroll_ceiling ? sizeof(scroll_t) : |
| 1207 |
tc == tc_scroll_floor_carry ? sizeof(scroll_t) : |
| 1208 |
tc == tc_zdoom_scroll_floor ? sizeof(scroll_t) : |
| 1209 |
tc == tc_zdoom_scroll_ceiling ? sizeof(scroll_t) : |
| 1210 |
tc == tc_thrust ? sizeof(scroll_t) : |
| 1211 |
tc == tc_scroll_side_control ? sizeof(control_scroll_t) : |
| 1212 |
tc == tc_scroll_floor_control ? sizeof(control_scroll_t) : |
| 1213 |
tc == tc_scroll_ceiling_control ? sizeof(control_scroll_t) : |
| 1214 |
tc == tc_scroll_floor_carry_control ? sizeof(control_scroll_t) : |
| 1215 |
tc == tc_pusher ? sizeof(pusher_t) : |
| 1216 |
tc == tc_flicker ? sizeof(fireflicker_t) : |
| 1217 |
tc == tc_zdoom_flicker ? sizeof(zdoom_flicker_t) : |
| 1218 |
tc == tc_friction ? sizeof(friction_t) : |
| 1219 |
tc == tc_light ? sizeof(light_t) : |
| 1220 |
tc == tc_phase ? sizeof(phase_t) : |
| 1221 |
tc == tc_acs ? sizeof(acs_t) : |
| 1222 |
tc == tc_pillar ? sizeof(pillar_t) : |
| 1223 |
tc == tc_floor_waggle ? sizeof(planeWaggle_t) : |
| 1224 |
tc == tc_ceiling_waggle ? sizeof(planeWaggle_t) : |
| 1225 |
tc == tc_poly_rotate ? sizeof(polyevent_t) : |
| 1226 |
tc == tc_poly_move ? sizeof(polyevent_t) : |
| 1227 |
tc == tc_poly_door ? sizeof(polydoor_t) : |
| 1228 |
tc == tc_quake ? sizeof(quake_t) : |
| 1229 |
tc == tc_ambient_source ? sizeof(ambient_source_t) : |
| 1230 |
tc == tc_mobj ? sizeof(mobj_t) : |
| 1231 |
tc == tc_button ? sizeof(button_t) : |
| 1232 |
0; |
| 1233 |
} |
| 1234 |
|
| 1235 |
if (*--save_p != tc_end) |
| 1236 |
I_Error ("P_UnArchiveThinkers: Unknown tc %i in size calculation", *save_p); |
| 1237 |
|
| 1238 |
// first table entry special: 0 maps to NULL |
| 1239 |
*(mobj_p = Z_Malloc((mobj_count + 1) * sizeof *mobj_p)) = 0; // table of pointers |
| 1240 |
save_p = sp; // restore save pointer |
| 1241 |
} |
| 1242 |
|
| 1243 |
// read in saved thinkers |
| 1244 |
mobj_count = 0; |
| 1245 |
while (true) |
| 1246 |
{ |
| 1247 |
P_LOAD_BYTE(tc); |
| 1248 |
if (tc == tc_end) |
| 1249 |
break; |
| 1250 |
|
| 1251 |
switch (tc) { |
| 1252 |
case tc_ceiling: |
| 1253 |
{ |
| 1254 |
ceiling_t *ceiling = Z_MallocLevel (sizeof(*ceiling)); |
| 1255 |
P_LOAD_P(ceiling); |
| 1256 |
ceiling->sector = §ors[(size_t)ceiling->sector]; |
| 1257 |
ceiling->sector->ceilingdata = ceiling; //jff 2/22/98 |
| 1258 |
|
| 1259 |
if (ceiling->thinker.function) |
| 1260 |
ceiling->thinker.function = T_MoveCeiling; |
| 1261 |
|
| 1262 |
P_AddThinker (&ceiling->thinker); |
| 1263 |
P_AddActiveCeiling(ceiling); |
| 1264 |
break; |
| 1265 |
} |
| 1266 |
|
| 1267 |
case tc_door: |
| 1268 |
{ |
| 1269 |
vldoor_t *door = Z_MallocLevel (sizeof(*door)); |
| 1270 |
P_LOAD_P(door); |
| 1271 |
door->sector = §ors[(size_t)door->sector]; |
| 1272 |
|
| 1273 |
//jff 1/31/98 unarchive line remembered by door as well |
| 1274 |
door->line = (intptr_t)door->line!=-1? &lines[(size_t)door->line] : NULL; |
| 1275 |
|
| 1276 |
door->sector->ceilingdata = door; //jff 2/22/98 |
| 1277 |
door->thinker.function = T_VerticalDoor; |
| 1278 |
P_AddThinker (&door->thinker); |
| 1279 |
break; |
| 1280 |
} |
| 1281 |
|
| 1282 |
case tc_floor: |
| 1283 |
{ |
| 1284 |
floormove_t *floor = Z_MallocLevel (sizeof(*floor)); |
| 1285 |
P_LOAD_P(floor); |
| 1286 |
floor->sector = §ors[(size_t)floor->sector]; |
| 1287 |
floor->sector->floordata = floor; //jff 2/22/98 |
| 1288 |
floor->thinker.function = T_MoveFloor; |
| 1289 |
P_AddThinker (&floor->thinker); |
| 1290 |
break; |
| 1291 |
} |
| 1292 |
|
| 1293 |
case tc_plat: |
| 1294 |
{ |
| 1295 |
plat_t *plat = Z_MallocLevel (sizeof(*plat)); |
| 1296 |
P_LOAD_P(plat); |
| 1297 |
plat->sector = §ors[(size_t)plat->sector]; |
| 1298 |
plat->sector->floordata = plat; //jff 2/22/98 |
| 1299 |
|
| 1300 |
if (plat->thinker.function) |
| 1301 |
plat->thinker.function = T_PlatRaise; |
| 1302 |
|
| 1303 |
P_AddThinker (&plat->thinker); |
| 1304 |
P_AddActivePlat(plat); |
| 1305 |
break; |
| 1306 |
} |
| 1307 |
|
| 1308 |
case tc_flash: |
| 1309 |
{ |
| 1310 |
lightflash_t *flash = Z_MallocLevel (sizeof(*flash)); |
| 1311 |
P_LOAD_P(flash); |
| 1312 |
flash->sector = §ors[(size_t)flash->sector]; |
| 1313 |
flash->sector->lightingdata = flash; |
| 1314 |
flash->thinker.function = T_LightFlash; |
| 1315 |
P_AddThinker (&flash->thinker); |
| 1316 |
break; |
| 1317 |
} |
| 1318 |
|
| 1319 |
case tc_strobe: |
| 1320 |
{ |
| 1321 |
strobe_t *strobe = Z_MallocLevel (sizeof(*strobe)); |
| 1322 |
P_LOAD_P(strobe); |
| 1323 |
strobe->sector = §ors[(size_t)strobe->sector]; |
| 1324 |
strobe->sector->lightingdata = strobe; |
| 1325 |
strobe->thinker.function = T_StrobeFlash; |
| 1326 |
P_AddThinker (&strobe->thinker); |
| 1327 |
break; |
| 1328 |
} |
| 1329 |
|
| 1330 |
case tc_glow: |
| 1331 |
{ |
| 1332 |
glow_t *glow = Z_MallocLevel (sizeof(*glow)); |
| 1333 |
P_LOAD_P(glow); |
| 1334 |
glow->sector = §ors[(size_t)glow->sector]; |
| 1335 |
glow->sector->lightingdata = glow; |
| 1336 |
glow->thinker.function = T_Glow; |
| 1337 |
P_AddThinker (&glow->thinker); |
| 1338 |
break; |
| 1339 |
} |
| 1340 |
|
| 1341 |
case tc_zdoom_glow: |
| 1342 |
{ |
| 1343 |
zdoom_glow_t *glow = Z_MallocLevel (sizeof(*glow)); |
| 1344 |
P_LOAD_P(glow); |
| 1345 |
glow->sector = §ors[(size_t)glow->sector]; |
| 1346 |
glow->sector->lightingdata = glow; |
| 1347 |
glow->thinker.function = T_ZDoom_Glow; |
| 1348 |
P_AddThinker (&glow->thinker); |
| 1349 |
break; |
| 1350 |
} |
| 1351 |
|
| 1352 |
case tc_flicker: // killough 10/4/98 |
| 1353 |
{ |
| 1354 |
fireflicker_t *flicker = Z_MallocLevel (sizeof(*flicker)); |
| 1355 |
P_LOAD_P(flicker); |
| 1356 |
flicker->sector = §ors[(size_t)flicker->sector]; |
| 1357 |
flicker->sector->lightingdata = flicker; |
| 1358 |
flicker->thinker.function = T_FireFlicker; |
| 1359 |
P_AddThinker (&flicker->thinker); |
| 1360 |
break; |
| 1361 |
} |
| 1362 |
|
| 1363 |
case tc_zdoom_flicker: |
| 1364 |
{ |
| 1365 |
zdoom_flicker_t *flicker = Z_MallocLevel (sizeof(*flicker)); |
| 1366 |
P_LOAD_P(flicker); |
| 1367 |
flicker->sector = §ors[(size_t)flicker->sector]; |
| 1368 |
flicker->sector->lightingdata = flicker; |
| 1369 |
flicker->thinker.function = T_ZDoom_Flicker; |
| 1370 |
P_AddThinker (&flicker->thinker); |
| 1371 |
break; |
| 1372 |
} |
| 1373 |
|
| 1374 |
//jff 2/22/98 new case for elevators |
| 1375 |
case tc_elevator: |
| 1376 |
{ |
| 1377 |
elevator_t *elevator = Z_MallocLevel (sizeof(*elevator)); |
| 1378 |
P_LOAD_P(elevator); |
| 1379 |
elevator->sector = §ors[(size_t)elevator->sector]; |
| 1380 |
elevator->sector->floordata = elevator; //jff 2/22/98 |
| 1381 |
elevator->sector->ceilingdata = elevator; //jff 2/22/98 |
| 1382 |
elevator->thinker.function = T_MoveElevator; |
| 1383 |
P_AddThinker (&elevator->thinker); |
| 1384 |
break; |
| 1385 |
} |
| 1386 |
|
| 1387 |
case tc_scroll_side: |
| 1388 |
{ |
| 1389 |
scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1390 |
P_LOAD_P(scroll); |
| 1391 |
scroll->thinker.function = dsda_UpdateSideScroller; |
| 1392 |
P_AddThinker(&scroll->thinker); |
| 1393 |
break; |
| 1394 |
} |
| 1395 |
|
| 1396 |
case tc_scroll_floor: |
| 1397 |
{ |
| 1398 |
scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1399 |
P_LOAD_P(scroll); |
| 1400 |
scroll->thinker.function = dsda_UpdateFloorScroller; |
| 1401 |
P_AddThinker(&scroll->thinker); |
| 1402 |
break; |
| 1403 |
} |
| 1404 |
|
| 1405 |
case tc_scroll_ceiling: |
| 1406 |
{ |
| 1407 |
scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1408 |
P_LOAD_P(scroll); |
| 1409 |
scroll->thinker.function = dsda_UpdateCeilingScroller; |
| 1410 |
P_AddThinker(&scroll->thinker); |
| 1411 |
break; |
| 1412 |
} |
| 1413 |
|
| 1414 |
case tc_scroll_floor_carry: |
| 1415 |
{ |
| 1416 |
scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1417 |
P_LOAD_P(scroll); |
| 1418 |
scroll->thinker.function = dsda_UpdateFloorCarryScroller; |
| 1419 |
P_AddThinker(&scroll->thinker); |
| 1420 |
break; |
| 1421 |
} |
| 1422 |
|
| 1423 |
case tc_zdoom_scroll_floor: |
| 1424 |
{ |
| 1425 |
scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1426 |
P_LOAD_P(scroll); |
| 1427 |
scroll->thinker.function = dsda_UpdateZDoomFloorScroller; |
| 1428 |
P_AddThinker(&scroll->thinker); |
| 1429 |
break; |
| 1430 |
} |
| 1431 |
|
| 1432 |
case tc_zdoom_scroll_ceiling: |
| 1433 |
{ |
| 1434 |
scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1435 |
P_LOAD_P(scroll); |
| 1436 |
scroll->thinker.function = dsda_UpdateZDoomCeilingScroller; |
| 1437 |
P_AddThinker(&scroll->thinker); |
| 1438 |
break; |
| 1439 |
} |
| 1440 |
|
| 1441 |
case tc_thrust: |
| 1442 |
{ |
| 1443 |
scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1444 |
P_LOAD_P(scroll); |
| 1445 |
scroll->thinker.function = dsda_UpdateThruster; |
| 1446 |
P_AddThinker(&scroll->thinker); |
| 1447 |
break; |
| 1448 |
} |
| 1449 |
|
| 1450 |
case tc_scroll_side_control: |
| 1451 |
{ |
| 1452 |
control_scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1453 |
P_LOAD_P(scroll); |
| 1454 |
scroll->scroll.thinker.function = dsda_UpdateControlSideScroller; |
| 1455 |
P_AddThinker(&scroll->scroll.thinker); |
| 1456 |
break; |
| 1457 |
} |
| 1458 |
|
| 1459 |
case tc_scroll_floor_control: |
| 1460 |
{ |
| 1461 |
control_scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1462 |
P_LOAD_P(scroll); |
| 1463 |
scroll->scroll.thinker.function = dsda_UpdateControlFloorScroller; |
| 1464 |
P_AddThinker(&scroll->scroll.thinker); |
| 1465 |
break; |
| 1466 |
} |
| 1467 |
|
| 1468 |
case tc_scroll_ceiling_control: |
| 1469 |
{ |
| 1470 |
control_scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1471 |
P_LOAD_P(scroll); |
| 1472 |
scroll->scroll.thinker.function = dsda_UpdateControlCeilingScroller; |
| 1473 |
P_AddThinker(&scroll->scroll.thinker); |
| 1474 |
break; |
| 1475 |
} |
| 1476 |
|
| 1477 |
case tc_scroll_floor_carry_control: |
| 1478 |
{ |
| 1479 |
control_scroll_t *scroll = Z_MallocLevel (sizeof(*scroll)); |
| 1480 |
P_LOAD_P(scroll); |
| 1481 |
scroll->scroll.thinker.function = dsda_UpdateControlFloorCarryScroller; |
| 1482 |
P_AddThinker(&scroll->scroll.thinker); |
| 1483 |
break; |
| 1484 |
} |
| 1485 |
|
| 1486 |
case tc_pusher: // phares 3/22/98: new Push/Pull effect thinkers |
| 1487 |
{ |
| 1488 |
pusher_t *pusher = Z_MallocLevel (sizeof(pusher_t)); |
| 1489 |
P_LOAD_P(pusher); |
| 1490 |
pusher->thinker.function = T_Pusher; |
| 1491 |
pusher->source = P_GetPushThing(pusher->affectee); |
| 1492 |
P_AddThinker(&pusher->thinker); |
| 1493 |
break; |
| 1494 |
} |
| 1495 |
|
| 1496 |
case tc_friction: |
| 1497 |
{ |
| 1498 |
friction_t *friction = Z_MallocLevel (sizeof(friction_t)); |
| 1499 |
P_LOAD_P(friction); |
| 1500 |
friction->thinker.function = T_Friction; |
| 1501 |
P_AddThinker(&friction->thinker); |
| 1502 |
break; |
| 1503 |
} |
| 1504 |
|
| 1505 |
case tc_light: |
| 1506 |
{ |
| 1507 |
light_t *light = Z_MallocLevel(sizeof(*light)); |
| 1508 |
P_LOAD_P(light); |
| 1509 |
light->sector = §ors[(size_t)light->sector]; |
| 1510 |
light->thinker.function = T_Light; |
| 1511 |
P_AddThinker(&light->thinker); |
| 1512 |
break; |
| 1513 |
} |
| 1514 |
|
| 1515 |
case tc_phase: |
| 1516 |
{ |
| 1517 |
phase_t *phase = Z_MallocLevel(sizeof(*phase)); |
| 1518 |
P_LOAD_P(phase); |
| 1519 |
phase->sector = §ors[(size_t)phase->sector]; |
| 1520 |
phase->sector->lightingdata = phase; |
| 1521 |
phase->thinker.function = T_Phase; |
| 1522 |
P_AddThinker(&phase->thinker); |
| 1523 |
break; |
| 1524 |
} |
| 1525 |
|
| 1526 |
case tc_acs: |
| 1527 |
{ |
| 1528 |
acs_t *acs = Z_MallocLevel(sizeof(*acs)); |
| 1529 |
P_LOAD_P(acs); |
| 1530 |
acs->line = (intptr_t) acs->line != -1 ? &lines[(size_t) acs->line] : NULL; |
| 1531 |
acs->thinker.function = T_InterpretACS; |
| 1532 |
P_AddThinker(&acs->thinker); |
| 1533 |
break; |
| 1534 |
} |
| 1535 |
|
| 1536 |
case tc_pillar: |
| 1537 |
{ |
| 1538 |
pillar_t *pillar = Z_MallocLevel(sizeof(*pillar)); |
| 1539 |
P_LOAD_P(pillar); |
| 1540 |
pillar->sector = §ors[(size_t)pillar->sector]; |
| 1541 |
pillar->sector->floordata = pillar; |
| 1542 |
pillar->thinker.function = T_BuildPillar; |
| 1543 |
P_AddThinker(&pillar->thinker); |
| 1544 |
break; |
| 1545 |
} |
| 1546 |
|
| 1547 |
case tc_floor_waggle: |
| 1548 |
{ |
| 1549 |
planeWaggle_t *waggle = Z_MallocLevel(sizeof(*waggle)); |
| 1550 |
P_LOAD_P(waggle); |
| 1551 |
waggle->sector = §ors[(size_t)waggle->sector]; |
| 1552 |
waggle->sector->floordata = waggle; |
| 1553 |
waggle->thinker.function = T_FloorWaggle; |
| 1554 |
P_AddThinker(&waggle->thinker); |
| 1555 |
break; |
| 1556 |
} |
| 1557 |
|
| 1558 |
case tc_ceiling_waggle: |
| 1559 |
{ |
| 1560 |
planeWaggle_t *waggle = Z_MallocLevel(sizeof(*waggle)); |
| 1561 |
P_LOAD_P(waggle); |
| 1562 |
waggle->sector = §ors[(size_t)waggle->sector]; |
| 1563 |
waggle->sector->floordata = waggle; |
| 1564 |
waggle->thinker.function = T_CeilingWaggle; |
| 1565 |
P_AddThinker(&waggle->thinker); |
| 1566 |
break; |
| 1567 |
} |
| 1568 |
|
| 1569 |
case tc_poly_rotate: |
| 1570 |
{ |
| 1571 |
polyevent_t *poly = Z_MallocLevel(sizeof(*poly)); |
| 1572 |
P_LOAD_P(poly); |
| 1573 |
poly->thinker.function = T_RotatePoly; |
| 1574 |
P_AddThinker(&poly->thinker); |
| 1575 |
break; |
| 1576 |
} |
| 1577 |
|
| 1578 |
case tc_poly_move: |
| 1579 |
{ |
| 1580 |
polyevent_t *poly = Z_MallocLevel(sizeof(*poly)); |
| 1581 |
P_LOAD_P(poly); |
| 1582 |
poly->thinker.function = T_MovePoly; |
| 1583 |
P_AddThinker(&poly->thinker); |
| 1584 |
break; |
| 1585 |
} |
| 1586 |
|
| 1587 |
case tc_poly_door: |
| 1588 |
{ |
| 1589 |
polydoor_t *poly = Z_MallocLevel(sizeof(*poly)); |
| 1590 |
P_LOAD_P(poly); |
| 1591 |
poly->thinker.function = T_PolyDoor; |
| 1592 |
P_AddThinker(&poly->thinker); |
| 1593 |
break; |
| 1594 |
} |
| 1595 |
|
| 1596 |
case tc_quake: |
| 1597 |
{ |
| 1598 |
quake_t *quake = Z_MallocLevel(sizeof(*quake)); |
| 1599 |
P_LOAD_P(quake); |
| 1600 |
quake->thinker.function = dsda_UpdateQuake; |
| 1601 |
P_AddThinker(&quake->thinker); |
| 1602 |
break; |
| 1603 |
} |
| 1604 |
|
| 1605 |
case tc_ambient_source: |
| 1606 |
{ |
| 1607 |
ambient_source_t *ambient_source = Z_MallocLevel(sizeof(*ambient_source)); |
| 1608 |
P_LOAD_P(ambient_source); |
| 1609 |
ambient_source->thinker.function = dsda_UpdateAmbientSource; |
| 1610 |
P_AddThinker(&ambient_source->thinker); |
| 1611 |
break; |
| 1612 |
} |
| 1613 |
|
| 1614 |
case tc_mobj: |
| 1615 |
{ |
| 1616 |
mobj_t *mobj = Z_MallocLevel(sizeof(mobj_t)); |
| 1617 |
|
| 1618 |
// killough 2/14/98 -- insert pointers to thinkers into table, in order: |
| 1619 |
mobj_count++; |
| 1620 |
mobj_p[mobj_count] = mobj; |
| 1621 |
|
| 1622 |
P_LOAD_P(mobj); |
| 1623 |
|
| 1624 |
mobj->state = states + (intptr_t) mobj->state; |
| 1625 |
|
| 1626 |
// Wipe blocklist pointers. They will be restored correctly later in P_UnArchiveBlockLinks. |
| 1627 |
mobj->bprev = NULL; |
| 1628 |
mobj->bnext = NULL; |
| 1629 |
|
| 1630 |
if (mobj->player) |
| 1631 |
(mobj->player = &players[(size_t) mobj->player - 1]) -> mo = mobj; |
| 1632 |
|
| 1633 |
mobj->info = &mobjinfo[mobj->type]; |
| 1634 |
|
| 1635 |
// Don't place objects marked for deletion |
| 1636 |
if (mobj->index == MARKED_FOR_DELETION) |
| 1637 |
{ |
| 1638 |
mobj->thinker.function = P_RemoveThinkerDelayed; |
| 1639 |
P_AddThinker(&mobj->thinker); |
| 1640 |
|
| 1641 |
// The references value must be nonzero to reach the target code |
| 1642 |
mobj->thinker.references = 1; |
| 1643 |
break; |
| 1644 |
} |
| 1645 |
|
| 1646 |
if (mobj->alpha < 1.f) |
| 1647 |
mobj->tranmap = dsda_TranMap(dsda_FloatToPercent(mobj->alpha)); |
| 1648 |
else |
| 1649 |
mobj->tranmap = NULL; |
| 1650 |
|
| 1651 |
P_SetThingPosition (mobj); |
| 1652 |
|
| 1653 |
// Wipe blocklist pointers again as P_SetThingPosition may have changed them. |
| 1654 |
mobj->bprev = NULL; |
| 1655 |
mobj->bnext = NULL; |
| 1656 |
|
| 1657 |
// killough 2/28/98: |
| 1658 |
// Fix for falling down into a wall after savegame loaded: |
| 1659 |
// mobj->floorz = mobj->subsector->sector->floorheight; |
| 1660 |
// mobj->ceilingz = mobj->subsector->sector->ceilingheight; |
| 1661 |
|
| 1662 |
mobj->thinker.function = P_MobjThinker; |
| 1663 |
P_AddThinker (&mobj->thinker); |
| 1664 |
|
| 1665 |
if (heretic && mobj->type == HERETIC_MT_BLASTERFX1) |
| 1666 |
mobj->thinker.function = P_BlasterMobjThinker; |
| 1667 |
|
| 1668 |
if (!((mobj->flags ^ MF_COUNTKILL) & (MF_FRIEND | MF_COUNTKILL | MF_CORPSE))) |
| 1669 |
totallive++; |
| 1670 |
break; |
| 1671 |
} |
| 1672 |
|
| 1673 |
case tc_button: |
| 1674 |
{ |
| 1675 |
button_t button; |
| 1676 |
P_LOAD_SIZE(&button, sizeof(button_t)); |
| 1677 |
button.line = &lines[(size_t)button.line]; |
| 1678 |
P_StartButton(button.line, button.where, button.btexture, button.btimer); |
| 1679 |
break; |
| 1680 |
} |
| 1681 |
|
| 1682 |
default: |
| 1683 |
I_Error("P_UnarchiveSpecials: Unknown tc %i in extraction", tc); |
| 1684 |
} |
| 1685 |
} |
| 1686 |
|
| 1687 |
// killough 2/14/98: adjust target and tracer fields, plus |
| 1688 |
// lastenemy field, to correctly point to mobj thinkers. |
| 1689 |
// NULL entries automatically handled by first table entry. |
| 1690 |
// |
| 1691 |
// killough 11/98: use P_SetNewTarget() to set fields |
| 1692 |
|
| 1693 |
for (th = thinkercap.next ; th != &thinkercap ; th=th->next) |
| 1694 |
{ |
| 1695 |
if (th->function == T_InterpretACS) |
| 1696 |
{ |
| 1697 |
P_ReplaceIndexWithMobj(&((acs_t *) th)->activator, mobj_p, mobj_count); |
| 1698 |
} |
| 1699 |
else if (th->function == dsda_UpdateQuake) |
| 1700 |
{ |
| 1701 |
P_ReplaceIndexWithMobj(&((quake_t *) th)->location, mobj_p, mobj_count); |
| 1702 |
} |
| 1703 |
else if (th->function == dsda_UpdateAmbientSource) |
| 1704 |
{ |
| 1705 |
P_ReplaceIndexWithMobj(&((ambient_source_t *) th)->mobj, mobj_p, mobj_count); |
| 1706 |
} |
| 1707 |
else if (P_IsMobjThinker(th)) |
| 1708 |
{ |
| 1709 |
P_ReplaceIndexWithMobj(&((mobj_t *) th)->target, mobj_p, mobj_count); |
| 1710 |
P_ReplaceIndexWithMobj(&((mobj_t *) th)->tracer, mobj_p, mobj_count); |
| 1711 |
P_ReplaceIndexWithMobj(&((mobj_t *) th)->lastenemy, mobj_p, mobj_count); |
| 1712 |
|
| 1713 |
if (raven) |
| 1714 |
{ |
| 1715 |
P_ReplaceIndexWithMobj(&((mobj_t *) th)->special1.m, mobj_p, mobj_count); |
| 1716 |
P_ReplaceIndexWithMobj(&((mobj_t *) th)->special2.m, mobj_p, mobj_count); |
| 1717 |
} |
| 1718 |
|
| 1719 |
// restore references now that targets are set |
| 1720 |
if (((mobj_t *) th)->index == MARKED_FOR_DELETION) |
| 1721 |
{ |
| 1722 |
((mobj_t *) th)->index = -1; |
| 1723 |
th->references--; |
| 1724 |
} |
| 1725 |
} |
| 1726 |
} |
| 1727 |
|
| 1728 |
P_UnArchivePolyObjSpecialData(); |
| 1729 |
|
| 1730 |
{ // killough 9/14/98: restore soundtargets |
| 1731 |
int i; |
| 1732 |
for (i = 0; i < numsectors; i++) |
| 1733 |
{ |
| 1734 |
P_LOAD_X(sectors[i].soundtarget); |
| 1735 |
// Must verify soundtarget. See P_ArchiveThinkers. |
| 1736 |
P_ReplaceIndexWithMobj(§ors[i].soundtarget, mobj_p, mobj_count); |
| 1737 |
} |
| 1738 |
} |
| 1739 |
|
| 1740 |
P_UnArchiveBlockLinks(mobj_p, mobj_count); |
| 1741 |
P_UnArchiveThinkerSubclasses(mobj_p, mobj_count); |
| 1742 |
|
| 1743 |
dsda_UnArchiveMSecNodes(mobj_p, mobj_count); |
| 1744 |
|
| 1745 |
Z_Free(mobj_p); // free translation table |
| 1746 |
|
| 1747 |
// TODO: not in sync, need to save and load existing order |
| 1748 |
if (map_format.thing_id) |
| 1749 |
{ |
| 1750 |
map_format.build_mobj_thing_id_list(); |
| 1751 |
} |
| 1752 |
|
| 1753 |
if (hexen) |
| 1754 |
{ |
| 1755 |
P_InitCreatureCorpseQueue(true); // true = scan for corpses |
| 1756 |
} |
| 1757 |
|
| 1758 |
// killough 3/26/98: Spawn icon landings: |
| 1759 |
if (gamemode == commercial && !hexen) |
| 1760 |
{ |
| 1761 |
// P_SpawnBrainTargets overwrites brain.targeton and brain.easy with zero. |
| 1762 |
struct brain_s brain_tmp = brain; // saving |
| 1763 |
|
| 1764 |
P_SpawnBrainTargets(); |
| 1765 |
|
| 1766 |
// old demos with save/load tics should not be affected by this fix |
| 1767 |
if (!prboom_comp[PC_RESET_MONSTERSPAWNER_PARAMS_AFTER_LOADING].state) |
| 1768 |
{ |
| 1769 |
brain = brain_tmp; // restoring |
| 1770 |
} |
| 1771 |
} |
| 1772 |
} |
| 1773 |
|
| 1774 |
// hexen |
| 1775 |
|
| 1776 |
void P_ArchiveACS(void) |
| 1777 |
{ |
| 1778 |
size_t size; |
| 1779 |
|
| 1780 |
if (!map_format.acs) return; |
| 1781 |
|
| 1782 |
size = sizeof(*WorldVars) * MAX_ACS_WORLD_VARS; |
| 1783 |
P_SAVE_SIZE(WorldVars, size); |
| 1784 |
|
| 1785 |
size = sizeof(*ACSStore) * (MAX_ACS_STORE + 1); |
| 1786 |
P_SAVE_SIZE(ACSStore, size); |
| 1787 |
} |
| 1788 |
|
| 1789 |
void P_UnArchiveACS(void) |
| 1790 |
{ |
| 1791 |
size_t size; |
| 1792 |
|
| 1793 |
if (!map_format.acs) return; |
| 1794 |
|
| 1795 |
size = sizeof(*WorldVars) * MAX_ACS_WORLD_VARS; |
| 1796 |
P_LOAD_SIZE(WorldVars, size); |
| 1797 |
|
| 1798 |
size = sizeof(*ACSStore) * (MAX_ACS_STORE + 1); |
| 1799 |
P_LOAD_SIZE(ACSStore, size); |
| 1800 |
} |
| 1801 |
|
| 1802 |
static void P_ArchiveVertex(vertex_t *v) |
| 1803 |
{ |
| 1804 |
P_SAVE_X(v->x); |
| 1805 |
|
| 1806 |
P_SAVE_X(v->y); |
| 1807 |
} |
| 1808 |
|
| 1809 |
static void P_UnArchiveVertex(vertex_t *v) |
| 1810 |
{ |
| 1811 |
P_LOAD_X(v->x); |
| 1812 |
|
| 1813 |
P_LOAD_X(v->y); |
| 1814 |
} |
| 1815 |
|
| 1816 |
void P_ArchivePolyobjs(void) |
| 1817 |
{ |
| 1818 |
int i; |
| 1819 |
|
| 1820 |
if (!map_format.polyobjs) return; |
| 1821 |
|
| 1822 |
for (i = 0; i < po_NumPolyobjs; i++) |
| 1823 |
{ |
| 1824 |
int seg_i; |
| 1825 |
polyobj_t *po; |
| 1826 |
|
| 1827 |
po = &polyobjs[i]; |
| 1828 |
|
| 1829 |
for (seg_i = 0; seg_i < po->numsegs; ++seg_i) { |
| 1830 |
seg_t *seg; |
| 1831 |
line_t *line; |
| 1832 |
|
| 1833 |
seg = po->segs[seg_i]; |
| 1834 |
line = seg->linedef; |
| 1835 |
|
| 1836 |
P_ArchiveVertex(seg->v1); |
| 1837 |
P_ArchiveVertex(seg->v2); |
| 1838 |
|
| 1839 |
P_SAVE_X(seg->angle); |
| 1840 |
P_SAVE_X(line->slopetype); |
| 1841 |
P_SAVE_ARRAY(line->bbox); |
| 1842 |
P_SAVE_X(line->dx); |
| 1843 |
P_SAVE_X(line->dy); |
| 1844 |
|
| 1845 |
P_ArchiveVertex(&po->originalPts[seg_i]); |
| 1846 |
P_ArchiveVertex(&po->prevPts[seg_i]); |
| 1847 |
} |
| 1848 |
|
| 1849 |
P_SAVE_X(po->angle); |
| 1850 |
P_SAVE_X(po->startSpot.x); |
| 1851 |
P_SAVE_X(po->startSpot.y); |
| 1852 |
} |
| 1853 |
} |
| 1854 |
|
| 1855 |
void P_UnArchivePolyobjs(void) |
| 1856 |
{ |
| 1857 |
void UnLinkPolyobj(polyobj_t * po); |
| 1858 |
void LinkPolyobj(polyobj_t * po); |
| 1859 |
void ResetPolySubSector(polyobj_t *po); |
| 1860 |
|
| 1861 |
int i; |
| 1862 |
|
| 1863 |
if (!map_format.polyobjs) return; |
| 1864 |
|
| 1865 |
for (i = 0; i < po_NumPolyobjs; i++) |
| 1866 |
{ |
| 1867 |
int seg_i; |
| 1868 |
polyobj_t *po; |
| 1869 |
|
| 1870 |
po = &polyobjs[i]; |
| 1871 |
|
| 1872 |
UnLinkPolyobj(po); |
| 1873 |
|
| 1874 |
for (seg_i = 0; seg_i < po->numsegs; ++seg_i) { |
| 1875 |
seg_t *seg; |
| 1876 |
line_t *line; |
| 1877 |
|
| 1878 |
seg = po->segs[seg_i]; |
| 1879 |
line = seg->linedef; |
| 1880 |
|
| 1881 |
P_UnArchiveVertex(seg->v1); |
| 1882 |
P_UnArchiveVertex(seg->v2); |
| 1883 |
|
| 1884 |
P_LOAD_X(seg->angle); |
| 1885 |
P_LOAD_X(line->slopetype); |
| 1886 |
P_LOAD_ARRAY(line->bbox); |
| 1887 |
P_LOAD_X(line->dx); |
| 1888 |
P_LOAD_X(line->dy); |
| 1889 |
|
| 1890 |
P_UnArchiveVertex(&po->originalPts[seg_i]); |
| 1891 |
P_UnArchiveVertex(&po->prevPts[seg_i]); |
| 1892 |
} |
| 1893 |
|
| 1894 |
P_LOAD_X(po->angle); |
| 1895 |
P_LOAD_X(po->startSpot.x); |
| 1896 |
P_LOAD_X(po->startSpot.y); |
| 1897 |
|
| 1898 |
LinkPolyobj(po); |
| 1899 |
ResetPolySubSector(po); |
| 1900 |
} |
| 1901 |
} |
| 1902 |
|
| 1903 |
void P_ArchiveScripts(void) |
| 1904 |
{ |
| 1905 |
size_t size; |
| 1906 |
|
| 1907 |
if (!map_format.acs) return; |
| 1908 |
|
| 1909 |
size = sizeof(*ACSInfo) * ACScriptCount; |
| 1910 |
P_SAVE_SIZE(ACSInfo, size); |
| 1911 |
|
| 1912 |
size = sizeof(*MapVars) * MAX_ACS_MAP_VARS; |
| 1913 |
P_SAVE_SIZE(MapVars, size); |
| 1914 |
} |
| 1915 |
|
| 1916 |
void P_UnArchiveScripts(void) |
| 1917 |
{ |
| 1918 |
size_t size; |
| 1919 |
|
| 1920 |
if (!map_format.acs) return; |
| 1921 |
|
| 1922 |
size = sizeof(*ACSInfo) * ACScriptCount; |
| 1923 |
P_LOAD_SIZE(ACSInfo, size); |
| 1924 |
|
| 1925 |
size = sizeof(*MapVars) * MAX_ACS_MAP_VARS; |
| 1926 |
P_LOAD_SIZE(MapVars, size); |
| 1927 |
} |
| 1928 |
|
| 1929 |
void P_ArchiveSounds(void) |
| 1930 |
{ |
| 1931 |
seqnode_t *node; |
| 1932 |
sector_t *sec; |
| 1933 |
int difference; |
| 1934 |
int i; |
| 1935 |
|
| 1936 |
if (!map_format.sndseq) return; |
| 1937 |
|
| 1938 |
P_SAVE_X(ActiveSequences); |
| 1939 |
|
| 1940 |
for (node = SequenceListHead; node; node = node->next) |
| 1941 |
{ |
| 1942 |
P_SAVE_X(node->sequence); |
| 1943 |
P_SAVE_X(node->delayTics); |
| 1944 |
P_SAVE_X(node->volume); |
| 1945 |
|
| 1946 |
difference = SN_GetSequenceOffset(node->sequence, node->sequencePtr); |
| 1947 |
P_SAVE_X(difference); |
| 1948 |
P_SAVE_X(node->currentSoundID); |
| 1949 |
|
| 1950 |
for (i = 0; i < po_NumPolyobjs; i++) |
| 1951 |
{ |
| 1952 |
if (node->mobj == (mobj_t *) &polyobjs[i].startSpot) |
| 1953 |
{ |
| 1954 |
break; |
| 1955 |
} |
| 1956 |
} |
| 1957 |
|
| 1958 |
if (i == po_NumPolyobjs) |
| 1959 |
{ // Sound is attached to a sector, not a polyobj |
| 1960 |
sec = R_PointInSector(node->mobj->x, node->mobj->y); |
| 1961 |
difference = (int) (sec - sectors); |
| 1962 |
P_SAVE_BYTE(0); // 0 -- sector sound origin |
| 1963 |
} |
| 1964 |
else |
| 1965 |
{ |
| 1966 |
difference = i; |
| 1967 |
P_SAVE_BYTE(1); // 1 -- polyobj sound origin |
| 1968 |
} |
| 1969 |
|
| 1970 |
P_SAVE_X(difference); |
| 1971 |
} |
| 1972 |
} |
| 1973 |
|
| 1974 |
void P_UnArchiveSounds(void) |
| 1975 |
{ |
| 1976 |
int i; |
| 1977 |
int numSequences; |
| 1978 |
int sequence; |
| 1979 |
int delayTics; |
| 1980 |
int volume; |
| 1981 |
int seqOffset; |
| 1982 |
int soundID; |
| 1983 |
byte polySnd; |
| 1984 |
int secNum; |
| 1985 |
mobj_t *sndMobj; |
| 1986 |
|
| 1987 |
if (!map_format.sndseq) return; |
| 1988 |
|
| 1989 |
P_LOAD_X(numSequences); |
| 1990 |
|
| 1991 |
i = 0; |
| 1992 |
while (i < numSequences) |
| 1993 |
{ |
| 1994 |
P_LOAD_X(sequence); |
| 1995 |
P_LOAD_X(delayTics); |
| 1996 |
P_LOAD_X(volume); |
| 1997 |
P_LOAD_X(seqOffset); |
| 1998 |
P_LOAD_X(soundID); |
| 1999 |
P_LOAD_BYTE(polySnd); |
| 2000 |
P_LOAD_X(secNum); |
| 2001 |
|
| 2002 |
if (!polySnd) |
| 2003 |
{ |
| 2004 |
sndMobj = (mobj_t *) §ors[secNum].soundorg; |
| 2005 |
} |
| 2006 |
else |
| 2007 |
{ |
| 2008 |
sndMobj = (mobj_t *) &polyobjs[secNum].startSpot; |
| 2009 |
} |
| 2010 |
SN_StartSequence(sndMobj, sequence); |
| 2011 |
SN_ChangeNodeData(i, seqOffset, delayTics, volume, soundID); |
| 2012 |
i++; |
| 2013 |
} |
| 2014 |
} |
| 2015 |
|
| 2016 |
void P_ArchiveAmbientSound(void) |
| 2017 |
{ |
| 2018 |
if (!heretic) return; |
| 2019 |
|
| 2020 |
P_SAVE_X(AmbSfxTics); |
| 2021 |
P_SAVE_X(AmbSfxVolume); |
| 2022 |
P_SAVE_X(AmbSfxPtrIndex); |
| 2023 |
|
| 2024 |
if (AmbSfxPtrIndex != -1) |
| 2025 |
{ |
| 2026 |
size_t offset; |
| 2027 |
|
| 2028 |
offset = AmbSfxPtr - LevelAmbientSfx[AmbSfxPtrIndex]; |
| 2029 |
|
| 2030 |
P_SAVE_X(offset); |
| 2031 |
} |
| 2032 |
} |
| 2033 |
|
| 2034 |
void P_UnArchiveAmbientSound(void) |
| 2035 |
{ |
| 2036 |
if (!heretic) return; |
| 2037 |
|
| 2038 |
P_LOAD_X(AmbSfxTics); |
| 2039 |
P_LOAD_X(AmbSfxVolume); |
| 2040 |
P_LOAD_X(AmbSfxPtrIndex); |
| 2041 |
|
| 2042 |
if (AmbSfxPtrIndex == -1) |
| 2043 |
{ |
| 2044 |
extern int AmbSndSeqInit[]; |
| 2045 |
|
| 2046 |
AmbSfxPtr = AmbSndSeqInit; |
| 2047 |
} |
| 2048 |
else |
| 2049 |
{ |
| 2050 |
size_t offset; |
| 2051 |
|
| 2052 |
P_LOAD_X(offset); |
| 2053 |
|
| 2054 |
AmbSfxPtr = LevelAmbientSfx[AmbSfxPtrIndex] + offset; |
| 2055 |
} |
| 2056 |
} |
| 2057 |
|
| 2058 |
void P_ArchiveMisc(void) |
| 2059 |
{ |
| 2060 |
size_t size; |
| 2061 |
|
| 2062 |
if (map_format.animdefs) |
| 2063 |
{ |
| 2064 |
P_SAVE_ARRAY(AnimDefs); |
| 2065 |
} |
| 2066 |
|
| 2067 |
if (map_format.hexen) |
| 2068 |
{ |
| 2069 |
size = sizeof(*localQuakeHappening) * MAX_MAXPLAYERS; |
| 2070 |
P_SAVE_SIZE(localQuakeHappening, size); |
| 2071 |
} |
| 2072 |
|
| 2073 |
if (!hexen) return; |
| 2074 |
|
| 2075 |
P_SAVE_ARRAY(PlayerClass); |
| 2076 |
P_SAVE_X(NextLightningFlash); |
| 2077 |
P_SAVE_X(LightningFlash); |
| 2078 |
|
| 2079 |
SV_StoreMapArchive(); |
| 2080 |
} |
| 2081 |
|
| 2082 |
void P_UnArchiveMisc(void) |
| 2083 |
{ |
| 2084 |
size_t size; |
| 2085 |
|
| 2086 |
if (map_format.animdefs) |
| 2087 |
{ |
| 2088 |
P_LOAD_ARRAY(AnimDefs); |
| 2089 |
} |
| 2090 |
|
| 2091 |
if (map_format.hexen) |
| 2092 |
{ |
| 2093 |
size = sizeof(*localQuakeHappening) * MAX_MAXPLAYERS; |
| 2094 |
P_LOAD_SIZE(localQuakeHappening, size); |
| 2095 |
} |
| 2096 |
|
| 2097 |
if (!hexen) return; |
| 2098 |
|
| 2099 |
P_LOAD_ARRAY(PlayerClass); |
| 2100 |
P_LOAD_X(NextLightningFlash); |
| 2101 |
P_LOAD_X(LightningFlash); |
| 2102 |
|
| 2103 |
SV_RestoreMapArchive(); |
| 2104 |
} |