Mercurial > mm7
diff GUI/UI/UISaveLoad.cpp @ 2547:fed97f15d1e1
* SaveLoad
* QuickReference
* Modal
* Character
author | a.parshin |
---|---|
date | Tue, 12 May 2015 01:45:31 +0200 |
parents | c674d547cc7c |
children | d87bfbd3bb3b |
line wrap: on
line diff
--- a/GUI/UI/UISaveLoad.cpp Mon May 11 17:45:02 2015 +0200 +++ b/GUI/UI/UISaveLoad.cpp Tue May 12 01:45:31 2015 +0200 @@ -1,24 +1,262 @@ #define _CRTDBG_MAP_ALLOC +#define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS #include <io.h> #include "Engine/Engine.h" - -#include "..\../IO/Keyboard.h" +#include "Engine/MapInfo.h" +#include "Engine/Graphics/Render.h" +#include "Engine/LOD.h" +#include "Engine/SaveLoad.h" +#include "Engine/texts.h" -#include "..\../Engine/MapInfo.h" -#include "..\../GUI/GUIWindow.h" -#include "..\../GUI/GUIFont.h" -#include "..\../Engine/Graphics/Render.h" -#include "..\../Engine/LOD.h" -#include "..\../Engine/SaveLoad.h" -#include "..\../Engine/texts.h" +#include "IO/Keyboard.h" + +#include "GUI/GUIFont.h" +#include "GUI/UI/UISaveLoad.h" #include "Game/MainMenu.h" +void UI_DrawSaveLoad(bool save); + + +GUIWindow_Save::GUIWindow_Save() : + GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) +{ + // ------------------------------------------------ + // 0045E93E SaveUI_Load(enum CURRENT_SCREEN screen) + char *v3; // eax@7 + LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 + + ++pIcons_LOD->uTexturePacksCount; + if (!pIcons_LOD->uNumPrevLoadedFiles) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); + memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails)); + uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); + uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); + uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); + uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); + uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); + uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + + //if (screen == SCREEN_SAVEGAME) + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); + } + /*else + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); + }*/ + + //pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...) + pRenderer->Present(); + pSavegameList->Initialize(1); + pLODFile.AllocSubIndicesAndIO(300, 0); + for (uint i = 0; i < 40; ++i) + { + v3 = pSavegameList->pFileList[i].pSaveFileName; + if (!*pSavegameList->pFileList[i].pSaveFileName) + v3 = "1.mm7"; + sprintf(pTmpBuf.data(), "saves\\%s", v3); + if (_access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6)) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); + } + else + { + pLODFile.LoadFile(pTmpBuf.data(), 1); + fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", 1)); + if (pLODFile.FindContainer("image.pcx", 1)) + { + pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", 1), 0, 1); + pLODFile.CloseWriteFile(); + pSavegameUsedSlots[i] = 1; + } + else + pSavegameUsedSlots[i] = 0; + } + } + pLODFile.FreeSubIndexAndIO(); + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); + uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); + uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); + +// ----------------------------- +// GUIWindow_Save c-tor --- part + CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); + CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); + CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); + CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); + CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); + CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); + CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); + pBtnLoadSlot = CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); + pBtnCancel = CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); + pBtnArrowUp = CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); + pBtnDownArrow = CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); +} + + +void GUIWindow_Save::Update() +{ +// ----------------------------------- +// 004156F0 GUI_UpdateWindows --- part +// { +// SaveUI_Draw(); +// } + +// ----- (004606FE) -------------------------------------------------------- +// void SaveUI_Draw() +// { + UI_DrawSaveLoad(true); +} + + + + +GUIWindow_Load::GUIWindow_Load(bool ingame) : + GUIWindow(0, 0, 0, 0, 0, nullptr) +{ +// ----- (0045E361) -------------------------------------------------------- +// void LoadUI_Load(unsigned int uDialogueType) +// { + current_screen_type = SCREEN_LOADGAME; + + LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 + + dword_6BE138 = -1; + pIcons_LOD->_inlined_sub2(); + + memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); + memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture)); + uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); + uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); + uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); + uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); + uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); + uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); + if (ingame) + { + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + if (current_screen_type == SCREEN_SAVEGAME) + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); + } + else + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); + } + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + } + else + pRenderer->DrawTextureNew(0, 0, &main_menu_background); + + + /*pGUIWindow_CurrentMenu = new GUIWindow_Load( + saveload_dlg_xs[uDialogueType], + saveload_dlg_ys[uDialogueType], + saveload_dlg_zs[uDialogueType], + saveload_dlg_ws[uDialogueType], 0, 0);*/ + + // GUIWindow::GUIWindow + this->uFrameX = saveload_dlg_xs[ingame ? 1 : 0]; + this->uFrameY = saveload_dlg_ys[ingame ? 1 : 0]; + this->uFrameWidth = saveload_dlg_zs[ingame ? 1 : 0]; + this->uFrameHeight = saveload_dlg_ws[ingame ? 1 : 0]; + this->uFrameZ = uFrameX + uFrameWidth - 1; + this->uFrameW = uFrameY + uFrameHeight - 1; + + + + DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." + pRenderer->Present(); + pSavegameList->Initialize(0); + if (pSaveListPosition > (signed int)uNumSavegameFiles) + { + pSaveListPosition = 0; + uLoadGameUI_SelectedSlot = 0; + } + pLODFile.AllocSubIndicesAndIO(300, 0); + Assert(sizeof(SavegameHeader) == 100); + for (uint i = 0; i < uNumSavegameFiles; ++i) + { + sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); + if (_access(pTmpBuf.data(), 6)) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" + continue; + } + pLODFile.LoadFile(pTmpBuf.data(), 1); + if (pLODFile.FindContainer("header.bin", true)) + fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", true)); + if (!_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]))// "AutoSave.MM7" + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" + if (!pLODFile.FindContainer("image.pcx", true)) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); + } + else + { + pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", true), 0, true); + pLODFile.CloseWriteFile(); + pSavegameUsedSlots[i] = 1; + } + } + + pLODFile.FreeSubIndexAndIO(); + if (current_screen_type == SCREEN_SAVEGAME) + { + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); + } + else + { + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD", TEXTURE_16BIT_PALETTE); + } + uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); + uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); + CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); + CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); + CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); + CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); + CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); + CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); + CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); + pBtnLoadSlot = CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); + pBtnCancel = CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); + pBtnArrowUp = CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); + pBtnDownArrow = CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); +} + + +void GUIWindow_Load::Update() +{ +// ----------------------------------- +// 004156F0 GUI_UpdateWindows --- part +// { +// LoadUI_Draw(); +// } + +// ----- (004606F7) -------------------------------------------------------- +// void LoadUI_Draw() +// { + UI_DrawSaveLoad(false); +} + //----- (004601B7) -------------------------------------------------------- static void UI_DrawSaveLoad(bool save) @@ -136,196 +374,3 @@ } pRenderer->EndScene(); } -// 6A0C9C: using guessed type int dword_6A0C9C; - -//----- (004606F7) -------------------------------------------------------- -void LoadUI_Draw() -{ - UI_DrawSaveLoad(false); -} - -//----- (004606FE) -------------------------------------------------------- -void SaveUI_Draw() -{ - UI_DrawSaveLoad(true); -} - -//----- (0045E361) -------------------------------------------------------- -void LoadUI_Load(unsigned int uDialogueType) -{ - LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 - - dword_6BE138 = -1; - pIcons_LOD->_inlined_sub2(); - - memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); - memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture)); - uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); - uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); - uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); - uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); - uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); - uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); - if ( uDialogueType ) - { - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if ( current_screen_type == SCREEN_SAVEGAME ) - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); - pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); - } - else - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); - pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); - } - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - } - else - pRenderer->DrawTextureNew(0, 0, &main_menu_background); - pGUIWindow_CurrentMenu = new GUIWindow_Load(saveload_dlg_xs[uDialogueType], saveload_dlg_ys[uDialogueType], saveload_dlg_zs[uDialogueType], - saveload_dlg_ws[uDialogueType], 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." - pRenderer->Present(); - pSavegameList->Initialize(0); - if ( pSaveListPosition > (signed int)uNumSavegameFiles ) - { - pSaveListPosition = 0; - uLoadGameUI_SelectedSlot = 0; - } - pLODFile.AllocSubIndicesAndIO(300, 0); - Assert(sizeof(SavegameHeader) == 100); - for (uint i = 0; i < uNumSavegameFiles; ++i) - { - sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); - if (_access(pTmpBuf.data(), 6)) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" - continue; - } - pLODFile.LoadFile(pTmpBuf.data(), 1); - if ( pLODFile.FindContainer("header.bin", true) ) - fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", true)); - if ( !_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" - if ( !pLODFile.FindContainer("image.pcx", true) ) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); - } - else - { - pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", true), 0, true); - pLODFile.CloseWriteFile(); - pSavegameUsedSlots[i] = 1; - } - } - - pLODFile.FreeSubIndexAndIO(); - if ( current_screen_type == SCREEN_SAVEGAME ) - { - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE); - } - else - { - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE); - } - uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); - uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); - pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); - pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); - pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); - pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); -} - -//----- (0045E93E) -------------------------------------------------------- -GUIWindow *SaveUI_Load(enum CURRENT_SCREEN screen) -{ - char *v3; // eax@7 - LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 - - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); - memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails)); - uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); - uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); - uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); - uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); - uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); - uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if (screen == SCREEN_SAVEGAME) - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); - } - else - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); - } - - //pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...) - pRenderer->Present(); - pSavegameList->Initialize(1); - pLODFile.AllocSubIndicesAndIO(300, 0); - for (uint i = 0; i < 40; ++i) - { - v3 = pSavegameList->pFileList[i].pSaveFileName; - if ( !*pSavegameList->pFileList[i].pSaveFileName ) - v3 = "1.mm7"; - sprintf(pTmpBuf.data(), "saves\\%s", v3); - if ( _access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6) ) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); - } - else - { - pLODFile.LoadFile(pTmpBuf.data(), 1); - fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", 1)); - if ( pLODFile.FindContainer("image.pcx", 1) ) - { - pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", 1), 0, 1); - pLODFile.CloseWriteFile(); - pSavegameUsedSlots[i] = 1; - } - else - pSavegameUsedSlots[i] = 0; - } - } - pLODFile.FreeSubIndexAndIO(); - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); - uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); - uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - - auto wnd = new GUIWindow_Save(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); - wnd->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); - wnd->CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); - wnd->CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); - wnd->CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); - wnd->CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); - wnd->CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); - wnd->CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); - pBtnLoadSlot = wnd->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); - pBtnCancel = wnd->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); - pBtnArrowUp = wnd->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); - pBtnDownArrow = wnd->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); - - return wnd; -} \ No newline at end of file