# HG changeset patch # User Ritor1 # Date 1366369315 -21600 # Node ID 4dc2252e0b0369cdb92d7bbf1c197fa0d8b13550 # Parent 393a83dcc359f744bf3ea95ccbe14a1a8d1f2552 CharacterUI_StatsTab_ShowHint fixed diff -r 393a83dcc359 -r 4dc2252e0b03 GUIWindow.h --- a/GUIWindow.h Thu Apr 18 11:15:54 2013 +0600 +++ b/GUIWindow.h Fri Apr 19 17:01:55 2013 +0600 @@ -474,7 +474,7 @@ unsigned int __fastcall GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level); const char *__fastcall CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType); char __cdecl CharacterUI_SkillsTab_ShowHint(); -char __cdecl CharacterUI_StatsTab_ShowHint(); +void __cdecl CharacterUI_StatsTab_ShowHint(); char __fastcall CharacterUI_StatsTab_Draw(unsigned int uPlayerID); // idb diff -r 393a83dcc359 -r 4dc2252e0b03 MM7.h --- a/MM7.h Thu Apr 18 11:15:54 2013 +0600 +++ b/MM7.h Fri Apr 19 17:01:55 2013 +0600 @@ -179,15 +179,15 @@ /* 374 */ #pragma pack(push, 1) -struct stru334 +struct stat_coord { - __int16 field_0; - __int16 field_2; - __int16 field_4; - __int16 field_6; + __int16 x; + __int16 y; + __int16 width; + __int16 height; }; #pragma pack(pop) -extern stru334 array_4E2940[26]; +extern stat_coord stat_string_coord[26]; /* 376 */ #pragma pack(push, 1) diff -r 393a83dcc359 -r 4dc2252e0b03 Player.cpp --- a/Player.cpp Thu Apr 18 11:15:54 2013 +0600 +++ b/Player.cpp Fri Apr 19 17:01:55 2013 +0600 @@ -1213,7 +1213,7 @@ if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) goto LABEL_10; - if ( v3->HasEnchantedItemEquipped(18) || v9->WearsItem(505, 3) || v10->WearsItem(530, 6) ) + if ( v3->HasEnchantedItemEquipped(18) || v3->WearsItem(505, 3) || v3->WearsItem(530, 6) ) goto LABEL_76; LABEL_40: v26 = 0; diff -r 393a83dcc359 -r 4dc2252e0b03 UIHouses.cpp --- a/UIHouses.cpp Thu Apr 18 11:15:54 2013 +0600 +++ b/UIHouses.cpp Fri Apr 19 17:01:55 2013 +0600 @@ -673,7 +673,7 @@ int v39; // edx@235 int v40; // edi@243 unsigned __int64 v41; // qax@243 - void *v42; // eax@244 + //void *v42; // eax@244 signed int v43; // edi@244 int v44; // edx@244 int v45; // eax@246 @@ -697,9 +697,7 @@ pRenderer->ClearZBuffer(0, 479); //v3 = dword_F8B198; if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) - { - v8 = window_SpeakInHouse; - } + v8 = window_SpeakInHouse; //else if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) { @@ -725,7 +723,7 @@ pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); - pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); + pDialogueWindow->CreateButton(8, 8, 0x1C2, 0x140, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); // LABEL_10: //v3 = dword_F8B198; v8 = window_SpeakInHouse; @@ -770,137 +768,108 @@ //NEW switch(in_current_building_type) { - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - { - if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed && - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed ) + case BildingType_FireGuild: + case BildingType_AirGuild: + case BildingType_WaterGuild: + case BildingType_EarthGuild: + case BildingType_SpiritGuild: + case BildingType_MindGuild: + case BildingType_BodyGuild: + case BildingType_LightGuild: + case BildingType_DarkGuild: + case BildingType_14: + case BildingType_15: + case BildingType_16: + { + if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed && + *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed ) + { + v32 = 0; + do { - v32 = 0; - do - { - //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); - v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; - if ( v33 ) - { - v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); - v8 = window_SpeakInHouse; - ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; - } - ++v32; - } - while ( v32 < 12 ); + //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); + v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; + if ( v33 ) + { + v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); + v8 = window_SpeakInHouse; + ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; + } + ++v32; + } + while ( v32 < 12 ); + } + else + { + SpellBookGenerator(); + 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)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); + *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; + *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); + } + //return; + break; + } + case BildingType_TownHall: + { + if ( uMessageParam == 99 ) + { + v10 = (int)((char *)v8->ptr_1C - 102); + v56 = v10; + v11 = 8 * v10 + 11325428; + if ( pParty->field_3C.field_0[2 * v10 + 1] >= (signed __int64)pParty->uTimePlayed + && pParty->field_3C.field_0[2 * v10] >= (signed __int64)pParty->uTimePlayed ) + { + v13 = 0; } else { - SpellBookGenerator(); - 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)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); - } - //return; - break; - } - case 17: - { - if ( uMessageParam == 99 ) - { - v10 = (int)((char *)v8->ptr_1C - 102); - v56 = v10; - v11 = 8 * v10 + 11325428; - if ( pParty->field_3C.field_0[2 * v10 + 1] >= (signed __int64)pParty->uTimePlayed - && pParty->field_3C.field_0[2 * v10] >= (signed __int64)pParty->uTimePlayed ) - { - v13 = 0; - } - else - { - v12 = v10; - v13 = 0; - pParty->field_75A[v12] = 0; - *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); - v14 = rand() % 258; - v15 = window_SpeakInHouse; - pParty->field_750[v12] = v14 + 1; - v16 = (int)((char *)v15->ptr_1C - 102); - if ( v16 ) - { - v17 = v16 - 1; - if ( v17 ) + v12 = v10; + v13 = 0; + pParty->field_75A[v12] = 0; + *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); + v14 = rand() % 258; + v15 = window_SpeakInHouse; + pParty->field_750[v12] = v14 + 1; + v16 = (int)((char *)v15->ptr_1C - 102); + if ( v16 ) + { + v17 = v16 - 1; + if ( v17 ) + { + v18 = v17 - 1; + if ( v18 ) { - v18 = v17 - 1; - if ( v18 ) + v19 = v18 - 1; + if ( v19 ) { - v19 = v18 - 1; - if ( v19 ) - { - if ( v19 == 1 ) - { - while ( 1 ) - { - v20 = pParty->field_750[v12]; - if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) - { - if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) - && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) - && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) - && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) - && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) - && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) - && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) - && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) - && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) - && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) - && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) - && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) - && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) - && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) - && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) - && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) - && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) - && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else + if ( v19 == 1 ) { while ( 1 ) { - v21 = pParty->field_750[v12]; - if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) + v20 = pParty->field_750[v12]; + if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) { - if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) - && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) - && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) - && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) - && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) - && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) - && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) - && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) - && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) - && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) - && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) - && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) - && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) - && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) + if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) + && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) + && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) + && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) + && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) + && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) + && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) + && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) + && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) + && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) + && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) + && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) + && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) + && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) + && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) + && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) + && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) + && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) break; } pParty->field_750[v12] = rand() % 258 + 1; @@ -911,21 +880,24 @@ { while ( 1 ) { - v22 = pParty->field_750[v12]; - if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) + v21 = pParty->field_750[v12]; + if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) { - if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) - && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) - && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) - && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) - && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) - && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) - && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) - && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) - && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) - && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) - && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) - break; + if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) + && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) + && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) + && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) + && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) + && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) + && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) + && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) + && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) + && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) + && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) + && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) + && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) + && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) + break; } pParty->field_750[v12] = rand() % 258 + 1; } @@ -935,24 +907,21 @@ { while ( 1 ) { - v23 = pParty->field_750[v12]; - if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) + v22 = pParty->field_750[v12]; + if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) { - if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) - && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) - && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) - && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) - && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) - && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) - && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) - && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) - && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) - && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) - && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) - && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) - && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) - && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) - break; + if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) + && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) + && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) + && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) + && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) + && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) + && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) + && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) + && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) + && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) + && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) + break; } pParty->field_750[v12] = rand() % 258 + 1; } @@ -962,88 +931,115 @@ { while ( 1 ) { - v24 = pParty->field_750[v12]; - if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) + v23 = pParty->field_750[v12]; + if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) { - if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) - && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) - && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) + if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) + && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) + && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) + && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) + && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) + && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) + && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) + && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) + && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) + && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) + && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) + && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) + && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) + && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) break; } pParty->field_750[v12] = rand() % 258 + 1; } } - v10 = v56; - } - v25 = v10; - v26 = pParty->field_750[v25]; - v27 = pParty->field_75A[v25] == v13; - word_F8B1A0 = pParty->field_750[v25]; - if ( v27 ) - { - //v1 = 0; - v27 = v26 == v13; - v29 = (int)pNPCTopics[351].pText; - if ( v27 ) - v29 = (int)pNPCTopics[353].pText; - dword_F8B1A4 = (char *)v29; } else { - if ( v26 != v13 ) + while ( 1 ) { - party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); - v28 = pParty->pPlayers; - do + v24 = pParty->field_750[v12]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) { - v28->SetVariable(VAR_Award, 86); - ++v28; + if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) + && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) + break; } - while ( (signed int)v28 < (signed int)pParty->pHirelings ); - pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; - pParty->field_750[v25] = v13; - pParty->field_75A[v25] = v13; + pParty->field_750[v12] = rand() % 258 + 1; } - //v1 = 0; - dword_F8B1A4 = pNPCTopics[352].pText; } + v10 = v56; } - else if ( uMessageParam == 100 ) + v25 = v10; + v26 = pParty->field_750[v25]; + v27 = pParty->field_75A[v25] == v13; + word_F8B1A0 = pParty->field_750[v25]; + if ( v27 ) { - pKeyActionMap->EnterText(1, 10, v8); + //v1 = 0; + v27 = v26 == v13; + v29 = (int)pNPCTopics[351].pText; + if ( v27 ) + v29 = (int)pNPCTopics[353].pText; + dword_F8B1A4 = (char *)v29; } - break; - } - case 22: + else { - if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) - pKeyActionMap->EnterText(1, 10, v8); - return; - break; + if ( v26 != v13 ) + { + party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); + v28 = pParty->pPlayers; + do + { + v28->SetVariable(VAR_Award, 86); + ++v28; + } + while ( (signed int)v28 < (signed int)pParty->pHirelings ); + pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; + pParty->field_750[v25] = v13; + pParty->field_75A[v25] = v13; + } + //v1 = 0; + dword_F8B1A4 = pNPCTopics[352].pText; } - case 1: - case 2: - case 3: - case 4: - case 21: - case 23: - case 30: - { - break; - } - default: - { - return; - break; - } + } + else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_100 ) + { + pKeyActionMap->EnterText(1, 10, v8); + } + break; + } + case BildingType_Bank: + { + if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) + pKeyActionMap->EnterText(1, 10, v8); + return; + break; + } + case BildingType_WeaponShop: + case BildingType_ArmorShop: + case BildingType_MagicShop: + case BildingType_AlchemistShop: + case BildingType_Tavern: + case BildingType_Temple: + case BildingType_Training: + { + break; + } + default: + { + return; + break; + } } /* @@ -1314,204 +1310,159 @@ //LABEL_196: switch ( uMessageParam ) { - case 96: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - FillAviableSkillsToTeach(in_current_building_type); - break; - } - case 101: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - sub_4B3A72(in_current_building_type); - break; - } - case 102: - case 103: - { - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - break; - } - case 104: - { - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + case HOUSE_DIALOGUE_LEARN_SKILLS: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + FillAviableSkillsToTeach(in_current_building_type); + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + sub_4B3A72(in_current_building_type); + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: + { + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: + { + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); + dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; + break; + } + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: + { + if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) + { + GenerateStandartShopItems(); + GenerateSpecialShopItems(); + pParty->field_3C.field_50[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); + } + if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) + { + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); - dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; + for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 ) + { + if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID ) + { + v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; + } + } + } + if ( in_current_building_type == BildingType_WeaponShop ) + { + v48 = 0; + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + do + { + if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v48].uItemID) + word_F8B158[v48] = rand() % (300 - ItemsInShopTexture[v48]->uTextureHeight); + ++v48; + } + while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ); + } + } + } + if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) + { + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 ) + { + if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID ) + { + v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; + } + } + } + if ( in_current_building_type == BildingType_WeaponShop ) + { + v53 = 0; + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + do + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v53].uItemID) + word_F8B158[v53] = rand() % (300 - ItemsInShopTexture[v53]->uTextureHeight); + ++v53; + } + while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ] ); + } + } + } break; - } - case 2: - case 95: - { - if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) - { - GenerateStandartShopItems(); - GenerateSpecialShopItems(); - v8 = window_SpeakInHouse; - v40 = window_SpeakInHouse->par1C; - //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)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - pParty->field_3C.field_50[v40] = v41; - } - v42 = v8->ptr_1C; - v43 = 0; - //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; - v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; - if ( uMessageParam == 2 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; - if ( v45 ) - { - v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BildingType_WeaponShop ) - { - v47 = v8->ptr_1C; - v48 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) - if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID) - { - v49 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight); - } - v47 = v8->ptr_1C; - ++v48; - } - //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - } - } - if ( uMessageParam == 95 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; - v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID; - if ( v50 ) - { - v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BildingType_WeaponShop ) - { - v52 = v8->ptr_1C; - v53 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID) - { - v54 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight); - } - v52 = v8->ptr_1C; - ++v53; - } - //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); - } - } - } - break; - } - case 3: - case 4: - case 5: - { - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - sub_421B2C_PlaceInInventory_or_DropPickedItem(); - break; - } - case 94: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - sub_4B3AD4(in_current_building_type); - break; - } - default: - { - if( uMessageParam >= 36 && uMessageParam <= 72 ) - { - //v35 = pPlayers[uActiveCharacter]; - //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); - v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); - v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v37 < v36 / 3 ) - v37 = v36 / 3; - - //if (false) - if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36]) - //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) - { - //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam); - if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) - { - if ( pParty->uNumGold < v37 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); - if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) - v39 = 4; - else - v39 = 2; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); - } - else - { - Party::TakeGold(v37); - dword_F8B1E4 = 1; - pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); - } - } - } - } - break; - } + } + case HOUSE_DIALOGUE_SHOP_SELL: + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + case HOUSE_DIALOGUE_SHOP_REPAIR: + { + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + sub_421B2C_PlaceInInventory_or_DropPickedItem(); + break; + } + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + sub_4B3AD4(in_current_building_type); + break; + } + default: + { + if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) + { + //v35 = pPlayers[uActiveCharacter]; + //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); + v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); + v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( v37 < v36 / 3 ) + v37 = v36 / 3; + //if (false) + if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36]) + //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) + { + //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam); + if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) + { + if ( pParty->uNumGold < v37 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); + if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) + v39 = 4; + else + v39 = 2; + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); + } + else + { + Party::TakeGold(v37); + dword_F8B1E4 = 1; + pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; + pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); + } + } + } + } + break; + } } /* if ( uMessageParam != 95 && uMessageParam != 2 ) @@ -3915,291 +3866,350 @@ //----- (004BA928) -------------------------------------------------------- void __cdecl ArmorShopDialog() - { - Player *v0; // ebx@1 - signed int v1; // esi@8 - unsigned int v2; // eax@10 - ItemGen *v3; // eax@11 - unsigned __int8 v4; // dl@12 - char *v5; // ecx@12 - char *v6; // eax@13 - int v7; // ST08_4@15 - int v8; // eax@15 - signed int v9; // esi@17 - unsigned int v10; // eax@19 - char *v11; // edi@19 - int v12; // ST08_4@20 - int v13; // eax@20 - unsigned __int8 v14; // dl@20 - char *v15; // ecx@20 - char **v16; // edi@22 - int all_text_height; // ebx@22 - char **v18; // esi@22 - int v19; // eax@23 - GUIWindow *v20; // ecx@24 - int v21; // eax@24 - int v22; // edx@24 - int v23; // ebx@24 - unsigned __int8 v24; // sf@24 - GUIButton *control_button; // eax@26 - GUIButton *v26; // esi@26 - int v27; // eax@26 - unsigned int v28; // ecx@26 - int v29; // edx@26 +{ + signed int v1; // esi@8 + unsigned int v2; // eax@10 + ItemGen *v3; // eax@11 + char *v5; // ecx@12 + char *v6; // eax@13 + int v8; // eax@15 + signed int v9; // esi@17 + unsigned int v10; // eax@19 + char *v11; // edi@19 + int v12; // ST08_4@20 + int v13; // eax@20 + char *v15; // ecx@20 + char **v16; // edi@22 + int all_text_height; // ebx@22 + char **v18; // esi@22 + int v19; // eax@23 + GUIWindow *v20; // ecx@24 + int v21; // eax@24 + int v22; // edx@24 + int v23; // ebx@24 + unsigned __int8 v24; // sf@24 + GUIButton *pButton; // eax@26 + unsigned int v28; // ecx@26 + int v29; // edx@26 + signed int v31; // esi@31 + unsigned int v32; // eax@33 + int v33; // eax@34 + int v35; // eax@35 + char *v36; // edx@36 + GUIWindow *v37; // edi@42 + signed int v38; // esi@42 + unsigned int v39; // esi@44 + int v40; // eax@44 + unsigned int v41; // eax@45 + int v42; // eax@47 + int v43; // ecx@52 + int v46; // eax@54 + unsigned int v49; // ecx@56 + int v51; // eax@56 + int v53; // eax@60 + int textureH; // eax@60 + signed int textureW; // ebx@65 + Texture *v56; // eax@67 + unsigned int pY_item; // edi@68 + Texture *v58; // ST1C_4@68 + int v59; // eax@68 + int v60; // edi@69 + signed int v61; // ebx@73 + Texture *v62; // eax@75 + int v63; // edi@76 + Texture *v64; // ST1C_4@76 + unsigned int v65; // ST18_4@76 + int v66; // eax@76 + int v67; // edi@77 + signed int v68; // ecx@81 + const char *pStatusText; // ecx@91 + void *v72; // eax@95 + POINT *v73; // esi@97 + int v74; // ecx@97 + int v75; // eax@98 + int v76; // ecx@98 + ItemGen *selected_item; // ecx@99 + unsigned __int8 v78; // bl@104 + int v80; // ebx@105 + char **v81; // esi@105 + int v82; // eax@106 + int v86; // ebx@107 + int pTextHeight; // eax@109 + unsigned int v90; // ecx@109 + int pNumString; // edx@109 + unsigned __int16 pTextColor; // ax@109 + signed int v93; // edx@114 + POINT *v94; // edi@120 + __int32 v95; // ecx@120 + void *v96; // ST14_4@122 + unsigned __int8 v97; // bl@122 + ItemGen *v98; // ST10_4@122 + int v99; // eax@122 + char *v100; // eax@122 + const char *v101; // ST18_4@122 + unsigned __int16 v102; // ST14_2@122 + int v103; // eax@122 + signed int v104; // edi@123 + Texture *v105; // eax@125 + int v106; // ebx@126 + unsigned int v108; // ST18_4@126 + int v109; // eax@126 + int v110; // ebx@127 + GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 + unsigned int v112; // [sp-14h] [bp-118h]@13 + int v113; // [sp-14h] [bp-118h]@36 + unsigned int v115; // [sp-10h] [bp-114h]@13 + ItemGen *v116; // [sp-10h] [bp-114h]@20 + int v117; // [sp-10h] [bp-114h]@36 + unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 + char *v121; // [sp-8h] [bp-10Ch]@13 + int v122; // [sp-8h] [bp-10Ch]@20 + unsigned int v123; // [sp-4h] [bp-108h]@13 + __int64 *v124; // [sp-4h] [bp-108h]@20 + int v125; // [sp-4h] [bp-108h]@68 + int v126; // [sp-4h] [bp-108h]@76 + int v127; // [sp-4h] [bp-108h]@126 + POINT v128; // [sp+Ch] [bp-F8h]@8 + POINT v129; // [sp+14h] [bp-F0h]@18 + char v130; // [sp+1Ch] [bp-E8h]@120 + POINT a2; // [sp+24h] [bp-E0h]@8 + POINT v132; // [sp+2Ch] [bp-D8h]@120 + POINT v133; // [sp+34h] [bp-D0h]@17 + POINT v134; // [sp+3Ch] [bp-C8h]@97 + POINT v135; // [sp+44h] [bp-C0h]@31 + POINT v136; // [sp+4Ch] [bp-B8h]@97 + POINT v137; // [sp+54h] [bp-B0h]@17 + POINT v138; // [sp+5Ch] [bp-A8h]@32 + POINT v139; // [sp+64h] [bp-A0h]@17 + POINT v140; // [sp+6Ch] [bp-98h]@31 + POINT v141; // [sp+74h] [bp-90h]@8 + POINT v142; // [sp+7Ch] [bp-88h]@31 + POINT v143; // [sp+84h] [bp-80h]@9 + GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 + int v146; // [sp+E4h] [bp-20h]@24 + int pYellowColor; // [sp+E8h] [bp-1Ch]@1 + int pWhiteColor; // [sp+ECh] [bp-18h]@1 + __int32 pItemCount; // [sp+F0h] [bp-14h]@8 + int v152; // [sp+FCh] [bp-8h]@24 + int v153; // [sp+100h] [bp-4h]@44 + int th; + short text_color; + int pActiveButton; - signed int v31; // esi@31 - unsigned int v32; // eax@33 - int v33; // eax@34 - int v34; // ST08_4@35 - int v35; // eax@35 - char *v36; // edx@36 - GUIWindow *v37; // edi@42 - signed int v38; // esi@42 - unsigned int v39; // esi@44 - int v40; // eax@44 - unsigned int v41; // eax@45 - int v42; // eax@47 - int v43; // ecx@52 - GUIButton *v44; // eax@54 - GUIButton *v45; // esi@54 - int v46; // eax@54 - char *v47; // eax@56 - int v48; // eax@56 - unsigned int v49; // ecx@56 - int v50; // edx@56 - int v51; // eax@56 - unsigned __int16 v52; // ax@56 - int v53; // eax@60 - int textureH; // eax@60 - signed int textureW; // ebx@65 - Texture *v56; // eax@67 - unsigned int v57; // edi@68 - Texture *v58; // ST1C_4@68 - int v59; // eax@68 - int v60; // edi@69 - signed int v61; // ebx@73 - Texture *v62; // eax@75 - int v63; // edi@76 - Texture *v64; // ST1C_4@76 - unsigned int v65; // ST18_4@76 - int v66; // eax@76 - int v67; // edi@77 - signed int v68; // ecx@81 - SHORT v69; // bx@89 - bool v70; // eax@89 - const char *v71; // ecx@91 - void *v72; // eax@95 - POINT *v73; // esi@97 - int v74; // ecx@97 - int v75; // eax@98 - int v76; // ecx@98 - ItemGen *selected_item; // ecx@99 - unsigned __int8 v78; // bl@104 - char **v79; // edi@105 - int v80; // ebx@105 - char **v81; // esi@105 - int v82; // eax@106 - GUIWindow *v83; // ecx@107 - int v84; // eax@107 - int v85; // edx@107 - int v86; // ebx@107 - GUIButton *v87; // eax@109 - GUIButton *v88; // esi@109 - int v89; // eax@109 - unsigned int v90; // ecx@109 - int v91; // edx@109 - unsigned __int16 v92; // ax@109 - signed int v93; // edx@114 - POINT *v94; // edi@120 - __int32 v95; // ecx@120 - void *v96; // ST14_4@122 - unsigned __int8 v97; // bl@122 - ItemGen *v98; // ST10_4@122 - int v99; // eax@122 - char *v100; // eax@122 - const char *v101; // ST18_4@122 - unsigned __int16 v102; // ST14_2@122 - int v103; // eax@122 - signed int v104; // edi@123 - Texture *v105; // eax@125 - int v106; // ebx@126 - Texture *v107; // ST1C_4@126 - unsigned int v108; // ST18_4@126 - int v109; // eax@126 - int v110; // ebx@127 - GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 - unsigned int v112; // [sp-14h] [bp-118h]@13 - int v113; // [sp-14h] [bp-118h]@36 - ItemGen *v114; // [sp-10h] [bp-114h]@12 - unsigned int v115; // [sp-10h] [bp-114h]@13 - ItemGen *v116; // [sp-10h] [bp-114h]@20 - int v117; // [sp-10h] [bp-114h]@36 - void *v118; // [sp-Ch] [bp-110h]@12 - unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 - void *v120; // [sp-Ch] [bp-110h]@20 - char *v121; // [sp-8h] [bp-10Ch]@13 - int v122; // [sp-8h] [bp-10Ch]@20 - unsigned int v123; // [sp-4h] [bp-108h]@13 - __int64 *v124; // [sp-4h] [bp-108h]@20 - int v125; // [sp-4h] [bp-108h]@68 - int v126; // [sp-4h] [bp-108h]@76 - int v127; // [sp-4h] [bp-108h]@126 - POINT v128; // [sp+Ch] [bp-F8h]@8 - POINT v129; // [sp+14h] [bp-F0h]@18 - char v130; // [sp+1Ch] [bp-E8h]@120 - POINT a2; // [sp+24h] [bp-E0h]@8 - POINT v132; // [sp+2Ch] [bp-D8h]@120 - POINT v133; // [sp+34h] [bp-D0h]@17 - POINT v134; // [sp+3Ch] [bp-C8h]@97 - POINT v135; // [sp+44h] [bp-C0h]@31 - POINT v136; // [sp+4Ch] [bp-B8h]@97 - POINT v137; // [sp+54h] [bp-B0h]@17 - POINT v138; // [sp+5Ch] [bp-A8h]@32 - POINT v139; // [sp+64h] [bp-A0h]@17 - POINT v140; // [sp+6Ch] [bp-98h]@31 - POINT v141; // [sp+74h] [bp-90h]@8 - POINT v142; // [sp+7Ch] [bp-88h]@31 - POINT v143; // [sp+84h] [bp-80h]@9 - GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 - char *Str; // [sp+E0h] [bp-24h]@56 - int v146; // [sp+E4h] [bp-20h]@24 - int hilight_color; // [sp+E8h] [bp-1Ch]@1 - int m_text_color; // [sp+ECh] [bp-18h]@1 - __int32 v149; // [sp+F0h] [bp-14h]@8 - Player* _this; // [sp+F4h] [bp-10h]@1 - unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15 - int v152; // [sp+FCh] [bp-8h]@24 - int v153; // [sp+100h] [bp-4h]@44 - int th; - short text_color; - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch (dialog_menu_id) + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + pWhiteColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + pYellowColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + switch (dialog_menu_id) + { + case HOUSE_DIALOGUE_MAIN: + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + all_text_height = 0; + for( int i = 0; i < 4; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v146 = ( 174 - all_text_height ) / 4; + v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; + pNumString = 0; + if ( pDialogueWindow->pNumPresenceButton>=0 ) + { + for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton) + { + pButton = pDialogueWindow->GetControl(pActiveButton); + pButton->uY = v146 + v23; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v23 = pButton->uY + pButton->uHeight - 1; + pButton->uW = v23; + pTextColor = pYellowColor; + if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) + pTextColor = pWhiteColor; + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); + ++pNumString; + } + } + } + break; + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка + textureW = 0; + v153 = 0; + for ( int i = 0; i < 8; ++i )// разместить вещи + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) + { + textureW = ItemsInShopTexture[i]->uTextureWidth; + textureH = ItemsInShopTexture[i]->uTextureHeight; + if ( i >= 4 ) //low row + { + v60 = 90 - (textureW/2); + pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); + v59 = v60 + v153 + 80220; + } + else + { + pY_item = 98 - textureH; + v152 = 86 - (textureW/2); + pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]); + v59 = v153 + v152 + 640 * pY_item; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); + } + v153 += 105; + } + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pItemCount = 0; + for ( int i = 0; i < 8; ++i ) + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) + ++pItemCount; + } + if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) + pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" + else + pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item" + DrawTextAtStatusBar(pStatusText, 0); + if ( pItemCount != 0 ) + { + v73 = pMouse->GetCursorPos(&v136); + v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; + if ( !v74 ) + return; + pItemCount = v74 - 1; + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; + if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0) + v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; + else + v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" + v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + return; + } + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { - case HOUSE_DIALOGUE_MAIN: - { - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - - all_text_height = 0; - for(int i=0;i<4;++i) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = (174 - all_text_height) / 4; - - v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - int j=0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) - { - th = 2; - for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) - { - control_button = pDialogueWindow->GetControl(v152); - control_button->uY = v146 + v23; - v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); - control_button->uHeight = v27; - v23 = control_button->uY + control_button->uHeight - 1; - control_button->uW = v23; - text_color = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != th ) - text_color = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); - ++th; - ++j; - } - } - } - break; - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + v11 = 0; + v61 = 0; + v153 = 0; + do + { + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - textureW = 0; - v153 = 0; - for(int i=0; i<8; ++i) - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - { - textureW = ItemsInShopTexture[i]->uTextureWidth; - textureH = ItemsInShopTexture[i]->uTextureHeight; - if ( i >= 4 ) //low row - { - v60 = 90 - (textureW/2); - pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); - v59 = v60 + v153 + 80220; - } - else - { - v57 = 98 - textureH; - v152 = 86 - (textureW/2); - pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]); - v59 = v153 + v152 + 640 * v57; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); - } - v153 += 105; - - } - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - - v149 = 0; - for(int i=0; i<8; ++i) - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - ++v149; - - } - - v69 = GetAsyncKeyState(17); - v70 = _this->CanSteal(); - //Str = (char *)v70; - if ( v69 == 0 || v70 == 0 ) - { - v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - } + v62 = ItemsInShopTexture[v61]; + if ( v61 >= 4 ) + { + v67 = 90 - ((signed int)v62->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); + v66 = v153 + v67 + 80220; + } + else + { + v63 = 98 - v62->uTextureHeight; + v64 = ItemsInShopTexture[v61]; + v65 = 98 - v62->uTextureHeight; + v152 = 86 - ((signed int)v62->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); + v66 = v152 + v153 + 640 * v63; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); + } + v153 += 105; + ++v61; + } + while ( v61 < 8 ); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v68 = 0; + pItemCount = 0; + do + { + // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) + ++pItemCount; + ++v68; + } + while ( v68 < 6 ); + if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) + pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" + else + pStatusText = pGlobalTXT_LocalizationStrings[185]; + DrawTextAtStatusBar(pStatusText, 0); + if ( (char *)pItemCount != 0 ) + { + v73 = pMouse->GetCursorPos(&v136); + v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; + if ( !v74 ) + return; + pItemCount = v74 - 1; + if ( dialog_menu_id == 2 ) + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; else - { - v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" - } - DrawTextAtStatusBar(v71, 0); - if ( v149 != 0 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - v149 = v74 - 1; - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; - if ( v69 ==0 || v70 == 0) - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; - } - else - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - } - v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); - return; - } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; + if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) + v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; + else + v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" + v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); return; + } + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" + all_text_height = 0; + for ( int i = 0; i < 3; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v152 = (174 - all_text_height) / 3; + v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; + v24 = -pDialogueWindow->pNumPresenceButton < 0; + pActiveButton = pDialogueWindow->pStartingPosActiveItem; + if ( v24 ^ pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + pNumString = 0; + do + { + pButton = pDialogueWindow->GetControl((unsigned int)pActiveButton); + pButton->uY = v152 + v86; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v90 = pButton->uY; + pButton->uHeight = pTextHeight; + v86 = v90 + pTextHeight - 1; + pButton->uW = v86; + pTextColor = pYellowColor; + if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) + pTextColor = pWhiteColor; + dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); + ++pNumString; + ++pActiveButton; } - break; + while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + return; + } + break; case HOUSE_DIALOGUE_SHOP_SELL: { draw_leather(); @@ -4207,389 +4217,221 @@ DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) return; - - if((v9 = pMouse->GetCursorPos(&v139)->x - 14, v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), + if((v9 = pMouse->GetCursorPos(&v139)->x - 14, pItemCount = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 - || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) + || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) ) return; - - v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; - v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3); - v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)]; + v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v10-1]; + v13 = pPlayers[uActiveCharacter]->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3); + v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)]; v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); return; } break; case HOUSE_DIALOGUE_SHOP_IDENTIFY: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v1 = pMouse->GetCursorPos(&a2)->x - 14; + pItemCount = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&v141)->x > 13 ) { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + if ( pMouse->GetCursorPos(&v143)->x < 462 ) + { + v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount); + if ( v2 ) { - v1 = pMouse->GetCursorPos(&a2)->x - 14; - v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&v141)->x > 13 ) - { - if ( pMouse->GetCursorPos(&v143)->x < 462 ) - { - v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); - if ( v2 ) - { - v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; - if (v3->Identified()) - { - v118 = window_SpeakInHouse->ptr_1C; - v4 = uActiveCharacter - 1; - v5 = "%24"; - v114 = v3; - } - else - { - v118 = window_SpeakInHouse->ptr_1C; - v114 = v3; - v7 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v8 = v0->_490EEE(v3, 2, v7, 4); - v4 = uPlayerID; - v5 = (char *)pMerchantsIdentifyPhrases[v8]; - } - v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3); - return; - } - } - } + v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v2-1]; + if (v3->Identified()) + v5 = "%24"; + else + { + v8 = pPlayers[uActiveCharacter]->_490EEE(v3, 2, (int)window_SpeakInHouse->ptr_1C, 4); + v5 = (char *)pMerchantsIdentifyPhrases[v8]; + } + v6 = BuilDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3); + return; } + } } - break; + } + } + break; case HOUSE_DIALOGUE_SHOP_REPAIR: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - - if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, - v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, + pItemCount = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), pMouse->GetCursorPos(&v140)->x <= 13) || pMouse->GetCursorPos(&v138)->x >= 462 - || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) - || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) - return; - - - v120 = window_SpeakInHouse->ptr_1C; - v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; - 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; - v15 = (char *)pMerchantsRepairPhrases[v35]; - v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32) + || (v33 = 9 * v32, !(pPlayers[uActiveCharacter]->field_1F5[4 * v33 + 15] & 2)) ) + return; + v116 = &pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1]; + v35 = pPlayers[uActiveCharacter]->_490EEE(&pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1], 2, (int)window_SpeakInHouse->ptr_1C, 5); + v15 = (char *)pMerchantsRepairPhrases[v35]; + v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + return; + } + break; + case HOUSE_DIALOGUE_SHOP_6: //buy standart ??? + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; - } - break; - case HOUSE_DIALOGUE_SHOP_6: //buy standart + pItemCount = 0; + for( int i = 0; i < 6 ; ++i ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) + ++pItemCount; + if ( pItemCount ) + { + v94 = pMouse->GetCursorPos(&v132); + pItemCount = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; + v95 = pItemCount; + if ( pItemCount && pItemCount != -65536 ) { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v149 = 0; - for(int i=0;i<6;++i) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - ++v149; - - - if ( v149 ) + --pItemCount; + v97 = uActiveCharacter - 1; + v99 = pPlayers[uActiveCharacter]->_490EEE(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2); + v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); + v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3); + } + v104 = 0; + v153 = 0; + do + { + //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) + { + v105 = ItemsInShopTexture[v104]; + if ( v104 >= 4 ) + { + v110 = 90 - ((signed int)v105->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); + v127 = v104 + 1; + v109 = v153 + v110 + 80220; + } + else { - v94 = pMouse->GetCursorPos(&v132); - v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; - v95 = v149; - if ( v149 && v149 != -65536 ) - { - --v149; - - v97 = uActiveCharacter - 1; - - v99 = _this->_490EEE( - &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2); - v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); - v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3); - } - v104 = 0; - v153 = 0; - do - { - //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) - { - v105 = ItemsInShopTexture[v104]; - if ( v104 >= 4 ) - { - v110 = 90 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); - v127 = v104 + 1; - v109 = v153 + v110 + 80220; - } - else - { - v106 = 98 - v105->uTextureHeight; - v107 = ItemsInShopTexture[v104]; - v108 = 98 - v105->uTextureHeight; - v152 = 86 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v108, v107); - v127 = v104 + 1; - v109 = v152 + v153 + 640 * v106; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); - } - v153 += 105; - ++v104; - } - while ( v104 < 8 ); - return; + v106 = 98 - v105->uTextureHeight; + v108 = 98 - v105->uTextureHeight; + v152 = 86 - ((signed int)v105->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v152 + v153, v108, ItemsInShopTexture[v104]); + v127 = v104 + 1; + v109 = v152 + v153 + 640 * v106; } - dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); + } + v153 += 105; + ++v104; } - break; - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + while ( v104 < 8 ); + return; + } + dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case HOUSE_DIALOGUE_LEARN_SKILLS: + { + if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + 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)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( (signed int)pActiveButton < v38 / 3 ) + pActiveButton = v38 / 3; + v39 = v37->pStartingPosActiveItem; + v40 = v37->pNumPresenceButton; + v153 = 0; + if ( (signed int)v39 < (signed int)(v39 + v40) ) + { + do { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - v79 = pShopOptions; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" - - all_text_height = 0; - for(int i=0;i<3;++i) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v83 = pDialogueWindow; - v152 = (174 - all_text_height) / 3; - v84 = pDialogueWindow->pStartingPosActiveItem; - v85 = v84 + pDialogueWindow->pNumPresenceButton; - v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; - v24 = -pDialogueWindow->pNumPresenceButton < 0; - _this = (Player *)pDialogueWindow->pStartingPosActiveItem; - if ( v24 ^ __OFSUB__(v84, v85) ) - { + v41 = v37->GetControl(v39)->msg_param - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] ) + { + v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); + v152 += v42; + ++v153; + } + ++v39; + } + while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); + if ( v153 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pActiveButton); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3); + pActiveButton = (149 - v152) / v153; + if ( (149 - v152) / v153 > 32 ) + pActiveButton = 32; + v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162; + v152 = v37->pStartingPosActiveItem; + v146 = v43; + if ( v152 < v152 + v37->pNumPresenceButton ) + { v153 = 2; do - { - v87 = v83->GetControl((unsigned int)_this); - v88 = v87; - v87->uY = v152 + v86; - v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0); - v90 = v88->uY; - v91 = v153; - v88->uHeight = v89; - v86 = v90 + v89 - 1; - v88->uW = v86; - v92 = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) - v92 = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); - v83 = pDialogueWindow; - ++v153; - ++v79; - _this = (Player *)((char *)_this + 1); - } - while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - return; - } - break; - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v11 = 0; - v61 = 0; - v153 = 0; - do { - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) - { - v62 = ItemsInShopTexture[v61]; - if ( v61 >= 4 ) - { - v67 = 90 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); - v66 = v153 + v67 + 80220; - } - else - { - v63 = 98 - v62->uTextureHeight; - v64 = ItemsInShopTexture[v61]; - v65 = 98 - v62->uTextureHeight; - v152 = 86 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); - v66 = v152 + v153 + 640 * v63; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); - } - v153 += 105; - ++v61; + pButton = v37->GetControl(v152); + v46 = pButton->msg_param - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = (unsigned int)((char *)pActiveButton + v146); + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v46], &dialog_window, 0, 0); + v49 = pButton->uY; + pButton->uHeight = pTextHeight; + v51 = v49 + pTextHeight - 1; + pButton->uW = v51; + v146 = v51; + pTextColor = pYellowColor; + if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) + pTextColor = pWhiteColor; + dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); + } + v53 = v37->pStartingPosActiveItem; + ++v152; + textureH = v37->pNumPresenceButton + v53; + ++v153; } - while ( v61 < 8 ); - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v68 = 0; - v149 = 0; - - do - { - // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) - ++v149; - ++v68; - } - while ( v68 < 6 ); - - v69 = GetAsyncKeyState(17); - v70 = _this->CanSteal(); - Str = (char *)v70; - if ( v69 == 0 || (char *)v70 == 0 ) - { - v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" - } - else - { - v71 = pGlobalTXT_LocalizationStrings[185]; - } - DrawTextAtStatusBar(v71, 0); - if ( (char *)v149 != 0 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - v149 = v74 - 1; - - if ( dialog_menu_id == 2 ) - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; - else - selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; - if ( v69 == 0 || Str == 0 ) - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; - } - else - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - } - v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); - return; - } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; + while ( v152 < textureH ); + } + return; } - break; - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - 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)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); - v39 = v37->pStartingPosActiveItem; - v40 = v37->pNumPresenceButton; - v153 = 0; - if ( (signed int)v39 < (signed int)(v39 + v40) ) - { - do - { - v41 = v37->GetControl(v39)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) - { - v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); - v152 += v42; - ++v153; - } - ++v39; - } - while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); - if ( v153 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - _this = (Player *)((149 - v152) / v153); - if ( (149 - v152) / v153 > 32 ) - _this = (Player *)32; - v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162; - v152 = v37->pStartingPosActiveItem; - v146 = v43; - if ( v152 < v152 + v37->pNumPresenceButton ) - { - v153 = 2; - do - { - v44 = v37->GetControl(v152); - v45 = v44; - v46 = v44->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] ) - { - v45->uW = 0; - v45->uHeight = 0; - v45->uY = 0; - } - else - { - v47 = pSkillNames[v46]; - v45->uY = (unsigned int)((char *)_this + v146); - Str = v47; - v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0); - v49 = v45->uY; - v50 = v153; - v45->uHeight = v48; - v51 = v49 + v48 - 1; - v45->uW = v51; - v146 = v51; - v52 = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) - v52 = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); - } - v53 = v37->pStartingPosActiveItem; - ++v152; - textureH = v37->pNumPresenceButton + v53; - ++v153; - } - while ( v152 < textureH ); - } - return; - } - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3); - return; - } - break; } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf, 3); + return; } - - + break; + } +} //----- (004B5D7C) -------------------------------------------------------- void GuildDialog() @@ -4972,117 +4814,115 @@ v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); HIDWORD(v60) = v2; if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) + { + if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL ) + { + if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) { - if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL ) + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { - if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) + v4 = pDialogueWindow; + v61 = pDialogueWindow; + 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); + v6 = v1->GetMerchant(); + v64 = (signed int)(v65 * (100 - v6)) / 100; + if ( v64 < (signed int)v65 / 3 ) + v64 = (signed int)v65 / 3; + v7 = v4->pStartingPosActiveItem; + v8 = v7 + v4->pNumPresenceButton; + v65 = 0; + v62 = v7; + if ( (signed int)v7 >= v8 ) + goto LABEL_78; + do + { + v9 = v4->GetControl(v62)->msg_param - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) { - - if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); + v66 = (DDM_DLV_Header *)((char *)v66 + v10); + ++v65; + } + v11 = v4->pStartingPosActiveItem; + ++v62; + } + while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); + if ( v65 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64); + v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + v64 = (149 - (signed int)v66) / (signed int)v65; + if ( v64 > 32 ) + v64 = 32; + v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; + v12 = v61; + result = v61->pStartingPosActiveItem; + v13 = result + v61->pNumPresenceButton; + v62 = v61->pStartingPosActiveItem; + if ( result < v13 ) + { + v66 = (DDM_DLV_Header *)2; + while ( 1 ) + { + v14 = v12->GetControl(v62); + v15 = v14; + v16 = v14->msg_param - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v4 = pDialogueWindow; - v61 = pDialogueWindow; - 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); - v6 = v1->GetMerchant(); - v64 = (signed int)(v65 * (100 - v6)) / 100; - if ( v64 < (signed int)v65 / 3 ) - v64 = (signed int)v65 / 3; - v7 = v4->pStartingPosActiveItem; - v8 = v7 + v4->pNumPresenceButton; - v65 = 0; - v62 = v7; - if ( (signed int)v7 >= v8 ) - goto LABEL_78; - do - { - v9 = v4->GetControl(v62)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) - { - v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); - v66 = (DDM_DLV_Header *)((char *)v66 + v10); - ++v65; - } - v11 = v4->pStartingPosActiveItem; - ++v62; - } - while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); - if ( v65 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64); - v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v64 = (149 - (signed int)v66) / (signed int)v65; - if ( v64 > 32 ) - v64 = 32; - v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; - v12 = v61; - result = v61->pStartingPosActiveItem; - v13 = result + v61->pNumPresenceButton; - v62 = v61->pStartingPosActiveItem; - if ( result < v13 ) - { - v66 = (DDM_DLV_Header *)2; - while ( 1 ) - { - v14 = v12->GetControl(v62); - v15 = v14; - v16 = v14->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) - { - v15->uW = 0; - v15->uHeight = 0; - v15->uY = 0; - } - else - { - v17 = pSkillNames[v16]; - v15->uY = v64 + v65; - HIDWORD(v60) = (uint32)v17; - v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); - v19 = v15->uY; - v15->uHeight = v18; - v20 = v19 + v18 - 1; - v15->uW = v20; - v65 = v20; - v21 = WORD2(v59); - if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) - v21 = WORD2(v58); - v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); - } - result = (int)v61; - ++v62; - v66 = (DDM_DLV_Header *)((char *)v66 + 1); - if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) - break; - v12 = v61; - } - } - } - else - { + v15->uW = 0; + v15->uHeight = 0; + v15->uY = 0; + } + else + { + v17 = pSkillNames[v16]; + v15->uY = v64 + v65; + HIDWORD(v60) = (uint32)v17; + v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); + v19 = v15->uY; + v15->uHeight = v18; + v20 = v19 + v18 - 1; + v15->uW = v20; + v65 = v20; + v21 = WORD2(v59); + if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) + v21 = WORD2(v58); + v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); + } + result = (int)v61; + ++v62; + v66 = (DDM_DLV_Header *)((char *)v66 + 1); + if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) + break; + v12 = v61; + } + } + } + else + { LABEL_78: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v22 = WORD2(v59); - v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0); - v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); - } - } - } - return; - } - - // DONATION - //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - v25 = 0; - if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) - { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v22 = WORD2(v59); + v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0); + v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); + } + } + } + return; + } + // DONATION + //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; + v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + v25 = 0; + if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) + { Party::TakeGold((signed __int64)v24); v26 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) @@ -5135,20 +4975,24 @@ ++byte_F8B1EF[uActiveCharacter]; v1->PlaySound(SPEECH_83, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!" - goto LABEL_46; - } - goto LABEL_55; - } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; + } if ( !v1->_4B6FF9() ) return; v25 = 0; if ( pParty->uNumGold < v2 ) - { -LABEL_55: - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - goto LABEL_46; - } + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; + } Party::TakeGold(v2); v35 = LODWORD(v1->pConditions[17]); v59 = v1->pConditions[14]; @@ -5169,7 +5013,11 @@ v1->uVoiceID = v38; ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37); } - goto LABEL_63; + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + v1->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; } v39 = v61; if ( (unsigned int)v61 | v35 ) @@ -5179,7 +5027,13 @@ else { if ( !v60 && !v58 && !v59 ) - goto LABEL_63; + { + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + v1->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; + } v1->field_1928 = v1->uFace; v1->field_1924 = v1->uVoiceID; v1->SetCondition(0x11u, 1); @@ -5191,13 +5045,11 @@ v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); } HIDWORD(v1->pConditions[17]) = (int)v39; -LABEL_63: pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); v1->PlaySound(SPEECH_82, 0); pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); -LABEL_46: pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return ; // void func + return; // void func } v63 = 1; v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); @@ -5636,18 +5488,9 @@ } } - - - - - - - - //----- (004B4FCF) -------------------------------------------------------- void MagicShopDialog() - { - Player *v0; // ebx@1 +{ int result; // eax@6 signed int v2; // esi@8 unsigned int v3; // ebx@10 @@ -5773,7 +5616,6 @@ int v122; int v114; - v0 = pPlayers[uActiveCharacter]; _this = pPlayers[uActiveCharacter]; memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; @@ -5781,6 +5623,41 @@ dialog_window.uFrameZ = 334; m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + all_text_height = 0; + for ( int i = 0; i < 4; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v146 = (174 - all_text_height) / 4; + v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; + int j = 0; + if ( pDialogueWindow->pNumPresenceButton>=0 ) + { + int th = 2; + for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) + { + control_button = pDialogueWindow->GetControl(v152); + control_button->uY = v146 + v23; + v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); + control_button->uHeight = v27; + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != th ) + text_color = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); + ++th; + ++j; + } + } + return; + } if ( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR ) { if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) @@ -5856,7 +5733,15 @@ v35 = v34 + v31->pNumPresenceButton; v122 = 0; if ( (signed int)v34 >= v35 ) - goto LABEL_140; + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);// + // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." + v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, hilight_color, pTmpBuf, 3); + return; + } do { v36 = v31->GetControl(v34)->msg_param - 36; @@ -5871,19 +5756,13 @@ while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem ); if ( !v122 ) { -LABEL_140: sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);// // "Seek knowledge elsewhere %s the %s" strcat(pTmpBuf, "\n \n"); strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - v30 = pTmpBuf; - v97 = 3; - v95 = pTmpBuf; - v92 = hilight_color; - v91 = 0; - v89 = 0; - v88 = &dialog_window; - goto LABEL_61; + v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, hilight_color, pTmpBuf, 3); + return; } sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); @@ -5951,7 +5830,7 @@ result = (int)pMouse->GetCursorPos(&v106), *(int *)result <= 13) || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) - || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) + || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) ) return; v96 = 0; @@ -5963,96 +5842,9 @@ v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5); v9 = uPlayerID; v10 = (char *)pMerchantsRepairPhrases[v29]; - goto LABEL_35; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) - { - /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory" - v14 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" - v15 = pShopOptions; - do - { - v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0); - ++v15; - v14 += v16; - } - while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); - v17 = pDialogueWindow; - v114 = (174 - v14) / 4; - result = pDialogueWindow->pStartingPosActiveItem; - v18 = result + pDialogueWindow->pNumPresenceButton; - v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v122 = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__(result, v18) ) - { - v119 = (const char **)2; - _this = (Player *)pShopOptions; - do - { - v21 = v17->GetControl(v122); - v22 = (const char **)_this; - v21->uY = v114 + v19; - v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0); - v24 = v21->uY; - v25 = v119; - v21->uHeight = v23; - v19 = v24 + v23 - 1; - v21->uW = v19; - v26 = color2; - if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 ) - v26 = m_text_color; - dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u); - v17 = pDialogueWindow; - v119 = (const char **)((char *)v119 + 1); - _this = (Player *)((char *)_this + 4); - ++v122; - result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( v122 < result ); - } - }*/ - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - - all_text_height = 0; - for(int i=0;i<4;++i) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = (174 - all_text_height) / 4; - - v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - int j=0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) - { - int th = 2; - for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) - { - control_button = pDialogueWindow->GetControl(v152); - control_button->uY = v146 + v23; - v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); - control_button->uHeight = v27; - v23 = control_button->uY + control_button->uHeight - 1; - control_button->uW = v23; - text_color = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != th ) - text_color = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); - ++th; - ++j; - } - } - - + v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); + v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3); return; } if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) @@ -6076,7 +5868,7 @@ result = (int)pMouse->GetCursorPos(&v103); if ( *(int *)result < 462 ) { - result = v0->GetItemIDAtInventoryIndex((int *)&v117); + result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117); v3 = 0; if ( result ) { @@ -6086,13 +5878,9 @@ if ( v4[20] & 1 ) { v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - v97 = 3; - v95 = v5; - v92 = m_text_color; v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; - - dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); - return; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v5, 3); + return; } v93 = window_SpeakInHouse->ptr_1C; v90 = (ItemGen *)v4; @@ -6101,7 +5889,10 @@ v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4); v9 = uPlayerID; v10 = (char *)pMerchantsIdentifyPhrases[v8]; - goto LABEL_35; + v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); + v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3); + return; } } } @@ -6119,7 +5910,7 @@ result = (int)pMouse->GetCursorPos(&v105), *(int *)result <= 13) || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) - || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) + || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) return; v96 = 0; v94 = 3; @@ -6130,17 +5921,9 @@ v13 = _this->_490EEE(v90, 3, v12, 3); v9 = uPlayerID; v10 = (char *)pMerchantsSellPhrases[v13]; -LABEL_35: v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); - v97 = 3; - v95 = v30; - v92 = m_text_color; - v91 = v3; - v89 = v3; - v88 = &dialog_window; -LABEL_61: - v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); + v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3); return; } } @@ -6282,7 +6065,7 @@ if ( result ) { v66 = 0; - v117 = 0;\ + v117 = 0; if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { do @@ -6355,7 +6138,10 @@ v9 = uPlayerID; v10 = (char *)pMerchantsBuyPhrases[v75]; } - goto LABEL_35; + v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); + v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3); + return; } } return; diff -r 393a83dcc359 -r 4dc2252e0b03 UIHouses.h --- a/UIHouses.h Thu Apr 18 11:15:54 2013 +0600 +++ b/UIHouses.h Fri Apr 19 17:01:55 2013 +0600 @@ -23,6 +23,8 @@ HOUSE_DIALOGUE_TRAININGHALL_TRAIN = 17, HOUSE_DIALOGUE_GUILD_BUY_BOOKS = 18, //... + HOUSE_DIALOGUE_36 = 36, + //.. HOUSE_DIALOGUE_GUILD_LEARN_SKILL = 72, //... HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT = 94, diff -r 393a83dcc359 -r 4dc2252e0b03 UIPopup.cpp --- a/UIPopup.cpp Thu Apr 18 11:15:54 2013 +0600 +++ b/UIPopup.cpp Fri Apr 19 17:01:55 2013 +0600 @@ -1614,235 +1614,172 @@ } //----- (00418083) -------------------------------------------------------- -char __cdecl CharacterUI_StatsTab_ShowHint() - { - LONG _x; // esi@1 - Player *_y; // eax@1 - int v2; // edi@1 - __int16 *v3; // ecx@1 - LONG v4; // edx@2 - signed int v5; // edx@4 - char *v6; // ecx@9 - char *v7; // ebx@9 - unsigned int v8; // ebx@15 - unsigned __int64 v9; // kr00_8@15 - char *v10; // ST2C_4@15 - signed int v11; // eax@15 - char *v12; // ecx@17 - char *v13; // eax@20 - Player *v14; // esi@28 - int v15; // ebx@28 - int v16; // eax@33 - POINT a2; // [sp+Ch] [bp-24h]@1 - __int64 v19; // [sp+14h] [bp-1Ch]@15 - char *v20; // [sp+1Ch] [bp-14h]@13 - Player *v21; // [sp+20h] [bp-10h]@13 - unsigned int v22; // [sp+24h] [bp-Ch]@15 - int *v23; // [sp+28h] [bp-8h]@13 - const char *v24; // [sp+2Ch] [bp-4h]@10 +void __cdecl CharacterUI_StatsTab_ShowHint() + { + LONG _x; // esi@1 + LONG _y; // eax@1 + int pStringNum; // edi@1 + signed int pTextColor; // eax@15 + char *pHourWord; // ecx@17 + char *pDayWord; // eax@20 + int v15; // ebx@28 + int v16; // eax@33 + POINT a2; // [sp+Ch] [bp-24h]@1 + int pHour; // [sp+14h] [bp-1Ch]@15 + unsigned int pDay; // [sp+24h] [bp-Ch]@15 - _x = pMouse->GetCursorPos(&a2)->x; - _y = (Player *)pMouse->GetCursorPos(&a2)->y; - v2 = 0; - v3 = &array_4E2940[0].field_2; - while ( 1 ) - { - v4 = *(v3 - 1); - if ( _x >= v4 ) - { - if ( _x <= v4 + v3[1] ) - { - v5 = *v3; - if ( (signed int)_y >= v5 ) - { - if ( (signed int)_y <= v5 + v3[2] ) - break; - } - } - } - v3 += 4; - ++v2; - if ( (signed int)v3 >= (signed int)&off_4E2A12 ) - return (char)_y; - } - switch ( v2 ) - { - case 0: + _x = pMouse->GetCursorPos(&a2)->x; + _y = pMouse->GetCursorPos(&a2)->y; + for ( pStringNum = 0; pStringNum < (signed int)&off_4E2A12; ++pStringNum ) + { + if ( _x >= stat_string_coord[pStringNum].x && _x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width ) + { + if ( _y >= stat_string_coord[pStringNum].y && _y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height ) + break; + } + } + switch ( pStringNum ) + { + case 0:// Attributes case 1: case 2: case 3: case 4: case 5: case 6: - LOBYTE(_y) = 4 * v2; - v6 = aAttributeNames[v2]; - v7 = pAttributeDescriptions[v2]; - goto LABEL_46; - case 7: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[108]); - v7 = pHealthPointsAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[108]; - goto LABEL_47; - case 8: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[212]); - v7 = pSpellPointsAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[212]; - goto LABEL_47; - case 9: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[12]); - v7 = pArmourClassAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[12]; - goto LABEL_47; - case 10: - v24 = pGlobalTXT_LocalizationStrings[47]; - strcpy(pTmpBuf2, pPlayerConditionAttributeDescription); - v7 = pTmpBuf2; - v20 = pTmpBuf2; - strcat(pTmpBuf2, "\n"); - - extern unsigned int pConditionImportancyTable[18]; - v23 = (int *)pConditionImportancyTable; - _y = pPlayers[uActiveCharacter]; - v21 = pPlayers[uActiveCharacter]; - do - { - if ( _y->pConditions[*v23] ) - { - strcat(pTmpBuf2, " \n"); - v8 = *v23; - v9 = pParty->uTimePlayed - v21->pConditions[*v23]; - a2.x = LODWORD(pParty->uTimePlayed) - LODWORD(v21->pConditions[*v23]); - a2.y = HIDWORD(v9); - v19 = (signed __int64)((double)*(signed __int64 *)&a2 * 0.234375) / 60 / 60; - v22 = (unsigned int)v19 / 0x18; - v10 = aCharacterConditionNames[v8]; - v19 %= 24i64; - v11 = GetConditionDrawColor(v8); - sprintf(pTmpBuf, &byte_4E2DE8, v11, v10); - strcat(pTmpBuf2, pTmpBuf); - if ( v19 && v19 <= 1 ) - v12 = pGlobalTXT_LocalizationStrings[109]; - else - v12 = pGlobalTXT_LocalizationStrings[110]; - if ( !v22 || (v13 = pGlobalTXT_LocalizationStrings[56], v22 > 1) ) - v13 = pGlobalTXT_LocalizationStrings[57]; - sprintf(pTmpBuf, "%lu %s, %lu %s", v22, v13, v19, v12); - strcat(pTmpBuf2, pTmpBuf); - v7 = v20; - _y = v21; - } - ++v23; - } - while ( (signed int)v23 < (signed int)&unk_4EDF40 ); - goto LABEL_47; - case 11: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[172]); - v7 = pFastSpellAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[172]; - goto LABEL_47; - case 12: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[5]); - v7 = pPlayerAgeAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[5]; - goto LABEL_47; - case 13: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[131]); - v7 = pPlayerLevelAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[131]; - goto LABEL_47; - case 14: - v14 = pPlayers[uActiveCharacter]; - v24 = pGlobalTXT_LocalizationStrings[83]; - v15 = v14->uLevel; - do - { - if ( (signed __int64)v14->uExperience < (unsigned int)sub_4B46F8(v15) ) - break; - ++v15; - } - while ( v15 <= 10000 ); - pTmpBuf[0] = 0; - pTmpBuf2[0] = 0; - if ( v15 > v14->uLevel ) - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[147], v15); - v16 = sub_4B46F8(v15) - LODWORD(v14->uExperience); - sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[538], v16, v15 + 1); - strcat(pTmpBuf, "\n"); - strcat(pTmpBuf, pTmpBuf2); - LOBYTE(_y) = sprintf(pTmpBuf2, "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf); - v7 = pTmpBuf2; - goto LABEL_47; - case 15: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[587]); - v7 = pAttackBonusAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[587]; - goto LABEL_47; - case 16: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[588]); - v7 = pAttackDamageAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[588]; - goto LABEL_47; - case 17: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[589]); - v7 = pMissleBonusAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[589]; - goto LABEL_47; - case 18: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[590]); - v7 = pMissleDamageAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[590]; - goto LABEL_47; - case 19: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[87]); - v7 = pFireResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[87]; - goto LABEL_47; - case 20: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[6]); - v7 = pAirResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[6]; - goto LABEL_47; - case 21: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[240]); - v7 = pWaterResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[240]; - goto LABEL_47; - case 22: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[70]); - v7 = pEarthResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[70]; - goto LABEL_47; - case 23: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[142]); - v7 = pMindResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[142]; - goto LABEL_47; - case 24: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[29]); - v7 = pBodyResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[29]; - goto LABEL_47; - case 25: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[207]); - v7 = pSkillPointsAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[207]; - goto LABEL_47; + if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] ) + sub_4179BC_draw_tooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]); + break; + case 7:// Health Points + if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription); + break; + case 8:// Spell Points + if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription); + break; + case 9:// Armor Class + if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription); + break; + case 10:// Player Condition + strcpy(pTmpBuf2, pPlayerConditionAttributeDescription); + strcat(pTmpBuf2, "\n"); + extern unsigned int pConditionImportancyTable[18]; + for ( uint i = 0; i < 18; ++i ) + { + if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] ) + { + strcat(pTmpBuf2, " \n"); + pHour = pParty->uTimePlayed - pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]]; + pHour = (unsigned int)((pHour * 0.234375) / 60 / 60); + pDay = (unsigned int)pHour / 24; + pHour %= 24i64; + pTextColor = GetConditionDrawColor(pConditionImportancyTable[i]); + sprintfex(pTmpBuf, format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]); + strcat(pTmpBuf2, pTmpBuf); + if ( pHour && pHour <= 1 ) + pHourWord = pGlobalTXT_LocalizationStrings[109]; + else + pHourWord = pGlobalTXT_LocalizationStrings[110]; + if ( !pDay || (pDayWord = pGlobalTXT_LocalizationStrings[56], pDay > 1) ) + pDayWord = pGlobalTXT_LocalizationStrings[57]; + sprintfex(pTmpBuf, "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord); + strcat(pTmpBuf2, pTmpBuf); + } + } + if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2 ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2); + break; + case 11:// Fast Spell + if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription); + break; + case 12:// Player Age + if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription); + break; + case 13:// Player Level + if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription); + break; + case 14://Experience + v15 = pPlayers[uActiveCharacter]->uLevel; + do + { + if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)sub_4B46F8(v15) ) + break; + ++v15; + } + while ( v15 <= 10000 ); + pTmpBuf[0] = 0; + pTmpBuf2[0] = 0; + if ( v15 > pPlayers[uActiveCharacter]->uLevel ) + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[147], v15); + v16 = sub_4B46F8(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[538], v16, v15 + 1); + strcat(pTmpBuf, "\n"); + strcat(pTmpBuf, pTmpBuf2); + sprintf(pTmpBuf2, "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf); + if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2 ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2); + break; + case 15:// Attack Bonus + if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription); + break; + case 16:// Attack Damage + if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription); + break; + case 17:// Missle Bonus + if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription); + break; + case 18:// Missle Damage + if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription); + break; + case 19:// Fire Resistance + if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription); + break; + case 20:// Air Resistance + if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription); + break; + case 21:// Water Resistance + if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription); + break; + case 22:// Earth Resistance + if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription); + break; + case 23:// Mind Resistance + if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription); + break; + case 24:// Body Resistance + if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription); + break; + case 25: // Skill Points + if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); + break; case 26: - _y = (Player *)(4 * pPlayers[uActiveCharacter]->classType); - v6 = *(char **)((char *)_y->pConditions + (int)pClassNames); - v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions); -LABEL_46: - v24 = v6; -LABEL_47: - if ( v24 && v7 ) - LOBYTE(_y) = sub_4179BC_draw_tooltip(v24, v7); - break; + __debugbreak; + //_y = (Player *)(4 * pPlayers[uActiveCharacter]->classType); + //v24 = *(char **)((char *)_y->pConditions + (int)pClassNames); + //v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions); + //if ( v24 && v7 ) + //sub_4179BC_draw_tooltip(v24, v7); + break; default: - return (char)_y; - } - return (char)_y; - } - + break; + } +} //----- (00410B28) -------------------------------------------------------- void __thiscall DrawSpellDescriptionPopup(int spell_index) diff -r 393a83dcc359 -r 4dc2252e0b03 mm7_2.cpp --- a/mm7_2.cpp Thu Apr 18 11:15:54 2013 +0600 +++ b/mm7_2.cpp Fri Apr 19 17:01:55 2013 +0600 @@ -741,64 +741,40 @@ } //----- (004BC8D5) -------------------------------------------------------- -void SpellBookGenerator() - { - int v0; // esi@1 - int v1; // ebx@1 - signed int v2; // edi@1 - signed int v3; // eax@2 +void SpellBookGenerator()//for GuildDialogs +{ + int pItemNum; // esi@1 int v4; // esi@7 - GUIWindow *v5; // ebp@15 - Texture *result; // eax@15 - int v7; // [sp+10h] [bp-4h]@0 - - // v0 = v7; - v1 = window_SpeakInHouse->par1C - 139; - v2 = 0; - for(int i=0; i<12; ++i) - { - //v3 = p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]; - v3 = p2DEvents[window_SpeakInHouse->par1C - 1].uType; - if ( v3 >= 5 ) - { - 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)window_SpeakInHouse->ptr_1C - 1].uType - + 345; - } - else - { - if ( v3 == 14 ) - { - v4 = rand() % 4; - } - else if ( v3 == 15 ) - { - v4 = rand() % 3 + 4; - } - else if ( v3 == 16 ) - v4 = rand() % 2 + 7; - if( v3 <= 16 ) - v0 = rand() % word_4F0F30[(signed int)v1] + 11 * v4 + 400; - } - } - if ( v0 == 487 ) + + for( int i = 0; i < 12; ++i ) + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 ) + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 ) + pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345; + else + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 ) + v4 = rand() % 4; + else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 ) + v4 = rand() % 3 + 4; + else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 ) + v4 = rand() % 2 + 7; + if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 ) + pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400; + } + } + if ( pItemNum == 487 ) { if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) - v0 = 486; - } - v5 = window_SpeakInHouse; - - ItemGen * _u = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; - _u->Reset(); - pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID= v0; + pItemNum = 486; + } + ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; + item_spellbook->Reset(); + pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum; pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified(); - - ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pItemsTable->pItems[v0].pIconName, TEXTURE_16BIT_PALETTE)]; - } - + ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE)]; + } return; } diff -r 393a83dcc359 -r 4dc2252e0b03 mm7_data.cpp --- a/mm7_data.cpp Thu Apr 18 11:15:54 2013 +0600 +++ b/mm7_data.cpp Fri Apr 19 17:01:55 2013 +0600 @@ -289,7 +289,35 @@ }; int paperdoll_helm_texture[2][16]; int paperdoll_belt_texture[2][7]; -stru334 array_4E2940[26]; +stat_coord stat_string_coord[26] = //0x4E2940 +{ + {0x1A, 0x39, 0xDC, 0x12}, + {0x1A, 0x4A, 0xDC, 0x12}, + {0x1A, 0x5B, 0xDC, 0x12}, + {0x1A, 0x6C, 0xDC, 0x12}, + {0x1A, 0x7D, 0xDC, 0x12}, + {0x1A, 0x8E, 0xDC, 0x12}, + {0x1A, 0x9F, 0xDC, 0x12}, + {0x1A, 0xC6, 0xDC, 0x12}, + {0x1A, 0xD7, 0xDC, 0x12}, + {0x1A, 0xE8, 0xDC, 0x12}, + {0x1A, 0x10C, 0xDC, 0x12}, + {0x1A, 0x11E, 0xDC, 0x12}, + {0x111, 0x36, 0xBA, 0x12}, + {0x111, 0x47, 0xBA, 0x12}, + {0x111, 0x58, 0xBA, 0x12}, + {0x111, 0x7E, 0xBA, 0x12}, + {0x111, 0x8F, 0xBA, 0x12}, + {0x111, 0xA0, 0xBA, 0x12}, + {0x111, 0xB1, 0xBA, 0x12}, + {0x111, 0xCA, 0xBA, 0x12}, + {0x111, 0xDD, 0xBA, 0x12}, + {0x111, 0xF0, 0xBA, 0x12}, + {0x111, 0x103, 0xBA, 0x12}, + {0x111, 0x116, 0xBA, 0x12}, + {0x111, 0x129, 0xBA, 0x12}, + {0x13E, 0x12, 0x89, 0x12}, +}; stru348 stru_4E1890[13]; @@ -488,7 +516,7 @@ }; // weak __int16 RightClickPortraitXmin[4]={0x14, 0x83, 0xF2, 0x165}; __int16 RightClickPortraitXmax[4]={0x53, 0xC6, 0x138, 0x1A7}; -void *off_4E2A12; // weak +void *off_4E2A12; // stat_string_control_button_count int pArmorSkills[5]={ 9, 10, 11, 8, 30}; int pWeaponSkills[9]={3, 5, 2, 6, 4, 0, 1, 31, 7}; int pMiscSkills[12]={35, 33, 24, 21, 32, 36, 29, 25, 22, 26, 23, 34}; @@ -549,7 +577,7 @@ //const char *format_4E2DC8 = "\f%05d"; char aS[777]; // idb char aLuSLuS[777]; // idb -char byte_4E2DE8; // idb +const char *format_4E2DE8 = "\f%05d%s\f00000 - "; char asc_4E2DFC[3]; // idb const char *format_4E2E00 = "%s\f%05u\xD\r180%s\n"; // idb const char *format_4E2E10 = "%s\f%05u\t110%d\f00000 / %d\n"; diff -r 393a83dcc359 -r 4dc2252e0b03 mm7_data.h --- a/mm7_data.h Thu Apr 18 11:15:54 2013 +0600 +++ b/mm7_data.h Fri Apr 19 17:01:55 2013 +0600 @@ -487,7 +487,7 @@ //extern const char *format_4E2DC8; extern char aS[]; // idb extern char aLuSLuS[]; // idb -extern char byte_4E2DE8; // idb +extern const char *format_4E2DE8; // idb extern char asc_4E2DFC[3]; // idb extern const char *format_4E2E00; // idb extern const char *format_4E2E10; // format text of resistance in Stats screen diff -r 393a83dcc359 -r 4dc2252e0b03 stru6.cpp --- a/stru6.cpp Thu Apr 18 11:15:54 2013 +0600 +++ b/stru6.cpp Fri Apr 19 17:01:55 2013 +0600 @@ -1298,7 +1298,7 @@ switch (uSpellID) { case SPELL_153: - __debugbreak(); // spell id == 153 wtf , curse probably ? happening when attacked by harpies + __debugbreak(); // spell id == 153 wtf , curse probably ? happening when attacked by harpies /disease(Ritor1)/ v6 = "zapp"; break;