- turned the exclude lists for initspriteforspawn into a flag.

This commit is contained in:
Christoph Oelckers 2022-01-19 09:41:48 +01:00
parent e4cfc374be
commit a776e5c56e
7 changed files with 32 additions and 29 deletions

View file

@ -325,6 +325,7 @@ enum sflags_t
SFLAG_NOTELEPORT = 0x10000000,
SFLAG_SE24_REMOVE = 0x20000000,
SFLAG_BLOCK_TRIPBOMB = 0x40000000,
SFLAG_NOFALLER = 0x80000000,
};

View file

@ -210,6 +210,7 @@ void initactorflags_d()
setflag(SFLAG_SE24_NOCARRY, { TRIPBOMB, LASERLINE, BOLT1, BOLT1 + 1,BOLT1 + 2, BOLT1 + 3, SIDEBOLT1, SIDEBOLT1 + 1, SIDEBOLT1 + 2, SIDEBOLT1 + 3, CRANE, CRANE1, CRANE2, BARBROKE });
setflag(SFLAG_SE24_REMOVE, { BLOODPOOL, PUKE, FOOTPRINTS, FOOTPRINTS2, FOOTPRINTS3, FOOTPRINTS4, BULLETHOLE, BLOODSPLAT1, BLOODSPLAT2, BLOODSPLAT3, BLOODSPLAT4 });
setflag(SFLAG_BLOCK_TRIPBOMB, { TRIPBOMB }); // making this a flag adds the option to let other things block placing trip bombs as well.
setflag(SFLAG_NOFALLER, { CRACK1, CRACK2, CRACK3, CRACK4, SPEAKER, LETTER, DUCK, TARGET, TRIPBOMB, VIEWSCREEN, VIEWSCREEN2 });
if (isWorldTour())
{

View file

@ -239,6 +239,7 @@ void initactorflags_r()
setflag(SFLAG_NOTELEPORT, { TRANSPORTERSTAR, TRANSPORTERBEAM, BULLETHOLE, WATERSPLASH2, BURNING, FIRE, MUD });
setflag(SFLAG_SE24_NOCARRY, { BULLETHOLE, BOLT1, BOLT1 + 1,BOLT1 + 2, BOLT1 + 3, CRANE, CRANE1, CRANE2, BARBROKE });
setflag(SFLAG_SE24_REMOVE, { BLOODPOOL, PUKE, FOOTPRINTS, FOOTPRINTS2, FOOTPRINTS3 });
setflag(SFLAG_NOFALLER, { CRACK1, CRACK2, CRACK3, CRACK4 });
// 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

@ -187,7 +187,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
void addspritetodelete(int spnum=0);
void checkavailinven(struct player_struct* p);
bool initspriteforspawn(DDukeActor* spn, const std::initializer_list<int> &excludes);
bool initspriteforspawn(DDukeActor* spn);
void spawninitdefault(DDukeActor* actj, DDukeActor* act);
void spawntransporter(DDukeActor* actj, DDukeActor* acti, bool beam);
int spawnbloodpoolpart1(DDukeActor* acti);

View file

@ -266,7 +266,7 @@ void cacheit_d(void)
//---------------------------------------------------------------------------
void spriteinit_d(DDukeActor* actor, TArray<DDukeActor*>& actors)
{
bool res = initspriteforspawn(actor, { CRACK1, CRACK2, CRACK3, CRACK4, SPEAKER, LETTER, DUCK, TARGET, TRIPBOMB, VIEWSCREEN, VIEWSCREEN2 });
bool res = initspriteforspawn(actor);
if (res) spawninit_d(nullptr, actor, &actors);
}

View file

@ -404,7 +404,7 @@ void cacheit_r(void)
void spriteinit_r(DDukeActor* actor, TArray<DDukeActor*>& actors)
{
bool res = initspriteforspawn(actor, { CRACK1, CRACK2, CRACK3, CRACK4 });
bool res = initspriteforspawn(actor);
if (res) spawninit_r(nullptr, actor, &actors);
}

View file

@ -135,7 +135,7 @@ DDukeActor* EGS(sectortype* whatsectp, int s_x, int s_y, int s_z, int s_pn, int8
//
//---------------------------------------------------------------------------
bool initspriteforspawn(DDukeActor* act, const std::initializer_list<int> &excludes)
bool initspriteforspawn(DDukeActor* act)
{
SetupGameVarsForActor(act);
act->attackertype = act->spr.picnum;
@ -160,36 +160,36 @@ bool initspriteforspawn(DDukeActor* act, const std::initializer_list<int> &exclu
act->temp_data[0] = act->temp_data[1] = act->temp_data[2] = act->temp_data[3] = act->temp_data[4] = act->temp_data[5] = 0;
act->temp_actor = nullptr;
if (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK)
if (!isIn(act->spr.picnum, excludes) && (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK))
if (wallswitchcheck(act) && (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
{
if (act->spr.picnum != TILE_ACCESSSWITCH && act->spr.picnum != TILE_ACCESSSWITCH2 && act->spr.pal)
{
if (act->spr.shade == 127) return false;
if (wallswitchcheck(act) && (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
if ((ud.multimode < 2) || (ud.multimode > 1 && ud.coop == 1))
{
if (act->spr.picnum != TILE_ACCESSSWITCH && act->spr.picnum != TILE_ACCESSSWITCH2 && act->spr.pal)
{
if ((ud.multimode < 2) || (ud.multimode > 1 && ud.coop == 1))
{
act->spr.xrepeat = act->spr.yrepeat = 0;
act->spr.cstat = 0;
act->spr.lotag = act->spr.hitag = 0;
return false;
}
}
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
if (act->spr.pal && act->spr.picnum != TILE_ACCESSSWITCH && act->spr.picnum != TILE_ACCESSSWITCH2)
act->spr.pal = 0;
return false;
}
if (act->spr.hitag)
{
ChangeActorStat(act, 12);
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
act->spr.extra = gs.impact_damage;
act->spr.xrepeat = act->spr.yrepeat = 0;
act->spr.cstat = 0;
act->spr.lotag = act->spr.hitag = 0;
return false;
}
}
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
if (act->spr.pal && act->spr.picnum != TILE_ACCESSSWITCH && act->spr.picnum != TILE_ACCESSSWITCH2)
act->spr.pal = 0;
return false;
}
if (!actorflag(act, SFLAG_NOFALLER) && (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK))
{
if (act->spr.shade == 127) return false;
if (act->spr.hitag)
{
ChangeActorStat(act, STAT_FALLER);
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
act->spr.extra = gs.impact_damage;
return false;
}
}
int s = act->spr.picnum;