mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 12:01:47 +00:00
Fix opengl splitscreen
This commit is contained in:
parent
96a5eadc84
commit
2ae394b8e3
2 changed files with 38 additions and 31 deletions
|
|
@ -107,8 +107,10 @@ static angle_t gl_xtoviewangle[MAXVIDWIDTH+1];
|
||||||
|
|
||||||
// base values set at SetViewSize
|
// base values set at SetViewSize
|
||||||
static float gl_basecentery;
|
static float gl_basecentery;
|
||||||
|
static float gl_basecenterx;
|
||||||
|
|
||||||
float gl_baseviewwindowy, gl_basewindowcentery;
|
float gl_baseviewwindowy, gl_basewindowcentery;
|
||||||
|
float gl_baseviewwindowx, gl_basewindowcenterx;
|
||||||
float gl_viewwidth, gl_viewheight; // viewport clipping boundaries (screen coords)
|
float gl_viewwidth, gl_viewheight; // viewport clipping boundaries (screen coords)
|
||||||
float gl_viewwindowx;
|
float gl_viewwindowx;
|
||||||
|
|
||||||
|
|
@ -5597,21 +5599,14 @@ void HWR_SetViewSize(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_centerx = gl_viewwidth / 2;
|
gl_basecenterx = gl_viewwidth / 2;
|
||||||
gl_basecentery = gl_viewheight / 2; //note: this is (gl_centerx * gl_viewheight / gl_viewwidth)
|
gl_basecentery = gl_viewheight / 2;
|
||||||
|
|
||||||
gl_viewwindowx = (vid.width - gl_viewwidth) / 2;
|
gl_baseviewwindowx = 0;
|
||||||
gl_windowcenterx = (float)(vid.width / 2);
|
gl_basewindowcenterx = gl_viewwidth / 2;
|
||||||
if (fabsf(gl_viewwidth - vid.width) < 1.0E-36f)
|
|
||||||
{
|
gl_baseviewwindowy = 0;
|
||||||
gl_baseviewwindowy = 0;
|
gl_basewindowcentery = gl_viewheight / 2;
|
||||||
gl_basewindowcentery = gl_viewheight / 2; // window top left corner at 0,0
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gl_baseviewwindowy = (vid.height-gl_viewheight) / 2;
|
|
||||||
gl_basewindowcentery = (float)(vid.height / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_pspritexscale = gl_viewwidth / BASEVIDWIDTH;
|
gl_pspritexscale = gl_viewwidth / BASEVIDWIDTH;
|
||||||
gl_pspriteyscale = ((vid.height*gl_pspritexscale*BASEVIDWIDTH)/BASEVIDHEIGHT)/vid.width;
|
gl_pspriteyscale = ((vid.height*gl_pspritexscale*BASEVIDWIDTH)/BASEVIDHEIGHT)/vid.width;
|
||||||
|
|
@ -5619,6 +5614,32 @@ void HWR_SetViewSize(void)
|
||||||
HWD.pfnFlushScreenTextures();
|
HWD.pfnFlushScreenTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------+
|
||||||
|
// HWR_ShiftViewPort : offset viewport according to current split
|
||||||
|
// -------------------+
|
||||||
|
static void HWR_ShiftViewPort(void)
|
||||||
|
{
|
||||||
|
gl_centerx = gl_basecenterx;
|
||||||
|
gl_viewwindowx = gl_baseviewwindowx;
|
||||||
|
gl_windowcenterx = gl_basewindowcenterx;
|
||||||
|
|
||||||
|
gl_centery = gl_basecentery;
|
||||||
|
gl_viewwindowy = gl_baseviewwindowy;
|
||||||
|
gl_windowcentery = gl_basewindowcentery;
|
||||||
|
|
||||||
|
if (viewssnum > ( r_splitscreen > 1 ))
|
||||||
|
{
|
||||||
|
gl_viewwindowy += gl_viewheight;
|
||||||
|
gl_windowcentery += gl_viewheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_splitscreen > 1 && viewssnum & 1)
|
||||||
|
{
|
||||||
|
gl_viewwindowx += gl_viewwidth;
|
||||||
|
gl_windowcenterx += gl_viewwidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set view aiming, for the sky dome, the skybox,
|
// Set view aiming, for the sky dome, the skybox,
|
||||||
// and the normal view, all with a single function.
|
// and the normal view, all with a single function.
|
||||||
static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean skybox)
|
static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean skybox)
|
||||||
|
|
@ -5670,14 +5691,7 @@ void HWR_RenderSkyboxView(player_t *player)
|
||||||
dup_viewangle = viewangle;
|
dup_viewangle = viewangle;
|
||||||
|
|
||||||
// set window position
|
// set window position
|
||||||
gl_centery = gl_basecentery;
|
HWR_ShiftViewPort();
|
||||||
gl_viewwindowy = gl_baseviewwindowy;
|
|
||||||
gl_windowcentery = gl_basewindowcentery;
|
|
||||||
if (viewssnum == 1)
|
|
||||||
{
|
|
||||||
gl_viewwindowy += (vid.height/2);
|
|
||||||
gl_windowcentery += (vid.height/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for new console commands.
|
// check for new console commands.
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
@ -5878,14 +5892,7 @@ void HWR_RenderPlayerView(void)
|
||||||
dup_viewangle = viewangle;
|
dup_viewangle = viewangle;
|
||||||
|
|
||||||
// set window position
|
// set window position
|
||||||
gl_centery = gl_basecentery;
|
HWR_ShiftViewPort();
|
||||||
gl_viewwindowy = gl_baseviewwindowy;
|
|
||||||
gl_windowcentery = gl_basewindowcentery;
|
|
||||||
if (viewssnum == 1)
|
|
||||||
{
|
|
||||||
gl_viewwindowy += (vid.height/2);
|
|
||||||
gl_windowcentery += (vid.height/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for new console commands.
|
// check for new console commands.
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
|
||||||
|
|
@ -2848,7 +2848,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||||
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
|
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
|
||||||
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
|
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
|
||||||
|
|
||||||
special_splitscreen = stransform->splitscreen;
|
special_splitscreen = (stransform->splitscreen == 1);
|
||||||
shearing = stransform->shearing;
|
shearing = stransform->shearing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue