Merge branch 'spritestuff2-fixes' into 'next'

Some fixes for spritestuff2

See merge request STJr/SRB2!1264
This commit is contained in:
James R 2020-11-25 19:26:49 -05:00
commit 4ab667c6a0
28 changed files with 221 additions and 216 deletions

View File

@ -1682,7 +1682,7 @@ static void CON_DrawHudlines(void)
;//charwidth = 4 * con_scalefactor;
else
{
//charwidth = SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
//charwidth = (hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true);
}
}

View File

@ -507,7 +507,7 @@ static void D_Display(void)
else
py = viewwindowy + 4;
patch = W_CachePatchName("M_PAUSE", PU_PATCH);
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch);
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - patch->width)/2, py, 0, patch);
#else
INT32 y = ((automapactive) ? (32) : (BASEVIDHEIGHT/2));
M_DrawTextBox((BASEVIDWIDTH/2) - (60), y - (16), 13, 2);
@ -652,6 +652,8 @@ void D_SRB2Loop(void)
SCR_SetMode(); // change video mode
SCR_Recalc();
chosenrendermode = render_none;
// Check and print which version is executed.
// Use this as the border between setup and the main game loop being entered.
CONS_Printf(
@ -1296,19 +1298,6 @@ void D_SRB2Main(void)
// set user default mode or mode set at cmdline
SCR_CheckDefaultMode();
// Lactozilla: Check if the render mode needs to change.
if (setrenderneeded)
{
CONS_Printf(M_GetText("Switching the renderer...\n"));
// Switch the renderer in the interface
if (VID_CheckRenderer())
con_refresh = true; // Allow explicit screen refresh again
// Set cv_renderer to the new render mode
CV_StealthSetValue(&cv_renderer, rendermode);
}
wipegamestate = gamestate;
savedata.lives = 0; // flag this as not-used

View File

@ -2336,8 +2336,8 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
pat = W_CachePatchName(patchname, PU_PATCH_LOWPRIORITY);
patwidth = SHORT(pat->width);
patheight = SHORT(pat->height);
patwidth = pat->width;
patheight = pat->height;
pw = patwidth * dupz;
ph = patheight * dupz;

View File

@ -585,6 +585,21 @@ static GLMapTexture_t *gl_textures; // For all textures
static GLMapTexture_t *gl_flats; // For all (texture) flats, as normal flats don't need to be cached
boolean gl_maptexturesloaded = false;
void HWR_FreeTextureData(patch_t *patch)
{
GLPatch_t *grPatch;
if (!patch || !patch->hardware)
return;
grPatch = patch->hardware;
if (vid.glstate == VID_GL_LIBRARY_LOADED)
HWD.pfnDeleteTexture(grPatch->mipmap);
if (grPatch->mipmap->data)
Z_Free(grPatch->mipmap->data);
}
void HWR_FreeTexture(patch_t *patch)
{
if (!patch)
@ -598,10 +613,7 @@ void HWR_FreeTexture(patch_t *patch)
if (grPatch->mipmap)
{
if (vid.glstate == VID_GL_LIBRARY_LOADED)
HWD.pfnDeleteTexture(grPatch->mipmap);
if (grPatch->mipmap->data)
Z_Free(grPatch->mipmap->data);
HWR_FreeTextureData(patch);
Z_Free(grPatch->mipmap);
}
@ -636,7 +648,7 @@ void HWR_FreeTextureColormaps(patch_t *patch)
if (!pat->mipmap)
break;
// No colormap mipmap either.
// No colormap mipmaps either.
if (!pat->mipmap->nextcolormap)
break;
@ -667,18 +679,13 @@ static void HWR_FreePatchCache(boolean freeall)
}
}
// free all textures after each level
void HWR_ClearAllTextures(void)
{
HWR_FreeMapTextures();
// free references to the textures
HWD.pfnClearMipMapCache();
// Alam: free the Z_Blocks before freeing it's users
HWD.pfnClearMipMapCache(); // free references to the textures
HWR_FreePatchCache(true);
}
// free all patch colormaps after each level: must be done after ClearMipMapCache!
void HWR_FreeColormapCache(void)
{
HWR_FreePatchCache(false);
@ -696,6 +703,7 @@ static void FreeMapTexture(GLMapTexture_t *tex)
HWD.pfnDeleteTexture(&tex->mipmap);
if (tex->mipmap.data)
Z_Free(tex->mipmap.data);
tex->mipmap.data = NULL;
}
void HWR_FreeMapTextures(void)
@ -722,18 +730,15 @@ void HWR_FreeMapTextures(void)
void HWR_LoadMapTextures(size_t pnumtextures)
{
// we must free it since numtextures changed
// we must free it since numtextures may have changed
HWR_FreeMapTextures();
// Why not Z_Malloc?
gl_numtextures = pnumtextures;
gl_textures = calloc(gl_numtextures, sizeof(*gl_textures));
gl_flats = calloc(gl_numtextures, sizeof(*gl_flats));
// Doesn't tell you which it _is_, but hopefully
// should never ever happen (right?!)
if ((gl_textures == NULL) || (gl_flats == NULL))
I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures. Sad!");
I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures");
gl_maptexturesloaded = true;
}
@ -1201,8 +1206,8 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
W_ReadLump(fademasklumpnum, Z_Malloc(W_LumpLength(fademasklumpnum),
PU_HWRCACHE, &flat));
stepy = ((INT32)SHORT(fmheight)<<FRACBITS)/pblockheight;
stepx = ((INT32)SHORT(fmwidth)<<FRACBITS)/pblockwidth;
stepy = ((INT32)fmheight<<FRACBITS)/pblockheight;
stepx = ((INT32)fmwidth<<FRACBITS)/pblockwidth;
posy = 0;
for (j = 0; j < pblockheight; j++)
{

View File

@ -43,20 +43,19 @@ typedef enum GLTextureFormat_e
// NULL if the texture is not in Doom heap cache.
struct GLMipmap_s
{
//for TexDownloadMipMap
GLTextureFormat_t format;
void *data;
// for TexDownloadMipMap
GLTextureFormat_t format;
void *data;
UINT32 flags;
UINT16 height;
UINT16 width;
UINT32 downloaded; // the dll driver have it in there cache ?
UINT32 flags;
UINT16 height;
UINT16 width;
UINT32 downloaded; // The GPU has this texture.
struct GLMipmap_s *nextcolormap;
const UINT8 *colormap;
// opengl
struct GLMipmap_s *nextmipmap; // opengl : liste of all texture in opengl driver
struct GLMipmap_s *nextmipmap; // Linked list of all textures
};
typedef struct GLMipmap_s GLMipmap_t;

View File

@ -282,7 +282,7 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
// if it's meant to cover the whole screen, black out the rest (ONLY IF TOP LEFT ISN'T TRANSPARENT)
// cx and cy are possibly *slightly* off from float maths
// This is done before here compared to software because we directly alter cx and cy to centre
if (cx >= -0.1f && cx <= 0.1f && (gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
if (cx >= -0.1f && cx <= 0.1f && gpatch->width == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && gpatch->height == BASEVIDHEIGHT)
{
const column_t *column = (const column_t *)((const UINT8 *)(gpatch->columns) + (gpatch->columnofs[0]));
if (!column->topdelta)
@ -427,8 +427,8 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
// fuck it, no GL support for croppedpatch v_perplayer right now. it's not like it's accessible to Lua or anything, and we only use it for menus...
cy -= (float)SHORT(gpatch->topoffset) * fscale;
cx -= (float)SHORT(gpatch->leftoffset) * fscale;
cy -= (float)(gpatch->topoffset) * fscale;
cx -= (float)(gpatch->leftoffset) * fscale;
if (!(option & V_NOSCALESTART))
{
@ -440,7 +440,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
// if it's meant to cover the whole screen, black out the rest (ONLY IF TOP LEFT ISN'T TRANSPARENT)
// cx and cy are possibly *slightly* off from float maths
// This is done before here compared to software because we directly alter cx and cy to centre
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
if (cx >= -0.1f && cx <= 0.1f && gpatch->width == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && gpatch->height == BASEVIDHEIGHT)
{
const column_t *column = (const column_t *)((const UINT8 *)(gpatch->columns) + (gpatch->columnofs[0]));
if (!column->topdelta)

View File

@ -46,6 +46,7 @@ EXPORT void HWRAPI(DeleteTexture) (FTextureInfo *TexInfo);
EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height, INT32 dst_stride, UINT16 *dst_data);
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip);
EXPORT void HWRAPI(ClearMipMapCache) (void);
EXPORT void HWRAPI(ClearCacheList) (void);
//Hurdler: added for backward compatibility
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
@ -100,6 +101,7 @@ struct hwdriver_s
ReadRect pfnReadRect;
GClipRect pfnGClipRect;
ClearMipMapCache pfnClearMipMapCache;
ClearCacheList pfnClearCacheList;
SetSpecialState pfnSetSpecialState;//Hurdler: added for backward compatibility
DrawModel pfnDrawModel;
CreateModelVBOs pfnCreateModelVBOs;

View File

@ -121,6 +121,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat);
void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum);
void HWR_FreeTexture(patch_t *patch);
void HWR_FreeTextureData(patch_t *patch);
void HWR_FreeTextureColormaps(patch_t *patch);
void HWR_ClearAllTextures(void);
void HWR_FreeColormapCache(void);

View File

@ -1145,7 +1145,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
texturevpegtop += gl_sidedef->rowoffset;
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
texturevpegtop %= SHORT(textures[gl_toptexture]->height)<<FRACBITS;
texturevpegtop %= (textures[gl_toptexture]->height)<<FRACBITS;
wallVerts[3].t = wallVerts[2].t = texturevpegtop * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpegtop + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * grTex->scaleY;
@ -1211,7 +1211,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
texturevpegbottom += gl_sidedef->rowoffset;
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
texturevpegbottom %= SHORT(textures[gl_bottomtexture]->height)<<FRACBITS;
texturevpegbottom %= (textures[gl_bottomtexture]->height)<<FRACBITS;
wallVerts[3].t = wallVerts[2].t = texturevpegbottom * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + gl_backsector->floorheight - gl_frontsector->floorheight) * grTex->scaleY;
@ -6221,17 +6221,6 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
void HWR_LoadLevel(void)
{
// Lactozilla (December 8, 2019)
// Level setup used to free EVERY mipmap from memory.
// Even mipmaps that aren't related to level textures.
// Presumably, the hardware render code used to store textures as level data.
// Meaning, they had memory allocated and marked with the PU_LEVEL tag.
// Level textures are only reloaded after R_LoadTextures, which is
// when the texture list is loaded.
// Sal: Unfortunately, NOT freeing them causes the dreaded Color Bug.
HWR_FreeColormapCache();
#ifdef ALAM_LIGHTING
// BP: reset light between levels (we draw preview frame lights on current frame)
HWR_ResetLights();
@ -6394,7 +6383,10 @@ void HWR_Switch(void)
// Create plane polygons
if (!gl_maploaded && (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)))
{
HWR_ClearAllTextures();
HWR_LoadLevel();
}
}
// --------------------------------------------------------------------------

View File

@ -527,7 +527,7 @@ void HWR_InitModels(void)
return;
}
}
// length of the player model prefix
prefixlen = strlen(PLAYERMODELPREFIX);
@ -1470,7 +1470,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
// Instead of the != operator, memcmp is used to avoid a compiler warning.
if (memcmp(&(hwrPatch->max_s), &(md2->model->max_s), sizeof(md2->model->max_s)) != 0 ||
memcmp(&(hwrPatch->max_t), &(md2->model->max_t), sizeof(md2->model->max_t)) != 0)
adjustTextureCoords(md2->model, gpatch);
adjustTextureCoords(md2->model, spr->gpatch);
HWR_GetMappedPatch(spr->gpatch, spr->colormap);
}

View File

@ -1308,12 +1308,21 @@ void Flush(void)
DeleteTexture(gl_cachehead);
gl_cachehead = gl_cachehead->nextmipmap;
}
gl_cachetail = gl_cachehead = NULL; //Hurdler: well, gl_cachehead is already NULL
ClearCacheList(); //Hurdler: well, gl_cachehead is already NULL
tex_downloaded = 0;
}
// -----------------+
// ClearCacheList : Clears the texture cache tail and head
// -----------------+
EXPORT void HWRAPI(ClearCacheList) (void)
{
gl_cachetail = gl_cachehead = NULL;
}
// -----------------+
// isExtAvailable : Look if an OpenGL extension is available
// Returns : true if extension available
@ -1930,13 +1939,15 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
{
UpdateTexture(pTexInfo);
pTexInfo->nextmipmap = NULL;
// insertion at the tail
if (gl_cachetail)
{ // insertion at the tail
{
gl_cachetail->nextmipmap = pTexInfo;
gl_cachetail = pTexInfo;
}
else // initialization of the linked list
gl_cachetail = gl_cachehead = pTexInfo;
gl_cachetail = gl_cachehead = pTexInfo;
}
}

View File

@ -1794,8 +1794,8 @@ static void HU_DrawChat_Old(void)
size_t i = 0;
const char *ntalk = "Say: ", *ttalk = "Say-Team: ";
const char *talk = ntalk;
INT32 charwidth = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
INT32 charheight = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
INT32 charwidth = 8 * con_scalefactor; //(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
INT32 charheight = 8 * con_scalefactor; //(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
if (teamtalk)
{
talk = ttalk;
@ -1816,7 +1816,7 @@ static void HU_DrawChat_Old(void)
}
else
{
//charwidth = SHORT(hu_font[talk[i]-HU_FONTSTART]->width) * con_scalefactor;
//charwidth = (hu_font[talk[i]-HU_FONTSTART]->width) * con_scalefactor;
V_DrawCharacter(HU_INPUTX + c, y, talk[i++] | cv_constextsize.value | V_NOSCALESTART, true);
}
c += charwidth;
@ -1844,7 +1844,7 @@ static void HU_DrawChat_Old(void)
}
else
{
//charwidth = SHORT(hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
//charwidth = (hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, true);
}
@ -2364,7 +2364,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
}
if (players[tab[i].num].exiting || (players[tab[i].num].pflags & PF_FINISHED))
V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon);
V_DrawSmallScaledPatch(x - exiticon->width/2 - 1, y-3, 0, exiticon);
if (gametyperankings[gametype] == GT_RACE)
{
@ -2668,7 +2668,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
V_DrawSmallScaledPatch(x-28, y-4, 0, tagico);
if (players[tab[i].num].exiting || (players[tab[i].num].pflags & PF_FINISHED))
V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon);
V_DrawSmallScaledPatch(x - exiticon->width/2 - 1, y-3, 0, exiticon);
// Draw emeralds
if (players[tab[i].num].powers[pw_invulnerability] && (players[tab[i].num].powers[pw_invulnerability] == players[tab[i].num].powers[pw_sneakers]) && ((leveltime/7) & 1))
@ -3094,7 +3094,7 @@ static void HU_DrawCoopOverlay(void)
if (LUA_HudEnabled(hud_tabemblems) && (!modifiedgame || savemoddata))
{
V_DrawString(160, 144, 0, va("- %d/%d", M_CountEmblems(), numemblems+numextraemblems));
V_DrawScaledPatch(128, 144 - SHORT(emblemicon->height)/4, 0, emblemicon);
V_DrawScaledPatch(128, 144 - emblemicon->height/4, 0, emblemicon);
}
if (!LUA_HudEnabled(hud_coopemeralds))

View File

@ -305,16 +305,16 @@ static int patch_get(lua_State *L)
lua_pushboolean(L, patch != NULL);
break;
case patch_width:
lua_pushinteger(L, SHORT(patch->width));
lua_pushinteger(L, patch->width);
break;
case patch_height:
lua_pushinteger(L, SHORT(patch->height));
lua_pushinteger(L, patch->height);
break;
case patch_leftoffset:
lua_pushinteger(L, SHORT(patch->leftoffset));
lua_pushinteger(L, patch->leftoffset);
break;
case patch_topoffset:
lua_pushinteger(L, SHORT(patch->topoffset));
lua_pushinteger(L, patch->topoffset);
break;
}
return 1;

View File

@ -4031,7 +4031,7 @@ static void M_DrawThermo(INT32 x, INT32 y, consvar_t *cv)
cursorlump = W_GetNumForName("M_THERMO");
V_DrawScaledPatch(xx, y, 0, p = W_CachePatchNum(leftlump,PU_PATCH));
xx += SHORT(p->width) - SHORT(p->leftoffset);
xx += p->width - p->leftoffset;
for (i = 0; i < 16; i++)
{
V_DrawScaledPatch(xx, y, V_WRAPX, W_CachePatchNum(centerlump[i & 1], PU_PATCH));
@ -4170,7 +4170,7 @@ static void M_DrawStaticBox(fixed_t x, fixed_t y, INT32 flags, fixed_t w, fixed_
fixed_t sw, pw;
patch = W_CachePatchName("LSSTATIC", PU_PATCH);
pw = SHORT(patch->width) - (sw = w*2); //FixedDiv(w, scale); -- for scale FRACUNIT/2
pw = patch->width - (sw = w*2); //FixedDiv(w, scale); -- for scale FRACUNIT/2
/*if (pw > 0) -- model code for modders providing weird LSSTATIC
{
@ -4267,8 +4267,8 @@ static void M_DrawMenuTitle(void)
if (p->height > 24) // title is larger than normal
{
INT32 xtitle = (BASEVIDWIDTH - (SHORT(p->width)/2))/2;
INT32 ytitle = (30 - (SHORT(p->height)/2))/2;
INT32 xtitle = (BASEVIDWIDTH - (p->width/2))/2;
INT32 ytitle = (30 - (p->height/2))/2;
if (xtitle < 0)
xtitle = 0;
@ -4279,8 +4279,8 @@ static void M_DrawMenuTitle(void)
}
else
{
INT32 xtitle = (BASEVIDWIDTH - SHORT(p->width))/2;
INT32 ytitle = (30 - SHORT(p->height))/2;
INT32 xtitle = (BASEVIDWIDTH - p->width)/2;
INT32 ytitle = (30 - p->height)/2;
if (xtitle < 0)
xtitle = 0;
@ -4316,7 +4316,7 @@ static void M_DrawGenericMenu(void)
{
patch_t *p;
p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH);
V_DrawScaledPatch((BASEVIDWIDTH - SHORT(p->width))/2, y, 0, p);
V_DrawScaledPatch((BASEVIDWIDTH - p->width)/2, y, 0, p);
}
else
{
@ -4847,7 +4847,7 @@ static void M_DrawCenteredMenu(void)
{
patch_t *p;
p = W_CachePatchName(currentMenu->menuitems[i].patch, PU_PATCH);
V_DrawScaledPatch((BASEVIDWIDTH - SHORT(p->width))/2, y, 0, p);
V_DrawScaledPatch((BASEVIDWIDTH - p->width)/2, y, 0, p);
}
else
{
@ -5695,7 +5695,7 @@ static void M_DrawRecordAttackForeground(void)
angle_t fa;
INT32 i;
INT32 height = (SHORT(fg->height)/2);
INT32 height = (fg->height / 2);
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
for (i = -12; i < (BASEVIDHEIGHT/height) + 12; i++)
@ -5730,9 +5730,9 @@ static void M_DrawNightsAttackMountains(void)
static INT32 bgscrollx;
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
patch_t *background = W_CachePatchName(curbgname, PU_PATCH);
INT16 w = SHORT(background->width);
INT16 w = background->width;
INT32 x = FixedInt(-bgscrollx) % w;
INT32 y = BASEVIDHEIGHT - SHORT(background->height)*2;
INT32 y = BASEVIDHEIGHT - (background->height * 2);
if (vid.height != BASEVIDHEIGHT * dupz)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 158);
@ -5757,18 +5757,18 @@ static void M_DrawNightsAttackBackground(void)
// top
patch_t *backtopfg = W_CachePatchName("NTSATKT1", PU_PATCH);
patch_t *fronttopfg = W_CachePatchName("NTSATKT2", PU_PATCH);
INT32 backtopwidth = SHORT(backtopfg->width);
//INT32 backtopheight = SHORT(backtopfg->height);
INT32 fronttopwidth = SHORT(fronttopfg->width);
//INT32 fronttopheight = SHORT(fronttopfg->height);
INT32 backtopwidth = backtopfg->width;
//INT32 backtopheight = backtopfg->height;
INT32 fronttopwidth = fronttopfg->width;
//INT32 fronttopheight = fronttopfg->height;
// bottom
patch_t *backbottomfg = W_CachePatchName("NTSATKB1", PU_PATCH);
patch_t *frontbottomfg = W_CachePatchName("NTSATKB2", PU_PATCH);
INT32 backbottomwidth = SHORT(backbottomfg->width);
INT32 backbottomheight = SHORT(backbottomfg->height);
INT32 frontbottomwidth = SHORT(frontbottomfg->width);
INT32 frontbottomheight = SHORT(frontbottomfg->height);
INT32 backbottomwidth = backbottomfg->width;
INT32 backbottomheight = backbottomfg->height;
INT32 frontbottomwidth = frontbottomfg->width;
INT32 frontbottomheight = frontbottomfg->height;
// background
M_DrawNightsAttackMountains();
@ -6151,7 +6151,7 @@ static void M_DrawMessageMenu(void)
}
V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2,y,V_ALLOWLOWERCASE,string);
y += 8; //SHORT(hu_font[0]->height);
y += 8; //hu_font[0]->height;
}
}
@ -9165,10 +9165,10 @@ static void M_DrawSetupChoosePlayerMenu(void)
patch_t *charbg = W_CachePatchName("CHARBG", PU_PATCH);
patch_t *charfg = W_CachePatchName("CHARFG", PU_PATCH);
INT16 bgheight = SHORT(charbg->height);
INT16 fgheight = SHORT(charfg->height);
INT16 bgwidth = SHORT(charbg->width);
INT16 fgwidth = SHORT(charfg->width);
INT16 bgheight = charbg->height;
INT16 fgheight = charfg->height;
INT16 bgwidth = charbg->width;
INT16 fgwidth = charfg->width;
INT32 x, y;
INT32 w = (vid.width/vid.dupx);
@ -9260,14 +9260,14 @@ static void M_DrawSetupChoosePlayerMenu(void)
curoutlinecolor = col = skincolors[charskin->prefcolor].invcolor;
txsh = oxsh;
ox = 8 + SHORT((description[char_on].charpic)->width)/2;
ox = 8 + ((description[char_on].charpic)->width)/2;
y = my + 144;
// cur
{
x = ox - txsh;
if (curpatch)
x -= (SHORT(curpatch->width)/2);
x -= curpatch->width / 2;
if (curtext[0] != '\0')
{
@ -9300,7 +9300,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
x = (ox - txsh) - w;
if (prevpatch)
x -= (SHORT(prevpatch->width)/2);
x -= prevpatch->width / 2;
if (prevtext[0] != '\0')
{
@ -9330,7 +9330,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
x = (ox - txsh) + w;
if (nextpatch)
x -= (SHORT(nextpatch->width)/2);
x -= nextpatch->width / 2;
if (nexttext[0] != '\0')
{
@ -9352,7 +9352,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
{
patch_t *header = W_CachePatchName("M_PICKP", PU_PATCH);
INT32 xtitle = 146;
INT32 ytitle = (35 - SHORT(header->height))/2;
INT32 ytitle = (35 - header->height) / 2;
V_DrawFixedPatch(xtitle<<FRACBITS, ytitle<<FRACBITS, FRACUNIT/2, 0, header, NULL);
}
#endif // CHOOSEPLAYER_DRAWHEADER
@ -9818,8 +9818,8 @@ void M_DrawTimeAttackMenu(void)
empatch = W_CachePatchName(M_GetEmblemPatch(em, true), PU_PATCH);
empatx = SHORT(empatch->leftoffset)/2;
empaty = SHORT(empatch->topoffset)/2;
empatx = empatch->leftoffset / 2;
empaty = empatch->topoffset / 2;
if (em->collected)
V_DrawSmallMappedPatch(104+76+empatx, yHeight+lsheadingheight/2+empaty, 0, empatch,
@ -10055,7 +10055,7 @@ void M_DrawNightsAttackMenu(void)
// Super Sonic
M_DrawNightsAttackSuperSonic();
//if (P_HasGrades(cv_nextmap.value, 0))
// V_DrawScaledPatch(235 - (SHORT((ngradeletters[bestoverall])->width)*3)/2, 135, 0, ngradeletters[bestoverall]);
// V_DrawScaledPatch(235 - (((ngradeletters[bestoverall])->width)*3)/2, 135, 0, ngradeletters[bestoverall]);
if (P_HasGrades(cv_nextmap.value, cv_dummymares.value))
{//make bigger again
@ -10612,7 +10612,7 @@ void M_DrawMarathon(void)
{
patch_t *fg = W_CachePatchName("RECATKFG", PU_PATCH);
INT32 trans = V_60TRANS+((cnt&~3)<<(V_ALPHASHIFT-2));
INT32 height = (SHORT(fg->height)/2);
INT32 height = fg->height / 2;
char patchname[7] = "CEMGx0";
dupz = (w*7)/6; //(w*42*120)/(360*6); -- I don't know why this works but I'm not going to complain.
@ -11382,7 +11382,7 @@ static void M_DrawServerMenu(void)
else
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_PATCH);
V_DrawSmallScaledPatch(319 - (currentMenu->x + (SHORT(PictureOfLevel->width)/2)), currentMenu->y + imgheight, 0, PictureOfLevel);
V_DrawSmallScaledPatch(319 - (currentMenu->x + (PictureOfLevel->width / 2)), currentMenu->y + imgheight, 0, PictureOfLevel);
}
}

View File

@ -4133,6 +4133,12 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// Clear pointers that would be left dangling by the purge
R_FlushTranslationColormapCache();
#ifdef HWRENDER
// Free GPU textures before freeing patches.
if (vid.glstate == VID_GL_LIBRARY_LOADED)
HWR_ClearAllTextures();
#endif
Patch_FreeTag(PU_PATCH_LOWPRIORITY);
Patch_FreeTag(PU_PATCH_ROTATED);
Z_FreeTags(PU_LEVEL, PU_PURGELEVEL - 1);
@ -4492,6 +4498,11 @@ boolean P_AddWadFile(const char *wadfilename)
if (!devparm && digmreplaces)
CONS_Printf(M_GetText("%s digital musics replaced\n"), sizeu1(digmreplaces));
#ifdef HWRENDER
// Free GPU textures before freeing patches.
if (vid.glstate == VID_GL_LIBRARY_LOADED)
HWR_ClearAllTextures();
#endif
//
// search for sprite replacements

View File

@ -31,13 +31,13 @@ patch_t *Patch_Create(softwarepatch_t *source, size_t srcsize, void *dest)
if (source)
{
INT32 col, colsize;
size_t size = sizeof(INT32) * source->width;
size_t size = sizeof(INT32) * SHORT(source->width);
size_t offs = (sizeof(INT16) * 4) + size;
patch->width = source->width;
patch->height = source->height;
patch->leftoffset = source->leftoffset;
patch->topoffset = source->topoffset;
patch->width = SHORT(source->width);
patch->height = SHORT(source->height);
patch->leftoffset = SHORT(source->leftoffset);
patch->topoffset = SHORT(source->topoffset);
patch->columnofs = Z_Calloc(size, PU_PATCH_DATA, NULL);
for (col = 0; col < source->width; col++)
@ -74,7 +74,7 @@ static void Patch_FreeData(patch_t *patch)
HWR_FreeTexture(patch);
#endif
for (i = 0; i < 2; i++)
for (i = 0; i < 4; i++)
{
if (patch->flats[i])
Z_Free(patch->flats[i]);

View File

@ -759,7 +759,7 @@ d->z = (v1.x * v2.y) - (v1.y * v2.x)
#undef SFMULT
}
static void R_SetSlopePlaneVectors(visplane_t *pl, INT32 y, fixed_t xoff, fixed_t yoff, float fudge)
void R_SetTiltedSpan(INT32 span)
{
if (ds_su == NULL)
ds_su = Z_Malloc(sizeof(*ds_su) * vid.height, PU_STATIC, NULL);
@ -768,10 +768,14 @@ static void R_SetSlopePlaneVectors(visplane_t *pl, INT32 y, fixed_t xoff, fixed_
if (ds_sz == NULL)
ds_sz = Z_Malloc(sizeof(*ds_sz) * vid.height, PU_STATIC, NULL);
ds_sup = &ds_su[y];
ds_svp = &ds_sv[y];
ds_szp = &ds_sz[y];
ds_sup = &ds_su[span];
ds_svp = &ds_sv[span];
ds_szp = &ds_sz[span];
}
static void R_SetSlopePlaneVectors(visplane_t *pl, INT32 y, fixed_t xoff, fixed_t yoff, float fudge)
{
R_SetTiltedSpan(y);
R_CalculateSlopeVectors(pl->slope, pl->viewx, pl->viewy, pl->viewz, FRACUNIT, FRACUNIT, xoff, yoff, pl->viewangle, pl->plangle, fudge);
}

View File

@ -96,6 +96,9 @@ void R_DrawSinglePlane(visplane_t *pl);
// Calculates the slope vectors needed for tilted span drawing.
void R_CalculateSlopeVectors(pslope_t *slope, fixed_t planeviewx, fixed_t planeviewy, fixed_t planeviewz, fixed_t planexscale, fixed_t planeyscale, fixed_t planexoffset, fixed_t planeyoffset, angle_t planeviewangle, angle_t planeangle, float fudge);
// Sets the slope vector pointers for the current tilted span.
void R_SetTiltedSpan(INT32 span);
typedef struct planemgr_s
{
visplane_t *plane;

View File

@ -419,9 +419,7 @@ void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis
// Lactozilla: I don't know what I'm doing
if (pSplat->tilted)
{
ds_sup = &ds_su[0];
ds_svp = &ds_sv[0];
ds_szp = &ds_sz[0];
R_SetTiltedSpan(0);
R_CalculateSlopeVectors(&pSplat->slope, viewx, viewy, viewz, pSplat->xscale, pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, viewangle, pSplat->angle, 1.0f);
spanfunctype = SPANDRAWFUNC_TILTEDSPRITE;
}

View File

@ -296,11 +296,11 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
if (!isPNG)
#endif
{
W_ReadLumpHeaderPwad(wadnum, l, &patch, sizeof (patch_t), 0);
width = SHORT(patch.width);
height = SHORT(patch.height);
topoffset = SHORT(patch.topoffset);
leftoffset = SHORT(patch.leftoffset);
W_ReadLumpHeaderPwad(wadnum, l, &patch, sizeof(INT16) * 4, 0);
width = (INT32)(SHORT(patch.width));
height = (INT32)(SHORT(patch.height));
topoffset = (INT16)(SHORT(patch.topoffset));
leftoffset = (INT16)(SHORT(patch.leftoffset));
}
spritecachedinfo[numspritelumps].width = width<<FRACBITS;
@ -308,14 +308,8 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
spritecachedinfo[numspritelumps].topoffset = topoffset<<FRACBITS;
spritecachedinfo[numspritelumps].height = height<<FRACBITS;
//BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
if (rendermode != render_none) // not for psprite
spritecachedinfo[numspritelumps].topoffset += FEETADJUST;
// Being selective with this causes bad things. :( Like the special stage tokens breaking apart.
/*if (rendermode != render_none // not for psprite
&& SHORT(patch.topoffset)>0 && SHORT(patch.topoffset)<SHORT(patch.height))
// perfect is patch.height but sometime it is too high
spritecachedinfo[numspritelumps].topoffset = min(SHORT(patch.topoffset)+(FEETADJUST>>FRACBITS),SHORT(patch.height))<<FRACBITS;*/
// BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
spritecachedinfo[numspritelumps].topoffset += FEETADJUST;
//----------------------------------------------------
@ -896,7 +890,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
vis->x2 = vid.width-1;
localcolfunc = (vis->cut & SC_VFLIP) ? R_DrawFlippedMaskedColumn : R_DrawMaskedColumn;
lengthcol = SHORT(patch->height);
lengthcol = patch->height;
// Split drawing loops for paper and non-paper to reduce conditional checks per sprite
if (vis->scalestep)
@ -904,7 +898,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
fixed_t horzscale = FixedMul(vis->spritexscale, this_scale);
fixed_t scalestep = FixedMul(vis->scalestep, vis->spriteyscale);
pwidth = SHORT(patch->width);
pwidth = patch->width;
// Papersprite drawing loop
for (dc_x = vis->x1; dc_x <= vis->x2; dc_x++, spryscale += scalestep)
@ -929,7 +923,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
else if (vis->cut & SC_SHEAR)
{
#ifdef RANGECHECK
pwidth = SHORT(patch->width);
pwidth = patch->width;
#endif
// Vertically sheared sprite
@ -951,7 +945,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
else
{
#ifdef RANGECHECK
pwidth = SHORT(patch->width);
pwidth = patch->width;
#endif
// Non-paper drawing loop
@ -1025,7 +1019,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
#ifdef RANGECHECK
texturecolumn = frac>>FRACBITS;
if (texturecolumn < 0 || texturecolumn >= SHORT(patch->width))
if (texturecolumn < 0 || texturecolumn >= patch->width)
I_Error("R_DrawPrecipitationSpriteRange: bad texturecolumn");
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));

View File

@ -72,7 +72,7 @@ CV_PossibleValue_t cv_renderer_t[] = {
{0, NULL}
};
consvar_t cv_renderer = CVAR_INIT ("renderer", "Software", CV_SAVE|CV_NOLUA|CV_CALL, cv_renderer_t, SCR_SetTargetRenderer);
consvar_t cv_renderer = CVAR_INIT ("renderer", "Software", CV_SAVE|CV_NOLUA|CV_CALL, cv_renderer_t, SCR_ChangeRenderer);
static void SCR_ChangeFullscreen(void);
@ -207,7 +207,11 @@ void SCR_SetMode(void)
if (setrenderneeded && (moviemode == MM_APNG))
M_StopMovie();
VID_CheckRenderer();
// VID_SetMode will call VID_CheckRenderer itself,
// so no need to do this in here.
if (!setmodeneeded)
VID_CheckRenderer();
vid.recalc = 1;
}
@ -402,15 +406,10 @@ void SCR_ChangeFullscreen(void)
#endif
}
void SCR_SetTargetRenderer(void)
{
if (!con_refresh)
SCR_ChangeRenderer();
}
void SCR_ChangeRenderer(void)
{
if ((signed)rendermode == cv_renderer.value)
if (chosenrendermode != render_none
|| (signed)rendermode == cv_renderer.value)
return;
#ifdef HWRENDER
@ -428,7 +427,6 @@ void SCR_ChangeRenderer(void)
// Set the new render mode
setrenderneeded = cv_renderer.value;
con_refresh = false;
}
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)

View File

@ -183,7 +183,6 @@ extern INT32 setmodeneeded; // mode number to set if needed, or 0
extern UINT8 setrenderneeded;
void SCR_ChangeRenderer(void);
void SCR_SetTargetRenderer(void);
extern CV_PossibleValue_t cv_renderer_t[];

View File

@ -90,6 +90,7 @@ void *hwSym(const char *funcName,void *handle)
GETFUNC(ReadRect);
GETFUNC(GClipRect);
GETFUNC(ClearMipMapCache);
GETFUNC(ClearCacheList);
GETFUNC(SetSpecialState);
GETFUNC(GetTextureUsed);
GETFUNC(DrawModel);

View File

@ -1557,7 +1557,7 @@ boolean VID_CheckRenderer(void)
setrenderneeded = 0;
}
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN, (rendererchanged ? SDL_FALSE : SDL_TRUE));
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN, (setmodeneeded ? SDL_TRUE : SDL_FALSE));
Impl_VideoSetupBuffer();
if (rendermode == render_soft)
@ -1568,11 +1568,6 @@ boolean VID_CheckRenderer(void)
bufSurface = NULL;
}
#ifdef HWRENDER
if (rendererchanged && vid.glstate == VID_GL_LIBRARY_LOADED) // Only if OpenGL ever loaded!
HWR_ClearAllTextures();
#endif
SCR_SetDrawFuncs();
}
#ifdef HWRENDER
@ -1868,6 +1863,7 @@ void VID_StartupOpenGL(void)
HWD.pfnReadRect = hwSym("ReadRect",NULL);
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
HWD.pfnClearCacheList = hwSym("ClearCacheList",NULL);
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);

View File

@ -454,7 +454,7 @@ boolean st_overlay;
static void ST_DrawNightsOverlayNum(fixed_t x /* right border */, fixed_t y, fixed_t s, INT32 a,
UINT32 num, patch_t **numpat, skincolornum_t colornum)
{
fixed_t w = SHORT(numpat[0]->width)*s;
fixed_t w = numpat[0]->width * s;
const UINT8 *colormap;
// I want my V_SNAPTOx flags. :< -Red
@ -672,7 +672,7 @@ static void ST_drawRaceNum(INT32 time)
if (!(P_AutoPause() || paused) && !bounce)
S_StartSound(0, ((racenum == racego) ? sfx_s3kad : sfx_s3ka7));
}
V_DrawScaledPatch(((BASEVIDWIDTH - SHORT(racenum->width))/2), height, V_PERPLAYER, racenum);
V_DrawScaledPatch(((BASEVIDWIDTH - racenum->width)/2), height, V_PERPLAYER, racenum);
}
static void ST_drawTime(void)
@ -1621,8 +1621,8 @@ static void ST_drawFirstPersonHUD(void)
p = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
// Display the countdown drown numbers!
if (p && !F_GetPromptHideHud(60 - SHORT(p->topoffset)))
V_DrawScaledPatch((BASEVIDWIDTH/2) - (SHORT(p->width)/2) + SHORT(p->leftoffset), 60 - SHORT(p->topoffset),
if (p && !F_GetPromptHideHud(60 - p->topoffset))
V_DrawScaledPatch((BASEVIDWIDTH/2) - (p->width / 2) + SHORT(p->leftoffset), 60 - SHORT(p->topoffset),
V_PERPLAYER|V_PERPLAYER|V_TRANSLUCENT, p);
}
@ -2375,7 +2375,7 @@ static void ST_drawTeamHUD(void)
p = bmatcico;
if (LUA_HudEnabled(hud_teamscores))
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - (p->width / 4), 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
if (gametyperules & GTR_TEAMFLAGS)
p = rflagico;
@ -2383,7 +2383,7 @@ static void ST_drawTeamHUD(void)
p = rmatcico;
if (LUA_HudEnabled(hud_teamscores))
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - (p->width / 4), 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
if (!(gametyperules & GTR_TEAMFLAGS))
goto num;
@ -2396,11 +2396,11 @@ static void ST_drawTeamHUD(void)
{
// Blue flag isn't at base
if (players[i].gotflag & GF_BLUEFLAG && LUA_HudEnabled(hud_teamscores))
V_DrawScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(nonicon->width)/2, 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon);
V_DrawScaledPatch(BASEVIDWIDTH/2 - SEP - (nonicon->width / 2), 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon);
// Red flag isn't at base
if (players[i].gotflag & GF_REDFLAG && LUA_HudEnabled(hud_teamscores))
V_DrawScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(nonicon2->width)/2, 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon2);
V_DrawScaledPatch(BASEVIDWIDTH/2 + SEP - (nonicon2->width / 2), 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon2);
whichflag |= players[i].gotflag;
@ -2673,7 +2673,7 @@ static void ST_overlayDrawer(void)
else
{
tic_t num = time;
INT32 sz = SHORT(tallnum[0]->width)/2, width = 0;
INT32 sz = tallnum[0]->width / 2, width = 0;
do
{
width += sz;

View File

@ -599,13 +599,13 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
// left offset
if (scrn & V_FLIP)
offsetx = FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
offsetx = FixedMul((patch->width - patch->leftoffset)<<FRACBITS, pscale) + 1;
else
offsetx = FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
offsetx = FixedMul(patch->leftoffset<<FRACBITS, pscale);
// top offset
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
offsety = FixedMul(SHORT(patch->topoffset)<<FRACBITS, vscale);
offsety = FixedMul(patch->topoffset<<FRACBITS, vscale);
if ((scrn & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
{
@ -712,7 +712,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
if (!(scrn & V_SCALEPATCHMASK))
{
// if it's meant to cover the whole screen, black out the rest (ONLY IF TOP LEFT ISN'T TRANSPARENT)
if (x == 0 && SHORT(patch->width) == BASEVIDWIDTH && y == 0 && SHORT(patch->height) == BASEVIDHEIGHT)
if (x == 0 && patch->width == BASEVIDWIDTH && y == 0 && patch->height == BASEVIDHEIGHT)
{
column = (const column_t *)((const UINT8 *)(patch->columns) + (patch->columnofs[0]));
if (!column->topdelta)
@ -754,18 +754,18 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
if (pscale != FRACUNIT) // scale width properly
{
pwidth = SHORT(patch->width)<<FRACBITS;
pwidth = patch->width<<FRACBITS;
pwidth = FixedMul(pwidth, pscale);
pwidth = FixedMul(pwidth, dupx<<FRACBITS);
pwidth >>= FRACBITS;
}
else
pwidth = SHORT(patch->width) * dupx;
pwidth = patch->width * dupx;
deststart = desttop;
destend = desttop + pwidth;
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++)
for (col = 0; (col>>FRACBITS) < patch->width; col += colfrac, ++offx, desttop++)
{
INT32 topdelta, prevdelta = -1;
if (scrn & V_FLIP) // offx is measured from right edge instead of left
@ -862,8 +862,8 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
colfrac = FixedDiv(FRACUNIT, fdup);
rowfrac = FixedDiv(FRACUNIT, fdup);
y -= FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
x -= FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
y -= FixedMul(patch->topoffset<<FRACBITS, pscale);
x -= FixedMul(patch->leftoffset<<FRACBITS, pscale);
if (splitscreen && (scrn & V_PERPLAYER))
{
@ -998,7 +998,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
desttop += (y*vid.width) + x;
}
for (col = sx<<FRACBITS; (col>>FRACBITS) < SHORT(patch->width) && ((col>>FRACBITS) - sx) < w; col += colfrac, ++x, desttop++)
for (col = sx<<FRACBITS; (col>>FRACBITS) < patch->width && ((col>>FRACBITS) - sx) < w; col += colfrac, ++x, desttop++)
{
INT32 topdelta, prevdelta = -1;
if (x < 0) // don't draw off the left of the screen (WRAP PREVENTION)
@ -1796,7 +1796,7 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
void V_DrawPatchFill(patch_t *pat)
{
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
INT32 x, y, pw = SHORT(pat->width) * dupz, ph = SHORT(pat->height) * dupz;
INT32 x, y, pw = pat->width * dupz, ph = pat->height * dupz;
for (x = 0; x < vid.width; x += pw)
{
@ -1984,7 +1984,7 @@ void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed)
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
return;
w = SHORT(hu_font[c]->width);
w = hu_font[c]->width;
if (x + w > vid.width)
return;
@ -2011,7 +2011,7 @@ void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UI
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
return;
w = (vid.width < 640 ) ? (SHORT(hu_font[c]->width)/2) : (SHORT(hu_font[c]->width)); // use normal sized characters if we're using a terribly low resolution.
w = (vid.width < 640 ) ? ((hu_font[c]->width / 2)) : (hu_font[c]->width); // use normal sized characters if we're using a terribly low resolution.
if (x + w > vid.width)
return;
@ -2173,10 +2173,10 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
if (charwidth)
{
w = charwidth * dupx;
center = w/2 - SHORT(hu_font[c]->width)*dupx/2;
center = w/2 - hu_font[c]->width*dupx/2;
}
else
w = SHORT(hu_font[c]->width) * dupx;
w = hu_font[c]->width * dupx;
if (cx > scrwidth)
continue;
@ -2290,10 +2290,10 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
if (charwidth)
{
w = charwidth * dupx;
center = w/2 - SHORT(hu_font[c]->width)*dupx/4;
center = w/2 - hu_font[c]->width*dupx/4;
}
else
w = SHORT(hu_font[c]->width) * dupx / 2;
w = hu_font[c]->width * dupx / 2;
if (cx > scrwidth)
continue;
@ -2408,7 +2408,7 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
if (charwidth)
w = charwidth * dupx;
else
w = (SHORT(tny_font[c]->width) * dupx);
w = tny_font[c]->width * dupx;
if (cx > scrwidth)
continue;
@ -2547,10 +2547,10 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
if (charwidth)
{
w = charwidth * dupx;
center = w/2 - SHORT(hu_font[c]->width)*(dupx/2);
center = w/2 - hu_font[c]->width*(dupx/2);
}
else
w = SHORT(hu_font[c]->width) * dupx;
w = hu_font[c]->width * dupx;
if ((cx>>FRACBITS) > scrwidth)
continue;
@ -2663,10 +2663,10 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st
if (charwidth)
{
w = charwidth * dupx;
center = w/2 - SHORT(hu_font[c]->width)*(dupx/4);
center = w/2 - hu_font[c]->width*(dupx/4);
}
else
w = SHORT(hu_font[c]->width) * dupx / 2;
w = hu_font[c]->width * dupx / 2;
if ((cx>>FRACBITS) > scrwidth)
break;
@ -2780,10 +2780,10 @@ void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *str
if (charwidth)
{
w = charwidth * dupx;
center = w/2 - SHORT(tny_font[c]->width)*(dupx/2);
center = w/2 - tny_font[c]->width*(dupx/2);
}
else
w = SHORT(tny_font[c]->width) * dupx;
w = tny_font[c]->width * dupx;
if ((cx>>FRACBITS) > scrwidth)
break;
@ -2897,10 +2897,10 @@ void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char
if (charwidth)
{
w = FixedMul(charwidth, dupx);
center = w/2 - SHORT(tny_font[c]->width)*(dupx/4);
center = w/2 - tny_font[c]->width*(dupx/4);
}
else
w = SHORT(tny_font[c]->width) * dupx / 2;
w = tny_font[c]->width * dupx / 2;
if (cx > scrwidth)
break;
@ -2933,7 +2933,7 @@ void V_DrawRightAlignedSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option
// Draws a tallnum. Replaces two functions in y_inter and st_stuff
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num)
{
INT32 w = SHORT(tallnum[0]->width);
INT32 w = tallnum[0]->width;
boolean neg;
if (flags & (V_NOSCALESTART|V_NOSCALEPATCH))
@ -2959,7 +2959,7 @@ void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num)
// Does not handle negative numbers in a special way, don't try to feed it any.
void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits)
{
INT32 w = SHORT(tallnum[0]->width);
INT32 w = tallnum[0]->width;
if (flags & (V_NOSCALESTART|V_NOSCALEPATCH))
w *= vid.dupx;
@ -3036,7 +3036,7 @@ void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string)
continue;
}
w = SHORT(cred_font[c]->width) * dupx;
w = cred_font[c]->width * dupx;
if ((cx>>FRACBITS) > scrwidth)
continue;
@ -3098,7 +3098,7 @@ static void V_DrawNameTagLine(INT32 x, INT32 y, INT32 option, fixed_t scale, UIN
continue;
}
w = FixedMul((SHORT(ntb_font[c]->width)+2 * dupx) * FRACUNIT, scale);
w = FixedMul(((ntb_font[c]->width)+2 * dupx) * FRACUNIT, scale);
if (FixedInt(cx) > scrwidth)
continue;
@ -3239,7 +3239,7 @@ INT32 V_NameTagWidth(const char *string)
if (c < 0 || c >= NT_FONTSIZE || !ntb_font[c] || !nto_font[c])
w += 4;
else
w += SHORT(ntb_font[c]->width)+2;
w += (ntb_font[c]->width)+2;
}
return w;
@ -3262,7 +3262,7 @@ INT32 V_CreditStringWidth(const char *string)
if (c < 0 || c >= CRED_FONTSIZE)
w += 16;
else
w += SHORT(cred_font[c]->width);
w += cred_font[c]->width;
}
return w;
@ -3320,7 +3320,7 @@ void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string)
continue;
}
w = SHORT(lt_font[c]->width) * dupx;
w = lt_font[c]->width * dupx;
if (cx > scrwidth)
continue;
@ -3352,7 +3352,7 @@ INT32 V_LevelNameWidth(const char *string)
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
w += 16;
else
w += SHORT(lt_font[c]->width);
w += lt_font[c]->width;
}
return w;
@ -3371,8 +3371,8 @@ INT32 V_LevelNameHeight(const char *string)
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
continue;
if (SHORT(lt_font[c]->height) > w)
w = SHORT(lt_font[c]->height);
if (lt_font[c]->height > w)
w = lt_font[c]->height;
}
return w;
@ -3385,11 +3385,11 @@ INT16 V_LevelActNumWidth(UINT8 num)
INT16 result = 0;
if (num == 0)
result = SHORT(ttlnum[num]->width);
result = ttlnum[num]->width;
while (num > 0 && num <= 99)
{
result = result + SHORT(ttlnum[num%10]->width);
result = result + ttlnum[num%10]->width;
num = num/10;
}
@ -3427,7 +3427,7 @@ INT32 V_StringWidth(const char *string, INT32 option)
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
w += spacewidth;
else
w += (charwidth ? charwidth : SHORT(hu_font[c]->width));
w += (charwidth ? charwidth : hu_font[c]->width);
}
if (option & (V_NOSCALESTART|V_NOSCALEPATCH))
@ -3467,7 +3467,7 @@ INT32 V_SmallStringWidth(const char *string, INT32 option)
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
w += spacewidth;
else
w += (charwidth ? charwidth : SHORT(hu_font[c]->width)/2);
w += (charwidth ? charwidth : (hu_font[c]->width / 2));
}
return w;
@ -3504,7 +3504,7 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
if (c < 0 || c >= HU_FONTSIZE || !tny_font[c])
w += spacewidth;
else
w += (charwidth ? charwidth : SHORT(tny_font[c]->width));
w += (charwidth ? charwidth : tny_font[c]->width);
}
return w;

View File

@ -111,6 +111,7 @@ static loadfunc_t hwdFuncTable[] = {
{"ReadRect@24", &hwdriver.pfnReadRect},
{"GClipRect@20", &hwdriver.pfnGClipRect},
{"ClearMipMapCache@0", &hwdriver.pfnClearMipMapCache},
{"ClearCacheList@0", &hwdriver.pfnClearCacheList},
{"SetSpecialState@8", &hwdriver.pfnSetSpecialState},
{"DrawModel@16", &hwdriver.pfnDrawModel},
{"SetTransform@4", &hwdriver.pfnSetTransform},
@ -144,6 +145,7 @@ static loadfunc_t hwdFuncTable[] = {
{"ReadRect", &hwdriver.pfnReadRect},
{"GClipRect", &hwdriver.pfnGClipRect},
{"ClearMipMapCache", &hwdriver.pfnClearMipMapCache},
{"ClearCacheList", &hwdriver.pfnClearCacheList},
{"SetSpecialState", &hwdriver.pfnSetSpecialState},
{"DrawModel", &hwdriver.pfnDrawModel},
{"SetTransform", &hwdriver.pfnSetTransform},

View File

@ -183,7 +183,7 @@ static void Y_IntermissionTokenDrawer(void)
offs = 0;
lowy = BASEVIDHEIGHT - 32 - 8;
temp = SHORT(tokenicon->height)/2;
temp = tokenicon->height / 2;
em = 0;
while (emeralds & (1 << em))
@ -212,7 +212,7 @@ static void Y_IntermissionTokenDrawer(void)
calc = (lowy - y)*2;
if (calc > 0)
V_DrawCroppedPatch(32<<FRACBITS, y<<FRACBITS, FRACUNIT/2, 0, tokenicon, 0, 0, SHORT(tokenicon->width), calc);
V_DrawCroppedPatch(32<<FRACBITS, y<<FRACBITS, FRACUNIT/2, 0, tokenicon, 0, 0, tokenicon->width, calc);
}
//
@ -402,7 +402,7 @@ void Y_IntermissionDrawer(void)
// Total
V_DrawScaledPatch(152, bonusy, 0, data.coop.ptotal);
V_DrawTallNum(BASEVIDWIDTH - 68, bonusy + 1, 0, data.coop.total);
bonusy -= (3*SHORT(tallnum[0]->height)/2) + 1;
bonusy -= (3*(tallnum[0]->height)/2) + 1;
// Draw bonuses
for (i = 3; i >= 0; --i)
@ -412,7 +412,7 @@ void Y_IntermissionDrawer(void)
V_DrawScaledPatch(152, bonusy, 0, data.coop.bonuspatches[i]);
V_DrawTallNum(BASEVIDWIDTH - 68, bonusy + 1, 0, data.coop.bonuses[i].points);
}
bonusy -= (3*SHORT(tallnum[0]->height)/2) + 1;
bonusy -= (3*(tallnum[0]->height)/2) + 1;
}
}
else if (intertype == int_spec)
@ -749,10 +749,10 @@ void Y_IntermissionDrawer(void)
char name[MAXPLAYERNAME+1];
// Show the team flags and the team score at the top instead of "RESULTS"
V_DrawSmallScaledPatch(128 - SHORT(data.match.blueflag->width)/4, 2, 0, data.match.blueflag);
V_DrawSmallScaledPatch(128 - (data.match.blueflag->width / 4), 2, 0, data.match.blueflag);
V_DrawCenteredString(128, 16, 0, va("%u", bluescore));
V_DrawSmallScaledPatch(192 - SHORT(data.match.redflag->width)/4, 2, 0, data.match.redflag);
V_DrawSmallScaledPatch(192 - (data.match.redflag->width / 4), 2, 0, data.match.redflag);
V_DrawCenteredString(192, 16, 0, va("%u", redscore));
// draw the level name