- did some global search & replace to reduce the number of accesses to the tilesiz wrapper.

This commit is contained in:
Christoph Oelckers 2020-11-20 08:18:26 +01:00
parent 9a43886be6
commit b97f12a2eb
8 changed files with 44 additions and 44 deletions

View file

@ -1476,11 +1476,11 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32
if (tileLoad(tilenum))
{
// daz-intz > 0 && daz-intz < k
int32_t xtex = mulscale16(ucoefup16, tilesiz[tilenum].x);
int32_t xtex = mulscale16(ucoefup16, tileWidth(tilenum));
int32_t vcoefup16 = 65536-divscale16(daz-intz, k);
int32_t ytex = mulscale16(vcoefup16, tilesiz[tilenum].y);
int32_t ytex = mulscale16(vcoefup16, tileHeight(tilenum));
auto texel = (tilePtr(tilenum) + tilesiz[tilenum].y*xtex + ytex);
auto texel = (tilePtr(tilenum) + tileHeight(tilenum)*xtex + ytex);
if (*texel == TRANSPARENT_INDEX)
continue;
}

View file

@ -199,7 +199,7 @@ static inline void get_wallspr_points(T const * const spr, int32_t *x1, int32_t
dax = sintable[ang&2047]*xrepeat;
day = sintable[(ang+1536)&2047]*xrepeat;
l = tilesiz[tilenum].x;
l = tileWidth(tilenum);
k = (l>>1)+xoff;
*x1 -= mulscale16(dax,k);
@ -220,7 +220,7 @@ static inline void get_floorspr_points(T const * const spr, int32_t px, int32_t
const int32_t cosang = sintable[(spr->ang+512)&2047];
const int32_t sinang = sintable[spr->ang&2047];
vec2_t const span = { tilesiz[tilenum].x, tilesiz[tilenum].y};
vec2_t const span = { tileWidth(tilenum), tileHeight(tilenum)};
vec2_t const repeat = { spr->xrepeat, spr->yrepeat };
vec2_t adjofs = { tileLeftOffset(tilenum) + spr->xoffset, tileTopOffset(tilenum) + spr->yoffset };

View file

@ -472,7 +472,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
l = spr->xrepeat;
dax = sintable[k & 2047] * l;
day = sintable[(k + 1536) & 2047] * l;
l = tilesiz[tilenum].x;
l = tileWidth(tilenum);
k = (l >> 1) + xoff;
x1 -= mulscale16(dax, k);
x2 = x1 + mulscale16(dax, l);
@ -505,9 +505,9 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
k = spr->ang;
cosang = sintable[(k + 512) & 2047];
sinang = sintable[k & 2047];
xspan = tilesiz[tilenum].x;
xspan = tileWidth(tilenum);
xrepeat = spr->xrepeat;
yspan = tilesiz[tilenum].y;
yspan = tileHeight(tilenum);
yrepeat = spr->yrepeat;
dax = ((xspan >> 1) + xoff) * xrepeat;

View file

@ -338,7 +338,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
if (aimed)
{
int dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1) + (5 << 8);
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (5 << 8);
switch (aimed->s.picnum)
{
case GREENSLIME:
@ -590,7 +590,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
if (aimed)
{
int dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1) - (12 << 8);
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) - (12 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}
@ -688,7 +688,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
aimed = aim(actor, 48);
if (aimed)
{
int dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1) + (8 << 8);
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (8 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
if (aimed->s.picnum != RECON)
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
@ -925,7 +925,7 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
auto aimed = aim(actor, AUTO_AIM_ANGLE);
if (aimed)
{
int dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1) + (5 << 8);
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (5 << 8);
switch (aimed->s.picnum)
{
case GREENSLIME:
@ -1145,7 +1145,7 @@ void shoot_d(DDukeActor* actor, int atwith)
auto aimed = isNamWW2GI() ? nullptr : aim(actor, AUTO_AIM_ANGLE);
if (aimed)
{
dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1);
dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1);
zvel = ((aimed->s.z - sz - dal - (4 << 8)) * 768) / (ldist(ps[p].GetActor(), aimed));
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}

View file

@ -226,7 +226,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
auto aimed = aim(actor, AUTO_AIM_ANGLE);
if (aimed)
{
int dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1) + (5 << 8);
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (5 << 8);
zvel = ((aimed->s.z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}
@ -514,7 +514,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
{
sx += sintable[(s->ang + 512 + 160) & 2047] >> 7;
sy += sintable[(s->ang + 160) & 2047] >> 7;
int dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1) - (12 << 8);
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) - (12 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}
@ -631,7 +631,7 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
else
act90 = aimed;
}
int dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1) + (8 << 8);
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (8 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
if (aimed->s.picnum != RECON)
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
@ -785,7 +785,7 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
if (aimed)
{
int dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1) - (12 << 8);
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) - (12 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}

View file

@ -824,7 +824,7 @@ int spawn_r(int j, int pn)
sp->xrepeat = 22;
sp->yrepeat = 20;
}
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case HULKHANG:
case HULKHANGDEAD:
@ -833,14 +833,14 @@ int spawn_r(int j, int pn)
case HULKSTAYPUT:
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case COOTPLAY:
case COOT:
case COOTSTAYPUT:
sp->xrepeat = 24;
sp->yrepeat = 18;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist <<= 2;
break;
case DRONE:
@ -857,12 +857,12 @@ int spawn_r(int j, int pn)
case BUBBASTAND:
sp->xrepeat = 25;
sp->yrepeat = 21;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case COW:
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case HEN:
case HENSTAYPUT:
@ -871,7 +871,7 @@ int spawn_r(int j, int pn)
{
sp->xrepeat = 42;
sp->yrepeat = 30;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
}
else
{
@ -884,7 +884,7 @@ int spawn_r(int j, int pn)
case MINIONSTAYPUT:
sp->xrepeat = 16;
sp->yrepeat = 16;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
if (isRRRA() && ufospawnsminion)
sp->pal = 8;
break;
@ -892,12 +892,12 @@ int spawn_r(int j, int pn)
case PIG:
sp->xrepeat = 16;
sp->yrepeat = 16;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case RABBIT:
sp->xrepeat = 18;
sp->yrepeat = 18;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case MAMACLOUD:
sp->xrepeat = 64;
@ -947,7 +947,7 @@ int spawn_r(int j, int pn)
case BIKER:
sp->xrepeat = 28;
sp->yrepeat = 22;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case CHEERB:
sp->xrepeat = 28;
@ -958,46 +958,46 @@ int spawn_r(int j, int pn)
case CHEERSTAYPUT:
sp->xrepeat = 20;
sp->yrepeat = 20;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case MAKEOUT:
sp->xrepeat = 26;
sp->yrepeat = 26;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case MINIONBOAT:
sp->xrepeat = 16;
sp->yrepeat = 16;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case HULKBOAT:
sp->xrepeat = 48;
sp->yrepeat = 48;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case CHEERBOAT:
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case TORNADO:
sp->xrepeat = 64;
sp->yrepeat = 128;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist >>= 2;
sp->cstat = 2;
break;
case LTH:
sp->xrepeat = 24;
sp->yrepeat = 22;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case ROCK:
case ROCK2:
sp->xrepeat = 64;
sp->yrepeat = 64;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
case UFO1_RRRA:
@ -1008,13 +1008,13 @@ int spawn_r(int j, int pn)
case UFO5:
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->extra = 50;
break;
case SBMOVE:
sp->xrepeat = 48;
sp->yrepeat = 48;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
break;
default:
@ -1409,7 +1409,7 @@ int spawn_r(int j, int pn)
sp->pal = 0;
sp->xrepeat = 18;
sp->yrepeat = 18;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
act->saved_ammo = 100;
sp->cstat = 257;
sp->lotag = 1;
@ -1425,7 +1425,7 @@ int spawn_r(int j, int pn)
sp->pal = 0;
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
act->saved_ammo = 20;
sp->cstat = 257;
sp->lotag = 1;

View file

@ -1986,7 +1986,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
l = spr->xrepeat;
dax = sintable[k & 2047] * l;
day = sintable[(k + 1536) & 2047] * l;
l = tilesiz[tilenum].x;
l = tileWidth(tilenum);
k = (l >> 1) + xoff;
x1 -= mulscale16(dax, k);
x2 = x1 + mulscale16(dax, l);
@ -2021,9 +2021,9 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
k = spr->ang;
cosang = sintable[(k + 512) & 2047];
sinang = sintable[k];
xspan = tilesiz[tilenum].x;
xspan = tileWidth(tilenum);
xrepeat = spr->xrepeat;
yspan = tilesiz[tilenum].y;
yspan = tileHeight(tilenum);
yrepeat = spr->yrepeat;
dax = ((xspan >> 1) + xoff) * xrepeat;

View file

@ -4787,9 +4787,9 @@ getzrangepoint(int x, int y, int z, short sectnum,
// These points will already have (x,y) subtracted from them
cosang = sintable[NORM_ANGLE(spr->ang + 512)];
sinang = sintable[spr->ang];
xspan = tilesiz[tilenum].x;
xspan = tileWidth(tilenum);
dax = ((xspan >> 1) + xoff) * spr->xrepeat;
yspan = tilesiz[tilenum].y;
yspan = tileHeight(tilenum);
day = ((yspan >> 1) + yoff) * spr->yrepeat;
x1 = spr->x + dmulscale16(sinang, dax, cosang, day) - x;
y1 = spr->y + dmulscale16(sinang, day, -cosang, dax) - y;