player views

4p still crashes for some reason
This commit is contained in:
Wolfy 2017-12-17 00:09:32 -06:00
parent 0393e24fa6
commit 50a2dc7b4d
4 changed files with 66 additions and 3 deletions

View file

@ -401,7 +401,7 @@ static void D_Display(void)
} }
// render the second screen // render the second screen
if (splitscreen && players[secondarydisplayplayer].mo) if ((splitscreen || splitscreen3 || splitscreen4) && players[secondarydisplayplayer].mo)
{ {
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
@ -410,6 +410,9 @@ static void D_Display(void)
#endif #endif
if (rendermode != render_none) if (rendermode != render_none)
{ {
if (splitscreen3 || splitscreen4)
viewwindowx = vid.width / 2;
viewwindowy = vid.height / 2; viewwindowy = vid.height / 2;
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
@ -422,11 +425,59 @@ static void D_Display(void)
} }
} }
if ((splitscreen3 || splitscreen4) && players[thirddisplayplayer].mo)
{
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(2, &players[thirddisplayplayer]);
else
#endif
if (rendermode != render_none)
{
viewwindowx = vid.width / 2;
viewwindowy = vid.height / 2;
M_Memcpy(ylookup2, ylookup3, viewheight*sizeof (ylookup[0]));
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
R_RenderPlayerView(&players[thirddisplayplayer]);
viewwindowy = 0;
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
}
if (splitscreen4 && players[fourthdisplayplayer].mo)
{
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(3, &players[fourthdisplayplayer]);
else
#endif
if (rendermode != render_none)
{
viewwindowx = vid.width / 2;
viewwindowy = vid.height / 2;
M_Memcpy(ylookup3, ylookup4, viewheight*sizeof (ylookup[0]));
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
R_RenderPlayerView(&players[fourthdisplayplayer]);
viewwindowy = 0;
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
}
// Image postprocessing effect // Image postprocessing effect
if (postimgtype) if (postimgtype)
V_DoPostProcessor(0, postimgtype, postimgparam); V_DoPostProcessor(0, postimgtype, postimgparam);
if (postimgtype2) if (postimgtype2)
V_DoPostProcessor(1, postimgtype2, postimgparam2); V_DoPostProcessor(1, postimgtype2, postimgparam2);
if (postimgtype3)
V_DoPostProcessor(2, postimgtype3, postimgparam3);
if (postimgtype4)
V_DoPostProcessor(3, postimgtype4, postimgparam4);
} }
if (lastdraw) if (lastdraw)

View file

@ -51,6 +51,14 @@ UINT8 *ylookup1[MAXVIDHEIGHT*4];
*/ */
UINT8 *ylookup2[MAXVIDHEIGHT*4]; UINT8 *ylookup2[MAXVIDHEIGHT*4];
/** \brief pointer to the start of each line of the screen, for view3 (splitscreen)
*/
UINT8 *ylookup3[MAXVIDHEIGHT*4];
/** \brief pointer to the start of each line of the screen, for view4 (splitscreen)
*/
UINT8 *ylookup4[MAXVIDHEIGHT*4];
/** \brief x byte offset for columns inside the viewwindow, /** \brief x byte offset for columns inside the viewwindow,
so the first column starts at (SCRWIDTH - VIEWWIDTH)/2 so the first column starts at (SCRWIDTH - VIEWWIDTH)/2
*/ */
@ -632,6 +640,8 @@ void R_InitViewBuffer(INT32 width, INT32 height)
{ {
ylookup[i] = ylookup1[i] = screens[0] + (i+viewwindowy)*vid.width*bytesperpixel; ylookup[i] = ylookup1[i] = screens[0] + (i+viewwindowy)*vid.width*bytesperpixel;
ylookup2[i] = screens[0] + (i+(vid.height>>1))*vid.width*bytesperpixel; // for splitscreen ylookup2[i] = screens[0] + (i+(vid.height>>1))*vid.width*bytesperpixel; // for splitscreen
ylookup3[i] = screens[0] + (i+(vid.height>>1))*vid.width*bytesperpixel;
ylookup3[i] = screens[0] + (i+(vid.height>>1))*vid.width*bytesperpixel;
} }
} }

View file

@ -22,6 +22,8 @@
extern UINT8 *ylookup[MAXVIDHEIGHT*4]; extern UINT8 *ylookup[MAXVIDHEIGHT*4];
extern UINT8 *ylookup1[MAXVIDHEIGHT*4]; extern UINT8 *ylookup1[MAXVIDHEIGHT*4];
extern UINT8 *ylookup2[MAXVIDHEIGHT*4]; extern UINT8 *ylookup2[MAXVIDHEIGHT*4];
extern UINT8 *ylookup3[MAXVIDHEIGHT*4];
extern UINT8 *ylookup4[MAXVIDHEIGHT*4];
extern INT32 columnofs[MAXVIDWIDTH*4]; extern INT32 columnofs[MAXVIDWIDTH*4];
extern UINT8 *topleft; extern UINT8 *topleft;

View file

@ -660,11 +660,11 @@ void R_ExecuteSetViewSize(void)
if (splitscreen || splitscreen3 || splitscreen4) if (splitscreen || splitscreen3 || splitscreen4)
viewheight >>= 1; viewheight >>= 1;
viewwidth = scaledviewwidth;
if (splitscreen3 || splitscreen4) if (splitscreen3 || splitscreen4)
viewwidth >>= 1; viewwidth >>= 1;
viewwidth = scaledviewwidth;
centerx = viewwidth/2; centerx = viewwidth/2;
centery = viewheight/2; centery = viewheight/2;
centerxfrac = centerx<<FRACBITS; centerxfrac = centerx<<FRACBITS;