diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index 3a1101f6b..82f1c5247 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -166,7 +166,7 @@ void DoRegenerates(); // lavadude void BuildLava(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, DAngle nAngle, int nChannel); -DExhumedActor* BuildLavaLimb(DExhumedActor* nSprite, int edx, int ebx); +DExhumedActor* BuildLavaLimb(DExhumedActor* nSprite, int edx, double ebx); void FuncLavaLimb(int, int, int, int); void FuncLava(int, int, int, int); diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index 333e35ece..6dd2c0bc6 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -123,6 +123,7 @@ int RandomLong(); int RandomSize(int nSize); DAngle RandomAngle9(); DAngle RandomAngle(); +double RandomFloat(double range); // record diff --git a/source/games/exhumed/src/lavadude.cpp b/source/games/exhumed/src/lavadude.cpp index d50f60a80..7ef26677b 100644 --- a/source/games/exhumed/src/lavadude.cpp +++ b/source/games/exhumed/src/lavadude.cpp @@ -37,11 +37,11 @@ static actionSeq LavadudeSeq[] = { {42, 1} }; -DExhumedActor* BuildLavaLimb(DExhumedActor* pActor, int move, int ebx) +DExhumedActor* BuildLavaLimb(DExhumedActor* pActor, int move, double height) { auto pLimbActor = insertActor(pActor->sector(), 118); - pLimbActor->spr.pos = pActor->spr.pos.plusZ((-RandomLong() % ebx) * zmaptoworld); + pLimbActor->spr.pos = pActor->spr.pos.plusZ(-RandomFloat(height)); pLimbActor->spr.cstat = 0; pLimbActor->spr.shade = -127; pLimbActor->spr.pal = 1; @@ -205,7 +205,7 @@ void AILavaDude::Damage(RunListEvent* ev) } } - BuildLavaLimb(pActor, totalmoves, 64000); + BuildLavaLimb(pActor, totalmoves, 250); } } @@ -371,7 +371,7 @@ void AILavaDude::Tick(RunListEvent* ev) { if (nFlag & 0x40) { - auto pLimbSprite = BuildLavaLimb(pActor, pActor->nFrame, 64000); + auto pLimbSprite = BuildLavaLimb(pActor, pActor->nFrame, 250); D3PlayFX(StaticSound[kSound26], pLimbSprite); } @@ -382,7 +382,7 @@ void AILavaDude::Tick(RunListEvent* ev) int ecx = 0; do { - BuildLavaLimb(pActor, ecx, 64000); + BuildLavaLimb(pActor, ecx, 250); ecx++; } while (ecx < 20); runlist_ChangeChannel(pActor->nCount, 1); @@ -394,7 +394,7 @@ void AILavaDude::Tick(RunListEvent* ev) do { - BuildLavaLimb(pActor, ecx, 256); + BuildLavaLimb(pActor, ecx, 1); ecx++; } while (ecx < 30); diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index 9b91ad04a..5b7806c34 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -349,7 +349,7 @@ int DestroyTailPart() for (int i = 0; i < 5; i++) { - int nHeight = GetActorHeight(pActor); + double nHeight = GetActorHeightF(pActor); BuildLavaLimb(pActor, i, nHeight); } @@ -945,7 +945,7 @@ void AIQueenHead::Tick(RunListEvent* ev) if (QueenHead.nIndex2 < 10) { for (int i = (10 - QueenHead.nIndex2) * 2; i > 0; i--) { - BuildLavaLimb(pActor, i, GetActorHeight(pActor)); + BuildLavaLimb(pActor, i, GetActorHeightF(pActor)); } } } @@ -963,7 +963,7 @@ void AIQueenHead::Tick(RunListEvent* ev) for (i = 0; i < 20; i++) { - BuildLavaLimb(pActor, i, GetActorHeight(pActor)); + BuildLavaLimb(pActor, i, GetActorHeightF(pActor)); } runlist_SubRunRec(pActor->spr.intowner); diff --git a/source/games/exhumed/src/random.cpp b/source/games/exhumed/src/random.cpp index 4b6aea96d..394ea88a8 100644 --- a/source/games/exhumed/src/random.cpp +++ b/source/games/exhumed/src/random.cpp @@ -79,6 +79,11 @@ int RandomLong() return randLong; } +double RandomFloat(double range) +{ + return RandomWord() * range / 0xffff; +} + int RandomSize(int nSize) { int randSize = 0;