Mercurial > might-and-magic-trilogy
diff SaveLoad.cpp @ 87:c0cf9393af64
Слияние
author | Ritor1 |
---|---|
date | Mon, 29 Oct 2012 09:28:08 +0600 |
parents | a84fb3752681 |
children | 6c42178c226e 51a5b0dc3f30 |
line wrap: on
line diff
--- a/SaveLoad.cpp Mon Oct 22 09:20:49 2012 +0600 +++ b/SaveLoad.cpp Mon Oct 29 09:28:08 2012 +0600 @@ -42,45 +42,13 @@ //----- (0045EE8A) -------------------------------------------------------- void __fastcall LoadGame(unsigned int uSlot) { - //unsigned int v1; // ebx@1 - //char v2; // zf@1 - //signed int v3; // esi@3 - //signed int v4; // esi@8 - //char *v5; // eax@9 - //unsigned int v6; // eax@12 - //unsigned int v7; // esi@13 - //char *v8; // ecx@14 - //FILE *v9; // eax@22 - //FILE *v10; // eax@26 - //FILE *v11; // eax@29 - //FILE *v12; // eax@32 - //FILE *v13; // eax@35 - //FILE *v14; // eax@38 - //unsigned int v15; // edi@41 - //Player *v16; // esi@41 - //int *v17; // esi@46 - //int v18; // edi@46 - //int v19; // ebx@46 - //int v20; // ecx@49 - //int v21; // eax@51 - //int v22; // ecx@56 - //bool v23; // edx@56 - //AudioPlayer *v24; // ebx@60 bool v25; // esi@62 bool v26; // eax@62 - //signed int v27; // esi@66 - //RGBTexture *v28; // edi@67 - std::string v29; // [sp-18h] [bp-108h]@25 int v30; // [sp-Ch] [bp-FCh]@65 int v31; // [sp-8h] [bp-F8h]@4 - //signed int v32; // [sp-4h] [bp-F4h]@4 char DstBuf[100]; // [sp+Ch] [bp-E4h]@23 - //char pContainer; // [sp+20h] [bp-D0h]@62 char Str[123]; // [sp+70h] [bp-80h]@25 - //char a3[5]; // [sp+EBh] [bp-5h]@2 - //v1 = uSlot; - //v2 = pSavegameUsedSlots[uSlot] == 0; dword_5B65C8 = 0; if (!pSavegameUsedSlots[uSlot]) { @@ -221,7 +189,7 @@ pGUIWindow_CurrentMenu->Release(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = true; @@ -321,7 +289,7 @@ 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 + //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 @@ -332,42 +300,49 @@ int a3; // [sp+26Fh] [bp-1h]@8 v66 = a2; - v64 = (std::string *)a1; + //v64 = (std::string *)a1; + strcpy(byte_6BE3B0, pCurrentMapName); - result = _strcmpi(pCurrentMapName, "d05.blv"); - if ( result ) - { - DstBuf = operator new(0xF4240u); - pDir.Reset(); + if (!_strcmpi(pCurrentMapName, "d05.blv")) + return false; + + DstBuf = malloc(0xF4240u); + pDir.Reset(); v52 = pParty->vPosition.x; - v51 = pParty->vPosition.z; - v62 = pParty->vPosition.y; + v51 = pParty->vPosition.y; + v62 = pParty->vPosition.z; v53 = pParty->sRotationY; v54 = pParty->sRotationX; - pParty->vPosition.x = pParty->vPrevPosition.x; - pParty->vPosition.z = pParty->vPrevPosition.z; - pParty->vPosition.y = 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((char *)&pDir, "image.pcx"); + 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 ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 11 ) + } + free(v3); + + if ( pCurrentScreen == 11 ) { pRenderer->DrawTextureIndexed( 8u, 8u, - (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); + (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); pRenderer->DrawTextureIndexed( 0x12u, 0x8Du, - (Texture *)(uTextureID_save_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_save_up] : 0)); + (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); @@ -447,13 +422,13 @@ { v39 = v69; v38 = (const char *)v70; - sprintfex(Str, "data\\lloyd%d%d.pcx", v70, v69); + sprintf(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); + sprintf(Str, "lloyd%d%d.pcx", v70, v69); fseek(v8, 0, 2); pDir.uDataSize = ftell(v8); rewind(v8); @@ -464,7 +439,7 @@ if ( pNew_LOD->Write(&pDir, DstBuf, 0) ) { v39 = 207; - sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 207); + sprintf(Str, pGlobalTXT_LocalizationStrings[612], 207); MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0); Size = 5080748; } @@ -475,7 +450,7 @@ ++v70; } while ( v70 <= 4 ); - if ( !v66 ) + if ( !a2 ) { sub_42FA22_mess_with_laying_item_list(); v9 = (int)malloc(0xF4240u); @@ -657,7 +632,7 @@ free((void *)v9); } free(DstBuf); - if ( v64 ) + if ( a1 ) { if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) ) { @@ -669,13 +644,13 @@ } } pParty->vPosition.x = v52; - pParty->vPosition.z = v51; - pParty->vPosition.y = v62; + pParty->vPosition.y = v51; + pParty->vPosition.z = v62; pParty->uFallStartY = v62; pParty->sRotationY = v53; result = v54; pParty->sRotationX = v54; - } + return result; } @@ -709,7 +684,7 @@ } GUI_UpdateWindows(); pGUIWindow_CurrentMenu->Release(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; v3 = pSavegameThumbnails; viewparams->bRedrawGameUI = 1; do @@ -727,7 +702,7 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[656], 2u);// "Game Saved!" viewparams->bRedrawGameUI = 1; } -// 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; +// 4E28F8: using guessed type int pCurrentScreen;