mirror of
https://github.com/nzp-team/quakespasm.git
synced 2024-11-10 06:32:03 +00:00
Ported viewmodel FOV seperation from 3ds
it is what it is
This commit is contained in:
parent
7364508152
commit
11d5544577
4 changed files with 33 additions and 3 deletions
Binary file not shown.
|
@ -95,6 +95,7 @@ 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};
|
||||
|
@ -693,6 +694,7 @@ void SCR_Init (void)
|
|||
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);
|
||||
|
@ -1650,6 +1652,7 @@ int GetWeaponZoomAmmount (void)
|
|||
}
|
||||
float zoomin_time;
|
||||
int original_fov;
|
||||
int original_view_fov;
|
||||
|
||||
void SCR_UpdateScreen (void)
|
||||
{
|
||||
|
@ -1675,25 +1678,32 @@ 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
|
||||
|
@ -1703,7 +1713,9 @@ void SCR_UpdateScreen (void)
|
|||
else
|
||||
{
|
||||
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)
|
||||
|
@ -1711,11 +1723,14 @@ void SCR_UpdateScreen (void)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
glTranslatef (paliashdr->scale_origin[0], paliashdr->scale_origin[1], paliashdr->scale_origin[2]);
|
||||
glScalef (paliashdr->scale[0], paliashdr->scale[1], paliashdr->scale[2]);
|
||||
|
||||
//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
|
||||
|
|
Loading…
Reference in a new issue