mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-28 23:21:58 +00:00
No more stupidity for No More Enemies special plz NME special now acts similarly to Each Time, checking all sectors sharing the same tag as itself for any enemies/bosses hiding within. This also supports cases where the tagged sectors are FOF control sectors. When the situation is asitsaysonthetin, NME acts like a normal trigger linedef should and executes all linedef execs around the sector it's located in.
git-svn-id: https://code.orospakr.ca/svn/srb2/trunk@9005 6de4a73c-47e2-0310-b8c1-93d6ecd3f8cd
This commit is contained in:
parent
af4c2fe391
commit
474ad01b46
2 changed files with 44 additions and 23 deletions
|
@ -1968,51 +1968,71 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies)
|
|||
{
|
||||
size_t i;
|
||||
fixed_t upperbound, lowerbound;
|
||||
INT32 s;
|
||||
sector_t *checksector;
|
||||
sector_t *sec = NULL;
|
||||
sector_t *targetsec = NULL;
|
||||
INT32 secnum = -1;
|
||||
msecnode_t *node;
|
||||
mobj_t *thing;
|
||||
boolean exists = false;
|
||||
boolean FOFsector = false;
|
||||
|
||||
for (i = 0; i < nobaddies->sector->linecount; i++)
|
||||
while ((secnum = P_FindSectorFromLineTag(nobaddies->sourceline, secnum)) >= 0)
|
||||
{
|
||||
if (nobaddies->sector->lines[i]->special == 223)
|
||||
sec = §ors[secnum];
|
||||
|
||||
FOFsector = false;
|
||||
|
||||
// Check the lines of this sector, to see if it is a FOF control sector.
|
||||
for (i = 0; i < sec->linecount; i++)
|
||||
{
|
||||
INT32 targetsecnum = -1;
|
||||
|
||||
upperbound = nobaddies->sector->ceilingheight;
|
||||
lowerbound = nobaddies->sector->floorheight;
|
||||
if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300)
|
||||
continue;
|
||||
|
||||
for (s = -1; (s = P_FindSectorFromLineTag(nobaddies->sector->lines[i], s)) >= 0 ;)
|
||||
FOFsector = true;
|
||||
|
||||
while ((targetsecnum = P_FindSectorFromLineTag(sec->lines[i], targetsecnum)) >= 0)
|
||||
{
|
||||
checksector = §ors[s];
|
||||
targetsec = §ors[targetsecnum];
|
||||
|
||||
node = checksector->touching_thinglist; // things touching this sector
|
||||
upperbound = targetsec->ceilingheight;
|
||||
lowerbound = targetsec->floorheight;
|
||||
node = targetsec->touching_thinglist; // things touching this sector
|
||||
while (node)
|
||||
{
|
||||
thing = node->m_thing;
|
||||
|
||||
if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0
|
||||
&& thing->z < upperbound && thing->z+thing->height > lowerbound)
|
||||
{
|
||||
exists = true;
|
||||
goto foundenemy;
|
||||
}
|
||||
return;
|
||||
|
||||
node = node->m_snext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foundenemy:
|
||||
if (exists)
|
||||
|
||||
if (!FOFsector)
|
||||
{
|
||||
upperbound = sec->ceilingheight;
|
||||
lowerbound = sec->floorheight;
|
||||
node = sec->touching_thinglist; // things touching this sector
|
||||
while (node)
|
||||
{
|
||||
thing = node->m_thing;
|
||||
|
||||
if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0
|
||||
&& thing->z < upperbound && thing->z+thing->height > lowerbound)
|
||||
return;
|
||||
|
||||
s = P_AproxDistance(nobaddies->sourceline->dx, nobaddies->sourceline->dy)>>FRACBITS;
|
||||
node = node->m_snext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", s);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", nobaddies->sourceline->tag);
|
||||
|
||||
// Otherwise, run the linedef exec and terminate this thinker
|
||||
P_LinedefExecute((INT16)s, NULL, NULL);
|
||||
// No enemies found, run the linedef exec and terminate this thinker
|
||||
P_RunTriggerLinedef(nobaddies->sourceline, NULL, NULL);
|
||||
P_RemoveThinker(&nobaddies->thinker);
|
||||
}
|
||||
|
||||
|
|
|
@ -1890,6 +1890,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
|||
|| specialtype == 304 // Ring count - Once
|
||||
|| specialtype == 307 // Character ability - Once
|
||||
|| specialtype == 308 // Race only - Once
|
||||
|| specialtype == 313 // No More Enemies - Once
|
||||
|| specialtype == 315 // No of pushables - Once
|
||||
|| specialtype == 318 // Unlockable trigger - Once
|
||||
|| specialtype == 320 // Unlockable - Once
|
||||
|
|
Loading…
Reference in a new issue