- Blood: add x-access functions to spritetype and walltype.

This is merely a refactoring aid to get everything in a state that later allows merging these into one.
This commit is contained in:
Christoph Oelckers 2021-11-19 00:55:30 +01:00
parent 9ab35816ea
commit 19f3365efc
2 changed files with 26 additions and 8 deletions

View file

@ -50,6 +50,12 @@ enum
};
namespace Blood
{
struct XWALL;
struct XSECTOR;
}
//40 bytes
struct walltype;
struct sectortype
@ -89,6 +95,11 @@ struct sectortype
void addceilingxpan(float add) { ceilingxpan_ = fmodf(ceilingxpan_ + add + 512, 256); } // +512 is for handling negative offsets
void addceilingypan(float add) { ceilingypan_ = fmodf(ceilingypan_ + add + 512, 256); } // +512 is for handling negative offsets
walltype *firstWall() const;
// These will unfortunately have to be within the base struct to refactor Blood properly. They can later be removed again, once everything is done.
Blood::XSECTOR& xs() const;
bool hasX() const { return extra > 0; } // 0 is invalid!
};
//cstat:
@ -145,6 +156,10 @@ struct walltype
int deltay() const { return point2Wall()->y - y; }
bool twoSided() const { return nextsector >= 0; }
// These will unfortunately have to be within the base struct to refactor Blood properly. They can later be removed again, once everything is done.
Blood::XWALL& xw() const;
bool hasX() const { return extra > 0; } // 0 is invalid!
#if 0
// make sure we do not accidentally copy this
walltype() = default;

View file

@ -356,12 +356,15 @@ void PropagateMarkerReferences(void);
unsigned int dbReadMapCRC(const char *pPath);
void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, int *pSector, unsigned int *pCRC);
inline XSECTOR* getxsector(int index)
{
return index <= 0? nullptr : &xsector[sector[index].extra];
}
inline XWALL* getxwall(int index)
{
return index <= 0 ? nullptr : &xwall[sector[index].extra];
}
END_BLD_NS
// refactoring aids.
inline Blood::XWALL& walltype::xw() const
{
return Blood::xwall[extra];
}
inline Blood::XSECTOR& sectortype::xs() const
{
return Blood::xsector[extra];
}