# HG changeset patch # User Gloval # Date 1361724466 -14400 # Node ID 37090bd974f94732e532c27c6f8824a78df5a5c6 # Parent 197461e5acecbf0cc782b1c5bc9cb94ee62c4825# Parent a7869569e912e59f9d4dd491e034cafb78e20dac Merge diff -r 197461e5acec -r 37090bd974f9 Actor.cpp --- a/Actor.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/Actor.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -202,7 +202,7 @@ } v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - array_5913D8[6] = 0; + pDialogueNPCCount = 0; uNumDialogueNPCPortraits = 1; pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v8]; sprintf(pContainer, "npc%03u", v5->uPortraitID); diff -r 197461e5acec -r 37090bd974f9 Events.cpp --- a/Events.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/Events.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -1519,7 +1519,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; - array_5913D8[6] = 0; + pDialogueNPCCount = 0; pDialogueWindow->Release(); dword_F8B19C = 0; pDialogueWindow = 0; diff -r 197461e5acec -r 37090bd974f9 GUIWindow.cpp --- a/GUIWindow.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/GUIWindow.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -1016,7 +1016,6 @@ } // 50640C: using guessed type int dword_50640C[]; - //----- (004B3157) -------------------------------------------------------- void GUIWindow::HouseDialogManager() { @@ -1049,7 +1048,7 @@ v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_507B04]); - if ( array_5913D8[6] != (NPCData *)uNumDialogueNPCPortraits || !uHouse_ExitPic ) + if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic ) { w.uFrameWidth = 130; w.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight); @@ -1069,11 +1068,10 @@ } v18.uFrameWidth += 8; v18.uFrameZ += 8; - if ( !array_5913D8[6] ) + if ( !pDialogueNPCCount ) { if ( dword_F8B198 == 31 ) { -LABEL_36: sub_4B4F4F(); goto LABEL_58; } @@ -1121,21 +1119,19 @@ v15 = 3; //v13 = (char *)p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C]; v13 = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle; - v11 = v19; - v10 = 113; -LABEL_56: - v18.DrawTitleText(pFontCreate, 0x1E3u, v10, v11, v13, v15); + v18.DrawTitleText(pFontCreate, 0x1E3u, 113, v19, v13, 3); goto LABEL_57; } v15 = 3; - v13 = array_5913D8[v8 - (dword_591080 != 0)]->pName; + v13 = HouseNPCData[v8 - (dword_591080 != 0)]->pName; v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2; } v11 = v19; v10 = v9; - goto LABEL_56; + v18.DrawTitleText(pFontCreate, 0x1E3u, v10, v11, v13, v15); + goto LABEL_57; } - v4 = (char *)array_5913D8[6] - 1; + v4 = (char *)pDialogueNPCCount - 1; pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); if ( pCurrentScreen == SCREEN_E ) @@ -1145,7 +1141,7 @@ } if ( v4 || !dword_591080 ) { - SimpleHouseDialog(); + SimpleHouseAndBoatsDialog(); } else { @@ -1215,7 +1211,8 @@ { if ( dword_F8B198 != 31 ) break; - goto LABEL_36; + sub_4B4F4F(); + goto LABEL_58; } TrainingDialog(); } @@ -1223,7 +1220,7 @@ } } LABEL_58: - if ( array_5913D8[6] == (NPCData *)uNumDialogueNPCPortraits && uHouse_ExitPic ) + if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) { pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); @@ -1951,7 +1948,7 @@ else { if ( v26 || !dword_591080 ) - v27 = array_5913D8[v26 - (dword_591080 != 0)]->pName; + v27 = HouseNPCData[v26 - (dword_591080 != 0)]->pName; else //v27 = (char *)p2DEvents_minus1_::08[13 * a4]; v27 = (char *)p2DEvents[pButton - 1].pProprieterName; @@ -1959,7 +1956,7 @@ v29 = (char*)pGlobalTXT_LocalizationStrings[435];// "Converse with %s" Побеседовать с ^Pt[%s] } sprintf(&byte_591180[100 * v26], v29, v30); - array_5913D8[v26 + 7] = (NPCData *)pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26], + HouseNPCData[v26 + 7] = (NPCData *)pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26], pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26], 0x3Fu, 0x49u, 1, 0, 0x19Au, v26, 0, &byte_591180[100 * v26], 0, 0, 0); ++v26; diff -r 197461e5acec -r 37090bd974f9 NPC.cpp --- a/NPC.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/NPC.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -670,7 +670,6 @@ pNPCDataBuff->joins = 1; } - //----- (00476387) -------------------------------------------------------- bool PartyHasDragon() { @@ -820,7 +819,6 @@ } } - //----- (00476590) -------------------------------------------------------- void InitializeMerchants() { diff -r 197461e5acec -r 37090bd974f9 mm7_1.cpp --- a/mm7_1.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/mm7_1.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -3521,8 +3521,6 @@ return result; } - - //----- (0041F54A) -------------------------------------------------------- void __cdecl LoadActualSkyFrame() { diff -r 197461e5acec -r 37090bd974f9 mm7_2.cpp --- a/mm7_2.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/mm7_2.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -4251,7 +4251,7 @@ pKeyActionMap->ResetKeys(); _5C3420_pDecoration = 0; ptr_F8B1E8 = 0; - if ( array_5913D8[6] ) + if ( pDialogueNPCCount ) { v0 = dword_F8B19C; if ( dword_F8B19C != 2 @@ -4269,7 +4269,7 @@ { if ( v0 == -1 ) { - _4B4224_UpdateNPCTopics((int)((char *)array_5913D8[6] - 1)); + _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); LABEL_33: pVideoPlayer->_4BF5B2(); return 1; @@ -4303,7 +4303,7 @@ UI_CreateEndConversationButton(); goto LABEL_28; } - array_5913D8[6] = 0; + pDialogueNPCCount = 0; pDialogueWindow->Release(); dword_F8B19C = 0; pDialogueWindow = 0; @@ -4318,7 +4318,7 @@ v3 = byte_591180; do { - array_5913D8[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2], + HouseNPCData[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2], 0x3Fu, 0x49u, 1, 0, 0x19Au, v2, 0, v3, 0, 0, 0); v1 = uNumDialogueNPCPortraits; ++v2; diff -r 197461e5acec -r 37090bd974f9 mm7_3.cpp --- a/mm7_3.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/mm7_3.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -17445,7 +17445,7 @@ signed int v44; // [sp+1Ch] [bp-8h]@25 int v45; // [sp+20h] [bp-4h]@1 - __debugbreak(); // refactor for blv ai +// __debugbreak(); // refactor for blv ai pParty->uFlags &= 0xFFFFFFCFu; v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v45 = 0; diff -r 197461e5acec -r 37090bd974f9 mm7_4.cpp --- a/mm7_4.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/mm7_4.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -4916,7 +4916,7 @@ if ( dword_5C35D4 ) { __debugbreak(); // fix - npc = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)]; + npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; } else npc = GetNPCData(uDialogue_SpeakingActorNPC_ID); @@ -9376,11 +9376,11 @@ // F8B1A8: using guessed type int dword_F8B1A8; //----- (004B2001) -------------------------------------------------------- -void __fastcall sub_4B2001(signed int a1) -{ - signed int v1; // eax@1 - NPCData *v2; // ebp@1 - int v3; // ecx@8 +void __fastcall ClickNPCTopic(signed int uMessageParam) +{ + //signed int v1; // eax@1 + NPCData *pCurrentNPCInfo; // ebp@1 + int pEventNumber; // ecx@8 Player *v4; // esi@20 int v5; // eax@28 int v6; // eax@31 @@ -9404,60 +9404,49 @@ char *v24; // [sp-8h] [bp-14h]@73 int v25; // [sp-4h] [bp-10h]@49 - v1 = a1; - uDialogueType = a1 + 1; - v2 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)]; - if ( a1 <= 23 ) - { - if ( a1 == 23 ) - { - v3 = v2->evt_E; - } - else - { - if ( a1 == 13 ) - { - ptr_F8B1E8 = pNPCStats->pProfessions[v2->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); - ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); - sub_4B40E6(); - dialogue_show_profession_details = false; + //v1 = a1; + uDialogueType = uMessageParam + 1; + pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; + switch ( uMessageParam ) + { + case 13: + ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); + ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); + sub_4B40E6(); + dialogue_show_profession_details = false; + goto _return; + case 19: + pEventNumber = pCurrentNPCInfo->evt_A; + break; + case 20: + pEventNumber = pCurrentNPCInfo->evt_B; + break; + case 21: + pEventNumber = pCurrentNPCInfo->evt_C; + break; + case 22: + pEventNumber = pCurrentNPCInfo->evt_D; + break; + case 23: + pEventNumber = pCurrentNPCInfo->evt_E; + break; + case 24: + pEventNumber = pCurrentNPCInfo->evt_F; + break; + default: goto _return; - } - switch ( a1 ) - { - case 19: - v3 = v2->evt_A; - break; - case 20: - v3 = v2->evt_B; - break; - case 21: - v3 = v2->evt_C; - break; - default: - if ( a1 != 22 ) - goto _return; - v3 = v2->evt_D; - break; - } - } - goto LABEL_84; - } - if ( a1 == 24 ) - { - v3 = v2->evt_F; -LABEL_84: - if ( v3 < 200 || v3 > 310 ) - { - if ( v3 < 400 || v3 > 410 ) - { - if ( v3 == 139 ) + } + if ( pEventNumber < 200 || pEventNumber > 310 ) + { + if ( pEventNumber < 400 || pEventNumber > 410 ) + { + if ( pEventNumber == 139 ) { sub_4B1ECE(); } else { - if ( v3 == 311 ) + if ( pEventNumber == 311 ) { sub_4BBA85_bounties(); } @@ -9465,32 +9454,32 @@ { ptr_F8B1E8 = 0; _5C3420_pDecoration = (LevelDecoration *)1; - EventProcessor(v3, 0, 1); + EventProcessor(pEventNumber, 0, 1); _5C3420_pDecoration = 0; } } } else { - dword_F8B1D8 = v1; - sub_4B3EF0(v3 - 400); + dword_F8B1D8 = uMessageParam; + DrawJoinGuildWindow(pEventNumber - 400); } } else { - sub_4B3FE5(v3); + sub_4B3FE5(pEventNumber); } goto _return; - } - if ( a1 != 76 ) - { - if ( a1 == 77 ) - { - v16 = v2->uProfession; + + if ( uMessageParam != 76 ) + { + if ( uMessageParam == 77 ) + { + v16 = pCurrentNPCInfo->uProfession; if (dialogue_show_profession_details) - v17 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText; + v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; else - v17 = pNPCStats->pProfessions[v2->uProfession - 1].pBenefits; + v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; ptr_F8B1E8 = v17; v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); dialogue_show_profession_details = ~dialogue_show_profession_details; @@ -9498,7 +9487,7 @@ } else { - if ( a1 == 79 ) + if ( uMessageParam == 79 ) { if ( dword_F8B1A8 ) { @@ -9536,7 +9525,7 @@ } else { - if ( a1 == 82 && dword_F8B1A8 ) + if ( uMessageParam == 82 && dword_F8B1A8 ) { Party::TakeGold(gold_transaction_amount); v4 = pParty->pPlayers; @@ -9549,36 +9538,36 @@ switch ( dword_F8B1D8 ) { case 19: - v10 = v2->evt_A; + v10 = pCurrentNPCInfo->evt_A; if ( (signed int)v10 >= 400 && (signed int)v10 <= 416 ) - v2->evt_A = 0; + pCurrentNPCInfo->evt_A = 0; break; case 20: - v9 = v2->evt_B; + v9 = pCurrentNPCInfo->evt_B; if ( v9 >= 400 && v9 <= 416 ) - v2->evt_B = 0; + pCurrentNPCInfo->evt_B = 0; break; case 21: - v8 = v2->evt_C; + v8 = pCurrentNPCInfo->evt_C; if ( v8 >= 400 && v8 <= 416 ) - v2->evt_C = 0; + pCurrentNPCInfo->evt_C = 0; break; case 22: - v7 = v2->evt_D; + v7 = pCurrentNPCInfo->evt_D; if ( v7 >= 400 && v7 <= 416 ) - v2->evt_D = 0; + pCurrentNPCInfo->evt_D = 0; break; case 23: - v6 = v2->evt_E; + v6 = pCurrentNPCInfo->evt_E; if ( v6 >= 400 && v6 <= 416 ) - v2->evt_E = 0; + pCurrentNPCInfo->evt_E = 0; break; case 24: - v5 = v2->evt_F; + v5 = pCurrentNPCInfo->evt_F; if ( v5 >= 400 ) { if ( v5 <= 416 ) - v2->evt_F = 0; + pCurrentNPCInfo->evt_F = 0; } break; } @@ -9612,15 +9601,15 @@ goto _return; } //v20 = v2->uProfession; - if ( v2->uProfession != 51 ) - { - v21 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice; + if ( pCurrentNPCInfo->uProfession != 51 ) + { + v21 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; if ( pParty->uNumGold < v21 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); dialogue_show_profession_details = false; uDialogueType = 13; - ptr_F8B1E8 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText; + ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); @@ -9630,19 +9619,19 @@ Party::TakeGold(v21); } //LOBYTE(v2->uFlags) |= 0x80u; - v2->uFlags = 128; + pCurrentNPCInfo->uFlags = 128; pParty->field_709 = 0; sub_44A56A(); if ( pParty->pHirelings[0].pName ) { - memcpy(&pParty->pHirelings[1], v2, sizeof(pParty->pHirelings[1])); - v24 = v2->pName; + memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); + v24 = pCurrentNPCInfo->pName; v22 = pParty->pHireling2Name; } else { - memcpy(pParty->pHirelings, v2, 0x4Cu); - v24 = v2->pName; + memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); + v24 = pCurrentNPCInfo->pName; v22 = pParty->pHireling1Name; } strcpy(v22, v24); @@ -10002,23 +9991,14 @@ //----- (004B29F2) -------------------------------------------------------- -const char *__fastcall sub_4B29F2(int a1) -{ - int v1; // esi@1 - Player *v2; // edi@1 - int v3; // eax@1 - Player *v4; // ecx@1 - - v1 = a1; +const char *__fastcall ContractSelectText(int pEventNumber) +{ dword_F8B1A8 = 0; - v2 = pPlayers[uActiveCharacter]; - v3 = a1 + 50; - v4 = pPlayers[uActiveCharacter]; - dword_F8B1AC_something_todo_with_awards = v3; - gold_transaction_amount = dword_4F08EC[v1]; - if ( v4->CanAct() ) - { - if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v2->field_152, dword_F8B1AC_something_todo_with_awards) ) + dword_F8B1AC_something_todo_with_awards = pEventNumber + 50; + gold_transaction_amount = dword_4F08EC[pEventNumber]; + if ( pPlayers[uActiveCharacter]->CanAct() ) + { + if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->field_152, dword_F8B1AC_something_todo_with_awards) ) { return pNPCTopics[123].pText; } @@ -10027,7 +10007,7 @@ if ( gold_transaction_amount <= pParty->uNumGold ) { dword_F8B1A8 = 1; - return pNPCTopics[v1 + 110].pText; + return pNPCTopics[pEventNumber + 110].pText; } else { @@ -10043,7 +10023,7 @@ //----- (004B2A74) -------------------------------------------------------- -char __cdecl SimpleHouseDialog() +char __cdecl SimpleHouseAndBoatsDialog() { char *v0; // esi@3 char *v1; // ST1C_4@3 @@ -10105,7 +10085,7 @@ NPCData *v58; // [sp+118h] [bp-4h]@6 memcpy(&a1, pDialogueWindow, sizeof(a1)); - if ( array_5913D8[6] == (NPCData *)uNumDialogueNPCPortraits && uHouse_ExitPic ) + if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) { v0 = pMapStats->pInfos[uHouse_ExitPic].pName; v1 = pMapStats->pInfos[uHouse_ExitPic].pName; @@ -10129,7 +10109,7 @@ } a1.uFrameWidth -= 10; a1.uFrameZ -= 10; - v58 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)]; + v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; v6 = v58; v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); @@ -10204,7 +10184,7 @@ v27 = v26 - 3; if ( !v27 ) { - v33 = (char *)sub_4B29F2((int)v52.ptr_1C); + v33 = (char *)ContractSelectText((int)v52.ptr_1C); goto LABEL_44; } v28 = v27 - 1; @@ -11061,42 +11041,17 @@ } //----- (004B3EF0) -------------------------------------------------------- -void __fastcall sub_4B3EF0(int a4) -{ - int v1; // edi@1 - - v1 = a4; +void __fastcall DrawJoinGuildWindow(int pEventNumber) +{ uDialogueType = 81; - ptr_F8B1E8 = (char *)pNPCTopics[a4 + 99].pText; - sub_4B29F2(a4); + ptr_F8B1E8 = (char *)pNPCTopics[pEventNumber + 99].pText; + ContractSelectText(pEventNumber); pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, v1, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 0x1D7, - 0x1BD, - 0xA9, - 0x23, - 1, - 0, - 0x71, - 0, - 0, - pGlobalTXT_LocalizationStrings[34], - (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), - 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventNumber, 0); + pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34], + (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); - pDialogueWindow->CreateButton( - 0x1E0u, - 0xA0u, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x52u, - 0, - pGlobalTXT_LocalizationStrings[122], - 0); + pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); pDialogueWindow->_41D08F(1, 1, 0, 2); dword_F8B19C = -1; } @@ -11145,7 +11100,7 @@ NPCData *v1; // edi@1 v0 = 0; - v1 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)]; + v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); pBtn_ExitCancel = pDialogueWindow->CreateButton( @@ -11210,7 +11165,7 @@ NPCData *v17; // [sp+10h] [bp-4h]@4 num_menu_buttons = 0; - array_5913D8[6] = (NPCData *)(_this + 1); + pDialogueNPCCount = (_this + 1); if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) { pDialogueWindow->Release(); @@ -11227,7 +11182,7 @@ } else { - v17 = array_5913D8[_this + 1 - ((dword_591080 != 0) + 1)]; + v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; if ( dword_F8B19C == -1 ) { pDialogueWindow->Release(); @@ -11235,14 +11190,14 @@ else { for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) - GUIButton::_41D0D8((GUIButton *)array_5913D8[i + 7]); + GUIButton::_41D0D8((GUIButton *)HouseNPCData[i + 7]); } pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); - if ( array_5913D8[6] == (NPCData *)1 && dword_591080 ) + if ( pDialogueNPCCount == 1 && dword_591080 ) { sub_4B3B42(dword_F8B198); } @@ -12666,7 +12621,7 @@ else { dword_F8B1D8 = newDialogueType; - sub_4B3EF0(v4 - 400); + DrawJoinGuildWindow(v4 - 400); } } else @@ -14750,7 +14705,7 @@ //if ( !(*(char *)v6 & 0x80) ) { v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0; - array_5913D8[v7] = npc; + HouseNPCData[v7] = npc; //v6 = v17; //*(&v13 + v2) = *(v17 - 1); Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID; @@ -14964,14 +14919,14 @@ } v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - array_5913D8[6] = 0; + pDialogueNPCCount = 0; pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; uTextureID_507B04 = uTextureID_right_panel; PrepareHouse(uHouseID); v18 = 1; uTextureID_507B04 = uTextureID_right_panel; if ( uNumDialogueNPCPortraits == 1 ) - array_5913D8[6] = (NPCData *)1; + pDialogueNPCCount = 1; pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) { diff -r 197461e5acec -r 37090bd974f9 mm7_5.cpp --- a/mm7_5.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/mm7_5.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -393,8 +393,8 @@ case UIMSG_51: sub_4BDB56_buy_skill____(); continue; - case UIMSG_AF: - sub_4B2001(uMessageParam); + case UIMSG_AF://Click topic + ClickNPCTopic(uMessageParam);//CheckNPCTopic continue; case UIMSG_195: sub_4BCACC_bounties(uMessageParam); @@ -3338,9 +3338,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0); /*v115 = v0; pMessageQueue_50CBD0->uNumMessages = v0; -//LABEL_769: pMessageQueue_50CBD0->pMessages[v115].eType = (UIMessageType)14; -//LABEL_770: pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; //goto LABEL_771; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; @@ -3349,7 +3347,6 @@ } v115 = 0; pMessageQueue_50CBD0->uNumMessages = 0; -//LABEL_768: pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0); /*if ( (signed int)v115 < 40 ) //goto LABEL_769; @@ -3362,7 +3359,6 @@ }*/ continue; case UIMSG_E: -//LABEL_772: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; OnGameViewportClick(); @@ -3378,28 +3374,12 @@ pPoint3 = pMouse->GetCursorPos(&v204); v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; } - v163 = 0; pButton2 = (GUIButton *)(unsigned __int16)v116; - pWindowType1 = (WindowType)15; - //goto LABEL_779; - v8 = 0; - v9 = 0; - v137 = 0; - v133 = 0; - GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); + GUIWindow::Create(0, 0, 0, 0, (WindowType)15, (int)pButton2, 0); continue; case UIMSG_54: - v163 = 0; pButton2 = (GUIButton *)uMessageParam; - pWindowType1 = (WindowType)22; -//LABEL_779: - v8 = 0; - v9 = 0; -//LABEL_732: - v137 = 0; - v133 = 0; -//LABEL_733: - GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); + GUIWindow::Create(0, 0, 0, 0, (WindowType)22, (int)pButton2, 0); continue; case UIMSG_Game_Action: if ( pMessageQueue_50CBD0->uNumMessages ) diff -r 197461e5acec -r 37090bd974f9 mm7_data.cpp --- a/mm7_data.cpp Sun Feb 24 20:47:01 2013 +0400 +++ b/mm7_data.cpp Sun Feb 24 20:47:46 2013 +0400 @@ -2000,7 +2000,8 @@ int dword_591178_teleporty; // weak int dword_59117C_teleportx; // weak char byte_591180[600]; // idb -struct NPCData *array_5913D8[12]; +struct NPCData *HouseNPCData[6];//array_5913D8 +int pDialogueNPCCount; struct Texture *pDialogueNPCPortraits[6]; int uNumDialogueNPCPortraits; // weak struct Texture *pTexture_591428; diff -r 197461e5acec -r 37090bd974f9 mm7_data.h --- a/mm7_data.h Sun Feb 24 20:47:01 2013 +0400 +++ b/mm7_data.h Sun Feb 24 20:47:46 2013 +0400 @@ -1333,7 +1333,8 @@ extern int dword_591178_teleporty; // weak extern int dword_59117C_teleportx; // weak extern char byte_591180[600]; // idb -extern struct NPCData *array_5913D8[12]; +extern struct NPCData *HouseNPCData[6]; +extern int pDialogueNPCCount; extern struct Texture *pDialogueNPCPortraits[6]; extern int uNumDialogueNPCPortraits; // weak extern struct Texture *pTexture_591428; @@ -2302,17 +2303,17 @@ void __cdecl sub_4B1D27(); void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2); // idb void __cdecl sub_4B1ECE(); -void __fastcall sub_4B2001(signed int a1); +void __fastcall ClickNPCTopic(signed int uMessageParam); char *__thiscall _4B254D_SkillMasteryTeacher(int _this); -const char *__fastcall sub_4B29F2(int a1); -char __cdecl SimpleHouseDialog(); +const char *__fastcall ContractSelectText(int pEventNumber); +char __cdecl SimpleHouseAndBoatsDialog(); struct GUIButton *__fastcall sub_4B36CC(int a1, unsigned int a2); int __thiscall sub_4B3703(void *_this); int __thiscall sub_4B3A72(int a1); // idb int __fastcall sub_4B3AD4(signed int a1); int __fastcall sub_4B3B42(signed int a1); void __cdecl sub_4B3E1E(); -void __fastcall sub_4B3EF0(int a4); +void __fastcall DrawJoinGuildWindow(int pEventNumber); void __fastcall sub_4B3FE5(int a4); void __cdecl sub_4B40E6(); void _4B4224_UpdateNPCTopics(int _this);