- turn all special actor type checks in moveflammable into flags.

Also wrap all flag checks in actorflag function
This commit is contained in:
Christoph Oelckers 2022-01-18 00:54:10 +01:00
parent cbd8de36a9
commit 58b718d2a2
11 changed files with 26 additions and 20 deletions

View file

@ -855,7 +855,7 @@ void moveflammable(DDukeActor* actor, int tire, int box, int pool)
actor->temp_data[1]++;
if ((actor->temp_data[1] & 3) > 0) return;
if (!isRR() && actor->spr.picnum == tire && actor->temp_data[1] == 32)
if (actorflag(actor, SFLAG_FLAMMABLEPOOLEFFECT) && actor->temp_data[1] == 32)
{
actor->spr.cstat = 0;
auto spawned = spawn(actor, pool);
@ -4416,7 +4416,7 @@ void handle_se24(DDukeActor *actor, const int16_t *list1, const int16_t *list2,
wallswitchcheck(a2))
break;
if (!(gs.actorinfo[a2->spr.picnum].flags & SFLAG_SE24_NOFLOORCHECK))
if (!actorflag(a2, SFLAG_SE24_NOFLOORCHECK))
{
if (a2->spr.pos.Z > (a2->floorz - (16 << 8)))
{

View file

@ -398,7 +398,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
act2->spr.xvel += (actor->spr.extra << 2);
}
if (gs.actorinfo[act2->spr.picnum].flags & SFLAG_HITRADIUSCHECK)
if (actorflag(act2, SFLAG_HITRADIUSCHECK))
fi.checkhitsprite(act2, actor);
}
else if (actor->spr.extra == 0) act2->hitextra = 0;
@ -2359,7 +2359,7 @@ static void greenslime(DDukeActor *actor)
DukeSectIterator it(actor->sector());
while (auto a2 = it.Next())
{
if (gs.actorinfo[a2->spr.picnum].flags & SFLAG_GREENSLIMEFOOD)
if (actorflag(a2, SFLAG_GREENSLIMEFOOD))
{
if (ldist(actor, a2) < 768 && (abs(actor->spr.pos.Z - a2->spr.pos.Z) < 8192)) //Gulp them
{

View file

@ -335,7 +335,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
act2->spr.xvel += (act2->spr.extra << 2);
}
if (gs.actorinfo[act2->spr.picnum].flags & SFLAG_HITRADIUSCHECK)
if (actorflag(act2, SFLAG_HITRADIUSCHECK))
fi.checkhitsprite(act2, actor);
if (act2->spr.picnum != RADIUSEXPLOSION &&

View file

@ -171,7 +171,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
t->pos.Z = interpolatedvalue(ps[h->spr.yvel].opos.Z, ps[h->spr.yvel].pos.Z, smoothratio);
t->pos.Z += PHEIGHT_DUKE;
}
else if (!(gs.actorinfo[h->spr.picnum].flags & SFLAG_NOINTERPOLATE))
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
t->pos = h->interpolatedvec3(smoothratio);
}

View file

@ -154,7 +154,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
h->spr.xrepeat = 24;
h->spr.yrepeat = 17;
}
else if (!(gs.actorinfo[h->spr.picnum].flags & SFLAG_NOINTERPOLATE))
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
t->pos = h->interpolatedvec3(smoothratio);
}

View file

@ -315,6 +315,8 @@ enum sflags_t
SFLAG_NOSHADOW = 0x00040000,
SFLAG_SE24_NOFLOORCHECK = 0x00080000,
SFLAG_NOINTERPOLATE = 0x00100000,
SFLAG_FALLINGFLAMMABLE = 0x00200000,
SFLAG_FLAMMABLEPOOLEFFECT = 0x00400000,
};

View file

@ -200,6 +200,8 @@ void initactorflags_d()
setflag(SFLAG_GREENSLIMEFOOD, { LIZTROOP, LIZMAN, PIGCOP, NEWBEAST });
setflag(SFLAG_SE24_NOFLOORCHECK, { CRANE, CRANE1, CRANE2, BARBROKE });
setflag(SFLAG_NOINTERPOLATE, { CRANEPOLE });
setflag(SFLAG_FLAMMABLEPOOLEFFECT, { TIRE });
setflag(SFLAG_FALLINGFLAMMABLE, { BOX });
if (isWorldTour())
{

View file

@ -230,6 +230,7 @@ void initactorflags_r()
setflag(SFLAG_SE24_NOFLOORCHECK, { CRANE, CRANE1, CRANE2, BARBROKE });
setflag(SFLAG_NOINTERPOLATE, { CRANEPOLE });
setflag(SFLAG_FALLINGFLAMMABLE, { BOX });
// Animals were not supposed to have this, but due to a coding bug the logic was unconditional for everything in the game.
for (auto& ainf : gs.actorinfo)

View file

@ -60,7 +60,7 @@ inline void setflag(EDukeFlags2 flag, const std::initializer_list<short>& types)
inline bool inventory(DDukeActor* S)
{
return !!(gs.actorinfo[S->spr.picnum].flags & SFLAG_INVENTORY);
return actorflag(S, SFLAG_INVENTORY);
}
inline void settileflag(int flag, const std::initializer_list<short>& types)

View file

@ -329,7 +329,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
actor != act)
continue;
if (gotshrinker && act->spr.xrepeat < 30 && !(gs.actorinfo[act->spr.picnum].flags & SFLAG_SHRINKAUTOAIM)) continue;
if (gotshrinker && act->spr.xrepeat < 30 && !actorflag(act, SFLAG_SHRINKAUTOAIM)) continue;
if (gotfreezer && act->spr.pal == 1) continue;
}

View file

@ -26,6 +26,17 @@ struct FireProj
vec3_t pos, vel;
};
// Todo - put more state in here
struct ActorInfo
{
uint32_t scriptaddress;
EDukeFlags1 flags;
EDukeFlags2 flags2;
int aimoffset;
int falladjustz;
int gutsoffset;
};
class DDukeActor : public DCoreActor
{
DECLARE_CLASS(DDukeActor, DCoreActor)
@ -62,6 +73,7 @@ public:
DDukeActor() = default;
size_t PropagateMark() override;
const ActorInfo* actorInfo() const;
// This once was stored in the owner field of the sprite
inline DDukeActor* GetOwner()
@ -120,17 +132,6 @@ struct animwalltype
int tag;
};
// Todo - put more state in here
struct ActorInfo
{
uint32_t scriptaddress;
EDukeFlags1 flags;
EDukeFlags2 flags2;
int aimoffset;
int falladjustz;
int gutsoffset;
};
// for now just flags not related to actors, may get more info later.
struct TileInfo
{