- Duke: Add a myriad of pitch recentering CVARs.

* Needs to be reworked into some kind of MP-safe flagging once we have demos/MP going. This will do for now.
* Fixes #853.
This commit is contained in:
Mitchell Richters 2023-03-26 12:45:48 +11:00
parent 11049123b0
commit a5a9882d9a
9 changed files with 36 additions and 23 deletions

View file

@ -91,8 +91,16 @@ CVARD(Bool, cl_bloodweapinterp, false, CVAR_ARCHIVE, "enable/disable Blood's wea
CVARD(Bool, cl_bloodoldweapbalance, false, CVAR_ARCHIVE, "enable/disable legacy 1.0 weapon handling for Blood")
CVARD(Bool, cl_loadingscreens, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable loading screens for games")
CVARD(Bool, cl_clampedpitch, true, CVAR_ARCHIVE, "clamp the view pitch to original ranges")
CVARD(Bool, cl_dukelockpitchreturn, true, CVAR_ARCHIVE, "enable/disable Duke's pitch input when returning to centre")
CUSTOM_CVARD(Int, cl_dukepitchmode, 7, CVAR_ARCHIVE, "customise Duke's myriad of pitch options")
{
if (self < 0) self = 0;
else if (self > 7) self = 7;
}
CVARD(Flag, cl_dukepitchlockreturn, cl_dukepitchmode, 1, "enable/disable pitch input while returning to centre");
CVARD(Flag, cl_dukepitchhardlanding, cl_dukepitchmode, 2, "enable/disable pitch adjustment from a high fall");
CVARD(Flag, cl_dukepitchlandingrecenter, cl_dukepitchmode, 4, "enable/disable pitch recentreing after a high fall");
CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable weapon autoaim")
{

View file

@ -1,6 +1,13 @@
#pragma once
#include "c_cvars.h"
enum
{
kDukePitchLockReturn = 1,
kDukePitchHardLanding = 2,
kDukePitchLandingRecenter = 4,
};
EXTERN_CVAR(Bool, cl_crosshair)
EXTERN_CVAR(Bool, cl_automsg)
EXTERN_CVAR(Int, cl_autoaim)
@ -36,7 +43,11 @@ EXTERN_CVAR(Bool, cl_bloodweapinterp)
EXTERN_CVAR(Bool, cl_bloodoldweapbalance)
EXTERN_CVAR(Bool, cl_loadingscreens)
EXTERN_CVAR(Bool, cl_clampedpitch)
EXTERN_CVAR(Bool, cl_dukelockpitchreturn)
EXTERN_CVAR(Int, cl_dukepitchmode)
EXTERN_CVAR(Flag, cl_dukepitchlockreturn)
EXTERN_CVAR(Flag, cl_dukepitchnohardlanding)
EXTERN_CVAR(Flag, cl_dukepitchnolandingcenter)
EXTERN_CVAR(Bool, demorec_seeds_cvar)
EXTERN_CVAR(Bool, demoplay_diffs)

View file

@ -39,7 +39,7 @@ struct GameInterface : public ::GameInterface
void SerializeGameState(FSerializer& arc) override;
void ExitFromMenu() override;
void DrawPlayerSprite(const DVector2& origin, bool onteam) override;
void reapplyInputBits(InputPacket* const input) override;
void reapplyInputBits(InputPacket* const input) override { input->actions |= ps[myconnectindex].sync.actions & SB_CENTERVIEW; }
void GetInput(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust) override;
void UpdateSounds() override;
void Startup() override;

View file

@ -610,21 +610,6 @@ static void processVehicleInput(player_struct *p, HIDInput* const hidInput, Inpu
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void GameInterface::reapplyInputBits(InputPacket* const input)
{
if ((ps[myconnectindex].sync.actions & SB_CENTERVIEW) && (cl_dukelockpitchreturn || !input->avel))
{
input->actions |= SB_CENTERVIEW;
}
}
//---------------------------------------------------------------------------
//
// External entry point

View file

@ -802,7 +802,7 @@ void player_struct::checkhardlanding()
{
if (hard_landing > 0)
{
GetActor()->spr.Angles.Pitch += maphoriz(hard_landing << 4);
GetActor()->spr.Angles.Pitch += maphoriz(hard_landing << 4) * !!(cl_dukepitchmode & kDukePitchHardLanding);
hard_landing--;
}
}

View file

@ -2973,7 +2973,7 @@ HORIZONLY:
}
// center_view
if (actions & SB_CENTERVIEW || p->hard_landing)
if (actions & SB_CENTERVIEW || (p->hard_landing && (cl_dukepitchmode & kDukePitchLandingRecenter)))
{
playerCenterView(snum);
}

View file

@ -3694,7 +3694,7 @@ HORIZONLY:
return;
}
if (actions & SB_CENTERVIEW || p->hard_landing)
if (actions & SB_CENTERVIEW || (p->hard_landing && (cl_dukepitchmode & kDukePitchLandingRecenter)))
{
playerCenterView(snum);
}

View file

@ -347,7 +347,10 @@ struct player_struct
bool centeringView()
{
return (sync.actions & SB_CENTERVIEW) && abs(GetActor()->spr.Angles.Pitch.Degrees()) > 2.2370;
const bool centering = sync.actions & SB_CENTERVIEW;
const bool lockedret = cl_dukepitchmode & kDukePitchLockReturn;
const bool rangetest = abs(GetActor()->spr.Angles.Pitch.Degrees()) > 2.2370;
return centering && lockedret && rangetest;
}
};

View file

@ -1024,12 +1024,18 @@ OptionMenu GameplayOptions protected
{
Option "$PLRMNU_FULLVIEWPITCH", "cl_clampedpitch", "OffOn"
}
StaticText ""
ifgame(Blood)
{
Option "$PLRMNU_BLDQAVINTERP", "cl_bloodqavinterp", "OnOff"
Option "$PLRMNU_BLDWEAPINTERP", "cl_bloodweapinterp", "OnOff", "cl_bloodqavinterp"
}
// StaticText ""
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{
Option "$PLRMNU_DUKEPITCHLOCKRET", "cl_dukepitchlockreturn", "OnOff"
Option "$PLRMNU_DUKEPITCHHARDLAND", "cl_dukepitchhardlanding", "OnOff"
Option "$PLRMNU_DUKEPITCHLANDRET", "cl_dukepitchlandingrecenter", "OnOff"
}
// Option "Record Demo", "m_recstat", "OnOff"
// Submenu "Cheats" "CheatsMenu
}