Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- mark all places using a sprite index that needs addressing with a G…
…etSpriteIndex function.
  • Loading branch information
coelckers committed Sep 6, 2021
1 parent 9010ea3 commit 8e9461d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion source/games/blood/src/_polymost.cpp
Expand Up @@ -49,7 +49,7 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation)
pTSprite->yoffset = pSprite->yoffset;
pTSprite->cstat = pSprite->cstat;
pTSprite->statnum = kStatDecoration;
pTSprite->owner = actor->GetIndex();
pTSprite->owner = actor->GetSpriteIndex();
pTSprite->flags = pSprite->hitag | 0x200;
pTSprite->x = dx + interpolatedvalue(pSprite->ox, pSprite->x, interpolation);
pTSprite->y = dy + interpolatedvalue(pSprite->oy, pSprite->y, interpolation);
Expand Down
2 changes: 1 addition & 1 deletion source/games/blood/src/animatesprite.cpp
Expand Up @@ -895,7 +895,7 @@ void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int
}
}

if (pTSprite->owner != gView->actor->GetIndex() || gViewPos != VIEWPOS_0) {
if (pTSprite->owner != gView->actor->GetSpriteIndex() || gViewPos != VIEWPOS_0) {
if (getflorzofslope(pTSprite->sectnum, pTSprite->x, pTSprite->y) >= cZ)
{
viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectShadow);
Expand Down
17 changes: 9 additions & 8 deletions source/games/blood/src/bloodactor.h
Expand Up @@ -130,11 +130,12 @@ class DBloodActor

spritetype& s() { return sprite[index]; }
XSPRITE& x() { return xsprite; } // calling this does not validate the xsprite!
int GetIndex() { return index; } // this is for error printing only!
int GetIndex() { return index; } // should only be for error reporting or for masking to a slot index
int GetSpriteIndex() { return index; } // this is only here to mark places that need changing later!

void SetOwner(DBloodActor* own)
{
s().owner = own ? own->GetIndex() : -1;
s().owner = own ? own->GetSpriteIndex() : -1;
}

DBloodActor* GetOwner()
Expand All @@ -145,7 +146,7 @@ class DBloodActor

void SetTarget(DBloodActor* own)
{
x().target_i = own ? own->GetIndex() : -1;
x().target_i = own ? own->GetSpriteIndex() : -1;
}

DBloodActor* GetTarget()
Expand All @@ -166,7 +167,7 @@ class DBloodActor

void SetBurnSource(DBloodActor* own)
{
x().burnSource = own ? own->GetIndex() : -1;
x().burnSource = own ? own->GetSpriteIndex() : -1;
}

DBloodActor* GetBurnSource()
Expand Down Expand Up @@ -322,7 +323,7 @@ class BloodLinearSpriteIterator

inline int DeleteSprite(DBloodActor* nSprite)
{
if (nSprite) return DeleteSprite(nSprite->GetIndex());
if (nSprite) return DeleteSprite(nSprite->GetSpriteIndex());
return 0;
}

Expand Down Expand Up @@ -364,12 +365,12 @@ inline void sfxKill3DSound(DBloodActor* pSprite, int a2 = -1, int a3 = -1)

inline void ChangeActorStat(DBloodActor* actor, int stat)
{
ChangeSpriteStat(actor->GetIndex(), stat);
ChangeSpriteStat(actor->GetSpriteIndex(), stat);
}

inline void ChangeActorSect(DBloodActor* actor, int stat)
{
ChangeSpriteSect(actor->GetIndex(), stat);
ChangeSpriteSect(actor->GetSpriteIndex(), stat);
}

inline int Collision::actorIndex(DBloodActor* actor)
Expand All @@ -384,7 +385,7 @@ inline DBloodActor* Collision::Actor(int a)

inline void setActorPos(DBloodActor* actor, vec3_t* pos)
{
setsprite(actor->GetIndex(), pos);
setsprite(actor->GetSpriteIndex(), pos);
}

END_BLD_NS
5 changes: 2 additions & 3 deletions source/games/blood/src/nnexts.cpp
Expand Up @@ -1390,7 +1390,7 @@ void nnExtProcessSuperSprites()
debrisactor->xvel += MulScale(nSpeed, Cos(pPlayer->pSprite->ang), 30);
debrisactor->yvel += MulScale(nSpeed, Sin(pPlayer->pSprite->ang), 30);

debrisactor->hit.hit = pPlayer->actor->GetIndex() | 0xc000;
debrisactor->hit.hit.setSprite(pPlayer->actor);
}
}
}
Expand Down Expand Up @@ -7572,7 +7572,6 @@ void nnExtAiSetDirection(DBloodActor* actor, int a3)
XSPRITE* pXSprite = &actor->x();
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);

int nSprite = actor->GetIndex();
int vc = ((a3 + 1024 - pSprite->ang) & 2047) - 1024;
int t1 = DMulScale(actor->xvel, Cos(pSprite->ang), actor->yvel, Sin(pSprite->ang), 30);
int vsi = ((t1 * 15) >> 12) / 2;
Expand Down Expand Up @@ -8356,7 +8355,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
sndy = emitter->y;

// sound attached to the sprite
if (pSpr != emitter && emitter->owner != actor->GetIndex())
if (pSpr != emitter && emitter->owner != actor->GetSpriteIndex())
{

if (!sectRangeIsFine(emitter->sectnum)) return false;
Expand Down
1 change: 0 additions & 1 deletion source/games/blood/src/triggers.cpp
Expand Up @@ -1459,7 +1459,6 @@ void OperateTeleport(unsigned int nSector, XSECTOR *pXSector)
ChangeActorSect(actor, pDest->sectnum);
sfxPlay3DSound(pDest, 201, -1, 0);
actor->xvel = actor->yvel = actor->zvel = 0;
int nSprite = actor->GetIndex();
actor->interpolated = false;
viewBackupSpriteLoc(actor);
if (pPlayer)
Expand Down

0 comments on commit 8e9461d

Please sign in to comment.