Mercurial > mm7
changeset 361:b803545c1b96
Слияние
author | Ritor1 |
---|---|
date | Thu, 21 Feb 2013 22:42:52 +0600 |
parents | 90017057667f (current diff) 57d81602e72c (diff) |
children | 38bfbee60146 |
files | mm7_4.cpp |
diffstat | 33 files changed, 1451 insertions(+), 1449 deletions(-) [+] |
line wrap: on
line diff
--- a/Arcomage.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/Arcomage.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -5641,8 +5641,8 @@ pArcomageGame->uGameResult = v0; if ( v0 == 1 ) { - v7 = ptr_507BC0; - v8 = (signed int)ptr_507BC0->ptr_1C; + v7 = window_SpeakInHouse; + v8 = (signed int)window_SpeakInHouse->ptr_1C; if ( v8 >= 108 ) { if ( v8 <= 120 )
--- a/Bink_Smacker.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/Bink_Smacker.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -23,6 +23,7 @@ void (__stdcall *smackw32_SmackBlitClose)(HSMACKBLIT) = 0; int (__stdcall *smackw32_SmackBlitClear)(HSMACKBLIT, unsigned short *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int) = 0; int (__stdcall *smackw32_SmackGoto)(_SMACK *, long) = 0; +int (__stdcall *smackw32_SmackBufferOpen)(HWND a1, long a2, long a3, long a4, long a5, long a6) = nullptr; void SMACKW32_DLL_Initialize() { HMODULE pDll = LoadLibraryW(L"SmackW32.dll"); @@ -44,6 +45,7 @@ smackw32_SmackBlitClose = (void (__stdcall *)(HSMACKBLIT))GetProcAddress(pDll, "_SmackBlitClose@4"); smackw32_SmackBlitClear = (int (__stdcall *)(HSMACKBLIT, unsigned short *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int))GetProcAddress(pDll, "_SmackBlitClear@32"); smackw32_SmackGoto = (int (__stdcall *)(_SMACK *, long))GetProcAddress(pDll, "_SmackGoto@8"); + smackw32_SmackBufferOpen = (int (__stdcall *)(HWND, long, long, long, long, long))GetProcAddress(pDll, "_SmackBufferOpen@24"); } @@ -139,13 +141,12 @@ int __stdcall SmackBufferOpen(HWND a1, long a2, long a3, long a4, long a5, long a6) { - __asm int 3 - return 0; + return (smackw32_SmackBufferOpen)(a1, a2, a3, a4, a5, a6); } -int __fastcall SmackVolumePan(long a1, long a2, _SMACK *a3, long a4, long a5, long a6) +int __fastcall SmackVolumePan(_SMACK *a3, long a4, long a5, long a6) { - __asm int 3 + //__asm int 3 return 0; } @@ -153,14 +154,14 @@ // sub_4D83D0: using guessed type int __stdcall SmackBufferNewPalette(_DWORD, _DWORD, _DWORD); int __stdcall SmackBufferNewPalette(long a1, long a2, long a3) { - __asm int 3 + //__asm int 3 return 0; } // sub_4D83D4: using guessed type int __stdcall SmackColorRemapWithTrans(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); int __stdcall SmackColorRemapWithTrans(long a1, long a2, long a3, long a4, long a5) { - __asm int 3 + //__asm int 3 return 0; }
--- a/Bink_Smacker.h Thu Feb 21 22:42:35 2013 +0600 +++ b/Bink_Smacker.h Thu Feb 21 22:42:52 2013 +0600 @@ -168,7 +168,7 @@ int __stdcall SmackBufferOpen(HWND a1, long a2, long a3, long a4, long a5, long a6); -int __fastcall SmackVolumePan(long a1, long a2, _SMACK *a3, long a4, long a5, long a6); +int __fastcall SmackVolumePan(_SMACK *a3, long a4, long a5, long a6); int __stdcall SmackGoto(_SMACK *a1, long a2);
--- a/Events.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/Events.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -122,11 +122,11 @@ if (!uLevelEVT_Size) return; - memset(array_5B5928, 0, 3200); - memset(pLevelEVT_Index, 80, 52800); + memset(array_5B5928_timers, 0, 3200); + memset(pLevelEVT_Index, 80, sizeof(EventIndex)*4400); uLevelEVT_NumEvents = 0; - dword_5B65C8 = 0; + dword_5B65C8_timers_count = 0; for (uint i = 0, j = 0; j < uLevelEVT_Size; ++i) { @@ -143,7 +143,7 @@ void EventProcessor(int uEventID, int a2, int a3) { unsigned int v3; // eax@5 - //signed int v4; // esi@7 + signed int v4; // esi@7 //char *v5; // eax@8 Player *v6; // ecx@8 //char *v7; // ebp@8 @@ -263,10 +263,10 @@ int v121; // [sp-4h] [bp-4ACh]@294 int curr_seq_num; // [sp+10h] [bp-498h]@4 //char *v123; // [sp+14h] [bp-494h]@0 - //signed int v124; // [sp+18h] [bp-490h]@7 + 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 player_choose; // [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 @@ -294,54 +294,57 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here return; } - v127 = 2 * (uActiveCharacter == 0) + 4; //4 and 6 - curr_seq_num = dword_597F18; + player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 + curr_seq_num = start_event_seq_number; if ( _5C3420_pDecoration ) { uSomeEVT_NumEvents = uGlobalEVT_NumEvents; pSomeEVT = pGlobalEVT; - memcpy(pSomeEVT_Events, pGlobalEVT_Index, 52800); //4400 evts + memcpy(pSomeEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); //4400 evts } else { uSomeEVT_NumEvents = uLevelEVT_NumEvents; pSomeEVT = pLevelEVT; - memcpy(pSomeEVT_Events, pLevelEVT_Index, 52800); + memcpy(pSomeEVT_Events, pLevelEVT_Index, sizeof(EventIndex)*4400); } - //v4 = 0; - //v124 = 0; - for (uint i = 0; i < uSomeEVT_NumEvents; ++i) - { - //v5 = pSomeEVT; + v4 = 0; + v124 = 0; + //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) + // { + //v6 = v123; //v7 = ""; - //while ( 1 ) - //{ + while ( 1 ) + { if ( dword_5B65C4 ) goto LABEL_301; //v8 = v4; - if ( pSomeEVT_Events[i/*v4*/].uEventID == uEventID && pSomeEVT_Events[i/*v4*/].event_sequence_num == curr_seq_num ) + if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num ) { //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; //v10 = (ByteArray *)&v5[v9]; - auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[i/*v4*/].uEventOffsetInEVT); + auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT); switch (_evt->_e_type) { case EVENT_CheckSeason: + // if ( !sub_4465DF_check_season(_evt->v5) ) { ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; } - v11 = _evt->v6; - goto LABEL_130; + v124 = -1; + curr_seq_num = _evt->v6 - 1; + ++curr_seq_num; + break; case EVENT_ShowMovie: { strcpy(Source, (char *)&_evt->v7); @@ -380,8 +383,8 @@ if (pAsyncMouse) pAsyncMouse->Resume(); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -403,8 +406,8 @@ if (pAsyncMouse) pAsyncMouse->Resume(); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; @@ -427,8 +430,8 @@ if (pAsyncMouse) pAsyncMouse->Resume(); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; } @@ -436,21 +439,21 @@ case EVENT_CheckSkill: { v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); - if ( v127 < 0 ) + if ( player_choose < 0 ) goto LABEL_47; - if ( v127 <= 3 ) + if ( player_choose <= 3 ) { - v24 = pParty->pPlayers[0].pActiveSkills[3486 * v127 + _evt->v5]; + v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5]; } else { - if ( v127 == 4 ) + if ( player_choose == 4 ) { v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; } else { - if ( v127 == 5 ) + if ( player_choose == 5 ) { v20 = 0; v21 = 3486 * v130 + _evt->v5; @@ -467,8 +470,8 @@ if ( v20 >= 4 ) { ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -492,8 +495,8 @@ goto LABEL_130; } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; } @@ -517,8 +520,8 @@ + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -535,8 +538,8 @@ LOBYTE(v26->field_2) |= 0x20u; } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -546,8 +549,8 @@ pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; pNPCStats->pNewNPCData[v27].greet = v28; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -605,25 +608,25 @@ if ( v30 == 78 ) { sub_4BD8B5(); - ptr_507BC0->Release(); + window_SpeakInHouse->Release(); pParty->uFlags &= 0xFFFFFFFDu; if ( EnterHouse((enum HOUSE_TYPE)170) ) { 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, "", 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); + window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); + window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); + window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); + window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); + window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); + window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); ptr_F8B1E8 = pNPCTopics[90].pText; } } } ++curr_seq_num; } - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -631,8 +634,8 @@ sub_448518_npc_set_item(_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); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -640,16 +643,16 @@ Actor::GiveItem(_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); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_SetNPCGroupNews: pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -657,8 +660,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); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -680,8 +683,8 @@ while ( v40 ); } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -703,8 +706,8 @@ while ( v44 ); } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -712,21 +715,21 @@ { pNPCStats->pNewNPCData[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)].Location2D = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - if ( ptr_507BC0 ) + if ( window_SpeakInHouse ) { - v46 = ptr_507BC0->ptr_1C; + v46 = window_SpeakInHouse->ptr_1C; if ( v46 == (void *)165 ) { sub_4BD8B5(); pVideoPlayer->Unload(); - ptr_507BC0->Release(); + window_SpeakInHouse->Release(); pParty->uFlags &= 0xFFFFFFFDu; _5C3420_pDecoration = (LevelDecoration *)1; if ( EnterHouse((enum HOUSE_TYPE)165) ) { pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); - ptr_507BC0 = v47; + window_SpeakInHouse = v47; v48 = v47->pControlsHead; if ( v48 ) { @@ -737,11 +740,11 @@ v48 = v49; } while ( v49 ); - v47 = ptr_507BC0; + v47 = window_SpeakInHouse; } v47->pControlsHead = 0; - ptr_507BC0->pControlsTail = 0; - ptr_507BC0->uNumControls = 0; + window_SpeakInHouse->pControlsTail = 0; + window_SpeakInHouse->uNumControls = 0; } } else @@ -752,127 +755,58 @@ } ++curr_seq_num; } - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_Jmp: - //v124 = -1; curr_seq_num = _evt->v5 - 1; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + //v4 = -1; + //v6 = v123; //v7 = ""; break; case EVENT_ShowFace: - v50 = _evt->v5; - if ( (unsigned __int8)v50 <= 3u ) + if ( _evt->v5 <= 3u ) //someone + pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); + else if ( _evt->v5 == 4 ) //active + pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); + else if ( _evt->v5 == 5 ) //all players { - v117 = 0; - v113 = _evt->v6; - v53 = (unsigned __int8)v50; - v52 = &pParty->pPlayers[v53]; - v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; + for(int i=0; i<4; ++i) + pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); } - if ( v50 == 4 ) - { - v117 = 0; - v113 = _evt->v6; - v52 = pPlayers[uActiveCharacter]; - v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); + else //random player + pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - if ( v50 != 5 ) - { - v117 = 0; - v113 = _evt->v6; - v53 = rand() % 4; - v52 = &pParty->pPlayers[v53]; - v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; - break; - } - v51 = pParty->pPlayers; - do - { - v51->PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); - ++v51; - } - while ( (signed int)v51 < (signed int)pParty->pHirelings ); - //LABEL_291: - ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_CharacterAnimation: - v54 = _evt->v5; - if ( (unsigned __int8)v54 <= 3u ) - { - v118 = 0; - v114 = _evt->v6; - v57 = (unsigned __int8)v54; - goto LABEL_119; - } - if ( v54 == 4 ) - { - v118 = 0; - v114 = _evt->v6; - v56 = pPlayers[uActiveCharacter]; - goto LABEL_120; - } - if ( v54 != 5 ) - { - v118 = 0; - v114 = _evt->v6; - v57 = rand() % 4; -LABEL_119: - v56 = &pParty->pPlayers[v57]; -LABEL_120: - v56->PlaySound((PlayerSpeech)v114, v118); - ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + if ( _evt->v5 <= 3u ) //someone + pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); + else if ( _evt->v5 == 4 ) //active + pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0); + else if ( _evt->v5 == 5 ) //all + for(int i=0; i<4; ++i) + pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); + else //random + pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); + ++curr_seq_num; + v4 = v124; + //v6 = v123; //v7 = ""; - break; - } - v55 = pParty->pPlayers; - for (int iii = 0; iii < 4; ++iii) - { - v55->PlaySound((PlayerSpeech)_evt->v6, 0); - ++v55; - } - //while ( (signed int)v55 < (signed int)pParty->pHirelings ); - ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; - //v6 = v123; - //v7 = ""; break; case EVENT_ForPartyMember: - v127 = _evt->v5; + player_choose = _evt->v5; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -884,14 +818,14 @@ _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), _evt->v25, _evt->v26, 0, 0); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_Compare: v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - if ( v127 == 5 ) + if ( player_choose == 5 ) { v130 = 0; v59 = pParty->pPlayers; @@ -905,8 +839,8 @@ if ( (signed int)v59 >= (signed int)pParty->pHirelings ) { ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -916,12 +850,12 @@ v11 = _evt->v11; goto LABEL_130; } - if ( v127 < 0 ) + if ( player_choose < 0 ) goto LABEL_139; - v61 = v127; - if ( v127 <= 3 ) + v61 = player_choose; + if ( player_choose <= 3 ) goto LABEL_137; - if ( v127 == 4 ) + if ( player_choose == 4 ) { if ( uActiveCharacter ) { @@ -931,11 +865,11 @@ } else { - if ( v127 != 6 ) + if ( player_choose != 6 ) goto LABEL_139; } v61 = rand() % 4; - //v5 = pSomeEVT; + LABEL_137: v6 = &pParty->pPlayers[v61]; LABEL_138: @@ -948,8 +882,8 @@ if ( v62 ) goto LABEL_129; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -968,8 +902,8 @@ { pMouse->RemoveHoldingItem(); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -983,8 +917,8 @@ { v66->RemoveItemAtInventoryIndex(v65); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1001,8 +935,8 @@ { *(&v66->pEquipment.uOffHand + v68) = 0; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1049,30 +983,30 @@ if ( v125 > (signed int)&pPlayers[4] ) { ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; } } } - v75 = v127; - if ( v127 != 5 ) + v75 = player_choose; + if ( player_choose != 5 ) { - if ( v127 < 0 ) + if ( player_choose < 0 ) goto LABEL_183; - if ( v127 > 3 ) + if ( player_choose > 3 ) { - if ( v127 != 4 ) + if ( player_choose != 4 ) { - if ( v127 == 6 ) + if ( player_choose == 6 ) goto LABEL_180; LABEL_183: ((Player *)v6)->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1084,7 +1018,7 @@ } LABEL_180: v75 = rand() % 4; - //v5 = pSomeEVT; + } v6 = &pParty->pPlayers[v75]; LABEL_182: @@ -1102,29 +1036,29 @@ } while ( (signed int)v76 < (signed int)pParty->pHirelings ); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_Set: v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - v78 = v127; - if ( v127 != 5 ) + v78 = player_choose; + if ( player_choose != 5 ) { - if ( v127 < 0 ) + if ( player_choose < 0 ) goto LABEL_197; - if ( v127 > 3 ) + if ( player_choose > 3 ) { - if ( v127 != 4 ) + if ( player_choose != 4 ) { - if ( v127 == 6 ) + if ( player_choose == 6 ) goto LABEL_194; LABEL_197: ((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1136,7 +1070,7 @@ } LABEL_194: v78 = rand() % 4; - //v5 = pSomeEVT; + } v6 = &pParty->pPlayers[v78]; LABEL_196: @@ -1154,23 +1088,23 @@ } while ( (signed int)v79 < (signed int)pParty->pHirelings ); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_Add: v80 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - v81 = v127; - if ( v127 != 5 ) + v81 = player_choose; + if ( player_choose != 5 ) { - if ( v127 < 0 ) + if ( player_choose < 0 ) goto LABEL_211; - if ( v127 > 3 ) + if ( player_choose > 3 ) { - if ( v127 != 4 ) + if ( player_choose != 4 ) { - if ( v127 == 6 ) + if ( player_choose == 6 ) goto LABEL_208; LABEL_211: ((Player *)v6)->AddVariable( @@ -1185,7 +1119,7 @@ } LABEL_208: v81 = rand() % 4; - //v5 = pSomeEVT; + } v6 = &pParty->pPlayers[v81]; LABEL_210: @@ -1207,13 +1141,13 @@ if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) viewparams->bRedrawGameUI = 1; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_InputString: - if ( !dword_597F18 ) + if ( !start_event_seq_number ) { strcpy( GameUI_StatusBar_TimedString, @@ -1244,8 +1178,8 @@ curr_seq_num = v11 - 1; } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1269,8 +1203,8 @@ if ( !uActiveCharacter ) { ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1290,8 +1224,8 @@ LABEL_234: v88->ReceiveDamage(v115, v119); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1304,16 +1238,16 @@ } while ( (signed int)v87 < (signed int)pParty->pHirelings ); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_ToggleIndoorLight: pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1321,8 +1255,8 @@ sub_44892E_set_faces_bit(_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); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1330,8 +1264,8 @@ Chest::ToggleFlag(_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); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1339,8 +1273,8 @@ Actor::ToggleFlag(_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); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1350,8 +1284,8 @@ _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1359,8 +1293,8 @@ if ( !_evt->v5 ) pWeather->bRenderSnow = _evt->v6 != 0; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1372,8 +1306,8 @@ { ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1384,8 +1318,8 @@ //LABEL_248: ShowStatusBarString(v91, 2u); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1398,16 +1332,16 @@ v91 = &pLevelStr[pLevelStrOffsets[v90]]; ShowStatusBarString(v91, 2u); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; } } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1424,8 +1358,8 @@ strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]); } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1437,24 +1371,24 @@ _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8), _evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8)); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_SetTexture: sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_SetSprite: SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1466,8 +1400,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)); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1475,16 +1409,16 @@ case EVENT_LocationName: --curr_seq_num; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; case EVENT_ChangeDoorState: sub_449A49_door_switch_animation(_evt->v5, _evt->v6); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1492,8 +1426,8 @@ if ( !Chest::Open(_evt->v5) ) goto LABEL_301; ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1578,8 +1512,8 @@ while ( sub_4BD8B5() ) ; pVideoPlayer->Unload(); - ptr_507BC0->Release(); - ptr_507BC0 = 0; + window_SpeakInHouse->Release(); + window_SpeakInHouse = 0; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pCurrentScreen = SCREEN_GAME; @@ -1594,8 +1528,8 @@ } } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1619,13 +1553,12 @@ item.uItemID = v102; pParty->SetHoldingItem(&item); ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; - case EVENT_SpeakInHouse: - v103 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + case EVENT_SpeakInHouse: if ( EnterHouse((enum HOUSE_TYPE)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) ) { if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) @@ -1634,17 +1567,17 @@ pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); v104 = 187; 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, "", 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); + v104 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); + window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); + window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); + window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); + window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); + window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); } ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; @@ -1656,17 +1589,17 @@ goto LABEL_301; default: ++curr_seq_num; - //v4 = v124; - //v5 = pSomeEVT; + v4 = v124; + //v6 = v123; //v7 = ""; break; } } - //++v4; - //v124 = v4; - //if ( v4 >= (signed int)uSomeEVT_NumEvents ) - //goto LABEL_301; + ++v4; + v124 = v4; + if ( v4 >= uSomeEVT_NumEvents ) + goto LABEL_301; //} } }
--- a/Events.h Thu Feb 21 22:42:35 2013 +0600 +++ b/Events.h Thu Feb 21 22:42:52 2013 +0600 @@ -292,8 +292,10 @@ VAR_ItemEquipped = 0x13B, }; - - +#define EVT_WORD(x) *(unsigned __int16*)&x +#define EVT_DWORD(x) *(unsigned int*)&x +#define EVT_STRING(x) (unsigned char*)&x +#define EVT_BYTE(x) (unsigned char)x extern EventIndex pSomeOtherEVT_Events[4400]; extern unsigned int uSomeOtherEVT_NumEvents;
--- a/GUIButton.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/GUIButton.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -73,7 +73,7 @@ struct GUIWindow *pPrimaryWindow; struct GUIWindow *pChestWindow; struct GUIWindow *pDialogueWindow; -struct GUIWindow *ptr_507BC0; +struct GUIWindow *window_SpeakInHouse; struct GUIWindow *pGUIWindow_ScrollWindow; struct GUIWindow *ptr_507BC8; struct GUIWindow *pGUIWindow_CurrentMenu;
--- a/GUIButton.h Thu Feb 21 22:42:35 2013 +0600 +++ b/GUIButton.h Thu Feb 21 22:42:52 2013 +0600 @@ -99,7 +99,7 @@ extern struct GUIWindow *pPrimaryWindow; extern struct GUIWindow *pChestWindow; extern struct GUIWindow *pDialogueWindow; -extern struct GUIWindow *ptr_507BC0; +extern struct GUIWindow *window_SpeakInHouse; extern struct GUIWindow *pGUIWindow_ScrollWindow; extern struct GUIWindow *ptr_507BC8; extern struct GUIWindow *pGUIWindow_CurrentMenu;
--- a/GUIWindow.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/GUIWindow.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -721,7 +721,8 @@ { v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * dword_506528]; v24 = dword_506528 + 1; - v22 = (char *)&pStorylineText->StoreLine[dword_506528].pPageTitle;//guess //field_4[3 * dword_506528 + 2]; + //v22 = (char *)&pStorylineText->StoreLine[dword_506528].pPageTitle;//guess //field_4[3 * dword_506528 + 2]; + v22 = (char *)&pStorylineText->StoreLine[dword_506528+1].pText; do { v4 = *(char **)v22; @@ -751,7 +752,8 @@ ++v24; //__debugbreak(); // fix condition } - while ( (signed int)v22 < (signed int)&pFactionTable->relations + 8 ); + //while ( (signed int)v22 < (signed int)&pFactionTable->relations + 8 ); + while ( (signed int)v22 <= (signed int)&pStorylineText->StoreLine[30].uTime ); } } } @@ -984,9 +986,9 @@ if (!chapter->bIsSpellAvailable[i]) continue; - v4 = 2 * (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); - CreateButton(pViewport->uViewportX + dword_4E20D0[v4], - pViewport->uViewportY + dword_4E20D0[v4 + 1], + v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); + CreateButton(pViewport->uViewportX + pIconPos[v4].Xpos, + pViewport->uViewportY + pIconPos[v4].Ypos, //dword_4E20D0 dword_506408[i + 1]->uTextureWidth, dword_506408[i + 1]->uTextureHeight, 1, 79, 0x56u, i, 0, "", 0); @@ -1047,7 +1049,7 @@ GUIWindow v18; // [sp+60h] [bp-58h]@2 int v19; // [sp+B4h] [bp-4h]@2 - if ( !ptr_507BC0 ) + if ( !window_SpeakInHouse ) return; memcpy(&v18, this, sizeof(v18)); v18.uFrameWidth -= 18; @@ -1062,7 +1064,7 @@ w.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight); //v2 = (const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C]; - v2 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pName; + v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName; if ( v2 ) { @@ -1071,7 +1073,7 @@ v3 = 0; v18.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, v1, //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C], - p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pName, 3); + p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName, 3); } } v18.uFrameWidth += 8; @@ -1094,7 +1096,7 @@ (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v5 + 7)); pRenderer->DrawTextureIndexed(8u, 347 - v6, pTexture_591428); v7 = FitTextInAWindow(ptr_F8B1E8, pFontArrus, &w, 0xDu, 0); - ptr_507BC0->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0); + window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0); } v8 = 0; if ( uNumDialogueNPCPortraits <= 0 ) @@ -1125,7 +1127,7 @@ { v15 = 3; //v13 = (char *)p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C]; - v13 = (char *)p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pProprieterTitle; + v13 = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle; v11 = v19; v10 = 113; LABEL_56: @@ -1157,9 +1159,9 @@ { sprintfex( pTmpBuf, pGlobalTXT_LocalizationStrings[429], //p2DEvents_minus1_::08[13 * (unsigned int)ptr_507BC0->ptr_1C], - p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pProprieterName, + p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName, //p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C]); - p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pProprieterTitle); + p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle); v18.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v19, pTmpBuf, 3u); if ( dword_F8B198 <= 18 ) { @@ -1992,7 +1994,7 @@ } if ( v25 == 1 ) { - ptr_507BC0 = &pWindowList[uNextFreeWindowID]; + window_SpeakInHouse = &pWindowList[uNextFreeWindowID]; _4B4224_UpdateNPCTopics(0); } }
--- a/GUIWindow.h Thu Feb 21 22:42:35 2013 +0600 +++ b/GUIWindow.h Thu Feb 21 22:42:52 2013 +0600 @@ -212,7 +212,7 @@ UIMSG_68 = 0x68, UIMSG_69 = 0x69, UIMSG_QuickReference = 0x6A, - UIMSG_6B = 0x6B, + UIMSG_GameMenuButton = 0x6B, UIMSG_AlreadyResting = 0x6D, UIMSG_SelectCharacter = 0x6E, UIMSG_ChangeSoundVolume = 0x6F,
--- a/MM7.h Thu Feb 21 22:42:35 2013 +0600 +++ b/MM7.h Thu Feb 21 22:42:52 2013 +0600 @@ -66,58 +66,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* 154 */ #pragma pack(push, 1) struct stru161 @@ -141,34 +89,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* 285 */ #pragma pack(push, 1) struct stru289 @@ -245,7 +165,12 @@ /* 349 */ enum HOUSE_TYPE { - HOUSE_BODY_GUILD_NOVICE_EMERALD_ISLE = 0xA3, + HOUSE_SMITH_EMERALD_ISLE = 1, + HOUSE_BODY_GUILD_NOVICE_EMERALD_ISLE = 163, + HOUSE_186 = 186, + HOUSE_JAIL = 187, + HOUSE_600 = 600, + HOUSE_601 = 601 };
--- a/NPC.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/NPC.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -680,7 +680,7 @@ //----- (00476395) -------------------------------------------------------- //0x26 Wizard eye at skill level 2 bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession) - { +{ bool result; // eax@2 signed int v2; // esi@3 char *v3; // eax@4
--- a/NPC.h Thu Feb 21 22:42:35 2013 +0600 +++ b/NPC.h Thu Feb 21 22:42:52 2013 +0600 @@ -22,7 +22,89 @@ int fame; //c int rep; //10 unsigned int Location2D; //14 - unsigned int uProfession; //18 + unsigned int uProfession; //18 CheckHiredNPCSpeciality(uProfession) + /* + + case PLAYER_SKILL_MONSTER_ID: + if ( CheckHiredNPCSpeciality(58) ) + skill += 6; + if ( CheckHiredNPCSpeciality(57) ) + skill += 6; + + case PLAYER_SKILL_ARMSMASTER: + if ( CheckHiredNPCSpeciality(15) ) + skill += 2; + if ( CheckHiredNPCSpeciality(16) ) + skill += 3; + + case PLAYER_SKILL_STEALING: + if (CheckHiredNPCSpeciality(51)) + skill += + + case PLAYER_SKILL_ALCHEMY: + if ( CheckHiredNPCSpeciality(23) ) + skill += 4; + if ( CheckHiredNPCSpeciality(24) ) + skill += 8 + + case PLAYER_SKILL_LEARNING: + if ( CheckHiredNPCSpeciality(13) ) + skill += 10; + if ( CheckHiredNPCSpeciality(14) ) + skill += 15; + if ( CheckHiredNPCSpeciality(4) ) + skill += 5; + + case PLAYER_SKILL_UNARMED: + if (CheckHiredNPCSpeciality(56) ) + skill + + + case PLAYER_SKILL_DODGE: + if ( CheckHiredNPCSpeciality(56) ) + skill+ + + case PLAYER_SKILL_MERCHANT: + if ( CheckHiredNPCSpeciality(20) ) + skill += 4; + if ( CheckHiredNPCSpeciality(21) ) + skill += 6; + if ( CheckHiredNPCSpeciality(48) ) + skill += 3; + if ( CheckHiredNPCSpeciality(50) ) + skill += 8; + + case PLAYER_SKILL_PERCEPTION: + if ( CheckHiredNPCSpeciality(22) ) + v2 = 6; + if ( CheckHiredNPCSpeciality(47) ) + v2 += 5; + + case PLAYER_SKILL_TRAP_DISARM: + if ( CheckHiredNPCSpeciality(25) ) + v2 = 4; + if ( CheckHiredNPCSpeciality(26) ) + v2 += 6; + if ( CheckHiredNPCSpeciality(51) ) + v2 += 8; + + FIRE WATER EARTH AIR + if ( CheckHiredNPCSpeciality(17) ) + v2 = 2; + if ( CheckHiredNPCSpeciality(18) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(19) ) + v2 += 4; + if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) + v2 += 3; + + SPIRIT MIND BODY + if ( CheckHiredNPCSpeciality(53) ) + v2 = 2; + if ( CheckHiredNPCSpeciality(54) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(55) ) + v2 += 4; + */ int greet; //1c int joins; //20 int field_24;
--- a/Party.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/Party.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -888,7 +888,7 @@ //unsigned int v10; // edi@62 //signed int v11; // [sp+0h] [bp-4h]@2 - if (dword_A75070 == stru_51076C.field_8) + if (dword_A75070 == stru_51076C.field_8) // stru_51076C.field_8 is incremented each time after this function is called, so this is useless return; dword_A75070 = stru_51076C.field_8;
--- a/Party.h Thu Feb 21 22:42:35 2013 +0600 +++ b/Party.h Thu Feb 21 22:42:52 2013 +0600 @@ -280,7 +280,7 @@ char field_15FF2[130]; char pHireling1Name[100]; char pHireling2Name[100]; - int field_1613C; + int armageddon_timer; int field_16140; int pTurnBasedPlayerRecoveryTimes[4]; char field_16154[212];
--- a/Player.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/Player.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -445,7 +445,7 @@ char v3; // zf@4 v1 = this; - v2 = (signed int)ptr_507BC0->ptr_1C; + v2 = (signed int)window_SpeakInHouse->ptr_1C; if ( v2 == 78 || v2 > 80 && v2 <= 82 ) { if ( GetMajorConditionIdx() == 18 ) @@ -4411,8 +4411,7 @@ //----- (0048E6DC) -------------------------------------------------------- unsigned int Player::GetBaseAge() { - return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - - uBirthYear + 1168; + return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; } //----- (0048E72C) -------------------------------------------------------- @@ -5644,260 +5643,238 @@ } //----- (0048F882) -------------------------------------------------------- -char Player::GetActualSkillLevel(enum PLAYER_SKILL_TYPE uSkillType) +char 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 + //unsigned int v7; // [sp-4h] [bp-14h]@35 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 - Player *v9; // [sp+Ch] [bp-4h]@1 - + //Player *v9; // [sp+Ch] [bp-4h]@1 + v2 = 0; - v9 = this; - if ( uSkillType > PLAYER_SKILL_DODGE ) - { - if ( uSkillType != PLAYER_SKILL_UNARMED ) - { - if ( uSkillType == PLAYER_SKILL_MONSTER_ID ) - { - if ( CheckHiredNPCSpeciality(0x3Au) ) - v2 = 6; - if ( CheckHiredNPCSpeciality(0x39u) ) - v2 += 6; - goto LABEL_83; - } - if ( uSkillType == PLAYER_SKILL_ARMSMASTER ) - { - if ( CheckHiredNPCSpeciality(0xFu) ) + switch (uSkillType) + { + case PLAYER_SKILL_MONSTER_ID: + { + if ( CheckHiredNPCSpeciality(58) ) + v2 = 6; + if ( CheckHiredNPCSpeciality(57) ) + v2 += 6; + v8 = (CHARACTER_ATTRIBUTE_TYPE)20; + v2 += GetItemsBonus(v8, 0); + } + break; + + case PLAYER_SKILL_ARMSMASTER: + { + if ( CheckHiredNPCSpeciality(15) ) v2 = 2; - if ( CheckHiredNPCSpeciality(0x10u) ) - v2 += 3; - goto LABEL_64; - } - if ( uSkillType == PLAYER_SKILL_STEALING ) - { - if ( CheckHiredNPCSpeciality(0x33u) ) - v2 = 8; - goto LABEL_64; - } - if ( uSkillType == PLAYER_SKILL_ALCHEMY ) - { - if ( CheckHiredNPCSpeciality(0x17u) ) - v2 = 4; - if ( CheckHiredNPCSpeciality(0x18u) ) - v2 += 8; - goto LABEL_64; - } - if ( uSkillType == 36 ) // learning - { - if ( CheckHiredNPCSpeciality(0xDu) ) - v2 = 10; - if ( CheckHiredNPCSpeciality(0xEu) ) - v2 += 15; - if ( CheckHiredNPCSpeciality(4u) ) - v2 += 5; - goto LABEL_64; - } - goto LABEL_86; - } - if ( !CheckHiredNPCSpeciality(0x38u) ) - goto LABEL_112; -LABEL_85: - v2 = 2; - goto LABEL_86; - } - if ( uSkillType == PLAYER_SKILL_DODGE ) - { - if ( !CheckHiredNPCSpeciality(0x38u) ) - goto LABEL_112; - v6 = 2; - goto LABEL_51; - } - if ( uSkillType <= PLAYER_SKILL_ITEM_ID ) - { - if ( uSkillType != PLAYER_SKILL_ITEM_ID ) - { - if ( (signed int)uSkillType < 0 ) - goto LABEL_86; - if ( uSkillType > PLAYER_SKILL_PLATE ) - { - if ( uSkillType <= PLAYER_SKILL_EARTH ) - { - if ( CheckHiredNPCSpeciality(0x11u) ) - v2 = 2; - if ( CheckHiredNPCSpeciality(0x12u) ) - v2 += 3; - v5 = 19; - } - else - { - if ( uSkillType > PLAYER_SKILL_BODY ) - goto LABEL_86; - if ( CheckHiredNPCSpeciality(0x35u) ) - v2 = 2; - if ( CheckHiredNPCSpeciality(0x36u) ) - v2 += 3; - v5 = 55; - } - if ( CheckHiredNPCSpeciality(v5) ) - v2 += 4; - if ( v9->classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) + if ( CheckHiredNPCSpeciality(16) ) v2 += 3; -LABEL_86: - if ( uSkillType <= PLAYER_SKILL_DARK ) - { - if ( uSkillType == PLAYER_SKILL_DARK ) - { - v8 = (CHARACTER_ATTRIBUTE_TYPE)42; - } - else - { - if ( uSkillType > PLAYER_SKILL_EARTH ) - { - switch ( uSkillType ) - { - case 16: - v8 = (CHARACTER_ATTRIBUTE_TYPE)38; - break; - case 17: - v8 = (CHARACTER_ATTRIBUTE_TYPE)39; - break; - case 18: - v8 = (CHARACTER_ATTRIBUTE_TYPE)40; - break; - default: - if ( uSkillType != 19 ) - goto LABEL_126; - v8 = (CHARACTER_ATTRIBUTE_TYPE)41; - break; - } - } - else - { - switch ( uSkillType ) - { - case PLAYER_SKILL_EARTH: - v8 = (CHARACTER_ATTRIBUTE_TYPE)37; - break; - case PLAYER_SKILL_BOW: - v8 = (CHARACTER_ATTRIBUTE_TYPE)44; - break; - case PLAYER_SKILL_SHIELD: - v8 = (CHARACTER_ATTRIBUTE_TYPE)45; - break; - case PLAYER_SKILL_FIRE: - v8 = (CHARACTER_ATTRIBUTE_TYPE)34; - break; - case PLAYER_SKILL_AIR: - v8 = (CHARACTER_ATTRIBUTE_TYPE)35; - break; - default: - if ( uSkillType != 14 ) - goto LABEL_126; - v8 = (CHARACTER_ATTRIBUTE_TYPE)36; - break; - } - } - } - goto LABEL_125; - } - if ( uSkillType <= PLAYER_SKILL_MONSTER_ID ) - { - if ( uSkillType != PLAYER_SKILL_MONSTER_ID ) - goto LABEL_112; -LABEL_83: - v8 = (CHARACTER_ATTRIBUTE_TYPE)20; - goto LABEL_125; - } -LABEL_64: - switch ( uSkillType ) - { - case PLAYER_SKILL_ARMSMASTER: - v8 = (CHARACTER_ATTRIBUTE_TYPE)21; - break; - case PLAYER_SKILL_STEALING: - v8 = (CHARACTER_ATTRIBUTE_TYPE)17; - break; - case PLAYER_SKILL_ALCHEMY: - v8 = (CHARACTER_ATTRIBUTE_TYPE)16; - break; - default: - if ( uSkillType != 36 ) - goto LABEL_126; - v8 = (CHARACTER_ATTRIBUTE_TYPE)46; - break; - } - goto LABEL_125; - } - if ( !CheckHiredNPCSpeciality(0x2Eu) ) - goto LABEL_86; - goto LABEL_85; - } - if ( !CheckHiredNPCSpeciality(0x39u) ) - goto LABEL_112; - v6 = 6; -LABEL_51: - v2 = v6; - goto LABEL_112; - } - if ( uSkillType == PLAYER_SKILL_MERCHANT ) - { - if ( CheckHiredNPCSpeciality(0x14u) ) - v2 = 4; - if ( CheckHiredNPCSpeciality(0x15u) ) - v2 += 6; - if ( CheckHiredNPCSpeciality(0x30u) ) - v2 += 3; - v7 = 50; -LABEL_47: - if ( CheckHiredNPCSpeciality(v7) ) - v2 += 8; - goto LABEL_112; - } - if ( uSkillType != PLAYER_SKILL_PERCEPTION ) - { - if ( uSkillType != PLAYER_SKILL_TRAP_DISARM ) - goto LABEL_86; - if ( CheckHiredNPCSpeciality(0x19u) ) - v2 = 4; - if ( CheckHiredNPCSpeciality(0x1Au) ) - v2 += 6; - v7 = 51; - goto LABEL_47; - } - if ( CheckHiredNPCSpeciality(0x16u) ) - v2 = 6; - if ( CheckHiredNPCSpeciality(0x2Fu) ) - v2 += 5; -LABEL_112: - switch ( uSkillType ) - { + v8 = (CHARACTER_ATTRIBUTE_TYPE)21; + v2 += GetItemsBonus(v8, 0); + } + break; + + case PLAYER_SKILL_STEALING: + { + if (CheckHiredNPCSpeciality(51)) + v2 = 8; + v8 = (CHARACTER_ATTRIBUTE_TYPE)17; + v2 += GetItemsBonus(v8, 0); + } + break; + + + case PLAYER_SKILL_ALCHEMY: + { + if ( CheckHiredNPCSpeciality(23) ) + v2 = 4; + if ( CheckHiredNPCSpeciality(24) ) + v2 += 8; + v8 = (CHARACTER_ATTRIBUTE_TYPE)16; + v2 += GetItemsBonus(v8, 0); + } + break; + + case PLAYER_SKILL_LEARNING: + { + if ( CheckHiredNPCSpeciality(13) ) + v2 = 10; + if ( CheckHiredNPCSpeciality(14) ) + v2 += 15; + if ( CheckHiredNPCSpeciality(4) ) + v2 += 5; + v8 = (CHARACTER_ATTRIBUTE_TYPE)46; + v2 += GetItemsBonus(v8, 0); + } + break; + + case PLAYER_SKILL_UNARMED: + { + if (CheckHiredNPCSpeciality(56) ) + v2 = 2; + v8 = (CHARACTER_ATTRIBUTE_TYPE)23; + v2 += GetItemsBonus(v8, 0); + } + break; + + case PLAYER_SKILL_DODGE: + { + if ( CheckHiredNPCSpeciality(56) ) + v2 = 2; + v8 = (CHARACTER_ATTRIBUTE_TYPE)22; + v2 += GetItemsBonus(v8, 0); + } + break; + + case PLAYER_SKILL_BOW: + v8 = (CHARACTER_ATTRIBUTE_TYPE)44; + v2 += GetItemsBonus(v8, 0); + break; + case PLAYER_SKILL_SHIELD: + v8 = (CHARACTER_ATTRIBUTE_TYPE)45; + v2 += GetItemsBonus(v8, 0); + break; + + case PLAYER_SKILL_EARTH: + if ( CheckHiredNPCSpeciality(17) ) + v2 = 2; + if ( CheckHiredNPCSpeciality(18) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(19) ) + v2 += 4; + if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) + v2 += 3; + v8 = (CHARACTER_ATTRIBUTE_TYPE)37; + v2 += GetItemsBonus(v8, 0); + break; + case PLAYER_SKILL_FIRE: + if ( CheckHiredNPCSpeciality(17) ) + v2 = 2; + if ( CheckHiredNPCSpeciality(18) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(19) ) + v2 += 4; + if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) + v2 += 3; + v8 = (CHARACTER_ATTRIBUTE_TYPE)34; + v2 += GetItemsBonus(v8, 0); + break; + case PLAYER_SKILL_AIR: + if ( CheckHiredNPCSpeciality(17) ) + v2 = 2; + if ( CheckHiredNPCSpeciality(18) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(19) ) + v2 += 4; + if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) + v2 += 3; + v8 = (CHARACTER_ATTRIBUTE_TYPE)35; + v2 += GetItemsBonus(v8, 0); + break; + case PLAYER_SKILL_WATER: + if ( CheckHiredNPCSpeciality(17) ) + v2 = 2; + if ( CheckHiredNPCSpeciality(18) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(19) ) + v2 += 4; + if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) + v2 += 3; + v8 = (CHARACTER_ATTRIBUTE_TYPE)36; + v2 += GetItemsBonus(v8, 0); + break; + case PLAYER_SKILL_SPIRIT: + if ( CheckHiredNPCSpeciality(53) ) + v2 = 2; + if ( CheckHiredNPCSpeciality(54) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(55) ) + v2 += 4; + v8 = (CHARACTER_ATTRIBUTE_TYPE)38; + v2 += GetItemsBonus(v8, 0); + break; + case PLAYER_SKILL_MIND: + if ( CheckHiredNPCSpeciality(53) ) + v2 = 2; + if ( CheckHiredNPCSpeciality(54) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(55) ) + v2 += 4; + v8 = (CHARACTER_ATTRIBUTE_TYPE)39; + v2 += GetItemsBonus(v8, 0); + break; + case PLAYER_SKILL_BODY: + if ( CheckHiredNPCSpeciality(53) ) + v2 = 2; + if ( CheckHiredNPCSpeciality(54) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(55) ) + v2 += 4; + v8 = (CHARACTER_ATTRIBUTE_TYPE)40; + v2 += GetItemsBonus(v8, 0); + break; + case PLAYER_SKILL_LIGHT: + v8 = (CHARACTER_ATTRIBUTE_TYPE)41; + v2 += GetItemsBonus(v8, 0); + break; + case PLAYER_SKILL_DARK: + { + v8 = (CHARACTER_ATTRIBUTE_TYPE)42; + v2 += GetItemsBonus(v8, 0); + } + break; + + case PLAYER_SKILL_MERCHANT: + { + if ( CheckHiredNPCSpeciality(20) ) + v2 = 4; + if ( CheckHiredNPCSpeciality(21) ) + v2 += 6; + if ( CheckHiredNPCSpeciality(48) ) + v2 += 3; + if ( CheckHiredNPCSpeciality(50) ) + v2 += 8; + } + break; + + case PLAYER_SKILL_PERCEPTION: + { + if ( CheckHiredNPCSpeciality(22) ) + v2 = 6; + if ( CheckHiredNPCSpeciality(47) ) + v2 += 5; + } + break; + case PLAYER_SKILL_ITEM_ID: v8 = (CHARACTER_ATTRIBUTE_TYPE)19; + v2 += GetItemsBonus(v8, 0); break; case PLAYER_SKILL_MEDITATION: v8 = (CHARACTER_ATTRIBUTE_TYPE)43; - break; + v2 += GetItemsBonus(v8, 0); + break; case PLAYER_SKILL_TRAP_DISARM: + { + if ( CheckHiredNPCSpeciality(25) ) + v2 = 4; + if ( CheckHiredNPCSpeciality(26) ) + v2 += 6; + if ( CheckHiredNPCSpeciality(51) ) + v2 += 8; v8 = (CHARACTER_ATTRIBUTE_TYPE)18; - break; - case PLAYER_SKILL_DODGE: - v8 = (CHARACTER_ATTRIBUTE_TYPE)22; - break; - default: - if ( uSkillType != 31 ) - goto LABEL_126; - v8 = (CHARACTER_ATTRIBUTE_TYPE)23; - break; - } -LABEL_125: - v2 += v9->GetItemsBonus(v8, 0); -LABEL_126: - v3 = v9->pActiveSkills[uSkillType]; - if ( v2 + (v9->pActiveSkills[uSkillType] & 0x3F) < 60 ) + v2 += GetItemsBonus(v8, 0); + } + break; + } + + v3 = pActiveSkills[uSkillType]; + if ( v2 + (pActiveSkills[uSkillType] & 0x3F) < 60 ) result = v2 + v3; else result = v3 & 0xFC | 0x3C;
--- a/Render.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/Render.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -7234,9 +7234,9 @@ //----- (004A2031) -------------------------------------------------------- -unsigned int Render::GetActorTintColor(float a2, int a3, int a4, int a5, RenderBillboard *a6) -{ - return ::GetActorTintColor(a3, a4, a2, a5, a6); +unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) +{ + return ::GetActorTintColor(tint, a4, a2, a5, a6); } /*void Render::DrawTerrainPolygon_new(stru148 *a3, IDirect3DTexture2 *pTexture)//new function
--- a/Render.h Thu Feb 21 22:42:35 2013 +0600 +++ b/Render.h Thu Feb 21 22:42:52 2013 +0600 @@ -319,7 +319,7 @@ unsigned int GetParentBillboardID(unsigned int uBillboardID); void BeginSceneD3D(); void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); - unsigned int GetActorTintColor(float a2, int a3, int a4, int a5, RenderBillboard *a6); + unsigned int GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6); void DrawPolygon(unsigned int uNumVertices, stru148 *a3, ODMFace *a4, IDirect3DTexture2 *pTexture); void DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders); void DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture);
--- a/SaveLoad.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/SaveLoad.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -51,7 +51,7 @@ SavegameHeader header; // [sp+Ch] [bp-E4h]@23 char Str[123]; // [sp+70h] [bp-80h]@25 - dword_5B65C8 = 0; + dword_5B65C8_timers_count = 0; if (!pSavegameUsedSlots[uSlot]) { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
--- a/Spells.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/Spells.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -121,8 +121,136 @@ {60, 60, 60, 60, 300, 300, 300, 300, 2073, 0} }; + unsigned char pSpellbookSpellIndices[9][12] = // 4E2430 + { + {0, 3, 1, 8, 11, 7, 4, 10, 6, 2, 5, 9}, + {0, 11, 2, 9, 6, 8, 5, 10, 3, 7, 1, 4}, + {0, 4, 8, 9, 1, 10, 3, 11, 7, 6, 2, 5}, + {0, 7, 10, 8, 2, 11, 1, 5, 3, 6, 4, 9}, + {0, 5, 10, 11, 7, 2, 8, 1, 4, 9, 3, 6}, + {0, 5, 9, 8, 3, 7, 6, 4, 1, 11, 2, 10}, + {0, 1, 6, 9, 3, 5, 8, 11, 7, 10, 4, 2}, + {0, 1, 10, 11, 9, 4, 3, 6, 5, 7, 8, 2}, + {0, 9, 3, 7, 1, 5, 2, 10, 11, 8, 6, 4} + }; + struct SpellBookIconPos pIconPos[108]={ + {0, 0}, + {17, 13}, + {115, 2}, + {217, 15}, + {299, 6}, + {28, 125}, + {130, 133}, + {294, 114}, + {11, 232}, + {134, 233}, + {237, 171}, + {296, 231}, + {0, 0}, + {19, 9}, + {117, 3}, + {206, 13}, + {285, 7}, + {16, 123}, + {113, 101}, + {201, 118}, + {317, 110}, + {11, 230}, + {149, 236}, + {296, 234}, + + {0, 0}, + {17, 9}, + {140, 0}, + {210, 34}, + {293, 5}, + {15, 98}, + {78, 121}, + {175, 136}, + {301, 115}, + {15, 226}, + {154, 225}, + {272, 220}, + + {0, 0}, + {7, 9}, + {156, 2}, + {277, 9}, + {11, 117}, + {111, 82}, + {180, 102}, + {303, 108}, + {10, 229}, + {120, 221}, + {201, 217}, + {296, 225}, + + {0, 0}, + {18, 8}, + {89, 15}, + {192, 14}, + {292, 7}, + {22, 129}, + {125, 146}, + {217, 136}, + {305, 115}, + {22, 226}, + {174, 237}, + {290, 231}, + + {0, 0}, + {18, 12}, + {148, 9}, + {292, 7}, + {17, 122}, + {121, 99}, + {220, 87}, + {293, 112}, + {13, 236}, + {128, 213}, + {220, 223}, + {315, 223}, + + {0, 0}, + {23, 14}, + {127, 8}, + {204, 0}, + {306, 8}, + {14, 115}, + {122, 132}, + {200, 116}, + {293, 122}, + {20, 228}, + {154, 228}, + {294, 239}, + + {0, 0}, + {19, 14}, + {124, 10}, + {283, 12}, + {8, 105}, + {113, 89}, + {190, 82}, + {298, 108}, + {18, 181}, + {101, 204}, + {204, 203}, + {285, 218}, + + {0, 0}, + {18, 17}, + {110, 16}, + {201, 15}, + {307, 15}, + {18, 148}, + {125, 166}, + {201, 123}, + {275, 120}, + {28, 235}, + {217, 222}, + {324, 216} }; //----- (0042EB31) --------------------------------------------------------
--- a/Spells.h Thu Feb 21 22:42:35 2013 +0600 +++ b/Spells.h Thu Feb 21 22:42:52 2013 +0600 @@ -142,11 +142,19 @@ }; #pragma pack(pop) +#pragma pack(push, 1) +struct SpellBookIconPos +{ + unsigned int Xpos; + unsigned int Ypos; +}; +#pragma pack(pop) extern struct SpellStats *pSpellStats; +extern struct SpellBookIconPos pIconPos[108]; extern stru324_spell stru_4E3ACC[]; extern SpellData pSpellDatas[100]; \ No newline at end of file
--- a/StorylineTextTable.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/StorylineTextTable.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -27,6 +27,13 @@ pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0); strtok(pHistoryTXT_Raw, "\r"); + StoreLine[0].pText=nullptr; + StoreLine[0].pPageTitle=nullptr; + StoreLine[0].uTime=0; + StoreLine[0].f_9=0; + StoreLine[0].f_A=0; + StoreLine[0].f_B=0; + for (i=0;i<29;++i) { test_string = strtok(NULL, "\r") + 1;
--- a/VideoPlayer.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/VideoPlayer.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -989,7 +989,7 @@ } v16 = 32767; v11 = (signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 32767.0); - SmackVolumePan(v8, HIDWORD(v11), v3->pSmackerMovie, 1040384, v11, 32767); + SmackVolumePan(v3->pSmackerMovie, 1040384, v11, 32767); } } @@ -1117,20 +1117,20 @@ } } pMouse->_469E24(); - if ( ptr_507BC0 && ptr_507BC0->ptr_1C == (void *)165 && !v1->pSmackerMovie ) + if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !v1->pSmackerMovie ) { bGameoverLoop = 1; sub_4BD8B5(); - ptr_507BC0->Release(); + window_SpeakInHouse->Release(); pParty->uFlags &= 0xFFFFFFFDu; if ( EnterHouse((enum HOUSE_TYPE)165) ) { pAudioPlayer->PlaySound(SOUND_0, 0, 0, -1, 0, 0, 0, 0); - ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 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); + window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); + window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); + window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); + window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); + window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); } bGameoverLoop = 0; }
--- a/mm7_1.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/mm7_1.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -49,6 +49,7 @@ #include "StorylineTextTable.h" #include "Events2D.h" #include "texts.h" +#include "stru351.h" #include "mm7_data.h" @@ -1743,36 +1744,12 @@ v24 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn]; v28 = pKeyActionMap->GetActionVKey(INPUT_ZoomIn); - pBtn_ZoomIn = pPrimaryWindow->CreateButton( - 0x23Eu, - 0x88u, - v24->uTextureWidth, - v24->uTextureHeight, - 2, - 0, - 0x170u, - 0, - v28, - pGlobalTXT_LocalizationStrings[252], // Zoom In - v24, - 0); - + pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, v24->uTextureWidth, v24->uTextureHeight, 2, 0, 0x170u, 0, v28, pGlobalTXT_LocalizationStrings[252], // Zoom In + v24, 0); v29 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut]; v33 = pKeyActionMap->GetActionVKey(INPUT_ZoomOut); - pBtn_ZoomOut = pPrimaryWindow->CreateButton( - 0x207u, - 0x88u, - v29->uTextureWidth, - v29->uTextureHeight, - 2, - 0, - 0x16Fu, - 0, - v33, - pGlobalTXT_LocalizationStrings[251], // Zoom Out - v29, - 0); - + pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, v29->uTextureWidth, v29->uTextureHeight, 2, 0, 0x16Fu, 0, v33, pGlobalTXT_LocalizationStrings[251], // Zoom Out + v29, 0); pPrimaryWindow->CreateButton(0x1E1u, 0, 0x99u, 0x43u, 1, 92, 0, 0, 0, "", 0); pPrimaryWindow->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x86u, 0, 0x35u, "", 0); pPrimaryWindow->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x87u, 0, 0x36u, "", 0); @@ -1781,74 +1758,38 @@ pBtn_CastSpell = pPrimaryWindow->CreateButton(0x1DCu, 0x1C2u, (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureWidth : 24), (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureHeight : 26), - 1, - 0, - 0x69u, - 0, - 0x43u, - pGlobalTXT_LocalizationStrings[38], + 1, 0, 0x69u, 0, 0x43u, pGlobalTXT_LocalizationStrings[38], (Texture *)(uTextureID_Btn_CastSpell != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_CastSpell] : 0), 0); pBtn_Rest = pPrimaryWindow->CreateButton(0x206u, 0x1C2u, (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureWidth : 24), (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureHeight : 26), - 1, - 0, - 0x68u, - 0, - 0x52u, - pGlobalTXT_LocalizationStrings[182], - (Texture *)(uTextureID_Btn_Rest != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_Rest] : 0), - 0); + 1, 0, 0x68u, 0, 0x52u, pGlobalTXT_LocalizationStrings[182], + (Texture *)(uTextureID_Btn_Rest != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_Rest] : 0), 0); pBtn_QuickReference = pPrimaryWindow->CreateButton(0x230u, 0x1C2u, (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureWidth : 24), (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureHeight : 26), - 1, - 0, - 0x6Au, - 0, - 0x5Au, - pGlobalTXT_LocalizationStrings[173], - (Texture *)(uTextureID_Btn_QuickReference != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_QuickReference] : 0), - 0); + 1, 0, 0x6Au, 0, 0x5Au, pGlobalTXT_LocalizationStrings[173], + (Texture *)(uTextureID_Btn_QuickReference != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_QuickReference] : 0), 0); pBtn_GameSettings = pPrimaryWindow->CreateButton(0x25Au, 0x1C2u, (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureWidth : 24), (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureHeight : 26), - 1, - 0, - 0x6Bu, - 0, - 0, - pGlobalTXT_LocalizationStrings[93], - (Texture *)(uTextureID_Btn_GameSettings != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings] : 0), - 0); + 1, 0, 0x6Bu, 0, 0, pGlobalTXT_LocalizationStrings[93], + (Texture *)(uTextureID_Btn_GameSettings != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings] : 0), 0); pBtn_NPCLeft = pPrimaryWindow->CreateButton(0x1D5u, 0xB2u, (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureWidth : 24), (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureHeight : 26), - 1, - 0, - 0xBCu, - 0, - 0, - "", - (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0), - 0); + 1, 0, 0xBCu, 0, 0, "", + (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0), 0); pBtn_NPCRight = pPrimaryWindow->CreateButton(0x272u, 0xB2u, (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureWidth : 24), (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureHeight : 26), - 1, - 0, - 0xBCu, - 1u, - 0, - "", - (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), - 0); + 1, 0, 0xBCu, 1u, 0, "", + (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), 0); Load_isn_spells_21_27(); } - //----- (0041C047) -------------------------------------------------------- void __cdecl GameUI_DrawStatusBar_2() { @@ -2356,12 +2297,13 @@ //char v64[100]; // [sp+D0h] [bp-1A8h]@40 char v65[120]; // [sp+134h] [bp-144h]@92 char Source[40]; // [sp+1ACh] [bp-CCh]@49 - int v67; // [sp+1D4h] [bp-A4h]@91 - int v68; // [sp+1D8h] [bp-A0h]@106 - int v69; // [sp+1DCh] [bp-9Ch]@101 - int v70; // [sp+1E0h] [bp-98h]@97 - int v71; // [sp+1E8h] [bp-90h]@93 - int v72; // [sp+1ECh] [bp-8Ch]@91 + stru351_summoned_item v67; + //int v67; // [sp+1D4h] [bp-A4h]@91 + //int v68; // [sp+1D8h] [bp-A0h]@106 + //int v69; // [sp+1DCh] [bp-9Ch]@101 + //int v70; // [sp+1E0h] [bp-98h]@97 + //int v71; // [sp+1E8h] [bp-90h]@93 + //int v72; // [sp+1ECh] [bp-8Ch]@91 int var88; // [sp+1F0h] [bp-88h]@1 Texture *v73; // [sp+1F4h] [bp-84h]@5 //unsigned int v75; // [sp+1F8h] [bp-80h]@5 @@ -2656,21 +2598,21 @@ { if ( _this->uAttributes & 8 && (_this->uAdditionalValue || _this->_bonus_type) ) { - sub_493F79((stru351 *)&v67, _this->uExpireTime - pParty->uTimePlayed); + sub_493F79(&v67, _this->uExpireTime - pParty->uTimePlayed); strcpy(pTmpBuf, "Duration:"); - Str = (char *)(v72 - 1168); - if ( v72 != 1168 ) + Str = (char *)(v67.field_18_expire_year - game_starting_year); + if (v67.field_18_expire_year != 1168 ) { - sprintf(v65, " %d:yr", v72 - 1168); + sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year); strcat(pTmpBuf, v65); } - if ( (((v71 || Str) && ((sprintf(v65, " %d:mo", v71), strcat(pTmpBuf, v65), v71) || Str) || v70) - && ((sprintf(v65, " %d:dy", v70), strcat(pTmpBuf, v65), v71) || Str || v70) - || v69) - && ((sprintf(v65, " %d:hr", v69), strcat(pTmpBuf, v65), v71) || Str || v70 || v69) - || v68 ) + if ( (((v67.field_14_exprie_month || Str) && ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str) || v67.field_C_expire_day) + && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || v67.field_C_expire_day) + || v67.field_8_expire_hour) + && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || v67.field_C_expire_day || v67.field_8_expire_hour) + || v67.field_4_expire_minute ) { - sprintf(v65, " %d:mn", v68); + sprintf(v65, " %d:mn", v67.field_4_expire_minute); strcat(pTmpBuf, v65); } v79.DrawText(v82, 100, v79.uFrameHeight - 2 * LOBYTE(v82->uFontHeight), 0, pTmpBuf, 0, 0, 0); @@ -5194,7 +5136,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 4); + pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); //LABEL_49: v17 = pItemGen->GetDisplayName(); sub_41C0B8_set_status_string(v17); @@ -5789,7 +5731,7 @@ uActiveCharacter = uPlayerID; return; } - if ( ptr_507BC0->field_40 == 1 ) + if ( window_SpeakInHouse->field_40 == 1 ) return; viewparams->bRedrawGameUI = true; if ( uActiveCharacter != uPlayerID )
--- a/mm7_2.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/mm7_2.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -64,7 +64,7 @@ int v3; // eax@1 GUIWindow v5; // [sp+8h] [bp-54h]@1 - memcpy(&v5, ptr_507BC0, sizeof(v5)); + memcpy(&v5, window_SpeakInHouse, sizeof(v5)); v0 = pGlobalTXT_LocalizationStrings[672]; v1 = pGlobalTXT_LocalizationStrings[672]; v5.uFrameX = 483; @@ -140,7 +140,7 @@ int v31; // [sp+114h] [bp-8h]@29 GUIFont *pOutString; // [sp+118h] [bp-4h]@21 - memcpy(&_this, ptr_507BC0, sizeof(_this)); + memcpy(&_this, window_SpeakInHouse, sizeof(_this)); _this.uFrameX = 483; _this.uFrameWidth = 148; _this.uFrameZ = 334; @@ -204,8 +204,8 @@ { if ( dword_F8B19C != 100 ) return; - v0 = ptr_507BC0; - if ( ptr_507BC0->field_40 == 1 ) + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 == 1 ) { sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); @@ -215,7 +215,7 @@ _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); return; } - if ( ptr_507BC0->field_40 == 2 ) + if ( window_SpeakInHouse->field_40 == 2 ) { v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); v2 = v1; @@ -233,7 +233,7 @@ } if ( v1 > pParty->uNumGold ) { - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); v2 = pParty->uNumGold; } if ( v2 > pParty->uFine ) @@ -244,11 +244,11 @@ pParty->uFine = 0; if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); - v0 = ptr_507BC0; + v0 = window_SpeakInHouse; } else { - if ( ptr_507BC0->field_40 != 3 ) + if ( window_SpeakInHouse->field_40 != 3 ) return; } v0->field_40 = 0; @@ -305,7 +305,7 @@ __int16 v13[2]; // [sp+60h] [bp-8h]@1 __int16 v14[2]; // [sp+64h] [bp-4h]@1 - memcpy(&_this, ptr_507BC0, sizeof(_this)); + memcpy(&_this, window_SpeakInHouse, sizeof(_this)); _this.uFrameX = 483; _this.uFrameWidth = 148; _this.uFrameZ = 334; @@ -317,11 +317,11 @@ { if ( dword_F8B19C == 7 ) { - v0 = ptr_507BC0; - if ( ptr_507BC0->field_40 != 1 ) - { - v1 = ptr_507BC0->field_40 - 2; - if ( ptr_507BC0->field_40 == 2 ) + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 != 1 ) + { + v1 = window_SpeakInHouse->field_40 - 2; + if ( window_SpeakInHouse->field_40 == 2 ) { v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); v7 = v6; @@ -339,7 +339,7 @@ } if ( v6 > pParty->uNumGold ) { - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); v7 = pParty->uNumGold; } if ( v7 ) @@ -349,7 +349,7 @@ if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); } - v0 = ptr_507BC0; + v0 = window_SpeakInHouse; LABEL_16: v0->field_40 = 0; goto LABEL_17; @@ -366,20 +366,20 @@ { if ( dword_F8B19C != 8 ) return; - v0 = ptr_507BC0; - if ( ptr_507BC0->field_40 != 1 ) - { - v1 = ptr_507BC0->field_40 - 2; - if ( ptr_507BC0->field_40 == 2 ) - { - ptr_507BC0->field_40 = 0; + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 != 1 ) + { + v1 = window_SpeakInHouse->field_40 - 2; + if ( window_SpeakInHouse->field_40 == 2 ) + { + window_SpeakInHouse->field_40 = 0; v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); v3 = v2; if ( v2 ) { if ( v2 > pParty->uNumGoldInBank ) { - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); v3 = pParty->uNumGoldInBank; } if ( v3 ) @@ -491,10 +491,10 @@ unsigned int v71; // [sp-4h] [bp-278h]@75 const char *v72; // [sp-4h] [bp-278h]@93 unsigned int v73; // [sp-4h] [bp-278h]@99 - char Dest; // [sp+Ch] [bp-268h]@55 - char v75; // [sp+70h] [bp-204h]@59 - char a1; // [sp+D4h] [bp-1A0h]@57 - char v77; // [sp+138h] [bp-13Ch]@59 + char Dest[100]; // [sp+Ch] [bp-268h]@55 + char v75[100]; // [sp+70h] [bp-204h]@59 + char a1[100]; // [sp+D4h] [bp-1A0h]@57 + char v77[100]; // [sp+138h] [bp-13Ch]@59 GUIWindow v78; // [sp+19Ch] [bp-D8h]@99 GUIWindow v79; // [sp+1F0h] [bp-84h]@1 char *Str[2]; // [sp+244h] [bp-30h]@30 @@ -510,8 +510,8 @@ unsigned __int8 v90; // [sp+26Fh] [bp-5h]@55 GUIFont *pOutString; // [sp+270h] [bp-4h]@3 - v0 = ptr_507BC0; - memcpy(&v79, ptr_507BC0, sizeof(v79)); + v0 = window_SpeakInHouse; + memcpy(&v79, window_SpeakInHouse, sizeof(v79)); v85 = pPlayers[uActiveCharacter]; v1 = v85; v79.uFrameX = 483; @@ -597,7 +597,7 @@ v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; goto LABEL_98; } - strcpy(pTmpBuf, pNPCTopics[(uint)ptr_507BC0->ptr_1C + 247].pText); + strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); v78.uFrameWidth = 460; v78.uFrameZ = 452; v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0); @@ -617,7 +617,7 @@ v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0); v64 = pFontArrus; } - ptr_507BC0->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); + window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); return; } if ( dword_F8B19C != 101 ) @@ -629,15 +629,15 @@ if ( pParty->uNumGold >= (unsigned int)pOutString ) { Party::TakeGold((unsigned int)pOutString); - v27 = (int)ptr_507BC0->ptr_1C; - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); + v27 = (int)window_SpeakInHouse->ptr_1C; + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); dword_F8B19C = 0; while ( sub_4BD8B5() ) ; sub_4B1D27(); pVideoPlayer->Unload(); - ptr_507BC0->Release(); - ptr_507BC0 = 0; + window_SpeakInHouse->Release(); + window_SpeakInHouse = 0; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pMessageQueue_50CBD0->pMessages[0].eType = (UIMessageType)409; @@ -658,7 +658,7 @@ *(float *)&v89 = 0.0; //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v9 = (signed __int64)(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].flt_24 * 500.0); + v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); if ( (signed int)pOutString < v9 / 3 ) @@ -739,7 +739,7 @@ } *(_QWORD *)Str = pParty->uNumFoodRations; //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) - if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier ) + if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); if ( uActiveCharacter ) @@ -750,8 +750,8 @@ { Party::TakeGold(v7); //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier; - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 3); + pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); v5 = 1; LABEL_43: if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) @@ -763,7 +763,7 @@ } } ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 4); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); goto LABEL_43; } if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) @@ -771,41 +771,41 @@ v28 = *(int *)v84; if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) v28 = v81; - sprintf(&Dest, format_4E2DC8, v28); + sprintf(Dest, format_4E2DC8, v28); sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); - strcat(&Dest, pTmpBuf2); - v90 = pFontArrus->CalcTextHeight(&Dest, &v79, 0, 0); - strcat(&Dest, "\n \n"); + strcat(Dest, pTmpBuf2); + v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); + strcat(Dest, "\n \n"); v29 = *(int *)v84; if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) v29 = v81; - sprintf(&a1, format_4E2DC8, v29); + sprintf(a1, format_4E2DC8, v29); sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[86], //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], - (signed __int64)p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier, + (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, v83); - strcat(&a1, pTmpBuf2); - v88 = pFontArrus->CalcTextHeight(&a1, &v79, 0, 0); - strcat(&a1, "\n \n"); + strcat(a1, pTmpBuf2); + v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); + strcat(a1, "\n \n"); v30 = *(int *)v84; if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) v30 = v81; - sprintf(&v77, format_4E2DC8, v30); - strcat(&v77, pGlobalTXT_LocalizationStrings[160]); - v82 = pFontArrus->CalcTextHeight(&v77, &v79, 0, 0); - strcat(&v77, "\n \n"); - v75 = 0; + sprintf(v77, format_4E2DC8, v30); + strcat(v77, pGlobalTXT_LocalizationStrings[160]); + v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); + strcat(v77, "\n \n"); + v75[0] = 0; v87 = 0; - v31 = (signed int)ptr_507BC0->ptr_1C; + v31 = (signed int)window_SpeakInHouse->ptr_1C; if ( v31 >= 108 && v31 <= 120 ) { v32 = *(int *)v84; if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) v32 = v81; - sprintf(&v75, format_4E2DC8, v32); - strcat(&v75, pGlobalTXT_LocalizationStrings[611]); - v87 = pFontArrus->CalcTextHeight(&v75, &v79, 0, 0); + sprintf(v75, format_4E2DC8, v32); + strcat(v75, pGlobalTXT_LocalizationStrings[611]); + v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); } v33 = pDialogueWindow; Str[1] = (char *)pDialogueWindow; @@ -939,11 +939,11 @@ void *result; // eax@15 signed int v9; // [sp-Ch] [bp-14h]@7 - v0 = ptr_507BC0; + v0 = window_SpeakInHouse; v1 = 0; - v2 = (signed int)ptr_507BC0->ptr_1C; + v2 = (signed int)window_SpeakInHouse->ptr_1C; //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] ) - if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].uType] ) + if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) { while ( v2 > 14 ) { @@ -974,14 +974,14 @@ v5 = v9; LABEL_13: pItemsTable->GenerateItem(v4, v5, (ItemGen *)&pParty->field_777C[9 * (v1 + 12 * v2)]); - v0 = ptr_507BC0; - pParty->field_777C[9 * (v1 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 5] = 1; + v0 = window_SpeakInHouse; + pParty->field_777C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 5] = 1; goto LABEL_14; } auto _t = (ItemGen *)&pParty->field_777C[9 * (v1 + 12 * v2)]; _t->Reset(); - v0 = ptr_507BC0; - pParty->field_777C[9 * (v1 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] = 220; + v0 = window_SpeakInHouse; + pParty->field_777C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] = 220; } LABEL_14: v2 = (signed int)v0->ptr_1C; @@ -1121,7 +1121,7 @@ v0 = pPlayers[uActiveCharacter]; _this = pPlayers[uActiveCharacter]; - memcpy(&v101, ptr_507BC0, sizeof(v101)); + memcpy(&v101, window_SpeakInHouse, sizeof(v101)); v101.uFrameX = 483; v101.uFrameWidth = 148; v101.uFrameZ = 334; @@ -1191,7 +1191,7 @@ { v30 = pDialogueWindow; v3 = 0; - v31 = ptr_507BC0->ptr_1C; + v31 = window_SpeakInHouse->ptr_1C; v106.y = 0; //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); v32 = (signed __int64)(p2DEvents[(signed int)v31 - 1].flt_24 * 500.0); @@ -1309,9 +1309,9 @@ { v85 = 0; v83 = 5; - v81 = ptr_507BC0->ptr_1C; + v81 = window_SpeakInHouse->ptr_1C; v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5]; - v28 = (int)ptr_507BC0->ptr_1C; + v28 = (int)window_SpeakInHouse->ptr_1C; v110 = uActiveCharacter - 1; v29 = _this->_490EEE( (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5], @@ -1407,9 +1407,9 @@ { v85 = 0; v83 = 3; - v81 = ptr_507BC0->ptr_1C; + v81 = window_SpeakInHouse->ptr_1C; v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - v12 = (int)ptr_507BC0->ptr_1C; + v12 = (int)window_SpeakInHouse->ptr_1C; v110 = uActiveCharacter - 1; v13 = _this->_490EEE(v79, 1, v12, 3); v6 = v110; @@ -1448,16 +1448,16 @@ v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; if (!v4->Identified()) { - v81 = ptr_507BC0->ptr_1C; + v81 = window_SpeakInHouse->ptr_1C; v79 = v4; - v9 = (int)ptr_507BC0->ptr_1C; + v9 = (int)window_SpeakInHouse->ptr_1C; v110 = uActiveCharacter - 1; v10 = _this->_490EEE(v4, 1, v9, 4); v6 = v110; v5 = (char *)pMerchantsIdentifyPhrases[v10]; goto LABEL_14; } - v81 = ptr_507BC0->ptr_1C; + v81 = window_SpeakInHouse->ptr_1C; v5 = "%24"; v79 = v4; LABEL_13: @@ -1491,7 +1491,7 @@ v109 = 0; do { - if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)ptr_507BC0->ptr_1C]] ) + if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) { v49 = word_F8B158[(signed int)v48]; v50 = dword_F8B168[(signed int)v48]; @@ -1516,7 +1516,7 @@ v108 = 0; do { - if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)ptr_507BC0->ptr_1C] + 724] ) + if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) { v52 = word_F8B158[(signed int)v109] + 30; v53 = dword_F8B168[(signed int)v109]; @@ -1542,7 +1542,7 @@ v106.x = 0; do { - if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] ) + if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) ++v106.x; ++v55; } @@ -1552,7 +1552,7 @@ { do { - if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] ) + if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) ++v106.x; ++v55; } @@ -1580,7 +1580,7 @@ { v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; v106.x = v60; - v61 = (int)ptr_507BC0->ptr_1C; + v61 = (int)window_SpeakInHouse->ptr_1C; v62 = 9 * (v60 + 12 * v61); v63 = (ItemGen *)&pParty->field_777C[v62]; if ( dword_F8B19C != 2 ) @@ -1589,7 +1589,7 @@ { v85 = 0; v83 = 2; - v81 = ptr_507BC0->ptr_1C; + v81 = window_SpeakInHouse->ptr_1C; v79 = v63; v110 = uActiveCharacter - 1; v64 = _this->_490EEE(v63, 1, v61, 2); @@ -1600,7 +1600,7 @@ v5 = pGlobalTXT_LocalizationStrings[181]; v85 = 0; v83 = 2; - v81 = ptr_507BC0->ptr_1C; + v81 = window_SpeakInHouse->ptr_1C; v79 = v63; goto LABEL_13; } @@ -1609,8 +1609,8 @@ { result = v101._4B1854( __PAIR__( - pParty->field_3C.field_50[2 * (unsigned int)ptr_507BC0->ptr_1C + 1], - pParty->field_3C.field_50[2 * (unsigned int)ptr_507BC0->ptr_1C]) + pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C + 1], + pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) - pParty->uTimePlayed); } } @@ -1739,7 +1739,7 @@ v0 = pPlayers[uActiveCharacter]; _this = pPlayers[uActiveCharacter]; - memcpy(&v104, ptr_507BC0, sizeof(v104)); + memcpy(&v104, window_SpeakInHouse, sizeof(v104)); v104.uFrameX = 483; v104.uFrameWidth = 148; v104.uFrameZ = 334; @@ -1819,9 +1819,9 @@ return result; v93 = 0; v91 = 3; - v89 = ptr_507BC0->ptr_1C; + v89 = window_SpeakInHouse->ptr_1C; v87 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - v44 = (int)ptr_507BC0->ptr_1C; + v44 = (int)window_SpeakInHouse->ptr_1C; v113 = uActiveCharacter - 1; v45 = _this->_490EEE(v87, 4, v44, 3); v39 = v113; @@ -1847,16 +1847,16 @@ v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; if (!v37->Identified()) { - v89 = ptr_507BC0->ptr_1C; + v89 = window_SpeakInHouse->ptr_1C; v87 = v37; - v41 = (int)ptr_507BC0->ptr_1C; + v41 = (int)window_SpeakInHouse->ptr_1C; v113 = uActiveCharacter - 1; v42 = _this->_490EEE(v37, 4, v41, 4); v39 = v113; v38 = (char *)pMerchantsIdentifyPhrases[v42]; goto LABEL_45; } - v89 = ptr_507BC0->ptr_1C; + v89 = window_SpeakInHouse->ptr_1C; v38 = "%24"; v87 = v37; LABEL_44: @@ -1931,7 +1931,7 @@ return result; v2 = pDialogueWindow; v3 = 0; - v4 = ptr_507BC0->ptr_1C; + v4 = window_SpeakInHouse->ptr_1C; v112 = 0; //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0); v5 = (signed __int64)(p2DEvents[(signed int)v4 - 1].flt_24 * 500.0); @@ -2029,7 +2029,7 @@ { do { - if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] ) + if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) { v46 = dword_F8B168[v114]; v47 = 152 - v46->uTextureHeight; @@ -2059,7 +2059,7 @@ v114 = 0; do { - if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 54] ) + if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) { v50 = dword_F8B168[v114 + 6]; v51 = 308 - v50->uTextureHeight; @@ -2091,7 +2091,7 @@ { do { - if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] ) + if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) { v54 = dword_F8B168[v114]; v55 = 152 - v54->uTextureHeight; @@ -2121,7 +2121,7 @@ v114 = 0; do { - if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 778] ) + if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) { v58 = dword_F8B168[v114 + 6]; v59 = 308 - v58->uTextureHeight; @@ -2158,7 +2158,7 @@ { do { - if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] ) + if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) ++v109; ++v62; } @@ -2168,7 +2168,7 @@ { do { - if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] ) + if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) ++v109; ++v62; } @@ -2191,8 +2191,8 @@ if ( !v109 ) return (POINT *)v104._4B1854( __PAIR__( - pParty->field_3C.field_50[2 * (unsigned int)ptr_507BC0->ptr_1C + 1], - pParty->field_3C.field_50[2 * (unsigned int)ptr_507BC0->ptr_1C]) + pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C + 1], + pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) - pParty->uTimePlayed); v66 = pMouse->GetCursorPos(&v98); result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); @@ -2200,7 +2200,7 @@ { v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; v109 = v67; - v68 = (int)ptr_507BC0->ptr_1C; + v68 = (int)window_SpeakInHouse->ptr_1C; v69 = 9 * (v67 + 12 * v68); v70 = (ItemGen *)&pParty->field_777C[v69]; if ( dword_F8B19C != 2 ) @@ -2209,7 +2209,7 @@ { v93 = 0; v91 = 2; - v89 = ptr_507BC0->ptr_1C; + v89 = window_SpeakInHouse->ptr_1C; v87 = v70; v113 = uActiveCharacter - 1; v71 = _this->_490EEE(v70, 4, v68, 2); @@ -2220,7 +2220,7 @@ v38 = pGlobalTXT_LocalizationStrings[181]; v93 = 0; v91 = 2; - v89 = ptr_507BC0->ptr_1C; + v89 = window_SpeakInHouse->ptr_1C; v87 = v70; goto LABEL_44; } @@ -2390,7 +2390,7 @@ v0 = pPlayers[uActiveCharacter]; _this = pPlayers[uActiveCharacter]; - memcpy(&v144, ptr_507BC0, sizeof(v144)); + memcpy(&v144, window_SpeakInHouse, sizeof(v144)); v144.uFrameX = 483; v144.uFrameWidth = 148; v144.uFrameZ = 334; @@ -2408,7 +2408,7 @@ v93 = 0; do { - if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] ) + if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) ++v149; ++v93; } @@ -2421,13 +2421,13 @@ if ( v149 && v149 != -65536 ) { --v149; - v96 = ptr_507BC0->ptr_1C; + v96 = window_SpeakInHouse->ptr_1C; v97 = uActiveCharacter - 1; v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724]; v99 = _this->_490EEE( (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724], 2, - (int)ptr_507BC0->ptr_1C, + (int)window_SpeakInHouse->ptr_1C, 2); v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], v97, v98, (char *)v96, 2, 0); v101 = v100; @@ -2439,7 +2439,7 @@ v153 = 0; do { - if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] ) + if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) { v105 = dword_F8B168[v104]; if ( v104 >= 4 ) @@ -2467,7 +2467,7 @@ while ( v104 < 8 ); return; } - v72 = ptr_507BC0->ptr_1C; + v72 = window_SpeakInHouse->ptr_1C; goto LABEL_96; } if ( dword_F8B19C == 94 ) @@ -2528,7 +2528,7 @@ v152 = 0; v37 = pDialogueWindow; //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v38 = (signed __int64)(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].flt_24 * 500.0); + v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100); if ( (signed int)_this < v38 / 3 ) _this = (Player *)(v38 / 3); @@ -2626,7 +2626,7 @@ v153 = 0; do { - if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] ) + if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) { v56 = dword_F8B168[v55]; if ( v55 >= 4 ) @@ -2660,7 +2660,7 @@ v153 = 0; do { - if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] != v11 ) + if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) { v62 = dword_F8B168[v61]; if ( v61 >= 4 ) @@ -2696,7 +2696,7 @@ { do { - if ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] != v11 ) + if ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] != v11 ) ++v149; ++v68; } @@ -2706,7 +2706,7 @@ { do { - if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] != v11 ) + if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) ++v149; ++v68; } @@ -2733,7 +2733,7 @@ if ( !v74 ) return; v149 = v74 - 1; - v75 = (int)ptr_507BC0->ptr_1C; + v75 = (int)window_SpeakInHouse->ptr_1C; v76 = 9 * (v74 - 1 + 12 * v75); if ( dword_F8B19C == 2 ) v77 = (ItemGen *)&pParty->field_777C[v76]; @@ -2743,7 +2743,7 @@ { v124 = (__int64 *)v11; v122 = 2; - v120 = ptr_507BC0->ptr_1C; + v120 = window_SpeakInHouse->ptr_1C; v116 = v77; v78 = uActiveCharacter - 1; v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; @@ -2753,7 +2753,7 @@ { v124 = (__int64 *)v11; v122 = 2; - v120 = ptr_507BC0->ptr_1C; + v120 = window_SpeakInHouse->ptr_1C; v116 = v77; v15 = pGlobalTXT_LocalizationStrings[181]; v14 = uActiveCharacter - 1; @@ -2768,7 +2768,7 @@ v111 = &v144; goto LABEL_63; } - v72 = ptr_507BC0->ptr_1C; + v72 = window_SpeakInHouse->ptr_1C; LABEL_96: v144._4B1854( __PAIR__(pParty->field_3C.field_50[2 * (int)v72 + 1], pParty->field_3C.field_50[2 * (int)v72]) @@ -2790,9 +2790,9 @@ return; v124 = 0; v122 = 5; - v120 = ptr_507BC0->ptr_1C; + v120 = window_SpeakInHouse->ptr_1C; v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; - v34 = (int)ptr_507BC0->ptr_1C; + v34 = (int)window_SpeakInHouse->ptr_1C; uPlayerID = uActiveCharacter - 1; v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); v14 = uPlayerID; @@ -2868,9 +2868,9 @@ return; v124 = 0; v122 = 3; - v120 = ptr_507BC0->ptr_1C; + v120 = window_SpeakInHouse->ptr_1C; v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; - v12 = (int)ptr_507BC0->ptr_1C; + v12 = (int)window_SpeakInHouse->ptr_1C; uPlayerID = uActiveCharacter - 1; v13 = v0->_490EEE(v116, 2, v12, 3); v14 = uPlayerID; @@ -2896,16 +2896,16 @@ v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; if (v3->Identified()) { - v118 = ptr_507BC0->ptr_1C; + v118 = window_SpeakInHouse->ptr_1C; v4 = uActiveCharacter - 1; v5 = "%24"; v114 = v3; } else { - v118 = ptr_507BC0->ptr_1C; + v118 = window_SpeakInHouse->ptr_1C; v114 = v3; - v7 = (int)ptr_507BC0->ptr_1C; + v7 = (int)window_SpeakInHouse->ptr_1C; uPlayerID = uActiveCharacter - 1; v8 = v0->_490EEE(v3, 2, v7, 4); v4 = uPlayerID; @@ -3166,7 +3166,7 @@ pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); pDialogueWindow->_41D08F(1, 1, 0, 2); dword_F8B19C = -1; - v0 = (int)((char *)ptr_507BC0->ptr_1C - 102); + v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) { pParty->field_75A[v0] = 0; @@ -3623,19 +3623,19 @@ int v7; // [sp+10h] [bp-4h]@0 v0 = v7; - v1 = (char *)ptr_507BC0->ptr_1C - 139; + v1 = (char *)window_SpeakInHouse->ptr_1C - 139; v2 = 0; do { //v3 = p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]; - v3 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].uType; + v3 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType; if ( v3 < 5 ) goto LABEL_12; if ( v3 <= 13 ) { v0 = rand() % word_4F0F30[(signed int)v1] //+ 11 * p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C] - + 11 * p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].uType + + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345; } else @@ -3665,9 +3665,9 @@ if ( !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, 239) ) v0 = 486; } - v5 = ptr_507BC0; - - auto _u = (ItemGen *)&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + v2 + 12 * (unsigned int)ptr_507BC0->ptr_1C; + v5 = window_SpeakInHouse; + + auto _u = (ItemGen *)&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + v2 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C; _u->Reset(); *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v2 + 12 * (unsigned int)v5->ptr_1C)) = v0; *(&pParty->pPlayers[1].pInstalledBeacons[1].field_10 + 9 * (v2++ + 12 * (unsigned int)v5->ptr_1C)) = 1; @@ -3704,12 +3704,12 @@ void __fastcall sub_4BCACC_bounties(signed int a1) { unsigned int v1; // edi@1 - signed int v2; // ebx@1 - signed int v3; // ecx@2 + //signed int v2; // ebx@1 + //signed int v3; // ecx@2 int v4; // eax@5 signed int v5; // esi@5 - Player *v6; // ecx@5 - signed int v7; // edx@5 + //Player *v6; // ecx@5 + //signed int v7; // edx@5 GUIWindow *v8; // esi@10 unsigned int v9; // eax@12 int v10; // esi@31 @@ -3757,66 +3757,52 @@ void *v52; // eax@260 signed int v53; // edi@260 int v54; // eax@262 - signed int v55; // [sp+10h] [bp-10h]@1 + //signed int v55; // [sp+10h] [bp-10h]@1 int v56; // [sp+14h] [bp-Ch]@31 v1 = 0; - v2 = a1; - v55 = a1; + //v2 = a1; + //v55 = a1; if ( !pDialogueWindow->pNumPresenceButton ) return; pRenderer->ClearZBuffer(0, 479); - v3 = dword_F8B198; + //v3 = dword_F8B198; if ( dword_F8B19C != 1 ) goto LABEL_13; if ( dword_F8B198 == 30 ) { - if ( v2 == 17 ) + if ( a1 == 17 ) { v4 = 0; v5 = 0; - v6 = pPlayers[uActiveCharacter]; - v7 = v6->uLevel; - if ( v7 > 0 ) + //v6 = pPlayers[uActiveCharacter]; + //v7 = pPlayers[uActiveCharacter]->uLevel; + if ( pPlayers[uActiveCharacter]->uLevel > 0 ) { do v4 += v5++ + 1; - while ( v5 < v7 ); - } - if ( v7 < (unsigned __int16)word_4F0866[(unsigned int)ptr_507BC0->ptr_1C] - && (signed __int64)v6->uExperience < 1000 * v4 ) + while ( v5 < pPlayers[uActiveCharacter]->uLevel ); + } + if ( pPlayers[uActiveCharacter]->uLevel < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C] + && (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4 ) return; } goto LABEL_9; } - v8 = ptr_507BC0; + v8 = window_SpeakInHouse; if ( (dword_F8B198 == 27 || dword_F8B198 == 28) - && (v1 = 0, - *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)ptr_507BC0->ptr_1C] + v2)] - + pParty->uDaysPlayed % 7)) - || dword_F8B198 != 23 - || v55 != 10 ) + && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + a1)] + pParty->uDaysPlayed % 7)) + || dword_F8B198 != 23 || a1 != 10 ) { LABEL_9: pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 526, - 445, - 75, - 33, - 1, - v1, - 0x71u, - v1, - v1, - pGlobalTXT_LocalizationStrings[74],// "End Conversation" - (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), - v1); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1); pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1); LABEL_10: - v3 = dword_F8B198; - v8 = ptr_507BC0; + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; goto LABEL_11; } if ( uActiveCharacter != v1 ) @@ -3826,35 +3812,35 @@ goto LABEL_10; } LABEL_11: - dword_F8B19C = v55; - if ( v3 < 19 ) - { - v9 = pIcons_LOD->LoadTexture(off_4F03B8[v3], TEXTURE_16BIT_PALETTE); - v3 = dword_F8B198; + dword_F8B19C = a1; + if ( dword_F8B198 < 19 ) + { + v9 = pIcons_LOD->LoadTexture(off_4F03B8[dword_F8B198], TEXTURE_16BIT_PALETTE); + //v3 = dword_F8B198; dword_F8B164 = &pIcons_LOD->pTextures[v9]; LABEL_13: - v8 = ptr_507BC0; - } - if ( v3 > 21 ) - { - if ( v3 == 22 ) + v8 = window_SpeakInHouse; + } + if ( dword_F8B198 > 21 ) + { + if ( dword_F8B198 == 22 ) { if ( dword_F8B19C >= 7 && dword_F8B19C <= 8 ) pKeyActionMap->EnterText(1, 10, v8); return; } - if ( v3 != 23 && v3 != 30 ) + if ( dword_F8B198 != 23 && dword_F8B198 != 30 ) return; } else { - if ( v3 != 21 ) - { - if ( v3 <= (signed int)v1 ) + if ( dword_F8B198 != 21 ) + { + if ( dword_F8B198 <= (signed int)v1 ) return; - if ( v3 > 4 ) - { - if ( v3 <= 16 ) + if ( dword_F8B198 > 4 ) + { + if ( dword_F8B198 <= 16 ) { if ( (signed __int64)__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], @@ -3869,7 +3855,7 @@ v34 = pIcons_LOD->LoadTexture( pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); - v8 = ptr_507BC0; + v8 = window_SpeakInHouse; dword_F8B168[v32] = &pIcons_LOD->pTextures[v34]; } ++v32; @@ -3879,20 +3865,20 @@ else { sub_4BC8D5(); - v30 = ptr_507BC0->ptr_1C; + v30 = window_SpeakInHouse->ptr_1C; v31 = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - * (signed int)p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].field_1C) + * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); } return; } - if ( v3 != 17 ) + if ( dword_F8B198 != 17 ) return; - if ( v55 == 99 ) + if ( a1 == 99 ) { v10 = (int)((char *)v8->ptr_1C - 102); v56 = v10; @@ -3906,11 +3892,9 @@ v12 = v10; v13 = 0; pParty->field_75A[v12] = 0; - *(_QWORD *)v11 = (signed __int64)((double)(309657600 - * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) - * 0.033333335); + *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); v14 = rand() % 258; - v15 = ptr_507BC0; + v15 = window_SpeakInHouse; pParty->field_750[v12] = v14 + 1; v16 = (int)((char *)v15->ptr_1C - 102); if ( v16 ) @@ -4092,7 +4076,7 @@ } goto LABEL_196; } - if ( v55 == 100 ) + if ( a1 == 100 ) { pKeyActionMap->EnterText(1, 10, v8); goto LABEL_196; @@ -4100,10 +4084,10 @@ } } } - if ( v55 > 95 ) + if ( a1 > 95 ) { LABEL_196: - switch ( v55 ) + switch ( a1 ) { case 96: pDialogueWindow->eWindowType = WINDOW_MainMenu; @@ -4134,25 +4118,25 @@ } return; } - if ( v55 != 95 && v55 != 2 ) - { - if ( v55 == 3 ) + if ( a1 != 95 && a1 != 2 ) + { + if ( a1 == 3 ) { dword_F8B19C = 3; } else { - if ( v55 == 4 ) + if ( a1 == 4 ) { dword_F8B19C = 4; } else { - if ( v55 != 5 ) - { - if ( v55 > 35 ) - { - if ( v55 <= 72 ) + if ( a1 != 5 ) + { + if ( a1 > 35 ) + { + if ( a1 <= 72 ) { v35 = pPlayers[uActiveCharacter]; //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); @@ -4171,7 +4155,7 @@ if (false) //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) { - v38 = (int)(&v35->uIntelligence + v55); + v38 = (int)(&v35->uIntelligence + a1); if ( !*(short *)v38 ) { if ( pParty->uNumGold < v37 ) @@ -4181,7 +4165,7 @@ v39 = 4; else v39 = 2; - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, v39); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v39); } else { @@ -4195,7 +4179,7 @@ } else { - if ( v55 == 94 ) + if ( a1 == 94 ) { pDialogueWindow->eWindowType = WINDOW_MainMenu; sub_4BCA33(); @@ -4217,12 +4201,12 @@ { GenerateShopItems(); sub_4B8F94(); - v8 = ptr_507BC0; - v40 = ptr_507BC0->ptr_1C; - v3 = dword_F8B198; + v8 = window_SpeakInHouse; + v40 = window_SpeakInHouse->ptr_1C; + //v3 = dword_F8B198; v41 = pParty->uTimePlayed //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].field_1C) + + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); pParty->field_3C.field_50[2 * (int)v40] = v41; pParty->field_3C.field_50[2 * (int)v40 + 1] = HIDWORD(v41); @@ -4231,7 +4215,7 @@ v43 = 0; //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; - if ( v55 == 2 ) + if ( a1 == 2 ) { if ( _4F063C_smthn_by_2da_uType[v44] ) { @@ -4241,8 +4225,8 @@ if ( v45 ) { v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); - v3 = dword_F8B198; - v8 = ptr_507BC0; + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; dword_F8B168[v43] = &pIcons_LOD->pTextures[v46]; } v42 = v8->ptr_1C; @@ -4251,7 +4235,7 @@ //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); } - if ( v3 == 1 ) + if ( dword_F8B198 == 1 ) { v47 = v8->ptr_1C; v48 = 0; @@ -4263,7 +4247,7 @@ if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) { v49 = rand(); - v8 = ptr_507BC0; + v8 = window_SpeakInHouse; word_F8B158[v48] = v49 % (300 - dword_F8B168[v48]->uTextureHeight); } v47 = v8->ptr_1C; @@ -4284,8 +4268,8 @@ if ( v50 ) { v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); - v3 = dword_F8B198; - v8 = ptr_507BC0; + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; dword_F8B168[v43] = &pIcons_LOD->pTextures[v51]; } v42 = v8->ptr_1C; @@ -4294,7 +4278,7 @@ //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); } - if ( v3 == 1 ) + if ( dword_F8B198 == 1 ) { v52 = v8->ptr_1C; v53 = 0; @@ -4306,7 +4290,7 @@ if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) { v54 = rand(); - v8 = ptr_507BC0; + v8 = window_SpeakInHouse; word_F8B158[v53] = v54 % (300 - dword_F8B168[v53]->uTextureHeight); } v52 = v8->ptr_1C; @@ -4394,13 +4378,13 @@ if ( uNumDialogueNPCPortraits != 1 ) { v2 = 0; - pBtn_ExitCancel = ptr_507BC0->pControlsHead; + pBtn_ExitCancel = window_SpeakInHouse->pControlsHead; if ( uNumDialogueNPCPortraits > 0 ) { v3 = byte_591180; do { - array_5913D8[v2 + 7] = (NPCData *)ptr_507BC0->CreateButton(*(&pNPCPortraits_x + v2 + 6 * v1 - 6), *(&pNPCPortraits_y + v2 + 6 * v1 - 6), + array_5913D8[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(*(&pNPCPortraits_x + v2 + 6 * v1 - 6), *(&pNPCPortraits_y + v2 + 6 * v1 - 6), 0x3Fu, 0x49u, 1, 0, 0x19Au, v2, 0, v3, 0, 0, 0); v1 = uNumDialogueNPCPortraits; ++v2; @@ -4527,7 +4511,7 @@ { v42 = dword_F8B19C - 36; //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v43 = (signed __int64)(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].flt_24 * 500.0); + v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); v44 = v43 * (100 - v0->GetMerchant()) / 100; if ( v44 < v43 / 3 ) v44 = v43 / 3; @@ -4539,7 +4523,7 @@ if ( pParty->uNumGold < v44 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" - v13 = ptr_507BC0->ptr_1C; + v13 = window_SpeakInHouse->ptr_1C; if ( dword_F8B198 == 30 ) v55 = 4; else @@ -4573,7 +4557,7 @@ v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF; if ( !v18 ) return; - v19 = ptr_507BC0->ptr_1C; + v19 = window_SpeakInHouse->ptr_1C; v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)v19)); //v21 = p2DEvents_minus1__20[13 * (signed int)v19]; v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier; @@ -4586,7 +4570,7 @@ { v24 = 2; LABEL_62: - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, v24); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24); v9 = pGlobalTXT_LocalizationStrings[155]; v54 = 2; goto LABEL_71; @@ -4612,7 +4596,7 @@ v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF; if ( !v29 ) return; - v30 = ptr_507BC0->ptr_1C; + v30 = window_SpeakInHouse->ptr_1C; v31 = 9 * (v29 - 1 + 12 * (int)v30); if ( dword_F8B19C == 2 ) { @@ -4646,7 +4630,7 @@ uNumSeconds = v0->StealFromShop(v32, a3, v38, 0, &a6); if ( !uNumSeconds ) { - sub_4B1447_party_fine((int)ptr_507BC0->ptr_1C, 0, a6); + sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); return; } } @@ -4675,7 +4659,7 @@ if ( uNumSeconds == 1 || uNumSeconds == 2 ) { *(char *)(v40 + 517) |= 1u; - sub_4B1447_party_fine((int)ptr_507BC0->ptr_1C, v41, a6); + sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6); goto LABEL_43; } } @@ -4706,8 +4690,8 @@ || pMouse->GetCursorPos(&v65)->x >= 462 || (v15 = v0->GetItemIDAtInventoryIndex((int *)&v79), (v77 = (Player *)v15) == 0) ) return; - v16 = ptr_507BC0; - if ( sub_4BDAAF((ItemGen *)&v0->pInventoryItems[v15-1], (int)ptr_507BC0->ptr_1C) ) + v16 = window_SpeakInHouse; + if ( sub_4BDAAF((ItemGen *)&v0->pInventoryItems[v15-1], (int)window_SpeakInHouse->ptr_1C) ) { dword_F8B1E4 = 1; v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C); @@ -4741,11 +4725,11 @@ if ( v11 ) { //v80 = v0->_4B8179(p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]); - v80 = v0->_4B8179(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier); + v80 = v0->_4B8179(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); v12 = (int)&v0->pInventoryItems[v11-1]; if ( !(*(char *)(v12 + 20) & 1) ) { - _this = (ItemGen *)ptr_507BC0->ptr_1C; + _this = (ItemGen *)window_SpeakInHouse->ptr_1C; if ( sub_4BDAAF((ItemGen *)v12, (int)_this) ) { if ( pParty->uNumGold >= v80 ) @@ -4786,7 +4770,7 @@ { v3 = (int)&v0->pInventoryItems[v2-1]; //v4 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - v4 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier; + v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; auto _v = (ItemGen *)&v0->pInventoryItems[v2-1]; v5 = _v->GetValue(); @@ -4796,7 +4780,7 @@ v80 = v6; if ( !v7 ) { - _this = (ItemGen *)ptr_507BC0->ptr_1C; + _this = (ItemGen *)window_SpeakInHouse->ptr_1C; if ( sub_4BDAAF((ItemGen *)v3, (int)_this) ) { if ( pParty->uNumGold >= v80 ) @@ -5099,7 +5083,7 @@ pRenderer->EndScene(); free(_this.pPixels); _this.pPixels = 0; - ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); + window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); pWindow.uFrameX = 75; pWindow.uFrameY = 60; pWindow.uFrameWidth = 469; @@ -5175,8 +5159,8 @@ pRenderer->pBeforePresentFunction(); pRenderer->_49F1BC("MM7_Win.Pcx"); pAllocator->FreeChunk(pFont); - ptr_507BC0->Release(); - ptr_507BC0 = 0; + window_SpeakInHouse->Release(); + window_SpeakInHouse = 0; if ( v15 == (void *)2 ) { result = pMessageQueue_50CBD0->uNumMessages; @@ -10995,7 +10979,7 @@ v14 = (unsigned __int64)(pAMPM2 % 24) >> 32; LODWORD(pAMPM2) = pAMPM2 % 24; HIDWORD(pOurHour) = pSaveFiles % 28; - pYear += 1168;// + pYear += game_starting_year; v16 = v12 & 3; pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; HIDWORD(pAMPM2) = v14 == 0 && ((signed int)v14 > 0 || (unsigned int)pOurHour >= 12) @@ -11975,7 +11959,7 @@ { if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - v12 = ptr_507BC0 == 0; + v12 = window_SpeakInHouse == 0; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = !v12; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; @@ -12354,7 +12338,7 @@ uCurrentlyLoadedLevelType = LEVEL_null; pSpriteFrameTable->ResetSomeSpriteFlags(); v0 = uNumVisibleWindows; - pParty->field_1613C = 0; + pParty->armageddon_timer = 0; while ( v0 > 0 ) pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release(); } @@ -12972,6 +12956,7 @@ return false; } + game_starting_year = 1168; pParty = new Party; memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings));
--- a/mm7_3.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/mm7_3.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -1111,7 +1111,7 @@ { v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); } - if ( pParty->field_1613C != v17 && v0->CanAct() ) + if ( pParty->armageddon_timer != v17 && v0->CanAct() ) { v0->vVelocity.x += rand() % 100 - 50; v0->vVelocity.y += rand() % 100 - 50; @@ -7649,7 +7649,7 @@ v4 = a2; v18 = a2; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) return PaletteManager::Get(a2); if ( !pWeather->field_FA0 ) { @@ -7766,7 +7766,7 @@ v8 = a2; v9 = a1; v26 = a1; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) { *a5 = -1; *a6 = -1; @@ -7928,11 +7928,6 @@ *(char *)a8 = 1; return result; } -// 4D864C: using guessed type char byte_4D864C; -// 6BE030: using guessed type int day_attrib; -// 6BE040: using guessed type int day_fogrange_1; -// 6BE044: using guessed type int day_fogrange_2; -// 6BE3C4: using guessed type char bUnderwater; //----- (0047C178) -------------------------------------------------------- void *__fastcall sr_sub_47C178(signed int a1, stru148 *a2, int terrain_gamma, int a4) @@ -7943,7 +7938,7 @@ int v7; // [sp+8h] [bp-4h]@3 v4 = a2; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) { result = PaletteManager::Get(a2->pTexture->palette_id2); } @@ -7968,7 +7963,7 @@ v9 = a2; v4 = a1; a3a = 1; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) { result = PaletteManager::Get(a1->pTexture->palette_id2); } @@ -8029,7 +8024,7 @@ v9 = a2; v4 = a1; a2a = 1; - if ( pParty->field_1613C ) + if ( pParty->armageddon_timer ) { result = (char *)pPaletteManager->field_199600_palettes[a1->pTexture->palette_id2]; } @@ -8109,8 +8104,8 @@ v3 = pWeather->field_FA0; if ( bUnderwater == 1 ) v3 = 0; - if ( pParty->field_1613C || !(day_attrib & 1) && !bUnderwater ) - return 0xFF000000u; + if ( pParty->armageddon_timer || !(day_attrib & 1) && !bUnderwater ) + return 0xFF000000; if ( v3 ) { if ( v3 != 1 ) @@ -8159,56 +8154,56 @@ v7 = 248; return (-1 - v7) << 24; } -// 6BE030: using guessed type int day_attrib; -// 6BE040: using guessed type int day_fogrange_1; -// 6BE044: using guessed type int day_fogrange_2; -// 6BE3C4: using guessed type char bUnderwater; + //----- (0047C4FC) -------------------------------------------------------- -signed int __fastcall GetActorTintColor(int a1, int a2, float a3, int a4, RenderBillboard *a5) -{ - int v5; // esi@1 +signed int __fastcall GetActorTintColor(int tint, int a2, float a3, int a4, RenderBillboard *a5) +{ + //int v5; // esi@1 signed int v6; // edx@1 - signed int result; // eax@2 + //signed int result; // eax@2 int v8; // eax@3 double v9; // st7@12 double v10; // ST0C_8@18 int v11; // ecx@28 - signed int v12; // edi@28 - double v13; // ST0C_8@33 - double v14; // ST0C_8@34 + //signed int v12; // edi@28 + //double v13; // ST0C_8@33 + //double v14; // ST0C_8@34 double v15; // st7@44 - double v16; // ST0C_8@44 - double v17; // ST0C_8@44 + //double v16; // ST0C_8@44 + //double v17; // ST0C_8@44 int v18; // ST14_4@44 - double v19; // ST0C_8@44 + //double v19; // ST0C_8@44 signed int v20; // [sp+10h] [bp-4h]@10 float a3a; // [sp+1Ch] [bp+8h]@33 float a3b; // [sp+1Ch] [bp+8h]@34 float a3c; // [sp+1Ch] [bp+8h]@44 - float a3d; // [sp+1Ch] [bp+8h]@44 + //float a3d; // [sp+1Ch] [bp+8h]@44 float a4b; // [sp+20h] [bp+Ch]@18 int a4a; // [sp+20h] [bp+Ch]@33 - float a4c; // [sp+20h] [bp+Ch]@44 - float a4d; // [sp+20h] [bp+Ch]@44 + //float a4c; // [sp+20h] [bp+Ch]@44 + //float a4d; // [sp+20h] [bp+Ch]@44 int a5a; // [sp+24h] [bp+10h]@44 - v5 = a2; + //v5 = a2; v6 = 0; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - return 8 * (31 - a1) | ((8 * (31 - a1) | ((31 - a1) << 11)) << 8); + + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + return 8 * (31 - tint) | ((8 * (31 - tint) | ((31 - tint) << 11)) << 8); + if (pParty->armageddon_timer) + return 0xFFFF0000; + v8 = pWeather->field_FA0; if ( bUnderwater == 1 ) v8 = 0; - if ( pParty->field_1613C ) - return 16711680; if ( v8 ) { + __debugbreak(); // doubt that weather-related stuff will ever trigger, but if it suddenly does - find out what it is if ( v8 != 1 ) return 0; v20 = 1; - if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime > 0 ) - v20 = pParty->pPartyBuffs[16].uPower; + if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) + v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; v9 = (double)v20 * 1024.0; if ( a4 ) goto LABEL_19; @@ -8240,59 +8235,59 @@ v6 = 216; goto LABEL_20; } + + + if ( a3 == 0.0 ) - { - result = (signed int)0xF8F8F8; - } - else - { - v11 = 8 * (a1 - v5); - v12 = v11; + return 0xFFF8F8F8; + + v11 = 8 * (tint - a2); + //v12 = v11; if ( v11 >= 0 ) { if ( v11 > 216 ) - v12 = 216; - } - else - { - v12 = 0; - } + v11 = 216; + } + else + v11 = 0; + if ( a4 ) { a3b = pOutdoor->fFogDensity * 216.0; - v14 = a3b + 6.7553994e15; - a4a = LODWORD(v14); + //v14 = a3b + 6.7553994e15; + a4a = floorf(a3b + 0.5f);//LODWORD(v14); } else { a3a = (a3 / (double)pOutdoorCamera->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; - v13 = a3a + 6.7553994e15; - a4a = LODWORD(v13); - } - v6 = a4a + v12; + //v13 = a3a + 6.7553994e15; + a4a = floorf(a3a + 0.5f);//LODWORD(v13); + } + v6 = a4a + v11; if ( a5 ) v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); if ( v6 > 216 ) v6 = 216; - if ( v6 < v12 ) - v6 = v12; + if ( v6 < v11 ) + v6 = v11; if ( v6 > 8 * pOutdoor->field_CBC_terrain_triangles_shade_type ) v6 = 8 * pOutdoor->field_CBC_terrain_triangles_shade_type; if ( !bUnderwater ) return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); + else + { v15 = (double)(255 - v6) * 0.0039215689; a3c = v15; - a4c = v15 * 16.0; - v16 = a4c + 6.7553994e15; - a5a = LODWORD(v16); - a4d = a3c * 194.0; - v17 = a4d + 6.7553994e15; - v18 = LODWORD(v17); - a3d = a3c * 153.0; - v19 = a3d + 6.7553994e15; - result = LODWORD(v19) | ((v18 | (a5a << 8)) << 8); - } - return result; + //a4c = v15 * 16.0; + //v16 = a4c + 6.7553994e15; + a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16); + //a4d = a3c * 194.0; + //v17 = a4d + 6.7553994e15; + v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17); + //a3d = a3c * 153.0; + //v19 = a3d + 6.7553994e15; + return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8); + } } // 6BE3C4: using guessed type char bUnderwater; @@ -9546,14 +9541,7 @@ } return 0; } -// 4D864C: using guessed type char byte_4D864C; -// 6BE0E4: using guessed type int mipmapping_building_mm1; -// 6BE0E8: using guessed type int mipmapping_building_mm2; -// 6BE0EC: using guessed type int mipmapping_building_mm3; -// 80AA14: using guessed type int dword_80AA14; -// 80AA18: using guessed type int dword_80AA18; -// 80AA1C: using guessed type int dword_80AA1C; -// 80AA20: using guessed type int dword_80AA20; + //----- (004839BD) -------------------------------------------------------- signed int __fastcall sr_sub_4839BD(Span *ecx0, unsigned __int16 *pTargetSurface) @@ -14170,7 +14158,7 @@ max_string_length = 0; string_num = 1; prev_string_offset = 0; - + pLevelStrOffsets[0]=0; for (uint i = 0; i < uLevelStrFileSize; ++i) { if ( !pLevelStr[i] ) @@ -14192,7 +14180,7 @@ if ( uLevelStrNumStrings > 0 ) { - for(uint i = 1; i <uLevelStrNumStrings ; ++i) + for(uint i = 0; i <uLevelStrNumStrings ; ++i) { if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] ) ++pLevelStrOffsets[i]; @@ -14204,27 +14192,19 @@ //----- (00443F95) -------------------------------------------------------- void __cdecl OnMapLeave() { - signed int v0; // edi@1 - char *v1; // esi@2 - int v2; // ecx@4 - - v0 = 0; - if ( (signed int)uLevelEVT_NumEvents > 0 ) - { - v1 = (char *)&pLevelEVT_Index[0].event_sequence_num; - do - { - if ( pLevelEVT[*((short *)v1 + 2) + 4] == 53 ) - { - v2 = *((int *)v1 - 1); - dword_597F18 = *(int *)v1; - EventProcessor(v2, 0, 1); - dword_597F18 = 0; - } - ++v0; - v1 += 12; - } - while ( v0 < (signed int)uLevelEVT_NumEvents ); + _evt_raw *test_event; + if ( uLevelEVT_NumEvents > 0 ) + { + 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; + } + } } } @@ -14276,38 +14256,34 @@ } else if (_evt->_e_type == EVENT_OnMapReload) { - dword_597F18 = pEvent.event_sequence_num; + start_event_seq_number = pEvent.event_sequence_num; EventProcessor(pEvent.uEventID, 0, 0); - dword_597F18 = 0; + start_event_seq_number = 0; } else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) { - v3 = &array_5B5928[dword_5B65C8]; + v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; v20 = pOutdoor->uLastVisitDay; if (uCurrentlyLoadedLevelType == LEVEL_Indoor) v20 = pIndoor->stru1.uLastVisitDay; - v4 = _evt->_e_type; - v3->field_1C = v4; - v3->field_8 = pEvent.uEventID; - v3->field_A = pEvent.event_sequence_num; - 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; + v3->timer_evt_type = _evt->_e_type; + v3->timer_evt_ID = pEvent.uEventID; + v3->timer_evt_seq_num = pEvent.event_sequence_num; + + v3->field_10 = _evt->v5; + v3->field_12 = _evt->v6; + v3->field_14 = _evt->v7; + v3->field_16 = _evt->v8; + v3->field_18 = _evt->v9; + v3->field_1A = _evt->v10; + 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 ) + + v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11; + v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11; + if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 ) { if ( v20 ) v18 = pParty->uTimePlayed - v20; @@ -14319,7 +14295,7 @@ { if ( v5 ) { - ++dword_5B65C8; + ++dword_5B65C8_timers_count; v3->field_0_time = 0; continue; } @@ -14328,12 +14304,13 @@ v26 / 7 != 0 && v32 != 0 || v26 != 0 || !v20) { - ++dword_5B65C8; + ++dword_5B65C8_timers_count; v3->field_0_time = 0; continue; } } - + else + { v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); v9 = v8; v10 = (signed int)v8 / 60; @@ -14391,7 +14368,8 @@ + 0x24EA00 * (v28 + 12i64 * month)) << 7) * 0.033333335); - ++dword_5B65C8; + ++dword_5B65C8_timers_count; + } } } } @@ -14880,7 +14858,7 @@ { if ( pParty->uFlags & 2 ) pGame->Draw(); - if ( !dword_597F18 ) + if ( !start_event_seq_number ) pAudioPlayer->StopChannels(-1, -1); pMiscTimer->Pause(); pEventTimer->Pause(); @@ -14901,9 +14879,9 @@ pGUIWindow2->Release(); pGUIWindow2 = 0; _5C3420_pDecoration = _591094_decoration; - dword_597F18 = dword_5C341C; + start_event_seq_number = dword_5C341C; EventProcessor(dword_5C3418, 0, 1); - dword_597F18 = 0; + start_event_seq_number = 0; _5C3420_pDecoration = 0; pEventTimer->Resume(); } @@ -15709,7 +15687,7 @@ v13 = _this; if ( !_this ) return 0; - v3 = dword_597F18; + v3 = start_event_seq_number; pSomeOtherEVT = pGlobalEVT; uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, 0xCE40u); @@ -16200,9 +16178,9 @@ { _5773B8_event_timer = pParty->uTimePlayed; v12 = 0; - if ( dword_5B65C8 > 0 ) - { - v4 = (char *)&array_5B5928[0].field_C; + if ( dword_5B65C8_timers_count > 0 ) + { + v4 = (char *)&array_5B5928_timers[0].field_C; while ( 1 ) { v5 = *(short *)v4; @@ -16236,9 +16214,9 @@ *((int *)v4 - 2) = v3; } v11 = *((short *)v4 - 2); - dword_597F18 = *((short *)v4 - 1); + start_event_seq_number = *((short *)v4 - 1); EventProcessor(v11, 0, 1); - dword_597F18 = 0; + start_event_seq_number = 0; LABEL_25: v3 = HIDWORD(pParty->uTimePlayed); v2 = LODWORD(pParty->uTimePlayed); @@ -16246,7 +16224,7 @@ LABEL_26: ++v12; v4 += 32; - if ( v12 >= dword_5B65C8 ) + if ( v12 >= dword_5B65C8_timers_count ) return; v1 = 0; } @@ -16257,9 +16235,9 @@ } v6 = *((short *)v4 - 2); *(short *)v4 = *((short *)v4 + 1); - dword_597F18 = *((short *)v4 - 1); + start_event_seq_number = *((short *)v4 - 1); EventProcessor(v6, 0, 1); - dword_597F18 = v1; + start_event_seq_number = v1; goto LABEL_25; } } @@ -17788,11 +17766,11 @@ else BLV_4016FA_AI(); v0 = 0; - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->field_1613C > 0 ) - { - if ( pParty->field_1613C > 417 ) - { - pParty->field_1613C = 0; + if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) + { + if ( pParty->armageddon_timer > 417 ) + { + pParty->armageddon_timer = 0; } else { @@ -17804,11 +17782,11 @@ if ( v3 > 128 || (v2 = -128, v3 < -128) ) pParty->sRotationX = v2; pParty->uFlags |= 2u; - pParty->field_1613C -= pMiscTimer->uTimeElapsed; + pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; v4 = pParty->field_16140 + 50; - if ( pParty->field_1613C <= 0 ) - { - pParty->field_1613C = 0; + if ( pParty->armageddon_timer <= 0 ) + { + pParty->armageddon_timer = 0; v84 = 0; if ( (signed int)uNumActors > 0 ) {
--- a/mm7_4.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/mm7_4.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -2,6 +2,8 @@ #include <direct.h> #include <assert.h> +#include "MM7.h" + #include "MapInfo.h" #include "Game.h" #include "GUIWindow.h" @@ -3726,29 +3728,26 @@ //----- (00493F79) -------------------------------------------------------- -int sub_493F79(stru351 *_this, __int64 a2) +void sub_493F79(stru351_summoned_item *_this, __int64 a2) { signed __int64 v2; // ST2C_8@1 signed __int64 v3; // qax@1 - signed __int64 v4; // ST1C_8@1 + //signed __int64 v4; // ST1C_8@1 unsigned __int64 v5; // qax@1 unsigned int v6; // ebx@1 - int result; // eax@1 v2 = (signed __int64)((double)a2 * 0.234375); v3 = v2 / 60 / 60; - v4 = v3; + //v4 = v3; v5 = (unsigned int)v3 / 0x18; v6 = (unsigned int)(v5 / 7) >> 2; - _this->field_0 = v2 % 60; - _this->field_4 = v2 / 60 % 60; - _this->field_8 = v4 % 24; - _this->field_10 = v5 / 7 & 3; - _this->field_C = (unsigned int)v5 % 0x1C; - result = v6 / 0xC + 1168; - _this->field_14 = v6 % 0xC; - _this->field_18 = result; - return result; + _this->field_0_expire_second = v2 % 60; + _this->field_4_expire_minute = v2 / 60 % 60; + _this->field_8_expire_hour = v3 % 24; + _this->field_10_expire_week = v5 / 7 & 3; + _this->field_C_expire_day = (unsigned int)v5 % 0x1C; + _this->field_14_exprie_month = v6 % 0xC; + _this->field_18_expire_year = v6 / 0xC + game_starting_year; } @@ -3841,7 +3840,7 @@ pParty->uCurrentHour = v2 % 24; pParty->uDaysPlayed = (unsigned int)v3 % 28; pParty->uCurrentMonth = v4 % 12; - pParty->uCurrentYear = v4 / 0xC + 1168; + pParty->uCurrentYear = v4 / 0xC + game_starting_year; if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 28 > v61) ) { pParty->pHirelings[0].bHasUsedTheAbility = false; @@ -4887,8 +4886,8 @@ int v53; // [sp-4h] [bp-13Ch]@107 int v54; // [sp+0h] [bp-138h]@107 __int16 v55[56]; // [sp+10h] [bp-128h]@34 - stru351 v56; // [sp+80h] [bp-B8h]@107 - stru351 v57; // [sp+9Ch] [bp-9Ch]@115 + stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 + stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 char a1[100]; // [sp+B8h] [bp-80h]@3 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 //size_t v60; // [sp+120h] [bp-18h]@3 @@ -5237,9 +5236,9 @@ if ( !a6 ) goto _continue_strcat; sub_493F79(&v57, *a6); - v54 = v57.field_18; - v53 = v57.field_C + 1; - v50 = v57.field_14; + v54 = v57.field_18_expire_year; + v53 = v57.field_C_expire_day + 1; + v50 = v57.field_14_exprie_month; sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); v11 = a1; goto _continue_strcat; @@ -5261,9 +5260,9 @@ HIDWORD(v49) = pParty->field_3C.field_440[2 * v17 + 1]; LODWORD(v49) = pParty->field_3C.field_440[2 * v17]; sub_493F79(&v56, v49); - v54 = v56.field_18; - v53 = v56.field_C + 1; - v50 = v56.field_14; + v54 = v56.field_18_expire_year; + v53 = v56.field_C_expire_day + 1; + v50 = v56.field_14_exprie_month; sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); v11 = a1; goto _continue_strcat; @@ -9063,7 +9062,7 @@ //----- (004B1A2D) -------------------------------------------------------- void __cdecl sub_4B1A2D() { - Player *v0; // edi@1 + //Player *v0; // edi@1 POINT *v1; // esi@5 unsigned int v2; // eax@5 int v3; // ecx@5 @@ -9083,7 +9082,7 @@ POINT a2; // [sp+40h] [bp-Ch]@5 int v18; // [sp+48h] [bp-4h]@5 - v0 = pPlayers[uActiveCharacter]; + //v0 = pPlayers[uActiveCharacter]; if ( dword_F8B198 <= 0 ) return; if ( dword_F8B198 <= 4 ) @@ -9098,9 +9097,9 @@ v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos((POINT *)&v14)->y - 17) >> 5); if ( pMouse->GetCursorPos((POINT *)&v13)->x <= 13 || pMouse->GetCursorPos((POINT *)&v12)->x >= 462 - || (v9 = v0->GetItemIDAtInventoryIndex(&v18)) == 0 ) + || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) return; - v7 = (ItemGen *)&v0->pInventoryItems[v9-1]; + v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; LABEL_15: GameUI_DrawItemInfo(v7); return; @@ -9113,7 +9112,7 @@ v18 = v5; if ( !v5 ) return; - v6 = 9 * (v5 + 12 * (unsigned int)ptr_507BC0->ptr_1C); + v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); if ( dword_F8B19C != 2 ) v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; @@ -9126,7 +9125,7 @@ v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; if ( v18 ) - sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)ptr_507BC0->ptr_1C)); + sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); } } // F8B198: using guessed type int dword_F8B198; @@ -9156,7 +9155,7 @@ pParty->uCurrentMonthWeek = v4 / 7 & 3; pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; pParty->uCurrentMonth = v5 % 0xC; - pParty->uCurrentYear = v5 / 0xC + 1168; + pParty->uCurrentYear = v5 / 0xC + game_starting_year; pParty->RestAndHeal(); dword_507B94 = 1; v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; @@ -9198,12 +9197,12 @@ if ( dword_F8B198 != 23 ) return; } - v1 = (unsigned int)ptr_507BC0->ptr_1C; + v1 = (unsigned int)window_SpeakInHouse->ptr_1C; LABEL_28: HousePlaySomeSound(v1, v0); return; } - v1 = (unsigned int)ptr_507BC0->ptr_1C; + v1 = (unsigned int)window_SpeakInHouse->ptr_1C; if ( (signed __int64)__PAIR__(pParty->field_3C._shop_ban_times[2 * v1 + 1], pParty->field_3C._shop_ban_times[2 * v1]) <= (signed __int64)pParty->uTimePlayed ) { if ( pParty->uNumGold <= 0x2710 ) @@ -9649,7 +9648,7 @@ strcpy(v22, v24); pParty->field_709 = 0; sub_44A56A(); - PrepareHouse((unsigned int)ptr_507BC0->ptr_1C); + PrepareHouse((HOUSE_TYPE)(int)window_SpeakInHouse->ptr_1C); dword_F8B19C = 1; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { @@ -10170,7 +10169,7 @@ v56 = v52.pStartingPosActiveItem; if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) { - v15 = (char *)v54; + v15 = "";//(char *)v54; while ( 1 ) { v16 = v52.GetControl(v56); @@ -10444,7 +10443,7 @@ v19 = 1; do { - v20 = (char *)ptr_507BC0->ptr_1C + 4 * (unsigned int)ptr_507BC0->ptr_1C + v19; + v20 = (char *)window_SpeakInHouse->ptr_1C + 4 * (unsigned int)window_SpeakInHouse->ptr_1C + v19; if ( v1 ) v21 = word_4F063E[(signed int)v20]; else @@ -10524,7 +10523,7 @@ v12 = 1; do { - v13 = v11 + 2 * (unsigned int)ptr_507BC0->ptr_1C - 30; + v13 = v11 + 2 * (unsigned int)window_SpeakInHouse->ptr_1C - 30; v14 = v12 + 4 * v13 + v13; if ( v10 ) v15 = word_4F06D8[v14]; @@ -10924,7 +10923,7 @@ sub_4B36CC(1, 0x10u); v4 = 3; sub_4B36CC(2, 0x60u); - v5 = (signed int)ptr_507BC0->ptr_1C; + v5 = (signed int)window_SpeakInHouse->ptr_1C; if ( v5 < 108 || v5 > 120 ) goto LABEL_28; v4 = 4; @@ -11544,7 +11543,7 @@ int v73; // [sp+80h] [bp-4h]@14 v0 = pPlayers[uActiveCharacter]; - memcpy(&v65, ptr_507BC0, sizeof(v65)); + memcpy(&v65, window_SpeakInHouse, sizeof(v65)); v65.uFrameX = 483; v65.uFrameWidth = 148; v65.uFrameZ = 334; @@ -11558,7 +11557,7 @@ v3 += v4 + 1; v5 = 1000 * v3; v6 = HIDWORD(v0->uExperience); - v7 = ptr_507BC0->ptr_1C; + v7 = window_SpeakInHouse->ptr_1C; v68 = (unsigned __int16)word_4F0866[(signed int)v7]; v66 = 1000 * v3; if ( (signed __int64)__PAIR__(v6, LODWORD(v0->uExperience)) >= v66 ) @@ -11592,7 +11591,7 @@ i = 0; v13 = pDialogueWindow; //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v14 = (signed __int64)(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].flt_24 * 500.0); + v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); v73 = v14 * (100 - v0->GetMerchant()) / 100; if ( v73 < v14 / 3 ) v73 = v14 / 3; @@ -11695,7 +11694,7 @@ if ( pParty->uNumGold >= i ) { Party::TakeGold(i); - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); ++v0->uLevel; v0->uSkillPoints += v0->uLevel / 10 + 5; v0->sHealth = v0->GetMaxHealth(); @@ -11714,7 +11713,7 @@ if ( *v39 > v37 ) { v40 = sub_494820(pParty->uCurrentHour); - v41 = ptr_507BC0->ptr_1C; + v41 = window_SpeakInHouse->ptr_1C; v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; if ( v41 == (void *)94 || v41 == (void *)95 ) v42 += 720; @@ -11731,7 +11730,7 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" v63 = 4; LABEL_55: - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, v63); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63); LABEL_56: result = pMessageQueue_50CBD0->uNumMessages; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) @@ -11990,7 +11989,7 @@ v0 = pPlayers[uActiveCharacter]; _this = pPlayers[uActiveCharacter]; - memcpy(&v112, ptr_507BC0, sizeof(v112)); + memcpy(&v112, window_SpeakInHouse, sizeof(v112)); v112.uFrameX = 483; v112.uFrameWidth = 148; v112.uFrameZ = 334; @@ -12060,7 +12059,7 @@ { v31 = pDialogueWindow; v3 = 0; - v32 = ptr_507BC0->ptr_1C; + v32 = window_SpeakInHouse->ptr_1C; v118 = 0; //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0); v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0); @@ -12171,9 +12170,9 @@ return result; v96 = 0; v94 = 5; - v93 = ptr_507BC0->ptr_1C; + v93 = window_SpeakInHouse->ptr_1C; v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5]; - v28 = (int)ptr_507BC0->ptr_1C; + v28 = (int)window_SpeakInHouse->ptr_1C; uPlayerID = uActiveCharacter - 1; v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5); v9 = uPlayerID; @@ -12265,16 +12264,16 @@ v4 = (char *)&_this->pInventoryItems[result-1]; if ( v4[20] & 1 ) { - v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)ptr_507BC0->ptr_1C, 4, 0); + v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); v97 = 3; v95 = v5; v92 = white; v6 = (212 - pFontArrus->CalcTextHeight(v5, &v112, 0, 0)) / 2 + 101; return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); } - v93 = ptr_507BC0->ptr_1C; + v93 = window_SpeakInHouse->ptr_1C; v90 = (ItemGen *)v4; - v7 = (int)ptr_507BC0->ptr_1C; + v7 = (int)window_SpeakInHouse->ptr_1C; uPlayerID = uActiveCharacter - 1; v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4); v9 = uPlayerID; @@ -12301,9 +12300,9 @@ return result; v96 = 0; v94 = 3; - v93 = ptr_507BC0->ptr_1C; + v93 = window_SpeakInHouse->ptr_1C; v90 = (ItemGen *)&_this->pInventoryItems[result-1]; - v12 = (int)ptr_507BC0->ptr_1C; + v12 = (int)window_SpeakInHouse->ptr_1C; uPlayerID = uActiveCharacter - 1; v13 = _this->_490EEE(v90, 3, v12, 3); v9 = uPlayerID; @@ -12329,7 +12328,7 @@ { do { - if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] ) + if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) { v50 = dword_F8B168[v49]; v51 = 152 - v50->uTextureHeight; @@ -12361,7 +12360,7 @@ v122 = 0; do { - if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 54] ) + if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) { v54 = dword_F8B168[v122 + 6]; v55 = 306 - v54->uTextureHeight; @@ -12391,7 +12390,7 @@ { do { - if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] ) + if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) { v58 = dword_F8B168[v49]; v59 = 152 - v58->uTextureHeight; @@ -12423,7 +12422,7 @@ v122 = 0; do { - if ( pParty->field_C59C[9 * (v122 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 778] ) + if ( pParty->field_C59C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) { v62 = dword_F8B168[v122 + 6]; v63 = 306 - v62->uTextureHeight; @@ -12460,7 +12459,7 @@ { do { - if ( pParty->field_777C[9 * (v66 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] ) + if ( pParty->field_777C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) ++v117; ++v66; } @@ -12470,7 +12469,7 @@ { do { - if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] ) + if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) ++v117; ++v66; } @@ -12493,8 +12492,8 @@ if ( !v117 ) return (int)v112._4B1854( __PAIR__( - pParty->field_3C.field_50[2 * (unsigned int)ptr_507BC0->ptr_1C + 1], - pParty->field_3C.field_50[2 * (unsigned int)ptr_507BC0->ptr_1C]) + pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C + 1], + pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) - pParty->uTimePlayed); v70 = pMouse->GetCursorPos(&v102); result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; @@ -12502,7 +12501,7 @@ { v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; v117 = v71; - v72 = (int)ptr_507BC0->ptr_1C; + v72 = (int)window_SpeakInHouse->ptr_1C; v73 = 9 * (v71 + 12 * v72); v74 = (ItemGen *)&pParty->field_777C[v73]; if ( dword_F8B19C != 2 ) @@ -12512,7 +12511,7 @@ v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" v96 = 0; v94 = 2; - v93 = ptr_507BC0->ptr_1C; + v93 = window_SpeakInHouse->ptr_1C; v90 = v74; v9 = uActiveCharacter - 1; } @@ -12520,7 +12519,7 @@ { v96 = 0; v94 = 2; - v93 = ptr_507BC0->ptr_1C; + v93 = window_SpeakInHouse->ptr_1C; v90 = v74; uPlayerID = uActiveCharacter - 1; v75 = _this->_490EEE(v74, 3, v72, 2); @@ -12927,8 +12926,8 @@ unsigned int v62; // [sp+2E4h] [bp-8h]@13 int v63; // [sp+2E8h] [bp-4h]@1 - v0 = ptr_507BC0; - memcpy(&v52, ptr_507BC0, sizeof(v52)); + v0 = window_SpeakInHouse; + memcpy(&v52, window_SpeakInHouse, sizeof(v52)); v58 = pPlayers[uActiveCharacter]; v1 = v58; v52.uFrameX = 483; @@ -12964,7 +12963,7 @@ if ( pParty->uNumGold < v63 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); } else { @@ -12991,7 +12990,7 @@ v63 = 32; do { - if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)ptr_507BC0->ptr_1C)) ) + if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) { pRenderer->DrawTextureTransparent(v63, 0x5Au, dword_F8B168[v6]); ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), dword_F8B168[v6], v6 + 1); @@ -13007,7 +13006,7 @@ v63 = 32; do { - if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)ptr_507BC0->ptr_1C)) ) + if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) { pRenderer->DrawTextureTransparent(v63, 0xFAu, dword_F8B168[v7]); ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), dword_F8B168[v7], v7 + 1); @@ -13023,7 +13022,7 @@ { v8 = 0; v9 = 12; - v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)ptr_507BC0->ptr_1C); + v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C); do { if ( *(int *)v10 ) @@ -13040,17 +13039,17 @@ if ( !v8 ) return (int)v52._4B1854( __PAIR__( - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)ptr_507BC0->ptr_1C + 44472], - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)ptr_507BC0->ptr_1C + 44468]) + *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], + *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - pParty->uTimePlayed); v12 = pMouse->GetCursorPos(&v51); result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) { - v14 = ptr_507BC0->ptr_1C; + v14 = window_SpeakInHouse->ptr_1C; v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); - v16 = (int)ptr_507BC0->ptr_1C; + v16 = (int)window_SpeakInHouse->ptr_1C; uPlayerID = uActiveCharacter - 1; v17 = v1->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, @@ -13073,7 +13072,7 @@ } if ( !(unsigned __int16)_449B57_test_bit( (unsigned __int8 *)v1->field_152, - word_4F0704[2 * (unsigned int)ptr_507BC0->ptr_1C]) ) + word_4F0704[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) { v36 = pNPCTopics[121].pText; v37 = v57; @@ -13277,8 +13276,8 @@ unsigned int v65; // [sp+1BCh] [bp-8h]@6 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6 - v0 = ptr_507BC0; - memcpy(&v57, ptr_507BC0, sizeof(v57)); + v0 = window_SpeakInHouse; + memcpy(&v57, window_SpeakInHouse, sizeof(v57)); v57.uFrameX = 483; v57.uFrameWidth = 148; v57.uFrameZ = 334; @@ -13302,7 +13301,7 @@ { v4 = pDialogueWindow; v61 = pDialogueWindow; - v5 = ptr_507BC0->ptr_1C; + v5 = window_SpeakInHouse->ptr_1C; v66 = 0; //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); @@ -13395,7 +13394,7 @@ return result; } //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - v24 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier; + v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; v25 = 0; if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) { @@ -13469,7 +13468,7 @@ { LABEL_55: ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); goto LABEL_46; } Party::TakeGold(v2); @@ -13481,7 +13480,7 @@ memset(v1, 0, 0xA0u); v1->sHealth = v1->GetMaxHealth(); v1->sMana = v1->GetMaxMana(); - v36 = (signed int)ptr_507BC0->ptr_1C; + v36 = (signed int)window_SpeakInHouse->ptr_1C; if ( v36 != 78 && (v36 <= 80 || v36 > 82) ) { if ( (unsigned int)v61 | v35 ) @@ -13615,12 +13614,12 @@ void *result; // eax@15 signed int v12; // [sp-4h] [bp-18h]@7 - v0 = ptr_507BC0; + v0 = window_SpeakInHouse; v1 = 0; - v2 = (int)&ptr_507BC0->ptr_1C; - v3 = (signed int)ptr_507BC0->ptr_1C; + v2 = (int)&window_SpeakInHouse->ptr_1C; + v3 = (signed int)window_SpeakInHouse->ptr_1C; //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] ) - if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].uType] ) + if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) { while ( v3 > 14 ) { @@ -13650,16 +13649,16 @@ v6 = v12; LABEL_13: pItemsTable->GenerateItem(v5, v6, (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]); - v0 = ptr_507BC0; - v2 = (int)&ptr_507BC0->ptr_1C; - pParty->field_C59C[9 * (v1 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 729] = 1; + v0 = window_SpeakInHouse; + v2 = (int)&window_SpeakInHouse->ptr_1C; + pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1; goto LABEL_14; } auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]; _a->Reset(); v2 = (int)&v0->ptr_1C; v10 = rand(); - v0 = ptr_507BC0; + v0 = window_SpeakInHouse; pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740; } LABEL_14: @@ -13722,8 +13721,8 @@ int v34; // [sp+74h] [bp-8h]@17 int v35; // [sp+78h] [bp-4h]@17 - v0 = ptr_507BC0; - memcpy(&v28, ptr_507BC0, sizeof(v28)); + v0 = window_SpeakInHouse; + memcpy(&v28, window_SpeakInHouse, sizeof(v28)); v1 = pPlayers[uActiveCharacter]; v28.uFrameX = 483; v28.uFrameWidth = 148; @@ -13774,7 +13773,7 @@ *(short *)v6 = 1; v27 = 2; } - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, v27); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v27); } } else @@ -13794,7 +13793,7 @@ } if ( !(unsigned __int16)_449B57_test_bit( (unsigned __int8 *)v1->field_152, - word_4F0754[2 * (unsigned int)ptr_507BC0->ptr_1C]) ) + word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) { v24 = pNPCTopics[171].pText; v25 = v31; @@ -13965,8 +13964,8 @@ unsigned int s1; // [sp+288h] [bp-8h]@1 int v66; // [sp+28Ch] [bp-4h]@48 - v0 = ptr_507BC0; - memcpy(&v53, ptr_507BC0, sizeof(v53)); + v0 = window_SpeakInHouse; + memcpy(&v53, window_SpeakInHouse, sizeof(v53)); v2 = 255; v61 = pPlayers[uActiveCharacter]; v1 = v61; @@ -14009,7 +14008,7 @@ while ( 1 ) { v47[1] = (const char *)v60; - v22 = ptr_507BC0->ptr_1C; + v22 = window_SpeakInHouse->ptr_1C; v23 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62); v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62); v24 = v16->GetControl(v60); @@ -14027,7 +14026,7 @@ v47[1] = v27; sprintf(a1, format_4E2DC8, v27); v66 = (unsigned __int8)byte_4F09B8[v26 * 4]; - if ( (signed int)ptr_507BC0->ptr_1C >= 63 ) + if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) { if ( CheckHiredNPCSpeciality(8u) ) v66 -= 2; @@ -14130,7 +14129,7 @@ if ( pParty->uNumGold < s1 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 3); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) return; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; @@ -14139,7 +14138,7 @@ } Party::TakeGold(s1); v47[1] = (const char *)7; - v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)ptr_507BC0->ptr_1C] + dword_F8B19C)]; + v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dword_F8B19C)]; if ( v5[pParty->uDaysPlayed % 7 + 1] ) { if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) ) @@ -14173,9 +14172,9 @@ pParty->uFallStartY = pParty->vPosition.z; pParty->sRotationY = *((int *)v5 + 6); } - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); v12 = (unsigned __int8)v5[8]; - if ( (signed int)ptr_507BC0->ptr_1C >= 63 ) + if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) { v63 = SPEECH_72; v13 = 2500; @@ -14867,124 +14866,134 @@ } //----- (0044606A) -------------------------------------------------------- -int __fastcall PrepareHouse(unsigned int uHouseID) -{ - unsigned int v1; // ebx@1 - signed int v2; // esi@1 - int uExitPic; // edi@1 +void PrepareHouse(HOUSE_TYPE house) +{ + //unsigned int v1; // ebx@1 + //signed int v2; // esi@1 + //int uExitPic; // edi@1 __int16 uExitMapID; // ax@2 - int result; // eax@5 - unsigned int *v6; // ecx@8 + //int result; // eax@5 + //unsigned int *v6; // ecx@8 int v7; // ebx@11 - int v8; // esi@16 - unsigned int v9; // eax@16 - unsigned int v10; // eax@19 - int v11; // ecx@19 - char pContainer[36]; // [sp+Ch] [bp-54h]@16 + //int v8; // esi@16 + //unsigned int v9; // eax@16 + //unsigned int v10; // eax@19 + //int v11; // ecx@19 + //char pContainer[36]; // [sp+Ch] [bp-54h]@16 int v13; // [sp+30h] [bp-30h]@11 int Dst[6]; // [sp+34h] [bp-2Ch]@1 - unsigned int v15; // [sp+4Ch] [bp-14h]@1 + //unsigned int v15; // [sp+4Ch] [bp-14h]@1 int uAnimationID; // [sp+50h] [bp-10h]@1 - unsigned int *v17; // [sp+54h] [bp-Ch]@3 - unsigned int v18; // [sp+58h] [bp-8h]@1 - int v19; // [sp+5Ch] [bp-4h]@7 - - v15 = uHouseID; - v1 = 52 * uHouseID; + //unsigned int *v17; // [sp+54h] [bp-Ch]@3 + //unsigned int v18; // [sp+58h] [bp-8h]@1 + //int v19; // [sp+5Ch] [bp-4h]@7 + + //v15 = uHouseID; + //v1 = 52 * uHouseID; //uAnimationID = p2DEvents_minus1___02[26 * uHouseID]; - uAnimationID = p2DEvents[uHouseID - 1].uAnimationID; - v2 = 0; - v18 = 52 * uHouseID; + uAnimationID = p2DEvents[house - 1].uAnimationID; + //v18 = 52 * uHouseID; memset(Dst, 0, 0x18u); //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1); - uExitPic = p2DEvents[uHouseID - 1].uExitPicID; + //uExitPic = p2DEvents[uHouseID - 1].uExitPicID; uNumDialogueNPCPortraits = 0; - uHouse_ExitPic = uExitPic; - if ( uExitPic ) + uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; + if ( uHouse_ExitPic ) { //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1); - uExitMapID = p2DEvents[uHouseID - 1]._quest_related; + uExitMapID = p2DEvents[house - 1]._quest_related; if ( uExitMapID > 0 ) { - v17 = (unsigned int *)(uExitMapID - 1); - if ( !((unsigned __int8)(0x80u >> (signed int)v17 % 8) & pParty->_award_bits[(uExitMapID - 1) >> 3]) ) - { - uExitPic = 0; + //v17 = (unsigned int *)(uExitMapID - 1); + if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_award_bits[(uExitMapID - 1) >> 3]) ) + { + //uExitPic = 0; uHouse_ExitPic = 0; } } } + dword_591080 = pAnimatedRooms[uAnimationID].field_8; - result = dword_591080; + //result = dword_591080; + + //v2 = 0; + uNumDialogueNPCPortraits = 0; if ( dword_591080 ) { - v2 = 1; + //v2 = 1; Dst[0] = dword_591080; uNumDialogueNPCPortraits = 1; } - v19 = 1; - if ( (signed int)pNPCStats->uNumNewNPCs > 1 ) - { - v6 = &pNPCStats->pNewNPCData[1].uFlags; - v17 = &pNPCStats->pNewNPCData[1].uFlags; - do - { - if ( v6[3] == v15 ) - { - if ( !(*(char *)v6 & 0x80) ) - { - v7 = v2++ - (result != 0); - array_5913D8[v7] = (NPCData *)(v6 - 2); - v6 = v17; - *(&v13 + v2) = *(v17 - 1); - v1 = v18; - if ( (*v6 & 3) != 2 ) - ++*v6; - } - } - ++v19; - v6 += 19; - v17 = v6; - } - while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); - uNumDialogueNPCPortraits = v2; - } - v19 = 0; - if ( v2 > 0 ) - { - do - { - v8 = v19; - sprintf(pContainer, "npc%03u", Dst[v19]); - v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - ++v19; - pDialogueNPCPortraits[v8] = &pIcons_LOD->pTextures[v9]; - result = v19; - } - while ( v19 < uNumDialogueNPCPortraits ); - uExitPic = uHouse_ExitPic; - } - if ( uExitPic ) - { - v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uExitPic], TEXTURE_16BIT_PALETTE); - v11 = uNumDialogueNPCPortraits++; - pDialogueNPCPortraits[v11] = &pIcons_LOD->pTextures[v10]; + + //v19 = 1; + for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) + { + auto npc = pNPCStats->pNewNPCData + i; + //v6 = &pNPCStats->pNewNPCData[1].uFlags; + //v17 = &pNPCStats->pNewNPCData[1].uFlags; + //do + //{ + if (npc->Location2D == house ) + { + if (~npc->uFlags & 0x80) + //if ( !(*(char *)v6 & 0x80) ) + { + v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0; + array_5913D8[v7] = npc; + //v6 = v17; + //*(&v13 + v2) = *(v17 - 1); + Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID; + //v1 = v18; + if ((npc->uFlags & 3) != 2) + ++npc->uFlags; + } + } + //++v19; + //v6 += 19; + //v17 = v6; + //} + //while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); + } + //uNumDialogueNPCPortraits = v2; + + //v19 = 0; + for (uint i = 0; i < uNumDialogueNPCPortraits; ++i) + //if ( v2 > 0 ) + { + //do + //{ + //v8 = v19; + char icon_name[128]; + sprintfex(icon_name, "npc%03u", Dst[i]); + //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + //++v19; + pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); + //result = v19; + //} + //while ( v19 < uNumDialogueNPCPortraits ); + //uExitPic = uHouse_ExitPic; + } + + if (uHouse_ExitPic) + { + //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); + //v11 = uNumDialogueNPCPortraits++; + pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1); - result = p2DEvents[uHouseID - 1].uExitMapID; - uHouse_ExitPic = result; - } - return result; -} - + //result = p2DEvents[house - 1].uExitMapID; + uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; + } + //return result; +} //----- (0044622E) -------------------------------------------------------- -bool __fastcall EnterHouse(enum HOUSE_TYPE uHouseID) -{ - enum HOUSE_TYPE v1; // edi@1 - int v2; // edi@5 +bool __fastcall EnterHouse(HOUSE_TYPE uHouseID) +{ + //enum HOUSE_TYPE v1; // edi@1 + //int v2; // edi@5 unsigned int uOpenTime; // eax@5 int uCloseTime; // esi@5 unsigned int v5; // esi@5 @@ -14992,24 +15001,24 @@ signed int v7; // ecx@10 signed int v8; // eax@10 int v9; // esi@10 - unsigned int v10; // esi@16 + //unsigned int v10; // esi@16 int v11; // ecx@17 unsigned int v12; // kr00_4@25 - Player *v13; // esi@25 + //Player *v13; // esi@25 int v14; // eax@25 - Player *v15; // esi@27 + //Player *v15; // esi@27 signed int v16; // eax@32 unsigned int v17; // eax@37 signed int v18; // edi@37 signed int v19; // edi@41 - unsigned int v20; // ecx@41 + //unsigned int v20; // ecx@41 const char *v22; // [sp-4h] [bp-40h]@33 char pContainer[40]; // [sp+Ch] [bp-30h]@32 unsigned int v24; // [sp+34h] [bp-8h]@5 - enum HOUSE_TYPE v25; // [sp+38h] [bp-4h]@1 - - v1 = uHouseID; - v25 = uHouseID; + //enum HOUSE_TYPE v25; // [sp+38h] [bp-4h]@1 + + //v1 = uHouseID; + //v25 = uHouseID; GameUI_StatusBar_TimedString[0] = 0; pStatusBarString[0] = 0; ShowStatusBarString("", 2u); @@ -15019,16 +15028,16 @@ uDialogueType = 0; pKeyActionMap->_459ED1(3); pKeyActionMap->ResetKeys(); - if ( v1 == 600 || v1 == 601 ) + if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) { GameOverMenu(0); return 0; } - v2 = 26 * v1; + //v2 = 26 * v1; //uOpenTime = p2DEvents_minus1_::uOpenTime[v2]; - uOpenTime = p2DEvents[v1 - 1].uOpenTime; + uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; //uCloseTime = p2DEvents_minus1_::uCloseTime[v2]; - uCloseTime = p2DEvents[v1 - 1].uCloseTime; + uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; ptr_F8B1E8 = 0; v24 = uOpenTime; v5 = uCloseTime - 1; @@ -15071,48 +15080,52 @@ if ( pParty->uCurrentHour > v5 ) goto LABEL_10; LABEL_16: - v10 = v25; - if ( (signed int)v25 >= 53 ) + //v10 = uHouseID; + if ( (signed int)uHouseID >= 53 ) goto LABEL_21; - v11 = pParty->field_3C._shop_ban_times[2 * v25 + 1]; - if ( !(v11 | pParty->field_3C._shop_ban_times[2 * v25]) - || (signed __int64)__PAIR__(v11, pParty->field_3C._shop_ban_times[2 * v25]) <= (signed __int64)pParty->uTimePlayed ) - { - pParty->field_3C._shop_ban_times[2 * v25] = 0; - pParty->field_3C._shop_ban_times[2 * v10 + 1] = 0; + v11 = pParty->field_3C._shop_ban_times[2 * uHouseID + 1]; + if ( !(v11 | pParty->field_3C._shop_ban_times[2 * uHouseID]) + || (signed __int64)__PAIR__(v11, pParty->field_3C._shop_ban_times[2 * uHouseID]) <= (signed __int64)pParty->uTimePlayed ) + { + pParty->field_3C._shop_ban_times[2 * uHouseID] = 0; + pParty->field_3C._shop_ban_times[2 * uHouseID + 1] = 0; LABEL_21: - if ( !dword_597F18 ) + if ( !start_event_seq_number ) pAudioPlayer->StopChannels(-1, -1); //uCurrentHouse_Animation = p2DEvents_minus1___02[v2]; - uCurrentHouse_Animation = p2DEvents[v2 / sizeof(_2devent) - 1].uAnimationID; + uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; dword_F8B198 = LOBYTE(pAnimatedRooms[uCurrentHouse_Animation].field_C); - if ( dword_F8B198 == 20 && pParty->uFine ) + if ( dword_F8B198 == 20 && pParty->uFine ) // going 2 jail { uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; - v25 = (HOUSE_TYPE)187; + //v25 = HOUSE_187; + uHouseID = HOUSE_JAIL; v12 = LODWORD(pParty->uTimePlayed); LODWORD(pParty->uTimePlayed) += 0x7620000u; - v13 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; - v14 = LOBYTE(pAnimatedRooms[(signed __int16)p2DEvents[186].uAnimationID].field_C); + v14 = LOBYTE(pAnimatedRooms[(signed __int16)p2DEvents[HOUSE_186].uAnimationID].field_C); pParty->uTimePlayed = __PAIR__(HIDWORD(pParty->uTimePlayed), v12) + 0x7620000; dword_F8B198 = v14; - do - { - v13->uTimeToRecovery = 0; - memset(&v13->uTimeToRecovery, 0, 4u); - ++v13; - } - while ( v13 <= &pParty->pPlayers[3] ); + //v13 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; + //do ++pParty->uNumPrisonTerms; pParty->uFine = 0; - v15 = pParty->pPlayers; + for (uint i = 0; i < 4; ++i) + { + pParty->pPlayers[i].uTimeToRecovery = 0; + pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; + pParty->pPlayers[i].SetVariable(VAR_Award, 87); + //v13->uTimeToRecovery = 0; + //memset(&v13->uTimeToRecovery, 0, 4u); + //++v13; + } + //while ( v13 <= &pParty->pPlayers[3] ); + /*v15 = pParty->pPlayers; do { - v15->SetVariable(VAR_Award, 87); ++v15; } - while ( v15 <= &pParty->pPlayers[3] ); - v10 = v25; + while ( v15 <= &pParty->pPlayers[3] );*/ + //v10 = v25; } ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) @@ -15135,25 +15148,25 @@ array_5913D8[6] = 0; pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; uTextureID_507B04 = uTextureID_right_panel; - PrepareHouse(v10); + PrepareHouse(uHouseID); v18 = 1; uTextureID_507B04 = uTextureID_right_panel; if ( uNumDialogueNPCPortraits == 1 ) array_5913D8[6] = (NPCData *)1; pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); - if ( (signed int)v10 < 139 || (signed int)v10 > 172 ) - { - if ( (signed int)v10 >= 54 && (signed int)v10 <= 73 && !sub_4B68EA(v10 - 54) ) + if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) + { + if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) ) goto LABEL_49; - v20 = v10; + //v20 = uHouseID; } else { - v19 = word_4F0704[2 * v10] - 1; - v20 = v10; + v19 = word_4F0704[2 * uHouseID] - 1; + //v20 = uHouseID; if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->field_152[v19 >> 3]) ) { - HousePlaySomeSound(v10, 3); + HousePlaySomeSound(uHouseID, 3); v18 = 1; LABEL_49: dword_5C35D4 = v18; @@ -15161,7 +15174,7 @@ } v18 = 1; } - HousePlaySomeSound(v20, v18); + HousePlaySomeSound(uHouseID, v18); goto LABEL_49; } ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!"
--- a/mm7_5.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/mm7_5.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -1278,8 +1278,8 @@ if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); - if ( pGUIWindow_CurrentMenu == ptr_507BC0 ) - ptr_507BC0 = 0; + if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) + window_SpeakInHouse = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; @@ -1311,8 +1311,8 @@ if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); - if ( pGUIWindow_CurrentMenu == ptr_507BC0 ) - ptr_507BC0 = 0; + if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) + window_SpeakInHouse = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; @@ -1518,8 +1518,8 @@ if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); - if ( pGUIWindow_CurrentMenu == ptr_507BC0 ) - ptr_507BC0 = 0; + if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) + window_SpeakInHouse = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; @@ -1547,7 +1547,7 @@ sub_4B1D27(); pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 814, 0, -1, 0, 0, 0, 0); pVideoPlayer->Unload(); - pGUIWindow_CurrentMenu = ptr_507BC0; + pGUIWindow_CurrentMenu = window_SpeakInHouse; //goto LABEL_322; if ( pGUIWindow_Settings ) { @@ -1568,8 +1568,8 @@ if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); - if ( pGUIWindow_CurrentMenu == ptr_507BC0 ) - ptr_507BC0 = 0; + if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) + window_SpeakInHouse = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; @@ -1641,8 +1641,8 @@ if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); - if ( pGUIWindow_CurrentMenu == ptr_507BC0 ) - ptr_507BC0 = 0; + if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) + window_SpeakInHouse = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; @@ -1670,8 +1670,8 @@ if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); - if ( pGUIWindow_CurrentMenu == ptr_507BC0 ) - ptr_507BC0 = 0; + if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) + window_SpeakInHouse = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; @@ -1705,8 +1705,8 @@ if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); - if ( pGUIWindow_CurrentMenu == ptr_507BC0 ) - ptr_507BC0 = 0; + if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) + window_SpeakInHouse = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; @@ -1849,10 +1849,10 @@ } else { - dword_597F18 = dword_5C341C; + start_event_seq_number = dword_5C341C; EventProcessor(dword_5C3418, 0, v0); } - dword_597F18 = 0; + start_event_seq_number = 0; if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) pParty->uTimePlayed += 1474560i64; continue; @@ -1860,7 +1860,7 @@ CloseWindowBackground(); pVideoPlayer->Unload(); sub_44603D(); - dword_597F18 = 0; + start_event_seq_number = 0; goto LABEL_422; case UIMSG_CycleCharacters: v39 = GetAsyncKeyState(VK_SHIFT); @@ -2126,7 +2126,7 @@ dword_6BE364_game_settings_1 |= v0; uGameState = 2; //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; - v53 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1]._quest_related; + v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; if ( v53 < 0 ) { v54 = abs(v53) - 1; @@ -3225,7 +3225,7 @@ pGlobalTXT_LocalizationStrings[79],// "Exit" (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); //, v179); continue; - case UIMSG_6B: + case UIMSG_GameMenuButton: if ( pCurrentScreen ) { pGUIWindow_CurrentMenu->Release(); @@ -3239,6 +3239,7 @@ free((void *)uNumSeconds); stru_506E40._40E55E("gamma.pcx", 0); GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0); + uNumVisibleWindows = uNumVisibleWindows - 1; //Ritor1: Insert //LABEL_453: if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; @@ -3993,7 +3994,7 @@ SetCurrentMenuID(MENU_10); continue; } - if ( pUIMessageType == UIMSG_6B )//unknow + if ( pUIMessageType == UIMSG_GameMenuButton )//unknow { __debugbreak(); if ( pCurrentScreen ) @@ -12540,7 +12541,7 @@ int v2; // ecx@1 int v3; // eax@1 - v0 = ptr_507BC0->ptr_1C; + v0 = window_SpeakInHouse->ptr_1C; dword_4E1874 = 5; v1 = &stru_4E1890[(int)((char *)v0 - 108)]; amuint_4E1860 = v1->field_4; @@ -13668,15 +13669,15 @@ } if ( v6->pLevelOfDetail0 ) { - v7 = 2 * (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); - v19 = pViewport->uViewportY + dword_4E20D0[v7 + 1]; - v17 = pViewport->uViewportX + dword_4E20D0[v7]; + v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); + v19 = pViewport->uViewportY + pIconPos[v7].Ypos; + v17 = pViewport->uViewportX + pIconPos[v7].Xpos; if ( BYTE1(v6->pBits) & 2 ) pRenderer->DrawTextureTransparent(v17, v19, v6); else pRenderer->DrawTextureIndexed(v17, v19, v6); - v8 = 2 * (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); - pRenderer->_4A612A(dword_4E20D0[v8], dword_4E20D0[v8 + 1], v23, v4); + v8 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); + pRenderer->_4A612A(pIconPos[v8].Xpos,pIconPos[v8].Ypos, v23, v4); } } } @@ -13692,9 +13693,9 @@ if ( v11->pLevelOfDetail0 ) { v21 = dword_5063D8[v10]; - v12 = 2 * (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); - v20 = pViewport->uViewportY + dword_4E20D0[v12 + 1]; - v18 = pViewport->uViewportX + dword_4E20D0[v12]; + v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); + v20 = pViewport->uViewportY + pIconPos[v12].Ypos; + v18 = pViewport->uViewportX + pIconPos[v12].Xpos; if ( BYTE1(v11->pBits) & 2 ) pRenderer->DrawTextureTransparent(v18, v20, v21); else @@ -13899,7 +13900,8 @@ v6 = pStru179.field_0[dword_506528]; dword_506548 = 0; dword_506520 = 0; - v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); + //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); + v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); v8 = BuilDialogueString( pStorylineText->StoreLine[v6].pText, uActiveCharacter - 1, @@ -15783,9 +15785,9 @@ continue; } pWindowList[pVisibleWindowsIdxs[i] - 1]._4B3157(); - if ( !ptr_507BC0 ) - continue; - v10 = ptr_507BC0->ptr_1C; + if ( !window_SpeakInHouse ) + continue; + v10 = window_SpeakInHouse->ptr_1C; if ( (signed int)v10 >= 53 ) continue; v11 = pParty->field_3C._shop_ban_times[2 * (_DWORD)v10 + 1]; @@ -16706,7 +16708,7 @@ if ( pCurrentScreen == SCREEN_HOUSE ) { if ( (signed int)pY < 345 && (signed int)pX < 469 ) - sub_4B1A2D(); + sub_4B1A2D();//identify item in inventory goto LABEL_132; } if ( pCurrentScreen <= SCREEN_HOUSE )
--- a/mm7_6.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/mm7_6.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -7686,11 +7686,11 @@ v640 = v12 - 2; if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) amount = 3; - if ( pPlayer->uNumArmageddonCasts >= amount || pParty->field_1613C > v1 ) + if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > v1 ) goto LABEL_200; if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; - pParty->field_1613C = 256; + pParty->armageddon_timer = 256; pParty->field_16140 = v2; ++pPlayer->uNumArmageddonCasts; if ( pParty->bTurnBasedModeOn == 1 )
--- a/mm7_data.cpp Thu Feb 21 22:42:35 2013 +0600 +++ b/mm7_data.cpp Thu Feb 21 22:42:52 2013 +0600 @@ -103,7 +103,7 @@ "Warlock Stables", 0x21, 0x181, 0x3201B, "Elf Stables", 0x21, 0x195, 0x34D1B, "Human Tavern01", 0xD, 0x2C2, 0x3115, - "Necromancer Tavern 01", 0xD, 0x3B0, 0x3915, + "Necromancer Tavern01", 0xD, 0x3B0, 0x3915, "Dwarven Tavern01", 0xD, 0x2FE, 0x5E15, "Wizard Tavern", 0xD, 0x3BB, 0x1115, "Warlock Tavern", 0xD, 0x3A8, 0x2115, @@ -432,7 +432,7 @@ stru220 stru_76E5C8[16384]; #include "stru176.h" -stru176 array_5B5928[100]; +stru176 array_5B5928_timers[100]; #include "ObjectList.h" struct ObjectList *pObjectList; @@ -509,6 +509,8 @@ //------------------------------------------------------------------------- // Data declarations +int game_starting_year = 0; + int pWindowList_at_506F50_minus1_indexing[1]; int dword_4C9890[10]; // weak int dword_4C9920[16]; // weak @@ -570,19 +572,8 @@ __int16 pTownPortalBook_ys[6]; __int16 pTownPortalBook_ws[6]; __int16 pTownPortalBook_hs[6]; -int dword_4E20D0[777]; // idb -unsigned char pSpellbookSpellIndices[9][12] = // 4E2430 -{ - {0, 3, 1, 8, 11, 7, 4, 10, 6, 2, 5, 9}, - {0, 11, 2, 9, 6, 8, 5, 10, 3, 7, 1, 4}, - {0, 4, 8, 9, 1, 10, 3, 11, 7, 6, 2, 5}, - {0, 7, 10, 8, 2, 11, 1, 5, 3, 6, 4, 9}, - {0, 5, 10, 11, 7, 2, 8, 1, 4, 9, 3, 6}, - {0, 5, 9, 8, 3, 7, 6, 4, 1, 11, 2, 10}, - {0, 1, 6, 9, 3, 5, 8, 11, 7, 10, 4, 2}, - {0, 1, 10, 11, 9, 4, 3, 6, 5, 7, 8, 2}, - {0, 9, 3, 7, 1, 5, 2, 10, 11, 8, 6, 4} -}; + + unsigned int pLloydsBeaconsPreviewXs[5] = {61, 281, 61, 281, 171}; // 004E249C unsigned int pLloydsBeaconsPreviewYs[5] = {84, 84, 228, 228, 155}; unsigned int pLloydsBeacons_SomeXs[5] = {59, 279, 59, 279, 169}; @@ -958,9 +949,34 @@ int pNPCPortraits_x = 521; // idb int dword_4E5EC8[777]; // weak int pNPCPortraits_y = 38; // idb -const char *pHouse_ExitPictures[11]; -char *_4E6BDC_loc_names[11]; -char aOutside[777]; // idb +const char *pHouse_ExitPictures[11]= +{ + "", + "ticon01", + "ticon02", + "ticon03", + "ticon04", + "ticon05", + "istairup", + "itrap", + "outside", + "idoor", + "isecdoor" +}; +const char *_4E6BDC_loc_names[11]= +{ + "mdt12.blv", + "d18.blv", + "mdt14.blv", + "d37.blv", + "mdk01.blv", + "mdt01.blv", + "mdr01.blv", + "mdt10.blv", + "mdt09.blv", + "mdt15.blv", + "mdt11.blv" +}; char aMer[777]; // idb char aMir[777]; // idb char aSel[777]; // idb @@ -1920,7 +1936,7 @@ struct Texture *pTexture_outside; // idb struct Texture *pTexture_Dialogue_Background; _UNKNOWN unk_597F10; // weak -int dword_597F18; // weak +int start_event_seq_number; // weak char byte_5B0938[2000]; int dword_5B5920; // weak int dword_5B5924; // weak @@ -1932,7 +1948,7 @@ int dword_5B65BC; // weak int dword_5B65C0; // weak int dword_5B65C4; // weak -int dword_5B65C8; // weak +int dword_5B65C8_timers_count; // weak int dword_5B65CC; // weak int dword_5B65D0_dialogue_actor_npc_id; // weak int dword_5C3418; // weak
--- a/mm7_data.h Thu Feb 21 22:42:35 2013 +0600 +++ b/mm7_data.h Thu Feb 21 22:42:52 2013 +0600 @@ -311,6 +311,8 @@ //------------------------------------------------------------------------- // Data declarations +extern int game_starting_year; + extern int pWindowList_at_506F50_minus1_indexing[1]; extern int dword_4C9890[10]; // weak extern int dword_4C9920[16]; // weak @@ -372,7 +374,6 @@ extern __int16 pTownPortalBook_ys[6]; extern __int16 pTownPortalBook_ws[6]; extern __int16 pTownPortalBook_hs[6]; -extern int dword_4E20D0[]; // idb extern unsigned char pSpellbookSpellIndices[9][12]; // 4E2430 extern unsigned int pLloydsBeaconsPreviewXs[5]; // 004E249C extern unsigned int pLloydsBeaconsPreviewYs[5]; @@ -684,7 +685,7 @@ extern int dword_4E5EC8[]; // weak extern int pNPCPortraits_y; // idb extern const char *pHouse_ExitPictures[11]; -extern char *_4E6BDC_loc_names[11]; +extern const char *_4E6BDC_loc_names[11]; extern char aOutside[]; // idb extern char aMer[]; // idb extern char aMir[]; // idb @@ -1341,7 +1342,7 @@ extern struct Texture *pTexture_outside; // idb extern struct Texture *pTexture_Dialogue_Background; extern _UNKNOWN unk_597F10; // weak -extern int dword_597F18; // weak +extern int start_event_seq_number; // weak extern char byte_5B0938[2000]; extern int dword_5B5920; // weak extern int dword_5B5924; // weak @@ -1353,7 +1354,7 @@ extern int dword_5B65BC; // weak extern int dword_5B65C0; // weak extern int dword_5B65C4; // weak -extern int dword_5B65C8; // weak +extern int dword_5B65C8_timers_count; // weak extern int dword_5B65CC; // weak extern int dword_5B65D0_dialogue_actor_npc_id; // weak extern int dword_5C3418; // weak @@ -2023,7 +2024,7 @@ struct NPCData *__fastcall GetNewNPCData(signed int npcid, int a2); int __fastcall sub_445C8B(signed int a1); void __cdecl sub_44603D(); -int __fastcall PrepareHouse(unsigned int uHouseID); // idb +void PrepareHouse(enum HOUSE_TYPE house); // idb bool __fastcall EnterHouse(enum HOUSE_TYPE uHouseID); int sub_4465DF_check_season(int a1); int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb @@ -2248,7 +2249,7 @@ signed int __thiscall CycleCharacter(unsigned int _this); void __fastcall Rest(unsigned int uHoursToSleep); int __cdecl _493938_regenerate(); -int __thiscall sub_493F79(struct stru351 *_this, __int64 a2); +void sub_493F79(struct stru351_summoned_item *_this, __int64 a2); void __cdecl _494035_timed_effects__water_walking_damage__etc(); unsigned int __fastcall sub_494820(unsigned int a1); char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2);
--- a/stru176.h Thu Feb 21 22:42:35 2013 +0600 +++ b/stru176.h Thu Feb 21 22:42:52 2013 +0600 @@ -6,8 +6,8 @@ struct stru176 { signed __int64 field_0_time; - __int16 field_8; - __int16 field_A; + __int16 timer_evt_ID; + __int16 timer_evt_seq_num; __int16 field_C; __int16 field_E; __int16 field_10; @@ -16,9 +16,9 @@ __int16 field_16; __int16 field_18; __int16 field_1A; - __int16 field_1C; + __int16 timer_evt_type; __int16 field_1E; }; #pragma pack(pop) -extern stru176 array_5B5928[100]; +extern stru176 array_5B5928_timers[100];
--- a/stru272.h Thu Feb 21 22:42:35 2013 +0600 +++ b/stru272.h Thu Feb 21 22:42:52 2013 +0600 @@ -4,7 +4,7 @@ /* 270 */ #pragma pack(push, 1) -struct stru272_stru0 +struct stru272_stru0 // ARCOMAGE stuff { int _40DFFE(); int _40E01A(int a2);
--- a/stru351.h Thu Feb 21 22:42:35 2013 +0600 +++ b/stru351.h Thu Feb 21 22:42:52 2013 +0600 @@ -3,14 +3,14 @@ /* 391 */ #pragma pack(push, 1) -struct stru351 +struct stru351_summoned_item { - int field_0; - int field_4; - int field_8; - int field_C; - int field_10; - int field_14; - int field_18; + int field_0_expire_second; + int field_4_expire_minute; + int field_8_expire_hour; + int field_C_expire_day; + int field_10_expire_week; + int field_14_exprie_month; + int field_18_expire_year; }; #pragma pack(pop) \ No newline at end of file