annotate GUI/UI/UIQuickReference.cpp @ 2551:4008b2f34be0

MainMenu rendering moved from event loop to respective window class
author a.parshin
date Tue, 12 May 2015 12:03:30 +0200
parents fed97f15d1e1
children 0c67be4ec900
rev   line source
2547
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
1 #include "Engine/Engine.h"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
2 #include "Engine/Timer.h"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
3 #include "Engine/LOD.h"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
4 #include "Engine/texts.h"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
5 #include "Engine/Party.h"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
6 #include "Engine/Graphics/IRender.h"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
7
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
8 #include "GUI/GUIFont.h"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
9 #include "GUI/UI/UIQuickReference.h"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
10
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
11 #include "Media/Audio/AudioPlayer.h"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
12
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
13 GUIWindow_QuickReference::GUIWindow_QuickReference() :
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
14 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 5, 0)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
15 {
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
16 // 004304E7 Game_EventLoop --- part
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
17 pEventTimer->Pause();
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
18 pAudioPlayer->StopChannels(-1, -1);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
19 current_screen_type = SCREEN_QUICK_REFERENCE;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
20 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
21 pBtn_ExitCancel = CreateButton(
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
22 0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0,
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
23 pGlobalTXT_LocalizationStrings[79],// "Exit"
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
24 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2),
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
25 0
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
26 ); //, v179);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
27 }
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
28
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
29 void GUIWindow_QuickReference::Update()
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
30 {
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
31 // -----------------------------------
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
32 // 004156F0 GUI_UpdateWindows --- part
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
33 // {
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
34 // GameUI_QuickRef_Draw();
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
35 // }
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
36
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
37 //----- (0041A57E) --------------------------------------------------------
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
38 //void GameUI_QuickRef_Draw()
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
39
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
40 unsigned int pTextColor; // eax@7
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
41 unsigned int pX; // [sp+14h] [bp-18h]@2
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
42 unsigned int pY; // edi@9
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
43 int pSkillsCount; // ecx@27
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
44 const char *pText; // eax@38
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
45 int pFontHeight; // [sp+18h] [bp-14h]@1
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
46
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
47 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
48 pFontHeight = LOBYTE(pFontArrus->uFontHeight) + 1;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
49 for (uint i = 0; i < 4; ++i)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
50 {
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
51 Player* player = &pParty->pPlayers[i];
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
52 pX = 94 * i + 89;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
53 if (i == 0)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
54 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 18, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
55 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * i + 89, 18, ui_character_header_text_color, player->pName, 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
56 if (i == 0)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
57 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 47, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //Уров.
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
58 sprintf(pTmpBuf.data(), "%lu", player->GetActualLevel());
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
59 if (player->GetActualLevel() <= player->GetBaseLevel())
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
60 pTextColor = player->GetExperienceDisplayColor();
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
61 else
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
62 pTextColor = ui_character_bonus_text_color;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
63 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, 47, pTextColor, pTmpBuf.data(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
64 pY = pFontHeight + 47;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
65 if (i == 0)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
66 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pFontHeight + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);//Класс
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
67 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pClassNames[player->classType], 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
68 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
69 if (i == 0)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
70 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//Здор.
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
71 sprintf(pTmpBuf.data(), "%d", player->sHealth);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
72 pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth());
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
73 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
74 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
75 if (i == 0)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
76 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);//Мана
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
77 sprintf(pTmpBuf.data(), "%d", player->sMana);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
78 pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana());
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
79 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
80 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
81 if (i == 0)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
82 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);//Класс брони
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
83 sprintf(pTmpBuf.data(), "%d", player->GetActualAC());
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
84 pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAC(), player->GetBaseAC());
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
85 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
86 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
87 if (!i)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
88 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Атака
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
89 sprintf(pTmpBuf.data(), "%+d", player->GetActualAttack(false));
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
90 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
91 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
92 if (!i)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
93 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр.
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
94 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetMeleeDamageString(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
95 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
96 if (!i)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
97 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Стрелять
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
98 sprintf(pTmpBuf.data(), "%+d", player->GetRangedAttack());
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
99 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
100 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
101 if (!i)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
102 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр.
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
103 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetRangedDamageString(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
104 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
105 if (!i)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
106 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Навыки
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
107 pSkillsCount = 0;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
108 for (uint j = 0; j <= 36; ++j)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
109 {
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
110 if (player->pActiveSkills[j])
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
111 ++pSkillsCount;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
112 }
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
113 sprintf(pTmpBuf.data(), "%lu", pSkillsCount);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
114 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
115 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
116 if (!i)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
117 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Очки
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
118 sprintf(pTmpBuf.data(), "%lu", player->uSkillPoints);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
119 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf.data(), 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
120 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
121 if (!i)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
122 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Сост.
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
123 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, aCharacterConditionNames[player->GetMajorConditionIdx()], 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
124 pY = pFontHeight + pY;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
125 if (!i)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
126 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Б.Прим.
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
127 if (player->uQuickSpell)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
128 pText = pSpellStats->pInfos[player->uQuickSpell].pShortName;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
129 else
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
130 pText = pGlobalTXT_LocalizationStrings[153];//Нет
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
131 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pText, 84, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
132 }
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
133
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
134 if (pParty->GetPartyReputation() >= 0)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
135 {
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
136 if (pParty->GetPartyReputation() <= 5)
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
137 pTextColor = ui_character_default_text_color;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
138 else
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
139 pTextColor = ui_character_bonus_text_color_neg;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
140 }
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
141 else
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
142 pTextColor = ui_character_bonus_text_color;
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
143
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
144 sprintf(pTmpBuf.data(), "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], pTextColor, GetReputationString(pParty->GetPartyReputation()));//Reputation
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
145 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf.data(), 0, 0, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
146 sprintf(pTmpBuf.data(), "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame Слава
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
147 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf.data(), 0, 0, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents:
diff changeset
148 }