From cfb86acc81d65a125ca08d7c248c612bb7c444a5 Mon Sep 17 00:00:00 2001 From: SkacikPL Date: Fri, 28 Jun 2019 18:15:24 +0200 Subject: [PATCH] game: Implement monster footsteps. Better tracking of enemies complementing the audio changes. Cherrypick of https://github.com/SkacikPL/Q2RTX/commit/74edb966a2605a4ca137fcb67904c12984837fc8 --- doc/040_cvarlist.md | 3 + src/game/g_main.c | 1 + src/game/header/local.h | 1 + src/game/monster/berserker/berserker.c | 42 ++++++++++--- src/game/monster/brain/brain.c | 46 ++++++++++---- src/game/monster/chick/chick.c | 56 ++++++++++++----- src/game/monster/gladiator/gladiator.c | 34 +++++++++-- src/game/monster/gunner/gunner.c | 54 ++++++++++++----- src/game/monster/infantry/infantry.c | 58 +++++++++++++----- src/game/monster/insane/insane.c | 52 +++++++++++++--- src/game/monster/medic/medic.c | 42 ++++++++++--- src/game/monster/mutant/mutant.c | 8 +-- src/game/monster/parasite/parasite.c | 8 +-- src/game/monster/soldier/soldier.c | 83 ++++++++++++++++++++------ src/game/savegame/savegame.c | 1 + 15 files changed, 382 insertions(+), 107 deletions(-) diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index e3004c14..7d44f636 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -205,6 +205,9 @@ Set `0` by default. may not be generated in all circumstances, especially when the player is moving over stairs and slopes. +* **g_monsterfootsteps**: If set to `1` monster footstep are generated. + By default this cvar is disabled (set to 0). + * **g_fix_triggered**: This cvar, when set to `1`, forces monsters to spawn in normally if they are set to a triggered spawn but do not have a targetname. There are a few cases of this in GroundZero and diff --git a/src/game/g_main.c b/src/game/g_main.c index b2939a68..a3d2a1a5 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -55,6 +55,7 @@ cvar_t *maxentities; cvar_t *g_select_empty; cvar_t *dedicated; cvar_t *g_footsteps; +cvar_t *g_monsterfootsteps; cvar_t *g_fix_triggered; cvar_t *g_commanderbody_nogod; diff --git a/src/game/header/local.h b/src/game/header/local.h index a1558b2d..fd26135b 100644 --- a/src/game/header/local.h +++ b/src/game/header/local.h @@ -520,6 +520,7 @@ extern cvar_t *needpass; extern cvar_t *g_select_empty; extern cvar_t *dedicated; extern cvar_t *g_footsteps; +extern cvar_t *g_monsterfootsteps; extern cvar_t *g_fix_triggered; extern cvar_t *g_commanderbody_nogod; diff --git a/src/game/monster/berserker/berserker.c b/src/game/monster/berserker/berserker.c index 8ed2b298..2d74d515 100644 --- a/src/game/monster/berserker/berserker.c +++ b/src/game/monster/berserker/berserker.c @@ -34,6 +34,29 @@ static int sound_punch; static int sound_sight; static int sound_search; +static int sound_step; +static int sound_step2; + +static void +berserk_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + int i; + i = rand() % (1 + 1 - 0) + 0; + + if (i == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else if (i == 1) + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void berserk_sight(edict_t *self, edict_t *other /* unused */) { @@ -146,12 +169,12 @@ mframe_t berserk_frames_walk[] = { {ai_walk, 9.1, NULL}, {ai_walk, 6.3, NULL}, {ai_walk, 4.9, NULL}, - {ai_walk, 6.7, NULL}, + {ai_walk, 6.7, berserk_footstep}, {ai_walk, 6.0, NULL}, {ai_walk, 8.2, NULL}, {ai_walk, 7.2, NULL}, {ai_walk, 6.1, NULL}, - {ai_walk, 4.9, NULL}, + {ai_walk, 4.9, berserk_footstep}, {ai_walk, 4.7, NULL}, {ai_walk, 4.7, NULL}, {ai_walk, 4.8, NULL} @@ -177,10 +200,10 @@ berserk_walk(edict_t *self) mframe_t berserk_frames_run1[] = { {ai_run, 21, NULL}, - {ai_run, 11, NULL}, + {ai_run, 11, berserk_footstep}, {ai_run, 21, NULL}, {ai_run, 25, NULL}, - {ai_run, 18, NULL}, + {ai_run, 18, berserk_footstep}, {ai_run, 19, NULL} }; @@ -270,7 +293,7 @@ berserk_attack_club(edict_t *self) mframe_t berserk_frames_attack_club[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, - {ai_charge, 0, NULL}, + {ai_charge, 0, berserk_footstep}, {ai_charge, 0, NULL}, {ai_charge, 0, berserk_swing}, {ai_charge, 0, NULL}, @@ -300,18 +323,18 @@ berserk_strike(edict_t *self) mframe_t berserk_frames_attack_strike[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, - {ai_move, 0, NULL}, + {ai_move, 0, berserk_footstep}, {ai_move, 0, berserk_swing}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, berserk_strike}, - {ai_move, 0, NULL}, + {ai_move, 0, berserk_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 9.7, NULL}, - {ai_move, 13.6, NULL} + {ai_move, 13.6, berserk_footstep} }; mmove_t berserk_move_attack_strike = @@ -557,6 +580,9 @@ SP_monster_berserk(edict_t *self) sound_search = gi.soundindex("berserk/bersrch1.wav"); sound_sight = gi.soundindex("berserk/sight.wav"); + sound_step = gi.soundindex("berserk/step1.wav"); + sound_step2 = gi.soundindex("berserk/step2.wav"); + self->s.modelindex = gi.modelindex("models/monsters/berserk/tris.md2"); VectorSet(self->mins, -16, -16, -24); VectorSet(self->maxs, 16, 16, 32); diff --git a/src/game/monster/brain/brain.c b/src/game/monster/brain/brain.c index b66bdbd0..7be35110 100644 --- a/src/game/monster/brain/brain.c +++ b/src/game/monster/brain/brain.c @@ -42,6 +42,29 @@ static int sound_melee1; static int sound_melee2; static int sound_melee3; +static int sound_step; +static int sound_step2; + +static void +brain_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + int i; + i = rand() % (1 + 1 - 0) + 0; + + if (i == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else if (i == 1) + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void brain_sight(edict_t *self, edict_t *other /* unused */) { @@ -180,13 +203,13 @@ mframe_t brain_frames_walk1[] = { {ai_walk, 7, NULL}, {ai_walk, 2, NULL}, {ai_walk, 3, NULL}, - {ai_walk, 3, NULL}, + {ai_walk, 3, brain_footstep}, {ai_walk, 1, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, {ai_walk, 9, NULL}, {ai_walk, -4, NULL}, - {ai_walk, -1, NULL}, + {ai_walk, -1, brain_footstep}, {ai_walk, 2, NULL} }; @@ -268,7 +291,7 @@ mmove_t brain_move_pain2 = mframe_t brain_frames_pain1[] = { {ai_move, -6, NULL}, {ai_move, -2, NULL}, - {ai_move, -6, NULL}, + {ai_move, -6, brain_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -285,7 +308,7 @@ mframe_t brain_frames_pain1[] = { {ai_move, 1, NULL}, {ai_move, 7, NULL}, {ai_move, 0, NULL}, - {ai_move, 3, NULL}, + {ai_move, 3, brain_footstep}, {ai_move, -1, NULL} }; @@ -352,11 +375,11 @@ mframe_t brain_frames_duck[] = { {ai_move, 0, NULL}, {ai_move, -2, brain_duck_down}, {ai_move, 17, brain_duck_hold}, - {ai_move, -3, NULL}, + {ai_move, -3, brain_footstep}, {ai_move, -1, brain_duck_up}, {ai_move, -5, NULL}, {ai_move, -6, NULL}, - {ai_move, -6, NULL} + {ai_move, -6, brain_footstep} }; mmove_t brain_move_duck = @@ -497,7 +520,7 @@ mframe_t brain_frames_attack1[] = { {ai_charge, 8, NULL}, {ai_charge, 3, NULL}, {ai_charge, 5, NULL}, - {ai_charge, 0, NULL}, + {ai_charge, 0, brain_footstep}, {ai_charge, -3, brain_swing_right}, {ai_charge, 0, NULL}, {ai_charge, -5, NULL}, @@ -511,7 +534,7 @@ mframe_t brain_frames_attack1[] = { {ai_charge, -1, NULL}, {ai_charge, -3, NULL}, {ai_charge, 2, NULL}, - {ai_charge, -11, NULL} + {ai_charge, -11, brain_footstep} }; mmove_t brain_move_attack1 = @@ -622,13 +645,13 @@ mframe_t brain_frames_run[] = { {ai_run, 9, NULL}, {ai_run, 2, NULL}, {ai_run, 3, NULL}, - {ai_run, 3, NULL}, + {ai_run, 3, brain_footstep}, {ai_run, 1, NULL}, {ai_run, 0, NULL}, {ai_run, 0, NULL}, {ai_run, 10, NULL}, {ai_run, -4, NULL}, - {ai_run, -1, NULL}, + {ai_run, -1, brain_footstep}, {ai_run, 2, NULL} }; @@ -812,6 +835,9 @@ SP_monster_brain(edict_t *self) sound_melee2 = gi.soundindex("brain/melee2.wav"); sound_melee3 = gi.soundindex("brain/melee3.wav"); + sound_step = gi.soundindex("brain/step1.wav"); + sound_step2 = gi.soundindex("brain/step2.wav"); + self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/brain/tris.md2"); diff --git a/src/game/monster/chick/chick.c b/src/game/monster/chick/chick.c index fcb97d51..d5aaed1b 100644 --- a/src/game/monster/chick/chick.c +++ b/src/game/monster/chick/chick.c @@ -51,6 +51,29 @@ static int sound_pain3; static int sound_sight; static int sound_search; +static int sound_step; +static int sound_step2; + + +void chick_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + int i; + i = rand() % (1 + 1 - 0) + 0; + + if (i == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else if (i == 1) + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void ChickMoan(edict_t *self) { @@ -204,12 +227,12 @@ mmove_t chick_move_start_run = mframe_t chick_frames_run[] = { {ai_run, 6, NULL}, - {ai_run, 8, NULL}, + {ai_run, 8, chick_footstep}, {ai_run, 13, NULL}, {ai_run, 5, NULL}, {ai_run, 7, NULL}, {ai_run, 4, NULL}, - {ai_run, 11, NULL}, + {ai_run, 11, chick_footstep}, {ai_run, 5, NULL}, {ai_run, 9, NULL}, {ai_run, 7, NULL} @@ -225,12 +248,12 @@ mmove_t chick_move_run = mframe_t chick_frames_walk[] = { {ai_walk, 6, NULL}, - {ai_walk, 8, NULL}, + {ai_walk, 8, chick_footstep}, {ai_walk, 13, NULL}, {ai_walk, 5, NULL}, {ai_walk, 7, NULL}, {ai_walk, 4, NULL}, - {ai_walk, 11, NULL}, + {ai_walk, 11, chick_footstep}, {ai_walk, 5, NULL}, {ai_walk, 9, NULL}, {ai_walk, 7, NULL} @@ -421,20 +444,20 @@ mframe_t chick_frames_death2[] = { {ai_move, -6, NULL}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, - {ai_move, -5, NULL}, + {ai_move, -5, chick_footstep}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, {ai_move, -2, NULL}, {ai_move, 1, NULL}, {ai_move, 10, NULL}, {ai_move, 2, NULL}, - {ai_move, 3, NULL}, + {ai_move, 3, chick_footstep}, {ai_move, 1, NULL}, {ai_move, 2, NULL}, {ai_move, 0, NULL}, {ai_move, 3, NULL}, {ai_move, 3, NULL}, - {ai_move, 1, NULL}, + {ai_move, 1, chick_footstep}, {ai_move, -3, NULL}, {ai_move, -5, NULL}, {ai_move, 4, NULL}, @@ -695,7 +718,7 @@ mframe_t chick_frames_start_attack1[] = { {ai_charge, -3, NULL}, {ai_charge, 3, NULL}, {ai_charge, 5, NULL}, - {ai_charge, 7, NULL}, + {ai_charge, 7, chick_footstep}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -712,17 +735,17 @@ mmove_t chick_move_start_attack1 = mframe_t chick_frames_attack1[] = { {ai_charge, 19, ChickRocket}, {ai_charge, -6, NULL}, - {ai_charge, -5, NULL}, + {ai_charge, -5, chick_footstep}, {ai_charge, -2, NULL}, - {ai_charge, -7, NULL}, + {ai_charge, -7, chick_footstep}, {ai_charge, 0, NULL}, {ai_charge, 1, NULL}, {ai_charge, 10, ChickReload}, {ai_charge, 4, NULL}, - {ai_charge, 5, NULL}, + {ai_charge, 5, chick_footstep}, {ai_charge, 6, NULL}, {ai_charge, 6, NULL}, - {ai_charge, 4, NULL}, + {ai_charge, 4, chick_footstep}, {ai_charge, 3, chick_rerocket} }; @@ -739,7 +762,7 @@ mframe_t chick_frames_end_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, -6, NULL}, {ai_charge, -4, NULL}, - {ai_charge, -2, NULL} + {ai_charge, -2, chick_footstep} }; mmove_t chick_move_end_attack1 = @@ -811,7 +834,7 @@ mframe_t chick_frames_end_slash[] = { {ai_charge, -6, NULL}, {ai_charge, -1, NULL}, {ai_charge, -6, NULL}, - {ai_charge, 0, NULL} + {ai_charge, 0, chick_footstep} }; mmove_t chick_move_end_slash = @@ -864,7 +887,7 @@ chick_slash(edict_t *self) mframe_t chick_frames_start_slash[] = { {ai_charge, 1, NULL}, {ai_charge, 8, NULL}, - {ai_charge, 3, NULL} + {ai_charge, 3, chick_footstep} }; mmove_t chick_move_start_slash = @@ -941,6 +964,9 @@ SP_monster_chick(edict_t *self) sound_sight = gi.soundindex("chick/chksght1.wav"); sound_search = gi.soundindex("chick/chksrch1.wav"); + sound_step = gi.soundindex("bitch/step1.wav"); + sound_step2 = gi.soundindex("bitch/step2.wav"); + self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/bitch/tris.md2"); diff --git a/src/game/monster/gladiator/gladiator.c b/src/game/monster/gladiator/gladiator.c index 7fa2f36c..e47103b4 100644 --- a/src/game/monster/gladiator/gladiator.c +++ b/src/game/monster/gladiator/gladiator.c @@ -38,6 +38,29 @@ static int sound_idle; static int sound_search; static int sound_sight; +static int sound_step; +static int sound_step2; + +static void +gladiator_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + int i; + i = rand() % (1 + 1 - 0) + 0; + + if (i == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else if (i == 1) + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void gladiator_idle(edict_t *self) { @@ -115,7 +138,7 @@ mframe_t gladiator_frames_walk[] = { {ai_walk, 7, NULL}, {ai_walk, 6, NULL}, {ai_walk, 5, NULL}, - {ai_walk, 2, NULL}, + {ai_walk, 2, gladiator_footstep}, {ai_walk, 0, NULL}, {ai_walk, 2, NULL}, {ai_walk, 8, NULL}, @@ -123,7 +146,7 @@ mframe_t gladiator_frames_walk[] = { {ai_walk, 8, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, - {ai_walk, 2, NULL}, + {ai_walk, 2, gladiator_footstep}, {ai_walk, 2, NULL}, {ai_walk, 1, NULL}, {ai_walk, 8, NULL} @@ -151,10 +174,10 @@ gladiator_walk(edict_t *self) mframe_t gladiator_frames_run[] = { {ai_run, 23, NULL}, {ai_run, 14, NULL}, - {ai_run, 14, NULL}, + {ai_run, 14, gladiator_footstep}, {ai_run, 21, NULL}, {ai_run, 12, NULL}, - {ai_run, 13, NULL} + {ai_run, 13, gladiator_footstep} }; mmove_t gladiator_move_run = @@ -525,6 +548,9 @@ SP_monster_gladiator(edict_t *self) sound_search = gi.soundindex("gladiator/gldsrch1.wav"); sound_sight = gi.soundindex("gladiator/sight.wav"); + sound_step = gi.soundindex("gladiator/step1.wav"); + sound_step2 = gi.soundindex("gladiator/step2.wav"); + self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/gladiatr/tris.md2"); diff --git a/src/game/monster/gunner/gunner.c b/src/game/monster/gunner/gunner.c index 3e86fc0d..a0f401d6 100644 --- a/src/game/monster/gunner/gunner.c +++ b/src/game/monster/gunner/gunner.c @@ -35,6 +35,29 @@ static int sound_open; static int sound_search; static int sound_sight; +static int sound_step; +static int sound_step2; + +static void +gunner_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + int i; + i = rand() % (1 + 1 - 0) + 0; + + if (i == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else if (i == 1) + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void gunner_idlesound(edict_t *self) { @@ -219,19 +242,19 @@ gunner_stand(edict_t *self) } mframe_t gunner_frames_walk[] = { - {ai_walk, 0, NULL}, + {ai_walk, 0, gunner_footstep}, {ai_walk, 3, NULL}, {ai_walk, 4, NULL}, {ai_walk, 5, NULL}, {ai_walk, 7, NULL}, - {ai_walk, 2, NULL}, + {ai_walk, 2, gunner_footstep}, {ai_walk, 6, NULL}, {ai_walk, 4, NULL}, {ai_walk, 2, NULL}, {ai_walk, 7, NULL}, {ai_walk, 5, NULL}, {ai_walk, 7, NULL}, - {ai_walk, 4, NULL} + {ai_walk, 4, gunner_footstep} }; mmove_t gunner_move_walk = @@ -255,11 +278,11 @@ gunner_walk(edict_t *self) mframe_t gunner_frames_run[] = { {ai_run, 26, NULL}, - {ai_run, 9, NULL}, + {ai_run, 9, gunner_footstep}, {ai_run, 9, NULL}, {ai_run, 9, NULL}, {ai_run, 15, NULL}, - {ai_run, 10, NULL}, + {ai_run, 10, gunner_footstep}, {ai_run, 13, NULL}, {ai_run, 6, NULL} }; @@ -292,10 +315,10 @@ gunner_run(edict_t *self) mframe_t gunner_frames_runandshoot[] = { {ai_run, 32, NULL}, - {ai_run, 15, NULL}, + {ai_run, 15, gunner_footstep}, {ai_run, 10, NULL}, {ai_run, 18, NULL}, - {ai_run, 8, NULL}, + {ai_run, 8, gunner_footstep}, {ai_run, 20, NULL} }; @@ -337,12 +360,12 @@ mmove_t gunner_move_pain3 = mframe_t gunner_frames_pain2[] = { {ai_move, -2, NULL}, {ai_move, 11, NULL}, - {ai_move, 6, NULL}, + {ai_move, 6, gunner_footstep}, {ai_move, 2, NULL}, {ai_move, -1, NULL}, {ai_move, -7, NULL}, {ai_move, -2, NULL}, - {ai_move, -7, NULL} + {ai_move, -7, gunner_footstep} }; mmove_t gunner_move_pain2 = @@ -356,7 +379,7 @@ mmove_t gunner_move_pain2 = mframe_t gunner_frames_pain1[] = { {ai_move, 2, NULL}, {ai_move, 0, NULL}, - {ai_move, -5, NULL}, + {ai_move, -5, gunner_footstep}, {ai_move, 3, NULL}, {ai_move, -1, NULL}, {ai_move, 0, NULL}, @@ -366,11 +389,11 @@ mframe_t gunner_frames_pain1[] = { {ai_move, 1, NULL}, {ai_move, 1, NULL}, {ai_move, 2, NULL}, - {ai_move, 1, NULL}, + {ai_move, 1, gunner_footstep}, {ai_move, 0, NULL}, {ai_move, -2, NULL}, {ai_move, -2, NULL}, - {ai_move, 0, NULL}, + {ai_move, 0, gunner_footstep}, {ai_move, 0, NULL} }; @@ -704,7 +727,7 @@ GunnerGrenade(edict_t *self) mframe_t gunner_frames_attack_chain[] = { {ai_charge, 0, gunner_opengun}, - {ai_charge, 0, NULL}, + {ai_charge, 0, gunner_footstep}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -746,7 +769,7 @@ mframe_t gunner_frames_endfire_chain[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, - {ai_charge, 0, NULL} + {ai_charge, 0, gunner_footstep} }; mmove_t gunner_move_endfire_chain = @@ -873,6 +896,9 @@ SP_monster_gunner(edict_t *self) sound_search = gi.soundindex("gunner/gunsrch1.wav"); sound_sight = gi.soundindex("gunner/sight1.wav"); + sound_step = gi.soundindex("gunner/step1.wav"); + sound_step2 = gi.soundindex("gunner/step2.wav"); + gi.soundindex("gunner/gunatck2.wav"); gi.soundindex("gunner/gunatck3.wav"); diff --git a/src/game/monster/infantry/infantry.c b/src/game/monster/infantry/infantry.c index 647737a5..1bcd2d0d 100644 --- a/src/game/monster/infantry/infantry.c +++ b/src/game/monster/infantry/infantry.c @@ -42,6 +42,29 @@ static int sound_sight; static int sound_search; static int sound_idle; +static int sound_step; +static int sound_step2; + +static void +infantry_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + int i; + i = rand() % (1 + 1 - 0) + 0; + + if (i == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else if (i == 1) + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + mframe_t infantry_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -92,7 +115,7 @@ mframe_t infantry_frames_fidget[] = { {ai_stand, 1, NULL}, {ai_stand, 3, NULL}, {ai_stand, 6, NULL}, - {ai_stand, 3, NULL}, + {ai_stand, 3, infantry_footstep}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -134,7 +157,7 @@ mframe_t infantry_frames_fidget[] = { {ai_stand, -3, NULL}, {ai_stand, -2, NULL}, {ai_stand, -3, NULL}, - {ai_stand, -3, NULL}, + {ai_stand, -3, infantry_footstep}, {ai_stand, -2, NULL} }; @@ -159,13 +182,13 @@ infantry_fidget(edict_t *self) } mframe_t infantry_frames_walk[] = { - {ai_walk, 5, NULL}, + {ai_walk, 5, infantry_footstep}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 5, NULL}, {ai_walk, 4, NULL}, {ai_walk, 5, NULL}, - {ai_walk, 6, NULL}, + {ai_walk, 6, infantry_footstep}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, @@ -194,11 +217,11 @@ infantry_walk(edict_t *self) mframe_t infantry_frames_run[] = { {ai_run, 10, NULL}, - {ai_run, 20, NULL}, + {ai_run, 20, infantry_footstep}, {ai_run, 5, NULL}, {ai_run, 7, NULL}, {ai_run, 30, NULL}, - {ai_run, 35, NULL}, + {ai_run, 35, infantry_footstep}, {ai_run, 2, NULL}, {ai_run, 6, NULL} }; @@ -229,12 +252,12 @@ mframe_t infantry_frames_pain1[] = { {ai_move, -2, NULL}, {ai_move, -1, NULL}, {ai_move, -2, NULL}, - {ai_move, -1, NULL}, + {ai_move, -1, infantry_footstep}, {ai_move, 1, NULL}, {ai_move, -1, NULL}, {ai_move, 1, NULL}, {ai_move, 6, NULL}, - {ai_move, 2, NULL} + {ai_move, 2, infantry_footstep} }; mmove_t infantry_move_pain1 = @@ -250,12 +273,12 @@ mframe_t infantry_frames_pain2[] = { {ai_move, -3, NULL}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, - {ai_move, -2, NULL}, + {ai_move, -2, infantry_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, {ai_move, 5, NULL}, - {ai_move, 2, NULL} + {ai_move, 2, infantry_footstep} }; mmove_t infantry_move_pain2 = @@ -406,11 +429,11 @@ mframe_t infantry_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -1, NULL}, - {ai_move, -4, NULL}, + {ai_move, -4, infantry_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, - {ai_move, -1, NULL}, + {ai_move, -1, infantry_footstep}, {ai_move, 3, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, @@ -439,8 +462,8 @@ mframe_t infantry_frames_death2[] = { {ai_move, 5, NULL}, {ai_move, -1, NULL}, {ai_move, 0, NULL}, - {ai_move, 1, NULL}, - {ai_move, 1, NULL}, + {ai_move, 1, infantry_footstep}, + {ai_move, 1, infantry_footstep}, {ai_move, 4, NULL}, {ai_move, 3, NULL}, {ai_move, 0, NULL}, @@ -610,7 +633,7 @@ mframe_t infantry_frames_duck[] = { {ai_move, -5, infantry_duck_hold}, {ai_move, 3, NULL}, {ai_move, 4, infantry_duck_up}, - {ai_move, 0, NULL} + {ai_move, 0, infantry_footstep} }; mmove_t infantry_move_duck = @@ -737,7 +760,7 @@ mframe_t infantry_frames_attack2[] = { {ai_charge, 3, NULL}, {ai_charge, 6, NULL}, {ai_charge, 0, infantry_swing}, - {ai_charge, 8, NULL}, + {ai_charge, 8, infantry_footstep}, {ai_charge, 5, NULL}, {ai_charge, 8, infantry_smack}, {ai_charge, 6, NULL}, @@ -801,6 +824,9 @@ SP_monster_infantry(edict_t *self) sound_search = gi.soundindex("infantry/infsrch1.wav"); sound_idle = gi.soundindex("infantry/infidle1.wav"); + sound_step = gi.soundindex("infantry/step1.wav"); + sound_step2 = gi.soundindex("infantry/step2.wav"); + self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/infantry/tris.md2"); diff --git a/src/game/monster/insane/insane.c b/src/game/monster/insane/insane.c index 0b6e1f00..c99b7fc1 100644 --- a/src/game/monster/insane/insane.c +++ b/src/game/monster/insane/insane.c @@ -34,6 +34,39 @@ static int sound_shake; static int sound_moan; static int sound_scream[8]; +static int sound_step; +static int sound_step2; +static int sound_step3; +static int sound_step4; + +static void +insane_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + int i; + i = rand() % (3 + 1 - 0) + 0; + + if (i == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 0.7, ATTN_NORM, 0); + } + else if (i == 1) + { + gi.sound(self, CHAN_BODY, sound_step2, 0.7, ATTN_NORM, 0); + } + else if (i == 2) + { + gi.sound(self, CHAN_BODY, sound_step3, 0.7, ATTN_NORM, 0); + } + else if (i == 3) + { + gi.sound(self, CHAN_BODY, sound_step4, 0.7, ATTN_NORM, 0); + } +} + + void insane_fist(edict_t *self) { @@ -336,13 +369,13 @@ mframe_t insane_frames_walk_normal[] = { {ai_walk, 1.7, NULL}, {ai_walk, 2.3, NULL}, {ai_walk, 2.4, NULL}, - {ai_walk, 2.2, NULL}, + {ai_walk, 2.2, insane_footstep}, {ai_walk, 4.2, NULL}, {ai_walk, 5.6, NULL}, {ai_walk, 3.3, NULL}, {ai_walk, 2.4, NULL}, {ai_walk, 0.9, NULL}, - {ai_walk, 0, NULL} + {ai_walk, 0, insane_footstep} }; mmove_t insane_move_walk_normal = @@ -367,25 +400,25 @@ mframe_t insane_frames_walk_insane[] = { {ai_walk, 2.9, NULL}, /* 4 */ {ai_walk, 2.2, NULL}, /* 5 */ {ai_walk, 2.6, NULL}, /* 6 */ - {ai_walk, 0, NULL}, /* 7 */ + {ai_walk, 0, insane_footstep}, /* 7 */ {ai_walk, 0.7, NULL}, /* 8 */ {ai_walk, 4.8, NULL}, /* 9 */ {ai_walk, 5.3, NULL}, /* 10 */ {ai_walk, 1.1, NULL}, /* 11 */ - {ai_walk, 2, NULL}, /* 12 */ + {ai_walk, 2, insane_footstep}, /* 12 */ {ai_walk, 0.5, NULL}, /* 13 */ {ai_walk, 0, NULL}, /* 14 */ {ai_walk, 0, NULL}, /* 15 */ {ai_walk, 4.9, NULL}, /* 16 */ {ai_walk, 6.7, NULL}, /* 17 */ {ai_walk, 3.8, NULL}, /* 18 */ - {ai_walk, 2, NULL}, /* 19 */ + {ai_walk, 2, insane_footstep}, /* 19 */ {ai_walk, 0.2, NULL}, /* 20 */ {ai_walk, 0, NULL}, /* 21 */ {ai_walk, 3.4, NULL}, /* 22 */ {ai_walk, 6.4, NULL}, /* 23 */ {ai_walk, 5, NULL}, /* 24 */ - {ai_walk, 1.8, NULL}, /* 25 */ + {ai_walk, 1.8, insane_footstep}, /* 25 */ {ai_walk, 0, NULL} /* 26 */ }; @@ -410,7 +443,7 @@ mframe_t insane_frames_stand_pain[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, - {ai_move, 0, NULL}, + {ai_move, 0, insane_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -926,6 +959,11 @@ SP_misc_insane(edict_t *self) sound_scream[6] = gi.soundindex("insane/insane9.wav"); sound_scream[7] = gi.soundindex("insane/insane10.wav"); + sound_step = gi.soundindex("player/step1.wav"); + sound_step2 = gi.soundindex("player/step2.wav"); + sound_step3 = gi.soundindex("player/step3.wav"); + sound_step4 = gi.soundindex("player/step4.wav"); + self->movetype = MOVETYPE_STEP; self->solid = SOLID_BBOX; self->s.modelindex = gi.modelindex("models/monsters/insane/tris.md2"); diff --git a/src/game/monster/medic/medic.c b/src/game/monster/medic/medic.c index 3bff87f3..b4fbe6da 100644 --- a/src/game/monster/medic/medic.c +++ b/src/game/monster/medic/medic.c @@ -40,6 +40,29 @@ static int sound_hook_hit; static int sound_hook_heal; static int sound_hook_retract; +static int sound_step; +static int sound_step2; + +static void +medic_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + int i; + i = rand() % (1 + 1 - 0) + 0; + + if (i == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else if (i == 1) + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + edict_t * medic_FindDeadMonster(edict_t *self) { @@ -280,13 +303,13 @@ medic_stand(edict_t *self) mframe_t medic_frames_walk[] = { {ai_walk, 6.2, NULL}, - {ai_walk, 18.1, NULL}, + {ai_walk, 18.1, medic_footstep}, {ai_walk, 1, NULL}, {ai_walk, 9, NULL}, {ai_walk, 10, NULL}, {ai_walk, 9, NULL}, {ai_walk, 11, NULL}, - {ai_walk, 11.6, NULL}, + {ai_walk, 11.6, medic_footstep}, {ai_walk, 2, NULL}, {ai_walk, 9.9, NULL}, {ai_walk, 14, NULL}, @@ -313,11 +336,11 @@ medic_walk(edict_t *self) } mframe_t medic_frames_run[] = { - {ai_run, 18, NULL}, + {ai_run, 18, medic_footstep}, {ai_run, 22.5, NULL}, {ai_run, 25.4, NULL}, {ai_run, 23.4, NULL}, - {ai_run, 24, NULL}, + {ai_run, 24, medic_footstep}, {ai_run, 35.6, NULL} }; @@ -387,6 +410,7 @@ mframe_t medic_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, + {ai_move, 0, medic_footstep}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -397,8 +421,7 @@ mframe_t medic_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, - {ai_move, 0, NULL}, - {ai_move, 0, NULL} + {ai_move, 0, medic_footstep} }; mmove_t medic_move_pain2 = @@ -914,7 +937,7 @@ mframe_t medic_frames_attackCable[] = { {ai_charge, 4.7, NULL}, {ai_charge, 5, NULL}, {ai_charge, 6, NULL}, - {ai_charge, 4, NULL}, + {ai_charge, 4, medic_footstep}, {ai_charge, 0, NULL}, {ai_move, 0, medic_hook_launch}, {ai_move, 0, medic_cable_attack}, @@ -928,7 +951,7 @@ mframe_t medic_frames_attackCable[] = { {ai_move, 0, medic_cable_attack}, {ai_move, -15, medic_hook_retract}, {ai_move, -1.5, NULL}, - {ai_move, -1.2, NULL}, + {ai_move, -1.2, medic_footstep}, {ai_move, -3, NULL}, {ai_move, -2, NULL}, {ai_move, 0.3, NULL}, @@ -1008,6 +1031,9 @@ SP_monster_medic(edict_t *self) sound_hook_heal = gi.soundindex("medic/medatck4.wav"); sound_hook_retract = gi.soundindex("medic/medatck5.wav"); + sound_step = gi.soundindex("medic/step1.wav"); + sound_step2 = gi.soundindex("medic/step2.wav"); + gi.soundindex("medic/medatck1.wav"); self->movetype = MOVETYPE_STEP; diff --git a/src/game/monster/mutant/mutant.c b/src/game/monster/mutant/mutant.c index ee907742..a0377f20 100644 --- a/src/game/monster/mutant/mutant.c +++ b/src/game/monster/mutant/mutant.c @@ -225,13 +225,13 @@ mutant_idle(edict_t *self) void mutant_walk(edict_t *self); mframe_t mutant_frames_walk[] = { - {ai_walk, 3, NULL}, + {ai_walk, 3, mutant_step}, {ai_walk, 1, NULL}, - {ai_walk, 5, NULL}, + {ai_walk, 5, mutant_step}, {ai_walk, 10, NULL}, {ai_walk, 13, NULL}, {ai_walk, 10, NULL}, - {ai_walk, 0, NULL}, + {ai_walk, 0, mutant_step}, {ai_walk, 5, NULL}, {ai_walk, 6, NULL}, {ai_walk, 16, NULL}, @@ -261,7 +261,7 @@ mutant_walk_loop(edict_t *self) mframe_t mutant_frames_start_walk[] = { {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, - {ai_walk, -2, NULL}, + {ai_walk, -2, mutant_step}, {ai_walk, 1, NULL} }; diff --git a/src/game/monster/parasite/parasite.c b/src/game/monster/parasite/parasite.c index 5e3428e9..b547ed69 100644 --- a/src/game/monster/parasite/parasite.c +++ b/src/game/monster/parasite/parasite.c @@ -258,10 +258,10 @@ parasite_stand(edict_t *self) mframe_t parasite_frames_run[] = { {ai_run, 30, NULL}, {ai_run, 30, NULL}, - {ai_run, 22, NULL}, - {ai_run, 19, NULL}, + {ai_run, 22, parasite_tap}, + {ai_run, 19, parasite_tap}, {ai_run, 24, NULL}, - {ai_run, 28, NULL}, + {ai_run, 28, parasite_tap}, {ai_run, 25, NULL} }; @@ -289,7 +289,7 @@ mmove_t parasite_move_start_run = mframe_t parasite_frames_stop_run[] = { {ai_run, 20, NULL}, {ai_run, 20, NULL}, - {ai_run, 12, NULL}, + {ai_run, 12, parasite_tap}, {ai_run, 10, NULL}, {ai_run, 0, NULL}, {ai_run, 0, NULL} diff --git a/src/game/monster/soldier/soldier.c b/src/game/monster/soldier/soldier.c index ea745699..d87c94a1 100644 --- a/src/game/monster/soldier/soldier.c +++ b/src/game/monster/soldier/soldier.c @@ -39,6 +39,39 @@ static int sound_death_light; static int sound_death; static int sound_death_ss; static int sound_cock; +static int sound_step; +static int sound_step2; +static int sound_step3; +static int sound_step4; + + +void +soldier_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + int i; + i = rand() % (3 + 1 - 0) + 0; + + if (i == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else if (i == 1) + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } + else if (i == 2) + { + gi.sound(self, CHAN_BODY, sound_step3, 1, ATTN_NORM, 0); + } + else if (i == 3) + { + gi.sound(self, CHAN_BODY, sound_step4, 1, ATTN_NORM, 0); + } +} + void soldier_idle(edict_t *self) @@ -207,12 +240,12 @@ mframe_t soldier_frames_walk1[] = { {ai_walk, 3, NULL}, {ai_walk, 6, NULL}, {ai_walk, 2, NULL}, - {ai_walk, 2, NULL}, + {ai_walk, 2, soldier_footstep}, {ai_walk, 2, NULL}, {ai_walk, 1, NULL}, {ai_walk, 6, NULL}, {ai_walk, 5, NULL}, - {ai_walk, 3, NULL}, + {ai_walk, 3, soldier_footstep}, {ai_walk, -1, soldier_walk1_random}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, @@ -242,17 +275,17 @@ mframe_t soldier_frames_walk1[] = { mmove_t soldier_move_walk1 = { FRAME_walk101, - FRAME_walk133, - soldier_frames_walk1, - NULL + FRAME_walk133, + soldier_frames_walk1, + NULL }; mframe_t soldier_frames_walk2[] = { - {ai_walk, 4, NULL}, + {ai_walk, 4, soldier_footstep}, {ai_walk, 4, NULL}, {ai_walk, 9, NULL}, {ai_walk, 8, NULL}, - {ai_walk, 5, NULL}, + {ai_walk, 5, soldier_footstep}, {ai_walk, 1, NULL}, {ai_walk, 3, NULL}, {ai_walk, 7, NULL}, @@ -303,10 +336,10 @@ mmove_t soldier_move_start_run = mframe_t soldier_frames_run[] = { {ai_run, 10, NULL}, - {ai_run, 11, NULL}, + {ai_run, 11, soldier_footstep}, {ai_run, 11, NULL}, {ai_run, 16, NULL}, - {ai_run, 10, NULL}, + {ai_run, 10, soldier_footstep}, {ai_run, 15, NULL} }; @@ -381,7 +414,7 @@ mmove_t soldier_move_pain2 = mframe_t soldier_frames_pain3[] = { {ai_move, -8, NULL}, {ai_move, 10, NULL}, - {ai_move, -4, NULL}, + {ai_move, -4, soldier_footstep}, {ai_move, -1, NULL}, {ai_move, -3, NULL}, {ai_move, 0, NULL}, @@ -396,7 +429,7 @@ mframe_t soldier_frames_pain3[] = { {ai_move, 2, NULL}, {ai_move, 4, NULL}, {ai_move, 3, NULL}, - {ai_move, 2, NULL} + {ai_move, 2, soldier_footstep} }; mmove_t soldier_move_pain3 = @@ -911,11 +944,11 @@ soldier_fire4(edict_t *self) mframe_t soldier_frames_attack4[] = { {ai_charge, 0, NULL}, - {ai_charge, 0, NULL}, + {ai_charge, 0, soldier_footstep}, {ai_charge, 0, soldier_fire4}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, - {ai_charge, 0, NULL} + {ai_charge, 0, soldier_footstep} }; mmove_t soldier_move_attack4 = @@ -965,17 +998,17 @@ soldier_attack6_refire(edict_t *self) mframe_t soldier_frames_attack6[] = { {ai_charge, 10, NULL}, {ai_charge, 4, NULL}, - {ai_charge, 12, NULL}, + {ai_charge, 12, soldier_footstep}, {ai_charge, 11, soldier_fire8}, {ai_charge, 13, NULL}, {ai_charge, 18, NULL}, - {ai_charge, 15, NULL}, + {ai_charge, 15, soldier_footstep}, {ai_charge, 14, NULL}, {ai_charge, 11, NULL}, - {ai_charge, 8, NULL}, + {ai_charge, 8, soldier_footstep}, {ai_charge, 11, NULL}, {ai_charge, 12, NULL}, - {ai_charge, 12, NULL}, + {ai_charge, 12, soldier_footstep}, {ai_charge, 17, soldier_attack6_refire} }; @@ -1558,6 +1591,10 @@ SP_monster_soldier_x(edict_t *self) sound_sight1 = gi.soundindex("soldier/solsght1.wav"); sound_sight2 = gi.soundindex("soldier/solsrch1.wav"); sound_cock = gi.soundindex("infantry/infatck3.wav"); + sound_step = gi.soundindex("player/step1.wav"); + sound_step2 = gi.soundindex("player/step2.wav"); + sound_step3 = gi.soundindex("player/step3.wav"); + sound_step4 = gi.soundindex("player/step4.wav"); self->mass = 100; @@ -1603,6 +1640,10 @@ SP_monster_soldier_light(edict_t *self) sound_pain_light = gi.soundindex("soldier/solpain2.wav"); sound_death_light = gi.soundindex("soldier/soldeth2.wav"); + sound_step = gi.soundindex("player/step1.wav"); + sound_step2 = gi.soundindex("player/step2.wav"); + sound_step3 = gi.soundindex("player/step3.wav"); + sound_step4 = gi.soundindex("player/step4.wav"); gi.modelindex("models/objects/laser/tris.md2"); gi.soundindex("misc/lasfly.wav"); gi.soundindex("soldier/solatck2.wav"); @@ -1634,6 +1675,10 @@ SP_monster_soldier(edict_t *self) sound_pain = gi.soundindex("soldier/solpain1.wav"); sound_death = gi.soundindex("soldier/soldeth1.wav"); + sound_step = gi.soundindex("player/step1.wav"); + sound_step2 = gi.soundindex("player/step2.wav"); + sound_step3 = gi.soundindex("player/step3.wav"); + sound_step4 = gi.soundindex("player/step4.wav"); gi.soundindex("soldier/solatck1.wav"); self->s.skinnum = 2; @@ -1663,6 +1708,10 @@ SP_monster_soldier_ss(edict_t *self) sound_pain_ss = gi.soundindex("soldier/solpain3.wav"); sound_death_ss = gi.soundindex("soldier/soldeth3.wav"); + sound_step = gi.soundindex("player/step1.wav"); + sound_step2 = gi.soundindex("player/step2.wav"); + sound_step3 = gi.soundindex("player/step3.wav"); + sound_step4 = gi.soundindex("player/step4.wav"); gi.soundindex("soldier/solatck3.wav"); self->s.skinnum = 4; diff --git a/src/game/savegame/savegame.c b/src/game/savegame/savegame.c index 06c652ff..0487acb5 100644 --- a/src/game/savegame/savegame.c +++ b/src/game/savegame/savegame.c @@ -245,6 +245,7 @@ InitGame(void) skill = gi.cvar("skill", "1", CVAR_LATCH); maxentities = gi.cvar("maxentities", "1024", CVAR_LATCH); g_footsteps = gi.cvar("g_footsteps", "1", CVAR_ARCHIVE); + g_monsterfootsteps = gi.cvar("g_monsterfootsteps", "0", CVAR_ARCHIVE); g_fix_triggered = gi.cvar ("g_fix_triggered", "0", 0); g_commanderbody_nogod = gi.cvar("g_commanderbody_nogod", "0", CVAR_ARCHIVE);