diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index 7630468f3..950ef17dd 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -223,7 +223,7 @@ void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActo if (nStat == kStatAnubisDrum) { - auto nAngle = (pActor->spr.angle + DAngle22_5) - DAngle::fromBuild(RandomSize(9)); + auto nAngle = (pActor->spr.angle + DAngle22_5) - RandomAngle9(); pHitActor->vel.XY() = nAngle.ToVector() * 2048; pHitActor->vel.Z = -(RandomSize(3) + 1); diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index 543523735..d46f6354c 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -121,6 +121,7 @@ uint8_t RandomByte(); uint16_t RandomWord(); int RandomLong(); int RandomSize(int nSize); +DAngle RandomAngle9(); // record diff --git a/source/games/exhumed/src/fish.cpp b/source/games/exhumed/src/fish.cpp index 809275580..a278bda10 100644 --- a/source/games/exhumed/src/fish.cpp +++ b/source/games/exhumed/src/fish.cpp @@ -184,7 +184,7 @@ void BuildFish(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, void IdleFish(DExhumedActor* pActor, int edx) { - pActor->add_int_ang((256 - RandomSize(9)) + 1024); + pActor->spr.angle += DAngle180 + DAngle45 - RandomAngle9(); pActor->norm_ang(); pActor->VelFromAngle(-8); @@ -192,7 +192,7 @@ void IdleFish(DExhumedActor* pActor, int edx) pActor->nAction = 0; pActor->nFrame = 0; - pActor->set_int_zvel(RandomSize(9)); + pActor->vel.Z = RandomSize(9) / 256.; if (!edx) { diff --git a/source/games/exhumed/src/lion.cpp b/source/games/exhumed/src/lion.cpp index 546cc91a5..2ef1e8829 100644 --- a/source/games/exhumed/src/lion.cpp +++ b/source/games/exhumed/src/lion.cpp @@ -462,7 +462,7 @@ void AILion::Tick(RunListEvent* ev) } else { - pActor->set_int_ang((RandomSize(9) + (pActor->int_ang() + 768)) & kAngleMask); + pActor->spr.angle += RandomAngle9() + DAngle45 + DAngle90; } pActor->set_int_zvel(-1000); diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 94521c679..3025ad4e2 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -1380,7 +1380,7 @@ DExhumedActor* BuildSpark(DExhumedActor* pActor, int nVal) } else { - auto nAngle = (pActor->spr.angle + DAngle22_5) - DAngle::fromBuild(RandomSize(9)); + auto nAngle = (pActor->spr.angle + DAngle22_5) - RandomAngle9(); if (nVal) { diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index 55a5cb777..ee99f825e 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -423,7 +423,6 @@ void BuildQueenEgg(int nQueen, int nVal) if (!pActor) return; auto pSector =pActor->sector(); - int nAngle = pActor->int_ang(); auto pActor2 = insertActor(pSector, 121); @@ -434,7 +433,7 @@ void BuildQueenEgg(int nQueen, int nVal) pActor2->spr.yoffset = 0; pActor2->spr.shade = -12; pActor2->spr.picnum = 1; - pActor2->set_int_ang((RandomSize(9) + (nAngle - 256)) & kAngleMask); + pActor2->spr.angle = pActor->spr.angle + RandomAngle9() - DAngle45; pActor2->backuppos(); if (!nVal) @@ -597,8 +596,7 @@ void AIQueenEgg::Tick(RunListEvent* ev) } [[fallthrough]]; case kHitWall: - pActor->set_int_ang((RandomSize(9) + 768)); - pActor->norm_ang(); + pActor->spr.angle = DAngle45 + DAngle90 + RandomAngle9(); pActor->VelFromAngle(-3); pActor->set_int_zvel(-RandomSize(5)); break; @@ -876,7 +874,7 @@ void AIQueenHead::Tick(RunListEvent* ev) runlist_DamageEnemy(pTarget, pActor, 10); D3PlayFX(StaticSound[kSoundQTail] | 0x2000, pActor); - pActor->add_int_ang(RandomSize(9) + 768); + pActor->spr.angle += DAngle45 + DAngle90 + RandomAngle9(); pActor->norm_ang(); pActor->set_int_zvel((-20) - RandomSize(6)); @@ -1266,7 +1264,7 @@ void AIQueen::Tick(RunListEvent* ev) } [[fallthrough]]; case 0x8000: - pActor->add_int_ang(256); + pActor->spr.angle += DAngle45; pActor->norm_ang(); SetQueenSpeed(pActor, si); diff --git a/source/games/exhumed/src/random.cpp b/source/games/exhumed/src/random.cpp index d0fbb3991..ad5262bf4 100644 --- a/source/games/exhumed/src/random.cpp +++ b/source/games/exhumed/src/random.cpp @@ -91,4 +91,9 @@ int RandomSize(int nSize) return randSize; } + +DAngle RandomAngle9() +{ + return DAngle::fromBuild(RandomSize(9)); +} END_PS_NS diff --git a/source/games/exhumed/src/scorp.cpp b/source/games/exhumed/src/scorp.cpp index 53a68c5d5..e51ab8e06 100644 --- a/source/games/exhumed/src/scorp.cpp +++ b/source/games/exhumed/src/scorp.cpp @@ -404,7 +404,7 @@ void AIScorp::Effect(RunListEvent* ev, DExhumedActor* pTarget, int mode) if (mode == 0) { PlotCourseToSprite(pActor, pTarget); - pActor->add_int_ang(RandomSize(7) - 63); + pActor->spr.angle += DAngle::fromBuild(RandomSize(7) - 63); pActor->norm_ang(); pActor->VelFromAngle(); diff --git a/source/games/exhumed/src/wasp.cpp b/source/games/exhumed/src/wasp.cpp index 9ca62d597..5f71537dd 100644 --- a/source/games/exhumed/src/wasp.cpp +++ b/source/games/exhumed/src/wasp.cpp @@ -155,7 +155,7 @@ void AIWasp::Damage(RunListEvent* ev) } pActor->nAction = 1; - pActor->add_int_ang(RandomSize(9) + 768); + pActor->spr.angle += DAngle45 + DAngle90 + RandomAngle9(); pActor->norm_ang(); pActor->nVel = 3000; @@ -304,9 +304,8 @@ void AIWasp::Tick(RunListEvent* ev) { if (bVal) { - pActor->add_int_ang(RandomSize(9) + 768); - pActor->norm_ang(); - pActor->set_int_zvel((-20) - RandomSize(6)); + pActor->spr.angle += DAngle45 + DAngle90 + RandomAngle9(); + pActor->vel.Z = ((-20) - RandomSize(6)) / 256.; pActor->nAction = 1; pActor->nVel = 3000;