changeset 847:e398541aee60

fixed party save position
author Gloval
date Sat, 30 Mar 2013 19:36:05 +0400
parents 39503542470c
children ceef50611567
files Game.cpp GameUIs.cpp SaveLoad.cpp UISaveLoad.cpp
diffstat 4 files changed, 296 insertions(+), 353 deletions(-) [+]
line wrap: on
line diff
--- a/Game.cpp	Fri Mar 29 16:32:02 2013 +0000
+++ b/Game.cpp	Sat Mar 30 19:36:05 2013 +0400
@@ -84,12 +84,13 @@
     if ( pParty->vPosition.x != pParty->vPrevPosition.x | pParty->sRotationY != pParty->sPrevRotationY | pParty->vPosition.y != pParty->vPrevPosition.y 
        | pParty->sRotationX != pParty->sPrevRotationX | pParty->vPosition.z != pParty->vPrevPosition.z | pParty->sEyelevel != pParty->sPrevEyelevel )
       pParty->uFlags |= 2u;
-    pParty->vPrevPosition = pParty->vPosition;
+    pParty->vPrevPosition.x = pParty->vPosition.x;
     pParty->vPrevPosition.y = pParty->vPosition.y;
+    pParty->vPrevPosition.z = pParty->vPosition.z;
     //v0 = &pRenderer;
     pParty->sPrevRotationY = pParty->sRotationY;
-    pParty->vPrevPosition.z = pParty->vPosition.z;
     pParty->sPrevRotationX = pParty->sRotationX;
+
     pParty->sPrevEyelevel = pParty->sEyelevel;
     pRenderer->BeginSceneD3D();
 
--- a/GameUIs.cpp	Fri Mar 29 16:32:02 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-#include <direct.h>
-#include <io.h>
-#include <assert.h>
-
-#include "GUIWindow.h"
-#include "GUIFont.h"
-#include "LOD.h"
-#include "SaveLoad.h"
-#include "Render.h"
-#include "texts.h"
-
-#include "mm7_data.h"
-
-
-//----- (0045E361) --------------------------------------------------------
-void __fastcall GameUI_DrawLoadMenu(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, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
-    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, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
-    pRenderer->DrawTextureIndexed(18, 141, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0));
-    pRenderer->DrawTextureIndexed(351, 302, (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0));
-  }
-  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_LoadSlot, 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, 0x143, 0x11, 0x11, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "",
-         pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0);
-
-}
-
-//----- (0045E93E) --------------------------------------------------------
-void  GameUI_DrawSaveMenu()
-{
-  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( 8u, 8u,
-    (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
-  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, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0));
-  pRenderer->DrawTextureIndexed(0x15Fu, 0x12Eu,
-    (Texture *)(uTextureID_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_u] : 0));
-  pRenderer->DrawTextureIndexed(0x12u, 0x8Du, (Texture *)(v0 != -1 ? (int)&pIcons_LOD->pTextures[v0] : 0));
-  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_17, 0, 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 198u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 218u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 1u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 238u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 2u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 258u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 3u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 278u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 4u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 298u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 5u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 318u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 6u, 0, "", 0);
-  pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0x69u, 0x28u, 1, 0, UIMSG_LoadSlot, 0, 0, "",
-                 (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0), 0);
-  pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(0x15Eu, 0x12Eu, 0x69u, 0x28u, 1, 0, UIMSG_Cancel, 0, 0, "",
-                 (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0), 0);
-  pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0xC7u, 0x11u, 0x11u, 1, 0, UIMSG_ArrowUp, 0, 0, "",
-         (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0);
-  pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0x143u, 0x11u, 0x11u, 1, 0, UIMSG_DownArrow, 0x22u, 0, "",
-         (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0);
-}
\ No newline at end of file
--- a/SaveLoad.cpp	Fri Mar 29 16:32:02 2013 +0000
+++ b/SaveLoad.cpp	Sat Mar 30 19:36:05 2013 +0400
@@ -230,77 +230,31 @@
 //----- (0045F469) --------------------------------------------------------
 void SaveGame( bool IsAutoSAve, bool NotSaveWorld )
     {
-  int result; // eax@1
   unsigned short *pScreenshot; // edi@5
   int text_pos; // eax@6
-  int v5; // eax@6
-  int v6; // eax@6
-  const char *v7; // edi@8
-  FILE *v8; // edi@24
+  FILE *pLLoidFile; // edi@24
   char* compressed_buf; // edi@30
-  void *v10; // esi@31
-  void *v11; // esi@31
-  void *v12; // esi@37
-  void *v13; // esi@37
-  void *v14; // esi@37
-  void *v15; // esi@37
-  void *v16; // esi@37
-  int v17; // esi@37
-  unsigned int v18; // ecx@38
-  unsigned int v19; // esi@39
-  BSPModel *v20; // edx@39
   char *data_write_pos; // esi@41
-  void *v22; // esi@41
-  BSPModel *v23; // eax@42
-  signed int v24; // edi@42
-  unsigned __int8 v25; // zf@43
-  unsigned __int8 v26; // sf@43
-  signed int v27; // edi@47
-  void *v28; // esi@50
-  void *v29; // esi@50
-  void *v30; // esi@50
-  void *v31; // esi@50
-  int v32; // esi@51
-  int v33; // eax@51
-  DWORD v34; // eax@59
-  //std::string v35; // [sp-18h] [bp-288h]@8
-  const char *v36; // [sp-10h] [bp-280h]@6
-  const char *v37; // [sp-Ch] [bp-27Ch]@6
-  unsigned int *v38; // [sp-8h] [bp-278h]@8
-  CHAR Buffer; // [sp+Ch] [bp-264h]@59
+  CHAR Buffer[128]; // [sp+Ch] [bp-264h]@59
   char Dir[255]; // [sp+8Ch] [bp-1E4h]@51
   char Drive[255]; // [sp+ACh] [bp-1C4h]@51
   SavegameHeader save_header; // [sp+CCh] [bp-1A4h]@10
-  //int v43; // [sp+CCh] [bp-1A4h]@10
-  //char Dest[20]; // [sp+E0h] [bp-190h]@10
-  //unsigned __int64 pTimePlayed; // [sp+F4h] [bp-17Ch]@10
   char Filename[255]; // [sp+130h] [bp-140h]@51
   char Ext[255]; // [sp+150h] [bp-120h]@51
-  char v48; // [sp+151h] [bp-11Fh]@51
   char Source[32]; // [sp+170h] [bp-100h]@51
-  char Str[120]; // [sp+190h] [bp-E0h]@8
-  int v51; // [sp+208h] [bp-68h]@2
+  char work_string[120]; // [sp+190h] [bp-E0h]@8
+  int pPositionY; // [sp+208h] [bp-68h]@2
   int pPositionX; // [sp+20Ch] [bp-64h]@2
-  int v53; // [sp+210h] [bp-60h]@2
-  int v54; // [sp+214h] [bp-5Ch]@2
+  int sPRotationY; // [sp+210h] [bp-60h]@2
+  int sPRotationX; // [sp+214h] [bp-5Ch]@2
   ODMHeader odm_data; // [sp+218h] [bp-58h]@30
-  char v56; // [sp+21Ch] [bp-54h]@30
-  char v57; // [sp+21Dh] [bp-53h]@30
-  char v58; // [sp+21Eh] [bp-52h]@30
-  char v59; // [sp+21Fh] [bp-51h]@30
-  int v60; // [sp+220h] [bp-50h]@30
-  int v61; // [sp+224h] [bp-4Ch]@30
-  int v62; // [sp+228h] [bp-48h]@2
+  int res; // [sp+224h] [bp-4Ch]@30
+  int pPositionZ; // [sp+228h] [bp-48h]@2
   LOD::Directory pLodDirectory; // [sp+22Ch] [bp-44h]@2
   size_t Size; // [sp+250h] [bp-20h]@26
-  __int16 *v66; // [sp+254h] [bp-1Ch]@1
   char *uncompressed_buff; // [sp+258h] [bp-18h]@2
-  __int16 *v68; // [sp+25Ch] [bp-14h]@32
   unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23
-  int v70; // [sp+264h] [bp-Ch]@22
-  std::string *v71; // [sp+268h] [bp-8h]@8
-  int a3; // [sp+26Fh] [bp-1h]@8
-  
+ 
   //v66 = a2;
   strcpy(byte_6BE3B0, pCurrentMapName);
   if (!_strcmpi(pCurrentMapName, "d05.blv")) // arena
@@ -309,14 +263,16 @@
   uncompressed_buff = (char*)malloc(1000000);
   pLodDirectory.Reset();
   pPositionX = pParty->vPosition.x;
-  v51 = pParty->vPosition.y;
-  v62 = pParty->vPosition.z;
-  v53 = pParty->sRotationY;
-  v54 = pParty->sRotationX;
+  pPositionY = pParty->vPosition.y;
+  pPositionZ = pParty->vPosition.z;
+  sPRotationY = pParty->sRotationY;
+  sPRotationX = pParty->sRotationX;
   pParty->vPosition.x = pParty->vPrevPosition.x;
-  pParty->vPosition.y = pParty->vPrevPosition.z;
-  pParty->vPosition.z = pParty->vPrevPosition.y;
-  pParty->uFallStartY = pParty->vPrevPosition.y;
+  pParty->vPosition.z = pParty->vPrevPosition.z;
+  pParty->vPosition.y = pParty->vPrevPosition.y;
+
+  pParty->uFallStartY = pParty->vPrevPosition.z;
+
   pParty->sRotationY = pParty->sPrevRotationY;
   pParty->sRotationX = pParty->sPrevRotationX;
   if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
@@ -342,8 +298,8 @@
 
   if (pNew_LOD->Write(&pLodDirectory, uncompressed_buff, 0))
   {
-    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 200); //Сохраненная игра повреждена! Code=%d
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0);
+    sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 200); //Сохраненная игра повреждена! Code=%d
+    MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0);
   }
 
   assert(sizeof(SavegameHeader) == 100);
@@ -356,66 +312,66 @@
   pLodDirectory.uDataSize = sizeof(SavegameHeader);
   if (pNew_LOD->Write(&pLodDirectory, &save_header, 0))
   {
-    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 201);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0);
+    sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 201);
+    MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0);
   }
   strcpy(pLodDirectory.pFilename, "party.bin");
   pLodDirectory.uDataSize = sizeof(Party); //90680;
   if ( pNew_LOD->Write(&pLodDirectory, pParty, 0) )
   {
-    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 202);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0);
+    sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 202);
+    MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0);
   }
   strcpy(pLodDirectory.pFilename, "clock.bin");
   pLodDirectory.uDataSize =sizeof(Timer);// 40;
   if ( pNew_LOD->Write(&pLodDirectory, pEventTimer, 0) )
   {
-    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 203);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0);
+    sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 203);
+    MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0);
   }
   strcpy(pLodDirectory.pFilename, "overlay.bin");
   pLodDirectory.uDataSize =sizeof(OtherOverlayList);// 1008;
   if ( pNew_LOD->Write(&pLodDirectory, pOtherOverlayList, 0) )
   {
-    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 204);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0);
+    sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 204);
+    MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0);
   }
   strcpy(pLodDirectory.pFilename, "npcdata.bin");
   pLodDirectory.uDataSize = 501 * sizeof(NPCData);
   assert(pLodDirectory.uDataSize == 38076);
   if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pNewNPCData, 0) )
   {
-    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 205);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0);
+    sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 205);
+    MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0);
   }
   strcpy(pLodDirectory.pFilename, "npcgroup.bin");
   pLodDirectory.uDataSize = 102;
   if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pGroups_copy, 0) )
   {
-    sprintf(Str, pGlobalTXT_LocalizationStrings[612], 206);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0);
+    sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 206);
+    MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0);
   }
   for (int i =  1; i <= 4; ++i) // 4 - players
   {
     for (int j =  1; j <= 5; ++j) // 5 - images
     {
-      sprintf(Str, "data\\lloyd%d%d.pcx", i, j);
-      v8 = fopen(Str, "rb");
-      if ( v8 )
+      sprintf(work_string, "data\\lloyd%d%d.pcx", i, j);
+      pLLoidFile = fopen(work_string, "rb");
+      if ( pLLoidFile )
       {
         __debugbreak();
-        sprintf(Str, "lloyd%d%d.pcx", i, j);
-        fseek(v8, 0, 2);
-        pLodDirectory.uDataSize = ftell(v8);
-        rewind(v8);
-        fread(uncompressed_buff, pLodDirectory.uDataSize, 1, v8);
-        strcpy((char *)&pLodDirectory, Str);
-        fclose(v8);
-        remove(Str);
+        sprintf(work_string, "lloyd%d%d.pcx", i, j);
+        fseek(pLLoidFile, 0, SEEK_END);
+        pLodDirectory.uDataSize = ftell(pLLoidFile);
+        rewind(pLLoidFile);
+        fread(uncompressed_buff, pLodDirectory.uDataSize, 1, pLLoidFile);
+        strcpy(pLodDirectory.pFilename, work_string);
+        fclose(pLLoidFile);
+        remove(work_string);
         if ( pNew_LOD->Write(&pLodDirectory, uncompressed_buff, 0) )
         {
-          sprintf(Str, pGlobalTXT_LocalizationStrings[612], 207);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0);
+          sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 207);
+          MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0);
           Size = 5080748;
         }
       }
@@ -467,8 +423,8 @@
       data_write_pos += 112 * uNumSpriteObjects;
       memcpy(data_write_pos, &uNumChests, 4);
       data_write_pos += 4;
-      memcpy(data_write_pos, pChests, 5324 * uNumChests);
-      data_write_pos += 5324 * uNumChests;
+      memcpy(data_write_pos, pChests, sizeof(Chest)*uNumChests);//5324 *
+      data_write_pos += sizeof(Chest)* uNumChests;
       memcpy(data_write_pos, pIndoor->pDoors, 0x3E80);
       data_write_pos += 16000;
       memcpy(data_write_pos, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size);
@@ -516,8 +472,8 @@
       data_write_pos += 112 * uNumSpriteObjects;
       memcpy(data_write_pos, &uNumChests, 4);
       data_write_pos += 4;
-      memcpy(data_write_pos, pChests, 5324 * uNumChests);
-      data_write_pos += 5324 * uNumChests;
+      memcpy(data_write_pos, pChests, sizeof(Chest)* uNumChests);
+      data_write_pos += sizeof(Chest)* uNumChests;
       memcpy(data_write_pos, &stru_5E4C90, 0xC8);
       data_write_pos += 200;
       memcpy(data_write_pos, &pOutdoor->loc_time, 0x38);
@@ -525,11 +481,11 @@
     }
     strcpy(Source, pCurrentMapName);
     _splitpath(Source, Drive, Dir, Filename, Ext);
-    v48 = 100;
+   
     Size = (int)data_write_pos - (int)uncompressed_buff;
     compressed_block_size = 999984;
-    LOBYTE(v33) = zlib::MemZip((char *)compressed_buf + 16, (unsigned int *)&compressed_block_size, uncompressed_buff,Size);
-    if ( v33 || (signed int)compressed_block_size > (signed int)Size )
+    res = zlib::MemZip((char *)compressed_buf + 16, (unsigned int *)&compressed_block_size, uncompressed_buff,Size);
+    if (res || (signed int)compressed_block_size > (signed int)Size )
     {
       memcpy((void *)(compressed_buf + 16), uncompressed_buff, Size);
       compressed_block_size = Size;
@@ -538,12 +494,12 @@
     memcpy(&((ODMHeader *)compressed_buf)->uCompressedSize, &compressed_block_size, 4);
     memcpy(&((ODMHeader *)compressed_buf)->uDecompressedSize, &Size, 4);
     sprintf(Source, "%s%s", &Filename, &Ext);
-    strcpy((char *)&pLodDirectory, Source);
+    strcpy(pLodDirectory.pFilename, Source);
     pLodDirectory.uDataSize = compressed_block_size;
     if ( pNew_LOD->Write(&pLodDirectory, (const void *)compressed_buf, 0) )
     {
-      sprintf(Str, pGlobalTXT_LocalizationStrings[612], 208);
-      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1071", 0);
+      sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 208);
+      MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1071", 0);
     }
     free((void *)compressed_buf);
   }
@@ -552,18 +508,17 @@
   {
     if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) )
     {
-      v34 = GetLastError();
-      FormatMessageA(0x1000, 0, v34, 0x400, &Buffer, 0x80, 0);
-      sprintf(Str, pGlobalTXT_LocalizationStrings[612], 300);
-      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1097", 0);
+      FormatMessageA(0x1000, 0, GetLastError(), 0x400, Buffer, 0x80, 0);
+      sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 300);
+      MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1097", 0);
     }
   }
   pParty->vPosition.x = pPositionX;
-  pParty->vPosition.y = v51;
-  pParty->vPosition.z = v62;
-  pParty->uFallStartY = v62;
-  pParty->sRotationY = v53;
-  pParty->sRotationX = v54;
+  pParty->vPosition.y = pPositionY;
+  pParty->vPosition.z = pPositionZ;
+  pParty->uFallStartY = pPositionZ;
+  pParty->sRotationY = sPRotationY;
+  pParty->sRotationX = sPRotationX;
 }
 
 
--- a/UISaveLoad.cpp	Fri Mar 29 16:32:02 2013 +0000
+++ b/UISaveLoad.cpp	Sat Mar 30 19:36:05 2013 +0400
@@ -1,5 +1,5 @@
 #include <assert.h>
-
+#include <io.h>
 #include "MM7.h"
 
 #include "MapInfo.h"
@@ -134,7 +134,7 @@
     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;
+    pMinutes = (int)(((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32);
     v9 = v8;
     v8 /= 60i64;
     pAMPM2 = v8;
@@ -156,7 +156,7 @@
     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  != 0 || ((signed int)v14 <= 0) && (unsigned int)pOurHour <= 12 )
     {
       if ( !(v14 | (unsigned int)pOurHour) )
       {
@@ -264,3 +264,230 @@
         //pAllocator->FreeChunk(pSavegameThumbnails[i].pPixels);
         pSavegameThumbnails[i].Release();
     }
+
+//----- (0045E361) --------------------------------------------------------
+void __fastcall GameUI_DrawLoadMenu(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, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
+        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, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
+        pRenderer->DrawTextureIndexed(18, 141, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0));
+        pRenderer->DrawTextureIndexed(351, 302, (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0));
+        }
+    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_LoadSlot, 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, 0x143, 0x11, 0x11, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "",
+        pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0);
+
+    }
+
+//----- (0045E93E) --------------------------------------------------------
+void  GameUI_DrawSaveMenu()
+    {
+    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( 8u, 8u,
+        (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
+    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, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0));
+    pRenderer->DrawTextureIndexed(0x15Fu, 0x12Eu,
+        (Texture *)(uTextureID_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_u] : 0));
+    pRenderer->DrawTextureIndexed(0x12u, 0x8Du, (Texture *)(v0 != -1 ? (int)&pIcons_LOD->pTextures[v0] : 0));
+    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_17, 0, 0);
+    pGUIWindow_CurrentMenu->CreateButton(21u, 198u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(21u, 218u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 1u, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(21u, 238u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 2u, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(21u, 258u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 3u, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(21u, 278u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 4u, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(21u, 298u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 5u, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(21u, 318u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 6u, 0, "", 0);
+    pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0x69u, 0x28u, 1, 0, UIMSG_LoadSlot, 0, 0, "",
+        (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0), 0);
+    pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(0x15Eu, 0x12Eu, 0x69u, 0x28u, 1, 0, UIMSG_Cancel, 0, 0, "",
+        (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0), 0);
+    pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0xC7u, 0x11u, 0x11u, 1, 0, UIMSG_ArrowUp, 0, 0, "",
+        (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0);
+    pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0x143u, 0x11u, 0x11u, 1, 0, UIMSG_DownArrow, 0x22u, 0, "",
+        (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0);
+    }