void InitSaveshots(qboolean loadmenu) { int i; char shotname [MAX_QPATH]; char mapshotname [MAX_QPATH]; for (i = 1; i < MAX_SAVEGAMES; i++) { // free previously loaded shots Com_sprintf(shotname, sizeof(shotname), "save/kmq2save%i/shot.jpg", i); R_FreePic(shotname); Com_sprintf(shotname, sizeof(shotname), "/save/kmq2save%i/shot.jpg", i); if (R_DrawFindPic(shotname)) { m_saveshotvalid[i] = true; } else { m_saveshotvalid[i] = false; } } if (loadmenu) { // register mapshot for autosave if (m_savevalid[0]) { Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", m_mapname); if (R_DrawFindPic(mapshotname)) { m_mapshotvalid = true; } else { m_mapshotvalid = false; } } else { m_mapshotvalid = false; } } // register null saveshot if (R_DrawFindPic("/gfx/ui/noscreen.pcx")) { m_saveshotvalid[MAX_SAVEGAMES] = true; } else { m_saveshotvalid[MAX_SAVEGAMES] = false; } }
/* ============== SV_Loadgame_f ============== */ void SV_Loadgame_f (void) { char name[MAX_OSPATH]; FILE *f; char *dir; if (Cmd_Argc() != 2) { Com_Printf ("USAGE: loadgame <directory>\n"); return; } Com_Printf ("Loading game...\n"); dir = Cmd_Argv(1); if (strstr (dir, "..") || strstr (dir, "/") || strstr (dir, "\\") ) { Com_Printf ("Bad savedir.\n"); } // make sure the server.ssv file exists Com_sprintf (name, sizeof(name), "%s/save/%s/server.ssv", FS_Gamedir(), Cmd_Argv(1)); f = fopen (name, "rb"); if (!f) { Com_Printf ("No such savegame: %s\n", name); return; } fclose (f); // Knightmare- set saveshot name if ( !dedicated->value && (!strcmp(Cmd_Argv(1), "quick") || !strcmp(Cmd_Argv(1), "quik")) ) { Com_sprintf(sv_loadshotname, sizeof(sv_loadshotname), "save/%s/shot.png", Cmd_Argv(1)); R_FreePic (sv_loadshotname); Com_sprintf(sv_loadshotname, sizeof(sv_loadshotname), "/save/%s/shot.png", Cmd_Argv(1)); load_saveshot = R_DrawFindPic(sv_loadshotname); } SV_CopySaveGame (Cmd_Argv(1), "current"); SV_ReadServerFile (); // go to the map sv.state = ss_dead; // don't save current level when changing SV_Map (false, svs.mapcmd, true); }
void Options_Screen_Teardown (void) { int i; char *str = va("ch%i.img", (int32_t)Cvar_VariableValue("crosshair")); crosshairs[0] = 0; for (i = 0; i < numcrosshairs; i++) { if (crosshair_names[i]) { Z_Free(crosshair_names[i]); crosshair_names[i] = NULL; } if (crosshairs[i] && !strstr(crosshairs[i]->name,str)) { R_FreePic(crosshairs[i]->name); crosshairs[i] = NULL; } } }