Mercurial > mm7
changeset 1065:e86b4951da70
Merge
author | Gloval |
---|---|
date | Fri, 24 May 2013 08:17:05 +0400 |
parents | 655fde266d96 (current diff) 89422dd58318 (diff) |
children | 938af16d5b88 |
files | mm7_2.cpp |
diffstat | 8 files changed, 674 insertions(+), 494 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Fri May 24 08:16:36 2013 +0400 +++ b/Actor.cpp Fri May 24 08:17:05 2013 +0400 @@ -293,7 +293,7 @@ } //----- (00404AC7) -------------------------------------------------------- -void __fastcall Actor::SpellAttack(unsigned int uActorID, AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel) +void __fastcall Actor::AI_SpellAttack(unsigned int uActorID, AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel) { Actor *v5; // esi@1 unsigned int v6; // edi@1 @@ -1398,7 +1398,7 @@ } //----- (00404874) -------------------------------------------------------- -char __fastcall Actor::RangedAttack(unsigned int uActorID, AIDirection *a2, int a3, char a4) +char __fastcall Actor::AI_RangedAttack(unsigned int uActorID, AIDirection *a2, int a3, char a4) { AIDirection *v4; // edi@1 Actor *v5; // esi@1 @@ -1890,7 +1890,7 @@ } //----- (00404030) -------------------------------------------------------- -void Actor::FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) +void Actor::AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) { unsigned int v4; // edi@1 unsigned int v5; // esi@1 @@ -1981,7 +1981,7 @@ } //----- (00403C6C) -------------------------------------------------------- -void Actor::MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0) +void Actor::AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0) { Actor *v3; // ebx@1 char v4; // zf@1 @@ -2077,7 +2077,7 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v24, sTargetPid, rand() % 2, 64, arg0); + Actor::AI_Pursue1(v24, sTargetPid, rand() % 2, 64, arg0); } //----- (00438CF3) -------------------------------------------------------- @@ -2383,7 +2383,7 @@ } //----- (00403A60) -------------------------------------------------------- -void Actor::SpellAttack2(unsigned int uActorID, signed int edx0, AIDirection *pDir) +void Actor::AI_SpellAttack2(unsigned int uActorID, signed int edx0, AIDirection *pDir) { Actor *v3; // ebx@1 AIDirection *v4; // esi@3 @@ -2485,11 +2485,11 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v22, a2, v22, 64, pDir); + Actor::AI_Pursue1(v22, a2, v22, 64, pDir); } //----- (00403854) -------------------------------------------------------- -void Actor::SpellAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) +void Actor::AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) { Actor *v3; // ebx@1 AIDirection *v4; // esi@3 @@ -2591,11 +2591,11 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v22, sTargetPid, v22, 64, pDir); + Actor::AI_Pursue1(v22, sTargetPid, v22, 64, pDir); } //----- (0040368B) -------------------------------------------------------- -void Actor::MissileAttack2(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) +void Actor::AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) { Actor *v3; // ebx@1 AIDirection *v4; // esi@3 @@ -2682,11 +2682,11 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v21, sTargetPid, v21, 64, pDir); + Actor::AI_Pursue1(v21, sTargetPid, v21, 64, pDir); } //----- (00403476) -------------------------------------------------------- -void Actor::MissileAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) +void Actor::AI_MissileAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) { Actor *v3; // ebx@1 int v4; // esi@3 @@ -2786,11 +2786,11 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v21, sTargetPid, v21, 64, pDir); + Actor::AI_Pursue1(v21, sTargetPid, v21, 64, pDir); } //----- (004032B2) -------------------------------------------------------- -void Actor::_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength) +void Actor::AI_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength) { unsigned int v4; // edi@1 Actor *v5; // esi@1 @@ -2926,7 +2926,7 @@ } //----- (004030AD) -------------------------------------------------------- -void Actor::Stun(unsigned int uActorID, signed int edx0, int arg0) +void Actor::AI_Stun(unsigned int uActorID, signed int edx0, int arg0) { unsigned int v3; // edi@1 Actor *v4; // ebx@1 @@ -2980,7 +2980,7 @@ { unsigned int v7; // eax@3 unsigned int v9; // eax@3 - + assert(uActorID < uNumActors); auto actor = pActors + uActorID; @@ -3148,7 +3148,7 @@ } //----- (00402AD7) -------------------------------------------------------- -void Actor::Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) +void Actor::AI_Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) { unsigned int v5; // edi@1 int v6; // eax@1 @@ -3221,7 +3221,7 @@ } //----- (00402968) -------------------------------------------------------- -void Actor::Flee(unsigned int uActorID, signed int sTargetPid, int uActionLength, AIDirection *a4) +void Actor::AI_Flee(unsigned int uActorID, signed int sTargetPid, int uActionLength, AIDirection *a4) { unsigned int v4; // esi@1 Actor *v5; // ebx@1 @@ -3282,7 +3282,7 @@ } //----- (0040281C) -------------------------------------------------------- -void Actor::Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) +void Actor::AI_Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) { unsigned int v5; // edi@1 int v6; // eax@1 @@ -3365,7 +3365,7 @@ } //----- (00402686) -------------------------------------------------------- -void Actor::Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) +void Actor::AI_Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) { //unsigned int v4; // edi@1 int v5; // eax@1
--- a/Actor.h Fri May 24 08:16:36 2013 +0400 +++ b/Actor.h Fri May 24 08:17:05 2013 +0400 @@ -191,30 +191,30 @@ static void _SelectTarget(unsigned int uActorID, int *a2, bool can_target_party); - static void Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4); - static void Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5); - static void Flee(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4); - static void Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir); + static void AI_Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4); + static void AI_Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5); + static void AI_Flee(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4); + static void AI_Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir); static void PlaySound(unsigned int uActorID, unsigned int uSoundID); static void Die(unsigned int uActorID); static void Resurrect(unsigned int uActorID); static void AI_Bored(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4); - static void Stun(unsigned int uActorID, signed int edx0, int arg0); + static void AI_Stun(unsigned int uActorID, signed int edx0, int arg0); static char __fastcall _4031C1_update_job(unsigned int uActorID, signed int a2, int a3); - static void _4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength); - static void MissileAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); - static void MissileAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); - static void SpellAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); - static void SpellAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); - static void MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0); + static void AI_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength); + static void AI_MissileAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); + static void AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); + static void AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); + static void AI_SpellAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); + static void AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0); static void __fastcall StandAwhile(unsigned int uActorID); static void AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, struct AIDirection *a4); static void AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4); - static void FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, struct AIDirection *a4); + static void AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, struct AIDirection *a4); static struct AIDirection *__fastcall GetDirectionInfo(unsigned int uObj1ID, unsigned int uObj2ID, struct AIDirection *pOut, int a4); static signed int __fastcall Explode(unsigned int uActorID); - static char __fastcall RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4); - static void __fastcall SpellAttack(unsigned int uActorID, struct AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel); + static char __fastcall AI_RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4); + static void __fastcall AI_SpellAttack(unsigned int uActorID, struct AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel); static void AggroSurroundingPeasants(unsigned int uActorID, int a2); static bool ArePeasantsOfSameFaction(Actor *a1, Actor *a2); static bool StealFrom(unsigned int uActorID);
--- a/Indoor.cpp Fri May 24 08:16:36 2013 +0400 +++ b/Indoor.cpp Fri May 24 08:17:05 2013 +0400 @@ -4208,7 +4208,7 @@ } v36 = stru_721530.uFaceID; LABEL_118: - Actor::FaceObject(v63, v36, v22, (AIDirection *)v22); + Actor::AI_FaceObject(v63, v36, v22, (AIDirection *)v22); goto LABEL_119; } if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 2 || pTurnEngine->field_4 == 3) ) @@ -4225,7 +4225,7 @@ if ( !pActors[v37].pMonsterInfo.uHostilityType ) goto LABEL_118; LABEL_114: - Actor::Flee(v63, v36, v22, (AIDirection *)v22); + Actor::AI_Flee(v63, v36, v22, (AIDirection *)v22); goto LABEL_119; } }
--- a/Party.cpp Fri May 24 08:16:36 2013 +0400 +++ b/Party.cpp Fri May 24 08:17:05 2013 +0400 @@ -854,7 +854,7 @@ v2 = abs(v0->vPosition.y - pParty->vPosition.y); v3 = abs(v0->vPosition.z - pParty->vPosition.z); if (int_get_vector_length(v1, v2, v3) < 512) - Actor::Flee(v4, 4, 0, 0); + Actor::AI_Flee(v4, 4, 0, 0); } ++v4; ++v0;
--- a/mm7_1.cpp Fri May 24 08:16:36 2013 +0400 +++ b/mm7_1.cpp Fri May 24 08:17:05 2013 +0400 @@ -1069,7 +1069,7 @@ if ( !v17->CanAct() ) return; v18 = a2.y; - Actor::FaceObject(a2.y, 4u, 0, 0); + Actor::AI_FaceObject(a2.y, 4u, 0, 0); if ( !v17->sNPC_ID ) { v19 = pNPCStats->pGroups_copy[v17->uGroup];
--- a/mm7_2.cpp Fri May 24 08:16:36 2013 +0400 +++ b/mm7_2.cpp Fri May 24 08:17:05 2013 +0400 @@ -6815,7 +6815,13 @@ case 101: // Quit game case 40001: - SendMessageA(::hWnd, WM_DESTROY, 0, 0); + { + v38 = 0; + v37 = 0; + v36 = 2; + v35 = ::hWnd; + SendMessageA(::hWnd, WM_DESTROY, v37, v38); + } return 0; @@ -7186,46 +7192,45 @@ { if ( pVideoPlayer->pVideoFrame.pPixels ) pVideoPlayer->bStopBeforeSchedule = 1; - if ( wParam == VK_RETURN ) - { - if ( !viewparams->field_4C ) - UI_OnKeyDown(wParam); - return 0; - } - if ( wParam == VK_CONTROL ) - { - dword_507B98_ctrl_pressed = 1; - return 0; - } - if ( wParam == VK_ESCAPE ) - { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); - return 0; - } - if ( wParam <= VK_HOME ) - return 0; - if ( wParam > VK_DOWN ) - { - if ( wParam != VK_F4 || pVideoPlayer->AnyMovieLoaded() ) + if ( wParam != VK_RETURN ) + { + if ( wParam == VK_CONTROL ) + { + dword_507B98_ctrl_pressed = 1; + return 0; + } + if ( wParam == VK_ESCAPE ) + { + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); + return 0; + } + if ( wParam <= VK_HOME ) return 0; - SendMessageA(hWnd, WM_COMMAND, 104, 0); - return 0; - } - if ( wParam >= VK_LEFT && wParam <= VK_DOWN ) - { - if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) - { - if ( !viewparams->field_4C ) - UI_OnKeyDown(wParam); + if ( wParam > VK_DOWN ) + { + if ( wParam != VK_F4 || pVideoPlayer->AnyMovieLoaded() ) + return 0; + v38 = 0; + v37 = 104; +//LABEL_126: + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - } - if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) - return 0; + if ( pCurrentScreen != SCREEN_GAME + && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) + return 0; + } + if ( !viewparams->field_4C ) + UI_OnKeyDown(wParam); + return 0; } pArcomageGame->stru1.field_0 = 1; if ( (unsigned __int16)GetAsyncKeyState(VK_SHIFT) >> 8 >= 0 ) + { v27 = MapVirtualKeyA((unsigned __int16)wParam, 2u); + } else { v13 = (unsigned __int16)MapVirtualKeyA((unsigned __int16)wParam, 2u); @@ -7233,7 +7238,8 @@ { if ( v13 > 61 ) { - if ( v13 == 91 ) + v24 = v13 - 91; + if ( !v24 ) { LOBYTE(pArcomageGame->stru1.field_8) = 123; //goto LABEL_181; @@ -7253,10 +7259,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 92 ) + v25 = v24 - 1; + if ( !v25 ) { LOBYTE(pArcomageGame->stru1.field_8) = 124; //goto LABEL_181; @@ -7276,10 +7288,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 93 ) + v26 = v25 - 1; + if ( !v26 ) { LOBYTE(pArcomageGame->stru1.field_8) = 125; //goto LABEL_181; @@ -7299,10 +7317,15 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 96 ) + if ( v26 == 3 ) { LOBYTE(pArcomageGame->stru1.field_8) = 126; //goto LABEL_181; @@ -7322,7 +7345,12 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } } @@ -7348,10 +7376,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 55 ) + v21 = v13 - 55; + if ( !v21 ) { LOBYTE(pArcomageGame->stru1.field_8) = 38; //goto LABEL_181; @@ -7371,10 +7405,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 56 ) + v22 = v21 - 1; + if ( !v22 ) { LOBYTE(pArcomageGame->stru1.field_8) = 42; //goto LABEL_181; @@ -7394,10 +7434,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 57 ) + v23 = v22 - 1; + if ( !v23 ) { LOBYTE(pArcomageGame->stru1.field_8) = 40; //goto LABEL_181; @@ -7417,10 +7463,15 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 59 ) + if ( v23 == 2 ) { LOBYTE(pArcomageGame->stru1.field_8) = 58; //goto LABEL_181; @@ -7440,7 +7491,12 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } } @@ -7467,12 +7523,18 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } if ( v13 > 49 ) { - if ( v13 == 50 ) + v18 = v13 - 50; + if ( !v18 ) { LOBYTE(pArcomageGame->stru1.field_8) = 64; //goto LABEL_181; @@ -7492,10 +7554,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 51 ) + v19 = v18 - 1; + if ( !v19 ) { LOBYTE(pArcomageGame->stru1.field_8) = 35; //goto LABEL_181; @@ -7515,10 +7583,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 52 ) + v20 = v19 - 1; + if ( !v20 ) { LOBYTE(pArcomageGame->stru1.field_8) = 36; //goto LABEL_181; @@ -7538,10 +7612,15 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 53 ) + if ( v20 == 1 ) { LOBYTE(pArcomageGame->stru1.field_8) = 37; //goto LABEL_181; @@ -7561,7 +7640,12 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } } @@ -7587,10 +7671,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 39 ) + v14 = v13 - 39; + if ( !v14 ) { LOBYTE(pArcomageGame->stru1.field_8) = 34; //goto LABEL_181; @@ -7610,10 +7700,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 44 ) + v15 = v14 - 5; + if ( !v15 ) { LOBYTE(pArcomageGame->stru1.field_8) = 60; //goto LABEL_181; @@ -7633,10 +7729,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 46 ) + v16 = v15 - 2; + if ( !v16 ) { LOBYTE(pArcomageGame->stru1.field_8) = 62; //goto LABEL_181; @@ -7656,10 +7758,16 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 47 ) + v17 = v16 - 1; + if ( !v17 ) { LOBYTE(pArcomageGame->stru1.field_8) = 63; //goto LABEL_181; @@ -7679,10 +7787,15 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( v13 == 48 ) + if ( v17 == 1 ) { LOBYTE(pArcomageGame->stru1.field_8) = 41; //LABEL_181: @@ -7702,7 +7815,12 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } } @@ -7727,7 +7845,12 @@ //goto _def_wnd_proc; return DefWindowProcA(hWnd, Msg, wParam, lParam); } - SendMessageA(hWnd, WM_COMMAND, 103, 0); + v38 = 0; + v37 = 103; + //goto LABEL_126; + v36 = 273; + v35 = hWnd; + SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } if ( Msg == WM_ACTIVATEAPP ) @@ -8917,7 +9040,7 @@ switch ( uTurnSpeed ) { case 0: // undefined turn option - __debugbreak(); // really shouldn't use this mode + //__debugbreak(); // really shouldn't use this mode uTurnSpeed = (unsigned int)uCPUSpeed < 199 ? 128 : 64; // adjust turn speed to estimated fps break; @@ -10473,7 +10596,7 @@ { if ( !v13->GetActorsRelation(0) && !(BYTE2(v13->uAttributes) & 8) && v13->CanAct() ) { - Actor::FaceObject(v12, 4u, 0, 0); + Actor::AI_FaceObject(v12, 4u, 0, 0); if ( v13->sNPC_ID ) { pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v12, 0);
--- a/mm7_3.cpp Fri May 24 08:16:36 2013 +0400 +++ b/mm7_3.cpp Fri May 24 08:17:05 2013 +0400 @@ -1178,7 +1178,7 @@ { if ( v71 == 0 ) { - Actor::Flee(v75, v38, 0, (AIDirection *)0); + Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); } else { @@ -1191,11 +1191,11 @@ } else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) { - Actor::Flee(v75, v38, 0, (AIDirection *)0); + Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); } else { - Actor::FaceObject(v75, v38, 0, (AIDirection *)0); + Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); } } break; @@ -1203,7 +1203,7 @@ if ( !v0->GetActorsRelation(0) ) { v38 = stru_721530.uFaceID; - Actor::FaceObject(v75, v38, 0, (AIDirection *)0); + Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); break; } //v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; @@ -2230,7 +2230,9 @@ v1 = 0; v103 = 0; v2 = 0; - *(float *)&v128 = 0.0; + //*(float *)&v128 = 0.0; + v128 = 0; + v129 = 0; pX = pParty->vPosition.x; pY = pParty->vPosition.y; v113 = pParty->field_6F0; @@ -2648,14 +2650,14 @@ } } -LABEL_123: +//LABEL_123: pParty->sRotationY = _angle_y; pParty->sRotationX = _angle_x; - if ( pZ < v111 ) + if ( pZ < v111 || pParty->bFlying) { if ( pParty->bFlying ) { -LABEL_130: +//LABEL_130: v31 = GetTickCount(); v126 = stru_5C6E00->Cos(v31); v129 = (unsigned __int64)(4i64 * v126) >> 16; @@ -2665,60 +2667,61 @@ if (pParty->FlyActive()) stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu; pParty->uFallStartY = pZ; - goto LABEL_141; - } - if ( v130 && v121 ) - sub_42F960_create_object(pX, pY, v111); - v121 = 0; - pZ = v111; - pParty->uFallStartY = v111; - } - if ( pParty->bFlying ) - goto LABEL_130; - v113 = pZ; - if (pParty->FlyActive()) - stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u; - -LABEL_141: + //goto LABEL_141; + } + else + { + if ( v130 && v121 ) + sub_42F960_create_object(pX, pY, v111); + v121 = 0; + pZ = v111; + pParty->uFallStartY = v111; + v113 = pZ; + if (pParty->FlyActive()) + stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u; + + } + } + else + { + v113 = pZ; + if (pParty->FlyActive()) + stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u; + } +//LABEL_141: if (bJumping && !pParty->bFlying) { v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); v34 = v121 + 2 * v33; v121 += 2 * v33; - goto LABEL_164; - } - if (!partyAtHighSlope) + } + else if (!partyAtHighSlope) { v34 = v121; - if (!bJumping) - goto LABEL_150; - goto LABEL_164; - } - if (!bJumping) - { - if ( v108 ) - goto LABEL_150; - - // rolling down the hill - // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air - // and falling to the gravity, gradually sliding downwards. nice trick - pZ = v111; - ODM_GetTerrainNormalAt(pX, pY, &v98); - v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); - v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; - v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; - v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; - v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); - v128 = v1; - v121 = v34; - if (!bJumping) - goto LABEL_150; - goto LABEL_164; - } - v34 = v121; - -LABEL_164: - if ( !bUnderwater && v34 <= 0) + } + else if (!bJumping) + { + if ( !v108 ) + { + // rolling down the hill + // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air + // and falling to the gravity, gradually sliding downwards. nice trick + pZ = v111; + ODM_GetTerrainNormalAt(pX, pY, &v98); + v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); + v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; + v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; + v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; + v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); + v128 = v1; + v121 = v34; + } + } + else + v34 = v121; + +//LABEL_164: + if ( !bUnderwater && v34 <= 0 && bJumping) { if ( v34 < -500 && !pParty->bFlying @@ -2735,7 +2738,7 @@ } else { -LABEL_150: +//LABEL_150: pParty->uFallStartY = pZ; } @@ -2801,27 +2804,37 @@ v43 = 1; v44 = 1; if ( bUnderwater || !v107 ) - goto LABEL_197; - if ( v127 && v129 > pZ ) - v44 = 0; - if ( v118 && v119 > pZ ) - v43 = 0; - if ( v44 ) - goto LABEL_197; - if ( v43 ) - goto LABEL_198; - v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); - if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ ) - { - v43 = 1; -LABEL_197: - pX = _angle_x; - if ( !v43 ) - goto LABEL_199; -LABEL_198: - pY = _angle_y; - } -LABEL_199: + { + pX = _angle_x; + if ( v43 ) + pY = _angle_y; + } + else + { + if ( v127 && v129 > pZ ) + v44 = 0; + if ( v118 && v119 > pZ ) + v43 = 0; + if ( v44 ) + { + pX = _angle_x; + if ( v43 ) + pY = _angle_y; + } + else if ( v43 ) + pY = _angle_y; + else + { + v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); + if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ ) + { + v43 = 1; + pX = _angle_x; + if ( v43 ) + pY = _angle_y; + } + } + } if ( stru_721530.field_7C >= stru_721530.field_6C ) { if ( !v107 ) @@ -2843,8 +2856,14 @@ pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); viewparams->bRedrawGameUI = 1; - goto LABEL_234; - } + v2 = (unsigned __int64)(58500i64 * v2) >> 16; + v127 = (BSPModel *)58500; + v128 = (unsigned __int64)(58500i64 * v128) >> 16; + v122 = (unsigned __int64)(58500i64 * v121) >> 16; + ++v126; + v121 = (unsigned __int64)(58500i64 * v121) >> 16; + continue; + } if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) { v56 = integer_sqrt(v2 * v2 + v128 * v128); @@ -2884,15 +2903,26 @@ v53 = v47->uPolygonType; if ( v53 == 3 ) { - if ( v121 < 0 ) - v121 = 0; - pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1; - if ( v2 * v2 + v128 * v128 < 400 ) - { - v2 = 0; - *(float *)&v128 = 0.0; - } - goto LABEL_221; + if ( v121 < 0 ) + v121 = 0; + pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1; + if ( v2 * v2 + v128 * v128 < 400 ) + { + v2 = 0; + *(float *)&v128 = 0.0; + } + if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) + { + pParty->floor_face_pid = v45; + v103 = v47->sCogTriggeredID; + } + v2 = (unsigned __int64)(58500i64 * v2) >> 16; + v127 = (BSPModel *)58500; + v128 = (unsigned __int64)(58500i64 * v128) >> 16; + v122 = (unsigned __int64)(58500i64 * v121) >> 16; + ++v126; + v121 = (unsigned __int64)(58500i64 * v121) >> 16; + continue; } if ( !v129 && (v53 != 4 || v119) ) { @@ -2925,15 +2955,20 @@ if ( !v119 ) pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16); } -LABEL_220: - v45 = stru_721530.uFaceID; -LABEL_221: - if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) - { - pParty->floor_face_pid = v45; - v103 = v47->sCogTriggeredID; - } - goto LABEL_234; +//LABEL_220: + v45 = stru_721530.uFaceID; + if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) + { + pParty->floor_face_pid = v45; + v103 = v47->sCogTriggeredID; + } + v2 = (unsigned __int64)(58500i64 * v2) >> 16; + v127 = (BSPModel *)58500; + v128 = (unsigned __int64)(58500i64 * v128) >> 16; + v122 = (unsigned __int64)(58500i64 * v121) >> 16; + ++v126; + v121 = (unsigned __int64)(58500i64 * v121) >> 16; + continue; } v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16; if ( stru_721530.field_64 >> 3 > v118 ) @@ -2948,13 +2983,27 @@ v2 += v122; v128 += (int)v127; if ( v2 * v2 + v128 * v128 >= 400 ) - goto LABEL_220; + { + v45 = stru_721530.uFaceID; + if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) + { + pParty->floor_face_pid = v45; + v103 = v47->sCogTriggeredID; + } + v2 = (unsigned __int64)(58500i64 * v2) >> 16; + v127 = (BSPModel *)58500; + v128 = (unsigned __int64)(58500i64 * v128) >> 16; + v122 = (unsigned __int64)(58500i64 * v121) >> 16; + ++v126; + v121 = (unsigned __int64)(58500i64 * v121) >> 16; + continue; + } v2 = 0; v121 = 0; *(float *)&v128 = 0.0; } } -LABEL_234: +//LABEL_234: v2 = (unsigned __int64)(58500i64 * v2) >> 16; v127 = (BSPModel *)58500; v128 = (unsigned __int64)(58500i64 * v128) >> 16; @@ -2969,54 +3018,71 @@ v126 = abs(pParty->vPosition.y - pY); v62 = abs(pParty->vPosition.z - pZ); if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 ) - goto LABEL_344; - if ( v114 && (!bJumping || v101) ) - { - if ( !v107 - && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) ) - { + { + pAudioPlayer->_4AA258(804); + pParty->walk_sound_timer = 64; + } + else + { + if ( v114 && (!bJumping || v101) ) + { + if ( !v107 + && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) ) + { - v90 = -1; - v89 = 1; - v88 = 804; - v87 = 64; - goto LABEL_257; - } - - v90 = -1; - v89 = 1; - v88 = 804; - v86 = 1; -LABEL_255: - v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; - v64 = WorldPosToGridCellX(pParty->vPosition.x); - v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86); - goto LABEL_257; - } - if ( v124 && (!bJumping || v101) ) - { - if ( v107 - || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 ) - { + v90 = -1; + v89 = 1; + v88 = 804; + v87 = 64; + pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); + } + else + { + v90 = -1; + v89 = 1; + v88 = 804; + v86 = 1; + //LABEL_255: + v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; + v64 = WorldPosToGridCellX(pParty->vPosition.x); + v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86); + pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); + } + } + else + { + if ( v124 && (!bJumping || v101) ) + { + if ( v107 + || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 ) + { - v90 = -1; - v89 = 1; - v88 = 804; - v86 = 0; - goto LABEL_255; - } - v90 = -1; - v89 = 1; - v88 = 804; - v87 = 103; -LABEL_257: - pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); - } - else - { -LABEL_344: - pAudioPlayer->_4AA258(804); - pParty->walk_sound_timer = 64; + v90 = -1; + v89 = 1; + v88 = 804; + v86 = 0; + v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; + v64 = WorldPosToGridCellX(pParty->vPosition.x); + v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86); + pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); + } + else + { + v90 = -1; + v89 = 1; + v88 = 804; + v87 = 103; + //LABEL_257: + pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); + } + } + else + { + //LABEL_344: + pAudioPlayer->_4AA258(804); + pParty->walk_sound_timer = 64; + } + } } } if ( !bJumping || v101 ) @@ -3113,24 +3179,26 @@ if ( v127 ) { v78 = v69 != 0; - goto LABEL_306; - } - v114 = 1; - } - v78 = 1; -LABEL_306: + } + else + { + v114 = 1; + v78 = 1; + } + } + else + v78 = 1; +//LABEL_306: if ( v77 ) { pParty->vPosition.x = pX; - if ( !v78 ) - goto LABEL_313; - goto LABEL_312; } if ( v78 ) { -LABEL_312: pParty->vPosition.y = pY; -LABEL_313: + } + if ( v78 || v77) + { if ( bWaterWalk ) { pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; @@ -3148,14 +3216,13 @@ } } } - goto LABEL_318; - } - if ( bWalkSound && pParty->walk_sound_timer <= 0 ) + } + else if ( bWalkSound && pParty->walk_sound_timer <= 0 ) { pAudioPlayer->_4AA258(804); pParty->walk_sound_timer = 64; } -LABEL_318: +//LABEL_318: v81 = pZ; v82 = pZ; pParty->vPosition.z = pZ; @@ -14385,15 +14452,15 @@ { //unsigned int v0; // esi@4 int v1; // eax@7 - int v2; // ecx@7 - int v3; // eax@7 + //int v2; // ecx@7 + //int v3; // eax@7 signed int v4; // edi@10 Actor *v5; // esi@12 - signed int v6; // eax@14 + signed int sDmg; // eax@14 __int16 v7; // cx@14 - Player **v8; // esi@20 + //Player **v8; // esi@20 Player *pPlayer; // ecx@21 - //Actor *pActor; // esi@34 + Actor *pActor; // esi@34 //__int16 v11; // ax@34 //unsigned int v12; // eax@47 //signed int v13; // edi@47 @@ -14404,7 +14471,7 @@ //unsigned int v18; // ecx@67 //unsigned __int16 v19; // ax@72 //int *v20; // esi@80 - Actor *v21; // ebx@80 + //Actor *v21; // ebx@80 unsigned __int16 v22; // ax@86 //signed int v23; // eax@94 //unsigned int v24; // eax@102 @@ -14487,58 +14554,48 @@ else { pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); - v1 = rand(); - v2 = 128; - v3 = pParty->sRotationX + v1 % 16 - 8; - pParty->sRotationX = v3; - if ( v3 > 128 || (v2 = -128, v3 < -128) ) - pParty->sRotationX = v2; + pParty->sRotationX = pParty->sRotationX + rand() % 16 - 8; + if ( pParty->sRotationX > 128) + pParty->sRotationX = 128; + else if ( pParty->sRotationX < -128 ) + pParty->sRotationX = -128; + pParty->uFlags |= 2u; pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; v4 = pParty->field_16140 + 50; if ( pParty->armageddon_timer <= 0 ) { pParty->armageddon_timer = 0; - v84 = 0; - if ( (signed int)uNumActors > 0 ) + for(int i = 0; i < uNumActors; i++) { - v5 = pActors;//[0].sCurrentHP; - do + pActor=&pActors[i]; + if ( pActor->CanAct() ) { - if ( v5->CanAct() ) + sDmg = stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); + pActor->sCurrentHP -= stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); + if ( sDmg ) { - v6 = stru_50C198.CalcMagicalDamageToActor(v5, 5, v4); - v7 = v5->sCurrentHP - v6; - v5->sCurrentHP = v7; - if ( v6 ) + if ( pActor->sCurrentHP >= 0 ) { - if ( v7 >= 0 ) - { - Actor::Stun(v84, 4, 0); - } - else - { - Actor::Die(v84); - if ( v5->pMonsterInfo.uExp ) - GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); - } + Actor::AI_Stun(i, 4, 0); + } + else + { + Actor::Die(i); + if ( pActor->pMonsterInfo.uExp ) + GivePartyExp(pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uExp); } } - ++v84; - ++v5; } - while ( (signed int)v84 < (signed int)uNumActors ); + ++v84; + ++v5; } - v8 = &pPlayers[1]; - do + for(int i = 1; i <= 4; i++) { - pPlayer = *v8; - if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) + pPlayer = pPlayers[i]; + if ( !pPlayer->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) pPlayer->ReceiveDamage(v4, DMGT_5); - ++v8; } - while ( (signed int)v8 <= (signed int)&pPlayers[4] ); - //v0 = 0; } if (pTurnEngine->field_1C) --pTurnEngine->field_1C; @@ -14555,7 +14612,7 @@ //uActorID = v0; for (uint i = 0; i < uNumActors; ++i) { - auto actor = pActors + i; + pActor = &pActors[i]; //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState //do //{ @@ -14563,10 +14620,10 @@ //v11 = *(unsigned int *)LODWORD(v80); //v49 = *(unsigned int *)LODWORD(v80) == 5; ai_near_actors_targets_pid[i] = OBJECT_Player; - if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400) + if (pActor->uAIState == Dead || pActor->uAIState == Removed || pActor->uAIState == Disabled || pActor->uAttributes & 0x0400) continue; - if (!actor->sCurrentHP && actor->uAIState != Dying) + if (!pActor->sCurrentHP && pActor->uAIState != Dying) Actor::Die(i); //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; @@ -14577,7 +14634,7 @@ for (uint j = 0; j < 22; ++j) { if (j != 10) - actor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); + pActor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); } /*do { @@ -14590,52 +14647,52 @@ ++v14; } while ( v13 < 22 );*/ - if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) + if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) - actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; - if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) - actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; + if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) + pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; // not sure - else if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) - actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; + else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) + pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; - if ((signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 - || (signed __int64)actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) + if ((signed __int64)pActor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 + || (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) continue; //v15 = pMiscTimer->uTimeElapsed; //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; //v17 = pActor->uCurrentActionTime; //v18 = pActor->pMonsterInfo.uRecoveryTime; - if (actor->pMonsterInfo.uRecoveryTime) + if (pActor->pMonsterInfo.uRecoveryTime) { - if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) - actor->pMonsterInfo.uRecoveryTime = 0; + if (pActor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) + pActor->pMonsterInfo.uRecoveryTime = 0; else - actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; + pActor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; } - actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; - if (actor->uCurrentActionTime < actor->uCurrentActionLength) + pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; + if (pActor->uCurrentActionTime < pActor->uCurrentActionLength) continue; //v19 = actor->uAIState; - if (actor->uAIState == Dying) - actor->uAIState = Dead; + if (pActor->uAIState == Dying) + pActor->uAIState = Dead; else { - if (actor->uAIState != Summoned) + if (pActor->uAIState != Summoned) { Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); continue; } - actor->uAIState = Standing; + pActor->uAIState = Standing; } - actor->uCurrentActionTime = 0; - actor->uCurrentActionLength = 0; - actor->UpdateAnimation(); + pActor->uCurrentActionTime = 0; + pActor->uCurrentActionLength = 0; + pActor->UpdateAnimation(); //LABEL_78: //++uActorID; //LODWORD(v80) += 836; @@ -14655,61 +14712,61 @@ assert(actor_id < uNumActors); //v20 = &ai_near_actors_targets_pid[actor_id]; - v21 = &pActors[actor_id]; + pActor = &pActors[actor_id]; Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); - if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) - v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + if (pActor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) + pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; target_pid = ai_near_actors_targets_pid[actor_id]; target_pid_type = PID_TYPE(target_pid); if ( target_pid_type == OBJECT_Actor) v80 = 0.5; else v80 = 1.0; - v22 = v21->uAIState; + v22 = pActor->uAIState; if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) { continue; } - if ( !v21->sCurrentHP ) + if ( !pActor->sCurrentHP ) Actor::Die(actor_id); for(int i=0;i<22;i++) { if ( i != 10 ) { - v21->pActorBuffs[i]._4585CA(pParty->uTimePlayed); + pActor->pActorBuffs[i]._4585CA(pParty->uTimePlayed); } } - if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) - v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; - if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) - v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) + pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; + if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) + pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; // not sure - else if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) - v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; - if ( (signed __int64)v21->pActorBuffs[2].uExpireTime < 0 ) + else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) + pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; + if ( (signed __int64)pActor->pActorBuffs[2].uExpireTime < 0 ) { - v21->uAIState = Removed; + pActor->uAIState = Removed; continue; } - if ( (signed __int64)v21->pActorBuffs[5].uExpireTime > 0 - || (signed __int64)v21->pActorBuffs[6].uExpireTime > 0) + if ( (signed __int64)pActor->pActorBuffs[5].uExpireTime > 0 + || (signed __int64)pActor->pActorBuffs[6].uExpireTime > 0) { continue; } v27 = pMiscTimer->uTimeElapsed; - v28 = v21->pMonsterInfo.uRecoveryTime; - v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; + v28 = pActor->pMonsterInfo.uRecoveryTime; + pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; if ( (signed int)v28 > 0 ) - v21->pMonsterInfo.uRecoveryTime = v28 - v27; - if ( v21->pMonsterInfo.uRecoveryTime < 0 ) - v21->pMonsterInfo.uRecoveryTime = 0; - if ( !(v21->uAttributes & 0x8000) ) - v21->uAttributes |= 0x8000; + pActor->pMonsterInfo.uRecoveryTime = v28 - v27; + if ( pActor->pMonsterInfo.uRecoveryTime < 0 ) + pActor->pMonsterInfo.uRecoveryTime = 0; + if ( !(pActor->uAttributes & 0x8000) ) + pActor->uAttributes |= 0x8000; a1 = PID(OBJECT_Actor,actor_id); v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0); memcpy(&v75, v30, sizeof(v75)); memcpy(&pDir, &v75, sizeof(pDir)); - uAIState = v21->uAIState; + uAIState = pActor->uAIState; /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 && v80 * 307.2 >= (double)(signed int)v75.uDistance @@ -14720,60 +14777,60 @@ } else */ - if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly - || (signed int)v21->pMonsterInfo.uRecoveryTime > 0 + if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly + || (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 || v80 * 307.2 < (double)(signed int)v75.uDistance || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting - && !v21->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) + && !pActor->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) { - if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) + if ( (signed int)pActor->uCurrentActionTime < pActor->uCurrentActionLength ) { continue; } - else if ( v21->uAIState == AttackingMelee ) + else if ( pActor->uAIState == AttackingMelee ) { - v35 = stru_50C198.special_ability_use_check(v21, actor_id); + v35 = stru_50C198.special_ability_use_check(pActor, actor_id); stru_50FE08.Add( a1, 5120, - v21->vPosition.x, - v21->vPosition.y, - v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), + pActor->vPosition.x, + pActor->vPosition.y, + pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1), v35, 1 ); } - else if ( v21->uAIState == AttackingRanged1 ) + else if ( pActor->uAIState == AttackingRanged1 ) { - v34 = v21->pMonsterInfo.uMissleAttack1Type; - Actor::RangedAttack(actor_id, &pDir, v34, 0); + v34 = pActor->pMonsterInfo.uMissleAttack1Type; + Actor::AI_RangedAttack(actor_id, &pDir, v34, 0); } - else if ( v21->uAIState == AttackingRanged2 ) + else if ( pActor->uAIState == AttackingRanged2 ) { - v34 = v21->pMonsterInfo.uMissleAttack2Type; - Actor::RangedAttack(actor_id, &pDir, v34, 1); + v34 = pActor->pMonsterInfo.uMissleAttack2Type; + Actor::AI_RangedAttack(actor_id, &pDir, v34, 1); } - else if ( v21->uAIState == AttackingRanged3 ) + else if ( pActor->uAIState == AttackingRanged3 ) { - v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; - v33 = v21->pMonsterInfo.uSpell1ID; - Actor::SpellAttack(actor_id, &pDir, v33, 2, v65); + v65 = pActor->pMonsterInfo.uSpellSkillAndMastery1; + v33 = pActor->pMonsterInfo.uSpell1ID; + Actor::AI_SpellAttack(actor_id, &pDir, v33, 2, v65); } - else if ( v21->uAIState == AttackingRanged4 ) + else if ( pActor->uAIState == AttackingRanged4 ) { - v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; - v33 = v21->pMonsterInfo.uSpell2ID; - Actor::SpellAttack(actor_id, &pDir, v33, 3, v65); + v65 = pActor->pMonsterInfo.uSpellSkillAndMastery2; + v33 = pActor->pMonsterInfo.uSpell2ID; + Actor::AI_SpellAttack(actor_id, &pDir, v33, 3, v65); } } v36 = v75.uDistance; - if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) + if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) { if ( target_pid_type == OBJECT_Actor ) { v36 = v75.uDistance; - v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] + v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (pActor->pMonsterInfo.uID - 1) / 3] + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); } else @@ -14800,85 +14857,85 @@ v38 = 5120; } if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) - v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } - if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) + if ( (signed __int64)pActor->pActorBuffs[4].uExpireTime > 0 ) { if ( (signed int)v36 >= 10240 ) { - Actor::_4032B2(actor_id, target_pid, 1024, 0); + Actor::AI_4032B2(actor_id, target_pid, 1024, 0); } else { //peasents after attacked //guard after attacked - Actor::Flee(actor_id, target_pid, 0, &pDir); + Actor::AI_Flee(actor_id, target_pid, 0, &pDir); } continue; } - if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) + if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) { - if ( v21->pMonsterInfo.uAIType == 1 ) + if ( pActor->pMonsterInfo.uAIType == 1 ) { - if ( v21->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == 5 ) { - Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); + Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); } else { - Actor::Flee(actor_id, target_pid, 0, &pDir); + Actor::AI_Flee(actor_id, target_pid, 0, &pDir); continue; } } - if ( !(v21->uAttributes & 0x020000) ) + if ( !(pActor->uAttributes & 0x020000) ) { - if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3) + if ( pActor->pMonsterInfo.uAIType == 2 || pActor->pMonsterInfo.uAIType == 3) { - if ( v21->pMonsterInfo.uAIType == 2 ) - v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; - if ( v21->pMonsterInfo.uAIType == 3 ) - v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; - v84 = v21->sCurrentHP; + if ( pActor->pMonsterInfo.uAIType == 2 ) + v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.2; + if ( pActor->pMonsterInfo.uAIType == 3 ) + v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.1; + v84 = pActor->sCurrentHP; v42 = (double)(signed int)v84; if ( v43 > v42 && (signed int)v36 < 10240 ) { - Actor::Flee(actor_id, target_pid, 0, &pDir); + Actor::AI_Flee(actor_id, target_pid, 0, &pDir); continue; } } } - v81 = v36 - v21->uActorRadius; + v81 = v36 - pActor->uActorRadius; if ( target_pid_type == OBJECT_Actor ) v81 -= pActors[PID_ID(target_pid)].uActorRadius; if ( v81 < 0 ) v81 = 0; rand(); - v21->uAttributes &= 0xFBFFFF; + pActor->uAttributes &= 0xFBFFFF; if ( v81 < 5120 ) { - v45 = stru_50C198.special_ability_use_check(v21, actor_id); + v45 = stru_50C198.special_ability_use_check(pActor, actor_id); if ( v45 == 0 ) { - if ( v21->pMonsterInfo.uMissleAttack1Type ) + if ( pActor->pMonsterInfo.uMissleAttack1Type ) { - if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) + if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) { - Actor::MissileAttack1(actor_id, target_pid, &pDir); + Actor::AI_MissileAttack1(actor_id, target_pid, &pDir); } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; if ( v80 * 307.2 > (double)v81 ) { v64 = (signed __int64)v47; @@ -14886,7 +14943,7 @@ } else { - Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); + Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); } } } @@ -14896,21 +14953,21 @@ { if ( v81 >= 1024 ) { - if ( v21->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { //monsters - Actor::Pursue3(actor_id, target_pid, 0, &pDir); + Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir); } } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } @@ -14920,19 +14977,19 @@ //monsters //guard after player runs away // follow player - Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); + Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); } } - else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { //monsters - Actor::MeleeAttack(actor_id, target_pid, &pDir); + Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); } } continue; @@ -14940,28 +14997,28 @@ else if ( v45 == 2 || v45 == 3 ) { if ( v45 == 2 ) - v46 = v21->pMonsterInfo.uSpell1ID; + v46 = pActor->pMonsterInfo.uSpell1ID; else - v46 = v21->pMonsterInfo.uSpell2ID; + v46 = pActor->pMonsterInfo.uSpell2ID; if ( v46 ) { - if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) + if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) { if ( v45 == 2 ) - Actor::SpellAttack1(actor_id, target_pid, &pDir); + Actor::AI_SpellAttack1(actor_id, target_pid, &pDir); else - Actor::SpellAttack2(actor_id, target_pid, &pDir); + Actor::AI_SpellAttack2(actor_id, target_pid, &pDir); } - else if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) + else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; + Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); } } else @@ -14970,130 +15027,130 @@ { if ( v81 >= 1024 ) { - if ( v21->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::Pursue3(actor_id, target_pid, 256, &pDir); + Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); } } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { v70 = (signed __int64)v80 * 307.2; - Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); + Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); } } - else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::MeleeAttack(actor_id, target_pid, &pDir); + Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); } } continue; } } } - - if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) + + if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) { - if ( !v21->pMonsterInfo.uMovementType ) + if ( !pActor->pMonsterInfo.uMovementType ) { - Actor::_4032B2(actor_id, 4, 1024, 0); + Actor::AI_4032B2(actor_id, 4, 1024, 0); } - else if ( v21->pMonsterInfo.uMovementType == 1 ) + else if ( pActor->pMonsterInfo.uMovementType == 1 ) { - Actor::_4032B2(actor_id, 4, 2560, 0); + Actor::AI_4032B2(actor_id, 4, 2560, 0); } - else if ( v21->pMonsterInfo.uMovementType == 2 ) + else if ( pActor->pMonsterInfo.uMovementType == 2 ) { - Actor::_4032B2(actor_id, 4, 5120, 0); + Actor::AI_4032B2(actor_id, 4, 5120, 0); } - else if ( v21->pMonsterInfo.uMovementType == 4 ) + else if ( pActor->pMonsterInfo.uMovementType == 4 ) { - Actor::_4032B2(actor_id, 4, 10240, 0); + Actor::AI_4032B2(actor_id, 4, 10240, 0); } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); - v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; memcpy(&v74, v57, sizeof(v74)); memcpy(&pDir, &v74, sizeof(pDir)); v64 = (signed __int64)v58; Actor::AI_Stand(actor_id, 4, v64, &pDir); } } - else if ( !v21->pMonsterInfo.uMissleAttack2Type ) + else if ( !pActor->pMonsterInfo.uMissleAttack2Type ) { if ( (double)v81 >= v80 * 307.2 ) { if ( v81 >= 1024 ) { - if ( v21->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::Pursue3(actor_id, target_pid, 256, &pDir); + Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); } } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { v70 = (signed __int64)v80 * 307.2; - Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); + Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); } } - else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::MeleeAttack(actor_id, target_pid, &pDir); + Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); } } - else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; + if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) { v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); + Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); } } else { - Actor::MissileAttack2(actor_id, target_pid, &pDir); - } + Actor::AI_MissileAttack2(actor_id, target_pid, &pDir); + } } } }
--- a/mm7_5.cpp Fri May 24 08:16:36 2013 +0400 +++ b/mm7_5.cpp Fri May 24 08:17:05 2013 +0400 @@ -4672,7 +4672,7 @@ } if ( pMonster->sCurrentHP > 0 ) { - Actor::Stun(uActorID_Monster_, a1, 0); + Actor::AI_Stun(uActorID_Monster_, a1, 0); Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); if ( bShowDamage ) { @@ -5007,7 +5007,7 @@ { if ( v7->sCurrentHP >= 1 ) { - Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); + Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); Actor::AggroSurroundingPeasants(uActorID, 1); } else @@ -5193,7 +5193,7 @@ { if ( v44->sCurrentHP >= 1 ) { - Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); + Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); Actor::AggroSurroundingPeasants(uActorID, 1); } else @@ -5459,7 +5459,7 @@ if ( v7 ) { if ( pActor->sCurrentHP > 0 ) - Actor::Stun(uActorIDa, a2, 0); + Actor::AI_Stun(uActorIDa, a2, 0); else Actor::Die(uActorIDa); a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; @@ -5478,7 +5478,7 @@ } else { - Actor::Stun(uActorIDa, a2, 0); + Actor::AI_Stun(uActorIDa, a2, 0); } } } @@ -5567,7 +5567,7 @@ if ( v14 ) { if ( v7->sCurrentHP > 0 ) - Actor::Stun(uActorID, v17, 0); + Actor::AI_Stun(uActorID, v17, 0); else Actor::Die(uActorID); Actor::AggroSurroundingPeasants(uActorID, 0); @@ -5587,7 +5587,7 @@ } else { - Actor::Stun(uActorID, v17, 0); + Actor::AI_Stun(uActorID, v17, 0); } return; } @@ -6884,7 +6884,7 @@ v22 = 2; v17 = v5->pMonsterInfo.uSpell1ID; } - Actor::SpellAttack(v4, &a4, v17, v22, v24); + Actor::AI_SpellAttack(v4, &a4, v17, v22, v24); LABEL_25: v16 = a2a; v23 = &a4; @@ -6900,7 +6900,7 @@ v18 = v5->pMonsterInfo.uMissleAttack1Type; v25 = 0; } - Actor::RangedAttack(v4, &a4, v18, v25); + Actor::AI_RangedAttack(v4, &a4, v18, v25); goto LABEL_25; } } @@ -7015,7 +7015,7 @@ { if ( v5->pMonsterInfo.uMissleAttack2Type ) { - Actor::MissileAttack2(v13, v22, &v18); + Actor::AI_MissileAttack2(v13, v22, &v18); goto LABEL_43; } } @@ -7030,16 +7030,16 @@ if ( v15 ) { if ( v14 == 2 ) - Actor::SpellAttack1(v13, v22, &v18); + Actor::AI_SpellAttack1(v13, v22, &v18); else - Actor::SpellAttack2(v13, v22, &v18); + Actor::AI_SpellAttack2(v13, v22, &v18); goto LABEL_43; } goto LABEL_44; } if ( v5->pMonsterInfo.uMissleAttack1Type ) { - Actor::MissileAttack1(v13, v22, &v18); + Actor::AI_MissileAttack1(v13, v22, &v18); LABEL_43: //v3 = v21; v21->field_C = 1; @@ -7052,7 +7052,7 @@ LABEL_44: if ( (double)(signed int)v20 < 307.2 ) { - Actor::MeleeAttack(v13, v22, &v18); + Actor::AI_MeleeAttack(v13, v22, &v18); //v3 = v21; v21->field_C = 3; goto LABEL_48; @@ -7331,12 +7331,12 @@ { if ( (signed int)v11 < 10240 ) { - Actor::Flee(uActorID, a2a, 0, &pDir); + Actor::AI_Flee(uActorID, a2a, 0, &pDir); v29->field_C = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; } - Actor::_4032B2(uActorID, a2a, 1024, 0); + Actor::AI_4032B2(uActorID, a2a, 1024, 0); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7354,7 +7354,7 @@ v29->uActionLength = actor->uCurrentActionLength; return 1; } - Actor::Flee(uActorID, a2a, 32, 0); + Actor::AI_Flee(uActorID, a2a, 32, 0); v29->field_C = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7373,7 +7373,7 @@ v29->uActionLength = actor->uCurrentActionLength; return 1; } - Actor::Flee(uActorID, a2a, 32, 0); + Actor::AI_Flee(uActorID, a2a, 32, 0); v29->field_C = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7394,7 +7394,7 @@ v29->uActionLength = actor->uCurrentActionLength; return 1; } - Actor::Flee(uActorID, a2a, 32, 0); + Actor::AI_Flee(uActorID, a2a, 32, 0); v29->field_C = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7408,9 +7408,9 @@ if ( (signed int)v11 < 5120 ) { if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) - Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir); + Actor::AI_Pursue1(uActorID, a2a, uActorID, 32, &pDir); else - Actor::Pursue2(uActorID, a2a, 32, &pDir, 307); + Actor::AI_Pursue2(uActorID, a2a, 32, &pDir, 307); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7418,28 +7418,28 @@ LABEL_46: if ( !actor->pMonsterInfo.uMovementType ) { - Actor::_4032B2(uActorID, a2a, 1024, 32); + Actor::AI_4032B2(uActorID, a2a, 1024, 32); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; } if ( actor->pMonsterInfo.uMovementType == 1 ) { - Actor::_4032B2(uActorID, a2a, 2560, 32); + Actor::AI_4032B2(uActorID, a2a, 2560, 32); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; } if ( actor->pMonsterInfo.uMovementType == 2 ) { - Actor::_4032B2(uActorID, a2a, 5120, 32); + Actor::AI_4032B2(uActorID, a2a, 5120, 32); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; } if ( actor->pMonsterInfo.uMovementType == 4 ) { - Actor::_4032B2(uActorID, a2a, 10240, 32); + Actor::AI_4032B2(uActorID, a2a, 10240, 32); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1;