40 if (AddFontResourceEx(L
"Fonts\\euroswh.ttf", FR_PRIVATE,
nullptr) == 0)
42 MessageBoxW(
nullptr, L
"Error loading euroswh.ttf in Fonts\\...", L
"Error loading font!", MB_ICONERROR | MB_OK);
43 logger->
Log(
"Error loading \"euroswh.ttf\" in Fonts\\...", Logger::Level::Error);
47 if (AddFontResourceEx(L
"Fonts\\DejaVuSansMono.ttf", FR_PRIVATE,
nullptr) == 0)
49 MessageBoxW(
nullptr, L
"Error loading DejaVuSansMono.ttf in Fonts\\...", L
"Error loading font!", MB_ICONERROR | MB_OK);
50 logger->
Log(
"Error loading \"DejaVuSansMono.ttf\" in Fonts\\...", Logger::Level::Error);
54 if (AddFontResourceEx(L
"Fonts\\lhandw.ttf", FR_PRIVATE,
nullptr) == 0)
56 MessageBoxW(
nullptr, L
"Error loading lhandw.ttf in Fonts\\...", L
"Error loading font!", MB_ICONERROR | MB_OK);
57 logger->
Log(
"Error loading \"lhandw.ttf\" in Fonts\\...", Logger::Level::Error);
63 logger->
Log(
"Removing font resources...");
65 RemoveFontResourceEx(L
"Fonts\\LicensePlate.ttf", FR_PRIVATE,
nullptr);
66 RemoveFontResourceEx(L
"Fonts\\rcaf6-GIMP.ttf", FR_PRIVATE,
nullptr);
68 RemoveFontResourceEx(L
"Fonts\\euroswh.ttf", FR_PRIVATE,
nullptr);
69 RemoveFontResourceEx(L
"Fonts\\DejaVuSansMono.ttf", FR_PRIVATE,
nullptr);
70 RemoveFontResourceEx(L
"Fonts\\lhandw.ttf", FR_PRIVATE,
nullptr);
72 RemoveFontResourceEx(L
"Fonts\\cour.ttf", FR_PRIVATE,
nullptr);
73 RemoveFontResourceEx(L
"Fonts\\pala.ttf", FR_PRIVATE,
nullptr);
148 for (
short t = 0; t < 3; t++)
151 sprintf_s(msg, 99,
"m_pddsLightningAndBackground[%i]", t);
164 sprintf_s(msg, 99,
"m_pddsAvatar[%i]", t);
199 pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,
false);
200 pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
201 pd3dDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS);
204 pd3dDevice->SetRenderState(D3DRS_LIGHTING,
false);
208 D3DVIEWPORT9 mvp, oldmvp;
215 mvp.MinZ = 0.0001f; mvp.MaxZ = 0.01f;
216 V(pd3dDevice->GetViewport(&oldmvp));
217 V(pd3dDevice->SetViewport(&mvp));
219 V(pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xFFC0B19C, 1.0f, 0));
221 D3DXMATRIX matWorld, matrixBase;
233 D3DXVECTOR3 vEyePt(0.0f, 0.0f, 0.0005f);
234 D3DXVECTOR3 vLookatPt(0.0f, 0.0f, 0.0f);
235 D3DXVECTOR3 vUpVec(0.0f, 1.0f, 0.0f);
237 D3DXMatrixLookAtRH(&matView, &vEyePt, &vLookatPt, &vUpVec);
246 D3DXMATRIXA16 matProj;
247 D3DXMatrixPerspectiveFovRH(&matProj, D3DX_PI / 4, 1.0f, 0.0001f, 0.01f);
250 pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
251 pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
252 pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
253 pd3dDevice->SetRenderState(D3DRS_TEXTUREFACTOR,
gui->
skintone);
258 bool firstone =
true;
259 static float fTimer = 0.0f;
261 fTimer += fElapsedTime*1.0472f;
266 if (tempcomponent.
type == 100 ||
267 tempcomponent.
type == 101 ||
268 tempcomponent.
type == 103 ||
269 tempcomponent.
type == 104)
271 float fAngle = sinf(fTimer)*D3DX_PI*0.125f;
272 D3DXMatrixRotationX(&matWorld, -D3DX_HALFPI);
273 matWorld = matrixBase * matWorld;
275 if (tempcomponent.
type == 100 && !firstone &&
gui->
g_HUD.GetRadioButton(
IDC_MALE)->GetChecked())
283 matWorld = matTemp * matWorld;
284 D3DXMatrixRotationY(&matTemp, fAngle);
285 matWorld = matWorld * matTemp;
288 (tempcomponent.
type == 100 && tempcomponent.
attachto == 250) ||
296 D3DXMATRIX mWorldViewProj = matWorld * matView * matProj;
297 V(
g_pEffect->SetMatrix(
"matWorldViewProj", &mWorldViewProj));
299 D3DXVECTOR4 tempvec4;
301 float powage = powf(
gui->
age, 2.0f);
302 tempvec4.x =
gui->
haircolor.r*(1.0f - powage) + 1.0f*powage;
303 tempvec4.y =
gui->
haircolor.g*(1.0f - powage) + 1.0f*powage;
304 tempvec4.z =
gui->
haircolor.b*(1.0f - powage) + 1.0f*powage;
306 V(
g_pEffect->SetVector(
"Radiosity", &tempvec4));
311 V(
g_pEffect->SetVector(
"shiplight", &tempvec4));
316 V(
g_pEffect->SetVector(
"ambient", &tempvec4));
327 pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,
true);
328 pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
329 pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
331 pd3dDevice->SetTransform(D3DTS_WORLD, &matWorld);
332 pd3dDevice->SetTransform(D3DTS_VIEW, &matView);
333 pd3dDevice->SetTransform(D3DTS_PROJECTION, &matProj);
342 V(pd3dDevice->SetViewport(&oldmvp));
344 pd3dDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
345 pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
346 pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
347 pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
358 V_RETURN(DXUTGetD3D9Device()->GetDeviceCaps(&caps));
361 if (caps.VertexShaderVersion >= D3DVS_VERSION(3, 0) &&
362 caps.PixelShaderVersion >= D3DPS_VERSION(3, 0))
364 DWORD dwShaderFlags = D3DXSHADER_OPTIMIZATION_LEVEL3;
367 dwShaderFlags |= D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT;
370 dwShaderFlags |= D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT;
373 hr = D3DXCreateEffectFromResource(DXUTGetD3D9Device(),
nullptr, MAKEINTRESOURCE(
IDR_RCDATA1),
nullptr,
nullptr, dwShaderFlags,
nullptr, &
g_pEffect,
nullptr);
376 gui->
game->
logger->
Log(
"Graphics::LoadShaderFile D3DXCreateEffectFromResource", Logger::Level::Error, hr);
381 logger->
Log(
"D3DXCreateEffectFromFile() succeeded...");
382 V_RETURN(
g_pEffect->SetTechnique(
"TShader"));
387 MessageBox(
nullptr, L
"Requires a graphics adapter with DirectX 9.0c (vs3.0 and ps3.0 support) or higher!", L
"HLSL Error", MB_ICONERROR | MB_OK);
LPDIRECT3DTEXTURE9 m_pddsGUIInterlace
void DrawImmigration(IDirect3DDevice9 *pd3dDevice, float fElapsedTime)
LPDIRECT3DTEXTURE9 m_pddsLightningAndBackground[3]
HRESULT OnResetDevice(void) const
HRESULT LoadShaderFile(void)
LPDIRECT3DVERTEXBUFFER9 VB
void DrawRXTXLights(LPDIRECT3DTEXTURE9 *tex) const
s_mesh_component GetComponent(short i) const
void AddFontsToSystem(void) const
LPDIRECT3DTEXTURE9 m_pddsCloudBaseMapAndNetwork
void OnDestroyDevice(void)
void RemoveFontsFromSystem(void) const
s_polygon_object tempobject
void Log(const char *msg, Level level=Info, int errorCode=0)
ID3DXSprite * g_pTextSprite
void AddTrackedResource(const char *name, _D3DPOOL pool=D3DPOOL_MANAGED)
void UpdateTrackedResource(const char *name, int status)
void AddToCallStack(const char *msg)
unsigned short GetComponents() const
LPDIRECT3DTEXTURE9 m_pddsAvatar[humantextureC]