Server: Add water stepping, wading and swimming sounds + script definitions

This commit is contained in:
Marco Cawthorne 2021-02-13 23:06:06 +01:00
parent 7874773acf
commit 0fe863aabc
2 changed files with 54 additions and 4 deletions

View File

@ -237,3 +237,26 @@ step_ladder.right
sample player/pl_ladder3.wav
sample player/pl_ladder4.wav
}
step_wade.left
{
sample player/pl_wade1.wav
sample player/pl_wade2.wav
}
step_wade.right
{
sample player/pl_wade3.wav
sample player/pl_wade4.wav
}
step_swim.left
{
sample player/pl_swim1.wav
sample player/pl_swim2.wav
}
step_swim.right
{
sample player/pl_swim3.wav
sample player/pl_swim4.wav
}

View File

@ -56,6 +56,10 @@ Footsteps_Init(void)
Sound_Precache("step_wood.right");
Sound_Precache("step_ladder.left");
Sound_Precache("step_ladder.right");
Sound_Precache("step_wade.left");
Sound_Precache("step_wade.right");
Sound_Precache("step_swim.left");
Sound_Precache("step_swim.right");
}
/*
@ -267,10 +271,32 @@ Footsteps_Update(void)
return;
}
/* make it so we step once we land */
if (!(pl.flags & FL_ONGROUND) && !(pl.flags & FL_ONLADDER)) {
pl.step_time = 0.0f;
return;
if (pl.waterlevel == 1) {
if (pl.step) {
Sound_Play(pl, CHAN_BODY, "step_slosh.left");
} else {
Sound_Play(pl, CHAN_BODY, "step_slosh.right");
}
pl.step_time = time + 0.35f;
} else if (pl.waterlevel == 2) {
if (pl.step) {
Sound_Play(pl, CHAN_BODY, "step_wade.left");
} else {
Sound_Play(pl, CHAN_BODY, "step_wade.right");
}
pl.step_time = time + 1.0f;
} else if (pl.waterlevel == 3) {
if (pl.step) {
Sound_Play(pl, CHAN_BODY, "step_swim.left");
} else {
Sound_Play(pl, CHAN_BODY, "step_swim.right");
}
pl.step_time = time + 2.0f;
} else {
/* make it so we step once we land */
if (!(pl.flags & FL_ONGROUND) && !(pl.flags & FL_ONLADDER)) {
pl.step_time = 0.0f;
return;
}
/* the footsteps call might overwrite this later */
@ -288,6 +314,7 @@ Footsteps_Update(void)
default:
Footsteps_Default(pl);
}
}
/* switch between feet */
pl.step = 1 - pl.step;