Added toggle control for weapon bob while flying

This commit is contained in:
CandiceJoy 2022-12-16 17:12:03 -06:00
parent de65d1b96f
commit 0fdb740ac7
No known key found for this signature in database
GPG Key ID: D51ABC8A5F5828DA
9 changed files with 28 additions and 2 deletions

View File

@ -63,6 +63,7 @@ CVAR (Int, team, TEAM_NONE, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (String, gender, "male", CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Bool, neverswitchonpickup, false, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, movebob, 0.25f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Bool, fviewbob, true, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, stillbob, 0.f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, wbobspeed, 1.f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, wbobfire, 0.f, CVAR_USERINFO | CVAR_ARCHIVE);
@ -80,6 +81,7 @@ enum
INFO_Gender,
INFO_NeverSwitchOnPickup,
INFO_MoveBob,
INFO_FViewBob,
INFO_StillBob,
INFO_WBobSpeed,
INFO_WBobFire,

View File

@ -450,6 +450,7 @@ xx(Playermenu)
xx(ColorSet)
xx(NeverSwitchOnPickup)
xx(MoveBob)
xx(FViewBob)
xx(StillBob)
xx(ClassicFlight)
xx(WBobSpeed)

View File

@ -226,6 +226,10 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
{
return *static_cast<FFloatCVar *>(*CheckKey(NAME_MoveBob));
}
double GetFViewBob() const
{
return *static_cast<FBoolCVar *>(*CheckKey(NAME_FViewBob));
}
double GetStillBob() const
{
return *static_cast<FFloatCVar *>(*CheckKey(NAME_StillBob));

View File

@ -531,6 +531,7 @@
PLAYERINFO_GENDER,
PLAYERINFO_NEVERSWITCH,
PLAYERINFO_MOVEBOB,
PLAYERINFO_FVIEWBOB,
PLAYERINFO_STILLBOB,
PLAYERINFO_PLAYERCLASS,
PLAYERINFO_FOV,
@ -9954,6 +9955,7 @@ scriptwait:
case PLAYERINFO_GENDER: STACK(2) = userinfo->GetGender(); break;
case PLAYERINFO_NEVERSWITCH: STACK(2) = userinfo->GetNeverSwitch(); break;
case PLAYERINFO_MOVEBOB: STACK(2) = DoubleToACS(userinfo->GetMoveBob()); break;
case PLAYERINFO_FVIEWBOB: STACK(2) = DoubleToACS(userinfo->GetFViewBob()); break;
case PLAYERINFO_STILLBOB: STACK(2) = DoubleToACS(userinfo->GetStillBob()); break;
case PLAYERINFO_PLAYERCLASS: STACK(2) = userinfo->GetPlayerClassNum(); break;
case PLAYERINFO_DESIREDFOV: STACK(2) = (int)pl->DesiredFOV; break;

View File

@ -2410,7 +2410,10 @@ static void P_ZMovement (AActor *mo, double oldfloorz)
}
if (mo->player && (mo->flags & MF_NOGRAVITY) && (mo->Z() > mo->floorz))
{
if (!mo->IsNoClip2())
FBaseCVar* const fViewBobCvar = G_GetUserCVar(int(mo->player - players),"FViewBob");
bool const fViewBob = fViewBobCvar->GetGenericRep(fViewBobCvar->GetRealType()).Bool;
if (!mo->IsNoClip2() && fViewBob)
{
mo->AddZ(DAngle::fromDeg(360 / 80.f * mo->Level->maptime).Sin() / 8);
}

View File

@ -796,6 +796,12 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, GetMoveBob)
ACTION_RETURN_FLOAT(self->userinfo.GetMoveBob());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetFViewBob)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_BOOL(self->userinfo.GetFViewBob());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetStillBob)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);

View File

@ -2762,6 +2762,7 @@ Interpolate monster movement,DSPLYMNU_NOMONSTERINTERPOLATION,,,,Interpolovat poh
Menu dim,DSPLYMNU_MENUDIM,,,,Síla barvy pozadí v menu,Menüabdunklung,,Menuo-malheleco,Atenuación del menú,,Valikon himmennys,Assombrissement menu,Menü homályosítása,Offuscamento menu,メニュー背景,메뉴 배경색 강도,Donkere menuachtergrond,Mgła w menu,Atenuação do menu,,Întunecare meniu,Затемнение фона меню,Пригушивање менија
Dim color,DSPLYMNU_DIMCOLOR,,,Dim colour,Barva pozadí v menu,Abdunklungsfarbe,,Malheleca koloro,Color de la atenuación,,Himmennysväri,Couleur de l'assombrissement,Homályosítás színe,Colore offuscamento,背景色,배경색 설정,Donkere kleur,Kolor mgły,Cor da atenuação,,Culoare întunecare,Цвет затемнения,Боја пригушивања
View bob amount while moving,DSPLYMNU_MOVEBOB,,,,Pohupování pohledu při pohybu,Waffenpendeln beim Bewegen,,Vidi kvanton de kapo-balanciĝo dum movado,Cantidad de balanceo al moverse,,Aseen heilumisvoimakkuus liikkeessä,Chaloupage arme en movement,Fegyver mozgása lépés közben,Ammontare di bob di movimento,視点揺れする移動値,이동 시 화면 흔들림 강도,,Dygaj kiedy się ruszasz,Quantidade de balanço durante movimento,,Mișcare cameră în timpul deplasării,Покачивание камеры при движении,Тресење камере током кретања
View bobbing while flying,DSPLYMNU_FVIEWBOB,,,,,,,,,,,,,,,,,,,,,,
View bob amount while not moving,DSPLYMNU_STILLBOB,,,,Pohupování pohledu v klidu,Waffenpendeln bei Nichtbewegen,,Vidi kvanton de kapo-balanciĝo dum ne movado,Cantidad de balanceo al no moverse,,Aseen heilumisvoimakkuus levossa,Chaloupage arme statique,Fegyver mozgása egy helyben,Ammontare di bob di movimento da fermo,視点揺れしない移動値,정지 시 화면 움직임 강도,,Dygaj kiedy się nie ruszasz,Quantidade de balanço parado,,Mișcare cameră în timpul staționării,Покачивание камеры при бездействии,Тресење камере током неактивности
Weapon bob speed,DSPLYMNU_BOBSPEED,,,,Rychlost pohupování zbraně,Waffenpendelgeschwindigkeit,,Rapido de armilo-balanciĝo,Velocidad de balanceo de Arma,,Aseen heilumisnopeus,Vitesse du chaloupage,Fegyver mozgás sebesség,Velocità di bob dell'arma,武器揺れ速度,무기 흔들림 속도,Snelheid wapenzwaaieffect,Szybkość ruchu broni,Velocidade de balanço de arma,,Viteză mișcare arme,Скорость покачивания оружия,Брзина трсења оружја
,,Scaling,,,,,,,,,,,,,,,,,,,,,

Can't render this file because it is too large.

View File

@ -1053,6 +1053,7 @@ OptionMenu "HUDOptions" protected
Option "$HUDMNU_OLDOUCH", "st_oldouch", "OnOff"
StaticText " "
Slider "$DSPLYMNU_MOVEBOB", "movebob", 0, 1.0, 0.05, 2
Option "$DSPLYMNU_FVIEWBOB", "fviewbob", "OnOff"
Slider "$DSPLYMNU_STILLBOB", "stillbob", 0, 1.0, 0.05, 2
Slider "$DSPLYMNU_BOBSPEED", "wbobspeed", 0, 2.0, 0.1
Slider "$DSPLYMNU_BOBFIRE", "wbobfire", 0, 1.0, 0.1

View File

@ -590,7 +590,11 @@ class PlayerPawn : Actor
return;
}
if (still)
if (bFly && !GetCVar("FViewBob"))
{
bob = 0;
}
else if (still)
{
if (player.health > 0)
{
@ -638,6 +642,7 @@ class PlayerPawn : Actor
bob = 0;
}
player.viewz = pos.Z + player.viewheight + (bob * clamp(ViewBob, 0. , 1.5)); // [SP] Allow DECORATE changes to view bobbing speed.
if (Floorclip && player.playerstate != PST_DEAD
&& pos.Z <= floorz)
{
@ -2800,6 +2805,7 @@ struct PlayerInfo native play // self is what internally is known as player_t
native double GetWBobSpeed() const;
native double GetWBobFire() const;
native double GetMoveBob() const;
native bool GetFViewBob() const;
native double GetStillBob() const;
native void SetFOV(float fov);
native clearscope bool GetClassicFlight() const;