diff --git a/source/core/actorlist.cpp b/source/core/actorlist.cpp index a9036441f..b10218029 100644 --- a/source/core/actorlist.cpp +++ b/source/core/actorlist.cpp @@ -495,7 +495,7 @@ DEFINE_FIELD_NAMED(DCoreActor, spr.cstat, cstat) DEFINE_FIELD_NAMED(DCoreActor, spr.cstat2, cstat2) DEFINE_FIELD_NAMED(DCoreActor, spr.picnum, picnum) DEFINE_FIELD_NAMED(DCoreActor, spr.statnum, statnum) -DEFINE_FIELD_NAMED(DCoreActor, spr.__int_angle, ang) +//DEFINE_FIELD_NAMED(DCoreActor, spr.angle, angle) DEFINE_FIELD_NAMED(DCoreActor, spr.pos, pos) DEFINE_FIELD_NAMED(DCoreActor, spr.xvel, xvel) DEFINE_FIELD_NAMED(DCoreActor, spr.yvel, yvel) diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 990dbc007..6c7815720 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -109,22 +109,21 @@ public: constexpr int16_t int_ang() const { - return spr.__int_angle; + return spr.angle.Buildang(); } void set_int_ang(int a) { - spr.__int_angle = int16_t(a); + spr.angle = DAngle::fromBuild(a); } void add_int_ang(int a) { - spr.__int_angle += int16_t(a); + spr.angle += DAngle::fromBuild(a); } void norm_ang() { - spr.__int_angle &= 2047; } // Same as above but with invertex y and z axes to match the renderer's coordinate system. diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 426669e8f..725f76826 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -569,7 +569,7 @@ tspritetype* renderAddTsprite(tspriteArray& tsprites, DCoreActor* actor) tspr->yoffset = actor->spr.yoffset; tspr->sectp = actor->spr.sectp; tspr->statnum = actor->spr.statnum; - tspr->__int_angle = actor->int_ang(); + tspr->angle = actor->spr.angle; tspr->xvel = actor->spr.xvel; tspr->yvel = actor->spr.yvel; tspr->zvel = actor->spr.zvel; diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index aa2be88ac..d8c9b96f1 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -313,7 +313,8 @@ static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno) spr.yoffset = fr.ReadInt8(); secno = fr.ReadInt16(); spr.statnum = fr.ReadInt16(); - spr.__int_angle = fr.ReadInt16(); + spr.intangle = fr.ReadInt16(); + spr.angle = DAngle::fromBuild(spr.intangle); spr.intowner = fr.ReadInt16(); spr.xvel = fr.ReadInt16(); spr.yvel = fr.ReadInt16(); @@ -339,7 +340,8 @@ static void ReadSpriteV6(FileReader& fr, spritetype& spr, int& secno) spr.xoffset = fr.ReadInt8(); spr.yoffset = fr.ReadInt8(); spr.picnum = fr.ReadInt16(); - spr.__int_angle = fr.ReadInt16(); + spr.intangle = fr.ReadInt16(); + spr.angle = DAngle::fromBuild(spr.intangle); spr.xvel = fr.ReadInt16(); spr.yvel = fr.ReadInt16(); spr.zvel = fr.ReadInt16(); @@ -366,7 +368,8 @@ static void ReadSpriteV5(FileReader& fr, spritetype& spr, int& secno) spr.xrepeat = fr.ReadUInt8(); spr.yrepeat = fr.ReadUInt8(); spr.picnum = fr.ReadInt16(); - spr.__int_angle = fr.ReadInt16(); + spr.intangle = fr.ReadInt16(); + spr.angle = DAngle::fromBuild(spr.intangle); spr.xvel = fr.ReadInt16(); spr.yvel = fr.ReadInt16(); spr.zvel = fr.ReadInt16(); diff --git a/source/core/maptypes.h b/source/core/maptypes.h index f6b2f300a..30a0e4b44 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -460,11 +460,12 @@ struct spritetypebase DVector3 pos; sectortype* sectp; + DAngle angle; ESpriteFlags cstat; int16_t picnum; int16_t statnum; - int16_t __int_angle; + int16_t intangle; // needs to be kept for SW's SP_TAG4 int16_t xvel; int16_t yvel; union { int16_t zvel, inittype; }; // inittype, type and flags are for Blood. @@ -495,22 +496,22 @@ struct spritetypebase constexpr int16_t int_ang() const { - return __int_angle; + return angle.Buildang(); } void set_int_ang(int a) { - __int_angle = int16_t(a); + angle = DAngle::fromDeg(a); } void add_int_ang(int a) { - __int_angle += int16_t(a); + angle += DAngle::fromDeg(a); } void copy_ang(const spritetypebase* other) { - __int_angle = other->int_ang(); + angle = other->angle; } }; diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index 68fa2ad2d..a6b8d6eff 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -461,7 +461,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, spritetype &c, spritet ("yoffset", c.yoffset, def->yoffset) ("statnum", c.statnum) ("sectnum", c.sectp) - ("ang", c.__int_angle, def->__int_angle) + ("angle", c.angle, def->angle) + ("ang", c.intangle, def->intangle) ("owner", c.intowner, def->intowner) ("xvel", c.xvel, def->xvel) ("yvel", c.yvel, def->yvel) diff --git a/source/core/thingdef_properties.cpp b/source/core/thingdef_properties.cpp index 3731000d1..7cdf3ea26 100644 --- a/source/core/thingdef_properties.cpp +++ b/source/core/thingdef_properties.cpp @@ -337,7 +337,7 @@ DEFINE_PROPERTY(statnum, I, CoreActor) DEFINE_PROPERTY(angle, I, CoreActor) { PROP_INT_PARM(i, 0); - bag.Info->ActorInfo()->defsprite.__int_angle = i; + bag.Info->ActorInfo()->defsprite.angle = DAngle::fromDeg(i); bag.Info->ActorInfo()->DefaultFlags |= DEFF_ANG; } diff --git a/source/core/vmexports.cpp b/source/core/vmexports.cpp index d6ad644d7..f8bea2a45 100644 --- a/source/core/vmexports.cpp +++ b/source/core/vmexports.cpp @@ -84,7 +84,7 @@ DEFINE_FIELD_X(walltype, walltype, yrepeat) DEFINE_FIELD_NAMED_X(tspritetype, tspritetype, sectp, sector) DEFINE_FIELD_X(tspritetype, tspritetype, cstat) DEFINE_FIELD_X(tspritetype, tspritetype, statnum) -DEFINE_FIELD_NAMED_X(tspritetype, tspritetype, __int_angle, ang) +DEFINE_FIELD_X(tspritetype, tspritetype, angle) DEFINE_FIELD_X(tspritetype, tspritetype, xvel) DEFINE_FIELD_X(tspritetype, tspritetype, yvel) DEFINE_FIELD_X(tspritetype, tspritetype, zvel) diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 9e4f50de2..c1ccf4043 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -477,7 +477,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int* pSprite->picnum = LittleShort(load.picnum); int secno = LittleShort(load.sectnum); pSprite->statnum = LittleShort(load.statnum); - pSprite->__int_angle = LittleShort(load.ang); + pSprite->angle = DAngle::fromBuild(LittleShort(load.ang)); pSprite->intowner = LittleShort(load.owner); pSprite->xvel = LittleShort(load.index); pSprite->yvel = LittleShort(load.yvel); diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 490ccd2c5..ef9112bf6 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -628,7 +628,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) { auto pSector = pActor->sector(); pSector->Speed = nSpeed; - pSector->Flag |= pActor->spr.int_ang(); + pSector->Flag |= pActor->spr.intangle; DeleteActor(pActor); return; diff --git a/source/games/exhumed/src/items.cpp b/source/games/exhumed/src/items.cpp index 154050f25..4a9f929e6 100644 --- a/source/games/exhumed/src/items.cpp +++ b/source/games/exhumed/src/items.cpp @@ -379,7 +379,7 @@ void StartRegenerate(DExhumedActor* pActor) if (!(currentLevel->gameflags & LEVEL_EX_MULTI)) { - pActor->spr.__int_angle /= 5; + pActor->spr.intangle /= 5; // what is this? } pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 86eb4df50..8e1ee3ac2 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1998,7 +1998,7 @@ inline int TEST_BOOL11(DSWActor* sp) { return sp->spr.extra & SPRX_BOOL11; } inline int16_t SP_TAG1(DSWActor* actor) { return actor->spr.hitag; } inline int16_t& SP_TAG2(DSWActor* actor) { return actor->spr.lotag; } inline uint8_t& SP_TAG3(DSWActor* actor) { return actor->spr.clipdist; } -inline int16_t& SP_TAG4(DSWActor* actor) { return actor->spr.__int_angle; } // this may not be transitioned to a real angular type +inline int16_t& SP_TAG4(DSWActor* actor) { return actor->spr.intangle; } // this may not be transitioned to a real angular type inline int16_t& SP_TAG5(DSWActor* actor) { return actor->spr.xvel; } inline int16_t& SP_TAG6(DSWActor* actor) { return actor->spr.yvel; } inline uint8_t& SP_TAG7(DSWActor* actor) { return MSB_VAR(actor->spr.zvel); } diff --git a/wadsrc/static/zscript/coreactor.zs b/wadsrc/static/zscript/coreactor.zs index 494eea91a..7cbe55310 100644 --- a/wadsrc/static/zscript/coreactor.zs +++ b/wadsrc/static/zscript/coreactor.zs @@ -7,7 +7,7 @@ class CoreActor native //native int16 picnum; // access is disabled to allow later refactoring. native readonly Vector3 pos; native readonly int16 statnum; - native int16 ang; + //native int16 ang; native int16 xvel; native int16 yvel; native int16 zvel, inittype; // inittype, type and flags are for Blood. diff --git a/wadsrc/static/zscript/maptypes.zs b/wadsrc/static/zscript/maptypes.zs index d9942e740..df40b518c 100644 --- a/wadsrc/static/zscript/maptypes.zs +++ b/wadsrc/static/zscript/maptypes.zs @@ -276,7 +276,7 @@ struct tspritetype native native int16 cstat; //native int16 picnum; native int16 statnum; - native int16 ang; + //native int16 ang; /* these are not needed for tsprites native int16 xvel; native int16 yvel;