- Blood: Savegame fully transitioned to JSON

not tested yet.
This commit is contained in:
Christoph Oelckers 2020-11-22 16:47:08 +01:00
parent 572d3c9944
commit 9a4073508d
29 changed files with 763 additions and 912 deletions

View file

@ -46,7 +46,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gib.h"
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "player.h"
#include "seq.h"
#include "sound.h"

View file

@ -41,7 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gib.h"
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "player.h"
#include "seq.h"
#include "sound.h"
@ -1773,56 +1772,13 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, DUDEEXTRA& w, DUDE
//
//---------------------------------------------------------------------------
FSerializer& Serialize(FSerializer& arc, const char* keyname, GENDUDEEXTRA& w, GENDUDEEXTRA* def)
{
if (arc.BeginObject(keyname))
{
arc.Array("initvals", w.initVals, 3)
.Array("availdeaths", w.availDeaths, kDamageMax)
("movespeed", w.moveSpeed)
("firedist", w.fireDist)
("throwdist", w.throwDist)
("curweapon", w.curWeapon)
("weapontype", w.weaponType)
("basedispersion", w.baseDispersion)
("slavecount", w.slaveCount)
("lifeleech", w.nLifeLeech)
.Array("slaves", w.slave, w.slaveCount)
.Array("dmgcontrol", w.dmgControl, kDamageMax)
.Array("updreq", w.updReq, kGenDudePropertyMax)
("flags", w.flags)
.EndObject();
}
return arc;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void SerializeAI(FSerializer& arc)
{
if (arc.BeginObject("ai"))
{
arc.SparseArray("dudeslope", gDudeSlope, kMaxSprites, activeXSprites)
.SparseArray("dudeextra", gDudeExtra, kMaxSprites, activeXSprites);
// the GenDudeArray only contains valid info for kDudeModernCustom and kDudeModernCustomBurning so only save the relevant entries as these are not small.
bool foundsome = false;
for (int i = 0; i < kMaxSprites; i++)
{
if (activeSprites[i] && (sprite[i].type == kDudeModernCustom || sprite[i].type == kDudeModernCustomBurning))
{
if (!foundsome) arc.BeginArray("gendudeextra");
foundsome = true;
arc(nullptr, gGenDudeExtra[i]);
}
}
if (foundsome) arc.EndArray();
arc.EndObject();
.SparseArray("dudeextra", gDudeExtra, kMaxSprites, activeXSprites)
.EndObject();
}
}

View file

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"
#include "view.h"

View file

@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "db.h"
#include "player.h"
#include "sound.h"
#include "loadsave.h"
#include "raze_sound.h"
BEGIN_BLD_NS

View file

@ -40,7 +40,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gib.h"
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "seq.h"
#include "sound.h"
@ -502,7 +501,6 @@ void GameInterface::app_init()
FireInit();
Printf(PRINT_NONOTIFY, "Initializing weapon animations\n");
WeaponInit();
LoadSaveSetup();
myconnectindex = connecthead = 0;
gNetPlayers = numplayers = 1;

View file

@ -82,8 +82,6 @@ struct GameInterface : ::GameInterface
void MenuClosed() override;
bool CanSave() override;
bool StartGame(FNewGameStartup& gs) override;
bool SaveGame() override;
bool LoadGame() override;
void QuitToTitle() override;
FString GetCoordString() override;
ReservedSpace GetReservedScreenSpace(int viewsize) override;

View file

@ -463,13 +463,8 @@ struct LOCATION {
int ang;
};
struct POINT2D {
int x, y;
};
struct POINT3D {
int x, y, z;
};
using POINT2D = vec2_t;
using POINT3D = vec3_t;
struct VECTOR2D {
int dx, dy;

View file

@ -47,6 +47,9 @@ XSPRITE xsprite[kMaxXSprites];
XSECTOR xsector[kMaxXSectors];
XWALL xwall[kMaxXWalls];
XSECTOR xsectorbackup[kMaxXSectors];
XWALL xwallbackup[kMaxXWalls];
SPRITEHIT gSpriteHit[kMaxXSprites];
int xvel[kMaxSprites], yvel[kMaxSprites], zvel[kMaxSprites];
@ -274,6 +277,20 @@ void InitFreeList(unsigned short *pList, int nCount)
pList[0] = nCount - 1;
}
void InitFreeList(unsigned short* pList, int nCount, FixedBitArray<MAXSPRITES>&used)
{
int lastfree = 0;
for (int i = 1; i < nCount; i++)
{
if (!used[i])
{
pList[i] = lastfree;
lastfree = i;
}
}
pList[0] = lastfree;
}
void InsertFree(unsigned short *pList, int nIndex)
{
pList[nIndex] = pList[0];
@ -391,14 +408,13 @@ void PropagateMarkerReferences(void)
}
}
bool byte_1A76C6, byte_1A76C7, byte_1A76C8;
bool drawtile2048, encrypted;
MAPHEADER2 byte_19AE44;
unsigned int dbReadMapCRC(const char *pPath)
{
byte_1A76C7 = 0;
byte_1A76C8 = 0;
encrypted = 0;
FString mapname = pPath;
DefaultExtension(mapname, ".map");
@ -422,7 +438,7 @@ unsigned int dbReadMapCRC(const char *pPath)
}
else if ((ver & 0xff00) == 0x700)
{
byte_1A76C8 = 1;
encrypted = 1;
}
else
{
@ -432,7 +448,7 @@ unsigned int dbReadMapCRC(const char *pPath)
return fr.ReadInt32();
}
int gMapRev, gSongId, gSkyCount;
int gMapRev, gMattId, gSkyCount;
//char byte_19AE44[128];
const int nXSectorSize = 60;
const int nXSpriteSize = 56;
@ -517,9 +533,9 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
{
I_Error("%s: Map file corrupted", mapname.GetChars());
}
byte_1A76C8 = 0;
encrypted = 0;
if ((LittleShort(header.version) & 0xff00) == 0x700) {
byte_1A76C8 = 1;
encrypted = 1;
#ifdef NOONE_EXTENSIONS
// indicate if the map requires modern features to work properly
@ -536,7 +552,6 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
fr.Read(&mapHeader,37/* sizeof(mapHeader)*/);
if (mapHeader.mattid != 0 && mapHeader.mattid != 0x7474614d && mapHeader.mattid != 0x4d617474) {
dbCrypt((char*)&mapHeader, sizeof(mapHeader), 0x7474614d);
byte_1A76C7 = 1;
}
mapHeader.x = LittleLong(mapHeader.x);
@ -558,16 +573,16 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
*pAngle = mapHeader.ang;
*pSector = mapHeader.sect;
gVisibility = g_visibility = mapHeader.visibility;
gSongId = mapHeader.mattid;
if (byte_1A76C8)
gMattId = mapHeader.mattid;
if (encrypted)
{
if (mapHeader.mattid == 0x7474614d || mapHeader.mattid == 0x4d617474)
{
byte_1A76C6 = 1;
drawtile2048 = 1;
}
else if (!mapHeader.mattid)
{
byte_1A76C6 = 0;
drawtile2048 = 0;
}
else
{
@ -583,7 +598,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
numsectors = mapHeader.numsectors;
numwalls = mapHeader.numwalls;
dbInit();
if (byte_1A76C8)
if (encrypted)
{
fr.Read(&byte_19AE44, 128);
dbCrypt((char*)&byte_19AE44, 128, numwalls);
@ -598,7 +613,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
}
gSkyCount = 1<< mapHeader.pskybits;
fr.Read(tpskyoff, gSkyCount*sizeof(tpskyoff[0]));
if (byte_1A76C8)
if (encrypted)
{
dbCrypt((char*)tpskyoff, gSkyCount*sizeof(tpskyoff[0]), gSkyCount*2);
}
@ -616,7 +631,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
sectortype *pSector = &sector[i];
sectortypedisk load;
fr.Read(&load, sizeof(sectortypedisk));
if (byte_1A76C8)
if (encrypted)
{
dbCrypt((char*)&load, sizeof(sectortypedisk), gMapRev*sizeof(sectortypedisk));
}
@ -652,7 +667,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
XSECTOR *pXSector = &xsector[nXSector];
memset(pXSector, 0, sizeof(XSECTOR));
int nCount;
if (!byte_1A76C8)
if (!encrypted)
{
nCount = nXSectorSize;
}
@ -750,7 +765,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
walltype *pWall = &wall[i];
walltypedisk load;
fr.Read(&load, sizeof(walltypedisk));
if (byte_1A76C8)
if (encrypted)
{
dbCrypt((char*)&load, sizeof(walltypedisk), (gMapRev*sizeof(sectortypedisk)) | 0x7474614d);
}
@ -779,7 +794,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
XWALL *pXWall = &xwall[nXWall];
memset(pXWall, 0, sizeof(XWALL));
int nCount;
if (!byte_1A76C8)
if (!encrypted)
{
nCount = nXWallSize;
}
@ -833,7 +848,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
spritetypedisk load;
spritetype *pSprite = &sprite[i];
fr.Read(&load, sizeof(spritetypedisk)); // load into an intermediate buffer so that spritetype is no longer bound by file formats.
if (byte_1A76C8) // What were these people thinking? :(
if (encrypted) // What were these people thinking? :(
{
dbCrypt((char*)&load, sizeof(spritetypedisk), (gMapRev*sizeof(spritetypedisk)) | 0x7474614d);
}
@ -874,7 +889,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
XSPRITE *pXSprite = &xsprite[nXSprite];
memset(pXSprite, 0, sizeof(XSPRITE));
int nCount;
if (!byte_1A76C8)
if (!encrypted)
{
nCount = nXSpriteSize;
}
@ -948,7 +963,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
bitReader.skipBits(32);
xsprite[sprite[i].extra].reference = i;
xsprite[sprite[i].extra].busy = IntToFixed(xsprite[sprite[i].extra].state);
if (!byte_1A76C8) {
if (!encrypted) {
xsprite[sprite[i].extra].lT |= xsprite[sprite[i].extra].lB;
}
@ -978,22 +993,22 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
if (pCRC)
*pCRC = nCRC;
PropagateMarkerReferences();
if (byte_1A76C8)
if (encrypted)
{
if (gSongId == 0x7474614d || gSongId == 0x4d617474)
if (gMattId == 0x7474614d || gMattId == 0x4d617474)
{
byte_1A76C6 = 1;
drawtile2048 = 1;
}
else if (!gSongId)
else if (!gMattId)
{
byte_1A76C6 = 0;
drawtile2048 = 0;
}
else
{
I_Error("%s: Corrupted Map file", mapname.GetChars());
}
}
else if (gSongId != 0)
else if (gMattId != 0)
{
I_Error("%s: Corrupted Map file", mapname.GetChars());
}

View file

@ -298,13 +298,17 @@ struct SPRITEHIT {
extern unsigned short gStatCount[kMaxStatus + 1];;
extern bool byte_1A76C6, byte_1A76C7, byte_1A76C8;
extern bool drawtile2048, encrypted;
extern MAPHEADER2 byte_19AE44;
extern XSPRITE xsprite[kMaxXSprites];
extern XSECTOR xsector[kMaxXSectors];
extern XWALL xwall[kMaxXWalls];
extern XSECTOR xsectorbackup[kMaxXSectors];
extern XWALL xwallbackup[kMaxXWalls];
extern FixedBitArray<MAXSPRITES> activeXSprites;
extern SPRITEHIT gSpriteHit[kMaxXSprites];
extern char qsector_filler[kMaxSectors];
@ -312,7 +316,7 @@ extern char qsector_filler[kMaxSectors];
extern int xvel[kMaxSprites], yvel[kMaxSprites], zvel[kMaxSprites];
extern int gVisibility;
extern int gMapRev, gSongId, gSkyCount;
extern int gMapRev, gMattId, gSkyCount;
extern const char *gItemText[];
extern const char *gAmmoText[];
extern const char *gWeaponText[];
@ -366,6 +370,7 @@ int qchangespritesect(short nSprite, short nSector);
int ChangeSpriteStat(int nSprite, int nStatus);
int qchangespritestat(short nSprite, short nStatus);
void InitFreeList(unsigned short *pList, int nCount);
void InitFreeList(unsigned short* pList, int nCount, FixedBitArray<MAXSPRITES>& activeXSprites);
void InsertFree(unsigned short *pList, int nIndex);
unsigned short dbInsertXSprite(int nSprite);
void dbDeleteXSprite(int nXSprite);

View file

@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "player.h"
#include "sound.h"
#include "view.h"

View file

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"
#include "view.h"

View file

@ -32,7 +32,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "inifile.h"
#include "levels.h"
#include "loadsave.h"
#include "messages.h"
#include "seq.h"
#include "sound.h"
@ -45,7 +44,7 @@ BEGIN_BLD_NS
GAMEOPTIONS gGameOptions;
GAMEOPTIONS gSingleGameOptions = {
0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 3600, 1800, 1800, 7200
0, 2, 0, 0, 0, 0, 0, 0, 2, 3600, 1800, 1800, 7200
};
EPISODEINFO gEpisodeInfo[kMaxEpisodes+1];

View file

@ -49,8 +49,6 @@ enum EGameFlag
struct GAMEOPTIONS {
unsigned char nGameType;
unsigned char nDifficulty;
short nSaveGameSlot;
int picEntry;
char nMonsterSettings;
int uGameFlags;
int uNetGameFlags;

File diff suppressed because it is too large Load diff

View file

@ -27,23 +27,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
struct FSavegameNode;
BEGIN_BLD_NS
class LoadSave {
public:
static LoadSave head;
static FileWriter *hSFile;
static FileReader hLFile;
static TDeletingArray<LoadSave*> loadSaves;
LoadSave() {
loadSaves.Push(this);
}
virtual ~LoadSave() = default;
virtual void Save(void);
virtual void Load(void);
void Read(void *, int);
void Write(const void *, int);
};
void LoadSaveSetup(void);
extern FixedBitArray<MAXSPRITES> activeXSprites;
END_BLD_NS

View file

@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "eventq.h"
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "messages.h"
#include "player.h"
#include "view.h"

View file

@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "blood.h"
#include "db.h"
#include "gameutil.h"
#include "loadsave.h"
#include "player.h"
#include "view.h"

View file

@ -32,7 +32,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "nnexts.h"
#ifdef NOONE_EXTENSIONS
#include <random>
#include "loadsave.h"
#include "player.h"
#include "aiunicult.h"
#include "triggers.h"
@ -45,6 +44,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sound.h"
#include "seq.h"
#include "ai.h"
#include "savegamehelp.h"
BEGIN_BLD_NS
@ -5286,43 +5286,83 @@ void callbackGenDudeUpdate(int nSprite) // 24
}
class NNLoadSave : public LoadSave
{
virtual void Load(void);
virtual void Save(void);
};
void NNLoadSave::Load(void)
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
FSerializer& Serialize(FSerializer& arc, const char* keyname, GENDUDEEXTRA& w, GENDUDEEXTRA* def)
{
Read(gSpriteMass, sizeof(gSpriteMass));
Read(&gProxySpritesCount, sizeof(gProxySpritesCount));
Read(gProxySpritesList, sizeof(gProxySpritesList));
Read(&gSightSpritesCount, sizeof(gSightSpritesCount));
Read(gSightSpritesList, sizeof(gSightSpritesList));
Read(&gPhysSpritesCount, sizeof(gPhysSpritesCount));
Read(gPhysSpritesList, sizeof(gPhysSpritesList));
Read(&gImpactSpritesCount, sizeof(gImpactSpritesCount));
Read(gImpactSpritesList, sizeof(gImpactSpritesList));
Read(&gEventRedirectsUsed, sizeof(gEventRedirectsUsed));
if (arc.BeginObject(keyname))
{
arc.Array("initvals", w.initVals, 3)
.Array("availdeaths", w.availDeaths, kDamageMax)
("movespeed", w.moveSpeed)
("firedist", w.fireDist)
("throwdist", w.throwDist)
("curweapon", w.curWeapon)
("weapontype", w.weaponType)
("basedispersion", w.baseDispersion)
("slavecount", w.slaveCount)
("lifeleech", w.nLifeLeech)
.Array("slaves", w.slave, w.slaveCount)
.Array("dmgcontrol", w.dmgControl, kDamageMax)
.Array("updreq", w.updReq, kGenDudePropertyMax)
("flags", w.flags)
.EndObject();
}
return arc;
}
void NNLoadSave::Save(void)
FSerializer& Serialize(FSerializer& arc, const char* keyname, SPRITEMASS& w, SPRITEMASS* def)
{
Write(gSpriteMass, sizeof(gSpriteMass));
Write(&gProxySpritesCount, sizeof(gProxySpritesCount));
Write(gProxySpritesList, sizeof(gProxySpritesList));
Write(&gSightSpritesCount, sizeof(gSightSpritesCount));
Write(gSightSpritesList, sizeof(gSightSpritesList));
Write(&gPhysSpritesCount, sizeof(gPhysSpritesCount));
Write(gPhysSpritesList, sizeof(gPhysSpritesList));
Write(&gImpactSpritesCount, sizeof(gImpactSpritesCount));
Write(gImpactSpritesList, sizeof(gImpactSpritesList));
Write(&gEventRedirectsUsed, sizeof(gEventRedirectsUsed));
static SPRITEMASS nul;
if (arc.isReading()) w = {};
if (arc.BeginObject(keyname))
{
arc ("seq", w.seqId, &nul.seqId)
("picnum", w.picnum, &nul.picnum)
("xrepeat", w.xrepeat, &nul.xrepeat)
("yrepeat", w.yrepeat, &nul.yrepeat)
("clipdist", w.clipdist)
("mass", w.mass)
("airvel", w.airVel)
("fraction", w.fraction)
.EndObject();
}
return arc;
}
void NNLoadSaveConstruct(void)
void SerializeNNExts(FSerializer& arc)
{
new NNLoadSave();
if (arc.BeginObject("nnexts"))
{
// the GenDudeArray only contains valid info for kDudeModernCustom and kDudeModernCustomBurning so only save the relevant entries as these are not small.
bool foundsome = false;
for (int i = 0; i < kMaxSprites; i++)
{
if (activeSprites[i] && (sprite[i].type == kDudeModernCustom || sprite[i].type == kDudeModernCustomBurning))
{
if (!foundsome) arc.BeginArray("gendudeextra");
foundsome = true;
arc(nullptr, gGenDudeExtra[i]);
}
}
if (foundsome) arc.EndArray();
arc.SparseArray("spritemass", gSpriteMass, kMaxSprites, activeXSprites)
("proxyspritescount", gProxySpritesCount)
.Array("proxyspriteslist", gProxySpritesList, gProxySpritesCount)
("sightspritescount", gSightSpritesCount)
.Array("sightspriteslist", gSightSpritesList, gSightSpritesCount)
("physspritescount", gPhysSpritesCount)
.Array("physspriteslist", gPhysSpritesList, gPhysSpritesCount)
("impactspritescount", gImpactSpritesCount)
.Array("impactspriteslist", gImpactSpritesList, gImpactSpritesCount)
("eventredirects", gEventRedirectsUsed)
.EndObject();
}
}
///////////////////////////////////////////////////////////////////

View file

@ -36,7 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gib.h"
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "player.h"
#include "seq.h"
#include "sound.h"

View file

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"
#include "view.h"

View file

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"
#include "view.h"

View file

@ -34,7 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "eventq.h"
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "sound.h"
#include "seq.h"
#include "gameutil.h"

View file

@ -41,7 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gib.h"
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "player.h"
#include "seq.h"
#include "qav.h"

View file

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "endgame.h"
#include "aistate.h"
#include "loadsave.h"
#include "sectorfx.h"
#include "choke.h"
#include "view.h"
@ -481,8 +480,8 @@ void UpdateBlend()
videoTintBlood(nRed, nGreen, nBlue);
}
char otherMirrorGotpic[2];
char bakMirrorGotpic[2];
uint8_t otherMirrorGotpic[2];
uint8_t bakMirrorGotpic[2];
// int gVisibility;
int deliriumTilt, deliriumTurn, deliriumPitch;
@ -988,7 +987,7 @@ void viewDrawScreen(bool sceneonly)
gChoke.animateChoke(160, zn, (int)gInterpolate);
}
#if 0
if (byte_1A76C6)
if (drawtile_2048)
{
DrawStatSprite(2048, xdim-15, 20);
}
@ -1065,36 +1064,17 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a)
return true;
}
class ViewLoadSave : public LoadSave {
public:
void Load(void);
void Save(void);
};
void ViewLoadSave::Load(void)
void SerializeView(FSerializer& arc)
{
Read(otherMirrorGotpic, sizeof(otherMirrorGotpic));
Read(bakMirrorGotpic, sizeof(bakMirrorGotpic));
Read(&gScreenTilt, sizeof(gScreenTilt));
Read(&deliriumTilt, sizeof(deliriumTilt));
Read(&deliriumTurn, sizeof(deliriumTurn));
Read(&deliriumPitch, sizeof(deliriumPitch));
if (arc.BeginObject("view"))
{
arc("screentilt", gScreenTilt)
("deliriumtilt", deliriumTilt)
("deliriumturn", deliriumTurn)
("deliriumpitch", deliriumPitch)
.EndObject();
}
}
void ViewLoadSave::Save(void)
{
Write(otherMirrorGotpic, sizeof(otherMirrorGotpic));
Write(bakMirrorGotpic, sizeof(bakMirrorGotpic));
Write(&gScreenTilt, sizeof(gScreenTilt));
Write(&deliriumTilt, sizeof(deliriumTilt));
Write(&deliriumTurn, sizeof(deliriumTurn));
Write(&deliriumPitch, sizeof(deliriumPitch));
}
void ViewLoadSaveConstruct(void)
{
new ViewLoadSave();
}
END_BLD_NS

View file

@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "db.h"
#include "gameutil.h"
#include "levels.h"
#include "loadsave.h"
#include "view.h"
#include "nnexts.h"
@ -333,33 +332,4 @@ void SerializeWarp(FSerializer& arc)
}
}
class WarpLoadSave : public LoadSave
{
public:
virtual void Load();
virtual void Save();
};
void WarpLoadSave::Load()
{
Read(gStartZone, sizeof(gStartZone));
Read(gUpperLink, sizeof(gUpperLink));
Read(gLowerLink, sizeof(gLowerLink));
}
void WarpLoadSave::Save()
{
Write(gStartZone, sizeof(gStartZone));
Write(gUpperLink, sizeof(gUpperLink));
Write(gLowerLink, sizeof(gLowerLink));
}
void WarpLoadSaveConstruct(void)
{
new WarpLoadSave();
}
END_BLD_NS

View file

@ -38,7 +38,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gameutil.h"
#include "globals.h"
#include "levels.h"
#include "loadsave.h"
#include "player.h"
#include "qav.h"
#include "seq.h"

View file

@ -307,7 +307,6 @@ typedef struct {
int16_t tileofs[MAXPSKYTILES]; // for 0 <= j < (1<<lognumtiles): tile offset relative to basetile
int32_t yscale;
int combinedtile;
} psky_t;
// Index of map-global (legacy) multi-sky:

View file

@ -243,12 +243,24 @@ void bfirst_search_try(T *const list, uint8_t *const bitmap, T *const eltnumptr,
/* End dependence on compat.o object. */
inline FSerializer& Serialize(FSerializer& arc, const char* key, vec3_t& c, vec3_t* def)
inline FSerializer& Serialize(FSerializer& arc, const char* key, vec2_t& c, vec2_t* def)
{
if (def && !memcmp(&c, def, sizeof(c))) return arc;
if (arc.BeginObject(key))
{
arc("x", c.x, def? &def->x : nullptr)
("y", c.y, def ? &def->y : nullptr)
.EndObject();
}
return arc;
}
inline FSerializer& Serialize(FSerializer& arc, const char* key, vec3_t& c, vec3_t* def)
{
if (def && !memcmp(&c, def, sizeof(c))) return arc;
if (arc.BeginObject(key))
{
arc("x", c.x, def ? &def->x : nullptr)
("y", c.y, def ? &def->y : nullptr)
("z", c.z, def ? &def->z : nullptr)
.EndObject();
@ -256,5 +268,4 @@ inline FSerializer& Serialize(FSerializer& arc, const char* key, vec3_t& c, vec3
return arc;
}
#endif // compat_h_

View file

@ -808,14 +808,12 @@ psky_t * tileSetupSky(int32_t const tilenum)
for (auto& sky : multipskies)
if (tilenum == sky.tilenum)
{
sky.combinedtile = -1; // invalidate the old content
return &sky;
}
multipskies.Reserve(1);
multipskies.Last() = {};
multipskies.Last().tilenum = tilenum;
multipskies.Last().combinedtile = -1;
multipskies.Last().yscale = 65536;
return &multipskies.Last();
}