mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2025-01-31 19:50:35 +00:00
Implement r_viewmodel_fov
This commit is contained in:
parent
b6113e3224
commit
d7d1416f5a
2 changed files with 45 additions and 50 deletions
|
@ -168,7 +168,7 @@ cvar_t r_model_brightness = { "r_model_brightness", "1", qtrue}; // Toggle hi
|
|||
cvar_t r_runqmbparticles = {"r_runqmbparticles", "1", qtrue};
|
||||
|
||||
extern cvar_t cl_maxfps;
|
||||
|
||||
extern cvar_t scr_fov_viewmodel;
|
||||
|
||||
|
||||
|
||||
|
@ -2300,24 +2300,31 @@ void R_DrawAliasModel (entity_t *e)
|
|||
|
||||
R_InterpolateEntity(e,0);
|
||||
|
||||
//blubs disabled this
|
||||
/*if (r_i_model_transform.value)
|
||||
R_BlendedRotateForEntity (e, 0);
|
||||
else
|
||||
R_RotateForEntity (e, 0);
|
||||
*/
|
||||
|
||||
const ScePspFVector3 translation =
|
||||
{
|
||||
paliashdr->scale_origin[0], paliashdr->scale_origin[1], paliashdr->scale_origin[2]
|
||||
};
|
||||
sceGumTranslate(&translation);
|
||||
|
||||
const ScePspFVector3 scaling =
|
||||
{
|
||||
paliashdr->scale[0], paliashdr->scale[1], paliashdr->scale[2]
|
||||
};
|
||||
sceGumScale(&scaling);
|
||||
// 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;
|
||||
|
||||
const ScePspFVector3 translation = {
|
||||
paliashdr->scale_origin[0] * scale, paliashdr->scale_origin[1], paliashdr->scale_origin[2]
|
||||
};
|
||||
const ScePspFVector3 scaling = {
|
||||
paliashdr->scale[0] * scale, paliashdr->scale[1], paliashdr->scale[2]
|
||||
};
|
||||
|
||||
sceGumTranslate(&translation);
|
||||
sceGumScale(&scaling);
|
||||
} else {
|
||||
const ScePspFVector3 translation = {
|
||||
paliashdr->scale_origin[0], paliashdr->scale_origin[1], paliashdr->scale_origin[2]
|
||||
};
|
||||
const ScePspFVector3 scaling = {
|
||||
paliashdr->scale[0], paliashdr->scale[1], paliashdr->scale[2]
|
||||
};
|
||||
|
||||
sceGumTranslate(&translation);
|
||||
sceGumScale(&scaling);
|
||||
}
|
||||
|
||||
//============================================================================================================================= 83% at this point
|
||||
|
||||
|
|
|
@ -89,7 +89,8 @@ float scr_conlines; // lines of console to display
|
|||
|
||||
float oldscreensize, oldfov;
|
||||
cvar_t scr_coloredtext = {"scr_coloredtext","1", qtrue};
|
||||
cvar_t scr_fov = {"fov","80", qtrue}; // 10 - 170
|
||||
cvar_t scr_fov = {"fov","105", qtrue}; // motolegacy -- dquake is 15 degrees off for.. some reason. this is really 90 according to elsewhere.
|
||||
cvar_t scr_fov_viewmodel = {"r_viewmodel_fov","85"}; // motolegacy -- and this is 70.
|
||||
cvar_t scr_conspeed = {"scr_conspeed","300"};
|
||||
cvar_t scr_centertime = {"scr_centertime","2"};
|
||||
cvar_t scr_showram = {"showram","1"};
|
||||
|
@ -627,6 +628,7 @@ void SCR_Init (void)
|
|||
{
|
||||
|
||||
Cvar_RegisterVariable (&scr_fov);
|
||||
Cvar_RegisterVariable (&scr_fov_viewmodel);
|
||||
Cvar_RegisterVariable (&scr_conspeed);
|
||||
Cvar_RegisterVariable (&scr_showram);
|
||||
Cvar_RegisterVariable (&scr_showpause);
|
||||
|
@ -1411,6 +1413,7 @@ int GetWeaponZoomAmmount (void)
|
|||
}
|
||||
float zoomin_time;
|
||||
int original_fov;
|
||||
int original_view_fov;
|
||||
void SCR_UpdateScreen (void)
|
||||
{
|
||||
if (block_drawing)
|
||||
|
@ -1445,65 +1448,50 @@ void SCR_UpdateScreen (void)
|
|||
//
|
||||
if (cl.stats[STAT_ZOOM] == 1)
|
||||
{
|
||||
/*if (zoomin_time == 0 && !original_fov)
|
||||
{
|
||||
original_fov = scr_fov.value;
|
||||
zoomin_time = Sys_FloatTime () + 0.01;
|
||||
Cvar_SetValue ("fov", scr_fov.value - 2.5);
|
||||
|
||||
}
|
||||
else if (zoomin_time < Sys_FloatTime ())
|
||||
{
|
||||
int tempfloat = original_fov - GetWeaponZoomAmmount();
|
||||
if (scr_fov.value > tempfloat)
|
||||
{
|
||||
zoomin_time = Sys_FloatTime () + 0.01;
|
||||
Cvar_SetValue ("fov", scr_fov.value - 2.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvar_SetValue ("fov", tempfloat);
|
||||
zoomin_time = 0;
|
||||
}
|
||||
}*/
|
||||
if(!original_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)
|
||||
if (!original_fov) {
|
||||
original_fov = scr_fov.value;
|
||||
//original_fov = scr_fov.value;
|
||||
original_view_fov = scr_fov_viewmodel.value;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
/*zoomin_time = Sys_FloatTime () + 0.01;
|
||||
Cvar_SetValue ("fov", scr_fov.value + 2.5);
|
||||
if (scr_fov.value == original_fov)
|
||||
{
|
||||
zoomin_time = 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue