- Rename PlayerHorizon::horiz in prep for negating this angle throughout code.

This commit is contained in:
Mitchell Richters 2022-09-30 18:45:40 +10:00 committed by Christoph Oelckers
parent 4becce9bf4
commit 619b8005ac
16 changed files with 84 additions and 84 deletions

View file

@ -180,7 +180,7 @@ void PlayerHorizon::applyinput(float const horz, ESyncBits* actions, double cons
if (horz)
{
*actions &= ~SB_CENTERVIEW;
horiz += DAngle::fromDeg(horz);
__horiz += DAngle::fromDeg(horz);
}
// Process keyboard input.
@ -189,7 +189,7 @@ void PlayerHorizon::applyinput(float const horz, ESyncBits* actions, double cons
if (*actions & (up | down))
{
if (lock) *actions &= ~SB_CENTERVIEW; else *actions |= SB_CENTERVIEW;
horiz += getTicrateScale(rate) * scaleAdjust * (!!(*actions & up) - !!(*actions & down));
__horiz += getTicrateScale(rate) * scaleAdjust * (!!(*actions & up) - !!(*actions & down));
}
};
doKbdInput(SB_AIM_UP, SB_AIM_DOWN, PITCH_AIMSPEED, true);
@ -198,12 +198,12 @@ void PlayerHorizon::applyinput(float const horz, ESyncBits* actions, double cons
// Do return to centre.
if ((*actions & SB_CENTERVIEW) && !(*actions & (SB_LOOK_UP|SB_LOOK_DOWN)))
{
scaletozero(horiz, PITCH_CENTERSPEED * (PITCH_CNTRSINEOFFSET - abs(horiz)).Sin(), scaleAdjust);
if (!horiz.Sgn()) *actions &= ~SB_CENTERVIEW;
scaletozero(__horiz, PITCH_CENTERSPEED * (PITCH_CNTRSINEOFFSET - abs(__horiz)).Sin(), scaleAdjust);
if (!__horiz.Sgn()) *actions &= ~SB_CENTERVIEW;
}
// clamp before we finish, even if it's clamped in the drawer.
horiz = ClampViewPitch(horiz);
__horiz = ClampViewPitch(__horiz);
}
else
{
@ -361,14 +361,14 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w,
{
if (arc.BeginObject(keyname))
{
arc("horiz", w.horiz)
arc("horiz", w.__horiz)
("horizoff", w.horizoff)
("inputdisabled", w.inputdisabled)
.EndObject();
if (arc.isReading())
{
w.ohoriz = w.horiz;
w.ohoriz = w.__horiz;
w.ohorizoff = w.horizoff;
w.inputdisabled = w.inputdisabled;
w.resetadjustment();

View file

@ -8,7 +8,7 @@
struct PlayerHorizon
{
DAngle horiz, ohoriz, horizoff, ohorizoff;
DAngle __horiz, ohoriz, horizoff, ohorizoff;
friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, PlayerHorizon* def);
@ -19,18 +19,18 @@ struct PlayerHorizon
// Interpolation helpers.
void backup()
{
ohoriz = horiz;
ohoriz = __horiz;
ohorizoff = horizoff;
}
void restore()
{
horiz = ohoriz;
__horiz = ohoriz;
horizoff = ohorizoff;
}
// Commonly used getters.
DAngle osum() { return ohoriz + ohorizoff; }
DAngle sum() { return horiz + horizoff; }
DAngle sum() { return __horiz + horizoff; }
DAngle interpolatedsum(double const interpfrac) { return interpolatedvalue(osum(), sum(), interpfrac); }
// Ticrate playsim adjustment helpers.
@ -51,7 +51,7 @@ struct PlayerHorizon
}
else
{
horiz += value;
__horiz += value;
}
}
@ -66,8 +66,8 @@ struct PlayerHorizon
}
else
{
horiz = value;
if (backup) ohoriz = horiz;
__horiz = value;
if (backup) ohoriz = __horiz;
}
}
@ -75,21 +75,21 @@ struct PlayerHorizon
{
if (targetset())
{
auto delta = deltaangle(horiz, target);
auto delta = deltaangle(__horiz, target);
if (abs(delta).Degrees() > 0.45)
{
horiz += delta * scaleAdjust;
__horiz += delta * scaleAdjust;
}
else
{
horiz = target;
__horiz = target;
target = nullAngle;
}
}
else if (adjustment.Sgn())
{
horiz += adjustment * scaleAdjust;
__horiz += adjustment * scaleAdjust;
}
}

View file

@ -819,7 +819,7 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->actor->xspr.health = pDudeInfo->startHealth << 4;
pPlayer->actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
pPlayer->bloodlust = 0;
pPlayer->horizon.horiz = pPlayer->horizon.horizoff = nullAngle;
pPlayer->horizon.__horiz = pPlayer->horizon.horizoff = nullAngle;
pPlayer->slope = 0;
pPlayer->fragger = nullptr;
pPlayer->underwaterTime = 1200;
@ -1556,7 +1556,7 @@ void ProcessInput(PLAYER* pPlayer)
}
pPlayer->deathTime += 4;
if (!bSeqStat)
pPlayer->horizon.addadjustment(deltaangle(pPlayer->horizon.horiz, gi->playerPitchMax() * (1. - BobVal(ClipHigh(pPlayer->deathTime << 3, 1024) + 512))));
pPlayer->horizon.addadjustment(deltaangle(pPlayer->horizon.__horiz, gi->playerPitchMax() * (1. - BobVal(ClipHigh(pPlayer->deathTime << 3, 1024) + 512))));
if (pPlayer->curWeapon)
pInput->setNewWeapon(pPlayer->curWeapon);
if (pInput->actions & SB_OPEN)
@ -1731,7 +1731,7 @@ void ProcessInput(PLAYER* pPlayer)
pPlayer->angle.unlockinput();
pPlayer->horizon.unlockinput();
pPlayer->slope = -pPlayer->horizon.horiz.Tan();
pPlayer->slope = -pPlayer->horizon.__horiz.Tan();
if (pInput->actions & SB_INVPREV)
{
pInput->actions &= ~SB_INVPREV;

View file

@ -2170,7 +2170,7 @@ static void greenslime(DDukeActor *actor)
return;
}
actor->spr.pos.Z = ps[p].pos.Z + 8 + ps[p].pyoff - (actor->temp_data[2] - (ps[p].horizon.horiz.Tan() * 2048.)) * zinttoworld;
actor->spr.pos.Z = ps[p].pos.Z + 8 + ps[p].pyoff - (actor->temp_data[2] - (ps[p].horizon.__horiz.Tan() * 2048.)) * zinttoworld;
if (actor->temp_data[2] > 512)
actor->temp_data[2] -= 128;

View file

@ -346,7 +346,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
}
ps[iPlayer].horizon.settarget(maphoriz(lValue));
}
else SetGameVarID(lVar2, int(ps[iPlayer].horizon.horiz.Tan() * 128.), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].horizon.__horiz.Tan() * 128.), sActor, sPlayer);
break;
case PLAYER_OHORIZ:
@ -925,7 +925,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
case PLAYER_RETURN_TO_CENTER:
if (bSet) ps[iPlayer].sync.actions |= SB_CENTERVIEW;
else SetGameVarID(lVar2, ps[iPlayer].sync.actions & SB_CENTERVIEW ? int(abs((ps[iPlayer].horizon.horiz * (DAngle::fromDeg(9.) / GetMaxPitch())).Degrees())) : 0, sActor, sPlayer);
else SetGameVarID(lVar2, ps[iPlayer].sync.actions & SB_CENTERVIEW ? int(abs((ps[iPlayer].horizon.__horiz * (DAngle::fromDeg(9.) / GetMaxPitch())).Degrees())) : 0, sActor, sPlayer);
break;
default:
@ -2243,7 +2243,7 @@ int ParseState::parse(void)
ps[g_p].last_extra = g_ac->spr.extra = gs.max_player_health;
ps[g_p].wantweaponfire = -1;
ps[g_p].horizon.ohoriz = ps[g_p].horizon.horiz = nullAngle;
ps[g_p].horizon.ohoriz = ps[g_p].horizon.__horiz = nullAngle;
ps[g_p].on_crane = nullptr;
ps[g_p].frag_ps = g_p;
ps[g_p].horizon.ohorizoff = ps[g_p].horizon.horizoff = nullAngle;

View file

@ -792,7 +792,7 @@ static void FinalizeInput(player_struct *p, InputPacket& input)
loc.avel = input.avel = 0;
}
if (p->newOwner != nullptr || (p->sync.actions & SB_CENTERVIEW && abs(p->horizon.horiz.Degrees()) > 2.2370))
if (p->newOwner != nullptr || (p->sync.actions & SB_CENTERVIEW && abs(p->horizon.__horiz.Degrees()) > 2.2370))
{
loc.horz = input.horz = 0;
}

View file

@ -619,7 +619,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
backupplayer(p);
p->horizon.horizoff = p->horizon.horiz = nullAngle;
p->horizon.horizoff = p->horizon.__horiz = nullAngle;
updatesector(p->pos, &p->cursector);

View file

@ -1515,7 +1515,7 @@ void checkweapons_r(player_struct* p)
}
p->OnMotorcycle = 0;
p->gotweapon[MOTORCYCLE_WEAPON] = false;
p->horizon.horiz = nullAngle;
p->horizon.__horiz = nullAngle;
p->moto_do_bump = 0;
p->MotoSpeed = 0;
p->TiltStatus = 0;
@ -1534,7 +1534,7 @@ void checkweapons_r(player_struct* p)
}
p->OnBoat = 0;
p->gotweapon[BOAT_WEAPON] = false;
p->horizon.horiz = nullAngle;
p->horizon.__horiz = nullAngle;
p->moto_do_bump = 0;
p->MotoSpeed = 0;
p->TiltStatus = 0;
@ -1761,7 +1761,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
}
if (horiz != FRACUNIT)
{
p->horizon.addadjustment(deltaangle(p->horizon.horiz, maphoriz(horiz)));
p->horizon.addadjustment(deltaangle(p->horizon.__horiz, maphoriz(horiz)));
}
const DAngle adjust = mapangle(-510);
@ -2029,7 +2029,7 @@ static void onBoat(int snum, ESyncBits &actions)
}
if (horiz != FRACUNIT)
{
p->horizon.addadjustment(deltaangle(p->horizon.horiz, maphoriz(horiz)));
p->horizon.addadjustment(deltaangle(p->horizon.__horiz, maphoriz(horiz)));
}
if (p->MotoSpeed > 0 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight))

View file

@ -54,7 +54,7 @@ void resetmys()
mypos = omypos = ps[myconnectindex].pos;
myxvel = myyvel = myzvel = 0;
myang = ps[myconnectindex].angle.ang;
myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz;
myhoriz = omyhoriz = ps[myconnectindex].horizon.__horiz;
myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff;
mycursectnum = sectnum(ps[myconnectindex].cursector);
myjumpingcounter = ps[myconnectindex].jumping_counter;

View file

@ -151,7 +151,7 @@ void resetplayerstats(int snum)
p->footprintpal = 0;
p->footprintshade = 0;
p->jumping_toggle = 0;
p->horizon.ohoriz = p->horizon.horiz = DAngle::fromDeg(17.354);
p->horizon.ohoriz = p->horizon.__horiz = DAngle::fromDeg(17.354);
p->horizon.ohorizoff = p->horizon.horizoff = nullAngle;
p->bobcounter = 0;
p->on_ground = 0;

View file

@ -747,7 +747,7 @@ loc_flag:
// loc_27266:
case kWeaponSword:
{
nHeight -= PlayerList[nLocalPlayer].horizon.horiz.Tan() * 32.;
nHeight -= PlayerList[nLocalPlayer].horizon.__horiz.Tan() * 32.;
thePos.Z += nHeight;
@ -852,7 +852,7 @@ loc_flag:
}
case kWeaponPistol:
{
double h = PlayerList[nLocalPlayer].horizon.horiz.Tan() * 2.;
double h = PlayerList[nLocalPlayer].horizon.__horiz.Tan() * 2.;
nHeight -= h;
DExhumedActor* target = nullptr;
@ -876,7 +876,7 @@ loc_flag:
case kWeaponGrenade:
{
ThrowGrenade(nPlayer, nHeight - 10, PlayerList[nLocalPlayer].horizon.horiz.Tan());
ThrowGrenade(nPlayer, nHeight - 10, PlayerList[nLocalPlayer].horizon.__horiz.Tan());
break;
}
case kWeaponStaff:

View file

@ -410,7 +410,7 @@ void RestartPlayer(int nPlayer)
plr->nThrust.Zero();
plr->nDestVertPan = plr->horizon.ohoriz = plr->horizon.horiz = nullAngle;
plr->nDestVertPan = plr->horizon.ohoriz = plr->horizon.__horiz = nullAngle;
plr->nBreathTimer = 90;
plr->nTauntTimer = RandomSize(3) + 3;
@ -506,7 +506,7 @@ void StartDeathSeq(int nPlayer, int nVal)
StopFiringWeapon(nPlayer);
PlayerList[nPlayer].horizon.ohoriz = PlayerList[nPlayer].horizon.horiz = nullAngle;
PlayerList[nPlayer].horizon.ohoriz = PlayerList[nPlayer].horizon.__horiz = nullAngle;
PlayerList[nPlayer].oeyelevel = PlayerList[nPlayer].eyelevel = -55;
PlayerList[nPlayer].nInvisible = 0;
dVertPan[nPlayer] = 15;
@ -1118,7 +1118,7 @@ void AIPlayer::Tick(RunListEvent* ev)
zVelB = -zVelB;
}
if (zVelB > 2 && !PlayerList[nPlayer].horizon.horiz.Sgn() && cl_slopetilting) {
if (zVelB > 2 && !PlayerList[nPlayer].horizon.__horiz.Sgn() && cl_slopetilting) {
PlayerList[nPlayer].nDestVertPan = nullAngle;
}
}
@ -2484,12 +2484,12 @@ sectdone:
if (actions & (SB_AIM_UP | SB_AIM_DOWN) || sPlayerInput[nPlayer].pan)
{
pPlayer->nDestVertPan = pPlayer->horizon.horiz;
pPlayer->nDestVertPan = pPlayer->horizon.__horiz;
pPlayer->bPlayerPan = pPlayer->bLockPan = true;
}
else if (actions & (SB_LOOK_UP | SB_LOOK_DOWN | SB_CENTERVIEW))
{
pPlayer->nDestVertPan = pPlayer->horizon.horiz;
pPlayer->nDestVertPan = pPlayer->horizon.__horiz;
pPlayer->bPlayerPan = pPlayer->bLockPan = false;
}
@ -2500,7 +2500,7 @@ sectdone:
if (cl_slopetilting && !pPlayer->bPlayerPan && !pPlayer->bLockPan)
{
if (double nVertPan = deltaangle(pPlayer->horizon.horiz, pPlayer->nDestVertPan).Tan() * 32.)
if (double nVertPan = deltaangle(pPlayer->horizon.__horiz, pPlayer->nDestVertPan).Tan() * 32.)
{
pPlayer->horizon.addadjustment(maphoriz(abs(nVertPan) >= 4 ? clamp(nVertPan, -4., 4.) : nVertPan * 2.));
}
@ -2620,7 +2620,7 @@ sectdone:
}
else
{
if (PlayerList[nPlayer].horizon.horiz.Sgn() < 0)
if (PlayerList[nPlayer].horizon.__horiz.Sgn() < 0)
{
PlayerList[nPlayer].horizon.settarget(nullAngle);
PlayerList[nPlayer].eyelevel -= dVertPan[nPlayer];
@ -2629,11 +2629,11 @@ sectdone:
{
PlayerList[nPlayer].horizon.addadjustment(maphoriz(dVertPan[nPlayer]));
if (PlayerList[nPlayer].horizon.horiz.Degrees() >= 38)
if (PlayerList[nPlayer].horizon.__horiz.Degrees() >= 38)
{
PlayerList[nPlayer].horizon.settarget(DAngle::fromDeg(37.72));
}
else if (PlayerList[nPlayer].horizon.horiz.Sgn() <= 0)
else if (PlayerList[nPlayer].horizon.__horiz.Sgn() <= 0)
{
if (!(pPlayerActor->sector()->Flag & kSectUnderwater))
{

View file

@ -612,7 +612,7 @@ void JS_DrawCameras(PLAYER* pp, const DVector3& campos, double smoothratio)
if (TEST_BOOL11(camactor) && numplayers > 1)
{
drawroomstotile(cp->pos, cp->angle.ang, cp->horizon.horiz, cp->cursector, mirror[cnt].campic, smoothratio);
drawroomstotile(cp->pos, cp->angle.ang, cp->horizon.__horiz, cp->cursector, mirror[cnt].campic, smoothratio);
}
else
{

View file

@ -1289,7 +1289,7 @@ int PlayerInitChemBomb(PLAYER* pp)
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew))
actorNew->user.Flags |= (SPR_UNDERWATER);
actorNew->vel.Z -= pp->horizon.horiz.Tan() * HORIZ_MULTF;
actorNew->vel.Z -= pp->horizon.__horiz.Tan() * HORIZ_MULTF;
oclipdist = plActor->native_clipdist();
plActor->set_const_clipdist(0);
@ -1664,7 +1664,7 @@ int PlayerInitCaltrops(PLAYER* pp)
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew))
actorNew->user.Flags |= (SPR_UNDERWATER);
actorNew->vel.Z -= pp->horizon.horiz.Tan() * HORIZ_MULTF;
actorNew->vel.Z -= pp->horizon.__horiz.Tan() * HORIZ_MULTF;
oclipdist = plActor->native_clipdist();
plActor->set_const_clipdist(0);
@ -2209,7 +2209,7 @@ int SpawnShell(DSWActor* actor, int ShellNum)
if (actor->user.PlayerP)
{
actorNew->vel.Z = -actor->user.PlayerP->horizon.horiz.Tan() * (HORIZ_MULTF / 3.);
actorNew->vel.Z = -actor->user.PlayerP->horizon.__horiz.Tan() * (HORIZ_MULTF / 3.);
}
switch (actorNew->user.ID)

View file

@ -6004,12 +6004,12 @@ void DoPlayerBeginDie(PLAYER* pp)
static void DoPlayerDeathHoriz(PLAYER* pp, double target, double speed)
{
if ((pp->horizon.horiz.Degrees() - target) > 0.4476)
if ((pp->horizon.__horiz.Degrees() - target) > 0.4476)
{
pp->horizon.addadjustment(DAngle::fromDeg(-speed));
}
if ((target - pp->horizon.horiz.Degrees()) > 0.4476)
if ((target - pp->horizon.__horiz.Degrees()) > 0.4476)
{
pp->horizon.addadjustment(DAngle::fromDeg(speed));
}
@ -6159,7 +6159,7 @@ void DoPlayerDeathCheckKeys(PLAYER* pp)
plActor->spr.xrepeat = PLAYER_NINJA_XREPEAT;
plActor->spr.yrepeat = PLAYER_NINJA_YREPEAT;
pp->horizon.horiz = nullAngle;
pp->horizon.__horiz = nullAngle;
DoPlayerResetMovement(pp);
plActor->user.ID = NINJA_RUN_R0;
PlayerDeathReset(pp);
@ -7176,14 +7176,14 @@ void InitAllPlayers(void)
extern bool NewGame;
//int fz,cz;
pfirst->horizon.horiz = nullAngle;
pfirst->horizon.__horiz = nullAngle;
// Initialize all [MAX_SW_PLAYERS] arrays here!
for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++)
{
pp->pos = pp->opos = pfirst->pos;
pp->angle.ang = pp->angle.oang = pfirst->angle.ang;
pp->horizon.horiz = pp->horizon.ohoriz = pfirst->horizon.horiz;
pp->horizon.__horiz = pp->horizon.ohoriz = pfirst->horizon.__horiz;
pp->cursector = pfirst->cursector;
// set like this so that player can trigger something on start of the level
pp->lastcursector = pfirst->cursector+1;

View file

@ -11610,7 +11610,7 @@ int DoRing(DSWActor* actor)
// put it out there
actor->spr.pos += actor->spr.angle.ToVector() * actor->user.Dist;
if (pp) actor->spr.pos.Z += actor->user.Dist * -pp->horizon.horiz.Tan() * 2.; // horizon math sucks...
if (pp) actor->spr.pos.Z += actor->user.Dist * -pp->horizon.__horiz.Tan() * 2.; // horizon math sucks...
SetActor(actor, actor->spr.pos);
@ -11689,7 +11689,7 @@ void InitSpellRing(PLAYER* pp)
// put it out there
actorNew->spr.pos += actorNew->spr.angle.ToVector() * actorNew->user.Dist;
actorNew->spr.pos.Z += pp->pos.Z + 20 + (actorNew->user.Dist * -pp->horizon.horiz.Tan() * 2.); // horizon math sucks...
actorNew->spr.pos.Z += pp->pos.Z + 20 + (actorNew->user.Dist * -pp->horizon.__horiz.Tan() * 2.); // horizon math sucks...
actorNew->spr.angle += DAngle90;
@ -12063,7 +12063,7 @@ void InitSpellNapalm(PLAYER* pp)
actor->spr.xrepeat = 32;
actor->spr.yrepeat = 32;
actor->set_const_clipdist(0);
actor->vel.Z = -pp->horizon.horiz.Tan() * HORIZ_MULTF;
actor->vel.Z = -pp->horizon.__horiz.Tan() * HORIZ_MULTF;
actor->spr.cstat |= (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
actor->user.Flags2 |= (SPR2_BLUR_TAPER_FAST);
@ -12195,7 +12195,7 @@ int InitSpellMirv(PLAYER* pp)
actorNew->spr.xrepeat = 72;
actorNew->spr.yrepeat = 72;
actorNew->set_const_clipdist(32 >> 2);
actorNew->vel.Z = -pp->horizon.horiz.Tan() * HORIZ_MULTF;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * HORIZ_MULTF;
actorNew->spr.cstat |= (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -12329,7 +12329,7 @@ int InitSwordAttack(PLAYER* pp)
{
HitInfo hit{};
double daz = -pp->horizon.horiz.Tan() * 1000. + (RandomRangeF(24000 / 256.) - 12000 / 256.);
double daz = -pp->horizon.__horiz.Tan() * 1000. + (RandomRangeF(24000 / 256.) - 12000 / 256.);
DAngle daang = pp->angle.ang;
FAFhitscan(pp->pos, pp->cursector, DVector3(pp->angle.ang.ToVector() * 1024, daz), hit, CLIPMASK_MISSILE);
@ -12506,7 +12506,7 @@ int InitFistAttack(PLAYER* pp)
// all this is to break glass
{
HitInfo hit{};
double daz = -pp->horizon.horiz.Tan() * 1000. + (RandomRangeF(24000 / 256.) - 12000 / 256.);
double daz = -pp->horizon.__horiz.Tan() * 1000. + (RandomRangeF(24000 / 256.) - 12000 / 256.);
auto daang = pp->angle.ang;
FAFhitscan(pp->pos, pp->cursector, DVector3(pp->angle.ang.ToVector() * 1024, daz), hit, CLIPMASK_MISSILE);
@ -13069,7 +13069,7 @@ int InitStar(PLAYER* pp)
actorNew->spr.shade = -25;
actorNew->set_const_clipdist(32 >> 2);
// zvel was overflowing with this calculation - had to move to a local long var
double zvel = -pp->horizon.horiz.Tan() * ((HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5);
double zvel = -pp->horizon.__horiz.Tan() * ((HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5);
actorNew->user.ceiling_dist = (1);
actorNew->user.floor_dist = (1);
@ -13120,7 +13120,7 @@ int InitStar(PLAYER* pp)
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew2))
actorNew2->user.Flags |= SPR_UNDERWATER;
zvel = -pp->horizon.horiz.Tan() * ((HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5);
zvel = -pp->horizon.__horiz.Tan() * ((HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5);
actorNew2->vel.Z = zvel * 0.5;
if (MissileSetPos(actorNew2, DoStar, 1000))
@ -13170,7 +13170,7 @@ void InitHeartAttack(PLAYER* pp)
actorNew->spr.xrepeat = 52;
actorNew->spr.yrepeat = 52;
actorNew->set_const_clipdist(0);
actorNew->vel.Z = -pp->horizon.horiz.Tan() * HORIZ_MULTF;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * HORIZ_MULTF;
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
actorNew->user.Flags2 |= (SPR2_DONT_TARGET_OWNER);
actorNew->spr.cstat |= (CSTAT_SPRITE_INVISIBLE);
@ -13314,7 +13314,7 @@ int InitShotgun(PLAYER* pp)
}
else
{
daz = -pp->horizon.horiz.Tan() * 1000.;
daz = -pp->horizon.__horiz.Tan() * 1000.;
daang = pp->angle.ang;
}
@ -13477,7 +13477,7 @@ int InitLaser(PLAYER* pp)
actorNew->set_const_clipdist(64 >> 2);;
// the slower the missile travels the less of a zvel it needs
actorNew->vel.Z = -pp->horizon.horiz.Tan() * 16.;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * 16.;
actorNew->user.WeaponNum = actor->user.WeaponNum;
actorNew->user.Radius = 200;
@ -13573,7 +13573,7 @@ int InitRail(PLAYER* pp)
actorNew->spr.yrepeat = 52;
actorNew->spr.xrepeat = 52;
actorNew->spr.shade = -15;
zvel = -pp->horizon.horiz.Tan() * ((HORIZ_MULT + 17) * 0.5);
zvel = -pp->horizon.__horiz.Tan() * ((HORIZ_MULT + 17) * 0.5);
actorNew->user.RotNum = 5;
NewStateGroup(actorNew, &sg_Rail[0]);
@ -13739,7 +13739,7 @@ int InitRocket(PLAYER* pp)
actorNew->spr.yrepeat = 90;
actorNew->spr.xrepeat = 90;
actorNew->spr.shade = -15;
zvel = -pp->horizon.horiz.Tan() * ((HORIZ_MULT + 35) * 0.5);
zvel = -pp->horizon.__horiz.Tan() * ((HORIZ_MULT + 35) * 0.5);
actorNew->set_const_clipdist(64 >> 2);
@ -13847,7 +13847,7 @@ int InitBunnyRocket(PLAYER* pp)
actorNew->spr.yrepeat = 64;
actorNew->spr.xrepeat = 64;
actorNew->spr.shade = -15;
zvel = -pp->horizon.horiz.Tan() * ((HORIZ_MULT + 35) * 0.5);
zvel = -pp->horizon.__horiz.Tan() * ((HORIZ_MULT + 35) * 0.5);
actorNew->set_const_clipdist(64 >> 2);
@ -13950,7 +13950,7 @@ int InitNuke(PLAYER* pp)
actorNew->spr.yrepeat = 128;
actorNew->spr.xrepeat = 128;
actorNew->spr.shade = -15;
zvel = -pp->horizon.horiz.Tan() * ((HORIZ_MULT + 36) * 0.5);
zvel = -pp->horizon.__horiz.Tan() * ((HORIZ_MULT + 36) * 0.5);
actorNew->set_const_clipdist(64 >> 2);
// Set to red palette
@ -14133,7 +14133,7 @@ int InitMicro(PLAYER* pp)
actorNew->spr.yrepeat = 24;
actorNew->spr.xrepeat = 24;
actorNew->spr.shade = -15;
actorNew->vel.Z = -pp->horizon.horiz.Tan() * HORIZ_MULTF;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * HORIZ_MULTF;
actorNew->set_const_clipdist(64 >> 2);
// randomize zvelocity
@ -15321,7 +15321,7 @@ int InitTracerUzi(PLAYER* pp)
static const short lat_dist[] = {800,-800};
double nz = 8 - (pp->horizon.horiz.Tan() * 36.);
double nz = 8 - (pp->horizon.__horiz.Tan() * 36.);
// Spawn a shot
// Inserting and setting up variables
@ -15361,7 +15361,7 @@ int InitTracerUzi(PLAYER* pp)
return 0;
}
actorNew->vel.Z = -pp->horizon.horiz.Tan() * actorNew->vel.X;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * actorNew->vel.X;
plActor->set_native_clipdist(oclipdist);
@ -15629,7 +15629,7 @@ int InitUzi(PLAYER* pp)
else
{
daang = pp->angle.ang + mapangle(RandomRange(24) - 12);
daz = -pp->horizon.horiz.Tan() * 1000. + (RandomRangeF(24000/256.) - 12000/256.);
daz = -pp->horizon.__horiz.Tan() * 1000. + (RandomRangeF(24000/256.) - 12000/256.);
}
DVector3 vect(daang.ToVector() * 1024, daz);
@ -15804,7 +15804,7 @@ int InitTankShell(DSWActor* actor, PLAYER* pp)
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat |= (CSTAT_SPRITE_INVISIBLE);
actorNew->vel.Z = -pp->horizon.horiz.Tan() * actorNew->vel.X;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * actorNew->vel.X;
WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false);
// a bit of randomness
@ -15873,7 +15873,7 @@ int InitTurretMicro(DSWActor* actor, PLAYER* pp)
actorNew->spr.yrepeat = 24;
actorNew->spr.xrepeat = 24;
actorNew->spr.shade = -15;
actorNew->vel.Z = -pp->horizon.horiz.Tan() * HORIZ_MULTF + RandomRangeF(8) - 5;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * HORIZ_MULTF + RandomRangeF(8) - 5;
actorNew->set_const_clipdist(64 >> 2);
@ -15943,7 +15943,7 @@ int InitTurretRocket(DSWActor* actor, PLAYER* pp)
actorNew->user.Flags2 |= (SPR2_SO_MISSILE);
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->vel.Z = -pp->horizon.horiz.Tan() * actorNew->vel.X;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * actorNew->vel.X;
WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false);
// a bit of randomness
@ -15983,7 +15983,7 @@ int InitTurretFireball(DSWActor* actor, PLAYER* pp)
actorNew->user.Flags2 |= (SPR2_SO_MISSILE);
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->vel.Z = -pp->horizon.horiz.Tan() * actorNew->vel.X;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * actorNew->vel.X;
WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false);
// a bit of randomness
@ -16021,7 +16021,7 @@ int InitTurretRail(DSWActor* actor, PLAYER* pp)
actorNew->spr.yrepeat = 52;
actorNew->spr.xrepeat = 52;
actorNew->spr.shade = -15;
actorNew->vel.Z = -pp->horizon.horiz.Tan() * HORIZ_MULTF;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * HORIZ_MULTF;
actorNew->user.RotNum = 5;
NewStateGroup(actorNew, &sg_Rail[0]);
@ -16069,7 +16069,7 @@ int InitTurretLaser(DSWActor* actor, PLAYER* pp)
actorNew->spr.shade = -15;
// the slower the missile travels the less of a zvel it needs
actorNew->vel.Z = -pp->horizon.horiz.Tan() * 16.;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * 16.;
actorNew->user.Radius = 200;
actorNew->user.ceiling_dist = (1);
@ -16107,7 +16107,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYER* pp)
double daz = npos.Z;
if (RANDOM_P2(1024) < 200)
InitTracerTurret(actor, pp->actor, pp->horizon.horiz);
InitTracerTurret(actor, pp->actor, pp->horizon.__horiz);
DAngle daang = DAngle22_5 / 2;
if (WeaponAutoAimHitscan(actor, &daz, &daang, false) != nullptr)
@ -16116,7 +16116,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYER* pp)
}
else
{
daz = -1000 * max(pp->horizon.horiz.Tan(), -0.1953125) + RandomRangeF(80) - 40;
daz = -1000 * max(pp->horizon.__horiz.Tan(), -0.1953125) + RandomRangeF(80) - 40;
daang = actor->spr.angle;
}
@ -16814,7 +16814,7 @@ int InitGrenade(PLAYER* pp)
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew))
actorNew->user.Flags |= (SPR_UNDERWATER);
actorNew->vel.Z = -pp->horizon.horiz.Tan() * HORIZ_MULTF;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * HORIZ_MULTF;
SAVE_CLIP;
actor->set_const_clipdist(0);
@ -16932,7 +16932,7 @@ int InitMine(PLAYER* pp)
actorNew->spr.xrepeat = 32;
actorNew->spr.shade = -15;
actorNew->set_const_clipdist(128 >> 2);
actorNew->vel.Z = -pp->horizon.horiz.Tan() * HORIZ_MULTF;
actorNew->vel.Z = -pp->horizon.__horiz.Tan() * HORIZ_MULTF;
actorNew->user.WeaponNum = actor->user.WeaponNum;
actorNew->user.Radius = 200;
actorNew->user.ceiling_dist = (5);
@ -17067,7 +17067,7 @@ int InitFireball(PLAYER* pp)
actorNew->user.ceiling_dist = (6);
actorNew->user.floor_dist = (6);
double zvel = -pp->horizon.horiz.Tan() * 120.;
double zvel = -pp->horizon.__horiz.Tan() * 120.;
// at certain angles the clipping box was big enough to block the
// initial positioning of the fireball.