annotate SaveLoad.cpp @ 3:540178ef9b18

Main menu functionality
author Nomad
date Wed, 10 Oct 2012 19:10:15 +0200
parents 8b8875f5b359
children 93bf1d5f6a6d
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #include <io.h>
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2 #include <direct.h>
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 #include "SaveLoad.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6 #include "mm7_data.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
12 struct SavegameList *pSavegameList = new SavegameList;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
13 unsigned int uNumSavegameFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
14 unsigned int pSavegameUsedSlots[45];
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
15 struct RGBTexture *pSavegameThumbnails = new RGBTexture[45];
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
16 SavegameHeader *pSavegameHeader = new SavegameHeader[45];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20 //----- (0045E297) --------------------------------------------------------
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
21 void SavegameList::Initialize(unsigned int bHideEmptySlots)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23 uNumSavegameFiles = 0;
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
24
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
25 _chdir("saves");
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26 {
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
27 if (!bHideEmptySlots && _access(pGlobalTXT_LocalizationStrings[613], 0) != -1 )
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
28 strcpy(pSavesNames[uNumSavegameFiles++], pGlobalTXT_LocalizationStrings[613]);
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
29
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
30 for (uint i = 0; i < 40; ++i)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31 {
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
32 sprintf(pTmpBuf, "save%03d.mm7", i);
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
33 if (_access(pTmpBuf, 0) == -1)
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
34 continue;
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
35
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
36 uint idx = i;
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
37 if (!bHideEmptySlots)
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
38 idx = uNumSavegameFiles;
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
39 strcpy(pSavesNames[idx], pTmpBuf);
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
40
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41 ++uNumSavegameFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44 _chdir("..");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
45 }