- partial conversion of SP_TAG3 to actors.

This commit is contained in:
Christoph Oelckers 2021-12-24 15:21:44 +01:00
parent 627a69570f
commit 06d33b8276
8 changed files with 52 additions and 54 deletions

View file

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

View file

@ -1374,7 +1374,7 @@ void UpdateWallPortalState()
while (auto actor = it.Next())
{
auto sp = &actor->s();
if (SP_TAG3(sp) == 0)
if (SP_TAG3(actor) == 0)
{
// back up ceilingpicnum and ceilingstat
SP_TAG5(sp) = sp->sector()->ceilingpicnum;
@ -1383,7 +1383,7 @@ void UpdateWallPortalState()
SET(sp->sector()->ceilingstat, ESectorFlags::FromInt(SP_TAG6(sp)));
RESET(sp->sector()->ceilingstat, CSTAT_SECTOR_SKY);
}
else if (SP_TAG3(sp) == 1)
else if (SP_TAG3(actor) == 1)
{
SP_TAG5(sp) = sp->sector()->floorpicnum;
sp->sector()->floorpicnum = SP_TAG2(actor);
@ -1401,7 +1401,7 @@ void RestorePortalState()
while (auto actor = it.Next())
{
auto sp = &actor->s();
if (SP_TAG3(sp) == 0)
if (SP_TAG3(actor) == 0)
{
// restore ceilingpicnum and ceilingstat
sp->sector()->ceilingpicnum = SP_TAG5(sp);
@ -1409,7 +1409,7 @@ void RestorePortalState()
//RESET(sp->sector()->ceilingstat, CEILING_STAT_TYPE_MASK);
RESET(sp->sector()->ceilingstat, CSTAT_SECTOR_SKY);
}
else if (SP_TAG3(sp) == 1)
else if (SP_TAG3(actor) == 1)
{
sp->sector()->floorpicnum = SP_TAG5(sp);
sp->sector()->floorstat = ESectorFlags::FromInt(SP_TAG4(sp));

View file

@ -109,7 +109,7 @@ void DiffuseLighting(DSWActor* actor)
if (LIGHT_Match(itActor) != LIGHT_Match(actor))
continue;
shade = sp->shade + ((LIGHT_DiffuseNum(dsp) + 1) * LIGHT_DiffuseMult(dsp));
shade = sp->shade + ((LIGHT_DiffuseNum(itActor) + 1) * LIGHT_DiffuseMult(dsp));
if (shade > LIGHT_MaxDark(sp))
shade = LIGHT_MaxDark(sp);
@ -136,7 +136,7 @@ void DoLightingMatch(short match, short state)
if (LIGHT_Match(itActor) != match)
continue;
switch (LIGHT_Type(sp))
switch (LIGHT_Type(itActor))
{
case LIGHT_CONSTANT:
@ -278,7 +278,7 @@ void DoLighting(void)
if (TEST_BOOL1(sp) == OFF)
continue;
switch (LIGHT_Type(sp))
switch (LIGHT_Type(itActor))
{
case LIGHT_CONSTANT:
break;

View file

@ -36,7 +36,7 @@ void DoLighting(void);
// Descriptive Light variables mapped from other variables
inline int LIGHT_Match(DSWActor* sp) { return SP_TAG2(sp); }
#define LIGHT_Type(sp) (SP_TAG3((sp)))
inline int LIGHT_Type(DSWActor* sp) { return SP_TAG3(sp); }
#define LIGHT_MaxTics(sp) (SP_TAG4((sp)))
inline int8_t LIGHT_MaxBright(spritetype* sp) { return int8_t(SP_TAG5(sp)); }
inline int8_t LIGHT_MaxDark(spritetype* sp) { return int8_t(SP_TAG6(sp)); }
@ -50,7 +50,7 @@ inline int8_t LIGHT_MaxDark(spritetype* sp) { return int8_t(SP_TAG6(sp)); }
#define LIGHT_CeilingShade(sp) ((sp)->yoffset)
#define LIGHT_Tics(sp) ((sp)->pos.Z)
#define LIGHT_DiffuseNum(sp) (SP_TAG3((sp)))
inline int LIGHT_DiffuseNum(DSWActor* sp) { return SP_TAG3(sp); }
#define LIGHT_DiffuseMult(sp) (SP_TAG4((sp)))
enum LightTypes {LIGHT_CONSTANT, LIGHT_FLICKER, LIGHT_FADE, LIGHT_FLICKER_ON, LIGHT_FADE_TO_ON_OFF};

View file

@ -134,10 +134,11 @@ short DoSOevent(short match, short state)
}
}
if (sop->match_event_actor == nullptr)
auto me_act = sop->match_event_actor;
if (me_act == nullptr)
continue;
me_sp = &sop->match_event_actor->s();
me_sp = &me_act->s();
// toggle
if (state == -1)
@ -156,12 +157,12 @@ short DoSOevent(short match, short state)
if (state == ON)
{
spin_adj = (int)SP_TAG3(me_sp);
spin_adj = (int)SP_TAG3(me_act);
vel_adj = SP_TAG7(me_sp);
}
else if (state == OFF)
{
spin_adj = -(int)SP_TAG3(me_sp);
spin_adj = -(int)SP_TAG3(me_act);
vel_adj = -SP_TAG7(me_sp);
}

View file

@ -1376,7 +1376,7 @@ void DoPlayerWarpTeleporter(PLAYERp pp)
}
sp_warp = &act_warp->s();
switch (SP_TAG3(sp_warp))
switch (SP_TAG3(act_warp))
{
case 1:
DoPlayerTeleportToOffset(pp);

View file

@ -38,7 +38,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
inline int16_t& QUAKE_Match(DSWActor* actor) { return SP_TAG2(actor); }
#define QUAKE_Zamt(sp) (SP_TAG3(sp))
inline uint8_t& QUAKE_Zamt(DSWActor* actor) { return SP_TAG3(actor); }
#define QUAKE_Radius(sp) (SP_TAG4(sp))
#define QUAKE_Duration(sp) (SP_TAG5(sp))
#define QUAKE_WaitSecs(sp) (SP_TAG6(sp))
@ -134,7 +134,6 @@ void ProcessQuakeSpot(void)
continue;
// spawn a quake if time is up
//QUAKE_WaitTics(sp) -= 4*synctics;
SET_SP_TAG13(sp, (QUAKE_WaitTics(sp)-4*synctics));
if ((int16_t)QUAKE_WaitTics(sp) < 0)
{
@ -211,7 +210,7 @@ void QuakeViewChange(PLAYERp pp, int *z_diff, int *x_diff, int *y_diff, short *a
if (save_dist > radius)
return;
*z_diff = Z(STD_RANDOM_RANGE(QUAKE_Zamt(sp)) - (QUAKE_Zamt(sp)/2));
*z_diff = Z(STD_RANDOM_RANGE(SP_TAG3(sp)) - (SP_TAG3(sp)/2));
ang_amt = QUAKE_AngAmt(sp) * 4L;
*ang_diff = STD_RANDOM_RANGE(ang_amt) - (ang_amt/2);
@ -247,7 +246,7 @@ void SpawnQuake(sectortype* sect, int x, int y, int z,
sp->extra = 0;
QUAKE_Match(actorNew) = -1;
QUAKE_Zamt(sp) = uint8_t(amt);
QUAKE_Zamt(actorNew) = uint8_t(amt);
QUAKE_Radius(sp) = radius/8;
QUAKE_Duration(sp) = tics;
QUAKE_AngAmt(sp) = 8;

View file

@ -2011,7 +2011,6 @@ void SpriteSetup(void)
case QUAKE_SPOT:
{
change_actor_stat(actor, STAT_QUAKE_SPOT);
//SP_TAG13(sp) = (SP_TAG6(sp)*10L) * 120L;
SET_SP_TAG13(sp, ((SP_TAG6(sp)*10L) * 120L));
break;
}
@ -2608,7 +2607,6 @@ void SpriteSetup(void)
}
case SOUND_SPOT:
//SP_TAG13(sp) = SP_TAG4(sp);
SET_SP_TAG13(sp, SP_TAG4(sp));
change_actor_stat(actor, STAT_SOUND_SPOT);
break;
@ -3600,17 +3598,17 @@ int ActorCoughItem(DSWActor* actor)
choose = RANDOM_P2(1024);
if (choose > 854)
SP_TAG3(np) = 91; // Match number
SP_TAG3(actorNew) = 91; // Match number
else if (choose > 684)
SP_TAG3(np) = 48; // Match number
SP_TAG3(actorNew) = 48; // Match number
else if (choose > 514)
SP_TAG3(np) = 58; // Match number
SP_TAG3(actorNew) = 58; // Match number
else if (choose > 344)
SP_TAG3(np) = 60; // Match number
SP_TAG3(actorNew) = 60; // Match number
else if (choose > 174)
SP_TAG3(np) = 62; // Match number
SP_TAG3(actorNew) = 62; // Match number
else
SP_TAG3(np) = 68; // Match number
SP_TAG3(actorNew) = 68; // Match number
// match
SP_TAG2(actorNew) = -1;
@ -3639,7 +3637,7 @@ int ActorCoughItem(DSWActor* actor)
// zvel
SP_TAG8(np) = 40;
SP_TAG3(np) = 69; // Match number
SP_TAG3(actorNew) = 69; // Match number
// match
SP_TAG2(actorNew) = -1;
@ -3668,7 +3666,7 @@ int ActorCoughItem(DSWActor* actor)
// zvel
SP_TAG8(np) = 40;
SP_TAG3(np) = 70; // Match number
SP_TAG3(actorNew) = 70; // Match number
// match
SP_TAG2(actorNew) = -1;
@ -3703,36 +3701,36 @@ int ActorCoughItem(DSWActor* actor)
switch (u->WeaponNum)
{
case WPN_UZI:
SP_TAG3(np) = 0;
SP_TAG3(actorNew) = 0;
break;
case WPN_SHOTGUN:
SP_TAG3(np) = 51;
SP_TAG3(actorNew) = 51;
break;
case WPN_STAR:
if (u->PlayerP->WpnAmmo[WPN_STAR] < 9)
break;
SP_TAG3(np) = 41;
SP_TAG3(actorNew) = 41;
break;
case WPN_MINE:
if (u->PlayerP->WpnAmmo[WPN_MINE] < 5)
break;
SP_TAG3(np) = 42;
SP_TAG3(actorNew) = 42;
break;
case WPN_MICRO:
case WPN_ROCKET:
SP_TAG3(np) = 43;
SP_TAG3(actorNew) = 43;
break;
case WPN_GRENADE:
SP_TAG3(np) = 45;
SP_TAG3(actorNew) = 45;
break;
case WPN_RAIL:
SP_TAG3(np) = 47;
SP_TAG3(actorNew) = 47;
break;
case WPN_HEART:
SP_TAG3(np) = 55;
SP_TAG3(actorNew) = 55;
break;
case WPN_HOTHEAD:
SP_TAG3(np) = 53;
SP_TAG3(actorNew) = 53;
break;
}
@ -3765,33 +3763,33 @@ int ActorCoughItem(DSWActor* actor)
if (u->spal == PAL_XLAT_LT_TAN)
{
SP_TAG3(np) = 44;
SP_TAG3(actorNew) = 44;
}
else if (u->spal == PAL_XLAT_LT_GREY)
{
SP_TAG3(np) = 46;
SP_TAG3(actorNew) = 46;
}
else if (u->spal == PALETTE_PLAYER5) // Green Ninja
{
if (RANDOM_P2(1024) < 700)
SP_TAG3(np) = 61;
SP_TAG3(actorNew) = 61;
else
SP_TAG3(np) = 60;
SP_TAG3(actorNew) = 60;
}
else if (u->spal == PALETTE_PLAYER3) // Red Ninja
{
// type
if (RANDOM_P2(1024) < 800)
SP_TAG3(np) = 68;
SP_TAG3(actorNew) = 68;
else
SP_TAG3(np) = 44;
SP_TAG3(actorNew) = 44;
}
else
{
if (RANDOM_P2(1024) < 512)
SP_TAG3(np) = 41;
SP_TAG3(actorNew) = 41;
else
SP_TAG3(np) = 68;
SP_TAG3(actorNew) = 68;
}
// match
@ -3824,30 +3822,30 @@ int ActorCoughItem(DSWActor* actor)
if (u->ID == PACHINKO1)
{
if (RANDOM_P2(1024) < 600)
SP_TAG3(np) = 64; // Small MedKit
SP_TAG3(actorNew) = 64; // Small MedKit
else
SP_TAG3(np) = 59; // Fortune Cookie
SP_TAG3(actorNew) = 59; // Fortune Cookie
}
else if (u->ID == PACHINKO2)
{
if (RANDOM_P2(1024) < 600)
SP_TAG3(np) = 52; // Lg Shot Shell
SP_TAG3(actorNew) = 52; // Lg Shot Shell
else
SP_TAG3(np) = 68; // Uzi clip
SP_TAG3(actorNew) = 68; // Uzi clip
}
else if (u->ID == PACHINKO3)
{
if (RANDOM_P2(1024) < 600)
SP_TAG3(np) = 57;
SP_TAG3(actorNew) = 57;
else
SP_TAG3(np) = 63;
SP_TAG3(actorNew) = 63;
}
else if (u->ID == PACHINKO4)
{
if (RANDOM_P2(1024) < 600)
SP_TAG3(np) = 60;
SP_TAG3(actorNew) = 60;
else
SP_TAG3(np) = 61;
SP_TAG3(actorNew) = 61;
}
// match