- added isEffector inline and exported NATURALLIGHTNING which got a bit in the way.

This commit is contained in:
Christoph Oelckers 2022-12-01 20:54:41 +01:00
parent be6ead173a
commit 9ad8f67ce9
18 changed files with 48 additions and 30 deletions

View file

@ -23,6 +23,7 @@ xx(DukeGenericDestructible)
xx(DukeGlassPieces)
xx(DukeGlassPieces1)
xx(DukeGlassPieces2)
xx(DukeNaturalLightning)
xx(spawnstate)
xx(brokenstate)

View file

@ -1413,7 +1413,7 @@ static void handle_se28(DDukeActor* actor)
DukeStatIterator it(STAT_DEFAULT);
while (auto act2 = it.Next())
{
if (act2->spr.picnum == NATURALLIGHTNING && act2->spr.hitag == actor->spr.hitag)
if (act2->GetClass()->TypeName == NAME_DukeNaturalLightning && act2->spr.hitag == actor->spr.hitag)
act2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
}
}
@ -1430,7 +1430,7 @@ static void handle_se28(DDukeActor* actor)
DukeStatIterator it(STAT_DEFAULT);
while (auto act2 = it.Next())
{
if (act2->spr.picnum == NATURALLIGHTNING && act2->spr.hitag == actor->spr.hitag)
if (act2->GetClass()->TypeName == NAME_DukeNaturalLightning && act2->spr.hitag == actor->spr.hitag)
{
if (rnd(32) && (actor->temp_data[2] & 1))
{

View file

@ -1540,7 +1540,7 @@ void handle_se06_r(DDukeActor *actor)
}
if (!hulkspawn)
{
ns = CreateActor(actor->sector(), DVector3(actor->spr.pos.XY(), actor->sector()->ceilingz + 466.5), 3677, -8, DVector2(0.25, 0.25), nullAngle, 0., 0., actor, 5);
ns = CreateActor(actor->sector(), DVector3(actor->spr.pos.XY(), actor->sector()->ceilingz + 466.5), UFOLIGHT, -8, DVector2(0.25, 0.25), nullAngle, 0., 0., actor, 5);
if (ns)
{
ns->spr.cstat = CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT;

View file

@ -109,9 +109,8 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
h = static_cast<DDukeActor*>(t->ownerActor);
auto OwnerAc = h->GetOwner();
switch (h->spr.picnum)
if (iseffector(h))
{
case SECTOREFFECTOR:
if (t->lotag == SE_27_DEMO_CAM && ud.recstat == 1)
{
t->picnum = 11 + ((PlayClock >> 3) & 1);
@ -120,12 +119,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
else
t->scale = DVector2(0, 0);
break;
case NATURALLIGHTNING:
t->shade = -127;
break;
default:
break;
}
if (t->statnum == 99) continue;

View file

@ -44,6 +44,12 @@ inline int islocator(DDukeActor* actor)
return actor->GetClass()->TypeName == NAME_DukeLocator;
}
inline int iseffector(DDukeActor* actor)
{
return actor->spr.picnum == SECTOREFFECTOR;
}
inline int badguypic(int const tileNum)
{
return ((gs.actorinfo[tileNum].flags & (SFLAG_INTERNAL_BADGUY | SFLAG_BADGUY)) != 0);

View file

@ -1052,6 +1052,7 @@ y(RRTILE3653, 3653)
y(RRTILE3668, 3668)
y(RRTILE3671, 3671)
y(RRTILE3673, 3673)
x(UFOLIGHT, 3677)
y(RRTILE3684, 3684)
y(RRTILE3708, 3708)
y(RRTILE3714, 3714)

View file

@ -111,7 +111,7 @@ static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int a
DukeStatIterator its(STAT_EFFECTOR);
while (auto effector = its.Next())
{
if (effector->sector() == hit.hitSector && effector->spr.picnum == SECTOREFFECTOR && effector->GetOwner()
if (effector->sector() == hit.hitSector && iseffector(effector) && effector->GetOwner()
&& effector->spr.lotag == SE_7_TELEPORT)
{
DVector3 npos;
@ -260,7 +260,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
while (auto effector = its.Next())
{
auto Owner = effector->GetOwner();
if (effector->sector() == hit.hitSector && effector->spr.picnum == SECTOREFFECTOR && Owner && effector->spr.lotag == SE_7_TELEPORT)
if (effector->sector() == hit.hitSector && iseffector(effector) && Owner && effector->spr.lotag == SE_7_TELEPORT)
{
DVector3 npos;
npos.XY() = hit.hitpos.XY() + (Owner->spr.pos.XY() - effector->spr.pos.XY());

View file

@ -46,7 +46,7 @@ int which_palookup = 9;
void premapcontroller(DDukeActor* ac)
{
CallStaticSetup(ac);
if (ac->spr.picnum == SECTOREFFECTOR)
if (iseffector(ac))
{
ac->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN | CSTAT_SPRITE_ALIGNMENT_MASK);
}
@ -824,7 +824,7 @@ static void SpawnPortals()
DukeStatIterator it(STAT_RAROR);
while (auto act = it.Next())
{
if (act->spr.picnum == SECTOREFFECTOR && act->spr.lotag == tag)
if (iseffector(act) && act->spr.lotag == tag)
{
int hitag = act->spr.hitag;
if (processedTags.Find(hitag) == processedTags.Size())
@ -832,7 +832,7 @@ static void SpawnPortals()
DukeStatIterator it2(STAT_RAROR);
while (auto act2 = it2.Next())
{
if (act2->spr.picnum == SECTOREFFECTOR && act2->spr.lotag == tag + 1 && act2->spr.hitag == hitag)
if (iseffector(act2) && act2->spr.lotag == tag + 1 && act2->spr.hitag == hitag)
{
if (processedTags.Find(act->spr.hitag) == processedTags.Size())
{

View file

@ -290,7 +290,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
{
if (actor->exists())
{
if (actor->spr.picnum == SECTOREFFECTOR && actor->spr.lotag == SE_14_SUBWAY_CAR)
if (iseffector(actor) && actor->spr.lotag == SE_14_SUBWAY_CAR)
continue;
spriteinit_d(actor, actors);
}
@ -300,7 +300,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
{
if (actor->exists())
{
if (actor->spr.picnum == SECTOREFFECTOR && actor->spr.lotag == SE_14_SUBWAY_CAR)
if (iseffector(actor) && actor->spr.lotag == SE_14_SUBWAY_CAR)
spriteinit_d(actor, actors);
}
}

View file

@ -583,7 +583,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
{
if (actor->exists())
{
if (actor->spr.picnum == SECTOREFFECTOR && actor->spr.lotag == SE_14_SUBWAY_CAR)
if (iseffector(actor) && actor->spr.lotag == SE_14_SUBWAY_CAR)
continue;
spriteinit_r(actor, actors);
}
@ -593,7 +593,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
{
if (actor->exists())
{
if (actor->spr.picnum == SECTOREFFECTOR && actor->spr.lotag == SE_14_SUBWAY_CAR)
if (iseffector(actor) && actor->spr.lotag == SE_14_SUBWAY_CAR)
spriteinit_r(actor, actors);
if (actor->spr.picnum == RRTILE19)
actor->Destroy();

View file

@ -648,7 +648,7 @@ static void handle_st15(sectortype* sptr, DDukeActor* actor)
DDukeActor* a2;
while ((a2 = it.Next()))
{
if (a2->spr.picnum == SECTOREFFECTOR && a2->spr.lotag == ST_17_PLATFORM_UP) break;
if (iseffector(a2) && a2->spr.lotag == ST_17_PLATFORM_UP) break;
}
if (!a2) return;
@ -1255,7 +1255,7 @@ void operateforcefields_common(DDukeActor *effector, int low, const std::initial
{
wal->cstat = 0;
if (effector && effector->spr.picnum == SECTOREFFECTOR && effector->spr.lotag == 30)
if (effector && iseffector(effector) && effector->spr.lotag == 30)
wal->lotag = 0;
}
else

View file

@ -898,7 +898,7 @@ bool checkhitceiling_d(sectortype* sectp)
DukeSectIterator it(sectp);
while (auto act = it.Next())
{
if (act->spr.picnum == SECTOREFFECTOR && act->spr.lotag == SE_12_LIGHT_SWITCH)
if (iseffector(act) && act->spr.lotag == SE_12_LIGHT_SWITCH)
{
DukeStatIterator it1(STAT_EFFECTOR);
while (auto act2 = it1.Next())

View file

@ -1264,7 +1264,7 @@ bool checkhitceiling_r(sectortype* sectp)
DukeSectIterator it(sectp);
while (auto act1 = it.Next())
{
if (act1->spr.picnum == SECTOREFFECTOR && (act1->spr.lotag == SE_12_LIGHT_SWITCH || (isRRRA() && (act1->spr.lotag == 47 || act1->spr.lotag == 48))))
if (iseffector(act1) && (act1->spr.lotag == SE_12_LIGHT_SWITCH || (isRRRA() && (act1->spr.lotag == 47 || act1->spr.lotag == 48))))
{
DukeStatIterator itr(STAT_EFFECTOR);
while (auto act2 = itr.Next())

View file

@ -455,7 +455,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
for(auto act2 : *actors)
{
if (act2->spr.statnum < MAXSTATUS && act2->spr.picnum == SECTOREFFECTOR && (act2->spr.lotag == SE_7_TELEPORT || act2->spr.lotag == SE_23_ONE_WAY_TELEPORT) &&
if (act2->spr.statnum < MAXSTATUS && iseffector(act2) && (act2->spr.lotag == SE_7_TELEPORT || act2->spr.lotag == SE_23_ONE_WAY_TELEPORT) &&
actor != act2 && act2->spr.hitag == actor->spr.hitag)
{
actor->SetOwner(act2);
@ -767,7 +767,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
if (actors) for (auto act2 : *actors)
{
if (act2->spr.statnum < MAXSTATUS)
if (act2->spr.picnum == SECTOREFFECTOR &&
if (iseffector(act2) &&
act2->spr.lotag == SE_1_PIVOT &&
act2->spr.hitag == actor->spr.hitag)
{

View file

@ -151,10 +151,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.scale = DVector2(0, 0);
ChangeActorStat(act, STAT_MISC);
break;
case NATURALLIGHTNING:
act->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
break;
case TRANSPORTERSTAR:
case TRANSPORTERBEAM:
spawntransporter(actj, act, act->spr.picnum == TRANSPORTERBEAM);

View file

@ -11,6 +11,7 @@ spawnclasses
8 = DukeMasterSwitch
9 = DukeRespawnController
10 = DukeGPSpeed
4890 = DukeNaturalLightning
1221 = DukeCranePole
1222 = DukeCrane

View file

@ -59,6 +59,7 @@ version "4.10"
#include "zscript/games/duke/actors/respawnmarker.zs"
#include "zscript/games/duke/actors/genericdestructible.zs"
#include "zscript/games/duke/actors/frameeffect.zs"
#include "zscript/games/duke/actors/naturallightning.zs"
#include "zscript/games/duke/actors/projectiles.zs"
#include "zscript/games/duke/actors/rat.zs"

View file

@ -0,0 +1,19 @@
class DukeNaturalLightning : DukeActor
{
default
{
pic "NATURALLIGHTNING";
}
override void Initialize()
{
self.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
self.cstat |= CSTAT_SPRITE_INVISIBLE;
}
override bool Animate(tspritetype t)
{
t.shade = -127;
return true;
}
}