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

Function M_DoRSpAttack

Source/monster.cpp:2249–2289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2247}
2248
2249int M_DoRSpAttack(int i)
2250{
2251 if ((DWORD)i >= MAXMONSTERS)
2252 app_fatal("M_DoRSpAttack: Invalid monster %d", i);
2253 if (monster[i].MType == NULL)
2254 app_fatal("M_DoRSpAttack: Monster %d \"%s\" MType NULL", i, monster[i].mName);
2255 if (monster[i].MType == NULL) // BUGFIX: should check MData
2256 app_fatal("M_DoRSpAttack: Monster %d \"%s\" MData NULL", i, monster[i].mName);
2257
2258 if (monster[i]._mAnimFrame == monster[i].MData->mAFNum2 && !monster[i]._mAnimCnt) {
2259 AddMissile(
2260 monster[i]._mx,
2261 monster[i]._my,
2262 monster[i]._menemyx,
2263 monster[i]._menemyy,
2264 monster[i]._mdir,
2265 monster[i]._mVar1,
2266 1,
2267 i,
2268 monster[i]._mVar3,
2269 0);
2270 PlayEffect(i, 3);
2271 }
2272
2273 if (monster[i]._mAi == AI_MEGA && monster[i]._mAnimFrame == 3) {
2274 int hadV2 = monster[i]._mVar2;
2275 monster[i]._mVar2++;
2276 if (hadV2 == 0) {
2277 monster[i]._mFlags |= MFLAG_ALLOW_SPECIAL;
2278 } else if (monster[i]._mVar2 == 15) {
2279 monster[i]._mFlags &= ~MFLAG_ALLOW_SPECIAL;
2280 }
2281 }
2282
2283 if (monster[i]._mAnimFrame == monster[i]._mAnimLen) {
2284 M_StartStand(i, monster[i]._mdir);
2285 return TRUE;
2286 }
2287
2288 return FALSE;
2289}
2290
2291BOOL M_DoSAttack(int i)
2292{

Callers 1

ProcessMonstersFunction · 0.85

Calls 4

app_fatalFunction · 0.85
AddMissileFunction · 0.85
PlayEffectFunction · 0.85
M_StartStandFunction · 0.85

Tested by

no test coverage detected