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