Mercurial > mm7
diff SaveLoad.cpp @ 2173:daa61976637d
savegame and loadgame continue
author | Ritor1 |
---|---|
date | Tue, 21 Jan 2014 00:59:21 +0600 |
parents | 9bd7522cdbbb |
children | 5ca3251ea543 |
line wrap: on
line diff
--- a/SaveLoad.cpp Mon Jan 20 17:25:01 2014 +0600 +++ b/SaveLoad.cpp Tue Jan 21 00:59:21 2014 +0600 @@ -79,7 +79,7 @@ break; } - for (uint j = 0; j < pSoundList->sNumSounds; ++j) + for (uint j = 0; j < pSoundList->sNumSounds; ++j) if (pSoundList->pSL_Sounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999) { pSoundList->UnloadSound(j, 1); @@ -94,72 +94,72 @@ int e = GetLastError(); pNew_LOD->LoadFile("data\\new.lod", 0); - FILE *f = pNew_LOD->FindContainer("header.bin", 1); - if (!f) + FILE *file = pNew_LOD->FindContainer("header.bin", 1); + if (!file) { - sprintf(Str, pGlobalTXT_LocalizationStrings[612], 100); + sprintf(Str, pGlobalTXT_LocalizationStrings[612], 100);//Сохраненная игра повреждена! Code=%d Log::Warning(L"%S", Str); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:549", 0); } Assert(sizeof(SavegameHeader) == 100); - fread(&header, sizeof(SavegameHeader), 1, f); + fread(&header, sizeof(SavegameHeader), 1, file); - f = pNew_LOD->FindContainer("party.bin", 1); - if (!f) + file = pNew_LOD->FindContainer("party.bin", 1); + if (!file) { - sprintf(Str, pGlobalTXT_LocalizationStrings[612], 101); + sprintf(Str, pGlobalTXT_LocalizationStrings[612], 101);//Сохраненная игра повреждена! Code=%d 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); + fread(pParty, sizeof(Party), 1, file); - f = pNew_LOD->FindContainer("clock.bin", 1); - if (!f) + file = pNew_LOD->FindContainer("clock.bin", 1); + if (!file) { - sprintf(Str, pGlobalTXT_LocalizationStrings[612], 102); + sprintf(Str, pGlobalTXT_LocalizationStrings[612], 102);//Сохраненная игра повреждена! Code=%d 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); + fread(pEventTimer, sizeof(Timer), 1, file); - f = pNew_LOD->FindContainer("overlay.bin", 1); - if (!f) + file = pNew_LOD->FindContainer("overlay.bin", 1); + if (!file) { - sprintf(Str, pGlobalTXT_LocalizationStrings[612], 103); + sprintf(Str, pGlobalTXT_LocalizationStrings[612], 103);//Сохраненная игра повреждена! Code=%d 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); + fread(pOtherOverlayList, sizeof(OtherOverlayList), 1, file); - f = pNew_LOD->FindContainer("npcdata.bin", 0); - if (!f) + file = pNew_LOD->FindContainer("npcdata.bin", 0); + if (!file) { - sprintf(Str, pGlobalTXT_LocalizationStrings[612], 104); + sprintf(Str, pGlobalTXT_LocalizationStrings[612], 104);//Сохраненная игра повреждена! Code=%d 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); + fread(pNPCStats->pNewNPCData, sizeof(pNPCStats->pNewNPCData), 1, file); pNPCStats->_476C60(); - f = pNew_LOD->FindContainer("npcgroup.bin", 0); - if (!f) + file = pNew_LOD->FindContainer("npcgroup.bin", 0); + if (!file) { - sprintf(Str, pGlobalTXT_LocalizationStrings[612], 105); + sprintf(Str, pGlobalTXT_LocalizationStrings[612], 105);//Сохраненная игра повреждена! Code=%d 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); + fread(pNPCStats->pGroups_copy, sizeof(pNPCStats->pGroups_copy), 1, file); uActiveCharacter = 0; @@ -182,7 +182,7 @@ if (uEquipIdx) { int uItemID = pParty->pPlayers[i].pInventoryItemList[uEquipIdx - 1].uItemID; - if (pItemsTable->pItems[uItemID].uEquipType == 12) + if (pItemsTable->pItems[uItemID].uEquipType == EQUIP_WAND)//жезл { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 v31 = *((int *)&pSpellDatas[66].uNormalLevelRecovery + uItemID); @@ -192,7 +192,6 @@ } } - pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_GAME; @@ -254,7 +253,7 @@ unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23 //v66 = a2; - strcpy(byte_6BE3B0.data(), pCurrentMapName); + strcpy(byte_6BE3B0.data(), pCurrentMapName);//byte_6BE3B0 - save_map_name if (!_stricmp(pCurrentMapName, "d05.blv")) // arena return; @@ -414,8 +413,8 @@ } memcpy(data_write_pos, &uNumActors, 4); data_write_pos += 4; - memcpy(data_write_pos, pActors.data(), 836 * uNumActors); - data_write_pos += 836 * uNumActors; + memcpy(data_write_pos, &pActors, uNumActors * sizeof(Actor)); + data_write_pos += uNumActors * sizeof(Actor); memcpy(data_write_pos, &uNumSpriteObjects, 4); data_write_pos += 4; memcpy(data_write_pos, pSpriteObjects.data(), 112 * uNumSpriteObjects); @@ -553,17 +552,17 @@ pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_GAME; //v3 = pSavegameThumbnails; - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; for (uint i = 0; i < 45; i++) pSavegameThumbnails[i].Release(); if ( bNotArena ) pNew_LOD->_4621A7(); else - ShowStatusBarString(pGlobalTXT_LocalizationStrings[583], 2u);// "No saving in the Arena" + ShowStatusBarString(pGlobalTXT_LocalizationStrings[583], 2);// "No saving in the Arena" pIcons_LOD->RemoveTexturesFromTextureList(); pEventTimer->Resume(); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[656], 2u);// "Game Saved!" + ShowStatusBarString(pGlobalTXT_LocalizationStrings[656], 2);// "Game Saved!" viewparams->bRedrawGameUI = true; } // 4E28F8: using guessed type int pCurrentScreen;