- got rid of fxSpawn.

This commit is contained in:
Christoph Oelckers 2021-09-01 21:56:39 +02:00
parent 085bd3a165
commit 1e1764eda6
2 changed files with 8 additions and 15 deletions

View file

@ -128,7 +128,7 @@ void CFX::remove(int nSprite)
actPostSprite(nSprite, kStatFree); actPostSprite(nSprite, kStatFree);
} }
spritetype * CFX::fxSpawn(FX_ID nFx, int nSector, int x, int y, int z, unsigned int a6) DBloodActor* CFX::fxSpawnActor(FX_ID nFx, int nSector, int x, int y, int z, unsigned int a6)
{ {
if (nSector < 0 || nSector >= numsectors) if (nSector < 0 || nSector >= numsectors)
return NULL; return NULL;
@ -157,13 +157,13 @@ spritetype * CFX::fxSpawn(FX_ID nFx, int nSector, int x, int y, int z, unsigned
FXDATA *pFX = &gFXData[nFx]; FXDATA *pFX = &gFXData[nFx];
if (gStatCount[1] == 512) if (gStatCount[1] == 512)
{ {
StatIterator it(kStatFX); BloodStatIterator it(kStatFX);
int nSprite = it.NextIndex(); auto iactor = it.Next();
while (nSprite != -1 && (sprite[nSprite].flags & 32)) while (iactor && (iactor->s().flags & 32))
nSprite = it.NextIndex(); iactor = it.Next();
if (nSprite == -1) if (!iactor)
return NULL; return NULL;
destroy(nSprite); destroy(iactor->s().index);
} }
auto actor = actSpawnSprite(nSector, x, y, z, 1, 0); auto actor = actSpawnSprite(nSector, x, y, z, 1, 0);
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
@ -190,7 +190,7 @@ spritetype * CFX::fxSpawn(FX_ID nFx, int nSector, int x, int y, int z, unsigned
a6 = pFX->ate; a6 = pFX->ate;
if (a6) if (a6)
evPost(actor, a6+Random2(a6>>1), kCallbackRemove); evPost(actor, a6+Random2(a6>>1), kCallbackRemove);
return pSprite; return actor;
} }
void CFX::fxProcess(void) void CFX::fxProcess(void)
@ -356,10 +356,4 @@ void fxPrecache()
} }
DBloodActor* CFX::fxSpawnActor(FX_ID nFx, int nSector, int x, int y, int z, unsigned int a6)
{
auto spr = fxSpawn(nFx, nSector, x, y, z, a6);
return spr ? &bloodActors[spr->index] : nullptr;
}
END_BLD_NS END_BLD_NS

View file

@ -93,7 +93,6 @@ class CFX {
public: public:
void destroy(int); void destroy(int);
void remove(int); void remove(int);
spritetype * fxSpawn(FX_ID, int, int, int, int, unsigned int);
DBloodActor* fxSpawnActor(FX_ID, int, int, int, int, unsigned int); DBloodActor* fxSpawnActor(FX_ID, int, int, int, int, unsigned int);
void fxProcess(void); void fxProcess(void);
}; };