diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 4e775509b..83d75dbd5 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -314,7 +314,7 @@ static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno) secno = fr.ReadInt16(); spr.statnum = fr.ReadInt16(); spr.intangle = fr.ReadInt16(); - spr.angle = DAngle::fromBuild(spr.intangle); + spr.angle = mapangle(spr.intangle); spr.intowner = fr.ReadInt16(); spr.xint = fr.ReadInt16(); spr.yint = fr.ReadInt16(); @@ -341,7 +341,7 @@ static void ReadSpriteV6(FileReader& fr, spritetype& spr, int& secno) spr.yoffset = fr.ReadInt8(); spr.picnum = fr.ReadInt16(); spr.intangle = fr.ReadInt16(); - spr.angle = DAngle::fromBuild(spr.intangle); + spr.angle = mapangle(spr.intangle); spr.xint = fr.ReadInt16(); spr.yint = fr.ReadInt16(); spr.inittype = fr.ReadInt16(); @@ -369,7 +369,7 @@ static void ReadSpriteV5(FileReader& fr, spritetype& spr, int& secno) spr.yrepeat = fr.ReadUInt8(); spr.picnum = fr.ReadInt16(); spr.intangle = fr.ReadInt16(); - spr.angle = DAngle::fromBuild(spr.intangle); + spr.angle = mapangle(spr.intangle); spr.xint = fr.ReadInt16(); spr.yint = fr.ReadInt16(); spr.inittype = fr.ReadInt16(); diff --git a/source/core/maptypes.h b/source/core/maptypes.h index ba3115e99..cbf1d6149 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -745,3 +745,9 @@ TArray loadMapWalls(const char* filename); void loadMapBackup(const char* filename); void loadMapHack(const char* filename, const uint8_t*, SpawnSpriteDef& sprites); void validateStartSector(const char* filename, const DVector3& pos, int* cursectnum, unsigned numsectors, bool noabort = false); + +// should only be used to read angles from map-loaded data (for proper documentation) +inline DAngle mapangle(int mapang) +{ + return DAngle::fromBuild(mapang); +} \ No newline at end of file diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index 7258ece50..c22904097 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -139,7 +139,7 @@ static void batThinkGoto(DBloodActor* actor) auto nAngle = VecToAngle(dvec); int nDist = approxDist(dvec); aiChooseDirection(actor, nAngle); - if (nDist < 512 && absangle(actor->spr.angle, nAngle) < DAngle::fromBuild(pDudeInfo->periphery)) + if (nDist < 512 && absangle(actor->spr.angle, nAngle) < mapangle(pDudeInfo->periphery)) aiNewState(actor, &batSearch); batThinkTarget(actor); } diff --git a/source/games/blood/src/aibeast.cpp b/source/games/blood/src/aibeast.cpp index 97fa50c55..8952178f9 100644 --- a/source/games/blood/src/aibeast.cpp +++ b/source/games/blood/src/aibeast.cpp @@ -178,7 +178,7 @@ static void beastThinkGoto(DBloodActor* actor) auto nAngle = VecToAngle(dvec); int nDist = approxDist(dvec); aiChooseDirection(actor, nAngle); - if (nDist < 512 && absangle(actor->spr.angle, nAngle) < DAngle::fromBuild(pDudeInfo->periphery)) + if (nDist < 512 && absangle(actor->spr.angle, nAngle) < mapangle(pDudeInfo->periphery)) { if (pXSector && pXSector->Underwater) aiNewState(actor, &beastSwimSearch); @@ -328,7 +328,7 @@ static void beastThinkSwimGoto(DBloodActor* actor) auto nAngle = VecToAngle(dvec); int nDist = approxDist(dvec); aiChooseDirection(actor, nAngle); - if (nDist < 512 && absangle(actor->spr.angle, nAngle) < DAngle::fromBuild(pDudeInfo->periphery)) + if (nDist < 512 && absangle(actor->spr.angle, nAngle) < mapangle(pDudeInfo->periphery)) aiNewState(actor, &beastSwimSearch); aiThinkTarget(actor); } diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index 8c8dd92dd..f2bc94288 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -152,7 +152,7 @@ static void eelThinkGoto(DBloodActor* actor) auto nAngle = VecToAngle(dvec); int nDist = approxDist(dvec); aiChooseDirection(actor, nAngle); - if (nDist < 512 && absangle(actor->spr.angle, nAngle) < DAngle::fromBuild(pDudeInfo->periphery)) + if (nDist < 512 && absangle(actor->spr.angle, nAngle) < mapangle(pDudeInfo->periphery)) aiNewState(actor, &eelSearch); eelThinkTarget(actor); } diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 383f52a92..151271103 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -475,7 +475,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, int* cursectnum, pSprite->picnum = LittleShort(load.picnum); int secno = LittleShort(load.sectnum); pSprite->statnum = LittleShort(load.statnum); - pSprite->angle = DAngle::fromBuild(LittleShort(load.ang)); + pSprite->angle = mapangle(LittleShort(load.ang)); pSprite->intowner = LittleShort(load.owner); pSprite->xint = LittleShort(load.index); pSprite->yint = LittleShort(load.yvel); @@ -549,7 +549,7 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, int* cursectnum, pXSprite->data1 = bitReader.readSigned(16); pXSprite->data2 = bitReader.readSigned(16); pXSprite->data3 = bitReader.readSigned(16); - pXSprite->goalAng = DAngle::fromBuild(bitReader.readUnsigned(11)); + pXSprite->goalAng = mapangle(bitReader.readUnsigned(11)); pXSprite->dodgeDir = bitReader.readSigned(2); pXSprite->locked = bitReader.readUnsigned(1); pXSprite->medium = bitReader.readUnsigned(2); diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index 6b2405271..f499acb49 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -417,7 +417,7 @@ QAV* getQAV(int res_id) qavdata->frames[i].tiles[j].stat = fr.ReadInt32(); qavdata->frames[i].tiles[j].shade = fr.ReadInt8(); qavdata->frames[i].tiles[j].palnum = fr.ReadUInt8(); - qavdata->frames[i].tiles[j].angle = DAngle::fromBuild(fr.ReadUInt16()); + qavdata->frames[i].tiles[j].angle = mapangle(fr.ReadUInt16()); } } diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index cb1b4964c..f64798d00 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -155,7 +155,7 @@ void AISoul::Tick(RunListEvent* ev) pActor->spr.extra += (pActor->nPhase & 0x0F) + 5; pActor->spr.extra &= kAngleMask; - double nVel = DAngle::fromBuild(pActor->spr.extra).Cos(); + double nVel = mapangle(pActor->spr.extra).Cos(); auto vect = pActor->spr.angle.ToVector() * nVel * 8; auto coll = movesprite(pActor,vect, pActor->vel.Z, 0, CLIPMASK0); diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index aef08ce02..3380ebfe8 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -1176,7 +1176,7 @@ void SetupSectorObject(sectortype* sectp, short tag) break; case SO_LIMIT_TURN: sop->limit_ang_center = actor->spr.angle; - sop->limit_ang_delta = DAngle::fromBuild(actor->spr.lotag); + sop->limit_ang_delta = mapangle(actor->spr.lotag); KillActor(actor); break; case SO_MATCH_EVENT: @@ -1191,7 +1191,7 @@ void SetupSectorObject(sectortype* sectp, short tag) case SO_SPIN: if (sop->spin_speed != nullAngle) break; - sop->spin_speed = DAngle::fromBuild(actor->spr.lotag); + sop->spin_speed = mapangle(actor->spr.lotag); sop->last_ang = sop->ang; KillActor(actor); break; @@ -1203,7 +1203,7 @@ void SetupSectorObject(sectortype* sectp, short tag) break; case SO_SPIN_REVERSE: - sop->spin_speed = DAngle::fromBuild(actor->spr.lotag); + sop->spin_speed = mapangle(actor->spr.lotag); sop->last_ang = sop->ang; if (sop->spin_speed >= nullAngle) @@ -2195,7 +2195,7 @@ DVector2 DoTrack(SECTOR_OBJECT* sop, short locktics) if (sop->spin_speed != nullAngle) break; - sop->spin_speed = DAngle::fromBuild(tpoint->tag_high); + sop->spin_speed = mapangle(tpoint->tag_high); sop->last_ang = sop->ang; break; diff --git a/source/games/sw/src/wallmove.cpp b/source/games/sw/src/wallmove.cpp index ccffb9a3d..e155dd217 100644 --- a/source/games/sw/src/wallmove.cpp +++ b/source/games/sw/src/wallmove.cpp @@ -93,7 +93,7 @@ int DoWallMove(DSWActor* actor) bool SOsprite = false; double dist = SP_TAG13(actor) * maptoworld; - DAngle ang = DAngle::fromBuild(SP_TAG4(actor)); + DAngle ang = mapangle(SP_TAG4(actor)); picnum1 = SP_TAG5(actor); picnum2 = SP_TAG6(actor); shade1 = SP_TAG7(actor); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 4d093ee32..31d15cfa2 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -11740,7 +11740,7 @@ int DoSerpRing(DSWActor* actor) } // rotate the ring - actor->user.slide_ang += DAngle::fromBuild(actor->spr.yint); + actor->user.slide_ang += mapangle(actor->spr.yint); // rotate the heads if (actor->user.Flags & (SPR_BOUNCE))