- remove float_pos wrapper.

This commit is contained in:
Christoph Oelckers 2022-02-07 08:49:03 +01:00
parent b327f7f03a
commit 24c845f827
5 changed files with 10 additions and 80 deletions

View file

@ -496,6 +496,7 @@ DEFINE_FIELD_NAMED(DCoreActor, spr.cstat2, cstat2)
DEFINE_FIELD_NAMED(DCoreActor, spr.picnum, picnum)
DEFINE_FIELD_NAMED(DCoreActor, spr.statnum, statnum)
DEFINE_FIELD_NAMED(DCoreActor, spr.ang, ang)
DEFINE_FIELD_NAMED(DCoreActor, spr.pos, pos)
DEFINE_FIELD_NAMED(DCoreActor, spr.xvel, xvel)
DEFINE_FIELD_NAMED(DCoreActor, spr.yvel, yvel)
DEFINE_FIELD_NAMED(DCoreActor, spr.zvel, zvel)
@ -525,29 +526,6 @@ DEFINE_FIELD_NAMED(DCoreActor, sprext.alpha, alpha)
DEFINE_FIELD_NAMED(DCoreActor, time, spawnindex)
DEFINE_FIELD_NAMED(DCoreActor, spritesetindex, spritesetpic)
DEFINE_ACTION_FUNCTION(DCoreActor, pos)
{
PARAM_SELF_PROLOGUE(DCoreActor);
ACTION_RETURN_VEC3(self->float_pos());
}
DEFINE_ACTION_FUNCTION(DCoreActor, xy)
{
PARAM_SELF_PROLOGUE(DCoreActor);
ACTION_RETURN_VEC2(self->float_pos().XY());
}
double coreactor_z(DCoreActor* self)
{
return self->float_pos().Z;
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, z, coreactor_z)
{
PARAM_SELF_PROLOGUE(DCoreActor);
ACTION_RETURN_FLOAT(coreactor_z(self));
}
void coreactor_setpos(DCoreActor* self, double x, double y, double z, int relink)
{
self->spr.pos = { x, y, z };
@ -601,32 +579,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, move, coreactor_move)
return 0;
}
void coreactor_setz(DCoreActor* self, double z)
{
self->spr.pos.Z = z;
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, setz, coreactor_setz)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_FLOAT(z);
coreactor_setz(self, z);
return 0;
}
void coreactor_addz(DCoreActor* self, double z)
{
self->spr.pos.Z += z;
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, addz, coreactor_addz)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_FLOAT(z);
coreactor_addz(self, z);
return 0;
}
void coreactor_setSpritePic(DCoreActor* self, unsigned z)
{
auto &spriteset = static_cast<PClassActor*>(self->GetClass())->ActorInfo()->SpriteSet;

View file

@ -107,22 +107,6 @@ public:
spr.pos.Y = y * inttoworld;
}
DVector3 float_pos() const
{
return spr.pos;
}
void set_float_z(int z)
{
spr.pos.Z = z;
}
void add_float_z(int z)
{
spr.pos.Z += z;
}
// Same as above but with invertex y and z axes to match the renderer's coordinate system.
DVector3 render_pos() const
{

View file

@ -600,15 +600,15 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
if (actor2->spr.hitag == 1)
{
geosectorwarp[geocnt] = actor2->sector();
geox[geocnt] = actor->float_pos().X - actor2->float_pos().X;
geoy[geocnt] = actor->float_pos().Y - actor2->float_pos().Y;
geox[geocnt] = actor->spr.pos.X - actor2->spr.pos.X;
geoy[geocnt] = actor->spr.pos.Y - actor2->spr.pos.Y;
//geoz[geocnt] = actor->spr.z - actor2->spr.z;
}
if (actor2->spr.hitag == 2)
{
geosectorwarp2[geocnt] = actor2->sector();
geox2[geocnt] = actor->float_pos().X - actor2->float_pos().X;
geoy2[geocnt] = actor->float_pos().Y - actor2->float_pos().Y;
geox2[geocnt] = actor->spr.pos.X - actor2->spr.pos.X;
geoy2[geocnt] = actor->spr.pos.Y - actor2->spr.pos.Y;
//geoz2[geocnt] = actor->spr.z - actor2->spr.z;
}
}

View file

@ -382,22 +382,22 @@ int DoSlidorInstantClose(DSWActor* actor)
switch (wal->lotag)
{
case TAG_WALL_SLIDOR_LEFT:
diff = wal->pos.X - actor->float_pos().X;
diff = wal->pos.X - actor->spr.pos.X;
DoSlidorMoveWalls(actor, diff);
break;
case TAG_WALL_SLIDOR_RIGHT:
diff = wal->pos.X - actor->float_pos().X;
diff = wal->pos.X - actor->spr.pos.X;
DoSlidorMoveWalls(actor, -diff);
break;
case TAG_WALL_SLIDOR_UP:
diff = wal->pos.Y - actor->float_pos().Y;
diff = wal->pos.Y - actor->spr.pos.Y;
DoSlidorMoveWalls(actor, diff);
break;
case TAG_WALL_SLIDOR_DOWN:
diff = wal->pos.Y - actor->float_pos().Y;
diff = wal->pos.Y - actor->spr.pos.Y;
DoSlidorMoveWalls(actor, -diff);
break;
}

View file

@ -5,6 +5,7 @@ class CoreActor native
native int16 cstat;
//native int16 picnum; // access is disabled to allow later refactoring.
native readonly Vector3 pos;
native readonly int16 statnum;
native int16 ang;
native int16 xvel;
@ -37,16 +38,9 @@ class CoreActor native
native readonly int16 spritesetpic;
native readonly int spawnindex;
// note that the pos vector is not directly accessible here.
// Its mixed fixed point format should be hidden from scripting, plus we need to wrap the setters to ensure proper sector linking anyway.
native Vector3 pos();
native Vector2 xy();
native double z();
native void setpos(Vector3 newpos, bool relink = true);
native void copypos(CoreActor newpos, bool relink = true);
native void move(Vector3 newpos, bool relink = true);
native void setz(double newz);
native void addz(double amount);
native void setSpritePic(int index); // index into actor's spriteset.
native void backuppos();
}