Mercurial > mm7
annotate Render.cpp @ 1410:38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
stru167 -> TrailParticle
stru167warp -> TrailParticleGenerator
author | Nomad |
---|---|
date | Fri, 26 Jul 2013 22:19:29 +0200 |
parents | c9e3b93ec570 |
children | 3881d2f94eb1 b67a3e0d6fc3 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
4 |
140 | 5 #include <assert.h> |
6 | |
1277 | 7 #include "Outdoor_stuff.h" |
1016 | 8 #include "VideoPlayer.h" |
9 #include "Sprites.h" | |
10 #include "Mouse.h" | |
11 #include "GammaControl.h" | |
12 #include "stru6.h" | |
1183 | 13 #include "GUIWindow.h" |
1016 | 14 #include "DecalBuilder.h" |
15 #include "ParticleEngine.h" | |
0 | 16 #include "Render.h" |
17 #include "OutdoorCamera.h" | |
18 #include "IndoorCamera.h" | |
19 #include "Outdoor.h" | |
20 #include "Party.h" | |
21 #include "LOD.h" | |
22 #include "Viewport.h" | |
23 #include "Math.h" | |
24 #include "PaletteManager.h" | |
25 #include "Time.h" | |
26 #include "Game.h" | |
27 #include "LightmapBuilder.h" | |
28 #include "ObjectList.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
29 #include "SpriteObject.h" |
0 | 30 #include "DecorationList.h" |
31 #include "Allocator.h" | |
32 #include "OSInfo.h" | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
33 #include "Actor.h" |
0 | 34 #include "Log.h" |
179 | 35 #include "TileFrameTable.h" |
189 | 36 #include "texts.h" |
0 | 37 #include "mm7_data.h" |
860 | 38 #include "MM7.h" |
1262 | 39 #include "Lights.h" |
0 | 40 |
41 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") | |
42 #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib") | |
43 | |
44 struct IDirectDrawClipper *pDDrawClipper; | |
45 struct Render *pRenderer; // idb | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
46 struct RenderVertexD3D3 pVertices[50]; |
0 | 47 int uNumDecorationsDrawnThisFrame; // weak |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
48 RenderBillboard pBillboardRenderList[500]; |
0 | 49 unsigned int uNumBillboardsToDraw; |
50 int uNumSpritesDrawnThisFrame; // weak | |
51 | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
52 RenderVertexSoft array_507D30[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
53 RenderVertexSoft array_508690[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
54 RenderVertexSoft array_508FF0[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
55 RenderVertexSoft array_509950[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
56 RenderVertexSoft array_50A2B0[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
57 RenderVertexSoft array_50AC10[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
58 |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
59 RenderVertexSoft array_73D150[20]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
60 |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
61 RenderVertexD3D3 d3d_vertex_buffer[50]; |
0 | 62 |
63 RenderVertexSoft *ptr_801A04; | |
64 RenderVertexSoft *ptr_801A08; | |
65 | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
66 RenderVertexSoft pVerticesSR_801A10[384]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
67 RenderVertexSoft pVerticesSR_806210[384]; |
0 | 68 |
69 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); | |
70 | |
71 /* 384 */ | |
72 #pragma pack(push, 1) | |
73 struct PCXHeader_1 | |
74 { | |
75 char manufacturer; | |
76 char version; | |
77 char encoding; | |
78 char bpp; | |
79 __int16 left; | |
80 __int16 up; | |
81 __int16 right; | |
82 __int16 bottom; | |
83 __int16 hdpi; | |
84 __int16 vdpi; | |
85 }; | |
86 #pragma pack(pop) | |
87 | |
88 /* 385 */ | |
89 #pragma pack(push, 1) | |
90 struct PCXHeader_2 | |
91 { | |
92 char reserved; | |
93 char planes; | |
94 __int16 pitch; | |
95 __int16 palette_info; | |
96 }; | |
97 #pragma pack(pop) | |
98 | |
99 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst); | |
100 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2); | |
101 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, struct RenderD3D_aux *a6); | |
102 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut); // idb | |
103 | |
104 //----- (0049E79F) -------------------------------------------------------- | |
105 bool __cdecl CheckTextureStages() | |
106 { | |
107 bool v0; // edi@1 | |
108 IDirectDrawSurface4 *pSurface2; // [sp+Ch] [bp-14h]@1 | |
109 IDirectDrawSurface4 *pSurface1; // [sp+10h] [bp-10h]@1 | |
110 DWORD v4; // [sp+14h] [bp-Ch]@1 | |
111 IDirect3DTexture2 *pTexture2; // [sp+18h] [bp-8h]@1 | |
112 IDirect3DTexture2 *pTexture1; // [sp+1Ch] [bp-4h]@1 | |
113 | |
114 v0 = false; | |
115 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface1, &pTexture1, true, false, 32u); | |
116 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface2, &pTexture2, true, false, 32u); | |
117 | |
118 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture1)); | |
186 | 119 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 120 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 2u)); |
121 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | |
122 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | |
123 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | |
124 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 1u)); | |
125 | |
126 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture2)); | |
186 | 127 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); |
0 | 128 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1u)); |
129 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 7u)); | |
130 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, 2u)); | |
131 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG2, 1u)); | |
132 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MAGFILTER, 2u)); | |
133 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MINFILTER, 2u)); | |
134 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MIPFILTER, 1u)); | |
135 | |
136 if ( !pRenderer->pRenderD3D->pDevice->ValidateDevice(&v4) && v4 == 1 ) | |
137 v0 = true; | |
138 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 1u)); | |
139 pTexture1->Release(); | |
140 pTexture2->Release(); | |
141 pSurface1->Release(); | |
142 pSurface2->Release(); | |
143 return v0; | |
144 } | |
145 | |
146 //----- (00440CB8) -------------------------------------------------------- | |
147 void Render::DrawBillboardList_BLV() | |
148 { | |
149 __int16 v2; // ax@3 | |
150 int v5; // eax@11 | |
151 RenderBillboardTransform_local0 soft_billboard; // [sp+4h] [bp-50h]@1 | |
152 | |
153 soft_billboard.uParentBillboardID = -1; | |
154 soft_billboard.pTarget = pBLVRenderParams->pRenderTarget; | |
155 soft_billboard.pTargetZ = pBLVRenderParams->pTargetZBuffer; | |
156 soft_billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
157 soft_billboard.uViewportX = pBLVRenderParams->uViewportX; | |
158 soft_billboard.uViewportY = pBLVRenderParams->uViewportY; | |
159 soft_billboard.uViewportZ = pBLVRenderParams->uViewportZ - 1; | |
160 soft_billboard.uViewportW = pBLVRenderParams->uViewportW; | |
161 | |
617 | 162 pOutdoorCamera->uNumBillboards = ::uNumBillboardsToDraw; |
163 for (uint i = 0; i < ::uNumBillboardsToDraw; ++i) | |
0 | 164 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
165 auto p = pBillboardRenderList + i; |
0 | 166 |
167 soft_billboard.uScreenSpaceX = p->uScreenSpaceX; | |
168 soft_billboard.uParentBillboardID = i; | |
169 soft_billboard.uScreenSpaceY = p->uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
170 soft_billboard._screenspace_x_scaler_packedfloat = p->_screenspace_x_scaler_packedfloat; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
171 soft_billboard._screenspace_y_scaler_packedfloat = p->_screenspace_y_scaler_packedfloat; |
0 | 172 soft_billboard.sZValue = p->sZValue; |
173 soft_billboard.uFlags = p->field_1E; | |
174 soft_billboard.uTintColor = p->uTintColor; | |
175 v2 = p->uHwSpriteID; | |
176 if ( v2 != -1 ) | |
177 { | |
178 if ( pRenderer->pRenderD3D ) | |
657 | 179 pRenderer->DrawBillboard_Indoor(&soft_billboard, &pSprites_LOD->pHardwareSprites[v2], p->dimming_level); |
0 | 180 else |
181 { | |
657 | 182 soft_billboard.pPalette = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, p->dimming_level, 1); |
0 | 183 if (p->field_1E & 0x0100) |
184 soft_billboard.pPalette = pPaletteManager->field_261600[p->uPalette]; | |
185 if ( !(soft_billboard.uFlags & 0x40) && soft_billboard.uFlags & 0x80 ) | |
186 soft_billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, 0, 1); | |
187 v5 = p->uHwSpriteID; | |
188 if ( v5 >= 0 ) | |
733 | 189 pSprites_LOD->pSpriteHeaders[v5].DrawSprite_sw(&soft_billboard, 1); |
0 | 190 } |
191 } | |
192 } | |
193 } | |
194 | |
195 //----- (004A16A5) -------------------------------------------------------- | |
196 bool __cdecl AreRenderSurfacesOk() | |
197 { | |
198 char v0; // zf@4 | |
199 bool result; // eax@8 | |
200 | |
201 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
202 { | |
203 if ( !pRenderer->pBackBuffer4 ) | |
204 goto LABEL_9; | |
205 v0 = pRenderer->pFrontBuffer4 == 0; | |
206 } | |
207 else | |
208 { | |
209 if ( !pRenderer->pBackBuffer2 ) | |
210 goto LABEL_9; | |
211 v0 = pRenderer->pFrontBuffer2 == 0; | |
212 } | |
213 if ( !v0 ) | |
214 { | |
215 LOBYTE(result) = 1; | |
216 return result; | |
217 } | |
218 LABEL_9: | |
219 LOBYTE(result) = 0; | |
220 return result; | |
221 } | |
222 | |
988 | 223 |
1338 | 224 void Render::RenderTerrainD3D() // New function |
86 | 225 { |
226 char result; // al@3 | |
227 int v6; // ecx@8 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
228 struct Polygon *pTile; // ebx@8 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
229 struct Polygon *v16; |
86 | 230 unsigned int v18; // edi@22 |
231 int v35; // edi@63 | |
232 int v37; // eax@73 | |
233 int v39; // eax@80 | |
234 char v40; // [sp-18h] [bp-70h]@2 | |
235 int v41; // [sp-14h] [bp-6Ch]@2 | |
236 int v42; // [sp-10h] [bp-68h]@2 | |
237 int v43; // [sp-Ch] [bp-64h]@2 | |
238 const char *v44; // [sp-8h] [bp-60h]@2 | |
239 int v45; // [sp-4h] [bp-5Ch]@2 | |
240 int v56; | |
241 int v57; // [sp+38h] [bp-20h]@36 | |
242 int v64; // [sp+57h] [bp-1h]@2 | |
243 int v62; | |
186 | 244 |
245 //warning: the game uses CW culling by default, ccw is incosistent | |
246 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); | |
247 | |
1338 | 248 static RenderVertexSoft pTerrainVertices[128 * 128];//vertexCountX and vertexCountZ |
249 | |
250 //Ãåíåðàöèÿ ìåñòîïîëîæåíèÿ âåðøèí------------------------------------------------------------------------- | |
251 //ðåø¸òêà âåðøèí äåëèòñÿ íà äâå ÷àñòè îò -64 äî 0 è îò 0 äî 64 | |
252 // | |
253 // -64 X 0 64 | |
254 // --------------- 64 | |
255 // | | | | |
256 // | | | | |
257 // | | | | |
258 // 0|------+------| Z | |
259 // | | | | |
260 // | | | | |
261 // | | | | |
262 // --------------- | |
263 // -64 | |
264 | |
265 int blockScale = 512; | |
266 int heightScale = 32; | |
267 for (unsigned int z = 0; z < 128; ++z) | |
268 { | |
269 for (unsigned int x = 0; x < 128; ++x) | |
270 { | |
271 pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * blockScale; | |
272 pTerrainVertices[z * 128 + x].vWorldPosition.y = (64 - (signed)z) * blockScale; | |
273 pTerrainVertices[z * 128 + x].vWorldPosition.z = heightScale * pOutdoor->pTerrain.pHeightmap[z * 128 + x]; | |
121 | 274 pGame->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); |
275 pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); | |
106 | 276 } |
277 } | |
1338 | 278 //-------------------------------------------------------------------------------------------------------------------- |
279 | |
280 // | |
1344 | 281 for (unsigned int z = 0; z < 127; ++z) |
282 { | |
283 for (unsigned int x = 0; x < 127; ++x) | |
1338 | 284 { |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
285 pTile = &array_77EC08[pOutdoorCamera->uNumPolygons]; |
1338 | 286 pTile->flags = 0; |
287 pTile->field_32 = 0; | |
288 pTile->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); | |
289 pTile->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[pTile->uTileBitmapID]; | |
290 if (pTile->uTileBitmapID == 0xFFFF) | |
106 | 291 continue; |
186 | 292 |
1338 | 293 //pTile->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(x, z); |
294 pTile->flags = pOutdoor->GetSomeOtherTileInfo(x, z); | |
295 pTile->field_32 = 0; | |
296 pTile->field_59 = 1; | |
297 pTile->sTextureDeltaU = 0; | |
298 pTile->sTextureDeltaV = 0; | |
299 // x,z x+1,z | |
300 // .____________. | |
301 // | | | |
302 // | | | |
303 // | | | |
304 // | | | |
305 // | | | |
306 // .____________. | |
307 // x,z+1 x+1,z+1 | |
308 memcpy(&array_73D150[0], &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft));//x, z | |
106 | 309 array_73D150[0].u = 0; |
310 array_73D150[0].v = 0; | |
1338 | 311 memcpy(&array_73D150[1], &pTerrainVertices[z * 128 + x + 1], sizeof(RenderVertexSoft));//x + 1, z |
106 | 312 array_73D150[1].u = 1; |
313 array_73D150[1].v = 0; | |
1338 | 314 memcpy(&array_73D150[2], &pTerrainVertices[(z + 1) * 128 + x + 1], sizeof(RenderVertexSoft));//x + 1, z + 1 |
106 | 315 array_73D150[2].u = 1; |
316 array_73D150[2].v = 1; | |
1338 | 317 memcpy(&array_73D150[3], &pTerrainVertices[(z + 1) * 128 + x], sizeof(RenderVertexSoft));//x, z + 1 |
106 | 318 array_73D150[3].u = 0; |
319 array_73D150[3].v = 1; | |
1338 | 320 //v58 = 0; |
321 //if (v58 == 4) // if all y == first y; primitive in xz plane | |
322 //pTile->field_32 |= 0x0001; | |
323 pTile->pODMFace = nullptr; | |
324 pTile->uNumVertices = 4; | |
325 pTile->field_59 = 5; | |
326 | |
327 //shading (çàòåíåíèå)---------------------------------------------------------------------------- | |
328 //uint norm_idx = pTerrainNormalIndices[2 * (z * 128 + x) + 1]; | |
329 uint norm_idx = pTerrainNormalIndices[2 * (x * 128 + z) + 1];//åñòü íåñîâïàäåíèå â 1 êóáèê, òåíü íàäî ïîäíÿòü íà 1 | |
638 | 330 assert(norm_idx < uNumTerrainNormals); |
331 | |
332 auto norm = pTerrainNormals + norm_idx; | |
1338 | 333 float _f = ((norm->x * (float)pOutdoor->vSunlight.x / 65536.0) - |
334 (norm->y * (float)pOutdoor->vSunlight.y / 65536.0) - | |
335 (norm->z * (float)pOutdoor->vSunlight.z / 65536.0)); | |
336 pTile->dimming_level = 20.0 - floorf(20.0 * _f + 0.5f); | |
337 //----------------------------------------------------------------------------------------------- | |
638 | 338 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
339 ++pOutdoorCamera->uNumPolygons; |
86 | 340 ++pOutdoorCamera->field_44; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
341 assert(pOutdoorCamera->uNumPolygons < 20000); |
265 | 342 |
1338 | 343 pTile->uBModelID = 0; |
344 pTile->uBModelFaceID = 0; | |
345 pTile->field_50 = (8 * (0 | (0 << 6))) | 6; | |
346 for (unsigned int k = 0; k < pTile->uNumVertices; ++k) | |
106 | 347 { |
348 memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); | |
168 | 349 array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); |
106 | 350 } |
140 | 351 |
1338 | 352 // check the transparency and texture (tiles) mapping (ïðîâåðêà ïðîçðà÷íîñòè è íàëîæåíèå òåêñòóð (òàéëîâ))---------------------- |
186 | 353 bool transparent = false; |
1338 | 354 if ( !( pTile->flags & 1 ) ) // íå ïîääåðæèâàåòñÿ TextureFrameTable |
355 { | |
356 if ( pTile->flags & 2 && pTile->uTileBitmapID == pRenderer->hd_water_tile_id) | |
357 { | |
358 //transparent = false; | |
359 v6 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; | |
360 } | |
361 else | |
362 { | |
363 v6 = pTile->uTileBitmapID; | |
364 if ( !_strnicmp(pBitmaps_LOD->pTextures[pTile->uTileBitmapID].pName, "wtrdr", 5) ) | |
365 transparent = true; | |
366 } | |
179 | 367 |
140 | 368 assert(v6 < 1000); // many random crashes here |
186 | 369 |
370 // for all shore tiles - draw a tile water under them since they're half-empty | |
1338 | 371 if (!_strnicmp(pBitmaps_LOD->pTextures[pTile->uTileBitmapID].pName, "wtrdr", 5)) // all shore tile filenames are wtrdrXXX |
372 pTile->DrawBorderTiles(); | |
373 | |
374 pRenderer->DrawTerrainPolygon(pTile->uNumVertices, pTile, pBitmaps_LOD->pHardwareTextures[v6], transparent, true); | |
375 } | |
376 //else //çäåñü óæå ïîãðàíè÷íûå òàéëû âîäû | |
377 //pTile->DrawBorderTiles(); | |
378 //-------------------------------------------------------------------------------------------------------------------------------- | |
186 | 379 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
380 --pOutdoorCamera->uNumPolygons; |
86 | 381 --pOutdoorCamera->field_44; |
106 | 382 } |
383 } | |
384 } | |
0 | 385 |
386 //----- (0048034E) -------------------------------------------------------- | |
985 | 387 void Render::DrawTerrainD3D(int a1, int a2, int a3, int unk4) |
388 { | |
389 //int v3; // esi@1 | |
0 | 390 int v4; // edi@1 |
391 int v5; // ebx@2 | |
392 int v6; // eax@2 | |
393 int v7; // eax@3 | |
394 RenderVertexSoft *v8; // edi@3 | |
395 RenderVertexSoft *v9; // ebx@4 | |
396 RenderVertexSoft *v10; // ecx@4 | |
397 float v11; // eax@6 | |
398 double v12; // ST5C_8@6 | |
399 double v13; // ST2C_8@6 | |
400 int v14; // eax@6 | |
401 double v15; // st7@6 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
402 struct Polygon *pTile; // ebx@12 |
0 | 403 unsigned __int16 v17; // ax@12 |
404 int v18; // eax@13 | |
405 signed int v22; // eax@13 | |
1338 | 406 Vec3_float_ *norm; // eax@15 |
407 //double v24; // st6@17 | |
0 | 408 double v25; // ST54_8@17 |
409 unsigned __int8 v26; // sf@17 | |
410 unsigned __int8 v27; // of@17 | |
411 double v28; // st5@19 | |
412 double v29; // st5@19 | |
413 double v30; // st5@19 | |
414 double v31; // st5@19 | |
67 | 415 struct struct8 *v32; // esi@21 |
416 double v3a; // st7@32 | |
0 | 417 int v33; // edi@38 |
418 unsigned int v34; // ecx@47 | |
419 char v35; // zf@47 | |
420 unsigned int v36; // eax@50 | |
421 int v37; // eax@54 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
422 //Polygon *v38; // ecx@55 |
0 | 423 unsigned int v39; // eax@59 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
424 struct Polygon *v40; // ebx@62 |
86 | 425 unsigned __int16 pTileBitmapsID; // ax@62 |
0 | 426 int v42; // eax@63 |
427 LightmapBuilder *v43; // ecx@63 | |
67 | 428 int v44; // eax@63 |
0 | 429 int v45; // eax@63 |
430 int v46; // eax@63 | |
431 signed int v47; // eax@63 | |
432 Vec3_float_ *v48; // eax@65 | |
433 double v49; // st6@67 | |
434 double v50; // ST4C_8@67 | |
435 double v51; // st5@71 | |
436 double v52; // st5@71 | |
437 double v53; // st5@71 | |
438 double v54; // st7@84 | |
439 unsigned int v55; // ecx@98 | |
440 unsigned int v56; // eax@101 | |
441 int v57; // eax@105 | |
442 unsigned int v58; // eax@109 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
443 struct Polygon *v59; // esi@112 |
0 | 444 unsigned __int16 v60; // ax@112 |
67 | 445 int v61; // eax@113 |
0 | 446 signed int v62; // eax@113 |
447 Vec3_float_ *v63; // eax@114 | |
448 double v64; // st6@116 | |
449 double v65; // ST3C_8@116 | |
450 double v66; // st5@120 | |
451 double v67; // st5@120 | |
452 double v68; // st5@120 | |
453 double v69; // st7@133 | |
454 int v70; // edi@138 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
455 struct Polygon *v71; // esi@147 |
0 | 456 unsigned int v72; // ecx@147 |
457 unsigned int v73; // eax@150 | |
67 | 458 int v74; // eax@154 |
0 | 459 unsigned int v75; // eax@158 |
985 | 460 //unsigned int v76; // [sp-10h] [bp-E0h]@61 |
67 | 461 int v77; // [sp-Ch] [bp-DCh]@61 |
0 | 462 IDirect3DTexture2 *v78; // [sp-8h] [bp-D8h]@61 |
985 | 463 //int v79; // [sp-4h] [bp-D4h]@61 |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
464 bool v80; // [sp+0h] [bp-D0h]@59 |
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
465 bool v81; // [sp+0h] [bp-D0h]@109 |
0 | 466 int v82; // [sp+54h] [bp-7Ch]@1 |
467 int v83; // [sp+60h] [bp-70h]@1 | |
468 int v84; // [sp+6Ch] [bp-64h]@1 | |
469 int v85; // [sp+70h] [bp-60h]@63 | |
1075 | 470 float a4; // [sp+74h] [bp-5Ch]@73 |
0 | 471 float v87; // [sp+78h] [bp-58h]@122 |
472 int v88; // [sp+7Ch] [bp-54h]@1 | |
473 int v89; // [sp+80h] [bp-50h]@6 | |
67 | 474 int v93; // [sp+90h] [bp-40h]@2 |
0 | 475 int X; // [sp+94h] [bp-3Ch]@1 |
476 float v95; // [sp+98h] [bp-38h]@21 | |
477 LightmapBuilder *v96; // [sp+9Ch] [bp-34h]@73 | |
67 | 478 int v97; // [sp+A0h] [bp-30h]@6 |
0 | 479 int sX; // [sp+A4h] [bp-2Ch]@6 |
480 unsigned int uNumVertices; // [sp+A8h] [bp-28h]@73 | |
481 int v100; // [sp+ACh] [bp-24h]@122 | |
482 int sY; // [sp+B0h] [bp-20h]@6 | |
67 | 483 RenderVertexSoft *v102; // [sp+B4h] [bp-1Ch]@3 |
0 | 484 unsigned int a5; // [sp+B8h] [bp-18h]@21 |
485 RenderVertexSoft *v101; // [sp+BCh] [bp-14h]@6 | |
486 Vec3_float_ *v99; // [sp+C0h] [bp-10h]@17 | |
487 RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6 | |
67 | 488 RenderVertexSoft *pVertices2; // [sp+C8h] [bp-8h]@6 |
0 | 489 char v108; // [sp+CFh] [bp-1h]@36 |
490 float thisd; // [sp+D8h] [bp+8h]@6 | |
491 float thise; // [sp+D8h] [bp+8h]@6 | |
492 float thisf; // [sp+D8h] [bp+8h]@17 | |
493 IndoorCameraD3D *thisa; // [sp+D8h] [bp+8h]@23 | |
494 float thisg; // [sp+D8h] [bp+8h]@67 | |
495 IndoorCameraD3D *thisb; // [sp+D8h] [bp+8h]@75 | |
496 float thish; // [sp+D8h] [bp+8h]@116 | |
497 IndoorCameraD3D *thisc; // [sp+D8h] [bp+8h]@124 | |
498 char this_3; // [sp+DBh] [bp+Bh]@30 | |
499 char this_3a; // [sp+DBh] [bp+Bh]@82 | |
500 char this_3b; // [sp+DBh] [bp+Bh]@131 | |
501 | |
67 | 502 static stru154 static_sub_0048034E_stru_154; |
503 static stru154 stru_76D5A8; | |
985 | 504 //v3 = a1; |
67 | 505 v82 = a2; |
985 | 506 v83 = a3; |
507 X = abs(unk4); | |
0 | 508 v4 = 0; |
509 v88 = 0; | |
985 | 510 v84 = a1 - 1; |
1175 | 511 /* if ( a1 - 1 > 0 ) |
0 | 512 { |
513 while ( 1 ) | |
514 { | |
515 v5 = abs(X);//v5 = 13108 | |
516 v6 = abs(v83);//v6 = 13108 | |
517 --X; | |
985 | 518 //__debugbreak(); // uncoment & refactor following large if |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
519 v93 = (int)&terrain_76E5C8[(v5 << 7) + v6]; |
67 | 520 /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), |
0 | 521 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), |
522 ((a8 = v9, | |
523 pVertices = &pVerticesSR_801A10[1] + v7, | |
524 v11 = v8->vWorldPosition.x, | |
525 v101 = v10, | |
526 v12 = v11 + 6.755399441055744e15, | |
527 sX = LODWORD(v12), | |
528 v13 = v8->vWorldPosition.y + 6.755399441055744e15, | |
529 sY = LODWORD(v13), | |
530 thisd = (v10->vWorldPosition.x + v8->vWorldPosition.x) * 0.5, | |
62 | 531 v14 = WorldPosToGridCellX(floorf(thisd + 0.5f)),//maybe current camera position X |
0 | 532 v15 = v9->vWorldPosition.y + v8->vWorldPosition.y, |
533 v89 = v14, | |
534 thise = v15 * 0.5, | |
62 | 535 _this = (LightmapBuilder *)WorldPosToGridCellZ(floorf(thisd + 0.5f)),//maybe current camera position Z |
0 | 536 WorldPosToGridCellX(sX), |
537 WorldPosToGridCellZ(sY), | |
538 !byte_4D864C) | |
539 || !(pGame->uFlags & 0x80)) | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
540 && !_481EFA_clip_terrain_poly(v8, v9, v101, pVertices, 1)) )*/ |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
541 /*if ( !&terrain_76E5C8[(v5 << 7) + v6] ) |
1175 | 542 goto LABEL_162*/ |
67 | 543 v8 = &pVerticesSR_806210[v4]; |
1175 | 544 //pVertices2 = &pVerticesSR_801A10[v4 + 1]; |
545 //v102 = v8; | |
67 | 546 if (!v82) |
547 { | |
86 | 548 pVertices = &pVerticesSR_801A10[v4]; |
549 v101 = &pVerticesSR_806210[v4 + 1]; | |
67 | 550 } |
551 else | |
552 { | |
86 | 553 pVertices = &pVerticesSR_801A10[v4 + 1]; |
554 v101 = &pVerticesSR_806210[v4]; | |
555 } | |
67 | 556 sX = floorf(v8->vWorldPosition.x + 0.5f); |
557 sY = floorf(v8->vWorldPosition.z + 0.5f); | |
558 v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f)); | |
559 v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f)); | |
1175 | 560 /*WorldPosToGridCellX(sX); |
67 | 561 WorldPosToGridCellZ(sY); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
562 if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !_481EFA_clip_terrain_poly(v8, pVertices, v101, pVertices2, 1)) |
86 | 563 if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y |
564 || pVertices2->vWorldPosition.y != v101->vWorldPosition.y ) | |
1175 | 565 break;*/ |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
566 pTile = &array_77EC08[pOutdoorCamera->uNumPolygons]; |
1338 | 567 pTile->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); |
568 if ( pTile->uTileBitmapID != -1 ) | |
569 { | |
570 pTile->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(sX, sY); | |
571 pTile->field_32 = 0; | |
572 pTile->field_59 = 1; | |
573 pTile->terrain_grid_x = (char)v97; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
574 __debugbreak(); // warning C4700: uninitialized local variable 'v93' used |
1338 | 575 pTile->field_34 = *(_WORD *)(v93 + 2); |
576 pTile->terrain_grid_z = v89; | |
577 v22 = pTerrainNormalIndices[2 * (v97 + 128 * v89) + 1]; | |
86 | 578 if ( v22 < 0 || v22 > uNumTerrainNormals - 1 ) |
1338 | 579 norm = 0; |
86 | 580 else |
1338 | 581 norm = &pTerrainNormals[v22]; |
582 thisf = 20.0 - ( -(((float)pOutdoor->vSunlight.x / 65536.0) * norm->x) - | |
583 (((float)pOutdoor->vSunlight.y / 65536.0) * norm->y) - | |
584 (((float)pOutdoor->vSunlight.z / 65536.0) * norm->z)) * 20.0; | |
86 | 585 //v25 = thisf + 6.7553994e15; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
586 //v27 = pOutdoorCamera->uNumPolygons > 1999; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
587 //v26 = pOutdoorCamera->uNumPolygons - 1999 < 0; |
1338 | 588 pTile->dimming_level = floorf(thisf + 0.5f); |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
589 if ( pOutdoorCamera->uNumPolygons >= 1999 ) |
86 | 590 return; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
591 ++pOutdoorCamera->uNumPolygons; |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
592 //if ( !_481FC9_terrain(v8, pVertices, v101, v16) )//Ritor1: It's temporary |
4 | 593 //goto LABEL_126; |
96 | 594 //{ |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
595 //--pOutdoorCamera->uNumPolygons; |
96 | 596 //goto LABEL_162; |
597 //} | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
598 __debugbreak(); // warning C4700: uninitialized local variable 'v102' used |
86 | 599 memcpy(&array_50AC10[0], v102, 0x30u); |
168 | 600 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); |
86 | 601 array_50AC10[0].u = 0.0; |
602 array_50AC10[0].v = 0.0; | |
603 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); | |
168 | 604 array_50AC10[1]._rhw = 1.0 / (pVertices->vWorldViewPosition.x + 0.0000001000000011686097); |
86 | 605 array_50AC10[1].u = 0.0; |
606 array_50AC10[1].v = 1.0; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
607 __debugbreak(); // warning C4700: uninitialized local variable 'pVertices2' used |
86 | 608 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); |
168 | 609 array_50AC10[2]._rhw = 1.0 / (pVertices2->vWorldViewPosition.x + 0.0000001000000011686097); |
86 | 610 array_50AC10[2].u = 1.0; |
611 array_50AC10[2].v = 1.0; | |
612 memcpy(&array_50AC10[3], v101, sizeof(array_50AC10[3])); | |
168 | 613 array_50AC10[3]._rhw = 1.0 / (v101->vWorldViewPosition.x + 0.0000001000000011686097); |
86 | 614 array_50AC10[3].u = 1.0; |
615 array_50AC10[3].v = 0.0; | |
616 /*if ( !(byte_76D5C0 & 1) ) | |
617 { | |
618 byte_76D5C0 |= 1u; | |
619 stru154(stru_76D5A8); | |
620 atexit(loc_481199); | |
621 }*/ | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
622 v32 = (struct8 *)array_50AC10; |
86 | 623 v97 = (int)pGame->pLightmapBuilder; |
1338 | 624 pGame->pLightmapBuilder->StackLights_TerrainFace(norm, &v95, array_50AC10, 4, 1); |
625 pDecalBuilder->_49BE8A(pTile, norm, &v95, array_50AC10, 4, 1); | |
86 | 626 a5 = 4; |
627 if ( byte_4D864C && pGame->uFlags & 0x80 ) | |
628 { | |
629 thisa = pGame->pIndoorCameraD3D; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
630 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 ) |
86 | 631 goto LABEL_162; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
632 thisa->ViewTransform(array_50AC10, a5); |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
633 thisa->Project(array_50AC10, a5, 0); |
86 | 634 } |
635 this_3 = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 | |
636 || v101->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0; | |
637 v3a = (double)pOutdoorCamera->shading_dist_mist; | |
638 v108 = v3a < v102->vWorldViewPosition.x || v3a < pVertices->vWorldViewPosition.x | |
639 || v3a < v101->vWorldViewPosition.x || v3a < pVertices2->vWorldViewPosition.x; | |
640 v33 = 0; | |
641 pGame->pLightmapBuilder->std__vector_000004_size = 0; | |
642 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | |
0 | 643 { |
86 | 644 if ( this_3 ) |
645 v33 = 3; | |
646 else | |
647 v33 = v108 != 0 ? 5 : 0; | |
1338 | 648 static_sub_0048034E_stru_154.ClassifyPolygon(norm, v95); |
86 | 649 if ( pDecalBuilder->uNumDecals > 0 ) |
1338 | 650 pDecalBuilder->ApplyDecals(31 - pTile->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, *(float *)&v33, -1); |
0 | 651 } |
86 | 652 if ( stru_F8AD28.uNumLightsApplied > 0 ) |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
653 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33); |
86 | 654 v34 = a5; |
655 //v35 = byte_4D864C == 0; | |
1338 | 656 pTile->uNumVertices = a5; |
86 | 657 if ( !byte_4D864C || ~pGame->uFlags & 0x80 ) |
0 | 658 { |
86 | 659 if ( this_3 ) |
660 { | |
661 v36 = sr_424CD7(v34); | |
1338 | 662 pTile->uNumVertices = v36; |
86 | 663 OutdoorCamera::Project(v36); |
664 } | |
665 if ( v108 ) | |
666 { | |
667 v36 = sr_424EE0_MakeFanFromTriangle(v34); | |
1338 | 668 pTile->uNumVertices = v36; |
86 | 669 OutdoorCamera::Project(v36); |
670 } | |
0 | 671 } |
86 | 672 //v37 = *(int *)&v16->flags; |
1338 | 673 if ( ~pTile->flags & 1 ) |
86 | 674 { |
1338 | 675 if ( pTile->flags & 2 && pTile->uTileBitmapID == pRenderer->hd_water_tile_id ) |
86 | 676 { |
677 v80 = false; | |
265 | 678 v39 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; |
86 | 679 } |
680 else | |
681 { | |
1338 | 682 v39 = pTile->uTileBitmapID; |
86 | 683 v80 = true; |
684 } | |
685 //v79 = 0; | |
686 //v78 = pBitmaps_LOD->pHardwareTextures[v39]; | |
1338 | 687 pTile->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v39];// Ritor1: It's temporary |
688 v77 = (int)pTile; | |
86 | 689 //v76 = v16->uNumVertices; |
4 | 690 //LABEL_161: |
1338 | 691 pRenderer->DrawTerrainPolygon(pTile->uNumVertices, pTile, pBitmaps_LOD->pHardwareTextures[v39], false, v80); |
86 | 692 goto LABEL_162; |
693 } | |
0 | 694 LABEL_56: |
1338 | 695 pTile->DrawBorderTiles(); |
86 | 696 } |
0 | 697 LABEL_162: |
86 | 698 v4 = v88 + 1; |
699 if ( ++v88 >= v84 ) | |
700 return; | |
701 } | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
702 /* v40 = &array_77EC08[pOutdoorCamera->uNumPolygons]; |
86 | 703 v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); |
704 if ( v40->uTileBitmapID == -1 ) | |
705 goto LABEL_162; | |
706 v42 = pOutdoor->GetSomeOtherTileInfo(sX, sY); | |
707 BYTE1(v42) |= 0x80u; | |
708 v43 = pGame->pLightmapBuilder; | |
709 *(int *)&v40->flags = v42; | |
710 v44 = v93; | |
711 v40->field_59 = 1; | |
638 | 712 v40->terrain_grid_x = (char)v43; |
86 | 713 v40->field_34 = *(_WORD *)(v44 + 2); |
714 v45 = v89; | |
638 | 715 v40->terrain_grid_z = v89; |
86 | 716 v46 = 4 * ((char)v43 + (v45 << 7)); |
717 v85 = v46; | |
718 v47 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + v46 + 2);// v47 = pTerrainNormalIndices[v46 + 1]; | |
719 if ( v47 < 0 || v47 > (signed int)(uNumTerrainNormals - 1) ) | |
720 v48 = 0; | |
721 else | |
722 v48 = &pTerrainNormals[v47]; | |
723 v49 = v92 * v48->y; | |
724 //v99 = v48; | |
725 thisg = 20.0 - (-v49 - v91 * v48->z - v90 * v48->x) * 20.0; | |
726 v50 = thisg + 6.755399441055744e15; | |
638 | 727 v40->dimming_level = LOBYTE(v50); |
86 | 728 if ( LOBYTE(v50) < 0 ) |
638 | 729 v40->dimming_level = 0; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
730 if ( pOutdoorCamera->uNumPolygons >= 1999 ) |
0 | 731 return; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
732 ++pOutdoorCamera->uNumPolygons; |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
733 /*if ( !_481FC9_terrain(pVertices, pVertices2, v8, v40) ) // Ritor1: It's temporary |
86 | 734 //goto LABEL_77; |
735 { | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
736 --pOutdoorCamera->uNumPolygons; |
86 | 737 goto LABEL_112; |
738 }*/ | |
1175 | 739 /*memcpy(&array_50AC10[0], v102, 0x30u); |
168 | 740 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); |
86 | 741 array_50AC10[0].u = 0.0; |
742 array_50AC10[0].v = 0.0; | |
743 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); | |
168 | 744 array_50AC10[1]._rhw = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097; |
86 | 745 array_50AC10[1].u = 0.0; |
746 array_50AC10[1].v = 1.0; | |
747 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); | |
168 | 748 array_50AC10[2]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; |
86 | 749 array_50AC10[2].u = 1.0; |
750 array_50AC10[2].v = 1.0; | |
751 static stru154 static_sub_0048034E_stru_76D590; | |
752 /*static bool __init_flag2 = false; | |
753 if (!__init_flag2) | |
754 { | |
755 __init_flag2 = true; | |
756 stru154::stru154(&static_sub_0048034E_stru_76D590); | |
757 }*/ | |
758 /*if ( !(byte_76D5C0 & 2) ) | |
759 { | |
760 byte_76D5C0 |= 2; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
761 Polygon(stru_76D590); |
86 | 762 atexit(loc_48118F); |
763 }*/ | |
1175 | 764 /*v96 = pGame->pLightmapBuilder; |
86 | 765 pGame->pLightmapBuilder->StackLights_TerrainFace(v48, (float *)&a4, array_50AC10, 3, 0); |
1075 | 766 pDecalBuilder->_49BE8A(v40, v48, &a4, array_50AC10, 3, 0); |
86 | 767 uNumVertices = 3; |
768 if ( byte_4D864C && pGame->uFlags & 0x80 ) | |
769 { | |
770 thisb = pGame->pIndoorCameraD3D; | |
771 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices ) | |
772 { | |
773 //LABEL_77: | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
774 --pOutdoorCamera->uNumPolygons; |
86 | 775 goto LABEL_112; |
776 } | |
777 thisb->ViewTransform(array_50AC10, uNumVertices); | |
778 thisb->Project(array_50AC10, uNumVertices, 0); | |
779 } | |
780 this_3a = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0; | |
781 v54 = (double)pOutdoorCamera->shading_dist_mist; | |
782 v108 = v54 < v102->vWorldViewPosition.x || v54 < pVertices->vWorldViewPosition.x || v54 < pVertices2->vWorldViewPosition.x; | |
783 pVertices = 0; | |
784 v96->std__vector_000004_size = 0; | |
785 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | |
786 { | |
787 if ( this_3a ) | |
788 pVertices = (RenderVertexSoft *)3; | |
789 else | |
790 pVertices = (RenderVertexSoft *)(v108 != 0 ? 5 : 0); | |
791 //a8 = (RenderVertexSoft *)(this_3a ? 3 : v108 != 0 ? 5 : 0); | |
734 | 792 static_sub_0048034E_stru_76D590.ClassifyPolygon(v48, *(float *)&a4); |
86 | 793 if ( pDecalBuilder->uNumDecals > 0 ) |
638 | 794 pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)pVertices, -1); |
86 | 795 } |
796 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
797 v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)pVertices); | |
798 v55 = uNumVertices; | |
799 //v35 = byte_4D864C == 0; | |
800 v40->uNumVertices = uNumVertices; | |
801 if ( !byte_76D5C0 || !(pGame->uFlags & 0x80) ) | |
802 { | |
803 if ( this_3a ) | |
804 { | |
805 v56 = sr_424CD7(v55); | |
806 } | |
807 else | |
808 { | |
809 if ( !v108 ) | |
810 goto LABEL_105; | |
811 v56 = sr_424EE0_MakeFanFromTriangle(v55); | |
812 } | |
813 v40->uNumVertices = v56; | |
814 OutdoorCamera::Project(v56); | |
815 } | |
816 LABEL_105: | |
817 v57 = *(int *)&v40->flags; | |
818 if ( BYTE1(v57) & 1 ) | |
819 { | |
1338 | 820 v40->DrawBorderTiles(); |
86 | 821 } |
822 else | |
823 { | |
265 | 824 if ( v57 & 2 && v40->uTileBitmapID == pRenderer->hd_water_tile_id ) |
86 | 825 { |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
826 v81 = false; |
265 | 827 v58 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; |
86 | 828 } |
829 else | |
830 { | |
831 v58 = v40->uTileBitmapID; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
832 v81 = true; |
86 | 833 } |
186 | 834 pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81); |
86 | 835 } |
836 LABEL_112: | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
837 v59 = &array_77EC08[pOutdoorCamera->uNumPolygons]; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
838 //a8 = (RenderVertexSoft *)&array_77EC08[pOutdoorCamera->uNumPolygons]; |
86 | 839 v59->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); |
840 if ( v59->uTileBitmapID == -1 ) | |
841 goto LABEL_162; | |
842 *(int *)&v59->flags = pOutdoor->GetSomeOtherTileInfo(sX, sY); | |
843 v61 = v93; | |
844 v59->field_59 = 1; | |
845 v59->field_34 = *(_WORD *)(v61 + 2); | |
638 | 846 v59->terrain_grid_z = v89; |
847 v59->terrain_grid_x = v97; | |
86 | 848 v62 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + v85); |
849 if ( v62 > (signed int)(uNumTerrainNormals - 1) ) | |
850 v63 = 0; | |
851 else | |
852 v63 = &pTerrainNormals[v62]; | |
853 v64 = v92 * v63->y; | |
854 //v99 = v63; | |
855 thish = 20.0 - (-v64 - v91 * v63->y - v90 * v63->x) * 20.0; | |
638 | 856 v59->dimming_level = floorf(thish + 0.5f); |
857 if ( v59->dimming_level < 0 ) | |
858 v59->dimming_level = 0; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
859 if ( pOutdoorCamera->uNumPolygons >= 1999 ) |
86 | 860 return; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
861 ++pOutdoorCamera->uNumPolygons; |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
862 if ( !_481FC9_terrain(v101, v102, pVertices2, v59) ) |
86 | 863 { |
864 //LABEL_126: | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
865 --pOutdoorCamera->uNumPolygons; |
86 | 866 goto LABEL_162; |
867 } | |
868 memcpy(&array_50AC10[0], v102, 0x30u); | |
168 | 869 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); |
86 | 870 array_50AC10[0].u = 0.0; |
871 array_50AC10[0].v = 0.0; | |
872 memcpy(&array_50AC10[1], pVertices2, sizeof(array_50AC10[1])); | |
168 | 873 array_50AC10[1]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; |
86 | 874 array_50AC10[1].u = 1.0; |
875 array_50AC10[1].v = 1.0; | |
876 memcpy(&array_50AC10[2], v101, sizeof(array_50AC10[2])); | |
168 | 877 array_50AC10[2]._rhw = 1.0 / v101->vWorldViewPosition.x + 0.0000001000000011686097; |
86 | 878 array_50AC10[2].u = 1.0; |
879 array_50AC10[2].v = 0.0; | |
880 static stru154 static_sub_0048034E_stru_76D578; | |
881 /*static bool __init_flag1 = false; | |
882 if (!__init_flag1) | |
883 { | |
884 __init_flag1 = true; | |
885 stru154::stru154(&static_sub_0048034E_stru_76D578); | |
886 }*/ | |
1175 | 887 /* v96 = pGame->pLightmapBuilder; |
86 | 888 pGame->pLightmapBuilder->StackLights_TerrainFace(v63, &v87, array_50AC10, 3, 1); |
1075 | 889 pDecalBuilder->_49BE8A(v40, v63, &v87, array_50AC10, 3, 1); |
86 | 890 v100 = 3; |
891 if ( byte_4D864C && pGame->uFlags & 0x80 ) | |
892 { | |
893 thisc = pGame->pIndoorCameraD3D; | |
894 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, (unsigned int *)&v100, 0) == 1 && !v100 ) | |
895 //goto LABEL_126; | |
896 { | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
897 --pOutdoorCamera->uNumPolygons; |
86 | 898 goto LABEL_162; |
899 } | |
900 thisc->ViewTransform(array_50AC10, v100); | |
901 thisc->Project(array_50AC10, v100, 0); | |
902 } | |
903 this_3b = v102->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0 | |
904 || v101->vWorldViewPosition.x < 8.0; | |
905 v69 = (double)pOutdoorCamera->shading_dist_mist; | |
906 v108 = v69 < v102->vWorldViewPosition.x || v69 < pVertices2->vWorldViewPosition.x || v69 < v101->vWorldViewPosition.x; | |
907 v70 = 0; | |
908 v96->std__vector_000004_size = 0; | |
909 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | |
910 { | |
911 if ( this_3b ) | |
912 v70 = 3; | |
913 else | |
914 v70 = v108 != 0 ? 5 : 0; | |
734 | 915 static_sub_0048034E_stru_76D578.ClassifyPolygon(v63, v87); |
86 | 916 if ( pDecalBuilder->uNumDecals > 0 ) |
638 | 917 pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70, -1); |
86 | 918 } |
919 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
920 v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70); | |
921 v71 = v59; | |
922 v72 = v100; | |
923 //v35 = byte_4D864C == 0; | |
924 v59->uNumVertices = v100;//??? | |
925 if ( !byte_4D864C && pGame->uFlags & 0x80 ) | |
926 goto LABEL_154; | |
927 if ( this_3b ) | |
928 { | |
929 v73 = sr_424CD7(v72); | |
0 | 930 } |
931 else | |
932 { | |
933 if ( !v108 ) | |
86 | 934 { |
935 LABEL_154: | |
936 v74 = v71->flags; | |
937 if ( !(BYTE1(v74) & 1) ) | |
938 { | |
265 | 939 if ( v74 & 2 && v71->uTileBitmapID == pRenderer->hd_water_tile_id ) |
86 | 940 { |
941 v80 = false; | |
265 | 942 v75 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; |
86 | 943 } |
944 else | |
945 { | |
946 v75 = v71->uTileBitmapID; | |
947 v80 = true; | |
948 } | |
949 //v79 = 0; | |
985 | 950 v78 = pBitmaps_LOD->pHardwareTextures[v75]; |
86 | 951 v71->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v75];// Ritor1: It's temporary |
952 //v77 = (int)v71; | |
953 //v76 = v71->uNumVertices; | |
954 //goto LABEL_161; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
955 pRenderer->DrawTerrainPolygon(v71->uNumVertices, (Polygon *)v71, v78, 0, v80); |
86 | 956 goto LABEL_162; |
957 } | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
958 v38 = (Polygon *)v71; |
86 | 959 goto LABEL_56; |
960 } | |
961 v73 = sr_424EE0_MakeFanFromTriangle(v72); | |
962 } | |
963 v71->uNumVertices = v73; | |
964 OutdoorCamera::Project(v73); | |
0 | 965 goto LABEL_154; |
86 | 966 } |
1175 | 967 }*/ |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
968 |
0 | 969 |
970 //----- (0047BACF) -------------------------------------------------------- | |
971 void Render::TransformBillboardsAndSetPalettesODM() | |
972 { | |
142 | 973 //int v0; // edi@1 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
974 //char *v1; // esi@2 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
975 //unsigned int v2; // edx@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
976 //int v3; // eax@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
977 //int v4; // edi@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
978 //int v5; // eax@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
979 //__int16 v6; // di@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
980 //int v7; // eax@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
981 //int v8; // ebx@4 |
0 | 982 unsigned __int16 *v9; // eax@7 |
983 char v10; // zf@9 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
984 //DWORD v11; // eax@13 |
0 | 985 int v12; // eax@13 |
986 int v13; // eax@14 | |
987 RenderBillboardTransform_local0 billboard; // [sp+4h] [bp-60h]@1 | |
988 int v15; // [sp+54h] [bp-10h]@13 | |
142 | 989 //int v16; // [sp+58h] [bp-Ch]@1 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
990 //int v17; // [sp+5Ch] [bp-8h]@2 |
0 | 991 int v18; // [sp+60h] [bp-4h]@13 |
992 | |
993 billboard.uParentBillboardID = -1; | |
994 billboard.pTarget = pRenderer->pTargetSurface; | |
995 billboard.pTargetZ = pRenderer->pActiveZBuffer; | |
996 billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
693 | 997 billboard.uViewportX = pViewport->uViewportTL_X; |
998 billboard.uViewportY = pViewport->uViewportTL_Y; | |
999 billboard.uViewportZ = pViewport->uViewportBR_X - 1; | |
1000 billboard.uViewportW = pViewport->uViewportBR_Y; | |
0 | 1001 pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw; |
142 | 1002 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1003 for (int i = 0; i < ::uNumBillboardsToDraw; ++i) |
0 | 1004 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1005 auto pBillboard = pBillboardRenderList + i; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1006 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1007 billboard.uScreenSpaceX = pBillboard->uScreenSpaceX; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1008 billboard.uScreenSpaceY = pBillboard->uScreenSpaceY; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1009 billboard.uParentBillboardID = i; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1010 billboard._screenspace_x_scaler_packedfloat = pBillboard->_screenspace_x_scaler_packedfloat; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1011 billboard.uTintColor = pBillboard->uTintColor; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1012 billboard._screenspace_y_scaler_packedfloat = pBillboard->_screenspace_y_scaler_packedfloat; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1013 billboard.sZValue = pBillboard->sZValue; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1014 billboard.uFlags = pBillboard->field_1E; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1015 if (pBillboard->uHwSpriteID != -1) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1016 { |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1017 if (!pRenderer->pRenderD3D) __debugbreak(); // no sw rendering |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1018 //if (pRenderer->pRenderD3D) |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1019 pRenderer->TransformBillboard(&billboard, |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1020 &pSprites_LOD->pHardwareSprites[pBillboard->uHwSpriteID], |
657 | 1021 pBillboard->dimming_level, pBillboard); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1022 /*else |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1023 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1024 assert(false); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1025 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1026 auto v1 = (char *)&pBillboard->uScreenSpaceY; |
0 | 1027 if ( *(v1 - 10) & 2 ) |
1028 v9 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 0, 1); | |
1029 else | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1030 v9 = sr_GetBillboardPalette((RenderBillboard *)(v1 - 40), *((short *)v1 - 7), pBillboard->sZValue, *((short *)v1 + 1)); |
0 | 1031 v10 = (*(v1 - 9) & 1) == 0; |
1032 billboard.pPalette = v9; | |
1033 if ( !v10 ) | |
1034 billboard.pPalette = pPaletteManager->field_261600[*((short *)v1 - 7)]; | |
1035 if ( !(billboard.uFlags & 0x40) && billboard.uFlags & 0x80 ) | |
1036 { | |
323 | 1037 v12 = stru_5C6E00->Cos(i * 5 + GetTickCount()); |
0 | 1038 v15 = abs(v12); |
1039 v18 = (unsigned __int64)(15i64 * v15) >> 16; | |
1040 billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 15 - v18, 1); | |
1041 } | |
1042 v13 = *((short *)v1 - 8); | |
1043 if ( v13 >= 0 ) | |
733 | 1044 pSprites_LOD->pSpriteHeaders[v13].DrawSprite_sw(&billboard, 1); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1045 }*/ |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1046 } |
0 | 1047 } |
1048 } | |
1049 | |
1050 //----- (0047AF11) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
1051 void Render::DrawSpriteObjects_ODM() |
0 | 1052 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1053 //char *v0; // edi@2 |
430 | 1054 //ObjectDesc *v1; // ebx@4 |
0 | 1055 __int16 v2; // cx@5 |
1056 RenderBillboard *v3; // esi@10 | |
1057 SpriteFrame *v4; // eax@10 | |
430 | 1058 //SpriteFrame *v5; // ebx@10 |
0 | 1059 unsigned int v6; // eax@10 |
430 | 1060 //int v7; // ecx@10 |
1061 //int v8; // edx@10 | |
0 | 1062 int v9; // ecx@10 |
1063 unsigned __int16 v10; // ax@10 | |
430 | 1064 //int *v11; // eax@14 |
0 | 1065 int v12; // eax@22 |
1066 int v13; // ST3C_4@23 | |
1067 int v14; // eax@23 | |
1068 int v15; // ecx@23 | |
1069 int v16; // ebx@23 | |
1070 int v17; // ecx@25 | |
1071 int v18; // eax@25 | |
1072 int v19; // ST40_4@26 | |
1073 int v20; // ecx@26 | |
1074 int v21; // ST44_4@28 | |
1075 int v22; // ST3C_4@29 | |
1076 signed __int64 v23; // qtt@30 | |
1077 int v24; // ebx@30 | |
1078 int v25; // ST3C_4@30 | |
1079 int v26; // eax@31 | |
1080 char v27; // zf@31 | |
430 | 1081 //SpriteFrame *v28; // [sp+Ch] [bp-34h]@10 |
1082 //__int16 a5; // [sp+10h] [bp-30h]@10 | |
0 | 1083 int v30; // [sp+14h] [bp-2Ch]@23 |
1084 int v31; // [sp+14h] [bp-2Ch]@29 | |
1085 __int16 v32; // [sp+14h] [bp-2Ch]@30 | |
1086 int v33; // [sp+18h] [bp-28h]@23 | |
1087 int v34; // [sp+18h] [bp-28h]@26 | |
1088 int v35; // [sp+18h] [bp-28h]@30 | |
1089 int v36; // [sp+1Ch] [bp-24h]@10 | |
1090 int v37; // [sp+1Ch] [bp-24h]@23 | |
1091 int a6; // [sp+20h] [bp-20h]@10 | |
1092 int a6a; // [sp+20h] [bp-20h]@23 | |
1093 int v40; // [sp+24h] [bp-1Ch]@25 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1094 //signed int v41; // [sp+28h] [bp-18h]@1 |
0 | 1095 int v42; // [sp+2Ch] [bp-14h]@23 |
1096 int y; // [sp+30h] [bp-10h]@10 | |
1097 int x; // [sp+34h] [bp-Ch]@10 | |
1098 int z; // [sp+38h] [bp-8h]@10 | |
1099 signed __int16 v46; // [sp+3Ch] [bp-4h]@12 | |
1100 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1101 //v41 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
1102 for (int i = 0; i < uNumSpriteObjects; ++i) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
1103 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1104 auto object = &pSpriteObjects[i]; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
1105 //auto v0 = (char *)&pSpriteObjects[i].uSectorID; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
1106 //v0 = (char *)&pSpriteObjects[0].uSectorID; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1107 //do |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1108 //{ |
430 | 1109 if (!object->uObjectDescID) // item probably pciked up |
1110 continue; | |
1111 | |
1112 assert(object->uObjectDescID < pObjectList->uNumObjects); | |
1113 auto object_desc = pObjectList->pObjects + object->uObjectDescID; | |
1114 if (object_desc->NoSprite()) | |
1115 continue; | |
1116 | |
1117 //v1 = &pObjectList->pObjects[*((short *)v0 - 13)]; | |
1118 //if ( !(v1->uFlags & 1) ) | |
1119 //{ | |
1120 //v2 = *((short *)v0 - 14) | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
1121 v2 = object->uType; |
430 | 1122 if ( (v2 < 1000 || v2 >= 10000) && (v2 < 500 || v2 >= 600) || pGame->pStru6Instance->_4A81CA(object) ) |
1123 { | |
1124 //a5 = *(short *)v0; | |
1125 x = object->vPosition.x; | |
1126 y = object->vPosition.y; | |
1127 z = object->vPosition.z; | |
1128 v3 = &pBillboardRenderList[::uNumBillboardsToDraw]; | |
1129 v4 = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); | |
1130 //v5 = v4; | |
1131 //v28 = v4; | |
1132 v36 = v4->uFlags; | |
1133 a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier; | |
1134 v6 = stru_5C6E00->Atan2(object->vPosition.x - pIndoorCamera->pos.x, object->vPosition.y - pIndoorCamera->pos.y); | |
1135 //LOWORD(v7) = object->uFacing; | |
1136 //v8 = v36; | |
1137 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; | |
1138 v10 = v4->pHwSpriteIDs[v9]; | |
0 | 1139 v3->uHwSpriteID = v10; |
1140 if ( v36 & 0x20 ) | |
1141 { | |
430 | 1142 //v8 = v36; |
1143 z -= (signed int)((unsigned __int64)(v4->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; | |
0 | 1144 } |
1145 v46 = 0; | |
430 | 1146 if ( v36 & 2 ) |
0 | 1147 v46 = 2; |
430 | 1148 //v11 = (int *)(256 << v9); |
1149 if ( (256 << v9) & v36 ) | |
0 | 1150 v46 |= 4u; |
430 | 1151 if ( v36 & 0x40000 ) |
0 | 1152 v46 |= 0x40u; |
430 | 1153 if ( v36 & 0x20000 ) |
0 | 1154 LOBYTE(v46) = v46 | 0x80; |
1155 if ( a6 ) | |
1156 { | |
430 | 1157 //LOBYTE(v11) = byte_4E94D3; |
1158 pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); | |
0 | 1159 } |
1160 v12 = (x - pIndoorCamera->pos.x) << 16; | |
1161 if ( pIndoorCamera->sRotationX ) | |
1162 { | |
1163 v13 = (y - pIndoorCamera->pos.y) << 16; | |
1164 v30 = ((unsigned __int64)(v12 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) | |
1165 + ((unsigned __int64)(v13 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); | |
1166 v37 = (unsigned __int64)(v12 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
1167 a6a = (unsigned __int64)(v13 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
1168 v33 = (z - pIndoorCamera->pos.z) << 16; | |
1169 v14 = (unsigned __int64)(v30 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; | |
1170 v15 = (unsigned __int64)(v33 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; | |
1171 v16 = v15 + v14; | |
1172 v42 = v15 + v14; | |
1173 if ( v15 + v14 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 ) | |
1174 { | |
1175 v17 = a6a - v37; | |
1176 v40 = a6a - v37; | |
1177 v18 = ((unsigned __int64)(v33 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) | |
1178 - ((unsigned __int64)(v30 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); | |
1179 goto LABEL_29; | |
1180 } | |
1181 } | |
1182 else | |
1183 { | |
1184 v34 = (y - pIndoorCamera->pos.y) << 16; | |
1185 v19 = (unsigned __int64)(v12 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
1186 v20 = (unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
1187 v16 = v20 + v19; | |
1188 v42 = v20 + v19; | |
1189 if ( v20 + v19 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 ) | |
1190 { | |
430 | 1191 v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; |
1192 v17 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; | |
1193 v40 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; | |
0 | 1194 v18 = (z - pIndoorCamera->pos.z) << 16; |
1195 LABEL_29: | |
1196 v31 = v18; | |
1197 v22 = abs(v17); | |
1198 if ( abs(v16) >= v22 ) | |
1199 { | |
1200 LODWORD(v23) = 0; | |
1201 HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
1202 v24 = v23 / v42; | |
1203 v25 = v23 / v42; | |
1204 LODWORD(v23) = 0; | |
1205 HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
430 | 1206 v35 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16); |
1207 v32 = LOWORD(pViewport->uScreenCenterY) - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16); | |
1208 | |
1209 //if (::uNumBillboardsToDraw >= 500) | |
1210 // return; | |
1211 assert(::uNumBillboardsToDraw < 500); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1212 ++::uNumBillboardsToDraw; |
0 | 1213 ++uNumSpritesDrawnThisFrame; |
430 | 1214 |
1215 object->uAttributes |= 1; | |
1216 v3->uPalette = v4->uPaletteIndex; | |
1217 v3->uIndoorSectorID = object->uSectorID; | |
1218 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; | |
1219 v26 = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; | |
1220 v3->pSpriteFrame = v4; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1221 v3->_screenspace_y_scaler_packedfloat = v26; |
0 | 1222 v3->field_1E = v46; |
430 | 1223 v3->world_x = x; |
1224 v3->world_y = y; | |
1225 v3->world_z = z; | |
0 | 1226 v3->uScreenSpaceX = v35; |
1227 v3->uScreenSpaceY = v32; | |
1228 HIWORD(v26) = HIWORD(v42); | |
1229 LOWORD(v26) = 0; | |
430 | 1230 v27 = (object->uAttributes & 0x20) == 0; |
862 | 1231 v3->sZValue = v26 + (PID(OBJECT_Item,i)); |
657 | 1232 v3->dimming_level = 0; |
0 | 1233 v3->uTintColor = 0; |
1234 if ( !v27 ) | |
1235 { | |
1236 if ( !pRenderer->pRenderD3D ) | |
1237 v3->sZValue = 0; | |
1238 } | |
1239 } | |
1240 goto LABEL_34; | |
1241 } | |
1242 } | |
1243 } | |
430 | 1244 //} |
0 | 1245 LABEL_34: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1246 ; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1247 //++v41; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1248 //v0 += 112; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1249 //} |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
1250 //while ( v41 < (signed int)uNumSpriteObjects ); |
0 | 1251 } |
1252 } | |
1253 // 4E94D3: using guessed type char byte_4E94D3; | |
1254 // 5187E4: using guessed type int uNumSpritesDrawnThisFrame; | |
1255 | |
1256 //----- (0049D9BC) -------------------------------------------------------- | |
1257 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut) | |
1258 { | |
1259 size_t v4; // eax@1 | |
1260 size_t v5; // eax@1 | |
1261 IUnknown *v6; // eax@10 | |
1262 size_t v7; // eax@13 | |
1263 DDDEVICEIDENTIFIER ddDevId; // [sp+4h] [bp-4F8h]@11 | |
1264 DDSURFACEDESC2 v10;/*int v10; // [sp+42Ch] [bp-D0h]@16 | |
1265 int v11; // [sp+430h] [bp-CCh]@16 | |
1266 int v12; // [sp+434h] [bp-C8h]@16 | |
1267 int v13; // [sp+438h] [bp-C4h]@16 | |
1268 int v14; // [sp+474h] [bp-88h]@16*/ | |
1269 DDSCAPS2 ddsCaps; // [sp+4A8h] [bp-54h]@14 | |
1270 unsigned int uFreeVideoMem; // [sp+4B8h] [bp-44h]@14 | |
1271 RenderD3D_aux aux; // [sp+4BCh] [bp-40h]@19 | |
1272 IDirect3D3 *pDirect3D3; // [sp+4C4h] [bp-38h]@18 | |
1273 int v19; // [sp+4C8h] [bp-34h]@16 | |
1274 RenderD3D_D3DDevDesc v20; // [sp+4CCh] [bp-30h]@1 | |
1275 LPDIRECTDRAW pDirectDraw; // [sp+4F4h] [bp-8h]@4 | |
1276 IDirectDraw4 *pDirectDraw4; // [sp+4F8h] [bp-4h]@7 | |
1277 | |
1278 v4 = strlen(lpDriverName); | |
1279 v20.pDriverName = new char[v4 + 1]; | |
1280 v5 = strlen(lpDevDesc); | |
1281 v20.pDeviceDesc = new char[v5 + 1]; | |
1282 strcpy(v20.pDriverName, lpDriverName); | |
1283 strcpy(v20.pDeviceDesc, lpDevDesc); | |
1284 if ( lpGUID ) | |
1285 { | |
1286 v20.pGUID = new GUID; | |
1287 memcpy(v20.pGUID, lpGUID, 0x10u); | |
1288 } | |
1289 else | |
1290 { | |
1291 v20.pGUID = 0; | |
1292 } | |
1293 | |
1294 if (FAILED(DirectDrawCreate(v20.pGUID, &pDirectDraw, 0))) | |
1295 { | |
1296 delete [] v20.pDriverName; | |
1297 delete [] v20.pDeviceDesc; | |
1298 if ( v20.pGUID ) | |
1299 delete v20.pGUID; | |
1300 } | |
1301 else | |
1302 { | |
1303 if (FAILED(pDirectDraw->QueryInterface(IID_IDirectDraw4, (LPVOID *)&pDirectDraw4))) | |
1304 { | |
1305 delete [] v20.pDriverName; | |
1306 delete [] v20.pDeviceDesc; | |
1307 if ( v20.pGUID ) | |
1308 delete v20.pGUID; | |
1309 v6 = (IUnknown *)pDirectDraw; | |
1310 } | |
1311 else | |
1312 { | |
1313 pDirectDraw->Release(); | |
1314 if (FAILED( pDirectDraw4->GetDeviceIdentifier(&ddDevId, 1u))) | |
1315 { | |
1316 v20.pDDraw4DevDesc = 0; | |
1317 } | |
1318 else | |
1319 { | |
1320 v7 = strlen(ddDevId.szDescription); | |
1321 v20.pDDraw4DevDesc = new char[v7 + 1]; | |
1322 strcpy(v20.pDDraw4DevDesc, ddDevId.szDescription); | |
1323 } | |
1324 memset(&ddsCaps, 0, 0x10u); | |
1325 if (FAILED(pDirectDraw4->GetAvailableVidMem( | |
1326 &ddsCaps, | |
1327 (LPDWORD)&v20.uVideoMem, | |
1328 (LPDWORD)&uFreeVideoMem))) | |
1329 v20.uVideoMem = 0; | |
1330 memset(&v10, 0, 0x7Cu); | |
1331 v10.dwSize = 124; | |
1332 v10.dwFlags = 6; | |
1333 v10.dwHeight = 640; | |
1334 v10.dwWidth = 480; | |
1335 v10.ddpfPixelFormat.dwSize = 32; | |
1336 | |
1337 v19 = 0; | |
1338 if ( FAILED(pDirectDraw4->EnumDisplayModes( | |
1339 0, | |
1340 0, | |
1341 &v19, | |
1342 (LPDDENUMMODESCALLBACK2)DDrawDisplayModesEnumerator)) | |
1343 || !v19 | |
1344 || FAILED(pDirectDraw4->QueryInterface(IID_IDirect3D3, (LPVOID *)&pDirect3D3))) | |
1345 { | |
1346 delete [] v20.pDriverName; | |
1347 delete [] v20.pDeviceDesc; | |
1348 if ( v20.pDDraw4DevDesc ) | |
1349 free(v20.pDDraw4DevDesc); | |
1350 if ( v20.pGUID ) | |
1351 delete v20.pGUID; | |
1352 v6 = (IUnknown *)pDirectDraw4; | |
1353 } | |
1354 else | |
1355 { | |
1356 aux.pInfo = pOut; | |
1357 aux.ptr_4 = &v20; | |
1358 pDirect3D3->EnumDevices((LPD3DENUMDEVICESCALLBACK)D3DDeviceEnumerator, &aux); | |
1359 delete [] v20.pDriverName; | |
1360 delete [] v20.pDeviceDesc; | |
1361 if ( v20.pDDraw4DevDesc ) | |
1362 free(v20.pDDraw4DevDesc); | |
1363 if ( v20.pGUID ) | |
1364 delete v20.pGUID; | |
1365 pDirectDraw4->Release(); | |
1366 v6 = (IUnknown *)pDirect3D3; | |
1367 pDirectDraw4 = 0; | |
1368 } | |
1369 } | |
1370 v6->Release(); | |
1371 } | |
1372 return 1; | |
1373 } | |
1374 | |
1375 //----- (0049D784) -------------------------------------------------------- | |
1376 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, RenderD3D_aux *a6) | |
1377 { | |
1378 int v6; // eax@1 | |
1379 signed int v7; // edi@1 | |
1380 signed int v8; // edi@14 | |
1381 size_t v9; // eax@30 | |
1382 size_t v10; // eax@30 | |
1383 size_t v11; // eax@30 | |
1384 size_t v12; // eax@30 | |
1385 size_t v13; // eax@30 | |
1386 | |
1387 v6 = pHWDesc->dwFlags; | |
1388 v7 = -1; | |
1389 if ( v6 ) | |
1390 { | |
1391 if ( !a6->ptr_4->pGUID ) | |
1392 v7 = 0; | |
1393 if ( v6 && a6->ptr_4->pGUID ) | |
1394 v7 = 1; | |
1395 } | |
1396 if ( !strcmp(lpDeviceName, "RGB Emulation") && !a6->ptr_4->pGUID ) | |
1397 v7 = 2; | |
1398 if ( !strcmp(lpDeviceName, "Reference Rasterizer") && !a6->ptr_4->pGUID ) | |
1399 v7 = 3; | |
1400 if ( v7 != -1 ) | |
1401 { | |
1402 v8 = v7; | |
1403 a6->pInfo[v8].bIsDeviceCompatible = 1; | |
1404 a6->pInfo[v8].uCaps = 0; | |
1405 if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 0x10) ) | |
1406 a6->pInfo[v8].uCaps |= 2u; | |
1407 if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 2) ) | |
1408 a6->pInfo[v8].uCaps |= 4u; | |
1409 if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 1) ) | |
1410 a6->pInfo[v8].uCaps |= 8u; | |
1411 if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 0x20) ) | |
1412 a6->pInfo[v8].uCaps |= 0x10u; | |
1413 if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 2) ) | |
1414 a6->pInfo[v8].uCaps |= 0x20u; | |
1415 if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 4) ) | |
1416 a6->pInfo[v8].uCaps |= 0x40u; | |
1417 if ( !(BYTE1(pHWDesc->dwDevCaps) & 0x10) ) | |
1418 BYTE1(a6->pInfo[v8].uCaps) |= 1u; | |
1419 if ( pHWDesc->dpcTriCaps.dwTextureCaps & 0x20 ) | |
1420 LOBYTE(a6->pInfo[v8].uCaps) |= 0x80u; | |
1421 v9 = strlen(lpDeviceName); | |
1422 a6->pInfo[v8].pName = new char[v9 + 1]; | |
1423 strcpy(a6->pInfo[v8].pName, lpDeviceName); | |
1424 v10 = strlen(lpDeviceDesc); | |
1425 a6->pInfo[v8].pDescription = new char[v10 + 1]; | |
1426 strcpy(a6->pInfo[v8].pDescription, lpDeviceDesc); | |
1427 a6->pInfo[v8].pGUID = (GUID *)operator new(0x10u); | |
1428 memcpy(a6->pInfo[v8].pGUID, lpGUID, 0x10u); | |
1429 v11 = strlen(a6->ptr_4->pDriverName); | |
1430 a6->pInfo[v8].pDriverName = new char[v11 + 1]; | |
1431 strcpy(a6->pInfo[v8].pDriverName, a6->ptr_4->pDriverName); | |
1432 v12 = strlen(a6->ptr_4->pDeviceDesc); | |
1433 a6->pInfo[v8].pDeviceDesc = new char[v12 + 1]; | |
1434 strcpy(a6->pInfo[v8].pDeviceDesc, a6->ptr_4->pDeviceDesc); | |
1435 v13 = strlen(a6->ptr_4->pDDraw4DevDesc); | |
1436 a6->pInfo[v8].pDDraw4DevDesc = new char[v13 + 1]; | |
1437 strcpy(a6->pInfo[v8].pDDraw4DevDesc, a6->ptr_4->pDDraw4DevDesc); | |
1438 if ( a6->ptr_4->pGUID ) | |
1439 { | |
1440 a6->pInfo[v8].pDirectDrawGUID = new GUID; | |
1441 memcpy(a6->pInfo[v8].pDirectDrawGUID, a6->ptr_4->pGUID, 0x10u); | |
1442 } | |
1443 else | |
1444 { | |
1445 a6->pInfo[v8].pDirectDrawGUID = 0; | |
1446 } | |
1447 a6->pInfo[v8].uVideoMem = a6->ptr_4->uVideoMem; | |
1448 } | |
1449 return 1; | |
1450 } | |
1451 | |
1452 //----- (0049D75C) -------------------------------------------------------- | |
1453 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2) | |
1454 { | |
1455 HRESULT result; // eax@3 | |
1456 | |
1457 if ( pSurfaceDesc->ddsCaps.dwCaps | 0x2000 && pSurfaceDesc->ddpfPixelFormat.dwRGBBitCount == 16 ) | |
1458 { | |
1459 *a2 = 1; | |
1460 result = 0; | |
1461 } | |
1462 else | |
1463 { | |
1464 result = 1; | |
1465 } | |
1466 return result; | |
1467 } | |
1468 | |
1469 //----- (0047A95E) -------------------------------------------------------- | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1470 void Render::PrepareDecorationsRenderList_ODM() |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1471 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1472 //char *v0; // esi@2 |
639 | 1473 //DecorationDesc *v1; // ebx@6 |
0 | 1474 __int16 v2; // ax@6 |
1475 double v3; // st7@7 | |
639 | 1476 //int v4; // eax@9 |
1477 //int v5; // edx@9 | |
0 | 1478 unsigned int v6; // edi@9 |
1479 int v7; // eax@9 | |
1480 SpriteFrame *v8; // eax@9 | |
635 | 1481 //SpriteFrame *v9; // edi@9 |
0 | 1482 unsigned __int16 *v10; // eax@9 |
1483 int v11; // ecx@9 | |
1484 int v12; // eax@9 | |
1485 int v13; // ecx@9 | |
1486 int v14; // ecx@20 | |
1487 char v15; // dl@20 | |
1488 signed int v16; // eax@20 | |
1489 int v17; // eax@23 | |
1490 int v18; // ecx@24 | |
1491 int v19; // eax@24 | |
1492 int v20; // ecx@24 | |
1493 int v21; // ebx@26 | |
1494 int v22; // eax@26 | |
1495 int v23; // eax@30 | |
1496 signed __int64 v24; // qtt@31 | |
1497 int v25; // ebx@31 | |
1498 int v26; // ecx@32 | |
1499 RenderBillboard *v27; // eax@37 | |
1500 __int16 v28; // dx@37 | |
1501 __int16 v29; // cx@37 | |
1502 int v30; // ecx@37 | |
1503 int v31; // ebx@37 | |
619 | 1504 Particle_sw local_0; // [sp+Ch] [bp-98h]@7 |
639 | 1505 //int x; // [sp+74h] [bp-30h]@9 |
1506 //int y; // [sp+78h] [bp-2Ch]@9 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1507 //int v35; // [sp+7Ch] [bp-28h]@1 |
639 | 1508 //int v36; // [sp+80h] [bp-24h]@9 |
0 | 1509 unsigned __int16 *v37; // [sp+84h] [bp-20h]@9 |
1510 int v38; // [sp+88h] [bp-1Ch]@9 | |
1511 int v39; // [sp+8Ch] [bp-18h]@24 | |
1512 int v40; // [sp+90h] [bp-14h]@24 | |
1513 int v41; // [sp+94h] [bp-10h]@24 | |
1514 int v42; // [sp+98h] [bp-Ch]@9 | |
1515 int a5; // [sp+9Ch] [bp-8h]@9 | |
1516 int b; // [sp+A0h] [bp-4h]@22 | |
1517 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1518 //v35 = 0; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1519 //if ( (signed int)uNumLevelDecorations > 0 ) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1520 //{ |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1521 //v0 = (char *)&pLevelDecorations[0].vPosition.y; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1522 //do |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1523 for (int i = 0; i < uNumLevelDecorations; ++i) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1524 { |
1202 | 1525 auto decor = &pLevelDecorations[i]; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1526 auto v0 = (char *)&pLevelDecorations[i].vPosition.y; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1527 |
639 | 1528 if ( (!(decor->field_2 & 0x40) || decor->_47A825()) && !(decor->field_2 & 0x20) ) |
1529 { | |
1530 //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; | |
1531 auto decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; | |
1532 v2 = decor_desc->uFlags; | |
0 | 1533 if ( (char)v2 >= 0 ) |
1534 { | |
1535 if ( !(v2 & 0x22) ) | |
1536 { | |
639 | 1537 //v4 = decor->vPosition.x; |
1538 //v5 = decor->vPosition.z; | |
0 | 1539 v6 = pMiscTimer->uTotalGameTimeElapsed; |
639 | 1540 //y = decor->vPosition.y; |
1541 //x = decor->vPosition.x; | |
1542 //v36 = decor->vPosition.z; | |
1543 v7 = abs(decor->vPosition.x + decor->vPosition.y); | |
635 | 1544 |
1545 | |
1546 #pragma region "New: seasons change" | |
1547 extern bool change_seasons; | |
1548 if (change_seasons) | |
1549 switch (pParty->uCurrentMonth) | |
1550 { | |
1551 // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites | |
1552 case 11: case 0: case 1: // winter | |
639 | 1553 switch (decor_desc->uSpriteID) |
635 | 1554 { |
1555 //case 468: //bush02 grows on swamps, which are evergreeen actually | |
1556 case 548: // flower10 | |
1557 case 547: // flower09 | |
1558 case 541: // flower03 | |
1559 case 539: continue; // flower01 | |
1560 | |
1561 case 483: // tree01 | |
1562 case 486: // tree04 | |
1563 case 492: // tree10 | |
639 | 1564 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 2); |
1565 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7); | |
635 | 1566 break; |
1567 | |
1568 default: | |
639 | 1569 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); |
635 | 1570 } |
1571 break; | |
1572 | |
1573 case 2: case 3: case 4: // spring | |
639 | 1574 switch (decor_desc->uSpriteID) |
635 | 1575 { |
1576 } | |
639 | 1577 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); |
635 | 1578 break; |
1579 | |
1580 case 8: case 9: case 10: // autumn | |
639 | 1581 switch (decor_desc->uSpriteID) |
635 | 1582 { |
1583 //case 468: //bush02 grows on swamps, which are evergreeen actually | |
1584 case 548: // flower10 | |
1585 case 547: // flower09 | |
1586 case 541: // flower03 | |
1587 case 539: continue; // flower01 | |
1588 | |
1589 case 483: // tree01 | |
1590 case 486: // tree04 | |
1591 case 492: // tree10 | |
639 | 1592 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 1); |
1593 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7); | |
635 | 1594 break; |
1595 | |
1596 default: | |
639 | 1597 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); |
635 | 1598 } |
1599 break; | |
1600 | |
1601 case 5: case 6: case 7: // summer | |
1602 //all green by default | |
639 | 1603 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); |
635 | 1604 break; |
1605 | |
1606 default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); | |
1607 } | |
637 | 1608 else |
639 | 1609 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); |
635 | 1610 #pragma endregion |
639 | 1611 //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); |
635 | 1612 |
1613 //v9 = v8; | |
0 | 1614 v42 = v8->uFlags; |
1615 a5 = v8->uGlowRadius; | |
639 | 1616 v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pIndoorCamera->pos.x, |
1617 decor->vPosition.y - pIndoorCamera->pos.y); | |
0 | 1618 v11 = *((int *)v0 + 2); |
1619 v37 = v10; | |
1620 v12 = v42; | |
1621 v38 = 0; | |
1622 v13 = ((signed int)(stru_5C6E00->uIntegerPi | |
1623 + ((signed int)stru_5C6E00->uIntegerPi >> 3) | |
1624 + v11 | |
1625 - (signed int)v37) >> 8) & 7; | |
1626 v37 = (unsigned __int16 *)v13; | |
1627 if ( v42 & 2 ) | |
1628 v38 = 2; | |
1629 if ( (256 << v13) & v42 ) | |
1630 v38 |= 4u; | |
1631 if ( v12 & 0x40000 ) | |
1632 v38 |= 0x40u; | |
1633 if ( v12 & 0x20000 ) | |
1634 LOBYTE(v38) = v38 | 0x80; | |
1635 if ( a5 ) | |
1636 { | |
1637 if ( pRenderer->pRenderD3D && pRenderer->bUseColoredLights ) | |
1638 { | |
639 | 1639 v14 = decor_desc->uColoredLightRed; |
1640 v15 = decor_desc->uColoredLightGreen; | |
1641 v16 = decor_desc->uColoredLightBlue; | |
0 | 1642 } |
1643 else | |
1644 { | |
1645 v16 = 255; | |
1646 v14 = 255; | |
1647 v15 = 255; | |
1648 } | |
1649 b = v16; | |
1650 pStationaryLightsStack->AddLight( | |
639 | 1651 decor->vPosition.x, |
1652 decor->vPosition.y, | |
1653 decor->vPosition.z + decor_desc->uDecorationHeight / 2, | |
0 | 1654 a5, |
1655 v14, | |
1656 v15, | |
1657 v16, | |
1658 byte_4E94D0); | |
1659 } | |
639 | 1660 v17 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; |
0 | 1661 if ( pIndoorCamera->sRotationX ) |
1662 { | |
639 | 1663 v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; |
0 | 1664 v18 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) |
1665 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); | |
1666 v42 = v18; | |
1667 b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
1668 a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
639 | 1669 v40 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; |
0 | 1670 v41 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; |
1671 v19 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; | |
1672 v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); | |
1673 v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); | |
1674 if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) | |
1675 { | |
1676 v21 = a5 - b; | |
1677 v41 = a5 - b; | |
1678 a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; | |
1679 b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; | |
1680 v22 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - a5; | |
1681 LABEL_30: | |
1682 v42 = v22; | |
1683 v40 = 2 * abs(v20); | |
1684 v23 = abs(v21); | |
1685 if ( v40 >= v23 ) | |
1686 { | |
1687 LODWORD(v24) = 0; | |
1688 HIDWORD(v24) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
1689 a5 = v24 / v39; | |
1690 v25 = pViewport->uScreenCenterX | |
1691 - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16); | |
1692 b = (unsigned __int64)(a5 * (signed __int64)v42) >> 16; | |
1693 v41 = v24 / v39; | |
1694 v40 = pViewport->uScreenCenterY | |
1695 - ((signed int)(((unsigned __int64)(a5 * (signed __int64)v42) >> 16) + 32768) >> 16); | |
635 | 1696 v42 = v8->scale; |
0 | 1697 v41 = (unsigned __int64)(v42 * v24 / v39) >> 16; |
635 | 1698 v37 = (unsigned __int16 *)&v8->pHwSpriteIDs[(int)v37]; |
0 | 1699 if ( pRenderer->pRenderD3D ) |
1700 { | |
1701 v26 = v41; | |
1702 v42 = pSprites_LOD->pHardwareSprites[(signed __int16)*v37].uBufferWidth >> 1; | |
1703 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; | |
1704 } | |
1705 else | |
1706 { | |
1707 v26 = v41; | |
1708 v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1; | |
1709 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; | |
1710 } | |
693 | 1711 if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) |
0 | 1712 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1713 if (::uNumBillboardsToDraw >= 500) |
0 | 1714 return; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1715 v27 = &pBillboardRenderList[::uNumBillboardsToDraw++]; |
0 | 1716 ++uNumDecorationsDrawnThisFrame; |
1717 v27->uHwSpriteID = *v37; | |
635 | 1718 v28 = v8->uPaletteIndex; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1719 v27->_screenspace_x_scaler_packedfloat = v26; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1720 v27->_screenspace_y_scaler_packedfloat = v26; |
0 | 1721 v29 = v38; |
1722 v27->uScreenSpaceX = v25; | |
1723 HIBYTE(v29) |= 2u; | |
1724 v27->uPalette = v28; | |
1725 v27->field_1E = v29; | |
639 | 1726 v27->world_x = decor->vPosition.x; |
1727 v27->world_y = decor->vPosition.y; | |
1728 v27->world_z = decor->vPosition.z; | |
0 | 1729 v27->uScreenSpaceY = v40; |
1730 HIWORD(v30) = HIWORD(v39); | |
862 | 1731 v31 = PID(OBJECT_Decoration,i); |
0 | 1732 LOWORD(v30) = 0; |
1733 v27->uIndoorSectorID = 0; | |
1734 v27->sZValue = v30 + v31; | |
657 | 1735 v27->dimming_level = 0; |
635 | 1736 v27->pSpriteFrame = v8; |
0 | 1737 v27->uTintColor = 0; |
1738 } | |
1739 } | |
1740 goto LABEL_38; | |
1741 } | |
1742 } | |
1743 else | |
1744 { | |
639 | 1745 v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; |
1746 v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; | |
0 | 1747 b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; |
1748 a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
1749 v20 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); | |
1750 v39 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); | |
1751 if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) | |
1752 { | |
1753 a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
1754 b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
1755 v21 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; | |
1756 v41 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; | |
639 | 1757 v22 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; |
0 | 1758 goto LABEL_30; |
1759 } | |
1760 } | |
1761 } | |
1762 } | |
1763 else | |
1764 { | |
1765 memset(&local_0, 0, 0x68u); | |
1766 v3 = (double)*((signed int *)v0 - 1); | |
619 | 1767 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; |
1768 local_0.uDiffuse = 0xFF3C1E; | |
0 | 1769 local_0.x = v3; |
1770 local_0.y = (double)*(signed int *)v0; | |
1771 local_0.z = (double)*((signed int *)v0 + 1); | |
1390 | 1772 local_0.r = 0.0; |
1773 local_0.g = 0.0; | |
1774 local_0.b = 0.0; | |
0 | 1775 local_0.flt_28 = 1.0; |
1776 local_0.timeToLive = (rand() & 0x80) + 128; | |
1777 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); | |
1778 pGame->pParticleEngine->AddParticle(&local_0); | |
1779 } | |
1780 } | |
1781 LABEL_38: | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1782 ; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1783 //++v35; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1784 //v0 += 32; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1785 } |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1786 //while ( v35 < (signed int)uNumLevelDecorations ); |
0 | 1787 } |
1788 // 4E94D0: using guessed type char byte_4E94D0; | |
1789 // 5187EC: using guessed type int uNumDecorationsDrawnThisFrame; | |
1790 | |
1791 //----- (0049D717) -------------------------------------------------------- | |
1792 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst) | |
1793 { | |
1794 HRESULT v2; // esi@2 | |
1795 | |
1796 if ( Src->dwFlags & 0x400 | 0x2000 ) | |
1797 { | |
1798 v2 = 0; | |
1799 if ( Src->dwRGBBitCount == 16 && !Src->dwRBitMask ) | |
1800 goto LABEL_6; | |
1801 if ( !Dst->dwSize ) | |
1802 { | |
1803 v2 = 1; | |
1804 LABEL_6: | |
1805 memcpy(Dst, Src, 0x20u); | |
1806 return v2; | |
1807 } | |
1808 } | |
1809 return 1; | |
1810 } | |
1811 | |
1812 //----- (0049DC28) -------------------------------------------------------- | |
1813 void RenderD3D::GetAvailableDevices(RenderD3D__DevInfo **pOutDevices) | |
1814 { | |
1815 RenderD3D__DevInfo *v2; // eax@1 | |
1816 | |
1817 v2 = new RenderD3D__DevInfo[4];// 4 items | |
1818 *pOutDevices = v2; | |
1819 memset(v2, 0, 0xA0u); | |
1820 DirectDrawEnumerateA((LPDDENUMCALLBACKA)RenderD3D__DeviceEnumerator, *pOutDevices); | |
1821 } | |
1822 | |
1823 //----- (0049DC58) -------------------------------------------------------- | |
1824 RenderD3D::RenderD3D() | |
1825 { | |
1826 RenderD3D *v1; // esi@1 | |
1827 | |
1828 v1 = this; | |
1829 this->pHost = 0; | |
1830 this->pDirect3D = 0; | |
1831 this->pUnk = 0; | |
1832 this->pBackBuffer = 0; | |
1833 this->pFrontBuffer = 0; | |
1834 this->pZBuffer = 0; | |
1835 this->pDevice = 0; | |
1836 this->pViewport = 0; | |
1837 this->field_40 = 1; | |
1838 this->field_44 = 10; | |
1839 GetAvailableDevices(&this->pAvailableDevices); | |
1840 } | |
1841 | |
1842 //----- (0049DC90) -------------------------------------------------------- | |
1843 void RenderD3D::Release() | |
1844 { | |
1845 RenderD3D *v1; // esi@1 | |
1846 IDirectDraw4 *v2; // eax@2 | |
1847 signed int v3; // edi@4 | |
1848 IDirect3DViewport3 *v4; // eax@22 | |
1849 IUnknown *v5; // eax@24 | |
1850 IDirectDrawSurface4 *v6; // eax@26 | |
1851 IDirect3DDevice3 *v7; // eax@28 | |
1852 IDirect3D3 *v8; // eax@30 | |
1853 IDirectDrawSurface4 *v9; // eax@32 | |
1854 IDirectDrawSurface4 *v10; // eax@34 | |
1855 IDirectDraw4 *v11; // eax@36 | |
1856 | |
1857 v1 = this; | |
1858 if ( !this->bWindowed ) | |
1859 { | |
1860 v2 = this->pHost; | |
1861 if ( v2 ) | |
1862 { | |
1863 v2->RestoreDisplayMode(); | |
1864 v1->pHost->SetCooperativeLevel(v1->hWindow, 8u); | |
1865 v1->pHost->FlipToGDISurface(); | |
1866 } | |
1867 } | |
1868 v3 = 0; | |
1869 do | |
1870 { | |
1871 if ( v1->pAvailableDevices[v3].pDriverName ) | |
1872 { | |
1873 free(v1->pAvailableDevices[v3].pDriverName); | |
1874 v1->pAvailableDevices[v3].pDriverName = 0; | |
1875 } | |
1876 if ( v1->pAvailableDevices[v3].pDeviceDesc ) | |
1877 { | |
1878 free(v1->pAvailableDevices[v3].pDeviceDesc); | |
1879 v1->pAvailableDevices[v3].pDeviceDesc = 0; | |
1880 } | |
1881 if ( v1->pAvailableDevices[v3].pDDraw4DevDesc ) | |
1882 { | |
1883 free(v1->pAvailableDevices[v3].pDDraw4DevDesc); | |
1884 v1->pAvailableDevices[v3].pDDraw4DevDesc = 0; | |
1885 } | |
1886 if ( v1->pAvailableDevices[v3].pDirectDrawGUID ) | |
1887 { | |
1888 free(v1->pAvailableDevices[v3].pDirectDrawGUID); | |
1889 v1->pAvailableDevices[v3].pDirectDrawGUID = 0; | |
1890 } | |
1891 if ( v1->pAvailableDevices[v3].pName ) | |
1892 { | |
1893 free(v1->pAvailableDevices[v3].pName); | |
1894 v1->pAvailableDevices[v3].pName = 0; | |
1895 } | |
1896 if ( v1->pAvailableDevices[v3].pDescription ) | |
1897 { | |
1898 free(v1->pAvailableDevices[v3].pDescription); | |
1899 v1->pAvailableDevices[v3].pDescription = 0; | |
1900 } | |
1901 if ( v1->pAvailableDevices[v3].pGUID ) | |
1902 { | |
1903 free(v1->pAvailableDevices[v3].pGUID); | |
1904 v1->pAvailableDevices[v3].pGUID = 0; | |
1905 } | |
1906 ++v3; | |
1907 } | |
1908 while ( v3 < 4 ); | |
1909 if ( v1->pAvailableDevices ) | |
1910 { | |
1911 free(v1->pAvailableDevices); | |
1912 v1->pAvailableDevices = 0; | |
1913 } | |
1914 v4 = v1->pViewport; | |
1915 if ( v4 ) | |
1916 { | |
1917 v4->Release(); | |
1918 v1->pViewport = 0; | |
1919 } | |
1920 v5 = v1->pUnk; | |
1921 if ( v5 ) | |
1922 { | |
1923 v5->Release(); | |
1924 v1->pUnk = 0; | |
1925 } | |
1926 v6 = v1->pZBuffer; | |
1927 if ( v6 ) | |
1928 { | |
1929 v6->Release(); | |
1930 v1->pZBuffer = 0; | |
1931 } | |
1932 v7 = v1->pDevice; | |
1933 if ( v7 ) | |
1934 { | |
1935 v7->Release(); | |
1936 v1->pDevice = 0; | |
1937 } | |
1938 v8 = v1->pDirect3D; | |
1939 if ( v8 ) | |
1940 { | |
1941 v8->Release(); | |
1942 v1->pDirect3D = 0; | |
1943 } | |
1944 v9 = v1->pBackBuffer; | |
1945 if ( v9 ) | |
1946 { | |
1947 v9->Release(); | |
1948 v1->pBackBuffer = 0; | |
1949 } | |
1950 v10 = v1->pFrontBuffer; | |
1951 if ( v10 ) | |
1952 { | |
1953 v10->Release(); | |
1954 v1->pFrontBuffer = 0; | |
1955 } | |
1956 v11 = v1->pHost; | |
1957 if ( v11 ) | |
1958 { | |
1959 v11->Release(); | |
1960 v1->pHost = 0; | |
1961 } | |
1962 } | |
1963 | |
1964 //----- (0049DE14) -------------------------------------------------------- | |
1965 bool RenderD3D::CreateDevice(unsigned int uDeviceID, int bWindowed, HWND hWnd) | |
1966 { | |
1967 //IDirectDraw4 *v8; // eax@12 | |
1968 //IDirectDraw4 *v9; // eax@16 | |
1969 //IDirectDraw4 *v10; // eax@20 | |
1970 //IDirectDraw4 *v13; // eax@35 | |
1971 const char *v23; // [sp-4h] [bp-DCh]@9 | |
1972 const char *v24; // [sp-4h] [bp-DCh]@13 | |
1973 const char *v25; // [sp-4h] [bp-DCh]@19 | |
1974 DWORD v26; // [sp-4h] [bp-DCh]@30 | |
1975 DDSCAPS2 v27; // [sp+Ch] [bp-CCh]@37 | |
1976 DDSURFACEDESC2 ddsd2; // [sp+1Ch] [bp-BCh]@11 | |
1977 D3DVIEWPORT2 d3dvp2; // [sp+98h] [bp-40h]@28 | |
1978 IDirectDrawClipper *v30; // [sp+C4h] [bp-14h]@18 | |
1979 LPDIRECTDRAW lpDD; // [sp+C8h] [bp-10h]@1 | |
1980 | |
1981 this->bWindowed = bWindowed; | |
1982 this->hWindow = hWnd; | |
1983 | |
1984 if (FAILED(DirectDrawCreate(pAvailableDevices[uDeviceID].pDirectDrawGUID, &lpDD, 0))) | |
1985 { | |
1986 sprintf(pErrorMessage, "Init - Failed to create DirectDraw interface.\n"); | |
1987 return 0; | |
1988 } | |
1989 | |
1990 if (FAILED(lpDD->QueryInterface(IID_IDirectDraw4, (LPVOID *)&pHost))) | |
1991 { | |
1992 sprintf(pErrorMessage, "Init - Failed to create DirectDraw4 interface.\n"); | |
1993 if (lpDD) | |
1994 lpDD->Release(); | |
1995 return 0; | |
1996 } | |
1997 lpDD->Release(); | |
1998 lpDD = 0; | |
1999 | |
2000 if (bWindowed && !pAvailableDevices[uDeviceID].pDirectDrawGUID) | |
2001 { | |
2002 if (FAILED(pHost->SetCooperativeLevel(hWnd, DDSCL_MULTITHREADED | DDSCL_NORMAL))) | |
2003 { | |
2004 v23 = "Init - Failed to set cooperative level.\n"; | |
2005 sprintf(pErrorMessage, v23); | |
2006 LABEL_65: | |
2007 if (pHost) | |
2008 { | |
2009 pHost->Release(); | |
2010 pHost = 0; | |
2011 } | |
2012 return 0; | |
2013 } | |
2014 memset(&ddsd2, 0, sizeof(DDSURFACEDESC2)); | |
2015 ddsd2.dwSize = sizeof(DDSURFACEDESC2); | |
2016 ddsd2.dwFlags = DDSD_CAPS; | |
2017 ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; | |
2018 if ( !pHost->CreateSurface(&ddsd2, &pFrontBuffer, 0) ) | |
2019 { | |
2020 ddsd2.dwSize = sizeof(DDSURFACEDESC2); | |
2021 pHost->GetDisplayMode(&ddsd2); | |
2022 if ( ddsd2.ddpfPixelFormat.dwRGBBitCount != 16 ) | |
2023 { | |
2024 v24 = "Init - Desktop isn't in 16 bit mode.\n"; | |
2025 goto LABEL_14; | |
2026 } | |
2027 | |
2028 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; | |
2029 ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; | |
2030 ddsd2.dwWidth = 640; | |
2031 ddsd2.dwHeight = 480; | |
2032 if (pHost->CreateSurface(&ddsd2, &pBackBuffer, 0) ) | |
2033 { | |
2034 v24 = "Init - Failed to create back buffer.\n"; | |
2035 LABEL_14: | |
2036 sprintf(pErrorMessage, v24); | |
2037 if (pFrontBuffer) | |
2038 { | |
2039 pFrontBuffer->Release(); | |
2040 pFrontBuffer = 0; | |
2041 } | |
2042 goto LABEL_65; | |
2043 } | |
2044 if ( pHost->CreateClipper(0, &v30, 0) ) | |
2045 { | |
2046 v25 = "Init - Failed to create clipper.\n"; | |
2047 goto LABEL_45; | |
2048 } | |
2049 v30->SetHWnd(0, hWnd); | |
2050 pFrontBuffer->SetClipper(v30); | |
2051 | |
2052 v30->Release(); | |
2053 v30 = 0; | |
2054 | |
2055 pHost->QueryInterface(IID_IDirect3D3, (LPVOID *)&pDirect3D); | |
2056 | |
2057 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; | |
2058 ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; | |
2059 ddsd2.dwWidth = 640; | |
2060 ddsd2.dwHeight = 480; | |
2061 | |
2062 if ( pDirect3D->EnumZBufferFormats(*pAvailableDevices[uDeviceID].pGUID, | |
2063 (HRESULT (__stdcall *)(DDPIXELFORMAT *, void *))D3DZBufferFormatEnumerator, | |
2064 &ddsd2.ddpfPixelFormat) ) | |
2065 goto LABEL_21; | |
2066 if ( uDeviceID == 2 || uDeviceID == 3 ) | |
2067 ddsd2.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; | |
2068 | |
2069 if ( !pHost->CreateSurface(&ddsd2, &pZBuffer, 0) ) | |
2070 { | |
2071 if ( !pBackBuffer->AddAttachedSurface(pZBuffer) ) | |
2072 { | |
2073 if ( !pDirect3D->CreateDevice(*pAvailableDevices[uDeviceID].pGUID, | |
2074 pBackBuffer, | |
2075 &pDevice, | |
2076 0) ) | |
2077 { | |
2078 memset(&d3dvp2, 0, sizeof(D3DVIEWPORT2)); | |
2079 d3dvp2.dvClipWidth = 2.0; | |
2080 d3dvp2.dvClipY = 1.0; | |
2081 d3dvp2.dvClipHeight = 2.0; | |
2082 d3dvp2.dvMaxZ = 1.0; | |
2083 d3dvp2.dvMinZ = 0.0; | |
2084 goto LABEL_54; | |
2085 } | |
2086 LABEL_51: | |
2087 sprintf(pErrorMessage, "Init - Failed to create D3D device.\n"); | |
2088 if (pDirect3D) | |
2089 { | |
2090 pDirect3D->Release(); | |
2091 pDirect3D = 0; | |
2092 } | |
2093 goto LABEL_59; | |
2094 } | |
2095 LABEL_48: | |
2096 sprintf(pErrorMessage, "Init - Failed to attach z-buffer to back buffer.\n"); | |
2097 if (pZBuffer) | |
2098 { | |
2099 pZBuffer->Release(); | |
2100 pZBuffer = 0; | |
2101 } | |
2102 goto LABEL_61; | |
2103 } | |
2104 goto LABEL_44; | |
2105 } | |
2106 LABEL_36: | |
2107 v23 = "Init - Failed to create front buffer.\n"; | |
2108 sprintf(pErrorMessage, v23); | |
2109 goto LABEL_65; | |
2110 } | |
2111 if ( uDeviceID == 1 ) | |
2112 v26 = 1045; | |
2113 else | |
2114 v26 = 1041; | |
2115 if (pHost->SetCooperativeLevel(hWnd, v26) ) | |
2116 { | |
2117 v23 = "Init - Failed to set cooperative level.\n"; | |
2118 sprintf(pErrorMessage, v23); | |
2119 goto LABEL_65; | |
2120 } | |
2121 if (pHost->SetDisplayMode(640u, 480u, 16u, 0, 0) ) | |
2122 { | |
2123 v23 = "Init - Failed to set display mode.\n"; | |
2124 sprintf(pErrorMessage, v23); | |
2125 goto LABEL_65; | |
2126 } | |
2127 | |
2128 memset(&ddsd2, 0, sizeof(DDSURFACEDESC2)); | |
2129 ddsd2.dwSize = sizeof(DDSURFACEDESC2); | |
2130 ddsd2.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; | |
2131 ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; | |
2132 ddsd2.dwBackBufferCount = 1; | |
2133 if ( pHost->CreateSurface(&ddsd2, &pFrontBuffer, 0) ) | |
2134 goto LABEL_36; | |
2135 //a3a = &pBackBuffer; | |
2136 //v14 = *v34; | |
2137 memset(&v27, 0, sizeof(DDSCAPS2)); | |
2138 v27.dwCaps = DDSCAPS_BACKBUFFER; | |
2139 //v33 = (IDirect3DDevice3 **)v14->GetAttachedSurface(&v27, &pBackBuffer); | |
2140 //hWnda = &pDirect3D; | |
2141 pHost->QueryInterface(IID_IDirect3D3, (LPVOID *)&pDirect3D); | |
2142 if (FAILED(pFrontBuffer->GetAttachedSurface(&v27, &pBackBuffer))) | |
2143 { | |
2144 v25 = "Init - Failed to get D3D interface.\n"; | |
2145 goto LABEL_45; | |
2146 } | |
2147 | |
2148 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; | |
2149 ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; | |
2150 ddsd2.dwWidth = 640; | |
2151 ddsd2.dwHeight = 480; | |
2152 if ( pDirect3D->EnumZBufferFormats(*pAvailableDevices[uDeviceID].pGUID, | |
2153 (HRESULT (__stdcall *)(DDPIXELFORMAT *, void *))D3DZBufferFormatEnumerator, | |
2154 &ddsd2.ddpfPixelFormat) ) | |
2155 { | |
2156 LABEL_21: | |
2157 v25 = "Init - Failed to enumerate Z buffer formats.\n"; | |
2158 goto LABEL_45; | |
2159 } | |
2160 if ( uDeviceID == 2 || uDeviceID == 3 ) | |
2161 BYTE1(ddsd2.ddsCaps.dwCaps) |= 8u; | |
2162 //uDeviceIDa = &pZBuffer; | |
2163 if (pHost->CreateSurface(&ddsd2, &pZBuffer, 0) ) | |
2164 { | |
2165 LABEL_44: | |
2166 v25 = "Init - Failed to create z-buffer.\n"; | |
2167 LABEL_45: | |
2168 sprintf(pErrorMessage, v25); | |
2169 if (pBackBuffer) | |
2170 { | |
2171 pBackBuffer->Release(); | |
2172 pBackBuffer = 0; | |
2173 } | |
2174 LABEL_63: | |
2175 //v19 = &pFrontBuffer; | |
2176 if (pFrontBuffer) | |
2177 { | |
2178 pFrontBuffer->Release(); | |
2179 pFrontBuffer= 0; | |
2180 } | |
2181 goto LABEL_65; | |
2182 } | |
2183 if (pBackBuffer->AddAttachedSurface(pZBuffer)) | |
2184 goto LABEL_48; | |
2185 //v33 = &pDevice; | |
2186 if (pDirect3D->CreateDevice(*pAvailableDevices[uDeviceID].pGUID, | |
2187 pBackBuffer, | |
2188 &pDevice, | |
2189 0) ) | |
2190 goto LABEL_51; | |
2191 memset(&d3dvp2, 0, sizeof(D3DVIEWPORT2)); | |
2192 d3dvp2.dvClipWidth = 2.0; | |
2193 d3dvp2.dvClipY = 1.0; | |
2194 d3dvp2.dvClipHeight = 2.0; | |
2195 d3dvp2.dvMaxZ = 1.0; | |
2196 | |
2197 LABEL_54: | |
2198 d3dvp2.dwSize = sizeof(D3DVIEWPORT2); | |
2199 //v17 = *hWnda; | |
2200 d3dvp2.dwWidth = 640; | |
2201 d3dvp2.dwHeight = 480; | |
2202 d3dvp2.dvClipX = -1.0; | |
2203 //v18 = v17->lpVtbl; | |
2204 //v32 = &v4->pViewport; | |
2205 if (pDirect3D->CreateViewport(&pViewport, 0)) | |
2206 { | |
2207 sprintf(pErrorMessage, "Init - Failed to create viewport.\n"); | |
2208 if (pDevice) | |
2209 { | |
2210 pDevice->Release(); | |
2211 pDevice = 0; | |
2212 } | |
2213 if (pDirect3D) | |
2214 { | |
2215 pDirect3D->Release(); | |
2216 pDirect3D = 0; | |
2217 } | |
2218 LABEL_59: | |
2219 if (pZBuffer) | |
2220 { | |
2221 pZBuffer->Release(); | |
2222 pZBuffer = 0; | |
2223 } | |
2224 LABEL_61: | |
2225 if (pBackBuffer) | |
2226 { | |
2227 pBackBuffer->Release(); | |
2228 pBackBuffer = 0; | |
2229 } | |
2230 goto LABEL_63; | |
2231 } | |
2232 | |
2233 pDevice->AddViewport(pViewport); | |
2234 pViewport->SetViewport2(&d3dvp2); | |
2235 pDevice->SetCurrentViewport(pViewport); | |
2236 return 1; | |
2237 } | |
2238 | |
2239 //----- (0049E444) -------------------------------------------------------- | |
2240 unsigned int RenderD3D::GetDeviceCaps() | |
2241 { | |
2242 unsigned int v1; // ebx@1 | |
2243 RenderD3D *v2; // edi@1 | |
2244 IDirect3DDevice3 *v3; // eax@1 | |
2245 unsigned int result; // eax@2 | |
2246 D3DDEVICEDESC refCaps; // [sp+Ch] [bp-1F8h]@1 | |
2247 D3DDEVICEDESC halCaps; // [sp+108h] [bp-FCh]@1 | |
2248 | |
2249 v1 = 0; | |
2250 v2 = this; | |
2251 memset(&halCaps, 0, 0xFCu); | |
2252 halCaps.dwSize = 252; | |
2253 memset(&refCaps, 0, 0xFCu); | |
2254 v3 = v2->pDevice; | |
2255 refCaps.dwSize = 252; | |
2256 if ( v3->GetCaps(&halCaps, &refCaps) ) | |
2257 { | |
2258 result = 1; | |
2259 } | |
2260 else | |
2261 { | |
2262 if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 0x10) ) | |
2263 v1 = 2; | |
2264 if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 2) ) | |
2265 v1 |= 4u; | |
2266 if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 1) ) | |
2267 v1 |= 8u; | |
2268 if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 0x20) ) | |
2269 v1 |= 0x10u; | |
2270 if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 2) ) | |
2271 v1 |= 0x20u; | |
2272 if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 4) ) | |
2273 v1 |= 0x40u; | |
2274 if ( halCaps.dpcTriCaps.dwTextureCaps & 0x20 ) | |
2275 LOBYTE(v1) = v1 | 0x80; | |
2276 result = v1; | |
2277 } | |
2278 return result; | |
2279 } | |
2280 | |
2281 //----- (0049E4FC) -------------------------------------------------------- | |
2282 void RenderD3D::ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear) | |
2283 { | |
2284 uint uClearFlags = 0; | |
2285 | |
2286 if (bClearColor) | |
2287 uClearFlags |= D3DCLEAR_TARGET; | |
2288 if (bClearDepth) | |
2289 uClearFlags |= D3DCLEAR_ZBUFFER; | |
2290 | |
2291 D3DRECT rects[] = {{0, 0, 640, 480}}; | |
2292 if (uClearFlags) | |
2293 pViewport->Clear2(1, rects, uClearFlags, uClearColor, z_clear, 0); | |
2294 } | |
2295 | |
2296 //----- (0049E54D) -------------------------------------------------------- | |
2297 void RenderD3D::Present(bool bForceBlit) | |
2298 { | |
2299 RECT v5; // [sp+18h] [bp-18h]@1 | |
2300 struct tagPOINT Point; // [sp+28h] [bp-8h]@4 | |
2301 | |
2302 v5.left = 0; | |
2303 v5.top = 0; | |
2304 v5.bottom = 480; | |
2305 v5.right = 640; | |
2306 | |
2307 if (bWindowed || bForceBlit) | |
2308 { | |
2309 RECT rc; | |
2310 GetClientRect(hWindow, &rc); | |
2311 Point.y = 0; | |
2312 Point.x = 0; | |
2313 ClientToScreen(hWindow, &Point); | |
2314 OffsetRect(&rc, Point.x, Point.y); | |
2315 pFrontBuffer->Blt(&rc, pBackBuffer, &v5, DDBLT_WAIT, 0); | |
2316 } | |
2317 else | |
2318 pFrontBuffer->Flip(0, 1); | |
2319 } | |
2320 | |
2321 //----- (0049E5D4) -------------------------------------------------------- | |
2322 bool RenderD3D::CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim) | |
2323 { | |
2324 unsigned int v8; // edx@4 | |
2325 unsigned int v9; // ebx@5 | |
2326 unsigned int v10; // eax@5 | |
2327 DWORD v11; // edx@5 | |
2328 //int v12; // edx@7 | |
2329 DDSURFACEDESC2 ddsd2; // [sp+Ch] [bp-80h]@1 | |
2330 //RenderD3D *v15; // [sp+88h] [bp-4h]@1 | |
2331 | |
2332 //v15 = this; | |
2333 memset(&ddsd2, 0, 0x7Cu); | |
2334 ddsd2.dwSize = 0x7Cu; | |
2335 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; | |
2336 ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE; | |
2337 ddsd2.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE; | |
2338 ddsd2.dwHeight = uTextureHeight; | |
2339 ddsd2.dwWidth = uTextureWidth; | |
2340 if ( bMipmaps ) | |
2341 { | |
2342 if ( (signed int)uTextureHeight <= (signed int)uTextureWidth ) | |
2343 { | |
2344 v8 = GetMaxMipLevels(uTextureHeight) - GetMaxMipLevels(uMinDeviceTexDim); | |
2345 LABEL_8: | |
2346 ddsd2.dwMipMapCount = v8; | |
2347 if ( !v8 ) | |
2348 goto LABEL_12; | |
2349 goto LABEL_11; | |
2350 } | |
2351 if ( (signed int)uTextureWidth < (signed int)uMinDeviceTexDim ) | |
2352 { | |
2353 v8 = GetMaxMipLevels(uMinDeviceTexDim); | |
2354 goto LABEL_8; | |
2355 } | |
2356 v9 = GetMaxMipLevels(uTextureWidth); | |
2357 v10 = GetMaxMipLevels(uMinDeviceTexDim); | |
2358 ddsd2.dwMipMapCount = v9 - v10; | |
2359 if ( v9 == v10 ) | |
2360 { | |
2361 ddsd2.dwFlags = 0x1007u; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
2362 __debugbreak(); // warning C4700: uninitialized local variable 'v11' used |
0 | 2363 ddsd2.ddsCaps.dwCaps = v11; |
2364 goto LABEL_12; | |
2365 } | |
2366 } | |
2367 else | |
2368 { | |
2369 ddsd2.dwMipMapCount = 1; | |
2370 } | |
2371 LABEL_11: | |
2372 ddsd2.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_MIPMAPCOUNT; | |
2373 ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP; | |
2374 LABEL_12: | |
2375 ddsd2.ddpfPixelFormat.dwRGBBitCount = 16; | |
2376 ddsd2.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); | |
2377 if (bAlphaChannel) | |
2378 { | |
2379 ddsd2.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; | |
2380 ddsd2.ddpfPixelFormat.dwRBitMask = 0x7C00; | |
2381 ddsd2.ddpfPixelFormat.dwGBitMask = 0x03E0; | |
2382 ddsd2.ddpfPixelFormat.dwBBitMask = 0x001F; | |
2383 ddsd2.ddpfPixelFormat.dwRGBAlphaBitMask = 0x8000u; | |
2384 } | |
2385 else | |
2386 { | |
2387 ddsd2.ddpfPixelFormat.dwFlags = DDPF_RGB; | |
2388 ddsd2.ddpfPixelFormat.dwRBitMask = 0xF800; | |
2389 ddsd2.ddpfPixelFormat.dwGBitMask = 0x07E0; | |
2390 ddsd2.ddpfPixelFormat.dwBBitMask = 0x001F; | |
2391 ddsd2.ddpfPixelFormat.dwRGBAlphaBitMask = 0; | |
2392 } | |
2393 if (FAILED(pHost->CreateSurface(&ddsd2, pOutSurface, 0))) | |
2394 return false; | |
2395 if (FAILED((*pOutSurface)->QueryInterface(IID_IDirect3DTexture2, (void **)pOutTexture))) | |
2396 { | |
2397 (*pOutSurface)->Release(); | |
2398 *pOutSurface = 0; | |
2399 return false; | |
2400 } | |
2401 return true; | |
2402 } | |
2403 | |
2404 //----- (004A5190) -------------------------------------------------------- | |
2405 void RenderD3D::HandleLostResources() | |
2406 { | |
2407 pBitmaps_LOD->ReleaseLostHardwareTextures(); | |
2408 pBitmaps_LOD->_410423_move_textures_to_device(); | |
2409 pSprites_LOD->ReleaseLostHardwareSprites(); | |
2410 } | |
2411 | |
2412 //----- (004A2050) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
2413 void Render::DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture) |
0 | 2414 { |
2415 Render *v5; // edi@1 | |
2416 unsigned int v6; // ebx@1 | |
2417 LightmapBuilder *v7; // esi@3 | |
2418 int v8; // eax@7 | |
2419 ODMFace *v9; // eax@12 | |
2420 char *v10; // esi@12 | |
2421 double v11; // st7@14 | |
2422 double v12; // st7@14 | |
2423 int v13; // eax@14 | |
2424 ODMFace *v14; // ecx@14 | |
2425 double v15; // st7@14 | |
2426 float v16; // ST48_4@15 | |
2427 int v17; // eax@15 | |
2428 char v18; // zf@17 | |
2429 HRESULT v19; // eax@18 | |
2430 HRESULT v20; // eax@18 | |
2431 HRESULT v21; // eax@20 | |
2432 HRESULT v22; // eax@20 | |
2433 unsigned int v23; // ecx@20 | |
2434 char *v24; // eax@21 | |
2435 HRESULT v25; // eax@23 | |
2436 HRESULT v26; // eax@23 | |
2437 HRESULT v27; // eax@24 | |
2438 HRESULT v28; // eax@25 | |
2439 HRESULT v29; // eax@25 | |
2440 HRESULT v30; // eax@25 | |
2441 HRESULT v31; // eax@25 | |
2442 HRESULT v32; // eax@26 | |
2443 unsigned int v33; // ecx@26 | |
2444 char *v34; // eax@27 | |
2445 int v35; // edx@28 | |
2446 HRESULT v36; // eax@29 | |
2447 HRESULT v37; // eax@29 | |
2448 HRESULT v38; // eax@29 | |
2449 HRESULT v39; // eax@29 | |
2450 //IDirect3DDevice3Vtbl *v40; // ebx@29 | |
2451 unsigned int v41; // eax@29 | |
2452 HRESULT v42; // eax@30 | |
2453 HRESULT v43; // eax@30 | |
2454 HRESULT v44; // eax@30 | |
2455 char *v45; // esi@34 | |
2456 int v46; // ecx@35 | |
2457 double v47; // st6@35 | |
2458 int v48; // eax@36 | |
2459 const char *v49; // [sp+4Ch] [bp-1Ch]@0 | |
2460 const char *v50; // [sp+4Ch] [bp-1Ch]@20 | |
2461 int v51; // [sp+50h] [bp-18h]@0 | |
2462 unsigned int v52; // [sp+54h] [bp-14h]@0 | |
2463 LightmapBuilder *v53; // [sp+58h] [bp-10h]@3 | |
2464 unsigned int v54; // [sp+5Ch] [bp-Ch]@3 | |
2465 unsigned int v55; // [sp+5Ch] [bp-Ch]@34 | |
2466 unsigned int v56; // [sp+60h] [bp-8h]@12 | |
2467 int v57; // [sp+60h] [bp-8h]@34 | |
638 | 2468 unsigned int a2; // [sp+64h] [bp-4h]@4 |
0 | 2469 |
2470 v5 = this; | |
2471 v6 = 0; | |
2472 if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 ) | |
2473 { | |
2474 v7 = pGame->pLightmapBuilder; | |
2475 v53 = v7; | |
2476 v54 = v7->std__vector_000004_size; | |
2477 if ( v7->std__vector_000004_size) | |
638 | 2478 a2 = 0xFFFFFFFF; |
2479 pGame->AlterGamma_ODM(a4, &a2); | |
1394 | 2480 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) |
0 | 2481 { |
638 | 2482 v8 = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); |
1394 | 2483 v7->DrawLightmaps(/*v8, 0*/); |
0 | 2484 } |
2485 else | |
2486 { | |
2487 if ( !v54 || byte_4D864C && pGame->uFlags & 2 ) | |
2488 { | |
323 | 2489 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 2490 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
2491 if (bUsingSpecular) | |
2492 { | |
186 | 2493 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
2494 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
2495 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 2496 } |
1073 | 2497 for (uint i = 0; i < uNumVertices; ++i) |
2498 { | |
2499 | |
2500 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
2501 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
2502 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); | |
2503 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
2504 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
2505 pGame->AlterGamma_ODM(a4, &d3d_vertex_buffer[i].diffuse); | |
2506 | |
2507 if ( this->bUsingSpecular ) | |
0 | 2508 { |
1073 | 2509 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 2510 } |
1073 | 2511 else |
2512 { | |
2513 d3d_vertex_buffer[i].specular = 0; | |
2514 } | |
2515 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
2516 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
2517 | |
2518 } | |
323 | 2519 |
2520 if (a4->uAttributes & FACE_OUTLINED) | |
2521 { | |
2522 int color; | |
2523 if (GetTickCount() % 300 >= 150) | |
2524 color = 0xFFFF2020; | |
2525 else color = 0xFF901010; | |
2526 | |
2527 for (uint i = 0; i < uNumVertices; ++i) | |
2528 d3d_vertex_buffer[i].diffuse = color; | |
2529 } | |
2530 | |
0 | 2531 pRenderD3D->pDevice->SetTexture(0, pTexture); |
2532 pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
2533 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2534 d3d_vertex_buffer, |
0 | 2535 uNumVertices, |
2536 D3DDP_DONOTLIGHT); | |
2537 } | |
2538 else | |
2539 { | |
1073 | 2540 for (uint i = 0; i < uNumVertices; ++i) |
2541 { | |
2542 | |
2543 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
2544 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
2545 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); | |
2546 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
2547 d3d_vertex_buffer[i].diffuse = GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
2548 if ( this->bUsingSpecular ) | |
0 | 2549 { |
1073 | 2550 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 2551 } |
1073 | 2552 else |
2553 { | |
2554 d3d_vertex_buffer[i].specular = 0; | |
2555 } | |
2556 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
2557 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
2558 | |
2559 } | |
2560 | |
186 | 2561 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
2562 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
0 | 2563 if (bUsingSpecular) |
186 | 2564 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
0 | 2565 |
2566 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | |
2567 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
2568 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2569 d3d_vertex_buffer, |
0 | 2570 uNumVertices, |
2571 D3DDP_DONOTLIGHT)); | |
2572 //v50 = (const char *)v5->pRenderD3D->pDevice; | |
2573 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
2574 //(*(void (**)(void))(*(int *)v50 + 88))(); | |
1394 | 2575 v53->DrawLightmaps(/*-1, 0*/); |
1073 | 2576 for (uint i = 0; i < uNumVertices; ++i) |
2577 { | |
2578 d3d_vertex_buffer[i].diffuse = a2; | |
2579 } | |
0 | 2580 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); |
186 | 2581 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 2582 if ( !pRenderer->bUsingSpecular ) |
186 | 2583 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
2584 | |
2585 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
2586 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
2587 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
0 | 2588 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
2589 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2590 d3d_vertex_buffer, |
0 | 2591 uNumVertices, |
2592 D3DDP_DONOTLIGHT)); | |
2593 if (bUsingSpecular) | |
2594 { | |
186 | 2595 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
0 | 2596 |
1073 | 2597 for (uint i = 0; i < uNumVertices; ++i) |
2598 { | |
2599 d3d_vertex_buffer[i].diffuse = pRenderer->uFogColor | d3d_vertex_buffer[i].specular & 0xFF000000; | |
2600 d3d_vertex_buffer[i].specular = 0; | |
2601 } | |
2602 | |
0 | 2603 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
186 | 2604 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
2605 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); | |
0 | 2606 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
2607 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2608 d3d_vertex_buffer, |
0 | 2609 uNumVertices, |
2610 D3DDP_DONOTLIGHT)); | |
186 | 2611 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 2612 //v40 = pRenderer->pRenderD3D->pDevice->lpVtbl; |
2613 v41 = GetLevelFogColor(); | |
2614 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF); | |
2615 v6 = 0; | |
2616 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); | |
2617 } | |
186 | 2618 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
2619 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 2620 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v6)); |
2621 } | |
2622 } | |
2623 } | |
2624 } | |
2625 // 4D864C: using guessed type char byte_4D864C; | |
2626 | |
2627 //----- (0049EB79) -------------------------------------------------------- | |
2628 Render::~Render() | |
2629 { | |
2630 Render *v1; // esi@1 | |
2631 | |
2632 v1 = this; | |
2633 pAllocator->FreeChunk(this->pDefaultZBuffer); | |
2634 v1->pD3DBitmaps.Release(); | |
2635 v1->pD3DSprites.Release(); | |
2636 Release(); | |
2637 v1->bWindowMode = 1; | |
2638 //nullsub_1(); | |
2639 //nullsub_1(); | |
2640 } | |
2641 | |
2642 //----- (0049E756) -------------------------------------------------------- | |
2643 bool Render::IsColorKeySupported(IDirectDraw4 *this_) | |
2644 { | |
2645 DDCAPS refCaps; // [sp+0h] [bp-2F8h]@1 | |
2646 DDCAPS halCaps; // [sp+17Ch] [bp-17Ch]@1 | |
2647 | |
2648 halCaps.dwSize = 380; | |
2649 refCaps.dwSize = 380; | |
2650 this_->GetCaps(&halCaps, &refCaps); | |
2651 return halCaps.dwSVBCaps & 0x40 && BYTE1(halCaps.dwSVBCKeyCaps) & 2; | |
2652 } | |
2653 | |
2654 //----- (0049E992) -------------------------------------------------------- | |
2655 Render::Render() | |
2656 { | |
2657 Render *v1; // esi@1 | |
2658 int v2; // eax@1 | |
2659 char v3; // zf@1 | |
2660 | |
2661 v1 = this; | |
2662 this->pDirectDraw4 = 0; | |
2663 this->pFrontBuffer4 = 0; | |
2664 this->pBackBuffer4 = 0; | |
2665 this->pColorKeySurface4 = 0; | |
2666 this->pDirectDraw2 = 0; | |
2667 this->pFrontBuffer2 = 0; | |
2668 this->pBackBuffer2 = 0; | |
2669 this->pSomeSurface2 = 0; | |
2670 //RenderHWLContainer::RenderHWLContainer(&this->pD3DBitmaps); | |
2671 //RenderHWLContainer::RenderHWLContainer(&v1->pD3DSprites); | |
2672 v1->bWindowMode = 1; | |
2673 v1->field_40054 = 0; | |
2674 v1->field_10 = 640; | |
2675 v1->field_14 = 480; | |
2676 v1->field_40030 = 0; | |
2677 v1->field_4002C = 0; | |
2678 v1->pActiveZBuffer = 0; | |
2679 v1->pDefaultZBuffer = 0; | |
709 | 2680 v1->raster_clip_y = 0; |
2681 v1->raster_clip_x = 0; | |
2682 v1->raster_clip_z = 639; | |
2683 v1->raster_clip_w = 479; | |
0 | 2684 v1->field_4003C = (int)&unk_4EED80; |
2685 v1->field_40040 = dword_4EED78; | |
2686 v1->uClipZ = 640; | |
2687 v1->field_40044 = 2; | |
2688 v1->field_40048 = 6; | |
2689 v1->pFrontBuffer4 = 0; | |
2690 v1->pBackBuffer4 = 0; | |
2691 v1->pColorKeySurface4 = 0; | |
2692 v1->pDirectDraw4 = 0; | |
2693 v1->pRenderD3D = 0; | |
2694 v1->uNumSceneBegins = 0; | |
2695 v1->uNumD3DSceneBegins = 0; | |
2696 v1->field_40110 = 0; | |
2697 v1->pTargetSurface = 0; | |
2698 v1->uTargetSurfacePitch = 0; | |
2699 v1->uClipY = 0; | |
2700 v1->uClipX = 0; | |
2701 v1->uClipW = 480; | |
2702 v1->bClip = 1; | |
2703 v1->bColorKeySupported = 0; | |
2704 v1->bRequiredTextureStagesAvailable = 0; | |
2705 v1->bTinting = 1; | |
2706 LOBYTE(v1->field_103668) = 0; | |
2707 v1->field_1036B8 = 0; | |
2708 v1->_gpu_memory_used = 0; | |
2709 uNumBillboardsToDraw = 0; | |
2710 bFogEnabled = false; | |
265 | 2711 |
2712 hd_water_tile_id = -1; | |
2713 hd_water_current_frame = 0; | |
0 | 2714 } |
2715 | |
781 | 2716 bool Render::Initialize(bool bWindowed, uint uDefaultDevice, bool bColoredLights, uint uDetailLevel, uint bTinting) |
0 | 2717 { |
2718 bUserDirect3D = true;//ReadWindowsRegistryInt("Use D3D", 0); | |
2719 bStartInWindow = bWindowed; | |
2720 | |
2721 uDesiredDirect3DDevice = uDefaultDevice;//ReadWindowsRegistryInt("D3D Device", 1); | |
2722 | |
2723 bUseColoredLights = bColoredLights;//ReadWindowsRegistryInt("Colored Lights", 0); | |
2724 uLevelOfDetail = uDetailLevel;//ReadWindowsRegistryInt("Detail Level", 1); | |
2725 | |
2726 this->bTinting = bTinting; | |
2727 | |
2728 auto r1 = pD3DBitmaps.Load(L"data\\d3dbitmap.hwl"); | |
2729 auto r2 = pD3DSprites.Load(L"data\\d3dsprite.hwl"); | |
2730 | |
2731 return r1 && r2; | |
2732 } | |
2733 | |
2734 //----- (0049EBF1) -------------------------------------------------------- | |
2735 void Render::_49EBF1() | |
2736 { | |
2737 signed int uNumRedBits; // edx@1 | |
2738 signed int uNuGreenBits; // edi@1 | |
2739 signed int uNumBlueBits; // esi@1 | |
2740 unsigned int v4; // edx@4 | |
2741 unsigned int v5; // edi@4 | |
2742 int v6; // ebx@4 | |
2743 int v7; // edx@4 | |
2744 signed int v8; // [sp+8h] [bp-24h]@1 | |
2745 signed int v9; // [sp+Ch] [bp-20h]@1 | |
2746 signed int v10; // [sp+20h] [bp-Ch]@1 | |
2747 signed int i; // [sp+24h] [bp-8h]@2 | |
2748 signed int v12; // [sp+28h] [bp-4h]@3 | |
2749 | |
2750 v10 = 0; | |
2751 uNumRedBits = 1 << this->uTargetRBits; | |
2752 uNuGreenBits = 1 << this->uTargetGBits; | |
2753 uNumBlueBits = 1 << this->uTargetBBits; | |
2754 v9 = 1 << this->uTargetRBits; | |
2755 v8 = 1 << this->uTargetGBits; | |
2756 if ( uNumRedBits > 0 ) | |
2757 { | |
2758 do | |
2759 { | |
2760 for ( i = 0; i < uNuGreenBits; ++i ) | |
2761 { | |
2762 v12 = 0; | |
2763 if ( uNumBlueBits > 0 ) | |
2764 { | |
2765 do | |
2766 { | |
2767 v4 = this->uTargetBBits; | |
2768 v5 = v4 + this->uTargetGBits; | |
2769 v6 = (v12 >> 1) + (v10 >> 1 << v5) + (i >> 1 << this->uTargetBBits); | |
2770 v7 = (v10 << v5) + v12++ + (i << v4); | |
2771 this->field_2C[v7] = v6; | |
2772 } | |
2773 while ( v12 < uNumBlueBits ); | |
2774 uNumRedBits = v9; | |
2775 uNuGreenBits = v8; | |
2776 } | |
2777 } | |
2778 ++v10; | |
2779 } | |
2780 while ( v10 < uNumRedBits ); | |
2781 } | |
2782 } | |
2783 | |
2784 //----- (0049ECC4) -------------------------------------------------------- | |
2785 void Render::ClearBlack() | |
2786 { | |
2787 if (pRenderD3D) | |
2788 { | |
2789 if (field_40110) | |
2790 pRenderD3D->ClearTarget(true, 0, false, 0.0); | |
2791 } | |
2792 else | |
2793 memset(pRenderer->pTargetSurface, 0, 4 * (field_10 * field_14 / 2)); | |
2794 } | |
2795 | |
2796 //----- (0049ED18) -------------------------------------------------------- | |
2797 void Render::PresentBlackScreen() | |
2798 { | |
2799 LONG w; // edx@3 | |
2800 IDirectDrawSurface *v2; // eax@3 | |
2801 DDBLTFX v3; // [sp+4h] [bp-74h]@5 | |
2802 RECT x; // [sp+68h] [bp-10h]@3 | |
2803 | |
2804 memset(&v3, 0, sizeof(DDBLTFX)); | |
2805 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || | |
2806 pVersion->pVersionInfo.dwMajorVersion >= 5) | |
2807 { | |
2808 x.left = uWindowX; | |
2809 x.right = uWindowX + uWindowHeight; | |
2810 x.top = uWindowY; | |
2811 w = uWindowY + uWindowWidth; | |
2812 v2 = (IDirectDrawSurface *)this->pBackBuffer4; | |
2813 } | |
2814 else | |
2815 { | |
2816 x.left = uWindowX; | |
2817 x.right = uWindowX + uWindowHeight; | |
2818 x.top = uWindowY; | |
2819 w = uWindowY + uWindowWidth; | |
2820 v2 = (IDirectDrawSurface *)this->pBackBuffer2; | |
2821 } | |
2822 x.bottom = w; | |
2823 v3.dwFillColor = 0; | |
2824 v3.dwSize = 100; | |
2825 v2->Blt(&x, 0, 0, DDBLT_COLORFILL, &v3); | |
2826 pRenderer->Present(); | |
2827 } | |
2828 | |
2829 //----- (0049EDB6) -------------------------------------------------------- | |
2830 void Render::SavePCXScreenshot() | |
2831 { | |
2832 Render *v1; // esi@1 | |
2833 __int16 v2; // di@1 | |
2834 int v3; // eax@4 | |
2835 int v4; // ecx@4 | |
2836 int v5; // eax@8 | |
2837 FILE *v6; // edi@10 | |
2838 int v7; // ecx@11 | |
2839 int v8; // eax@11 | |
2840 int v9; // eax@13 | |
2841 int v10; // ecx@15 | |
2842 unsigned __int8 v11; // dl@15 | |
2843 signed int v12; // eax@18 | |
2844 char v13; // zf@27 | |
2845 HRESULT v14; // eax@29 | |
2846 char v15[56]; // [sp+Ch] [bp-158h]@10 | |
2847 __int16 v16; // [sp+44h] [bp-120h]@10 | |
2848 DDSURFACEDESC2 Dst; // [sp+48h] [bp-11Ch]@7 | |
2849 char color_map[48]; // [sp+C4h] [bp-A0h]@10 | |
2850 char Filename[40]; // [sp+F4h] [bp-70h]@3 | |
2851 char *v20; // [sp+11Ch] [bp-48h]@14 | |
2852 char *v21; // [sp+120h] [bp-44h]@14 | |
2853 int v24; // [sp+124h] [bp-40h]@11 | |
2854 FILE *File; // [sp+128h] [bp-3Ch]@3 | |
2855 int var38; // [sp+12Ch] [bp-38h]@4 | |
2856 PCXHeader_1 header1; // [sp+130h] [bp-34h]@10 | |
2857 PCXHeader_2 header2; // [sp+140h] [bp-24h]@10 | |
2858 void *ptr; // [sp+148h] [bp-1Ch]@10 | |
2859 void *v28; // [sp+14Ch] [bp-18h]@8 | |
2860 int v29; // [sp+150h] [bp-14h]@4 | |
2861 int v30; // [sp+154h] [bp-10h]@4 | |
2862 char v31; // [sp+15Ah] [bp-Ah]@25 | |
2863 unsigned __int8 v32; // [sp+15Bh] [bp-9h]@17 | |
2864 int i; // [sp+15Ch] [bp-8h]@10 | |
2865 unsigned __int8 v34; // [sp+163h] [bp-1h]@17 | |
2866 | |
2867 v1 = this; | |
2868 v2 = 0; | |
2869 if ( !this->pRenderD3D || this->field_40110 ) | |
2870 { | |
2871 sprintf(Filename, "screen%0.2i.pcx", dword_4EFA80++ % 100); | |
2872 File = fopen(Filename, "wb"); | |
2873 if ( File ) | |
2874 { | |
2875 v3 = v1->field_10; | |
2876 v4 = v1->field_14; | |
2877 var38 = v3; | |
2878 v29 = v4; | |
2879 v30 = v3; | |
2880 if ( v3 & 1 ) | |
2881 v30 = v3 + 1; | |
2882 if ( v1->pRenderD3D ) | |
2883 { | |
2884 memset(&Dst, 0, 0x7Cu); | |
2885 Dst.dwSize = 124; | |
168 | 2886 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 2887 return; |
2888 v28 = Dst.lpSurface; | |
2889 v5 = Dst.lPitch >> 1; | |
2890 v2 = 0; | |
2891 } | |
2892 else | |
2893 { | |
2894 pRenderer->BeginScene(); | |
2895 v28 = pRenderer->pTargetSurface; | |
2896 v5 = pRenderer->uTargetSurfacePitch; | |
2897 } | |
2898 i = v5; | |
2899 header1.right = var38 - 1; | |
2900 header1.left = v2; | |
2901 header1.bottom = v29 - 1; | |
2902 header1.up = v2; | |
2903 header2.pitch = v30; | |
2904 memset(color_map, 0, sizeof(color_map)); | |
2905 memset(v15, 0, sizeof(v15)); | |
2906 header2.reserved = 0; | |
2907 header1.manufacturer = 10; | |
2908 v16 = 0; | |
2909 v6 = File; | |
2910 header1.version = 5; | |
2911 header1.encoding = 1; | |
2912 header1.bpp = 8; | |
2913 header1.hdpi = 75; | |
2914 header1.vdpi = 75; | |
2915 header2.planes = 3; | |
2916 header2.palette_info = 1; | |
2917 fwrite(&header1, 1u, 1u, File); | |
2918 fwrite(&header1.version, 1u, 1u, v6); | |
2919 fwrite(&header1.encoding, 1u, 1u, v6); | |
2920 fwrite(&header1.bpp, 1u, 1u, v6); | |
2921 fwrite(&header1.left, 2u, 1u, v6); | |
2922 fwrite(&header1.up, 2u, 1u, v6); | |
2923 fwrite(&header1.right, 2u, 1u, v6); | |
2924 fwrite(&header1.bottom, 2u, 1u, v6); | |
2925 fwrite(&header1.hdpi, 2u, 1u, v6); | |
2926 fwrite(&header1.vdpi, 2u, 1u, v6); | |
2927 fwrite(color_map, 0x30u, 1u, v6); | |
2928 fwrite(&header2, 1u, 1u, v6); | |
2929 fwrite(&header2.planes, 1u, 1u, v6); | |
2930 fwrite(&header2.pitch, 2u, 1u, v6); | |
2931 fwrite(&header2.palette_info, 2u, 1u, v6); | |
2932 fwrite(v15, 0x3Au, 1u, v6); | |
2933 ptr = pAllocator->AllocNamedChunk(0, 3 * var38 + 6, 0); | |
2934 if ( v29 > 0 ) | |
2935 { | |
2936 v7 = v30; | |
2937 File = (FILE *)v29; | |
2938 v29 = 3 * v30; | |
2939 v24 = 2 * i; | |
2940 v8 = (int)v28; | |
2941 while ( 1 ) | |
2942 { | |
2943 i = v8; | |
2944 v9 = 0; | |
2945 if ( var38 > 0 ) | |
2946 { | |
2947 v21 = (char *)ptr + v7; | |
2948 v20 = (char *)ptr + 2 * v30; | |
2949 do | |
2950 { | |
2951 *((char *)ptr + v9) = (signed int)(v1->uTargetRMask & *(short *)i) >> (LOBYTE(v1->uTargetGBits) | |
2952 + LOBYTE(v1->uTargetBBits) | |
2953 + v1->uTargetRBits | |
2954 - 8); | |
2955 v21[v9] = (signed int)(v1->uTargetGMask & *(short *)i) >> (LOBYTE(v1->uTargetBBits) | |
2956 + LOBYTE(v1->uTargetGBits) | |
2957 - 8); | |
2958 v10 = i; | |
2959 v11 = LOBYTE(v1->uTargetBMask); | |
2960 i += 2; | |
2961 v20[v9++] = (*(char *)v10 & v11) << (8 - LOBYTE(v1->uTargetBBits)); | |
2962 } | |
2963 while ( v9 < var38 ); | |
2964 } | |
2965 for ( i = 0; i < v29; i += v34 ) | |
2966 { | |
2967 v34 = 1; | |
2968 v32 = *((char *)ptr + i); | |
2969 do | |
2970 { | |
2971 v12 = i + v34; | |
2972 if ( *((char *)ptr + v12) != v32 ) | |
2973 break; | |
2974 if ( !(v12 % v30) ) | |
2975 break; | |
2976 ++v34; | |
2977 } | |
2978 while ( v34 < 0x3Fu ); | |
2979 if ( i + v34 > v29 ) | |
2980 v34 = 3 * v30 - i; | |
2981 if ( v34 > 1u || v32 >= 0xC0u ) | |
2982 { | |
2983 v31 = v34 | 0xC0; | |
2984 fwrite(&v31, 1u, 1u, v6); | |
2985 } | |
2986 fwrite(&v32, 1u, 1u, v6); | |
2987 } | |
2988 v8 = (int)((char *)v28 + v24); | |
2989 v13 = File == (FILE *)1; | |
2990 File = (FILE *)((char *)File - 1); | |
2991 v28 = (char *)v28 + v24; | |
2992 if ( v13 ) | |
2993 break; | |
2994 v7 = v30; | |
2995 } | |
2996 } | |
2997 if ( v1->pRenderD3D ) | |
2998 { | |
2999 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
3000 } | |
3001 else | |
3002 { | |
3003 pRenderer->EndScene(); | |
3004 } | |
3005 | |
3006 pAllocator->FreeChunk(ptr); | |
3007 fclose(v6); | |
3008 } | |
3009 } | |
3010 } | |
3011 // 4EFA80: using guessed type int dword_4EFA80; | |
3012 | |
3013 //----- (0049F1BC) -------------------------------------------------------- | |
3014 void Render::_49F1BC(const char *a1) | |
3015 { | |
3016 Render *v2; // esi@1 | |
3017 __int16 v3; // di@1 | |
3018 int v4; // eax@4 | |
3019 char *v5; // ecx@4 | |
3020 unsigned int v6; // eax@8 | |
3021 FILE *v7; // edi@10 | |
3022 int v8; // ecx@11 | |
3023 int v9; // eax@11 | |
3024 int v10; // eax@13 | |
3025 const char *v11; // ecx@15 | |
3026 unsigned __int8 v12; // dl@15 | |
3027 signed int v13; // eax@18 | |
3028 char v14; // zf@27 | |
3029 HRESULT v15; // eax@29 | |
3030 char v16; // [sp+Ch] [bp-12Ch]@10 | |
3031 __int16 v17; // [sp+44h] [bp-F4h]@10 | |
3032 int Dst; // [sp+48h] [bp-F0h]@7 | |
3033 int v19; // [sp+58h] [bp-E0h]@8 | |
3034 unsigned __int16 *v20; // [sp+6Ch] [bp-CCh]@8 | |
3035 char v21; // [sp+C4h] [bp-74h]@10 | |
3036 unsigned int v22; // [sp+F4h] [bp-44h]@11 | |
3037 char *v23; // [sp+F8h] [bp-40h]@14 | |
3038 int v24; // [sp+FCh] [bp-3Ch]@11 | |
3039 int v25; // [sp+100h] [bp-38h]@4 | |
3040 FILE *File; // [sp+104h] [bp-34h]@3 | |
3041 char Str; // [sp+108h] [bp-30h]@10 | |
3042 char v28; // [sp+109h] [bp-2Fh]@10 | |
3043 char v29; // [sp+10Ah] [bp-2Eh]@10 | |
3044 char v30; // [sp+10Bh] [bp-2Dh]@10 | |
3045 __int16 v31; // [sp+10Ch] [bp-2Ch]@10 | |
3046 __int16 v32; // [sp+10Eh] [bp-2Ah]@10 | |
3047 __int16 v33; // [sp+110h] [bp-28h]@10 | |
3048 __int16 v34; // [sp+112h] [bp-26h]@10 | |
3049 __int16 v35; // [sp+114h] [bp-24h]@10 | |
3050 __int16 v36; // [sp+116h] [bp-22h]@10 | |
3051 char v37; // [sp+118h] [bp-20h]@10 | |
3052 char v38; // [sp+119h] [bp-1Fh]@10 | |
3053 __int16 v39; // [sp+11Ah] [bp-1Eh]@10 | |
3054 __int16 v40; // [sp+11Ch] [bp-1Ch]@10 | |
3055 void *ptr; // [sp+120h] [bp-18h]@10 | |
3056 unsigned __int16 *v42; // [sp+124h] [bp-14h]@8 | |
3057 int v43; // [sp+128h] [bp-10h]@4 | |
3058 char v44; // [sp+12Fh] [bp-9h]@25 | |
3059 char *i; // [sp+130h] [bp-8h]@10 | |
3060 unsigned __int8 v46; // [sp+137h] [bp-1h]@17 | |
3061 | |
3062 v2 = this; | |
3063 v3 = 0; | |
3064 if ( !this->pRenderD3D || this->field_40110 ) | |
3065 { | |
3066 ++dword_4EFA84; | |
3067 File = fopen(a1, "wb"); | |
3068 if ( File ) | |
3069 { | |
3070 v4 = v2->field_10; | |
3071 v5 = (char *)v2->field_14; | |
3072 v25 = v4; | |
3073 a1 = v5; | |
3074 v43 = v4; | |
3075 if ( v4 & 1 ) | |
3076 v43 = v4 + 1; | |
3077 if ( v2->pRenderD3D ) | |
3078 { | |
3079 memset(&Dst, 0, 0x7Cu); | |
3080 Dst = 124; | |
168 | 3081 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, (DDSURFACEDESC2 *)&Dst, DDLOCK_WAIT) ) |
0 | 3082 return; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
3083 __debugbreak(); // warning C4700: uninitialized local variable 'v20' used |
0 | 3084 v42 = v20; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
3085 __debugbreak(); // warning C4700: uninitialized local variable 'v19' used |
0 | 3086 v6 = v19 >> 1; |
3087 v3 = 0; | |
3088 } | |
3089 else | |
3090 { | |
3091 pRenderer->BeginScene(); | |
3092 v42 = pRenderer->pTargetSurface; | |
3093 v6 = pRenderer->uTargetSurfacePitch; | |
3094 } | |
3095 i = (char *)v6; | |
3096 v33 = v25 - 1; | |
3097 v31 = v3; | |
3098 v34 = (short)a1 - 1; | |
3099 v32 = v3; | |
3100 v39 = v43; | |
3101 memset(&v21, 0, 0x30u); | |
3102 memset(&v16, 0, 0x38u); | |
3103 v37 = 0; | |
3104 Str = 10; | |
3105 v17 = 0; | |
3106 v7 = File; | |
3107 v28 = 5; | |
3108 v29 = 1; | |
3109 v30 = 8; | |
3110 v35 = 75; | |
3111 v36 = 75; | |
3112 v38 = 3; | |
3113 v40 = 1; | |
3114 fwrite(&Str, 1u, 1u, File); | |
3115 fwrite(&v28, 1u, 1u, v7); | |
3116 fwrite(&v29, 1u, 1u, v7); | |
3117 fwrite(&v30, 1u, 1u, v7); | |
3118 fwrite(&v31, 2u, 1u, v7); | |
3119 fwrite(&v32, 2u, 1u, v7); | |
3120 fwrite(&v33, 2u, 1u, v7); | |
3121 fwrite(&v34, 2u, 1u, v7); | |
3122 fwrite(&v35, 2u, 1u, v7); | |
3123 fwrite(&v36, 2u, 1u, v7); | |
3124 fwrite(&v21, 0x30u, 1u, v7); | |
3125 fwrite(&v37, 1u, 1u, v7); | |
3126 fwrite(&v38, 1u, 1u, v7); | |
3127 fwrite(&v39, 2u, 1u, v7); | |
3128 fwrite(&v40, 2u, 1u, v7); | |
3129 fwrite(&v16, 0x3Au, 1u, v7); | |
3130 ptr = pAllocator->AllocNamedChunk(0, 3 * v25 + 6, 0); | |
3131 if ( (signed int)a1 > 0 ) | |
3132 { | |
3133 v8 = v43; | |
3134 File = (FILE *)a1; | |
3135 v24 = 3 * v43; | |
3136 v22 = 2 * (int)i; | |
3137 v9 = (int)v42; | |
3138 while ( 1 ) | |
3139 { | |
3140 a1 = (const char *)v9; | |
3141 v10 = 0; | |
3142 if ( v25 > 0 ) | |
3143 { | |
3144 i = (char *)ptr + v8; | |
3145 v23 = (char *)ptr + 2 * v43; | |
3146 do | |
3147 { | |
3148 *((char *)ptr + v10) = (signed int)(v2->uTargetRMask & *(short *)a1) >> (LOBYTE(v2->uTargetGBits) | |
3149 + LOBYTE(v2->uTargetBBits) | |
3150 + v2->uTargetRBits | |
3151 - 8); | |
3152 i[v10] = (signed int)(v2->uTargetGMask & *(short *)a1) >> (LOBYTE(v2->uTargetBBits) | |
3153 + LOBYTE(v2->uTargetGBits) | |
3154 - 8); | |
3155 v11 = a1; | |
3156 v12 = LOBYTE(v2->uTargetBMask); | |
3157 a1 += 2; | |
3158 v23[v10++] = ((unsigned __int8)*v11 & v12) << (8 - LOBYTE(v2->uTargetBBits)); | |
3159 } | |
3160 while ( v10 < v25 ); | |
3161 } | |
3162 for ( i = 0; (signed int)i < v24; i += BYTE3(a1) ) | |
3163 { | |
3164 BYTE3(a1) = 1; | |
3165 v46 = *((char *)ptr + (int)i); | |
3166 do | |
3167 { | |
3168 v13 = (signed int)&i[BYTE3(a1)]; | |
3169 if ( *((char *)ptr + v13) != v46 ) | |
3170 break; | |
3171 if ( !(v13 % v43) ) | |
3172 break; | |
3173 ++BYTE3(a1); | |
3174 } | |
3175 while ( BYTE3(a1) < 0x3Fu ); | |
3176 if ( (signed int)&i[BYTE3(a1)] > v24 ) | |
3177 BYTE3(a1) = 3 * v43 - (char)i; | |
3178 if ( BYTE3(a1) > 1u || v46 >= 0xC0u ) | |
3179 { | |
3180 v44 = BYTE3(a1) | 0xC0; | |
3181 fwrite(&v44, 1u, 1u, v7); | |
3182 } | |
3183 fwrite(&v46, 1u, 1u, v7); | |
3184 } | |
3185 v9 = (int)&v42[v22 / 2]; | |
3186 v14 = File == (FILE *)1; | |
3187 File = (FILE *)((char *)File - 1); | |
3188 v42 = (unsigned __int16 *)((char *)v42 + v22); | |
3189 if ( v14 ) | |
3190 break; | |
3191 v8 = v43; | |
3192 } | |
3193 } | |
3194 if ( v2->pRenderD3D ) | |
3195 { | |
3196 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
3197 } | |
3198 else | |
3199 { | |
3200 pRenderer->EndScene(); | |
3201 } | |
3202 pAllocator->FreeChunk(ptr); | |
3203 fclose(v7); | |
3204 } | |
3205 } | |
3206 } | |
3207 // 4EFA84: using guessed type int dword_4EFA84; | |
3208 | |
3209 //----- (0049F5A2) -------------------------------------------------------- | |
810 | 3210 void Render::PackPCXpicture( unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size ) |
3211 { | |
0 | 3212 Render *v7; // ebx@1 |
3213 void *v8; // esi@3 | |
3214 void *v9; // esi@3 | |
3215 int v10; // ecx@4 | |
810 | 3216 unsigned short* v11; // eax@4 |
0 | 3217 int v12; // eax@6 |
3218 int v13; // eax@8 | |
3219 int v14; // ecx@8 | |
3220 signed int v15; // eax@11 | |
3221 char v16; // zf@20 | |
3222 int result; // eax@21 | |
3223 char v18[58]; // [sp+Ch] [bp-ACh]@3 | |
3224 // __int16 v19; // [sp+44h] [bp-74h]@3 | |
3225 char v20[48]; // [sp+48h] [bp-70h]@3 | |
810 | 3226 char *lineG; // [sp+78h] [bp-40h]@7 |
3227 char *lineB; // [sp+7Ch] [bp-3Ch]@7 | |
0 | 3228 int v23; // [sp+80h] [bp-38h]@4 |
3229 int v24; // [sp+84h] [bp-34h]@4 | |
3230 int v25; // [sp+88h] [bp-30h]@4 | |
3231 int v26; // [sp+8Ch] [bp-2Ch]@4 | |
810 | 3232 PCXHeader_1 Src; // [sp+90h] [bp-28h]@3 |
3233 PCXHeader_2 v27; // [sp+A0h] [bp-18h]@3 | |
3234 char *lineRGB; // [sp+A8h] [bp-10h]@3 | |
3235 int pitch; // [sp+ACh] [bp-Ch]@1 | |
0 | 3236 char v43; // [sp+B3h] [bp-5h]@18 |
3237 int i; // [sp+B4h] [bp-4h]@6 | |
810 | 3238 unsigned short* line_pictute_data; |
3239 byte test_byte; | |
3240 unsigned char pict_byte; | |
0 | 3241 |
3242 v7 = this; | |
810 | 3243 pitch = wight; |
3244 if ( wight & 1 ) | |
3245 pitch = wight + 1; | |
3246 Src.left = 0; | |
3247 Src.up = 0; | |
3248 Src.right = wight - 1; | |
3249 Src.bottom = heidth - 1; | |
3250 v27.pitch = pitch; | |
0 | 3251 memset(&v20, 0, 0x30u); |
3252 memset(&v18, 0, 0x38u); | |
810 | 3253 v8 = data_buff; |
3254 v27.reserved = 0; | |
0 | 3255 *(_WORD *)&v18[56] = 0; |
810 | 3256 Src.manufacturer = 10; |
3257 Src.version = 5; | |
3258 Src.encoding = 1; | |
3259 Src.bpp = 8; | |
3260 Src.hdpi = 75; | |
3261 Src.vdpi = 75; | |
3262 v27.planes = 3; | |
3263 v27.palette_info = 1; | |
3264 memcpy(data_buff, &Src, 1u); | |
0 | 3265 v8 = (char *)v8 + 1; |
810 | 3266 memcpy(v8, &Src.version, 1u); |
0 | 3267 v8 = (char *)v8 + 1; |
810 | 3268 memcpy(v8, &Src.encoding, 1u); |
0 | 3269 v8 = (char *)v8 + 1; |
810 | 3270 memcpy(v8, &Src.bpp, 1u); |
0 | 3271 v8 = (char *)v8 + 1; |
810 | 3272 memcpy(v8, &Src.left, 2u); |
0 | 3273 v8 = (char *)v8 + 2; |
810 | 3274 memcpy(v8, &Src.up, 2u); |
0 | 3275 v8 = (char *)v8 + 2; |
810 | 3276 memcpy(v8, &Src.right, 2u); |
0 | 3277 v8 = (char *)v8 + 2; |
810 | 3278 memcpy(v8, &Src.bottom, 2u); |
0 | 3279 v8 = (char *)v8 + 2; |
810 | 3280 memcpy(v8, &Src.hdpi, 2u); |
0 | 3281 v8 = (char *)v8 + 2; |
810 | 3282 memcpy(v8, &Src.vdpi, 2u); |
0 | 3283 v8 = (char *)v8 + 2; |
3284 memcpy(v8, &v20, 0x30u); | |
3285 v8 = (char *)v8 + 48; | |
810 | 3286 memcpy(v8, &v27, 1u); |
0 | 3287 v8 = (char *)v8 + 1; |
810 | 3288 memcpy(v8, &v27.planes, 1u); |
0 | 3289 v8 = (char *)v8 + 1; |
810 | 3290 memcpy(v8, &v27.pitch, 2u); |
0 | 3291 v8 = (char *)v8 + 2; |
810 | 3292 memcpy(v8, &v27.palette_info, 2u); |
0 | 3293 v8 = (char *)v8 + 2; |
3294 memcpy(v8, &v18, 0x3Au); | |
3295 v9 = (char *)v8 + 58; | |
810 | 3296 |
3297 lineRGB = (char*)pAllocator->AllocNamedChunk(0, 3 * (wight + 2), 0); | |
3298 if ( heidth > 0 ) | |
3299 { | |
3300 v10 = pitch; | |
3301 v25 = heidth; | |
3302 v26 = 3 * pitch; | |
3303 v23 = 2 * wight; | |
3304 v11 = picture_data; | |
3305 v24 = (int)picture_data; | |
0 | 3306 while ( 1 ) |
3307 { | |
810 | 3308 line_pictute_data = v11; |
0 | 3309 v12 = 0; |
3310 i = 0; | |
810 | 3311 if ( wight > 0 ) |
3312 { | |
3313 lineG = (char *)lineRGB + pitch; | |
3314 lineB = (char *)lineRGB + 2 * pitch; | |
0 | 3315 do |
3316 { | |
810 | 3317 lineRGB[v12] = (signed int)(v7->uTargetRMask & *line_pictute_data) >> (v7->uTargetGBits + v7->uTargetBBits + v7->uTargetRBits - 8); |
3318 lineG[v12] = (signed int)(v7->uTargetGMask & *line_pictute_data) >> ( v7->uTargetBBits + v7->uTargetGBits- 8); | |
3319 lineB[v12] = (v7->uTargetBMask & *line_pictute_data) << (8 - v7->uTargetBBits); | |
3320 | |
3321 v12++; | |
3322 } | |
3323 while ( v12 < wight ); | |
0 | 3324 } |
3325 for ( i = 0; i < v26; v9 = (char *)v9 + 1 ) | |
3326 { | |
810 | 3327 test_byte = 1; |
3328 pict_byte = lineRGB [i]; | |
0 | 3329 do |
3330 { | |
810 | 3331 v15 = i + test_byte; |
3332 if ( *((char *)lineRGB + v15) != pict_byte ) | |
0 | 3333 break; |
810 | 3334 if ( !(v15 % pitch) ) |
0 | 3335 break; |
810 | 3336 ++test_byte; |
3337 } | |
3338 while ( test_byte < 0x3Fu ); | |
3339 if ( i + test_byte > v26 ) | |
3340 test_byte = 3 * pitch - i; | |
3341 if ( test_byte > 1u || pict_byte >= 0xC0u ) | |
3342 { | |
3343 v43 = test_byte | 0xC0; | |
0 | 3344 memcpy(v9, &v43, 1u); |
3345 v9 = (char *)v9 + 1; | |
3346 } | |
810 | 3347 memcpy(v9, &pict_byte, 1u); |
3348 i += test_byte; | |
3349 } | |
3350 v11 +=wight ; | |
0 | 3351 v16 = v25-- == 1; |
810 | 3352 |
0 | 3353 if ( v16 ) |
3354 break; | |
810 | 3355 v10 = pitch; |
3356 } | |
3357 } | |
3358 pAllocator->FreeChunk(lineRGB); | |
3359 *(int *)packed_size = (char *)v9 - data_buff; | |
3360 | |
0 | 3361 } |
3362 | |
3363 //----- (0049F8B5) -------------------------------------------------------- | |
3364 FILE *Render::SavePCXImage(const char *Filename, char *a3, int a4, int a5) | |
3365 { | |
3366 Render *v5; // esi@1 | |
3367 FILE *result; // eax@1 | |
3368 FILE *v7; // edi@4 | |
3369 int v8; // ecx@5 | |
3370 int v9; // eax@5 | |
3371 int v10; // eax@7 | |
3372 int v11; // ecx@9 | |
3373 signed int v12; // eax@12 | |
3374 char v13; // zf@21 | |
3375 char v14[56]; // [sp+4h] [bp-A0h]@4 | |
3376 __int16 v15; // [sp+3Ch] [bp-68h]@4 | |
3377 char color_map[48]; // [sp+40h] [bp-64h]@4 | |
3378 int v17; // [sp+70h] [bp-34h]@5 | |
3379 int v18; // [sp+74h] [bp-30h]@5 | |
3380 char *v19; // [sp+78h] [bp-2Ch]@5 | |
3381 int v20; // [sp+7Ch] [bp-28h]@5 | |
3382 PCXHeader_1 header1; // [sp+80h] [bp-24h]@4 | |
3383 PCXHeader_2 header2; // [sp+90h] [bp-14h]@4 | |
3384 void *ptr; // [sp+98h] [bp-Ch]@4 | |
3385 int v24; // [sp+9Ch] [bp-8h]@2 | |
3386 char *i; // [sp+A0h] [bp-4h]@8 | |
3387 | |
3388 v5 = this; | |
3389 result = fopen(Filename, "wb"); | |
3390 Filename = (const char *)result; | |
3391 if ( result ) | |
3392 { | |
3393 v24 = a4; | |
3394 if ( a4 & 1 ) | |
3395 v24 = a4 + 1; | |
3396 header1.left = 0; | |
3397 header1.up = 0; | |
3398 header1.right = a4 - 1; | |
3399 header1.bottom = a5 - 1; | |
3400 header2.pitch = v24; | |
3401 memset(color_map, 0, sizeof(color_map)); | |
3402 header2.reserved = 0; | |
3403 memset(v14, 0, sizeof(v14)); | |
3404 v15 = 0; | |
3405 header1.manufacturer = 10; | |
3406 header1.version = 5; | |
3407 header1.encoding = 1; | |
3408 header1.bpp = 8; | |
3409 header1.hdpi = 75; | |
3410 header1.vdpi = 75; | |
3411 header2.planes = 3; | |
3412 header2.palette_info = 1; | |
3413 fwrite(&header1, 1u, 1u, (FILE *)Filename); | |
3414 v7 = (FILE *)Filename; | |
3415 fwrite(&header1.version, 1u, 1u, (FILE *)Filename); | |
3416 fwrite(&header1.encoding, 1u, 1u, v7); | |
3417 fwrite(&header1.bpp, 1u, 1u, v7); | |
3418 fwrite(&header1.left, 2u, 1u, v7); | |
3419 fwrite(&header1.up, 2u, 1u, v7); | |
3420 fwrite(&header1.right, 2u, 1u, v7); | |
3421 fwrite(&header1.bottom, 2u, 1u, v7); | |
3422 fwrite(&header1.hdpi, 2u, 1u, v7); | |
3423 fwrite(&header1.vdpi, 2u, 1u, v7); | |
3424 fwrite(color_map, 0x30u, 1u, v7); | |
3425 fwrite(&header2, 1u, 1u, v7); | |
3426 fwrite(&header2.planes, 1u, 1u, v7); | |
3427 fwrite(&header2.pitch, 2u, 1u, v7); | |
3428 fwrite(&header2.palette_info, 2u, 1u, v7); | |
3429 fwrite(v14, 0x3Au, 1u, v7); | |
3430 ptr = pAllocator->AllocNamedChunk(0, 3 * a4 + 6, 0); | |
3431 if ( a5 > 0 ) | |
3432 { | |
3433 v8 = v24; | |
3434 v18 = a5; | |
3435 v20 = 3 * v24; | |
3436 v17 = 2 * a4; | |
3437 v9 = (int)a3; | |
3438 v19 = a3; | |
3439 while ( 1 ) | |
3440 { | |
3441 a5 = v9; | |
3442 v10 = 0; | |
3443 if ( a4 > 0 ) | |
3444 { | |
3445 a3 = (char *)ptr + v8; | |
3446 i = (char *)ptr + 2 * v24; | |
3447 do | |
3448 { | |
3449 *((char *)ptr + v10) = (signed int)(v5->uTargetRMask & *(short *)a5) >> (LOBYTE(v5->uTargetGBits) | |
3450 + LOBYTE(v5->uTargetBBits) | |
3451 + v5->uTargetRBits | |
3452 - 8); | |
3453 a3[v10] = (signed int)(v5->uTargetGMask & *(short *)a5) >> (LOBYTE(v5->uTargetBBits) | |
3454 + LOBYTE(v5->uTargetGBits) | |
3455 - 8); | |
3456 v11 = a5; | |
3457 a5 += 2; | |
3458 i[v10++] = (v5->uTargetBMask & *(char *)v11) << (8 - LOBYTE(v5->uTargetBBits)); | |
3459 } | |
3460 while ( v10 < a4 ); | |
3461 } | |
3462 for ( i = 0; (signed int)i < v20; i += BYTE3(a5) ) | |
3463 { | |
3464 BYTE3(a5) = 1; | |
3465 BYTE3(Filename) = *((char *)ptr + (int)i); | |
3466 do | |
3467 { | |
3468 v12 = (signed int)&i[BYTE3(a5)]; | |
3469 if ( *((char *)ptr + v12) != BYTE3(Filename) ) | |
3470 break; | |
3471 if ( !(v12 % v24) ) | |
3472 break; | |
3473 ++BYTE3(a5); | |
3474 } | |
3475 while ( BYTE3(a5) < 0x3Fu ); | |
3476 if ( (signed int)&i[BYTE3(a5)] > v20 ) | |
3477 BYTE3(a5) = 3 * v24 - (char)i; | |
3478 if ( BYTE3(a5) > 1u || BYTE3(Filename) >= 0xC0u ) | |
3479 { | |
3480 BYTE3(a3) = BYTE3(a5) | 0xC0; | |
3481 fwrite((char *)&a3 + 3, 1u, 1u, v7); | |
3482 } | |
3483 fwrite((char *)&Filename + 3, 1u, 1u, v7); | |
3484 } | |
3485 v9 = (int)&v19[v17]; | |
3486 v13 = v18-- == 1; | |
3487 v19 += v17; | |
3488 if ( v13 ) | |
3489 break; | |
3490 v8 = v24; | |
3491 } | |
3492 } | |
3493 pAllocator->FreeChunk(ptr); | |
3494 result = (FILE *)fclose(v7); | |
3495 } | |
3496 return result; | |
3497 } | |
3498 | |
3499 //----- (0049FBCD) -------------------------------------------------------- | |
3500 void Render::ClearTarget(unsigned int uColor) | |
3501 { | |
3502 if (pRenderD3D) | |
3503 { | |
3504 if (field_40110) | |
3505 pRenderD3D->ClearTarget(true, uColor, false, 0.0); | |
3506 } | |
3507 else | |
3508 memset32(pTargetSurface, uColor, field_10 * field_14 / 2); | |
3509 } | |
3510 | |
3511 //----- (0049FC23) -------------------------------------------------------- | |
3512 void Render::Release2() | |
3513 { | |
3514 Release(); | |
3515 bWindowMode = 1; | |
3516 } | |
3517 | |
3518 //----- (0049FC37) -------------------------------------------------------- | |
3519 void Render::Present() | |
3520 { | |
3521 Render *v1; // esi@1 | |
3522 struct tagRECT Rect; // [sp+8h] [bp-28h]@11 | |
3523 RECT a4; // [sp+18h] [bp-18h]@11 | |
3524 struct tagPOINT Point; // [sp+28h] [bp-8h]@11 | |
3525 | |
3526 v1 = this; | |
3527 if ( !pRenderer->pRenderD3D || this->field_40110 ) | |
3528 { | |
3529 this->pBeforePresentFunction(); | |
3530 if ( v1->pRenderD3D ) | |
3531 { | |
3532 if ( v1->field_40110 ) | |
3533 { | |
3534 pRenderD3D->Present(false); | |
3535 } | |
3536 } | |
3537 else | |
3538 { | |
3539 if ( v1->bWindowMode ) | |
3540 { | |
3541 RestoreFrontBuffer(); | |
3542 GetClientRect(v1->hWnd, &Rect); | |
3543 Point.y = 0; | |
3544 Point.x = 0; | |
3545 ClientToScreen(v1->hWnd, &Point); | |
3546 OffsetRect(&Rect, Point.x, Point.y); | |
3547 a4.top = 0; | |
3548 a4.bottom = 480; | |
3549 a4.left = 0; | |
3550 a4.right = 640; | |
3551 PresentRect(&Rect, &a4); | |
3552 } | |
3553 else | |
3554 { | |
3555 RestoreFrontBuffer(); | |
3556 a4.top = 0; | |
3557 a4.bottom = 480; | |
3558 a4.left = 0; | |
3559 a4.right = 640; | |
3560 BltBackToFontFast(0, 0, &a4); | |
3561 } | |
3562 } | |
3563 } | |
3564 } | |
3565 | |
3566 //----- (0049FD3A) -------------------------------------------------------- | |
3567 void Render::_49FD3A() | |
3568 { | |
3569 Render *v2; // esi@1 | |
3570 IDirectDrawSurface4 *v3; // eax@6 | |
3571 IDirectDrawSurface4 *v4; // ST0C_4@6 | |
3572 RECT v5; // [sp+8h] [bp-10h]@6 | |
3573 | |
3574 auto a1 = this; | |
3575 v2 = a1; | |
3576 if ( a1->pRenderD3D ) | |
3577 { | |
3578 if (pFrontBuffer4->IsLost() == DDERR_SURFACELOST) | |
3579 pFrontBuffer4->Restore(); | |
3580 if (pBackBuffer4->IsLost() == DDERR_SURFACELOST) | |
3581 pBackBuffer4->Restore(); | |
3582 v3 = v2->pBackBuffer4; | |
3583 v4 = v2->pFrontBuffer4; | |
3584 v5.top = 0; | |
3585 v5.bottom = 480; | |
3586 v5.left = 0; | |
3587 v5.right = 640; | |
3588 v3->BltFast(0, 0, v4, &v5, 16u); | |
3589 } | |
3590 } | |
3591 | |
3592 //----- (0049FDBF) -------------------------------------------------------- | |
3593 void Render::CreateZBuffer() | |
3594 { | |
3595 if (!pDefaultZBuffer) | |
3596 { | |
3597 pDefaultZBuffer = pActiveZBuffer = nullptr; | |
3598 pDefaultZBuffer = pActiveZBuffer = (int *)pAllocator->AllocNamedChunk(0, 0x12C000, "Z Buf."); | |
871 | 3599 memset32(pActiveZBuffer, 0xFFFF0000, 0x4B000u); // // inlined Render::ClearActiveZBuffer (mm8::004A085B) |
0 | 3600 } |
3601 } | |
3602 | |
3603 //----- (0049FE05) -------------------------------------------------------- | |
3604 void Render::Release() | |
3605 { | |
3606 Render *v1; // esi@1 | |
3607 RenderD3D *v2; // ecx@1 | |
3608 char v3; // zf@4 | |
3609 void *v4; // ebx@6 | |
3610 IDirectDraw *v5; // eax@10 | |
3611 IDirectDrawSurface2 *v6; // eax@11 | |
3612 IDirectDrawSurface2 *v7; // eax@13 | |
3613 IDirectDrawSurface2 *v8; // eax@15 | |
3614 IDirectDraw2 *v9; // eax@17 | |
3615 IDirectDraw4 *v10; // eax@19 | |
3616 IDirectDrawSurface4 *v11; // eax@20 | |
3617 IDirectDrawSurface4 *v12; // eax@22 | |
3618 IDirectDrawSurface4 *v13; // eax@24 | |
3619 IDirectDraw4 *v14; // eax@26 | |
3620 unsigned __int16 **v15; // ebx@28 | |
3621 void **v16; // esi@29 | |
3622 | |
3623 v1 = this; | |
3624 v2 = this->pRenderD3D; | |
3625 if ( v2 ) | |
3626 { | |
3627 if ( v1->field_40110 ) | |
3628 { | |
3629 pRenderD3D->ClearTarget(1u, 0, 0, 1.0); | |
3630 pRenderD3D->Present(0); | |
3631 pRenderD3D->ClearTarget(1u, 0, 0, 1.0); | |
3632 } | |
3633 v1->pColorKeySurface4 = 0; | |
3634 v1->pBackBuffer4 = 0; | |
3635 v3 = v1->pTargetSurface == 0; | |
3636 v1->pFrontBuffer4 = 0; | |
3637 v1->pDirectDraw4 = 0; | |
3638 if ( !v3 ) | |
3639 { | |
3640 free(v1->ptr_400E8); | |
3641 v1->pTargetSurface = 0; | |
3642 v1->ptr_400E8 = 0; | |
3643 } | |
3644 v4 = v1->pRenderD3D; | |
3645 if ( v4 ) | |
3646 { | |
3647 pRenderD3D->Release(); | |
3648 free(v4); | |
3649 } | |
3650 v1->pRenderD3D = 0; | |
3651 } | |
3652 else | |
3653 { | |
3654 if ( bWinNT4_0 == 1 ) | |
3655 { | |
3656 v5 = (IDirectDraw *)v1->pDirectDraw2; | |
3657 if ( !v5 ) | |
3658 return; | |
3659 v5->SetCooperativeLevel(v1->hWnd, 8u); | |
3660 v1->pDirectDraw2->FlipToGDISurface(); | |
3661 v6 = v1->pSomeSurface2; | |
3662 if ( v6 ) | |
3663 { | |
3664 v6->Release(); | |
3665 v1->pSomeSurface2 = 0; | |
3666 } | |
3667 v7 = v1->pBackBuffer2; | |
3668 if ( v7 ) | |
3669 { | |
3670 v7->Release(); | |
3671 v1->pBackBuffer2 = 0; | |
3672 } | |
3673 v8 = v1->pFrontBuffer2; | |
3674 if ( v8 ) | |
3675 { | |
3676 v8->Release(); | |
3677 v1->pFrontBuffer2 = 0; | |
3678 } | |
3679 v9 = v1->pDirectDraw2; | |
3680 if ( v9 ) | |
3681 { | |
3682 v9->Release(); | |
3683 v1->pDirectDraw2 = 0; | |
3684 } | |
3685 } | |
3686 else | |
3687 { | |
3688 v10 = v1->pDirectDraw4; | |
3689 if ( !v10 ) | |
3690 return; | |
3691 v10->SetCooperativeLevel(v1->hWnd, 1032u); | |
3692 v1->pDirectDraw4->FlipToGDISurface(); | |
3693 v11 = v1->pColorKeySurface4; | |
3694 if ( v11 ) | |
3695 { | |
3696 v11->Release(); | |
3697 v1->pColorKeySurface4 = 0; | |
3698 } | |
3699 v12 = v1->pBackBuffer4; | |
3700 if ( v12 ) | |
3701 { | |
3702 v12->Release(); | |
3703 v1->pBackBuffer4 = 0; | |
3704 } | |
3705 v13 = v1->pFrontBuffer4; | |
3706 if ( v13 ) | |
3707 { | |
3708 v13->Release(); | |
3709 v1->pFrontBuffer4 = 0; | |
3710 } | |
3711 v14 = v1->pDirectDraw4; | |
3712 if ( v14 ) | |
3713 { | |
3714 v14->Release(); | |
3715 v1->pDirectDraw4 = 0; | |
3716 } | |
3717 } | |
3718 v15 = &v1->pTargetSurface; | |
3719 if ( v1->pTargetSurface ) | |
3720 { | |
3721 v16 = (void **)&v1->ptr_400E8; | |
3722 free(*v16); | |
3723 *v15 = 0; | |
3724 *v16 = 0; | |
3725 } | |
3726 } | |
3727 } | |
3728 | |
3729 //----- (0049FFD7) -------------------------------------------------------- | |
3730 void Render::CreateSomeTexture() | |
3731 { | |
3732 pRenderD3D->CreateTexture(64, 64, &pSurface, &pTexture, true, false, 32); | |
3733 } | |
3734 | |
3735 //----- (0049FFFB) -------------------------------------------------------- | |
3736 bool Render::InitializeFullscreen(HWND hWnd) | |
3737 { | |
3738 //Render *v2; // esi@1 | |
3739 //HWND v3; // ebx@1 | |
3740 //void *v4; // eax@2 | |
3741 //RenderD3D *v5; // eax@3 | |
3742 unsigned int v6; // edx@5 | |
3743 RenderD3D__DevInfo *v7; // ecx@5 | |
3744 bool v8; // eax@6 | |
3745 RenderD3D *v9; // ecx@13 | |
3746 unsigned int v10; // eax@13 | |
3747 RenderD3D *v11; // eax@25 | |
3748 HRESULT v12; // eax@25 | |
3749 int v13; // ecx@25 | |
3750 int v14; // eax@27 | |
3751 signed int v15; // ebx@31 | |
3752 bool v16; // eax@35 | |
3753 char v17; // zf@35 | |
3754 IDirectDraw4 *v18; // eax@38 | |
3755 HRESULT v19; // eax@38 | |
3756 int *v20; // eax@39 | |
3757 int *v22; // eax@42 | |
3758 int v23; // ecx@42 | |
3759 D3DDEVICEDESC refCaps; // [sp+Ch] [bp-300h]@25 | |
3760 DDSURFACEDESC2 pDesc; // [sp+108h] [bp-204h]@40 | |
3761 D3DDEVICEDESC halCaps; // [sp+184h] [bp-188h]@25 | |
3762 DDSURFACEDESC2 ddsd2; // [sp+280h] [bp-8Ch]@38 | |
3763 void *v28; // [sp+2FCh] [bp-10h]@2 | |
3764 int v29; // [sp+308h] [bp-4h]@2 | |
3765 | |
3766 //v2 = this; | |
3767 this->field_40110 = 0; | |
3768 this->pColorKeySurface4 = 0; | |
3769 this->pBackBuffer4 = 0; | |
3770 this->pFrontBuffer4 = 0; | |
3771 this->pDirectDraw4 = 0; | |
3772 this->bColorKeySupported = 0; | |
3773 Release(); | |
3774 //v3 = hWnd; | |
3775 this->hWnd = hWnd; | |
3776 CreateZBuffer(); | |
3777 if ( bUserDirect3D ) | |
3778 { | |
3779 pRenderD3D = new RenderD3D; | |
3780 v28 = pRenderD3D; | |
3781 v6 = uDesiredDirect3DDevice; | |
3782 v29 = -1; | |
3783 v7 = pRenderD3D->pAvailableDevices; | |
3784 if ( v7[v6].bIsDeviceCompatible ) | |
3785 { | |
3786 v8 = pRenderD3D->CreateDevice(v6, 0, hWnd); | |
3787 uAcquiredDirect3DDevice = uDesiredDirect3DDevice; | |
3788 } | |
3789 else | |
3790 { | |
3791 if ( v7[1].bIsDeviceCompatible ) | |
3792 { | |
3793 v8 = pRenderD3D->CreateDevice(1u, 0, hWnd); | |
3794 uAcquiredDirect3DDevice = 1; | |
3795 } | |
3796 else | |
3797 { | |
3798 if ( !v7->bIsDeviceCompatible ) | |
3799 Abortf("There aren't any D3D devices to create."); | |
3800 v8 = pRenderD3D->CreateDevice(0, 0, hWnd); | |
3801 uAcquiredDirect3DDevice = 0; | |
3802 } | |
3803 } | |
3804 if ( !v8 ) | |
3805 Abortf("D3Drend->Init failed."); | |
3806 v9 = pRenderD3D; | |
3807 pBackBuffer4 = v9->pBackBuffer; | |
3808 pFrontBuffer4 = v9->pFrontBuffer; | |
3809 pDirectDraw4 = v9->pHost; | |
3810 v10 = pRenderD3D->GetDeviceCaps(); | |
3811 if ( v10 & 1 ) | |
3812 { | |
3813 if ( pRenderD3D ) | |
3814 { | |
3815 pRenderD3D->Release(); | |
3816 delete pRenderD3D; | |
3817 } | |
3818 pRenderD3D = 0; | |
3819 pBackBuffer4 = 0; | |
3820 pFrontBuffer4 = 0; | |
3821 pDirectDraw4 = 0; | |
3822 Abortf("Direct3D renderer: The device failed to return capabilities."); | |
3823 } | |
3824 if ( v10 & 0x3E ) | |
3825 { | |
3826 if ( pRenderD3D ) | |
3827 { | |
3828 pRenderD3D->Release(); | |
3829 delete pRenderD3D; | |
3830 } | |
3831 pColorKeySurface4 = 0; | |
3832 pRenderD3D = 0; | |
3833 pBackBuffer4 = 0; | |
3834 pFrontBuffer4 = 0; | |
3835 pDirectDraw4 = 0; | |
3836 Abortf("Direct3D renderer: The device doesn't support the necessary alpha blending modes."); | |
3837 } | |
3838 if ( (v10 & 0x80u) != 0 ) | |
3839 { | |
3840 if ( pRenderD3D ) | |
3841 { | |
3842 pRenderD3D->Release(); | |
3843 delete pRenderD3D; | |
3844 } | |
3845 pRenderD3D = 0; | |
3846 pBackBuffer4 = 0; | |
3847 pFrontBuffer4 = 0; | |
3848 pDirectDraw4 = 0; | |
3849 Abortf("Direct3D renderer: The device doesn't support non-square textures."); | |
3850 } | |
3851 LOBYTE(field_10365C) = ~(unsigned __int8)(v10 >> 6) & 1; | |
3852 bRequiredTextureStagesAvailable = CheckTextureStages(); | |
3853 memset(&halCaps, 0, 0xFCu); | |
3854 halCaps.dwSize = 252; | |
3855 memset(&refCaps, 0, 0xFCu); | |
3856 v11 = pRenderD3D; | |
3857 refCaps.dwSize = 252; | |
3858 ErrD3D(v11->pDevice->GetCaps(&halCaps, &refCaps)); | |
3859 v13 = halCaps.dwMinTextureWidth; | |
3860 if ( (unsigned int)halCaps.dwMinTextureWidth >= halCaps.dwMinTextureHeight ) | |
3861 v13 = halCaps.dwMinTextureHeight; | |
3862 v14 = halCaps.dwMaxTextureWidth; | |
3863 uMinDeviceTextureDim = v13; | |
3864 if ( (unsigned int)v14 < halCaps.dwMaxTextureHeight ) | |
3865 v14 = halCaps.dwMaxTextureHeight; | |
3866 uMaxDeviceTextureDim = v14; | |
3867 if ( (unsigned int)v13 < 4 ) | |
3868 uMinDeviceTextureDim = 4; | |
3869 CreateSomeTexture(); | |
3870 v15 = 1; | |
3871 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, true)); | |
3872 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true)); | |
3873 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u)); | |
3874 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SPECULARENABLE, false)); | |
3875 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, false)); | |
3876 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, false)); | |
3877 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); | |
3878 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | |
3879 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | |
3880 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 3u)); | |
3881 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, 2u)); | |
3882 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, 0)); | |
3883 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, 2u)); | |
3884 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | |
3885 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, 0)); | |
3886 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 4u)); | |
3887 } | |
3888 else | |
3889 { | |
3890 CreateDirectDraw(); | |
3891 SetDirectDrawCooperationMode(hWnd, 1); | |
3892 SetDirectDrawDisplayMode(640u, 480u, 16u); | |
3893 CreateDirectDrawPrimarySurface(); | |
3894 v15 = 1; | |
3895 } | |
3896 ddpfPrimareSuface.dwSize = 32; | |
3897 GetTargetPixelFormat(&ddpfPrimareSuface); | |
3898 ParseTargetPixelFormat(); | |
3899 _49EBF1(); | |
3900 if ( pRenderD3D ) | |
3901 { | |
3902 v16 = IsColorKeySupported(pDirectDraw4); | |
3903 v17 = uAcquiredDirect3DDevice == v15; | |
3904 bColorKeySupported = v16; | |
3905 if ( !v17 ) | |
3906 bColorKeySupported = 0; | |
3907 if ( bColorKeySupported ) | |
3908 { | |
3909 memset(&ddsd2, 0, 0x7Cu); | |
3910 ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue = uTargetGMask | uTargetBMask; | |
3911 ddsd2.ddckCKSrcBlt.dwColorSpaceHighValue = ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue; | |
3912 v18 = pDirectDraw4; | |
3913 ddsd2.dwSize = 124; | |
3914 ddsd2.dwFlags = 65543; | |
3915 ddsd2.ddsCaps.dwCaps = 2112; | |
3916 ddsd2.dwWidth = 640; | |
3917 ddsd2.dwHeight = 480; | |
3918 ErrD3D(v18->CreateSurface(&ddsd2, &pColorKeySurface4, 0)); | |
3919 pBeforePresentFunction = Present_ColorKey; | |
3920 } | |
3921 else | |
3922 { | |
3923 pTargetSurface = 0; | |
3924 ptr_400E8 = 0; | |
3925 v20 = (int *)operator new(0x96020u); | |
3926 ptr_400E8 = v20; | |
3927 if ( !v20 | |
3928 || (memset(&pDesc, 0, 0x7Cu), | |
3929 pDesc.dwSize = 124, | |
3930 !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, v15)) ) | |
3931 return 0; | |
3932 pBackBuffer4->Unlock(0); | |
3933 v22 = ptr_400E8 + 4; | |
3934 v23 = (unsigned int)pDesc.lpSurface & 7; | |
3935 LOBYTE(v22) = (unsigned __int8)v22 & 0xF8; | |
3936 uTargetSurfacePitch = 640; | |
3937 pBeforePresentFunction = Present_NoColorKey; | |
3938 v15 = 1; | |
3939 pTargetSurface = (unsigned __int16 *)((char *)v22 + 2 * v23); | |
3940 } | |
3941 field_40110 = v15; | |
3942 } | |
3943 else | |
3944 { | |
3945 pBeforePresentFunction = 0;//nullsub_1; | |
3946 } | |
3947 bWindowMode = 0; | |
3948 pParty->uFlags |= 2u; | |
3949 LODWORD(flt_6BE3A0) = 0x3F0CCCCDu; | |
3950 pViewport->_4C02F8(36044); | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
3951 return v15 != 0; |
0 | 3952 } |
3953 // 6BE3A0: using guessed type float flt_6BE3A0; | |
3954 | |
3955 //----- (004A05F3) -------------------------------------------------------- | |
3956 bool Render::SwitchToWindow(HWND hWnd) | |
3957 { | |
3958 //Render *v2; // esi@1 | |
3959 //void *v3; // eax@2 | |
3960 //RenderD3D *v4; // eax@3 | |
3961 //unsigned int v5; // edx@5 | |
3962 //RenderD3D__DevInfo *v6; // ecx@5 | |
3963 bool v7; // eax@7 | |
3964 //RenderD3D *v8; // ecx@12 | |
3965 unsigned int v9; // eax@12 | |
3966 RenderD3D *v10; // eax@24 | |
3967 HRESULT v11; // eax@24 | |
3968 int v12; // eax@24 | |
3969 int v13; // eax@26 | |
3970 bool v14; // eax@32 | |
3971 char v15; // zf@32 | |
3972 IDirectDraw4 *v16; // eax@35 | |
3973 HRESULT v17; // eax@35 | |
3974 int *v18; // eax@36 | |
3975 int *v19; // edx@38 | |
3976 int v20; // eax@38 | |
3977 unsigned int v21; // ecx@38 | |
3978 int v22; // eax@41 | |
3979 D3DDEVICEDESC refCaps; // [sp+Ch] [bp-300h]@24 | |
3980 DDSURFACEDESC2 pDesc; // [sp+108h] [bp-204h]@37 | |
3981 D3DDEVICEDESC halCaps; // [sp+184h] [bp-188h]@24 | |
3982 DDSURFACEDESC2 ddsd2; // [sp+280h] [bp-8Ch]@35 | |
3983 //RenderD3D *thisa; // [sp+2FCh] [bp-10h]@2 | |
3984 int v29; // [sp+308h] [bp-4h]@2 | |
3985 | |
3986 pParty->uFlags |= 2u; | |
3987 //v2 = this; | |
3988 flt_6BE3A0 = 0.55000001f; | |
3989 pViewport->_4C02F8(36044); | |
3990 field_40110 = 0; | |
3991 Release(); | |
3992 pColorKeySurface4 = 0; | |
3993 pBackBuffer4 = 0; | |
3994 pFrontBuffer4 = 0; | |
3995 pDirectDraw4 = 0; | |
3996 bColorKeySupported = 0; | |
3997 CreateZBuffer(); | |
3998 if ( bUserDirect3D ) | |
3999 { | |
4000 /*v3 = operator new(0x148u); | |
4001 thisa = (RenderD3D *)v3; | |
4002 v29 = 0; | |
4003 if ( v3 ) | |
4004 v4 = RenderD3D::RenderD3D((RenderD3D *)v3); | |
4005 else | |
4006 v4 = 0;*/ | |
4007 pRenderD3D = new RenderD3D; | |
4008 //v4 = pRenderD3D; | |
4009 //v5 = uDesiredDirect3DDevice; | |
4010 v29 = -1; | |
4011 //v6 = pRenderD3D->pAvailableDevices; | |
4012 if (pRenderD3D->pAvailableDevices[uDesiredDirect3DDevice].bIsDeviceCompatible && | |
4013 uDesiredDirect3DDevice != 1 ) | |
4014 { | |
4015 v7 = pRenderD3D->CreateDevice(uDesiredDirect3DDevice, 1, hWnd); | |
4016 uAcquiredDirect3DDevice = uDesiredDirect3DDevice; | |
4017 } | |
4018 else | |
4019 { | |
4020 if ( !pRenderD3D->pAvailableDevices[0].bIsDeviceCompatible ) | |
4021 Abortf("There aren't any D3D devices to init."); | |
4022 v7 = pRenderD3D->CreateDevice(0, 1, hWnd); | |
4023 uAcquiredDirect3DDevice = 0; | |
4024 } | |
4025 if ( !v7 ) | |
4026 Abortf("D3Drend->Init failed."); | |
4027 | |
4028 //v8 = pRenderD3D; | |
4029 pColorKeySurface4 = 0; | |
4030 pBackBuffer4 = pRenderD3D->pBackBuffer; | |
4031 pFrontBuffer4 = pRenderD3D->pFrontBuffer; | |
4032 pDirectDraw4 = pRenderD3D->pHost; | |
4033 v9 = pRenderD3D->GetDeviceCaps(); | |
4034 if ( v9 & 1 ) | |
4035 { | |
4036 if (pRenderD3D) | |
4037 { | |
4038 pRenderD3D->Release(); | |
4039 delete pRenderD3D; | |
4040 } | |
4041 pRenderD3D = 0; | |
4042 pBackBuffer4 = 0; | |
4043 pFrontBuffer4 = 0; | |
4044 pDirectDraw4 = 0; | |
4045 Abortf("Direct3D renderer: The device failed to return capabilities."); | |
4046 } | |
4047 if ( v9 & 0x3E ) | |
4048 { | |
4049 if (pRenderD3D) | |
4050 { | |
4051 pRenderD3D->Release(); | |
4052 delete pRenderD3D; | |
4053 } | |
4054 pColorKeySurface4 = 0; | |
4055 pRenderD3D = 0; | |
4056 pBackBuffer4 = 0; | |
4057 pFrontBuffer4 = 0; | |
4058 pDirectDraw4 = 0; | |
4059 Abortf("Direct3D renderer: The device doesn't support the necessary alpha blending modes."); | |
4060 } | |
4061 if ( (v9 & 0x80u) != 0 ) | |
4062 { | |
4063 if (pRenderD3D) | |
4064 { | |
4065 pRenderD3D->Release(); | |
4066 delete pRenderD3D; | |
4067 } | |
4068 pRenderD3D = 0; | |
4069 pBackBuffer4 = 0; | |
4070 pFrontBuffer4 = 0; | |
4071 pDirectDraw4 = 0; | |
4072 Abortf("Direct3D renderer: The device doesn't support non-square textures."); | |
4073 } | |
4074 LOBYTE(field_10365C) = ~(unsigned __int8)(v9 >> 6) & 1; | |
4075 bRequiredTextureStagesAvailable = CheckTextureStages(); | |
4076 memset(&halCaps, 0, 0xFCu); | |
4077 halCaps.dwSize = 252; | |
4078 memset(&refCaps, 0, 0xFCu); | |
4079 //v10 = v2->pRenderD3D; | |
4080 refCaps.dwSize = 252; | |
4081 ErrD3D(pRenderD3D->pDevice->GetCaps(&halCaps, &refCaps)); | |
4082 v12 = halCaps.dwMinTextureWidth; | |
4083 if ( (unsigned int)halCaps.dwMinTextureWidth >= halCaps.dwMinTextureHeight ) | |
4084 v12 = halCaps.dwMinTextureHeight; | |
4085 uMinDeviceTextureDim = v12; | |
4086 v13 = halCaps.dwMaxTextureWidth; | |
4087 if ( (unsigned int)halCaps.dwMaxTextureWidth < halCaps.dwMaxTextureHeight ) | |
4088 v13 = halCaps.dwMaxTextureHeight; | |
4089 uMaxDeviceTextureDim = v13; | |
4090 CreateSomeTexture(); | |
4091 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, 1u)); | |
4092 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); | |
4093 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u)); | |
4094 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SPECULARENABLE, 0)); | |
4095 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, 0)); | |
4096 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); | |
4097 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | |
4098 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | |
4099 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 3u)); | |
4100 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, 2u)); | |
4101 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, 0)); | |
4102 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, 2u)); | |
4103 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | |
4104 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, 0)); | |
4105 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 4u)); | |
4106 } | |
4107 else | |
4108 { | |
4109 CreateDirectDraw(); | |
4110 SetDirectDrawCooperationMode(hWnd, 0); | |
4111 field_4004C = 1; | |
4112 CreateFrontBuffer(); | |
4113 CreateClipper(hWnd); | |
4114 CreateBackBuffer(); | |
4115 field_40030 = 0; | |
4116 field_18_locked_pitch = 0; | |
4117 } | |
4118 ddpfPrimareSuface.dwSize = 32; | |
4119 GetTargetPixelFormat(&ddpfPrimareSuface); | |
4120 ParseTargetPixelFormat(); | |
4121 _49EBF1(); | |
4122 if ( !pRenderD3D ) | |
4123 { | |
4124 pBeforePresentFunction = 0;//nullsub_1; | |
4125 goto LABEL_47; | |
4126 } | |
4127 v14 = IsColorKeySupported(pDirectDraw4); | |
4128 v15 = uAcquiredDirect3DDevice == 1; | |
4129 bColorKeySupported = v14; | |
4130 if ( !v15 ) | |
4131 bColorKeySupported = 0; | |
4132 if ( bColorKeySupported ) | |
4133 { | |
4134 memset(&ddsd2, 0, 0x7Cu); | |
4135 ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue = uTargetGMask | uTargetBMask; | |
4136 ddsd2.ddckCKSrcBlt.dwColorSpaceHighValue = ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue; | |
4137 v16 = pDirectDraw4; | |
4138 ddsd2.dwSize = 124; | |
4139 ddsd2.dwFlags = 65543; | |
4140 ddsd2.ddsCaps.dwCaps = 2112; | |
4141 ddsd2.dwWidth = 640; | |
4142 ddsd2.dwHeight = 480; | |
4143 ErrD3D(v16->CreateSurface(&ddsd2, &pColorKeySurface4, 0)); | |
4144 pBeforePresentFunction = Present_ColorKey; | |
4145 LABEL_45: | |
4146 field_40110 = 1; | |
4147 LABEL_47: | |
4148 bWindowMode = 1; | |
4149 hWnd = hWnd; | |
4150 return 0; | |
4151 } | |
4152 pTargetSurface = 0; | |
4153 ptr_400E8 = 0; | |
4154 v18 = (int *)new char[0x96020]; | |
4155 memset(v18, -1, 0x96020); | |
4156 ptr_400E8 = v18; | |
4157 if ( v18 ) | |
4158 { | |
4159 memset(&pDesc, 0, 0x7Cu); | |
4160 pDesc.dwSize = 124; | |
168 | 4161 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, DDLOCK_WAIT) ) |
0 | 4162 { |
4163 pRenderer->pBackBuffer4->Unlock(0); | |
4164 v19 = ptr_400E8; | |
4165 v20 = (unsigned int)pDesc.lpSurface & 7; | |
4166 v21 = (unsigned int)ptr_400E8 & 7; | |
4167 if ( v21 == v20 ) | |
4168 { | |
4169 pTargetSurface = (unsigned __int16 *)v19; | |
4170 } | |
4171 else | |
4172 { | |
4173 if ( (signed int)v21 >= v20 ) | |
4174 v22 = (int)((char *)v19 + 2 * (v21 - v20) + 16); | |
4175 else | |
4176 v22 = (int)((char *)v19 + 2 * (v20 - v21) + 16); | |
4177 pTargetSurface = (unsigned __int16 *)v22; | |
4178 } | |
4179 uTargetSurfacePitch = 640; | |
4180 pBeforePresentFunction = Present_NoColorKey; | |
4181 goto LABEL_45; | |
4182 } | |
4183 } | |
4184 return 0; | |
4185 } | |
4186 | |
4187 //----- (004A0BEE) -------------------------------------------------------- | |
709 | 4188 char Render::RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) |
0 | 4189 { |
4190 int v6; // edi@1 | |
4191 int v7; // edx@5 | |
4192 unsigned int v8; // ebx@5 | |
4193 int v9; // eax@7 | |
4194 unsigned int v10; // ecx@9 | |
4195 unsigned int v11; // esi@13 | |
4196 int v12; // eax@17 | |
4197 int v13; // eax@21 | |
4198 Render *v14; // edi@21 | |
4199 int v15; // eax@25 | |
4200 int v16; // eax@27 | |
4201 signed int v17; // eax@28 | |
4202 signed int v18; // edi@30 | |
4203 signed __int64 v19; // qax@41 | |
4204 int v20; // edi@41 | |
4205 unsigned int v21; // edi@46 | |
4206 int v22; // esi@47 | |
4207 int v23; // ebx@47 | |
4208 signed int v24; // edx@50 | |
4209 signed int v25; // esi@52 | |
4210 unsigned __int16 *v26; // ecx@52 | |
4211 int v27; // ebx@54 | |
4212 int v28; // edi@55 | |
4213 int v29; // edx@55 | |
4214 int v30; // ebx@60 | |
4215 int v31; // edx@61 | |
4216 int v32; // edi@61 | |
4217 int v34; // [sp+Ch] [bp-10h]@3 | |
4218 Render *v35; // [sp+10h] [bp-Ch]@1 | |
4219 __int64 v36; // [sp+14h] [bp-8h]@1 | |
4220 signed int v37; // [sp+18h] [bp-4h]@28 | |
4221 unsigned int uXa; // [sp+24h] [bp+8h]@49 | |
4222 unsigned int uYa; // [sp+28h] [bp+Ch]@28 | |
4223 int uYb; // [sp+28h] [bp+Ch]@47 | |
4224 int uZa; // [sp+2Ch] [bp+10h]@38 | |
4225 | |
4226 v36 = 0i64; | |
709 | 4227 v6 = this->raster_clip_x; |
0 | 4228 v35 = this; |
4229 if ( (signed int)uX < v6 ) | |
4230 HIDWORD(v36) = 8; | |
709 | 4231 v34 = this->raster_clip_z; |
4232 if ( (signed int)uX > this->raster_clip_z ) | |
0 | 4233 HIDWORD(v36) |= 4u; |
709 | 4234 v7 = this->raster_clip_y; |
0 | 4235 v8 = uY; |
4236 if ( (signed int)uY < v7 ) | |
4237 HIDWORD(v36) |= 2u; | |
709 | 4238 v9 = this->raster_clip_w; |
0 | 4239 if ( (signed int)uY > v9 ) |
4240 HIDWORD(v36) |= 1u; | |
4241 v10 = uZ; | |
4242 if ( (signed int)uZ < v6 ) | |
4243 LODWORD(v36) = 8; | |
4244 if ( (signed int)uZ > v34 ) | |
4245 LODWORD(v36) = v36 | 4; | |
4246 v11 = uW; | |
4247 if ( (signed int)uW < v7 ) | |
4248 LODWORD(v36) = v36 | 2; | |
4249 if ( (signed int)uW > v9 ) | |
4250 LODWORD(v36) = v36 | 1; | |
4251 LOBYTE(v12) = v36; | |
4252 if ( (unsigned int)v36 & HIDWORD(v36) ) | |
4253 return v12; | |
4254 if ( !v36 ) | |
4255 { | |
4256 LABEL_46: | |
4257 v21 = pRenderer->uTargetSurfacePitch; | |
4258 if ( pRenderer->uTargetSurfacePitch ) | |
4259 { | |
4260 v12 = uX + v8 * pRenderer->uTargetSurfacePitch; | |
4261 v22 = v11 - v8; | |
4262 v23 = v22; | |
4263 uYb = v22; | |
4264 if ( v22 < 0 ) | |
4265 { | |
4266 v23 = -v22; | |
4267 uYb = -v22; | |
4268 v21 = -pRenderer->uTargetSurfacePitch; | |
4269 } | |
4270 uXa = v10 - uX; | |
4271 if ( (uXa & 0x80000000u) == 0 ) | |
4272 { | |
4273 v24 = 1; | |
4274 } | |
4275 else | |
4276 { | |
4277 uXa = -uXa; | |
4278 v24 = -1; | |
4279 } | |
4280 v25 = 0; | |
4281 v26 = v35->pTargetSurface; | |
4282 if ( v26 ) | |
4283 { | |
4284 if ( (signed int)uXa <= v23 ) | |
4285 { | |
4286 v30 = v23 + 1; | |
4287 if ( v30 > 0 ) | |
4288 { | |
4289 v31 = 2 * v24; | |
4290 v32 = 2 * v21; | |
4291 v12 = (int)&v26[v12]; | |
4292 do | |
4293 { | |
4294 v25 += uXa; | |
4295 *(short *)v12 = uColor; | |
4296 v12 += v32; | |
4297 if ( v25 > 0 ) | |
4298 { | |
4299 v25 -= uYb; | |
4300 v12 += v31; | |
4301 } | |
4302 --v30; | |
4303 } | |
4304 while ( v30 ); | |
4305 } | |
4306 } | |
4307 else | |
4308 { | |
4309 v27 = uXa + 1; | |
4310 if ( (signed int)(uXa + 1) > 0 ) | |
4311 { | |
4312 v28 = 2 * v21; | |
4313 v29 = 2 * v24; | |
4314 v12 = (int)&v26[v12]; | |
4315 do | |
4316 { | |
4317 v25 += uYb; | |
4318 *(short *)v12 = uColor; | |
4319 v12 += v29; | |
4320 if ( v25 > (signed int)uXa ) | |
4321 { | |
4322 v25 -= uXa; | |
4323 v12 += v28; | |
4324 } | |
4325 --v27; | |
4326 } | |
4327 while ( v27 ); | |
4328 } | |
4329 } | |
4330 } | |
4331 } | |
4332 return v12; | |
4333 } | |
4334 if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 ) | |
4335 { | |
4336 if ( BYTE4(v36) & 8 ) | |
4337 { | |
4338 v13 = (signed int)((uW - uY) * (v6 - uX)) / (signed int)(uZ - uX); | |
4339 v14 = v35; | |
4340 v8 = v13 + uY; | |
709 | 4341 uX = v35->raster_clip_x; |
0 | 4342 goto LABEL_24; |
4343 } | |
4344 v10 = v6; | |
4345 v11 = (signed int)((uY - uW) * (v6 - uZ)) / (signed int)(uX - uZ) + uW; | |
4346 } | |
4347 v14 = v35; | |
4348 LABEL_24: | |
4349 if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 ) | |
4350 { | |
709 | 4351 v15 = v14->raster_clip_z; |
0 | 4352 if ( BYTE4(v36) & 4 ) |
4353 { | |
4354 v14 = v35; | |
4355 v8 += (signed int)((v11 - v8) * (v15 - uX)) / (signed int)(v10 - uX); | |
709 | 4356 uX = v35->raster_clip_z; |
0 | 4357 } |
4358 else | |
4359 { | |
4360 v16 = (signed int)((v8 - v11) * (v15 - v10)) / (signed int)(uX - v10); | |
709 | 4361 v10 = v14->raster_clip_z; |
0 | 4362 v11 += v16; |
4363 } | |
4364 } | |
709 | 4365 v17 = v14->raster_clip_y; |
0 | 4366 v37 = 0; |
709 | 4367 uYa = v14->raster_clip_y; |
0 | 4368 if ( (signed int)v8 < v17 ) |
4369 v37 = 2; | |
709 | 4370 v18 = v14->raster_clip_w; |
0 | 4371 if ( (signed int)v8 > v18 ) |
4372 v37 |= 1u; | |
4373 if ( (signed int)v11 >= v17 ) | |
4374 v12 = 0; | |
4375 else | |
4376 v12 = 2; | |
4377 if ( (signed int)v11 > v18 ) | |
4378 LOBYTE(v12) = v12 | 1; | |
4379 if ( !(v12 & v37) ) | |
4380 { | |
4381 v12 ^= v37; | |
4382 uZa = v12; | |
4383 if ( v12 & 2 ) | |
4384 { | |
4385 if ( v37 & 2 ) | |
4386 { | |
4387 uX += (signed int)((v10 - uX) * (uYa - v8)) / (signed int)(v11 - v8); | |
4388 LOBYTE(v12) = (char)v35; | |
709 | 4389 v8 = v35->raster_clip_y; |
0 | 4390 } |
4391 else | |
4392 { | |
4393 v19 = (signed int)((uX - v10) * (uYa - v11)); | |
4394 v20 = v8 - v11; | |
4395 v11 = uYa; | |
4396 v12 = v19 / v20; | |
4397 v10 += v12; | |
4398 } | |
4399 } | |
4400 if ( uZa & 1 ) | |
4401 { | |
4402 if ( v37 & 1 ) | |
4403 { | |
709 | 4404 uX += (signed int)((v10 - uX) * (v35->raster_clip_w - v8)) / (signed int)(v11 - v8); |
0 | 4405 LOBYTE(v12) = (char)v35; |
709 | 4406 v8 = v35->raster_clip_w; |
0 | 4407 } |
4408 else | |
4409 { | |
709 | 4410 v12 = (signed int)((uX - v10) * (v35->raster_clip_w - v11)) / (signed int)(v8 - v11); |
4411 v11 = v35->raster_clip_w; | |
0 | 4412 v10 += v12; |
4413 } | |
4414 } | |
4415 goto LABEL_46; | |
4416 } | |
4417 return v12; | |
4418 } | |
4419 | |
4420 //----- (004A0E80) -------------------------------------------------------- | |
4421 void Render::ClearZBuffer(int a2, int a3) | |
4422 { | |
4423 memset32(this->pActiveZBuffer, -65536, 0x4B000u); | |
4424 } | |
4425 | |
4426 //----- (004A0E97) -------------------------------------------------------- | |
709 | 4427 void Render::SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) |
4428 { | |
4429 this->raster_clip_x = uX; | |
4430 this->raster_clip_y = uY; | |
4431 this->raster_clip_z = uZ; | |
4432 this->raster_clip_w = uW; | |
0 | 4433 } |
4434 | |
4435 //----- (004A0EB6) -------------------------------------------------------- | |
4436 void Render::ParseTargetPixelFormat() | |
4437 { | |
4438 Render *v1; // eax@1 | |
4439 signed int v2; // ecx@1 | |
4440 DWORD uRedMask; // edx@1 | |
4441 unsigned int uGreenMask; // esi@5 | |
4442 signed int v5; // ecx@5 | |
4443 unsigned int uBlueMask; // edx@9 | |
4444 signed int v7; // ecx@9 | |
4445 unsigned int v8; // ecx@13 | |
4446 | |
4447 v1 = this; | |
4448 v2 = 0; | |
4449 uRedMask = v1->ddpfPrimareSuface.dwRBitMask; | |
4450 v1->uTargetBBits = 0; | |
4451 v1->uTargetGBits = 0; | |
4452 v1->uTargetRBits = 0; | |
4453 do | |
4454 { | |
4455 if ( (1 << v2) & uRedMask ) | |
4456 ++v1->uTargetRBits; | |
4457 ++v2; | |
4458 } | |
4459 while ( v2 < 16 ); | |
4460 uGreenMask = v1->ddpfPrimareSuface.dwGBitMask; | |
4461 v5 = 0; | |
4462 do | |
4463 { | |
4464 if ( (1 << v5) & uGreenMask ) | |
4465 ++v1->uTargetGBits; | |
4466 ++v5; | |
4467 } | |
4468 while ( v5 < 16 ); | |
4469 uBlueMask = v1->ddpfPrimareSuface.dwBBitMask; | |
4470 v7 = 0; | |
4471 do | |
4472 { | |
4473 if ( (1 << v7) & uBlueMask ) | |
4474 ++v1->uTargetBBits; | |
4475 ++v7; | |
4476 } | |
4477 while ( v7 < 16 ); | |
4478 v8 = v1->ddpfPrimareSuface.dwRBitMask; | |
4479 v1->uTargetGMask = uGreenMask; | |
4480 v1->uTargetRMask = v8; | |
4481 v1->uTargetBMask = uBlueMask; | |
4482 } | |
4483 | |
4484 //----- (004A0F40) -------------------------------------------------------- | |
4485 bool Render::LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags) | |
4486 { | |
4487 IDirectDrawSurface4 *v4; // esi@1 | |
168 | 4488 HRESULT result; // eax@1 |
0 | 4489 HRESULT v6; // eax@4 |
4490 int v7; // [sp-8h] [bp-14h]@10 | |
4491 unsigned int v8; // [sp-4h] [bp-10h]@10 | |
4492 char v9; // [sp+Bh] [bp-1h]@1 | |
4493 | |
4494 v4 = pSurface; | |
4495 v9 = 1; | |
4496 result = pSurface->Lock(0, pDesc, uLockFlags, 0); | |
4497 if ( result == DDERR_SURFACELOST ) | |
4498 { | |
4499 v6 = v4->Restore(); | |
4500 if ( v6 ) | |
4501 { | |
4502 if ( v6 != DDERR_IMPLICITLYCREATED ) | |
4503 { | |
4504 LABEL_20: | |
4505 v9 = 0; | |
4506 result = (bool)memset(pDesc, 0, 4u); | |
4507 goto LABEL_21; | |
4508 } | |
4509 pRenderer->pFrontBuffer4->Restore(); | |
4510 v4->Restore(); | |
4511 } | |
4512 result = v4->Lock(0, pDesc, DDLOCK_WAIT, 0); | |
4513 if ( result == DDERR_INVALIDRECT || result == DDERR_SURFACEBUSY ) | |
4514 goto LABEL_20; | |
4515 ErrD3D(result); | |
4516 if ( result ) | |
4517 { | |
4518 //v8 = 0; | |
4519 //v7 = 2161; | |
4520 LABEL_19: | |
4521 //CheckHRESULT((CheckHRESULT_stru0 *)&pSurface, result, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp", v7, v8); | |
4522 goto LABEL_20; | |
4523 } | |
4524 if ( pRenderer->pRenderD3D ) | |
4525 pRenderD3D->HandleLostResources(); | |
4526 result = pRenderer->pDirectDraw4->RestoreAllSurfaces(); | |
4527 } | |
4528 else | |
4529 { | |
4530 if ( result ) | |
4531 { | |
4532 if ( result == DDERR_INVALIDRECT || result == DDERR_SURFACEBUSY ) | |
4533 goto LABEL_20; | |
4534 ErrD3D(result); | |
4535 //v8 = 0; | |
4536 //v7 = 2199; | |
4537 //goto LABEL_19; | |
4538 } | |
4539 } | |
4540 LABEL_21: | |
4541 LOBYTE(result) = v9; | |
4542 return result; | |
4543 } | |
4544 | |
4545 //----- (004A1032) -------------------------------------------------------- | |
4546 bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags) | |
4547 { | |
4548 IDirectDrawSurface2 *v4; // esi@1 | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
4549 HRESULT v5; // eax@1 |
0 | 4550 HRESULT v6; // eax@2 |
4551 int v7; // [sp-8h] [bp-10h]@8 | |
4552 unsigned int v8; // [sp-4h] [bp-Ch]@8 | |
4553 | |
4554 v4 = pSurface; | |
4555 v5 = pSurface->Lock( | |
4556 0, | |
4557 pDesc, | |
4558 uLockFlags, | |
4559 0); | |
4560 BYTE3(pSurface) = 1; | |
4561 if ( v5 == DDERR_SURFACELOST ) | |
4562 { | |
4563 v6 = v4->Restore(); | |
4564 if ( !v6 ) | |
4565 goto LABEL_5; | |
4566 if ( v6 == DDERR_IMPLICITLYCREATED ) | |
4567 { | |
4568 pRenderer->pFrontBuffer2->Restore(); | |
4569 v4->Restore(); | |
4570 LABEL_5: | |
4571 v5 = v4->Lock(0, pDesc, 1u, 0) != 0; | |
4572 if ( v5 == DDERR_INVALIDRECT || v5 == DDERR_SURFACEBUSY ) | |
4573 goto LABEL_14; | |
4574 if ( !v5 ) | |
4575 return true; | |
4576 ErrD3D(v5); | |
4577 //v8 = 0; | |
4578 //v7 = 2247; | |
4579 goto LABEL_13; | |
4580 } | |
4581 else | |
4582 { | |
4583 pDesc->dwSize = 0; | |
4584 return false; | |
4585 } | |
4586 } | |
4587 else | |
4588 { | |
4589 if ( !v5 ) | |
4590 return true; | |
4591 if ( v5 != DDERR_INVALIDRECT && v5 != DDERR_SURFACEBUSY ) | |
4592 { | |
4593 //v8 = 0; | |
4594 //v7 = 2269; | |
4595 ErrD3D(v5); | |
4596 pDesc->dwSize = 0; | |
4597 return false; | |
4598 LABEL_13: | |
4599 //CheckHRESULT((CheckHRESULT_stru0 *)&pSurface, v5, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp", v7, v8); | |
4600 goto LABEL_14; | |
4601 } | |
4602 } | |
4603 LABEL_14: | |
4604 return true; | |
4605 } | |
4606 | |
4607 //----- (004A10E4) -------------------------------------------------------- | |
4608 void Render::CreateDirectDraw() | |
4609 { | |
4610 Render *v1; // edi@1 | |
4611 HRESULT v2; // eax@1 | |
4612 HRESULT v3; // eax@5 | |
4613 int v6; // [sp-Ch] [bp-20h]@3 | |
4614 unsigned int v9; // [sp+0h] [bp-14h]@0 | |
4615 IDirectDraw *lpDD; // [sp+10h] [bp-4h]@1 | |
4616 | |
4617 v1 = this; | |
4618 ErrD3D(DirectDrawCreate(0, &lpDD, 0)); | |
4619 | |
4620 pDirectDraw2 = nullptr; | |
4621 pDirectDraw4 = nullptr; | |
4622 | |
4623 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4624 ErrD3D(lpDD->QueryInterface(IID_IDirectDraw4, (void **)&pDirectDraw4)); | |
4625 else | |
4626 ErrD3D(lpDD->QueryInterface(IID_IDirectDraw2, (void **)&pDirectDraw2)); | |
4627 | |
4628 lpDD->Release(); | |
4629 lpDD = nullptr; | |
4630 } | |
4631 | |
4632 //----- (004A1169) -------------------------------------------------------- | |
4633 void Render::SetDirectDrawCooperationMode(HWND hWnd, bool bFullscreen) | |
4634 { | |
4635 DWORD flags; // eax@1 | |
4636 IDirectDraw *v4; // ecx@3 | |
4637 HRESULT v5; // eax@5 | |
4638 int v6; // [sp-8h] [bp-8h]@3 | |
4639 unsigned int v7; // [sp-4h] [bp-4h]@3 | |
4640 | |
4641 flags = bFullscreen ? DDSCL_NORMAL | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : | |
4642 DDSCL_NORMAL; | |
4643 | |
4644 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4645 ErrD3D(pDirectDraw4->SetCooperativeLevel(hWnd, flags | DDSCL_MULTITHREADED)); | |
4646 else | |
4647 ErrD3D(pDirectDraw2->SetCooperativeLevel(hWnd, flags)); | |
4648 } | |
4649 | |
4650 //----- (004A11C6) -------------------------------------------------------- | |
4651 void Render::SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP) | |
4652 { | |
4653 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4654 ErrD3D(pDirectDraw4->SetDisplayMode(uWidth, uHeight, uBPP, 0, 0)); | |
4655 else | |
4656 ErrD3D(pDirectDraw2->SetDisplayMode(uWidth, uHeight, uBPP, 0, 0)); | |
4657 } | |
4658 | |
4659 //----- (004A121C) -------------------------------------------------------- | |
4660 void Render::CreateFrontBuffer() | |
4661 { | |
4662 Render *v1; // esi@1 | |
4663 IDirectDraw *pDD; // eax@3 | |
4664 IDirectDrawSurface **pOutSurf; // esi@3 | |
4665 struct _DDSURFACEDESC *v4; // edx@3 | |
4666 HRESULT v5; // eax@5 | |
4667 int v6; // [sp-8h] [bp-8Ch]@3 | |
4668 unsigned int v7; // [sp-4h] [bp-88h]@3 | |
4669 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3 | |
4670 | |
4671 v1 = this; | |
4672 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4673 { | |
4674 memset(&a2, 0, 0x7Cu); | |
4675 pDD = (IDirectDraw *)v1->pDirectDraw4; | |
4676 a2.dwSize = 124; | |
4677 a2.dwFlags = 1; | |
4678 v7 = 0; | |
4679 a2.ddsCaps.dwCaps = 512; | |
4680 v6 = 2357; | |
4681 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer4; | |
4682 v4 = (struct _DDSURFACEDESC *)&a2; | |
4683 } | |
4684 else | |
4685 { | |
4686 memset(&a2.lPitch, 0, 0x6Cu); // DDSURFACEDESC here | |
4687 pDD = (IDirectDraw *)v1->pDirectDraw2; | |
4688 a2.lPitch = 108; | |
4689 a2.dwBackBufferCount = 1; | |
4690 v7 = 0; | |
4691 a2.dwTextureStage = 512; | |
4692 v6 = 2346; | |
4693 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer2; | |
4694 v4 = (struct _DDSURFACEDESC *)&a2.lPitch; | |
4695 } | |
4696 ErrD3D(pDD->CreateSurface(v4, pOutSurf, 0)); | |
4697 } | |
4698 | |
4699 //----- (004A12CD) -------------------------------------------------------- | |
4700 void Render::CreateBackBuffer() | |
4701 { | |
4702 Render *v1; // esi@1 | |
4703 IDirectDraw *v2; // eax@3 | |
4704 IDirectDrawSurface **ppBackBuffer; // esi@3 | |
4705 struct _DDSURFACEDESC *v4; // edx@3 | |
4706 HRESULT v5; // eax@5 | |
4707 int v6; // [sp-8h] [bp-8Ch]@3 | |
4708 unsigned int v7; // [sp-4h] [bp-88h]@3 | |
4709 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3 | |
4710 | |
4711 v1 = this; | |
4712 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4713 { | |
4714 memset(&a2, 0, 0x7Cu); | |
4715 v2 = (IDirectDraw *)v1->pDirectDraw4; | |
4716 a2.dwSize = 124; | |
4717 a2.dwFlags = 7; | |
4718 v7 = 0; | |
4719 a2.ddsCaps.dwCaps = 2112; | |
4720 a2.dwWidth = 640; | |
4721 a2.dwHeight = 480; | |
4722 v6 = 2387; | |
4723 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4; | |
4724 v4 = (struct _DDSURFACEDESC *)&a2; | |
4725 } | |
4726 else | |
4727 { | |
4728 memset(&a2.lPitch, 0, 0x6Cu); | |
4729 v2 = (IDirectDraw *)v1->pDirectDraw2; | |
4730 a2.lPitch = 108; | |
4731 a2.dwBackBufferCount = 7; | |
4732 v7 = 0; | |
4733 a2.dwTextureStage = 2112; | |
4734 a2.dwAlphaBitDepth = 640; | |
4735 a2.dwMipMapCount = 480; | |
4736 v6 = 2374; | |
4737 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2; | |
4738 v4 = (struct _DDSURFACEDESC *)&a2.lPitch; // //DDSURFACEDESC here fo ddraw2 | |
4739 } | |
4740 ErrD3D(v2->CreateSurface(v4, ppBackBuffer, 0)); | |
4741 } | |
4742 | |
4743 //----- (004A139A) -------------------------------------------------------- | |
4744 void Render::CreateDirectDrawPrimarySurface() | |
4745 { | |
4746 Render *v1; // esi@1 | |
4747 int v2; // ebx@3 | |
4748 IDirectDraw2 *v3; // eax@3 | |
4749 HRESULT v4; // eax@3 | |
4750 IDirectDrawSurface *pFrontBuffer; // eax@3 | |
4751 DDSCAPS2 *v6; // edx@3 | |
4752 IDirectDraw4 *v7; // eax@4 | |
4753 HRESULT v8; // eax@4 | |
4754 int v9; // ST14_4@5 | |
4755 IDirectDrawSurface *v10; // ST10_4@5 | |
4756 HRESULT v11; // eax@5 | |
4757 IDirectDrawSurface **ppBackBuffer; // [sp-4h] [bp-A4h]@3 | |
4758 const char *v13; // [sp+0h] [bp-A0h]@0 | |
4759 int v14; // [sp+4h] [bp-9Ch]@0 | |
4760 unsigned int v15; // [sp+8h] [bp-98h]@0 | |
4761 DDSURFACEDESC2 ddsd2; // [sp+Ch] [bp-94h]@3 | |
4762 DDSCAPS2 v17; // [sp+88h] [bp-18h]@4 | |
4763 int a4; // [sp+98h] [bp-8h]@3 | |
4764 | |
4765 v1 = this; | |
4766 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4767 { | |
4768 v2 = 0; | |
4769 this->field_4004C = 1; | |
4770 memset(&ddsd2, 0, 0x7Cu); | |
4771 v7 = v1->pDirectDraw4; | |
4772 ddsd2.dwBackBufferCount = 1; | |
4773 ddsd2.dwSize = 0x7Cu; | |
4774 ddsd2.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; | |
4775 ddsd2.ddsCaps.dwCaps = DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_3DDEVICE | DDSCAPS_PRIMARYSURFACE; | |
4776 ErrD3D(v7->CreateSurface( | |
4777 &ddsd2, | |
4778 &pFrontBuffer4, | |
4779 0)); | |
4780 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer4; | |
4781 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4; | |
4782 } | |
4783 else | |
4784 { | |
4785 v2 = 0; | |
4786 this->field_4004C = 1; | |
4787 | |
4788 DDSURFACEDESC ddsd; | |
4789 memset(&ddsd, 0, sizeof(DDSURFACEDESC)); | |
4790 | |
4791 ddsd.lpSurface = (LPVOID)1; | |
4792 ddsd.lPitch = 108; | |
4793 ddsd.dwBackBufferCount = 33; | |
4794 ddsd.ddsCaps.dwCaps = 8728; | |
4795 ErrD3D(pDirectDraw2->CreateSurface( | |
4796 &ddsd, | |
4797 (IDirectDrawSurface **)&pFrontBuffer2, | |
4798 0)); | |
4799 | |
4800 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer2; | |
4801 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2; | |
4802 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
4803 __debugbreak(); // warning C4700: uninitialized local variable 'v6' used |
0 | 4804 v9 = (int)v6; |
4805 v10 = pFrontBuffer; // BUG | |
4806 | |
4807 v17.dwCaps = 4; | |
4808 ErrD3D(pFrontBuffer->GetAttachedSurface((DDSCAPS *)&v17, ppBackBuffer));// hr = this->pFrontBuffer->GetAttachedSurface(&ddsCaps2, ppBackBuffer); | |
4809 //CheckHRESULT(&thisa, v11, (const char *)v10, v9, (unsigned int)ppBackBuffer); | |
4810 v1->field_40030 = v2; | |
4811 v1->field_18_locked_pitch = v2; | |
4812 } | |
4813 | |
4814 //----- (004A14F4) -------------------------------------------------------- | |
4815 void Render::CreateClipper(HWND a2) | |
4816 { | |
4817 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4818 { | |
4819 ErrD3D(pDirectDraw4->CreateClipper(0, &pDDrawClipper, 0)); | |
4820 ErrD3D(pDDrawClipper->SetHWnd(0, a2)); | |
4821 ErrD3D(pFrontBuffer4->SetClipper(pDDrawClipper)); | |
4822 } | |
4823 else | |
4824 { | |
4825 ErrD3D(pDirectDraw2->CreateClipper(0, &pDDrawClipper, 0)); | |
4826 ErrD3D(pDDrawClipper->SetHWnd(0, a2)); | |
4827 } | |
4828 } | |
4829 | |
4830 //----- (004A15D8) -------------------------------------------------------- | |
4831 void Render::GetTargetPixelFormat(DDPIXELFORMAT *pOut) | |
4832 { | |
4833 IDirectDrawSurface *v2; // eax@3 | |
4834 | |
4835 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4836 v2 = (IDirectDrawSurface *)this->pFrontBuffer4; | |
4837 else | |
4838 v2 = (IDirectDrawSurface *)this->pFrontBuffer2; | |
4839 v2->GetPixelFormat(pOut); | |
4840 } | |
4841 | |
4842 //----- (004A1605) -------------------------------------------------------- | |
4843 void Render::LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow) | |
4844 { | |
4845 Render *v3; // esi@1 | |
4846 signed int v4; // eax@3 | |
4847 | |
4848 v3 = this; | |
4849 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4850 { | |
4851 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 | |
4852 memset(&pDesc, 0, 0x7Cu); | |
4853 pDesc.dwSize = 124; | |
168 | 4854 LockSurface_DDraw4(v3->pBackBuffer4, &pDesc, DDLOCK_WAIT); |
0 | 4855 *pOutSurfacePtr = pDesc.lpSurface; |
4856 v4 = pDesc.lPitch; | |
4857 } | |
4858 else | |
4859 { | |
4860 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 | |
4861 memset(&pDesc.lPitch, 0, 0x6Cu); | |
4862 pDesc.lPitch = 108; | |
4863 LockSurface_DDraw2(v3->pBackBuffer2, &pDesc, 1u); | |
4864 *pOutSurfacePtr = (void *)pDesc.lpSurface; | |
4865 v4 = pDesc.dwReserved; | |
4866 } | |
4867 *pOutPixelsPerRow = v4 >> 1; | |
4868 } | |
4869 | |
4870 //----- (004A169E) -------------------------------------------------------- | |
4871 bool Render::UsingDirect3D() | |
4872 { | |
4873 return bUserDirect3D == 0; | |
4874 } | |
4875 | |
4876 //----- (004A16E1) -------------------------------------------------------- | |
4877 void Render::UnlockBackBuffer() | |
4878 { | |
4879 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4880 ErrD3D(pBackBuffer4->Unlock(0)); | |
4881 else | |
4882 ErrD3D(pBackBuffer2->Unlock(0)); | |
4883 } | |
4884 | |
4885 //----- (004A172E) -------------------------------------------------------- | |
4886 void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow) | |
4887 { | |
4888 Render *v3; // esi@1 | |
4889 signed int v4; // eax@3 | |
4890 | |
4891 v3 = this; | |
4892 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4893 { | |
4894 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 | |
4895 memset(&pDesc, 0, 0x7Cu); | |
4896 pDesc.dwSize = 124; | |
168 | 4897 LockSurface_DDraw4(v3->pFrontBuffer4, &pDesc, DDLOCK_WAIT); |
0 | 4898 *pOutSurface = pDesc.lpSurface; |
4899 v4 = pDesc.lPitch; | |
4900 } | |
4901 else | |
4902 { | |
4903 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 | |
4904 memset(&pDesc.lPitch, 0, 0x6Cu); | |
4905 pDesc.lPitch = 108; | |
4906 LockSurface_DDraw2(v3->pFrontBuffer2, &pDesc, 1u); | |
4907 *pOutSurface = (void *)pDesc.lpSurface; | |
4908 v4 = pDesc.dwReserved; | |
4909 } | |
4910 *pOutPixelsPerRow = v4 >> 1; | |
4911 } | |
4912 | |
4913 //----- (004A17C7) -------------------------------------------------------- | |
4914 void Render::UnlockFrontBuffer() | |
4915 { | |
4916 IDirectDrawSurface *pFront; // eax@3 | |
4917 HRESULT v2; // eax@5 | |
4918 signed int v3; // [sp-8h] [bp-Ch]@3 | |
4919 int v4; // [sp-4h] [bp-8h]@3 | |
4920 | |
4921 auto a5 = this; | |
4922 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4923 { | |
4924 pFront = (IDirectDrawSurface *)a5->pFrontBuffer4; | |
4925 v4 = 0; | |
4926 v3 = 2615; | |
4927 } | |
4928 else | |
4929 { | |
4930 pFront = (IDirectDrawSurface *)a5->pFrontBuffer2; | |
4931 v4 = 0; | |
4932 v3 = 2611; | |
4933 } | |
4934 ErrD3D(pFront->Unlock(0)); | |
4935 } | |
4936 | |
4937 //----- (004A1814) -------------------------------------------------------- | |
4938 void Render::RestoreFrontBuffer() | |
4939 { | |
4940 IDirectDrawSurface **v1; // esi@2 | |
4941 | |
4942 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT | |
4943 || (v1 = (IDirectDrawSurface **)&this->pFrontBuffer2, pVersion->pVersionInfo.dwMajorVersion >= 5u) ) | |
4944 v1 = (IDirectDrawSurface **)&this->pFrontBuffer4; | |
4945 if ( (*v1)->IsLost() == DDERR_SURFACELOST ) | |
4946 (*v1)->Restore(); | |
4947 } | |
4948 | |
4949 //----- (004A184C) -------------------------------------------------------- | |
4950 HRESULT Render::_4A184C() | |
4951 { | |
4952 IDirectDrawSurface **pBack; // esi@2 | |
4953 HRESULT result; // eax@4 | |
4954 | |
4955 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT | |
4956 || (pBack = (IDirectDrawSurface **)&this->pBackBuffer2, pVersion->pVersionInfo.dwMajorVersion != 4) ) | |
4957 pBack = (IDirectDrawSurface **)&this->pBackBuffer4; | |
4958 result = (*pBack)->IsLost(); | |
4959 if ( result == DDERR_SURFACELOST ) | |
4960 result = (*pBack)->Restore(); | |
4961 return result; | |
4962 } | |
4963 | |
4964 //----- (004A1884) -------------------------------------------------------- | |
4965 void Render::PresentRect(RECT *a2, RECT *a3) | |
4966 { | |
4967 IDirectDrawSurface *pFront; // eax@3 | |
4968 HRESULT v4; // eax@5 | |
4969 IDirectDrawSurface *pBack; // [sp-1Ch] [bp-1Ch]@3 | |
4970 struct tagRECT *v6; // [sp-18h] [bp-18h]@3 | |
4971 DWORD v7; // [sp-14h] [bp-14h]@3 | |
4972 DDBLTFX *v8; // [sp-10h] [bp-10h]@3 | |
4973 const char *v9; // [sp-Ch] [bp-Ch]@3 | |
4974 int v10; // [sp-8h] [bp-8h]@3 | |
4975 unsigned int v11; // [sp-4h] [bp-4h]@3 | |
4976 | |
4977 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4978 { | |
4979 v11 = 0; | |
4980 pFront = (IDirectDrawSurface *)this->pFrontBuffer4; | |
4981 v10 = 2657; | |
4982 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp"; | |
4983 v8 = 0; | |
4984 v7 = DDBLT_WAIT; | |
4985 v6 = a3; | |
4986 pBack = (IDirectDrawSurface *)this->pBackBuffer4; | |
4987 } | |
4988 else | |
4989 { | |
4990 v11 = 0; | |
4991 pFront = (IDirectDrawSurface *)this->pFrontBuffer2; | |
4992 v10 = 2653; | |
4993 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp"; | |
4994 v8 = 0; | |
4995 v7 = DDBLT_WAIT; | |
4996 v6 = a3; | |
4997 pBack = (IDirectDrawSurface *)this->pBackBuffer2; | |
4998 } | |
4999 ErrD3D(pFront->Blt(a2, pBack, v6, v7, v8)); | |
5000 } | |
5001 | |
5002 //----- (004A18F5) -------------------------------------------------------- | |
5003 void Render::BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags) | |
5004 { | |
5005 IDirectDrawSurface *pFront; // eax@3 | |
5006 HRESULT v6; // eax@5 | |
5007 int v7; // [sp-8h] [bp-8h]@3 | |
5008 unsigned int v8; // [sp-4h] [bp-4h]@3 | |
5009 | |
5010 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u ) | |
5011 ErrD3D(pFrontBuffer4->Blt(pDstRect, (IDirectDrawSurface4 *)pSrcSurface, pSrcRect, uBltFlags, nullptr)); | |
5012 else | |
5013 ErrD3D(pFrontBuffer2->Blt(pDstRect, (IDirectDrawSurface2 *)pSrcSurface, pSrcRect, uBltFlags, nullptr)); | |
5014 } | |
5015 | |
5016 //----- (004A194A) -------------------------------------------------------- | |
5017 void Render::BltBackToFontFast(int a2, int a3, RECT *a4) | |
5018 { | |
5019 IDirectDrawSurface *pFront; // eax@3 | |
5020 IDirectDrawSurface *pBack; // [sp-Ch] [bp-Ch]@3 | |
5021 | |
5022 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
5023 { | |
5024 pFront = (IDirectDrawSurface *)this->pFrontBuffer4; | |
5025 pBack = (IDirectDrawSurface *)this->pBackBuffer4; | |
5026 } | |
5027 else | |
5028 { | |
5029 pFront = (IDirectDrawSurface *)this->pFrontBuffer2; | |
5030 pBack = (IDirectDrawSurface *)this->pBackBuffer2; | |
5031 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5032 pFront->BltFast(0, 0, pBack, a4, DDBLTFAST_WAIT); |
0 | 5033 } |
5034 | |
5035 //----- (004A1B22) -------------------------------------------------------- | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5036 unsigned int Render::Billboard_ProbablyAddToListAndSortByZOrder(float z) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5037 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5038 //unsigned int v2; // ebx@1 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5039 //double v4; // st7@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5040 //unsigned int v5; // esi@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5041 //int v6; // ecx@5 |
0 | 5042 unsigned int v7; // edx@6 |
5043 char *v8; // ecx@12 | |
5044 void *v9; // edi@16 | |
5045 unsigned int v10; // eax@16 | |
5046 void *v11; // edi@21 | |
5047 unsigned int v12; // eax@21 | |
5048 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5049 //v2 = uNumBillboardsToDraw; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5050 if (uNumBillboardsToDraw >= 999 ) |
0 | 5051 return 0; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5052 if (!uNumBillboardsToDraw) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5053 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5054 uNumBillboardsToDraw = 1; |
0 | 5055 return 0; |
5056 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5057 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5058 //v4 = *(float *)&a1; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5059 //v5 = pRenderer->uNumBillboardsToDraw; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5060 //v6 = 0; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5061 for (int left = 0, right = uNumBillboardsToDraw; left < right; ) // binsearch |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5062 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5063 v7 = left + (right - left) / 2; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5064 if (z <= pRenderer->pBillboardRenderListD3D[v7].z_order) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5065 right = v7; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5066 else |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5067 left = v7 + 1; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5068 } |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5069 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5070 v8 = (char *)&pRenderer->pBillboardRenderListD3D[v7].z_order; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5071 if (z > *(float *)v8 ) |
0 | 5072 { |
5073 if ( v7 == pRenderer->uNumBillboardsToDraw - 1 ) | |
5074 { | |
5075 v7 = pRenderer->uNumBillboardsToDraw; | |
5076 } | |
5077 else | |
5078 { | |
5079 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) | |
5080 { | |
5081 v9 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw]; | |
5082 v10 = pRenderer->uNumBillboardsToDraw - v7; | |
5083 do | |
5084 { | |
5085 memcpy(v9, (char *)v9 - 156, 0x9Cu); | |
5086 v9 = (char *)v9 - 156; | |
5087 --v10; | |
5088 } | |
5089 while ( v10 ); | |
5090 } | |
5091 ++v7; | |
5092 } | |
717 | 5093 //LABEL_23: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5094 uNumBillboardsToDraw++; |
0 | 5095 return v7; |
5096 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5097 if (z <= *(float *)v8 ) |
0 | 5098 { |
5099 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) | |
5100 { | |
5101 v11 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw]; | |
5102 v12 = pRenderer->uNumBillboardsToDraw - v7; | |
5103 do | |
5104 { | |
5105 memcpy(v11, (char *)v11 - 156, 0x9Cu); | |
5106 v11 = (char *)v11 - 156; | |
5107 --v12; | |
5108 } | |
5109 while ( v12 ); | |
5110 } | |
717 | 5111 //goto LABEL_23; |
5112 uNumBillboardsToDraw++; | |
5113 return v7; | |
0 | 5114 } |
5115 return v7; | |
5116 } | |
5117 | |
5118 //----- (004A1E9D) -------------------------------------------------------- | |
5119 unsigned int Render::GetBillboardDrawListSize() | |
5120 { | |
5121 return pRenderer->uNumBillboardsToDraw; | |
5122 } | |
5123 | |
5124 //----- (004A1EA3) -------------------------------------------------------- | |
5125 unsigned int Render::GetParentBillboardID(unsigned int uBillboardID) | |
5126 { | |
5127 return pRenderer->pBillboardRenderListD3D[uBillboardID].uParentBillboardID; | |
5128 } | |
5129 | |
5130 //----- (004A1EB6) -------------------------------------------------------- | |
5131 void Render::BeginSceneD3D() | |
5132 { | |
5133 if (!uNumD3DSceneBegins++) | |
5134 { | |
5135 if (pRenderD3D) | |
5136 { | |
5137 pRenderD3D->ClearTarget(true, 0x00F08020, true, 1.0); | |
5138 pRenderer->uNumBillboardsToDraw = 0; | |
5139 pRenderD3D->pDevice->BeginScene(); | |
1390 | 5140 |
0 | 5141 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
5142 uFogColor = GetLevelFogColor(); | |
5143 else | |
5144 uFogColor = 0; | |
5145 | |
5146 if ( uFogColor & 0xFF000000 ) | |
5147 { | |
5148 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1); | |
5149 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, uFogColor & 0xFFFFFF); | |
5150 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); | |
5151 bUsingSpecular = true; | |
5152 } | |
5153 else | |
5154 { | |
5155 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0); | |
5156 bUsingSpecular = 0; | |
5157 } | |
5158 } | |
5159 else | |
5160 { | |
5161 LockRenderSurface((void **)&pTargetSurface, &uTargetSurfacePitch); | |
5162 if (pTargetSurface) | |
5163 field_18_locked_pitch = uTargetSurfacePitch; | |
5164 else | |
5165 --uNumD3DSceneBegins; | |
5166 } | |
5167 } | |
5168 } | |
5169 | |
5170 //----- (004A1FE1) -------------------------------------------------------- | |
5171 void Render::DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene() | |
5172 { | |
5173 --uNumD3DSceneBegins; | |
5174 if (uNumD3DSceneBegins) | |
5175 return; | |
5176 | |
5177 if (pRenderD3D) | |
5178 { | |
5179 pGame->draw_debug_outlines(); | |
161 | 5180 DoRenderBillboards_D3D(); |
0 | 5181 pGame->pStru6Instance->RenderSpecialEffects(); |
5182 pRenderD3D->pDevice->EndScene(); | |
5183 } | |
5184 else | |
5185 pGame->pStru6Instance->RenderSpecialEffects(); | |
5186 } | |
5187 | |
5188 //----- (004A2031) -------------------------------------------------------- | |
349 | 5189 unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) |
5190 { | |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
5191 // __debugbreak(); // should not fire outside decal builder |
349 | 5192 return ::GetActorTintColor(tint, a4, a2, a5, a6); |
0 | 5193 } |
5194 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
5195 /*void Render::DrawTerrainPolygon_new(Polygon *a3, IDirect3DTexture2 *pTexture)//new function |
86 | 5196 { |
5197 int v5; // ebx@1 | |
5198 int v6; // edi@1 | |
5199 int v8; // eax@7 | |
5200 float v9; // eax@12 | |
5201 float *v10; // esi@12 | |
5202 float v11; // ecx@14 | |
5203 double v12; // st7@14 | |
5204 double v13; // st7@14 | |
5205 double v14; // st7@14 | |
5206 signed int v15; // eax@14 | |
5207 int v16; // eax@15 | |
5208 float v17; // ST48_4@15 | |
5209 char v18; // zf@17 | |
5210 int v19; // eax@18 | |
5211 int v20; // eax@18 | |
5212 int v21; // edx@20 | |
5213 signed int v22; // ecx@20 | |
5214 int v23; // eax@20 | |
5215 const char *v24; // ST4C_4@20 | |
5216 unsigned int v25; // ST50_4@20 | |
5217 int v26; // ST54_4@20 | |
5218 int v27; // eax@20 | |
5219 _UNKNOWN *v28; // eax@21 | |
5220 int v29; // ecx@23 | |
5221 int v30; // eax@23 | |
5222 int v31; // eax@23 | |
5223 int v32; // eax@24 | |
5224 int v33; // eax@25 | |
5225 int v34; // eax@25 | |
5226 int v35; // eax@25 | |
5227 int v36; // eax@25 | |
5228 signed int v37; // ecx@26 | |
5229 int v38; // eax@26 | |
5230 _UNKNOWN *v39; // eax@27 | |
5231 int v40; // edx@28 | |
5232 int v41; // eax@29 | |
5233 int v42; // eax@29 | |
5234 int v43; // eax@29 | |
5235 int v44; // eax@29 | |
5236 unsigned int v46; // eax@29 | |
5237 int v47; // eax@30 | |
5238 int v48; // eax@30 | |
5239 int v49; // eax@30 | |
5240 double v52; // st6@35 | |
5241 const char *v55; // [sp+4Ch] [bp-1Ch]@20 | |
5242 int v57; // [sp+5Ch] [bp-Ch]@3 | |
5243 signed int v59; // [sp+60h] [bp-8h]@12 | |
5244 int v61; // [sp+64h] [bp-4h]@4 | |
5245 int i; | |
5246 | |
5247 v6 = (int)this; | |
5248 v5 = 0; | |
5249 if (!this->uNumD3DSceneBegins) | |
5250 return; | |
5251 | |
5252 | |
5253 | |
5254 | |
186 | 5255 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
86 | 5256 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); |
5257 if (this->bUsingSpecular) | |
5258 { | |
186 | 5259 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
5260 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); | |
5261 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | |
86 | 5262 } |
5263 | |
5264 pVertices[0].pos.x = array_50AC10[0].vWorldViewProjX; | |
5265 pVertices[0].pos.y = array_50AC10[0].vWorldViewProjY; | |
5266 pVertices[0].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[0].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); | |
5267 pVertices[0].rhw = 1.0 / (array_50AC10[0].vWorldViewPosition.x + 0.0000001000000011686097); | |
5268 pVertices[0].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); | |
5269 pVertices[0].specular = 0; | |
5270 pVertices[0].texcoord.x = array_50AC10[0].u; | |
5271 pVertices[0].texcoord.y = array_50AC10[0].v; | |
5272 | |
5273 pVertices[1].pos.x = array_50AC10[3].vWorldViewProjX; | |
5274 pVertices[1].pos.y = array_50AC10[3].vWorldViewProjY; | |
5275 pVertices[1].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[3].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); | |
5276 pVertices[1].rhw = 1.0 / (array_50AC10[3].vWorldViewPosition.x + 0.0000001000000011686097); | |
5277 pVertices[1].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[3].vWorldViewPosition.x, 0, 0); | |
5278 pVertices[1].specular = 0; | |
5279 pVertices[1].texcoord.x = array_50AC10[3].u; | |
5280 pVertices[1].texcoord.y = array_50AC10[3].v; | |
5281 | |
5282 pVertices[2].pos.x = array_50AC10[1].vWorldViewProjX; | |
5283 pVertices[2].pos.y = array_50AC10[1].vWorldViewProjY; | |
5284 pVertices[2].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[1].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); | |
5285 pVertices[2].rhw = 1.0 / (array_50AC10[1].vWorldViewPosition.x + 0.0000001000000011686097); | |
5286 pVertices[2].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[1].vWorldViewPosition.x, 0, 0); | |
5287 pVertices[2].specular = 0; | |
5288 pVertices[2].texcoord.x = array_50AC10[1].u; | |
5289 pVertices[2].texcoord.y = array_50AC10[1].v; | |
5290 | |
5291 memcpy(pVertices + 3, pVertices + 2, sizeof(RenderVertexD3D3)); | |
5292 memcpy(pVertices + 4, pVertices + 1, sizeof(RenderVertexD3D3)); | |
5293 | |
5294 pVertices[5].pos.x = array_50AC10[2].vWorldViewProjX; | |
5295 pVertices[5].pos.y = array_50AC10[2].vWorldViewProjY; | |
5296 pVertices[5].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[2].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); | |
5297 pVertices[5].rhw = 1.0 / (array_50AC10[2].vWorldViewPosition.x + 0.0000001000000011686097); | |
5298 pVertices[5].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[2].vWorldViewPosition.x, 0, 0); | |
5299 pVertices[5].specular = 0; | |
5300 pVertices[5].texcoord.x = array_50AC10[2].u; | |
5301 pVertices[5].texcoord.y = array_50AC10[2].v; | |
5302 | |
5303 | |
5304 this->pRenderD3D->pDevice->SetTexture(0, pTexture); | |
5305 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, 6, D3DDP_DONOTLIGHT); | |
5306 | |
186 | 5307 }*/ |
5308 | |
0 | 5309 //----- (004A26BC) -------------------------------------------------------- |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
5310 void Render::DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders) |
186 | 5311 { |
5312 //RenderVertexSoft *pVertices; // esi@0 | |
5313 //int v7; // edi@1 | |
0 | 5314 unsigned int v8; // ebx@1 |
5315 LightmapBuilder *v9; // esi@3 | |
5316 unsigned int v10; // edx@3 | |
5317 int v11; // eax@5 | |
5318 int v12; // eax@11 | |
5319 char *v13; // esi@11 | |
5320 double v14; // st7@13 | |
5321 double v15; // st7@13 | |
5322 signed int v16; // eax@13 | |
5323 int v17; // ecx@13 | |
5324 double v18; // st7@13 | |
5325 float v19; // ST78_4@14 | |
5326 int v20; // eax@14 | |
5327 char v21; // zf@16 | |
5328 HRESULT v22; // eax@17 | |
5329 HRESULT v23; // eax@17 | |
5330 HRESULT v24; // eax@19 | |
5331 HRESULT v25; // eax@19 | |
5332 unsigned int v26; // ecx@19 | |
5333 char *v27; // eax@20 | |
5334 HRESULT v28; // eax@22 | |
5335 HRESULT v29; // eax@22 | |
5336 HRESULT v30; // eax@23 | |
5337 HRESULT v31; // eax@24 | |
5338 HRESULT v32; // eax@24 | |
5339 HRESULT v33; // eax@24 | |
5340 HRESULT v34; // eax@24 | |
5341 HRESULT v35; // eax@25 | |
5342 HRESULT v36; // eax@25 | |
5343 unsigned int v37; // ecx@25 | |
5344 char *v38; // eax@26 | |
5345 int v39; // edx@27 | |
5346 HRESULT v40; // eax@28 | |
5347 HRESULT v41; // eax@28 | |
5348 HRESULT v42; // eax@28 | |
5349 HRESULT v43; // eax@28 | |
5350 //IDirect3DDevice3Vtbl *v44; // ebx@28 | |
5351 unsigned int v45; // eax@28 | |
5352 HRESULT v46; // eax@29 | |
5353 HRESULT v47; // eax@29 | |
5354 HRESULT v48; // eax@29 | |
186 | 5355 //IDirect3DDevice3 *v49; // eax@35 |
0 | 5356 //IDirect3DDevice3Vtbl *v50; // ecx@35 |
5357 int v51; // eax@40 | |
5358 char *v52; // esi@40 | |
5359 double v53; // st7@42 | |
5360 double v54; // st7@42 | |
5361 signed int v55; // eax@42 | |
5362 int v56; // ecx@42 | |
5363 double v57; // st7@42 | |
5364 float v58; // ST7C_4@43 | |
5365 int v59; // eax@43 | |
186 | 5366 //signed int v60; // [sp+78h] [bp-14h]@31 |
5367 //RenderVertexSoft *v61; // [sp+7Ch] [bp-10h]@3 | |
0 | 5368 const char *v62; // [sp+80h] [bp-Ch]@0 |
5369 const char *v63; // [sp+80h] [bp-Ch]@19 | |
5370 int v64; // [sp+84h] [bp-8h]@0 | |
5371 LightmapBuilder *v65; // [sp+88h] [bp-4h]@3 | |
5372 unsigned int v66; // [sp+88h] [bp-4h]@40 | |
5373 unsigned int a6a; // [sp+A0h] [bp+14h]@11 | |
186 | 5374 int a7; |
5375 | |
5376 //v7 = (int)this; | |
0 | 5377 v8 = 0; |
186 | 5378 if (!this->uNumD3DSceneBegins) |
75 | 5379 return; |
5380 if ( uNumVertices < 3) | |
5381 return; | |
5382 | |
186 | 5383 //v61 = pVertices; |
5384 | |
75 | 5385 /* v9 = pGame->pLightmapBuilder; |
0 | 5386 v65 = v9; |
75 | 5387 v10 = v9->std__vector_000004_size;*/ |
1394 | 5388 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) |
0 | 5389 { |
638 | 5390 v11 = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); |
1394 | 5391 pGame->pLightmapBuilder->DrawLightmaps(/*v11, 0*/); |
0 | 5392 } |
5393 else | |
5394 { | |
186 | 5395 if (transparent || !pGame->pLightmapBuilder->std__vector_000004_size || |
75 | 5396 byte_4D864C && pGame->uFlags & 2 ) |
5397 { | |
186 | 5398 if (clampAtTextureBorders) |
5399 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP); | |
0 | 5400 else |
186 | 5401 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
5402 | |
5403 if (transparent || this->bUsingSpecular) | |
5404 { | |
5405 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); | |
5406 if (transparent) | |
0 | 5407 { |
186 | 5408 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA); |
5409 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA); | |
5410 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO); | |
5411 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); | |
0 | 5412 } |
5413 else | |
5414 { | |
186 | 5415 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); |
5416 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | |
0 | 5417 } |
186 | 5418 } |
1073 | 5419 |
5420 for (uint i = 0; i < uNumVertices; ++i) | |
5421 { | |
5422 | |
5423 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
5424 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
5425 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); | |
5426 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
5427 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
5428 if ( this->bUsingSpecular ) | |
0 | 5429 { |
1073 | 5430 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 5431 } |
1073 | 5432 else |
5433 { | |
5434 d3d_vertex_buffer[i].specular = 0; | |
5435 } | |
5436 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
5437 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
5438 } | |
5439 | |
5440 this->pRenderD3D->pDevice->SetTexture(0, a5); | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5441 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer, uNumVertices, 16); |
186 | 5442 if (transparent) |
5443 { | |
5444 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
5445 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
5446 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 5447 } |
5448 } | |
5449 else | |
5450 { | |
1073 | 5451 for (uint i = 0; i < uNumVertices; ++i) |
5452 { | |
5453 | |
5454 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
5455 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
5456 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); | |
5457 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
5458 d3d_vertex_buffer[i].diffuse = GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
5459 if ( this->bUsingSpecular ) | |
0 | 5460 { |
1073 | 5461 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 5462 } |
1073 | 5463 else |
5464 { | |
5465 d3d_vertex_buffer[i].specular = 0; | |
5466 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
5467 __debugbreak(); // warning C4700: uninitialized local variable 'v20' used |
1073 | 5468 d3d_vertex_buffer[i].specular = v20; |
5469 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
5470 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
5471 } | |
186 | 5472 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
5473 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
5474 if (pRenderer->bUsingSpecular) | |
5475 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); | |
0 | 5476 |
5477 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | |
186 | 5478 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
0 | 5479 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5480 d3d_vertex_buffer, |
0 | 5481 uNumVertices, |
5482 16)); | |
5483 //v63 = (const char *)v7->pRenderD3D->pDevice; | |
186 | 5484 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
0 | 5485 //(*(void (**)(void))(*(int *)v63 + 88))(); |
1394 | 5486 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
1073 | 5487 for (uint i = 0; i < uNumVertices; ++i) |
5488 { | |
5489 d3d_vertex_buffer[i].diffuse = -1; | |
5490 } | |
0 | 5491 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); |
186 | 5492 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 5493 if ( !pRenderer->bUsingSpecular ) |
5494 { | |
186 | 5495 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
5496 } | |
5497 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
5498 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
5499 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
5500 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
0 | 5501 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5502 d3d_vertex_buffer, |
0 | 5503 uNumVertices, |
5504 16)); | |
5505 if ( pRenderer->bUsingSpecular ) | |
5506 { | |
186 | 5507 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
0 | 5508 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); |
1073 | 5509 for (uint i = 0; i < uNumVertices; ++i) |
5510 { | |
5511 d3d_vertex_buffer[i].diffuse = pRenderer->uFogColor | d3d_vertex_buffer[i].specular & 0xFF000000; | |
5512 d3d_vertex_buffer[i].specular = 0; | |
5513 } | |
5514 | |
75 | 5515 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem |
186 | 5516 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
5517 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); | |
5518 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
0 | 5519 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5520 d3d_vertex_buffer, |
0 | 5521 uNumVertices, |
5522 16)); | |
186 | 5523 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 5524 //v44 = pRenderer->pRenderD3D->pDevice; |
5525 v45 = GetLevelFogColor(); | |
5526 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, v45 & 0xFFFFFF)); | |
5527 v8 = 0; | |
5528 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
5529 } | |
186 | 5530 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
5531 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 5532 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v8)); |
5533 } | |
5534 } | |
186 | 5535 |
791 | 5536 if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES || pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES) |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5537 pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); |
0 | 5538 } |
5539 // 4A26BC: could not find valid save-restore pair for esi | |
5540 // 4D864C: using guessed type char byte_4D864C; | |
5541 | |
5542 //----- (004A2DA3) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
5543 void Render::DrawSkyPolygon(unsigned int uNumVertices, struct Polygon *a3, IDirect3DTexture2 *pTexture) |
852 | 5544 { |
67 | 5545 int v7; // eax@7 |
0 | 5546 float v13; // ST3C_4@8 |
67 | 5547 int i; |
5548 | |
5549 if ( !this->uNumD3DSceneBegins ) | |
5550 return; | |
5551 if ( uNumVertices >= 3 ) | |
5552 { | |
186 | 5553 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
67 | 5554 if ( this->bUsingSpecular ) |
5555 { | |
186 | 5556 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
5557 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); | |
5558 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | |
67 | 5559 } |
840 | 5560 for ( i = 0; i < uNumVertices; ++i ) |
67 | 5561 { |
5562 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
5563 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
5564 pVertices[i].pos.z = 0.99989998; | |
168 | 5565 pVertices[i].rhw = array_50AC10[i]._rhw; |
67 | 5566 |
840 | 5567 pVertices[i].diffuse = ::GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); |
67 | 5568 v7 = 0; |
5569 if (this->bUsingSpecular) | |
5570 { | |
5571 v13 = array_50AC10[i].vWorldViewPosition.x; | |
5572 v7 = sub_47C3D7_get_fog_related_stuff(0, 1, v13); | |
5573 } | |
5574 pVertices[i].specular = v7; | |
5575 pVertices[i].texcoord.x = array_50AC10[i].u; | |
5576 pVertices[i].texcoord.y = array_50AC10[i].v; | |
5577 } | |
5578 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture); | |
5579 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
840 | 5580 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); |
0 | 5581 } |
5582 } | |
5583 | |
5584 //----- (004A2ED5) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
5585 void Render::_4A2ED5(signed int a2, struct Polygon *a3, IDirect3DTexture2 *pHwTex) |
0 | 5586 { |
5587 signed int v4; // edi@2 | |
5588 int v5; // eax@3 | |
5589 int v6; // edx@5 | |
1072 | 5590 RenderVertexD3D3 *v7; // eax@6 |
5591 RenderVertexSoft *v8; // ecx@6 | |
5592 //double v9; // st6@7 | |
5593 //int v10; // ebx@7 | |
5594 //int v11; // ebx@7 | |
0 | 5595 |
5596 if ( this->uNumD3DSceneBegins ) | |
5597 { | |
5598 v4 = a2; | |
5599 if ( a2 >= 3 ) | |
5600 { | |
186 | 5601 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
638 | 5602 v5 = 31 - (a3->dimming_level & 0x1F); |
5603 if ( v5 < pOutdoor->max_terrain_dimming_level ) | |
5604 v5 = pOutdoor->max_terrain_dimming_level; | |
0 | 5605 v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); |
1072 | 5606 for (uint i = 0; i < a2; ++i) |
5607 { | |
5608 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | |
5609 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
5610 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / array_507D30[i].vWorldViewPosition.y; | |
5611 d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw; | |
5612 d3d_vertex_buffer[i].diffuse = v6; | |
5613 d3d_vertex_buffer[i].specular = 0; | |
5614 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u; | |
5615 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v; | |
5616 } | |
5617 | |
0 | 5618 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
186 | 5619 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
0 | 5620 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5621 d3d_vertex_buffer, |
0 | 5622 a2, |
5623 28)); | |
5624 } | |
5625 } | |
5626 } | |
5627 | |
1390 | 5628 |
5629 //----- (00479A53) -------------------------------------------------------- | |
5630 void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID) | |
5631 { | |
5632 BLVFace *pFace; // esi@1 | |
5633 unsigned int v3; // edi@1 | |
5634 PolygonType v4; // al@1 | |
5635 double v5; // st7@3 | |
5636 signed __int64 v6; // qax@3 | |
5637 PolygonType v7; // cl@3 | |
5638 int v8; // esi@7 | |
5639 int v9; // eax@7 | |
5640 unsigned int v10; // eax@7 | |
5641 double v11; // st6@7 | |
5642 int v12; // edx@7 | |
5643 int v13; // eax@7 | |
5644 char *v14; // esi@8 | |
5645 void *v15; // ecx@9 | |
5646 int v16; // eax@9 | |
5647 int v17; // edi@9 | |
5648 double v18; // st7@9 | |
5649 signed int v19; // ebx@9 | |
5650 void *v20; // ecx@9 | |
5651 int v21; // ebx@11 | |
5652 int v22; // eax@14 | |
5653 signed __int64 v23; // qtt@16 | |
5654 double v24; // st7@16 | |
5655 unsigned __int8 v25; // sf@16 | |
5656 unsigned __int8 v26; // of@16 | |
5657 Render *v27; // ecx@17 | |
5658 double v28; // st7@20 | |
5659 char *v29; // ebx@20 | |
5660 char *v30; // edx@20 | |
5661 unsigned __int8 v31; // c0@21 | |
5662 unsigned __int8 v32; // c3@21 | |
5663 double v33; // st6@23 | |
5664 char *v34; // esi@30 | |
5665 const void *v35; // ecx@31 | |
5666 int v36; // eax@31 | |
5667 const void *v37; // edi@31 | |
5668 signed __int64 v38; // qax@31 | |
5669 int v39; // ecx@31 | |
5670 int v40; // ebx@33 | |
5671 int v41; // eax@36 | |
5672 signed __int64 v42; // qtt@39 | |
5673 int v43; // eax@39 | |
5674 char v44; // zf@39 | |
5675 double v45; // st7@39 | |
5676 double v46; // st7@39 | |
5677 unsigned int v47; // edx@40 | |
5678 double v48; // st7@41 | |
5679 RenderVertexSoft *v49; // ebx@41 | |
5680 void *v50; // edi@43 | |
5681 double v51; // st7@46 | |
5682 RenderVertexSoft *v52; // edx@46 | |
5683 void *v53; // edi@48 | |
5684 char *v54; // ebx@52 | |
5685 unsigned int v55; // eax@53 | |
5686 unsigned int v56; // eax@55 | |
5687 int v57; // ST10_4@55 | |
5688 Texture *v58; // eax@55 | |
5689 signed int v59; // [sp-4h] [bp-178h]@17 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
5690 struct Polygon *v60; // [sp+0h] [bp-174h]@17 |
1390 | 5691 IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
5692 struct Polygon v62; // [sp+14h] [bp-160h]@6 |
1390 | 5693 unsigned int v63; // [sp+120h] [bp-54h]@7 |
5694 double v64; // [sp+124h] [bp-50h]@7 | |
5695 unsigned int v65; // [sp+128h] [bp-4Ch]@1 | |
5696 unsigned int v66; // [sp+12Ch] [bp-48h]@7 | |
5697 float v67; // [sp+130h] [bp-44h]@7 | |
5698 __int64 v68; // [sp+134h] [bp-40h]@3 | |
5699 __int64 v69; // [sp+13Ch] [bp-38h]@3 | |
5700 int v70; // [sp+144h] [bp-30h]@3 | |
5701 int X; // [sp+148h] [bp-2Ch]@9 | |
5702 int v72; // [sp+14Ch] [bp-28h]@7 | |
5703 float v73; // [sp+150h] [bp-24h]@16 | |
5704 unsigned int v74; // [sp+154h] [bp-20h]@3 | |
5705 RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3 | |
5706 float v76; // [sp+15Ch] [bp-18h]@9 | |
5707 int v77; // [sp+160h] [bp-14h]@9 | |
5708 int v78; // [sp+164h] [bp-10h]@7 | |
5709 void *v79; // [sp+168h] [bp-Ch]@9 | |
5710 float v80; // [sp+16Ch] [bp-8h]@3 | |
5711 const void *v81; // [sp+170h] [bp-4h]@7 | |
5712 | |
5713 __debugbreak(); | |
5714 | |
5715 pFace = &pIndoor->pFaces[uFaceID]; | |
5716 v65 = uFaceID; | |
5717 v3 = uNumVertices; | |
5718 v4 = pFace->uPolygonType; | |
5719 if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor ) | |
5720 { | |
5721 if ( (signed int)uNumVertices > 0 ) | |
5722 { | |
5723 v54 = (char *)&array_507D30[0].u; | |
5724 LODWORD(v80) = uNumVertices; | |
5725 do | |
5726 { | |
5727 v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x; | |
5728 *(float *)v54 = (double)v69 + *(float *)v54; | |
5729 *(float *)v54 = *(float *)v54 * 0.25; | |
5730 v55 = GetTickCount(); | |
5731 v54 += 48; | |
5732 v44 = LODWORD(v80)-- == 1; | |
5733 v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5); | |
5734 *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; | |
5735 } | |
5736 while ( !v44 ); | |
5737 uFaceID = v65; | |
5738 } | |
5739 v56 = 8 * uFaceID; | |
5740 LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); | |
5741 v57 = v56; | |
5742 v58 = pFace->GetTexture(); | |
5743 pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); | |
5744 return; | |
5745 } | |
5746 HIDWORD(v69) = pIndoorCamera->sRotationX; | |
5747 HIDWORD(v68) = pIndoorCamera->pos.z; | |
5748 *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; | |
5749 v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z) | |
5750 / (((double)pBLVRenderParams->field_40 + 16192.0) | |
5751 * 65536.0) | |
5752 + *(float *)&v74); | |
5753 v5 = (double)pIndoorCamera->sRotationX * 0.0030664064; | |
5754 *(float *)&v75 = v5; | |
5755 v80 = cos(v5) * 16192.0; | |
5756 v6 = (signed __int64)(*(float *)&v74 | |
5757 - (double)pBLVRenderParams->field_40 | |
5758 / ((v80 + 0.0000001) | |
5759 * 65535.0) | |
5760 * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68))); | |
5761 v7 = pFace->uPolygonType; | |
5762 if ( v7 == 4 || v7 == 3 ) | |
5763 v70 = v6; | |
5764 stru_8019C8._48653D(65536, 0, 0, 0, 65536, 0); | |
5765 v62._48607B(&stru_8019C8); | |
5766 v62.uTileBitmapID = pFace->uBitmapID; | |
5767 v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); | |
5768 if ( !v62.pTexture ) | |
5769 return; | |
5770 v8 = pBLVRenderParams->sPartyRotX; | |
5771 v62.dimming_level = 0; | |
5772 v62.uNumVertices = v3; | |
5773 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); | |
5774 v62.v_18.y = 0; | |
5775 v62.v_18.x = -v9; | |
5776 v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); | |
5777 v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; | |
5778 memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); | |
5779 LODWORD(v80) = v10; | |
5780 v62.field_24 = 33554432; | |
5781 v64 = (double)(signed int)v10 * 0.5; | |
5782 v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); | |
5783 LODWORD(v80) = v62.pTexture->uTextureWidth; | |
5784 v11 = 1.0 / (double)SLODWORD(v80); | |
5785 LODWORD(v80) = v62.pTexture->uTextureHeight; | |
5786 v12 = v62.pTexture->uWidthMinus1; | |
5787 v13 = v62.pTexture->uHeightMinus1; | |
5788 v67 = v11; | |
5789 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; | |
5790 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; | |
5791 v78 = 0; | |
5792 v81 = 0; | |
5793 *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80); | |
5794 if ( (signed int)v62.uNumVertices <= 0 ) | |
5795 { | |
5796 LABEL_17: | |
5797 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; | |
5798 v27 = pRenderer; | |
5799 v60 = &v62; | |
5800 v59 = v62.uNumVertices; | |
5801 goto LABEL_18; | |
5802 } | |
5803 v14 = (char *)&array_507D30[0].vWorldViewProjY; | |
5804 while ( 2 ) | |
5805 { | |
5806 v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14)); | |
5807 LODWORD(v80) = v62.ptr_38->field_14; | |
5808 v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; | |
5809 v16 = v77 + v62.ptr_38->field_C; | |
5810 v77 = (int)v15; | |
5811 v74 = v16; | |
5812 LODWORD(v80) = v62.ptr_38->field_20; | |
5813 v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; | |
5814 v79 = v15; | |
5815 v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18); | |
5816 LODWORD(v80) = v62.v_18.z; | |
5817 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16); | |
5818 v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1)); | |
5819 v18 = *(float *)v14 - 1.0; | |
5820 v19 = -v62.field_24; | |
5821 v77 = -v62.field_24; | |
5822 X = (int)((char *)v79 + v62.v_18.x); | |
5823 LODWORD(v76) = (signed __int64)v18; | |
5824 v20 = (void *)(v72 * (v70 - LODWORD(v76))); | |
5825 while ( 1 ) | |
5826 { | |
5827 v79 = v20; | |
5828 if ( !X ) | |
5829 goto LABEL_14; | |
5830 v21 = abs(v19 >> 14); | |
5831 if ( v21 <= abs(X) ) | |
5832 break; | |
5833 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) | |
5834 break; | |
5835 v19 = v77; | |
5836 v20 = v79; | |
5837 LABEL_14: | |
5838 LODWORD(v80) = v62.v_18.z; | |
5839 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16); | |
5840 v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16; | |
5841 --LODWORD(v76); | |
5842 v20 = (char *)v20 + v72; | |
5843 X = v22 + v62.v_18.x; | |
5844 v78 = 1; | |
5845 } | |
5846 if ( !v78 ) | |
5847 { | |
5848 LODWORD(v23) = v77 << 16; | |
5849 HIDWORD(v23) = v77 >> 16; | |
5850 v79 = (void *)(v23 / X); | |
5851 v77 = v17; | |
5852 LODWORD(v80) = v62.ptr_38->field_10; | |
5853 v77 = v17; | |
5854 LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16); | |
5855 LODWORD(v80) = v62.ptr_38->field_1C; | |
5856 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16)); | |
5857 v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; | |
5858 LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; | |
5859 v14 += 48; | |
5860 LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); | |
5861 v81 = (char *)v81 + 1; | |
5862 v24 = (double)SLODWORD(v80) * 0.000015259022; | |
5863 LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); | |
5864 v26 = __OFSUB__((int)v81, v62.uNumVertices); | |
5865 v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0; | |
5866 *((float *)v14 - 10) = v24 * v67; | |
5867 *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1); | |
5868 *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79; | |
5869 if ( !(v25 ^ v26) ) | |
5870 goto LABEL_17; | |
5871 continue; | |
5872 } | |
5873 break; | |
5874 } | |
5875 LODWORD(v73) = 0; | |
5876 v80 = v76; | |
5877 if ( (signed int)v62.uNumVertices > 0 ) | |
5878 { | |
5879 v28 = (double)SLODWORD(v76); | |
5880 LODWORD(v76) = (int)(char *)array_50AC10 + 28; | |
5881 v29 = (char *)&array_50AC10[0].vWorldViewProjX; | |
5882 v30 = (char *)&array_507D30[1].vWorldViewProjY; | |
5883 v79 = array_50AC10; | |
5884 v81 = array_507D30; | |
5885 v78 = v62.uNumVertices; | |
5886 do | |
5887 { | |
5888 v31 = v28 < *((float *)v30 - 12); | |
5889 v32 = v28 == *((float *)v30 - 12); | |
5890 ++LODWORD(v73); | |
5891 memcpy(v79, v81, 0x30u); | |
5892 v79 = (char *)v79 + 48; | |
5893 LODWORD(v76) += 48; | |
5894 v29 += 48; | |
5895 if ( v31 | v32 || v28 >= *(float *)v30 ) | |
5896 { | |
5897 if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 ) | |
5898 goto LABEL_28; | |
5899 v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12)) | |
5900 + *((float *)v30 - 1); | |
5901 } | |
5902 else | |
5903 { | |
5904 v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30) | |
5905 + *((float *)v30 - 13); | |
5906 } | |
5907 *(float *)v29 = v33; | |
5908 v79 = (char *)v79 + 48; | |
5909 v29 += 48; | |
5910 ++LODWORD(v73); | |
5911 *(unsigned int *)LODWORD(v76) = v28; | |
5912 LODWORD(v76) += 48; | |
5913 LABEL_28: | |
5914 v81 = (char *)v81 + 48; | |
5915 v30 += 48; | |
5916 --v78; | |
5917 } | |
5918 while ( v78 ); | |
5919 } | |
5920 if ( SLODWORD(v73) <= 0 ) | |
5921 goto LABEL_40; | |
5922 v34 = (char *)&array_50AC10[0].vWorldViewProjY; | |
5923 v65 = v77 >> 14; | |
5924 HIDWORD(v69) = LODWORD(v73); | |
5925 do | |
5926 { | |
5927 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); | |
5928 v78 = v62.ptr_38->field_14; | |
5929 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); | |
5930 v36 = (int)((char *)v81 + v62.ptr_38->field_C); | |
5931 v81 = v35; | |
5932 v74 = v36; | |
5933 v78 = v62.ptr_38->field_20; | |
5934 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); | |
5935 v78 = (int)v35; | |
5936 v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->field_18); | |
5937 v81 = (const void *)v62.v_18.z; | |
5938 v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16; | |
5939 v37 = (const void *)(v72 | |
5940 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); | |
5941 v38 = (signed __int64)(*(float *)v34 - 1.0); | |
5942 v81 = 0; | |
5943 LODWORD(v76) = v38; | |
5944 v39 = v72 * (v70 - v38); | |
5945 while ( 1 ) | |
5946 { | |
5947 v78 = v39; | |
5948 if ( !X ) | |
5949 goto LABEL_36; | |
5950 v40 = abs(X); | |
5951 if ( abs((signed __int64)v65) <= v40 ) | |
5952 break; | |
5953 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) | |
5954 break; | |
5955 v39 = v78; | |
5956 LABEL_36: | |
5957 v78 = v62.v_18.z; | |
5958 v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; | |
5959 --LODWORD(v76); | |
5960 v39 += v72; | |
5961 X = v41 + v62.v_18.x; | |
5962 v81 = (const void *)1; | |
5963 } | |
5964 if ( v81 ) | |
5965 { | |
5966 v79 = (void *)v62.v_18.z; | |
5967 v78 = 2 * LODWORD(v76); | |
5968 v81 = (const void *)((unsigned __int64)(v62.v_18.z | |
5969 * (signed __int64)(signed int)(signed __int64)(((double)v70 | |
5970 - ((double)(2 * LODWORD(v76)) | |
5971 - *(float *)v34)) | |
5972 * (double)v72)) >> 16); | |
5973 X = (int)((char *)v81 + v62.v_18.x); | |
5974 } | |
5975 LODWORD(v42) = v77 << 16; | |
5976 HIDWORD(v42) = v77 >> 16; | |
5977 v79 = (void *)(v42 / X); | |
5978 v81 = v37; | |
5979 v78 = v62.ptr_38->field_10; | |
5980 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); | |
5981 v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); | |
5982 v74 = (unsigned int)v37; | |
5983 LODWORD(v76) = v43; | |
5984 v78 = v62.ptr_38->field_1C; | |
5985 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); | |
5986 v74 = (unsigned __int64)(v43 * v42 / X) >> 16; | |
5987 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); | |
5988 v34 += 48; | |
5989 v78 = v66 + ((signed int)v74 >> 4); | |
5990 v44 = HIDWORD(v69)-- == 1; | |
5991 v45 = (double)v78 * 0.000015259022; | |
5992 v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); | |
5993 *((float *)v34 - 10) = v45 * v67; | |
5994 *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1); | |
5995 v46 = (double)(signed int)v79; | |
5996 *((float *)v34 - 16) = 0.000015258789 * v46; | |
5997 *((float *)v34 - 11) = 65536.0 / v46; | |
5998 } | |
5999 while ( !v44 ); | |
6000 LABEL_40: | |
6001 v47 = 0; | |
6002 if ( SLODWORD(v73) > 0 ) | |
6003 { | |
6004 v48 = (double)SLODWORD(v80); | |
6005 v75 = array_507D30; | |
6006 v49 = array_50AC10; | |
6007 HIDWORD(v69) = LODWORD(v73); | |
6008 do | |
6009 { | |
6010 if ( v48 >= v49->vWorldViewProjY ) | |
6011 { | |
6012 v50 = v75; | |
6013 ++v47; | |
6014 ++v75; | |
6015 memcpy(v50, v49, 0x30u); | |
6016 } | |
6017 ++v49; | |
6018 --HIDWORD(v69); | |
6019 } | |
6020 while ( HIDWORD(v69) ); | |
6021 } | |
6022 v62.uNumVertices = v47; | |
6023 pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]); | |
6024 *(float *)&v74 = 0.0; | |
6025 if ( SLODWORD(v73) > 0 ) | |
6026 { | |
6027 v51 = (double)SLODWORD(v80); | |
6028 v75 = array_507D30; | |
6029 v52 = array_50AC10; | |
6030 v80 = v73; | |
6031 do | |
6032 { | |
6033 if ( v51 <= v52->vWorldViewProjY ) | |
6034 { | |
6035 v53 = v75; | |
6036 ++v74; | |
6037 ++v75; | |
6038 memcpy(v53, v52, 0x30u); | |
6039 } | |
6040 ++v52; | |
6041 --LODWORD(v80); | |
6042 } | |
6043 while ( v80 != 0.0 ); | |
6044 } | |
6045 v62.uNumVertices = v74; | |
6046 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; | |
6047 v60 = &v62; | |
6048 v59 = v74; | |
6049 v27 = pRenderer; | |
6050 LABEL_18: | |
6051 v27->_4A2ED5(v59, v60, v61); | |
6052 } | |
6053 | |
6054 | |
0 | 6055 //----- (004A2FC0) -------------------------------------------------------- |
6056 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) | |
6057 { | |
6058 //Render *v8; // edi@1 | |
6059 //unsigned int v9; // esi@3 | |
1072 | 6060 RenderVertexSoft *v12; // ecx@9 |
6061 RenderVertexD3D3 *v13; // eax@9 | |
0 | 6062 double v14; // st6@10 |
6063 int v15; // edx@10 | |
6064 Texture *v16; // edx@10 | |
6065 double v17; // st6@10 | |
6066 //char v18; // zf@10 | |
6067 Texture *v19; // edx@10 | |
595 | 6068 //Texture *v23; // edx@16 |
6069 //char *v24; // ecx@16 | |
6070 //char *v25; // eax@16 | |
6071 //double v26; // st6@17 | |
6072 //int v27; // esi@17 | |
6073 //double v28; // st6@17 | |
6074 //unsigned int v33; // ecx@18 | |
6075 //char *v34; // eax@19 | |
0 | 6076 //Texture *v45; // edx@23 |
6077 //char *v46; // ecx@23 | |
6078 //char *v47; // eax@23 | |
6079 //double v48; // st6@24 | |
6080 //int v49; // esi@24 | |
6081 //double v50; // st6@24 | |
6082 const char *v53; // [sp-Ch] [bp-20h]@21 | |
6083 //int v54; // [sp-8h] [bp-1Ch]@21 | |
6084 //unsigned int v55; // [sp-4h] [bp-18h]@21 | |
6085 const char *v56; // [sp+0h] [bp-14h]@0 | |
6086 int v57; // [sp+4h] [bp-10h]@0 | |
6087 unsigned int v58; // [sp+8h] [bp-Ch]@0 | |
6088 //LightmapBuilder *v59; // [sp+Ch] [bp-8h]@3 | |
6089 //int a3a; // [sp+10h] [bp-4h]@4 | |
6090 | |
6091 //v8 = this; | |
6092 if (!uNumD3DSceneBegins || uNumVertices < 3) | |
6093 return; | |
6094 | |
6095 //auto a3 = pFace; | |
6096 //auto a6 = uPackedID; | |
6097 //v59 = pGame->pLightmapBuilder; | |
6098 //v9 = v59->std__vector_000004_size; | |
6099 | |
6100 auto uCorrectedColor = uColor; | |
6101 if (pGame->pLightmapBuilder->std__vector_000004_size) | |
6102 uCorrectedColor = 0xFFFFFFFF; | |
638 | 6103 pGame->AlterGamma_BLV(pFace, &uCorrectedColor); |
0 | 6104 |
792 | 6105 |
6106 if (pFace->uAttributes & FACE_OUTLINED) | |
6107 { | |
6108 int color; | |
6109 if (GetTickCount() % 300 >= 150) | |
6110 uColor = uCorrectedColor = 0xFF20FF20; | |
6111 else uColor = uCorrectedColor = 0xFF109010; | |
6112 } | |
6113 | |
1394 | 6114 if (byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) |
0 | 6115 { |
6116 __debugbreak(); | |
6117 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | |
186 | 6118 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
1072 | 6119 for (uint i = 0; i < uNumVertices; ++i) |
6120 { | |
6121 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | |
6122 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
6123 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | |
6124 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | |
6125 d3d_vertex_buffer[i].diffuse = uCorrectedColor; | |
6126 d3d_vertex_buffer[i].specular = 0; | |
6127 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | |
6128 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | |
6129 } | |
6130 | |
186 | 6131 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 6132 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
6133 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | |
6134 D3DPT_TRIANGLEFAN, | |
6135 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
6136 d3d_vertex_buffer, |
0 | 6137 uNumVertices, |
6138 28)); | |
1394 | 6139 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
0 | 6140 } |
6141 else | |
6142 { | |
6143 if (!pGame->pLightmapBuilder->std__vector_000004_size || | |
6144 byte_4D864C && pGame->uFlags & 2) | |
6145 { | |
6146 for (uint i = 0; i < uNumVertices; ++i) | |
6147 { | |
186 | 6148 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; |
6149 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
6150 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | |
6151 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | |
6152 d3d_vertex_buffer[i].diffuse = uCorrectedColor; | |
6153 d3d_vertex_buffer[i].specular = 0; | |
6154 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | |
6155 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | |
6156 } | |
6157 | |
6158 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
0 | 6159 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
6160 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
6161 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
6162 d3d_vertex_buffer, |
0 | 6163 uNumVertices, |
6164 28)); | |
6165 } | |
6166 else | |
6167 { | |
595 | 6168 for (uint i = 0; i < uNumVertices; ++i) |
6169 { | |
6170 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | |
6171 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
6172 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | |
6173 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | |
6174 d3d_vertex_buffer[i].diffuse = uColor; | |
6175 d3d_vertex_buffer[i].specular = 0; | |
6176 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | |
6177 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | |
6178 } | |
6179 //__debugbreak(); | |
6180 //if ( (signed int)uNumVertices > 0 ) | |
6181 //{ | |
6182 //v23 = pTex; | |
6183 //v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
6184 //v25 = (char *)&d3d_vertex_buffer[0].pos.y; | |
6185 //pTex = (Texture *)uNumVertices; | |
6186 //uint v18; | |
6187 //do | |
6188 //{ | |
6189 //v26 = *(float *)v24 * 0.061758894; | |
6190 //v27 = *((int *)v24 + 3); | |
6191 //*((int *)v25 + 4) = 0; | |
6192 //*((int *)v25 - 1) = v27; | |
6193 //*(int *)v25 = *((int *)v24 + 4); | |
6194 //*((int *)v25 + 3) = uColor; | |
6195 //v25 += 32; | |
6196 //*((float *)v25 - 7) = 1.0 - 1.0 / v26; | |
6197 //v28 = 1.0 / *(float *)v24; | |
6198 //v24 += 48; | |
6199 //v18 = pTex == (Texture *)1; | |
6200 //pTex = (Texture *)((char *)pTex - 1); | |
6201 //*((float *)v25 - 6) = v28; | |
0 | 6202 //a3 = (BLVFace *)v23->uTextureWidth; |
595 | 6203 //*((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth; |
0 | 6204 //a3 = (BLVFace *)v23->uTextureHeight; |
595 | 6205 //*((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; |
6206 //} | |
6207 //while ( !v18 ); | |
6208 //} | |
0 | 6209 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); |
186 | 6210 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 6211 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
186 | 6212 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
0 | 6213 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
6214 d3d_vertex_buffer, |
0 | 6215 uNumVertices, |
6216 28)); | |
595 | 6217 |
6218 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
1394 | 6219 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
595 | 6220 |
6221 for (uint i = 0; i < uNumVertices; ++i) | |
6222 d3d_vertex_buffer[i].diffuse = uCorrectedColor; | |
6223 /*v33 = uNumVertices; | |
0 | 6224 if ( (signed int)uNumVertices > 0 ) |
6225 { | |
186 | 6226 v34 = (char *)&d3d_vertex_buffer[0].diffuse; |
0 | 6227 do |
6228 { | |
6229 *(int *)v34 = uCorrectedColor; | |
6230 v34 += 32; | |
6231 --v33; | |
6232 } | |
6233 while ( v33 ); | |
595 | 6234 }*/ |
0 | 6235 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
186 | 6236 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
6237 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
6238 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
6239 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
6240 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
6241 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
0 | 6242 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
6243 d3d_vertex_buffer, |
0 | 6244 uNumVertices, |
6245 28)); | |
186 | 6246 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
6247 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
6248 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
0 | 6249 } |
6250 } | |
6251 } | |
6252 // 4D864C: using guessed type char byte_4D864C; | |
6253 | |
6254 //----- (004A43B1) -------------------------------------------------------- | |
717 | 6255 void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level) |
6256 { | |
6257 //RenderBillboardTransform_local0 *v4; // ebx@2 | |
6258 //double v5; // st7@2 | |
6259 //float v6; // ST08_4@2 | |
0 | 6260 unsigned int v7; // eax@2 |
717 | 6261 //int v8; // ecx@2 |
6262 //unsigned int v9; // esi@2 | |
6263 //Sprite *v10; // edi@5 | |
0 | 6264 signed int v11; // eax@9 |
6265 signed int v12; // eax@9 | |
717 | 6266 //double v13; // st7@12 |
6267 //double v14; // st6@12 | |
0 | 6268 double v15; // st5@12 |
6269 double v16; // st4@12 | |
6270 double v17; // st3@12 | |
6271 double v18; // st2@12 | |
6272 int v19; // ecx@14 | |
6273 double v20; // st3@14 | |
6274 int v21; // ecx@16 | |
6275 double v22; // st3@16 | |
717 | 6276 //IDirect3DTexture2 *v23; // eax@18 |
6277 //signed int v24; // [sp+18h] [bp-18h]@5 | |
6278 //signed int v25; // [sp+1Ch] [bp-14h]@5 | |
6279 //Render *v26; // [sp+20h] [bp-10h]@1 | |
0 | 6280 float v27; // [sp+24h] [bp-Ch]@5 |
6281 int v28; // [sp+28h] [bp-8h]@2 | |
6282 float v29; // [sp+2Ch] [bp-4h]@5 | |
717 | 6283 //float pSoftBillboarda; // [sp+38h] [bp+8h]@2 |
0 | 6284 float v31; // [sp+3Ch] [bp+Ch]@5 |
717 | 6285 //float v32; // [sp+3Ch] [bp+Ch]@12 |
0 | 6286 float a1; // [sp+40h] [bp+10h]@5 |
6287 | |
717 | 6288 //v26 = this; |
0 | 6289 if ( this->uNumD3DSceneBegins ) |
6290 { | |
717 | 6291 //v4 = pSoftBillboard; |
6292 //v5 = (double)pSoftBillboard->zbuffer_depth; | |
6293 //pSoftBillboarda = pSoftBillboard->zbuffer_depth; | |
6294 //v6 = pSoftBillboard->zbuffer_depth; | |
6295 v7 = Billboard_ProbablyAddToListAndSortByZOrder(pSoftBillboard->zbuffer_depth); | |
6296 //v8 = dimming_level; | |
6297 //v9 = v7; | |
657 | 6298 v28 = dimming_level & 0xFF000000; |
6299 if ( dimming_level & 0xFF000000 ) | |
717 | 6300 pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Opaque_3; |
0 | 6301 else |
717 | 6302 pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Transparent; |
6303 //v10 = a3; | |
6304 pBillboardRenderListD3D[v7].field_90 = pSoftBillboard->field_44; | |
6305 pBillboardRenderListD3D[v7].sZValue = pSoftBillboard->sZValue; | |
6306 pBillboardRenderListD3D[v7].uParentBillboardID = pSoftBillboard->uParentBillboardID; | |
6307 //v25 = pSoftBillboard->uScreenSpaceX; | |
6308 //v24 = pSoftBillboard->uScreenSpaceY; | |
6309 a1 = (pSoftBillboard->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_x_scaler_packedfloat); | |
6310 v29 = (pSoftBillboard->_screenspace_y_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_y_scaler_packedfloat); | |
6311 v31 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); | |
6312 v27 = (double)(pSprite->uBufferHeight - pSprite->uAreaY); | |
6313 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 6314 v31 = v31 * -1.0; |
717 | 6315 if ( pSoftBillboard->uTintColor && this->bTinting ) |
6316 { | |
6317 v11 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); | |
737 | 6318 v12 = BlendColors(pSoftBillboard->uTintColor, v11); |
0 | 6319 if ( v28 ) |
6320 v12 = (unsigned int)((char *)&array_77EC08[1852].pEdgeList1[17] + 3) & ((unsigned int)v12 >> 1); | |
6321 } | |
6322 else | |
6323 { | |
717 | 6324 v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); |
6325 } | |
6326 //v13 = (double)v25; | |
1390 | 6327 pBillboardRenderListD3D[v7].pQuads[0].specular = 0; |
6328 pBillboardRenderListD3D[v7].pQuads[0].diffuse = v12; | |
6329 pBillboardRenderListD3D[v7].pQuads[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1; | |
717 | 6330 //v14 = (double)v24; |
6331 //v32 = v14; | |
1390 | 6332 pBillboardRenderListD3D[v7].pQuads[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29; |
717 | 6333 v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894); |
1390 | 6334 pBillboardRenderListD3D[v7].pQuads[0].pos.z = v15; |
717 | 6335 v16 = 1.0 / pSoftBillboard->zbuffer_depth; |
1390 | 6336 pBillboardRenderListD3D[v7].pQuads[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth; |
6337 pBillboardRenderListD3D[v7].pQuads[0].texcoord.x = 0.0; | |
6338 pBillboardRenderListD3D[v7].pQuads[0].texcoord.y = 0.0; | |
717 | 6339 v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); |
6340 v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight); | |
6341 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 6342 v17 = v17 * -1.0; |
1390 | 6343 pBillboardRenderListD3D[v7].pQuads[1].specular = 0; |
6344 pBillboardRenderListD3D[v7].pQuads[1].diffuse = v12; | |
6345 pBillboardRenderListD3D[v7].pQuads[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1; | |
6346 pBillboardRenderListD3D[v7].pQuads[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29; | |
6347 pBillboardRenderListD3D[v7].pQuads[1].pos.z = v15; | |
6348 pBillboardRenderListD3D[v7].pQuads[1].rhw = v16; | |
6349 pBillboardRenderListD3D[v7].pQuads[1].texcoord.x = 0.0; | |
6350 pBillboardRenderListD3D[v7].pQuads[1].texcoord.y = 1.0; | |
717 | 6351 v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight; |
6352 v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); | |
6353 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 6354 v20 = v20 * -1.0; |
1390 | 6355 pBillboardRenderListD3D[v7].pQuads[2].specular = 0; |
6356 pBillboardRenderListD3D[v7].pQuads[2].diffuse = v12; | |
6357 pBillboardRenderListD3D[v7].pQuads[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX; | |
6358 pBillboardRenderListD3D[v7].pQuads[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29; | |
6359 pBillboardRenderListD3D[v7].pQuads[2].pos.z = v15; | |
6360 pBillboardRenderListD3D[v7].pQuads[2].rhw = v16; | |
6361 pBillboardRenderListD3D[v7].pQuads[2].texcoord.x = 1.0; | |
6362 pBillboardRenderListD3D[v7].pQuads[2].texcoord.y = 1.0; | |
717 | 6363 v21 = pSprite->uBufferHeight - pSprite->uAreaY; |
6364 v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); | |
6365 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 6366 v22 = v22 * -1.0; |
1390 | 6367 pBillboardRenderListD3D[v7].pQuads[3].specular = 0; |
6368 pBillboardRenderListD3D[v7].pQuads[3].diffuse = v12; | |
6369 pBillboardRenderListD3D[v7].pQuads[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX; | |
6370 pBillboardRenderListD3D[v7].pQuads[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29; | |
6371 pBillboardRenderListD3D[v7].pQuads[3].pos.z = v15; | |
6372 pBillboardRenderListD3D[v7].pQuads[3].rhw = v16; | |
6373 pBillboardRenderListD3D[v7].pQuads[3].texcoord.x = 1.0; | |
6374 pBillboardRenderListD3D[v7].pQuads[3].texcoord.y = 0.0; | |
717 | 6375 //v23 = pSprite->pTexture; |
6376 pBillboardRenderListD3D[v7].uNumVertices = 4; | |
6377 pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth; | |
6378 pBillboardRenderListD3D[v7].pTexture = pSprite->pTexture; | |
0 | 6379 } |
6380 } | |
6381 | |
6382 //----- (004A354F) -------------------------------------------------------- | |
6383 void Render::MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) | |
6384 { | |
743 | 6385 //double v5; // st7@3 |
6386 //float v6; // ST20_4@3 | |
6387 //float v7; // ST00_4@3 | |
0 | 6388 unsigned int v8; // esi@3 |
743 | 6389 //int v9; // eax@3 |
6390 //int v10; // ebx@3 | |
0 | 6391 float v11; // ST28_4@3 |
743 | 6392 //double v12; // st7@3 |
6393 //float v13; // ST24_4@3 | |
6394 //double v14; // st6@3 | |
6395 //float v15; // ST1C_4@3 | |
0 | 6396 float v16; // ST2C_4@3 |
6397 float v17; // ST30_4@3 | |
6398 signed int v18; // ST18_4@3 | |
6399 signed int v19; // ST14_4@3 | |
6400 signed int v20; // ST10_4@3 | |
6401 signed int v21; // eax@3 | |
6402 double v22; // st6@3 | |
6403 float v23; // ST2C_4@3 | |
6404 float v24; // ST30_4@3 | |
6405 signed int v25; // ST10_4@3 | |
6406 signed int v26; // ST14_4@3 | |
6407 signed int v27; // ST18_4@3 | |
6408 signed int v28; // eax@3 | |
6409 double v29; // st6@3 | |
6410 float v30; // ecx@3 | |
6411 float v31; // ST2C_4@3 | |
6412 float v32; // ST30_4@3 | |
6413 signed int v33; // ST10_4@3 | |
6414 signed int v34; // ST14_4@3 | |
6415 signed int v35; // ST18_4@3 | |
6416 signed int v36; // eax@3 | |
6417 float v37; // ecx@3 | |
6418 double v38; // st6@3 | |
6419 float v39; // ST2C_4@3 | |
6420 float v40; // ST30_4@3 | |
6421 signed int v41; // ST10_4@3 | |
6422 signed int v42; // ST14_4@3 | |
6423 signed int v43; // ST18_4@3 | |
6424 signed int v44; // eax@3 | |
6425 double v45; // st6@3 | |
6426 float v46; // eax@3 | |
6427 | |
6428 if ( this->uNumD3DSceneBegins ) | |
6429 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6430 if (a2->zbuffer_depth) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6431 { |
743 | 6432 //v5 = (double)a2->zbuffer_depth; |
6433 //v6 = v5; | |
6434 //v7 = v5; | |
6435 v8 = Billboard_ProbablyAddToListAndSortByZOrder(a2->zbuffer_depth); | |
0 | 6436 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; |
6437 pBillboardRenderListD3D[v8].field_90 = a2->field_44; | |
6438 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; | |
6439 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; | |
743 | 6440 //v9 = a2->uScreenSpaceX; |
6441 //v10 = a2->uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6442 v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); |
743 | 6443 //v12 = (double) a2->uScreenSpaceX; |
6444 //v13 = v12; | |
6445 //v14 = (double)(a2->uScreenSpaceY - 12); | |
6446 //v15 = v14; | |
6447 v16 = (double)( a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; | |
6448 v17 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); | |
323 | 6449 v18 = stru_5C6E00->Cos(angle); |
6450 v19 = stru_5C6E00->Sin(angle); | |
6451 v20 = stru_5C6E00->Sin(angle); | |
6452 v21 = stru_5C6E00->Cos(angle); | |
1390 | 6453 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 |
0 | 6454 + (double)(v18 >> 16)) |
6455 * v16 | |
6456 - ((double)(unsigned __int16)v19 * 0.000015259022 | |
6457 + (double)(v19 >> 16)) | |
6458 * v17) | |
743 | 6459 * v11 + (double) a2->uScreenSpaceX; |
0 | 6460 v22 = (((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v17 |
6461 + ((double)(unsigned __int16)v20 * 0.000015259022 + (double)(v20 >> 16)) * v16 | |
6462 - 12.0) | |
6463 * v11 | |
6464 + (double)a2->uScreenSpaceY; | |
1390 | 6465 pBillboardRenderListD3D[v8].pQuads[0].specular = 0; |
6466 pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; | |
6467 pBillboardRenderListD3D[v8].pQuads[0].pos.y = v22; | |
6468 pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894); | |
6469 pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; | |
6470 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; | |
6471 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; | |
743 | 6472 v31 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; |
6473 v32 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); | |
323 | 6474 v25 = stru_5C6E00->Cos(angle); |
6475 v26 = stru_5C6E00->Sin(angle); | |
6476 v27 = stru_5C6E00->Sin(angle); | |
6477 v28 = stru_5C6E00->Cos(angle); | |
1390 | 6478 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 |
0 | 6479 + (double)(v25 >> 16)) |
740 | 6480 * v31 |
0 | 6481 - ((double)(unsigned __int16)v26 * 0.000015259022 |
6482 + (double)(v26 >> 16)) | |
740 | 6483 * v32) |
743 | 6484 * v11 + (double) a2->uScreenSpaceX; |
740 | 6485 v29 = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v32 |
6486 + ((double)(unsigned __int16)v27 * 0.000015259022 + (double)(v27 >> 16)) * v31 | |
0 | 6487 - 12.0) |
6488 * v11 | |
6489 + (double)a2->uScreenSpaceY; | |
1390 | 6490 pBillboardRenderListD3D[v8].pQuads[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuads[0].pos.z; |
6491 v30 = pBillboardRenderListD3D[v8].pQuads[0].rhw; | |
6492 pBillboardRenderListD3D[v8].pQuads[1].pos.y = v29; | |
6493 pBillboardRenderListD3D[v8].pQuads[1].specular = 0; | |
6494 pBillboardRenderListD3D[v8].pQuads[1].rhw = v30; | |
6495 pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; | |
6496 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; | |
6497 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; | |
743 | 6498 v23 = (double)(a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; |
6499 v24 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); | |
323 | 6500 v33 = stru_5C6E00->Cos(angle); |
6501 v34 = stru_5C6E00->Sin(angle); | |
6502 v35 = stru_5C6E00->Sin(angle); | |
6503 v36 = stru_5C6E00->Cos(angle); | |
1390 | 6504 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 |
0 | 6505 + (double)(v33 >> 16)) |
740 | 6506 * v23 |
0 | 6507 - ((double)(unsigned __int16)v34 * 0.000015259022 |
6508 + (double)(v34 >> 16)) | |
740 | 6509 * v24) |
743 | 6510 * v11 + (double) a2->uScreenSpaceX; |
1390 | 6511 v37 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; |
740 | 6512 v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v24 |
6513 + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v23 | |
0 | 6514 - 12.0) |
6515 * v11 | |
6516 + (double)a2->uScreenSpaceY; | |
1390 | 6517 pBillboardRenderListD3D[v8].pQuads[2].specular = 0; |
6518 pBillboardRenderListD3D[v8].pQuads[2].pos.z = v37; | |
6519 pBillboardRenderListD3D[v8].pQuads[2].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; | |
6520 pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; | |
6521 pBillboardRenderListD3D[v8].pQuads[2].pos.y = v38; | |
6522 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; | |
6523 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; | |
743 | 6524 v39 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; |
6525 v40 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); | |
323 | 6526 v41 = stru_5C6E00->Cos(angle); |
6527 v42 = stru_5C6E00->Sin(angle); | |
6528 v43 = stru_5C6E00->Sin(angle); | |
6529 v44 = stru_5C6E00->Cos(angle); | |
1390 | 6530 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 |
0 | 6531 + (double)(v41 >> 16)) |
6532 * v39 | |
6533 - ((double)(unsigned __int16)v42 * 0.000015259022 | |
6534 + (double)(v42 >> 16)) | |
6535 * v40) | |
743 | 6536 * v11 + (double) a2->uScreenSpaceX; |
0 | 6537 v45 = (((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 |
6538 + ((double)(unsigned __int16)v43 * 0.000015259022 + (double)(v43 >> 16)) * v39 | |
6539 - 12.0) | |
6540 * v11 | |
6541 + (double)a2->uScreenSpaceY; | |
1390 | 6542 v46 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; |
6543 pBillboardRenderListD3D[v8].pQuads[3].specular = 0; | |
6544 pBillboardRenderListD3D[v8].pQuads[3].pos.z = v46; | |
6545 pBillboardRenderListD3D[v8].pQuads[3].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; | |
6546 pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; | |
0 | 6547 pBillboardRenderListD3D[v8].pTexture = a3; |
743 | 6548 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; |
0 | 6549 pBillboardRenderListD3D[v8].uNumVertices = 4; |
1390 | 6550 pBillboardRenderListD3D[v8].pQuads[3].pos.y = v45; |
6551 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; | |
6552 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; | |
0 | 6553 } |
6554 } | |
6555 } | |
6556 | |
6557 //----- (004A3AD9) -------------------------------------------------------- | |
6558 void Render::MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) | |
6559 { | |
6560 double v5; // st7@2 | |
6561 float v6; // ST28_4@2 | |
6562 float v7; // ST00_4@2 | |
6563 unsigned int v8; // esi@2 | |
6564 int v9; // eax@2 | |
6565 int v10; // ebx@2 | |
6566 float v11; // ST34_4@2 | |
6567 double v12; // st7@2 | |
6568 float v13; // ST2C_4@2 | |
6569 double v14; // st6@2 | |
6570 float v15; // ST24_4@2 | |
6571 float v16; // ST38_4@2 | |
6572 float v17; // ST3C_4@2 | |
6573 signed int v18; // ST1C_4@2 | |
6574 int v19; // ST30_4@2 | |
6575 signed int v20; // ST20_4@2 | |
6576 signed int v21; // ST18_4@2 | |
6577 signed int v22; // eax@2 | |
6578 double v23; // st6@2 | |
6579 float v24; // ST20_4@2 | |
6580 float v25; // ST1C_4@2 | |
6581 float v26; // ST38_4@2 | |
6582 float v27; // ST3C_4@2 | |
6583 signed int v28; // ST18_4@2 | |
6584 signed int v29; // ST14_4@2 | |
6585 signed int v30; // ST10_4@2 | |
6586 signed int v31; // eax@2 | |
6587 double v32; // st6@2 | |
6588 float v33; // ST38_4@2 | |
6589 float v34; // ST3C_4@2 | |
6590 signed int v35; // ST10_4@2 | |
6591 signed int v36; // ST14_4@2 | |
6592 signed int v37; // ST18_4@2 | |
6593 signed int v38; // eax@2 | |
6594 double v39; // st6@2 | |
6595 float v40; // ST38_4@2 | |
6596 float v41; // ST3C_4@2 | |
6597 signed int v42; // ST10_4@2 | |
6598 signed int v43; // ST14_4@2 | |
6599 signed int v44; // ST18_4@2 | |
6600 signed int v45; // eax@2 | |
6601 double v46; // st6@2 | |
6602 | |
6603 if ( this->uNumD3DSceneBegins ) | |
6604 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6605 v5 = (double)a2->zbuffer_depth; |
0 | 6606 v6 = v5; |
6607 v7 = v5; | |
6608 v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); | |
6609 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; | |
6610 pBillboardRenderListD3D[v8].field_90 = a2->field_44; | |
6611 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; | |
6612 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; | |
6613 v9 = a2->uScreenSpaceX; | |
6614 v10 = a2->uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6615 v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); |
0 | 6616 v12 = (double)v9; |
6617 v13 = v12; | |
6618 v14 = (double)(v10 - 12); | |
6619 v15 = v14; | |
6620 v16 = (double)(v9 - 12) - v12; | |
6621 v17 = (double)(v10 - 25) - v14; | |
323 | 6622 v18 = stru_5C6E00->Cos(angle); |
0 | 6623 v19 = angle - stru_5C6E00->uIntegerHalfPi; |
323 | 6624 v20 = stru_5C6E00->Sin(angle); |
6625 v21 = stru_5C6E00->Sin(angle); | |
6626 v22 = stru_5C6E00->Cos(angle); | |
1390 | 6627 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 |
0 | 6628 + (double)(v18 >> 16)) |
6629 * v16 | |
6630 - ((double)(unsigned __int16)v20 * 0.000015259022 | |
6631 + (double)(v20 >> 16)) | |
6632 * v17) | |
6633 * v11 + v13; | |
6634 v23 = (((double)(unsigned __int16)v22 * 0.000015259022 + (double)(v22 >> 16)) * v17 | |
6635 + ((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v16 | |
6636 - 12.0) | |
6637 * v11 | |
6638 + (double)a2->uScreenSpaceY; | |
1390 | 6639 pBillboardRenderListD3D[v8].pQuads[0].specular = 0; |
6640 pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; | |
6641 pBillboardRenderListD3D[v8].pQuads[0].pos.y = v23; | |
0 | 6642 v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); |
1390 | 6643 pBillboardRenderListD3D[v8].pQuads[0].pos.z = v24; |
0 | 6644 v25 = 1.0 / v6; |
1390 | 6645 pBillboardRenderListD3D[v8].pQuads[0].rhw = v25; |
6646 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; | |
6647 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; | |
0 | 6648 v26 = (double)(a2->uScreenSpaceX - 12) - v13; |
6649 v27 = (double)a2->uScreenSpaceY - v15; | |
323 | 6650 v28 = stru_5C6E00->Cos(angle); |
6651 v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6652 v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6653 v31 = stru_5C6E00->Cos(angle); | |
1390 | 6654 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 |
0 | 6655 + (double)(v28 >> 16)) |
6656 * v26 | |
6657 - ((double)(unsigned __int16)v29 * 0.000015259022 | |
6658 + (double)(v29 >> 16)) | |
6659 * v27) | |
6660 * v11 + v13; | |
6661 v32 = (((double)(unsigned __int16)v31 * 0.000015259022 + (double)(v31 >> 16)) * v27 | |
6662 + ((double)(unsigned __int16)v30 * 0.000015259022 + (double)(v30 >> 16)) * v26 | |
6663 - 12.0) | |
6664 * v11 | |
6665 + (double)a2->uScreenSpaceY; | |
1390 | 6666 pBillboardRenderListD3D[v8].pQuads[1].pos.z = v24; |
6667 pBillboardRenderListD3D[v8].pQuads[1].pos.y = v32; | |
6668 pBillboardRenderListD3D[v8].pQuads[1].specular = 0; | |
6669 pBillboardRenderListD3D[v8].pQuads[1].rhw = v25; | |
6670 pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; | |
6671 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; | |
6672 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; | |
0 | 6673 v33 = (double)(a2->uScreenSpaceX + 12) - v13; |
6674 v34 = (double)a2->uScreenSpaceY - v15; | |
323 | 6675 v35 = stru_5C6E00->Cos(angle); |
6676 v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6677 v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6678 v38 = stru_5C6E00->Cos(angle); | |
1390 | 6679 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 |
0 | 6680 + (double)(v35 >> 16)) |
6681 * v33 | |
6682 - ((double)(unsigned __int16)v36 * 0.000015259022 | |
6683 + (double)(v36 >> 16)) | |
6684 * v34) | |
6685 * v11 + v13; | |
6686 v39 = (((double)(unsigned __int16)v38 * 0.000015259022 + (double)(v38 >> 16)) * v34 | |
6687 + ((double)(unsigned __int16)v37 * 0.000015259022 + (double)(v37 >> 16)) * v33 | |
6688 - 12.0) | |
6689 * v11 | |
6690 + (double)a2->uScreenSpaceY; | |
1390 | 6691 pBillboardRenderListD3D[v8].pQuads[2].specular = 0; |
6692 pBillboardRenderListD3D[v8].pQuads[2].pos.z = v24; | |
6693 pBillboardRenderListD3D[v8].pQuads[2].rhw = v25; | |
6694 pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; | |
6695 pBillboardRenderListD3D[v8].pQuads[2].pos.y = v39; | |
6696 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; | |
6697 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; | |
0 | 6698 v40 = (double)(a2->uScreenSpaceX + 12) - v13; |
6699 v41 = (double)(a2->uScreenSpaceY - 25) - v15; | |
323 | 6700 v42 = stru_5C6E00->Cos(angle); |
6701 v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6702 v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6703 v45 = stru_5C6E00->Cos(angle); | |
1390 | 6704 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 |
0 | 6705 + (double)(v42 >> 16)) |
6706 * v40 | |
6707 - ((double)(unsigned __int16)v43 * 0.000015259022 | |
6708 + (double)(v43 >> 16)) | |
6709 * v41) | |
6710 * v11 + v13; | |
6711 v46 = (((double)(unsigned __int16)v45 * 0.000015259022 + (double)(v45 >> 16)) * v41 | |
6712 + ((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 | |
6713 - 12.0) | |
6714 * v11 | |
6715 + (double)a2->uScreenSpaceY; | |
1390 | 6716 pBillboardRenderListD3D[v8].pQuads[3].specular = 0; |
6717 pBillboardRenderListD3D[v8].pQuads[3].pos.z = v24; | |
6718 pBillboardRenderListD3D[v8].pQuads[3].rhw = v25; | |
6719 pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; | |
0 | 6720 pBillboardRenderListD3D[v8].pTexture = a3; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6721 pBillboardRenderListD3D[v8].z_order = v6; |
0 | 6722 pBillboardRenderListD3D[v8].uNumVertices = 4; |
1390 | 6723 pBillboardRenderListD3D[v8].pQuads[3].pos.y = v46; |
6724 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; | |
6725 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; | |
0 | 6726 } |
6727 } | |
6728 | |
6729 //----- (004A4023) -------------------------------------------------------- | |
657 | 6730 void Render::TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard) |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6731 { |
0 | 6732 unsigned int v8; // esi@2 |
6733 double v14; // st6@14 | |
6734 double v15; // st5@14 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6735 //unsigned int v16; // ecx@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6736 //double v17; // st7@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6737 //double v18; // st5@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6738 //double v19; // st4@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6739 //double v20; // st5@18 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6740 //double v21; // st4@18 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6741 //signed int v23; // [sp+18h] [bp-18h]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6742 //signed int v24; // [sp+1Ch] [bp-14h]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6743 //float v26; // [sp+20h] [bp-10h]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6744 //float v27; // [sp+20h] [bp-10h]@12 |
0 | 6745 float v29; // [sp+28h] [bp-8h]@5 |
6746 float v30; // [sp+2Ch] [bp-4h]@5 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6747 //float pSpritea; // [sp+3Ch] [bp+Ch]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6748 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6749 if (!uNumD3DSceneBegins) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6750 return; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6751 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6752 v8 = Billboard_ProbablyAddToListAndSortByZOrder(a2->zbuffer_depth); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6753 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6754 v30 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) / 65530.0 + HIWORD(a2->_screenspace_x_scaler_packedfloat); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6755 v29 = (a2->_screenspace_y_scaler_packedfloat & 0xFFFF) / 65530.0 + HIWORD(a2->_screenspace_y_scaler_packedfloat); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6756 |
657 | 6757 unsigned int diffuse = ::GetActorTintColor(dimming_level, 0, a2->zbuffer_depth, 0, pBillboard); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6758 if (a2->uTintColor & 0x00FFFFFF && bTinting) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6759 { |
737 | 6760 diffuse = BlendColors(a2->uTintColor, diffuse); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6761 if (a2->uTintColor & 0xFF000000) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6762 diffuse = 0x007F7F7F & ((unsigned int)diffuse >> 1); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6763 } |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6764 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6765 unsigned int specular = 0; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6766 if (bUsingSpecular) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6767 specular = sub_47C3D7_get_fog_related_stuff(0, 0, a2->zbuffer_depth); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6768 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6769 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6770 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6771 if (a2->uFlags & 4) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6772 v14 *= -1.0; |
1390 | 6773 pBillboardRenderListD3D[v8].pQuads[0].diffuse = diffuse; |
6774 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30; | |
6775 pBillboardRenderListD3D[v8].pQuads[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
6776 pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
6777 pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; | |
6778 pBillboardRenderListD3D[v8].pQuads[0].specular = specular; | |
6779 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; | |
6780 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6781 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6782 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6783 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6784 if ( a2->uFlags & 4 ) |
0 | 6785 v14 = v14 * -1.0; |
1390 | 6786 pBillboardRenderListD3D[v8].pQuads[1].specular = specular; |
6787 pBillboardRenderListD3D[v8].pQuads[1].diffuse = diffuse; | |
6788 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30; | |
6789 pBillboardRenderListD3D[v8].pQuads[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
6790 pBillboardRenderListD3D[v8].pQuads[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
6791 pBillboardRenderListD3D[v8].pQuads[1].rhw = 1.0 / a2->zbuffer_depth; | |
6792 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; | |
6793 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6794 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6795 v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6796 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6797 if ( a2->uFlags & 4 ) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6798 v14 *= -1.0; |
1390 | 6799 pBillboardRenderListD3D[v8].pQuads[2].diffuse = diffuse; |
6800 pBillboardRenderListD3D[v8].pQuads[2].specular = specular; | |
6801 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30; | |
6802 pBillboardRenderListD3D[v8].pQuads[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
6803 pBillboardRenderListD3D[v8].pQuads[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
6804 pBillboardRenderListD3D[v8].pQuads[2].rhw = 1.0 / a2->zbuffer_depth; | |
6805 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; | |
6806 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6807 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6808 v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6809 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6810 if ( a2->uFlags & 4 ) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6811 v14 *= -1.0; |
1390 | 6812 pBillboardRenderListD3D[v8].pQuads[3].diffuse = diffuse; |
6813 pBillboardRenderListD3D[v8].pQuads[3].specular = specular; | |
6814 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30; | |
6815 pBillboardRenderListD3D[v8].pQuads[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
6816 pBillboardRenderListD3D[v8].pQuads[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
6817 pBillboardRenderListD3D[v8].pQuads[3].rhw = 1.0 / a2->zbuffer_depth; | |
6818 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; | |
6819 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6820 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6821 pBillboardRenderListD3D[v8].uNumVertices = 4; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6822 pBillboardRenderListD3D[v8].pTexture = pSprite->pTexture; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6823 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6824 pBillboardRenderListD3D[v8].field_90 = a2->field_44; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6825 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6826 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6827 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6828 if (a2->uTintColor & 0xFF000000) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6829 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6830 else |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6831 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Transparent; |
0 | 6832 } |
6833 | |
6834 //----- (004A48E4) -------------------------------------------------------- | |
6835 int Render::MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6) | |
6836 { | |
6837 int v6; // ecx@1 | |
6838 int v7; // ebx@1 | |
6839 int v8; // ecx@1 | |
6840 int v9; // edx@1 | |
6841 int v10; // edi@1 | |
6842 unsigned int x; // esi@1 | |
6843 int result; // eax@8 | |
6844 int v13; // [sp+Ch] [bp-10h]@1 | |
6845 int v14; // [sp+10h] [bp-Ch]@1 | |
6846 int v15; // [sp+14h] [bp-8h]@1 | |
6847 int v16; // [sp+18h] [bp-4h]@1 | |
6848 int v17; // [sp+24h] [bp+8h]@1 | |
6849 unsigned int v18; // [sp+28h] [bp+Ch]@1 | |
6850 int v19; // [sp+34h] [bp+18h]@1 | |
6851 | |
6852 v6 = screenSpaceX; | |
6853 v7 = (a6 >> 1) + screenSpaceY; | |
6854 v17 = 0; | |
6855 v15 = 0; | |
6856 v8 = (a6 >> 1) + v6; | |
6857 v14 = (a6 >> 1) * (a6 >> 1); | |
6858 v9 = 2 * (a6 >> 1); | |
6859 v10 = (a6 >> 1) * ((a6 >> 1) - 1); | |
6860 x = v8 - (a6 >> 1); | |
6861 v16 = (a6 >> 1) + screenSpaceY - v8; | |
6862 v19 = a6 >> 1; | |
6863 v13 = v9; | |
6864 v18 = v8; | |
6865 do | |
6866 { | |
6867 sr_4A46E6_draw_particle_segment(x, v16 + v18, z, 2 * v19, lightColor); | |
6868 if ( v15 ) | |
6869 sr_4A46E6_draw_particle_segment(x, v17 + v7, z, 2 * v19, lightColor); | |
6870 v14 -= v15; | |
6871 if ( v14 <= v10 ) | |
6872 { | |
6873 if ( v19 != v17 ) | |
6874 { | |
6875 sr_4A46E6_draw_particle_segment(v18, v16 + x, z, 2 * v17, lightColor); | |
6876 sr_4A46E6_draw_particle_segment(v18, v19 + v7, z, 2 * v17, lightColor); | |
6877 } | |
6878 --v19; | |
6879 v13 -= 2; | |
6880 ++x; | |
6881 v10 -= v13; | |
6882 } | |
6883 result = v17++; | |
6884 v15 += 2; | |
6885 --v18; | |
6886 } | |
6887 while ( result < v19 ); | |
6888 return result; | |
6889 } | |
6890 | |
6891 //----- (004A49D0) -------------------------------------------------------- | |
6892 void Render::DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9) | |
6893 { | |
1159 | 6894 int absXDifference; // eax@1 |
6895 int absYDifference; // eax@1 | |
6896 unsigned int smallerabsdiff; // ebx@1 | |
6897 unsigned int largerabsdiff; | |
0 | 6898 double v16; // st7@7 |
6899 double v17; // st7@7 | |
6900 double v18; // st6@7 | |
6901 double v20; // st4@8 | |
6902 double v21; // st4@10 | |
6903 double v22; // st4@10 | |
6904 double v23; // st4@10 | |
6905 double v25; // st4@11 | |
6906 double v26; // st4@13 | |
6907 double v28; // st4@13 | |
6908 RenderVertexD3D3 v29[4]; // [sp+0h] [bp-94h]@7 | |
1159 | 6909 int xDifference; // [sp+88h] [bp-Ch]@1 |
0 | 6910 signed int v32; // [sp+8Ch] [bp-8h]@1 |
1159 | 6911 int yDifference; // [sp+90h] [bp-4h]@1 |
6912 | |
6913 xDifference = bankersRounding(dstX - srcX); | |
6914 yDifference = bankersRounding(dstY - srcY); | |
6915 absYDifference = abs(yDifference); | |
6916 absXDifference = abs(xDifference); | |
6917 smallerabsdiff = min(absXDifference, absYDifference); | |
6918 largerabsdiff = max(absXDifference, absYDifference); | |
6919 v32 = (11 * smallerabsdiff >> 5) + largerabsdiff; | |
0 | 6920 v16 = 1.0 / (double)v32; |
1159 | 6921 v17 = (double)yDifference * v16 * a4; |
6922 v18 = (double)xDifference * v16 * a4; | |
6923 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
6924 { | |
6925 v20 = a3 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
6926 v25 = a7 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
6927 } | |
6928 else | |
6929 { | |
6930 v20 = a3 * 0.061758894; | |
6931 v25 = a7 * 0.061758894; | |
6932 } | |
6933 v21 = 1.0 / a3; | |
6934 v22 = (double)yDifference * v16 * a8; | |
6935 v23 = (double)xDifference * v16 * a8; | |
6936 v26 = 1.0 - 1.0 / v25; | |
6937 v28 = 1.0 / a7; | |
0 | 6938 v29[0].pos.x = srcX + v17; |
6939 v29[0].pos.y = srcY - v18; | |
1159 | 6940 v29[0].pos.z = 1.0 - 1.0 / v20; |
6941 v29[0].rhw = v21; | |
0 | 6942 v29[0].diffuse = -1; |
6943 v29[0].specular = 0; | |
6944 v29[0].texcoord.x = 1.0; | |
6945 v29[0].texcoord.y = 0.0; | |
1159 | 6946 |
0 | 6947 v29[1].pos.x = v22 + dstX; |
6948 v29[1].pos.y = dstY - v23; | |
1159 | 6949 v29[1].pos.z = v26; |
6950 v29[1].rhw = v28; | |
0 | 6951 v29[1].diffuse = -16711936; |
6952 v29[1].specular = 0; | |
6953 v29[1].texcoord.x = 1.0; | |
6954 v29[1].texcoord.y = 1.0; | |
1159 | 6955 |
6956 v29[2].pos.x = dstX - v22; | |
6957 v29[2].pos.y = v23 + dstY; | |
6958 v29[2].pos.z = v26; | |
0 | 6959 v29[2].rhw = v28; |
1159 | 6960 v29[2].diffuse = -1; |
6961 v29[2].specular = 0; | |
0 | 6962 v29[2].texcoord.x = 0.0; |
6963 v29[2].texcoord.y = 1.0; | |
1159 | 6964 |
0 | 6965 v29[3].pos.x = srcX - v17; |
6966 v29[3].pos.y = v18 + srcY; | |
1159 | 6967 v29[3].pos.z = v29[0].pos.z; |
6968 v29[3].rhw = v21; | |
6969 v29[3].diffuse = -1; | |
6970 v29[3].specular = 0; | |
0 | 6971 v29[3].texcoord.x = 0.0; |
6972 v29[3].texcoord.y = 0.0; | |
186 | 6973 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
6974 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
6975 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | |
6976 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | |
6977 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | |
6978 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
0 | 6979 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, a9)); |
6980 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive( | |
6981 D3DPT_TRIANGLEFAN, | |
6982 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
6983 v29, | |
6984 4, | |
6985 24)); | |
186 | 6986 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
6987 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
6988 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
6989 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
6990 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
6991 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); | |
0 | 6992 } |
6993 | |
6994 //----- (004A4CC9) -------------------------------------------------------- | |
1390 | 6995 void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse) |
6996 { | |
0 | 6997 unsigned int v5; // eax@7 |
6998 char *v7; // edx@8 | |
6999 double v10; // st6@9 | |
7000 double v11; // st6@10 | |
7001 int v12; // ebx@13 | |
1390 | 7002 |
7003 if (a1->uNumVertices < 3) | |
7004 return; | |
7005 | |
7006 float depth = 1000000.0; | |
7007 for (uint i = 0; i < a1->uNumVertices; ++i) | |
7008 { | |
7009 if (a1->field_104[i].z < depth) | |
7010 depth = a1->field_104[i * 4].z; | |
7011 } | |
7012 | |
7013 v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth); | |
7014 pBillboardRenderListD3D[v5].field_90 = 0; | |
7015 pBillboardRenderListD3D[v5].uParentBillboardID = -1; | |
7016 pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; | |
7017 pBillboardRenderListD3D[v5].pTexture = 0; | |
7018 pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices; | |
7019 pBillboardRenderListD3D[v5].z_order = depth; | |
7020 | |
7021 for (uint i = 0; i < a1->uNumVertices; ++i) | |
7022 { | |
7023 pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x; | |
7024 pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y; | |
7025 | |
7026 v10 = a1->field_104[i].z; | |
7027 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7028 v11 = v10 * 0.061758894; | |
7029 else | |
7030 v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
7031 pBillboardRenderListD3D[v5].pQuads[i].pos.z = 1.0 - 1.0 / v11; | |
7032 pBillboardRenderListD3D[v5].pQuads[i].rhw = 1.0 / a1->field_104[i].z; | |
7033 | |
7034 if (diffuse & 0xFF000000) | |
7035 v12 = a1->field_104[i].diffuse; | |
7036 else | |
7037 v12 = diffuse; | |
7038 pBillboardRenderListD3D[v5].pQuads[i].diffuse = v12; | |
7039 pBillboardRenderListD3D[v5].pQuads[i].specular = 0; | |
7040 | |
7041 pBillboardRenderListD3D[v5].pQuads[i].texcoord.x = 0.0; | |
7042 pBillboardRenderListD3D[v5].pQuads[i].texcoord.y = 0.0; | |
0 | 7043 } |
7044 } | |
7045 | |
7046 //----- (004A4DE1) -------------------------------------------------------- | |
7047 bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture) | |
7048 { | |
7049 HRESULT v12; // eax@14 | |
7050 unsigned __int16 *v13; // ecx@19 | |
7051 unsigned __int16 *v14; // eax@19 | |
7052 DWORD v15; // edx@20 | |
7053 HRESULT v16; // eax@23 | |
7054 stru350 Dst; // [sp+Ch] [bp-F8h]@12 | |
7055 | |
7056 auto pHWLTexture = pD3DBitmaps.LoadTexture(pName, bMipMaps); | |
7057 if ( pHWLTexture ) | |
7058 { | |
7059 bMipMaps = !strncmp(pName, "HDWTR", 5); | |
7060 if ( !pRenderD3D->CreateTexture( | |
7061 pHWLTexture->uWidth, | |
7062 pHWLTexture->uHeight, | |
7063 pOutSurface, | |
7064 pOutTexture, | |
7065 true, | |
7066 bMipMaps, | |
7067 uMinDeviceTextureDim) ) | |
7068 Abortf("HiScreen16::LoadTexture - D3Drend->CreateTexture() failed: %x", 0); | |
7069 //v10 = *pOutSurface; | |
7070 //v11 = 0; | |
7071 if ( bMipMaps ) | |
7072 { | |
7073 Dst._450DDE(); | |
7074 //v20 = 0; | |
7075 Dst._450DF1(&stru_4EFCBC, &stru_4EFCBC); | |
7076 | |
7077 IDirectDrawSurface4 *pNextSurf = *pOutSurface; | |
7078 while ( 1 ) | |
7079 { | |
7080 DDSCAPS2 v19; | |
7081 memset(&v19, 0, sizeof(DDSCAPS2)); | |
7082 v19.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; | |
7083 | |
7084 DDSURFACEDESC2 desc; | |
7085 memset(&desc, 0, sizeof(DDSURFACEDESC2)); | |
7086 desc.dwSize = sizeof(DDSURFACEDESC2); | |
7087 | |
168 | 7088 if ( LockSurface_DDraw4(pNextSurf, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
0 | 7089 { |
7090 Dst.sub_451007_scale_image_bicubic( | |
7091 pHWLTexture->pPixels, | |
7092 pHWLTexture->uWidth, | |
7093 pHWLTexture->uHeight, | |
7094 pHWLTexture->uWidth, | |
7095 (unsigned short *)desc.lpSurface, | |
7096 desc.dwWidth, | |
7097 desc.dwHeight, | |
7098 desc.lPitch >> 1, | |
7099 0, | |
7100 0); | |
7101 ErrD3D(pNextSurf->Unlock(0)); | |
7102 //bMipMaps = 0x4D86ACu; | |
7103 } | |
7104 if (FAILED(pNextSurf->GetAttachedSurface(&v19, &pNextSurf))) | |
7105 break; | |
7106 //v10 = (IDirectDrawSurface4 *)pName; | |
7107 //v11 = 0; | |
7108 } | |
7109 //v20 = -1; | |
7110 //nullsub_1(); | |
7111 } | |
7112 else | |
7113 { | |
7114 DDSCAPS2 v19; | |
7115 memset(&v19, 0, sizeof(DDSCAPS2)); | |
7116 v19.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; | |
7117 | |
7118 DDSURFACEDESC2 desc; | |
7119 memset(&desc, 0, sizeof(DDSURFACEDESC2)); | |
7120 desc.dwSize = sizeof(DDSURFACEDESC2); | |
7121 | |
168 | 7122 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
0 | 7123 { |
7124 bMipMaps = 0; | |
7125 v13 = pHWLTexture->pPixels; | |
7126 v14 = (unsigned __int16 *)desc.lpSurface; | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7127 for(int bMipMaps = 0; bMipMaps < desc.dwHeight; bMipMaps++) |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7128 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7129 for (v15 = 0; v15 < desc.dwWidth; v15++) |
0 | 7130 { |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7131 *v14 = *v13; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7132 ++v14; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7133 ++v13; |
0 | 7134 } |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7135 v14 += (desc.lPitch >> 1) - desc.dwWidth; |
0 | 7136 } |
7137 ErrD3D((*pOutSurface)->Unlock(0)); | |
7138 } | |
7139 } | |
7140 delete [] pHWLTexture->pPixels; | |
7141 delete pHWLTexture; | |
7142 return true; | |
7143 } | |
7144 return false; | |
7145 } | |
7146 | |
7147 //----- (004A5048) -------------------------------------------------------- | |
670 | 7148 bool Render::MoveSpriteToDevice( Sprite *pSprite ) |
7149 { | |
7150 | |
7151 HWLTexture *sprite_texture; // eax@1 | |
0 | 7152 unsigned __int16 *v9; // edx@5 |
7153 LPVOID v10; // eax@5 | |
7154 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 | |
7155 | |
670 | 7156 sprite_texture = pD3DSprites.LoadTexture(pSprite->pName, pSprite->uPaletteID); |
7157 if ( sprite_texture ) | |
7158 { | |
7159 _gpu_memory_used += 2 * sprite_texture->uWidth * sprite_texture->uHeight; | |
7160 pSprite->uAreaX = sprite_texture->uAreaX; | |
7161 pSprite->uAreaY = sprite_texture->uAreaY; | |
7162 pSprite->uBufferWidth = sprite_texture->uBufferWidth; | |
7163 pSprite->uBufferHeight = sprite_texture->uBufferHeight; | |
7164 pSprite->uAreaWidth = sprite_texture->uAreaWidth; | |
7165 pSprite->uAreaHeight = sprite_texture->uAreaHeigth; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
7166 //v6 = v3->uMinDeviceTextureDim; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
7167 //v7 = v3->pRenderD3D; |
670 | 7168 if (!pRenderD3D->CreateTexture(sprite_texture->uWidth, sprite_texture->uHeight, &pSprite->pTextureSurface, &pSprite->pTexture, 1u, 0, uMinDeviceTextureDim)) |
0 | 7169 Abortf("HiScreen16::LoadTexture - D3Drend->CreateTexture() failed: %x", 0); |
7170 //pSprite = v2->pTextureSurface; | |
7171 //pSprite = (Sprite *)pSprite->pName; | |
7172 //v8 = pSprite; | |
670 | 7173 memset(&Dst, 0, sizeof(DDSURFACEDESC2)); |
0 | 7174 Dst.dwSize = 124; |
670 | 7175 if ( LockSurface_DDraw4((IDirectDrawSurface4 *)pSprite->pTextureSurface, &Dst, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
7176 { | |
7177 v9 = sprite_texture->pPixels; | |
7178 v10 = Dst.lpSurface; | |
7179 for (int i=0; i<sprite_texture->uHeight; ++i) | |
0 | 7180 { |
670 | 7181 for (int j=0; j<sprite_texture->uWidth/2; ++j) |
7182 { | |
0 | 7183 *(int *)v10 = *(int *)v9; |
7184 v9 += 2; | |
7185 v10 = (char *)v10 + 4; | |
670 | 7186 } |
7187 v10 = (char *)v10+Dst.lPitch-sprite_texture->uWidth*2; | |
0 | 7188 } |
670 | 7189 ErrD3D(pSprite->pTextureSurface->Unlock(0)); |
7190 } | |
7191 free(sprite_texture->pPixels); | |
7192 free(sprite_texture); | |
7193 return true; | |
7194 } | |
7195 return false; | |
0 | 7196 } |
7197 | |
7198 //----- (004A51CB) -------------------------------------------------------- | |
7199 void Render::BeginScene() | |
7200 { | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7201 //Render *v1; // esi@1 |
0 | 7202 unsigned int v2; // eax@1 |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7203 /*int v3; // eax@5 |
0 | 7204 unsigned __int16 **v4; // edi@6 |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7205 char *v5; // ebx@7*/ |
0 | 7206 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 |
7207 | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7208 //v1 = this; |
0 | 7209 v2 = this->uNumSceneBegins; |
7210 this->uNumSceneBegins = v2 + 1; | |
7211 if ( !v2 ) | |
7212 { | |
7213 if ( this->pRenderD3D ) | |
7214 { | |
7215 if ( this->bColorKeySupported ) | |
7216 { | |
7217 memset(&Dst, 0, 0x7Cu); | |
7218 Dst.dwSize = 124; | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7219 if ( LockSurface_DDraw4(this->pColorKeySurface4, &Dst, 0x800 | DDLOCK_WAIT) ) |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7220 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7221 this->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7222 this->uTargetSurfacePitch = Dst.lPitch >> 1; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7223 this->field_18_locked_pitch = Dst.lPitch >> 1; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7224 } |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7225 --this->uNumSceneBegins; |
0 | 7226 } |
7227 } | |
7228 else | |
7229 { | |
7230 if ( !this->pTargetSurface ) | |
7231 { | |
7232 LockRenderSurface((void **)&this->pTargetSurface, &this->uTargetSurfacePitch); | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7233 if ( this->pTargetSurface ) |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7234 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7235 this->field_18_locked_pitch = this->uTargetSurfacePitch; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7236 } |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7237 --this->uNumSceneBegins; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7238 } |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7239 } |
0 | 7240 RestoreFrontBuffer(); |
7241 } | |
7242 } | |
7243 | |
7244 //----- (004A527D) -------------------------------------------------------- | |
7245 void Render::EndScene() | |
7246 { | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7247 if ( this->uNumSceneBegins ) |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7248 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7249 this->uNumSceneBegins--; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
7250 if ( !this->uNumSceneBegins ) |
0 | 7251 { |
7252 if ( this->pRenderD3D ) | |
7253 { | |
7254 if ( this->bColorKeySupported ) | |
7255 { | |
7256 this->pTargetSurface = 0; | |
7257 this->uTargetSurfacePitch = 0; | |
7258 this->field_18_locked_pitch = 0; | |
7259 ErrD3D(this->pColorKeySurface4->Unlock(0)); | |
7260 } | |
7261 } | |
7262 else | |
7263 { | |
7264 this->pTargetSurface = 0; | |
7265 this->uTargetSurfacePitch = 0; | |
7266 this->field_18_locked_pitch = 0; | |
7267 UnlockBackBuffer(); | |
7268 } | |
7269 } | |
7270 } | |
7271 } | |
7272 | |
7273 //----- ( ) -------------------------------------------------------- | |
7274 unsigned int Render::_4A52F1(unsigned int this_, float a3) | |
7275 { | |
7276 unsigned int v3; // esi@1 | |
7277 double v4; // st7@2 | |
7278 double v5; // st7@6 | |
7279 double v6; // st6@6 | |
7280 unsigned int v7; // eax@6 | |
7281 double v8; // st5@6 | |
7282 double v9; // st4@6 | |
7283 HRESULT v10; // eax@6 | |
7284 HRESULT v11; // eax@6 | |
7285 unsigned int result; // eax@6 | |
7286 unsigned int v13; // eax@7 | |
7287 unsigned __int16 *v14; // ecx@7 | |
7288 int *v15; // eax@7 | |
7289 unsigned int v16; // ecx@8 | |
7290 __int16 v17; // ax@10 | |
7291 int v18; // esi@10 | |
7292 float v19; // edi@10 | |
7293 void *v20; // esi@10 | |
7294 int v21; // edx@10 | |
7295 int v22; // ecx@11 | |
7296 int v23; // edx@12 | |
7297 __int16 v24; // ax@15 | |
7298 int v25; // esi@15 | |
7299 float v26; // edi@15 | |
7300 char *v27; // esi@15 | |
7301 int v28; // edx@15 | |
7302 int v29; // ecx@16 | |
7303 int v30; // edx@17 | |
7304 int v31; // [sp-Ch] [bp-ACh]@11 | |
7305 int v32; // [sp-Ch] [bp-ACh]@16 | |
7306 const char *v33; // [sp+0h] [bp-A0h]@0 | |
7307 int v34; // [sp+4h] [bp-9Ch]@0 | |
7308 unsigned int v35; // [sp+8h] [bp-98h]@0 | |
7309 RenderVertexD3D3 v36[4]; // [sp+Ch] [bp-94h]@6 | |
7310 unsigned int v37; // [sp+8Ch] [bp-14h]@7 | |
7311 int v38; // [sp+90h] [bp-10h]@7 | |
7312 double v39; // [sp+94h] [bp-Ch]@6 | |
7313 float v40; // [sp+9Ch] [bp-4h]@6 | |
7314 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
7315 __debugbreak(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
7316 |
0 | 7317 auto ecx0 = this; |
7318 v3 = 0; | |
7319 if ( ecx0->pRenderD3D ) | |
7320 { | |
7321 v4 = a3; | |
7322 if ( a3 <= 1.0 ) | |
7323 { | |
7324 if ( v4 < 0.0 ) | |
7325 v4 = 0.0; | |
7326 } | |
7327 else | |
7328 { | |
7329 v4 = 1.0; | |
7330 } | |
7331 a3 = v4 * 255.0; | |
7332 v39 = a3 + 6.7553994e15; | |
7333 LODWORD(v40) = LODWORD(v39); | |
693 | 7334 v5 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 7335 v36[0].pos.x = v5; |
693 | 7336 v6 = (double)(signed int)pViewport->uViewportTL_Y; |
0 | 7337 v7 = this_ | (LODWORD(v39) << 24); |
693 | 7338 this_ = pViewport->uViewportBR_Y + 1; |
0 | 7339 v36[0].specular = 0; |
7340 v36[0].pos.y = v6; | |
7341 v36[0].diffuse = v7; | |
7342 v36[1].diffuse = v7; | |
7343 v36[0].pos.z = 0.0; | |
7344 v36[2].diffuse = v7; | |
7345 v36[3].diffuse = v7; | |
7346 v36[0].rhw = 1.0; | |
7347 v36[1].specular = 0; | |
7348 v36[0].texcoord.x = 0.0; | |
7349 v36[2].specular = 0; | |
7350 v36[3].specular = 0; | |
7351 v36[0].texcoord.y = 0.0; | |
7352 v36[1].pos.x = v5; | |
693 | 7353 v8 = (double)(pViewport->uViewportBR_Y + 1); |
0 | 7354 v36[1].pos.y = v8; |
7355 v36[1].pos.z = 0.0; | |
7356 v36[1].rhw = 1.0; | |
7357 v36[1].texcoord.x = 0.0; | |
7358 v36[1].texcoord.y = 0.0; | |
693 | 7359 v9 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 7360 v36[2].pos.x = v9; |
7361 v36[2].pos.y = v8; | |
7362 v36[2].pos.z = 0.0; | |
7363 v36[2].rhw = 1.0; | |
7364 v36[2].texcoord.x = 0.0; | |
7365 v36[2].texcoord.y = 0.0; | |
7366 v36[3].pos.x = v9; | |
7367 v36[3].pos.y = v6; | |
7368 v36[3].pos.z = 0.0; | |
7369 v36[3].rhw = 1.0; | |
7370 v36[3].texcoord.x = 0.0; | |
7371 v36[3].texcoord.y = 0.0; | |
7372 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | |
186 | 7373 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
7374 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
7375 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | |
7376 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); | |
7377 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); | |
7378 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | |
7379 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS)); | |
0 | 7380 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( |
7381 D3DPT_TRIANGLEFAN, | |
7382 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
7383 v36, | |
7384 4, | |
7385 28)); | |
186 | 7386 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
7387 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
7388 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
7389 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
7390 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
7391 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS)); | |
0 | 7392 } |
7393 else | |
7394 { | |
7395 v40 = (1.0 - a3) * 65536.0; | |
7396 v39 = v40 + 6.7553994e15; | |
7397 LODWORD(a3) = LODWORD(v39); | |
693 | 7398 v38 = (signed int)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) >> 1; |
7399 HIDWORD(v39) = pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1; | |
7400 v13 = pViewport->uViewportTL_X + ecx0->uTargetSurfacePitch - pViewport->uViewportBR_X; | |
7401 v14 = &ecx0->pTargetSurface[pViewport->uViewportTL_X + pViewport->uViewportTL_Y * ecx0->uTargetSurfacePitch]; | |
0 | 7402 v37 = 2 * v13; |
7403 LODWORD(v40) = (int)v14; | |
7404 | |
7405 int __i = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7406 v15 = dword_F1B430.data(); |
0 | 7407 do |
7408 { | |
7409 v16 = v3; | |
7410 v3 += LODWORD(a3); | |
7411 dword_F1B430[__i++] = v16 >> 16; | |
7412 } | |
7413 //while ( (signed int)v15 < (signed int)&Aureal3D_SplashScreen ); | |
7414 while (__i < 32); | |
7415 | |
7416 if ( pRenderer->uTargetGBits == 6 ) | |
7417 { | |
7418 v17 = _42690D_colors_cvt(this_); | |
7419 v18 = (65536 - LODWORD(a3)) * (v17 & 0x1F); | |
7420 this_ = (((65536 - LODWORD(a3)) * (unsigned __int16)(v17 & 0xF800) & 0xF800FFFF | v18 & 0x1F0000 | (65536 - LODWORD(a3)) * (v17 & 0x7E0) & 0x7E00000u) >> 16 << 16) | (((65536 - LODWORD(a3)) * (unsigned __int16)(v17 & 0xF800) & 0xF800FFFF | v18 & 0x1F0000 | (65536 - LODWORD(a3)) * (v17 & 0x7E0) & 0x7E00000u) >> 16); | |
7421 v19 = v40; | |
7422 v20 = off_4EFDB0; | |
7423 v21 = HIDWORD(v39); | |
7424 do | |
7425 { | |
7426 v22 = v38; | |
7427 v31 = v21; | |
7428 do | |
7429 { | |
7430 v23 = (*(int *)((char *)v20 | |
7431 + ((((unsigned __int16)(*(short *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF800u) >> 9)) << 11) | *(unsigned int *)LODWORD(v19) & 0x7FF) & 0x7C0u) >> 4)) << 6) | (*(int *)((char *)v20 + ((((*(int *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF800u) >> 9)) << 11) | (*(int *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF8000000u) >> 25)) << 27) | *(unsigned int *)LODWORD(v19) & 0x7FF07FF) & 0x7C00000u) >> 20)) << 22) | ((*(int *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF800u) >> 9)) << 11) | (*(int *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF8000000u) >> 25)) << 27) | *(unsigned int *)LODWORD(v19) & 0x7FF07FF) & 0xF81FF81F; | |
7432 result = this_ | |
7433 + (*((int *)v20 | |
7434 + (((unsigned __int8)(*((char *)v20 | |
7435 + ((((unsigned __int16)(*(short *)((char *)v20 | |
7436 + ((*(unsigned int *)LODWORD(v19) & 0xF800u) >> 9)) << 11) | *(unsigned int *)LODWORD(v19) & 0x7FF) & 0x7C0u) >> 4)) << 6) | *(unsigned int *)LODWORD(v19) & 0x1F) & 0x1F)) | (*(int *)((char *)v20 + ((v23 & 0x1F0000u) >> 14)) << 16) | ((*(int *)((char *)v20 + ((((unsigned __int16)(*(short *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF800u) >> 9)) << 11) | *(unsigned int *)LODWORD(v19) & 0x7FF) & 0x7C0u) >> 4)) << 6) | (*(int *)((char *)v20 + ((((*(int *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF800u) >> 9)) << 11) | (*(int *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF8000000u) >> 25)) << 27) | *(unsigned int *)LODWORD(v19) & 0x7FF07FF) & 0x7C00000u) >> 20)) << 22) | ((*(int *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF800u) >> 9)) << 11) | (*(int *)((char *)v20 + ((*(unsigned int *)LODWORD(v19) & 0xF8000000u) >> 25)) << 27) | *(unsigned int *)LODWORD(v19) & 0x7FF07FF) & 0xF81FF81F) & 0xFFE0FFE0); | |
7437 *(unsigned int *)LODWORD(v19) = result; | |
7438 LODWORD(v19) += 4; | |
7439 --v22; | |
7440 } | |
7441 while ( v22 ); | |
7442 LODWORD(v19) += v37; | |
7443 v21 = v31 - 1; | |
7444 } | |
7445 while ( v31 != 1 ); | |
7446 } | |
7447 else | |
7448 { | |
7449 v24 = _4268E3_smthn_to_a1r5g5b5(this_); | |
7450 v25 = (65536 - LODWORD(a3)) * (v24 & 0x1F); | |
7451 this_ = (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) | |
7452 * (v24 & 0x3E0) & 0x3E00000u) >> 16 << 16) | (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) * (v24 & 0x3E0) & 0x3E00000u) >> 16); | |
7453 v26 = v40; | |
7454 v27 = (char *)off_4EFDB0; | |
7455 v28 = HIDWORD(v39); | |
7456 do | |
7457 { | |
7458 v29 = v38; | |
7459 v32 = v28; | |
7460 do | |
7461 { | |
7462 v30 = 32 | |
7463 * *(int *)&v27[(((unsigned __int16)(*(short *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C00u) >> 8] << 10) | *(unsigned int *)LODWORD(v26) & 0x3FF) & 0x3E0u) >> 3] | (*(int *)&v27[(((*(int *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C00u) >> 8] << 10) | (*(int *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C000000u) >> 24] << 26) | *(unsigned int *)LODWORD(v26) & 0x3FF03FF) & 0x3E00000u) >> 19] << 21) | ((*(int *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C00u) >> 8] << 10) | (*(int *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C000000u) >> 24] << 26) | *(unsigned int *)LODWORD(v26) & 0x3FF03FF) & 0x7C1F7C1F; | |
7464 result = this_ | |
7465 + (*(int *)&v27[4 | |
7466 * (((unsigned __int8)(32 | |
7467 * v27[(((unsigned __int16)(*(short *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C00u) >> 8] << 10) | *(unsigned int *)LODWORD(v26) & 0x3FF) & 0x3E0u) >> 3]) | *(unsigned int *)LODWORD(v26) & 0x1F) & 0x1F)] | (*(int *)&v27[(v30 & 0x1F0000u) >> 14] << 16) | (32 * *(int *)&v27[(((unsigned __int16)(*(short *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C00u) >> 8] << 10) | *(unsigned int *)LODWORD(v26) & 0x3FF) & 0x3E0u) >> 3] | (*(int *)&v27[(((*(int *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C00u) >> 8] << 10) | (*(int *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C000000u) >> 24] << 26) | *(unsigned int *)LODWORD(v26) & 0x3FF03FF) & 0x3E00000u) >> 19] << 21) | ((*(int *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C00u) >> 8] << 10) | (*(int *)&v27[(*(unsigned int *)LODWORD(v26) & 0x7C000000u) >> 24] << 26) | *(unsigned int *)LODWORD(v26) & 0x3FF03FF) & 0x7C1F7C1F) & 0xFFE0FFE0); | |
7468 *(unsigned int *)LODWORD(v26) = result; | |
7469 LODWORD(v26) += 4; | |
7470 --v29; | |
7471 } | |
7472 while ( v29 ); | |
7473 LODWORD(v26) += v37; | |
7474 v28 = v32 - 1; | |
7475 } | |
7476 while ( v32 != 1 ); | |
7477 } | |
7478 } | |
7479 return result; | |
7480 } | |
7481 | |
7482 //----- (004A5B81) -------------------------------------------------------- | |
727 | 7483 void Render::SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) |
0 | 7484 { |
7485 this->bClip = 1; | |
7486 this->uClipY = uY; | |
7487 this->uClipX = uX; | |
7488 this->uClipW = uW; | |
7489 this->uClipZ = uZ; | |
7490 } | |
7491 | |
7492 //----- (004A5BB6) -------------------------------------------------------- | |
727 | 7493 void Render::ResetTextureClipRect() |
0 | 7494 { |
7495 this->uClipY = 0; | |
7496 this->uClipX = 0; | |
7497 this->bClip = 1; | |
7498 this->uClipW = 480; | |
7499 this->uClipZ = 640; | |
7500 } | |
7501 | |
7502 //----- (004A5BE3) -------------------------------------------------------- | |
7503 void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) | |
7504 { | |
7505 int v4; // edi@3 | |
7506 unsigned __int16 *v5; // edx@3 | |
7507 unsigned __int16 *v6; // esi@3 | |
7508 unsigned int v8; // eax@5 | |
7509 unsigned int v9; // ebx@5 | |
7510 unsigned int v11; // eax@7 | |
7511 unsigned int v12; // ebx@8 | |
7512 unsigned int v15; // eax@14 | |
7513 int v19; // [sp+10h] [bp-8h]@3 | |
7514 unsigned int uOutXa; // [sp+20h] [bp+8h]@16 | |
7515 int v23; // [sp+28h] [bp+10h]@3 | |
7516 | |
7517 if ( this->uNumSceneBegins && a4 ) | |
7518 { | |
7519 v4 = a4->uWidth; | |
7520 v5 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; | |
7521 v6 = a4->pPixels; | |
7522 v23 = a4->uHeight; | |
7523 v19 = v4; | |
7524 if ( this->bClip ) | |
7525 { | |
1152 | 7526 if ( (signed int)uOutX < (signed int)this->uClipX ) |
7527 { | |
7528 v8 = this->uClipX - uOutX; | |
7529 v9 = uOutX - this->uClipX; | |
0 | 7530 v8 *= 2; |
7531 v4 += v9; | |
7532 v6 = (unsigned __int16 *)((char *)v6 + v8); | |
7533 v5 = (unsigned __int16 *)((char *)v5 + v8); | |
7534 } | |
1152 | 7535 if ( (signed int)uOutY < (signed int)this->uClipY ) |
7536 { | |
7537 v11 = this->uClipY - uOutY; | |
0 | 7538 v6 += v19 * v11; |
7539 v23 += uOutY - this->uClipY; | |
7540 v5 += this->uTargetSurfacePitch * v11; | |
7541 } | |
1152 | 7542 v12 = max(this->uClipX, uOutX); |
7543 if ( (signed int)(v4 + v12) > (signed int)this->uClipZ ) | |
7544 { | |
7545 v4 = this->uClipZ - max(this->uClipX, uOutX); | |
7546 } | |
7547 v15 = max(this->uClipY, uOutY); | |
7548 if ( (signed int)(v15 + v23) > (signed int)this->uClipW ) | |
7549 { | |
7550 v23 = this->uClipW - max(this->uClipY, uOutY); | |
7551 } | |
7552 } | |
7553 | |
7554 for (int outerCounter = 0; outerCounter < v23; outerCounter++) | |
7555 { | |
7556 for (int counter = 0; counter < v4; counter++) | |
7557 { | |
7558 *v5 = *v6; | |
7559 ++v5; | |
7560 ++v6; | |
7561 } | |
7562 v6 += v19 - v4; | |
7563 v5 += this->uTargetSurfacePitch - v4; | |
0 | 7564 } |
7565 } | |
7566 } | |
7567 | |
7568 //----- (004A5D33) -------------------------------------------------------- | |
7569 void Render::_4A5D33(unsigned int pX, unsigned int pY, int a4, int a5, RGBTexture *pTexture) | |
7570 { | |
7571 Render *v6; // esi@1 | |
7572 unsigned __int16 *v7; // ebx@3 | |
7573 int v8; // ecx@3 | |
7574 int v9; // edx@3 | |
7575 int v10; // ecx@3 | |
7576 int v11; // edi@3 | |
7577 signed int v12; // eax@4 | |
7578 unsigned int v13; // eax@5 | |
7579 signed int v14; // eax@6 | |
7580 unsigned int v15; // eax@7 | |
7581 unsigned int v16; // edx@8 | |
7582 int v17; // eax@10 | |
7583 unsigned int v18; // ecx@11 | |
7584 unsigned int v19; // ecx@14 | |
7585 int v20; // eax@16 | |
7586 unsigned int v21; // ecx@17 | |
7587 int v22; // eax@21 | |
7588 int v23; // edi@23 | |
7589 int v24; // [sp+Ch] [bp-4h]@3 | |
7590 int a2a; // [sp+18h] [bp+8h]@21 | |
7591 unsigned int teal; // [sp+1Ch] [bp+Ch]@20 | |
7592 int a4a; // [sp+20h] [bp+10h]@3 | |
7593 int a4b; // [sp+20h] [bp+10h]@21 | |
7594 unsigned __int16 *pTexturea; // [sp+28h] [bp+18h]@3 | |
7595 | |
7596 v6 = this; | |
7597 if ( this->uNumSceneBegins && pTexture ) | |
7598 { | |
7599 v7 = &this->pTargetSurface[pX + pY * this->uTargetSurfacePitch]; | |
7600 v8 = pTexture->uWidth; | |
7601 v24 = pTexture->uWidth; | |
7602 v9 = a4 + a5 * v8; | |
7603 v10 = v8 - a4; | |
7604 a4a = v10; | |
7605 v11 = pTexture->uHeight - a5; | |
7606 pTexturea = &pTexture->pPixels[v9]; | |
7607 if ( v6->bClip ) | |
7608 { | |
7609 v12 = v6->uClipX; | |
7610 if ( (signed int)pX < v12 ) | |
7611 { | |
7612 v13 = 2 * (v12 - pX); | |
7613 pTexturea = (unsigned __int16 *)((char *)pTexturea + v13); | |
7614 v10 += pX - v6->uClipX; | |
7615 v7 = (unsigned __int16 *)((char *)v7 + v13); | |
7616 a4a = v10; | |
7617 } | |
7618 v14 = v6->uClipY; | |
7619 if ( (signed int)pY < v14 ) | |
7620 { | |
7621 v15 = v14 - pY; | |
7622 pTexturea += v24 * v15; | |
7623 v11 += pY - v6->uClipY; | |
7624 v10 = a4a; | |
7625 v7 += v6->uTargetSurfacePitch * v15; | |
7626 } | |
7627 v16 = v6->uClipX; | |
7628 if ( (signed int)v16 < (signed int)pX ) | |
7629 v16 = pX; | |
7630 v17 = v6->uClipZ; | |
7631 if ( (signed int)(v10 + v16) > v17 ) | |
7632 { | |
7633 v18 = v6->uClipX; | |
7634 if ( (signed int)v18 < (signed int)pX ) | |
7635 v18 = pX; | |
7636 a4a = v17 - v18; | |
7637 } | |
7638 v19 = v6->uClipY; | |
7639 if ( (signed int)v19 < (signed int)pY ) | |
7640 v19 = pY; | |
7641 v20 = v6->uClipW; | |
7642 if ( (signed int)(v11 + v19) > v20 ) | |
7643 { | |
7644 v21 = v6->uClipY; | |
7645 if ( (signed int)v21 < (signed int)pY ) | |
7646 v21 = pY; | |
7647 v11 = v20 - v21; | |
7648 } | |
7649 } | |
949 | 7650 teal = TargetColor(0, 0xFFu, 0xFFu); |
0 | 7651 if ( v11 > 0 ) |
7652 { | |
7653 v22 = a4a; | |
7654 a2a = v11; | |
7655 a4b = 2 * (v24 - a4a); | |
7656 do | |
7657 { | |
7658 if ( v22 > 0 ) | |
7659 { | |
7660 v23 = v22; | |
7661 do | |
7662 { | |
7663 if ( *pTexturea != teal ) | |
7664 *v7 = *pTexturea; | |
7665 ++pTexturea; | |
7666 ++v7; | |
7667 --v23; | |
7668 } | |
7669 while ( v23 ); | |
7670 } | |
7671 v7 += v6->uTargetSurfacePitch - v22; | |
7672 pTexturea = (unsigned __int16 *)((char *)pTexturea + a4b); | |
7673 --a2a; | |
7674 } | |
7675 while ( a2a ); | |
7676 } | |
7677 } | |
7678 } | |
7679 | |
7680 //----- (004A6E7E) -------------------------------------------------------- | |
7681 void Render::_4A6E7E(unsigned int a2, unsigned int a3, Texture *a4) | |
7682 { | |
7683 unsigned __int16 *v4; // eax@4 | |
7684 int v5; // edx@4 | |
7685 unsigned int v6; // edi@4 | |
7686 unsigned int v7; // edx@5 | |
7687 unsigned int v8; // edx@6 | |
7688 unsigned int v9; // edx@7 | |
7689 unsigned int v10; // edx@8 | |
7690 unsigned int v11; // ebx@9 | |
7691 unsigned int v12; // esi@11 | |
7692 unsigned int v13; // edx@12 | |
7693 unsigned int v14; // ebx@15 | |
7694 unsigned int v15; // esi@17 | |
7695 unsigned int v16; // edi@18 | |
7696 char v17; // zf@29 | |
7697 int v18; // [sp+14h] [bp-Ch]@4 | |
7698 int v19; // [sp+18h] [bp-8h]@4 | |
7699 unsigned __int8 *v20; // [sp+1Ch] [bp-4h]@4 | |
7700 int v21; // [sp+28h] [bp+8h]@25 | |
7701 int v22; // [sp+28h] [bp+8h]@34 | |
7702 unsigned int v23; // [sp+2Ch] [bp+Ch]@23 | |
7703 unsigned int v24; // [sp+2Ch] [bp+Ch]@32 | |
7704 | |
7705 if ( this->uNumSceneBegins && a4 && a4->pPalette16 ) | |
7706 { | |
7707 v4 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 7708 v20 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7709 v5 = a4->uTextureWidth; |
7710 v6 = a4->uTextureHeight; | |
7711 v19 = a4->uTextureWidth; | |
7712 v18 = a4->uTextureWidth; | |
7713 if ( this->bClip ) | |
7714 { | |
7715 v7 = this->uClipX; | |
7716 if ( (signed int)a2 < (signed int)v7 ) | |
7717 { | |
7718 v8 = v7 - a2; | |
7719 v20 += v8; | |
7720 v19 += a2 - this->uClipX; | |
7721 v4 += v8; | |
7722 } | |
7723 v9 = this->uClipY; | |
7724 if ( (signed int)a3 < (signed int)v9 ) | |
7725 { | |
7726 v10 = v9 - a3; | |
7727 v20 += v18 * v10; | |
7728 v6 = a3 - this->uClipY + a4->uTextureHeight; | |
7729 v4 += this->uTargetSurfacePitch * v10; | |
7730 } | |
7731 v11 = this->uClipX; | |
7732 v5 = v19; | |
7733 if ( (signed int)v11 < (signed int)a2 ) | |
7734 v11 = a2; | |
7735 v12 = this->uClipZ; | |
7736 if ( (signed int)(v19 + v11) > (signed int)v12 ) | |
7737 { | |
7738 v13 = this->uClipX; | |
7739 if ( (signed int)v13 < (signed int)a2 ) | |
7740 v13 = a2; | |
7741 v5 = v12 - v13; | |
7742 } | |
7743 v14 = this->uClipY; | |
7744 if ( (signed int)v14 < (signed int)a3 ) | |
7745 v14 = a3; | |
7746 v15 = this->uClipW; | |
7747 if ( (signed int)(v6 + v14) > (signed int)v15 ) | |
7748 { | |
7749 v16 = this->uClipY; | |
7750 if ( (signed int)v16 < (signed int)a3 ) | |
7751 v16 = a3; | |
7752 v6 = v15 - v16; | |
7753 } | |
7754 } | |
7755 if ( pRenderer->uTargetGBits == 5 ) | |
7756 { | |
7757 if ( (signed int)v6 > 0 ) | |
7758 { | |
7759 v23 = v6; | |
7760 do | |
7761 { | |
7762 if ( v5 > 0 ) | |
7763 { | |
7764 v21 = v5; | |
7765 do | |
7766 { | |
7767 if ( *v20 ) | |
7768 *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x3DEF; | |
7769 ++v4; | |
7770 ++v20; | |
7771 --v21; | |
7772 } | |
7773 while ( v21 ); | |
7774 } | |
7775 v20 += v18 - v5; | |
7776 v17 = v23-- == 1; | |
7777 v4 += this->uTargetSurfacePitch - v5; | |
7778 } | |
7779 while ( !v17 ); | |
7780 } | |
7781 } | |
7782 else | |
7783 { | |
7784 if ( (signed int)v6 > 0 ) | |
7785 { | |
7786 v24 = v6; | |
7787 do | |
7788 { | |
7789 if ( v5 > 0 ) | |
7790 { | |
7791 v22 = v5; | |
7792 do | |
7793 { | |
7794 if ( *v20 ) | |
7795 *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF; | |
7796 ++v4; | |
7797 ++v20; | |
7798 --v22; | |
7799 } | |
7800 while ( v22 ); | |
7801 } | |
7802 v20 += v18 - v5; | |
7803 v17 = v24-- == 1; | |
7804 v4 += this->uTargetSurfacePitch - v5; | |
7805 } | |
7806 while ( !v17 ); | |
7807 } | |
7808 } | |
7809 } | |
7810 } | |
7811 | |
7812 //----- (004A6DF5) -------------------------------------------------------- | |
7813 int Render::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) | |
7814 { | |
7815 int result; // eax@0 | |
7816 int v8; // ecx@3 | |
7817 unsigned __int16 *v9; // edi@4 | |
7818 unsigned __int16 *v10; // ebx@4 | |
7819 int v11; // esi@4 | |
7820 unsigned __int16 *pBitmapa; // [sp+14h] [bp+8h]@3 | |
7821 unsigned __int16 *pTargeta; // [sp+20h] [bp+14h]@3 | |
7822 | |
7823 if ( pBitmap ) | |
7824 { | |
7825 if ( pTarget ) | |
7826 { | |
7827 pBitmapa = &pBitmap[pBitmapXY->x + uBitmapPitch * pBitmapXY->y]; | |
7828 pTargeta = &pTarget[a7->x + uTargetPitch * a7->y]; | |
7829 v8 = a7->z - a7->x; | |
7830 result = a7->w - a7->y; | |
7831 if ( result > 0 ) | |
7832 { | |
7833 v9 = pBitmapa; | |
7834 v10 = pTargeta; | |
7835 v11 = a7->w - a7->y; | |
7836 do | |
7837 { | |
7838 if ( v8 > 0 ) | |
7839 { | |
7840 result = v8; | |
7841 do | |
7842 { | |
7843 *v9 = *v10; | |
7844 ++v9; | |
7845 ++v10; | |
7846 --result; | |
7847 } | |
7848 while ( result ); | |
7849 } | |
7850 v9 += uBitmapPitch - v8; | |
7851 v10 += uTargetPitch - v8; | |
7852 --v11; | |
7853 } | |
7854 while ( v11 ); | |
7855 } | |
7856 } | |
7857 } | |
7858 return result; | |
7859 } | |
7860 | |
7861 //----- (004A6D87) -------------------------------------------------------- | |
7862 void Render::FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16) | |
7863 { | |
7864 if (!uNumSceneBegins) | |
7865 return; | |
7866 | |
7867 unsigned __int32 twoColors = (uColor16 << 16) | uColor16; | |
7868 for (uint y = 0; y < uHeight; ++y) | |
7869 { | |
7870 auto pDst = &pTargetSurface[uX + (y + uY) * uTargetSurfacePitch]; | |
7871 | |
7872 memset32(pDst, twoColors, uWidth / 2); | |
7873 if (uWidth & 1) | |
7874 pDst[uWidth - 1] = uColor16; | |
7875 } | |
7876 } | |
7877 | |
7878 //----- (004A6C4F) -------------------------------------------------------- | |
7879 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) | |
7880 { | |
7881 unsigned int v9; // edi@2 | |
7882 unsigned int v10; // esi@2 | |
7883 unsigned __int16 *v11; // eax@2 | |
7884 unsigned int v12; // ebx@3 | |
7885 signed int v13; // edx@5 | |
7886 int v14; // edx@6 | |
7887 signed int v15; // ebx@7 | |
7888 unsigned int v16; // edx@9 | |
7889 signed int v17; // edi@10 | |
7890 signed int v18; // ebx@13 | |
7891 unsigned int v19; // edx@15 | |
7892 signed int v20; // esi@16 | |
7893 unsigned int v21; // esi@22 | |
7894 unsigned __int16 v22; // dx@24 | |
7895 char v23; // zf@28 | |
7896 unsigned __int8 *v24; // [sp+Ch] [bp-4h]@2 | |
7897 unsigned int uOutXa; // [sp+18h] [bp+8h]@20 | |
7898 | |
7899 if ( this->uNumSceneBegins ) | |
7900 { | |
7901 v9 = uCharWidth; | |
7902 v10 = uCharHeight; | |
7903 v11 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; | |
7904 v24 = pFontPixels; | |
7905 if ( this->bClip ) | |
7906 { | |
7907 v12 = this->uClipX; | |
7908 if ( uOutX < (signed int)v12 ) | |
7909 { | |
7910 v24 = &pFontPixels[v12 - uOutX]; | |
7911 v11 += v12 - uOutX; | |
7912 v9 = uCharWidth + uOutX - v12; | |
7913 } | |
7914 v13 = this->uClipY; | |
7915 if ( uOutY < v13 ) | |
7916 { | |
7917 v14 = v13 - uOutY; | |
7918 v24 += uCharWidth * v14; | |
7919 v10 = uCharHeight + uOutY - this->uClipY; | |
7920 v11 += this->uTargetSurfacePitch * v14; | |
7921 } | |
7922 v15 = this->uClipX; | |
7923 if ( v15 < uOutX ) | |
7924 v15 = uOutX; | |
7925 v16 = this->uClipZ; | |
7926 if ( (signed int)(v9 + v15) > (signed int)v16 ) | |
7927 { | |
7928 v17 = this->uClipX; | |
7929 if ( v17 < uOutX ) | |
7930 v17 = uOutX; | |
7931 v9 = v16 - v17; | |
7932 } | |
7933 v18 = this->uClipY; | |
7934 if ( v18 < uOutY ) | |
7935 v18 = uOutY; | |
7936 v19 = this->uClipW; | |
7937 if ( (signed int)(v10 + v18) > (signed int)v19 ) | |
7938 { | |
7939 v20 = this->uClipY; | |
7940 if ( v20 < uOutY ) | |
7941 v20 = uOutY; | |
7942 v10 = v19 - v20; | |
7943 } | |
7944 } | |
7945 if ( (signed int)v10 > 0 ) | |
7946 { | |
7947 uOutXa = v10; | |
7948 do | |
7949 { | |
7950 if ( (signed int)v9 > 0 ) | |
7951 { | |
7952 v21 = v9; | |
7953 do | |
7954 { | |
7955 if ( *v24 ) | |
7956 { | |
7957 v22 = uShadowColor; | |
7958 if ( *v24 != 1 ) | |
7959 v22 = uFaceColor; | |
7960 *v11 = v22; | |
7961 } | |
7962 ++v11; | |
7963 ++v24; | |
7964 --v21; | |
7965 } | |
7966 while ( v21 ); | |
7967 } | |
7968 v24 += uCharWidth - v9; | |
7969 v23 = uOutXa-- == 1; | |
7970 v11 += this->uTargetSurfacePitch - v9; | |
7971 } | |
7972 while ( !v23 ); | |
7973 } | |
7974 } | |
7975 } | |
7976 | |
7977 //----- (004A6A68) -------------------------------------------------------- | |
7978 void Render::_4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height) | |
7979 { | |
7980 Render *v5; // ebx@1 | |
7981 unsigned __int16 v6; // ax@1 | |
7982 | |
7983 v5 = this; | |
7984 | |
7985 Texture tex; // [sp+Ch] [bp-48h]@1 | |
7986 //Texture::Texture(&tex); | |
7987 | |
7988 v6 = a4->uTextureHeight - height; | |
7989 memcpy(&tex, a4, sizeof(tex)); | |
7990 tex.uTextureHeight = v6; | |
7991 if ( (signed __int16)v6 > 0 ) | |
7992 DrawTextureIndexed(a2, a3, &tex); | |
7993 } | |
7994 | |
7995 //----- (004A6AB1) -------------------------------------------------------- | |
1268 | 7996 void Render::DrawTextPalette( int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8 ) |
7997 { | |
0 | 7998 int v8; // edi@2 |
7999 unsigned int v9; // esi@2 | |
8000 unsigned __int16 *v10; // eax@2 | |
8001 unsigned char *v11; // edx@2 | |
8002 unsigned int v12; // ebx@3 | |
8003 signed int v13; // edx@5 | |
8004 int v14; // edx@6 | |
8005 signed int v15; // ebx@7 | |
8006 unsigned int v16; // edx@9 | |
8007 signed int v17; // edi@10 | |
8008 signed int v18; // ebx@13 | |
8009 unsigned int v19; // edx@15 | |
8010 signed int v20; // esi@16 | |
8011 int v21; // ebx@22 | |
8012 char v22; // zf@28 | |
8013 int v23; // ebx@31 | |
8014 unsigned __int16 v24; // si@35 | |
8015 int v25; // [sp+Ch] [bp-4h]@2 | |
8016 int v26; // [sp+1Ch] [bp+Ch]@24 | |
8017 int v27; // [sp+1Ch] [bp+Ch]@33 | |
8018 unsigned int v28; // [sp+20h] [bp+10h]@30 | |
8019 unsigned int v29; // [sp+24h] [bp+14h]@22 | |
8020 unsigned int v30; // [sp+24h] [bp+14h]@31 | |
8021 | |
8022 auto a2 = x; | |
8023 auto a3 = y; | |
8024 auto a6 = uFontHeight; | |
8025 if ( this->uNumSceneBegins ) | |
8026 { | |
8027 v8 = a5; | |
8028 v9 = a6; | |
8029 v10 = &pTargetSurface[x + y * uTargetSurfacePitch]; | |
1268 | 8030 v11 = (unsigned char *)font_pixels; |
8031 v25 = (int)font_pixels; | |
0 | 8032 if ( this->bClip ) |
8033 { | |
8034 v12 = this->uClipX; | |
8035 if ( a2 < (signed int)v12 ) | |
8036 { | |
1268 | 8037 v25 = v12 - a2 + (int)font_pixels; |
0 | 8038 v10 += v12 - a2; |
8039 v8 = a5 + a2 - v12; | |
8040 } | |
8041 v13 = this->uClipY; | |
8042 if ( a3 < v13 ) | |
8043 { | |
8044 v14 = v13 - a3; | |
8045 v25 += a5 * v14; | |
8046 v9 = a6 + a3 - this->uClipY; | |
8047 v10 += this->uTargetSurfacePitch * v14; | |
8048 } | |
8049 v15 = this->uClipX; | |
8050 if ( v15 < a2 ) | |
8051 v15 = a2; | |
8052 v16 = this->uClipZ; | |
8053 if ( v8 + v15 > (signed int)v16 ) | |
8054 { | |
8055 v17 = this->uClipX; | |
8056 if ( v17 < a2 ) | |
8057 v17 = a2; | |
8058 v8 = v16 - v17; | |
8059 } | |
8060 v18 = this->uClipY; | |
8061 if ( v18 < a3 ) | |
8062 v18 = a3; | |
8063 v19 = this->uClipW; | |
8064 if ( (signed int)(v9 + v18) > (signed int)v19 ) | |
8065 { | |
8066 v20 = this->uClipY; | |
8067 if ( v20 < a3 ) | |
8068 v20 = a3; | |
8069 v9 = v19 - v20; | |
8070 } | |
8071 v11 = (unsigned char *)v25; | |
8072 } | |
8073 if ( a8 ) | |
8074 { | |
8075 v28 = pRenderer->uTargetGMask | pRenderer->uTargetBMask; | |
8076 if ( (signed int)v9 > 0 ) | |
8077 { | |
8078 v23 = a5; | |
8079 v30 = v9; | |
8080 do | |
8081 { | |
8082 if ( v8 > 0 ) | |
8083 { | |
8084 v27 = v8; | |
8085 do | |
8086 { | |
8087 if ( *v11 ) | |
8088 v24 = pPalette[*v11]; | |
8089 else | |
8090 v24 = v28; | |
8091 *v10 = v24; | |
8092 ++v10; | |
8093 ++v11; | |
8094 --v27; | |
8095 } | |
8096 while ( v27 ); | |
8097 } | |
8098 v11 += v23 - v8; | |
8099 v22 = v30-- == 1; | |
8100 v10 += this->uTargetSurfacePitch - v8; | |
8101 } | |
8102 while ( !v22 ); | |
8103 } | |
8104 } | |
8105 else | |
8106 { | |
8107 if ( (signed int)v9 > 0 ) | |
8108 { | |
8109 v21 = a5; | |
8110 v29 = v9; | |
8111 do | |
8112 { | |
8113 if ( v8 > 0 ) | |
8114 { | |
8115 v26 = v8; | |
8116 do | |
8117 { | |
8118 if ( *v11 ) | |
8119 *v10 = pPalette[*v11]; | |
8120 ++v10; | |
8121 ++v11; | |
8122 --v26; | |
8123 } | |
8124 while ( v26 ); | |
8125 } | |
8126 v11 += v21 - v8; | |
8127 v22 = v29-- == 1; | |
8128 v10 += this->uTargetSurfacePitch - v8; | |
8129 } | |
8130 while ( !v22 ); | |
8131 } | |
8132 } | |
8133 } | |
8134 } | |
8135 | |
8136 //----- (004A68EF) -------------------------------------------------------- | |
8137 void Render::DrawTransparentGreenShade(signed int a2, signed int a3, Texture *pTexture) | |
8138 { | |
8139 Texture *v4; // edi@2 | |
8140 unsigned int v5; // ebx@4 | |
8141 unsigned __int16 *v6; // eax@4 | |
8142 signed int v7; // edx@5 | |
8143 int v8; // edx@6 | |
8144 signed int v9; // edx@7 | |
8145 int v10; // edx@8 | |
8146 signed int v11; // edx@9 | |
8147 signed int v12; // esi@12 | |
8148 signed int v13; // esi@15 | |
8149 unsigned int v14; // edx@17 | |
8150 signed int v15; // esi@18 | |
8151 unsigned __int8 *v16; // ebx@22 | |
8152 char v17; // zf@28 | |
8153 int v18; // [sp+10h] [bp-10h]@4 | |
8154 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
8155 int v20; // [sp+1Ch] [bp-4h]@4 | |
8156 int v21; // [sp+28h] [bp+8h]@24 | |
8157 unsigned int v22; // [sp+2Ch] [bp+Ch]@22 | |
8158 unsigned int pTexturea; // [sp+30h] [bp+10h]@11 | |
8159 | |
8160 if ( this->uNumSceneBegins ) | |
8161 { | |
8162 v4 = pTexture; | |
8163 if ( pTexture ) | |
8164 { | |
8165 if ( pTexture->pPalette16 ) | |
8166 { | |
8167 v5 = pTexture->uTextureHeight; | |
8168 v6 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 8169 v19 = pTexture->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8170 v20 = pTexture->uTextureWidth; |
8171 v18 = pTexture->uTextureWidth; | |
8172 if ( this->bClip ) | |
8173 { | |
8174 v7 = this->uClipX; | |
8175 if ( a2 < v7 ) | |
8176 { | |
8177 v8 = v7 - a2; | |
8178 v19 += v8; | |
8179 v20 += a2 - this->uClipX; | |
8180 v6 += v8; | |
8181 } | |
8182 v9 = this->uClipY; | |
8183 v5 = pTexture->uTextureHeight; | |
8184 if ( a3 < v9 ) | |
8185 { | |
8186 v10 = v9 - a3; | |
8187 v19 += v18 * v10; | |
8188 v5 = a3 - this->uClipY + pTexture->uTextureHeight; | |
8189 v4 = pTexture; | |
8190 v6 += this->uTargetSurfacePitch * v10; | |
8191 } | |
8192 v11 = this->uClipX; | |
8193 if ( v11 < a2 ) | |
8194 v11 = a2; | |
8195 pTexturea = this->uClipZ; | |
8196 if ( v11 + v20 > (signed int)pTexturea ) | |
8197 { | |
8198 v12 = this->uClipX; | |
8199 if ( v12 < a2 ) | |
8200 v12 = a2; | |
8201 v20 = pTexturea - v12; | |
8202 } | |
8203 v13 = this->uClipY; | |
8204 if ( v13 < a3 ) | |
8205 v13 = a3; | |
8206 v14 = this->uClipW; | |
8207 if ( (signed int)(v5 + v13) > (signed int)v14 ) | |
8208 { | |
8209 v15 = this->uClipY; | |
8210 if ( v15 < a3 ) | |
8211 v15 = a3; | |
8212 v5 = v14 - v15; | |
8213 } | |
8214 } | |
8215 if ( (signed int)v5 > 0 ) | |
8216 { | |
8217 v22 = v5; | |
8218 v16 = v19; | |
8219 do | |
8220 { | |
8221 if ( v20 > 0 ) | |
8222 { | |
8223 v21 = v20; | |
8224 do | |
8225 { | |
8226 if ( *v16 ) | |
8227 *v6 = this->uTargetGMask & v4->pPalette16[*v16]; | |
8228 ++v6; | |
8229 ++v16; | |
8230 --v21; | |
8231 } | |
8232 while ( v21 ); | |
8233 } | |
8234 v16 += v18 - v20; | |
8235 v17 = v22-- == 1; | |
8236 v6 += this->uTargetSurfacePitch - v20; | |
8237 } | |
8238 while ( !v17 ); | |
8239 } | |
8240 } | |
8241 } | |
8242 } | |
8243 } | |
8244 | |
8245 //----- (004A6776) -------------------------------------------------------- | |
315 | 8246 void Render::DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4) |
0 | 8247 { |
8248 Texture *v4; // edi@2 | |
8249 unsigned int v5; // ebx@4 | |
8250 unsigned __int16 *v6; // eax@4 | |
8251 unsigned int v7; // edx@5 | |
8252 unsigned int v8; // edx@6 | |
8253 unsigned int v9; // edx@7 | |
8254 unsigned int v10; // edx@8 | |
8255 unsigned int v11; // edx@9 | |
8256 unsigned int v12; // esi@12 | |
8257 unsigned int v13; // esi@15 | |
8258 unsigned int v14; // edx@17 | |
8259 unsigned int v15; // esi@18 | |
8260 unsigned __int8 *v16; // ebx@22 | |
8261 char v17; // zf@28 | |
8262 int v18; // [sp+10h] [bp-10h]@4 | |
8263 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
8264 int v20; // [sp+1Ch] [bp-4h]@4 | |
8265 int a2a; // [sp+28h] [bp+8h]@24 | |
8266 unsigned int a3a; // [sp+2Ch] [bp+Ch]@22 | |
8267 unsigned int a4a; // [sp+30h] [bp+10h]@11 | |
8268 | |
8269 if ( this->uNumSceneBegins ) | |
8270 { | |
8271 v4 = a4; | |
8272 if ( a4 ) | |
8273 { | |
8274 if ( a4->pPalette16 ) | |
8275 { | |
8276 v5 = a4->uTextureHeight; | |
8277 v6 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 8278 v19 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8279 v20 = a4->uTextureWidth; |
8280 v18 = a4->uTextureWidth; | |
8281 if ( this->bClip ) | |
8282 { | |
8283 v7 = this->uClipX; | |
8284 if ( (signed int)a2 < (signed int)v7 ) | |
8285 { | |
8286 v8 = v7 - a2; | |
8287 v19 += v8; | |
8288 v20 += a2 - this->uClipX; | |
8289 v6 += v8; | |
8290 } | |
8291 v9 = this->uClipY; | |
8292 v5 = a4->uTextureHeight; | |
8293 if ( (signed int)a3 < (signed int)v9 ) | |
8294 { | |
8295 v10 = v9 - a3; | |
8296 v19 += v18 * v10; | |
8297 v5 = a3 - this->uClipY + a4->uTextureHeight; | |
8298 v4 = a4; | |
8299 v6 += this->uTargetSurfacePitch * v10; | |
8300 } | |
8301 v11 = this->uClipX; | |
8302 if ( (signed int)v11 < (signed int)a2 ) | |
8303 v11 = a2; | |
8304 a4a = this->uClipZ; | |
8305 if ( (signed int)(v11 + v20) > (signed int)a4a ) | |
8306 { | |
8307 v12 = this->uClipX; | |
8308 if ( (signed int)v12 < (signed int)a2 ) | |
8309 v12 = a2; | |
8310 v20 = a4a - v12; | |
8311 } | |
8312 v13 = this->uClipY; | |
8313 if ( (signed int)v13 < (signed int)a3 ) | |
8314 v13 = a3; | |
8315 v14 = this->uClipW; | |
8316 if ( (signed int)(v5 + v13) > (signed int)v14 ) | |
8317 { | |
8318 v15 = this->uClipY; | |
8319 if ( (signed int)v15 < (signed int)a3 ) | |
8320 v15 = a3; | |
8321 v5 = v14 - v15; | |
8322 } | |
8323 } | |
8324 if ( (signed int)v5 > 0 ) | |
8325 { | |
8326 a3a = v5; | |
8327 v16 = v19; | |
8328 do | |
8329 { | |
8330 if ( v20 > 0 ) | |
8331 { | |
8332 a2a = v20; | |
8333 do | |
8334 { | |
8335 if ( *v16 ) | |
8336 *v6 = this->uTargetRMask & v4->pPalette16[*v16]; | |
8337 ++v6; | |
8338 ++v16; | |
8339 --a2a; | |
8340 } | |
8341 while ( a2a ); | |
8342 } | |
8343 v16 += v18 - v20; | |
8344 v17 = a3a-- == 1; | |
8345 v6 += this->uTargetSurfacePitch - v20; | |
8346 } | |
8347 while ( !v17 ); | |
8348 } | |
8349 } | |
8350 } | |
8351 } | |
8352 } | |
8353 | |
8354 //----- (004A65CC) -------------------------------------------------------- | |
8355 void Render::_4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8) | |
8356 { | |
8357 unsigned __int16 *v8; // esi@6 | |
8358 unsigned int v9; // edi@6 | |
8359 unsigned int v10; // eax@7 | |
8360 unsigned int v11; // eax@8 | |
8361 unsigned int v12; // eax@9 | |
8362 unsigned int v13; // eax@10 | |
8363 unsigned int v14; // edx@11 | |
8364 unsigned int v15; // eax@13 | |
8365 unsigned int v16; // edx@14 | |
8366 unsigned int v17; // edx@17 | |
8367 unsigned int v18; // eax@19 | |
8368 unsigned int v19; // edx@20 | |
8369 int v20; // eax@27 | |
8370 int v21; // edx@29 | |
8371 int v22; // [sp+Ch] [bp-Ch]@6 | |
8372 int v23; // [sp+Ch] [bp-Ch]@24 | |
8373 unsigned __int8 *v24; // [sp+14h] [bp-4h]@6 | |
8374 int xa; // [sp+20h] [bp+8h]@26 | |
8375 unsigned int ya; // [sp+24h] [bp+Ch]@24 | |
8376 int v27; // [sp+2Ch] [bp+14h]@6 | |
8377 | |
8378 if ( this->uNumSceneBegins && a4 && a4->pPalette16 && a5 && a5->pPalette16 ) | |
8379 { | |
8380 v8 = &this->pTargetSurface[x + y * this->uTargetSurfacePitch]; | |
710 | 8381 v24 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8382 v27 = a4->uTextureWidth; |
8383 v9 = a4->uTextureHeight; | |
8384 v22 = a4->uTextureWidth; | |
8385 if ( this->bClip ) | |
8386 { | |
8387 v10 = this->uClipX; | |
8388 if ( (signed int)x < (signed int)v10 ) | |
8389 { | |
8390 v11 = v10 - x; | |
8391 v24 += v11; | |
8392 v27 += x - this->uClipX; | |
8393 v8 += v11; | |
8394 } | |
8395 v12 = this->uClipY; | |
8396 if ( (signed int)y < (signed int)v12 ) | |
8397 { | |
8398 v13 = v12 - y; | |
8399 v24 += v22 * v13; | |
8400 v9 = y - this->uClipY + a4->uTextureHeight; | |
8401 v8 += this->uTargetSurfacePitch * v13; | |
8402 } | |
8403 v14 = this->uClipX; | |
8404 if ( (signed int)v14 < (signed int)x ) | |
8405 v14 = x; | |
8406 v15 = this->uClipZ; | |
8407 if ( (signed int)(v27 + v14) > (signed int)v15 ) | |
8408 { | |
8409 v16 = this->uClipX; | |
8410 if ( (signed int)v16 < (signed int)x ) | |
8411 v16 = x; | |
8412 v27 = v15 - v16; | |
8413 } | |
8414 v17 = this->uClipY; | |
8415 if ( (signed int)v17 < (signed int)y ) | |
8416 v17 = y; | |
8417 v18 = this->uClipW; | |
8418 if ( (signed int)(v9 + v17) > (signed int)v18 ) | |
8419 { | |
8420 v19 = this->uClipY; | |
8421 if ( (signed int)v19 < (signed int)y ) | |
8422 v19 = y; | |
8423 v9 = v18 - v19; | |
8424 } | |
8425 } | |
8426 if ( (signed int)v9 > 0 ) | |
8427 { | |
8428 ya = v9; | |
8429 v23 = v22 - v27; | |
8430 do | |
8431 { | |
8432 if ( v27 > 0 ) | |
8433 { | |
8434 xa = v27; | |
8435 do | |
8436 { | |
8437 v20 = *v24; | |
8438 if ( v20 >= a7 && v20 <= a8 ) | |
8439 { | |
8440 v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); | |
8441 if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) | |
8442 v21 = 2 * a8 - v21 - a7; | |
8443 *v8 = a4->pPalette16[v21]; | |
8444 } | |
8445 ++v8; | |
8446 ++v24; | |
8447 --xa; | |
8448 } | |
8449 while ( xa ); | |
8450 } | |
8451 v8 += this->uTargetSurfacePitch - v27; | |
8452 v24 += v23; | |
8453 --ya; | |
8454 } | |
8455 while ( ya ); | |
8456 } | |
8457 } | |
8458 } | |
8459 | |
8460 //----- (004A63E6) -------------------------------------------------------- | |
8461 void Render::_4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) | |
8462 { | |
8463 Texture *v8; // eax@2 | |
8464 Texture *v9; // ebx@4 | |
8465 unsigned __int16 *v10; // esi@6 | |
8466 unsigned int v11; // edi@7 | |
8467 unsigned int v12; // eax@9 | |
8468 unsigned int v13; // eax@10 | |
8469 unsigned int v14; // edx@11 | |
8470 unsigned int v15; // eax@13 | |
8471 unsigned int v16; // edx@14 | |
8472 unsigned int v17; // edx@17 | |
8473 unsigned int v18; // eax@19 | |
8474 unsigned int v19; // edx@20 | |
8475 int v20; // eax@27 | |
8476 int v21; // edx@29 | |
8477 int v22; // [sp+Ch] [bp-Ch]@6 | |
8478 int v23; // [sp+Ch] [bp-Ch]@24 | |
8479 int v24; // [sp+10h] [bp-8h]@6 | |
8480 int v25; // [sp+14h] [bp-4h]@6 | |
8481 int i; // [sp+20h] [bp+8h]@25 | |
8482 int v27; // [sp+24h] [bp+Ch]@23 | |
8483 unsigned __int8 *v28; // [sp+28h] [bp+10h]@6 | |
8484 | |
8485 if ( this->uNumSceneBegins ) | |
8486 { | |
8487 v8 = a4; | |
8488 if ( a4 ) | |
8489 { | |
8490 if ( a4->pPalette16 ) | |
8491 { | |
8492 v9 = a5; | |
8493 if ( a5 ) | |
8494 { | |
8495 if ( a5->pPalette16 ) | |
8496 { | |
8497 v10 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 8498 v28 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8499 v25 = v8->uTextureWidth; |
8500 v24 = v8->uTextureHeight; | |
8501 v22 = v8->uTextureWidth; | |
8502 if ( this->bClip ) | |
8503 { | |
8504 v11 = this->uClipX; | |
8505 if ( (signed int)a2 < (signed int)v11 ) | |
8506 { | |
8507 v28 += v11 - a2; | |
8508 v25 += a2 - v11; | |
8509 v9 = a5; | |
8510 v10 += v11 - a2; | |
8511 } | |
8512 v12 = this->uClipY; | |
8513 if ( (signed int)a3 < (signed int)v12 ) | |
8514 { | |
8515 v13 = v12 - a3; | |
8516 v9 = a5; | |
8517 v28 += v22 * v13; | |
8518 v24 += a3 - this->uClipY; | |
8519 v10 += this->uTargetSurfacePitch * v13; | |
8520 } | |
8521 v14 = this->uClipX; | |
8522 if ( (signed int)v14 < (signed int)a2 ) | |
8523 v14 = a2; | |
8524 v15 = this->uClipZ; | |
8525 if ( (signed int)(v25 + v14) > (signed int)v15 ) | |
8526 { | |
8527 v16 = this->uClipX; | |
8528 if ( (signed int)v16 < (signed int)a2 ) | |
8529 v16 = a2; | |
8530 v25 = v15 - v16; | |
8531 } | |
8532 v17 = this->uClipY; | |
8533 if ( (signed int)v17 < (signed int)a3 ) | |
8534 v17 = a3; | |
8535 v18 = this->uClipW; | |
8536 if ( (signed int)(v24 + v17) > (signed int)v18 ) | |
8537 { | |
8538 v19 = this->uClipY; | |
8539 if ( (signed int)v19 < (signed int)a3 ) | |
8540 v19 = a3; | |
8541 v24 = v18 - v19; | |
8542 } | |
8543 } | |
8544 v27 = 0; | |
8545 if ( v24 > 0 ) | |
8546 { | |
8547 v23 = v22 - v25; | |
8548 do | |
8549 { | |
8550 for ( i = 0; i < v25; ++v28 ) | |
8551 { | |
8552 if ( *v28 ) | |
8553 { | |
710 | 8554 v20 = *(&v9->pLevelOfDetail0_prolly_alpha_mask[i & v9->uWidthMinus1] + v9->uTextureWidth * (v27 & v9->uHeightMinus1)); |
0 | 8555 if ( v20 >= a7 ) |
8556 { | |
8557 if ( v20 <= a8 ) | |
8558 { | |
8559 v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); | |
8560 if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) | |
8561 v21 = 2 * a8 - v21 - a7; | |
8562 v9 = a5; | |
8563 *v10 = a5->pPalette16[v21]; | |
8564 } | |
8565 } | |
8566 } | |
8567 ++i; | |
8568 ++v10; | |
8569 } | |
8570 ++v27; | |
8571 v10 += this->uTargetSurfacePitch - v25; | |
8572 v28 += v23; | |
8573 } | |
8574 while ( v27 < v24 ); | |
8575 } | |
8576 } | |
8577 } | |
8578 } | |
8579 } | |
8580 } | |
8581 } | |
8582 | |
8583 //----- (004A6274) -------------------------------------------------------- | |
8584 void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture) | |
8585 { | |
8586 Texture *pCurrentTexture; // edi@2 | |
8587 int uHeight; // ebx@4 | |
8588 unsigned __int16 *v6; // eax@4 | |
8589 unsigned int v7; // edx@5 | |
8590 unsigned int v8; // edx@6 | |
8591 unsigned int v9; // edx@7 | |
8592 unsigned int v10; // edx@8 | |
8593 unsigned int v11; // edx@9 | |
8594 unsigned int v12; // esi@12 | |
8595 unsigned int v13; // esi@15 | |
8596 unsigned int v14; // edx@17 | |
8597 unsigned int v15; // esi@18 | |
8598 unsigned __int8 *v16; // ebx@22 | |
8599 char uFlag; // zf@28 | |
8600 int v18; // [sp+10h] [bp-10h]@4 | |
8601 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
8602 int uWidth; // [sp+1Ch] [bp-4h]@4 | |
8603 int uXa; // [sp+28h] [bp+8h]@24 | |
8604 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 | |
8605 unsigned int pTexturea; // [sp+30h] [bp+10h]@11 | |
8606 | |
8607 if ( this->uNumSceneBegins ) | |
8608 { | |
8609 pCurrentTexture = pTexture; | |
8610 if ( pTexture ) | |
8611 { | |
8612 if ( pTexture->pPalette16 ) | |
8613 { | |
8614 uHeight = pTexture->uTextureHeight; | |
8615 v6 = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; | |
710 | 8616 v19 = pTexture->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8617 uWidth = pTexture->uTextureWidth; |
8618 v18 = pTexture->uTextureWidth; | |
8619 if ( this->bClip ) | |
8620 { | |
8621 v7 = this->uClipX; | |
8622 if ( (signed int)uX < (signed int)v7 ) | |
8623 { | |
8624 v8 = v7 - uX; | |
8625 v19 += v8; | |
8626 uWidth += uX - this->uClipX; | |
8627 v6 += v8; | |
8628 } | |
8629 v9 = this->uClipY; | |
8630 uHeight = pTexture->uTextureHeight; | |
8631 if ( (signed int)uY < (signed int)v9 ) | |
8632 { | |
8633 v10 = v9 - uY; | |
8634 v19 += v18 * v10; | |
8635 uHeight = uY - this->uClipY + pTexture->uTextureHeight; | |
8636 pCurrentTexture = pTexture; | |
8637 v6 += this->uTargetSurfacePitch * v10; | |
8638 } | |
8639 v11 = this->uClipX; | |
8640 if ( (signed int)v11 < (signed int)uX ) | |
8641 v11 = uX; | |
8642 pTexturea = this->uClipZ; | |
8643 if ( (signed int)(v11 + uWidth) > (signed int)pTexturea ) | |
8644 { | |
8645 v12 = this->uClipX; | |
8646 if ( (signed int)v12 < (signed int)uX ) | |
8647 v12 = uX; | |
8648 uWidth = pTexturea - v12; | |
8649 } | |
8650 v13 = this->uClipY; | |
8651 if ( (signed int)v13 < (signed int)uY ) | |
8652 v13 = uY; | |
8653 v14 = this->uClipW; | |
8654 if ( (signed int)(uHeight + v13) > (signed int)v14 ) | |
8655 { | |
8656 v15 = this->uClipY; | |
8657 if ( (signed int)v15 < (signed int)uY ) | |
8658 v15 = uY; | |
8659 uHeight = v14 - v15; | |
8660 } | |
8661 } | |
8662 if ( (signed int)uHeight > 0 ) | |
8663 { | |
8664 uYa = uHeight; | |
8665 v16 = v19; | |
8666 do | |
8667 { | |
8668 if ( uWidth > 0 ) | |
8669 { | |
8670 uXa = uWidth; | |
8671 do | |
8672 { | |
8673 if ( *v16 ) | |
8674 *v6 = pCurrentTexture->pPalette16[*v16]; | |
8675 ++v6; | |
8676 ++v16; | |
8677 } | |
8678 while ( uXa-- !=1 ); | |
8679 } | |
8680 v16 += v18 - uWidth; | |
8681 uFlag = uYa-- == 1; | |
8682 v6 += this->uTargetSurfacePitch - uWidth; | |
8683 } | |
8684 while ( !uFlag ); | |
8685 } | |
8686 } | |
8687 } | |
8688 } | |
8689 } | |
8690 | |
8691 //----- (004A612A) -------------------------------------------------------- | |
710 | 8692 void Render::DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal) |
0 | 8693 { |
8694 Texture *v5; // eax@2 | |
8695 unsigned int v6; // edx@3 | |
8696 int v7; // ebx@3 | |
8697 int v8; // edi@3 | |
8698 signed int v9; // eax@4 | |
8699 int v10; // eax@5 | |
8700 unsigned int v11; // esi@6 | |
8701 signed int v12; // esi@8 | |
8702 unsigned int v13; // eax@10 | |
8703 signed int v14; // esi@11 | |
8704 unsigned int v15; // esi@14 | |
8705 unsigned int v16; // eax@16 | |
8706 unsigned int v17; // ecx@17 | |
8707 int v18; // edx@23 | |
8708 int v19; // [sp+Ch] [bp-Ch]@3 | |
8709 int v20; // [sp+10h] [bp-8h]@3 | |
8710 int uOutXa; // [sp+20h] [bp+8h]@21 | |
8711 unsigned __int8 *uOutYa; // [sp+24h] [bp+Ch]@3 | |
8712 int *pZBuffer; // [sp+28h] [bp+10h]@3 | |
8713 | |
8714 if ( this->uNumSceneBegins ) | |
8715 { | |
8716 v5 = pTexture; | |
8717 if ( pTexture ) | |
8718 { | |
8719 v6 = uOutY; | |
8720 v7 = pTexture->uTextureHeight; | |
8721 pZBuffer = &this->pActiveZBuffer[uOutX + 640 * uOutY]; | |
710 | 8722 uOutYa = v5->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8723 v8 = v5->uTextureWidth; |
8724 v20 = v5->uTextureWidth; | |
8725 v19 = v5->uTextureWidth; | |
8726 if ( this->bClip ) | |
8727 { | |
8728 v9 = this->uClipX; | |
8729 if ( uOutX < v9 ) | |
8730 { | |
8731 v10 = v9 - uOutX; | |
8732 uOutYa += v10; | |
8733 v8 += uOutX - this->uClipX; | |
8734 v20 = v8; | |
8735 pZBuffer += v10; | |
8736 } | |
8737 v11 = this->uClipY; | |
8738 if ( (signed int)v6 < (signed int)v11 ) | |
8739 { | |
8740 uOutYa += v19 * (v11 - v6); | |
8741 v7 += v6 - v11; | |
8742 pZBuffer += 640 * (v11 - v6); | |
8743 v8 = v20; | |
8744 } | |
8745 v12 = this->uClipX; | |
8746 if ( v12 < uOutX ) | |
8747 v12 = uOutX; | |
8748 v13 = this->uClipZ; | |
8749 if ( v8 + v12 > (signed int)v13 ) | |
8750 { | |
8751 v14 = this->uClipX; | |
8752 if ( v14 < uOutX ) | |
8753 v14 = uOutX; | |
8754 v8 = v13 - v14; | |
8755 } | |
8756 v15 = this->uClipY; | |
8757 if ( (signed int)v15 < (signed int)v6 ) | |
8758 v15 = v6; | |
8759 v16 = this->uClipW; | |
8760 if ( (signed int)(v7 + v15) > (signed int)v16 ) | |
8761 { | |
8762 v17 = this->uClipY; | |
8763 if ( (signed int)v17 >= (signed int)v6 ) | |
8764 v6 = v17; | |
8765 v7 = v16 - v6; | |
8766 } | |
8767 } | |
8768 if ( v7 > 0 ) | |
8769 { | |
8770 uOutXa = v7; | |
8771 do | |
8772 { | |
8773 if ( v8 > 0 ) | |
8774 { | |
8775 v18 = v8; | |
8776 do | |
8777 { | |
8778 if ( *uOutYa ) | |
8779 *pZBuffer = zVal; | |
8780 ++pZBuffer; | |
8781 ++uOutYa; | |
8782 --v18; | |
8783 } | |
8784 while ( v18 ); | |
8785 } | |
8786 pZBuffer += 640 - v8; | |
8787 uOutYa += v19 - v8; | |
8788 --uOutXa; | |
8789 } | |
8790 while ( uOutXa ); | |
8791 } | |
8792 } | |
8793 } | |
8794 } | |
8795 | |
8796 //----- (004A601E) -------------------------------------------------------- | |
991 | 8797 void Render::ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5) |
0 | 8798 { |
8799 signed int v5; // edx@3 | |
8800 int v6; // ebx@3 | |
8801 int v7; // esi@3 | |
8802 void *v8; // esi@3 | |
8803 unsigned int v9; // eax@4 | |
8804 unsigned int v10; // eax@6 | |
8805 signed int v11; // edi@8 | |
8806 unsigned int v12; // eax@10 | |
8807 signed int v13; // edi@11 | |
8808 unsigned int v14; // edi@14 | |
8809 unsigned int v15; // eax@16 | |
8810 unsigned int v16; // ecx@17 | |
8811 int v17; // [sp+18h] [bp+Ch]@3 | |
8812 unsigned int pTexturea; // [sp+1Ch] [bp+10h]@3 | |
8813 | |
8814 if ( this->uNumSceneBegins && pTexture ) | |
8815 { | |
8816 v5 = a3; | |
8817 v6 = pTexture->uTextureHeight; | |
8818 v7 = 5 * a3; | |
8819 v17 = pTexture->uTextureHeight; | |
8820 v8 = &this->pActiveZBuffer[a2 + (v7 << 7)]; | |
8821 pTexturea = pTexture->uTextureWidth; | |
8822 if ( this->bClip ) | |
8823 { | |
8824 v9 = this->uClipX; | |
8825 if ( a2 < (signed int)v9 ) | |
8826 { | |
8827 pTexturea += a2 - v9; | |
8828 v8 = (char *)v8 + 4 * (v9 - a2); | |
8829 } | |
8830 v10 = this->uClipY; | |
8831 if ( v5 < (signed int)v10 ) | |
8832 { | |
8833 v17 += v5 - v10; | |
8834 v8 = (char *)v8 + 2560 * (v10 - v5); | |
8835 } | |
8836 v11 = this->uClipX; | |
8837 if ( v11 < a2 ) | |
8838 v11 = a2; | |
8839 v12 = this->uClipZ; | |
8840 if ( (signed int)(pTexturea + v11) > (signed int)v12 ) | |
8841 { | |
8842 v13 = this->uClipX; | |
8843 if ( v13 < a2 ) | |
8844 v13 = a2; | |
8845 pTexturea = v12 - v13; | |
8846 } | |
8847 v14 = this->uClipY; | |
8848 if ( (signed int)v14 < v5 ) | |
8849 v14 = v5; | |
8850 v6 = v17; | |
8851 v15 = this->uClipW; | |
8852 if ( (signed int)(v17 + v14) > (signed int)v15 ) | |
8853 { | |
8854 v16 = this->uClipY; | |
8855 if ( (signed int)v16 < v5 ) | |
8856 v16 = v5; | |
8857 v6 = v15 - v16; | |
8858 } | |
8859 } | |
8860 if ( v6 > 0 ) | |
8861 { | |
8862 do | |
8863 { | |
8864 if ( (signed int)pTexturea > 0 ) | |
8865 { | |
8866 memset32(v8, a5, pTexturea); | |
8867 v8 = (char *)v8 + 4 * pTexturea; | |
8868 } | |
8869 v8 = (char *)v8 + 4 * (640 - pTexturea); | |
8870 --v6; | |
8871 } | |
8872 while ( v6 ); | |
8873 } | |
8874 } | |
8875 } | |
8876 | |
8877 //----- (004A5EB2) -------------------------------------------------------- | |
8878 void Render::DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4) | |
8879 { | |
8880 Texture *v4; // edi@2 | |
8881 unsigned int v5; // ebx@4 | |
8882 unsigned __int16 *pTarget; // eax@4 | |
8883 unsigned int v7; // edx@5 | |
8884 unsigned int v8; // edx@6 | |
8885 unsigned int v9; // edx@7 | |
8886 unsigned int v10; // edx@8 | |
8887 unsigned int v11; // edx@9 | |
8888 unsigned int v12; // esi@12 | |
8889 unsigned int v13; // esi@15 | |
8890 unsigned int v14; // edx@17 | |
8891 unsigned int v15; // esi@18 | |
8892 unsigned __int8 *v16; // edx@22 | |
8893 char v17; // zf@26 | |
8894 int v18; // [sp+10h] [bp-10h]@4 | |
8895 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
8896 int v20; // [sp+1Ch] [bp-4h]@4 | |
8897 int uXa; // [sp+28h] [bp+8h]@24 | |
8898 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 | |
8899 unsigned int v23; // [sp+30h] [bp+10h]@11 | |
8900 | |
8901 if ( this->uNumSceneBegins ) | |
8902 { | |
8903 v4 = a4; | |
8904 if ( a4 ) | |
8905 { | |
8906 if ( a4->pPalette16 ) | |
8907 { | |
8908 v5 = a4->uTextureHeight; | |
8909 pTarget = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; | |
710 | 8910 v19 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8911 v20 = a4->uTextureWidth; |
8912 v18 = a4->uTextureWidth; | |
8913 if ( this->bClip ) | |
8914 { | |
8915 v7 = this->uClipX; | |
8916 if ( (signed int)uX < (signed int)v7 ) | |
8917 { | |
8918 v8 = v7 - uX; | |
8919 v19 += v8; | |
8920 v20 += uX - this->uClipX; | |
8921 pTarget += v8; | |
8922 } | |
8923 v9 = this->uClipY; | |
8924 v5 = a4->uTextureHeight; | |
8925 if ( (signed int)uY < (signed int)v9 ) | |
8926 { | |
8927 v10 = v9 - uY; | |
8928 v19 += v18 * v10; | |
8929 v5 = uY - this->uClipY + a4->uTextureHeight; | |
8930 v4 = a4; | |
8931 pTarget += this->uTargetSurfacePitch * v10; | |
8932 } | |
8933 v11 = this->uClipX; | |
8934 if ( (signed int)v11 < (signed int)uX ) | |
8935 v11 = uX; | |
8936 v23 = this->uClipZ; | |
8937 if ( (signed int)(v11 + v20) > (signed int)v23 ) | |
8938 { | |
8939 v12 = this->uClipX; | |
8940 if ( (signed int)v12 < (signed int)uX ) | |
8941 v12 = uX; | |
8942 v20 = v23 - v12; | |
8943 } | |
8944 v13 = this->uClipY; | |
8945 if ( (signed int)v13 < (signed int)uY ) | |
8946 v13 = uY; | |
8947 v14 = this->uClipW; | |
8948 if ( (signed int)(v5 + v13) > (signed int)v14 ) | |
8949 { | |
8950 v15 = this->uClipY; | |
8951 if ( (signed int)v15 < (signed int)uY ) | |
8952 v15 = uY; | |
8953 v5 = v14 - v15; | |
8954 } | |
8955 } | |
8956 if ( (signed int)v5 > 0 ) | |
8957 { | |
8958 uYa = v5; | |
8959 v16 = v19; | |
8960 do | |
8961 { | |
8962 if ( v20 > 0 ) | |
8963 { | |
8964 uXa = v20; | |
8965 do | |
8966 { | |
8967 *pTarget = v4->pPalette16[*v16]; | |
8968 ++pTarget; | |
8969 ++v16; | |
8970 --uXa; | |
8971 } | |
8972 while ( uXa ); | |
8973 } | |
8974 v16 += v18 - v20; | |
8975 v17 = uYa-- == 1; | |
8976 pTarget += this->uTargetSurfacePitch - v20; | |
8977 } | |
8978 while ( !v17 ); | |
8979 } | |
8980 } | |
8981 } | |
8982 } | |
8983 } | |
8984 | |
8985 //----- (004667E9) -------------------------------------------------------- | |
8986 void Render::ChangeBetweenWinFullscreenModes() | |
8987 { | |
8988 float v0; // ST14_4@17 | |
8989 int v4; // edx@26 | |
8990 ObjectDesc *v5; // eax@26 | |
8991 RGBTexture *v6; // esi@33 | |
8992 const char *v8; // [sp-4h] [bp-28h]@33 | |
8993 struct tagRECT Rect; // [sp+14h] [bp-10h]@15 | |
8994 | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8995 if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) ) |
0 | 8996 { |
8997 ModalWindow(pGlobalTXT_LocalizationStrings[62], 0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window." | |
8998 return; | |
8999 } | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9000 if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9001 { |
0 | 9002 if ( pEventTimer->bPaused ) |
9003 BYTE1(dword_6BE364_game_settings_1) |= 8u; | |
9004 else | |
9005 pEventTimer->Pause(); | |
9006 if ( pMiscTimer->bPaused ) | |
9007 BYTE1(dword_6BE364_game_settings_1) |= 0x10u; | |
9008 else | |
9009 pMiscTimer->Pause(); | |
9010 pMouse->bActive = 0; | |
9011 if ( pRenderer->pRenderD3D ) | |
9012 { | |
9013 pBitmaps_LOD->ReleaseHardwareTextures(); | |
9014 pSprites_LOD->ReleaseAll(); | |
9015 } | |
9016 if ( pRenderer->bWindowMode ) | |
9017 { | |
9018 if ( GetWindowRect(hWnd, &Rect) ) | |
9019 { | |
9020 WriteWindowsRegistryInt("window X", Rect.left); | |
9021 WriteWindowsRegistryInt("window Y", Rect.top); | |
9022 uWindowX = Rect.left; | |
9023 uWindowY = Rect.top; | |
9024 } | |
9025 SetMenu(hWnd, 0); | |
9026 SetWindowLongA(hWnd, -20, 0); | |
9027 SetWindowLongA(hWnd, -16, 0x10000000u); | |
9028 pRenderer->InitializeFullscreen(hWnd); | |
9029 v0 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
9030 pGame->pGammaController->Initialize(v0); | |
9031 } | |
9032 else | |
9033 { | |
9034 ClipCursor(0); | |
9035 pRenderer->SwitchToWindow(hWnd); | |
9036 SetWindowLongA(hWnd, -16, uWindowStyle); | |
9037 SetMenu(hWnd, hOSMenu); | |
9038 } | |
9039 if ( pRenderer->pRenderD3D ) | |
9040 { | |
9041 pBitmaps_LOD->_410423_move_textures_to_device(); | |
9042 pSprites_LOD->MoveSpritesToVideoMemory(); | |
9043 } | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9044 if (!( pPaletteManager->uNumTargetBBits == pRenderer->uTargetBBits |
0 | 9045 && pPaletteManager->uNumTargetGBits == pRenderer->uTargetGBits |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9046 && pPaletteManager->uNumTargetRBits == pRenderer->uTargetRBits )) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9047 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9048 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9049 pPaletteManager->RecalculateAll(); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9050 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9051 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9052 for (int i = 0; i < pObjectList->uNumObjects; i++) |
0 | 9053 { |
9054 BYTE3(v4) = 0; | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9055 v5 = &pObjectList->pObjects[i]; |
0 | 9056 *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR; |
9057 LOBYTE(v4) = v5->uParticleTrailColorG; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
9058 v5->uParticleTrailColor = v5->uParticleTrailColorB | (v4 << 8); |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9059 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9060 SetUserInterface(pParty->alignment, true); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9061 if ( pVideoPlayer->pVideoFrame.pPixels ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9062 pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1); |
0 | 9063 if ( uCurrentMenuID != 6 ) |
9064 { | |
9065 if ( uCurrentMenuID == 8 ) | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9066 dword_A74C88 = 1; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9067 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9068 else |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9069 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9070 if ( uCurrentMenuID ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9071 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9072 v6 = &pTexture_PCX; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9073 pTexture_PCX.Release(); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9074 v8 = "makeme.pcx"; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9075 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9076 else |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9077 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9078 v6 = &pTexture_PCX; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9079 pTexture_PCX.Release(); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9080 v8 = "title.pcx"; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9081 if ( uCurrentMenuID ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9082 v8 = "lsave640.pcx"; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9083 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9084 v6->Load(v8, 0); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9085 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9086 } |
0 | 9087 viewparams->bRedrawGameUI = 1; |
688 | 9088 viewparams->InitGrayPalette(); |
0 | 9089 pMouse->SetCurrentCursorBitmap(); |
9090 if ( pRenderer->bWindowMode ) | |
9091 { | |
9092 InvalidateRect(0, 0, 0); | |
9093 MoveWindow(hWnd, uWindowX, uWindowY, uWindowWidth, uWindowHeight, 0); | |
9094 ShowWindow(hWnd, 1); | |
9095 } | |
9096 pMouse->bActive = 1; | |
9097 if ( pVideoPlayer->AnyMovieLoaded() ) | |
898 | 9098 pVideoPlayer->SelectMovieType(); |
0 | 9099 if ( BYTE1(dword_6BE364_game_settings_1) & 8 ) |
9100 BYTE1(dword_6BE364_game_settings_1) &= 0xF7u; | |
9101 else | |
9102 pEventTimer->Resume(); | |
9103 if ( BYTE1(dword_6BE364_game_settings_1) & 0x10 ) | |
9104 BYTE1(dword_6BE364_game_settings_1) &= 0xEFu; | |
9105 else | |
9106 pMiscTimer->Resume(); | |
9107 } | |
9108 } | |
9109 // 6BE364: using guessed type int dword_6BE364_game_settings_1; | |
9110 // A74C88: using guessed type int dword_A74C88; | |
9111 | |
9112 | |
9113 //----- (004524D8) -------------------------------------------------------- | |
9114 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) | |
9115 { | |
9116 int v11; // eax@13 | |
9117 int v12; // ecx@13 | |
9118 void *v13; // eax@13 | |
9119 unsigned __int8 v14; // zf@13 | |
9120 unsigned __int8 v15; // sf@13 | |
9121 int v16; // esi@14 | |
9122 int v17; // ecx@16 | |
9123 int v18; // esi@16 | |
9124 unsigned __int16 *v19; // eax@16 | |
9125 int v20; // edx@16 | |
9126 int v21; // ecx@16 | |
9127 int v22; // eax@16 | |
9128 int v23; // esi@16 | |
9129 unsigned __int16 *v26; // [sp+24h] [bp-10h]@13 | |
9130 int v27; // [sp+28h] [bp-Ch]@14 | |
9131 int v28; // [sp+2Ch] [bp-8h]@13 | |
9132 int pDestb; // [sp+3Ch] [bp+8h]@15 | |
9133 | |
9134 //v3 = this; | |
9135 //sprintf(Str1, "%s", pName); | |
9136 //v4 = uNumItems; | |
9137 if (!uNumItems) | |
9138 return nullptr; | |
9139 | |
9140 //{ | |
9141 //v5 = 0, pDesta = uNumItems; | |
9142 uint idx1 = 0, | |
9143 idx2 = uNumItems; | |
9144 while (true) | |
9145 { | |
9146 auto i = idx1 + (idx2 - idx1) / 2; | |
9147 | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
9148 auto res = _stricmp(pName, pSpriteNames[i]); |
0 | 9149 if (!res) |
9150 { | |
9151 fseek(pFile, pSpriteOffsets[i], SEEK_SET); | |
9152 break; | |
9153 } | |
9154 else if (res < 0) | |
9155 idx2 = idx1 + (idx2 - idx1) / 2; | |
9156 else | |
9157 idx1 = i + 1; | |
9158 | |
9159 if ( idx1 >= idx2 ) | |
9160 return false; | |
9161 } | |
9162 | |
9163 | |
9164 uint uCompressedSize = 0; | |
9165 fread(&uCompressedSize, 4, 1, pFile); | |
9166 | |
9167 auto pTex = new HWLTexture; | |
670 | 9168 fread(&pTex->uBufferWidth, 4, 1, pFile); |
9169 fread(&pTex->uBufferHeight, 4, 1, pFile); | |
9170 fread(&pTex->uAreaWidth, 4, 1, pFile); | |
9171 fread(&pTex->uAreaHeigth, 4, 1, pFile); | |
0 | 9172 fread(&pTex->uWidth, 4, 1, pFile); |
9173 fread(&pTex->uHeight, 4, 1, pFile); | |
670 | 9174 fread(&pTex->uAreaX, 4, 1, pFile); |
9175 fread(&pTex->uAreaY, 4, 1, pFile); | |
0 | 9176 |
9177 pTex->pPixels = new unsigned __int16[pTex->uWidth * pTex->uHeight]; | |
9178 if (uCompressedSize) | |
9179 { | |
9180 auto pCompressedData = new char[uCompressedSize]; | |
9181 { | |
9182 fread(pCompressedData, 1, uCompressedSize, pFile); | |
9183 auto uDecompressedSize = pTex->uWidth * pTex->uHeight * sizeof(short); | |
9184 zlib::MemUnzip(pTex->pPixels, &uDecompressedSize, pCompressedData, uCompressedSize); | |
9185 } | |
9186 delete [] pCompressedData; | |
9187 } | |
9188 else | |
9189 fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); | |
9190 | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9191 if ( field_61A94_scale_hwls_to_half ) //is it even possible to ever get here? field_61A94_scale_hwls_to_half is only set to zero |
0 | 9192 { |
9193 v11 = pTex->uHeight / 2; | |
9194 v12 = pTex->uWidth / 2; | |
9195 pTex->uHeight = v11; | |
9196 pTex->uWidth = v12; | |
9197 v13 = new unsigned __int16[v12 * v11]; | |
9198 v28 = 0; | |
9199 v14 = pTex->uHeight == 0; | |
9200 v15 = (pTex->uHeight & 0x80000000u) != 0; | |
9201 v26 = (unsigned __int16 *)v13; | |
9202 if ( !(v15 | v14) ) | |
9203 { | |
9204 v16 = pTex->uWidth; | |
9205 v27 = 1; | |
9206 do | |
9207 { | |
9208 pDestb = 0; | |
9209 if ( v16 > 0 ) | |
9210 { | |
9211 do | |
9212 { | |
9213 v17 = v16 * v27; | |
9214 v18 = v28 * v16; | |
9215 v19 = pTex->pPixels; | |
9216 v20 = pDestb + 2 * v18; | |
9217 v21 = (int)&v19[2 * (pDestb + v17)]; | |
9218 v22 = (int)&v19[2 * v20]; | |
9219 LOWORD(v20) = *(unsigned short *)(v21 + 2); | |
9220 LOWORD(v21) = *(unsigned short *)v21; | |
9221 v23 = pDestb++ + v18; | |
9222 v26[v23] = sub_452442(*(unsigned short *)v22, *(unsigned short *)(v22 + 2), v21, v20); | |
9223 v16 = pTex->uWidth; | |
9224 } | |
9225 while (pDestb < pTex->uWidth); | |
9226 } | |
9227 ++v28; | |
9228 v27 += 2; | |
9229 } | |
9230 while ( v28 < (signed int)pTex->uHeight ); | |
9231 } | |
9232 delete [] pTex->pPixels; | |
9233 pTex->pPixels = v26; | |
9234 } | |
9235 return pTex; | |
9236 //result = pTex; | |
9237 // } | |
9238 // else | |
9239 // { | |
9240 //LABEL_8: | |
9241 // return nullptr; | |
9242 // } | |
9243 } | |
9244 | |
9245 //----- (0045271F) -------------------------------------------------------- | |
9246 bool RenderHWLContainer::Release() | |
9247 { | |
9248 __int32 v4; // eax@6 | |
9249 FILE *v5; // ST24_4@6 | |
9250 FILE *File; // [sp+4h] [bp-4h]@6 | |
9251 | |
1162 | 9252 if ( this->bDumpDebug) |
0 | 9253 { |
9254 File = fopen("logd3d.txt", "w"); | |
1162 | 9255 v4 = ftell(this->pFile); |
9256 v5 = this->pFile; | |
9257 this->uDataOffset = v4; | |
9258 fwrite(&this->uNumItems, 4u, 1u, v5); | |
9259 for (int i = 0; i < this->uNumItems; i++) | |
9260 { | |
9261 fwrite(this->pSpriteNames[i], 1u, 0x14u, this->pFile); | |
9262 fprintf(File, "D3D texture name: %s\t\toffset: %x\n", this->pSpriteNames[i], *(unsigned int *)(&(this->pSpriteNames[i]) + 200000/sizeof(char*))); | |
9263 } | |
9264 fwrite(this->pSpriteOffsets, 4u, this->uNumItems, this->pFile); | |
9265 fseek(this->pFile, 4, 0); | |
9266 fwrite(&this->uDataOffset, 4u, 1u, this->pFile); | |
9267 fclose(this->pFile); | |
0 | 9268 fclose(File); |
9269 } | |
9270 else | |
9271 { | |
9272 fclose(this->pFile); | |
1162 | 9273 for (int i = 0; i < this->uNumItems; i++) |
9274 { | |
9275 free(this->pSpriteNames[i]); | |
0 | 9276 } |
9277 } | |
1093 | 9278 return true; |
0 | 9279 } |
9280 | |
9281 //----- (00452347) -------------------------------------------------------- | |
9282 RenderHWLContainer::RenderHWLContainer(): | |
9283 bDumpDebug(false) | |
9284 { | |
9285 this->pFile = 0; | |
9286 uSignature = 0; | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9287 this->uDataOffset = 0; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9288 memset(&this->uNumItems, 0, 0x61A84u); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9289 this->uNumItems = 0; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
9290 this->field_61A94_scale_hwls_to_half = 0; |
0 | 9291 } |
9292 | |
9293 //----- (0045237F) -------------------------------------------------------- | |
9294 bool RenderHWLContainer::Load(const wchar_t *pFilename) | |
9295 { | |
9296 pFile = _wfopen(pFilename, L"rb"); | |
9297 if (!pFile) | |
9298 { | |
9299 Log::Warning(L"Failed to open file: %s", pFilename); | |
9300 return false; | |
9301 } | |
9302 | |
9303 fread(&uSignature, 1, 4, pFile); | |
9304 if (uSignature != 'TD3D') | |
9305 { | |
9306 Log::Warning(L"Invalid format: %s", pFilename); | |
9307 return false; | |
9308 } | |
9309 | |
9310 fread(&uDataOffset, 4, 1, pFile); | |
9311 fseek(pFile, uDataOffset, SEEK_SET); | |
9312 fread(&uNumItems, 4, 1, pFile); | |
9313 | |
9314 memset(pSpriteNames, 0, 50000 * sizeof(char *)); | |
9315 for (uint i = 0; i < uNumItems; ++i) | |
9316 { | |
9317 pSpriteNames[i] = new char[20]; | |
9318 fread(pSpriteNames[i], 1, 20, pFile); | |
9319 } | |
9320 fread(pSpriteOffsets, 4, uNumItems, pFile); | |
9321 | |
9322 return true; | |
9323 } | |
9324 | |
9325 //----- (004A1C1E) -------------------------------------------------------- | |
9326 void DoRenderBillboards_D3D() | |
9327 { | |
186 | 9328 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); |
9329 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
9330 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9331 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9332 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9333 /*if (pRenderer->uNumBillboardsToDraw) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9334 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9335 auto p = &pRenderer->pBillboardRenderListD3D[0]; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9336 for (int i = 0; i < p->uNumVertices; ++i) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9337 { |
1390 | 9338 p->pQuads[i].pos.z -= p->pQuads[i].pos.z * 0.6; |
9339 //p->pQuads[i].rhw = + 0.8 * (1.0f - p->pQuads[i].rhw); | |
9340 } | |
9341 p->pQuads[0].pos.x = 10; | |
9342 p->pQuads[0].pos.y = 10; | |
9343 | |
9344 p->pQuads[1].pos.x = 10; | |
9345 p->pQuads[1].pos.y = 200; | |
9346 | |
9347 p->pQuads[2].pos.x = 100; | |
9348 p->pQuads[2].pos.y = 200; | |
9349 | |
9350 p->pQuads[3].pos.x = 100; | |
9351 p->pQuads[3].pos.y = 10; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9352 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9353 if (p->uOpacity != RenderBillboardD3D::NoBlend) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9354 SetBillboardBlendOptions(p->uOpacity); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9355 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9356 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9357 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9358 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1390 | 9359 p->pQuads, p->uNumVertices, |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9360 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9361 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9362 }*/ |
0 | 9363 |
9364 for (uint i = pRenderer->uNumBillboardsToDraw - 1; i != (uint)-1; --i) | |
9365 { | |
101 | 9366 auto p = &pRenderer->pBillboardRenderListD3D[i]; |
0 | 9367 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9368 if (p->uOpacity != RenderBillboardD3D::NoBlend) |
0 | 9369 SetBillboardBlendOptions(p->uOpacity); |
9370 | |
101 | 9371 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9372 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9373 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1390 | 9374 p->pQuads, p->uNumVertices, |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9375 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); |
0 | 9376 } |
9377 | |
9378 if (pRenderer->bFogEnabled) | |
9379 { | |
9380 pRenderer->bFogEnabled = false; | |
186 | 9381 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 9382 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); |
9383 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
9384 } | |
186 | 9385 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
9386 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
9387 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
9388 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
9389 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
9390 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
0 | 9391 } |
9392 | |
9393 //----- (004A1DA8) -------------------------------------------------------- | |
9394 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1) | |
9395 { | |
9396 switch (a1) | |
9397 { | |
9398 case RenderBillboardD3D::Transparent: | |
9399 { | |
9400 if (pRenderer->bFogEnabled) | |
9401 { | |
9402 pRenderer->bFogEnabled = false; | |
186 | 9403 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 9404 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); |
9405 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
9406 } | |
9407 | |
186 | 9408 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); |
9409 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); | |
9410 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
0 | 9411 } |
9412 break; | |
9413 | |
9414 case RenderBillboardD3D::Opaque_1: | |
9415 case RenderBillboardD3D::Opaque_2: | |
9416 case RenderBillboardD3D::Opaque_3: | |
9417 { | |
9418 if (pRenderer->bUsingSpecular) | |
9419 { | |
9420 if (!pRenderer->bFogEnabled) | |
9421 { | |
9422 pRenderer->bFogEnabled = true; | |
186 | 9423 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
9424 } | |
9425 } | |
9426 | |
9427 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
9428 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | |
9429 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | |
0 | 9430 } |
9431 break; | |
9432 | |
9433 default: | |
9434 Log::Warning(L"SetBillboardBlendOptions: invalid opacity type (%u)", a1); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
9435 assert(false); |
0 | 9436 break; |
9437 } | |
9438 } | |
1297 | 9439 //----- (0040DF3D) -------------------------------------------------------- |
9440 void __cdecl CallRenderPresent() | |
9441 { | |
9442 pRenderer->Present(); | |
9443 } | |
1390 | 9444 |
9445 | |
9446 | |
9447 //----- (0044EC20) -------------------------------------------------------- | |
9448 /*bool RenderD3D::DoesRaiseExceptions() | |
9449 { | |
9450 return true; | |
9451 }*/ |