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

Function M_DoDeath

Source/monster.cpp:2595–2637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2593}
2594
2595BOOL M_DoDeath(int i)
2596{
2597 int var1;
2598 int x, y;
2599
2600 if ((DWORD)i >= MAXMONSTERS)
2601 app_fatal("M_DoDeath: Invalid monster %d", i);
2602 if (monster[i].MType == NULL)
2603 app_fatal("M_DoDeath: Monster %d \"%s\" MType NULL", i, monster[i].mName);
2604
2605 monster[i]._mVar1++;
2606 var1 = monster[i]._mVar1;
2607 if (monster[i].MType->mtype == MT_DIABLO) {
2608 x = monster[i]._mx - ViewX;
2609 if (x < 0)
2610 x = -1;
2611 else
2612 x = x > 0;
2613 ViewX += x;
2614
2615 y = monster[i]._my - ViewY;
2616 if (y < 0) {
2617 y = -1;
2618 } else {
2619 y = y > 0;
2620 }
2621 ViewY += y;
2622
2623 if (var1 == 140)
2624 PrepDoEnding();
2625 } else if (monster[i]._mAnimFrame == monster[i]._mAnimLen) {
2626 if (monster[i]._uniqtype == 0)
2627 AddDead(monster[i]._mx, monster[i]._my, monster[i].MType->mdeadval, (direction)monster[i]._mdir);
2628 else
2629 AddDead(monster[i]._mx, monster[i]._my, monster[i]._udeadval, (direction)monster[i]._mdir);
2630
2631 dMonster[monster[i]._mx][monster[i]._my] = 0;
2632 monster[i]._mDelFlag = TRUE;
2633
2634 M_UpdateLeader(i);
2635 }
2636 return FALSE;
2637}
2638
2639BOOL M_DoSpStand(int i)
2640{

Callers 1

ProcessMonstersFunction · 0.85

Calls 4

app_fatalFunction · 0.85
PrepDoEndingFunction · 0.85
AddDeadFunction · 0.85
M_UpdateLeaderFunction · 0.85

Tested by

no test coverage detected