From f8016516d5a8665f3ebe221b1f7524b8bf24a84b Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Fri, 19 Mar 2021 22:16:24 +0100 Subject: [PATCH] Track projectiles in minimap (toggleable). --- cvarinfo.txt | 2 + language.def_menu | 4 ++ language.es_menu | 4 ++ language.version | 4 +- menudef.txt | 2 + zscript/handler/swwm_handler_worldtick.zsc | 27 +++++++++- zscript/hud/swwm_hud.zsc | 60 +++++++++------------- zscript/swwm_thinkers_hud.zsc | 4 ++ 8 files changed, 69 insertions(+), 38 deletions(-) diff --git a/cvarinfo.txt b/cvarinfo.txt index 0fa13efe7..92a51c2dc 100644 --- a/cvarinfo.txt +++ b/cvarinfo.txt @@ -110,6 +110,7 @@ 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 bool swwm_mm_missiles = true; // show projectiles (how revolutionary) 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"; @@ -132,6 +133,7 @@ nosave color swwm_mm_thingcolor_monster = "ff 60 40"; nosave color swwm_mm_thingcolor_ncmonster = "a0 40 20"; nosave color swwm_mm_thingcolor_shootable = "ff a0 a0"; // thingcolor as fallback nosave color swwm_mm_thingcolor_vipitem = "80 60 ff"; // unexploredsecretcolor as fallback +nosave color swwm_mm_thingcolor_missile = "ff a0 20"; // specialwallcolor as fallback nosave color swwm_mm_tswallcolor = "30 20 40"; nosave color swwm_mm_unexploredsecretcolor = "40 00 80"; nosave color swwm_mm_wallcolor = "c0 e0 ff"; diff --git a/language.def_menu b/language.def_menu index a34214b44..6251d092e 100644 --- a/language.def_menu +++ b/language.def_menu @@ -217,6 +217,7 @@ SWWM_MM_ENABLE = "Show Minimap"; SWWM_MM_ROTATE = "Rotate Minimap"; SWWM_MM_GRID = "Show Grid"; SWWM_MM_PORTALOVERLAY = "Overlay Portals"; +SWWM_MM_MISSILES = "Show Projectiles"; SWWM_MM_COLORSET = "Minimap Color Set"; SWWM_OWNCOLORS = "Our Colors"; SWWM_GZDOOMCOLORS = "GZDoom Custom"; @@ -250,6 +251,7 @@ SWWM_MM_THINGCOLOR_ITEM = "Items"; SWWM_MM_THINGCOLOR_CITEM = "Count Items"; SWWM_MM_THINGCOLOR_VIPITEM = "Important Items"; SWWM_MM_THINGCOLOR_SHOOTABLE = "Shootable Actors"; +SWWM_MM_THINGCOLOR_MISSILE = "Projectiles"; TOOLTIP_SWWM_VOICETYPE = "Sets the voice pack for the player."; TOOLTIP_SWWM_MUTEVOICE = "Control what gets muted, if you'd rather have a more silent protagonist."; TOOLTIP_SWWM_FLASHSTRENGTH = "Screen flashes usually happen when firing some weapons, you can lower this if these effects are harmful for you."; @@ -347,6 +349,7 @@ 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_MISSILES = "Displays projectiles in the minimap. Can be toggled if this clutters too much."; 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."; @@ -375,6 +378,7 @@ TOOLTIP_SWWM_MM_THINGCOLOR_ITEM = "Color for items."; TOOLTIP_SWWM_MM_THINGCOLOR_CITEM = "Color for items that count towards map tally."; TOOLTIP_SWWM_MM_THINGCOLOR_VIPITEM = "Color for very important items."; TOOLTIP_SWWM_MM_THINGCOLOR_SHOOTABLE = "Color for things that can be damaged."; +TOOLTIP_SWWM_MM_THINGCOLOR_MISSILE = "Color for projectiles."; // knowledge base SWWM_COMINGSOON = "(coming soon)"; SWWM_MISSTAB = "Mission"; diff --git a/language.es_menu b/language.es_menu index 596f84b02..32fb57654 100644 --- a/language.es_menu +++ b/language.es_menu @@ -214,6 +214,7 @@ 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_MISSILES = "Mostrar Proyectiles"; SWWM_MM_COLORSET = "Set de Colores de Minimapa"; SWWM_OWNCOLORS = "Colores Propios"; SWWM_GZDOOMCOLORS = "Personalizado de GZDoom"; @@ -247,6 +248,7 @@ SWWM_MM_THINGCOLOR_ITEM = "Objetos"; SWWM_MM_THINGCOLOR_CITEM = "Objetos contados"; SWWM_MM_THINGCOLOR_VIPITEM = "Objetos importantes"; SWWM_MM_THINGCOLOR_SHOOTABLE = "Actores vulnerables"; +SWWM_MM_THINGCOLOR_MISSILE = "Proyectiles"; TOOLTIP_SWWM_VOICETYPE = "Selecciona el pack de voz para el jugador."; TOOLTIP_SWWM_MUTEVOICE = "Controla lo que se mutea, si prefieres tener un protagonista más silencioso."; TOOLTIP_SWWM_FLASHSTRENGTH = "Los destellos en pantalla suelen ocurrir al disparar algunas armas, puedes reducirlo si este tipo de efectos te causan malestar."; @@ -344,6 +346,7 @@ 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_MISSILES = "Muestra proyectiles en el minimapa. Puede ser desactivado si causa problemas de visibilidad."; 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."; @@ -372,6 +375,7 @@ TOOLTIP_SWWM_MM_THINGCOLOR_ITEM = "Color para ítems."; TOOLTIP_SWWM_MM_THINGCOLOR_CITEM = "Color para ítems que cuentan para el tanteo del mapa."; TOOLTIP_SWWM_MM_THINGCOLOR_VIPITEM = "Color para ítems muy importantes."; TOOLTIP_SWWM_MM_THINGCOLOR_SHOOTABLE = "Color para cosas que pueden ser dañadas."; +TOOLTIP_SWWM_MM_THINGCOLOR_MISSILE = "Color para proyectiles."; // knowledge base SWWM_COMINGSOON = "(próximamente)"; SWWM_MISSTAB = "Misión"; diff --git a/language.version b/language.version index 5eca259aa..661eac5e7 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r379 \cu(Fri 19 Mar 22:15:44 CET 2021)\c-"; -SWWM_SHORTVER="\cw0.9.11b-pre r379 \cu(2021-03-19 22:15:44)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r379 \cu(Fri 19 Mar 22:16:24 CET 2021)\c-"; +SWWM_SHORTVER="\cw0.9.11b-pre r379 \cu(2021-03-19 22:16:24)\c-"; diff --git a/menudef.txt b/menudef.txt index 36143608e..be086bb09 100644 --- a/menudef.txt +++ b/menudef.txt @@ -210,6 +210,7 @@ OptionMenu "SWWMMinimapMenu" 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_MISSILES", "swwm_mm_missiles", "YesNo" Option "$SWWM_MM_COLORSET", "swwm_mm_colorset", "SWWMMinimapColorset" SafeCommand "$SWWM_MM_RESET", "event swwmresetmmcolors" StaticText " " @@ -239,6 +240,7 @@ OptionMenu "SWWMMinimapMenu" ColorPicker "$SWWM_MM_THINGCOLOR_CITEM", "swwm_mm_thingcolor_citem" ColorPicker "$SWWM_MM_THINGCOLOR_VIPITEM", "swwm_mm_thingcolor_vipitem" ColorPicker "$SWWM_MM_THINGCOLOR_SHOOTABLE", "swwm_mm_thingcolor_shootable" + ColorPicker "$SWWM_MM_THINGCOLOR_MISSILE", "swwm_mm_thingcolor_missile" } AddOptionMenu "OptionsMenu" { diff --git a/zscript/handler/swwm_handler_worldtick.zsc b/zscript/handler/swwm_handler_worldtick.zsc index cc925ebda..cc2d2d5ed 100644 --- a/zscript/handler/swwm_handler_worldtick.zsc +++ b/zscript/handler/swwm_handler_worldtick.zsc @@ -236,6 +236,18 @@ extend Class SWWMHandler continue; SWWMSimpleTracker.Track(a); } + // we need to refer to the suckables array to find missiles + for ( int i=0; i viewdist ) + continue; + if ( !thesight && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) + continue; + SWWMSimpleTracker.Track(a); + } if ( swwm_mm_portaloverlay && (psectors.Size() > 1) ) { // oh boy here we go @@ -266,6 +278,18 @@ extend Class SWWMHandler continue; SWWMSimpleTracker.Track(a); } + // we need to refer to the suckables array to find missiles + for ( int i=0; i viewdist ) + continue; + if ( !thesight && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) + continue; + SWWMSimpleTracker.Track(a); + } } } SWWMSimpleTracker trk = strackers; @@ -279,7 +303,8 @@ extend Class SWWMHandler // "last breath" update if ( (trk.target.bKILLED || (trk.target.Health <= 0)) || ((trk.target is 'Inventory') && (!trk.target.bSPECIAL || Inventory(trk.target).Owner)) - || ((trk.target is 'Chancebox') && (trk.target.CurState != trk.target.SpawnState)) ) + || ((trk.target is 'Chancebox') && (trk.target.CurState != trk.target.SpawnState)) + || (trk.target.default.bMISSILE && !trk.target.bMISSILE) ) trk.Update(); } // prune expired trackers diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index 4283ce68c..ddb46d2c4 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -70,7 +70,7 @@ Class SWWMStatusBar : BaseStatusBar // minimap colors (thats a lot of 'em) int mm_colorset; - Color mm_backcolor, mm_cdwallcolor, mm_efwallcolor, mm_fdwallcolor, mm_gridcolor, mm_interlevelcolor, mm_intralevelcolor, mm_lockedcolor, mm_notseencolor, mm_portalcolor, mm_secretsectorcolor, mm_secretwallcolor, mm_specialwallcolor, mm_thingcolor, mm_thingcolor_citem, mm_thingcolor_friend, mm_thingcolor_item, mm_thingcolor_monster, mm_thingcolor_ncmonster, mm_thingcolor_shootable, mm_thingcolor_vipitem, mm_tswallcolor, mm_unexploredsecretcolor, mm_wallcolor, mm_xhaircolor, mm_yourcolor; + Color mm_backcolor, mm_cdwallcolor, mm_efwallcolor, mm_fdwallcolor, mm_gridcolor, mm_interlevelcolor, mm_intralevelcolor, mm_lockedcolor, mm_notseencolor, mm_portalcolor, mm_secretsectorcolor, mm_secretwallcolor, mm_specialwallcolor, mm_thingcolor, mm_thingcolor_citem, mm_thingcolor_friend, mm_thingcolor_item, mm_thingcolor_monster, mm_thingcolor_ncmonster, mm_thingcolor_shootable, mm_thingcolor_vipitem, mm_thingcolor_missile, mm_tswallcolor, mm_unexploredsecretcolor, mm_wallcolor, mm_xhaircolor, mm_yourcolor; bool mm_displaylocks; // if playing in Japanese, returns an alternate font of the same height @@ -877,6 +877,7 @@ Class SWWMStatusBar : BaseStatusBar mm_thingcolor_ncmonster = am_thingcolor_ncmonster; mm_thingcolor_shootable = am_thingcolor; mm_thingcolor_vipitem = am_unexploredsecretcolor; + mm_thingcolor_missile = am_specialwallcolor; mm_tswallcolor = am_tswallcolor; mm_unexploredsecretcolor = am_unexploredsecretcolor; mm_wallcolor = am_wallcolor; @@ -907,6 +908,7 @@ Class SWWMStatusBar : BaseStatusBar mm_thingcolor_ncmonster = "74 fc 6c"; mm_thingcolor_shootable = "74 fc 6c"; mm_thingcolor_vipitem = "74 fc 6c"; + mm_thingcolor_missile = "74 fc 6c"; mm_tswallcolor = "80 80 80"; mm_unexploredsecretcolor = 0; mm_wallcolor = "fc 00 00"; @@ -937,6 +939,7 @@ Class SWWMStatusBar : BaseStatusBar mm_thingcolor_ncmonster = "fc 00 00"; mm_thingcolor_shootable = "bb 3b 00"; mm_thingcolor_vipitem = "db ab 00"; + mm_thingcolor_missile = "bb 3b 00"; mm_tswallcolor = "77 73 73"; mm_unexploredsecretcolor = 0; mm_wallcolor = "c7 ce ce"; @@ -967,6 +970,7 @@ Class SWWMStatusBar : BaseStatusBar mm_thingcolor_ncmonster = "ec ec ec"; mm_thingcolor_shootable = "ec ec ec"; mm_thingcolor_vipitem = "ec ec ec"; + mm_thingcolor_missile = "ec ec ec"; mm_tswallcolor = "58 5d 56"; mm_unexploredsecretcolor = 0; mm_wallcolor = "4b 32 10"; @@ -997,6 +1001,7 @@ Class SWWMStatusBar : BaseStatusBar mm_thingcolor_ncmonster = swwm_mm_thingcolor_ncmonster; mm_thingcolor_shootable = swwm_mm_thingcolor_shootable; mm_thingcolor_vipitem = swwm_mm_thingcolor_vipitem; + mm_thingcolor_missile = swwm_mm_thingcolor_missile; mm_tswallcolor = swwm_mm_tswallcolor; mm_unexploredsecretcolor = swwm_mm_unexploredsecretcolor; mm_wallcolor = swwm_mm_wallcolor; @@ -1334,6 +1339,7 @@ Class SWWMStatusBar : BaseStatusBar Sector csec = players[consoleplayer].Camera.CurSector; for ( SWWMSimpleTracker t=hnd.strackers; t; t=t.next ) { + if ( !swwm_mm_missiles && t.ismissile ) continue; Color col = mm_thingcolor; bool isitem = false; bool plainactor = false; @@ -1345,46 +1351,30 @@ Class SWWMStatusBar : BaseStatusBar pos = t.target.prev.xy*(1.-FracTic)+t.target.pos.xy*FracTic; angle = t.target.angle; radius = t.target.radius; - if ( t.isitem ) - { - if ( SWWMUtility.IsVipItem(t.target) ) col = mm_thingcolor_vipitem; - else if ( SWWMUtility.IsScoreItem(t.target) ) col = mm_thingcolor_citem; - else col = mm_thingcolor_item; - isitem = true; - } - else if ( t.target.player ) col = t.target.player.GetColor(); - else if ( t.target.bFRIENDLY ) col = mm_thingcolor_friend; - else if ( t.target.bCOUNTKILL ) col = mm_thingcolor_monster; - else if ( t.target.bISMONSTER ) col = mm_thingcolor_ncmonster; - else - { - if ( SWWMUtility.IsVipItem(t.target) ) col = mm_thingcolor_vipitem; // chanceboxes - else if ( t.target.bSHOOTABLE ) col = mm_thingcolor_shootable; - plainactor = true; - } } else { pos = t.pos.xy; angle = t.angle; radius = t.radius; - if ( t.isitem ) - { - if ( t.vipitem ) col = mm_thingcolor_vipitem; - else if ( t.countitem ) col = mm_thingcolor_citem; - else col = mm_thingcolor_item; - isitem = true; - } - if ( t.isplayer ) col = t.playercol; - else if ( t.friendly ) col = mm_thingcolor_friend; - else if ( t.countkill ) col = mm_thingcolor_monster; - else if ( t.ismonster ) col = mm_thingcolor_ncmonster; - else - { - if ( t.vipitem ) col = mm_thingcolor_vipitem; // chanceboxes - else if ( t.shootable ) col = mm_thingcolor_shootable; - plainactor = true; - } + } + if ( t.isitem ) + { + if ( t.vipitem ) col = mm_thingcolor_vipitem; + else if ( t.countitem ) col = mm_thingcolor_citem; + else col = mm_thingcolor_item; + isitem = true; + } + else if ( t.isplayer ) col = t.playercol; + else if ( t.friendly ) col = mm_thingcolor_friend; + else if ( t.countkill ) col = mm_thingcolor_monster; + else if ( t.ismonster ) col = mm_thingcolor_ncmonster; + else if ( t.ismissile ) col = mm_thingcolor_missile; + else + { + if ( t.vipitem ) col = mm_thingcolor_vipitem; // chanceboxes + else if ( t.shootable ) col = mm_thingcolor_shootable; + plainactor = true; } int mtime = 35; if ( thesight && !t.expired && t.target ) mtime += 105; diff --git a/zscript/swwm_thinkers_hud.zsc b/zscript/swwm_thinkers_hud.zsc index 8bab7f7f6..6f0fb6d9c 100644 --- a/zscript/swwm_thinkers_hud.zsc +++ b/zscript/swwm_thinkers_hud.zsc @@ -486,6 +486,7 @@ Class SWWMSimpleTracker : Thinker bool countitem; bool vipitem; bool expired; + bool ismissile; int lastupdate; ui double smoothalpha; // smoothened alpha, for ui SWWMSimpleTracker prev, next; @@ -502,6 +503,7 @@ Class SWWMSimpleTracker : Thinker friendly = target.IsFriend(players[consoleplayer].mo); countkill = target.bCOUNTKILL; shootable = target.default.bSHOOTABLE; + ismissile = target.default.bMISSILE; isitem = (target is 'Inventory'); countitem = SWWMUtility.IsScoreItem(target); vipitem = SWWMUtility.IsVipItem(target); @@ -544,6 +546,8 @@ Class SWWMSimpleTracker : Thinker lastupdate += 70; } } + else if ( ismissile ) + expired = !target.bMISSILE; else if ( target.default.bSHOOTABLE ) expired = (target.Health<=0); }