mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 14:30:48 +00:00
Fix monsters being unable to see the player if he generates noise.
When searching for the player FinTarget() always goes after sound targets and aborts as soon as it finds one. So if the player is constantly generating sounds - for example firing the machine gun - there's a high chance that monsters will only hear but never see him. Work around this by adding a small timeout to player noises, make sure that at least 3 frames passed since the last noise. This gives monsters 2 frames to see the player. This bug was present in the original code, this is a small gameplay change. The problem was analysed by @BjossiAlfreds in #436. He also suggested the fix.
This commit is contained in:
parent
35547d813a
commit
5c17eb0132
1 changed files with 10 additions and 0 deletions
|
@ -123,12 +123,22 @@ PlayerNoise(edict_t *who, vec3_t where, int type)
|
|||
|
||||
if ((type == PNOISE_SELF) || (type == PNOISE_WEAPON))
|
||||
{
|
||||
if (level.framenum <= (level.sound_entity_framenum + 3))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
noise = who->mynoise;
|
||||
level.sound_entity = noise;
|
||||
level.sound_entity_framenum = level.framenum;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (level.framenum <= (level.sound2_entity_framenum + 3))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
noise = who->mynoise2;
|
||||
level.sound2_entity = noise;
|
||||
level.sound2_entity_framenum = level.framenum;
|
||||
|
|
Loading…
Reference in a new issue