void P_ArchiveSpecials(void) { thinker_t* th; int i; for(th = thinkercap.next; th != &thinkercap; th = th->next) { if(th->function.acv == (actionf_v)NULL) { for(i = 0; i < MAXCEILINGS; i++) { if(activeceilings[i] == (ceiling_t *)th) { break; } } if(i < MAXCEILINGS) { saveg_write8(tc_ceiling); saveg_write_pad(); saveg_write_ceiling_t((ceiling_t *)th); } continue; } for(i = 0; saveg_specials[i].type != tc_endthinkers; i++) { if(th->function.acp1 == (actionf_p1)saveg_specials[i].function.acp1) { saveg_write8(saveg_specials[i].type); saveg_write_pad(); saveg_specials[i].writefunc(th); saveg_write32(th == macrothinker ? 1 : 0); break; } } } // add a terminating marker saveg_write8(tc_endthinkers); }
void P_ArchiveMacros(void) { int i; saveg_write_pad(); // [kex] 12/26/11 - keep track of disabled macros for(i = 0; i < macros.macrocount; i++) { saveg_write8(macros.def[i].data[0].id == 0 ? 1 : 0); } if(!macro) { saveg_write8(0); return; } saveg_write8(1); saveg_write16(macroid); saveg_write16(macrocounter); saveg_write16(nextmacro - macro->data); saveg_write_mobjindex(mobjmacro); saveg_write16(taglistidx); for(i = 0; i < MAXQUEUELIST; i++) { saveg_write16(taglist[i]); } }
// // Write the header for a savegame // void P_WriteSaveGameHeader(char *description) { char name[VERSIONSIZE]; int i; for (i = 0; description[i] != '\0'; i++) saveg_write8(description[i]); for (; i < SAVESTRINGSIZE; i++) saveg_write8(0); memset(name, 0, sizeof(name)); strcpy(name, PACKAGE_SAVEGAMEVERSIONSTRING); for (i = 0; i < VERSIONSIZE; i++) saveg_write8(name[i]); saveg_write8(gameskill); saveg_write8(gameepisode); if (M_StringCompare(mapnum, "E1M4B")) saveg_write8(10); else if (M_StringCompare(mapnum, "E1M8B")) saveg_write8(11); else saveg_write8(gamemap); saveg_write8(gamemission); saveg_write8((leveltime >> 16) & 0xFF); saveg_write8((leveltime >> 8) & 0xFF); saveg_write8(leveltime & 0xFF); }
static void saveg_write_ticcmd_t(ticcmd_t *str) { // signed char forwardmove; saveg_write8(str->forwardmove); // signed char sidemove; saveg_write8(str->sidemove); // short angleturn; saveg_write16(str->angleturn); // short consistancy; saveg_write16(str->consistancy); // byte chatchar; saveg_write8(str->chatchar); // byte buttons; saveg_write8(str->buttons); // byte buttons2; saveg_write8(str->buttons2); // [STRIFE] // int inventory; saveg_write32(str->inventory); // [STRIFE] }
// // P_ArchiveThinkers // // [STRIFE] Verified unmodified. // void P_ArchiveThinkers (void) { thinker_t* th; // save off the current thinkers for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { if (th->function.acp1 == (actionf_p1)P_MobjThinker) { saveg_write8(tc_mobj); saveg_write_pad(); saveg_write_mobj_t((mobj_t *) th); continue; } // haleyjd: This may seem mysterious but in the DOOM prebeta, // different types of things used different thinker functions. // Those would have all been handled here and this message is // probably a relic of that old system, not to mention the odd // name of this function, and use of an enumeration with only // two values in it. // I_Error ("P_ArchiveThinkers: Unknown thinker function"); } // add a terminating marker saveg_write8(tc_end); }
void P_WriteSaveGameHeader(char *description) { char name[VERSIONSIZE]; int i; /* [STRIFE] This is in the "NAME" file in a Strife save directory. for (i=0; description[i] != '\0'; ++i) saveg_write8(description[i]); for (; i<SAVESTRINGSIZE; ++i) saveg_write8(0); */ memset (name,0,sizeof(name)); M_snprintf(name, sizeof(name), "ver %i", STRIFE_VERSION); for (i=0; i<VERSIONSIZE; ++i) saveg_write8(name[i]); saveg_write8(gameskill); // [STRIFE] This information is implicit in the file being loaded. //saveg_write8(gameepisode); //saveg_write8(gamemap); for (i=0 ; i<MAXPLAYERS ; i++) saveg_write8(playeringame[i]); saveg_write8((leveltime >> 16) & 0xff); saveg_write8((leveltime >> 8) & 0xff); saveg_write8(leveltime & 0xff); }
static void saveg_write_ticcmd_t(ticcmd_t *str) { saveg_write8(str->forwardmove); saveg_write8(str->sidemove); saveg_write16(str->angleturn); saveg_write8(str->buttons); saveg_write32(str->lookdir); }
void P_WriteSaveGameHeader(char *description) { char name[VERSIONSIZE]; int i; for (i=0; description[i] != '\0'; ++i) saveg_write8(description[i]); for (; i<SAVESTRINGSIZE; ++i) saveg_write8(0); memset(name, 0, sizeof(name)); M_snprintf(name, sizeof(name), "version %i", G_VanillaVersionCode()); for (i=0; i<VERSIONSIZE; ++i) saveg_write8(name[i]); saveg_write8(gameskill); saveg_write8(gameepisode); saveg_write8(gamemap); for (i=0 ; i<MAXPLAYERS ; i++) saveg_write8(playeringame[i]); saveg_write8((leveltime >> 16) & 0xff); saveg_write8((leveltime >> 8) & 0xff); saveg_write8(leveltime & 0xff); }
static void saveg_write32(int value) { saveg_write8(value & 0xff); saveg_write8((value >> 8) & 0xff); saveg_write8((value >> 16) & 0xff); saveg_write8((value >> 24) & 0xff); }
static void saveg_write_pad(void) { unsigned long pos = ftell(save_stream); int padding = (4 - (pos & 3)) & 3; for (int i = 0; i < padding; i++) saveg_write8(0); }
static void saveg_write_ticcmd_t(ticcmd_t *str) { // signed char forwardmove; saveg_write8(str->forwardmove); // signed char sidemove; saveg_write8(str->sidemove); // short angleturn; saveg_write16(str->angleturn); // short consistancy; saveg_write16(str->consistancy); // byte chatchar; saveg_write8(str->chatchar); // byte buttons; saveg_write8(str->buttons); }
// // P_ArchiveThinkers // void P_ArchiveThinkers(void) { // save off the current thinkers for (thinker_t *th = thinkers[th_mobj].cnext; th != &thinkers[th_mobj]; th = th->cnext) { saveg_write8(tc_mobj); saveg_write_pad(); saveg_write_mobj_t((mobj_t *)th); } // save off the bloodsplats for (int i = 0; i < numsectors; i++) for (bloodsplat_t *splat = sectors[i].splatlist; splat; splat = splat->snext) { saveg_write8(tc_bloodsplat); saveg_write_pad(); saveg_write_bloodsplat_t(splat); } // add a terminating marker saveg_write8(tc_end); }
// // P_ArchiveThinkers // void P_ArchiveThinkers (void) { thinker_t* th; // save off the current thinkers for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { if (th->function.acp1 == (actionf_p1)P_MobjThinker) { saveg_write8(tc_mobj); saveg_write_pad(); saveg_write_mobj_t((mobj_t *) th); continue; } // I_Error ("P_ArchiveThinkers: Unknown thinker function"); } // add a terminating marker saveg_write8(tc_end); }
static void saveg_write_pad(void) { unsigned long pos; int padding; int i; pos = f_tell (&save_stream); padding = (4 - (pos & 3)) & 3; for (i=0; i<padding; ++i) { saveg_write8(0); } }
static void saveg_write_ticcmd_t(ticcmd_t* cmd) { saveg_write8(cmd->forwardmove); saveg_write8(cmd->sidemove); saveg_write16(cmd->angleturn); saveg_write16(cmd->pitch); saveg_write8(cmd->consistancy); saveg_write8(cmd->chatchar); saveg_write8(cmd->buttons); saveg_write8(cmd->buttons2); }
// // P_ArchiveSpecials // void P_ArchiveSpecials(void) { int i = maxbuttons; button_t *button_ptr = buttonlist; // save off the current thinkers for (thinker_t *th = thinkers[th_misc].cnext; th != &thinkers[th_misc]; th = th->cnext) { if (!th->function) { dboolean done_one = false; for (ceilinglist_t *ceilinglist = activeceilings; ceilinglist; ceilinglist = ceilinglist->next) if (ceilinglist->ceiling == (ceiling_t *)th) { saveg_write8(tc_ceiling); saveg_write_pad(); saveg_write_ceiling_t((ceiling_t *)th); done_one = true; break; } // [jeff-d] save height of moving platforms for (platlist_t *platlist = activeplats; platlist; platlist = platlist->next) if (platlist->plat == (plat_t *)th) { saveg_write8(tc_plat); saveg_write_pad(); saveg_write_plat_t((plat_t *)th); done_one = true; break; } if (done_one) continue; } if (th->function == T_MoveCeiling) { saveg_write8(tc_ceiling); saveg_write_pad(); saveg_write_ceiling_t((ceiling_t *)th); continue; } if (th->function == T_VerticalDoor) { saveg_write8(tc_door); saveg_write_pad(); saveg_write_vldoor_t((vldoor_t *)th); continue; } if (th->function == T_MoveFloor) { saveg_write8(tc_floor); saveg_write_pad(); saveg_write_floormove_t((floormove_t *)th); continue; } if (th->function == T_PlatRaise) { saveg_write8(tc_plat); saveg_write_pad(); saveg_write_plat_t((plat_t *)th); continue; } if (th->function == T_LightFlash) { saveg_write8(tc_flash); saveg_write_pad(); saveg_write_lightflash_t((lightflash_t *)th); continue; } if (th->function == T_StrobeFlash) { saveg_write8(tc_strobe); saveg_write_pad(); saveg_write_strobe_t((strobe_t *)th); continue; } if (th->function == T_Glow) { saveg_write8(tc_glow); saveg_write_pad(); saveg_write_glow_t((glow_t *)th); continue; } if (th->function == T_FireFlicker) { saveg_write8(tc_fireflicker); saveg_write_pad(); saveg_write_fireflicker_t((fireflicker_t *)th); continue; } if (th->function == T_MoveElevator) { saveg_write8(tc_elevator); saveg_write_pad(); saveg_write_elevator_t((elevator_t *)th); continue; } if (th->function == T_Scroll) { saveg_write8(tc_scroll); saveg_write_pad(); saveg_write_scroll_t((scroll_t *)th); continue; } if (th->function == T_Pusher) { saveg_write8(tc_pusher); saveg_write_pad(); saveg_write_pusher_t((pusher_t *)th); continue; } } do { if (button_ptr->btimer) { saveg_write8(tc_button); saveg_write_pad(); saveg_write_button_t(button_ptr); } button_ptr++; } while (--i); // add a terminating marker saveg_write8(tc_endspecials); }
// // Things to handle: // // T_MoveCeiling, (ceiling_t: sector_t * swizzle), - active list // T_VerticalDoor, (vldoor_t: sector_t * swizzle), // T_MoveFloor, (floormove_t: sector_t * swizzle), // T_LightFlash, (lightflash_t: sector_t * swizzle), // T_StrobeFlash, (strobe_t: sector_t *), // T_Glow, (glow_t: sector_t *), // T_PlatRaise, (plat_t: sector_t *), - active list // void P_ArchiveSpecials (void) { thinker_t* th; int i; // save off the current thinkers for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { if (th->function.acv == (actionf_v)NULL) { for (i = 0; i < MAXCEILINGS;i++) if (activeceilings[i] == (ceiling_t *)th) break; if (i<MAXCEILINGS) { saveg_write8(tc_ceiling); saveg_write_pad(); saveg_write_ceiling_t((ceiling_t *) th); } continue; } if (th->function.acp1 == (actionf_p1)T_MoveCeiling) { saveg_write8(tc_ceiling); saveg_write_pad(); saveg_write_ceiling_t((ceiling_t *) th); continue; } if (th->function.acp1 == (actionf_p1)T_VerticalDoor) { saveg_write8(tc_door); saveg_write_pad(); saveg_write_vldoor_t((vldoor_t *) th); continue; } if (th->function.acp1 == (actionf_p1)T_MoveFloor) { saveg_write8(tc_floor); saveg_write_pad(); saveg_write_floormove_t((floormove_t *) th); continue; } if (th->function.acp1 == (actionf_p1)T_PlatRaise) { saveg_write8(tc_plat); saveg_write_pad(); saveg_write_plat_t((plat_t *) th); continue; } if (th->function.acp1 == (actionf_p1)T_LightFlash) { saveg_write8(tc_flash); saveg_write_pad(); saveg_write_lightflash_t((lightflash_t *) th); continue; } if (th->function.acp1 == (actionf_p1)T_StrobeFlash) { saveg_write8(tc_strobe); saveg_write_pad(); saveg_write_strobe_t((strobe_t *) th); continue; } if (th->function.acp1 == (actionf_p1)T_Glow) { saveg_write8(tc_glow); saveg_write_pad(); saveg_write_glow_t((glow_t *) th); continue; } } // add a terminating marker saveg_write8(tc_endspecials); }
static void saveg_write_mobj_t(mobj_t *str) { // thinker_t thinker; saveg_write_thinker_t(&str->thinker); // fixed_t x; saveg_write32(str->x); // fixed_t y; saveg_write32(str->y); // fixed_t z; saveg_write32(str->z); // struct mobj_s* snext; saveg_writep(str->snext); // struct mobj_s* sprev; saveg_writep(str->sprev); // angle_t angle; saveg_write32(str->angle); // spritenum_t sprite; saveg_write_enum(str->sprite); // int frame; saveg_write32(str->frame); // struct mobj_s* bnext; saveg_writep(str->bnext); // struct mobj_s* bprev; saveg_writep(str->bprev); // struct subsector_s* subsector; saveg_writep(str->subsector); // fixed_t floorz; saveg_write32(str->floorz); // fixed_t ceilingz; saveg_write32(str->ceilingz); // fixed_t radius; saveg_write32(str->radius); // fixed_t height; saveg_write32(str->height); // fixed_t momx; saveg_write32(str->momx); // fixed_t momy; saveg_write32(str->momy); // fixed_t momz; saveg_write32(str->momz); // int validcount; saveg_write32(str->validcount); // mobjtype_t type; saveg_write_enum(str->type); // mobjinfo_t* info; saveg_writep(str->info); // int tics; saveg_write32(str->tics); // state_t* state; saveg_write32(str->state - states); // int flags; saveg_write32(str->flags); // int health; saveg_write32(str->health); // int movedir; saveg_write32(str->movedir); // int movecount; saveg_write32(str->movecount); // struct mobj_s* target; saveg_writep(str->target); // int reactiontime; saveg_write32(str->reactiontime); // int threshold; saveg_write32(str->threshold); // struct player_s* player; if (str->player) { saveg_write32(str->player - players + 1); } else { saveg_write32(0); } // int lastlook; saveg_write32(str->lastlook); // mapthing_t spawnpoint; saveg_write_mapthing_t(&str->spawnpoint); // struct mobj_s* tracer; saveg_writep(str->tracer); // byte miscdata; saveg_write8(str->miscdata); // [STRIFE] Only change to mobj_t. }
void P_WriteSaveGameEOF(void) { saveg_write8(SAVEGAME_EOF); }
static void saveg_write16(short value) { saveg_write8(value & 0xff); saveg_write8((value >> 8) & 0xff); }
static void saveg_write_header(char *description) { int i; int size; char date[32]; byte* tbn; for(i = 0; description[i] != '\0'; i++) { saveg_write8(description[i]); } for(; i < SAVESTRINGSIZE; i++) { saveg_write8(0); } sprintf(date, "%s", saveg_gettime()); size = dstrlen(date); for(i = 0; i < size; i++) { saveg_write8(date[i]); } for(; i < 32; i++) { saveg_write8(0); } size = M_CacheThumbNail(&tbn); saveg_write32(size); for(i = 0; i < size; i++) { saveg_write8(tbn[i]); } Z_Free(tbn); for(i = 0; i < 16; i++) { saveg_write8(passwordData[i]); } saveg_write8(gameskill); saveg_write8(gamemap); saveg_write8(nextmap); saveg_write_pad(); saveg_write16(globalint); // // [kex] 12/26/11 - write total stat info // saveg_write_pad(); saveg_write32(totalkills); saveg_write32(totalitems); saveg_write32(totalsecret); for(i = 0; i < MAXPLAYERS; i++) { saveg_write8(playeringame[i]); } saveg_write8((leveltime >> 16) & 0xff); saveg_write8((leveltime >> 8) & 0xff); saveg_write8(leveltime & 0xff); saveg_write_pad(); }
// // P_ArchiveWorld // void P_ArchiveWorld(void) { int i; int j; sector_t *sec; line_t *li; side_t *si; light_t *light; // do sectors for(i = 0, sec = sectors; i < numsectors; i++, sec++) { saveg_write16(F2INT(sec->floorheight)); saveg_write16(F2INT(sec->ceilingheight)); saveg_write16(sec->floorpic); saveg_write16(sec->ceilingpic); saveg_write16(sec->special); saveg_write16(sec->tag); saveg_write16(sec->flags); saveg_write16(sec->lightlevel); saveg_write32(sec->xoffset); saveg_write32(sec->yoffset); saveg_write_mobjindex(sec->soundtarget); for(j = 0; j < 5; j++) { saveg_write16(sec->colors[j]); } } // do lines for(i = 0, li = lines; i < numlines; i++, li++) { saveg_write16((li->flags >> 16)); saveg_write16((li->flags & 0xFFFF)); saveg_write16(li->special); saveg_write16(li->tag); for(j = 0; j < 2; j++) { if(li->sidenum[j] == NO_SIDE_INDEX) { continue; } si = &sides[li->sidenum[j]]; saveg_write16(F2INT(si->textureoffset)); saveg_write16(F2INT(si->rowoffset)); saveg_write16(si->toptexture); saveg_write16(si->bottomtexture); saveg_write16(si->midtexture); } } // do lights for(i = 0, light = lights; i < numlights; i++, light++) { saveg_write8(light->base_r); saveg_write8(light->base_g); saveg_write8(light->base_b); saveg_write8(light->active_r); saveg_write8(light->active_g); saveg_write8(light->active_b); saveg_write8(light->r); saveg_write8(light->g); saveg_write8(light->b); saveg_write_pad(); saveg_write16(light->tag); } }