- eliminated the remaining SP_* spritetype function variants.

This commit is contained in:
Christoph Oelckers 2021-12-25 01:20:36 +01:00
parent 8ffc87134d
commit 8a2908bc30
6 changed files with 62 additions and 81 deletions

View file

@ -2060,16 +2060,6 @@ inline int FacingRange(DSWActor* a1, DSWActor* a2, int range)
{
return (abs(getincangle(getangle(a1->spr.pos.X - a2->spr.pos.X, a1->spr.pos.Y - a2->spr.pos.Y), a2->spr.ang)) < (range));
}
inline uint8_t& SP_TAG3(spritetype* s) { return s->clipdist; }
inline int16_t& SP_TAG4(spritetype* s) { return s->ang; }
inline int16_t& SP_TAG5(spritetype* s) { return s->xvel; }
inline int16_t& SP_TAG6(spritetype* s) { return s->yvel; }
inline uint8_t& SP_TAG7(spritetype* s) { return MSB_VAR(s->zvel); }
inline uint8_t& SP_TAG8(spritetype* s) { return LSB_VAR(s->zvel); }
inline uint8_t& SP_TAG9(spritetype* s) { return MSB_VAR(s->owner); }
inline uint8_t& SP_TAG10(spritetype* s) { return LSB_VAR(s->owner); }
inline void SET_BOOL1(DSWActor* sp) { sp->spr.extra |= SPRX_BOOL1; }
inline void SET_BOOL2(DSWActor* sp) { sp->spr.extra |= SPRX_BOOL2; }
inline void SET_BOOL3(DSWActor* sp) { sp->spr.extra |= SPRX_BOOL3; }

View file

@ -246,7 +246,7 @@ void SpikeAlign(DSWActor* actor)
SPRITEp sp = &actor->s();
// either work on single sector or all tagged in SOBJ
if ((int8_t)SP_TAG7(sp) < 0)
if ((int8_t)SP_TAG7(actor) < 0)
{
if (TEST(actor->spr.cstat, CSTAT_SPRITE_YFLIP))
alignceilslope(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, u->zclip);
@ -256,9 +256,9 @@ void SpikeAlign(DSWActor* actor)
else
{
if (TEST(actor->spr.cstat, CSTAT_SPRITE_YFLIP))
SOBJ_AlignCeilingToPoint(&SectorObject[SP_TAG7(sp)], actor->spr.pos.X, actor->spr.pos.Y, u->zclip);
SOBJ_AlignCeilingToPoint(&SectorObject[SP_TAG7(actor)], actor->spr.pos.X, actor->spr.pos.Y, u->zclip);
else
SOBJ_AlignFloorToPoint(&SectorObject[SP_TAG7(sp)], actor->spr.pos.X, actor->spr.pos.Y, u->zclip);
SOBJ_AlignFloorToPoint(&SectorObject[SP_TAG7(actor)], actor->spr.pos.X, actor->spr.pos.Y, u->zclip);
}
}

View file

@ -3522,15 +3522,15 @@ void SetupItemForJump(DSWActor* spawner, DSWActor* actor)
auto sip = &spawner->s();
// setup item for jumping
if (SP_TAG7(sip))
if (SP_TAG7(spawner))
{
change_actor_stat(actor, STAT_SKIP4);
u->ceiling_dist = Z(6);
u->floor_dist = Z(0);
u->Counter = 0;
actor->spr.xvel = (int)SP_TAG7(sip)<<2;
actor->spr.zvel = -(((int)SP_TAG8(sip))<<5);
actor->spr.xvel = (int)SP_TAG7(spawner)<<2;
actor->spr.zvel = -(((int)SP_TAG8(spawner))<<5);
u->xchange = MOVEx(actor->spr.xvel, actor->spr.ang);
u->ychange = MOVEy(actor->spr.xvel, actor->spr.ang);
@ -3835,7 +3835,7 @@ int SpawnItemsMatch(short match)
if (SP_TAG2(itActor) != match)
continue;
switch (SP_TAG3(sip))
switch (SP_TAG3(itActor))
{
case 90:
spawnedActor = BunnyHatch2(itActor);
@ -4253,7 +4253,7 @@ int SpawnItemsMatch(short match)
if (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS)
break;
num = SP_TAG3(sip) - 1;
num = SP_TAG3(itActor) - 1;
if (!ItemSpotClear(itActor, STAT_ITEM, s_Key[num]->Pic))
break;
@ -6489,8 +6489,7 @@ void MissileWarpType(DSWActor* actor, DSWActor* act_warp)
void ActorWarpType(DSWActor* actor, DSWActor* act_warp)
{
auto sp_warp = &act_warp->s();
switch (SP_TAG3(sp_warp))
switch (SP_TAG3(act_warp))
{
case 1:
break;

View file

@ -1085,10 +1085,10 @@ void SetupSectorObject(sectortype* sectp, short tag)
switch (sp->hitag)
{
case SO_SCALE_XY_MULT:
if (SP_TAG5(sp))
sop->scale_x_mult = SP_TAG5(sp);
if (SP_TAG6(sp))
sop->scale_y_mult = SP_TAG6(sp);
if (SP_TAG5(actor))
sop->scale_x_mult = SP_TAG5(actor);
if (SP_TAG6(actor))
sop->scale_y_mult = SP_TAG6(actor);
KillActor(actor);
break;
@ -1101,33 +1101,33 @@ void SetupSectorObject(sectortype* sectp, short tag)
sop->scale_point_speed[j] = SP_TAG2(actor);
}
if (SP_TAG4(sp))
sop->scale_point_rand_freq = (uint8_t)SP_TAG4(sp);
if (SP_TAG4(actor))
sop->scale_point_rand_freq = (uint8_t)SP_TAG4(actor);
else
sop->scale_point_rand_freq = 64;
sop->scale_point_dist_min = -SP_TAG5(sp);
sop->scale_point_dist_max = SP_TAG6(sp);
sop->scale_point_dist_min = -SP_TAG5(actor);
sop->scale_point_dist_max = SP_TAG6(actor);
KillActor(actor);
break;
case SO_SCALE_INFO:
SET(sop->flags, SOBJ_DYNAMIC);
sop->scale_speed = SP_TAG2(actor);
sop->scale_dist_min = -SP_TAG5(sp);
sop->scale_dist_max = SP_TAG6(sp);
sop->scale_dist_min = -SP_TAG5(actor);
sop->scale_dist_max = SP_TAG6(actor);
sop->scale_type = SP_TAG4(sp);
sop->scale_active_type = SP_TAG7(sp);
sop->scale_type = SP_TAG4(actor);
sop->scale_active_type = SP_TAG7(actor);
if (SP_TAG8(sp))
sop->scale_rand_freq = (uint8_t)SP_TAG8(sp);
if (SP_TAG8(actor))
sop->scale_rand_freq = (uint8_t)SP_TAG8(actor);
else
sop->scale_rand_freq = 64>>3;
if (SP_TAG3(sp) == 0)
if (SP_TAG3(actor) == 0)
sop->scale_dist = sop->scale_dist_min;
else if (SP_TAG3(sp) == 1)
else if (SP_TAG3(actor) == 1)
sop->scale_dist = sop->scale_dist_max;
KillActor(actor);
@ -1199,8 +1199,8 @@ void SetupSectorObject(sectortype* sectp, short tag)
break;
case SO_MAX_DAMAGE:
u->MaxHealth = SP_TAG2(actor);
if (SP_TAG5(sp) != 0)
sop->max_damage = SP_TAG5(sp);
if (SP_TAG5(actor) != 0)
sop->max_damage = SP_TAG5(actor);
else
sop->max_damage = u->MaxHealth;
@ -2189,7 +2189,7 @@ void CallbackSOsink(ANIMp ap, void *data)
continue;
// move sprite WAY down in water
ndx = AnimSet(ANIM_Userz, 0, actor, -u->sz - GetSpriteSizeZ(sp) - Z(100), ap->vel>>8);
ndx = AnimSet(ANIM_Userz, 0, actor, -u->sz - ActorSizeZ(actor) - Z(100), ap->vel>>8);
AnimSetVelAdj(ndx, ap->vel_adj);
}
@ -2860,12 +2860,10 @@ void DoAutoTurretObject(SECTOR_OBJECTp sop)
DSWActor* sActor = sop->so_actors[i];
if (!sActor) continue;
auto shootp = &sActor->s();
if (shootp->statnum == STAT_SO_SHOOT_POINT)
if (sActor->spr.statnum == STAT_SO_SHOOT_POINT)
{
if (SP_TAG5(shootp))
u->Counter = SP_TAG5(shootp);
if (SP_TAG5(sActor))
u->Counter = SP_TAG5(sActor);
else
u->Counter = 12;
InitTurretMgun(sop);
@ -3194,8 +3192,8 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
sp->ang = tpoint->ang;
z[0] = sp->pos.Z - GetSpriteSizeZ(sp) + Z(5);
z[1] = sp->pos.Z - DIV2(GetSpriteSizeZ(sp));
z[0] = sp->pos.Z - ActorSizeZ(actor) + Z(5);
z[1] = sp->pos.Z - DIV2(ActorSizeZ(actor));
for (i = 0; i < (int)SIZ(z); i++)
{
@ -3418,7 +3416,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
// Get the z height to climb
//
neartag({ sp->pos.X, sp->pos.Y, GetSpriteZOfTop(sp) - DIV2(GetSpriteSizeZ(sp)) }, sp->sector(), sp->ang, near, 600, NTAG_SEARCH_LO_HI);
neartag({ sp->pos.X, sp->pos.Y, ActorZOfTop(actor) - (ActorSizeZ(actor) >> 1) }, sp->sector(), sp->ang, near, 600, NTAG_SEARCH_LO_HI);
if (near.hitWall == nullptr)
{
@ -3447,7 +3445,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
//
SET(sp->cstat, CSTAT_SPRITE_YCENTER);
bos_z = GetSpriteZOfBottom(sp);
bos_z = ActorZOfBottom(actor);
if (bos_z > u->loz)
{
u->sy = (bos_z - sp->pos.Z);
@ -3602,7 +3600,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
if (TEST(u->Flags, SPR_CLIMBING))
{
if (GetSpriteZOfTop(sp) + (GetSpriteSizeZ(sp) >> 2) < u->sz)
if (ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2) < u->sz)
{
RESET(u->Flags, SPR_CLIMBING);

View file

@ -40,8 +40,8 @@ BEGIN_SW_NS
extern short NormalVisibility; // player.c
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))
#define VIS_VisDir(actor) (SP_TAG3(actor))
#define VIS_VisGoal(actor) (SP_TAG4(actor))
void ProcessVisOn(void)
{
@ -52,15 +52,15 @@ void ProcessVisOn(void)
{
sp = &actor->s();
if (VIS_VisDir(sp))
if (VIS_VisDir(actor))
{
// get brighter
VIS_VisCur(actor) >>= 1;
//VIS_VisCur(actor) -= 16;
if (VIS_VisCur(actor) <= VIS_VisGoal(sp))
if (VIS_VisCur(actor) <= VIS_VisGoal(actor))
{
VIS_VisCur(actor) = VIS_VisGoal(sp);
VIS_VisDir(sp) ^= 1;
VIS_VisCur(actor) = VIS_VisGoal(actor);
VIS_VisDir(actor) ^= 1;
}
}
else
@ -179,9 +179,9 @@ void SpawnVis(DSWActor* parentActor, sectortype* sect, int x, int y, int z, int
actorNew->spr.cstat = 0;
actorNew->spr.extra = 0;
VIS_VisDir(&actorNew->spr) = 1;
VIS_VisDir(actorNew) = 1;
VIS_VisCur(actorNew) = NormalVisibility;
VIS_VisGoal(&actorNew->spr) = amt;
VIS_VisGoal(actorNew) = amt;
}
END_SW_NS

View file

@ -2636,8 +2636,6 @@ STATE s_PaperShrapC[] =
bool MissileHitMatch(DSWActor* weapActor, int WeaponNum, DSWActor* hitActor)
{
SPRITEp hsp = &hitActor->s();
if (WeaponNum <= -1)
{
ASSERT(weapActor != nullptr);
@ -2645,11 +2643,11 @@ bool MissileHitMatch(DSWActor* weapActor, int WeaponNum, DSWActor* hitActor)
WeaponNum = wu->WeaponNum;
// can be hit by SO only
if (SP_TAG7(hsp) == 4)
if (SP_TAG7(hitActor) == 4)
{
if (TEST(wu->Flags2, SPR2_SO_MISSILE))
{
DoMatchEverything(nullptr, hsp->hitag, -1);
DoMatchEverything(nullptr, hitActor->spr.hitag, -1);
return true;
}
else
@ -2659,7 +2657,7 @@ bool MissileHitMatch(DSWActor* weapActor, int WeaponNum, DSWActor* hitActor)
}
}
if (SP_TAG7(hsp) == 0)
if (SP_TAG7(hitActor) == 0)
{
switch (WeaponNum)
{
@ -2667,11 +2665,11 @@ bool MissileHitMatch(DSWActor* weapActor, int WeaponNum, DSWActor* hitActor)
case WPN_MICRO:
case WPN_NAPALM:
case WPN_ROCKET:
DoMatchEverything(nullptr, hsp->hitag, -1);
DoMatchEverything(nullptr, hitActor->spr.hitag, -1);
return true;
}
}
else if (SP_TAG7(hsp) == 1)
else if (SP_TAG7(hitActor) == 1)
{
switch (WeaponNum)
{
@ -2680,11 +2678,11 @@ bool MissileHitMatch(DSWActor* weapActor, int WeaponNum, DSWActor* hitActor)
case WPN_HOTHEAD:
case WPN_NAPALM:
case WPN_ROCKET:
DoMatchEverything(nullptr, hsp->hitag, -1);
DoMatchEverything(nullptr, hitActor->spr.hitag, -1);
return true;
}
}
else if (SP_TAG7(hsp) == 2)
else if (SP_TAG7(hitActor) == 2)
{
switch (WeaponNum)
{
@ -2695,11 +2693,11 @@ bool MissileHitMatch(DSWActor* weapActor, int WeaponNum, DSWActor* hitActor)
case WPN_ROCKET:
case WPN_UZI:
case WPN_SHOTGUN:
DoMatchEverything(nullptr, hsp->hitag, -1);
DoMatchEverything(nullptr, hitActor->spr.hitag, -1);
return true;
}
}
else if (SP_TAG7(hsp) == 3)
else if (SP_TAG7(hitActor) == 3)
{
switch (WeaponNum)
{
@ -2713,7 +2711,7 @@ bool MissileHitMatch(DSWActor* weapActor, int WeaponNum, DSWActor* hitActor)
case WPN_ROCKET:
case WPN_UZI:
case WPN_SHOTGUN:
DoMatchEverything(nullptr, hsp->hitag, -1);
DoMatchEverything(nullptr, hitActor->spr.hitag, -1);
return true;
}
}
@ -2750,7 +2748,6 @@ int DoLavaErupt(DSWActor* actor)
USER* u = actor->u();
short i,pnum;
PLAYERp pp;
SPRITEp tsp;
bool found = false;
if (TEST_BOOL1(actor))
@ -2763,9 +2760,7 @@ int DoLavaErupt(DSWActor* actor)
SWSectIterator it(pp->cursector);
while (auto itActor = it.Next())
{
tsp = &itActor->s();
if (tsp->statnum == STAT_TRIGGER && SP_TAG7(tsp) == 0 && SP_TAG5(tsp) == 1)
if (itActor->spr.statnum == STAT_TRIGGER && SP_TAG7(itActor) == 0 && SP_TAG5(itActor) == 1)
{
found = true;
break;
@ -3146,7 +3141,6 @@ int SpawnShrap(DSWActor* parentActor, DSWActor* secondaryActor, int means, BREAK
int hz[3];
short dang = 0;
//SHRAPp p = StdShrap;
SHRAPp p = SmallGore;
short shrap_shade = -15;
short shrap_xsize = 48, shrap_ysize = 48;
@ -3187,7 +3181,7 @@ int SpawnShrap(DSWActor* parentActor, DSWActor* secondaryActor, int means, BREAK
if (!parentActor->hasU())
{
// Jump to shrap type
shrap_type = SP_TAG8(parent);
shrap_type = SP_TAG8(parentActor);
goto UserShrap;
}
else
@ -3209,17 +3203,17 @@ int SpawnShrap(DSWActor* parentActor, DSWActor* secondaryActor, int means, BREAK
case SPAWN_SPOT:
{
if (pu->LastDamage)
shrap_type = SP_TAG3(parent);
shrap_type = SP_TAG3(parentActor);
else
shrap_type = SP_TAG6(parent);
shrap_type = SP_TAG6(parentActor);
UserShrap:
shrap_delta_size = (int8_t)SP_TAG10(parent);
shrap_rand_zamt = SP_TAG9(parent);
shrap_delta_size = (int8_t)SP_TAG10(parentActor);
shrap_rand_zamt = SP_TAG9(parentActor);
// Hey, better limit this in case mappers go crazy, like I did. :)
// Kills frame rate!
shrap_amt = SP_TAG8(parent);
shrap_amt = SP_TAG8(parentActor);
if (shrap_amt > 5)
shrap_amt = 5;
@ -8417,7 +8411,7 @@ int DoGrenade(DSWActor* actor)
// special case so grenade can ring gong
if (hsp->lotag == TAG_SPRITE_HIT_MATCH)
{
if (TEST(SP_TAG8(hsp), BIT(3)))
if (TEST(SP_TAG8(hitActor), BIT(3)))
DoMatchEverything(nullptr, hsp->hitag, -1);
}