# HG changeset patch # User Ritor1 # Date 1361417150 -21600 # Node ID bbf8efb5bfeeab79258cd752582224f5192ec6aa # Parent bc7f77c694c3099196be728822d52d47241d07ad# Parent 95be2dcecadffbefb93e906acc3ca2944bff9cdb Слияние diff -r bc7f77c694c3 -r bbf8efb5bfee Arcomage.cpp --- a/Arcomage.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/Arcomage.cpp Thu Feb 21 09:25:50 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 ) diff -r bc7f77c694c3 -r bbf8efb5bfee Bink_Smacker.cpp --- a/Bink_Smacker.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/Bink_Smacker.cpp Thu Feb 21 09:25:50 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,11 +141,10 @@ 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 return 0; diff -r bc7f77c694c3 -r bbf8efb5bfee Bink_Smacker.h --- a/Bink_Smacker.h Thu Feb 21 09:25:36 2013 +0600 +++ b/Bink_Smacker.h Thu Feb 21 09:25:50 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); diff -r bc7f77c694c3 -r bbf8efb5bfee Events.cpp --- a/Events.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/Events.cpp Thu Feb 21 09:25:50 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; //} } } diff -r bc7f77c694c3 -r bbf8efb5bfee Events.h --- a/Events.h Thu Feb 21 09:25:36 2013 +0600 +++ b/Events.h Thu Feb 21 09:25:50 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; diff -r bc7f77c694c3 -r bbf8efb5bfee GUIButton.cpp --- a/GUIButton.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/GUIButton.cpp Thu Feb 21 09:25:50 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; diff -r bc7f77c694c3 -r bbf8efb5bfee GUIButton.h --- a/GUIButton.h Thu Feb 21 09:25:36 2013 +0600 +++ b/GUIButton.h Thu Feb 21 09:25:50 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; diff -r bc7f77c694c3 -r bbf8efb5bfee GUIWindow.cpp --- a/GUIWindow.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/GUIWindow.cpp Thu Feb 21 09:25:50 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 ); } } } @@ -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); } } diff -r bc7f77c694c3 -r bbf8efb5bfee MM7.h --- a/MM7.h Thu Feb 21 09:25:36 2013 +0600 +++ b/MM7.h Thu Feb 21 09:25:50 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 }; diff -r bc7f77c694c3 -r bbf8efb5bfee NPC.cpp --- a/NPC.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/NPC.cpp Thu Feb 21 09:25:50 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 diff -r bc7f77c694c3 -r bbf8efb5bfee NPC.h --- a/NPC.h Thu Feb 21 09:25:36 2013 +0600 +++ b/NPC.h Thu Feb 21 09:25:50 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; diff -r bc7f77c694c3 -r bbf8efb5bfee Party.cpp --- a/Party.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/Party.cpp Thu Feb 21 09:25:50 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; diff -r bc7f77c694c3 -r bbf8efb5bfee Party.h --- a/Party.h Thu Feb 21 09:25:36 2013 +0600 +++ b/Party.h Thu Feb 21 09:25:50 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]; diff -r bc7f77c694c3 -r bbf8efb5bfee Player.cpp --- a/Player.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/Player.cpp Thu Feb 21 09:25:50 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; diff -r bc7f77c694c3 -r bbf8efb5bfee Render.cpp --- a/Render.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/Render.cpp Thu Feb 21 09:25:50 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 diff -r bc7f77c694c3 -r bbf8efb5bfee Render.h --- a/Render.h Thu Feb 21 09:25:36 2013 +0600 +++ b/Render.h Thu Feb 21 09:25:50 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); diff -r bc7f77c694c3 -r bbf8efb5bfee SaveLoad.cpp --- a/SaveLoad.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/SaveLoad.cpp Thu Feb 21 09:25:50 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); diff -r bc7f77c694c3 -r bbf8efb5bfee StorylineTextTable.cpp --- a/StorylineTextTable.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/StorylineTextTable.cpp Thu Feb 21 09:25:50 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; @@ -50,13 +57,13 @@ switch (decode_step) { case 1: - StoreLine[i].pText=RemoveQuotes(test_string); + StoreLine[i+1].pText=RemoveQuotes(test_string); break; case 2: - StoreLine[i].uTime=atoi(test_string); //strange but in text here string not digit + StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit break; case 3: - StoreLine[i].pPageTitle=RemoveQuotes(test_string); + StoreLine[i+1].pPageTitle=RemoveQuotes(test_string); break; } } diff -r bc7f77c694c3 -r bbf8efb5bfee VideoPlayer.cpp --- a/VideoPlayer.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/VideoPlayer.cpp Thu Feb 21 09:25:50 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; } diff -r bc7f77c694c3 -r bbf8efb5bfee mm7_1.cpp --- a/mm7_1.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/mm7_1.cpp Thu Feb 21 09:25:50 2013 +0600 @@ -49,6 +49,7 @@ #include "StorylineTextTable.h" #include "Events2D.h" #include "texts.h" +#include "stru351.h" #include "mm7_data.h" @@ -2356,12 +2357,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 +2658,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 +5196,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 +5791,7 @@ uActiveCharacter = uPlayerID; return; } - if ( ptr_507BC0->field_40 == 1 ) + if ( window_SpeakInHouse->field_40 == 1 ) return; viewparams->bRedrawGameUI = true; if ( uActiveCharacter != uPlayerID ) diff -r bc7f77c694c3 -r bbf8efb5bfee mm7_2.cpp --- a/mm7_2.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/mm7_2.cpp Thu Feb 21 09:25:50 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; @@ -3783,16 +3783,16 @@ v4 += v5++ + 1; while ( v5 < v7 ); } - if ( v7 < (unsigned __int16)word_4F0866[(unsigned int)ptr_507BC0->ptr_1C] + if ( v7 < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C] && (signed __int64)v6->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)] + *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + v2)] + pParty->uDaysPlayed % 7)) || dword_F8B198 != 23 || v55 != 10 ) @@ -3816,7 +3816,7 @@ pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1); LABEL_10: v3 = dword_F8B198; - v8 = ptr_507BC0; + v8 = window_SpeakInHouse; goto LABEL_11; } if ( uActiveCharacter != v1 ) @@ -3833,7 +3833,7 @@ v3 = dword_F8B198; dword_F8B164 = &pIcons_LOD->pTextures[v9]; LABEL_13: - v8 = ptr_507BC0; + v8 = window_SpeakInHouse; } if ( v3 > 21 ) { @@ -3869,7 +3869,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,11 +3879,11 @@ 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); @@ -3910,7 +3910,7 @@ * (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 ) @@ -4181,7 +4181,7 @@ v39 = 4; else v39 = 2; - HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, v39); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v39); } else { @@ -4217,12 +4217,12 @@ { GenerateShopItems(); sub_4B8F94(); - v8 = ptr_507BC0; - v40 = ptr_507BC0->ptr_1C; + 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); @@ -4242,7 +4242,7 @@ { v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); v3 = dword_F8B198; - v8 = ptr_507BC0; + v8 = window_SpeakInHouse; dword_F8B168[v43] = &pIcons_LOD->pTextures[v46]; } v42 = v8->ptr_1C; @@ -4263,7 +4263,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; @@ -4285,7 +4285,7 @@ { v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); v3 = dword_F8B198; - v8 = ptr_507BC0; + v8 = window_SpeakInHouse; dword_F8B168[v43] = &pIcons_LOD->pTextures[v51]; } v42 = v8->ptr_1C; @@ -4306,7 +4306,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 +4394,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 +4527,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 +4539,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 +4573,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 +4586,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 +4612,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 +4646,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 +4675,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 +4706,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 +4741,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 +4786,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 +4796,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 +5099,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 +5175,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 +10995,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 +11975,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 +12354,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 +12972,7 @@ return false; } + game_starting_year = 1168; pParty = new Party; memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings)); diff -r bc7f77c694c3 -r bbf8efb5bfee mm7_3.cpp --- a/mm7_3.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/mm7_3.cpp Thu Feb 21 09:25:50 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) @@ -14156,59 +14144,47 @@ //----- (00443E31) -------------------------------------------------------- void __cdecl LoadLevel_InitializeLevelStr() { - signed __int16 v0; // si@1 - //unsigned int v1; // ecx@1 - signed int v2; // edi@1 - int v3; // edx@1 - //int v4; // eax@2 - int v5; // ebx@4 - int v6; // ebx@11 - int v7; // eax@12 - unsigned int *v8; // edi@13 - char Args[100]; // [sp+Ch] [bp-68h]@9 - int v10; // [sp+70h] [bp-4h]@1 - - if (sizeof(pLevelStrOffsets) != 0x7D0) + + char Args[100]; + int string_num; + int max_string_length; + int current_string_length; + int prev_string_offset; + + if (sizeof(pLevelStrOffsets) != 2000) Log::Warning(L"pLevelStrOffsets: deserialization warning"); - memset(pLevelStrOffsets, 0, 0x7D0u); + memset(pLevelStrOffsets, 0, 2000); - v0 = 0; - //v1 = uLevelStrFileSize; - v2 = 1; - v3 = 0; - v10 = 0; - //v4 = 0; + max_string_length = 0; + string_num = 1; + prev_string_offset = 0; + pLevelStrOffsets[0]=0; for (uint i = 0; i < uLevelStrFileSize; ++i) { if ( !pLevelStr[i] ) { - v5 = (signed __int16)v2++; - pLevelStrOffsets[v5] = i + 1; - if ( (signed __int16)(i - (short)v10) > v0 ) - v0 = i - v10; - v10 = i; - } - } - - uLevelStrNumStrings = (signed __int16)v2 - 1; - if ( v0 > 800 ) - { - sprintf(Args, "MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", v0 + 1); + pLevelStrOffsets[string_num] = i + 1; + ++string_num; + if ( i - prev_string_offset > max_string_length ) + max_string_length = i - prev_string_offset; + prev_string_offset = i; + } + } + + uLevelStrNumStrings = string_num - 1; + if ( max_string_length > 800 ) + { + sprintf(Args, "MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1); Abortf(Args); } - v6 = 0; - if ( (signed __int16)v2 - 1 > 0 ) - { - v7 = 0; - do - { - v8 = &pLevelStrOffsets[v7]; - if ( RemoveQuotes(&pLevelStr[*v8]) != &pLevelStr[*v8] ) - ++*v8; - ++v6; - v7 = (signed __int16)v6; - } - while ( (signed __int16)v6 < (signed int)uLevelStrNumStrings ); + + if ( uLevelStrNumStrings > 0 ) + { + for(uint i = 0; i 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; + } + } } } @@ -14288,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; @@ -14331,7 +14295,7 @@ { if ( v5 ) { - ++dword_5B65C8; + ++dword_5B65C8_timers_count; v3->field_0_time = 0; continue; } @@ -14340,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; @@ -14403,7 +14368,8 @@ + 0x24EA00 * (v28 + 12i64 * month)) << 7) * 0.033333335); - ++dword_5B65C8; + ++dword_5B65C8_timers_count; + } } } } @@ -14892,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(); @@ -14913,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(); } @@ -15721,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); @@ -16212,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; @@ -16248,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); @@ -16258,7 +16224,7 @@ LABEL_26: ++v12; v4 += 32; - if ( v12 >= dword_5B65C8 ) + if ( v12 >= dword_5B65C8_timers_count ) return; v1 = 0; } @@ -16269,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; } } @@ -17800,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 { @@ -17816,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 ) { diff -r bc7f77c694c3 -r bbf8efb5bfee mm7_4.cpp --- a/mm7_4.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/mm7_4.cpp Thu Feb 21 09:25:50 2013 +0600 @@ -2,6 +2,8 @@ #include #include +#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; @@ -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; @@ -14868,123 +14867,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 +15002,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 +15029,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 +15081,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 +15149,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 +15175,7 @@ } v18 = 1; } - HousePlaySomeSound(v20, v18); + HousePlaySomeSound(uHouseID, v18); goto LABEL_49; } ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" diff -r bc7f77c694c3 -r bbf8efb5bfee mm7_5.cpp --- a/mm7_5.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/mm7_5.cpp Thu Feb 21 09:25:50 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; @@ -7005,11 +7005,11 @@ //----- (0043CC7C) -------------------------------------------------------- void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID) { - Player **ppPlayer; // esi@1 + //Player **ppPlayer; // esi@1 Player *pPlayer; // ebx@1 - enum CHARACTER_RACE pRace; // edi@1 + //enum CHARACTER_RACE pRace; // edi@1 signed int pSex; // eax@1 - int v5; // edi@4 + //int v5; // edi@4 unsigned int v6; // ecx@9 int v7; // ecx@10 unsigned int v8; // eax@14 @@ -7072,7 +7072,7 @@ int v65; // edi@148 char *v66; // eax@148 Texture *v67; // edi@149 - Player *v68; // ebx@155 + //Player *v68; // ebx@155 unsigned int v69; // edx@155 int v70; // edx@156 unsigned int v71; // eax@160 @@ -7221,7 +7221,7 @@ Texture *a2i; // [sp+14h] [bp-38h]@284 int a2j; // [sp+14h] [bp-38h]@312 int a2k; // [sp+14h] [bp-38h]@336 - Player *v217; // [sp+18h] [bp-34h]@1 + //Player *v217; // [sp+18h] [bp-34h]@1 int v218; // [sp+1Ch] [bp-30h]@15 int v219; // [sp+1Ch] [bp-30h]@60 int v220; // [sp+1Ch] [bp-30h]@94 @@ -7254,28 +7254,23 @@ int uPlayerID_a; // [sp+38h] [bp-14h]@9 signed int IsDwarf; // [sp+40h] [bp-Ch]@4 int v249; // [sp+40h] [bp-Ch]@358 - signed int v250; // [sp+44h] [bp-8h]@1 - - ppPlayer = &pPlayers[uPlayerID]; - pPlayer = *ppPlayer; + //signed int v250; // [sp+44h] [bp-8h]@1 + + pPlayer = pPlayers[uPlayerID]; uPlayerID_ = uPlayerID; - v217 = *ppPlayer; pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE); - pRace = pPlayer->GetRace(); pSex = pPlayer->GetSexByVoice(); - v250 = pSex; - if ( pRace && pRace != 1 && pRace != 2 ) + if ( pPlayer->GetRace() && pPlayer->GetRace() != 1 && pPlayer->GetRace() != 2 ) { IsDwarf = 1; - v5 = (pSex != 0) + 2; + pBodyComplection = (pSex != 0) + 2; } else { IsDwarf = 0; - v5 = pSex != 0; - } - pBodyComplection = v5; - v244 = (*ppPlayer)->uFace; + pBodyComplection = pSex != 0; + } + v244 = pPlayer->uFace; pRenderer->ResetClip(); pRenderer->DrawTextureIndexed(0x1D3u, 0, (Texture *)(uTextureID_BACKDOLL != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BACKDOLL] : 0));// if ( !IsPlayerWearingWatersuit[uPlayerID_] ) @@ -7284,7 +7279,7 @@ if ( !v21 ) goto LABEL_59; v230 = pPlayer->pEquipment.uBow; - v22 = (int)&v217->pInventoryItems[v21-1]; + v22 = (int)&pPlayer->pInventoryItems[v21-1]; v23 = *(int *)v22; v24 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[v23].uEquipX; a3b = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[v23].uEquipY; @@ -7316,11 +7311,11 @@ if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(v24, a3b, v27, v230); LABEL_59: - v31 = v217->pEquipment.uCloak;// + v31 = pPlayer->pEquipment.uCloak;// if ( !v31 ) goto LABEL_93; - v231 = v217->pEquipment.uCloak; - v32 = (int)&v217->pInventoryItems[v31-1]; + v231 = pPlayer->pEquipment.uCloak; + v32 = (int)&pPlayer->pInventoryItems[v31-1]; v219 = v32; if ( *(int *)v32 != 525 ) { @@ -7368,11 +7363,11 @@ v240 = 4 * uPlayerID_ - 4; pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, (Texture *)(*(unsigned int *)((char *)papredoll_dbods + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dbods + v240)] : 0)); - v43 = v217->pEquipment.uBody;// + v43 = pPlayer->pEquipment.uBody;// if ( !v43 ) goto LABEL_127; - v232 = v217->pEquipment.uBody; - v44 = (int)&v217->pInventoryItems[v43-1]; + v232 = pPlayer->pEquipment.uBody; + v44 = (int)&pPlayer->pInventoryItems[v43-1]; v220 = v44; if ( *(int *)v44 != 504 ) { @@ -7427,11 +7422,11 @@ if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2d, a3d, v54, v232); LABEL_127: - v56 = v217->pEquipment.field_20; + v56 = pPlayer->pEquipment.field_20; if ( !v56 ) goto LABEL_155; - v233 = v217->pEquipment.field_20; - v57 = (int)&v217->pInventoryItems[v56-1]; + v233 = pPlayer->pEquipment.field_20; + v57 = (int)&pPlayer->pInventoryItems[v56-1]; v221 = v57; v58 = *(int *)v57; if ( *(int *)v57 == 529 ) @@ -7492,19 +7487,18 @@ if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2e, a3e, v67, v233); LABEL_155: - v68 = v217; - v69 = v217->pEquipment.uMainHand; + v69 = pPlayer->pEquipment.uMainHand; uPlayerID_a = 2 * pBodyComplection; - if ( !v69 || (v70 = *(int *)&v217->pInventoryItems[v69-1], pItemsTable->pItems[v70].uEquipType != 1) - && (pItemsTable->pItems[v70].uSkillType != 4 || v217->pEquipment.uOffHand) ) + if ( !v69 || (v70 = *(int *)&pPlayer->pInventoryItems[v69-1], pItemsTable->pItems[v70].uEquipType != 1) + && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayer->pEquipment.uOffHand) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], (Texture *)(*(unsigned int *)((char *)papredoll_dlads + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlads + v240)] : 0)); - v71 = v217->pEquipment.uBelt; + v71 = pPlayer->pEquipment.uBelt; if ( v71 ) { - v234 = v217->pEquipment.uBelt; - v72 = (int)&v217->pInventoryItems[v71-1]; + v234 = pPlayer->pEquipment.uBelt; + v72 = (int)&pPlayer->pInventoryItems[v71-1]; v222 = v72; if ( *(int *)v72 == 524 ) { @@ -7529,8 +7523,8 @@ v75 = stru_511718.texids[v74]; else v75 = stru_511718.texids[v73 + 7 * (pBodyComplection - 2)]; - v76 = *(int *)&v217->field_1F5[36 * v71 + 15]; - if ( !(*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) ) + v76 = *(int *)&pPlayer->field_1F5[36 * v71 + 15]; + if ( !(*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) ) { v79 = v75 + 1; v80 = (char *)&pIcons_LOD->pTextures[v75]; @@ -7554,12 +7548,11 @@ } if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2f, a3f, v81, v234); - v68 = v217; goto LABEL_192; } - if ( (*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) != 16 ) + if ( (*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) != 16 ) { - if ( (*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) == 32 ) + if ( (*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) == 32 ) { v172 = "sp28a"; v77 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v172, TEXTURE_16BIT_PALETTE)]; @@ -7572,10 +7565,9 @@ } v78 = (double)GetTickCount() * 0.1; pRenderer->_4A63E6(a2f, a3f, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), v77, (signed __int64)v78, 0, 255); - v68 = v217; goto LABEL_192; } - if ( (*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) == 64 ) + if ( (*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) == 64 ) { v172 = "sp30a"; v77 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v172, TEXTURE_16BIT_PALETTE)]; @@ -7588,10 +7580,9 @@ } v78 = (double)GetTickCount() * 0.1; pRenderer->_4A63E6(a2f, a3f, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), v77, (signed __int64)v78, 0, 255); - v68 = v217; goto LABEL_192; } - if ( (*(int *)&v217->field_1F5[36 * v71 + 15] & 0xF0) == 128 ) + if ( (*(int *)&pPlayer->field_1F5[36 * v71 + 15] & 0xF0) == 128 ) { v172 = "sp91a"; v77 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v172, TEXTURE_16BIT_PALETTE)]; @@ -7604,7 +7595,6 @@ } v78 = (double)GetTickCount() * 0.1; pRenderer->_4A63E6(a2f, a3f, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), v77, (signed __int64)v78, 0, 255); - v68 = v217; goto LABEL_192; } } @@ -7619,24 +7609,23 @@ } v78 = (double)GetTickCount() * 0.1; pRenderer->_4A63E6(a2f, a3f, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), v77, (signed __int64)v78, 0, 255); - v68 = v217; goto LABEL_192; } } LABEL_192: - v82 = v68->pEquipment.uMainHand; + v82 = pPlayer->pEquipment.uMainHand; if ( v82 ) { - v83 = *(int *)&v68->pInventoryItems[v82-1]; + v83 = *(int *)&pPlayer->pInventoryItems[v82-1]; if ( pItemsTable->pItems[v83].uEquipType == 1 - || pItemsTable->pItems[v83].uSkillType == 4 && !v68->pEquipment.uOffHand ) + || pItemsTable->pItems[v83].uSkillType == 4 && !pPlayer->pEquipment.uOffHand ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[0][uPlayerID_a], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[0][uPlayerID_a + 1], (Texture *)(*(unsigned int *)((char *)papredoll_dlaus + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlaus + v240)] : 0)); } - v84 = v68->pEquipment.uBody; + v84 = pPlayer->pEquipment.uBody; v235 = v84; - v85 = (int)((char *)v68 + 36 * v84); + v85 = (int)((char *)pPlayer + 36 * v84); v242 = v85; v86 = *(int *)(v85 + 496); v87 = *(int *)(v85 + 496) - 504; @@ -7655,11 +7644,11 @@ if ( v90 < 0 || v90 > 17 ) { LABEL_259: - v111 = v68->pEquipment.uCloak; + v111 = pPlayer->pEquipment.uCloak; if ( !v111 ) goto LABEL_293; - v236 = v68->pEquipment.uCloak; - v112 = (int)&v68->pInventoryItems[v111-1]; + v236 = pPlayer->pEquipment.uCloak; + v112 = (int)&pPlayer->pInventoryItems[v111-1]; v225 = v112; v113 = *(int *)v112; if ( v113 != 525 ) @@ -7692,7 +7681,6 @@ if ( v116 == pIcons_LOD->FindTextureByName("pending") ) { LABEL_292: - v68 = v217; LABEL_293: if ( v244 == 12 || v244 == 13 ) { @@ -7702,11 +7690,11 @@ pPaperdoll_BodyY + pPaperdoll_Beards[2 * v244 - 23], (Texture *)(v122 != -1 ? (int)&pIcons_LOD->pTextures[v122] : 0)); } - v123 = v68->pEquipment.uHelm; + v123 = pPlayer->pEquipment.uHelm; if ( !v123 ) goto LABEL_335; v237 = v123; - v124 = (int)&v217->pInventoryItems[v123-1]; + v124 = (int)&pPlayer->pInventoryItems[v123-1]; v226 = v124; if ( *(int *)v124 != 521 ) { @@ -7738,7 +7726,7 @@ a2j = pPaperdoll_BodyX + dword_4E58D0[v126]; a3i = pPaperdoll_BodyY + dword_4E58D4[v126]; if ( IsDwarf != 1 || *(int *)v124 != 92 ) - v127 = stru_511698.texids[v125 + 16 * v250]; + v127 = stru_511698.texids[v125 + 16 * pSex]; else v127 = papredoll_dbrds[11]; v128 = *(int *)(v124 + 20); @@ -7832,11 +7820,11 @@ if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2j, a3i, v133, v237); LABEL_335: - v134 = v217->pEquipment.uMainHand; + v134 = pPlayer->pEquipment.uMainHand; if ( !v134 ) goto LABEL_358; - v238 = v217->pEquipment.uMainHand; - v135 = (int)&v217->pInventoryItems[v134-1]; + v238 = pPlayer->pEquipment.uMainHand; + v135 = (int)&pPlayer->pInventoryItems[v134-1]; v227 = v135; v136 = *(int *)v135; v137 = *(int *)v135; @@ -7873,11 +7861,11 @@ if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2k, a3j, v144, v238); LABEL_358: - v145 = v217->pEquipment.uOffHand; - v249 = v217->pEquipment.uOffHand; + v145 = pPlayer->pEquipment.uOffHand; + v249 = pPlayer->pEquipment.uOffHand; if ( !v145 ) goto LABEL_393; - v146 = (int)&v217->pInventoryItems[v145-1]; + v146 = (int)&pPlayer->pInventoryItems[v145-1]; v228 = v146; v147 = *(int *)v146; v148 = *(int *)v146; @@ -8204,10 +8192,10 @@ goto LABEL_272; } LABEL_209: - if ( v68->pEquipment.uMainHand - && (v68->GetEquippedItemEquipType(1u) == 1 - || v68->GetEquippedItemSkillType(EQUIP_TWO_HANDED) == 4 - && !v68->pEquipment.uOffHand) ) + if ( pPlayer->pEquipment.uMainHand + && (pPlayer->GetEquippedItemEquipType(1u) == 1 + || pPlayer->GetEquippedItemSkillType(EQUIP_TWO_HANDED) == 4 + && !pPlayer->pEquipment.uOffHand) ) { v91 = 17 * pBodyComplection + v90; v92 = v91; @@ -8227,10 +8215,7 @@ } a3g = pPaperdoll_BodyY + v95; if ( v94 == pIcons_LOD->FindTextureByName("pending") ) - { - v68 = v217; goto LABEL_259; - } if ( *(int *)(v242 + 516) & 0xF0 ) { if ( (*(int *)(v242 + 516) & 0xF0) != 16 ) @@ -8251,7 +8236,6 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = v217; goto LABEL_259; } if ( (*(int *)(v242 + 516) & 0xF0) == 64 ) @@ -8270,7 +8254,6 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = v217; goto LABEL_259; } if ( (*(int *)(v242 + 516) & 0xF0) == 128 ) @@ -8289,7 +8272,6 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = v217; goto LABEL_259; } } @@ -8307,7 +8289,6 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = v217; goto LABEL_259; } v98 = v94 + 1; @@ -8322,7 +8303,6 @@ v100->DrawTransparentRedShade(v163, v175, v188); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = v217; goto LABEL_259; } if ( *(char *)(v242 + 516) & 1 ) @@ -8334,7 +8314,6 @@ pRenderer->DrawTextureTransparent(v164, v176, v189); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = v217; goto LABEL_259; } v101 = (Texture *)(v98 != 0 ? (int)v99 : 0); @@ -8344,16 +8323,12 @@ pRenderer->DrawTransparentGreenShade(v165, v177, v190); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = v217; goto LABEL_259; } v102 = 17 * pBodyComplection + v90; v94 = paperdoll_array_511290[0][v102][1]; if ( v94 == pIcons_LOD->FindTextureByName("pending") ) - { - v68 = v217; goto LABEL_259; - } v103 = pPaperdoll_BodyX + paperdoll_shoulder[0][v102][0]; v104 = pPaperdoll_BodyY + paperdoll_shoulder[0][v102][1]; v224 = *(int *)(v242 + 516); @@ -8374,7 +8349,6 @@ v100->DrawTransparentRedShade(v163, v175, v188); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = v217; goto LABEL_259; } if ( v224 & 1 ) @@ -8387,7 +8361,6 @@ pRenderer->DrawTextureTransparent(v164, v176, v189); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = v217; goto LABEL_259; } v101 = (Texture *)(v109 != 0 ? (int)v110 : 0); @@ -8398,7 +8371,6 @@ pRenderer->DrawTransparentGreenShade(v165, v177, v190); if ( !bRingsShownInCharScreen ) pRenderer->_4A612A(a2g, a3g, v101, v235); - v68 = v217; goto LABEL_259; } v106 = v105 - 16; @@ -8421,7 +8393,6 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = v217; goto LABEL_259; } v108 = v107 - 32; @@ -8441,7 +8412,6 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = v217; goto LABEL_259; } if ( v108 == 64 ) @@ -8460,7 +8430,6 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = v217; goto LABEL_259; } } @@ -8478,7 +8447,6 @@ v97 = (double)GetTickCount(); pRenderer->_4A63E6(a2g, a3g, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), v174, v187); - v68 = v217; goto LABEL_259; } v186 = 16; @@ -8806,23 +8774,23 @@ pRenderer->_4A612A(a2, a3, (Texture *)(*(unsigned int *)((char *)papredoll_dbods + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dbods + v240)] : 0), pPlayer->pEquipment.uBody); - uPlayerID_a = 2 * v5; + uPlayerID_a = 2 * pBodyComplection; v6 = pPlayer->pEquipment.uMainHand; if ( !v6 || (v7 = *(int *)&pPlayer->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1) && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayer->pEquipment.uOffHand) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[v5][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[v5][1], + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], (Texture *)(*(unsigned int *)((char *)papredoll_dlads + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlads + v240)] : 0)); v8 = pPlayer->pEquipment.uMainHand; if ( v8 ) { v229 = pPlayer->pEquipment.uMainHand; - v9 = (int)&v217->pInventoryItems[v8-1]; - v10 = v5 << 7; + v9 = (int)&pPlayer->pInventoryItems[v8-1]; + v10 = pBodyComplection << 7; v218 = v9; v11 = *(int *)v9; v12 = *(int *)v9; - v13 = pPaperdoll_BodyX + paperdoll_Weapon[v5][1][0] - pItemsTable->pItems[v12].uEquipX; + v13 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[v12].uEquipX; a2a = v13; a3a = pPaperdoll_BodyY + *(int *)((char *)&paperdoll_Weapon[0][1][1] + v10) - pItemsTable->pItems[v12].uEquipY; if ( v11 == 64 ) @@ -8925,11 +8893,11 @@ pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[uPlayerID_a], pPaperdoll_BodyY + pPaperdoll_RightHand[uPlayerID_a + 1], (Texture *)(*(unsigned int *)((char *)papredoll_drhs + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_drhs + v240)] : 0)); - v161 = v217->pEquipment.uMainHand; + v161 = pPlayer->pEquipment.uMainHand; if ( v161 ) { - v162 = *(int *)&v217->pInventoryItems[v161-1]; - if ( pItemsTable->pItems[v162].uEquipType == 1 || pItemsTable->pItems[v162].uSkillType == 4 && !v217->pEquipment.uOffHand ) + v162 = *(int *)&pPlayer->pInventoryItems[v161-1]; + if ( pItemsTable->pItems[v162].uEquipType == 1 || pItemsTable->pItems[v162].uSkillType == 4 && !pPlayer->pEquipment.uOffHand ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[0][uPlayerID_a], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[0][uPlayerID_a + 1], (Texture *)(*(unsigned int *)((char *)papredoll_dlhus + v240) != -1 ? (int)&pIcons_LOD->pTextures[*(unsigned int *)((char *)papredoll_dlhus + v240)] : 0)); @@ -12572,7 +12540,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; @@ -13931,7 +13899,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, @@ -15815,9 +15784,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]; diff -r bc7f77c694c3 -r bbf8efb5bfee mm7_6.cpp --- a/mm7_6.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/mm7_6.cpp Thu Feb 21 09:25:50 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 ) diff -r bc7f77c694c3 -r bbf8efb5bfee mm7_data.cpp --- a/mm7_data.cpp Thu Feb 21 09:25:36 2013 +0600 +++ b/mm7_data.cpp Thu Feb 21 09:25:50 2013 +0600 @@ -69,68 +69,192 @@ #include "stru159.h" stru159 pAnimatedRooms[196] = { - "", 0x00000004, 0x000001F4, 0x00000000, - "Human Armor01", 0x00000020, 0x000002C0, 0x00003A02, - "Necromancer Armor01", 0x00000020, 0x000002D7, 0x00004602, - "Dwarven Armor01", 0x00000020, 0x000002EE, 0x00000502, - "Wizard Armor", 0x00000020, 0x000003BD, 0x00001302, - "Warlock Armor", 0x00000020, 0x000002D6, 0x00002302, - "Elf Armor", 0x00000020, 0x000002BC, 0x00004F02, - "Human Alchemisht01", 0x0000000E, 0x000002BE, 0x00005F04, - "Necromancer Alchemist01", 0x0000000E, 0x000002D6, 0x00004504, - "Dwarven Achemist01", 0x0000000E, 0x00000387, 0x00000404, - "Wizard Alchemist", 0x0000000E, 0x00000232, 0x00001904, - "Warlock Alchemist", 0x0000000E, 0x000002BE, 0x00002A04, - "Elf Alchemist", 0x0000000E, 0x0000038A, 0x00005404, - "Human Bank01", 0x00000006, 0x00000384, 0x00003416, - "Necromancer Bank01", 0x00000006, 0x000002D8, 0x00004716, - "Dwarven Bank", 0x00000006, 0x000002F3, 0x00000616, - "Wizard Bank", 0x00000006, 0x000003BA, 0x00001416, - "Warlock Bank", 0x00000006, 0x0000039F, 0x00002416, - "Elf Bank", 0x00000006, 0x000002BC, 0x00004716, - "Boat01", 0x0000000F, 0x0000004C, 0x0003351C, - "Boat01d", 0x0000000F, 0x0000004C, 0x0003351C, - "Human Magic Shop01", 0x0000000A, 0x000002C8, 0x00003603, - "Necromancer Magic Shop01", 0x0000000E, 0x000002DC, 0x00004203, - "Dwarven Magic Shop01", 0x0000002A, 0x000002EF, 0x00005B03, - "Wizard Magic Shop", 0x0000001E, 0x000002DF, 0x00000F03, - "Warlock Magic Shop", 0x00000007, 0x000003B9, 0x00001F03, - "Elf Magic Shop", 0x00000024, 0x000002CC, 0x00005203, - "Human Stables01", 0x00000021, 0x00000031, 0x0003301B, - "Necromancer Stables", 0x00000021, 0x000002DD, 0x0003431B, - "", 0x00000021, 0x000002F0, 0x00035B1B, - "Wizard Stables", 0x00000021, 0x000003BA, 0x0003101B, - "Warlock Stables", 0x00000021, 0x00000181, 0x0003201B, - "Elf Stables", 0x00000021, 0x00000195, 0x00034D1B, - "Human Tavern01", 0x0000000D, 0x000002C2, 0x00003115, - "Necromancer Tavern 01", 0x0000000D, 0x000003B0, 0x00003915, - "Dwarven Tavern01", 0x0000000D, 0x000002FE, 0x00005E15, - "Wizard Tavern", 0x0000000D, 0x000003BB, 0x00001115, - "Warlock Tavern", 0x0000000D, 0x000003A8, 0x00002115, - "Elf Tavern", 0x0000000D, 0x000002CD, 0x00004E15, - "Human Temple01", 0x00000024, 0x000002DB, 0x00033217, - "Necromancer Temple", 0x00000024, 0x000002DF, 0x00033C17, - "Dwarven Temple01", 0x00000024, 0x000002F1, 0x00035617, - "Wizard Temple", 0x00000024, 0x000002E0, 0x00030A17, - "Warlock Temple", 0x00000024, 0x000003A4, 0x00031B17, - "Elf Temple", 0x00000024, 0x000002CE, 0x00034817, - "Human Town Hall", 0x00000010, 0x0000039C, 0x00000E11, - "Necromancer Town Hall01", 0x00000010, 0x000003A4, 0x00003D11, - "Dwarven Town Hall", 0x00000010, 0x000002DB, 0x00005811, - "Wizard Town Hall", 0x00000010, 0x000003BD, 0x00000B11, - "Warlock Town Hall", 0x00000010, 0x000002DB, 0x00001C11, - "Elf Town Hall", 0x00000010, 0x0000027A, 0x00004911, - "Human Training Ground01", 0x00000018, 0x000002C7, 0x00002C1E, - "Necromancer Training Ground", 0x00000018, 0x000003AD, 0x00003E1E, - "Dwarven Training Ground", 0x00000018, 0x000002F2, 0x0000591E, - "Wizard Training Ground", 0x00000018, 0x000003A3, 0x00000C1E, - "Warlock Training Ground", 0x00000018, 0x000003A6, 0x00001D1E, - "Elf Training Ground", 0x00000018, 0x0000019F, 0x00004A1E, - "Human Weapon Smith01", 0x00000016, 0x000002C1, 0x00042D01, - "Necromancer Weapon Smith01", 0x00000016, 0x000002D9, 0x00043F01, - "Dwarven Weapon Smith01", 0x00000016, 0x000002EE, 0x00045201, - "Wizard Weapon Smith", 0x00000016, 0x000002D5, 0x00040D01, - "Warlock Weapon Smith", 0x00000016, 0x000002D7, 0x00041701 + "", 0x4, 0x1F4, 0, + "Human Armor01", 0x20, 0x2C0, 0x3A02, + "Necromancer Armor01", 0x20, 0x2D7, 0x4602, + "Dwarven Armor01", 0x20, 0x2EE, 0x502, + "Wizard Armor", 0x20, 0x3BD, 0x1302, + "Warlock Armor", 0x20, 0x2D6, 0x2302, + "Elf Armor", 0x20, 0x2BC, 0x4F02, + "Human Alchemisht01", 0xE, 0x2BE, 0x5F04, + "Necromancer Alchemist01", 0xE, 0x2D6, 0x4504, + "Dwarven Achemist01", 0xE, 0x387, 0x404, + "Wizard Alchemist", 0xE, 0x232, 0x1904, + "Warlock Alchemist", 0xE, 0x2BE, 0x2A04, + "Elf Alchemist", 0xE, 0x38A, 0x5404, + "Human Bank01", 0x6, 0x384, 0x3416, + "Necromancer Bank01", 0x6, 0x2D8, 0x4716, + "Dwarven Bank", 0x6, 0x2F3, 0x616, + "Wizard Bank", 0x6, 0x3BA, 0x1416, + "Warlock Bank", 0x6, 0x39F, 0x2416, + "Elf Bank", 0x6, 0x2BC, 0x4716, + "Boat01", 0xF, 0x4C, 0x3351C, + "Boat01d", 0xF, 0x4C, 0x3351C, + "Human Magic Shop01", 0xA, 0x2C8, 0x3603, + "Necromancer Magic Shop01", 0xE, 0x2DC, 0x4203, + "Dwarven Magic Shop01", 0x2A, 0x2EF, 0x5B03, + "Wizard Magic Shop", 0x1E, 0x2DF, 0xF03, + "Warlock Magic Shop", 0x7, 0x3B9, 0x1F03, + "Elf Magic Shop", 0x24, 0x2CC, 0x5203, + "Human Stables01", 0x21, 0x31, 0x3301B, + "Necromancer Stables", 0x21, 0x2DD, 0x3431B, + "", 0x21, 0x2F0, 0x35B1B, + "Wizard Stables", 0x21, 0x3BA, 0x3101B, + "Warlock Stables", 0x21, 0x181, 0x3201B, + "Elf Stables", 0x21, 0x195, 0x34D1B, + "Human Tavern01", 0xD, 0x2C2, 0x3115, + "Necromancer Tavern 01", 0xD, 0x3B0, 0x3915, + "Dwarven Tavern01", 0xD, 0x2FE, 0x5E15, + "Wizard Tavern", 0xD, 0x3BB, 0x1115, + "Warlock Tavern", 0xD, 0x3A8, 0x2115, + "Elf Tavern", 0xD, 0x2CD, 0x4E15, + "Human Temple01", 0x24, 0x2DB, 0x33217, + "Necromancer Temple", 0x24, 0x2DF, 0x33C17, + "Dwarven Temple01", 0x24, 0x2F1, 0x35617, + "Wizard Temple", 0x24, 0x2E0, 0x30A17, + "Warlock Temple", 0x24, 0x3A4, 0x31B17, + "Elf Temple", 0x24, 0x2CE, 0x34817, + "Human Town Hall", 0x10, 0x39C, 0xE11, + "Necromancer Town Hall01", 0x10, 0x3A4, 0x3D11, + "Dwarven Town Hall", 0x10, 0x2DB, 0x5811, + "Wizard Town Hall", 0x10, 0x3BD, 0xB11, + "Warlock Town Hall", 0x10, 0x2DB, 0x1C11, + "Elf Town Hall", 0x10, 0x27A, 0x4911, + "Human Training Ground01", 0x18, 0x2C7, 0x2C1E, + "Necromancer Training Ground", 0x18, 0x3AD, 0x3E1E, + "Dwarven Training Ground", 0x18, 0x2F2, 0x591E, + "Wizard Training Ground", 0x18, 0x3A3, 0xC1E, + "Warlock Training Ground", 0x18, 0x3A6, 0x1D1E, + "Elf Training Ground", 0x18, 0x19F, 0x4A1E, + "Human Weapon Smith01", 0x16, 0x2C1, 0x42D01, + "Necromancer Weapon Smith01", 0x16, 0x2D9, 0x43F01, + "Dwarven Weapon Smith01", 0x16, 0x2EE, 0x45201, + "Wizard Weapon Smith", 0x16, 0x2D5, 0x40D01, + "Warlock Weapon Smith", 0x16, 0x2D7, 0x41701, + "Elf Weapon Smith", 0x16, 0x2CA, 0x44B01, + "Air Guild", 0x1D, 0xA4, 0x30106, + "Body Guild", 0x19, 0x3BF, 0x20B, + "DarkGuild", 0x19, 0x2D1, 0x30D, + "EarthGuild", 0x19, 0x2CB, 0x5308, + "Fire Guild", 0x1C, 0x2BF, 0x3805, + "Light Guild", 0x1C, 0x2D5, 0x2E0C, + "Mind Guild", 0x1C, 0xE5, 0x280A, + "Spirit Guild", 0x1C, 0x2D2, 0x2909, + "Water Guild", 0x1B, 0x2D3, 0x1807, + "Lord And Judge Out01", 1, 0, 0x271D, + "Human Poor House 1", 8, 0, 0x1D, + "Human Poor House 2", 8, 0, 0x1D, + "Human Medium House 1", 8, 0, 0x1D, + "Human Medium House 2", 8, 0, 0x1D, + "Human Rich House 1", 8, 0, 0x1D, + "Human Rich House 2", 8, 0, 0x1D, + "Elven Poor House 1", 8, 0, 0x1D, + "Elven Poor House 2", 8, 0, 0x1D, + "Elven Poor House 3", 8, 0, 0x1D, + "Elven Medium House 1", 8, 0, 0x1D, + "Elven Medium House 2", 8, 0, 0x1D, + "Elven Medium House 3", 8, 0, 0x1D, + "Elven Rich House 1", 8, 0, 0x1D, + "Elven Rich House 2", 8, 0, 0x1D, + "Elven Rich House 3", 8, 0, 0x1D, + "Dwarven Poor House 1", 8, 0, 0x1D, + "Dwarven Poor House 2", 8, 0, 0x1D, + "Dwarven Poor House 3", 8, 0, 0x1D, + "Dwarven Medium House 1", 8, 0, 0x1D, + "Dwarven Medium house 2", 8, 0, 0x1D, + "Dwarven Medium House 3", 8, 0, 0x1D, + "Dwarven Rich House 1", 8, 0, 0x1D, + "Dwarven Rich House 2", 8, 0, 0x1D, + "Dwarven Rich House 3", 8, 0, 0x1D, + "Wizard Poor House 1", 8, 0, 0x1D, + "Wizard Poor House 2", 8, 0, 0x1D, + "Wizard Poor House 3", 8, 0, 0x1D, + "Wizard Medium House 1", 8, 0, 0x1D, + "Wizard Medium House 2", 8, 0, 0x1D, + "Wizard Mdeium House 3", 8, 0, 0x1D, + "Wizard Rich House 1", 8, 0, 0x1D, + "Wizard Rich House 2", 8, 0, 0x1D, + "Wizard Rich House 3", 8, 0, 0x1D, + "Necromancer Poor House 1", 8, 0, 0x1D, + "Necromancer Poor House 2", 8, 0, 0x1D, + "Necromancer Poor House 3", 8, 0, 0x1D, + "Necromancer Medium House 1", 8, 0, 0x1D, + "Necromancer Medium House 2", 8, 0, 0x1D, + "Necromancer Mdeium House 3", 8, 0, 0x1D, + "Necromancer Rich House 1", 8, 0, 0x1D, + "Necromancer Rich House 2", 8, 0, 0x1D, + "Necromancer Rich House 3", 8, 0, 0x1D, + "Warlock Poor House 1", 8, 0, 0x1D, + "Warlock Poor House 2", 8, 0, 0x1D, + "Warlock Poor House 3", 8, 0, 0x1D, + "Warlock Medium House 1", 8, 0, 0x1D, + "Warlock Medium House 2", 8, 0, 0x1D, + "Warlock Mdeium House 3", 8, 0, 0x1D, + "Warlock Rich House 1", 8, 0, 0x1D, + "Warlock Rich House 2", 8, 0, 0x1D, + "Warlock Rich House 3", 8, 0, 0x1D, + "Out01 Temple of the Moon", 0x24, 0, 0x19, + "Out01 Dragon Cave", 0x24, 0, 0x19, + "Out02 Castle Harmondy", 0x24, 0, 0x19, + "Out02 White Cliff Cave", 0x24, 0, 0x19, + "Out03 Erathian Sewer", 0x24, 0, 0x19, + "Out03 Fort Riverstride", 0x24, 0, 0x19, + "Out03 Castle Gryphonheart", 0x24, 0, 0x19, + "Out04 Elf Castle", 0x24, 0, 0x19, + "Out04 Tularean Caves", 0x24, 0, 0x19, + "Out04 Clanker's Laboratory", 0x24, 0, 0x19, + "Out05 Hall of the Pit", 0x24, 0, 0x19, + "Out05 Watchtower 6", 0x24, 0, 0x19, + "Out06 School of Sorcery", 0x24, 0, 0x19, + "Out06 Red Dwarf Mines", 0x24, 0, 0x19, + "Out07 Castle Lambert", 0x24, 0, 0x19, + "Out07 Walls of Mist", 0x24, 0, 0x19, + "Out07 Temple of the Light", 0x24, 0, 0x19, + "Out08 Evil Entrance", 0x24, 0, 0x19, + "Out08 Breeding Zone", 0x24, 0, 0x19, + "Out08 Temple of the Dark", 0x24, 0, 0x19, + "Out09 Grand Temple of the Moon", 0x24, 0, 0x19, + "Out09 Grand Tempple of the Sun", 0x24, 0, 0x19, + "Out10 Thunderfist Mountain", 0x24, 0, 0x19, + "Out10 The Maze", 0x24, 0, 0x19, + "Out10 Connecting Tunnel Cave #1", 0x24, 0, 0x19, + "", 0x24, 0, 0x19, + "Out11 Stone City", 0x24, 0, 0x19, + "", 0x24, 0, 0x19, + "Out12 Colony Zod", 0x24, 0, 0x19, + "Out12 Connecting Tunnel Cave #1", 0x24, 0, 0x19, + "", 0x24, 0, 0x19, + "Out13 Mercenary Guild", 0x24, 0, 0x19, + "Out13 Tidewater Caverns", 0x24, 0, 0x19, + "Out13 Wine Cellar", 0x24, 0, 0x19, + "Out14 Titan's Stronghold", 0x24, 0, 0x19, + "Out14 Temple Of Baa", 0x24, 0, 0x19, + "Out14 Hall under the Hill", 0x24, 0, 0x19, + "Out15 The Linclon", 0x24, 0, 0x19, + "Jail", 0x24, 0, 0x1F, + "Harmondale Throne Room", 0x24, 0, 0x1D, + "Gryphonheart Throne Room", 0x24, 0, 0x14, + "Elf Castle Throne Room", 0x24, 0, 0x14, + "Wizard Castle Throne Room", 0x24, 0, 0x14, + "Necromancer Casstle Trone Room", 0x24, 0, 0x14, + "Master Thief", 0x24, 0, 0x1D, + "Dwarven King", 0x24, 0, 0x14, + "Arms Master", 0x24, 0, 0x1D, + "Warlock", 0x24, 0, 0x1D, + "Lord Markam", 0x24, 0, 0x14, + "Arbiter Neutral Town", 0x24, 0, 0x1D, + "Arbiter Good Town", 0x24, 0, 0x1D, + "Arbiter Evil Town", 0x24, 0, 0x1D, + "Necromancer Throne Room Empty", 0x24, 0, 0x14, + "", 0x24, 0, 0x1D, + "Boat01", 0xF, 0, 0x3351D, + "", 0x24, 0, 0x1C, + "", 0x24, 0, 0x1D, + "Arbiter Room Neutral", 0x24, 0, 0x1D, + "Out02 Castle Harmondy Abandoned", 0x24, 0, 0x19, + "Human Temple02", 0x24, 0x3AB, 0x1B17, + "Player Castle Good", 0x24, 0, 0x19, + "Player Castle Bad", 0x24, 0, 0x19, }; #include "stru160.h" @@ -308,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; @@ -385,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 @@ -834,9 +960,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 @@ -1796,7 +1947,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 @@ -1808,7 +1959,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 diff -r bc7f77c694c3 -r bbf8efb5bfee mm7_data.h --- a/mm7_data.h Thu Feb 21 09:25:36 2013 +0600 +++ b/mm7_data.h Thu Feb 21 09:25:50 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 @@ -684,7 +686,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 +1343,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 +1355,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 +2025,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 +2250,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); diff -r bc7f77c694c3 -r bbf8efb5bfee stru176.h --- a/stru176.h Thu Feb 21 09:25:36 2013 +0600 +++ b/stru176.h Thu Feb 21 09:25:50 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]; diff -r bc7f77c694c3 -r bbf8efb5bfee stru272.h --- a/stru272.h Thu Feb 21 09:25:36 2013 +0600 +++ b/stru272.h Thu Feb 21 09:25:50 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); diff -r bc7f77c694c3 -r bbf8efb5bfee stru351.h --- a/stru351.h Thu Feb 21 09:25:36 2013 +0600 +++ b/stru351.h Thu Feb 21 09:25:50 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