- 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 ResetMoveFifo();
void InitChunks(); void InitChunks();
void InitPushBlocks(); void InitPushBlocks();
void Gravity(short nSprite); void Gravity(DExhumedActor* actor);
inline void Gravity(DExhumedActor* actor)
{
Gravity(actor->GetSpriteIndex());
}
short UpdateEnemy(short *nEnemy); short UpdateEnemy(short *nEnemy);
DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy) 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; return nRet;
} }
void Gravity(short nSprite) void Gravity(DExhumedActor* actor)
{ {
auto pSprite = &sprite[nSprite]; auto pSprite = &actor->s();
short nSector = pSprite->sectnum; short nSector = pSprite->sectnum;
if (SectFlag[nSector] & kSectUnderwater) if (SectFlag[nSector] & kSectUnderwater)
@ -1503,9 +1503,10 @@ void AICreatureChunk::Tick(RunListEvent* ev)
{ {
int nSprite = RunData[ev->nRun].nObjIndex; int nSprite = RunData[ev->nRun].nObjIndex;
assert(nSprite >= 0 && nSprite < kMaxSprites); assert(nSprite >= 0 && nSprite < kMaxSprites);
auto pActor = &exhumedActors[nSprite];
auto pSprite = &sprite[nSprite]; auto pSprite = &sprite[nSprite];
Gravity(nSprite); Gravity(pActor);
int nSector = pSprite->sectnum; int nSector = pSprite->sectnum;
pSprite->pal = sector[nSector].ceilingpal; pSprite->pal = sector[nSector].ceilingpal;

View file

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