From 905389c495b41bef6adaf9189e8e58fa99994411 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Fri, 23 Oct 2020 21:05:00 +0200 Subject: [PATCH] Add option for blob shadows to only affect mod objects (default). Minor optimizations of stuff. --- cvarinfo.txt | 2 +- language.def_menu | 3 ++ language.es_menu | 3 ++ language.version | 2 +- menudef.txt | 8 ++++- zscript/swwm_common.zsc | 19 ++++++----- zscript/swwm_deathlydeathcannon.zsc | 2 +- zscript/swwm_handler.zsc | 49 +++++++++++++++-------------- zscript/swwm_player.zsc | 21 ++++++++----- 9 files changed, 66 insertions(+), 43 deletions(-) diff --git a/cvarinfo.txt b/cvarinfo.txt index 8e39e1b38..6644bcd31 100644 --- a/cvarinfo.txt +++ b/cvarinfo.txt @@ -81,5 +81,5 @@ user bool swwm_intermusic = false; // use original intermission music server int swwm_enemydrops = 0; // allow enemies to drop ammo and weapons (-1 - no ammo or weapons, 0 - ammo only, 1 - both) server bool swwm_shotgib = true; // buckshot can gib (some people don't like this for some reason, so it's an option now) user bool swwm_collectanim = true; // player special gestures for collectables (first person only) -server bool swwm_shadows = true; // enables blob shadows under certain things +server int swwm_shadows = 1; // enables blob shadows under certain things (0 - no shadows, 1 - mod objects, 2 - everything) user bool swwm_precisecrosshair = true; // use mod's own, more precise crosshair diff --git a/language.def_menu b/language.def_menu index 009ba4ca6..a35789dc4 100644 --- a/language.def_menu +++ b/language.def_menu @@ -140,6 +140,9 @@ SWWM_DROPS_WEAPONS = "Ammo And Weapons"; SWWM_SHOTGIB = "Buckshot can Gib"; SWWM_COLLECTANIM = "Collectible Animations"; SWWM_SHADOWS = "Simple Shadows"; +SWWM_SHADOWS_OFF = "None"; +SWWM_SHADOWS_ON = "Mod Objects"; +SWWM_SHADOWS_ALL = "Everything"; SWWM_PRECISECROSSHAIR = "Precise Crosshair"; 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."; diff --git a/language.es_menu b/language.es_menu index 40a2cf7c2..69c31de5e 100644 --- a/language.es_menu +++ b/language.es_menu @@ -140,6 +140,9 @@ SWWM_DROPS_WEAPONS = "Munición y Armas"; SWWM_SHOTGIB = "Los Perdigones pueden Desviscerar"; SWWM_COLLECTANIM = "Animaciones de Coleccionables"; SWWM_SHADOWS = "Sombras Simples"; +SWWM_SHADOWS_OFF = "Nada"; +SWWM_SHADOWS_ON = "Objetos de Mod"; +SWWM_SHADOWS_ALL = "Todo"; SWWM_PRECISECROSSHAIR = "Mira Precisa"; 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."; diff --git a/language.version b/language.version index be100b206..9f41bdf50 100644 --- a/language.version +++ b/language.version @@ -1,2 +1,2 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r569 \cu(Fri 23 Oct 20:00:22 CEST 2020)"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r570 \cu(Fri 23 Oct 21:05:00 CEST 2020)"; diff --git a/menudef.txt b/menudef.txt index 889f14a54..8956d666a 100644 --- a/menudef.txt +++ b/menudef.txt @@ -18,6 +18,12 @@ OptionValue "SWWMEnemyDropType" 0, "$SWWM_DROPS_AMMO" 1, "$SWWM_DROPS_WEAPONS" } +OptionValue "SWWMShadows" +{ + 0, "$SWWM_SHADOWS_OFF" + 1, "$SWWM_SHADOWS_ON" + 2, "$SWWM_SHADOWS_ALL" +} OptionMenu "SWWMOptionMenu" { Class "SWWMOptionMenu" @@ -33,7 +39,7 @@ OptionMenu "SWWMOptionMenu" StaticText " " StaticText "$SWWM_OTITLE", "Blue" Option "$SWWM_PRECISECROSSHAIR", "swwm_precisecrosshair", "YesNo" - Option "$SWWM_SHADOWS", "swwm_shadows", "YesNo" + Option "$SWWM_SHADOWS", "swwm_shadows", "SWWMShadows" Option "$SWWM_BLOOD", "swwm_blood", "YesNo" ScaleSlider "$SWWM_MAXBLOOD", "swwm_maxblood", -1, 1000, 1, "$SWWM_NONE", "$SWWM_UNLIMITED" ScaleSlider "$SWWM_MAXGIBS", "swwm_maxgibs", -1, 1000, 1, "$SWWM_NONE", "$SWWM_UNLIMITED" diff --git a/zscript/swwm_common.zsc b/zscript/swwm_common.zsc index 62e4443df..8d8c336ba 100644 --- a/zscript/swwm_common.zsc +++ b/zscript/swwm_common.zsc @@ -1247,13 +1247,6 @@ Class SWWMShadow : Actor } private void Update( bool nointerpolate = false ) { - double curz = target.CurSector.NextLowestFloorAt(target.pos.x,target.pos.y,target.pos.z); - SetOrigin((target.pos.x,target.pos.y,curz),true); - if ( nointerpolate ) - prev = pos; - else if ( oldfloor != target.CurSector ) - prev.z = pos.z; // prevent interpolation of steep height changes - oldfloor = target.CurSector; // update scale / alpha if ( (target is 'Inventory') && (Inventory(target).Owner || !target.bSPECIAL) || target.bKILLED || target.bINVISIBLE || (target.sprite == target.GetSpriteIndex('TNT1')) ) alpha = 0.; @@ -1264,8 +1257,18 @@ Class SWWMShadow : Actor double bscale = (target.radius/16.)*(1.-min(1.,.003*abs(target.pos.z-pos.z))); A_SetScale(bscale); } + // update position + double curz = target.CurSector.NextLowestFloorAt(target.pos.x,target.pos.y,target.pos.z); + if ( (target.pos.xy == pos.xy) && (pos.z == curz) ) return; + SetOrigin((target.pos.x,target.pos.y,curz),true); + if ( nointerpolate ) + prev = pos; + else if ( oldfloor != target.CurSector ) + prev.z = pos.z; // prevent interpolation of steep height changes // update slope alignment - SWWMUtility.SetToSlope(self,0); + if ( !oldfloor || (oldfloor != target.CurSector) ) + SWWMUtility.SetToSlope(self,0); + oldfloor = target.CurSector; } override void Tick() { diff --git a/zscript/swwm_deathlydeathcannon.zsc b/zscript/swwm_deathlydeathcannon.zsc index d382f12bc..890931a49 100644 --- a/zscript/swwm_deathlydeathcannon.zsc +++ b/zscript/swwm_deathlydeathcannon.zsc @@ -255,7 +255,7 @@ Class YnykronDelayedImpact : Actor special1++; if ( special1 < 4 ) { - if ( tracer ) SetOrigin(level.Vec3Offset(tracer.pos,ofs),true); + if ( tracer ) SetOrigin(level.Vec3Offset(tracer.pos,ofs),false); return; } let b = Spawn("YnykronImpact",pos); diff --git a/zscript/swwm_handler.zsc b/zscript/swwm_handler.zsc index be81b7015..ac1d38e0e 100644 --- a/zscript/swwm_handler.zsc +++ b/zscript/swwm_handler.zsc @@ -1165,11 +1165,11 @@ Class SWWMHandler : EventHandler let hp = Actor.Spawn("HeadpatTracker",e.Thing.pos); hp.target = e.Thing; } - if ( !swwm_notrack && (e.Thing.bSHOOTABLE || e.Thing.bISMONSTER) && !(e.Thing is 'LampMoth') && !(e.Thing is 'CompanionLamp') ) SWWMCombatTracker.Spawn(e.Thing); - if ( swwm_shadows && (e.Thing.bSHOOTABLE || e.Thing.bISMONSTER || e.Thing.bCORPSE || (e.Thing is 'Inventory')) ) + if ( !swwm_notrack && (e.Thing.bSHOOTABLE || e.Thing.bISMONSTER) && !(e.Thing is 'LampMoth') && !(e.Thing is 'CompanionLamp') ) + SWWMCombatTracker.Spawn(e.Thing); + if ( e.Thing.bSHOOTABLE || e.Thing.bISMONSTER || e.Thing.bCORPSE || (e.Thing is 'Inventory') ) { - // Uncomment once sprite shadows are added in-engine - //if ( ((e.Thing is 'Demolitionist') || (e.Thing.SpawnState.sprite == e.Thing.GetSpriteIndex('XZW1'))) ) + if ( (swwm_shadows == 2) || ((swwm_shadows == 1) && ((e.Thing is 'Demolitionist') || (e.Thing.SpawnState.sprite == e.Thing.GetSpriteIndex('XZW1')))) ) SWWMShadow.Track(e.Thing); } } @@ -1200,31 +1200,34 @@ Class SWWMHandler : EventHandler { if ( e.Type == InputEvent.TYPE_KeyDown ) { - static const int lods[] = {38,24,32,31,24,33,18,50,24,49,18}; - // what's that spell? - // loadsamoney! ... probably - if ( e.KeyScan == lods[kcode] ) + if ( sv_cheats ) { - kcode++; - if ( kcode >= 11 ) + static const int lods[] = {38,24,32,31,24,33,18,50,24,49,18}; + // what's that spell? + // loadsamoney! ... probably + if ( e.KeyScan == lods[kcode] ) { - SendNetworkEvent("swwmmoneycheat",consoleplayer); - kcode = 0; + kcode++; + if ( kcode >= 11 ) + { + SendNetworkEvent("swwmmoneycheat",consoleplayer); + kcode = 0; + } } - } - else kcode = 0; - static const int deep[] = {32,18,18,25,38,24,19,18}; - // the deepest lore - if ( e.KeyScan == deep[lcode] ) - { - lcode++; - if ( lcode >= 8 ) + else kcode = 0; + static const int deep[] = {32,18,18,25,38,24,19,18}; + // the deepest lore + if ( e.KeyScan == deep[lcode] ) { - SendNetworkEvent("swwmlorecheat",consoleplayer); - lcode = 0; + lcode++; + if ( lcode >= 8 ) + { + SendNetworkEvent("swwmlorecheat",consoleplayer); + lcode = 0; + } } + else lcode = 0; } - else lcode = 0; if ( e.KeyScan == 33 ) // assuming that's the F key on all keyboards (hopefully) { let demo = Demolitionist(players[consoleplayer].mo); diff --git a/zscript/swwm_player.zsc b/zscript/swwm_player.zsc index 2682b2da2..92679dd1c 100644 --- a/zscript/swwm_player.zsc +++ b/zscript/swwm_player.zsc @@ -2598,6 +2598,9 @@ Class ReviveCooldown : Powerup // not an actual light, just handles the attach/detach Class DemolitionistSelfLight : Actor { + bool oldactive; + bool oldglow; + Default { +NOGRAVITY; @@ -2623,14 +2626,16 @@ Class DemolitionistSelfLight : Actor Destroy(); return; } - if ( !activelight() ) - target.A_RemoveLight('DemoSelfLight'); - else if ( activelight() ) + bool curactive = activelight(); + if ( curactive && !oldactive ) target.A_AttachLight('DemoSelfLight',DynamicLight.PointLight,Color(56,72,88),200,0,DynamicLight.LF_DONTLIGHTSELF|DynamicLight.LF_ATTENUATE|DynamicLight.LF_SPOT,(12,0,target.player?(target.player.viewz-target.pos.z):(target.height*.93)),0,30,90,target.pitch); - if ( target.bINVISIBLE || (target.alpha <= double.epsilon) ) - target.A_RemoveLight('DemoSelfLight2'); - else - target.A_AttachLight('DemoSelfLight2',DynamicLight.PointLight,Color(32,48,24),80,0,DynamicLight.LF_DONTLIGHTSELF|DynamicLight.LF_ATTENUATE,(0,0,target.height/2)); + else if ( !curactive && oldactive ) + target.A_RemoveLight('DemoSelfLight'); + oldactive = curactive; + bool curglow = !(target.bINVISIBLE||(target.alpha <= double.epsilon)); + if ( curglow && !oldglow ) target.A_AttachLight('DemoSelfLight2',DynamicLight.PointLight,Color(32,48,24),80,0,DynamicLight.LF_DONTLIGHTSELF|DynamicLight.LF_ATTENUATE,(0,0,target.height/2)); + else if ( !curglow && oldglow ) target.A_RemoveLight('DemoSelfLight2'); + oldglow = curglow; } } @@ -3003,7 +3008,7 @@ Class HeadpatTracker : Actor return; } A_SetSize(target.radius+8,target.height+8); - SetOrigin(target.pos,false); + if ( pos != target.pos ) SetOrigin(target.pos,false); } override bool Used( Actor user ) {