diff --git a/source/blood/src/aiunicult.cpp b/source/blood/src/aiunicult.cpp index b55b3102b..7e3766733 100644 --- a/source/blood/src/aiunicult.cpp +++ b/source/blood/src/aiunicult.cpp @@ -1495,7 +1495,7 @@ int getRangeAttackDist(spritetype* pSprite, int minDist, int maxDist) { } } - dist = tilesiz[picnum].y << 8; + dist = tileHeight(picnum) << 8; if (yrepeat < 64) dist -= (64 - yrepeat) * mul; else if (yrepeat > 64) dist += (yrepeat - 64) * (mul / 3); } diff --git a/source/blood/src/gameutil.cpp b/source/blood/src/gameutil.cpp index e193c27f1..ede4502aa 100644 --- a/source/blood/src/gameutil.cpp +++ b/source/blood/src/gameutil.cpp @@ -571,9 +571,6 @@ int VectorScan(spritetype *pSprite, int nOffset, int nZOffset, int dx, int dy, i if (!nSizX || !nSizY) return 0; - int potX = nSizX == (1<<(picsiz[nPicnum]&15)); - int potY = nSizY == (1<<(picsiz[nPicnum]>>4)); - nOffset = (nOffset*pWall->yrepeat) / 8; nOffset += (nSizY*pWall->ypanning) / 256; int nLength = approxDist(pWall->x - wall[pWall->point2].x, pWall->y - wall[pWall->point2].y); @@ -584,20 +581,11 @@ int VectorScan(spritetype *pSprite, int nOffset, int nZOffset, int dx, int dy, i nHOffset = approxDist(gHitInfo.hitx - pWall->x, gHitInfo.hity - pWall->y); nHOffset = pWall->xpanning + ((nHOffset*pWall->xrepeat) << 3) / nLength; - if (potX) - nHOffset &= nSizX - 1; - else - nHOffset %= nSizX; - if (potY) - nOffset &= nSizY - 1; - else - nOffset %= nSizY; + nHOffset %= nSizX; + nOffset %= nSizY; auto pData = tileLoadTile(nPicnum); int nPixel; - if (potY) - nPixel = (nHOffset<<(picsiz[nPicnum]>>4)) + nOffset; - else - nPixel = nHOffset*nSizY + nOffset; + nPixel = nHOffset*nSizY + nOffset; if (pData[nPixel] == TRANSPARENT_INDEX) { diff --git a/source/blood/src/nnexts.cpp b/source/blood/src/nnexts.cpp index c4d69a55b..5aa47df11 100644 --- a/source/blood/src/nnexts.cpp +++ b/source/blood/src/nnexts.cpp @@ -958,7 +958,7 @@ int getSpriteMassBySize(spritetype* pSprite) { } clipDist = ClipLow(pSprite->clipdist, 1); - short x = tilesiz[picnum].x; short y = tilesiz[picnum].y; + short x = tileWidth(picnum); short y = tileHeight(picnum); short xrepeat = pSprite->xrepeat; short yrepeat = pSprite->yrepeat; // take surface type into account diff --git a/source/blood/src/sectorfx.cpp b/source/blood/src/sectorfx.cpp index b948f41cc..dd38a4cf2 100644 --- a/source/blood/src/sectorfx.cpp +++ b/source/blood/src/sectorfx.cpp @@ -285,9 +285,9 @@ void DoSectorPanning(void) int py = (pSector->floorypanning<<8)+pXSector->floorYPanFrac; if (pSector->floorstat&64) angle -= 512; - int xBits = (picsiz[nTile]&15)-((pSector->floorstat&8)!=0); + int xBits = (widthBits(nTile))-((pSector->floorstat&8)!=0); px += mulscale30(speed<<2, Cos(angle))>>xBits; - int yBits = (picsiz[nTile]/16)-((pSector->floorstat&8)!=0); + int yBits = (heightBits(nTile))-((pSector->floorstat&8)!=0); py -= mulscale30(speed<<2, Sin(angle))>>yBits; pSector->floorxpanning = px>>8; pSector->floorypanning = py>>8; @@ -301,9 +301,9 @@ void DoSectorPanning(void) int py = (pSector->ceilingypanning<<8)+pXSector->ceilYPanFrac; if (pSector->ceilingstat&64) angle -= 512; - int xBits = (picsiz[nTile]&15)-((pSector->ceilingstat&8)!=0); + int xBits = (widthBits(nTile))-((pSector->ceilingstat&8)!=0); px += mulscale30(speed<<2, Cos(angle))>>xBits; - int yBits = (picsiz[nTile]/16)-((pSector->ceilingstat&8)!=0); + int yBits = (heightBits(nTile))-((pSector->ceilingstat&8)!=0); py -= mulscale30(speed<<2, Sin(angle))>>yBits; pSector->ceilingxpanning = px>>8; pSector->ceilingypanning = py>>8; @@ -330,8 +330,8 @@ void DoSectorPanning(void) int nTile = wall[nWall].picnum; int px = (wall[nWall].xpanning<<8)+pXWall->xpanFrac; int py = (wall[nWall].ypanning<<8)+pXWall->ypanFrac; - px += (psx<<2)>>((uint8_t)picsiz[nTile]&15); - py += (psy<<2)>>((uint8_t)picsiz[nTile]/16); + px += (psx << 2) >> widthBits(nTile); + py += (psy << 2) >> heightBits(nTile); wall[nWall].xpanning = px>>8; wall[nWall].ypanning = py>>8; pXWall->xpanFrac = px&255; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index eb0e2589d..5c45d02e0 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -1435,8 +1435,8 @@ int32_t animateoffs(int const tilenum, int fakevar) // globalpicnum --> globalxshift, globalyshift static void calc_globalshifts(void) { - globalxshift = (8-(picsiz[globalpicnum]&15)); - globalyshift = (8-(picsiz[globalpicnum]>>4)); + globalxshift = (8-widthBits(globalpicnum)); + globalyshift = (8-heightBits(globalpicnum)); if (globalorientation&8) { globalxshift++; globalyshift++; } // PK: the following can happen for large (>= 512) tile sizes. // NOTE that global[xy]shift are unsigned chars. @@ -3108,7 +3108,8 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) globalx2 = mulscale10(dmulscale10(ox,bakgvect.x,oy,bakgvect.y),i); globaly2 = mulscale10(dmulscale10(ox,bakgvect.y,-oy,bakgvect.x),i); - ox = picsiz[globalpicnum]; oy = ((ox>>4)&15); ox &= 15; + ox = widthBits(globalpicnum); + oy = heightBits(globalpicnum); if (pow2long[ox] != xspan) { ox++; @@ -4057,7 +4058,7 @@ int32_t spriteheightofsptr(uspriteptr_t spr, int32_t *height, int32_t alsotileyo int32_t hei, zofs=0; const int32_t picnum=spr->picnum, yrepeat=spr->yrepeat; - hei = (tilesiz[picnum].y*yrepeat)<<2; + hei = (tileHeight(picnum)*yrepeat)<<2; if (height != NULL) *height = hei; @@ -5025,7 +5026,7 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, if (!tex) { tileUpdatePicnum(&picnum, (int16_t)0xc000); - if ((tilesiz[picnum].x <= 0) || (tilesiz[picnum].y <= 0)) return; + if ((tileWidth(picnum) <= 0) || (tileHeight(picnum) <= 0)) return; if (hw_models && tile2model[picnum].hudmem[(dastat & 4) >> 2]) { polymost_dorotatespritemodel(sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, guniqhudid); diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 8db9dc459..6df7a50e8 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -1639,8 +1639,8 @@ static void polymost_internal_nonparallaxed(vec2f_t n0, vec2f_t n1, float ryp0, if (globalorientation&32) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //Texture panning - vec2f_t fxy = { global_cf_xpanning * ((float)(1 << (picsiz[globalpicnum] & 15))) * (1.0f / 256.f), - global_cf_ypanning * ((float)(1 << (picsiz[globalpicnum] >> 4))) * (1.0f / 256.f) }; + vec2f_t fxy = { global_cf_xpanning * ((float)(1 << widthBits(globalpicnum))) * (1.0f / 256.f), + global_cf_ypanning * ((float)(1 << heightBits(globalpicnum))) * (1.0f / 256.f) }; if ((globalorientation&(2+64)) == (2+64)) //Hack for panning for slopes w/ relative alignment { @@ -1761,7 +1761,7 @@ static void calc_ypanning(int32_t refposz, float ryp0, float ryp1, float const t0 = ((float)(refposz-globalposz))*ryp0 + ghoriz; float const t1 = ((float)(refposz-globalposz))*ryp1 + ghoriz; float t = (float(xtex.d*x0 + otex.d) * (float)yrepeat) / ((x1-x0) * ryp0 * 2048.f); - int i = (1<<(picsiz[globalpicnum]>>4)); + int i = 1<< heightBits(globalpicnum); if (i < tilesize.y) i <<= 1; @@ -1892,10 +1892,10 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i float const dd = fxdimen*.0000001f; //Adjust sky depth based on screen size! float vv[2]; - float t = (float)((1<<(picsiz[globalpicnum]&15))<>1)+dapyoffs)) - vv[1]*ghoriz; - int ti = (1<<(picsiz[globalpicnum]>>4)); if (ti != tilesiz.y) ti += ti; + int ti = (1<<(heightBits(globalpicnum))); if (ti != tilesiz.y) ti += ti; vec3f_t o; skyclamphack = 0; @@ -1916,7 +1916,7 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i if (xys[i].x > x1) x1 = xys[i].x; } - int const npot = (1<<(picsiz[globalpicnum]&15)) != tilesiz.x; + int const npot = (1<<(widthBits(globalpicnum))) != tileWidth(globalpicnum); int const xpanning = (hw_parallaxskypanning?global_cf_xpanning:0); GLInterface.SetClamp((npot || xpanning != 0) ? 0 : 2); diff --git a/source/core/rendering/gl/renderer/gl_postprocess.cpp b/source/core/rendering/gl/renderer/gl_postprocess.cpp index 8f2f024e7..2c7afe0ad 100644 --- a/source/core/rendering/gl/renderer/gl_postprocess.cpp +++ b/source/core/rendering/gl/renderer/gl_postprocess.cpp @@ -35,6 +35,7 @@ #include "hwrenderer/data/flatvertices.h" #include "r_videoscale.h" #include "v_video.h" +#include "templates.h" extern bool vid_hdr_active; diff --git a/source/core/rendering/gl/renderer/gl_renderbuffers.cpp b/source/core/rendering/gl/renderer/gl_renderbuffers.cpp index 1aaa6cd3a..bdc7ca5f1 100644 --- a/source/core/rendering/gl/renderer/gl_renderbuffers.cpp +++ b/source/core/rendering/gl/renderer/gl_renderbuffers.cpp @@ -30,6 +30,7 @@ #include "gl/renderer/gl_postprocessstate.h" #include "gl/shaders/gl_shaderprogram.h" #include "gl/system/gl_buffers.h" +#include "templates.h" #include EXTERN_CVAR(Int, gl_debug_level) diff --git a/source/core/rendering/hwrenderer/postprocessing/hw_postprocess.cpp b/source/core/rendering/hwrenderer/postprocessing/hw_postprocess.cpp index b6e0a2092..37f000db9 100644 --- a/source/core/rendering/hwrenderer/postprocessing/hw_postprocess.cpp +++ b/source/core/rendering/hwrenderer/postprocessing/hw_postprocess.cpp @@ -28,6 +28,7 @@ #include "hwrenderer/postprocessing/hw_postprocess_cvars.h" #include "palutil.h" #include "palettecontainer.h" +#include "vectors.h" #include Postprocess hw_postprocess; @@ -272,7 +273,7 @@ void PPBloom::BlurStep(PPRenderState *renderstate, const BlurUniforms &blurUnifo float PPBloom::ComputeBlurGaussian(float n, float theta) // theta = Blur Amount { - return (float)((1.0f / sqrtf(2 * (float)M_PI * theta)) * expf(-(n * n) / (2.0f * theta * theta))); + return (float)((1.0f / sqrtf(2 * pi::pif() * theta)) * expf(-(n * n) / (2.0f * theta * theta))); } void PPBloom::ComputeBlurSamples(int sampleCount, float blurAmount, float *sampleWeights) @@ -610,7 +611,7 @@ PPAmbientOcclusion::PPAmbientOcclusion() for (int i = 0; i < 16; i++) { - double angle = 2.0 * M_PI * distribution(generator) / numDirections[quality]; + double angle = 2.0 * pi::pi() * distribution(generator) / numDirections[quality]; double x = cos(angle); double y = sin(angle); double z = distribution(generator); diff --git a/source/core/textures/buildtiles.cpp b/source/core/textures/buildtiles.cpp index 27e143d3e..1698e8282 100644 --- a/source/core/textures/buildtiles.cpp +++ b/source/core/textures/buildtiles.cpp @@ -898,4 +898,3 @@ void tileCopySection(int tilenum1, int sx1, int sy1, int xsiz, int ysiz, int til TileSiz tilesiz; PicAnm picanm; -PicSiz picsiz; diff --git a/source/core/textures/textures.h b/source/core/textures/textures.h index c07cdbf8b..83da80c0a 100644 --- a/source/core/textures/textures.h +++ b/source/core/textures/textures.h @@ -639,15 +639,36 @@ struct PicAnm }; extern PicAnm picanm; -struct PicSiz +// Helpers to read the refactored tilesiz array. +inline int tileWidth(int num) { - uint8_t operator[](size_t index) - { - assert(index < MAXTILES); - return TileFiles.tiles[index]->GetPicSize(); - } -}; -extern PicSiz picsiz; + return tilesiz[num].x; +} + +inline int tileHeight(int num) +{ + return tilesiz[num].y; +} + +inline int widthBits(int num) +{ + int w = tileWidth(num); + int j = 15; + + while ((j > 1) && ((1 << j) > w)) + j--; + return j; +} + +inline int heightBits(int num) +{ + int w = tileHeight(num); + int j = 15; + + while ((j > 1) && ((1 << j) > w)) + j--; + return j; +} inline rottile_t& RotTile(int tile) { diff --git a/source/duke3d/src/gamevars.cpp b/source/duke3d/src/gamevars.cpp index 9f685c6b0..fccee3c2b 100644 --- a/source/duke3d/src/gamevars.cpp +++ b/source/duke3d/src/gamevars.cpp @@ -1135,16 +1135,6 @@ void Gv_FinalizeWeaponDefaults(void) static int32_t lastvisinc; #endif -// Helpers to read the refactored tilesiz array. -static int tileWidth(int num) -{ - return tilesiz[num].x; -} - -static int tileHeight(int num) -{ - return tilesiz[num].y; -} static void Gv_AddSystemVars(void) { diff --git a/source/glbackend/gl_palmanager.cpp b/source/glbackend/gl_palmanager.cpp index c790e2b0a..1ec56db5a 100644 --- a/source/glbackend/gl_palmanager.cpp +++ b/source/glbackend/gl_palmanager.cpp @@ -87,8 +87,6 @@ void PaletteManager::DeleteAll() lastsindex = ~0u; memset(palettemap, 0, sizeof(palettemap)); memset(palswapmap, 0, sizeof(palswapmap)); - memset(addshade, 0, sizeof(addshade)); - memset(mulshade, 0, sizeof(mulshade)); numshades = 1; diff --git a/source/glbackend/glbackend.h b/source/glbackend/glbackend.h index cdab778d0..ca71d2fa5 100644 --- a/source/glbackend/glbackend.h +++ b/source/glbackend/glbackend.h @@ -29,12 +29,6 @@ struct PaletteData FHardwareTexture* paltexture; }; -struct PalShade -{ - int palindex; - float mulshade, addshade; -}; - struct PalswapData { int32_t crc32; @@ -55,8 +49,6 @@ class PaletteManager // The current engine limit is 256 palettes and 256 palswaps. uint32_t palettemap[256] = {}; uint32_t palswapmap[256] = {}; - float addshade[256] = {}; - float mulshade[256] = {}; uint32_t lastindex = ~0u; uint32_t lastsindex = ~0u; int numshades = 1; diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index acb0b825e..2078c7f3d 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -1247,7 +1247,7 @@ void G_InitRRRASkies(void) if (sector[i].ceilingpicnum != LA && sector[i].ceilingpicnum != MOONSKY1 && sector[i].ceilingpicnum != BIGORBIT1) { int const picnum = sector[i].ceilingpicnum; - if (tilesiz[picnum].x == 512) + if (tileWidth(picnum) == 512) { psky_t *sky = tileSetupSky(picnum); sky->horizfrac = 32768; @@ -1255,7 +1255,7 @@ void G_InitRRRASkies(void) sky->tileofs[0] = 0; sky->tileofs[1] = 0; } - else if (tilesiz[picnum].x == 1024) + else if (tileWidth(picnum) == 1024) { psky_t *sky = tileSetupSky(picnum); sky->horizfrac = 32768; diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index c2ef56e02..177bfbbe4 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -1315,7 +1315,7 @@ InitWeaponSword(PLAYERp pp) if (!pp->Wpn[WPN_SWORD]) { psp = pp->Wpn[WPN_SWORD] = pSpawnSprite(pp, ps_PresentSword, PRI_MID, SWORD_XOFF, SWORD_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[WPN_SWORD]) @@ -1448,7 +1448,7 @@ pSwordSlideDown(PANEL_SPRITEp psp) pSetState(psp, psp->PresentState); psp->x = SWORD_XOFF; psp->y = SWORD_YOFF; - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); psp->yorig = psp->y; } } @@ -1528,7 +1528,7 @@ pSwordSlideDownR(PANEL_SPRITEp psp) pSetState(psp, psp->PresentState); psp->x = SWORD_XOFF; psp->y = SWORD_YOFF; - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); psp->yorig = psp->y; } } @@ -1554,9 +1554,9 @@ pSwordHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= SWORD_YOFF + tilesiz[picnum].y) + if (psp->y >= SWORD_YOFF + tileHeight(picnum)) { - psp->y = SWORD_YOFF + tilesiz[picnum].y; + psp->y = SWORD_YOFF + tileHeight(picnum); psp->x = SWORD_XOFF; pWeaponUnHideKeys(psp, psp->PresentState); @@ -1642,7 +1642,7 @@ pSwordRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= SWORD_YOFF + tilesiz[picnum].y) + if (psp->y >= SWORD_YOFF + tileHeight(picnum)) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); psp->PlayerP->Wpn[WPN_SWORD] = NULL; @@ -1782,7 +1782,7 @@ InitWeaponStar(PLAYERp pp) if (!pp->Wpn[WPN_STAR]) { psp = pp->Wpn[WPN_STAR] = pSpawnSprite(pp, ps_PresentStar, PRI_MID, STAR_XOFF, STAR_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[WPN_STAR]) @@ -1871,9 +1871,9 @@ pStarHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= STAR_YOFF + tilesiz[picnum].y) + if (psp->y >= STAR_YOFF + tileHeight(picnum)) { - psp->y = STAR_YOFF + tilesiz[picnum].y; + psp->y = STAR_YOFF + tileHeight(picnum); pWeaponUnHideKeys(psp, psp->PresentState); } @@ -1934,7 +1934,7 @@ pStarRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= STAR_YOFF + tilesiz[picnum].y) + if (psp->y >= STAR_YOFF + tileHeight(picnum)) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); @@ -2452,7 +2452,7 @@ InitWeaponUzi(PLAYERp pp) if (!pp->Wpn[WPN_UZI]) { psp = pp->Wpn[WPN_UZI] = pSpawnSprite(pp, ps_PresentUzi, PRI_MID, 160 + UZI_XOFF, UZI_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } // if Current weapon is uzi @@ -2653,9 +2653,9 @@ pUziHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= 200 + tilesiz[picnum].y) + if (psp->y >= 200 + tileHeight(picnum)) { - psp->y = 200 + tilesiz[picnum].y; + psp->y = 200 + tileHeight(picnum); if (TEST(psp->flags, PANF_PRIMARY) && psp->PlayerP->WpnUziType != 1) { @@ -2811,7 +2811,7 @@ pUziRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= 200 + tilesiz[picnum].y) + if (psp->y >= 200 + tileHeight(picnum)) { // if in the reload phase and its retracting then get rid of uzi // no matter whether it is PRIMARY/SECONDARY/neither. @@ -2904,7 +2904,7 @@ SpawnUziShell(PANEL_SPRITEp psp) } SET(shell->flags, PANF_WEAPON_SPRITE); - shell->y = shell->yorig = psp->y - tilesiz[psp->picndx].y + 20; + shell->y = shell->yorig = psp->y - tileHeight(psp->picndx) + 20; shell->sin_ndx = 0; shell->sin_amt = 13 + RANDOM_P2(8); @@ -3019,7 +3019,7 @@ SpawnShotgunShell(PANEL_SPRITEp psp) shell = pSpawnSprite(pp, ps_ShotgunShell, PRI_FRONT, 0, 0); shell->x = psp->x + 25; - shell->y = shell->yorig = psp->y - tilesiz[psp->picndx].y + 85; + shell->y = shell->yorig = psp->y - tileHeight(psp->picndx) + 85; shell->xspeed = ss->lo_xspeed + (RANDOM_RANGE((ss->hi_xspeed - ss->lo_xspeed)>>4) << 4); SET(shell->flags, PANF_WEAPON_SPRITE); @@ -3188,7 +3188,7 @@ InitWeaponShotgun(PLAYERp pp) if (!pp->Wpn[pp->WeaponType]) { psp = pp->Wpn[pp->WeaponType] = pSpawnSprite(pp, ps_PresentShotgun, PRI_MID, SHOTGUN_XOFF, SHOTGUN_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[pp->WeaponType]) @@ -3293,11 +3293,11 @@ pShotgunReloadDown(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= SHOTGUN_YOFF + (tilesiz[picnum].y/2)) + if (psp->y >= SHOTGUN_YOFF + (tileHeight(picnum)/2)) { PlaySound(DIGI_ROCKET_UP, psp->PlayerP,v3df_follow|v3df_dontpan|v3df_doppler); - psp->y = SHOTGUN_YOFF + (tilesiz[picnum].y/2); + psp->y = SHOTGUN_YOFF + (tileHeight(picnum)/2); pStatePlusOne(psp); } @@ -3408,9 +3408,9 @@ pShotgunHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= SHOTGUN_YOFF + tilesiz[picnum].y) + if (psp->y >= SHOTGUN_YOFF + tileHeight(picnum)) { - psp->y = SHOTGUN_YOFF + tilesiz[picnum].y; + psp->y = SHOTGUN_YOFF + tileHeight(picnum); pWeaponUnHideKeys(psp, psp->PresentState); } @@ -3542,7 +3542,7 @@ pShotgunRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= SHOTGUN_YOFF + tilesiz[picnum].y + 50) + if (psp->y >= SHOTGUN_YOFF + tileHeight(picnum) + 50) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); psp->PlayerP->Wpn[psp->WeaponType] = NULL; @@ -3699,7 +3699,7 @@ InitWeaponRail(PLAYERp pp) if (!pp->Wpn[pp->WeaponType]) { psp = pp->Wpn[pp->WeaponType] = pSpawnSprite(pp, ps_PresentRail, PRI_MID, RAIL_XOFF, RAIL_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[pp->WeaponType]) @@ -3832,9 +3832,9 @@ pRailHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= RAIL_YOFF + tilesiz[picnum].y) + if (psp->y >= RAIL_YOFF + tileHeight(picnum)) { - psp->y = RAIL_YOFF + tilesiz[picnum].y; + psp->y = RAIL_YOFF + tileHeight(picnum); pWeaponUnHideKeys(psp, psp->PresentState); } @@ -3938,7 +3938,7 @@ pRailRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= RAIL_YOFF + tilesiz[picnum].y + 50) + if (psp->y >= RAIL_YOFF + tileHeight(picnum) + 50) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); psp->PlayerP->Wpn[psp->WeaponType] = NULL; @@ -4149,7 +4149,7 @@ InitWeaponHothead(PLAYERp pp) if (!pp->Wpn[WPN_HOTHEAD]) { psp = pp->Wpn[WPN_HOTHEAD] = pSpawnSprite(pp, ps_PresentHothead, PRI_MID, HOTHEAD_XOFF, HOTHEAD_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[WPN_HOTHEAD]) @@ -4252,10 +4252,10 @@ pHotheadHide(PANEL_SPRITEp psp) psp->x += 3 * synctics; - if (psp->x >= HOTHEAD_XOFF + tilesiz[picnum].x || psp->y >= HOTHEAD_YOFF + tilesiz[picnum].y) + if (psp->x >= HOTHEAD_XOFF + tileWidth(picnum) || psp->y >= HOTHEAD_YOFF + tileHeight(picnum)) { psp->x = HOTHEAD_XOFF; - psp->y = HOTHEAD_YOFF + tilesiz[picnum].y; + psp->y = HOTHEAD_YOFF + tileHeight(picnum); pWeaponUnHideKeys(psp, psp->PresentState); } @@ -4352,7 +4352,7 @@ pHotheadRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= HOTHEAD_YOFF + tilesiz[picnum].y) + if (psp->y >= HOTHEAD_YOFF + tileHeight(picnum)) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); psp->PlayerP->Wpn[WPN_HOTHEAD] = NULL; @@ -4589,7 +4589,7 @@ InitWeaponMicro(PLAYERp pp) if (!pp->Wpn[WPN_MICRO]) { psp = pp->Wpn[WPN_MICRO] = pSpawnSprite(pp, ps_PresentMicro, PRI_MID, MICRO_XOFF, MICRO_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[WPN_MICRO]) @@ -4732,9 +4732,9 @@ pMicroHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= MICRO_YOFF + tilesiz[picnum].y + 20) + if (psp->y >= MICRO_YOFF + tileHeight(picnum) + 20) { - psp->y = MICRO_YOFF + tilesiz[picnum].y + 20; + psp->y = MICRO_YOFF + tileHeight(picnum) + 20; psp->x = MICRO_XOFF; pWeaponUnHideKeys(psp, psp->PresentState); @@ -4951,7 +4951,7 @@ pMicroRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= MICRO_YOFF + tilesiz[picnum].y) + if (psp->y >= MICRO_YOFF + tileHeight(picnum)) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); psp->PlayerP->Wpn[WPN_MICRO] = NULL; @@ -5088,7 +5088,7 @@ InitWeaponHeart(PLAYERp pp) if (!pp->Wpn[WPN_HEART]) { psp = pp->Wpn[WPN_HEART] = pSpawnSprite(pp, ps_PresentHeart, PRI_MID, 160 + 10, HEART_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[WPN_HEART]) @@ -5153,9 +5153,9 @@ pHeartHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= HEART_YOFF + tilesiz[picnum].y) + if (psp->y >= HEART_YOFF + tileHeight(picnum)) { - psp->y = HEART_YOFF + tilesiz[picnum].y; + psp->y = HEART_YOFF + tileHeight(picnum); pWeaponUnHideKeys(psp, psp->PresentState); } @@ -5259,7 +5259,7 @@ pHeartRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= HEART_YOFF + tilesiz[picnum].y) + if (psp->y >= HEART_YOFF + tileHeight(picnum)) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); psp->PlayerP->Wpn[WPN_HEART] = NULL; @@ -5585,7 +5585,7 @@ InitWeaponGrenade(PLAYERp pp) if (!pp->Wpn[WPN_GRENADE]) { psp = pp->Wpn[WPN_GRENADE] = pSpawnSprite(pp, ps_PresentGrenade, PRI_MID, GRENADE_XOFF, GRENADE_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[WPN_GRENADE]) @@ -5634,10 +5634,10 @@ pGrenadeRecoilDown(PANEL_SPRITEp psp) psp->vel -= 24 * synctics; - // if (psp->y >= GRENADE_YOFF + tilesiz[picnum].y) + // if (psp->y >= GRENADE_YOFF + tileHeight(picnum)) if (psp->vel < 400) { - // psp->y = GRENADE_YOFF + tilesiz[picnum].y; + // psp->y = GRENADE_YOFF + tileHeight(picnum); psp->vel = 400; psp->ang = NORM_ANGLE(psp->ang + 1024); @@ -5728,9 +5728,9 @@ pGrenadeHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= GRENADE_YOFF + tilesiz[picnum].y) + if (psp->y >= GRENADE_YOFF + tileHeight(picnum)) { - psp->y = GRENADE_YOFF + tilesiz[picnum].y; + psp->y = GRENADE_YOFF + tileHeight(picnum); psp->x = GRENADE_XOFF; pGrenadePresentSetup(psp); @@ -5789,7 +5789,7 @@ pGrenadeRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= GRENADE_YOFF + tilesiz[picnum].y) + if (psp->y >= GRENADE_YOFF + tileHeight(picnum)) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); psp->PlayerP->Wpn[WPN_GRENADE] = NULL; @@ -5874,7 +5874,7 @@ InitWeaponMine(PLAYERp pp) if (!pp->Wpn[WPN_MINE]) { psp = pp->Wpn[WPN_MINE] = pSpawnSprite(pp, ps_PresentMine, PRI_MID, MINE_XOFF, MINE_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[WPN_MINE]) @@ -5915,11 +5915,11 @@ pMineLower(PANEL_SPRITEp psp) { psp->y += 4 * synctics; - if (psp->y > MINE_YOFF + tilesiz[psp->picndx].y) + if (psp->y > MINE_YOFF + tileHeight(psp->picndx)) { if (!WeaponOK(psp->PlayerP)) return; - psp->y = MINE_YOFF + tilesiz[psp->picndx].y; + psp->y = MINE_YOFF + tileHeight(psp->picndx); pStatePlusOne(psp); } } @@ -5974,9 +5974,9 @@ pMineHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= MINE_YOFF + tilesiz[picnum].y) + if (psp->y >= MINE_YOFF + tileHeight(picnum)) { - psp->y = MINE_YOFF + tilesiz[picnum].y; + psp->y = MINE_YOFF + tileHeight(picnum); psp->x = MINE_XOFF; pWeaponUnHideKeys(psp, psp->PresentState); @@ -6032,7 +6032,7 @@ pMineRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= MINE_YOFF + tilesiz[picnum].y) + if (psp->y >= MINE_YOFF + tileHeight(picnum)) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); psp->PlayerP->Wpn[WPN_MINE] = NULL; @@ -6141,7 +6141,7 @@ InitChops(PLAYERp pp) if (!pp->Chops) { psp = pp->Chops = pSpawnSprite(pp, ps_ChopsAttack1, PRI_MID, CHOPS_XOFF, CHOPS_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (Prediction) @@ -6256,7 +6256,7 @@ pChopsRetract(PANEL_SPRITEp psp) psp->y += 6 * synctics; - if (psp->y >= CHOPS_YOFF + tilesiz[picnum].y) + if (psp->y >= CHOPS_YOFF + tileHeight(picnum)) { if (RANDOM_RANGE(1000) > 800) PlayerSound(DIGI_GETTINGSTIFF,v3df_follow|v3df_dontpan,psp->PlayerP); @@ -6541,7 +6541,7 @@ InitWeaponFist(PLAYERp pp) if (!pp->Wpn[WPN_FIST]) { psp = pp->Wpn[WPN_FIST] = pSpawnSprite(pp, ps_PresentFist, PRI_MID, FIST_XOFF, FIST_YOFF); - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); } if (pp->CurWpn == pp->Wpn[WPN_FIST]) @@ -6734,7 +6734,7 @@ pFistSlideDown(PANEL_SPRITEp psp) pSetState(psp, psp->PresentState); psp->x = FIST_XOFF; psp->y = FIST_YOFF; - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); psp->yorig = psp->y; } } @@ -6863,7 +6863,7 @@ pFistSlideDownR(PANEL_SPRITEp psp) pSetState(psp, psp->PresentState); psp->x = FIST_XOFF; psp->y = FIST_YOFF; - psp->y += tilesiz[psp->picndx].y; + psp->y += tileHeight(psp->picndx); psp->yorig = psp->y; } } @@ -6889,9 +6889,9 @@ pFistHide(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= FIST_YOFF + tilesiz[picnum].y) + if (psp->y >= FIST_YOFF + tileHeight(picnum)) { - psp->y = FIST_YOFF + tilesiz[picnum].y; + psp->y = FIST_YOFF + tileHeight(picnum); pWeaponUnHideKeys(psp, psp->PresentState); } @@ -6994,7 +6994,7 @@ pFistRetract(PANEL_SPRITEp psp) psp->y += 3 * synctics; - if (psp->y >= FIST_YOFF + tilesiz[picnum].y) + if (psp->y >= FIST_YOFF + tileHeight(picnum)) { RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT); psp->PlayerP->Wpn[WPN_FIST] = NULL;