annotate SaveLoad.cpp @ 2024:bb0da61e4a7e

substract item and AddItem for Alexis fix
author Ritor1
date Sat, 16 Nov 2013 00:02:24 +0600
parents c1c74df0a33e
children 28cb79ae2f6f
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
4
0
Ritor1
parents:
diff changeset
5 #include <io.h>
Ritor1
parents:
diff changeset
6 #include <direct.h>
Ritor1
parents:
diff changeset
7
Ritor1
parents:
diff changeset
8 #include "SaveLoad.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 982
diff changeset
9 #include "BSPModel.h"
0
Ritor1
parents:
diff changeset
10 #include "Party.h"
Ritor1
parents:
diff changeset
11 #include "LOD.h"
Ritor1
parents:
diff changeset
12 #include "Outdoor.h"
Ritor1
parents:
diff changeset
13 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
14 #include "Actor.h"
Ritor1
parents:
diff changeset
15 #include "Chest.h"
Ritor1
parents:
diff changeset
16 #include "Time.h"
Ritor1
parents:
diff changeset
17 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
18 #include "GUIFont.h"
Ritor1
parents:
diff changeset
19 #include "Overlays.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 488
diff changeset
20 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
21 #include "Viewport.h"
Ritor1
parents:
diff changeset
22 #include "stru123.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 165
diff changeset
23 #include "texts.h"
0
Ritor1
parents:
diff changeset
24 #include "Log.h"
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
25 #include "VideoPlayer.h"
1828
35c1e4ff6ba7 party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents: 1754
diff changeset
26 #include "Level/Decoration.h"
0
Ritor1
parents:
diff changeset
27
Ritor1
parents:
diff changeset
28 #include "mm7_data.h"
Ritor1
parents:
diff changeset
29
Ritor1
parents:
diff changeset
30
Ritor1
parents:
diff changeset
31
Ritor1
parents:
diff changeset
32
Ritor1
parents:
diff changeset
33
Ritor1
parents:
diff changeset
34 struct SavegameList *pSavegameList = new SavegameList;
Ritor1
parents:
diff changeset
35 unsigned int uNumSavegameFiles;
1206
ab6560001f5b arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents: 1205
diff changeset
36 std::array<unsigned int, 45> pSavegameUsedSlots;
ab6560001f5b arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents: 1205
diff changeset
37 std::array<struct RGBTexture, 45> pSavegameThumbnails;
ab6560001f5b arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents: 1205
diff changeset
38 std::array<SavegameHeader, 45> pSavegameHeader;
0
Ritor1
parents:
diff changeset
39
Ritor1
parents:
diff changeset
40
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44
Ritor1
parents:
diff changeset
45
Ritor1
parents:
diff changeset
46
Ritor1
parents:
diff changeset
47
Ritor1
parents:
diff changeset
48
Ritor1
parents:
diff changeset
49 //----- (0045EE8A) --------------------------------------------------------
Ritor1
parents:
diff changeset
50 void __fastcall LoadGame(unsigned int uSlot)
Ritor1
parents:
diff changeset
51 {
Ritor1
parents:
diff changeset
52 bool v25; // esi@62
Ritor1
parents:
diff changeset
53 bool v26; // eax@62
Ritor1
parents:
diff changeset
54 int v30; // [sp-Ch] [bp-FCh]@65
Ritor1
parents:
diff changeset
55 int v31; // [sp-8h] [bp-F8h]@4
Ritor1
parents:
diff changeset
56 SavegameHeader header; // [sp+Ch] [bp-E4h]@23
Ritor1
parents:
diff changeset
57 char Str[123]; // [sp+70h] [bp-80h]@25
Ritor1
parents:
diff changeset
58
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
59 dword_5B65C8_timers_count = 0;
0
Ritor1
parents:
diff changeset
60 if (!pSavegameUsedSlots[uSlot])
Ritor1
parents:
diff changeset
61 {
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1736
diff changeset
62 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
63 Log::Warning(L"LoadGame: slot %u is empty", uSlot);
Ritor1
parents:
diff changeset
64 return;
Ritor1
parents:
diff changeset
65 }
Ritor1
parents:
diff changeset
66
Ritor1
parents:
diff changeset
67 for (uint i = 1; i < 5; ++i)
Ritor1
parents:
diff changeset
68 for (uint j = 1; j < 6; ++j)
Ritor1
parents:
diff changeset
69 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
70 sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
71 remove(pTmpBuf.data());
0
Ritor1
parents:
diff changeset
72 }
Ritor1
parents:
diff changeset
73
Ritor1
parents:
diff changeset
74
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 189
diff changeset
75 if (SoundSetAction[24][0])
0
Ritor1
parents:
diff changeset
76 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
77 {
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 752
diff changeset
78 for (uint j = 0; j < pSoundList->sNumSounds; ++j)
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 189
diff changeset
79 if (pSoundList->pSounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998)
0
Ritor1
parents:
diff changeset
80 {
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 752
diff changeset
81 pSoundList->UnloadSound(j, 1);
0
Ritor1
parents:
diff changeset
82 break;
Ritor1
parents:
diff changeset
83 }
Ritor1
parents:
diff changeset
84
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 752
diff changeset
85 for (uint j = 0; j < pSoundList->sNumSounds; ++j)
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 189
diff changeset
86 if (pSoundList->pSounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999)
0
Ritor1
parents:
diff changeset
87 {
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 752
diff changeset
88 pSoundList->UnloadSound(j, 1);
0
Ritor1
parents:
diff changeset
89 break;
Ritor1
parents:
diff changeset
90 }
Ritor1
parents:
diff changeset
91 }
Ritor1
parents:
diff changeset
92
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
93 sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[uSlot].pSaveFileName);
0
Ritor1
parents:
diff changeset
94
Ritor1
parents:
diff changeset
95 pNew_LOD->CloseWriteFile();
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
96 if (!CopyFileA(pTmpBuf.data(), "data\\new.lod", 0))
0
Ritor1
parents:
diff changeset
97 int e = GetLastError();
Ritor1
parents:
diff changeset
98
Ritor1
parents:
diff changeset
99 pNew_LOD->LoadFile("data\\new.lod", 0);
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
100 FILE *f = pNew_LOD->FindContainer("header.bin", 1);
0
Ritor1
parents:
diff changeset
101 if (!f)
Ritor1
parents:
diff changeset
102 {
Ritor1
parents:
diff changeset
103 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 100);
Ritor1
parents:
diff changeset
104 Log::Warning(L"%S", Str);
Ritor1
parents:
diff changeset
105 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:549", 0);
Ritor1
parents:
diff changeset
106 }
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1489
diff changeset
107 Assert(sizeof(SavegameHeader) == 100);
0
Ritor1
parents:
diff changeset
108 fread(&header, sizeof(SavegameHeader), 1, f);
Ritor1
parents:
diff changeset
109
Ritor1
parents:
diff changeset
110 f = pNew_LOD->FindContainer("party.bin", 1);
Ritor1
parents:
diff changeset
111 if (!f)
Ritor1
parents:
diff changeset
112 {
Ritor1
parents:
diff changeset
113 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 101);
Ritor1
parents:
diff changeset
114 Log::Warning(L"%S", Str);
Ritor1
parents:
diff changeset
115 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:559", 0);
Ritor1
parents:
diff changeset
116 }
Ritor1
parents:
diff changeset
117 if (sizeof(Party) != 0x16238)
Ritor1
parents:
diff changeset
118 Log::Warning(L"class Party: deserialization warning");
Ritor1
parents:
diff changeset
119 fread(pParty, 0x16238u, 1, f);
Ritor1
parents:
diff changeset
120
Ritor1
parents:
diff changeset
121
Ritor1
parents:
diff changeset
122 f = pNew_LOD->FindContainer("clock.bin", 1);
Ritor1
parents:
diff changeset
123 if (!f)
Ritor1
parents:
diff changeset
124 {
Ritor1
parents:
diff changeset
125 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 102);
Ritor1
parents:
diff changeset
126 Log::Warning(L"%S", Str);
Ritor1
parents:
diff changeset
127 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:569", 0);
Ritor1
parents:
diff changeset
128 }
Ritor1
parents:
diff changeset
129 if (sizeof(Timer) != 0x28)
Ritor1
parents:
diff changeset
130 Log::Warning(L"class Timer: deserialization warning");
Ritor1
parents:
diff changeset
131 fread(pEventTimer, 0x28u, 1u, f);
Ritor1
parents:
diff changeset
132
Ritor1
parents:
diff changeset
133 f = pNew_LOD->FindContainer("overlay.bin", 1);
Ritor1
parents:
diff changeset
134 if (!f)
Ritor1
parents:
diff changeset
135 {
Ritor1
parents:
diff changeset
136 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 103);
Ritor1
parents:
diff changeset
137 Log::Warning(L"%S", Str);
Ritor1
parents:
diff changeset
138 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:579", 0);
Ritor1
parents:
diff changeset
139 }
Ritor1
parents:
diff changeset
140 if (sizeof(OtherOverlayList) != 0x3F0)
Ritor1
parents:
diff changeset
141 Log::Warning(L"class OtherOverlayList: deserialization warning");
Ritor1
parents:
diff changeset
142 fread(pOtherOverlayList, 0x3F0, 1, f);
Ritor1
parents:
diff changeset
143
Ritor1
parents:
diff changeset
144 f = pNew_LOD->FindContainer("npcdata.bin", 0);
Ritor1
parents:
diff changeset
145 if (!f)
Ritor1
parents:
diff changeset
146 {
Ritor1
parents:
diff changeset
147 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 104);
Ritor1
parents:
diff changeset
148 Log::Warning(L"%S", Str);
Ritor1
parents:
diff changeset
149 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:590", 0);
Ritor1
parents:
diff changeset
150 }
Ritor1
parents:
diff changeset
151 if (sizeof(pNPCStats->pNewNPCData) != 0x94BC)
Ritor1
parents:
diff changeset
152 Log::Warning(L"NPCStats: deserialization warning");
Ritor1
parents:
diff changeset
153 fread(pNPCStats->pNewNPCData, 0x94BC, 1, f);
Ritor1
parents:
diff changeset
154 pNPCStats->_476C60();
Ritor1
parents:
diff changeset
155
Ritor1
parents:
diff changeset
156 f = pNew_LOD->FindContainer("npcgroup.bin", 0);
Ritor1
parents:
diff changeset
157 if (!f)
Ritor1
parents:
diff changeset
158 {
Ritor1
parents:
diff changeset
159 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 105);
Ritor1
parents:
diff changeset
160 Log::Warning(L"%S", Str);
Ritor1
parents:
diff changeset
161 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:600", 0);
Ritor1
parents:
diff changeset
162 }
Ritor1
parents:
diff changeset
163 if (sizeof(pNPCStats->pGroups_copy) != 0x66)
Ritor1
parents:
diff changeset
164 Log::Warning(L"NPCStats: deserialization warning");
Ritor1
parents:
diff changeset
165 fread(pNPCStats->pGroups_copy, 0x66, 1, f);
Ritor1
parents:
diff changeset
166
Ritor1
parents:
diff changeset
167
Ritor1
parents:
diff changeset
168 uActiveCharacter = 0;
Ritor1
parents:
diff changeset
169 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
170 if (pParty->pPlayers[i].CanAct())
Ritor1
parents:
diff changeset
171 {
Ritor1
parents:
diff changeset
172 uActiveCharacter = i + 1;
Ritor1
parents:
diff changeset
173 break;
Ritor1
parents:
diff changeset
174 }
Ritor1
parents:
diff changeset
175
Ritor1
parents:
diff changeset
176 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
177 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
178 uchar uQuickspell = pParty->pPlayers[i].uQuickSpell;
0
Ritor1
parents:
diff changeset
179 if (uQuickspell)
Ritor1
parents:
diff changeset
180 stru_AA1058[i]._494836(uQuickspell, i + 9 - 8);
Ritor1
parents:
diff changeset
181
Ritor1
parents:
diff changeset
182 for (uint j = 0; j < 2; ++j)
Ritor1
parents:
diff changeset
183 {
Ritor1
parents:
diff changeset
184 uint uEquipIdx = pParty->pPlayers[i].pEquipment.pIndices[j];
Ritor1
parents:
diff changeset
185 if (uEquipIdx)
Ritor1
parents:
diff changeset
186 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
187 int uItemID = pParty->pPlayers[i].pInventoryItemList[uEquipIdx - 1].uItemID;
0
Ritor1
parents:
diff changeset
188 if (pItemsTable->pItems[uItemID].uEquipType == 12)
Ritor1
parents:
diff changeset
189 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
190 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
488
Nomad
parents: 382
diff changeset
191 v31 = *((int *)&pSpellDatas[66].uNormalLevelRecovery + uItemID);
0
Ritor1
parents:
diff changeset
192 stru_A750F8[i]._494836(v31, i + 9);
Ritor1
parents:
diff changeset
193 }
Ritor1
parents:
diff changeset
194 }
Ritor1
parents:
diff changeset
195 }
Ritor1
parents:
diff changeset
196 }
Ritor1
parents:
diff changeset
197
Ritor1
parents:
diff changeset
198
Ritor1
parents:
diff changeset
199 pGUIWindow_CurrentMenu->Release();
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 79
diff changeset
200 pCurrentScreen = SCREEN_GAME;
0
Ritor1
parents:
diff changeset
201
Ritor1
parents:
diff changeset
202 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
203
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 336
diff changeset
204 SetUserInterface(pParty->alignment, true);
0
Ritor1
parents:
diff changeset
205
Ritor1
parents:
diff changeset
206 pEventTimer->Resume();
Ritor1
parents:
diff changeset
207 pEventTimer->StopGameTime();
Ritor1
parents:
diff changeset
208
Ritor1
parents:
diff changeset
209 v25 = pGames_LOD->DoesContainerExist(header.pLocationName);
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
210 sprintf(pTmpBuf.data(), "levels\\%s", header.pLocationName);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
211 v26 = _access(pTmpBuf.data(), 4) != -1;
0
Ritor1
parents:
diff changeset
212 if ( !v25 && !v26 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1489
diff changeset
213 Error("Unable to find: %s!", header.pLocationName);
0
Ritor1
parents:
diff changeset
214
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
215 strcpy(pCurrentMapName, header.pLocationName);
0
Ritor1
parents:
diff changeset
216 dword_6BE364_game_settings_1 |= 0x2001;
Ritor1
parents:
diff changeset
217
Ritor1
parents:
diff changeset
218 for (uint i = 0; i < uNumSavegameFiles; ++i)
Ritor1
parents:
diff changeset
219 pSavegameThumbnails[i].Release();
Ritor1
parents:
diff changeset
220
1405
c0b273d33338 RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents: 1404
diff changeset
221 pIcons_LOD->RemoveTexturesPackFromTextureList();
328
8e23edf57e27 little fix
Ritor1
parents: 203
diff changeset
222 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
8e23edf57e27 little fix
Ritor1
parents: 203
diff changeset
223 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
0
Ritor1
parents:
diff changeset
224 if (uTurnSpeed)
Ritor1
parents:
diff changeset
225 pParty->sRotationY = uTurnSpeed * pParty->sRotationY / (signed int)uTurnSpeed;
Ritor1
parents:
diff changeset
226 MM7Initialization();
Ritor1
parents:
diff changeset
227 bFlashQuestBook = false;
Ritor1
parents:
diff changeset
228 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
229 }
Ritor1
parents:
diff changeset
230
Ritor1
parents:
diff changeset
231
Ritor1
parents:
diff changeset
232 //----- (0045F469) --------------------------------------------------------
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
233 void SaveGame( bool IsAutoSAve, bool NotSaveWorld )
982
08fd1436ef35 enums & lod
Nomad
parents: 847
diff changeset
234 {
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
235 unsigned short *pScreenshot; // edi@5
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
236 int text_pos; // eax@6
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
237 FILE *pLLoidFile; // edi@24
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
238 char* compressed_buf; // edi@30
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
239 char *data_write_pos; // esi@41
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
240 CHAR Buffer[128]; // [sp+Ch] [bp-264h]@59
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 4
diff changeset
241 char Dir[255]; // [sp+8Ch] [bp-1E4h]@51
6ad816231528 structure fixes, death crash fix
zipi
parents: 4
diff changeset
242 char Drive[255]; // [sp+ACh] [bp-1C4h]@51
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
243 SavegameHeader save_header; // [sp+CCh] [bp-1A4h]@10
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 4
diff changeset
244 char Filename[255]; // [sp+130h] [bp-140h]@51
6ad816231528 structure fixes, death crash fix
zipi
parents: 4
diff changeset
245 char Ext[255]; // [sp+150h] [bp-120h]@51
0
Ritor1
parents:
diff changeset
246 char Source[32]; // [sp+170h] [bp-100h]@51
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
247 char work_string[120]; // [sp+190h] [bp-E0h]@8
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
248 int pPositionY; // [sp+208h] [bp-68h]@2
0
Ritor1
parents:
diff changeset
249 int pPositionX; // [sp+20Ch] [bp-64h]@2
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
250 int sPRotationY; // [sp+210h] [bp-60h]@2
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
251 int sPRotationX; // [sp+214h] [bp-5Ch]@2
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
252 ODMHeader odm_data; // [sp+218h] [bp-58h]@30
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
253 int res; // [sp+224h] [bp-4Ch]@30
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
254 int pPositionZ; // [sp+228h] [bp-48h]@2
0
Ritor1
parents:
diff changeset
255 size_t Size; // [sp+250h] [bp-20h]@26
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
256 char *uncompressed_buff; // [sp+258h] [bp-18h]@2
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
257 unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
258
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
259 //v66 = a2;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
260 strcpy(byte_6BE3B0.data(), pCurrentMapName);
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
261 if (!_stricmp(pCurrentMapName, "d05.blv")) // arena
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
262 return;
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
263
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
264 uncompressed_buff = (char*)malloc(1000000);
982
08fd1436ef35 enums & lod
Nomad
parents: 847
diff changeset
265
08fd1436ef35 enums & lod
Nomad
parents: 847
diff changeset
266 LOD::Directory pLodDirectory; // [sp+22Ch] [bp-44h]@2
0
Ritor1
parents:
diff changeset
267 pPositionX = pParty->vPosition.x;
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
268 pPositionY = pParty->vPosition.y;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
269 pPositionZ = pParty->vPosition.z;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
270 sPRotationY = pParty->sRotationY;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
271 sPRotationX = pParty->sRotationX;
0
Ritor1
parents:
diff changeset
272 pParty->vPosition.x = pParty->vPrevPosition.x;
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
273 pParty->vPosition.z = pParty->vPrevPosition.z;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
274 pParty->vPosition.y = pParty->vPrevPosition.y;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
275
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
276 pParty->uFallStartY = pParty->vPrevPosition.z;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
277
0
Ritor1
parents:
diff changeset
278 pParty->sRotationY = pParty->sPrevRotationY;
Ritor1
parents:
diff changeset
279 pParty->sRotationX = pParty->sPrevRotationX;
Ritor1
parents:
diff changeset
280 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
Ritor1
parents:
diff changeset
281 pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
282 else
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
283 pOutdoor->loc_time.uLastVisitDay = pParty->uTimePlayed;
0
Ritor1
parents:
diff changeset
284 pScreenshot = MakeScreenshot(150, 112);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
285 strcpy(pLodDirectory.pFilename, "image.pcx");
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
286 pRenderer->PackPCXpicture(pScreenshot, 150, 112, uncompressed_buff, 1000000, &pLodDirectory.uDataSize);
0
Ritor1
parents:
diff changeset
287 free(pScreenshot);
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 79
diff changeset
288 if (pCurrentScreen == SCREEN_SAVEGAME)
0
Ritor1
parents:
diff changeset
289 {
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
290 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave));
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
291 pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up));
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
292 text_pos = pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[190]);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
293 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, text_pos + 25, 219, 0, pGlobalTXT_LocalizationStrings[190], 0, 0, 0); //Ñîõðàíåíèå
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
294 text_pos = pFontSmallnum->AlignText_Center(186, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
295 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, text_pos + 25, 259, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
296 text_pos = pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
297 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, text_pos + 25, 299, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); //Ïîæàëóéñòà, ïîäîæäèòå
0
Ritor1
parents:
diff changeset
298 pRenderer->Present();
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
299 }
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
300
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
301 if (pNew_LOD->Write(&pLodDirectory, uncompressed_buff, 0))
0
Ritor1
parents:
diff changeset
302 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
303 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 200); //Ñîõðàíåííàÿ èãðà ïîâðåæäåíà! Code=%d
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
304 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0);
0
Ritor1
parents:
diff changeset
305 }
Ritor1
parents:
diff changeset
306
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1489
diff changeset
307 Assert(sizeof(SavegameHeader) == 100);
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
308 memset(save_header.pName, 0, 20);
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
309 memset(save_header.pLocationName, 0, 20);
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
310 memset(save_header.field_30, 0, 52);
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
311 strcpy(save_header.pLocationName, pCurrentMapName);
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
312 save_header.uWordTime = pParty->uTimePlayed;
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
313 strcpy(pLodDirectory.pFilename, "header.bin");
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
314 pLodDirectory.uDataSize = sizeof(SavegameHeader);
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
315 if (pNew_LOD->Write(&pLodDirectory, &save_header, 0))
0
Ritor1
parents:
diff changeset
316 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
317 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 201);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
318 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0);
0
Ritor1
parents:
diff changeset
319 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
320 strcpy(pLodDirectory.pFilename, "party.bin");
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
321 pLodDirectory.uDataSize = sizeof(Party); //90680;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
322 if ( pNew_LOD->Write(&pLodDirectory, pParty, 0) )
0
Ritor1
parents:
diff changeset
323 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
324 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 202);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
325 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0);
0
Ritor1
parents:
diff changeset
326 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
327 strcpy(pLodDirectory.pFilename, "clock.bin");
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
328 pLodDirectory.uDataSize =sizeof(Timer);// 40;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
329 if ( pNew_LOD->Write(&pLodDirectory, pEventTimer, 0) )
0
Ritor1
parents:
diff changeset
330 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
331 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 203);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
332 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0);
0
Ritor1
parents:
diff changeset
333 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
334 strcpy(pLodDirectory.pFilename, "overlay.bin");
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
335 pLodDirectory.uDataSize =sizeof(OtherOverlayList);// 1008;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
336 if ( pNew_LOD->Write(&pLodDirectory, pOtherOverlayList, 0) )
0
Ritor1
parents:
diff changeset
337 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
338 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 204);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
339 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0);
0
Ritor1
parents:
diff changeset
340 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
341 strcpy(pLodDirectory.pFilename, "npcdata.bin");
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
342 pLodDirectory.uDataSize = 501 * sizeof(NPCData);
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1489
diff changeset
343 Assert(pLodDirectory.uDataSize == 38076);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
344 if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pNewNPCData, 0) )
0
Ritor1
parents:
diff changeset
345 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
346 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 205);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
347 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0);
0
Ritor1
parents:
diff changeset
348 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
349 strcpy(pLodDirectory.pFilename, "npcgroup.bin");
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
350 pLodDirectory.uDataSize = 102;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
351 if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pGroups_copy, 0) )
0
Ritor1
parents:
diff changeset
352 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
353 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 206);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
354 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0);
0
Ritor1
parents:
diff changeset
355 }
Ritor1
parents:
diff changeset
356 for (int i = 1; i <= 4; ++i) // 4 - players
Ritor1
parents:
diff changeset
357 {
Ritor1
parents:
diff changeset
358 for (int j = 1; j <= 5; ++j) // 5 - images
Ritor1
parents:
diff changeset
359 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
360 sprintf(work_string, "data\\lloyd%d%d.pcx", i, j);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
361 pLLoidFile = fopen(work_string, "rb");
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
362 if ( pLLoidFile )
0
Ritor1
parents:
diff changeset
363 {
Ritor1
parents:
diff changeset
364 __debugbreak();
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
365 sprintf(work_string, "lloyd%d%d.pcx", i, j);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
366 fseek(pLLoidFile, 0, SEEK_END);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
367 pLodDirectory.uDataSize = ftell(pLLoidFile);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
368 rewind(pLLoidFile);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
369 fread(uncompressed_buff, pLodDirectory.uDataSize, 1, pLLoidFile);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
370 strcpy(pLodDirectory.pFilename, work_string);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
371 fclose(pLLoidFile);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
372 remove(work_string);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
373 if ( pNew_LOD->Write(&pLodDirectory, uncompressed_buff, 0) )
0
Ritor1
parents:
diff changeset
374 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
375 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 207);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
376 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0);
0
Ritor1
parents:
diff changeset
377 Size = 5080748;
Ritor1
parents:
diff changeset
378 }
Ritor1
parents:
diff changeset
379 }
Ritor1
parents:
diff changeset
380 }
Ritor1
parents:
diff changeset
381 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
382 if ( !NotSaveWorld )
0
Ritor1
parents:
diff changeset
383 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 4
diff changeset
384 //__debugbreak();
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
385 CompactLayingItemsList();
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
386 compressed_buf = (char*)malloc(1000000);
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
387 odm_data.uVersion = 91969;
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
388 odm_data.pMagic[0] = 'm';
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
389 odm_data.pMagic[1] = 'v';
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
390 odm_data.pMagic[2] = 'i';
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
391 odm_data.pMagic[3] = 'i';
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
392 odm_data.uCompressedSize = 0;
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
393 odm_data.uDecompressedSize = 0;
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
394 data_write_pos = uncompressed_buff;
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
395 memcpy((void *)compressed_buf, &odm_data, 0x10);
0
Ritor1
parents:
diff changeset
396 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
397 {
Ritor1
parents:
diff changeset
398 pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces;
Ritor1
parents:
diff changeset
399 pIndoor->dlv.uNumBModels = 0;
Ritor1
parents:
diff changeset
400 pIndoor->dlv.uNumDecorations = uNumLevelDecorations;
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
401 memcpy(data_write_pos, &pIndoor->dlv,sizeof(DDM_DLV_Header) );//0x28
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
402 data_write_pos += sizeof(DDM_DLV_Header);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
403 memcpy(data_write_pos, pIndoor->_visible_outlines, 0x36B);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
404 data_write_pos += 875;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
405
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
406 for (int i = 0; i <(signed int)pIndoor->uNumFaces; ++i)
0
Ritor1
parents:
diff changeset
407 {
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
408 memcpy(data_write_pos, &pIndoor->pFaces[i].uAttributes, 4);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
409 data_write_pos += 4;
0
Ritor1
parents:
diff changeset
410 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
411
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
412 for (int i = 0; i <(signed int)uNumLevelDecorations; ++i)
0
Ritor1
parents:
diff changeset
413 {
1489
a27cdb3d753e Cleanup of LevelDecoration and related.
yoctozepto
parents: 1477
diff changeset
414 memcpy(data_write_pos, &pLevelDecorations[i].uFlags, 2);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
415
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
416 data_write_pos+= 2;
0
Ritor1
parents:
diff changeset
417 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
418 memcpy(data_write_pos, &uNumActors, 4);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
419 data_write_pos += 4;
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1165
diff changeset
420 memcpy(data_write_pos, pActors.data(), 836 * uNumActors);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
421 data_write_pos += 836 * uNumActors;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
422 memcpy(data_write_pos, &uNumSpriteObjects, 4);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
423 data_write_pos += 4;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
424 memcpy(data_write_pos, pSpriteObjects.data(), 112 * uNumSpriteObjects);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
425 data_write_pos += 112 * uNumSpriteObjects;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
426 memcpy(data_write_pos, &uNumChests, 4);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
427 data_write_pos += 4;
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1165
diff changeset
428 memcpy(data_write_pos, pChests.data(), sizeof(Chest)*uNumChests);//5324 *
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
429 data_write_pos += sizeof(Chest)* uNumChests;
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
430 memcpy(data_write_pos, pIndoor->pDoors, 0x3E80);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
431 data_write_pos += 16000;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
432 memcpy(data_write_pos, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
433 data_write_pos += pIndoor->blv.uDoors_ddata_Size;
1736
c6fe09a06712 Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents: 1583
diff changeset
434 memcpy(data_write_pos, &stru_5E4C90_MapPersistVars, 0xC8);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
435 data_write_pos += 200;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
436 memcpy(data_write_pos, &pIndoor->stru1, 0x38);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
437 data_write_pos += 56;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
438
0
Ritor1
parents:
diff changeset
439 }
Ritor1
parents:
diff changeset
440 else
Ritor1
parents:
diff changeset
441 {
Ritor1
parents:
diff changeset
442 pOutdoor->ddm.uNumFacesInBModels = 0;
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
443 for (int i=0; i<pOutdoor->uNumBModels;++i)
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
444 {
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
445 pOutdoor->ddm.uNumFacesInBModels +=pOutdoor->pBModels[i].uNumFaces;
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
446 }
0
Ritor1
parents:
diff changeset
447 pOutdoor->ddm.uNumBModels = pOutdoor->uNumBModels;
Ritor1
parents:
diff changeset
448 pOutdoor->ddm.uNumDecorations = uNumLevelDecorations;
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
449 memcpy(data_write_pos, &pOutdoor->ddm, sizeof(DDM_DLV_Header));//0x28
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
450 data_write_pos += sizeof(DDM_DLV_Header);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
451 memcpy(data_write_pos, pOutdoor->uUndiscoveredArea, 0x3C8);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
452 data_write_pos += 968;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
453 memcpy(data_write_pos, pOutdoor->uDicovered_area, 0x3C8);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
454 data_write_pos += 968;
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
455 for (int i = 0; i < pOutdoor->uNumBModels ; ++i)
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 4
diff changeset
456 for (int j = 0; j < pOutdoor->pBModels[i].uNumFaces;++j)//*(int *)&pOutdoor->pBModels->pModelName[v24]; ++j)
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
457 {
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
458 memcpy(data_write_pos, &(pOutdoor->pBModels[i].pFaces[j].uAttributes), 4);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
459 data_write_pos += 4;
0
Ritor1
parents:
diff changeset
460 }
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 817
diff changeset
461
1084
5a59b5b2699f SaveGame "for" cycle fix - orignal disassembly code has "i < uNumLevelDecorations"
Grumpy7
parents: 1016
diff changeset
462 for (int i = 0; i < (signed int)uNumLevelDecorations; ++i)
0
Ritor1
parents:
diff changeset
463 {
1489
a27cdb3d753e Cleanup of LevelDecoration and related.
yoctozepto
parents: 1477
diff changeset
464 memcpy(data_write_pos, &pLevelDecorations[i].uFlags, 2);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
465 data_write_pos += 2;
0
Ritor1
parents:
diff changeset
466 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
467 memcpy(data_write_pos, &uNumActors, 4);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
468 data_write_pos += 4;
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1165
diff changeset
469 memcpy(data_write_pos, pActors.data(), 836 * uNumActors);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
470 data_write_pos += 836 * uNumActors;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
471 memcpy(data_write_pos, &uNumSpriteObjects, 4);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
472 data_write_pos += 4;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
473 memcpy(data_write_pos, pSpriteObjects.data(), 112 * uNumSpriteObjects);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
474 data_write_pos += 112 * uNumSpriteObjects;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
475 memcpy(data_write_pos, &uNumChests, 4);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
476 data_write_pos += 4;
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1165
diff changeset
477 memcpy(data_write_pos, pChests.data(), sizeof(Chest)* uNumChests);
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
478 data_write_pos += sizeof(Chest)* uNumChests;
1736
c6fe09a06712 Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents: 1583
diff changeset
479 memcpy(data_write_pos, &stru_5E4C90_MapPersistVars, 0xC8);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
480 data_write_pos += 200;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
481 memcpy(data_write_pos, &pOutdoor->loc_time, 0x38);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
482 data_write_pos += 56;
0
Ritor1
parents:
diff changeset
483 }
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
484 strcpy(Source, pCurrentMapName);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 4
diff changeset
485 _splitpath(Source, Drive, Dir, Filename, Ext);
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
486
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
487 Size = (int)data_write_pos - (int)uncompressed_buff;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
488 compressed_block_size = 999984;
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
489 res = zlib::MemZip((char *)compressed_buf + 16, (unsigned int *)&compressed_block_size, uncompressed_buff,Size);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
490 if (res || (signed int)compressed_block_size > (signed int)Size )
0
Ritor1
parents:
diff changeset
491 {
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
492 memcpy((void *)(compressed_buf + 16), uncompressed_buff, Size);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
493 compressed_block_size = Size;
0
Ritor1
parents:
diff changeset
494 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
495 compressed_block_size += 16;
814
35122475edd7 struct correction
Gloval
parents: 810
diff changeset
496 memcpy(&((ODMHeader *)compressed_buf)->uCompressedSize, &compressed_block_size, 4);
35122475edd7 struct correction
Gloval
parents: 810
diff changeset
497 memcpy(&((ODMHeader *)compressed_buf)->uDecompressedSize, &Size, 4);
0
Ritor1
parents:
diff changeset
498 sprintf(Source, "%s%s", &Filename, &Ext);
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
499 strcpy(pLodDirectory.pFilename, Source);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
500 pLodDirectory.uDataSize = compressed_block_size;
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
501 if ( pNew_LOD->Write(&pLodDirectory, (const void *)compressed_buf, 0) )
0
Ritor1
parents:
diff changeset
502 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
503 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 208);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
504 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1071", 0);
0
Ritor1
parents:
diff changeset
505 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
506 free((void *)compressed_buf);
0
Ritor1
parents:
diff changeset
507 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
508 free(uncompressed_buff);
f5156b8c61ad savegame refactoring
Gloval
parents: 764
diff changeset
509 if ( IsAutoSAve )
0
Ritor1
parents:
diff changeset
510 {
Ritor1
parents:
diff changeset
511 if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) )
Ritor1
parents:
diff changeset
512 {
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
513 FormatMessageA(0x1000, 0, GetLastError(), 0x400, Buffer, 0x80, 0);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
514 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 300);
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
515 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1097", 0);
0
Ritor1
parents:
diff changeset
516 }
Ritor1
parents:
diff changeset
517 }
Ritor1
parents:
diff changeset
518 pParty->vPosition.x = pPositionX;
847
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
519 pParty->vPosition.y = pPositionY;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
520 pParty->vPosition.z = pPositionZ;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
521 pParty->uFallStartY = pPositionZ;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
522 pParty->sRotationY = sPRotationY;
e398541aee60 fixed party save position
Gloval
parents: 837
diff changeset
523 pParty->sRotationX = sPRotationX;
0
Ritor1
parents:
diff changeset
524 }
Ritor1
parents:
diff changeset
525
Ritor1
parents:
diff changeset
526
Ritor1
parents:
diff changeset
527 //----- (00460078) --------------------------------------------------------
Ritor1
parents:
diff changeset
528 void __fastcall DoSavegame(unsigned int uSlot)
Ritor1
parents:
diff changeset
529 {
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
530 //unsigned int v1; // esi@1
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
531 //int v2; // esi@2
557
604d70894002 Saving works partly
zipi
parents: 515
diff changeset
532 //RGBTexture *v3; // ebx@3
0
Ritor1
parents:
diff changeset
533 int bNotArena; // [sp+2Ch] [bp-8h]@1
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
534 //unsigned int v6; // [sp+30h] [bp-4h]@1
0
Ritor1
parents:
diff changeset
535
165
Ritor1
parents: 151
diff changeset
536 //__debugbreak();
0
Ritor1
parents:
diff changeset
537
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
538 //v1 = uSlot;
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
539 //v6 = uSlot;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
540 bNotArena = _stricmp(pCurrentMapName, "d05.blv");
0
Ritor1
parents:
diff changeset
541 if ( bNotArena )
Ritor1
parents:
diff changeset
542 {
Ritor1
parents:
diff changeset
543 LOD::Directory pDir; // [sp+Ch] [bp-28h]@2
Ritor1
parents:
diff changeset
544 SaveGame(0, 0);
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
545 //v2 = 100 * v1;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
546 strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName);
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
547 pSavegameHeader[uSlot].uWordTime = pParty->uTimePlayed;
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
548 strcpy(pDir.pFilename, "header.bin");
0
Ritor1
parents:
diff changeset
549 pDir.uDataSize = 100;
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
550 pNew_LOD->Write(&pDir, &pSavegameHeader[uSlot], 0);
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
551 sprintf(pTmpBuf.data(), "saves\\save%03d.mm7", uSlot);
0
Ritor1
parents:
diff changeset
552 pNew_LOD->CloseWriteFile();
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
553 CopyFileA("data\\new.lod", pTmpBuf.data(), 0);
0
Ritor1
parents:
diff changeset
554 }
Ritor1
parents:
diff changeset
555 GUI_UpdateWindows();
Ritor1
parents:
diff changeset
556 pGUIWindow_CurrentMenu->Release();
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 79
diff changeset
557 pCurrentScreen = SCREEN_GAME;
557
604d70894002 Saving works partly
zipi
parents: 515
diff changeset
558 //v3 = pSavegameThumbnails;
0
Ritor1
parents:
diff changeset
559 viewparams->bRedrawGameUI = 1;
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
560 for (uint i = 0; i < 45; i++)
557
604d70894002 Saving works partly
zipi
parents: 515
diff changeset
561 pSavegameThumbnails[i].Release();
604d70894002 Saving works partly
zipi
parents: 515
diff changeset
562 //while ( (signed int)v3 < (signed int)&unk_6A0758 );
0
Ritor1
parents:
diff changeset
563 if ( bNotArena )
Ritor1
parents:
diff changeset
564 pNew_LOD->_4621A7();
Ritor1
parents:
diff changeset
565 else
Ritor1
parents:
diff changeset
566 ShowStatusBarString(pGlobalTXT_LocalizationStrings[583], 2u);// "No saving in the Arena"
1405
c0b273d33338 RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents: 1404
diff changeset
567 pIcons_LOD->RemoveTexturesFromTextureList();
0
Ritor1
parents:
diff changeset
568 pEventTimer->Resume();
Ritor1
parents:
diff changeset
569 ShowStatusBarString(pGlobalTXT_LocalizationStrings[656], 2u);// "Game Saved!"
568
6f7d936edc9b SaveGame/LoadGame sorta works
Nomad
parents: 557
diff changeset
570 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
571 }
Ritor1
parents:
diff changeset
572 // 4E28F8: using guessed type int pCurrentScreen;
Ritor1
parents:
diff changeset
573
Ritor1
parents:
diff changeset
574
Ritor1
parents:
diff changeset
575
Ritor1
parents:
diff changeset
576
Ritor1
parents:
diff changeset
577
Ritor1
parents:
diff changeset
578
Ritor1
parents:
diff changeset
579
Ritor1
parents:
diff changeset
580
Ritor1
parents:
diff changeset
581
Ritor1
parents:
diff changeset
582
Ritor1
parents:
diff changeset
583
Ritor1
parents:
diff changeset
584 //----- (0045E297) --------------------------------------------------------
Ritor1
parents:
diff changeset
585 void SavegameList::Initialize(unsigned int bHideEmptySlots)
Ritor1
parents:
diff changeset
586 {
382
a4a5996fea5b Fixed savelist problem
Gloval
parents: 373
diff changeset
587 memset(pSavegameList, 0, 0x3138);
a4a5996fea5b Fixed savelist problem
Gloval
parents: 373
diff changeset
588 // Reset();
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
589 uNumSavegameFiles = 0;
0
Ritor1
parents:
diff changeset
590
Ritor1
parents:
diff changeset
591 _chdir("saves");
Ritor1
parents:
diff changeset
592 {
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
593 if (!bHideEmptySlots && _access(pGlobalTXT_LocalizationStrings[613], 0) != -1 ) // AutoSave.MM7
382
a4a5996fea5b Fixed savelist problem
Gloval
parents: 373
diff changeset
594 strcpy(pSavegameList->pFileList[uNumSavegameFiles++].pSaveFileName, pGlobalTXT_LocalizationStrings[613]);
0
Ritor1
parents:
diff changeset
595
Ritor1
parents:
diff changeset
596 for (uint i = 0; i < 40; ++i)
Ritor1
parents:
diff changeset
597 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
598 sprintf(pTmpBuf.data(), "save%03d.mm7", i);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
599 if (_access(pTmpBuf.data(), 0) == -1)
0
Ritor1
parents:
diff changeset
600 continue;
Ritor1
parents:
diff changeset
601
Ritor1
parents:
diff changeset
602 uint idx = i;
Ritor1
parents:
diff changeset
603 if (!bHideEmptySlots)
Ritor1
parents:
diff changeset
604 idx = uNumSavegameFiles;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
605 strcpy(pSavegameList->pFileList[idx].pSaveFileName, pTmpBuf.data());
0
Ritor1
parents:
diff changeset
606
Ritor1
parents:
diff changeset
607 ++uNumSavegameFiles;
Ritor1
parents:
diff changeset
608 }
Ritor1
parents:
diff changeset
609 }
Ritor1
parents:
diff changeset
610 _chdir("..");
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
611 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
612 //----- (0046086A) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
613 void SaveNewGame()
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
614 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
615 FILE *v3; // eax@7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
616 void *pSave; // [sp+170h] [bp-8h]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
617
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
618 if ( pVideoPlayer->AnyMovieLoaded() )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
619 pVideoPlayer->Unload();
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
620 pSave = malloc(1000000);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
621 pNew_LOD->CloseWriteFile();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
622 remove("data\\new.lod");
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
623
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
624 LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
625 strcpy(this_.LodVersion, "MMVII");
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
626 strcpy(this_.LodDescription, "newmaps for MMVII");
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
627 this_.LODSize = 100;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
628 this_.dword_0000A8 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
629
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
630 LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
631 a3.dword_000018 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
632 a3.word_00001E = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
633 strcpy(a3.pFilename, "current");
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
634 pNew_LOD->CreateNewLod(&this_, &a3, "data\\new.lod");
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
635 if (pNew_LOD->LoadFile("data\\new.lod", false))
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
636 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
637 pNew_LOD->CreateTempFile();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
638 pNew_LOD->uNumSubDirs = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
639
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
640 LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
641 for (int i = pGames_LOD->uNumSubDirs / 2; i < pGames_LOD->uNumSubDirs; ++i)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
642 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
643 memcpy(&pDir, &pGames_LOD->pSubIndices[i], sizeof(pDir));
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
644 v3 = pGames_LOD->FindContainer(pGames_LOD->pSubIndices[i].pFilename, 1);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
645 fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
646 pNew_LOD->AppendDirectory(&pDir, pSave);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
647 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
648
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
649 LOD::Directory save_game_dir; // [sp+12Ch] [bp-4Ch]@9
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
650 strcpy(pSavegameHeader[0].pLocationName, "out01.odm");
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
651 strcpy(save_game_dir.pFilename, "header.bin");
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
652 save_game_dir.uDataSize = sizeof(SavegameHeader);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
653 pNew_LOD->AppendDirectory(&save_game_dir, &pSavegameHeader[0]);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
654
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
655 pNew_LOD->FixDirectoryOffsets();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
656 pParty->vPrevPosition.y = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
657 pParty->vPrevPosition.x = 12552;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
658 pParty->vPosition.x = 12552;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
659 pParty->vPosition.z = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
660 pParty->uFallStartY = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
661 pParty->sPrevRotationX = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
662 pParty->sRotationX = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
663 pParty->vPrevPosition.z = 1816;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
664 pParty->vPosition.y = 1816;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
665 pParty->sPrevRotationY = 512;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
666 pParty->sRotationY = 512;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
667 SaveGame(1, 1);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
668 }
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
669 free(pSave);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
670 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
671 //----- (0045E03A) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
672 unsigned short * MakeScreenshot( signed int width, signed int height )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
673 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
674 //signed int v2; // edi@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
675 unsigned __int16 *v3; // ebx@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
676 int v4; // edx@7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
677 unsigned __int8 v5; // cf@9
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
678 unsigned int v6; // ecx@9
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
679 unsigned __int16 *v7; // edi@9
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
680 int j; // ecx@9
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
681 //unsigned __int16 *v9; // edi@15
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
682 //int v10; // ecx@15
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
683 //LONG v11; // esi@15
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
684 //signed __int64 v12; // qax@18
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
685 //unsigned int v13; // ST10_4@21
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
686 HRESULT v14; // eax@21
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
687 int v15; // edi@29
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
688 signed __int64 v16; // qax@30
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
689 signed int v17; // edx@34
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
690 unsigned __int16 *v18; // edi@36
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
691 int k; // ecx@36
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
692 DDSURFACEDESC2 Dst; // [sp+4h] [bp-A0h]@6
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
693 unsigned __int16 *pPixels; // [sp+80h] [bp-24h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
694 float v23; // [sp+84h] [bp-20h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
695 unsigned __int16 *_this; // [sp+88h] [bp-1Ch]@21
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
696 float v25; // [sp+8Ch] [bp-18h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
697 unsigned int v26; // [sp+90h] [bp-14h]@17
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
698 //int v27; // [sp+94h] [bp-10h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
699 int v28; // [sp+98h] [bp-Ch]@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
700 int v29; // [sp+9Ch] [bp-8h]@15
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
701 //int v30; // [sp+A0h] [bp-4h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
702
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
703 //v30 = width;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
704 //v2 = height;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
705 //v27 = height;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
706 v23 = game_viewport_width / (double)width;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
707 v25 = game_viewport_height / (double)height;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
708
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
709 pPixels = (unsigned __int16 *)malloc(2 * height * width);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
710 memset(pPixels, 0 , 2 * height * width);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
711
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
712 v3 = pPixels;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
713 if ( pRenderer->pRenderD3D )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
714 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
715 pRenderer->BeginSceneD3D();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
716
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
717 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
718 pIndoor->Draw();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
719 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
720 pOutdoor->Draw();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
721
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
722 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
723 memset(&Dst, 0, 0x7Cu);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
724 Dst.dwSize = sizeof(Dst);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
725
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
726 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
727 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
728 ushort* src = (unsigned __int16 *)Dst.lpSurface;
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
729 ulong src_width = (Dst.lPitch / sizeof(short));
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
730 ulong src_height = Dst.dwHeight;
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
731 ushort* dst = pPixels;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
732 for (uint y = 0; y < height; ++y)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
733 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
734 //uint src_y = (game_viewport_y + y * v25) * (Dst.lPitch / sizeof(short));
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
735 uint src_y = game_viewport_y + y * v25;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1489
diff changeset
736 Assert(game_viewport_y + y * v25 < src_height);
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1489
diff changeset
737 Assert(y < height);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
738
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
739 for (uint x = 0; x < width; ++x)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
740 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
741 //uint src_x = game_viewport_x + x * v23;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
742 uint src_x = game_viewport_x + x * v23;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1489
diff changeset
743 Assert(src_x < src_width);
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1489
diff changeset
744 Assert(x < width);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
745
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
746 dst[y * width + x] = (((63*y)/117) << 5) | 31*x/155;//31*y/117;//src[src_y * src_width + src_x];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
747 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
748 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
749 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
750 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
751 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
752 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
753 __debugbreak(); // unrefactored
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
754 v4 = height;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
755 if ( height > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
756 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
757 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
758 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
759 if ( width > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
760 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
761 v5 = width & 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
762 v6 = (unsigned int)width >> 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
763 memset(v3, 0, 4 * ((unsigned int)width >> 1));
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
764 v7 = &v3[2 * v6];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
765 for ( j = v5; j; --j )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
766 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
767 *v7 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
768 ++v7;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
769 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
770 v3 += width;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
771 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
772 --v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
773 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
774 while ( v4 );
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
775 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
776 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
777 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
778 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
779 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
780 pRenderer->BeginScene();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
781 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
782 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
783 pIndoor->Draw();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
784 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
785 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
786 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
787 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
788 pOutdoor->Draw();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
789 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
790 _this = pRenderer->pTargetSurface;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
791 v26 = pRenderer->uTargetSurfacePitch;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
792 if ( pRenderer->pTargetSurface )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
793 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
794 if ( height > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
795 {
1430
71a2cf416478 LloydBeacons
Ritor1
parents: 1405
diff changeset
796 for ( v29 = 0; v29 < height; ++v29 )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
797 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
798 if ( width > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
799 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
800 v15 = v26 * (unsigned __int64)(signed __int64)((double)v29 * v25 + 8.0);
1430
71a2cf416478 LloydBeacons
Ritor1
parents: 1405
diff changeset
801 for ( v28 = 0; v28 < width; v28++ )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
802 {
1430
71a2cf416478 LloydBeacons
Ritor1
parents: 1405
diff changeset
803 *v3 = _this[v15 + (int)(signed __int64)((double)v28 * v23 + 8.0)];
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
804 ++v3;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
805 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
806 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
807 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
808 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
809 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
810 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
811 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
812 if ( height > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
813 {
1430
71a2cf416478 LloydBeacons
Ritor1
parents: 1405
diff changeset
814 for ( v17 = height; v17; --v17 )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
815 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
816 if ( width > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
817 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
818 memset(v3, 0, 4 * ((unsigned int)width >> 1));
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
819 v18 = &v3[2 * ((unsigned int)width >> 1)];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
820 for ( k = width & 1; k; --k )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
821 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
822 *v18 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
823 ++v18;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
824 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
825 v3 += width;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
826 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
827 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
828 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
829 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
830 pRenderer->EndScene();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
831 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
832 return pPixels;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
833 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
834 //----- (0045E26C) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1430
diff changeset
835 void SaveScreenshot(const char *pFilename)
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
836 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
837 unsigned __int16 *v2; // esi@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
838
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
839 v2 = MakeScreenshot(92, 68);
1430
71a2cf416478 LloydBeacons
Ritor1
parents: 1405
diff changeset
840 pRenderer->SavePCXImage(pFilename, (char *)v2, 92, 68);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1207
diff changeset
841 free(v2);
0
Ritor1
parents:
diff changeset
842 }