- made SP_TAG1 a function with an actor parameter.

This commit is contained in:
Christoph Oelckers 2021-12-24 13:42:50 +01:00
parent 40050f5008
commit 5be1bc4de7
9 changed files with 35 additions and 34 deletions

View file

@ -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;

View file

@ -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)
{

View file

@ -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;

View file

@ -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();

View file

@ -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;
}

View file

@ -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();

View file

@ -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();

View file

@ -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:

View file

@ -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();