From 47e207f1584174eb6303c6b38e8c38e31e6ddd50 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 5 Sep 2021 11:45:36 +0200 Subject: [PATCH] - eliminated spritetype::index. # Conflicts: # source/games/sw/src/swactor.h --- source/build/include/buildtypes.h | 12 +++++------- source/games/blood/src/_polymost.cpp | 1 - source/games/blood/src/db.cpp | 7 ++----- source/games/blood/src/player.cpp | 2 +- source/games/blood/src/sfx.cpp | 2 +- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/source/build/include/buildtypes.h b/source/build/include/buildtypes.h index 8fe3830f9..cfa3368ad 100644 --- a/source/build/include/buildtypes.h +++ b/source/build/include/buildtypes.h @@ -266,13 +266,11 @@ struct spritetype int8_t xoffset, yoffset; int16_t sectnum, statnum; int16_t oang, ang, owner; - union { - int16_t xvel, index; - }; - int16_t yvel; - union { - int16_t zvel, inittype; - }; + int16_t xvel; + int16_t yvel; + union { + int16_t zvel, inittype; + }; union { int16_t lotag, type; }; diff --git a/source/games/blood/src/_polymost.cpp b/source/games/blood/src/_polymost.cpp index e01955e73..2dd996fe7 100644 --- a/source/games/blood/src/_polymost.cpp +++ b/source/games/blood/src/_polymost.cpp @@ -35,7 +35,6 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation) tspritetype* pTSprite = &pm_tsprite[pm_spritesortcnt++]; *pTSprite = {}; pTSprite->type = pSprite->type; - pTSprite->index = pSprite->index; pTSprite->sectnum = nSector2; pTSprite->x = pSprite->x + dx; pTSprite->y = pSprite->y + dy; diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index f3a11804a..e83b22710 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -165,7 +165,6 @@ void qinitspritelists(void) // Replace for (int i = 0; i < kMaxSprites; i++) { sprite[i].sectnum = -1; - sprite[i].index = -1; InsertSpriteStat(i, kMaxStatus); } memset(gStatCount, 0, sizeof(gStatCount)); @@ -192,7 +191,6 @@ DBloodActor* InsertSprite(int nSector, int nStat) pSprite->clipdist = 32; pSprite->xrepeat = pSprite->yrepeat = 64; actor->SetOwner(nullptr); - pSprite->index = nSprite; Numsprites++; @@ -806,7 +804,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, int pSprite->statnum = LittleShort(load.statnum); pSprite->ang = LittleShort(load.ang); pSprite->owner = LittleShort(load.owner); - pSprite->index = LittleShort(load.index); + pSprite->xvel = LittleShort(load.index); pSprite->yvel = LittleShort(load.yvel); pSprite->inittype = LittleShort(load.inittype); pSprite->type = LittleShort(load.type); @@ -827,7 +825,6 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, int InsertSpriteSect(i, pSprite->sectnum); InsertSpriteStat(i, pSprite->statnum); Numsprites++; - pSprite->index = i; if (pSprite->extra > 0) { char pBuffer[nXSpriteSize]; @@ -896,7 +893,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, int pXSprite->dudeAmbush = bitReader.readUnsigned(1); pXSprite->dudeGuard = bitReader.readUnsigned(1); pXSprite->dudeFlag4 = bitReader.readUnsigned(1); - pXSprite->target_i = bitReader.readSigned(16); + /*pXSprite->target_i = */ bitReader.readSigned(16); pXSprite->targetX = bitReader.readSigned(32); pXSprite->targetY = bitReader.readSigned(32); pXSprite->targetZ = bitReader.readSigned(32); diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 4325f34d4..c7563b4b7 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -671,7 +671,7 @@ void playerStart(int nPlayer, int bNewLevel) playerResetPosture(pPlayer); seqSpawn(pDudeInfo->seqStartID, actor, -1); if (pPlayer == gMe) - actor->s().cstat2 |= CSTAT2_SPRITE_MAPPED; + actor->s().cstat2 |= CSTAT2_SPRITE_MAPPED; int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); pSprite->z -= bottom - pSprite->z; diff --git a/source/games/blood/src/sfx.cpp b/source/games/blood/src/sfx.cpp index afbf3f3fb..bcdd35f59 100644 --- a/source/games/blood/src/sfx.cpp +++ b/source/games/blood/src/sfx.cpp @@ -90,7 +90,7 @@ void BloodSoundEngine::CalcPosVel(int type, const void* source, const float pt[3 { auto sprt = (spritetype*)source; assert(sprt != nullptr); - auto actor = &bloodActors[sprt->index]; + auto actor = &bloodActors[sprt - sprite]; // Engine expects velocity in units per second, not units per tic. if (vel) *vel = { actor->xvel * (30 / 65536.f), actor->zvel * (-30 / 65536.f), actor->yvel * (-30 / 65536.f) };