mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 16:10:52 +00:00
- use player_add_int_xy and player_set_int_xy.
This commit is contained in:
parent
44dc2a692f
commit
86076b2871
8 changed files with 29 additions and 32 deletions
|
@ -789,8 +789,7 @@ void movecrane(DDukeActor *actor, int crane)
|
|||
{
|
||||
auto ang = ps[p].angle.ang.asbuild();
|
||||
ps[p].backupxyz();
|
||||
ps[p].__int_pos.X = actor->int_pos().X - bcos(ang, -6);
|
||||
ps[p].__int_pos.Y = actor->int_pos().Y - bsin(ang, -6);
|
||||
ps[p].player_set_int_xy({ actor->int_pos().X - bcos(ang, -6), actor->int_pos().Y - bsin(ang, -6) });
|
||||
ps[p].player_set_int_z(actor->int_pos().Z + (2 << 8));
|
||||
SetActor(ps[p].GetActor(), ps[p].player_int_pos());
|
||||
ps[p].setCursector(ps[p].GetActor()->sector());
|
||||
|
@ -2688,7 +2687,7 @@ void handle_se00(DDukeActor* actor)
|
|||
ps[p].bobpos.X += res.X - ps[p].player_int_pos().X;
|
||||
ps[p].bobpos.Y += res.Y - ps[p].player_int_pos().Y;
|
||||
|
||||
ps[p].__int_pos.vec2 = res;
|
||||
ps[p].player_set_int_xy(res);
|
||||
|
||||
auto psp = ps[p].GetActor();
|
||||
if (psp->spr.extra <= 0)
|
||||
|
@ -2857,10 +2856,10 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
|||
|
||||
if (actor->sector() == psp->sector())
|
||||
{
|
||||
rotatepoint(actor->int_pos().vec2, ps[p].player_int_pos().vec2, q, &ps[p].__int_pos.vec2);
|
||||
vec2_t result;
|
||||
rotatepoint(actor->int_pos().vec2, ps[p].player_int_pos().vec2, q, &result);
|
||||
|
||||
ps[p].__int_pos.X += m;
|
||||
ps[p].__int_pos.Y +=x;
|
||||
ps[p].player_set_int_xy({ result.X + m, result.Y + x });
|
||||
|
||||
ps[p].bobpos.X += m;
|
||||
ps[p].bobpos.Y += x;
|
||||
|
@ -3030,8 +3029,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
|
|||
auto psp = ps[p].GetActor();
|
||||
if (psp->sector() == actor->sector())
|
||||
{
|
||||
ps[p].__int_pos.X += l;
|
||||
ps[p].__int_pos.Y +=x;
|
||||
ps[p].player_add_int_xy({ l, x });
|
||||
|
||||
if (numplayers > 1)
|
||||
{
|
||||
|
@ -3162,8 +3160,7 @@ void handle_se02(DDukeActor* actor)
|
|||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
if (ps[p].cursector == actor->sector() && ps[p].on_ground)
|
||||
{
|
||||
ps[p].__int_pos.X += m;
|
||||
ps[p].__int_pos.Y +=x;
|
||||
ps[p].player_add_int_xy({ m, x });
|
||||
|
||||
ps[p].bobpos.X += m;
|
||||
ps[p].bobpos.Y += x;
|
||||
|
@ -3878,8 +3875,7 @@ void handle_se17(DDukeActor* actor)
|
|||
{
|
||||
int p = act3->spr.yvel;
|
||||
|
||||
ps[p].__int_pos.X += act2->int_pos().X - actor->int_pos().X;
|
||||
ps[p].__int_pos.Y +=act2->int_pos().Y - actor->int_pos().Y;
|
||||
ps[p].player_add_int_xy({ act2->int_pos().X - actor->int_pos().X, act2->int_pos().Y - actor->int_pos().Y });
|
||||
ps[p].player_set_int_z(act2->sector()->int_floorz() - (sc->int_floorz() - ps[p].player_int_pos().Z));
|
||||
|
||||
act3->floorz = act2->sector()->floorz;
|
||||
|
@ -4171,9 +4167,7 @@ void handle_se20(DDukeActor* actor)
|
|||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
if (ps[p].cursector == actor->sector() && ps[p].on_ground)
|
||||
{
|
||||
ps[p].__int_pos.X += x;
|
||||
ps[p].__int_pos.Y +=l;
|
||||
|
||||
ps[p].player_add_int_xy({ x, l });
|
||||
ps[p].backupxy();
|
||||
|
||||
SetActor(ps[p].GetActor(), vec3_t( ps[p].player_int_pos().X, ps[p].player_int_pos().Y, ps[p].player_int_pos().Z + gs.int_playerheight ));
|
||||
|
|
|
@ -1828,8 +1828,7 @@ void movetransports_d(void)
|
|||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) ||
|
||||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
|
||||
{
|
||||
ps[p].__int_pos.X += Owner->int_pos().X - act->int_pos().X;
|
||||
ps[p].__int_pos.Y += Owner->int_pos().Y - act->int_pos().Y;
|
||||
ps[p].player_add_int_xy(Owner->int_pos().vec2 - act->int_pos().vec2);
|
||||
ps[p].backupxy();
|
||||
|
||||
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
|
||||
|
@ -1885,8 +1884,7 @@ void movetransports_d(void)
|
|||
|
||||
if (k == 1)
|
||||
{
|
||||
ps[p].__int_pos.X += Owner->int_pos().X - act->int_pos().X;
|
||||
ps[p].__int_pos.Y +=Owner->int_pos().Y - act->int_pos().Y;
|
||||
ps[p].player_add_int_xy(Owner->int_pos().vec2 - act->int_pos().vec2);
|
||||
ps[p].backupxy();
|
||||
|
||||
if (!Owner || Owner->GetOwner() != Owner)
|
||||
|
|
|
@ -1475,8 +1475,7 @@ void movetransports_r(void)
|
|||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) ||
|
||||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
|
||||
{
|
||||
ps[p].__int_pos.X += Owner->int_pos().X - act->int_pos().X;
|
||||
ps[p].__int_pos.Y +=Owner->int_pos().Y - act->int_pos().Y;
|
||||
ps[p].player_add_int_xy(Owner->int_pos().vec2 - act->int_pos().vec2);
|
||||
ps[p].backupxy();
|
||||
|
||||
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
|
||||
|
@ -1542,8 +1541,7 @@ void movetransports_r(void)
|
|||
|
||||
if (k == 1)
|
||||
{
|
||||
ps[p].__int_pos.X += Owner->int_pos().X - act->int_pos().X;
|
||||
ps[p].__int_pos.Y +=Owner->int_pos().Y - act->int_pos().Y;
|
||||
ps[p].player_add_int_xy(Owner->int_pos().vec2 - act->int_pos().vec2);
|
||||
ps[p].backupxy();
|
||||
|
||||
if (Owner->GetOwner() != Owner)
|
||||
|
@ -1557,8 +1555,7 @@ void movetransports_r(void)
|
|||
}
|
||||
else if (isRRRA() && k == 2)
|
||||
{
|
||||
ps[p].__int_pos.X += Owner->int_pos().X - act->int_pos().X;
|
||||
ps[p].__int_pos.Y +=Owner->int_pos().Y - act->int_pos().Y;
|
||||
ps[p].player_add_int_xy(Owner->int_pos().vec2 - act->int_pos().vec2);
|
||||
ps[p].backupxy();
|
||||
|
||||
if (Owner->GetOwner() != Owner)
|
||||
|
|
|
@ -115,7 +115,8 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
|
|||
{
|
||||
player_struct* p = &ps[myconnectindex];
|
||||
|
||||
p->__int_pos = { x, y, z };
|
||||
p->player_set_int_xy({ x, y});
|
||||
p->player_set_int_z(z);
|
||||
p->backupxyz();
|
||||
|
||||
if (ang != INT_MIN)
|
||||
|
|
|
@ -208,7 +208,7 @@ inline bool playrunning()
|
|||
inline void doslopetilting(player_struct* p, double const scaleAdjust = 1)
|
||||
{
|
||||
bool const canslopetilt = p->on_ground && p->insector() && p->cursector->lotag != ST_2_UNDERWATER && (p->cursector->floorstat & CSTAT_SECTOR_SLOPE);
|
||||
p->horizon.calcviewpitch(p->__int_pos.vec2, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust);
|
||||
p->horizon.calcviewpitch(p->player_int_pos().vec2, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -3026,8 +3026,7 @@ HORIZONLY:
|
|||
Collision clip{};
|
||||
if (ud.clipping)
|
||||
{
|
||||
p->__int_pos.X += p->vel.X >> 14;
|
||||
p->__int_pos.Y +=p->vel.Y >> 14;
|
||||
p->player_add_int_xy({ p->vel.X >> 14, p->vel.Y >> 14 });
|
||||
updatesector(p->player_int_pos().X, p->player_int_pos().Y, &p->cursector);
|
||||
ChangeActorSect(pact, p->cursector);
|
||||
}
|
||||
|
|
|
@ -3795,8 +3795,7 @@ HORIZONLY:
|
|||
Collision clip{};
|
||||
if (ud.clipping)
|
||||
{
|
||||
p->__int_pos.X += p->vel.X >> 14;
|
||||
p->__int_pos.Y +=p->vel.Y >> 14;
|
||||
p->player_add_int_xy({ p->vel.X >> 14, p->vel.Y >> 14 });
|
||||
updatesector(p->player_int_pos().X, p->player_int_pos().Y, &p->cursector);
|
||||
ChangeActorSect(pact, p->cursector);
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ struct player_struct
|
|||
|
||||
vec3_t player_int_opos() const
|
||||
{
|
||||
return { int(opos.X * worldtoint), int(opos.Y * worldtoint),int(opos.Z * zworldtoint) };
|
||||
return { int(opos.X * worldtoint), int(opos.Y * worldtoint), int(opos.Z * zworldtoint) };
|
||||
}
|
||||
|
||||
void player_add_int_z(int z)
|
||||
|
@ -427,6 +427,15 @@ struct player_struct
|
|||
{
|
||||
__int_pos.Z = z;
|
||||
}
|
||||
void player_add_int_xy(const vec2_t& v)
|
||||
{
|
||||
__int_pos.vec2 += v;
|
||||
}
|
||||
void player_set_int_xy(const vec2_t& v)
|
||||
{
|
||||
__int_pos.vec2 = v;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue