mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-14 16:40:46 +00:00
- Rename PlayerAngles::RenderAngles
to CameraAngles
.
* Better conveys what it is and separates it from the already established `getRender*()` methods around the place. * Sorry Simon!
This commit is contained in:
parent
742a2e5c9a
commit
d329328191
15 changed files with 30 additions and 30 deletions
|
@ -324,7 +324,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, P
|
|||
|
||||
if (arc.isReading())
|
||||
{
|
||||
w.resetRenderAngles();
|
||||
w.resetCameraAngles();
|
||||
}
|
||||
}
|
||||
return arc;
|
||||
|
|
|
@ -9,7 +9,7 @@ struct PlayerAngles
|
|||
DRotator PrevViewAngles, ViewAngles;
|
||||
|
||||
// Player camera angles, not for direct manipulation within the playsim.
|
||||
DRotator RenderAngles;
|
||||
DRotator CameraAngles;
|
||||
|
||||
// Holder of current yaw spin state for the 180 degree turn.
|
||||
DAngle YawSpin;
|
||||
|
@ -25,7 +25,7 @@ struct PlayerAngles
|
|||
// General methods.
|
||||
void initialize(DCoreActor* const actor, const DAngle viewyaw = nullAngle)
|
||||
{
|
||||
if (pActor = actor) RenderAngles = PrevLerpAngles = pActor->spr.Angles;
|
||||
if (pActor = actor) CameraAngles = PrevLerpAngles = pActor->spr.Angles;
|
||||
PrevViewAngles.Yaw = ViewAngles.Yaw = viewyaw;
|
||||
}
|
||||
DAngle getPitchWithView()
|
||||
|
@ -37,22 +37,22 @@ struct PlayerAngles
|
|||
DRotator getRenderAngles(const double interpfrac)
|
||||
{
|
||||
// Get angles and return with clamped off pitch.
|
||||
auto angles = RenderAngles + interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
|
||||
auto angles = CameraAngles + interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
|
||||
angles.Pitch = ClampViewPitch(angles.Pitch);
|
||||
return angles;
|
||||
}
|
||||
void updateRenderAngles(const double interpfrac)
|
||||
void updateCameraAngles(const double interpfrac)
|
||||
{
|
||||
// Apply the current interpolated angle state to the render angles.
|
||||
const auto lerpAngles = interpolatedvalue(pActor->PrevAngles, pActor->spr.Angles, interpfrac);
|
||||
RenderAngles += lerpAngles - PrevLerpAngles;
|
||||
CameraAngles += lerpAngles - PrevLerpAngles;
|
||||
PrevLerpAngles = lerpAngles;
|
||||
}
|
||||
void resetRenderAngles()
|
||||
void resetCameraAngles()
|
||||
{
|
||||
// Apply any last remaining ticrate angle updates and reset variables.
|
||||
RenderAngles += pActor->spr.Angles - PrevLerpAngles;
|
||||
PrevLerpAngles = pActor->spr.Angles = RenderAngles;
|
||||
CameraAngles += pActor->spr.Angles - PrevLerpAngles;
|
||||
PrevLerpAngles = pActor->spr.Angles = CameraAngles;
|
||||
PrevViewAngles = ViewAngles;
|
||||
}
|
||||
|
||||
|
|
|
@ -438,7 +438,7 @@ void GameInterface::Ticker()
|
|||
PLAYER* pPlayer = &gPlayer[myconnectindex];
|
||||
|
||||
// this must be done before the view is backed up.
|
||||
pPlayer->Angles.resetRenderAngles();
|
||||
pPlayer->Angles.resetCameraAngles();
|
||||
|
||||
// disable synchronised input if set by game.
|
||||
resetForcedSyncInput();
|
||||
|
|
|
@ -57,8 +57,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
|||
// Perform unsynchronised angle/horizon if not dead.
|
||||
if (!SyncInput() && gamestate == GS_LEVEL && pPlayer->actor->xspr.health != 0)
|
||||
{
|
||||
pPlayer->Angles.RenderAngles.Yaw += DAngle::fromDeg(input.avel);
|
||||
pPlayer->Angles.RenderAngles.Pitch += DAngle::fromDeg(input.horz);
|
||||
pPlayer->Angles.CameraAngles.Yaw += DAngle::fromDeg(input.avel);
|
||||
pPlayer->Angles.CameraAngles.Pitch += DAngle::fromDeg(input.horz);
|
||||
}
|
||||
|
||||
if (packet)
|
||||
|
|
|
@ -582,7 +582,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
else interpfrac = 1.;
|
||||
|
||||
// update render angles.
|
||||
pPlayer->Angles.updateRenderAngles(interpfrac);
|
||||
pPlayer->Angles.updateCameraAngles(interpfrac);
|
||||
|
||||
if (cl_interpolate)
|
||||
{
|
||||
|
|
|
@ -426,7 +426,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
|
|||
double j = clamp(czoom * act->spr.scale.Y + abs(pp.truefz - act->getOffsetZ()) * REPEAT_SCALE, (1. / 3.), 2.);
|
||||
|
||||
auto const vec = OutAutomapVector(mxy - cpos, cangvect, czoom, xydim);
|
||||
auto const daang = -(pp.Angles.RenderAngles.Yaw - cang).Normalized360().Degrees();
|
||||
auto const daang = -(pp.Angles.CameraAngles.Yaw - cang).Normalized360().Degrees();
|
||||
|
||||
DrawTexture(twod, tileGetTexture(i), vec.X, vec.Y, DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), act->spr.pal), DTA_CenterOffset, true,
|
||||
DTA_Rotate, daang, DTA_Color, shadeToLight(act->spr.shade), DTA_ScaleX, j, DTA_ScaleY, j, TAG_DONE);
|
||||
|
|
|
@ -70,7 +70,7 @@ void GameInterface::Ticker()
|
|||
everyothertime++;
|
||||
|
||||
// this must be done before the view is backed up.
|
||||
ps[myconnectindex].Angles.resetRenderAngles();
|
||||
ps[myconnectindex].Angles.resetCameraAngles();
|
||||
|
||||
// disable synchronised input if set by game.
|
||||
resetForcedSyncInput();
|
||||
|
|
|
@ -830,8 +830,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
|||
|
||||
if (!SyncInput() && p->GetActor()->spr.extra > 0)
|
||||
{
|
||||
p->Angles.RenderAngles.Yaw += p->adjustavel(input.avel);
|
||||
p->Angles.RenderAngles.Pitch += DAngle::fromDeg(input.horz);
|
||||
p->Angles.CameraAngles.Yaw += p->adjustavel(input.avel);
|
||||
p->Angles.CameraAngles.Pitch += DAngle::fromDeg(input.horz);
|
||||
}
|
||||
|
||||
if (packet)
|
||||
|
|
|
@ -221,7 +221,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
|
|||
player_struct* p = &ps[snum];
|
||||
|
||||
// update render angles.
|
||||
p->Angles.updateRenderAngles(interpfrac);
|
||||
p->Angles.updateCameraAngles(interpfrac);
|
||||
|
||||
if (automapMode == am_full || !p->insector())
|
||||
return;
|
||||
|
|
|
@ -368,7 +368,7 @@ void GameInterface::Ticker()
|
|||
else if (EndLevel == 0)
|
||||
{
|
||||
// this must be done before the view is backed up.
|
||||
PlayerList[nLocalPlayer].Angles.resetRenderAngles();
|
||||
PlayerList[nLocalPlayer].Angles.resetCameraAngles();
|
||||
UpdatePlayerSpriteAngle(&PlayerList[nLocalPlayer]);
|
||||
|
||||
// disable synchronised input if set by game.
|
||||
|
|
|
@ -75,8 +75,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
|||
|
||||
if (!SyncInput() && gamestate == GS_LEVEL && !nFreeze)
|
||||
{
|
||||
pPlayer->Angles.RenderAngles.Yaw += DAngle::fromDeg(input.avel);
|
||||
pPlayer->Angles.RenderAngles.Pitch += DAngle::fromDeg(input.horz);
|
||||
pPlayer->Angles.CameraAngles.Yaw += DAngle::fromDeg(input.avel);
|
||||
pPlayer->Angles.CameraAngles.Pitch += DAngle::fromDeg(input.horz);
|
||||
|
||||
if (input.horz)
|
||||
{
|
||||
|
|
|
@ -203,7 +203,7 @@ void DrawView(double interpfrac, bool sceneonly)
|
|||
auto nDoppleOldCstat = pDop->spr.cstat;
|
||||
|
||||
// update render angles.
|
||||
pPlayer->Angles.updateRenderAngles(interpfrac);
|
||||
pPlayer->Angles.updateCameraAngles(interpfrac);
|
||||
UpdatePlayerSpriteAngle(pPlayer);
|
||||
|
||||
if (nSnakeCam >= 0 && !sceneonly)
|
||||
|
|
|
@ -803,7 +803,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
|
|||
}
|
||||
|
||||
tsp->pos = pos;
|
||||
tsp->Angles.Yaw = pp->Angles.RenderAngles.Yaw;
|
||||
tsp->Angles.Yaw = pp->Angles.CameraAngles.Yaw;
|
||||
//continue;
|
||||
}
|
||||
else
|
||||
|
@ -1242,7 +1242,7 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly)
|
|||
}
|
||||
|
||||
// update render angles.
|
||||
pp->Angles.updateRenderAngles(interpfrac);
|
||||
pp->Angles.updateCameraAngles(interpfrac);
|
||||
|
||||
// Get initial player position, interpolating if required.
|
||||
DVector3 tpos = camerapp->actor->getRenderPos(interpfrac);
|
||||
|
@ -1458,7 +1458,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
|
|||
|
||||
if (spnum >= 0)
|
||||
{
|
||||
const auto daang = -(pp->Angles.RenderAngles.Yaw - cang).Normalized360().Degrees();
|
||||
const auto daang = -(pp->Angles.CameraAngles.Yaw - cang).Normalized360().Degrees();
|
||||
auto vect = OutAutomapVector(mxy - cpos, cangvect, czoom, xydim);
|
||||
|
||||
// This repeat scale is correct.
|
||||
|
|
|
@ -180,22 +180,22 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
|||
{
|
||||
if ((pp->Flags2 & PF2_INPUT_CAN_AIM))
|
||||
{
|
||||
pp->Angles.RenderAngles.Pitch += DAngle::fromDeg(input.horz);
|
||||
pp->Angles.CameraAngles.Pitch += DAngle::fromDeg(input.horz);
|
||||
}
|
||||
|
||||
if ((pp->Flags2 & PF2_INPUT_CAN_TURN_GENERAL))
|
||||
{
|
||||
pp->Angles.RenderAngles.Yaw += DAngle::fromDeg(input.avel);
|
||||
pp->Angles.CameraAngles.Yaw += DAngle::fromDeg(input.avel);
|
||||
}
|
||||
|
||||
if ((pp->Flags2 & PF2_INPUT_CAN_TURN_VEHICLE))
|
||||
{
|
||||
DoPlayerTurnVehicle(pp, pp->Angles.RenderAngles.Yaw, input.avel, pp->actor->getOffsetZ() + 10, abs(pp->actor->getOffsetZ() + 10 - pp->sop->floor_loz));
|
||||
DoPlayerTurnVehicle(pp, pp->Angles.CameraAngles.Yaw, input.avel, pp->actor->getOffsetZ() + 10, abs(pp->actor->getOffsetZ() + 10 - pp->sop->floor_loz));
|
||||
}
|
||||
|
||||
if ((pp->Flags2 & PF2_INPUT_CAN_TURN_TURRET))
|
||||
{
|
||||
DoPlayerTurnTurret(pp, pp->Angles.RenderAngles.Yaw, input.avel);
|
||||
DoPlayerTurnTurret(pp, pp->Angles.CameraAngles.Yaw, input.avel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6705,7 +6705,7 @@ void MoveSkipSavePos(void)
|
|||
MoveSkip2 ^= 1;
|
||||
|
||||
// this must be done before the view is backed up.
|
||||
Player[myconnectindex].Angles.resetRenderAngles();
|
||||
Player[myconnectindex].Angles.resetCameraAngles();
|
||||
|
||||
// Save off player
|
||||
TRAVERSE_CONNECT(pnum)
|
||||
|
|
Loading…
Reference in a new issue