diff --git a/language.version b/language.version index 96f62d186..da632ebf8 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r768 \cu(Tue 28 Feb 17:22:52 CET 2023)\c-"; -SWWM_SHORTVER="\cw1.3pre r768 \cu(2023-02-28 17:22:52)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r769 \cu(Fri 3 Mar 20:23:17 CET 2023)\c-"; +SWWM_SHORTVER="\cw1.3pre r769 \cu(2023-03-03 20:23:17)\c-"; diff --git a/zscript/player/swwm_player_anim.zsc b/zscript/player/swwm_player_anim.zsc index 7252c0725..a1f9dc317 100644 --- a/zscript/player/swwm_player_anim.zsc +++ b/zscript/player/swwm_player_anim.zsc @@ -524,39 +524,14 @@ extend Class Demolitionist void A_Footstep( double yofs, int run = 0, double vol = .3, bool nosplash = false ) { - if ( run == 2 ) - { - A_StartSound("demolitionist/run",CHAN_FOOTSTEP,CHANF_OVERLAP,vol); - if ( !nosplash ) - { - let b = Spawn("InvisibleSplasher",level.Vec3Offset(pos,(RotateVector((0,yofs*.25*radius),angle),0))); - b.target = self; - b.A_CheckTerrain(); - } - vel.xy += (RotateVector(NormalizedMove(),angle)/3600.)*TweakSpeed(); - } - else if ( run == 1 ) - { - A_StartSound("demolitionist/walk",CHAN_FOOTSTEP,CHANF_OVERLAP,vol*.5); - if ( !nosplash ) - { - let b = Spawn("InvisibleSplasher",level.Vec3Offset(pos,(RotateVector((0,yofs*.25*radius),angle),0))); - b.target = self; - b.A_CheckTerrain(); - } - vel.xy += (RotateVector(NormalizedMove(),angle)/4800.)*TweakSpeed(); - } - else - { - A_StartSound("demolitionist/walk",CHAN_FOOTSTEP,CHANF_OVERLAP,vol*.2); - if ( !nosplash ) - { - let b = Spawn("SmolInvisibleSplasher",level.Vec3Offset(pos,(RotateVector((0,yofs*.25*radius),angle),0))); - b.target = self; - b.A_CheckTerrain(); - } - vel.xy += (RotateVector(NormalizedMove(),angle)/6400.)*TweakSpeed(); - } + if ( !multiplayer && !(player.cheats&CF_CHASECAM) ) + return; + PlayFootstep(yofs,run,vol,nosplash); + } + + void A_Crawl( double vol = .1, bool bAlt = false ) + { + A_StartSound(bAlt?"demolitionist/runstop":"demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,vol); } int FastCheck() @@ -825,25 +800,25 @@ extend Class Demolitionist CrouchMove: #### # 4; XZW7 MN 4 A_FastJump(null,"CrouchMoveRun","CrouchMoveFast"); - XZW7 O 0 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.1); + XZW7 O 0 A_Crawl(.1,false); XZW7 OPQRS 4 A_FastJump(null,"CrouchMoveRun","CrouchMoveFast"); - XZW7 T 0 A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.1); + XZW7 T 0 A_Crawl(.1,true); XZW7 TUV 4 A_FastJump(null,"CrouchMoveRun","CrouchMoveFast"); Goto CrouchMove+1; CrouchMoveRun: #### # 3; XZW7 MN 3 A_FastJump("CrouchMove",null,"CrouchMoveFast"); - XZW7 O 0 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.2); + XZW7 O 0 A_Crawl(.2,false); XZW7 OPQRS 3 A_FastJump("CrouchMove",null,"CrouchMoveFast"); - XZW7 T 0 A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.2); + XZW7 T 0 A_Crawl(.2,true); XZW7 TUV 3 A_FastJump("CrouchMove",null,"CrouchMoveFast"); Goto CrouchMoveRun+1; CrouchMoveFast: #### # 2; XZW7 MN 2 A_FastJump("CrouchMove","CrouchMoveRun",null); - XZW7 O 0 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.4); + XZW7 O 0 A_Crawl(.4,false); XZW7 OPQRS 2 A_FastJump("CrouchMove","CrouchMoveRun",null); - XZW7 T 0 A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.4); + XZW7 T 0 A_Crawl(.4,true); XZW7 TUV 2 A_FastJump("CrouchMove","CrouchMoveRun",null); Goto CrouchMoveFast+2; CrouchWave: @@ -933,25 +908,25 @@ extend Class Demolitionist SwimLoop: #### # 5; XZWE MNO 5 A_FastJump(null,"SwimLoopRun","SwimLoopFast"); - XZWE P 0 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.1); + XZWE P 0 A_Crawl(.1,false); XZWE PQRSTU 5 A_FastJump(null,"SwimLoopRun","SwimLoopFast"); - XZWE V 0 A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.1); + XZWE V 0 A_Crawl(.1,true); XZWE VWX 5 A_FastJump(null,"SwimLoopRun","SwimLoopFast"); Goto SwimLoop+1; SwimLoopRun: #### # 3; XZWE MNO 3 A_FastJump("SwimLoop",null,"SwimLoopFast"); - XZWE P 0 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.2); + XZWE P 0 A_Crawl(.2,false); XZWE PQRSTU 3 A_FastJump("SwimLoop",null,"SwimLoopFast"); - XZWE V 0 A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.2); + XZWE V 0 A_Crawl(.2,true); XZWE VWX 3 A_FastJump("SwimLoop",null,"SwimLoopFast"); Goto SwimLoopRun+1; SwimLoopFast: #### # 2; XZWE MNO 2 A_FastJump("SwimLoop","SwimLoopRun",null); - XZWE P 0 A_StartSound("demolitionist/runstart",CHAN_FOOTSTEP,CHANF_OVERLAP,.4); + XZWE P 0 A_Crawl(.4,false); XZWE PQRSTU 2 A_FastJump("SwimLoop","SwimLoopRun",null); - XZWE V 0 A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP,.4); + XZWE V 0 A_Crawl(.4,true); XZWE VWX 2 A_FastJump("SwimLoop","SwimLoopRun",null); Goto SwimLoopFast+1; SwimEnd: diff --git a/zscript/player/swwm_player_move.zsc b/zscript/player/swwm_player_move.zsc index dba01e889..12cad7395 100644 --- a/zscript/player/swwm_player_move.zsc +++ b/zscript/player/swwm_player_move.zsc @@ -22,6 +22,43 @@ extend Class Demolitionist return fact; } + void PlayFootstep( double yofs, int run = 0, double vol = .3, bool nosplash = false ) + { + if ( run == 2 ) + { + A_StartSound("demolitionist/run",CHAN_FOOTSTEP,CHANF_OVERLAP,vol); + if ( !nosplash ) + { + let b = Spawn("InvisibleSplasher",level.Vec3Offset(pos,(RotateVector((0,yofs*.25*radius),angle),0))); + b.target = self; + b.A_CheckTerrain(); + } + vel.xy += (RotateVector(NormalizedMove(),angle)/3600.)*TweakSpeed(); + } + else if ( run == 1 ) + { + A_StartSound("demolitionist/walk",CHAN_FOOTSTEP,CHANF_OVERLAP,vol*.5); + if ( !nosplash ) + { + let b = Spawn("InvisibleSplasher",level.Vec3Offset(pos,(RotateVector((0,yofs*.25*radius),angle),0))); + b.target = self; + b.A_CheckTerrain(); + } + vel.xy += (RotateVector(NormalizedMove(),angle)/4800.)*TweakSpeed(); + } + else + { + A_StartSound("demolitionist/walk",CHAN_FOOTSTEP,CHANF_OVERLAP,vol*.2); + if ( !nosplash ) + { + let b = Spawn("SmolInvisibleSplasher",level.Vec3Offset(pos,(RotateVector((0,yofs*.25*radius),angle),0))); + b.target = self; + b.A_CheckTerrain(); + } + vel.xy += (RotateVector(NormalizedMove(),angle)/6400.)*TweakSpeed(); + } + } + override void CalcHeight() { double defviewh = viewheight+player.crouchviewdelta; @@ -63,10 +100,23 @@ extend Class Demolitionist // apply bobbing (formula adapted from Unreal) oldbobtime = bobtime; double vel2d = vel.xy dot vel.xy; - bobtime += (1.25+.25*min(vel2d/100.,3.))/GameTicRate; - Vector2 bob = (sin(bobtime*180.),sin(bobtime*360.))*player.bob*.25; + bobtime += (1.75+.25*min(vel2d/100.,3.))/GameTicRate; + Vector2 bob = (sin(bobtime*180.),.5*sin(bobtime*360.))*player.bob*.25; if ( player.morphtics ) bob = (0.,0.); + else if ( player.bob && !multiplayer && !(player.cheats&CF_CHASECAM) + && player.onground && !bNoGravity && (player.crouchdir != -1) ) + { + // bob-based footsteps in first person + int m = int(2.*M_PI+oldbobtime); + int n = int(2.*M_PI+bobtime); + if ( m != n ) + { + int side = (sin(bobtime*180.)>0.)?1:-1; + int spd = bWalking?0:(player.cmd.buttons&BT_RUN)?2:1; + PlayFootstep(side,spd); + } + } // set up viewz player.viewz = pos.z+player.viewheight+(bob.y*clamp(viewbob,0.,1.5)); // handle smooth step down (hacky but looks ok) diff --git a/zscript/player/swwm_player_tick.zsc b/zscript/player/swwm_player_tick.zsc index 7c7e6124c..d3b303b50 100644 --- a/zscript/player/swwm_player_tick.zsc +++ b/zscript/player/swwm_player_tick.zsc @@ -354,7 +354,7 @@ extend Class Demolitionist if ( loudlv > 3 ) A_StartSound(String.Format("voice/%s/grunt%d",myvoice,idx),CHAN_DEMOVOICEAUX3,CHANF_OVERLAP); } if ( lastvelz < -1 ) - A_Footstep(0,1,clamp(-lastvelz*0.05,0.0,1.0),true); + PlayFootstep(0,1,clamp(-lastvelz*0.05,0.0,1.0),true); // bounce off slopes if ( pos.z <= floorz ) {