World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
UIQuickReference.cpp
См. документацию.
1 #include "Engine/AssetsManager.h"
2 #include "Engine/Engine.h"
4 #include "Engine/LOD.h"
5 #include "Engine/Localization.h"
6 #include "Engine/Party.h"
7 #include "Engine/Time.h"
8 
9 #include "GUI/GUIButton.h"
10 #include "GUI/GUIFont.h"
11 #include "GUI/UI/UICharacter.h"
13 
15 #include "Platform/Api.h"
16 
18 
21  // 004304E7 Game_EventLoop --- part
22  pEventTimer->Pause();
23  pAudioPlayer->StopChannels(-1, -1);
25 
26  // paperdoll_dbrds[2] = assets->GetImage_16BitAlpha(L"BUTTEXI1");
27 
30  assets->GetImage_ColorKey("quikref", 0x7FF);
31 
33  CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0,
34  localization->GetString(79), // "Exit"
35  {{ui_buttdesc2}}); //, v179);
36 }
37 
39  // -----------------------------------
40  // 004156F0 GUI_UpdateWindows --- part
41  // {
42  // GameUI_QuickRef_Draw();
43  // }
44 
45  //----- (0041A57E) --------------------------------------------------------
46  // void GameUI_QuickRef_Draw()
47 
48  unsigned int pTextColor; // eax@7
49  unsigned int pX; // [sp+14h] [bp-18h]@2
50  unsigned int pY; // edi@9
51  int pSkillsCount; // ecx@27
52  const char *pText; // eax@38
53  int pFontHeight; // [sp+18h] [bp-14h]@1
54  String pTempString;
55 
56  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f,
58 
59  pFontHeight = pFontArrus->GetHeight() + 1;
60  for (uint i = 0; i < 4; ++i) {
61  Player *player = &pParty->pPlayers[i];
62  pX = 94 * i + 89;
63  if (i == 0)
65  localization->GetString(149),
66  60, 0); // Name
69  player->pName, 84, 0);
70 
71  if (i == 0)
73  localization->GetString(131),
74  60, 0); //Уров.
75  if (player->GetActualLevel() <= player->GetBaseLevel())
76  pTextColor = player->GetExperienceDisplayColor();
77  else
78  pTextColor = ui_character_bonus_text_color;
79  pTempString = StringPrintf("%lu", player->GetActualLevel());
81  pFontArrus, pX, 47, pTextColor,
82  pTempString, 84, 0);
83 
84  pY = pFontHeight + 47;
85  if (i == 0)
87  pFontArrus, 22, pFontHeight + 47, 0,
88  localization->GetString(41), 60, 0); //Класс
90  pFontArrus, pX, pY, 0,
91  localization->GetClassName(player->classType), 84, 0);
92  pY = pFontHeight + pY;
93 
94  if (i == 0)
96  localization->GetString(107),
97  60, 0); //Здор.
99  player->sHealth, player->GetMaxHealth());
100  pTempString = StringPrintf("%d", player->sHealth);
102  pFontArrus, pX, pY, pTextColor, pTempString,
103  84, 0);
104  pY = pFontHeight + pY;
105 
106  if (i == 0)
108  localization->GetString(209),
109  60, 0); //Мана
111  player->sMana, player->GetMaxMana());
112  pTempString = StringPrintf("%d", player->sMana);
114  pFontArrus, pX, pY, pTextColor, pTempString,
115  84, 0);
116  pY = pFontHeight + pY;
117 
118  if (i == 0)
121  60, 0); //Класс брони
123  player->GetActualAC(), player->GetBaseAC());
124  pTempString = StringPrintf("%d", player->GetActualAC());
126  pFontArrus, pX, pY, pTextColor,
127  pTempString, 84, 0);
128  pY = pFontHeight + pY;
129 
130  if (!i)
132  localization->GetString(18),
133  60, 0); //Атака
134  pTempString = StringPrintf("%+d", player->GetActualAttack(false));
136  pFontArrus, pX, pY, 0,
137  pTempString, 84, 0);
138  pY = pFontHeight + pY;
139 
140  if (!i)
142  localization->GetString(66),
143  60, 0); // Damage Повр.
144  pTempString = player->GetMeleeDamageString();
146  pFontArrus, pX, pY, 0, pTempString, 84, 0);
147  pY = pFontHeight + pY;
148 
149  if (!i)
151  localization->GetString(203),
152  60, 0); // Стрелять
153  pTempString = StringPrintf("%+d", player->GetRangedAttack());
155  pFontArrus, pX, pY, 0,
156  pTempString, 84, 0);
157  pY = pFontHeight + pY;
158 
159  if (!i)
161  localization->GetString(66),
162  60, 0); //Повр.
163  pTempString = player->GetRangedDamageString();
165  pFontArrus, pX, pY, 0, pTempString, 84, 0);
166  pY = pFontHeight + pY;
167 
168  if (!i)
170  localization->GetString(205),
171  60, 0); //Навыки
172  pSkillsCount = 0;
173  for (uint j = 0; j <= 36; ++j) {
174  if (player->pActiveSkills[j]) ++pSkillsCount;
175  }
176  pTempString = StringPrintf("%lu", pSkillsCount);
178  pFontArrus, pX, pY, 0, pTempString, 84, 0);
179  pY = pFontHeight + pY;
180 
181  if (!i)
183  localization->GetString(168),
184  60, 0); //Очки
185  pTempString = StringPrintf("%lu", player->uSkillPoints);
187  pFontArrus, pX, pY,
190  pTempString, 84, 0);
191  pY = pFontHeight + pY;
192 
193  if (!i)
195  localization->GetString(45),
196  60, 0); //Сост.
198  pFontArrus, pX, pY, pTextColor,
200  player->GetMajorConditionIdx()),
201  84, 0);
202  pY = pFontHeight + pY;
203 
204  if (!i)
206  localization->GetString(170),
207  60, 0); //Б.Прим.
208  if (player->uQuickSpell)
209  pText = pSpellStats->pInfos[player->uQuickSpell].pShortName;
210  else
211  pText = localization->GetString(153); //Нет
212  pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pText, 84,
213  0);
214  }
215 
216  if (pParty->GetPartyReputation() >= 0) {
217  if (pParty->GetPartyReputation() <= 5)
218  pTextColor = ui_character_default_text_color;
219  else
221  } else {
222  pTextColor = ui_character_bonus_text_color;
223  }
224 
225  auto str1 = StringPrintf("%s: \f%05d%s\f00000",
226  localization->GetString(180), pTextColor,
228  .c_str()); // Reputation
229  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, str1, 0, 0, 0);
230  auto str2 = StringPrintf("\r261%s: %d", localization->GetString(84),
231  pParty->GetPartyFame()); // Fame Слава
232  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, str2, 0, 0, 0);
233 }
Player
Definition: Player.h:401
GUIWindow::DrawText
void DrawText(GUIFont *font, int x, int y, unsigned short uFontColor, const char *str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
Definition: GUIWindow.cpp:694
Player::GetRangedDamageString
String GetRangedDamageString()
Definition: Player.cpp:1441
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
Localization::GetCharacterConditionName
const char * GetCharacterConditionName(unsigned int index) const
Definition: Localization.h:75
UIMSG_Escape
@ UIMSG_Escape
Definition: GUIWindow.h:96
LOD.h
Image::GetHeight
unsigned int GetHeight()
Definition: Image.cpp:230
GUIWindow
Definition: GUIWindow.h:433
Player::GetActualAttack
int GetActualAttack(bool onlyMainHandDmg)
Definition: Player.cpp:1156
pGUIWindow_CurrentMenu
GUIWindow * pGUIWindow_CurrentMenu
Definition: GUIWindow.cpp:54
SpellStats::pInfos
SpellInfo pInfos[100]
Definition: Spells.h:192
GUIWindow::CreateButton
GUIButton * CreateButton(int x, int y, int width, int height, int a6, int a7, UIMessageType msg, unsigned int msg_param, uint8_t hotkey, const String &label, const std::vector< Image * > &textures=std::vector< Image * >())
Definition: GUIWindow.cpp:717
GetReputationString
String GetReputationString(int reputation)
Definition: UIGame.cpp:2360
Player::GetBaseLevel
int GetBaseLevel()
Definition: Player.cpp:1068
localization
Localization * localization
Definition: Localization.cpp:11
CURRENT_SCREEN::SCREEN_QUICK_REFERENCE
@ SCREEN_QUICK_REFERENCE
ui_character_bonus_text_color_neg
unsigned int ui_character_bonus_text_color_neg
Definition: UICharacter.cpp:47
Party::pPlayers
std::array< Player, 4 > pPlayers
Definition: Party.h:310
GUIFont.h
GUIFont::GetHeight
unsigned int GetHeight() const
Definition: GUIFont.cpp:84
Player::GetActualAC
int GetActualAC()
Definition: Player.cpp:2452
Player::uSkillPoints
unsigned int uSkillPoints
Definition: Player.h:765
AssetsManager.h
ui_character_bonus_text_color
unsigned int ui_character_bonus_text_color
Definition: UICharacter.cpp:46
Player::pActiveSkills
std::array< unsigned __int16, 37 > pActiveSkills
Definition: Player.h:711
Player::GetBaseAC
int GetBaseAC()
Definition: Player.cpp:2439
Engine.h
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
Party::GetPartyFame
unsigned int GetPartyFame()
Definition: Party.cpp:302
GUIWindow_QuickReference::Update
virtual void Update()
Definition: UIQuickReference.cpp:38
UI_GetHealthManaAndOtherQualitiesStringColor
unsigned int UI_GetHealthManaAndOtherQualitiesStringColor(int current_pos, int base_pos)
Definition: UIGame.cpp:2307
Localization.h
Image::GetWidth
unsigned int GetWidth()
Definition: Image.cpp:217
GUIButton.h
pBtn_ExitCancel
GUIButton * pBtn_ExitCancel
Definition: GUIButton.cpp:28
pParty
Party * pParty
Definition: Party.cpp:30
Image
Definition: Image.h:19
GUIWindow::DrawTextInRect
int DrawTextInRect(GUIFont *font, unsigned int x, unsigned int y, unsigned int color, const char *text, int rect_width, int reverse_text)
Definition: GUIWindow.cpp:702
GUIWindow_QuickReference::GUIWindow_QuickReference
GUIWindow_QuickReference()
Definition: UIQuickReference.cpp:19
ui_character_default_text_color
unsigned int ui_character_default_text_color
Definition: UICharacter.cpp:43
pFontArrus
GUIFont * pFontArrus
Definition: GUIFont.cpp:18
IRender.h
Player::GetMeleeDamageString
String GetMeleeDamageString()
Definition: Player.cpp:1413
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
AudioPlayer::StopChannels
void StopChannels(int uStartChannel, int uEndChannel)
Definition: AudioPlayer.cpp:331
Party.h
Player::GetMaxMana
int GetMaxMana()
Definition: Player.cpp:2369
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
Player::pName
char pName[16]
Definition: Player.h:637
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
Player::sMana
int sMana
Definition: Player.h:767
WINDOW_QuickReference
@ WINDOW_QuickReference
Definition: GUIWindow.h:299
Timer::Pause
void Pause()
Definition: Time.cpp:19
Player::GetMaxHealth
int GetMaxHealth()
Definition: Player.cpp:2354
pSpellStats
struct SpellStats * pSpellStats
Definition: Spells.cpp:32
Party::GetPartyReputation
int GetPartyReputation()
Definition: Party.cpp:922
AudioPlayer.h
UICharacter.h
ui_game_quickref_background
Image * ui_game_quickref_background
Definition: UIQuickReference.cpp:17
Player::classType
PLAYER_CLASS_TYPE classType
Definition: Player.h:639
Player::GetMajorConditionIdx
unsigned int GetMajorConditionIdx()
Definition: Player.cpp:2614
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
uint
unsigned int uint
Definition: MM7.h:4
ui_character_header_text_color
unsigned int ui_character_header_text_color
Definition: UICharacter.cpp:45
Player::sHealth
int sHealth
Definition: Player.h:766
Player::GetExperienceDisplayColor
unsigned int GetExperienceDisplayColor()
Definition: Player.cpp:1481
Player::GetActualLevel
int GetActualLevel()
Definition: Player.cpp:1073
SpellInfo::pShortName
char * pShortName
Definition: Spells.h:177
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
Localization::GetClassName
const char * GetClassName(unsigned int index) const
Definition: Localization.h:35
Player::uQuickSpell
unsigned __int8 uQuickSpell
Definition: Player.h:774
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
String
std::string String
Definition: Strings.h:10
pEventTimer
Timer * pEventTimer
Definition: Time.cpp:8
Api.h
UIQuickReference.h
Time.h
Player::GetRangedAttack
int GetRangedAttack()
Definition: Player.cpp:1311
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52