Update 1 changes

This commit is contained in:
Mike Rubits
2023-10-03 14:43:06 -04:00
parent 60f29560f3
commit 8dc1fc9794
67 changed files with 1806 additions and 1479 deletions

View File

@@ -14,12 +14,12 @@ black widow, part 2
#include "m_rogue_widow2.h"
#include "../m_flash.h"
static int sound_pain1;
static int sound_pain2;
static int sound_pain3;
static int sound_death;
static int sound_search1;
static int sound_tentacles_retract;
static cached_soundindex sound_pain1;
static cached_soundindex sound_pain2;
static cached_soundindex sound_pain3;
static cached_soundindex sound_death;
static cached_soundindex sound_search1;
static cached_soundindex sound_tentacles_retract;
// sqrt(64*64*2) + sqrt(28*28*2) => 130.1
constexpr vec3_t spawnpoints[] = {
@@ -685,14 +685,19 @@ MONSTERINFO_WALK(widow2_walk) (edict_t *self) -> void
M_SetAnimation(self, &widow2_move_walk);
}
void widow2_attack(edict_t *self);
MONSTERINFO_MELEE(widow2_melee) (edict_t *self) -> void
{
M_SetAnimation(self, &widow2_move_tongs);
if (self->timestamp >= level.time)
widow2_attack(self);
else
M_SetAnimation(self, &widow2_move_tongs);
}
MONSTERINFO_ATTACK(widow2_attack) (edict_t *self) -> void
{
float range, luck;
float luck;
bool blocked = false;
if (self->monsterinfo.aiflags & AI_BLOCKED)
@@ -704,6 +709,31 @@ MONSTERINFO_ATTACK(widow2_attack) (edict_t *self) -> void
if (!self->enemy)
return;
float real_enemy_range = realrange(self, self->enemy);
// melee attack
if (self->timestamp < level.time)
{
if (real_enemy_range < 300)
{
vec3_t f, r, u;
AngleVectors(self->s.angles, f, r, u);
vec3_t spot1 = G_ProjectSource2(self->s.origin, offsets[0], f, r, u);
vec3_t spot2 = self->enemy->s.origin;
if (widow2_tongue_attack_ok(spot1, spot2, 256))
{
// melee attack ok
// be nice in easy mode
if (skill->integer != 0 || irandom(4))
{
M_SetAnimation(self, &widow2_move_tongs);
return;
}
}
}
}
if (self->bad_area)
{
if ((frandom() < 0.75f) || (level.time < self->monsterinfo.attack_finished))
@@ -731,9 +761,7 @@ MONSTERINFO_ATTACK(widow2_attack) (edict_t *self) -> void
return;
}
range = realrange(self, self->enemy);
if (range < 600)
if (real_enemy_range < 600)
{
luck = frandom();
if (M_SlotsLeft(self) >= 2)
@@ -924,14 +952,6 @@ DIE(widow2_die) (edict_t *self, edict_t *inflictor, edict_t *attacker, int damag
MONSTERINFO_CHECKATTACK(Widow2_CheckAttack) (edict_t *self) -> bool
{
vec3_t spot1, spot2;
vec3_t temp;
float chance;
trace_t tr;
float enemy_yaw;
float real_enemy_range;
vec3_t f, r, u;
if (!self->enemy)
return false;
@@ -944,92 +964,7 @@ MONSTERINFO_CHECKATTACK(Widow2_CheckAttack) (edict_t *self) -> bool
return true;
}
if (self->enemy->health > 0)
{
// see if any entities are in the way of the shot
spot1 = self->s.origin;
spot1[2] += self->viewheight;
spot2 = self->enemy->s.origin;
spot2[2] += self->enemy->viewheight;
tr = gi.traceline(spot1, spot2, self, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_PLAYER | CONTENTS_SLIME | CONTENTS_LAVA);
// do we have a clear shot?
if (tr.ent != self->enemy && !(tr.ent->svflags & SVF_PLAYER))
{
// go ahead and spawn stuff if we're mad a a client
if (self->enemy->client && M_SlotsLeft(self) >= 2)
{
self->monsterinfo.attack_state = AS_BLIND;
return true;
}
// PGM - we want them to go ahead and shoot at info_notnulls if they can.
if (self->enemy->solid != SOLID_NOT || tr.fraction < 1.0f) // PGM
return false;
}
}
float enemy_range = range_to(self, self->enemy);
temp = self->enemy->s.origin - self->s.origin;
enemy_yaw = vectoyaw(temp);
self->ideal_yaw = enemy_yaw;
// melee attack
if (self->timestamp < level.time)
{
real_enemy_range = realrange(self, self->enemy);
if (real_enemy_range < 300)
{
AngleVectors(self->s.angles, f, r, u);
spot1 = G_ProjectSource2(self->s.origin, offsets[0], f, r, u);
spot2 = self->enemy->s.origin;
if (widow2_tongue_attack_ok(spot1, spot2, 256))
{
// melee attack ok
// be nice in easy mode
if (skill->integer == 0 && irandom(4))
return false;
if (self->monsterinfo.melee)
self->monsterinfo.attack_state = AS_MELEE;
else
self->monsterinfo.attack_state = AS_MISSILE;
return true;
}
}
}
if (level.time < self->monsterinfo.attack_finished)
return false;
if (self->monsterinfo.aiflags & AI_STAND_GROUND)
{
chance = 0.4f;
}
else if (enemy_range <= RANGE_NEAR)
{
chance = 0.8f;
}
else if (enemy_range <= RANGE_MID)
{
chance = 0.8f;
}
else
{
chance = 0.5f;
}
// PGM - go ahead and shoot every time if it's a info_notnull
if ((frandom() < chance) || (self->enemy->solid == SOLID_NOT))
{
self->monsterinfo.attack_state = AS_MISSILE;
return true;
}
return false;
return M_CheckAttack_Base(self, 0.4f, 0.8f, 0.8f, 0.5f, 0.f, 0.f);
}
void Widow2Precache()
@@ -1072,12 +1007,12 @@ void SP_monster_widow2(edict_t *self)
return;
}
sound_pain1 = gi.soundindex("widow/bw2pain1.wav");
sound_pain2 = gi.soundindex("widow/bw2pain2.wav");
sound_pain3 = gi.soundindex("widow/bw2pain3.wav");
sound_death = gi.soundindex("widow/death.wav");
sound_search1 = gi.soundindex("bosshovr/bhvunqv1.wav");
sound_tentacles_retract = gi.soundindex("brain/brnatck3.wav");
sound_pain1.assign("widow/bw2pain1.wav");
sound_pain2.assign("widow/bw2pain2.wav");
sound_pain3.assign("widow/bw2pain3.wav");
sound_death.assign("widow/death.wav");
sound_search1.assign("bosshovr/bhvunqv1.wav");
sound_tentacles_retract.assign("brain/brnatck3.wav");
// self->s.sound = gi.soundindex ("bosshovr/bhvengn1.wav");