- removed the old start-of-level-only savegame code.

This serves no purpose anymore, even with a checkpoint-based gameplay the full saves will do just as well.
This commit is contained in:
Christoph Oelckers 2020-08-23 16:30:20 +02:00
parent f7fcd341ec
commit 85875da77a
9 changed files with 6 additions and 154 deletions

View file

@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h" #include "compat.h"
#include "build.h" #include "build.h"
#include "exhumed.h" #include "exhumed.h"
#include "menu.h"
#include "names.h" #include "names.h"
#include "engine.h" #include "engine.h"
#include "c_bind.h" #include "c_bind.h"
@ -29,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ps_input.h" #include "ps_input.h"
#include "view.h" #include "view.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "menu.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "v_font.h" #include "v_font.h"
#include "texturemanager.h" #include "texturemanager.h"

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "exhumed.h" #include "exhumed.h"
#include "sequence.h" #include "sequence.h"
#include "names.h" #include "names.h"
#include "menu.h"
#include "player.h" #include "player.h"
#include "ps_input.h" #include "ps_input.h"
#include "sound.h" #include "sound.h"

View file

@ -138,6 +138,12 @@ void InitGame();
void InitNewGame(); void InitNewGame();
void startmainmenu(); void startmainmenu();
int showmap(short nLevel, short nLevelNew, short nLevelBest);
void menu_DoPlasma();
void menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest, TArray<JobDesc>& jobs);
void DoEnergyTile();
void InitEnergyTile();
extern int EndLevel; extern int EndLevel;
extern int32_t g_commandSetup; extern int32_t g_commandSetup;
extern int32_t g_noSetup; extern int32_t g_noSetup;

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "exhumed.h" #include "exhumed.h"
#include "sequence.h" #include "sequence.h"
#include "names.h" #include "names.h"
#include "menu.h"
#include "player.h" #include "player.h"
#include "ps_input.h" #include "ps_input.h"
#include "sound.h" #include "sound.h"

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "engine.h" #include "engine.h"
#include "sound.h" #include "sound.h"
#include "exhumed.h" #include "exhumed.h"
#include "menu.h"
#include "ps_input.h" #include "ps_input.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "gamecontrol.h" #include "gamecontrol.h"

View file

@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "aistuff.h" #include "aistuff.h"
#include "player.h" #include "player.h"
#include "sequence.h" #include "sequence.h"
#include "menu.h"
#include "names.h" #include "names.h"
#include "engine.h" #include "engine.h"
#include "c_bind.h" #include "c_bind.h"
@ -32,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ps_input.h" #include "ps_input.h"
#include "view.h" #include "view.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "menu.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "gamestate.h" #include "gamestate.h"
#include "statistics.h" #include "statistics.h"
@ -44,12 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS BEGIN_PS_NS
#define kSaveFileName "savgamea.sav"
#define kMaxSaveSlots 5
#define kMaxSaveSlotChars 25
GameStat GameStats;
uint8_t nCinemaSeen; uint8_t nCinemaSeen;
uint8_t energytile[66 * 66] = {0}; uint8_t energytile[66 * 66] = {0};
@ -246,81 +238,6 @@ void DoEnergyTile()
} }
} }
void menu_GameLoad2(FILE* fp, bool bIsDemo)
{
fread(&GameStats, sizeof(GameStats), 1, fp);
nPlayerWeapons[nLocalPlayer] = GameStats.nWeapons;
PlayerList[nLocalPlayer].nCurrentWeapon = GameStats.nCurrentWeapon;
nPlayerClip[nLocalPlayer] = GameStats.clip;
int nPistolBullets = PlayerList[nLocalPlayer].nAmmo[kWeaponPistol];
if (nPistolBullets >= 6) {
nPistolBullets = 6;
}
nPistolClip[nLocalPlayer] = nPistolBullets;
memcpy(&PlayerList[nLocalPlayer], &GameStats.player, sizeof(Player));
nPlayerItem[nLocalPlayer] = GameStats.items;
nPlayerLives[nLocalPlayer] = GameStats.nLives;
SetPlayerItem(nLocalPlayer, nPlayerItem[nLocalPlayer]);
CheckClip(nLocalPlayer);
}
short menu_GameLoad(int nSlot)
{
memset(&GameStats, 0, sizeof(GameStats));
FILE* fp = fopen(kSaveFileName, "rb");
if (fp == NULL) {
return 0;
}
fseek(fp, 125, SEEK_SET);
fseek(fp, nSlot * sizeof(GameStats), SEEK_CUR);
menu_GameLoad2(fp);
fclose(fp);
return GameStats.nMap;
}
void menu_GameSave2(FILE* fp)
{
memset(&GameStats, 0, sizeof(GameStats));
//GameStats.nMap = (uint8_t)levelnum;
GameStats.nWeapons = nPlayerWeapons[nLocalPlayer];
GameStats.nCurrentWeapon = PlayerList[nLocalPlayer].nCurrentWeapon;
GameStats.clip = nPlayerClip[nLocalPlayer];
GameStats.items = nPlayerItem[nLocalPlayer];
GameStats.nLives = nPlayerLives[nLocalPlayer];
memcpy(&GameStats.player, &PlayerList[nLocalPlayer], sizeof(GameStats.player));
fwrite(&GameStats, sizeof(GameStats), 1, fp);
}
void menu_GameSave(int nSaveSlot)
{
if (nSaveSlot < 0) {
return;
}
FILE* fp = fopen(kSaveFileName, "rb+");
if (fp != NULL)
{
fseek(fp, 125, SEEK_SET); // skip save slot names
fseek(fp, sizeof(GameStat) * nSaveSlot, SEEK_CUR);
menu_GameSave2(fp);
fclose(fp);
}
}
static SavegameHelper sgh("menu", static SavegameHelper sgh("menu",
SA(nCinemaSeen), SA(nCinemaSeen),
SA(energytile), SA(energytile),

View file

@ -1,64 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 sirlemonhead, Nuke.YKT
This file is part of PCExhumed.
PCExhumed is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#ifndef __menu_h__
#define __menu_h__
#include "player.h"
#include <stdio.h>
BEGIN_PS_NS
#pragma pack(1)
// should be 75 bytes
struct GameStat
{
uint8_t nMap;
short nWeapons;
short nCurrentWeapon;
short clip;
short items;
Player player;
short nLives;
};
#pragma pack()
extern GameStat GameStats;
extern unsigned char cinemapal[];
int showmap(short nLevel, short nLevelNew, short nLevelBest);
void menu_DoPlasma();
int menu_Menu(int val);
short menu_GameLoad(int nSlot);
void menu_GameLoad2(FILE *fp, bool bIsDemo = false);
void menu_GameSave2(FILE *fp);
void menu_GameSave(int nSaveSlot);
void menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest, TArray<JobDesc> &jobs);
void DoEnergyTile();
void InitEnergyTile();
END_PS_NS
#endif

View file

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ps_input.h" #include "ps_input.h"
#include "status.h" #include "status.h"
#include "sound.h" #include "sound.h"
#include "menu.h"
#include "sound.h" #include "sound.h"
#include "buildtiles.h" #include "buildtiles.h"
#include "gstrings.h" #include "gstrings.h"

View file

@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "exhumed.h" #include "exhumed.h"
#include "player.h" #include "player.h"
#include "aistuff.h" #include "aistuff.h"
#include "menu.h"
#include "sound.h" #include "sound.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "v_video.h" #include "v_video.h"