- add more wrappers and use 'inittype' where the actual zvel member of spritetype is wanted.

This will avoid problems with search&replace later.
This commit is contained in:
Christoph Oelckers 2022-09-01 00:45:45 +02:00
parent 8946a66350
commit 05f488ce3c
6 changed files with 20 additions and 9 deletions

View file

@ -499,7 +499,7 @@ DEFINE_FIELD_NAMED(DCoreActor, spr.statnum, statnum)
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)
DEFINE_FIELD_NAMED(DCoreActor, spr.inittype, zvel)
DEFINE_FIELD_NAMED(DCoreActor, spr.inittype, inittype)
DEFINE_FIELD_NAMED(DCoreActor, spr.hitag, hitag)
DEFINE_FIELD_NAMED(DCoreActor, spr.lotag, lotag)

View file

@ -111,24 +111,35 @@ public:
spr.angle = spr.angle.Normalized360();
}
// these use Blood's inittype alias to not get caught up in searches.
int int_zvel() const
{
return spr. zvel;
return spr.inittype;
}
double float_zvel() const
{
return spr.inittype * zinttoworld;
}
void clear_zvel()
{
spr.inittype = 0;
}
void set_int_zvel(int v)
{
spr. zvel = v;
spr.inittype = v;
}
void add_int_zvel(int v)
{
spr.zvel += v;
spr.inittype += v;
}
void mul_int_zvel(double v)
{
spr.zvel = int(spr.zvel * v);
spr.inittype = int(spr.inittype * v);
}
// Same as above but with inverted y and z axes to match the renderer's coordinate system.

View file

@ -615,7 +615,7 @@ tspritetype* renderAddTsprite(tspriteArray& tsprites, DCoreActor* actor)
tspr->angle = actor->spr.angle;
tspr->xvel = actor->spr.xvel;
tspr->yvel = actor->spr.yvel;
tspr->zvel = actor->int_zvel();
tspr->inittype = actor->spr.inittype;
tspr->lotag = actor->spr.lotag;
tspr->hitag = actor->spr.hitag;
tspr->extra = actor->spr.extra;

View file

@ -466,7 +466,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, spritetype &c, spritet
("owner", c.intowner, def->intowner)
("xvel", c.xvel, def->xvel)
("yvel", c.yvel, def->yvel)
("zvel", c.zvel, def->zvel)
("zvel", c.inittype, def->inittype)
("lotag", c.lotag, def->lotag)
("hitag", c.hitag, def->hitag)
("extra", c.extra, def->extra)

View file

@ -367,7 +367,7 @@ DEFINE_PROPERTY(yvel, I, CoreActor)
DEFINE_PROPERTY(zvel, I, CoreActor)
{
PROP_INT_PARM(i, 0);
bag.Info->ActorInfo()->defsprite.zvel = i;
bag.Info->ActorInfo()->defsprite.inittype = i;
bag.Info->ActorInfo()->DefaultFlags |= DEFF_ZVEL;
}

View file

@ -87,7 +87,7 @@ DEFINE_FIELD_X(tspritetype, tspritetype, statnum)
DEFINE_FIELD_X(tspritetype, tspritetype, angle)
DEFINE_FIELD_X(tspritetype, tspritetype, xvel)
DEFINE_FIELD_X(tspritetype, tspritetype, yvel)
DEFINE_FIELD_X(tspritetype, tspritetype, zvel)
DEFINE_FIELD_NAMED_X(tspritetype, tspritetype, inittype,zvel)
DEFINE_FIELD_X(tspritetype, tspritetype, lotag)
DEFINE_FIELD_X(tspritetype, tspritetype, hitag)
DEFINE_FIELD_X(tspritetype, tspritetype, extra)