- moved gInterpolateSprite into DBloodActor

This commit is contained in:
Christoph Oelckers 2021-09-05 12:35:13 +02:00
parent bac40ddb05
commit c40266625b
12 changed files with 21 additions and 28 deletions

View file

@ -598,7 +598,7 @@ static void unicultThinkChase(DBloodActor* actor)
}
}
else if (dist > 4072 && dist <= 11072 && !spriteIsUnderwater(actor, false) && pSprite->owner != (kMaxSprites - 1))
else if (dist > 4072 && dist <= 11072 && !spriteIsUnderwater(actor, false) && !actor->GetSpecialOwner())
{
switch (curWeapon)
{
@ -2534,7 +2534,8 @@ bool genDudePrepare(DBloodActor* actor, int propId)
}
case kGenDudePropertyLeech:
pExtra->pLifeLeech = nullptr;
if (pSprite->owner != kMaxSprites - 1) {
if (!actor->GetSpecialOwner())
{
BloodStatIterator it(kStatThing);
while (auto actor2 = it.Next())
{

View file

@ -543,7 +543,7 @@ void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int
}
int nSprite = pTSprite->owner;
if (cl_interpolate && gInterpolateSprite[nSprite] && !(pTSprite->flags&512))
if (cl_interpolate && owneractor->interpolated && !(pTSprite->flags&512))
{
pTSprite->pos = pTSprite->interpolatedvec3(gInterpolate);
pTSprite->ang = pTSprite->interpolatedang(gInterpolate);

View file

@ -264,7 +264,9 @@ void GameInterface::Ticker()
if (newweap > 0 && newweap < WeaponSel_MaxBlood) gPlayer[i].newWeapon = newweap;
}
gInterpolateSprite.Zero();
BloodSpriteIterator it;
while (DBloodActor* act = it.Next()) act->interpolated = false;
ClearMovementInterpolations();
UpdateInterpolations();

View file

@ -102,8 +102,9 @@ public:
int cumulDamage; // this one's transient and does not need to be saved.
bool explosionhackflag; // this originally hijacked the target field which is not safe when working with pointers.
bool interpolated;
DBloodActor() :index(int(this - base())) { /*assert(index >= 0 && index < kMaxSprites);*/ }
DBloodActor() :index(int(this - base())) {}
DBloodActor& operator=(const DBloodActor& other) = default;
void Clear()
@ -115,6 +116,7 @@ public:
genDudeExtra = {};
prevmarker = nullptr;
basePoint = {};
interpolated = false;
xvel = yvel = zvel = 0;
explosionhackflag = false;
interpolated = false;

View file

@ -608,7 +608,7 @@ void sub_76A08(DBloodActor *actor, spritetype *pSprite2, PLAYER *pPlayer) // ???
ChangeActorSect(actor, pSprite2->sectnum);
sfxPlay3DSound(pSprite2, 201, -1, 0);
actor->xvel = actor->yvel = actor->zvel = 0;
viewBackupSpriteLoc(pSprite->index, pSprite);
viewBackupSpriteLoc(actor);
if (pPlayer)
{
playerResetInertia(pPlayer);

View file

@ -165,8 +165,7 @@ void qinitspritelists(void) // Replace
{
headspritestat[i] = -1;
}
int const nMaxSprites = kMaxSprites;
for (short i = 0; i < nMaxSprites; i++)
for (short i = 0; i < kMaxSprites; i++)
{
sprite[i].sectnum = -1;
sprite[i].index = -1;

View file

@ -58,10 +58,6 @@ enum {
// by NoOne: functions to quickly check range of specifical arrays
inline bool spriRangeIsFine(int nIndex) {
return (nIndex >= 0 && nIndex < kMaxSprites);
}
inline bool sectRangeIsFine(int nIndex) {
return (nIndex >= 0 && nIndex < kMaxSectors);
}

View file

@ -4484,7 +4484,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH)
{
auto act = objActor->genDudeExtra.pLifeLeech;
if (!act) return false;
if (pSpr->owner == kMaxSprites - 1) return true;
if (objActor->GetSpecialOwner()) return true;
else if (PUSH) condPush(aCond, OBJ_SPRITE, 0, act);
return false;
}

View file

@ -1459,7 +1459,7 @@ void OperateTeleport(unsigned int nSector, XSECTOR *pXSector)
sfxPlay3DSound(pDest, 201, -1, 0);
actor->xvel = actor->yvel = actor->zvel = 0;
int nSprite = actor->s().index;
gInterpolateSprite.Clear(nSprite);
actor->interpolated = false;
viewBackupSpriteLoc(actor);
if (pPlayer)
{

View file

@ -49,7 +49,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
EXTERN_CVAR(Bool, testnewrenderer)
BEGIN_BLD_NS
FixedBitArray<kMaxSprites> gInterpolateSprite;
VIEW gPrevView[kMaxPlayers];
VIEWPOS gViewPos;
int gViewIndex;

View file

@ -136,7 +136,6 @@ extern int gScreenTilt;
extern int deliriumTilt, deliriumTurn, deliriumPitch;
extern int gScreenTiltO, deliriumTurnO, deliriumPitchO;
extern int gShowFrameRate;
extern FixedBitArray<kMaxSprites> gInterpolateSprite;
extern int gLastPal;
extern double gInterpolate;
@ -173,18 +172,13 @@ inline void viewInterpolateWall(int nWall, walltype *pWall)
StartInterpolation(nWall, Interp_Wall_Y);
}
inline void viewBackupSpriteLoc(int nSprite, spritetype *pSprite)
{
if (!gInterpolateSprite[nSprite])
{
pSprite->backuploc();
gInterpolateSprite.Set(nSprite);
}
}
inline void viewBackupSpriteLoc(DBloodActor* actor)
{
viewBackupSpriteLoc(actor->s().index, &actor->s());
if (!actor->interpolated)
{
actor->s().backuploc();
actor->interpolated = true;
}
}

View file

@ -198,7 +198,7 @@ int CheckLink(DBloodActor *actor)
else
z2 = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
pSprite->z += z2-z;
gInterpolateSprite.Clear(pSprite->index);
actor->interpolated = false;
return pUpper->type;
}
}
@ -225,7 +225,7 @@ int CheckLink(DBloodActor *actor)
else
z2 = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
pSprite->z += z2-z;
gInterpolateSprite.Clear(pSprite->index);
actor->interpolated = false;
return pLower->type;
}
}