view SaveLoad.cpp @ 3:540178ef9b18

Main menu functionality
author Nomad
date Wed, 10 Oct 2012 19:10:15 +0200
parents 8b8875f5b359
children 93bf1d5f6a6d
line wrap: on
line source

#include <io.h>
#include <direct.h>

#include "SaveLoad.h"

#include "mm7_data.h"





struct SavegameList *pSavegameList = new SavegameList;
unsigned int uNumSavegameFiles;
unsigned int pSavegameUsedSlots[45];
struct RGBTexture *pSavegameThumbnails = new RGBTexture[45];
SavegameHeader *pSavegameHeader = new SavegameHeader[45];



//----- (0045E297) --------------------------------------------------------
void SavegameList::Initialize(unsigned int bHideEmptySlots)
{
  uNumSavegameFiles = 0;

  _chdir("saves");
  {
    if (!bHideEmptySlots && _access(pGlobalTXT_LocalizationStrings[613], 0) != -1 )
      strcpy(pSavesNames[uNumSavegameFiles++], pGlobalTXT_LocalizationStrings[613]);

    for (uint i = 0; i < 40; ++i)
    {
      sprintf(pTmpBuf, "save%03d.mm7", i);
      if (_access(pTmpBuf, 0) == -1)
        continue;

      uint idx = i;
      if (!bHideEmptySlots)
        idx = uNumSavegameFiles;
      strcpy(pSavesNames[idx], pTmpBuf);

      ++uNumSavegameFiles;
    }
  }
  _chdir("..");
}