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

#include <UISaveLoad.h>

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

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

 GUIWindow_Save ()
 
virtual ~GUIWindow_Save ()
 
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 ()
 

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

Imagesaveload_ui_save_up
 
Imagesaveload_ui_loadsave
 
Imagesaveload_ui_saveu
 
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 строка 5

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

◆ GUIWindow_Save()

GUIWindow_Save::GUIWindow_Save ( )

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

35  :
36  GUIWindow(WINDOW_Save, 0, 0, window->GetWidth(), window->GetHeight(), 0) {
37  memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
38  memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails));
39 
40  saveload_ui_loadsave = assets->GetImage_ColorKey("loadsave", 0x7FF);
41  saveload_ui_save_up = assets->GetImage_ColorKey("save_up", 0x7FF);
42  saveload_ui_saveu = assets->GetImage_ColorKey("LS_saveU", 0x7FF);
43  saveload_ui_x_u = assets->GetImage_ColorKey("x_u", 0x7FF);
44 
46 
49 
50  LOD::File pLODFile;
51  for (uint i = 0; i < MAX_SAVE_SLOTS; ++i) {
52  // String file_name = pSavegameList->pFileList[i];
53  String file_name = StringPrintf("save%03d.mm7", i);
54  if (file_name.empty()) {
55  file_name = "1.mm7";
56  }
57 
58  String str = "saves\\" + file_name;
59  str = MakeDataPath(str.c_str());
60  if (_access(str.c_str(), 0) || _access(str.c_str(), 6)) {
61  pSavegameUsedSlots[i] = 0;
62  strcpy(pSavegameHeader[i].pName, localization->GetString(72)); // Empty
63  } else {
64  pLODFile.Open(str);
65  void *data = pLODFile.LoadRaw("header.bin");
66  memcpy(&pSavegameHeader[i], data, sizeof(SavegameHeader));
67 
68  if (pSavegameHeader[i].pName[0] == '\0') {
69  // blank so add something - suspect quicksaves
70  String newname = pSavegameList->pFileList[i];
71  String test = newname.substr(0, newname.size() - 4);
72  strcpy(pSavegameHeader[i].pName, test.c_str());
73  }
74 
75  pSavegameThumbnails[i] = Image::Create(new PCX_LOD_File_Loader(&pLODFile, "image.pcx"));
76  if (pSavegameThumbnails[i]->GetWidth() == 0) {
77  pSavegameThumbnails[i]->Release();
78  pSavegameThumbnails[i] = nullptr;
79  }
80 
81  if (pSavegameThumbnails[i] != nullptr) {
82  pSavegameUsedSlots[i] = 1;
83  } else {
84  pSavegameUsedSlots[i] = 0;
85  }
86  }
87  }
88 
91  ui_ar_up_dn = assets->GetImage_Alpha("ar_up_dn");
92  ui_ar_dn_dn = assets->GetImage_Alpha("ar_dn_dn");
93 
94  scrollstop = assets->GetImage_ColorKey("con_x", 0x7FF);
95 
96  // GUIWindow_Save c-tor --- part
97  CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "");
98  CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "");
99  CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "");
100  CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "");
101  CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "");
102  CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "");
103  CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "");
104 
105  pBtnLoadSlot = CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", { { saveload_ui_ls_saved } });
106  pBtnCancel = CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", { { saveload_ui_x_d } });
107  pBtnArrowUp = CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", { { ui_ar_up_dn } });
108  pBtnDownArrow = CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, MAX_SAVE_SLOTS, 0, "", { { ui_ar_dn_dn } });
109 }

Перекрестные ссылки assets, Image::Create(), GUIWindow::CreateButton(), AssetsManager::GetImage_Alpha(), AssetsManager::GetImage_ColorKey(), Localization::GetString(), Image::GetWidth(), SavegameList::Initialize(), LOD::File::LoadRaw(), localization, MakeDataPath(), MAX_SAVE_SLOTS, LOD::File::Open(), pBtnArrowUp, pBtnCancel, pBtnDownArrow, pBtnLoadSlot, SavegameList::pFileList, pSavegameHeader, pSavegameList, pSavegameThumbnails, pSavegameUsedSlots, pSaveListPosition, saveload_ui_loadsave, saveload_ui_ls_saved, saveload_ui_save_up, saveload_ui_saveu, saveload_ui_x_d, saveload_ui_x_u, scrollstop, StringPrintf(), ui_ar_dn_dn, ui_ar_up_dn, UIMSG_ArrowUp, UIMSG_Cancel, UIMSG_DownArrow, UIMSG_SaveLoadBtn, UIMSG_SelectLoadSlot и uLoadGameUI_SelectedSlot.

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

◆ ~GUIWindow_Save()

virtual GUIWindow_Save::~GUIWindow_Save ( )
inlinevirtual

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

8 {}

Методы

◆ Update()

void GUIWindow_Save::Update ( )
virtual

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

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

111  {
113  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, saveload_ui_loadsave);
114  render->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, saveload_ui_saveu);
115  render->DrawTextureAlphaNew(18 / 640.0f, 139 / 480.0f, saveload_ui_save_up);
116  render->DrawTextureAlphaNew(351 / 640.0f, 302 / 480.0f, saveload_ui_x_u);
117  }
118  UI_DrawSaveLoad(true);
119 }

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

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

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

◆ saveload_ui_save_up

Image* GUIWindow_Save::saveload_ui_save_up
protected

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

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

◆ saveload_ui_loadsave

Image* GUIWindow_Save::saveload_ui_loadsave
protected

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

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

◆ saveload_ui_saveu

Image* GUIWindow_Save::saveload_ui_saveu
protected

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

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

◆ saveload_ui_x_u

Image* GUIWindow_Save::saveload_ui_x_u
protected

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

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


Объявления и описания членов классов находятся в файлах:
MENU_SAVELOAD
@ MENU_SAVELOAD
Definition: GUIWindow.h:254
uLoadGameUI_SelectedSlot
unsigned int uLoadGameUI_SelectedSlot
Definition: mm7_data.cpp:693
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
GUIWindow_Save::saveload_ui_x_u
Image * saveload_ui_x_u
Definition: UISaveLoad.h:18
pBtnArrowUp
GUIButton * pBtnArrowUp
Definition: GUIButton.cpp:86
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
WINDOW_Save
@ WINDOW_Save
Definition: GUIWindow.h:348
GUIWindow_Save::saveload_ui_loadsave
Image * saveload_ui_loadsave
Definition: UISaveLoad.h:16
GUIWindow::GUIWindow
GUIWindow()
Definition: GUIWindow.cpp:765
localization
Localization * localization
Definition: Localization.cpp:11
GUIWindow_Save::saveload_ui_saveu
Image * saveload_ui_saveu
Definition: UISaveLoad.h:17
scrollstop
Image * scrollstop
Definition: UISaveLoad.cpp:33
pSavegameUsedSlots
std::array< unsigned int, MAX_SAVE_SLOTS > pSavegameUsedSlots
Definition: SaveLoad.cpp:43
GUIWindow_Save::saveload_ui_save_up
Image * saveload_ui_save_up
Definition: UISaveLoad.h:15
GetCurrentMenuID
MENU_STATE GetCurrentMenuID()
Definition: GUIWindow.cpp:133
UIMSG_DownArrow
@ UIMSG_DownArrow
Definition: GUIWindow.h:130
SavegameList::Initialize
static void Initialize()
Definition: SaveLoad.cpp:547
UIMSG_ArrowUp
@ UIMSG_ArrowUp
Definition: GUIWindow.h:129
UI_DrawSaveLoad
static void UI_DrawSaveLoad(bool save)
Definition: UISaveLoad.cpp:231
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
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
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
UIMSG_SaveLoadBtn
@ UIMSG_SaveLoadBtn
Definition: GUIWindow.h:131
saveload_ui_x_d
Image * saveload_ui_x_d
Definition: UISaveLoad.cpp:32
UIMSG_Cancel
@ UIMSG_Cancel
Definition: GUIWindow.h:133
ui_ar_dn_dn
Image * ui_ar_dn_dn
Definition: GUIWindow.cpp:100
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
LOD::File::Open
bool Open(const String &pFilename)
Definition: LOD.cpp:751
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
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
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
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