mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- moved sprite[], spriteext[] and spritesmooth[] into DCoreActor.
Also removed the last remaining sprite pointer in saveable data.
This commit is contained in:
parent
4cecb6f955
commit
d3b1e34d78
10 changed files with 40 additions and 36 deletions
|
@ -143,12 +143,8 @@ struct usermaphack_t
|
|||
uint8_t md4[16]{};
|
||||
};
|
||||
|
||||
extern spriteext_t spriteext[MAXSPRITES];
|
||||
extern spritesmooth_t spritesmooth[MAXSPRITES + MAXUNIQHUDID];
|
||||
|
||||
extern TArray<sectortype> sector;
|
||||
extern TArray<walltype> wall;
|
||||
extern spritetype sprite[MAXSPRITES];
|
||||
EXTERN int leveltimer;
|
||||
|
||||
extern TArray<sectortype> sectorbackup;
|
||||
|
@ -328,7 +324,7 @@ struct SpawnSpriteDef
|
|||
void insertAllSprites(SpawnSpriteDef& sprites);
|
||||
|
||||
void allocateMapArrays(int numsprites);
|
||||
void ValidateSprite(spritetype& spr);
|
||||
void ValidateSprite(spritetype& spr, int index);
|
||||
void engineLoadBoard(const char *filename, int flags, vec3_t *dapos, int16_t *daang, int *dacursectnum, SpawnSpriteDef& sprites);
|
||||
void loadMapBackup(const char* filename);
|
||||
void G_LoadMapHack(const char* filename, const unsigned char*, SpawnSpriteDef& sprites);
|
||||
|
|
|
@ -41,12 +41,8 @@
|
|||
#include "gl_renderer.h"
|
||||
#endif
|
||||
|
||||
spriteext_t spriteext[MAXSPRITES];
|
||||
spritesmooth_t spritesmooth[MAXSPRITES + MAXUNIQHUDID];
|
||||
|
||||
TArray<sectortype> sector;
|
||||
TArray<walltype> wall;
|
||||
spritetype sprite[MAXSPRITES];
|
||||
|
||||
int32_t r_rortexture = 0;
|
||||
int32_t r_rortexturerange = 0;
|
||||
|
|
|
@ -17,6 +17,11 @@ public:
|
|||
DCoreActor* prevStat, * nextStat;
|
||||
DCoreActor* prevSect, * nextSect;
|
||||
|
||||
spritetype spr;
|
||||
spriteext_t sprext;
|
||||
spritesmooth_t spsmooth;
|
||||
|
||||
|
||||
virtual ~DCoreActor() = default;
|
||||
virtual void Serialize(FSerializer& arc);
|
||||
|
||||
|
@ -25,19 +30,34 @@ public:
|
|||
return (unsigned)s().statnum < MAXSTATUS;
|
||||
}
|
||||
|
||||
spritetype& s() const
|
||||
const spritetype& s() const
|
||||
{
|
||||
return sprite[index];
|
||||
return spr;
|
||||
}
|
||||
|
||||
spriteext_t& sx() const
|
||||
spritetype& s()
|
||||
{
|
||||
return spriteext[index];
|
||||
return spr;
|
||||
}
|
||||
|
||||
spritesmooth_t& sm() const
|
||||
const spriteext_t& sx() const
|
||||
{
|
||||
return spritesmooth[index];
|
||||
return sprext;
|
||||
}
|
||||
|
||||
spriteext_t& sx()
|
||||
{
|
||||
return sprext;
|
||||
}
|
||||
|
||||
const spritesmooth_t& sm() const
|
||||
{
|
||||
return spsmooth;
|
||||
}
|
||||
|
||||
spritesmooth_t& sm()
|
||||
{
|
||||
return spsmooth;
|
||||
}
|
||||
|
||||
int GetIndex() const
|
||||
|
|
|
@ -237,9 +237,8 @@ static void SetWallPalV5()
|
|||
}
|
||||
}
|
||||
|
||||
void ValidateSprite(spritetype& spr)
|
||||
void ValidateSprite(spritetype& spr, int index)
|
||||
{
|
||||
int index = int(&spr - sprite);
|
||||
bool bugged = false;
|
||||
if ((unsigned)spr.statnum >= MAXSTATUS)
|
||||
{
|
||||
|
@ -297,7 +296,6 @@ static void ReadSpriteV7(FileReader& fr, spritetype& spr)
|
|||
spr.hitag = fr.ReadInt16();
|
||||
spr.extra = fr.ReadInt16();
|
||||
spr.detail = 0;
|
||||
ValidateSprite(spr);
|
||||
}
|
||||
|
||||
static void ReadSpriteV6(FileReader& fr, spritetype& spr)
|
||||
|
@ -326,7 +324,6 @@ static void ReadSpriteV6(FileReader& fr, spritetype& spr)
|
|||
spr.extra = fr.ReadInt16();
|
||||
spr.blend = 0;
|
||||
spr.detail = 0;
|
||||
ValidateSprite(spr);
|
||||
}
|
||||
|
||||
static void ReadSpriteV5(FileReader& fr, spritetype& spr)
|
||||
|
@ -361,7 +358,6 @@ static void ReadSpriteV5(FileReader& fr, spritetype& spr)
|
|||
spr.xoffset = 0;
|
||||
spr.yoffset = 0;
|
||||
spr.detail = 0;
|
||||
ValidateSprite(spr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -431,8 +427,6 @@ void allocateMapArrays(int numsprites)
|
|||
memset(sector.Data(), 0, sizeof(sectortype) * numsectors);
|
||||
wall.Resize(numwalls);
|
||||
memset(wall.Data(), 0, sizeof(walltype) * numwalls);
|
||||
memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES);
|
||||
memset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES + MAXUNIQHUDID));
|
||||
|
||||
ClearAutomap();
|
||||
}
|
||||
|
@ -508,6 +502,8 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang,
|
|||
case 6: ReadSpriteV6(fr, sprites.sprites[i]); break;
|
||||
default: ReadSpriteV7(fr, sprites.sprites[i]); break;
|
||||
}
|
||||
ValidateSprite(sprites.sprites[i], i);
|
||||
|
||||
}
|
||||
|
||||
artSetupMapArt(filename);
|
||||
|
|
|
@ -655,6 +655,10 @@ FSerializer &Serialize(FSerializer &arc, const char *key, walltype &c, walltype
|
|||
void DCoreActor::Serialize(FSerializer& arc)
|
||||
{
|
||||
// nothing here yet.
|
||||
arc("sprite", spr)
|
||||
("spriteext", sprext);
|
||||
|
||||
if (arc.isReading()) spsmooth = {};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,14 +22,6 @@ void M_Autosave();
|
|||
#define SAVEGAME_EXT ".dsave"
|
||||
|
||||
|
||||
template<> inline FSerializer& Serialize(FSerializer& arc, const char* keyname, spritetype*& w, spritetype** def)
|
||||
{
|
||||
int ndx = w ? int(w - sprite) : -1;
|
||||
arc(keyname, ndx);
|
||||
w = ndx == -1 ? nullptr : sprite + ndx;
|
||||
return arc;
|
||||
}
|
||||
|
||||
template<> inline FSerializer& Serialize(FSerializer& arc, const char* keyname, sectortype*& w, sectortype** def)
|
||||
{
|
||||
int ndx = w ? sectnum(w) : -1;
|
||||
|
|
|
@ -555,7 +555,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect
|
|||
pSprite->shade = load.shade;
|
||||
pSprite->blend = 0;
|
||||
pSprite->time = i;
|
||||
ValidateSprite(*pSprite);
|
||||
ValidateSprite(*pSprite, i);
|
||||
|
||||
if (pSprite->extra > 0)
|
||||
{
|
||||
|
|
|
@ -1171,14 +1171,14 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, sectortype** tsect, binan
|
|||
|
||||
if (!player_in_camera && pp->camera_check_time_delay > 0)
|
||||
{
|
||||
if (pp->last_camera_sp != sp)
|
||||
if (pp->last_camera_act != actor)
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (sp->clipdist)
|
||||
{
|
||||
case 1:
|
||||
pp->last_camera_sp = sp;
|
||||
pp->last_camera_act = actor;
|
||||
CircleCamera(tx, ty, tz, tsect, tang, 0);
|
||||
found_camera = true;
|
||||
break;
|
||||
|
@ -1187,7 +1187,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, sectortype** tsect, binan
|
|||
{
|
||||
int xvect,yvect,zvect,zdiff;
|
||||
|
||||
pp->last_camera_sp = sp;
|
||||
pp->last_camera_act = actor;
|
||||
|
||||
xvect = ang.bcos(-3);
|
||||
yvect = ang.bsin(-3);
|
||||
|
|
|
@ -771,7 +771,7 @@ struct PLAYERstruct
|
|||
int ceiling_dist,floor_dist;
|
||||
SECTORp hi_sectp, lo_sectp;
|
||||
|
||||
SPRITEp last_camera_sp;
|
||||
DSWActor* last_camera_act;
|
||||
int circle_camera_dist;
|
||||
int six,siy,siz; // save player interp position for PlayerSprite
|
||||
int16_t siang;
|
||||
|
|
|
@ -459,7 +459,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYERstruct& w, P
|
|||
("lo_sectp", w.lo_sectp)
|
||||
("hi_sp", w.highActor)
|
||||
("lo_sp", w.lowActor)
|
||||
("last_camera_sp", w.last_camera_sp)
|
||||
("last_camera_sp", w.last_camera_act)
|
||||
("circle_camera_dist", w.circle_camera_dist)
|
||||
("six", w.six)
|
||||
("siy", w.siy)
|
||||
|
|
Loading…
Reference in a new issue