- renaming spritetype::pos

This commit is contained in:
Christoph Oelckers 2022-02-02 18:59:37 +01:00
parent ad9931081e
commit dc94dedc6b
23 changed files with 251 additions and 242 deletions

View file

@ -72,91 +72,91 @@ public:
void copy_pos(const DCoreActor* other)
{
spr.pos = other->spr.pos;
spr.__int_pos = other->spr.__int_pos;
}
const vec3_t int_pos() const
{
return spr.pos;
return spr.__int_pos;
}
void set_int_z(int z)
{
spr.pos.Z = z;
spr.__int_pos.Z = z;
}
void add_int_z(int z)
{
spr.pos.Z += z;
spr.__int_pos.Z += z;
}
void add_int_pos(const vec3_t& add)
{
spr.pos += add;
spr.__int_pos += add;
}
void set_int_pos(const vec3_t& add)
{
spr.pos = add;
spr.__int_pos = add;
}
void copy_int_xy(DCoreActor* other)
{
spr.pos.X = other->spr.pos.X;
spr.pos.Y = other->spr.pos.Y;
spr.__int_pos.X = other->spr.__int_pos.X;
spr.__int_pos.Y = other->spr.__int_pos.Y;
}
void set_int_xy(int x, int y)
{
spr.pos.X = x;
spr.pos.Y = y;
spr.__int_pos.X = x;
spr.__int_pos.Y = y;
}
DVector3 float_pos() const
{
return { spr.pos.X * inttoworld, spr.pos.Y * inttoworld, spr.pos.Z * zinttoworld };
return { spr.__int_pos.X * inttoworld, spr.__int_pos.Y * inttoworld, spr.__int_pos.Z * zinttoworld };
}
void set_float_pos(const DVector3& pos)
{
spr.pos = { int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) };
spr.__int_pos = { int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) };
}
void add_float_pos(const DVector3& pos)
{
spr.pos += { int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) };
spr.__int_pos += { int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) };
}
void set_float_z(int z)
{
spr.pos.Z = int(z * zworldtoint);
spr.__int_pos.Z = int(z * zworldtoint);
}
void add_float_z(int z)
{
spr.pos.Z += int(z * zworldtoint);
spr.__int_pos.Z += int(z * zworldtoint);
}
// Same as above but with invertex y and z axes to match the renderer's coordinate system.
DVector3 render_pos() const
{
return { spr.pos.X * inttoworld, -spr.pos.Y * inttoworld, -spr.pos.Z * zinttoworld };
return { spr.__int_pos.X * inttoworld, -spr.__int_pos.Y * inttoworld, -spr.__int_pos.Z * zinttoworld };
}
int32_t interpolatedx(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(opos.X, spr.pos.X, smoothratio, scale);
return interpolatedvalue(opos.X, spr.__int_pos.X, smoothratio, scale);
}
int32_t interpolatedy(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(opos.Y, spr.pos.Y, smoothratio, scale);
return interpolatedvalue(opos.Y, spr.__int_pos.Y, smoothratio, scale);
}
int32_t interpolatedz(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(opos.Z, spr.pos.Z, smoothratio, scale);
return interpolatedvalue(opos.Z, spr.__int_pos.Z, smoothratio, scale);
}
vec2_t interpolatedvec2(double const smoothratio, int const scale = 16)
@ -185,27 +185,27 @@ public:
void backupx()
{
opos.X = spr.pos.X;
opos.X = spr.__int_pos.X;
}
void backupy()
{
opos.Y = spr.pos.Y;
opos.Y = spr.__int_pos.Y;
}
void backupz()
{
opos.Z = spr.pos.Z;
opos.Z = spr.__int_pos.Z;
}
void backupvec2()
{
opos.vec2 = spr.pos.vec2;
opos.vec2 = spr.__int_pos.vec2;
}
void backuppos()
{
opos = spr.pos;
opos = spr.__int_pos;
}
void backupang()

View file

@ -377,7 +377,7 @@ void TGetFlatSpritePosition(const spritetypebase* spr, vec2_t pos, vec2_t* out,
{
for (int i = 0; i < 4; i++)
{
int spos = DMulScale(-sinang, out[i].Y - spr->pos.Y, -cosang, out[i].X - spr->pos.X, 4);
int spos = DMulScale(-sinang, out[i].Y - pos.Y, -cosang, out[i].X - pos.X, 4);
outz[i] = MulScale(heinum, spos, 18);
}
}
@ -557,7 +557,7 @@ tspritetype* renderAddTsprite(tspriteArray& tsprites, DCoreActor* actor)
{
auto tspr = tsprites.newTSprite();
tspr->pos = actor->int_pos();
tspr->__int_pos = actor->int_pos();
tspr->cstat = actor->spr.cstat;
tspr->picnum = actor->spr.picnum;
tspr->shade = actor->spr.shade;

View file

@ -322,10 +322,10 @@ inline int tspriteGetSlope(const tspritetype* spr)
inline int32_t tspriteGetZOfSlope(const tspritetype* tspr, int dax, int day)
{
int heinum = tspriteGetSlope(tspr);
if (heinum == 0) return tspr->pos.Z;
if (heinum == 0) return tspr->__int_pos.Z;
int const j = DMulScale(bsin(tspr->ang + 1024), day - tspr->pos.Y, -bsin(tspr->ang + 512), dax - tspr->pos.X, 4);
return tspr->pos.Z + MulScale(heinum, j, 18);
int const j = DMulScale(bsin(tspr->ang + 1024), day - tspr->__int_pos.Y, -bsin(tspr->ang + 512), dax - tspr->__int_pos.X, 4);
return tspr->__int_pos.Z + MulScale(heinum, j, 18);
}
inline int inside(int x, int y, const sectortype* sect)

View file

@ -257,38 +257,39 @@ static void SetWallPalV5()
}
}
void validateSprite(spritetype& spr, int sectnum, int index)
void validateSprite(spritetype& spri, int sectnum, int index)
{
auto pos = spri.__int_pos;
bool bugged = false;
if ((unsigned)spr.statnum >= MAXSTATUS)
if ((unsigned)spri.statnum >= MAXSTATUS)
{
Printf("Sprite #%d (%d,%d) has invalid statnum %d.\n", index, spr.pos.X, spr.pos.Y, spr.statnum);
Printf("Sprite #%d (%d,%d) has invalid statnum %d.\n", index, pos.X, pos.Y, spri.statnum);
bugged = true;
}
else if ((unsigned)spr.picnum >= MAXTILES)
else if ((unsigned)spri.picnum >= MAXTILES)
{
Printf("Sprite #%d (%d,%d) has invalid picnum %d.\n", index, spr.pos.X, spr.pos.Y, spr.picnum);
Printf("Sprite #%d (%d,%d) has invalid picnum %d.\n", index, pos.X, pos.Y, spri.picnum);
bugged = true;
}
else if (!validSectorIndex(sectnum))
{
sectnum = -1;
updatesector(spr.pos.X, spr.pos.Y, &sectnum);
updatesector(pos.X, pos.Y, &sectnum);
bugged = sectnum < 0;
if (!DPrintf(DMSG_WARNING, "Sprite #%d (%d,%d) with invalid sector %d was corrected to sector %d\n", index, spr.pos.X, spr.pos.Y, sectnum, sectnum))
if (!DPrintf(DMSG_WARNING, "Sprite #%d (%d,%d) with invalid sector %d was corrected to sector %d\n", index, pos.X, pos.Y, sectnum, sectnum))
{
if (bugged) Printf("Sprite #%d (%d,%d) with invalid sector %d\n", index, spr.pos.X, spr.pos.Y, sectnum);
if (bugged) Printf("Sprite #%d (%d,%d) with invalid sector %d\n", index, pos.X, pos.Y, sectnum);
}
}
if (bugged)
{
spr = {};
spr.statnum = MAXSTATUS;
spri = {};
spri.statnum = MAXSTATUS;
sectnum = -1;
}
if (sectnum >= 0) spr.sectp = &sector[sectnum];
else spr.sectp = nullptr;
if (sectnum >= 0) spri.sectp = &sector[sectnum];
else spri.sectp = nullptr;
}
static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno)

View file

@ -445,7 +445,7 @@ struct walltype
struct spritetypebase
{
vec3_t pos;
vec3_t __int_pos;
sectortype* sectp;
@ -473,7 +473,7 @@ struct spritetypebase
void SetMapPos(int x, int y, int z)
{
pos = { x, y, z };
__int_pos = { x, y, z };
}
};
@ -494,6 +494,16 @@ struct tspritetype : public spritetypebase
{
DCoreActor* ownerActor;
int time;
const vec3_t int_pos() const
{
return __int_pos;
}
void set_int_pos(const vec3_t& pos)
{
__int_pos = pos;
}
};
class tspriteArray

View file

@ -318,13 +318,13 @@ void HWDrawInfo::DispatchSprites()
if (actor->sprext.renderflags & SPREXT_AWAY1)
{
tspr->pos.X += bcos(tspr->ang, -13);
tspr->pos.Y += bsin(tspr->ang, -13);
tspr->__int_pos.X += bcos(tspr->ang, -13);
tspr->__int_pos.Y += bsin(tspr->ang, -13);
}
else if (actor->sprext.renderflags & SPREXT_AWAY2)
{
tspr->pos.X -= bcos(tspr->ang, -13);
tspr->pos.Y -= bsin(tspr->ang, -13);
tspr->__int_pos.X -= bcos(tspr->ang, -13);
tspr->__int_pos.Y -= bsin(tspr->ang, -13);
}
switch (tspr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK)

View file

@ -124,7 +124,7 @@ void HWFlat::MakeVertices(HWDrawInfo* di)
int ofsz[4];
auto cstat = Sprite->cstat;
if (tspriteGetSlope(Sprite)) cstat &= ~CSTAT_SPRITE_YFLIP; // NBlood doesn't y-flip slope sprites.
GetFlatSpritePosition(Sprite, Sprite->pos.vec2, pos, ofsz, true);
GetFlatSpritePosition(Sprite, Sprite->__int_pos.vec2, pos, ofsz, true);
Sprite->cstat = cstat;
auto ret = screen->mVertexData->AllocVertices(6);
@ -177,7 +177,7 @@ void HWFlat::MakeVertices(HWDrawInfo* di)
auto svp = &di->SlopeSpriteVertices[svi];
auto& vpt = di->Viewpoint;
depth = (float)((Sprite->pos.X * (1/16.f) - vpt.Pos.X) * vpt.TanCos + (Sprite->pos.Y * (1 / -16.f) - vpt.Pos.Y) * vpt.TanSin);
depth = (float)((Sprite->__int_pos.X * (1/16.f) - vpt.Pos.X) * vpt.TanCos + (Sprite->__int_pos.Y * (1 / -16.f) - vpt.Pos.Y) * vpt.TanSin);
for (unsigned j = 0; j < 4; j++)
{
@ -421,12 +421,12 @@ void HWFlat::ProcessFlatSprite(HWDrawInfo* di, tspritetype* sprite, sectortype*
int tilenum = sprite->picnum;
texture = tileGetTexture(tilenum);
bool belowfloor = false;
if (sprite->pos.Z > sprite->sectp->floorz)
if (sprite->__int_pos.Z > sprite->sectp->floorz)
{
belowfloor = true;
sprite->pos.Z = sprite->sectp->floorz;
sprite->__int_pos.Z = sprite->sectp->floorz;
}
z = sprite->pos.Z * (1 / -256.f);
z = sprite->__int_pos.Z * (1 / -256.f);
if (z == di->Viewpoint.Pos.Z) return; // looking right at the edge.
dynlightindex = -1;

View file

@ -332,9 +332,9 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int
SetSpriteTranslucency(spr, alpha, RenderStyle);
x = spr->pos.X * (1 / 16.f);
z = spr->pos.Z * (1 / -256.f);
y = spr->pos.Y * (1 / -16.f);
x = spr->__int_pos.X * (1 / 16.f);
z = spr->__int_pos.Z * (1 / -256.f);
y = spr->__int_pos.Y * (1 / -16.f);
auto vp = di->Viewpoint;
if ((vp.Pos.XY() - DVector2(x, y)).LengthSquared() < 0.125) return;
@ -395,9 +395,9 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int
float viewvecX = vp.ViewVector.X;
float viewvecY = vp.ViewVector.Y;
x = spr->pos.X * (1 / 16.f);
y = spr->pos.Y * (1 / -16.f);
z = spr->pos.Z * (1 / -256.f);
x = spr->__int_pos.X * (1 / 16.f);
y = spr->__int_pos.Y * (1 / -16.f);
z = spr->__int_pos.Z * (1 / -256.f);
x1 = x - viewvecY * (xoff - (width * 0.5f));
x2 = x - viewvecY * (xoff + (width * 0.5f));
@ -504,13 +504,13 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, tspritetype* spr, s
scalevec.Z *= sprzscale;
translatevec.Z *= sprzscale;
float zpos = (float)(spr->pos.Z + ownerActor->sprext.position_offset.Z);
float zpos = (float)(spr->__int_pos.Z + ownerActor->sprext.position_offset.Z);
float zscale = ((spr->cstat & CSTAT_SPRITE_YFLIP) && (spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -4.f : 4.f;
zpos -= (spr->yoffset * spr->yrepeat) * zscale * voxel->bscale;
x = (spr->pos.X + ownerActor->sprext.position_offset.X) * (1 / 16.f);
x = (spr->__int_pos.X + ownerActor->sprext.position_offset.X) * (1 / 16.f);
z = zpos * (1 / -256.f);
y = (spr->pos.Y + ownerActor->sprext.position_offset.Y) * (1 / -16.f);
y = (spr->__int_pos.Y + ownerActor->sprext.position_offset.Y) * (1 / -16.f);
float zoff = voxel->siz.Z * .5f;
if (!(spr->cstat & CSTAT_SPRITE_YCENTER))

View file

@ -55,8 +55,8 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos)
auto sect = tspr->sectp;
float tx = tspr->pos.X * (float)inttoworld;
float ty = tspr->pos.Y * (float)inttoworld;
float tx = tspr->__int_pos.X * (float)inttoworld;
float ty = tspr->__int_pos.Y * (float)inttoworld;
for(auto& wal : wallsofsector(sect))
{
@ -1102,7 +1102,7 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
int HWWall::CheckWallSprite(tspritetype* spr, tspritetype* last)
{
// If the position changed we need to recalculate everything.
if (spr->pos.X != last->pos.X || spr->pos.Y != last->pos.Y || spr->sectp != last->sectp || spr->ang != last->ang) return 3;
if (spr->__int_pos.X != last->__int_pos.X || spr->__int_pos.Y != last->__int_pos.Y || spr->sectp != last->sectp || spr->ang != last->ang) return 3;
// if the horizontal orientation changes we need to recalculate the walls this attaches to, but not the positioning.
if (spr->xrepeat != last->xrepeat || spr->xoffset != last->xoffset || spr->picnum != last->picnum || ((spr->cstat ^ last->cstat) & CSTAT_SPRITE_XFLIP)) return 2;
@ -1128,9 +1128,9 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, tspritetype* spr, sectortype* sec
seg = nullptr;
Sprite = spr;
vec2_t pos[2];
int sprz = spr->pos.Z;
int sprz = spr->__int_pos.Z;
GetWallSpritePosition(spr, spr->pos.vec2, pos, true);
GetWallSpritePosition(spr, spr->__int_pos.vec2, pos, true);
glseg.x1 = pos[0].X * (1 / 16.f);
glseg.y1 = pos[0].Y * (1 / -16.f);
glseg.x2 = pos[1].X * (1 / 16.f);

View file

@ -446,9 +446,9 @@ FSerializer &Serialize(FSerializer &arc, const char *key, spritetype &c, spritet
def = &zsp; // always delta against 0
if (arc.BeginObject(key))
{
arc("x", c.pos.X, def->pos.X)
("y", c.pos.Y, def->pos.Y)
("z", c.pos.Z, def->pos.Z)
arc("x", c.__int_pos.X, def->__int_pos.X)
("y", c.__int_pos.Y, def->__int_pos.Y)
("z", c.__int_pos.Z, def->__int_pos.Z)
("cstat", c.cstat, def->cstat)
("picnum", c.picnum, def->picnum)
("shade", c.shade, def->shade)

View file

@ -537,15 +537,15 @@ DEFINE_ACTION_FUNCTION_NATIVE(_walltype, twosided, wall_twosided)
DEFINE_ACTION_FUNCTION(_tspritetype, pos)
{
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
ACTION_RETURN_VEC3(DVector3(self->pos.X * inttoworld, self->pos.Y * inttoworld, self->pos.Z * zinttoworld));
ACTION_RETURN_VEC3(DVector3(self->__int_pos.X * inttoworld, self->__int_pos.Y * inttoworld, self->__int_pos.Z * zinttoworld));
}
void tsprite_setpos(tspritetype* tsp, double x, double y, double z)
{
if (!tsp) ThrowAbortException(X_READ_NIL, nullptr);
tsp->pos.X = int(x * worldtoint);
tsp->pos.Y = int(y * worldtoint);
tsp->pos.Z = int(z * zworldtoint);
tsp->__int_pos.X = int(x * worldtoint);
tsp->__int_pos.Y = int(y * worldtoint);
tsp->__int_pos.Z = int(z * zworldtoint);
}
DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, setpos, tsprite_setpos)
@ -561,9 +561,9 @@ DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, setpos, tsprite_setpos)
void tsprite_addpos(tspritetype* tsp, double x, double y, double z)
{
if (!tsp) ThrowAbortException(X_READ_NIL, nullptr);
tsp->pos.X = int(x * worldtoint);
tsp->pos.Y = int(y * worldtoint);
tsp->pos.Z = int(z * zworldtoint);
tsp->__int_pos.X += int(x * worldtoint);
tsp->__int_pos.Y += int(y * worldtoint);
tsp->__int_pos.Z += int(z * zworldtoint);
}
DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, addpos, tsprite_addpos)
@ -583,4 +583,4 @@ struct tsprite
void setPic(string texture);
}
#endif
#endif

View file

@ -97,12 +97,12 @@ tspritetype* viewInsertTSprite(tspriteArray& tsprites, sectortype* pSector, int
pTSprite->sectp = pSector;
if (parentTSprite)
{
pTSprite->pos = parentTSprite->pos;
pTSprite->__int_pos = parentTSprite->__int_pos;
pTSprite->ownerActor = parentTSprite->ownerActor;
pTSprite->ang = parentTSprite->ang;
}
pTSprite->pos.X += Cos(gCameraAng) >> 25;
pTSprite->pos.Y += Sin(gCameraAng) >> 25;
pTSprite->__int_pos.X += Cos(gCameraAng) >> 25;
pTSprite->__int_pos.Y += Sin(gCameraAng) >> 25;
return pTSprite;
}
@ -167,7 +167,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (perc >= 75) pNSprite2->pal = 0;
else if (perc >= 50) pNSprite2->pal = 6;
pNSprite2->pos.Z = top - 2048;
pNSprite2->__int_pos.Z = top - 2048;
pNSprite2->shade = -128;
break;
}
@ -188,9 +188,9 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
int z = 0;
RotateYZ(&x, &y, &z, nRand1);
RotateXZ(&x, &y, &z, nRand2);
pNSprite->pos.X = pTSprite->pos.X + x;
pNSprite->pos.Y = pTSprite->pos.Y + y;
pNSprite->pos.Z = pTSprite->pos.Z + (z << 4);
pNSprite->__int_pos.X = pTSprite->__int_pos.X + x;
pNSprite->__int_pos.Y = pTSprite->__int_pos.Y + y;
pNSprite->__int_pos.Z = pTSprite->__int_pos.Z + (z << 4);
pNSprite->picnum = 1720;
pNSprite->shade = -128;
}
@ -206,7 +206,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
pNSprite->shade = -128;
pNSprite->pal = 0;
pNSprite->pos.Z = top;
pNSprite->__int_pos.Z = top;
if (nViewEffect == kViewEffectFlag)
pNSprite->xrepeat = pNSprite->yrepeat = 24;
else
@ -220,7 +220,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (!pNSprite)
break;
pNSprite->pos.Z = pTSprite->pos.Z;
pNSprite->__int_pos.Z = pTSprite->__int_pos.Z;
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
pNSprite->shade = -128;
pNSprite->xrepeat = pTSprite->xrepeat;
@ -266,7 +266,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
pNSprite->xrepeat = pNSprite->yrepeat = 24;
pNSprite->picnum = 626;
pNSprite->pos.Z = top;
pNSprite->__int_pos.Z = top;
break;
}
case kViewEffectTrail:
@ -289,12 +289,12 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
int nLen = 128 + (i << 7);
int x = MulScale(nLen, Cos(nAng), 30);
pNSprite->pos.X = pTSprite->pos.X + x;
pNSprite->__int_pos.X = pTSprite->__int_pos.X + x;
int y = MulScale(nLen, Sin(nAng), 30);
pNSprite->pos.Y = pTSprite->pos.Y + y;
pNSprite->pos.Z = pTSprite->pos.Z;
pNSprite->__int_pos.Y = pTSprite->__int_pos.Y + y;
pNSprite->__int_pos.Z = pTSprite->__int_pos.Z;
assert(pSector);
FindSector(pNSprite->pos.X, pNSprite->pos.Y, pNSprite->pos.Z, &pSector);
FindSector(pNSprite->__int_pos.X, pNSprite->__int_pos.Y, pNSprite->__int_pos.Z, &pSector);
pNSprite->sectp = pSector;
pNSprite->ownerActor = pTSprite->ownerActor;
pNSprite->picnum = pTSprite->picnum;
@ -315,7 +315,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
break;
pNSprite->shade = -128;
pNSprite->pos.Z = pTSprite->pos.Z;
pNSprite->__int_pos.Z = pTSprite->__int_pos.Z;
pNSprite->picnum = 908;
pNSprite->statnum = kStatDecoration;
pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum) * pTSprite->xrepeat) / 64;
@ -329,7 +329,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
int top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->pos.Z = top;
pNSprite->__int_pos.Z = top;
if (IsDudeSprite(pTSprite))
pNSprite->picnum = 672;
else
@ -348,7 +348,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
int top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->pos.Z = bottom;
pNSprite->__int_pos.Z = bottom;
if (pTSprite->type >= kDudeBase && pTSprite->type < kDudeMax)
pNSprite->picnum = 672;
else
@ -367,7 +367,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
int top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->pos.Z = top;
pNSprite->__int_pos.Z = top;
pNSprite->picnum = 2101;
pNSprite->shade = -128;
pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum) * pTSprite->xrepeat) / 32;
@ -381,7 +381,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
int top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
pNSprite->pos.Z = bottom;
pNSprite->__int_pos.Z = bottom;
pNSprite->picnum = 2101;
pNSprite->shade = -128;
pNSprite->xrepeat = pNSprite->yrepeat = (tileWidth(pTSprite->picnum) * pTSprite->xrepeat) / 32;
@ -392,10 +392,10 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
auto pNSprite = viewInsertTSprite(tsprites, pTSprite->sectp, 32767, pTSprite);
if (!pNSprite)
break;
pNSprite->pos.Z = getflorzofslopeptr(pTSprite->sectp, pNSprite->pos.X, pNSprite->pos.Y);
pNSprite->__int_pos.Z = getflorzofslopeptr(pTSprite->sectp, pNSprite->__int_pos.X, pNSprite->__int_pos.Y);
if ((pNSprite->sectp->floorpicnum >= 4080) && (pNSprite->sectp->floorpicnum <= 4095) && !VanillaMode()) // if floor has ror, find actual floor
{
int cX = pNSprite->pos.X, cY = pNSprite->pos.Y, cZ = pNSprite->pos.Z, cZrel = pNSprite->pos.Z;
int cX = pNSprite->__int_pos.X, cY = pNSprite->__int_pos.Y, cZ = pNSprite->__int_pos.Z, cZrel = pNSprite->__int_pos.Z;
auto cSect = pNSprite->sectp;
for (int i = 0; i < 16; i++) // scan through max stacked sectors
{
@ -408,7 +408,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
cZ = newFloorZ;
}
pNSprite->sectp = cSect;
pNSprite->pos.Z = cZrel;
pNSprite->__int_pos.Z = cZrel;
}
pNSprite->shade = 127;
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
@ -420,7 +420,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
pNSprite->pal = 5;
int height = tileHeight(pNSprite->picnum);
int center = height / 2 + tileTopOffset(pNSprite->picnum);
pNSprite->pos.Z -= (pNSprite->yrepeat << 2) * (height - center);
pNSprite->__int_pos.Z -= (pNSprite->yrepeat << 2) * (height - center);
break;
}
case kViewEffectFlareHalo:
@ -432,7 +432,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
pNSprite->shade = -128;
pNSprite->pal = 2;
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
pNSprite->pos.Z = pTSprite->pos.Z;
pNSprite->__int_pos.Z = pTSprite->__int_pos.Z;
pNSprite->xrepeat = pTSprite->xrepeat;
pNSprite->yrepeat = pTSprite->yrepeat;
pNSprite->picnum = 2427;
@ -445,11 +445,11 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
break;
sectortype* pSector = pTSprite->sectp;
pNSprite->pos.X = pTSprite->pos.X;
pNSprite->pos.Y = pTSprite->pos.Y;
pNSprite->pos.Z = pSector->ceilingz;
pNSprite->__int_pos.X = pTSprite->__int_pos.X;
pNSprite->__int_pos.Y = pTSprite->__int_pos.Y;
pNSprite->__int_pos.Z = pSector->ceilingz;
pNSprite->picnum = 624;
pNSprite->shade = ((pTSprite->pos.Z - pSector->ceilingz) >> 8) - 64;
pNSprite->shade = ((pTSprite->__int_pos.Z - pSector->ceilingz) >> 8) - 64;
pNSprite->pal = 2;
pNSprite->xrepeat = pNSprite->yrepeat = 64;
pNSprite->cstat |= CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_YFLIP | CSTAT_SPRITE_TRANSLUCENT;
@ -464,11 +464,11 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
break;
sectortype* pSector = pTSprite->sectp;
pNSprite->pos.X = pTSprite->pos.X;
pNSprite->pos.Y = pTSprite->pos.Y;
pNSprite->pos.Z = pSector->floorz;
pNSprite->__int_pos.X = pTSprite->__int_pos.X;
pNSprite->__int_pos.Y = pTSprite->__int_pos.Y;
pNSprite->__int_pos.Z = pSector->floorz;
pNSprite->picnum = 624;
uint8_t nShade = (pSector->floorz - pTSprite->pos.Z) >> 8;
uint8_t nShade = (pSector->floorz - pTSprite->__int_pos.Z) >> 8;
pNSprite->shade = nShade - 32;
pNSprite->pal = 2;
pNSprite->xrepeat = pNSprite->yrepeat = nShade;
@ -483,7 +483,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (!pNSprite)
break;
pNSprite->pos.Z = pTSprite->pos.Z;
pNSprite->__int_pos.Z = pTSprite->__int_pos.Z;
if (gDetail > 1)
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
pNSprite->shade = ClipLow(pTSprite->shade - 32, -128);
@ -503,10 +503,10 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
if (!pNSprite)
break;
pNSprite->pos.X = pTSprite->pos.X;
pNSprite->pos.Y = pTSprite->pos.Y;
pNSprite->pos.Z = pTSprite->pos.Z - (32 << 8);
pNSprite->pos.Z -= weaponIcon.zOffset << 8; // offset up
pNSprite->__int_pos.X = pTSprite->__int_pos.X;
pNSprite->__int_pos.Y = pTSprite->__int_pos.Y;
pNSprite->__int_pos.Z = pTSprite->__int_pos.Z - (32 << 8);
pNSprite->__int_pos.Z -= weaponIcon.zOffset << 8; // offset up
pNSprite->picnum = nTile;
pNSprite->shade = pTSprite->shade;
pNSprite->xrepeat = 32;
@ -520,8 +520,8 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
pNSprite->picnum = nVoxel;
if (pPlayer->curWeapon == kWeapLifeLeech) // position lifeleech behind player
{
pNSprite->pos.X += MulScale(128, Cos(gView->actor->spr.ang), 30);
pNSprite->pos.Y += MulScale(128, Sin(gView->actor->spr.ang), 30);
pNSprite->__int_pos.X += MulScale(128, Cos(gView->actor->spr.ang), 30);
pNSprite->__int_pos.Y += MulScale(128, Sin(gView->actor->spr.ang), 30);
}
if ((pPlayer->curWeapon == kWeapLifeLeech) || (pPlayer->curWeapon == kWeapVoodooDoll)) // make lifeleech/voodoo doll always face viewer like sprite
pNSprite->ang = (pNSprite->ang + 512) & 2047; // offset angle 90 degrees
@ -585,7 +585,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
if (cl_interpolate && owneractor->interpolated && !(pTSprite->flags & 512))
{
pTSprite->pos = owneractor->interpolatedvec3(gInterpolate);
pTSprite->__int_pos = owneractor->interpolatedvec3(gInterpolate);
pTSprite->ang = owneractor->interpolatedang(gInterpolate);
}
int nAnim = 0;
@ -615,8 +615,8 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
pTSprite->cstat &= ~CSTAT_SPRITE_XFLIP;
break;
}
int dX = cX - pTSprite->pos.X;
int dY = cY - pTSprite->pos.Y;
int dX = cX - pTSprite->__int_pos.X;
int dY = cY - pTSprite->__int_pos.Y;
RotateVector(&dX, &dY, 128 - pTSprite->ang);
nAnim = GetOctant(dX, dY);
if (nAnim <= 4)
@ -637,8 +637,8 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
pTSprite->cstat &= ~CSTAT_SPRITE_XFLIP;
break;
}
int dX = cX - pTSprite->pos.X;
int dY = cY - pTSprite->pos.Y;
int dX = cX - pTSprite->__int_pos.X;
int dY = cY - pTSprite->__int_pos.Y;
RotateVector(&dX, &dY, 128 - pTSprite->ang);
nAnim = GetOctant(dX, dY);
break;
@ -654,7 +654,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
{
int top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
if (getflorzofslopeptr(pTSprite->sectp, pTSprite->pos.X, pTSprite->pos.Y) > bottom)
if (getflorzofslopeptr(pTSprite->sectp, pTSprite->__int_pos.X, pTSprite->__int_pos.Y) > bottom)
nAnim = 1;
}
break;
@ -855,12 +855,12 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
if (pTSprite->type != kMissileFlareRegular) break;
sectortype* pSector1 = pTSprite->sectp;
int zDiff = (pTSprite->pos.Z - pSector1->ceilingz) >> 8;
int zDiff = (pTSprite->__int_pos.Z - pSector1->ceilingz) >> 8;
if ((pSector1->ceilingstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) {
viewAddEffect(tsprites, nTSprite, kViewEffectCeilGlow);
}
zDiff = (pSector1->floorz - pTSprite->pos.Z) >> 8;
zDiff = (pSector1->floorz - pTSprite->__int_pos.Z) >> 8;
if ((pSector1->floorstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) {
viewAddEffect(tsprites, nTSprite, kViewEffectFloorGlow);
}
@ -909,9 +909,9 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
auto pNTSprite = viewAddEffect(tsprites, nTSprite, kViewEffectShoot);
if (pNTSprite) {
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pNTSprite->pos.X += MulScale(pPosture->zOffset, Cos(pTSprite->ang), 28);
pNTSprite->pos.Y += MulScale(pPosture->zOffset, Sin(pTSprite->ang), 28);
pNTSprite->pos.Z = pPlayer->actor->int_pos().Z - pPosture->xOffset;
pNTSprite->__int_pos.X += MulScale(pPosture->zOffset, Cos(pTSprite->ang), 28);
pNTSprite->__int_pos.Y += MulScale(pPosture->zOffset, Sin(pTSprite->ang), 28);
pNTSprite->__int_pos.Z = pPlayer->actor->int_pos().Z - pPosture->xOffset;
}
}
@ -936,7 +936,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
}
if (pTSprite->ownerActor != gView->actor || gViewPos != VIEWPOS_0) {
if (getflorzofslopeptr(pTSprite->sectp, pTSprite->pos.X, pTSprite->pos.Y) >= cZ)
if (getflorzofslopeptr(pTSprite->sectp, pTSprite->__int_pos.X, pTSprite->__int_pos.Y) >= cZ)
{
viewAddEffect(tsprites, nTSprite, kViewEffectShadow);
}
@ -968,7 +968,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
if (pTSprite->type < kThingBase || pTSprite->type >= kThingMax || owneractor->hit.florhit.type == kHitNone)
{
if ((pTSprite->flags & kPhysMove) && getflorzofslopeptr(pTSprite->sectp, pTSprite->pos.X, pTSprite->pos.Y) >= cZ)
if ((pTSprite->flags & kPhysMove) && getflorzofslopeptr(pTSprite->sectp, pTSprite->__int_pos.X, pTSprite->__int_pos.Y) >= cZ)
viewAddEffect(tsprites, nTSprite, kViewEffectShadow);
}
}
@ -984,8 +984,8 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
{
case 1:
{
int dX = cX - pTSprite->pos.X;
int dY = cY - pTSprite->pos.Y;
int dX = cX - pTSprite->__int_pos.X;
int dY = cY - pTSprite->__int_pos.Y;
RotateVector(&dX, &dY, 128 - pTSprite->ang);
nAnim = GetOctant(dX, dY);
if (nAnim <= 4)
@ -1001,8 +1001,8 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
}
case 2:
{
int dX = cX - pTSprite->pos.X;
int dY = cY - pTSprite->pos.Y;
int dX = cX - pTSprite->__int_pos.X;
int dY = cY - pTSprite->__int_pos.Y;
RotateVector(&dX, &dY, 128 - pTSprite->ang);
nAnim = GetOctant(dX, dY);
break;

View file

@ -473,9 +473,9 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int*
}
auto pSprite = &sprites.sprites[i];
*pSprite = {};
pSprite->pos.X = LittleLong(load.x);
pSprite->pos.Y = LittleLong(load.y);
pSprite->pos.Z = LittleLong(load.z);
pSprite->__int_pos.X = LittleLong(load.x);
pSprite->__int_pos.Y = LittleLong(load.y);
pSprite->__int_pos.Z = LittleLong(load.z);
pSprite->cstat = ESpriteFlags::FromInt(LittleShort(load.cstat));
pSprite->picnum = LittleShort(load.picnum);
int secno = LittleShort(load.sectnum);

View file

@ -82,7 +82,7 @@ extern int gSkyCount;
void GetSpriteExtents(spritetypebase const* const pSprite, int* top, int* bottom)
{
*top = *bottom = pSprite->pos.Z;
*top = *bottom = pSprite->__int_pos.Z;
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
int height = tileHeight(pSprite->picnum);

View file

@ -165,14 +165,14 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
if (t->statnum == 99) continue;
if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && ps[h->spr.yvel].newOwner == nullptr && h->GetOwner())
{
t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].opos.X, 16);
t->pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].opos.Y, 16);
t->pos.Z = interpolatedvalue(ps[h->spr.yvel].opos.Z, ps[h->spr.yvel].pos.Z, smoothratio);
t->pos.Z += PHEIGHT_DUKE;
t->__int_pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].opos.X, 16);
t->__int_pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].opos.Y, 16);
t->__int_pos.Z = interpolatedvalue(ps[h->spr.yvel].opos.Z, ps[h->spr.yvel].pos.Z, smoothratio);
t->__int_pos.Z += PHEIGHT_DUKE;
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
t->pos = h->interpolatedvec3(smoothratio);
t->__int_pos = h->interpolatedvec3(smoothratio);
}
auto sectp = h->sector();
@ -183,7 +183,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
switch (h->spr.picnum)
{
case DUKELYINGDEAD:
t->pos.Z += (24 << 8);
t->__int_pos.Z += (24 << 8);
break;
case BLOODPOOL:
case FOOTPRINTS:
@ -209,8 +209,8 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
OwnerAc->int_pos().Y - ps[screenpeek].pos.Y);
int sqb =
getangle(
OwnerAc->int_pos().X - t->pos.X,
OwnerAc->int_pos().Y - t->pos.Y);
OwnerAc->int_pos().X - t->__int_pos.X,
OwnerAc->int_pos().Y - t->__int_pos.Y);
if (abs(getincangle(sqa, sqb)) > 512)
if (ldist(OwnerAc, t) < ldist(ps[screenpeek].GetActor(), OwnerAc))
@ -225,17 +225,17 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
t->xrepeat = 0;
else
{
t->ang = getangle(x - t->pos.X, y - t->pos.Y);
t->pos.X = OwnerAc->int_pos().X;
t->pos.Y = OwnerAc->int_pos().Y;
t->pos.X += bcos(t->ang, -10);
t->pos.Y += bsin(t->ang, -10);
t->ang = getangle(x - t->__int_pos.X, y - t->__int_pos.Y);
t->__int_pos.X = OwnerAc->int_pos().X;
t->__int_pos.Y = OwnerAc->int_pos().Y;
t->__int_pos.X += bcos(t->ang, -10);
t->__int_pos.Y += bsin(t->ang, -10);
}
}
break;
case ATOMICHEALTH:
t->pos.Z -= (4 << 8);
t->__int_pos.Z -= (4 << 8);
break;
case CRYSTALAMMO:
t->shade = bsin(PlayClock << 4, -10);
@ -307,7 +307,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
p = h->spr.yvel;
if (t->pal == 1) t->pos.Z -= (18 << 8);
if (t->pal == 1) t->__int_pos.Z -= (18 << 8);
if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr)
{
@ -357,8 +357,8 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
}
if (h->GetOwner())
newtspr->pos.Z = ps[p].pos.Z - (12 << 8);
else newtspr->pos.Z = h->int_pos().Z - (51 << 8);
newtspr->__int_pos.Z = ps[p].pos.Z - (12 << 8);
else newtspr->__int_pos.Z = h->int_pos().Z - (51 << 8);
if (ps[p].curr_weapon == HANDBOMB_WEAPON)
{
newtspr->xrepeat = 10;
@ -430,8 +430,8 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
if (!h->GetOwner()) continue;
if (t->pos.Z > h->floorz && t->xrepeat < 32)
t->pos.Z = h->floorz;
if (t->__int_pos.Z > h->floorz && t->xrepeat < 32)
t->__int_pos.Z = h->floorz;
break;
@ -590,7 +590,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
shadowspr->shade = 127;
shadowspr->cstat |= CSTAT_SPRITE_TRANSLUCENT;
shadowspr->pos.Z = daz;
shadowspr->__int_pos.Z = daz;
shadowspr->pal = 4;
if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0)
@ -604,9 +604,9 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
int look = getangle(shadowspr->pos.X - ps[screenpeek].pos.X, shadowspr->pos.Y - ps[screenpeek].pos.Y);
shadowspr->pos.X += bcos(look, -9);
shadowspr->pos.Y += bsin(look, -9);
int look = getangle(shadowspr->__int_pos.X - ps[screenpeek].pos.X, shadowspr->__int_pos.Y - ps[screenpeek].pos.Y);
shadowspr->__int_pos.X += bcos(look, -9);
shadowspr->__int_pos.Y += bsin(look, -9);
}
}
}
@ -625,7 +625,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
case LASERLINE:
if (!OwnerAc) break;
if (t->sectp->lotag == 2) t->pal = 8;
t->pos.Z = OwnerAc->int_pos().Z - (3 << 8);
t->__int_pos.Z = OwnerAc->int_pos().Z - (3 << 8);
if (gs.lasermode == 2 && ps[screenpeek].heat_on == 0)
t->yrepeat = 0;
t->shade = -127;
@ -656,7 +656,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
case BURNING2:
if (!OwnerAc) break;
if (!actorflag(OwnerAc, SFLAG_NOFLOORFIRE))
t->pos.Z = t->sectp->floorz;
t->__int_pos.Z = t->sectp->floorz;
t->shade = -127;
break;
case COOLEXPLOSION1:

View file

@ -145,16 +145,16 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
if (t->statnum == 99) continue;
if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && ps[h->spr.yvel].newOwner == nullptr && h->GetOwner())
{
t->pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].opos.X, 16);
t->pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].opos.Y, 16);
t->pos.Z = interpolatedvalue(ps[h->spr.yvel].opos.Z, ps[h->spr.yvel].pos.Z, smoothratio);
t->pos.Z += PHEIGHT_RR;
t->__int_pos.X -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].opos.X, 16);
t->__int_pos.Y -= MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].opos.Y, 16);
t->__int_pos.Z = interpolatedvalue(ps[h->spr.yvel].opos.Z, ps[h->spr.yvel].pos.Z, smoothratio);
t->__int_pos.Z += PHEIGHT_RR;
h->spr.xrepeat = 24;
h->spr.yrepeat = 17;
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
t->pos = h->interpolatedvec3(smoothratio);
t->__int_pos = h->interpolatedvec3(smoothratio);
}
auto sectp = h->sector();
@ -181,7 +181,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
h->spr.xrepeat = 24;
h->spr.yrepeat = 17;
if (h->spr.extra > 0)
t->pos.Z += (6 << 8);
t->__int_pos.Z += (6 << 8);
break;
case BLOODPOOL:
case FOOTPRINTS:
@ -204,8 +204,8 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
OwnerAc->int_pos().Y - ps[screenpeek].pos.Y);
int sqb =
getangle(
OwnerAc->int_pos().X - t->pos.X,
OwnerAc->int_pos().Y - t->pos.Y);
OwnerAc->int_pos().X - t->__int_pos.X,
OwnerAc->int_pos().Y - t->__int_pos.Y);
if (abs(getincangle(sqa, sqb)) > 512)
if (ldist(OwnerAc, t) < ldist(ps[screenpeek].GetActor(), OwnerAc))
@ -219,17 +219,17 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
t->xrepeat = 0;
else
{
t->ang = getangle(x - t->pos.X, y - t->pos.Y);
t->pos.X = OwnerAc->int_pos().X;
t->pos.Y = OwnerAc->int_pos().Y;
t->pos.X += bcos(t->ang, -10);
t->pos.Y += bsin(t->ang, -10);
t->ang = getangle(x - t->__int_pos.X, y - t->__int_pos.Y);
t->__int_pos.X = OwnerAc->int_pos().X;
t->__int_pos.Y = OwnerAc->int_pos().Y;
t->__int_pos.X += bcos(t->ang, -10);
t->__int_pos.Y += bsin(t->ang, -10);
}
}
break;
case ATOMICHEALTH:
t->pos.Z -= (4 << 8);
t->__int_pos.Z -= (4 << 8);
break;
case CRYSTALAMMO:
t->shade = bsin(PlayClock << 4, -10);
@ -349,7 +349,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
p = h->spr.yvel;
if (t->pal == 1) t->pos.Z -= (18 << 8);
if (t->pal == 1) t->__int_pos.Z -= (18 << 8);
if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr)
{
@ -397,8 +397,8 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
}
if (h->GetOwner())
newtspr->pos.Z = ps[p].pos.Z - (12 << 8);
else newtspr->pos.Z = h->int_pos().Z - (51 << 8);
newtspr->__int_pos.Z = ps[p].pos.Z - (12 << 8);
else newtspr->__int_pos.Z = h->int_pos().Z - (51 << 8);
if (ps[p].curr_weapon == HANDBOMB_WEAPON)
{
newtspr->xrepeat = 10;
@ -474,8 +474,8 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
if (!h->GetOwner()) continue;
if (t->pos.Z > h->floorz && t->xrepeat < 32)
t->pos.Z = h->floorz;
if (t->__int_pos.Z > h->floorz && t->xrepeat < 32)
t->__int_pos.Z = h->floorz;
if (ps[p].OnMotorcycle && p == screenpeek)
{
@ -746,7 +746,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
shadowspr->shade = 127;
shadowspr->cstat |= CSTAT_SPRITE_TRANSLUCENT;
shadowspr->pos.Z = daz;
shadowspr->__int_pos.Z = daz;
shadowspr->pal = 4;
if (hw_models && md_tilehasmodel(t->picnum, t->pal) >= 0)
@ -760,9 +760,9 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
int look = getangle(shadowspr->pos.X - ps[screenpeek].pos.X, shadowspr->pos.Y - ps[screenpeek].pos.Y);
shadowspr->pos.X += bcos(look, -9);
shadowspr->pos.Y += bsin(look, -9);
int look = getangle(shadowspr->__int_pos.X - ps[screenpeek].pos.X, shadowspr->__int_pos.Y - ps[screenpeek].pos.Y);
shadowspr->__int_pos.X += bcos(look, -9);
shadowspr->__int_pos.Y += bsin(look, -9);
}
}
}
@ -813,7 +813,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
case FIRE:
case BURNING:
if (!OwnerAc || !actorflag(OwnerAc, SFLAG_NOFLOORFIRE))
t->pos.Z = t->sectp->floorz;
t->__int_pos.Z = t->sectp->floorz;
t->shade = -127;
break;
case WALLLIGHT3:

View file

@ -105,8 +105,8 @@ inline int ldist(DDukeActor* s1, DDukeActor* s2)
inline int ldist(const DDukeActor* s1, const tspritetype* s2)
{
int vx, vy;
vx = s1->int_pos().X - s2->pos.X;
vy = s1->int_pos().Y - s2->pos.Y;
vx = s1->int_pos().X - s2->__int_pos.X;
vy = s1->int_pos().Y - s2->__int_pos.Y;
return(FindDistance2D(vx, vy) + 1);
}
inline int dist(DDukeActor* s1, DDukeActor* s2)

View file

@ -479,7 +479,7 @@ int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx)
int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal)
{
tspritetype* pTSprite = mytspriteArray->get(nSprite);
int nAngle = GetMyAngle(nCamerax - pTSprite->pos.X, nCameray - pTSprite->pos.Y);
int nAngle = GetMyAngle(nCamerax - pTSprite->__int_pos.X, nCameray - pTSprite->__int_pos.Y);
int nSeqOffset = ((((pTSprite->ang + 512) - nAngle) + 128) & kAngleMask) >> 8;
@ -527,7 +527,7 @@ int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal)
int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
{
tspritetype* pTSprite = mytspriteArray->get(nSprite);
int nAngle = GetMyAngle(nCamerax - pTSprite->pos.X, nCameray - pTSprite->pos.Y);
int nAngle = GetMyAngle(nCamerax - pTSprite->__int_pos.X, nCameray - pTSprite->__int_pos.Y);
int val;
@ -580,9 +580,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
}
tspritetype* tsp = mytspriteArray->newTSprite();
tsp->pos.X = pTSprite->pos.X;
tsp->pos.Y = pTSprite->pos.Y;
tsp->pos.Z = pTSprite->pos.Z;
tsp->__int_pos = pTSprite->__int_pos;
tsp->shade = shade;
tsp->pal = pTSprite->pal;
tsp->xrepeat = pTSprite->xrepeat;
@ -626,13 +624,13 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
{
pTSprite->picnum = nShadowPic;
edx = ((tileWidth(nPict) << 5) / nShadowWidth) - ((nFloorZ - pTSprite->pos.Z) >> 10);
edx = ((tileWidth(nPict) << 5) / nShadowWidth) - ((nFloorZ - pTSprite->__int_pos.Z) >> 10);
if (edx < 1) {
edx = 1;
}
pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT;
pTSprite->pos.Z = nFloorZ;
pTSprite->__int_pos.Z = nFloorZ;
pTSprite->yrepeat = (uint8_t)edx;
pTSprite->xrepeat = (uint8_t)edx;
pTSprite->statnum = -3;

View file

@ -73,7 +73,7 @@ static void analyzesprites(tspriteArray& tsprites, int x, int y, int z, double c
if (pTSprite->ownerActor)
{
// interpolate sprite position
pTSprite->pos = pTSprite->ownerActor->interpolatedvec3(smoothratio);
pTSprite->__int_pos = pTSprite->ownerActor->interpolatedvec3(smoothratio);
pTSprite->ang = pTSprite->ownerActor->interpolatedang(smoothratio);
}
}
@ -110,7 +110,7 @@ static void analyzesprites(tspriteArray& tsprites, int x, int y, int z, double c
{
pTSprite->cstat |= CSTAT_SPRITE_YCENTER;
int nTileY = (tileHeight(pTSprite->picnum) * pTSprite->yrepeat) * 2;
pTSprite->pos.Z -= nTileY;
pTSprite->__int_pos.Z -= nTileY;
}
if (pTSprite->pal == 4 && pTSprite->shade >= numshades) pTSprite->shade = numshades - 1;

View file

@ -103,7 +103,7 @@ int GetRotation(tspriteArray& tsprites, int tSpriteNum, int viewx, int viewy)
// Get which of the 8 angles of the sprite to draw (0-7)
// rotation ranges from 0-7
angle2 = getangle(tsp->pos.X - viewx, tsp->pos.Y - viewy);
angle2 = getangle(tsp->__int_pos.X - viewx, tsp->__int_pos.Y - viewy);
rotation = ((tsp->ang + 3072 + 128 - angle2) & 2047);
rotation = (rotation >> 8) & 7;
@ -211,7 +211,7 @@ int DoShadowFindGroundPoint(tspritetype* tspr)
save_cstat = tspr->cstat;
tspr->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
FAFgetzrangepoint(tspr->pos.X, tspr->pos.Y, tspr->pos.Z, tspr->sectp, &hiz, &ceilhit, &loz, &florhit);
FAFgetzrangepoint(tspr->__int_pos.X, tspr->__int_pos.Y, tspr->__int_pos.Z, tspr->sectp, &hiz, &ceilhit, &loz, &florhit);
tspr->cstat = save_cstat;
switch (florhit.type)
@ -263,7 +263,7 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, int viewz, int camang)
auto sect = tsp->sectp;
// make sure its the correct sector
// DoShadowFindGroundPoint calls FAFgetzrangepoint and this is sensitive
updatesector(tsp->pos.X, tsp->pos.Y, &sect);
updatesector(tsp->__int_pos.X, tsp->__int_pos.Y, &sect);
if (sect == nullptr)
{
@ -300,7 +300,7 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, int viewz, int camang)
}
// need to find the ground here
tSpr->pos.Z = loz;
tSpr->__int_pos.Z = loz;
// if below or close to sprites z don't bother to draw it
if ((viewz - loz) > -Z(8))
@ -335,9 +335,9 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, int viewz, int camang)
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
int look = getangle(tSpr->pos.X - Player[screenpeek].si.X, tSpr->pos.Y - Player[screenpeek].si.Y);
tSpr->pos.X += bcos(look, -9);
tSpr->pos.Y += bsin(look, -9);
int look = getangle(tSpr->__int_pos.X - Player[screenpeek].si.X, tSpr->__int_pos.Y - Player[screenpeek].si.Y);
tSpr->__int_pos.X += bcos(look, -9);
tSpr->__int_pos.Y += bsin(look, -9);
}
// Check for voxel items and use a round generic pic if so
@ -406,12 +406,12 @@ void DoMotionBlur(tspriteArray& tsprites, tspritetype const * const tsp)
*tSpr = *tsp;
tSpr->cstat |= CSTAT_SPRITE_TRANSLUCENT|CSTAT_SPRITE_TRANS_FLIP;
tSpr->pos.X += dx;
tSpr->pos.Y += dy;
tSpr->__int_pos.X += dx;
tSpr->__int_pos.Y += dy;
dx += nx;
dy += ny;
tSpr->pos.Z += dz;
tSpr->__int_pos.Z += dz;
dz += nz;
tSpr->xrepeat = uint8_t(xrepeat);
@ -456,13 +456,13 @@ void WarpCopySprite(tspriteArray& tsprites)
tspritetype* newTSpr = renderAddTsprite(tsprites, itActor2);
newTSpr->statnum = 0;
xoff = itActor->int_pos().X - newTSpr->pos.X;
yoff = itActor->int_pos().Y - newTSpr->pos.Y;
zoff = itActor->int_pos().Z - newTSpr->pos.Z;
xoff = itActor->int_pos().X - newTSpr->__int_pos.X;
yoff = itActor->int_pos().Y - newTSpr->__int_pos.Y;
zoff = itActor->int_pos().Z - newTSpr->__int_pos.Z;
newTSpr->pos.X = itActor1->int_pos().X - xoff;
newTSpr->pos.Y = itActor1->int_pos().Y - yoff;
newTSpr->pos.Z = itActor1->int_pos().Z - zoff;
newTSpr->__int_pos.X = itActor1->int_pos().X - xoff;
newTSpr->__int_pos.Y = itActor1->int_pos().Y - yoff;
newTSpr->__int_pos.Z = itActor1->int_pos().Z - zoff;
newTSpr->sectp = itActor1->sector();
}
@ -478,8 +478,8 @@ void WarpCopySprite(tspriteArray& tsprites)
tspritetype* newTSpr = renderAddTsprite(tsprites, itActor2);
newTSpr->statnum = 0;
auto off = itActor1->int_pos() - newTSpr->pos;
newTSpr->pos = itActor->int_pos() - off;
auto off = itActor1->int_pos() - newTSpr->__int_pos;
newTSpr->__int_pos = itActor->int_pos() - off;
newTSpr->sectp = itActor->sector();
}
}
@ -491,7 +491,7 @@ void DoStarView(tspritetype* tsp, DSWActor* tActor, int viewz)
{
extern STATE s_Star[], s_StarDown[];
extern STATE s_StarStuck[], s_StarDownStuck[];
int zdiff = viewz - tsp->pos.Z;
int zdiff = viewz - tsp->__int_pos.Z;
if (labs(zdiff) > Z(24))
{
@ -516,7 +516,7 @@ DSWActor* CopySprite(sprt const* tsp, sectortype* newsector)
auto actorNew = insertActor(newsector, STAT_FAF_COPY);
actorNew->set_int_pos(tsp->pos);
actorNew->set_int_pos(tsp->__int_pos);
actorNew->spr.cstat = tsp->cstat;
actorNew->spr.picnum = tsp->picnum;
actorNew->spr.pal = tsp->pal;
@ -546,7 +546,7 @@ DSWActor* ConnectCopySprite(spritetypebase const* tsp)
testz = GetSpriteZOfTop(tsp) - Z(10);
if (testz < tsp->sectp->ceilingz)
updatesectorz(tsp->pos.X, tsp->pos.Y, testz, &newsector);
updatesectorz(tsp->__int_pos.X, tsp->__int_pos.Y, testz, &newsector);
if (newsector != nullptr && newsector != tsp->sectp)
{
@ -560,7 +560,7 @@ DSWActor* ConnectCopySprite(spritetypebase const* tsp)
testz = GetSpriteZOfBottom(tsp) + Z(10);
if (testz > tsp->sectp->floorz)
updatesectorz(tsp->pos.X, tsp->pos.Y, testz, &newsector);
updatesectorz(tsp->__int_pos.X, tsp->__int_pos.Y, testz, &newsector);
if (newsector != nullptr && newsector != tsp->sectp)
{
@ -623,7 +623,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int
{
if (tsp->statnum <= STAT_SKIP4_INTERP_END)
{
tsp->pos = tActor->interpolatedvec3(smr4, 18);
tsp->__int_pos = tActor->interpolatedvec3(smr4, 18);
}
}
@ -631,7 +631,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int
{
if (tsp->statnum <= STAT_SKIP2_INTERP_END)
{
tsp->pos = tActor->interpolatedvec3(smr2, 17);
tsp->__int_pos = tActor->interpolatedvec3(smr2, 17);
}
}
}
@ -641,7 +641,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int
{
int32_t const floorz = getflorzofslopeptr(tActor->sector(), tActor->int_pos().X, tActor->int_pos().Y);
if (tActor->int_pos().Z > floorz)
tsp->pos.Z = floorz;
tsp->__int_pos.Z = floorz;
}
if (r_shadows && (tActor->user.Flags & SPR_SHADOW))
@ -761,16 +761,16 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int
{
// move sprite forward some so he looks like he's
// climbing
tsp->pos.X = pp->si.X + MOVEx(128 + 80, tsp->ang);
tsp->pos.Y = pp->si.Y + MOVEy(128 + 80, tsp->ang);
tsp->__int_pos.X = pp->si.X + MOVEx(128 + 80, tsp->ang);
tsp->__int_pos.Y = pp->si.Y + MOVEy(128 + 80, tsp->ang);
}
else
{
tsp->pos.X = pp->si.X;
tsp->pos.Y = pp->si.Y;
tsp->__int_pos.X = pp->si.X;
tsp->__int_pos.Y = pp->si.Y;
}
tsp->pos.Z = tsp->pos.Z + pp->si.Z;
tsp->__int_pos.Z = tsp->__int_pos.Z + pp->si.Z;
tsp->ang = pp->siang;
//continue;
}
@ -785,9 +785,9 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int
{
pp = tActor->user.PlayerP;
int sr = 65536 - int(smoothratio);
tsp->pos.X -= MulScale(pp->pos.X - pp->opos.X, sr, 16);
tsp->pos.Y -= MulScale(pp->pos.Y - pp->opos.Y, sr, 16);
tsp->pos.Z -= MulScale(pp->pos.Z - pp->opos.Z, sr, 16);
tsp->__int_pos.X -= MulScale(pp->pos.X - pp->opos.X, sr, 16);
tsp->__int_pos.Y -= MulScale(pp->pos.Y - pp->opos.Y, sr, 16);
tsp->__int_pos.Z -= MulScale(pp->pos.Z - pp->opos.Z, sr, 16);
tsp->ang -= MulScale(pp->angle.ang.asbuild() - pp->angle.oang.asbuild(), sr, 16);
}
}
@ -905,8 +905,8 @@ void post_analyzesprites(tspriteArray& tsprites)
continue;
}
tsp->pos.X = atsp->pos.X;
tsp->pos.Y = atsp->pos.Y;
tsp->__int_pos.X = atsp->__int_pos.X;
tsp->__int_pos.Y = atsp->__int_pos.Y;
// statnum is priority - draw this ALWAYS first at 0
// statnum is priority - draw this ALWAYS last at MAXSTATUS
if ((atsp->extra & SPRX_BURNABLE))

View file

@ -242,15 +242,15 @@ inline int GetSpriteSizeToBottom(const spritetypebase* sp)
inline int GetSpriteZOfTop(const spritetypebase* sp)
{
return (sp->cstat & CSTAT_SPRITE_YCENTER) ?
sp->pos.Z - GetSpriteSizeToTop(sp) :
sp->pos.Z - GetSpriteSizeZ(sp);
sp->__int_pos.Z - GetSpriteSizeToTop(sp) :
sp->__int_pos.Z - GetSpriteSizeZ(sp);
}
inline int GetSpriteZOfBottom(const spritetypebase* sp)
{
return (sp->cstat & CSTAT_SPRITE_YCENTER) ?
sp->pos.Z + GetSpriteSizeToBottom(sp) :
sp->pos.Z;
sp->__int_pos.Z + GetSpriteSizeToBottom(sp) :
sp->__int_pos.Z;
}
// mid and upper/lower sprite calculations
@ -2119,7 +2119,7 @@ struct ANIM
return SectorObject[animindex].pmid.Z;
case ANIM_Spritez:
if (animactor == nullptr) return scratch;
return animactor->spr.pos.Z;
return animactor->spr.__int_pos.Z;
case ANIM_Userz:
if (animactor == nullptr) return scratch;
return animactor->user.pos.Z;

View file

@ -157,15 +157,15 @@ static void setvalue(so_interp::interp_data& element, double value)
break;
case soi_sprx:
if (element.actorofang)
element.actorofang->spr.pos.X = (int)value;
element.actorofang->spr.__int_pos.X = (int)value;
break;
case soi_spry:
if (element.actorofang)
element.actorofang->spr.pos.Y = (int)value;
element.actorofang->spr.__int_pos.Y = (int)value;
break;
case soi_sprz:
if (element.actorofang)
element.actorofang->spr.pos.Z = (int)value;
element.actorofang->spr.__int_pos.Z = (int)value;
break;
default:
break;

View file

@ -532,7 +532,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
}
else if (type == SOURCE_Actor || type == SOURCE_Player)
{
vpos = type == SOURCE_Actor ? &((DSWActor*)source)->spr.pos : &((PLAYER*)source)->pos;
vpos = type == SOURCE_Actor ? &((DSWActor*)source)->spr.__int_pos : &((PLAYER*)source)->pos;
FVector3 npos = GetSoundPos(vpos);
*pos = npos;
@ -552,7 +552,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
else if (type == SOURCE_Ambient)
{
auto spot = ((AmbientSound*)source)->spot;
vpos = &spot->spr.pos;
vpos = &spot->spr.__int_pos;
FVector3 npos = GetSoundPos(vpos);
// Can the ambient sound see the player? If not, tone it down some.