Skip to content

Commit

Permalink
- Exhumed: Return early in movesprite() if the actor's sector is null.
Browse files Browse the repository at this point in the history
* This is what PowerSlaveGDX does.
* Fixes #1010.
  • Loading branch information
mjr4077au committed Nov 8, 2023
1 parent 6c70211 commit 3496d5c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions source/games/exhumed/src/move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,17 +421,21 @@ Collision movesprite(DExhumedActor* pActor, DVector2 vect, double dz, double flo
auto spos = pActor->spr.pos;
double nSpriteHeight = GetActorHeight(pActor);
auto pSector = pActor->sector();
assert(pSector);
Collision nRet{};

double floorZ = pSector->floorz;
if (!pSector)
{
assert(pSector);
return nRet;
}

if ((pSector->Flag & kSectUnderwater) || (floorZ < spos.Z))
if ((pSector->Flag & kSectUnderwater) || (pSector->floorz < spos.Z))
{
vect *= 0.5;
}

sectortype* overridesect;
Collision nRet = movespritez(pActor, dz, nSpriteHeight, pActor->clipdist, &overridesect);
nRet = movespritez(pActor, dz, nSpriteHeight, pActor->clipdist, &overridesect);

pSector = pActor->sector(); // modified in movespritez so re-grab this variable

Expand Down

0 comments on commit 3496d5c

Please sign in to comment.