Closed BjossiAlfreds closed 4 years ago
I totally overlooked this one. I think that your suggestion - shoot constantly when blocked - is the best way. Can you send a pull request?
Done. I took the liberty to kill the useless code I mentioned, along with the bug, since it was doing traces which are quite expensive. I could have gone even further but I didn't want to break function pointers in savegames...
I could have gone even further but I didn't want to break function pointers in savegames...
Yeah, keeping some unused code or function arguments is often much easier than bumping the savegame version and implement fallback code for older ones. And it's Quake II. The code will never be nice, clean and bugfree. ;)
This is a weird one. If you anger a parasite and run away so that it can't find/reach you, you will likely hear that the parasite has started attacking something. That something is still you, only it is now ignoring visibility.
I found the source of this bug, in g_newai.c::blocked_checkshot(). This function has a special hack for parasites that executes their attack whenever they are blocked from reaching you according to the monster movement system, but it only checks range and angle, not visibility.
Also, now is a good time to mention that the rest of blocked_checkshot() is actually dead code. Notice that at the top of the function it returns if enemy is not a player, but the code that comes after the parasite stuff will only execute if enemy is a tesla, thus never executing. If we moved the parasite stuff into parasite_blocked() (or removed it altogether since it isn't doing anything useful or correct) blocked_checkshot could be eliminated and replaced by the boolean expression "false".
Question is, what do you want to do about this? I feel that rogue's intention was to make the parasite shoot constantly when blocked from reaching the player but it is still in range and can see the player, so perhaps modifying the code to check visibility may be the best solution and closest to the original intent.