Minimap portal overlay support (oh my).
This commit is contained in:
parent
5ac45d68cd
commit
8ceaafc382
8 changed files with 104 additions and 15 deletions
|
|
@ -107,6 +107,7 @@ nosave bool swwm_mm_enable = true; // show a minimap below the score counter
|
|||
nosave noarchive float swwm_mm_zoom = 1; // zoom level of minimap
|
||||
nosave bool swwm_mm_rotate = true; // rotate minimap
|
||||
nosave bool swwm_mm_grid = false; // show blockmap grid plus (0,0) crosshair
|
||||
nosave bool swwm_mm_portaloverlay = true; // show portal overlays, like the gzdoom automap (but unlike the gzdoom automap, we also overlay actors)
|
||||
nosave int swwm_mm_colorset = 0; // 0: SWWM GZ, 1: GZDoom, 2: Doom, 3: Strife, 4: Raven
|
||||
nosave color swwm_mm_backcolor = "10 10 10";
|
||||
nosave color swwm_mm_cdwallcolor = "30 50 70";
|
||||
|
|
@ -117,7 +118,7 @@ nosave color swwm_mm_interlevelcolor = "ff 00 60";
|
|||
nosave color swwm_mm_intralevelcolor = "00 60 ff";
|
||||
nosave color swwm_mm_lockedcolor = "00 80 00";
|
||||
nosave color swwm_mm_notseencolor = "20 20 30";
|
||||
nosave color swwm_mm_portalcolor = "40 30 20"; // unused
|
||||
nosave color swwm_mm_portalcolor = "40 30 20";
|
||||
nosave color swwm_mm_secretsectorcolor = "80 00 ff";
|
||||
nosave color swwm_mm_secretwallcolor = "60 40 80";
|
||||
nosave color swwm_mm_specialwallcolor = "ff a0 00";
|
||||
|
|
|
|||
|
|
@ -212,6 +212,7 @@ SWWM_MMTITLE = "Minimap Settings";
|
|||
SWWM_MM_ENABLE = "Show Minimap";
|
||||
SWWM_MM_ROTATE = "Rotate Minimap";
|
||||
SWWM_MM_GRID = "Show Grid";
|
||||
SWWM_MM_PORTALOVERLAY = "Overlay Portals";
|
||||
SWWM_MM_COLORSET = "Minimap Color Set";
|
||||
SWWM_OWNCOLORS = "Our Colors";
|
||||
SWWM_GZDOOMCOLORS = "GZDoom Custom";
|
||||
|
|
@ -339,6 +340,7 @@ TOOLTIP_SWWM_ITEMSPARKLES = "Nearby items will have particles around them, as a
|
|||
TOOLTIP_SWWM_MM_ENABLE = "Displays a minimap under the score counter.";
|
||||
TOOLTIP_SWWM_MM_ROTATE = "Rotates the minimap view.";
|
||||
TOOLTIP_SWWM_MM_GRID = "Shows a 128x128 grid on the minimap.";
|
||||
TOOLTIP_SWWM_MM_PORTALOVERLAY = "Overlays regions belonging to static portals, along with things contained within them.";
|
||||
TOOLTIP_SWWM_MM_COLORSET = "Choose what palette to use for the minimap.";
|
||||
TOOLTIP_EVENT_SWWMRESETMMCOLORS = "Resets all these colors to their original values.";
|
||||
TOOLTIP_SWWM_MM_BACKCOLOR = "Color of the minimap drawing area.";
|
||||
|
|
@ -356,7 +358,7 @@ TOOLTIP_SWWM_MM_INTERLEVELCOLOR = "Color of teleporters that go to another map,
|
|||
TOOLTIP_SWWM_MM_SECRETSECTORCOLOR = "Color of revealed secret sectors.";
|
||||
TOOLTIP_SWWM_MM_UNEXPLOREDSECRETCOLOR = "Color of secret sectors that haven't been explored yet.";
|
||||
TOOLTIP_SWWM_MM_SPECIALWALLCOLOR = "Color of special lines that the player can activate.";
|
||||
TOOLTIP_SWWM_MM_PORTALCOLOR = "Color of map lines belonging to a static portal (not implemented).";
|
||||
TOOLTIP_SWWM_MM_PORTALCOLOR = "Color to tint map lines belonging to a static portal, also used for things contained in it.";
|
||||
TOOLTIP_SWWM_MM_TSWALLCOLOR = "Color of lines with no height difference, hidden unless using cheats.";
|
||||
TOOLTIP_SWWM_MM_SECRETWALLCOLOR = "Color of lines that are flagged as secret, only shown using cheats.";
|
||||
TOOLTIP_SWWM_MM_THINGCOLOR = "Color for general things in the map.";
|
||||
|
|
|
|||
|
|
@ -209,6 +209,7 @@ SWWM_MMTITLE = "Opciones de Minimapa";
|
|||
SWWM_MM_ENABLE = "Mostrar Minimapa";
|
||||
SWWM_MM_ROTATE = "Rotar Minimapa";
|
||||
SWWM_MM_GRID = "Mostrar Cuadrícula";
|
||||
SWWM_MM_PORTALOVERLAY = "Superposición de Portales";
|
||||
SWWM_MM_COLORSET = "Set de Colores de Minimapa";
|
||||
SWWM_OWNCOLORS = "Colores Propios";
|
||||
SWWM_GZDOOMCOLORS = "Personalizado de GZDoom";
|
||||
|
|
@ -336,6 +337,7 @@ TOOLTIP_SWWM_ITEMSPARKLES = "Los ítems cercanos tendrán partículas alrededor,
|
|||
TOOLTIP_SWWM_MM_ENABLE = "Muestra un minimapa bajo el contador de puntuación.";
|
||||
TOOLTIP_SWWM_MM_ROTATE = "Gira la vista del minimapa.";
|
||||
TOOLTIP_SWWM_MM_GRID = "Muestra una cuadrícula de 128x128 en el minimapa.";
|
||||
TOOLTIP_SWWM_MM_PORTALOVERLAY = "Sobrepone regiones que pertenecen a portales estáticos, junto con los objetos que contengan.";
|
||||
TOOLTIP_SWWM_MM_COLORSET = "Selecciona que paleta usar para el minimapa.";
|
||||
TOOLTIP_EVENT_SWWMRESETMMCOLORS = "Resetea estos colores a sus valores originales.";
|
||||
TOOLTIP_SWWM_MM_BACKCOLOR = "Color del área de dibujo del mapa.";
|
||||
|
|
@ -353,7 +355,7 @@ TOOLTIP_SWWM_MM_INTERLEVELCOLOR = "Color para teletransportes a otro mapa, o sal
|
|||
TOOLTIP_SWWM_MM_SECRETSECTORCOLOR = "Color de sectores secretos revelados.";
|
||||
TOOLTIP_SWWM_MM_UNEXPLOREDSECRETCOLOR = "Color de sectores secretos que aun no han sido explorados.";
|
||||
TOOLTIP_SWWM_MM_SPECIALWALLCOLOR = "Color de líneas especiales que el jugador puede activar.";
|
||||
TOOLTIP_SWWM_MM_PORTALCOLOR = "Color de líneas de mapa que forman parte de un portal estático (no implementado).";
|
||||
TOOLTIP_SWWM_MM_PORTALCOLOR = "Color que tiñe líneas de mapa que forman parte de un portal estático, también usado para objetos dentro del mismo.";
|
||||
TOOLTIP_SWWM_MM_TSWALLCOLOR = "Color de líneas sin diferencia de altura, ocultas a menos que se usen trucos.";
|
||||
TOOLTIP_SWWM_MM_SECRETWALLCOLOR = "Color de líneas marcadas como secretas, solo mostradas usando trucos.";
|
||||
TOOLTIP_SWWM_MM_THINGCOLOR = "Color para cosas generales en el mapa.";
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r310 \cu(Wed 24 Feb 01:00:35 CET 2021)\c-";
|
||||
SWWM_SHORTVER="\cw0.9.11b-pre r310 \cu(2021-02-24 01:00:35)\c-";
|
||||
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r311 \cu(Wed 24 Feb 21:40:54 CET 2021)\c-";
|
||||
SWWM_SHORTVER="\cw0.9.11b-pre r311 \cu(2021-02-24 21:40:54)\c-";
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ OptionMenu "SWWMMinimapMenu"
|
|||
Option "$SWWM_MM_ENABLE", "swwm_mm_enable", "YesNo"
|
||||
Option "$SWWM_MM_ROTATE", "swwm_mm_rotate", "YesNo"
|
||||
Option "$SWWM_MM_GRID", "swwm_mm_grid", "YesNo"
|
||||
Option "$SWWM_MM_PORTALOVERLAY", "swwm_mm_portaloverlay", "YesNo"
|
||||
Option "$SWWM_MM_COLORSET", "swwm_mm_colorset", "SWWMMinimapColorset"
|
||||
SafeCommand "$SWWM_MM_RESET", "event swwmresetmmcolors"
|
||||
StaticText " "
|
||||
|
|
@ -225,7 +226,7 @@ OptionMenu "SWWMMinimapMenu"
|
|||
ColorPicker "$SWWM_MM_SECRETSECTORCOLOR", "swwm_mm_secretsectorcolor"
|
||||
ColorPicker "$SWWM_MM_UNEXPLOREDSECRETCOLOR", "swwm_mm_unexploredsecretcolor"
|
||||
ColorPicker "$SWWM_MM_SPECIALWALLCOLOR", "swwm_mm_specialwallcolor"
|
||||
//ColorPicker "$SWWM_MM_PORTALCOLOR", "swwm_mm_portalcolor"
|
||||
ColorPicker "$SWWM_MM_PORTALCOLOR", "swwm_mm_portalcolor"
|
||||
ColorPicker "$SWWM_MM_TSWALLCOLOR", "swwm_mm_tswallcolor"
|
||||
ColorPicker "$SWWM_MM_SECRETWALLCOLOR", "swwm_mm_secretwallcolor"
|
||||
ColorPicker "$SWWM_MM_THINGCOLOR", "swwm_mm_thingcolor"
|
||||
|
|
|
|||
|
|
@ -302,6 +302,10 @@ Class SWWMHandler : EventHandler
|
|||
// attempt to optimize Ynykron singularity suction
|
||||
Array<Actor> suckableactors;
|
||||
|
||||
// list contains a sector that belongs to each portal group
|
||||
// used to ease some portal-aware functions
|
||||
Array<int> psectors;
|
||||
|
||||
// vanilla boss stuff
|
||||
String bosstag;
|
||||
Array<Actor> bossactors;
|
||||
|
|
@ -947,10 +951,15 @@ Class SWWMHandler : EventHandler
|
|||
let cli = SWWMCachedLockInfo.GetInstance();
|
||||
if ( cli.ent.Size() == 0 ) SetupLockdefsCache(cli);
|
||||
// keep a list of sectors containing 3D floors, for use by the minimap
|
||||
// also does the same for the portal group list
|
||||
ffsectors.Clear();
|
||||
psectors.Clear();
|
||||
for ( int i=0; i<level.sectors.Size(); i++ )
|
||||
{
|
||||
Sector s = level.sectors[i];
|
||||
if ( psectors.Size() <= s.portalgroup )
|
||||
psectors.Resize(s.portalgroup+1);
|
||||
psectors[s.portalgroup] = s.Index();
|
||||
if ( !s.Get3DFloorCount() ) continue;
|
||||
int realcount = 0;
|
||||
for ( int j=0; j<s.Get3DFloorCount(); j++ )
|
||||
|
|
@ -1479,6 +1488,38 @@ Class SWWMHandler : EventHandler
|
|||
continue;
|
||||
SWWMSimpleTracker.Track(a);
|
||||
}
|
||||
if ( swwm_mm_portaloverlay && (psectors.Size() > 1) )
|
||||
{
|
||||
// oh boy here we go
|
||||
int thisgroup = players[consoleplayer].Camera.CurSector.portalgroup;
|
||||
for ( int i=0; i<psectors.Size(); i++ )
|
||||
{
|
||||
if ( i == thisgroup ) continue;
|
||||
Vector2 relpos = players[consoleplayer].Camera.pos.xy+SWWMUtility.PortalDisplacement(level.Sectors[psectors[thisgroup]],level.Sectors[psectors[i]]);
|
||||
bt = BlockThingsIterator.CreateFromPos(relpos.x,relpos.y,players[consoleplayer].Camera.pos.z,players[consoleplayer].Camera.pos.z+players[consoleplayer].Camera.height,viewdist,false);
|
||||
while ( bt.Next() )
|
||||
{
|
||||
let a = bt.Thing;
|
||||
if ( !a ) continue;
|
||||
Vector2 rv = a.pos.xy-relpos;
|
||||
if ( max(abs(rv.x)-a.radius,abs(rv.y)-a.radius) > viewdist )
|
||||
continue;
|
||||
if ( a == players[consoleplayer].Camera )
|
||||
continue;
|
||||
if ( !a.player && !a.bSOLID && !a.bSHOOTABLE && !a.bISMONSTER && !a.bFRIENDLY && !(a is 'Inventory') && !(a is 'Chancebox') )
|
||||
continue;
|
||||
if ( !thesight && !a.IsFriend(players[consoleplayer].mo) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
|
||||
continue;
|
||||
if ( a.bKILLED || (a.Health <= 0) )
|
||||
continue;
|
||||
if ( (a is 'Inventory') && (!a.bSPECIAL || Inventory(a).Owner) )
|
||||
continue;
|
||||
if ( (a is 'Chancebox') && (a.CurState != a.SpawnState) )
|
||||
continue;
|
||||
SWWMSimpleTracker.Track(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
SWWMSimpleTracker trk = strackers;
|
||||
while ( trk )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1006,7 +1006,6 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShouldDisplaySpecial( int special )
|
||||
{
|
||||
// thanks graf/randi/whoever
|
||||
|
|
@ -1041,7 +1040,6 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CheckSectorAction( Sector s, out int special, bool useonly )
|
||||
{
|
||||
for ( Actor act=s.SecActTarget; act; act=act.tracer )
|
||||
|
|
@ -1055,7 +1053,6 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool RealLineSpecial( Line l, out int special )
|
||||
{
|
||||
if ( special && l.activation&SPAC_PlayerActivate )
|
||||
|
|
@ -1064,7 +1061,6 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
return true;
|
||||
return (l.backsector && CheckSectorAction(l.backsector,special,false));
|
||||
}
|
||||
|
||||
private bool ShowTriggerLine( Line l )
|
||||
{
|
||||
if ( am_showtriggerlines == 0 ) return false;
|
||||
|
|
@ -1123,7 +1119,7 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
{
|
||||
double zoomlevel = oldminimapzoom*(1.-FracTic)+minimapzoom*FracTic;
|
||||
double zoomview = MAPVIEWDIST*zoomlevel, zoomclip = CLIPDIST*zoomlevel;
|
||||
Vector2 cpos = CPlayer.Camera.prev.xy*(1.-FracTic)+CPlayer.Camera.pos.xy*FracTic;
|
||||
Vector2 cpos = players[consoleplayer].Camera.prev.xy*(1.-FracTic)+players[consoleplayer].Camera.pos.xy*FracTic;
|
||||
// find farthest visible southwest grid point from camera position
|
||||
int maxlines = int(zoomview/64);
|
||||
Vector2 gpt = (cpos-(zoomview,zoomview))/128;
|
||||
|
|
@ -1225,7 +1221,8 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
{
|
||||
double zoomlevel = oldminimapzoom*(1.-FracTic)+minimapzoom*FracTic;
|
||||
double zoomview = MAPVIEWDIST*zoomlevel, zoomclip = CLIPDIST*zoomlevel;
|
||||
Vector2 cpos = CPlayer.Camera.prev.xy*(1.-FracTic)+CPlayer.Camera.pos.xy*FracTic;
|
||||
Vector2 cpos = players[consoleplayer].Camera.prev.xy*(1.-FracTic)+players[consoleplayer].Camera.pos.xy*FracTic;
|
||||
Sector csec = players[consoleplayer].Camera.CurSector;
|
||||
for ( int i=0; i<level.lines.Size(); i++ )
|
||||
{
|
||||
Line l = level.lines[i];
|
||||
|
|
@ -1233,6 +1230,21 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
if ( (l.flags&Line.ML_DONTDRAW) && ((am_cheat == 0) || (am_cheat >= 4)) )
|
||||
continue;
|
||||
Vector2 rv1 = l.v1.p-cpos, rv2 = l.v2.p-cpos;
|
||||
bool isportal = false;
|
||||
if ( swwm_mm_portaloverlay )
|
||||
{
|
||||
Sector linesector;
|
||||
if ( l.sidedef[0].flags&Side.WALLF_POLYOBJ ) linesector = level.PointInSector(l.v1.p+l.delta/2.);
|
||||
else linesector = l.frontsector;
|
||||
isportal = (linesector.portalgroup!=csec.portalgroup);
|
||||
if ( isportal )
|
||||
{
|
||||
// portal displacement
|
||||
Vector2 pofs = SWWMUtility.PortalDisplacement(csec,linesector);
|
||||
rv1 -= pofs;
|
||||
rv2 -= pofs;
|
||||
}
|
||||
}
|
||||
if ( min(min(abs(rv1.x),abs(rv2.x)),min(abs(rv1.y),abs(rv2.y))) > zoomview )
|
||||
continue;
|
||||
// flip Y
|
||||
|
|
@ -1306,7 +1318,12 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
}
|
||||
else col = mm_notseencolor;
|
||||
// draw the line
|
||||
Screen.DrawThickLine(int(rv1.x),int(rv1.y),int(rv2.x),int(rv2.y),max(1.,hs.x*.5),col);
|
||||
if ( isportal )
|
||||
{
|
||||
col = Color((col.r+mm_portalcolor.r*7)/8,(col.g+mm_portalcolor.g*7)/8,(col.b+mm_portalcolor.b*7)/8);
|
||||
Screen.DrawThickLine(int(rv1.x),int(rv1.y),int(rv2.x),int(rv2.y),max(1.,hs.x*.25),col);
|
||||
}
|
||||
else Screen.DrawThickLine(int(rv1.x),int(rv1.y),int(rv2.x),int(rv2.y),max(1.,hs.x*.5),col);
|
||||
}
|
||||
}
|
||||
private void DrawMapThings( Vector2 basepos )
|
||||
|
|
@ -1314,7 +1331,8 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
bool thesight = !!CPlayer.mo.FindInventory("Omnisight");
|
||||
double zoomlevel = oldminimapzoom*(1.-FracTic)+minimapzoom*FracTic;
|
||||
double zoomview = MAPVIEWDIST*zoomlevel, zoomclip = CLIPDIST*zoomlevel;
|
||||
Vector2 cpos = CPlayer.Camera.prev.xy*(1.-FracTic)+CPlayer.Camera.pos.xy*FracTic;
|
||||
Vector2 cpos = players[consoleplayer].Camera.prev.xy*(1.-FracTic)+players[consoleplayer].Camera.pos.xy*FracTic;
|
||||
Sector csec = players[consoleplayer].Camera.CurSector;
|
||||
for ( SWWMSimpleTracker t=hnd.strackers; t; t=t.next )
|
||||
{
|
||||
Color col = mm_thingcolor;
|
||||
|
|
@ -1372,6 +1390,19 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
int mtime = 35;
|
||||
if ( thesight && !t.expired && t.target ) mtime += 105;
|
||||
Vector2 rv = pos-cpos;
|
||||
bool isportal = false;
|
||||
if ( swwm_mm_portaloverlay )
|
||||
{
|
||||
Sector sec = level.PointInSector(pos);
|
||||
if ( sec.portalgroup != csec.portalgroup )
|
||||
{
|
||||
isportal = true;
|
||||
// portal displacement
|
||||
rv -= SWWMUtility.PortalDisplacement(csec,sec);
|
||||
// and blend in the color too
|
||||
col = Color((col.r+mm_portalcolor.r*7)/8,(col.g+mm_portalcolor.g*7)/8,(col.b+mm_portalcolor.b*7)/8);
|
||||
}
|
||||
}
|
||||
if ( min(abs(rv.x)-radius,abs(rv.y)-radius) > zoomview )
|
||||
continue;
|
||||
Vector2 tv[4];
|
||||
|
|
@ -1420,7 +1451,8 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
x0 += basepos;
|
||||
x1 += basepos;
|
||||
// draw the line
|
||||
Screen.DrawThickLine(int(x0.x),int(x0.y),int(x1.x),int(x1.y),max(1.,hs.x*.5),col,int(t.smoothalpha*255));
|
||||
if ( isportal ) Screen.DrawThickLine(int(x0.x),int(x0.y),int(x1.x),int(x1.y),max(1.,hs.x*.25),col,int(t.smoothalpha*255));
|
||||
else Screen.DrawThickLine(int(x0.x),int(x0.y),int(x1.x),int(x1.y),max(1.,hs.x*.5),col,int(t.smoothalpha*255));
|
||||
drawn = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -967,6 +967,16 @@ Class SWWMUtility
|
|||
return false;
|
||||
}
|
||||
|
||||
// get how much a sector's physical position is offset by portals
|
||||
static Vector2 PortalDisplacement( Sector a, Sector b )
|
||||
{
|
||||
if ( a.portalgroup == b.portalgroup ) return (0,0); // ez
|
||||
// we can't access level.displacements, so we gotta improvise
|
||||
Vector2 pdisp = b.centerspot-a.centerspot;
|
||||
Vector2 vdisp = level.Vec2Diff(a.centerspot,b.centerspot);
|
||||
return pdisp-vdisp;
|
||||
}
|
||||
|
||||
// shorthand for some of these checks (these are generally used by the mission briefing system)
|
||||
static bool IsKnownMap()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue