mirror of
https://github.com/DrBeef/Raze.git
synced 2025-03-30 20:51:22 +00:00
- late __int_pos additions
This commit is contained in:
parent
4c6976baca
commit
c15aeec9f7
7 changed files with 14 additions and 72 deletions
|
@ -557,7 +557,7 @@ tspritetype* renderAddTsprite(tspriteArray& tsprites, DCoreActor* actor)
|
|||
{
|
||||
auto tspr = tsprites.newTSprite();
|
||||
|
||||
tspr->__int_pos = actor->int_pos();
|
||||
tspr->set_int_pos(actor->int_pos());
|
||||
tspr->cstat = actor->spr.cstat;
|
||||
tspr->picnum = actor->spr.picnum;
|
||||
tspr->shade = actor->spr.shade;
|
||||
|
|
|
@ -322,7 +322,7 @@ 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->__int_pos.Z;
|
||||
if (heinum == 0) return tspr->int_pos().Z;
|
||||
|
||||
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);
|
||||
|
|
|
@ -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->__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 (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;
|
||||
|
|
|
@ -530,57 +530,3 @@ DEFINE_ACTION_FUNCTION_NATIVE(_walltype, twosided, wall_twosided)
|
|||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_BOOL(self->twoSided());
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_tspritetype, pos)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
|
||||
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->__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)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(z);
|
||||
tsprite_setpos(self, x, y, z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tsprite_addpos(tspritetype* tsp, double x, double y, double z)
|
||||
{
|
||||
if (!tsp) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
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)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(z);
|
||||
tsprite_addpos(self, x, y, z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
struct tsprite
|
||||
{
|
||||
void setPic(string texture);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -391,10 +391,10 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
|
|||
auto pNSprite = viewInsertTSprite(tsprites, pTSprite->sectp, 32767, pTSprite);
|
||||
if (!pNSprite)
|
||||
break;
|
||||
pNSprite->__int_pos.Z = getflorzofslopeptr(pTSprite->sectp, pNSprite->__int_pos.X, pNSprite->__int_pos.Y);
|
||||
pNSprite->set_int_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->__int_pos.X, cY = pNSprite->__int_pos.Y, cZ = pNSprite->__int_pos.Z, cZrel = pNSprite->__int_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
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
|
|||
cZ = newFloorZ;
|
||||
}
|
||||
pNSprite->sectp = cSect;
|
||||
pNSprite->__int_pos.Z = cZrel;
|
||||
pNSprite->set_int_z(cZrel);
|
||||
}
|
||||
pNSprite->shade = 127;
|
||||
pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
|
||||
|
@ -419,7 +419,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->__int_pos.Z -= (pNSprite->yrepeat << 2) * (height - center);
|
||||
pNSprite->add_int_z(-(pNSprite->yrepeat << 2) * (height - center));
|
||||
break;
|
||||
}
|
||||
case kViewEffectFlareHalo:
|
||||
|
|
|
@ -110,15 +110,15 @@ static double getvalue(so_interp::interp_data& element)
|
|||
return SectorObject[index].pmid.Z;
|
||||
case soi_sprx:
|
||||
if (element.actorofang)
|
||||
return element.actorofang->int_pos().X;
|
||||
return element.actorofang->float_pos().X;
|
||||
break;
|
||||
case soi_spry:
|
||||
if (element.actorofang)
|
||||
return element.actorofang->int_pos().Y;
|
||||
return element.actorofang->float_pos().Y;
|
||||
break;
|
||||
case soi_sprz:
|
||||
if (element.actorofang)
|
||||
return element.actorofang->int_pos().Z;
|
||||
return element.actorofang->float_pos().Z;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -157,15 +157,15 @@ static void setvalue(so_interp::interp_data& element, double value)
|
|||
break;
|
||||
case soi_sprx:
|
||||
if (element.actorofang)
|
||||
element.actorofang->spr.__int_pos.X = (int)value;
|
||||
element.actorofang->add_float_pos({ value, 0, 0});
|
||||
break;
|
||||
case soi_spry:
|
||||
if (element.actorofang)
|
||||
element.actorofang->spr.__int_pos.Y = (int)value;
|
||||
element.actorofang->add_float_pos({ 0, value, 0});
|
||||
break;
|
||||
case soi_sprz:
|
||||
if (element.actorofang)
|
||||
element.actorofang->spr.__int_pos.Z = (int)value;
|
||||
element.actorofang->add_float_pos({ 0, 0, value});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -298,11 +298,7 @@ struct tspritetype native
|
|||
native int8 yoffset;
|
||||
native CoreActor ownerActor;
|
||||
native int time;
|
||||
|
||||
//void setPic(string texture);
|
||||
native Vector3 pos();
|
||||
native void setPos(Vector3 pos);
|
||||
native void addPos(Vector3 pos);
|
||||
|
||||
}
|
||||
|
||||
enum ESprextFlags
|
||||
|
|
Loading…
Reference in a new issue