- Gravity function.

This commit is contained in:
Christoph Oelckers 2021-10-21 00:00:26 +02:00
parent 5234481370
commit 9ef4f0fa99
3 changed files with 7 additions and 9 deletions

View file

@ -221,11 +221,7 @@ void MoveThings();
void ResetMoveFifo();
void InitChunks();
void InitPushBlocks();
void Gravity(short nSprite);
inline void Gravity(DExhumedActor* actor)
{
Gravity(actor->GetSpriteIndex());
}
void Gravity(DExhumedActor* actor);
short UpdateEnemy(short *nEnemy);
DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy)
{

View file

@ -612,9 +612,9 @@ int movesprite(short nSprite, int dx, int dy, int dz, int, int flordist, unsigne
return nRet;
}
void Gravity(short nSprite)
void Gravity(DExhumedActor* actor)
{
auto pSprite = &sprite[nSprite];
auto pSprite = &actor->s();
short nSector = pSprite->sectnum;
if (SectFlag[nSector] & kSectUnderwater)
@ -1503,9 +1503,10 @@ void AICreatureChunk::Tick(RunListEvent* ev)
{
int nSprite = RunData[ev->nRun].nObjIndex;
assert(nSprite >= 0 && nSprite < kMaxSprites);
auto pActor = &exhumedActors[nSprite];
auto pSprite = &sprite[nSprite];
Gravity(nSprite);
Gravity(pActor);
int nSector = pSprite->sectnum;
pSprite->pal = sector[nSector].ceilingpal;

View file

@ -2042,6 +2042,7 @@ void AIObject::Tick(RunListEvent* ev)
short nObject = RunData[ev->nRun].nObjIndex;
auto pObject = &ObjectList[nObject];
auto pActor = &exhumedActors[pObject->nSprite];// ev->pObjActor;
short nSprite = pObject->nSprite;
auto pSprite = &sprite[nSprite];
short nStat = pSprite->statnum;
@ -2052,7 +2053,7 @@ void AIObject::Tick(RunListEvent* ev)
}
if (nStat != kStatExplodeTarget) {
Gravity(nSprite);
Gravity(pActor);
}
// do animation