mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Avoid rendering unused left/right edges of screen while rolling
This commit is contained in:
parent
21ccefe4eb
commit
1d221a453a
2 changed files with 29 additions and 34 deletions
24
src/r_main.c
24
src/r_main.c
|
@ -561,6 +561,7 @@ static struct {
|
|||
fixed_t zoomneeded;
|
||||
INT32 *scrmap;
|
||||
INT32 scrmapsize;
|
||||
INT32 x1; // clip rendering horizontally for efficiency
|
||||
boolean use;
|
||||
} viewmorph = {
|
||||
0,
|
||||
|
@ -570,6 +571,7 @@ static struct {
|
|||
FRACUNIT,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
false
|
||||
};
|
||||
|
||||
|
@ -615,6 +617,7 @@ void R_CheckViewMorph(void)
|
|||
)
|
||||
{
|
||||
viewmorph.use = false;
|
||||
viewmorph.x1 = 0;
|
||||
if (viewmorph.zoomneeded != FRACUNIT)
|
||||
R_SetViewSize();
|
||||
viewmorph.zoomneeded = FRACUNIT;
|
||||
|
@ -682,6 +685,14 @@ void R_CheckViewMorph(void)
|
|||
x1 = -(halfwidth * rollcos - halfheight * rollsin);
|
||||
y1 = -(halfheight * rollcos + halfwidth * rollsin);
|
||||
|
||||
#ifdef WOUGHMP_WOUGHMP
|
||||
if (fisheye)
|
||||
viewmorph.x1 = (INT32)(halfwidth - (halfwidth * fabsf(rollcos) + halfheight * fabsf(rollsin)) * fisheyemap[halfwidth]);
|
||||
else
|
||||
#endif
|
||||
viewmorph.x1 = (INT32)(halfwidth - (halfwidth * fabsf(rollcos) + halfheight * fabsf(rollsin)));
|
||||
//CONS_Printf("saving %d cols\n", viewmorph.x1);
|
||||
|
||||
//CONS_Printf("Top left corner is %f %f\n", x1, y1);
|
||||
|
||||
#ifdef WOUGHMP_WOUGHMP
|
||||
|
@ -1316,7 +1327,18 @@ void R_RenderPlayerView(player_t *player)
|
|||
validcount++;
|
||||
|
||||
// Clear buffers.
|
||||
R_ClearClipSegs();
|
||||
if (viewmorph.use)
|
||||
{
|
||||
portalclipstart = viewmorph.x1;
|
||||
portalclipend = viewwidth-viewmorph.x1-1;
|
||||
R_PortalClearClipSegs(portalclipstart, portalclipend);
|
||||
}
|
||||
else
|
||||
{
|
||||
portalclipstart = 0;
|
||||
portalclipend = viewwidth-1;
|
||||
R_ClearClipSegs();
|
||||
}
|
||||
R_ClearDrawSegs();
|
||||
R_ClearPlanes();
|
||||
R_ClearSprites();
|
||||
|
|
|
@ -1307,17 +1307,8 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
|||
|
||||
shadow->mobj = thing; // Easy access! Tails 06-07-2002
|
||||
|
||||
shadow->x1 = x1 < 0 ? 0 : x1;
|
||||
shadow->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||
|
||||
// PORTAL SEMI-CLIPPING
|
||||
if (portalrender)
|
||||
{
|
||||
if (shadow->x1 < portalclipstart)
|
||||
shadow->x1 = portalclipstart;
|
||||
if (shadow->x2 >= portalclipend)
|
||||
shadow->x2 = portalclipend-1;
|
||||
}
|
||||
shadow->x1 = x1 < portalclipstart ? portalclipstart : x1;
|
||||
shadow->x2 = x2 >= portalclipend ? portalclipend-1 : x2;
|
||||
|
||||
shadow->xscale = FixedMul(xscale, shadowxscale); //SoM: 4/17/2000
|
||||
shadow->scale = FixedMul(yscale, shadowyscale);
|
||||
|
@ -1815,17 +1806,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
|
||||
vis->mobj = thing; // Easy access! Tails 06-07-2002
|
||||
|
||||
vis->x1 = x1 < 0 ? 0 : x1;
|
||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||
|
||||
// PORTAL SEMI-CLIPPING
|
||||
if (portalrender)
|
||||
{
|
||||
if (vis->x1 < portalclipstart)
|
||||
vis->x1 = portalclipstart;
|
||||
if (vis->x2 >= portalclipend)
|
||||
vis->x2 = portalclipend-1;
|
||||
}
|
||||
vis->x1 = x1 < portalclipstart ? portalclipstart : x1;
|
||||
vis->x2 = x2 >= portalclipend ? portalclipend-1 : x2;
|
||||
|
||||
vis->xscale = xscale; //SoM: 4/17/2000
|
||||
vis->sector = thing->subsector->sector;
|
||||
|
@ -2034,17 +2016,8 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
vis->shear.tan = 0;
|
||||
vis->shear.offset = 0;
|
||||
|
||||
vis->x1 = x1 < 0 ? 0 : x1;
|
||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||
|
||||
// PORTAL SEMI-CLIPPING
|
||||
if (portalrender)
|
||||
{
|
||||
if (vis->x1 < portalclipstart)
|
||||
vis->x1 = portalclipstart;
|
||||
if (vis->x2 >= portalclipend)
|
||||
vis->x2 = portalclipend-1;
|
||||
}
|
||||
vis->x1 = x1 < portalclipstart ? portalclipstart : x1;
|
||||
vis->x2 = x2 >= portalclipend ? portalclipend-1 : x2;
|
||||
|
||||
vis->xscale = xscale; //SoM: 4/17/2000
|
||||
vis->sector = thing->subsector->sector;
|
||||
|
|
Loading…
Reference in a new issue