Show "all keys" doors as multicolor in the minimap.

Deprecate IsValidLockNum and GetLockColor utility functions.
This commit is contained in:
Mari the Deer 2022-12-23 18:26:12 +01:00
commit 116bca4b0b
4 changed files with 33 additions and 9 deletions

View file

@ -518,7 +518,28 @@ extend Class SWWMStatusBar
&& (lock > 0) && (lock < 256) )
{
let lcol = SWWMUtility.GetLockColor(lock);
if ( lcol ) col = lcol;
if ( !lcol )
{
// "all keys" locks lack a color
// so we cycle through the colors of all available keys
if ( gameinfo.gametype&GAME_Doom )
{
Color cols[3] = {0xFFFF0000,0xFF0000FF,0xFFFFFF00};
col = cols[int(((gametic+fractic)*3)/GameTicRate)%3];
}
else if ( gameinfo.gametype&GAME_Heretic )
{
Color cols[3] = {0xFFFFFF00,0xFF00FF00,0xFF0000FF};
col = cols[int(((gametic+fractic)*3)/GameTicRate)%3];
}
else if ( gameinfo.gametype&GAME_Hexen )
{
Color cols[11] = {0xFF969696,0xFFFFDA00,0xFF4040FF,0xFFFF8000,0xFF00FF00,0xFF2F97FF,0xFF9A98BC,0xFF9C4C00,0xFFFFD900,0xFF40FF40,0xFFFF4040};
col = cols[int(((gametic+fractic)*11)/GameTicRate)%11];
}
else col = mm_lockedcolor; // fallback
}
else if ( lcol != -1 ) col = lcol;
else col = mm_lockedcolor;
}
else if ( mm_specialwallcolor && ShowTriggerLine(l) )

View file

@ -198,13 +198,16 @@ Class SWWMCachedLockInfo : SWWMStaticThinker
{
let ti = ThinkerIterator.Create("SWWMCachedLockInfo",STAT_STATIC);
SWWMCachedLockInfo cli = SWWMCachedLockInfo(ti.Next());
if ( !cli ) return 0;
if ( !cli ) return -1;
foreach ( e:cli.ent )
{
if ( (e.locknumber == l) && e.hascolor )
return e.mapcolor;
if ( e.locknumber == l )
{
if ( e.hascolor ) return e.mapcolor;
return 0;
}
}
return 0;
return -1;
}
static SWWMCachedLockInfo GetInstance()

View file

@ -208,13 +208,13 @@ extend Class SWWMUtility
return false;
}
static bool IsValidLockNum( int l )
deprecated("4.11","Use Key.IsLockDefined() instead") static bool IsValidLockNum( int l )
{
if ( (l < 1) || (l > 255) ) return true;
return SWWMCachedLockInfo.IsValidLock(l);
}
static Color GetLockColor( int l )
deprecated("4.11","Use Key.GetMapColorForLock() instead") static Color GetLockColor( int l )
{
return SWWMCachedLockInfo.GetLockColor(l);
}