These bugs are related to time of access, where fields of e.g. a
player or monster struct is accessed upon missile impact (instead
of missile launch), and at this point, the monster may be dead, or
the player may have left the game, resulting in accessing garbage
data that may have been overwritten by other data (e.g. new monster
spawn or new player joining).
One way to resolve this issue is to store e.g. the damage in the
missile struct when lanuching the missing. This way, the missile
would have all information required to know its damage on imact
instead of having to rely on outside sources that may no longer
be present.
Without this BUGFIX, pathing towards and attacking a hostile
player with player index 0 (through 3) would trigger the speech
dialogue of a corresponding monster 0 (through 3), should they
have speeches activated. Given that the first 4 monster indices
are reserved for Golems, this BUG would trigger if a golem was
killed, and given the incorrect implementation of pseudo delete
of golems in DeleteMonsterList failing to reserve the golem
monster indices, and a new monster was spawned (e.g. by King
Leoric) thus taking a "golem" monster index. Given this scenario,
attacking a player could trigger a speech dialogue (well, that is
if the spawned monsters had speech dialogues activated).
MWVel velocity values are not rounded consistently (inconsistent use of
floor and ceil). The original formula is (for 16, 32 and 64 pixels of
movement, respectively):
vel16 = (16 << monsterWalkShift) / nframes
vel32 = (32 << monsterWalkShift) / nframes
vel64 = (64 << monsterWalkShift) / nframes
The BUGFIX comment contains updated monster walk velocity values for
the MWVel table, where the formala is calculated as above with consistent
rounding to nearest integer.
Also, correct minor typo in BUGFIX of M2MStartHit. The DevilX code
is correct in M2MStartHit (the Devilution comment used
`<=` rather than `<`).
Both were related to the special handling of golem monster numbers.
Having golems occupy the first 4 monster number slots feels like
such a lovely hack :P
The index used to access monster was incorrect for the fallen
one flee behaviour. The AI should make fallen ones flee from
the direction of the monster which got hit. Right now, it's
random as the wrong index is used.