From aac4f5711080c4ad4c63d0734b4a815f0cfd5bd0 Mon Sep 17 00:00:00 2001
From: RD42 <42702181+dashr9230@users.noreply.github.com>
Date: Tue, 2 Apr 2024 22:22:38 +0800
Subject: [PATCH] [saco] Implement CUnkClass13 constructor
* Implement `CUnkClass13::RestoreDeviceObjects()`
* Update `DoInitStuff()`
---
saco/main.cpp | 3 ++-
saco/main.h | 1 +
saco/saco.vcproj | 6 ++++++
saco/unkclass13.cpp | 31 +++++++++++++++++++++++++++++++
saco/unkclass13.h | 18 ++++++++++++++++++
5 files changed, 58 insertions(+), 1 deletion(-)
create mode 100644 saco/unkclass13.cpp
create mode 100644 saco/unkclass13.h
diff --git a/saco/main.cpp b/saco/main.cpp
index c5b6200..d5ae2ef 100644
--- a/saco/main.cpp
+++ b/saco/main.cpp
@@ -22,9 +22,9 @@ CSpawnScreen *pSpawnScreen=0;
CNetGame *pNetGame=0;
//DWORD dword_1026EB98=0;
CFontRender *pDefaultFont=0;
-//DWORD dword_1026EBA0=0;
//DWORD dword_1026EBA4=0;
//DWORD dword_1026EBA8=0;
+CUnkClass13 *pUnkClass13=0;
BOOL bGameInited=FALSE;
@@ -364,6 +364,7 @@ void DoInitStuff()
pUnkClass10 = new CUnkClass10(pD3DDevice);
pUnkClass11 = new CUnkClass11();
pUnkClass12 = new CUnkClass12();
+ pUnkClass13 = new CUnkClass13(pD3DDevice);
// TODO: DoInitStuff
diff --git a/saco/main.h b/saco/main.h
index e036ec1..071bde3 100644
--- a/saco/main.h
+++ b/saco/main.h
@@ -74,6 +74,7 @@ typedef struct _GAME_SETTINGS {
#include "unkclass10.h"
#include "unkclass11.h"
#include "unkclass12.h"
+#include "unkclass13.h"
void SetStringFromCommandLine(char *szCmdLine, char *szString);
void SetStringFromQuotedCommandLine(char *szCmdLine, char *szString);
diff --git a/saco/saco.vcproj b/saco/saco.vcproj
index 21f027e..ecd19d6 100644
--- a/saco/saco.vcproj
+++ b/saco/saco.vcproj
@@ -573,6 +573,12 @@
+
+
+
+
diff --git a/saco/unkclass13.cpp b/saco/unkclass13.cpp
new file mode 100644
index 0000000..ed99c0b
--- /dev/null
+++ b/saco/unkclass13.cpp
@@ -0,0 +1,31 @@
+
+#include "main.h"
+
+CUnkClass13::CUnkClass13(IDirect3DDevice9 *pD3DDevice)
+{
+ field_20 = 0;
+ m_pD3DSurface = NULL;
+ m_pD3DTexture = NULL;
+ m_pD3DRenderToSurface = NULL;
+ m_pD3DDevice = pD3DDevice;
+
+ RestoreDeviceObjects();
+}
+
+void CUnkClass13::RestoreDeviceObjects()
+{
+ m_pD3DDevice->GetDisplayMode(0, &m_DisplayMode);
+
+ HRESULT hr = D3DXCreateTexture(m_pD3DDevice, 128, 32, 1,
+ D3DUSAGE_RENDERTARGET, m_DisplayMode.Format, D3DPOOL_DEFAULT, &m_pD3DTexture);
+ if(SUCCEEDED(hr))
+ {
+ D3DSURFACE_DESC desc;
+
+ m_pD3DTexture->GetSurfaceLevel(0, &m_pD3DSurface);
+ m_pD3DSurface->GetDesc(&desc);
+
+ D3DXCreateRenderToSurface(m_pD3DDevice, desc.Width, desc.Height,
+ desc.Format, TRUE, D3DFMT_D16, &m_pD3DRenderToSurface);
+ }
+}
\ No newline at end of file
diff --git a/saco/unkclass13.h b/saco/unkclass13.h
new file mode 100644
index 0000000..3195af3
--- /dev/null
+++ b/saco/unkclass13.h
@@ -0,0 +1,18 @@
+
+#pragma once
+
+class CUnkClass13
+{
+private:
+ IDirect3DDevice9 *m_pD3DDevice;
+ ID3DXRenderToSurface *m_pD3DRenderToSurface;
+ IDirect3DTexture9 *m_pD3DTexture;
+ IDirect3DSurface9* m_pD3DSurface;
+ D3DDISPLAYMODE m_DisplayMode;
+ int field_20;
+
+public:
+ CUnkClass13(IDirect3DDevice9 *pD3DDevice);
+
+ void RestoreDeviceObjects();
+};