diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 46d43d518..cc6a5b2a5 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1054,7 +1054,7 @@ struct USER int16_t wait_active_check; // for enemy checking of player int16_t inactive_time; // length of time actor has been unaware of his tgt - int16_t sang; + DAngle sang; uint8_t spal; // save off default palette number Collision coll; // same thing broken up into useful components. @@ -1073,7 +1073,7 @@ struct USER int16_t Vis; // Shading upgrade, for shooting, etc... bool DidAlert; // Has actor done his alert noise before? - int16_t oangdiff; // Used for interpolating sprite angles + DAngle oangdiff; // Used for interpolating sprite angles uint8_t filler; }; diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index 16cbe9e25..f42689547 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -60,7 +60,7 @@ static struct so_interp double bakipos; double lastipos; double lastoldipos; - double lastangdiff; + DAngle lastangdiff; TObjPtr actorofang; } data[SO_MAXINTERPOLATIONS]; @@ -209,7 +209,7 @@ static void so_setspriteanginterpolation(so_interp *interp, DSWActor* actor) data->oldipos = data->lastipos = data->lastoldipos = actor->int_ang(); - data->lastangdiff = 0; + data->lastangdiff = nullAngle; data->actorofang = actor; } @@ -333,9 +333,9 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings if (actorofang) { if (actorofang->hasU()) - actorofang->user.oangdiff = 0; + actorofang->user.oangdiff = nullAngle; if (!interpolating) - data->lastangdiff = 0; + data->lastangdiff = nullAngle; data->oldipos = actorofang->int_ang(); } } @@ -390,7 +390,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b auto actorofang = data->actorofang; if (actorofang) { - data->lastangdiff = actorofang->hasU() ? actorofang->user.oangdiff : 0; + data->lastangdiff = actorofang->hasU() ? actorofang->user.oangdiff : nullAngle; } } } @@ -443,7 +443,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b { DSWActor* actor = data->actorofang; if (!actor) continue; - actor->set_int_ang(NORM_ANGLE(data->lastoldipos + MulScale(data->lastangdiff, ratio, 16))); + actor->set_int_ang(NORM_ANGLE(data->lastoldipos + MulScale(data->lastangdiff.Buildang(), ratio, 16))); } else { @@ -508,7 +508,7 @@ void so_serializeinterpolations(FSerializer& arc) if (arc.isReading()) { data->lastipos = data->lastoldipos = data->oldipos; - data->lastangdiff = 0; + data->lastangdiff = nullAngle; } } } diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index c681e8d44..75787e6c8 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -855,7 +855,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, USER& w, USER* def if (arc.isReading()) { - w.oangdiff = 0; + w.oangdiff = nullAngle; } } return arc; diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index cb41defc7..4383e705c 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -838,7 +838,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop) itActor->user.Flags |= (SPR_SO_ATTACHED); - itActor->user.sang = itActor->int_ang(); + itActor->user.sang = itActor->spr.angle; itActor->user.spal = itActor->spr.pal; // search SO's sectors to make sure that it is not on a @@ -1673,8 +1673,8 @@ PlayerPart: } } - int16_t oldang = actor->int_ang(); - actor->set_int_ang(actor->user.sang); + auto oldang = actor->spr.angle; + actor->spr.angle = actor->user.sang; if (actor->user.Flags & (SPR_ON_SO_SECTOR)) { @@ -1714,7 +1714,7 @@ PlayerPart: SetActorZ(sop->so_actors[i], actor->spr.pos); } - actor->user.oangdiff += getincangle(oldang, actor->int_ang()); + actor->user.oangdiff += ::deltaangle(oldang, actor->spr.angle); if ((actor->spr.extra & SPRX_BLADE)) { diff --git a/source/games/sw/src/wallmove.cpp b/source/games/sw/src/wallmove.cpp index e2c87d36e..14e8831ae 100644 --- a/source/games/sw/src/wallmove.cpp +++ b/source/games/sw/src/wallmove.cpp @@ -59,10 +59,10 @@ void SOwallmove(SECTOR_OBJECT* sop, DSWActor* actor, walltype* find_wallp, int d if (&wal == find_wallp) { // move orig x and y in saved angle - int ang = actor->user.sang; + auto ang = actor->user.sang; - *nx = MulScale(dist, bcos(ang), 14); - *ny = MulScale(dist, bsin(ang), 14); + *nx = dist * ang.Cos(); + *ny = dist * ang.Sin(); sop->xorig[wallcount] -= *nx; sop->yorig[wallcount] -= *ny; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 21b40b3ea..5e61ce053 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -10070,7 +10070,7 @@ void AddSpriteToSectorObject(DSWActor* actor, SECTOR_OBJECT* sop) actor->user.pos.XY() = sop->pmid.XY() - actor->spr.pos.XY(); actor->user.pos.Z = sop->mid_sector->floorz - actor->spr.pos.Z; - actor->user.sang = actor->int_ang(); + actor->user.sang = actor->spr.angle; } void SpawnBigGunFlames(DSWActor* actor, DSWActor* Operator, SECTOR_OBJECT* sop, bool smallflames)