comparison Render.cpp @ 781:d170f23f70d1

tidy, code moving
author zipi
date Sun, 24 Mar 2013 01:27:34 +0000
parents 45615cacad31
children 346f7069676a
comparison
equal deleted inserted replaced
780:93c6b78abf35 781:d170f23f70d1
20 #include "OSInfo.h" 20 #include "OSInfo.h"
21 #include "Actor.h" 21 #include "Actor.h"
22 #include "Log.h" 22 #include "Log.h"
23 #include "TileFrameTable.h" 23 #include "TileFrameTable.h"
24 #include "texts.h" 24 #include "texts.h"
25
26 #include "mm7_data.h" 25 #include "mm7_data.h"
27
28 26
29 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") 27 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib")
30 #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib") 28 #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib")
31
32
33
34
35
36
37 29
38 struct IDirectDrawClipper *pDDrawClipper; 30 struct IDirectDrawClipper *pDDrawClipper;
39 struct Render *pRenderer; // idb 31 struct Render *pRenderer; // idb
40 struct RenderVertexD3D3 pVertices[50]; 32 struct RenderVertexD3D3 pVertices[50];
41 int uNumDecorationsDrawnThisFrame; // weak 33 int uNumDecorationsDrawnThisFrame; // weak
42 RenderBillboard pBillboardRenderList[500]; 34 RenderBillboard pBillboardRenderList[500];
43 unsigned int uNumBillboardsToDraw; 35 unsigned int uNumBillboardsToDraw;
44 int uNumSpritesDrawnThisFrame; // weak 36 int uNumSpritesDrawnThisFrame; // weak
45 37
46
47 RenderVertexSoft array_507D30[50]; 38 RenderVertexSoft array_507D30[50];
48 RenderVertexSoft array_508690[50]; 39 RenderVertexSoft array_508690[50];
49 RenderVertexSoft array_508FF0[50]; 40 RenderVertexSoft array_508FF0[50];
50 RenderVertexSoft array_509950[50]; 41 RenderVertexSoft array_509950[50];
51 RenderVertexSoft array_50A2B0[50]; 42 RenderVertexSoft array_50A2B0[50];
59 RenderVertexSoft *ptr_801A08; 50 RenderVertexSoft *ptr_801A08;
60 51
61 RenderVertexSoft pVerticesSR_801A10[384]; 52 RenderVertexSoft pVerticesSR_801A10[384];
62 RenderVertexSoft pVerticesSR_806210[384]; 53 RenderVertexSoft pVerticesSR_806210[384];
63 54
64
65
66
67
68
69
70 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); 55 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1);
71
72 56
73 /* 384 */ 57 /* 384 */
74 #pragma pack(push, 1) 58 #pragma pack(push, 1)
75 struct PCXHeader_1 59 struct PCXHeader_1
76 { 60 {
96 __int16 pitch; 80 __int16 pitch;
97 __int16 palette_info; 81 __int16 palette_info;
98 }; 82 };
99 #pragma pack(pop) 83 #pragma pack(pop)
100 84
101
102
103
104
105
106
107
108 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst); 85 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst);
109 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2); 86 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2);
110 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, struct RenderD3D_aux *a6); 87 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, struct RenderD3D_aux *a6);
111 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut); // idb 88 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut); // idb
112
113
114
115
116
117
118
119
120
121
122
123 89
124 //----- (0049E79F) -------------------------------------------------------- 90 //----- (0049E79F) --------------------------------------------------------
125 bool __cdecl CheckTextureStages() 91 bool __cdecl CheckTextureStages()
126 { 92 {
127 bool v0; // edi@1 93 bool v0; // edi@1
160 pTexture2->Release(); 126 pTexture2->Release();
161 pSurface1->Release(); 127 pSurface1->Release();
162 pSurface2->Release(); 128 pSurface2->Release();
163 return v0; 129 return v0;
164 } 130 }
165
166
167
168
169
170
171
172
173
174
175
176
177 131
178 //----- (00440CB8) -------------------------------------------------------- 132 //----- (00440CB8) --------------------------------------------------------
179 void Render::DrawBillboardList_BLV() 133 void Render::DrawBillboardList_BLV()
180 { 134 {
181 __int16 v2; // ax@3 135 __int16 v2; // ax@3
222 } 176 }
223 } 177 }
224 } 178 }
225 } 179 }
226 180
227
228
229
230
231 //----- (004A16A5) -------------------------------------------------------- 181 //----- (004A16A5) --------------------------------------------------------
232 bool __cdecl AreRenderSurfacesOk() 182 bool __cdecl AreRenderSurfacesOk()
233 { 183 {
234 char v0; // zf@4 184 char v0; // zf@4
235 bool result; // eax@8 185 bool result; // eax@8
253 } 203 }
254 LABEL_9: 204 LABEL_9:
255 LOBYTE(result) = 0; 205 LOBYTE(result) = 0;
256 return result; 206 return result;
257 } 207 }
258
259
260 208
261 //----- (00487389) -------------------------------------------------------- 209 //----- (00487389) --------------------------------------------------------
262 __int16 Render::ExecOutdoorDrawSW() 210 __int16 Render::ExecOutdoorDrawSW()
263 { 211 {
264 unsigned __int16 *v0; // ebx@1 212 unsigned __int16 *v0; // ebx@1
2474 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); 2422 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
2475 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); 2423 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int);
2476 // 4D864C: using guessed type char byte_4D864C; 2424 // 4D864C: using guessed type char byte_4D864C;
2477 // 76D5C0: using guessed type char static_sub_0048034E_byte_76D5C0__init_flag; 2425 // 76D5C0: using guessed type char static_sub_0048034E_byte_76D5C0__init_flag;
2478 2426
2479
2480
2481 //----- (00481212) -------------------------------------------------------- 2427 //----- (00481212) --------------------------------------------------------
2482 void Render::DrawTerrainSW(int a1, int a2, int a3) 2428 void Render::DrawTerrainSW(int a1, int a2, int a3)
2483 { 2429 {
2484 int v3; // esi@1 2430 int v3; // esi@1
2485 int v4; // ecx@1 2431 int v4; // ecx@1
2974 --pOutdoorCamera->numStru148s; 2920 --pOutdoorCamera->numStru148s;
2975 goto LABEL_75; 2921 goto LABEL_75;
2976 } 2922 }
2977 } 2923 }
2978 2924
2979
2980 //----- (0047BACF) -------------------------------------------------------- 2925 //----- (0047BACF) --------------------------------------------------------
2981 void Render::TransformBillboardsAndSetPalettesODM() 2926 void Render::TransformBillboardsAndSetPalettesODM()
2982 { 2927 {
2983 //int v0; // edi@1 2928 //int v0; // edi@1
2984 //char *v1; // esi@2 2929 //char *v1; // esi@2
3053 pSprites_LOD->pSpriteHeaders[v13].DrawSprite_sw(&billboard, 1); 2998 pSprites_LOD->pSpriteHeaders[v13].DrawSprite_sw(&billboard, 1);
3054 } 2999 }
3055 } 3000 }
3056 } 3001 }
3057 } 3002 }
3058
3059 3003
3060 //----- (0047AF11) -------------------------------------------------------- 3004 //----- (0047AF11) --------------------------------------------------------
3061 void Render::DrawSpriteObjects_ODM() 3005 void Render::DrawSpriteObjects_ODM()
3062 { 3006 {
3063 //char *v0; // edi@2 3007 //char *v0; // edi@2
3261 } 3205 }
3262 } 3206 }
3263 // 4E94D3: using guessed type char byte_4E94D3; 3207 // 4E94D3: using guessed type char byte_4E94D3;
3264 // 5187E4: using guessed type int uNumSpritesDrawnThisFrame; 3208 // 5187E4: using guessed type int uNumSpritesDrawnThisFrame;
3265 3209
3266
3267 //----- (0049D9BC) -------------------------------------------------------- 3210 //----- (0049D9BC) --------------------------------------------------------
3268 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut) 3211 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut)
3269 { 3212 {
3270 size_t v4; // eax@1 3213 size_t v4; // eax@1
3271 size_t v5; // eax@1 3214 size_t v5; // eax@1
3380 } 3323 }
3381 v6->Release(); 3324 v6->Release();
3382 } 3325 }
3383 return 1; 3326 return 1;
3384 } 3327 }
3385
3386 3328
3387 //----- (0049D784) -------------------------------------------------------- 3329 //----- (0049D784) --------------------------------------------------------
3388 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, RenderD3D_aux *a6) 3330 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, RenderD3D_aux *a6)
3389 { 3331 {
3390 int v6; // eax@1 3332 int v6; // eax@1
3459 a6->pInfo[v8].uVideoMem = a6->ptr_4->uVideoMem; 3401 a6->pInfo[v8].uVideoMem = a6->ptr_4->uVideoMem;
3460 } 3402 }
3461 return 1; 3403 return 1;
3462 } 3404 }
3463 3405
3464
3465 //----- (0049D75C) -------------------------------------------------------- 3406 //----- (0049D75C) --------------------------------------------------------
3466 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2) 3407 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2)
3467 { 3408 {
3468 HRESULT result; // eax@3 3409 HRESULT result; // eax@3
3469 3410
3476 { 3417 {
3477 result = 1; 3418 result = 1;
3478 } 3419 }
3479 return result; 3420 return result;
3480 } 3421 }
3481
3482
3483 3422
3484 //----- (0047A95E) -------------------------------------------------------- 3423 //----- (0047A95E) --------------------------------------------------------
3485 void Render::PrepareDecorationsRenderList_ODM() 3424 void Render::PrepareDecorationsRenderList_ODM()
3486 { 3425 {
3487 //char *v0; // esi@2 3426 //char *v0; // esi@2
3801 //while ( v35 < (signed int)uNumLevelDecorations ); 3740 //while ( v35 < (signed int)uNumLevelDecorations );
3802 } 3741 }
3803 // 4E94D0: using guessed type char byte_4E94D0; 3742 // 4E94D0: using guessed type char byte_4E94D0;
3804 // 5187EC: using guessed type int uNumDecorationsDrawnThisFrame; 3743 // 5187EC: using guessed type int uNumDecorationsDrawnThisFrame;
3805 3744
3806
3807 //----- (0049D717) -------------------------------------------------------- 3745 //----- (0049D717) --------------------------------------------------------
3808 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst) 3746 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst)
3809 { 3747 {
3810 HRESULT v2; // esi@2 3748 HRESULT v2; // esi@2
3811 3749
3833 v2 = new RenderD3D__DevInfo[4];// 4 items 3771 v2 = new RenderD3D__DevInfo[4];// 4 items
3834 *pOutDevices = v2; 3772 *pOutDevices = v2;
3835 memset(v2, 0, 0xA0u); 3773 memset(v2, 0, 0xA0u);
3836 DirectDrawEnumerateA((LPDDENUMCALLBACKA)RenderD3D__DeviceEnumerator, *pOutDevices); 3774 DirectDrawEnumerateA((LPDDENUMCALLBACKA)RenderD3D__DeviceEnumerator, *pOutDevices);
3837 } 3775 }
3838
3839 3776
3840 //----- (0049DC58) -------------------------------------------------------- 3777 //----- (0049DC58) --------------------------------------------------------
3841 RenderD3D::RenderD3D() 3778 RenderD3D::RenderD3D()
3842 { 3779 {
3843 RenderD3D *v1; // esi@1 3780 RenderD3D *v1; // esi@1
3975 { 3912 {
3976 v11->Release(); 3913 v11->Release();
3977 v1->pHost = 0; 3914 v1->pHost = 0;
3978 } 3915 }
3979 } 3916 }
3980
3981 3917
3982 //----- (0049DE14) -------------------------------------------------------- 3918 //----- (0049DE14) --------------------------------------------------------
3983 bool RenderD3D::CreateDevice(unsigned int uDeviceID, int bWindowed, HWND hWnd) 3919 bool RenderD3D::CreateDevice(unsigned int uDeviceID, int bWindowed, HWND hWnd)
3984 { 3920 {
3985 //IDirectDraw4 *v8; // eax@12 3921 //IDirectDraw4 *v8; // eax@12
4252 pViewport->SetViewport2(&d3dvp2); 4188 pViewport->SetViewport2(&d3dvp2);
4253 pDevice->SetCurrentViewport(pViewport); 4189 pDevice->SetCurrentViewport(pViewport);
4254 return 1; 4190 return 1;
4255 } 4191 }
4256 4192
4257
4258 //----- (0049E444) -------------------------------------------------------- 4193 //----- (0049E444) --------------------------------------------------------
4259 unsigned int RenderD3D::GetDeviceCaps() 4194 unsigned int RenderD3D::GetDeviceCaps()
4260 { 4195 {
4261 unsigned int v1; // ebx@1 4196 unsigned int v1; // ebx@1
4262 RenderD3D *v2; // edi@1 4197 RenderD3D *v2; // edi@1
4295 result = v1; 4230 result = v1;
4296 } 4231 }
4297 return result; 4232 return result;
4298 } 4233 }
4299 4234
4300
4301 //----- (0049E4FC) -------------------------------------------------------- 4235 //----- (0049E4FC) --------------------------------------------------------
4302 void RenderD3D::ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear) 4236 void RenderD3D::ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear)
4303 { 4237 {
4304 uint uClearFlags = 0; 4238 uint uClearFlags = 0;
4305 4239
4311 D3DRECT rects[] = {{0, 0, 640, 480}}; 4245 D3DRECT rects[] = {{0, 0, 640, 480}};
4312 if (uClearFlags) 4246 if (uClearFlags)
4313 pViewport->Clear2(1, rects, uClearFlags, uClearColor, z_clear, 0); 4247 pViewport->Clear2(1, rects, uClearFlags, uClearColor, z_clear, 0);
4314 } 4248 }
4315 4249
4316
4317 //----- (0049E54D) -------------------------------------------------------- 4250 //----- (0049E54D) --------------------------------------------------------
4318 void RenderD3D::Present(bool bForceBlit) 4251 void RenderD3D::Present(bool bForceBlit)
4319 { 4252 {
4320 RECT v5; // [sp+18h] [bp-18h]@1 4253 RECT v5; // [sp+18h] [bp-18h]@1
4321 struct tagPOINT Point; // [sp+28h] [bp-8h]@4 4254 struct tagPOINT Point; // [sp+28h] [bp-8h]@4
4336 pFrontBuffer->Blt(&rc, pBackBuffer, &v5, DDBLT_WAIT, 0); 4269 pFrontBuffer->Blt(&rc, pBackBuffer, &v5, DDBLT_WAIT, 0);
4337 } 4270 }
4338 else 4271 else
4339 pFrontBuffer->Flip(0, 1); 4272 pFrontBuffer->Flip(0, 1);
4340 } 4273 }
4341
4342 4274
4343 //----- (0049E5D4) -------------------------------------------------------- 4275 //----- (0049E5D4) --------------------------------------------------------
4344 bool RenderD3D::CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim) 4276 bool RenderD3D::CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim)
4345 { 4277 {
4346 unsigned int v8; // edx@4 4278 unsigned int v8; // edx@4
4427 { 4359 {
4428 pBitmaps_LOD->ReleaseLostHardwareTextures(); 4360 pBitmaps_LOD->ReleaseLostHardwareTextures();
4429 pBitmaps_LOD->_410423_move_textures_to_device(); 4361 pBitmaps_LOD->_410423_move_textures_to_device();
4430 pSprites_LOD->ReleaseLostHardwareSprites(); 4362 pSprites_LOD->ReleaseLostHardwareSprites();
4431 } 4363 }
4432
4433
4434 4364
4435 //----- (004A2050) -------------------------------------------------------- 4365 //----- (004A2050) --------------------------------------------------------
4436 void Render::DrawPolygon(unsigned int uNumVertices, stru148 *a3, ODMFace *a4, IDirect3DTexture2 *pTexture) 4366 void Render::DrawPolygon(unsigned int uNumVertices, stru148 *a3, ODMFace *a4, IDirect3DTexture2 *pTexture)
4437 { 4367 {
4438 Render *v5; // edi@1 4368 Render *v5; // edi@1
4691 } 4621 }
4692 } 4622 }
4693 } 4623 }
4694 // 4D864C: using guessed type char byte_4D864C; 4624 // 4D864C: using guessed type char byte_4D864C;
4695 4625
4696
4697 //----- (0049EB79) -------------------------------------------------------- 4626 //----- (0049EB79) --------------------------------------------------------
4698 Render::~Render() 4627 Render::~Render()
4699 { 4628 {
4700 Render *v1; // esi@1 4629 Render *v1; // esi@1
4701 4630
4706 Release(); 4635 Release();
4707 v1->bWindowMode = 1; 4636 v1->bWindowMode = 1;
4708 //nullsub_1(); 4637 //nullsub_1();
4709 //nullsub_1(); 4638 //nullsub_1();
4710 } 4639 }
4711
4712
4713 4640
4714 //----- (0049E756) -------------------------------------------------------- 4641 //----- (0049E756) --------------------------------------------------------
4715 bool Render::IsColorKeySupported(IDirectDraw4 *this_) 4642 bool Render::IsColorKeySupported(IDirectDraw4 *this_)
4716 { 4643 {
4717 DDCAPS refCaps; // [sp+0h] [bp-2F8h]@1 4644 DDCAPS refCaps; // [sp+0h] [bp-2F8h]@1
4783 4710
4784 hd_water_tile_id = -1; 4711 hd_water_tile_id = -1;
4785 hd_water_current_frame = 0; 4712 hd_water_current_frame = 0;
4786 } 4713 }
4787 4714
4788 bool Render::Initialize(bool bWindowed, uint uDefaultDevice, 4715 bool Render::Initialize(bool bWindowed, uint uDefaultDevice, bool bColoredLights, uint uDetailLevel, uint bTinting)
4789 bool bColoredLights, uint uDetailLevel, uint bTinting)
4790 { 4716 {
4791 bUserDirect3D = true;//ReadWindowsRegistryInt("Use D3D", 0); 4717 bUserDirect3D = true;//ReadWindowsRegistryInt("Use D3D", 0);
4792 bStartInWindow = bWindowed; 4718 bStartInWindow = bWindowed;
4793 4719
4794 uDesiredDirect3DDevice = uDefaultDevice;//ReadWindowsRegistryInt("D3D Device", 1); 4720 uDesiredDirect3DDevice = uDefaultDevice;//ReadWindowsRegistryInt("D3D Device", 1);
4801 auto r1 = pD3DBitmaps.Load(L"data\\d3dbitmap.hwl"); 4727 auto r1 = pD3DBitmaps.Load(L"data\\d3dbitmap.hwl");
4802 auto r2 = pD3DSprites.Load(L"data\\d3dsprite.hwl"); 4728 auto r2 = pD3DSprites.Load(L"data\\d3dsprite.hwl");
4803 4729
4804 return r1 && r2; 4730 return r1 && r2;
4805 } 4731 }
4806
4807
4808 4732
4809 //----- (0049EBF1) -------------------------------------------------------- 4733 //----- (0049EBF1) --------------------------------------------------------
4810 void Render::_49EBF1() 4734 void Render::_49EBF1()
4811 { 4735 {
4812 signed int uNumRedBits; // edx@1 4736 signed int uNumRedBits; // edx@1
4854 } 4778 }
4855 while ( v10 < uNumRedBits ); 4779 while ( v10 < uNumRedBits );
4856 } 4780 }
4857 } 4781 }
4858 4782
4859
4860 //----- (0049ECC4) -------------------------------------------------------- 4783 //----- (0049ECC4) --------------------------------------------------------
4861 void Render::ClearBlack() 4784 void Render::ClearBlack()
4862 { 4785 {
4863 if (pRenderD3D) 4786 if (pRenderD3D)
4864 { 4787 {
4866 pRenderD3D->ClearTarget(true, 0, false, 0.0); 4789 pRenderD3D->ClearTarget(true, 0, false, 0.0);
4867 } 4790 }
4868 else 4791 else
4869 memset(pRenderer->pTargetSurface, 0, 4 * (field_10 * field_14 / 2)); 4792 memset(pRenderer->pTargetSurface, 0, 4 * (field_10 * field_14 / 2));
4870 } 4793 }
4871
4872 4794
4873 //----- (0049ED18) -------------------------------------------------------- 4795 //----- (0049ED18) --------------------------------------------------------
4874 void Render::PresentBlackScreen() 4796 void Render::PresentBlackScreen()
4875 { 4797 {
4876 LONG w; // edx@3 4798 LONG w; // edx@3
4900 v3.dwFillColor = 0; 4822 v3.dwFillColor = 0;
4901 v3.dwSize = 100; 4823 v3.dwSize = 100;
4902 v2->Blt(&x, 0, 0, DDBLT_COLORFILL, &v3); 4824 v2->Blt(&x, 0, 0, DDBLT_COLORFILL, &v3);
4903 pRenderer->Present(); 4825 pRenderer->Present();
4904 } 4826 }
4905
4906 4827
4907 //----- (0049EDB6) -------------------------------------------------------- 4828 //----- (0049EDB6) --------------------------------------------------------
4908 void Render::SavePCXScreenshot() 4829 void Render::SavePCXScreenshot()
4909 { 4830 {
4910 Render *v1; // esi@1 4831 Render *v1; // esi@1
5086 } 5007 }
5087 } 5008 }
5088 } 5009 }
5089 // 4EFA80: using guessed type int dword_4EFA80; 5010 // 4EFA80: using guessed type int dword_4EFA80;
5090 5011
5091
5092 //----- (0049F1BC) -------------------------------------------------------- 5012 //----- (0049F1BC) --------------------------------------------------------
5093 void Render::_49F1BC(const char *a1) 5013 void Render::_49F1BC(const char *a1)
5094 { 5014 {
5095 Render *v2; // esi@1 5015 Render *v2; // esi@1
5096 __int16 v3; // di@1 5016 __int16 v3; // di@1
5280 fclose(v7); 5200 fclose(v7);
5281 } 5201 }
5282 } 5202 }
5283 } 5203 }
5284 // 4EFA84: using guessed type int dword_4EFA84; 5204 // 4EFA84: using guessed type int dword_4EFA84;
5285
5286
5287 5205
5288 //----- (0049F5A2) -------------------------------------------------------- 5206 //----- (0049F5A2) --------------------------------------------------------
5289 int Render::_49F5A2(int a2, int a3, int a4, void *Dst, int a6, int a7) 5207 int Render::_49F5A2(int a2, int a3, int a4, void *Dst, int a6, int a7)
5290 { 5208 {
5291 Render *v7; // ebx@1 5209 Render *v7; // ebx@1
5454 result = a7; 5372 result = a7;
5455 *(int *)a7 = (char *)v9 - Dst; 5373 *(int *)a7 = (char *)v9 - Dst;
5456 return result; 5374 return result;
5457 } 5375 }
5458 5376
5459
5460 //----- (0049F8B5) -------------------------------------------------------- 5377 //----- (0049F8B5) --------------------------------------------------------
5461 FILE *Render::SavePCXImage(const char *Filename, char *a3, int a4, int a5) 5378 FILE *Render::SavePCXImage(const char *Filename, char *a3, int a4, int a5)
5462 { 5379 {
5463 Render *v5; // esi@1 5380 Render *v5; // esi@1
5464 FILE *result; // eax@1 5381 FILE *result; // eax@1
5591 result = (FILE *)fclose(v7); 5508 result = (FILE *)fclose(v7);
5592 } 5509 }
5593 return result; 5510 return result;
5594 } 5511 }
5595 5512
5596
5597 //----- (0049FBCD) -------------------------------------------------------- 5513 //----- (0049FBCD) --------------------------------------------------------
5598 void Render::ClearTarget(unsigned int uColor) 5514 void Render::ClearTarget(unsigned int uColor)
5599 { 5515 {
5600 if (pRenderD3D) 5516 if (pRenderD3D)
5601 { 5517 {
5604 } 5520 }
5605 else 5521 else
5606 memset32(pTargetSurface, uColor, field_10 * field_14 / 2); 5522 memset32(pTargetSurface, uColor, field_10 * field_14 / 2);
5607 } 5523 }
5608 5524
5609
5610
5611 //----- (0049FC23) -------------------------------------------------------- 5525 //----- (0049FC23) --------------------------------------------------------
5612 void Render::Release2() 5526 void Render::Release2()
5613 { 5527 {
5614 Release(); 5528 Release();
5615 bWindowMode = 1; 5529 bWindowMode = 1;
5616 } 5530 }
5617
5618 5531
5619 //----- (0049FC37) -------------------------------------------------------- 5532 //----- (0049FC37) --------------------------------------------------------
5620 void Render::Present() 5533 void Render::Present()
5621 { 5534 {
5622 Render *v1; // esi@1 5535 Render *v1; // esi@1
5692 v5.right = 640; 5605 v5.right = 640;
5693 v3->BltFast(0, 0, v4, &v5, 16u); 5606 v3->BltFast(0, 0, v4, &v5, 16u);
5694 } 5607 }
5695 } 5608 }
5696 5609
5697
5698 //----- (0049FDBF) -------------------------------------------------------- 5610 //----- (0049FDBF) --------------------------------------------------------
5699 void Render::CreateZBuffer() 5611 void Render::CreateZBuffer()
5700 { 5612 {
5701 if (!pDefaultZBuffer) 5613 if (!pDefaultZBuffer)
5702 { 5614 {
5703 pDefaultZBuffer = pActiveZBuffer = nullptr; 5615 pDefaultZBuffer = pActiveZBuffer = nullptr;
5704 pDefaultZBuffer = pActiveZBuffer = (int *)pAllocator->AllocNamedChunk(0, 0x12C000, "Z Buf."); 5616 pDefaultZBuffer = pActiveZBuffer = (int *)pAllocator->AllocNamedChunk(0, 0x12C000, "Z Buf.");
5705 memset32(pActiveZBuffer, 0xFFFF0000u, 0x4B000u); 5617 memset32(pActiveZBuffer, 0xFFFF0000u, 0x4B000u);
5706 } 5618 }
5707 } 5619 }
5708
5709 5620
5710 //----- (0049FE05) -------------------------------------------------------- 5621 //----- (0049FE05) --------------------------------------------------------
5711 void Render::Release() 5622 void Render::Release()
5712 { 5623 {
5713 Render *v1; // esi@1 5624 Render *v1; // esi@1
6057 pViewport->_4C02F8(36044); 5968 pViewport->_4C02F8(36044);
6058 return v15; 5969 return v15;
6059 } 5970 }
6060 // 6BE3A0: using guessed type float flt_6BE3A0; 5971 // 6BE3A0: using guessed type float flt_6BE3A0;
6061 5972
6062
6063 //----- (004A05F3) -------------------------------------------------------- 5973 //----- (004A05F3) --------------------------------------------------------
6064 bool Render::SwitchToWindow(HWND hWnd) 5974 bool Render::SwitchToWindow(HWND hWnd)
6065 { 5975 {
6066 //Render *v2; // esi@1 5976 //Render *v2; // esi@1
6067 //void *v3; // eax@2 5977 //void *v3; // eax@2
6289 goto LABEL_45; 6199 goto LABEL_45;
6290 } 6200 }
6291 } 6201 }
6292 return 0; 6202 return 0;
6293 } 6203 }
6294
6295 6204
6296 //----- (004A0BEE) -------------------------------------------------------- 6205 //----- (004A0BEE) --------------------------------------------------------
6297 char Render::RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) 6206 char Render::RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor)
6298 { 6207 {
6299 int v6; // edi@1 6208 int v6; // edi@1
6524 goto LABEL_46; 6433 goto LABEL_46;
6525 } 6434 }
6526 return v12; 6435 return v12;
6527 } 6436 }
6528 6437
6529
6530
6531 //----- (004A0E80) -------------------------------------------------------- 6438 //----- (004A0E80) --------------------------------------------------------
6532 void Render::ClearZBuffer(int a2, int a3) 6439 void Render::ClearZBuffer(int a2, int a3)
6533 { 6440 {
6534 memset32(this->pActiveZBuffer, -65536, 0x4B000u); 6441 memset32(this->pActiveZBuffer, -65536, 0x4B000u);
6535 } 6442 }
6536
6537
6538 6443
6539 //----- (004A0E97) -------------------------------------------------------- 6444 //----- (004A0E97) --------------------------------------------------------
6540 void Render::SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) 6445 void Render::SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW)
6541 { 6446 {
6542 this->raster_clip_x = uX; 6447 this->raster_clip_x = uX;
6543 this->raster_clip_y = uY; 6448 this->raster_clip_y = uY;
6544 this->raster_clip_z = uZ; 6449 this->raster_clip_z = uZ;
6545 this->raster_clip_w = uW; 6450 this->raster_clip_w = uW;
6546 } 6451 }
6547
6548 6452
6549 //----- (004A0EB6) -------------------------------------------------------- 6453 //----- (004A0EB6) --------------------------------------------------------
6550 void Render::ParseTargetPixelFormat() 6454 void Render::ParseTargetPixelFormat()
6551 { 6455 {
6552 Render *v1; // eax@1 6456 Render *v1; // eax@1
6657 } 6561 }
6658 LABEL_21: 6562 LABEL_21:
6659 LOBYTE(result) = v9; 6563 LOBYTE(result) = v9;
6660 return result; 6564 return result;
6661 } 6565 }
6662
6663 6566
6664 //----- (004A1032) -------------------------------------------------------- 6567 //----- (004A1032) --------------------------------------------------------
6665 bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags) 6568 bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags)
6666 { 6569 {
6667 IDirectDrawSurface2 *v4; // esi@1 6570 IDirectDrawSurface2 *v4; // esi@1
6989 bool Render::UsingDirect3D() 6892 bool Render::UsingDirect3D()
6990 { 6893 {
6991 return bUserDirect3D == 0; 6894 return bUserDirect3D == 0;
6992 } 6895 }
6993 6896
6994
6995 //----- (004A16E1) -------------------------------------------------------- 6897 //----- (004A16E1) --------------------------------------------------------
6996 void Render::UnlockBackBuffer() 6898 void Render::UnlockBackBuffer()
6997 { 6899 {
6998 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) 6900 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
6999 ErrD3D(pBackBuffer4->Unlock(0)); 6901 ErrD3D(pBackBuffer4->Unlock(0));
7000 else 6902 else
7001 ErrD3D(pBackBuffer2->Unlock(0)); 6903 ErrD3D(pBackBuffer2->Unlock(0));
7002 } 6904 }
7003
7004 6905
7005 //----- (004A172E) -------------------------------------------------------- 6906 //----- (004A172E) --------------------------------------------------------
7006 void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow) 6907 void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow)
7007 { 6908 {
7008 Render *v3; // esi@1 6909 Render *v3; // esi@1
7052 v3 = 2611; 6953 v3 = 2611;
7053 } 6954 }
7054 ErrD3D(pFront->Unlock(0)); 6955 ErrD3D(pFront->Unlock(0));
7055 } 6956 }
7056 6957
7057
7058 //----- (004A1814) -------------------------------------------------------- 6958 //----- (004A1814) --------------------------------------------------------
7059 void Render::RestoreFrontBuffer() 6959 void Render::RestoreFrontBuffer()
7060 { 6960 {
7061 IDirectDrawSurface **v1; // esi@2 6961 IDirectDrawSurface **v1; // esi@2
7062 6962
7064 || (v1 = (IDirectDrawSurface **)&this->pFrontBuffer2, pVersion->pVersionInfo.dwMajorVersion >= 5u) ) 6964 || (v1 = (IDirectDrawSurface **)&this->pFrontBuffer2, pVersion->pVersionInfo.dwMajorVersion >= 5u) )
7065 v1 = (IDirectDrawSurface **)&this->pFrontBuffer4; 6965 v1 = (IDirectDrawSurface **)&this->pFrontBuffer4;
7066 if ( (*v1)->IsLost() == DDERR_SURFACELOST ) 6966 if ( (*v1)->IsLost() == DDERR_SURFACELOST )
7067 (*v1)->Restore(); 6967 (*v1)->Restore();
7068 } 6968 }
7069
7070 6969
7071 //----- (004A184C) -------------------------------------------------------- 6970 //----- (004A184C) --------------------------------------------------------
7072 HRESULT Render::_4A184C() 6971 HRESULT Render::_4A184C()
7073 { 6972 {
7074 IDirectDrawSurface **pBack; // esi@2 6973 IDirectDrawSurface **pBack; // esi@2
7118 v6 = a3; 7017 v6 = a3;
7119 pBack = (IDirectDrawSurface *)this->pBackBuffer2; 7018 pBack = (IDirectDrawSurface *)this->pBackBuffer2;
7120 } 7019 }
7121 ErrD3D(pFront->Blt(a2, pBack, v6, v7, v8)); 7020 ErrD3D(pFront->Blt(a2, pBack, v6, v7, v8));
7122 } 7021 }
7123
7124 7022
7125 //----- (004A18F5) -------------------------------------------------------- 7023 //----- (004A18F5) --------------------------------------------------------
7126 void Render::BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags) 7024 void Render::BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags)
7127 { 7025 {
7128 IDirectDrawSurface *pFront; // eax@3 7026 IDirectDrawSurface *pFront; // eax@3
7236 return v7; 7134 return v7;
7237 } 7135 }
7238 return v7; 7136 return v7;
7239 } 7137 }
7240 7138
7241
7242 //----- (004A1E9D) -------------------------------------------------------- 7139 //----- (004A1E9D) --------------------------------------------------------
7243 unsigned int Render::GetBillboardDrawListSize() 7140 unsigned int Render::GetBillboardDrawListSize()
7244 { 7141 {
7245 return pRenderer->uNumBillboardsToDraw; 7142 return pRenderer->uNumBillboardsToDraw;
7246 } 7143 }
7309 pRenderD3D->pDevice->EndScene(); 7206 pRenderD3D->pDevice->EndScene();
7310 } 7207 }
7311 else 7208 else
7312 pGame->pStru6Instance->RenderSpecialEffects(); 7209 pGame->pStru6Instance->RenderSpecialEffects();
7313 } 7210 }
7314
7315
7316 7211
7317 //----- (004A2031) -------------------------------------------------------- 7212 //----- (004A2031) --------------------------------------------------------
7318 unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) 7213 unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6)
7319 { 7214 {
7320 __debugbreak(); // should not fire outside decal builder 7215 __debugbreak(); // should not fire outside decal builder
7716 7611
7717 if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_D3D_OUTLINES || 7612 if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_D3D_OUTLINES ||
7718 pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_D3D_OUTLINES ) 7613 pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_D3D_OUTLINES )
7719 pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); 7614 pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0);
7720 } 7615 }
7721
7722 // 4A26BC: could not find valid save-restore pair for esi 7616 // 4A26BC: could not find valid save-restore pair for esi
7723 // 4D864C: using guessed type char byte_4D864C; 7617 // 4D864C: using guessed type char byte_4D864C;
7724 7618
7725 //----- (004A2DA3) -------------------------------------------------------- 7619 //----- (004A2DA3) --------------------------------------------------------
7726 void Render::DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture) 7620 void Render::DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture)
7764 } 7658 }
7765 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture); 7659 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture);
7766 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); 7660 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
7767 } 7661 }
7768 } 7662 }
7663
7769 //----- (004A2DA3) -------------------------------------------------------- 7664 //----- (004A2DA3) --------------------------------------------------------
7770 void Render::DrawFan(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture) 7665 void Render::DrawFan(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture)
7771 { 7666 {
7772 int v4; // ebx@1 7667 int v4; // ebx@1
7773 int v7; // eax@7 7668 int v7; // eax@7
7807 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture); 7702 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture);
7808 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, 7703 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
7809 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); 7704 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
7810 } 7705 }
7811 } 7706 }
7812
7813 7707
7814 //----- (004A2ED5) -------------------------------------------------------- 7708 //----- (004A2ED5) --------------------------------------------------------
7815 void Render::_4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex) 7709 void Render::_4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex)
7816 { 7710 {
7817 signed int v4; // edi@2 7711 signed int v4; // edi@2
7863 a2, 7757 a2,
7864 28)); 7758 28));
7865 } 7759 }
7866 } 7760 }
7867 } 7761 }
7868
7869
7870 7762
7871 //----- (004A2FC0) -------------------------------------------------------- 7763 //----- (004A2FC0) --------------------------------------------------------
7872 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) 7764 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8)
7873 { 7765 {
7874 //Render *v8; // edi@1 7766 //Render *v8; // edi@1
8072 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); 7964 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE));
8073 } 7965 }
8074 } 7966 }
8075 } 7967 }
8076 // 4D864C: using guessed type char byte_4D864C; 7968 // 4D864C: using guessed type char byte_4D864C;
8077
8078 7969
8079 //----- (004A43B1) -------------------------------------------------------- 7970 //----- (004A43B1) --------------------------------------------------------
8080 void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level) 7971 void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level)
8081 { 7972 {
8082 //RenderBillboardTransform_local0 *v4; // ebx@2 7973 //RenderBillboardTransform_local0 *v4; // ebx@2
8201 pBillboardRenderListD3D[v7].uNumVertices = 4; 8092 pBillboardRenderListD3D[v7].uNumVertices = 4;
8202 pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth; 8093 pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth;
8203 pBillboardRenderListD3D[v7].pTexture = pSprite->pTexture; 8094 pBillboardRenderListD3D[v7].pTexture = pSprite->pTexture;
8204 } 8095 }
8205 } 8096 }
8206
8207
8208 8097
8209 //----- (004A354F) -------------------------------------------------------- 8098 //----- (004A354F) --------------------------------------------------------
8210 void Render::MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) 8099 void Render::MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle)
8211 { 8100 {
8212 //double v5; // st7@3 8101 //double v5; // st7@3
8379 pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; 8268 pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0;
8380 } 8269 }
8381 } 8270 }
8382 } 8271 }
8383 8272
8384
8385 //----- (004A3AD9) -------------------------------------------------------- 8273 //----- (004A3AD9) --------------------------------------------------------
8386 void Render::MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) 8274 void Render::MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle)
8387 { 8275 {
8388 double v5; // st7@2 8276 double v5; // st7@2
8389 float v6; // ST28_4@2 8277 float v6; // ST28_4@2
8552 pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; 8440 pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0;
8553 pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; 8441 pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0;
8554 } 8442 }
8555 } 8443 }
8556 8444
8557
8558 //----- (004A4023) -------------------------------------------------------- 8445 //----- (004A4023) --------------------------------------------------------
8559 void Render::TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard) 8446 void Render::TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard)
8560 { 8447 {
8561 unsigned int v8; // esi@2 8448 unsigned int v8; // esi@2
8562 double v14; // st6@14 8449 double v14; // st6@14
8657 if (a2->uTintColor & 0xFF000000) 8544 if (a2->uTintColor & 0xFF000000)
8658 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3; 8545 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3;
8659 else 8546 else
8660 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Transparent; 8547 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Transparent;
8661 } 8548 }
8662
8663 8549
8664 //----- (004A48E4) -------------------------------------------------------- 8550 //----- (004A48E4) --------------------------------------------------------
8665 int Render::MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6) 8551 int Render::MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6)
8666 { 8552 {
8667 int v6; // ecx@1 8553 int v6; // ecx@1
8852 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); 8738 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
8853 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); 8739 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE));
8854 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); 8740 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW));
8855 } 8741 }
8856 8742
8857
8858 //----- (004A4CC9) -------------------------------------------------------- 8743 //----- (004A4CC9) --------------------------------------------------------
8859 void Render::_4A4CC9(stru6_stru1_indoor_sw_billboard *a1, int a2) 8744 void Render::_4A4CC9(stru6_stru1_indoor_sw_billboard *a1, int a2)
8860 { 8745 {
8861 int v3; // eax@1 8746 int v3; // eax@1
8862 int v4; // edx@3 8747 int v4; // edx@3
8930 pBillboardRenderListD3D[v5].uNumVertices = v13; 8815 pBillboardRenderListD3D[v5].uNumVertices = v13;
8931 LODWORD(pBillboardRenderListD3D[v5].z_order) = v14; 8816 LODWORD(pBillboardRenderListD3D[v5].z_order) = v14;
8932 } 8817 }
8933 } 8818 }
8934 8819
8935
8936 //----- (004A4DE1) -------------------------------------------------------- 8820 //----- (004A4DE1) --------------------------------------------------------
8937 bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture) 8821 bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture)
8938 { 8822 {
8939 HRESULT v12; // eax@14 8823 HRESULT v12; // eax@14
8940 unsigned __int16 *v13; // ecx@19 8824 unsigned __int16 *v13; // ecx@19
9183 UnlockBackBuffer(); 9067 UnlockBackBuffer();
9184 } 9068 }
9185 } 9069 }
9186 } 9070 }
9187 } 9071 }
9188
9189 9072
9190 //----- ( ) -------------------------------------------------------- 9073 //----- ( ) --------------------------------------------------------
9191 unsigned int Render::_4A52F1(unsigned int this_, float a3) 9074 unsigned int Render::_4A52F1(unsigned int this_, float a3)
9192 { 9075 {
9193 unsigned int v3; // esi@1 9076 unsigned int v3; // esi@1
9392 } 9275 }
9393 } 9276 }
9394 return result; 9277 return result;
9395 } 9278 }
9396 9279
9397
9398
9399 //----- (004A5B81) -------------------------------------------------------- 9280 //----- (004A5B81) --------------------------------------------------------
9400 void Render::SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) 9281 void Render::SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW)
9401 { 9282 {
9402 this->bClip = 1; 9283 this->bClip = 1;
9403 this->uClipY = uY; 9284 this->uClipY = uY;
9404 this->uClipX = uX; 9285 this->uClipX = uX;
9405 this->uClipW = uW; 9286 this->uClipW = uW;
9406 this->uClipZ = uZ; 9287 this->uClipZ = uZ;
9407 } 9288 }
9408 9289
9409
9410 //----- (004A5BB6) -------------------------------------------------------- 9290 //----- (004A5BB6) --------------------------------------------------------
9411 void Render::ResetTextureClipRect() 9291 void Render::ResetTextureClipRect()
9412 { 9292 {
9413 this->uClipY = 0; 9293 this->uClipY = 0;
9414 this->uClipX = 0; 9294 this->uClipX = 0;
9415 this->bClip = 1; 9295 this->bClip = 1;
9416 this->uClipW = 480; 9296 this->uClipW = 480;
9417 this->uClipZ = 640; 9297 this->uClipZ = 640;
9418 } 9298 }
9419
9420 9299
9421 //----- (004A5BE3) -------------------------------------------------------- 9300 //----- (004A5BE3) --------------------------------------------------------
9422 void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) 9301 void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4)
9423 { 9302 {
9424 int v4; // edi@3 9303 int v4; // edi@3
9518 } 9397 }
9519 while ( !v18 ); 9398 while ( !v18 );
9520 } 9399 }
9521 } 9400 }
9522 } 9401 }
9523
9524 9402
9525 //----- (004A5D33) -------------------------------------------------------- 9403 //----- (004A5D33) --------------------------------------------------------
9526 void Render::_4A5D33(unsigned int pX, unsigned int pY, int a4, int a5, RGBTexture *pTexture) 9404 void Render::_4A5D33(unsigned int pX, unsigned int pY, int a4, int a5, RGBTexture *pTexture)
9527 { 9405 {
9528 Render *v6; // esi@1 9406 Render *v6; // esi@1
9632 while ( a2a ); 9510 while ( a2a );
9633 } 9511 }
9634 } 9512 }
9635 } 9513 }
9636 9514
9637
9638
9639 //----- (004A6E7E) -------------------------------------------------------- 9515 //----- (004A6E7E) --------------------------------------------------------
9640 void Render::_4A6E7E(unsigned int a2, unsigned int a3, Texture *a4) 9516 void Render::_4A6E7E(unsigned int a2, unsigned int a3, Texture *a4)
9641 { 9517 {
9642 unsigned __int16 *v4; // eax@4 9518 unsigned __int16 *v4; // eax@4
9643 int v5; // edx@4 9519 int v5; // edx@4
9766 } 9642 }
9767 } 9643 }
9768 } 9644 }
9769 } 9645 }
9770 9646
9771
9772 //----- (004A6DF5) -------------------------------------------------------- 9647 //----- (004A6DF5) --------------------------------------------------------
9773 int Render::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) 9648 int Render::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7)
9774 { 9649 {
9775 int result; // eax@0 9650 int result; // eax@0
9776 int v8; // ecx@3 9651 int v8; // ecx@3
9816 } 9691 }
9817 } 9692 }
9818 return result; 9693 return result;
9819 } 9694 }
9820 9695
9821
9822 //----- (004A6D87) -------------------------------------------------------- 9696 //----- (004A6D87) --------------------------------------------------------
9823 void Render::FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16) 9697 void Render::FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16)
9824 { 9698 {
9825 if (!uNumSceneBegins) 9699 if (!uNumSceneBegins)
9826 return; 9700 return;
9833 memset32(pDst, twoColors, uWidth / 2); 9707 memset32(pDst, twoColors, uWidth / 2);
9834 if (uWidth & 1) 9708 if (uWidth & 1)
9835 pDst[uWidth - 1] = uColor16; 9709 pDst[uWidth - 1] = uColor16;
9836 } 9710 }
9837 } 9711 }
9838
9839
9840 9712
9841 //----- (004A6C4F) -------------------------------------------------------- 9713 //----- (004A6C4F) --------------------------------------------------------
9842 void Render::DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor) 9714 void Render::DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor)
9843 { 9715 {
9844 unsigned int v9; // edi@2 9716 unsigned int v9; // edi@2
9935 while ( !v23 ); 9807 while ( !v23 );
9936 } 9808 }
9937 } 9809 }
9938 } 9810 }
9939 9811
9940
9941
9942 //----- (004A6A68) -------------------------------------------------------- 9812 //----- (004A6A68) --------------------------------------------------------
9943 void Render::_4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height) 9813 void Render::_4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height)
9944 { 9814 {
9945 Render *v5; // ebx@1 9815 Render *v5; // ebx@1
9946 unsigned __int16 v6; // ax@1 9816 unsigned __int16 v6; // ax@1
9954 memcpy(&tex, a4, sizeof(tex)); 9824 memcpy(&tex, a4, sizeof(tex));
9955 tex.uTextureHeight = v6; 9825 tex.uTextureHeight = v6;
9956 if ( (signed __int16)v6 > 0 ) 9826 if ( (signed __int16)v6 > 0 )
9957 DrawTextureIndexed(a2, a3, &tex); 9827 DrawTextureIndexed(a2, a3, &tex);
9958 } 9828 }
9959
9960
9961 9829
9962 //----- (004A6AB1) -------------------------------------------------------- 9830 //----- (004A6AB1) --------------------------------------------------------
9963 void Render::DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8) 9831 void Render::DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8)
9964 { 9832 {
9965 int v8; // edi@2 9833 int v8; // edi@2
10207 } 10075 }
10208 } 10076 }
10209 } 10077 }
10210 } 10078 }
10211 10079
10212
10213 //----- (004A6776) -------------------------------------------------------- 10080 //----- (004A6776) --------------------------------------------------------
10214 void Render::DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4) 10081 void Render::DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4)
10215 { 10082 {
10216 Texture *v4; // edi@2 10083 Texture *v4; // edi@2
10217 unsigned int v5; // ebx@4 10084 unsigned int v5; // ebx@4
10422 } 10289 }
10423 while ( ya ); 10290 while ( ya );
10424 } 10291 }
10425 } 10292 }
10426 } 10293 }
10427
10428 10294
10429 //----- (004A63E6) -------------------------------------------------------- 10295 //----- (004A63E6) --------------------------------------------------------
10430 void Render::_4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) 10296 void Render::_4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8)
10431 { 10297 {
10432 Texture *v8; // eax@2 10298 Texture *v8; // eax@2
10547 } 10413 }
10548 } 10414 }
10549 } 10415 }
10550 } 10416 }
10551 10417
10552
10553 //----- (004A6274) -------------------------------------------------------- 10418 //----- (004A6274) --------------------------------------------------------
10554 void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture) 10419 void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture)
10555 { 10420 {
10556 Texture *pCurrentTexture; // edi@2 10421 Texture *pCurrentTexture; // edi@2
10557 int uHeight; // ebx@4 10422 int uHeight; // ebx@4
10656 } 10521 }
10657 } 10522 }
10658 } 10523 }
10659 } 10524 }
10660 10525
10661
10662 //----- (004A612A) -------------------------------------------------------- 10526 //----- (004A612A) --------------------------------------------------------
10663 void Render::DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal) 10527 void Render::DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal)
10664 { 10528 {
10665 Texture *v5; // eax@2 10529 Texture *v5; // eax@2
10666 unsigned int v6; // edx@3 10530 unsigned int v6; // edx@3
10761 while ( uOutXa ); 10625 while ( uOutXa );
10762 } 10626 }
10763 } 10627 }
10764 } 10628 }
10765 } 10629 }
10766
10767 10630
10768 //----- (004A601E) -------------------------------------------------------- 10631 //----- (004A601E) --------------------------------------------------------
10769 void Render::_4A601E(signed int a2, signed int a3, Texture *pTexture, int a5) 10632 void Render::_4A601E(signed int a2, signed int a3, Texture *pTexture, int a5)
10770 { 10633 {
10771 signed int v5; // edx@3 10634 signed int v5; // edx@3
11102 } 10965 }
11103 } 10966 }
11104 // 6BE364: using guessed type int dword_6BE364_game_settings_1; 10967 // 6BE364: using guessed type int dword_6BE364_game_settings_1;
11105 // A74C88: using guessed type int dword_A74C88; 10968 // A74C88: using guessed type int dword_A74C88;
11106 10969
11107
11108 //----- (0044EC20) -------------------------------------------------------- 10970 //----- (0044EC20) --------------------------------------------------------
11109 bool RenderD3D::DoesRaiseExceptions() 10971 bool RenderD3D::DoesRaiseExceptions()
11110 { 10972 {
11111 return true; 10973 return true;
11112 } 10974 }
11113
11114 10975
11115 //----- (0040DBD3) -------------------------------------------------------- 10976 //----- (0040DBD3) --------------------------------------------------------
11116 void __fastcall Render::SetPixel(Vec2_int_ *pTargetXY, unsigned __int16 uColor) 10977 void __fastcall Render::SetPixel(Vec2_int_ *pTargetXY, unsigned __int16 uColor)
11117 { 10978 {
11118 Vec2_int_ *pTargetXY_; // esi@1 10979 Vec2_int_ *pTargetXY_; // esi@1
11139 } 11000 }
11140 } 11001 }
11141 pRenderer->EndScene(); 11002 pRenderer->EndScene();
11142 } 11003 }
11143 } 11004 }
11144
11145 11005
11146 //----- (004524D8) -------------------------------------------------------- 11006 //----- (004524D8) --------------------------------------------------------
11147 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) 11007 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps)
11148 { 11008 {
11149 int v11; // eax@13 11009 int v11; // eax@13
11381 fread(pSpriteOffsets, 4, uNumItems, pFile); 11241 fread(pSpriteOffsets, 4, uNumItems, pFile);
11382 11242
11383 return true; 11243 return true;
11384 } 11244 }
11385 11245
11386
11387
11388
11389
11390
11391
11392
11393
11394 //----- (004A1C1E) -------------------------------------------------------- 11246 //----- (004A1C1E) --------------------------------------------------------
11395 void DoRenderBillboards_D3D() 11247 void DoRenderBillboards_D3D()
11396 { 11248 {
11397 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); 11249 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP));
11398 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); 11250 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE));
11457 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); 11309 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
11458 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); 11310 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));
11459 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); 11311 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
11460 } 11312 }
11461 11313
11462
11463
11464
11465
11466 //----- (004A1DA8) -------------------------------------------------------- 11314 //----- (004A1DA8) --------------------------------------------------------
11467 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1) 11315 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1)
11468 { 11316 {
11469 switch (a1) 11317 switch (a1)
11470 { 11318 {