Mercurial > mm7
changeset 2005:8fa26b63244a
Merge
author | Grumpy7 |
---|---|
date | Wed, 06 Nov 2013 00:09:47 -0800 |
parents | 2bcb4ec491cb (current diff) 72af4d93bdfb (diff) |
children | 30c2b575d25c |
files | |
diffstat | 22 files changed, 821 insertions(+), 266 deletions(-) [+] |
line wrap: on
line diff
--- a/.gitignore Tue Nov 05 20:42:54 2013 -0800 +++ b/.gitignore Wed Nov 06 00:09:47 2013 -0800 @@ -3,3 +3,4 @@ Release *.orig .hg/* +Build/
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj Tue Nov 05 20:42:54 2013 -0800 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj Wed Nov 06 00:09:47 2013 -0800 @@ -165,6 +165,7 @@ <ClCompile Include="..\..\mm7_4.cpp" /> <ClCompile Include="..\..\mm7_5.cpp" /> <ClCompile Include="..\..\mm7_6.cpp" /> + <ClCompile Include="..\..\mm7_7.cpp" /> <ClCompile Include="..\..\mm7_data.cpp" /> <ClCompile Include="..\..\Monsters.cpp" /> <ClCompile Include="..\..\Mouse.cpp" />
--- a/Game.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/Game.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -757,6 +757,7 @@ WriteWindowsRegistryInt("window X", Rect.left); WriteWindowsRegistryInt("window Y", Rect.top); } + window->Delete(); WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); pItemsTable->Release(); pNPCStats->Release();
--- a/Indoor.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/Indoor.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -487,7 +487,7 @@ //int v25; // eax@38 //char *v26; // edi@38 IDirect3DTexture2 *v27; // eax@42 - Texture *v28; // [sp+Ch] [bp-1Ch]@15 + //Texture *v28; // [sp+Ch] [bp-1Ch]@15 //int i; // [sp+10h] [bp-18h]@38 //LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16 //IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16 @@ -497,9 +497,6 @@ int a4a; // [sp+34h] [bp+Ch]@25 //unsigned int a4b; // [sp+34h] [bp+Ch]@38 - //v4 = uFaceID; - //a7 = pVertices; - //uFaceID_ = uFaceID; if (uFaceID >= pIndoor->uNumFaces) return; @@ -507,7 +504,6 @@ static RenderVertexSoft static_vertices_F7B628[64]; static stru154 stru_F7B60C; // idb - //v9 = &pIndoor->pFaces[uFaceID]; BLVFace* pFace = &pIndoor->pFaces[uFaceID]; if (pFace->uNumVertices < 3) return; @@ -522,8 +518,6 @@ if (!pFace->GetTexture()) return; - v28 = pFace->GetTexture(); - if (!pGame->pIndoorCameraD3D->IsCulled(pFace)) { uNumVerticesa = pFace->uNumVertices; @@ -551,8 +545,7 @@ pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28); pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0); pGame->pLightmapBuilder->std__vector_000004_size = 0; - if (stru_F8AD28.uNumLightsApplied > 0 || - pDecalBuilder->uNumDecals > 0) + if (stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0) { stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x; stru_F7B60C.polygonType = pFace->uPolygonType; @@ -570,10 +563,7 @@ if (pFace->Fluid()) { if (pFace->uBitmapID == pRenderer->hd_water_tile_id) - { - v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; - v27 = pBitmaps_LOD->pHardwareTextures[v23]; - } + v27 = pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]]; else { //auto v24 = GetTickCount() / 4; @@ -585,72 +575,52 @@ for (uint i = 0; i < uNumVerticesa; ++i) //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8)); array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle); - v23 = pFace->uBitmapID; - v27 = pBitmaps_LOD->pHardwareTextures[v23]; + v27 = pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID]; } } else if (pFace->uAttributes & 0x4000) - { - v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_); - v27 = pBitmaps_LOD->pHardwareTextures[v23]; - } + v27 = pBitmaps_LOD->pHardwareTextures[pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_)]; else { v17 = 0xFF808080; - v23 = pFace->uBitmapID; - v27 = pBitmaps_LOD->pHardwareTextures[v23]; + v27 = pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID]; } if (pFace->uAttributes & FACE_INDOOR_SKY) pRenderer->DrawIndoorSky(uNumVerticesa, uFaceID); else - pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0); + pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), v17, 0); return; } } } } - - - //----- (004B0E07) -------------------------------------------------------- unsigned int __fastcall sub_4B0E07(unsigned int uFaceID) { - BLVFace *v1; // edi@1 - BLVFaceExtra *v2; // ecx@1 - Texture *v3; // esi@1 - unsigned int v4; // eax@1 - unsigned int v5; // ecx@1 unsigned int result; // eax@1 - unsigned int v7; // ecx@5 - - v1 = &pIndoor->pFaces[uFaceID]; - v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; - v3 = pBitmaps_LOD->GetTexture(v1->uBitmapID); - stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; - stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; - v4 = GetTickCount(); - v5 = v1->uAttributes; - result = v4 >> 3; - if ( v5 & 4 ) + + stru_F8AD28.pDeltaUV[0] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaU; + stru_F8AD28.pDeltaUV[1] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaV; + result = GetTickCount() >> 3; + if ( pIndoor->pFaces[uFaceID].uAttributes & 4 ) { - stru_F8AD28.pDeltaUV[1] -= result & v3->uHeightMinus1; + stru_F8AD28.pDeltaUV[1] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1; } else { - if ( v5 & 0x20 ) - stru_F8AD28.pDeltaUV[1] += result & v3->uHeightMinus1; + if ( pIndoor->pFaces[uFaceID].uAttributes & 0x20 ) + stru_F8AD28.pDeltaUV[1] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1; } - v7 = v1->uAttributes; - if ( BYTE1(v7) & 8 ) + if ( BYTE1(pIndoor->pFaces[uFaceID].uAttributes) & 8 ) { - stru_F8AD28.pDeltaUV[0] -= result & v3->uWidthMinus1; + stru_F8AD28.pDeltaUV[0] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1; } else { - if ( v7 & 0x40 ) - stru_F8AD28.pDeltaUV[0] += result & v3->uWidthMinus1; + if ( pIndoor->pFaces[uFaceID].uAttributes & 0x40 ) + stru_F8AD28.pDeltaUV[0] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1; } return result; }
--- a/OSWindow.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/OSWindow.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -410,6 +410,15 @@ return false; } + HDC hDC = GetDC(NULL); + int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL); + int planes = GetDeviceCaps(hDC, PLANES); + ReleaseDC(NULL, hDC); + if (bitsPerPixel != 16 || planes != 1) + { + SetColorDepth(16); + } + SetWindowedMode(window_width, window_height); Show(); @@ -501,7 +510,8 @@ { SetWindowLongW(api_handle, GWL_EXSTYLE, 0); SetWindowLongW(api_handle, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW); - + SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, 0); + RECT rcWindow; GetWindowRect(api_handle, &rcWindow); @@ -789,3 +799,37 @@ return true; } + +bool OSWindow::SetColorDepth(int bit) +{ + dm.dmSize = sizeof(DEVMODE); + if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm)) + { + printf("EnumDisplaySettings failed:%d\n", GetLastError()); + return false; + } + dm.dmBitsPerPel = bit; + dm.dmFields = DM_BITSPERPEL; + if (ChangeDisplaySettings(&dm, CDS_TEST) !=DISP_CHANGE_SUCCESSFUL) + { + printf("\nIllegal graphics mode: %d\n", GetLastError()); + return false; + } + if (ChangeDisplaySettings(&dm, 0) == DISP_CHANGE_SUCCESSFUL) + { + ChangedColorDepth = true; + } +} + +void OSWindow::Delete() +{ + Deinitialize(); +} + +void OSWindow::Deinitialize() +{ + if( ChangedColorDepth ) + { + SetColorDepth(32); + } +} \ No newline at end of file
--- a/OSWindow.h Tue Nov 05 20:42:54 2013 -0800 +++ b/OSWindow.h Wed Nov 06 00:09:47 2013 -0800 @@ -6,7 +6,7 @@ { public: static OSWindow *Create(const wchar_t *title, int window_width, int window_height); - + void Delete(); void SetFullscreenMode(); void SetWindowedMode(int new_window_width, int new_window_height); @@ -38,11 +38,15 @@ protected: bool Initialize(const wchar_t *title, int window_width, int window_height); + void Deinitialize(); + bool SetColorDepth(int bit); bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result); HWND api_handle; + DEVMODE dm; private: + bool ChangedColorDepth; static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); HMENU CreateDebugMenuPanel();
--- a/Outdoor.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/Outdoor.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -239,11 +239,11 @@ // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); //----- (00488EEF) -------------------------------------------------------- -unsigned int OutdoorLocation::GetTileTexture(int sX, int sY) +unsigned int OutdoorLocation::GetTileTexture(signed int sX, signed int sY) { //OutdoorLocation *v3; // esi@1 - unsigned int v4; // edi@1 - unsigned int v5; // eax@1 + signed int v4; // edi@1 + signed int v5; // eax@1 // unsigned int result; // eax@5 /*v3 = this; @@ -2502,11 +2502,11 @@ } //----- (0047EE16) -------------------------------------------------------- -int OutdoorLocation::DoGetHeightOnTerrain(unsigned int uX, unsigned int uZ) +int OutdoorLocation::DoGetHeightOnTerrain(signed int sX, signed int sZ) { - assert(uX < 128 && uZ < 128); + assert(sX < 128 && sZ < 128); - return 32 * pTerrain.pHeightmap[uZ * 128 + uX]; + return 32 * pTerrain.pHeightmap[sZ * 128 + sX]; } //----- (0047EE49) --------------------------------------------------------
--- a/Outdoor.h Tue Nov 05 20:42:54 2013 -0800 +++ b/Outdoor.h Wed Nov 06 00:09:47 2013 -0800 @@ -140,7 +140,7 @@ unsigned int DoGetTileTexture(unsigned int uX, unsigned int uZ); int _47ED83(signed int a2, signed int a3); int ActuallyGetSomeOtherTileInfo(unsigned int uX, unsigned int uY); - int DoGetHeightOnTerrain(unsigned int uX, unsigned int uZ); + int DoGetHeightOnTerrain(signed int sX, signed int sZ); int GetSoundIdByPosition(signed int X_pos, signed int Y_pos, int a4); int UpdateDiscoveredArea(int a2, int a3, int a4); bool _47F04C(signed int a2, signed int a3);
--- a/ParticleEngine.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/ParticleEngine.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -632,7 +632,7 @@ //Particle *v14; // eax@28 RenderBillboardTransform_local0 v15; // [sp+Ch] [bp-58h]@1 - v15.uParentBillboardID = -1; + v15.sParentBillboardID = -1; for (uint i = uStartParticle; i < uEndParticle; ++i) { @@ -746,7 +746,7 @@ //int v15; // [sp+5Ch] [bp-8h]@9 int v16; // [sp+60h] [bp-4h]@1 - pBillboard.uParentBillboardID = -1; + pBillboard.sParentBillboardID = -1; pParticleEngine = this; //v2 = this->uStartParticle; //v5 = v2 > this->uEndParticle;// v5 = __OFSUB__(v2, this->uEndParticle);
--- a/Render.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/Render.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -128,6 +128,35 @@ return v0; } +void Render::sub_4A19B0() +{ + char *result; // eax@1 + signed int v1; // ecx@1 + /* + result = (char *)&this->pBillboardRenderListD3D[0].uOpacity; + v1 = 1000; + do + { + *(_DWORD *)result = 0; + *((_DWORD *)result + 1) = -1; + *((_DWORD *)result + 3) = -1; + *((_DWORD *)result - 34) = 4; + result += 156; + --v1; + } + while ( v1 ); + */ + for( int i = 0; i < 1000; i++ ) + { + this->pBillboardRenderListD3D[i].uOpacity = (RenderBillboardD3D::OpacityType)0; + this->pBillboardRenderListD3D[i].field_90 = -1; + this->pBillboardRenderListD3D[i].sParentBillboardID = -1; + this->pBillboardRenderListD3D[i].uNumVertices = 4; + } + + return; +} + //----- (00440CB8) -------------------------------------------------------- void Render::DrawBillboardList_BLV() { @@ -135,7 +164,7 @@ int v5; // eax@11 RenderBillboardTransform_local0 soft_billboard; // [sp+4h] [bp-50h]@1 - soft_billboard.uParentBillboardID = -1; + soft_billboard.sParentBillboardID = -1; soft_billboard.pTarget = pBLVRenderParams->pRenderTarget; soft_billboard.pTargetZ = pBLVRenderParams->pTargetZBuffer; soft_billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; @@ -150,7 +179,7 @@ RenderBillboard* p = &pBillboardRenderList[i]; soft_billboard.uScreenSpaceX = p->uScreenSpaceX; - soft_billboard.uParentBillboardID = i; + soft_billboard.sParentBillboardID = i; soft_billboard.uScreenSpaceY = p->uScreenSpaceY; soft_billboard._screenspace_x_scaler_packedfloat = p->_screenspace_x_scaler_packedfloat; soft_billboard._screenspace_y_scaler_packedfloat = p->_screenspace_y_scaler_packedfloat; @@ -378,7 +407,7 @@ //int v17; // [sp+5Ch] [bp-8h]@2 int v18; // [sp+60h] [bp-4h]@13 - billboard.uParentBillboardID = -1; + billboard.sParentBillboardID = -1; billboard.pTarget = pRenderer->pTargetSurface; billboard.pTargetZ = pRenderer->pActiveZBuffer; billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; @@ -394,7 +423,7 @@ billboard.uScreenSpaceX = pBillboard->uScreenSpaceX; billboard.uScreenSpaceY = pBillboard->uScreenSpaceY; - billboard.uParentBillboardID = i; + billboard.sParentBillboardID = i; billboard._screenspace_x_scaler_packedfloat = pBillboard->_screenspace_x_scaler_packedfloat; billboard.uTintColor = pBillboard->uTintColor; billboard._screenspace_y_scaler_packedfloat = pBillboard->_screenspace_y_scaler_packedfloat; @@ -2095,6 +2124,7 @@ hd_water_tile_id = -1; hd_water_current_frame = 0; + sub_4A19B0(); } bool Render::Initialize(bool bWindowed, OSWindow *window, bool bColoredLights, uint32_t uDetailLevel, bool bTinting) @@ -4508,7 +4538,7 @@ //----- (004A1EA3) -------------------------------------------------------- unsigned int Render::GetParentBillboardID(unsigned int uBillboardID) { - return pRenderer->pBillboardRenderListD3D[uBillboardID].uParentBillboardID; + return pRenderer->pBillboardRenderListD3D[uBillboardID].sParentBillboardID; } //----- (004A1EB6) -------------------------------------------------------- @@ -4978,7 +5008,7 @@ { d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; - d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / array_507D30[i].vWorldViewPosition.y; + d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw; d3d_vertex_buffer[i].diffuse = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); d3d_vertex_buffer[i].specular = 0; @@ -5051,6 +5081,7 @@ int v72; // [sp+14Ch] [bp-28h]@7 float v73; // [sp+150h] [bp-24h]@16 unsigned int v74; // [sp+154h] [bp-20h]@3 + unsigned int v74_; // [sp+154h] [bp-20h]@3 RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3 float v76; // [sp+15Ch] [bp-18h]@9 int v77; // [sp+160h] [bp-14h]@9 @@ -5060,7 +5091,7 @@ const void *v81; // [sp+170h] [bp-4h]@7 pFace = &pIndoor->pFaces[uFaceID]; - //for floor and wall------------------- + //for floor and wall(for example Selesta)------------------- if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor) { int v69 = (GetTickCount() / 32) - pGame->pIndoorCameraD3D->vPartyPos.x; @@ -5085,8 +5116,8 @@ * 65535.0) * (sin(v5) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z)); + stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); pSkyPolygon.Create_48607B(&stru_8019C8); - pSkyPolygon.ptr_38->_48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); pSkyPolygon.uTileBitmapID = pFace->uBitmapID; pSkyPolygon.pTexture = pBitmaps_LOD->GetTexture(pSkyPolygon.uTileBitmapID); @@ -5113,27 +5144,22 @@ v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; v78 = 0; - v81 = 0; + //v81 = 0; float v68 = 1.0 / (double)pSkyPolygon.pTexture->uTextureHeight; if ( (signed int)pSkyPolygon.uNumVertices <= 0 ) - { - pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, - pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); return; - } - - //v14 = (char *)&array_507D30[0].vWorldViewProjY; + int _507D30_idx = 0; - while ( 2 ) + for ( _507D30_idx; _507D30_idx < pSkyPolygon.uNumVertices; _507D30_idx++ ) { //v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY)); v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16; v74 = v77 + pSkyPolygon.ptr_38->angle_from_north; v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16; - v75 = (RenderVertexSoft *)(v77 + pSkyPolygon.ptr_38->angle_from_east); - - v79 = (void *)(((unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16); + v74_ = v77 + pSkyPolygon.ptr_38->angle_from_east; + + v79 = (void *)(((unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY))) >> 16); v17 = v72 * (pBLVRenderParams->uViewportCenterX - (int)array_507D30[_507D30_idx].vWorldViewProjX); v18 = array_507D30[_507D30_idx].vWorldViewProjY - 1.0; v19 = -pSkyPolygon.field_24; @@ -5147,7 +5173,7 @@ if ( !X ) goto LABEL_14; v21 = abs(v19 >> 14); - if ( v21 <= abs(X) ) + if ( v21 <= abs(X) )//0x800 <= 0x28652 break; if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) break; @@ -5165,121 +5191,96 @@ { LODWORD(v23) = v77 << 16; HIDWORD(v23) = v77 >> 16;//v23 = 0xfffffe0000000000 - int i = HIDWORD(v23) / X; - v79 = (void *)(v23 / X);//X = FFFF96A3(FFFF9014) - v77 = v17; + v79 = (void *)(v23 / X);//X = FFFF9014(-28652) v77 = v17; - - LODWORD(v76) = v74 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v17) >> 16); - LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); - //v24 = (double)SLODWORD(v80) * 0.000015259022; + signed __int64 s = v74 + ((pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v17) >> 16);// s = 0xFFFFFFFF FFFF3EE6 + LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(s) * (v23 / X)) >> 16) >> 4); array_507D30[_507D30_idx].u = ((double)SLODWORD(v80) * 0.000015259022) * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth); - v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v17) >> 16)); - LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); + signed __int64 s2 = (signed __int64)(v74_ + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v17) >> 16)); + LODWORD(v80) = v63 + ((signed int)((unsigned __int64)(SLODWORD(s2) * (v23 / X)) >> 16) >> 4); array_507D30[_507D30_idx].v = ((double)SLODWORD(v80) * 0.000015259022) * v68; - v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; - LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; - //v14 += 48; - v81 = (char *)v81 + 1; - //v26 = __OFSUB__((int)v81, pSkyPolygon.uNumVertices); - //v25 = (signed int)((char *)v81 - pSkyPolygon.uNumVertices) < 0; + v77 = (unsigned __int64)(SLODWORD(s) * (v23 / X)) >> 16; + LODWORD(v73) = (unsigned __int64)(SLODWORD(s2) * (v23 / X)) >> 16; array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79; - /* - v18 = v17 / v38; - if ( v18 < 0 ) - v18 = pODMRenderParams->shading_dist_mist; - - v37 = v35 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v13) >> 16); - v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + ((signed int)((unsigned __int64)(v37 * (signed __int64)v18) >> 16) >> 3); - array_50AC10[i].u = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureWidth * 65536.0); - - v36 = v36 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v13) >> 16); - v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + ((signed int)((unsigned __int64)(v36 * (signed __int64)v18) >> 16) >> 3); - array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0); - - array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist - array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16); - */ - _507D30_idx++; - if ( (int)v81 >= pSkyPolygon.uNumVertices ) - { - pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, - pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); - return; - } + + //if ( (int)v81 >= pSkyPolygon.uNumVertices ) + //{ + // pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, + // pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); + // return; + //} continue; } break; } + if ( _507D30_idx >= pSkyPolygon.uNumVertices ) + { + pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, + pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); + return; + } LODWORD(v73) = 0; v80 = v76; if ( (signed int)pSkyPolygon.uNumVertices > 0 ) { v28 = (double)SLODWORD(v76); LODWORD(v76) = (int)(char *)array_50AC10 + 28; - v29 = (char *)&array_50AC10[0].vWorldViewProjX; - v30 = (char *)&array_507D30[1].vWorldViewProjY; - v79 = array_50AC10; - v81 = array_507D30; - v78 = pSkyPolygon.uNumVertices; - do - { - v31 = v28 < *((float *)v30 - 12); - v32 = v28 == *((float *)v30 - 12); + uint i = 0; + for ( v78 = pSkyPolygon.uNumVertices; v78; --v78 ) + { ++LODWORD(v73); - memcpy(v79, v81, 0x30u); - v79 = (char *)v79 + 48; + memcpy(&array_50AC10[i], &array_507D30[i], 0x30u); LODWORD(v76) += 48; - v29 += 48; - if ( v31 | v32 || v28 >= *(float *)v30 ) - { - if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 ) - goto LABEL_28; - v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12)) - + *((float *)v30 - 1); + if ( v28 < array_507D30[i].vWorldViewProjY | v28 == array_507D30[i].vWorldViewProjY + || v28 >= array_507D30[i + 1].vWorldViewProjY ) + { + if ( v28 >= array_507D30[i].vWorldViewProjY || v28 <= array_507D30[i + 1].vWorldViewProjY ) + { + i++; + continue; + } + v33 = (array_507D30[i + 1].vWorldViewProjX - array_507D30[i].vWorldViewProjX) * v28 / (array_507D30[i + 1].vWorldViewProjY - array_507D30[i].vWorldViewProjY) + + array_507D30[i + 1].vWorldViewProjX; } else { - v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30) - + *((float *)v30 - 13); - } - *(float *)v29 = v33; - v79 = (char *)v79 + 48; - v29 += 48; + v33 = (array_507D30[i].vWorldViewProjX - array_507D30[i + 1].vWorldViewProjX) * v28 / (array_507D30[i].vWorldViewProjY - array_507D30[i + 1].vWorldViewProjY) + + array_507D30[i].vWorldViewProjX; + } + array_50AC10[i + 1].vWorldViewProjX = v33; ++LODWORD(v73); *(unsigned int *)LODWORD(v76) = v28; LODWORD(v76) += 48; -LABEL_28: - v81 = (char *)v81 + 48; - v30 += 48; - --v78; - } - while ( v78 ); + i++; + } } if ( SLODWORD(v73) <= 0 ) goto LABEL_40; - v34 = (char *)&array_50AC10[0].vWorldViewProjY; + //v34 = (char *)&array_50AC10[0].vWorldViewProjY; + uint j = 0; v65 = v77 >> 14; - HIDWORD(v69) = LODWORD(v73); - do - { - v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); - v78 = pSkyPolygon.ptr_38->viewing_angle_from_west_east; - v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); + //HIDWORD(v69) = LODWORD(v73); + for ( int t = (int)LODWORD(v73); t > 1; t-- ) + { + v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)array_50AC10[j].vWorldViewProjY)); + + //v78 = pSkyPolygon.ptr_38->viewing_angle_from_west_east; + v81 = (const void *)((unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(signed int)v35) >> 16); v36 = (int)((char *)v81 + pSkyPolygon.ptr_38->angle_from_north); + v81 = v35; v74 = v36; - v78 = pSkyPolygon.ptr_38->viewing_angle_from_north_south; - v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); + //v78 = pSkyPolygon.ptr_38->viewing_angle_from_north_south; + v81 = (const void *)((unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(signed int)v35) >> 16); v78 = (int)v35; v75 = (RenderVertexSoft *)((char *)v81 + pSkyPolygon.ptr_38->angle_from_east); v81 = (const void *)pSkyPolygon.v_18.z; v78 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)v35) >> 16; v37 = (const void *)(v72 - * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); - v38 = (signed __int64)(*(float *)v34 - 1.0); + * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)array_50AC10[j].vWorldViewProjX)); + v38 = (signed __int64)(array_50AC10[j].vWorldViewProjY - 1.0); v81 = 0; LODWORD(v76) = v38; v39 = v72 * (v70 - v38); @@ -5309,7 +5310,7 @@ v81 = (const void *)((unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)(signed __int64)(((double)v70 - ((double)(2 * LODWORD(v76)) - - *(float *)v34)) + - array_50AC10[j].vWorldViewProjY)) * (double)v72)) >> 16); X = (int)((char *)v81 + pSkyPolygon.v_18.x); } @@ -5317,72 +5318,61 @@ HIDWORD(v42) = v77 >> 16; v79 = (void *)(v42 / X); v81 = v37; - v78 = pSkyPolygon.ptr_38->angle_from_west; - v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); - v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); + + //v78 = pSkyPolygon.ptr_38->angle_from_west; + v81 = (const void *)((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)(signed int)v37) >> 16); + v43 = v74 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)(signed int)v37) >> 16); v74 = (unsigned int)v37; LODWORD(v76) = v43; - v78 = pSkyPolygon.ptr_38->angle_from_south; - v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); + + //v78 = pSkyPolygon.ptr_38->angle_from_south; + v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)(signed int)v37) >> 16)); v74 = (unsigned __int64)(v43 * v42 / X) >> 16; v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); - v34 += 48; + + //v34 += 48; v78 = v66 + ((signed int)v74 >> 4); - v44 = HIDWORD(v69)-- == 1; + //v44 = HIDWORD(v69)-- == 1; v45 = (double)v78 * 0.000015259022; v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); - *((float *)v34 - 10) = v45 * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth); - *((float *)v34 - 9) = (double)v78 * 0.000015259022 * v68; - v46 = (double)(signed int)v79; - *((float *)v34 - 16) = 0.000015258789 * v46; - *((float *)v34 - 11) = 65536.0 / v46; - } - while ( !v44 ); + array_50AC10[j].u = v45 * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth); + array_50AC10[j].v = (double)v78 * 0.000015259022 * v68; + //v46 = (double)(signed int)v79; + array_50AC10[j].vWorldViewPosition.x = 0.000015258789 * (double)(signed int)v79; + array_50AC10[j]._rhw = 65536.0 / (double)(signed int)v79; + ++j; + } + //while ( !v44 ); LABEL_40: - v47 = 0; + uint i = 0; if ( SLODWORD(v73) > 0 ) { v48 = (double)SLODWORD(v80); - v75 = array_507D30; - v49 = array_50AC10; - HIDWORD(v69) = LODWORD(v73); - do - { - if ( v48 >= v49->vWorldViewProjY ) - { - v50 = v75; - ++v47; - ++v75; - memcpy(v50, v49, 0x30u); - } - ++v49; - --HIDWORD(v69); - } - while ( HIDWORD(v69) ); - } - pSkyPolygon.uNumVertices = v47; - pRenderer->DrawIndoorSkyPolygon(v47, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); - *(float *)&v74 = 0.0; + for ( HIDWORD(v69) = LODWORD(v73); HIDWORD(v69); --HIDWORD(v69) ) + { + if ( v48 >= array_50AC10[i].vWorldViewProjY ) + { + ++i; + memcpy(&array_507D30[i], &array_50AC10[i], 0x30u); + } + } + } + pSkyPolygon.uNumVertices = i; + pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); + int pNumVertices = 0; if ( SLODWORD(v73) > 0 ) { v51 = (double)SLODWORD(v80); - v75 = array_507D30; - v52 = array_50AC10; - for ( v80 = v73; v80; --v80 ) - { - if ( v51 <= v52->vWorldViewProjY ) - { - v53 = v75; - ++v74; - ++v75; - memcpy(v53, v52, 0x30u); - } - ++v52; - //--LODWORD(v80); - } - //while ( v80 != 0.0 ); - } - pRenderer->DrawIndoorSkyPolygon(v74, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); + for ( v80 = v73; v80 != 0.0; --LODWORD(v80) ) + { + if ( v51 <= array_50AC10[pNumVertices].vWorldViewProjY ) + { + ++pNumVertices; + memcpy(&array_507D30[pNumVertices], &array_50AC10[pNumVertices], 0x30u); + } + } + } + pRenderer->DrawIndoorSkyPolygon(pNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); } @@ -5637,7 +5627,7 @@ //v10 = a3; pBillboardRenderListD3D[v7].field_90 = pSoftBillboard->field_44; pBillboardRenderListD3D[v7].sZValue = pSoftBillboard->sZValue; - pBillboardRenderListD3D[v7].uParentBillboardID = pSoftBillboard->uParentBillboardID; + pBillboardRenderListD3D[v7].sParentBillboardID = pSoftBillboard->sParentBillboardID; //v25 = pSoftBillboard->uScreenSpaceX; //v24 = pSoftBillboard->uScreenSpaceY; a1 = (pSoftBillboard->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_x_scaler_packedfloat); @@ -5770,7 +5760,7 @@ pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; pBillboardRenderListD3D[v8].field_90 = a2->field_44; pBillboardRenderListD3D[v8].sZValue = a2->sZValue; - pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; + pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID; //v9 = a2->uScreenSpaceX; //v10 = a2->uScreenSpaceY; v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); @@ -5943,7 +5933,7 @@ pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; pBillboardRenderListD3D[v8].field_90 = a2->field_44; pBillboardRenderListD3D[v8].sZValue = a2->sZValue; - pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; + pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID; v9 = a2->uScreenSpaceX; v10 = a2->uScreenSpaceY; v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); @@ -6157,7 +6147,7 @@ pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; pBillboardRenderListD3D[v8].field_90 = a2->field_44; pBillboardRenderListD3D[v8].sZValue = a2->sZValue; - pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; + pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID; if (a2->uTintColor & 0xFF000000) pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3; @@ -6346,7 +6336,7 @@ v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth); pBillboardRenderListD3D[v5].field_90 = 0; - pBillboardRenderListD3D[v5].uParentBillboardID = -1; + pBillboardRenderListD3D[v5].sParentBillboardID = -1; pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; pBillboardRenderListD3D[v5].pTexture = 0; pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices;
--- a/Render.h Tue Nov 05 20:42:54 2013 -0800 +++ b/Render.h Wed Nov 06 00:09:47 2013 -0800 @@ -203,7 +203,7 @@ OpacityType uOpacity; int field_90; int sZValue; - unsigned int uParentBillboardID; + signed int sParentBillboardID; }; #pragma pack(pop) @@ -369,7 +369,7 @@ //void ExecOutdoorDrawSW(); void ChangeBetweenWinFullscreenModes(); void DrawBillboardList_BLV(); - + void __cdecl sub_4A19B0(); //unsigned int bUserDirect3D; unsigned int bStartInWindow; @@ -498,7 +498,7 @@ unsigned int uViewportZ; unsigned int uViewportW; int field_44; - int uParentBillboardID; + int sParentBillboardID; int uTintColor; }; #pragma pack(pop)
--- a/UI/UIPopup.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/UI/UIPopup.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -473,7 +473,7 @@ Actor::Actor(&pMonsterInfoUI_Doll); atexit(nullsub_3); }*/ - v106.uParentBillboardID = -1; + v106.sParentBillboardID = -1; v115 = monster_popup_y_offsets[((signed __int16)pActors[uActorID].pMonsterInfo.uID - 1) / 3] - 40; if ( pActors[uActorID].pMonsterInfo.uID == pMonsterInfoUI_Doll.pMonsterInfo.uID ) v9 = pMonsterInfoUI_Doll.uCurrentActionLength;
--- a/UI/UiGame.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/UI/UiGame.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -615,9 +615,9 @@ pButton->uHeight = pTextHeight; v42 = pButton->uY + pTextHeight - 1; pButton->uW = v42; - pTextColor = ui_game_dialogue_option_highlight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = ui_game_dialogue_option_normal_color; + pTextColor = ui_game_dialogue_option_normal_color; + if ( pDialogueWindow->pCurrentPosActiveItem == i ) + pTextColor = ui_game_dialogue_option_highlight_color; window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3); } }
--- a/Vis.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/Vis.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -132,8 +132,8 @@ { if (v13 == -1) v13 = i; - else if ((unsigned int)pBillboardRenderList[billboard->uParentBillboardID].sZValue < - pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) + else if ((unsigned int)pBillboardRenderList[billboard->sParentBillboardID].sZValue < + pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].sParentBillboardID].sZValue) v13 = i; } } @@ -221,9 +221,9 @@ { if (DoesRayIntersectBillboard(fPickDepth, i)) { - RenderBillboard* billboard = &pBillboardRenderList[d3d_billboard->uParentBillboardID]; + RenderBillboard* billboard = &pBillboardRenderList[d3d_billboard->sParentBillboardID]; - list->AddObject((void *)d3d_billboard->uParentBillboardID, VisObjectType_Sprite, billboard->sZValue); + list->AddObject((void *)d3d_billboard->sParentBillboardID, VisObjectType_Sprite, billboard->sZValue); } } } @@ -260,7 +260,7 @@ float v29; // [sp+8h] [bp-4h]@2 float a1a; // [sp+14h] [bp+8h]@2 - if ( a1->uParentBillboardID == -1 ) + if ( a1->sParentBillboardID == -1 ) return false; //result = a1; @@ -1379,9 +1379,9 @@ { if (DoesRayIntersectBillboard(pick_depth, i)) { - RenderBillboard* billboard = &pBillboardRenderList[d3d_billboard->uParentBillboardID]; + RenderBillboard* billboard = &pBillboardRenderList[d3d_billboard->sParentBillboardID]; - list->AddObject((void *)d3d_billboard->uParentBillboardID, VisObjectType_Sprite, billboard->sZValue); + list->AddObject((void *)d3d_billboard->sParentBillboardID, VisObjectType_Sprite, billboard->sZValue); } } } @@ -1414,8 +1414,8 @@ case VisObjectType_Sprite: { v5 = filter->select_flags; - int object_idx = PID_ID(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].uParentBillboardID].object_pid); - int object_type = PID_TYPE(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].uParentBillboardID].object_pid); + int object_idx = PID_ID(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].sParentBillboardID].object_pid); + int object_type = PID_TYPE(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].sParentBillboardID].object_pid); if ( v5 & 2 ) { if (object_type == filter->object_id) @@ -1541,7 +1541,7 @@ static Vis_SelectionList Vis_static_stru_F91E10; Vis_static_stru_F91E10.uNumPointers = 0; - v3 = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].uParentBillboardID; + v3 = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].sParentBillboardID; if (v3 == -1) return false;
--- a/_deleted.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/_deleted.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -9381,22 +9381,6 @@ return result; } -//----- (00423B4A) -------------------------------------------------------- -void sub_423B4A() -{ - float *v0; // eax@1 - signed int v1; // ecx@1 - - v0 = &array_507D30[0].flt_2C; - v1 = 50; - do - { - *v0 = 0.0; - v0 += 12; - --v1; - } - while ( v1 ); -} //----- (004AD504) -------------------------------------------------------- int __fastcall sr_4AD504(signed int sFaceID)
--- a/mm7_2.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/mm7_2.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -4350,6 +4350,7 @@ uCPUSpeed = Rect.bottom;*/ uCPUSpeed = 2048; // about 2GHz + constructors(); if (!MM7_Initialize(640, 480)) { @@ -6011,7 +6012,7 @@ v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; v124 = 8 * v153; LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); return 0; }
--- a/mm7_3.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/mm7_3.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -5655,7 +5655,7 @@ int v12; // [sp+60h] [bp-8h]@1 int v13; // [sp+64h] [bp-4h]@6 - v10.uParentBillboardID = -1; + v10.sParentBillboardID = -1; v10.pTarget = pRenderer->pTargetSurface; v10.pTargetZ = pRenderer->pActiveZBuffer; v10.uTargetPitch = pRenderer->field_10;
--- a/mm7_5.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/mm7_5.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -1034,6 +1034,9 @@ signed int a3a; // [sp+24h] [bp+8h]@14 int a4a; // [sp+28h] [bp+Ch]@2 + std::array<int, 52> dword_4F5CC8_ys; // idb + std::array<int, 52> dword_4F5D98_xs; // idb + //__debugbreak(); v5 = a4->uAttributes; @@ -1128,6 +1131,9 @@ int a4a; // [sp+28h] [bp+Ch]@2 signed int a5a; // [sp+2Ch] [bp+10h]@14 + std::array<int, 52> dword_4F5B24_ys; // idb + std::array<int, 52> dword_4F5BF4_xs; // idb + __debugbreak(); v5 = a4->uAttributes;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mm7_7.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -0,0 +1,560 @@ +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include "mm7_data.h" +#include "Render.h" +#include "texts.h" +#include "Party.h" +#include "Viewport.h" + +int __cdecl sub_401022() +{ + int result; // eax@1 + signed int v1; // ecx@1 + int *v2; // edx@1 +/* + result = (int)dword_4F8580; + v1 = 60; + v2 = &dword_4F8580[1]; + do + { + v2[2] = 0; + v2[1] = 0; + *v2 = 0; + v2 += 3; + --v1; + } + while ( v1 ); + dword_4F8580[0] = 1; + return result; + */ + + for( int i = 0; i < 62; i++ ) + { + dword_4F8580[i] = 0; + } + dword_4F8580[0] = 1; + return 0; +} + +//----- (00423B4A) -------------------------------------------------------- +void sub_423B4A() +{ + float *v0; // eax@1 + signed int v1; // ecx@1 + + v0 = &array_507D30[0].flt_2C; + v1 = 50; + do + { + *v0 = 0.0; + v0 += 12; + --v1; + } + while ( v1 ); +} + +/* +GUIProgressBar *__cdecl crt_construct_576E30() +{ + RGBTexture::RGBTexture(&pGameLoadingUI_ProgressBar.pLoadingBg); + RGBTexture::RGBTexture(&pGameLoadingUI_ProgressBar.field_40); + RGBTexture::RGBTexture(&pGameLoadingUI_ProgressBar.field_68); + RGBTexture::RGBTexture(&pGameLoadingUI_ProgressBar.field_90); + RGBTexture::RGBTexture(&pGameLoadingUI_ProgressBar.field_B8); + Texture::Texture(&pGameLoadingUI_ProgressBar.field_E0); + Texture::Texture(&pGameLoadingUI_ProgressBar.pBardata); + Texture::Texture(&pGameLoadingUI_ProgressBar.pLoadingProgress); + pGameLoadingUI_ProgressBar.uProgressCurrent = 0; + pGameLoadingUI_ProgressBar.uProgressMax = 0; + pGameLoadingUI_ProgressBar.field_9 = 0; + pGameLoadingUI_ProgressBar.field_8 = 0; + pGameLoadingUI_ProgressBar.uHeight = 0; + pGameLoadingUI_ProgressBar.uWidth = 0; + pGameLoadingUI_ProgressBar.uY = 0; + pGameLoadingUI_ProgressBar.uX = 0; + pGameLoadingUI_ProgressBar.field_17 = 0; + pGameLoadingUI_ProgressBar.field_16 = 0; + pGameLoadingUI_ProgressBar.field_15 = 0; + pGameLoadingUI_ProgressBar.field_14 = 0; + pGameLoadingUI_ProgressBar.field_13 = 0; + pGameLoadingUI_ProgressBar.field_12 = 0; + pGameLoadingUI_ProgressBar.field_11 = 0; + pGameLoadingUI_ProgressBar.field_10 = 0; + return &pGameLoadingUI_ProgressBar; +} +*/ + +void __cdecl crt_init_globals_46BD9F() +{ + pPartyActionQueue->uNumActions = 0; +} + +void __cdecl sub_4C023F() +{ + pViewport->field_30 = 32768; + pViewport->SetScreen(0, 0, 639u, 479u); +} + +void constructors() +{ + sub_401022(); + sub_423B4A(); + crt_init_globals_46BD9F(); + sub_4C023F(); + + //no call to these anywhere + uGameUIFontMain_initialize(); + uGameUIFontShadow_initialize(); + SetSomeItemsNames(); +} + +/* + +X = called already in our code +byte = constructor byte setter + +.data:004DF004 dd offset sub_4C9A95 +IOStream + +.data:004DF008 dd offset sub_4C9B06 +IOStream + +.data:004DF00C dd offset sub_401022 +added + +.data:004DF010 dd offset sub_408B98 +.data:004DF014 dd offset sub_409BCC +.data:004DF018 dd offset crt_sub_40D6EB +byte + +.data:004DF01C dd offset crt_construct_40D707_ptr_pArcomageGame +X + +.data:004DF020 dd offset crt_sub_40E4A6 +.data:004DF024 dd offset crt_deconstruct_40E503 +.data:004DF028 dd offset crt_sub_40F760 +.data:004DF02C dd offset crt_sub_40F7EA +.data:004DF030 dd offset crt_sub_40F9A9 +.data:004DF034 dd offset crt_sub_410AD9 +byte + +.data:004DF038 dd offset SetMoonPhaseNames +X + +.data:004DF03C dd offset crt_sub_413FD0 +byte + +.data:004DF040 dd offset j_SetMonthNames +.data:004DF044 dd offset j_SetDayNames +.data:004DF048 dd offset j_SetSpellSchoolNames +.data:004DF04C dd offset j_SetAttributeNames +X InitializeGameText + +.data:004DF050 dd offset uGameUIFontMain_initialize +.data:004DF054 dd offset uGameUIFontShadow_initialize +added + +.data:004DF058 dd offset crt_construct_507ABC +.data:004DF05C dd offset crt_construct_507A94 +.data:004DF060 dd offset crt_construct_507A6C +.data:004DF064 dd offset crt_construct_507A44 +.data:004DF068 dd offset crt_construct_507A1C +.data:004DF06C dd offset crt_construct_506F20 +.data:004DF070 dd offset crt_construct_414D90_ptr_506E40 +X (RGBTexture constructor) + +.data:004DF074 dd offset crt_sub_423903 +byte + +.data:004DF078 dd offset IndoorCamera__IndoorCamera +X + +.data:004DF07C dd offset crt_sub_423ACD +byte + +.data:004DF080 dd offset j_reset_some_strus_flt_2Cs +deleted + +.data:004DF084 dd offset j_sub_423B4A +added + +.data:004DF088 dd offset crt_sub_4262DD +byte + +.data:004DF08C dd offset crt_construct_pEventTimer +.data:004DF090 dd offset crt_construct_pMiscTimer +X + +.data:004DF094 dd offset crt_sub_42640D +.data:004DF098 dd offset crt_sub_4268C7 +.data:004DF09C dd offset crt_sub_42692B +byte + +.data:004DF0A0 dd offset sub_426947 +X initialized + +.data:004DF0A4 dd offset crt_construct_50C0C8 +X CastSpellInfo + +.data:004DF0A8 dd offset crt_sub_42FBB7 +byte + +.data:004DF0AC dd offset crt_construct_50CDB4 +seems unused CastSpellInfo variable + +.data:004DF0B0 dd offset sub_4361D3 +.data:004DF0B4 dd offset sub_4382A0 +.data:004DF0B8 dd offset sub_43850A +.data:004DF0BC dd offset crt_438AEF +.data:004DF0C0 dd offset crt_438B7F +.data:004DF0C4 dd offset ctr_deconstruct_43B4E0 +byte + +.data:004DF0C8 dd offset crt_43B4FC +deleted, constructor for stru_51076C + +.data:004DF0CC dd offset crt_deconstruct_43B51C +.data:004DF0D0 dd offset crt_deconstruct_43B5F0 +.data:004DF0D4 dd offset crt_deconstruct_43B64C +byte + +.data:004DF0D8 dd offset _crt_construct_stru165 +X BloodsplatContainer + +.data:004DF0DC dd offset crt_deconstruct_43B751 +.data:004DF0E0 dd offset crt_deconstruct_43B9E3 +.data:004DF0E4 dd offset crt_deconstruct_43BC8B +.data:004DF0E8 dd offset crt_deconstruct_43F22A +byte + +.data:004DF0EC dd offset crt_construct_51B778 +X BspRenderer + +.data:004DF0F0 dd offset crt_construct_519AB8 +X LightsStack_MobileLight + +.data:004DF0F4 dd offset crt_construct_5187F0 +X LightsStack_StationaryLight + + +.data:004DF0F8 dd offset crt_deconstruct_440B28 +.data:004DF0FC dd offset crt_deconstruct_440F5C +byte + +.data:004DF100 dd offset crt_construct_576E30 +added but have to RECHECK + +.data:004DF104 dd offset crt_deconstruct_4437E5 +byte + +.data:004DF108 dd offset sub_446219 +X InitializeGameText + +.data:004DF10C dd offset crt_construct_5773C4 +unused RGBTexture + +.data:004DF110 dd offset sub_44C346 +.data:004DF114 dd offset crt_deconstruct_44C42C +.data:004DF118 dd offset crt_deconstruct_44D49E +byte + +.data:004DF11C dd offset _inline_SpriteFrameTable__SpriteFrameTable_global +.data:004DF120 dd offset _inline_TextureFrameTable__TextureFrameTable_global +X + +.data:004DF124 dd offset sub_44E49B +.data:004DF128 dd offset sub_44F1F9 +.data:004DF12C dd offset sub_44F560 +.data:004DF130 dd offset sub_450DC2 +.data:004DF134 dd offset crt_deconstruct_45232B +byte + +.data:004DF138 dd offset crt_construct_stru193_math@5C6E00 +X + +.data:004DF13C dd offset crt_452B74 +byte + +.data:004DF140 dd offset j_SetSomeItemsNames +added + +.data:004DF144 dd offset crt_deconstruct_458364 +byte + +.data:004DF148 dd offset _intline_DecorationList__DecorationList_global +X + +.data:004DF14C dd offset j_crt_construct_6836D0 +X LevelDecorations + +.data:004DF150 dd offset _inline_ObjectList__ObjectList_global +X + +.data:004DF154 dd offset j_crt_construct_665230 +X SpriteObjects + +.data:004DF158 dd offset j_crt_construct_5FF158 +X Actors + +.data:004DF15C dd offset _inline_MonsterList__MonsterList_global +X + +.data:004DF160 dd offset _inline_ChestList__ChestList_global +X + +.data:004DF164 dd offset j_crt_construct_5E5150 +X Chests + +.data:004DF168 dd offset _inline_OverlayList__OverlayList_global +X + +.data:004DF16C dd offset crt_construct_5E4D58 +X OverlayList + +.data:004DF170 dd offset sub_459C05 +byte + +.data:004DF174 dd offset sub_459C21 +X KeyboardActionMapping + +.data:004DF178 dd offset crt_deconstruct_45AFBD +.data:004DF17C dd offset crt_deconstruct_45B0EE +.data:004DF180 dd offset sub_45BA89 +byte + +.data:004DF184 dd offset crt_call_global_ctor_45BAA5 +stru_69BD44 = "effpar03" , need RECHECK + +.data:004DF188 dd offset crt_deconstruct_45DEF7 +.data:004DF18C dd offset crt_deconstruct_45DF53 +.data:004DF190 dd offset crt_deconstruct_45DF6F +.data:004DF194 dd offset crt_deconstruct_45DF8B +byte + +.data:004DF198 dd offset crt_construct_ptr_6A0A60 +X LODFile + +.data:004DF19C dd offset crt_construct_ptr_6A0820 +X LODFile + +.data:004DF1A0 dd offset j_crt_construct_ptr_6A0118 +X RGBTexture + +.data:004DF1A4 dd offset sub_461415 +.data:004DF1A8 dd offset crt_deconstruct_4621BE +.data:004DF1AC dd offset crt_deconstruct_46220E +byte + +.data:004DF1B0 dd offset crt_construct_ptr_702B28 +X Allocator + +.data:004DF1B4 dd offset sub_46224A +X unused + +.data:004DF1B8 dd offset crt_construct_ptr_06F0E80 +X LODFile_IconsBitmaps + +.data:004DF1BC dd offset sub_4623CF +X LODFile_Sprites + +.data:004DF1C0 dd offset crt_call_ctors__pIcons_LOD +.data:004DF1C4 dd offset crt_call_ctors__pEvents_LOD +.data:004DF1C8 dd offset _inline_IndoorLocation__IndoorLocation_global +X + +.data:004DF1CC dd offset crt_init_globals_462620 +X initialized + +.data:004DF1D0 dd offset crt_construct_ptr_6BE158 +unused stru289 + +.data:004DF1D4 dd offset j_crt_init_globals_462659 +X initialized + +.data:004DF1D8 dd offset crt_construct_ptr_06BE070 +X ODMRenderParams + +.data:004DF1DC dd offset crt_init_globals_46269B +unused SW variable + +.data:004DF1E0 dd offset crt_construct_ptr_6BE048 +X TileTable + +.data:004DF1E4 dd offset crt_construct_ptr_6A0DF0 +X OutdoorLocation + +.data:004DF1E8 dd offset sub_466CA6 +.data:004DF1EC dd offset crt_deconstruct_467D29 +.data:004DF1F0 dd offset sub_467E32 +.data:004DF1F4 dd offset crt_deconstruct_46AC2C +byte + +.data:004DF1F8 dd offset crt_construct_46AC48_ptr_720990 +X std__string_720990 = "micon1" , need RECHECK + +.data:004DF1FC dd offset crt_deconstruct_46BD83 +byte + +.data:004DF200 dd offset crt_init_globals_46BD9F +added + +.data:004DF204 dd offset nullsub_26 +X + +.data:004DF208 dd offset sub_476102 +byte + +.data:004DF20C dd offset sub_47611E +X Texture + +.data:004DF210 dd offset sub_476128 +dword_7241C8 = 1 RECHECK + +.data:004DF214 dd offset sub_476133 +X InitializeGameText + +.data:004DF218 dd offset sub_477595 +.data:004DF21C dd offset sub_47836D +.data:004DF220 dd offset crt_sub_4783D9 +byte + +.data:004DF224 dd offset j__sub_4783FA_construct_global_73D150 + + +.data:004DF228 dd offset sub_47A368 +.data:004DF22C dd offset sub_47C778 +.data:004DF230 dd offset sub_47CDBE +byte + +.data:004DF234 dd offset sub_47CDDA + + +.data:004DF238 dd offset sub_47F483 +byte + +.data:004DF23C dd offset sub_47F49F + + +.data:004DF240 dd offset sub_47F4B9 + + +.data:004DF244 dd offset sub_482A74 +.data:004DF248 dd offset sub_485F37 +.data:004DF24C dd offset sub_486A0C +.data:004DF250 dd offset crt_deconstruct_487DF7 +.data:004DF254 dd offset sub_488E07 +.data:004DF258 dd offset sub_489572 +.data:004DF25C dd offset crt_deconstruct_489B44 +.data:004DF260 dd offset crt_deconstruct_489BBA +byte + +.data:004DF264 dd offset crt_construct_489BD6_ptr_080D198 +X PaletteManager + +.data:004DF268 dd offset sub_48AAA9 +.data:004DF26C dd offset sub_48C20E +byte + +.data:004DF270 dd offset sub_48C22A +.data:004DF274 dd offset loc_48C234 +.data:004DF278 dd offset loc_48C243 +.data:004DF27C dd offset loc_48C252 +.data:004DF280 dd offset loc_48C3C0 +.data:004DF284 dd offset loc_48C474 +Party constructor + +.data:004DF288 dd offset sub_49801C +.data:004DF28C dd offset sub_498077 +.data:004DF290 dd offset sub_498A25 +.data:004DF294 dd offset sub_49AFE5 +.data:004DF298 dd offset crt_deconstruct_49B36B +byte + +.data:004DF29C dd offset crt_construct_stru187@AE5BA8 +X DecalBuilder + +.data:004DF2A0 dd offset crt_construct_ptr_AE5B94 +std__string_AE5B94 = "hwsplat04", need RECHECK + +.data:004DF2A4 dd offset sub_49C594 +.data:004DF2A8 dd offset sub_49D6C8 +.data:004DF2AC dd offset sub_49D6E4 +.data:004DF2B0 dd offset sub_49E71A +byte + +.data:004DF2B4 dd offset sub_49E736 +X Render + +.data:004DF2B8 dd offset sub_4A198F +byte + +.data:004DF2BC dd offset sub_4A19AB +added + +.data:004DF2C0 dd offset sub_4A51AF +.data:004DF2C4 dd offset sub_4A7047 +.data:004DF2C8 dd offset sub_4A94EB +.data:004DF2CC dd offset sub_4A963E +byte + +.data:004DF2D0 dd offset sub_4A965A +X pSoundList + +.data:004DF2D4 dd offset AudioPlayer__AudioPlayer +X + +.data:004DF2D8 dd offset sub_4AC1AD +.data:004DF2DC dd offset sub_4AC662 +.data:004DF2E0 dd offset sub_4ACC1C +.data:004DF2E4 dd offset sub_4AD369 +.data:004DF2E8 dd offset crt_deconstruct_4AD44B +byte + +.data:004DF2EC dd offset crt_construct_4AD467_ptr_F79D68 +X OSVersion + +.data:004DF2F0 dd offset crt_deconstruct_4AD4DE +byte + +.data:004DF2F4 dd offset crt_construct_ptr_F7CE30 +X Texture + +.data:004DF2F8 dd offset sub_4B142B +.data:004DF2FC dd offset crt_sub_4BE344 +byte + +.data:004DF300 dd offset j_Random__ctor +X + +.data:004DF304 dd offset crt_sub_4BE6B5 +.data:004DF308 dd offset crt_sub_4BE6D4 +byte + +.data:004DF30C dd offset crt_j_VideoPlayer__ctor +RECHECK + +.data:004DF310 dd offset sub_4C021E +byte + +.data:004DF314 dd offset sub_4C023A +added + +.data:004DF318 dd offset sub_4C035A +.data:004DF31C dd offset sub_4C03A3 +byte + +.data:004DF320 dd offset sub_4C03BF +.data:004DF324 dd offset sub_4C03F1 +.data:004DF328 dd offset sub_4C0423 +.data:004DF32C dd offset sub_4C044B +.data:004DF330 dd offset sub_4C047D +X vis filters + +.data:004DF334 dd offset sub_4C2A6E +.data:004DF338 dd offset sub_4C2A8A +.data:004DF33C dd offset sub_4C2F7C +byte + +*/ \ No newline at end of file
--- a/mm7_data.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/mm7_data.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -787,7 +787,7 @@ std::array<unsigned int, 2> pHiredNPCsIconsOffsetsY = {152, 152}; std::array<int, 2> dword_4EE07C; // weak _UNKNOWN unk_4EE084; // weak -std::array<__int16, 100> word_4EE088_sound_ids = +std::array<__int16, 101> word_4EE088_sound_ids = {{ 0, 10000, 10010, 10020, 10030, 10040, 10050, 10060, 10070, 10080, 10090, 10100, 11000, 11010, 11020, 11030, 11040, 11050, 11060, 11070, @@ -798,7 +798,8 @@ 15040, 15050, 15060, 15070, 15080, 15090, 15100, 16000, 16010, 16020, 16030, 16040, 16050, 16060, 16070, 16080, 16090, 16100, 17000, 17010, 17020, 17030, 17040, 17050, 17060, 17070, 17080, 17090, 17100, 18000, - 18010, 18020, 18030, 18040, 18050, 18060, 18070, 18080, 18090, 18100 + 18010, 18020, 18030, 18040, 18050, 18060, 18070, 18080, 18090, 18100, + 1 }}; std::array<short, 28> word_4EE150 = {{ @@ -856,10 +857,6 @@ int dword_4F5428[777]; // weak int dword_4F542C[777]; // weak _UNKNOWN crtunk_4F54B8; // weak -std::array<int, 52> dword_4F5B24_ys; // idb -std::array<int, 52> dword_4F5BF4_xs; // idb -std::array<int, 52> dword_4F5CC8_ys; // idb -std::array<int, 52> dword_4F5D98_xs; // idb std::array<int, 500> ai_array_4F5E68; std::array<int, 500> ai_array_4F6638_actor_ids; std::array<int, 500> ai_near_actors_targets_pid;
--- a/mm7_data.h Tue Nov 05 20:42:54 2013 -0800 +++ b/mm7_data.h Wed Nov 06 00:09:47 2013 -0800 @@ -478,7 +478,7 @@ extern std::array<unsigned int, 2> pHiredNPCsIconsOffsetsY; extern std::array<int, 2> dword_4EE07C; // weak extern _UNKNOWN unk_4EE084; // weak -extern std::array<__int16, 100> word_4EE088_sound_ids; // weak +extern std::array<__int16, 101> word_4EE088_sound_ids; // weak extern std::array<short, 28> word_4EE150; extern int dword_4EED78; // weak extern _UNKNOWN unk_4EED80; // weak @@ -502,10 +502,6 @@ extern int dword_4F5428[]; // weak extern int dword_4F542C[]; // weak extern _UNKNOWN crtunk_4F54B8; // weak -extern std::array<int, 52> dword_4F5B24_ys; // idb -extern std::array<int, 52> dword_4F5BF4_xs; // idb -extern std::array<int, 52> dword_4F5CC8_ys; // idb -extern std::array<int, 52> dword_4F5D98_xs; // idb extern std::array<int, 500> ai_array_4F5E68; extern std::array<int, 500> ai_array_4F6638_actor_ids; extern std::array<int, 500> ai_near_actors_targets_pid; @@ -1029,7 +1025,7 @@ //------------------------------------------------------------------------- // Function declarations - +void constructors(); void init_event_triggers(); void check_event_triggers();
--- a/stru6.cpp Tue Nov 05 20:42:54 2013 -0800 +++ b/stru6.cpp Wed Nov 06 00:09:47 2013 -0800 @@ -1549,7 +1549,7 @@ else { vsr.pTarget = pRenderer->pTargetSurface; - vsr.uParentBillboardID = -1; + vsr.sParentBillboardID = -1; vsr.pTargetZ = pRenderer->pActiveZBuffer; vsr.uScreenSpaceX = (signed int)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; vsr.uScreenSpaceY = pViewport->uViewportBR_Y; @@ -1563,7 +1563,7 @@ vsr._screenspace_y_scaler_packedfloat = v18 / 0x1000000; vsr.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v70->uPaletteIndex, 0, 1); vsr.uTargetPitch = pRenderer->uTargetSurfacePitch; - vsr.uParentBillboardID = -1; + vsr.sParentBillboardID = -1; vsr.uViewportX = pViewport->uViewportTL_X; vsr.uViewportZ = pViewport->uViewportBR_X; vsr.uViewportY = pViewport->uViewportTL_Y;