From 1e7cce28af7adab408c640c05117d2baa36fd31a Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 30 Sep 2022 21:39:39 +1000 Subject: [PATCH] - VecToAngle() with `delta()` inside to .Angle() replacements. --- source/build/src/clip.cpp | 2 +- source/games/duke/src/actors.cpp | 4 ++-- source/games/duke/src/actors_d.cpp | 6 +++--- source/games/duke/src/actors_r.cpp | 10 +++++----- source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_d.cpp | 2 +- source/games/duke/src/player_r.cpp | 6 +++--- source/games/duke/src/sectors_d.cpp | 2 +- source/games/exhumed/src/move.cpp | 2 +- source/games/sw/src/break.cpp | 2 +- source/games/sw/src/jweapon.cpp | 2 +- source/games/sw/src/player.cpp | 4 ++-- source/games/sw/src/ripper.cpp | 2 +- source/games/sw/src/ripper2.cpp | 2 +- source/games/sw/src/weapon.cpp | 8 ++++---- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 49ba3ea2b..96617d57e 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -829,7 +829,7 @@ int pushmove_(vec3_t *const vect, int *const sectnum, if (j != 0) { - DAngle jj = VecToAngle(wal->delta()); + DAngle jj = wal->delta().Angle(); int32_t dx = -int(jj.Sin() * 8); int32_t dy = int(jj.Cos() * 8); int bad2 = 16; diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 9ce6444a4..68f12d3ac 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1263,7 +1263,7 @@ void bounce(DDukeActor* actor) auto sectp = actor->sector(); - DAngle daang = VecToAngle(sectp->firstWall()->delta()); + DAngle daang = sectp->firstWall()->delta().Angle(); double k; if (actor->spr.pos.Z < (actor->floorz + actor->ceilingz) * 0.5) @@ -1467,7 +1467,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball) if (j == kHitWall) { - auto ang = VecToAngle(coll.hitWall->delta()); + auto ang = coll.hitWall->delta().Angle(); actor->spr.angle = ang * 2 - actor->spr.angle; } else if (j == kHitSprite) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index f1f1e0b75..3262d7a0b 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1416,7 +1416,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3 &oldpo (!isWorldTour() || proj->spr.picnum != FIREBALL) && (wal->overpicnum == MIRROR || wal->picnum == MIRROR)) { - DAngle k = VecToAngle(wal->delta()); + DAngle k = wal->delta().Angle(); proj->spr.angle = k * 2 - proj->spr.angle; proj->SetOwner(proj); spawn(proj, TRANSPORTERSTAR); @@ -1435,7 +1435,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3 &oldpo proj->spr.yint--; } - DAngle k = VecToAngle(wal->delta()); + DAngle k = wal->delta().Angle(); proj->spr.angle = k * 2 - proj->spr.angle; return true; } @@ -2639,7 +2639,7 @@ static void heavyhbomb(DDukeActor *actor) auto wal = coll.hitWall; fi.checkhitwall(actor, wal, actor->spr.pos, actor->spr.picnum); - DAngle k = VecToAngle(wal->delta()); + DAngle k = wal->delta().Angle(); actor->spr.angle = k * 2 - actor->spr.angle; actor->vel.X *= 0.5; } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 465a12a69..d4dc66134 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1045,7 +1045,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3& oldpo if (proj->spr.picnum != RPG && (!isRRRA() || proj->spr.picnum != RPG2) && proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != SPIT && proj->spr.picnum != SHRINKSPARK && (wal->overpicnum == MIRROR || wal->picnum == MIRROR)) { - DAngle walang = VecToAngle(wal->delta()); + DAngle walang = wal->delta().Angle(); proj->spr.angle = walang * 2 - proj->spr.angle; proj->SetOwner(proj); spawn(proj, TRANSPORTERSTAR); @@ -1068,7 +1068,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3& oldpo proj->spr.yint--; } - DAngle walang = VecToAngle(wal->delta()); + DAngle walang = wal->delta().Angle(); proj->spr.angle = walang * 2 - proj->spr.angle; return true; } @@ -1103,7 +1103,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3& oldpo proj->spr.yint--; } - DAngle k = VecToAngle(wal->delta()); + DAngle k = wal->delta().Angle(); proj->spr.angle = k * 2 - proj->spr.angle; return true; } @@ -2418,7 +2418,7 @@ static void heavyhbomb(DDukeActor *actor) actor->vel.X = 0; goto DETONATEB; } - DAngle k = VecToAngle(wal->delta()); + DAngle k = wal->delta().Angle(); actor->spr.angle = k * 2 - actor->spr.angle; actor->vel.X *= 0.5; } @@ -2546,7 +2546,7 @@ static int henstand(DDukeActor *actor) { if (coll.type == kHitWall) { - DAngle k = VecToAngle(coll.hitWall->delta()); + DAngle k = coll.hitWall->delta().Angle(); actor->spr.angle = k * 2 - actor->spr.angle; } else if (coll.type == kHitSprite) diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index bd175e853..cf3c3fecb 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -1050,7 +1050,7 @@ void shootbloodsplat(DDukeActor* actor, int p, const DVector3& pos, DAngle ang, if (spawned) { spawned->vel.X = -0.75; - spawned->spr.angle = VecToAngle(-hit.hitWall->delta()) + DAngle90; // note the '-' sign here! + spawned->spr.angle = -hit.hitWall->delta().Angle() + DAngle90; // note the '-' sign here! spawned->spr.pos = hit.hitpos; spawned->spr.cstat |= randomXFlip(); ssp(spawned, CLIPMASK0); diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index eca26782b..a9ab65de2 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -521,7 +521,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int if (hole) { hole->vel.X = -1 / 16.; - hole->spr.angle = VecToAngle(-hit.hitWall->delta()) + DAngle90; + hole->spr.angle = -hit.hitWall->delta().Angle() + DAngle90; ssp(hole, CLIPMASK0); hole->spr.cstat2 |= CSTAT2_SPRITE_DECAL; } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 385eb41cb..929949c33 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -410,7 +410,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int if (hole) { hole->vel.X = -1 / 16; - hole->spr.angle = VecToAngle(-hit.hitWall->delta()) + DAngle90; + hole->spr.angle = -hit.hitWall->delta().Angle() + DAngle90; ssp(hole, CLIPMASK0); hole->spr.cstat2 |= CSTAT2_SPRITE_DECAL; } @@ -2374,7 +2374,7 @@ void onMotorcycleMove(int snum, walltype* wal) { auto p = &ps[snum]; auto pact = p->GetActor(); - double angleDelta = absangle(p->angle.ang, VecToAngle(wal->delta())).Degrees(); + double angleDelta = absangle(p->angle.ang, wal->delta().Angle()).Degrees(); double damageAmount = p->MotoSpeed * p->MotoSpeed; const double scale = (180. / 2048.); @@ -2430,7 +2430,7 @@ void onBoatMove(int snum, int psectlotag, walltype* wal) { auto p = &ps[snum]; auto pact = p->GetActor(); - double angleDelta = absangle(p->angle.ang, VecToAngle(wal->delta())).Degrees(); + double angleDelta = absangle(p->angle.ang, wal->delta().Angle()).Degrees(); const double scale = (90. / 2048.); p->angle.addadjustment(DAngle::fromDeg(p->MotoSpeed * (krand() & 1 ? -scale : scale))); diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 4655e8519..809fef221 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -679,7 +679,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, const DVector3& pos, int atw if (spawned) { spawned->spr.cstat |= CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_YCENTER; - spawned->spr.angle = VecToAngle(-wal->delta()) - DAngle90; + spawned->spr.angle = -wal->delta().Angle() - DAngle90; S_PlayActorSound(SOMETHINGHITFORCE, spawned); } diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index fcdf1751a..37c55c03e 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -1038,7 +1038,7 @@ Collision AngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int threshol DAngle GetWallNormal(walltype* pWall) { - return (VecToAngle(pWall->delta()) + DAngle90).Normalized360(); + return (pWall->delta().Angle() + DAngle90).Normalized360(); } //--------------------------------------------------------------------------- diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index 7a51ac59b..18c281794 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -752,7 +752,7 @@ bool UserBreakWall(walltype* wp) int WallBreakPosition(walltype* wp, sectortype** sectp, DVector3& pos, DAngle& ang) { int nx,ny; - DAngle wall_ang = VecToAngle(wp->delta()) + DAngle90; + DAngle wall_ang = wp->delta().Angle() + DAngle90; *sectp = wp->sectorp(); ASSERT(*sectp); diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 186fc5965..70c242206 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -438,7 +438,7 @@ int DoBloodSpray(DSWActor* actor) break; } - auto wall_ang = VecToAngle(wph->delta()) - DAngle90; + auto wall_ang = wph->delta().Angle() - DAngle90; SpawnMidSplash(actor); auto bldActor = QueueWallBlood(actor, wall_ang); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index aaf9e1443..8e355b332 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1670,7 +1670,7 @@ void SlipSlope(PLAYER* pp) if (!(sectu->flags & SECTFU_SLIDE_SECTOR) || !(pp->cursector->floorstat & CSTAT_SECTOR_SLOPE)) return; - DAngle ang = VecToAngle(pp->cursector->firstWall()->delta()) + DAngle90; + DAngle ang = pp->cursector->firstWall()->delta().Angle() + DAngle90; pp->vect += ang.ToVector() * pp->cursector->floorheinum / (1 << (sectu->speed + 4)); // todo confirm scale } @@ -6301,7 +6301,7 @@ void DoPlayerDeathMoveHead(PLAYER* pp) } case kHitWall: { - DAngle wall_ang = VecToAngle(plActor->user.coll.hitWall->delta()) - DAngle90; + DAngle wall_ang = plActor->user.coll.hitWall->delta().Angle() - DAngle90; DAngle dang = deltaangle(wall_ang, plActor->user.slide_ang); plActor->user.slide_ang = wall_ang + DAngle180 - dang; diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index 520f83e1d..3a4a04f70 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -1023,7 +1023,7 @@ int DoRipperMoveHang(DSWActor* actor) actor->user.WaitTics = 2 + ((RANDOM_P2(4 << 8) >> 8) * 120); // hang flush with the wall - actor->spr.angle = VecToAngle(actor->user.coll.hitWall->delta()) - DAngle90; + actor->spr.angle = actor->user.coll.hitWall->delta().Angle() - DAngle90; return 0; } diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index af5312bb1..d4881cd31 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -1029,7 +1029,7 @@ int DoRipper2MoveHang(DSWActor* actor) actor->user.WaitTics = 0; // Double jump // hang flush with the wall - actor->spr.angle = VecToAngle(actor->user.coll.hitWall->delta()) - DAngle90; + actor->spr.angle = actor->user.coll.hitWall->delta().Angle() - DAngle90; return 0; } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 1a6af17e8..b6bd54d7d 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -8366,7 +8366,7 @@ bool SlopeBounce(DSWActor* actor, bool* hit_wall) // get angle of the first wall of the sector auto wallp = hit_sector->firstWall(); - DAngle daang = VecToAngle(wallp->delta()); + DAngle daang = wallp->delta().Angle(); // k is now the slope of the ceiling or floor @@ -15556,7 +15556,7 @@ bool HitscanSpriteAdjust(DSWActor* actor, walltype* hit_wall) { if (hit_wall) { - actor->spr.angle = VecToAngle(hit_wall->delta()) + DAngle90; + actor->spr.angle = hit_wall->delta().Angle() + DAngle90; } DAngle ang = actor->spr.angle; @@ -17966,7 +17966,7 @@ void QueueHole(sectortype* hit_sect, walltype* hit_wall, const DVector3& pos) spawnedActor->spr.cstat |= (CSTAT_SPRITE_ONE_SIDE); spawnedActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); - spawnedActor->spr.angle = VecToAngle(hit_wall->delta()) + DAngle90; + spawnedActor->spr.angle = hit_wall->delta().Angle() + DAngle90; // move it back some auto vec = spawnedActor->spr.angle.ToVector(); @@ -18308,7 +18308,7 @@ DSWActor* QueueWallBlood(DSWActor* actor, DAngle bang) spawnedActor->spr.cstat |= (CSTAT_SPRITE_YCENTER); spawnedActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); - spawnedActor->spr.angle = VecToAngle(hit.hitWall->delta()) + DAngle90; + spawnedActor->spr.angle = hit.hitWall->delta().Angle() + DAngle90; // move it back some auto vec = spawnedActor->spr.angle.ToVector();