| 1684 | } |
| 1685 | |
| 1686 | void M2MStartKill(int i, int mid) |
| 1687 | { |
| 1688 | int md; |
| 1689 | |
| 1690 | if ((DWORD)i >= MAXMONSTERS) { |
| 1691 | app_fatal("M2MStartKill: Invalid monster (attacker) %d", i); |
| 1692 | } |
| 1693 | if ((DWORD)i >= MAXMONSTERS) { /// BUGFIX: should check `mid` |
| 1694 | app_fatal("M2MStartKill: Invalid monster (killed) %d", mid); |
| 1695 | } |
| 1696 | if (!monster[i].MType) |
| 1697 | app_fatal("M2MStartKill: Monster %d \"%s\" MType NULL", mid, monster[mid].mName); |
| 1698 | |
| 1699 | delta_kill_monster(mid, monster[mid]._mx, monster[mid]._my, currlevel); |
| 1700 | NetSendCmdLocParam1(FALSE, CMD_MONSTDEATH, monster[mid]._mx, monster[mid]._my, mid); |
| 1701 | |
| 1702 | monster[mid].mWhoHit |= 1 << i; |
| 1703 | if (i < MAX_PLRS) |
| 1704 | AddPlrMonstExper(monster[mid].mLevel, monster[mid].mExp, monster[mid].mWhoHit); |
| 1705 | |
| 1706 | monstkills[monster[mid].MType->mtype]++; |
| 1707 | monster[mid]._mhitpoints = 0; |
| 1708 | SetRndSeed(monster[mid]._mRndSeed); |
| 1709 | |
| 1710 | if (mid >= MAX_PLRS) |
| 1711 | SpawnItem(mid, monster[mid]._mx, monster[mid]._my, TRUE); |
| 1712 | |
| 1713 | if (monster[mid].MType->mtype == MT_DIABLO) |
| 1714 | M_DiabloDeath(mid, TRUE); |
| 1715 | else |
| 1716 | PlayEffect(i, 2); |
| 1717 | |
| 1718 | PlayEffect(mid, 2); |
| 1719 | |
| 1720 | md = (monster[i]._mdir - 4) & 7; |
| 1721 | if (monster[mid].MType->mtype == MT_GOLEM) |
| 1722 | md = 0; |
| 1723 | |
| 1724 | monster[mid]._mdir = md; |
| 1725 | NewMonsterAnim(mid, &monster[mid].MType->Anims[MA_DEATH], md); |
| 1726 | monster[mid]._mmode = MM_DEATH; |
| 1727 | monster[mid]._mxoff = 0; |
| 1728 | monster[mid]._myoff = 0; |
| 1729 | monster[mid]._mx = monster[mid]._moldx; |
| 1730 | monster[mid]._my = monster[mid]._moldy; |
| 1731 | monster[mid]._mfutx = monster[mid]._moldx; |
| 1732 | monster[mid]._mfuty = monster[mid]._moldy; |
| 1733 | M_CheckEFlag(mid); |
| 1734 | M_ClearSquares(mid); |
| 1735 | dMonster[monster[mid]._mx][monster[mid]._my] = mid + 1; |
| 1736 | CheckQuestKill(mid, TRUE); |
| 1737 | M_FallenFear(monster[mid]._mx, monster[mid]._my); |
| 1738 | if (monster[mid].MType->mtype >= MT_NACID && monster[mid].MType->mtype <= MT_XACID) |
| 1739 | AddMissile(monster[mid]._mx, monster[mid]._my, 0, 0, 0, MIS_ACIDPUD, 1, mid, monster[mid]._mint + 1, 0); |
| 1740 | } |
| 1741 | |
| 1742 | void M_StartKill(int i, int pnum) |
| 1743 | { |
no test coverage detected