remove vid.rowbytes
it was just vid.width lel
This commit is contained in:
1 parent
a6d6c03a58
commit
0efedae2c3
6 files changed
+48
-45
No files matched your search
+1
-1
@@ -610,7 +610,7 @@ static boolean D_Display(void)
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.rowbytes);
|
||||
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.width);
|
||||
}
|
||||
|
||||
lastdraw = false;
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
|
||||
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
||||
UINT8 * restrict dsrc;
|
||||
|
||||
const UINT8 * restrict deststop = vid.screens[0] + vid.rowbytes * vid.height;
|
||||
const UINT8 * restrict deststop = vid.screens[0] + vid.width * vid.height;
|
||||
|
||||
if (dest+8 > deststop)
|
||||
{
|
||||
|
||||
@@ -58,7 +58,6 @@ typedef struct viddef_s
|
||||
// screens[4] = fade screen end, postimage tempoarary buffer
|
||||
|
||||
UINT8 *buffer; // invisible screens buffer
|
||||
size_t rowbytes; // bytes per scanline of the VIDEO mode
|
||||
INT32 width; // PIXELS per scanline
|
||||
INT32 height;
|
||||
boolean recalc; // if true, recalc vid-based stuff
|
||||
|
||||
+20
-19
@@ -1207,7 +1207,7 @@ void I_OsPolling(void)
|
||||
if (consolevent)
|
||||
I_GetConsoleEvents();
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) == (SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER))
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK|SDL_INIT_GAMECONTROLLER) == (SDL_INIT_JOYSTICK|SDL_INIT_GAMECONTROLLER))
|
||||
{
|
||||
SDL_GameControllerUpdate();
|
||||
|
||||
@@ -1415,7 +1415,7 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale)
|
||||
if (rendermode != render_soft)
|
||||
I_Error ("I_ReadScreen: called while in non-software mode");
|
||||
else if (scale == 1)
|
||||
VID_BlitLinearScreen(vid.screens[0], scr, vid.width, vid.height, vid.rowbytes, vid.rowbytes);
|
||||
VID_BlitLinearScreen(vid.screens[0], scr, vid.width, vid.height, vid.width, vid.width);
|
||||
else
|
||||
{
|
||||
UINT8 * restrict source = vid.screens[0];
|
||||
@@ -1546,6 +1546,7 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||
// just set the desktop resolution as a fallback
|
||||
SDL_DisplayMode mode;
|
||||
SDL_GetWindowDisplayMode(window, &mode);
|
||||
|
||||
if (mode.w >= 2048)
|
||||
{
|
||||
vid.width = 1920;
|
||||
@@ -1556,6 +1557,7 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||
vid.width = mode.w;
|
||||
vid.height = mode.h;
|
||||
}
|
||||
|
||||
vid.modenum = -1;
|
||||
}
|
||||
|
||||
@@ -1594,8 +1596,11 @@ static SDL_bool Impl_CreateContext(void)
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
int flags = 0; // Use this to set SDL_RENDERER_* flags now
|
||||
|
||||
if (usesdl2soft)
|
||||
{
|
||||
flags |= SDL_RENDERER_SOFTWARE;
|
||||
}
|
||||
else if (cv_vidwait.value)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||
@@ -1650,9 +1655,9 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
||||
flags |= SDL_WINDOW_OPENGL;
|
||||
|
||||
if (msaa)
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa);
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa);
|
||||
}
|
||||
|
||||
// Without a 24-bit depth buffer many visuals are ruined by z-fighting.
|
||||
@@ -1667,8 +1672,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
||||
#endif
|
||||
|
||||
// Create a window
|
||||
window = SDL_CreateWindow("SRB2Kart "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
realwidth, realheight, flags);
|
||||
window = SDL_CreateWindow("SRB2Kart "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, realwidth, realheight, flags);
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
@@ -1694,12 +1698,10 @@ static void Impl_VideoSetupBuffer(void)
|
||||
// Set up game's software render buffer
|
||||
size_t size;
|
||||
|
||||
vid.rowbytes = vid.width;
|
||||
|
||||
if (vid.buffer)
|
||||
free(vid.buffer);
|
||||
|
||||
size = vid.rowbytes*vid.height * NUMSCREENS;
|
||||
size = vid.width*vid.height * NUMSCREENS;
|
||||
|
||||
vid.buffer = calloc(size, NUMSCREENS);
|
||||
|
||||
@@ -1709,8 +1711,7 @@ static void Impl_VideoSetupBuffer(void)
|
||||
}
|
||||
}
|
||||
|
||||
static FILE *
|
||||
OpenRendererFile (const char * mode)
|
||||
static FILE * OpenRendererFile(const char * mode)
|
||||
{
|
||||
char * path = va(pandf,srb2home,"renderer.txt");
|
||||
return fopen(path, mode);
|
||||
@@ -1727,11 +1728,11 @@ void I_StartupGraphics(void)
|
||||
if (graphics_started)
|
||||
return;
|
||||
|
||||
COM_AddCommand ("vid_nummodes", VID_Command_NumModes_f);
|
||||
COM_AddCommand ("vid_modelist", VID_Command_ModeList_f);
|
||||
COM_AddCommand ("vid_mode", VID_Command_Mode_f);
|
||||
CV_RegisterVar (&cv_vidwait);
|
||||
CV_RegisterVar (&cv_stretch);
|
||||
COM_AddCommand("vid_nummodes", VID_Command_NumModes_f);
|
||||
COM_AddCommand("vid_modelist", VID_Command_ModeList_f);
|
||||
COM_AddCommand("vid_mode", VID_Command_Mode_f);
|
||||
CV_RegisterVar(&cv_vidwait);
|
||||
CV_RegisterVar(&cv_stretch);
|
||||
disable_mouse = M_CheckParm("-nomouse");
|
||||
disable_fullscreen = M_CheckParm("-win") ? 1 : 0;
|
||||
|
||||
@@ -1830,7 +1831,6 @@ void I_StartupGraphics(void)
|
||||
if (strcasecmp(word, "a2c") == 0)
|
||||
{
|
||||
a2c = true;
|
||||
|
||||
CONS_Printf("Using a2c because it was specified to be used earlier\n");
|
||||
}
|
||||
}
|
||||
@@ -1984,7 +1984,8 @@ static void Impl_SetVsync(void)
|
||||
SDL_RenderSetVSync(renderer, cv_vidwait.value);
|
||||
#endif
|
||||
#ifdef HWRENDER
|
||||
if (!renderer && rendermode == render_opengl && sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
if (!renderer && rendermode == render_opengl &&
|
||||
sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
{
|
||||
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||
}
|
||||
|
||||
+25
-22
@@ -612,8 +612,7 @@ static void CV_constextsize_OnChange(void)
|
||||
// --------------------------------------------------------------------------
|
||||
// Copy a rectangular area from one bitmap to another (8bpp)
|
||||
// --------------------------------------------------------------------------
|
||||
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
||||
size_t destrowbytes)
|
||||
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes, size_t destrowbytes)
|
||||
{
|
||||
if (srcrowbytes == destrowbytes && srcrowbytes == (size_t)width)
|
||||
{
|
||||
@@ -790,7 +789,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
if (!desttop)
|
||||
return;
|
||||
|
||||
deststop = desttop + vid.rowbytes * vid.height;
|
||||
deststop = desttop + vid.width * vid.height;
|
||||
|
||||
if (scrn & V_NOSCALESTART)
|
||||
{
|
||||
@@ -1041,7 +1040,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
if (!desttop)
|
||||
return;
|
||||
|
||||
deststop = desttop + vid.rowbytes * vid.height;
|
||||
deststop = desttop + vid.width * vid.height;
|
||||
|
||||
if (scrn & V_NOSCALESTART)
|
||||
{
|
||||
@@ -1191,7 +1190,7 @@ void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const
|
||||
#endif
|
||||
|
||||
dest = vid.screens[scrn] + y*vid.width + x;
|
||||
deststop = vid.screens[scrn] + vid.rowbytes * vid.height;
|
||||
deststop = vid.screens[scrn] + vid.width * vid.height;
|
||||
|
||||
while (height--)
|
||||
{
|
||||
@@ -1288,7 +1287,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
h = vid.height-y;
|
||||
|
||||
dest = vid.screens[0] + y*vid.width + x;
|
||||
deststop = vid.screens[0] + vid.rowbytes * vid.height;
|
||||
deststop = vid.screens[0] + vid.width * vid.height;
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
@@ -1573,7 +1572,7 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c)
|
||||
h = w;
|
||||
|
||||
dest = vid.screens[0] + y*vid.width + x;
|
||||
deststop = vid.screens[0] + vid.rowbytes * vid.height;
|
||||
deststop = vid.screens[0] + vid.width * vid.height;
|
||||
|
||||
c &= 255;
|
||||
|
||||
@@ -1645,7 +1644,7 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
|
||||
dupx = dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
||||
|
||||
dest = vid.screens[0] + y*dupy*vid.width + x*dupx;
|
||||
deststop = vid.screens[0] + vid.rowbytes * vid.height;
|
||||
deststop = vid.screens[0] + vid.width * vid.height;
|
||||
|
||||
// from V_DrawScaledPatch
|
||||
if (vid.width != BASEVIDWIDTH * dupx)
|
||||
@@ -1767,8 +1766,10 @@ void V_DrawVhsEffect(boolean rewind)
|
||||
upbary -= renderdeltatics * (vid.dupy * (rewind ? 3 : 1.8f));
|
||||
downbary += renderdeltatics * (vid.dupy * (rewind ? 2 : 1));
|
||||
|
||||
if (upbary < -barsize*FRACUNIT) upbary = vid.height<<FRACBITS;
|
||||
if (downbary > vid.height<<FRACBITS) downbary = -barsize*FRACUNIT;
|
||||
if (upbary < -barsize*FRACUNIT)
|
||||
upbary = vid.height<<FRACBITS;
|
||||
if (downbary > vid.height<<FRACBITS)
|
||||
downbary = -barsize*FRACUNIT;
|
||||
|
||||
fixed_t uby = upbary>>FRACBITS, dby = downbary>>FRACBITS;
|
||||
|
||||
@@ -1790,18 +1791,20 @@ void V_DrawVhsEffect(boolean rewind)
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs += updistort * 2.0f * min(y-uby, uby+barsize-y) / barsize;
|
||||
}
|
||||
|
||||
if (y >= dby && y < dby+barsize)
|
||||
{
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize;
|
||||
}
|
||||
|
||||
offs += M_RandomKey(vid.dupx<<1);
|
||||
|
||||
// lazy way to avoid crashes
|
||||
if (y == 0 && offs < 0) offs = 0;
|
||||
else if (y >= vid.height-2 && offs > 0) offs = 0;
|
||||
if ((y == 0 && offs < 0) || (y >= vid.height-2 && offs > 0))
|
||||
offs = 0;
|
||||
|
||||
for (x = min(pos+vid.rowbytes*2, vid.rowbytes*vid.height); pos < x; pos++)
|
||||
for (x = min(pos+(size_t)vid.width*2, (size_t)vid.width*vid.height); pos < x; pos++)
|
||||
{
|
||||
tmp[pos] = thismapstart[buf[pos+offs]];
|
||||
#ifdef HQ_VHS
|
||||
@@ -1810,7 +1813,7 @@ void V_DrawVhsEffect(boolean rewind)
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(buf, tmp, vid.rowbytes*vid.height);
|
||||
memcpy(buf, tmp, vid.width*vid.height);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1825,11 +1828,11 @@ void V_DrawVhsEffect(boolean rewind)
|
||||
void V_DrawFadeScreen(UINT16 color, UINT8 strength)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
{
|
||||
HWR_FadeScreenMenuBack(color, strength);
|
||||
return;
|
||||
}
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWR_FadeScreenMenuBack(color, strength);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
const UINT8 *fadetable =
|
||||
@@ -1838,7 +1841,7 @@ void V_DrawFadeScreen(UINT16 color, UINT8 strength)
|
||||
: ((color & 0xFF00) // Color is not palette index?
|
||||
? ((UINT8 *)colormaps + strength*256) // Do COLORMAP fade.
|
||||
: ((UINT8 *)transtables + ((9-strength)<<FF_TRANSSHIFT) + color*256)); // Else, do TRANSMAP** fade.
|
||||
const UINT8 *deststop = vid.screens[0] + vid.rowbytes * vid.height;
|
||||
const UINT8 *deststop = vid.screens[0] + vid.width * vid.height;
|
||||
UINT8 *buf = vid.screens[0];
|
||||
|
||||
// heavily simplified -- we don't need to know x or y
|
||||
@@ -1863,7 +1866,7 @@ void V_DrawFadeConsBack(INT32 plines)
|
||||
|
||||
// heavily simplified -- we don't need to know x or y position,
|
||||
// just the stop position
|
||||
deststop = vid.screens[0] + vid.rowbytes * min(plines, vid.height);
|
||||
deststop = vid.screens[0] + vid.width * min(plines, vid.height);
|
||||
for (buf = vid.screens[0]; buf < deststop; ++buf)
|
||||
*buf = consolebgmap[*buf];
|
||||
}
|
||||
@@ -3787,7 +3790,7 @@ UINT8 GetColorLUTDirect(colorlookup_t *lut, UINT8 r, UINT8 g, UINT8 b)
|
||||
void V_Init(void)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 screensize = vid.rowbytes * vid.height;
|
||||
INT32 screensize = vid.width * vid.height;
|
||||
|
||||
for (i = 0; i < NUMSCREENS; i++)
|
||||
{
|
||||
|
||||
+1
-1
@@ -450,7 +450,7 @@ void Y_IntermissionDrawer(void)
|
||||
else
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
VID_BlitLinearScreen(vid.screens[1], vid.screens[0], vid.width, vid.height, vid.width, vid.rowbytes);
|
||||
VID_BlitLinearScreen(vid.screens[1], vid.screens[0], vid.width, vid.height, vid.width, vid.width);
|
||||
#ifdef HWRENDER
|
||||
else if (rendermode == render_opengl)
|
||||
HWR_DrawIntermissionBG();
|
||||
|
||||
Reference in new issue
Block a user