From 85875da77ad8f18b628fd21b361dce47e9f5dece Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 23 Aug 2020 16:30:20 +0200 Subject: [PATCH] - 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. --- source/exhumed/src/2d.cpp | 2 - source/exhumed/src/exhumed.cpp | 1 - source/exhumed/src/exhumed.h | 6 +++ source/exhumed/src/gameloop.cpp | 1 - source/exhumed/src/init.cpp | 1 - source/exhumed/src/menu.cpp | 83 --------------------------------- source/exhumed/src/menu.h | 64 ------------------------- source/exhumed/src/player.cpp | 1 - source/exhumed/src/view.cpp | 1 - 9 files changed, 6 insertions(+), 154 deletions(-) delete mode 100644 source/exhumed/src/menu.h diff --git a/source/exhumed/src/2d.cpp b/source/exhumed/src/2d.cpp index 98bf17461..40372bcb9 100644 --- a/source/exhumed/src/2d.cpp +++ b/source/exhumed/src/2d.cpp @@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "build.h" #include "exhumed.h" -#include "menu.h" #include "names.h" #include "engine.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 "view.h" #include "raze_sound.h" -#include "menu.h" #include "v_2ddrawer.h" #include "v_font.h" #include "texturemanager.h" diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index f268a2c70..8c5b680e6 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "exhumed.h" #include "sequence.h" #include "names.h" -#include "menu.h" #include "player.h" #include "ps_input.h" #include "sound.h" diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 41d0be968..b8f766f80 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -138,6 +138,12 @@ void InitGame(); void InitNewGame(); void startmainmenu(); +int showmap(short nLevel, short nLevelNew, short nLevelBest); +void menu_DoPlasma(); +void menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest, TArray& jobs); +void DoEnergyTile(); +void InitEnergyTile(); + extern int EndLevel; extern int32_t g_commandSetup; extern int32_t g_noSetup; diff --git a/source/exhumed/src/gameloop.cpp b/source/exhumed/src/gameloop.cpp index 4ae2535ba..8e7500c28 100644 --- a/source/exhumed/src/gameloop.cpp +++ b/source/exhumed/src/gameloop.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "exhumed.h" #include "sequence.h" #include "names.h" -#include "menu.h" #include "player.h" #include "ps_input.h" #include "sound.h" diff --git a/source/exhumed/src/init.cpp b/source/exhumed/src/init.cpp index 2252dd9de..847c54777 100644 --- a/source/exhumed/src/init.cpp +++ b/source/exhumed/src/init.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "engine.h" #include "sound.h" #include "exhumed.h" -#include "menu.h" #include "ps_input.h" #include "mapinfo.h" #include "gamecontrol.h" diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index 8afcb487e..87cf68608 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "aistuff.h" #include "player.h" #include "sequence.h" -#include "menu.h" #include "names.h" #include "engine.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 "view.h" #include "raze_sound.h" -#include "menu.h" #include "v_2ddrawer.h" #include "gamestate.h" #include "statistics.h" @@ -44,12 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS -#define kSaveFileName "savgamea.sav" -#define kMaxSaveSlots 5 -#define kMaxSaveSlotChars 25 - -GameStat GameStats; - uint8_t nCinemaSeen; 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", SA(nCinemaSeen), SA(energytile), diff --git a/source/exhumed/src/menu.h b/source/exhumed/src/menu.h deleted file mode 100644 index 23e2706fd..000000000 --- a/source/exhumed/src/menu.h +++ /dev/null @@ -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 - -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 &jobs); - -void DoEnergyTile(); - -void InitEnergyTile(); - -END_PS_NS - -#endif diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index e0648f9c2..9a40ace4f 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "ps_input.h" #include "status.h" #include "sound.h" -#include "menu.h" #include "sound.h" #include "buildtiles.h" #include "gstrings.h" diff --git a/source/exhumed/src/view.cpp b/source/exhumed/src/view.cpp index f86a44442..25b17ebae 100644 --- a/source/exhumed/src/view.cpp +++ b/source/exhumed/src/view.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "exhumed.h" #include "player.h" #include "aistuff.h" -#include "menu.h" #include "sound.h" #include "mapinfo.h" #include "v_video.h"