Mercurial > mm7
diff Render.cpp @ 1590:5792fdafe2f5
Слияние
author | Ritor1 |
---|---|
date | Wed, 11 Sep 2013 09:39:09 +0600 |
parents | cff02d7d3460 |
children | c24e91e9a108 8094f1706b1f |
line wrap: on
line diff
--- a/Render.cpp Wed Sep 11 09:23:41 2013 +0600 +++ b/Render.cpp Wed Sep 11 09:39:09 2013 +0600 @@ -26,7 +26,6 @@ #include "ObjectList.h" #include "SpriteObject.h" #include "DecorationList.h" -#include "Allocator.h" #include "OSInfo.h" #include "Actor.h" #include "Log.h" @@ -2018,7 +2017,7 @@ Render *v1; // esi@1 v1 = this; - pAllocator->FreeChunk(this->pDefaultZBuffer); + free(this->pDefaultZBuffer); v1->pD3DBitmaps.Release(); v1->pD3DSprites.Release(); Release(); @@ -2318,7 +2317,7 @@ fwrite(&header2.pitch, 2u, 1u, v6); fwrite(&header2.palette_info, 2u, 1u, v6); fwrite(v15, 0x3Au, 1u, v6); - ptr = pAllocator->AllocNamedChunk(0, 3 * var38 + 6, 0); + ptr = malloc(3 * var38 + 6); if ( v29 > 0 ) { v7 = v30; @@ -2391,7 +2390,7 @@ pRenderer->EndScene(); } - pAllocator->FreeChunk(ptr); + free(ptr); fclose(v6); } } @@ -2515,7 +2514,7 @@ fwrite(&v39, 2u, 1u, v7); fwrite(&v40, 2u, 1u, v7); fwrite(&v16, 0x3Au, 1u, v7); - ptr = pAllocator->AllocNamedChunk(0, 3 * v25 + 6, 0); + ptr = malloc(3 * v25 + 6); if ( (signed int)a1 > 0 ) { v8 = v43; @@ -2587,7 +2586,7 @@ { pRenderer->EndScene(); } - pAllocator->FreeChunk(ptr); + free(ptr); fclose(v7); } } @@ -2682,7 +2681,7 @@ memcpy(v8, &v18, 0x3Au); v9 = (char *)v8 + 58; - lineRGB = (char*)pAllocator->AllocNamedChunk(0, 3 * (wight + 2), 0); + lineRGB = (char*)malloc(3 * (wight + 2)); if ( heidth > 0 ) { v10 = pitch; @@ -2743,7 +2742,7 @@ v10 = pitch; } } - pAllocator->FreeChunk(lineRGB); + free(lineRGB); *(int *)packed_size = (char *)v9 - data_buff; } @@ -2814,7 +2813,7 @@ fwrite(&header2.pitch, 2u, 1u, v7); fwrite(&header2.palette_info, 2u, 1u, v7); fwrite(v14, 0x3Au, 1u, v7); - ptr = pAllocator->AllocNamedChunk(0, 3 * a4 + 6, 0); + ptr = malloc(3 * a4 + 6); if ( a5 > 0 ) { v8 = v24; @@ -2877,7 +2876,7 @@ v8 = v24; } } - pAllocator->FreeChunk(ptr); + free(ptr); result = (FILE *)fclose(v7); } return result; @@ -2982,7 +2981,7 @@ if (!pDefaultZBuffer) { pDefaultZBuffer = pActiveZBuffer = nullptr; - pDefaultZBuffer = pActiveZBuffer = (int *)pAllocator->AllocNamedChunk(0, 0x12C000, "Z Buf."); + pDefaultZBuffer = pActiveZBuffer = (int *)malloc(0x12C000); memset32(pActiveZBuffer, 0xFFFF0000, 0x4B000u); // // inlined Render::ClearActiveZBuffer (mm8::004A085B) } } @@ -3335,11 +3334,10 @@ } bWindowMode = 0; pParty->uFlags |= 2u; - LODWORD(flt_6BE3A0) = 0x3F0CCCCDu; + LODWORD(flt_6BE3A0) = 0x3F0CCCCDu; __debugbreak(); // replace with actual float pViewport->_4C02F8(36044); return v15 != 0; } -// 6BE3A0: using guessed type float flt_6BE3A0; //----- (004A05F3) -------------------------------------------------------- bool Render::SwitchToWindow(HWND hWnd) @@ -6453,7 +6451,7 @@ Error("HiScreen16::LoadTexture - D3Drend->CreateTexture() failed: %x", 0); //v10 = *pOutSurface; //v11 = 0; - if ( bMipMaps ) + if (bMipMaps) { Dst._450DDE(); //v20 = 0; @@ -6472,7 +6470,7 @@ if ( LockSurface_DDraw4(pNextSurf, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) { - Dst.sub_451007_scale_image_bicubic( + /*Dst.sub_451007_scale_image_bicubic( pHWLTexture->pPixels, pHWLTexture->uWidth, pHWLTexture->uHeight, @@ -6482,7 +6480,7 @@ desc.dwHeight, desc.lPitch >> 1, 0, - 0); + 0);*/ ErrD3D(pNextSurf->Unlock(0)); //bMipMaps = 0x4D86ACu; } @@ -6701,8 +6699,11 @@ auto ecx0 = this; v3 = 0; - if ( ecx0->pRenderD3D ) - { + + if (!this->pRenderD3D) + __debugbreak(); // sw render + + //{ v4 = a3; if ( a3 <= 1.0 ) { @@ -6713,6 +6714,7 @@ { v4 = 1.0; } + __debugbreak(); // banker's rounding again a3 = v4 * 255.0; v39 = a3 + 6.7553994e15; LODWORD(v40) = LODWORD(v39); @@ -6774,7 +6776,7 @@ ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS)); - } + /*} else { v40 = (1.0 - a3) * 65536.0; @@ -6800,7 +6802,7 @@ if ( pRenderer->uTargetGBits == 6 ) { - v17 = _42690D_colors_cvt(this_); + v17 = sr_42690D_colors_cvt(this_); v18 = (65536 - LODWORD(a3)) * (v17 & 0x1F); this_ = (((65536 - LODWORD(a3)) * (unsigned __int16)(v17 & 0xF800) & 0xF800FFFF | v18 & 0x1F0000 | (65536 - LODWORD(a3)) * (v17 & 0x7E0) & 0x7E00000u) >> 16 << 16) | (((65536 - LODWORD(a3)) * (unsigned __int16)(v17 & 0xF800) & 0xF800FFFF | v18 & 0x1F0000 | (65536 - LODWORD(a3)) * (v17 & 0x7E0) & 0x7E00000u) >> 16); v19 = v40; @@ -6831,7 +6833,7 @@ } else { - v24 = _4268E3_smthn_to_a1r5g5b5(this_); + v24 = sr_4268E3_smthn_to_a1r5g5b5(this_); v25 = (65536 - LODWORD(a3)) * (v24 & 0x1F); this_ = (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) * (v24 & 0x3E0) & 0x3E00000u) >> 16 << 16) | (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) * (v24 & 0x3E0) & 0x3E00000u) >> 16); @@ -6860,7 +6862,7 @@ } while ( v32 != 1 ); } - } + }*/ return result; } @@ -8490,11 +8492,11 @@ //----- (004524D8) -------------------------------------------------------- HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) { - int v11; // eax@13 - int v12; // ecx@13 + //int v11; // eax@13 + //int v12; // ecx@13 void *v13; // eax@13 - unsigned __int8 v14; // zf@13 - unsigned __int8 v15; // sf@13 + //unsigned __int8 v14; // zf@13 + //unsigned __int8 v15; // sf@13 int v16; // esi@14 int v17; // ecx@16 int v18; // esi@16 @@ -8565,18 +8567,14 @@ else fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); - if ( field_61A94_scale_hwls_to_half ) //is it even possible to ever get here? field_61A94_scale_hwls_to_half is only set to zero - { - v11 = pTex->uHeight / 2; - v12 = pTex->uWidth / 2; - pTex->uHeight = v11; - pTex->uWidth = v12; - v13 = new unsigned __int16[v12 * v11]; + if ( scale_hwls_to_half ) + { + pTex->uHeight /= 2; + pTex->uWidth /= 2; + v13 = new unsigned __int16[pTex->uWidth * pTex->uHeight]; v28 = 0; - v14 = pTex->uHeight == 0; - v15 = (pTex->uHeight & 0x80000000u) != 0; v26 = (unsigned __int16 *)v13; - if ( !(v15 | v14) ) + if ( pTex->uHeight > 0 ) { v16 = pTex->uWidth; v27 = 1; @@ -8596,7 +8594,8 @@ LOWORD(v20) = *(unsigned short *)(v21 + 2); LOWORD(v21) = *(unsigned short *)v21; v23 = pDestb++ + v18; - v26[v23] = sub_452442(*(unsigned short *)v22, *(unsigned short *)(v22 + 2), v21, v20); + extern unsigned int __fastcall _452442_color_cvt(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4); + v26[v23] = _452442_color_cvt(*(unsigned short *)v22, *(unsigned short *)(v22 + 2), v21, v20); v16 = pTex->uWidth; } while (pDestb < pTex->uWidth); @@ -8610,13 +8609,6 @@ pTex->pPixels = v26; } return pTex; - //result = pTex; -// } -// else -// { -//LABEL_8: -// return nullptr; -// } } //----- (0045271F) -------------------------------------------------------- @@ -8664,7 +8656,7 @@ this->uDataOffset = 0; memset(&this->uNumItems, 0, 0x61A84u); this->uNumItems = 0; - this->field_61A94_scale_hwls_to_half = 0; + this->scale_hwls_to_half = false; } //----- (0045237F) --------------------------------------------------------