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

#include <UISaveLoad.h>

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

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

 GUIWindow_Load (bool ingame)
 
virtual ~GUIWindow_Load ()
 
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 ()
 

Защищенные данные

Imagemain_menu_background
 
Imagesaveload_ui_load_up
 
Imagesaveload_ui_loadsave
 
Imagesaveload_ui_loadu
 
Imagesaveload_ui_x_u
 

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

- Открытые статические члены унаследованные от 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
 

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

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

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

◆ GUIWindow_Load()

GUIWindow_Load::GUIWindow_Load ( bool  ingame)
explicit

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

121  :
122  GUIWindow(WINDOW_Load, 0, 0, 0, 0, 0) {
124 
125  dword_6BE138 = -1;
127 
128  memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots));
129  memset(pSavegameThumbnails.data(), 0, MAX_SAVE_SLOTS * sizeof(Image *));
130 
131  saveload_ui_loadsave = assets->GetImage_ColorKey("loadsave", 0x7FF);
132  saveload_ui_load_up = assets->GetImage_ColorKey("load_up", 0x7FF);
133  saveload_ui_loadu = assets->GetImage_ColorKey("LS_loadU", 0x7FF);
134  saveload_ui_x_u = assets->GetImage_ColorKey("x_u", 0x7FF);
135 
136  main_menu_background = nullptr;
137  if (!ingame) {
139  }
140 
141  // GUIWindow::GUIWindow
142  this->uFrameX = saveload_dlg_xs[ingame ? 1 : 0];
143  this->uFrameY = saveload_dlg_ys[ingame ? 1 : 0];
144  this->uFrameWidth = saveload_dlg_zs[ingame ? 1 : 0];
145  this->uFrameHeight = saveload_dlg_ws[ingame ? 1 : 0];
146  this->uFrameZ = uFrameX + uFrameWidth - 1;
147  this->uFrameW = uFrameY + uFrameHeight - 1;
148 
149  DrawText(pFontSmallnum, 25, 199, 0, localization->GetString(505), 0, 0, 0); // "Reading..."
150  render->Present();
151 
153  // if (pSaveListPosition > (int)uNumSavegameFiles) {
154  pSaveListPosition = 0;
156  //}
157  LOD::File pLODFile;
158  Assert(sizeof(SavegameHeader) == 100);
159  for (uint i = 0; i < uNumSavegameFiles; ++i) {
160  String str = "saves\\" + pSavegameList->pFileList[i];
161  str = MakeDataPath(str.c_str());
162  if (_access(str.c_str(), 6)) {
163  pSavegameUsedSlots[i] = 0;
164  strcpy(pSavegameHeader[i].pName, localization->GetString(72)); // "Empty"
165  continue;
166  }
167 
168  if (!pLODFile.Open(str)) __debugbreak();
169  void *data = pLODFile.LoadRaw("header.bin");
170  memcpy(&pSavegameHeader[i], data, sizeof(SavegameHeader));
171  if (!_stricmp(pSavegameList->pFileList[i].c_str(), localization->GetString(613))) { // "AutoSave.MM7"
172  strcpy(pSavegameHeader[i].pName, localization->GetString(16)); // "Autosave"
173  }
174 
175  if (pSavegameHeader[i].pName[0] == '\0') {
176  // blank so add something - suspect quicksaves
177  String newname = pSavegameList->pFileList[i];
178  String test = newname.substr(0, newname.size() - 4);
179  strcpy(pSavegameHeader[i].pName, test.c_str());
180  }
181 
182  pSavegameThumbnails[i] = Image::Create(new PCX_LOD_File_Loader(&pLODFile, "image.pcx"));
183  if (pSavegameThumbnails[i]->GetWidth() == 0) {
184  pSavegameThumbnails[i]->Release();
185  pSavegameThumbnails[i] = nullptr;
186  }
187 
188  pSavegameUsedSlots[i] = 1;
189  if (pSavegameThumbnails[i] != nullptr) {
190  // pSavegameUsedSlots[i] = 1;
191  } else {
192  // pSavegameUsedSlots[i] = 0;
193  // pSavegameList->pFileList[i].clear();
194  }
195  }
196 
199  ui_ar_up_dn = assets->GetImage_Alpha("AR_UP_DN");
200  ui_ar_dn_dn = assets->GetImage_Alpha("AR_DN_DN");
201 
202  scrollstop = assets->GetImage_ColorKey("con_x", 0x7FF);
203 
204  CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "");
205  CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "");
206  CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "");
207  CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "");
208  CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "");
209  CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "");
210  CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "");
211 
212  pBtnLoadSlot = CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", { { saveload_ui_ls_saved } });
213  pBtnCancel = CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", { { saveload_ui_x_d } });
214  pBtnArrowUp = CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", { { ui_ar_up_dn } });
215  pBtnDownArrow = CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", { { ui_ar_dn_dn } });
216 }

Перекрестные ссылки __debugbreak(), LODFile_IconsBitmaps::_inlined_sub2(), assets, Image::Create(), GUIWindow::CreateButton(), current_screen_type, GUIWindow::DrawText(), dword_6BE138, AssetsManager::GetImage_Alpha(), AssetsManager::GetImage_ColorKey(), AssetsManager::GetImage_PCXFromIconsLOD(), Localization::GetString(), Image::GetWidth(), SavegameList::Initialize(), LOD::File::LoadRaw(), localization, main_menu_background, MakeDataPath(), MAX_SAVE_SLOTS, LOD::File::Open(), pBtnArrowUp, pBtnCancel, pBtnDownArrow, pBtnLoadSlot, SavegameList::pFileList, pFontSmallnum, pIcons_LOD, pSavegameHeader, pSavegameList, pSavegameThumbnails, pSavegameUsedSlots, pSaveListPosition, render, saveload_dlg_ws, saveload_dlg_xs, saveload_dlg_ys, saveload_dlg_zs, saveload_ui_load_up, saveload_ui_loadsave, saveload_ui_loadu, saveload_ui_ls_saved, saveload_ui_x_d, saveload_ui_x_u, SCREEN_LOADGAME, scrollstop, GUIWindow::uFrameHeight, GUIWindow::uFrameW, GUIWindow::uFrameWidth, GUIWindow::uFrameX, GUIWindow::uFrameY, GUIWindow::uFrameZ, ui_ar_dn_dn, ui_ar_up_dn, UIMSG_ArrowUp, UIMSG_Cancel, UIMSG_DownArrow, UIMSG_SaveLoadBtn, UIMSG_SelectLoadSlot, uLoadGameUI_SelectedSlot и uNumSavegameFiles.

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

◆ ~GUIWindow_Load()

virtual GUIWindow_Load::~GUIWindow_Load ( )
inlinevirtual

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

24 {}

Методы

◆ Update()

void GUIWindow_Load::Update ( )
virtual

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

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

218  {
219  if (main_menu_background != nullptr) {
220  render->DrawTextureNew(0, 0, main_menu_background);
221  }
223  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, saveload_ui_loadsave);
224  render->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, saveload_ui_loadu);
225  render->DrawTextureAlphaNew(18 / 640.0f, 139 / 480.0f, saveload_ui_load_up);
226  render->DrawTextureAlphaNew(351 / 640.0f, 302 / 480.0f, saveload_ui_x_u);
227  }
228  UI_DrawSaveLoad(false);
229 }

Перекрестные ссылки GetCurrentMenuID(), main_menu_background, MENU_LoadingProcInMainMenu, MENU_SAVELOAD, render, saveload_ui_load_up, saveload_ui_loadsave, saveload_ui_loadu, saveload_ui_x_u и UI_DrawSaveLoad().

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

Данные класса

◆ main_menu_background

Image* GUIWindow_Load::main_menu_background
protected

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

Используется в GUIWindow_Load() и Update().

◆ saveload_ui_load_up

Image* GUIWindow_Load::saveload_ui_load_up
protected

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

Используется в GUIWindow_Load() и Update().

◆ saveload_ui_loadsave

Image* GUIWindow_Load::saveload_ui_loadsave
protected

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

Используется в GUIWindow_Load() и Update().

◆ saveload_ui_loadu

Image* GUIWindow_Load::saveload_ui_loadu
protected

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

Используется в GUIWindow_Load() и Update().

◆ saveload_ui_x_u

Image* GUIWindow_Load::saveload_ui_x_u
protected

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

Используется в GUIWindow_Load() и Update().


Объявления и описания членов классов находятся в файлах:
MENU_SAVELOAD
@ MENU_SAVELOAD
Definition: GUIWindow.h:254
uLoadGameUI_SelectedSlot
unsigned int uLoadGameUI_SelectedSlot
Definition: mm7_data.cpp:693
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
GUIWindow::uFrameW
unsigned int uFrameW
Definition: GUIWindow.h:473
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
pBtnArrowUp
GUIButton * pBtnArrowUp
Definition: GUIButton.cpp:86
GUIWindow_Load::saveload_ui_loadu
Image * saveload_ui_loadu
Definition: UISaveLoad.h:33
pBtnCancel
GUIButton * pBtnCancel
Definition: GUIButton.cpp:87
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
GUIWindow::GUIWindow
GUIWindow()
Definition: GUIWindow.cpp:765
saveload_dlg_ys
std::array< unsigned int, 2 > saveload_dlg_ys
Definition: mm7_data.cpp:202
localization
Localization * localization
Definition: Localization.cpp:11
scrollstop
Image * scrollstop
Definition: UISaveLoad.cpp:33
pSavegameUsedSlots
std::array< unsigned int, MAX_SAVE_SLOTS > pSavegameUsedSlots
Definition: SaveLoad.cpp:43
uNumSavegameFiles
unsigned int uNumSavegameFiles
Definition: SaveLoad.cpp:42
AssetsManager::GetImage_PCXFromIconsLOD
Texture * GetImage_PCXFromIconsLOD(const String &name)
Definition: AssetsManager.cpp:81
GUIWindow::uFrameWidth
unsigned int uFrameWidth
Definition: GUIWindow.h:470
GUIWindow::uFrameZ
unsigned int uFrameZ
Definition: GUIWindow.h:472
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
GetCurrentMenuID
MENU_STATE GetCurrentMenuID()
Definition: GUIWindow.cpp:133
UIMSG_DownArrow
@ UIMSG_DownArrow
Definition: GUIWindow.h:130
WINDOW_Load
@ WINDOW_Load
Definition: GUIWindow.h:349
SavegameList::Initialize
static void Initialize()
Definition: SaveLoad.cpp:547
Image
Definition: Image.h:19
UIMSG_ArrowUp
@ UIMSG_ArrowUp
Definition: GUIWindow.h:129
GUIWindow_Load::saveload_ui_load_up
Image * saveload_ui_load_up
Definition: UISaveLoad.h:31
UI_DrawSaveLoad
static void UI_DrawSaveLoad(bool save)
Definition: UISaveLoad.cpp:231
CURRENT_SCREEN::SCREEN_LOADGAME
@ SCREEN_LOADGAME
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
GUIWindow::uFrameHeight
unsigned int uFrameHeight
Definition: GUIWindow.h:471
pIcons_LOD
LODFile_IconsBitmaps * pIcons_LOD
Definition: LOD.cpp:12
GUIWindow_Load::main_menu_background
Image * main_menu_background
Definition: UISaveLoad.h:29
pSavegameThumbnails
std::array< Image *, MAX_SAVE_SLOTS > pSavegameThumbnails
Definition: SaveLoad.cpp:44
PCX_LOD_File_Loader
Definition: ImageLoader.h:94
pSaveListPosition
int pSaveListPosition
Definition: mm7_data.cpp:692
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
saveload_dlg_zs
std::array< unsigned int, 2 > saveload_dlg_zs
Definition: mm7_data.cpp:203
UIMSG_SaveLoadBtn
@ UIMSG_SaveLoadBtn
Definition: GUIWindow.h:131
saveload_ui_x_d
Image * saveload_ui_x_d
Definition: UISaveLoad.cpp:32
saveload_dlg_xs
std::array< unsigned int, 2 > saveload_dlg_xs
Definition: mm7_data.cpp:201
UIMSG_Cancel
@ UIMSG_Cancel
Definition: GUIWindow.h:133
GUIWindow_Load::saveload_ui_loadsave
Image * saveload_ui_loadsave
Definition: UISaveLoad.h:32
ui_ar_dn_dn
Image * ui_ar_dn_dn
Definition: GUIWindow.cpp:100
GUIWindow::uFrameY
unsigned int uFrameY
Definition: GUIWindow.h:469
saveload_ui_ls_saved
Image * saveload_ui_ls_saved
Definition: UISaveLoad.cpp:31
pBtnLoadSlot
GUIButton * pBtnLoadSlot
Definition: GUIButton.cpp:88
pBtnDownArrow
GUIButton * pBtnDownArrow
Definition: GUIButton.cpp:85
MAX_SAVE_SLOTS
constexpr unsigned int MAX_SAVE_SLOTS
Definition: SaveLoad.h:33
MENU_LoadingProcInMainMenu
@ MENU_LoadingProcInMainMenu
Definition: GUIWindow.h:260
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
MakeDataPath
std::string MakeDataPath(const char *file_rel_path)
Definition: Engine.cpp:126
Image::Create
static Image * Create(unsigned int width, unsigned int height, IMAGE_FORMAT format, const void *pixels=nullptr)
Definition: Image.cpp:243
UIMSG_SelectLoadSlot
@ UIMSG_SelectLoadSlot
Definition: GUIWindow.h:132
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
uint
unsigned int uint
Definition: MM7.h:4
LOD::File
Definition: LOD.h:58
__debugbreak
void __cdecl __debugbreak(void)
LOD::File::Open
bool Open(const String &pFilename)
Definition: LOD.cpp:751
GUIWindow_Load::saveload_ui_x_u
Image * saveload_ui_x_u
Definition: UISaveLoad.h:34
AssetsManager::GetImage_Alpha
Texture * GetImage_Alpha(const String &name)
Definition: AssetsManager.cpp:66
ui_ar_up_dn
Image * ui_ar_up_dn
Definition: GUIWindow.cpp:102
SavegameHeader
Definition: SaveLoad.h:18
GUIWindow::uFrameX
unsigned int uFrameX
Definition: GUIWindow.h:468
dword_6BE138
int dword_6BE138
Definition: mm7_data.cpp:704
LODFile_IconsBitmaps::_inlined_sub2
void _inlined_sub2()
Definition: LOD.cpp:37
SavegameList::pFileList
std::array< String, 45 > pFileList
Definition: SaveLoad.h:13
LOD::File::LoadRaw
void * LoadRaw(const String &pContainer, size_t *data_size=nullptr)
Definition: LOD.cpp:895
String
std::string String
Definition: Strings.h:10
saveload_dlg_ws
std::array< unsigned int, 2 > saveload_dlg_ws
Definition: mm7_data.cpp:204
pFontSmallnum
GUIFont * pFontSmallnum
Definition: GUIFont.cpp:25
pSavegameList
struct SavegameList * pSavegameList
Definition: SaveLoad.cpp:41
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52
pSavegameHeader
std::array< SavegameHeader, MAX_SAVE_SLOTS > pSavegameHeader
Definition: SaveLoad.cpp:45