MCPcopy Create free account
hub / github.com/diasurgical/devilution / MonstStartKill

Function MonstStartKill

Source/monster.cpp:1635–1684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1633}
1634
1635void MonstStartKill(int i, int pnum, BOOL sendmsg)
1636{
1637 int md;
1638
1639 if ((DWORD)i >= MAXMONSTERS) {
1640 app_fatal("MonstStartKill: Invalid monster %d", i);
1641 }
1642 if (!monster[i].MType) {
1643 app_fatal("MonstStartKill: Monster %d \"%s\" MType NULL", i, monster[i].mName);
1644 }
1645
1646 if (pnum >= 0)
1647 monster[i].mWhoHit |= 1 << pnum;
1648 if (pnum < MAX_PLRS && i > MAX_PLRS)
1649 AddPlrMonstExper(monster[i].mLevel, monster[i].mExp, monster[i].mWhoHit);
1650 monstkills[monster[i].MType->mtype]++;
1651 monster[i]._mhitpoints = 0;
1652 SetRndSeed(monster[i]._mRndSeed);
1653 if (QuestStatus(QTYPE_GARB) && monster[i].mName == UniqMonst[UMT_GARBUD].mName) {
1654 CreateTypeItem(monster[i]._mx + 1, monster[i]._my + 1, TRUE, ITYPE_MACE, IMISC_NONE, TRUE, FALSE);
1655 } else if (i > MAX_PLRS - 1) { // Golems should not spawn items
1656 SpawnItem(i, monster[i]._mx, monster[i]._my, sendmsg);
1657 }
1658 if (monster[i].MType->mtype == MT_DIABLO)
1659 M_DiabloDeath(i, TRUE);
1660 else
1661 PlayEffect(i, 2);
1662
1663 if (pnum >= 0)
1664 md = M_GetDir(i);
1665 else
1666 md = monster[i]._mdir;
1667 monster[i]._mdir = md;
1668 NewMonsterAnim(i, &monster[i].MType->Anims[MA_DEATH], md);
1669 monster[i]._mmode = MM_DEATH;
1670 monster[i]._mxoff = 0;
1671 monster[i]._myoff = 0;
1672 monster[i]._mVar1 = 0;
1673 monster[i]._mx = monster[i]._moldx;
1674 monster[i]._my = monster[i]._moldy;
1675 monster[i]._mfutx = monster[i]._moldx;
1676 monster[i]._mfuty = monster[i]._moldy;
1677 M_CheckEFlag(i);
1678 M_ClearSquares(i);
1679 dMonster[monster[i]._mx][monster[i]._my] = i + 1;
1680 CheckQuestKill(i, sendmsg);
1681 M_FallenFear(monster[i]._mx, monster[i]._my);
1682 if (monster[i].MType->mtype >= MT_NACID && monster[i].MType->mtype <= MT_XACID)
1683 AddMissile(monster[i]._mx, monster[i]._my, 0, 0, 0, MIS_ACIDPUD, 1, i, monster[i]._mint + 1, 0);
1684}
1685
1686void M2MStartKill(int i, int mid)
1687{

Callers 2

M_StartKillFunction · 0.85
M_SyncStartKillFunction · 0.85

Calls 15

app_fatalFunction · 0.85
AddPlrMonstExperFunction · 0.85
SetRndSeedFunction · 0.85
QuestStatusFunction · 0.85
CreateTypeItemFunction · 0.85
SpawnItemFunction · 0.85
M_DiabloDeathFunction · 0.85
PlayEffectFunction · 0.85
M_GetDirFunction · 0.85
NewMonsterAnimFunction · 0.85
M_CheckEFlagFunction · 0.85
M_ClearSquaresFunction · 0.85

Tested by

no test coverage detected