From e9013694f0664ce777fe5401003d4c554d0b18af Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Wed, 31 Aug 2022 10:58:25 +0200 Subject: [PATCH] Legion of Bones support. --- cvarinfo.base | 1 + language.def_menu | 2 + language.es_menu | 2 + language.version | 4 +- menudef.txt | 1 + zscript/handler/swwm_handler_replacements.zsc | 142 +++++++++++++++--- zscript/swwm_handler.zsc | 9 +- 7 files changed, 137 insertions(+), 24 deletions(-) diff --git a/cvarinfo.base b/cvarinfo.base index 0117234f5..f6adb1ed9 100644 --- a/cvarinfo.base +++ b/cvarinfo.base @@ -85,6 +85,7 @@ nosave bool swwm_nointroex = false; // does not play the "explosions" intro seq server bool swwm_bonkhammer = false; // combat hammer makes bonk sounds when hitting enemies server int swwm_friendlyfire = 0; // 0: allow all friendly fire, 1: block incoming damage, 2: block incoming and outgoing damage nosave bool swwm_showmaptitle = false; // shows the name of the map when entering, just like in dark souls! +server bool swwm_lobdoubled = false; // [LOB] Enable Double Death monster spawns // minimap settings nosave bool swwm_mm_enable = true; // show a minimap below the score counter diff --git a/language.def_menu b/language.def_menu index 39ee82d1c..245665c77 100644 --- a/language.def_menu +++ b/language.def_menu @@ -186,6 +186,7 @@ SWWM_FF_INCOMING = "Block Incoming"; SWWM_FF_ALL = "Block All"; SWWM_DAMNUMS_COLOR = "Color Damage Numbers"; SWWM_SHOWMAPTITLE = "Animated Map Title"; +SWWM_LOBDOUBLED = "LOB Double Death"; SWWM_MM_ENABLE = "Show Minimap"; SWWM_MM_MISSILES = "Projectiles In Minimap"; SWWM_MM_COLORSET = "Minimap Color Set"; @@ -285,6 +286,7 @@ TOOLTIP_SWWM_BONKHAMMER = "The Combat Hammer will make funny sounds when hitting TOOLTIP_SWWM_FRIENDLYFIRE = "Controls whether friendlies can deal damage to or take damage from the player."; TOOLTIP_SWWM_DAMNUMS_COLOR = "Damage numbers will change color based on the type of damage dealt. Otherwise, default to red."; TOOLTIP_SWWM_SHOWMAPTITLE = "Shows an animated title card when entering a map. It's just like Dark Souls!"; +TOOLTIP_SWWM_LOBDOUBLED = "[Legion of Bones] Enables \"Double Death\", which makes enemies first spawn as their vanilla variants to then turn undead on defeat."; TOOLTIP_SWWMACHIEVEMENTMENU = "View your achievements."; TOOLTIP_SWWM_MM_ENABLE = "Displays a minimap on the top right corner of the screen."; TOOLTIP_SWWM_MM_MISSILES = "Displays projectiles in the minimap. Can be toggled if this clutters too much."; diff --git a/language.es_menu b/language.es_menu index 50c34e5ce..467186d2c 100644 --- a/language.es_menu +++ b/language.es_menu @@ -180,6 +180,7 @@ SWWM_BONKHAMMER = "Martillo Loco"; SWWM_FRIENDLYFIRE = "Fuego Amigo"; SWWM_DAMNUMS_COLOR = "Colorear Números de Daño"; SWWM_SHOWMAPTITLE = "Título de Mapa Animado"; +SWWM_LOBDOUBLED = "LOB Doble Muerte"; SWWM_FF_UNRESTRICTED = "Sin Restricción"; SWWM_FF_INCOMING = "Bloquear Entrante"; SWWM_FF_ALL = "Bloquear Todo"; @@ -283,6 +284,7 @@ TOOLTIP_SWWM_BONKHAMMER = "El Martillo de Combate hará ruídos graciosos al gol TOOLTIP_SWWM_FRIENDLYFIRE = "Controla el que los aliados puedan causar daño o ser dañados por el jugador."; TOOLTIP_SWWM_DAMNUMS_COLOR = "Los números de daño cambiarán color en base al tipo de daño. De lo contrario, serán siempre rojos."; TOOLTIP_SWWM_SHOWMAPTITLE = "Muestra una animación de título al entrar en un mapa. ¡Es igualito que Dark Souls!"; +TOOLTIP_SWWM_LOBDOUBLED = "[Legion of Bones] Habilita \"Doble Muerte\", lo cual hace que los enemigos aparezcan primero como sus variantes vanilla para luego volverse no-muertos al derrotarlos."; TOOLTIP_SWWMACHIEVEMENTMENU = "Revisa tus logros."; TOOLTIP_SWWM_MM_ENABLE = "Muestra un minimapa en la esquina superior derecha de la pantalla."; TOOLTIP_SWWM_MM_MISSILES = "Muestra proyectiles en el minimapa. Puede ser desactivado si causa problemas de visibilidad."; diff --git a/language.version b/language.version index b1a198775..c1b875702 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r391 \cu(Wed 31 Aug 10:07:48 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r391 \cu(2022-08-31 10:07:48)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r392 \cu(Wed 31 Aug 10:58:25 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r392 \cu(2022-08-31 10:58:25)\c-"; diff --git a/menudef.txt b/menudef.txt index efb99931e..94ac89701 100644 --- a/menudef.txt +++ b/menudef.txt @@ -221,6 +221,7 @@ OptionMenu "SWWMOptionMenu" IfGame(Doom) { Option "$SWWM_DRLASKILL", "swwm_drlaskill", "SWWMDRLASkill" + Option "$SWWM_LOBDOUBLED", "swwm_lobdoubled", "YesNo" } } OptionMenu "SWWMDebugMenu" diff --git a/zscript/handler/swwm_handler_replacements.zsc b/zscript/handler/swwm_handler_replacements.zsc index 10b187a78..240ea8c83 100644 --- a/zscript/handler/swwm_handler_replacements.zsc +++ b/zscript/handler/swwm_handler_replacements.zsc @@ -210,49 +210,49 @@ extend Class SWWMHandler case 0: for ( int i=0; i<18; i++ ) { - if ( !(a is babypool[i]) ) continue; + if ( !(a.GetClassName() == babypool[i]) ) continue; return refpool[i]; } break; case 1: for ( int i=0; i<18; i++ ) { - if ( !(a is easypool[i]) ) continue; + if ( !(a.GetClassName() == easypool[i]) ) continue; return refpool[i]; } break; case 2: for ( int i=0; i<18; i++ ) { - if ( !(a is normalpool[i]) ) continue; + if ( !(a.GetClassName() == normalpool[i]) ) continue; return refpool[i]; } break; case 3: for ( int i=0; i<18; i++ ) { - if ( !(a is hardpool[i]) ) continue; + if ( !(a.GetClassName() == hardpool[i]) ) continue; return refpool[i]; } break; case 4: for ( int i=0; i<18; i++ ) { - if ( !(a is nightmarepool[i]) ) continue; + if ( !(a.GetClassName() == nightmarepool[i]) ) continue; return refpool[i]; } break; case 5: for ( int i=0; i<18; i++ ) { - if ( !(a is technophobiapool[i]) ) continue; + if ( !(a.GetClassName() == technophobiapool[i]) ) continue; return refpool[i]; } break; case 6: for ( int i=0; i<18; i++ ) { - if ( !(a is armageddonpool[i]) ) continue; + if ( !(a.GetClassName() == armageddonpool[i]) ) continue; return refpool[i]; } break; @@ -260,7 +260,7 @@ extend Class SWWMHandler default: for ( int i=0; i<18; i++ ) { - if ( !(a is adaptivepool[i]) ) continue; + if ( !(a.GetClassName() == adaptivepool[i]) ) continue; return refpool[i]; } break; @@ -268,12 +268,66 @@ extend Class SWWMHandler return null; } + private Class GetLOBReplacee( Class a ) + { + static const String refpool[] = + { + "Zombieman", + "Shotgunguy", + "Chaingunguy", + "DoomImp", + "Demon", + "Spectre", + "Cacodemon", + "HellKnight", + "BaronOfHell", + "Revenant", + "Fatso", + "Arachnotron", + "Archvile" + }; + static const String reppool[] = + { + "LOBZombieman", + "LOBShotgunguy", + "LOBChaingunguy", + "LOBDoomImp", + "LOBDemon", + "LOBSpectre", + "LOBCacodemon", + "LOBHellKnight", + "LOBBaronOfHell", + "LOBRevenant", + "LOBFatso", + "LOBArachnotron", + "LOBArchvile" + }; + for ( int i=0; i<13; i++ ) + { + if ( !(a.GetClassName() == reppool[i]) ) continue; + return refpool[i]; + } + return null; + } + override void CheckReplacee( ReplacedEvent e ) { if ( profiling ) ProfileTick(); + // these are all needed so boss deaths work if ( e.Replacement is 'DSparilHax' ) e.Replacee = 'Sorcerer2'; - // drla stuff, needed so boss deaths work + // LOB "double death" stuff + if ( haslegionofbones && swwm_lobdoubled ) + { + let rep = GetLOBReplacee(e.Replacement); + if ( rep ) + { + e.Replacee = rep; + if ( profiling ) ProfileTock(PT_CHECKREPLACEE); + return; + } + } + // drla stuff if ( !hasdrlamonsters ) { if ( profiling ) ProfileTock(PT_CHECKREPLACEE); @@ -489,49 +543,49 @@ extend Class SWWMHandler case 0: for ( int i=0; i<18; i++ ) { - if ( !(a is refpool[i]) ) continue; + if ( !(a.GetClassName() == refpool[i]) ) continue; return babypool[i]; } break; case 1: for ( int i=0; i<18; i++ ) { - if ( !(a is refpool[i]) ) continue; + if ( !(a.GetClassName() == refpool[i]) ) continue; return easypool[i]; } break; case 2: for ( int i=0; i<18; i++ ) { - if ( !(a is refpool[i]) ) continue; + if ( !(a.GetClassName() == refpool[i]) ) continue; return normalpool[i]; } break; case 3: for ( int i=0; i<18; i++ ) { - if ( !(a is refpool[i]) ) continue; + if ( !(a.GetClassName() == refpool[i]) ) continue; return hardpool[i]; } break; case 4: for ( int i=0; i<18; i++ ) { - if ( !(a is refpool[i]) ) continue; + if ( !(a.GetClassName() == refpool[i]) ) continue; return nightmarepool[i]; } break; case 5: for ( int i=0; i<18; i++ ) { - if ( !(a is refpool[i]) ) continue; + if ( !(a.GetClassName() == refpool[i]) ) continue; return technophobiapool[i]; } break; case 6: for ( int i=0; i<18; i++ ) { - if ( !(a is refpool[i]) ) continue; + if ( !(a.GetClassName() == refpool[i]) ) continue; return armageddonpool[i]; } break; @@ -539,7 +593,7 @@ extend Class SWWMHandler default: for ( int i=0; i<18; i++ ) { - if ( !(a is refpool[i]) ) continue; + if ( !(a.GetClassName() == refpool[i]) ) continue; return adaptivepool[i]; } break; @@ -547,6 +601,48 @@ extend Class SWWMHandler return null; } + private Class GetLOBReplacement( Class a ) + { + static const String refpool[] = + { + "Zombieman", + "Shotgunguy", + "Chaingunguy", + "DoomImp", + "Demon", + "Spectre", + "Cacodemon", + "HellKnight", + "BaronOfHell", + "Revenant", + "Fatso", + "Arachnotron", + "Archvile" + }; + static const String reppool[] = + { + "LOBZombieman", + "LOBShotgunguy", + "LOBChaingunguy", + "LOBDoomImp", + "LOBDemon", + "LOBSpectre", + "LOBCacodemon", + "LOBHellKnight", + "LOBBaronOfHell", + "LOBRevenant", + "LOBFatso", + "LOBArachnotron", + "LOBArchvile" + }; + for ( int i=0; i<13; i++ ) + { + if ( !(a.GetClassName() == refpool[i]) ) continue; + return reppool[i]; + } + return null; + } + override void CheckReplacement( ReplaceEvent e ) { if ( profiling ) ProfileTick(); @@ -568,6 +664,18 @@ extend Class SWWMHandler return; } } + // LOB "double death" stuff + if ( haslegionofbones && swwm_lobdoubled ) + { + let rep = GetLOBReplacement(e.Replacee); + if ( rep ) + { + e.Replacement = rep; + e.IsFinal = true; + if ( profiling ) ProfileTock(PT_CHECKREPLACEMENT); + return; + } + } // only replace vanilla blood if no other gore mod is doing it if ( (((e.Replacee == "Blood") && (!e.Replacement || e.Replacement == "Blood")) || (bludtypes.Find(e.Replacee.GetClassName()) < bludtypes.Size())) && swwm_blood ) e.Replacement = "mkBlood"; else if ( e.Replacee is 'ItemFog' ) e.Replacement = 'SWWMItemFog'; diff --git a/zscript/swwm_handler.zsc b/zscript/swwm_handler.zsc index 0219484b5..6ec392fc8 100644 --- a/zscript/swwm_handler.zsc +++ b/zscript/swwm_handler.zsc @@ -23,7 +23,7 @@ Class SWWMHandler : EventHandler Array funtagsv, mergemonstersv; // for checkreplacement - bool hasdrlamonsters; + bool hasdrlamonsters, haslegionofbones; int iskdizd; Array bludtypes; @@ -73,12 +73,11 @@ Class SWWMHandler : EventHandler bossmap = -1; indoomvacation = -1; inultdoom2 = -1; - // this one can be initialized here easily + // class-checking ones can be initialized here easily for ( int i=0; i