Mercurial > might-and-magic-trilogy
changeset 86:c83d06692295
Слияние
author | Ritor1 |
---|---|
date | Mon, 22 Oct 2012 09:20:49 +0600 |
parents | 1265125099c7 (current diff) 484492a6dd28 (diff) |
children | c0cf9393af64 |
files | mm7_4.cpp |
diffstat | 14 files changed, 741 insertions(+), 683 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Oct 22 09:18:21 2012 +0600 +++ b/Actor.cpp Mon Oct 22 09:20:49 2012 +0600 @@ -629,7 +629,7 @@ LOBYTE(v21) = v21 | 2; v100 = 0; v99 = v21; - v22 = (SoundID)word_4EE0A6; + v22 = (SoundID)word_4EE088_sound_ids[15]; LABEL_202: v98 = v22; goto LABEL_222; @@ -854,7 +854,7 @@ { v37 = 8 * v36; LOBYTE(v37) = v37 | 2; - pAudioPlayer->PlaySound((SoundID)word_4EE09A, v37, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], v37, 0, -1, 0, 0, 0, 0); } spellnumb = rand() % 1024 - 512; v38 = rand(); @@ -1084,7 +1084,7 @@ LOBYTE(v65) = 8 * LOBYTE(v120) | 3; v100 = 0; v99 = v65; - v22 = (SoundID)word_4EE128; + v22 = (SoundID)word_4EE088_sound_ids[80]; goto LABEL_202; } if ( spellnum != 51 ) @@ -1402,7 +1402,7 @@ LOBYTE(v81) = v81 | 2; v100 = 0; v99 = v81; - v22 = (SoundID)word_4EE142; + v22 = (SoundID)word_4EE088_sound_ids[93]; goto LABEL_202; } }
--- a/Events.h Mon Oct 22 09:18:21 2012 +0600 +++ b/Events.h Mon Oct 22 09:20:49 2012 +0600 @@ -14,6 +14,47 @@ #pragma pack(pop) +#pragma pack(push, 1) +struct _evt_raw +{ + unsigned char v0; + unsigned char v1; + unsigned char v2; + unsigned char v3; + unsigned char v4; + unsigned char v5; + unsigned char v6; + unsigned char v7; + unsigned char v8; + unsigned char v9; + unsigned char v10; + unsigned char v11; + unsigned char v12; + unsigned char v13; + unsigned char v14; + unsigned char v15; + unsigned char v16; + unsigned char v17; + unsigned char v18; + unsigned char v19; + unsigned char v20; + unsigned char v21; + unsigned char v22; + unsigned char v23; + unsigned char v24; + unsigned char v25; + unsigned char v26; + unsigned char v27; + unsigned char v28; + unsigned char v29; + unsigned char v30; + unsigned char v31; + unsigned char v32; + unsigned char tail[128]; +}; +#pragma pop() + + /* 310 */ enum EventType
--- a/Game.cpp Mon Oct 22 09:18:21 2012 +0600 +++ b/Game.cpp Mon Oct 22 09:20:49 2012 +0600 @@ -257,7 +257,7 @@ uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; if (pAsyncMouse) pAsyncMouse->Resume(); - if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) + if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard ) pAsyncKeyboard->Resume(); if ( pRenderer->pRenderD3D ) pGame->pVisInstance->_4C1A02(); @@ -271,7 +271,7 @@ TranslateMessage(&Msg); DispatchMessageA(&Msg); } - if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) + if (dword_6BE364_game_settings_1 & 0x0100 ) { WaitMessage(); continue;
--- a/NPC.h Mon Oct 22 09:18:21 2012 +0600 +++ b/NPC.h Mon Oct 22 09:20:49 2012 +0600 @@ -87,7 +87,7 @@ void Initialize1(); void Initialize(); void Release(); - int InitializeAdditionalNPCs(NPCData *a2, int a3, int a4, int a5); + bool InitializeAdditionalNPCs(NPCData *a2, int a3, int a4, int a5); void _476C60();
--- a/Party.cpp Mon Oct 22 09:18:21 2012 +0600 +++ b/Party.cpp Mon Oct 22 09:20:49 2012 +0600 @@ -544,9 +544,9 @@ ::pPlayers[i + 1] = &pPlayers[i]; pPlayers[0].Reset(0); - pPlayers[0].Reset(4); - pPlayers[0].Reset(24); - pPlayers[0].Reset(32); + pPlayers[1].Reset(4); + pPlayers[2].Reset(24); + pPlayers[3].Reset(32); pPlayers[0].uFace = 17; pPlayers[0].field_1924 = 17; pPlayers[0].uVoiceID = 17;
--- a/Player.cpp Mon Oct 22 09:18:21 2012 +0600 +++ b/Player.cpp Mon Oct 22 09:20:49 2012 +0600 @@ -1547,7 +1547,7 @@ { v4 = v2 + 1; v5 = (char *)this + 36 * v2; - v6 = &byte_4E8398[pItemsTable->pItems[uItemID].uEquipType]; + v6 = &byte_4E8394[pItemsTable->pItems[uItemID].uEquipType + 4]; *(&this->pEquipment.uOffHand + (unsigned __int8)*v6) = v4; *((int *)v5 + 133) = uItemID; v5[556] = *v6 + 1;
--- a/Render.cpp Mon Oct 22 09:18:21 2012 +0600 +++ b/Render.cpp Mon Oct 22 09:20:49 2012 +0600 @@ -10440,8 +10440,8 @@ //----- (004A6274) -------------------------------------------------------- void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture) { - Texture *v4; // edi@2 - unsigned int v5; // ebx@4 + Texture *pCurrentTexture; // edi@2 + int uHeight; // ebx@4 unsigned __int16 *v6; // eax@4 unsigned int v7; // edx@5 unsigned int v8; // edx@6 @@ -10453,25 +10453,25 @@ unsigned int v14; // edx@17 unsigned int v15; // esi@18 unsigned __int8 *v16; // ebx@22 - char v17; // zf@28 + char uFlag; // zf@28 int v18; // [sp+10h] [bp-10h]@4 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 - int v20; // [sp+1Ch] [bp-4h]@4 + int uWidth; // [sp+1Ch] [bp-4h]@4 int uXa; // [sp+28h] [bp+8h]@24 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 unsigned int pTexturea; // [sp+30h] [bp+10h]@11 if ( this->uNumSceneBegins ) { - v4 = pTexture; + pCurrentTexture = pTexture; if ( pTexture ) { if ( pTexture->pPalette16 ) { - v5 = pTexture->uTextureHeight; + uHeight = pTexture->uTextureHeight; v6 = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; v19 = pTexture->pLevelOfDetail0; - v20 = pTexture->uTextureWidth; + uWidth = pTexture->uTextureWidth; v18 = pTexture->uTextureWidth; if ( this->bClip ) { @@ -10480,66 +10480,65 @@ { v8 = v7 - uX; v19 += v8; - v20 += uX - this->uClipX; + uWidth += uX - this->uClipX; v6 += v8; } v9 = this->uClipY; - v5 = pTexture->uTextureHeight; + uHeight = pTexture->uTextureHeight; if ( (signed int)uY < (signed int)v9 ) { v10 = v9 - uY; v19 += v18 * v10; - v5 = uY - this->uClipY + pTexture->uTextureHeight; - v4 = pTexture; + uHeight = uY - this->uClipY + pTexture->uTextureHeight; + pCurrentTexture = pTexture; v6 += this->uTargetSurfacePitch * v10; } v11 = this->uClipX; if ( (signed int)v11 < (signed int)uX ) v11 = uX; pTexturea = this->uClipZ; - if ( (signed int)(v11 + v20) > (signed int)pTexturea ) + if ( (signed int)(v11 + uWidth) > (signed int)pTexturea ) { v12 = this->uClipX; if ( (signed int)v12 < (signed int)uX ) v12 = uX; - v20 = pTexturea - v12; + uWidth = pTexturea - v12; } v13 = this->uClipY; if ( (signed int)v13 < (signed int)uY ) v13 = uY; v14 = this->uClipW; - if ( (signed int)(v5 + v13) > (signed int)v14 ) + if ( (signed int)(uHeight + v13) > (signed int)v14 ) { v15 = this->uClipY; if ( (signed int)v15 < (signed int)uY ) v15 = uY; - v5 = v14 - v15; - } - } - if ( (signed int)v5 > 0 ) - { - uYa = v5; + uHeight = v14 - v15; + } + } + if ( (signed int)uHeight > 0 ) + { + uYa = uHeight; v16 = v19; do { - if ( v20 > 0 ) + if ( uWidth > 0 ) { - uXa = v20; + uXa = uWidth; do { if ( *v16 ) - *v6 = v4->pPalette16[*v16]; + *v6 = pCurrentTexture->pPalette16[*v16]; ++v6; ++v16; - --uXa; } - while ( uXa ); + while ( uXa-- !=1 ); } - v16 += v18 - v20; - v17 = uYa-- == 1; - v6 += this->uTargetSurfacePitch - v20; - } - while ( !v17 ); + v16 += v18 - uWidth; + uFlag = uYa-- == 1; + v6 += this->uTargetSurfacePitch - uWidth; + } + while ( !uFlag ); } } }
--- a/Texture.cpp Mon Oct 22 09:18:21 2012 +0600 +++ b/Texture.cpp Mon Oct 22 09:20:49 2012 +0600 @@ -108,15 +108,7 @@ unsigned int uTextureID_BUTTYES2; unsigned int uTextureID_x_ok_u; Texture *pPlayerPortraits[22]; -Texture *pTexture_IC_KNIGHT; -Texture *pTexture_IC_THIEF; -Texture *pTexture_IC_MONK; -Texture *pTexture_IC_PALAD; -Texture *pTexture_IC_ARCH; -Texture *pTexture_IC_RANGER; -Texture *pTexture_IC_CLER; -Texture *pTexture_IC_DRUID; -Texture *pTexture_IC_SORC; +Texture *pTexture_IC_KNIGHT[8]; Texture *pTexture_MAKESKY; Texture *pTexture_MAKETOP; Texture *pTextures_arrowr[20];
--- a/Texture.h Mon Oct 22 09:18:21 2012 +0600 +++ b/Texture.h Mon Oct 22 09:20:49 2012 +0600 @@ -210,15 +210,7 @@ extern unsigned int uTextureID_BUTTYES2; extern unsigned int uTextureID_x_ok_u; extern Texture *pPlayerPortraits[22]; -extern Texture *pTexture_IC_KNIGHT; -extern Texture *pTexture_IC_THIEF; -extern Texture *pTexture_IC_MONK; -extern Texture *pTexture_IC_PALAD; -extern Texture *pTexture_IC_ARCH; -extern Texture *pTexture_IC_RANGER; -extern Texture *pTexture_IC_CLER; -extern Texture *pTexture_IC_DRUID; -extern Texture *pTexture_IC_SORC; +extern Texture *pTexture_IC_KNIGHT[8]; extern Texture *pTexture_MAKESKY; extern Texture *pTexture_MAKETOP; extern Texture *pTextures_arrowr[20];
--- a/mm7_2.cpp Mon Oct 22 09:18:21 2012 +0600 +++ b/mm7_2.cpp Mon Oct 22 09:20:49 2012 +0600 @@ -11846,23 +11846,23 @@ //----- (00461103) -------------------------------------------------------- void __cdecl sub_461103() { - GUIProgressBar *v0; // ebx@1 - signed int v1; // ebp@1 - char *v2; // esi@2 + //GUIProgressBar *v0; // ebx@1 + //signed int v1; // ebp@1 + //char *v2; // esi@2 __int16 v3; // cx@3 int v4; // edx@8 - size_t v5; // edi@14 + //size_t v5; // edi@14 signed int v6; // esi@14 - char *v7; // edx@15 + //char *v7; // edx@15 signed int v8; // ecx@16 int v9; // ecx@23 MonsterInfo *v10; // ebx@23 - int *v11; // esi@23 + //int *v11; // esi@23 int v12; // esi@25 int v13; // eax@26 __int16 v14; // ax@41 - signed int v15; // [sp+10h] [bp-4Ch]@1 - signed int v16; // [sp+10h] [bp-4Ch]@14 + //signed int v15; // [sp+10h] [bp-4Ch]@1 + //signed int v16; // [sp+10h] [bp-4Ch]@14 signed int v17; // [sp+14h] [bp-48h]@3 signed int v18; // [sp+14h] [bp-48h]@23 int v19; // [sp+18h] [bp-44h]@1 @@ -11870,141 +11870,153 @@ int v21[16]; // [sp+1Ch] [bp-40h]@17 sub_450218_prolly_generate_chests_loot(); - v0 = pGameLoadingUI_ProgressBar; + //v0 = pGameLoadingUI_ProgressBar; pGameLoadingUI_ProgressBar->Progress(); pParty->uFlags |= 2u; pParty->field_7B5_in_arena_quest = 0; - v1 = 0; + //v1 = 0; dword_5C6DF8 = 1; pNPCStats->field_17FC0 = 0; v19 = pMapStats->GetMapInfo(pCurrentMapName); - v15 = 0; - if ( (signed int)uNumActors > 0 ) - { - v2 = (char *)&pActors[0].uNPC_ID; - do - { - v3 = *((short *)v2 + 32); - v17 = v1; + + //v15 = 0; + for (uint i = 0; i < uNumActors; ++i) + //if ( (signed int)uNumActors > 0 ) + { + auto pActor = pActors + i; + //v2 = (char *)&pActors[0].uNPC_ID; + //do + //{ + v3 = pActor->pMonsterInfo.uID; + v17 = 0; if ( v3 >= 115 && v3 <= 186 || v3 >= 232 && v3 <= 249 ) v17 = 1; - v1 = 0; + //v1 = 0; v4 = (v3 - 1) % 3; if ( 2 == v4 ) { - if ( *(short *)v2 && *(short *)v2 < 5000 ) - goto LABEL_13; + if ( pActor->uNPC_ID && pActor->uNPC_ID < 5000 ) + continue; } else { if ( v4 != 1 ) { - if ( v4 != 0 || *(short *)v2 ) - goto LABEL_13; + if ( v4 != 0 || pActor->uNPC_ID ) + continue; goto LABEL_12; } } - if ( *(short *)v2 > 0 && *(short *)v2 < 5000 ) - goto LABEL_13; + if ( pActor->uNPC_ID > 0 && pActor->uNPC_ID < 5000 ) + continue; if ( v17 ) { pNPCStats->InitializeAdditionalNPCs(&pNPCStats->array_13EF4[pNPCStats->field_17FC0], v3, 0, v19); v14 = LOWORD(pNPCStats->field_17FC0) + 5000; ++pNPCStats->field_17FC0; - *(short *)v2 = v14; - goto LABEL_13; + pActor->uNPC_ID = v14; + continue; } LABEL_12: - *(short *)v2 = 0; -LABEL_13: - ++v15; - v2 += 836; - } - while ( v15 < (signed int)uNumActors ); - } + pActor->uNPC_ID = 0; +//LABEL_13: + //++v15; + //v2 += 836; + //} + //while ( v15 < (signed int)uNumActors ); + } + pGameLoadingUI_ProgressBar->Progress(); - v5 = uNumActors; + + //v5 = uNumActors; v6 = 0; v20 = 0; - v16 = v1; - if ( (signed int)uNumActors > v1 ) - { - v7 = (char *)&pActors[0].pMonsterInfo; - do - { + //v16 = v1; + + for (uint i = 0; i < uNumActors; ++i) + { + auto pActor = pActors + i; + //v7 = (char *)&pActors[0].pMonsterInfo; + //do + //{ v8 = 0; - if ( v6 > v1 ) + if ( v6 > 0 ) { do { - if ( v21[v8] == *((short *)v7 + 26) - 1 ) + if ( v21[v8] == pActor->pMonsterInfo.uID - 1 ) break; ++v8; } while ( v8 < v6 ); } + if ( v8 == v6 ) { - v21[v6++] = *((short *)v7 + 26) - 1; + v21[v6++] = pActor->pMonsterInfo.uID - 1; v20 = v6; if ( v6 == 16 ) break; } - ++v16; - v7 += 836; - } - while ( v16 < (signed int)v5 ); - } + //++v16; + //v7 += 836; + //} + //while ( v16 < (signed int)v5 ); + } + pGameLoadingUI_ProgressBar->Progress(); - if ( v6 > v1 ) - { + + if ( v6 > 0 ) + { + int _v0 = 0; do { - v9 = v21[v1]; + v9 = v21[_v0]; v18 = 4; v10 = &pMonsterStats->pInfos[v9 + 1]; - v11 = (int *)pMonsterList->pMonsters[v9].pSoundSampleIDs; + //v11 = (int *)pMonsterList->pMonsters[v9].pSoundSampleIDs; + auto v11 = &pMonsterList->pMonsters[v9]; do { - pSoundList->_4A9A67(*(short *)v11, 0); - v11 = (int *)((char *)v11 + 2); + pSoundList->_4A9A67(v11->pSoundSampleIDs[4 - v18], 0); + //v11 = (int *)((char *)v11 + 2); --v18; } while ( v18 ); v12 = 0; do - LOWORD(v13) = pSoundList->_4A9A67(v12++ + word_4EE088_sound_ids[v10->uSpell1ID], 1u); + v13 = pSoundList->_4A9A67(v12++ + word_4EE088_sound_ids[v10->uSpell1ID], 1); while ( v13 ); - ++v1; - } - while ( v1 < v20 ); - v0 = pGameLoadingUI_ProgressBar; - v1 = 0; - } - v0->Progress(); + ++_v0; + } + while ( _v0 < v6 ); + //v0 = pGameLoadingUI_ProgressBar; + //v1 = 0; + } + + pGameLoadingUI_ProgressBar->Progress(); + if ( dword_6BE368_debug_settings_2 & 4 ) - uNumActors = v1; + uNumActors = 0; if ( dword_6BE368_debug_settings_2 & 8 ) - uNumLevelDecorations = v1; + uNumLevelDecorations = 0; sub_4613C4(); - v0->Progress(); - pIndoorCamera->pos.y = v1; - pIndoorCamera->pos.x = v1; + + pGameLoadingUI_ProgressBar->Progress(); + + pIndoorCamera->pos.y = 0; + pIndoorCamera->pos.x = 0; pIndoorCamera->pos.z = 100; - pIndoorCamera->sRotationY = v1; - pIndoorCamera->sRotationX = v1; + pIndoorCamera->sRotationY = 0; + pIndoorCamera->sRotationX = 0; viewparams->bRedrawGameUI = 1; - uLevel_StartingPointType = v1; + uLevel_StartingPointType = 0; pSprites_LOD->_461397(); pPaletteManager->LockTestAll(); - if ( pParty->pPickedItem.uItemID != v1 ) + if ( pParty->pPickedItem.uItemID != 0 ) pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID); } -// 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; -// 5C6DF8: using guessed type int dword_5C6DF8; -// 6BE35C: using guessed type int uLevel_StartingPointType; -// 6BE368: using guessed type int dword_6BE368_debug_settings_2; -// 461103: using guessed type int var_40[16]; + //----- (004613C4) -------------------------------------------------------- @@ -13140,6 +13152,7 @@ sub_461103(); if ( !_strcmpi(pCurrentMapName, "d11.blv") || !_strcmpi(pCurrentMapName, "d10.blv") ) { + __debugbreak(); v6 = uNumActors; if ( (signed int)uNumActors > 0 ) { @@ -13161,8 +13174,7 @@ pGameLoadingUI_ProgressBar->Release(); _flushall(); } -// 5C35C4: using guessed type int bDialogueUI_InitializeActor_NPC_ID; -// 6BE3C4: using guessed type char bUnderwater; + //----- (004649EF) -------------------------------------------------------- int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue) @@ -15094,7 +15106,7 @@ v1 = uEquipType; _this.Reset(); - v2 = (unsigned __int8)byte_4E8398[v1]; + v2 = (unsigned __int8)byte_4E8394[v1 + 4]; v3 = pPlayers[uActiveCharacter]; v9 = v3; v11 = (int *)((char *)&v3->pEquipment + 4 * v2);
--- a/mm7_3.cpp Mon Oct 22 09:18:21 2012 +0600 +++ b/mm7_3.cpp Mon Oct 22 09:20:49 2012 +0600 @@ -5862,156 +5862,182 @@ } //----- (0047730C) -------------------------------------------------------- -signed int __stdcall const_1(int a1) +int __fastcall const_1(int a1, int) { return 1; } // 47730C: using guessed type int __stdcall const_1(int); //----- (0047732C) -------------------------------------------------------- -int NPCStats::InitializeAdditionalNPCs(NPCData *a2, int a3, int a4, int a5) -{ - NPCStats *v5; // ebx@1 +bool NPCStats::InitializeAdditionalNPCs(NPCData *a2, int a3, int a4, int a5) +{ + //NPCStats *v5; // ebx@1 signed __int64 v6; // qax@1 int v7; // esi@1 int v8; // edx@1 - int v9; // eax@1 - unsigned int v10; // ecx@23 - int v11; // edx@28 - int v12; // esi@37 - int v13; // edx@37 - int v14; // ecx@37 - int v15; // eax@37 - int v16; // edx@37 + NPCData *v9; // edi@1 + int v10; // eax@1 + //int v11; // eax@23 + int v12; // ecx@23 + int v13; // edx@28 + int v14; // esi@37 + int v15; // edx@37 + int v16; // ecx@37 + int v17; // eax@37 + int v18; // edx@37 signed int result; // eax@39 - int v18; // [sp+Ch] [bp-Ch]@1 - signed int v19; // [sp+10h] [bp-8h]@1 - signed int v20; // [sp+14h] [bp-4h]@1 - int v21; // [sp+24h] [bp+Ch]@1 - - v21 = a3 - 1; - v5 = this; - v6 = (signed __int64)((double)v21 * -0.33333334); - v7 = *((char *)&unk_4E83B0 - v6); - v18 = *((char *)&unk_4E8408 - v6); - v8 = rand() % (signed int)this->uNumNPCNames[v7]; + int v20; // [sp+Ch] [bp-Ch]@1 + signed int v21; // [sp+10h] [bp-8h]@1 + signed int v22; // [sp+14h] [bp-4h]@1 + int v23; // [sp+24h] [bp+Ch]@1 + + + v23 = a3 - 1; + //v5 = this; + v6 = (signed __int64)((double)v23 * -0.33333334); + v7 = (unsigned __int8)byte_4E8394[-(_DWORD)v6 + 28]; + v20 = (unsigned __int8)byte_4E8394[-(_DWORD)v6 + 116]; + v8 = rand() % uNumNPCNames[v7]; + v9 = a2; a2->uSex = v7; - a2->pName = (char *)*((int *)&v5->pNPCData[0].pName + v7 + 2 * v8 + 19038); - v9 = 0; - v20 = 0; - v19 = 0; + a2->pName = pNPCNames[v8][v7]; + v10 = 0; + v22 = 0; + v21 = 0; + while ( 1 ) { - if ( v18 == v9 ) - { - if ( v7 == v9 ) - { - v21 = 2; - } - else - { - if ( v7 - v9 == 1 ) - v21 = 201; - } - } - else - { - switch ( v18 - v9 ) + if ( v20 == v10 ) + { + if ( v7 == v10 ) + { + v23 = 2; + a2 = (NPCData *)100; + } + else + { + if ( v7 - v10 == 1 ) + { + v23 = 201; + a2 = (NPCData *)250; + } + } + } + else + { + switch ( v20 - v10 ) { case 1: - if ( v7 == v9 ) - { - v21 = 400; + if ( v7 == v10 ) + { + v23 = 400; + a2 = (NPCData *)430; } else { - if ( v7 - v9 == 1 ) - v21 = 460; + if ( v7 - v10 == 1 ) + { + v23 = 460; + a2 = (NPCData *)490; + } } break; case 2: - if ( v7 == v9 ) - { - v21 = 500; + if ( v7 == v10 ) + { + v23 = 500; + a2 = (NPCData *)520; } else { - if ( v7 - v9 == 1 ) - v21 = 530; + if ( v7 - v10 == 1 ) + { + v23 = 530; + a2 = (NPCData *)550; + } } break; case 3: - if ( v7 == v9 ) - { - v21 = 300; + if ( v7 == v10 ) + { + v23 = 300; + a2 = (NPCData *)330; } else { - if ( v7 - v9 == 1 ) - v21 = 360; + if ( v7 - v10 == 1 ) + { + v23 = 360; + a2 = (NPCData *)387; + } } break; } } - rand(); - if ( const_1(v18) == 1 ) - v19 = 1; - ++v20; - if ( v20 >= 4 ) - { - v10 = v21; - v19 = 1; - } - if ( v19 ) + v12 = v23 + rand() % ((int)a2 - v23 + 1); + if ( const_1(v12, v7) == 1 ) + v21 = 1; + ++v22; + if ( v22 >= 4 ) + { + v12 = v23; + v21 = 1; + } + if ( v21 ) break; - v9 = 0; - } - a2->uPortraitID = v10; - a2->uFlags = 0; - a2->fame = 0; - v11 = rand() % 100 + 1; - if ( v11 >= 60 ) - { - if ( v11 >= 90 ) - { - if ( v11 >= 95 ) - { - if ( v11 >= 98 ) - a2->rep = -600; + v10 = 0; + } + + v9->uPortraitID = v12; + v9->uFlags = 0; + v9->fame = 0; + v13 = rand() % 100 + 1; + + if ( v13 >= 60 ) + { + if ( v13 >= 90 ) + { + if ( v13 >= 95 ) + { + if ( v13 >= 98 ) + v9->rep = -600; else - a2->rep = 400; - } - else - { - a2->rep = -300; - } - } - else - { - a2->rep = 200; - } - } - else - { - a2->rep = 0; - } - v12 = (int)((char *)v5 + 64 * a5); - v13 = rand() % *(int *)(v12 + 91460); - v14 = 0; - v15 = 0; - v16 = v13 + 1; - if ( v16 > 0 ) - { - do - v14 += *(char *)(v12 + v15++ + 91464); - while ( v14 < v16 ); - } - a2->uProfession = v15 - 1; - a2->house = a4; - result = 1; - a2->field_24 = 1; - a2->joins = 1; - return result; + v9->rep = 400; + } + else + { + v9->rep = -300; + } + } + else + { + v9->rep = 200; + } + } + else + { + v9->rep = 0; + } + + //v14 = (int)((char *)v5 + 64 * a5); + //v15 = rand() % *(_DWORD *)(v14 + 91460); + v15 = rand() % array_16544[a5].field_0; + v16 = 0; + v17 = 0; + v18 = v15 + 1; + + if ( v18 > 0 ) + { + do + //v14 += *(char *)(v14 + v17++ + 0x16548); + v16 += array_16544[a5].field_4[v17++]; + while ( v16 < v18 ); + } + v9->uProfession = v17 - 1; + v9->house = a4; + v9->field_24 = 1; + v9->joins = 1; + return true; } // 47730C: using guessed type int __stdcall const_1(int); @@ -15422,19 +15448,15 @@ while ( v0 < (signed int)uLevelEVT_NumEvents ); } } -// 597F18: using guessed type int dword_597F18; + //----- (00443FDC) -------------------------------------------------------- void OnMapLoad() { - signed __int64 v0; // qax@0 - int v1; // esi@1 - Event *v2; // ebx@2 stru176 *v3; // esi@7 __int16 v4; // cx@9 __int16 v5; // di@9 int v6; // eax@9 - int v7; // ecx@13 signed __int64 v8; // qax@26 unsigned int v9; // ecx@26 signed __int64 v10; // qax@26 @@ -15448,9 +15470,7 @@ unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 signed __int64 v19; // [sp+14h] [bp-3Ch]@26 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 - Event *v21; // [sp+28h] [bp-28h]@2 int v22; // [sp+2Ch] [bp-24h]@26 - signed int v23; // [sp+30h] [bp-20h]@1 int v24; // [sp+34h] [bp-1Ch]@26 int v25; // [sp+38h] [bp-18h]@26 int v26; // [sp+3Ch] [bp-14h]@15 @@ -15462,164 +15482,144 @@ __int16 v32; // [sp+4Ch] [bp-4h]@9 __int16 v33; // [sp+4Eh] [bp-2h]@9 - v1 = 0; - v23 = 0; - if ( (signed int)uLevelEVT_NumEvents > 0 ) - { - v2 = pLevelEVT_Events; - v21 = pLevelEVT_Events; - while ( 1 ) - { - LODWORD(v0) = LOWORD(v2->uEventOffsetInEVT); - if ( (unsigned __int8)pLevelEVT[(int)v0 + 4] == 3 ) - { - pSoundList->_4A9A67( - (unsigned __int8)pLevelEVT[(int)v0 + 5] - + (((unsigned __int8)pLevelEVT[(int)v0 + 6] - + (((unsigned __int8)pLevelEVT[(int)v0 + 7] + ((unsigned __int8)pLevelEVT[(int)v0 + 8] << 8)) << 8)) << 8), - v1); - goto LABEL_36; - } - if ( (unsigned __int8)pLevelEVT[(int)v0 + 4] == 31 ) - break; - if ( (unsigned __int8)pLevelEVT[(int)v0 + 4] == 37 ) - { - v7 = v2->uEventID; - dword_597F18 = v2->field_4; - EventProcessor(v7, 0, v1); - dword_597F18 = v1; - } - else - { - if ( (unsigned __int8)pLevelEVT[(int)v0 + 4] == 38 ) - break; - } -LABEL_36: - ++v23; - ++v2; - v21 = v2; - if ( v23 >= (signed int)uLevelEVT_NumEvents ) - return; - } - v20 = pOutdoor->uLastVisitDay; - v3 = &array_5B5928[dword_5B65C8]; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - v20 = pIndoor->stru1.uLastVisitDay; - v4 = (unsigned __int8)pLevelEVT[(int)v0 + 4]; - WORD2(v0) = LOWORD(v2->uEventID); - *(short *)&v3->field_18[4] = v4; - v3->field_8 = WORD2(v0); - v3->field_A = LOWORD(v2->field_4); - v33 = (unsigned __int8)pLevelEVT[(int)v0 + 6]; - v3->field_12 = v33; - v32 = (unsigned __int8)pLevelEVT[(int)v0 + 7]; - v3->field_14 = v32; - v31 = (unsigned __int8)pLevelEVT[(int)v0 + 8]; - v3->field_16 = v31; - v5 = (unsigned __int8)pLevelEVT[(int)v0 + 5]; - v30 = (unsigned __int8)pLevelEVT[(int)v0 + 9]; - *(short *)&v3->field_18[0] = v30; - v29 = (unsigned __int8)pLevelEVT[(int)v0 + 10]; - *(short *)&v3->field_18[2] = v29; - WORD2(v0) = (unsigned __int8)pLevelEVT[(int)v0 + 12]; - LOWORD(v0) = (unsigned __int8)pLevelEVT[(int)v0 + 11]; - v6 = (HIDWORD(v0) << 8) + v0; - v3->field_10 = v5; - v3->field_C = v6; - v3->field_E = v6; - if ( v4 == 38 && !(short)v6 ) - { - if ( v20 ) - v18 = pParty->uTimePlayed - v20; - else - v18 = 0i64; - v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; - HIDWORD(v0) = v26 / 7 / 4 % 12; - if ( v26 / 7 / 4 / 12 ) - { - LODWORD(v0) = 0; - if ( v5 ) - { -LABEL_25: - v3->field_4 = v0; -LABEL_34: + for (uint i = 0; i < uLevelEVT_NumEvents; ++i) + { + auto pEvent = pLevelEVT_Events + i; + + auto _evt = (_evt_raw *)(pLevelEVT + pEvent->uEventOffsetInEVT); + + if (_evt->v4 == 3) + { + pSoundList->_4A9A67( + _evt->v5 + + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8), + 0); + } + else if (_evt->v4 == 37) + { + dword_597F18 = pEvent->field_4; + EventProcessor(pEvent->uEventID, 0, 0); + dword_597F18 = 0; + } + else if (_evt->v4 == 31 || _evt->v4 == 38) + { + v3 = &array_5B5928[dword_5B65C8]; + v20 = pOutdoor->uLastVisitDay; + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + v20 = pIndoor->stru1.uLastVisitDay; + + v4 = _evt->v4; + v3->field_1C = v4; + v3->field_8 = pEvent->uEventID; + v3->field_A = pEvent->field_4; + v33 = _evt->v6; + v3->field_12 = v33; + v32 = _evt->v7; + v3->field_14 = v32; + v31 = _evt->v8; + v3->field_16 = v31; + v5 = _evt->v5; + v30 = _evt->v9; + v3->field_18 = v30; + v29 = _evt->v10; + v3->field_1A = v29; + + v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; + v3->field_10 = v5; + v3->field_C = v6; + v3->field_E = v6; + if ( v4 == 38 && !(short)v6 ) + { + if ( v20 ) + v18 = pParty->uTimePlayed - v20; + else + v18 = 0i64; + v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; + + if ( v26 / 7 / 4 / 12 ) + { + if ( v5 ) + { + v3->field_4 = 0; + ++dword_5B65C8; + v3->field_0 = 0; + continue; + } + } + if (v26 / 7 / 4 != 0 && v33 != 0 || + v26 / 7 != 0 && v32 != 0 || + v26 != 0 || !v20) + { + v3->field_4 = 0; ++dword_5B65C8; - v3->field_0 = v0; - v1 = 0; - goto LABEL_36; - } - } - else - { - LODWORD(v0) = 0; - } - if ( v26 / 7 / 4 != (int)v0 && v33 != (short)v0 - || v26 / 7 != (int)v0 && v32 != (short)v0 - || v26 != (int)v0 - || !v20 ) - goto LABEL_25; - } - v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); - v9 = v8; - v10 = (signed int)v8 / 60; - v22 = v10 % 60; - v11 = (signed int)(v10 / 60); - v12 = v11 % 24; - v13 = (signed int)(v11 / 24); - v27 = v13 % 7; - v14 = (signed int)(v13 / 7); - v15 = v14 % 4; - v16 = (signed int)(v14 / 4); - v24 = v16 / 12; - - auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; - auto _2 = ((__int64)v9 << 32) | _1; - v19 = _2 % 60; - //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, - // v9) - // % 60; - v17 = v12; - v25 = v15; - v28 = v16 % 12; - if ( v5 ) - { - ++v24; - } - else - { - if ( v33 ) - { - ++v28; - } - else - { - if ( v32 ) - { - ++v25; + v3->field_0 = 0; + continue; + } + } + + v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); + v9 = v8; + v10 = (signed int)v8 / 60; + v22 = v10 % 60; + v11 = (signed int)(v10 / 60); + v12 = v11 % 24; + v13 = (signed int)(v11 / 24); + v27 = v13 % 7; + v14 = (signed int)(v13 / 7); + v15 = v14 % 4; + v16 = (signed int)(v14 / 4); + v24 = v16 / 12; + + auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; + auto _2 = ((__int64)v9 << 32) | _1; + + v19 = _2 % 60; + //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, + // v9) + // % 60; + + v17 = v12; + v25 = v15; + v28 = v16 % 12; + if ( v5 ) + { + ++v24; + } + else + { + if ( v33 ) + { + ++v28; } else { - ++v27; - v22 = v30; - v17 = v31; - v19 = v29; - } - } - } - v0 = (signed __int64)((double)((v19 - + 0x3C * v22 - + 0xE10 * v17 - + 0x93A80 * v25 - + 0x15180 * v27 - + 0x24EA00 * (v28 + 12i64 * v24)) << 7) - * 0.033333335); - v2 = v21; - v3->field_4 = HIDWORD(v0); - goto LABEL_34; - } -} -// 597F18: using guessed type int dword_597F18; -// 5B65C8: using guessed type int dword_5B65C8; + if ( v32 ) + { + ++v25; + } + else + { + ++v27; + v22 = v30; + v17 = v31; + v19 = v29; + } + } + } + auto v0 = (signed __int64)((double)((v19 + + 0x3C * v22 + + 0xE10 * v17 + + 0x93A80 * v25 + + 0x15180 * v27 + + 0x24EA00 * (v28 + 12i64 * v24)) << 7) + * 0.033333335); + v3->field_4 = HIDWORD(v0); + + ++dword_5B65C8; + v3->field_0 = v0; + } + } +} //----- (00444360) -------------------------------------------------------- void __thiscall Level_LoadEvtAndStr(const char *pLevelName) @@ -16824,22 +16824,22 @@ //----- (004465DF) -------------------------------------------------------- -signed int __thiscall sub_4465DF_check_season(void *_this) +int sub_4465DF_check_season(int a1) { unsigned int v1; // eax@1 unsigned int v2; // edx@1 - char *v3; // ecx@2 + int v3; // ecx@2 int v4; // ecx@3 char v6; // zf@9 v1 = pParty->uCurrentMonth + 1; v2 = pParty->uDaysPlayed + 1; - if ( _this ) - { - v3 = (char *)_this - 1; + if ( a1 ) + { + v3 = a1 - 1; if ( v3 ) { - v4 = (int)(v3 - 1); + v4 = v3 - 1; if ( v4 ) { if ( v4 != 1 ) @@ -17032,19 +17032,19 @@ //----- (0044684A) -------------------------------------------------------- -void __fastcall EventProcessor(int a1, int a2, int a3) +void __fastcall EventProcessor(int uEventID, int a2, int a3) { unsigned int v3; // eax@5 - signed int v4; // esi@7 - char *v5; // eax@8 - char *v6; // ecx@8 - char *v7; // ebp@8 - signed int v8; // edx@10 - int v9; // edi@12 - ByteArray *v10; // esi@12 + //signed int v4; // esi@7 + //char *v5; // eax@8 + Player *v6; // ecx@8 + //char *v7; // ebp@8 + //signed int v8; // edx@10 + //int v9; // edi@12 + //ByteArray *v10; // esi@12 int v11; // eax@14 char *v12; // eax@15 - char *v13; // edi@21 + //char *v13; // edi@21 int v14; // ebp@21 int v15; // edi@21 const char *v16; // esi@21 @@ -17132,7 +17132,7 @@ unsigned int v98; // edx@265 const char *v99; // esi@267 int v100; // edx@267 - char *v101; // edi@281 + //char *v101; // edi@281 unsigned int v102; // esi@281 int v103; // edi@284 int v104; // eax@288 @@ -17154,15 +17154,15 @@ int v120; // [sp-4h] [bp-4ACh]@278 int v121; // [sp-4h] [bp-4ACh]@294 int v122; // [sp+10h] [bp-498h]@4 - char *v123; // [sp+14h] [bp-494h]@0 - signed int v124; // [sp+18h] [bp-490h]@7 + //char *v123; // [sp+14h] [bp-494h]@0 + //signed int v124; // [sp+18h] [bp-490h]@7 signed int v125; // [sp+1Ch] [bp-48Ch]@155 int v126; // [sp+1Ch] [bp-48Ch]@262 int v127; // [sp+20h] [bp-488h]@4 int v128; // [sp+24h] [bp-484h]@21 int v129; // [sp+24h] [bp-484h]@262 signed int v130; // [sp+28h] [bp-480h]@0 - int v131; // [sp+2Ch] [bp-47Ch]@1 + //int v131; // [sp+2Ch] [bp-47Ch]@1 int v132; // [sp+30h] [bp-478h]@262 signed int v133; // [sp+34h] [bp-474h]@1 int v134; // [sp+38h] [bp-470h]@262 @@ -17176,7 +17176,7 @@ char Str[120]; // [sp+ECh] [bp-3BCh]@21 Actor Dst; // [sp+164h] [bp-344h]@53 - v131 = a1; + //v131 = uEventID; v133 = 0; dword_5B5920 = a2; dword_5B65C4 = 0; @@ -17202,31 +17202,33 @@ } uSomeEVT_NumEvents = v3; memcpy(pSomeEVT_Events, v112, 0xCE40u); - v4 = 0; - v124 = 0; - if ( (signed int)uSomeEVT_NumEvents > 0 ) - { - v5 = pSomeEVT; - v6 = v123; - v7 = nullstring; - while ( 1 ) - { + //v4 = 0; + //v124 = 0; + for (uint i = 0; i < uSomeEVT_NumEvents; ++i) + { + //v5 = pSomeEVT; + //v6 = v123; + //v7 = nullstring; + //while ( 1 ) + //{ if ( dword_5B65C4 ) goto LABEL_301; - v8 = v4; - if ( pSomeEVT_Events[v4].uEventID == v131 && pSomeEVT_Events[v8].field_4 == v122 ) - { - v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; - v10 = (ByteArray *)&v5[v9]; - switch ( v5[v9 + 4] ) + //v8 = v4; + if ( pSomeEVT_Events[i/*v4*/].uEventID == uEventID && pSomeEVT_Events[i/*v4*/].field_4 == v122 ) + { + //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; + //v10 = (ByteArray *)&v5[v9]; + auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[i/*v4*/].uEventOffsetInEVT); + + switch (_evt->v4) { case EVENT_CheckSeason: - if ( !sub_4465DF_check_season((void *)v10->f[5]) ) + if ( !sub_4465DF_check_season(_evt->v5) ) goto LABEL_291; - v11 = v10->f[6]; + v11 = _evt->v6; goto LABEL_130; case EVENT_ShowMovie: - strcpy(Source, &v10->f[7]); + strcpy(Source, (char *)&_evt->v7); v12 = (char *)&item.uExpireTime + strlen(Source) + 7; if ( *v12 == 32 ) *v12 = 0; @@ -17237,9 +17239,11 @@ if (pAsyncMouse) pAsyncMouse->Suspend(); v128 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; - v13 = &pSomeEVT[v9]; - v14 = (unsigned __int8)v13[5]; - v15 = (unsigned __int8)v13[6]; + //v13 = &pSomeEVT[v9]; + //v14 = (unsigned __int8)v13[5]; + //v15 = (unsigned __int8)v13[6]; + v14 = _evt->v5; + v15 = _evt->v6; strcpy(Str, Source); v16 = RemoveQuotes(Str); VideoPlayer::MovieLoop(v16, 0, v14, 1); @@ -17277,25 +17281,25 @@ pAsyncMouse->Resume(); goto LABEL_291; case EVENT_CheckSkill: - v19 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8); + v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); if ( v127 < 0 ) goto LABEL_47; if ( v127 <= 3 ) { - v24 = pParty->pPlayers[0].pActiveSkills[3486 * v127 + v10->f[5]]; + v24 = pParty->pPlayers[0].pActiveSkills[3486 * v127 + _evt->v5]; } else { if ( v127 == 4 ) { - v24 = pPlayers[uActiveCharacter]->pActiveSkills[v10->f[5]]; + v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; } else { if ( v127 == 5 ) { v20 = 0; - v21 = 3486 * v130 + v10->f[5]; + v21 = 3486 * v130 + _evt->v5; v136 = 1; LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; v137 = v21 & 0x40; @@ -17303,26 +17307,26 @@ v22 = v21 & 0x100; v23 = v21 & 0x3F; v139 = v22; - while ( v23 < v19 || !*(&v136 + v10->f[6]) ) + while ( v23 < v19 || !*(&v136 + _evt->v6) ) { ++v20; if ( v20 >= 4 ) goto LABEL_291; } LABEL_50: - v11 = v10->f[11]; + v11 = _evt->v11; goto LABEL_130; } LABEL_47: - v10 = (ByteArray *)&v5[v9]; - v24 = pParty->pPlayers[0].pActiveSkills[(unsigned __int8)v5[v9 + 5] + 3486 * rand() % 4]; + //v10 = (ByteArray *)&v5[v9]; + v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; } } v136 = 1; v137 = v24 & 0x40; v138 = v24 & 0x80; v139 = v24 & 0x100; - if ( (v24 & 0x3F) >= v19 && *(&v136 + v10->f[6]) ) + if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) goto LABEL_50; goto LABEL_291; case EVENT_SpeakNPC: @@ -17330,24 +17334,24 @@ { //Actor::Actor(&Dst); memset(&Dst, 0, 0x344u); - dword_5B65D0_dialogue_actor_npc_id = (unsigned __int8)pSomeEVT[v9 + 5] - + (((unsigned __int8)pSomeEVT[v9 + 6] - + (((unsigned __int8)pSomeEVT[v9 + 7] - + ((unsigned __int8)pSomeEVT[v9 + 8] << 8)) << 8)) << 8); + dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + + ((_evt->v6 + + ((_evt->v7 + + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); Dst.uNPC_ID = dword_5B65D0_dialogue_actor_npc_id; Dst.InitializeDialogue(0); } else { - bDialogueUI_InitializeActor_NPC_ID = v10->f[5] - + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); + bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); } goto LABEL_291; case EVENT_ChangeEvent: - v25 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); + v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); if ( v25 ) { - stru_5E4C90.field_0[_5C3420_pDecoration->field_1C] = v10->f[5] - 124; + stru_5E4C90.field_0[_5C3420_pDecoration->field_1C] = _evt->v5 - 124; } else { @@ -17357,16 +17361,16 @@ } goto LABEL_291; case EVENT_SetNPCGreeting: - v27 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); - v28 = v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8); + v27 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v28 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; pNPCStats->pNewNPCData[v27].greet = v28; goto LABEL_291; case EVENT_SetNPCTopic: - v29 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); - v30 = v10->f[10] + ((v10->f[11] + ((v10->f[12] + (v10->f[13] << 8)) << 8)) << 8); - v31 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); - v32 = v10->f[9]; + v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); + v31 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v32 = _evt->v9; v33 = &pNPCStats->pNewNPCData[v31]; if ( v32 ) { @@ -17420,11 +17424,11 @@ { pAudioPlayer->StopChannels(-1, -1); ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); - ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, v7, 0); - ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, v7, 0); - ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, v7, 0); - ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, v7, 0); - ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, v7, 0); + ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); + ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); + ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); + ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); + ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); ptr_F8B1E8 = pNPCTopics[90].pText; } } @@ -17432,26 +17436,28 @@ goto LABEL_291; case EVENT_NPCSetItem: sub_448518_npc_set_item( - v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), - v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8), - v10->f[13]); + _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13); goto LABEL_291; case EVENT_SetActorItem: Actor::GiveItem( - v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), - v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8), - v10->f[13]); + _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13); goto LABEL_291; case EVENT_SetNPCGroupNews: - pNPCStats->pGroups_copy[v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8)] = v10->f[9] + (v10->f[10] << 8); + pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); goto LABEL_291; case EVENT_SetActorGroup: - *(&pActors[0].uGroup + 285212672 * v10->f[8] + 209 * (v10->f[5] + ((v10->f[6] + (v10->f[7] << 8)) << 8))) = v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8); + __debugbreak(); + *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); goto LABEL_291; case EVENT_ChangeGroup: - v38 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); - v39 = v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8); + v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); v40 = uNumActors; + __debugbreak(); if ( (signed int)uNumActors > 0 ) { v41 = (char *)&pActors[0].uGroup; @@ -17466,9 +17472,10 @@ } goto LABEL_291; case EVENT_ChangeGroupAlly: - v42 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); - v43 = v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8); + v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); v44 = uNumActors; + __debugbreak(); if ( (signed int)uNumActors > 0 ) { v45 = (char *)&pActors[0].uAlly; @@ -17483,7 +17490,7 @@ } goto LABEL_291; case EVENT_MoveNPC: - pNPCStats->pNewNPCData[v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8)].house = v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8); + pNPCStats->pNewNPCData[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)].house = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); if ( ptr_507BC0 ) { v46 = ptr_507BC0->ptr_1C; @@ -17524,29 +17531,29 @@ } goto LABEL_291; case EVENT_Jmp: - v124 = -1; - v122 = v10->f[5] - 1; + //v124 = -1; + v122 = _evt->v5 - 1; goto LABEL_291; case EVENT_ShowFace: - v50 = v10->f[5]; + v50 = _evt->v5; if ( (unsigned __int8)v50 <= 3u ) { v117 = 0; - v113 = v10->f[6]; + v113 = _evt->v6; v53 = (unsigned __int8)v50; goto LABEL_108; } if ( v50 == 4 ) { v117 = 0; - v113 = v10->f[6]; + v113 = _evt->v6; v52 = pPlayers[uActiveCharacter]; goto LABEL_109; } if ( v50 != 5 ) { v117 = 0; - v113 = v10->f[6]; + v113 = _evt->v6; v53 = rand() % 4; LABEL_108: v52 = &pParty->pPlayers[v53]; @@ -17557,37 +17564,37 @@ v51 = pParty->pPlayers; do { - v51->PlayEmotion((unsigned __int8)pSomeEVT[v9 + 6], 0); + v51->PlayEmotion(_evt->v6, 0); ++v51; } while ( (signed int)v51 < (signed int)pParty->pHirelings ); LABEL_291: ++v122; - v4 = v124; - v5 = pSomeEVT; - v6 = v123; - v7 = nullstring; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = nullstring; break; case EVENT_CharacterAnimation: - v54 = v10->f[5]; + v54 = _evt->v5; if ( (unsigned __int8)v54 <= 3u ) { v118 = 0; - v114 = v10->f[6]; + v114 = _evt->v6; v57 = (unsigned __int8)v54; goto LABEL_119; } if ( v54 == 4 ) { v118 = 0; - v114 = v10->f[6]; + v114 = _evt->v6; v56 = pPlayers[uActiveCharacter]; goto LABEL_120; } if ( v54 != 5 ) { v118 = 0; - v114 = v10->f[6]; + v114 = _evt->v6; v57 = rand() % 4; LABEL_119: v56 = &pParty->pPlayers[v57]; @@ -17598,28 +17605,28 @@ v55 = pParty->pPlayers; do { - v55->PlaySound((unsigned __int8)pSomeEVT[v9 + 6], 0); + v55->PlaySound(_evt->v6, 0); ++v55; } while ( (signed int)v55 < (signed int)pParty->pHirelings ); goto LABEL_291; case EVENT_ForPartyMember: - v127 = v10->f[5]; + v127 = _evt->v5; goto LABEL_291; case EVENT_SummonItem: sub_42F7EB_DropItemAt( - v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), - v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8), - v10->f[13] + ((v10->f[14] + ((v10->f[15] + (v10->f[16] << 8)) << 8)) << 8), - v10->f[17] + ((v10->f[18] + ((v10->f[19] + (v10->f[20] << 8)) << 8)) << 8), - v10->f[21] + ((v10->f[22] + ((v10->f[23] + (v10->f[24] << 8)) << 8)) << 8), - v10->f[25], - v10->f[26], + _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), + _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), + _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), + _evt->v25, + _evt->v26, 0, 0); goto LABEL_291; case EVENT_Compare: - v58 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8); + v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); if ( v127 == 5 ) { v130 = 0; @@ -17627,8 +17634,8 @@ while ( 1 ) { LOBYTE(v60) = v59->CompareVariable( - (enum VariableType)((unsigned __int8)pSomeEVT[v9 + 5] - + ((unsigned __int8)pSomeEVT[v9 + 6] << 8)), + (enum VariableType)(_evt->v5 + + ((uint)_evt->v6 << 8)), v58); if ( v60 ) break; @@ -17638,7 +17645,7 @@ goto LABEL_291; } LABEL_129: - v11 = (unsigned __int8)pSomeEVT[v9 + 11]; + v11 = _evt->v11; goto LABEL_130; } if ( v127 < 0 ) @@ -17650,7 +17657,7 @@ { if ( uActiveCharacter ) { - v6 = (char *)pPlayers[uActiveCharacter]; + v6 = pPlayers[uActiveCharacter]; goto LABEL_138; } } @@ -17660,14 +17667,14 @@ goto LABEL_139; } v61 = rand() % 4; - v5 = pSomeEVT; + //v5 = pSomeEVT; LABEL_137: - v6 = (char *)&pParty->pPlayers[v61]; + v6 = &pParty->pPlayers[v61]; LABEL_138: - v123 = v6; + //v123 = v6; LABEL_139: LOBYTE(v62) = ((Player *)v6)->CompareVariable( - (enum VariableType)((unsigned __int8)v5[v9 + 5] + ((unsigned __int8)v5[v9 + 6] << 8)), + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58); LABEL_140: if ( v62 ) @@ -17675,13 +17682,13 @@ goto LABEL_291; case EVENT_IsActorAlive: v62 = IsActorAlive( - v10->f[5], - v10->f[6] + ((v10->f[7] + ((v10->f[8] + (v10->f[9] << 8)) << 8)) << 8), - v10->f[10]); + _evt->v5, + _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), + _evt->v10); goto LABEL_140; case EVENT_Substract: - v63 = (void *)(v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8)); - if ( v10->f[5] + (v10->f[6] << 8) == VAR_PlayerItemInHands ) + v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8)); + if ( _evt->v5 + ((uint)_evt->v6 << 8) == VAR_PlayerItemInHands ) { v64 = 0; if ( (void *)pParty->pPickedItem.uItemID == v63 ) @@ -17768,22 +17775,22 @@ goto LABEL_180; LABEL_183: ((Player *)v6)->SubtractVariable( - (enum VariableType)((unsigned __int8)v5[v9 + 5] + ((unsigned __int8)v5[v9 + 6] << 8)), + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); goto LABEL_291; } if ( uActiveCharacter ) { - v6 = (char *)pPlayers[uActiveCharacter]; + v6 = pPlayers[uActiveCharacter]; goto LABEL_182; } LABEL_180: v75 = rand() % 4; - v5 = pSomeEVT; - } - v6 = (char *)&pParty->pPlayers[v75]; + //v5 = pSomeEVT; + } + v6 = &pParty->pPlayers[v75]; LABEL_182: - v123 = v6; + //v123 = v6; goto LABEL_183; } v76 = pParty->pPlayers; @@ -17791,14 +17798,14 @@ do { v76->SubtractVariable( - (enum VariableType)((unsigned __int8)pSomeEVT[v9 + 5] + ((unsigned __int8)pSomeEVT[v9 + 6] << 8)), + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); ++v76; } while ( (signed int)v76 < (signed int)pParty->pHirelings ); goto LABEL_291; case EVENT_Set: - v77 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8); + v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); v78 = v127; if ( v127 != 5 ) { @@ -17812,22 +17819,22 @@ goto LABEL_194; LABEL_197: ((Player *)v6)->SetVariable( - (enum VariableType)((unsigned __int8)v5[v9 + 5] + ((unsigned __int8)v5[v9 + 6] << 8)), + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); goto LABEL_291; } if ( uActiveCharacter ) { - v6 = (char *)pPlayers[uActiveCharacter]; + v6 = pPlayers[uActiveCharacter]; goto LABEL_196; } LABEL_194: v78 = rand() % 4; - v5 = pSomeEVT; - } - v6 = (char *)&pParty->pPlayers[v78]; + //v5 = pSomeEVT; + } + v6 = &pParty->pPlayers[v78]; LABEL_196: - v123 = v6; + //v123 = v6; goto LABEL_197; } v79 = pParty->pPlayers; @@ -17835,14 +17842,14 @@ do { v79->SetVariable( - (enum VariableType)((unsigned __int8)pSomeEVT[v9 + 5] + ((unsigned __int8)pSomeEVT[v9 + 6] << 8)), + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); ++v79; } while ( (signed int)v79 < (signed int)pParty->pHirelings ); goto LABEL_291; case EVENT_Add: - v80 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8); + v80 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); v81 = v127; if ( v127 != 5 ) { @@ -17856,22 +17863,22 @@ goto LABEL_208; LABEL_211: ((Player *)v6)->AddVariable( - (enum VariableType)((unsigned __int8)v5[v9 + 5] + ((unsigned __int8)v5[v9 + 6] << 8)), + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); goto LABEL_212; } if ( uActiveCharacter ) { - v6 = (char *)pPlayers[uActiveCharacter]; + v6 = pPlayers[uActiveCharacter]; goto LABEL_210; } LABEL_208: v81 = rand() % 4; - v5 = pSomeEVT; - } - v6 = (char *)&pParty->pPlayers[v81]; + //v5 = pSomeEVT; + } + v6 = &pParty->pPlayers[v81]; LABEL_210: - v123 = v6; + //v123 = v6; goto LABEL_211; } v82 = pParty->pPlayers; @@ -17879,13 +17886,13 @@ do { v82->AddVariable( - (enum VariableType)((unsigned __int8)pSomeEVT[v9 + 5] + ((unsigned __int8)pSomeEVT[v9 + 6] << 8)), + (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); ++v82; } while ( (signed int)v82 < (signed int)pParty->pHirelings ); LABEL_212: - v83 = (unsigned __int8)pSomeEVT[v9 + 5] + ((unsigned __int8)pSomeEVT[v9 + 6] << 8); + v83 = _evt->v5 + ((uint)_evt->v6 << 8); if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) viewparams->bRedrawGameUI = 1; goto LABEL_291; @@ -17894,51 +17901,51 @@ { strcpy( GameUI_StatusBar_TimedString, - &pLevelStr[pLevelStrOffsets[(unsigned __int8)v5[v9 + 5] - + (((unsigned __int8)v5[v9 + 6] - + (((unsigned __int8)v5[v9 + 7] + ((unsigned __int8)v5[v9 + 8] << 8)) << 8)) << 8)]]); + &pLevelStr[pLevelStrOffsets[_evt->v5 + + ((_evt->v6 + + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); v105 = v122; v121 = 26; LABEL_295: - sub_4451A8_press_any_key(v131, v105, v121); + sub_4451A8_press_any_key(uEventID, v105, v121); LABEL_301: if ( v133 == 1 ) LABEL_302: OnMapLeave(); return; } - v84 = v10->f[13] + ((v10->f[14] + ((v10->f[15] + (v10->f[16] << 8)) << 8)) << 8); + v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); if ( !_strcmpi( GameUI_StatusBar_TimedString, - &pLevelStr[pLevelStrOffsets[v10->f[9] - + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8)]]) + &pLevelStr[pLevelStrOffsets[_evt->v9 + + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) || !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) ) { - v11 = (unsigned __int8)pSomeEVT[v9 + 17]; + v11 = _evt->v17; LABEL_130: - v124 = -1; + //v124 = -1; LABEL_131: v122 = v11 - 1; } goto LABEL_291; case EVENT_RandomGoTo: - v124 = -1; - v11 = (unsigned __int8)*(&pSomeEVT[v9 + 5] + //v124 = -1; + v11 = (unsigned __int8)*(&_evt->v5 + rand() - % ((v10->f[5] != 0) - + (v10->f[6] != 0) - + (v10->f[7] != 0) - + (v10->f[8] != 0) - + (v10->f[9] != 0) - + (v10->f[10] != 0))); + % ((_evt->v5 != 0) + + (_evt->v6 != 0) + + (_evt->v7 != 0) + + (_evt->v8 != 0) + + (_evt->v9 != 0) + + (_evt->v10 != 0))); goto LABEL_131; case EVENT_ReceiveDamage: - v85 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8); - v86 = v10->f[5]; + v85 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + v86 = _evt->v5; if ( (unsigned __int8)v86 <= 3u ) { - v119 = v10->f[6]; - v115 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8); + v119 = _evt->v6; + v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); v89 = (unsigned __int8)v86; goto LABEL_233; } @@ -17946,15 +17953,15 @@ { if ( !uActiveCharacter ) goto LABEL_291; - v119 = v10->f[6]; + v119 = _evt->v6; v88 = pPlayers[uActiveCharacter]; - v115 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8); + v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); goto LABEL_234; } if ( v86 != 5 ) { - v119 = v10->f[6]; - v115 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8); + v119 = _evt->v6; + v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v1 << 8)) << 8)) << 8); v89 = rand() % 4; LABEL_233: v88 = &pParty->pPlayers[v89]; @@ -17965,44 +17972,44 @@ v87 = pParty->pPlayers; do { - v87->ReceiveDamage(v85, (unsigned __int8)pSomeEVT[v9 + 6]); + v87->ReceiveDamage(v85, _evt->v6); ++v87; } while ( (signed int)v87 < (signed int)pParty->pHirelings ); goto LABEL_291; case EVENT_ToggleIndoorLight: - pIndoor->ToggleLight(v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), v10->f[9]); + pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9); goto LABEL_291; case EVENT_SetFacesBit: sub_44892E_set_faces_bit( - v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), - v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8), - v10->f[13]); + _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13); goto LABEL_291; case EVENT_ToggleChestFlag: Chest::ToggleFlag( - v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), - v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8), - v10->f[13]); + _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13); goto LABEL_291; case EVENT_ToggleActorFlag: Actor::ToggleFlag( - v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), - v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8), - v10->f[13]); + _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13); goto LABEL_291; case EVENT_ToggleActorGroupFlag: ToggleActorGroupFlag( - v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), - v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8), - v10->f[13]); + _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13); goto LABEL_291; case EVENT_SetSnow: - if ( !v10->f[5] ) - pWeather->bRenderSnow = v10->f[6] != 0; + if ( !_evt->v5 ) + pWeather->bRenderSnow = _evt->v6 != 0; goto LABEL_291; case EVENT_StatusText: - v90 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); + v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); if ( _5C3420_pDecoration ) { if ( _5C3420_pDecoration == (LevelDecoration *)1 ) @@ -18028,7 +18035,7 @@ } goto LABEL_291; case EVENT_ShowMessage: - v92 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); + v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); if ( _5C3420_pDecoration ) { v93 = (&dword_721664)[8 * v92]; @@ -18042,76 +18049,76 @@ goto LABEL_291; case EVENT_CastSpell: sub_448DF8_cast_spell( - v10->f[5], - v10->f[6], - v10->f[7], - v10->f[8] + ((v10->f[9] + ((v10->f[10] + (v10->f[11] << 8)) << 8)) << 8), - v10->f[12] + ((v10->f[13] + ((v10->f[14] + (v10->f[15] << 8)) << 8)) << 8), - v10->f[16] + ((v10->f[17] + ((v10->f[18] + (v10->f[19] << 8)) << 8)) << 8), - v10->f[20] + ((v10->f[21] + ((v10->f[22] + (v10->f[23] << 8)) << 8)) << 8), - v10->f[24] + ((v10->f[25] + ((v10->f[26] + (v10->f[27] << 8)) << 8)) << 8), - v10->f[28] + ((v10->f[29] + ((v10->f[30] + (v10->f[31] << 8)) << 8)) << 8)); + _evt->v5, + _evt->v6, + _evt->v7, + _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), + _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), + _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), + _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), + _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8), + _evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8)); goto LABEL_291; case EVENT_SetTexture: - sub_44861E_set_texture(v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), &v10->f[9]); + sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9); goto LABEL_291; case EVENT_SetSprite: SetDecorationSprite( - v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8), - v10->f[9], - &v10->f[10]); + _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9, + (char *)&_evt->v10); goto LABEL_291; case EVENT_SummonMonsters: sub_448CF4_spawn_monsters( - v10->f[5], - v10->f[6], - v10->f[7], - v10->f[8] + ((v10->f[9] + ((v10->f[10] + (v10->f[11] << 8)) << 8)) << 8), - v10->f[12] + ((v10->f[13] + ((v10->f[14] + (v10->f[15] << 8)) << 8)) << 8), - v10->f[16] + ((v10->f[17] + ((v10->f[18] + (v10->f[19] << 8)) << 8)) << 8), - v10->f[20] + ((v10->f[21] + ((v10->f[22] + (v10->f[23] << 8)) << 8)) << 8), - v10->f[24] + ((v10->f[25] + ((v10->f[26] + (v10->f[27] << 8)) << 8)) << 8)); + _evt->v5, + _evt->v6, + _evt->v7, + _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), + _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), + _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), + _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), + _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8)); goto LABEL_291; case EVENT_MouseOver: case EVENT_LocationName: --v122; goto LABEL_291; case EVENT_ChangeDoorState: - sub_449A49_door_switch_animation(v10->f[5], v10->f[6]); + sub_449A49_door_switch_animation(_evt->v5, _evt->v6); goto LABEL_291; case EVENT_OpenChest: - if ( !Chest::Open(v10->f[5]) ) + if ( !Chest::Open(_evt->v5) ) goto LABEL_301; goto LABEL_291; case EVENT_MoveToMap: - v94 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); - v135 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); - v132 = v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8); - v126 = v10->f[13] + ((v10->f[14] + ((v10->f[15] + (v10->f[16] << 8)) << 8)) << 8); - v129 = v10->f[17] + ((v10->f[18] + ((v10->f[19] + (v10->f[20] << 8)) << 8)) << 8); - v95 = v10->f[21] + ((v10->f[22] + ((v10->f[23] + (v10->f[24] << 8)) << 8)) << 8); - v96 = v10->f[25]; - v97 = v96 + ((v10->f[26] + ((v10->f[27] + (v10->f[28] << 8)) << 8)) << 8); - v134 = v96 + ((v10->f[26] + ((v10->f[27] + (v10->f[28] << 8)) << 8)) << 8); - if ( v10->f[29] || v10->f[30] ) + v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); + v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); + v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); + v96 = _evt->v25; + v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); + v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); + if ( _evt->v29 || _evt->v30 ) { if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) pRenderer->_49FD3A(); sub_444839_move_map( - (unsigned __int8)pSomeEVT[v9 + 29], - (unsigned __int8)pSomeEVT[v9 + 30], + _evt->v29, + _evt->v30, v135, v132, v126, v129, v95, v134, - &pSomeEVT[v9 + 31]); - dword_5C3418 = v131; + (char *)&_evt->v31); + dword_5C3418 = uEventID; dword_5C341C = v122 + 1; goto LABEL_301; } - _5B65AC_npcdata_fame_or_other = v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8); + _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); _5B65A8_npcdata_uflags_or_other = v94; _5B65B0_npcdata_rep_or_other = v126; if ( v129 == -1 ) @@ -18123,7 +18130,7 @@ v98 = v129 & stru_5C6E00->uDoublePiMask; _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; } - v99 = &v10->f[31]; + v99 = (char *)&_evt->v31; _5B65B8_npcdata_hiword_house_or_other = v95; dword_5B65BC = v97; v100 = v94 | v132 | v126 | v95 | v97 | v98; @@ -18193,25 +18200,25 @@ v120 = 0; v116 = 0; v111 = 0; - v110 = v10->f[13] + ((v10->f[14] + ((v10->f[15] + (v10->f[16] << 8)) << 8)) << 8); - v109 = v10->f[9] + ((v10->f[10] + ((v10->f[11] + (v10->f[12] << 8)) << 8)) << 8); + v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); + v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); v108 = 0; v107 = 0; - v106 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); + v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); goto LABEL_280; case EVENT_GiveItem: item.Reset(); - v101 = &pSomeEVT[v9]; - v102 = (unsigned __int8)v101[7] - + (((unsigned __int8)v101[8] + (((unsigned __int8)v101[9] + ((unsigned __int8)v101[10] << 8)) << 8)) << 8); - pItemsTable->GenerateItem((unsigned __int8)v101[5], (unsigned __int8)v101[6], &item); + //v101 = &pSomeEVT[v9]; + v102 = _evt->v7 + + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); if ( v102 ) item.uItemID = v102; pParty->SetHoldingItem(&item); goto LABEL_291; case EVENT_SpeakInHouse: - v103 = v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8); - if ( EnterHouse((enum HOUSE_TYPE)(v10->f[5] + ((v10->f[6] + ((v10->f[7] + (v10->f[8] << 8)) << 8)) << 8))) ) + v103 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + if ( EnterHouse((enum HOUSE_TYPE)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) ) { if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) pRenderer->_49FD3A(); @@ -18221,11 +18228,11 @@ if ( uCurrentHouse_Animation != 167 ) v104 = v103; ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); - ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, v7, 0); - ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, v7, 0); - ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, v7, 0); - ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, v7, 0); - ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, v7, 0); + ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); + ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); + ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); + ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); + ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); } goto LABEL_291; default: @@ -18238,11 +18245,11 @@ goto LABEL_301; } } - ++v4; - v124 = v4; - if ( v4 >= (signed int)uSomeEVT_NumEvents ) - goto LABEL_301; - } + //++v4; + //v124 = v4; + //if ( v4 >= (signed int)uSomeEVT_NumEvents ) + //goto LABEL_301; + //} } }
--- a/mm7_data.cpp Mon Oct 22 09:18:21 2012 +0600 +++ b/mm7_data.cpp Mon Oct 22 09:20:49 2012 +0600 @@ -1064,9 +1064,18 @@ char byte_4E8168[116]; char aD3dTextureName[777]; // idb char aLogd3d_txt[777]; // idb -char byte_4E8398[777]; // weak -_UNKNOWN unk_4E83B0; // weak -_UNKNOWN unk_4E8408; // weak +char byte_4E8394[204] = +{ + 0, 0, 0, 0, 1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, + 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 1, + 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0 +}; stru355 stru_4E82A4 = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000}; stru355 stru_4EFCBC = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000}; char aGlobal_txt[777]; // idb @@ -1955,14 +1964,25 @@ unsigned int pHiredNPCsIconsOffsetsY[2]; int dword_4EE07C[2]; // weak _UNKNOWN unk_4EE084; // weak -__int16 word_4EE088_sound_ids[777]; // weak -__int16 word_4EE09A; // weak -__int16 word_4EE0A6; // weak -__int16 word_4EE128; // weak -__int16 word_4EE142; // weak -__int16 word_4EE150[28]; -char aInvalidPicture[777]; // idb -char aEWorkMsdevM_19[37]; // weak +__int16 word_4EE088_sound_ids[100] = +{ + 0, 10000, 10010, 10020, 10030, 10040, 10050, 10060, 10070, 10080, + 10090, 10100, 11000, 11010, 11020, 11030, 11040, 11050, 11060, 11070, + 11080, 11090, 11100, 12000, 12010, 12020, 12030, 12040, 12050, 12060, + 12070, 12080, 12090, 12100, 13000, 13010, 13020, 13030, 13040, 13050, + 13060, 13070, 13080, 13090, 13100, 14000, 14010, 14020, 14030, 14040, + 14050, 14060, 14070, 14080, 14090, 14100, 15000, 15010, 15020, 15030, + 15040, 15050, 15060, 15070, 15080, 15090, 15100, 16000, 16010, 16020, + 16030, 16040, 16050, 16060, 16070, 16080, 16090, 16100, 17000, 17010, + 17020, 17030, 17040, 17050, 17060, 17070, 17080, 17090, 17100, 18000, + 18010, 18020, 18030, 18040, 18050, 18060, 18070, 18080, 18090, 18100 +}; +short word_4EE150[28] = +{ + 1, 2, 3, 4, 5, 7, 32, 33, 36, 37, 38, 40, 41, 42, 43, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 60 +}; + char aDD[777]; // idb char off_4EE75C[777]; // idb char aFacemask[777]; // idb
--- a/mm7_data.h Mon Oct 22 09:18:21 2012 +0600 +++ b/mm7_data.h Mon Oct 22 09:20:49 2012 +0600 @@ -1051,9 +1051,7 @@ extern char byte_4E8168[116]; extern char aD3dTextureName[]; // idb extern char aLogd3d_txt[]; // idb -extern char byte_4E8398[]; // weak -extern _UNKNOWN unk_4E83B0; // weak -extern _UNKNOWN unk_4E8408; // weak +extern char byte_4E8394[]; // weak #include "Texture.h" extern stru355 stru_4E82A4;// = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000}; extern stru355 stru_4EFCBC;// = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000}; @@ -1936,13 +1934,7 @@ extern int dword_4EE07C[2]; // weak extern _UNKNOWN unk_4EE084; // weak extern __int16 word_4EE088_sound_ids[]; // weak -extern __int16 word_4EE09A; // weak -extern __int16 word_4EE0A6; // weak -extern __int16 word_4EE128; // weak -extern __int16 word_4EE142; // weak -extern __int16 word_4EE150[28]; -extern char aInvalidPicture[]; // idb -extern char aEWorkMsdevM_19[37]; // weak +extern short word_4EE150[]; extern char aDD[]; // idb extern char off_4EE75C[]; // idb extern char aFacemask[]; // idb @@ -3162,7 +3154,7 @@ void __cdecl sub_44603D(); int __fastcall PrepareHouse(unsigned int uHouseID); // idb bool __fastcall EnterHouse(enum HOUSE_TYPE uHouseID); -signed int __thiscall sub_4465DF_check_season(void *_this); +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(); bool __thiscall sub_4466C4(void *_this); @@ -3334,7 +3326,7 @@ void __cdecl InitializeTransitions(); void __cdecl InitializeAutonotes(); void __cdecl InitializeQuests(); -int __stdcall const_1(int); // weak +int __fastcall const_1(int, int); // weak int __cdecl GetPartyReputation(); void __cdecl sub_4783FA_construct_global_73D150(); void __cdecl loc_4789D4(); // idb
--- a/stru176.h Mon Oct 22 09:18:21 2012 +0600 +++ b/stru176.h Mon Oct 22 09:20:49 2012 +0600 @@ -15,7 +15,10 @@ __int16 field_12; __int16 field_14; __int16 field_16; - char field_18[8]; + __int16 field_18; + __int16 field_1A; + __int16 field_1C; + __int16 field_1E; }; #pragma pack(pop) extern stru176 array_5B5928[100];