From ade23e99fcb465edbc816027f4619ee9bada244e Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Fri, 5 Nov 2021 20:53:34 +0100 Subject: [PATCH] Pistol start tweaking. --- cvarinfo.base | 5 +- language.def_menu | 10 +++- language.es_menu | 10 +++- language.version | 4 +- menudef.txt | 5 +- zscript/handler/swwm_handler_worldload.zsc | 17 +++--- zscript/swwm_player.zsc | 62 +++++++++++++++++++++- zscript/utility/swwm_utility.zsc | 55 +++++++++++++++---- 8 files changed, 138 insertions(+), 30 deletions(-) diff --git a/cvarinfo.base b/cvarinfo.base index c9b668e57..3bec283b3 100644 --- a/cvarinfo.base +++ b/cvarinfo.base @@ -91,7 +91,10 @@ nosave int swwm_shadowdist = 2000; // max distance beyond which blob shadows ar server bool swwm_swapweapons = true; // [DLC1] allows carrying only one weapon in each slot (excluding starter melee) nosave int swwm_forcestats = 1; // always shows level stats on the HUD, not just when the automap is open (2 - also show map name, otherwise only stats) user int swwm_funtrails = 0; // recolors trails of eviscerator chunks and sheen bullets -server int swwm_pistolstart = 0; // enforces pistol start for all maps (excluding hubs) [2 - only between clusters] +server int swwm_ps_fullreset = 0; // full reset of inventory, including score if enabled (0: no, 1: all maps excluding hubs, 2: between clusters) +server int swwm_ps_resetammo = 0; // resets all ammo to zero +server int swwm_ps_resetitems = 0; // removes all carried items +server int swwm_ps_resethealth = 0; // sets health back to 100 nosave int swwm_numcolor_scr = 5; // font color for score numbers (default: gold) nosave int swwm_numcolor_bonus = 23; // font color for bonus numbers (default: fire) nosave int swwm_numcolor_dmg = 6; // font color for damage numbers (default: red) diff --git a/language.def_menu b/language.def_menu index 1c29925ad..3016abfa0 100644 --- a/language.def_menu +++ b/language.def_menu @@ -155,7 +155,10 @@ SWWM_TRAILS_MAGENTA = "Magenta"; SWWM_TRAILS_RANDOM = "Random"; SWWM_TRAILS_RAINBOW = "Rainbow"; SWWM_TRAILS_TRANS = "TRANS RIGHTS"; -SWWM_PISTOLSTART = "Force Pistol Start"; +SWWM_PS_FULLRESET = "Pistol Start"; +SWWM_PS_RESETAMMO = "Reset Ammo"; +SWWM_PS_RESETITEMS = "Reset Items"; +SWWM_PS_RESETHEALTH = "Reset Health"; SWWM_PISTOLSTART_MAP = "Per-Map"; SWWM_PISTOLSTART_CLUSTER = "Per-Cluster"; SWWM_NUMCOLOR_SCR = "Score Number Color"; @@ -334,7 +337,10 @@ TOOLTIP_SWWM_SHADOWDIST = "Maximum distance at which to show blob shadows. May h TOOLTIP_SWWM_SWAPWEAPONS = "Allow only one weapon per slot (excluding Deep Impact). Disable if you'd rather throw balance out the window."; TOOLTIP_SWWM_FORCESTATS = "Shows map statistics in the HUD even when the automap isn't open."; TOOLTIP_SWWM_FUNTRAILS = "Recolors the trails left by slot 5 weapon projectiles."; -TOOLTIP_SWWM_PISTOLSTART = "Forces you to pistol start between levels/clusters. This excludes travel between levels within a hub, however."; +TOOLTIP_SWWM_PS_FULLRESET = "Clears your entire inventory, excluding collectibles. May include score reset if enabled separately."; +TOOLTIP_SWWM_PS_RESETAMMO = "Clears all your carried ammo, excluding what is already loaded into your weapons."; +TOOLTIP_SWWM_PS_RESETITEMS = "Clears all your carried items that aren't weapons or ammo. Excludes equipped armor."; +TOOLTIP_SWWM_PS_RESETHEALTH = "Sets your health back to 100%, and removes all equipped armor."; TOOLTIP_SWWM_NUMCOLOR_SCR = "Select the color for score numbers."; TOOLTIP_SWWM_NUMCOLOR_BONUS = "Select the color for bonuses that may accompany score numbers."; TOOLTIP_SWWM_NUMCOLOR_DMG = "Select the color for damage numbers."; diff --git a/language.es_menu b/language.es_menu index 30701b5c8..839d964ba 100644 --- a/language.es_menu +++ b/language.es_menu @@ -154,7 +154,10 @@ SWWM_TRAILS_BLUE = "Azul"; SWWM_TRAILS_MAGENTA = "Magenta"; SWWM_TRAILS_RANDOM = "Aleatorio"; SWWM_TRAILS_RAINBOW = "Arcoiris"; -SWWM_PISTOLSTART = "Forzar Pistol Start"; +SWWM_PS_FULLRESET = "Reseteo Completo"; +SWWM_PS_RESETAMMO = "Resetear Munición"; +SWWM_PS_RESETITEMS = "Resetear Ítems"; +SWWM_PS_RESETHEALTH = "Resetear Salud"; SWWM_PISTOLSTART_MAP = "Cada Nivel"; SWWM_PISTOLSTART_CLUSTER = "Cada Clúster"; SWWM_NUMCOLOR_SCR = "Color de Números de Puntos"; @@ -333,7 +336,10 @@ TOOLTIP_SWWM_SHADOWDIST = "Distancia máxima a la que mostrar sombras. Puede ayu TOOLTIP_SWWM_SWAPWEAPONS = "Permite solo un arma por puesto (excluyendo Deep Impact). Desactiva si prefieres tirar el balance por la ventana."; TOOLTIP_SWWM_FORCESTATS = "Muestra estadísticas de mapa en el HUD incluso cuando el automapa no está abierto."; TOOLTIP_SWWM_FUNTRAILS = "Recolorea los rastros dejados por proyectiles de armas de ranura 5."; -TOOLTIP_SWWM_PISTOLSTART = "Fuerza hacer pistol start entre niveles/clústers. Aunque esto excluye viajes entre niveles de un mismo hub."; +TOOLTIP_SWWM_PS_FULLRESET = "Vacía todo tu inventario, excluyendo coleccionables. Puede incluir el reseteo de puntos si está activado."; +TOOLTIP_SWWM_PS_RESETAMMO = "Vacía toda la munición que llevas, excluyendo la que ya esté cargada en tus armas."; +TOOLTIP_SWWM_PS_RESETITEMS = "Vacía todos los ítems que llevas que no sean armas o munición. Excluye la armadura equipada."; +TOOLTIP_SWWM_PS_RESETHEALTH = "Resetea tu salud de vuelta al 100%, y quita toda la armadura equipada."; TOOLTIP_SWWM_NUMCOLOR_SCR = "Selecciona el color para los numeros de puntos."; TOOLTIP_SWWM_NUMCOLOR_BONUS = "Selecciona el color para las bonificaciones que pueden acompañar a los números de puntos."; TOOLTIP_SWWM_NUMCOLOR_DMG = "Selecciona el color para los números de daño."; diff --git a/language.version b/language.version index 83bcd1609..6af5825c2 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1.38 r1 \cu(Fri 5 Nov 20:52:40 CET 2021)\c-"; -SWWM_SHORTVER="\cw1.1.38 r1 \cu(2021-11-05 20:52:40)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1.39 \cu(Fri 5 Nov 20:53:58 CET 2021)\c-"; +SWWM_SHORTVER="\cw1.1.39 \cu(2021-11-05 20:53:58)\c-"; diff --git a/menudef.txt b/menudef.txt index 2e605a4f8..67ff8a9cd 100644 --- a/menudef.txt +++ b/menudef.txt @@ -165,7 +165,10 @@ OptionMenu "SWWMOptionMenu" TrapOption "$SWWM_ENGINE", "swwm_engine" StaticText " " StaticText "$SWWM_BTITLE", "Blue" - Option "$SWWM_PISTOLSTART", "swwm_pistolstart", "SWWMPistolStart" + Option "$SWWM_PS_FULLRESET", "swwm_ps_fullreset", "SWWMPistolStart" + Option "$SWWM_PS_RESETAMMO", "swwm_ps_resetammo", "SWWMPistolStart" + Option "$SWWM_PS_RESETITEMS", "swwm_ps_resetitems", "SWWMPistolStart" + Option "$SWWM_PS_RESETHEALTH", "swwm_ps_resethealth", "SWWMPistolStart" Option "$SWWM_ENEMYDROPS", "swwm_enemydrops", "SWWMEnemyDropType" Option "$SWWM_ONDEMANDAMMO", "swwm_ondemandammo", "YesNo" Option "$SWWM_RESETSCORE", "swwm_resetscore", "YesNo" diff --git a/zscript/handler/swwm_handler_worldload.zsc b/zscript/handler/swwm_handler_worldload.zsc index 00b9cb42f..2b28564c0 100644 --- a/zscript/handler/swwm_handler_worldload.zsc +++ b/zscript/handler/swwm_handler_worldload.zsc @@ -106,16 +106,15 @@ extend Class SWWMHandler } // end of episode resets and enforced pistol starts LevelInfo nextlv = LevelInfo.FindLevelInfo(e.NextMap); - if ( (level.nextsecretmap.Left(6) == "enDSeQ") - || (swwm_pistolstart && nextlv && (level.cluster != nextlv.cluster)) - || ((swwm_pistolstart == 1) && !(level.clusterflags&LevelLocals.CLUSTER_HUB)) ) + for ( int i=0; i 0) && !(level.clusterflags&LevelLocals.CLUSTER_HUB) ) diff --git a/zscript/swwm_player.zsc b/zscript/swwm_player.zsc index 837569423..3f9f81247 100644 --- a/zscript/swwm_player.zsc +++ b/zscript/swwm_player.zsc @@ -1,4 +1,5 @@ // The Demolitionist + Class Demolitionist : PlayerPawn { int last_jump_held, last_boost, last_kick; @@ -75,6 +76,15 @@ Class Demolitionist : PlayerPawn transient bool bWalking; + enum EInvWipe + { + WIPE_EPISODE = 1, + WIPE_CLUSTER = 2, + WIPE_MAP = 4 + } + + int invwipe; // inventory wipe flags for next level + Property DashFuel : dashfuel; Default @@ -2935,8 +2945,56 @@ Class Demolitionist : PlayerPawn // clean up attached actors if ( selflight ) selflight.Destroy(); // inventory wipes - if ( FindInventory("InventoryWipeToken") && (player.playerstate != PST_DEAD) ) - SWWMUtility.WipeInventory(self,swwm_resetscore); + if ( invwipe && (player.playerstate != PST_DEAD) ) + { + bool wiped = false; + bool resetammo = false; + bool resetitems = false; + bool resethealth = false; + if ( invwipe&WIPE_EPISODE ) + { + SWWMUtility.WipeInventory(self,swwm_resetscore); + wiped = true; + } + if ( invwipe&WIPE_CLUSTER ) + { + if ( (swwm_ps_fullreset == 2) && !wiped ) + { + SWWMUtility.WipeInventory(self,swwm_resetscore); + wiped = true; + } + if ( (swwm_ps_resetammo == 2) && !wiped ) + { + SWWMUtility.ResetAmmo(self); + resetammo = true; + } + if ( (swwm_ps_resetitems == 2) && !wiped ) + { + SWWMUtility.ResetItems(self); + resetitems = true; + } + if ( (swwm_ps_resethealth == 2) && !wiped ) + { + SWWMUtility.ResetHealth(self); + resethealth = true; + } + } + if ( invwipe&WIPE_MAP ) + { + if ( (swwm_ps_fullreset == 1) && !wiped ) + { + SWWMUtility.WipeInventory(self,swwm_resetscore); + wiped = true; + } + if ( (swwm_ps_resetammo == 1) && !wiped && !resetammo ) + SWWMUtility.ResetAmmo(self); + if ( (swwm_ps_resetitems == 1) && !wiped && !resetitems ) + SWWMUtility.ResetItems(self); + if ( (swwm_ps_resethealth == 1) && !wiped && !resethealth ) + SWWMUtility.ResetHealth(self); + } + } + invwipe = 0; } override void Travelled() { diff --git a/zscript/utility/swwm_utility.zsc b/zscript/utility/swwm_utility.zsc index 869f63372..14ff99a72 100644 --- a/zscript/utility/swwm_utility.zsc +++ b/zscript/utility/swwm_utility.zsc @@ -1876,6 +1876,50 @@ Class SWWMUtility p.health = p.mo.Health = p.mo.SpawnHealth(); } + // sets all carried ammo back to zero + static play void ResetAmmo( Actor mo ) + { + PlayerInfo p = mo.player; + if ( !p || !p.mo ) return; + for ( Inventory i=p.mo.inv; i; i=i.inv ) + { + if ( !(i is 'Ammo') ) continue; + i.Amount = 0; + } + } + + // removes all carried items that aren't weapons or ammo + static play void ResetItems( Actor mo ) + { + PlayerInfo p = mo.player; + if ( !p || !p.mo ) return; + Actor last = p.mo; + while ( last.inv ) + { + let inv = last.inv; + if ( (inv is 'SWWMCollectible') || (inv is 'Weapon') || (inv is 'Ammo') || (inv is 'SWWMArmor') ) + { + last = inv; + continue; + } + inv.Destroy(); + if ( !inv.bDestroyed ) last = inv; + } + } + + // resets health and removes worn armor + static play void ResetHealth( Actor mo ) + { + PlayerInfo p = mo.player; + if ( !p || !p.mo ) return; + p.health = p.mo.health = 100; + for ( Inventory i=p.mo.inv; i; i=i.inv ) + { + if ( !(i is 'SWWMArmor') ) continue; + i.Amount = 0; + } + } + // WHACK static play void EndLevelDie( Actor victim ) { @@ -2229,14 +2273,3 @@ Class ShinemapDebugSphere : Actor Loop; } } - -// used to indicate that the next level resets inventory -Class InventoryWipeToken : Inventory -{ - default - { - +INVENTORY.UNDROPPABLE; - +INVENTORY.UNTOSSABLE; - +INVENTORY.UNCLEARABLE; - } -}