mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- Blood: simplified management of XSectors and XWalls.
This does not need a free list - they get statically allocated per level, so a simple counter is enough.
This commit is contained in:
parent
2b1284e8fa
commit
53481fb9a3
3 changed files with 14 additions and 18 deletions
|
@ -50,6 +50,10 @@ SPRITEHIT gSpriteHit[kMaxXSprites];
|
|||
|
||||
int xvel[kMaxSprites], yvel[kMaxSprites], zvel[kMaxSprites];
|
||||
|
||||
unsigned short nextXSprite[kMaxXSprites];
|
||||
int XWallsUsed, XSectorsUsed;
|
||||
|
||||
|
||||
|
||||
char qsector_filler[kMaxSectors];
|
||||
|
||||
|
@ -257,10 +261,6 @@ int qchangespritestat(short nSprite, short nStatus)
|
|||
return ChangeSpriteStat(nSprite, nStatus);
|
||||
}
|
||||
|
||||
unsigned short nextXSprite[kMaxXSprites];
|
||||
unsigned short nextXWall[kMaxXWalls];
|
||||
unsigned short nextXSector[kMaxXSectors];
|
||||
|
||||
void InitFreeList(unsigned short *pList, int nCount)
|
||||
{
|
||||
for (int i = 1; i < nCount; i++)
|
||||
|
@ -302,9 +302,8 @@ void dbDeleteXSprite(int nXSprite)
|
|||
|
||||
unsigned short dbInsertXWall(int nWall)
|
||||
{
|
||||
int nXWall = nextXWall[0];
|
||||
nextXWall[0] = nextXWall[nXWall];
|
||||
if (nXWall == 0)
|
||||
int nXWall = XWallsUsed++;
|
||||
if (nXWall >= kMaxXWalls)
|
||||
{
|
||||
I_Error("Out of free XWalls");
|
||||
}
|
||||
|
@ -316,9 +315,8 @@ unsigned short dbInsertXWall(int nWall)
|
|||
|
||||
unsigned short dbInsertXSector(int nSector)
|
||||
{
|
||||
int nXSector = nextXSector[0];
|
||||
nextXSector[0] = nextXSector[nXSector];
|
||||
if (nXSector == 0)
|
||||
int nXSector = XSectorsUsed++;
|
||||
if (nXSector >= kMaxXSectors)
|
||||
{
|
||||
I_Error("Out of free XSectors");
|
||||
}
|
||||
|
@ -335,12 +333,11 @@ void dbInit(void)
|
|||
{
|
||||
xsprite[i].reference = -1;
|
||||
}
|
||||
InitFreeList(nextXWall, kMaxXWalls);
|
||||
XWallsUsed = XSectorsUsed = 0;
|
||||
for (int i = 1; i < kMaxXWalls; i++)
|
||||
{
|
||||
xwall[i].reference = -1;
|
||||
}
|
||||
InitFreeList(nextXSector, kMaxXSectors);
|
||||
for (int i = 1; i < kMaxXSectors; i++)
|
||||
{
|
||||
xsector[i].reference = -1;
|
||||
|
|
|
@ -306,8 +306,7 @@ extern const char *gAmmoText[];
|
|||
extern const char *gWeaponText[];
|
||||
|
||||
extern unsigned short nextXSprite[kMaxXSprites];
|
||||
extern unsigned short nextXWall[kMaxXWalls];
|
||||
extern unsigned short nextXSector[kMaxXSectors];
|
||||
extern int XWallsUsed, XSectorsUsed;
|
||||
|
||||
static inline int GetWallType(int nWall)
|
||||
{
|
||||
|
|
|
@ -602,8 +602,8 @@ void MyLoadSave::Load(void)
|
|||
Read(&byte_19AE44, sizeof(byte_19AE44));
|
||||
Read(gStatCount, sizeof(gStatCount));
|
||||
Read(nextXSprite, sizeof(nextXSprite));
|
||||
Read(nextXWall, sizeof(nextXWall));
|
||||
Read(nextXSector, sizeof(nextXSector));
|
||||
Read(&XWallsUsed, sizeof(XWallsUsed));
|
||||
Read(&XSectorsUsed, sizeof(XSectorsUsed));
|
||||
memset(xsprite, 0, sizeof(xsprite));
|
||||
for (int nSprite = 0; nSprite < kMaxSprites; nSprite++)
|
||||
{
|
||||
|
@ -687,8 +687,8 @@ void MyLoadSave::Save(void)
|
|||
Write(&byte_19AE44, sizeof(byte_19AE44));
|
||||
Write(gStatCount, sizeof(gStatCount));
|
||||
Write(nextXSprite, sizeof(nextXSprite));
|
||||
Write(nextXWall, sizeof(nextXWall));
|
||||
Write(nextXSector, sizeof(nextXSector));
|
||||
Write(&XWallsUsed, sizeof(XWallsUsed));
|
||||
Write(&XSectorsUsed, sizeof(XSectorsUsed));
|
||||
for (int nSprite = 0; nSprite < kMaxSprites; nSprite++)
|
||||
{
|
||||
if (sprite[nSprite].statnum < kMaxStatus)
|
||||
|
|
Loading…
Reference in a new issue