Skip to content

Commit 17ba9b6

Browse files
committed
Fix comments from pull request
1 parent e8ff88d commit 17ba9b6

3 files changed

Lines changed: 17 additions & 22 deletions

File tree

ddraw/DebugOverlay.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
#include "DebugOverlay.h"
18-
#include "RenderData.h"
1918
#include <sstream>
2019

2120
#define IMGUI_DEFINE_MATH_OPERATORS
@@ -99,7 +98,7 @@ void DebugOverlay::BeginScene()
9998
ImGui::NewFrame();
10099
}
101100

102-
void DebugOverlay::EndScene(const RenderData &RenderData)
101+
void DebugOverlay::EndScene()
103102
{
104103
static bool ShowDebugUI = false;
105104
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftAlt)) &&

ddraw/DebugOverlay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class DebugOverlay
4848

4949
// Frame functions
5050
void BeginScene();
51-
void EndScene(const class RenderData &RenderData);
51+
void EndScene();
5252

5353
// Functions
5454
void SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);

ddraw/IDirect3DDeviceX.cpp

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <DirectXMath.h>
2020

2121
// Enable for testing only
22-
#define ENABLE_DEBUGOVERLAY
22+
//#define ENABLE_DEBUGOVERLAY
2323

2424
#ifdef ENABLE_DEBUGOVERLAY
2525
#include "DebugOverlay.h"
@@ -339,17 +339,17 @@ HRESULT m_IDirect3DDeviceX::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStat
339339
break;
340340
}
341341

342-
if(Config.DdrawConvertHomogeneousW)
342+
if (Config.DdrawConvertHomogeneousW)
343343
{
344344
#ifdef ENABLE_DEBUGOVERLAY
345345
// Set the original matrix
346346
DOverlay.SetTransform(dtstTransformStateType, lpD3DMatrix);
347347
#endif
348348

349-
if(dtstTransformStateType == D3DTS_VIEW)
349+
if (dtstTransformStateType == D3DTS_VIEW)
350350
{
351351
D3DVIEWPORT9 Viewport9;
352-
if(SUCCEEDED((*d3d9Device)->GetViewport(&Viewport9)))
352+
if (SUCCEEDED((*d3d9Device)->GetViewport(&Viewport9)))
353353
{
354354
const float width = (float)Viewport9.Width;
355355
const float height = (float)Viewport9.Height;
@@ -365,15 +365,13 @@ HRESULT m_IDirect3DDeviceX::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStat
365365
view._42 = 1.0f; // translate Y
366366
view._44 = 1.0f;
367367

368-
if(!Config.DdrawConvertHomogeneousToWorld)
369-
{
370-
// Override the original matrix
371-
std::memcpy(lpD3DMatrix, &view, sizeof(_D3DMATRIX));
372-
}
373-
else
368+
// Override the original matrix
369+
std::memcpy(lpD3DMatrix, &view, sizeof(_D3DMATRIX));
370+
371+
if (Config.DdrawConvertHomogeneousToWorld)
374372
{
375373
DirectX::XMVECTOR position, direction;
376-
if(Config.DdrawConvertHomogeneousToWorldUseGameCamera)
374+
if (Config.DdrawConvertHomogeneousToWorldUseGameCamera)
377375
{
378376
// To reconstruct the 3D world, we need to know where the camera is and where it is looking
379377
position = DirectX::XMVectorSet(lpD3DMatrix->_41, lpD3DMatrix->_42, lpD3DMatrix->_43, lpD3DMatrix->_44);
@@ -384,12 +382,9 @@ HRESULT m_IDirect3DDeviceX::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStat
384382
const float cameradir = 1.0f;
385383

386384
position = DirectX::XMVectorSet(0.0f, 0.0f, -cameradir, 0.0f);
387-
DirectX::XMVectorSet(0.0f, 0.0f, cameradir, 0.0f);
385+
direction = DirectX::XMVectorSet(0.0f, 0.0f, cameradir, 0.0f);
388386
}
389387

390-
// Override the original matrix
391-
std::memcpy(lpD3DMatrix, &view, sizeof(_D3DMATRIX));
392-
393388
// Store the original matrix so it can be restored
394389
std::memcpy(&RenderData.DdrawConvertHomogeneousToWorld_ViewMatrixOriginal, &view, sizeof(_D3DMATRIX));
395390

@@ -1703,7 +1698,7 @@ HRESULT m_IDirect3DDeviceX::EndScene()
17031698
}
17041699

17051700
#ifdef ENABLE_DEBUGOVERLAY
1706-
DOverlay.EndScene(RenderData);
1701+
DOverlay.EndScene();
17071702
#endif
17081703

17091704
// The IDirect3DDevice7::EndScene method ends a scene that was begun by calling the IDirect3DDevice7::BeginScene method.
@@ -2137,7 +2132,7 @@ HRESULT m_IDirect3DDeviceX::SetRenderState(D3DRENDERSTATETYPE dwRenderStateType,
21372132
break;
21382133
}
21392134
case D3DRS_LIGHTING:
2140-
if(Config.DdrawDisableLighting)
2135+
if (Config.DdrawDisableLighting)
21412136
{
21422137
dwRenderState = FALSE;
21432138
}
@@ -2548,9 +2543,10 @@ HRESULT m_IDirect3DDeviceX::DrawIndexedPrimitive(D3DPRIMITIVETYPE dptPrimitiveTy
25482543
const UINT stride = GetVertexStride(dwVertexTypeDesc);
25492544

25502545
// Handle PositionT
2551-
if((dwVertexTypeDesc & D3DFVF_XYZRHW) != 0 && Config.DdrawConvertHomogeneousW)
2546+
if (Config.DdrawConvertHomogeneousW && (dwVertexTypeDesc & 0x0E) == D3DFVF_XYZRHW)
25522547
{
2553-
if(!Config.DdrawConvertHomogeneousToWorld)
2548+
D3DFVF_XYZB1;
2549+
if (!Config.DdrawConvertHomogeneousToWorld)
25542550
{
25552551
/*UINT8 *vertex = (UINT8*)lpVertices;
25562552

0 commit comments

Comments
 (0)