# HG changeset patch # User auratoostronk # Date 1643462498 28800 # Sat Jan 29 05:21:38 2022 -0800 # Node ID 10154395276298cdd6f90d680df2d99a58a534cd # Parent 4178904d769879e6c2919fb647ee6dd2736399e9 Changed FOV command to CVAR; added FOV slider in menu; FOV does not reset on respawn. diff -r 4178904d7698 -r 101543952762 src/c_cmds.cpp --- a/src/c_cmds.cpp Sat Dec 11 16:35:55 2021 -0500 +++ b/src/c_cmds.cpp Sat Jan 29 05:21:38 2022 -0800 @@ -1055,36 +1055,19 @@ chdir (curdir); } -CCMD (fov) +//Aura [NS] Changed from CCMD to CUSTOM_CVAR +CUSTOM_CVAR (Int, fov, 90, CVAR_ARCHIVE | CVAR_NOINITCALL) { - player_t *player = who ? who->player : &players[consoleplayer]; - - if (argv.argc() != 2) + player_t *player = &players[consoleplayer]; + if (player != nullptr && player->mo != nullptr) { - Printf ("fov is %g\n", player->DesiredFOV); - return; - } - else if (dmflags & DF_NO_FOV) - { - if (consoleplayer == Net_Arbitrator) + if (dmflags & DF_NO_FOV) { - Net_WriteByte (DEM_FOV); - } - else - { - Printf ("A setting controller has disabled FOV changes.\n"); + player->DesiredFOV = player->FOV = 90; return; } + player->DesiredFOV = player->FOV = fov; } - else - { - // Just do this here in client games. - if ( NETWORK_GetState( ) == NETSTATE_CLIENT ) - player->DesiredFOV = static_cast ( clamp (atoi (argv[1]), 5, 179) ); - - Net_WriteByte (DEM_MYFOV); - } - Net_WriteByte (clamp (atoi (argv[1]), 5, 179)); } //========================================================================== diff -r 4178904d7698 -r 101543952762 src/cl_demo.cpp --- a/src/cl_demo.cpp Sat Dec 11 16:35:55 2021 -0500 +++ b/src/cl_demo.cpp Sat Jan 29 05:21:38 2022 -0800 @@ -147,6 +147,9 @@ static unsigned int g_TicsPlayedBack = 0; +// [Aura (NS)] +EXTERN_CVAR(Int, fov) + // [Dusk] Should we perform demo authentication? CUSTOM_CVAR( Bool, demo_pure, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG ) { @@ -1070,7 +1073,17 @@ p->mo->angle = pCamera->angle; p->mo->flags |= (MF_NOGRAVITY); p->mo->player = p; - p->DesiredFOV = p->FOV = 90.f; + // [Aura (NS)] + if (dmflags & DF_NO_FOV) + { + //Printf("A setting controller has disabled FOV changes.\n"); + p->DesiredFOV = p->FOV = 90; + } + else + { + p->DesiredFOV = p->FOV = fov; + } + p->crouchfactor = FRACUNIT; PLAYER_SetDefaultSpectatorValues ( p ); players[consoleplayer].camera = g_demoCameraPlayer.mo; diff -r 4178904d7698 -r 101543952762 src/cl_main.cpp --- a/src/cl_main.cpp Sat Dec 11 16:35:55 2021 -0500 +++ b/src/cl_main.cpp Sat Jan 29 05:21:38 2022 -0800 @@ -152,6 +152,8 @@ EXTERN_CVAR( Int, cl_ticsperupdate ) EXTERN_CVAR( String, name ) EXTERN_CVAR( Bool, cl_telespy ) +// [Aura (NS)] +EXTERN_CVAR(Int, fov); //***************************************************************************** // CONSOLE COMMANDS/VARIABLES @@ -3624,7 +3626,16 @@ pActor->sprite = skins[lSkin].sprite; } - pPlayer->DesiredFOV = pPlayer->FOV = 90.f; + // [Aura (NS)] + if (dmflags & DF_NO_FOV) + { + pPlayer->DesiredFOV = pPlayer->FOV = 90; + } + else + { + pPlayer->DesiredFOV = pPlayer->FOV = fov; + } + // If the console player was watching another player in demo mode, continue to follow // that other player. if ( pCameraActor ) diff -r 4178904d7698 -r 101543952762 src/d_main.cpp --- a/src/d_main.cpp Sat Dec 11 16:35:55 2021 -0500 +++ b/src/d_main.cpp Sat Jan 29 05:21:38 2022 -0800 @@ -198,6 +198,8 @@ EXTERN_CVAR (Int, screenblocks) EXTERN_CVAR (Bool, sv_cheats) EXTERN_CVAR (Bool, sv_unlimited_pickup) +//[Aura NS] +EXTERN_CVAR(Int, fov) extern int testingmode; extern bool setmodeneeded; @@ -429,21 +431,34 @@ } } // If nofov is set, force everybody to the arbitrator's FOV. + // [Aura NS] If no fov is set, force everybody to 90 FOV instead. if ((self & DF_NO_FOV) && consoleplayer == Net_Arbitrator) { - BYTE fov; - - Net_WriteByte (DEM_FOV); - - // If the game is started with DF_NO_FOV set, the arbitrator's - // DesiredFOV will not be set when this callback is run, so - // be sure not to transmit a 0 FOV. - fov = (BYTE)players[consoleplayer].DesiredFOV; - if (fov == 0) + //[Aura NS] Reset every player's FOV to 90 + for (int i = 0; i < MAXPLAYERS; i++) { - fov = 90; + player_t* p = &players[i]; + + if (!playeringame[i]) + break; + + p->FOV = p->DesiredFOV = 90; } - Net_WriteByte (fov); + } + //[Aura NS] If nofov is not set, reset every player's FOV back. + else + { + //[Aura NS] Reset every player's FOV to their desired value + for (int i = 0; i < MAXPLAYERS; i++) + { + player_t* p = &players[i]; + + if (!playeringame[i]) + break; + + p->FOV = p->DesiredFOV = fov; + } + } // [BC] If we're the server, tell clients that the dmflags changed. diff -r 4178904d7698 -r 101543952762 src/p_mobj.cpp --- a/src/p_mobj.cpp Sat Dec 11 16:35:55 2021 -0500 +++ b/src/p_mobj.cpp Sat Jan 29 05:21:38 2022 -0800 @@ -166,6 +166,9 @@ CVAR (Int, cl_pufftype, 0, CVAR_ARCHIVE); CVAR (Int, cl_bloodtype, 0, CVAR_ARCHIVE); +// [Aura (NS)] +EXTERN_CVAR(Int, fov) + // [BB] CVAR (Bool, sv_showspawnnames, false, CVAR_DEBUGONLY) @@ -5565,7 +5568,17 @@ mobj->sprite = skins[lSkin].sprite; } - p->DesiredFOV = p->FOV = 90.f; + + // [Aura (NS)] + if (dmflags & DF_NO_FOV) + { + p->DesiredFOV = p->FOV = 90; + } + else + { + p->DesiredFOV = p->FOV = fov; + } + p->camera = p->mo; p->playerstate = PST_LIVE; p->refire = 0; diff -r 4178904d7698 -r 101543952762 wadsrc/static/menudef.z --- a/wadsrc/static/menudef.z Sat Dec 11 16:35:55 2021 -0500 +++ b/wadsrc/static/menudef.z Sat Jan 29 05:21:38 2022 -0800 @@ -223,6 +223,8 @@ Slider "Gamma correction", "Gamma", 0.75, 3.0, 0.05, 2 Slider "Brightness", "vid_brightness", -0.8,0.8, 0.05 Slider "Contrast", "vid_contrast", 0.1, 3.0, 0.1 + // [Aura (NS)] Added a slider for Field of View + Slider "Field of View", "fov", 60.0, 120.0, 1.0 Option "Vertical Sync", "vid_vsync", "OnOff" // [TP]