- continued work on Blood save state

* save and restore the ambient sound state
* removed a few unused global variables
* removed unused code from choke.cpp
This commit is contained in:
Christoph Oelckers 2020-02-12 00:43:13 +01:00
parent fd384a5f47
commit 9fdd1d9e17
6 changed files with 35 additions and 53 deletions

View file

@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "player.h" #include "player.h"
#include "resource.h" #include "resource.h"
#include "sound.h" #include "sound.h"
#include "loadsave.h"
#include "sound/s_soundinternal.h" #include "sound/s_soundinternal.h"
BEGIN_BLD_NS BEGIN_BLD_NS
@ -151,4 +152,36 @@ void ambInit(void)
} }
} }
class ASoundLoadSave : public LoadSave
{
virtual void Load(void);
virtual void Save(void);
};
void ASoundLoadSave::Load(void)
{
for (auto &amb : ambChannels)
{
Read(&amb.check, sizeof(amb.check));
amb.soundID = FSoundID(amb.check);
amb.distance = 0;
}
}
void ASoundLoadSave::Save(void)
{
for (auto &amb : ambChannels)
{
Write(&amb.check, sizeof(amb.check));
}
}
static ASoundLoadSave *myLoadSave;
void ASoundLoadSaveConstruct(void)
{
myLoadSave = new ASoundLoadSave();
}
END_BLD_NS END_BLD_NS

View file

@ -77,8 +77,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
int32_t gNoSetup = 0, gCommandSetup = 0;
INPUT_MODE gInputMode; INPUT_MODE gInputMode;
#ifdef USE_QHEAP #ifdef USE_QHEAP
@ -103,12 +101,9 @@ int gChokeCounter = 0;
double g_gameUpdateTime, g_gameUpdateAndDrawTime; double g_gameUpdateTime, g_gameUpdateAndDrawTime;
double g_gameUpdateAvgTime = 0.001; double g_gameUpdateAvgTime = 0.001;
int gSaveGameNum;
bool gQuitGame; bool gQuitGame;
int gQuitRequest; int gQuitRequest;
bool gPaused; bool gPaused;
bool gSaveGameActive;
int gCacheMiss;
enum gametokens enum gametokens
{ {
@ -669,7 +664,6 @@ void StartLevel(GAMEOPTIONS *gameOptions)
sfxSetReverb(0); sfxSetReverb(0);
ambInit(); ambInit();
sub_79760(); sub_79760();
gCacheMiss = 0;
gFrame = 0; gFrame = 0;
gChokeCounter = 0; gChokeCounter = 0;
if (!gDemo.at1) if (!gDemo.at1)
@ -719,7 +713,6 @@ void StartNetworkLevel(void)
StartLevel(&gGameOptions); StartLevel(&gGameOptions);
} }
int gDoQuickSave = 0;
void LocalKeys(void) void LocalKeys(void)
{ {

View file

@ -51,7 +51,6 @@ enum INPUT_MODE {
}; };
extern INPUT_MODE gInputMode; extern INPUT_MODE gInputMode;
extern int32_t gNoSetup;
extern short BloodVersion; extern short BloodVersion;
extern int gNetPlayers; extern int gNetPlayers;
extern bool gRestartGame; extern bool gRestartGame;
@ -60,14 +59,10 @@ extern double g_gameUpdateTime, g_gameUpdateAndDrawTime;
extern double g_gameUpdateAvgTime; extern double g_gameUpdateAvgTime;
extern int blood_globalflags; extern int blood_globalflags;
extern int gSaveGameNum;
extern bool gPaused; extern bool gPaused;
extern bool gSaveGameActive;
extern bool gSavingGame; extern bool gSavingGame;
extern bool gQuitGame; extern bool gQuitGame;
extern int gQuitRequest; extern int gQuitRequest;
extern int gCacheMiss;
extern int gDoQuickSave;
void QuitGame(void); void QuitGame(void);
void PreloadCache(void); void PreloadCache(void);

View file

@ -36,26 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
void CChoke::sub_83F54(char *a1, int _x, int _y, void (*a2)(PLAYER*))
{
at14 = _x;
at18 = _y;
at0 = a1;
at1c = a2;
if (!at4 && at0)
{
at4 = gSysRes.Lookup(at0, "QAV");
if (!at4)
ThrowError("Could not load QAV %s\n", at0);
at8 = (QAV*)gSysRes.Lock(at4);
at8->nSprite = -1;
at8->x = at14;
at8->y = at18;
at8->Preload();
sub_84218();
}
}
void CChoke::sub_83ff0(int a1, void(*a2)(PLAYER*)) void CChoke::sub_83ff0(int a1, void(*a2)(PLAYER*))
{ {
at0 = NULL; at0 = NULL;
@ -74,24 +54,6 @@ void CChoke::sub_83ff0(int a1, void(*a2)(PLAYER*))
} }
} }
void CChoke::sub_84080(char *a1, void(*a2)(PLAYER*))
{
at0 = a1;
at1c = a2;
if (!at4 && at0)
{
at4 = gSysRes.Lookup(at0, "QAV");
if (!at4)
ThrowError("Could not load QAV %s\n", at0);
at8 = (QAV*)gSysRes.Lock(at4);
at8->nSprite = -1;
at8->x = at14;
at8->y = at18;
at8->Preload();
sub_84218();
}
}
void CChoke::sub_84110(int x, int y) void CChoke::sub_84110(int x, int y)
{ {
if (!at4) if (!at4)

View file

@ -43,9 +43,7 @@ public:
at14 = 0; at14 = 0;
at18 = 0; at18 = 0;
}; };
void sub_83F54(char *a1, int _x, int _y, void(*a2)(PLAYER*));
void sub_83ff0(int a1, void(*a2)(PLAYER*)); void sub_83ff0(int a1, void(*a2)(PLAYER*));
void sub_84080(char *a1, void(*a2)(PLAYER*));
void sub_84110(int x, int y); void sub_84110(int x, int y);
void sub_84218(); void sub_84218();
char *at0; char *at0;

View file

@ -565,7 +565,6 @@ bool GameInterface::LoadGame(FSaveGameNode* node)
} }
gFrameTicks = 0; gFrameTicks = 0;
gFrame = 0; gFrame = 0;
gCacheMiss = 0;
gFrameRate = 0; gFrameRate = 0;
totalclock = 0; totalclock = 0;
gPaused = 0; gPaused = 0;
@ -835,6 +834,7 @@ void ViewLoadSaveConstruct(void);
void WarpLoadSaveConstruct(void); void WarpLoadSaveConstruct(void);
void WeaponLoadSaveConstruct(void); void WeaponLoadSaveConstruct(void);
void NNLoadSaveConstruct(void); void NNLoadSaveConstruct(void);
void ASoundLoadSaveConstruct(void);
void LoadSaveSetup(void) void LoadSaveSetup(void)
{ {
@ -854,6 +854,7 @@ void LoadSaveSetup(void)
WarpLoadSaveConstruct(); WarpLoadSaveConstruct();
WeaponLoadSaveConstruct(); WeaponLoadSaveConstruct();
NNLoadSaveConstruct(); NNLoadSaveConstruct();
ASoundLoadSaveConstruct();
} }
END_BLD_NS END_BLD_NS