- made SP_TAG2 a function with an actor parameter.

This commit is contained in:
Christoph Oelckers 2021-12-24 14:12:21 +01:00
parent 5be1bc4de7
commit 397d9b0d84
21 changed files with 109 additions and 143 deletions

View file

@ -101,7 +101,7 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, int se
{
// back up ceilingpicnum and ceilingstat
SP_TAG5(sp) = sp->sector()->ceilingpicnum;
sp->sector()->ceilingpicnum = SP_TAG2(sp);
sp->sector()->ceilingpicnum = SP_TAG2(actor);
SP_TAG4(sp) = sp->sector()->ceilingstat;
SET(sp->sector()->ceilingstat, ESectorFlags::FromInt(SP_TAG6(sp)));
RESET(sp->sector()->ceilingstat, CSTAT_SECTOR_SKY);
@ -109,7 +109,7 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, int se
else if (SP_TAG3(sp) == 1)
{
SP_TAG5(sp) = sp->sector()->floorpicnum;
sp->sector()->floorpicnum = SP_TAG2(sp);
sp->sector()->floorpicnum = SP_TAG2(actor);
SP_TAG4(sp) = sp->sector()->floorstat;
SET(sp->sector()->floorstat, ESectorFlags::FromInt(SP_TAG6(sp)));
RESET(sp->sector()->floorstat, CSTAT_SECTOR_SKY);

View file

@ -536,8 +536,7 @@ DSWActor* FindBreakSpriteMatch(int match)
SWStatIterator it(STAT_BREAKABLE);
while (auto actor = it.Next())
{
auto sp = &actor->s();
if (SP_TAG2(sp) == match && actor->spr.picnum == ST1)
if (SP_TAG2(actor) == match && actor->spr.picnum == ST1)
{
return actor;
}

View file

@ -62,7 +62,7 @@ void PreCacheOverride(void)
SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while (auto actor = it.Next())
{
int j = SP_TAG2(&actor->spr);
int j = SP_TAG2(actor);
if(j >= 0 && j <= MAXTILES)
markTileForPrecache(j, 0);
}

View file

@ -125,7 +125,7 @@ void CopySectorMatch(int match)
{
src_sp = &sActor->s();
if (SP_TAG2(src_sp) == SP_TAG2(dest_sp) &&
if (SP_TAG2(sActor) == SP_TAG2(dActor) &&
SP_TAG3(src_sp) == SP_TAG3(dest_sp))
{
ssectp = src_sp->sector();

View file

@ -1378,18 +1378,16 @@ void UpdateWallPortalState()
{
// back up ceilingpicnum and ceilingstat
SP_TAG5(sp) = sp->sector()->ceilingpicnum;
sp->sector()->ceilingpicnum = SP_TAG2(sp);
sp->sector()->ceilingpicnum = SP_TAG2(actor);
SP_TAG4(sp) = sp->sector()->ceilingstat;
//SET(sp->sector()->ceilingstat, ((int)SP_TAG7(sp))<<7);
SET(sp->sector()->ceilingstat, ESectorFlags::FromInt(SP_TAG6(sp)));
RESET(sp->sector()->ceilingstat, CSTAT_SECTOR_SKY);
}
else if (SP_TAG3(sp) == 1)
{
SP_TAG5(sp) = sp->sector()->floorpicnum;
sp->sector()->floorpicnum = SP_TAG2(sp);
sp->sector()->floorpicnum = SP_TAG2(actor);
SP_TAG4(sp) = sp->sector()->floorstat;
//SET(sp->sector()->floorstat, ((int)SP_TAG7(sp))<<7);
SET(sp->sector()->floorstat, ESectorFlags::FromInt(SP_TAG6(sp)));
RESET(sp->sector()->floorstat, CSTAT_SECTOR_SKY);
}

View file

@ -2102,8 +2102,8 @@ 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)
inline int16_t SP_TAG1(DSWActor* actor) { return actor->spr.hitag; }
inline int16_t& SP_TAG2(DSWActor* actor) { return actor->spr.lotag; }
#define SP_TAG3(sp) ((sp)->clipdist)
#define SP_TAG4(sp) ((sp)->ang)
#define SP_TAG5(sp) ((sp)->xvel)

View file

@ -461,7 +461,7 @@ JS_ProcessEchoSpot()
if (dist <= SP_TAG4(tp)) // tag4 = ang
{
reverb = SP_TAG2(tp);
reverb = SP_TAG2(actor);
if (reverb > 200) reverb = 200;
if (reverb < 100) reverb = 100;

View file

@ -33,23 +33,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
/* #define LIGHT_Match(sp) (SP_TAG2((sp))) */
/* #define LIGHT_Type(sp) (SP_TAG3((sp))) */
/* #define LIGHT_MaxTics(sp) (SP_TAG4((sp))) */
/* #define LIGHT_MaxBright(sp) (SP_TAG5((sp))) */
/* #define LIGHT_MaxDark(sp) (SP_TAG6((sp))) */
/* #define LIGHT_ShadeInc(sp) (SP_TAG7((sp))) */
/* */
/* #define LIGHT_Dir(sp) (!!(TEST((sp)->extra, SPRX_BOOL10))) */
/* #define LIGHT_DirChange(sp) (FLIP((sp)->extra, SPRX_BOOL10)) */
/* */
/* #define LIGHT_Shade(sp) ((sp)->shade) */
/* #define LIGHT_FloorShade(sp) ((sp)->xoffset) */
/* #define LIGHT_CeilingShade(sp) ((sp)->yoffset) */
/* #define LIGHT_Tics(sp) ((sp)->pos.Z) */
/* */
/* #define LIGHT_DiffuseNum(sp) (SP_TAG3((sp))) */
/* #define LIGHT_DiffuseMult(sp) (SP_TAG4((sp))) */
void SectorLightShade(DSWActor* actor, short intensity)
{
@ -123,7 +106,7 @@ void DiffuseLighting(DSWActor* actor)
dsp = &itActor->s();
// make sure matchs match
if (LIGHT_Match(dsp) != LIGHT_Match(sp))
if (LIGHT_Match(itActor) != LIGHT_Match(actor))
continue;
shade = sp->shade + ((LIGHT_DiffuseNum(dsp) + 1) * LIGHT_DiffuseMult(dsp));
@ -150,7 +133,7 @@ void DoLightingMatch(short match, short state)
auto u = itActor->u();
sp = &itActor->s();
if (LIGHT_Match(sp) != match)
if (LIGHT_Match(itActor) != match)
continue;
switch (LIGHT_Type(sp))
@ -276,7 +259,7 @@ void InitLighting(void)
if (!TEST_BOOL9(sp))
{
DoLightingMatch(LIGHT_Match(sp), !!TEST_BOOL1(sp));
DoLightingMatch(LIGHT_Match(actor), !!TEST_BOOL1(sp));
}
}
}

View file

@ -35,7 +35,7 @@ void DoLighting(void);
// Descriptive Light variables mapped from other variables
#define LIGHT_Match(sp) (SP_TAG2((sp)))
inline int LIGHT_Match(DSWActor* sp) { return SP_TAG2(sp); }
#define LIGHT_Type(sp) (SP_TAG3((sp)))
#define LIGHT_MaxTics(sp) (SP_TAG4((sp)))
inline int8_t LIGHT_MaxBright(spritetype* sp) { return int8_t(SP_TAG5(sp)); }

View file

@ -37,7 +37,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
#define QUAKE_Match(sp) (SP_TAG2(sp))
inline int16_t& QUAKE_Match(DSWActor* actor) { return SP_TAG2(actor); }
#define QUAKE_Zamt(sp) (SP_TAG3(sp))
#define QUAKE_Radius(sp) (SP_TAG4(sp))
#define QUAKE_Duration(sp) (SP_TAG5(sp))
@ -77,7 +77,7 @@ void DoQuakeMatch(short match)
{
auto sp = &actor->s();
if (QUAKE_Match(sp) == match)
if (QUAKE_Match(actor) == match)
{
if ((int16_t)QUAKE_WaitTics(sp) > 0)
{
@ -246,7 +246,7 @@ void SpawnQuake(sectortype* sect, int x, int y, int z,
sp->cstat = 0;
sp->extra = 0;
QUAKE_Match(sp) = -1;
QUAKE_Match(actorNew) = -1;
QUAKE_Zamt(sp) = uint8_t(amt);
QUAKE_Radius(sp) = radius/8;
QUAKE_Duration(sp) = tics;

View file

@ -103,27 +103,26 @@ void SetRotatorActive(DSWActor* actor)
DoRotatorSetInterp(actor);
// play activate sound
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
DoSoundSpotMatch(SP_TAG2(actor), 1, SOUND_OBJECT_TYPE);
SET(u->Flags, SPR_ACTIVE);
u->Tics = 0;
// moving to the OFF position
if (r->tgt == 0)
VatorSwitch(SP_TAG2(sp), OFF);
VatorSwitch(SP_TAG2(actor), false);
else
VatorSwitch(SP_TAG2(sp), ON);
VatorSwitch(SP_TAG2(actor), true);
}
void SetRotatorInactive(DSWActor* actor)
{
USERp u = actor->u();
SPRITEp sp = &actor->s();
DoRotatorStopInterp(actor);
// play inactivate sound
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
DoSoundSpotMatch(SP_TAG2(actor), 2, SOUND_OBJECT_TYPE);
RESET(u->Flags, SPR_ACTIVE);
}
@ -155,7 +154,7 @@ void DoRotatorMatch(PLAYERp pp, short match, bool manual)
{
fsp = &actor->s();
if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(fsp) == match)
if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(actor) == match)
{
fu = actor->u();
@ -212,7 +211,7 @@ bool TestRotatorMatchActive(short match)
{
fsp = &actor->s();
if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(fsp) == match)
if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(actor) == match)
{
fu = actor->u();
@ -323,7 +322,7 @@ int DoRotator(DSWActor* actor)
// If ang is CLOSED then
if (r->pos == 0)
{
short match = SP_TAG2(sp);
short match = SP_TAG2(actor);
// new tgt is OPEN (open)
r->tgt = r->open_dest;

View file

@ -1013,7 +1013,7 @@ void DoSoundSpotMatch(short match, short sound_num, short sound_type)
{
sp = &actor->s();
if (SP_TAG2(sp) == match && !TEST_BOOL6(sp))
if (SP_TAG2(actor) == match && !TEST_BOOL6(sp))
{
short snd[3];
@ -1084,7 +1084,7 @@ void DoSoundSpotStopSound(short match)
auto sp = &actor->s();
// found match and is a follow type
if (SP_TAG2(sp) == match && TEST_BOOL2(sp))
if (SP_TAG2(actor) == match && TEST_BOOL2(sp))
{
DeleteNoSoundOwner(actor);
}
@ -1100,7 +1100,7 @@ void DoStopSoundSpotMatch(short match)
{
sp = &actor->s();
if (SP_TAG2(sp) == match)
if (SP_TAG2(actor) == match)
{
DoSoundSpotStopSound(SP_TAG5(sp));
}
@ -1308,7 +1308,7 @@ void DoChangorMatch(short match)
auto sp = &actor->s();
auto sectp = sp->sector();
if (SP_TAG2(sp) != match)
if (SP_TAG2(actor) != match)
continue;
if (TEST_BOOL1(sp))

View file

@ -99,27 +99,26 @@ void SetSlidorActive(DSWActor* actor)
DoSlidorInterp(actor, StartInterpolation);
// play activate sound
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
DoSoundSpotMatch(SP_TAG2(actor), 1, SOUND_OBJECT_TYPE);
SET(u->Flags, SPR_ACTIVE);
u->Tics = 0;
// moving to the OFF position
if (r->tgt == 0)
VatorSwitch(SP_TAG2(sp), OFF);
VatorSwitch(SP_TAG2(actor), false);
else
VatorSwitch(SP_TAG2(sp), ON);
VatorSwitch(SP_TAG2(actor), true);
}
void SetSlidorInactive(DSWActor* actor)
{
USERp u = actor->u();
SPRITEp sp = &actor->s();
DoSlidorInterp(actor, StopInterpolation);
// play inactivate sound
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
DoSoundSpotMatch(SP_TAG2(actor), 2, SOUND_OBJECT_TYPE);
RESET(u->Flags, SPR_ACTIVE);
}
@ -151,7 +150,7 @@ void DoSlidorMatch(PLAYERp pp, short match, bool manual)
{
fsp = &actor->s();
if (SP_TAG1(actor) == SECT_SLIDOR && SP_TAG2(fsp) == match)
if (SP_TAG1(actor) == SECT_SLIDOR && SP_TAG2(actor) == match)
{
fu = actor->u();
@ -205,7 +204,7 @@ bool TestSlidorMatchActive(short match)
{
fsp = &actor->s();
if (SP_TAG1(actor) == SECT_SLIDOR && SP_TAG2(fsp) == match)
if (SP_TAG1(actor) == SECT_SLIDOR && SP_TAG2(actor) == match)
{
fu = actor->u();
@ -492,7 +491,7 @@ int DoSlidor(DSWActor* actor)
// If ang is CLOSED then
if (r->pos == 0)
{
short match = SP_TAG2(sp);
short match = SP_TAG2(actor);
// new tgt is OPEN (open)
r->speed = r->orig_speed;

View file

@ -104,35 +104,34 @@ void SetSpikeActive(DSWActor* actor)
InterpSectorSprites(sp->sector(), true);
// play activate sound
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
DoSoundSpotMatch(SP_TAG2(actor), 1, SOUND_OBJECT_TYPE);
SET(u->Flags, SPR_ACTIVE);
u->Tics = 0;
// moving to the ON position
if (u->z_tgt == sp->pos.Z)
VatorSwitch(SP_TAG2(sp), ON);
VatorSwitch(SP_TAG2(actor), true);
else
// moving to the OFF position
if (u->z_tgt == u->sz)
VatorSwitch(SP_TAG2(sp), OFF);
VatorSwitch(SP_TAG2(actor), false);
}
void SetSpikeInactive(DSWActor* actor)
{
USERp u = actor->u();
SPRITEp sp = &actor->s();
SECTORp sectp = sp->sector();
SECTORp sectp = actor->spr.sector();
if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP))
StopInterpolation(sp->sector(), Interp_Sect_Ceilingheinum);
if (TEST(actor->spr.cstat, CSTAT_SPRITE_YFLIP))
StopInterpolation(sectp, Interp_Sect_Ceilingheinum);
else
StopInterpolation(sp->sector(), Interp_Sect_Floorheinum);
StopInterpolation(sectp, Interp_Sect_Floorheinum);
InterpSectorSprites(sp->sector(), false);
InterpSectorSprites(sectp, false);
// play activate sound
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
DoSoundSpotMatch(SP_TAG2(actor), 2, SOUND_OBJECT_TYPE);
RESET(u->Flags, SPR_ACTIVE);
}
@ -150,7 +149,7 @@ void DoSpikeOperate(sectortype* sect)
if (fsp->statnum == STAT_SPIKE && SP_TAG1(actor) == SECT_SPIKE && SP_TAG3(fsp) == 0)
{
match = SP_TAG2(fsp);
match = SP_TAG2(actor);
if (match > 0)
{
if (!TestSpikeMatchActive(match))
@ -168,24 +167,16 @@ void DoSpikeOperate(sectortype* sect)
// returns first spike found
void DoSpikeMatch(short match)
{
USERp fu;
SPRITEp fsp;
SWStatIterator it(STAT_SPIKE);
while (auto actor = it.Next())
{
fsp = &actor->s();
if (SP_TAG1(actor) == SECT_SPIKE && SP_TAG2(fsp) == match)
if (SP_TAG1(actor) == SECT_SPIKE && SP_TAG2(actor) == match)
{
fu = actor->u();
if (TEST(fu->Flags, SPR_ACTIVE))
if (actor->user.Flags & SPR_ACTIVE)
{
ReverseSpike(actor);
continue;
}
SetSpikeActive(actor);
}
}
@ -202,7 +193,7 @@ bool TestSpikeMatchActive(short match)
{
fsp = &actor->s();
if (SP_TAG1(actor) == SECT_SPIKE && SP_TAG2(fsp) == match)
if (SP_TAG1(actor) == SECT_SPIKE && SP_TAG2(actor) == match)
{
fu = actor->u();
@ -334,7 +325,7 @@ int DoSpike(DSWActor* actor)
// in the OFF position
if (u->z_tgt == u->sz)
{
short match = SP_TAG2(sp);
short match = SP_TAG2(actor);
// change target
u->jump_speed = u->vel_tgt;

View file

@ -1842,7 +1842,7 @@ void SpriteSetup(void)
case SLIDE_SECTOR:
sectp->u_defined = true;
SET(sectp->flags, SECTFU_SLIDE_SECTOR);
sectp->speed = SP_TAG2(sp);
sectp->speed = SP_TAG2(actor);
KillActor(actor);
break;
@ -2659,7 +2659,7 @@ void SpriteSetup(void)
case PLAX_GLOB_Z_ADJUST:
{
SET(sp->sector()->extra, SECTFX_Z_ADJUST);
PlaxCeilGlobZadjust = SP_TAG2(sp);
PlaxCeilGlobZadjust = SP_TAG2(actor);
PlaxFloorGlobZadjust = SP_TAG3(sp);
KillActor(actor);
break;
@ -3614,7 +3614,7 @@ int ActorCoughItem(DSWActor* actor)
SP_TAG3(np) = 68; // Match number
// match
SP_TAG2(np) = -1;
SP_TAG2(actorNew) = -1;
// kill
RESET_BOOL1(np);
SpawnItemsMatch(-1);
@ -3643,7 +3643,7 @@ int ActorCoughItem(DSWActor* actor)
SP_TAG3(np) = 69; // Match number
// match
SP_TAG2(np) = -1;
SP_TAG2(actorNew) = -1;
// kill
RESET_BOOL1(np);
SpawnItemsMatch(-1);
@ -3672,7 +3672,7 @@ int ActorCoughItem(DSWActor* actor)
SP_TAG3(np) = 70; // Match number
// match
SP_TAG2(np) = -1;
SP_TAG2(actorNew) = -1;
// kill
RESET_BOOL1(np);
SpawnItemsMatch(-1);
@ -3738,7 +3738,7 @@ int ActorCoughItem(DSWActor* actor)
}
// match
SP_TAG2(np) = -1;
SP_TAG2(actorNew) = -1;
// kill
RESET_BOOL1(np);
SpawnItemsMatch(-1);
@ -3796,7 +3796,7 @@ int ActorCoughItem(DSWActor* actor)
}
// match
SP_TAG2(np) = -1;
SP_TAG2(actorNew) = -1;
// kill
RESET_BOOL1(np);
SpawnItemsMatch(-1);
@ -3852,7 +3852,7 @@ int ActorCoughItem(DSWActor* actor)
}
// match
SP_TAG2(np) = -1;
SP_TAG2(actorNew) = -1;
// kill
RESET_BOOL1(np);
SpawnItemsMatch(-1);
@ -3872,7 +3872,7 @@ int SpawnItemsMatch(short match)
{
sip = &itActor->s();
if (SP_TAG2(sip) != match)
if (SP_TAG2(itActor) != match)
continue;
switch (SP_TAG3(sip))

View file

@ -1119,10 +1119,10 @@ void SetupSectorObject(sectortype* sectp, short tag)
case SO_SCALE_POINT_INFO:
memset(sop->scale_point_dist,0,sizeof(sop->scale_point_dist));
sop->scale_point_base_speed = SP_TAG2(sp);
sop->scale_point_base_speed = SP_TAG2(actor);
for (j = 0; j < (int)SIZ(sop->scale_point_speed); j++)
{
sop->scale_point_speed[j] = SP_TAG2(sp);
sop->scale_point_speed[j] = SP_TAG2(actor);
}
if (SP_TAG4(sp))
@ -1137,7 +1137,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
case SO_SCALE_INFO:
SET(sop->flags, SOBJ_DYNAMIC);
sop->scale_speed = SP_TAG2(sp);
sop->scale_speed = SP_TAG2(actor);
sop->scale_dist_min = -SP_TAG5(sp);
sop->scale_dist_max = SP_TAG6(sp);
@ -1222,7 +1222,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
KillActor(actor);
break;
case SO_MAX_DAMAGE:
u->MaxHealth = SP_TAG2(sp);
u->MaxHealth = SP_TAG2(actor);
if (SP_TAG5(sp) != 0)
sop->max_damage = SP_TAG5(sp);
else
@ -1241,7 +1241,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
case SO_DRIVABLE_ATTRIB:
sop->drive_angspeed = SP_TAG2(sp);
sop->drive_angspeed = SP_TAG2(actor);
sop->drive_angspeed <<= 5;
sop->drive_angslide = SP_TAG3(sp);
if (sop->drive_angslide <= 0 || sop->drive_angslide == 32)

View file

@ -109,18 +109,18 @@ void SetVatorActive(DSWActor* actor)
InterpSectorSprites(sp->sector(), true);
// play activate sound
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
DoSoundSpotMatch(SP_TAG2(actor), 1, SOUND_OBJECT_TYPE);
SET(u->Flags, SPR_ACTIVE);
u->Tics = 0;
// moving to the ON position
if (u->z_tgt == sp->pos.Z)
VatorSwitch(SP_TAG2(sp), ON);
VatorSwitch(SP_TAG2(actor), true);
else
// moving to the OFF position
if (u->z_tgt == u->sz)
VatorSwitch(SP_TAG2(sp), OFF);
VatorSwitch(SP_TAG2(actor), false);
}
void SetVatorInactive(DSWActor* actor)
@ -137,7 +137,7 @@ void SetVatorInactive(DSWActor* actor)
InterpSectorSprites(sp->sector(), false);
// play inactivate sound
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
DoSoundSpotMatch(SP_TAG2(actor), 2, SOUND_OBJECT_TYPE);
RESET(u->Flags, SPR_ACTIVE);
}
@ -165,7 +165,7 @@ void DoVatorOperate(PLAYERp pp, sectortype* sect)
continue;
}
match = SP_TAG2(fsp);
match = SP_TAG2(actor);
if (match > 0)
{
if (!TestVatorMatchActive(match))
@ -203,7 +203,7 @@ void DoVatorMatch(PLAYERp pp, short match)
{
fsp = &actor->s();
if (SP_TAG1(actor) == SECT_VATOR && SP_TAG2(fsp) == match)
if (SP_TAG1(actor) == SECT_VATOR && SP_TAG2(actor) == match)
{
fu = actor->u();
@ -252,7 +252,7 @@ bool TestVatorMatchActive(short match)
{
fsp = &actor->s();
if (SP_TAG1(actor) == SECT_VATOR && SP_TAG2(fsp) == match)
if (SP_TAG1(actor) == SECT_VATOR && SP_TAG2(actor) == match)
{
fu = actor->u();
@ -439,7 +439,7 @@ int DoVator(DSWActor* actor)
// in the OFF position
if (u->z_tgt == u->sz)
{
short match = SP_TAG2(sp);
short match = SP_TAG2(actor);
// change target
u->jump_speed = u->vel_tgt;

View file

@ -39,7 +39,7 @@ BEGIN_SW_NS
extern short NormalVisibility; // player.c
#define VIS_VisCur(sp) (SP_TAG2(sp))
inline int16_t& VIS_VisCur(DSWActor* actor) { return SP_TAG2(actor); }
#define VIS_VisDir(sp) (SP_TAG3(sp))
#define VIS_VisGoal(sp) (SP_TAG4(sp))
@ -55,23 +55,23 @@ void ProcessVisOn(void)
if (VIS_VisDir(sp))
{
// get brighter
VIS_VisCur(sp) >>= 1;
//VIS_VisCur(sp) -= 16;
if (VIS_VisCur(sp) <= VIS_VisGoal(sp))
VIS_VisCur(actor) >>= 1;
//VIS_VisCur(actor) -= 16;
if (VIS_VisCur(actor) <= VIS_VisGoal(sp))
{
VIS_VisCur(sp) = VIS_VisGoal(sp);
VIS_VisCur(actor) = VIS_VisGoal(sp);
VIS_VisDir(sp) ^= 1;
}
}
else
{
// get darker
VIS_VisCur(sp) <<= 1;
VIS_VisCur(sp) += 1;
//VIS_VisCur(sp) += 16;
if (VIS_VisCur(sp) >= NormalVisibility)
VIS_VisCur(actor) <<= 1;
VIS_VisCur(actor) += 1;
//VIS_VisCur(actor) += 16;
if (VIS_VisCur(actor) >= NormalVisibility)
{
VIS_VisCur(sp) = NormalVisibility;
VIS_VisCur(actor) = NormalVisibility;
auto own = GetOwner(actor);
if (own != nullptr)
{
@ -119,8 +119,8 @@ void VisViewChange(PLAYERp pp, int *vis)
// save off the brightest vis that you can see
if (FAFcansee(pp->pos.X, pp->pos.Y, pp->pos.Z, pp->cursector, x, y, z, sectp))
{
if (VIS_VisCur(sp) < BrightestVis)
BrightestVis = VIS_VisCur(sp);
if (VIS_VisCur(actor) < BrightestVis)
BrightestVis = VIS_VisCur(actor);
}
}
@ -129,7 +129,7 @@ void VisViewChange(PLAYERp pp, int *vis)
void SpawnVis(DSWActor* parentActor, sectortype* sect, int x, int y, int z, int amt)
{
SPRITEp sp;
DSWActor* actorNew = nullptr;
if (parentActor != nullptr)
{
auto psp = &parentActor->s();
@ -151,17 +151,16 @@ void SpawnVis(DSWActor* parentActor, sectortype* sect, int x, int y, int z, int
}
}
auto actorNew = insertActor(psp->sector(), STAT_VIS_ON);
sp = &actorNew->s();
actorNew = insertActor(psp->sector(), STAT_VIS_ON);
SetOwner(parentActor, actorNew);
ASSERT(parentActor->hasU());
SET(pu->Flags2, SPR2_CHILDREN);
sp->pos.X = psp->pos.X;
sp->pos.Y = psp->pos.Y;
sp->pos.Z = psp->pos.Z;
actorNew->spr.pos.X = psp->pos.X;
actorNew->spr.pos.Y = psp->pos.Y;
actorNew->spr.pos.Z = psp->pos.Z;
SET(pu->Flags2, SPR2_VIS_SHADING);
}
@ -170,20 +169,19 @@ void SpawnVis(DSWActor* parentActor, sectortype* sect, int x, int y, int z, int
if (sect->floorpal == PALETTE_FOG)
return;
auto actorNew = insertActor(sect, STAT_VIS_ON);
sp = &actorNew->s();
actorNew = insertActor(sect, STAT_VIS_ON);
sp->pos.X = x;
sp->pos.Y = y;
sp->pos.Z = z - Z(20);
actorNew->spr.pos.X = x;
actorNew->spr.pos.Y = y;
actorNew->spr.pos.Z = z - Z(20);
}
sp->cstat = 0;
sp->extra = 0;
actorNew->spr.cstat = 0;
actorNew->spr.extra = 0;
VIS_VisDir(sp) = 1;
VIS_VisCur(sp) = NormalVisibility;
VIS_VisGoal(sp) = amt;
VIS_VisDir(&actorNew->spr) = 1;
VIS_VisCur(actorNew) = NormalVisibility;
VIS_VisGoal(&actorNew->spr) = amt;
}
END_SW_NS

View file

@ -170,7 +170,7 @@ bool CanSeeWallMove(SPRITEp wp, short match)
{
sp = &actor->s();
if (SP_TAG2(sp) == match)
if (SP_TAG2(actor) == match)
{
found = true;
@ -192,7 +192,7 @@ int DoWallMoveMatch(short match)
SWStatIterator it(STAT_WALL_MOVE);
while (auto actor = it.Next())
{
if (SP_TAG2(&actor->s()) == match)
if (SP_TAG2(actor) == match)
{
found = true;
DoWallMove(actor);

View file

@ -142,7 +142,7 @@ DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, sect
if (SP_TAG5(sp))
{
short ndx = 0;
match_rand[ndx++] = SP_TAG2(sp);
match_rand[ndx++] = SP_TAG2(sp_from);
match_rand[ndx++] = SP_TAG5(sp);
if (SP_TAG6(sp))
match_rand[ndx++] = SP_TAG6(sp);

View file

@ -2806,8 +2806,8 @@ int DoLavaErupt(DSWActor* actor)
// Counter controls the volume of lava erupting
// starts out slow and increases to a max
u->Counter += synctics;
if (u->Counter > SP_TAG2(sp))
u->Counter = SP_TAG2(sp);
if (u->Counter > SP_TAG2(actor))
u->Counter = SP_TAG2(actor);
if ((RANDOM_P2(1024<<6)>>6) < u->Counter)
{
@ -7463,7 +7463,7 @@ int DoExpDamageTest(DSWActor* actor)
if (TEST_BOOL1(&actor->spr))
continue;
if (!CanSeeWallMove(wp, SP_TAG2(&actor->spr)))
if (!CanSeeWallMove(wp, SP_TAG2(actor)))
continue;
if (dist < found_dist)
@ -7475,17 +7475,16 @@ int DoExpDamageTest(DSWActor* actor)
if (found_act)
{
auto found_sp = &found_act->s();
if (SP_TAG2(found_sp) == 0)
if (SP_TAG2(found_act) == 0)
{
// just do one
DoWallMove(found_act);
}
else
{
if (DoWallMoveMatch(SP_TAG2(found_sp)))
if (DoWallMoveMatch(SP_TAG2(found_act)))
{
DoSpawnSpotsForDamage(SP_TAG2(found_sp));
DoSpawnSpotsForDamage(SP_TAG2(found_act));
}
}
}
@ -16798,12 +16797,12 @@ int InitSobjGun(PLAYERp pp)
if (sp->statnum == STAT_SO_SHOOT_POINT)
{
// match when firing
if (SP_TAG2(sp))
if (SP_TAG2(actor))
{
DoMatchEverything(pp, SP_TAG2(sp), -1);
DoMatchEverything(pp, SP_TAG2(actor), -1);
if (TEST_BOOL1(sp))
{
SP_TAG2(sp) = 0;
SP_TAG2(actor) = 0;
}
}