Mercurial > might-and-magic-trilogy
view SaveLoad.cpp @ 76:75994455e457
BLV collisions
author | Nomad |
---|---|
date | Sat, 27 Oct 2012 22:25:38 +0200 |
parents | 05e4b4bd4d64 |
children | a84fb3752681 |
line wrap: on
line source
#include <io.h> #include <direct.h> #include "SaveLoad.h" #include "NPC.h" #include "Party.h" #include "LOD.h" #include "Outdoor.h" #include "AudioPlayer.h" #include "Actor.h" #include "Chest.h" #include "Time.h" #include "GUIWindow.h" #include "GUIFont.h" #include "Overlays.h" #include "LayingItem.h" #include "Viewport.h" #include "stru123.h" #include "Log.h" #include "mm7_data.h" struct SavegameList *pSavegameList = new SavegameList; unsigned int uNumSavegameFiles; unsigned int pSavegameUsedSlots[45]; struct RGBTexture *pSavegameThumbnails = new RGBTexture[45]; SavegameHeader *pSavegameHeader = new SavegameHeader[45]; //----- (0045EE8A) -------------------------------------------------------- void __fastcall LoadGame(unsigned int uSlot) { bool v25; // esi@62 bool v26; // eax@62 int v30; // [sp-Ch] [bp-FCh]@65 int v31; // [sp-8h] [bp-F8h]@4 char DstBuf[100]; // [sp+Ch] [bp-E4h]@23 char Str[123]; // [sp+70h] [bp-80h]@25 dword_5B65C8 = 0; if (!pSavegameUsedSlots[uSlot]) { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); Log::Warning(L"LoadGame: slot %u is empty", uSlot); return; } for (uint i = 1; i < 5; ++i) for (uint j = 1; j < 6; ++j) { sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j); remove(pTmpBuf); } if (byte_4ED498) for (uint i = 0; i < 4; ++i) { for (uint j = 0; j < pSoundList->uNumSounds; ++j) if (pSoundList->pSounds[j].uSoundID == 2 * (byte_4ED498 + 50 * pParty->pPlayers[i].uVoiceID) + 4998) { pSoundList->_4A9DCD(j, 1); break; } for (uint j = 0; j < pSoundList->uNumSounds; ++j) if (pSoundList->pSounds[j].uSoundID == 2 * (byte_4ED498 + 50 * pParty->pPlayers[i].uVoiceID) + 4999) { pSoundList->_4A9DCD(j, 1); break; } } sprintf(pTmpBuf, "saves\\%s", pSavegameList->pSavesNames[uSlot]); pNew_LOD->CloseWriteFile(); if (!CopyFileA(pTmpBuf, "data\\new.lod", 0)) int e = GetLastError(); pNew_LOD->LoadFile("data\\new.lod", 0); auto *f = pNew_LOD->FindContainer("header.bin", 1); if (!f) { sprintf(Str, pGlobalTXT_LocalizationStrings[612], 100); Log::Warning(L"%S", Str); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:549", 0); } fread(&DstBuf, 0x64u, 1u, f); f = pNew_LOD->FindContainer("party.bin", 1); if (!f) { sprintf(Str, pGlobalTXT_LocalizationStrings[612], 101); Log::Warning(L"%S", Str); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:559", 0); } if (sizeof(Party) != 0x16238) Log::Warning(L"class Party: deserialization warning"); fread(pParty, 0x16238u, 1, f); f = pNew_LOD->FindContainer("clock.bin", 1); if (!f) { sprintf(Str, pGlobalTXT_LocalizationStrings[612], 102); Log::Warning(L"%S", Str); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:569", 0); } if (sizeof(Timer) != 0x28) Log::Warning(L"class Timer: deserialization warning"); fread(pEventTimer, 0x28u, 1u, f); f = pNew_LOD->FindContainer("overlay.bin", 1); if (!f) { sprintf(Str, pGlobalTXT_LocalizationStrings[612], 103); Log::Warning(L"%S", Str); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:579", 0); } if (sizeof(OtherOverlayList) != 0x3F0) Log::Warning(L"class OtherOverlayList: deserialization warning"); fread(pOtherOverlayList, 0x3F0, 1, f); f = pNew_LOD->FindContainer("npcdata.bin", 0); if (!f) { sprintf(Str, pGlobalTXT_LocalizationStrings[612], 104); Log::Warning(L"%S", Str); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:590", 0); } if (sizeof(pNPCStats->pNewNPCData) != 0x94BC) Log::Warning(L"NPCStats: deserialization warning"); fread(pNPCStats->pNewNPCData, 0x94BC, 1, f); pNPCStats->_476C60(); f = pNew_LOD->FindContainer("npcgroup.bin", 0); if (!f) { sprintf(Str, pGlobalTXT_LocalizationStrings[612], 105); Log::Warning(L"%S", Str); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:600", 0); } if (sizeof(pNPCStats->pGroups_copy) != 0x66) Log::Warning(L"NPCStats: deserialization warning"); fread(pNPCStats->pGroups_copy, 0x66, 1, f); uActiveCharacter = 0; for (uint i = 0; i < 4; ++i) if (pParty->pPlayers[i].CanAct()) { uActiveCharacter = i + 1; break; } for (uint i = 0; i < 4; ++i) { auto uQuickspell = pParty->pPlayers[i].uQuickSpell; if (uQuickspell) stru_AA1058[i]._494836(uQuickspell, i + 9 - 8); for (uint j = 0; j < 2; ++j) { uint uEquipIdx = pParty->pPlayers[i].pEquipment.pIndices[j]; if (uEquipIdx) { auto uItemID = pParty->pPlayers[i].pInventoryItems[uEquipIdx - 1].uItemID; if (pItemsTable->pItems[uItemID].uEquipType == 12) { __debugbreak(); v31 = *((int *)&pSpellDatas[66].field_8 + uItemID); stru_A750F8[i]._494836(v31, i + 9); } } } } pGUIWindow_CurrentMenu->Release(); pCurrentScreen = 0; viewparams->bRedrawGameUI = true; SetUserInterface(pParty->uAlignment, true); pEventTimer->Resume(); pEventTimer->StopGameTime(); v25 = pGames_LOD->DoesContainerExist(&DstBuf[20]); sprintf(pTmpBuf, "levels\\%s", &DstBuf[20]); v26 = _access(pTmpBuf, 4) != -1; if ( !v25 && !v26 ) { sprintf(pTmpBuf, "Unable to find: %s!", &DstBuf[20]); Abortf(pTmpBuf); } strcpy(pCurrentMapName, &DstBuf[20]); dword_6BE364_game_settings_1 |= 0x2001; for (uint i = 0; i < uNumSavegameFiles; ++i) pSavegameThumbnails[i].Release(); pIcons_LOD->_4114F2(); pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0); pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0); if (uTurnSpeed) pParty->sRotationY = uTurnSpeed * pParty->sRotationY / (signed int)uTurnSpeed; MM7Initialization(); bFlashQuestBook = false; viewparams->bRedrawGameUI = true; } //----- (0045F469) -------------------------------------------------------- int __fastcall SaveGame(int a1, __int16 *a2) { int result; // eax@1 void *v3; // edi@5 int v4; // eax@6 int v5; // eax@6 int v6; // eax@6 const char *v7; // edi@8 FILE *v8; // edi@24 int v9; // edi@30 void *v10; // esi@31 void *v11; // esi@31 void *v12; // esi@37 void *v13; // esi@37 void *v14; // esi@37 void *v15; // esi@37 void *v16; // esi@37 int v17; // esi@37 unsigned int v18; // ecx@38 unsigned int v19; // esi@39 char *v20; // edx@39 void *v21; // esi@41 void *v22; // esi@41 BSPModel *v23; // eax@42 signed int v24; // edi@42 unsigned __int8 v25; // zf@43 unsigned __int8 v26; // sf@43 signed int v27; // edi@47 void *v28; // esi@50 void *v29; // esi@50 void *v30; // esi@50 void *v31; // esi@50 int v32; // esi@51 int v33; // eax@51 DWORD v34; // eax@59 std::string v35; // [sp-18h] [bp-288h]@8 const char *v36; // [sp-10h] [bp-280h]@6 const char *v37; // [sp-Ch] [bp-27Ch]@6 const char *v38; // [sp-8h] [bp-278h]@8 int v39; // [sp-4h] [bp-274h]@8 CHAR Buffer; // [sp+Ch] [bp-264h]@59 char Dir; // [sp+8Ch] [bp-1E4h]@51 char Drive; // [sp+ACh] [bp-1C4h]@51 int v43; // [sp+CCh] [bp-1A4h]@10 char Dest[20]; // [sp+E0h] [bp-190h]@10 unsigned __int64 v45; // [sp+F4h] [bp-17Ch]@10 char Filename; // [sp+130h] [bp-140h]@51 char Ext; // [sp+150h] [bp-120h]@51 char v48; // [sp+151h] [bp-11Fh]@51 char Source[32]; // [sp+170h] [bp-100h]@51 char Str[120]; // [sp+190h] [bp-E0h]@8 int v51; // [sp+208h] [bp-68h]@2 int v52; // [sp+20Ch] [bp-64h]@2 int v53; // [sp+210h] [bp-60h]@2 int v54; // [sp+214h] [bp-5Ch]@2 int Src; // [sp+218h] [bp-58h]@30 char v56; // [sp+21Ch] [bp-54h]@30 char v57; // [sp+21Dh] [bp-53h]@30 char v58; // [sp+21Eh] [bp-52h]@30 char v59; // [sp+21Fh] [bp-51h]@30 int v60; // [sp+220h] [bp-50h]@30 int v61; // [sp+224h] [bp-4Ch]@30 int v62; // [sp+228h] [bp-48h]@2 LOD::Directory pDir; // [sp+22Ch] [bp-44h]@2 //std::string *v64; // [sp+24Ch] [bp-24h]@1 size_t Size; // [sp+250h] [bp-20h]@26 __int16 *v66; // [sp+254h] [bp-1Ch]@1 void *DstBuf; // [sp+258h] [bp-18h]@2 __int16 *v68; // [sp+25Ch] [bp-14h]@32 unsigned int v69; // [sp+260h] [bp-10h]@23 int v70; // [sp+264h] [bp-Ch]@22 std::string *v71; // [sp+268h] [bp-8h]@8 int a3; // [sp+26Fh] [bp-1h]@8 v66 = a2; //v64 = (std::string *)a1; strcpy(byte_6BE3B0, pCurrentMapName); if (!_strcmpi(pCurrentMapName, "d05.blv")) return false; DstBuf = malloc(0xF4240u); pDir.Reset(); v52 = pParty->vPosition.x; v51 = pParty->vPosition.y; v62 = pParty->vPosition.z; v53 = pParty->sRotationY; v54 = pParty->sRotationX; pParty->vPosition.x = pParty->vPrevPosition.x; pParty->vPosition.y = pParty->vPrevPosition.z; pParty->vPosition.z = pParty->vPrevPosition.y; pParty->uFallStartY = pParty->vPrevPosition.y; pParty->sRotationY = pParty->sPrevRotationY; pParty->sRotationX = pParty->sPrevRotationX; if (uCurrentlyLoadedLevelType == LEVEL_Indoor) pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed; else pOutdoor->uLastVisitDay = pParty->uTimePlayed; v3 = MakeScreenshot(150, 112); { strcpy(pDir.pFilename, "image.pcx"); pRenderer->_49F5A2((int)v3, 150, 112, DstBuf, 1000000, (int)&pDir.uDataSize); } free(v3); if ( pCurrentScreen == 11 ) { pRenderer->DrawTextureIndexed( 8u, 8u, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); pRenderer->DrawTextureIndexed( 0x12u, 0x8Du, (Texture *)(uTextureID_save_up != -1 ? &pIcons_LOD->pTextures[uTextureID_save_up] : 0)); v36 = pGlobalTXT_LocalizationStrings[190]; v4 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[190]); pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v4 + 25, 219, 0, v36, 0, 0, 0); v37 = (const char *)(&pSavegameHeader + uLoadGameUI_SelectedSlot); v5 = pFontSmallnum->AlignText_Center(0xBAu, (const char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot); pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v5 + 25, 0x103u, 0, v37, 185, 0); v36 = pGlobalTXT_LocalizationStrings[165]; v6 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[165]); pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v6 + 25, 299, 0, v36, 0, 0, 0); pRenderer->Present(); } if ( pNew_LOD->Write(&pDir, DstBuf, 0) ) { sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 200); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0); } else { v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp"; } strcpy(Dest, pCurrentMapName); v45 = pParty->uTimePlayed; strcpy((char *)&pDir, "header.bin"); pDir.uDataSize = 100; if ( pNew_LOD->Write(&pDir, &v43, 0) ) { v39 = 201; sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 201); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0); } strcpy((char *)&pDir, "party.bin"); pDir.uDataSize = 90680; if ( pNew_LOD->Write(&pDir, &pParty, 0) ) { v39 = 202; sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 202); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0); } strcpy((char *)&pDir, "Timer.bin"); pDir.uDataSize = 40; if ( pNew_LOD->Write(&pDir, &pEventTimer, 0) ) { v39 = 203; sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 203); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0); } strcpy((char *)&pDir, "overlay.bin"); pDir.uDataSize = 1008; if ( pNew_LOD->Write(&pDir, &pOtherOverlayList, 0) ) { v39 = 204; sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 204); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0); } strcpy((char *)&pDir, "npcdata.bin"); pDir.uDataSize = 38076; if ( pNew_LOD->Write(&pDir, pNPCStats->pNewNPCData, 0) ) { v39 = 205; sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 205); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0); } strcpy((char *)&pDir, "npcgroup.bin"); pDir.uDataSize = 102; if ( pNew_LOD->Write(&pDir, pNPCStats->pGroups_copy, 0) ) { v39 = 206; sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 206); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0); } v70 = 1; do { v69 = 1; do { v39 = v69; v38 = (const char *)v70; sprintfex(Str, "data\\lloyd%d%d.pcx", v70, v69); v8 = fopen(Str, "rb"); if ( v8 ) { v39 = v69; v38 = (const char *)v70; sprintfex(Str, "lloyd%d%d.pcx", v70, v69); fseek(v8, 0, 2); pDir.uDataSize = ftell(v8); rewind(v8); fread(DstBuf, pDir.uDataSize, 1u, v8); strcpy((char *)&pDir, Str); fclose(v8); remove(Str); if ( pNew_LOD->Write(&pDir, DstBuf, 0) ) { v39 = 207; sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 207); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0); Size = 5080748; } } ++v69; } while ( (signed int)v69 <= 5 ); ++v70; } while ( v70 <= 4 ); if ( !a2 ) { sub_42FA22_mess_with_laying_item_list(); v9 = (int)malloc(0xF4240u); v71 = (std::string *)v9; Src = 91969; v56 = 109; v57 = 118; v58 = 105; v59 = 105; v60 = 0; v61 = 0; memcpy((void *)v9, &Src, 0x10u); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { v10 = DstBuf; pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces; pIndoor->dlv.uNumBModels = 0; pIndoor->dlv.uNumDecorations = uNumLevelDecorations; memcpy(DstBuf, &pIndoor->dlv, 0x28u); v10 = (char *)v10 + 40; memcpy(v10, pIndoor->_visible_outlines, 0x36Bu); v11 = (char *)v10 + 875; v70 = 0; if ( (signed int)pIndoor->uNumFaces > 0 ) { v68 = 0; do { v38 = (char *)v68 + (unsigned int)pIndoor->pFaces + 44; memcpy(v11, v38, 4u); v68 += 48; v11 = (char *)v11 + 4; ++v70; } while ( v70 < (signed int)pIndoor->uNumFaces ); } v70 = 0; if ( (signed int)uNumLevelDecorations > 0 ) { v68 = &pLevelDecorations[0].field_2; do { memcpy(v11, v68, 2u); v68 += 16; v11 = (char *)v11 + 2; ++v70; } while ( v70 < (signed int)uNumLevelDecorations ); } memcpy(v11, &uNumActors, 4u); v12 = (char *)v11 + 4; memcpy(v12, pActors, 836 * uNumActors); v13 = (char *)v12 + 836 * uNumActors; memcpy(v13, &uNumLayingItems, 4u); v13 = (char *)v13 + 4; memcpy(v13, pLayingItems, 112 * uNumLayingItems); v14 = (char *)v13 + 112 * uNumLayingItems; memcpy(v14, &uNumChests, 4u); v14 = (char *)v14 + 4; memcpy(v14, pChests, 5324 * uNumChests); v15 = (char *)v14 + 5324 * uNumChests; memcpy(v15, pIndoor->pDoors, 0x3E80u); v15 = (char *)v15 + 16000; memcpy(v15, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size); v16 = (char *)v15 + pIndoor->blv.uDoors_ddata_Size; memcpy(v16, &stru_5E4C90, 0xC8u); v17 = (int)((char *)v16 + 200); memcpy((void *)v17, &pIndoor->stru1, 0x38u); } else { v18 = 0; pOutdoor->ddm.uNumFacesInBModels = 0; if ( (signed int)pOutdoor->uNumBModels > 0 ) { v19 = pOutdoor->uNumBModels; v20 = (char *)&pOutdoor->pBModels->uNumFaces; do { v18 += *(int *)v20; v20 += 188; --v19; pOutdoor->ddm.uNumFacesInBModels = v18; } while ( v19 ); } v21 = DstBuf; pOutdoor->ddm.uNumBModels = pOutdoor->uNumBModels; pOutdoor->ddm.uNumDecorations = uNumLevelDecorations; memcpy(DstBuf, &pOutdoor->ddm, 0x28u); v21 = (char *)v21 + 40; memcpy(v21, pOutdoor->array_528, 0x3C8u); v21 = (char *)v21 + 968; memcpy(v21, pOutdoor->array_8F0, 0x3C8u); v22 = (char *)v21 + 968; v70 = 0; if ( (signed int)pOutdoor->uNumBModels > 0 ) { v23 = pOutdoor->pBModels; v24 = 76; do { v25 = *(int *)&v23->pModelName[v24] == 0; v26 = *(int *)&v23->pModelName[v24] < 0; v66 = 0; if ( !(v26 | v25) ) { v68 = 0; do { v38 = (char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28; memcpy(v22, v38, 4u); v23 = pOutdoor->pBModels; v68 += 154; v22 = (char *)v22 + 4; v66 = (__int16 *)((char *)v66 + 1); } while ( (signed int)v66 < *(int *)&pOutdoor->pBModels->pModelName[v24] ); } ++v70; v24 += 188; } while ( v70 < (signed int)pOutdoor->uNumBModels ); } v27 = 0; if ( (signed int)uNumLevelDecorations > 0 ) { v66 = &pLevelDecorations[0].field_2; do { memcpy(v22, v66, 2u); v66 += 16; v22 = (char *)v22 + 2; ++v27; } while ( v27 < (signed int)uNumLevelDecorations ); } memcpy(v22, &uNumActors, 4u); v28 = (char *)v22 + 4; memcpy(v28, pActors, 836 * uNumActors); v29 = (char *)v28 + 836 * uNumActors; memcpy(v29, &uNumLayingItems, 4u); v29 = (char *)v29 + 4; memcpy(v29, pLayingItems, 112 * uNumLayingItems); v30 = (char *)v29 + 112 * uNumLayingItems; memcpy(v30, &uNumChests, 4u); v30 = (char *)v30 + 4; memcpy(v30, pChests, 5324 * uNumChests); v31 = (char *)v30 + 5324 * uNumChests; memcpy(v31, &stru_5E4C90, 0xC8u); v17 = (int)((char *)v31 + 200); memcpy((void *)v17, &pOutdoor->uLastVisitDay, 0x38u); v9 = (int)v71; } v32 = v17 + 56; strcpy(Source, pCurrentMapName); _splitpath(Source, &Drive, &Dir, &Filename, &Ext); v48 = 100; Size = v32 - (int)DstBuf; v69 = 999984; LOBYTE(v33) = zlib::MemZip((char *)v9 + 16, (unsigned int *)&v69, DstBuf, v32 - (int)DstBuf); if ( v33 || (signed int)v69 > (signed int)Size ) { memcpy((void *)(v9 + 16), DstBuf, Size); v69 = Size; } v69 += 16; memcpy((void *)(v9 + 8), &v69, 4u); memcpy((void *)(v9 + 12), &Size, 4u); sprintfex(Source, "%s%s", &Filename, &Ext); strcpy((char *)&pDir, Source); pDir.uDataSize = v69; if ( pNew_LOD->Write(&pDir, (const void *)v9, 0) ) { v39 = 208; sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 208); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1071", 0); } free((void *)v9); } free(DstBuf); if ( a1 ) { if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) ) { v34 = GetLastError(); FormatMessageA(0x1000u, 0, v34, 0x400u, &Buffer, 0x80u, 0); v39 = 300; sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 300); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1097", 0); } } pParty->vPosition.x = v52; pParty->vPosition.y = v51; pParty->vPosition.z = v62; pParty->uFallStartY = v62; pParty->sRotationY = v53; result = v54; pParty->sRotationX = v54; return result; } //----- (00460078) -------------------------------------------------------- void __fastcall DoSavegame(unsigned int uSlot) { unsigned int v1; // esi@1 int v2; // esi@2 RGBTexture *v3; // ebx@3 int bNotArena; // [sp+2Ch] [bp-8h]@1 unsigned int v6; // [sp+30h] [bp-4h]@1 v1 = uSlot; v6 = uSlot; bNotArena = _strcmpi(pCurrentMapName, "d05.blv"); if ( bNotArena ) { LOD::Directory pDir; // [sp+Ch] [bp-28h]@2 SaveGame(0, 0); v2 = 100 * v1; strcpy(&pSavegameHeader->pLocationName[v2], pCurrentMapName); *(int *)((char *)&pSavegameHeader->uWordTime + v2) = LODWORD(pParty->uTimePlayed); *(int *)((char *)&pSavegameHeader->uWordTime + v2 + 4) = HIDWORD(pParty->uTimePlayed); strcpy((char *)&pDir, "header.bin"); pDir.uDataSize = 100; pNew_LOD->Write(&pDir, (char *)&pSavegameHeader + v2, 0); sprintfex(pTmpBuf, "saves\\save%03d.mm7", v6); pNew_LOD->CloseWriteFile(); CopyFileA("data\\new.lod", pTmpBuf, 0); } GUI_UpdateWindows(); pGUIWindow_CurrentMenu->Release(); pCurrentScreen = 0; v3 = pSavegameThumbnails; viewparams->bRedrawGameUI = 1; do { v3->Release(); ++v3; } while ( (signed int)v3 < (signed int)&unk_6A0758 ); if ( bNotArena ) pNew_LOD->_4621A7(); else ShowStatusBarString(pGlobalTXT_LocalizationStrings[583], 2u);// "No saving in the Arena" pIcons_LOD->_4355F7(); pEventTimer->Resume(); ShowStatusBarString(pGlobalTXT_LocalizationStrings[656], 2u);// "Game Saved!" viewparams->bRedrawGameUI = 1; } // 4E28F8: using guessed type int pCurrentScreen; //----- (0045E297) -------------------------------------------------------- void SavegameList::Initialize(unsigned int bHideEmptySlots) { uNumSavegameFiles = 0; _chdir("saves"); { if (!bHideEmptySlots && _access(pGlobalTXT_LocalizationStrings[613], 0) != -1 ) strcpy(pSavesNames[uNumSavegameFiles++], pGlobalTXT_LocalizationStrings[613]); for (uint i = 0; i < 40; ++i) { sprintf(pTmpBuf, "save%03d.mm7", i); if (_access(pTmpBuf, 0) == -1) continue; uint idx = i; if (!bHideEmptySlots) idx = uNumSavegameFiles; strcpy(pSavesNames[idx], pTmpBuf); ++uNumSavegameFiles; } } _chdir(".."); }