Additional exit marker types.

This commit is contained in:
Mari the Deer 2021-12-29 21:46:20 +01:00
commit d20773a56f
6 changed files with 42 additions and 16 deletions

View file

@ -297,8 +297,10 @@ extend Class SWWMHandler
let a = SWWMTeleportLine(Actor.Spawn("SWWMTeleportLine"));
a.tline = l;
}
if ( !SWWMUtility.IsExitLine(l) )
continue;
bool isexit;
int exittype;
[isexit, exittype] = SWWMUtility.IsExitLine(l);
if ( !isexit ) continue;
if ( skipme.Find(l) < skipme.Size() ) continue;
skipme.Push(l);
// look for connected lines
@ -362,7 +364,7 @@ extend Class SWWMHandler
for ( int i=0; i<con.Size(); i++ )
lpos += SWWMUtility.UseLinePos(con[i]);
lpos /= con.Size();
SWWMInterest.Spawn(lpos,theline:l);
SWWMInterest.Spawn(lpos,theline:l,theexit:exittype);
}
// spawn loot
if ( !deathmatch ) Chancebox.SpawnChanceboxes();

View file

@ -156,14 +156,14 @@ Class SWWMInterestMarker : MapMarker
States
{
Spawn:
EIXT AB -1;
EIXT ABCD -1;
Stop;
}
}
Class SWWMInterest : Thinker
{
int type;
int type, exittype;
Key trackedkey;
Line trackedline;
Actor marker;
@ -171,7 +171,7 @@ Class SWWMInterest : Thinker
SWWMInterest prev, next;
String keytag;
static SWWMInterest Spawn( Vector3 pos = (0,0,0), Key thekey = null, Line theline = null )
static SWWMInterest Spawn( Vector3 pos = (0,0,0), Key thekey = null, Line theline = null, int theexit = 0 )
{
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( !hnd ) return null;
@ -197,9 +197,9 @@ Class SWWMInterest : Thinker
else if ( theline )
{
i.type = INT_Exit;
i.exittype = theexit;
i.marker = Actor.Spawn("SWWMInterestMarker",pos);
if ( theline.special == Exit_Secret )
i.marker.SetState(i.marker.SpawnState+1);
i.marker.SetState(i.marker.SpawnState+theexit);
}
else
{

View file

@ -14,6 +14,14 @@ enum EDoExplosionFlags
DE_COUNTFHKILLS = 512 // only count kills for enemies that were at full health
};
enum EExitType
{
ET_Normal,
ET_Secret,
ET_EndGame,
ET_NewMap,
};
Struct SWWMProjectionData
{
swwm_GM_Matrix wtc;
@ -410,17 +418,33 @@ Class SWWMUtility
return locknum;
}
static clearscope bool IsExitLine( Line l )
// return if a line is an exit, and additionally the type of exit
static clearscope bool, int IsExitLine( Line l )
{
if ( (l.special == Exit_Normal) || (l.special == Exit_Secret) || (l.special == Teleport_EndGame) || (l.special == Teleport_NewMap) )
return true;
if ( l.special == Exit_Secret )
return true, ET_Secret;
if ( l.special == Exit_Normal )
return true, ET_Normal;
if ( l.special == Teleport_EndGame )
return true, ET_EndGame;
if ( l.special == Teleport_NewMap )
return true, ET_NewMap;
// E1M8 compat
if ( (l.special == ACS_Execute) && (l.Args[0] == -Int('E1M8_KNOCKOUT')) )
return true;
return true, ET_Normal;
// spooktober™
if ( ((l.special == ACS_Execute) || (l.special == ACS_ExecuteAlways)) && (l.Args[0] == -Int('MapFadeOut')) )
return true;
return false;
{
if ( level.levelnum == 1 )
{
let lv = levelinfo.FindLevelByNum(l.Args[2]);
if ( lv && lv.mapname.Left(6) ~== "SECRET" )
return true, ET_Secret;
else return true, ET_NewMap;
}
return true, ET_Normal;
}
return false, ET_Normal;
}
static clearscope bool IsTeleportLine( Line l, bool all = false )