diff --git a/source/games/sw/src/copysect.cpp b/source/games/sw/src/copysect.cpp index 39e932275..d7673b517 100644 --- a/source/games/sw/src/copysect.cpp +++ b/source/games/sw/src/copysect.cpp @@ -165,7 +165,7 @@ void CopySectorMatch(int match) while (auto itActor = itsec.Next()) { // don't move ST1 Copy Tags - if (SP_TAG1(&itActor->spr) != SECT_COPY_SOURCE) + if (SP_TAG1(itActor) != SECT_COPY_SOURCE) { int sx,sy,dx,dy,src_xoff,src_yoff,trash; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 42efda233..4632f70e3 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -186,24 +186,6 @@ inline int32_t FIXED(int32_t msw, int32_t lsw) #define MSW(fixed) ((fixed)>>16) #define LSW(fixed) (((int16_t)(fixed))) -// Defines for reading in ST1 sprite tagging -#define SP_TAG1(sp) ((sp)->hitag) -#define SP_TAG2(sp) ((sp)->lotag) -#define SP_TAG3(sp) ((sp)->clipdist) -#define SP_TAG4(sp) ((sp)->ang) -#define SP_TAG5(sp) ((sp)->xvel) -#define SP_TAG6(sp) ((sp)->yvel) -#define SP_TAG7(sp) (MSB_VAR((sp)->zvel)) -#define SP_TAG8(sp) (LSB_VAR((sp)->zvel)) -#define SP_TAG9(sp) (MSB_VAR((sp)->owner)) -#define SP_TAG10(sp) (LSB_VAR((sp)->owner)) -#define SP_TAG11(sp) ((sp)->shade) -#define SP_TAG12(sp) ((sp)->pal) -#define SP_TAG13(sp) LittleShort(*((int16_t*)&(sp)->xoffset)) -#define SP_TAG14(sp) LittleShort(*((int16_t*)&(sp)->xrepeat)) -#define SP_TAG15(sp) ((sp)->z) -#define SET_SP_TAG13(sp,val) (*((int16_t*)&(sp)->xoffset)) = LittleShort((int16_t)val) -#define SET_SP_TAG14(sp,val) (*((int16_t*)&(sp)->xrepeat)) = LittleShort((int16_t)val) #define TRAVERSE_CONNECT(i) for (i = connecthead; i != -1; i = connectpoint2[i]) @@ -2119,6 +2101,25 @@ END_SW_NS BEGIN_SW_NS +// Defines for reading in ST1 sprite tagging +inline int SP_TAG1(DSWActor* actor) { return actor->spr.hitag; } +#define SP_TAG2(sp) ((sp)->lotag) +#define SP_TAG3(sp) ((sp)->clipdist) +#define SP_TAG4(sp) ((sp)->ang) +#define SP_TAG5(sp) ((sp)->xvel) +#define SP_TAG6(sp) ((sp)->yvel) +#define SP_TAG7(sp) (MSB_VAR((sp)->zvel)) +#define SP_TAG8(sp) (LSB_VAR((sp)->zvel)) +#define SP_TAG9(sp) (MSB_VAR((sp)->owner)) +#define SP_TAG10(sp) (LSB_VAR((sp)->owner)) +#define SP_TAG11(sp) ((sp)->shade) +#define SP_TAG12(sp) ((sp)->pal) +#define SP_TAG13(sp) LittleShort(*((int16_t*)&(sp)->xoffset)) +#define SP_TAG14(sp) LittleShort(*((int16_t*)&(sp)->xrepeat)) +#define SP_TAG15(sp) ((sp)->z) +#define SET_SP_TAG13(sp,val) (*((int16_t*)&(sp)->xoffset)) = LittleShort((int16_t)val) +#define SET_SP_TAG14(sp,val) (*((int16_t*)&(sp)->xrepeat)) = LittleShort((int16_t)val) + // actual Z for TOS and BOS - handles both WYSIWYG and old style inline int ActorZOfTop(DSWActor* actor) { diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index 9fb411171..e7e0670f5 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -211,7 +211,7 @@ void so_addinterpolation(SECTOR_OBJECTp sop) SWSectIterator it(*sectp); while (auto actor = it.Next()) - if (actor->spr.statnum == STAT_VATOR && SP_TAG1(&actor->s()) == SECT_VATOR) + if (actor->spr.statnum == STAT_VATOR && SP_TAG1(actor) == SECT_VATOR) { interp->hasvator = true; break; diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index 301b3b398..e2c8dafe9 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -155,7 +155,7 @@ void DoRotatorMatch(PLAYERp pp, short match, bool manual) { fsp = &actor->s(); - if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match) + if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(fsp) == match) { fu = actor->u(); @@ -212,7 +212,7 @@ bool TestRotatorMatchActive(short match) { fsp = &actor->s(); - if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match) + if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(fsp) == match) { fu = actor->u(); diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 9affbbf07..6ea46a609 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -711,11 +711,11 @@ int OperateSector(sectortype* sect, short player_is_operating) if (fsect->hasU() && fsect->stag == SECT_LOCK_DOOR) return false; - if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && TEST_BOOL7(fsp)) + if (fsp->statnum == STAT_VATOR && SP_TAG1(actor) == SECT_VATOR && TEST_BOOL7(fsp)) return false; - if (fsp->statnum == STAT_ROTATOR && SP_TAG1(fsp) == SECT_ROTATOR && TEST_BOOL7(fsp)) + if (fsp->statnum == STAT_ROTATOR && SP_TAG1(actor) == SECT_ROTATOR && TEST_BOOL7(fsp)) return false; - if (fsp->statnum == STAT_SLIDOR && SP_TAG1(fsp) == SECT_SLIDOR && TEST_BOOL7(fsp)) + if (fsp->statnum == STAT_SLIDOR && SP_TAG1(actor) == SECT_SLIDOR && TEST_BOOL7(fsp)) return false; } diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index b02d0a12b..10b176824 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -151,7 +151,7 @@ void DoSlidorMatch(PLAYERp pp, short match, bool manual) { fsp = &actor->s(); - if (SP_TAG1(fsp) == SECT_SLIDOR && SP_TAG2(fsp) == match) + if (SP_TAG1(actor) == SECT_SLIDOR && SP_TAG2(fsp) == match) { fu = actor->u(); @@ -205,7 +205,7 @@ bool TestSlidorMatchActive(short match) { fsp = &actor->s(); - if (SP_TAG1(fsp) == SECT_SLIDOR && SP_TAG2(fsp) == match) + if (SP_TAG1(actor) == SECT_SLIDOR && SP_TAG2(fsp) == match) { fu = actor->u(); diff --git a/source/games/sw/src/spike.cpp b/source/games/sw/src/spike.cpp index 254e23e54..ceb2292a3 100644 --- a/source/games/sw/src/spike.cpp +++ b/source/games/sw/src/spike.cpp @@ -148,7 +148,7 @@ void DoSpikeOperate(sectortype* sect) { fsp = &actor->s(); - if (fsp->statnum == STAT_SPIKE && SP_TAG1(fsp) == SECT_SPIKE && SP_TAG3(fsp) == 0) + if (fsp->statnum == STAT_SPIKE && SP_TAG1(actor) == SECT_SPIKE && SP_TAG3(fsp) == 0) { match = SP_TAG2(fsp); if (match > 0) @@ -176,7 +176,7 @@ void DoSpikeMatch(short match) { fsp = &actor->s(); - if (SP_TAG1(fsp) == SECT_SPIKE && SP_TAG2(fsp) == match) + if (SP_TAG1(actor) == SECT_SPIKE && SP_TAG2(fsp) == match) { fu = actor->u(); @@ -202,7 +202,7 @@ bool TestSpikeMatchActive(short match) { fsp = &actor->s(); - if (SP_TAG1(fsp) == SECT_SPIKE && SP_TAG2(fsp) == match) + if (SP_TAG1(actor) == SECT_SPIKE && SP_TAG2(fsp) == match) { fu = actor->u(); diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 2ce65adc0..454d73405 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -6540,7 +6540,7 @@ void ActorWarpUpdatePos(DSWActor* actor, sectortype* sect) void MissileWarpType(DSWActor* actor, DSWActor* act_warp) { auto sp_warp = &act_warp->s(); - switch (SP_TAG1(sp_warp)) + switch (SP_TAG1(act_warp)) { case WARP_CEILING_PLANE: case WARP_FLOOR_PLANE: diff --git a/source/games/sw/src/vator.cpp b/source/games/sw/src/vator.cpp index 6f56e23f8..e75bb4358 100644 --- a/source/games/sw/src/vator.cpp +++ b/source/games/sw/src/vator.cpp @@ -153,7 +153,7 @@ void DoVatorOperate(PLAYERp pp, sectortype* sect) { fsp = &actor->s(); - if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && SP_TAG3(fsp) == 0) + if (fsp->statnum == STAT_VATOR && SP_TAG1(actor) == SECT_VATOR && SP_TAG3(fsp) == 0) { auto fsect = fsp->sector(); @@ -203,7 +203,7 @@ void DoVatorMatch(PLAYERp pp, short match) { fsp = &actor->s(); - if (SP_TAG1(fsp) == SECT_VATOR && SP_TAG2(fsp) == match) + if (SP_TAG1(actor) == SECT_VATOR && SP_TAG2(fsp) == match) { fu = actor->u(); @@ -252,7 +252,7 @@ bool TestVatorMatchActive(short match) { fsp = &actor->s(); - if (SP_TAG1(fsp) == SECT_VATOR && SP_TAG2(fsp) == match) + if (SP_TAG1(actor) == SECT_VATOR && SP_TAG2(fsp) == match) { fu = actor->u();