[saco] Implement CUnkClass13 constructor

* Implement `CUnkClass13::RestoreDeviceObjects()`
* Update `DoInitStuff()`
This commit is contained in:
RD42 2024-04-02 22:22:38 +08:00
parent fdde0ffe60
commit aac4f57110
5 changed files with 58 additions and 1 deletions

View File

@ -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

View File

@ -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);

View File

@ -573,6 +573,12 @@
<File
RelativePath=".\unkclass12.h">
</File>
<File
RelativePath=".\unkclass13.cpp">
</File>
<File
RelativePath=".\unkclass13.h">
</File>
<File
RelativePath=".\unkclass2.cpp">
</File>

31
saco/unkclass13.cpp Normal file
View File

@ -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);
}
}

18
saco/unkclass13.h Normal file
View File

@ -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();
};