Investigated PVS report for monster code and addressed a number of issues

This commit is contained in:
BjossiAlfreds 2019-09-25 19:01:47 +00:00
parent e2cadbc06b
commit c2188ed5f6
11 changed files with 12 additions and 99 deletions

View file

@ -711,10 +711,6 @@ Boss2_CheckAttack(edict_t *self)
{ {
chance = 0.4; chance = 0.4;
} }
else if (enemy_range == RANGE_MELEE)
{
chance = 0.8;
}
else if (enemy_range == RANGE_NEAR) else if (enemy_range == RANGE_NEAR)
{ {
chance = 0.8; chance = 0.8;

View file

@ -807,10 +807,6 @@ Jorg_CheckAttack(edict_t *self)
{ {
chance = 0.4; chance = 0.4;
} }
else if (enemy_range == RANGE_MELEE)
{
chance = 0.8;
}
else if (enemy_range == RANGE_NEAR) else if (enemy_range == RANGE_NEAR)
{ {
chance = 0.4; chance = 0.4;

View file

@ -975,10 +975,6 @@ Makron_CheckAttack(edict_t *self)
{ {
chance = 0.4; chance = 0.4;
} }
else if (enemy_range == RANGE_MELEE)
{
chance = 0.8;
}
else if (enemy_range == RANGE_NEAR) else if (enemy_range == RANGE_NEAR)
{ {
chance = 0.4; chance = 0.4;

View file

@ -1436,10 +1436,6 @@ Carrier_CheckAttack(edict_t *self)
{ {
chance = 0.4; chance = 0.4;
} }
else if (enemy_range == RANGE_MELEE)
{
chance = 0.8;
}
else if (enemy_range == RANGE_NEAR) else if (enemy_range == RANGE_NEAR)
{ {
chance = 0.8; chance = 0.8;

View file

@ -330,11 +330,6 @@ InfantryMachineGun(edict_t *self)
return; return;
} }
if (!self->enemy || !self->enemy->inuse)
{
return;
}
/* new attack start frame */ /* new attack start frame */
if (self->s.frame == FRAME_attak104) if (self->s.frame == FRAME_attak104)
{ {
@ -343,7 +338,7 @@ InfantryMachineGun(edict_t *self)
G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], G_ProjectSource(self->s.origin, monster_flash_offset[flash_number],
forward, right, start); forward, right, start);
if (self->enemy) if (self->enemy && self->enemy->inuse)
{ {
VectorMA(self->enemy->s.origin, -0.2, self->enemy->velocity, target); VectorMA(self->enemy->s.origin, -0.2, self->enemy->velocity, target);
target[2] += self->enemy->viewheight; target[2] += self->enemy->viewheight;

View file

@ -18,7 +18,6 @@ edict_t *new_bad;
* Returns false if any part of the bottom of the * Returns false if any part of the bottom of the
* entity is off an edge that is not a staircase. * entity is off an edge that is not a staircase.
*/ */
int c_yes, c_no;
qboolean qboolean
M_CheckBottom(edict_t *ent) M_CheckBottom(edict_t *ent)
@ -60,11 +59,9 @@ M_CheckBottom(edict_t *ent)
} }
} }
c_yes++;
return true; /* we got out easy */ return true; /* we got out easy */
realcheck: realcheck:
c_no++;
start[2] = mins[2]; start[2] = mins[2];
/* the midpoint must be within 16 of the bottom */ /* the midpoint must be within 16 of the bottom */
@ -132,7 +129,6 @@ realcheck:
} }
} }
c_yes++;
return true; return true;
} }
@ -449,34 +445,13 @@ SV_movestep(edict_t *ent, vec3_t move, qboolean relink)
if (!current_bad && new_bad) if (!current_bad && new_bad)
{ {
if (new_bad->owner) if (new_bad->owner && !strcmp(new_bad->owner->classname, "tesla"))
{ {
if (!strcmp(new_bad->owner->classname, "tesla")) if (!ent->enemy || !ent->enemy->inuse ||
!ent->enemy->client || !visible(ent, ent->enemy))
{ {
if ((!(ent->enemy)) || (!(ent->enemy->inuse))) TargetTesla(ent, new_bad->owner);
{ ent->monsterinfo.aiflags |= AI_BLOCKED;
TargetTesla(ent, new_bad->owner);
ent->monsterinfo.aiflags |= AI_BLOCKED;
}
else if (!strcmp(ent->enemy->classname, "telsa"))
{
}
else if ((ent->enemy) && (ent->enemy->client))
{
if (visible(ent, ent->enemy))
{
}
else
{
TargetTesla(ent, new_bad->owner);
ent->monsterinfo.aiflags |= AI_BLOCKED;
}
}
else
{
TargetTesla(ent, new_bad->owner);
ent->monsterinfo.aiflags |= AI_BLOCKED;
}
} }
} }

View file

@ -676,14 +676,11 @@ supertankMachineGun(edict_t *self)
G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], G_ProjectSource(self->s.origin, monster_flash_offset[flash_number],
forward, right, start); forward, right, start);
if (self->enemy) VectorCopy(self->enemy->s.origin, vec);
{ VectorMA(vec, 0, self->enemy->velocity, vec);
VectorCopy(self->enemy->s.origin, vec); vec[2] += self->enemy->viewheight;
VectorMA(vec, 0, self->enemy->velocity, vec); VectorSubtract(vec, start, forward);
vec[2] += self->enemy->viewheight; VectorNormalize(forward);
VectorSubtract(vec, start, forward);
VectorNormalize(forward);
}
monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD,
DEFAULT_BULLET_VSPREAD, flash_number); DEFAULT_BULLET_VSPREAD, flash_number);

View file

@ -526,7 +526,7 @@ TurretFire(edict_t *self)
VectorCopy(self->enemy->s.origin, end); VectorCopy(self->enemy->s.origin, end);
/* aim for the head. */ /* aim for the head. */
if ((self->enemy) && (self->enemy->client)) if (self->enemy->client)
{ {
end[2] += self->enemy->viewheight; end[2] += self->enemy->viewheight;
} }

View file

@ -1712,42 +1712,6 @@ ThrowWidowGibReal(edict_t *self, char *gibname, int damage, int type,
gi.linkentity(gib); gi.linkentity(gib);
} }
void
BloodFountain(edict_t *self, int number, vec3_t startpos, int damage)
{
int n;
vec3_t vd;
vec3_t origin, size, velocity;
if (!self)
{
return;
}
return;
for (n = 0; n < number; n++)
{
if (startpos)
{
VectorCopy(startpos, origin);
}
else
{
VectorScale(self->size, 0.5, size);
VectorAdd(self->absmin, size, origin);
origin[0] = origin[0] + crandom() * size[0];
origin[1] = origin[1] + crandom() * size[1];
origin[2] = origin[2] + crandom() * size[2];
}
WidowVelocityForDamage(damage, vd);
VectorMA(self->velocity, 1.0, vd, velocity);
velocity[0] *= 2;
velocity[1] *= 2;
}
}
void void
ThrowSmallStuff(edict_t *self, vec3_t point) ThrowSmallStuff(edict_t *self, vec3_t point)
{ {

View file

@ -206,7 +206,6 @@ extern void WidowExplosion1 ( edict_t * self ) ;
extern void WidowExplode ( edict_t * self ) ; extern void WidowExplode ( edict_t * self ) ;
extern void ThrowMoreStuff ( edict_t * self , vec3_t point ) ; extern void ThrowMoreStuff ( edict_t * self , vec3_t point ) ;
extern void ThrowSmallStuff ( edict_t * self , vec3_t point ) ; extern void ThrowSmallStuff ( edict_t * self , vec3_t point ) ;
extern void BloodFountain ( edict_t * self , int number , vec3_t startpos , int damage ) ;
extern void ThrowWidowGibReal ( edict_t * self , char * gibname , int damage , int type , vec3_t startpos , qboolean sized , int hitsound , qboolean fade ) ; extern void ThrowWidowGibReal ( edict_t * self , char * gibname , int damage , int type , vec3_t startpos , qboolean sized , int hitsound , qboolean fade ) ;
extern void ThrowWidowGibSized ( edict_t * self , char * gibname , int damage , int type , vec3_t startpos , int hitsound , qboolean fade ) ; extern void ThrowWidowGibSized ( edict_t * self , char * gibname , int damage , int type , vec3_t startpos , int hitsound , qboolean fade ) ;
extern void ThrowWidowGibLoc ( edict_t * self , char * gibname , int damage , int type , vec3_t startpos , qboolean fade ) ; extern void ThrowWidowGibLoc ( edict_t * self , char * gibname , int damage , int type , vec3_t startpos , qboolean fade ) ;

View file

@ -206,7 +206,6 @@
{"WidowExplode", (byte *)WidowExplode}, {"WidowExplode", (byte *)WidowExplode},
{"ThrowMoreStuff", (byte *)ThrowMoreStuff}, {"ThrowMoreStuff", (byte *)ThrowMoreStuff},
{"ThrowSmallStuff", (byte *)ThrowSmallStuff}, {"ThrowSmallStuff", (byte *)ThrowSmallStuff},
{"BloodFountain", (byte *)BloodFountain},
{"ThrowWidowGibReal", (byte *)ThrowWidowGibReal}, {"ThrowWidowGibReal", (byte *)ThrowWidowGibReal},
{"ThrowWidowGibSized", (byte *)ThrowWidowGibSized}, {"ThrowWidowGibSized", (byte *)ThrowWidowGibSized},
{"ThrowWidowGibLoc", (byte *)ThrowWidowGibLoc}, {"ThrowWidowGibLoc", (byte *)ThrowWidowGibLoc},