Mercurial > mm7
diff SaveLoad.cpp @ 2139:f9b55be70c1b
Слияние
author | Ritor1 |
---|---|
date | Thu, 02 Jan 2014 09:11:28 +0600 |
parents | e378232bfd36 |
children | d28d3c006077 |
line wrap: on
line diff
--- a/SaveLoad.cpp Thu Jan 02 09:11:01 2014 +0600 +++ b/SaveLoad.cpp Thu Jan 02 09:11:28 2014 +0600 @@ -24,6 +24,7 @@ #include "Log.h" #include "VideoPlayer.h" #include "Level/Decoration.h" +#include "Render.h" #include "mm7_data.h" @@ -76,14 +77,14 @@ for (uint i = 0; i < 4; ++i) { for (uint j = 0; j < pSoundList->sNumSounds; ++j) - if (pSoundList->pSounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998) + if (pSoundList->pSL_Sounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998) { pSoundList->UnloadSound(j, 1); break; } for (uint j = 0; j < pSoundList->sNumSounds; ++j) - if (pSoundList->pSounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999) + if (pSoundList->pSL_Sounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999) { pSoundList->UnloadSound(j, 1); break; @@ -177,7 +178,7 @@ { uchar uQuickspell = pParty->pPlayers[i].uQuickSpell; if (uQuickspell) - stru_AA1058[i]._494836(uQuickspell, i + 9 - 8); + stru_AA1058[i]._494836(uQuickspell, i + 1); for (uint j = 0; j < 2; ++j) { @@ -321,7 +322,7 @@ pLodDirectory.uDataSize = sizeof(Party); //90680; if ( pNew_LOD->Write(&pLodDirectory, pParty, 0) ) { - sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 202); + sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 202);//Save game corrupted! Code=%d MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0); } strcpy(pLodDirectory.pFilename, "clock.bin"); @@ -379,7 +380,7 @@ } } } - if ( !NotSaveWorld ) + if ( !NotSaveWorld )//autosave for change location { //__debugbreak(); CompactLayingItemsList(); @@ -669,20 +670,15 @@ free(pSave); } //----- (0045E03A) -------------------------------------------------------- -unsigned short * MakeScreenshot( signed int width, signed int height ) +unsigned short *MakeScreenshot( signed int width, signed int height ) { - //signed int v2; // edi@1 unsigned __int16 *v3; // ebx@1 int v4; // edx@7 unsigned __int8 v5; // cf@9 unsigned int v6; // ecx@9 unsigned __int16 *v7; // edi@9 int j; // ecx@9 - //unsigned __int16 *v9; // edi@15 - //int v10; // ecx@15 - //LONG v11; // esi@15 - //signed __int64 v12; // qax@18 - //unsigned int v13; // ST10_4@21 + unsigned int screen_x; // qax@18 HRESULT v14; // eax@21 int v15; // edi@29 signed __int64 v16; // qax@30 @@ -691,27 +687,23 @@ int k; // ecx@36 DDSURFACEDESC2 Dst; // [sp+4h] [bp-A0h]@6 unsigned __int16 *pPixels; // [sp+80h] [bp-24h]@1 - float v23; // [sp+84h] [bp-20h]@1 + float interval_x; // [sp+84h] [bp-20h]@1 unsigned __int16 *_this; // [sp+88h] [bp-1Ch]@21 - float v25; // [sp+8Ch] [bp-18h]@1 - unsigned int v26; // [sp+90h] [bp-14h]@17 - //int v27; // [sp+94h] [bp-10h]@1 + float interval_y; // [sp+8Ch] [bp-18h]@1 + unsigned int screen_y; // [sp+90h] [bp-14h]@17 int v28; // [sp+98h] [bp-Ch]@16 int v29; // [sp+9Ch] [bp-8h]@15 - //int v30; // [sp+A0h] [bp-4h]@1 - //v30 = width; - //v2 = height; - //v27 = height; - v23 = game_viewport_width / (double)width; - v25 = game_viewport_height / (double)height; + interval_x = game_viewport_width / (double)width; + interval_y = game_viewport_height / (double)height; pPixels = (unsigned __int16 *)malloc(2 * height * width); memset(pPixels, 0 , 2 * height * width); v3 = pPixels; - if ( pRenderer->pRenderD3D ) - { + if (!pRenderer->pRenderD3D) + __debugbreak(); + pRenderer->BeginSceneD3D(); if (uCurrentlyLoadedLevelType == LEVEL_Indoor) @@ -720,30 +712,29 @@ pOutdoor->Draw(); pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); - memset(&Dst, 0, 0x7Cu); + memset(&Dst, 0, 0x7C); Dst.dwSize = sizeof(Dst); if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) { - ushort* src = (unsigned __int16 *)Dst.lpSurface; - ulong src_width = (Dst.lPitch / sizeof(short)); - ulong src_height = Dst.dwHeight; - ushort* dst = pPixels; for (uint y = 0; y < height; ++y) { - //uint src_y = (game_viewport_y + y * v25) * (Dst.lPitch / sizeof(short)); - uint src_y = game_viewport_y + y * v25; - Assert(game_viewport_y + y * v25 < src_height); - Assert(y < height); - for (uint x = 0; x < width; ++x) { - //uint src_x = game_viewport_x + x * v23; - uint src_x = game_viewport_x + x * v23; - Assert(src_x < src_width); - Assert(x < width); + //*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)]; - dst[y * width + x] = (((63*y)/117) << 5) | 31*x/155;//31*y/117;//src[src_y * src_width + src_x]; + if (Dst.ddpfPixelFormat.dwRGBBitCount == 32) + { + auto p = (unsigned __int32 *)Dst.lpSurface + (int)(x * interval_x + 8.0) + y/* (int)(y * interval_y + 8.0)*/ * Dst.lPitch; + *v3 = Color16((*p >> 16) & 255, (*p >> 8) & 255, *p & 255); + } + else if (Dst.ddpfPixelFormat.dwRGBBitCount == 16) + { + auto p = (unsigned __int16 *)Dst.lpSurface + (int)(x * interval_x + 8.0) + y * Dst.lPitch; + *v3 = *p; + } + else __debugbreak(); + ++v3; } } ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); @@ -774,8 +765,9 @@ while ( v4 ); } } - } - else + + + /*if (!pRenderer->pRenderD3D) { pRenderer->BeginScene(); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) @@ -828,15 +820,15 @@ } } pRenderer->EndScene(); - } + }*/ return pPixels; } //----- (0045E26C) -------------------------------------------------------- void SaveScreenshot(const char *pFilename) { - unsigned __int16 *v2; // esi@1 + unsigned short *screenshot; // esi@1 - v2 = MakeScreenshot(92, 68); - pRenderer->SavePCXImage(pFilename, (char *)v2, 92, 68); - free(v2); + screenshot = MakeScreenshot(92, 68); + pRenderer->SavePCXImage(pFilename, screenshot, 92, 68); + free(screenshot); } \ No newline at end of file