annotate SaveLoad.cpp @ 27:be2066176d89

On level initialization
author Nomad
date Tue, 16 Oct 2012 01:31:05 +0200
parents 93bf1d5f6a6d
children 18f7a1b94448
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"
26
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
5 #include "NPC.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
6 #include "Party.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
7 #include "LOD.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
8 #include "Outdoor.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
9 #include "AudioPlayer.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
10 #include "Actor.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
11 #include "Chest.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
12 #include "Time.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
13 #include "GUIWindow.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
14 #include "GUIFont.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
15 #include "Overlays.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
16 #include "LayingItem.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
17 #include "Viewport.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
18 #include "stru123.h"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
19 #include "Log.h"
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 #include "mm7_data.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
27 struct SavegameList *pSavegameList = new SavegameList;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28 unsigned int uNumSavegameFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29 unsigned int pSavegameUsedSlots[45];
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
30 struct RGBTexture *pSavegameThumbnails = new RGBTexture[45];
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
31 SavegameHeader *pSavegameHeader = new SavegameHeader[45];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34
26
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
35
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
36
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
37
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
38
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
39
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
40
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
41
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
42 //----- (0045EE8A) --------------------------------------------------------
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
43 void __fastcall LoadGame(unsigned int uSlot)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
44 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
45 //unsigned int v1; // ebx@1
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
46 //char v2; // zf@1
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
47 //signed int v3; // esi@3
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
48 //signed int v4; // esi@8
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
49 //char *v5; // eax@9
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
50 //unsigned int v6; // eax@12
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
51 //unsigned int v7; // esi@13
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
52 //char *v8; // ecx@14
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
53 //FILE *v9; // eax@22
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
54 //FILE *v10; // eax@26
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
55 //FILE *v11; // eax@29
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
56 //FILE *v12; // eax@32
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
57 //FILE *v13; // eax@35
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
58 //FILE *v14; // eax@38
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
59 //unsigned int v15; // edi@41
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
60 //Player *v16; // esi@41
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
61 //int *v17; // esi@46
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
62 //int v18; // edi@46
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
63 //int v19; // ebx@46
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
64 //int v20; // ecx@49
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
65 //int v21; // eax@51
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
66 //int v22; // ecx@56
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
67 //bool v23; // edx@56
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
68 //AudioPlayer *v24; // ebx@60
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
69 bool v25; // esi@62
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
70 bool v26; // eax@62
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
71 //signed int v27; // esi@66
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
72 //RGBTexture *v28; // edi@67
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
73 std::string v29; // [sp-18h] [bp-108h]@25
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
74 int v30; // [sp-Ch] [bp-FCh]@65
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
75 int v31; // [sp-8h] [bp-F8h]@4
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
76 //signed int v32; // [sp-4h] [bp-F4h]@4
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
77 char DstBuf[100]; // [sp+Ch] [bp-E4h]@23
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
78 //char pContainer; // [sp+20h] [bp-D0h]@62
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
79 char Str[123]; // [sp+70h] [bp-80h]@25
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
80 //char a3[5]; // [sp+EBh] [bp-5h]@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
81
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
82 //v1 = uSlot;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
83 //v2 = pSavegameUsedSlots[uSlot] == 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
84 dword_5B65C8 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
85 if (!pSavegameUsedSlots[uSlot])
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
86 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
87 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
88 Log::Warning(L"LoadGame: slot %u is empty", uSlot);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
89 return;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
90 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
91
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
92 for (uint i = 1; i < 5; ++i)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
93 for (uint j = 1; j < 6; ++j)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
94 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
95 sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
96 remove(pTmpBuf);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
97 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
98
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
99
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
100 if (byte_4ED498)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
101 for (uint i = 0; i < 4; ++i)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
102 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
103 for (uint j = 0; j < pSoundList->uNumSounds; ++j)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
104 if (pSoundList->pSounds[j].uSoundID == 2 * (byte_4ED498 + 50 * pParty->pPlayers[i].uVoiceID) + 4998)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
105 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
106 pSoundList->_4A9DCD(j, 1);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
107 break;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
108 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
109
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
110 for (uint j = 0; j < pSoundList->uNumSounds; ++j)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
111 if (pSoundList->pSounds[j].uSoundID == 2 * (byte_4ED498 + 50 * pParty->pPlayers[i].uVoiceID) + 4999)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
112 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
113 pSoundList->_4A9DCD(j, 1);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
114 break;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
115 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
116 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
117
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
118 sprintf(pTmpBuf, "saves\\%s", pSavegameList->pSavesNames[uSlot]);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
119
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
120 pNew_LOD->CloseWriteFile();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
121 if (!CopyFileA(pTmpBuf, "data\\new.lod", 0))
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
122 int e = GetLastError();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
123
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
124 pNew_LOD->LoadFile("data\\new.lod", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
125 auto *f = pNew_LOD->FindContainer("header.bin", 1);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
126 if (!f)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
127 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
128 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 100);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
129 Log::Warning(L"%S", Str);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
130 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:549", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
131 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
132 fread(&DstBuf, 0x64u, 1u, f);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
133
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
134 f = pNew_LOD->FindContainer("party.bin", 1);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
135 if (!f)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
136 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
137 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 101);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
138 Log::Warning(L"%S", Str);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
139 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:559", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
140 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
141 if (sizeof(Party) != 0x16238)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
142 Log::Warning(L"class Party: deserialization warning");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
143 fread(pParty, 0x16238u, 1, f);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
144
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
145
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
146 f = pNew_LOD->FindContainer("clock.bin", 1);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
147 if (!f)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
148 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
149 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 102);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
150 Log::Warning(L"%S", Str);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
151 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:569", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
152 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
153 if (sizeof(Timer) != 0x28)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
154 Log::Warning(L"class Timer: deserialization warning");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
155 fread(pEventTimer, 0x28u, 1u, f);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
156
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
157 f = pNew_LOD->FindContainer("overlay.bin", 1);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
158 if (!f)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
159 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
160 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 103);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
161 Log::Warning(L"%S", Str);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
162 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:579", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
163 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
164 if (sizeof(OtherOverlayList) != 0x3F0)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
165 Log::Warning(L"class OtherOverlayList: deserialization warning");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
166 fread(pOtherOverlayList, 0x3F0, 1, f);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
167
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
168 f = pNew_LOD->FindContainer("npcdata.bin", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
169 if (!f)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
170 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
171 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 104);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
172 Log::Warning(L"%S", Str);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
173 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:590", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
174 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
175 if (sizeof(pNPCStats->pNewNPCData) != 0x94BC)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
176 Log::Warning(L"NPCStats: deserialization warning");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
177 fread(pNPCStats->pNewNPCData, 0x94BC, 1, f);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
178 pNPCStats->_476C60();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
179
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
180 f = pNew_LOD->FindContainer("npcgroup.bin", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
181 if (!f)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
182 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
183 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 105);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
184 Log::Warning(L"%S", Str);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
185 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:600", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
186 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
187 if (sizeof(pNPCStats->pGroups_copy) != 0x66)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
188 Log::Warning(L"NPCStats: deserialization warning");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
189 fread(pNPCStats->pGroups_copy, 0x66, 1, f);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
190
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
191
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
192 uActiveCharacter = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
193 for (uint i = 0; i < 4; ++i)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
194 if (pParty->pPlayers[i].CanAct())
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
195 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
196 uActiveCharacter = i + 1;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
197 break;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
198 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
199
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
200 for (uint i = 0; i < 4; ++i)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
201 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
202 auto uQuickspell = pParty->pPlayers[i].uQuickSpell;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
203 if (uQuickspell)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
204 stru_AA1058[i]._494836(uQuickspell, i + 9 - 8);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
205
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
206 for (uint j = 0; j < 2; ++j)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
207 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
208 uint uEquipIdx = pParty->pPlayers[i].pEquipment.pIndices[j];
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
209 if (uEquipIdx)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
210 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
211 auto uItemID = pParty->pPlayers[i].pInventoryItems[uEquipIdx - 1].uItemID;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
212 if (pItemsTable->pItems[uItemID].uEquipType == 12)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
213 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
214 __debugbreak();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
215 v31 = *((int *)&pSpellDatas[66].field_8 + uItemID);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
216 stru_A750F8[i]._494836(v31, i + 9);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
217 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
218 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
219 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
220 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
221
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
222
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
223 pGUIWindow_CurrentMenu->Release();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
224 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
225
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
226 viewparams->bRedrawGameUI = true;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
227
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
228 SetUserInterface(pParty->uAlignment, true);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
229
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
230 pEventTimer->Resume();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
231 pEventTimer->StopGameTime();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
232
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
233 v25 = pGames_LOD->DoesContainerExist(&DstBuf[20]);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
234 sprintf(pTmpBuf, "levels\\%s", &DstBuf[20]);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
235 v26 = _access(pTmpBuf, 4) != -1;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
236 if ( !v25 && !v26 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
237 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
238 sprintf(pTmpBuf, "Unable to find: %s!", &DstBuf[20]);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
239 Abortf(pTmpBuf);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
240 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
241
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
242 strcpy(pCurrentMapName, &DstBuf[20]);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
243 dword_6BE364_game_settings_1 |= 0x2001;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
244
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
245 for (uint i = 0; i < uNumSavegameFiles; ++i)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
246 pSavegameThumbnails[i].Release();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
247
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
248 pIcons_LOD->_4114F2();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
249 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
250 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
251 if (uTurnSpeed)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
252 pParty->sRotationY = uTurnSpeed * pParty->sRotationY / (signed int)uTurnSpeed;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
253 MM7Initialization();
27
be2066176d89 On level initialization
Nomad
parents: 26
diff changeset
254 bFlashQuestBook = false;
be2066176d89 On level initialization
Nomad
parents: 26
diff changeset
255 viewparams->bRedrawGameUI = true;
26
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
256 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
257
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
258
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
259 //----- (0045F469) --------------------------------------------------------
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
260 int __fastcall SaveGame(int a1, __int16 *a2)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
261 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
262 int result; // eax@1
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
263 void *v3; // edi@5
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
264 int v4; // eax@6
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
265 int v5; // eax@6
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
266 int v6; // eax@6
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
267 const char *v7; // edi@8
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
268 FILE *v8; // edi@24
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
269 int v9; // edi@30
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
270 void *v10; // esi@31
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
271 void *v11; // esi@31
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
272 void *v12; // esi@37
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
273 void *v13; // esi@37
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
274 void *v14; // esi@37
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
275 void *v15; // esi@37
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
276 void *v16; // esi@37
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
277 int v17; // esi@37
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
278 unsigned int v18; // ecx@38
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
279 unsigned int v19; // esi@39
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
280 char *v20; // edx@39
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
281 void *v21; // esi@41
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
282 void *v22; // esi@41
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
283 BSPModel *v23; // eax@42
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
284 signed int v24; // edi@42
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
285 unsigned __int8 v25; // zf@43
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
286 unsigned __int8 v26; // sf@43
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
287 signed int v27; // edi@47
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
288 void *v28; // esi@50
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
289 void *v29; // esi@50
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
290 void *v30; // esi@50
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
291 void *v31; // esi@50
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
292 int v32; // esi@51
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
293 int v33; // eax@51
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
294 DWORD v34; // eax@59
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
295 std::string v35; // [sp-18h] [bp-288h]@8
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
296 const char *v36; // [sp-10h] [bp-280h]@6
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
297 const char *v37; // [sp-Ch] [bp-27Ch]@6
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
298 const char *v38; // [sp-8h] [bp-278h]@8
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
299 int v39; // [sp-4h] [bp-274h]@8
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
300 CHAR Buffer; // [sp+Ch] [bp-264h]@59
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
301 char Dir; // [sp+8Ch] [bp-1E4h]@51
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
302 char Drive; // [sp+ACh] [bp-1C4h]@51
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
303 int v43; // [sp+CCh] [bp-1A4h]@10
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
304 char Dest[20]; // [sp+E0h] [bp-190h]@10
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
305 unsigned __int64 v45; // [sp+F4h] [bp-17Ch]@10
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
306 char Filename; // [sp+130h] [bp-140h]@51
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
307 char Ext; // [sp+150h] [bp-120h]@51
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
308 char v48; // [sp+151h] [bp-11Fh]@51
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
309 char Source[32]; // [sp+170h] [bp-100h]@51
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
310 char Str[120]; // [sp+190h] [bp-E0h]@8
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
311 int v51; // [sp+208h] [bp-68h]@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
312 int v52; // [sp+20Ch] [bp-64h]@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
313 int v53; // [sp+210h] [bp-60h]@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
314 int v54; // [sp+214h] [bp-5Ch]@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
315 int Src; // [sp+218h] [bp-58h]@30
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
316 char v56; // [sp+21Ch] [bp-54h]@30
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
317 char v57; // [sp+21Dh] [bp-53h]@30
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
318 char v58; // [sp+21Eh] [bp-52h]@30
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
319 char v59; // [sp+21Fh] [bp-51h]@30
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
320 int v60; // [sp+220h] [bp-50h]@30
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
321 int v61; // [sp+224h] [bp-4Ch]@30
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
322 int v62; // [sp+228h] [bp-48h]@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
323 LOD::Directory pDir; // [sp+22Ch] [bp-44h]@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
324 std::string *v64; // [sp+24Ch] [bp-24h]@1
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
325 size_t Size; // [sp+250h] [bp-20h]@26
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
326 __int16 *v66; // [sp+254h] [bp-1Ch]@1
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
327 void *DstBuf; // [sp+258h] [bp-18h]@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
328 __int16 *v68; // [sp+25Ch] [bp-14h]@32
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
329 unsigned int v69; // [sp+260h] [bp-10h]@23
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
330 int v70; // [sp+264h] [bp-Ch]@22
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
331 std::string *v71; // [sp+268h] [bp-8h]@8
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
332 int a3; // [sp+26Fh] [bp-1h]@8
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
333
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
334 v66 = a2;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
335 v64 = (std::string *)a1;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
336 strcpy(byte_6BE3B0, pCurrentMapName);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
337 result = _strcmpi(pCurrentMapName, "d05.blv");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
338 if ( result )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
339 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
340 DstBuf = operator new(0xF4240u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
341 pDir.Reset();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
342 v52 = pParty->vPosition.x;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
343 v51 = pParty->vPosition.z;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
344 v62 = pParty->vPosition.y;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
345 v53 = pParty->sRotationY;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
346 v54 = pParty->sRotationX;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
347 pParty->vPosition.x = pParty->vPrevPosition.x;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
348 pParty->vPosition.z = pParty->vPrevPosition.z;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
349 pParty->vPosition.y = pParty->vPrevPosition.y;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
350 pParty->uFallStartY = pParty->vPrevPosition.y;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
351 pParty->sRotationY = pParty->sPrevRotationY;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
352 pParty->sRotationX = pParty->sPrevRotationX;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
353 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
354 pIndoor->uLastVisitDay = pParty->uTimePlayed;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
355 else
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
356 pOutdoor->uLastVisitDay = pParty->uTimePlayed;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
357 v3 = MakeScreenshot(150, 112);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
358 strcpy((char *)&pDir, "image.pcx");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
359 pRenderer->_49F5A2((int)v3, 150, 112, DstBuf, 1000000, (int)&pDir.uDataSize);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
360 free(v3);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
361 if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 11 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
362 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
363 pRenderer->DrawTextureIndexed(
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
364 8u,
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
365 8u,
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
366 (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
367 pRenderer->DrawTextureIndexed(
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
368 0x12u,
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
369 0x8Du,
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
370 (Texture *)(uTextureID_save_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_save_up] : 0));
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
371 v36 = pGlobalTXT_LocalizationStrings[190];
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
372 v4 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[190]);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
373 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v4 + 25, 219, 0, v36, 0, 0, 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
374 v37 = (const char *)(&pSavegameHeader + uLoadGameUI_SelectedSlot);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
375 v5 = pFontSmallnum->AlignText_Center(0xBAu,
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
376 (const char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
377 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v5 + 25, 0x103u, 0, v37, 185, 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
378 v36 = pGlobalTXT_LocalizationStrings[165];
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
379 v6 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[165]);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
380 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v6 + 25, 299, 0, v36, 0, 0, 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
381 pRenderer->Present();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
382 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
383 if ( pNew_LOD->Write(&pDir, DstBuf, 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
384 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
385 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 200);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
386 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
387 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
388 else
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
389 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
390 v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp";
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
391 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
392 strcpy(Dest, pCurrentMapName);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
393 v45 = pParty->uTimePlayed;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
394 strcpy((char *)&pDir, "header.bin");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
395 pDir.uDataSize = 100;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
396 if ( pNew_LOD->Write(&pDir, &v43, 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
397 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
398 v39 = 201;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
399 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 201);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
400 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
401 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
402 strcpy((char *)&pDir, "party.bin");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
403 pDir.uDataSize = 90680;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
404 if ( pNew_LOD->Write(&pDir, &pParty, 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
405 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
406 v39 = 202;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
407 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 202);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
408 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
409 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
410 strcpy((char *)&pDir, "Timer.bin");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
411 pDir.uDataSize = 40;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
412 if ( pNew_LOD->Write(&pDir, &pEventTimer, 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
413 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
414 v39 = 203;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
415 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 203);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
416 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
417 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
418 strcpy((char *)&pDir, "overlay.bin");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
419 pDir.uDataSize = 1008;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
420 if ( pNew_LOD->Write(&pDir, &pOtherOverlayList, 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
421 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
422 v39 = 204;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
423 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 204);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
424 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
425 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
426 strcpy((char *)&pDir, "npcdata.bin");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
427 pDir.uDataSize = 38076;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
428 if ( pNew_LOD->Write(&pDir, pNPCStats->pNewNPCData, 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
429 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
430 v39 = 205;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
431 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 205);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
432 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
433 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
434 strcpy((char *)&pDir, "npcgroup.bin");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
435 pDir.uDataSize = 102;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
436 if ( pNew_LOD->Write(&pDir, pNPCStats->pGroups_copy, 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
437 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
438 v39 = 206;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
439 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 206);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
440 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
441 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
442 v70 = 1;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
443 do
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
444 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
445 v69 = 1;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
446 do
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
447 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
448 v39 = v69;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
449 v38 = (const char *)v70;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
450 sprintfex(Str, "data\\lloyd%d%d.pcx", v70, v69);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
451 v8 = fopen(Str, "rb");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
452 if ( v8 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
453 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
454 v39 = v69;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
455 v38 = (const char *)v70;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
456 sprintfex(Str, "lloyd%d%d.pcx", v70, v69);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
457 fseek(v8, 0, 2);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
458 pDir.uDataSize = ftell(v8);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
459 rewind(v8);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
460 fread(DstBuf, pDir.uDataSize, 1u, v8);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
461 strcpy((char *)&pDir, Str);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
462 fclose(v8);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
463 remove(Str);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
464 if ( pNew_LOD->Write(&pDir, DstBuf, 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
465 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
466 v39 = 207;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
467 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 207);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
468 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
469 Size = 5080748;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
470 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
471 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
472 ++v69;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
473 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
474 while ( (signed int)v69 <= 5 );
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
475 ++v70;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
476 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
477 while ( v70 <= 4 );
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
478 if ( !v66 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
479 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
480 sub_42FA22_mess_with_laying_item_list();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
481 v9 = (int)malloc(0xF4240u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
482 v71 = (std::string *)v9;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
483 Src = 91969;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
484 v56 = 109;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
485 v57 = 118;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
486 v58 = 105;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
487 v59 = 105;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
488 v60 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
489 v61 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
490 memcpy((void *)v9, &Src, 0x10u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
491 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
492 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
493 v10 = DstBuf;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
494 pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
495 pIndoor->dlv.uNumBModels = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
496 pIndoor->dlv.uNumDecorations = uNumLevelDecorations;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
497 memcpy(DstBuf, &pIndoor->dlv, 0x28u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
498 v10 = (char *)v10 + 40;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
499 memcpy(v10, pIndoor->_visible_outlines, 0x36Bu);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
500 v11 = (char *)v10 + 875;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
501 v70 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
502 if ( (signed int)pIndoor->uNumFaces > 0 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
503 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
504 v68 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
505 do
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
506 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
507 v38 = (char *)v68 + (unsigned int)pIndoor->pFaces + 44;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
508 memcpy(v11, v38, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
509 v68 += 48;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
510 v11 = (char *)v11 + 4;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
511 ++v70;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
512 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
513 while ( v70 < (signed int)pIndoor->uNumFaces );
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
514 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
515 v70 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
516 if ( (signed int)uNumLevelDecorations > 0 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
517 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
518 v68 = &pLevelDecorations[0].field_2;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
519 do
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
520 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
521 memcpy(v11, v68, 2u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
522 v68 += 16;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
523 v11 = (char *)v11 + 2;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
524 ++v70;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
525 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
526 while ( v70 < (signed int)uNumLevelDecorations );
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
527 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
528 memcpy(v11, &uNumActors, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
529 v12 = (char *)v11 + 4;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
530 memcpy(v12, pActors, 836 * uNumActors);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
531 v13 = (char *)v12 + 836 * uNumActors;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
532 memcpy(v13, &uNumLayingItems, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
533 v13 = (char *)v13 + 4;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
534 memcpy(v13, pLayingItems, 112 * uNumLayingItems);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
535 v14 = (char *)v13 + 112 * uNumLayingItems;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
536 memcpy(v14, &uNumChests, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
537 v14 = (char *)v14 + 4;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
538 memcpy(v14, pChests, 5324 * uNumChests);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
539 v15 = (char *)v14 + 5324 * uNumChests;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
540 memcpy(v15, pIndoor->pDoors, 0x3E80u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
541 v15 = (char *)v15 + 16000;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
542 memcpy(v15, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
543 v16 = (char *)v15 + pIndoor->blv.uDoors_ddata_Size;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
544 memcpy(v16, &stru_5E4C90, 0xC8u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
545 v17 = (int)((char *)v16 + 200);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
546 memcpy((void *)v17, &pIndoor->uLastVisitDay, 0x38u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
547 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
548 else
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
549 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
550 v18 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
551 pOutdoor->ddm.uNumFacesInBModels = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
552 if ( (signed int)pOutdoor->uNumBModels > 0 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
553 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
554 v19 = pOutdoor->uNumBModels;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
555 v20 = (char *)&pOutdoor->pBModels->uNumFaces;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
556 do
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
557 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
558 v18 += *(int *)v20;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
559 v20 += 188;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
560 --v19;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
561 pOutdoor->ddm.uNumFacesInBModels = v18;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
562 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
563 while ( v19 );
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
564 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
565 v21 = DstBuf;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
566 pOutdoor->ddm.uNumBModels = pOutdoor->uNumBModels;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
567 pOutdoor->ddm.uNumDecorations = uNumLevelDecorations;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
568 memcpy(DstBuf, &pOutdoor->ddm, 0x28u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
569 v21 = (char *)v21 + 40;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
570 memcpy(v21, pOutdoor->array_528, 0x3C8u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
571 v21 = (char *)v21 + 968;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
572 memcpy(v21, pOutdoor->array_8F0, 0x3C8u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
573 v22 = (char *)v21 + 968;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
574 v70 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
575 if ( (signed int)pOutdoor->uNumBModels > 0 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
576 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
577 v23 = pOutdoor->pBModels;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
578 v24 = 76;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
579 do
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
580 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
581 v25 = *(int *)&v23->pModelName[v24] == 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
582 v26 = *(int *)&v23->pModelName[v24] < 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
583 v66 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
584 if ( !(v26 | v25) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
585 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
586 v68 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
587 do
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
588 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
589 v38 = (char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
590 memcpy(v22, v38, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
591 v23 = pOutdoor->pBModels;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
592 v68 += 154;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
593 v22 = (char *)v22 + 4;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
594 v66 = (__int16 *)((char *)v66 + 1);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
595 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
596 while ( (signed int)v66 < *(int *)&pOutdoor->pBModels->pModelName[v24] );
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
597 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
598 ++v70;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
599 v24 += 188;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
600 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
601 while ( v70 < (signed int)pOutdoor->uNumBModels );
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
602 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
603 v27 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
604 if ( (signed int)uNumLevelDecorations > 0 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
605 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
606 v66 = &pLevelDecorations[0].field_2;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
607 do
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
608 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
609 memcpy(v22, v66, 2u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
610 v66 += 16;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
611 v22 = (char *)v22 + 2;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
612 ++v27;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
613 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
614 while ( v27 < (signed int)uNumLevelDecorations );
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
615 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
616 memcpy(v22, &uNumActors, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
617 v28 = (char *)v22 + 4;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
618 memcpy(v28, pActors, 836 * uNumActors);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
619 v29 = (char *)v28 + 836 * uNumActors;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
620 memcpy(v29, &uNumLayingItems, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
621 v29 = (char *)v29 + 4;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
622 memcpy(v29, pLayingItems, 112 * uNumLayingItems);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
623 v30 = (char *)v29 + 112 * uNumLayingItems;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
624 memcpy(v30, &uNumChests, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
625 v30 = (char *)v30 + 4;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
626 memcpy(v30, pChests, 5324 * uNumChests);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
627 v31 = (char *)v30 + 5324 * uNumChests;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
628 memcpy(v31, &stru_5E4C90, 0xC8u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
629 v17 = (int)((char *)v31 + 200);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
630 memcpy((void *)v17, &pOutdoor->uLastVisitDay, 0x38u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
631 v9 = (int)v71;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
632 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
633 v32 = v17 + 56;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
634 strcpy(Source, pCurrentMapName);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
635 _splitpath(Source, &Drive, &Dir, &Filename, &Ext);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
636 v48 = 100;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
637 Size = v32 - (int)DstBuf;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
638 v69 = 999984;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
639 LOBYTE(v33) = zlib::MemZip((char *)v9 + 16, (unsigned int *)&v69, DstBuf, v32 - (int)DstBuf);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
640 if ( v33 || (signed int)v69 > (signed int)Size )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
641 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
642 memcpy((void *)(v9 + 16), DstBuf, Size);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
643 v69 = Size;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
644 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
645 v69 += 16;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
646 memcpy((void *)(v9 + 8), &v69, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
647 memcpy((void *)(v9 + 12), &Size, 4u);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
648 sprintfex(Source, "%s%s", &Filename, &Ext);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
649 strcpy((char *)&pDir, Source);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
650 pDir.uDataSize = v69;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
651 if ( pNew_LOD->Write(&pDir, (const void *)v9, 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
652 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
653 v39 = 208;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
654 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 208);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
655 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1071", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
656 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
657 free((void *)v9);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
658 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
659 free(DstBuf);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
660 if ( v64 )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
661 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
662 if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
663 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
664 v34 = GetLastError();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
665 FormatMessageA(0x1000u, 0, v34, 0x400u, &Buffer, 0x80u, 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
666 v39 = 300;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
667 sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 300);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
668 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1097", 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
669 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
670 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
671 pParty->vPosition.x = v52;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
672 pParty->vPosition.z = v51;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
673 pParty->vPosition.y = v62;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
674 pParty->uFallStartY = v62;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
675 pParty->sRotationY = v53;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
676 result = v54;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
677 pParty->sRotationX = v54;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
678 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
679 return result;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
680 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
681
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
682
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
683 //----- (00460078) --------------------------------------------------------
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
684 void __fastcall DoSavegame(unsigned int uSlot)
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
685 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
686 unsigned int v1; // esi@1
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
687 int v2; // esi@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
688 RGBTexture *v3; // ebx@3
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
689 int bNotArena; // [sp+2Ch] [bp-8h]@1
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
690 unsigned int v6; // [sp+30h] [bp-4h]@1
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
691
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
692 v1 = uSlot;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
693 v6 = uSlot;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
694 bNotArena = _strcmpi(pCurrentMapName, "d05.blv");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
695 if ( bNotArena )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
696 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
697 LOD::Directory pDir; // [sp+Ch] [bp-28h]@2
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
698 SaveGame(0, 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
699 v2 = 100 * v1;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
700 strcpy(&pSavegameHeader->pLocationName[v2], pCurrentMapName);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
701 *(int *)((char *)&pSavegameHeader->uWordTime + v2) = LODWORD(pParty->uTimePlayed);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
702 *(int *)((char *)&pSavegameHeader->uWordTime + v2 + 4) = HIDWORD(pParty->uTimePlayed);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
703 strcpy((char *)&pDir, "header.bin");
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
704 pDir.uDataSize = 100;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
705 pNew_LOD->Write(&pDir, (char *)&pSavegameHeader + v2, 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
706 sprintfex(pTmpBuf, "saves\\save%03d.mm7", v6);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
707 pNew_LOD->CloseWriteFile();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
708 CopyFileA("data\\new.lod", pTmpBuf, 0);
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
709 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
710 GUI_UpdateWindows();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
711 pGUIWindow_CurrentMenu->Release();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
712 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
713 v3 = pSavegameThumbnails;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
714 viewparams->bRedrawGameUI = 1;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
715 do
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
716 {
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
717 v3->Release();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
718 ++v3;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
719 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
720 while ( (signed int)v3 < (signed int)&unk_6A0758 );
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
721 if ( bNotArena )
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
722 pNew_LOD->_4621A7();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
723 else
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
724 ShowStatusBarString(pGlobalTXT_LocalizationStrings[583], 2u);// "No saving in the Arena"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
725 pIcons_LOD->_4355F7();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
726 pEventTimer->Resume();
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
727 ShowStatusBarString(pGlobalTXT_LocalizationStrings[656], 2u);// "Game Saved!"
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
728 viewparams->bRedrawGameUI = 1;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
729 }
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
730 // 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
731
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
732
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
733
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
734
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
735
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
736
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
737
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
738
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
739
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
740
93bf1d5f6a6d Game loading.
Nomad
parents: 3
diff changeset
741
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
742 //----- (0045E297) --------------------------------------------------------
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
743 void SavegameList::Initialize(unsigned int bHideEmptySlots)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
744 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
745 uNumSavegameFiles = 0;
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
746
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
747 _chdir("saves");
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
748 {
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
749 if (!bHideEmptySlots && _access(pGlobalTXT_LocalizationStrings[613], 0) != -1 )
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
750 strcpy(pSavesNames[uNumSavegameFiles++], pGlobalTXT_LocalizationStrings[613]);
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
751
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
752 for (uint i = 0; i < 40; ++i)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
753 {
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
754 sprintf(pTmpBuf, "save%03d.mm7", i);
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
755 if (_access(pTmpBuf, 0) == -1)
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
756 continue;
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
757
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
758 uint idx = i;
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
759 if (!bHideEmptySlots)
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
760 idx = uNumSavegameFiles;
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
761 strcpy(pSavesNames[idx], pTmpBuf);
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
762
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
763 ++uNumSavegameFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
764 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
765 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
766 _chdir("..");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
767 }