mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'fov-gamestate' into 'master'
Force FOV to 90 during Podium and Title Screen Closes #1214 See merge request KartKrew/Kart!2171
This commit is contained in:
commit
6791bc301e
6 changed files with 38 additions and 7 deletions
|
|
@ -77,7 +77,7 @@
|
|||
#include "../r_state.h"
|
||||
#include "../tables.h"
|
||||
#include "r_opengl/r_opengl.h"
|
||||
#include "../r_main.h" // for cv_fov
|
||||
#include "../r_main.h" // for R_FOV
|
||||
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
static GLdouble viewMatrix[16];
|
||||
|
|
@ -331,7 +331,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
|||
|
||||
// NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
|
||||
|
||||
float render_fov = FIXED_TO_FLOAT(cv_fov[viewssnum].value);
|
||||
float render_fov = FIXED_TO_FLOAT(R_FOV(viewssnum));
|
||||
float render_fovratio = (float)BASEVIDWIDTH / (float)BASEVIDHEIGHT; // SRB2CBTODO: NEWCLIPTODO: Is this right?
|
||||
float render_multiplier = 64.0f / render_fovratio / RMUL;
|
||||
|
||||
|
|
|
|||
|
|
@ -5450,7 +5450,7 @@ static void HWR_DrawSkyBackground(player_t *player)
|
|||
if (cv_glskydome.value)
|
||||
{
|
||||
FTransform dometransform;
|
||||
const float fpov = FIXED_TO_FLOAT(cv_fov[viewssnum].value+player->fovadd);
|
||||
const float fpov = FIXED_TO_FLOAT(R_FOV(viewssnum)+player->fovadd);
|
||||
postimg_t *type = &postimgtype[R_GetViewNumber()];
|
||||
|
||||
memset(&dometransform, 0x00, sizeof(FTransform));
|
||||
|
|
@ -5700,7 +5700,7 @@ static void HWR_SetShaderState(void)
|
|||
|
||||
static void HWR_RenderViewpoint(player_t *player, boolean drawSkyTexture, boolean timing)
|
||||
{
|
||||
const float fpov = FIXED_TO_FLOAT(cv_fov[viewssnum].value+player->fovadd);
|
||||
const float fpov = FIXED_TO_FLOAT(R_FOV(viewssnum)+player->fovadd);
|
||||
postimg_t *type = &postimgtype[viewssnum];
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1134,7 +1134,7 @@ void K_ObjectTracking(trackingResult_t *result, const vector3_t *point, boolean
|
|||
screenHalfH = (screenHeight >> 1) << FRACBITS;
|
||||
|
||||
// Calculate FOV adjustments.
|
||||
fovDiff = cv_fov[cameraNum].value - baseFov;
|
||||
fovDiff = R_FOV(cameraNum) - baseFov;
|
||||
fov = ((baseFov - fovDiff) / 2) - (stplyr->fovadd / 2);
|
||||
fovTangent = NEWTAN(FixedAngle(fov));
|
||||
|
||||
|
|
|
|||
|
|
@ -8825,6 +8825,9 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||
{
|
||||
G_PreLevelTitleCard();
|
||||
}
|
||||
|
||||
// Apply FOV override.
|
||||
R_CheckFOV();
|
||||
}
|
||||
|
||||
TracyCZoneEnd(__zone);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ fixed_t centerxfrac, centeryfrac;
|
|||
fixed_t projection[MAXSPLITSCREENPLAYERS];
|
||||
fixed_t projectiony[MAXSPLITSCREENPLAYERS]; // aspect ratio
|
||||
fixed_t fovtan[MAXSPLITSCREENPLAYERS]; // field of view
|
||||
fixed_t g_fovcache[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
// just for profiling purposes
|
||||
size_t framecount;
|
||||
|
|
@ -188,7 +189,7 @@ void SplitScreen_OnChange(void)
|
|||
extern "C" void Fov_OnChange(void);
|
||||
void Fov_OnChange(void)
|
||||
{
|
||||
R_SetViewSize();
|
||||
R_CheckFOV();
|
||||
}
|
||||
|
||||
extern "C" void ChaseCam_OnChange(void);
|
||||
|
|
@ -955,6 +956,18 @@ void R_SetViewSize(void)
|
|||
setsizeneeded = true;
|
||||
}
|
||||
|
||||
void R_CheckFOV(void)
|
||||
{
|
||||
for (UINT8 s = 0; s <= r_splitscreen; ++s)
|
||||
{
|
||||
if (g_fovcache[s] != R_FOV(s))
|
||||
{
|
||||
R_SetViewSize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// R_ExecuteSetViewSize
|
||||
//
|
||||
|
|
@ -997,7 +1010,8 @@ void R_ExecuteSetViewSize(void)
|
|||
|
||||
for (s = 0; s <= r_splitscreen; ++s)
|
||||
{
|
||||
fov = FixedAngle(cv_fov[s].value/2) + ANGLE_90;
|
||||
g_fovcache[s] = R_FOV(s);
|
||||
fov = FixedAngle(g_fovcache[s]/2) + ANGLE_90;
|
||||
fovtan[s] = FixedMul(FINETANGENT(fov >> ANGLETOFINESHIFT), viewmorph[s].zoomneeded);
|
||||
if (r_splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
|
||||
fovtan[s] = 17*fovtan[s]/10;
|
||||
|
|
@ -1071,6 +1085,16 @@ void R_ExecuteSetViewSize(void)
|
|||
am_recalc = true;
|
||||
}
|
||||
|
||||
fixed_t R_FOV(int split)
|
||||
{
|
||||
if (gamestate == GS_TITLESCREEN || gamestate == GS_CEREMONY)
|
||||
{
|
||||
return 90*FRACUNIT; // standard setting
|
||||
}
|
||||
|
||||
return cv_fov[split].value;
|
||||
}
|
||||
|
||||
//
|
||||
// R_Init
|
||||
//
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ extern fixed_t centeryfrac;
|
|||
extern fixed_t projection[MAXSPLITSCREENPLAYERS];
|
||||
extern fixed_t projectiony[MAXSPLITSCREENPLAYERS];
|
||||
extern fixed_t fovtan[MAXSPLITSCREENPLAYERS];
|
||||
extern fixed_t g_fovcache[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern size_t validcount, linecount, loopcount, framecount;
|
||||
|
||||
|
|
@ -178,6 +179,9 @@ void R_SetViewSize(void);
|
|||
// do it (sometimes explicitly called)
|
||||
void R_ExecuteSetViewSize(void);
|
||||
|
||||
fixed_t R_FOV(int split);
|
||||
void R_CheckFOV(void);
|
||||
|
||||
void R_SetupFrame(int split);
|
||||
void R_SkyboxFrame(int split);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue