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