From 80f62a057d18e2e2a9fdd1c7c2e7bcf11f12f010 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 17 Dec 2017 22:27:26 -0500 Subject: [PATCH] SUCCESS --- src/d_main.c | 47 ++++++++++++++++++++++++++++------------------- src/m_misc.c | 2 +- src/r_draw.c | 27 +++++++++++++++++---------- src/r_draw.h | 2 ++ src/r_main.c | 3 +++ src/r_plane.c | 14 ++++++++++++-- src/v_video.c | 47 +++++++++++++++++++++++++---------------------- 7 files changed, 88 insertions(+), 54 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 035e4f4d3..0889765bf 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -389,6 +389,9 @@ static void D_Display(void) { if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) { + viewwindowy = 0; + viewwindowx = 0; + topleft = screens[0] + viewwindowy*vid.width + viewwindowx; objectsdrawn = 0; #ifdef HWRENDER @@ -411,8 +414,16 @@ static void D_Display(void) if (rendermode != render_none) { if (splitscreen3 || splitscreen4) - viewwindowx = vid.width / 2; - viewwindowy = vid.height / 2; + { + viewwindowx = viewwidth; + viewwindowy = 0; + } + else + { + viewwindowx = 0; + viewwindowy = viewheight; + } + M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); topleft = screens[0] + viewwindowy*vid.width + viewwindowx; @@ -430,22 +441,21 @@ static void D_Display(void) #ifdef HWRENDER if (rendermode != render_soft) HWR_RenderPlayerView(2, &players[thirddisplayplayer]); - //else + else #endif - /*if (rendermode != render_none) + if (rendermode != render_none) { - if (splitscreen3 || splitscreen4) - viewwindowx = vid.width / 2; - viewwindowy = vid.height / 2; - M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); + viewwindowx = 0; + viewwindowy = viewheight; + M_Memcpy(ylookup, ylookup3, viewheight*sizeof (ylookup[0])); topleft = screens[0] + viewwindowy*vid.width + viewwindowx; - R_RenderPlayerView(&players[secondarydisplayplayer]); + R_RenderPlayerView(&players[thirddisplayplayer]); viewwindowy = 0; M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); - }*/ + } } // render the fourth screen @@ -454,22 +464,21 @@ static void D_Display(void) #ifdef HWRENDER if (rendermode != render_soft) HWR_RenderPlayerView(3, &players[fourthdisplayplayer]); - //else + else #endif - /*if (rendermode != render_none) + if (rendermode != render_none) { - if (splitscreen3 || splitscreen4) - viewwindowx = vid.width / 2; - viewwindowy = vid.height / 2; - M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); + viewwindowx = viewwidth; + viewwindowy = viewheight; + M_Memcpy(ylookup, ylookup4, viewheight*sizeof (ylookup[0])); topleft = screens[0] + viewwindowy*vid.width + viewwindowx; - R_RenderPlayerView(&players[secondarydisplayplayer]); + R_RenderPlayerView(&players[fourthdisplayplayer]); viewwindowy = 0; M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); - }*/ + } } // Image postprocessing effect @@ -515,7 +524,7 @@ static void D_Display(void) else py = viewwindowy + 4; patch = W_CachePatchName("M_PAUSE", PU_CACHE); - V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch); + V_DrawScaledPatch(viewwindowx + (viewwidth - SHORT(patch->width))/2, py, 0, patch); } // vid size change is now finished if it was on... diff --git a/src/m_misc.c b/src/m_misc.c index 0259e04b5..74ba8b319 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -649,7 +649,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png char keytxt[SRB2PNGTXT][12] = { "Title", "Author", "Description", "Playername", "Mapnum", "Mapname", "Location", "Interface", "Revision", "Build Date", "Build Time"}; - char titletxt[] = "Sonic Robo Blast 2 " VERSIONSTRING; + char titletxt[] = "SRB2Kart " VERSIONSTRING; png_charp authortxt = I_GetUserName(); png_charp playertxt = cv_playername.zstring; char desctxt[] = "SRB2Kart Screenshot"; diff --git a/src/r_draw.c b/src/r_draw.c index ac7d263dc..491c4bce7 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -51,6 +51,14 @@ UINT8 *ylookup1[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, so the first column starts at (SCRWIDTH - VIEWWIDTH)/2 */ @@ -614,24 +622,23 @@ void R_InitViewBuffer(INT32 width, INT32 height) if (bytesperpixel < 1 || bytesperpixel > 4) I_Error("R_InitViewBuffer: wrong bytesperpixel value %d\n", bytesperpixel); - // Handle resize, e.g. smaller view windows with border and/or status bar. - viewwindowx = (vid.width - width) >> 1; + viewwindowx = 0; + viewwindowy = 0; // Column offset for those columns of the view window, but relative to the entire screen for (i = 0; i < width; i++) columnofs[i] = (viewwindowx + i) * bytesperpixel; - // Same with base row offset. - if (width == vid.width) - viewwindowy = 0; - else - viewwindowy = (vid.height - height) >> 1; - // Precalculate all row offsets. for (i = 0; i < height; i++) { - ylookup[i] = ylookup1[i] = screens[0] + (i+viewwindowy)*vid.width*bytesperpixel; - ylookup2[i] = screens[0] + (i+(vid.height>>1))*vid.width*bytesperpixel; // for splitscreen + ylookup[i] = ylookup1[i] = screens[0] + i*vid.width*bytesperpixel; + if (splitscreen) + ylookup2[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel; + else + ylookup2[i] = screens[0] + i*vid.width*bytesperpixel + (viewwidth*bytesperpixel); + ylookup3[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel; + ylookup4[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel + (viewwidth*bytesperpixel); } } diff --git a/src/r_draw.h b/src/r_draw.h index 419586c65..ae70cd8a3 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -22,6 +22,8 @@ extern UINT8 *ylookup[MAXVIDHEIGHT*4]; extern UINT8 *ylookup1[MAXVIDHEIGHT*4]; extern UINT8 *ylookup2[MAXVIDHEIGHT*4]; +extern UINT8 *ylookup3[MAXVIDHEIGHT*4]; +extern UINT8 *ylookup4[MAXVIDHEIGHT*4]; extern INT32 columnofs[MAXVIDWIDTH*4]; extern UINT8 *topleft; diff --git a/src/r_main.c b/src/r_main.c index a4840692d..3867cdfaa 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -663,7 +663,10 @@ void R_ExecuteSetViewSize(void) viewwidth = scaledviewwidth; if (splitscreen3 || splitscreen4) + { viewwidth >>= 1; + scaledviewwidth >>= 1; + } centerx = viewwidth/2; centery = viewheight/2; diff --git a/src/r_plane.c b/src/r_plane.c index b7b9eaff3..8cb0d785d 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -842,6 +842,7 @@ void R_DrawSinglePlane(visplane_t *pl) ) { INT32 top, bottom; + UINT8 *scr; itswater = true; if (spanfunc == R_DrawTranslucentSpan_8) @@ -857,8 +858,17 @@ void R_DrawSinglePlane(visplane_t *pl) if (bottom > vid.height) bottom = vid.height; - // Only copy the part of the screen we need - VID_BlitLinearScreen((splitscreen && viewplayer == &players[secondarydisplayplayer]) ? screens[0] + (top+(vid.height>>1))*vid.width : screens[0]+((top)*vid.width), screens[1]+((top)*vid.width), + if (splitscreen4 && viewplayer == &players[fourthdisplayplayer]) // Only copy the part of the screen we need + scr = (screens[0] + (top+(viewheight))*vid.width + viewwidth); + else if ((splitscreen && viewplayer == &players[secondarydisplayplayer]) + || ((splitscreen3 || splitscreen4) && viewplayer == &players[thirddisplayplayer])) + scr = (screens[0] + (top+(viewheight))*vid.width); + else if ((splitscreen3 || splitscreen4) && viewplayer == &players[secondarydisplayplayer]) + scr = (screens[0] + ((top)*vid.width) + viewwidth); + else + scr = (screens[0] + ((top)*vid.width)); + + VID_BlitLinearScreen(scr, screens[1]+((top)*vid.width), vid.width, bottom-top, vid.width, vid.width); } diff --git a/src/v_video.c b/src/v_video.c index 8dbffcd29..618f985e6 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1974,7 +1974,7 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) (void)type; (void)param; #else - INT32 height, yoffset; + INT32 yoffset; #ifdef HWRENDER // draw a hardware converted patch @@ -1982,19 +1982,22 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) return; #endif - if (view < 0 || view >= 2 || (view == 1 && !(splitscreen || splitscreen3 || splitscreen4))) + if (view < 0 || view >= 3 + || (view == 1 && !(splitscreen || splitscreen3 || splitscreen4)) + || (view == 2 && !(splitscreen3 || splitscreen4)) + || (view == 3 && !splitscreen4)) return; - if (splitscreen) - height = vid.height/2; - else - height = vid.height; - - if (view == 1) - yoffset = vid.height/2; + if ((view == 1 && splitscreen) || view >= 2) + yoffset = viewheight; else yoffset = 0; + /*if (view & 1 && !splitscreen) + xoffset = viewwidth; + else + xoffset = 0;*/ + if (type == postimg_water) { UINT8 *tmpscr = screens[4]; @@ -2005,7 +2008,7 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) INT32 sine; //UINT8 *transme = transtables + ((tr_trans50-1)<>FRACBITS; newpix = abs(sine); @@ -2051,7 +2054,7 @@ Unoptimized version } VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset, screens[0]+vid.width*vid.bpp*yoffset, - vid.width*vid.bpp, height, vid.width*vid.bpp, vid.width); + vid.width*vid.bpp, viewheight, vid.width*vid.bpp, vid.width); } else if (type == postimg_motion) // Motion Blur! { @@ -2062,7 +2065,7 @@ Unoptimized version // TODO: Add a postimg_param so that we can pick the translucency level... UINT8 *transme = transtables + ((param-1)<