- renamed most non-sprite xrepeat and yrepeat as refactpring aid.

These will be renamed back later but now they create too much search noise.
A few local variables have been permanently renamed to scale*.
This commit is contained in:
Christoph Oelckers 2022-10-06 00:18:06 +02:00
parent c678298141
commit 91c318b708
17 changed files with 85 additions and 85 deletions

View file

@ -482,18 +482,18 @@ size_t DCoreActor::PropagateMark()
int DCoreActor::GetOffsetAndHeight(int& height)
{
int yrepeat = spr.yrepeat << 2;
height = tileHeight(spr.picnum) * yrepeat;
int _yrepeat = spr.yrepeat << 2;
height = tileHeight(spr.picnum) * _yrepeat;
int zofs = (spr.cstat & CSTAT_SPRITE_YCENTER)? height >> 1 : 0;
return zofs - tileTopOffset(spr.picnum) * yrepeat;
return zofs - tileTopOffset(spr.picnum) * _yrepeat;
}
double DCoreActor::GetOffsetAndHeight(double& height)
{
double yrepeat = spr.ScaleY();
height = tileHeight(spr.picnum) * yrepeat;
double _yrepeat = spr.ScaleY();
height = tileHeight(spr.picnum) * _yrepeat;
double zofs = (spr.cstat & CSTAT_SPRITE_YCENTER) ? height * 0.5 : 0;
return zofs - tileTopOffset(spr.picnum) * yrepeat;
return zofs - tileTopOffset(spr.picnum) * _yrepeat;
}

View file

@ -249,25 +249,25 @@ void TGetFlatSpritePosition(const spritetypebase* spr, const DVector2& pos, DVec
double width, height, leftofs, topofs;
double sloperatio = sqrt(heinum * heinum + SLOPEVAL_FACTOR * SLOPEVAL_FACTOR) * (1. / SLOPEVAL_FACTOR);
double xrepeat = spr->ScaleX();
double yrepeat = spr->ScaleY();
double _xrepeat = spr->ScaleX();
double _yrepeat = spr->ScaleY();
int xo = heinum ? 0 : spr->xoffset;
int yo = heinum ? 0 : spr->yoffset;
if (render && hw_hightile && TileFiles.tiledata[spr->picnum].hiofs.xsize)
{
width = TileFiles.tiledata[spr->picnum].hiofs.xsize * xrepeat;
height = TileFiles.tiledata[spr->picnum].hiofs.ysize * yrepeat;
leftofs = (TileFiles.tiledata[spr->picnum].hiofs.xoffs + xo) * xrepeat;
topofs = (TileFiles.tiledata[spr->picnum].hiofs.yoffs + yo) * yrepeat;
width = TileFiles.tiledata[spr->picnum].hiofs.xsize * _xrepeat;
height = TileFiles.tiledata[spr->picnum].hiofs.ysize * _yrepeat;
leftofs = (TileFiles.tiledata[spr->picnum].hiofs.xoffs + xo) * _xrepeat;
topofs = (TileFiles.tiledata[spr->picnum].hiofs.yoffs + yo) * _yrepeat;
}
else
{
width = (int)tex->GetDisplayWidth() * xrepeat;
height = (int)tex->GetDisplayHeight() * yrepeat;
leftofs = ((int)tex->GetDisplayLeftOffset() + xo) * xrepeat;
topofs = ((int)tex->GetDisplayTopOffset() + yo) * yrepeat;
width = (int)tex->GetDisplayWidth() * _xrepeat;
height = (int)tex->GetDisplayHeight() * _yrepeat;
leftofs = ((int)tex->GetDisplayLeftOffset() + xo) * _xrepeat;
topofs = ((int)tex->GetDisplayTopOffset() + yo) * _yrepeat;
}
if (spr->cstat & CSTAT_SPRITE_XFLIP) leftofs = -leftofs;

View file

@ -191,8 +191,8 @@ static void ReadWallV7(FileReader& fr, walltype& wall)
wall.overpicnum = fr.ReadInt16();
wall.shade = fr.ReadInt8();
wall.pal = fr.ReadUInt8();
wall.xrepeat = fr.ReadUInt8();
wall.yrepeat = fr.ReadUInt8();
wall._xrepeat = fr.ReadUInt8();
wall._yrepeat = fr.ReadUInt8();
wall.xpan_ = fr.ReadUInt8();
wall.ypan_ = fr.ReadUInt8();
wall.lotag = fr.ReadInt16();
@ -213,8 +213,8 @@ static void ReadWallV6(FileReader& fr, walltype& wall)
wall.shade = fr.ReadInt8();
wall.pal = fr.ReadUInt8();
wall.cstat = EWallFlags::FromInt(fr.ReadUInt16());
wall.xrepeat = fr.ReadUInt8();
wall.yrepeat = fr.ReadUInt8();
wall._xrepeat = fr.ReadUInt8();
wall._yrepeat = fr.ReadUInt8();
wall.xpan_ = fr.ReadUInt8();
wall.ypan_ = fr.ReadUInt8();
wall.lotag = fr.ReadInt16();
@ -232,8 +232,8 @@ static void ReadWallV5(FileReader& fr, walltype& wall)
wall.overpicnum = fr.ReadInt16();
wall.shade = fr.ReadInt8();
wall.cstat = EWallFlags::FromInt(fr.ReadUInt16());
wall.xrepeat = fr.ReadUInt8();
wall.yrepeat = fr.ReadUInt8();
wall._xrepeat = fr.ReadUInt8();
wall._yrepeat = fr.ReadUInt8();
wall.xpan_ = fr.ReadUInt8();
wall.ypan_ = fr.ReadUInt8();

View file

@ -389,8 +389,8 @@ struct walltype
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
uint8_t _xrepeat;
uint8_t _yrepeat;
// extensions not from the binary map format.
angle_t clipangle;

View file

@ -747,13 +747,13 @@ void HWWall::DoTexture(HWDrawInfo* di, walltype* wal, walltype* refwall, float r
if (pow2size < th) pow2size *= 2;
float ypanning = refwall->ypan_ ? pow2size * refwall->ypan_ / (256.0f * th) : 0;
tcs[LOLFT].u = tcs[UPLFT].u = ((leftdist * 8.f * wal->xrepeat) + refwall->xpan_) / tw;
tcs[LORGT].u = tcs[UPRGT].u = ((rightdist * 8.f * wal->xrepeat) + refwall->xpan_) / tw;
tcs[LOLFT].u = tcs[UPLFT].u = ((leftdist * 8.f * wal->_xrepeat) + refwall->xpan_) / tw;
tcs[LORGT].u = tcs[UPRGT].u = ((rightdist * 8.f * wal->_xrepeat) + refwall->xpan_) / tw;
auto setv = [=](float hl, float hr, float frac) -> float
{
float h = hl + (hr - hl) * frac;
h = (-(float)((refheight + h) * 256) / ((th * 2048.0f) / (float)(wal->yrepeat))) + ypanning;
h = (-(float)((refheight + h) * 256) / ((th * 2048.0f) / (float)(wal->_yrepeat))) + ypanning;
if (refwall->cstat & CSTAT_WALL_YFLIP) h = -h;
return h;
};

View file

@ -609,8 +609,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, walltype &c, walltype
("overpicnum", c.overpicnum, def->overpicnum)
("shade", c.shade, def->shade)
("pal", c.pal, def->pal)
("xrepeat", c.xrepeat, def->xrepeat)
("yrepeat", c.yrepeat, def->yrepeat)
("xrepeat", c._xrepeat, def->_xrepeat)
("yrepeat", c._yrepeat, def->_yrepeat)
("xpanning", c.xpan_, def->xpan_)
("ypanning", c.ypan_, def->ypan_)
("lotag", c.lotag, def->lotag)

View file

@ -78,8 +78,8 @@ DEFINE_FIELD_X(walltype, walltype, hitag)
DEFINE_FIELD_X(walltype, walltype, extra)
DEFINE_FIELD_X(walltype, walltype, shade)
DEFINE_FIELD_X(walltype, walltype, pal)
DEFINE_FIELD_X(walltype, walltype, xrepeat)
DEFINE_FIELD_X(walltype, walltype, yrepeat)
DEFINE_FIELD_NAMED_X(walltype, walltype, _xrepeat, xrepeat)
DEFINE_FIELD_NAMED_X(walltype, walltype, _yrepeat, yrepeat)
DEFINE_FIELD_NAMED_X(tspritetype, tspritetype, sectp, sector)
DEFINE_FIELD_X(tspritetype, tspritetype, cstat)

View file

@ -2746,7 +2746,7 @@ static DBloodActor* actDropAmmo(DBloodActor* actor, int nType)
act2->spr.type = nType;
act2->spr.picnum = pAmmo->picnum;
act2->spr.shade = pAmmo->shade;
act2->spr.SetScale(pAmmo->xrepeat * REPEAT_SCALE, pAmmo->yrepeat * REPEAT_SCALE);
act2->spr.SetScale(pAmmo->_xrepeat * REPEAT_SCALE, pAmmo->_yrepeat * REPEAT_SCALE);
return act2;
}
return nullptr;
@ -2762,7 +2762,7 @@ static DBloodActor* actDropWeapon(DBloodActor* actor, int nType)
act2->spr.type = nType;
act2->spr.picnum = pWeapon->picnum;
act2->spr.shade = pWeapon->shade;
act2->spr.SetScale(pWeapon->xrepeat * REPEAT_SCALE, pWeapon->yrepeat * REPEAT_SCALE);
act2->spr.SetScale(pWeapon->_xrepeat * REPEAT_SCALE, pWeapon->_yrepeat * REPEAT_SCALE);
return act2;
}
return nullptr;
@ -2778,7 +2778,7 @@ static DBloodActor* actDropItem(DBloodActor* actor, int nType)
act2->spr.type = nType;
act2->spr.picnum = pItem->picnum;
act2->spr.shade = pItem->shade;
act2->spr.SetScale(pItem->xrepeat * REPEAT_SCALE, pItem->yrepeat * REPEAT_SCALE);
act2->spr.SetScale(pItem->_xrepeat * REPEAT_SCALE, pItem->_yrepeat * REPEAT_SCALE);
return act2;
}
return nullptr;
@ -6250,8 +6250,8 @@ DBloodActor* actSpawnThing(sectortype* pSector, const DVector3& pos, int nThingT
actor->spr.picnum = pThingInfo->picnum;
actor->spr.shade = pThingInfo->shade;
actor->spr.pal = pThingInfo->pal;
if (pThingInfo->xrepeat) actor->spr.xrepeat = pThingInfo->xrepeat;
if (pThingInfo->yrepeat) actor->spr.yrepeat = pThingInfo->yrepeat;
if (pThingInfo->_xrepeat) actor->spr.xrepeat = pThingInfo->_xrepeat;
if (pThingInfo->_yrepeat) actor->spr.yrepeat = pThingInfo->_yrepeat;
actor->spr.cstat2 |= CSTAT2_SPRITE_MAPPED;
switch (nThingType)
{
@ -6465,7 +6465,7 @@ DBloodActor* actFireMissile(DBloodActor* actor, double xyoff, double zoff, DVect
spawned->clipdist = pMissileInfo->fClipDist();
spawned->spr.flags = 1;
spawned->spr.SetScale(pMissileInfo->xrepeat * REPEAT_SCALE, pMissileInfo->yrepeat * REPEAT_SCALE);
spawned->spr.SetScale(pMissileInfo->_xrepeat * REPEAT_SCALE, pMissileInfo->_yrepeat * REPEAT_SCALE);
spawned->spr.picnum = pMissileInfo->picnum;
spawned->spr.angle = actor->spr.angle += mapangle(pMissileInfo->angleOfs);
spawned->vel = dv * pMissileInfo->fVelocity();

View file

@ -76,8 +76,8 @@ struct THINGINFO
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat; // xrepeat
uint8_t yrepeat; // yrepeat
uint8_t _xrepeat; // xrepeat
uint8_t _yrepeat; // yrepeat
int dmgControl[kDamageMax]; // damage
double fClipdist() const { return clipdist * 0.25; }
@ -89,8 +89,8 @@ struct AMMOITEMDATA
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
uint8_t _xrepeat;
uint8_t _yrepeat;
int16_t count;
uint8_t type;
uint8_t weaponType;
@ -102,8 +102,8 @@ struct WEAPONITEMDATA
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
uint8_t _xrepeat;
uint8_t _yrepeat;
int16_t type;
int16_t ammoType;
int16_t count;
@ -115,8 +115,8 @@ struct ITEMDATA
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
uint8_t _xrepeat;
uint8_t _yrepeat;
int16_t packSlot;
};
@ -125,8 +125,8 @@ struct MissileType
int16_t picnum;
int velocity;
int angleOfs;
uint8_t xrepeat;
uint8_t yrepeat;
uint8_t _xrepeat;
uint8_t _yrepeat;
int8_t shade;
uint8_t clipDist;

View file

@ -1577,14 +1577,14 @@ static void scaleDamage(DBloodActor* actor)
}
// take in account yrepeat of sprite
int yrepeat = actor->spr.yrepeat;
if (yrepeat < 64)
int yscale = int(actor->spr.ScaleY() * 64);
if (yscale < 64)
{
for (int i = 0; i < kDmgMax; i++) curScale[i] += (64 - yrepeat);
for (int i = 0; i < kDmgMax; i++) curScale[i] += (64 - yscale);
}
else if (yrepeat > 64)
else if (yscale > 64)
{
for (int i = 0; i < kDmgMax; i++) curScale[i] -= ((yrepeat - 64) >> 2);
for (int i = 0; i < kDmgMax; i++) curScale[i] -= ((yscale - 64) >> 2);
}
// take surface type into account
@ -1700,13 +1700,13 @@ static int getDispersionModifier(DBloodActor* actor, int minDisp, int maxDisp)
static double getRangeAttackDist(DBloodActor* actor, double minDist, double maxDist)
{
int yrepeat = actor->spr.yrepeat;
int yscale = int(actor->spr.ScaleY() * 64);
int dist = 0;
int seqId = actor->xspr.data2;
int mul = 550;
int picnum = actor->spr.picnum;
if (yrepeat > 0)
if (yscale > 0)
{
if (seqId >= 0)
{
@ -1718,8 +1718,8 @@ static double getRangeAttackDist(DBloodActor* actor, double minDist, double maxD
}
dist = tileHeight(picnum) << 8;
if (yrepeat < 64) dist -= (64 - yrepeat) * mul;
else if (yrepeat > 64) dist += (yrepeat - 64) * (mul / 3);
if (yscale < 64) dist -= (64 - yscale) * mul;
else if (yscale > 64) dist += (yscale - 64) * (mul / 3);
}
return clamp(dist / 16., minDist, maxDist);
}

View file

@ -400,9 +400,9 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** cur
pWall->extra = LittleShort(load.extra);
pWall->shade = load.shade;
pWall->pal = load.pal;
pWall->xrepeat = load.xrepeat;
pWall->_xrepeat = load._xrepeat;
pWall->xpan_ = load.xpanning;
pWall->yrepeat = load.yrepeat;
pWall->_yrepeat = load._yrepeat;
pWall->ypan_ = load.ypanning;
if (pWall->extra > 0)
@ -485,7 +485,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** cur
pSprite->extra = LittleShort(load.extra);
pSprite->pal = load.pal;
pSprite->clipdist = load.clipdist;
pSprite->SetScale(load.xrepeat * REPEAT_SCALE, load.yrepeat * REPEAT_SCALE);
pSprite->SetScale(load._xrepeat * REPEAT_SCALE, load._yrepeat * REPEAT_SCALE);
pSprite->xoffset = load.xoffset;
pSprite->yoffset = load.yoffset;
pSprite->detail = load.detail;

View file

@ -348,7 +348,7 @@ int VectorScan(DBloodActor* actor, double nOffset, double nZOffset, const DVecto
if (!nSizX || !nSizY)
return 0;
int nnOfs = int((nOfs * pWall->yrepeat) / 8);
int nnOfs = int((nOfs * pWall->_yrepeat) / 8);
nnOfs += int((nSizY * pWall->ypan_) / 256);
double nLength = (pWall->pos - pWall->point2Wall()->pos).Length();
double fHOffset;
@ -357,7 +357,7 @@ int VectorScan(DBloodActor* actor, double nOffset, double nZOffset, const DVecto
else
fHOffset = (gHitInfo.hitpos.XY() - pWall->pos).Length();
int nHOffset = int(pWall->xpan_ + ((fHOffset * pWall->xrepeat) * 8) / nLength) % nSizX;
int nHOffset = int(pWall->xpan_ + ((fHOffset * pWall->_xrepeat) * 8) / nLength) % nSizX;
nnOfs %= nSizY;
auto pData = tilePtr(nPicnum);
int nPixel = nHOffset * nSizY + nnOfs;

View file

@ -12,7 +12,7 @@ struct spritetypedisk
int16_t picnum;
int8_t shade;
uint8_t pal, clipdist, detail;
uint8_t xrepeat, yrepeat;
uint8_t _xrepeat, _yrepeat;
int8_t xoffset, yoffset;
int16_t sectnum, statnum;
int16_t ang, owner;
@ -46,7 +46,7 @@ struct walltypedisk
uint16_t cstat;
int16_t picnum, overpicnum;
int8_t shade;
uint8_t pal, xrepeat, yrepeat, xpanning, ypanning;
uint8_t pal, _xrepeat, _yrepeat, xpanning, ypanning;
int16_t type;
int16_t hitag;
int16_t extra;

View file

@ -1457,8 +1457,8 @@ int getSpriteMassBySize(DBloodActor* actor)
clipDist = max(actor->clipdist, 0.25);
int x = tileWidth(picnum);
int y = tileHeight(picnum);
int xrepeat = actor->spr.xrepeat;
int yrepeat = actor->spr.yrepeat;
int xscale = actor->spr.xrepeat * 64;
int yscale = actor->spr.yrepeat * 64;
// take surface type into account
switch (tileGetSurfType(actor->spr.picnum))
@ -1481,10 +1481,10 @@ int getSpriteMassBySize(DBloodActor* actor)
mass = ((x + y) * int(clipDist * 2)) / massDiv;
if (xrepeat > 64) mass += ((xrepeat - 64) * addMul);
else if (xrepeat < 64 && mass > 0)
if (xscale > 64) mass += ((xscale - 64) * addMul);
else if (xscale < 64 && mass > 0)
{
for (int i = 64 - xrepeat; i > 0; i--)
for (int i = 64 - xscale; i > 0; i--)
{
if ((mass -= subMul) <= 100 && subMul-- <= 1)
{
@ -1494,10 +1494,10 @@ int getSpriteMassBySize(DBloodActor* actor)
}
}
if (yrepeat > 64) mass += ((yrepeat - 64) * addMul);
else if (yrepeat < 64 && mass > 0)
if (yscale > 64) mass += ((yscale - 64) * addMul);
else if (yscale < 64 && mass > 0)
{
for (int i = 64 - yrepeat; i > 0; i--)
for (int i = 64 - yscale; i > 0; i--)
{
if ((mass -= subMul) <= 100 && subMul-- <= 1)
{
@ -2483,10 +2483,10 @@ void useObjResizer(DBloodActor* sourceactor, int targType, sectortype* targSect,
case OBJ_WALL:
if (!targWall) return;
if (valueIsBetween(sourceactor->xspr.data1, -1, 32767))
targWall->xrepeat = ClipRange(sourceactor->xspr.data1, 0, 255);
targWall->_xrepeat = ClipRange(sourceactor->xspr.data1, 0, 255);
if (valueIsBetween(sourceactor->xspr.data2, -1, 32767))
targWall->yrepeat = ClipRange(sourceactor->xspr.data2, 0, 255);
targWall->_yrepeat = ClipRange(sourceactor->xspr.data2, 0, 255);
if (valueIsBetween(sourceactor->xspr.data3, -1, 32767))
targWall->xpan_ = (float)ClipRange(sourceactor->xspr.data3, 0, 255);
@ -3968,9 +3968,9 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
case 27: return condCmp(pObj->shade, arg1, arg2, cmpOp);
case 28: return (arg3) ? condCmp((pObj->cstat & EWallFlags::FromInt(arg3)), arg1, arg2, cmpOp) : (pObj->cstat & EWallFlags::FromInt(arg1));
case 29: return (arg3) ? condCmp((pObj->hitag & arg3), arg1, arg2, cmpOp) : (pObj->hitag & arg1);
case 30: return condCmp(pObj->xrepeat, arg1, arg2, cmpOp);
case 30: return condCmp(pObj->_xrepeat, arg1, arg2, cmpOp);
case 31: return condCmp(pObj->xpan(), arg1, arg2, cmpOp);
case 32: return condCmp(pObj->yrepeat, arg1, arg2, cmpOp);
case 32: return condCmp(pObj->_yrepeat, arg1, arg2, cmpOp);
case 33: return condCmp(pObj->ypan(), arg1, arg2, cmpOp);
}
}

View file

@ -3867,8 +3867,8 @@ void destroyit(DDukeActor *actor)
destwal->picnum = srcwal->picnum;
destwal->overpicnum = srcwal->overpicnum;
destwal->shade = srcwal->shade;
destwal->xrepeat = srcwal->xrepeat;
destwal->yrepeat = srcwal->yrepeat;
destwal->_xrepeat = srcwal->_xrepeat;
destwal->_yrepeat = srcwal->_yrepeat;
destwal->xpan_ = srcwal->xpan_;
destwal->ypan_ = srcwal->ypan_;
if (isRRRA() && destwal->twoSided())

View file

@ -988,12 +988,12 @@ void DoWall(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, i
else SetGameVarID(lVar2, wallp->pal, sActor, sPlayer);
break;
case WALL_XREPEAT:
if (bSet) wallp->xrepeat = lValue;
else SetGameVarID(lVar2, wallp->xrepeat, sActor, sPlayer);
if (bSet) wallp->_xrepeat = lValue;
else SetGameVarID(lVar2, wallp->_xrepeat, sActor, sPlayer);
break;
case WALL_YREPEAT:
if (bSet) wallp->yrepeat = lValue;
else SetGameVarID(lVar2, wallp->yrepeat, sActor, sPlayer);
if (bSet) wallp->_yrepeat = lValue;
else SetGameVarID(lVar2, wallp->_yrepeat, sActor, sPlayer);
break;
case WALL_XPANNING:
if (bSet) wallp->xpan_ = (float)(lValue & 255);

View file

@ -60,8 +60,8 @@ void CopySectorWalls(sectortype* dest_sect, sectortype* src_sect)
{
dwall->picnum = swall->picnum;
dwall->xrepeat = swall->xrepeat;
dwall->yrepeat = swall->yrepeat;
dwall->_xrepeat = swall->_xrepeat;
dwall->_yrepeat = swall->_yrepeat;
dwall->overpicnum = swall->overpicnum;
dwall->pal = swall->pal;
dwall->cstat = swall->cstat;
@ -77,8 +77,8 @@ void CopySectorWalls(sectortype* dest_sect, sectortype* src_sect)
auto const dest_nextwall = dwall->nextWall();
auto const src_nextwall = swall->nextWall();
dest_nextwall->picnum = src_nextwall->picnum;
dest_nextwall->xrepeat = src_nextwall->xrepeat;
dest_nextwall->yrepeat = src_nextwall->yrepeat;
dest_nextwall->_xrepeat = src_nextwall->_xrepeat;
dest_nextwall->_yrepeat = src_nextwall->_yrepeat;
dest_nextwall->overpicnum = src_nextwall->overpicnum;
dest_nextwall->pal = src_nextwall->pal;
dest_nextwall->cstat = src_nextwall->cstat;