- we do not need XSPRITE::reference anymore.

This commit is contained in:
Christoph Oelckers 2021-09-05 09:35:44 +02:00
parent 3d22bfa362
commit 766d87106a
4 changed files with 5 additions and 27 deletions

View file

@ -209,7 +209,7 @@ int DeleteSprite(int nSprite)
if (sprite[nSprite].extra > 0)
{
dbDeleteXSprite(sprite[nSprite].extra);
InsertFree(nextXSprite, sprite[nSprite].extra);
}
assert(sprite[nSprite].statnum >= 0 && sprite[nSprite].statnum < kMaxStatus);
RemoveSpriteStat(nSprite);
@ -289,20 +289,10 @@ unsigned short dbInsertXSprite(int nSprite)
}
memset(&xsprite[nXSprite], 0, sizeof(XSPRITE));
bloodActors[nSprite].hit = {};
xsprite[nXSprite].reference = nSprite;
sprite[nSprite].extra = nXSprite;
return nXSprite;
}
void dbDeleteXSprite(int nXSprite)
{
assert(xsprite[nXSprite].reference >= 0);
assert(sprite[xsprite[nXSprite].reference].extra == nXSprite);
InsertFree(nextXSprite, nXSprite);
sprite[xsprite[nXSprite].reference].extra = -1;
xsprite[nXSprite].reference = -1;
}
unsigned short dbInsertXWall(int nWall)
{
int nXWall = XWallsUsed++;
@ -332,10 +322,6 @@ unsigned short dbInsertXSector(int nSector)
void dbInit(void)
{
InitFreeList(nextXSprite, kMaxXSprites);
for (int i = 1; i < kMaxXSprites; i++)
{
xsprite[i].reference = -1;
}
XWallsUsed = XSectorsUsed = 1; // 0 is not usable because it's the default for 'extra' and some code actually uses it to clobber the contents in here. :(
for (int i = 1; i < kMaxXWalls; i++)
{
@ -900,7 +886,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, int
assert(nCount <= nXSpriteSize);
fr.Read(pBuffer, nCount);
BitReader bitReader(pBuffer, nCount);
pXSprite->reference = bitReader.readSigned(14);
/*pXSprite->reference =*/ bitReader.readSigned(14);
pXSprite->state = bitReader.readUnsigned(1);
pXSprite->busy = bitReader.readUnsigned(17);
pXSprite->txID = bitReader.readUnsigned(10);
@ -961,10 +947,9 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, int
pXSprite->stateTimer = bitReader.readUnsigned(16);
pXSprite->aiState = NULL;
bitReader.skipBits(32);
xsprite[sprite[i].extra].reference = i;
xsprite[sprite[i].extra].busy = IntToFixed(xsprite[sprite[i].extra].state);
pXSprite->busy = IntToFixed(pXSprite->state);
if (!encrypted) {
xsprite[sprite[i].extra].lT |= xsprite[sprite[i].extra].lB;
pXSprite->lT |= pXSprite->lB;
}
#ifdef NOONE_EXTENSIONS

View file

@ -45,10 +45,6 @@ enum
// by NoOne: functions to quckly check range of specifical arrays
inline bool xspriRangeIsFine(int nXindex) {
return (nXindex >= 0 && nXindex < kMaxXSprites);
}
inline bool xsectRangeIsFine(int nXindex) {
return (nXindex >= 0 && nXindex < kMaxXSectors);
}
@ -108,7 +104,6 @@ struct XSPRITE {
uint32_t health;
uint32_t busy;
int16_t reference;
int16_t data1; // Data 1
int16_t data2; // Data 2
int16_t data3; // Data 3
@ -362,7 +357,6 @@ 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);
unsigned short dbInsertXWall(int nWall);
unsigned short dbInsertXSector(int nSector);
void dbInit(void);

View file

@ -611,7 +611,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, XSPRITE& w, XSPRIT
arc("flags", w.flags, def->flags)
("aistate", w.aiState, def->aiState)
("busy", w.busy, def->busy)
("reference", w.reference, def->reference)
("txid", w.txID, def->txID)
("rxid", w.rxID, def->rxID)
("command", w.command, def->command)

View file

@ -3741,7 +3741,7 @@ void condError(DBloodActor* aCond, const char* pzFormat, ...)
break;
}
snprintf(buffer, 256, "\n\n%s CONDITION RX: %d, TX: %d, SPRITE: #%d RETURNS:\n", condType.GetChars(), pXCond->rxID, pXCond->txID, pXCond->reference);
snprintf(buffer, 256, "\n\n%s CONDITION RX: %d, TX: %d, SPRITE: #%d RETURNS:\n", condType.GetChars(), pXCond->rxID, pXCond->txID, aCond->GetIndex());
va_list args;
va_start(args, pzFormat);
vsnprintf(buffer2, 512, pzFormat, args);