mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- gameinput.h: For PlayerAngle struct methods settarget()
, properly set target as angle + delta between angle & target within method and not game-side.
This commit is contained in:
parent
e9e4590f6a
commit
80ff918b17
6 changed files with 25 additions and 16 deletions
|
@ -247,6 +247,7 @@ class binangle
|
|||
friend constexpr binangle bamang(uint32_t v);
|
||||
friend constexpr binangle q16ang(uint32_t v);
|
||||
friend constexpr binangle buildang(uint32_t v);
|
||||
friend binangle buildfang(double v);
|
||||
friend binangle radang(double v);
|
||||
friend binangle degang(double v);
|
||||
|
||||
|
@ -350,6 +351,7 @@ public:
|
|||
inline constexpr binangle bamang(uint32_t v) { return binangle(v); }
|
||||
inline constexpr binangle q16ang(uint32_t v) { return binangle(v << 5); }
|
||||
inline constexpr binangle buildang(uint32_t v) { return binangle(v << BAMBITS); }
|
||||
inline binangle buildfang(double v) { return binangle(xs_CRoundToUInt(v * BAMUNIT)); }
|
||||
inline binangle radang(double v) { return binangle(xs_CRoundToUInt(v * (0x80000000u / pi::pi()))); }
|
||||
inline binangle degang(double v) { return binangle(FloatToAngle(v)); }
|
||||
|
||||
|
|
|
@ -49,6 +49,20 @@ int getincangle(int a, int na)
|
|||
return na-a;
|
||||
}
|
||||
|
||||
double getincanglef(double a, double na)
|
||||
{
|
||||
a = fmod(a, 2048.);
|
||||
na = fmod(na, 2048.);
|
||||
|
||||
if(fabs(a-na) >= 1024)
|
||||
{
|
||||
if(na > 1024) na -= 2048;
|
||||
if(a > 1024) a -= 2048;
|
||||
}
|
||||
|
||||
return na-a;
|
||||
}
|
||||
|
||||
fixed_t getincangleq16(fixed_t a, fixed_t na)
|
||||
{
|
||||
a &= 0x7FFFFFF;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "packet.h"
|
||||
|
||||
int getincangle(int a, int na);
|
||||
double getincanglef(double a, double na);
|
||||
fixed_t getincangleq16(fixed_t a, fixed_t na);
|
||||
lookangle getincanglebam(binangle a, binangle na);
|
||||
|
||||
|
@ -171,7 +172,7 @@ struct PlayerAngle
|
|||
{
|
||||
if (!cl_syncinput && !backup)
|
||||
{
|
||||
target = value << BAMBITS;
|
||||
target = (ang + getincanglebam(ang, buildang(value))).asbam();
|
||||
if (target == 0) target += 1;
|
||||
}
|
||||
else
|
||||
|
@ -185,12 +186,12 @@ struct PlayerAngle
|
|||
{
|
||||
if (!cl_syncinput && !backup)
|
||||
{
|
||||
target = value * BAMUNIT;
|
||||
target = (ang + getincanglebam(ang, buildfang(value))).asbam();
|
||||
if (target == 0) target += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ang = bamang(xs_CRoundToUInt(value * BAMUNIT));
|
||||
ang = buildfang(value);
|
||||
if (backup) oang = ang;
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +200,7 @@ struct PlayerAngle
|
|||
{
|
||||
if (!cl_syncinput && !backup)
|
||||
{
|
||||
target = value.asbam();
|
||||
target = (ang + getincanglebam(ang, value)).asbam();
|
||||
if (target == 0) target += 1;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -730,8 +730,7 @@ void movecrane(DDukeActor *actor, int crane)
|
|||
actor->SetActiveCrane(true);
|
||||
ps[p].on_crane = actor;
|
||||
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].GetActor());
|
||||
auto ang = ps[p].angle.ang;
|
||||
ps[p].angle.settarget(ang + getincanglebam(ang, buildang(spri->ang + 1024)));
|
||||
ps[p].angle.settarget(spri->ang + 1024);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -885,7 +885,6 @@ struct PLAYERstruct
|
|||
short pnum; // carry along the player number
|
||||
|
||||
short LadderSector;
|
||||
binangle LadderAngle;
|
||||
int lx,ly; // ladder x and y
|
||||
short JumpDuration;
|
||||
short WadeDepth;
|
||||
|
|
|
@ -3651,8 +3651,7 @@ DoPlayerClimb(PLAYERp pp)
|
|||
nx = MOVEx(100, lsp->ang);
|
||||
ny = MOVEy(100, lsp->ang);
|
||||
|
||||
// set angle player is supposed to face.
|
||||
pp->LadderAngle = buildang(lsp->ang + 1024);
|
||||
// set ladder sector
|
||||
pp->LadderSector = wall[wal].nextsector;
|
||||
|
||||
// set players "view" distance from the ladder - needs to be farther than
|
||||
|
@ -3661,8 +3660,7 @@ DoPlayerClimb(PLAYERp pp)
|
|||
pp->lx = lsp->x + nx * 5;
|
||||
pp->ly = lsp->y + ny * 5;
|
||||
|
||||
auto& PlayerAngle = pp->angle.ang;
|
||||
pp->angle.settarget(PlayerAngle + getincanglebam(PlayerAngle, pp->LadderAngle));
|
||||
pp->angle.settarget(lsp->ang + 1024);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4058,9 +4056,6 @@ PlayerOnLadder(PLAYERp pp)
|
|||
nx = MOVEx(100, lsp->ang);
|
||||
ny = MOVEy(100, lsp->ang);
|
||||
|
||||
// set angle player is supposed to face.
|
||||
pp->LadderAngle = buildang(lsp->ang + 1024);
|
||||
|
||||
#if DEBUG
|
||||
if (wall[wal].nextsector < 0)
|
||||
{
|
||||
|
@ -4078,8 +4073,7 @@ PlayerOnLadder(PLAYERp pp)
|
|||
pp->lx = lsp->x + nx * 5;
|
||||
pp->ly = lsp->y + ny * 5;
|
||||
|
||||
auto& PlayerAngle = pp->angle.ang;
|
||||
pp->angle.settarget(PlayerAngle + getincanglebam(PlayerAngle, pp->LadderAngle));
|
||||
pp->angle.settarget(lsp->ang + 1024);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue