Fix detection of exit and teleport lines in the minimap.

This commit is contained in:
Mari the Deer 2023-11-22 19:49:39 +01:00
commit 1ab60369b8
2 changed files with 56 additions and 38 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1015 \cu(Wed 22 Nov 19:49:24 CET 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r1015 \cu(2023-11-22 19:49:24)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1016 \cu(Wed 22 Nov 19:49:39 CET 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r1016 \cu(2023-11-22 19:49:39)\c-";

View file

@ -223,35 +223,33 @@ extend Class SWWMStatusBar
}
return true;
}
private bool CheckSectorAction( Sector s, out int special, bool useonly )
private bool CheckWhichSpecial( int type, int special )
{
for ( Actor act=s.SecActTarget; act; act=act.tracer )
if ( type == 1 )
{
if ( (act.Health&(SectorAction.SECSPAC_Use|SectorAction.SECSPAC_UseWall) || !useonly)
&& act.special && !act.bFRIENDLY )
{
special = act.special;
// check for teleport specials
if ( (special == Teleport)
|| (special == Teleport_NoFog)
|| (special == Teleport_ZombieChanger)
|| (special == Teleport_Line) )
return true;
}
return false;
}
return false;
}
private bool RealLineSpecial( Line l, out int special )
{
if ( special && l.activation&SPAC_PlayerActivate )
return true;
if ( CheckSectorAction(l.frontsector,special,!l.backsector) )
return true;
return (l.backsector && CheckSectorAction(l.backsector,special,false));
}
private bool ShowTriggerLine( Line l )
{
if ( am_showtriggerlines == 0 ) return false;
int special = l.special;
if ( !RealLineSpecial(l,special) ) return false;
if ( type == 2 )
{
// check for exit specials
if ( (special == Exit_Normal)
|| (special == Exit_Secret)
|| (special == Teleport_NewMap)
|| (special == Teleport_EndGame) )
return true;
return false;
}
// just check normal specials
if ( !special || (am_showtriggerlines == 0) ) return false;
if ( !ShouldDisplaySpecial(special) ) return false;
if ( special && (am_showtriggerlines >= 2) ) return true;
if ( !special || (special == Door_Open)
if ( (special == Door_Open)
|| (special == Door_Close)
|| (special == Door_CloseWaitOpen)
|| (special == Door_Raise)
@ -260,6 +258,36 @@ extend Class SWWMStatusBar
return false;
return true;
}
private bool CheckSectorAction( Sector s, int type, bool useonly )
{
for ( Actor act=s.SecActTarget; act; act=act.tracer )
{
if ( ((act.Health&(SectorAction.SECSPAC_Use|SectorAction.SECSPAC_UseWall)) || (false == useonly))
&& CheckWhichSpecial(type,act.special) && !act.bFRIENDLY )
return true;
}
return false;
}
private bool RealLineSpecial( Line l, int type )
{
if ( l.activation&SPAC_PlayerActivate && CheckWhichSpecial(type,l.special) )
return true;
if ( CheckSectorAction(l.frontsector,type,!l.backsector) )
return true;
return (l.backsector && CheckSectorAction(l.backsector,type,false));
}
private bool CheckTriggerLine( Line l )
{
return RealLineSpecial(l,0);
}
private bool CheckTeleportLine( Line l )
{
return RealLineSpecial(l,1);
}
private bool CheckExitLine( Line l )
{
return RealLineSpecial(l,2);
}
private bool CmpFloorPlanes( Line l )
{
return (l.frontsector.floorplane.Normal == l.backsector.floorplane.Normal)
@ -270,7 +298,6 @@ extend Class SWWMStatusBar
return (l.frontsector.ceilingplane.Normal == l.backsector.ceilingplane.Normal)
&& (l.frontsector.ceilingplane.D == l.backsector.ceilingplane.D);
}
private int CheckSecret( Line l )
{
if ( !mm_secretsectorcolor || !mm_unexploredsecretcolor )
@ -402,18 +429,9 @@ extend Class SWWMStatusBar
col = mm_secretwallcolor;
else col = mm_wallcolor;
}
else if ( mm_interlevelcolor
&& ((l.special == Exit_Normal)
|| (l.special == Exit_Secret)
|| (l.special == Teleport_NewMap)
|| (l.special == Teleport_EndGame)) )
else if ( mm_interlevelcolor && CheckExitLine(l) )
col = mm_interlevelcolor;
else if ( mm_intralevelcolor &&
(l.activation&SPAC_PlayerActivate)
&& ((l.special == Teleport)
|| (l.special == Teleport_NoFog)
|| (l.special == Teleport_ZombieChanger)
|| (l.special == Teleport_Line)) )
else if ( mm_intralevelcolor && CheckTeleportLine(l) )
col = mm_intralevelcolor;
else if ( (lock > 0) && (lock < 256) )
{
@ -442,7 +460,7 @@ extend Class SWWMStatusBar
else if ( lcol != -1 ) col = lcol;
else col = mm_lockedcolor;
}
else if ( mm_specialwallcolor && ShowTriggerLine(l) )
else if ( mm_specialwallcolor && CheckTriggerLine(l) )
col = mm_specialwallcolor;
else if ( secwit == 1 ) col = mm_secretsectorcolor; // locked doors and trigger lines take priority over secrets
else if ( secwit == 2 ) col = mm_unexploredsecretcolor;