view UISaveLoad.cpp @ 1033:3a5c8df8381d

* UI cleans and moves * Deleted many junk global variables.
author Nomad
date Tue, 21 May 2013 23:44:51 +0200
parents c45d51b3f4f4
children 39f42990698f
line wrap: on
line source

#include <assert.h>
#include <io.h>
#include "MM7.h"

#include "Mouse.h"
#include "Keyboard.h"

#include "MapInfo.h"
#include "Game.h"
#include "GUIWindow.h"
#include "GUIFont.h"
#include "GUIProgressBar.h"
#include "Party.h"
#include "AudioPlayer.h"
#include "Outdoor.h"
#include "IndoorCamera.h"
#include "Overlays.h"
#include "Monsters.h"
#include "Arcomage.h"
#include "LOD.h"
#include "Actor.h"
#include "Allocator.h"
#include "Events.h"
#include "Viewport.h"
#include "FrameTableInc.h"
#include "Math.h"
#include "SpriteObject.h"
#include "ObjectList.h"
#include "Chest.h"
#include "PaletteManager.h"
#include "DecorationList.h"
#include "SaveLoad.h"
#include "stru123.h"
#include "Time.h"
#include "IconFrameTable.h"
#include "Awards.h"
#include "Autonotes.h"
#include "stru160.h"
#include "TurnEngine.h"
#include "CastSpellInfo.h"
#include "Weather.h"
#include "stru298.h"
#include "StorylineTextTable.h"
#include "Events2D.h"
#include "texts.h"

#include "mm7_data.h"


//----- (004601B7) --------------------------------------------------------
static void UI_DrawSaveLoad(bool save)
{
  unsigned __int16 v1; // bx@1
  unsigned int v2; // edi@4
  unsigned int v3; // eax@4
  unsigned int v4; // eax@8
  int v5; // edi@8
  unsigned int v6; // eax@8
  unsigned int pMapID; // eax@10
  signed __int64 v8; // qax@10
  unsigned int v9; // ebx@10
  unsigned __int64 v10; // qax@10
  __int64 v11; // qax@10
  char v12; // di@10
  unsigned __int64 v13; // qtt@10
  unsigned int v14; // ecx@10
  __int64 pOurHour; // qax@10
  int v16; // edi@10
  signed int pHour; // ebx@22
  //const char *v18; // ST14_4@32
  int v19; // eax@32
  const char *v20; // ST18_4@32
  int v21; // eax@32
  //const char *v22; // ST14_4@32
  int v23; // eax@32
  const char *pSlotName; // edi@36
  int v25; // eax@43
  GUIWindow pWindow; // [sp+Ch] [bp-78h]@8
  /*unsigned int Dst; // [sp+Ch] [bp-78h]@8
  unsigned int v27; // [sp+10h] [bp-74h]@8
  int v28; // [sp+14h] [bp-70h]@8
  int v29; // [sp+18h] [bp-6Ch]@8
  unsigned int v30; // [sp+1Ch] [bp-68h]@8
  unsigned int v31; // [sp+20h] [bp-64h]@8*/
  int pMinutes; // [sp+60h] [bp-24h]@10
  int pMonthNum; // [sp+68h] [bp-1Ch]@10
  unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10
  __int64 pAMPM2; // [sp+74h] [bp-10h]@10
  int pYear; // [sp+7Ch] [bp-8h]@10
  //int a4; // [sp+80h] [bp-4h]@1
  int pFilesID;

  v1 = 255;
  TargetColor(0xFF, 0xFF, 0xFF);
  TargetColor(0xFF, 0xFF, 0x9B);
  pRenderer->BeginScene();
  if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu )
  {
    pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave));
    if (save)
    {
      v2 = uTextureID_save_up;
      v3 = uTextureID_LS_saveU;
    }
    else
    {
      v2 = uTextureID_load_up;
      v3 = uTextureID_LS_loadU;
    }
    pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v3));
    pRenderer->DrawTextureIndexed (18, 139, pIcons_LOD->GetTexture(v2));
    pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u));
    v1 = 255;
  }
  if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
  {
    memset(&pWindow, 0, 0x54);
    pWindow.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240;
    v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight;
    pWindow.uFrameWidth = 220;
    v4 += 157;
    pWindow.uFrameY = v4;
    v5 = pFontSmallnum->uFontHeight;
    pWindow.uFrameZ = pWindow.uFrameX + 219;
    pWindow.uFrameHeight = v5;
    pWindow.uFrameW = v5 + v4 - 1;
    v6 = uLoadGameUI_SelectedSlot;
    if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels)
    {
      pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, pSavegameThumbnails + uLoadGameUI_SelectedSlot);
      v6 = uLoadGameUI_SelectedSlot;
    }
    pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName);
    pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapID].pName, 3);
    v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60;
    pMinutes = (int)(((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32);
    v9 = v8;
    v8 /= 60i64;
    pAMPM2 = v8;
    v10 = (unsigned int)v8 / 24;
    pSaveFiles = v10;
    v11 = (unsigned int)(v10 / 7);
    v12 = v11;
    LODWORD(v13) = (unsigned int)v11 >> 2;
    HIDWORD(v13) = HIDWORD(v11);
    pMonthNum = v13 % 12;
    pYear = v13 / 12;
    pMinutes = (int)__PAIR__(pMinutes, v9) % 60;
    pOurHour = pAMPM2 % 24;
    v14 = (unsigned __int64)(pAMPM2 % 24) >> 32;
    LODWORD(pAMPM2) = pAMPM2 % 24;
    HIDWORD(pOurHour) = pSaveFiles % 28;
    pYear += game_starting_year;
    v16 = v12 & 3;
    pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261;
    HIDWORD(pAMPM2) = v14 == 0 && ((signed int)v14 > 0 || (unsigned int)pOurHour >= 12)
                && (signed int)v14 <= 0 && (v14 != 0 || (unsigned int)pOurHour < 24);
    if ( v14  != 0 || ((signed int)v14 <= 0) && (unsigned int)pOurHour <= 12 )
    {
      if ( !(v14 | (unsigned int)pOurHour) )
      {
        pSaveFiles = 0;
        pHour = 12;
        goto LABEL_23;
      }
    }
    else
    {
      v14 = (__PAIR__(v14, (unsigned int)pOurHour) - 12) >> 32;
      LODWORD(pOurHour) = pOurHour - 12;
    }
    pHour = pOurHour;
    pSaveFiles = v14;
LABEL_23:
    auto day = aDayNames[HIDWORD(pOurHour) % 7];
    auto ampm = aAMPMNames[HIDWORD(pAMPM2)];
    auto month = aMonthNames[pMonthNum];
    //sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID);
    sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear);
    pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf, 3u);
    v1 = 255;
  }
  if ( pGUIWindow_CurrentMenu->field_40 == 2 )
  {
    pGUIWindow_CurrentMenu->field_40 = 0;
    strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer);
    /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
    {
      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_SaveGame;
      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
      *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
      ++pMessageQueue_50CBD0->uNumMessages;
    }*/
    pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0);
  }
  else
  {
    if ( pGUIWindow_CurrentMenu->field_40 == 3 )
      pGUIWindow_CurrentMenu->field_40 = 0;
  }
  if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
  {
    //v18 = pGlobalTXT_LocalizationStrings[135];
    v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Загрузка"
    pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);
    v20 = (const char *)(pSavegameHeader + uLoadGameUI_SelectedSlot);
    v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
    pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0);
    //v22 = pGlobalTXT_LocalizationStrings[165];
    v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//"Пожалуйста, пожождите"
    pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v23 + 25, 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);
  }
  else
  {
    if ( save )
      pSaveFiles = 40;
    else
      pSaveFiles = uNumSavegameFiles;
    int a4 = 199;
    pFilesID = pSaveListPosition;
    pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot
    do
    {
      if ( pFilesID >= (signed int)pSaveFiles )
        break;
      short clr;
      HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? TargetColor(v1, v1, 0x64) : 0);
      if ( pGUIWindow_CurrentMenu->field_40 != 1 || pFilesID != uLoadGameUI_SelectedSlot )
      {
        pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0);
      }
      else
      {
        v25 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1);
        pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum);
      }
      a4 += 21;
      ++pFilesID;
      pSlotName += 100;
    }
    while ( a4 < 346 );
  }
  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)
{
    unsigned int v1; // ebp@5
    unsigned int v2; // eax@5
    //signed int v3; // ebp@11
    FILE *v4; // eax@14
    FILE *v5; // eax@18
    unsigned int v6; // eax@25
    GUIButton *v7; // eax@27
    const char *v8; // [sp-8h] [bp-26Ch]@25
    //char *v9; // [sp-4h] [bp-268h]@19
    enum TEXTURE_TYPE v10; // [sp-4h] [bp-268h]@25
    unsigned int uDialogueType_; // [sp+10h] [bp-254h]@1
    //RGBTexture *pTex; // [sp+10h] [bp-254h]@12
    //SavegameHeader *Dest; // [sp+14h] [bp-250h]@12
    //const char *Str1; // [sp+18h] [bp-24Ch]@12
    LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1
    int v16; // [sp+260h] [bp-4h]@1

    uDialogueType_ = uDialogueType;
    dword_6BE138 = -1;
    pIcons_LOD->_inlined_sub2();

    memset(pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
    memset(pSavegameThumbnails, 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 ( pCurrentScreen == SCREEN_SAVEGAME )
            {
            v1 = uTextureID_save_up;
            v2 = uTextureID_LS_saveU;
            }
        else
            {
            v1 = uTextureID_load_up;
            v2 = uTextureID_LS_loadU;
            }
        pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v2));
        pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(v1));
        pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u));
        }
    else
        {
        pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
        }
    pGUIWindow_CurrentMenu = GUIWindow::Create(saveload_dlg_xs[uDialogueType_], saveload_dlg_ys[uDialogueType_], saveload_dlg_zs[uDialogueType_],
        saveload_dlg_ws[uDialogueType_], WINDOW_MainMenu_Load, 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(0x12C, 0);
    assert(sizeof(SavegameHeader) == 0x64);
    //v3 = 0;
    for (uint i = 0; i < uNumSavegameFiles; ++i)
        {

        sprintf(pTmpBuf, "saves\\%s", pSavegameList->pFileList[i].pSaveFileName);
        if (_access(pTmpBuf, 6))
            {
            pSavegameUsedSlots[i] = 0;
            strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty"
            continue;
            }
        pLODFile.LoadFile(pTmpBuf, 1);
        v4 = pLODFile.FindContainer("header.bin", true);
        if ( v4 )
            fread(&pSavegameHeader[i], 0x64, 1, v4);
        if ( !_strcmpi(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7"
            strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave"
        v5 = pLODFile.FindContainer("image.pcx", true);
        if ( !v5 )
            {
            pSavegameUsedSlots[i] = 0;
            strcpy(pSavegameList->pFileList[i].pSaveFileName, "");
            }
        else
            {
            pSavegameThumbnails[i].LoadFromFILE(v5, 0, true);
            pLODFile.CloseWriteFile();
            pSavegameUsedSlots[i] = 1;
            }
        }

    //LABEL_24:
    pLODFile.FreeSubIndexAndIO();
    if ( pCurrentScreen == 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) --------------------------------------------------------
void SaveUI_Load()
{
    unsigned int v0; // ebp@4
    unsigned int v1; // eax@4
    char *v3; // eax@7
    FILE *v4; // eax@11
    FILE *v5; // eax@11
    LODWriteableFile v11; // [sp+1Ch] [bp-248h]@1

    ++pIcons_LOD->uTexturePacksCount;
    if ( !pIcons_LOD->uNumPrevLoadedFiles )
        pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
    memset(pSavegameUsedSlots, 0, 0xB4u);
    memset(&pSavegameThumbnails, 0, 0x708u);
    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 ( pCurrentScreen == SCREEN_SAVEGAME )
    {
        v0 = uTextureID_save_up;
        v1 = uTextureID_LS_saveU;
        }
    else
    {
        v0 = uTextureID_load_up;
        v1 = uTextureID_LS_loadU;
        }
    pRenderer->DrawTextureIndexed(0xF1u, 0x12Eu, pIcons_LOD->GetTexture(v1));
    pRenderer->DrawTextureIndexed(0x15Fu, 0x12Eu, pIcons_LOD->GetTexture(uTextureID_x_u));
    pRenderer->DrawTextureIndexed(0x12u, 0x8Du, pIcons_LOD->GetTexture(v0));
    pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);
    pRenderer->Present();
    pSavegameList->Initialize(1u);
    v11.AllocSubIndicesAndIO(0x12Cu, 0);
    //v2 = pSavegameUsedSlots;
    // Dest = pSavegameHeader;
    // this_ = pSavegameThumbnails;
    // v8 = (char *)pSavegameList->pSavesNames;
    for (uint i = 0; i < 40; ++i)
        {
        v3 = pSavegameList->pFileList[i].pSaveFileName;
        if ( !*pSavegameList->pFileList[i].pSaveFileName )
            v3 = "1.mm7";
        sprintf(pTmpBuf, "saves\\%s", v3);
        if ( _access(pTmpBuf, 0) || _access(pTmpBuf, 6) )
            {
            pSavegameUsedSlots[i] = 0;
            strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]);
            }
        else
            {
            v11.LoadFile(pTmpBuf, 1);
            v4 = v11.FindContainer("header.bin", 1);
            fread(&pSavegameHeader[i], 100, 1u, v4);
            v5 = v11.FindContainer("image.pcx", 1);
            if ( v5 )
                {
                pSavegameThumbnails[i].LoadFromFILE(v5, 0, 1u);
                v11.CloseWriteFile();
                pSavegameUsedSlots[i] = 1;
                }
            else
                {
                pSavegameUsedSlots[i] = 0;
                }
            }

        }

    v11.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);
    pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SaveLoadButtons, 0, 0);
    pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
    pGUIWindow_CurrentMenu->CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0);
    pGUIWindow_CurrentMenu->CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0);
    pGUIWindow_CurrentMenu->CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0);
    pGUIWindow_CurrentMenu->CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0);
    pGUIWindow_CurrentMenu->CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0);
    pGUIWindow_CurrentMenu->CreateButton(21, 318, 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, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0);
}