- use the actual actor flags.

Not fully working yet...
This commit is contained in:
Christoph Oelckers 2022-12-20 22:25:48 +01:00
parent 510afe16fb
commit ae4ef6401c
24 changed files with 133 additions and 141 deletions

View file

@ -46,15 +46,20 @@ struct SpawnRec
FSoundID breaksound;
int8_t fullbright, clipdist;
int16_t flags;
PClassActor* Class(int pn)
{
return cls;
}
};
using SpawnMap = TMap<int, SpawnRec>;
inline SpawnMap spawnMap;
inline PClassActor* GetSpawnType(int spawnnum)
{
auto info = spawnMap.CheckKey(spawnnum);
if (info)
{
return static_cast<PClassActor*>(info->cls);
}
return nullptr;
}
struct BreakWallRec
{
FTextureID brokentex;

View file

@ -51,6 +51,17 @@ xx(DukePlayerOnWater)
xx(RedneckBillyRay)
xx(RedneckBiker)
xx(RedneckCheerleader)
xx(DukeShotSpark)
xx(DukeJibs6)
xx(RedneckMotoHit)
xx(DukeFlamethrowerFlame)
xx(DukeShrinkSpark)
xx(DukeFirefly)
xx(DukeFireball)
xx(DukeBloodSplat3)
xx(DukeBloodSplat1)
xx(DukeBloodSplat2)
xx(DukeBloodSplat4)
xx(spawnstate)
xx(brokenstate)

View file

@ -397,7 +397,6 @@ DEFINE_PROPERTY(health, I, CoreActor)
//==========================================================================
DEFINE_PROPERTY(lookallarounddefault,0, DukeActor)
{
PROP_INT_PARM(i, 0);
if (!isRR()) defaults->flags1 |= SFLAG_LOOKALLAROUND; // feature comes from RR, but we want the option in Duke as well, so this fake property sets the default
else
{

View file

@ -61,7 +61,7 @@ double adjustfall(DDukeActor* actor, double c);
void TickActor(DDukeActor* self)
{
if (self->spr.statnum == STAT_ACTOR || actorflag(self, SFLAG3_FORCERUNCON))
if (self->spr.statnum == STAT_ACTOR || (self->flags3 & SFLAG3_FORCERUNCON))
{
double xx;
int p = findplayer(self, &xx);
@ -88,7 +88,7 @@ void TickActor(DDukeActor* self)
void respawnhitag(DDukeActor* actor)
{
if (actorflag(actor, SFLAG2_TRIGGERRESPAWN))
if (actor->flags2 & SFLAG2_TRIGGERRESPAWN)
{
if (actor->spr.yint) operaterespawns(actor->spr.yint);
}
@ -256,7 +256,7 @@ void clearcamera(player_struct* ps)
DukeStatIterator it(STAT_ACTOR);
while (auto k = it.Next())
{
if (actorflag(k, SFLAG2_CAMERA))
if (k->flags2 & SFLAG2_CAMERA)
k->spr.yint = 0;
}
}
@ -670,7 +670,7 @@ void tickstat(int stat, bool deleteinvalid)
DukeStatIterator iti(stat);
while (auto act = iti.Next())
{
if (actorflag(act, SFLAG2_DIENOW) || act->sector() == nullptr || (deleteinvalid && act->spr.scale.X == 0))
if ((act->flags2 & SFLAG2_DIENOW) || act->sector() == nullptr || (deleteinvalid && act->spr.scale.X == 0))
{
act->Destroy();
}
@ -912,7 +912,7 @@ void handle_se00(DDukeActor* actor)
DukeSectIterator itp(actor->sector());
while (auto act2 = itp.Next())
{
if (act2->spr.statnum != STAT_EFFECTOR && act2->spr.statnum != STAT_PROJECTILE && !actorflag(act2, SFLAG2_NOROTATEWITHSECTOR))
if (act2->spr.statnum != STAT_EFFECTOR && act2->spr.statnum != STAT_PROJECTILE && !(act2->flags2 & SFLAG2_NOROTATEWITHSECTOR))
{
if (act2->isPlayer() && act2->GetOwner())
{
@ -2228,7 +2228,7 @@ DDukeActor* ifhitsectors(sectortype* sect)
DukeStatIterator it(STAT_MISC);
while (auto a1 = it.Next())
{
if (actorflag(a1, SFLAG_TRIGGER_IFHITSECTOR) && sect == a1->sector())
if ((a1->flags1 & SFLAG_TRIGGER_IFHITSECTOR) && sect == a1->sector())
return a1;
}
return nullptr;
@ -2580,13 +2580,13 @@ void handle_se24(DDukeActor *actor, bool scroll, double mult)
case STAT_STANDABLE:
case STAT_ACTOR:
case STAT_DEFAULT:
if (actorflag(a2, SFLAG_SE24_REMOVE))
if (a2->flags1 & SFLAG_SE24_REMOVE)
{
a2->spr.scale = DVector2(0, 0);
continue;
}
if (actorflag(a2, SFLAG_SE24_NOCARRY) || wallswitchcheck(a2) || GetExtInfo(a2->spr.spritetexture()).switchindex > 0)
if ((a2->flags1 & SFLAG_SE24_NOCARRY) || wallswitchcheck(a2) || GetExtInfo(a2->spr.spritetexture()).switchindex > 0)
continue;
if (a2->spr.pos.Z > a2->floorz - 16)
@ -3062,7 +3062,7 @@ void getglobalz(DDukeActor* actor)
void makeitfall(DDukeActor* actor)
{
if (actorflag(actor, SFLAG3_NOGRAVITY)) return;
if (actor->flags3 & SFLAG3_NOGRAVITY) return;
double grav;
@ -3345,12 +3345,12 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
goto SKIPJIBS;
if (sphit)
{
spawnguts(actor, PClass::FindActor("DukeJibs6"), 5);
spawnguts(actor, PClass::FindActor(NAME_DukeJibs6), 5);
S_PlayActorSound(squished, actor);
}
else
{
spawnguts(actor, PClass::FindActor("DukeJibs6"), 15);
spawnguts(actor, PClass::FindActor(NAME_DukeJibs6), 15);
S_PlayActorSound(squished, actor);
spawn(actor, BLOODPOOL);
}
@ -3446,8 +3446,8 @@ void movefta(void)
// The second updatesector call here used px and py again and was redundant as coded.
// SFLAG_LOOKALLAROUND is set for all actors in Duke.
if (act->spr.pal == 33 || actorflag(act, SFLAG_LOOKALLAROUND) ||
(actorflag(act, SFLAG_LOOKALLAROUNDWITHPAL8) && act->spr.pal == 8) ||
if (act->spr.pal == 33 || (act->flags1 & SFLAG_LOOKALLAROUND) ||
((act->flags1 & SFLAG_LOOKALLAROUNDWITHPAL8) && act->spr.pal == 8) ||
(act->spr.Angles.Yaw.Cos() * (px - sx) + act->spr.Angles.Yaw.Sin() * (py - sy) >= 0))
{
double r1 = zrand(32);
@ -3465,7 +3465,7 @@ void movefta(void)
if (canseeme)
{
if (actorflag(act, SFLAG_MOVEFTA_MAKESTANDABLE))
if ((act->flags1 & SFLAG_MOVEFTA_MAKESTANDABLE))
{
if (act->sector()->ceilingstat & CSTAT_SECTOR_SKY)
act->spr.shade = act->sector()->ceilingshade;
@ -3491,7 +3491,7 @@ void movefta(void)
else act->spr.shade = act->sector()->floorshade;
// wakeup is an RR feature, this flag will allow it to use in Duke, too.
if (actorflag(act, SFLAG_MOVEFTA_WAKEUPCHECK))
if ((act->flags1 & SFLAG_MOVEFTA_WAKEUPCHECK))
{
if (wakeup(act, p))
{

View file

@ -213,7 +213,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
}
}
if (x == 0 || x >= 5 || actorflag(act2, SFLAG_HITRADIUS_FLAG1))
if (x == 0 || x >= 5 || (act2->flags1 & SFLAG_HITRADIUS_FLAG1))
{
if (actor->spr.picnum != DTILE_SHRINKSPARK || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))
if ((actor->spr.pos - act2->spr.pos).Length() < radius)
@ -223,7 +223,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
fi.checkhitsprite(act2, actor);
}
}
else if (act2->spr.extra >= 0 && act2 != actor && (actorflag(act2, SFLAG_HITRADIUS_FLAG2) || badguy(act2) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)))
else if (act2->spr.extra >= 0 && act2 != actor && ((act2->flags1 & SFLAG_HITRADIUS_FLAG2) || badguy(act2) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)))
{
if (actor->spr.picnum == DTILE_SHRINKSPARK && act2->spr.picnum != DTILE_SHARK && (act2 == Owner || act2->spr.scale.X < 0.375))
{
@ -281,13 +281,13 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
act2->hitextra = hp1 + (krand() % (hp2 - hp1));
}
if (!actorflag(act2, SFLAG2_NORADIUSPUSH) && !bossguy(act2))
if (!(act2->flags2 & SFLAG2_NORADIUSPUSH) && !bossguy(act2))
{
if (act2->vel.X < 0) act2->vel.X = 0;
act2->vel.X += ( (actor->spr.extra / 4.));
}
if (actorflag(act2, SFLAG_HITRADIUSCHECK))
if ((act2->flags1 & SFLAG_HITRADIUSCHECK))
fi.checkhitsprite(act2, actor);
}
else if (actor->spr.extra == 0) act2->hitextra = 0;
@ -352,7 +352,7 @@ int movesprite_ex_d(DDukeActor* actor, const DVector3& change, unsigned int clip
double clipdist;
if (actor->spr.picnum == DTILE_LIZMAN)
clipdist = 18.25;
else if (actorflag(actor, SFLAG_BADGUY))
else if ((actor->flags1 & SFLAG_BADGUY))
clipdist = actor->clipdist;
else
clipdist = 12;
@ -488,7 +488,7 @@ int ifhitbyweapon_d(DDukeActor *actor)
actor->spr.extra -= actor->hitextra;
auto Owner = actor->GetOwner();
if (!actorflag(actor, SFLAG2_IGNOREHITOWNER) && Owner && Owner->spr.statnum < MAXSTATUS)
if (!(actor->flags2 & SFLAG2_IGNOREHITOWNER) && Owner && Owner->spr.statnum < MAXSTATUS)
actor->SetOwner(hitowner);
}
@ -696,13 +696,13 @@ void movetransports_d(void)
break;
case STAT_ACTOR:
if (actorflag(act, SFLAG3_DONTDIVEALIVE) && act2->spr.extra > 0) continue;
if ((act->flags3 & SFLAG3_DONTDIVEALIVE) && act2->spr.extra > 0) continue;
[[fallthrough]];
case STAT_PROJECTILE:
case STAT_MISC:
case STAT_FALLER:
case STAT_DUMMYPLAYER:
if (actorflag(act, SFLAG2_DONTDIVE)) continue;
if ((act->flags2 & SFLAG2_DONTDIVE)) continue;
ll = abs(act2->vel.Z);
@ -726,7 +726,7 @@ void movetransports_d(void)
if (warpspriteto)
{
if (actorflag(act2, SFLAG_NOTELEPORT)) continue;
if ((act2->flags1 & SFLAG_NOTELEPORT)) continue;
switch (act2->spr.picnum)
{
case DTILE_PLAYERONWATER:
@ -1309,7 +1309,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
ps[playernum].vel.XY() *= gs.playerfriction - 0.125;
}
}
else if (!actorflag(actor, SFLAG2_FLOATING))
else if (!(actor->flags2 & SFLAG2_FLOATING))
{
if (!*(moveptr + 1))
{

View file

@ -199,7 +199,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
DukeStatIterator it1(statlist[x]);
while (auto act2 = it1.Next())
{
if (x == 0 || x >= 5 || actorflag(act2, SFLAG_HITRADIUS_FLAG1))
if (x == 0 || x >= 5 || (act2->flags1 & SFLAG_HITRADIUS_FLAG1))
{
if (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)
if ((actor->spr.pos - act2->spr.pos).Length() < radius)
@ -210,7 +210,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
fi.checkhitsprite(act2, actor);
}
}
else if (act2->spr.extra >= 0 && act2 != actor && (actorflag(act2, SFLAG_HITRADIUS_FLAG2) || badguy(act2) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)))
else if (act2->spr.extra >= 0 && act2 != actor && ((act2->flags1 & SFLAG_HITRADIUS_FLAG2) || badguy(act2) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)))
{
if (actor->spr.picnum == RTILE_MORTER && act2 == Owner)
{
@ -255,13 +255,13 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
act2->hitextra = hp1 + (krand() % (hp2 - hp1));
}
if (!actorflag(act2, SFLAG2_NORADIUSPUSH) && !bossguy(act2))
if (!(act2->flags2 & SFLAG2_NORADIUSPUSH) && !bossguy(act2))
{
if (act2->vel.X < 0) act2->vel.X = 0;
act2->vel.X += ((actor->spr.extra / 4.));
}
if (actorflag(act2, SFLAG_HITRADIUSCHECK))
if ((act2->flags1 & SFLAG_HITRADIUSCHECK))
fi.checkhitsprite(act2, actor);
if (act2->spr.picnum != RTILE_RADIUSEXPLOSION &&
@ -423,7 +423,7 @@ int ifhitbyweapon_r(DDukeActor *actor)
actor->spr.extra -= actor->hitextra;
auto Owner = actor->GetOwner();
if (!actorflag(actor, SFLAG2_IGNOREHITOWNER) && Owner && Owner->spr.statnum < MAXSTATUS)
if (!(actor->flags2 & SFLAG2_IGNOREHITOWNER) && Owner && Owner->spr.statnum < MAXSTATUS)
actor->SetOwner(hitowner);
}
@ -619,7 +619,7 @@ void movetransports_r(void)
case STAT_PROJECTILE:
case STAT_MISC:
case STAT_DUMMYPLAYER:
if (actorflag(act, SFLAG2_DONTDIVE)) continue;
if ((act->flags2 & SFLAG2_DONTDIVE)) continue;
ll = abs(act2->vel.Z);
if (isRRRA())
@ -674,7 +674,7 @@ void movetransports_r(void)
if (warpspriteto)
{
if (actorflag(act2, SFLAG_NOTELEPORT)) continue;
if ((act2->flags1 & SFLAG_NOTELEPORT)) continue;
switch (act2->spr.picnum)
{
case RTILE_PLAYERONWATER:
@ -1421,7 +1421,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
ps[pnum].vel.XY() *= gs.playerfriction - 0.125;
}
}
else if (!actorflag(actor, SFLAG2_FLOATING))
else if (!(actor->flags2 & SFLAG2_FLOATING))
{
if (!*(moveptr + 1))
{

View file

@ -43,7 +43,7 @@ void drawshadows(tspriteArray& tsprites, tspritetype* t, DDukeActor* h)
auto sectp = t->sectp;
double floorz;
if ((sectp->lotag & 0xff) > 2 || h->spr.statnum == STAT_PROJECTILE || h->spr.statnum == STAT_MISC || actorflag(h, SFLAG2_FLOATING))
if ((sectp->lotag & 0xff) > 2 || h->spr.statnum == STAT_PROJECTILE || h->spr.statnum == STAT_MISC || (h->flags2 & SFLAG2_FLOATING))
floorz = sectp->floorz;
else
floorz = h->floorz;
@ -109,7 +109,7 @@ bool RRRAFullbrightHack(tspritetype* t, int k)
void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAngle viewang)
{
if (gs.actorinfo[h->spr.picnum].scriptaddress && !actorflag(h, SFLAG2_DONTANIMATE))// && (t->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_SLAB)
if (gs.actorinfo[h->spr.picnum].scriptaddress && !(h->flags2 & SFLAG2_DONTANIMATE))// && (t->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_SLAB)
{
DAngle kang;
int t4 = h->temp_data[4];

View file

@ -57,7 +57,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t = tsprites.get(j);
h = static_cast<DDukeActor*>(t->ownerActor);
if (!actorflag(h, SFLAG2_FORCESECTORSHADE) && ((t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || (badguypic(t->picnum) && t->extra > 0) || t->statnum == STAT_PLAYER)
if (!(h->flags2 & SFLAG2_FORCESECTORSHADE) && ((t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || (badguy(static_cast<DDukeActor*>(t->ownerActor)) && t->extra > 0) || t->statnum == STAT_PLAYER)
{
if (h->sector()->shadedsector == 1 && h->spr.statnum != STAT_ACTOR)
{
@ -93,7 +93,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
if (t->statnum == STAT_TEMP) continue;
auto pp = &ps[h->PlayerIndex()];
if ((h->spr.statnum != STAT_ACTOR && h->isPlayer() && pp->newOwner == nullptr && h->GetOwner()) || !actorflag(h, SFLAG_NOINTERPOLATE))
if ((h->spr.statnum != STAT_ACTOR && h->isPlayer() && pp->newOwner == nullptr && h->GetOwner()) || !(h->flags1 & SFLAG_NOINTERPOLATE))
{
t->pos = h->interpolatedpos(interpfrac);
t->Angles.Yaw = h->interpolatedyaw(interpfrac);
@ -103,11 +103,11 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
auto sectp = h->sector();
bool res = CallAnimate(h, t);
// some actors have 4, some 6 rotation frames - in true Build fashion there's no pointers what to do here without flagging it.
if (actorflag(h, SFLAG2_ALWAYSROTATE1) || (t->clipdist & TSPR_ROTATE8FRAMES))
if ((h->flags2 & SFLAG2_ALWAYSROTATE1) || (t->clipdist & TSPR_ROTATE8FRAMES))
applyRotation1(h, t, viewang);
else if (actorflag(h, SFLAG2_ALWAYSROTATE2) || (t->clipdist & TSPR_ROTATE12FRAMES))
else if ((h->flags2 & SFLAG2_ALWAYSROTATE2) || (t->clipdist & TSPR_ROTATE12FRAMES))
applyRotation2(h, t, viewang);
if (sectp->floorpal && !actorflag(h, SFLAG2_NOFLOORPAL) && !(t->clipdist & TSPR_NOFLOORPAL))
if (sectp->floorpal && !(h->flags2 & SFLAG2_NOFLOORPAL) && !(t->clipdist & TSPR_NOFLOORPAL))
copyfloorpal(t, sectp);
if (res)

View file

@ -52,7 +52,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t = tsprites.get(j);
h = static_cast<DDukeActor*>(t->ownerActor);
if (!actorflag(h, SFLAG2_FORCESECTORSHADE) && ((t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || (badguypic(t->picnum) && t->extra > 0) || t->statnum == STAT_PLAYER)
if (!(h->flags2 & SFLAG2_FORCESECTORSHADE) && ((t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || badguy(static_cast<DDukeActor*>(t->ownerActor)) || t->statnum == STAT_PLAYER)
{
if (h->sector()->shadedsector == 1 && h->spr.statnum != 1)
{
@ -91,7 +91,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t->Angles.Yaw = h->interpolatedyaw(interpfrac);
h->spr.scale = DVector2(0.375, 0.265625);
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
else if (!(h->flags1 & SFLAG_NOINTERPOLATE))
{
t->pos = h->interpolatedpos(interpfrac);
t->Angles.Yaw = h->interpolatedyaw(interpfrac);
@ -101,11 +101,11 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
auto sectp = h->sector();
bool res = CallAnimate(h, t);
// some actors have 4, some 6 rotation frames - in true Build fashion there's no pointers what to do here without flagging it.
if (actorflag(h, SFLAG2_ALWAYSROTATE1) || (t->clipdist & TSPR_ROTATE8FRAMES))
if ((h->flags2 & SFLAG2_ALWAYSROTATE1) || (t->clipdist & TSPR_ROTATE8FRAMES))
applyRotation1(h, t, viewang);
else if (actorflag(h, SFLAG2_ALWAYSROTATE2) || (t->clipdist & TSPR_ROTATE12FRAMES))
else if ((h->flags2 & SFLAG2_ALWAYSROTATE2) || (t->clipdist & TSPR_ROTATE12FRAMES))
applyRotation2(h, t, viewang);
if (sectp->floorpal && !actorflag(h, SFLAG2_NOFLOORPAL) && !(t->clipdist & TSPR_NOFLOORPAL))
if (sectp->floorpal && !(h->flags2 & SFLAG2_NOFLOORPAL) && !(t->clipdist & TSPR_NOFLOORPAL))
copyfloorpal(t, sectp);
if (res)

View file

@ -25,12 +25,12 @@ DDukeActor* spawn(DDukeActor* actj, PClassActor* pname);
inline int badguy(DDukeActor* pSprite)
{
return badguypic(pSprite->spr.picnum);
return pSprite->flags1 & (SFLAG_BADGUY | SFLAG_INTERNAL_BADGUY);
}
inline int bossguy(DDukeActor* pSprite)
{
return bossguypic(pSprite->spr.picnum);
return pSprite->flags1 & SFLAG_BOSS;
}
// old interface versions of already changed functions

View file

@ -404,7 +404,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
break;
case CSTAT_SPRITE_ALIGNMENT_WALL:
if (actorflag(act, SFLAG2_SHOWWALLSPRITEONMAP)) DrawAutomapAlignmentWall(act->spr, sprpos, cangvect, czoom, xydim, col);
if ((act->flags2 & SFLAG2_SHOWWALLSPRITEONMAP)) DrawAutomapAlignmentWall(act->spr, sprpos, cangvect, czoom, xydim, col);
break;
case CSTAT_SPRITE_ALIGNMENT_FLOOR:

View file

@ -1870,11 +1870,11 @@ int ParseState::parse(void)
break;
case concmd_iseat:
insptr++;
playereat(&ps[g_p], *insptr++, actorflag(g_ac, SFLAG3_BIGHEALTH));
playereat(&ps[g_p], *insptr++, !!(g_ac->flags3 & SFLAG3_BIGHEALTH));
break;
case concmd_addphealth:
insptr++;
addphealth(&ps[g_p], *insptr++, actorflag(g_ac, SFLAG3_BIGHEALTH));
addphealth(&ps[g_p], *insptr++, !!(g_ac->flags3 & SFLAG3_BIGHEALTH));
break;
case concmd_state:
@ -2082,7 +2082,7 @@ int ParseState::parse(void)
auto info = spawnMap.CheckKey(*(insptr - 1));
if (info)
{
auto clstype = static_cast<PClassActor*>(info->Class(*(insptr - 1)));
auto clstype = info->cls;
if (clstype) spawnguts(g_ac, clstype, *insptr);
}
insptr++;
@ -3317,7 +3317,7 @@ bool execute(DDukeActor *actor,int p,double xx)
else if (ud.respawn_items == 1 && (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) goto quit;
}
if (actor->spr.statnum == STAT_ACTOR || (actor->spr.statnum == STAT_STANDABLE && actorflag(actor, SFLAG_CHECKSLEEP)))
if (actor->spr.statnum == STAT_ACTOR || (actor->spr.statnum == STAT_STANDABLE && (actor->flags1 & SFLAG_CHECKSLEEP)))
{
if (actor->timetosleep > 1)
actor->timetosleep--;

View file

@ -62,21 +62,6 @@ inline int bossguypic(int const tileNum)
return ((gs.actorinfo[tileNum].flags & (SFLAG_BOSS)) != 0);
}
inline int actorflag(DDukeActor * actor, EDukeFlags1 mask)
{
return (((gs.actorinfo[actor->spr.picnum].flags) & mask) != 0);
}
inline int actorflag(DDukeActor* actor, EDukeFlags2 mask)
{
return (((gs.actorinfo[actor->spr.picnum].flags2) & mask) != 0);
}
inline int actorflag(DDukeActor* actor, EDukeFlags3 mask)
{
return (((gs.actorinfo[actor->spr.picnum].flags3) & mask) != 0);
}
inline int attackerflag(DDukeActor* actor, EDukeFlags1 mask)
{
return (((gs.actorinfo[actor->attackertype].flags) & mask) != 0);
@ -91,7 +76,7 @@ inline void setflag(EDukeFlags1 flag, const std::initializer_list<short>& types)
{
for (auto val : types)
{
gs.actorinfo[val].flags |= flag;
//gs.actorinfo[val].flags |= flag;
}
}
@ -99,7 +84,7 @@ inline void setflag(EDukeFlags2 flag, const std::initializer_list<short>& types)
{
for (auto val : types)
{
gs.actorinfo[val].flags2 |= flag;
//gs.actorinfo[val].flags2 |= flag;
}
}
@ -107,13 +92,13 @@ inline void setflag(EDukeFlags3 flag, const std::initializer_list<short>& types)
{
for (auto val : types)
{
gs.actorinfo[val].flags3 |= flag;
//gs.actorinfo[val].flags3 |= flag;
}
}
inline bool inventory(DDukeActor* S)
{
return actorflag(S, SFLAG_INVENTORY);
return S->flags1 & SFLAG_INVENTORY;
}
inline bool wallswitchcheck(DDukeActor* s)
@ -363,7 +348,7 @@ inline void setPlayerActorViewZOffset(DDukeActor* const pact)
// this is still not foolproof because CON requires manually recording the kills.
inline void addtokills(DDukeActor* actor)
{
if (actorflag(actor, SFLAG_KILLCOUNT))
if (actor->flags1 & SFLAG_KILLCOUNT)
{
ps[myconnectindex].max_actors_killed++;
actor->spr.cstat2 |= CSTAT2_SPRITE_COUNTKILL;
@ -372,7 +357,7 @@ inline void addtokills(DDukeActor* actor)
inline void addkill(DDukeActor* actor)
{
if (actorflag(actor, SFLAG_KILLCOUNT) && (actor->spr.cstat2 & CSTAT2_SPRITE_COUNTKILL))
if ((actor->flags1 & SFLAG_KILLCOUNT) && (actor->spr.cstat2 & CSTAT2_SPRITE_COUNTKILL))
{
ps[myconnectindex].actors_killed++;
actor->spr.cstat2 &= ~CSTAT2_SPRITE_COUNTKILL;
@ -381,7 +366,7 @@ inline void addkill(DDukeActor* actor)
inline void subkill(DDukeActor* actor)
{
if (actorflag(actor, SFLAG_KILLCOUNT) && !(actor->spr.cstat2 & CSTAT2_SPRITE_COUNTKILL))
if ((actor->flags1 & SFLAG_KILLCOUNT) && !(actor->spr.cstat2 & CSTAT2_SPRITE_COUNTKILL))
{
ps[myconnectindex].actors_killed--;
actor->spr.cstat2 |= CSTAT2_SPRITE_COUNTKILL;

View file

@ -328,7 +328,7 @@ DDukeActor* aim(DDukeActor* actor, int abase)
actor != act)
continue;
if (gotshrinker && act->spr.scale.X < 0.46875 && !actorflag(act, SFLAG_SHRINKAUTOAIM)) continue;
if (gotshrinker && act->spr.scale.X < 0.46875 && !(act->flags1 & SFLAG_SHRINKAUTOAIM)) continue;
if (gotfreezer && act->spr.pal == 1) continue;
}
@ -393,7 +393,7 @@ void dokneeattack(int snum)
spawnguts(p->actorsqu, PClass::FindActor("DukeJibs6"), 7);
spawn(p->actorsqu, PClass::FindActor("DukeBloodPool"));
S_PlayActorSound(SQUISHED, p->actorsqu);
if (actorflag(p->actorsqu, SFLAG2_TRIGGERRESPAWN))
if (p->actorsqu->flags2 & SFLAG2_TRIGGERRESPAWN)
{
if (p->actorsqu->spr.yint)
operaterespawns(p->actorsqu->spr.yint);
@ -404,12 +404,11 @@ void dokneeattack(int snum)
quickkill(&ps[p->actorsqu->PlayerIndex()]);
ps[p->actorsqu->PlayerIndex()].frag_ps = snum;
}
else if (badguy(p->actorsqu))
else
{
addkill(p->actorsqu);
p->actorsqu->Destroy();
}
else p->actorsqu->Destroy();
}
p->actorsqu = nullptr;
}
@ -1047,7 +1046,7 @@ bool addphealth(player_struct* p, int amount, bool bigitem)
DukeStatIterator it(STAT_ACTOR);
while (auto actj = it.Next())
{
if (actorflag(actj, SFLAG2_CAMERA))
if (actj->flags2 & SFLAG2_CAMERA)
actj->spr.yint = 0;
}
}

View file

@ -576,7 +576,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) + 8;
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
if (!actorflag(aimed, SFLAG2_SPECIALAUTOAIM))
if (!(aimed->flags2 & SFLAG2_SPECIALAUTOAIM))
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
@ -625,7 +625,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
}
spawned->spr.extra += (krand() & 7);
if (!(actorflag(spawned, SFLAG2_REFLECTIVE)))
if (!(spawned->flags2 & SFLAG2_REFLECTIVE))
spawned->temp_actor = aimed;
else
{
@ -971,13 +971,8 @@ void shoot_d(DDukeActor* actor, int atwith, PClass *cls)
}
if (cls == nullptr)
{
auto info = spawnMap.CheckKey(atwith);
if (info)
{
cls = static_cast<PClassActor*>(info->Class(atwith));
}
}
cls = GetSpawnType(atwith);
if (cls && cls->IsDescendantOf(RUNTIME_CLASS(DDukeActor)) && CallShootThis(static_cast<DDukeActor*>(GetDefaultByType(cls)), actor, p, spos, sang)) return;
if (cls && atwith == -1) atwith = GetDefaultByType(cls)->spr.picnum;
@ -1887,7 +1882,7 @@ int operateTripbomb(int snum)
DukeSectIterator it(hit.hitSector);
while ((act = it.Next()))
{
if (!actorflag(act, SFLAG_BLOCK_TRIPBOMB))
if (!(act->flags1 & SFLAG_BLOCK_TRIPBOMB))
{
auto delta = act->spr.pos - hit.hitpos;
if (abs(delta.Z) < 12 && delta.XY().LengthSquared() < (18.125 * 18.125))

View file

@ -569,7 +569,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw
double dal = ((aimed->spr.scale.X * tex->GetDisplayHeight()) * 0.5) + 8;
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
if (!actorflag(aimed, SFLAG2_SPECIALAUTOAIM))
if (!(aimed->flags2 & SFLAG2_SPECIALAUTOAIM))
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
@ -606,7 +606,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw
spawned->seek_actor = act90;
spawned->spr.extra += (krand() & 7);
if (!(actorflag(spawned, SFLAG2_REFLECTIVE)))
if (!(spawned->flags2 & SFLAG2_REFLECTIVE))
spawned->temp_actor = aimed;
else
{
@ -790,13 +790,8 @@ void shoot_r(DDukeActor* actor, int atwith, PClass* cls)
}
if (cls == nullptr)
{
auto info = spawnMap.CheckKey(atwith);
if (info)
{
cls = static_cast<PClassActor*>(info->Class(atwith));
}
}
cls = GetSpawnType(atwith);
if (cls && cls->IsDescendantOf(RUNTIME_CLASS(DDukeActor)) && CallShootThis(static_cast<DDukeActor*>(GetDefaultByType(cls)), actor, p, spos, sang)) return;
if (cls && atwith == -1) atwith = GetDefaultByType(cls)->spr.picnum;

View file

@ -984,7 +984,7 @@ static TArray<DDukeActor*> spawnactors(SpawnSpriteDef& sprites)
auto sprt = &sprites.sprites[i];
auto info = spawnMap.CheckKey(sprt->picnum);
auto cls = info ? info->Class(sprt->picnum) : nullptr;;
auto cls = info ? info->cls : nullptr;;
auto actor = static_cast<DDukeActor*>(InsertActor(cls? cls : RUNTIME_CLASS(DDukeActor), sprt->sectp, sprt->statnum));
if (actor)
{

View file

@ -1273,7 +1273,7 @@ void operateforcefields(DDukeActor *effector, int low)
void checkhitwall(DDukeActor* spr, walltype* wal, const DVector3& pos)
{
if (wal->overtexture == mirrortex && actorflag(spr, SFLAG2_BREAKMIRRORS))
if (wal->overtexture == mirrortex && (spr->flags2 & SFLAG2_BREAKMIRRORS))
{
lotsofglass(spr, wal, 70);
wal->cstat &= ~CSTAT_WALL_MASKED;

View file

@ -194,13 +194,13 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj)
if (Owner && Owner->isPlayer() && targ->spr.picnum != DTILE_ROTATEGUN && targ->spr.picnum != DTILE_DRONE)
if (ps[Owner->PlayerIndex()].curr_weapon == SHOTGUN_WEAPON)
{
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat3"));
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat1"));
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat2"));
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat4"));
fi.shoot(targ, -1, PClass::FindActor(NAME_DukeBloodSplat3));
fi.shoot(targ, -1, PClass::FindActor(NAME_DukeBloodSplat1));
fi.shoot(targ, -1, PClass::FindActor(NAME_DukeBloodSplat2));
fi.shoot(targ, -1, PClass::FindActor(NAME_DukeBloodSplat4));
}
if (!actorflag(targ, SFLAG2_NODAMAGEPUSH)) // RR does not have this.
if (!(targ->flags2 & SFLAG2_NODAMAGEPUSH)) // RR does not have this.
{
if ((targ->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0)
targ->spr.Angles.Yaw = proj->spr.Angles.Yaw + DAngle180;
@ -222,7 +222,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj)
if (targ->spr.statnum != STAT_ZOMBIEACTOR)
{
if (proj->spr.picnum == DTILE_FREEZEBLAST && ((targ->isPlayer() && targ->spr.pal == 1) || (gs.freezerhurtowner == 0 && proj->GetOwner() == targ)))
if ((proj->flags2 & SFLAG2_FREEZEDAMAGE) && ((targ->isPlayer() && targ->spr.pal == 1) || (gs.freezerhurtowner == 0 && proj->GetOwner() == targ)))
return;
int hitpic = proj->spr.picnum;
@ -256,7 +256,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj)
DukeStatIterator it(STAT_ACTOR);
while (auto itActor = it.Next())
{
if (actorflag(itActor, SFLAG2_CAMERA)) itActor->spr.yint = 0;
if (itActor->flags2 & SFLAG2_CAMERA) itActor->spr.yint = 0;
}
}
@ -305,7 +305,7 @@ void clearcameras(player_struct* p)
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
{
if (actorflag(act, SFLAG2_CAMERA)) act->spr.yint = 0;
if ((act->flags2 & SFLAG2_CAMERA)) act->spr.yint = 0;
}
}
@ -415,7 +415,7 @@ void checksectors_d(int snum)
neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->GetActor()->PrevAngles.Yaw, near, 80., NT_Lotag | NT_Hitag);
if (near.actor() != nullptr)
{
if (actorflag(near.actor(), SFLAG2_TRIGGERRESPAWN))
if (near.actor()->flags2 & SFLAG2_TRIGGERRESPAWN)
return;
}

View file

@ -230,7 +230,7 @@ void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj)
DukeStatIterator it(STAT_EFFECTOR);
while (auto act = it.Next())
{
if (actorflag(act, SFLAG2_CAMERA)) act->spr.yint = 0;
if ((act->flags2 & SFLAG2_CAMERA)) act->spr.yint = 0;
}
}
auto Owner = targ->GetHitOwner();
@ -410,7 +410,7 @@ void checksectors_r(int snum)
neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->GetActor()->PrevAngles.Yaw, near, 80., NT_Lotag | NT_Hitag);
if (near.actor() != nullptr)
{
if (actorflag(near.actor(), SFLAG2_TRIGGERRESPAWN))
if (near.actor()->flags2 & SFLAG2_TRIGGERRESPAWN)
return;
switch (near.actor()->spr.picnum)

View file

@ -83,10 +83,7 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor*
if (!clstype)
{
info = spawnMap.CheckKey(s_pn);
if (info)
{
clstype = static_cast<PClassActor*>(info->Class(s_pn));
}
if (info) clstype = static_cast<PClassActor*>(info->cls);
}
auto act = static_cast<DDukeActor*>(InsertActor(clstype? clstype : RUNTIME_CLASS(DDukeActor), whatsectp, s_stat));
@ -228,7 +225,7 @@ bool initspriteforspawn(DDukeActor* act)
}
if (!actorflag(act, SFLAG_NOFALLER) && (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK))
if (!(act->flags1 & SFLAG_NOFALLER) && (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK))
{
if (act->spr.shade == 127) return false;
@ -302,18 +299,13 @@ bool commonEnemySetup(DDukeActor* self, DDukeActor* owner)
{
if (!self->mapSpawned) self->spr.lotag = 0;
if (gs.actorinfo[self->spr.picnum].scriptaddress) // default scale only applies to actors with a CON part. Note: needs fixing later!
// Init the size. This is different for internal and user enemies.
self->clipdist = 20;
if (self->flags1 & SFLAG_INTERNAL_BADGUY)
{
// Init the size. This is different for internal and user enemies.
if (actorflag(self, SFLAG_INTERNAL_BADGUY))
{
self->spr.scale = DVector2(0.625, 0.625);
self->clipdist = 20;
}
else if (self->spr.scale.X == 0 || self->spr.scale.Y == 0)
{
self->spr.scale = DVector2(REPEAT_SCALE, REPEAT_SCALE);
}
self->flags1 |= SFLAG_BADGUY; // simplify future checks.
self->spr.scale = DVector2(0.625, 0.625);
}
if ((self->spr.lotag > ud.player_skill) || ud.monsters_off == 1)
@ -335,7 +327,7 @@ bool commonEnemySetup(DDukeActor* self, DDukeActor* owner)
{
CallPlayFTASound(self);
ChangeActorStat(self, STAT_ACTOR);
if (owner && !actorflag(self, SFLAG_INTERNAL_BADGUY)) self->spr.Angles.Yaw = owner->spr.Angles.Yaw;
if (owner && !(self->flags1 & SFLAG_INTERNAL_BADGUY)) self->spr.Angles.Yaw = owner->spr.Angles.Yaw;
}
else ChangeActorStat(self, STAT_ZOMBIEACTOR);
return true;
@ -830,7 +822,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
DDukeActor* spawninit(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>* actors)
{
if (actorflag(act, SFLAG2_TRIGGERRESPAWN))
if ((act->flags2 & SFLAG2_TRIGGERRESPAWN))
{
act->spr.yint = act->spr.hitag;
act->spr.hitag = -1;

View file

@ -22,7 +22,6 @@ struct STATUSBARTYPE
bool gotweapon[MAX_WEAPONS];
};
// Todo - put more state in here
struct ActorInfo
{
uint32_t scriptaddress;

View file

@ -134,11 +134,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, GetSoundFlags, duke_GetSoundFlags)
ACTION_RETURN_INT(duke_GetSoundFlags(snd));
}
DEFINE_ACTION_FUNCTION_NATIVE(_Duke, badguyID, badguypic)
static int Duke_badguypic(int spawnno)
{
auto clstype = GetSpawnType(spawnno);
if (clstype->IsDescendantOf(RUNTIME_CLASS(DDukeActor)))
return badguy(static_cast<DDukeActor*>(GetDefaultByType(clstype)));
return false;
}
DEFINE_ACTION_FUNCTION_NATIVE(_Duke, badguyID, Duke_badguypic)
{
PARAM_PROLOGUE;
PARAM_INT(p);
ACTION_RETURN_INT(badguypic(p));
ACTION_RETURN_INT(Duke_badguypic(p));
}
void updatepindisplay(int tag, int pins);
@ -701,21 +709,21 @@ DEFINE_ACTION_FUNCTION(DDukeActor, actorflag1)
{
PARAM_SELF_PROLOGUE(DDukeActor);
PARAM_INT(mask);
ACTION_RETURN_BOOL(!!actorflag(self, EDukeFlags1::FromInt(mask)));
ACTION_RETURN_BOOL(!!(self->flags1 & EDukeFlags1::FromInt(mask)));
}
DEFINE_ACTION_FUNCTION(DDukeActor, actorflag2)
{
PARAM_SELF_PROLOGUE(DDukeActor);
PARAM_INT(mask);
ACTION_RETURN_BOOL(!!actorflag(self, EDukeFlags2::FromInt(mask)));
ACTION_RETURN_BOOL(!!(self->flags2 & EDukeFlags2::FromInt(mask)));
}
DEFINE_ACTION_FUNCTION(DDukeActor, actorflag3)
{
PARAM_SELF_PROLOGUE(DDukeActor);
PARAM_INT(mask);
ACTION_RETURN_BOOL(!!actorflag(self, EDukeFlags3::FromInt(mask)));
ACTION_RETURN_BOOL(!!(self->flags3 & EDukeFlags3::FromInt(mask)));
}
DEFINE_ACTION_FUNCTION(DDukeActor, attackerflag1)

View file

@ -85,6 +85,10 @@ enum ESectorTriggers
class DukeActor : CoreActor native
{
default
{
lookallarounddefault;
}
enum EStatnums
{
STAT_DEFAULT = 0,