diff --git a/language.version b/language.version index 102c49b22..518541455 100644 --- a/language.version +++ b/language.version @@ -1,2 +1,2 @@ [default] -SWWM_MODVER="\cxSWWM GZ\c- r277 (Sat 30 May 00:08:20 CEST 2020)"; +SWWM_MODVER="\cxSWWM GZ\c- r278 (Sat 30 May 22:29:59 CEST 2020)"; diff --git a/zscript/swwm_player.zsc b/zscript/swwm_player.zsc index 1dfdba5ec..6269528c2 100644 --- a/zscript/swwm_player.zsc +++ b/zscript/swwm_player.zsc @@ -16,7 +16,7 @@ Class Demolitionist : PlayerPawn double lastvelz, prevvelz; double ssup; - transient CVar myvoice, mute, fly6dof; + transient CVar myvoice, mute, fly6dof, clrun; SWWMStats mystats; int cairtime; @@ -674,7 +674,7 @@ Class Demolitionist : PlayerPawn // crouch to swim/float down if ( !totallyfrozen && (player.cmd.buttons&BT_CROUCH) ) { - double mult = (player.cmd.buttons&BT_SPEED)?2.:1.; + double mult = FastCheck()?2.:1.; if ( waterlevel >= 2 ) vel.z = -4*Speed*mult; else if ( bNOGRAVITY ) vel.z = -3*mult; } @@ -752,7 +752,7 @@ Class Demolitionist : PlayerPawn double jcmove = 0.; if ( player.cmd.buttons&BT_JUMP ) jcmove += 4096.; if ( player.cmd.buttons&BT_CROUCH ) jcmove -= 4096.; - if ( player.cmd.buttons&BT_SPEED ) jcmove *= 2.; + if ( FastCheck() ) jcmove *= 2.; if ( CanCrouch() && (player.crouchfactor != -1) ) fs *= player.crouchfactor; Vector3 x, y, z; [x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll); @@ -893,7 +893,7 @@ Class Demolitionist : PlayerPawn wallclimb = false; jumpactor = null; } - double mult = (player.cmd.buttons&BT_SPEED)?2.:1.; + double mult = FastCheck()?2.:1.; if ( player.crouchoffset ) player.crouching = 1; else if ( waterlevel >= 2 ) vel.z = 4*Speed*mult; else if ( (waterlevel < 2) && (bFly || bFlyCheat) && !(player.cheats&CF_NOCLIP2) ) return; @@ -1155,7 +1155,7 @@ Class Demolitionist : PlayerPawn if ( InStateSequence(CurState,FindState("Crouch")) || InStateSequence(CurState,FindState("CrouchMove")) ) SetStateLabel("EndCrouch"); - else if ( player.cmd.buttons&BT_SPEED + else if ( FastCheck() && (InStateSequence(CurState,FindState("Spawn")) || InStateSequence(CurState,FindState("Turn")) || InStateSequence(CurState,FindState("See"))) ) @@ -1329,6 +1329,15 @@ Class Demolitionist : PlayerPawn } return false; } + bool FastCheck( bool notfast = false ) + { + if ( !player ) return false; + bool rslt = (player.cmd.buttons&BT_SPEED); + if ( !clrun ) clrun = CVar.GetCVar('cl_run',player); + if ( clrun.GetBool() ) rslt = !rslt; + if ( notfast ) rslt = !rslt; + return rslt; + } States { Spawn: @@ -1339,11 +1348,11 @@ Class Demolitionist : PlayerPawn See: // normal walking #### # 2; - XZW1 BCD 2 A_JumpIf(player&&(player.cmd.buttons&BT_SPEED),"SeeFast"); + XZW1 BCD 2 A_JumpIf(FastCheck(false),"SeeFast"); XZW1 E 0 A_Footstep(1); - XZW1 EFGHIJKL 2 A_JumpIf(player&&(player.cmd.buttons&BT_SPEED),"SeeFast"); + XZW1 EFGHIJKL 2 A_JumpIf(FastCheck(false),"SeeFast"); XZW1 M 0 A_Footstep(-1); - XZW1 MNOPA 2 A_JumpIf(player&&(player.cmd.buttons&BT_SPEED),"SeeFast"); + XZW1 MNOPA 2 A_JumpIf(FastCheck(false),"SeeFast"); Goto See+1; Turn: #### # 8 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.1); @@ -1359,11 +1368,11 @@ Class Demolitionist : PlayerPawn SeeFastLoop: // keep sprinting XZW1 U 0 A_Footstep(1,true); - XZW1 UVWXYZ 2 A_JumpIf(player&&!(player.cmd.buttons&BT_SPEED),"SeeFastEnd"); - XZW2 A 2 A_JumpIf(player&&!(player.cmd.buttons&BT_SPEED),"SeeFastEnd"); + XZW1 UVWXYZ 2 A_JumpIf(FastCheck(true),"SeeFastEnd"); + XZW2 A 2 A_JumpIf(FastCheck(true),"SeeFastEnd"); XZW2 B 0 A_Footstep(-1,true); - XZW2 BCDEFG 2 A_JumpIf(player&&!(player.cmd.buttons&BT_SPEED),"SeeFastEnd"); - XZW1 T 2 A_JumpIf(player&&!(player.cmd.buttons&BT_SPEED),"SeeFastEnd"); + XZW2 BCDEFG 2 A_JumpIf(FastCheck(true),"SeeFastEnd"); + XZW1 T 2 A_JumpIf(FastCheck(true),"SeeFastEnd"); Goto SeeFastLoop; SeeFastEnd: // brake