diff --git a/src/g_main.c b/src/g_main.c index 47890ff..138b46e 100644 --- a/src/g_main.c +++ b/src/g_main.c @@ -37,6 +37,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 *filterban; diff --git a/src/header/local.h b/src/header/local.h index c046a76..8d0968a 100644 --- a/src/header/local.h +++ b/src/header/local.h @@ -513,6 +513,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 *filterban; diff --git a/src/monster/berserker/berserker.c b/src/monster/berserker/berserker.c index 3060455..4479598 100644 --- a/src/monster/berserker/berserker.c +++ b/src/monster/berserker/berserker.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * The berserker. * @@ -15,10 +34,37 @@ static int sound_punch; static int sound_sight; static int sound_search; +static int sound_step; +static int sound_step2; + +void +berserk_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + // Lazy loading for savegame compatibility. + if (sound_step == 0 || sound_step2 == 0) + { + sound_step = gi.soundindex("berserk/step1.wav"); + sound_step2 = gi.soundindex("berserk/step2.wav"); + } + + if (randk() % 2 == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void berserk_sight(edict_t *self, edict_t *other /* unused */) { - if (!self) + if (!self) { return; } @@ -29,7 +75,7 @@ berserk_sight(edict_t *self, edict_t *other /* unused */) void berserk_search(edict_t *self) { - if (!self) + if (!self) { return; } @@ -39,7 +85,7 @@ berserk_search(edict_t *self) void berserk_fidget(edict_t *self); -mframe_t berserk_frames_stand[] = { +static mframe_t berserk_frames_stand[] = { {ai_stand, 0, berserk_fidget}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -47,17 +93,18 @@ mframe_t berserk_frames_stand[] = { {ai_stand, 0, NULL} }; -mmove_t berserk_move_stand = { +mmove_t berserk_move_stand = +{ FRAME_stand1, - FRAME_stand5, - berserk_frames_stand, - NULL + FRAME_stand5, + berserk_frames_stand, + NULL }; void berserk_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -65,7 +112,7 @@ berserk_stand(edict_t *self) self->monsterinfo.currentmove = &berserk_move_stand; } -mframe_t berserk_frames_stand_fidget[] = { +static mframe_t berserk_frames_stand_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -88,7 +135,8 @@ mframe_t berserk_frames_stand_fidget[] = { {ai_stand, 0, NULL} }; -mmove_t berserk_move_stand_fidget = { +mmove_t berserk_move_stand_fidget = +{ FRAME_standb1, FRAME_standb20, berserk_frames_stand_fidget, @@ -98,7 +146,7 @@ mmove_t berserk_move_stand_fidget = { void berserk_fidget(edict_t *self) { - if (!self) + if (!self) { return; } @@ -122,22 +170,23 @@ berserk_fidget(edict_t *self) gi.sound(self, CHAN_WEAPON, sound_idle, 1, ATTN_IDLE, 0); } -mframe_t berserk_frames_walk[] = { +static 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} }; -mmove_t berserk_move_walk = { +mmove_t berserk_move_walk = +{ FRAME_walkc1, FRAME_walkc11, berserk_frames_walk, @@ -147,7 +196,7 @@ mmove_t berserk_move_walk = { void berserk_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -155,16 +204,17 @@ berserk_walk(edict_t *self) self->monsterinfo.currentmove = &berserk_move_walk; } -mframe_t berserk_frames_run1[] = { +static 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} }; -mmove_t berserk_move_run1 = { +mmove_t berserk_move_run1 = +{ FRAME_run1, FRAME_run6, berserk_frames_run1, @@ -174,7 +224,7 @@ mmove_t berserk_move_run1 = { void berserk_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -194,7 +244,7 @@ berserk_attack_spike(edict_t *self) { static vec3_t aim = {MELEE_DISTANCE, 0, -24}; - if (!self) + if (!self) { return; } @@ -205,7 +255,7 @@ berserk_attack_spike(edict_t *self) void berserk_swing(edict_t *self) { - if (!self) + if (!self) { return; } @@ -213,7 +263,7 @@ berserk_swing(edict_t *self) gi.sound(self, CHAN_WEAPON, sound_punch, 1, ATTN_NORM, 0); } -mframe_t berserk_frames_attack_spike[] = { +static mframe_t berserk_frames_attack_spike[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, berserk_swing}, @@ -224,7 +274,8 @@ mframe_t berserk_frames_attack_spike[] = { {ai_charge, 0, NULL} }; -mmove_t berserk_move_attack_spike = { +mmove_t berserk_move_attack_spike = +{ FRAME_att_c1, FRAME_att_c8, berserk_frames_attack_spike, @@ -236,7 +287,7 @@ berserk_attack_club(edict_t *self) { vec3_t aim; - if (!self) + if (!self) { return; } @@ -245,10 +296,10 @@ berserk_attack_club(edict_t *self) fire_hit(self, aim, (5 + (rand() % 6)), 400); /* Slower attack */ } -mframe_t berserk_frames_attack_club[] = { - {ai_charge, 0, NULL}, +static mframe_t berserk_frames_attack_club[] = { {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}, @@ -260,7 +311,8 @@ mframe_t berserk_frames_attack_club[] = { {ai_charge, 0, NULL} }; -mmove_t berserk_move_attack_club = { +mmove_t berserk_move_attack_club = +{ FRAME_att_c9, FRAME_att_c20, berserk_frames_attack_club, @@ -274,24 +326,25 @@ berserk_strike(edict_t *self) very PITA. Let it be... */ } -mframe_t berserk_frames_attack_strike[] = { - {ai_move, 0, NULL}, +static mframe_t berserk_frames_attack_strike[] = { {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 = { +mmove_t berserk_move_attack_strike = +{ FRAME_att_c21, FRAME_att_c34, berserk_frames_attack_strike, @@ -301,7 +354,7 @@ mmove_t berserk_move_attack_strike = { void berserk_melee(edict_t *self) { - if (!self) + if (!self) { return; } @@ -316,21 +369,22 @@ berserk_melee(edict_t *self) } } -mframe_t berserk_frames_pain1[] = { +static mframe_t berserk_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; -mmove_t berserk_move_pain1 = { +mmove_t berserk_move_pain1 = +{ FRAME_painc1, FRAME_painc4, berserk_frames_pain1, berserk_run }; -mframe_t berserk_frames_pain2[] = { +static mframe_t berserk_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -353,7 +407,8 @@ mframe_t berserk_frames_pain2[] = { {ai_move, 0, NULL} }; -mmove_t berserk_move_pain2 = { +mmove_t berserk_move_pain2 = +{ FRAME_painb1, FRAME_painb20, berserk_frames_pain2, @@ -361,10 +416,10 @@ mmove_t berserk_move_pain2 = { }; void -berserk_pain(edict_t *self, edict_t *other /* unsued */, +berserk_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { - if (!self) + if (!self) { return; } @@ -400,7 +455,7 @@ berserk_pain(edict_t *self, edict_t *other /* unsued */, void berserk_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -413,7 +468,7 @@ berserk_dead(edict_t *self) gi.linkentity(self); } -mframe_t berserk_frames_death1[] = { +static mframe_t berserk_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -429,14 +484,15 @@ mframe_t berserk_frames_death1[] = { {ai_move, 0, NULL} }; -mmove_t berserk_move_death1 = { +mmove_t berserk_move_death1 = +{ FRAME_death1, FRAME_death13, berserk_frames_death1, berserk_dead }; -mframe_t berserk_frames_death2[] = { +static mframe_t berserk_frames_death2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -447,20 +503,21 @@ mframe_t berserk_frames_death2[] = { {ai_move, 0, NULL} }; -mmove_t berserk_move_death2 = { +mmove_t berserk_move_death2 = +{ FRAME_deathc1, - FRAME_deathc8, + FRAME_deathc8, berserk_frames_death2, berserk_dead }; void -berserk_die(edict_t *self, edict_t *inflictor /* unsued */, edict_t *attacker /* unused */, +berserk_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */, int damage, vec3_t point /* unused */) { int n; - if (!self) + if (!self) { return; } @@ -471,15 +528,18 @@ berserk_die(edict_t *self, edict_t *inflictor /* unsued */, edict_t *attacker /* for (n = 0; n < 2; n++) { - ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", + damage, GIB_ORGANIC); } - ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); + ThrowHead(self, "models/objects/gibs/head2/tris.md2", + damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } @@ -509,7 +569,7 @@ berserk_die(edict_t *self, edict_t *inflictor /* unsued */, edict_t *attacker /* void SP_monster_berserk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -520,6 +580,11 @@ SP_monster_berserk(edict_t *self) return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + /* pre-caches */ sound_pain = gi.soundindex("berserk/berpain2.wav"); sound_die = gi.soundindex("berserk/berdeth2.wav"); diff --git a/src/monster/boss2/boss2.c b/src/monster/boss2/boss2.c index ad2c239..8afa5c4 100644 --- a/src/monster/boss2/boss2.c +++ b/src/monster/boss2/boss2.c @@ -149,7 +149,7 @@ Boss2MachineGun(edict_t *self) boss2_firebullet_right(self); } -mframe_t boss2_frames_stand[] = { +static mframe_t boss2_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -180,7 +180,7 @@ mmove_t boss2_move_stand = { NULL }; -mframe_t boss2_frames_fidget[] = { +static mframe_t boss2_frames_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -220,7 +220,7 @@ mmove_t boss2_move_fidget = { NULL }; -mframe_t boss2_frames_walk[] = { +static mframe_t boss2_frames_walk[] = { {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, {ai_walk, 8, NULL}, @@ -250,7 +250,7 @@ mmove_t boss2_move_walk = { NULL }; -mframe_t boss2_frames_run[] = { +static mframe_t boss2_frames_run[] = { {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, @@ -280,7 +280,7 @@ mmove_t boss2_move_run = { NULL }; -mframe_t boss2_frames_attack_pre_mg[] = { +static mframe_t boss2_frames_attack_pre_mg[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, @@ -299,7 +299,7 @@ mmove_t boss2_move_attack_pre_mg = { NULL }; -mframe_t boss2_frames_attack_mg[] = { +static mframe_t boss2_frames_attack_mg[] = { {ai_charge, 1, Boss2MachineGun}, {ai_charge, 1, Boss2MachineGun}, {ai_charge, 1, Boss2MachineGun}, @@ -315,7 +315,7 @@ mmove_t boss2_move_attack_mg = { NULL }; -mframe_t boss2_frames_attack_post_mg[] = { +static mframe_t boss2_frames_attack_post_mg[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, @@ -329,7 +329,7 @@ mmove_t boss2_move_attack_post_mg = { boss2_run }; -mframe_t boss2_frames_attack_rocket[] = { +static mframe_t boss2_frames_attack_rocket[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, @@ -360,7 +360,7 @@ mmove_t boss2_move_attack_rocket = { boss2_run }; -mframe_t boss2_frames_pain_heavy[] = { +static mframe_t boss2_frames_pain_heavy[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -388,7 +388,7 @@ mmove_t boss2_move_pain_heavy = { boss2_run }; -mframe_t boss2_frames_pain_light[] = { +static mframe_t boss2_frames_pain_light[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -402,7 +402,7 @@ mmove_t boss2_move_pain_light = { boss2_run }; -mframe_t boss2_frames_death[] = { +static mframe_t boss2_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, diff --git a/src/monster/boss3/boss31.c b/src/monster/boss3/boss31.c index a8f70d0..ab0cfa7 100644 --- a/src/monster/boss3/boss31.c +++ b/src/monster/boss3/boss31.c @@ -67,7 +67,7 @@ jorg_search(edict_t *self) } /* stand */ -mframe_t jorg_frames_stand[] = { +static mframe_t jorg_frames_stand[] = { {ai_stand, 0, jorg_idle}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -183,7 +183,7 @@ jorg_stand(edict_t *self) self->monsterinfo.currentmove = &jorg_move_stand; } -mframe_t jorg_frames_run[] = { +static mframe_t jorg_frames_run[] = { {ai_run, 17, jorg_step_left}, {ai_run, 0, NULL}, {ai_run, 0, NULL}, @@ -208,7 +208,7 @@ mmove_t jorg_move_run = { }; /* walk */ -mframe_t jorg_frames_start_walk[] = { +static mframe_t jorg_frames_start_walk[] = { {ai_walk, 5, NULL}, {ai_walk, 6, NULL}, {ai_walk, 7, NULL}, @@ -223,7 +223,7 @@ mmove_t jorg_move_start_walk = { NULL }; -mframe_t jorg_frames_walk[] = { +static mframe_t jorg_frames_walk[] = { {ai_walk, 17, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, @@ -247,7 +247,7 @@ mmove_t jorg_move_walk = { NULL }; -mframe_t jorg_frames_end_walk[] = { +static mframe_t jorg_frames_end_walk[] = { {ai_walk, 11, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, @@ -292,7 +292,7 @@ jorg_run(edict_t *self) } } -mframe_t jorg_frames_pain3[] = { +static mframe_t jorg_frames_pain3[] = { {ai_move, -28, NULL}, {ai_move, -6, NULL}, {ai_move, -3, jorg_step_left}, @@ -327,7 +327,7 @@ mmove_t jorg_move_pain3 = { jorg_run }; -mframe_t jorg_frames_pain2[] = { +static mframe_t jorg_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} @@ -340,7 +340,7 @@ mmove_t jorg_move_pain2 = { jorg_run }; -mframe_t jorg_frames_pain1[] = { +static mframe_t jorg_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} @@ -353,7 +353,7 @@ mmove_t jorg_move_pain1 = { jorg_run }; -mframe_t jorg_frames_death1[] = { +static mframe_t jorg_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -413,7 +413,7 @@ mmove_t jorg_move_death = { jorg_dead }; -mframe_t jorg_frames_attack2[] = { +static mframe_t jorg_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -436,7 +436,7 @@ mmove_t jorg_move_attack2 = { jorg_run }; -mframe_t jorg_frames_start_attack1[] = { +static mframe_t jorg_frames_start_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -454,7 +454,7 @@ mmove_t jorg_move_start_attack1 = { jorg_attack1 }; -mframe_t jorg_frames_attack1[] = { +static mframe_t jorg_frames_attack1[] = { {ai_charge, 0, jorg_firebullet}, {ai_charge, 0, jorg_firebullet}, {ai_charge, 0, jorg_firebullet}, @@ -470,7 +470,7 @@ mmove_t jorg_move_attack1 = { jorg_reattack1 }; -mframe_t jorg_frames_end_attack1[] = { +static mframe_t jorg_frames_end_attack1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, diff --git a/src/monster/boss3/boss32.c b/src/monster/boss3/boss32.c index 95ffddd..20680d8 100644 --- a/src/monster/boss3/boss32.c +++ b/src/monster/boss3/boss32.c @@ -60,7 +60,7 @@ makron_taunt(edict_t *self) } /* stand */ -mframe_t makron_frames_stand[] = { +static mframe_t makron_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -141,7 +141,7 @@ makron_stand(edict_t *self) self->monsterinfo.currentmove = &makron_move_stand; } -mframe_t makron_frames_run[] = { +static mframe_t makron_frames_run[] = { {ai_run, 3, makron_step_left}, {ai_run, 12, NULL}, {ai_run, 8, NULL}, @@ -227,19 +227,6 @@ makron_prerailgun(edict_t *self) gi.sound(self, CHAN_WEAPON, sound_prerailgun, 1, ATTN_NORM, 0); } -mframe_t makron_frames_walk[] = { - {ai_walk, 3, makron_step_left}, - {ai_walk, 12, NULL}, - {ai_walk, 8, NULL}, - {ai_walk, 8, NULL}, - {ai_walk, 8, makron_step_right}, - {ai_walk, 6, NULL}, - {ai_walk, 12, NULL}, - {ai_walk, 9, NULL}, - {ai_walk, 6, NULL}, - {ai_walk, 12, NULL} -}; - mmove_t makron_move_walk = { FRAME_walk204, FRAME_walk213, @@ -276,7 +263,7 @@ makron_run(edict_t *self) } } -mframe_t makron_frames_pain6[] = { +static mframe_t makron_frames_pain6[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -313,7 +300,7 @@ mmove_t makron_move_pain6 = { makron_run }; -mframe_t makron_frames_pain5[] = { +static mframe_t makron_frames_pain5[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -327,7 +314,7 @@ mmove_t makron_move_pain5 = { makron_run }; -mframe_t makron_frames_pain4[] = { +static mframe_t makron_frames_pain4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -341,7 +328,7 @@ mmove_t makron_move_pain4 = { makron_run }; -mframe_t makron_frames_death2[] = { +static mframe_t makron_frames_death2[] = { {ai_move, -15, NULL}, {ai_move, 3, NULL}, {ai_move, -12, NULL}, @@ -446,7 +433,7 @@ mmove_t makron_move_death2 = { makron_dead }; -mframe_t makron_frames_death3[] = { +static mframe_t makron_frames_death3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -476,7 +463,7 @@ mmove_t makron_move_death3 = { NULL }; -mframe_t makron_frames_sight[] = { +static mframe_t makron_frames_sight[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -524,7 +511,7 @@ makronBFG(edict_t *self) monster_fire_bfg(self, start, dir, 50, 300, 100, 300, MZ2_MAKRON_BFG); } -mframe_t makron_frames_attack3[] = { +static mframe_t makron_frames_attack3[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -542,7 +529,7 @@ mmove_t makron_move_attack3 = { makron_run }; -mframe_t makron_frames_attack4[] = { +static mframe_t makron_frames_attack4[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -578,7 +565,7 @@ mmove_t makron_move_attack4 = { makron_run }; -mframe_t makron_frames_attack5[] = { +static mframe_t makron_frames_attack5[] = { {ai_charge, 0, makron_prerailgun}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, diff --git a/src/monster/boss5/boss5.c b/src/monster/boss5/boss5.c index befc7b9..4a0b0cf 100644 --- a/src/monster/boss5/boss5.c +++ b/src/monster/boss5/boss5.c @@ -53,7 +53,7 @@ boss5_search(edict_t *self) } /* stand */ -mframe_t boss5_frames_stand[] = { +static mframe_t boss5_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -134,7 +134,7 @@ boss5_stand(edict_t *self) self->monsterinfo.currentmove = &boss5_move_stand; } -mframe_t boss5_frames_run[] = { +static mframe_t boss5_frames_run[] = { {ai_run, 12, TreadSound2}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, @@ -163,7 +163,7 @@ mmove_t boss5_move_run = { }; /* walk */ -mframe_t boss5_frames_forward[] = { +static mframe_t boss5_frames_forward[] = { {ai_walk, 4, TreadSound2}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, @@ -231,7 +231,7 @@ boss5_run(edict_t *self) } } -mframe_t boss5_frames_turn_right[] = { +static mframe_t boss5_frames_turn_right[] = { {ai_move, 0, TreadSound2}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -259,7 +259,7 @@ mmove_t boss5_move_turn_right = { boss5_run }; -mframe_t boss5_frames_turn_left[] = { +static mframe_t boss5_frames_turn_left[] = { {ai_move, 0, TreadSound2}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -287,7 +287,7 @@ mmove_t boss5_move_turn_left = { boss5_run }; -mframe_t boss5_frames_pain3[] = { +static mframe_t boss5_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -301,7 +301,7 @@ mmove_t boss5_move_pain3 = { boss5_run }; -mframe_t boss5_frames_pain2[] = { +static mframe_t boss5_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -315,7 +315,7 @@ mmove_t boss5_move_pain2 = { boss5_run }; -mframe_t boss5_frames_pain1[] = { +static mframe_t boss5_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -329,7 +329,7 @@ mmove_t boss5_move_pain1 = { boss5_run }; -mframe_t boss5_frames_death1[] = { +static mframe_t boss5_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -363,7 +363,7 @@ mmove_t boss5_move_death = { boss5_dead }; -mframe_t boss5_frames_backward[] = { +static mframe_t boss5_frames_backward[] = { {ai_walk, 0, TreadSound2}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, @@ -391,7 +391,7 @@ mmove_t boss5_move_backward = { NULL }; -mframe_t boss5_frames_attack4[] = { +static mframe_t boss5_frames_attack4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -407,7 +407,7 @@ mmove_t boss5_move_attack4 = { boss5_run }; -mframe_t boss5_frames_attack3[] = { +static mframe_t boss5_frames_attack3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -444,7 +444,7 @@ mmove_t boss5_move_attack3 = { boss5_run }; -mframe_t boss5_frames_attack2[] = { +static mframe_t boss5_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -481,7 +481,7 @@ mmove_t boss5_move_attack2 = { boss5_run }; -mframe_t boss5_frames_attack1[] = { +static mframe_t boss5_frames_attack1[] = { {ai_charge, 0, boss5MachineGun}, {ai_charge, 0, boss5MachineGun}, {ai_charge, 0, boss5MachineGun}, @@ -497,7 +497,7 @@ mmove_t boss5_move_attack1 = { boss5_reattack1 }; -mframe_t boss5_frames_end_attack1[] = { +static mframe_t boss5_frames_end_attack1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, diff --git a/src/monster/brain/brain.c b/src/monster/brain/brain.c index 3c40a73..62dd42a 100644 --- a/src/monster/brain/brain.c +++ b/src/monster/brain/brain.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * Brain. * @@ -22,13 +41,42 @@ static int sound_search; static int sound_melee1; static int sound_melee2; static int sound_melee3; + +static int sound_step; +static int sound_step2; + + void brain_run(edict_t *self); void brain_dead(edict_t *self); +void +brain_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + // Lazy loading for savegame compatibility. + if (sound_step == 0 || sound_step2 == 0) + { + sound_step = gi.soundindex("brain/step1.wav"); + sound_step2 = gi.soundindex("brain/step2.wav"); + } + + if (randk() % 2 == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void brain_sight(edict_t *self, edict_t *other /* unused */) { - if (!self) + if (!self) { return; } @@ -39,7 +87,7 @@ brain_sight(edict_t *self, edict_t *other /* unused */) void brain_search(edict_t *self) { - if (!self) + if (!self) { return; } @@ -49,7 +97,7 @@ brain_search(edict_t *self) /* STAND */ -mframe_t brain_frames_stand[] = { +static mframe_t brain_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -84,17 +132,18 @@ mframe_t brain_frames_stand[] = { {ai_stand, 0, NULL} }; -mmove_t brain_move_stand = { +mmove_t brain_move_stand = +{ FRAME_stand01, - FRAME_stand30, - brain_frames_stand, - NULL + FRAME_stand30, + brain_frames_stand, + NULL }; void brain_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -104,7 +153,7 @@ brain_stand(edict_t *self) /* IDLE */ -mframe_t brain_frames_idle[] = { +static mframe_t brain_frames_idle[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -139,17 +188,18 @@ mframe_t brain_frames_idle[] = { {ai_stand, 0, NULL} }; -mmove_t brain_move_idle = { +mmove_t brain_move_idle = +{ FRAME_stand31, - FRAME_stand60, - brain_frames_idle, - brain_stand + FRAME_stand60, + brain_frames_idle, + brain_stand }; void brain_idle(edict_t *self) { - if (!self) + if (!self) { return; } @@ -160,31 +210,32 @@ brain_idle(edict_t *self) /* WALK */ -mframe_t brain_frames_walk1[] = { +static 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} }; -mmove_t brain_move_walk1 = { +mmove_t brain_move_walk1 = +{ FRAME_walk101, FRAME_walk111, - brain_frames_walk1, - NULL + brain_frames_walk1, + NULL }; void brain_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -192,7 +243,7 @@ brain_walk(edict_t *self) self->monsterinfo.currentmove = &brain_move_walk1; } -mframe_t brain_frames_defense[] = { +static mframe_t brain_frames_defense[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -204,14 +255,15 @@ mframe_t brain_frames_defense[] = { {ai_move, 0, NULL} }; -mmove_t brain_move_defense = { +mmove_t brain_move_defense = +{ FRAME_defens01, - FRAME_defens08, - brain_frames_defense, - NULL + FRAME_defens08, + brain_frames_defense, + NULL }; -mframe_t brain_frames_pain3[] = { +static mframe_t brain_frames_pain3[] = { {ai_move, -2, NULL}, {ai_move, 2, NULL}, {ai_move, 1, NULL}, @@ -220,14 +272,15 @@ mframe_t brain_frames_pain3[] = { {ai_move, -4, NULL} }; -mmove_t brain_move_pain3 = { +mmove_t brain_move_pain3 = +{ FRAME_pain301, - FRAME_pain306, - brain_frames_pain3, - brain_run + FRAME_pain306, + brain_frames_pain3, + brain_run }; -mframe_t brain_frames_pain2[] = { +static mframe_t brain_frames_pain2[] = { {ai_move, -2, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -238,17 +291,18 @@ mframe_t brain_frames_pain2[] = { {ai_move, -2, NULL} }; -mmove_t brain_move_pain2 = { +mmove_t brain_move_pain2 = +{ FRAME_pain201, FRAME_pain208, brain_frames_pain2, brain_run }; -mframe_t brain_frames_pain1[] = { +static 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}, @@ -265,15 +319,16 @@ 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} }; -mmove_t brain_move_pain1 = { +mmove_t brain_move_pain1 = +{ FRAME_pain101, - FRAME_pain121, - brain_frames_pain1, - brain_run + FRAME_pain121, + brain_frames_pain1, + brain_run }; /* DUCK */ @@ -281,7 +336,7 @@ mmove_t brain_move_pain1 = { void brain_duck_down(edict_t *self) { - if (!self) + if (!self) { return; } @@ -300,7 +355,7 @@ brain_duck_down(edict_t *self) void brain_duck_hold(edict_t *self) { - if (!self) + if (!self) { return; } @@ -318,7 +373,7 @@ brain_duck_hold(edict_t *self) void brain_duck_up(edict_t *self) { - if (!self) + if (!self) { return; } @@ -329,18 +384,19 @@ brain_duck_up(edict_t *self) gi.linkentity(self); } -mframe_t brain_frames_duck[] = { +static 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 = { +mmove_t brain_move_duck = +{ FRAME_duck01, FRAME_duck08, brain_frames_duck, @@ -370,7 +426,7 @@ brain_dodge(edict_t *self, edict_t *attacker, float eta) self->monsterinfo.currentmove = &brain_move_duck; } -mframe_t brain_frames_death2[] = { +static mframe_t brain_frames_death2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -378,14 +434,15 @@ mframe_t brain_frames_death2[] = { {ai_move, 0, NULL} }; -mmove_t brain_move_death2 = { +mmove_t brain_move_death2 = +{ FRAME_death201, FRAME_death205, brain_frames_death2, - brain_dead + brain_dead }; -mframe_t brain_frames_death1[] = { +static mframe_t brain_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -2, NULL}, @@ -406,7 +463,8 @@ mframe_t brain_frames_death1[] = { {ai_move, 0, NULL} }; -mmove_t brain_move_death1 = { +mmove_t brain_move_death1 = +{ FRAME_death101, FRAME_death118, brain_frames_death1, @@ -418,7 +476,7 @@ mmove_t brain_move_death1 = { void brain_swing_right(edict_t *self) { - if (!self) + if (!self) { return; } @@ -431,7 +489,7 @@ brain_hit_right(edict_t *self) { vec3_t aim; - if (!self) + if (!self) { return; } @@ -447,7 +505,7 @@ brain_hit_right(edict_t *self) void brain_swing_left(edict_t *self) { - if (!self) + if (!self) { return; } @@ -460,7 +518,7 @@ brain_hit_left(edict_t *self) { vec3_t aim; - if (!self) + if (!self) { return; } @@ -473,11 +531,11 @@ brain_hit_left(edict_t *self) } } -mframe_t brain_frames_attack1[] = { +static 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}, @@ -491,20 +549,21 @@ 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 = { +mmove_t brain_move_attack1 = +{ FRAME_attak101, - FRAME_attak118, - brain_frames_attack1, - brain_run + FRAME_attak118, + brain_frames_attack1, + brain_run }; void brain_chest_open(edict_t *self) { - if (!self) + if (!self) { return; } @@ -519,7 +578,7 @@ brain_tentacle_attack(edict_t *self) { vec3_t aim; - if (!self) + if (!self) { return; } @@ -537,7 +596,7 @@ brain_tentacle_attack(edict_t *self) void brain_chest_closed(edict_t *self) { - if (!self) + if (!self) { return; } @@ -551,7 +610,7 @@ brain_chest_closed(edict_t *self) } } -mframe_t brain_frames_attack2[] = { +static mframe_t brain_frames_attack2[] = { {ai_charge, 5, NULL}, {ai_charge, -4, NULL}, {ai_charge, -4, NULL}, @@ -571,17 +630,18 @@ mframe_t brain_frames_attack2[] = { {ai_charge, -6, NULL} }; -mmove_t brain_move_attack2 = { +mmove_t brain_move_attack2 = +{ FRAME_attak201, - FRAME_attak217, - brain_frames_attack2, - brain_run + FRAME_attak217, + brain_frames_attack2, + brain_run }; void brain_melee(edict_t *self) { - if (!self) + if (!self) { return; } @@ -806,7 +866,7 @@ brain_laserbeam_reattack(edict_t *self) } } -mframe_t brain_frames_attack3[] = { +static mframe_t brain_frames_attack3[] = { {ai_charge, 5, NULL}, {ai_charge, -4, NULL}, {ai_charge, -4, NULL}, @@ -833,7 +893,7 @@ mmove_t brain_move_attack3 = { brain_run }; -mframe_t brain_frames_attack4[] = { +static mframe_t brain_frames_attack4[] = { {ai_charge, 9, brain_laserbeam}, {ai_charge, 2, brain_laserbeam}, {ai_charge, 3, brain_laserbeam}, @@ -888,23 +948,24 @@ brain_attack(edict_t *self) /* RUN */ -mframe_t brain_frames_run[] = { +static 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} }; -mmove_t brain_move_run = { +mmove_t brain_move_run = +{ FRAME_walk101, - FRAME_walk111, + FRAME_walk111, brain_frames_run, NULL }; @@ -912,7 +973,7 @@ mmove_t brain_move_run = { void brain_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -935,7 +996,7 @@ brain_pain(edict_t *self, edict_t *other /* unused */, { float r; - if (!self) + if (!self) { return; } @@ -979,7 +1040,7 @@ brain_pain(edict_t *self, edict_t *other /* unused */, void brain_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -998,7 +1059,7 @@ brain_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* u { int n; - if (!self) + if (!self) { return; } @@ -1056,7 +1117,7 @@ brain_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* u void SP_monster_brain(edict_t *self) { - if (!self) + if (!self) { return; } @@ -1067,6 +1128,11 @@ SP_monster_brain(edict_t *self) return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + sound_chest_open = gi.soundindex("brain/brnatck1.wav"); sound_tentacles_extend = gi.soundindex("brain/brnatck2.wav"); sound_tentacles_retract = gi.soundindex("brain/brnatck3.wav"); diff --git a/src/monster/chick/chick.c b/src/monster/chick/chick.c index c331a97..9811534 100644 --- a/src/monster/chick/chick.c +++ b/src/monster/chick/chick.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * Iron Maiden. * @@ -32,10 +51,38 @@ 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; + + // Lazy loading for savegame compatibility. + if (sound_step == 0 || sound_step2 == 0) + { + sound_step = gi.soundindex("bitch/step1.wav"); + sound_step2 = gi.soundindex("bitch/step2.wav"); + } + + if (randk() % 2 == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void ChickMoan(edict_t *self) { - if (!self) + if (!self) { return; } @@ -50,7 +97,7 @@ ChickMoan(edict_t *self) } } -mframe_t chick_frames_fidget[] = { +static mframe_t chick_frames_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -83,7 +130,8 @@ mframe_t chick_frames_fidget[] = { {ai_stand, 0, NULL} }; -mmove_t chick_move_fidget = { +mmove_t chick_move_fidget = +{ FRAME_stand201, FRAME_stand230, chick_frames_fidget, @@ -93,7 +141,7 @@ mmove_t chick_move_fidget = { void chick_fidget(edict_t *self) { - if (!self) + if (!self) { return; } @@ -109,7 +157,7 @@ chick_fidget(edict_t *self) } } -mframe_t chick_frames_stand[] = { +static mframe_t chick_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -142,7 +190,8 @@ mframe_t chick_frames_stand[] = { {ai_stand, 0, chick_fidget}, }; -mmove_t chick_move_stand = { +mmove_t chick_move_stand = +{ FRAME_stand101, FRAME_stand130, chick_frames_stand, @@ -152,7 +201,7 @@ mmove_t chick_move_stand = { void chick_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -160,7 +209,7 @@ chick_stand(edict_t *self) self->monsterinfo.currentmove = &chick_move_stand; } -mframe_t chick_frames_start_run[] = { +static mframe_t chick_frames_start_run[] = { {ai_run, 1, NULL}, {ai_run, 0, NULL}, {ai_run, 0, NULL}, @@ -173,47 +222,50 @@ mframe_t chick_frames_start_run[] = { {ai_run, 3, NULL} }; -mmove_t chick_move_start_run = { +mmove_t chick_move_start_run = +{ FRAME_walk01, FRAME_walk10, chick_frames_start_run, chick_run }; -mframe_t chick_frames_run[] = { +static 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} }; -mmove_t chick_move_run = { +mmove_t chick_move_run = +{ FRAME_walk11, FRAME_walk20, chick_frames_run, NULL }; -mframe_t chick_frames_walk[] = { +static 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} }; -mmove_t chick_move_walk = { +mmove_t chick_move_walk = +{ FRAME_walk11, FRAME_walk20, chick_frames_walk, @@ -223,7 +275,7 @@ mmove_t chick_move_walk = { void chick_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -234,7 +286,7 @@ chick_walk(edict_t *self) void chick_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -256,7 +308,7 @@ chick_run(edict_t *self) } } -mframe_t chick_frames_pain1[] = { +static mframe_t chick_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -264,14 +316,15 @@ mframe_t chick_frames_pain1[] = { {ai_move, 0, NULL} }; -mmove_t chick_move_pain1 = { +mmove_t chick_move_pain1 = +{ FRAME_pain101, FRAME_pain105, chick_frames_pain1, chick_run }; -mframe_t chick_frames_pain2[] = { +static mframe_t chick_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -279,14 +332,15 @@ mframe_t chick_frames_pain2[] = { {ai_move, 0, NULL} }; -mmove_t chick_move_pain2 = { +mmove_t chick_move_pain2 = +{ FRAME_pain201, FRAME_pain205, - chick_frames_pain2, + chick_frames_pain2, chick_run }; -mframe_t chick_frames_pain3[] = { +static mframe_t chick_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -6, NULL}, @@ -310,10 +364,11 @@ mframe_t chick_frames_pain3[] = { {ai_move, 2, NULL} }; -mmove_t chick_move_pain3 = { +mmove_t chick_move_pain3 = +{ FRAME_pain301, FRAME_pain321, - chick_frames_pain3, + chick_frames_pain3, chick_run }; @@ -323,7 +378,7 @@ chick_pain(edict_t *self, edict_t *other /* unused */, { float r; - if (!self) + if (!self) { return; } @@ -377,7 +432,7 @@ chick_pain(edict_t *self, edict_t *other /* unused */, void chick_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -390,24 +445,24 @@ chick_dead(edict_t *self) gi.linkentity(self); } -mframe_t chick_frames_death2[] = { +static 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}, @@ -416,14 +471,15 @@ mframe_t chick_frames_death2[] = { {ai_move, 1, NULL} }; -mmove_t chick_move_death2 = { +mmove_t chick_move_death2 = +{ FRAME_death201, FRAME_death223, chick_frames_death2, chick_dead }; -mframe_t chick_frames_death1[] = { +static mframe_t chick_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, -7, NULL}, @@ -438,11 +494,12 @@ mframe_t chick_frames_death1[] = { {ai_move, 0, NULL} }; -mmove_t chick_move_death1 = { +mmove_t chick_move_death1 = +{ FRAME_death101, - FRAME_death112, - chick_frames_death1, - chick_dead + FRAME_death112, + chick_frames_death1, + chick_dead }; void @@ -452,7 +509,7 @@ chick_die(edict_t *self, edict_t *inflictor /* unused */, { int n; - if (!self) + if (!self) { return; } @@ -507,7 +564,7 @@ chick_die(edict_t *self, edict_t *inflictor /* unused */, void chick_duck_down(edict_t *self) { - if (!self) + if (!self) { return; } @@ -527,7 +584,7 @@ chick_duck_down(edict_t *self) void chick_duck_hold(edict_t *self) { - if (!self) + if (!self) { return; } @@ -545,7 +602,7 @@ chick_duck_hold(edict_t *self) void chick_duck_up(edict_t *self) { - if (!self) + if (!self) { return; } @@ -556,7 +613,7 @@ chick_duck_up(edict_t *self) gi.linkentity(self); } -mframe_t chick_frames_duck[] = { +static mframe_t chick_frames_duck[] = { {ai_move, 0, chick_duck_down}, {ai_move, 1, NULL}, {ai_move, 4, chick_duck_hold}, @@ -566,15 +623,16 @@ mframe_t chick_frames_duck[] = { {ai_move, 1, NULL} }; -mmove_t chick_move_duck = { +mmove_t chick_move_duck = +{ FRAME_duck01, - FRAME_duck07, - chick_frames_duck, - chick_run + FRAME_duck07, + chick_frames_duck, + chick_run }; void -chick_dodge(edict_t *self, edict_t *attacker, float eta) +chick_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) { if (!self || !attacker) { @@ -600,7 +658,7 @@ ChickSlash(edict_t *self) { vec3_t aim; - if (!self) + if (!self) { return; } @@ -645,7 +703,7 @@ ChickRocket(edict_t *self) void Chick_PreAttack1(edict_t *self) { - if (!self) + if (!self) { return; } @@ -656,7 +714,7 @@ Chick_PreAttack1(edict_t *self) void ChickReload(edict_t *self) { - if (!self) + if (!self) { return; } @@ -664,7 +722,7 @@ ChickReload(edict_t *self) gi.sound(self, CHAN_VOICE, sound_missile_reload, 1, ATTN_NORM, 0); } -mframe_t chick_frames_start_attack1[] = { +static mframe_t chick_frames_start_attack1[] = { {ai_charge, 0, Chick_PreAttack1}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -673,63 +731,66 @@ 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}, {ai_charge, 0, chick_attack1} }; -mmove_t chick_move_start_attack1 = { +mmove_t chick_move_start_attack1 = +{ FRAME_attak101, - FRAME_attak113, - chick_frames_start_attack1, - NULL + FRAME_attak113, + chick_frames_start_attack1, + NULL }; -mframe_t chick_frames_attack1[] = { +static 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} }; -mmove_t chick_move_attack1 = { +mmove_t chick_move_attack1 = +{ FRAME_attak114, - FRAME_attak127, - chick_frames_attack1, - NULL + FRAME_attak127, + chick_frames_attack1, + NULL }; -mframe_t chick_frames_end_attack1[] = { +static mframe_t chick_frames_end_attack1[] = { {ai_charge, -3, NULL}, {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 = { +mmove_t chick_move_end_attack1 = +{ FRAME_attak128, FRAME_attak132, chick_frames_end_attack1, - chick_run + chick_run }; void chick_rerocket(edict_t *self) { - if (!self) + if (!self) { return; } @@ -755,7 +816,7 @@ chick_rerocket(edict_t *self) void chick_attack1(edict_t *self) { - if (!self) + if (!self) { return; } @@ -763,7 +824,7 @@ chick_attack1(edict_t *self) self->monsterinfo.currentmove = &chick_move_attack1; } -mframe_t chick_frames_slash[] = { +static mframe_t chick_frames_slash[] = { {ai_charge, 1, NULL}, {ai_charge, 7, ChickSlash}, {ai_charge, -7, NULL}, @@ -775,31 +836,33 @@ mframe_t chick_frames_slash[] = { {ai_charge, -2, chick_reslash} }; -mmove_t chick_move_slash = { +mmove_t chick_move_slash = +{ FRAME_attak204, - FRAME_attak212, - chick_frames_slash, - NULL + FRAME_attak212, + chick_frames_slash, + NULL }; -mframe_t chick_frames_end_slash[] = { +static 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 = { +mmove_t chick_move_end_slash = +{ FRAME_attak213, FRAME_attak216, - chick_frames_end_slash, + chick_frames_end_slash, chick_run }; void chick_reslash(edict_t *self) { - if (!self) + if (!self) { return; } @@ -827,26 +890,32 @@ chick_reslash(edict_t *self) void chick_slash(edict_t *self) { + if (!self) + { + return; + } + self->monsterinfo.currentmove = &chick_move_slash; } -mframe_t chick_frames_start_slash[] = { +static 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 = { +mmove_t chick_move_start_slash = +{ FRAME_attak201, FRAME_attak203, chick_frames_start_slash, - chick_slash + chick_slash }; void chick_melee(edict_t *self) { - if (!self) + if (!self) { return; } @@ -857,7 +926,7 @@ chick_melee(edict_t *self) void chick_attack(edict_t *self) { - if (!self) + if (!self) { return; } @@ -868,7 +937,7 @@ chick_attack(edict_t *self) void chick_sight(edict_t *self, edict_t *other /* unused */) { - if (!self) + if (!self) { return; } @@ -882,7 +951,7 @@ chick_sight(edict_t *self, edict_t *other /* unused */) void SP_monster_chick(edict_t *self) { - if (!self) + if (!self) { return; } @@ -893,6 +962,11 @@ SP_monster_chick(edict_t *self) return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + sound_missile_prelaunch = gi.soundindex("chick/chkatck1.wav"); sound_missile_launch = gi.soundindex("chick/chkatck2.wav"); sound_melee_swing = gi.soundindex("chick/chkatck3.wav"); diff --git a/src/monster/fixbot/fixbot.c b/src/monster/fixbot/fixbot.c index bb942ac..054b6c9 100644 --- a/src/monster/fixbot/fixbot.c +++ b/src/monster/fixbot/fixbot.c @@ -691,7 +691,7 @@ fly_vertical2(edict_t *self) } } -mframe_t fixbot_frames_landing[] = { +static mframe_t fixbot_frames_landing[] = { {ai_move, 0, NULL}, {ai_move, 0, fly_vertical2}, {ai_move, 0, fly_vertical2}, @@ -765,7 +765,7 @@ mmove_t fixbot_move_landing = { }; /* generic ambient stand */ -mframe_t fixbot_frames_stand[] = { +static mframe_t fixbot_frames_stand[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -795,7 +795,7 @@ mmove_t fixbot_move_stand = { NULL }; -mframe_t fixbot_frames_stand2[] = { +static mframe_t fixbot_frames_stand2[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -831,7 +831,7 @@ mmove_t fixbot_move_stand2 = { * and take the object with it ( this may require a * variant of liftoff and landing ) */ -mframe_t fixbot_frames_pickup[] = { +static mframe_t fixbot_frames_pickup[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -871,7 +871,7 @@ mmove_t fixbot_move_pickup = { }; /* generic frame to move bot */ -mframe_t fixbot_frames_roamgoal[] = { +static mframe_t fixbot_frames_roamgoal[] = { {ai_move, 0, roam_goal} }; @@ -904,7 +904,7 @@ ai_facing(edict_t *self, float dist) } } -mframe_t fixbot_frames_turn[] = { +static mframe_t fixbot_frames_turn[] = { {ai_facing, 0, NULL} }; @@ -927,7 +927,7 @@ go_roam(edict_t *self) } /* takeoff */ -mframe_t fixbot_frames_takeoff[] = { +static mframe_t fixbot_frames_takeoff[] = { {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, {ai_move, 0.01, fly_vertical}, @@ -955,7 +955,7 @@ mmove_t fixbot_move_takeoff = { }; /* findout what this is */ -mframe_t fixbot_frames_paina[] = { +static mframe_t fixbot_frames_paina[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -972,7 +972,7 @@ mmove_t fixbot_move_paina = { }; /* findout what this is */ -mframe_t fixbot_frames_painb[] = { +static mframe_t fixbot_frames_painb[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -995,7 +995,7 @@ mmove_t fixbot_move_painb = { * call a generic painsound * some spark effects */ -mframe_t fixbot_frames_pain3[] = { +static mframe_t fixbot_frames_pain3[] = { {ai_move, -1, NULL} }; @@ -1012,7 +1012,7 @@ mmove_t fixbot_move_pain3 = { * ( may need second land if the * bot is releasing jib into jib vat ) */ -mframe_t fixbot_frames_land[] = { +static mframe_t fixbot_frames_land[] = { {ai_move, 0, NULL} }; @@ -1034,7 +1034,7 @@ ai_movetogoal(edict_t *self, float dist) M_MoveToGoal(self, dist); } -mframe_t fixbot_frames_forward[] = { +static mframe_t fixbot_frames_forward[] = { {ai_movetogoal, 5, use_scanner} }; @@ -1045,7 +1045,7 @@ mmove_t fixbot_move_forward = { NULL }; -mframe_t fixbot_frames_walk[] = { +static mframe_t fixbot_frames_walk[] = { {ai_walk, 5, NULL} }; @@ -1056,7 +1056,7 @@ mmove_t fixbot_move_walk = { NULL }; -mframe_t fixbot_frames_run[] = { +static mframe_t fixbot_frames_run[] = { {ai_run, 10, NULL} }; @@ -1067,7 +1067,7 @@ mmove_t fixbot_move_run = { NULL }; -mframe_t fixbot_frames_death1[] = { +static mframe_t fixbot_frames_death1[] = { {ai_move, 0, NULL} }; @@ -1078,7 +1078,7 @@ mmove_t fixbot_move_death1 = { fixbot_dead }; -mframe_t fixbot_frames_backward[] = { +static mframe_t fixbot_frames_backward[] = { {ai_move, 0, NULL} }; @@ -1089,7 +1089,7 @@ mmove_t fixbot_move_backward = { NULL }; -mframe_t fixbot_frames_start_attack[] = { +static mframe_t fixbot_frames_start_attack[] = { {ai_charge, 0, NULL} }; @@ -1100,7 +1100,7 @@ mmove_t fixbot_move_start_attack = { fixbot_attack }; -mframe_t fixbot_frames_attack1[] = { +static mframe_t fixbot_frames_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -1218,7 +1218,7 @@ fixbot_fire_laser(edict_t *self) } } -mframe_t fixbot_frames_laserattack[] = { +static mframe_t fixbot_frames_laserattack[] = { {ai_charge, 0, fixbot_fire_laser}, {ai_charge, 0, fixbot_fire_laser}, {ai_charge, 0, fixbot_fire_laser}, @@ -1236,7 +1236,7 @@ mmove_t fixbot_move_laserattack = { /* need to get forward translation data for the charge attack */ -mframe_t fixbot_frames_attack2[] = { +static mframe_t fixbot_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -1331,7 +1331,7 @@ ai_move2(edict_t *self, float dist) M_ChangeYaw(self); } -mframe_t fixbot_frames_weld_start[] = { +static mframe_t fixbot_frames_weld_start[] = { {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, {ai_move2, 0, NULL}, @@ -1351,7 +1351,7 @@ mmove_t fixbot_move_weld_start = { NULL }; -mframe_t fixbot_frames_weld[] = { +static mframe_t fixbot_frames_weld[] = { {ai_move2, 0, fixbot_fire_welder}, {ai_move2, 0, fixbot_fire_welder}, {ai_move2, 0, fixbot_fire_welder}, @@ -1368,7 +1368,7 @@ mmove_t fixbot_move_weld = { NULL }; -mframe_t fixbot_frames_weld_end[] = { +static mframe_t fixbot_frames_weld_end[] = { {ai_move2, -2, NULL}, {ai_move2, -2, NULL}, {ai_move2, -2, NULL}, diff --git a/src/monster/flipper/flipper.c b/src/monster/flipper/flipper.c index 2a5863d..af12210 100644 --- a/src/monster/flipper/flipper.c +++ b/src/monster/flipper/flipper.c @@ -21,7 +21,7 @@ static int sound_sight; void flipper_stand(edict_t *self); -mframe_t flipper_frames_stand[] = { +static mframe_t flipper_frames_stand[] = { {ai_stand, 0, NULL} }; @@ -43,7 +43,7 @@ flipper_stand(edict_t *self) self->monsterinfo.currentmove = &flipper_move_stand; } -mframe_t flipper_frames_run[] = { +static mframe_t flipper_frames_run[] = { {ai_run, FLIPPER_RUN_SPEED, NULL}, /* 6 */ {ai_run, FLIPPER_RUN_SPEED, NULL}, {ai_run, FLIPPER_RUN_SPEED, NULL}, @@ -90,7 +90,7 @@ flipper_run_loop(edict_t *self) self->monsterinfo.currentmove = &flipper_move_run_loop; } -mframe_t flipper_frames_run_start[] = { +static mframe_t flipper_frames_run_start[] = { {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, @@ -118,7 +118,7 @@ flipper_run(edict_t *self) } /* Standard Swimming */ -mframe_t flipper_frames_walk[] = { +static mframe_t flipper_frames_walk[] = { {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, @@ -163,7 +163,7 @@ flipper_walk(edict_t *self) self->monsterinfo.currentmove = &flipper_move_walk; } -mframe_t flipper_frames_start_run[] = { +static mframe_t flipper_frames_start_run[] = { {ai_run, 8, NULL}, {ai_run, 8, NULL}, {ai_run, 8, NULL}, @@ -188,7 +188,7 @@ flipper_start_run(edict_t *self) self->monsterinfo.currentmove = &flipper_move_start_run; } -mframe_t flipper_frames_pain2[] = { +static mframe_t flipper_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -203,7 +203,7 @@ mmove_t flipper_move_pain2 = { flipper_run }; -mframe_t flipper_frames_pain1[] = { +static mframe_t flipper_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -243,7 +243,7 @@ flipper_preattack(edict_t *self) gi.sound(self, CHAN_WEAPON, sound_chomp, 1, ATTN_NORM, 0); } -mframe_t flipper_frames_attack[] = { +static mframe_t flipper_frames_attack[] = { {ai_charge, 0, flipper_preattack}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -353,7 +353,7 @@ flipper_dead(edict_t *self) gi.linkentity(self); } -mframe_t flipper_frames_death[] = { +static mframe_t flipper_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, diff --git a/src/monster/float/float.c b/src/monster/float/float.c index 9584d22..38f5173 100644 --- a/src/monster/float/float.c +++ b/src/monster/float/float.c @@ -79,7 +79,7 @@ floater_fire_blaster(edict_t *self) monster_fire_blaster(self, start, dir, 1, 1000, MZ2_FLOAT_BLASTER_1, effect); } -mframe_t floater_frames_stand1[] = { +static mframe_t floater_frames_stand1[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -141,7 +141,7 @@ mmove_t floater_move_stand1 = { NULL }; -mframe_t floater_frames_stand2[] = { +static mframe_t floater_frames_stand2[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -221,7 +221,7 @@ floater_stand(edict_t *self) } } -mframe_t floater_frames_activate[] = { +static mframe_t floater_frames_activate[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -261,7 +261,7 @@ mmove_t floater_move_activate = { NULL }; -mframe_t floater_frames_attack1[] = { +static mframe_t floater_frames_attack1[] = { {ai_charge, 0, NULL}, /* Blaster attack */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -285,7 +285,7 @@ mmove_t floater_move_attack1 = { floater_run }; -mframe_t floater_frames_attack2[] = { +static mframe_t floater_frames_attack2[] = { {ai_charge, 0, NULL}, /* Claws */ {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -320,7 +320,7 @@ mmove_t floater_move_attack2 = { floater_run }; -mframe_t floater_frames_attack3[] = { +static mframe_t floater_frames_attack3[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -364,7 +364,7 @@ mmove_t floater_move_attack3 = { floater_run }; -mframe_t floater_frames_death[] = { +static mframe_t floater_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -387,7 +387,7 @@ mmove_t floater_move_death = { floater_dead }; -mframe_t floater_frames_pain1[] = { +static mframe_t floater_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -404,7 +404,7 @@ mmove_t floater_move_pain1 = { floater_run }; -mframe_t floater_frames_pain2[] = { +static mframe_t floater_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -422,7 +422,7 @@ mmove_t floater_move_pain2 = { floater_run }; -mframe_t floater_frames_pain3[] = { +static mframe_t floater_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -444,7 +444,7 @@ mmove_t floater_move_pain3 = { floater_run }; -mframe_t floater_frames_walk[] = { +static mframe_t floater_frames_walk[] = { {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, @@ -506,7 +506,7 @@ mmove_t floater_move_walk = { NULL }; -mframe_t floater_frames_run[] = { +static mframe_t floater_frames_run[] = { {ai_run, 13, NULL}, {ai_run, 13, NULL}, {ai_run, 13, NULL}, diff --git a/src/monster/flyer/flyer.c b/src/monster/flyer/flyer.c index 7fb6e64..c988b3b 100644 --- a/src/monster/flyer/flyer.c +++ b/src/monster/flyer/flyer.c @@ -59,7 +59,7 @@ flyer_pop_blades(edict_t *self) gi.sound(self, CHAN_VOICE, sound_sproing, 1, ATTN_NORM, 0); } -mframe_t flyer_frames_stand[] = { +static mframe_t flyer_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -114,7 +114,7 @@ mmove_t flyer_move_stand = { NULL }; -mframe_t flyer_frames_walk[] = { +static mframe_t flyer_frames_walk[] = { {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, @@ -169,7 +169,7 @@ mmove_t flyer_move_walk = { NULL }; -mframe_t flyer_frames_run[] = { +static mframe_t flyer_frames_run[] = { {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, @@ -264,7 +264,7 @@ flyer_stand(edict_t *self) self->monsterinfo.currentmove = &flyer_move_stand; } -mframe_t flyer_frames_start[] = { +static mframe_t flyer_frames_start[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -280,7 +280,7 @@ mmove_t flyer_move_start = { NULL }; -mframe_t flyer_frames_stop[] = { +static mframe_t flyer_frames_stop[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -319,7 +319,7 @@ flyer_start(edict_t *self) self->monsterinfo.currentmove = &flyer_move_start; } -mframe_t flyer_frames_rollright[] = { +static mframe_t flyer_frames_rollright[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -338,7 +338,7 @@ mmove_t flyer_move_rollright = { NULL }; -mframe_t flyer_frames_rollleft[] = { +static mframe_t flyer_frames_rollleft[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -357,7 +357,7 @@ mmove_t flyer_move_rollleft = { NULL }; -mframe_t flyer_frames_pain3[] = { +static mframe_t flyer_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -371,7 +371,7 @@ mmove_t flyer_move_pain3 = { flyer_run }; -mframe_t flyer_frames_pain2[] = { +static mframe_t flyer_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -385,7 +385,7 @@ mmove_t flyer_move_pain2 = { flyer_run }; -mframe_t flyer_frames_pain1[] = { +static mframe_t flyer_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -404,7 +404,7 @@ mmove_t flyer_move_pain1 = { flyer_run }; -mframe_t flyer_frames_defense[] = { +static mframe_t flyer_frames_defense[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, /* Hold this frame */ @@ -420,7 +420,7 @@ mmove_t flyer_move_defense = { NULL }; -mframe_t flyer_frames_bankright[] = { +static mframe_t flyer_frames_bankright[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -437,7 +437,7 @@ mmove_t flyer_move_bankright = { NULL }; -mframe_t flyer_frames_bankleft[] = { +static mframe_t flyer_frames_bankleft[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -511,7 +511,7 @@ flyer_fireright(edict_t *self) flyer_fire(self, MZ2_FLYER_BLASTER_2); } -mframe_t flyer_frames_attack2[] = { +static mframe_t flyer_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -568,7 +568,7 @@ flyer_slash_right(edict_t *self) gi.sound(self, CHAN_WEAPON, sound_slash, 1, ATTN_NORM, 0); } -mframe_t flyer_frames_start_melee[] = { +static mframe_t flyer_frames_start_melee[] = { {ai_charge, 0, flyer_pop_blades}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -584,7 +584,7 @@ mmove_t flyer_move_start_melee = { flyer_loop_melee }; -mframe_t flyer_frames_end_melee[] = { +static mframe_t flyer_frames_end_melee[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL} @@ -597,7 +597,7 @@ mmove_t flyer_move_end_melee = { flyer_run }; -mframe_t flyer_frames_loop_melee[] = { +static mframe_t flyer_frames_loop_melee[] = { {ai_charge, 0, NULL}, /* Loop Start */ {ai_charge, 0, NULL}, {ai_charge, 0, flyer_slash_left}, /* Left Wing Strike */ diff --git a/src/monster/gekk/gekk.c b/src/monster/gekk/gekk.c index ee2e9f4..c24bd27 100644 --- a/src/monster/gekk/gekk.c +++ b/src/monster/gekk/gekk.c @@ -325,7 +325,7 @@ ai_stand2(edict_t *self, float dist) } } -mframe_t gekk_frames_stand[] = { +static mframe_t gekk_frames_stand[] = { {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, @@ -378,7 +378,7 @@ mmove_t gekk_move_stand = { NULL }; -mframe_t gekk_frames_standunderwater[] = { +static mframe_t gekk_frames_standunderwater[] = { {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, @@ -405,7 +405,7 @@ gekk_swim_loop(edict_t *self) self->monsterinfo.currentmove = &gekk_move_swim_loop; } -mframe_t gekk_frames_swim[] = { +static mframe_t gekk_frames_swim[] = { {ai_run, 16, NULL}, {ai_run, 16, NULL}, {ai_run, 16, NULL}, @@ -420,7 +420,7 @@ mmove_t gekk_move_swim_loop = { gekk_swim_loop }; -mframe_t gekk_frames_swim_start[] = { +static mframe_t gekk_frames_swim_start[] = { {ai_run, 14, NULL}, {ai_run, 14, NULL}, {ai_run, 14, NULL}, @@ -516,7 +516,7 @@ gekk_idle_loop(edict_t *self) } } -mframe_t gekk_frames_idle[] = { +static mframe_t gekk_frames_idle[] = { {ai_stand2, 0, gekk_search}, {ai_stand2, 0, NULL}, {ai_stand2, 0, NULL}, @@ -586,7 +586,7 @@ gekk_idle(edict_t *self) } } -mframe_t gekk_frames_walk[] = { +static mframe_t gekk_frames_walk[] = { {ai_walk, 3.849, gekk_check_underwater}, /* frame 0 */ {ai_walk, 19.606, NULL}, /* frame 1 */ {ai_walk, 25.583, NULL}, /* frame 2 */ @@ -657,7 +657,7 @@ gekk_run(edict_t *self) } } -mframe_t gekk_frames_run[] = { +static mframe_t gekk_frames_run[] = { {ai_run, 3.849, gekk_check_underwater}, /* frame 0 */ {ai_run, 19.606, NULL}, /* frame 1 */ {ai_run, 25.583, NULL}, /* frame 2 */ @@ -673,7 +673,7 @@ mmove_t gekk_move_run = { NULL }; -mframe_t gekk_frames_run_st[] = { +static mframe_t gekk_frames_run_st[] = { {ai_run, 0.212, NULL}, /* frame 0 */ {ai_run, 19.753, NULL}, /* frame 1 */ }; @@ -895,7 +895,7 @@ reloogie(edict_t *self) } } -mframe_t gekk_frames_spit[] = { +static mframe_t gekk_frames_spit[] = { {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, @@ -913,7 +913,7 @@ mmove_t gekk_move_spit = { gekk_run_start }; -mframe_t gekk_frames_attack1[] = { +static mframe_t gekk_frames_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -934,7 +934,7 @@ mmove_t gekk_move_attack1 = { gekk_run_start }; -mframe_t gekk_frames_attack2[] = { +static mframe_t gekk_frames_attack2[] = { {ai_charge, 0.000, NULL}, {ai_charge, 0.000, NULL}, {ai_charge, 0.000, gekk_hit_left}, @@ -969,7 +969,7 @@ gekk_check_underwater(edict_t *self) } } -mframe_t gekk_frames_leapatk[] = { +static mframe_t gekk_frames_leapatk[] = { {ai_charge, 0.000, NULL}, /* frame 0 */ {ai_charge, -0.387, NULL}, /* frame 1 */ {ai_charge, -1.113, NULL}, /* frame 2 */ @@ -999,7 +999,7 @@ mmove_t gekk_move_leapatk = { gekk_run_start }; -mframe_t gekk_frames_leapatk2[] = { +static mframe_t gekk_frames_leapatk2[] = { {ai_charge, 0.000, NULL}, /* frame 0 */ {ai_charge, -0.387, NULL}, /* frame 1 */ {ai_charge, -1.113, NULL}, /* frame 2 */ @@ -1049,7 +1049,7 @@ gekk_preattack(edict_t *self) /* Unused but PITA to remove */ } -mframe_t gekk_frames_attack[] = { +static mframe_t gekk_frames_attack[] = { {ai_charge, 16, gekk_preattack}, {ai_charge, 16, NULL}, {ai_charge, 16, NULL}, @@ -1296,7 +1296,7 @@ gekk_jump(edict_t *self) } } -mframe_t gekk_frames_pain[] = { +static mframe_t gekk_frames_pain[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ @@ -1312,7 +1312,7 @@ mmove_t gekk_move_pain = { gekk_run_start }; -mframe_t gekk_frames_pain1[] = { +static mframe_t gekk_frames_pain1[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ @@ -1334,7 +1334,7 @@ mmove_t gekk_move_pain1 = { gekk_run_start }; -mframe_t gekk_frames_pain2[] = { +static mframe_t gekk_frames_pain2[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ @@ -1480,7 +1480,7 @@ isgibfest(edict_t *self) } } -mframe_t gekk_frames_death1[] = { +static mframe_t gekk_frames_death1[] = { {ai_move, -5.151, NULL}, /* frame 0 */ {ai_move, -12.223, NULL}, /* frame 1 */ {ai_move, -11.484, NULL}, /* frame 2 */ @@ -1500,7 +1500,7 @@ mmove_t gekk_move_death1 = { gekk_dead }; -mframe_t gekk_frames_death3[] = { +static mframe_t gekk_frames_death3[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.022, NULL}, /* frame 1 */ {ai_move, 0.169, NULL}, /* frame 2 */ @@ -1517,7 +1517,7 @@ mmove_t gekk_move_death3 = { gekk_dead }; -mframe_t gekk_frames_death4[] = { +static mframe_t gekk_frames_death4[] = { {ai_move, 5.103, NULL}, /* frame 0 */ {ai_move, -4.808, NULL}, /* frame 1 */ {ai_move, -10.509, NULL}, /* frame 2 */ @@ -1562,7 +1562,7 @@ mmove_t gekk_move_death4 = { gekk_dead }; -mframe_t gekk_frames_wdeath[] = { +static mframe_t gekk_frames_wdeath[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ @@ -1731,7 +1731,7 @@ gekk_duck_hold(edict_t *self) } } -mframe_t gekk_frames_lduck[] = { +static mframe_t gekk_frames_lduck[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ @@ -1754,7 +1754,7 @@ mmove_t gekk_move_lduck = { gekk_run_start }; -mframe_t gekk_frames_rduck[] = { +static mframe_t gekk_frames_rduck[] = { {ai_move, 0.000, NULL}, /* frame 0 */ {ai_move, 0.000, NULL}, /* frame 1 */ {ai_move, 0.000, NULL}, /* frame 2 */ diff --git a/src/monster/gladiator/gladb.c b/src/monster/gladiator/gladb.c index 6a7e5da..b6b2bb6 100644 --- a/src/monster/gladiator/gladb.c +++ b/src/monster/gladiator/gladb.c @@ -63,7 +63,7 @@ gladb_cleaver_swing(edict_t *self) gi.sound(self, CHAN_WEAPON, sound_cleaver_swing, 1, ATTN_NORM, 0); } -mframe_t gladb_frames_stand[] = { +static mframe_t gladb_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -91,7 +91,7 @@ gladb_stand(edict_t *self) self->monsterinfo.currentmove = &gladb_move_stand; } -mframe_t gladb_frames_walk[] = { +static mframe_t gladb_frames_walk[] = { {ai_walk, 15, NULL}, {ai_walk, 7, NULL}, {ai_walk, 6, NULL}, @@ -128,7 +128,7 @@ gladb_walk(edict_t *self) self->monsterinfo.currentmove = &gladb_move_walk; } -mframe_t gladb_frames_run[] = { +static mframe_t gladb_frames_run[] = { {ai_run, 23, NULL}, {ai_run, 14, NULL}, {ai_run, 14, NULL}, @@ -184,7 +184,7 @@ GladbMelee(edict_t *self) } } -mframe_t gladb_frames_attack_melee[] = { +static mframe_t gladb_frames_attack_melee[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -259,7 +259,7 @@ gladbGun_check(edict_t *self) } } -mframe_t gladb_frames_attack_gun[] = { +static mframe_t gladb_frames_attack_gun[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, gladbGun}, @@ -311,7 +311,7 @@ gladb_attack(edict_t *self) self->monsterinfo.currentmove = &gladb_move_attack_gun; } -mframe_t gladb_frames_pain[] = { +static mframe_t gladb_frames_pain[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -326,7 +326,7 @@ mmove_t gladb_move_pain = { gladb_frames_pain, gladb_run }; -mframe_t gladb_frames_pain_air[] = { +static mframe_t gladb_frames_pain_air[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -405,7 +405,7 @@ gladb_dead(edict_t *self) gi.linkentity(self); } -mframe_t gladb_frames_death[] = { +static mframe_t gladb_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, diff --git a/src/monster/gladiator/gladiator.c b/src/monster/gladiator/gladiator.c index 0d52a02..e7c8618 100644 --- a/src/monster/gladiator/gladiator.c +++ b/src/monster/gladiator/gladiator.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * Gladiator. * @@ -19,10 +38,37 @@ static int sound_idle; static int sound_search; static int sound_sight; +static int sound_step; +static int sound_step2; + +void +gladiator_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + // Lazy loading for savegame compatibility. + if (sound_step == 0 || sound_step2 == 0) + { + sound_step = gi.soundindex("gladiator/step1.wav"); + sound_step2 = gi.soundindex("gladiator/step2.wav"); + } + + if (randk() % 2 == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void gladiator_idle(edict_t *self) { - if (!self) + if (!self) { return; } @@ -33,7 +79,7 @@ gladiator_idle(edict_t *self) void gladiator_sight(edict_t *self, edict_t *other /* unused */) { - if (!self) + if (!self) { return; } @@ -44,7 +90,7 @@ gladiator_sight(edict_t *self, edict_t *other /* unused */) void gladiator_search(edict_t *self) { - if (!self) + if (!self) { return; } @@ -55,7 +101,7 @@ gladiator_search(edict_t *self) void gladiator_cleaver_swing(edict_t *self) { - if (!self) + if (!self) { return; } @@ -63,7 +109,7 @@ gladiator_cleaver_swing(edict_t *self) gi.sound(self, CHAN_WEAPON, sound_cleaver_swing, 1, ATTN_NORM, 0); } -mframe_t gladiator_frames_stand[] = { +static mframe_t gladiator_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -73,17 +119,18 @@ mframe_t gladiator_frames_stand[] = { {ai_stand, 0, NULL} }; -mmove_t gladiator_move_stand = { +mmove_t gladiator_move_stand = +{ FRAME_stand1, - FRAME_stand7, - gladiator_frames_stand, - NULL + FRAME_stand7, + gladiator_frames_stand, + NULL }; void gladiator_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -91,12 +138,12 @@ gladiator_stand(edict_t *self) self->monsterinfo.currentmove = &gladiator_move_stand; } -mframe_t gladiator_frames_walk[] = { +static mframe_t gladiator_frames_walk[] = { {ai_walk, 15, NULL}, {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}, @@ -104,23 +151,24 @@ 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} }; -mmove_t gladiator_move_walk = { +mmove_t gladiator_move_walk = +{ FRAME_walk1, - FRAME_walk16, - gladiator_frames_walk, - NULL + FRAME_walk16, + gladiator_frames_walk, + NULL }; void gladiator_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -128,26 +176,27 @@ gladiator_walk(edict_t *self) self->monsterinfo.currentmove = &gladiator_move_walk; } -mframe_t gladiator_frames_run[] = { +static 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 = { +mmove_t gladiator_move_run = +{ FRAME_run1, - FRAME_run6, - gladiator_frames_run, - NULL + FRAME_run6, + gladiator_frames_run, + NULL }; void gladiator_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -167,7 +216,7 @@ GaldiatorMelee(edict_t *self) { vec3_t aim; - if (!self) + if (!self) { return; } @@ -184,7 +233,7 @@ GaldiatorMelee(edict_t *self) } } -mframe_t gladiator_frames_attack_melee[] = { +static mframe_t gladiator_frames_attack_melee[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -204,17 +253,18 @@ mframe_t gladiator_frames_attack_melee[] = { {ai_charge, 0, NULL} }; -mmove_t gladiator_move_attack_melee = { +mmove_t gladiator_move_attack_melee = +{ FRAME_melee1, - FRAME_melee17, - gladiator_frames_attack_melee, - gladiator_run + FRAME_melee17, + gladiator_frames_attack_melee, + gladiator_run }; void gladiator_melee(edict_t *self) { - if (!self) + if (!self) { return; } @@ -229,7 +279,7 @@ GladiatorGun(edict_t *self) vec3_t dir; vec3_t forward, right; - if (!self) + if (!self) { return; } @@ -245,7 +295,7 @@ GladiatorGun(edict_t *self) monster_fire_railgun(self, start, dir, 50, 100, MZ2_GLADIATOR_RAILGUN_1); } -mframe_t gladiator_frames_attack_gun[] = { +static mframe_t gladiator_frames_attack_gun[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -257,11 +307,12 @@ mframe_t gladiator_frames_attack_gun[] = { {ai_charge, 0, NULL} }; -mmove_t gladiator_move_attack_gun = { +mmove_t gladiator_move_attack_gun = +{ FRAME_attack1, - FRAME_attack9, - gladiator_frames_attack_gun, - gladiator_run + FRAME_attack9, + gladiator_frames_attack_gun, + gladiator_run }; void @@ -270,7 +321,7 @@ gladiator_attack(edict_t *self) float range; vec3_t v; - if (!self) + if (!self) { return; } @@ -297,7 +348,7 @@ gladiator_attack(edict_t *self) self->monsterinfo.currentmove = &gladiator_move_attack_gun; } -mframe_t gladiator_frames_pain[] = { +static mframe_t gladiator_frames_pain[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -306,14 +357,15 @@ mframe_t gladiator_frames_pain[] = { {ai_move, 0, NULL} }; -mmove_t gladiator_move_pain = { +mmove_t gladiator_move_pain = +{ FRAME_pain1, - FRAME_pain6, - gladiator_frames_pain, - gladiator_run + FRAME_pain6, + gladiator_frames_pain, + gladiator_run }; -mframe_t gladiator_frames_pain_air[] = { +static mframe_t gladiator_frames_pain_air[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -323,18 +375,19 @@ mframe_t gladiator_frames_pain_air[] = { {ai_move, 0, NULL} }; -mmove_t gladiator_move_pain_air = { +mmove_t gladiator_move_pain_air = +{ FRAME_painup1, - FRAME_painup7, - gladiator_frames_pain_air, - gladiator_run + FRAME_painup7, + gladiator_frames_pain_air, + gladiator_run }; void gladiator_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { - if (!self) + if (!self) { return; } @@ -384,7 +437,7 @@ gladiator_pain(edict_t *self, edict_t *other /* unused */, void gladiator_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -397,7 +450,7 @@ gladiator_dead(edict_t *self) gi.linkentity(self); } -mframe_t gladiator_frames_death[] = { +static mframe_t gladiator_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -422,11 +475,12 @@ mframe_t gladiator_frames_death[] = { {ai_move, 0, NULL} }; -mmove_t gladiator_move_death = { +mmove_t gladiator_move_death = +{ FRAME_death1, - FRAME_death22, - gladiator_frames_death, - gladiator_dead + FRAME_death22, + gladiator_frames_death, + gladiator_dead }; void @@ -436,7 +490,7 @@ gladiator_die(edict_t *self, edict_t *inflictor /* unused */, { int n; - if (!self) + if (!self) { return; } @@ -484,7 +538,7 @@ gladiator_die(edict_t *self, edict_t *inflictor /* unused */, void SP_monster_gladiator(edict_t *self) { - if (!self) + if (!self) { return; } @@ -495,6 +549,11 @@ SP_monster_gladiator(edict_t *self) return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + sound_pain1 = gi.soundindex("gladiator/pain.wav"); sound_pain2 = gi.soundindex("gladiator/gldpain2.wav"); sound_die = gi.soundindex("gladiator/glddeth2.wav"); diff --git a/src/monster/gunner/gunner.c b/src/monster/gunner/gunner.c index 8b88ba6..a1beb60 100644 --- a/src/monster/gunner/gunner.c +++ b/src/monster/gunner/gunner.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * Gunner. * @@ -16,6 +35,9 @@ static int sound_open; static int sound_search; static int sound_sight; +static int sound_step; +static int sound_step2; + qboolean visible(edict_t *self, edict_t *other); void GunnerGrenade(edict_t *self); void GunnerFire(edict_t *self); @@ -23,10 +45,34 @@ void gunner_fire_chain(edict_t *self); void gunner_refire_chain(edict_t *self); void gunner_stand(edict_t *self); +void +gunner_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + // Lazy loading for savegame compatibility. + if (sound_step == 0 || sound_step2 == 0) + { + sound_step = gi.soundindex("gunner/step1.wav"); + sound_step2 = gi.soundindex("gunner/step2.wav"); + } + + if (randk() % 2 == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + void gunner_idlesound(edict_t *self) { - if (!self) + if (!self) { return; } @@ -35,9 +81,9 @@ gunner_idlesound(edict_t *self) } void -gunner_sight(edict_t *self, edict_t *other) +gunner_sight(edict_t *self, edict_t *other /* unused */) { - if (!self) + if (!self) { return; } @@ -48,7 +94,7 @@ gunner_sight(edict_t *self, edict_t *other) void gunner_search(edict_t *self) { - if (!self) + if (!self) { return; } @@ -56,7 +102,7 @@ gunner_search(edict_t *self) gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0); } -mframe_t gunner_frames_fidget[] = { +static mframe_t gunner_frames_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -112,17 +158,18 @@ mframe_t gunner_frames_fidget[] = { {ai_stand, 0, NULL} }; -mmove_t gunner_move_fidget = { +mmove_t gunner_move_fidget = +{ FRAME_stand31, FRAME_stand70, - gunner_frames_fidget, + gunner_frames_fidget, gunner_stand }; void gunner_fidget(edict_t *self) { - if (!self) + if (!self) { return; } @@ -143,7 +190,7 @@ gunner_fidget(edict_t *self) } } -mframe_t gunner_frames_stand[] = { +static mframe_t gunner_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -178,17 +225,18 @@ mframe_t gunner_frames_stand[] = { {ai_stand, 0, gunner_fidget} }; -mmove_t gunner_move_stand = { +mmove_t gunner_move_stand = +{ FRAME_stand01, - FRAME_stand30, - gunner_frames_stand, - NULL + FRAME_stand30, + gunner_frames_stand, + NULL }; void gunner_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -196,33 +244,34 @@ gunner_stand(edict_t *self) self->monsterinfo.currentmove = &gunner_move_stand; } -mframe_t gunner_frames_walk[] = { - {ai_walk, 0, NULL}, +static mframe_t gunner_frames_walk[] = { + {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 = { +mmove_t gunner_move_walk = +{ FRAME_walk07, - FRAME_walk19, - gunner_frames_walk, - NULL + FRAME_walk19, + gunner_frames_walk, + NULL }; void gunner_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -230,28 +279,29 @@ gunner_walk(edict_t *self) self->monsterinfo.currentmove = &gunner_move_walk; } -mframe_t gunner_frames_run[] = { +static 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} }; -mmove_t gunner_move_run = { +mmove_t gunner_move_run = +{ FRAME_run01, FRAME_run08, - gunner_frames_run, - NULL + gunner_frames_run, + NULL }; void gunner_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -266,26 +316,27 @@ gunner_run(edict_t *self) } } -mframe_t gunner_frames_runandshoot[] = { +static 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} }; -mmove_t gunner_move_runandshoot = { +mmove_t gunner_move_runandshoot = +{ FRAME_runs01, - FRAME_runs06, + FRAME_runs06, gunner_frames_runandshoot, - NULL + NULL }; void gunner_runandshoot(edict_t *self) { - if (!self) + if (!self) { return; } @@ -293,7 +344,7 @@ gunner_runandshoot(edict_t *self) self->monsterinfo.currentmove = &gunner_move_runandshoot; } -mframe_t gunner_frames_pain3[] = { +static mframe_t gunner_frames_pain3[] = { {ai_move, -3, NULL}, {ai_move, 1, NULL}, {ai_move, 1, NULL}, @@ -301,35 +352,37 @@ mframe_t gunner_frames_pain3[] = { {ai_move, 1, NULL} }; -mmove_t gunner_move_pain3 = { +mmove_t gunner_move_pain3 = +{ FRAME_pain301, - FRAME_pain305, - gunner_frames_pain3, - gunner_run + FRAME_pain305, + gunner_frames_pain3, + gunner_run }; -mframe_t gunner_frames_pain2[] = { +static 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 = { +mmove_t gunner_move_pain2 = +{ FRAME_pain201, - FRAME_pain208, - gunner_frames_pain2, - gunner_run + FRAME_pain208, + gunner_frames_pain2, + gunner_run }; -mframe_t gunner_frames_pain1[] = { +static 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}, @@ -339,26 +392,27 @@ 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} }; -mmove_t gunner_move_pain1 = { +mmove_t gunner_move_pain1 = +{ FRAME_pain101, - FRAME_pain118, - gunner_frames_pain1, - gunner_run + FRAME_pain118, + gunner_frames_pain1, + gunner_run }; void gunner_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage) { - if (!self) + if (!self) { return; } @@ -386,7 +440,7 @@ gunner_pain(edict_t *self, edict_t *other /* unused */, if (skill->value == SKILL_HARDPLUS) { - return; /* no pain anims in nightmare */ + return; /* no pain anims in nightmare */ } if (damage <= 10) @@ -406,7 +460,7 @@ gunner_pain(edict_t *self, edict_t *other /* unused */, void gunner_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -419,7 +473,7 @@ gunner_dead(edict_t *self) gi.linkentity(self); } -mframe_t gunner_frames_death[] = { +static mframe_t gunner_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -433,11 +487,12 @@ mframe_t gunner_frames_death[] = { {ai_move, 0, NULL} }; -mmove_t gunner_move_death = { +mmove_t gunner_move_death = +{ FRAME_death01, - FRAME_death11, - gunner_frames_death, - gunner_dead + FRAME_death11, + gunner_frames_death, + gunner_dead }; void @@ -447,7 +502,7 @@ gunner_die(edict_t *self, edict_t *inflictor /* unused */, { int n; - if (!self) + if (!self) { return; } @@ -459,15 +514,18 @@ gunner_die(edict_t *self, edict_t *inflictor /* unused */, for (n = 0; n < 2; n++) { - ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", + damage, GIB_ORGANIC); } - ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); + ThrowHead(self, "models/objects/gibs/head2/tris.md2", + damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } @@ -487,7 +545,7 @@ gunner_die(edict_t *self, edict_t *inflictor /* unused */, void gunner_duck_down(edict_t *self) { - if (!self) + if (!self) { return; } @@ -516,7 +574,7 @@ gunner_duck_down(edict_t *self) void gunner_duck_hold(edict_t *self) { - if (!self) + if (!self) { return; } @@ -534,7 +592,7 @@ gunner_duck_hold(edict_t *self) void gunner_duck_up(edict_t *self) { - if (!self) + if (!self) { return; } @@ -545,7 +603,7 @@ gunner_duck_up(edict_t *self) gi.linkentity(self); } -mframe_t gunner_frames_duck[] = { +static mframe_t gunner_frames_duck[] = { {ai_move, 1, gunner_duck_down}, {ai_move, 1, NULL}, {ai_move, 1, gunner_duck_hold}, @@ -556,15 +614,16 @@ mframe_t gunner_frames_duck[] = { {ai_move, -1, NULL} }; -mmove_t gunner_move_duck = { +mmove_t gunner_move_duck = +{ FRAME_duck01, FRAME_duck08, gunner_frames_duck, - gunner_run + gunner_run }; void -gunner_dodge(edict_t *self, edict_t *attacker, float eta /* unsued */) +gunner_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) { if (!self || !attacker) { @@ -588,7 +647,7 @@ gunner_dodge(edict_t *self, edict_t *attacker, float eta /* unsued */) void gunner_opengun(edict_t *self) { - if (!self) + if (!self) { return; } @@ -605,7 +664,7 @@ GunnerFire(edict_t *self) vec3_t aim; int flash_number; - if (!self) + if (!self) { return; } @@ -635,7 +694,7 @@ GunnerGrenade(edict_t *self) vec3_t aim; int flash_number; - if (!self) + if (!self) { return; } @@ -660,13 +719,15 @@ GunnerGrenade(edict_t *self) AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, start); + VectorCopy(forward, aim); + monster_fire_grenade(self, start, aim, 50, 600, flash_number); } -mframe_t gunner_frames_attack_chain[] = { +static 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}, @@ -674,14 +735,15 @@ mframe_t gunner_frames_attack_chain[] = { {ai_charge, 0, NULL} }; -mmove_t gunner_move_attack_chain = { +mmove_t gunner_move_attack_chain = +{ FRAME_attak209, - FRAME_attak215, - gunner_frames_attack_chain, - gunner_fire_chain + FRAME_attak215, + gunner_frames_attack_chain, + gunner_fire_chain }; -mframe_t gunner_frames_fire_chain[] = { +static mframe_t gunner_frames_fire_chain[] = { {ai_charge, 0, GunnerFire}, {ai_charge, 0, GunnerFire}, {ai_charge, 0, GunnerFire}, @@ -692,31 +754,33 @@ mframe_t gunner_frames_fire_chain[] = { {ai_charge, 0, GunnerFire} }; -mmove_t gunner_move_fire_chain = { +mmove_t gunner_move_fire_chain = +{ FRAME_attak216, - FRAME_attak223, - gunner_frames_fire_chain, - gunner_refire_chain + FRAME_attak223, + gunner_frames_fire_chain, + gunner_refire_chain }; -mframe_t gunner_frames_endfire_chain[] = { +static 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, NULL}, {ai_charge, 0, NULL}, - {ai_charge, 0, NULL} + {ai_charge, 0, gunner_footstep} }; -mmove_t gunner_move_endfire_chain = { +mmove_t gunner_move_endfire_chain = +{ FRAME_attak224, - FRAME_attak230, - gunner_frames_endfire_chain, - gunner_run + FRAME_attak230, + gunner_frames_endfire_chain, + gunner_run }; -mframe_t gunner_frames_attack_grenade[] = { +static mframe_t gunner_frames_attack_grenade[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -740,17 +804,18 @@ mframe_t gunner_frames_attack_grenade[] = { {ai_charge, 0, NULL} }; -mmove_t gunner_move_attack_grenade = { +mmove_t gunner_move_attack_grenade = +{ FRAME_attak101, - FRAME_attak121, - gunner_frames_attack_grenade, - gunner_run + FRAME_attak121, + gunner_frames_attack_grenade, + gunner_run }; void gunner_attack(edict_t *self) { - if (!self) + if (!self) { return; } @@ -775,7 +840,7 @@ gunner_attack(edict_t *self) void gunner_fire_chain(edict_t *self) { - if (!self) + if (!self) { return; } @@ -786,7 +851,7 @@ gunner_fire_chain(edict_t *self) void gunner_refire_chain(edict_t *self) { - if (!self) + if (!self) { return; } @@ -812,7 +877,7 @@ gunner_refire_chain(edict_t *self) void SP_monster_gunner(edict_t *self) { - if (!self) + if (!self) { return; } @@ -823,6 +888,11 @@ SP_monster_gunner(edict_t *self) return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + sound_death = gi.soundindex("gunner/death1.wav"); sound_pain = gi.soundindex("gunner/gunpain2.wav"); sound_pain2 = gi.soundindex("gunner/gunpain1.wav"); @@ -863,4 +933,3 @@ SP_monster_gunner(edict_t *self) walkmonster_start(self); } - diff --git a/src/monster/hover/hover.c b/src/monster/hover/hover.c index 0474e1b..9c1c19e 100644 --- a/src/monster/hover/hover.c +++ b/src/monster/hover/hover.c @@ -55,7 +55,7 @@ hover_search(edict_t *self) } } -mframe_t hover_frames_stand[] = { +static mframe_t hover_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -95,7 +95,7 @@ mmove_t hover_move_stand = { NULL }; -mframe_t hover_frames_stop1[] = { +static mframe_t hover_frames_stop1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -114,7 +114,7 @@ mmove_t hover_move_stop1 = { NULL }; -mframe_t hover_frames_stop2[] = { +static mframe_t hover_frames_stop2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -132,7 +132,7 @@ mmove_t hover_move_stop2 = { NULL }; -mframe_t hover_frames_takeoff[] = { +static mframe_t hover_frames_takeoff[] = { {ai_move, 0, NULL}, {ai_move, -2, NULL}, {ai_move, 5, NULL}, @@ -172,7 +172,7 @@ mmove_t hover_move_takeoff = { NULL }; -mframe_t hover_frames_pain3[] = { +static mframe_t hover_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -191,7 +191,7 @@ mmove_t hover_move_pain3 = { hover_run }; -mframe_t hover_frames_pain2[] = { +static mframe_t hover_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -213,7 +213,7 @@ mmove_t hover_move_pain2 = { hover_run }; -mframe_t hover_frames_pain1[] = { +static mframe_t hover_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 2, NULL}, @@ -251,7 +251,7 @@ mmove_t hover_move_pain1 = { hover_run }; -mframe_t hover_frames_land[] = { +static mframe_t hover_frames_land[] = { {ai_move, 0, NULL} }; @@ -262,7 +262,7 @@ mmove_t hover_move_land = { NULL }; -mframe_t hover_frames_forward[] = { +static mframe_t hover_frames_forward[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -307,7 +307,7 @@ mmove_t hover_move_forward = { NULL }; -mframe_t hover_frames_walk[] = { +static mframe_t hover_frames_walk[] = { {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, @@ -352,7 +352,7 @@ mmove_t hover_move_walk = { NULL }; -mframe_t hover_frames_run[] = { +static mframe_t hover_frames_run[] = { {ai_run, 10, NULL}, {ai_run, 10, NULL}, {ai_run, 10, NULL}, @@ -397,7 +397,7 @@ mmove_t hover_move_run = { NULL }; -mframe_t hover_frames_death1[] = { +static mframe_t hover_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -418,7 +418,7 @@ mmove_t hover_move_death1 = { hover_dead }; -mframe_t hover_frames_backward[] = { +static mframe_t hover_frames_backward[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -452,7 +452,7 @@ mmove_t hover_move_backward = { NULL }; -mframe_t hover_frames_start_attack[] = { +static mframe_t hover_frames_start_attack[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL}, {ai_charge, 1, NULL} @@ -465,7 +465,7 @@ mmove_t hover_move_start_attack = { hover_attack }; -mframe_t hover_frames_attack1[] = { +static mframe_t hover_frames_attack1[] = { {ai_charge, -10, hover_fire_blaster}, {ai_charge, -10, hover_fire_blaster}, {ai_charge, 0, hover_reattack}, @@ -478,7 +478,7 @@ mmove_t hover_move_attack1 = { NULL }; -mframe_t hover_frames_end_attack[] = { +static mframe_t hover_frames_end_attack[] = { {ai_charge, 1, NULL}, {ai_charge, 1, NULL} }; diff --git a/src/monster/infantry/infantry.c b/src/monster/infantry/infantry.c index 7148210..72187ec 100644 --- a/src/monster/infantry/infantry.c +++ b/src/monster/infantry/infantry.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * Infantry. * @@ -23,7 +42,34 @@ static int sound_sight; static int sound_search; static int sound_idle; -mframe_t infantry_frames_stand[] = { +static int sound_step; +static int sound_step2; + +void +infantry_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + // Lazy loading for savegame compatibility. + if (sound_step == 0 || sound_step2 == 0) + { + sound_step = gi.soundindex("infantry/step1.wav"); + sound_step2 = gi.soundindex("infantry/step2.wav"); + } + + if (randk() % 2 == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + + +static mframe_t infantry_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -48,9 +94,10 @@ mframe_t infantry_frames_stand[] = { {ai_stand, 0, NULL} }; -mmove_t infantry_move_stand = { +mmove_t infantry_move_stand = +{ FRAME_stand50, - FRAME_stand71, + FRAME_stand71, infantry_frames_stand, NULL }; @@ -58,7 +105,7 @@ mmove_t infantry_move_stand = { void infantry_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -66,13 +113,13 @@ infantry_stand(edict_t *self) self->monsterinfo.currentmove = &infantry_move_stand; } -mframe_t infantry_frames_fidget[] = { +static mframe_t infantry_frames_fidget[] = { {ai_stand, 1, NULL}, {ai_stand, 0, NULL}, {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}, @@ -114,21 +161,22 @@ 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} }; -mmove_t infantry_move_fidget = { +mmove_t infantry_move_fidget = +{ FRAME_stand01, - FRAME_stand49, - infantry_frames_fidget, - infantry_stand + FRAME_stand49, + infantry_frames_fidget, + infantry_stand }; void infantry_fidget(edict_t *self) { - if (!self) + if (!self) { return; } @@ -137,14 +185,14 @@ infantry_fidget(edict_t *self) gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } -mframe_t infantry_frames_walk[] = { - {ai_walk, 5, NULL}, +static mframe_t infantry_frames_walk[] = { + {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}, @@ -152,17 +200,18 @@ mframe_t infantry_frames_walk[] = { {ai_walk, 5, NULL} }; -mmove_t infantry_move_walk = { +mmove_t infantry_move_walk = +{ FRAME_walk03, - FRAME_walk14, - infantry_frames_walk, + FRAME_walk14, + infantry_frames_walk, NULL }; void infantry_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -170,21 +219,22 @@ infantry_walk(edict_t *self) self->monsterinfo.currentmove = &infantry_move_walk; } -mframe_t infantry_frames_run[] = { +static 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} }; -mmove_t infantry_move_run = { +mmove_t infantry_move_run = +{ FRAME_run01, - FRAME_run08, - infantry_frames_run, + FRAME_run08, + infantry_frames_run, NULL }; @@ -206,44 +256,46 @@ infantry_run(edict_t *self) } } -mframe_t infantry_frames_pain1[] = { +static mframe_t infantry_frames_pain1[] = { {ai_move, -3, NULL}, {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 = { +mmove_t infantry_move_pain1 = +{ FRAME_pain101, FRAME_pain110, infantry_frames_pain1, infantry_run }; -mframe_t infantry_frames_pain2[] = { +static mframe_t infantry_frames_pain2[] = { {ai_move, -3, NULL}, {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 = { +mmove_t infantry_move_pain2 = +{ FRAME_pain201, - FRAME_pain210, - infantry_frames_pain2, - infantry_run + FRAME_pain210, + infantry_frames_pain2, + infantry_run }; void @@ -252,7 +304,7 @@ infantry_pain(edict_t *self, edict_t *other /* unused */, { int n; - if (!self) + if (!self) { return; } @@ -311,7 +363,7 @@ InfantryMachineGun(edict_t *self) vec3_t vec; int flash_number; - if (!self) + if (!self) { return; } @@ -337,7 +389,8 @@ InfantryMachineGun(edict_t *self) } else { - flash_number = MZ2_INFANTRY_MACHINEGUN_2 + (self->s.frame - FRAME_death211); + flash_number = MZ2_INFANTRY_MACHINEGUN_2 + + (self->s.frame - FRAME_death211); AngleVectors(self->s.angles, forward, right, NULL); G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], @@ -354,7 +407,7 @@ InfantryMachineGun(edict_t *self) void infantry_sight(edict_t *self, edict_t *other /* unused */) { - if (!self) + if (!self) { return; } @@ -365,7 +418,7 @@ infantry_sight(edict_t *self, edict_t *other /* unused */) void infantry_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -379,16 +432,16 @@ infantry_dead(edict_t *self) M_FlyCheck(self); } -mframe_t infantry_frames_death1[] = { +static mframe_t infantry_frames_death1[] = { {ai_move, -4, NULL}, {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}, @@ -402,22 +455,23 @@ mframe_t infantry_frames_death1[] = { {ai_move, -3, NULL} }; -mmove_t infantry_move_death1 = { +mmove_t infantry_move_death1 = +{ FRAME_death101, - FRAME_death120, - infantry_frames_death1, - infantry_dead + FRAME_death120, + infantry_frames_death1, + infantry_dead }; /* Off with his head */ -mframe_t infantry_frames_death2[] = { +static mframe_t infantry_frames_death2[] = { {ai_move, 0, NULL}, {ai_move, 1, NULL}, {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}, @@ -438,14 +492,15 @@ mframe_t infantry_frames_death2[] = { {ai_move, 0, NULL} }; -mmove_t infantry_move_death2 = { +mmove_t infantry_move_death2 = +{ FRAME_death201, - FRAME_death225, + FRAME_death225, infantry_frames_death2, infantry_dead }; -mframe_t infantry_frames_death3[] = { +static mframe_t infantry_frames_death3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -457,7 +512,8 @@ mframe_t infantry_frames_death3[] = { {ai_move, 0, NULL} }; -mmove_t infantry_move_death3 = { +mmove_t infantry_move_death3 = +{ FRAME_death301, FRAME_death309, infantry_frames_death3, @@ -471,7 +527,7 @@ infantry_die(edict_t *self, edict_t *inflictor /* unused */, { int n; - if (!self) + if (!self) { return; } @@ -483,15 +539,18 @@ infantry_die(edict_t *self, edict_t *inflictor /* unused */, for (n = 0; n < 2; n++) { - ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", + damage, GIB_ORGANIC); } - ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); + ThrowHead(self, "models/objects/gibs/head2/tris.md2", + damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } @@ -528,7 +587,7 @@ infantry_die(edict_t *self, edict_t *inflictor /* unused */, void infantry_duck_down(edict_t *self) { - if (!self) + if (!self) { return; } @@ -548,7 +607,7 @@ infantry_duck_down(edict_t *self) void infantry_duck_hold(edict_t *self) { - if (!self) + if (!self) { return; } @@ -566,7 +625,7 @@ infantry_duck_hold(edict_t *self) void infantry_duck_up(edict_t *self) { - if (!self) + if (!self) { return; } @@ -577,19 +636,20 @@ infantry_duck_up(edict_t *self) gi.linkentity(self); } -mframe_t infantry_frames_duck[] = { +static mframe_t infantry_frames_duck[] = { {ai_move, -2, infantry_duck_down}, {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 = { +mmove_t infantry_move_duck = +{ FRAME_duck01, - FRAME_duck05, - infantry_frames_duck, - infantry_run + FRAME_duck05, + infantry_frames_duck, + infantry_run }; void @@ -619,7 +679,7 @@ infantry_set_firetime(edict_t *self) { int n; - if (!self) + if (!self) { return; } @@ -642,7 +702,7 @@ infantry_cock_gun(edict_t *self) void infantry_fire(edict_t *self) { - if (!self) + if (!self) { return; } @@ -659,7 +719,7 @@ infantry_fire(edict_t *self) } } -mframe_t infantry_frames_attack1[] = { +static mframe_t infantry_frames_attack1[] = { {ai_charge, 10, infantry_set_firetime}, {ai_charge, 6, NULL}, {ai_charge, 0, infantry_fire}, @@ -677,17 +737,18 @@ mframe_t infantry_frames_attack1[] = { {ai_charge, -1, NULL} }; -mmove_t infantry_move_attack1 = { +mmove_t infantry_move_attack1 = +{ FRAME_attak101, FRAME_attak115, - infantry_frames_attack1, + infantry_frames_attack1, infantry_run }; void infantry_swing(edict_t *self) { - if (!self) + if (!self) { return; } @@ -700,7 +761,7 @@ infantry_smack(edict_t *self) { vec3_t aim; - if (!self) + if (!self) { return; } @@ -713,28 +774,29 @@ infantry_smack(edict_t *self) } } -mframe_t infantry_frames_attack2[] = { +static 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}, {ai_charge, 3, NULL}, }; -mmove_t infantry_move_attack2 = { +mmove_t infantry_move_attack2 = +{ FRAME_attak201, FRAME_attak208, - infantry_frames_attack2, - infantry_run + infantry_frames_attack2, + infantry_run }; void infantry_attack(edict_t *self) { - if (!self) + if (!self) { return; } @@ -755,7 +817,7 @@ infantry_attack(edict_t *self) void SP_monster_infantry(edict_t *self) { - if (!self) + if (!self) { return; } @@ -766,6 +828,11 @@ SP_monster_infantry(edict_t *self) return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + sound_pain1 = gi.soundindex("infantry/infpain1.wav"); sound_pain2 = gi.soundindex("infantry/infpain2.wav"); sound_die1 = gi.soundindex("infantry/infdeth1.wav"); @@ -809,4 +876,3 @@ SP_monster_infantry(edict_t *self) walkmonster_start(self); } - diff --git a/src/monster/insane/insane.c b/src/monster/insane/insane.c index e4549ff..bd72f95 100644 --- a/src/monster/insane/insane.c +++ b/src/monster/insane/insane.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * The insane earth soldiers. * @@ -15,6 +34,11 @@ 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; + void insane_stand(edict_t *self); void insane_dead(edict_t *self); void insane_cross(edict_t *self); @@ -24,10 +48,47 @@ void insane_checkdown(edict_t *self); void insane_checkup(edict_t *self); void insane_onground(edict_t *self); +void +insane_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + // Lazy loading for savegame compatibility. + if (sound_step == 0 || sound_step2 == 0 || sound_step3 == 0 || sound_step4 == 0) + { + 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"); + } + + int i; + i = randk() % 4; + + 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) { - if (!self) + if (!self) { return; } @@ -38,7 +99,7 @@ insane_fist(edict_t *self) void insane_shake(edict_t *self) { - if (!self) + if (!self) { return; } @@ -49,7 +110,7 @@ insane_shake(edict_t *self) void insane_moan(edict_t *self) { - if (!self) + if (!self) { return; } @@ -80,7 +141,7 @@ insane_scream(edict_t *self) gi.sound(self, CHAN_VOICE, sound_scream[rand() % 8], 1, ATTN_IDLE, 0); } -mframe_t insane_frames_stand_normal[] = { +static mframe_t insane_frames_stand_normal[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -89,14 +150,15 @@ mframe_t insane_frames_stand_normal[] = { {ai_stand, 0, insane_checkdown} }; -mmove_t insane_move_stand_normal = { +mmove_t insane_move_stand_normal = +{ FRAME_stand60, - FRAME_stand65, + FRAME_stand65, insane_frames_stand_normal, insane_stand }; -mframe_t insane_frames_stand_insane[] = { +static mframe_t insane_frames_stand_insane[] = { {ai_stand, 0, insane_shake}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -129,14 +191,15 @@ mframe_t insane_frames_stand_insane[] = { {ai_stand, 0, insane_checkdown} }; -mmove_t insane_move_stand_insane = { +mmove_t insane_move_stand_insane = +{ FRAME_stand65, FRAME_stand94, - insane_frames_stand_insane, + insane_frames_stand_insane, insane_stand }; -mframe_t insane_frames_uptodown[] = { +static mframe_t insane_frames_uptodown[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -182,14 +245,15 @@ mframe_t insane_frames_uptodown[] = { {ai_move, 0, NULL} }; -mmove_t insane_move_uptodown = { +mmove_t insane_move_uptodown = +{ FRAME_stand1, FRAME_stand40, insane_frames_uptodown, insane_onground }; -mframe_t insane_frames_downtoup[] = { +static mframe_t insane_frames_downtoup[] = { {ai_move, -0.7, NULL}, /* 41 */ {ai_move, -1.2, NULL}, /* 42 */ {ai_move, -1.5, NULL}, /* 43 */ @@ -208,17 +272,18 @@ mframe_t insane_frames_downtoup[] = { {ai_move, -0.3, NULL}, /* 56 */ {ai_move, 0, NULL}, /* 57 */ {ai_move, 0, NULL}, /* 58 */ - {ai_move, 0, NULL} /* 59 */ + {ai_move, 0, NULL} /* 59 */ }; -mmove_t insane_move_downtoup = { +mmove_t insane_move_downtoup = +{ FRAME_stand41, - FRAME_stand59, - insane_frames_downtoup, - insane_stand + FRAME_stand59, + insane_frames_downtoup, + insane_stand }; -mframe_t insane_frames_jumpdown[] = { +static mframe_t insane_frames_jumpdown[] = { {ai_move, 0.2, NULL}, {ai_move, 11.5, NULL}, {ai_move, 5.1, NULL}, @@ -226,14 +291,15 @@ mframe_t insane_frames_jumpdown[] = { {ai_move, 0, NULL} }; -mmove_t insane_move_jumpdown = { +mmove_t insane_move_jumpdown = +{ FRAME_stand96, - FRAME_stand100, + FRAME_stand100, insane_frames_jumpdown, insane_onground }; -mframe_t insane_frames_down[] = { +static mframe_t insane_frames_down[] = { {ai_move, 0, NULL}, /* 100 */ {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -297,92 +363,97 @@ mframe_t insane_frames_down[] = { {ai_move, 0, insane_checkup} /* 160 */ }; -mmove_t insane_move_down = { +mmove_t insane_move_down = +{ FRAME_stand100, - FRAME_stand160, + FRAME_stand160, insane_frames_down, insane_onground }; -mframe_t insane_frames_walk_normal[] = { +static mframe_t insane_frames_walk_normal[] = { {ai_walk, 0, insane_scream}, {ai_walk, 2.5, NULL}, {ai_walk, 3.5, NULL}, {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 = { +mmove_t insane_move_walk_normal = +{ + FRAME_walk27, + FRAME_walk39, + insane_frames_walk_normal, + insane_walk +}; + +mmove_t insane_move_run_normal = +{ FRAME_walk27, FRAME_walk39, insane_frames_walk_normal, - insane_walk + insane_run }; -mmove_t insane_move_run_normal = { - FRAME_walk27, - FRAME_walk39, - insane_frames_walk_normal, - insane_run -}; - -mframe_t insane_frames_walk_insane[] = { +static mframe_t insane_frames_walk_insane[] = { {ai_walk, 0, insane_scream}, /* walk 1 */ {ai_walk, 3.4, NULL}, /* walk 2 */ {ai_walk, 3.6, NULL}, /* 3 */ {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 */ }; -mmove_t insane_move_walk_insane = { +mmove_t insane_move_walk_insane = +{ FRAME_walk1, - FRAME_walk26, + FRAME_walk26, insane_frames_walk_insane, insane_walk }; -mmove_t insane_move_run_insane = { +mmove_t insane_move_run_insane = +{ FRAME_walk1, - FRAME_walk26, + FRAME_walk26, insane_frames_walk_insane, insane_run }; -mframe_t insane_frames_stand_pain[] = { - {ai_move, 0, NULL}, +static 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}, @@ -391,14 +462,15 @@ mframe_t insane_frames_stand_pain[] = { {ai_move, 0, NULL} }; -mmove_t insane_move_stand_pain = { +mmove_t insane_move_stand_pain = +{ FRAME_st_pain2, FRAME_st_pain12, insane_frames_stand_pain, insane_run }; -mframe_t insane_frames_stand_death[] = { +static mframe_t insane_frames_stand_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -418,14 +490,15 @@ mframe_t insane_frames_stand_death[] = { {ai_move, 0, NULL} }; -mmove_t insane_move_stand_death = { +mmove_t insane_move_stand_death = +{ FRAME_st_death2, FRAME_st_death18, insane_frames_stand_death, - insane_dead + insane_dead }; -mframe_t insane_frames_crawl[] = { +static mframe_t insane_frames_crawl[] = { {ai_walk, 0, insane_scream}, {ai_walk, 1.5, NULL}, {ai_walk, 2.1, NULL}, @@ -437,21 +510,23 @@ mframe_t insane_frames_crawl[] = { {ai_walk, 2.4, NULL} }; -mmove_t insane_move_crawl = { +mmove_t insane_move_crawl = +{ FRAME_crawl1, FRAME_crawl9, insane_frames_crawl, NULL }; -mmove_t insane_move_runcrawl = { +mmove_t insane_move_runcrawl = +{ FRAME_crawl1, FRAME_crawl9, - insane_frames_crawl, + insane_frames_crawl, NULL }; -mframe_t insane_frames_crawl_pain[] = { +static mframe_t insane_frames_crawl_pain[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -463,14 +538,15 @@ mframe_t insane_frames_crawl_pain[] = { {ai_move, 0, NULL} }; -mmove_t insane_move_crawl_pain = { +mmove_t insane_move_crawl_pain = +{ FRAME_cr_pain2, FRAME_cr_pain10, insane_frames_crawl_pain, insane_run }; -mframe_t insane_frames_crawl_death[] = { +static mframe_t insane_frames_crawl_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -480,14 +556,15 @@ mframe_t insane_frames_crawl_death[] = { {ai_move, 0, NULL} }; -mmove_t insane_move_crawl_death = { +mmove_t insane_move_crawl_death = +{ FRAME_cr_death10, - FRAME_cr_death16, + FRAME_cr_death16, insane_frames_crawl_death, insane_dead }; -mframe_t insane_frames_cross[] = { +static mframe_t insane_frames_cross[] = { {ai_move, 0, insane_moan}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -505,14 +582,15 @@ mframe_t insane_frames_cross[] = { {ai_move, 0, NULL} }; -mmove_t insane_move_cross = { +mmove_t insane_move_cross = +{ FRAME_cross1, - FRAME_cross15, + FRAME_cross15, insane_frames_cross, insane_cross }; -mframe_t insane_frames_struggle_cross[] = { +static mframe_t insane_frames_struggle_cross[] = { {ai_move, 0, insane_scream}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -530,17 +608,18 @@ mframe_t insane_frames_struggle_cross[] = { {ai_move, 0, NULL} }; -mmove_t insane_move_struggle_cross = { +mmove_t insane_move_struggle_cross = +{ FRAME_cross16, FRAME_cross30, - insane_frames_struggle_cross, - insane_cross + insane_frames_struggle_cross, + insane_cross }; void insane_cross(edict_t *self) { - if (!self) + if (!self) { return; } @@ -558,7 +637,7 @@ insane_cross(edict_t *self) void insane_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -590,7 +669,7 @@ insane_walk(edict_t *self) void insane_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -625,7 +704,7 @@ insane_pain(edict_t *self, edict_t *other /* unused */, { int l, r; - if (!self) + if (!self) { return; } @@ -676,7 +755,8 @@ insane_pain(edict_t *self, edict_t *other /* unused */, if (((self->s.frame >= FRAME_crawl1) && (self->s.frame <= FRAME_crawl9)) || - ((self->s.frame >= FRAME_stand99) && (self->s.frame <= FRAME_stand160))) + ((self->s.frame >= FRAME_stand99) && + (self->s.frame <= FRAME_stand160))) { self->monsterinfo.currentmove = &insane_move_crawl_pain; } @@ -689,7 +769,7 @@ insane_pain(edict_t *self, edict_t *other /* unused */, void insane_onground(edict_t *self) { - if (!self) + if (!self) { return; } @@ -700,7 +780,7 @@ insane_onground(edict_t *self) void insane_checkdown(edict_t *self) { - if (!self) + if (!self) { return; } @@ -726,11 +806,12 @@ insane_checkdown(edict_t *self) void insane_checkup(edict_t *self) { - if (!self) + if (!self) { return; } + /* If Hold_Ground and Crawl are set */ if ((self->spawnflags & 4) && (self->spawnflags & 16)) { return; @@ -745,7 +826,7 @@ insane_checkup(edict_t *self) void insane_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -755,6 +836,7 @@ insane_stand(edict_t *self) self->monsterinfo.currentmove = &insane_move_cross; self->monsterinfo.aiflags |= AI_STAND_GROUND; } + /* If Hold_Ground and Crawl are set */ else if ((self->spawnflags & 4) && (self->spawnflags & 16)) { self->monsterinfo.currentmove = &insane_move_down; @@ -773,7 +855,7 @@ insane_stand(edict_t *self) void insane_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -801,7 +883,7 @@ insane_die(edict_t *self, edict_t *inflictor /* unused */, { int n; - if (!self) + if (!self) { return; } @@ -812,15 +894,18 @@ insane_die(edict_t *self, edict_t *inflictor /* unused */, for (n = 0; n < 2; n++) { - ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", + damage, GIB_ORGANIC); } - ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); + ThrowHead(self, "models/objects/gibs/head2/tris.md2", + damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } @@ -862,7 +947,7 @@ insane_die(edict_t *self, edict_t *inflictor /* unused */, void SP_misc_insane(edict_t *self) { - if (!self) + if (!self) { return; } @@ -873,6 +958,13 @@ SP_misc_insane(edict_t *self) return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + sound_step3 = 0; + sound_step4 = 0; + sound_fist = gi.soundindex("insane/insane11.wav"); sound_shake = gi.soundindex("insane/insane5.wav"); sound_moan = gi.soundindex("insane/insane7.wav"); diff --git a/src/monster/medic/medic.c b/src/monster/medic/medic.c index b578ed0..1817b1d 100644 --- a/src/monster/medic/medic.c +++ b/src/monster/medic/medic.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * Medic. * @@ -9,6 +28,7 @@ #include "medic.h" qboolean visible(edict_t *self, edict_t *other); + static int sound_idle1; static int sound_pain1; static int sound_pain2; @@ -20,15 +40,41 @@ static int sound_hook_hit; static int sound_hook_heal; static int sound_hook_retract; +static int sound_step; +static int sound_step2; + void ED_CallSpawn(edict_t *ent); +void +medic_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + // Lazy loading for savegame compatibility. + if (sound_step == 0 || sound_step2 == 0) + { + sound_step = gi.soundindex("medic/step1.wav"); + sound_step2 = gi.soundindex("medic/step2.wav"); + } + + if (randk() % 2 == 0) + { + gi.sound(self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0); + } + else + { + gi.sound(self, CHAN_BODY, sound_step2, 1, ATTN_NORM, 0); + } +} + edict_t * medic_FindDeadMonster(edict_t *self) { edict_t *ent = NULL; edict_t *best = NULL; - if (!self) + if (!self) { return NULL; } @@ -92,7 +138,7 @@ medic_idle(edict_t *self) { edict_t *ent; - if (!self) + if (!self) { return; } @@ -115,7 +161,7 @@ medic_search(edict_t *self) { edict_t *ent; - if (!self) + if (!self) { return; } @@ -140,7 +186,7 @@ medic_search(edict_t *self) void medic_sight(edict_t *self, edict_t *other /* unused */) { - if (!self) + if (!self) { return; } @@ -148,7 +194,7 @@ medic_sight(edict_t *self, edict_t *other /* unused */) gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); } -mframe_t medic_frames_stand[] = { +static mframe_t medic_frames_stand[] = { {ai_stand, 0, medic_idle}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -241,7 +287,8 @@ mframe_t medic_frames_stand[] = { {ai_stand, 0, NULL}, }; -mmove_t medic_move_stand = { +mmove_t medic_move_stand = +{ FRAME_wait1, FRAME_wait90, medic_frames_stand, @@ -251,7 +298,7 @@ mmove_t medic_move_stand = { void medic_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -259,22 +306,23 @@ medic_stand(edict_t *self) self->monsterinfo.currentmove = &medic_move_stand; } -mframe_t medic_frames_walk[] = { +static 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}, {ai_walk, 9.3, NULL} }; -mmove_t medic_move_walk = { +mmove_t medic_move_walk = +{ FRAME_walk1, FRAME_walk12, medic_frames_walk, @@ -284,7 +332,7 @@ mmove_t medic_move_walk = { void medic_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -292,26 +340,27 @@ medic_walk(edict_t *self) self->monsterinfo.currentmove = &medic_move_walk; } -mframe_t medic_frames_run[] = { - {ai_run, 18, NULL}, +static mframe_t medic_frames_run[] = { + {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} }; -mmove_t medic_move_run = { +mmove_t medic_move_run = +{ FRAME_run1, - FRAME_run6, - medic_frames_run, + FRAME_run6, + medic_frames_run, NULL }; void medic_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -343,7 +392,7 @@ medic_run(edict_t *self) } } -mframe_t medic_frames_pain1[] = { +static mframe_t medic_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -354,14 +403,19 @@ mframe_t medic_frames_pain1[] = { {ai_move, 0, NULL} }; -mmove_t medic_move_pain1 = { +mmove_t medic_move_pain1 = +{ FRAME_paina1, - FRAME_paina8, + FRAME_paina8, medic_frames_pain1, medic_run }; -mframe_t medic_frames_pain2[] = { +static 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}, @@ -372,14 +426,11 @@ 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, NULL}, - {ai_move, 0, NULL}, - {ai_move, 0, NULL} + {ai_move, 0, medic_footstep} }; -mmove_t medic_move_pain2 = { +mmove_t medic_move_pain2 = +{ FRAME_painb1, FRAME_painb15, medic_frames_pain2, @@ -390,7 +441,7 @@ void medic_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage /* unused */) { - if (!self) + if (!self) { return; } @@ -433,7 +484,7 @@ medic_fire_blaster(edict_t *self) vec3_t dir; int effect; - if (!self) + if (!self) { return; } @@ -468,7 +519,7 @@ medic_fire_blaster(edict_t *self) void medic_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -481,7 +532,7 @@ medic_dead(edict_t *self) gi.linkentity(self); } -mframe_t medic_frames_death[] = { +static mframe_t medic_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -514,7 +565,8 @@ mframe_t medic_frames_death[] = { {ai_move, 0, NULL} }; -mmove_t medic_move_death = { +mmove_t medic_move_death = +{ FRAME_death1, FRAME_death30, medic_frames_death, @@ -528,7 +580,7 @@ medic_die(edict_t *self, edict_t *inflictor /* unused */, { int n; - if (!self) + if (!self) { return; } @@ -546,15 +598,18 @@ medic_die(edict_t *self, edict_t *inflictor /* unused */, for (n = 0; n < 2; n++) { - ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", + damage, GIB_ORGANIC); } - ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); + ThrowHead(self, "models/objects/gibs/head2/tris.md2", + damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } @@ -575,7 +630,7 @@ medic_die(edict_t *self, edict_t *inflictor /* unused */, void medic_duck_down(edict_t *self) { - if (!self) + if (!self) { return; } @@ -595,7 +650,7 @@ medic_duck_down(edict_t *self) void medic_duck_hold(edict_t *self) { - if (!self) + if (!self) { return; } @@ -613,7 +668,7 @@ medic_duck_hold(edict_t *self) void medic_duck_up(edict_t *self) { - if (!self) + if (!self) { return; } @@ -624,7 +679,7 @@ medic_duck_up(edict_t *self) gi.linkentity(self); } -mframe_t medic_frames_duck[] = { +static mframe_t medic_frames_duck[] = { {ai_move, -1, NULL}, {ai_move, -1, NULL}, {ai_move, -1, medic_duck_down}, @@ -643,7 +698,8 @@ mframe_t medic_frames_duck[] = { {ai_move, -1, NULL} }; -mmove_t medic_move_duck = { +mmove_t medic_move_duck = +{ FRAME_duck1, FRAME_duck16, medic_frames_duck, @@ -653,7 +709,7 @@ mmove_t medic_move_duck = { void medic_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) { - if (!self || !attacker) + if (!self || !attacker) { return; } @@ -672,7 +728,7 @@ medic_dodge(edict_t *self, edict_t *attacker, float eta /* unused */) self->monsterinfo.currentmove = &medic_move_duck; } -mframe_t medic_frames_attackHyperBlaster[] = { +static mframe_t medic_frames_attackHyperBlaster[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -691,7 +747,8 @@ mframe_t medic_frames_attackHyperBlaster[] = { {ai_charge, 0, medic_fire_blaster} }; -mmove_t medic_move_attackHyperBlaster = { +mmove_t medic_move_attackHyperBlaster = +{ FRAME_attack15, FRAME_attack30, medic_frames_attackHyperBlaster, @@ -701,7 +758,7 @@ mmove_t medic_move_attackHyperBlaster = { void medic_continue(edict_t *self) { - if (!self) + if (!self) { return; } @@ -715,7 +772,7 @@ medic_continue(edict_t *self) } } -mframe_t medic_frames_attackBlaster[] = { +static mframe_t medic_frames_attackBlaster[] = { {ai_charge, 0, NULL}, {ai_charge, 5, NULL}, {ai_charge, 5, NULL}, @@ -742,7 +799,7 @@ mmove_t medic_move_attackBlaster = { void medic_hook_launch(edict_t *self) { - if (!self) + if (!self) { return; } @@ -771,7 +828,7 @@ medic_cable_attack(edict_t *self) vec3_t dir, angles; float distance; - if (!self) + if (!self) { return; } @@ -871,7 +928,7 @@ medic_cable_attack(edict_t *self) void medic_hook_retract(edict_t *self) { - if (!self) + if (!self) { return; } @@ -880,7 +937,7 @@ medic_hook_retract(edict_t *self) self->enemy->monsterinfo.aiflags &= ~AI_RESURRECTING; } -mframe_t medic_frames_attackCable[] = { +static mframe_t medic_frames_attackCable[] = { {ai_move, 2, NULL}, {ai_move, 3, NULL}, {ai_move, 5, NULL}, @@ -888,7 +945,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}, @@ -902,7 +959,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}, @@ -911,7 +968,8 @@ mframe_t medic_frames_attackCable[] = { {ai_move, 1.3, NULL} }; -mmove_t medic_move_attackCable = { +mmove_t medic_move_attackCable = +{ FRAME_attack33, FRAME_attack60, medic_frames_attackCable, @@ -921,7 +979,7 @@ mmove_t medic_move_attackCable = { void medic_attack(edict_t *self) { - if (!self) + if (!self) { return; } @@ -939,7 +997,7 @@ medic_attack(edict_t *self) qboolean medic_checkattack(edict_t *self) { - if (!self) + if (!self) { return false; } @@ -959,7 +1017,7 @@ medic_checkattack(edict_t *self) void SP_monster_medic(edict_t *self) { - if (!self) + if (!self) { return; } @@ -970,6 +1028,11 @@ SP_monster_medic(edict_t *self) return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + sound_idle1 = gi.soundindex("medic/idle.wav"); sound_pain1 = gi.soundindex("medic/medpain1.wav"); sound_pain2 = gi.soundindex("medic/medpain2.wav"); diff --git a/src/monster/mutant/mutant.c b/src/monster/mutant/mutant.c index b3121bd..bfed3d7 100644 --- a/src/monster/mutant/mutant.c +++ b/src/monster/mutant/mutant.c @@ -83,7 +83,7 @@ mutant_swing(edict_t *self) gi.sound(self, CHAN_VOICE, sound_swing, 1, ATTN_NORM, 0); } -mframe_t mutant_frames_stand[] = { +static mframe_t mutant_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -174,7 +174,7 @@ mutant_idle_loop(edict_t *self) } } -mframe_t mutant_frames_idle[] = { +static mframe_t mutant_frames_idle[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -209,7 +209,7 @@ mutant_idle(edict_t *self) gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } -mframe_t mutant_frames_walk[] = { +static mframe_t mutant_frames_walk[] = { {ai_walk, 3, NULL}, {ai_walk, 1, NULL}, {ai_walk, 5, NULL}, @@ -242,7 +242,7 @@ mutant_walk_loop(edict_t *self) self->monsterinfo.currentmove = &mutant_move_walk; } -mframe_t mutant_frames_start_walk[] = { +static mframe_t mutant_frames_start_walk[] = { {ai_walk, 5, NULL}, {ai_walk, 5, NULL}, {ai_walk, -2, NULL}, @@ -267,7 +267,7 @@ mutant_walk(edict_t *self) self->monsterinfo.currentmove = &mutant_move_start_walk; } -mframe_t mutant_frames_run[] = { +static mframe_t mutant_frames_run[] = { {ai_run, 40, NULL}, {ai_run, 40, mutant_step}, {ai_run, 24, NULL}, @@ -364,7 +364,7 @@ mutant_check_refire(edict_t *self) } } -mframe_t mutant_frames_attack[] = { +static mframe_t mutant_frames_attack[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, mutant_hit_left}, @@ -484,7 +484,7 @@ mutant_check_landing(edict_t *self) } } -mframe_t mutant_frames_jump[] = { +static mframe_t mutant_frames_jump[] = { {ai_charge, 0, NULL}, {ai_charge, 17, NULL}, {ai_charge, 15, mutant_jump_takeoff}, @@ -599,7 +599,7 @@ mutant_checkattack(edict_t *self) return false; } -mframe_t mutant_frames_pain1[] = { +static mframe_t mutant_frames_pain1[] = { {ai_move, 4, NULL}, {ai_move, -3, NULL}, {ai_move, -8, NULL}, @@ -614,7 +614,7 @@ mmove_t mutant_move_pain1 = { mutant_run }; -mframe_t mutant_frames_pain2[] = { +static mframe_t mutant_frames_pain2[] = { {ai_move, -24, NULL}, {ai_move, 11, NULL}, {ai_move, 5, NULL}, @@ -630,7 +630,7 @@ mmove_t mutant_move_pain2 = { mutant_run }; -mframe_t mutant_frames_pain3[] = { +static mframe_t mutant_frames_pain3[] = { {ai_move, -22, NULL}, {ai_move, 3, NULL}, {ai_move, 3, NULL}, @@ -715,7 +715,7 @@ mutant_dead(edict_t *self) M_FlyCheck(self); } -mframe_t mutant_frames_death1[] = { +static mframe_t mutant_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -734,7 +734,7 @@ mmove_t mutant_move_death1 = { mutant_dead }; -mframe_t mutant_frames_death2[] = { +static mframe_t mutant_frames_death2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, diff --git a/src/monster/parasite/parasite.c b/src/monster/parasite/parasite.c index 7e22a2f..d807954 100644 --- a/src/monster/parasite/parasite.c +++ b/src/monster/parasite/parasite.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * Parasite. * @@ -32,7 +51,7 @@ void parasite_refidget(edict_t *self); void parasite_launch(edict_t *self) { - if (!self) + if (!self) { return; } @@ -43,7 +62,7 @@ parasite_launch(edict_t *self) void parasite_reel_in(edict_t *self) { - if (!self) + if (!self) { return; } @@ -54,7 +73,7 @@ parasite_reel_in(edict_t *self) void parasite_sight(edict_t *self, edict_t *other /* unused */) { - if (!self) + if (!self) { return; } @@ -65,7 +84,7 @@ parasite_sight(edict_t *self, edict_t *other /* unused */) void parasite_tap(edict_t *self) { - if (!self) + if (!self) { return; } @@ -73,10 +92,19 @@ parasite_tap(edict_t *self) gi.sound(self, CHAN_WEAPON, sound_tap, 1, ATTN_IDLE, 0); } +void +parasite_footstep(edict_t *self) +{ + if (g_monsterfootsteps->value) + { + parasite_tap(self); + } +} + void parasite_scratch(edict_t *self) { - if (!self) + if (!self) { return; } @@ -87,7 +115,7 @@ parasite_scratch(edict_t *self) void parasite_search(edict_t *self) { - if (!self) + if (!self) { return; } @@ -95,21 +123,22 @@ parasite_search(edict_t *self) gi.sound(self, CHAN_WEAPON, sound_search, 1, ATTN_IDLE, 0); } -mframe_t parasite_frames_start_fidget[] = { +static mframe_t parasite_frames_start_fidget[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL} }; -mmove_t parasite_move_start_fidget = { +mmove_t parasite_move_start_fidget = +{ FRAME_stand18, - FRAME_stand21, + FRAME_stand21, parasite_frames_start_fidget, parasite_do_fidget }; -mframe_t parasite_frames_fidget[] = { +static mframe_t parasite_frames_fidget[] = { {ai_stand, 0, parasite_scratch}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -118,14 +147,15 @@ mframe_t parasite_frames_fidget[] = { {ai_stand, 0, NULL} }; -mmove_t parasite_move_fidget = { +mmove_t parasite_move_fidget = +{ FRAME_stand22, FRAME_stand27, parasite_frames_fidget, parasite_refidget }; -mframe_t parasite_frames_end_fidget[] = { +static mframe_t parasite_frames_end_fidget[] = { {ai_stand, 0, parasite_scratch}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -136,7 +166,8 @@ mframe_t parasite_frames_end_fidget[] = { {ai_stand, 0, NULL} }; -mmove_t parasite_move_end_fidget = { +mmove_t parasite_move_end_fidget = +{ FRAME_stand28, FRAME_stand35, parasite_frames_end_fidget, @@ -146,7 +177,7 @@ mmove_t parasite_move_end_fidget = { void parasite_end_fidget(edict_t *self) { - if (!self) + if (!self) { return; } @@ -157,7 +188,7 @@ parasite_end_fidget(edict_t *self) void parasite_do_fidget(edict_t *self) { - if (!self) + if (!self) { return; } @@ -168,7 +199,7 @@ parasite_do_fidget(edict_t *self) void parasite_refidget(edict_t *self) { - if (!self) + if (!self) { return; } @@ -186,7 +217,7 @@ parasite_refidget(edict_t *self) void parasite_idle(edict_t *self) { - if (!self) + if (!self) { return; } @@ -194,7 +225,7 @@ parasite_idle(edict_t *self) self->monsterinfo.currentmove = ¶site_move_start_fidget; } -mframe_t parasite_frames_stand[] = { +static mframe_t parasite_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, parasite_tap}, @@ -214,9 +245,10 @@ mframe_t parasite_frames_stand[] = { {ai_stand, 0, parasite_tap} }; -mmove_t parasite_move_stand = { +mmove_t parasite_move_stand = +{ FRAME_stand01, - FRAME_stand17, + FRAME_stand17, parasite_frames_stand, parasite_stand }; @@ -224,7 +256,7 @@ mmove_t parasite_move_stand = { void parasite_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -232,55 +264,58 @@ parasite_stand(edict_t *self) self->monsterinfo.currentmove = ¶site_move_stand; } -mframe_t parasite_frames_run[] = { +static 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_footstep}, + {ai_run, 19, parasite_footstep}, {ai_run, 24, NULL}, - {ai_run, 28, NULL}, + {ai_run, 28, parasite_footstep}, {ai_run, 25, NULL} }; -mmove_t parasite_move_run = { +mmove_t parasite_move_run = +{ FRAME_run03, - FRAME_run09, - parasite_frames_run, - NULL + FRAME_run09, + parasite_frames_run, + NULL }; -mframe_t parasite_frames_start_run[] = { +static mframe_t parasite_frames_start_run[] = { {ai_run, 0, NULL}, {ai_run, 30, NULL}, }; -mmove_t parasite_move_start_run = { +mmove_t parasite_move_start_run = +{ FRAME_run01, - FRAME_run02, + FRAME_run02, parasite_frames_start_run, parasite_run }; -mframe_t parasite_frames_stop_run[] = { +static mframe_t parasite_frames_stop_run[] = { {ai_run, 20, NULL}, {ai_run, 20, NULL}, - {ai_run, 12, NULL}, + {ai_run, 12, parasite_footstep}, {ai_run, 10, NULL}, {ai_run, 0, NULL}, {ai_run, 0, NULL} }; -mmove_t parasite_move_stop_run = { +mmove_t parasite_move_stop_run = +{ FRAME_run10, - FRAME_run15, - parasite_frames_stop_run, - NULL + FRAME_run15, + parasite_frames_stop_run, + NULL }; void parasite_start_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -298,7 +333,7 @@ parasite_start_run(edict_t *self) void parasite_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -313,45 +348,48 @@ parasite_run(edict_t *self) } } -mframe_t parasite_frames_walk[] = { +static mframe_t parasite_frames_walk[] = { {ai_walk, 30, NULL}, {ai_walk, 30, NULL}, - {ai_walk, 22, NULL}, + {ai_walk, 22, parasite_footstep}, {ai_walk, 19, NULL}, - {ai_walk, 24, NULL}, - {ai_walk, 28, NULL}, + {ai_walk, 24, parasite_footstep}, + {ai_walk, 28, parasite_footstep}, {ai_walk, 25, NULL} }; -mmove_t parasite_move_walk = { +mmove_t parasite_move_walk = +{ FRAME_run03, - FRAME_run09, - parasite_frames_walk, - parasite_walk + FRAME_run09, + parasite_frames_walk, + parasite_walk }; -mframe_t parasite_frames_start_walk[] = { +static mframe_t parasite_frames_start_walk[] = { {ai_walk, 0, NULL}, {ai_walk, 30, parasite_walk} }; -mmove_t parasite_move_start_walk = { +mmove_t parasite_move_start_walk = +{ FRAME_run01, - FRAME_run02, + FRAME_run02, parasite_frames_start_walk, NULL }; -mframe_t parasite_frames_stop_walk[] = { +static mframe_t parasite_frames_stop_walk[] = { {ai_walk, 20, NULL}, {ai_walk, 20, NULL}, - {ai_walk, 12, NULL}, + {ai_walk, 12, parasite_footstep}, {ai_walk, 10, NULL}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL} }; -mmove_t parasite_move_stop_walk = { +mmove_t parasite_move_stop_walk = +{ FRAME_run10, FRAME_run15, parasite_frames_stop_walk, @@ -361,7 +399,7 @@ mmove_t parasite_move_stop_walk = { void parasite_start_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -372,7 +410,7 @@ parasite_start_walk(edict_t *self) void parasite_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -380,7 +418,7 @@ parasite_walk(edict_t *self) self->monsterinfo.currentmove = ¶site_move_walk; } -mframe_t parasite_frames_pain1[] = { +static mframe_t parasite_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -394,9 +432,10 @@ mframe_t parasite_frames_pain1[] = { {ai_move, 0, NULL} }; -mmove_t parasite_move_pain1 = { +mmove_t parasite_move_pain1 = +{ FRAME_pain101, - FRAME_pain111, + FRAME_pain111, parasite_frames_pain1, parasite_start_run }; @@ -405,7 +444,7 @@ void parasite_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, int damage /* unused */) { - if (!self) + if (!self) { return; } @@ -475,7 +514,7 @@ parasite_drain_attack(edict_t *self) trace_t tr; int damage; - if (!self) + if (!self) { return; } @@ -537,7 +576,7 @@ parasite_drain_attack(edict_t *self) damage, 0, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN); } -mframe_t parasite_frames_drain[] = { +static mframe_t parasite_frames_drain[] = { {ai_charge, 0, parasite_launch}, {ai_charge, 0, NULL}, {ai_charge, 15, parasite_drain_attack}, /* Target hits */ @@ -558,14 +597,15 @@ mframe_t parasite_frames_drain[] = { {ai_charge, 0, NULL} }; -mmove_t parasite_move_drain = { +mmove_t parasite_move_drain = +{ FRAME_drain01, FRAME_drain18, parasite_frames_drain, parasite_start_run }; -mframe_t parasite_frames_break[] = { +static mframe_t parasite_frames_break[] = { {ai_charge, 0, NULL}, {ai_charge, -3, NULL}, {ai_charge, 1, NULL}, @@ -600,18 +640,18 @@ mframe_t parasite_frames_break[] = { {ai_charge, 1, NULL} }; -mmove_t parasite_move_break = { +mmove_t parasite_move_break = +{ FRAME_break01, - FRAME_break32, - parasite_frames_break, + FRAME_break32, + parasite_frames_break, parasite_start_run }; - void parasite_attack(edict_t *self) { - if (!self) + if (!self) { return; } @@ -622,7 +662,7 @@ parasite_attack(edict_t *self) void parasite_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -635,7 +675,7 @@ parasite_dead(edict_t *self) gi.linkentity(self); } -mframe_t parasite_frames_death[] = { +static mframe_t parasite_frames_death[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -645,7 +685,8 @@ mframe_t parasite_frames_death[] = { {ai_move, 0, NULL} }; -mmove_t parasite_move_death = { +mmove_t parasite_move_death = +{ FRAME_death101, FRAME_death107, parasite_frames_death, @@ -671,15 +712,18 @@ parasite_die(edict_t *self, edict_t *inflictor /* unused */, for (n = 0; n < 2; n++) { - ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, GIB_ORGANIC); } for (n = 0; n < 4; n++) { - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", + damage, GIB_ORGANIC); } - ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); + ThrowHead(self, "models/objects/gibs/head2/tris.md2", + damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } @@ -702,7 +746,7 @@ parasite_die(edict_t *self, edict_t *inflictor /* unused */, void SP_monster_parasite(edict_t *self) { - if (!self) + if (!self) { return; } diff --git a/src/monster/soldier/soldier.c b/src/monster/soldier/soldier.c index f8fed2e..18ddef3 100644 --- a/src/monster/soldier/soldier.c +++ b/src/monster/soldier/soldier.c @@ -1,4 +1,23 @@ -/* ======================================================================= +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= * * Soldier aka "Guard". This is the most complex enemy in Quake 2, since * it uses all AI features (dodging, sight, crouching, etc) and comes @@ -22,6 +41,10 @@ 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_stand(edict_t *self); void soldier_run(edict_t *self); @@ -29,10 +52,47 @@ void soldierh_stand(edict_t *self); void soldierh_run(edict_t *self); extern void brain_dabeam(edict_t *self); +void +soldier_footstep(edict_t *self) +{ + if (!g_monsterfootsteps->value) + return; + + // Lazy loading for savegame compatibility. + if (sound_step == 0 || sound_step2 == 0 || sound_step3 == 0 || sound_step4 == 0) + { + 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"); + } + + int i; + i = randk() % 4; + + 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) { - if (!self) + if (!self) { return; } @@ -46,7 +106,7 @@ soldier_idle(edict_t *self) void soldier_cock(edict_t *self) { - if (!self) + if (!self) { return; } @@ -61,7 +121,7 @@ soldier_cock(edict_t *self) } } -mframe_t soldier_frames_stand1[] = { +static mframe_t soldier_frames_stand1[] = { {ai_stand, 0, soldier_idle}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -96,14 +156,15 @@ mframe_t soldier_frames_stand1[] = { {ai_stand, 0, NULL} }; -mmove_t soldier_move_stand1 = { +mmove_t soldier_move_stand1 = +{ FRAME_stand101, FRAME_stand130, - soldier_frames_stand1, - soldier_stand + soldier_frames_stand1, + soldier_stand }; -mframe_t soldier_frames_stand3[] = { +static mframe_t soldier_frames_stand3[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -148,7 +209,8 @@ mframe_t soldier_frames_stand3[] = { {ai_stand, 0, NULL} }; -mmove_t soldier_move_stand3 = { +mmove_t soldier_move_stand3 = +{ FRAME_stand301, FRAME_stand339, soldier_frames_stand3, @@ -158,7 +220,7 @@ mmove_t soldier_move_stand3 = { void soldier_stand(edict_t *self) { - if (!self) + if (!self) { return; } @@ -177,7 +239,7 @@ soldier_stand(edict_t *self) void soldier_walk1_random(edict_t *self) { - if (!self) + if (!self) { return; } @@ -188,16 +250,16 @@ soldier_walk1_random(edict_t *self) } } -mframe_t soldier_frames_walk1[] = { +static 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}, @@ -224,19 +286,20 @@ mframe_t soldier_frames_walk1[] = { {ai_walk, 0, NULL} }; -mmove_t soldier_move_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}, +static mframe_t soldier_frames_walk2[] = { + {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}, @@ -244,17 +307,18 @@ mframe_t soldier_frames_walk2[] = { {ai_walk, 7, NULL} }; -mmove_t soldier_move_walk2 = { +mmove_t soldier_move_walk2 = +{ FRAME_walk209, FRAME_walk218, - soldier_frames_walk2, + soldier_frames_walk2, NULL }; void soldier_walk(edict_t *self) { - if (!self) + if (!self) { return; } @@ -269,38 +333,40 @@ soldier_walk(edict_t *self) } } -mframe_t soldier_frames_start_run[] = { +static mframe_t soldier_frames_start_run[] = { {ai_run, 7, NULL}, {ai_run, 5, NULL} }; -mmove_t soldier_move_start_run = { +mmove_t soldier_move_start_run = +{ FRAME_run01, FRAME_run02, soldier_frames_start_run, soldier_run }; -mframe_t soldier_frames_run[] = { +static 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} }; -mmove_t soldier_move_run = { +mmove_t soldier_move_run = +{ FRAME_run03, - FRAME_run08, - soldier_frames_run, + FRAME_run08, + soldier_frames_run, NULL }; void soldier_run(edict_t *self) { - if (!self) + if (!self) { return; } @@ -323,7 +389,7 @@ soldier_run(edict_t *self) } } -mframe_t soldier_frames_pain1[] = { +static mframe_t soldier_frames_pain1[] = { {ai_move, -3, NULL}, {ai_move, 4, NULL}, {ai_move, 1, NULL}, @@ -331,14 +397,15 @@ mframe_t soldier_frames_pain1[] = { {ai_move, 0, NULL} }; -mmove_t soldier_move_pain1 = { +mmove_t soldier_move_pain1 = +{ FRAME_pain101, FRAME_pain105, soldier_frames_pain1, soldier_run }; -mframe_t soldier_frames_pain2[] = { +static mframe_t soldier_frames_pain2[] = { {ai_move, -13, NULL}, {ai_move, -1, NULL}, {ai_move, 2, NULL}, @@ -348,17 +415,18 @@ mframe_t soldier_frames_pain2[] = { {ai_move, 2, NULL} }; -mmove_t soldier_move_pain2 = { +mmove_t soldier_move_pain2 = +{ FRAME_pain201, - FRAME_pain207, + FRAME_pain207, soldier_frames_pain2, soldier_run }; -mframe_t soldier_frames_pain3[] = { +static 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}, @@ -373,17 +441,18 @@ 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 = { +mmove_t soldier_move_pain3 = +{ FRAME_pain301, FRAME_pain318, soldier_frames_pain3, soldier_run }; -mframe_t soldier_frames_pain4[] = { +static mframe_t soldier_frames_pain4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -403,10 +472,11 @@ mframe_t soldier_frames_pain4[] = { {ai_move, 0, NULL} }; -mmove_t soldier_move_pain4 = { +mmove_t soldier_move_pain4 = +{ FRAME_pain401, - FRAME_pain417, - soldier_frames_pain4, + FRAME_pain417, + soldier_frames_pain4, soldier_run }; @@ -417,7 +487,7 @@ soldier_pain(edict_t *self, edict_t *other /* unused */, float r; int n; - if (!self) + if (!self) { return; } @@ -431,8 +501,8 @@ soldier_pain(edict_t *self, edict_t *other /* unused */, { if ((self->velocity[2] > 100) && ((self->monsterinfo.currentmove == &soldier_move_pain1) || - (self->monsterinfo.currentmove == &soldier_move_pain2) || - (self->monsterinfo.currentmove == &soldier_move_pain3))) + (self->monsterinfo.currentmove == &soldier_move_pain2) || + (self->monsterinfo.currentmove == &soldier_move_pain3))) { self->monsterinfo.currentmove = &soldier_move_pain4; } @@ -484,37 +554,40 @@ soldier_pain(edict_t *self, edict_t *other /* unused */, } } -static int blaster_flash[] = { +static int blaster_flash[] = +{ MZ2_SOLDIER_BLASTER_1, MZ2_SOLDIER_BLASTER_2, MZ2_SOLDIER_BLASTER_3, MZ2_SOLDIER_BLASTER_4, - MZ2_SOLDIER_BLASTER_5, - MZ2_SOLDIER_BLASTER_6, + MZ2_SOLDIER_BLASTER_5, + MZ2_SOLDIER_BLASTER_6, MZ2_SOLDIER_BLASTER_7, MZ2_SOLDIER_BLASTER_8 }; -static int shotgun_flash[] = { +static int shotgun_flash[] = +{ MZ2_SOLDIER_SHOTGUN_1, - MZ2_SOLDIER_SHOTGUN_2, - MZ2_SOLDIER_SHOTGUN_3, + MZ2_SOLDIER_SHOTGUN_2, + MZ2_SOLDIER_SHOTGUN_3, MZ2_SOLDIER_SHOTGUN_4, - MZ2_SOLDIER_SHOTGUN_5, - MZ2_SOLDIER_SHOTGUN_6, + MZ2_SOLDIER_SHOTGUN_5, + MZ2_SOLDIER_SHOTGUN_6, MZ2_SOLDIER_SHOTGUN_7, - MZ2_SOLDIER_SHOTGUN_8 + MZ2_SOLDIER_SHOTGUN_8 }; -static int machinegun_flash[] = { +static int machinegun_flash[] = +{ MZ2_SOLDIER_MACHINEGUN_1, - MZ2_SOLDIER_MACHINEGUN_2, - MZ2_SOLDIER_MACHINEGUN_3, + MZ2_SOLDIER_MACHINEGUN_2, + MZ2_SOLDIER_MACHINEGUN_3, MZ2_SOLDIER_MACHINEGUN_4, - MZ2_SOLDIER_MACHINEGUN_5, - MZ2_SOLDIER_MACHINEGUN_6, + MZ2_SOLDIER_MACHINEGUN_5, + MZ2_SOLDIER_MACHINEGUN_6, MZ2_SOLDIER_MACHINEGUN_7, - MZ2_SOLDIER_MACHINEGUN_8 + MZ2_SOLDIER_MACHINEGUN_8 }; void @@ -528,7 +601,7 @@ soldier_fire(edict_t *self, int flash_number) float r, u; int flash_index; - if (!self) + if (!self) { return; } @@ -578,8 +651,9 @@ soldier_fire(edict_t *self, int flash_number) } else if (self->s.skinnum <= 3) { - monster_fire_shotgun(self, start, aim, 2, 1, DEFAULT_SHOTGUN_HSPREAD, - DEFAULT_SHOTGUN_VSPREAD, DEFAULT_SHOTGUN_COUNT, flash_index); + monster_fire_shotgun(self, start, aim, 2, 1, + DEFAULT_SHOTGUN_HSPREAD, DEFAULT_SHOTGUN_VSPREAD, + DEFAULT_SHOTGUN_COUNT, flash_index); } else { @@ -605,7 +679,7 @@ soldier_fire(edict_t *self, int flash_number) void soldier_fire1(edict_t *self) { - if (!self) + if (!self) { return; } @@ -616,7 +690,7 @@ soldier_fire1(edict_t *self) void soldier_attack1_refire1(edict_t *self) { - if (!self) + if (!self) { return; } @@ -631,7 +705,8 @@ soldier_attack1_refire1(edict_t *self) return; } - if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + if (((skill->value == SKILL_HARDPLUS) && + (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } @@ -644,7 +719,7 @@ soldier_attack1_refire1(edict_t *self) void soldier_attack1_refire2(edict_t *self) { - if (!self) + if (!self) { return; } @@ -659,13 +734,14 @@ soldier_attack1_refire2(edict_t *self) return; } - if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + if (((skill->value == SKILL_HARDPLUS) && + (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } } -mframe_t soldier_frames_attack1[] = { +static mframe_t soldier_frames_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_fire1}, @@ -680,17 +756,18 @@ mframe_t soldier_frames_attack1[] = { {ai_charge, 0, NULL} }; -mmove_t soldier_move_attack1 = { +mmove_t soldier_move_attack1 = +{ FRAME_attak101, - FRAME_attak112, - soldier_frames_attack1, + FRAME_attak112, + soldier_frames_attack1, soldier_run }; void soldier_fire2(edict_t *self) { - if (!self) + if (!self) { return; } @@ -701,7 +778,12 @@ soldier_fire2(edict_t *self) void soldier_attack2_refire1(edict_t *self) { - if (!self) + if (!self) + { + return; + } + + if (!self->enemy) { return; } @@ -716,7 +798,8 @@ soldier_attack2_refire1(edict_t *self) return; } - if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + if (((skill->value == SKILL_HARDPLUS) && + (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak204; } @@ -729,7 +812,12 @@ soldier_attack2_refire1(edict_t *self) void soldier_attack2_refire2(edict_t *self) { - if (!self) + if (!self) + { + return; + } + + if (!self->enemy) { return; } @@ -744,13 +832,14 @@ soldier_attack2_refire2(edict_t *self) return; } - if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + if (((skill->value == SKILL_HARDPLUS) && + (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak204; } } -mframe_t soldier_frames_attack2[] = { +static mframe_t soldier_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -771,7 +860,8 @@ mframe_t soldier_frames_attack2[] = { {ai_charge, 0, NULL} }; -mmove_t soldier_move_attack2 = { +mmove_t soldier_move_attack2 = +{ FRAME_attak201, FRAME_attak218, soldier_frames_attack2, @@ -781,7 +871,7 @@ mmove_t soldier_move_attack2 = { void soldier_duck_down(edict_t *self) { - if (!self) + if (!self) { return; } @@ -801,7 +891,7 @@ soldier_duck_down(edict_t *self) void soldier_duck_up(edict_t *self) { - if (!self) + if (!self) { return; } @@ -815,7 +905,7 @@ soldier_duck_up(edict_t *self) void soldier_fire3(edict_t *self) { - if (!self) + if (!self) { return; } @@ -827,7 +917,7 @@ soldier_fire3(edict_t *self) void soldier_attack3_refire(edict_t *self) { - if (!self) + if (!self) { return; } @@ -838,7 +928,7 @@ soldier_attack3_refire(edict_t *self) } } -mframe_t soldier_frames_attack3[] = { +static mframe_t soldier_frames_attack3[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldier_fire3}, @@ -850,17 +940,18 @@ mframe_t soldier_frames_attack3[] = { {ai_charge, 0, NULL} }; -mmove_t soldier_move_attack3 = { +mmove_t soldier_move_attack3 = +{ FRAME_attak301, - FRAME_attak309, - soldier_frames_attack3, - soldier_run + FRAME_attak309, + soldier_frames_attack3, + soldier_run }; void soldier_fire4(edict_t *self) { - if (!self) + if (!self) { return; } @@ -868,16 +959,17 @@ soldier_fire4(edict_t *self) soldier_fire(self, 3); } -mframe_t soldier_frames_attack4[] = { - {ai_charge, 0, NULL}, +static mframe_t soldier_frames_attack4[] = { {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 = { +mmove_t soldier_move_attack4 = +{ FRAME_attak401, FRAME_attak406, soldier_frames_attack4, @@ -887,7 +979,7 @@ mmove_t soldier_move_attack4 = { void soldier_fire8(edict_t *self) { - if (!self) + if (!self) { return; } @@ -898,7 +990,7 @@ soldier_fire8(edict_t *self) void soldier_attack6_refire(edict_t *self) { - if (!self) + if (!self) { return; } @@ -919,34 +1011,35 @@ soldier_attack6_refire(edict_t *self) } } -mframe_t soldier_frames_attack6[] = { +static 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} }; -mmove_t soldier_move_attack6 = { +mmove_t soldier_move_attack6 = +{ FRAME_runs01, - FRAME_runs14, - soldier_frames_attack6, - soldier_run + FRAME_runs14, + soldier_frames_attack6, + soldier_run }; void soldier_attack(edict_t *self) { - if (!self) + if (!self) { return; } @@ -971,7 +1064,7 @@ soldier_attack(edict_t *self) void soldier_sight(edict_t *self, edict_t *other /* unused */) { - if (!self) + if (!self) { return; } @@ -997,7 +1090,7 @@ soldier_sight(edict_t *self, edict_t *other /* unused */) void soldier_duck_hold(edict_t *self) { - if (!self) + if (!self) { return; } @@ -1012,7 +1105,7 @@ soldier_duck_hold(edict_t *self) } } -mframe_t soldier_frames_duck[] = { +static mframe_t soldier_frames_duck[] = { {ai_move, 5, soldier_duck_down}, {ai_move, -1, soldier_duck_hold}, {ai_move, 1, NULL}, @@ -1020,7 +1113,8 @@ mframe_t soldier_frames_duck[] = { {ai_move, 5, NULL} }; -mmove_t soldier_move_duck = { +mmove_t soldier_move_duck = +{ FRAME_duck01, FRAME_duck05, soldier_frames_duck, @@ -1032,7 +1126,7 @@ soldier_dodge(edict_t *self, edict_t *attacker, float eta) { float r; - if (!self || !attacker) + if (!self || !attacker) { return; } @@ -1093,7 +1187,7 @@ soldier_dodge(edict_t *self, edict_t *attacker, float eta) void soldier_fire6(edict_t *self) { - if (!self) + if (!self) { return; } @@ -1104,7 +1198,7 @@ soldier_fire6(edict_t *self) void soldier_fire7(edict_t *self) { - if (!self) + if (!self) { return; } @@ -1115,7 +1209,7 @@ soldier_fire7(edict_t *self) void soldier_dead(edict_t *self) { - if (!self) + if (!self) { return; } @@ -1128,7 +1222,7 @@ soldier_dead(edict_t *self) gi.linkentity(self); } -mframe_t soldier_frames_death1[] = { +static mframe_t soldier_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, -10, NULL}, {ai_move, -10, NULL}, @@ -1170,14 +1264,15 @@ mframe_t soldier_frames_death1[] = { {ai_move, 0, NULL} }; -mmove_t soldier_move_death1 = { +mmove_t soldier_move_death1 = +{ FRAME_death101, - FRAME_death136, - soldier_frames_death1, - soldier_dead + FRAME_death136, + soldier_frames_death1, + soldier_dead }; -mframe_t soldier_frames_death2[] = { +static mframe_t soldier_frames_death2[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, @@ -1218,14 +1313,15 @@ mframe_t soldier_frames_death2[] = { {ai_move, 0, NULL} }; -mmove_t soldier_move_death2 = { +mmove_t soldier_move_death2 = +{ FRAME_death201, - FRAME_death235, + FRAME_death235, soldier_frames_death2, soldier_dead }; -mframe_t soldier_frames_death3[] = { +static mframe_t soldier_frames_death3[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, @@ -1277,14 +1373,15 @@ mframe_t soldier_frames_death3[] = { {ai_move, 0, NULL}, }; -mmove_t soldier_move_death3 = { +mmove_t soldier_move_death3 = +{ FRAME_death301, FRAME_death345, soldier_frames_death3, soldier_dead }; -mframe_t soldier_frames_death4[] = { +static mframe_t soldier_frames_death4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -1345,14 +1442,15 @@ mframe_t soldier_frames_death4[] = { {ai_move, 0, NULL} }; -mmove_t soldier_move_death4 = { +mmove_t soldier_move_death4 = +{ FRAME_death401, FRAME_death453, soldier_frames_death4, - soldier_dead + soldier_dead }; -mframe_t soldier_frames_death5[] = { +static mframe_t soldier_frames_death5[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, @@ -1381,14 +1479,15 @@ mframe_t soldier_frames_death5[] = { {ai_move, 0, NULL} }; -mmove_t soldier_move_death5 = { +mmove_t soldier_move_death5 = +{ FRAME_death501, FRAME_death524, soldier_frames_death5, soldier_dead }; -mframe_t soldier_frames_death6[] = { +static mframe_t soldier_frames_death6[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -1401,11 +1500,12 @@ mframe_t soldier_frames_death6[] = { {ai_move, 0, NULL} }; -mmove_t soldier_move_death6 = { +mmove_t soldier_move_death6 = +{ FRAME_death601, - FRAME_death610, - soldier_frames_death6, - soldier_dead + FRAME_death610, + soldier_frames_death6, + soldier_dead }; void @@ -1415,7 +1515,7 @@ soldier_die(edict_t *self, edict_t *inflictor /* unused */, { int n; - if (!self) + if (!self) { return; } @@ -1427,11 +1527,14 @@ soldier_die(edict_t *self, edict_t *inflictor /* unused */, for (n = 0; n < 3; n++) { - ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", + damage, GIB_ORGANIC); } - ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, GIB_ORGANIC); - ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC); + ThrowGib(self, "models/objects/gibs/chest/tris.md2", + damage, GIB_ORGANIC); + ThrowHead(self, "models/objects/gibs/head2/tris.md2", + damage, GIB_ORGANIC); self->deadflag = DEAD_DEAD; return; } @@ -1493,11 +1596,18 @@ soldier_die(edict_t *self, edict_t *inflictor /* unused */, void SP_monster_soldier_x(edict_t *self) { - if (!self) + if (!self) { return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + sound_step3 = 0; + sound_step4 = 0; + self->s.modelindex = gi.modelindex("models/monsters/soldier/tris.md2"); self->monsterinfo.scale = MODEL_SCALE; VectorSet(self->mins, -16, -16, -24); @@ -1536,7 +1646,7 @@ SP_monster_soldier_x(edict_t *self) void SP_monster_soldier_light(edict_t *self) { - if (!self) + if (!self) { return; } @@ -1554,6 +1664,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"); @@ -1567,7 +1681,7 @@ SP_monster_soldier_light(edict_t *self) void SP_monster_soldier(edict_t *self) { - if (!self) + if (!self) { return; } @@ -1585,6 +1699,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; @@ -1596,7 +1714,7 @@ SP_monster_soldier(edict_t *self) void SP_monster_soldier_ss(edict_t *self) { - if (!self) + if (!self) { return; } @@ -1614,6 +1732,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; @@ -1651,7 +1773,7 @@ soldierh_cock(edict_t *self) } } -mframe_t soldierh_frames_stand1[] = { +static mframe_t soldierh_frames_stand1[] = { {ai_stand, 0, soldierh_idle}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -1693,7 +1815,7 @@ mmove_t soldierh_move_stand1 = { soldierh_stand }; -mframe_t soldierh_frames_stand3[] = { +static mframe_t soldierh_frames_stand3[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -1777,7 +1899,7 @@ soldierh_walk1_random(edict_t *self) } } -mframe_t soldierh_frames_walk1[] = { +static mframe_t soldierh_frames_walk1[] = { {ai_walk, 3, NULL}, {ai_walk, 6, NULL}, {ai_walk, 2, NULL}, @@ -1820,7 +1942,7 @@ mmove_t soldierh_move_walk1 = { NULL }; -mframe_t soldierh_frames_walk2[] = { +static mframe_t soldierh_frames_walk2[] = { {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, {ai_walk, 9, NULL}, @@ -1858,7 +1980,7 @@ soldierh_walk(edict_t *self) } } -mframe_t soldierh_frames_start_run[] = { +static mframe_t soldierh_frames_start_run[] = { {ai_run, 7, NULL}, {ai_run, 5, NULL} }; @@ -1870,7 +1992,7 @@ mmove_t soldierh_move_start_run = { soldierh_run }; -mframe_t soldierh_frames_run[] = { +static mframe_t soldierh_frames_run[] = { {ai_run, 10, NULL}, {ai_run, 11, NULL}, {ai_run, 11, NULL}, @@ -1912,7 +2034,7 @@ soldierh_run(edict_t *self) } } -mframe_t soldierh_frames_pain1[] = { +static mframe_t soldierh_frames_pain1[] = { {ai_move, -3, NULL}, {ai_move, 4, NULL}, {ai_move, 1, NULL}, @@ -1927,7 +2049,7 @@ mmove_t soldierh_move_pain1 = { soldierh_run }; -mframe_t soldierh_frames_pain2[] = { +static mframe_t soldierh_frames_pain2[] = { {ai_move, -13, NULL}, {ai_move, -1, NULL}, {ai_move, 2, NULL}, @@ -1944,7 +2066,7 @@ mmove_t soldierh_move_pain2 = { soldierh_run }; -mframe_t soldierh_frames_pain3[] = { +static mframe_t soldierh_frames_pain3[] = { {ai_move, -8, NULL}, {ai_move, 10, NULL}, {ai_move, -4, NULL}, @@ -1972,7 +2094,7 @@ mmove_t soldierh_move_pain3 = { soldierh_run }; -mframe_t soldierh_frames_pain4[] = { +static mframe_t soldierh_frames_pain4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -2340,7 +2462,7 @@ soldierh_hyper_sound(edict_t *self) } } -mframe_t soldierh_frames_attack1[] = { +static mframe_t soldierh_frames_attack1[] = { {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_hyper_sound}, {ai_charge, 0, soldierh_fire1}, @@ -2470,7 +2592,7 @@ soldierh_attack2_refire2(edict_t *self) } } -mframe_t soldierh_frames_attack2[] = { +static mframe_t soldierh_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -2558,7 +2680,7 @@ soldierh_attack3_refire(edict_t *self) } } -mframe_t soldierh_frames_attack3[] = { +static mframe_t soldierh_frames_attack3[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_fire3}, @@ -2588,7 +2710,7 @@ soldierh_fire4(edict_t *self) soldierh_fire(self, 3); } -mframe_t soldierh_frames_attack4[] = { +static mframe_t soldierh_frames_attack4[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, soldierh_fire4}, @@ -2639,7 +2761,7 @@ soldierh_attack6_refire(edict_t *self) } } -mframe_t soldierh_frames_attack6[] = { +static mframe_t soldierh_frames_attack6[] = { {ai_charge, 10, NULL}, {ai_charge, 4, NULL}, {ai_charge, 12, NULL}, @@ -2739,7 +2861,7 @@ soldierh_duck_hold(edict_t *self) } } -mframe_t soldierh_frames_duck[] = { +static mframe_t soldierh_frames_duck[] = { {ai_move, 5, soldierh_duck_down}, {ai_move, -1, soldierh_duck_hold}, {ai_move, 1, NULL}, @@ -2862,7 +2984,7 @@ soldierh_dead(edict_t *self) gi.linkentity(self); } -mframe_t soldierh_frames_death1[] = { +static mframe_t soldierh_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, -10, NULL}, {ai_move, -10, NULL}, @@ -2911,7 +3033,7 @@ mmove_t soldierh_move_death1 = { soldierh_dead }; -mframe_t soldierh_frames_death2[] = { +static mframe_t soldierh_frames_death2[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, @@ -2959,7 +3081,7 @@ mmove_t soldierh_move_death2 = { soldierh_dead }; -mframe_t soldierh_frames_death3[] = { +static mframe_t soldierh_frames_death3[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, @@ -3018,7 +3140,7 @@ mmove_t soldierh_move_death3 = { soldierh_dead }; -mframe_t soldierh_frames_death4[] = { +static mframe_t soldierh_frames_death4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -3086,7 +3208,7 @@ mmove_t soldierh_move_death4 = { soldierh_dead }; -mframe_t soldierh_frames_death5[] = { +static mframe_t soldierh_frames_death5[] = { {ai_move, -5, NULL}, {ai_move, -5, NULL}, {ai_move, -5, NULL}, @@ -3122,7 +3244,7 @@ mmove_t soldierh_move_death5 = { soldierh_dead }; -mframe_t soldierh_frames_death6[] = { +static mframe_t soldierh_frames_death6[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -3227,11 +3349,18 @@ soldierh_die(edict_t *self, edict_t *inflictor /* unused */, void SP_monster_soldier_h(edict_t *self) { - if (!self) + if (!self) { return; } + // Force recaching at next footstep to ensure + // that the sound indices are correct. + sound_step = 0; + sound_step2 = 0; + sound_step3 = 0; + sound_step4 = 0; + self->s.modelindex = gi.modelindex("models/monsters/soldierh/tris.md2"); self->monsterinfo.scale = MODEL_SCALE; VectorSet(self->mins, -16, -16, -24); @@ -3303,7 +3432,7 @@ SP_monster_soldier_ripper(edict_t *self) void SP_monster_soldier_hypergun(edict_t *self) { - if (!self) + if (!self) { return; } @@ -3333,7 +3462,7 @@ SP_monster_soldier_hypergun(edict_t *self) void SP_monster_soldier_lasergun(edict_t *self) { - if (!self) + if (!self) { return; } diff --git a/src/monster/supertank/supertank.c b/src/monster/supertank/supertank.c index 064d5fd..aeb57ba 100644 --- a/src/monster/supertank/supertank.c +++ b/src/monster/supertank/supertank.c @@ -53,7 +53,7 @@ supertank_search(edict_t *self) } } -mframe_t supertank_frames_stand[] = { +static mframe_t supertank_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -134,7 +134,7 @@ supertank_stand(edict_t *self) self->monsterinfo.currentmove = &supertank_move_stand; } -mframe_t supertank_frames_run[] = { +static mframe_t supertank_frames_run[] = { {ai_run, 12, TreadSound}, {ai_run, 12, NULL}, {ai_run, 12, NULL}, @@ -162,7 +162,7 @@ mmove_t supertank_move_run = { NULL }; -mframe_t supertank_frames_forward[] = { +static mframe_t supertank_frames_forward[] = { {ai_walk, 4, TreadSound}, {ai_walk, 4, NULL}, {ai_walk, 4, NULL}, @@ -230,7 +230,7 @@ supertank_run(edict_t *self) } } -mframe_t supertank_frames_turn_right[] = { +static mframe_t supertank_frames_turn_right[] = { {ai_move, 0, TreadSound}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -258,7 +258,7 @@ mmove_t supertank_move_turn_right = { supertank_run }; -mframe_t supertank_frames_turn_left[] = { +static mframe_t supertank_frames_turn_left[] = { {ai_move, 0, TreadSound}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -286,7 +286,7 @@ mmove_t supertank_move_turn_left = { supertank_run }; -mframe_t supertank_frames_pain3[] = { +static mframe_t supertank_frames_pain3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -300,7 +300,7 @@ mmove_t supertank_move_pain3 = { supertank_run }; -mframe_t supertank_frames_pain2[] = { +static mframe_t supertank_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -314,7 +314,7 @@ mmove_t supertank_move_pain2 = { supertank_run }; -mframe_t supertank_frames_pain1[] = { +static mframe_t supertank_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -328,7 +328,7 @@ mmove_t supertank_move_pain1 = { supertank_run }; -mframe_t supertank_frames_death1[] = { +static mframe_t supertank_frames_death1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -362,7 +362,7 @@ mmove_t supertank_move_death = { supertank_dead }; -mframe_t supertank_frames_backward[] = { +static mframe_t supertank_frames_backward[] = { {ai_walk, 0, TreadSound}, {ai_walk, 0, NULL}, {ai_walk, 0, NULL}, @@ -390,7 +390,7 @@ mmove_t supertank_move_backward = { NULL }; -mframe_t supertank_frames_attack4[] = { +static mframe_t supertank_frames_attack4[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -406,7 +406,7 @@ mmove_t supertank_move_attack4 = { supertank_run }; -mframe_t supertank_frames_attack3[] = { +static mframe_t supertank_frames_attack3[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -443,7 +443,7 @@ mmove_t supertank_move_attack3 = { supertank_run }; -mframe_t supertank_frames_attack2[] = { +static mframe_t supertank_frames_attack2[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -480,7 +480,7 @@ mmove_t supertank_move_attack2 = { supertank_run }; -mframe_t supertank_frames_attack1[] = { +static mframe_t supertank_frames_attack1[] = { {ai_charge, 0, supertankMachineGun}, {ai_charge, 0, supertankMachineGun}, {ai_charge, 0, supertankMachineGun}, @@ -496,7 +496,7 @@ mmove_t supertank_move_attack1 = { supertank_reattack1 }; -mframe_t supertank_frames_end_attack1[] = { +static mframe_t supertank_frames_end_attack1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, diff --git a/src/monster/tank/tank.c b/src/monster/tank/tank.c index 7db8c49..c8c8028 100644 --- a/src/monster/tank/tank.c +++ b/src/monster/tank/tank.c @@ -78,7 +78,7 @@ tank_idle(edict_t *self) gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); } -mframe_t tank_frames_stand[] = { +static mframe_t tank_frames_stand[] = { {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, {ai_stand, 0, NULL}, @@ -129,7 +129,7 @@ tank_stand(edict_t *self) self->monsterinfo.currentmove = &tank_move_stand; } -mframe_t tank_frames_start_walk[] = { +static mframe_t tank_frames_start_walk[] = { {ai_walk, 0, NULL}, {ai_walk, 6, NULL}, {ai_walk, 6, NULL}, @@ -143,7 +143,7 @@ mmove_t tank_move_start_walk = { tank_walk }; -mframe_t tank_frames_walk[] = { +static mframe_t tank_frames_walk[] = { {ai_walk, 4, NULL}, {ai_walk, 5, NULL}, {ai_walk, 3, NULL}, @@ -169,7 +169,7 @@ mmove_t tank_move_walk = { NULL }; -mframe_t tank_frames_stop_walk[] = { +static mframe_t tank_frames_stop_walk[] = { {ai_walk, 3, NULL}, {ai_walk, 3, NULL}, {ai_walk, 2, NULL}, @@ -195,7 +195,7 @@ tank_walk(edict_t *self) self->monsterinfo.currentmove = &tank_move_walk; } -mframe_t tank_frames_start_run[] = { +static mframe_t tank_frames_start_run[] = { {ai_run, 0, NULL}, {ai_run, 6, NULL}, {ai_run, 6, NULL}, @@ -209,7 +209,7 @@ mmove_t tank_move_start_run = { tank_run }; -mframe_t tank_frames_run[] = { +static mframe_t tank_frames_run[] = { {ai_run, 4, NULL}, {ai_run, 5, NULL}, {ai_run, 3, NULL}, @@ -235,7 +235,7 @@ mmove_t tank_move_run = { NULL }; -mframe_t tank_frames_stop_run[] = { +static mframe_t tank_frames_stop_run[] = { {ai_run, 3, NULL}, {ai_run, 3, NULL}, {ai_run, 2, NULL}, @@ -284,7 +284,7 @@ tank_run(edict_t *self) } } -mframe_t tank_frames_pain1[] = { +static mframe_t tank_frames_pain1[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -298,7 +298,7 @@ mmove_t tank_move_pain1 = { tank_run }; -mframe_t tank_frames_pain2[] = { +static mframe_t tank_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -313,7 +313,7 @@ mmove_t tank_move_pain2 = { tank_run }; -mframe_t tank_frames_pain3[] = { +static mframe_t tank_frames_pain3[] = { {ai_move, -7, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, @@ -547,7 +547,7 @@ TankMachineGun(edict_t *self) DEFAULT_BULLET_VSPREAD, flash_number); } -mframe_t tank_frames_attack_blast[] = { +static mframe_t tank_frames_attack_blast[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -573,7 +573,7 @@ mmove_t tank_move_attack_blast = { tank_reattack_blaster }; -mframe_t tank_frames_reattack_blast[] = { +static mframe_t tank_frames_reattack_blast[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, TankBlaster}, @@ -589,7 +589,7 @@ mmove_t tank_move_reattack_blast = { tank_reattack_blaster }; -mframe_t tank_frames_attack_post_blast[] = { +static mframe_t tank_frames_attack_post_blast[] = { {ai_move, 0, NULL}, /* 17 */ {ai_move, 0, NULL}, {ai_move, 2, NULL}, @@ -638,7 +638,7 @@ tank_poststrike(edict_t *self) tank_run(self); } -mframe_t tank_frames_attack_strike[] = { +static mframe_t tank_frames_attack_strike[] = { {ai_move, 3, NULL}, {ai_move, 2, NULL}, {ai_move, 2, NULL}, @@ -686,7 +686,7 @@ mmove_t tank_move_attack_strike = { tank_poststrike }; -mframe_t tank_frames_attack_pre_rocket[] = { +static mframe_t tank_frames_attack_pre_rocket[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -719,7 +719,7 @@ mmove_t tank_move_attack_pre_rocket = { tank_doattack_rocket }; -mframe_t tank_frames_attack_fire_rocket[] = { +static mframe_t tank_frames_attack_fire_rocket[] = { {ai_charge, -3, NULL}, /* Loop Start 22 */ {ai_charge, 0, NULL}, {ai_charge, 0, TankRocket}, /* 24 */ @@ -738,7 +738,7 @@ mmove_t tank_move_attack_fire_rocket = { tank_refire_rocket }; -mframe_t tank_frames_attack_post_rocket[] = { +static mframe_t tank_frames_attack_post_rocket[] = { {ai_charge, 0, NULL}, /* 31 */ {ai_charge, -1, NULL}, {ai_charge, -1, NULL}, @@ -773,7 +773,7 @@ mmove_t tank_move_attack_post_rocket = { tank_run }; -mframe_t tank_frames_attack_chain[] = { +static mframe_t tank_frames_attack_chain[] = { {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, {ai_charge, 0, NULL}, @@ -930,7 +930,7 @@ tank_dead(edict_t *self) gi.linkentity(self); } -mframe_t tank_frames_death1[] = { +static mframe_t tank_frames_death1[] = { {ai_move, -7, NULL}, {ai_move, -2, NULL}, {ai_move, -2, NULL}, diff --git a/src/savegame/savegame.c b/src/savegame/savegame.c index 281f5e4..d8c5109 100644 --- a/src/savegame/savegame.c +++ b/src/savegame/savegame.c @@ -47,12 +47,15 @@ #include "../header/local.h" /* -* When ever the savegame version is changed, q2 will refuse to -* load older savegames. This should be bumped if the files -* in tables/ are changed, otherwise strange things may happen. -*/ -#define SAVEGAMEVER "YQ2-4" + * When ever the savegame version is changed, q2 will refuse to + * load older savegames. This should be bumped if the files + * in tables/ are changed, otherwise strange things may happen. + */ +#define SAVEGAMEVER "YQ2-5" +#ifndef BUILD_DATE +#define BUILD_DATE __DATE__ +#endif /* * This macros are used to prohibit loading of savegames @@ -142,12 +145,12 @@ typedef struct * to each of the functions * prototyped above. */ -functionList_t functionList[] = { +static functionList_t functionList[] = { #include "tables/gamefunc_list.h" }; /* - * Prtotypes for forward + * Prototypes for forward * declaration for all game * mmove_t functions. */ @@ -159,12 +162,12 @@ functionList_t functionList[] = { * functions prototyped * above. */ -mmoveList_t mmoveList[] = { +static mmoveList_t mmoveList[] = { #include "tables/gamemmove_list.h" }; /* - * Fields to be saved + * Fields to be saved (used in g_spawn.c) */ field_t fields[] = { #include "tables/fields.h" @@ -174,7 +177,7 @@ field_t fields[] = { * Level fields to * be saved */ -field_t levelfields[] = { +static field_t levelfields[] = { #include "tables/levelfields.h" }; @@ -182,7 +185,7 @@ field_t levelfields[] = { * Client fields to * be saved */ -field_t clientfields[] = { +static field_t clientfields[] = { #include "tables/clientfields.h" }; @@ -197,7 +200,7 @@ void InitGame(void) { gi.dprintf("Game is starting up.\n"); - gi.dprintf("Game is %s built on %s.\n", GAMEVERSION, __DATE__); + gi.dprintf("Game is %s built on %s.\n", GAMEVERSION, BUILD_DATE); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); @@ -213,7 +216,7 @@ InitGame(void) /* latched vars */ sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); - gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); + gi.cvar ("gamedate", BUILD_DATE, CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); maxspectators = gi.cvar ("maxspectators", "4", CVAR_SERVERINFO); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); @@ -223,6 +226,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); /* change anytime vars */ @@ -837,6 +841,7 @@ ReadGame(const char *filename) {"YQ2-2", 2}, {"YQ2-3", 3}, {"YQ2-4", 4}, + {"YQ2-5", 5}, }; for (i=0; i < sizeof(version_mappings)/sizeof(version_mappings[0]); ++i) @@ -847,7 +852,7 @@ ReadGame(const char *filename) break; } } - + if (save_ver == 0) // not found in mappings table { fclose(f); @@ -957,7 +962,7 @@ WriteEdict(FILE *f, edict_t *ent) } /* - * Helper fcuntion to write the + * Helper function to write the * level local data into a file. * Called by WriteLevel. */ @@ -1073,10 +1078,10 @@ ReadLevelLocals(FILE *f) /* * Reads a level back into the memory. - * SpawnEntities were allready called + * SpawnEntities were already called * in the same way when the level was * saved. All world links were cleared - * befor this function was called. When + * before this function was called. When * this function is called, no clients * are connected to the server. */ @@ -1172,4 +1177,3 @@ ReadLevel(const char *filename) } } } - diff --git a/src/savegame/tables/gamefunc_decs.h b/src/savegame/tables/gamefunc_decs.h index 210d24d..821c576 100644 --- a/src/savegame/tables/gamefunc_decs.h +++ b/src/savegame/tables/gamefunc_decs.h @@ -1,4 +1,23 @@ /* + * Copyright (C) 1997-2001 Id Software, Inc. + * Copyright (C) 2011 Yamagi Burmeister + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * * ======================================================================= * * Prototypes for every function in the game.so. @@ -263,6 +282,7 @@ extern void SP_monster_soldier_ss ( edict_t * self ) ; extern void SP_monster_soldier ( edict_t * self ) ; extern void SP_monster_soldier_light ( edict_t * self ) ; extern void SP_monster_soldier_x ( edict_t * self ) ; +extern void soldier_footstep( edict_t *self ) ; extern void soldier_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void soldier_dead ( edict_t * self ) ; extern void soldier_fire7 ( edict_t * self ) ; @@ -349,6 +369,7 @@ extern void M_ChangeYaw ( edict_t * ent ) ; extern qboolean SV_movestep ( edict_t * ent , vec3_t move , qboolean relink ) ; extern qboolean M_CheckBottom ( edict_t * ent ) ; extern void SP_monster_medic ( edict_t * self ) ; +extern void medic_footstep( edict_t *self ) ; extern qboolean medic_checkattack ( edict_t * self ) ; extern void medic_attack ( edict_t * self ) ; extern void medic_hook_retract ( edict_t * self ) ; @@ -371,6 +392,7 @@ extern void medic_search ( edict_t * self ) ; extern void medic_idle ( edict_t * self ) ; extern edict_t * medic_FindDeadMonster ( edict_t * self ) ; extern void SP_misc_insane ( edict_t * self ) ; +extern void insane_footstep( edict_t *self ) ; extern void insane_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void insane_dead ( edict_t * self ) ; extern void insane_stand ( edict_t * self ) ; @@ -386,6 +408,7 @@ extern void insane_moan ( edict_t * self ) ; extern void insane_shake ( edict_t * self ) ; extern void insane_fist ( edict_t * self ) ; extern void SP_monster_infantry ( edict_t * self ) ; +extern void infantry_footstep( edict_t *self ) ; extern void infantry_attack ( edict_t * self ) ; extern void infantry_smack ( edict_t * self ) ; extern void infantry_swing ( edict_t * self ) ; @@ -420,6 +443,7 @@ extern void hover_reattack ( edict_t * self ) ; extern void hover_search ( edict_t * self ) ; extern void hover_sight ( edict_t * self , edict_t * other ) ; extern void SP_monster_gunner ( edict_t * self ) ; +extern void gunner_footstep( edict_t *self ) ; extern void gunner_refire_chain ( edict_t * self ) ; extern void gunner_fire_chain ( edict_t * self ) ; extern void gunner_attack ( edict_t * self ) ; @@ -442,6 +466,7 @@ extern void gunner_search ( edict_t * self ) ; extern void gunner_sight ( edict_t * self , edict_t * other ) ; extern void gunner_idlesound ( edict_t * self ) ; extern void SP_monster_gladiator ( edict_t * self ) ; +extern void gladiator_footstep( edict_t *self ) ; extern void gladiator_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void gladiator_dead ( edict_t * self ) ; extern void gladiator_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; @@ -600,6 +625,7 @@ extern edict_t * fixbot_FindDeadMonster ( edict_t * self ) ; extern float crand ( void ) ; extern void SP_monster_chick_heat ( edict_t * self ) ; extern void SP_monster_chick ( edict_t * self ) ; +extern void chick_footstep( edict_t *self ) ; extern void chick_sight ( edict_t * self , edict_t * other ) ; extern void chick_attack ( edict_t * self ) ; extern void chick_melee ( edict_t * self ) ; @@ -624,6 +650,7 @@ extern void chick_stand ( edict_t * self ) ; extern void chick_fidget ( edict_t * self ) ; extern void ChickMoan ( edict_t * self ) ; extern void SP_monster_brain ( edict_t * self ) ; +extern void brain_footstep( edict_t *self ) ; extern void brain_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void brain_dead ( edict_t * self ) ; extern void brain_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; @@ -732,6 +759,7 @@ extern void boss2_firebullet_right ( edict_t * self ) ; extern void Boss2Rocket ( edict_t * self ) ; extern void boss2_search ( edict_t * self ) ; extern void SP_monster_berserk ( edict_t * self ) ; +extern void berserk_footstep( edict_t *self ) ; extern void berserk_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void berserk_dead ( edict_t * self ) ; extern void berserk_pain ( edict_t * self , edict_t * other , float kick , int damage ) ; diff --git a/src/savegame/tables/gamefunc_list.h b/src/savegame/tables/gamefunc_list.h index dc60350..97d2187 100644 --- a/src/savegame/tables/gamefunc_list.h +++ b/src/savegame/tables/gamefunc_list.h @@ -1,4 +1,23 @@ /* + * Copyright (C) 1997-2001 Id Software, Inc. + * Copyright (C) 2011 Yamagi Burmeister + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * * ======================================================================= * * Functionpointers to every function in the game.so. @@ -263,6 +282,7 @@ {"SP_monster_soldier", (byte *)SP_monster_soldier}, {"SP_monster_soldier_light", (byte *)SP_monster_soldier_light}, {"SP_monster_soldier_x", (byte *)SP_monster_soldier_x}, +{"soldier_footstep", (byte *)soldier_footstep}, {"soldier_die", (byte *)soldier_die}, {"soldier_dead", (byte *)soldier_dead}, {"soldier_fire7", (byte *)soldier_fire7}, @@ -349,6 +369,7 @@ {"SV_movestep", (byte *)SV_movestep}, {"M_CheckBottom", (byte *)M_CheckBottom}, {"SP_monster_medic", (byte *)SP_monster_medic}, +{"medic_footstep", (byte *)medic_footstep}, {"medic_checkattack", (byte *)medic_checkattack}, {"medic_attack", (byte *)medic_attack}, {"medic_hook_retract", (byte *)medic_hook_retract}, @@ -371,6 +392,7 @@ {"medic_idle", (byte *)medic_idle}, {"medic_FindDeadMonster", (byte *)medic_FindDeadMonster}, {"SP_misc_insane", (byte *)SP_misc_insane}, +{"insane_footstep", (byte *)insane_footstep}, {"insane_die", (byte *)insane_die}, {"insane_dead", (byte *)insane_dead}, {"insane_stand", (byte *)insane_stand}, @@ -386,6 +408,7 @@ {"insane_shake", (byte *)insane_shake}, {"insane_fist", (byte *)insane_fist}, {"SP_monster_infantry", (byte *)SP_monster_infantry}, +{"infantry_footstep", (byte *)infantry_footstep}, {"infantry_attack", (byte *)infantry_attack}, {"infantry_smack", (byte *)infantry_smack}, {"infantry_swing", (byte *)infantry_swing}, @@ -420,6 +443,7 @@ {"hover_search", (byte *)hover_search}, {"hover_sight", (byte *)hover_sight}, {"SP_monster_gunner", (byte *)SP_monster_gunner}, +{"gunner_footstep", (byte *)gunner_footstep}, {"gunner_refire_chain", (byte *)gunner_refire_chain}, {"gunner_fire_chain", (byte *)gunner_fire_chain}, {"gunner_attack", (byte *)gunner_attack}, @@ -442,6 +466,7 @@ {"gunner_sight", (byte *)gunner_sight}, {"gunner_idlesound", (byte *)gunner_idlesound}, {"SP_monster_gladiator", (byte *)SP_monster_gladiator}, +{"gladiator_footstep", (byte *)gladiator_footstep}, {"gladiator_die", (byte *)gladiator_die}, {"gladiator_dead", (byte *)gladiator_dead}, {"gladiator_pain", (byte *)gladiator_pain}, @@ -600,6 +625,7 @@ {"crand", (byte *)crand}, {"SP_monster_chick_heat", (byte *)SP_monster_chick_heat}, {"SP_monster_chick", (byte *)SP_monster_chick}, +{"chick_footstep", (byte *)chick_footstep}, {"chick_sight", (byte *)chick_sight}, {"chick_attack", (byte *)chick_attack}, {"chick_melee", (byte *)chick_melee}, @@ -624,6 +650,7 @@ {"chick_fidget", (byte *)chick_fidget}, {"ChickMoan", (byte *)ChickMoan}, {"SP_monster_brain", (byte *)SP_monster_brain}, +{"brain_footstep", (byte *)brain_footstep}, {"brain_die", (byte *)brain_die}, {"brain_dead", (byte *)brain_dead}, {"brain_pain", (byte *)brain_pain}, @@ -732,6 +759,7 @@ {"Boss2Rocket", (byte *)Boss2Rocket}, {"boss2_search", (byte *)boss2_search}, {"SP_monster_berserk", (byte *)SP_monster_berserk}, +{"berserk_footstep", (byte *)berserk_footstep}, {"berserk_die", (byte *)berserk_die}, {"berserk_dead", (byte *)berserk_dead}, {"berserk_pain", (byte *)berserk_pain},