mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-15 09:11:59 +00:00
SUCCESS
This commit is contained in:
parent
d2425329ca
commit
80f62a057d
7 changed files with 88 additions and 54 deletions
47
src/d_main.c
47
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...
|
||||
|
|
|
@ -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";
|
||||
|
|
27
src/r_draw.c
27
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -663,7 +663,10 @@ void R_ExecuteSetViewSize(void)
|
|||
viewwidth = scaledviewwidth;
|
||||
|
||||
if (splitscreen3 || splitscreen4)
|
||||
{
|
||||
viewwidth >>= 1;
|
||||
scaledviewwidth >>= 1;
|
||||
}
|
||||
|
||||
centerx = viewwidth/2;
|
||||
centery = viewheight/2;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)<<FF_TRANSSHIFT);
|
||||
|
||||
for (y = yoffset; y < yoffset+height; y++)
|
||||
for (y = yoffset; y < yoffset+viewheight; y++)
|
||||
{
|
||||
sine = (FINESINE(disStart)*5)>>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)<<FF_TRANSSHIFT);
|
||||
|
||||
for (y = yoffset; y < yoffset+height; y++)
|
||||
for (y = yoffset; y < yoffset+viewheight; y++)
|
||||
{
|
||||
for (x = 0; x < vid.width; x++)
|
||||
{
|
||||
|
@ -2071,7 +2074,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_flip) // Flip the screen upside-down
|
||||
{
|
||||
|
@ -2079,11 +2082,11 @@ Unoptimized version
|
|||
UINT8 *srcscr = screens[0];
|
||||
INT32 y, y2;
|
||||
|
||||
for (y = yoffset, y2 = yoffset+height - 1; y < yoffset+height; y++, y2--)
|
||||
for (y = yoffset, y2 = yoffset+viewheight - 1; y < yoffset+viewheight; y++, y2--)
|
||||
M_Memcpy(&tmpscr[y2*vid.width], &srcscr[y*vid.width], vid.width);
|
||||
|
||||
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_heat) // Heat wave
|
||||
{
|
||||
|
@ -2092,24 +2095,24 @@ Unoptimized version
|
|||
INT32 y;
|
||||
|
||||
// Make sure table is built
|
||||
if (heatshifter == NULL || lastheight != height)
|
||||
if (heatshifter == NULL || lastheight != viewheight)
|
||||
{
|
||||
if (heatshifter)
|
||||
Z_Free(heatshifter);
|
||||
|
||||
heatshifter = Z_Calloc(height * sizeof(boolean), PU_STATIC, NULL);
|
||||
heatshifter = Z_Calloc(viewheight * sizeof(boolean), PU_STATIC, NULL);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
for (y = 0; y < viewheight; y++)
|
||||
{
|
||||
if (M_RandomChance(FRACUNIT/8)) // 12.5%
|
||||
heatshifter[y] = true;
|
||||
}
|
||||
|
||||
heatindex[0] = heatindex[1] = 0;
|
||||
lastheight = height;
|
||||
lastheight = viewheight;
|
||||
}
|
||||
|
||||
for (y = yoffset; y < yoffset+height; y++)
|
||||
for (y = yoffset; y < yoffset+viewheight; y++)
|
||||
{
|
||||
if (heatshifter[heatindex[view]++])
|
||||
{
|
||||
|
@ -2120,14 +2123,14 @@ Unoptimized version
|
|||
else
|
||||
M_Memcpy(&tmpscr[y*vid.width], &srcscr[y*vid.width], vid.width);
|
||||
|
||||
heatindex[view] %= height;
|
||||
heatindex[view] %= viewheight;
|
||||
}
|
||||
|
||||
heatindex[view]++;
|
||||
heatindex[view] %= vid.height;
|
||||
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue