- got rid of several inline wrappers.

This commit is contained in:
Christoph Oelckers 2021-10-21 21:10:17 +02:00
parent 2b8893762c
commit 2195bc0b76
3 changed files with 27 additions and 59 deletions

View file

@ -218,14 +218,7 @@ void ResetMoveFifo();
void InitChunks();
void InitPushBlocks();
void Gravity(DExhumedActor* actor);
short UpdateEnemy(short *nEnemy);
DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy)
{
short ndx = (short)(*ppEnemy? (*ppEnemy)->GetSpriteIndex() : -1);
int v = UpdateEnemy(&ndx);
return v == -1 ? nullptr : &exhumedActors[v];
}
DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy);
Collision MoveCreature(DExhumedActor* nSprite);
Collision MoveCreatureWithCaution(DExhumedActor* actor);
void WheresMyMouth(int nPlayer, int *x, int *y, int *z, short *sectnum);
@ -238,14 +231,7 @@ void CreatePushBlock(int nSector);
void FuncCreatureChunk(int a, int, int nRun);
DExhumedActor* FindPlayer(DExhumedActor* nSprite, int nDistance, bool dontengage = false);
int BuildCreatureChunk(int nVal, int nPic);
DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial = false)
{
int s = pSrc->GetSpriteIndex();
if (bSpecial) s |= 0x4000;
int c = BuildCreatureChunk(s, nPic);
return c < 0 ? nullptr : &exhumedActors[c];
}
DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial = false);
void BuildNear(int x, int y, int walldist, int nSector);
int PlotCourseToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2);
void CheckSectorFloor(short nSector, int z, int *x, int *y);
@ -254,11 +240,7 @@ int GetWallNormal(short nWall);
int GetUpAngle(DExhumedActor* nSprite1, int nVal, DExhumedActor* nSprite2, int ecx);
void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel);
Collision AngleChase(DExhumedActor* nSprite, DExhumedActor* nSprite2, int ebx, int ecx, int push1);
void SetQuake(short nSprite, int nVal);
void SetQuake(DExhumedActor* nSprite, int nVal)
{
SetQuake(nSprite->GetSpriteIndex(), nVal);
}
void SetQuake(DExhumedActor* nSprite, int nVal);
// mummy

View file

@ -1154,9 +1154,9 @@ void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel)
initsect = pSprite->sectnum;
}
void SetQuake(short nSprite, int nVal)
void SetQuake(DExhumedActor* pActor, int nVal)
{
auto pSprite = &sprite[nSprite];
auto pSprite = &pActor->s();
int x = pSprite->x;
int y = pSprite->y;
@ -1434,34 +1434,21 @@ DExhumedActor* GrabChunkSprite()
return pActor;
}
int BuildCreatureChunk(int nVal, int nPic)
DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial)
{
int var_14;
auto actor = GrabChunkSprite();
if (actor == nullptr) {
return -1;
return nullptr;
}
auto pSprite = &actor->s();
auto pSrcSpr = &pSrc->s();
if (nVal & 0x4000)
{
nVal &= 0x3FFF;
var_14 = 1;
}
else
{
var_14 = 0;
}
pSprite->x = pSrcSpr->x;
pSprite->y = pSrcSpr->y;
pSprite->z = pSrcSpr->z;
nVal &= 0xFFFF;
pSprite->x = sprite[nVal].x;
pSprite->y = sprite[nVal].y;
pSprite->z = sprite[nVal].z;
ChangeActorSect(actor, sprite[nVal].sectnum);
ChangeActorSect(actor, pSrcSpr->sectnum);
pSprite->cstat = 0x80;
pSprite->shade = -12;
@ -1471,7 +1458,7 @@ int BuildCreatureChunk(int nVal, int nPic)
pSprite->yvel = (RandomSize(5) - 16) << 7;
pSprite->zvel = (-(RandomSize(8) + 512)) << 3;
if (var_14)
if (bSpecial)
{
pSprite->xvel *= 4;
pSprite->yvel *= 4;
@ -1489,18 +1476,17 @@ int BuildCreatureChunk(int nVal, int nPic)
// GrabTimeSlot(3);
pSprite->extra = -1;
pSprite->owner = runlist_AddRunRec(pSprite->lotag - 1, actor->GetSpriteIndex(), 0xD0000);
pSprite->hitag = runlist_AddRunRec(NewRun, actor->GetSpriteIndex(), 0xD0000);
pSprite->owner = runlist_AddRunRec(pSprite->lotag - 1, actor, 0xD0000);
pSprite->hitag = runlist_AddRunRec(NewRun, actor, 0xD0000);
return actor->GetSpriteIndex();
return actor;
}
void AICreatureChunk::Tick(RunListEvent* ev)
{
int nSprite = RunData[ev->nRun].nObjIndex;
assert(nSprite >= 0 && nSprite < kMaxSprites);
auto pActor = &exhumedActors[nSprite];
auto pSprite = &sprite[nSprite];
auto pActor = ev->pObjActor;
if (!pActor) return;
auto pSprite = &pActor->s();
Gravity(pActor);
@ -1578,15 +1564,15 @@ void FuncCreatureChunk(int nObject, int nMessage, int nDamage, int nRun)
}
short UpdateEnemy(short *nEnemy)
DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy)
{
if (*nEnemy >= 0)
if (*ppEnemy)
{
if (!(sprite[*nEnemy].cstat & 0x101)) {
*nEnemy = -1;
if (!((*ppEnemy)->s().cstat & 0x101)) {
*ppEnemy = nullptr;
}
}
return *nEnemy;
return *ppEnemy;
}
END_PS_NS

View file

@ -644,9 +644,9 @@ void AIPlayer::Damage(RunListEvent* ev)
{
int nDamage = ev->nDamage;
short nPlayer = RunData[ev->nRun].nObjIndex;
auto pPlayerActor = PlayerList[nPlayer].Actor();
short nAction = PlayerList[nPlayer].nAction;
short nPlayerSprite = PlayerList[nPlayer].nSprite;
auto pPlayerSprite = &sprite[nPlayerSprite];
auto pPlayerSprite = &pPlayerActor->s();
auto pDopple = PlayerList[nPlayer].pDoppleSprite;
if (!nDamage) {
@ -733,7 +733,7 @@ void AIPlayer::Damage(RunListEvent* ev)
{
for (int i = 122; i <= 131; i++)
{
BuildCreatureChunk(nPlayerSprite, seq_GetSeqPicnum(kSeqJoe, i, 0));
BuildCreatureChunk(pPlayerActor, seq_GetSeqPicnum(kSeqJoe, i, 0));
}
StartDeathSeq(nPlayer, 1);