From d137fe863c9668ffb5bf549e350bafadecd47d5d Mon Sep 17 00:00:00 2001 From: Guilherme Nemeth Date: Tue, 16 Aug 2022 11:15:22 -0300 Subject: [PATCH] berserker: slam attack, running club attack Based on: https://github.com/fhomolka/q2_25anniversary/commit/31bc4e52e3bc944798996caa8ed01f431eedb644 --- src/game/monster/berserker/berserker.c | 69 +++++++++++++++++++++-- src/game/savegame/tables/gamemmove_decs.h | 1 + src/game/savegame/tables/gamemmove_list.h | 1 + 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/src/game/monster/berserker/berserker.c b/src/game/monster/berserker/berserker.c index 795eeb24..05c92842 100644 --- a/src/game/monster/berserker/berserker.c +++ b/src/game/monster/berserker/berserker.c @@ -325,8 +325,15 @@ mmove_t berserk_move_attack_club = void berserk_strike(edict_t *self) { - /* Unused, but removal is - very PITA. Let it be... */ + vec3_t aim; + + if (!self) + { + return; + } + + VectorSet(aim, MELEE_DISTANCE, 0, -6); + fire_hit(self, aim, (10 + (randk() % 6)), 400); /* Slower attack */ } static mframe_t berserk_frames_attack_strike[] = { @@ -354,6 +361,50 @@ mmove_t berserk_move_attack_strike = berserk_run }; +static void +berserk_attack_running_club(edict_t *self) +{ + /* Same as regular club attack */ + vec3_t aim; + + if (!self) + { + return; + } + + VectorSet(aim, MELEE_DISTANCE, self->mins[0], -4); + fire_hit(self, aim, (5 + (randk() % 6)), 400); /* Slower attack */ +} + +static mframe_t berserk_frames_attack_running_club[] = { + {ai_charge, 21, NULL}, + {ai_charge, 11, NULL}, + {ai_charge, 21, NULL}, + {ai_charge, 25, NULL}, + {ai_charge, 18, NULL}, + {ai_charge, 19, NULL}, + {ai_charge, 21, NULL}, + {ai_charge, 11, NULL}, + {ai_charge, 21, NULL}, + {ai_charge, 25, NULL}, + {ai_charge, 18, NULL}, + {ai_charge, 19, NULL}, + {ai_charge, 21, NULL}, + {ai_charge, 11, NULL}, + {ai_charge, 21, NULL}, + {ai_charge, 25, berserk_swing}, + {ai_charge, 18, berserk_attack_running_club}, + {ai_charge, 19, NULL} +}; + +mmove_t berserk_move_attack_running_club = +{ + FRAME_r_att1, + FRAME_r_att18, + berserk_frames_attack_running_club, + berserk_run +}; + void berserk_melee(edict_t *self) { @@ -364,14 +415,24 @@ berserk_melee(edict_t *self) monster_done_dodge(self); - if ((randk() % 2) == 0) + const int r = randk() % 4; + + if (r == 0) { self->monsterinfo.currentmove = &berserk_move_attack_spike; } - else + else if (r == 1) + { + self->monsterinfo.currentmove = &berserk_move_attack_strike; + } + else if (r == 2) { self->monsterinfo.currentmove = &berserk_move_attack_club; } + else + { + self->monsterinfo.currentmove = &berserk_move_attack_running_club; + } } static mframe_t berserk_frames_pain1[] = { diff --git a/src/game/savegame/tables/gamemmove_decs.h b/src/game/savegame/tables/gamemmove_decs.h index c1640f92..8bc8479c 100644 --- a/src/game/savegame/tables/gamemmove_decs.h +++ b/src/game/savegame/tables/gamemmove_decs.h @@ -56,6 +56,7 @@ extern mmove_t army_move_pain3; extern mmove_t army_move_run; extern mmove_t army_move_stand; extern mmove_t berserk_move_attack_club; +extern mmove_t berserk_move_attack_running_club; extern mmove_t berserk_move_attack_spike; extern mmove_t berserk_move_attack_strike; extern mmove_t berserk_move_death1; diff --git a/src/game/savegame/tables/gamemmove_list.h b/src/game/savegame/tables/gamemmove_list.h index 6eef5919..c9b4876d 100644 --- a/src/game/savegame/tables/gamemmove_list.h +++ b/src/game/savegame/tables/gamemmove_list.h @@ -55,6 +55,7 @@ {"army_move_run", &army_move_run}, {"army_move_stand", &army_move_stand}, {"berserk_move_attack_club", &berserk_move_attack_club}, +{"berserk_move_attack_running_club", &berserk_move_attack_running_club}, {"berserk_move_attack_spike", &berserk_move_attack_spike}, {"berserk_move_attack_strike", &berserk_move_attack_strike}, {"berserk_move_death1", &berserk_move_death1},