World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Класс GUIWindow_Rest

#include <UIRest.h>

+ Граф наследования:GUIWindow_Rest:
+ Граф связей класса GUIWindow_Rest:

Открытые члены

 GUIWindow_Rest ()
 
virtual ~GUIWindow_Rest ()
 
virtual void Update ()
 
- Открытые члены унаследованные от GUIWindow
 GUIWindow ()
 
 GUIWindow (WindowType windowType, unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int pButton, const String &hint=String())
 
virtual ~GUIWindow ()
 
GUIButtonCreateButton (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 * >())
 
bool Contains (unsigned int x, unsigned int y)
 
void DrawFlashingInputCursor (int uX, int uY, GUIFont *a2)
 
int DrawTextInRect (GUIFont *font, unsigned int x, unsigned int y, unsigned int color, const char *text, int rect_width, int reverse_text)
 
int DrawTextInRect (GUIFont *font, unsigned int x, unsigned int y, unsigned int color, String &str, int rect_width, int reverse_text)
 
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)
 
void DrawText (GUIFont *font, int x, int y, unsigned short uFontColor, const String &str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
 
void DrawTitleText (GUIFont *font, int horizontal_margin, int vertical_margin, unsigned __int16 uDefaultColor, const char *pInString, int line_spacing)
 
void DrawTitleText (GUIFont *font, int horizontal_margin, int vertical_margin, unsigned __int16 uDefaultColor, const String &str, int line_spacing)
 
void DrawShops_next_generation_time_string (GameTime time)
 
void HouseDialogManager ()
 
void DrawMessageBox (bool inside_game_viewport)
 
GUIButtonGetControl (unsigned int uID)
 
void _41D08F_set_keyboard_control_group (int num_buttons, int a3, int a4, int a5)
 
void _41D73D_draw_buff_tooltip ()
 
virtual void Release ()
 
void DeleteButtons ()
 

Дополнительные унаследованные члены

- Открытые статические члены унаследованные от GUIWindow
static void InitializeGUI ()
 
- Открытые атрибуты унаследованные от GUIWindow
unsigned int uFrameX
 
unsigned int uFrameY
 
unsigned int uFrameWidth
 
unsigned int uFrameHeight
 
unsigned int uFrameZ
 
unsigned int uFrameW
 
WindowType eWindowType
 
union {
   void *   ptr_1C
 
   unsigned int   par1C
 
}; 
 
int field_24
 
int pNumPresenceButton
 
int pCurrentPosActiveItem
 
int field_30
 
int field_34
 
int pStartingPosActiveItem
 
int receives_keyboard_input_2
 
bool receives_keyboard_input
 
String sHint
 
std::vector< GUIButton * > vButtons
 
Mousemouse = nullptr
 
Loglog = nullptr
 

Подробное описание

См. определение в файле UIRest.h строка 5

Конструктор(ы)

◆ GUIWindow_Rest()

GUIWindow_Rest::GUIWindow_Rest ( )

См. определение в файле UIRest.cpp строка 91

92  : GUIWindow(WINDOW_Rest, 0, 0, window->GetWidth(), window->GetHeight(), 0) {
95 
97  rest_ui_restmain = assets->GetImage_Alpha("restmain");
98  rest_ui_btn_1 = assets->GetImage_Alpha("restb1");
99  rest_ui_btn_2 = assets->GetImage_Alpha("restb2");
100  rest_ui_btn_3 = assets->GetImage_Alpha("restb3");
101  rest_ui_btn_4 = assets->GetImage_Alpha("restb4");
102  rest_ui_btn_exit = assets->GetImage_Alpha("restexit");
103 
105 
106  // auto wnd = new GUIWindow_Rest(0, 0, window->GetWidth(),
107  // window->GetHeight());
108  pButton_RestUI_Exit = CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest,
109  0, 0, "", {{rest_ui_btn_exit}});
110  pButton_RestUI_Main = CreateButton(24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour,
111  0, 'R', "", {{rest_ui_btn_4}});
113  CreateButton(61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "",
114  {{rest_ui_btn_1}});
116  61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", {{rest_ui_btn_2}});
118  CreateButton(61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "",
119  {{rest_ui_btn_3}});
120 }

Перекрестные ссылки _507CD4_RestUI_hourglass_anim_controller, assets, GUIWindow::CreateButton(), current_screen_type, AssetsManager::GetImage_Alpha(), OutdoorLocation::LoadActualSkyFrame(), pButton_RestUI_Exit, pButton_RestUI_Main, pButton_RestUI_Wait1Hour, pButton_RestUI_Wait5Minutes, pButton_RestUI_WaitUntilDawn, PrepareToLoadRestUI(), rest_ui_btn_1, rest_ui_btn_2, rest_ui_btn_3, rest_ui_btn_4, rest_ui_btn_exit, rest_ui_restmain, SCREEN_REST, UIMSG_AlreadyResting, UIMSG_ExitRest, UIMSG_Rest8Hour, UIMSG_Wait1Hour и UIMSG_Wait5Minutes.

+ Граф вызовов:

◆ ~GUIWindow_Rest()

virtual GUIWindow_Rest::~GUIWindow_Rest ( )
inlinevirtual

См. определение в файле UIRest.h строка 8

8 {}

Методы

◆ Update()

void GUIWindow_Rest::Update ( )
virtual

Переопределяет метод предка GUIWindow.

См. определение в файле UIRest.cpp строка 123

123  {
124  int live_characters; // esi@1
125  unsigned int v3; // eax@15
126  GUIButton tmp_button; // [sp+8h] [bp-DCh]@19
127  unsigned int am_pm_hours; // [sp+D8h] [bp-Ch]@9
128 
129  live_characters = 0;
130  for (int i = 1; i < 5; ++i)
131  if (!pPlayers[i]->IsDead() && !pPlayers[i]->IsEradicated() &&
132  pPlayers[i]->sHealth > 0)
133  ++live_characters;
134 
135  if (live_characters) {
136  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, rest_ui_restmain);
137  am_pm_hours = pParty->uCurrentHour;
139  if ((signed int)pParty->uCurrentHour <= 12) {
140  if (!am_pm_hours) am_pm_hours = 12;
141  } else {
142  am_pm_hours -= 12;
143  }
144  render->DrawTextureAlphaNew(16 / 640.0f, 26 / 480.0f,
149  }
153  if ((unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512) {
154  v3 = 0;
156  }
158  (int)floorf(((double)v3 / 512.0 * 120.0) + 0.5f) % 256 + 1;
159  if (hourglass_icon_idx >= 120) hourglass_icon_idx = 1;
160 
161  {
163  StringPrintf("hglas%03d", hourglass_icon_idx), 0x7FF);
164  render->DrawTextureAlphaNew(267 / 640.0f, 159 / 480.0f,
166  }
167 
168  tmp_button.uX = 24;
169  tmp_button.uY = 154;
170  tmp_button.uZ = 194;
171  tmp_button.uW = 190;
172  tmp_button.uWidth = 171;
173  tmp_button.uHeight = 37;
175  tmp_button.DrawLabel(localization->GetString(183), pFontCreate,
176  Color16(10, 0, 0),
177  Color16(230, 214, 193)); //Отдых и лечение 8 часов
178  tmp_button.pParent = 0;
179 
180  auto str1 = StringPrintf("\r408%d", uRestUI_FoodRequiredToRest);
181  pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, Color16(10, 0, 0), str1, 0, 0, Color16(230, 214, 193));
182 
183  pButton_RestUI_WaitUntilDawn->DrawLabel(localization->GetString(237), pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193)); // Ждать до рассвета
184  pButton_RestUI_Wait1Hour->DrawLabel(localization->GetString(239), pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193)); // Ждать 1 час
185  pButton_RestUI_Wait5Minutes->DrawLabel(localization->GetString(238), pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193)); // Ждать 5 минут
186  pButton_RestUI_Exit->DrawLabel(localization->GetString(81), pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193)); // Закончить отдыхать
187  tmp_button.uX = 45;
188  tmp_button.uY = 199;
189 
190  tmp_button.uZ = 229;
191  tmp_button.uW = 228;
192 
193  tmp_button.uWidth = 185;
194  tmp_button.uHeight = 30;
195 
197  tmp_button.DrawLabel(localization->GetString(236), pFontCreate,
198  Color16(10, 0, 0),
199  Color16(230, 214, 193)); //Ждать без лечения
200  tmp_button.pParent = 0;
201  auto str2 = StringPrintf(
202  "%d:%02d %s", am_pm_hours, pParty->uCurrentMinute,
204  (pParty->uCurrentHour >= 12 && pParty->uCurrentHour < 24) ? 1
205  : 0));
207  Color16(10, 0, 0), str2, 0, 0,
208  Color16(230, 214, 193));
209  auto str3 = StringPrintf("%s\r190%d", localization->GetString(56),
210  pParty->uCurrentDayOfMonth + 1); //День
212  Color16(10, 0, 0), str3, 0, 0,
213  Color16(230, 214, 193));
214  auto str4 = StringPrintf("%s\r190%d", localization->GetString(146),
215  pParty->uCurrentMonth + 1); //Месяц
217  Color16(10, 0, 0), str4, 0, 0,
218  Color16(230, 214, 193));
219  auto str5 = StringPrintf("%s\r190%d", localization->GetString(245),
220  pParty->uCurrentYear); //Год
222  Color16(10, 0, 0), str5, 0, 0,
223  Color16(230, 214, 193));
225  } else {
227  (int)pButton_RestUI_Exit,
228  localization->GetString(81)); // "Exit Rest"
229  }
230 }

Перекрестные ссылки _506F14_resting_stage, _507CD4_RestUI_hourglass_anim_controller, assets, Color16(), GUIButton::DrawLabel(), GUIWindow::DrawText(), dword_506F1C, Localization::GetAmPm(), AssetsManager::GetImage_ColorKey(), Localization::GetString(), hourglass_icon_idx, localization, pButton_RestUI_Exit, pButton_RestUI_Wait1Hour, pButton_RestUI_Wait5Minutes, pButton_RestUI_WaitUntilDawn, GUIWindow::pCurrentPosActiveItem, pEventTimer, pFontCreate, pGUIWindow_CurrentMenu, GUIButton::pParent, pParty, pPlayers, Image::Release(), render, rest_ui_hourglass_frame_current, rest_ui_restmain, rest_ui_sky_frame_current, Party::Sleep8Hours(), StringPrintf(), Party::uCurrentDayOfMonth, Party::uCurrentHour, Party::uCurrentMinute, Party::uCurrentMonth, Party::uCurrentYear, GUIButton::uHeight, uRestUI_FoodRequiredToRest, Timer::uTimeElapsed, GUIButton::uW, GUIButton::uWidth, GUIButton::uX, GUIButton::uY и GUIButton::uZ.

+ Граф вызовов:

Объявления и описания членов классов находятся в файлах:
pButton_RestUI_Exit
GUIButton * pButton_RestUI_Exit
Definition: GUIButton.cpp:35
pButton_RestUI_Main
GUIButton * pButton_RestUI_Main
Definition: GUIButton.cpp:34
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
rest_ui_btn_exit
Image * rest_ui_btn_exit
Definition: UIRest.cpp:25
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
Timer::uTimeElapsed
unsigned int uTimeElapsed
Definition: Time.h:133
Party::uCurrentMonth
unsigned int uCurrentMonth
Definition: Party.h:272
hourglass_icon_idx
unsigned char hourglass_icon_idx
Definition: mm7_data.cpp:238
WINDOW_Rest
@ WINDOW_Rest
Definition: GUIWindow.h:301
dword_506F1C
int dword_506F1C
Definition: mm7_data.cpp:546
Party::uCurrentMinute
unsigned int uCurrentMinute
Definition: Party.h:276
GUIButton::pParent
GUIWindow * pParent
Definition: GUIButton.h:33
pGUIWindow_CurrentMenu
GUIWindow * pGUIWindow_CurrentMenu
Definition: GUIWindow.cpp:54
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
rest_ui_btn_4
Image * rest_ui_btn_4
Definition: UIRest.cpp:24
GUIButton::uZ
unsigned int uZ
Definition: GUIButton.h:25
GUIWindow::GUIWindow
GUIWindow()
Definition: GUIWindow.cpp:765
localization
Localization * localization
Definition: Localization.cpp:11
Party::uCurrentHour
unsigned int uCurrentHour
Definition: Party.h:275
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
pFontCreate
GUIFont * pFontCreate
Definition: GUIFont.cpp:22
GUIButton
Definition: GUIButton.h:11
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
Party::Sleep8Hours
static void Sleep8Hours()
Definition: Party.cpp:899
_506F14_resting_stage
int _506F14_resting_stage
Definition: mm7_data.cpp:544
rest_ui_restmain
Image * rest_ui_restmain
Definition: UIRest.cpp:29
rest_ui_btn_2
Image * rest_ui_btn_2
Definition: UIRest.cpp:28
rest_ui_hourglass_frame_current
Image * rest_ui_hourglass_frame_current
Definition: UIRest.cpp:32
pParty
Party * pParty
Definition: Party.cpp:30
GUIWindow::pCurrentPosActiveItem
int pCurrentPosActiveItem
Definition: GUIWindow.h:482
pButton_RestUI_Wait1Hour
GUIButton * pButton_RestUI_Wait1Hour
Definition: GUIButton.cpp:38
UIMSG_ExitRest
@ UIMSG_ExitRest
Definition: GUIWindow.h:134
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
UIMSG_AlreadyResting
@ UIMSG_AlreadyResting
Definition: GUIWindow.h:92
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
uRestUI_FoodRequiredToRest
int uRestUI_FoodRequiredToRest
Definition: mm7_data.cpp:543
pButton_RestUI_WaitUntilDawn
GUIButton * pButton_RestUI_WaitUntilDawn
Definition: GUIButton.cpp:37
rest_ui_sky_frame_current
Image * rest_ui_sky_frame_current
Definition: UIRest.cpp:31
GUIButton::uWidth
unsigned int uWidth
Definition: GUIButton.h:23
Localization::GetAmPm
const char * GetAmPm(unsigned int index) const
Definition: Localization.h:79
rest_ui_btn_1
Image * rest_ui_btn_1
Definition: UIRest.cpp:27
GUIButton::uX
unsigned int uX
Definition: GUIButton.h:21
GUIButton::uW
unsigned int uW
Definition: GUIButton.h:26
pButton_RestUI_Wait5Minutes
GUIButton * pButton_RestUI_Wait5Minutes
Definition: GUIButton.cpp:36
PrepareToLoadRestUI
void PrepareToLoadRestUI()
Definition: UIRest.cpp:54
Party::uCurrentDayOfMonth
unsigned int uCurrentDayOfMonth
Definition: Party.h:274
OnCancel
Definition: GUIWindow.h:568
UIMSG_Wait5Minutes
@ UIMSG_Wait5Minutes
Definition: GUIWindow.h:80
UIMSG_Rest8Hour
@ UIMSG_Rest8Hour
Definition: GUIWindow.h:82
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
GUIButton::DrawLabel
void DrawLabel(const String &label_text, GUIFont *pFont, int a5, int uFontShadowColor)
Definition: GUIButton.cpp:104
rest_ui_btn_3
Image * rest_ui_btn_3
Definition: UIRest.cpp:26
UIMSG_Wait1Hour
@ UIMSG_Wait1Hour
Definition: GUIWindow.h:81
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
GUIButton::uY
unsigned int uY
Definition: GUIButton.h:22
GUIButton::uHeight
unsigned int uHeight
Definition: GUIButton.h:24
CURRENT_SCREEN::SCREEN_REST
@ SCREEN_REST
OutdoorLocation::LoadActualSkyFrame
static void LoadActualSkyFrame()
Definition: Outdoor.cpp:2143
_507CD4_RestUI_hourglass_anim_controller
int _507CD4_RestUI_hourglass_anim_controller
Definition: mm7_data.cpp:560
AssetsManager::GetImage_Alpha
Texture * GetImage_Alpha(const String &name)
Definition: AssetsManager.cpp:66
Color16
uint16_t Color16(uint32_t r, uint32_t g, uint32_t b)
Definition: Engine.cpp:148
Party::uCurrentYear
unsigned int uCurrentYear
Definition: Party.h:271
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
pEventTimer
Timer * pEventTimer
Definition: Time.cpp:8
Image::Release
bool Release()
Definition: Image.cpp:335
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52