From 5293c52bcabf790b5839c91d09b5ae2fb381de40 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sun, 22 Nov 2020 20:02:47 -0300 Subject: [PATCH] Remove SHORT macros for referencing patch width/height/offsets --- src/console.c | 2 +- src/d_main.c | 2 +- src/f_finale.c | 4 +- src/hardware/hw_cache.c | 4 +- src/hardware/hw_draw.c | 8 ++-- src/hardware/hw_main.c | 4 +- src/hu_stuff.c | 14 +++---- src/m_menu.c | 68 +++++++++++++++++----------------- src/r_patch.c | 10 ++--- src/r_things.c | 28 ++++++-------- src/st_stuff.c | 18 ++++----- src/v_video.c | 82 ++++++++++++++++++++--------------------- src/y_inter.c | 12 +++--- 13 files changed, 125 insertions(+), 131 deletions(-) diff --git a/src/console.c b/src/console.c index 29794d017..b19b8818d 100644 --- a/src/console.c +++ b/src/console.c @@ -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); } } diff --git a/src/d_main.c b/src/d_main.c index 81797947d..1045d4d99 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -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); diff --git a/src/f_finale.c b/src/f_finale.c index 268bc79f5..688cd4fc7 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -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; diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 5c4702fda..b4fa7ec6c 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -1206,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)<= -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) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 1dda7a423..5dd2727bc 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -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)<height)<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)<height)<scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + gl_backsector->floorheight - gl_frontsector->floorheight) * grTex->scaleY; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 604a509e0..7e9144f98 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -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)) diff --git a/src/m_menu.c b/src/m_menu.c index d31e2154c..b09025fe0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -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<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); } } diff --git a/src/r_patch.c b/src/r_patch.c index d6db44ea5..1a08d1892 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -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++) diff --git a/src/r_things.c b/src/r_things.c index 9032cd246..30bf15f85 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -297,10 +297,10 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 #endif { W_ReadLumpHeaderPwad(wadnum, l, &patch, sizeof(INT16) * 4, 0); - width = SHORT(patch.width); - height = SHORT(patch.height); - topoffset = SHORT(patch.topoffset); - leftoffset = SHORT(patch.leftoffset); + width = (INT32)(SHORT(patch.width)); + height = (INT32)(SHORT(patch.height)); + topoffset = (INT16)(SHORT(patch.topoffset)); + leftoffset = (INT16)(SHORT(patch.leftoffset)); } spritecachedinfo[numspritelumps].width = width<0 && SHORT(patch.topoffset)>FRACBITS),SHORT(patch.height))<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])); diff --git a/src/st_stuff.c b/src/st_stuff.c index 45e498323..8ecf4368f 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -458,7 +458,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 @@ -676,7 +676,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) @@ -1625,8 +1625,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); } @@ -2379,7 +2379,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; @@ -2387,7 +2387,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; @@ -2400,11 +2400,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; @@ -2677,7 +2677,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; diff --git a/src/v_video.c b/src/v_video.c index 522883475..4713db0d8 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -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))<width - patch->leftoffset)<leftoffset)<leftoffset<topoffset)<topoffset<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)<width<>= 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)<leftoffset)<topoffset<leftoffset<>FRACBITS) < SHORT(patch->width) && ((col>>FRACBITS) - sx) < w; col += colfrac, ++x, desttop++) + for (col = sx<>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; diff --git a/src/y_inter.c b/src/y_inter.c index acdf5f8d7..061cbb5e1 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -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<width), calc); + V_DrawCroppedPatch(32<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