mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- use mapangle in more places, mainly constants and random values using special formula
This commit is contained in:
parent
0e1a566d62
commit
72dc3d5da9
29 changed files with 85 additions and 85 deletions
|
@ -747,7 +747,7 @@ void loadMapHack(const char* filename, const uint8_t*, SpawnSpriteDef& sprites);
|
|||
void validateStartSector(const char* filename, const DVector3& pos, int* cursectnum, unsigned numsectors, bool noabort = false);
|
||||
|
||||
// should only be used to read angles from map-loaded data (for proper documentation)
|
||||
inline DAngle mapangle(int mapang)
|
||||
constexpr DAngle mapangle(int mapang)
|
||||
{
|
||||
return DAngle::fromBuild(mapang);
|
||||
}
|
|
@ -1134,7 +1134,7 @@ void aiGenDudeMoveForward(DBloodActor* actor)
|
|||
}
|
||||
else
|
||||
{
|
||||
DAngle maxTurn = DAngle::fromBuild(pDudeInfo->angSpeed * 4 >> 4);
|
||||
DAngle maxTurn = mapangle(pDudeInfo->angSpeed * 4 >> 4);
|
||||
|
||||
DAngle dang = actor->xspr.goalAng - actor->spr.angle;
|
||||
actor->spr.angle += clamp(dang, -maxTurn, maxTurn);
|
||||
|
|
|
@ -146,7 +146,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
|
|||
if (!pNSprite)
|
||||
break;
|
||||
|
||||
auto ang = DAngle::fromBuild((PlayClock * 2048) / 120).Normalized360();
|
||||
auto ang = mapangle((PlayClock * 2048) / 120).Normalized360();
|
||||
auto nRand1 = random_angles[i][0];
|
||||
auto nRand2 = random_angles[i][1];
|
||||
auto nRand3 = random_angles[i][2];
|
||||
|
|
|
@ -8147,7 +8147,7 @@ void aiPatrolRandGoalAng(DBloodActor* actor)
|
|||
|
||||
void aiPatrolTurn(DBloodActor* actor)
|
||||
{
|
||||
DAngle nTurnRange = DAngle::fromBuild((getDudeInfo(actor->spr.type)->angSpeed << 1) >> 4);
|
||||
DAngle nTurnRange = mapangle((getDudeInfo(actor->spr.type)->angSpeed << 1) >> 4);
|
||||
DAngle nAng = deltaangle(actor->spr.angle, actor->xspr.goalAng);
|
||||
actor->spr.angle += clamp(nAng, -nTurnRange, nTurnRange);
|
||||
|
||||
|
|
|
@ -387,13 +387,13 @@ void viewUpdateDelirium(PLAYER* pPlayer)
|
|||
gScreenTilt = gScreenTilt.Normalized180();
|
||||
if (gScreenTilt > nullAngle)
|
||||
{
|
||||
gScreenTilt -= DAngle::fromBuild(8);
|
||||
gScreenTilt -= mapangle(8);
|
||||
if (gScreenTilt < nullAngle)
|
||||
gScreenTilt = nullAngle;
|
||||
}
|
||||
else if (gScreenTilt < nullAngle)
|
||||
{
|
||||
gScreenTilt += DAngle::fromBuild(8);
|
||||
gScreenTilt += mapangle(8);
|
||||
if (gScreenTilt >= nullAngle)
|
||||
gScreenTilt = nullAngle;
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ void viewUpdateShake(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& cH
|
|||
{
|
||||
int nValue = ClipHigh(effectType * 8, 2000);
|
||||
cH += buildhoriz(QRandom2(nValue >> 8));
|
||||
cA += DAngle::fromBuild(QRandom2(nValue >> 8));
|
||||
cA += mapangle(QRandom2(nValue >> 8));
|
||||
cPos.X += QRandom2F(nValue * inttoworld) * inttoworld;
|
||||
cPos.Y += QRandom2F(nValue * inttoworld) * inttoworld;
|
||||
cPos.Z += QRandom2F(nValue) * zinttoworld;
|
||||
|
|
|
@ -1959,7 +1959,7 @@ void camera(DDukeActor *actor)
|
|||
|
||||
if (actor->spr.hitag > 0)
|
||||
{
|
||||
auto const angle = DAngle::fromBuild(8);
|
||||
auto const angle = mapangle(8);
|
||||
|
||||
if (actor->temp_data[1] < actor->spr.hitag)
|
||||
actor->spr.angle += angle;
|
||||
|
|
|
@ -472,7 +472,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_ANG:
|
||||
if (bSet) ps[iPlayer].angle.settarget(DAngle::fromBuild(lValue));
|
||||
if (bSet) ps[iPlayer].angle.settarget(mapangle(lValue));
|
||||
else SetGameVarID(lVar2, ps[iPlayer].angle.ang.Buildang(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
|
@ -490,7 +490,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_LOOK_ANG:
|
||||
if (bSet) ps[iPlayer].angle.look_ang = DAngle::fromBuild(lValue);
|
||||
if (bSet) ps[iPlayer].angle.look_ang = mapangle(lValue);
|
||||
else SetGameVarID(lVar2, ps[iPlayer].angle.look_ang.Buildang(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
|
@ -650,7 +650,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_ONE_EIGHTY_COUNT:
|
||||
if (bSet) ps[iPlayer].angle.spin = DAngle::fromBuild(lValue);
|
||||
if (bSet) ps[iPlayer].angle.spin = mapangle(lValue);
|
||||
else SetGameVarID(lVar2, ps[iPlayer].angle.spin.Buildang(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
|
@ -710,7 +710,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_ROTSCRNANG:
|
||||
if (bSet) ps[iPlayer].angle.orotscrnang = ps[iPlayer].angle.rotscrnang = DAngle::fromBuild(lValue);
|
||||
if (bSet) ps[iPlayer].angle.orotscrnang = ps[iPlayer].angle.rotscrnang = mapangle(lValue);
|
||||
else SetGameVarID(lVar2, ps[iPlayer].angle.rotscrnang.Buildang(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
|
@ -3150,7 +3150,7 @@ int ParseState::parse(void)
|
|||
int i;
|
||||
insptr++;
|
||||
i = *(insptr++); // ID of def
|
||||
ps[g_p].angle.ang = DAngle::fromBuild(GetGameVarID(i, g_ac, g_p).safeValue() & 2047);
|
||||
ps[g_p].angle.ang = mapangle(GetGameVarID(i, g_ac, g_p).safeValue() & 2047);
|
||||
break;
|
||||
}
|
||||
case concmd_getactorangle:
|
||||
|
|
|
@ -174,7 +174,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, DVector3 spos, DAng
|
|||
zvel = ((ps[j].opos.Z - spos.Z) * vel) / l;
|
||||
|
||||
if (badguy(actor) && (actor->spr.hitag & face_player_smart) != 0)
|
||||
sang = actor->spr.angle + DAngle::fromBuild((krand() & 31) - 16);
|
||||
sang = actor->spr.angle + mapangle((krand() & 31) - 16);
|
||||
|
||||
if (actor->sector()->lotag == 2 && (krand() % 5) == 0)
|
||||
spawned = spawn(actor, WATERBUBBLE);
|
||||
|
@ -199,7 +199,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, DVector3 spos, DAng
|
|||
spawned->set_int_zvel(zvel * 256);
|
||||
}
|
||||
|
||||
spawned->spr.pos = spos + (sang + DAngle::fromBuild(112)).ToVector() * 7;
|
||||
spawned->spr.pos = spos + (sang + mapangle(112)).ToVector() * 7;
|
||||
spawned->spr.pos.Z--;
|
||||
spawned->setsector(actor->sector());
|
||||
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
||||
|
|
|
@ -3054,11 +3054,11 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
|
|||
}
|
||||
if (p->kickback_pic == 2)
|
||||
{
|
||||
p->angle.addadjustment(DAngle::fromBuild(16));
|
||||
p->angle.addadjustment(mapangle(16));
|
||||
}
|
||||
else if (p->kickback_pic == 4)
|
||||
{
|
||||
p->angle.addadjustment(DAngle::fromBuild(-16));
|
||||
p->angle.addadjustment(mapangle(-16));
|
||||
}
|
||||
if (p->kickback_pic > 4)
|
||||
p->kickback_pic = 1;
|
||||
|
@ -3084,11 +3084,11 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
|
|||
}
|
||||
if (p->kickback_pic == 2)
|
||||
{
|
||||
p->angle.addadjustment(DAngle::fromBuild(4));
|
||||
p->angle.addadjustment(mapangle(4));
|
||||
}
|
||||
else if (p->kickback_pic == 4)
|
||||
{
|
||||
p->angle.addadjustment(DAngle::fromBuild(-4));
|
||||
p->angle.addadjustment(mapangle(-4));
|
||||
}
|
||||
if (p->kickback_pic > 4)
|
||||
p->kickback_pic = 1;
|
||||
|
|
|
@ -436,7 +436,7 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell)
|
|||
if (actj->isPlayer())
|
||||
{
|
||||
snum = actj->PlayerIndex();
|
||||
ang = ps[snum].angle.ang - DAngle::fromBuild((krand() & 63) + 8); //Fine tune
|
||||
ang = ps[snum].angle.ang - mapangle((krand() & 63) + 8); //Fine tune
|
||||
|
||||
act->temp_data[0] = krand() & 1;
|
||||
act->spr.pos.Z = 3 + ps[snum].pos.Z + ps[snum].pyoff - (ps[snum].horizon.sum().asbuildf() * (1/16.)) + (!isshell ? 3 : 0);
|
||||
|
|
|
@ -286,7 +286,7 @@ void AILavaDude::Tick(RunListEvent* ev)
|
|||
ChangeActorSect(pActor, pSector);
|
||||
pActor->spr.pos = pos;
|
||||
|
||||
pActor->spr.angle += DAngle180 + DAngle::fromBuild(RandomWord() & 0x3FF);
|
||||
pActor->spr.angle += DAngle180 + mapangle(RandomWord() & 0x3FF);
|
||||
pActor->VelFromAngle();
|
||||
break;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ void AILavaDude::Tick(RunListEvent* ev)
|
|||
|
||||
if (coll.type == kHitWall)
|
||||
{
|
||||
pActor->spr.angle += DAngle180 + DAngle::fromBuild(RandomWord() & 0x3FF);
|
||||
pActor->spr.angle += DAngle180 + mapangle(RandomWord() & 0x3FF);
|
||||
pActor->VelFromAngle();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ void AILion::Damage(RunListEvent* ev)
|
|||
PlotCourseToSprite(pActor, pTarget);
|
||||
pActor->nAction = 5;
|
||||
pActor->nCount = RandomSize(3);
|
||||
pActor->spr.angle += DAngle::fromBuild((- (RandomSize(1) << 8)) + (RandomSize(1) << 8)); // NOTE: no angle mask in original code
|
||||
pActor->spr.angle += mapangle((- (RandomSize(1) << 8)) + (RandomSize(1) << 8)); // NOTE: no angle mask in original code
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -674,7 +674,7 @@ void CheckSectorFloor(sectortype* pSector, double z, DVector2& xy)
|
|||
return;
|
||||
}
|
||||
|
||||
DAngle nAng = DAngle::fromBuild(pSector->Flag & kAngleMask);
|
||||
DAngle nAng = mapangle(pSector->Flag & kAngleMask);
|
||||
|
||||
if (z >= pSector->floorz)
|
||||
{
|
||||
|
|
|
@ -275,7 +275,7 @@ void AIMummy::Tick(RunListEvent* ev)
|
|||
{
|
||||
case kHitWall:
|
||||
{
|
||||
pActor->spr.angle += DAngle180 + DAngle::fromBuild(RandomWord() & 0x3FF);
|
||||
pActor->spr.angle += DAngle180 + mapangle(RandomWord() & 0x3FF);
|
||||
pActor->VelFromAngle(-2);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1836,7 +1836,7 @@ void AIEnergyBlock::Damage(RunListEvent* ev)
|
|||
|
||||
auto pActor2 = insertActor(lasthitsect, 0);
|
||||
|
||||
pActor2->spr.angle = DAngle::fromBuild(ev->nParam);
|
||||
pActor2->spr.angle = mapangle(ev->nParam);
|
||||
pActor2->spr.pos = lasthit;
|
||||
|
||||
BuildSpark(pActor2, 0); // shoot out blue orb when damaged
|
||||
|
|
|
@ -123,11 +123,11 @@ int RandomSize(int nSize)
|
|||
|
||||
DAngle RandomAngle9()
|
||||
{
|
||||
return DAngle::fromBuild(RandomSize(9));
|
||||
return mapangle(RandomSize(9));
|
||||
}
|
||||
|
||||
DAngle RandomAngle()
|
||||
{
|
||||
return DAngle::fromBuild(RandomSize(11));
|
||||
return mapangle(RandomSize(11));
|
||||
}
|
||||
END_PS_NS
|
||||
|
|
|
@ -440,7 +440,7 @@ void AIScorp::Effect(RunListEvent* ev, DExhumedActor* pTarget, int mode)
|
|||
if (mode == 0)
|
||||
{
|
||||
PlotCourseToSprite(pActor, pTarget);
|
||||
pActor->spr.angle += DAngle::fromBuild(RandomSize(7) - 63);
|
||||
pActor->spr.angle += mapangle(RandomSize(7) - 63);
|
||||
pActor->norm_ang();
|
||||
|
||||
pActor->VelFromAngle();
|
||||
|
|
|
@ -348,7 +348,7 @@ void DrawView(double interpfrac, bool sceneonly)
|
|||
if (ang2.Degrees() < 0)
|
||||
ang2 = -ang2;
|
||||
|
||||
if (ang2 > DAngle::fromBuild(10))
|
||||
if (ang2 > mapangle(10))
|
||||
{
|
||||
inita -= ang2 * (1. / 8.);
|
||||
return;
|
||||
|
|
|
@ -1524,7 +1524,7 @@ DAngle FindNewAngle(DSWActor* actor, int dir, double DistToMove)
|
|||
|
||||
for (; *adp != -99; adp++)
|
||||
{
|
||||
new_ang = oang + DAngle::fromBuild(* adp);
|
||||
new_ang = oang + mapangle(* adp);
|
||||
|
||||
#if 1
|
||||
// look directly ahead for a ledge
|
||||
|
|
|
@ -751,7 +751,7 @@ int DoCoolgCircle(DSWActor* actor)
|
|||
{
|
||||
double bound;
|
||||
|
||||
actor->spr.angle += DAngle::fromBuild(actor->user.Counter2);
|
||||
actor->spr.angle += mapangle(actor->user.Counter2);
|
||||
|
||||
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
|
||||
{
|
||||
|
|
|
@ -703,7 +703,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
|
|||
{
|
||||
|
||||
tsp->picnum = DART_PIC;
|
||||
tsp->angle -= DAngle90 + DAngle::fromBuild(24);
|
||||
tsp->angle -= DAngle90 + mapangle(24);
|
||||
tsp->xrepeat = tsp->yrepeat = DART_REPEAT;
|
||||
tsp->cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL);
|
||||
}
|
||||
|
|
|
@ -466,7 +466,7 @@ int DoHornetCircle(DSWActor* actor)
|
|||
{
|
||||
double bound;
|
||||
|
||||
actor->spr.angle += DAngle::fromBuild(actor->user.Counter2);
|
||||
actor->spr.angle += mapangle(actor->user.Counter2);
|
||||
|
||||
if (!move_actor(actor, DVector3(actor->spr.angle.ToVector() * actor->vel.X, 0)))
|
||||
{
|
||||
|
|
|
@ -480,7 +480,7 @@ void JS_DrawCameras(PLAYER* pp, const DVector3& campos, double smoothratio)
|
|||
oscilation_delta -= oscilation_delta % 4;
|
||||
oscilationclock += oscilation_delta;
|
||||
oscilation_delta *= 2;
|
||||
DAngle oscillation_angle = DAngle::fromBuild(oscilation_delta);
|
||||
DAngle oscillation_angle = mapangle(oscilation_delta);
|
||||
for (cnt = MAXMIRRORS - 1; cnt >= 0; cnt--)
|
||||
{
|
||||
if (!mirror[cnt].ismagic) continue; // these are definitely not camera textures.
|
||||
|
@ -557,7 +557,7 @@ void JS_DrawCameras(PLAYER* pp, const DVector3& campos, double smoothratio)
|
|||
return;
|
||||
}
|
||||
|
||||
auto maxang = DAngle::fromBuild(SP_TAG6(camactor));
|
||||
auto maxang = mapangle(SP_TAG6(camactor));
|
||||
// BOOL2 = Oscilate camera
|
||||
if (TEST_BOOL2(camactor) && MoveSkip2 == 0)
|
||||
{
|
||||
|
|
|
@ -1789,7 +1789,7 @@ int InitBloodSpray(DSWActor* actor, bool dogib, short velocity)
|
|||
vel = 105+RandomRange(100);
|
||||
|
||||
if (dogib)
|
||||
ang = ang + DAngle90 + DAngle::fromBuild(RandomRange(200));
|
||||
ang = ang + DAngle90 + mapangle(RandomRange(200));
|
||||
else
|
||||
ang = ang + DAngle180 + DAngle45 - RandomAngle(45);
|
||||
|
||||
|
@ -2212,7 +2212,7 @@ int SpawnShell(DSWActor* actor, int ShellNum)
|
|||
HelpMissileLateral(actorNew,2500);
|
||||
actorNew->spr.angle -= DAngle90;
|
||||
HelpMissileLateral(actorNew,1000); // Was 1500
|
||||
actorNew->spr.angle += DAngle::fromBuild(712); // somewhat weird number...
|
||||
actorNew->spr.angle += mapangle(712); // somewhat weird number...
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3865,7 +3865,7 @@ bool PlayerOnLadder(PLAYER* pp)
|
|||
|
||||
static DAngle angles[] =
|
||||
{
|
||||
DAngle::fromBuild(30), -DAngle::fromBuild(30)
|
||||
mapangle(30), -mapangle(30)
|
||||
};
|
||||
|
||||
if (Prediction)
|
||||
|
@ -6974,7 +6974,7 @@ void PlayerGlobal(PLAYER* pp)
|
|||
|
||||
// camera stuff that can't be done in drawscreen
|
||||
if (pp->circle_camera_dist > CIRCLE_CAMERA_DIST_MINF)
|
||||
pp->circle_camera_ang += DAngle::fromBuild(14);
|
||||
pp->circle_camera_ang += mapangle(14);
|
||||
|
||||
if (pp->camera_check_time_delay > 0)
|
||||
{
|
||||
|
|
|
@ -223,7 +223,7 @@ void QuakeViewChange(PLAYER* pp, DVector3& tpos, DAngle& tang)
|
|||
tposdiff.Z = StdRandomRange(QUAKE_Zamt(actor)) - (QUAKE_Zamt(actor)/2);
|
||||
|
||||
int ang_amt = QUAKE_AngAmt(actor) * 4L;
|
||||
tangdiff = DAngle::fromBuild(StdRandomRange(ang_amt) - (ang_amt/2));
|
||||
tangdiff = mapangle(StdRandomRange(ang_amt) - (ang_amt/2));
|
||||
|
||||
int pos_amt = QUAKE_PosAmt(actor) * 4L;
|
||||
tposdiff.XY() = DVector2(StdRandomRange(pos_amt) - (pos_amt/2), StdRandomRange(pos_amt) - (pos_amt/2)) * (1. / 4.);
|
||||
|
|
|
@ -1953,7 +1953,7 @@ void SpriteSetup(void)
|
|||
actor->vel.X = 0;
|
||||
else
|
||||
actor->vel.X = actor->spr.lotag * maptoworld;
|
||||
actor->spr.angle = DAngle::fromBuild(SP_TAG6(actor));
|
||||
actor->spr.angle = mapangle(SP_TAG6(actor));
|
||||
// attach to the sector that contains the wall
|
||||
ChangeActorSect(actor, hit.hitSector);
|
||||
StartInterpolation(hit.hitWall, Interp_Wall_PanX);
|
||||
|
@ -4868,7 +4868,7 @@ int DoGrating(DSWActor* actor)
|
|||
|
||||
int DoKey(DSWActor* actor)
|
||||
{
|
||||
actor->spr.angle += DAngle::fromBuild(14 * ACTORMOVETICS);
|
||||
actor->spr.angle += mapangle(14 * ACTORMOVETICS);
|
||||
|
||||
DoGet(actor);
|
||||
return 0;
|
||||
|
|
|
@ -101,7 +101,7 @@ int DoWallMove(DSWActor* actor)
|
|||
int dang = ((int)SP_TAG10(actor)) << 3;
|
||||
|
||||
if (dang)
|
||||
ang += DAngle::fromBuild(RandomRange(dang) - dang/2);
|
||||
ang += mapangle(RandomRange(dang) - dang/2);
|
||||
|
||||
DVector2 nvec = dist * ang.ToVector();
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ ANIMATOR DoBettyBeginDeath;
|
|||
ANIMATOR DoSkullBeginDeath;
|
||||
ANIMATOR DoRipperGrow;
|
||||
|
||||
constexpr DAngle FacingAngle = DAngle::fromBuild(150);
|
||||
constexpr DAngle FacingAngle = mapangle(150);
|
||||
|
||||
//
|
||||
// Damage Amounts defined in damage.h
|
||||
|
@ -3673,7 +3673,7 @@ AutoShrap:
|
|||
|
||||
for (; p->id; p++)
|
||||
{
|
||||
auto ang_range = DAngle::fromBuild(p->ang_range);
|
||||
auto ang_range = mapangle(p->ang_range);
|
||||
if (!p->random_disperse)
|
||||
{
|
||||
//dang = (2048 / p->num);
|
||||
|
@ -3688,7 +3688,7 @@ AutoShrap:
|
|||
|
||||
if (p->random_disperse)
|
||||
{
|
||||
actor->spr.angle = shrap_angl + DAngle::fromBuild(RANDOM_P2(p->ang_range << 5) >> 5) - (ang_range * 0.5);
|
||||
actor->spr.angle = shrap_angl + mapangle(RANDOM_P2(p->ang_range << 5) >> 5) - (ang_range * 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3815,7 +3815,7 @@ int DoVomit(DSWActor* actor)
|
|||
{
|
||||
actor->user.Counter = NORM_ANGLE(actor->user.Counter + (30*MISSILEMOVETICS));
|
||||
// notreallypos
|
||||
auto v = actor->user.pos + DAngle::fromBuild(actor->user.Counter).ToVector() * 12;
|
||||
auto v = actor->user.pos + mapangle(actor->user.Counter).ToVector() * 12;
|
||||
actor->spr.xrepeat = int(v.X);
|
||||
actor->spr.yrepeat = int(v.Y);
|
||||
if (actor->user.Flags & (SPR_JUMPING))
|
||||
|
@ -4115,7 +4115,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, DAngle hit_angle, const DVe
|
|||
|
||||
for (; p->state; p++)
|
||||
{
|
||||
auto ang_range = DAngle::fromBuild(p->ang_range);
|
||||
auto ang_range = mapangle(p->ang_range);
|
||||
if (!p->random_disperse)
|
||||
{
|
||||
start_angle = hit_angle - (ang_range * 0.5) + DAngle180;
|
||||
|
@ -4150,7 +4150,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, DAngle hit_angle, const DVe
|
|||
|
||||
if (p->random_disperse)
|
||||
{
|
||||
actorNew->spr.angle = hit_angle + DAngle::fromBuild((RANDOM_P2(p->ang_range<<5)>>5) - (p->ang_range >> 1));
|
||||
actorNew->spr.angle = hit_angle + mapangle((RANDOM_P2(p->ang_range<<5)>>5) - (p->ang_range >> 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -11422,16 +11422,16 @@ int DoMirv(DSWActor* actor)
|
|||
if (!actor->user.Counter)
|
||||
{
|
||||
int i;
|
||||
static short angs[] =
|
||||
static const DAngle angs[] =
|
||||
{
|
||||
512,
|
||||
-512
|
||||
DAngle90,
|
||||
-DAngle90
|
||||
};
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
auto actorNew = SpawnActor(STAT_MISSILE, MIRV_METEOR, &sg_MirvMeteor[0][0], actor->sector(),
|
||||
actor->spr.pos, actor->spr.angle + DAngle::fromBuild(angs[i]), 50);
|
||||
actor->spr.pos, actor->spr.angle + angs[i], 50);
|
||||
|
||||
actorNew->user.RotNum = 5;
|
||||
NewStateGroup(actorNew, &sg_MirvMeteor[0]);
|
||||
|
@ -11606,7 +11606,7 @@ int DoRing(DSWActor* actor)
|
|||
}
|
||||
|
||||
// rotate the ring
|
||||
actor->spr.angle += DAngle::fromBuild(5 * RINGMOVETICS);
|
||||
actor->spr.angle += mapangle(5 * RINGMOVETICS);
|
||||
|
||||
// put it out there
|
||||
actor->spr.pos += actor->spr.angle.ToVector() * actor->user.Dist;
|
||||
|
@ -11744,9 +11744,9 @@ int DoSerpRing(DSWActor* actor)
|
|||
|
||||
// rotate the heads
|
||||
if (actor->user.Flags & (SPR_BOUNCE))
|
||||
actor->spr.angle += DAngle::fromBuild(28 * RINGMOVETICS);
|
||||
actor->spr.angle += mapangle(28 * RINGMOVETICS);
|
||||
else
|
||||
actor->spr.angle -= DAngle::fromBuild(28 * RINGMOVETICS);
|
||||
actor->spr.angle -= mapangle(28 * RINGMOVETICS);
|
||||
|
||||
// put it out there
|
||||
actor->spr.pos += actor->user.slide_ang.ToVector() * actor->user.Dist;
|
||||
|
@ -11893,7 +11893,7 @@ void InitVulcanBoulder(DSWActor* actor)
|
|||
if (SP_TAG7(actor))
|
||||
{
|
||||
delta = SP_TAG5(actor);
|
||||
nang = actor->spr.angle + DAngle::fromBuild((RandomRange(delta) - (delta >> 1)));
|
||||
nang = actor->spr.angle + mapangle((RandomRange(delta) - (delta >> 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -12312,7 +12312,7 @@ int InitSwordAttack(PLAYER* pp)
|
|||
|
||||
double dist = (pp->pos.XY() - itActor->spr.pos.XY()).Length();
|
||||
|
||||
face = DAngle::fromBuild(200);
|
||||
face = mapangle(200);
|
||||
|
||||
if (dist < CloseRangeDist(itActor, plActor, 62.5) && PlayerFacingRange(pp, itActor, face))
|
||||
{
|
||||
|
@ -12478,13 +12478,13 @@ int InitFistAttack(PLAYER* pp)
|
|||
bool iactive = pp->InventoryActive[2];
|
||||
if (iactive) // Shadow Bombs give you demon fist
|
||||
{
|
||||
face = DAngle::fromBuild(190);
|
||||
face = mapangle(190);
|
||||
reach = 143.75;
|
||||
}
|
||||
else
|
||||
{
|
||||
reach = 62.5;
|
||||
face = DAngle::fromBuild(200);
|
||||
face = mapangle(200);
|
||||
}
|
||||
|
||||
if (dist < CloseRangeDist(itActor, plActor, reach) && PlayerFacingRange(pp, itActor, face))
|
||||
|
@ -13046,7 +13046,7 @@ int InitStar(PLAYER* pp)
|
|||
{
|
||||
DSWActor* plActor = pp->actor;
|
||||
|
||||
static DAngle dang[] = { DAngle::fromBuild(-12), DAngle::fromBuild(12) };
|
||||
static DAngle dang[] = { mapangle(-12), mapangle(12) };
|
||||
const int STAR_REPEAT = 26;
|
||||
const int STAR_HORIZ_ADJ = 100;
|
||||
|
||||
|
@ -13325,12 +13325,12 @@ int InitShotgun(PLAYER* pp)
|
|||
if (pp->WpnShotgunType == 0)
|
||||
{
|
||||
ndaz = daz + RandomRangeF(120) - 45;
|
||||
ndaang = daang + DAngle::fromBuild(RandomRange(30) - 15);
|
||||
ndaang = daang + mapangle(RandomRange(30) - 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
ndaz = daz + RandomRangeF(200) - 65;
|
||||
ndaang = daang + DAngle::fromBuild(RandomRange(70) - 30);
|
||||
ndaang = daang + mapangle(RandomRange(70) - 30);
|
||||
}
|
||||
|
||||
DVector3 vect(ndaang.ToVector() * 1024, ndaz);
|
||||
|
@ -13529,7 +13529,7 @@ int InitLaser(PLAYER* pp)
|
|||
|
||||
if (WeaponAutoAim(pp->actor, actorNew, DAngle22_5 / 4, false) == -1)
|
||||
{
|
||||
actorNew->spr.angle -= DAngle::fromBuild(5);
|
||||
actorNew->spr.angle -= mapangle(5);
|
||||
}
|
||||
|
||||
UpdateChange(actorNew);
|
||||
|
@ -13610,7 +13610,7 @@ int InitRail(PLAYER* pp)
|
|||
actorNew->vel.Z = zvel * 0.5;
|
||||
if (WeaponAutoAim(pp->actor, actorNew, DAngle22_5 / 4, false) == -1)
|
||||
{
|
||||
actorNew->spr.angle -= DAngle::fromBuild(4);
|
||||
actorNew->spr.angle -= mapangle(4);
|
||||
}
|
||||
else
|
||||
zvel = actorNew->vel.Z; // Let autoaiming set zvel now
|
||||
|
@ -13684,7 +13684,7 @@ int InitZillaRail(DSWActor* actor)
|
|||
actorNew->vel.Z = zvel * 0.5;
|
||||
if (WeaponAutoAim(actor, actorNew, DAngle22_5 / 4, false) == -1)
|
||||
{
|
||||
actorNew->spr.angle -= DAngle::fromBuild(4);
|
||||
actorNew->spr.angle -= mapangle(4);
|
||||
}
|
||||
else
|
||||
zvel = actorNew->vel.Z; // Let autoaiming set zvel now
|
||||
|
@ -13795,7 +13795,7 @@ int InitRocket(PLAYER* pp)
|
|||
actorNew->vel.Z = zvel * 0.5;
|
||||
if (WeaponAutoAim(pp->actor, actorNew, DAngle22_5 / 4, false) == -1)
|
||||
{
|
||||
actorNew->spr.angle -= DAngle::fromBuild(5);
|
||||
actorNew->spr.angle -= mapangle(5);
|
||||
}
|
||||
else
|
||||
zvel = actorNew->vel.Z; // Let autoaiming set zvel now
|
||||
|
@ -13900,7 +13900,7 @@ int InitBunnyRocket(PLAYER* pp)
|
|||
actorNew->vel.Z = zvel * 0.5;
|
||||
if (WeaponAutoAim(pp->actor, actorNew, DAngle22_5 / 4, false) == -1)
|
||||
{
|
||||
actorNew->spr.angle -= DAngle::fromBuild(5);
|
||||
actorNew->spr.angle -= mapangle(5);
|
||||
}
|
||||
else
|
||||
zvel = actorNew->vel.Z; // Let autoaiming set zvel now
|
||||
|
@ -13994,7 +13994,7 @@ int InitNuke(PLAYER* pp)
|
|||
actorNew->vel.Z = zvel * 0.5;
|
||||
if (WeaponAutoAim(pp->actor, actorNew, DAngle22_5 / 4, false) == -1)
|
||||
{
|
||||
actorNew->spr.angle -= DAngle::fromBuild(5);
|
||||
actorNew->spr.angle -= mapangle(5);
|
||||
}
|
||||
else
|
||||
zvel = actorNew->vel.Z; // Let autoaiming set zvel now
|
||||
|
@ -14070,7 +14070,7 @@ int InitEnemyNuke(DSWActor* actor)
|
|||
actorNew->vel.Z = zvel * 0.5;
|
||||
if (WeaponAutoAim(actor, actorNew, DAngle22_5 / 4, false) == -1)
|
||||
{
|
||||
actorNew->spr.angle -= DAngle::fromBuild(5);
|
||||
actorNew->spr.angle -= mapangle(5);
|
||||
}
|
||||
else
|
||||
zvel = actorNew->vel.Z; // Let autoaiming set zvel now
|
||||
|
@ -14195,7 +14195,7 @@ int InitMicro(PLAYER* pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
actorNew->spr.angle += DAngle::fromBuild((RandomRange(MICRO_ANG) - (MICRO_ANG / 2)) - 16);
|
||||
actorNew->spr.angle += mapangle((RandomRange(MICRO_ANG) - (MICRO_ANG / 2)) - 16);
|
||||
}
|
||||
|
||||
UpdateChange(actorNew);
|
||||
|
@ -14534,7 +14534,7 @@ int InitSerpSpell(DSWActor* actor)
|
|||
|
||||
static const DAngle delta_ang[] =
|
||||
{
|
||||
DAngle::fromBuild(-10), DAngle::fromBuild(10)
|
||||
mapangle(-10), mapangle(10)
|
||||
};
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
|
@ -14636,7 +14636,7 @@ int InitSerpMonstSpell(DSWActor* actor)
|
|||
|
||||
static const DAngle delta_ang[] =
|
||||
{
|
||||
DAngle::fromBuild(-10), DAngle::fromBuild(10)
|
||||
mapangle(-10), mapangle(10)
|
||||
};
|
||||
|
||||
PlaySound(DIGI_MISSLFIRE, actor, v3df_none);
|
||||
|
@ -14796,7 +14796,7 @@ int InitEnemyRail(DSWActor* actor)
|
|||
|
||||
// add a bit of randomness
|
||||
if (RANDOM_P2(1024) < 512)
|
||||
actor->spr.angle += DAngle::fromBuild(RANDOM_P2(128) - 64);
|
||||
actor->spr.angle += mapangle(RANDOM_P2(128) - 64);
|
||||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
@ -15368,7 +15368,7 @@ int InitTracerUzi(PLAYER* pp)
|
|||
WeaponAutoAim(pp->actor, actorNew, DAngle22_5 / 4, false);
|
||||
|
||||
// a bit of randomness
|
||||
actorNew->spr.angle += DAngle::fromBuild(RandomRange(30) - 15);
|
||||
actorNew->spr.angle += mapangle(RandomRange(30) - 15);
|
||||
|
||||
UpdateChange(actorNew);
|
||||
|
||||
|
@ -15413,7 +15413,7 @@ int InitTracerTurret(DSWActor* actor, DSWActor* Operator, fixedhoriz horiz)
|
|||
WeaponAutoAim(actor, actorNew, DAngle22_5 / 4, false);
|
||||
|
||||
// a bit of randomness
|
||||
actorNew->spr.angle += DAngle::fromBuild(RandomRange(30) - 15);
|
||||
actorNew->spr.angle += mapangle(RandomRange(30) - 15);
|
||||
|
||||
UpdateChange(actorNew);
|
||||
|
||||
|
@ -15623,12 +15623,12 @@ int InitUzi(PLAYER* pp)
|
|||
DAngle daang = DAngle22_5 / 4;
|
||||
if (WeaponAutoAimHitscan(pp->actor, &daz, &daang, false) != nullptr)
|
||||
{
|
||||
daang += DAngle::fromBuild(RandomRange(24) - 12);
|
||||
daang += mapangle(RandomRange(24) - 12);
|
||||
daz += RandomRangeF(10000/256.) - 5000/256.;
|
||||
}
|
||||
else
|
||||
{
|
||||
daang = pp->angle.ang + DAngle::fromBuild(RandomRange(24) - 12);
|
||||
daang = pp->angle.ang + mapangle(RandomRange(24) - 12);
|
||||
daz = -pp->horizon.horiz.asbuildf() * (2000/256.) + (RandomRangeF(24000/256.) - 12000/256.);
|
||||
}
|
||||
|
||||
|
@ -15808,7 +15808,7 @@ int InitTankShell(DSWActor* actor, PLAYER* pp)
|
|||
|
||||
WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false);
|
||||
// a bit of randomness
|
||||
actorNew->spr.angle += DAngle::fromBuild(RandomRange(30) - 15);
|
||||
actorNew->spr.angle += mapangle(RandomRange(30) - 15);
|
||||
actorNew->norm_ang();
|
||||
|
||||
UpdateChange(actorNew);
|
||||
|
@ -15907,7 +15907,7 @@ int InitTurretMicro(DSWActor* actor, PLAYER* pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
actorNew->spr.angle += DAngle::fromBuild((RandomRange(MICRO_ANG) - (MICRO_ANG / 2)) - 16);
|
||||
actorNew->spr.angle += mapangle((RandomRange(MICRO_ANG) - (MICRO_ANG / 2)) - 16);
|
||||
}
|
||||
|
||||
UpdateChange(actorNew);
|
||||
|
@ -15987,7 +15987,7 @@ int InitTurretFireball(DSWActor* actor, PLAYER* pp)
|
|||
|
||||
WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false);
|
||||
// a bit of randomness
|
||||
actorNew->spr.angle += DAngle::fromBuild(RandomRange(30) - 15);
|
||||
actorNew->spr.angle += mapangle(RandomRange(30) - 15);
|
||||
actorNew->norm_ang();
|
||||
|
||||
UpdateChange(actorNew);
|
||||
|
@ -16491,7 +16491,7 @@ int InitTurretMgun(SECTOR_OBJECT* sop)
|
|||
// don't shoot if greater than 128
|
||||
return 0;
|
||||
}
|
||||
else if (delta > DAngle::fromBuild(24))
|
||||
else if (delta > mapangle(24))
|
||||
{
|
||||
// always shoot the ground when tracking
|
||||
// and not close
|
||||
|
@ -16641,7 +16641,7 @@ int InitEnemyUzi(DSWActor* actor)
|
|||
{
|
||||
// set angle to player and also face player when attacking
|
||||
actor->spr.angle = daang;
|
||||
daang += DAngle::fromBuild(RandomRange(24) - 12);
|
||||
daang += mapangle(RandomRange(24) - 12);
|
||||
daz += RandomRange(40 * 256) / 256. - 20;
|
||||
}
|
||||
else
|
||||
|
@ -17095,7 +17095,7 @@ int InitFireball(PLAYER* pp)
|
|||
actorNew->vel.Z = 0.5;
|
||||
if (WeaponAutoAimZvel(pp->actor, actorNew, &zvel, DAngle22_5 / 4, false) == -1)
|
||||
{
|
||||
actorNew->spr.angle -= DAngle::fromBuild(9);
|
||||
actorNew->spr.angle -= mapangle(9);
|
||||
}
|
||||
|
||||
UpdateChangeXY(actorNew);
|
||||
|
|
Loading…
Reference in a new issue