- Remaining manual changes to replace player's ang with DAngle object.

This commit is contained in:
Mitchell Richters 2022-08-27 23:09:51 +10:00 committed by Christoph Oelckers
parent b23e77d9c7
commit ad908719ec
15 changed files with 59 additions and 59 deletions

View file

@ -1498,7 +1498,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
{
// if(actor->spr.pal == 12)
{
int j = getincangle(ps[p].angle.ang.Buildang()getangle(actor->spr.pos.XY() - ps[p].pos.XY()));
int j = getincangle(ps[p].angle.ang.Buildang(), getangle(actor->spr.pos.XY() - ps[p].pos.XY()));
if (j > -64 && j < 64 && PlayerInput(p, SB_OPEN))
if (ps[p].toggle_key_flag == 1)
{

View file

@ -2223,8 +2223,8 @@ static void greenslime(DDukeActor *actor)
actor->spr.xrepeat = 20 + bsin(actor->temp_data[1], -13);
actor->spr.yrepeat = 15 + bsin(actor->temp_data[1], -13);
actor->spr.pos.X = ps[p].pos.X + ps[p].angle.ang.fcos() * 8;
actor->spr.pos.Y = ps[p].pos.Y + ps[p].angle.ang.fsin() * 8;
actor->spr.pos.X = ps[p].pos.X + ps[p].angle.ang.Cos() * 8;
actor->spr.pos.Y = ps[p].pos.Y + ps[p].angle.ang.Sin() * 8;
return;
}

View file

@ -2451,8 +2451,8 @@ int ParseState::parse(void)
case concmd_slapplayer:
insptr++;
forceplayerangle(g_p);
ps[g_p].vel.X -= ps[g_p].angle.ang.bcos(7);
ps[g_p].vel.Y -= ps[g_p].angle.ang.bsin(7);
ps[g_p].vel.X -= ps[g_p].angle.ang.Cos() * (1 << 21);
ps[g_p].vel.Y -= ps[g_p].angle.ang.Sin() * (1 << 21);
return 0;
case concmd_wackplayer:
insptr++;
@ -2460,8 +2460,8 @@ int ParseState::parse(void)
forceplayerangle(g_p);
else
{
ps[g_p].vel.X -= ps[g_p].angle.ang.bcos(10);
ps[g_p].vel.Y -= ps[g_p].angle.ang.bsin(10);
ps[g_p].vel.X -= ps[g_p].angle.ang.Cos() * (1 << 24);
ps[g_p].vel.Y -= ps[g_p].angle.ang.Sin() * (1 << 24);
ps[g_p].jumping_counter = 767;
ps[g_p].jumping_toggle = 1;
}

View file

@ -852,8 +852,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
if (packet)
{
*packet = loc;
packet->fvel = MulScale(loc.fvel, p->angle.ang.bcos(), 9) + MulScale(loc.svel, p->angle.ang.bsin(), 9) + p->fric.X;
packet->svel = MulScale(loc.fvel, p->angle.ang.bsin(), 9) - MulScale(loc.svel, p->angle.ang.bcos(), 9) + p->fric.Y;
packet->fvel = MulScale(loc.fvel, p->angle.ang.Cos() * (1 << 14), 9) + MulScale(loc.svel, p->angle.ang.Sin() * (1 << 14), 9) + p->fric.X;
packet->svel = MulScale(loc.fvel, p->angle.ang.Sin() * (1 << 14), 9) - MulScale(loc.svel, p->angle.ang.Cos() * (1 << 14), 9) + p->fric.Y;
loc = {};
}
}

View file

@ -215,7 +215,7 @@ int hitawall(player_struct* p, walltype** hitw)
{
HitInfo hit{};
hitscan(p->player_int_pos(), p->cursector, { p->angle.ang.bcos(), p->angle.ang.bsin(), 0 }, hit, CLIPMASK0);
hitscan(p->player_int_pos(), p->cursector, { int(p->angle.ang.Cos() * (1 << 14)), int(p->angle.ang.Sin() * (1 << 14)), 0 }, hit, CLIPMASK0);
if (hitw) *hitw = hit.hitWall;
return (FindDistance2D(hit.hitpos.vec2 - p->player_int_pos().vec2));

View file

@ -2010,7 +2010,7 @@ int operateTripbomb(int snum)
auto p = &ps[snum];
HitInfo hit{};
hitscan(p->player_int_pos(), p->cursector, { p->angle.ang.bcos(), p->angle.ang.bsin(), -p->horizon.sum().asq16() >> 11 }, hit, CLIPMASK1);
hitscan(p->player_int_pos(), p->cursector, { int(p->angle.ang.Cos() * (1 << 14)), int(p->angle.ang.Sin() * (1 << 14)), -p->horizon.sum().asq16() >> 11 }, hit, CLIPMASK1);
if (hit.hitSector == nullptr || hit.actor())
return 0;
@ -2200,8 +2200,8 @@ static void operateweapon(int snum, ESyncBits actions)
}
auto spawned = EGS(p->cursector,
p->player_int_pos().X + p->angle.ang.bcos(-6),
p->player_int_pos().Y + p->angle.ang.bsin(-6),
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 8),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 8),
p->player_int_pos().Z, HEAVYHBOMB, -16, 9, 9,
p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)), i, pact, 1);

View file

@ -1321,8 +1321,8 @@ int doincrements_r(player_struct* p)
{
p->noise_radius = 16384;
madenoise(screenpeek);
p->vel.X += p->angle.ang.bcos(4);
p->vel.Y += p->angle.ang.bsin(4);
p->vel.X += p->angle.ang.Cos() * (1 << 18);
p->vel.Y += p->angle.ang.Sin() * (1 << 18);
}
p->eat -= 4;
if (p->eat < 0)
@ -2745,8 +2745,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
}
auto spawned = EGS(p->cursector,
p->player_int_pos().X + p->angle.ang.bcos(-6),
p->player_int_pos().Y + p->angle.ang.bsin(-6),
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 8),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 8),
p->player_int_pos().Z, HEAVYHBOMB, -16, 9, 9,
p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pact, 1);
@ -2800,8 +2800,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
p->visibility = 0;
if (psectlotag != 857)
{
p->vel.X -= p->angle.ang.bcos(4);
p->vel.Y -= p->angle.ang.bsin(4);
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
}
}
else if (p->kickback_pic == 2)
@ -2900,14 +2900,14 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (psectlotag != 857)
{
p->vel.X -= p->angle.ang.bcos(5);
p->vel.Y -= p->angle.ang.bsin(5);
p->vel.X -= p->angle.ang.Cos() * (1 << 19);
p->vel.Y -= p->angle.ang.Sin() * (1 << 19);
}
}
else if (psectlotag != 857)
{
p->vel.X -= p->angle.ang.bcos(4);
p->vel.Y -= p->angle.ang.bsin(4);
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
}
}
@ -2993,8 +2993,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (psectlotag != 857)
{
p->vel.X -= p->angle.ang.bcos(4);
p->vel.Y -= p->angle.ang.bsin(4);
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
}
checkavailweapon(p);
@ -3134,8 +3134,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
}
else if (p->kickback_pic == 12)
{
p->vel.X -= p->angle.ang.bcos(4);
p->vel.Y -= p->angle.ang.bsin(4);
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
p->horizon.addadjustment(buildhoriz(20));
p->recoil += 20;
}
@ -3160,8 +3160,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
}
EGS(p->cursector,
p->player_int_pos().X + p->angle.ang.bcos(-6),
p->player_int_pos().Y + p->angle.ang.bsin(-6),
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 8),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 8),
p->player_int_pos().Z, POWDERKEG, -16, 9, 9,
p->angle.ang.Buildang(), k * 2, i, pact, 1);
}
@ -3184,8 +3184,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
}
if (p->kickback_pic < 30)
{
p->vel.X += p->angle.ang.bcos(4);
p->vel.Y += p->angle.ang.bsin(4);
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
}
p->kickback_pic++;
if (p->kickback_pic > 40)
@ -4099,15 +4099,15 @@ void OffMotorcycle(player_struct *p)
p->TurbCount = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->vel.X -= p->angle.ang.bcos(7);
p->vel.Y -= p->angle.ang.bsin(7);
p->vel.X -= p->angle.ang.Cos() * (1 << 7);
p->vel.Y -= p->angle.ang.Sin() * (1 << 7);
p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBIKE);
if (spawned)
{
spawned->set_int_ang(p->angle.ang.Buildang());
spawned->spr.xvel += p->angle.ang.bcos(7);
spawned->spr.yvel += p->angle.ang.bsin(7);
spawned->spr.xvel += p->angle.ang.Cos() * (1 << 7);
spawned->spr.yvel += p->angle.ang.Sin() * (1 << 7);
spawned->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON];
}
}
@ -4166,15 +4166,15 @@ void OffBoat(player_struct *p)
p->TurbCount = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->vel.X -= p->angle.ang.bcos(7);
p->vel.Y -= p->angle.ang.bsin(7);
p->vel.X -= p->angle.ang.Cos() * (1 << 7);
p->vel.Y -= p->angle.ang.Sin() * (1 << 7);
p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBOAT);
if (spawned)
{
spawned->set_int_ang(p->angle.ang.Buildang());
spawned->spr.xvel += p->angle.ang.bcos(7);
spawned->spr.yvel += p->angle.ang.bsin(7);
spawned->spr.xvel += p->angle.ang.Cos() * (1 << 7);
spawned->spr.yvel += p->angle.ang.Sin() * (1 << 7);
spawned->saved_ammo = p->ammo_amount[BOAT_WEAPON];
}
}

View file

@ -341,8 +341,8 @@ void operateweapon_ww(int snum, ESyncBits actions)
}
auto j = EGS(p->cursector,
p->player_int_pos().X + p->angle.ang.bcos(-6),
p->player_int_pos().Y + p->angle.ang.bsin(-6),
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 8),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 8),
p->player_int_pos().Z, HEAVYHBOMB, -16, 9, 9,
p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)), i, p->GetActor(), 1);

View file

@ -1306,8 +1306,8 @@ void moveclouds(double smoothratio)
cloudclock = myclock + 6;
// cloudx/y were an array, but all entries were always having the same value so a single pair is enough.
cloudx += (float)ps[screenpeek].angle.ang.fcos() * 0.5f;
cloudy += (float)ps[screenpeek].angle.ang.fsin() * 0.5f;
cloudx += (float)ps[screenpeek].angle.ang.Cos() * 0.5f;
cloudy += (float)ps[screenpeek].angle.ang.Sin() * 0.5f;
for (int i = 0; i < numclouds; i++)
{
// no clamping here!

View file

@ -917,13 +917,13 @@ void checkplayerhurt_d(player_struct* p, const Collision& coll)
p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0));
p->vel.X = -p->angle.ang.bcos(8);
p->vel.Y = -p->angle.ang.bsin(8);
p->vel.X = -p->angle.ang.Cos() * (1 << 22);
p->vel.Y = -p->angle.ang.Sin() * (1 << 22);
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
fi.checkhitwall(p->GetActor(), wal,
p->player_int_pos().X + p->angle.ang.bcos(-9),
p->player_int_pos().Y + p->angle.ang.bsin(-9),
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 5),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 5),
p->player_int_pos().Z, -1);
break;
@ -931,8 +931,8 @@ void checkplayerhurt_d(player_struct* p, const Collision& coll)
case BIGFORCE:
p->hurt_delay = 26;
fi.checkhitwall(p->GetActor(), wal,
p->player_int_pos().X + p->angle.ang.bcos(-9),
p->player_int_pos().Y + p->angle.ang.bsin(-9),
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 5),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 5),
p->player_int_pos().Z, -1);
break;
@ -1592,7 +1592,7 @@ void checksectors_d(int snum)
neartag({ p->player_int_opos().X, p->player_int_opos().Y, p->player_int_opos().Z }, p->GetActor()->sector(), p->angle.oang.Buildang(), near, 1280L, 1);
else
{
neartag(p->player_int_pos(), p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1);
neartag(p->player_int_pos(), p->GetActor()->sector(), p->angle.oang.Buildang(), near, 1280, 1);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
neartag({ p->player_int_pos().X, p->player_int_pos().Y, p->player_int_pos().Z + (8 << 8) }, p->GetActor()->sector(), p->angle.oang.Buildang(), near, 1280, 1);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)

View file

@ -1409,8 +1409,8 @@ void checkplayerhurt_r(player_struct* p, const Collision &coll)
case BIGFORCE:
p->hurt_delay = 26;
fi.checkhitwall(p->GetActor(), wal,
p->player_int_pos().X + p->angle.ang.bcos(-9),
p->player_int_pos().Y + p->angle.ang.bsin(-9),
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 5),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 5),
p->player_int_pos().Z, -1);
break;

View file

@ -792,7 +792,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int
tsp->add_int_x(-MulScale(pp->pos.X - pp->opos.X, sr, 16));
tsp->add_int_y(-MulScale(pp->pos.Y - pp->opos.Y, sr, 16));
tsp->add_int_z(-MulScale(pp->pos.Z - pp->opos.Z, sr, 16));
tsp->ang -= MulScale(pp->angle.ang.Buildang() - pp->angle.oang.Buildang(), sr, 16);
tsp->add_int_ang(-MulScale(pp->angle.ang.Buildang() - pp->angle.oang.Buildang(), sr, 16));
}
}

View file

@ -201,8 +201,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
if (packet)
{
*packet = loc;
packet->fvel = MulScale(loc.fvel, pp->angle.ang.bcos(), 9) + MulScale(loc.svel, pp->angle.ang.bsin(), 9);
packet->svel = MulScale(loc.fvel, pp->angle.ang.bsin(), 9) - MulScale(loc.svel, pp->angle.ang.bcos(), 9);
packet->fvel = MulScale(loc.fvel, pp->angle.ang.Cos() * (1 << 14), 9) + MulScale(loc.svel, pp->angle.ang.Sin() * (1 << 14), 9);
packet->svel = MulScale(loc.fvel, pp->angle.ang.Sin() * (1 << 14), 9) - MulScale(loc.svel, pp->angle.ang.Cos() * (1 << 14), 9);
loc = {};
}
}

View file

@ -2254,7 +2254,7 @@ void DoTankTreads(PLAYER* pp)
return;
vel = FindDistance2D(pp->vect.X>>8, pp->vect.Y>>8);
dot = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.bcos(), pp->angle.ang.bsin());
dot = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14));
if (dot < 0)
reverse = true;
@ -3147,7 +3147,7 @@ void DoPlayerClimb(PLAYER* pp)
pp->vect.X = pp->vect.Y = 0;
climbvel = FindDistance2D(pp->vect.X, pp->vect.Y)>>9;
dot = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.bcos(), pp->angle.ang.bsin());
dot = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14));
if (dot < 0)
climbvel = -climbvel;
@ -3670,7 +3670,7 @@ bool PlayerOnLadder(PLAYER* pp)
neartag(pp->pos, pp->cursector, pp->angle.ang.Buildang(), near, 1024 + 768, NTAG_SEARCH_LO_HI);
dir = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.bcos(), pp->angle.ang.bsin());
dir = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14));
if (dir < 0)
return false;

View file

@ -16508,7 +16508,7 @@ int InitMine(PLAYER* pp)
actorNew->user.change.X = MOVEx(actorNew->spr.xvel, actorNew->int_ang());
actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang());
dot = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.bcos(), pp->angle.ang.bsin());
dot = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14));
// don't adjust for strafing
if (labs(dot) > 10000)