- flammable flags.

This commit is contained in:
Christoph Oelckers 2022-01-27 00:41:33 +01:00
parent 913b0622b8
commit 125c3e8004
12 changed files with 44 additions and 59 deletions

View file

@ -847,7 +847,7 @@ void movefountain(DDukeActor *actor, int fountain)
//
//---------------------------------------------------------------------------
void moveflammable(DDukeActor* actor, int tire, int box, int pool)
void moveflammable(DDukeActor* actor, int pool)
{
int j;
if (actor->temp_data[0] == 1)
@ -859,7 +859,11 @@ void moveflammable(DDukeActor* actor, int tire, int box, int pool)
{
actor->spr.cstat = 0;
auto spawned = spawn(actor, pool);
if (spawned) spawned->spr.shade = 127;
if (spawned)
{
spawned->spr.pal = 2;
spawned->spr.shade = 127;
}
}
else
{
@ -888,7 +892,7 @@ void moveflammable(DDukeActor* actor, int tire, int box, int pool)
}
actor->spr.yrepeat = j;
}
if (box >= 0 && actor->spr.picnum == box)
if (actorflag(actor, SFLAG_FALLINGFLAMMABLE))
{
makeitfall(actor);
actor->ceilingz = actor->sector()->ceilingz;
@ -2302,7 +2306,7 @@ bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool f
//
//---------------------------------------------------------------------------
bool bloodpool(DDukeActor* actor, bool puke, int TIRE)
bool bloodpool(DDukeActor* actor, bool puke)
{
auto sectp = actor->sector();
@ -2327,7 +2331,7 @@ bool bloodpool(DDukeActor* actor, bool puke, int TIRE)
if (actor->temp_data[2] < 32)
{
actor->temp_data[2]++;
if (actor->attackertype == TIRE)
if (attackerflag(actor, SFLAG_FLAMMABLEPOOLEFFECT))
{
if (actor->spr.xrepeat < 64 && actor->spr.yrepeat < 64)
{
@ -2363,7 +2367,7 @@ bool bloodpool(DDukeActor* actor, bool puke, int TIRE)
if (actor->temp_data[1] == 1) return false;
actor->temp_data[1] = 1;
if (actor->attackertype == TIRE)
if (attackerflag(actor, SFLAG_FLAMMABLEPOOLEFFECT))
ps[p].footprintcount = 10;
else ps[p].footprintcount = 3;

View file

@ -322,7 +322,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
}
}
if (x == 0 || x >= 5 || AFLAMABLE(act2->spr.picnum))
if (x == 0 || x >= 5 || actorflag(act2, SFLAG_HITRADIUS_FLAG1))
{
if (actor->spr.picnum != SHRINKSPARK || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))
if (dist(actor, act2) < r)
@ -1208,7 +1208,7 @@ void movestandables_d(void)
else if (AFLAMABLE(picnum))
{
moveflammable(act, TIRE, BOX, BLOODPOOL);
moveflammable(act, BLOODPOOL);
}
else if (picnum == TRIPBOMB)
@ -3140,7 +3140,7 @@ void moveexplosions_d(void) // STATNUM 5
continue;
case BLOODPOOL:
case PUKE:
bloodpool(act, act->spr.picnum == PUKE, TIRE);
bloodpool(act, act->spr.picnum == PUKE);
continue;

View file

@ -267,7 +267,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 || AFLAMABLE(act2->spr.picnum))
if (x == 0 || x >= 5 || actorflag(act2, SFLAG_HITRADIUS_FLAG1))
{
if (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)
if (dist(actor, act2) < r)
@ -853,7 +853,7 @@ void movestandables_r(void)
else if (AFLAMABLE(picnum))
{
moveflammable(act, TIRE, BOX, BLOODPOOL);
moveflammable(act, BLOODPOOL);
}
@ -3115,7 +3115,7 @@ void moveexplosions_r(void) // STATNUM 5
continue;
case BLOODPOOL:
if (!bloodpool(act, false, TIRE)) continue;
if (!bloodpool(act, false)) continue;
if (act->sector()->lotag == 800)
if (act->spr.pos.Z >= act->sector()->floorz - (8 << 8))

View file

@ -657,7 +657,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
case BURNING:
case BURNING2:
if (!OwnerAc) break;
if (OwnerAc->spr.picnum != TREE1 && OwnerAc->spr.picnum != TREE2)
if (!actorflag(OwnerAc, SFLAG_NOFLOORFIRE))
t->pos.Z = t->sectp->floorz;
t->shade = -127;
break;

View file

@ -814,7 +814,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
break;
case FIRE:
case BURNING:
if (OwnerAc && OwnerAc->spr.picnum != TREE1 && OwnerAc->spr.picnum != TREE2)
if (!OwnerAc || !actorflag(OwnerAc, SFLAG_NOFLOORFIRE))
t->pos.Z = t->sectp->floorz;
t->shade = -127;
break;

View file

@ -317,6 +317,9 @@ enum sflags_t
SFLAG_NOINTERPOLATE = 0x00100000,
SFLAG_FALLINGFLAMMABLE = 0x00200000,
SFLAG_FLAMMABLEPOOLEFFECT = 0x00400000,
SFLAG_INFLAME = 0x00800000,
SFLAG_NOFLOORFIRE = 0x01000000,
SFLAG_HITRADIUS_FLAG1 = 0x02000000,
};

View file

@ -202,6 +202,9 @@ void initactorflags_d()
setflag(SFLAG_NOINTERPOLATE, { CRANEPOLE });
setflag(SFLAG_FLAMMABLEPOOLEFFECT, { TIRE });
setflag(SFLAG_FALLINGFLAMMABLE, { BOX });
setflag(SFLAG_INFLAME, { RADIUSEXPLOSION, RPG, FIRELASER, HYDRENT, HEAVYHBOMB });
setflag(SFLAG_NOFLOORFIRE, { TREE1, TREE2 });
setflag(SFLAG_HITRADIUS_FLAG1, { BOX, TREE1, TREE2, TIRE, CONE });
if (isWorldTour())
{

View file

@ -231,6 +231,10 @@ void initactorflags_r()
setflag(SFLAG_SE24_NOFLOORCHECK, { CRANE, CRANE1, CRANE2, BARBROKE });
setflag(SFLAG_NOINTERPOLATE, { CRANEPOLE });
setflag(SFLAG_FALLINGFLAMMABLE, { BOX });
setflag(SFLAG_INFLAME, { RADIUSEXPLOSION, RPG, FIRELASER, HYDRENT, HEAVYHBOMB, TRIPBOMBSPRITE, COOLEXPLOSION1, OWHIP, UWHIP });
if (isRRRA()) setflag(SFLAG_INFLAME, { RPG2 });
setflag(SFLAG_NOFLOORFIRE, { TREE1, TREE2 });
setflag(SFLAG_HITRADIUS_FLAG1, { BOX, TREE1, TREE2, TIRE });
// 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

@ -33,7 +33,7 @@ void RANDOMSCRAP(DDukeActor* i);
void ms(DDukeActor* i);
void movecrane(DDukeActor* i, int crane);
void movefountain(DDukeActor* i, int fountain);
void moveflammable(DDukeActor* i, int tire, int box, int pool);
void moveflammable(DDukeActor* i, int pool);
void detonate(DDukeActor* i, int explosion);
void movemasterswitch(DDukeActor* i, int spectype1, int spectype2);
void movetrash(DDukeActor* i);
@ -59,7 +59,7 @@ void watersplash2(DDukeActor* i);
void frameeffect1(DDukeActor* i);
bool money(DDukeActor* i, int BLOODPOOL);
bool jibs(DDukeActor* i, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2);
bool bloodpool(DDukeActor* i, bool puke, int TIRE);
bool bloodpool(DDukeActor* i, bool puke);
void shell(DDukeActor* i, bool morecheck);
void glasspieces(DDukeActor* i);
void scrap(DDukeActor* i, int SCRAP1, int SCRAP6);

View file

@ -37,6 +37,16 @@ inline int actorflag(DDukeActor* actor, EDukeFlags2 mask)
return (((gs.actorinfo[actor->spr.picnum].flags2) & mask) != 0);
}
inline int attackerflag(DDukeActor* actor, EDukeFlags1 mask)
{
return (((gs.actorinfo[actor->attackertype].flags) & mask) != 0);
}
inline int attackerflag(DDukeActor* actor, EDukeFlags2 mask)
{
return (((gs.actorinfo[actor->attackertype].flags2) & mask) != 0);
}
inline int actorfella(DDukeActor* actor)
{
return actorflag(actor, SFLAG_KILLCOUNT);

View file

@ -1083,31 +1083,20 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
case TIRE:
case CONE:
case BOX:
switch (proj->spr.picnum)
if (actorflag(proj, SFLAG_INFLAME))
{
case RADIUSEXPLOSION:
case RPG:
case FIRELASER:
case HYDRENT:
case HEAVYHBOMB:
if (targ->temp_data[0] == 0)
{
targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
targ->temp_data[0] = 1;
spawn(targ, BURNING);
}
break;
}
break;
case CACTUS:
// case CACTUSBROKE:
switch (proj->spr.picnum)
if (actorflag(proj, SFLAG_INFLAME))
{
case RADIUSEXPLOSION:
case RPG:
case FIRELASER:
case HYDRENT:
case HEAVYHBOMB:
for (k = 0; k < 64; k++)
{
auto spawned = EGS(targ->sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5);
@ -1117,8 +1106,6 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
if (targ->spr.picnum == CACTUS)
targ->spr.picnum = CACTUSBROKE;
targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
// else deletesprite(i);
break;
}
break;

View file

@ -2122,46 +2122,21 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
case TREE2:
case TIRE:
case BOX:
switch (proj->spr.picnum)
if (actorflag(proj, SFLAG_INFLAME))
{
case RPG2:
if (!isRRRA()) break;
[[fallthrough]];
case RADIUSEXPLOSION:
case RPG:
case FIRELASER:
case HYDRENT:
case HEAVYHBOMB:
case TRIPBOMBSPRITE:
case COOLEXPLOSION1:
case OWHIP:
case UWHIP:
if (targ->temp_data[0] == 0)
{
targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
targ->temp_data[0] = 1;
spawn(targ, BURNING);
}
break;
}
break;
case CACTUS:
// case CACTUSBROKE:
switch (proj->spr.picnum)
if (actorflag(proj, SFLAG_INFLAME))
{
case RPG2:
if (!isRRRA()) break;
[[fallthrough]];
case RADIUSEXPLOSION:
case RPG:
case FIRELASER:
case HYDRENT:
case HEAVYHBOMB:
case TRIPBOMBSPRITE:
case COOLEXPLOSION1:
case OWHIP:
case UWHIP:
for (k = 0; k < 64; k++)
{
auto spawned = EGS(targ->sector(), targ->spr.pos.X, targ->spr.pos.Y, targ->spr.pos.Z - (krand() % (48 << 8)), SCRAP6 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (targ->spr.zvel >> 2), targ, 5);
@ -2172,7 +2147,6 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
targ->spr.picnum = CACTUSBROKE;
targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
// else deletesprite(i);
break;
}
break;