Merge pull request #43 from BjossiAlfreds/berserker

Restored berserker rogue features
This commit is contained in:
Yamagi 2019-09-28 16:57:25 +02:00 committed by GitHub
commit f5d5331b8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 170 additions and 2 deletions

View file

@ -159,7 +159,7 @@ mframe_t berserk_frames_run1[] = {
{ai_run, 21, NULL},
{ai_run, 11, NULL},
{ai_run, 21, NULL},
{ai_run, 25, NULL},
{ai_run, 25, monster_done_dodge},
{ai_run, 18, NULL},
{ai_run, 19, NULL}
};
@ -179,6 +179,8 @@ berserk_run(edict_t *self)
return;
}
monster_done_dodge(self);
if (self->monsterinfo.aiflags & AI_STAND_GROUND)
{
self->monsterinfo.currentmove = &berserk_move_stand;
@ -303,6 +305,8 @@ berserk_melee(edict_t *self)
return;
}
monster_done_dodge(self);
if ((rand() % 2) == 0)
{
self->monsterinfo.currentmove = &berserk_move_attack_spike;
@ -383,6 +387,8 @@ berserk_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage)
return; /* no pain anims in nightmare */
}
monster_done_dodge(self);
if ((damage < 20) || (random() < 0.5))
{
self->monsterinfo.currentmove = &berserk_move_pain1;
@ -499,6 +505,158 @@ berserk_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /*
}
}
void
berserk_jump_now(edict_t *self)
{
vec3_t forward, up;
if (!self)
{
return;
}
monster_jump_start(self);
AngleVectors(self->s.angles, forward, NULL, up);
VectorMA(self->velocity, 100, forward, self->velocity);
VectorMA(self->velocity, 300, up, self->velocity);
}
void
berserk_jump2_now(edict_t *self)
{
vec3_t forward,up;
if (!self)
{
return;
}
monster_jump_start(self);
AngleVectors(self->s.angles, forward, NULL, up);
VectorMA(self->velocity, 150, forward, self->velocity);
VectorMA(self->velocity, 400, up, self->velocity);
}
void
berserk_jump_wait_land(edict_t *self)
{
if (!self)
{
return;
}
if (self->groundentity == NULL)
{
self->monsterinfo.nextframe = self->s.frame;
if (monster_jump_finished(self))
{
self->monsterinfo.nextframe = self->s.frame + 1;
}
}
else
{
self->monsterinfo.nextframe = self->s.frame + 1;
}
}
mframe_t berserk_frames_jump[] = {
{ai_move, 0, NULL},
{ai_move, 0, NULL},
{ai_move, 0, NULL},
{ai_move, 0, berserk_jump_now},
{ai_move, 0, NULL},
{ai_move, 0, NULL},
{ai_move, 0, berserk_jump_wait_land},
{ai_move, 0, NULL},
{ai_move, 0, NULL}
};
mmove_t berserk_move_jump = {
FRAME_jump1,
FRAME_jump9,
berserk_frames_jump,
berserk_run
};
mframe_t berserk_frames_jump2[] = {
{ai_move, -8, NULL},
{ai_move, -4, NULL},
{ai_move, -4, NULL},
{ai_move, 0, berserk_jump_now},
{ai_move, 0, NULL},
{ai_move, 0, NULL},
{ai_move, 0, berserk_jump_wait_land},
{ai_move, 0, NULL},
{ai_move, 0, NULL}
};
mmove_t berserk_move_jump2 = {
FRAME_jump1,
FRAME_jump9,
berserk_frames_jump2,
berserk_run
};
void
berserk_jump(edict_t *self)
{
if (!self || !self->enemy)
{
return;
}
monster_done_dodge(self);
if (self->enemy->s.origin[2] > self->s.origin[2])
{
self->monsterinfo.currentmove = &berserk_move_jump2;
}
else
{
self->monsterinfo.currentmove = &berserk_move_jump;
}
}
qboolean
berserk_blocked(edict_t *self, float dist)
{
if (blocked_checkjump(self, dist, 256, 40))
{
berserk_jump(self);
return true;
}
if (blocked_checkplat(self, dist))
{
return true;
}
return false;
}
void
berserk_sidestep(edict_t *self)
{
if (!self)
{
return;
}
if ((self->monsterinfo.currentmove == &berserk_move_jump) ||
(self->monsterinfo.currentmove == &berserk_move_jump2))
{
return;
}
if (self->monsterinfo.currentmove != &berserk_move_run1)
{
self->monsterinfo.currentmove = &berserk_move_run1;
}
}
/*
* QUAKED monster_berserk (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
*/
@ -540,11 +698,13 @@ SP_monster_berserk(edict_t *self)
self->monsterinfo.stand = berserk_stand;
self->monsterinfo.walk = berserk_walk;
self->monsterinfo.run = berserk_run;
self->monsterinfo.dodge = NULL;
self->monsterinfo.dodge = M_MonsterDodge;
self->monsterinfo.sidestep = berserk_sidestep;
self->monsterinfo.attack = NULL;
self->monsterinfo.melee = berserk_melee;
self->monsterinfo.sight = berserk_sight;
self->monsterinfo.search = berserk_search;
self->monsterinfo.blocked = berserk_blocked;
self->monsterinfo.currentmove = &berserk_move_stand;
self->monsterinfo.scale = MODEL_SCALE;

View file

@ -794,6 +794,8 @@ 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_sidestep ( edict_t * self ) ;
extern qboolean berserk_blocked ( edict_t * self , float dist ) ;
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 ) ;

View file

@ -794,6 +794,8 @@
{"Boss2Rocket", (byte *)Boss2Rocket},
{"boss2_search", (byte *)boss2_search},
{"SP_monster_berserk", (byte *)SP_monster_berserk},
{"berserk_sidestep", (byte *)berserk_sidestep},
{"berserk_blocked", (byte *)berserk_blocked},
{"berserk_die", (byte *)berserk_die},
{"berserk_dead", (byte *)berserk_dead},
{"berserk_pain", (byte *)berserk_pain},

View file

@ -346,6 +346,8 @@ extern mmove_t boss2_move_run ;
extern mmove_t boss2_move_walk ;
extern mmove_t boss2_move_fidget ;
extern mmove_t boss2_move_stand ;
extern mmove_t berserk_move_jump2 ;
extern mmove_t berserk_move_jump ;
extern mmove_t berserk_move_death2 ;
extern mmove_t berserk_move_death1 ;
extern mmove_t berserk_move_pain2 ;

View file

@ -346,6 +346,8 @@
{"boss2_move_walk", &boss2_move_walk},
{"boss2_move_fidget", &boss2_move_fidget},
{"boss2_move_stand", &boss2_move_stand},
{"berserk_move_jump2", &berserk_move_jump2},
{"berserk_move_jump", &berserk_move_jump},
{"berserk_move_death2", &berserk_move_death2},
{"berserk_move_death1", &berserk_move_death1},
{"berserk_move_pain2", &berserk_move_pain2},