- 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 "resource.h"
#include "sound.h"
#include "loadsave.h"
#include "sound/s_soundinternal.h"
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

View file

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

View file

@ -51,7 +51,6 @@ enum INPUT_MODE {
};
extern INPUT_MODE gInputMode;
extern int32_t gNoSetup;
extern short BloodVersion;
extern int gNetPlayers;
extern bool gRestartGame;
@ -60,14 +59,10 @@ extern double g_gameUpdateTime, g_gameUpdateAndDrawTime;
extern double g_gameUpdateAvgTime;
extern int blood_globalflags;
extern int gSaveGameNum;
extern bool gPaused;
extern bool gSaveGameActive;
extern bool gSavingGame;
extern bool gQuitGame;
extern int gQuitRequest;
extern int gCacheMiss;
extern int gDoQuickSave;
void QuitGame(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
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*))
{
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)
{
if (!at4)

View file

@ -43,9 +43,7 @@ public:
at14 = 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_84080(char *a1, void(*a2)(PLAYER*));
void sub_84110(int x, int y);
void sub_84218();
char *at0;

View file

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