Mercurial > mm7
changeset 1172:d5dae0b4b98a
Слияние
author | Ritor1 |
---|---|
date | Fri, 24 May 2013 10:53:46 +0600 |
parents | 28ee6610a3d2 (current diff) 938af16d5b88 (diff) |
children | 0158f383b492 |
files | Vis.cpp |
diffstat | 26 files changed, 969 insertions(+), 829 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Fri May 24 10:53:33 2013 +0600 +++ b/Actor.cpp Fri May 24 10:53:46 2013 +0600 @@ -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 @@ -3156,14 +3156,14 @@ unsigned int v8; // ecx@1 char v9; // zf@1 AIDirection *v10; // esi@6 - int v12; // ecx@19 - unsigned int v13; // eax@19 + //int v12; // ecx@19 + //unsigned int v13; // eax@19 AIDirection a3; // [sp+Ch] [bp-5Ch]@7 - AIDirection v15; // [sp+28h] [bp-40h]@7 + //AIDirection v15; // [sp+28h] [bp-40h]@7 AIDirection v16; // [sp+44h] [bp-24h]@7 - unsigned int v17; // [sp+60h] [bp-8h]@1 + //unsigned int v17; // [sp+60h] [bp-8h]@1 unsigned int v18; // [sp+64h] [bp-4h]@1 - int v19; // [sp+70h] [bp+8h]@19 + //int v19; // [sp+70h] [bp+8h]@19 v5 = uActorID; v6 = 0; @@ -3171,7 +3171,6 @@ v18 = a2; v8 = PID(OBJECT_Actor,uActorID); v9 = v7->pMonsterInfo.uFlying == 0; - v17 = v5; if ( !v9 && !pParty->bFlying ) { if ( v7->pMonsterInfo.uMissleAttack1Type ) @@ -3179,12 +3178,11 @@ else v6 = pParty->uPartyHeight; } + v10 = pDir; if ( !pDir ) { - memcpy(&v15, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v15)); - memcpy(&v16, &v15, sizeof(v16)); - v5 = v17; + memcpy(&v16, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v16)); v10 = &v16; } if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) @@ -3209,16 +3207,10 @@ v18 = 16; if ( arg0 % 2 ) v18 = -16; - v12 = ((unsigned __int64)(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle) * (signed __int64)v10->uDistanceXZ) >> 16) - + pParty->vPosition.x; - v13 = stru_5C6E00->uIntegerPi + v10->uYawAngle; - v17 = v12; - v19 = stru_5C6E00->Sin(v18 + v13); + v7->uYawAngle = stru_5C6E00->Atan2( - v17 - v7->vPosition.x, - pParty->vPosition.y - + ((unsigned __int64)(v19 * (signed __int64)v10->uDistanceXZ) >> 16) - - v7->vPosition.y); + pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, + pParty->vPosition.y + fixpoint_sub0(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); if ( uActionLength ) v7->uCurrentActionLength = uActionLength; else @@ -3229,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 @@ -3290,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 @@ -3373,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 10:53:33 2013 +0600 +++ b/Actor.h Fri May 24 10:53:46 2013 +0600 @@ -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/Chest.cpp Fri May 24 10:53:33 2013 +0600 +++ b/Chest.cpp Fri May 24 10:53:46 2013 +0600 @@ -66,10 +66,10 @@ char *v26; // edx@29 unsigned __int16 v27; // ax@32 //SpriteObject a1; // [sp+14h] [bp-B0h]@28 - int v29; // [sp+84h] [bp-40h]@16 - int v30; // [sp+88h] [bp-3Ch]@16 - int v31; // [sp+8Ch] [bp-38h]@16 - int v32; // [sp+90h] [bp-34h]@16 + int v29[4]; // [sp+84h] [bp-40h]@16 + //int v30; // [sp+88h] [bp-3Ch]@16 + //int v31; // [sp+8Ch] [bp-38h]@16 + //int v32; // [sp+90h] [bp-34h]@16 float v33; // [sp+94h] [bp-30h]@23 //char *v34; // [sp+98h] [bp-2Ch]@5 int v35; // [sp+9Ch] [bp-28h]@16 @@ -105,10 +105,10 @@ goto LABEL_12; if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[v2].LockX5 ) { - v29 = 811; - v30 = 812; - v31 = 813; - v32 = 814; + v29[0] = 811; + v29[1] = 812; + v29[2] = 813; + v29[3] = 814; v5 = rand() % 4; v6 = PID_ID(EvtTargetObj); v35 = v5;
--- a/Events.cpp Fri May 24 10:53:33 2013 +0600 +++ b/Events.cpp Fri May 24 10:53:46 2013 +0600 @@ -6,6 +6,7 @@ #include "MapInfo.h" #include "Game.h" +#include "Outdoor.h" #include "GUIWindow.h" #include "GUIProgressBar.h" #include "Chest.h" @@ -24,6 +25,7 @@ #include "Events.h" #include "Events2D.h" #include "UIHouses.h" +#include "Log.h" #include "MM7.h" @@ -56,7 +58,7 @@ //----- (00443CE1) -------------------------------------------------------- unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize) - { +{ FILE *pLodFile; // eax@1 unsigned int uTextureSize; // esi@3 char Args[60]; // [sp+8h] [bp-B4h]@6 @@ -109,6 +111,7 @@ pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; pGlobalEVT_Index[events_count].uEventOffsetInEVT=offset_in; offset_in+=current_hdr->evt_size+1; + current_hdr=(raw_event_header *)&pGlobalEVT[offset_in]; } uGlobalEVT_NumEvents = events_count; @@ -117,6 +120,7 @@ } + //----- (00443EF8) -------------------------------------------------------- void LoadLevel_InitializeLevelEvt() { @@ -148,25 +152,132 @@ pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; pLevelEVT_Index[events_count].uEventOffsetInEVT=offset_in; offset_in+=current_hdr->evt_size+1; + current_hdr=(raw_event_header *)&pLevelEVT[offset_in]; } uLevelEVT_NumEvents = events_count; /* - for (uint i = 0, j = 0; j < uLevelEVT_Size; ++i) +EmeraldIsle::Variables: +[0] ??? +[1] ??? +[2] Luck Fountain uses left +[3] Gold Fountain used this week +[4] Gold Fountain total uses + + +Emerald Isle #110 // Fire Resistance fountain +0 LocationName +0 if (Player.FireResistance < 50) + { +1 Set(Player.FireResistance, 50) +2 SetFooterString(22) // +50 Fire Resistance (temporarily) +3 Add(Party.Autonotes, 2) +4 goto return + } +5 SetFooterString(11) // Refreshing! +6 return + + + +Emerald Isle #111 // ??? + Initialize + Set(Map.Variables[0], 30) + Set(Map.Variables[1], 30) + + +Emerald Isle #114 // month timer - manage luck fountain +0 LocationName +0 if (Player.BaseLuck >= 15) + { +2 SetFooterString(11) // Refreshing! +3 return + } + else { - pLevelEVT_Index[i].uEventID = pLevelEVT[j + 1] + ((unsigned short)pLevelEVT[j + 2] << 8); - pLevelEVT_Index[i].event_sequence_num = pLevelEVT[j + 3]; - pLevelEVT_Index[i].uEventOffsetInEVT = j; - j += pLevelEVT[j] + 1; - uLevelEVT_NumEvents++; - }*/ +1 if (Map.Variables[2] >= 1) + { +4 Sub(Map.Variables[2], 1) +5 Add(Player.BaseLuck, 2) +6 SetFooterString(25) // +2 Luck (Permament) +7 return + } + else + { +2 SetFooterString(11) // Refreshing! +3 return + } + } + +8 Initialize +9 Set Map.Variables[2], 8 + + + +Emerald Isle #115 // week timer - gold fountain in the center of town +0 LocationName +0 if (Map.Variables[4] < 3) + { +1 if (Map.Variables[3] == 0) + { +2 if (Party.Gold < 201) + { +3 if (Player.BaseLuck >= 15) + { +5 Add(Map.Variables[3], 1) +6 Add(Party.Gold, 1000) +7 Add(Map.Variables[4], 1) +8 goto return + } + else + { +4 goto 9 + } + } + } + } +9 SetFooterString(11) // Refreshing! +10 return + +11 Initialize +12 Set(Map.Variables[3], 0) + + + + + +Emerald Isle #220 // day timer - monster spawner +0 LocationName +0 Initialize +1 if (NumAliveActors(group=20) != 0) +2 return +3 SpawnMonsters(1, level=1, count=10, x=-336, y=14512, z=0, group=20) +4 SpawnMonsters(1, level=2, count=5, x=16, y=16352, z=90, group=20) +5 SpawnMonsters(1, level=1, count=10, x=480, y=18288, z=6, group=20) + + + +Emerald Isle #200 // margareth dock tip +0 if (!QBits.QuestDone[17]) + { +1 InitiateNPCDialogue(npc=19) + } +2 return + + +Emerald Isle #201 // margareth armoury tip +0 if (!QBits.QuestDone[17]) + { +1 InitiateNPCDialogue(npc=20) + } +2 return +*/ } //----- (0044684A) -------------------------------------------------------- -void EventProcessor(int uEventID, int targetObj, int canShowMessages) - { +void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line) +{ unsigned int v3; // eax@5 signed int v4; // esi@7 //char *v5; // eax@8 @@ -320,7 +431,8 @@ return; } player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 - curr_seq_num = start_event_seq_number; + curr_seq_num = entry_line; + if ( activeLevelDecoration ) { uSomeEVT_NumEvents = uGlobalEVT_NumEvents; @@ -356,11 +468,11 @@ case EVENT_CheckSeason: // if ( !sub_4465DF_check_season(_evt->v5) ) - { + { ++curr_seq_num; v4 = v124; break; - } + } v124 = -1; curr_seq_num = _evt->v6 - 1; ++curr_seq_num; @@ -980,13 +1092,17 @@ pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); } v83 = EVT_WORD(_evt->v5); - if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) - viewparams->bRedrawGameUI = 1; + if (v83 == 21 || // gold well on emerald isle + v83 == 22 || v83 == 23 || v83 == 24 ) + { + __debugbreak(); // find out what these decorations are + viewparams->bRedrawGameUI = true; + } ++curr_seq_num; v4 = v124; break; case EVENT_InputString: - if ( !start_event_seq_number ) + if ( !entry_line ) { strcpy(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); v105 = curr_seq_num;
--- a/Events.h Fri May 24 10:53:33 2013 +0600 +++ b/Events.h Fri May 24 10:53:46 2013 +0600 @@ -99,7 +99,7 @@ EVENT_ForPartyMember = 0x23, EVENT_Jmp = 0x24, EVENT_OnMapReload = 0x25, - EVENT_OnLongTimer = 0x26, + EVENT_Initialize = 0x26, EVENT_SetNPCTopic = 0x27, EVENT_MoveNPC = 0x28, EVENT_GiveItem = 0x29, @@ -256,7 +256,12 @@ VAR_Stoned = 0x78, VAR_Eradicated = 0x79, VAR_MajorCondition = 0x7A, - VAR_MapPersistentVariable_0 = 0x7B, + VAR_MapPersistentVariable_0 = 123, + VAR_MapPersistentVariable_1 = 124, + VAR_MapPersistentVariable_2 = 125, + VAR_MapPersistentVariable_3 = 126, + VAR_MapPersistentVariable_4 = 127, + VAR_MapPersistentVariable_5 = 0x80, VAR_NPCs = 0xD6, VAR_Reputation = 0xD7, VAR_ActiveSpells = 0xDE, @@ -321,9 +326,9 @@ unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize); -void Initialize_GlobalEVT(); -void LoadLevel_InitializeLevelEvt(); -void EventProcessor(int uEventID, int a2, int a3); +void Initialize_GlobalEVT(); +void LoadLevel_InitializeLevelEvt(); +void EventProcessor(int uEventID, int a2, int a3, int entry_line = 0);
--- a/Game.cpp Fri May 24 10:53:33 2013 +0600 +++ b/Game.cpp Fri May 24 10:53:46 2013 +0600 @@ -265,7 +265,7 @@ //Render *v2; // edi@7 //signed int v3; // esi@7 signed int pNewNPCsCount; // ecx@58 - char *pFlags; // eax@59 + NPCData *pNPC; // eax@59 Player *pPlayer; // esi@65 //OtherOverlay *pOtherOverlay; // esi@67 //signed int v8; // edi@67 @@ -442,13 +442,13 @@ pNewNPCsCount = 0; if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) { - pFlags = (char *)&pNPCStats->pNewNPCData[0].uFlags; + pNPC = pNPCStats->pNewNPCData; do { - if ( *((int *)pFlags + 6) ) - *pFlags &= 0x7Fu; + if ( pNPC->field_24 ) + pNPC->uFlags &= 0xFFFFFF7Fu; ++pNewNPCsCount; - pFlags += 76; + ++pNPC; } while ( pNewNPCsCount < (signed int)pNPCStats->uNumNewNPCs ); }
--- a/Indoor.cpp Fri May 24 10:53:33 2013 +0600 +++ b/Indoor.cpp Fri May 24 10:53:46 2013 +0600 @@ -1734,15 +1734,12 @@ //----- (004488F7) -------------------------------------------------------- void IndoorLocation::ToggleLight(signed int sLightID, unsigned int bToggle) { - char *v2; // eax@4 - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (sLightID <= pIndoor->uNumLights - 1) && (sLightID >= 0) ) { - v2 = (char *)&pIndoor->pLights[sLightID].uAtributes; if ( bToggle ) - *v2 &= 0xF7u; + pIndoor->pLights[sLightID].uAtributes &= 0xFFFFFFF7u; else - *v2 |= 8u; + pIndoor->pLights[sLightID].uAtributes |= 8u; pParty->uFlags |= 2u; } } @@ -4208,7 +4205,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 +4222,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/Indoor.h Fri May 24 10:53:33 2013 +0600 +++ b/Indoor.h Fri May 24 10:53:46 2013 +0600 @@ -264,6 +264,7 @@ #define FACE_CLICKABLE 0x02000000 // Event can be triggered by clicking on the facet. #define FACE_PRESSURE_PLATE 0x04000000 // Event can be triggered by stepping on the facet. #define FACE_ETHEREAL 0x20000000 // Untouchable. You can pass through it. +#define FACE_PICKED 0x80000000 /* 93 */ #pragma pack(push, 1)
--- a/Outdoor.cpp Fri May 24 10:53:33 2013 +0600 +++ b/Outdoor.cpp Fri May 24 10:53:46 2013 +0600 @@ -2249,7 +2249,7 @@ if (face.HasEventHint()) face.uAttributes |= 0x1000u; else - face.uAttributes &= 0xEFFFu; + face.uAttributes &= 0xFFFFEFFFu; } //++thisa; //v89 = pBModels;
--- a/Outdoor.h Fri May 24 10:53:33 2013 +0600 +++ b/Outdoor.h Fri May 24 10:53:46 2013 +0600 @@ -3,6 +3,7 @@ #include "Indoor.h" #include "TileFrameTable.h" #include "Weather.h" +#include "BSPModel.h" #define DAY_ATTRIB_FOG 1 @@ -195,7 +196,7 @@ unsigned int uNumBModels; struct OutdoorLocationTerrain pTerrain; void *pCmap; - struct BSPModel *pBModels; + BSPModel *pBModels; unsigned int numFaceIDListElems; unsigned __int16 *pFaceIDLIST; unsigned int *pOMAP;
--- a/Party.cpp Fri May 24 10:53:33 2013 +0600 +++ b/Party.cpp Fri May 24 10:53:46 2013 +0600 @@ -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/Party.h Fri May 24 10:53:33 2013 +0600 +++ b/Party.h Fri May 24 10:53:46 2013 +0600 @@ -6,7 +6,7 @@ - +#define PARTY_AUTONOTES_BIT__EMERALD_FIRE_FOUNTAIN 2 enum PARTY_QUEST_BITS: unsigned __int32 { @@ -17,6 +17,8 @@ PARTY_QUEST_EMERALD_LUTE_ACTIVE = 5, PARTY_QUEST_EMERALD_HAT_ACTIVE = 6, + PARTY_QUEST_EMERALD_MARGARETH_OFF = 17, + PARTY_QUEST_EVENMORN_MAP_FOUND = 64, PARTY_QUEST_FINISHED_EMERALD_ISLE = 136, PARTY_QUEST_FOUNTAIN_HARMONDALE = 206,
--- a/Player.cpp Fri May 24 10:53:33 2013 +0600 +++ b/Player.cpp Fri May 24 10:53:46 2013 +0600 @@ -5221,8 +5221,8 @@ if ((v28 < 0) || v28 > 2 ) return v5 + v62 + v61; } - v15 = pItemsTable->pItems[v29].uDamageMod; - v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; + v15 = pItemsTable->pItems[v23].uDamageMod; + v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; v5 += v15 + v14; return v5 + v62 + v61; } @@ -5407,43 +5407,38 @@ //----- (0048F882) -------------------------------------------------------- int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) { - signed int v2; // esi@1 - unsigned __int16 v3; // ax@126 - char result; // al@127 - unsigned int v5; // [sp-4h] [bp-14h]@13 - signed int v6; // [sp-4h] [bp-14h]@27 - //unsigned int v7; // [sp-4h] [bp-14h]@35 - CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 - //Player *v9; // [sp+Ch] [bp-4h]@1 + signed int bonus_value; // esi@1 + unsigned __int16 skill_value; // ax@126 + int result; // al@127 - v2 = 0; + bonus_value = 0; switch (uSkillType) { case PLAYER_SKILL_MONSTER_ID: { if ( CheckHiredNPCSpeciality(Hunter) ) - v2 = 6; + bonus_value = 6; if ( CheckHiredNPCSpeciality(Sage) ) - v2 += 6; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); + bonus_value += 6; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); } break; case PLAYER_SKILL_ARMSMASTER: { if ( CheckHiredNPCSpeciality(Armsmaster) ) - v2 = 2; + bonus_value = 2; if ( CheckHiredNPCSpeciality(Weaponsmaster) ) - v2 += 3; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); + bonus_value += 3; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); } break; case PLAYER_SKILL_STEALING: { if (CheckHiredNPCSpeciality(Burglar)) - v2 = 8; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); + bonus_value = 8; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); } break; @@ -5451,185 +5446,188 @@ case PLAYER_SKILL_ALCHEMY: { if ( CheckHiredNPCSpeciality(Herbalist) ) - v2 = 4; + bonus_value = 4; if ( CheckHiredNPCSpeciality(Apothecary) ) - v2 += 8; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); + bonus_value += 8; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); } break; case PLAYER_SKILL_LEARNING: { if ( CheckHiredNPCSpeciality(Teacher) ) - v2 = 10; + bonus_value = 10; if ( CheckHiredNPCSpeciality(Instructor) ) - v2 += 15; + bonus_value += 15; if ( CheckHiredNPCSpeciality(Scholar) ) - v2 += 5; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); + bonus_value += 5; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); } break; case PLAYER_SKILL_UNARMED: { if (CheckHiredNPCSpeciality(Monk) ) - v2 = 2; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); + bonus_value = 2; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); } break; case PLAYER_SKILL_DODGE: { if ( CheckHiredNPCSpeciality(Monk) ) - v2 = 2; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); + bonus_value = 2; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); } break; case PLAYER_SKILL_BOW: - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); break; case PLAYER_SKILL_SHIELD: - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); break; case PLAYER_SKILL_EARTH: if ( CheckHiredNPCSpeciality(Apprentice) ) - v2 = 2; + bonus_value = 2; if ( CheckHiredNPCSpeciality(Mystic) ) - v2 += 3; + bonus_value += 3; if ( CheckHiredNPCSpeciality(Spellmaster) ) - v2 += 4; + bonus_value += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) - v2 += 3; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); + bonus_value += 3; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); break; case PLAYER_SKILL_FIRE: if ( CheckHiredNPCSpeciality(Apprentice) ) - v2 = 2; + bonus_value = 2; if ( CheckHiredNPCSpeciality(Mystic) ) - v2 += 3; + bonus_value += 3; if ( CheckHiredNPCSpeciality(Spellmaster) ) - v2 += 4; + bonus_value += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) - v2 += 3; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); + bonus_value += 3; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); break; case PLAYER_SKILL_AIR: if ( CheckHiredNPCSpeciality(Apprentice) ) - v2 = 2; + bonus_value = 2; if ( CheckHiredNPCSpeciality(Mystic) ) - v2 += 3; + bonus_value += 3; if ( CheckHiredNPCSpeciality(Spellmaster) ) - v2 += 4; + bonus_value += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) - v2 += 3; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); + bonus_value += 3; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); break; case PLAYER_SKILL_WATER: if ( CheckHiredNPCSpeciality(Apprentice) ) - v2 = 2; + bonus_value = 2; if ( CheckHiredNPCSpeciality(Mystic) ) - v2 += 3; + bonus_value += 3; if ( CheckHiredNPCSpeciality(Spellmaster) ) - v2 += 4; + bonus_value += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) - v2 += 3; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); + bonus_value += 3; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); break; case PLAYER_SKILL_SPIRIT: if ( CheckHiredNPCSpeciality(Acolyte2) ) - v2 = 2; + bonus_value = 2; if ( CheckHiredNPCSpeciality(Initiate) ) - v2 += 3; + bonus_value += 3; if ( CheckHiredNPCSpeciality(Prelate) ) - v2 += 4; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); + bonus_value += 4; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); break; case PLAYER_SKILL_MIND: if ( CheckHiredNPCSpeciality(Acolyte2) ) - v2 = 2; + bonus_value = 2; if ( CheckHiredNPCSpeciality(Initiate) ) - v2 += 3; + bonus_value += 3; if ( CheckHiredNPCSpeciality(Prelate) ) - v2 += 4; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); + bonus_value += 4; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); break; case PLAYER_SKILL_BODY: if ( CheckHiredNPCSpeciality(Acolyte2) ) - v2 = 2; + bonus_value = 2; if ( CheckHiredNPCSpeciality(Initiate) ) - v2 += 3; + bonus_value += 3; if ( CheckHiredNPCSpeciality(Prelate) ) - v2 += 4; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); + bonus_value += 4; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); break; case PLAYER_SKILL_LIGHT: - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); break; case PLAYER_SKILL_DARK: { - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); } break; case PLAYER_SKILL_MERCHANT: { if ( CheckHiredNPCSpeciality(Trader) ) - v2 = 4; + bonus_value = 4; if ( CheckHiredNPCSpeciality(Merchant) ) - v2 += 6; + bonus_value += 6; if ( CheckHiredNPCSpeciality(Gypsy) ) - v2 += 3; + bonus_value += 3; if ( CheckHiredNPCSpeciality(Duper) ) - v2 += 8; + bonus_value += 8; } break; case PLAYER_SKILL_PERCEPTION: { if ( CheckHiredNPCSpeciality(Scout) ) - v2 = 6; + bonus_value = 6; if ( CheckHiredNPCSpeciality(Psychic) ) - v2 += 5; + bonus_value += 5; } break; case PLAYER_SKILL_ITEM_ID: - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); break; case PLAYER_SKILL_MEDITATION: - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); break; case PLAYER_SKILL_TRAP_DISARM: { if ( CheckHiredNPCSpeciality(Tinker) ) - v2 = 4; + bonus_value = 4; if ( CheckHiredNPCSpeciality(Locksmith) ) - v2 += 6; + bonus_value += 6; if ( CheckHiredNPCSpeciality(Burglar) ) - v2 += 8; - v2 += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); + bonus_value += 8; + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); } break; } - v3 = pActiveSkills[uSkillType]; - if ( v2 + (v3 & 0x3F) < 60 ) - result = v2 + v3; + skill_value = pActiveSkills[uSkillType]; + if ( bonus_value + (skill_value & 0x3F) < 60 ) + result = bonus_value + skill_value; else - result = v3 & 0xFFFC | 0x3C; //al + result = skill_value & 0xFFFC | 0x3C; //al return result; } //----- (0048FC00) -------------------------------------------------------- int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) { + + + Player *v2; // esi@1 - int v3; // eax@1 + int armmaster_skill; // eax@1 char v4; // di@1 signed int v5; // ebx@1 - unsigned int v6; // eax@2 + unsigned int armaster_mastery; // eax@2 unsigned __int8 v7; // sf@5 unsigned __int8 v8; // of@5 PlayerEquipment *v9; // ebx@19 @@ -5682,8 +5680,8 @@ unsigned int v57; // eax@118 int v58; // esi@121 signed int j; // ecx@121 - int v60; // edi@126 - int v61; // eax@126 + int base_value; // edi@126 + int attrib_modif; // eax@126 signed int v62; // [sp-4h] [bp-30h]@26 signed int v63; // [sp-4h] [bp-30h]@80 int v64; // [sp+Ch] [bp-20h]@104 @@ -5697,56 +5695,148 @@ int a1; // [sp+34h] [bp+8h]@21 int a1a; // [sp+34h] [bp+8h]@74 signed int a1b; // [sp+34h] [bp+8h]@94 + int multiplier; + int arm_bonus; + int lvl_avl[4]; v2 = this; v70 = 0; v69 = 0; + multiplier =0; + arm_bonus =0; v71 = (ITEM_EQUIP_TYPE)0; - LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); - v4 = v3; + armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); + v4 = armmaster_skill; v5 = 1; - if ( v3 ) - { - v6 = SkillToMastery(v3); + if ( armmaster_skill ) + { + armaster_mastery = SkillToMastery(armmaster_skill); if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) { - if ( (signed int)v6 >= 4 ) - goto LABEL_4; - v8 = __OFSUB__(v6, 3); - v7 = ((v6 - 3) & 0x80000000u) != 0; - } - else - { - if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) - goto LABEL_11; - if ( (signed int)v6 >= 4 ) - { -LABEL_4: - v71 = (ITEM_EQUIP_TYPE)2; -LABEL_11: - v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); - goto LABEL_12; - } - v8 = __OFSUB__(v6, 2); - v7 = ((v6 - 2) & 0x80000000u) != 0; - } - if ( !(v7 ^ v8) ) - v71 = (ITEM_EQUIP_TYPE)1; - goto LABEL_11; - } -LABEL_12: + if ( armaster_mastery == 4 ) + multiplier =2; + else if ( armaster_mastery == 3 ) + multiplier =1; + } + else if ( a2 == CHARACTER_ATTRIBUTE_ATTACK ) + { + if ( armaster_mastery == 4 ) + multiplier =2; + else if ( armaster_mastery >= 2 ) + multiplier =1; + } + arm_bonus=(armmaster_skill&0x3F)*multiplier; + } + + if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) { - v60 = pBaseHealthPerLevelByClass[v2->classType]; - v61 = v2->GetBodybuilding(); - return v60 * v61; + base_value = pBaseHealthPerLevelByClass[classType]; + attrib_modif = GetBodybuilding(); + return base_value * attrib_modif; } if ( a2 == CHARACTER_ATTRIBUTE_MANA ) { - v60 = pBaseManaPerLevelByClass[v2->classType]; - v61 = v2->GetMeditation(); - return v60 * v61; - } + base_value = pBaseManaPerLevelByClass[classType]; + attrib_modif = GetMeditation(); + return base_value * attrib_modif; + } + if ( a2 == CHARACTER_ATTRIBUTE_AC_BONUS ) + { + a1b = 0; + v71 = (ITEM_EQUIP_TYPE)0; + + for (j=0; j<16; ++j) + { + if (pEquipment.pIndices[j]&&(!pOwnItems[ pEquipment.pIndices[j]].Broken())) + { + int curr_item =pOwnItems[pEquipment.pIndices[j]].uItemID; + v44=pItemsTable->pItems[curr_item].uSkillType; + switch (v44) + { + + case PLAYER_SKILL_STAFF: + + lvl_avl[0]=0; + lvl_avl[1]=1; + lvl_avl[2]=0; + lvl_avl[3]=0; + break; + case PLAYER_SKILL_SWORD: + case PLAYER_SKILL_SPEAR: + lvl_avl[0]=0; + lvl_avl[1]=0; + lvl_avl[2]=0; + lvl_avl[3]=1; + break; + case PLAYER_SKILL_SHIELD: + a1b = 1; + lvl_avl[0]=1; + lvl_avl[1]=0; + lvl_avl[2]=1; + lvl_avl[3]=0; + break; + case PLAYER_SKILL_LEATHER: + v71 = (ITEM_EQUIP_TYPE)1; + lvl_avl[0]=1; + lvl_avl[1]=0; + lvl_avl[2]=1; + lvl_avl[3]=0; + + break; + case PLAYER_SKILL_CHAIN: + a1b = 1; + lvl_avl[0]=1; + lvl_avl[1]=0; + lvl_avl[2]=0; + lvl_avl[3]=0; + break; + case PLAYER_SKILL_PLATE: + a1b = 1; + lvl_avl[0]=1; + lvl_avl[1]=0; + lvl_avl[2]=0; + lvl_avl[3]=0; + break; + default: + continue; + } + + v50= GetActualSkillLevel((PLAYER_SKILL_TYPE)v44); + v51 = v50; + v52 = SkillToMastery(v50); + v53 = v51 & 0x3F; + for ( i = 0; i < (signed int)v52; ++i ) + { + if ( lvl_avl[i] ) + v70 += v53; + } + + } + } + + lvl_avl[0]=1; + lvl_avl[1]=1; + lvl_avl[2]=1; + lvl_avl[3]=0; + + v55 = GetActualSkillLevel(PLAYER_SKILL_DODGE); + v56 = v55; + v57 = SkillToMastery(v55); + if ( !a1b && (!v71 || v57 == 4) ) + { + v58 = v56 & 0x3F; + for ( j = 0; j < (signed int)v57; ++j ) + { + if ( lvl_avl[i] ) + v70 += v58; + } + } + return v70; + + + } + if ( a2 != 9 ) { if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) @@ -5906,7 +5996,7 @@ { if ( v2->HasItemEquipped(v35) ) { - v37 = *(int *)&v2->pInventoryItems[v35].uItemID; + v37 = v2->pInventoryItems[v35].uItemID; if ( pItemsTable->pItems[v37].uEquipType <= 1u ) break; } @@ -5972,99 +6062,7 @@ v30 = v68 + v71 * (a1a & 0x3F); return (int)((char *)v69 + v30); } - a1b = 0; - v71 = (ITEM_EQUIP_TYPE)0; - v68 = 16; - v69 = &v2->pEquipment; - do - { - if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) - goto LABEL_117; - v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; - v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; - if ( !v44 ) - { - v64 = 0; - v65 = 1; -LABEL_111: - v66 = 0; - goto LABEL_112; - } - v45 = v44 - 1; - if ( !v45 || (v46 = v45 - 3) == 0 ) - { - v64 = 0; - v65 = 0; - v66 = 0; - v67 = 1; - goto LABEL_113; - } - v47 = v46 - 4; - if ( v47 ) - { - v48 = v47 - 1; - if ( v48 ) - { - v49 = v48 - 1; - if ( v49 ) - { - if ( v49 != 1 ) - goto LABEL_117; - a1b = 1; - v64 = 1; - v65 = 0; - v66 = 0; - v67 = 0; - goto LABEL_113; - } - a1b = 1; - v64 = 1; - v65 = 0; - goto LABEL_111; - } - v71 = (ITEM_EQUIP_TYPE)1; - } - else - { - a1b = 1; - } - v64 = 1; - v65 = 0; - v66 = 1; -LABEL_112: - v67 = 0; -LABEL_113: - LOBYTE(v50) = v2->GetActualSkillLevel(v43); - v51 = v50; - v52 = SkillToMastery(v50); - v53 = v51 & 0x3F; - for ( i = 0; i < (signed int)v52; ++i ) - { - if ( *(&v64 + i) ) - v70 += v53; - } -LABEL_117: - v69 = (PlayerEquipment *)((char *)v69 + 4); - --v68; - } - while ( v68 ); - v64 = 1; - v65 = 1; - v66 = 1; - v67 = 0; - LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); - v56 = v55; - v57 = SkillToMastery(v55); - if ( !a1b && (!v71 || v57 == 4) ) - { - v58 = v56 & 0x3F; - for ( j = 0; j < (signed int)v57; ++j ) - { - if ( *(&v64 + j) ) - v70 += v58; - } - } - return v70; + } //----- (00490109) --------------------------------------------------------
--- a/SpriteObject.cpp Fri May 24 10:53:33 2013 +0600 +++ b/SpriteObject.cpp Fri May 24 10:53:46 2013 +0600 @@ -1095,7 +1095,7 @@ { if (pSpriteObjects[uLayingItemID].uAttributes & 4 ) { - pSpriteObjects[uLayingItemID].uAttributes &= 0xFB; + pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB; --pTurnEngine->field_1C; } }
--- a/UICharacter.cpp Fri May 24 10:53:33 2013 +0600 +++ b/UICharacter.cpp Fri May 24 10:53:46 2013 +0600 @@ -772,7 +772,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_MainHand4->uAttributes &= 0xFu; + item_MainHand4->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v17 = (double)GetTickCount() * 0.1; @@ -819,7 +819,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - itemBow->uAttributes &= 0xFu; + itemBow->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v28 = (double)GetTickCount() * 0.1; @@ -881,7 +881,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Cloak->uAttributes &= 0xFu; + item_Cloak->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v40 = (double)GetTickCount() * 0.1; @@ -949,7 +949,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Armor->uAttributes &= 0xFu; + item_Armor->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v52 = (double)GetTickCount() * 0.1; @@ -1005,7 +1005,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Armor->uAttributes &= 0xFu; + item_Armor->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v97 = (double)GetTickCount(); @@ -1050,7 +1050,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Armor->uAttributes &= 0xFu; + item_Armor->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v97 = (double)GetTickCount(); @@ -1114,7 +1114,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Boot->uAttributes &= 0xFu; + item_Boot->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v64 = (double)GetTickCount() * 0.1; @@ -1185,7 +1185,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Belt->uAttributes &= 0xFu; + item_Belt->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v78 = (double)GetTickCount() * 0.1; @@ -1260,7 +1260,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_CloakCollar->uAttributes &= 0xFu; + item_CloakCollar->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v118 = (double)GetTickCount() * 0.1; @@ -1324,7 +1324,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Helm->uAttributes &= 0xFu; + item_Helm->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v130 = (double)GetTickCount() * 0.1; @@ -1388,7 +1388,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_MainHand3->uAttributes &= 0xFu; + item_MainHand3->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v141 = (double)GetTickCount() * 0.1; @@ -1460,7 +1460,7 @@ if ( _50C9A8_item_enchantment_timer <= 0 ) { _50C9A8_item_enchantment_timer = 0; - item_Shield->uAttributes &= 0xFu; + item_Shield->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4 = 0; } v158 = (double)GetTickCount() * 0.1; @@ -1602,7 +1602,7 @@ if (_50C9A8_item_enchantment_timer <= 0) { _50C9A8_item_enchantment_timer = 0; - item->uAttributes &= 0xF; + item->uAttributes &= 0xFFFFFF0F; ptr_50C9A4 = 0; } pRenderer->_4A63E6(x, y, item_texture, enchantment_texture, GetTickCount() * 0.1, 0, 255);
--- a/UIHouses.cpp Fri May 24 10:53:33 2013 +0600 +++ b/UIHouses.cpp Fri May 24 10:53:46 2013 +0600 @@ -531,8 +531,7 @@ return 0; } } - if ( !start_event_seq_number ) - pAudioPlayer->StopChannels(-1, -1); + pAudioPlayer->StopChannels(-1, -1); uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType;
--- a/UIPartyCreation.cpp Fri May 24 10:53:33 2013 +0600 +++ b/UIPartyCreation.cpp Fri May 24 10:53:46 2013 +0600 @@ -657,10 +657,10 @@ } while ( uControlParamd < 9 ); - pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickOK, 0, 0xD, "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE), 0); - pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickReset, 0, 0x43, "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE2), 0); - pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickMinus, 0, 0x2D, "", pTexture_buttminu, 0); - pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickPlus, 1, 0x2B, "", pTexture_buttplus, 0); + pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickOK, 0, '\r', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE), 0); + pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickReset, 0, 'C', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE2), 0); + pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickMinus, 0, '-', "", pTexture_buttminu, 0); + pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickPlus, 1, '+', "", pTexture_buttplus, 0); pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); }
--- a/UiGame.cpp Fri May 24 10:53:33 2013 +0600 +++ b/UiGame.cpp Fri May 24 10:53:46 2013 +0600 @@ -2570,7 +2570,7 @@ LABEL_15: //v12 = &pIndoor->pFaces[pOutline->uFace1ID]; if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && - (pFace1->uAttributes & 0x2000000 || pFace2->uAttributes & 0x2000000) && + (pFace1->uAttributes & 0x2000 || pFace2->uAttributes & 0x2000) && (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID)) { if (uNumBlueFacesInBLVMinimap < 49)
--- a/Vis.cpp Fri May 24 10:53:33 2013 +0600 +++ b/Vis.cpp Fri May 24 10:53:46 2013 +0600 @@ -322,11 +322,12 @@ { if ( pFaceID < (signed int)pIndoor->uNumFaces ) { - if ( is_part_of_selection(&pIndoor->pFaces[pFaceID], filter) ) + auto face = pIndoor->pFaces + pFaceID; + if ( is_part_of_selection(face, filter) ) { - if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) ) + if ( !pGame->pIndoorCameraD3D->IsCulled(face) ) { - if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[pFaceID], 0xFFFFFFFFu) ) + if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, face, 0xFFFFFFFFu) ) { pGame->pIndoorCameraD3D->ViewTransform(&a1, 1); v9 = fixpoint_from_float(/*v8, */a1.vWorldViewPosition.x); @@ -345,6 +346,12 @@ } } } + + if (face->uAttributes & FACE_PICKED) + face->uAttributes |= FACE_OUTLINED; + else + face->uAttributes &= ~FACE_OUTLINED; + face->uAttributes &= ~FACE_PICKED; } } v5 = v17 + 1; @@ -385,10 +392,11 @@ list->AddObject(face, VisObjectType_Face, v13); } - if (blv_face.uAttributes & 0x80000000) + if (blv_face.uAttributes & FACE_PICKED) face->uAttributes |= FACE_OUTLINED; else face->uAttributes &= ~FACE_OUTLINED; + blv_face.uAttributes &= ~FACE_PICKED; } } } @@ -610,8 +618,6 @@ IntersectPoint.z < pFace->pBounding.z1 || IntersectPoint.z > pFace->pBounding.z2 ) return false; - pFace->uAttributes |= 0x80000000; - if (uModelID != -1) ODM_CreateIntersectFacesVertexCoordList(&a, &b, intersect_face_vertex_coords_list_a, intersect_face_vertex_coords_list_b, &IntersectPoint, pFace, uModelID); @@ -656,6 +662,8 @@ if ( v16 != 1 ) return false; + + pFace->uAttributes |= FACE_PICKED; return true; /* int v5; // esi@10 @@ -1255,7 +1263,6 @@ return true; } - //----- (004C04AF) -------------------------------------------------------- Vis::Vis() {
--- a/mm7_1.cpp Fri May 24 10:53:33 2013 +0600 +++ b/mm7_1.cpp Fri May 24 10:53:46 2013 +0600 @@ -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 10:53:33 2013 +0600 +++ b/mm7_2.cpp Fri May 24 10:53:46 2013 +0600 @@ -3820,33 +3820,31 @@ MonsterDesc *v8; // edi@16 unsigned __int16 v9; // ax@16 int v10; // ebx@16 - int v11; // edi@16 - int v12; // eax@16 - int v13; // ecx@16 - int v14; // ebx@16 + //int v11; // edi@16 + //int v12; // eax@16 + //int v13; // ecx@16 + //int v14; // ebx@16 const char *v15; // [sp-4h] [bp-24h]@2 - unsigned __int16 v16; // [sp+0h] [bp-20h]@1 - int v17; // [sp+4h] [bp-1Ch]@1 + //unsigned __int16 v16; // [sp+0h] [bp-20h]@1 + //int v17; // [sp+4h] [bp-1Ch]@1 unsigned int uFaceID; // [sp+8h] [bp-18h]@16 int v19; // [sp+Ch] [bp-14h]@16 size_t v20; // [sp+10h] [bp-10h]@6 int v21; // [sp+14h] [bp-Ch]@14 - int v22; // [sp+18h] [bp-8h]@14 + //int v22; // [sp+18h] [bp-8h]@14 unsigned int v23; // [sp+1Ch] [bp-4h]@6 - v16 = a2; - v17 = a1; + //v16 = a2; + //v17 = a1; if ( a2 == 4 ) { v15 = "Elemental Light C"; } - else - { - if ( a2 == 3 ) + else if ( a2 == 3 ) v15 = "Elemental Light B"; else v15 = "Elemental Light A"; - } + v23 = pMonsterList->GetMonsterIDByName(v15); v3 = 0; v20 = uNumActors; @@ -3855,7 +3853,7 @@ v4 = pActors;//[0].uAIState; while ( v4->uAIState != Removed ) { - ++v3; + ++v3; ++v4; if ( v3 >= (signed int)uNumActors ) break; @@ -3866,7 +3864,7 @@ if ( v20 != uNumActors || (result = uNumActors + 1, (signed int)(uNumActors + 1) < 500) ) { v21 = 0; - v22 = pParty->vPosition.z; + //v22 = pParty->vPosition.z; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) v21 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v6 = &pActors[v20]; @@ -3886,22 +3884,21 @@ v6->pMonsterInfo.uExp = 0; v6->uMovementSpeed = v9; v10 = rand() % 2048; - v11 = ((unsigned __int64)(stru_5C6E00->Cos(v10) * (signed __int64)v19) >> 16) + pParty->vPosition.x; + //v11 = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19); uFaceID = stru_5C6E00->Sin(v10); - v23 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; - v12 = pParty->vPosition.y; - v13 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; - v6->vInitialPosition.x = v11; - v14 = v13 + v12; - LOWORD(v12) = v22; - v6->vInitialPosition.z = v22; - v6->vPosition.z = v12; - LOWORD(v12) = v21; - v6->vPosition.x = v11; - v6->vInitialPosition.y = v14; - v6->vPosition.y = v14; + //v12 = pParty->vPosition.y; + //v13 = fixpoint_sub0(uFaceID, v19); + //v14 = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19); + //LOWORD(v12) = v22; + v6->vInitialPosition.x = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19); + v6->vPosition.x = v6->vInitialPosition.x; + v6->vInitialPosition.y = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19); + v6->vPosition.y = v6->vInitialPosition.y; + v6->vInitialPosition.z = pParty->vPosition.z; + v6->vPosition.z = v6->vInitialPosition.z; + //LOWORD(v12) = v21; v6->uTetherDistance = 256; - v6->uSectorID = v12; + v6->uSectorID = v21; v6->PrepareSprites(0); v6->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v6->uAlly = 9999; @@ -3911,19 +3908,17 @@ v6->uCurrentActionLength = 256; v6->UpdateAnimation(); if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor - || (v22 = pParty->vPosition.z, - result = pIndoor->GetSector(v11, v14, pParty->vPosition.z), + || (result = pIndoor->GetSector(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z), result == v21) - && (result = BLV_GetFloorLevel(v11, v14, v22, result, &uFaceID), result != -30000) - && (result = abs(result - v22), result <= 1024) ) + && (result = BLV_GetFloorLevel(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z, result, &uFaceID), result != -30000) + && (result = abs(result - pParty->vPosition.z), result <= 1024) ) { if ( v20 == uNumActors ) ++uNumActors; - v6->uSummonerID = PID(OBJECT_Player,v17); - result = v6->pActorBuffs[2].Apply( - pParty->uTimePlayed + (signed __int64)((double)(a3 << 7) * 0.033333335), - v16, - v17, + v6->uSummonerID = PID(OBJECT_Player, a1); + result = v6->pActorBuffs[2].Apply(pParty->uTimePlayed + (a3 * 128) / 30.0f, + a2, + a1, 0, 0); } @@ -5450,9 +5445,9 @@ } //----- (00458244) -------------------------------------------------------- -unsigned int SkillToMastery(unsigned int value) -{ - switch (value & 0x1C0) +int SkillToMastery( unsigned int skill_value ) + { + switch (skill_value & 0x1C0) { case 0x100: return 4; // Grandmaster case 0x80: return 3; // Master @@ -7207,14 +7202,6 @@ if ( wParam == VK_ESCAPE ) { pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - v12 = window_SpeakInHouse == 0; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = !v12; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ return 0; } if ( wParam <= VK_HOME ) @@ -7231,7 +7218,7 @@ SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( pCurrentScreen + if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) return 0; } @@ -9053,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; @@ -9322,7 +9309,7 @@ char test[1024]; sprintfex(test, "^Pi[%s]: ^R[;;]", ""); - + bool bNoMargareth = false; if (pCmdLine && *pCmdLine) { if (wcsstr(pCmdLine, L"-usedefs")) @@ -9349,6 +9336,8 @@ bNoCD = true; if (wcsstr(pCmdLine, L"-new_sky")) new_sky = true; + if (wcsstr(pCmdLine, L"-nomarg")) + bNoMargareth = true; } @@ -9424,6 +9413,9 @@ bFlashQuestBook = true; pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); SaveNewGame(); + + if (bNoMargareth) + _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1); pGame->Loop(); if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU) @@ -10604,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 10:53:33 2013 +0600 +++ b/mm7_3.cpp Fri May 24 10:53:46 2013 +0600 @@ -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; @@ -1611,10 +1611,6 @@ } } - for (uint i = 0; i < pIndoor->uNumFaces; ++i) - pIndoor->pFaces[i].uAttributes &= ~FACE_OUTLINED; - pIndoor->pFaces[uFaceID].uAttributes |= FACE_OUTLINED; - blv_prev_party_x = pParty->vPosition.x; blv_prev_party_z = pParty->vPosition.y; blv_prev_party_y = pParty->vPosition.z; @@ -2234,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; @@ -2652,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; @@ -2669,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 @@ -2739,7 +2738,7 @@ } else { -LABEL_150: +//LABEL_150: pParty->uFallStartY = pZ; } @@ -2805,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 ) @@ -2847,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); @@ -2888,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) ) { @@ -2929,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 ) @@ -2952,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; @@ -2973,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 ) @@ -3117,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; @@ -3152,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; @@ -11855,11 +11918,9 @@ for (uint i = 0; i < uLevelEVT_NumEvents; ++i) { test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT]; - if ( test_event->_e_type== EVENT_OnMapLeave ) - { - start_event_seq_number = pLevelEVT_Index[i].event_sequence_num; - EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1); - start_event_seq_number = 0; + if ( test_event->_e_type == EVENT_OnMapLeave ) + { + EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num); } } } @@ -11909,11 +11970,9 @@ } else if (_evt->_e_type == EVENT_OnMapReload) { - start_event_seq_number = pEvent.event_sequence_num; - EventProcessor(pEvent.uEventID, 0, 0); - start_event_seq_number = 0; + EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num); } - else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) + else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize) { v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; v20 = pOutdoor->loc_time.uLastVisitDay; @@ -11936,7 +11995,7 @@ v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11; - if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 ) + if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 ) { if ( v20 ) v18 = pParty->uTimePlayed - v20; @@ -12157,8 +12216,7 @@ { if ( pParty->uFlags & 2 ) pGame->Draw(); - if ( !start_event_seq_number ) - pAudioPlayer->StopChannels(-1, -1); + pAudioPlayer->StopChannels(-1, -1); pMiscTimer->Pause(); pEventTimer->Pause(); dword_5C3418 = v4; @@ -12178,9 +12236,7 @@ pGUIWindow2->Release(); pGUIWindow2 = 0; activeLevelDecoration = _591094_decoration; - start_event_seq_number = dword_5C341C; - EventProcessor(dword_5C3418, 0, 1); - start_event_seq_number = 0; + EventProcessor(dword_5C3418, 0, 1, dword_5C341C); activeLevelDecoration = NULL; pEventTimer->Resume(); } @@ -12381,7 +12437,7 @@ } //----- (004466C4) -------------------------------------------------------- -int NPC_EventProcessor( int npc_event_id ) +int NPC_EventProcessor(int npc_event_id, int entry_line) { signed int event_index; // ebp@1 int evt_seq_num; // esi@3 @@ -12392,7 +12448,7 @@ event_index = 0; if ( !npc_event_id ) return 0; - evt_seq_num = start_event_seq_number; + evt_seq_num = entry_line; pSomeOtherEVT = pGlobalEVT; uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); @@ -12842,11 +12898,7 @@ else { timer->time_left_to_fire = timer->fire_interval; - - start_event_seq_number = timer->timer_evt_seq_num; - EventProcessor(timer->timer_evt_ID, 0, 1); - - start_event_seq_number = 0; + EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); } } else @@ -12862,13 +12914,10 @@ next_trigger_time = 7 * 60 * 60 * 24; // 1 week timer->next_fire_time += (next_trigger_time * 128) / 3.0f; - if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row is big time interval has lapsed + if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed timer->next_fire_time = pParty->uTimePlayed; - start_event_seq_number = timer->timer_evt_seq_num; - EventProcessor(timer->timer_evt_ID, 0, 1); - - start_event_seq_number = 0; + EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); } } } @@ -14403,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 @@ -14422,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 @@ -14505,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; @@ -14573,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 //{ @@ -14581,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; @@ -14595,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 { @@ -14608,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; @@ -14673,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 @@ -14738,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 @@ -14818,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 &= 0xFFFBFFFF; 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; @@ -14904,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); } } } @@ -14914,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); } @@ -14938,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; @@ -14958,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 @@ -14988,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 10:53:33 2013 +0600 +++ b/mm7_5.cpp Fri May 24 10:53:46 2013 +0600 @@ -1638,10 +1638,8 @@ } else { - start_event_seq_number = dword_5C341C; - EventProcessor(dword_5C3418, 0, 1); - } - start_event_seq_number = 0; + EventProcessor(dword_5C3418, 0, 1, dword_5C341C); + } if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) pParty->uTimePlayed += 1474560i64; continue; @@ -1649,7 +1647,6 @@ CloseWindowBackground(); pVideoPlayer->Unload(); DialogueEnding(); - start_event_seq_number = 0; viewparams->bRedrawGameUI = true; continue; case UIMSG_CycleCharacters: @@ -4675,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 ) { @@ -5010,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 @@ -5196,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 @@ -5462,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; @@ -5481,7 +5478,7 @@ } else { - Actor::Stun(uActorIDa, a2, 0); + Actor::AI_Stun(uActorIDa, a2, 0); } } } @@ -5570,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); @@ -5590,7 +5587,7 @@ } else { - Actor::Stun(uActorID, v17, 0); + Actor::AI_Stun(uActorID, v17, 0); } return; } @@ -6887,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; @@ -6903,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; } } @@ -7018,7 +7015,7 @@ { if ( v5->pMonsterInfo.uMissleAttack2Type ) { - Actor::MissileAttack2(v13, v22, &v18); + Actor::AI_MissileAttack2(v13, v22, &v18); goto LABEL_43; } } @@ -7033,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; @@ -7055,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; @@ -7334,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; @@ -7357,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; @@ -7376,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; @@ -7397,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; @@ -7411,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; @@ -7421,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;
--- a/mm7_6.cpp Fri May 24 10:53:33 2013 +0600 +++ b/mm7_6.cpp Fri May 24 10:53:46 2013 +0600 @@ -7446,15 +7446,18 @@ } //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; - for ( uint i = 0; i < 30; ++i ) + + + // WUT? double event trigger + /*for ( uint i = 0; i < 30; ++i ) { if ( pKeyActionMap->pToggleTypes[i] ) v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); else v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); - if ( v14 && i == 9 ) + if ( v14 ) { - if ( !pCurrentScreen ) + if (pCurrentScreen == SCREEN_GAME) { pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); continue; @@ -7480,7 +7483,7 @@ //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); } } - } + }*/ if ( !pEventTimer->bPaused ) { for ( uint i = 0; i < 30; ++i ) @@ -7699,13 +7702,6 @@ } else { - /* if ( dword_50C9E8 < 40 ) - { - dword_50C9EC[3 * dword_50C9E8] = 25; - dword_50C9EC[3 * dword_50C9E8 + 1] = 0; - dword_50C9EC[3 * dword_50C9E8 + 2] = 0; - ++dword_50C9E8; - }*/ pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); } break;
--- a/mm7_data.cpp Fri May 24 10:53:33 2013 +0600 +++ b/mm7_data.cpp Fri May 24 10:53:46 2013 +0600 @@ -1306,7 +1306,6 @@ struct Texture *pTexture_outside; // idb struct Texture *pTexture_Dialogue_Background; _UNKNOWN unk_597F10; // weak -int start_event_seq_number; // weak char byte_5B0938[2000]; int EvtTargetObj; // 0x5B5920 int _unused_5B5924_is_travel_ui_drawn = false; // 005B5924
--- a/mm7_data.h Fri May 24 10:53:33 2013 +0600 +++ b/mm7_data.h Fri May 24 10:53:46 2013 +0600 @@ -799,7 +799,6 @@ extern struct Texture *pTexture_outside; // idb extern struct Texture *pTexture_Dialogue_Background; extern _UNKNOWN unk_597F10; // weak -extern int start_event_seq_number; // weak extern char byte_5B0938[2000]; extern int EvtTargetObj; // weak extern int _unused_5B5924_is_travel_ui_drawn; // 005B5924 @@ -1383,7 +1382,7 @@ int sub_4465DF_check_season(int a1); int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb // void __cdecl crt_construct_5773C4(); -int NPC_EventProcessor(int npc_event_id); +int NPC_EventProcessor(int npc_event_id, int entry_line = 0); void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3); void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename); @@ -1426,7 +1425,7 @@ int __cdecl j_SetSomeItemsNames(); -unsigned int SkillToMastery(unsigned int skill_value); +int SkillToMastery(unsigned int skill_value); unsigned int __fastcall GetSpellColor(signed int a1); void *__thiscall unknown_vdtor_6(void *_this, bool a2); unsigned short * MakeScreenshot(signed int width, signed int height);