Merge pull request #1 from ScatterBox/main

sB's request
This commit is contained in:
Ian 2022-12-20 16:49:59 -05:00 committed by GitHub
commit c00c821ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 67 additions and 9 deletions

Binary file not shown.

View File

@ -267,6 +267,9 @@ CL_AdjustAngles
Moves the local angle positions
================
*/
extern float client_sprinting; //sB fix a bugggggggg and SQUASH
void CL_AdjustAngles (void)
{
float speed;
@ -314,7 +317,7 @@ void CL_AdjustAngles (void)
// vita gyro support by rinnegatamante (originally from vitaquake)
// creds to the switch-examples for nx support
if (motioncam.value) {
if (gyromode.value && cl.stats[STAT_ZOOM] == 0)
if (gyromode.value && cl.stats[STAT_ZOOM] == 0 || client_sprinting == 1) //sB fix gyro activating while sprinting.
return;
#ifdef VITA

View File

@ -94,6 +94,8 @@ cvar_t scr_clock = {"scr_clock", "0", CVAR_NONE};
cvar_t scr_viewsize = {"viewsize","100", CVAR_ARCHIVE};
cvar_t scr_fov = {"fov","70",CVAR_NONE}; // 10 - 170
cvar_t scr_fov_adapt = {"fov_adapt","1",CVAR_ARCHIVE};
cvar_t scr_dynamic_fov = {"scr_dynamic_fov","1",CVAR_ARCHIVE}; //sB add dynamic FOV toggle
cvar_t scr_fov_viewmodel = {"r_viewmodel_fov","70"};
cvar_t scr_conspeed = {"scr_conspeed","500",CVAR_ARCHIVE};
cvar_t scr_centertime = {"scr_centertime","2",CVAR_NONE};
cvar_t scr_showram = {"showram","1",CVAR_NONE};
@ -691,6 +693,8 @@ void SCR_Init (void)
Cvar_SetCallback (&scr_viewsize, SCR_Callback_refdef);
Cvar_RegisterVariable (&scr_fov);
Cvar_RegisterVariable (&scr_fov_adapt);
Cvar_RegisterVariable (&scr_dynamic_fov); //sB add dynamic FOV toggle
Cvar_RegisterVariable (&scr_fov_viewmodel); //sB porting seperate viewmodel FOV
Cvar_RegisterVariable (&scr_viewsize);
Cvar_RegisterVariable (&scr_conspeed);
Cvar_RegisterVariable (&scr_showram);
@ -1648,6 +1652,7 @@ int GetWeaponZoomAmmount (void)
}
float zoomin_time;
int original_fov;
int original_view_fov;
void SCR_UpdateScreen (void)
{
@ -1673,39 +1678,60 @@ void SCR_UpdateScreen (void)
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
if (cl.stats[STAT_ZOOM] == 1)
if (cl.stats[STAT_ZOOM] == 1) //sB was here porting seperate viewmodel fov
{
if(!original_fov)
{
original_fov = scr_fov.value;
original_view_fov = scr_fov_viewmodel.value;
}
if(scr_fov.value > (GetWeaponZoomAmmount() + 1))//+1 for accounting for floating point inaccurraces
{
scr_fov.value += ((original_fov - GetWeaponZoomAmmount()) - scr_fov.value) * 0.25;
scr_fov_viewmodel.value += ((original_view_fov - GetWeaponZoomAmmount()) - scr_fov_viewmodel.value) * 0.25;
Cvar_SetValue("fov",scr_fov.value);
Cvar_SetValue("r_viewmodel_fov", scr_fov_viewmodel.value);
}
}
else if (cl.stats[STAT_ZOOM] == 2)
{
Cvar_SetValue ("fov", 30);
Cvar_SetValue ("r_viewmodel_fov", 30);
zoomin_time = 0;
}
else if (cl.stats[STAT_ZOOM] == 3)
{
if(!original_fov)
original_fov = scr_fov.value;
original_view_fov = scr_fov_viewmodel.value;
//original_fov = scr_fov.value;
if(scr_dynamic_fov.value == 0) //sB add dynamic FOV toggle
{
original_fov = 0;
original_view_fov = 0;
}
else if(scr_dynamic_fov.value == 1)
{
scr_fov.value += (original_fov - 10 - scr_fov.value) * 0.3;
//scr_fov_viewmodel.value += (original_view_fov - 10 - scr_fov_viewmodel.value) * 0.3;
Cvar_SetValue("fov",scr_fov.value);
//Cvar_SetValue("r_viewmodel_fov", scr_fov_viewmodel.value);
}
}
else if (cl.stats[STAT_ZOOM] == 0 && original_fov != 0)
{
if(scr_fov.value < (original_fov + 1))//+1 for accounting for floating point inaccuracies
{
scr_fov.value += (original_fov - scr_fov.value) * 0.25;
scr_fov_viewmodel.value += (original_view_fov - scr_fov_viewmodel.value) * 0.25;
Cvar_SetValue("fov",scr_fov.value);
Cvar_SetValue("r_viewmodel_fov", scr_fov_viewmodel.value);
}
else
{
original_fov = 0;
original_view_fov = 0;
}
}

View File

@ -58,6 +58,7 @@ static inline int IS_NAN (float x) {
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
#define VectorClear(a) ((a)[0] = (a)[1] = (a)[2] = 0)
#define VectorNegate(a, b) ((b)[0] = -(a)[0], (b)[1] = -(a)[1], (b)[2] = -(a)[2])
#define DEG2RAD( a ) ( a * M_PI ) / 180.0F //sB porting seperate viewmodel fov
//johnfitz -- courtesy of lordhavoc
// QuakeSpasm: To avoid strict aliasing violations, use a float/int union instead of type punning.

View File

@ -51,6 +51,7 @@ extern cvar_t in_aimassist;
extern cvar_t joy_invert;
extern cvar_t crosshair;
extern cvar_t scr_showfps;
extern cvar_t scr_dynamic_fov;
extern cvar_t host_maxfps;
extern cvar_t r_fullbright;
extern cvar_t gl_texturemode;
@ -2143,8 +2144,19 @@ void M_Graphics_Settings_Draw (void)
else
Draw_ColoredStringScale(300, y + 160, "Enabled", 1, 1, 1, 1, 1.5f);
// Back
// Toggle Dynamic FOV
if (gsettings_cursor == 8)
Draw_ColoredStringScale(10, y + 175, "Dynamic FOV", 1, 0, 0, 1, 1.5f);
else
Draw_ColoredStringScale(10, y + 175, "Dynamic FOV", 1, 1, 1, 1, 1.5f);
if (scr_dynamic_fov.value == 0)
Draw_ColoredStringScale(300, y + 175, "Disabled", 1, 1, 1, 1, 1.5f);
else
Draw_ColoredStringScale(300, y + 175, "Enabled", 1, 1, 1, 1, 1.5f);
// Back
if (gsettings_cursor == 9)
Draw_ColoredStringScale(10, y + 335, "Back", 1, 0, 0, 1, 1.5f);
else
Draw_ColoredStringScale(10, y + 335, "Back", 1, 1, 1, 1, 1.5f);
@ -2157,6 +2169,7 @@ void M_Graphics_Settings_Draw (void)
case 3: Draw_ColoredStringScale(10, y + 305, "Increase or Decrease Game Brightness.", 1, 1, 1, 1, 1.5f); break;
case 6: Draw_ColoredStringScale(10, y + 305, "Toggle all non-realtime lights.", 1, 1, 1, 1, 1.5f); break;
case 7: Draw_ColoredStringScale(10, y + 305, "Toggle texture filtering.", 1, 1, 1, 1, 1.5f); break;
case 8: Draw_ColoredStringScale(10, y + 305, "Toggle Dynamic FOV.", 1, 1, 1, 1, 1.5f); break;
default: break;
}
}
@ -2170,7 +2183,8 @@ void M_Graphics_Settings_Key (int key)
case 0: Cvar_SetValue("scr_showfps", scr_showfps.value ? 0 : 1); break;
case 6: Cvar_SetValue("r_fullbright", r_fullbright.value ? 0 : 1); break;
case 7: Cvar_Set("gl_texturemode", strcmp(gl_texturemode.string, "GL_LINEAR") ? "GL_LINEAR" : "GL_NEAREST_MIPMAP_LINEAR" ); break;
case 8: M_Menu_Options_f (); break;
case 8: Cvar_SetValue("scr_dynamic_fov", scr_dynamic_fov.value ? 0 : 1); break;
case 9: M_Menu_Options_f (); break;
default: break;
}
break;

View File

@ -25,6 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
extern cvar_t r_drawflat, gl_overbright_models, gl_fullbrights, r_lerpmodels, r_lerpmove; //johnfitz
extern cvar_t scr_fov_viewmodel; //sB porting seperate viewmodel FOV
extern cvar_t scr_fov;
#include "mathlib.h"
//up to 16 color translated skins
gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz -- changed to an array of pointers
@ -876,6 +880,7 @@ void R_DrawTransparentAliasModel (entity_t *e)
//
glPushMatrix ();
R_RotateForEntity (lerpdata.origin, lerpdata.angles);
glTranslatef (paliashdr->scale_origin[0], paliashdr->scale_origin[1], paliashdr->scale_origin[2]);
glScalef (paliashdr->scale[0], paliashdr->scale[1], paliashdr->scale[2]);
@ -962,8 +967,17 @@ void R_DrawAliasModel (entity_t *e)
//
glPushMatrix ();
R_RotateForEntity (lerpdata.origin, lerpdata.angles);
//sB porting viewmodel FOV from 3ds build
// Special handling of view model to keep FOV from altering look. Pretty good. Not perfect but rather close.
if (e == &cl.viewent && scr_fov_viewmodel.value) {
float scale = 1.0f / tan (DEG2RAD (scr_fov.value / 2.0f)) * scr_fov_viewmodel.value / 90.0f;
glTranslatef (paliashdr->scale_origin[0] * scale, paliashdr->scale_origin[1], paliashdr->scale_origin[2]);
glScalef (paliashdr->scale[0] * scale, paliashdr->scale[1], paliashdr->scale[2]);
} else {
glTranslatef (paliashdr->scale_origin[0], paliashdr->scale_origin[1], paliashdr->scale_origin[2]);
glScalef (paliashdr->scale[0], paliashdr->scale[1], paliashdr->scale[2]);
}
//
// random stuff

View File

@ -233,11 +233,11 @@ float V_CalcBob (float speed,float which)//0 = regular, 1 = side bobbing
{
float bob = 0;
float sprint = 1;
if(cl.stats[STAT_ZOOM] == 3)
sprint = 1.8 * speed_reduce (cl.stats[STAT_ACTIVEWEAPON]);//this gets sprinting speed in comparison to walk speed per weapon
if(cl.stats[STAT_ZOOM] == 2)
return 0;
//12.048 -> 4.3 = 100 -> 36ish, so replace 100 with 36
if(which == 0)
bob = cl_bobup.value * 24 * speed * (sprint * sprint) * sin((cl.time * 12.5 * sprint));//Pitch Bobbing 10