Browse Source

Clean up MAI_Ranged (#546)

pull/25/head
Anders Jenbo 7 years ago committed by Robin Eklind
parent
commit
d91c64e063
  1. 97
      Source/monster.cpp
  2. 2
      Source/monster.h

97
Source/monster.cpp

@ -4323,71 +4323,48 @@ void __fastcall MAI_GoatMc(int i)
MAI_Round(i, 1u); MAI_Round(i, 1u);
} }
void __fastcall MAI_Ranged(int i, int missile_type, unsigned char special) void __fastcall MAI_Ranged(int i, int missile_type, BOOL special)
{ {
int v3; // edi int md;
int v4; // esi int mx, my, fx, fy;
char v5; // al MonsterStruct *Monst;
int v6; // eax
int v7; // ecx
int v8; // ebx
int v9; // edi
BOOLEAN v11; // zf
int v12; // eax
int v13; // eax
//int v14; // ST00_4
//int v16; // eax
int x2; // [esp+8h] [ebp-14h]
int y2; // [esp+Ch] [ebp-10h]
int missile_typea; // [esp+10h] [ebp-Ch]
int v20; // [esp+14h] [ebp-8h]
int arglist; // [esp+18h] [ebp-4h]
v3 = i;
missile_typea = missile_type;
arglist = i;
if ((DWORD)i >= MAXMONSTERS) if ((DWORD)i >= MAXMONSTERS)
TermMsg("MAI_Ranged: Invalid monster %d", i); TermMsg("MAI_Ranged: Invalid monster %d", i);
v4 = v3;
if (monster[v3]._mmode == MM_STAND) { Monst = &monster[i];
v5 = monster[v4]._msquelch; if (monster[i]._mmode != MM_STAND) {
if (v5 == -1 || monster[v4]._mFlags & MFLAG_TARGETS_MONSTER) { return;
v7 = (unsigned char)monster[v4]._menemyy; }
y2 = v7;
v8 = monster[v4]._my - v7; if (Monst->_msquelch == -1 || Monst->_mFlags & MFLAG_TARGETS_MONSTER) {
x2 = (unsigned char)monster[v4]._menemyx; mx = Monst->_menemyx;
v9 = monster[v4]._mx - x2; my = Monst->_menemyy;
v20 = M_GetDir(arglist); fx = Monst->_mx - mx;
if (monster[v4]._msquelch < 0xFFu) /* check sign */ fy = Monst->_my - my;
MonstCheckDoors(arglist); md = M_GetDir(i);
v11 = monster[v4]._mVar1 == MM_RATTACK; if ((DWORD)Monst->_msquelch < -1) /* check sign */
monster[v4]._mdir = v20; MonstCheckDoors(i);
if (v11) { Monst->_mdir = md;
v12 = random(118, 20); if (Monst->_mVar1 == MM_RATTACK) {
M_StartDelay(arglist, v12); M_StartDelay(i, random(118, 20));
} else if (abs(v9) < 4) { } else if (abs(fx) < 4 && abs(fy) < 4) {
v13 = abs(v8); if (random(119, 100) < 10 * (Monst->_mint + 7))
//v15 = v14; M_CallWalk(i, opposite[md]);
if (v13 < 4) { }
if (random(119, 100) < 10 * ((unsigned char)monster[v4]._mint + 7)) if (Monst->_mmode == MM_STAND) {
M_CallWalk(arglist, opposite[v20]); if (LineClear(Monst->_mx, Monst->_my, mx, my)) {
} if (special)
} M_StartRSpAttack(i, missile_type, 4);
if (monster[v4]._mmode == MM_STAND) { else
//_LOBYTE(v16) = LineClear(monster[v4]._mx, monster[v4]._my, x2, y2); M_StartRAttack(i, missile_type, 4);
if (LineClear(monster[v4]._mx, monster[v4]._my, x2, y2)) { } else {
if (special) Monst->_mAnimData = Monst->MType->Anims[MA_STAND].Data[md];
M_StartRSpAttack(arglist, missile_typea, 4);
else
M_StartRAttack(arglist, missile_typea, 4);
} else {
monster[v4]._mAnimData = monster[v4].MType->Anims[MA_STAND].Data[v20];
}
} }
} else if (v5) {
v6 = GetDirection(monster[v4]._mx, monster[v4]._my, monster[v4]._lastx, monster[v4]._lasty);
M_CallWalk(v3, v6);
} }
} else if (Monst->_msquelch) {
md = GetDirection(Monst->_mx, Monst->_my, Monst->_lastx, Monst->_lasty);
M_CallWalk(i, md);
} }
} }

2
Source/monster.h

@ -107,7 +107,7 @@ void __fastcall MAI_Fallen(int i);
void __fastcall MAI_Cleaver(int i); void __fastcall MAI_Cleaver(int i);
void __fastcall MAI_Round(int i, BOOL special); void __fastcall MAI_Round(int i, BOOL special);
void __fastcall MAI_GoatMc(int i); void __fastcall MAI_GoatMc(int i);
void __fastcall MAI_Ranged(int i, int missile_type, unsigned char special); void __fastcall MAI_Ranged(int i, int missile_type, BOOL special);
void __fastcall MAI_GoatBow(int i); void __fastcall MAI_GoatBow(int i);
void __fastcall MAI_Succ(int i); void __fastcall MAI_Succ(int i);
void __fastcall MAI_AcidUniq(int i); void __fastcall MAI_AcidUniq(int i);

Loading…
Cancel
Save