mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- started removing trivial vel wrappers
This commit is contained in:
parent
64e8a369ec
commit
b924569755
5 changed files with 20 additions and 35 deletions
|
@ -210,11 +210,6 @@ public:
|
|||
vel.Y *= v;
|
||||
}
|
||||
|
||||
DVector3 fVel() const
|
||||
{
|
||||
return vel;
|
||||
}
|
||||
|
||||
vec3_t int_vel() const
|
||||
{
|
||||
return vec3_t(FloatToFixed(vel.X), FloatToFixed(vel.Y), FloatToFixed(vel.Z));
|
||||
|
@ -240,16 +235,6 @@ public:
|
|||
vel = { FixedToFloat(x.X), FixedToFloat(x.Y), FixedToFloat(x.Z) };
|
||||
}
|
||||
|
||||
void set_float_bvel(DVector3 x)
|
||||
{
|
||||
vel = x;
|
||||
}
|
||||
|
||||
void set_float_bvel_xy(DVector2 x)
|
||||
{
|
||||
vel.XY() = x;
|
||||
}
|
||||
|
||||
void add_int_bvel_x(int x)
|
||||
{
|
||||
vel .X += FixedToFloat(x);
|
||||
|
@ -265,7 +250,7 @@ public:
|
|||
vel .Z += FixedToFloat(x);
|
||||
}
|
||||
|
||||
void clear_vel_xy()
|
||||
void ZeroVelocityXY()
|
||||
{
|
||||
vel .X = vel .Y = 0;
|
||||
}
|
||||
|
|
|
@ -2592,10 +2592,10 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, const DVector
|
|||
void actWallBounceVector(DBloodActor* actor, walltype* pWall, double factor)
|
||||
{
|
||||
auto delta = pWall->delta().Unit();
|
||||
auto vel = actor->fVel().XY();
|
||||
auto vel = actor->vel.XY();
|
||||
double t = vel.X * -delta.Y + vel.Y * delta.X;
|
||||
double t2 = t * (factor+1);
|
||||
actor->set_float_bvel_xy(vel - DVector2(-delta.Y * t2, delta.X * t2));
|
||||
actor->vel.XY() = (vel - DVector2(-delta.Y * t2, delta.X * t2));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -2611,7 +2611,7 @@ DVector4 actFloorBounceVector(DBloodActor* actor, double oldz, sectortype* pSect
|
|||
if (pSector->floorheinum == 0)
|
||||
{
|
||||
double t2 = oldz * t;
|
||||
return { actor->fVel().X, actor->fVel().Y, oldz - t2, t2};
|
||||
return { actor->vel.X, actor->vel.Y, oldz - t2, t2};
|
||||
}
|
||||
|
||||
walltype* pWall = pSector->firstWall();
|
||||
|
@ -2951,7 +2951,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
|
|||
actDropObject(actor, actor->xspr.dropMsg);
|
||||
|
||||
actor->spr.flags &= ~kPhysMove;
|
||||
actor->clear_vel_xy();
|
||||
actor->ZeroVelocityXY();
|
||||
|
||||
playGenDudeSound(actor, kGenDudeSndTransforming);
|
||||
int seqId = actor->xspr.data2 + kGenDudeSeqTransform;
|
||||
|
@ -4615,7 +4615,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
actor->spr.flags |= 4;
|
||||
|
||||
auto vec4 = actFloorBounceVector(actor, FixedToFloat(v20), actor->sector(), FixedToFloat(pThingInfo->elastic));
|
||||
actor->set_float_bvel_xy(vec4.XY());
|
||||
actor->vel,XY() = vec4.XY();
|
||||
int vax = FloatToFixed(vec4.W);
|
||||
|
||||
int nDamage = MulScale(vax, vax, 30) - pThingInfo->dmgResist;
|
||||
|
@ -5105,7 +5105,7 @@ void MoveDude(DBloodActor* actor)
|
|||
if (v30 > 0)
|
||||
{
|
||||
auto vec4 = actFloorBounceVector(actor, FixedToFloat(v30), actor->sector(), 0);
|
||||
actor->set_float_bvel_xy(vec4.XY());
|
||||
actor->vel.XY() = vec4.XY();
|
||||
int vax = FloatToFixed(vec4.W);
|
||||
|
||||
int nDamage = MulScale(vax, vax, 30);
|
||||
|
@ -5204,7 +5204,7 @@ void MoveDude(DBloodActor* actor)
|
|||
actor->add_int_bvel_y(-mulscale16r(actor->int_vel().Y, nDrag));
|
||||
|
||||
if (approxDist(actor->int_vel().X, actor->int_vel().Y) < 0x1000)
|
||||
actor->clear_vel_xy();
|
||||
actor->ZeroVelocityXY();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5249,7 +5249,7 @@ int MoveMissile(DBloodActor* actor)
|
|||
actor->add_int_bvel_z(deltaz);
|
||||
}
|
||||
}
|
||||
auto vel = actor->fVel();
|
||||
auto vel = actor->vel;
|
||||
double top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
int i = 1;
|
||||
|
@ -5314,9 +5314,9 @@ int MoveMissile(DBloodActor* actor)
|
|||
}
|
||||
if (cliptype >= 0 && cliptype != 3)
|
||||
{
|
||||
double nVel = actor->fVel().XY().Length();
|
||||
ppos.XY() -= actor->fVel().XY() / nVel;
|
||||
vel.Z -= actor->fVel().Z / nVel;
|
||||
double nVel = actor->vel.XY().Length();
|
||||
ppos.XY() -= actor->vel.XY() / nVel;
|
||||
vel.Z -= actor->vel.Z / nVel;
|
||||
updatesector(ppos, &pSector);
|
||||
pSector2 = pSector;
|
||||
}
|
||||
|
@ -6009,7 +6009,7 @@ static void actCheckDudes()
|
|||
// handle incarnations of custom dude
|
||||
if (actor->spr.type == kDudeModernCustom && actor->xspr.txID > 0 && actor->xspr.sysData1 == kGenDudeTransformStatus)
|
||||
{
|
||||
actor->clear_vel_xy();
|
||||
actor->ZeroVelocityXY();
|
||||
if (seqGetStatus(actor) < 0) genDudeTransform(actor);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -220,7 +220,7 @@ void genDudeAttack1(int, DBloodActor* actor)
|
|||
if (actor->GetTarget() == nullptr) return;
|
||||
|
||||
int dx, dy, dz;
|
||||
actor->clear_vel_xy();
|
||||
actor->ZeroVelocityXY();
|
||||
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
int dispersion = pExtra->baseDispersion;
|
||||
|
|
|
@ -527,7 +527,7 @@ void fxBouncingSleeve(DBloodActor* actor, sectortype*) // 16
|
|||
else if (zv > 0)
|
||||
{
|
||||
auto vec4 = actFloorBounceVector(actor, FixedToFloat(zv), actor->sector(), FixedToFloat(0x9000));
|
||||
actor->set_float_bvel(vec4.XYZ());
|
||||
actor->vel = vec4.XYZ();
|
||||
|
||||
if (actor->sector()->velFloor == 0 && abs(actor->int_vel().Z) < 0x20000) {
|
||||
sleeveStopBouncing(actor);
|
||||
|
|
|
@ -1786,7 +1786,7 @@ void debrisMove(int listIndex)
|
|||
{
|
||||
actor->xspr.physAttr |= kPhysFalling;
|
||||
auto vec4 = actFloorBounceVector(actor, FixedToFloat(v30), actor->sector(), FixedToFloat(tmpFraction));
|
||||
actor->set_float_bvel(vec4.XYZ());
|
||||
actor->vel = vec4.XYZ();
|
||||
v30 = actor->int_vel().Z;
|
||||
|
||||
if (abs(actor->int_vel().Z) < 0x10000)
|
||||
|
@ -1872,7 +1872,7 @@ void debrisMove(int listIndex)
|
|||
actor->add_int_bvel_x(-mulscale16r(actor->int_vel().X, nDrag));
|
||||
actor->add_int_bvel_y(-mulscale16r(actor->int_vel().Y, nDrag));
|
||||
if (approxDist(actor->int_vel().X, actor->int_vel().Y) < 0x1000)
|
||||
actor->clear_vel_xy();
|
||||
actor->ZeroVelocityXY();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -3138,7 +3138,7 @@ void useVelocityChanger(DBloodActor* actor, sectortype* sect, DBloodActor* initi
|
|||
if (toAng180) angl = DAngle180;
|
||||
else angl = DAngle::fromBuild(nAng - vAng);
|
||||
|
||||
auto velv = pSprite->fVel().XY();
|
||||
auto velv = pSprite->vel.XY();
|
||||
auto pt = rotatepoint(pSprite->spr.pos.XY(), velv, angl);
|
||||
//actor->vel.XY() = pt;
|
||||
pSprite->set_int_bvel_x(pt.X * worldtoint);
|
||||
|
@ -3292,7 +3292,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
|
|||
// change movement direction according source angle
|
||||
if (sourceactor->xspr.data3 & kModernTypeFlag2)
|
||||
{
|
||||
auto velv = actor->fVel().XY();
|
||||
auto velv = actor->vel.XY();
|
||||
auto pt = rotatepoint(actor->spr.pos.XY(), velv, sourceactor->spr.angle - VecToAngle(velv));
|
||||
//actor->vel.XY() = pt;
|
||||
actor->set_int_bvel_x(pt.X * worldtoint);
|
||||
|
@ -8200,7 +8200,7 @@ void aiPatrolMove(DBloodActor* actor)
|
|||
|
||||
if (abs(nAng) > goalAng || ((targetactor->xspr.waitTime > 0 || targetactor->xspr.data1 == targetactor->xspr.data2) && aiPatrolMarkerReached(actor)))
|
||||
{
|
||||
actor->clear_vel_xy();
|
||||
actor->ZeroVelocityXY();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue