From 9b4e0f1918e2efc4c279b9ab29de0c5aa6690ae6 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Wed, 3 Jun 2020 11:16:04 +0200 Subject: [PATCH] Player can now perform ground pounds on large enemies while dashing (previously this was prevented by the dash making the player bounce off) Tweaks to crouching behaviour (crouch-jump disabled by default). --- cvarinfo.txt | 3 +- language.def_menu | 2 + language.es_menu | 2 + language.version | 2 +- menudef.txt | 1 + zscript/swwm_player.zsc | 82 ++++++++++++++++++++++++++++++++++------- 6 files changed, 77 insertions(+), 15 deletions(-) diff --git a/cvarinfo.txt b/cvarinfo.txt index 06135ec31..a8e4560a5 100644 --- a/cvarinfo.txt +++ b/cvarinfo.txt @@ -54,4 +54,5 @@ server bool swwm_blood = false; // custom blood/gibbing user bool swwm_fuzz = true; // allows toggling the fuzz shader on the demolitionist menus, useful if you're streaming/recording since it destroys the encoding quality user bool swwm_cbtpause = true; // wallbuster menu pauses the game user noarchive int swwm_cbtmeme = 0; // easter egg, hidden cvar -user noarchive bool swwm_cbttime = false; // debug: times how long a reload takes \ No newline at end of file +user noarchive bool swwm_cbttime = false; // debug: times how long a reload takes +server bool swwm_crouchjump = false; // allows crouch-jumping (which looks weird af but some maps may need it) \ No newline at end of file diff --git a/language.def_menu b/language.def_menu index 811aaac86..6da6ffa26 100644 --- a/language.def_menu +++ b/language.def_menu @@ -98,6 +98,7 @@ SWWM_GZSCALE = "Use GZDoom Setting"; SWWM_BLOOD = "Enable Custom Blood"; SWWM_FUZZ = "Enable Animated Menu BG"; SWWM_BUSTERPAUSE = "Pause on Wallbuster Reload"; +SWWM_CROUCHJUMP = "Allow Crouch-Jump"; 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."; @@ -142,6 +143,7 @@ TOOLTIP_SWWM_SCRSCALE = "Scaling factor for score numbers. Set to 0 to use GZDoo TOOLTIP_SWWM_BLOOD = "Please note that these effects are kinda cheap and performance heavy. I'd honestly recommend Nashgore instead, it's better."; TOOLTIP_SWWM_FUZZ = "Toggling this off is recommended if you're recording/streaming as this effect can harm video quality."; TOOLTIP_SWWM_CBTPAUSE = "The game will pause while the Wallbuster reload menu is open (only in singleplayer)."; +TOOLTIP_SWWM_CROUCHJUMP = "Allow the player to crouch-jump (which may be needed on some maps). Note that there are no animations for this and it'll look weird."; // knowledge base SWWM_COMINGSOON = "(coming soon)"; SWWM_MISSTAB = "Mission"; diff --git a/language.es_menu b/language.es_menu index 655a571d5..991693a10 100644 --- a/language.es_menu +++ b/language.es_menu @@ -95,6 +95,7 @@ SWWM_GZSCALE = "Usar Opción de GZDoom"; SWWM_BLOOD = "Habilitar Sangre Personalizada"; SWWM_FUZZ = "Habilitar Fondo Animado de Menú"; SWWM_BUSTERPAUSE = "Pausar en Regarga de Wallbuster"; +SWWM_CROUCHJUMP = "Permitir Salto Agachado"; 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 effectos te causan malestar."; @@ -139,6 +140,7 @@ TOOLTIP_SWWM_SCRSCALE = "Factor de escalado para los números de puntuación. Po TOOLTIP_SWWM_BLOOD = "Ten en cuenta que estos efectos son un poco cutres y bajan los frames. Sinceramente, recomendaría usar Nashgore, es mejor."; TOOLTIP_SWWM_FUZZ = "Desactivar ésto es recomendado si estás grabando o haciendo streaming, ya que este effecto puede dañar la calidad del vídeo."; TOOLTIP_SWWM_CBTPAUSE = "El juego será pausado mientras el menú de recarga de Wallbuster está abierto (sólo en modo de un jugador)."; +TOOLTIP_SWWM_CROUCHJUMP = "Permite al jugador agacharse saltando (lo cual puede ser necesario en algunos mapas). Ten en cuenta que no hay animaciones para esto, así que se verá raro."; // knowledge base SWWM_COMINGSOON = "(próximamente)"; SWWM_MISSTAB = "Misión"; diff --git a/language.version b/language.version index 87c9348f9..31c61004a 100644 --- a/language.version +++ b/language.version @@ -1,2 +1,2 @@ [default] -SWWM_MODVER="\cxSWWM GZ\c- r290 (Wed 3 Jun 10:38:15 CEST 2020)"; +SWWM_MODVER="\cxSWWM GZ\c- r291 (Wed 3 Jun 11:16:04 CEST 2020)"; diff --git a/menudef.txt b/menudef.txt index 1ff043e67..7cfb7d104 100644 --- a/menudef.txt +++ b/menudef.txt @@ -28,6 +28,7 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_MUTELEVEL", "swwm_mutevoice", "SWWMVoice" Option "$SWWM_6DOF", "swwm_fly6dof", "YesNo" Option "$SWWM_REVIVE", "swwm_revive", "YesNo" + Option "$SWWM_CROUCHJUMP", "swwm_crouchjump", "YesNo" ScaleSlider "$SWWM_REVIVECOOLDOWN", "swwm_revivecooldown", 0, 300, 30, "$SWWM_UNLIMITED" StaticText " " StaticText "$SWWM_OTITLE", "Gold" diff --git a/zscript/swwm_player.zsc b/zscript/swwm_player.zsc index 6269528c2..7a935729b 100644 --- a/zscript/swwm_player.zsc +++ b/zscript/swwm_player.zsc @@ -584,11 +584,11 @@ Class Demolitionist : PlayerPawn Vector3 diff = level.Vec3Diff(pos,a.pos); if ( !SWWMUtility.ExtrudeIntersect(self,a,dir*spd,8,16) ) continue; if ( !CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; - // large monsters will stop the player + // large monsters will stop the player (unless hit from above if we're going at ground pound speed) A_QuakeEx(4,4,4,10,0,128,"",QF_RELATIVE|QF_SCALEDOWN); A_StartSound("demolitionist/bump",CHAN_FOOTSTEP,CHANF_OVERLAP); a.A_StartSound("demolitionist/bump",CHAN_FOOTSTEP,CHANF_OVERLAP); - if ( a.bDONTTHRUST || (a.Mass >= Mass*1.5) ) + if ( (diff.z < a.height) && (lastvelz >= -25) && (a.bDONTTHRUST || (a.Mass >= Mass*1.5)) ) { if ( bumped ) continue; bumped = true; @@ -669,17 +669,6 @@ Class Demolitionist : PlayerPawn return; // handled in moveplayer Super.CheckPitch(); } - override void CheckCrouch( bool totallyfrozen ) - { - // crouch to swim/float down - if ( !totallyfrozen && (player.cmd.buttons&BT_CROUCH) ) - { - double mult = FastCheck()?2.:1.; - if ( waterlevel >= 2 ) vel.z = -4*Speed*mult; - else if ( bNOGRAVITY ) vel.z = -3*mult; - } - Super.CheckCrouch(totallyfrozen); - } override void CheckMoveUpDown() { if ( InStateSequence(CurState,FindState("Dash")) ) @@ -808,6 +797,7 @@ Class Demolitionist : PlayerPawn if ( !(fm|sm) ) fm = 1; if ( fm ) dodge += (fm>0)?X:-X; if ( sm ) dodge += (sm>0)?Y:-Y; + if ( player.cmd.buttons&BT_CROUCH ) dodge = (0,0,-1); // death from above if ( player.onground ) { if ( !level.IsJumpingAllowed() ) dodge.z = 0; @@ -1338,6 +1328,72 @@ Class Demolitionist : PlayerPawn if ( notfast ) rslt = !rslt; return rslt; } + bool AllowCrouch() + { + if ( player.cmd.buttons&BT_JUMP ) return false; + if ( swwm_crouchjump ) return true; // allowed + if ( (waterlevel >= 2) || bNOGRAVITY ) return false; // no crouch while swimming/floating + if ( !player.onground ) return false; // no crouch while in air + return true; + } + // Imagine having to duplicate two functions only to change a couple values in both + // I sure love constants + override void CrouchMove( int direction ) + { + double defaultheight = FullHeight; + double savedheight = Height; + double crouchspeed = direction*CROUCHSPEED*.8; // slow down slightly so it matches the animation + double oldheight = player.viewheight; + player.crouchdir = direction; + player.crouchfactor += crouchspeed; + // check whether the move is ok + Height = defaultheight*player.crouchfactor; + if ( !TryMove(pos.xy,false) ) + { + Height = savedheight; + if ( direction > 0 ) + { + // doesn't fit + player.crouchfactor -= crouchspeed; + return; + } + } + Height = savedheight; + player.crouchfactor = clamp(player.crouchfactor,.3,1.); + player.viewheight = ViewHeight*player.crouchfactor; + player.crouchviewdelta = player.viewheight-ViewHeight; + // Check for eyes going above/below fake floor due to crouching motion. + CheckFakeFloorTriggers(pos.z+oldheight,true); + } + override void CheckCrouch( bool totallyfrozen ) + { + // crouch to swim/float down + if ( !totallyfrozen && (player.cmd.buttons&BT_CROUCH) ) + { + double mult = FastCheck()?2.:1.; + if ( waterlevel >= 2 ) vel.z = -4*Speed*mult; + else if ( bNOGRAVITY ) vel.z = -3*mult; + } + bool wascrouching = !!(player.cmd.buttons&BT_CROUCH); + if ( !AllowCrouch() ) player.cmd.buttons &= ~BT_CROUCH; + if ( CanCrouch() && (player.health > 0) && level.IsCrouchingAllowed() ) + { + if ( !totallyfrozen ) + { + int crouchdir = player.crouching; + if ( !crouchdir ) crouchdir = (player.cmd.buttons&BT_CROUCH)?-1:1; + else if ( player.cmd.buttons&BT_CROUCH ) player.crouching = 0; + if ( (crouchdir == 1) && (player.crouchfactor < 1) && (pos.z+height < ceilingz) ) + CrouchMove(1); + else if ( (crouchdir == -1) && (player.crouchfactor > .3) ) + CrouchMove(-1); + } + } + else player.Uncrouch(); + player.crouchoffset = -(ViewHeight)*(1-player.crouchfactor); + // we need the crouch button state to be preserved for other functions + if ( wascrouching ) player.cmd.buttons |= BT_CROUCH; + } States { Spawn: