Mercurial > mm7
changeset 2488:e8130e8c116f
Слияние
author | Ritor1 |
---|---|
date | Thu, 11 Sep 2014 17:26:30 +0600 |
parents | 0683c0a38282 (diff) 1e70f8470638 (current diff) |
children | ceda74e07201 |
files | |
diffstat | 9 files changed, 350 insertions(+), 656 deletions(-) [+] |
line wrap: on
line diff
--- a/AudioPlayer.h Sun Sep 07 01:36:04 2014 +0200 +++ b/AudioPlayer.h Thu Sep 11 17:26:30 2014 +0600 @@ -74,7 +74,7 @@ enum SoundID { SOUND_Invalid = 0, - SOUND_EnteringAHouse = 0x6, + SOUND_EnteringAHouse = 6, SOUND_7 = 7, SOUND_8 = 0x8, SOUND_24 = 24, @@ -249,8 +249,6 @@ }; - - #pragma pack(push, 1) struct SoundData {
--- a/Events.cpp Sun Sep 07 01:36:04 2014 +0200 +++ b/Events.cpp Thu Sep 11 17:26:30 2014 +0600 @@ -35,7 +35,8 @@ #include "UI\UIHouses.h" #include "MM7.h" #include "Level/Decoration.h" - +#include "LuaVM.h" +#include "Log.h" #include "DecorationList.h" @@ -349,13 +350,13 @@ v133 = 0; EvtTargetObj = targetObj; dword_5B65C4_cancelEventProcessing = 0; - /*if ( uEventID == 114 )//for test script + if ( uEventID == 114 )//for test script { if (!lua->DoFile("out01.lua")) Log::Warning(L"Error opening out01.lua\n"); Log::Warning(L"being tested that well\n"); return; - } */ + } if ( !uEventID ) { if ( !GameUI_Footer_TimeLeft )
--- a/Game.cpp Sun Sep 07 01:36:04 2014 +0200 +++ b/Game.cpp Thu Sep 11 17:26:30 2014 +0600 @@ -4961,10 +4961,10 @@ pEventTimer->Initialize(); window = OSWindow::Create(L"Might and Magic Trilogy", game_width, game_height);//Create game window - bool use_d3d11 = false; - if (use_d3d11) - pRenderer = RenderD3D11::Create(); - else + //bool use_d3d11 = false; + //if (use_d3d11) + //pRenderer = RenderD3D11::Create(); + //else pRenderer = Render::Create();//Create DirectX if (!pRenderer) {
--- a/LOD.cpp Sun Sep 07 01:36:04 2014 +0200 +++ b/LOD.cpp Thu Sep 11 17:26:30 2014 +0600 @@ -1724,7 +1724,6 @@ { Texture DstBuf; // [sp+4h] [bp-50h]@6 //Texture::Texture(&DstBuf); - if ( this->pTextures[i].pPalette16 ) { File = FindContainer((const char *)this->pTextures[i].pName, 0); @@ -2048,9 +2047,6 @@ //----- (004101B1) -------------------------------------------------------- int LODFile_IconsBitmaps::ReloadTexture(Texture *pDst, const char *pContainer, int mode) { - /////////////////////////////////////////////// - // // - /////////////////////////////////////////////// Texture *v6; // esi@2 unsigned int v7; // ebx@6 unsigned int v8; // ecx@6 @@ -2109,13 +2105,9 @@ //----- (0040FC08) -------------------------------------------------------- int LODFile_IconsBitmaps::LoadTextureFromLOD(Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType) { - ////////////////////////////////// - // // - ////////////////////////////////// Texture *v8; // esi@3 - size_t v11; // eax@14 enum TEXTURE_TYPE v12; // eax@14 - signed int v13; // esi@14 + signed int result; // esi@14 unsigned int v14; // eax@21 void *v19; // ST3C_4@27 size_t v22; // ST2C_4@29 @@ -2130,7 +2122,7 @@ v8 = pOutTex; fread(pOutTex, 1, 0x30, pFile); strcpy(pOutTex->pName, pContainer); - if (/*pRenderer->pRenderD3D &&*/ pOutTex->pBits & 2) + if (/*pRenderer->pRenderD3D &&*/ (pOutTex->pBits & 2) && strcmp(v8->pName, "sptext01"))//Ritor1: "&& strcmp(v8->pName, "sptext01")" - temporarily for red_aura { if (!pHardwareSurfaces || !pHardwareTextures) { @@ -2143,29 +2135,28 @@ ptr_011BB4 = new char[1000]; memset(ptr_011BB4, 0, 1000); } - if (_strnicmp(pContainer, "wtrdr", 5))//*v4 != 'w' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'd' || v4[4] != 'r' ) + if (_strnicmp(pContainer, "wtrdr", 5)) { - if (_strnicmp(pContainer, "WtrTyl", 6))//if ( *v4 != 'W' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'T' || v4[4] != 'y' || v4[5] != 'l' ) + if (_strnicmp(pContainer, "WtrTyl", 6)) v14 = uNumLoadedFiles; else { pRenderer->hd_water_tile_id = uNumLoadedFiles; v14 = uNumLoadedFiles; } - v13 = pRenderer->LoadTexture(pContainer, pOutTex->palette_id1, (IDirectDrawSurface4 **)&pHardwareSurfaces[v14], &pHardwareTextures[v14]); + result = pRenderer->LoadTexture(pContainer, pOutTex->palette_id1, (IDirectDrawSurface4 **)&pHardwareSurfaces[v14], &pHardwareTextures[v14]); } else { - v11 = strlen(pContainer); - v12 = (enum TEXTURE_TYPE)(int)malloc(v11 + 2); - eTextureType = v12; - *(char *)v12 = 104; - strcpy((char *)(v12 + 1), pContainer); - v13 = pRenderer->LoadTexture((const char *)eTextureType, pOutTex->palette_id1, + char *temp_container; + temp_container = (char *)malloc(strlen(pContainer) + 2); + *temp_container = 104;//'h' + strcpy(temp_container + 1, pContainer); + result = pRenderer->LoadTexture((const char *)temp_container, pOutTex->palette_id1, (IDirectDrawSurface4 **)&pHardwareSurfaces[uNumLoadedFiles], &pHardwareTextures[uNumLoadedFiles]); - free((void *)eTextureType); + free((void *)temp_container); } - return v13; + return result; } if ( !v8->uDecompressedSize || dword_011BA4 ) { @@ -2205,14 +2196,17 @@ } free((void *)pContainer); } + free(v8->pPalette16); + v8->pPalette16 = NULL; + free(v8->pPalette24); - v8->pPalette16 = 0; - v8->pPalette24 = 0; + v8->pPalette24 = NULL; + if ( eTextureType == TEXTURE_24BIT_PALETTE ) { v8->pPalette24 = (unsigned __int8 *)malloc(0x300); - fread(v8->pPalette24, 1, 0x300u, pFile); + fread(v8->pPalette24, 1, 0x300, pFile); } else { @@ -2349,6 +2343,7 @@ { areWeLoadingTexture = 1; + //check loaded texture? for (uint i = 0; i < uNumLoadedFiles; ++i) { if (!_stricmp(pContainer, pTextures[i].pName))
--- a/OpenALSoundProvider.h Sun Sep 07 01:36:04 2014 +0200 +++ b/OpenALSoundProvider.h Thu Sep 11 17:26:30 2014 +0600 @@ -4,6 +4,7 @@ #pragma comment(lib, "OpenAL32.lib") #include "stuff.h" +#include "Log.h" class OpenALSoundProvider { @@ -50,7 +51,10 @@ device = alcOpenDevice(nullptr); if (!device || CheckError()) + { + Log::Warning(L"Default sound device not present"); return false; + } context = alcCreateContext(device, nullptr); if (!context || CheckError())
--- a/Render.cpp Sun Sep 07 01:36:04 2014 +0200 +++ b/Render.cpp Thu Sep 11 17:26:30 2014 +0600 @@ -100,8 +100,8 @@ IDirect3DTexture2 *pTexture1; // [sp+1Ch] [bp-4h]@1 v0 = false; - pRenderD3D->CreateTexture(64u, 64u, &pSurface1, &pTexture1, true, false, 32u); - pRenderD3D->CreateTexture(64u, 64u, &pSurface2, &pTexture2, true, false, 32u); + pRenderD3D->CreateTexture(64, 64, &pSurface1, &pTexture1, true, false, 32); + pRenderD3D->CreateTexture(64, 64, &pSurface2, &pTexture2, true, false, 32); ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture1)); ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); @@ -123,7 +123,7 @@ if ( !pRenderD3D->pDevice->ValidateDevice(&v4) && v4 == 1 ) v0 = true; - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 1u)); + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 1)); pTexture1->Release(); pTexture2->Release(); pSurface1->Release(); @@ -135,8 +135,6 @@ //----- (00440CB8) -------------------------------------------------------- void Render::DrawBillboardList_BLV() { - __int16 v2; // ax@3 - int v5; // eax@11 RenderBillboardTransform_local0 soft_billboard; // [sp+4h] [bp-50h]@1 soft_billboard.sParentBillboardID = -1; @@ -161,11 +159,10 @@ soft_billboard.sZValue = p->sZValue; soft_billboard.uFlags = p->field_1E; soft_billboard.sTintColor = p->sTintColor; - v2 = p->HwSpriteID; - if ( v2 != -1 ) + if ( p->HwSpriteID != -1 ) { if ( pRenderD3D ) - DrawBillboard_Indoor(&soft_billboard, &pSprites_LOD->pHardwareSprites[v2], p->dimming_level); + DrawBillboard_Indoor(&soft_billboard, &pSprites_LOD->pHardwareSprites[p->HwSpriteID], p->dimming_level); else { soft_billboard.pPalette = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, p->dimming_level, 1); @@ -173,9 +170,8 @@ soft_billboard.pPalette = pPaletteManager->field_261600[p->uPalette]; if ( !(soft_billboard.uFlags & 0x40) && soft_billboard.uFlags & 0x80 ) soft_billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, 0, 1); - v5 = p->HwSpriteID; - if ( v5 >= 0 ) - pSprites_LOD->pSpriteHeaders[v5].DrawSprite_sw(&soft_billboard, 1); + if ( p->HwSpriteID >= 0 ) + pSprites_LOD->pSpriteHeaders[p->HwSpriteID].DrawSprite_sw(&soft_billboard, 1); } } } @@ -622,15 +618,15 @@ v46 = 2; //v11 = (int *)(256 << v9); if ( (256 << v9) & frame->uFlags ) - v46 |= 4u; + v46 |= 4; if ( frame->uFlags & 0x40000 ) - v46 |= 0x40u; + v46 |= 0x40; if ( frame->uFlags & 0x20000 ) LOBYTE(v46) = v46 | 0x80; if ( a6 ) { //LOBYTE(v11) = _4E94D3_light_type; - pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type); + pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFF, 0xFF, 0xFF, _4E94D3_light_type); } if (pGame->pIndoorCameraD3D->sRotationX) { @@ -759,7 +755,7 @@ if ( lpGUID ) { v20.pGUID = new GUID; - memcpy(v20.pGUID, lpGUID, 0x10u); + memcpy(v20.pGUID, lpGUID, 0x10); } else v20.pGUID = 0; @@ -833,22 +829,14 @@ //----- (0049D784) -------------------------------------------------------- HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, RenderD3D_aux *a6) { - int v6; // eax@1 signed int v7; // edi@1 - signed int v8; // edi@14 - size_t v9; // eax@30 - size_t v10; // eax@30 - size_t v11; // eax@30 - size_t v12; // eax@30 - size_t v13; // eax@30 - - v6 = pHWDesc->dwFlags; + v7 = -1; - if ( v6 ) + if ( pHWDesc->dwFlags ) { if ( !a6->ptr_4->pGUID ) v7 = 0; - if ( v6 && a6->ptr_4->pGUID ) + if ( pHWDesc->dwFlags && a6->ptr_4->pGUID ) v7 = 1; } if ( !strcmp(lpDeviceName, "RGB Emulation") && !a6->ptr_4->pGUID ) @@ -857,52 +845,51 @@ v7 = 3; if ( v7 != -1 ) { - v8 = v7; - a6->pInfo[v8].bIsDeviceCompatible = 1; - a6->pInfo[v8].uCaps = 0; + a6->pInfo[v7].bIsDeviceCompatible = 1; + a6->pInfo[v7].uCaps = 0; if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 0x10) ) - a6->pInfo[v8].uCaps |= 2u; + a6->pInfo[v7].uCaps |= 2; if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 2) ) - a6->pInfo[v8].uCaps |= 4u; + a6->pInfo[v7].uCaps |= 4; if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 1) ) - a6->pInfo[v8].uCaps |= 8u; + a6->pInfo[v7].uCaps |= 8; if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 0x20) ) - a6->pInfo[v8].uCaps |= 0x10u; + a6->pInfo[v7].uCaps |= 16; if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 2) ) - a6->pInfo[v8].uCaps |= 0x20u; + a6->pInfo[v7].uCaps |= 32; if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 4) ) - a6->pInfo[v8].uCaps |= 0x40u; + a6->pInfo[v7].uCaps |= 64; if ( !(BYTE1(pHWDesc->dwDevCaps) & 0x10) ) - BYTE1(a6->pInfo[v8].uCaps) |= 1u; + BYTE1(a6->pInfo[v7].uCaps) |= 1; if ( pHWDesc->dpcTriCaps.dwTextureCaps & 0x20 ) - LOBYTE(a6->pInfo[v8].uCaps) |= 0x80u; - v9 = strlen(lpDeviceName); - a6->pInfo[v8].pName = new char[v9 + 1]; - strcpy(a6->pInfo[v8].pName, lpDeviceName); - v10 = strlen(lpDeviceDesc); - a6->pInfo[v8].pDescription = new char[v10 + 1]; - strcpy(a6->pInfo[v8].pDescription, lpDeviceDesc); - a6->pInfo[v8].pGUID = new GUID; - memcpy(a6->pInfo[v8].pGUID, lpGUID, 0x10u); - v11 = strlen(a6->ptr_4->pDriverName); - a6->pInfo[v8].pDriverName = new char[v11 + 1]; - strcpy(a6->pInfo[v8].pDriverName, a6->ptr_4->pDriverName); - v12 = strlen(a6->ptr_4->pDeviceDesc); - a6->pInfo[v8].pDeviceDesc = new char[v12 + 1]; - strcpy(a6->pInfo[v8].pDeviceDesc, a6->ptr_4->pDeviceDesc); - v13 = strlen(a6->ptr_4->pDDraw4DevDesc); - a6->pInfo[v8].pDDraw4DevDesc = new char[v13 + 1]; - strcpy(a6->pInfo[v8].pDDraw4DevDesc, a6->ptr_4->pDDraw4DevDesc); + LOBYTE(a6->pInfo[v7].uCaps) |= 0x80; + + a6->pInfo[v7].pName = new char[strlen(lpDeviceName) + 1]; + strcpy(a6->pInfo[v7].pName, lpDeviceName); + + a6->pInfo[v7].pDescription = new char[strlen(lpDeviceDesc) + 1]; + strcpy(a6->pInfo[v7].pDescription, lpDeviceDesc); + + a6->pInfo[v7].pGUID = new GUID; + memcpy(a6->pInfo[v7].pGUID, lpGUID, 0x10); + + a6->pInfo[v7].pDriverName = new char[strlen(a6->ptr_4->pDriverName) + 1]; + strcpy(a6->pInfo[v7].pDriverName, a6->ptr_4->pDriverName); + + a6->pInfo[v7].pDeviceDesc = new char[strlen(a6->ptr_4->pDeviceDesc) + 1]; + strcpy(a6->pInfo[v7].pDeviceDesc, a6->ptr_4->pDeviceDesc); + + a6->pInfo[v7].pDDraw4DevDesc = new char[strlen(a6->ptr_4->pDDraw4DevDesc) + 1]; + strcpy(a6->pInfo[v7].pDDraw4DevDesc, a6->ptr_4->pDDraw4DevDesc); + if ( a6->ptr_4->pGUID ) { - a6->pInfo[v8].pDirectDrawGUID = new GUID; - memcpy(a6->pInfo[v8].pDirectDrawGUID, a6->ptr_4->pGUID, 0x10u); + a6->pInfo[v7].pDirectDrawGUID = new GUID; + memcpy(a6->pInfo[v7].pDirectDrawGUID, a6->ptr_4->pGUID, 0x10); } else - { - a6->pInfo[v8].pDirectDrawGUID = 0; - } - a6->pInfo[v8].uVideoMem = a6->ptr_4->uVideoMem; + a6->pInfo[v7].pDirectDrawGUID = 0; + a6->pInfo[v7].uVideoMem = a6->ptr_4->uVideoMem; } return 1; } @@ -910,7 +897,7 @@ //----- (0049D75C) -------------------------------------------------------- HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *found_compatible_mode) { - if ( pSurfaceDesc->ddsCaps.dwCaps | 0x2000 /*&& pSurfaceDesc->ddpfPixelFormat.dwRGBBitCount == 16*/ ) + if ( pSurfaceDesc->ddsCaps.dwCaps | DDSCAPS_3DDEVICE /*&& pSurfaceDesc->ddpfPixelFormat.dwRGBBitCount == 16*/ ) { *found_compatible_mode = 1; return S_OK; @@ -1219,7 +1206,7 @@ v2 = new RenderD3D__DevInfo[4];// 4 items *pOutDevices = v2; - memset(v2, 0, 0xA0u); + memset(v2, 0, sizeof(v2)); DirectDrawEnumerateExA((LPDDENUMCALLBACKEXA)RenderD3D__DeviceEnumerator, *pOutDevices, DDENUM_ATTACHEDSECONDARYDEVICES); } @@ -1242,98 +1229,89 @@ //----- (0049DC90) -------------------------------------------------------- void RenderD3D::Release() { - RenderD3D *v1; // esi@1 - IDirectDraw4 *v2; // eax@2 - signed int v3; // edi@4 - IDirect3DViewport3 *v4; // eax@22 - IUnknown *v5; // eax@24 - IDirectDrawSurface4 *v6; // eax@26 - IDirect3DDevice3 *v7; // eax@28 - IDirect3D3 *v8; // eax@30 - IDirectDrawSurface4 *v9; // eax@32 - IDirectDrawSurface4 *v10; // eax@34 - IDirectDraw4 *v11; // eax@36 - - v1 = this; if ( !this->bWindowed ) { - v2 = this->pHost; - if ( v2 ) - { - v2->RestoreDisplayMode(); - v1->pHost->SetCooperativeLevel(v1->hWindow, 8u); - v1->pHost->FlipToGDISurface(); - } - } - v3 = 0; - do - { - delete[] v1->pAvailableDevices[v3].pDriverName; - v1->pAvailableDevices[v3].pDriverName = nullptr; - delete[] v1->pAvailableDevices[v3].pDeviceDesc; - v1->pAvailableDevices[v3].pDeviceDesc = nullptr; - delete[] v1->pAvailableDevices[v3].pDDraw4DevDesc; - v1->pAvailableDevices[v3].pDDraw4DevDesc = nullptr; - delete v1->pAvailableDevices[v3].pDirectDrawGUID; - v1->pAvailableDevices[v3].pDirectDrawGUID = nullptr; - delete[] v1->pAvailableDevices[v3].pName; - v1->pAvailableDevices[v3].pName = nullptr; - delete[] v1->pAvailableDevices[v3].pDescription; - v1->pAvailableDevices[v3].pDescription = nullptr; - delete v1->pAvailableDevices[v3].pGUID; - v1->pAvailableDevices[v3].pGUID = nullptr; - ++v3; - } - while ( v3 < 4 ); - delete[] v1->pAvailableDevices; - v1->pAvailableDevices = 0; - v4 = v1->pViewport; - if ( v4 ) - { - v4->Release(); - v1->pViewport = 0; - } - v5 = v1->pUnk; - if ( v5 ) - { - v5->Release(); - v1->pUnk = 0; - } - v6 = v1->pZBuffer; - if ( v6 ) - { - v6->Release(); - v1->pZBuffer = 0; - } - v7 = v1->pDevice; - if ( v7 ) - { - v7->Release(); - v1->pDevice = 0; - } - v8 = v1->pDirect3D; - if ( v8 ) - { - v8->Release(); - v1->pDirect3D = 0; - } - v9 = v1->pBackBuffer; - if ( v9 ) - { - v9->Release(); - v1->pBackBuffer = 0; - } - v10 = v1->pFrontBuffer; - if ( v10 ) - { - v10->Release(); - v1->pFrontBuffer = 0; - } - v11 = v1->pHost; - if ( v11 ) - { - v11->Release(); - v1->pHost = 0; + if ( this->pHost ) + { + this->pHost->RestoreDisplayMode(); + this->pHost->SetCooperativeLevel(this->hWindow, DDSCL_NORMAL); + this->pHost->FlipToGDISurface(); + } + } + + for (int i = 0; i < 4; i++) + { + delete[] this->pAvailableDevices[i].pDriverName; + this->pAvailableDevices[i].pDriverName = nullptr; + + delete[] this->pAvailableDevices[i].pDeviceDesc; + this->pAvailableDevices[i].pDeviceDesc = nullptr; + + delete[] this->pAvailableDevices[i].pDDraw4DevDesc; + this->pAvailableDevices[i].pDDraw4DevDesc = nullptr; + + delete this->pAvailableDevices[i].pDirectDrawGUID; + this->pAvailableDevices[i].pDirectDrawGUID = nullptr; + + delete[] this->pAvailableDevices[i].pName; + this->pAvailableDevices[i].pName = nullptr; + + delete[] this->pAvailableDevices[i].pDescription; + this->pAvailableDevices[i].pDescription = nullptr; + + delete this->pAvailableDevices[i].pGUID; + this->pAvailableDevices[i].pGUID = nullptr; + } + + delete[] this->pAvailableDevices; + this->pAvailableDevices = NULL; + + if ( this->pViewport ) + { + this->pViewport->Release(); + this->pViewport = NULL; + } + + if ( this->pUnk ) + { + this->pUnk->Release(); + this->pUnk = NULL; + } + + if ( this->pZBuffer ) + { + this->pZBuffer->Release(); + this->pZBuffer = NULL; + } + + if ( this->pDevice ) + { + this->pDevice->Release(); + this->pDevice = NULL; + } + + if ( this->pDirect3D ) + { + this->pDirect3D->Release(); + this->pDirect3D = NULL; + } + + if ( this->pBackBuffer ) + { + this->pBackBuffer->Release(); + this->pBackBuffer = NULL; + } + + if ( this->pFrontBuffer ) + { + this->pFrontBuffer->Release(); + this->pFrontBuffer = NULL; + } + + if ( this->pHost ) + { + this->pHost->Release(); + this->pHost = NULL; } } @@ -1937,7 +1915,7 @@ ddsd2.dwMipMapCount = v9 - v10; if ( v9 == v10 ) { - ddsd2.dwFlags = 0x1007u; + ddsd2.dwFlags = 0x1007; __debugbreak(); // warning C4700: uninitialized local variable 'v11' used ddsd2.ddsCaps.dwCaps = v11; goto LABEL_12; @@ -1956,7 +1934,7 @@ ddsd2.ddpfPixelFormat.dwRBitMask = 0x7C00; ddsd2.ddpfPixelFormat.dwGBitMask = 0x03E0; ddsd2.ddpfPixelFormat.dwBBitMask = 0x001F; - ddsd2.ddpfPixelFormat.dwRGBAlphaBitMask = 0x8000u; + ddsd2.ddpfPixelFormat.dwRGBAlphaBitMask = 0x8000; } else { @@ -1988,79 +1966,27 @@ //----- (004A2050) -------------------------------------------------------- void Render::DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture) { - Render *v5; // edi@1 unsigned int v6; // ebx@1 - LightmapBuilder *v7; // esi@3 int v8; // eax@7 -// ODMFace *v9; // eax@12 -// char *v10; // esi@12 -// double v11; // st7@14 -// double v12; // st7@14 -// int v13; // eax@14 -// ODMFace *v14; // ecx@14 -// double v15; // st7@14 -// float v16; // ST48_4@15 -// int v17; // eax@15 -// char v18; // zf@17 -// HRESULT v19; // eax@18 -// HRESULT v20; // eax@18 -// HRESULT v21; // eax@20 -// HRESULT v22; // eax@20 -// unsigned int v23; // ecx@20 -// char *v24; // eax@21 -// HRESULT v25; // eax@23 -// HRESULT v26; // eax@23 -// HRESULT v27; // eax@24 -// HRESULT v28; // eax@25 -// HRESULT v29; // eax@25 -// HRESULT v30; // eax@25 -// HRESULT v31; // eax@25 -// HRESULT v32; // eax@26 -// unsigned int v33; // ecx@26 -// char *v34; // eax@27 -// int v35; // edx@28 -// HRESULT v36; // eax@29 -// HRESULT v37; // eax@29 -// HRESULT v38; // eax@29 -// HRESULT v39; // eax@29 - //IDirect3DDevice3Vtbl *v40; // ebx@29 unsigned int v41; // eax@29 -// HRESULT v42; // eax@30 -// HRESULT v43; // eax@30 -// HRESULT v44; // eax@30 -// char *v45; // esi@34 -// int v46; // ecx@35 -// double v47; // st6@35 -// int v48; // eax@36 -// const char *v49; // [sp+4Ch] [bp-1Ch]@0 -// const char *v50; // [sp+4Ch] [bp-1Ch]@20 -// int v51; // [sp+50h] [bp-18h]@0 -// unsigned int v52; // [sp+54h] [bp-14h]@0 - LightmapBuilder *v53; // [sp+58h] [bp-10h]@3 - unsigned int v54; // [sp+5Ch] [bp-Ch]@3 -// unsigned int v55; // [sp+5Ch] [bp-Ch]@34 -// unsigned int v56; // [sp+60h] [bp-8h]@12 -// int v57; // [sp+60h] [bp-8h]@34 + //unsigned int v54; // [sp+5Ch] [bp-Ch]@3 signed int a2; // [sp+64h] [bp-4h]@4 - v5 = this; v6 = 0; if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 ) { - v7 = pGame->pLightmapBuilder; - v53 = v7; - v54 = v7->std__vector_000004_size; - if ( v7->std__vector_000004_size) + //v54 = pGame->pLightmapBuilder->std__vector_000004_size; + if ( pGame->pLightmapBuilder->std__vector_000004_size) a2 = -1; pGame->AlterGamma_ODM(a4, &a2); if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01_lightmap_related) { v8 = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); - v7->DrawLightmaps(/*v8, 0*/); + pGame->pLightmapBuilder->DrawLightmaps(/*v8, 0*/); } else { - if ( !v54 || byte_4D864C && pGame->uFlags & 2 ) + if ( !pGame->pLightmapBuilder->std__vector_000004_size || byte_4D864C && pGame->uFlags & 2 ) { ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); @@ -2081,13 +2007,9 @@ pGame->AlterGamma_ODM(a4, &d3d_vertex_buffer[i].diffuse); if ( this->bUsingSpecular ) - { d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, array_50AC10[i].vWorldViewPosition.x); - } else - { d3d_vertex_buffer[i].specular = 0; - } d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; @@ -2122,13 +2044,9 @@ d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); d3d_vertex_buffer[i].diffuse = GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); if ( this->bUsingSpecular ) - { d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, array_50AC10[i].vWorldViewPosition.x); - } else - { d3d_vertex_buffer[i].specular = 0; - } d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; @@ -2148,7 +2066,7 @@ //v50 = (const char *)v5->pRenderD3D->pDevice; ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); //(*(void (**)(void))(*(int *)v50 + 88))(); - v53->DrawLightmaps(/*-1, 0*/); + pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); for (uint i = 0; i < uNumVertices; ++i) { d3d_vertex_buffer[i].diffuse = a2; @@ -2409,7 +2327,7 @@ fwrite(&header1.bottom, 2, 1, pOutFile); fwrite(&header1.hdpi, 2, 1, pOutFile); fwrite(&header1.vdpi, 2, 1, pOutFile); - fwrite(color_map, 0x30u, 1, pOutFile); + fwrite(color_map, 0x30, 1, pOutFile); fwrite(&header2, 1, 1, pOutFile); fwrite(&header2.planes, 1, 1, pOutFile); fwrite(&header2.pitch, 2, 1, pOutFile); @@ -3390,7 +3308,7 @@ pDirectDraw4 = nullptr; Error("Direct3D renderer: The device doesn't support the necessary alpha blending modes."); } - if ( (v10 & 0x80u) != 0 ) + if ( (v10 & 0x80) != 0 ) { if ( pRenderD3D ) { @@ -3606,11 +3524,13 @@ } //LOBYTE(field_10365C) = ~(unsigned __int8)(v9 >> 6) & 1; bRequiredTextureStagesAvailable = CheckTextureStages(); - memset(&halCaps, 0, 0xFCu); - halCaps.dwSize = 252; - memset(&refCaps, 0, 0xFCu); - //v10 = v2->pRenderD3D; - refCaps.dwSize = 252; + + memset(&halCaps, 0, sizeof(halCaps)); + halCaps.dwSize = sizeof(halCaps); + + memset(&refCaps, 0, sizeof(refCaps)); + refCaps.dwSize = sizeof(refCaps); + ErrD3D(pRenderD3D->pDevice->GetCaps(&halCaps, &refCaps)); v12 = halCaps.dwMinTextureWidth; if ( (unsigned int)halCaps.dwMinTextureWidth > halCaps.dwMinTextureHeight ) @@ -4140,19 +4060,19 @@ struct _DDSURFACEDESC *v4; // edx@3 //// HRESULT v5; // eax@5 int v6; // [sp-8h] [bp-8Ch]@3 - unsigned int v7; // [sp-4h] [bp-88h]@3 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3 //v1 = this; //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || //pVersion->pVersionInfo.dwMajorVersion != 4 ) { - memset(&a2, 0, 0x7Cu); + memset(&a2, 0, sizeof(a2)); + a2.dwSize = sizeof(a2); + pDD = (IDirectDraw *)this->pDirectDraw4; - a2.dwSize = 124; a2.dwFlags = 1; - v7 = 0; - a2.ddsCaps.dwCaps = 512; + a2.ddsCaps.dwCaps = 512;//DDSCAPS_PRIMARYSURFACE = 0x200 + v6 = 2357; pOutSurf = (IDirectDrawSurface **)&this->pFrontBuffer4; v4 = (struct _DDSURFACEDESC *)&a2; @@ -4163,7 +4083,6 @@ pDD = (IDirectDraw *)v1->pDirectDraw2; a2.lPitch = 108; a2.dwBackBufferCount = 1; - v7 = 0; a2.dwTextureStage = 512; v6 = 2346; pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer2; @@ -4188,14 +4107,16 @@ //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || // pVersion->pVersionInfo.dwMajorVersion != 4 ) { - memset(&a2, 0, 0x7Cu); + memset(&a2, 0, sizeof(a2)); + a2.dwSize = sizeof(a2); + v2 = (IDirectDraw *)this->pDirectDraw4; - a2.dwSize = 124; a2.dwFlags = 7; - v7 = 0; - a2.ddsCaps.dwCaps = 2112; + a2.ddsCaps.dwCaps = 2112;//0x840 = DDSCAPS_SYSTEMMEMORY = 0x800 | DDSCAPS_OFFSCREENPLAIN = 0x40 a2.dwWidth = window->GetWidth(); a2.dwHeight = window->GetHeight(); + + v7 = 0; v6 = 2387; ppBackBuffer = (IDirectDrawSurface **)&this->pBackBuffer4; v4 = (struct _DDSURFACEDESC *)&a2; @@ -4296,8 +4217,10 @@ //pVersion->pVersionInfo.dwMajorVersion != 4 ) { DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 - memset(&pDesc, 0, 0x7Cu); - pDesc.dwSize = 124; + + memset(&pDesc, 0, sizeof(pDesc)); + pDesc.dwSize = sizeof(pDesc); + LockSurface_DDraw4(this->pBackBuffer4, &pDesc, DDLOCK_WAIT); *pOutSurfacePtr = pDesc.lpSurface; v4 = pDesc.lPitch; @@ -4328,8 +4251,10 @@ //if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) { DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 - memset(&pDesc, 0, 0x7Cu); - pDesc.dwSize = 124; + + memset(&pDesc, 0, sizeof(pDesc)); + pDesc.dwSize = sizeof(pDesc); + LockSurface_DDraw4(this->pFrontBuffer4, &pDesc, DDLOCK_WAIT); *pOutSurface = pDesc.lpSurface; v4 = pDesc.lPitch; @@ -4644,71 +4569,11 @@ //----- (004A26BC) -------------------------------------------------------- void Render::DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders) { - //RenderVertexSoft *pVertices; // esi@0 - //int v7; // edi@1 unsigned int v8; // ebx@1 -// LightmapBuilder *v9; // esi@3 -// unsigned int v10; // edx@3 int v11; // eax@5 -// int v12; // eax@11 -// char *v13; // esi@11 -// double v14; // st7@13 -// double v15; // st7@13 -// signed int v16; // eax@13 -// int v17; // ecx@13 -// double v18; // st7@13 -// float v19; // ST78_4@14 int v20; // eax@14 -// char v21; // zf@16 -// HRESULT v22; // eax@17 -// HRESULT v23; // eax@17 -// HRESULT v24; // eax@19 -// HRESULT v25; // eax@19 -// unsigned int v26; // ecx@19 -// char *v27; // eax@20 -// HRESULT v28; // eax@22 -// HRESULT v29; // eax@22 -// HRESULT v30; // eax@23 -// HRESULT v31; // eax@24 -// HRESULT v32; // eax@24 -// HRESULT v33; // eax@24 -// HRESULT v34; // eax@24 -// HRESULT v35; // eax@25 -// HRESULT v36; // eax@25 -// unsigned int v37; // ecx@25 -// char *v38; // eax@26 -// int v39; // edx@27 -// HRESULT v40; // eax@28 -// HRESULT v41; // eax@28 -// HRESULT v42; // eax@28 -// HRESULT v43; // eax@28 - //IDirect3DDevice3Vtbl *v44; // ebx@28 unsigned int v45; // eax@28 -// HRESULT v46; // eax@29 -// HRESULT v47; // eax@29 -// HRESULT v48; // eax@29 - //IDirect3DDevice3 *v49; // eax@35 - //IDirect3DDevice3Vtbl *v50; // ecx@35 -// int v51; // eax@40 -// char *v52; // esi@40 -// double v53; // st7@42 -// double v54; // st7@42 -// signed int v55; // eax@42 -// int v56; // ecx@42 -// double v57; // st7@42 -// float v58; // ST7C_4@43 -// int v59; // eax@43 - //signed int v60; // [sp+78h] [bp-14h]@31 - //RenderVertexSoft *v61; // [sp+7Ch] [bp-10h]@3 -// const char *v62; // [sp+80h] [bp-Ch]@0 -// const char *v63; // [sp+80h] [bp-Ch]@19 -// int v64; // [sp+84h] [bp-8h]@0 -// LightmapBuilder *v65; // [sp+88h] [bp-4h]@3 -// unsigned int v66; // [sp+88h] [bp-4h]@40 -// unsigned int a6a; // [sp+A0h] [bp+14h]@11 -// int a7; - - //v7 = (int)this; + v8 = 0; if (!this->uNumD3DSceneBegins) return; @@ -5275,40 +5140,6 @@ //----- (004A2FC0) -------------------------------------------------------- void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) { - //Render *v8; // edi@1 - //unsigned int v9; // esi@3 -// RenderVertexSoft *v12; // ecx@9 -// RenderVertexD3D3 *v13; // eax@9 -// double v14; // st6@10 -// int v15; // edx@10 -// Texture *v16; // edx@10 -// double v17; // st6@10 - //char v18; // zf@10 -// Texture *v19; // edx@10 - //Texture *v23; // edx@16 - //char *v24; // ecx@16 - //char *v25; // eax@16 - //double v26; // st6@17 - //int v27; // esi@17 - //double v28; // st6@17 - //unsigned int v33; // ecx@18 - //char *v34; // eax@19 - //Texture *v45; // edx@23 - //char *v46; // ecx@23 - //char *v47; // eax@23 - //double v48; // st6@24 - //int v49; // esi@24 - //double v50; // st6@24 -// const char *v53; // [sp-Ch] [bp-20h]@21 - //int v54; // [sp-8h] [bp-1Ch]@21 - //unsigned int v55; // [sp-4h] [bp-18h]@21 -// const char *v56; // [sp+0h] [bp-14h]@0 -// int v57; // [sp+4h] [bp-10h]@0 -// unsigned int v58; // [sp+8h] [bp-Ch]@0 - //LightmapBuilder *v59; // [sp+Ch] [bp-8h]@3 - //int a3a; // [sp+10h] [bp-4h]@4 - - //v8 = this; if (!uNumD3DSceneBegins || uNumVertices < 3) return; @@ -5474,17 +5305,9 @@ //----- (004A43B1) -------------------------------------------------------- void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level) { - //RenderBillboardTransform_local0 *v4; // ebx@2 - //double v5; // st7@2 - //float v6; // ST08_4@2 unsigned int v7; // eax@2 - //int v8; // ecx@2 - //unsigned int v9; // esi@2 - //Sprite *v10; // edi@5 signed int v11; // eax@9 signed int v12; // eax@9 - //double v13; // st7@12 - //double v14; // st6@12 double v15; // st5@12 double v16; // st4@12 double v17; // st3@12 @@ -5493,19 +5316,12 @@ double v20; // st3@14 int v21; // ecx@16 double v22; // st3@16 - //IDirect3DTexture2 *v23; // eax@18 - //signed int v24; // [sp+18h] [bp-18h]@5 - //signed int v25; // [sp+1Ch] [bp-14h]@5 - //Render *v26; // [sp+20h] [bp-10h]@1 float v27; // [sp+24h] [bp-Ch]@5 int v28; // [sp+28h] [bp-8h]@2 float v29; // [sp+2Ch] [bp-4h]@5 - //float pSoftBillboarda; // [sp+38h] [bp+8h]@2 float v31; // [sp+3Ch] [bp+Ch]@5 - //float v32; // [sp+3Ch] [bp+Ch]@12 float a1; // [sp+40h] [bp+10h]@5 - //v26 = this; if ( this->uNumD3DSceneBegins ) { //v4 = pSoftBillboard; @@ -5602,17 +5418,8 @@ //----- (004A354F) -------------------------------------------------------- void Render::MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) { - //double v5; // st7@3 - //float v6; // ST20_4@3 - //float v7; // ST00_4@3 unsigned int v8; // esi@3 - //int v9; // eax@3 - //int v10; // ebx@3 float v11; // ST28_4@3 - //double v12; // st7@3 - //float v13; // ST24_4@3 - //double v14; // st6@3 - //float v15; // ST1C_4@3 float v16; // ST2C_4@3 float v17; // ST30_4@3 signed int v18; // ST18_4@3 @@ -5781,8 +5588,8 @@ float v6; // ST28_4@2 float v7; // ST00_4@2 unsigned int v8; // esi@2 - int v9; // eax@2 - int v10; // ebx@2 + //int v9; // eax@2 + //int v10; // ebx@2 float v11; // ST34_4@2 double v12; // st7@2 float v13; // ST2C_4@2 @@ -5830,26 +5637,25 @@ pBillboardRenderListD3D[v8].field_90 = a2->field_44; pBillboardRenderListD3D[v8].sZValue = a2->sZValue; pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID; - v9 = a2->uScreenSpaceX; - v10 = a2->uScreenSpaceY; + + //v9 = a2->uScreenSpaceX; + //v10 = a2->uScreenSpaceY; v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); - v12 = (double)v9; - v13 = v12; - v14 = (double)(v10 - 12); + v12 = (double)a2->uScreenSpaceX; + v13 = (double)a2->uScreenSpaceX; + v14 = (double)(a2->uScreenSpaceY - 12); v15 = v14; - v16 = (double)(v9 - 12) - v12; - v17 = (double)(v10 - 25) - v14; + v16 = (double)(a2->uScreenSpaceX - 12) - v12; + v17 = (double)(a2->uScreenSpaceY - 25) - v14; v18 = stru_5C6E00->Cos(angle); v19 = angle - stru_5C6E00->uIntegerHalfPi; v20 = stru_5C6E00->Sin(angle); v21 = stru_5C6E00->Sin(angle); v22 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 - + (double)(v18 >> 16)) - * v16 + + (double)(v18 >> 16)) * v16 - ((double)(unsigned __int16)v20 * 0.000015259022 - + (double)(v20 >> 16)) - * v17) + + (double)(v20 >> 16)) * v17) * v11 + v13; v23 = (((double)(unsigned __int16)v22 * 0.000015259022 + (double)(v22 >> 16)) * v17 + ((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v16 @@ -5865,6 +5671,7 @@ pBillboardRenderListD3D[v8].pQuads[0].rhw = v25; pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; + v26 = (double)(a2->uScreenSpaceX - 12) - v13; v27 = (double)a2->uScreenSpaceY - v15; v28 = stru_5C6E00->Cos(angle); @@ -5872,11 +5679,9 @@ v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v31 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 - + (double)(v28 >> 16)) - * v26 + + (double)(v28 >> 16)) * v26 - ((double)(unsigned __int16)v29 * 0.000015259022 - + (double)(v29 >> 16)) - * v27) + + (double)(v29 >> 16)) * v27) * v11 + v13; v32 = (((double)(unsigned __int16)v31 * 0.000015259022 + (double)(v31 >> 16)) * v27 + ((double)(unsigned __int16)v30 * 0.000015259022 + (double)(v30 >> 16)) * v26 @@ -5890,6 +5695,7 @@ pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; + v33 = (double)(a2->uScreenSpaceX + 12) - v13; v34 = (double)a2->uScreenSpaceY - v15; v35 = stru_5C6E00->Cos(angle); @@ -5897,11 +5703,9 @@ v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v38 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 - + (double)(v35 >> 16)) - * v33 + + (double)(v35 >> 16)) * v33 - ((double)(unsigned __int16)v36 * 0.000015259022 - + (double)(v36 >> 16)) - * v34) + + (double)(v36 >> 16)) * v34) * v11 + v13; v39 = (((double)(unsigned __int16)v38 * 0.000015259022 + (double)(v38 >> 16)) * v34 + ((double)(unsigned __int16)v37 * 0.000015259022 + (double)(v37 >> 16)) * v33 @@ -5915,6 +5719,7 @@ pBillboardRenderListD3D[v8].pQuads[2].pos.y = v39; pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; + v40 = (double)(a2->uScreenSpaceX + 12) - v13; v41 = (double)(a2->uScreenSpaceY - 25) - v15; v42 = stru_5C6E00->Cos(angle); @@ -5922,11 +5727,9 @@ v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v45 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 - + (double)(v42 >> 16)) - * v40 + + (double)(v42 >> 16)) * v40 - ((double)(unsigned __int16)v43 * 0.000015259022 - + (double)(v43 >> 16)) - * v41) + + (double)(v43 >> 16)) * v41) * v11 + v13; v46 = (((double)(unsigned __int16)v45 * 0.000015259022 + (double)(v45 >> 16)) * v41 + ((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 @@ -5952,19 +5755,8 @@ unsigned int v8; // esi@2 double v14; // st6@14 double v15; // st5@14 - //unsigned int v16; // ecx@16 - //double v17; // st7@16 - //double v18; // st5@16 - //double v19; // st4@16 - //double v20; // st5@18 - //double v21; // st4@18 - //signed int v23; // [sp+18h] [bp-18h]@5 - //signed int v24; // [sp+1Ch] [bp-14h]@5 - //float v26; // [sp+20h] [bp-10h]@5 - //float v27; // [sp+20h] [bp-10h]@12 float v29; // [sp+28h] [bp-8h]@5 float v30; // [sp+2Ch] [bp-4h]@5 - //float pSpritea; // [sp+3Ch] [bp+Ch]@5 if (!uNumD3DSceneBegins) return; @@ -6141,12 +5933,8 @@ ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); ErrD3D(pRenderD3D->pDevice->SetTexture(0, a9)); - ErrD3D(pRenderD3D->pDevice->DrawPrimitive( - D3DPT_TRIANGLEFAN, - D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - v29, - 4, - 24)); + ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, + D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v29, 4, 24)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); @@ -6422,42 +6210,8 @@ void Render::ScreenFade(unsigned int color, float t) { unsigned int v3; // esi@1 - //double v4; // st7@2 - //double v5; // st7@6 - double v6; // st6@6 unsigned int v7; // eax@6 - double v8; // st5@6 - double v9; // st4@6 -// HRESULT v10; // eax@6 -// HRESULT v11; // eax@6 -// unsigned int result; // eax@6 -// unsigned int v13; // eax@7 -// unsigned __int16 *v14; // ecx@7 -// int *v15; // eax@7 -// unsigned int v16; // ecx@8 -// __int16 v17; // ax@10 -// int v18; // esi@10 -// float v19; // edi@10 -// void *v20; // esi@10 -// int v21; // edx@10 -// int v22; // ecx@11 -// int v23; // edx@12 -// __int16 v24; // ax@15 -// int v25; // esi@15 -// float v26; // edi@15 -// char *v27; // esi@15 -// int v28; // edx@15 -// int v29; // ecx@16 -// int v30; // edx@17 -// int v31; // [sp-Ch] [bp-ACh]@11 -// int v32; // [sp-Ch] [bp-ACh]@16 -// const char *v33; // [sp+0h] [bp-A0h]@0 -// int v34; // [sp+4h] [bp-9Ch]@0 -// unsigned int v35; // [sp+8h] [bp-98h]@0 RenderVertexD3D3 v36[4]; // [sp+Ch] [bp-94h]@6 -// unsigned int v37; // [sp+8Ch] [bp-14h]@7 -// int v38; // [sp+90h] [bp-10h]@7 -// double v39; // [sp+94h] [bp-Ch]@6 int v40; // [sp+9Ch] [bp-4h]@6 v3 = 0; @@ -6469,44 +6223,45 @@ t = 0.0f; v40 = (char)floorf(t * 255.0f + 0.5f); - //v5 = (double)(signed int)pViewport->uViewportTL_X; - v36[0].pos.x = pViewport->uViewportTL_X; - v6 = (double)(signed int)pViewport->uViewportTL_Y; + v7 = color | (v40 << 24); - //this_ = pViewport->uViewportBR_Y + 1; + v36[0].specular = 0; - v36[0].pos.y = v6; - v36[0].diffuse = v7; - v36[1].diffuse = v7; + v36[0].pos.x = pViewport->uViewportTL_X; + v36[0].pos.y = (double)pViewport->uViewportTL_Y; v36[0].pos.z = 0.0; - v36[2].diffuse = v7; - v36[3].diffuse = v7; + v36[0].diffuse = v7; v36[0].rhw = 1.0; - v36[1].specular = 0; v36[0].texcoord.x = 0.0; - v36[2].specular = 0; - v36[3].specular = 0; v36[0].texcoord.y = 0.0; + + v36[1].specular = 0; v36[1].pos.x = pViewport->uViewportTL_X; - v8 = (double)(pViewport->uViewportBR_Y + 1); - v36[1].pos.y = v8; + v36[1].pos.y = (double)(pViewport->uViewportBR_Y + 1); v36[1].pos.z = 0.0; + v36[1].diffuse = v7; v36[1].rhw = 1.0; v36[1].texcoord.x = 0.0; v36[1].texcoord.y = 0.0; - v9 = (double)(signed int)pViewport->uViewportBR_X; - v36[2].pos.x = v9; - v36[2].pos.y = v8; + + v36[2].specular = 0; + v36[2].pos.x = (double)pViewport->uViewportBR_X; + v36[2].pos.y = (double)(pViewport->uViewportBR_Y + 1); v36[2].pos.z = 0.0; + v36[2].diffuse = v7; v36[2].rhw = 1.0; v36[2].texcoord.x = 0.0; v36[2].texcoord.y = 0.0; - v36[3].pos.x = v9; - v36[3].pos.y = v6; + + v36[3].specular = 0; + v36[3].pos.x = (double)pViewport->uViewportBR_X; + v36[3].pos.y = (double)pViewport->uViewportTL_Y; v36[3].pos.z = 0.0; + v36[3].diffuse = v7; v36[3].rhw = 1.0; v36[3].texcoord.x = 0.0; v36[3].texcoord.y = 0.0; + ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); @@ -6515,12 +6270,8 @@ ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS)); - ErrD3D(pRenderD3D->pDevice->DrawPrimitive( - D3DPT_TRIANGLEFAN, - D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - v36, - 4, - 28)); + ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, + D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v36, 4, 28)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); @@ -6620,20 +6371,20 @@ void Render::SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) { this->bClip = 1; + this->uClipX = uX; this->uClipY = uY; - this->uClipX = uX; + this->uClipZ = uZ; this->uClipW = uW; - this->uClipZ = uZ; } //----- (004A5BB6) -------------------------------------------------------- void Render::ResetTextureClipRect() { - this->uClipY = 0; + this->bClip = 1; this->uClipX = 0; - this->bClip = 1; + this->uClipY = 0; + this->uClipZ = window->GetWidth(); this->uClipW = 480; - this->uClipZ = window->GetWidth(); } unsigned __int32 Color32(unsigned __int16 color16) @@ -6662,7 +6413,6 @@ void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) { int v4; // edi@3 - //unsigned __int16 *v5; // edx@3 unsigned __int16 *v6; // esi@3 unsigned int v8; // eax@5 unsigned int v9; // ebx@5 @@ -6670,7 +6420,6 @@ unsigned int v12; // ebx@8 unsigned int v15; // eax@14 int v19; // [sp+10h] [bp-8h]@3 -// unsigned int uOutXa; // [sp+20h] [bp+8h]@16 int v23; // [sp+28h] [bp+10h]@3 if ( this->uNumSceneBegins && a4 ) @@ -6800,7 +6549,6 @@ //----- (004A6E7E) -------------------------------------------------------- void Render::DrawTranslucent(unsigned int a2, unsigned int a3, Texture *a4) { - //unsigned __int16 *v4; // eax@4 int v5; // edx@4 unsigned int v6; // edi@4 unsigned int v7; // edx@5 @@ -6813,14 +6561,9 @@ unsigned int v14; // ebx@15 unsigned int v15; // esi@17 unsigned int v16; // edi@18 -// char v17; // zf@29 int v18; // [sp+14h] [bp-Ch]@4 int v19; // [sp+18h] [bp-8h]@4 unsigned __int8 *v20; // [sp+1Ch] [bp-4h]@4 -// int v21; // [sp+28h] [bp+8h]@25 -// int v22; // [sp+28h] [bp+8h]@34 -// unsigned int v23; // [sp+2Ch] [bp+Ch]@23 -// unsigned int v24; // [sp+2Ch] [bp+Ch]@32 if ( this->uNumSceneBegins && a4 && a4->pPalette16 ) { @@ -6996,21 +6739,17 @@ { unsigned int v9; // edi@2 unsigned int v10; // esi@2 - //unsigned __int16 *v11; // eax@2 unsigned int v12; // ebx@3 - signed int v13; // edx@5 + //signed int v13; // edx@5 int v14; // edx@6 signed int v15; // ebx@7 - unsigned int v16; // edx@9 + //unsigned int v16; // edx@9 signed int v17; // edi@10 signed int v18; // ebx@13 unsigned int v19; // edx@15 signed int v20; // esi@16 - //unsigned int v21; // esi@22 unsigned __int16 v22; // dx@24 - //char v23; // zf@28 unsigned __int8 *v24; // [sp+Ch] [bp-4h]@2 - //unsigned int uOutXa; // [sp+18h] [bp+8h]@20 if (!this->uNumSceneBegins) return; @@ -7031,34 +6770,34 @@ clipped_out_x = uClipX; v9 = uCharWidth + uOutX - v12; } - v13 = this->uClipY; - if ( uOutY < v13 ) - { - v14 = v13 - uOutY; + //v13 = this->uClipY; + if ( uOutY < this->uClipY ) + { + v14 = this->uClipY - uOutY; v24 += uCharWidth * v14; v10 = uCharHeight + uOutY - this->uClipY; //v11 += this->uTargetSurfacePitch * v14; clipped_out_y = uClipY; } v15 = this->uClipX; - if ( v15 < uOutX ) + if ( this->uClipX < uOutX ) v15 = uOutX; - v16 = this->uClipZ; - if ( (signed int)(v9 + v15) > (signed int)v16 ) + //v16 = this->uClipZ; + if ( (signed int)(v9 + v15) > (signed int)this->uClipZ ) { v17 = this->uClipX; - if ( v17 < uOutX ) + if ( this->uClipX < uOutX ) v17 = uOutX; - v9 = v16 - v17; + v9 = this->uClipZ - v17; } v18 = this->uClipY; - if ( v18 < uOutY ) + if ( this->uClipY < uOutY ) v18 = uOutY; v19 = this->uClipW; if ( (signed int)(v10 + v18) > (signed int)v19 ) { v20 = this->uClipY; - if ( v20 < uOutY ) + if ( this->uClipY < uOutY ) v20 = uOutY; v10 = v19 - v20; } @@ -7099,27 +6838,15 @@ { int v8; // edi@2 unsigned int v9; // esi@2 - //unsigned __int16 *v10; // eax@2 unsigned char *v11; // edx@2 - unsigned int v12; // ebx@3 - signed int v13; // edx@5 int v14; // edx@6 signed int v15; // ebx@7 - unsigned int v16; // edx@9 signed int v17; // edi@10 signed int v18; // ebx@13 - unsigned int v19; // edx@15 signed int v20; // esi@16 -// int v21; // ebx@22 -// char v22; // zf@28 -// int v23; // ebx@31 unsigned __int16 v24; // si@35 int v25; // [sp+Ch] [bp-4h]@2 -// int v26; // [sp+1Ch] [bp+Ch]@24 -// int v27; // [sp+1Ch] [bp+Ch]@33 unsigned int v28; // [sp+20h] [bp+10h]@30 -// unsigned int v29; // [sp+24h] [bp+14h]@22 -// unsigned int v30; // [sp+24h] [bp+14h]@31 int a2 = x; int a3 = y; @@ -7136,44 +6863,40 @@ int clipped_out_y = y; if ( this->bClip ) { - v12 = this->uClipX; - if ( a2 < (signed int)v12 ) - { - v25 = v12 - a2 + (int)font_pixels; + if ( a2 < (signed int)this->uClipX ) + { + v25 = this->uClipX - a2 + (int)font_pixels; //v10 += v12 - a2; - v8 = a5 + a2 - v12; + v8 = a5 + a2 - this->uClipX; clipped_out_x = uClipX; } - v13 = this->uClipY; - if ( a3 < v13 ) - { - v14 = v13 - a3; + if ( a3 < this->uClipY ) + { + v14 = this->uClipY - a3; v25 += a5 * v14; v9 = a6 + a3 - this->uClipY; //v10 += this->uTargetSurfacePitch * v14; clipped_out_y = uClipY; } v15 = this->uClipX; - if ( v15 < a2 ) + if ( this->uClipX < a2 ) v15 = a2; - v16 = this->uClipZ; - if ( v8 + v15 > (signed int)v16 ) + if ( v8 + v15 > (signed int)this->uClipZ ) { v17 = this->uClipX; if ( v17 < a2 ) v17 = a2; - v8 = v16 - v17; + v8 = this->uClipZ - v17; } v18 = this->uClipY; - if ( v18 < a3 ) + if ( this->uClipY < a3 ) v18 = a3; - v19 = this->uClipW; - if ( (signed int)(v9 + v18) > (signed int)v19 ) + if ( (signed int)(v9 + v18) > (signed int)this->uClipW ) { v20 = this->uClipY; - if ( v20 < a3 ) + if ( this->uClipY < a3 ) v20 = a3; - v9 = v19 - v20; + v9 = this->uClipW - v20; } v11 = (unsigned char *)v25; } @@ -7398,12 +7121,9 @@ signed int v13; // esi@15 signed int v15; // esi@18 unsigned __int8 *v16; // ebx@22 -// char v17; // zf@28 int v18; // [sp+10h] [bp-10h]@4 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 int v20; // [sp+1Ch] [bp-4h]@4 -// int v21; // [sp+28h] [bp+8h]@24 -// unsigned int v22; // [sp+2Ch] [bp+Ch]@22 if (!uNumSceneBegins || !pTexture) return; @@ -7439,33 +7159,33 @@ if ( v11 + v20 > (signed int)this->uClipZ ) { v12 = this->uClipX; - if ( v12 < a2 ) + if ( this->uClipX < a2 ) v12 = a2; - v20 = this->uClipZ - v12; - } - v13 = this->uClipY; - if ( this->uClipY < a3 ) - v13 = a3; - if ( (signed int)(v5 + v13) > (signed int)this->uClipW ) - { - v15 = this->uClipY; - if ( this->uClipY < a3 ) - v15 = a3; - v5 = this->uClipW - v15; - } - } + v20 = this->uClipZ - v12; + } + v13 = this->uClipY; + if ( this->uClipY < a3 ) + v13 = a3; + if ( (signed int)(v5 + v13) > (signed int)this->uClipW ) + { + v15 = this->uClipY; + if ( this->uClipY < a3 ) + v15 = a3; + v5 = this->uClipW - v15; + } + } - v16 = v19; - for (uint y = 0; y < v5; ++y) - { - for (int x = 0; x < v20; ++x) - { - if ( *v16 ) - WritePixel16(clipped_out_x + x, clipped_out_y + y, pTexture->pPalette16[*v16] & mask); - ++v16; - } - v16 += v18 - v20; - } + v16 = v19; + for (uint y = 0; y < v5; ++y) + { + for (int x = 0; x < v20; ++x) + { + if ( *v16 ) + WritePixel16(clipped_out_x + x, clipped_out_y + y, pTexture->pPalette16[*v16] & mask); + ++v16; + } + v16 += v18 - v20; + } /*if ( (signed int)v5 > 0 ) { @@ -7492,7 +7212,7 @@ } while ( !v17 ); }*/ - } + } } @@ -7506,10 +7226,7 @@ unsigned int v19; // edx@20 int v20; // eax@27 int v21; // edx@29 -// int v23; // [sp+Ch] [bp-Ch]@24 unsigned __int8 *v24; // [sp+14h] [bp-4h]@6 -// int xa; // [sp+20h] [bp+8h]@26 -// unsigned int ya; // [sp+24h] [bp+Ch]@24 int Width; // [sp+2Ch] [bp+14h]@6 if ( this->uNumSceneBegins && a4 && a4->pPalette16 && a5 && a5->pPalette16 ) @@ -7549,7 +7266,7 @@ if ( (signed int)(uHeight + v17) > (signed int)this->uClipW ) { v19 = this->uClipY; - if ( (signed int)v19 < (signed int)y ) + if ( (signed int)this->uClipY < (signed int)y ) v19 = y; uHeight = this->uClipW - v19; } @@ -7614,7 +7331,6 @@ unsigned int v19; // edx@20 int v20; // eax@27 int v21; // edx@29 -// int v23; // [sp+Ch] [bp-Ch]@24 int Height; // [sp+10h] [bp-8h]@6 int Width; // [sp+14h] [bp-4h]@6 int v27; // [sp+24h] [bp+Ch]@23 @@ -7844,18 +7560,13 @@ //----- (004A612A) -------------------------------------------------------- void Render::DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal) { - Texture *v5; // eax@2 unsigned int v6; // edx@3 int v7; // ebx@3 int v8; // edi@3 - signed int v9; // eax@4 int v10; // eax@5 - unsigned int v11; // esi@6 signed int v12; // esi@8 - unsigned int v13; // eax@10 signed int v14; // esi@11 unsigned int v15; // esi@14 - unsigned int v16; // eax@16 unsigned int v17; // ecx@17 int v18; // edx@23 int v19; // [sp+Ch] [bp-Ch]@3 @@ -7866,56 +7577,51 @@ if ( this->uNumSceneBegins ) { - v5 = pTexture; if ( pTexture ) { v6 = uOutY; v7 = pTexture->uTextureHeight; pZBuffer = &this->pActiveZBuffer[uOutX + window->GetWidth() * uOutY]; - uOutYa = v5->pLevelOfDetail0_prolly_alpha_mask; - v8 = v5->uTextureWidth; - v20 = v5->uTextureWidth; - v19 = v5->uTextureWidth; + uOutYa = pTexture->pLevelOfDetail0_prolly_alpha_mask; + v8 = pTexture->uTextureWidth; + v20 = pTexture->uTextureWidth; + v19 = pTexture->uTextureWidth; if ( this->bClip ) { - v9 = this->uClipX; - if ( uOutX < v9 ) + if ( uOutX < this->uClipX ) { - v10 = v9 - uOutX; + v10 = this->uClipX - uOutX; uOutYa += v10; v8 += uOutX - this->uClipX; v20 = v8; pZBuffer += v10; } - v11 = this->uClipY; - if ( (signed int)v6 < (signed int)v11 ) + if ( (signed int)v6 < (signed int)this->uClipY ) { - uOutYa += v19 * (v11 - v6); - v7 += v6 - v11; - pZBuffer += window->GetWidth() * (v11 - v6); + uOutYa += v19 * (this->uClipY - v6); + v7 += v6 - this->uClipY; + pZBuffer += window->GetWidth() * (this->uClipY - v6); v8 = v20; } v12 = this->uClipX; - if ( v12 < uOutX ) + if ( this->uClipX < uOutX ) v12 = uOutX; - v13 = this->uClipZ; - if ( v8 + v12 > (signed int)v13 ) + if ( v8 + v12 > (signed int)this->uClipZ ) { v14 = this->uClipX; - if ( v14 < uOutX ) + if ( this->uClipX < uOutX ) v14 = uOutX; - v8 = v13 - v14; + v8 = this->uClipZ - v14; } v15 = this->uClipY; - if ( (signed int)v15 < (signed int)v6 ) + if ( (signed int)this->uClipY < (signed int)v6 ) v15 = v6; - v16 = this->uClipW; - if ( (signed int)(v7 + v15) > (signed int)v16 ) + if ( (signed int)(v7 + v15) > (signed int)this->uClipW ) { v17 = this->uClipY; - if ( (signed int)v17 >= (signed int)v6 ) + if ( (signed int)this->uClipY >= (signed int)v6 ) v6 = v17; - v7 = v16 - v6; + v7 = this->uClipW - v6; } } if ( v7 > 0 ) @@ -7953,13 +7659,9 @@ int v6; // ebx@3 int v7; // esi@3 void *v8; // esi@3 - unsigned int v9; // eax@4 - unsigned int v10; // eax@6 signed int v11; // edi@8 - unsigned int v12; // eax@10 signed int v13; // edi@11 unsigned int v14; // edi@14 - unsigned int v15; // eax@16 unsigned int v16; // ecx@17 int v17; // [sp+18h] [bp+Ch]@3 unsigned int pTexturea; // [sp+1Ch] [bp+10h]@3 @@ -7974,40 +7676,36 @@ pTexturea = pTexture->uTextureWidth; if ( this->bClip ) { - v9 = this->uClipX; - if ( a2 < (signed int)v9 ) - { - pTexturea += a2 - v9; - v8 = (char *)v8 + 4 * (v9 - a2); - } - v10 = this->uClipY; - if ( v5 < (signed int)v10 ) - { - v17 += v5 - v10; - v8 = (char *)v8 + 2560 * (v10 - v5); + if ( a2 < (signed int)this->uClipX ) + { + pTexturea += a2 - this->uClipX; + v8 = (char *)v8 + 4 * (this->uClipX - a2); + } + if ( v5 < (signed int)this->uClipY ) + { + v17 += v5 - this->uClipY; + v8 = (char *)v8 + 2560 * (this->uClipY - v5); } v11 = this->uClipX; - if ( v11 < a2 ) + if ( this->uClipX < a2 ) v11 = a2; - v12 = this->uClipZ; - if ( (signed int)(pTexturea + v11) > (signed int)v12 ) + if ( (signed int)(pTexturea + v11) > (signed int)this->uClipZ ) { v13 = this->uClipX; - if ( v13 < a2 ) + if ( this->uClipX < a2 ) v13 = a2; - pTexturea = v12 - v13; + pTexturea = this->uClipZ - v13; } v14 = this->uClipY; - if ( (signed int)v14 < v5 ) + if ( (signed int)this->uClipY < v5 ) v14 = v5; v6 = v17; - v15 = this->uClipW; - if ( (signed int)(v17 + v14) > (signed int)v15 ) + if ( (signed int)(v17 + v14) > (signed int)this->uClipW ) { v16 = this->uClipY; - if ( (signed int)v16 < v5 ) + if ( (signed int)this->uClipY < v5 ) v16 = v5; - v6 = v15 - v16; + v6 = this->uClipW - v16; } } if ( v6 > 0 ) @@ -8037,12 +7735,9 @@ unsigned int v12; // esi@12 unsigned int v13; // esi@15 unsigned int v15; // esi@18 -// char v17; // zf@26 int v18; // [sp+10h] [bp-10h]@4 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 int v20; // [sp+1Ch] [bp-4h]@4 -// int uXa; // [sp+28h] [bp+8h]@24 -// unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 if ( this->uNumSceneBegins ) { @@ -8079,25 +7774,25 @@ } v11 = this->uClipX; - if ( (signed int)v11 < (signed int)uX ) + if ( (signed int)this->uClipX < (signed int)uX ) v11 = uX; if ( (signed int)(v11 + v20) > (signed int)this->uClipZ ) { v12 = this->uClipX; - if ( (signed int)v12 < (signed int)uX ) + if ( (signed int)this->uClipX < (signed int)uX ) v12 = uX; v20 = this->uClipZ - v12; } v13 = this->uClipY; - if ( (signed int)v13 < (signed int)uY ) + if ( (signed int)this->uClipY < (signed int)uY ) v13 = uY; if ( (signed int)(v5 + v13) > (signed int)uClipW ) { v15 = this->uClipY; - if ( (signed int)v15 < (signed int)uY ) + if ( (signed int)this->uClipY < (signed int)uY ) v15 = uY; v5 = uClipW - v15; }
--- a/RenderD3D11.cpp Sun Sep 07 01:36:04 2014 +0200 +++ b/RenderD3D11.cpp Thu Sep 11 17:26:30 2014 +0600 @@ -1,4 +1,4 @@ -#include <d3dcompiler.h> +/*#include <d3dcompiler.h> #include <comdef.h> // _com_error #include "ErrorHandling.h" @@ -231,7 +231,7 @@ unsigned int device_flags = 0;//D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT; #ifndef NODEBUG - device_flags |= 0/*D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_DEBUGGABLE*/; + device_flags |= 0/*D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_DEBUGGABLE*//*; #endif HRESULT (__stdcall *dll_D3D11CreateDeviceAndSwapChain)(IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, UINT Flags, CONST D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, IDXGISwapChain** ppSwapChain, ID3D11Device** ppDevice, D3D_FEATURE_LEVEL* pFeatureLevel, ID3D11DeviceContext** ppImmediateContext); @@ -242,7 +242,7 @@ { MessageBoxA(nullptr, "Received Direct3D 9 or lower", "", 0); __debugbreak(); - } + }*/ /*if (fullscreen) { extern void ChangeResolution(int new_dith, int new_height, int new_bpp); @@ -253,7 +253,7 @@ } ErrorD3D(pSwapChain->SetFullscreenState(fullscreen, nullptr));*/ - +/* ID3D11Texture2D *pSwapChainSurface; { ErrorD3D(pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void **)&pSwapChainSurface)); @@ -322,4 +322,4 @@ d3dc->RSSetViewports(1, &viewport); return true; -} \ No newline at end of file +}*/ \ No newline at end of file
--- a/RenderD3D11.h Sun Sep 07 01:36:04 2014 +0200 +++ b/RenderD3D11.h Thu Sep 11 17:26:30 2014 +0600 @@ -1,4 +1,4 @@ -#pragma once +/*#pragma once #include <cstdint> #include <cstdio> @@ -170,3 +170,4 @@ ID3D11RenderTargetView *primary_srv; ID3D11DepthStencilView *depth_srv; }; +*/ \ No newline at end of file
--- a/UI/UICharacter.cpp Sun Sep 07 01:36:04 2014 +0200 +++ b/UI/UICharacter.cpp Thu Sep 11 17:26:30 2014 +0600 @@ -2592,7 +2592,7 @@ pParty->pPickedItem.Reset(); pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); _this.uBodyAnchor = 2; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v1], &_this, 0x24u); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v1], &_this, 0x24); pPlayers[uActiveCharacter]->pEquipment.uMainHand = v1 + 1; if ( pEquipType == EQUIP_WAND ) v50 = _this.uItemID;