mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-22 11:31:11 +00:00
- floatified the vect variables.
No change to the logic yet, only the copies have been transitioned.
This commit is contained in:
parent
66474142a4
commit
4f47472ef4
3 changed files with 47 additions and 46 deletions
|
@ -581,13 +581,9 @@ struct REMOTE_CONTROL
|
||||||
{
|
{
|
||||||
sectortype* cursectp, * lastcursectp;
|
sectortype* cursectp, * lastcursectp;
|
||||||
int pang;
|
int pang;
|
||||||
vec2_t _vect, _ovect, _slide_vect;
|
DVector2 vect, ovect, slide_vect;
|
||||||
DVector3 pos;
|
DVector3 pos;
|
||||||
SECTOR_OBJECT* sop_control;
|
SECTOR_OBJECT* sop_control;
|
||||||
|
|
||||||
vec2_t int_vect() const { return _vect; }
|
|
||||||
vec2_t int_ovect() const { return _ovect; }
|
|
||||||
vec2_t int_slide_vect() const { return _slide_vect; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PLAYER
|
struct PLAYER
|
||||||
|
@ -633,17 +629,17 @@ struct PLAYER
|
||||||
DVector3 si; // save player interp position for PlayerSprite
|
DVector3 si; // save player interp position for PlayerSprite
|
||||||
DAngle siang;
|
DAngle siang;
|
||||||
|
|
||||||
vec2_t _vect, _ovect, _slide_vect; // these need floatification, but must be done together. vect is in 14.18 format!
|
DVector2 vect, ovect, slide_vect; // these need floatification, but must be done together. vect is in 14.18 format!
|
||||||
vec2_t int_vect() const { return _vect; }
|
vec2_t int_vect() const { return vec2_t(FloatToFixed<18>(vect.X), FloatToFixed<18>(vect.Y)); }
|
||||||
vec2_t int_ovect() const { return _ovect; }
|
vec2_t int_ovect() const { return vec2_t(FloatToFixed<18>(ovect.X), FloatToFixed<18>(ovect.Y)); }
|
||||||
vec2_t int_slide_vect() const { return _slide_vect; }
|
vec2_t int_slide_vect() const { return vec2_t(FloatToFixed<18>(slide_vect.X), FloatToFixed<18>(slide_vect.Y)); }
|
||||||
|
|
||||||
void set_int_vect_x(int v) { _vect.X = v; }
|
void set_int_vect_x(int v) { vect.X = FixedToFloat<18>(v); }
|
||||||
void set_int_vect_y(int v) { _vect.Y = v; }
|
void set_int_vect_y(int v) { vect.Y = FixedToFloat<18>(v); }
|
||||||
void add_int_vect_x(int v) { _vect.X += v; }
|
void add_int_vect_x(int v) { vect.X += FixedToFloat<18>(v); }
|
||||||
void add_int_vect_y(int v) { _vect.Y += v; }
|
void add_int_vect_y(int v) { vect.Y += FixedToFloat<18>(v); }
|
||||||
void set_int_slide_vect_x(int v) { _slide_vect.X = v; }
|
void set_int_slide_vect_x(int v) { slide_vect.X = FixedToFloat<18>(v); }
|
||||||
void set_int_slide_vect_y(int v) { _slide_vect.Y = v; }
|
void set_int_slide_vect_y(int v) { slide_vect.Y = FixedToFloat<18>(v); }
|
||||||
|
|
||||||
int friction;
|
int friction;
|
||||||
int16_t slide_ang; // todo: floatify
|
int16_t slide_ang; // todo: floatify
|
||||||
|
|
|
@ -1243,8 +1243,9 @@ DSWActor* DoPickTarget(DSWActor* actor, DAngle max_delta_ang, int skip_targets)
|
||||||
|
|
||||||
void DoPlayerResetMovement(PLAYER* pp)
|
void DoPlayerResetMovement(PLAYER* pp)
|
||||||
{
|
{
|
||||||
pp->_vect = pp->_ovect = { 0, 0 };
|
pp->vect.Zero();
|
||||||
pp->_slide_vect = { 0, 0 };
|
pp->ovect.Zero();
|
||||||
|
pp->slide_vect.Zero();
|
||||||
pp->drive_avel = 0;
|
pp->drive_avel = 0;
|
||||||
pp->Flags &= ~(PF_PLAYER_MOVED);
|
pp->Flags &= ~(PF_PLAYER_MOVED);
|
||||||
}
|
}
|
||||||
|
@ -1855,7 +1856,7 @@ void DoPlayerSlide(PLAYER* pp)
|
||||||
pp->set_int_slide_vect_y(MulScale(pp->int_slide_vect().Y, PLAYER_SLIDE_FRICTION, 16));
|
pp->set_int_slide_vect_y(MulScale(pp->int_slide_vect().Y, PLAYER_SLIDE_FRICTION, 16));
|
||||||
|
|
||||||
if (abs(pp->int_slide_vect().X) < 12800 && abs(pp->int_slide_vect().Y) < 12800)
|
if (abs(pp->int_slide_vect().X) < 12800 && abs(pp->int_slide_vect().Y) < 12800)
|
||||||
pp->_slide_vect = { 0, 0 };
|
pp->slide_vect.Zero();
|
||||||
|
|
||||||
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
|
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
|
||||||
if (push_ret < 0)
|
if (push_ret < 0)
|
||||||
|
@ -1959,7 +1960,7 @@ void DoPlayerMove(PLAYER* pp)
|
||||||
|
|
||||||
DoPlayerSlide(pp);
|
DoPlayerSlide(pp);
|
||||||
|
|
||||||
pp->_ovect = pp->_vect;
|
pp->ovect = pp->vect;
|
||||||
|
|
||||||
pp->add_int_vect_x(((pp->input.fvel*synctics*2)<<6));
|
pp->add_int_vect_x(((pp->input.fvel*synctics*2)<<6));
|
||||||
pp->add_int_vect_y(((pp->input.svel*synctics*2)<<6));
|
pp->add_int_vect_y(((pp->input.svel*synctics*2)<<6));
|
||||||
|
@ -1987,7 +1988,7 @@ void DoPlayerMove(PLAYER* pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(pp->int_vect().X) < 12800 && abs(pp->int_vect().Y) < 12800)
|
if (abs(pp->int_vect().X) < 12800 && abs(pp->int_vect().Y) < 12800)
|
||||||
pp->_vect = { 0,0 };
|
pp->vect.Zero();
|
||||||
|
|
||||||
actor->set_int_xvel(FindDistance2D(pp->int_vect().X,pp->int_vect().Y)>>14);
|
actor->set_int_xvel(FindDistance2D(pp->int_vect().X,pp->int_vect().Y)>>14);
|
||||||
|
|
||||||
|
@ -2477,7 +2478,7 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
||||||
else
|
else
|
||||||
pp->Flags |= (PF_PLAYER_MOVED);
|
pp->Flags |= (PF_PLAYER_MOVED);
|
||||||
|
|
||||||
pp->_ovect = pp->_vect;
|
pp->ovect = pp->vect;
|
||||||
|
|
||||||
if (sop->drive_speed)
|
if (sop->drive_speed)
|
||||||
{
|
{
|
||||||
|
@ -2501,7 +2502,7 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(pp->int_vect().X) < 12800 && abs(pp->int_vect().Y) < 12800)
|
if (abs(pp->int_vect().X) < 12800 && abs(pp->int_vect().Y) < 12800)
|
||||||
pp->_vect = { 0, 0 };
|
pp->vect.Zero();
|
||||||
|
|
||||||
pp->lastcursector = pp->cursector;
|
pp->lastcursector = pp->cursector;
|
||||||
z = pp->int_ppos().Z + Z(10);
|
z = pp->int_ppos().Z + Z(10);
|
||||||
|
@ -2581,7 +2582,8 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
||||||
|
|
||||||
if (vel > 12000)
|
if (vel > 12000)
|
||||||
{
|
{
|
||||||
pp->_vect = pp->_ovect = { 0, 0 };
|
pp->vect.Zero();
|
||||||
|
pp->ovect.Zero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2626,7 +2628,8 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
||||||
|
|
||||||
if (vel > 12000)
|
if (vel > 12000)
|
||||||
{
|
{
|
||||||
pp->_vect = pp->_ovect = { 0, 0 };
|
pp->vect.Zero();
|
||||||
|
pp->ovect.Zero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3090,7 +3093,7 @@ void DoPlayerClimb(PLAYER* pp)
|
||||||
pp->set_int_vect_x(MulScale(pp->int_vect().X, PLAYER_CLIMB_FRICTION, 16));
|
pp->set_int_vect_x(MulScale(pp->int_vect().X, PLAYER_CLIMB_FRICTION, 16));
|
||||||
pp->set_int_vect_y(MulScale(pp->int_vect().Y, PLAYER_CLIMB_FRICTION, 16));
|
pp->set_int_vect_y(MulScale(pp->int_vect().Y, PLAYER_CLIMB_FRICTION, 16));
|
||||||
if (abs(pp->int_vect().X) < 12800 && abs(pp->int_vect().Y) < 12800)
|
if (abs(pp->int_vect().X) < 12800 && abs(pp->int_vect().Y) < 12800)
|
||||||
pp->_vect = { 0, 0 };
|
pp->vect.Zero();
|
||||||
|
|
||||||
climbVel = DVector2(pp->int_vect().X, pp->int_vect().Y).Length() * (1. / 512) * zinttoworld;
|
climbVel = DVector2(pp->int_vect().X, pp->int_vect().Y).Length() * (1. / 512) * zinttoworld;
|
||||||
dot = DOT_PRODUCT_2D(pp->int_vect().X, pp->int_vect().Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14));
|
dot = DOT_PRODUCT_2D(pp->int_vect().X, pp->int_vect().Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14));
|
||||||
|
@ -4955,9 +4958,9 @@ void PlayerToRemote(PLAYER* pp)
|
||||||
|
|
||||||
pp->remote.pos = pp->pos;
|
pp->remote.pos = pp->pos;
|
||||||
|
|
||||||
pp->remote._vect = pp->_vect;
|
pp->remote.vect = pp->vect;
|
||||||
pp->remote._ovect = pp->_ovect;
|
pp->remote.ovect = pp->ovect;
|
||||||
pp->remote._slide_vect = pp->_slide_vect;
|
pp->remote.slide_vect = pp->slide_vect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteToPlayer(PLAYER* pp)
|
void RemoteToPlayer(PLAYER* pp)
|
||||||
|
@ -4967,9 +4970,9 @@ void RemoteToPlayer(PLAYER* pp)
|
||||||
|
|
||||||
pp->pos = pp->remote.pos;
|
pp->pos = pp->remote.pos;
|
||||||
|
|
||||||
pp->_vect = pp->remote._vect;
|
pp->vect = pp->remote.vect;
|
||||||
pp->_ovect = pp->remote._ovect;
|
pp->ovect = pp->remote.ovect;
|
||||||
pp->_slide_vect = pp->remote._slide_vect;
|
pp->slide_vect = pp->remote.slide_vect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerRemoteReset(PLAYER* pp, sectortype* sect)
|
void PlayerRemoteReset(PLAYER* pp, sectortype* sect)
|
||||||
|
@ -4981,16 +4984,18 @@ void PlayerRemoteReset(PLAYER* pp, sectortype* sect)
|
||||||
pp->pos.XY() = rsp->spr.pos.XY();
|
pp->pos.XY() = rsp->spr.pos.XY();
|
||||||
pp->pos.Z = sect->floorz - PLAYER_HEIGHTF;
|
pp->pos.Z = sect->floorz - PLAYER_HEIGHTF;
|
||||||
|
|
||||||
pp->_vect = pp->_ovect = pp->_slide_vect = { 0,0 };
|
pp->vect.Zero();
|
||||||
|
pp->ovect.Zero();
|
||||||
|
pp->slide_vect.Zero();
|
||||||
|
|
||||||
UpdatePlayerSprite(pp);
|
UpdatePlayerSprite(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerRemoteInit(PLAYER* pp)
|
void PlayerRemoteInit(PLAYER* pp)
|
||||||
{
|
{
|
||||||
pp->remote._vect = { 0,0 };
|
pp->remote.vect.Zero();
|
||||||
pp->remote._ovect = { 0,0 };
|
pp->remote.ovect.Zero();
|
||||||
pp->remote._slide_vect = { 0,0 };
|
pp->remote.slide_vect.Zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoPlayerStopOperate(PLAYER* pp)
|
void DoPlayerStopOperate(PLAYER* pp)
|
||||||
|
@ -5397,7 +5402,7 @@ void DoPlayerBeginDie(PLAYER* pp)
|
||||||
pp->input.actions &= ~SB_CENTERVIEW;
|
pp->input.actions &= ~SB_CENTERVIEW;
|
||||||
|
|
||||||
pp->friction = PLAYER_RUN_FRICTION;
|
pp->friction = PLAYER_RUN_FRICTION;
|
||||||
pp->_slide_vect = { 0,0 };
|
pp->slide_vect.Zero();
|
||||||
pp->p_floor_dist = PLAYER_WADE_FLOOR_DIST;
|
pp->p_floor_dist = PLAYER_WADE_FLOOR_DIST;
|
||||||
pp->p_ceiling_dist = PLAYER_WADE_CEILING_DIST;
|
pp->p_ceiling_dist = PLAYER_WADE_CEILING_DIST;
|
||||||
ASSERT(pp->DeathType < SIZ(PlayerDeathFunc));
|
ASSERT(pp->DeathType < SIZ(PlayerDeathFunc));
|
||||||
|
|
|
@ -394,10 +394,10 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, REMOTE_CONTROL& w,
|
||||||
arc("cursectnum", w.cursectp)
|
arc("cursectnum", w.cursectp)
|
||||||
("lastcursectnum", w.lastcursectp)
|
("lastcursectnum", w.lastcursectp)
|
||||||
("pang", w.pang)
|
("pang", w.pang)
|
||||||
("xvect", w._vect.X)
|
("xvect", w.vect.X)
|
||||||
("yvect", w._vect.Y)
|
("yvect", w.vect.Y)
|
||||||
("slide_xvect", w._slide_vect.X)
|
("slide_xvect", w.slide_vect.X)
|
||||||
("slide_yvect", w._slide_vect.Y)
|
("slide_yvect", w.slide_vect.Y)
|
||||||
("x", w.pos.X)
|
("x", w.pos.X)
|
||||||
("y", w.pos.Y)
|
("y", w.pos.Y)
|
||||||
("z", w.pos.Z)
|
("z", w.pos.Z)
|
||||||
|
@ -406,7 +406,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, REMOTE_CONTROL& w,
|
||||||
}
|
}
|
||||||
if (arc.isReading())
|
if (arc.isReading())
|
||||||
{
|
{
|
||||||
w._ovect = w.int_vect();
|
w.ovect = w.vect;
|
||||||
}
|
}
|
||||||
return arc;
|
return arc;
|
||||||
}
|
}
|
||||||
|
@ -464,11 +464,11 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER*
|
||||||
("siy", w.si.Y)
|
("siy", w.si.Y)
|
||||||
("siz", w.si.Z)
|
("siz", w.si.Z)
|
||||||
("siang", w.siang)
|
("siang", w.siang)
|
||||||
("xvect", w._vect.X)
|
("xvect", w.vect.X)
|
||||||
("yvect", w._vect.Y)
|
("yvect", w.vect.Y)
|
||||||
("friction", w.friction)
|
("friction", w.friction)
|
||||||
("slide_xvect", w._slide_vect.X)
|
("slide_xvect", w.slide_vect.X)
|
||||||
("slide_yvect", w._slide_vect.Y)
|
("slide_yvect", w.slide_vect.Y)
|
||||||
("slide_ang", w.slide_ang)
|
("slide_ang", w.slide_ang)
|
||||||
("slide_dec", w.slide_dec)
|
("slide_dec", w.slide_dec)
|
||||||
("drive_avel", w.drive_avel)
|
("drive_avel", w.drive_avel)
|
||||||
|
@ -575,7 +575,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER*
|
||||||
if (arc.isReading())
|
if (arc.isReading())
|
||||||
{
|
{
|
||||||
w.opos = w.pos;
|
w.opos = w.pos;
|
||||||
w._ovect = w.int_vect();
|
w.ovect = w.vect;
|
||||||
w.obob_z = w.bob_z;
|
w.obob_z = w.bob_z;
|
||||||
w.input = {};
|
w.input = {};
|
||||||
w.lastinput = {};
|
w.lastinput = {};
|
||||||
|
|
Loading…
Reference in a new issue