# HG changeset patch # User Ritor1 # Date 1378382750 -21600 # Node ID f47eab1a70d85f4d26cf51d613d8a607c1d5c13e # Parent 863de6ec906bec35266953834d40002caf9b859d UIHouses.cpp cleaning(continue) diff -r 863de6ec906b -r f47eab1a70d8 UI/UIGuilds.cpp --- a/UI/UIGuilds.cpp Thu Sep 05 13:31:15 2013 +0600 +++ b/UI/UIGuilds.cpp Thu Sep 05 18:05:50 2013 +0600 @@ -40,7 +40,6 @@ int v26; // ecx@47 GUIButton *pButton; // eax@49 unsigned int v29; // eax@49 - char *pText; // eax@52 int pTextHeight; // eax@55 unsigned int v32; // ecx@55 int v33; // eax@55 @@ -75,6 +74,7 @@ int pPrice; // [sp+2E8h] [bp-4h]@1 int pNumActivItem; int all_text_height; + int pX; memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); working_window.uFrameX = 483; @@ -123,46 +123,36 @@ pRenderer->DrawTextureIndexed(8, 8, ShopTexture); v6 = 0; v62 = 0; - //pPrice = 32; - for ( pPrice = 32; pPrice < 452; pPrice += 70 ) + for ( pX = 32; pX < 452; pX += 70 )//расположение в верхнем ряду { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID) + if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID ) { - pRenderer->DrawTextureTransparent(pPrice, 90, ItemsInShopTexture[v6]); + pRenderer->DrawTextureTransparent(pX, 90, ItemsInShopTexture[v6]); ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); } - //pPrice += 70; v62 += 280; ++v6; } - //while ( pPrice < 452 ); v62 = 1680; v7 = 6; - //pPrice = 32; - for ( pPrice = 32; pPrice < 452; pPrice += 70 ) + for ( pX = 32; pX < 452; pX += 70 )//расположение в нижнем ряду { if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) { - pRenderer->DrawTextureTransparent(pPrice, 250, ItemsInShopTexture[v7]); + pRenderer->DrawTextureTransparent(pX, 250, ItemsInShopTexture[v7]); ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); } - //pPrice += 70; v62 += 280; ++v7; } - //while ( pPrice < 452 ); if ( HouseUI_CheckIfPlayerCanInteract() ) { v8 = 0; - //v9 = 12; - //do for ( v9 = 12; v9; --v9 ) { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID ) + if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID > 0 ) ++v8; - //--v9; } - //while ( v9 ); GetAsyncKeyState(17); statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) @@ -170,8 +160,7 @@ DrawTextAtStatusBar(statusbar_string, 0); if ( !v8 ) { - working_window.DrawCurrentTime(__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - pParty->uTimePlayed); + working_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C] - pParty->uTimePlayed);//"Приходите через 14 дней" return; } v12 = pMouse->GetCursorPos(&v51); @@ -196,7 +185,7 @@ guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) { //you must me member v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3u); + working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3); pDialogueWindow->pNumPresenceButton = 0; return; } @@ -266,9 +255,8 @@ v29 = pButton->msg_param; if ( v29 == 18 ) { - pText = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells" pButton->uY = v58 + v26; - pTextHeight = pFontArrus->CalcTextHeight(pText, &working_window, 0, 0); + pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); v32 = pButton->uY; pButton->uHeight = pTextHeight; v33 = v32 + pTextHeight - 1; @@ -277,7 +265,7 @@ pTextColor = pColorYellow; if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) pTextColor = pColorWhite; - working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pText, 3); + working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells" } else { diff -r 863de6ec906b -r f47eab1a70d8 UI/UIHouses.cpp --- a/UI/UIHouses.cpp Thu Sep 05 13:31:15 2013 +0600 +++ b/UI/UIHouses.cpp Thu Sep 05 18:05:50 2013 +0600 @@ -109,10 +109,6 @@ {255, 255, 255, 255} // HOUSE_BOATS_73 }; - - - - std::array pAnimatedRooms = //0x4E5F70 {{ {"", 0x4, 0x1F4, 0, 0, 0}, @@ -326,7 +322,7 @@ num_buttons = 2; CreateButtonInColumn(0, 102); CreateButtonInColumn(1, 103); - if ( pParty->HasItem(651) ) //Arcomage Deck + if ( pParty->HasItem(651) ) //Arcomage Deck { num_buttons = 3; CreateButtonInColumn(2, 104); @@ -369,24 +365,6 @@ //----- (004B3B42) -------------------------------------------------------- void InitializaDialogueOptions(BuildingType type) { - /*int v1; // ecx@18 - int v2; // ecx@19 - int v3; // ecx@20 - signed int v4; // esi@22 - signed int v5; // eax@22 - unsigned int v6; // edx@24 - int v7; // ecx@24 - int result; // eax@43 - int v9; // [sp-10h] [bp-14h]@28 - int v10; // [sp-Ch] [bp-10h]@28 - int v11; // [sp-8h] [bp-Ch]@28 - unsigned int v12; // [sp-4h] [bp-8h]@4 - unsigned int v13; // [sp-4h] [bp-8h]@5 - unsigned int v14; // [sp-4h] [bp-8h]@9 - unsigned int v15; // [sp-4h] [bp-8h]@10 - unsigned int v16; // [sp-4h] [bp-8h]@14 - int v17; // [sp-4h] [bp-8h]@28*/ - switch (type) { case BuildingType_WeaponShop: @@ -764,39 +742,30 @@ //----- (004B1784) -------------------------------------------------------- bool HouseUI_CheckIfPlayerCanInteract() { - Player *pPlayer; // ebx@1 - bool result; // eax@2 - int v3; // eax@3 - GUIWindow v4; // [sp+4h] [bp-54h]@3 + GUIWindow window; // [sp+4h] [bp-54h]@3 - pPlayer = pPlayers[uActiveCharacter]; - if ( pPlayer->CanAct() ) + if ( pPlayers[uActiveCharacter]->CanAct() ) { pDialogueWindow->pNumPresenceButton = dword_F8B1E0; - result = 1; + return true; } else { pDialogueWindow->pNumPresenceButton = 0; - memcpy(&v4, pPrimaryWindow, sizeof(v4)); - v4.uFrameX = 483; - v4.uFrameWidth = 148; - v4.uFrameZ = 334; - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// - // "%s is in no condition to %s" - // "do anything" - v3 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v4, 0, 0); - v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, ui_house_player_cant_interact_color, pTmpBuf.data(), 3u); - result = 0; + memcpy(&window, pPrimaryWindow, sizeof(window)); + window.uFrameX = 483; + window.uFrameWidth = 148; + window.uFrameZ = 334; + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, + pGlobalTXT_LocalizationStrings[562]); // "%s is in no condition to %s""do anything" + window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &window, 0, 0)) / 2 + 101, ui_house_player_cant_interact_color, pTmpBuf.data(), 3); + return false; } - return result; } //----- (0044622E) -------------------------------------------------------- bool EnterHouse(enum HOUSE_ID uHouseID) { - //enum HOUSE_ID v1; // edi@1 - //int v2; // edi@5 signed int uOpenTime; // eax@5 signed int uCloseTime; // esi@5 unsigned int v5; // esi@5 @@ -804,27 +773,18 @@ signed int am_pm_flag_open; // ecx@10 signed int am_pm_flag_close; // eax@10 int v9; // esi@10 - //unsigned int v10; // esi@16 int v11; // ecx@17 unsigned int v12; // kr00_4@25 - //Player *v13; // esi@25 int v14; // eax@25 - //Player *v15; // esi@27 - //signed int v16; // eax@32 unsigned int v17; // eax@37 signed int v18; // edi@37 signed int v19; // edi@41 - //unsigned int v20; // ecx@41 - //const char *v22; // [sp-4h] [bp-40h]@33 char pContainer[40]; // [sp+Ch] [bp-30h]@32 unsigned int v24; // [sp+34h] [bp-8h]@5 - //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1 - //v1 = uHouseID; - //v25 = uHouseID; GameUI_Footer_TimedString[0] = 0; pFooterString[0] = 0; - ShowStatusBarString("", 2u); + ShowStatusBarString("", 2); if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; viewparams->bRedrawGameUI = 1; @@ -952,25 +912,11 @@ //----- (0044606A) -------------------------------------------------------- void PrepareHouse(HOUSE_ID house) { - //unsigned int v1; // ebx@1 - //signed int v2; // esi@1 - //int uExitPic; // edi@1 __int16 uExitMapID; // ax@2 - //int result; // eax@5 - //unsigned int *v6; // ecx@8 int v7; // ebx@11 - //int v8; // esi@16 - //unsigned int v9; // eax@16 - //unsigned int v10; // eax@19 - //int v11; // ecx@19 - //char pContainer[36]; // [sp+Ch] [bp-54h]@16 int v13; // [sp+30h] [bp-30h]@11 int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1 - //unsigned int v15; // [sp+4Ch] [bp-14h]@1 int uAnimationID; // [sp+50h] [bp-10h]@1 - //unsigned int *v17; // [sp+54h] [bp-Ch]@3 - //unsigned int v18; // [sp+58h] [bp-8h]@1 - //int v19; // [sp+5Ch] [bp-4h]@7 uAnimationID = p2DEvents[house - 1].uAnimationID; @@ -1041,15 +987,8 @@ //----- (004BCACC) -------------------------------------------------------- void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) { - //unsigned int v1; // edi@1 - //signed int v2; // ebx@1 - //signed int v3; // ecx@2 - int v4; // eax@5 - signed int v5; // esi@5 - //Player *v6; // ecx@5 - //signed int v7; // edx@5 + int experience_for_next_level; // eax@5 GUIWindow *v8; // esi@10 - unsigned int v9; // eax@12 int v10; // esi@31 int v11; // edi@31 int v12; // esi@32 @@ -1070,19 +1009,17 @@ char v27; // zf@190 Player *v28; // edi@192 int v29; // eax@204 - void *v30; // esi@208 - unsigned __int64 v31; // qax@208 - signed int v32; // edi@209 - int v33; // eax@210 + //void *v30; // esi@208 + //unsigned __int64 v31; // qax@208 + //signed int v32; // edi@209 + //int v33; // eax@210 unsigned int v34; // eax@211 - //Player *v35; // edi@227 signed int v36; // esi@227 int v37; // ecx@227 int v38; // esi@230 int v39; // edx@235 int v40; // edi@243 unsigned __int64 v41; // qax@243 - //void *v42; // eax@244 signed int v43; // edi@244 int v44; // edx@244 int v45; // eax@246 @@ -1095,49 +1032,36 @@ void *v52; // eax@260 signed int v53; // edi@260 int v54; // eax@262 - //signed int v55; // [sp+10h] [bp-10h]@1 int v56; // [sp+14h] [bp-Ch]@31 - //v1 = 0; - //v2 = a1; - //v55 = a1; if ( !pDialogueWindow->pNumPresenceButton ) return; pRenderer->ClearZBuffer(0, 479); - //v3 = dword_F8B198; if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) v8 = window_SpeakInHouse; - //else if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) { if ( in_current_building_type == BuildingType_Training ) { if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) { - v4 = 0; - v5 = 0; - //v6 = pPlayers[uActiveCharacter]; - //v7 = pPlayers[uActiveCharacter]->uLevel; + experience_for_next_level = 0; if ( pPlayers[uActiveCharacter]->uLevel > 0 ) { - do - v4 += v5++ + 1; - while ( v5 < pPlayers[uActiveCharacter]->uLevel ); + for( uint i = 0; i < pPlayers[uActiveCharacter]->uLevel; i++ ) + experience_for_next_level += i + 1; } if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && - (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4) + (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * experience_for_next_level) return; } pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, 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(8, 8, 0x1C2, 0x140, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); -// LABEL_10: - //v3 = dword_F8B198; + pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); v8 = window_SpeakInHouse; } - //else if ( in_current_building_type != BuildingType_Training ) { v8 = window_SpeakInHouse; @@ -1145,14 +1069,11 @@ transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) { - //LABEL_9: pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, 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); - // LABEL_10: - //v3 = dword_F8B198; + pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); v8 = window_SpeakInHouse; } else if (uActiveCharacter) @@ -1162,14 +1083,10 @@ v8 = window_SpeakInHouse; } } - //LABEL_11: dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; if ( in_current_building_type < BuildingType_19 ) { - v9 = pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - ShopTexture = &pIcons_LOD->pTextures[v9]; - //LABEL_13: + ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; v8 = window_SpeakInHouse; } } @@ -1190,33 +1107,23 @@ case BuildingType_15: case BuildingType_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 ) + if ( pParty->field_3C.field_50[window_SpeakInHouse->par1C] >= (signed __int64)pParty->uTimePlayed ) { - v32 = 0; - do + for ( uint i = 0; i < 12; ++i ) { - //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 ) + if ( pParty->SpellBooksInGuilds[v8->par1C-139][i].uItemID ) { - v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); + v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpellBooksInGuilds[v8->par1C-139][i].uItemID].pIconName, TEXTURE_16BIT_PALETTE); v8 = window_SpeakInHouse; - ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; + ItemsInShopTexture[i] = &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]) + pParty->field_3C.field_50[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 * (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; diff -r 863de6ec906b -r f47eab1a70d8 UI/UiGame.cpp --- a/UI/UiGame.cpp Thu Sep 05 13:31:15 2013 +0600 +++ b/UI/UiGame.cpp Thu Sep 05 18:05:50 2013 +0600 @@ -1252,7 +1252,7 @@ //For Decorations---------------------------------- if (PID_TYPE(v18) == OBJECT_Decoration) { - if ( !pLevelDecorations[v19].field_16_event_id ) + if ( !pLevelDecorations[v19].uEventID ) { if ( pLevelDecorations[v19].IsInteractive() ) pText = pNPCTopics[stru_5E4C90._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 379].pTopic; @@ -1270,7 +1270,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - if ( !GetEventHintString(pLevelDecorations[v19].field_16_event_id) ) + if ( !GetEventHintString(pLevelDecorations[v19].uEventID) ) { if ( pMouse->uPointingObjectID == 0 ) { @@ -1283,7 +1283,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - GameUI_SetFooterString(GetEventHintString(pLevelDecorations[v19].field_16_event_id)); + GameUI_SetFooterString(GetEventHintString(pLevelDecorations[v19].uEventID)); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 )