Mercurial > mm7
diff UiGame.cpp @ 994:3431f6abc786
GameUI clean
author | Nomad |
---|---|
date | Tue, 14 May 2013 12:35:06 +0200 |
parents | 3a3ab572eff5 |
children | 5876a9cafa3e |
line wrap: on
line diff
--- a/UiGame.cpp Mon May 13 22:51:58 2013 +0100 +++ b/UiGame.cpp Tue May 14 12:35:06 2013 +0200 @@ -52,31 +52,31 @@ //----- (0041A57E) -------------------------------------------------------- void GameUI_QuickRef_Draw() { - unsigned int v0; // ebx@1 + //unsigned int v0; // ebx@1 //unsigned int v1; // eax@1 - Player *pPlayer; // ebp@2 - int v3; // eax@6 - int v4; // edi@6 + //Player *pPlayer; // ebp@2 + //int v3; // eax@6 + //int v4; // edi@6 unsigned int v5; // eax@7 unsigned int v6; // edi@9 unsigned int v7; // edi@11 - signed int v8; // eax@13 + //signed int v8; // eax@13 unsigned int v9; // eax@13 unsigned int v10; // edi@13 - int v11; // eax@15 + //int v11; // eax@15 unsigned int v12; // eax@15 unsigned int v13; // edi@15 - int v14; // eax@17 - int v15; // ST18_4@17 - int v16; // ebx@17 - int v17; // eax@17 + //int v14; // eax@17 + //int v15; // ST18_4@17 + //int v16; // ebx@17 + //int v17; // eax@17 unsigned int v18; // eax@17 unsigned int v19; // edi@17 - int v20; // eax@19 + //int v20; // eax@19 unsigned int v21; // edi@19 char *v22; // eax@21 unsigned int v23; // edi@21 - int v24; // eax@23 + //int v24; // eax@23 unsigned int v25; // edi@23 char *v26; // eax@25 unsigned int v27; // edi@25 @@ -88,101 +88,90 @@ const char *v33; // ST10_4@35 unsigned int v34; // eax@35 unsigned int v35; // edi@35 - unsigned __int8 v36; // al@37 + //unsigned __int8 v36; // al@37 char *v37; // eax@38 int v38; // eax@41 signed int v39; // edi@42 - char *v40; // eax@45 - unsigned int v41; // eax@45 + //char *v40; // eax@45 + //unsigned int v41; // eax@45 signed int v43; // [sp+10h] [bp-1Ch]@1 unsigned int v44; // [sp+14h] [bp-18h]@2 int v45; // [sp+18h] [bp-14h]@1 - unsigned int v46; // [sp+1Ch] [bp-10h]@1 - unsigned int v47; // [sp+20h] [bp-Ch]@1 + //unsigned int v46; // [sp+1Ch] [bp-10h]@1 + //unsigned int v47; // [sp+20h] [bp-Ch]@1 unsigned int v48; // [sp+24h] [bp-8h]@33 //unsigned int v49; // [sp+28h] [bp-4h]@1 - v0 = 0; - v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu); + //v0 = 0; + //v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu); //v49 = TargetColor(0xFFu, 0, 0); - v46 = TargetColor(0, 0xFFu, 0); + //v46 = TargetColor(0, 0xFFu, 0); //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); v43 = 0; v45 = LOBYTE(pFontArrus->uFontHeight) + 1; do - { - pPlayer = &pParty->pPlayers[v43]; + { + auto player = &pParty->pPlayers[v43]; v44 = 94 * v43 + 89; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, v0, pGlobalTXT_LocalizationStrings[149], 60, v0);//Name - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, v47, pPlayer->pName, 84, v0); - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, v0, pGlobalTXT_LocalizationStrings[131], 60, v0); //Уров. - v3 = pPlayer->GetActualLevel(); - sprintf(pTmpBuf, "%lu", v3); - v4 = pPlayer->GetBaseLevel(); - if ( pPlayer->GetActualLevel() <= v4 ) - v5 = pPlayer->GetExperienceDisplayColor(); + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, ui_color_text_header, player->pName, 84, 0); + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //Уров. + sprintf(pTmpBuf, "%lu", player->GetActualLevel()); + if ( player->GetActualLevel() <= player->GetBaseLevel()) + v5 = player->GetExperienceDisplayColor(); else - v5 = TargetColor(0, 0xFFu, v0); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, v0); + v5 = ui_color_text_bonus; + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, 0); v6 = v45 + 47; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, v0, pGlobalTXT_LocalizationStrings[41], 60, v0);//Класс - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, v0, pClassNames[pPlayer->classType], 84, v0); + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);//Класс + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, 0, pClassNames[player->classType], 84, 0); v7 = v45 + v6; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, v0, pGlobalTXT_LocalizationStrings[107], 60, v0);//Здор. - sprintf(pTmpBuf, "%d", pPlayer->sHealth); - v8 = pPlayer->GetMaxHealth(); - v9 = UI_GetHealthManaStringColor(pPlayer->sHealth, v8); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, v0); + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//Здор. + sprintf(pTmpBuf, "%d", player->sHealth); + v9 = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, 0); v10 = v45 + v7; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, v0, pGlobalTXT_LocalizationStrings[209], 60, v0);//Мана - sprintf(pTmpBuf, "%d", pPlayer->sMana); - v11 = pPlayer->GetMaxMana(); - v12 = UI_GetHealthManaStringColor(pPlayer->sMana, v11); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, v0); + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);//Мана + sprintf(pTmpBuf, "%d", player->sMana); + v12 = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, 0); v13 = v45 + v10; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, v0, pGlobalTXT_LocalizationStrings[0], 60, v0);//Класс брони - v14 = pPlayer->GetActualAC(); - sprintf(pTmpBuf, "%d", v14); - v15 = v0; - v16 = pPlayer->GetBaseAC(); - v17 = pPlayer->GetActualAC(); - v18 = UI_GetHealthManaStringColor(v17, v16); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, v15); - v0 = 0; + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);//Класс брони + sprintf(pTmpBuf, "%d", player->GetActualAC()); + v18 = UI_GetHealthManaStringColor(player->GetActualAC(), player->GetBaseAC()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, 0); v19 = v45 + v13; if ( !v43 ) pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Атака - v20 = pPlayer->GetActualAttack(0); - sprintf(pTmpBuf, "%+d", v20); + sprintf(pTmpBuf, "%+d", player->GetActualAttack(0)); pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0); v21 = v45 + v19; if ( !v43 ) pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. - v22 = pPlayer->GetMeleeDamageString(); + v22 = player->GetMeleeDamageString(); pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0); v23 = v45 + v21; if ( !v43 ) pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Стрелять - v24 = pPlayer->GetRangedAttack(); - sprintf(pTmpBuf, "%+d", v24); + sprintf(pTmpBuf, "%+d", player->GetRangedAttack()); pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0); v25 = v45 + v23; if ( !v43 ) pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. - v26 = pPlayer->GetRangedDamageString(); + v26 = player->GetRangedDamageString(); pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0); v27 = v45 + v25; if ( !v43 ) pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Навыки v28 = 0; - v29 = (char *)pPlayer->pActiveSkills; + v29 = (char *)player->pActiveSkills; v30 = 36; do { @@ -197,10 +186,10 @@ v31 = v45 + v27; if ( !v43 ) pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Очки - sprintf(pTmpBuf, "%lu", pPlayer->uSkillPoints); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, pPlayer->uSkillPoints != 0 ? v46 : 0, pTmpBuf, 84, 0); + sprintf(pTmpBuf, "%lu", player->uSkillPoints); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, player->uSkillPoints ? ui_color_text_bonus : ui_color_text_default, pTmpBuf, 84, 0); v32 = v45 + v31; - v48 = pPlayer->GetMajorConditionIdx(); + v48 = player->GetMajorConditionIdx(); if ( !v43 ) pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Сост. v33 = aCharacterConditionNames[v48]; @@ -209,9 +198,8 @@ v35 = v45 + v32; if ( !v43 ) pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Б.Прим. - v36 = pPlayer->uQuickSpell; - if ( v36 ) - v37 = pSpellStats->pInfos[v36].pShortName; + if (player->uQuickSpell) + v37 = pSpellStats->pInfos[player->uQuickSpell].pShortName; else v37 = pGlobalTXT_LocalizationStrings[153];//Нет pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0); @@ -223,23 +211,24 @@ if ( v38 >= 0 ) { if ( v38 <= 5 ) - v39 = TargetColor(0xFF, 0xFF, 0xFF); + v39 = ui_color_text_default; else - v39 = TargetColor(0xFF, 0, 0); + v39 = ui_color_text_bonus_neg; } else - v39 = v46; + v39 = ui_color_text_bonus; - v40 = GetReputationString(v38); - sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation + sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, GetReputationString(v38));//Reputation pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0); - v41 = pParty->GetPartyFame(); - sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame Слава + + sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame Слава pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0); - } +} + + //----- (0041AD6E) -------------------------------------------------------- -void __cdecl GameUI_DrawRightPanelItems() +void GameUI_DrawRightPanelItems() { if (GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed) GameUI_RightPanel_BookFlashTimer = 0; @@ -247,26 +236,25 @@ if (pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128) { GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed; - byte_50697C = byte_50697C == 0; + + static bool byte_50697C = false; // 50697C + byte_50697C = !byte_50697C; if ( byte_50697C && pCurrentScreen != SCREEN_REST ) { - if ( bFlashQuestBook ) - pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)); - if ( bFlashAutonotesBook ) - pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)); - if ( bFlashHistoryBook ) - pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)); + if (bFlashQuestBook) pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)); + if (bFlashAutonotesBook) pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)); + if (bFlashHistoryBook) pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)); } else { - pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame); - DrawHiredNPCs(); + pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame); + GameUI_DrawHiredNPCs(); } } } //----- (0041AEBB) -------------------------------------------------------- -void __cdecl GameUI_DrawFoodAndGold() +void GameUI_DrawFoodAndGold() { int v2; // esi@2 @@ -280,316 +268,122 @@ } } -//----- (0041AF52) -------------------------------------------------------- -void Actor::DrawHealthBar(Actor *a1, GUIWindow *a2) -{ - unsigned int v2; // eax@1 - GUIWindow *v3; // edi@1 - unsigned int v4; // esi@1 - signed int v5; // ebx@4 - double v6; // st7@5 - unsigned int v7; // eax@6 - unsigned int v8; // ebx@10 - unsigned int v9; // [sp+14h] [bp-Ch]@4 - unsigned int v10; // [sp+1Ch] [bp-4h]@4 - - v2 = a1->pMonsterInfo.uHP; - v3 = a2; - v4 = 25; - if ( (signed int)v2 > 25 ) - { - v4 = 200; - if ( (signed int)v2 < 200 ) - v4 = a1->pMonsterInfo.uHP; - } - v5 = a1->sCurrentHP; - v10 = v4; - v9 = uTextureID_mhp_grn; - if ( v5 < (signed int)v2 ) - { - v6 = (double)(signed int)v2; - v10 = (signed __int64)((double)(signed int)v4 / (double)(signed int)v2 * (double)a1->sCurrentHP); - if ( v5 <= (signed int)(signed __int64)(0.34 * v6) ) - { - v7 = uTextureID_mhp_red; - v9 = v7; - } - else if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) ) - { - v7 = uTextureID_mhp_yel; - v9 = v7; - } - } - v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2; - - pRenderer->SetTextureClipRect(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52); - pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd)); - pRenderer->SetTextureClipRect(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52); - pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 34, pIcons_LOD->GetTexture(v9)); - - pRenderer->ResetTextureClipRect(); - pRenderer->DrawTextureIndexed(v8 - 5, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capl)); - pRenderer->DrawTextureIndexed(v8 + v4, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capr)); -} //----- (0041B0C9) -------------------------------------------------------- -void __cdecl GameUI_DrawLifeManaBars() +void GameUI_DrawLifeManaBars() { - Texture *v0; // ebx@1 - Player *v1; // ecx@2 - float v2; // ST38_4@3 double v3; // st7@3 - signed __int64 v4; // qax@6 - Player *v5; // ecx@24 - float v6; // ST30_4@25 double v7; // st7@25 - bool v8; // ST38_4@27 Texture *v9; // [sp-4h] [bp-30h]@10 Texture *v10; // [sp+Ch] [bp-20h]@1 - Player *v11; // [sp+10h] [bp-1Ch]@2 - int v12; // [sp+10h] [bp-1Ch]@24 - Texture *v13; // [sp+14h] [bp-18h]@1 - Texture *v14; // [sp+18h] [bp-14h]@1 - float v15; // [sp+1Ch] [bp-10h]@1 - signed int v16; // [sp+24h] [bp-8h]@1 - signed int v17; // [sp+28h] [bp-4h]@8 + + + v10 = pIcons_LOD->GetTexture(uTextureID_BarBlue); - v0 = pIcons_LOD->GetTexture(uTextureID_BarGreen); - v14 = pIcons_LOD->GetTexture(uTextureID_BarYellow); - v13 = pIcons_LOD->GetTexture(uTextureID_BarRed); - v16 = 0; - v10 = pIcons_LOD->GetTexture(uTextureID_BarBlue); - v15 = v0->uTextureHeight; - do + for (uint i = 0; i < 4; ++i) { - v1 = &pParty->pPlayers[v16]; - v11 = v1; - if ( v1->sHealth > 0 ) + auto player = pParty->pPlayers + i; + + if (player->sHealth > 0) { - v11 = &pParty->pPlayers[v16]; - v2 = (double)v1->sHealth; - v3 = v2 / (double)v1->GetMaxHealth(); - if( v3 > 0.5 ) - { - if ( v3 > 1.0 ) - v3 = 1.0; - v4 = (signed __int64)((1.0 - v3) * v15); - if ( v16 == 2 || v16 == 3 ) - v17 = 2; - else - v17 = 0; - pRenderer->SetTextureClipRect( - v17 + pHealthBarPos[v16], - v4 + 402, - v17 + pHealthBarPos[v16] + v0->uTextureWidth, - v0->uTextureHeight + 402); - v9 = v0; - } - else if ( v3 > 0.25 ) - { - if ( v16 == 2 || v16 == 3 ) - v17 = 2; - else - v17 = 0; - pRenderer->SetTextureClipRect( - v17 + pHealthBarPos[v16], - (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, - v17 + pHealthBarPos[v16] + v14->uTextureWidth, - v14->uTextureHeight + 402); - v9 = v14; - } - else if ( v3 > 0.0 ) - { - if ( v16 == 2 || v16 == 3 ) - v17 = 2; - else - v17 = 0; - pRenderer->SetTextureClipRect( - v17 + pHealthBarPos[v16], - (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, - v17 + pHealthBarPos[v16] + v13->uTextureWidth, - v13->uTextureHeight + 402); - v9 = v13; - } + int v17 = 0; + if (i == 2 || i == 3) + v17 = 2; + + v3 = (double)player->sHealth / (double)player->GetMaxHealth(); + if( v3 > 0.5 ) + { + if ( v3 > 1.0 ) + v3 = 1.0; + v9 = pIcons_LOD->GetTexture(uTextureID_BarGreen); + } + else if ( v3 > 0.25 ) + v9 = pIcons_LOD->GetTexture(uTextureID_BarYellow); + else if ( v3 > 0.0 ) + v9 = pIcons_LOD->GetTexture(uTextureID_BarRed); + + if( v3 > 0.0 ) { - pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9); + pRenderer->SetTextureClipRect(v17 + pHealthBarPos[i], + (signed __int64)((1.0 - v3) * v9->uTextureHeight) + 402, + v17 + pHealthBarPos[i] + v9->uTextureWidth, + v9->uTextureHeight + 402); + + pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[i], 402, v9); pRenderer->ResetTextureClipRect(); } } - v5 = v11; - v12 = v11->sMana; - if ( v12 > 0 ) + + + if (player->sMana > 0) { - v6 = (double)v12; - v7 = v6 / (double)v5->GetMaxMana(); + v7 = player->sMana / (double)player->GetMaxMana(); if ( v7 > 1.0 ) v7 = 1.0; - v8 = v16 == 2; - pRenderer->SetTextureClipRect( - (v16 == 2) + pManaBarPos[v16], - (unsigned __int64)(signed __int64)((1.0 - v7) * v15) + 402, - v8 + pManaBarPos[v16] + v10->uTextureWidth, - v10->uTextureHeight + 402); - pRenderer->DrawTextureIndexed(v8 + pManaBarPos[v16], 0x192u, v10); + + int v17 = 0; + if (i == 2) + v17 = 1; + + pRenderer->SetTextureClipRect(v17 + pManaBarPos[i], + (signed __int64)((1.0 - v7) * v10->uTextureHeight) + 402, + v17 + pManaBarPos[i] + v10->uTextureWidth, + v10->uTextureHeight + 402); + pRenderer->DrawTextureIndexed(v17 + pManaBarPos[i], 402, v10); pRenderer->ResetTextureClipRect(); } - ++v16; } - while ( v16 < 4 ); } //----- (0041B3B6) -------------------------------------------------------- -void __cdecl draw_right_panel() +void GameUI_DrawRightPanel() { - pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); + pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, + pIcons_LOD->GetTexture(uTextureID_right_panel)); } //----- (0041B3E2) -------------------------------------------------------- -void __cdecl GameUI_DrawRightPanelFrames() +void GameUI_DrawRightPanelFrames() { - pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame); - pRenderer->DrawTextureRGB(0, 8u, pTexture_LeftFrame); - pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame); - pRenderer->DrawTextureRGB(0, 352u, pTexture_BottomFrame); + pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame); + pRenderer->DrawTextureRGB(0, 8, pTexture_LeftFrame); + pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame); + pRenderer->DrawTextureRGB(0, 352, pTexture_BottomFrame); GameUI_DrawFoodAndGold(); GameUI_DrawRightPanelItems(); } -//----- (0041B438) -------------------------------------------------------- -GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) + +//----- (0041C047) -------------------------------------------------------- +void GameUI_Footer_2() { - char v1; // al@1 - int v2; // esi@1 - char v3; // dl@1 - GUIWindow *v4; // ecx@2 - GUIButton *result; // eax@2 - //int v6; // edx@12 - - v1 = toupper(uHotkey); - v2 = uNumVisibleWindows; - v3 = v1; - if ( uNumVisibleWindows >= 0 ) - { - while ( 2 ) - { - v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; - for ( result = v4->pControlsHead; result; result = result->pNext ) - { - if ( result->uHotkey == v3 ) - { - pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - return result; - } - } - if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 & v4->uFrameHeight == 480) ) - { - --v2; - if ( v2 >= 0 ) - continue; - } - break; - } - } - return 0; -} -// 5075E0: using guessed type int pVisibleWindowsIdxs[20]; + char *v1; // edx@2 + int v5; // eax@5 -//----- (0041B4E1) -------------------------------------------------------- -int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) -{ - unsigned __int8 v3; // bl@1 - int result; // eax@1 - int i; // edx@2 - GUIButton *j; // ecx@3 - int k; // edx@7 - GUIButton *l; // ecx@8 - unsigned __int8 v9; // [sp+4h] [bp-8h]@1 - char v10; // [sp+8h] [bp-4h]@1 - - v3 = uNewHotkey; - v10 = toupper(uOldHotkey); - result = toupper(v3); - v9 = result; - if ( bFirstCall ) + pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); + if (GameUI_Footer_TimeLeft) + v1 = GameUI_Footer_TimedString; + else { - for ( i = uNumVisibleWindows; i >= 0; --i ) - { - result = 84 * pVisibleWindowsIdxs[i]; - //for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext ) - for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) - j->field_28 = 0; - } + if (!pFooterString[0]) + return; + v1 = pFooterString; } - for ( k = uNumVisibleWindows; k >= 0; --k ) - { - result = 84 * pVisibleWindowsIdxs[k]; - //for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext ) - for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) - { - LOBYTE(result) = v10; - if ( l->uHotkey == v10 ) - { - if ( !l->field_28 ) - { - LOBYTE(result) = v9; - l->field_28 = 1; - l->uHotkey = v9; - } - } - } - } - return result; + + v5 = pFontLucida->AlignText_Center(450, v1); + pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); } - - -//----- (0041C047) -------------------------------------------------------- -void __cdecl GameUI_Footer_2() - { - unsigned int v0; // eax@1 - char *v1; // edx@2 - unsigned int v2; // ST18_4@5 - const char *v3; // ST0C_4@5 - unsigned int v4; // ST08_4@5 - int v5; // eax@5 - - pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); - if ( GameUI_Footer_TimeLeft ) - { - v1 = GameUI_Footer_TimedString; - } - else - { - if ( !pFooterString[0] ) - return; - v1 = pFooterString; - } - LOWORD(v0) = uGameUIFontShadow; - v2 = v0; - LOWORD(v0) = uGameUIFontMain; - v3 = v1; - v4 = v0; - v5 = pFontLucida->AlignText_Center(0x1C2u, v1); - pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, v4, v3, 0, 0, v2); - } - //----- (0041C0B8) -------------------------------------------------------- -void __thiscall sub_41C0B8_set_status_string(const char *pStr) - { +void GameUI_SetFooterString(const char *pStr) +{ const char *v1; // esi@1 int i; // eax@7 int j; // eax@11 v1 = pStr; - if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(v1, 1u) && (*v1 || GameUI_Footer_TimeLeft) ) + if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(v1, 1) && (*v1 || GameUI_Footer_TimeLeft) ) { if ( GameUI_Footer_TimeLeft ) { @@ -612,7 +406,7 @@ //----- (0041C179) -------------------------------------------------------- void GameUI_Footer() { - unsigned int v0; // ebp@1 + //unsigned int v0; // ebp@1 char *v1; // edi@5 int v2; // eax@5 unsigned int v3; // esi@5 @@ -622,10 +416,9 @@ size_t v7; // eax@10 GUIFont *v8; // ecx@10 char v9; // zf@12 - unsigned int v10; // ST08_4@13 + //unsigned int v10; // ST08_4@13 int v11; // eax@13 - v0 = uGameUIFontShadow; if ( pFooterString[0] || GameUI_Footer_TimeLeft || bForceDrawFooter ) { pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); @@ -659,9 +452,8 @@ bForceDrawFooter = 0; if ( !v9 ) { - v10 = uGameUIFontMain; v11 = pFontLucida->AlignText_Center(v3, v1); - pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, v10, v1, 0, 0, v0); + pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); } } } @@ -784,7 +576,7 @@ //LABEL_93: v26 = v22; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -816,7 +608,7 @@ else v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -846,7 +638,7 @@ //goto LABEL_93; v26 = v22; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -887,7 +679,7 @@ //goto LABEL_93; v26 = v22; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -924,7 +716,7 @@ //goto LABEL_93; v26 = v22; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -992,7 +784,7 @@ } v26 = v28; //LABEL_87: - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); //goto _return; if ( pMouse->uPointingObjectID == 0 ) { @@ -1036,7 +828,7 @@ //LABEL_28: v13 = pButton->pButtonName; //_set_status_and_ret: - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); //LABEL_131: uLastPointedObjectID = 1; return; @@ -1058,7 +850,7 @@ pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); } v13 = pButton->pButtonName; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; //} @@ -1091,7 +883,7 @@ sprintf(Str1, v39, v41); v13 = Str1; //goto _set_status_and_ret; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; } @@ -1146,7 +938,7 @@ pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); //LABEL_49: v17 = pItemGen->GetDisplayName(); - sub_41C0B8_set_status_string(v17); + GameUI_SetFooterString(v17); //LABEL_50: uLastPointedObjectID = 1; //_return: @@ -1181,7 +973,7 @@ pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v14-1]; //goto LABEL_49; v17 = pItemGen->GetDisplayName(); - sub_41C0B8_set_status_string(v17); + GameUI_SetFooterString(v17); uLastPointedObjectID = 1; if ( pMouse->uPointingObjectID == 0 ) { @@ -1214,7 +1006,7 @@ //goto LABEL_28; { v13 = pButton->pButtonName; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; } @@ -1247,7 +1039,7 @@ //goto LABEL_28; v13 = pButton->pButtonName; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; //} @@ -1280,7 +1072,7 @@ sprintf(Str1, v39, v41); v13 = Str1; //goto _set_status_and_ret; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; } @@ -2081,7 +1873,7 @@ //----- (00491F87) -------------------------------------------------------- -void __cdecl DrawHiredNPCs() +void GameUI_DrawHiredNPCs() { //int v6; // eax@15 char v7; // al@17