mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Change show_hostile from int to float and remove unnecessary casts.
In the vanilla code show_hostile was a qboolean what's clearly wrong. For wome reasons I don't remember I changed it to an integer and added the casts. This is problematic because show_hostile is derived from level.time which is a float. The loss in precision broke some corner cases like monsters becoming activated when they shouldn't. Found, analyzed and reported by @BjossiAlfreds #525. Closes #525.
This commit is contained in:
parent
373ecdf429
commit
6b7af81cd2
2 changed files with 5 additions and 5 deletions
|
@ -445,7 +445,7 @@ FoundTarget(edict_t *self)
|
|||
level.sight_entity->light_level = 128;
|
||||
}
|
||||
|
||||
self->show_hostile = (int)level.time + 1; /* wake up other monsters */
|
||||
self->show_hostile = level.time + 1; /* wake up other monsters */
|
||||
|
||||
VectorCopy(self->enemy->s.origin, self->monsterinfo.last_sighting);
|
||||
self->monsterinfo.trail_time = level.time;
|
||||
|
@ -624,7 +624,7 @@ FindTarget(edict_t *self)
|
|||
|
||||
if (r == RANGE_NEAR)
|
||||
{
|
||||
if ((client->show_hostile < (int)level.time) && !infront(self, client))
|
||||
if ((client->show_hostile < level.time) && !infront(self, client))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -986,7 +986,7 @@ ai_checkattack(edict_t *self)
|
|||
}
|
||||
else
|
||||
{
|
||||
self->show_hostile = (int)level.time + 1;
|
||||
self->show_hostile = level.time + 1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ ai_checkattack(edict_t *self)
|
|||
}
|
||||
|
||||
/* wake up other monsters */
|
||||
self->show_hostile = (int)level.time + 1;
|
||||
self->show_hostile = level.time + 1;
|
||||
|
||||
/* check knowledge of enemy */
|
||||
enemy_vis = visible(self, self->enemy);
|
||||
|
|
|
@ -1028,8 +1028,8 @@ struct edict_s
|
|||
int max_health;
|
||||
int gib_health;
|
||||
int deadflag;
|
||||
int show_hostile;
|
||||
|
||||
float show_hostile;
|
||||
float powerarmor_time;
|
||||
|
||||
char *map; /* target_changelevel */
|
||||
|
|
Loading…
Reference in a new issue