From b23e77d9c7b982cd49235370bb0171293e573a51 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sat, 27 Aug 2022 23:09:22 +1000 Subject: [PATCH] - Replace player's `ang` with `DAngle` object. * This commit does not build. Committed items are everything that's been done by find and replace. * Next commit has hand-performed changes that are better separated out for clarity. --- source/core/gameinput.cpp | 4 +- source/core/gameinput.h | 21 ++++---- source/games/blood/src/nnexts.cpp | 2 +- source/games/blood/src/osdcmd.cpp | 2 +- source/games/blood/src/player.cpp | 6 +-- source/games/blood/src/view.cpp | 8 +-- source/games/duke/src/actors.cpp | 22 ++++---- source/games/duke/src/actors_d.cpp | 6 +-- source/games/duke/src/actors_r.cpp | 4 +- source/games/duke/src/ccmds.cpp | 2 +- source/games/duke/src/game_misc.cpp | 6 +-- source/games/duke/src/gameexec.cpp | 14 ++--- source/games/duke/src/inlines.h | 2 +- source/games/duke/src/input.cpp | 4 +- source/games/duke/src/player_d.cpp | 8 +-- source/games/duke/src/player_r.cpp | 46 ++++++++--------- source/games/duke/src/player_w.cpp | 2 +- source/games/duke/src/prediction.cpp | 2 +- source/games/duke/src/premap.cpp | 8 +-- source/games/duke/src/render.cpp | 4 +- source/games/duke/src/sectors_d.cpp | 10 ++-- source/games/duke/src/sectors_r.cpp | 16 +++--- source/games/duke/src/sounds.cpp | 2 +- source/games/duke/src/spawn.cpp | 2 +- source/games/duke/src/vmexports.cpp | 2 +- source/games/exhumed/src/map.cpp | 2 +- source/games/exhumed/src/osdcmds.cpp | 2 +- source/games/exhumed/src/player.cpp | 10 ++-- source/games/exhumed/src/sequence.cpp | 2 +- source/games/exhumed/src/view.cpp | 4 +- source/games/sw/src/draw.cpp | 10 ++-- source/games/sw/src/game.cpp | 2 +- source/games/sw/src/game.h | 2 +- source/games/sw/src/jsector.cpp | 2 +- source/games/sw/src/jweapon.cpp | 6 +-- source/games/sw/src/mclip.cpp | 2 +- source/games/sw/src/ninja.cpp | 4 +- source/games/sw/src/osdcmds.cpp | 2 +- source/games/sw/src/player.cpp | 74 +++++++++++++-------------- source/games/sw/src/sector.cpp | 6 +-- source/games/sw/src/sounds.cpp | 2 +- source/games/sw/src/track.cpp | 10 ++-- source/games/sw/src/weapon.cpp | 46 ++++++++--------- source/games/sw/src/zombie.cpp | 2 +- 44 files changed, 197 insertions(+), 198 deletions(-) diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index 6915679ec..f445bb128 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -397,7 +397,7 @@ void PlayerAngle::applyinput(float const avel, ESyncBits* actions, double const if (avel) { // add player's input - ang += degang(avel); + ang += DAngle::fromDeg(avel); } if (spin < 0) @@ -411,7 +411,7 @@ void PlayerAngle::applyinput(float const avel, ESyncBits* actions, double const add -= spin; spin = 0; } - ang += buildfang(add); + ang += DAngle::fromBuildf(add); } } else diff --git a/source/core/gameinput.h b/source/core/gameinput.h index 1ebb35247..193ff6713 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -124,8 +124,7 @@ private: struct PlayerAngle { - binangle ang, oang; - DAngle look_ang, olook_ang, rotscrnang, orotscrnang; + DAngle ang, oang, look_ang, olook_ang, rotscrnang, orotscrnang; double spin; friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, PlayerAngle* def); @@ -148,9 +147,9 @@ struct PlayerAngle } // Commonly used getters. - binangle osum() { return oang + bamang(olook_ang.BAMs()); } - binangle sum() { return ang + bamang(look_ang.BAMs()); } - binangle interpolatedsum(double const smoothratio) { return interpolatedangle(osum(), sum(), smoothratio); } + DAngle osum() { return oang + olook_ang; } + DAngle sum() { return ang + look_ang; } + DAngle interpolatedsum(double const smoothratio) { return interpolatedangle(osum(), sum(), smoothratio); } DAngle interpolatedlookang(double const smoothratio) { return interpolatedangle(olook_ang, look_ang, smoothratio); } DAngle interpolatedrotscrn(double const smoothratio) { return interpolatedangle(orotscrnang, rotscrnang, smoothratio); } @@ -176,7 +175,7 @@ struct PlayerAngle } else { - ang += bamang(value.BAMs()); + ang += value; } } @@ -188,7 +187,7 @@ struct PlayerAngle } else { - ang = bamang(value.BAMs()); + ang = value; if (backup) oang = ang; } } @@ -197,21 +196,21 @@ struct PlayerAngle { if (targetset()) { - auto delta = deltaangle(DAngle::fromBam(ang.asbam()), target).Degrees(); + auto delta = deltaangle(ang, target).Normalized180().Degrees(); if (abs(delta) > 1) { - ang += degang(scaleAdjust * delta); + ang += DAngle::fromDeg(scaleAdjust * delta); } else { - ang = bamang(target.BAMs()); + ang = target; target = DAngle::fromBam(0); } } else if (adjustment) { - ang += degang(scaleAdjust * adjustment); + ang += DAngle::fromDeg(scaleAdjust * adjustment); } } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 6b5abf6bd..ae820e47e 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -9339,7 +9339,7 @@ void changeSpriteAngle(DBloodActor* pSpr, int nAng) { PLAYER* pPlayer = getPlayerById(pSpr->spr.type); if (pPlayer) - pPlayer->angle.ang = buildang(nAng); + pPlayer->angle.ang = DAngle::fromBuild(nAng); else { pSpr->set_int_ang(nAng); diff --git a/source/games/blood/src/osdcmd.cpp b/source/games/blood/src/osdcmd.cpp index 077c12bba..3d6ef9709 100644 --- a/source/games/blood/src/osdcmd.cpp +++ b/source/games/blood/src/osdcmd.cpp @@ -43,7 +43,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) if (ang != INT_MIN) { - pPlayer->angle.oang = pPlayer->angle.ang = gView->angle.ang = buildang(ang); + pPlayer->angle.oang = pPlayer->angle.ang = gView->angle.ang = DAngle::fromBuild(ang); pView->angle = DAngle::fromBuild(ang); } diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 7cd7b55fc..0b7eae4d1 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -810,7 +810,7 @@ void playerStart(int nPlayer, int bNewLevel) actor->add_int_z(-(bottom - actor->int_pos().Z)); actor->spr.pal = 11 + (pPlayer->teamId & 3); actor->set_int_ang(pStartZone->ang); - pPlayer->angle.ang = buildang(actor->int_ang()); + pPlayer->angle.ang = DAngle::fromBuild(actor->int_ang()); actor->spr.type = kDudePlayer1 + nPlayer; actor->spr.clipdist = pDudeInfo->clipdist; actor->spr.flags = 15; @@ -1504,7 +1504,7 @@ int ActionScan(PLAYER* pPlayer, HitInfo* out) void UpdatePlayerSpriteAngle(PLAYER* pPlayer) { - pPlayer->actor->set_int_ang(pPlayer->angle.ang.asbuild()); + pPlayer->actor->set_int_ang(pPlayer->angle.ang.Buildang()); } //--------------------------------------------------------------------------- @@ -1559,7 +1559,7 @@ void ProcessInput(PLAYER* pPlayer) DBloodActor* fragger = pPlayer->fragger; if (fragger) { - pPlayer->angle.addadjustment(deltaangle(DAngle::fromBam(pPlayer->angle.ang.asbam()), VecToAngle(fragger->int_pos().X - actor->int_pos().X, fragger->int_pos().Y - actor->int_pos().Y))); + pPlayer->angle.addadjustment(deltaangle(pPlayer->angle.ang, VecToAngle(fragger->int_pos().X - actor->int_pos().X, fragger->int_pos().Y - actor->int_pos().Y))); } pPlayer->deathTime += 4; if (!bSeqStat) diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 2c7ed9d02..6f2b02b77 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -63,7 +63,7 @@ void viewBackupView(int nPlayer) { PLAYER* pPlayer = &gPlayer[nPlayer]; VIEW* pView = &gPrevView[nPlayer]; - pView->angle = DAngle::fromBam(pPlayer->angle.ang.asbam()); + pView->angle = pPlayer->angle.ang; pView->x = pPlayer->actor->int_pos().X; pView->y = pPlayer->actor->int_pos().Y; pView->viewz = pPlayer->zView; @@ -474,7 +474,7 @@ static void DrawMap(DBloodActor* view) VIEW* pView = &gPrevView[gViewIndex]; int x = interpolatedvalue(pView->x, view->int_pos().X, gInterpolate); int y = interpolatedvalue(pView->y, view->int_pos().Y, gInterpolate); - int ang = (!SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate)).asbuild(); + int ang = (!SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate)).Buildang(); DrawOverheadMap(x, y, ang, gInterpolate); if (tm) setViewport(hud_size); @@ -532,13 +532,13 @@ void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype if (!SyncInput()) { - cA = DAngle::fromBam(gView->angle.sum().asbam()); + cA = gView->angle.sum(); cH = gView->horizon.sum(); rotscrnang = gView->angle.rotscrnang; } else { - cA = DAngle::fromBam(gView->angle.interpolatedsum(gInterpolate).asbam()); + cA = gView->angle.interpolatedsum(gInterpolate); cH = gView->horizon.interpolatedsum(gInterpolate); rotscrnang = gView->angle.interpolatedrotscrn(gInterpolate); } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index d0fdc1e29..4b2a35d8d 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -360,7 +360,7 @@ void movedummyplayers(void) { act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; act->set_int_z(act->sector()->int_ceilingz() + (27 << 8)); - act->set_int_ang(ps[p].angle.ang.asbuild()); + act->set_int_ang(ps[p].angle.ang.Buildang()); if (act->temp_data[0] == 8) act->temp_data[0] = 0; else act->temp_data[0]++; @@ -400,7 +400,7 @@ void moveplayers(void) { act->spr.pos = p->opos.plusZ(gs.playerheight); act->backupz(); - act->set_int_ang(p->angle.oang.asbuild()); + act->set_int_ang(p->angle.oang.Buildang()); SetActor(act, act->spr.pos); } else @@ -441,7 +441,7 @@ void moveplayers(void) if (p->actorsqu != nullptr) { - p->angle.addadjustment(deltaangle(DAngle::fromBam(p->angle.ang.asbam()), VecToAngle(p->actorsqu->spr.pos.X - p->pos.X, p->actorsqu->spr.pos.Y - p->pos.Y)) * (1. / 4.)); + p->angle.addadjustment(deltaangle(p->angle.ang, VecToAngle(p->actorsqu->spr.pos.X - p->pos.X, p->actorsqu->spr.pos.Y - p->pos.Y)) * (1. / 4.)); } if (act->spr.extra > 0) @@ -461,10 +461,10 @@ void moveplayers(void) if (p->wackedbyactor != nullptr && p->wackedbyactor->spr.statnum < MAXSTATUS) { - p->angle.addadjustment(deltaangle(DAngle::fromBam(p->angle.ang.asbam()), VecToAngle(p->wackedbyactor->spr.pos.X - p->pos.X, p->wackedbyactor->spr.pos.Y - p->pos.Y)) * (1. / 2.)); + p->angle.addadjustment(deltaangle(p->angle.ang, VecToAngle(p->wackedbyactor->spr.pos.X - p->pos.X, p->wackedbyactor->spr.pos.Y - p->pos.Y)) * (1. / 2.)); } } - act->set_int_ang(p->angle.ang.asbuild()); + act->set_int_ang(p->angle.ang.Buildang()); } } else @@ -497,13 +497,13 @@ void moveplayers(void) if (act->spr.extra < 8) { act->spr.xvel = 128; - act->set_int_ang(p->angle.ang.asbuild()); + act->set_int_ang(p->angle.ang.Buildang()); act->spr.extra++; ssp(act, CLIPMASK0); } else { - act->set_int_ang(2047 - (p->angle.ang.asbuild())); + act->set_int_ang(2047 - (p->angle.ang.Buildang())); SetActor(act, act->spr.pos); } } @@ -788,7 +788,7 @@ void movecrane(DDukeActor *actor, int crane) } else if (actor->IsActiveCrane()) { - auto ang = ps[p].angle.ang.asbuild(); + auto ang = ps[p].angle.ang.Buildang(); ps[p].backupxyz(); ps[p].pos.X = actor->spr.pos.X - CRANE_STEP * buildang(ang).fcos(); ps[p].pos.Y = actor->spr.pos.Y - CRANE_STEP * buildang(ang).fsin(); @@ -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.asbuild(), 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) { @@ -1508,7 +1508,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball) { if (act2->spr.picnum == queball || act2->spr.picnum == stripeball) { - j = getincangle(ps[p].angle.ang.asbuild(), getangle(act2->spr.pos.XY() - ps[p].pos.XY())); + j = getincangle(ps[p].angle.ang.Buildang(), getangle(act2->spr.pos.XY() - ps[p].pos.XY())); if (j > -64 && j < 64) { int l; @@ -1522,7 +1522,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball) if (actor->spr.pal == 12) actor->spr.xvel = 164; else actor->spr.xvel = 140; - actor->set_int_ang(ps[p].angle.ang.asbuild()); + actor->set_int_ang(ps[p].angle.ang.Buildang()); ps[p].toggle_key_flag = 2; } } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index cd2432f68..e1300bc7a 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1797,7 +1797,7 @@ void movetransports_d(void) ps[k].GetActor()->spr.extra = 0; } - ps[p].angle.ang = buildang(Owner->int_ang()); + ps[p].angle.ang = DAngle::fromBuild(Owner->int_ang()); if (Owner->GetOwner() != Owner) { @@ -2126,7 +2126,7 @@ static void greenslime(DDukeActor *actor) } else if (x < 1024 && ps[p].quick_kick == 0) { - j = getincangle(ps[p].angle.ang.asbuild(), getangle(actor->spr.pos.XY() - ps[p].pos.XY())); + j = getincangle(ps[p].angle.ang.Buildang(), getangle(actor->spr.pos.XY() - ps[p].pos.XY())); if (j > -128 && j < 128) ps[p].quick_kick = 14; } @@ -2148,7 +2148,7 @@ static void greenslime(DDukeActor *actor) SetActor(actor, actor->spr.pos); - actor->set_int_ang(ps[p].angle.ang.asbuild()); + actor->set_int_ang(ps[p].angle.ang.Buildang()); if ((PlayerInput(p, SB_FIRE) || (ps[p].quick_kick > 0)) && ps[p].GetActor()->spr.extra > 0) if (ps[p].quick_kick > 0 || (ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0)) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 6e9ed6389..c1f012923 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1447,7 +1447,7 @@ void movetransports_r(void) ps[k].GetActor()->spr.extra = 0; } - ps[p].angle.ang = buildang(Owner->int_ang()); + ps[p].angle.ang = DAngle::fromBuild(Owner->int_ang()); if (Owner->GetOwner() != Owner) { @@ -2292,7 +2292,7 @@ void rr_specialstats() { if (act2->spr.picnum == RRTILE297) { - ps[p].angle.ang = buildang(act2->int_ang()); + ps[p].angle.ang = DAngle::fromBuild(act2->int_ang()); ps[p].getposfromactor(act2, -36); ps[p].backupxyz(); ps[p].setbobpos(); diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 0fc21909b..08068e09d 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -120,7 +120,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) if (ang != INT_MIN) { - p->angle.oang = p->angle.ang = buildang(ang); + p->angle.oang = p->angle.ang = DAngle::fromBuild(ang); } if (horz != INT_MIN) diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 8a923e8be..017c39fc6 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -61,7 +61,7 @@ FString GameInterface::GetCoordString() FString out; out.Format("pos= %2.3f, %2.3f, %2.3f - angle = %2.3f - sector = %d, lotag = %d, hitag = %d", - ps[snum].pos.X, ps[snum].pos.Y, ps[snum].pos.Z, ps[snum].angle.ang.asdeg(), sectnum(ps[snum].cursector), + ps[snum].pos.X, ps[snum].pos.Y, ps[snum].pos.Z, ps[snum].angle.ang.Degrees(), sectnum(ps[snum].cursector), ps[snum].cursector->lotag, ps[snum].cursector->hitag); return out; @@ -282,14 +282,14 @@ void drawoverlays(double smoothratio) { cposx = interpolatedvalue(pp->player_int_opos().X, pp->player_int_pos().X, smoothratio); cposy = interpolatedvalue(pp->player_int_opos().Y, pp->player_int_pos().Y, smoothratio); - cang = DAngle::fromBam((!SyncInput() ? pp->angle.ang : interpolatedangle(pp->angle.oang, pp->angle.ang, smoothratio)).asbam()); + cang = !SyncInput() ? pp->angle.ang : interpolatedangle(pp->angle.oang, pp->angle.ang, smoothratio); } } else { cposx = pp->player_int_opos().X; cposy = pp->player_int_opos().Y; - cang = DAngle::fromBam(pp->angle.oang.asbam()); + cang = pp->angle.oang; } DrawOverheadMap(cposx, cposy, cang.Buildang(), smoothratio); RestoreInterpolations(); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 4a23eb7f3..5a0b93ff8 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -473,11 +473,11 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, case PLAYER_ANG: if (bSet) ps[iPlayer].angle.settarget(DAngle::fromBuild(lValue)); - else SetGameVarID(lVar2, ps[iPlayer].angle.ang.asbuild(), sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].angle.ang.Buildang(), sActor, sPlayer); break; case PLAYER_OANG: - if (!bSet) SetGameVarID(lVar2, ps[iPlayer].angle.oang.asbuild(), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ps[iPlayer].angle.oang.Buildang(), sActor, sPlayer); break; case PLAYER_ANGVEL: // This no longer exists. @@ -2425,9 +2425,9 @@ int ParseState::parse(void) else if( (l& pfacing) ) { if (g_ac->isPlayer() && ud.multimode > 1) - j = getincangle(ps[otherp].angle.ang.asbuild(), getangle(ps[g_p].pos.XY() - ps[otherp].pos.XY())); + j = getincangle(ps[otherp].angle.ang.Buildang(), getangle(ps[g_p].pos.XY() - ps[otherp].pos.XY())); else - j = getincangle(ps[g_p].angle.ang.asbuild(), getangle(g_ac->spr.pos.XY() - ps[g_p].pos.XY())); + j = getincangle(ps[g_p].angle.ang.Buildang(), getangle(g_ac->spr.pos.XY() - ps[g_p].pos.XY())); if( j > -128 && j < 128 ) j = 1; @@ -2846,7 +2846,7 @@ int ParseState::parse(void) case concmd_ifangdiffl: insptr++; - j = abs(getincangle(ps[g_p].angle.ang.asbuild(),g_ac->int_ang())); + j = abs(getincangle(ps[g_p].angle.ang.Buildang(),g_ac->int_ang())); parseifelse( j <= *insptr); break; @@ -3146,7 +3146,7 @@ int ParseState::parse(void) int i; insptr++; i = *(insptr++); // ID of def - SetGameVarID(i, ps[g_p].angle.ang.asbuild(), g_ac, g_p); + SetGameVarID(i, ps[g_p].angle.ang.Buildang(), g_ac, g_p); break; } case concmd_setplayerangle: @@ -3154,7 +3154,7 @@ int ParseState::parse(void) int i; insptr++; i = *(insptr++); // ID of def - ps[g_p].angle.ang = buildang(GetGameVarID(i, g_ac, g_p).safeValue() & 2047); + ps[g_p].angle.ang = DAngle::fromBuild(GetGameVarID(i, g_ac, g_p).safeValue() & 2047); break; } case concmd_getactorangle: diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index bc010d9e3..e6f477c43 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -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->pos.XY(), DAngle::fromBam(p->angle.ang.asbam()), p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust); + p->horizon.calcviewpitch(p->pos.XY(), p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index bf10bdf66..ff5bf313e 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -287,7 +287,7 @@ void hud_input(int plnum) EGS(p->cursector, p->player_int_pos().X, p->player_int_pos().Y, - p->player_int_pos().Z + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.asbuild(), 0, 0, nullptr, 10); + p->player_int_pos().Z + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.Buildang(), 0, 0, nullptr, 10); pactor->temp_data[3] = pactor->temp_data[4] = 0; p->holoduke_on = pactor; pactor->spr.yvel = plnum; @@ -846,7 +846,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju p->angle.processhelpers(scaleAdjust); p->horizon.processhelpers(scaleAdjust); - p->GetActor()->set_int_ang(p->angle.ang.asbuild()); + p->GetActor()->set_int_ang(p->angle.ang.Buildang()); } if (packet) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index e69b7348b..2cb9d6169 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -294,7 +294,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) if (splash) { splash->set_int_xy(hit.hitpos.X, hit.hitpos.Y); - splash->set_int_ang(ps[p].angle.ang.asbuild()); // Total tweek + splash->set_int_ang(ps[p].angle.ang.Buildang()); // Total tweek splash->spr.xvel = 32; ssp(actor, CLIPMASK0); splash->spr.xvel = 0; @@ -1020,7 +1020,7 @@ void shoot_d(DDukeActor* actor, int atwith) sx = ps[p].player_int_pos().X; sy = ps[p].player_int_pos().Y; sz = ps[p].player_int_pos().Z + ps[p].pyoff + (4 << 8); - sa = ps[p].angle.ang.asbuild(); + sa = ps[p].angle.ang.Buildang(); ps[p].crack_time = CRACK_TIME; @@ -1991,7 +1991,7 @@ static void underwater(int snum, ESyncBits actions, int fz, int cz) auto j = spawn(pact, WATERBUBBLE); if (j) { - j->add_int_pos({ bcos(p->angle.ang.asbuild() + 64 - (global_random & 128), -6), bsin(p->angle.ang.asbuild() + 64 - (global_random & 128), -6), 0 }); + j->add_int_pos({ bcos(p->angle.ang.Buildang() + 64 - (global_random & 128), -6), bsin(p->angle.ang.Buildang() + 64 - (global_random & 128), -6), 0 }); j->spr.xrepeat = 3; j->spr.yrepeat = 2; j->set_int_z(p->player_int_pos().Z + (8 << 8)); @@ -2203,7 +2203,7 @@ static void operateweapon(int snum, ESyncBits actions) p->player_int_pos().X + p->angle.ang.bcos(-6), p->player_int_pos().Y + p->angle.ang.bsin(-6), p->player_int_pos().Z, HEAVYHBOMB, -16, 9, 9, - p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, pact, 1); + p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)), i, pact, 1); if (isNam()) { diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 8cc4b147d..9724cadbb 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -186,7 +186,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, if (splash) { splash->set_int_xy(hit.hitpos.X, hit.hitpos.Y); - splash->set_int_ang(ps[p].angle.ang.asbuild()); // Total tweek + splash->set_int_ang(ps[p].angle.ang.Buildang()); // Total tweek splash->spr.xvel = 32; ssp(actor, 0); splash->spr.xvel = 0; @@ -838,7 +838,7 @@ void shoot_r(DDukeActor* actor, int atwith) sx = ps[p].player_int_pos().X; sy = ps[p].player_int_pos().Y; sz = ps[p].player_int_pos().Z + ps[p].pyoff + (4 << 8); - sa = ps[p].angle.ang.asbuild(); + sa = ps[p].angle.ang.Buildang(); if (isRRRA()) ps[p].crack_time = CRACK_TIME; } @@ -1506,7 +1506,7 @@ void checkweapons_r(player_struct* p) auto j = spawn(p->GetActor(), 7220); if (j) { - j->set_int_ang(p->angle.ang.asbuild()); + j->set_int_ang(p->angle.ang.Buildang()); j->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON]; } p->OnMotorcycle = 0; @@ -1525,7 +1525,7 @@ void checkweapons_r(player_struct* p) auto j = spawn(p->GetActor(), 7233); if (j) { - j->set_int_ang(p->angle.ang.asbuild()); + j->set_int_ang(p->angle.ang.Buildang()); j->saved_ammo = p->ammo_amount[BOAT_WEAPON]; } p->OnBoat = 0; @@ -1801,17 +1801,17 @@ static void onMotorcycle(int snum, ESyncBits &actions) } } - p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4); - p->vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4); - p->angle.addadjustment(DAngle::fromBam(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment)).asbam())); + p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.Buildang(), 4); + p->vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.Buildang(), 4); + p->angle.addadjustment(deltaangle(p->angle.ang, p->angle.ang - DAngle::fromBam(angAdjustment))); } else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil)) { rng = krand() & 1; velAdjustment = rng == 0 ? -10 : 10; currSpeed = MulScale(currSpeed, p->moto_on_oil ? 10 : 5, 7); - p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4); - p->vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4); + p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.Buildang(), 4); + p->vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.Buildang(), 4); } p->moto_on_mud = p->moto_on_oil = 0; @@ -2045,9 +2045,9 @@ static void onBoat(int snum, ESyncBits &actions) angAdjustment >>= 6; } - p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4); - p->vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4); - p->angle.addadjustment(DAngle::fromBam(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment)).asbam())); + p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.Buildang(), 4); + p->vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.Buildang(), 4); + p->angle.addadjustment(deltaangle(p->angle.ang, p->angle.ang - DAngle::fromBam(angAdjustment))); } if (p->NotOnWater && p->MotoSpeed > 50) p->MotoSpeed -= (p->MotoSpeed / 2.); @@ -2350,7 +2350,7 @@ static void underwater(int snum, ESyncBits actions, int fz, int cz) auto j = spawn(pact, WATERBUBBLE); if (j) { - j->add_int_pos({ bcos(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6), bsin(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6), 0 }); + j->add_int_pos({ bcos(p->angle.ang.Buildang() + 64 - (global_random & 128) + 128, -6), bsin(p->angle.ang.Buildang() + 64 - (global_random & 128) + 128, -6), 0 }); j->spr.xrepeat = 3; j->spr.yrepeat = 2; j->set_int_z(p->player_int_pos().Z + (8 << 8)); @@ -2369,7 +2369,7 @@ void onMotorcycleMove(int snum, walltype* wal) { auto p = &ps[snum]; auto pact = p->GetActor(); - int angleDelta = abs(p->angle.ang.asbuild() - getangle(wal->delta())); + int angleDelta = abs(p->angle.ang.Buildang() - getangle(wal->delta())); double damageAmount = p->MotoSpeed * p->MotoSpeed; p->angle.addadjustment(DAngle::fromBuildf(p->MotoSpeed / (krand() & 1 ? -2 : 2))); @@ -2424,7 +2424,7 @@ void onBoatMove(int snum, int psectlotag, walltype* wal) auto p = &ps[snum]; auto pact = p->GetActor(); auto delta = wal->delta(); - int angleDelta = abs(p->angle.ang.asbuild() - getangle(wal->delta())); + int angleDelta = abs(p->angle.ang.Buildang() - getangle(wal->delta())); p->angle.addadjustment(DAngle::fromBuildf(p->MotoSpeed / (krand() & 1 ? -4 : 4))); @@ -2471,7 +2471,7 @@ void onMotorcycleHit(int snum, DDukeActor* victim) if (numplayers == 1) { Collision coll; - int ang = int(p->TiltStatus * 20 + p->angle.ang.asbuild()); + int ang = int(p->TiltStatus * 20 + p->angle.ang.Buildang()); movesprite_ex(victim, bcos(ang, -8), bsin(ang, -8), victim->spr.zvel, CLIPMASK0, coll); } } @@ -2531,7 +2531,7 @@ void onBoatHit(int snum, DDukeActor* victim) if (numplayers == 1) { Collision coll; - int ang = int(p->TiltStatus * 20 + p->angle.ang.asbuild()); + int ang = int(p->TiltStatus * 20 + p->angle.ang.Buildang()); movesprite_ex(victim, bcos(ang, -9), bsin(ang, -9), victim->spr.zvel, CLIPMASK0, coll); } } @@ -2748,7 +2748,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) p->player_int_pos().X + p->angle.ang.bcos(-6), p->player_int_pos().Y + p->angle.ang.bsin(-6), p->player_int_pos().Z, HEAVYHBOMB, -16, 9, 9, - p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pact, 1); + p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pact, 1); if (spawned) { @@ -3163,7 +3163,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) p->player_int_pos().X + p->angle.ang.bcos(-6), p->player_int_pos().Y + p->angle.ang.bsin(-6), p->player_int_pos().Z, POWDERKEG, -16, 9, 9, - p->angle.ang.asbuild(), k * 2, i, pact, 1); + p->angle.ang.Buildang(), k * 2, i, pact, 1); } p->kickback_pic++; if (p->kickback_pic > 20) @@ -4047,7 +4047,7 @@ void OnMotorcycle(player_struct *p, DDukeActor* motosprite) { p->pos.X = motosprite->spr.pos.X; p->pos.Y = motosprite->spr.pos.Y; - p->angle.ang = buildang(motosprite->int_ang()); + p->angle.ang = DAngle::fromBuild(motosprite->int_ang()); p->ammo_amount[MOTORCYCLE_WEAPON] = motosprite->saved_ammo; deletesprite(motosprite); } @@ -4105,7 +4105,7 @@ void OffMotorcycle(player_struct *p) auto spawned = spawn(p->GetActor(), EMPTYBIKE); if (spawned) { - spawned->set_int_ang(p->angle.ang.asbuild()); + 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->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON]; @@ -4127,7 +4127,7 @@ void OnBoat(player_struct *p, DDukeActor* boat) { p->pos.X = boat->spr.pos.X; p->pos.Y = boat->spr.pos.Y; - p->angle.ang = buildang(boat->int_ang()); + p->angle.ang = DAngle::fromBuild(boat->int_ang()); p->ammo_amount[BOAT_WEAPON] = boat->saved_ammo; deletesprite(boat); } @@ -4172,7 +4172,7 @@ void OffBoat(player_struct *p) auto spawned = spawn(p->GetActor(), EMPTYBOAT); if (spawned) { - spawned->set_int_ang(p->angle.ang.asbuild()); + 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->saved_ammo = p->ammo_amount[BOAT_WEAPON]; diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index d0ed9299a..fa4cde9cc 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -344,7 +344,7 @@ void operateweapon_ww(int snum, ESyncBits actions) p->player_int_pos().X + p->angle.ang.bcos(-6), p->player_int_pos().Y + p->angle.ang.bsin(-6), p->player_int_pos().Z, HEAVYHBOMB, -16, 9, 9, - p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, p->GetActor(), 1); + p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)), i, p->GetActor(), 1); if (j) { diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index 16efdde08..e709298ea 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -54,7 +54,7 @@ void resetmys() myy = omyy = ps[myconnectindex].pos.Y; myz = omyz = ps[myconnectindex].pos.Z; myxvel = myyvel = myzvel = 0; - myang = DAngle::fromBam(ps[myconnectindex].angle.ang.asbam()); + myang = ps[myconnectindex].angle.ang; myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz; myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff; mycursectnum = sectnum(ps[myconnectindex].cursector); diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index c8b12c221..bc3ab950a 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -98,7 +98,7 @@ void pickrandomspot(int snum) p->pos = po[i].opos; p->backupxyz(); p->setbobpos(); - p->angle.oang = p->angle.ang = buildang(po[i].oa); + p->angle.oang = p->angle.ang = DAngle::fromBuild(po[i].oa); p->setCursector(po[i].os); } @@ -542,7 +542,7 @@ void resetpspritevars(int g) STATUSBARTYPE tsbar[MAXPLAYERS]; EGS(ps[0].cursector, ps[0].player_int_pos().X, ps[0].player_int_pos().Y, ps[0].player_int_pos().Z, - TILE_APLAYER, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, nullptr, 10); + TILE_APLAYER, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, nullptr, 10); if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++) { @@ -661,7 +661,7 @@ void resetpspritevars(int g) ps[j].backupxyz(); ps[j].setbobpos(); act->backuppos(); - ps[j].angle.oang = ps[j].angle.ang = buildang(act->int_ang()); + ps[j].angle.oang = ps[j].angle.ang = DAngle::fromBuild(act->int_ang()); updatesector(act->int_pos().X, act->int_pos().Y, &ps[j].cursector); @@ -1012,7 +1012,7 @@ static int LoadTheMap(MapRecord *mi, player_struct*p, int gamemode) STAT_NewLevel(mi->fileName); TITLE_InformName(mi->name); - p->angle.ang = buildang(lbang); + p->angle.ang = DAngle::fromBuild(lbang); gotpic.Zero(); diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 444db6897..b96b1c3f0 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -310,13 +310,13 @@ void displayrooms(int snum, double smoothratio, bool sceneonly) if (SyncInput()) { // Original code for when the values are passed through the sync struct - cang = DAngle::fromBam(p->angle.interpolatedsum(smoothratio).asbam()); + cang = p->angle.interpolatedsum(smoothratio); choriz = p->horizon.interpolatedsum(smoothratio); } else { // This is for real time updating of the view direction. - cang = DAngle::fromBam(p->angle.sum().asbam()); + cang = p->angle.sum(); choriz = p->horizon.sum(); } } diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 0530135e4..201389afe 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -712,7 +712,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw if (wal->twoSided()) wal->nextWall()->cstat = 0; - auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3); + auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, spr, 3); if (spawned) { spawned->spr.lotag = SE_128_GLASS_BREAKING; @@ -1589,17 +1589,17 @@ void checksectors_d(int snum) return; } if (p->newOwner != nullptr) - neartag({ p->player_int_opos().X, p->player_int_opos().Y, p->player_int_opos().Z }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280L, 1); + 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); 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.asbuild(), near, 1280, 1); + 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) - neartag({ p->player_int_pos().X, p->player_int_pos().Y, p->player_int_pos().Z + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); + neartag({ p->player_int_pos().X, p->player_int_pos().Y, p->player_int_pos().Z + (16 << 8) }, 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 + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 3); + neartag({ p->player_int_pos().X, p->player_int_pos().Y, p->player_int_pos().Z + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.Buildang(), near, 1280, 3); if (near.actor() != nullptr) { switch (near.actor()->spr.picnum) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 11d74c87c..4325b894e 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -1024,7 +1024,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw if (wal->twoSided()) wal->nextWall()->cstat = 0; - auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3); + auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, spr, 3); if (spawned) { spawned->spr.lotag = SE_128_GLASS_BREAKING; @@ -1045,7 +1045,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw if (wal->twoSided()) wal->nextWall()->cstat = 0; - auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3); + auto spawned = EGS(sptr, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, spr, 3); if (spawned) { spawned->spr.lotag = SE_128_GLASS_BREAKING; @@ -2524,21 +2524,21 @@ void checksectors_r(int snum) } return; } - neartag(p->player_int_pos(), p->GetActor()->sector(), p->angle.oang.asbuild(), near , 1280, 3); + neartag(p->player_int_pos(), p->GetActor()->sector(), p->angle.oang.Buildang(), near , 1280, 3); } if (p->newOwner != nullptr) - neartag({ p->player_int_opos().X, p->player_int_opos().Y, p->player_int_opos().Z }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280L, 1); + 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.asbuild(), near, 1280, 1); + 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) - neartag({ p->player_int_pos().X, p->player_int_pos().Y, p->player_int_pos().Z + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); + neartag({ p->player_int_pos().X, p->player_int_pos().Y, p->player_int_pos().Z + (16 << 8) }, 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 + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 3); + neartag({ p->player_int_pos().X, p->player_int_pos().Y, p->player_int_pos().Z + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.Buildang(), near, 1280, 3); if (near.actor() != nullptr) { switch (near.actor()->spr.picnum) diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 16f0091e2..695844bf1 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -319,7 +319,7 @@ void S_GetCamera(vec3_t* c, int32_t* ca, sectortype** cs) auto p = &ps[screenpeek]; if (c) *c = p->player_int_pos(); if (cs) *cs = p->cursector; - if (ca) *ca = p->angle.ang.asbuild(); + if (ca) *ca = p->angle.ang.Buildang(); } else { diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 7be8e4890..42b056210 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -433,7 +433,7 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell) if (actj->isPlayer()) { snum = actj->spr.yvel; - a = ps[snum].angle.ang.asbuild() - (krand() & 63) + 8; //Fine tune + a = ps[snum].angle.ang.Buildang() - (krand() & 63) + 8; //Fine tune act->temp_data[0] = krand() & 1; act->set_int_z((3 << 8) + ps[snum].pyoff + ps[snum].player_int_pos().Z - (ps[snum].horizon.sum().asq16() >> 12) + (!isshell ? (3 << 8) : 0)); diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index eb67e5f7b..a64f1a7b6 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -380,7 +380,7 @@ DEFINE_ACTION_FUNCTION(_DukePlayer, GetGameVar) DEFINE_ACTION_FUNCTION(_DukePlayer, angleAsBuild) { PARAM_SELF_STRUCT_PROLOGUE(player_struct); - ACTION_RETURN_INT(self->angle.ang.asbuild()); + ACTION_RETURN_INT(self->angle.ang.Buildang()); } void dukeplayer_backuppos(player_struct* self) diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index e9054cb25..e1aaf8578 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -52,7 +52,7 @@ void DrawMap(double const smoothratio) int x = pPlayerActor->__interpolatedx(smoothratio); int y = pPlayerActor->__interpolatedy(smoothratio); - int ang = (!SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio)).asbuild(); + int ang = (!SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio)).Buildang(); DrawOverheadMap(x, y, ang, smoothratio); } } diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 8b6cf3cb7..2ab721925 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -42,7 +42,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) if (ang != INT_MIN) { - nPlayer->angle.oang = nPlayer->angle.ang = buildang(ang); + nPlayer->angle.oang = nPlayer->angle.ang = DAngle::fromBuild(ang); } if (horz != INT_MIN) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 59cd3b7ad..16673b875 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -265,8 +265,8 @@ void RestartPlayer(int nPlayer) pActor->set_int_pos(nNStartSprite->int_pos()); ChangeActorSect(pActor, nNStartSprite->sector()); - plr->angle.ang = buildang(nNStartSprite->int_ang() & kAngleMask); - pActor->set_int_ang(plr->angle.ang.asbuild()); + plr->angle.ang = DAngle::fromBuild(nNStartSprite->int_ang() & kAngleMask); + pActor->set_int_ang(plr->angle.ang.Buildang()); floorsprt = insertActor(pActor->sector(), 0); @@ -279,8 +279,8 @@ void RestartPlayer(int nPlayer) else { pActor->set_int_pos({ plr->sPlayerSave.x, plr->sPlayerSave.y, plr->sPlayerSave.pSector->int_floorz() }); - plr->angle.ang = buildang(plr->sPlayerSave.nAngle&kAngleMask); - pActor->set_int_ang(plr->angle.ang.asbuild()); + plr->angle.ang = DAngle::fromBuild(plr->sPlayerSave.nAngle&kAngleMask); + pActor->set_int_ang(plr->angle.ang.Buildang()); floorsprt = nullptr; } @@ -592,7 +592,7 @@ static void pickupMessage(int no) void UpdatePlayerSpriteAngle(Player* pPlayer) { - inita = pPlayer->angle.ang.asbuild(); + inita = pPlayer->angle.ang.Buildang(); if (pPlayer->pActor) pPlayer->pActor->set_int_ang(inita); } diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index 7233e7df7..63f8c9a8d 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -384,7 +384,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset) double x = ChunkXpos[nFrameBase] + (160 + xOffset); double y = ChunkYpos[nFrameBase] + (100 + yOffset); - hud_drawsprite(x, y, 65536, fmod(-2 * PlayerList[nLocalPlayer].angle.ang.asbuildf(), kAngleMask + 1), nTile, 0, 0, 1); + hud_drawsprite(x, y, 65536, fmod(-2 * PlayerList[nLocalPlayer].angle.ang.Buildfang(), kAngleMask + 1), nTile, 0, 0, 1); nFrameBase++; } } diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 5fb147bfc..90f920a04 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -241,13 +241,13 @@ void DrawView(double smoothRatio, bool sceneonly) if (!SyncInput()) { pan = PlayerList[nLocalPlayer].horizon.sum(); - nAngle = DAngle::fromBam(PlayerList[nLocalPlayer].angle.sum().asbam()); + nAngle = PlayerList[nLocalPlayer].angle.sum(); rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang; } else { pan = PlayerList[nLocalPlayer].horizon.interpolatedsum(smoothRatio); - nAngle = DAngle::fromBam(PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio).asbam()); + nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio); rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio); } diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 1b1302784..8866ae847 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -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->add_int_ang(-MulScale(pp->angle.ang.asbuild() - pp->angle.oang.asbuild(), sr, 16)); + tsp->ang -= MulScale(pp->angle.ang.Buildang() - pp->angle.oang.Buildang(), sr, 16); } } @@ -1035,7 +1035,7 @@ FString GameInterface::GetCoordString() out.AppendFormat("POSX:%d ", pp->pos.X); out.AppendFormat("POSY:%d ", pp->pos.Y); out.AppendFormat("POSZ:%d ", pp->pos.Z); - out.AppendFormat("ANG:%d\n", pp->angle.ang.asbuild()); + out.AppendFormat("ANG:%d\n", pp->angle.ang.Buildang()); return out; } @@ -1400,13 +1400,13 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly) // This isn't needed for the turret as it was fixable, but moving sector objects are problematic. if (SyncInput() || pp != Player+myconnectindex) { - tang = DAngle::fromBam(camerapp->angle.interpolatedsum(smoothratio).asbam()); + tang = camerapp->angle.interpolatedsum(smoothratio); thoriz = camerapp->horizon.interpolatedsum(smoothratio); trotscrnang = camerapp->angle.interpolatedrotscrn(smoothratio); } else { - tang = DAngle::fromBam(pp->angle.sum().asbam()); + tang = pp->angle.sum(); thoriz = pp->horizon.sum(); trotscrnang = pp->angle.rotscrnang; } @@ -1422,7 +1422,7 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly) tx = pp->pos.X; ty = pp->pos.Y; tz = pp->pos.Z; - tang = DAngle::fromBam(pp->angle.ang.asbam()); + tang = pp->angle.ang; } tsect = pp->cursector; updatesectorz(tx, ty, tz, &tsect); diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index 153e5634e..57aaa0422 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -410,7 +410,7 @@ void InitLevel(MapRecord *maprec) SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); STAT_NewLevel(currentLevel->fileName); TITLE_InformName(currentLevel->name); - Player[0].angle.ang = buildang(ang); + Player[0].angle.ang = DAngle::fromBuild(ang); auto vissect = §or[0]; // hack alert! if (vissect->extra != -1) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index c80188d00..86eb4df50 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1951,7 +1951,7 @@ inline bool SectorIsUnderwaterArea(sectortype* sect) inline bool PlayerFacingRange(PLAYER* pp, DSWActor* a, int range) { - return (abs(getincangle(getangle(a->int_pos().X - (pp)->pos.X, a->int_pos().Y - (pp)->pos.Y), (pp)->angle.ang.asbuild())) < (range)); + return (abs(getincangle(getangle(a->int_pos().X - (pp)->pos.X, a->int_pos().Y - (pp)->pos.Y), (pp)->angle.ang.Buildang())) < (range)); } inline bool FacingRange(DSWActor* a1, DSWActor* a2, int range) diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index 062930973..aab26a97e 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -626,7 +626,7 @@ void JS_DrawCameras(PLAYER* pp, int tx, int ty, int tz, double smoothratio) if (TEST_BOOL11(camactor) && numplayers > 1) { - drawroomstotile(cp->pos.X, cp->pos.Y, cp->pos.Z, DAngle::fromBam(cp->angle.ang.asbam()), cp->horizon.horiz, cp->cursector, mirror[cnt].campic, smoothratio); + drawroomstotile(cp->pos.X, cp->pos.Y, cp->pos.Z, cp->angle.ang, cp->horizon.horiz, cp->cursector, mirror[cnt].campic, smoothratio); } else { diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index e8d69c996..8b1757366 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1249,7 +1249,7 @@ int PlayerInitChemBomb(PLAYER* pp) // Spawn a shot // Inserting and setting up variables auto actorNew = SpawnActor(STAT_MISSILE, CHEMBOMB, s_ChemBomb, pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), CHEMBOMB_VELOCITY); + nx, ny, nz, pp->angle.ang.Buildang(), CHEMBOMB_VELOCITY); // don't throw it as far if crawling if (pp->Flags & (PF_CRAWLING)) @@ -1620,7 +1620,7 @@ int PlayerInitCaltrops(PLAYER* pp) nz = pp->pos.Z + pp->bob_z + Z(8); auto actorNew = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), (CHEMBOMB_VELOCITY + RandomRange(CHEMBOMB_VELOCITY)) / 2); + nx, ny, nz, pp->angle.ang.Buildang(), (CHEMBOMB_VELOCITY + RandomRange(CHEMBOMB_VELOCITY)) / 2); // don't throw it as far if crawling if (pp->Flags & (PF_CRAWLING)) @@ -1645,7 +1645,7 @@ int PlayerInitCaltrops(PLAYER* pp) actorNew->user.Flags |= (SPR_UNDERWATER); // They go out at different angles -// spawnedActor->spr.angle = NORM_ANGLE(pp->angle.ang.asbuild() + (RandomRange(50) - 25)); +// spawnedActor->spr.ang = NORM_ANGLE(pp->angle.ang.Buildang() + (RandomRange(50) - 25)); actorNew->spr.zvel = -pp->horizon.horiz.asq16() >> 9; diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index 93656d1c1..ec3cc1e7e 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -56,7 +56,7 @@ Collision MultiClipMove(PLAYER* pp, int z, int floor_dist) { // move the box to position instead of using offset- this prevents small rounding errors // allowing you to move through wall - ang = NORM_ANGLE(pp->angle.ang.asbuild() + sop->clipbox_ang[i]); + ang = NORM_ANGLE(pp->angle.ang.Buildang() + sop->clipbox_ang[i]); vec3_t spos = { pp->pos.X, pp->pos.Y, z }; diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index 7024cfb62..97d0036ba 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -2325,7 +2325,7 @@ void InitPlayerSprite(PLAYER* pp) COVER_SetReverb(0); // Turn off any echoing that may have been going before pp->Reverb = 0; auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, pp->pos.X, - pp->pos.Y, pp->pos.Z, pp->angle.ang.asbuild(), 0); + pp->pos.Y, pp->pos.Z, pp->angle.ang.Buildang(), 0); pp->actor = actor; pp->pnum = pnum; @@ -2393,7 +2393,7 @@ void SpawnPlayerUnderSprite(PLAYER* pp) int pnum = int(pp - Player); pp->PlayerUnderActor = SpawnActor(STAT_PLAYER_UNDER0 + pnum, - NINJA_RUN_R0, nullptr, pp->cursector, pp->pos.X, pp->pos.Y, pp->pos.Z, pp->angle.ang.asbuild(), 0); + NINJA_RUN_R0, nullptr, pp->cursector, pp->pos.X, pp->pos.Y, pp->pos.Z, pp->angle.ang.Buildang(), 0); DSWActor* actor = pp->PlayerUnderActor; diff --git a/source/games/sw/src/osdcmds.cpp b/source/games/sw/src/osdcmds.cpp index e05838b13..49a0cfb94 100644 --- a/source/games/sw/src/osdcmds.cpp +++ b/source/games/sw/src/osdcmds.cpp @@ -56,7 +56,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) if (ang != INT_MIN) { - Player->angle.oang = Player->angle.ang = buildang(ang); + Player->angle.oang = Player->angle.ang = DAngle::fromBuild(ang); } if (horz != INT_MIN) diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 2352ddd80..9e8bd0293 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1177,7 +1177,7 @@ DSWActor* DoPickTarget(DSWActor* actor, uint32_t max_delta_ang, int skip_targets angle2 = NORM_ANGLE(getangle(itActor->int_pos().X - actor->int_pos().X, itActor->int_pos().Y - actor->int_pos().Y)); // Get the angle difference - // delta_ang = labs(pp->angle.ang.asbuild() - angle2); + // delta_ang = labs(pp->angle.ang.Buildang() - angle2); delta_ang = short(abs(getincangle(angle2, actor->int_ang()))); @@ -1270,7 +1270,7 @@ void DoPlayerTeleportPause(PLAYER* pp) void DoPlayerTeleportToSprite(PLAYER* pp, vec3_t* pos, int ang) { - pp->angle.ang = pp->angle.oang = buildang(ang); + pp->angle.ang = pp->angle.oang = DAngle::fromBuild(ang); pp->pos.X = pp->opos.X = pp->oldpos.X = pos->X; pp->pos.Y = pp->opos.Y = pp->oldpos.Y = pos->Y; @@ -1456,14 +1456,14 @@ void UpdatePlayerSpriteAngle(PLAYER* pp) { DSWActor* plActor = pp->actor; plActor->backupang(); - plActor->set_int_ang(pp->angle.ang.asbuild()); + plActor->set_int_ang(pp->angle.ang.Buildang()); plActor = pp->PlayerUnderActor; if (!Prediction && plActor) { plActor->backupang(); - plActor->set_int_ang(pp->angle.ang.asbuild()); + plActor->set_int_ang(pp->angle.ang.Buildang()); } } @@ -1491,11 +1491,11 @@ void DoPlayerTurnVehicle(PLAYER* pp, float avel, int z, int floor_dist) if (avel != 0) { - auto sum = pp->angle.ang + degang(avel); - if (MultiClipTurn(pp, NORM_ANGLE(sum.asbuild()), z, floor_dist)) + auto sum = pp->angle.ang + DAngle::fromDeg(avel); + if (MultiClipTurn(pp, NORM_ANGLE(sum.Buildang()), z, floor_dist)) { pp->angle.ang = sum; - pp->actor->set_int_ang(pp->angle.ang.asbuild()); + pp->actor->set_int_ang(pp->angle.ang.Buildang()); } } } @@ -1519,11 +1519,11 @@ void DoPlayerTurnVehicleRect(PLAYER* pp, int *x, int *y, int *ox, int *oy) if (avel != 0) { - auto sum = pp->angle.ang + degang(avel); - if (RectClipTurn(pp, NORM_ANGLE(sum.asbuild()), x, y, ox, oy)) + auto sum = pp->angle.ang + DAngle::fromDeg(avel); + if (RectClipTurn(pp, NORM_ANGLE(sum.Buildang()), x, y, ox, oy)) { pp->angle.ang = sum; - pp->actor->set_int_ang(pp->angle.ang.asbuild()); + pp->actor->set_int_ang(pp->angle.ang.Buildang()); } } } @@ -1547,7 +1547,7 @@ void DoPlayerTurnTurret(PLAYER* pp, float avel) if (fabs(avel) >= FLT_EPSILON) { - new_ang = DAngle::fromBam(pp->angle.ang.asbam()) + DAngle::fromDeg(avel); + new_ang = pp->angle.ang + DAngle::fromDeg(avel); if (sop->limit_ang_center >= nullAngle) { @@ -1562,11 +1562,11 @@ void DoPlayerTurnTurret(PLAYER* pp, float avel) } } - pp->angle.ang = bamang(new_ang.BAMs()); - pp->actor->set_int_ang(pp->angle.ang.asbuild()); + pp->angle.ang = new_ang; + pp->actor->set_int_ang(pp->angle.ang.Buildang()); } - OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), pp->sop->pmid.X, pp->sop->pmid.Y); + OperateSectorObject(pp->sop, pp->angle.ang.Buildang(), pp->sop->pmid.X, pp->sop->pmid.Y); } void SlipSlope(PLAYER* pp) @@ -1592,7 +1592,7 @@ void SlipSlope(PLAYER* pp) void DoPlayerHorizon(PLAYER* pp, float const horz, double const scaleAdjust) { bool const canslopetilt = !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING)) && pp->cursector && (pp->cursector->floorstat & CSTAT_SECTOR_SLOPE); - pp->horizon.calcviewpitch(pp->pos.vec2, DAngle::fromBam(pp->angle.ang.asbam()), pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursector, scaleAdjust, (pp->Flags & PF_CLIMBING)); + pp->horizon.calcviewpitch(pp->pos.vec2, pp->angle.ang, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursector, scaleAdjust, (pp->Flags & PF_CLIMBING)); pp->horizon.applyinput(horz, &pp->input.actions, scaleAdjust); } @@ -1748,7 +1748,7 @@ void UpdatePlayerSprite(PLAYER* pp) if (pp->Flags & (PF_DEAD)) { ChangeActorSect(pp->actor, pp->cursector); - actor->set_int_ang(pp->angle.ang.asbuild()); + actor->set_int_ang(pp->angle.ang.Buildang()); UpdatePlayerUnderSprite(pp); return; } @@ -1819,7 +1819,7 @@ void UpdatePlayerSprite(PLAYER* pp) UpdatePlayerUnderSprite(pp); - actor->set_int_ang(pp->angle.ang.asbuild()); + actor->set_int_ang(pp->angle.ang.Buildang()); } void DoPlayerZrange(PLAYER* pp) @@ -2465,7 +2465,7 @@ void DriveCrush(PLAYER* pp, int *x, int *y) continue; damage = -(actor->user.Health + 100); - PlayerDamageSlide(actor->user.PlayerP, damage, pp->angle.ang.asbuild()); + PlayerDamageSlide(actor->user.PlayerP, damage, pp->angle.ang.Buildang()); PlayerUpdateHealth(actor->user.PlayerP, damage); PlayerCheckDeath(actor->user.PlayerP, pp->actor); } @@ -2589,7 +2589,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) } auto save_sect = pp->cursector; - OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), MAXSO, MAXSO); + OperateSectorObject(pp->sop, pp->angle.ang.Buildang(), MAXSO, MAXSO); pp->setcursector(pp->sop->op_main_sector); // for speed floor_dist = labs(z - pp->sop->floor_loz); @@ -2618,7 +2618,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) vec3_t hit_pos = { (x[0] + x[1]) >> 1, (y[0] + y[1]) >> 1, pp->cursector->int_floorz() - Z(10) }; hitscan(hit_pos, pp->cursector, - { MOVEx(256, pp->angle.ang.asbuild()), MOVEy(256, pp->angle.ang.asbuild()), 0 }, + { MOVEx(256, pp->angle.ang.Buildang()), MOVEy(256, pp->angle.ang.Buildang()), 0 }, hit, CLIPMASK_PLAYER); if (FindDistance2D(hit.hitpos.vec2 - hit_pos.vec2) < 800) @@ -2694,7 +2694,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) } } - OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), pp->pos.X, pp->pos.Y); + OperateSectorObject(pp->sop, pp->angle.ang.Buildang(), pp->pos.X, pp->pos.Y); pp->cursector = save_sect; // for speed if (!SyncInput()) @@ -3328,7 +3328,7 @@ void DoPlayerClimb(PLAYER* pp) HitInfo near; // constantly look for new ladder sector because of warping at any time - neartag(pp->pos, pp->cursector, pp->angle.ang.asbuild(), near, 800, NTAG_SEARCH_LO_HI); + neartag(pp->pos, pp->cursector, pp->angle.ang.Buildang(), near, 800, NTAG_SEARCH_LO_HI); if (near.hitWall) { @@ -3368,8 +3368,8 @@ int DoPlayerWadeSuperJump(PLAYER* pp) for (i = 0; i < SIZ(angs); i++) { FAFhitscan(pp->pos.X, pp->pos.Y, zh, pp->cursector, // Start position - bcos(pp->angle.ang.asbuild() + angs[i]), // X vector of 3D ang - bsin(pp->angle.ang.asbuild() + angs[i]), // Y vector of 3D ang + bcos(pp->angle.ang.Buildang() + angs[i]), // X vector of 3D ang + bsin(pp->angle.ang.Buildang() + angs[i]), // Y vector of 3D ang 0, hit, CLIPMASK_MISSILE); // Z vector of 3D ang if (hit.hitWall != nullptr && hit.hitSector != nullptr) @@ -3668,7 +3668,7 @@ bool PlayerOnLadder(PLAYER* pp) if (Prediction) return false; - neartag(pp->pos, pp->cursector, pp->angle.ang.asbuild(), near, 1024 + 768, NTAG_SEARCH_LO_HI); + 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()); @@ -3680,14 +3680,14 @@ bool PlayerOnLadder(PLAYER* pp) for (i = 0; i < SIZ(angles); i++) { - neartag(pp->pos, pp->cursector, NORM_ANGLE(pp->angle.ang.asbuild() + angles[i]), near, 600, NTAG_SEARCH_LO_HI); + neartag(pp->pos, pp->cursector, NORM_ANGLE(pp->angle.ang.Buildang() + angles[i]), near, 600, NTAG_SEARCH_LO_HI); if (near.hitWall == nullptr || near.hitpos.X < 100 || near.hitWall->lotag != TAG_WALL_CLIMB) return false; FAFhitscan(pp->pos.X, pp->pos.Y, pp->pos.Z, pp->cursector, - bcos(pp->angle.ang.asbuild() + angles[i]), - bsin(pp->angle.ang.asbuild() + angles[i]), + bcos(pp->angle.ang.Buildang() + angles[i]), + bsin(pp->angle.ang.Buildang() + angles[i]), 0, hit, CLIPMASK_MISSILE); @@ -4909,7 +4909,7 @@ void DoPlayerBeginOperate(PLAYER* pp) pp->sop = pp->sop_control = sop; sop->controller = pp->actor; - pp->angle.oang = pp->angle.ang = buildang(sop->ang); + pp->angle.oang = pp->angle.ang = DAngle::fromBuild(sop->ang); pp->pos.X = sop->pmid.X; pp->pos.Y = sop->pmid.Y; updatesector(pp->pos.X, pp->pos.Y, &pp->cursector); @@ -4994,7 +4994,7 @@ void DoPlayerBeginRemoteOperate(PLAYER* pp, SECTOR_OBJECT* sop) auto save_sect = pp->cursector; - pp->angle.oang = pp->angle.ang = buildang(sop->ang); + pp->angle.oang = pp->angle.ang = DAngle::fromBuild(sop->ang); pp->pos.X = sop->pmid.X; pp->pos.Y = sop->pmid.Y; updatesector(pp->pos.X, pp->pos.Y, &pp->cursector); @@ -5117,9 +5117,9 @@ void DoPlayerStopOperate(PLAYER* pp) { DSWActor* rsp = pp->remoteActor; if (TEST_BOOL1(rsp)) - pp->angle.ang = pp->angle.oang = buildang(rsp->int_ang()); + pp->angle.ang = pp->angle.oang = DAngle::fromBuild(rsp->int_ang()); else - pp->angle.ang = pp->angle.oang = bvectangbam(pp->sop_remote->pmid.X - pp->pos.X, pp->sop_remote->pmid.Y - pp->pos.Y); + pp->angle.ang = pp->angle.oang = VecToAngle(pp->sop_remote->pmid.X - pp->pos.X, pp->sop_remote->pmid.Y - pp->pos.Y); } if (pp->sop_control) @@ -5716,7 +5716,7 @@ void DoPlayerDeathFollowKiller(PLAYER* pp) { if (FAFcansee(killer->int_pos().X, killer->int_pos().Y, ActorZOfTop(killer), killer->sector(), pp->pos.X, pp->pos.Y, pp->pos.Z, pp->cursector)) { - pp->angle.addadjustment(deltaangle(DAngle::fromBam(pp->angle.ang.asbam()), VecToAngle(killer->int_pos().X - pp->pos.X, killer->int_pos().Y - pp->pos.Y)) * (1. / 16.)); + pp->angle.addadjustment(deltaangle(pp->angle.ang, VecToAngle(killer->int_pos().X - pp->pos.X, killer->int_pos().Y - pp->pos.Y)) * (1. / 16.)); } } } @@ -5750,7 +5750,7 @@ void DoPlayerDeathCheckKeys(PLAYER* pp) plActor->spr.xrepeat = plActor->spr.yrepeat = PLAYER_NINJA_XREPEAT; plActor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER); plActor->set_int_pos({ pp->pos.X, pp->pos.Y, pp->pos.Z + PLAYER_HEIGHT }); - plActor->set_int_ang(pp->angle.ang.asbuild()); + plActor->set_int_ang(pp->angle.ang.Buildang()); DoSpawnTeleporterEffect(plActor); PlaySound(DIGI_TELEPORT, pp, v3df_none); @@ -6861,7 +6861,7 @@ void PlayerSpawnPosition(PLAYER* pp) ASSERT(spawn_sprite != nullptr); pp->pos = pp->opos = spawn_sprite->int_pos(); - pp->angle.ang = pp->angle.oang = buildang(spawn_sprite->int_ang()); + pp->angle.ang = pp->angle.oang = DAngle::fromBuild(spawn_sprite->int_ang()); pp->setcursector(spawn_sprite->sector()); getzsofslopeptr(pp->cursector, pp->pos.X, pp->pos.Y, &cz, &fz); @@ -6918,7 +6918,7 @@ void InitMultiPlayerInfo(void) continue; } - auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, pp->pos.X, pp->pos.Y, pp->pos.Z, pp->angle.ang.asbuild(), 0); + auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, pp->pos.X, pp->pos.Y, pp->pos.Z, pp->angle.ang.Buildang(), 0); start0->clearUser(); start0->spr.picnum = ST1; } @@ -7204,7 +7204,7 @@ DEFINE_ACTION_FUNCTION(_SWPlayer, MaxUserHealth) DEFINE_ACTION_FUNCTION(_SWPlayer, GetBuildAngle) { PARAM_SELF_STRUCT_PROLOGUE(PLAYER); - ACTION_RETURN_INT(self->angle.ang.asbuild()); + ACTION_RETURN_INT(self->angle.ang.Buildang()); } DEFINE_ACTION_FUNCTION(_SW, WeaponMaxAmmo) diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 7152c31e8..435b9c48c 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -1934,7 +1934,7 @@ bool NearThings(PLAYER* pp) return false; } - neartag(pp->pos, pp->cursector, pp->angle.ang.asbuild(), near, 1024, NTAG_SEARCH_LO_HI); + neartag(pp->pos, pp->cursector, pp->angle.ang.Buildang(), near, 1024, NTAG_SEARCH_LO_HI); // hit a sprite? Check to see if it has sound info in it! @@ -1966,7 +1966,7 @@ bool NearThings(PLAYER* pp) // This only gets called if nothing else worked, check for nearness to a wall { HitInfo hit{}; - short dang = pp->angle.ang.asbuild(); + short dang = pp->angle.ang.Buildang(); FAFhitscan(pp->pos.X, pp->pos.Y, pp->pos.Z - Z(30), pp->cursector, // Start position bcos(dang), // X vector of 3D ang @@ -2014,7 +2014,7 @@ void NearTagList(NEAR_TAG_INFO* ntip, PLAYER* pp, int z, int dist, int type, int HitInfo near; - neartag({ pp->pos.X, pp->pos.Y, z }, pp->cursector, pp->angle.ang.asbuild(), near, dist, type); + neartag({ pp->pos.X, pp->pos.Y, z }, pp->cursector, pp->angle.ang.Buildang(), near, dist, type); if (near.hitSector != nullptr) { diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index b37bd613c..dcd92200a 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -607,7 +607,7 @@ void GameInterface::UpdateSounds(void) else tang = VecToAngle(pp->sop_remote->pmid.X - pp->pos.X, pp->sop_remote->pmid.Y - pp->pos.Y); } - else tang = DAngle::fromBam(pp->angle.ang.asbam()); + else tang = pp->angle.ang; listener.angle = float(-tang.Radians()); listener.velocity.Zero(); diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 1feebea90..1681303c2 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -723,7 +723,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop) if (pp->posx > xlow && pp->posx < xhigh && pp->posy > ylow && pp->posy < yhigh) { - pp->RevolveAng = DAngle::fromBam(pp->angle.ang.asbam()); + pp->RevolveAng = pp->angle.ang; pp->Revolve.X = pp->pos.X; pp->Revolve.Y = pp->pos.Y; pp->RevolveDeltaAng = DAngle::fromDeg(0.); @@ -1514,7 +1514,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, int nx, int ny) { pp->Flags |= (PF_PLAYER_RIDING); - pp->RevolveAng = DAngle::fromBam(pp->angle.ang.asbam()); + pp->RevolveAng = pp->angle.ang; pp->Revolve.X = pp->pos.X; pp->Revolve.Y = pp->pos.Y; @@ -1538,7 +1538,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, int nx, int ny) // save the current information so when Player stops // moving then you // know where he was last - pp->RevolveAng = DAngle::fromBam(pp->angle.ang.asbam()); + pp->RevolveAng = pp->angle.ang; pp->Revolve.X = pp->pos.X; pp->Revolve.Y = pp->pos.Y; @@ -1554,7 +1554,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, int nx, int ny) pp->Revolve.Y += ny; // Last known angle is now adjusted by the delta angle - pp->RevolveAng = DAngle::fromBam(pp->angle.ang.asbam()) - pp->RevolveDeltaAng; + pp->RevolveAng = deltaangle(pp->RevolveDeltaAng, pp->angle.ang); } // increment Players delta angle @@ -1567,7 +1567,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, int nx, int ny) // New angle is formed by taking last known angle and // adjusting by the delta angle - pp->angle.addadjustment(deltaangle(pp->RevolveAng + pp->RevolveDeltaAng, DAngle::fromBam(pp->angle.ang.asbam()))); + pp->angle.addadjustment(deltaangle(pp->RevolveAng + pp->RevolveDeltaAng, pp->angle.ang)); UpdatePlayerSprite(pp); } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index eddbdd480..3fbdec3bd 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -11221,7 +11221,7 @@ void InitSpellRing(PLAYER* pp) ang_diff = 2048 / max_missiles; - ang_start = NORM_ANGLE(pp->angle.ang.asbuild() - (2048 / 2)); + ang_start = NORM_ANGLE(pp->angle.ang.Buildang() - (2048 / 2)); if (!SW_SHAREWARE) PlaySound(DIGI_RFWIZ, pp, v3df_none); @@ -11578,7 +11578,7 @@ void InitSpellNapalm(PLAYER* pp) for (i = 0; i < SIZ(mp); i++) { auto actor = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, pp->cursector, - pp->pos.X, pp->pos.Y, pp->pos.Z + Z(12), pp->angle.ang.asbuild(), NAPALM_VELOCITY*2); + pp->pos.X, pp->pos.Y, pp->pos.Z + Z(12), pp->angle.ang.Buildang(), NAPALM_VELOCITY*2); actor->spr.hitag = LUMINOUS; //Always full brightness @@ -11712,7 +11712,7 @@ int InitSpellMirv(PLAYER* pp) return 0; auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursector, - pp->pos.X, pp->pos.Y, pp->pos.Z + Z(12), pp->angle.ang.asbuild(), MIRV_VELOCITY); + pp->pos.X, pp->pos.Y, pp->pos.Z + Z(12), pp->angle.ang.Buildang(), MIRV_VELOCITY); PlaySound(DIGI_MIRVWIZ, actorNew, v3df_follow); @@ -11809,7 +11809,7 @@ int InitSwordAttack(PLAYER* pp) bubble = SpawnBubble(pp->actor); if (bubble != nullptr) { - bubble->set_int_ang(pp->angle.ang.asbuild()); + bubble->set_int_ang(pp->angle.ang.Buildang()); random_amt = (RANDOM_P2(32 << 8) >> 8) - 16; @@ -11858,7 +11858,7 @@ int InitSwordAttack(PLAYER* pp) short daang; int daz; - daang = pp->angle.ang.asbuild(); + daang = pp->angle.ang.Buildang(); daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000); FAFhitscan(pp->pos.X, pp->pos.Y, pp->pos.Z, pp->cursector, // Start position @@ -11980,7 +11980,7 @@ int InitFistAttack(PLAYER* pp) bubble = SpawnBubble(pp->actor); if (bubble != nullptr) { - bubble->set_int_ang(pp->angle.ang.asbuild()); + bubble->set_int_ang(pp->angle.ang.Buildang()); random_amt = (RANDOM_P2(32<<8)>>8) - 16; @@ -12039,7 +12039,7 @@ int InitFistAttack(PLAYER* pp) short daang; int daz; - daang = pp->angle.ang.asbuild(); + daang = pp->angle.ang.Buildang(); daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000); FAFhitscan(pp->pos.X, pp->pos.Y, pp->pos.Z, pp->cursector, // Start position @@ -12600,7 +12600,7 @@ int InitStar(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, STAR1, s_Star, pp->cursector, nx, ny, nz, pp->angle.ang.asbuild(), STAR_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, STAR1, s_Star, pp->cursector, nx, ny, nz, pp->angle.ang.Buildang(), STAR_VELOCITY); SetOwner(pp->actor, actorNew); actorNew->spr.yrepeat = actorNew->spr.xrepeat = STAR_REPEAT; @@ -12698,7 +12698,7 @@ void InitHeartAttack(PLAYER* pp) return; auto actorNew = SpawnActor(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursector, - pp->pos.X, pp->pos.Y, pp->pos.Z + Z(12), pp->angle.ang.asbuild(), BLOOD_WORM_VELOCITY*2); + pp->pos.X, pp->pos.Y, pp->pos.Z + Z(12), pp->angle.ang.Buildang(), BLOOD_WORM_VELOCITY*2); actorNew->spr.hitag = LUMINOUS; //Always full brightness @@ -12849,7 +12849,7 @@ int InitShotgun(PLAYER* pp) else { daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16); - daang = pp->angle.ang.asbuild(); + daang = pp->angle.ang.Buildang(); } for (i = 0; i < 12; i++) @@ -13001,7 +13001,7 @@ int InitLaser(PLAYER* pp) // Inserting and setting up variables auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), 300); + nx, ny, nz, pp->angle.ang.Buildang(), 300); actorNew->spr.hitag = LUMINOUS; //Always full brightness SetOwner(pp->actor, actorNew); @@ -13104,7 +13104,7 @@ int InitRail(PLAYER* pp) // Inserting and setting up variables auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), 1200); + nx, ny, nz, pp->angle.ang.Buildang(), 1200); SetOwner(pp->actor, actorNew); @@ -13272,7 +13272,7 @@ int InitRocket(PLAYER* pp) nz = pp->pos.Z + pp->bob_z + Z(8); auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), ROCKET_VELOCITY); + nx, ny, nz, pp->angle.ang.Buildang(), ROCKET_VELOCITY); SetOwner(pp->actor, actorNew); actorNew->spr.yrepeat = 90; @@ -13380,7 +13380,7 @@ int InitBunnyRocket(PLAYER* pp) //nz = pp->posz + pp->bob_z + Z(12); nz = pp->pos.Z + pp->bob_z + Z(8); auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R4, &s_BunnyRocket[0][0], pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), ROCKET_VELOCITY); + nx, ny, nz, pp->angle.ang.Buildang(), ROCKET_VELOCITY); SetOwner(pp->actor, actorNew); actorNew->spr.yrepeat = 64; @@ -13482,7 +13482,7 @@ int InitNuke(PLAYER* pp) nz = pp->pos.Z + pp->bob_z + Z(8); auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), 700); + nx, ny, nz, pp->angle.ang.Buildang(), 700); SetOwner(pp->actor, actorNew); actorNew->spr.yrepeat = 128; @@ -13541,7 +13541,7 @@ int InitNuke(PLAYER* pp) actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang()); actorNew->user.change.Z = zvel; - PlayerDamageSlide(pp, -40, NORM_ANGLE(pp->angle.ang.asbuild()+1024)); // Recoil slide + PlayerDamageSlide(pp, -40, NORM_ANGLE(pp->angle.ang.Buildang()+1024)); // Recoil slide return 0; } @@ -13655,7 +13655,7 @@ int InitMicro(PLAYER* pp) else { picked = nullptr; - ang = pp->angle.ang.asbuild(); + ang = pp->angle.ang.Buildang(); } nz = pp->pos.Z + pp->bob_z + Z(14); @@ -14858,7 +14858,7 @@ int InitTracerUzi(PLAYER* pp) // Inserting and setting up variables auto actorNew = SpawnActor(STAT_MISSILE, 0, s_Tracer, pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), TRACER_VELOCITY); + nx, ny, nz, pp->angle.ang.Buildang(), TRACER_VELOCITY); actorNew->spr.hitag = LUMINOUS; //Always full brightness SetOwner(pp->actor, actorNew); @@ -15187,8 +15187,8 @@ int InitUzi(PLAYER* pp) } else { - //daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RandomRange(50) - 25)); - daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RandomRange(24) - 12)); + //daang = NORM_ANGLE(pp->angle.ang.Buildang() + (RandomRange(50) - 25)); + daang = NORM_ANGLE(pp->angle.ang.Buildang() + (RandomRange(24) - 12)); daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000); } @@ -16337,7 +16337,7 @@ int InitGrenade(PLAYER* pp) // Inserting and setting up variables auto actorNew = SpawnActor(STAT_MISSILE, GRENADE, &s_Grenade[0][0], pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), GRENADE_VELOCITY); + nx, ny, nz, pp->angle.ang.Buildang(), GRENADE_VELOCITY); // don't throw it as far if crawling if (pp->Flags & (PF_CRAWLING)) @@ -16482,7 +16482,7 @@ int InitMine(PLAYER* pp) // Inserting and setting up variables auto actorNew = SpawnActor(STAT_MISSILE, MINE, s_Mine, pp->cursector, - nx, ny, nz, pp->angle.ang.asbuild(), MINE_VELOCITY); + nx, ny, nz, pp->angle.ang.Buildang(), MINE_VELOCITY); SetOwner(pp->actor, actorNew); actorNew->spr.yrepeat = 32; @@ -16610,7 +16610,7 @@ int InitFireball(PLAYER* pp) nz = pp->pos.Z + pp->bob_z + Z(15); - auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursector, nx, ny, nz, pp->angle.ang.asbuild(), FIREBALL_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursector, nx, ny, nz, pp->angle.ang.Buildang(), FIREBALL_VELOCITY); actorNew->spr.hitag = LUMINOUS; //Always full brightness actorNew->spr.xrepeat = 40; diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 2a13e5fbe..c3879c8b5 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -776,7 +776,7 @@ void SpawnZombie(PLAYER* pp, DSWActor* weaponActor) if (ownerActor == nullptr) return; - auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->pos.X, pp->pos.Y, pp->pos.Z, pp->angle.ang.asbuild(), 0); + auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->pos.X, pp->pos.Y, pp->pos.Z, pp->angle.ang.Buildang(), 0); SetOwner(actorNew, ownerActor); actorNew->spr.pal = actorNew->user.spal = ownerActor->user.spal; actorNew->set_int_ang(RANDOM_P2(2048));