- make nBodygunSprite an actor array.

This commit is contained in:
Christoph Oelckers 2021-09-17 15:33:07 +02:00
parent fe9ddabd35
commit b1d15811c5
5 changed files with 22 additions and 21 deletions

View file

@ -242,7 +242,7 @@ int MoveCreatureWithCaution(int nSprite);
void WheresMyMouth(int nPlayer, int *x, int *y, int *z, short *sectnum);
int GetSpriteHeight(int nSprite);
DExhumedActor* GrabBody();
int GrabBodyGunSprite();
DExhumedActor* GrabBodyGunSprite();
void CreatePushBlock(int nSector);
void FuncCreatureChunk(int a, int, int nRun);
int FindPlayer(int nSprite, int nDistance);

View file

@ -62,7 +62,7 @@ extern short inita;
extern short initsect;
extern short nCurChunkNum;
extern short nBodyGunSprite[50];
extern DExhumedActor* nBodyGunSprite[50];
extern int movefifoend;
extern int movefifopos;
extern short nCurBodyGunNum;

View file

@ -45,7 +45,7 @@ short inita, initsect;
short nCurChunkNum = 0;
short nBodyGunSprite[50];
DExhumedActor* nBodyGunSprite[50];
int movefifoend;
int movefifopos;

View file

@ -1323,7 +1323,7 @@ void InitChunks()
{
nCurChunkNum = 0;
memset(nChunkSprite, 0, sizeof(nChunkSprite));
memset(nBodyGunSprite, -1, sizeof(nBodyGunSprite));
memset(nBodyGunSprite, 0, sizeof(nBodyGunSprite));
memset(nBodySprite, 0, sizeof(nBodySprite));
nCurBodyNum = 0;
nCurBodyGunNum = 0;
@ -1331,22 +1331,22 @@ void InitChunks()
nChunkTotal = 0;
}
int GrabBodyGunSprite()
DExhumedActor* GrabBodyGunSprite()
{
int nSprite = nBodyGunSprite[nCurBodyGunNum];
auto pSprite = &sprite[nSprite];
if (nSprite == -1)
auto pActor = nBodyGunSprite[nCurBodyGunNum];
spritetype* pSprite;
if (pActor == nullptr)
{
nSprite = insertsprite(0, 899);
pSprite = &sprite[nSprite];
nBodyGunSprite[nCurBodyGunNum] = nSprite;
pActor = insertActor(0, 899);
pSprite = &pActor->s();
nBodyGunSprite[nCurBodyGunNum] = pActor;
pSprite->lotag = -1;
pSprite->owner = -1;
}
else
{
auto pSprite = &pActor->s();
int nAnim = pSprite->owner;
if (nAnim != -1) {
@ -1364,7 +1364,7 @@ int GrabBodyGunSprite()
pSprite->cstat = 0;
return nSprite;
return pActor;
}
DExhumedActor* GrabBody()

View file

@ -505,18 +505,19 @@ void StartDeathSeq(int nPlayer, int nVal)
nSector = SectBelow[nSector];
}
int nGunSprite = GrabBodyGunSprite();
changespritesect(nGunSprite, nSector);
auto pGunActor = GrabBodyGunSprite();
ChangeActorSect(pGunActor, nSector);
auto pGunSprite = &pGunActor->s();
sprite[nGunSprite].x = pSprite->x;
sprite[nGunSprite].y = pSprite->y;
sprite[nGunSprite].z = sector[nSector].floorz - 512;
pGunSprite->x = pSprite->x;
pGunSprite->y = pSprite->y;
pGunSprite->z = sector[nSector].floorz - 512;
changespritestat(nGunSprite, nGunLotag[nWeapon] + 900);
ChangeActorStat(pGunActor, nGunLotag[nWeapon] + 900);
sprite[nGunSprite].picnum = nGunPicnum[nWeapon];
pGunSprite->picnum = nGunPicnum[nWeapon];
BuildItemAnim(nGunSprite);
BuildItemAnim(pGunActor->GetSpriteIndex());
}
}
}