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

Function MAI_Cleaver

Source/monster.cpp:3448–3476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3446}
3447
3448void MAI_Cleaver(int i)
3449{
3450 MonsterStruct *Monst;
3451 int x, y, mx, my, md;
3452
3453 if ((DWORD)i >= MAXMONSTERS)
3454 app_fatal("MAI_Cleaver: Invalid monster %d", i);
3455
3456 Monst = &monster[i];
3457 if (Monst->_mmode != MM_STAND || Monst->_msquelch == 0) {
3458 return;
3459 }
3460
3461 mx = Monst->_mx;
3462 my = Monst->_my;
3463 x = mx - Monst->_menemyx;
3464 y = my - Monst->_menemyy;
3465
3466 md = GetDirection(mx, my, Monst->_lastx, Monst->_lasty);
3467 Monst->_mdir = md;
3468
3469 if (abs(x) >= 2 || abs(y) >= 2)
3470 M_CallWalk(i, md);
3471 else
3472 M_StartAttack(i);
3473
3474 if (Monst->_mmode == MM_STAND)
3475 Monst->_mAnimData = Monst->MType->Anims[MA_STAND].Data[md];
3476}
3477
3478void MAI_Round(int i, BOOL special)
3479{

Callers

nothing calls this directly

Calls 4

app_fatalFunction · 0.85
GetDirectionFunction · 0.85
M_CallWalkFunction · 0.85
M_StartAttackFunction · 0.85

Tested by

no test coverage detected