static void saveg_read_lightflash_t(lightflash_t *str) { int sector; // thinker_t thinker; saveg_read_thinker_t(&str->thinker); // sector_t* sector; sector = saveg_read32(); str->sector = §ors[sector]; // int count; str->count = saveg_read32(); // int maxlight; str->maxlight = saveg_read32(); // int minlight; str->minlight = saveg_read32(); // int maxtime; str->maxtime = saveg_read32(); // int mintime; str->mintime = saveg_read32(); }
static void saveg_read_floormove_t(floormove_t *str) { int sector; // thinker_t thinker; saveg_read_thinker_t(&str->thinker); // floor_e type; str->type = saveg_read_enum(); // boolean crush; str->crush = saveg_read32(); // sector_t* sector; sector = saveg_read32(); str->sector = §ors[sector]; // int direction; str->direction = saveg_read32(); // int newspecial; str->newspecial = saveg_read32(); // short texture; str->texture = saveg_read16(); // fixed_t floordestheight; str->floordestheight = saveg_read32(); // fixed_t speed; str->speed = saveg_read32(); }
static void saveg_read_pusher_t(pusher_t *str) { str->type = saveg_read_enum(); str->x_mag = saveg_read32(); str->y_mag = saveg_read32(); str->magnitude = saveg_read32(); str->radius = saveg_read32(); str->x = saveg_read32(); str->y = saveg_read32(); str->affectee = saveg_read32(); }
static void saveg_setup_mobjread(void) { int i; // get count and allocate table savegmobjnum = saveg_read32(); savegmobj = (savegmobj_t*)Z_Alloca(sizeof(savegmobj_t) * savegmobjnum); // read and add mobjs for(i = 0; i < savegmobjnum; i++) { savegmobj[i].index = i + 1; savegmobj[i].mobj = Z_Calloc(sizeof(mobj_t), PU_LEVEL, NULL); } }
static void saveg_read_lightmorph_t(lightmorph_t* morph) { morph->dest = &lights[saveg_read32()]; morph->src = &lights[saveg_read32()]; morph->r = saveg_read32(); morph->g = saveg_read32(); morph->b = saveg_read32(); morph->inc = saveg_read32(); }
static void saveg_read_sequenceGlow_t(sequenceGlow_t* seq) { seq->sector = §ors[saveg_read32()]; seq->headsector = §ors[saveg_read32() - 1]; seq->count = saveg_read32(); seq->start = saveg_read32(); seq->index = saveg_read32(); seq->special = saveg_read32(); }
static void saveg_read_strobe_t(strobe_t* strobe) { strobe->sector = §ors[saveg_read32()]; strobe->count = saveg_read32(); strobe->maxlight = saveg_read32(); strobe->darktime = saveg_read32(); strobe->brighttime = saveg_read32(); strobe->special = saveg_read32(); }
dboolean P_QuickReadSaveHeader(char* name, char* date, int* thumbnail, int* skill, int* map) { int i; int size; if(M_ReadFile(name, &savebuffer) == -1) { return 0; } save_offset = 0; // skip the description field for(i = 0; i < SAVESTRINGSIZE; i++) { saveg_read8(); } for(i = 0; i < 32; i++) { date[i] = saveg_read8(); } size = saveg_read32() / sizeof(int); for(i = 0; i < size; i++) { thumbnail[i] = saveg_read32(); } // skip password for(i = 0; i < 16; i++) { saveg_read8(); } *skill = saveg_read8(); *map = saveg_read8(); Z_Free(savebuffer); return 1; }
// // lightflash_t // static void saveg_read_lightflash_t(lightflash_t *str) { str->sector = sectors + saveg_read32(); str->count = saveg_read32(); str->maxlight = saveg_read32(); str->minlight = saveg_read32(); str->maxtime = saveg_read32(); str->mintime = saveg_read32(); }
// // strobe_t // static void saveg_read_strobe_t(strobe_t *str) { str->sector = sectors + saveg_read32(); str->count = saveg_read32(); str->minlight = saveg_read32(); str->maxlight = saveg_read32(); str->darktime = saveg_read32(); str->brighttime = saveg_read32(); }
static void saveg_read_pspdef_t(pspdef_t *psp) { int state; state = saveg_read32(); psp->state = state > 0 ? &states[state] : NULL; psp->tics = saveg_read32(); psp->sx = saveg_read32(); psp->sy = saveg_read32(); psp->alpha = saveg_read32(); psp->frame_x = saveg_read32(); psp->frame_y = saveg_read32(); }
static mobj_t* saveg_read_mobjindex(void) { int index = saveg_read32(); if(index) { int i; for(i = 0; i < savegmobjnum; i++) { if(savegmobj[i].index == index) { return savegmobj[i].mobj; } } } return NULL; }
// // P_UnArchiveWorld // void P_UnArchiveWorld(void) { sector_t *sec = sectors; line_t *li = lines; // do sectors for (int i = 0; i < numsectors; i++, sec++) { sec->floorheight = saveg_read16() << FRACBITS; sec->ceilingheight = saveg_read16() << FRACBITS; sec->floorpic = saveg_read16(); sec->ceilingpic = saveg_read16(); sec->lightlevel = saveg_read16(); sec->special = saveg_read16(); sec->tag = saveg_read16(); sec->ceilingdata = NULL; sec->floordata = NULL; sec->lightingdata = NULL; soundtargets[MIN(i, TARGETLIMIT - 1)] = saveg_read32(); } // do lines for (int i = 0; i < numlines; i++, li++) { li->flags = saveg_read16(); li->special = saveg_read16(); li->tag = saveg_read16(); for (int j = 0; j < 2; j++) { side_t *si; if (li->sidenum[j] == NO_INDEX) continue; si = sides + li->sidenum[j]; si->textureoffset = saveg_read16() << FRACBITS; si->rowoffset = saveg_read16() << FRACBITS; si->toptexture = saveg_read16(); si->bottomtexture = saveg_read16(); si->midtexture = saveg_read16(); si->missingtoptexture = saveg_read_bool(); si->missingbottomtexture = saveg_read_bool(); si->missingmidtexture = saveg_read_bool(); } } }
// // plat_t // static void saveg_read_plat_t(plat_t *str) { str->thinker.function = (saveg_read_bool() ? T_PlatRaise : NULL); str->sector = sectors + saveg_read32(); str->speed = saveg_read32(); str->low = saveg_read32(); str->high = saveg_read32(); str->wait = saveg_read32(); str->count = saveg_read32(); str->status = (plat_e)saveg_read_enum(); str->oldstatus = (plat_e)saveg_read_enum(); str->crush = saveg_read_bool(); str->tag = saveg_read32(); str->type = (plattype_e)saveg_read_enum(); }
// // floormove_t // static void saveg_read_floormove_t(floormove_t *str) { str->type = (floor_e)saveg_read_enum(); str->crush = saveg_read_bool(); str->sector = sectors + saveg_read32(); str->direction = saveg_read32(); str->newspecial = saveg_read32(); str->texture = saveg_read16(); str->floordestheight = saveg_read32(); str->speed = saveg_read32(); str->stopsound = saveg_read32(); }
static void saveg_read_plat_t(plat_t *str) { int sector; // thinker_t thinker; saveg_read_thinker_t(&str->thinker); // sector_t* sector; sector = saveg_read32(); str->sector = §ors[sector]; // fixed_t speed; str->speed = saveg_read32(); // fixed_t low; str->low = saveg_read32(); // fixed_t high; str->high = saveg_read32(); // int wait; str->wait = saveg_read32(); // int count; str->count = saveg_read32(); // plat_e status; str->status = saveg_read_enum(); // plat_e oldstatus; str->oldstatus = saveg_read_enum(); // boolean crush; str->crush = saveg_read32(); // int tag; str->tag = saveg_read32(); // plattype_e type; str->type = saveg_read_enum(); }
static void saveg_read_vldoor_t(vldoor_t *str) { int sector; // thinker_t thinker; saveg_read_thinker_t(&str->thinker); // vldoor_e type; str->type = saveg_read_enum(); // sector_t* sector; sector = saveg_read32(); str->sector = §ors[sector]; // fixed_t topheight; str->topheight = saveg_read32(); // fixed_t speed; str->speed = saveg_read32(); // int direction; str->direction = saveg_read32(); // int topwait; str->topwait = saveg_read32(); // int topcountdown; str->topcountdown = saveg_read32(); // villsa [STRIFE] new field - sound to play when opening //int opensound; str->opensound = saveg_read32(); // villsa [STRIFE] new field - sound to play when closing //int closesound; str->closesound = saveg_read32(); }
static void saveg_read_player_t(player_t* p) { int i; p->mo = saveg_read_mobjindex(); p->playerstate = saveg_read32(); saveg_read_ticcmd_t(&p->cmd); p->viewz = saveg_read32(); p->viewheight = saveg_read32(); p->deltaviewheight = saveg_read32(); p->bob = saveg_read32(); p->recoilpitch = saveg_read32(); p->health = saveg_read32(); p->armorpoints = saveg_read32(); p->armortype = saveg_read32(); for(i = 0; i < NUMPOWERS; i++) { p->powers[i] = saveg_read32(); } for(i = 0; i < NUMCARDS; i++) { p->cards[i] = saveg_read32(); p->tryopen[i] = saveg_read32(); } p->artifacts = saveg_read32(); p->backpack = saveg_read32(); for(i = 0; i < MAXPLAYERS; i++) { p->frags[i] = saveg_read32(); } p->readyweapon = saveg_read32(); p->pendingweapon = saveg_read32(); for(i = 0; i < NUMWEAPONS; i++) { p->weaponowned[i] = saveg_read32(); } for(i = 0; i < NUMAMMO; i++) { p->ammo[i] = saveg_read32(); p->maxammo[i] = saveg_read32(); } p->attackdown = saveg_read32(); p->usedown = saveg_read32(); p->jumpdown = saveg_read32(); p->cheats = saveg_read32(); p->refire = saveg_read32(); p->killcount = saveg_read32(); p->itemcount = saveg_read32(); p->secretcount = saveg_read32(); p->damagecount = saveg_read32(); p->bonuscount = saveg_read32(); p->bfgcount = saveg_read32(); p->attacker = saveg_read_mobjindex(); p->cameratarget = saveg_read_mobjindex(); if(!p->cameratarget) { p->cameratarget = p->mo; } for(i = 0; i < NUMPSPRITES; i++) { saveg_read_pspdef_t(&p->psprites[i]); } p->palette = saveg_read32(); p->onground = saveg_read32(); p->autoaim = saveg_read32(); }
static void saveg_read_plat_t(plat_t* plat) { plat->sector = §ors[saveg_read32()]; plat->speed = saveg_read32(); plat->low = saveg_read32(); plat->high = saveg_read32(); plat->wait = saveg_read32(); plat->count = saveg_read32(); plat->status = saveg_read32(); plat->oldstatus = saveg_read32(); plat->crush = saveg_read32(); plat->tag = saveg_read32(); plat->type = saveg_read32(); plat->sector->specialdata = plat; }
// // player_t // static void saveg_read_player_t(void) { viewplayer->playerstate = (playerstate_t)saveg_read_enum(); saveg_read_ticcmd_t(&viewplayer->cmd); viewplayer->viewz = saveg_read32(); viewplayer->viewheight = saveg_read32(); viewplayer->deltaviewheight = saveg_read32(); viewplayer->momx = saveg_read32(); viewplayer->momy = saveg_read32(); viewplayer->health = saveg_read32(); oldhealth = saveg_read32(); viewplayer->armorpoints = saveg_read32(); viewplayer->armortype = (armortype_t)saveg_read_enum(); for (int i = 0; i < NUMPOWERS; i++) viewplayer->powers[i] = saveg_read32(); for (int i = 0; i < NUMCARDS; i++) { viewplayer->cards[i] = saveg_read32(); cardsfound = MAX(cardsfound, viewplayer->cards[i]); } viewplayer->neededcard = saveg_read32(); viewplayer->neededcardflash = saveg_read32(); viewplayer->backpack = saveg_read_bool(); viewplayer->readyweapon = (weapontype_t)saveg_read_enum(); viewplayer->pendingweapon = (weapontype_t)saveg_read_enum(); for (int i = 0; i < NUMWEAPONS; i++) viewplayer->weaponowned[i] = oldweaponsowned[i] = saveg_read32(); for (int i = 0; i < NUMAMMO; i++) viewplayer->ammo[i] = saveg_read32(); for (int i = 0; i < NUMAMMO; i++) viewplayer->maxammo[i] = saveg_read32(); viewplayer->attackdown = saveg_read_bool(); viewplayer->usedown = saveg_read_bool(); viewplayer->cheats = saveg_read32(); viewplayer->refire = saveg_read32(); viewplayer->killcount = saveg_read32(); viewplayer->itemcount = saveg_read32(); viewplayer->secretcount = saveg_read32(); viewplayer->damagecount = saveg_read32(); viewplayer->bonuscount = saveg_read32(); attacker = saveg_read32(); viewplayer->extralight = saveg_read32(); viewplayer->fixedcolormap = saveg_read32(); saveg_read_pspdef_t(&viewplayer->psprites[ps_weapon]); saveg_read_pspdef_t(&viewplayer->psprites[ps_flash]); viewplayer->didsecret = saveg_read_bool(); viewplayer->preferredshotgun = (weapontype_t)saveg_read_enum(); viewplayer->fistorchainsaw = (weapontype_t)saveg_read_enum(); viewplayer->invulnbeforechoppers = saveg_read_bool(); viewplayer->chainsawbeforechoppers = saveg_read_bool(); viewplayer->weaponbeforechoppers = (weapontype_t)saveg_read_enum(); viewplayer->oldviewz = saveg_read32(); viewplayer->lookdir = saveg_read32(); viewplayer->oldlookdir = saveg_read32(); viewplayer->recoil = saveg_read32(); viewplayer->oldrecoil = saveg_read32(); viewplayer->jumptics = saveg_read32(); if (!mouselook) { viewplayer->lookdir = 0; viewplayer->oldlookdir = 0; viewplayer->recoil = 0; viewplayer->oldrecoil = 0; } viewplayer->damageinflicted = saveg_read32(); viewplayer->damagereceived = saveg_read32(); viewplayer->cheated = saveg_read32(); viewplayer->shotshit = saveg_read32(); viewplayer->shotsfired = saveg_read32(); viewplayer->deaths = saveg_read32(); for (int i = 0; i < NUMMOBJTYPES; i++) viewplayer->mobjcount[i] = saveg_read32(); viewplayer->distancetraveled = saveg_read32(); viewplayer->itemspickedup_ammo_bullets = saveg_read32(); viewplayer->itemspickedup_ammo_cells = saveg_read32(); viewplayer->itemspickedup_ammo_rockets = saveg_read32(); viewplayer->itemspickedup_ammo_shells = saveg_read32(); viewplayer->itemspickedup_armor = saveg_read32(); viewplayer->itemspickedup_health = saveg_read32(); }
// // mobj_t // static void saveg_read_mobj_t(mobj_t *str) { str->x = saveg_read32(); str->y = saveg_read32(); str->z = saveg_read32(); str->angle = saveg_read32(); str->sprite = (spritenum_t)saveg_read_enum(); str->frame = saveg_read32(); str->floorz = saveg_read32(); str->ceilingz = saveg_read32(); str->dropoffz = saveg_read32(); str->radius = saveg_read32(); str->height = saveg_read32(); str->momx = saveg_read32(); str->momy = saveg_read32(); str->momz = saveg_read32(); str->type = (mobjtype_t)saveg_read_enum(); str->tics = saveg_read32(); str->state = &states[saveg_read32()]; str->flags = saveg_read32(); str->flags2 = saveg_read32(); str->health = saveg_read32(); str->movedir = saveg_read32(); str->movecount = saveg_read32(); targets[thingindex] = saveg_read32(); str->reactiontime = saveg_read32(); str->threshold = saveg_read32(); if (saveg_read_bool()) { str->player = viewplayer; str->player->mo = str; } saveg_read_mapthing_t(&str->spawnpoint); tracers[thingindex] = saveg_read32(); lastenemies[thingindex] = saveg_read32(); str->floatbob = saveg_read32(); str->shadowoffset = saveg_read32(); str->gear = saveg_read16(); str->bloodsplats = saveg_read32(); str->blood = saveg_read32(); str->interpolate = saveg_read32(); str->oldx = saveg_read32(); str->oldy = saveg_read32(); str->oldz = saveg_read32(); str->oldangle = saveg_read32(); str->nudge = saveg_read32(); str->pitch = saveg_read32(); str->id = saveg_read32(); }
static void saveg_read_mobj_t(mobj_t* mo) { int pl; mo->x = saveg_read32(); mo->y = saveg_read32(); mo->z = saveg_read32(); mo->tid = saveg_read32(); mo->snext = saveg_read_mobjindex(); mo->sprev = saveg_read_mobjindex(); mo->angle = saveg_read32(); mo->pitch = saveg_read32(); mo->sprite = saveg_read32(); mo->frame = saveg_read32(); mo->bnext = saveg_read_mobjindex(); mo->bprev = saveg_read_mobjindex(); mo->subsector = &subsectors[saveg_read32() - numsubsectors]; mo->floorz = saveg_read32(); mo->ceilingz = saveg_read32(); mo->radius = saveg_read32(); mo->height = saveg_read32(); mo->momx = saveg_read32(); mo->momy = saveg_read32(); mo->momz = saveg_read32(); mo->validcount = saveg_read32(); mo->state = &states[saveg_read32()]; mo->type = saveg_read32(); mo->tics = saveg_read32(); mo->flags = saveg_read32(); mo->health = saveg_read32(); mo->alpha = saveg_read32(); mo->blockflag = saveg_read32(); mo->movedir = saveg_read32(); mo->movecount = saveg_read32(); saveg_set_mobjtarget(&mo->target, saveg_read_mobjindex()); mo->reactiontime = saveg_read32(); mo->threshold = saveg_read32(); pl = saveg_read32(); mo->player = pl > 0 ? &players[pl - 1] : NULL; saveg_read_mapthing_t(&mo->spawnpoint); saveg_set_mobjtarget(&mo->tracer, saveg_read_mobjindex()); mo->frame_x = saveg_read32(); mo->frame_y = saveg_read32(); mo->frame_z = saveg_read32(); mo->mobjfunc = saveg_read32() ? P_RespawnSpecials : NULL; }
static void saveg_read_mobj_t(mobj_t *str) { int pl; // thinker_t thinker; saveg_read_thinker_t(&str->thinker); // fixed_t x; str->x = saveg_read32(); // fixed_t y; str->y = saveg_read32(); // fixed_t z; str->z = saveg_read32(); // struct mobj_s* snext; str->snext = saveg_readp(); // struct mobj_s* sprev; str->sprev = saveg_readp(); // angle_t angle; str->angle = saveg_read32(); // spritenum_t sprite; str->sprite = saveg_read_enum(); // int frame; str->frame = saveg_read32(); // struct mobj_s* bnext; str->bnext = saveg_readp(); // struct mobj_s* bprev; str->bprev = saveg_readp(); // struct subsector_s* subsector; str->subsector = saveg_readp(); // fixed_t floorz; str->floorz = saveg_read32(); // fixed_t ceilingz; str->ceilingz = saveg_read32(); // fixed_t radius; str->radius = saveg_read32(); // fixed_t height; str->height = saveg_read32(); // fixed_t momx; str->momx = saveg_read32(); // fixed_t momy; str->momy = saveg_read32(); // fixed_t momz; str->momz = saveg_read32(); // int validcount; str->validcount = saveg_read32(); // mobjtype_t type; str->type = saveg_read_enum(); // mobjinfo_t* info; str->info = saveg_readp(); // int tics; str->tics = saveg_read32(); // state_t* state; str->state = &states[saveg_read32()]; // int flags; str->flags = saveg_read32(); // int health; str->health = saveg_read32(); // int movedir; str->movedir = saveg_read32(); // int movecount; str->movecount = saveg_read32(); // struct mobj_s* target; str->target = saveg_readp(); // int reactiontime; str->reactiontime = saveg_read32(); // int threshold; str->threshold = saveg_read32(); // struct player_s* player; pl = saveg_read32(); if (pl > 0) { str->player = &players[pl - 1]; str->player->mo = str; } else { str->player = NULL; } // int lastlook; str->lastlook = saveg_read32(); // mapthing_t spawnpoint; saveg_read_mapthing_t(&str->spawnpoint); // struct mobj_s* tracer; str->tracer = saveg_readp(); }
static void saveg_read_combine_t(combine_t* combine) { combine->sector = §ors[saveg_read32()]; }
static void saveg_read_lightflash_t(lightflash_t* lf) { lf->sector = §ors[saveg_read32()]; lf->count = saveg_read32(); lf->special = saveg_read32(); }
static void saveg_read_fireflicker_t(fireflicker_t* ff) { ff->sector = §ors[saveg_read32()]; ff->count = saveg_read32(); ff->special = saveg_read32(); }
static void *saveg_readp(void) { return (void *) saveg_read32(); }
static void saveg_read_quake_t(quake_t* quake) { quake->tics = saveg_read32(); }
static void saveg_read_player_t(player_t *str) { int i; // mobj_t* mo; str->mo = saveg_readp(); // playerstate_t playerstate; str->playerstate = saveg_read_enum(); // ticcmd_t cmd; saveg_read_ticcmd_t(&str->cmd); // fixed_t viewz; str->viewz = saveg_read32(); // fixed_t viewheight; str->viewheight = saveg_read32(); // fixed_t deltaviewheight; str->deltaviewheight = saveg_read32(); // fixed_t bob; str->bob = saveg_read32(); // int health; str->health = saveg_read32(); // int armorpoints; str->armorpoints = saveg_read32(); // int armortype; str->armortype = saveg_read32(); // int powers[NUMPOWERS]; for (i=0; i<NUMPOWERS; ++i) { str->powers[i] = saveg_read32(); } // boolean cards[NUMCARDS]; for (i=0; i<NUMCARDS; ++i) { str->cards[i] = saveg_read32(); } // boolean backpack; str->backpack = saveg_read32(); // int frags[MAXPLAYERS]; for (i=0; i<MAXPLAYERS; ++i) { str->frags[i] = saveg_read32(); } // weapontype_t readyweapon; str->readyweapon = saveg_read_enum(); // weapontype_t pendingweapon; str->pendingweapon = saveg_read_enum(); // boolean weaponowned[NUMWEAPONS]; for (i=0; i<NUMWEAPONS; ++i) { str->weaponowned[i] = saveg_read32(); } // int ammo[NUMAMMO]; for (i=0; i<NUMAMMO; ++i) { str->ammo[i] = saveg_read32(); } // int maxammo[NUMAMMO]; for (i=0; i<NUMAMMO; ++i) { str->maxammo[i] = saveg_read32(); } // int attackdown; str->attackdown = saveg_read32(); // int usedown; str->usedown = saveg_read32(); // int cheats; str->cheats = saveg_read32(); // int refire; str->refire = saveg_read32(); // int killcount; str->killcount = saveg_read32(); // int itemcount; str->itemcount = saveg_read32(); // int secretcount; str->secretcount = saveg_read32(); // char* message; str->message = saveg_readp(); // int damagecount; str->damagecount = saveg_read32(); // int bonuscount; str->bonuscount = saveg_read32(); // mobj_t* attacker; str->attacker = saveg_readp(); // int extralight; str->extralight = saveg_read32(); // int fixedcolormap; str->fixedcolormap = saveg_read32(); // int colormap; str->colormap = saveg_read32(); // pspdef_t psprites[NUMPSPRITES]; for (i=0; i<NUMPSPRITES; ++i) { saveg_read_pspdef_t(&str->psprites[i]); } // boolean didsecret; str->didsecret = saveg_read32(); }
static void *saveg_readp(void) { return (void *) (intptr_t) saveg_read32(); }