The AddBarrel function was not checking the type of the barrel when
generating the oVar2. This led to skeletons being pre-spawned in
explosive barrels; except that explosive barrels do not trigger the
spawn, resulting in unreachable monsters sitting at (0, 0) even after a
full clear.
While this does not affect functionality of regular Diablo gameplay, it
potentially affects modders who would like to use the nummonsters
global variable to check for full clears.
If `dObject[dx][dy]` is zero, then `pn = -1`, which causes an
out-of-bounds access to object. If the memory `object[-1]._otype`
is either 84 or 85, then the player is randomly teleported to the
location of the Vile Betrayer quest. This can be triggered either
by interacting with a holy shrine or by casting phasing.
"Wherever you go, there you are"
The issue here is probably very unlikely to trigger anything in-game, as
the first 4 monster array elements are reserverd for golems. However,
after executing the body of the `if (mi != 0) { mi-- }` if-statement,
it is not possible to determine whether mi was 0 or 1 before executing
the body. This is relevant as the pack member check should only be
performed if mi was non-zero prior to executing the body of the
if-statement.
A fixed may look something as follows:
if (mi != 0) {
mi--;
// BUGFIX: should only run pack member check if mi was non-zero prior to executing the body of the above if-statemnet (fixed).
if (monster[mi].leaderflag == 1
&& monster[mi].leader == i
&& monster[mi]._mfutx == x
&& monster[mi]._mfuty == y) {
mcount++;
}
The dMonster array stores monster array index numbers + 1
(or the corresponding negative version -(index + 1)).
Prior to use, these must be decremented by 1.