- Invert rotscrnang so it rolls forward, consistent with all other angles.

This commit is contained in:
Mitchell Richters 2022-12-04 21:57:45 +11:00 committed by Christoph Oelckers
parent bef4536c1f
commit 175b182805
12 changed files with 21 additions and 19 deletions

View file

@ -232,7 +232,7 @@ void PlayerAngles::applyYaw(float const avel, ESyncBits* actions, double const s
if (auto looking = !!(*actions & SB_LOOK_RIGHT) - !!(*actions & SB_LOOK_LEFT))
{
ZzLOOKANG += getTicrateScale(YAW_LOOKINGSPEED) * getCorrectedScale(scaleAdjust) * looking;
ZzROTSCRNANG -= getTicrateScale(YAW_ROTATESPEED) * getCorrectedScale(scaleAdjust) * looking;
ZzROTSCRNANG += getTicrateScale(YAW_ROTATESPEED) * getCorrectedScale(scaleAdjust) * looking;
}
if (!lockedYaw())

View file

@ -81,7 +81,7 @@ struct PlayerAngles
// Crosshair x/y offsets based on look_ang's tangent.
DVector2 angCROSSHAIROFFSETS(const double interpfrac)
{
return DVector2(159.72, 145.5 * angRENDERROTSCRN(interpfrac).Sin()) * -angRENDERLOOKANG(interpfrac).Tan() * (1. / tan(r_fov * pi::pi() / 360.));
return DVector2(159.72, 145.5 * -angRENDERROTSCRN(interpfrac).Sin()) * -angRENDERLOOKANG(interpfrac).Tan() * (1. / tan(r_fov * pi::pi() / 360.));
}
// Weapon x/y offsets based on the above.

View file

@ -201,7 +201,7 @@ FRenderViewpoint SetupViewpoint(DCoreActor* cam, const DVector3& position, int s
r_viewpoint.Pos = { position.X, -position.Y, -position.Z };
r_viewpoint.HWAngles.Yaw = FAngle::fromDeg(-90.f + (float)angle.Degrees());
r_viewpoint.HWAngles.Pitch = FAngle::fromDeg(ClampViewPitch(horizon).Degrees());
r_viewpoint.HWAngles.Roll = FAngle::fromDeg(-(float)rollang.Degrees());
r_viewpoint.HWAngles.Roll = FAngle::fromDeg((float)rollang.Degrees());
r_viewpoint.FieldOfView = FAngle::fromDeg(fov > 0? fov : (float)r_fov);
r_viewpoint.RotAngle = angle.BAMs();
double FocalTangent = tan(r_viewpoint.FieldOfView.Radians() / 2);

View file

@ -214,7 +214,7 @@ void QAV::Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double
tileAlpha = (tileStat & RS_TRANS1) ? glblend[0].def[!!(tileStat & RS_TRANS2)].alpha : 1.f;
}
DrawFrame(tileX + x, tileY + y, tileZ, (tileA + angle).Buildfang(), tileAlpha, thisTile->picnum, tileStat, tileShade + shade, (palnum <= 0 ? thisTile->palnum : palnum), to3dview);
DrawFrame(tileX + x, tileY + y, tileZ, (tileA - angle).Buildfang(), tileAlpha, thisTile->picnum, tileStat, tileShade + shade, (palnum <= 0 ? thisTile->palnum : palnum), to3dview);
}
}
}

View file

@ -663,7 +663,7 @@ void viewDrawScreen(bool sceneonly)
uint8_t otherview = powerupCheck(pPlayer, kPwUpCrystalBall) > 0;
if (tilt.Degrees() || bDelirium)
{
rotscrnang = tilt;
rotscrnang = -tilt;
}
else if (otherview && gNetPlayers > 1)
{
@ -743,7 +743,7 @@ void viewDrawScreen(bool sceneonly)
if (sceneonly) return;
auto offsets = pPlayer->Angles.angCROSSHAIROFFSETS(interpfrac);
DrawCrosshair(kCrosshairTile, pPlayer->actor->xspr.health >> 4, offsets.X, offsets.Y, 2, -pPlayer->Angles.angLERPROTSCRN(interpfrac));
DrawCrosshair(kCrosshairTile, pPlayer->actor->xspr.health >> 4, offsets.X, offsets.Y, 2, pPlayer->Angles.angLERPROTSCRN(interpfrac));
#if 0 // This currently does not work. May have to be redone as a hardware effect.
if (v4 && gNetPlayers > 1)
{

View file

@ -292,7 +292,7 @@ void drawoverlays(double interpfrac)
if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr)
{
auto offsets = pp->Angles.angCROSSHAIROFFSETS(interpfrac);
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, offsets.X, offsets.Y + (pp->over_shoulder_on ? 2.5 : 0), isRR() ? 0.5 : 1, -pp->Angles.angLERPROTSCRN(interpfrac));
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, offsets.X, offsets.Y + (pp->over_shoulder_on ? 2.5 : 0), isRR() ? 0.5 : 1, pp->Angles.angLERPROTSCRN(interpfrac));
}
if (paused == 2)

View file

@ -710,8 +710,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_ROTSCRNANG:
if (bSet) ps[iPlayer].Angles.ZzOLDROTSCRNANG = ps[iPlayer].Angles.ZzROTSCRNANG = mapangle(lValue);
else SetGameVarID(lVar2, ps[iPlayer].Angles.ZzROTSCRNANG.Buildang(), sActor, sPlayer);
if (bSet) ps[iPlayer].Angles.ZzOLDROTSCRNANG = ps[iPlayer].Angles.ZzROTSCRNANG = -mapangle(lValue);
else SetGameVarID(lVar2, -ps[iPlayer].Angles.ZzROTSCRNANG.Buildang(), sActor, sPlayer);
break;
case PLAYER_DEAD_FLAG:

View file

@ -232,7 +232,7 @@ void displayweapon_d(int snum, double interpfrac)
auto horiz = !SyncInput() ? p->Angles.horizSUM() : p->Angles.horizLERPSUM(interpfrac);
auto pitchoffset = interpolatedvalue(0., 16., horiz / DAngle90);
auto yawinput = getavel(snum) * (1. / 16.);
auto angle = p->Angles.angRENDERROTSCRN(interpfrac);
auto angle = -p->Angles.angRENDERROTSCRN(interpfrac);
auto weapon_xoffset = 160 - 90 - (BobVal(512 + weapon_sway * 0.5) * (16384. / 1536.)) - 58 - p->weapon_ang;
auto shade = min(p->GetActor()->spr.shade, (int8_t)24);

View file

@ -116,10 +116,12 @@ void quickkill(player_struct* p)
void forceplayerangle(int snum)
{
player_struct* p = &ps[snum];
const auto ang = (DAngle22_5 - randomAngle(45)) / 2.;
p->Angles.addPitch(DAngle::fromDeg(-26.566));
p->sync.actions |= SB_CENTERVIEW;
p->Angles.ZzROTSCRNANG = p->Angles.ZzLOOKANG = (DAngle22_5 - randomAngle(45)) / 2.;
p->Angles.ZzLOOKANG = ang;
p->Angles.ZzROTSCRNANG = -ang;
}
//---------------------------------------------------------------------------
@ -622,7 +624,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
pushmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, 8, 4, 20, CLIPMASK0);
if (floorz > ceilingz + 16 && actor->spr.pal != 1)
p->Angles.ZzROTSCRNANG = DAngle::fromBuild(p->dead_flag + ((floorz + p->GetActor()->getOffsetZ()) * 2));
p->Angles.ZzROTSCRNANG = DAngle::fromBuild(-(p->dead_flag + ((floorz + p->GetActor()->getOffsetZ()) * 2)));
p->on_warping_sector = 0;
@ -734,13 +736,13 @@ void player_struct::apply_seasick(double factor)
if (SeaSick < 250)
{
if (SeaSick >= 180)
Angles.ZzROTSCRNANG += DAngle::fromDeg(24 * factor * BAngToDegree);
Angles.ZzROTSCRNANG -= DAngle::fromDeg(24 * factor * BAngToDegree);
else if (SeaSick >= 130)
Angles.ZzROTSCRNANG -= DAngle::fromDeg(24 * factor * BAngToDegree);
else if (SeaSick >= 70)
Angles.ZzROTSCRNANG += DAngle::fromDeg(24 * factor * BAngToDegree);
else if (SeaSick >= 20)
else if (SeaSick >= 70)
Angles.ZzROTSCRNANG -= DAngle::fromDeg(24 * factor * BAngToDegree);
else if (SeaSick >= 20)
Angles.ZzROTSCRNANG += DAngle::fromDeg(24 * factor * BAngToDegree);
}
if (SeaSick < 250)
Angles.ZzLOOKANG = DAngle::fromDeg(((krand() & 255) - 128) * factor * BAngToDegree);

View file

@ -88,7 +88,7 @@ void GameInterface::Render()
{
DrawStatusBar();
auto offsets = PlayerList[nLocalPlayer].Angles.angCROSSHAIROFFSETS(interpfrac);
DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, offsets.X, offsets.Y, 1, -PlayerList[nLocalPlayer].Angles.angLERPROTSCRN(interpfrac));
DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, offsets.X, offsets.Y, 1, PlayerList[nLocalPlayer].Angles.angLERPROTSCRN(interpfrac));
if (paused && !M_Active())
{

View file

@ -1022,7 +1022,7 @@ void PrintSpriteInfo(PLAYER* pp)
static void DrawCrosshair(PLAYER* pp, const double interpfrac)
{
auto offsets = pp->Angles.angCROSSHAIROFFSETS(interpfrac);
::DrawCrosshair(2326, pp->actor->user.Health, offsets.X, offsets.Y + ((pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0), 2, -pp->Angles.angLERPROTSCRN(interpfrac), shadeToLight(10));
::DrawCrosshair(2326, pp->actor->user.Health, offsets.X, offsets.Y + ((pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0), 2, pp->Angles.angLERPROTSCRN(interpfrac), shadeToLight(10));
}
//---------------------------------------------------------------------------

View file

@ -7429,7 +7429,7 @@ void pDisplaySprites(PLAYER* pp, double interpfrac)
int flags;
const auto offsets = pp->Angles.angWEAPONOFFSETS(interpfrac);
const auto angle = pp->Angles.angRENDERROTSCRN(interpfrac).Buildfang();
const auto angle = -pp->Angles.angRENDERROTSCRN(interpfrac).Buildfang();
auto list = pp->GetPanelSpriteList();
for (auto psp = list->Next; next = psp->Next, psp != list; psp = next)