- all of add_int_ang

This commit is contained in:
Christoph Oelckers 2022-09-09 19:28:20 +02:00
parent fdc6a49a97
commit c811a4a6dc
9 changed files with 19 additions and 16 deletions

View file

@ -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);

View file

@ -121,6 +121,7 @@ uint8_t RandomByte();
uint16_t RandomWord();
int RandomLong();
int RandomSize(int nSize);
DAngle RandomAngle9();
// record

View file

@ -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)
{

View file

@ -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);

View file

@ -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)
{

View file

@ -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);

View file

@ -91,4 +91,9 @@ int RandomSize(int nSize)
return randSize;
}
DAngle RandomAngle9()
{
return DAngle::fromBuild(RandomSize(9));
}
END_PS_NS

View file

@ -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();

View file

@ -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;