Mercurial > mm7
annotate Render.cpp @ 1637:2c71fa8913d2
class OutdoorCamera -> ODMRenderParams
author | Nomad |
---|---|
date | Tue, 17 Sep 2013 14:10:41 +0200 |
parents | 384a6b9d1333 |
children | ccde94f02b75 |
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 |
1277 | 5 #include "Outdoor_stuff.h" |
1016 | 6 #include "VideoPlayer.h" |
7 #include "Sprites.h" | |
8 #include "Mouse.h" | |
9 #include "GammaControl.h" | |
10 #include "stru6.h" | |
1183 | 11 #include "GUIWindow.h" |
1016 | 12 #include "DecalBuilder.h" |
13 #include "ParticleEngine.h" | |
0 | 14 #include "Render.h" |
15 #include "IndoorCamera.h" | |
16 #include "Outdoor.h" | |
17 #include "Party.h" | |
18 #include "LOD.h" | |
19 #include "Viewport.h" | |
20 #include "Math.h" | |
21 #include "PaletteManager.h" | |
22 #include "Time.h" | |
23 #include "Game.h" | |
24 #include "LightmapBuilder.h" | |
25 #include "ObjectList.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
26 #include "SpriteObject.h" |
0 | 27 #include "DecorationList.h" |
28 #include "OSInfo.h" | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
29 #include "Actor.h" |
0 | 30 #include "Log.h" |
179 | 31 #include "TileFrameTable.h" |
189 | 32 #include "texts.h" |
0 | 33 #include "mm7_data.h" |
860 | 34 #include "MM7.h" |
1262 | 35 #include "Lights.h" |
0 | 36 |
37 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") | |
38 #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib") | |
39 | |
40 struct IDirectDrawClipper *pDDrawClipper; | |
41 struct Render *pRenderer; // idb | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
42 struct RenderVertexD3D3 pVertices[50]; |
0 | 43 int uNumDecorationsDrawnThisFrame; // weak |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
44 RenderBillboard pBillboardRenderList[500]; |
0 | 45 unsigned int uNumBillboardsToDraw; |
46 int uNumSpritesDrawnThisFrame; // weak | |
47 | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
48 RenderVertexSoft array_507D30[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
49 RenderVertexSoft array_50AC10[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
50 RenderVertexSoft array_73D150[20]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
51 |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
52 RenderVertexD3D3 d3d_vertex_buffer[50]; |
0 | 53 |
54 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); | |
55 | |
56 /* 384 */ | |
57 #pragma pack(push, 1) | |
58 struct PCXHeader_1 | |
59 { | |
60 char manufacturer; | |
61 char version; | |
62 char encoding; | |
63 char bpp; | |
64 __int16 left; | |
65 __int16 up; | |
66 __int16 right; | |
67 __int16 bottom; | |
68 __int16 hdpi; | |
69 __int16 vdpi; | |
70 }; | |
71 #pragma pack(pop) | |
72 | |
73 /* 385 */ | |
74 #pragma pack(push, 1) | |
75 struct PCXHeader_2 | |
76 { | |
77 char reserved; | |
78 char planes; | |
79 __int16 pitch; | |
80 __int16 palette_info; | |
81 }; | |
82 #pragma pack(pop) | |
83 | |
84 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst); | |
85 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2); | |
86 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, struct RenderD3D_aux *a6); | |
87 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut); // idb | |
88 | |
89 //----- (0049E79F) -------------------------------------------------------- | |
1458 | 90 bool CheckTextureStages() |
0 | 91 { |
92 bool v0; // edi@1 | |
93 IDirectDrawSurface4 *pSurface2; // [sp+Ch] [bp-14h]@1 | |
94 IDirectDrawSurface4 *pSurface1; // [sp+10h] [bp-10h]@1 | |
95 DWORD v4; // [sp+14h] [bp-Ch]@1 | |
96 IDirect3DTexture2 *pTexture2; // [sp+18h] [bp-8h]@1 | |
97 IDirect3DTexture2 *pTexture1; // [sp+1Ch] [bp-4h]@1 | |
98 | |
99 v0 = false; | |
100 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface1, &pTexture1, true, false, 32u); | |
101 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface2, &pTexture2, true, false, 32u); | |
102 | |
103 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture1)); | |
186 | 104 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 105 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 2u)); |
106 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | |
107 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | |
108 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | |
109 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 1u)); | |
110 | |
111 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture2)); | |
186 | 112 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); |
0 | 113 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1u)); |
114 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 7u)); | |
115 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, 2u)); | |
116 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG2, 1u)); | |
117 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MAGFILTER, 2u)); | |
118 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MINFILTER, 2u)); | |
119 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MIPFILTER, 1u)); | |
120 | |
121 if ( !pRenderer->pRenderD3D->pDevice->ValidateDevice(&v4) && v4 == 1 ) | |
122 v0 = true; | |
123 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 1u)); | |
124 pTexture1->Release(); | |
125 pTexture2->Release(); | |
126 pSurface1->Release(); | |
127 pSurface2->Release(); | |
128 return v0; | |
129 } | |
130 | |
131 //----- (00440CB8) -------------------------------------------------------- | |
132 void Render::DrawBillboardList_BLV() | |
133 { | |
134 __int16 v2; // ax@3 | |
135 int v5; // eax@11 | |
136 RenderBillboardTransform_local0 soft_billboard; // [sp+4h] [bp-50h]@1 | |
137 | |
138 soft_billboard.uParentBillboardID = -1; | |
139 soft_billboard.pTarget = pBLVRenderParams->pRenderTarget; | |
140 soft_billboard.pTargetZ = pBLVRenderParams->pTargetZBuffer; | |
141 soft_billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
142 soft_billboard.uViewportX = pBLVRenderParams->uViewportX; | |
143 soft_billboard.uViewportY = pBLVRenderParams->uViewportY; | |
144 soft_billboard.uViewportZ = pBLVRenderParams->uViewportZ - 1; | |
145 soft_billboard.uViewportW = pBLVRenderParams->uViewportW; | |
146 | |
1637 | 147 pODMRenderParams->uNumBillboards = ::uNumBillboardsToDraw; |
617 | 148 for (uint i = 0; i < ::uNumBillboardsToDraw; ++i) |
0 | 149 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
150 auto p = pBillboardRenderList + i; |
0 | 151 |
152 soft_billboard.uScreenSpaceX = p->uScreenSpaceX; | |
153 soft_billboard.uParentBillboardID = i; | |
154 soft_billboard.uScreenSpaceY = p->uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
155 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
|
156 soft_billboard._screenspace_y_scaler_packedfloat = p->_screenspace_y_scaler_packedfloat; |
0 | 157 soft_billboard.sZValue = p->sZValue; |
158 soft_billboard.uFlags = p->field_1E; | |
159 soft_billboard.uTintColor = p->uTintColor; | |
160 v2 = p->uHwSpriteID; | |
161 if ( v2 != -1 ) | |
162 { | |
163 if ( pRenderer->pRenderD3D ) | |
657 | 164 pRenderer->DrawBillboard_Indoor(&soft_billboard, &pSprites_LOD->pHardwareSprites[v2], p->dimming_level); |
0 | 165 else |
166 { | |
657 | 167 soft_billboard.pPalette = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, p->dimming_level, 1); |
0 | 168 if (p->field_1E & 0x0100) |
169 soft_billboard.pPalette = pPaletteManager->field_261600[p->uPalette]; | |
170 if ( !(soft_billboard.uFlags & 0x40) && soft_billboard.uFlags & 0x80 ) | |
171 soft_billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, 0, 1); | |
172 v5 = p->uHwSpriteID; | |
173 if ( v5 >= 0 ) | |
733 | 174 pSprites_LOD->pSpriteHeaders[v5].DrawSprite_sw(&soft_billboard, 1); |
0 | 175 } |
176 } | |
177 } | |
178 } | |
179 | |
180 //----- (004A16A5) -------------------------------------------------------- | |
1458 | 181 bool AreRenderSurfacesOk() |
0 | 182 { |
183 char v0; // zf@4 | |
184 bool result; // eax@8 | |
185 | |
186 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
187 { | |
188 if ( !pRenderer->pBackBuffer4 ) | |
189 goto LABEL_9; | |
190 v0 = pRenderer->pFrontBuffer4 == 0; | |
191 } | |
192 else | |
193 { | |
194 if ( !pRenderer->pBackBuffer2 ) | |
195 goto LABEL_9; | |
196 v0 = pRenderer->pFrontBuffer2 == 0; | |
197 } | |
198 if ( !v0 ) | |
199 { | |
200 LOBYTE(result) = 1; | |
201 return result; | |
202 } | |
203 LABEL_9: | |
204 LOBYTE(result) = 0; | |
205 return result; | |
206 } | |
207 | |
1338 | 208 void Render::RenderTerrainD3D() // New function |
86 | 209 { |
210 int v6; // ecx@8 | |
1427 | 211 struct Polygon *pTilePolygon; // ebx@8 |
186 | 212 |
213 //warning: the game uses CW culling by default, ccw is incosistent | |
214 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); | |
215 | |
1338 | 216 static RenderVertexSoft pTerrainVertices[128 * 128];//vertexCountX and vertexCountZ |
217 | |
218 //Ãåíåðàöèÿ ìåñòîïîëîæåíèÿ âåðøèí------------------------------------------------------------------------- | |
219 //ðåø¸òêà âåðøèí äåëèòñÿ íà äâå ÷àñòè îò -64 äî 0 è îò 0 äî 64 | |
220 // | |
221 // -64 X 0 64 | |
222 // --------------- 64 | |
223 // | | | | |
224 // | | | | |
225 // | | | | |
226 // 0|------+------| Z | |
227 // | | | | |
228 // | | | | |
229 // | | | | |
230 // --------------- | |
231 // -64 | |
232 | |
233 int blockScale = 512; | |
234 int heightScale = 32; | |
235 for (unsigned int z = 0; z < 128; ++z) | |
236 { | |
237 for (unsigned int x = 0; x < 128; ++x) | |
238 { | |
239 pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * blockScale; | |
240 pTerrainVertices[z * 128 + x].vWorldPosition.y = (64 - (signed)z) * blockScale; | |
241 pTerrainVertices[z * 128 + x].vWorldPosition.z = heightScale * pOutdoor->pTerrain.pHeightmap[z * 128 + x]; | |
121 | 242 pGame->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); |
243 pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); | |
106 | 244 } |
245 } | |
1338 | 246 //-------------------------------------------------------------------------------------------------------------------- |
247 | |
248 // | |
1344 | 249 for (unsigned int z = 0; z < 127; ++z) |
250 { | |
251 for (unsigned int x = 0; x < 127; ++x) | |
1338 | 252 { |
1637 | 253 pTilePolygon = &array_77EC08[pODMRenderParams->uNumPolygons]; |
1427 | 254 pTilePolygon->flags = 0; |
255 pTilePolygon->field_32 = 0; | |
256 pTilePolygon->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); | |
257 pTilePolygon->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[pTilePolygon->uTileBitmapID]; | |
258 if (pTilePolygon->uTileBitmapID == 0xFFFF) | |
106 | 259 continue; |
186 | 260 |
1338 | 261 //pTile->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(x, z); |
1427 | 262 pTilePolygon->flags = pOutdoor->GetSomeOtherTileInfo(x, z); |
263 pTilePolygon->field_32 = 0; | |
264 pTilePolygon->field_59 = 1; | |
265 pTilePolygon->sTextureDeltaU = 0; | |
266 pTilePolygon->sTextureDeltaV = 0; | |
1338 | 267 // x,z x+1,z |
268 // .____________. | |
269 // | | | |
270 // | | | |
271 // | | | |
272 // | | | |
273 // | | | |
274 // .____________. | |
275 // x,z+1 x+1,z+1 | |
276 memcpy(&array_73D150[0], &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft));//x, z | |
106 | 277 array_73D150[0].u = 0; |
278 array_73D150[0].v = 0; | |
1338 | 279 memcpy(&array_73D150[1], &pTerrainVertices[z * 128 + x + 1], sizeof(RenderVertexSoft));//x + 1, z |
106 | 280 array_73D150[1].u = 1; |
281 array_73D150[1].v = 0; | |
1338 | 282 memcpy(&array_73D150[2], &pTerrainVertices[(z + 1) * 128 + x + 1], sizeof(RenderVertexSoft));//x + 1, z + 1 |
106 | 283 array_73D150[2].u = 1; |
284 array_73D150[2].v = 1; | |
1338 | 285 memcpy(&array_73D150[3], &pTerrainVertices[(z + 1) * 128 + x], sizeof(RenderVertexSoft));//x, z + 1 |
106 | 286 array_73D150[3].u = 0; |
287 array_73D150[3].v = 1; | |
1338 | 288 //v58 = 0; |
289 //if (v58 == 4) // if all y == first y; primitive in xz plane | |
290 //pTile->field_32 |= 0x0001; | |
1427 | 291 pTilePolygon->pODMFace = nullptr; |
292 pTilePolygon->uNumVertices = 4; | |
293 pTilePolygon->field_59 = 5; | |
1338 | 294 |
295 //shading (çàòåíåíèå)---------------------------------------------------------------------------- | |
296 //uint norm_idx = pTerrainNormalIndices[2 * (z * 128 + x) + 1]; | |
1424 | 297 uint norm_idx = pTerrainNormalIndices[2 * (x * 128 + z) + 2]; |
638 | 298 assert(norm_idx < uNumTerrainNormals); |
299 | |
300 auto norm = pTerrainNormals + norm_idx; | |
1338 | 301 float _f = ((norm->x * (float)pOutdoor->vSunlight.x / 65536.0) - |
302 (norm->y * (float)pOutdoor->vSunlight.y / 65536.0) - | |
303 (norm->z * (float)pOutdoor->vSunlight.z / 65536.0)); | |
1427 | 304 pTilePolygon->dimming_level = 20.0 - floorf(20.0 * _f + 0.5f); |
1338 | 305 //----------------------------------------------------------------------------------------------- |
638 | 306 |
1637 | 307 ++pODMRenderParams->uNumPolygons; |
308 ++pODMRenderParams->field_44; | |
309 assert(pODMRenderParams->uNumPolygons < 20000); | |
265 | 310 |
1427 | 311 pTilePolygon->uBModelID = 0; |
312 pTilePolygon->uBModelFaceID = 0; | |
313 pTilePolygon->field_50 = (8 * (0 | (0 << 6))) | 6; | |
314 for (unsigned int k = 0; k < pTilePolygon->uNumVertices; ++k) | |
106 | 315 { |
316 memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); | |
168 | 317 array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); |
106 | 318 } |
140 | 319 |
1338 | 320 // check the transparency and texture (tiles) mapping (ïðîâåðêà ïðîçðà÷íîñòè è íàëîæåíèå òåêñòóð (òàéëîâ))---------------------- |
186 | 321 bool transparent = false; |
1427 | 322 if ( !( pTilePolygon->flags & 1 ) ) // íå ïîääåðæèâàåòñÿ TextureFrameTable |
323 { | |
324 if ( /*pTile->flags & 2 && */pTilePolygon->uTileBitmapID == pRenderer->hd_water_tile_id) | |
1338 | 325 { |
326 //transparent = false; | |
327 v6 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; | |
328 } | |
329 else | |
330 { | |
1427 | 331 v6 = pTilePolygon->uTileBitmapID; |
332 if ( !_strnicmp(pBitmaps_LOD->pTextures[pTilePolygon->uTileBitmapID].pName, "wtrdr", 5) ) | |
1338 | 333 transparent = true; |
334 } | |
179 | 335 |
140 | 336 assert(v6 < 1000); // many random crashes here |
186 | 337 |
338 // for all shore tiles - draw a tile water under them since they're half-empty | |
1427 | 339 if (!_strnicmp(pBitmaps_LOD->pTextures[pTilePolygon->uTileBitmapID].pName, "wtrdr", 5)) // all shore tile filenames are wtrdrXXX |
340 pTilePolygon->DrawBorderTiles(); | |
341 | |
342 pRenderer->DrawTerrainPolygon(pTilePolygon->uNumVertices, pTilePolygon, pBitmaps_LOD->pHardwareTextures[v6], transparent, true); | |
1338 | 343 } |
344 //else //çäåñü óæå ïîãðàíè÷íûå òàéëû âîäû | |
345 //pTile->DrawBorderTiles(); | |
346 //-------------------------------------------------------------------------------------------------------------------------------- | |
186 | 347 |
1637 | 348 --pODMRenderParams->uNumPolygons; |
349 --pODMRenderParams->field_44; | |
106 | 350 } |
351 } | |
352 } | |
0 | 353 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
354 |
0 | 355 |
356 //----- (0047BACF) -------------------------------------------------------- | |
357 void Render::TransformBillboardsAndSetPalettesODM() | |
358 { | |
142 | 359 //int v0; // edi@1 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
360 //char *v1; // esi@2 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
361 //unsigned int v2; // edx@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
362 //int v3; // eax@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
363 //int v4; // edi@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
364 //int v5; // eax@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
365 //__int16 v6; // di@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
366 //int v7; // eax@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
367 //int v8; // ebx@4 |
0 | 368 unsigned __int16 *v9; // eax@7 |
369 char v10; // zf@9 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
370 //DWORD v11; // eax@13 |
0 | 371 int v12; // eax@13 |
372 int v13; // eax@14 | |
373 RenderBillboardTransform_local0 billboard; // [sp+4h] [bp-60h]@1 | |
374 int v15; // [sp+54h] [bp-10h]@13 | |
142 | 375 //int v16; // [sp+58h] [bp-Ch]@1 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
376 //int v17; // [sp+5Ch] [bp-8h]@2 |
0 | 377 int v18; // [sp+60h] [bp-4h]@13 |
378 | |
379 billboard.uParentBillboardID = -1; | |
380 billboard.pTarget = pRenderer->pTargetSurface; | |
381 billboard.pTargetZ = pRenderer->pActiveZBuffer; | |
382 billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
693 | 383 billboard.uViewportX = pViewport->uViewportTL_X; |
384 billboard.uViewportY = pViewport->uViewportTL_Y; | |
385 billboard.uViewportZ = pViewport->uViewportBR_X - 1; | |
386 billboard.uViewportW = pViewport->uViewportBR_Y; | |
1637 | 387 pODMRenderParams->uNumBillboards = uNumBillboardsToDraw; |
142 | 388 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
389 for (int i = 0; i < ::uNumBillboardsToDraw; ++i) |
0 | 390 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
391 auto pBillboard = pBillboardRenderList + i; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
392 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
393 billboard.uScreenSpaceX = pBillboard->uScreenSpaceX; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
394 billboard.uScreenSpaceY = pBillboard->uScreenSpaceY; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
395 billboard.uParentBillboardID = i; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
396 billboard._screenspace_x_scaler_packedfloat = pBillboard->_screenspace_x_scaler_packedfloat; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
397 billboard.uTintColor = pBillboard->uTintColor; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
398 billboard._screenspace_y_scaler_packedfloat = pBillboard->_screenspace_y_scaler_packedfloat; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
399 billboard.sZValue = pBillboard->sZValue; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
400 billboard.uFlags = pBillboard->field_1E; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
401 if (pBillboard->uHwSpriteID != -1) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
402 { |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
403 if (!pRenderer->pRenderD3D) __debugbreak(); // no sw rendering |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
404 //if (pRenderer->pRenderD3D) |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
405 pRenderer->TransformBillboard(&billboard, |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
406 &pSprites_LOD->pHardwareSprites[pBillboard->uHwSpriteID], |
657 | 407 pBillboard->dimming_level, pBillboard); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
408 /*else |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
409 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
410 assert(false); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
411 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
412 auto v1 = (char *)&pBillboard->uScreenSpaceY; |
0 | 413 if ( *(v1 - 10) & 2 ) |
414 v9 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 0, 1); | |
415 else | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
416 v9 = sr_GetBillboardPalette((RenderBillboard *)(v1 - 40), *((short *)v1 - 7), pBillboard->sZValue, *((short *)v1 + 1)); |
0 | 417 v10 = (*(v1 - 9) & 1) == 0; |
418 billboard.pPalette = v9; | |
419 if ( !v10 ) | |
420 billboard.pPalette = pPaletteManager->field_261600[*((short *)v1 - 7)]; | |
421 if ( !(billboard.uFlags & 0x40) && billboard.uFlags & 0x80 ) | |
422 { | |
323 | 423 v12 = stru_5C6E00->Cos(i * 5 + GetTickCount()); |
0 | 424 v15 = abs(v12); |
425 v18 = (unsigned __int64)(15i64 * v15) >> 16; | |
426 billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 15 - v18, 1); | |
427 } | |
428 v13 = *((short *)v1 - 8); | |
429 if ( v13 >= 0 ) | |
733 | 430 pSprites_LOD->pSpriteHeaders[v13].DrawSprite_sw(&billboard, 1); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
431 }*/ |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
432 } |
0 | 433 } |
434 } | |
435 | |
436 //----- (0047AF11) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
437 void Render::DrawSpriteObjects_ODM() |
0 | 438 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
439 //char *v0; // edi@2 |
430 | 440 //ObjectDesc *v1; // ebx@4 |
0 | 441 __int16 v2; // cx@5 |
442 RenderBillboard *v3; // esi@10 | |
443 SpriteFrame *v4; // eax@10 | |
430 | 444 //SpriteFrame *v5; // ebx@10 |
0 | 445 unsigned int v6; // eax@10 |
430 | 446 //int v7; // ecx@10 |
447 //int v8; // edx@10 | |
0 | 448 int v9; // ecx@10 |
449 unsigned __int16 v10; // ax@10 | |
430 | 450 //int *v11; // eax@14 |
0 | 451 int v12; // eax@22 |
452 int v13; // ST3C_4@23 | |
453 int v14; // eax@23 | |
454 int v15; // ecx@23 | |
455 int v16; // ebx@23 | |
456 int v17; // ecx@25 | |
457 int v18; // eax@25 | |
458 int v19; // ST40_4@26 | |
459 int v20; // ecx@26 | |
460 int v21; // ST44_4@28 | |
461 int v22; // ST3C_4@29 | |
462 signed __int64 v23; // qtt@30 | |
463 int v24; // ebx@30 | |
464 int v25; // ST3C_4@30 | |
465 int v26; // eax@31 | |
466 char v27; // zf@31 | |
430 | 467 //SpriteFrame *v28; // [sp+Ch] [bp-34h]@10 |
468 //__int16 a5; // [sp+10h] [bp-30h]@10 | |
0 | 469 int v30; // [sp+14h] [bp-2Ch]@23 |
470 int v31; // [sp+14h] [bp-2Ch]@29 | |
471 __int16 v32; // [sp+14h] [bp-2Ch]@30 | |
472 int v33; // [sp+18h] [bp-28h]@23 | |
473 int v34; // [sp+18h] [bp-28h]@26 | |
474 int v35; // [sp+18h] [bp-28h]@30 | |
475 int v36; // [sp+1Ch] [bp-24h]@10 | |
476 int v37; // [sp+1Ch] [bp-24h]@23 | |
477 int a6; // [sp+20h] [bp-20h]@10 | |
478 int a6a; // [sp+20h] [bp-20h]@23 | |
479 int v40; // [sp+24h] [bp-1Ch]@25 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
480 //signed int v41; // [sp+28h] [bp-18h]@1 |
0 | 481 int v42; // [sp+2Ch] [bp-14h]@23 |
482 int y; // [sp+30h] [bp-10h]@10 | |
483 int x; // [sp+34h] [bp-Ch]@10 | |
484 int z; // [sp+38h] [bp-8h]@10 | |
485 signed __int16 v46; // [sp+3Ch] [bp-4h]@12 | |
486 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
487 //v41 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
488 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
|
489 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
490 auto object = &pSpriteObjects[i]; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
491 //auto v0 = (char *)&pSpriteObjects[i].uSectorID; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
492 //v0 = (char *)&pSpriteObjects[0].uSectorID; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
493 //do |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
494 //{ |
430 | 495 if (!object->uObjectDescID) // item probably pciked up |
496 continue; | |
497 | |
498 assert(object->uObjectDescID < pObjectList->uNumObjects); | |
499 auto object_desc = pObjectList->pObjects + object->uObjectDescID; | |
500 if (object_desc->NoSprite()) | |
501 continue; | |
502 | |
503 //v1 = &pObjectList->pObjects[*((short *)v0 - 13)]; | |
504 //if ( !(v1->uFlags & 1) ) | |
505 //{ | |
506 //v2 = *((short *)v0 - 14) | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
507 v2 = object->uType; |
430 | 508 if ( (v2 < 1000 || v2 >= 10000) && (v2 < 500 || v2 >= 600) || pGame->pStru6Instance->_4A81CA(object) ) |
509 { | |
510 //a5 = *(short *)v0; | |
511 x = object->vPosition.x; | |
512 y = object->vPosition.y; | |
513 z = object->vPosition.z; | |
514 v3 = &pBillboardRenderList[::uNumBillboardsToDraw]; | |
515 v4 = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); | |
516 //v5 = v4; | |
517 //v28 = v4; | |
518 v36 = v4->uFlags; | |
519 a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier; | |
520 v6 = stru_5C6E00->Atan2(object->vPosition.x - pIndoorCamera->pos.x, object->vPosition.y - pIndoorCamera->pos.y); | |
521 //LOWORD(v7) = object->uFacing; | |
522 //v8 = v36; | |
523 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; | |
524 v10 = v4->pHwSpriteIDs[v9]; | |
0 | 525 v3->uHwSpriteID = v10; |
526 if ( v36 & 0x20 ) | |
527 { | |
430 | 528 //v8 = v36; |
529 z -= (signed int)((unsigned __int64)(v4->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; | |
0 | 530 } |
531 v46 = 0; | |
430 | 532 if ( v36 & 2 ) |
0 | 533 v46 = 2; |
430 | 534 //v11 = (int *)(256 << v9); |
535 if ( (256 << v9) & v36 ) | |
0 | 536 v46 |= 4u; |
430 | 537 if ( v36 & 0x40000 ) |
0 | 538 v46 |= 0x40u; |
430 | 539 if ( v36 & 0x20000 ) |
0 | 540 LOBYTE(v46) = v46 | 0x80; |
541 if ( a6 ) | |
542 { | |
430 | 543 //LOBYTE(v11) = byte_4E94D3; |
544 pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); | |
0 | 545 } |
546 v12 = (x - pIndoorCamera->pos.x) << 16; | |
547 if ( pIndoorCamera->sRotationX ) | |
548 { | |
549 v13 = (y - pIndoorCamera->pos.y) << 16; | |
1637 | 550 v30 = ((unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) |
551 + ((unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); | |
552 v37 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; | |
553 a6a = (unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; | |
0 | 554 v33 = (z - pIndoorCamera->pos.z) << 16; |
1637 | 555 v14 = (unsigned __int64)(v30 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; |
556 v15 = (unsigned __int64)(v33 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; | |
0 | 557 v16 = v15 + v14; |
558 v42 = v15 + v14; | |
1637 | 559 if ( v15 + v14 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) |
0 | 560 { |
561 v17 = a6a - v37; | |
562 v40 = a6a - v37; | |
1637 | 563 v18 = ((unsigned __int64)(v33 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16) |
564 - ((unsigned __int64)(v30 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); | |
0 | 565 goto LABEL_29; |
566 } | |
567 } | |
568 else | |
569 { | |
570 v34 = (y - pIndoorCamera->pos.y) << 16; | |
1637 | 571 v19 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; |
572 v20 = (unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; | |
0 | 573 v16 = v20 + v19; |
574 v42 = v20 + v19; | |
1637 | 575 if ( v20 + v19 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) |
0 | 576 { |
1637 | 577 v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; |
578 v17 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; | |
579 v40 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; | |
0 | 580 v18 = (z - pIndoorCamera->pos.z) << 16; |
581 LABEL_29: | |
582 v31 = v18; | |
583 v22 = abs(v17); | |
584 if ( abs(v16) >= v22 ) | |
585 { | |
586 LODWORD(v23) = 0; | |
1637 | 587 HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); |
0 | 588 v24 = v23 / v42; |
589 v25 = v23 / v42; | |
590 LODWORD(v23) = 0; | |
1637 | 591 HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); |
430 | 592 v35 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16); |
593 v32 = LOWORD(pViewport->uScreenCenterY) - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16); | |
594 | |
595 //if (::uNumBillboardsToDraw >= 500) | |
596 // return; | |
597 assert(::uNumBillboardsToDraw < 500); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
598 ++::uNumBillboardsToDraw; |
0 | 599 ++uNumSpritesDrawnThisFrame; |
430 | 600 |
601 object->uAttributes |= 1; | |
602 v3->uPalette = v4->uPaletteIndex; | |
603 v3->uIndoorSectorID = object->uSectorID; | |
604 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; | |
605 v26 = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; | |
606 v3->pSpriteFrame = v4; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
607 v3->_screenspace_y_scaler_packedfloat = v26; |
0 | 608 v3->field_1E = v46; |
430 | 609 v3->world_x = x; |
610 v3->world_y = y; | |
611 v3->world_z = z; | |
0 | 612 v3->uScreenSpaceX = v35; |
613 v3->uScreenSpaceY = v32; | |
614 HIWORD(v26) = HIWORD(v42); | |
615 LOWORD(v26) = 0; | |
430 | 616 v27 = (object->uAttributes & 0x20) == 0; |
862 | 617 v3->sZValue = v26 + (PID(OBJECT_Item,i)); |
657 | 618 v3->dimming_level = 0; |
0 | 619 v3->uTintColor = 0; |
620 if ( !v27 ) | |
621 { | |
622 if ( !pRenderer->pRenderD3D ) | |
623 v3->sZValue = 0; | |
624 } | |
625 } | |
626 goto LABEL_34; | |
627 } | |
628 } | |
629 } | |
430 | 630 //} |
0 | 631 LABEL_34: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
632 ; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
633 //++v41; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
634 //v0 += 112; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
635 //} |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
636 //while ( v41 < (signed int)uNumSpriteObjects ); |
0 | 637 } |
638 } | |
639 // 4E94D3: using guessed type char byte_4E94D3; | |
640 // 5187E4: using guessed type int uNumSpritesDrawnThisFrame; | |
641 | |
642 //----- (0049D9BC) -------------------------------------------------------- | |
643 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut) | |
644 { | |
645 size_t v4; // eax@1 | |
646 size_t v5; // eax@1 | |
647 IUnknown *v6; // eax@10 | |
648 size_t v7; // eax@13 | |
649 DDDEVICEIDENTIFIER ddDevId; // [sp+4h] [bp-4F8h]@11 | |
650 DDSURFACEDESC2 v10;/*int v10; // [sp+42Ch] [bp-D0h]@16 | |
651 int v11; // [sp+430h] [bp-CCh]@16 | |
652 int v12; // [sp+434h] [bp-C8h]@16 | |
653 int v13; // [sp+438h] [bp-C4h]@16 | |
654 int v14; // [sp+474h] [bp-88h]@16*/ | |
655 DDSCAPS2 ddsCaps; // [sp+4A8h] [bp-54h]@14 | |
656 unsigned int uFreeVideoMem; // [sp+4B8h] [bp-44h]@14 | |
657 RenderD3D_aux aux; // [sp+4BCh] [bp-40h]@19 | |
658 IDirect3D3 *pDirect3D3; // [sp+4C4h] [bp-38h]@18 | |
659 int v19; // [sp+4C8h] [bp-34h]@16 | |
660 RenderD3D_D3DDevDesc v20; // [sp+4CCh] [bp-30h]@1 | |
661 LPDIRECTDRAW pDirectDraw; // [sp+4F4h] [bp-8h]@4 | |
662 IDirectDraw4 *pDirectDraw4; // [sp+4F8h] [bp-4h]@7 | |
663 | |
664 v4 = strlen(lpDriverName); | |
665 v20.pDriverName = new char[v4 + 1]; | |
666 v5 = strlen(lpDevDesc); | |
667 v20.pDeviceDesc = new char[v5 + 1]; | |
668 strcpy(v20.pDriverName, lpDriverName); | |
669 strcpy(v20.pDeviceDesc, lpDevDesc); | |
670 if ( lpGUID ) | |
671 { | |
672 v20.pGUID = new GUID; | |
673 memcpy(v20.pGUID, lpGUID, 0x10u); | |
674 } | |
675 else | |
676 { | |
677 v20.pGUID = 0; | |
678 } | |
679 | |
680 if (FAILED(DirectDrawCreate(v20.pGUID, &pDirectDraw, 0))) | |
681 { | |
682 delete [] v20.pDriverName; | |
683 delete [] v20.pDeviceDesc; | |
684 if ( v20.pGUID ) | |
685 delete v20.pGUID; | |
686 } | |
687 else | |
688 { | |
689 if (FAILED(pDirectDraw->QueryInterface(IID_IDirectDraw4, (LPVOID *)&pDirectDraw4))) | |
690 { | |
691 delete [] v20.pDriverName; | |
692 delete [] v20.pDeviceDesc; | |
693 if ( v20.pGUID ) | |
694 delete v20.pGUID; | |
695 v6 = (IUnknown *)pDirectDraw; | |
696 } | |
697 else | |
698 { | |
699 pDirectDraw->Release(); | |
700 if (FAILED( pDirectDraw4->GetDeviceIdentifier(&ddDevId, 1u))) | |
701 { | |
702 v20.pDDraw4DevDesc = 0; | |
703 } | |
704 else | |
705 { | |
706 v7 = strlen(ddDevId.szDescription); | |
707 v20.pDDraw4DevDesc = new char[v7 + 1]; | |
708 strcpy(v20.pDDraw4DevDesc, ddDevId.szDescription); | |
709 } | |
710 memset(&ddsCaps, 0, 0x10u); | |
711 if (FAILED(pDirectDraw4->GetAvailableVidMem( | |
712 &ddsCaps, | |
713 (LPDWORD)&v20.uVideoMem, | |
714 (LPDWORD)&uFreeVideoMem))) | |
715 v20.uVideoMem = 0; | |
716 memset(&v10, 0, 0x7Cu); | |
717 v10.dwSize = 124; | |
718 v10.dwFlags = 6; | |
719 v10.dwHeight = 640; | |
720 v10.dwWidth = 480; | |
721 v10.ddpfPixelFormat.dwSize = 32; | |
722 | |
723 v19 = 0; | |
724 if ( FAILED(pDirectDraw4->EnumDisplayModes( | |
725 0, | |
726 0, | |
727 &v19, | |
728 (LPDDENUMMODESCALLBACK2)DDrawDisplayModesEnumerator)) | |
729 || !v19 | |
730 || FAILED(pDirectDraw4->QueryInterface(IID_IDirect3D3, (LPVOID *)&pDirect3D3))) | |
731 { | |
732 delete [] v20.pDriverName; | |
733 delete [] v20.pDeviceDesc; | |
734 if ( v20.pDDraw4DevDesc ) | |
735 free(v20.pDDraw4DevDesc); | |
736 if ( v20.pGUID ) | |
737 delete v20.pGUID; | |
738 v6 = (IUnknown *)pDirectDraw4; | |
739 } | |
740 else | |
741 { | |
742 aux.pInfo = pOut; | |
743 aux.ptr_4 = &v20; | |
744 pDirect3D3->EnumDevices((LPD3DENUMDEVICESCALLBACK)D3DDeviceEnumerator, &aux); | |
745 delete [] v20.pDriverName; | |
746 delete [] v20.pDeviceDesc; | |
747 if ( v20.pDDraw4DevDesc ) | |
748 free(v20.pDDraw4DevDesc); | |
749 if ( v20.pGUID ) | |
750 delete v20.pGUID; | |
751 pDirectDraw4->Release(); | |
752 v6 = (IUnknown *)pDirect3D3; | |
753 pDirectDraw4 = 0; | |
754 } | |
755 } | |
756 v6->Release(); | |
757 } | |
758 return 1; | |
759 } | |
760 | |
761 //----- (0049D784) -------------------------------------------------------- | |
762 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, RenderD3D_aux *a6) | |
763 { | |
764 int v6; // eax@1 | |
765 signed int v7; // edi@1 | |
766 signed int v8; // edi@14 | |
767 size_t v9; // eax@30 | |
768 size_t v10; // eax@30 | |
769 size_t v11; // eax@30 | |
770 size_t v12; // eax@30 | |
771 size_t v13; // eax@30 | |
772 | |
773 v6 = pHWDesc->dwFlags; | |
774 v7 = -1; | |
775 if ( v6 ) | |
776 { | |
777 if ( !a6->ptr_4->pGUID ) | |
778 v7 = 0; | |
779 if ( v6 && a6->ptr_4->pGUID ) | |
780 v7 = 1; | |
781 } | |
782 if ( !strcmp(lpDeviceName, "RGB Emulation") && !a6->ptr_4->pGUID ) | |
783 v7 = 2; | |
784 if ( !strcmp(lpDeviceName, "Reference Rasterizer") && !a6->ptr_4->pGUID ) | |
785 v7 = 3; | |
786 if ( v7 != -1 ) | |
787 { | |
788 v8 = v7; | |
789 a6->pInfo[v8].bIsDeviceCompatible = 1; | |
790 a6->pInfo[v8].uCaps = 0; | |
791 if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 0x10) ) | |
792 a6->pInfo[v8].uCaps |= 2u; | |
793 if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 2) ) | |
794 a6->pInfo[v8].uCaps |= 4u; | |
795 if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 1) ) | |
796 a6->pInfo[v8].uCaps |= 8u; | |
797 if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 0x20) ) | |
798 a6->pInfo[v8].uCaps |= 0x10u; | |
799 if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 2) ) | |
800 a6->pInfo[v8].uCaps |= 0x20u; | |
801 if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 4) ) | |
802 a6->pInfo[v8].uCaps |= 0x40u; | |
803 if ( !(BYTE1(pHWDesc->dwDevCaps) & 0x10) ) | |
804 BYTE1(a6->pInfo[v8].uCaps) |= 1u; | |
805 if ( pHWDesc->dpcTriCaps.dwTextureCaps & 0x20 ) | |
806 LOBYTE(a6->pInfo[v8].uCaps) |= 0x80u; | |
807 v9 = strlen(lpDeviceName); | |
808 a6->pInfo[v8].pName = new char[v9 + 1]; | |
809 strcpy(a6->pInfo[v8].pName, lpDeviceName); | |
810 v10 = strlen(lpDeviceDesc); | |
811 a6->pInfo[v8].pDescription = new char[v10 + 1]; | |
812 strcpy(a6->pInfo[v8].pDescription, lpDeviceDesc); | |
1631 | 813 a6->pInfo[v8].pGUID = new GUID; |
0 | 814 memcpy(a6->pInfo[v8].pGUID, lpGUID, 0x10u); |
815 v11 = strlen(a6->ptr_4->pDriverName); | |
816 a6->pInfo[v8].pDriverName = new char[v11 + 1]; | |
817 strcpy(a6->pInfo[v8].pDriverName, a6->ptr_4->pDriverName); | |
818 v12 = strlen(a6->ptr_4->pDeviceDesc); | |
819 a6->pInfo[v8].pDeviceDesc = new char[v12 + 1]; | |
820 strcpy(a6->pInfo[v8].pDeviceDesc, a6->ptr_4->pDeviceDesc); | |
821 v13 = strlen(a6->ptr_4->pDDraw4DevDesc); | |
822 a6->pInfo[v8].pDDraw4DevDesc = new char[v13 + 1]; | |
823 strcpy(a6->pInfo[v8].pDDraw4DevDesc, a6->ptr_4->pDDraw4DevDesc); | |
824 if ( a6->ptr_4->pGUID ) | |
825 { | |
826 a6->pInfo[v8].pDirectDrawGUID = new GUID; | |
827 memcpy(a6->pInfo[v8].pDirectDrawGUID, a6->ptr_4->pGUID, 0x10u); | |
828 } | |
829 else | |
830 { | |
831 a6->pInfo[v8].pDirectDrawGUID = 0; | |
832 } | |
833 a6->pInfo[v8].uVideoMem = a6->ptr_4->uVideoMem; | |
834 } | |
835 return 1; | |
836 } | |
837 | |
838 //----- (0049D75C) -------------------------------------------------------- | |
839 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2) | |
840 { | |
841 HRESULT result; // eax@3 | |
842 | |
843 if ( pSurfaceDesc->ddsCaps.dwCaps | 0x2000 && pSurfaceDesc->ddpfPixelFormat.dwRGBBitCount == 16 ) | |
844 { | |
845 *a2 = 1; | |
846 result = 0; | |
847 } | |
848 else | |
849 { | |
850 result = 1; | |
851 } | |
852 return result; | |
853 } | |
854 | |
855 //----- (0047A95E) -------------------------------------------------------- | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
856 void Render::PrepareDecorationsRenderList_ODM() |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
857 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
858 //char *v0; // esi@2 |
639 | 859 //DecorationDesc *v1; // ebx@6 |
0 | 860 __int16 v2; // ax@6 |
861 double v3; // st7@7 | |
639 | 862 //int v4; // eax@9 |
863 //int v5; // edx@9 | |
0 | 864 unsigned int v6; // edi@9 |
865 int v7; // eax@9 | |
866 SpriteFrame *v8; // eax@9 | |
635 | 867 //SpriteFrame *v9; // edi@9 |
0 | 868 unsigned __int16 *v10; // eax@9 |
869 int v11; // ecx@9 | |
870 int v12; // eax@9 | |
871 int v13; // ecx@9 | |
872 int v14; // ecx@20 | |
873 char v15; // dl@20 | |
874 signed int v16; // eax@20 | |
875 int v17; // eax@23 | |
876 int v18; // ecx@24 | |
877 int v19; // eax@24 | |
878 int v20; // ecx@24 | |
879 int v21; // ebx@26 | |
880 int v22; // eax@26 | |
881 int v23; // eax@30 | |
882 signed __int64 v24; // qtt@31 | |
883 int v25; // ebx@31 | |
884 int v26; // ecx@32 | |
885 RenderBillboard *v27; // eax@37 | |
886 __int16 v28; // dx@37 | |
887 __int16 v29; // cx@37 | |
888 int v30; // ecx@37 | |
889 int v31; // ebx@37 | |
619 | 890 Particle_sw local_0; // [sp+Ch] [bp-98h]@7 |
639 | 891 //int x; // [sp+74h] [bp-30h]@9 |
892 //int y; // [sp+78h] [bp-2Ch]@9 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
893 //int v35; // [sp+7Ch] [bp-28h]@1 |
639 | 894 //int v36; // [sp+80h] [bp-24h]@9 |
0 | 895 unsigned __int16 *v37; // [sp+84h] [bp-20h]@9 |
896 int v38; // [sp+88h] [bp-1Ch]@9 | |
897 int v39; // [sp+8Ch] [bp-18h]@24 | |
898 int v40; // [sp+90h] [bp-14h]@24 | |
899 int v41; // [sp+94h] [bp-10h]@24 | |
900 int v42; // [sp+98h] [bp-Ch]@9 | |
901 int a5; // [sp+9Ch] [bp-8h]@9 | |
902 int b; // [sp+A0h] [bp-4h]@22 | |
903 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
904 //v35 = 0; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
905 //if ( (signed int)uNumLevelDecorations > 0 ) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
906 //{ |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
907 //v0 = (char *)&pLevelDecorations[0].vPosition.y; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
908 //do |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
909 for (int i = 0; i < uNumLevelDecorations; ++i) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
910 { |
1202 | 911 auto decor = &pLevelDecorations[i]; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
912 auto v0 = (char *)&pLevelDecorations[i].vPosition.y; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
913 |
1491
6d21ef91cb2d
Rename LevelDecoration::_47A825 to LevelDecoration::IsObeliskChestActive().
yoctozepto
parents:
1490
diff
changeset
|
914 if ((!(decor->uFlags & LEVEL_DECORATION_OBELISK_CHEST) || decor->IsObeliskChestActive()) && !(decor->uFlags & LEVEL_DECORATION_INVISIBLE)) |
1490 | 915 { |
916 //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; | |
917 auto decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; | |
918 v2 = decor_desc->uFlags; | |
919 if ( (char)v2 >= 0 ) | |
920 { | |
921 if ( !(v2 & 0x22) ) | |
0 | 922 { |
1490 | 923 //v4 = decor->vPosition.x; |
924 //v5 = decor->vPosition.z; | |
925 v6 = pMiscTimer->uTotalGameTimeElapsed; | |
926 //y = decor->vPosition.y; | |
927 //x = decor->vPosition.x; | |
928 //v36 = decor->vPosition.z; | |
929 v7 = abs(decor->vPosition.x + decor->vPosition.y); | |
930 | |
931 | |
932 #pragma region "New: seasons change" | |
933 extern bool change_seasons; | |
934 if (change_seasons) | |
935 switch (pParty->uCurrentMonth) | |
936 { | |
937 // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites | |
938 case 11: case 0: case 1: // winter | |
939 switch (decor_desc->uSpriteID) | |
940 { | |
941 //case 468: //bush02 grows on swamps, which are evergreeen actually | |
942 case 548: // flower10 | |
943 case 547: // flower09 | |
944 case 541: // flower03 | |
945 case 539: continue; // flower01 | |
946 | |
947 case 483: // tree01 | |
948 case 486: // tree04 | |
949 case 492: // tree10 | |
950 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 2); | |
951 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7); | |
952 break; | |
953 | |
954 default: | |
955 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
956 } | |
957 break; | |
958 | |
959 case 2: case 3: case 4: // spring | |
960 switch (decor_desc->uSpriteID) | |
961 { | |
962 } | |
963 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
964 break; | |
965 | |
966 case 8: case 9: case 10: // autumn | |
967 switch (decor_desc->uSpriteID) | |
968 { | |
969 //case 468: //bush02 grows on swamps, which are evergreeen actually | |
970 case 548: // flower10 | |
971 case 547: // flower09 | |
972 case 541: // flower03 | |
973 case 539: continue; // flower01 | |
974 | |
975 case 483: // tree01 | |
976 case 486: // tree04 | |
977 case 492: // tree10 | |
978 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 1); | |
979 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7); | |
980 break; | |
981 | |
982 default: | |
983 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
984 } | |
985 break; | |
986 | |
987 case 5: case 6: case 7: // summer | |
988 //all green by default | |
989 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
990 break; | |
991 | |
992 default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); | |
993 } | |
994 else | |
995 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
996 #pragma endregion | |
997 //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
998 | |
999 //v9 = v8; | |
1000 v42 = v8->uFlags; | |
1001 a5 = v8->uGlowRadius; | |
1002 v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pIndoorCamera->pos.x, | |
1003 decor->vPosition.y - pIndoorCamera->pos.y); | |
1004 v11 = *((int *)v0 + 2); | |
1005 v37 = v10; | |
1006 v12 = v42; | |
1007 v38 = 0; | |
1008 v13 = ((signed int)(stru_5C6E00->uIntegerPi | |
1009 + ((signed int)stru_5C6E00->uIntegerPi >> 3) | |
1010 + v11 | |
1011 - (signed int)v37) >> 8) & 7; | |
1012 v37 = (unsigned __int16 *)v13; | |
1013 if ( v42 & 2 ) | |
1014 v38 = 2; | |
1015 if ( (256 << v13) & v42 ) | |
1016 v38 |= 4u; | |
1017 if ( v12 & 0x40000 ) | |
1018 v38 |= 0x40u; | |
1019 if ( v12 & 0x20000 ) | |
1020 LOBYTE(v38) = v38 | 0x80; | |
1021 if ( a5 ) | |
0 | 1022 { |
1490 | 1023 if ( pRenderer->pRenderD3D && pRenderer->bUseColoredLights ) |
0 | 1024 { |
1490 | 1025 v14 = decor_desc->uColoredLightRed; |
1026 v15 = decor_desc->uColoredLightGreen; | |
1027 v16 = decor_desc->uColoredLightBlue; | |
0 | 1028 } |
1029 else | |
1030 { | |
1490 | 1031 v16 = 255; |
1032 v14 = 255; | |
1033 v15 = 255; | |
1034 } | |
1035 b = v16; | |
1036 pStationaryLightsStack->AddLight( | |
1037 decor->vPosition.x, | |
1038 decor->vPosition.y, | |
1039 decor->vPosition.z + decor_desc->uDecorationHeight / 2, | |
1040 a5, | |
1041 v14, | |
1042 v15, | |
1043 v16, | |
1044 byte_4E94D0); | |
1045 } | |
1046 v17 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; | |
1047 if ( pIndoorCamera->sRotationX ) | |
1048 { | |
1049 v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; | |
1637 | 1050 v18 = ((unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) |
1051 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); | |
1490 | 1052 v42 = v18; |
1637 | 1053 b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; |
1054 a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; | |
1490 | 1055 v40 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; |
1637 | 1056 v41 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; |
1057 v19 = (unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; | |
1058 v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); | |
1059 v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); | |
1060 if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) | |
1490 | 1061 { |
1062 v21 = a5 - b; | |
1063 v41 = a5 - b; | |
1637 | 1064 a5 = (unsigned __int64)(v42 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; |
1065 b = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; | |
1066 v22 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16) - a5; | |
1490 | 1067 LABEL_30: |
1068 v42 = v22; | |
1069 v40 = 2 * abs(v20); | |
1070 v23 = abs(v21); | |
1071 if ( v40 >= v23 ) | |
0 | 1072 { |
1490 | 1073 LODWORD(v24) = 0; |
1637 | 1074 HIDWORD(v24) = SLOWORD(pODMRenderParams->int_fov_rad); |
1490 | 1075 a5 = v24 / v39; |
1076 v25 = pViewport->uScreenCenterX | |
1077 - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16); | |
1078 b = (unsigned __int64)(a5 * (signed __int64)v42) >> 16; | |
1079 v41 = v24 / v39; | |
1080 v40 = pViewport->uScreenCenterY | |
1081 - ((signed int)(((unsigned __int64)(a5 * (signed __int64)v42) >> 16) + 32768) >> 16); | |
1082 v42 = v8->scale; | |
1083 v41 = (unsigned __int64)(v42 * v24 / v39) >> 16; | |
1084 v37 = (unsigned __int16 *)&v8->pHwSpriteIDs[(int)v37]; | |
1085 if ( pRenderer->pRenderD3D ) | |
1086 { | |
1087 v26 = v41; | |
1088 v42 = pSprites_LOD->pHardwareSprites[(signed __int16)*v37].uBufferWidth >> 1; | |
1089 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; | |
1090 } | |
1091 else | |
1092 { | |
1093 v26 = v41; | |
1094 v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1; | |
1095 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; | |
1096 } | |
1097 if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) | |
1098 { | |
1099 if (::uNumBillboardsToDraw >= 500) | |
1100 return; | |
1101 v27 = &pBillboardRenderList[::uNumBillboardsToDraw++]; | |
1102 ++uNumDecorationsDrawnThisFrame; | |
1103 v27->uHwSpriteID = *v37; | |
1104 v28 = v8->uPaletteIndex; | |
1105 v27->_screenspace_x_scaler_packedfloat = v26; | |
1106 v27->_screenspace_y_scaler_packedfloat = v26; | |
1107 v29 = v38; | |
1108 v27->uScreenSpaceX = v25; | |
1109 HIBYTE(v29) |= 2u; | |
1110 v27->uPalette = v28; | |
1111 v27->field_1E = v29; | |
1112 v27->world_x = decor->vPosition.x; | |
1113 v27->world_y = decor->vPosition.y; | |
1114 v27->world_z = decor->vPosition.z; | |
1115 v27->uScreenSpaceY = v40; | |
1116 HIWORD(v30) = HIWORD(v39); | |
1117 v31 = PID(OBJECT_Decoration,i); | |
1118 LOWORD(v30) = 0; | |
1119 v27->uIndoorSectorID = 0; | |
1120 v27->sZValue = v30 + v31; | |
1121 v27->dimming_level = 0; | |
1122 v27->pSpriteFrame = v8; | |
1123 v27->uTintColor = 0; | |
1124 } | |
0 | 1125 } |
1490 | 1126 goto LABEL_38; |
1127 } | |
1128 } | |
1129 else | |
1130 { | |
1131 v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; | |
1132 v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; | |
1637 | 1133 b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; |
1134 a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; | |
1135 v20 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); | |
1136 v39 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); | |
1137 if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) | |
1490 | 1138 { |
1637 | 1139 a5 = (unsigned __int64)(v42 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; |
1140 b = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; | |
1141 v21 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; | |
1142 v41 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; | |
1490 | 1143 v22 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; |
1144 goto LABEL_30; | |
0 | 1145 } |
1146 } | |
1147 } | |
1490 | 1148 } |
1149 else | |
1150 { | |
1151 memset(&local_0, 0, 0x68u); | |
1152 v3 = (double)*((signed int *)v0 - 1); | |
1153 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; | |
1154 local_0.uDiffuse = 0xFF3C1E; | |
1155 local_0.x = v3; | |
1156 local_0.y = (double)*(signed int *)v0; | |
1157 local_0.z = (double)*((signed int *)v0 + 1); | |
1158 local_0.r = 0.0; | |
1159 local_0.g = 0.0; | |
1160 local_0.b = 0.0; | |
1161 local_0.flt_28 = 1.0; | |
1162 local_0.timeToLive = (rand() & 0x80) + 128; | |
1163 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); | |
1164 pGame->pParticleEngine->AddParticle(&local_0); | |
1165 } | |
1166 } | |
0 | 1167 LABEL_38: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1168 ; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1169 //++v35; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1170 //v0 += 32; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1171 } |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1172 //while ( v35 < (signed int)uNumLevelDecorations ); |
0 | 1173 } |
1174 // 4E94D0: using guessed type char byte_4E94D0; | |
1175 // 5187EC: using guessed type int uNumDecorationsDrawnThisFrame; | |
1176 | |
1177 //----- (0049D717) -------------------------------------------------------- | |
1178 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst) | |
1179 { | |
1180 HRESULT v2; // esi@2 | |
1181 | |
1182 if ( Src->dwFlags & 0x400 | 0x2000 ) | |
1183 { | |
1184 v2 = 0; | |
1185 if ( Src->dwRGBBitCount == 16 && !Src->dwRBitMask ) | |
1186 goto LABEL_6; | |
1187 if ( !Dst->dwSize ) | |
1188 { | |
1189 v2 = 1; | |
1190 LABEL_6: | |
1191 memcpy(Dst, Src, 0x20u); | |
1192 return v2; | |
1193 } | |
1194 } | |
1195 return 1; | |
1196 } | |
1197 | |
1198 //----- (0049DC28) -------------------------------------------------------- | |
1199 void RenderD3D::GetAvailableDevices(RenderD3D__DevInfo **pOutDevices) | |
1200 { | |
1201 RenderD3D__DevInfo *v2; // eax@1 | |
1202 | |
1203 v2 = new RenderD3D__DevInfo[4];// 4 items | |
1204 *pOutDevices = v2; | |
1205 memset(v2, 0, 0xA0u); | |
1206 DirectDrawEnumerateA((LPDDENUMCALLBACKA)RenderD3D__DeviceEnumerator, *pOutDevices); | |
1207 } | |
1208 | |
1209 //----- (0049DC58) -------------------------------------------------------- | |
1210 RenderD3D::RenderD3D() | |
1211 { | |
1212 RenderD3D *v1; // esi@1 | |
1213 | |
1214 v1 = this; | |
1215 this->pHost = 0; | |
1216 this->pDirect3D = 0; | |
1217 this->pUnk = 0; | |
1218 this->pBackBuffer = 0; | |
1219 this->pFrontBuffer = 0; | |
1220 this->pZBuffer = 0; | |
1221 this->pDevice = 0; | |
1222 this->pViewport = 0; | |
1223 this->field_40 = 1; | |
1224 this->field_44 = 10; | |
1225 GetAvailableDevices(&this->pAvailableDevices); | |
1226 } | |
1227 | |
1228 //----- (0049DC90) -------------------------------------------------------- | |
1229 void RenderD3D::Release() | |
1230 { | |
1231 RenderD3D *v1; // esi@1 | |
1232 IDirectDraw4 *v2; // eax@2 | |
1233 signed int v3; // edi@4 | |
1234 IDirect3DViewport3 *v4; // eax@22 | |
1235 IUnknown *v5; // eax@24 | |
1236 IDirectDrawSurface4 *v6; // eax@26 | |
1237 IDirect3DDevice3 *v7; // eax@28 | |
1238 IDirect3D3 *v8; // eax@30 | |
1239 IDirectDrawSurface4 *v9; // eax@32 | |
1240 IDirectDrawSurface4 *v10; // eax@34 | |
1241 IDirectDraw4 *v11; // eax@36 | |
1242 | |
1243 v1 = this; | |
1244 if ( !this->bWindowed ) | |
1245 { | |
1246 v2 = this->pHost; | |
1247 if ( v2 ) | |
1248 { | |
1249 v2->RestoreDisplayMode(); | |
1250 v1->pHost->SetCooperativeLevel(v1->hWindow, 8u); | |
1251 v1->pHost->FlipToGDISurface(); | |
1252 } | |
1253 } | |
1254 v3 = 0; | |
1255 do | |
1256 { | |
1257 if ( v1->pAvailableDevices[v3].pDriverName ) | |
1258 { | |
1259 free(v1->pAvailableDevices[v3].pDriverName); | |
1260 v1->pAvailableDevices[v3].pDriverName = 0; | |
1261 } | |
1262 if ( v1->pAvailableDevices[v3].pDeviceDesc ) | |
1263 { | |
1264 free(v1->pAvailableDevices[v3].pDeviceDesc); | |
1265 v1->pAvailableDevices[v3].pDeviceDesc = 0; | |
1266 } | |
1267 if ( v1->pAvailableDevices[v3].pDDraw4DevDesc ) | |
1268 { | |
1269 free(v1->pAvailableDevices[v3].pDDraw4DevDesc); | |
1270 v1->pAvailableDevices[v3].pDDraw4DevDesc = 0; | |
1271 } | |
1272 if ( v1->pAvailableDevices[v3].pDirectDrawGUID ) | |
1273 { | |
1274 free(v1->pAvailableDevices[v3].pDirectDrawGUID); | |
1275 v1->pAvailableDevices[v3].pDirectDrawGUID = 0; | |
1276 } | |
1277 if ( v1->pAvailableDevices[v3].pName ) | |
1278 { | |
1279 free(v1->pAvailableDevices[v3].pName); | |
1280 v1->pAvailableDevices[v3].pName = 0; | |
1281 } | |
1282 if ( v1->pAvailableDevices[v3].pDescription ) | |
1283 { | |
1284 free(v1->pAvailableDevices[v3].pDescription); | |
1285 v1->pAvailableDevices[v3].pDescription = 0; | |
1286 } | |
1287 if ( v1->pAvailableDevices[v3].pGUID ) | |
1288 { | |
1289 free(v1->pAvailableDevices[v3].pGUID); | |
1290 v1->pAvailableDevices[v3].pGUID = 0; | |
1291 } | |
1292 ++v3; | |
1293 } | |
1294 while ( v3 < 4 ); | |
1295 if ( v1->pAvailableDevices ) | |
1296 { | |
1297 free(v1->pAvailableDevices); | |
1298 v1->pAvailableDevices = 0; | |
1299 } | |
1300 v4 = v1->pViewport; | |
1301 if ( v4 ) | |
1302 { | |
1303 v4->Release(); | |
1304 v1->pViewport = 0; | |
1305 } | |
1306 v5 = v1->pUnk; | |
1307 if ( v5 ) | |
1308 { | |
1309 v5->Release(); | |
1310 v1->pUnk = 0; | |
1311 } | |
1312 v6 = v1->pZBuffer; | |
1313 if ( v6 ) | |
1314 { | |
1315 v6->Release(); | |
1316 v1->pZBuffer = 0; | |
1317 } | |
1318 v7 = v1->pDevice; | |
1319 if ( v7 ) | |
1320 { | |
1321 v7->Release(); | |
1322 v1->pDevice = 0; | |
1323 } | |
1324 v8 = v1->pDirect3D; | |
1325 if ( v8 ) | |
1326 { | |
1327 v8->Release(); | |
1328 v1->pDirect3D = 0; | |
1329 } | |
1330 v9 = v1->pBackBuffer; | |
1331 if ( v9 ) | |
1332 { | |
1333 v9->Release(); | |
1334 v1->pBackBuffer = 0; | |
1335 } | |
1336 v10 = v1->pFrontBuffer; | |
1337 if ( v10 ) | |
1338 { | |
1339 v10->Release(); | |
1340 v1->pFrontBuffer = 0; | |
1341 } | |
1342 v11 = v1->pHost; | |
1343 if ( v11 ) | |
1344 { | |
1345 v11->Release(); | |
1346 v1->pHost = 0; | |
1347 } | |
1348 } | |
1349 | |
1350 //----- (0049DE14) -------------------------------------------------------- | |
1351 bool RenderD3D::CreateDevice(unsigned int uDeviceID, int bWindowed, HWND hWnd) | |
1352 { | |
1353 //IDirectDraw4 *v8; // eax@12 | |
1354 //IDirectDraw4 *v9; // eax@16 | |
1355 //IDirectDraw4 *v10; // eax@20 | |
1356 //IDirectDraw4 *v13; // eax@35 | |
1357 const char *v23; // [sp-4h] [bp-DCh]@9 | |
1358 const char *v24; // [sp-4h] [bp-DCh]@13 | |
1359 const char *v25; // [sp-4h] [bp-DCh]@19 | |
1360 DWORD v26; // [sp-4h] [bp-DCh]@30 | |
1361 DDSCAPS2 v27; // [sp+Ch] [bp-CCh]@37 | |
1362 DDSURFACEDESC2 ddsd2; // [sp+1Ch] [bp-BCh]@11 | |
1363 D3DVIEWPORT2 d3dvp2; // [sp+98h] [bp-40h]@28 | |
1364 IDirectDrawClipper *v30; // [sp+C4h] [bp-14h]@18 | |
1365 LPDIRECTDRAW lpDD; // [sp+C8h] [bp-10h]@1 | |
1366 | |
1367 this->bWindowed = bWindowed; | |
1368 this->hWindow = hWnd; | |
1369 | |
1370 if (FAILED(DirectDrawCreate(pAvailableDevices[uDeviceID].pDirectDrawGUID, &lpDD, 0))) | |
1371 { | |
1372 sprintf(pErrorMessage, "Init - Failed to create DirectDraw interface.\n"); | |
1373 return 0; | |
1374 } | |
1375 | |
1376 if (FAILED(lpDD->QueryInterface(IID_IDirectDraw4, (LPVOID *)&pHost))) | |
1377 { | |
1378 sprintf(pErrorMessage, "Init - Failed to create DirectDraw4 interface.\n"); | |
1379 if (lpDD) | |
1380 lpDD->Release(); | |
1381 return 0; | |
1382 } | |
1383 lpDD->Release(); | |
1384 lpDD = 0; | |
1385 | |
1386 if (bWindowed && !pAvailableDevices[uDeviceID].pDirectDrawGUID) | |
1387 { | |
1388 if (FAILED(pHost->SetCooperativeLevel(hWnd, DDSCL_MULTITHREADED | DDSCL_NORMAL))) | |
1389 { | |
1390 v23 = "Init - Failed to set cooperative level.\n"; | |
1391 sprintf(pErrorMessage, v23); | |
1392 LABEL_65: | |
1393 if (pHost) | |
1394 { | |
1395 pHost->Release(); | |
1396 pHost = 0; | |
1397 } | |
1398 return 0; | |
1399 } | |
1400 memset(&ddsd2, 0, sizeof(DDSURFACEDESC2)); | |
1401 ddsd2.dwSize = sizeof(DDSURFACEDESC2); | |
1402 ddsd2.dwFlags = DDSD_CAPS; | |
1403 ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; | |
1404 if ( !pHost->CreateSurface(&ddsd2, &pFrontBuffer, 0) ) | |
1405 { | |
1406 ddsd2.dwSize = sizeof(DDSURFACEDESC2); | |
1407 pHost->GetDisplayMode(&ddsd2); | |
1408 if ( ddsd2.ddpfPixelFormat.dwRGBBitCount != 16 ) | |
1409 { | |
1410 v24 = "Init - Desktop isn't in 16 bit mode.\n"; | |
1411 goto LABEL_14; | |
1412 } | |
1413 | |
1414 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; | |
1415 ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; | |
1416 ddsd2.dwWidth = 640; | |
1417 ddsd2.dwHeight = 480; | |
1418 if (pHost->CreateSurface(&ddsd2, &pBackBuffer, 0) ) | |
1419 { | |
1420 v24 = "Init - Failed to create back buffer.\n"; | |
1421 LABEL_14: | |
1422 sprintf(pErrorMessage, v24); | |
1423 if (pFrontBuffer) | |
1424 { | |
1425 pFrontBuffer->Release(); | |
1426 pFrontBuffer = 0; | |
1427 } | |
1428 goto LABEL_65; | |
1429 } | |
1430 if ( pHost->CreateClipper(0, &v30, 0) ) | |
1431 { | |
1432 v25 = "Init - Failed to create clipper.\n"; | |
1433 goto LABEL_45; | |
1434 } | |
1435 v30->SetHWnd(0, hWnd); | |
1436 pFrontBuffer->SetClipper(v30); | |
1437 | |
1438 v30->Release(); | |
1439 v30 = 0; | |
1440 | |
1441 pHost->QueryInterface(IID_IDirect3D3, (LPVOID *)&pDirect3D); | |
1442 | |
1443 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; | |
1444 ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; | |
1445 ddsd2.dwWidth = 640; | |
1446 ddsd2.dwHeight = 480; | |
1447 | |
1448 if ( pDirect3D->EnumZBufferFormats(*pAvailableDevices[uDeviceID].pGUID, | |
1449 (HRESULT (__stdcall *)(DDPIXELFORMAT *, void *))D3DZBufferFormatEnumerator, | |
1450 &ddsd2.ddpfPixelFormat) ) | |
1451 goto LABEL_21; | |
1452 if ( uDeviceID == 2 || uDeviceID == 3 ) | |
1453 ddsd2.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; | |
1454 | |
1455 if ( !pHost->CreateSurface(&ddsd2, &pZBuffer, 0) ) | |
1456 { | |
1457 if ( !pBackBuffer->AddAttachedSurface(pZBuffer) ) | |
1458 { | |
1459 if ( !pDirect3D->CreateDevice(*pAvailableDevices[uDeviceID].pGUID, | |
1460 pBackBuffer, | |
1461 &pDevice, | |
1462 0) ) | |
1463 { | |
1464 memset(&d3dvp2, 0, sizeof(D3DVIEWPORT2)); | |
1465 d3dvp2.dvClipWidth = 2.0; | |
1466 d3dvp2.dvClipY = 1.0; | |
1467 d3dvp2.dvClipHeight = 2.0; | |
1468 d3dvp2.dvMaxZ = 1.0; | |
1469 d3dvp2.dvMinZ = 0.0; | |
1470 goto LABEL_54; | |
1471 } | |
1472 LABEL_51: | |
1473 sprintf(pErrorMessage, "Init - Failed to create D3D device.\n"); | |
1474 if (pDirect3D) | |
1475 { | |
1476 pDirect3D->Release(); | |
1477 pDirect3D = 0; | |
1478 } | |
1479 goto LABEL_59; | |
1480 } | |
1481 LABEL_48: | |
1482 sprintf(pErrorMessage, "Init - Failed to attach z-buffer to back buffer.\n"); | |
1483 if (pZBuffer) | |
1484 { | |
1485 pZBuffer->Release(); | |
1486 pZBuffer = 0; | |
1487 } | |
1488 goto LABEL_61; | |
1489 } | |
1490 goto LABEL_44; | |
1491 } | |
1492 LABEL_36: | |
1493 v23 = "Init - Failed to create front buffer.\n"; | |
1494 sprintf(pErrorMessage, v23); | |
1495 goto LABEL_65; | |
1496 } | |
1497 if ( uDeviceID == 1 ) | |
1498 v26 = 1045; | |
1499 else | |
1500 v26 = 1041; | |
1501 if (pHost->SetCooperativeLevel(hWnd, v26) ) | |
1502 { | |
1503 v23 = "Init - Failed to set cooperative level.\n"; | |
1504 sprintf(pErrorMessage, v23); | |
1505 goto LABEL_65; | |
1506 } | |
1507 if (pHost->SetDisplayMode(640u, 480u, 16u, 0, 0) ) | |
1508 { | |
1509 v23 = "Init - Failed to set display mode.\n"; | |
1510 sprintf(pErrorMessage, v23); | |
1511 goto LABEL_65; | |
1512 } | |
1513 | |
1514 memset(&ddsd2, 0, sizeof(DDSURFACEDESC2)); | |
1515 ddsd2.dwSize = sizeof(DDSURFACEDESC2); | |
1516 ddsd2.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; | |
1517 ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; | |
1518 ddsd2.dwBackBufferCount = 1; | |
1519 if ( pHost->CreateSurface(&ddsd2, &pFrontBuffer, 0) ) | |
1520 goto LABEL_36; | |
1521 //a3a = &pBackBuffer; | |
1522 //v14 = *v34; | |
1523 memset(&v27, 0, sizeof(DDSCAPS2)); | |
1524 v27.dwCaps = DDSCAPS_BACKBUFFER; | |
1525 //v33 = (IDirect3DDevice3 **)v14->GetAttachedSurface(&v27, &pBackBuffer); | |
1526 //hWnda = &pDirect3D; | |
1527 pHost->QueryInterface(IID_IDirect3D3, (LPVOID *)&pDirect3D); | |
1528 if (FAILED(pFrontBuffer->GetAttachedSurface(&v27, &pBackBuffer))) | |
1529 { | |
1530 v25 = "Init - Failed to get D3D interface.\n"; | |
1531 goto LABEL_45; | |
1532 } | |
1533 | |
1534 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; | |
1535 ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; | |
1536 ddsd2.dwWidth = 640; | |
1537 ddsd2.dwHeight = 480; | |
1538 if ( pDirect3D->EnumZBufferFormats(*pAvailableDevices[uDeviceID].pGUID, | |
1539 (HRESULT (__stdcall *)(DDPIXELFORMAT *, void *))D3DZBufferFormatEnumerator, | |
1540 &ddsd2.ddpfPixelFormat) ) | |
1541 { | |
1542 LABEL_21: | |
1543 v25 = "Init - Failed to enumerate Z buffer formats.\n"; | |
1544 goto LABEL_45; | |
1545 } | |
1546 if ( uDeviceID == 2 || uDeviceID == 3 ) | |
1547 BYTE1(ddsd2.ddsCaps.dwCaps) |= 8u; | |
1548 //uDeviceIDa = &pZBuffer; | |
1549 if (pHost->CreateSurface(&ddsd2, &pZBuffer, 0) ) | |
1550 { | |
1551 LABEL_44: | |
1552 v25 = "Init - Failed to create z-buffer.\n"; | |
1553 LABEL_45: | |
1554 sprintf(pErrorMessage, v25); | |
1555 if (pBackBuffer) | |
1556 { | |
1557 pBackBuffer->Release(); | |
1558 pBackBuffer = 0; | |
1559 } | |
1560 LABEL_63: | |
1561 //v19 = &pFrontBuffer; | |
1562 if (pFrontBuffer) | |
1563 { | |
1564 pFrontBuffer->Release(); | |
1565 pFrontBuffer= 0; | |
1566 } | |
1567 goto LABEL_65; | |
1568 } | |
1569 if (pBackBuffer->AddAttachedSurface(pZBuffer)) | |
1570 goto LABEL_48; | |
1571 //v33 = &pDevice; | |
1572 if (pDirect3D->CreateDevice(*pAvailableDevices[uDeviceID].pGUID, | |
1573 pBackBuffer, | |
1574 &pDevice, | |
1575 0) ) | |
1576 goto LABEL_51; | |
1577 memset(&d3dvp2, 0, sizeof(D3DVIEWPORT2)); | |
1578 d3dvp2.dvClipWidth = 2.0; | |
1579 d3dvp2.dvClipY = 1.0; | |
1580 d3dvp2.dvClipHeight = 2.0; | |
1581 d3dvp2.dvMaxZ = 1.0; | |
1582 | |
1583 LABEL_54: | |
1584 d3dvp2.dwSize = sizeof(D3DVIEWPORT2); | |
1585 //v17 = *hWnda; | |
1586 d3dvp2.dwWidth = 640; | |
1587 d3dvp2.dwHeight = 480; | |
1588 d3dvp2.dvClipX = -1.0; | |
1589 //v18 = v17->lpVtbl; | |
1590 //v32 = &v4->pViewport; | |
1591 if (pDirect3D->CreateViewport(&pViewport, 0)) | |
1592 { | |
1593 sprintf(pErrorMessage, "Init - Failed to create viewport.\n"); | |
1594 if (pDevice) | |
1595 { | |
1596 pDevice->Release(); | |
1597 pDevice = 0; | |
1598 } | |
1599 if (pDirect3D) | |
1600 { | |
1601 pDirect3D->Release(); | |
1602 pDirect3D = 0; | |
1603 } | |
1604 LABEL_59: | |
1605 if (pZBuffer) | |
1606 { | |
1607 pZBuffer->Release(); | |
1608 pZBuffer = 0; | |
1609 } | |
1610 LABEL_61: | |
1611 if (pBackBuffer) | |
1612 { | |
1613 pBackBuffer->Release(); | |
1614 pBackBuffer = 0; | |
1615 } | |
1616 goto LABEL_63; | |
1617 } | |
1618 | |
1619 pDevice->AddViewport(pViewport); | |
1620 pViewport->SetViewport2(&d3dvp2); | |
1621 pDevice->SetCurrentViewport(pViewport); | |
1622 return 1; | |
1623 } | |
1624 | |
1625 //----- (0049E444) -------------------------------------------------------- | |
1626 unsigned int RenderD3D::GetDeviceCaps() | |
1627 { | |
1628 unsigned int v1; // ebx@1 | |
1629 RenderD3D *v2; // edi@1 | |
1630 IDirect3DDevice3 *v3; // eax@1 | |
1631 unsigned int result; // eax@2 | |
1632 D3DDEVICEDESC refCaps; // [sp+Ch] [bp-1F8h]@1 | |
1633 D3DDEVICEDESC halCaps; // [sp+108h] [bp-FCh]@1 | |
1634 | |
1635 v1 = 0; | |
1636 v2 = this; | |
1637 memset(&halCaps, 0, 0xFCu); | |
1638 halCaps.dwSize = 252; | |
1639 memset(&refCaps, 0, 0xFCu); | |
1640 v3 = v2->pDevice; | |
1641 refCaps.dwSize = 252; | |
1642 if ( v3->GetCaps(&halCaps, &refCaps) ) | |
1643 { | |
1644 result = 1; | |
1645 } | |
1646 else | |
1647 { | |
1648 if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 0x10) ) | |
1649 v1 = 2; | |
1650 if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 2) ) | |
1651 v1 |= 4u; | |
1652 if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 1) ) | |
1653 v1 |= 8u; | |
1654 if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 0x20) ) | |
1655 v1 |= 0x10u; | |
1656 if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 2) ) | |
1657 v1 |= 0x20u; | |
1658 if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 4) ) | |
1659 v1 |= 0x40u; | |
1660 if ( halCaps.dpcTriCaps.dwTextureCaps & 0x20 ) | |
1661 LOBYTE(v1) = v1 | 0x80; | |
1662 result = v1; | |
1663 } | |
1664 return result; | |
1665 } | |
1666 | |
1667 //----- (0049E4FC) -------------------------------------------------------- | |
1668 void RenderD3D::ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear) | |
1669 { | |
1670 uint uClearFlags = 0; | |
1671 | |
1672 if (bClearColor) | |
1673 uClearFlags |= D3DCLEAR_TARGET; | |
1674 if (bClearDepth) | |
1675 uClearFlags |= D3DCLEAR_ZBUFFER; | |
1676 | |
1677 D3DRECT rects[] = {{0, 0, 640, 480}}; | |
1678 if (uClearFlags) | |
1679 pViewport->Clear2(1, rects, uClearFlags, uClearColor, z_clear, 0); | |
1680 } | |
1681 | |
1682 //----- (0049E54D) -------------------------------------------------------- | |
1683 void RenderD3D::Present(bool bForceBlit) | |
1684 { | |
1685 RECT v5; // [sp+18h] [bp-18h]@1 | |
1686 struct tagPOINT Point; // [sp+28h] [bp-8h]@4 | |
1687 | |
1688 v5.left = 0; | |
1689 v5.top = 0; | |
1690 v5.bottom = 480; | |
1691 v5.right = 640; | |
1692 | |
1693 if (bWindowed || bForceBlit) | |
1694 { | |
1695 RECT rc; | |
1696 GetClientRect(hWindow, &rc); | |
1697 Point.y = 0; | |
1698 Point.x = 0; | |
1699 ClientToScreen(hWindow, &Point); | |
1700 OffsetRect(&rc, Point.x, Point.y); | |
1701 pFrontBuffer->Blt(&rc, pBackBuffer, &v5, DDBLT_WAIT, 0); | |
1702 } | |
1703 else | |
1704 pFrontBuffer->Flip(0, 1); | |
1705 } | |
1706 | |
1707 //----- (0049E5D4) -------------------------------------------------------- | |
1708 bool RenderD3D::CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim) | |
1709 { | |
1710 unsigned int v8; // edx@4 | |
1711 unsigned int v9; // ebx@5 | |
1712 unsigned int v10; // eax@5 | |
1713 DWORD v11; // edx@5 | |
1714 //int v12; // edx@7 | |
1715 DDSURFACEDESC2 ddsd2; // [sp+Ch] [bp-80h]@1 | |
1716 //RenderD3D *v15; // [sp+88h] [bp-4h]@1 | |
1717 | |
1718 //v15 = this; | |
1719 memset(&ddsd2, 0, 0x7Cu); | |
1720 ddsd2.dwSize = 0x7Cu; | |
1721 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; | |
1722 ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE; | |
1723 ddsd2.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE; | |
1724 ddsd2.dwHeight = uTextureHeight; | |
1725 ddsd2.dwWidth = uTextureWidth; | |
1726 if ( bMipmaps ) | |
1727 { | |
1728 if ( (signed int)uTextureHeight <= (signed int)uTextureWidth ) | |
1729 { | |
1730 v8 = GetMaxMipLevels(uTextureHeight) - GetMaxMipLevels(uMinDeviceTexDim); | |
1731 LABEL_8: | |
1732 ddsd2.dwMipMapCount = v8; | |
1733 if ( !v8 ) | |
1734 goto LABEL_12; | |
1735 goto LABEL_11; | |
1736 } | |
1737 if ( (signed int)uTextureWidth < (signed int)uMinDeviceTexDim ) | |
1738 { | |
1739 v8 = GetMaxMipLevels(uMinDeviceTexDim); | |
1740 goto LABEL_8; | |
1741 } | |
1742 v9 = GetMaxMipLevels(uTextureWidth); | |
1743 v10 = GetMaxMipLevels(uMinDeviceTexDim); | |
1744 ddsd2.dwMipMapCount = v9 - v10; | |
1745 if ( v9 == v10 ) | |
1746 { | |
1747 ddsd2.dwFlags = 0x1007u; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
1748 __debugbreak(); // warning C4700: uninitialized local variable 'v11' used |
0 | 1749 ddsd2.ddsCaps.dwCaps = v11; |
1750 goto LABEL_12; | |
1751 } | |
1752 } | |
1753 else | |
1754 { | |
1755 ddsd2.dwMipMapCount = 1; | |
1756 } | |
1757 LABEL_11: | |
1758 ddsd2.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_MIPMAPCOUNT; | |
1759 ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP; | |
1760 LABEL_12: | |
1761 ddsd2.ddpfPixelFormat.dwRGBBitCount = 16; | |
1762 ddsd2.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); | |
1763 if (bAlphaChannel) | |
1764 { | |
1765 ddsd2.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; | |
1766 ddsd2.ddpfPixelFormat.dwRBitMask = 0x7C00; | |
1767 ddsd2.ddpfPixelFormat.dwGBitMask = 0x03E0; | |
1768 ddsd2.ddpfPixelFormat.dwBBitMask = 0x001F; | |
1769 ddsd2.ddpfPixelFormat.dwRGBAlphaBitMask = 0x8000u; | |
1770 } | |
1771 else | |
1772 { | |
1773 ddsd2.ddpfPixelFormat.dwFlags = DDPF_RGB; | |
1774 ddsd2.ddpfPixelFormat.dwRBitMask = 0xF800; | |
1775 ddsd2.ddpfPixelFormat.dwGBitMask = 0x07E0; | |
1776 ddsd2.ddpfPixelFormat.dwBBitMask = 0x001F; | |
1777 ddsd2.ddpfPixelFormat.dwRGBAlphaBitMask = 0; | |
1778 } | |
1779 if (FAILED(pHost->CreateSurface(&ddsd2, pOutSurface, 0))) | |
1780 return false; | |
1781 if (FAILED((*pOutSurface)->QueryInterface(IID_IDirect3DTexture2, (void **)pOutTexture))) | |
1782 { | |
1783 (*pOutSurface)->Release(); | |
1784 *pOutSurface = 0; | |
1785 return false; | |
1786 } | |
1787 return true; | |
1788 } | |
1789 | |
1790 //----- (004A5190) -------------------------------------------------------- | |
1791 void RenderD3D::HandleLostResources() | |
1792 { | |
1793 pBitmaps_LOD->ReleaseLostHardwareTextures(); | |
1794 pBitmaps_LOD->_410423_move_textures_to_device(); | |
1795 pSprites_LOD->ReleaseLostHardwareSprites(); | |
1796 } | |
1797 | |
1798 //----- (004A2050) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
1799 void Render::DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture) |
0 | 1800 { |
1801 Render *v5; // edi@1 | |
1802 unsigned int v6; // ebx@1 | |
1803 LightmapBuilder *v7; // esi@3 | |
1804 int v8; // eax@7 | |
1805 ODMFace *v9; // eax@12 | |
1806 char *v10; // esi@12 | |
1807 double v11; // st7@14 | |
1808 double v12; // st7@14 | |
1809 int v13; // eax@14 | |
1810 ODMFace *v14; // ecx@14 | |
1811 double v15; // st7@14 | |
1812 float v16; // ST48_4@15 | |
1813 int v17; // eax@15 | |
1814 char v18; // zf@17 | |
1815 HRESULT v19; // eax@18 | |
1816 HRESULT v20; // eax@18 | |
1817 HRESULT v21; // eax@20 | |
1818 HRESULT v22; // eax@20 | |
1819 unsigned int v23; // ecx@20 | |
1820 char *v24; // eax@21 | |
1821 HRESULT v25; // eax@23 | |
1822 HRESULT v26; // eax@23 | |
1823 HRESULT v27; // eax@24 | |
1824 HRESULT v28; // eax@25 | |
1825 HRESULT v29; // eax@25 | |
1826 HRESULT v30; // eax@25 | |
1827 HRESULT v31; // eax@25 | |
1828 HRESULT v32; // eax@26 | |
1829 unsigned int v33; // ecx@26 | |
1830 char *v34; // eax@27 | |
1831 int v35; // edx@28 | |
1832 HRESULT v36; // eax@29 | |
1833 HRESULT v37; // eax@29 | |
1834 HRESULT v38; // eax@29 | |
1835 HRESULT v39; // eax@29 | |
1836 //IDirect3DDevice3Vtbl *v40; // ebx@29 | |
1837 unsigned int v41; // eax@29 | |
1838 HRESULT v42; // eax@30 | |
1839 HRESULT v43; // eax@30 | |
1840 HRESULT v44; // eax@30 | |
1841 char *v45; // esi@34 | |
1842 int v46; // ecx@35 | |
1843 double v47; // st6@35 | |
1844 int v48; // eax@36 | |
1845 const char *v49; // [sp+4Ch] [bp-1Ch]@0 | |
1846 const char *v50; // [sp+4Ch] [bp-1Ch]@20 | |
1847 int v51; // [sp+50h] [bp-18h]@0 | |
1848 unsigned int v52; // [sp+54h] [bp-14h]@0 | |
1849 LightmapBuilder *v53; // [sp+58h] [bp-10h]@3 | |
1850 unsigned int v54; // [sp+5Ch] [bp-Ch]@3 | |
1851 unsigned int v55; // [sp+5Ch] [bp-Ch]@34 | |
1852 unsigned int v56; // [sp+60h] [bp-8h]@12 | |
1853 int v57; // [sp+60h] [bp-8h]@34 | |
638 | 1854 unsigned int a2; // [sp+64h] [bp-4h]@4 |
0 | 1855 |
1856 v5 = this; | |
1857 v6 = 0; | |
1858 if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 ) | |
1859 { | |
1860 v7 = pGame->pLightmapBuilder; | |
1861 v53 = v7; | |
1862 v54 = v7->std__vector_000004_size; | |
1863 if ( v7->std__vector_000004_size) | |
638 | 1864 a2 = 0xFFFFFFFF; |
1865 pGame->AlterGamma_ODM(a4, &a2); | |
1394 | 1866 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) |
0 | 1867 { |
638 | 1868 v8 = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); |
1394 | 1869 v7->DrawLightmaps(/*v8, 0*/); |
0 | 1870 } |
1871 else | |
1872 { | |
1873 if ( !v54 || byte_4D864C && pGame->uFlags & 2 ) | |
1874 { | |
323 | 1875 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 1876 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
1877 if (bUsingSpecular) | |
1878 { | |
186 | 1879 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
1880 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
1881 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 1882 } |
1073 | 1883 for (uint i = 0; i < uNumVertices; ++i) |
1884 { | |
1885 | |
1886 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
1887 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
1637 | 1888 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); |
1073 | 1889 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); |
1890 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
1891 pGame->AlterGamma_ODM(a4, &d3d_vertex_buffer[i].diffuse); | |
1892 | |
1893 if ( this->bUsingSpecular ) | |
0 | 1894 { |
1073 | 1895 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 1896 } |
1073 | 1897 else |
1898 { | |
1899 d3d_vertex_buffer[i].specular = 0; | |
1900 } | |
1901 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
1902 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
1903 | |
1904 } | |
323 | 1905 |
1906 if (a4->uAttributes & FACE_OUTLINED) | |
1907 { | |
1908 int color; | |
1909 if (GetTickCount() % 300 >= 150) | |
1910 color = 0xFFFF2020; | |
1911 else color = 0xFF901010; | |
1912 | |
1913 for (uint i = 0; i < uNumVertices; ++i) | |
1914 d3d_vertex_buffer[i].diffuse = color; | |
1915 } | |
1916 | |
0 | 1917 pRenderD3D->pDevice->SetTexture(0, pTexture); |
1918 pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
1919 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1920 d3d_vertex_buffer, |
0 | 1921 uNumVertices, |
1922 D3DDP_DONOTLIGHT); | |
1923 } | |
1924 else | |
1925 { | |
1073 | 1926 for (uint i = 0; i < uNumVertices; ++i) |
1927 { | |
1928 | |
1929 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
1930 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
1637 | 1931 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); |
1073 | 1932 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); |
1933 d3d_vertex_buffer[i].diffuse = GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
1934 if ( this->bUsingSpecular ) | |
0 | 1935 { |
1073 | 1936 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 1937 } |
1073 | 1938 else |
1939 { | |
1940 d3d_vertex_buffer[i].specular = 0; | |
1941 } | |
1942 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
1943 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
1944 | |
1945 } | |
1946 | |
186 | 1947 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
1948 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
0 | 1949 if (bUsingSpecular) |
186 | 1950 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
0 | 1951 |
1952 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | |
1953 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
1954 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1955 d3d_vertex_buffer, |
0 | 1956 uNumVertices, |
1957 D3DDP_DONOTLIGHT)); | |
1958 //v50 = (const char *)v5->pRenderD3D->pDevice; | |
1959 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
1960 //(*(void (**)(void))(*(int *)v50 + 88))(); | |
1394 | 1961 v53->DrawLightmaps(/*-1, 0*/); |
1073 | 1962 for (uint i = 0; i < uNumVertices; ++i) |
1963 { | |
1964 d3d_vertex_buffer[i].diffuse = a2; | |
1965 } | |
0 | 1966 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); |
186 | 1967 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 1968 if ( !pRenderer->bUsingSpecular ) |
186 | 1969 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
1970 | |
1971 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
1972 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
1973 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
0 | 1974 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
1975 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1976 d3d_vertex_buffer, |
0 | 1977 uNumVertices, |
1978 D3DDP_DONOTLIGHT)); | |
1979 if (bUsingSpecular) | |
1980 { | |
186 | 1981 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
0 | 1982 |
1073 | 1983 for (uint i = 0; i < uNumVertices; ++i) |
1984 { | |
1985 d3d_vertex_buffer[i].diffuse = pRenderer->uFogColor | d3d_vertex_buffer[i].specular & 0xFF000000; | |
1986 d3d_vertex_buffer[i].specular = 0; | |
1987 } | |
1988 | |
0 | 1989 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
186 | 1990 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
1991 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); | |
0 | 1992 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
1993 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1994 d3d_vertex_buffer, |
0 | 1995 uNumVertices, |
1996 D3DDP_DONOTLIGHT)); | |
186 | 1997 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 1998 //v40 = pRenderer->pRenderD3D->pDevice->lpVtbl; |
1999 v41 = GetLevelFogColor(); | |
2000 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF); | |
2001 v6 = 0; | |
2002 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); | |
2003 } | |
186 | 2004 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
2005 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 2006 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v6)); |
2007 } | |
2008 } | |
2009 } | |
2010 } | |
2011 // 4D864C: using guessed type char byte_4D864C; | |
2012 | |
2013 //----- (0049EB79) -------------------------------------------------------- | |
2014 Render::~Render() | |
2015 { | |
2016 Render *v1; // esi@1 | |
2017 | |
2018 v1 = this; | |
1583 | 2019 free(this->pDefaultZBuffer); |
0 | 2020 v1->pD3DBitmaps.Release(); |
2021 v1->pD3DSprites.Release(); | |
2022 Release(); | |
2023 v1->bWindowMode = 1; | |
2024 //nullsub_1(); | |
2025 //nullsub_1(); | |
2026 } | |
2027 | |
2028 //----- (0049E756) -------------------------------------------------------- | |
2029 bool Render::IsColorKeySupported(IDirectDraw4 *this_) | |
2030 { | |
2031 DDCAPS refCaps; // [sp+0h] [bp-2F8h]@1 | |
2032 DDCAPS halCaps; // [sp+17Ch] [bp-17Ch]@1 | |
2033 | |
2034 halCaps.dwSize = 380; | |
2035 refCaps.dwSize = 380; | |
2036 this_->GetCaps(&halCaps, &refCaps); | |
2037 return halCaps.dwSVBCaps & 0x40 && BYTE1(halCaps.dwSVBCKeyCaps) & 2; | |
2038 } | |
2039 | |
2040 //----- (0049E992) -------------------------------------------------------- | |
2041 Render::Render() | |
2042 { | |
2043 Render *v1; // esi@1 | |
2044 int v2; // eax@1 | |
2045 char v3; // zf@1 | |
2046 | |
2047 v1 = this; | |
2048 this->pDirectDraw4 = 0; | |
2049 this->pFrontBuffer4 = 0; | |
2050 this->pBackBuffer4 = 0; | |
2051 this->pColorKeySurface4 = 0; | |
2052 this->pDirectDraw2 = 0; | |
2053 this->pFrontBuffer2 = 0; | |
2054 this->pBackBuffer2 = 0; | |
2055 this->pSomeSurface2 = 0; | |
2056 //RenderHWLContainer::RenderHWLContainer(&this->pD3DBitmaps); | |
2057 //RenderHWLContainer::RenderHWLContainer(&v1->pD3DSprites); | |
2058 v1->bWindowMode = 1; | |
2059 v1->field_40054 = 0; | |
2060 v1->field_10 = 640; | |
2061 v1->field_14 = 480; | |
2062 v1->field_40030 = 0; | |
2063 v1->field_4002C = 0; | |
2064 v1->pActiveZBuffer = 0; | |
2065 v1->pDefaultZBuffer = 0; | |
709 | 2066 v1->raster_clip_y = 0; |
2067 v1->raster_clip_x = 0; | |
2068 v1->raster_clip_z = 639; | |
2069 v1->raster_clip_w = 479; | |
0 | 2070 v1->field_4003C = (int)&unk_4EED80; |
2071 v1->field_40040 = dword_4EED78; | |
2072 v1->uClipZ = 640; | |
2073 v1->field_40044 = 2; | |
2074 v1->field_40048 = 6; | |
2075 v1->pFrontBuffer4 = 0; | |
2076 v1->pBackBuffer4 = 0; | |
2077 v1->pColorKeySurface4 = 0; | |
2078 v1->pDirectDraw4 = 0; | |
2079 v1->pRenderD3D = 0; | |
2080 v1->uNumSceneBegins = 0; | |
2081 v1->uNumD3DSceneBegins = 0; | |
2082 v1->field_40110 = 0; | |
2083 v1->pTargetSurface = 0; | |
2084 v1->uTargetSurfacePitch = 0; | |
2085 v1->uClipY = 0; | |
2086 v1->uClipX = 0; | |
2087 v1->uClipW = 480; | |
2088 v1->bClip = 1; | |
2089 v1->bColorKeySupported = 0; | |
2090 v1->bRequiredTextureStagesAvailable = 0; | |
2091 v1->bTinting = 1; | |
2092 LOBYTE(v1->field_103668) = 0; | |
2093 v1->field_1036B8 = 0; | |
2094 v1->_gpu_memory_used = 0; | |
2095 uNumBillboardsToDraw = 0; | |
2096 bFogEnabled = false; | |
265 | 2097 |
2098 hd_water_tile_id = -1; | |
2099 hd_water_current_frame = 0; | |
0 | 2100 } |
2101 | |
1512 | 2102 bool Render::Initialize(bool bWindowed, uint32_t uDefaultDevice, bool bColoredLights, uint32_t uDetailLevel, bool bTinting) |
0 | 2103 { |
2104 bUserDirect3D = true;//ReadWindowsRegistryInt("Use D3D", 0); | |
2105 bStartInWindow = bWindowed; | |
2106 | |
2107 uDesiredDirect3DDevice = uDefaultDevice;//ReadWindowsRegistryInt("D3D Device", 1); | |
2108 | |
2109 bUseColoredLights = bColoredLights;//ReadWindowsRegistryInt("Colored Lights", 0); | |
2110 uLevelOfDetail = uDetailLevel;//ReadWindowsRegistryInt("Detail Level", 1); | |
2111 | |
2112 this->bTinting = bTinting; | |
2113 | |
2114 auto r1 = pD3DBitmaps.Load(L"data\\d3dbitmap.hwl"); | |
2115 auto r2 = pD3DSprites.Load(L"data\\d3dsprite.hwl"); | |
2116 | |
2117 return r1 && r2; | |
2118 } | |
2119 | |
2120 //----- (0049EBF1) -------------------------------------------------------- | |
2121 void Render::_49EBF1() | |
2122 { | |
2123 signed int uNumRedBits; // edx@1 | |
2124 signed int uNuGreenBits; // edi@1 | |
2125 signed int uNumBlueBits; // esi@1 | |
2126 unsigned int v4; // edx@4 | |
2127 unsigned int v5; // edi@4 | |
2128 int v6; // ebx@4 | |
2129 int v7; // edx@4 | |
2130 signed int v8; // [sp+8h] [bp-24h]@1 | |
2131 signed int v9; // [sp+Ch] [bp-20h]@1 | |
2132 signed int v10; // [sp+20h] [bp-Ch]@1 | |
2133 signed int i; // [sp+24h] [bp-8h]@2 | |
2134 signed int v12; // [sp+28h] [bp-4h]@3 | |
2135 | |
2136 v10 = 0; | |
2137 uNumRedBits = 1 << this->uTargetRBits; | |
2138 uNuGreenBits = 1 << this->uTargetGBits; | |
2139 uNumBlueBits = 1 << this->uTargetBBits; | |
2140 v9 = 1 << this->uTargetRBits; | |
2141 v8 = 1 << this->uTargetGBits; | |
2142 if ( uNumRedBits > 0 ) | |
2143 { | |
2144 do | |
2145 { | |
2146 for ( i = 0; i < uNuGreenBits; ++i ) | |
2147 { | |
2148 v12 = 0; | |
2149 if ( uNumBlueBits > 0 ) | |
2150 { | |
2151 do | |
2152 { | |
2153 v4 = this->uTargetBBits; | |
2154 v5 = v4 + this->uTargetGBits; | |
2155 v6 = (v12 >> 1) + (v10 >> 1 << v5) + (i >> 1 << this->uTargetBBits); | |
2156 v7 = (v10 << v5) + v12++ + (i << v4); | |
2157 this->field_2C[v7] = v6; | |
2158 } | |
2159 while ( v12 < uNumBlueBits ); | |
2160 uNumRedBits = v9; | |
2161 uNuGreenBits = v8; | |
2162 } | |
2163 } | |
2164 ++v10; | |
2165 } | |
2166 while ( v10 < uNumRedBits ); | |
2167 } | |
2168 } | |
2169 | |
2170 //----- (0049ECC4) -------------------------------------------------------- | |
2171 void Render::ClearBlack() | |
2172 { | |
2173 if (pRenderD3D) | |
2174 { | |
2175 if (field_40110) | |
2176 pRenderD3D->ClearTarget(true, 0, false, 0.0); | |
2177 } | |
2178 else | |
2179 memset(pRenderer->pTargetSurface, 0, 4 * (field_10 * field_14 / 2)); | |
2180 } | |
2181 | |
2182 //----- (0049ED18) -------------------------------------------------------- | |
2183 void Render::PresentBlackScreen() | |
2184 { | |
2185 LONG w; // edx@3 | |
2186 IDirectDrawSurface *v2; // eax@3 | |
2187 DDBLTFX v3; // [sp+4h] [bp-74h]@5 | |
2188 RECT x; // [sp+68h] [bp-10h]@3 | |
2189 | |
2190 memset(&v3, 0, sizeof(DDBLTFX)); | |
2191 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || | |
2192 pVersion->pVersionInfo.dwMajorVersion >= 5) | |
2193 { | |
2194 x.left = uWindowX; | |
2195 x.right = uWindowX + uWindowHeight; | |
2196 x.top = uWindowY; | |
2197 w = uWindowY + uWindowWidth; | |
2198 v2 = (IDirectDrawSurface *)this->pBackBuffer4; | |
2199 } | |
2200 else | |
2201 { | |
2202 x.left = uWindowX; | |
2203 x.right = uWindowX + uWindowHeight; | |
2204 x.top = uWindowY; | |
2205 w = uWindowY + uWindowWidth; | |
2206 v2 = (IDirectDrawSurface *)this->pBackBuffer2; | |
2207 } | |
2208 x.bottom = w; | |
2209 v3.dwFillColor = 0; | |
2210 v3.dwSize = 100; | |
2211 v2->Blt(&x, 0, 0, DDBLT_COLORFILL, &v3); | |
2212 pRenderer->Present(); | |
2213 } | |
2214 | |
2215 //----- (0049EDB6) -------------------------------------------------------- | |
2216 void Render::SavePCXScreenshot() | |
2217 { | |
2218 Render *v1; // esi@1 | |
2219 __int16 v2; // di@1 | |
2220 int v3; // eax@4 | |
2221 int v4; // ecx@4 | |
2222 int v5; // eax@8 | |
2223 FILE *v6; // edi@10 | |
2224 int v7; // ecx@11 | |
2225 int v8; // eax@11 | |
2226 int v9; // eax@13 | |
2227 int v10; // ecx@15 | |
2228 unsigned __int8 v11; // dl@15 | |
2229 signed int v12; // eax@18 | |
2230 char v13; // zf@27 | |
2231 HRESULT v14; // eax@29 | |
2232 char v15[56]; // [sp+Ch] [bp-158h]@10 | |
2233 __int16 v16; // [sp+44h] [bp-120h]@10 | |
2234 DDSURFACEDESC2 Dst; // [sp+48h] [bp-11Ch]@7 | |
2235 char color_map[48]; // [sp+C4h] [bp-A0h]@10 | |
2236 char Filename[40]; // [sp+F4h] [bp-70h]@3 | |
2237 char *v20; // [sp+11Ch] [bp-48h]@14 | |
2238 char *v21; // [sp+120h] [bp-44h]@14 | |
2239 int v24; // [sp+124h] [bp-40h]@11 | |
2240 FILE *File; // [sp+128h] [bp-3Ch]@3 | |
2241 int var38; // [sp+12Ch] [bp-38h]@4 | |
2242 PCXHeader_1 header1; // [sp+130h] [bp-34h]@10 | |
2243 PCXHeader_2 header2; // [sp+140h] [bp-24h]@10 | |
2244 void *ptr; // [sp+148h] [bp-1Ch]@10 | |
2245 void *v28; // [sp+14Ch] [bp-18h]@8 | |
2246 int v29; // [sp+150h] [bp-14h]@4 | |
2247 int v30; // [sp+154h] [bp-10h]@4 | |
2248 char v31; // [sp+15Ah] [bp-Ah]@25 | |
2249 unsigned __int8 v32; // [sp+15Bh] [bp-9h]@17 | |
2250 int i; // [sp+15Ch] [bp-8h]@10 | |
2251 unsigned __int8 v34; // [sp+163h] [bp-1h]@17 | |
2252 | |
2253 v1 = this; | |
2254 v2 = 0; | |
2255 if ( !this->pRenderD3D || this->field_40110 ) | |
2256 { | |
2257 sprintf(Filename, "screen%0.2i.pcx", dword_4EFA80++ % 100); | |
2258 File = fopen(Filename, "wb"); | |
2259 if ( File ) | |
2260 { | |
2261 v3 = v1->field_10; | |
2262 v4 = v1->field_14; | |
2263 var38 = v3; | |
2264 v29 = v4; | |
2265 v30 = v3; | |
2266 if ( v3 & 1 ) | |
2267 v30 = v3 + 1; | |
2268 if ( v1->pRenderD3D ) | |
2269 { | |
2270 memset(&Dst, 0, 0x7Cu); | |
2271 Dst.dwSize = 124; | |
168 | 2272 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 2273 return; |
2274 v28 = Dst.lpSurface; | |
2275 v5 = Dst.lPitch >> 1; | |
2276 v2 = 0; | |
2277 } | |
2278 else | |
2279 { | |
2280 pRenderer->BeginScene(); | |
2281 v28 = pRenderer->pTargetSurface; | |
2282 v5 = pRenderer->uTargetSurfacePitch; | |
2283 } | |
2284 i = v5; | |
2285 header1.right = var38 - 1; | |
2286 header1.left = v2; | |
2287 header1.bottom = v29 - 1; | |
2288 header1.up = v2; | |
2289 header2.pitch = v30; | |
2290 memset(color_map, 0, sizeof(color_map)); | |
2291 memset(v15, 0, sizeof(v15)); | |
2292 header2.reserved = 0; | |
2293 header1.manufacturer = 10; | |
2294 v16 = 0; | |
2295 v6 = File; | |
2296 header1.version = 5; | |
2297 header1.encoding = 1; | |
2298 header1.bpp = 8; | |
2299 header1.hdpi = 75; | |
2300 header1.vdpi = 75; | |
2301 header2.planes = 3; | |
2302 header2.palette_info = 1; | |
2303 fwrite(&header1, 1u, 1u, File); | |
2304 fwrite(&header1.version, 1u, 1u, v6); | |
2305 fwrite(&header1.encoding, 1u, 1u, v6); | |
2306 fwrite(&header1.bpp, 1u, 1u, v6); | |
2307 fwrite(&header1.left, 2u, 1u, v6); | |
2308 fwrite(&header1.up, 2u, 1u, v6); | |
2309 fwrite(&header1.right, 2u, 1u, v6); | |
2310 fwrite(&header1.bottom, 2u, 1u, v6); | |
2311 fwrite(&header1.hdpi, 2u, 1u, v6); | |
2312 fwrite(&header1.vdpi, 2u, 1u, v6); | |
2313 fwrite(color_map, 0x30u, 1u, v6); | |
2314 fwrite(&header2, 1u, 1u, v6); | |
2315 fwrite(&header2.planes, 1u, 1u, v6); | |
2316 fwrite(&header2.pitch, 2u, 1u, v6); | |
2317 fwrite(&header2.palette_info, 2u, 1u, v6); | |
2318 fwrite(v15, 0x3Au, 1u, v6); | |
1583 | 2319 ptr = malloc(3 * var38 + 6); |
0 | 2320 if ( v29 > 0 ) |
2321 { | |
2322 v7 = v30; | |
2323 File = (FILE *)v29; | |
2324 v29 = 3 * v30; | |
2325 v24 = 2 * i; | |
2326 v8 = (int)v28; | |
2327 while ( 1 ) | |
2328 { | |
2329 i = v8; | |
2330 v9 = 0; | |
2331 if ( var38 > 0 ) | |
2332 { | |
2333 v21 = (char *)ptr + v7; | |
2334 v20 = (char *)ptr + 2 * v30; | |
2335 do | |
2336 { | |
2337 *((char *)ptr + v9) = (signed int)(v1->uTargetRMask & *(short *)i) >> (LOBYTE(v1->uTargetGBits) | |
2338 + LOBYTE(v1->uTargetBBits) | |
2339 + v1->uTargetRBits | |
2340 - 8); | |
2341 v21[v9] = (signed int)(v1->uTargetGMask & *(short *)i) >> (LOBYTE(v1->uTargetBBits) | |
2342 + LOBYTE(v1->uTargetGBits) | |
2343 - 8); | |
2344 v10 = i; | |
2345 v11 = LOBYTE(v1->uTargetBMask); | |
2346 i += 2; | |
2347 v20[v9++] = (*(char *)v10 & v11) << (8 - LOBYTE(v1->uTargetBBits)); | |
2348 } | |
2349 while ( v9 < var38 ); | |
2350 } | |
2351 for ( i = 0; i < v29; i += v34 ) | |
2352 { | |
2353 v34 = 1; | |
2354 v32 = *((char *)ptr + i); | |
2355 do | |
2356 { | |
2357 v12 = i + v34; | |
2358 if ( *((char *)ptr + v12) != v32 ) | |
2359 break; | |
2360 if ( !(v12 % v30) ) | |
2361 break; | |
2362 ++v34; | |
2363 } | |
2364 while ( v34 < 0x3Fu ); | |
2365 if ( i + v34 > v29 ) | |
2366 v34 = 3 * v30 - i; | |
2367 if ( v34 > 1u || v32 >= 0xC0u ) | |
2368 { | |
2369 v31 = v34 | 0xC0; | |
2370 fwrite(&v31, 1u, 1u, v6); | |
2371 } | |
2372 fwrite(&v32, 1u, 1u, v6); | |
2373 } | |
2374 v8 = (int)((char *)v28 + v24); | |
2375 v13 = File == (FILE *)1; | |
2376 File = (FILE *)((char *)File - 1); | |
2377 v28 = (char *)v28 + v24; | |
2378 if ( v13 ) | |
2379 break; | |
2380 v7 = v30; | |
2381 } | |
2382 } | |
2383 if ( v1->pRenderD3D ) | |
2384 { | |
2385 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2386 } | |
2387 else | |
2388 { | |
2389 pRenderer->EndScene(); | |
2390 } | |
2391 | |
1583 | 2392 free(ptr); |
0 | 2393 fclose(v6); |
2394 } | |
2395 } | |
2396 } | |
2397 // 4EFA80: using guessed type int dword_4EFA80; | |
2398 | |
2399 //----- (0049F1BC) -------------------------------------------------------- | |
2400 void Render::_49F1BC(const char *a1) | |
2401 { | |
2402 Render *v2; // esi@1 | |
2403 __int16 v3; // di@1 | |
2404 int v4; // eax@4 | |
2405 char *v5; // ecx@4 | |
2406 unsigned int v6; // eax@8 | |
2407 FILE *v7; // edi@10 | |
2408 int v8; // ecx@11 | |
2409 int v9; // eax@11 | |
2410 int v10; // eax@13 | |
2411 const char *v11; // ecx@15 | |
2412 unsigned __int8 v12; // dl@15 | |
2413 signed int v13; // eax@18 | |
2414 char v14; // zf@27 | |
2415 HRESULT v15; // eax@29 | |
2416 char v16; // [sp+Ch] [bp-12Ch]@10 | |
2417 __int16 v17; // [sp+44h] [bp-F4h]@10 | |
2418 int Dst; // [sp+48h] [bp-F0h]@7 | |
2419 int v19; // [sp+58h] [bp-E0h]@8 | |
2420 unsigned __int16 *v20; // [sp+6Ch] [bp-CCh]@8 | |
2421 char v21; // [sp+C4h] [bp-74h]@10 | |
2422 unsigned int v22; // [sp+F4h] [bp-44h]@11 | |
2423 char *v23; // [sp+F8h] [bp-40h]@14 | |
2424 int v24; // [sp+FCh] [bp-3Ch]@11 | |
2425 int v25; // [sp+100h] [bp-38h]@4 | |
2426 FILE *File; // [sp+104h] [bp-34h]@3 | |
2427 char Str; // [sp+108h] [bp-30h]@10 | |
2428 char v28; // [sp+109h] [bp-2Fh]@10 | |
2429 char v29; // [sp+10Ah] [bp-2Eh]@10 | |
2430 char v30; // [sp+10Bh] [bp-2Dh]@10 | |
2431 __int16 v31; // [sp+10Ch] [bp-2Ch]@10 | |
2432 __int16 v32; // [sp+10Eh] [bp-2Ah]@10 | |
2433 __int16 v33; // [sp+110h] [bp-28h]@10 | |
2434 __int16 v34; // [sp+112h] [bp-26h]@10 | |
2435 __int16 v35; // [sp+114h] [bp-24h]@10 | |
2436 __int16 v36; // [sp+116h] [bp-22h]@10 | |
2437 char v37; // [sp+118h] [bp-20h]@10 | |
2438 char v38; // [sp+119h] [bp-1Fh]@10 | |
2439 __int16 v39; // [sp+11Ah] [bp-1Eh]@10 | |
2440 __int16 v40; // [sp+11Ch] [bp-1Ch]@10 | |
2441 void *ptr; // [sp+120h] [bp-18h]@10 | |
2442 unsigned __int16 *v42; // [sp+124h] [bp-14h]@8 | |
2443 int v43; // [sp+128h] [bp-10h]@4 | |
2444 char v44; // [sp+12Fh] [bp-9h]@25 | |
2445 char *i; // [sp+130h] [bp-8h]@10 | |
2446 unsigned __int8 v46; // [sp+137h] [bp-1h]@17 | |
2447 | |
2448 v2 = this; | |
2449 v3 = 0; | |
2450 if ( !this->pRenderD3D || this->field_40110 ) | |
2451 { | |
2452 ++dword_4EFA84; | |
2453 File = fopen(a1, "wb"); | |
2454 if ( File ) | |
2455 { | |
2456 v4 = v2->field_10; | |
2457 v5 = (char *)v2->field_14; | |
2458 v25 = v4; | |
2459 a1 = v5; | |
2460 v43 = v4; | |
2461 if ( v4 & 1 ) | |
2462 v43 = v4 + 1; | |
2463 if ( v2->pRenderD3D ) | |
2464 { | |
2465 memset(&Dst, 0, 0x7Cu); | |
2466 Dst = 124; | |
168 | 2467 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, (DDSURFACEDESC2 *)&Dst, DDLOCK_WAIT) ) |
0 | 2468 return; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
2469 __debugbreak(); // warning C4700: uninitialized local variable 'v20' used |
0 | 2470 v42 = v20; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
2471 __debugbreak(); // warning C4700: uninitialized local variable 'v19' used |
0 | 2472 v6 = v19 >> 1; |
2473 v3 = 0; | |
2474 } | |
2475 else | |
2476 { | |
2477 pRenderer->BeginScene(); | |
2478 v42 = pRenderer->pTargetSurface; | |
2479 v6 = pRenderer->uTargetSurfacePitch; | |
2480 } | |
2481 i = (char *)v6; | |
2482 v33 = v25 - 1; | |
2483 v31 = v3; | |
2484 v34 = (short)a1 - 1; | |
2485 v32 = v3; | |
2486 v39 = v43; | |
2487 memset(&v21, 0, 0x30u); | |
2488 memset(&v16, 0, 0x38u); | |
2489 v37 = 0; | |
2490 Str = 10; | |
2491 v17 = 0; | |
2492 v7 = File; | |
2493 v28 = 5; | |
2494 v29 = 1; | |
2495 v30 = 8; | |
2496 v35 = 75; | |
2497 v36 = 75; | |
2498 v38 = 3; | |
2499 v40 = 1; | |
2500 fwrite(&Str, 1u, 1u, File); | |
2501 fwrite(&v28, 1u, 1u, v7); | |
2502 fwrite(&v29, 1u, 1u, v7); | |
2503 fwrite(&v30, 1u, 1u, v7); | |
2504 fwrite(&v31, 2u, 1u, v7); | |
2505 fwrite(&v32, 2u, 1u, v7); | |
2506 fwrite(&v33, 2u, 1u, v7); | |
2507 fwrite(&v34, 2u, 1u, v7); | |
2508 fwrite(&v35, 2u, 1u, v7); | |
2509 fwrite(&v36, 2u, 1u, v7); | |
2510 fwrite(&v21, 0x30u, 1u, v7); | |
2511 fwrite(&v37, 1u, 1u, v7); | |
2512 fwrite(&v38, 1u, 1u, v7); | |
2513 fwrite(&v39, 2u, 1u, v7); | |
2514 fwrite(&v40, 2u, 1u, v7); | |
2515 fwrite(&v16, 0x3Au, 1u, v7); | |
1583 | 2516 ptr = malloc(3 * v25 + 6); |
0 | 2517 if ( (signed int)a1 > 0 ) |
2518 { | |
2519 v8 = v43; | |
2520 File = (FILE *)a1; | |
2521 v24 = 3 * v43; | |
2522 v22 = 2 * (int)i; | |
2523 v9 = (int)v42; | |
2524 while ( 1 ) | |
2525 { | |
2526 a1 = (const char *)v9; | |
2527 v10 = 0; | |
2528 if ( v25 > 0 ) | |
2529 { | |
2530 i = (char *)ptr + v8; | |
2531 v23 = (char *)ptr + 2 * v43; | |
2532 do | |
2533 { | |
2534 *((char *)ptr + v10) = (signed int)(v2->uTargetRMask & *(short *)a1) >> (LOBYTE(v2->uTargetGBits) | |
2535 + LOBYTE(v2->uTargetBBits) | |
2536 + v2->uTargetRBits | |
2537 - 8); | |
2538 i[v10] = (signed int)(v2->uTargetGMask & *(short *)a1) >> (LOBYTE(v2->uTargetBBits) | |
2539 + LOBYTE(v2->uTargetGBits) | |
2540 - 8); | |
2541 v11 = a1; | |
2542 v12 = LOBYTE(v2->uTargetBMask); | |
2543 a1 += 2; | |
2544 v23[v10++] = ((unsigned __int8)*v11 & v12) << (8 - LOBYTE(v2->uTargetBBits)); | |
2545 } | |
2546 while ( v10 < v25 ); | |
2547 } | |
2548 for ( i = 0; (signed int)i < v24; i += BYTE3(a1) ) | |
2549 { | |
2550 BYTE3(a1) = 1; | |
2551 v46 = *((char *)ptr + (int)i); | |
2552 do | |
2553 { | |
2554 v13 = (signed int)&i[BYTE3(a1)]; | |
2555 if ( *((char *)ptr + v13) != v46 ) | |
2556 break; | |
2557 if ( !(v13 % v43) ) | |
2558 break; | |
2559 ++BYTE3(a1); | |
2560 } | |
2561 while ( BYTE3(a1) < 0x3Fu ); | |
2562 if ( (signed int)&i[BYTE3(a1)] > v24 ) | |
2563 BYTE3(a1) = 3 * v43 - (char)i; | |
2564 if ( BYTE3(a1) > 1u || v46 >= 0xC0u ) | |
2565 { | |
2566 v44 = BYTE3(a1) | 0xC0; | |
2567 fwrite(&v44, 1u, 1u, v7); | |
2568 } | |
2569 fwrite(&v46, 1u, 1u, v7); | |
2570 } | |
2571 v9 = (int)&v42[v22 / 2]; | |
2572 v14 = File == (FILE *)1; | |
2573 File = (FILE *)((char *)File - 1); | |
2574 v42 = (unsigned __int16 *)((char *)v42 + v22); | |
2575 if ( v14 ) | |
2576 break; | |
2577 v8 = v43; | |
2578 } | |
2579 } | |
2580 if ( v2->pRenderD3D ) | |
2581 { | |
2582 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2583 } | |
2584 else | |
2585 { | |
2586 pRenderer->EndScene(); | |
2587 } | |
1583 | 2588 free(ptr); |
0 | 2589 fclose(v7); |
2590 } | |
2591 } | |
2592 } | |
2593 // 4EFA84: using guessed type int dword_4EFA84; | |
2594 | |
2595 //----- (0049F5A2) -------------------------------------------------------- | |
810 | 2596 void Render::PackPCXpicture( unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size ) |
2597 { | |
0 | 2598 Render *v7; // ebx@1 |
2599 void *v8; // esi@3 | |
2600 void *v9; // esi@3 | |
2601 int v10; // ecx@4 | |
810 | 2602 unsigned short* v11; // eax@4 |
0 | 2603 int v12; // eax@6 |
2604 int v13; // eax@8 | |
2605 int v14; // ecx@8 | |
2606 signed int v15; // eax@11 | |
2607 char v16; // zf@20 | |
2608 int result; // eax@21 | |
2609 char v18[58]; // [sp+Ch] [bp-ACh]@3 | |
2610 // __int16 v19; // [sp+44h] [bp-74h]@3 | |
2611 char v20[48]; // [sp+48h] [bp-70h]@3 | |
810 | 2612 char *lineG; // [sp+78h] [bp-40h]@7 |
2613 char *lineB; // [sp+7Ch] [bp-3Ch]@7 | |
0 | 2614 int v23; // [sp+80h] [bp-38h]@4 |
2615 int v24; // [sp+84h] [bp-34h]@4 | |
2616 int v25; // [sp+88h] [bp-30h]@4 | |
2617 int v26; // [sp+8Ch] [bp-2Ch]@4 | |
810 | 2618 PCXHeader_1 Src; // [sp+90h] [bp-28h]@3 |
2619 PCXHeader_2 v27; // [sp+A0h] [bp-18h]@3 | |
2620 char *lineRGB; // [sp+A8h] [bp-10h]@3 | |
2621 int pitch; // [sp+ACh] [bp-Ch]@1 | |
0 | 2622 char v43; // [sp+B3h] [bp-5h]@18 |
2623 int i; // [sp+B4h] [bp-4h]@6 | |
810 | 2624 unsigned short* line_pictute_data; |
2625 byte test_byte; | |
2626 unsigned char pict_byte; | |
0 | 2627 |
2628 v7 = this; | |
810 | 2629 pitch = wight; |
2630 if ( wight & 1 ) | |
2631 pitch = wight + 1; | |
2632 Src.left = 0; | |
2633 Src.up = 0; | |
2634 Src.right = wight - 1; | |
2635 Src.bottom = heidth - 1; | |
2636 v27.pitch = pitch; | |
0 | 2637 memset(&v20, 0, 0x30u); |
2638 memset(&v18, 0, 0x38u); | |
810 | 2639 v8 = data_buff; |
2640 v27.reserved = 0; | |
0 | 2641 *(_WORD *)&v18[56] = 0; |
810 | 2642 Src.manufacturer = 10; |
2643 Src.version = 5; | |
2644 Src.encoding = 1; | |
2645 Src.bpp = 8; | |
2646 Src.hdpi = 75; | |
2647 Src.vdpi = 75; | |
2648 v27.planes = 3; | |
2649 v27.palette_info = 1; | |
2650 memcpy(data_buff, &Src, 1u); | |
0 | 2651 v8 = (char *)v8 + 1; |
810 | 2652 memcpy(v8, &Src.version, 1u); |
0 | 2653 v8 = (char *)v8 + 1; |
810 | 2654 memcpy(v8, &Src.encoding, 1u); |
0 | 2655 v8 = (char *)v8 + 1; |
810 | 2656 memcpy(v8, &Src.bpp, 1u); |
0 | 2657 v8 = (char *)v8 + 1; |
810 | 2658 memcpy(v8, &Src.left, 2u); |
0 | 2659 v8 = (char *)v8 + 2; |
810 | 2660 memcpy(v8, &Src.up, 2u); |
0 | 2661 v8 = (char *)v8 + 2; |
810 | 2662 memcpy(v8, &Src.right, 2u); |
0 | 2663 v8 = (char *)v8 + 2; |
810 | 2664 memcpy(v8, &Src.bottom, 2u); |
0 | 2665 v8 = (char *)v8 + 2; |
810 | 2666 memcpy(v8, &Src.hdpi, 2u); |
0 | 2667 v8 = (char *)v8 + 2; |
810 | 2668 memcpy(v8, &Src.vdpi, 2u); |
0 | 2669 v8 = (char *)v8 + 2; |
2670 memcpy(v8, &v20, 0x30u); | |
2671 v8 = (char *)v8 + 48; | |
810 | 2672 memcpy(v8, &v27, 1u); |
0 | 2673 v8 = (char *)v8 + 1; |
810 | 2674 memcpy(v8, &v27.planes, 1u); |
0 | 2675 v8 = (char *)v8 + 1; |
810 | 2676 memcpy(v8, &v27.pitch, 2u); |
0 | 2677 v8 = (char *)v8 + 2; |
810 | 2678 memcpy(v8, &v27.palette_info, 2u); |
0 | 2679 v8 = (char *)v8 + 2; |
2680 memcpy(v8, &v18, 0x3Au); | |
2681 v9 = (char *)v8 + 58; | |
810 | 2682 |
1583 | 2683 lineRGB = (char*)malloc(3 * (wight + 2)); |
810 | 2684 if ( heidth > 0 ) |
2685 { | |
2686 v10 = pitch; | |
2687 v25 = heidth; | |
2688 v26 = 3 * pitch; | |
2689 v23 = 2 * wight; | |
2690 v11 = picture_data; | |
2691 v24 = (int)picture_data; | |
0 | 2692 while ( 1 ) |
2693 { | |
810 | 2694 line_pictute_data = v11; |
0 | 2695 v12 = 0; |
2696 i = 0; | |
810 | 2697 if ( wight > 0 ) |
2698 { | |
2699 lineG = (char *)lineRGB + pitch; | |
2700 lineB = (char *)lineRGB + 2 * pitch; | |
0 | 2701 do |
2702 { | |
810 | 2703 lineRGB[v12] = (signed int)(v7->uTargetRMask & *line_pictute_data) >> (v7->uTargetGBits + v7->uTargetBBits + v7->uTargetRBits - 8); |
2704 lineG[v12] = (signed int)(v7->uTargetGMask & *line_pictute_data) >> ( v7->uTargetBBits + v7->uTargetGBits- 8); | |
2705 lineB[v12] = (v7->uTargetBMask & *line_pictute_data) << (8 - v7->uTargetBBits); | |
2706 | |
2707 v12++; | |
2708 } | |
2709 while ( v12 < wight ); | |
0 | 2710 } |
2711 for ( i = 0; i < v26; v9 = (char *)v9 + 1 ) | |
2712 { | |
810 | 2713 test_byte = 1; |
2714 pict_byte = lineRGB [i]; | |
0 | 2715 do |
2716 { | |
810 | 2717 v15 = i + test_byte; |
2718 if ( *((char *)lineRGB + v15) != pict_byte ) | |
0 | 2719 break; |
810 | 2720 if ( !(v15 % pitch) ) |
0 | 2721 break; |
810 | 2722 ++test_byte; |
2723 } | |
2724 while ( test_byte < 0x3Fu ); | |
2725 if ( i + test_byte > v26 ) | |
2726 test_byte = 3 * pitch - i; | |
2727 if ( test_byte > 1u || pict_byte >= 0xC0u ) | |
2728 { | |
2729 v43 = test_byte | 0xC0; | |
0 | 2730 memcpy(v9, &v43, 1u); |
2731 v9 = (char *)v9 + 1; | |
2732 } | |
810 | 2733 memcpy(v9, &pict_byte, 1u); |
2734 i += test_byte; | |
2735 } | |
2736 v11 +=wight ; | |
0 | 2737 v16 = v25-- == 1; |
810 | 2738 |
0 | 2739 if ( v16 ) |
2740 break; | |
810 | 2741 v10 = pitch; |
2742 } | |
2743 } | |
1583 | 2744 free(lineRGB); |
810 | 2745 *(int *)packed_size = (char *)v9 - data_buff; |
2746 | |
0 | 2747 } |
2748 | |
2749 //----- (0049F8B5) -------------------------------------------------------- | |
2750 FILE *Render::SavePCXImage(const char *Filename, char *a3, int a4, int a5) | |
2751 { | |
1430 | 2752 //Render *v5; // esi@1 |
0 | 2753 FILE *result; // eax@1 |
2754 FILE *v7; // edi@4 | |
2755 int v8; // ecx@5 | |
2756 int v9; // eax@5 | |
2757 int v10; // eax@7 | |
2758 int v11; // ecx@9 | |
2759 signed int v12; // eax@12 | |
2760 char v13; // zf@21 | |
2761 char v14[56]; // [sp+4h] [bp-A0h]@4 | |
2762 __int16 v15; // [sp+3Ch] [bp-68h]@4 | |
2763 char color_map[48]; // [sp+40h] [bp-64h]@4 | |
2764 int v17; // [sp+70h] [bp-34h]@5 | |
2765 int v18; // [sp+74h] [bp-30h]@5 | |
2766 char *v19; // [sp+78h] [bp-2Ch]@5 | |
2767 int v20; // [sp+7Ch] [bp-28h]@5 | |
2768 PCXHeader_1 header1; // [sp+80h] [bp-24h]@4 | |
2769 PCXHeader_2 header2; // [sp+90h] [bp-14h]@4 | |
2770 void *ptr; // [sp+98h] [bp-Ch]@4 | |
2771 int v24; // [sp+9Ch] [bp-8h]@2 | |
2772 char *i; // [sp+A0h] [bp-4h]@8 | |
2773 | |
2774 result = fopen(Filename, "wb"); | |
2775 Filename = (const char *)result; | |
2776 if ( result ) | |
2777 { | |
2778 v24 = a4; | |
2779 if ( a4 & 1 ) | |
2780 v24 = a4 + 1; | |
2781 header1.left = 0; | |
2782 header1.up = 0; | |
2783 header1.right = a4 - 1; | |
2784 header1.bottom = a5 - 1; | |
2785 header2.pitch = v24; | |
2786 memset(color_map, 0, sizeof(color_map)); | |
2787 header2.reserved = 0; | |
2788 memset(v14, 0, sizeof(v14)); | |
2789 v15 = 0; | |
2790 header1.manufacturer = 10; | |
2791 header1.version = 5; | |
2792 header1.encoding = 1; | |
2793 header1.bpp = 8; | |
2794 header1.hdpi = 75; | |
2795 header1.vdpi = 75; | |
2796 header2.planes = 3; | |
2797 header2.palette_info = 1; | |
2798 fwrite(&header1, 1u, 1u, (FILE *)Filename); | |
2799 v7 = (FILE *)Filename; | |
2800 fwrite(&header1.version, 1u, 1u, (FILE *)Filename); | |
2801 fwrite(&header1.encoding, 1u, 1u, v7); | |
2802 fwrite(&header1.bpp, 1u, 1u, v7); | |
2803 fwrite(&header1.left, 2u, 1u, v7); | |
2804 fwrite(&header1.up, 2u, 1u, v7); | |
2805 fwrite(&header1.right, 2u, 1u, v7); | |
2806 fwrite(&header1.bottom, 2u, 1u, v7); | |
2807 fwrite(&header1.hdpi, 2u, 1u, v7); | |
2808 fwrite(&header1.vdpi, 2u, 1u, v7); | |
2809 fwrite(color_map, 0x30u, 1u, v7); | |
2810 fwrite(&header2, 1u, 1u, v7); | |
2811 fwrite(&header2.planes, 1u, 1u, v7); | |
2812 fwrite(&header2.pitch, 2u, 1u, v7); | |
2813 fwrite(&header2.palette_info, 2u, 1u, v7); | |
2814 fwrite(v14, 0x3Au, 1u, v7); | |
1583 | 2815 ptr = malloc(3 * a4 + 6); |
0 | 2816 if ( a5 > 0 ) |
2817 { | |
2818 v8 = v24; | |
2819 v18 = a5; | |
2820 v20 = 3 * v24; | |
2821 v17 = 2 * a4; | |
2822 v9 = (int)a3; | |
2823 v19 = a3; | |
2824 while ( 1 ) | |
2825 { | |
2826 a5 = v9; | |
2827 v10 = 0; | |
2828 if ( a4 > 0 ) | |
2829 { | |
2830 a3 = (char *)ptr + v8; | |
2831 i = (char *)ptr + 2 * v24; | |
2832 do | |
2833 { | |
1430 | 2834 *((char *)ptr + v10) = (signed int)(this->uTargetRMask & *(short *)a5) >> (LOBYTE(this->uTargetGBits) |
2835 + LOBYTE(this->uTargetBBits) | |
2836 + this->uTargetRBits | |
0 | 2837 - 8); |
1430 | 2838 a3[v10] = (signed int)(this->uTargetGMask & *(short *)a5) >> (LOBYTE(this->uTargetBBits) |
2839 + LOBYTE(this->uTargetGBits) | |
0 | 2840 - 8); |
2841 v11 = a5; | |
2842 a5 += 2; | |
1430 | 2843 i[v10++] = (this->uTargetBMask & *(char *)v11) << (8 - LOBYTE(this->uTargetBBits)); |
0 | 2844 } |
2845 while ( v10 < a4 ); | |
2846 } | |
2847 for ( i = 0; (signed int)i < v20; i += BYTE3(a5) ) | |
2848 { | |
2849 BYTE3(a5) = 1; | |
2850 BYTE3(Filename) = *((char *)ptr + (int)i); | |
2851 do | |
2852 { | |
2853 v12 = (signed int)&i[BYTE3(a5)]; | |
2854 if ( *((char *)ptr + v12) != BYTE3(Filename) ) | |
2855 break; | |
2856 if ( !(v12 % v24) ) | |
2857 break; | |
2858 ++BYTE3(a5); | |
2859 } | |
2860 while ( BYTE3(a5) < 0x3Fu ); | |
2861 if ( (signed int)&i[BYTE3(a5)] > v20 ) | |
2862 BYTE3(a5) = 3 * v24 - (char)i; | |
2863 if ( BYTE3(a5) > 1u || BYTE3(Filename) >= 0xC0u ) | |
2864 { | |
2865 BYTE3(a3) = BYTE3(a5) | 0xC0; | |
2866 fwrite((char *)&a3 + 3, 1u, 1u, v7); | |
2867 } | |
2868 fwrite((char *)&Filename + 3, 1u, 1u, v7); | |
2869 } | |
2870 v9 = (int)&v19[v17]; | |
2871 v13 = v18-- == 1; | |
2872 v19 += v17; | |
2873 if ( v13 ) | |
2874 break; | |
2875 v8 = v24; | |
2876 } | |
2877 } | |
1583 | 2878 free(ptr); |
0 | 2879 result = (FILE *)fclose(v7); |
2880 } | |
2881 return result; | |
2882 } | |
2883 | |
2884 //----- (0049FBCD) -------------------------------------------------------- | |
2885 void Render::ClearTarget(unsigned int uColor) | |
2886 { | |
2887 if (pRenderD3D) | |
2888 { | |
2889 if (field_40110) | |
2890 pRenderD3D->ClearTarget(true, uColor, false, 0.0); | |
2891 } | |
2892 else | |
2893 memset32(pTargetSurface, uColor, field_10 * field_14 / 2); | |
2894 } | |
2895 | |
2896 //----- (0049FC23) -------------------------------------------------------- | |
2897 void Render::Release2() | |
2898 { | |
2899 Release(); | |
2900 bWindowMode = 1; | |
2901 } | |
2902 | |
2903 //----- (0049FC37) -------------------------------------------------------- | |
2904 void Render::Present() | |
2905 { | |
2906 Render *v1; // esi@1 | |
2907 struct tagRECT Rect; // [sp+8h] [bp-28h]@11 | |
2908 RECT a4; // [sp+18h] [bp-18h]@11 | |
2909 struct tagPOINT Point; // [sp+28h] [bp-8h]@11 | |
2910 | |
2911 v1 = this; | |
2912 if ( !pRenderer->pRenderD3D || this->field_40110 ) | |
2913 { | |
2914 this->pBeforePresentFunction(); | |
2915 if ( v1->pRenderD3D ) | |
2916 { | |
2917 if ( v1->field_40110 ) | |
2918 { | |
2919 pRenderD3D->Present(false); | |
2920 } | |
2921 } | |
2922 else | |
2923 { | |
2924 if ( v1->bWindowMode ) | |
2925 { | |
2926 RestoreFrontBuffer(); | |
2927 GetClientRect(v1->hWnd, &Rect); | |
2928 Point.y = 0; | |
2929 Point.x = 0; | |
2930 ClientToScreen(v1->hWnd, &Point); | |
2931 OffsetRect(&Rect, Point.x, Point.y); | |
2932 a4.top = 0; | |
2933 a4.bottom = 480; | |
2934 a4.left = 0; | |
2935 a4.right = 640; | |
2936 PresentRect(&Rect, &a4); | |
2937 } | |
2938 else | |
2939 { | |
2940 RestoreFrontBuffer(); | |
2941 a4.top = 0; | |
2942 a4.bottom = 480; | |
2943 a4.left = 0; | |
2944 a4.right = 640; | |
2945 BltBackToFontFast(0, 0, &a4); | |
2946 } | |
2947 } | |
2948 } | |
2949 } | |
2950 | |
2951 //----- (0049FD3A) -------------------------------------------------------- | |
2952 void Render::_49FD3A() | |
2953 { | |
2954 Render *v2; // esi@1 | |
2955 IDirectDrawSurface4 *v3; // eax@6 | |
2956 IDirectDrawSurface4 *v4; // ST0C_4@6 | |
2957 RECT v5; // [sp+8h] [bp-10h]@6 | |
2958 | |
2959 auto a1 = this; | |
2960 v2 = a1; | |
2961 if ( a1->pRenderD3D ) | |
2962 { | |
2963 if (pFrontBuffer4->IsLost() == DDERR_SURFACELOST) | |
2964 pFrontBuffer4->Restore(); | |
2965 if (pBackBuffer4->IsLost() == DDERR_SURFACELOST) | |
2966 pBackBuffer4->Restore(); | |
2967 v3 = v2->pBackBuffer4; | |
2968 v4 = v2->pFrontBuffer4; | |
2969 v5.top = 0; | |
2970 v5.bottom = 480; | |
2971 v5.left = 0; | |
2972 v5.right = 640; | |
2973 v3->BltFast(0, 0, v4, &v5, 16u); | |
2974 } | |
2975 } | |
2976 | |
2977 //----- (0049FDBF) -------------------------------------------------------- | |
2978 void Render::CreateZBuffer() | |
2979 { | |
2980 if (!pDefaultZBuffer) | |
2981 { | |
2982 pDefaultZBuffer = pActiveZBuffer = nullptr; | |
1583 | 2983 pDefaultZBuffer = pActiveZBuffer = (int *)malloc(0x12C000); |
871 | 2984 memset32(pActiveZBuffer, 0xFFFF0000, 0x4B000u); // // inlined Render::ClearActiveZBuffer (mm8::004A085B) |
0 | 2985 } |
2986 } | |
2987 | |
2988 //----- (0049FE05) -------------------------------------------------------- | |
2989 void Render::Release() | |
2990 { | |
2991 Render *v1; // esi@1 | |
2992 RenderD3D *v2; // ecx@1 | |
2993 char v3; // zf@4 | |
2994 void *v4; // ebx@6 | |
2995 IDirectDraw *v5; // eax@10 | |
2996 IDirectDrawSurface2 *v6; // eax@11 | |
2997 IDirectDrawSurface2 *v7; // eax@13 | |
2998 IDirectDrawSurface2 *v8; // eax@15 | |
2999 IDirectDraw2 *v9; // eax@17 | |
3000 IDirectDraw4 *v10; // eax@19 | |
3001 IDirectDrawSurface4 *v11; // eax@20 | |
3002 IDirectDrawSurface4 *v12; // eax@22 | |
3003 IDirectDrawSurface4 *v13; // eax@24 | |
3004 IDirectDraw4 *v14; // eax@26 | |
3005 unsigned __int16 **v15; // ebx@28 | |
3006 void **v16; // esi@29 | |
3007 | |
3008 v1 = this; | |
3009 v2 = this->pRenderD3D; | |
3010 if ( v2 ) | |
3011 { | |
3012 if ( v1->field_40110 ) | |
3013 { | |
3014 pRenderD3D->ClearTarget(1u, 0, 0, 1.0); | |
3015 pRenderD3D->Present(0); | |
3016 pRenderD3D->ClearTarget(1u, 0, 0, 1.0); | |
3017 } | |
3018 v1->pColorKeySurface4 = 0; | |
3019 v1->pBackBuffer4 = 0; | |
3020 v3 = v1->pTargetSurface == 0; | |
3021 v1->pFrontBuffer4 = 0; | |
3022 v1->pDirectDraw4 = 0; | |
3023 if ( !v3 ) | |
3024 { | |
3025 free(v1->ptr_400E8); | |
3026 v1->pTargetSurface = 0; | |
3027 v1->ptr_400E8 = 0; | |
3028 } | |
3029 v4 = v1->pRenderD3D; | |
3030 if ( v4 ) | |
3031 { | |
3032 pRenderD3D->Release(); | |
3033 free(v4); | |
3034 } | |
3035 v1->pRenderD3D = 0; | |
3036 } | |
3037 else | |
3038 { | |
3039 if ( bWinNT4_0 == 1 ) | |
3040 { | |
3041 v5 = (IDirectDraw *)v1->pDirectDraw2; | |
3042 if ( !v5 ) | |
3043 return; | |
3044 v5->SetCooperativeLevel(v1->hWnd, 8u); | |
3045 v1->pDirectDraw2->FlipToGDISurface(); | |
3046 v6 = v1->pSomeSurface2; | |
3047 if ( v6 ) | |
3048 { | |
3049 v6->Release(); | |
3050 v1->pSomeSurface2 = 0; | |
3051 } | |
3052 v7 = v1->pBackBuffer2; | |
3053 if ( v7 ) | |
3054 { | |
3055 v7->Release(); | |
3056 v1->pBackBuffer2 = 0; | |
3057 } | |
3058 v8 = v1->pFrontBuffer2; | |
3059 if ( v8 ) | |
3060 { | |
3061 v8->Release(); | |
3062 v1->pFrontBuffer2 = 0; | |
3063 } | |
3064 v9 = v1->pDirectDraw2; | |
3065 if ( v9 ) | |
3066 { | |
3067 v9->Release(); | |
3068 v1->pDirectDraw2 = 0; | |
3069 } | |
3070 } | |
3071 else | |
3072 { | |
3073 v10 = v1->pDirectDraw4; | |
3074 if ( !v10 ) | |
3075 return; | |
3076 v10->SetCooperativeLevel(v1->hWnd, 1032u); | |
3077 v1->pDirectDraw4->FlipToGDISurface(); | |
3078 v11 = v1->pColorKeySurface4; | |
3079 if ( v11 ) | |
3080 { | |
3081 v11->Release(); | |
3082 v1->pColorKeySurface4 = 0; | |
3083 } | |
3084 v12 = v1->pBackBuffer4; | |
3085 if ( v12 ) | |
3086 { | |
3087 v12->Release(); | |
3088 v1->pBackBuffer4 = 0; | |
3089 } | |
3090 v13 = v1->pFrontBuffer4; | |
3091 if ( v13 ) | |
3092 { | |
3093 v13->Release(); | |
3094 v1->pFrontBuffer4 = 0; | |
3095 } | |
3096 v14 = v1->pDirectDraw4; | |
3097 if ( v14 ) | |
3098 { | |
3099 v14->Release(); | |
3100 v1->pDirectDraw4 = 0; | |
3101 } | |
3102 } | |
3103 v15 = &v1->pTargetSurface; | |
3104 if ( v1->pTargetSurface ) | |
3105 { | |
3106 v16 = (void **)&v1->ptr_400E8; | |
3107 free(*v16); | |
3108 *v15 = 0; | |
3109 *v16 = 0; | |
3110 } | |
3111 } | |
3112 } | |
3113 | |
3114 //----- (0049FFD7) -------------------------------------------------------- | |
3115 void Render::CreateSomeTexture() | |
3116 { | |
3117 pRenderD3D->CreateTexture(64, 64, &pSurface, &pTexture, true, false, 32); | |
3118 } | |
3119 | |
3120 //----- (0049FFFB) -------------------------------------------------------- | |
3121 bool Render::InitializeFullscreen(HWND hWnd) | |
3122 { | |
3123 //Render *v2; // esi@1 | |
3124 //HWND v3; // ebx@1 | |
3125 //void *v4; // eax@2 | |
3126 //RenderD3D *v5; // eax@3 | |
3127 unsigned int v6; // edx@5 | |
3128 RenderD3D__DevInfo *v7; // ecx@5 | |
3129 bool v8; // eax@6 | |
3130 RenderD3D *v9; // ecx@13 | |
3131 unsigned int v10; // eax@13 | |
3132 RenderD3D *v11; // eax@25 | |
3133 HRESULT v12; // eax@25 | |
3134 int v13; // ecx@25 | |
3135 int v14; // eax@27 | |
3136 signed int v15; // ebx@31 | |
3137 bool v16; // eax@35 | |
3138 char v17; // zf@35 | |
3139 IDirectDraw4 *v18; // eax@38 | |
3140 HRESULT v19; // eax@38 | |
3141 int *v20; // eax@39 | |
3142 int *v22; // eax@42 | |
3143 int v23; // ecx@42 | |
3144 D3DDEVICEDESC refCaps; // [sp+Ch] [bp-300h]@25 | |
3145 DDSURFACEDESC2 pDesc; // [sp+108h] [bp-204h]@40 | |
3146 D3DDEVICEDESC halCaps; // [sp+184h] [bp-188h]@25 | |
3147 DDSURFACEDESC2 ddsd2; // [sp+280h] [bp-8Ch]@38 | |
3148 void *v28; // [sp+2FCh] [bp-10h]@2 | |
3149 int v29; // [sp+308h] [bp-4h]@2 | |
3150 | |
3151 //v2 = this; | |
3152 this->field_40110 = 0; | |
3153 this->pColorKeySurface4 = 0; | |
3154 this->pBackBuffer4 = 0; | |
3155 this->pFrontBuffer4 = 0; | |
3156 this->pDirectDraw4 = 0; | |
3157 this->bColorKeySupported = 0; | |
3158 Release(); | |
3159 //v3 = hWnd; | |
3160 this->hWnd = hWnd; | |
3161 CreateZBuffer(); | |
3162 if ( bUserDirect3D ) | |
3163 { | |
3164 pRenderD3D = new RenderD3D; | |
3165 v28 = pRenderD3D; | |
3166 v6 = uDesiredDirect3DDevice; | |
3167 v29 = -1; | |
3168 v7 = pRenderD3D->pAvailableDevices; | |
3169 if ( v7[v6].bIsDeviceCompatible ) | |
3170 { | |
3171 v8 = pRenderD3D->CreateDevice(v6, 0, hWnd); | |
3172 uAcquiredDirect3DDevice = uDesiredDirect3DDevice; | |
3173 } | |
3174 else | |
3175 { | |
3176 if ( v7[1].bIsDeviceCompatible ) | |
3177 { | |
3178 v8 = pRenderD3D->CreateDevice(1u, 0, hWnd); | |
3179 uAcquiredDirect3DDevice = 1; | |
3180 } | |
3181 else | |
3182 { | |
3183 if ( !v7->bIsDeviceCompatible ) | |
1545 | 3184 Error("There aren't any D3D devices to create."); |
3185 | |
0 | 3186 v8 = pRenderD3D->CreateDevice(0, 0, hWnd); |
3187 uAcquiredDirect3DDevice = 0; | |
3188 } | |
3189 } | |
3190 if ( !v8 ) | |
1545 | 3191 Error("D3Drend->Init failed."); |
3192 | |
0 | 3193 v9 = pRenderD3D; |
3194 pBackBuffer4 = v9->pBackBuffer; | |
3195 pFrontBuffer4 = v9->pFrontBuffer; | |
3196 pDirectDraw4 = v9->pHost; | |
3197 v10 = pRenderD3D->GetDeviceCaps(); | |
3198 if ( v10 & 1 ) | |
3199 { | |
3200 if ( pRenderD3D ) | |
3201 { | |
3202 pRenderD3D->Release(); | |
3203 delete pRenderD3D; | |
3204 } | |
3205 pRenderD3D = 0; | |
3206 pBackBuffer4 = 0; | |
3207 pFrontBuffer4 = 0; | |
3208 pDirectDraw4 = 0; | |
1545 | 3209 Error("Direct3D renderer: The device failed to return capabilities."); |
0 | 3210 } |
3211 if ( v10 & 0x3E ) | |
3212 { | |
3213 if ( pRenderD3D ) | |
3214 { | |
3215 pRenderD3D->Release(); | |
3216 delete pRenderD3D; | |
3217 } | |
3218 pColorKeySurface4 = 0; | |
3219 pRenderD3D = 0; | |
3220 pBackBuffer4 = 0; | |
3221 pFrontBuffer4 = 0; | |
3222 pDirectDraw4 = 0; | |
1545 | 3223 Error("Direct3D renderer: The device doesn't support the necessary alpha blending modes."); |
0 | 3224 } |
3225 if ( (v10 & 0x80u) != 0 ) | |
3226 { | |
3227 if ( pRenderD3D ) | |
3228 { | |
3229 pRenderD3D->Release(); | |
3230 delete pRenderD3D; | |
3231 } | |
3232 pRenderD3D = 0; | |
3233 pBackBuffer4 = 0; | |
3234 pFrontBuffer4 = 0; | |
3235 pDirectDraw4 = 0; | |
1545 | 3236 Error("Direct3D renderer: The device doesn't support non-square textures."); |
0 | 3237 } |
3238 LOBYTE(field_10365C) = ~(unsigned __int8)(v10 >> 6) & 1; | |
3239 bRequiredTextureStagesAvailable = CheckTextureStages(); | |
3240 memset(&halCaps, 0, 0xFCu); | |
3241 halCaps.dwSize = 252; | |
3242 memset(&refCaps, 0, 0xFCu); | |
3243 v11 = pRenderD3D; | |
3244 refCaps.dwSize = 252; | |
3245 ErrD3D(v11->pDevice->GetCaps(&halCaps, &refCaps)); | |
3246 v13 = halCaps.dwMinTextureWidth; | |
3247 if ( (unsigned int)halCaps.dwMinTextureWidth >= halCaps.dwMinTextureHeight ) | |
3248 v13 = halCaps.dwMinTextureHeight; | |
3249 v14 = halCaps.dwMaxTextureWidth; | |
3250 uMinDeviceTextureDim = v13; | |
3251 if ( (unsigned int)v14 < halCaps.dwMaxTextureHeight ) | |
3252 v14 = halCaps.dwMaxTextureHeight; | |
3253 uMaxDeviceTextureDim = v14; | |
3254 if ( (unsigned int)v13 < 4 ) | |
3255 uMinDeviceTextureDim = 4; | |
3256 CreateSomeTexture(); | |
3257 v15 = 1; | |
3258 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, true)); | |
3259 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true)); | |
3260 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u)); | |
3261 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SPECULARENABLE, false)); | |
3262 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, false)); | |
3263 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, false)); | |
3264 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); | |
3265 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | |
3266 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | |
3267 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 3u)); | |
3268 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, 2u)); | |
3269 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, 0)); | |
3270 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, 2u)); | |
3271 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | |
3272 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, 0)); | |
3273 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 4u)); | |
3274 } | |
3275 else | |
3276 { | |
3277 CreateDirectDraw(); | |
3278 SetDirectDrawCooperationMode(hWnd, 1); | |
3279 SetDirectDrawDisplayMode(640u, 480u, 16u); | |
3280 CreateDirectDrawPrimarySurface(); | |
3281 v15 = 1; | |
3282 } | |
3283 ddpfPrimareSuface.dwSize = 32; | |
3284 GetTargetPixelFormat(&ddpfPrimareSuface); | |
3285 ParseTargetPixelFormat(); | |
3286 _49EBF1(); | |
3287 if ( pRenderD3D ) | |
3288 { | |
3289 v16 = IsColorKeySupported(pDirectDraw4); | |
3290 v17 = uAcquiredDirect3DDevice == v15; | |
3291 bColorKeySupported = v16; | |
3292 if ( !v17 ) | |
3293 bColorKeySupported = 0; | |
3294 if ( bColorKeySupported ) | |
3295 { | |
3296 memset(&ddsd2, 0, 0x7Cu); | |
3297 ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue = uTargetGMask | uTargetBMask; | |
3298 ddsd2.ddckCKSrcBlt.dwColorSpaceHighValue = ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue; | |
3299 v18 = pDirectDraw4; | |
3300 ddsd2.dwSize = 124; | |
3301 ddsd2.dwFlags = 65543; | |
3302 ddsd2.ddsCaps.dwCaps = 2112; | |
3303 ddsd2.dwWidth = 640; | |
3304 ddsd2.dwHeight = 480; | |
3305 ErrD3D(v18->CreateSurface(&ddsd2, &pColorKeySurface4, 0)); | |
3306 pBeforePresentFunction = Present_ColorKey; | |
3307 } | |
3308 else | |
3309 { | |
3310 pTargetSurface = 0; | |
3311 ptr_400E8 = 0; | |
1631 | 3312 v20 = (int *)malloc(0x96020u); |
0 | 3313 ptr_400E8 = v20; |
3314 if ( !v20 | |
3315 || (memset(&pDesc, 0, 0x7Cu), | |
3316 pDesc.dwSize = 124, | |
3317 !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, v15)) ) | |
3318 return 0; | |
3319 pBackBuffer4->Unlock(0); | |
3320 v22 = ptr_400E8 + 4; | |
3321 v23 = (unsigned int)pDesc.lpSurface & 7; | |
3322 LOBYTE(v22) = (unsigned __int8)v22 & 0xF8; | |
3323 uTargetSurfacePitch = 640; | |
3324 pBeforePresentFunction = Present_NoColorKey; | |
3325 v15 = 1; | |
3326 pTargetSurface = (unsigned __int16 *)((char *)v22 + 2 * v23); | |
3327 } | |
3328 field_40110 = v15; | |
3329 } | |
3330 else | |
3331 { | |
3332 pBeforePresentFunction = 0;//nullsub_1; | |
3333 } | |
3334 bWindowMode = 0; | |
3335 pParty->uFlags |= 2u; | |
1583 | 3336 LODWORD(flt_6BE3A0) = 0x3F0CCCCDu; __debugbreak(); // replace with actual float |
0 | 3337 pViewport->_4C02F8(36044); |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
3338 return v15 != 0; |
0 | 3339 } |
3340 | |
3341 //----- (004A05F3) -------------------------------------------------------- | |
3342 bool Render::SwitchToWindow(HWND hWnd) | |
3343 { | |
3344 //Render *v2; // esi@1 | |
3345 //void *v3; // eax@2 | |
3346 //RenderD3D *v4; // eax@3 | |
3347 //unsigned int v5; // edx@5 | |
3348 //RenderD3D__DevInfo *v6; // ecx@5 | |
3349 bool v7; // eax@7 | |
3350 //RenderD3D *v8; // ecx@12 | |
3351 unsigned int v9; // eax@12 | |
3352 RenderD3D *v10; // eax@24 | |
3353 HRESULT v11; // eax@24 | |
3354 int v12; // eax@24 | |
3355 int v13; // eax@26 | |
3356 bool v14; // eax@32 | |
3357 char v15; // zf@32 | |
3358 IDirectDraw4 *v16; // eax@35 | |
3359 HRESULT v17; // eax@35 | |
3360 int *v18; // eax@36 | |
3361 int *v19; // edx@38 | |
3362 int v20; // eax@38 | |
3363 unsigned int v21; // ecx@38 | |
3364 int v22; // eax@41 | |
3365 D3DDEVICEDESC refCaps; // [sp+Ch] [bp-300h]@24 | |
3366 DDSURFACEDESC2 pDesc; // [sp+108h] [bp-204h]@37 | |
3367 D3DDEVICEDESC halCaps; // [sp+184h] [bp-188h]@24 | |
3368 DDSURFACEDESC2 ddsd2; // [sp+280h] [bp-8Ch]@35 | |
3369 //RenderD3D *thisa; // [sp+2FCh] [bp-10h]@2 | |
3370 int v29; // [sp+308h] [bp-4h]@2 | |
3371 | |
3372 pParty->uFlags |= 2u; | |
3373 //v2 = this; | |
3374 flt_6BE3A0 = 0.55000001f; | |
3375 pViewport->_4C02F8(36044); | |
3376 field_40110 = 0; | |
3377 Release(); | |
3378 pColorKeySurface4 = 0; | |
3379 pBackBuffer4 = 0; | |
3380 pFrontBuffer4 = 0; | |
3381 pDirectDraw4 = 0; | |
3382 bColorKeySupported = 0; | |
3383 CreateZBuffer(); | |
3384 if ( bUserDirect3D ) | |
3385 { | |
1631 | 3386 /*v3 = malloc(0x148u); |
0 | 3387 thisa = (RenderD3D *)v3; |
3388 v29 = 0; | |
3389 if ( v3 ) | |
3390 v4 = RenderD3D::RenderD3D((RenderD3D *)v3); | |
3391 else | |
3392 v4 = 0;*/ | |
3393 pRenderD3D = new RenderD3D; | |
3394 //v4 = pRenderD3D; | |
3395 //v5 = uDesiredDirect3DDevice; | |
3396 v29 = -1; | |
3397 //v6 = pRenderD3D->pAvailableDevices; | |
3398 if (pRenderD3D->pAvailableDevices[uDesiredDirect3DDevice].bIsDeviceCompatible && | |
3399 uDesiredDirect3DDevice != 1 ) | |
3400 { | |
3401 v7 = pRenderD3D->CreateDevice(uDesiredDirect3DDevice, 1, hWnd); | |
3402 uAcquiredDirect3DDevice = uDesiredDirect3DDevice; | |
3403 } | |
3404 else | |
3405 { | |
3406 if ( !pRenderD3D->pAvailableDevices[0].bIsDeviceCompatible ) | |
1545 | 3407 Error("There aren't any D3D devices to init."); |
3408 | |
0 | 3409 v7 = pRenderD3D->CreateDevice(0, 1, hWnd); |
3410 uAcquiredDirect3DDevice = 0; | |
3411 } | |
3412 if ( !v7 ) | |
1545 | 3413 Error("D3Drend->Init failed."); |
0 | 3414 |
3415 //v8 = pRenderD3D; | |
3416 pColorKeySurface4 = 0; | |
3417 pBackBuffer4 = pRenderD3D->pBackBuffer; | |
3418 pFrontBuffer4 = pRenderD3D->pFrontBuffer; | |
3419 pDirectDraw4 = pRenderD3D->pHost; | |
3420 v9 = pRenderD3D->GetDeviceCaps(); | |
3421 if ( v9 & 1 ) | |
3422 { | |
3423 if (pRenderD3D) | |
3424 { | |
3425 pRenderD3D->Release(); | |
3426 delete pRenderD3D; | |
3427 } | |
3428 pRenderD3D = 0; | |
3429 pBackBuffer4 = 0; | |
3430 pFrontBuffer4 = 0; | |
3431 pDirectDraw4 = 0; | |
1545 | 3432 Error("Direct3D renderer: The device failed to return capabilities."); |
0 | 3433 } |
3434 if ( v9 & 0x3E ) | |
3435 { | |
3436 if (pRenderD3D) | |
3437 { | |
3438 pRenderD3D->Release(); | |
3439 delete pRenderD3D; | |
3440 } | |
3441 pColorKeySurface4 = 0; | |
3442 pRenderD3D = 0; | |
3443 pBackBuffer4 = 0; | |
3444 pFrontBuffer4 = 0; | |
3445 pDirectDraw4 = 0; | |
1545 | 3446 Error("Direct3D renderer: The device doesn't support the necessary alpha blending modes."); |
0 | 3447 } |
3448 if ( (v9 & 0x80u) != 0 ) | |
3449 { | |
3450 if (pRenderD3D) | |
3451 { | |
3452 pRenderD3D->Release(); | |
3453 delete pRenderD3D; | |
3454 } | |
3455 pRenderD3D = 0; | |
3456 pBackBuffer4 = 0; | |
3457 pFrontBuffer4 = 0; | |
3458 pDirectDraw4 = 0; | |
1545 | 3459 Error("Direct3D renderer: The device doesn't support non-square textures."); |
0 | 3460 } |
3461 LOBYTE(field_10365C) = ~(unsigned __int8)(v9 >> 6) & 1; | |
3462 bRequiredTextureStagesAvailable = CheckTextureStages(); | |
3463 memset(&halCaps, 0, 0xFCu); | |
3464 halCaps.dwSize = 252; | |
3465 memset(&refCaps, 0, 0xFCu); | |
3466 //v10 = v2->pRenderD3D; | |
3467 refCaps.dwSize = 252; | |
3468 ErrD3D(pRenderD3D->pDevice->GetCaps(&halCaps, &refCaps)); | |
3469 v12 = halCaps.dwMinTextureWidth; | |
3470 if ( (unsigned int)halCaps.dwMinTextureWidth >= halCaps.dwMinTextureHeight ) | |
3471 v12 = halCaps.dwMinTextureHeight; | |
3472 uMinDeviceTextureDim = v12; | |
3473 v13 = halCaps.dwMaxTextureWidth; | |
3474 if ( (unsigned int)halCaps.dwMaxTextureWidth < halCaps.dwMaxTextureHeight ) | |
3475 v13 = halCaps.dwMaxTextureHeight; | |
3476 uMaxDeviceTextureDim = v13; | |
3477 CreateSomeTexture(); | |
3478 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, 1u)); | |
3479 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); | |
3480 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u)); | |
3481 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SPECULARENABLE, 0)); | |
3482 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, 0)); | |
3483 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); | |
3484 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | |
3485 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | |
3486 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 3u)); | |
3487 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, 2u)); | |
3488 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, 0)); | |
3489 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, 2u)); | |
3490 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | |
3491 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, 0)); | |
3492 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 4u)); | |
3493 } | |
3494 else | |
3495 { | |
3496 CreateDirectDraw(); | |
3497 SetDirectDrawCooperationMode(hWnd, 0); | |
3498 field_4004C = 1; | |
3499 CreateFrontBuffer(); | |
3500 CreateClipper(hWnd); | |
3501 CreateBackBuffer(); | |
3502 field_40030 = 0; | |
3503 field_18_locked_pitch = 0; | |
3504 } | |
3505 ddpfPrimareSuface.dwSize = 32; | |
3506 GetTargetPixelFormat(&ddpfPrimareSuface); | |
3507 ParseTargetPixelFormat(); | |
3508 _49EBF1(); | |
3509 if ( !pRenderD3D ) | |
3510 { | |
3511 pBeforePresentFunction = 0;//nullsub_1; | |
3512 goto LABEL_47; | |
3513 } | |
3514 v14 = IsColorKeySupported(pDirectDraw4); | |
3515 v15 = uAcquiredDirect3DDevice == 1; | |
3516 bColorKeySupported = v14; | |
3517 if ( !v15 ) | |
3518 bColorKeySupported = 0; | |
3519 if ( bColorKeySupported ) | |
3520 { | |
3521 memset(&ddsd2, 0, 0x7Cu); | |
3522 ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue = uTargetGMask | uTargetBMask; | |
3523 ddsd2.ddckCKSrcBlt.dwColorSpaceHighValue = ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue; | |
3524 v16 = pDirectDraw4; | |
3525 ddsd2.dwSize = 124; | |
3526 ddsd2.dwFlags = 65543; | |
3527 ddsd2.ddsCaps.dwCaps = 2112; | |
3528 ddsd2.dwWidth = 640; | |
3529 ddsd2.dwHeight = 480; | |
3530 ErrD3D(v16->CreateSurface(&ddsd2, &pColorKeySurface4, 0)); | |
3531 pBeforePresentFunction = Present_ColorKey; | |
3532 LABEL_45: | |
3533 field_40110 = 1; | |
3534 LABEL_47: | |
3535 bWindowMode = 1; | |
3536 hWnd = hWnd; | |
3537 return 0; | |
3538 } | |
3539 pTargetSurface = 0; | |
3540 ptr_400E8 = 0; | |
3541 v18 = (int *)new char[0x96020]; | |
3542 memset(v18, -1, 0x96020); | |
3543 ptr_400E8 = v18; | |
3544 if ( v18 ) | |
3545 { | |
3546 memset(&pDesc, 0, 0x7Cu); | |
3547 pDesc.dwSize = 124; | |
168 | 3548 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, DDLOCK_WAIT) ) |
0 | 3549 { |
3550 pRenderer->pBackBuffer4->Unlock(0); | |
3551 v19 = ptr_400E8; | |
3552 v20 = (unsigned int)pDesc.lpSurface & 7; | |
3553 v21 = (unsigned int)ptr_400E8 & 7; | |
3554 if ( v21 == v20 ) | |
3555 { | |
3556 pTargetSurface = (unsigned __int16 *)v19; | |
3557 } | |
3558 else | |
3559 { | |
3560 if ( (signed int)v21 >= v20 ) | |
3561 v22 = (int)((char *)v19 + 2 * (v21 - v20) + 16); | |
3562 else | |
3563 v22 = (int)((char *)v19 + 2 * (v20 - v21) + 16); | |
3564 pTargetSurface = (unsigned __int16 *)v22; | |
3565 } | |
3566 uTargetSurfacePitch = 640; | |
3567 pBeforePresentFunction = Present_NoColorKey; | |
3568 goto LABEL_45; | |
3569 } | |
3570 } | |
3571 return 0; | |
3572 } | |
3573 | |
3574 //----- (004A0BEE) -------------------------------------------------------- | |
709 | 3575 char Render::RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) |
0 | 3576 { |
3577 int v6; // edi@1 | |
3578 int v7; // edx@5 | |
3579 unsigned int v8; // ebx@5 | |
3580 int v9; // eax@7 | |
3581 unsigned int v10; // ecx@9 | |
3582 unsigned int v11; // esi@13 | |
3583 int v12; // eax@17 | |
3584 int v13; // eax@21 | |
3585 Render *v14; // edi@21 | |
3586 int v15; // eax@25 | |
3587 int v16; // eax@27 | |
3588 signed int v17; // eax@28 | |
3589 signed int v18; // edi@30 | |
3590 signed __int64 v19; // qax@41 | |
3591 int v20; // edi@41 | |
3592 unsigned int v21; // edi@46 | |
3593 int v22; // esi@47 | |
3594 int v23; // ebx@47 | |
3595 signed int v24; // edx@50 | |
3596 signed int v25; // esi@52 | |
3597 unsigned __int16 *v26; // ecx@52 | |
3598 int v27; // ebx@54 | |
3599 int v28; // edi@55 | |
3600 int v29; // edx@55 | |
3601 int v30; // ebx@60 | |
3602 int v31; // edx@61 | |
3603 int v32; // edi@61 | |
3604 int v34; // [sp+Ch] [bp-10h]@3 | |
3605 Render *v35; // [sp+10h] [bp-Ch]@1 | |
3606 __int64 v36; // [sp+14h] [bp-8h]@1 | |
3607 signed int v37; // [sp+18h] [bp-4h]@28 | |
3608 unsigned int uXa; // [sp+24h] [bp+8h]@49 | |
3609 unsigned int uYa; // [sp+28h] [bp+Ch]@28 | |
3610 int uYb; // [sp+28h] [bp+Ch]@47 | |
3611 int uZa; // [sp+2Ch] [bp+10h]@38 | |
3612 | |
3613 v36 = 0i64; | |
709 | 3614 v6 = this->raster_clip_x; |
0 | 3615 v35 = this; |
3616 if ( (signed int)uX < v6 ) | |
3617 HIDWORD(v36) = 8; | |
709 | 3618 v34 = this->raster_clip_z; |
3619 if ( (signed int)uX > this->raster_clip_z ) | |
0 | 3620 HIDWORD(v36) |= 4u; |
709 | 3621 v7 = this->raster_clip_y; |
0 | 3622 v8 = uY; |
3623 if ( (signed int)uY < v7 ) | |
3624 HIDWORD(v36) |= 2u; | |
709 | 3625 v9 = this->raster_clip_w; |
0 | 3626 if ( (signed int)uY > v9 ) |
3627 HIDWORD(v36) |= 1u; | |
3628 v10 = uZ; | |
3629 if ( (signed int)uZ < v6 ) | |
3630 LODWORD(v36) = 8; | |
3631 if ( (signed int)uZ > v34 ) | |
3632 LODWORD(v36) = v36 | 4; | |
3633 v11 = uW; | |
3634 if ( (signed int)uW < v7 ) | |
3635 LODWORD(v36) = v36 | 2; | |
3636 if ( (signed int)uW > v9 ) | |
3637 LODWORD(v36) = v36 | 1; | |
3638 LOBYTE(v12) = v36; | |
3639 if ( (unsigned int)v36 & HIDWORD(v36) ) | |
3640 return v12; | |
3641 if ( !v36 ) | |
3642 { | |
3643 LABEL_46: | |
3644 v21 = pRenderer->uTargetSurfacePitch; | |
3645 if ( pRenderer->uTargetSurfacePitch ) | |
3646 { | |
3647 v12 = uX + v8 * pRenderer->uTargetSurfacePitch; | |
3648 v22 = v11 - v8; | |
3649 v23 = v22; | |
3650 uYb = v22; | |
3651 if ( v22 < 0 ) | |
3652 { | |
3653 v23 = -v22; | |
3654 uYb = -v22; | |
3655 v21 = -pRenderer->uTargetSurfacePitch; | |
3656 } | |
3657 uXa = v10 - uX; | |
3658 if ( (uXa & 0x80000000u) == 0 ) | |
3659 { | |
3660 v24 = 1; | |
3661 } | |
3662 else | |
3663 { | |
3664 uXa = -uXa; | |
3665 v24 = -1; | |
3666 } | |
3667 v25 = 0; | |
3668 v26 = v35->pTargetSurface; | |
3669 if ( v26 ) | |
3670 { | |
3671 if ( (signed int)uXa <= v23 ) | |
3672 { | |
3673 v30 = v23 + 1; | |
3674 if ( v30 > 0 ) | |
3675 { | |
3676 v31 = 2 * v24; | |
3677 v32 = 2 * v21; | |
3678 v12 = (int)&v26[v12]; | |
3679 do | |
3680 { | |
3681 v25 += uXa; | |
3682 *(short *)v12 = uColor; | |
3683 v12 += v32; | |
3684 if ( v25 > 0 ) | |
3685 { | |
3686 v25 -= uYb; | |
3687 v12 += v31; | |
3688 } | |
3689 --v30; | |
3690 } | |
3691 while ( v30 ); | |
3692 } | |
3693 } | |
3694 else | |
3695 { | |
3696 v27 = uXa + 1; | |
3697 if ( (signed int)(uXa + 1) > 0 ) | |
3698 { | |
3699 v28 = 2 * v21; | |
3700 v29 = 2 * v24; | |
3701 v12 = (int)&v26[v12]; | |
3702 do | |
3703 { | |
3704 v25 += uYb; | |
3705 *(short *)v12 = uColor; | |
3706 v12 += v29; | |
3707 if ( v25 > (signed int)uXa ) | |
3708 { | |
3709 v25 -= uXa; | |
3710 v12 += v28; | |
3711 } | |
3712 --v27; | |
3713 } | |
3714 while ( v27 ); | |
3715 } | |
3716 } | |
3717 } | |
3718 } | |
3719 return v12; | |
3720 } | |
3721 if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 ) | |
3722 { | |
3723 if ( BYTE4(v36) & 8 ) | |
3724 { | |
3725 v13 = (signed int)((uW - uY) * (v6 - uX)) / (signed int)(uZ - uX); | |
3726 v14 = v35; | |
3727 v8 = v13 + uY; | |
709 | 3728 uX = v35->raster_clip_x; |
0 | 3729 goto LABEL_24; |
3730 } | |
3731 v10 = v6; | |
3732 v11 = (signed int)((uY - uW) * (v6 - uZ)) / (signed int)(uX - uZ) + uW; | |
3733 } | |
3734 v14 = v35; | |
3735 LABEL_24: | |
3736 if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 ) | |
3737 { | |
709 | 3738 v15 = v14->raster_clip_z; |
0 | 3739 if ( BYTE4(v36) & 4 ) |
3740 { | |
3741 v14 = v35; | |
3742 v8 += (signed int)((v11 - v8) * (v15 - uX)) / (signed int)(v10 - uX); | |
709 | 3743 uX = v35->raster_clip_z; |
0 | 3744 } |
3745 else | |
3746 { | |
3747 v16 = (signed int)((v8 - v11) * (v15 - v10)) / (signed int)(uX - v10); | |
709 | 3748 v10 = v14->raster_clip_z; |
0 | 3749 v11 += v16; |
3750 } | |
3751 } | |
709 | 3752 v17 = v14->raster_clip_y; |
0 | 3753 v37 = 0; |
709 | 3754 uYa = v14->raster_clip_y; |
0 | 3755 if ( (signed int)v8 < v17 ) |
3756 v37 = 2; | |
709 | 3757 v18 = v14->raster_clip_w; |
0 | 3758 if ( (signed int)v8 > v18 ) |
3759 v37 |= 1u; | |
3760 if ( (signed int)v11 >= v17 ) | |
3761 v12 = 0; | |
3762 else | |
3763 v12 = 2; | |
3764 if ( (signed int)v11 > v18 ) | |
3765 LOBYTE(v12) = v12 | 1; | |
3766 if ( !(v12 & v37) ) | |
3767 { | |
3768 v12 ^= v37; | |
3769 uZa = v12; | |
3770 if ( v12 & 2 ) | |
3771 { | |
3772 if ( v37 & 2 ) | |
3773 { | |
3774 uX += (signed int)((v10 - uX) * (uYa - v8)) / (signed int)(v11 - v8); | |
3775 LOBYTE(v12) = (char)v35; | |
709 | 3776 v8 = v35->raster_clip_y; |
0 | 3777 } |
3778 else | |
3779 { | |
3780 v19 = (signed int)((uX - v10) * (uYa - v11)); | |
3781 v20 = v8 - v11; | |
3782 v11 = uYa; | |
3783 v12 = v19 / v20; | |
3784 v10 += v12; | |
3785 } | |
3786 } | |
3787 if ( uZa & 1 ) | |
3788 { | |
3789 if ( v37 & 1 ) | |
3790 { | |
709 | 3791 uX += (signed int)((v10 - uX) * (v35->raster_clip_w - v8)) / (signed int)(v11 - v8); |
0 | 3792 LOBYTE(v12) = (char)v35; |
709 | 3793 v8 = v35->raster_clip_w; |
0 | 3794 } |
3795 else | |
3796 { | |
709 | 3797 v12 = (signed int)((uX - v10) * (v35->raster_clip_w - v11)) / (signed int)(v8 - v11); |
3798 v11 = v35->raster_clip_w; | |
0 | 3799 v10 += v12; |
3800 } | |
3801 } | |
3802 goto LABEL_46; | |
3803 } | |
3804 return v12; | |
3805 } | |
3806 | |
3807 //----- (004A0E80) -------------------------------------------------------- | |
3808 void Render::ClearZBuffer(int a2, int a3) | |
3809 { | |
3810 memset32(this->pActiveZBuffer, -65536, 0x4B000u); | |
3811 } | |
3812 | |
3813 //----- (004A0E97) -------------------------------------------------------- | |
709 | 3814 void Render::SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) |
3815 { | |
3816 this->raster_clip_x = uX; | |
3817 this->raster_clip_y = uY; | |
3818 this->raster_clip_z = uZ; | |
3819 this->raster_clip_w = uW; | |
0 | 3820 } |
3821 | |
3822 //----- (004A0EB6) -------------------------------------------------------- | |
3823 void Render::ParseTargetPixelFormat() | |
3824 { | |
3825 Render *v1; // eax@1 | |
3826 signed int v2; // ecx@1 | |
3827 DWORD uRedMask; // edx@1 | |
3828 unsigned int uGreenMask; // esi@5 | |
3829 signed int v5; // ecx@5 | |
3830 unsigned int uBlueMask; // edx@9 | |
3831 signed int v7; // ecx@9 | |
3832 unsigned int v8; // ecx@13 | |
3833 | |
3834 v1 = this; | |
3835 v2 = 0; | |
3836 uRedMask = v1->ddpfPrimareSuface.dwRBitMask; | |
3837 v1->uTargetBBits = 0; | |
3838 v1->uTargetGBits = 0; | |
3839 v1->uTargetRBits = 0; | |
3840 do | |
3841 { | |
3842 if ( (1 << v2) & uRedMask ) | |
3843 ++v1->uTargetRBits; | |
3844 ++v2; | |
3845 } | |
3846 while ( v2 < 16 ); | |
3847 uGreenMask = v1->ddpfPrimareSuface.dwGBitMask; | |
3848 v5 = 0; | |
3849 do | |
3850 { | |
3851 if ( (1 << v5) & uGreenMask ) | |
3852 ++v1->uTargetGBits; | |
3853 ++v5; | |
3854 } | |
3855 while ( v5 < 16 ); | |
3856 uBlueMask = v1->ddpfPrimareSuface.dwBBitMask; | |
3857 v7 = 0; | |
3858 do | |
3859 { | |
3860 if ( (1 << v7) & uBlueMask ) | |
3861 ++v1->uTargetBBits; | |
3862 ++v7; | |
3863 } | |
3864 while ( v7 < 16 ); | |
3865 v8 = v1->ddpfPrimareSuface.dwRBitMask; | |
3866 v1->uTargetGMask = uGreenMask; | |
3867 v1->uTargetRMask = v8; | |
3868 v1->uTargetBMask = uBlueMask; | |
3869 } | |
3870 | |
3871 //----- (004A0F40) -------------------------------------------------------- | |
3872 bool Render::LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags) | |
3873 { | |
3874 IDirectDrawSurface4 *v4; // esi@1 | |
168 | 3875 HRESULT result; // eax@1 |
0 | 3876 HRESULT v6; // eax@4 |
3877 int v7; // [sp-8h] [bp-14h]@10 | |
3878 unsigned int v8; // [sp-4h] [bp-10h]@10 | |
3879 char v9; // [sp+Bh] [bp-1h]@1 | |
3880 | |
3881 v4 = pSurface; | |
3882 v9 = 1; | |
3883 result = pSurface->Lock(0, pDesc, uLockFlags, 0); | |
3884 if ( result == DDERR_SURFACELOST ) | |
3885 { | |
3886 v6 = v4->Restore(); | |
3887 if ( v6 ) | |
3888 { | |
3889 if ( v6 != DDERR_IMPLICITLYCREATED ) | |
3890 { | |
3891 LABEL_20: | |
3892 v9 = 0; | |
3893 result = (bool)memset(pDesc, 0, 4u); | |
3894 goto LABEL_21; | |
3895 } | |
3896 pRenderer->pFrontBuffer4->Restore(); | |
3897 v4->Restore(); | |
3898 } | |
3899 result = v4->Lock(0, pDesc, DDLOCK_WAIT, 0); | |
3900 if ( result == DDERR_INVALIDRECT || result == DDERR_SURFACEBUSY ) | |
3901 goto LABEL_20; | |
3902 ErrD3D(result); | |
3903 if ( result ) | |
3904 { | |
3905 //v8 = 0; | |
3906 //v7 = 2161; | |
3907 LABEL_19: | |
3908 //CheckHRESULT((CheckHRESULT_stru0 *)&pSurface, result, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp", v7, v8); | |
3909 goto LABEL_20; | |
3910 } | |
3911 if ( pRenderer->pRenderD3D ) | |
3912 pRenderD3D->HandleLostResources(); | |
3913 result = pRenderer->pDirectDraw4->RestoreAllSurfaces(); | |
3914 } | |
3915 else | |
3916 { | |
3917 if ( result ) | |
3918 { | |
3919 if ( result == DDERR_INVALIDRECT || result == DDERR_SURFACEBUSY ) | |
3920 goto LABEL_20; | |
3921 ErrD3D(result); | |
3922 //v8 = 0; | |
3923 //v7 = 2199; | |
3924 //goto LABEL_19; | |
3925 } | |
3926 } | |
3927 LABEL_21: | |
3928 LOBYTE(result) = v9; | |
3929 return result; | |
3930 } | |
3931 | |
3932 //----- (004A1032) -------------------------------------------------------- | |
3933 bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags) | |
3934 { | |
3935 IDirectDrawSurface2 *v4; // esi@1 | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
3936 HRESULT v5; // eax@1 |
0 | 3937 HRESULT v6; // eax@2 |
3938 int v7; // [sp-8h] [bp-10h]@8 | |
3939 unsigned int v8; // [sp-4h] [bp-Ch]@8 | |
3940 | |
3941 v4 = pSurface; | |
3942 v5 = pSurface->Lock( | |
3943 0, | |
3944 pDesc, | |
3945 uLockFlags, | |
3946 0); | |
3947 BYTE3(pSurface) = 1; | |
3948 if ( v5 == DDERR_SURFACELOST ) | |
3949 { | |
3950 v6 = v4->Restore(); | |
3951 if ( !v6 ) | |
3952 goto LABEL_5; | |
3953 if ( v6 == DDERR_IMPLICITLYCREATED ) | |
3954 { | |
3955 pRenderer->pFrontBuffer2->Restore(); | |
3956 v4->Restore(); | |
3957 LABEL_5: | |
3958 v5 = v4->Lock(0, pDesc, 1u, 0) != 0; | |
3959 if ( v5 == DDERR_INVALIDRECT || v5 == DDERR_SURFACEBUSY ) | |
3960 goto LABEL_14; | |
3961 if ( !v5 ) | |
3962 return true; | |
3963 ErrD3D(v5); | |
3964 //v8 = 0; | |
3965 //v7 = 2247; | |
3966 goto LABEL_13; | |
3967 } | |
3968 else | |
3969 { | |
3970 pDesc->dwSize = 0; | |
3971 return false; | |
3972 } | |
3973 } | |
3974 else | |
3975 { | |
3976 if ( !v5 ) | |
3977 return true; | |
3978 if ( v5 != DDERR_INVALIDRECT && v5 != DDERR_SURFACEBUSY ) | |
3979 { | |
3980 //v8 = 0; | |
3981 //v7 = 2269; | |
3982 ErrD3D(v5); | |
3983 pDesc->dwSize = 0; | |
3984 return false; | |
3985 LABEL_13: | |
3986 //CheckHRESULT((CheckHRESULT_stru0 *)&pSurface, v5, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp", v7, v8); | |
3987 goto LABEL_14; | |
3988 } | |
3989 } | |
3990 LABEL_14: | |
3991 return true; | |
3992 } | |
3993 | |
3994 //----- (004A10E4) -------------------------------------------------------- | |
3995 void Render::CreateDirectDraw() | |
3996 { | |
3997 Render *v1; // edi@1 | |
3998 HRESULT v2; // eax@1 | |
3999 HRESULT v3; // eax@5 | |
4000 int v6; // [sp-Ch] [bp-20h]@3 | |
4001 unsigned int v9; // [sp+0h] [bp-14h]@0 | |
4002 IDirectDraw *lpDD; // [sp+10h] [bp-4h]@1 | |
4003 | |
4004 v1 = this; | |
4005 ErrD3D(DirectDrawCreate(0, &lpDD, 0)); | |
4006 | |
4007 pDirectDraw2 = nullptr; | |
4008 pDirectDraw4 = nullptr; | |
4009 | |
4010 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4011 ErrD3D(lpDD->QueryInterface(IID_IDirectDraw4, (void **)&pDirectDraw4)); | |
4012 else | |
4013 ErrD3D(lpDD->QueryInterface(IID_IDirectDraw2, (void **)&pDirectDraw2)); | |
4014 | |
4015 lpDD->Release(); | |
4016 lpDD = nullptr; | |
4017 } | |
4018 | |
4019 //----- (004A1169) -------------------------------------------------------- | |
4020 void Render::SetDirectDrawCooperationMode(HWND hWnd, bool bFullscreen) | |
4021 { | |
4022 DWORD flags; // eax@1 | |
4023 IDirectDraw *v4; // ecx@3 | |
4024 HRESULT v5; // eax@5 | |
4025 int v6; // [sp-8h] [bp-8h]@3 | |
4026 unsigned int v7; // [sp-4h] [bp-4h]@3 | |
4027 | |
4028 flags = bFullscreen ? DDSCL_NORMAL | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : | |
4029 DDSCL_NORMAL; | |
4030 | |
4031 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4032 ErrD3D(pDirectDraw4->SetCooperativeLevel(hWnd, flags | DDSCL_MULTITHREADED)); | |
4033 else | |
4034 ErrD3D(pDirectDraw2->SetCooperativeLevel(hWnd, flags)); | |
4035 } | |
4036 | |
4037 //----- (004A11C6) -------------------------------------------------------- | |
4038 void Render::SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP) | |
4039 { | |
4040 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4041 ErrD3D(pDirectDraw4->SetDisplayMode(uWidth, uHeight, uBPP, 0, 0)); | |
4042 else | |
4043 ErrD3D(pDirectDraw2->SetDisplayMode(uWidth, uHeight, uBPP, 0, 0)); | |
4044 } | |
4045 | |
4046 //----- (004A121C) -------------------------------------------------------- | |
4047 void Render::CreateFrontBuffer() | |
4048 { | |
4049 Render *v1; // esi@1 | |
4050 IDirectDraw *pDD; // eax@3 | |
4051 IDirectDrawSurface **pOutSurf; // esi@3 | |
4052 struct _DDSURFACEDESC *v4; // edx@3 | |
4053 HRESULT v5; // eax@5 | |
4054 int v6; // [sp-8h] [bp-8Ch]@3 | |
4055 unsigned int v7; // [sp-4h] [bp-88h]@3 | |
4056 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3 | |
4057 | |
4058 v1 = this; | |
4059 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4060 { | |
4061 memset(&a2, 0, 0x7Cu); | |
4062 pDD = (IDirectDraw *)v1->pDirectDraw4; | |
4063 a2.dwSize = 124; | |
4064 a2.dwFlags = 1; | |
4065 v7 = 0; | |
4066 a2.ddsCaps.dwCaps = 512; | |
4067 v6 = 2357; | |
4068 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer4; | |
4069 v4 = (struct _DDSURFACEDESC *)&a2; | |
4070 } | |
4071 else | |
4072 { | |
4073 memset(&a2.lPitch, 0, 0x6Cu); // DDSURFACEDESC here | |
4074 pDD = (IDirectDraw *)v1->pDirectDraw2; | |
4075 a2.lPitch = 108; | |
4076 a2.dwBackBufferCount = 1; | |
4077 v7 = 0; | |
4078 a2.dwTextureStage = 512; | |
4079 v6 = 2346; | |
4080 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer2; | |
4081 v4 = (struct _DDSURFACEDESC *)&a2.lPitch; | |
4082 } | |
4083 ErrD3D(pDD->CreateSurface(v4, pOutSurf, 0)); | |
4084 } | |
4085 | |
4086 //----- (004A12CD) -------------------------------------------------------- | |
4087 void Render::CreateBackBuffer() | |
4088 { | |
4089 Render *v1; // esi@1 | |
4090 IDirectDraw *v2; // eax@3 | |
4091 IDirectDrawSurface **ppBackBuffer; // esi@3 | |
4092 struct _DDSURFACEDESC *v4; // edx@3 | |
4093 HRESULT v5; // eax@5 | |
4094 int v6; // [sp-8h] [bp-8Ch]@3 | |
4095 unsigned int v7; // [sp-4h] [bp-88h]@3 | |
4096 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3 | |
4097 | |
4098 v1 = this; | |
4099 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4100 { | |
4101 memset(&a2, 0, 0x7Cu); | |
4102 v2 = (IDirectDraw *)v1->pDirectDraw4; | |
4103 a2.dwSize = 124; | |
4104 a2.dwFlags = 7; | |
4105 v7 = 0; | |
4106 a2.ddsCaps.dwCaps = 2112; | |
4107 a2.dwWidth = 640; | |
4108 a2.dwHeight = 480; | |
4109 v6 = 2387; | |
4110 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4; | |
4111 v4 = (struct _DDSURFACEDESC *)&a2; | |
4112 } | |
4113 else | |
4114 { | |
4115 memset(&a2.lPitch, 0, 0x6Cu); | |
4116 v2 = (IDirectDraw *)v1->pDirectDraw2; | |
4117 a2.lPitch = 108; | |
4118 a2.dwBackBufferCount = 7; | |
4119 v7 = 0; | |
4120 a2.dwTextureStage = 2112; | |
4121 a2.dwAlphaBitDepth = 640; | |
4122 a2.dwMipMapCount = 480; | |
4123 v6 = 2374; | |
4124 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2; | |
4125 v4 = (struct _DDSURFACEDESC *)&a2.lPitch; // //DDSURFACEDESC here fo ddraw2 | |
4126 } | |
4127 ErrD3D(v2->CreateSurface(v4, ppBackBuffer, 0)); | |
4128 } | |
4129 | |
4130 //----- (004A139A) -------------------------------------------------------- | |
4131 void Render::CreateDirectDrawPrimarySurface() | |
4132 { | |
4133 Render *v1; // esi@1 | |
4134 int v2; // ebx@3 | |
4135 IDirectDraw2 *v3; // eax@3 | |
4136 HRESULT v4; // eax@3 | |
4137 IDirectDrawSurface *pFrontBuffer; // eax@3 | |
4138 DDSCAPS2 *v6; // edx@3 | |
4139 IDirectDraw4 *v7; // eax@4 | |
4140 HRESULT v8; // eax@4 | |
4141 int v9; // ST14_4@5 | |
4142 IDirectDrawSurface *v10; // ST10_4@5 | |
4143 HRESULT v11; // eax@5 | |
4144 IDirectDrawSurface **ppBackBuffer; // [sp-4h] [bp-A4h]@3 | |
4145 const char *v13; // [sp+0h] [bp-A0h]@0 | |
4146 int v14; // [sp+4h] [bp-9Ch]@0 | |
4147 unsigned int v15; // [sp+8h] [bp-98h]@0 | |
4148 DDSURFACEDESC2 ddsd2; // [sp+Ch] [bp-94h]@3 | |
4149 DDSCAPS2 v17; // [sp+88h] [bp-18h]@4 | |
4150 int a4; // [sp+98h] [bp-8h]@3 | |
4151 | |
4152 v1 = this; | |
4153 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4154 { | |
4155 v2 = 0; | |
4156 this->field_4004C = 1; | |
4157 memset(&ddsd2, 0, 0x7Cu); | |
4158 v7 = v1->pDirectDraw4; | |
4159 ddsd2.dwBackBufferCount = 1; | |
4160 ddsd2.dwSize = 0x7Cu; | |
4161 ddsd2.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; | |
4162 ddsd2.ddsCaps.dwCaps = DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_3DDEVICE | DDSCAPS_PRIMARYSURFACE; | |
4163 ErrD3D(v7->CreateSurface( | |
4164 &ddsd2, | |
4165 &pFrontBuffer4, | |
4166 0)); | |
4167 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer4; | |
4168 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4; | |
4169 } | |
4170 else | |
4171 { | |
4172 v2 = 0; | |
4173 this->field_4004C = 1; | |
4174 | |
4175 DDSURFACEDESC ddsd; | |
4176 memset(&ddsd, 0, sizeof(DDSURFACEDESC)); | |
4177 | |
4178 ddsd.lpSurface = (LPVOID)1; | |
4179 ddsd.lPitch = 108; | |
4180 ddsd.dwBackBufferCount = 33; | |
4181 ddsd.ddsCaps.dwCaps = 8728; | |
4182 ErrD3D(pDirectDraw2->CreateSurface( | |
4183 &ddsd, | |
4184 (IDirectDrawSurface **)&pFrontBuffer2, | |
4185 0)); | |
4186 | |
4187 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer2; | |
4188 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2; | |
4189 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
4190 __debugbreak(); // warning C4700: uninitialized local variable 'v6' used |
0 | 4191 v9 = (int)v6; |
4192 v10 = pFrontBuffer; // BUG | |
4193 | |
4194 v17.dwCaps = 4; | |
4195 ErrD3D(pFrontBuffer->GetAttachedSurface((DDSCAPS *)&v17, ppBackBuffer));// hr = this->pFrontBuffer->GetAttachedSurface(&ddsCaps2, ppBackBuffer); | |
4196 //CheckHRESULT(&thisa, v11, (const char *)v10, v9, (unsigned int)ppBackBuffer); | |
4197 v1->field_40030 = v2; | |
4198 v1->field_18_locked_pitch = v2; | |
4199 } | |
4200 | |
4201 //----- (004A14F4) -------------------------------------------------------- | |
4202 void Render::CreateClipper(HWND a2) | |
4203 { | |
4204 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4205 { | |
4206 ErrD3D(pDirectDraw4->CreateClipper(0, &pDDrawClipper, 0)); | |
4207 ErrD3D(pDDrawClipper->SetHWnd(0, a2)); | |
4208 ErrD3D(pFrontBuffer4->SetClipper(pDDrawClipper)); | |
4209 } | |
4210 else | |
4211 { | |
4212 ErrD3D(pDirectDraw2->CreateClipper(0, &pDDrawClipper, 0)); | |
4213 ErrD3D(pDDrawClipper->SetHWnd(0, a2)); | |
4214 } | |
4215 } | |
4216 | |
4217 //----- (004A15D8) -------------------------------------------------------- | |
4218 void Render::GetTargetPixelFormat(DDPIXELFORMAT *pOut) | |
4219 { | |
4220 IDirectDrawSurface *v2; // eax@3 | |
4221 | |
4222 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4223 v2 = (IDirectDrawSurface *)this->pFrontBuffer4; | |
4224 else | |
4225 v2 = (IDirectDrawSurface *)this->pFrontBuffer2; | |
4226 v2->GetPixelFormat(pOut); | |
4227 } | |
4228 | |
4229 //----- (004A1605) -------------------------------------------------------- | |
4230 void Render::LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow) | |
4231 { | |
4232 Render *v3; // esi@1 | |
4233 signed int v4; // eax@3 | |
4234 | |
4235 v3 = this; | |
4236 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4237 { | |
4238 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 | |
4239 memset(&pDesc, 0, 0x7Cu); | |
4240 pDesc.dwSize = 124; | |
168 | 4241 LockSurface_DDraw4(v3->pBackBuffer4, &pDesc, DDLOCK_WAIT); |
0 | 4242 *pOutSurfacePtr = pDesc.lpSurface; |
4243 v4 = pDesc.lPitch; | |
4244 } | |
4245 else | |
4246 { | |
4247 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 | |
4248 memset(&pDesc.lPitch, 0, 0x6Cu); | |
4249 pDesc.lPitch = 108; | |
4250 LockSurface_DDraw2(v3->pBackBuffer2, &pDesc, 1u); | |
4251 *pOutSurfacePtr = (void *)pDesc.lpSurface; | |
4252 v4 = pDesc.dwReserved; | |
4253 } | |
4254 *pOutPixelsPerRow = v4 >> 1; | |
4255 } | |
4256 | |
4257 //----- (004A169E) -------------------------------------------------------- | |
4258 bool Render::UsingDirect3D() | |
4259 { | |
4260 return bUserDirect3D == 0; | |
4261 } | |
4262 | |
4263 //----- (004A16E1) -------------------------------------------------------- | |
4264 void Render::UnlockBackBuffer() | |
4265 { | |
4266 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4267 ErrD3D(pBackBuffer4->Unlock(0)); | |
4268 else | |
4269 ErrD3D(pBackBuffer2->Unlock(0)); | |
4270 } | |
4271 | |
4272 //----- (004A172E) -------------------------------------------------------- | |
4273 void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow) | |
4274 { | |
4275 Render *v3; // esi@1 | |
4276 signed int v4; // eax@3 | |
4277 | |
4278 v3 = this; | |
4279 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4280 { | |
4281 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 | |
4282 memset(&pDesc, 0, 0x7Cu); | |
4283 pDesc.dwSize = 124; | |
168 | 4284 LockSurface_DDraw4(v3->pFrontBuffer4, &pDesc, DDLOCK_WAIT); |
0 | 4285 *pOutSurface = pDesc.lpSurface; |
4286 v4 = pDesc.lPitch; | |
4287 } | |
4288 else | |
4289 { | |
4290 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 | |
4291 memset(&pDesc.lPitch, 0, 0x6Cu); | |
4292 pDesc.lPitch = 108; | |
4293 LockSurface_DDraw2(v3->pFrontBuffer2, &pDesc, 1u); | |
4294 *pOutSurface = (void *)pDesc.lpSurface; | |
4295 v4 = pDesc.dwReserved; | |
4296 } | |
4297 *pOutPixelsPerRow = v4 >> 1; | |
4298 } | |
4299 | |
4300 //----- (004A17C7) -------------------------------------------------------- | |
4301 void Render::UnlockFrontBuffer() | |
4302 { | |
4303 IDirectDrawSurface *pFront; // eax@3 | |
4304 HRESULT v2; // eax@5 | |
4305 signed int v3; // [sp-8h] [bp-Ch]@3 | |
4306 int v4; // [sp-4h] [bp-8h]@3 | |
4307 | |
4308 auto a5 = this; | |
4309 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4310 { | |
4311 pFront = (IDirectDrawSurface *)a5->pFrontBuffer4; | |
4312 v4 = 0; | |
4313 v3 = 2615; | |
4314 } | |
4315 else | |
4316 { | |
4317 pFront = (IDirectDrawSurface *)a5->pFrontBuffer2; | |
4318 v4 = 0; | |
4319 v3 = 2611; | |
4320 } | |
4321 ErrD3D(pFront->Unlock(0)); | |
4322 } | |
4323 | |
4324 //----- (004A1814) -------------------------------------------------------- | |
4325 void Render::RestoreFrontBuffer() | |
4326 { | |
4327 IDirectDrawSurface **v1; // esi@2 | |
4328 | |
4329 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT | |
4330 || (v1 = (IDirectDrawSurface **)&this->pFrontBuffer2, pVersion->pVersionInfo.dwMajorVersion >= 5u) ) | |
4331 v1 = (IDirectDrawSurface **)&this->pFrontBuffer4; | |
4332 if ( (*v1)->IsLost() == DDERR_SURFACELOST ) | |
4333 (*v1)->Restore(); | |
4334 } | |
4335 | |
4336 //----- (004A184C) -------------------------------------------------------- | |
4337 HRESULT Render::_4A184C() | |
4338 { | |
4339 IDirectDrawSurface **pBack; // esi@2 | |
4340 HRESULT result; // eax@4 | |
4341 | |
4342 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT | |
4343 || (pBack = (IDirectDrawSurface **)&this->pBackBuffer2, pVersion->pVersionInfo.dwMajorVersion != 4) ) | |
4344 pBack = (IDirectDrawSurface **)&this->pBackBuffer4; | |
4345 result = (*pBack)->IsLost(); | |
4346 if ( result == DDERR_SURFACELOST ) | |
4347 result = (*pBack)->Restore(); | |
4348 return result; | |
4349 } | |
4350 | |
4351 //----- (004A1884) -------------------------------------------------------- | |
4352 void Render::PresentRect(RECT *a2, RECT *a3) | |
4353 { | |
4354 IDirectDrawSurface *pFront; // eax@3 | |
4355 HRESULT v4; // eax@5 | |
4356 IDirectDrawSurface *pBack; // [sp-1Ch] [bp-1Ch]@3 | |
4357 struct tagRECT *v6; // [sp-18h] [bp-18h]@3 | |
4358 DWORD v7; // [sp-14h] [bp-14h]@3 | |
4359 DDBLTFX *v8; // [sp-10h] [bp-10h]@3 | |
4360 const char *v9; // [sp-Ch] [bp-Ch]@3 | |
4361 int v10; // [sp-8h] [bp-8h]@3 | |
4362 unsigned int v11; // [sp-4h] [bp-4h]@3 | |
4363 | |
4364 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4365 { | |
4366 v11 = 0; | |
4367 pFront = (IDirectDrawSurface *)this->pFrontBuffer4; | |
4368 v10 = 2657; | |
4369 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp"; | |
4370 v8 = 0; | |
4371 v7 = DDBLT_WAIT; | |
4372 v6 = a3; | |
4373 pBack = (IDirectDrawSurface *)this->pBackBuffer4; | |
4374 } | |
4375 else | |
4376 { | |
4377 v11 = 0; | |
4378 pFront = (IDirectDrawSurface *)this->pFrontBuffer2; | |
4379 v10 = 2653; | |
4380 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp"; | |
4381 v8 = 0; | |
4382 v7 = DDBLT_WAIT; | |
4383 v6 = a3; | |
4384 pBack = (IDirectDrawSurface *)this->pBackBuffer2; | |
4385 } | |
4386 ErrD3D(pFront->Blt(a2, pBack, v6, v7, v8)); | |
4387 } | |
4388 | |
4389 //----- (004A18F5) -------------------------------------------------------- | |
4390 void Render::BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags) | |
4391 { | |
4392 IDirectDrawSurface *pFront; // eax@3 | |
4393 HRESULT v6; // eax@5 | |
4394 int v7; // [sp-8h] [bp-8h]@3 | |
4395 unsigned int v8; // [sp-4h] [bp-4h]@3 | |
4396 | |
4397 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u ) | |
4398 ErrD3D(pFrontBuffer4->Blt(pDstRect, (IDirectDrawSurface4 *)pSrcSurface, pSrcRect, uBltFlags, nullptr)); | |
4399 else | |
4400 ErrD3D(pFrontBuffer2->Blt(pDstRect, (IDirectDrawSurface2 *)pSrcSurface, pSrcRect, uBltFlags, nullptr)); | |
4401 } | |
4402 | |
4403 //----- (004A194A) -------------------------------------------------------- | |
4404 void Render::BltBackToFontFast(int a2, int a3, RECT *a4) | |
4405 { | |
4406 IDirectDrawSurface *pFront; // eax@3 | |
4407 IDirectDrawSurface *pBack; // [sp-Ch] [bp-Ch]@3 | |
4408 | |
4409 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4410 { | |
4411 pFront = (IDirectDrawSurface *)this->pFrontBuffer4; | |
4412 pBack = (IDirectDrawSurface *)this->pBackBuffer4; | |
4413 } | |
4414 else | |
4415 { | |
4416 pFront = (IDirectDrawSurface *)this->pFrontBuffer2; | |
4417 pBack = (IDirectDrawSurface *)this->pBackBuffer2; | |
4418 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4419 pFront->BltFast(0, 0, pBack, a4, DDBLTFAST_WAIT); |
0 | 4420 } |
4421 | |
4422 //----- (004A1B22) -------------------------------------------------------- | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4423 unsigned int Render::Billboard_ProbablyAddToListAndSortByZOrder(float z) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4424 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4425 //unsigned int v2; // ebx@1 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4426 //double v4; // st7@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4427 //unsigned int v5; // esi@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4428 //int v6; // ecx@5 |
0 | 4429 unsigned int v7; // edx@6 |
4430 char *v8; // ecx@12 | |
4431 void *v9; // edi@16 | |
4432 unsigned int v10; // eax@16 | |
4433 void *v11; // edi@21 | |
4434 unsigned int v12; // eax@21 | |
4435 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4436 //v2 = uNumBillboardsToDraw; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4437 if (uNumBillboardsToDraw >= 999 ) |
0 | 4438 return 0; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4439 if (!uNumBillboardsToDraw) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4440 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4441 uNumBillboardsToDraw = 1; |
0 | 4442 return 0; |
4443 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4444 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4445 //v4 = *(float *)&a1; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4446 //v5 = pRenderer->uNumBillboardsToDraw; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4447 //v6 = 0; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4448 for (int left = 0, right = uNumBillboardsToDraw; left < right; ) // binsearch |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4449 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4450 v7 = left + (right - left) / 2; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4451 if (z <= pRenderer->pBillboardRenderListD3D[v7].z_order) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4452 right = v7; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4453 else |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4454 left = v7 + 1; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4455 } |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4456 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4457 v8 = (char *)&pRenderer->pBillboardRenderListD3D[v7].z_order; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4458 if (z > *(float *)v8 ) |
0 | 4459 { |
4460 if ( v7 == pRenderer->uNumBillboardsToDraw - 1 ) | |
4461 { | |
4462 v7 = pRenderer->uNumBillboardsToDraw; | |
4463 } | |
4464 else | |
4465 { | |
4466 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) | |
4467 { | |
4468 v9 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw]; | |
4469 v10 = pRenderer->uNumBillboardsToDraw - v7; | |
4470 do | |
4471 { | |
4472 memcpy(v9, (char *)v9 - 156, 0x9Cu); | |
4473 v9 = (char *)v9 - 156; | |
4474 --v10; | |
4475 } | |
4476 while ( v10 ); | |
4477 } | |
4478 ++v7; | |
4479 } | |
717 | 4480 //LABEL_23: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4481 uNumBillboardsToDraw++; |
0 | 4482 return v7; |
4483 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4484 if (z <= *(float *)v8 ) |
0 | 4485 { |
4486 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) | |
4487 { | |
4488 v11 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw]; | |
4489 v12 = pRenderer->uNumBillboardsToDraw - v7; | |
4490 do | |
4491 { | |
4492 memcpy(v11, (char *)v11 - 156, 0x9Cu); | |
4493 v11 = (char *)v11 - 156; | |
4494 --v12; | |
4495 } | |
4496 while ( v12 ); | |
4497 } | |
717 | 4498 //goto LABEL_23; |
4499 uNumBillboardsToDraw++; | |
4500 return v7; | |
0 | 4501 } |
4502 return v7; | |
4503 } | |
4504 | |
4505 //----- (004A1E9D) -------------------------------------------------------- | |
4506 unsigned int Render::GetBillboardDrawListSize() | |
4507 { | |
4508 return pRenderer->uNumBillboardsToDraw; | |
4509 } | |
4510 | |
4511 //----- (004A1EA3) -------------------------------------------------------- | |
4512 unsigned int Render::GetParentBillboardID(unsigned int uBillboardID) | |
4513 { | |
4514 return pRenderer->pBillboardRenderListD3D[uBillboardID].uParentBillboardID; | |
4515 } | |
4516 | |
4517 //----- (004A1EB6) -------------------------------------------------------- | |
4518 void Render::BeginSceneD3D() | |
4519 { | |
4520 if (!uNumD3DSceneBegins++) | |
4521 { | |
4522 if (pRenderD3D) | |
4523 { | |
4524 pRenderD3D->ClearTarget(true, 0x00F08020, true, 1.0); | |
4525 pRenderer->uNumBillboardsToDraw = 0; | |
4526 pRenderD3D->pDevice->BeginScene(); | |
1390 | 4527 |
0 | 4528 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
4529 uFogColor = GetLevelFogColor(); | |
4530 else | |
4531 uFogColor = 0; | |
4532 | |
4533 if ( uFogColor & 0xFF000000 ) | |
4534 { | |
4535 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1); | |
4536 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, uFogColor & 0xFFFFFF); | |
4537 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); | |
4538 bUsingSpecular = true; | |
4539 } | |
4540 else | |
4541 { | |
4542 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0); | |
4543 bUsingSpecular = 0; | |
4544 } | |
4545 } | |
4546 else | |
4547 { | |
4548 LockRenderSurface((void **)&pTargetSurface, &uTargetSurfacePitch); | |
4549 if (pTargetSurface) | |
4550 field_18_locked_pitch = uTargetSurfacePitch; | |
4551 else | |
4552 --uNumD3DSceneBegins; | |
4553 } | |
4554 } | |
4555 } | |
4556 | |
4557 //----- (004A1FE1) -------------------------------------------------------- | |
4558 void Render::DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene() | |
4559 { | |
4560 --uNumD3DSceneBegins; | |
4561 if (uNumD3DSceneBegins) | |
4562 return; | |
4563 | |
4564 if (pRenderD3D) | |
4565 { | |
4566 pGame->draw_debug_outlines(); | |
161 | 4567 DoRenderBillboards_D3D(); |
0 | 4568 pGame->pStru6Instance->RenderSpecialEffects(); |
4569 pRenderD3D->pDevice->EndScene(); | |
4570 } | |
4571 else | |
4572 pGame->pStru6Instance->RenderSpecialEffects(); | |
4573 } | |
4574 | |
4575 //----- (004A2031) -------------------------------------------------------- | |
349 | 4576 unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) |
4577 { | |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4578 // __debugbreak(); // should not fire outside decal builder |
349 | 4579 return ::GetActorTintColor(tint, a4, a2, a5, a6); |
0 | 4580 } |
4581 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4582 /*void Render::DrawTerrainPolygon_new(Polygon *a3, IDirect3DTexture2 *pTexture)//new function |
86 | 4583 { |
4584 int v5; // ebx@1 | |
4585 int v6; // edi@1 | |
4586 int v8; // eax@7 | |
4587 float v9; // eax@12 | |
4588 float *v10; // esi@12 | |
4589 float v11; // ecx@14 | |
4590 double v12; // st7@14 | |
4591 double v13; // st7@14 | |
4592 double v14; // st7@14 | |
4593 signed int v15; // eax@14 | |
4594 int v16; // eax@15 | |
4595 float v17; // ST48_4@15 | |
4596 char v18; // zf@17 | |
4597 int v19; // eax@18 | |
4598 int v20; // eax@18 | |
4599 int v21; // edx@20 | |
4600 signed int v22; // ecx@20 | |
4601 int v23; // eax@20 | |
4602 const char *v24; // ST4C_4@20 | |
4603 unsigned int v25; // ST50_4@20 | |
4604 int v26; // ST54_4@20 | |
4605 int v27; // eax@20 | |
4606 _UNKNOWN *v28; // eax@21 | |
4607 int v29; // ecx@23 | |
4608 int v30; // eax@23 | |
4609 int v31; // eax@23 | |
4610 int v32; // eax@24 | |
4611 int v33; // eax@25 | |
4612 int v34; // eax@25 | |
4613 int v35; // eax@25 | |
4614 int v36; // eax@25 | |
4615 signed int v37; // ecx@26 | |
4616 int v38; // eax@26 | |
4617 _UNKNOWN *v39; // eax@27 | |
4618 int v40; // edx@28 | |
4619 int v41; // eax@29 | |
4620 int v42; // eax@29 | |
4621 int v43; // eax@29 | |
4622 int v44; // eax@29 | |
4623 unsigned int v46; // eax@29 | |
4624 int v47; // eax@30 | |
4625 int v48; // eax@30 | |
4626 int v49; // eax@30 | |
4627 double v52; // st6@35 | |
4628 const char *v55; // [sp+4Ch] [bp-1Ch]@20 | |
4629 int v57; // [sp+5Ch] [bp-Ch]@3 | |
4630 signed int v59; // [sp+60h] [bp-8h]@12 | |
4631 int v61; // [sp+64h] [bp-4h]@4 | |
4632 int i; | |
4633 | |
4634 v6 = (int)this; | |
4635 v5 = 0; | |
4636 if (!this->uNumD3DSceneBegins) | |
4637 return; | |
4638 | |
4639 | |
4640 | |
4641 | |
186 | 4642 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
86 | 4643 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); |
4644 if (this->bUsingSpecular) | |
4645 { | |
186 | 4646 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
4647 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); | |
4648 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | |
86 | 4649 } |
4650 | |
4651 pVertices[0].pos.x = array_50AC10[0].vWorldViewProjX; | |
4652 pVertices[0].pos.y = array_50AC10[0].vWorldViewProjY; | |
1637 | 4653 pVertices[0].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[0].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist); |
86 | 4654 pVertices[0].rhw = 1.0 / (array_50AC10[0].vWorldViewPosition.x + 0.0000001000000011686097); |
4655 pVertices[0].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); | |
4656 pVertices[0].specular = 0; | |
4657 pVertices[0].texcoord.x = array_50AC10[0].u; | |
4658 pVertices[0].texcoord.y = array_50AC10[0].v; | |
4659 | |
4660 pVertices[1].pos.x = array_50AC10[3].vWorldViewProjX; | |
4661 pVertices[1].pos.y = array_50AC10[3].vWorldViewProjY; | |
1637 | 4662 pVertices[1].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[3].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist); |
86 | 4663 pVertices[1].rhw = 1.0 / (array_50AC10[3].vWorldViewPosition.x + 0.0000001000000011686097); |
4664 pVertices[1].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[3].vWorldViewPosition.x, 0, 0); | |
4665 pVertices[1].specular = 0; | |
4666 pVertices[1].texcoord.x = array_50AC10[3].u; | |
4667 pVertices[1].texcoord.y = array_50AC10[3].v; | |
4668 | |
4669 pVertices[2].pos.x = array_50AC10[1].vWorldViewProjX; | |
4670 pVertices[2].pos.y = array_50AC10[1].vWorldViewProjY; | |
1637 | 4671 pVertices[2].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[1].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist); |
86 | 4672 pVertices[2].rhw = 1.0 / (array_50AC10[1].vWorldViewPosition.x + 0.0000001000000011686097); |
4673 pVertices[2].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[1].vWorldViewPosition.x, 0, 0); | |
4674 pVertices[2].specular = 0; | |
4675 pVertices[2].texcoord.x = array_50AC10[1].u; | |
4676 pVertices[2].texcoord.y = array_50AC10[1].v; | |
4677 | |
4678 memcpy(pVertices + 3, pVertices + 2, sizeof(RenderVertexD3D3)); | |
4679 memcpy(pVertices + 4, pVertices + 1, sizeof(RenderVertexD3D3)); | |
4680 | |
4681 pVertices[5].pos.x = array_50AC10[2].vWorldViewProjX; | |
4682 pVertices[5].pos.y = array_50AC10[2].vWorldViewProjY; | |
1637 | 4683 pVertices[5].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[2].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist); |
86 | 4684 pVertices[5].rhw = 1.0 / (array_50AC10[2].vWorldViewPosition.x + 0.0000001000000011686097); |
4685 pVertices[5].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[2].vWorldViewPosition.x, 0, 0); | |
4686 pVertices[5].specular = 0; | |
4687 pVertices[5].texcoord.x = array_50AC10[2].u; | |
4688 pVertices[5].texcoord.y = array_50AC10[2].v; | |
4689 | |
4690 | |
4691 this->pRenderD3D->pDevice->SetTexture(0, pTexture); | |
4692 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, 6, D3DDP_DONOTLIGHT); | |
4693 | |
186 | 4694 }*/ |
4695 | |
0 | 4696 //----- (004A26BC) -------------------------------------------------------- |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4697 void Render::DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders) |
186 | 4698 { |
4699 //RenderVertexSoft *pVertices; // esi@0 | |
4700 //int v7; // edi@1 | |
0 | 4701 unsigned int v8; // ebx@1 |
4702 LightmapBuilder *v9; // esi@3 | |
4703 unsigned int v10; // edx@3 | |
4704 int v11; // eax@5 | |
4705 int v12; // eax@11 | |
4706 char *v13; // esi@11 | |
4707 double v14; // st7@13 | |
4708 double v15; // st7@13 | |
4709 signed int v16; // eax@13 | |
4710 int v17; // ecx@13 | |
4711 double v18; // st7@13 | |
4712 float v19; // ST78_4@14 | |
4713 int v20; // eax@14 | |
4714 char v21; // zf@16 | |
4715 HRESULT v22; // eax@17 | |
4716 HRESULT v23; // eax@17 | |
4717 HRESULT v24; // eax@19 | |
4718 HRESULT v25; // eax@19 | |
4719 unsigned int v26; // ecx@19 | |
4720 char *v27; // eax@20 | |
4721 HRESULT v28; // eax@22 | |
4722 HRESULT v29; // eax@22 | |
4723 HRESULT v30; // eax@23 | |
4724 HRESULT v31; // eax@24 | |
4725 HRESULT v32; // eax@24 | |
4726 HRESULT v33; // eax@24 | |
4727 HRESULT v34; // eax@24 | |
4728 HRESULT v35; // eax@25 | |
4729 HRESULT v36; // eax@25 | |
4730 unsigned int v37; // ecx@25 | |
4731 char *v38; // eax@26 | |
4732 int v39; // edx@27 | |
4733 HRESULT v40; // eax@28 | |
4734 HRESULT v41; // eax@28 | |
4735 HRESULT v42; // eax@28 | |
4736 HRESULT v43; // eax@28 | |
4737 //IDirect3DDevice3Vtbl *v44; // ebx@28 | |
4738 unsigned int v45; // eax@28 | |
4739 HRESULT v46; // eax@29 | |
4740 HRESULT v47; // eax@29 | |
4741 HRESULT v48; // eax@29 | |
186 | 4742 //IDirect3DDevice3 *v49; // eax@35 |
0 | 4743 //IDirect3DDevice3Vtbl *v50; // ecx@35 |
4744 int v51; // eax@40 | |
4745 char *v52; // esi@40 | |
4746 double v53; // st7@42 | |
4747 double v54; // st7@42 | |
4748 signed int v55; // eax@42 | |
4749 int v56; // ecx@42 | |
4750 double v57; // st7@42 | |
4751 float v58; // ST7C_4@43 | |
4752 int v59; // eax@43 | |
186 | 4753 //signed int v60; // [sp+78h] [bp-14h]@31 |
4754 //RenderVertexSoft *v61; // [sp+7Ch] [bp-10h]@3 | |
0 | 4755 const char *v62; // [sp+80h] [bp-Ch]@0 |
4756 const char *v63; // [sp+80h] [bp-Ch]@19 | |
4757 int v64; // [sp+84h] [bp-8h]@0 | |
4758 LightmapBuilder *v65; // [sp+88h] [bp-4h]@3 | |
4759 unsigned int v66; // [sp+88h] [bp-4h]@40 | |
4760 unsigned int a6a; // [sp+A0h] [bp+14h]@11 | |
186 | 4761 int a7; |
4762 | |
4763 //v7 = (int)this; | |
0 | 4764 v8 = 0; |
186 | 4765 if (!this->uNumD3DSceneBegins) |
75 | 4766 return; |
4767 if ( uNumVertices < 3) | |
4768 return; | |
4769 | |
186 | 4770 //v61 = pVertices; |
4771 | |
75 | 4772 /* v9 = pGame->pLightmapBuilder; |
0 | 4773 v65 = v9; |
75 | 4774 v10 = v9->std__vector_000004_size;*/ |
1394 | 4775 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) |
0 | 4776 { |
638 | 4777 v11 = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); |
1394 | 4778 pGame->pLightmapBuilder->DrawLightmaps(/*v11, 0*/); |
0 | 4779 } |
4780 else | |
4781 { | |
186 | 4782 if (transparent || !pGame->pLightmapBuilder->std__vector_000004_size || |
75 | 4783 byte_4D864C && pGame->uFlags & 2 ) |
4784 { | |
186 | 4785 if (clampAtTextureBorders) |
4786 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP); | |
0 | 4787 else |
186 | 4788 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
4789 | |
4790 if (transparent || this->bUsingSpecular) | |
4791 { | |
4792 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); | |
4793 if (transparent) | |
0 | 4794 { |
186 | 4795 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA); |
4796 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA); | |
4797 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO); | |
4798 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); | |
0 | 4799 } |
4800 else | |
4801 { | |
186 | 4802 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); |
4803 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | |
0 | 4804 } |
186 | 4805 } |
1073 | 4806 |
4807 for (uint i = 0; i < uNumVertices; ++i) | |
4808 { | |
4809 | |
4810 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
4811 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
1637 | 4812 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); |
1073 | 4813 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); |
4814 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
4815 if ( this->bUsingSpecular ) | |
0 | 4816 { |
1073 | 4817 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 4818 } |
1073 | 4819 else |
4820 { | |
4821 d3d_vertex_buffer[i].specular = 0; | |
4822 } | |
4823 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
4824 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
4825 } | |
4826 | |
4827 this->pRenderD3D->pDevice->SetTexture(0, a5); | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4828 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer, uNumVertices, 16); |
186 | 4829 if (transparent) |
4830 { | |
4831 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
4832 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
4833 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 4834 } |
4835 } | |
4836 else | |
4837 { | |
1073 | 4838 for (uint i = 0; i < uNumVertices; ++i) |
4839 { | |
4840 | |
4841 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
4842 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
1637 | 4843 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); |
1073 | 4844 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); |
4845 d3d_vertex_buffer[i].diffuse = GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
4846 if ( this->bUsingSpecular ) | |
0 | 4847 { |
1073 | 4848 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 4849 } |
1073 | 4850 else |
4851 { | |
4852 d3d_vertex_buffer[i].specular = 0; | |
4853 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
4854 __debugbreak(); // warning C4700: uninitialized local variable 'v20' used |
1073 | 4855 d3d_vertex_buffer[i].specular = v20; |
4856 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
4857 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
4858 } | |
186 | 4859 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
4860 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
4861 if (pRenderer->bUsingSpecular) | |
4862 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); | |
0 | 4863 |
4864 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | |
186 | 4865 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
0 | 4866 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4867 d3d_vertex_buffer, |
0 | 4868 uNumVertices, |
4869 16)); | |
4870 //v63 = (const char *)v7->pRenderD3D->pDevice; | |
186 | 4871 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
0 | 4872 //(*(void (**)(void))(*(int *)v63 + 88))(); |
1394 | 4873 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
1073 | 4874 for (uint i = 0; i < uNumVertices; ++i) |
4875 { | |
4876 d3d_vertex_buffer[i].diffuse = -1; | |
4877 } | |
0 | 4878 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); |
186 | 4879 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 4880 if ( !pRenderer->bUsingSpecular ) |
4881 { | |
186 | 4882 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
4883 } | |
4884 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
4885 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
4886 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
4887 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
0 | 4888 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4889 d3d_vertex_buffer, |
0 | 4890 uNumVertices, |
4891 16)); | |
4892 if ( pRenderer->bUsingSpecular ) | |
4893 { | |
186 | 4894 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
0 | 4895 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); |
1073 | 4896 for (uint i = 0; i < uNumVertices; ++i) |
4897 { | |
4898 d3d_vertex_buffer[i].diffuse = pRenderer->uFogColor | d3d_vertex_buffer[i].specular & 0xFF000000; | |
4899 d3d_vertex_buffer[i].specular = 0; | |
4900 } | |
4901 | |
75 | 4902 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem |
186 | 4903 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
4904 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); | |
4905 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
0 | 4906 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4907 d3d_vertex_buffer, |
0 | 4908 uNumVertices, |
4909 16)); | |
186 | 4910 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 4911 //v44 = pRenderer->pRenderD3D->pDevice; |
4912 v45 = GetLevelFogColor(); | |
4913 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, v45 & 0xFFFFFF)); | |
4914 v8 = 0; | |
4915 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
4916 } | |
186 | 4917 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
4918 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 4919 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v8)); |
4920 } | |
4921 } | |
186 | 4922 |
791 | 4923 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
|
4924 pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); |
0 | 4925 } |
4926 // 4A26BC: could not find valid save-restore pair for esi | |
4927 // 4D864C: using guessed type char byte_4D864C; | |
4928 | |
4929 //----- (004A2DA3) -------------------------------------------------------- | |
1427 | 4930 void Render::DrawSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture) |
852 | 4931 { |
67 | 4932 int v7; // eax@7 |
4933 | |
4934 if ( !this->uNumD3DSceneBegins ) | |
4935 return; | |
4936 if ( uNumVertices >= 3 ) | |
4937 { | |
186 | 4938 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
67 | 4939 if ( this->bUsingSpecular ) |
4940 { | |
186 | 4941 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
4942 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); | |
4943 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | |
67 | 4944 } |
1427 | 4945 for ( uint i = 0; i < uNumVertices; ++i ) |
67 | 4946 { |
4947 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
4948 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
4949 pVertices[i].pos.z = 0.99989998; | |
168 | 4950 pVertices[i].rhw = array_50AC10[i]._rhw; |
67 | 4951 |
840 | 4952 pVertices[i].diffuse = ::GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); |
67 | 4953 v7 = 0; |
4954 if (this->bUsingSpecular) | |
1427 | 4955 v7 = sub_47C3D7_get_fog_related_stuff(0, 1, array_50AC10[i].vWorldViewPosition.x); |
67 | 4956 pVertices[i].specular = v7; |
4957 pVertices[i].texcoord.x = array_50AC10[i].u; | |
4958 pVertices[i].texcoord.y = array_50AC10[i].v; | |
4959 } | |
4960 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture); | |
4961 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
840 | 4962 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); |
0 | 4963 } |
4964 } | |
4965 | |
4966 //----- (004A2ED5) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4967 void Render::_4A2ED5(signed int a2, struct Polygon *a3, IDirect3DTexture2 *pHwTex) |
0 | 4968 { |
4969 signed int v4; // edi@2 | |
4970 int v5; // eax@3 | |
4971 int v6; // edx@5 | |
1072 | 4972 RenderVertexD3D3 *v7; // eax@6 |
4973 RenderVertexSoft *v8; // ecx@6 | |
4974 //double v9; // st6@7 | |
4975 //int v10; // ebx@7 | |
4976 //int v11; // ebx@7 | |
0 | 4977 |
4978 if ( this->uNumD3DSceneBegins ) | |
4979 { | |
4980 v4 = a2; | |
4981 if ( a2 >= 3 ) | |
4982 { | |
186 | 4983 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
638 | 4984 v5 = 31 - (a3->dimming_level & 0x1F); |
4985 if ( v5 < pOutdoor->max_terrain_dimming_level ) | |
4986 v5 = pOutdoor->max_terrain_dimming_level; | |
0 | 4987 v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); |
1072 | 4988 for (uint i = 0; i < a2; ++i) |
4989 { | |
4990 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | |
4991 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
4992 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / array_507D30[i].vWorldViewPosition.y; | |
4993 d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw; | |
4994 d3d_vertex_buffer[i].diffuse = v6; | |
4995 d3d_vertex_buffer[i].specular = 0; | |
4996 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u; | |
4997 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v; | |
4998 } | |
4999 | |
0 | 5000 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
186 | 5001 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
0 | 5002 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5003 d3d_vertex_buffer, |
0 | 5004 a2, |
5005 28)); | |
5006 } | |
5007 } | |
5008 } | |
5009 | |
1390 | 5010 |
5011 //----- (00479A53) -------------------------------------------------------- | |
5012 void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID) | |
5013 { | |
5014 BLVFace *pFace; // esi@1 | |
5015 unsigned int v3; // edi@1 | |
5016 PolygonType v4; // al@1 | |
5017 double v5; // st7@3 | |
5018 signed __int64 v6; // qax@3 | |
5019 PolygonType v7; // cl@3 | |
5020 int v8; // esi@7 | |
5021 int v9; // eax@7 | |
5022 unsigned int v10; // eax@7 | |
5023 double v11; // st6@7 | |
5024 int v12; // edx@7 | |
5025 int v13; // eax@7 | |
5026 char *v14; // esi@8 | |
5027 void *v15; // ecx@9 | |
5028 int v16; // eax@9 | |
5029 int v17; // edi@9 | |
5030 double v18; // st7@9 | |
5031 signed int v19; // ebx@9 | |
5032 void *v20; // ecx@9 | |
5033 int v21; // ebx@11 | |
5034 int v22; // eax@14 | |
5035 signed __int64 v23; // qtt@16 | |
5036 double v24; // st7@16 | |
5037 unsigned __int8 v25; // sf@16 | |
5038 unsigned __int8 v26; // of@16 | |
5039 Render *v27; // ecx@17 | |
5040 double v28; // st7@20 | |
5041 char *v29; // ebx@20 | |
5042 char *v30; // edx@20 | |
5043 unsigned __int8 v31; // c0@21 | |
5044 unsigned __int8 v32; // c3@21 | |
5045 double v33; // st6@23 | |
5046 char *v34; // esi@30 | |
5047 const void *v35; // ecx@31 | |
5048 int v36; // eax@31 | |
5049 const void *v37; // edi@31 | |
5050 signed __int64 v38; // qax@31 | |
5051 int v39; // ecx@31 | |
5052 int v40; // ebx@33 | |
5053 int v41; // eax@36 | |
5054 signed __int64 v42; // qtt@39 | |
5055 int v43; // eax@39 | |
5056 char v44; // zf@39 | |
5057 double v45; // st7@39 | |
5058 double v46; // st7@39 | |
5059 unsigned int v47; // edx@40 | |
5060 double v48; // st7@41 | |
5061 RenderVertexSoft *v49; // ebx@41 | |
5062 void *v50; // edi@43 | |
5063 double v51; // st7@46 | |
5064 RenderVertexSoft *v52; // edx@46 | |
5065 void *v53; // edi@48 | |
5066 char *v54; // ebx@52 | |
5067 unsigned int v55; // eax@53 | |
5068 unsigned int v56; // eax@55 | |
5069 int v57; // ST10_4@55 | |
5070 Texture *v58; // eax@55 | |
5071 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
|
5072 struct Polygon *v60; // [sp+0h] [bp-174h]@17 |
1390 | 5073 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
|
5074 struct Polygon v62; // [sp+14h] [bp-160h]@6 |
1390 | 5075 unsigned int v63; // [sp+120h] [bp-54h]@7 |
5076 double v64; // [sp+124h] [bp-50h]@7 | |
5077 unsigned int v65; // [sp+128h] [bp-4Ch]@1 | |
5078 unsigned int v66; // [sp+12Ch] [bp-48h]@7 | |
5079 float v67; // [sp+130h] [bp-44h]@7 | |
5080 __int64 v68; // [sp+134h] [bp-40h]@3 | |
5081 __int64 v69; // [sp+13Ch] [bp-38h]@3 | |
5082 int v70; // [sp+144h] [bp-30h]@3 | |
5083 int X; // [sp+148h] [bp-2Ch]@9 | |
5084 int v72; // [sp+14Ch] [bp-28h]@7 | |
5085 float v73; // [sp+150h] [bp-24h]@16 | |
5086 unsigned int v74; // [sp+154h] [bp-20h]@3 | |
5087 RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3 | |
5088 float v76; // [sp+15Ch] [bp-18h]@9 | |
5089 int v77; // [sp+160h] [bp-14h]@9 | |
5090 int v78; // [sp+164h] [bp-10h]@7 | |
5091 void *v79; // [sp+168h] [bp-Ch]@9 | |
5092 float v80; // [sp+16Ch] [bp-8h]@3 | |
5093 const void *v81; // [sp+170h] [bp-4h]@7 | |
5094 | |
5095 __debugbreak(); | |
5096 | |
5097 pFace = &pIndoor->pFaces[uFaceID]; | |
5098 v65 = uFaceID; | |
5099 v3 = uNumVertices; | |
5100 v4 = pFace->uPolygonType; | |
5101 if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor ) | |
5102 { | |
5103 if ( (signed int)uNumVertices > 0 ) | |
5104 { | |
5105 v54 = (char *)&array_507D30[0].u; | |
5106 LODWORD(v80) = uNumVertices; | |
5107 do | |
5108 { | |
5109 v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x; | |
5110 *(float *)v54 = (double)v69 + *(float *)v54; | |
5111 *(float *)v54 = *(float *)v54 * 0.25; | |
5112 v55 = GetTickCount(); | |
5113 v54 += 48; | |
5114 v44 = LODWORD(v80)-- == 1; | |
5115 v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5); | |
5116 *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; | |
5117 } | |
5118 while ( !v44 ); | |
5119 uFaceID = v65; | |
5120 } | |
5121 v56 = 8 * uFaceID; | |
5122 LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); | |
5123 v57 = v56; | |
5124 v58 = pFace->GetTexture(); | |
5125 pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); | |
5126 return; | |
5127 } | |
5128 HIDWORD(v69) = pIndoorCamera->sRotationX; | |
5129 HIDWORD(v68) = pIndoorCamera->pos.z; | |
5130 *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; | |
5131 v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z) | |
5132 / (((double)pBLVRenderParams->field_40 + 16192.0) | |
5133 * 65536.0) | |
5134 + *(float *)&v74); | |
5135 v5 = (double)pIndoorCamera->sRotationX * 0.0030664064; | |
5136 *(float *)&v75 = v5; | |
5137 v80 = cos(v5) * 16192.0; | |
5138 v6 = (signed __int64)(*(float *)&v74 | |
5139 - (double)pBLVRenderParams->field_40 | |
5140 / ((v80 + 0.0000001) | |
5141 * 65535.0) | |
5142 * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68))); | |
5143 v7 = pFace->uPolygonType; | |
5144 if ( v7 == 4 || v7 == 3 ) | |
5145 v70 = v6; | |
1544 | 5146 stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); |
1427 | 5147 v62.Create_48607B(&stru_8019C8); |
1390 | 5148 v62.uTileBitmapID = pFace->uBitmapID; |
5149 v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); | |
5150 if ( !v62.pTexture ) | |
5151 return; | |
5152 v8 = pBLVRenderParams->sPartyRotX; | |
5153 v62.dimming_level = 0; | |
5154 v62.uNumVertices = v3; | |
5155 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); | |
5156 v62.v_18.y = 0; | |
5157 v62.v_18.x = -v9; | |
5158 v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); | |
5159 v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; | |
5160 memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); | |
5161 LODWORD(v80) = v10; | |
5162 v62.field_24 = 33554432; | |
5163 v64 = (double)(signed int)v10 * 0.5; | |
5164 v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); | |
5165 LODWORD(v80) = v62.pTexture->uTextureWidth; | |
5166 v11 = 1.0 / (double)SLODWORD(v80); | |
5167 LODWORD(v80) = v62.pTexture->uTextureHeight; | |
5168 v12 = v62.pTexture->uWidthMinus1; | |
5169 v13 = v62.pTexture->uHeightMinus1; | |
5170 v67 = v11; | |
5171 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; | |
5172 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; | |
5173 v78 = 0; | |
5174 v81 = 0; | |
5175 *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80); | |
5176 if ( (signed int)v62.uNumVertices <= 0 ) | |
5177 { | |
5178 LABEL_17: | |
5179 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; | |
5180 v27 = pRenderer; | |
5181 v60 = &v62; | |
5182 v59 = v62.uNumVertices; | |
5183 goto LABEL_18; | |
5184 } | |
5185 v14 = (char *)&array_507D30[0].vWorldViewProjY; | |
5186 while ( 2 ) | |
5187 { | |
5188 v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14)); | |
5189 LODWORD(v80) = v62.ptr_38->field_14; | |
5190 v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; | |
5191 v16 = v77 + v62.ptr_38->field_C; | |
5192 v77 = (int)v15; | |
5193 v74 = v16; | |
5194 LODWORD(v80) = v62.ptr_38->field_20; | |
5195 v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; | |
5196 v79 = v15; | |
5197 v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18); | |
5198 LODWORD(v80) = v62.v_18.z; | |
5199 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16); | |
5200 v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1)); | |
5201 v18 = *(float *)v14 - 1.0; | |
5202 v19 = -v62.field_24; | |
5203 v77 = -v62.field_24; | |
5204 X = (int)((char *)v79 + v62.v_18.x); | |
5205 LODWORD(v76) = (signed __int64)v18; | |
5206 v20 = (void *)(v72 * (v70 - LODWORD(v76))); | |
5207 while ( 1 ) | |
5208 { | |
5209 v79 = v20; | |
5210 if ( !X ) | |
5211 goto LABEL_14; | |
5212 v21 = abs(v19 >> 14); | |
5213 if ( v21 <= abs(X) ) | |
5214 break; | |
5215 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) | |
5216 break; | |
5217 v19 = v77; | |
5218 v20 = v79; | |
5219 LABEL_14: | |
5220 LODWORD(v80) = v62.v_18.z; | |
5221 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16); | |
5222 v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16; | |
5223 --LODWORD(v76); | |
5224 v20 = (char *)v20 + v72; | |
5225 X = v22 + v62.v_18.x; | |
5226 v78 = 1; | |
5227 } | |
5228 if ( !v78 ) | |
5229 { | |
5230 LODWORD(v23) = v77 << 16; | |
5231 HIDWORD(v23) = v77 >> 16; | |
5232 v79 = (void *)(v23 / X); | |
5233 v77 = v17; | |
5234 LODWORD(v80) = v62.ptr_38->field_10; | |
5235 v77 = v17; | |
5236 LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16); | |
5237 LODWORD(v80) = v62.ptr_38->field_1C; | |
5238 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16)); | |
5239 v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; | |
5240 LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; | |
5241 v14 += 48; | |
5242 LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); | |
5243 v81 = (char *)v81 + 1; | |
5244 v24 = (double)SLODWORD(v80) * 0.000015259022; | |
5245 LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); | |
5246 v26 = __OFSUB__((int)v81, v62.uNumVertices); | |
5247 v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0; | |
5248 *((float *)v14 - 10) = v24 * v67; | |
5249 *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1); | |
5250 *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79; | |
5251 if ( !(v25 ^ v26) ) | |
5252 goto LABEL_17; | |
5253 continue; | |
5254 } | |
5255 break; | |
5256 } | |
5257 LODWORD(v73) = 0; | |
5258 v80 = v76; | |
5259 if ( (signed int)v62.uNumVertices > 0 ) | |
5260 { | |
5261 v28 = (double)SLODWORD(v76); | |
5262 LODWORD(v76) = (int)(char *)array_50AC10 + 28; | |
5263 v29 = (char *)&array_50AC10[0].vWorldViewProjX; | |
5264 v30 = (char *)&array_507D30[1].vWorldViewProjY; | |
5265 v79 = array_50AC10; | |
5266 v81 = array_507D30; | |
5267 v78 = v62.uNumVertices; | |
5268 do | |
5269 { | |
5270 v31 = v28 < *((float *)v30 - 12); | |
5271 v32 = v28 == *((float *)v30 - 12); | |
5272 ++LODWORD(v73); | |
5273 memcpy(v79, v81, 0x30u); | |
5274 v79 = (char *)v79 + 48; | |
5275 LODWORD(v76) += 48; | |
5276 v29 += 48; | |
5277 if ( v31 | v32 || v28 >= *(float *)v30 ) | |
5278 { | |
5279 if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 ) | |
5280 goto LABEL_28; | |
5281 v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12)) | |
5282 + *((float *)v30 - 1); | |
5283 } | |
5284 else | |
5285 { | |
5286 v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30) | |
5287 + *((float *)v30 - 13); | |
5288 } | |
5289 *(float *)v29 = v33; | |
5290 v79 = (char *)v79 + 48; | |
5291 v29 += 48; | |
5292 ++LODWORD(v73); | |
5293 *(unsigned int *)LODWORD(v76) = v28; | |
5294 LODWORD(v76) += 48; | |
5295 LABEL_28: | |
5296 v81 = (char *)v81 + 48; | |
5297 v30 += 48; | |
5298 --v78; | |
5299 } | |
5300 while ( v78 ); | |
5301 } | |
5302 if ( SLODWORD(v73) <= 0 ) | |
5303 goto LABEL_40; | |
5304 v34 = (char *)&array_50AC10[0].vWorldViewProjY; | |
5305 v65 = v77 >> 14; | |
5306 HIDWORD(v69) = LODWORD(v73); | |
5307 do | |
5308 { | |
5309 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); | |
5310 v78 = v62.ptr_38->field_14; | |
5311 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); | |
5312 v36 = (int)((char *)v81 + v62.ptr_38->field_C); | |
5313 v81 = v35; | |
5314 v74 = v36; | |
5315 v78 = v62.ptr_38->field_20; | |
5316 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); | |
5317 v78 = (int)v35; | |
5318 v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->field_18); | |
5319 v81 = (const void *)v62.v_18.z; | |
5320 v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16; | |
5321 v37 = (const void *)(v72 | |
5322 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); | |
5323 v38 = (signed __int64)(*(float *)v34 - 1.0); | |
5324 v81 = 0; | |
5325 LODWORD(v76) = v38; | |
5326 v39 = v72 * (v70 - v38); | |
5327 while ( 1 ) | |
5328 { | |
5329 v78 = v39; | |
5330 if ( !X ) | |
5331 goto LABEL_36; | |
5332 v40 = abs(X); | |
5333 if ( abs((signed __int64)v65) <= v40 ) | |
5334 break; | |
5335 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) | |
5336 break; | |
5337 v39 = v78; | |
5338 LABEL_36: | |
5339 v78 = v62.v_18.z; | |
5340 v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; | |
5341 --LODWORD(v76); | |
5342 v39 += v72; | |
5343 X = v41 + v62.v_18.x; | |
5344 v81 = (const void *)1; | |
5345 } | |
5346 if ( v81 ) | |
5347 { | |
5348 v79 = (void *)v62.v_18.z; | |
5349 v78 = 2 * LODWORD(v76); | |
5350 v81 = (const void *)((unsigned __int64)(v62.v_18.z | |
5351 * (signed __int64)(signed int)(signed __int64)(((double)v70 | |
5352 - ((double)(2 * LODWORD(v76)) | |
5353 - *(float *)v34)) | |
5354 * (double)v72)) >> 16); | |
5355 X = (int)((char *)v81 + v62.v_18.x); | |
5356 } | |
5357 LODWORD(v42) = v77 << 16; | |
5358 HIDWORD(v42) = v77 >> 16; | |
5359 v79 = (void *)(v42 / X); | |
5360 v81 = v37; | |
5361 v78 = v62.ptr_38->field_10; | |
5362 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); | |
5363 v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); | |
5364 v74 = (unsigned int)v37; | |
5365 LODWORD(v76) = v43; | |
5366 v78 = v62.ptr_38->field_1C; | |
5367 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); | |
5368 v74 = (unsigned __int64)(v43 * v42 / X) >> 16; | |
5369 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); | |
5370 v34 += 48; | |
5371 v78 = v66 + ((signed int)v74 >> 4); | |
5372 v44 = HIDWORD(v69)-- == 1; | |
5373 v45 = (double)v78 * 0.000015259022; | |
5374 v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); | |
5375 *((float *)v34 - 10) = v45 * v67; | |
5376 *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1); | |
5377 v46 = (double)(signed int)v79; | |
5378 *((float *)v34 - 16) = 0.000015258789 * v46; | |
5379 *((float *)v34 - 11) = 65536.0 / v46; | |
5380 } | |
5381 while ( !v44 ); | |
5382 LABEL_40: | |
5383 v47 = 0; | |
5384 if ( SLODWORD(v73) > 0 ) | |
5385 { | |
5386 v48 = (double)SLODWORD(v80); | |
5387 v75 = array_507D30; | |
5388 v49 = array_50AC10; | |
5389 HIDWORD(v69) = LODWORD(v73); | |
5390 do | |
5391 { | |
5392 if ( v48 >= v49->vWorldViewProjY ) | |
5393 { | |
5394 v50 = v75; | |
5395 ++v47; | |
5396 ++v75; | |
5397 memcpy(v50, v49, 0x30u); | |
5398 } | |
5399 ++v49; | |
5400 --HIDWORD(v69); | |
5401 } | |
5402 while ( HIDWORD(v69) ); | |
5403 } | |
5404 v62.uNumVertices = v47; | |
5405 pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]); | |
5406 *(float *)&v74 = 0.0; | |
5407 if ( SLODWORD(v73) > 0 ) | |
5408 { | |
5409 v51 = (double)SLODWORD(v80); | |
5410 v75 = array_507D30; | |
5411 v52 = array_50AC10; | |
5412 v80 = v73; | |
5413 do | |
5414 { | |
5415 if ( v51 <= v52->vWorldViewProjY ) | |
5416 { | |
5417 v53 = v75; | |
5418 ++v74; | |
5419 ++v75; | |
5420 memcpy(v53, v52, 0x30u); | |
5421 } | |
5422 ++v52; | |
5423 --LODWORD(v80); | |
5424 } | |
5425 while ( v80 != 0.0 ); | |
5426 } | |
5427 v62.uNumVertices = v74; | |
5428 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; | |
5429 v60 = &v62; | |
5430 v59 = v74; | |
5431 v27 = pRenderer; | |
5432 LABEL_18: | |
5433 v27->_4A2ED5(v59, v60, v61); | |
5434 } | |
5435 | |
5436 | |
0 | 5437 //----- (004A2FC0) -------------------------------------------------------- |
5438 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) | |
5439 { | |
5440 //Render *v8; // edi@1 | |
5441 //unsigned int v9; // esi@3 | |
1072 | 5442 RenderVertexSoft *v12; // ecx@9 |
5443 RenderVertexD3D3 *v13; // eax@9 | |
0 | 5444 double v14; // st6@10 |
5445 int v15; // edx@10 | |
5446 Texture *v16; // edx@10 | |
5447 double v17; // st6@10 | |
5448 //char v18; // zf@10 | |
5449 Texture *v19; // edx@10 | |
595 | 5450 //Texture *v23; // edx@16 |
5451 //char *v24; // ecx@16 | |
5452 //char *v25; // eax@16 | |
5453 //double v26; // st6@17 | |
5454 //int v27; // esi@17 | |
5455 //double v28; // st6@17 | |
5456 //unsigned int v33; // ecx@18 | |
5457 //char *v34; // eax@19 | |
0 | 5458 //Texture *v45; // edx@23 |
5459 //char *v46; // ecx@23 | |
5460 //char *v47; // eax@23 | |
5461 //double v48; // st6@24 | |
5462 //int v49; // esi@24 | |
5463 //double v50; // st6@24 | |
5464 const char *v53; // [sp-Ch] [bp-20h]@21 | |
5465 //int v54; // [sp-8h] [bp-1Ch]@21 | |
5466 //unsigned int v55; // [sp-4h] [bp-18h]@21 | |
5467 const char *v56; // [sp+0h] [bp-14h]@0 | |
5468 int v57; // [sp+4h] [bp-10h]@0 | |
5469 unsigned int v58; // [sp+8h] [bp-Ch]@0 | |
5470 //LightmapBuilder *v59; // [sp+Ch] [bp-8h]@3 | |
5471 //int a3a; // [sp+10h] [bp-4h]@4 | |
5472 | |
5473 //v8 = this; | |
5474 if (!uNumD3DSceneBegins || uNumVertices < 3) | |
5475 return; | |
5476 | |
5477 //auto a3 = pFace; | |
5478 //auto a6 = uPackedID; | |
5479 //v59 = pGame->pLightmapBuilder; | |
5480 //v9 = v59->std__vector_000004_size; | |
5481 | |
5482 auto uCorrectedColor = uColor; | |
5483 if (pGame->pLightmapBuilder->std__vector_000004_size) | |
5484 uCorrectedColor = 0xFFFFFFFF; | |
638 | 5485 pGame->AlterGamma_BLV(pFace, &uCorrectedColor); |
0 | 5486 |
792 | 5487 |
5488 if (pFace->uAttributes & FACE_OUTLINED) | |
5489 { | |
5490 int color; | |
5491 if (GetTickCount() % 300 >= 150) | |
5492 uColor = uCorrectedColor = 0xFF20FF20; | |
5493 else uColor = uCorrectedColor = 0xFF109010; | |
5494 } | |
5495 | |
1394 | 5496 if (byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) |
0 | 5497 { |
5498 __debugbreak(); | |
5499 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | |
186 | 5500 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
1072 | 5501 for (uint i = 0; i < uNumVertices; ++i) |
5502 { | |
5503 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | |
5504 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
5505 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | |
5506 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | |
5507 d3d_vertex_buffer[i].diffuse = uCorrectedColor; | |
5508 d3d_vertex_buffer[i].specular = 0; | |
5509 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | |
5510 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | |
5511 } | |
5512 | |
186 | 5513 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 5514 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
5515 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | |
5516 D3DPT_TRIANGLEFAN, | |
5517 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5518 d3d_vertex_buffer, |
0 | 5519 uNumVertices, |
5520 28)); | |
1394 | 5521 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
0 | 5522 } |
5523 else | |
5524 { | |
5525 if (!pGame->pLightmapBuilder->std__vector_000004_size || | |
5526 byte_4D864C && pGame->uFlags & 2) | |
5527 { | |
5528 for (uint i = 0; i < uNumVertices; ++i) | |
5529 { | |
186 | 5530 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; |
5531 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
5532 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | |
5533 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | |
5534 d3d_vertex_buffer[i].diffuse = uCorrectedColor; | |
5535 d3d_vertex_buffer[i].specular = 0; | |
5536 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | |
5537 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | |
5538 } | |
5539 | |
5540 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
0 | 5541 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
5542 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
5543 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5544 d3d_vertex_buffer, |
0 | 5545 uNumVertices, |
5546 28)); | |
5547 } | |
5548 else | |
5549 { | |
595 | 5550 for (uint i = 0; i < uNumVertices; ++i) |
5551 { | |
5552 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | |
5553 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
5554 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | |
5555 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | |
5556 d3d_vertex_buffer[i].diffuse = uColor; | |
5557 d3d_vertex_buffer[i].specular = 0; | |
5558 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | |
5559 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | |
5560 } | |
5561 //__debugbreak(); | |
5562 //if ( (signed int)uNumVertices > 0 ) | |
5563 //{ | |
5564 //v23 = pTex; | |
5565 //v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
5566 //v25 = (char *)&d3d_vertex_buffer[0].pos.y; | |
5567 //pTex = (Texture *)uNumVertices; | |
5568 //uint v18; | |
5569 //do | |
5570 //{ | |
5571 //v26 = *(float *)v24 * 0.061758894; | |
5572 //v27 = *((int *)v24 + 3); | |
5573 //*((int *)v25 + 4) = 0; | |
5574 //*((int *)v25 - 1) = v27; | |
5575 //*(int *)v25 = *((int *)v24 + 4); | |
5576 //*((int *)v25 + 3) = uColor; | |
5577 //v25 += 32; | |
5578 //*((float *)v25 - 7) = 1.0 - 1.0 / v26; | |
5579 //v28 = 1.0 / *(float *)v24; | |
5580 //v24 += 48; | |
5581 //v18 = pTex == (Texture *)1; | |
5582 //pTex = (Texture *)((char *)pTex - 1); | |
5583 //*((float *)v25 - 6) = v28; | |
0 | 5584 //a3 = (BLVFace *)v23->uTextureWidth; |
595 | 5585 //*((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth; |
0 | 5586 //a3 = (BLVFace *)v23->uTextureHeight; |
595 | 5587 //*((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; |
5588 //} | |
5589 //while ( !v18 ); | |
5590 //} | |
0 | 5591 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); |
186 | 5592 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 5593 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
186 | 5594 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
0 | 5595 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5596 d3d_vertex_buffer, |
0 | 5597 uNumVertices, |
5598 28)); | |
595 | 5599 |
5600 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
1394 | 5601 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
595 | 5602 |
5603 for (uint i = 0; i < uNumVertices; ++i) | |
5604 d3d_vertex_buffer[i].diffuse = uCorrectedColor; | |
5605 /*v33 = uNumVertices; | |
0 | 5606 if ( (signed int)uNumVertices > 0 ) |
5607 { | |
186 | 5608 v34 = (char *)&d3d_vertex_buffer[0].diffuse; |
0 | 5609 do |
5610 { | |
5611 *(int *)v34 = uCorrectedColor; | |
5612 v34 += 32; | |
5613 --v33; | |
5614 } | |
5615 while ( v33 ); | |
595 | 5616 }*/ |
0 | 5617 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
186 | 5618 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
5619 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
5620 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
5621 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
5622 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
5623 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
0 | 5624 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5625 d3d_vertex_buffer, |
0 | 5626 uNumVertices, |
5627 28)); | |
186 | 5628 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
5629 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
5630 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
0 | 5631 } |
5632 } | |
5633 } | |
5634 // 4D864C: using guessed type char byte_4D864C; | |
5635 | |
5636 //----- (004A43B1) -------------------------------------------------------- | |
717 | 5637 void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level) |
5638 { | |
5639 //RenderBillboardTransform_local0 *v4; // ebx@2 | |
5640 //double v5; // st7@2 | |
5641 //float v6; // ST08_4@2 | |
0 | 5642 unsigned int v7; // eax@2 |
717 | 5643 //int v8; // ecx@2 |
5644 //unsigned int v9; // esi@2 | |
5645 //Sprite *v10; // edi@5 | |
0 | 5646 signed int v11; // eax@9 |
5647 signed int v12; // eax@9 | |
717 | 5648 //double v13; // st7@12 |
5649 //double v14; // st6@12 | |
0 | 5650 double v15; // st5@12 |
5651 double v16; // st4@12 | |
5652 double v17; // st3@12 | |
5653 double v18; // st2@12 | |
5654 int v19; // ecx@14 | |
5655 double v20; // st3@14 | |
5656 int v21; // ecx@16 | |
5657 double v22; // st3@16 | |
717 | 5658 //IDirect3DTexture2 *v23; // eax@18 |
5659 //signed int v24; // [sp+18h] [bp-18h]@5 | |
5660 //signed int v25; // [sp+1Ch] [bp-14h]@5 | |
5661 //Render *v26; // [sp+20h] [bp-10h]@1 | |
0 | 5662 float v27; // [sp+24h] [bp-Ch]@5 |
5663 int v28; // [sp+28h] [bp-8h]@2 | |
5664 float v29; // [sp+2Ch] [bp-4h]@5 | |
717 | 5665 //float pSoftBillboarda; // [sp+38h] [bp+8h]@2 |
0 | 5666 float v31; // [sp+3Ch] [bp+Ch]@5 |
717 | 5667 //float v32; // [sp+3Ch] [bp+Ch]@12 |
0 | 5668 float a1; // [sp+40h] [bp+10h]@5 |
5669 | |
717 | 5670 //v26 = this; |
0 | 5671 if ( this->uNumD3DSceneBegins ) |
5672 { | |
717 | 5673 //v4 = pSoftBillboard; |
5674 //v5 = (double)pSoftBillboard->zbuffer_depth; | |
5675 //pSoftBillboarda = pSoftBillboard->zbuffer_depth; | |
5676 //v6 = pSoftBillboard->zbuffer_depth; | |
5677 v7 = Billboard_ProbablyAddToListAndSortByZOrder(pSoftBillboard->zbuffer_depth); | |
5678 //v8 = dimming_level; | |
5679 //v9 = v7; | |
657 | 5680 v28 = dimming_level & 0xFF000000; |
5681 if ( dimming_level & 0xFF000000 ) | |
717 | 5682 pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Opaque_3; |
0 | 5683 else |
717 | 5684 pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Transparent; |
5685 //v10 = a3; | |
5686 pBillboardRenderListD3D[v7].field_90 = pSoftBillboard->field_44; | |
5687 pBillboardRenderListD3D[v7].sZValue = pSoftBillboard->sZValue; | |
5688 pBillboardRenderListD3D[v7].uParentBillboardID = pSoftBillboard->uParentBillboardID; | |
5689 //v25 = pSoftBillboard->uScreenSpaceX; | |
5690 //v24 = pSoftBillboard->uScreenSpaceY; | |
5691 a1 = (pSoftBillboard->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_x_scaler_packedfloat); | |
5692 v29 = (pSoftBillboard->_screenspace_y_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_y_scaler_packedfloat); | |
5693 v31 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); | |
5694 v27 = (double)(pSprite->uBufferHeight - pSprite->uAreaY); | |
5695 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 5696 v31 = v31 * -1.0; |
717 | 5697 if ( pSoftBillboard->uTintColor && this->bTinting ) |
5698 { | |
5699 v11 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); | |
737 | 5700 v12 = BlendColors(pSoftBillboard->uTintColor, v11); |
0 | 5701 if ( v28 ) |
5702 v12 = (unsigned int)((char *)&array_77EC08[1852].pEdgeList1[17] + 3) & ((unsigned int)v12 >> 1); | |
5703 } | |
5704 else | |
5705 { | |
717 | 5706 v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); |
5707 } | |
5708 //v13 = (double)v25; | |
1390 | 5709 pBillboardRenderListD3D[v7].pQuads[0].specular = 0; |
5710 pBillboardRenderListD3D[v7].pQuads[0].diffuse = v12; | |
5711 pBillboardRenderListD3D[v7].pQuads[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1; | |
717 | 5712 //v14 = (double)v24; |
5713 //v32 = v14; | |
1390 | 5714 pBillboardRenderListD3D[v7].pQuads[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29; |
717 | 5715 v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894); |
1390 | 5716 pBillboardRenderListD3D[v7].pQuads[0].pos.z = v15; |
717 | 5717 v16 = 1.0 / pSoftBillboard->zbuffer_depth; |
1390 | 5718 pBillboardRenderListD3D[v7].pQuads[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth; |
5719 pBillboardRenderListD3D[v7].pQuads[0].texcoord.x = 0.0; | |
5720 pBillboardRenderListD3D[v7].pQuads[0].texcoord.y = 0.0; | |
717 | 5721 v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); |
5722 v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight); | |
5723 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 5724 v17 = v17 * -1.0; |
1390 | 5725 pBillboardRenderListD3D[v7].pQuads[1].specular = 0; |
5726 pBillboardRenderListD3D[v7].pQuads[1].diffuse = v12; | |
5727 pBillboardRenderListD3D[v7].pQuads[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1; | |
5728 pBillboardRenderListD3D[v7].pQuads[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29; | |
5729 pBillboardRenderListD3D[v7].pQuads[1].pos.z = v15; | |
5730 pBillboardRenderListD3D[v7].pQuads[1].rhw = v16; | |
5731 pBillboardRenderListD3D[v7].pQuads[1].texcoord.x = 0.0; | |
5732 pBillboardRenderListD3D[v7].pQuads[1].texcoord.y = 1.0; | |
717 | 5733 v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight; |
5734 v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); | |
5735 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 5736 v20 = v20 * -1.0; |
1390 | 5737 pBillboardRenderListD3D[v7].pQuads[2].specular = 0; |
5738 pBillboardRenderListD3D[v7].pQuads[2].diffuse = v12; | |
5739 pBillboardRenderListD3D[v7].pQuads[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX; | |
5740 pBillboardRenderListD3D[v7].pQuads[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29; | |
5741 pBillboardRenderListD3D[v7].pQuads[2].pos.z = v15; | |
5742 pBillboardRenderListD3D[v7].pQuads[2].rhw = v16; | |
5743 pBillboardRenderListD3D[v7].pQuads[2].texcoord.x = 1.0; | |
5744 pBillboardRenderListD3D[v7].pQuads[2].texcoord.y = 1.0; | |
717 | 5745 v21 = pSprite->uBufferHeight - pSprite->uAreaY; |
5746 v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); | |
5747 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 5748 v22 = v22 * -1.0; |
1390 | 5749 pBillboardRenderListD3D[v7].pQuads[3].specular = 0; |
5750 pBillboardRenderListD3D[v7].pQuads[3].diffuse = v12; | |
5751 pBillboardRenderListD3D[v7].pQuads[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX; | |
5752 pBillboardRenderListD3D[v7].pQuads[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29; | |
5753 pBillboardRenderListD3D[v7].pQuads[3].pos.z = v15; | |
5754 pBillboardRenderListD3D[v7].pQuads[3].rhw = v16; | |
5755 pBillboardRenderListD3D[v7].pQuads[3].texcoord.x = 1.0; | |
5756 pBillboardRenderListD3D[v7].pQuads[3].texcoord.y = 0.0; | |
717 | 5757 //v23 = pSprite->pTexture; |
5758 pBillboardRenderListD3D[v7].uNumVertices = 4; | |
5759 pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth; | |
5760 pBillboardRenderListD3D[v7].pTexture = pSprite->pTexture; | |
0 | 5761 } |
5762 } | |
5763 | |
5764 //----- (004A354F) -------------------------------------------------------- | |
5765 void Render::MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) | |
5766 { | |
743 | 5767 //double v5; // st7@3 |
5768 //float v6; // ST20_4@3 | |
5769 //float v7; // ST00_4@3 | |
0 | 5770 unsigned int v8; // esi@3 |
743 | 5771 //int v9; // eax@3 |
5772 //int v10; // ebx@3 | |
0 | 5773 float v11; // ST28_4@3 |
743 | 5774 //double v12; // st7@3 |
5775 //float v13; // ST24_4@3 | |
5776 //double v14; // st6@3 | |
5777 //float v15; // ST1C_4@3 | |
0 | 5778 float v16; // ST2C_4@3 |
5779 float v17; // ST30_4@3 | |
5780 signed int v18; // ST18_4@3 | |
5781 signed int v19; // ST14_4@3 | |
5782 signed int v20; // ST10_4@3 | |
5783 signed int v21; // eax@3 | |
5784 double v22; // st6@3 | |
5785 float v23; // ST2C_4@3 | |
5786 float v24; // ST30_4@3 | |
5787 signed int v25; // ST10_4@3 | |
5788 signed int v26; // ST14_4@3 | |
5789 signed int v27; // ST18_4@3 | |
5790 signed int v28; // eax@3 | |
5791 double v29; // st6@3 | |
5792 float v30; // ecx@3 | |
5793 float v31; // ST2C_4@3 | |
5794 float v32; // ST30_4@3 | |
5795 signed int v33; // ST10_4@3 | |
5796 signed int v34; // ST14_4@3 | |
5797 signed int v35; // ST18_4@3 | |
5798 signed int v36; // eax@3 | |
5799 float v37; // ecx@3 | |
5800 double v38; // st6@3 | |
5801 float v39; // ST2C_4@3 | |
5802 float v40; // ST30_4@3 | |
5803 signed int v41; // ST10_4@3 | |
5804 signed int v42; // ST14_4@3 | |
5805 signed int v43; // ST18_4@3 | |
5806 signed int v44; // eax@3 | |
5807 double v45; // st6@3 | |
5808 float v46; // eax@3 | |
5809 | |
5810 if ( this->uNumD3DSceneBegins ) | |
5811 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5812 if (a2->zbuffer_depth) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5813 { |
743 | 5814 //v5 = (double)a2->zbuffer_depth; |
5815 //v6 = v5; | |
5816 //v7 = v5; | |
5817 v8 = Billboard_ProbablyAddToListAndSortByZOrder(a2->zbuffer_depth); | |
0 | 5818 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; |
5819 pBillboardRenderListD3D[v8].field_90 = a2->field_44; | |
5820 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; | |
5821 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; | |
743 | 5822 //v9 = a2->uScreenSpaceX; |
5823 //v10 = a2->uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5824 v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); |
743 | 5825 //v12 = (double) a2->uScreenSpaceX; |
5826 //v13 = v12; | |
5827 //v14 = (double)(a2->uScreenSpaceY - 12); | |
5828 //v15 = v14; | |
5829 v16 = (double)( a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; | |
5830 v17 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); | |
323 | 5831 v18 = stru_5C6E00->Cos(angle); |
5832 v19 = stru_5C6E00->Sin(angle); | |
5833 v20 = stru_5C6E00->Sin(angle); | |
5834 v21 = stru_5C6E00->Cos(angle); | |
1390 | 5835 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 |
0 | 5836 + (double)(v18 >> 16)) |
5837 * v16 | |
5838 - ((double)(unsigned __int16)v19 * 0.000015259022 | |
5839 + (double)(v19 >> 16)) | |
5840 * v17) | |
743 | 5841 * v11 + (double) a2->uScreenSpaceX; |
0 | 5842 v22 = (((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v17 |
5843 + ((double)(unsigned __int16)v20 * 0.000015259022 + (double)(v20 >> 16)) * v16 | |
5844 - 12.0) | |
5845 * v11 | |
5846 + (double)a2->uScreenSpaceY; | |
1390 | 5847 pBillboardRenderListD3D[v8].pQuads[0].specular = 0; |
5848 pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; | |
5849 pBillboardRenderListD3D[v8].pQuads[0].pos.y = v22; | |
5850 pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894); | |
5851 pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; | |
5852 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; | |
5853 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; | |
743 | 5854 v31 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; |
5855 v32 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); | |
323 | 5856 v25 = stru_5C6E00->Cos(angle); |
5857 v26 = stru_5C6E00->Sin(angle); | |
5858 v27 = stru_5C6E00->Sin(angle); | |
5859 v28 = stru_5C6E00->Cos(angle); | |
1390 | 5860 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 |
0 | 5861 + (double)(v25 >> 16)) |
740 | 5862 * v31 |
0 | 5863 - ((double)(unsigned __int16)v26 * 0.000015259022 |
5864 + (double)(v26 >> 16)) | |
740 | 5865 * v32) |
743 | 5866 * v11 + (double) a2->uScreenSpaceX; |
740 | 5867 v29 = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v32 |
5868 + ((double)(unsigned __int16)v27 * 0.000015259022 + (double)(v27 >> 16)) * v31 | |
0 | 5869 - 12.0) |
5870 * v11 | |
5871 + (double)a2->uScreenSpaceY; | |
1390 | 5872 pBillboardRenderListD3D[v8].pQuads[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuads[0].pos.z; |
5873 v30 = pBillboardRenderListD3D[v8].pQuads[0].rhw; | |
5874 pBillboardRenderListD3D[v8].pQuads[1].pos.y = v29; | |
5875 pBillboardRenderListD3D[v8].pQuads[1].specular = 0; | |
5876 pBillboardRenderListD3D[v8].pQuads[1].rhw = v30; | |
5877 pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; | |
5878 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; | |
5879 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; | |
743 | 5880 v23 = (double)(a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; |
5881 v24 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); | |
323 | 5882 v33 = stru_5C6E00->Cos(angle); |
5883 v34 = stru_5C6E00->Sin(angle); | |
5884 v35 = stru_5C6E00->Sin(angle); | |
5885 v36 = stru_5C6E00->Cos(angle); | |
1390 | 5886 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 |
0 | 5887 + (double)(v33 >> 16)) |
740 | 5888 * v23 |
0 | 5889 - ((double)(unsigned __int16)v34 * 0.000015259022 |
5890 + (double)(v34 >> 16)) | |
740 | 5891 * v24) |
743 | 5892 * v11 + (double) a2->uScreenSpaceX; |
1390 | 5893 v37 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; |
740 | 5894 v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v24 |
5895 + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v23 | |
0 | 5896 - 12.0) |
5897 * v11 | |
5898 + (double)a2->uScreenSpaceY; | |
1390 | 5899 pBillboardRenderListD3D[v8].pQuads[2].specular = 0; |
5900 pBillboardRenderListD3D[v8].pQuads[2].pos.z = v37; | |
5901 pBillboardRenderListD3D[v8].pQuads[2].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; | |
5902 pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; | |
5903 pBillboardRenderListD3D[v8].pQuads[2].pos.y = v38; | |
5904 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; | |
5905 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; | |
743 | 5906 v39 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; |
5907 v40 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); | |
323 | 5908 v41 = stru_5C6E00->Cos(angle); |
5909 v42 = stru_5C6E00->Sin(angle); | |
5910 v43 = stru_5C6E00->Sin(angle); | |
5911 v44 = stru_5C6E00->Cos(angle); | |
1390 | 5912 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 |
0 | 5913 + (double)(v41 >> 16)) |
5914 * v39 | |
5915 - ((double)(unsigned __int16)v42 * 0.000015259022 | |
5916 + (double)(v42 >> 16)) | |
5917 * v40) | |
743 | 5918 * v11 + (double) a2->uScreenSpaceX; |
0 | 5919 v45 = (((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 |
5920 + ((double)(unsigned __int16)v43 * 0.000015259022 + (double)(v43 >> 16)) * v39 | |
5921 - 12.0) | |
5922 * v11 | |
5923 + (double)a2->uScreenSpaceY; | |
1390 | 5924 v46 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; |
5925 pBillboardRenderListD3D[v8].pQuads[3].specular = 0; | |
5926 pBillboardRenderListD3D[v8].pQuads[3].pos.z = v46; | |
5927 pBillboardRenderListD3D[v8].pQuads[3].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; | |
5928 pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; | |
0 | 5929 pBillboardRenderListD3D[v8].pTexture = a3; |
743 | 5930 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; |
0 | 5931 pBillboardRenderListD3D[v8].uNumVertices = 4; |
1390 | 5932 pBillboardRenderListD3D[v8].pQuads[3].pos.y = v45; |
5933 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; | |
5934 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; | |
0 | 5935 } |
5936 } | |
5937 } | |
5938 | |
5939 //----- (004A3AD9) -------------------------------------------------------- | |
5940 void Render::MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) | |
5941 { | |
5942 double v5; // st7@2 | |
5943 float v6; // ST28_4@2 | |
5944 float v7; // ST00_4@2 | |
5945 unsigned int v8; // esi@2 | |
5946 int v9; // eax@2 | |
5947 int v10; // ebx@2 | |
5948 float v11; // ST34_4@2 | |
5949 double v12; // st7@2 | |
5950 float v13; // ST2C_4@2 | |
5951 double v14; // st6@2 | |
5952 float v15; // ST24_4@2 | |
5953 float v16; // ST38_4@2 | |
5954 float v17; // ST3C_4@2 | |
5955 signed int v18; // ST1C_4@2 | |
5956 int v19; // ST30_4@2 | |
5957 signed int v20; // ST20_4@2 | |
5958 signed int v21; // ST18_4@2 | |
5959 signed int v22; // eax@2 | |
5960 double v23; // st6@2 | |
5961 float v24; // ST20_4@2 | |
5962 float v25; // ST1C_4@2 | |
5963 float v26; // ST38_4@2 | |
5964 float v27; // ST3C_4@2 | |
5965 signed int v28; // ST18_4@2 | |
5966 signed int v29; // ST14_4@2 | |
5967 signed int v30; // ST10_4@2 | |
5968 signed int v31; // eax@2 | |
5969 double v32; // st6@2 | |
5970 float v33; // ST38_4@2 | |
5971 float v34; // ST3C_4@2 | |
5972 signed int v35; // ST10_4@2 | |
5973 signed int v36; // ST14_4@2 | |
5974 signed int v37; // ST18_4@2 | |
5975 signed int v38; // eax@2 | |
5976 double v39; // st6@2 | |
5977 float v40; // ST38_4@2 | |
5978 float v41; // ST3C_4@2 | |
5979 signed int v42; // ST10_4@2 | |
5980 signed int v43; // ST14_4@2 | |
5981 signed int v44; // ST18_4@2 | |
5982 signed int v45; // eax@2 | |
5983 double v46; // st6@2 | |
5984 | |
5985 if ( this->uNumD3DSceneBegins ) | |
5986 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5987 v5 = (double)a2->zbuffer_depth; |
0 | 5988 v6 = v5; |
5989 v7 = v5; | |
5990 v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); | |
5991 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; | |
5992 pBillboardRenderListD3D[v8].field_90 = a2->field_44; | |
5993 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; | |
5994 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; | |
5995 v9 = a2->uScreenSpaceX; | |
5996 v10 = a2->uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5997 v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); |
0 | 5998 v12 = (double)v9; |
5999 v13 = v12; | |
6000 v14 = (double)(v10 - 12); | |
6001 v15 = v14; | |
6002 v16 = (double)(v9 - 12) - v12; | |
6003 v17 = (double)(v10 - 25) - v14; | |
323 | 6004 v18 = stru_5C6E00->Cos(angle); |
0 | 6005 v19 = angle - stru_5C6E00->uIntegerHalfPi; |
323 | 6006 v20 = stru_5C6E00->Sin(angle); |
6007 v21 = stru_5C6E00->Sin(angle); | |
6008 v22 = stru_5C6E00->Cos(angle); | |
1390 | 6009 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 |
0 | 6010 + (double)(v18 >> 16)) |
6011 * v16 | |
6012 - ((double)(unsigned __int16)v20 * 0.000015259022 | |
6013 + (double)(v20 >> 16)) | |
6014 * v17) | |
6015 * v11 + v13; | |
6016 v23 = (((double)(unsigned __int16)v22 * 0.000015259022 + (double)(v22 >> 16)) * v17 | |
6017 + ((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v16 | |
6018 - 12.0) | |
6019 * v11 | |
6020 + (double)a2->uScreenSpaceY; | |
1390 | 6021 pBillboardRenderListD3D[v8].pQuads[0].specular = 0; |
6022 pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; | |
6023 pBillboardRenderListD3D[v8].pQuads[0].pos.y = v23; | |
1637 | 6024 v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pODMRenderParams->shading_dist_mist); |
1390 | 6025 pBillboardRenderListD3D[v8].pQuads[0].pos.z = v24; |
0 | 6026 v25 = 1.0 / v6; |
1390 | 6027 pBillboardRenderListD3D[v8].pQuads[0].rhw = v25; |
6028 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; | |
6029 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; | |
0 | 6030 v26 = (double)(a2->uScreenSpaceX - 12) - v13; |
6031 v27 = (double)a2->uScreenSpaceY - v15; | |
323 | 6032 v28 = stru_5C6E00->Cos(angle); |
6033 v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6034 v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6035 v31 = stru_5C6E00->Cos(angle); | |
1390 | 6036 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 |
0 | 6037 + (double)(v28 >> 16)) |
6038 * v26 | |
6039 - ((double)(unsigned __int16)v29 * 0.000015259022 | |
6040 + (double)(v29 >> 16)) | |
6041 * v27) | |
6042 * v11 + v13; | |
6043 v32 = (((double)(unsigned __int16)v31 * 0.000015259022 + (double)(v31 >> 16)) * v27 | |
6044 + ((double)(unsigned __int16)v30 * 0.000015259022 + (double)(v30 >> 16)) * v26 | |
6045 - 12.0) | |
6046 * v11 | |
6047 + (double)a2->uScreenSpaceY; | |
1390 | 6048 pBillboardRenderListD3D[v8].pQuads[1].pos.z = v24; |
6049 pBillboardRenderListD3D[v8].pQuads[1].pos.y = v32; | |
6050 pBillboardRenderListD3D[v8].pQuads[1].specular = 0; | |
6051 pBillboardRenderListD3D[v8].pQuads[1].rhw = v25; | |
6052 pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; | |
6053 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; | |
6054 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; | |
0 | 6055 v33 = (double)(a2->uScreenSpaceX + 12) - v13; |
6056 v34 = (double)a2->uScreenSpaceY - v15; | |
323 | 6057 v35 = stru_5C6E00->Cos(angle); |
6058 v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6059 v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6060 v38 = stru_5C6E00->Cos(angle); | |
1390 | 6061 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 |
0 | 6062 + (double)(v35 >> 16)) |
6063 * v33 | |
6064 - ((double)(unsigned __int16)v36 * 0.000015259022 | |
6065 + (double)(v36 >> 16)) | |
6066 * v34) | |
6067 * v11 + v13; | |
6068 v39 = (((double)(unsigned __int16)v38 * 0.000015259022 + (double)(v38 >> 16)) * v34 | |
6069 + ((double)(unsigned __int16)v37 * 0.000015259022 + (double)(v37 >> 16)) * v33 | |
6070 - 12.0) | |
6071 * v11 | |
6072 + (double)a2->uScreenSpaceY; | |
1390 | 6073 pBillboardRenderListD3D[v8].pQuads[2].specular = 0; |
6074 pBillboardRenderListD3D[v8].pQuads[2].pos.z = v24; | |
6075 pBillboardRenderListD3D[v8].pQuads[2].rhw = v25; | |
6076 pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; | |
6077 pBillboardRenderListD3D[v8].pQuads[2].pos.y = v39; | |
6078 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; | |
6079 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; | |
0 | 6080 v40 = (double)(a2->uScreenSpaceX + 12) - v13; |
6081 v41 = (double)(a2->uScreenSpaceY - 25) - v15; | |
323 | 6082 v42 = stru_5C6E00->Cos(angle); |
6083 v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6084 v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6085 v45 = stru_5C6E00->Cos(angle); | |
1390 | 6086 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 |
0 | 6087 + (double)(v42 >> 16)) |
6088 * v40 | |
6089 - ((double)(unsigned __int16)v43 * 0.000015259022 | |
6090 + (double)(v43 >> 16)) | |
6091 * v41) | |
6092 * v11 + v13; | |
6093 v46 = (((double)(unsigned __int16)v45 * 0.000015259022 + (double)(v45 >> 16)) * v41 | |
6094 + ((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 | |
6095 - 12.0) | |
6096 * v11 | |
6097 + (double)a2->uScreenSpaceY; | |
1390 | 6098 pBillboardRenderListD3D[v8].pQuads[3].specular = 0; |
6099 pBillboardRenderListD3D[v8].pQuads[3].pos.z = v24; | |
6100 pBillboardRenderListD3D[v8].pQuads[3].rhw = v25; | |
6101 pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; | |
0 | 6102 pBillboardRenderListD3D[v8].pTexture = a3; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6103 pBillboardRenderListD3D[v8].z_order = v6; |
0 | 6104 pBillboardRenderListD3D[v8].uNumVertices = 4; |
1390 | 6105 pBillboardRenderListD3D[v8].pQuads[3].pos.y = v46; |
6106 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; | |
6107 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; | |
0 | 6108 } |
6109 } | |
6110 | |
6111 //----- (004A4023) -------------------------------------------------------- | |
657 | 6112 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
|
6113 { |
0 | 6114 unsigned int v8; // esi@2 |
6115 double v14; // st6@14 | |
6116 double v15; // st5@14 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6117 //unsigned int v16; // ecx@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6118 //double v17; // st7@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6119 //double v18; // st5@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6120 //double v19; // st4@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6121 //double v20; // st5@18 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6122 //double v21; // st4@18 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6123 //signed int v23; // [sp+18h] [bp-18h]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6124 //signed int v24; // [sp+1Ch] [bp-14h]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6125 //float v26; // [sp+20h] [bp-10h]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6126 //float v27; // [sp+20h] [bp-10h]@12 |
0 | 6127 float v29; // [sp+28h] [bp-8h]@5 |
6128 float v30; // [sp+2Ch] [bp-4h]@5 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6129 //float pSpritea; // [sp+3Ch] [bp+Ch]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6130 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6131 if (!uNumD3DSceneBegins) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6132 return; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6133 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6134 v8 = Billboard_ProbablyAddToListAndSortByZOrder(a2->zbuffer_depth); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6135 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6136 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
|
6137 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
|
6138 |
657 | 6139 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
|
6140 if (a2->uTintColor & 0x00FFFFFF && bTinting) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6141 { |
737 | 6142 diffuse = BlendColors(a2->uTintColor, diffuse); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6143 if (a2->uTintColor & 0xFF000000) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6144 diffuse = 0x007F7F7F & ((unsigned int)diffuse >> 1); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6145 } |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6146 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6147 unsigned int specular = 0; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6148 if (bUsingSpecular) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6149 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
|
6150 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6151 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6152 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6153 if (a2->uFlags & 4) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6154 v14 *= -1.0; |
1390 | 6155 pBillboardRenderListD3D[v8].pQuads[0].diffuse = diffuse; |
6156 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30; | |
6157 pBillboardRenderListD3D[v8].pQuads[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
1637 | 6158 pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); |
1390 | 6159 pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; |
6160 pBillboardRenderListD3D[v8].pQuads[0].specular = specular; | |
6161 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; | |
6162 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6163 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6164 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6165 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6166 if ( a2->uFlags & 4 ) |
0 | 6167 v14 = v14 * -1.0; |
1390 | 6168 pBillboardRenderListD3D[v8].pQuads[1].specular = specular; |
6169 pBillboardRenderListD3D[v8].pQuads[1].diffuse = diffuse; | |
6170 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30; | |
6171 pBillboardRenderListD3D[v8].pQuads[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
1637 | 6172 pBillboardRenderListD3D[v8].pQuads[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); |
1390 | 6173 pBillboardRenderListD3D[v8].pQuads[1].rhw = 1.0 / a2->zbuffer_depth; |
6174 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; | |
6175 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6176 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6177 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
|
6178 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6179 if ( a2->uFlags & 4 ) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6180 v14 *= -1.0; |
1390 | 6181 pBillboardRenderListD3D[v8].pQuads[2].diffuse = diffuse; |
6182 pBillboardRenderListD3D[v8].pQuads[2].specular = specular; | |
6183 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30; | |
6184 pBillboardRenderListD3D[v8].pQuads[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
1637 | 6185 pBillboardRenderListD3D[v8].pQuads[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); |
1390 | 6186 pBillboardRenderListD3D[v8].pQuads[2].rhw = 1.0 / a2->zbuffer_depth; |
6187 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; | |
6188 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6189 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6190 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
|
6191 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6192 if ( a2->uFlags & 4 ) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6193 v14 *= -1.0; |
1390 | 6194 pBillboardRenderListD3D[v8].pQuads[3].diffuse = diffuse; |
6195 pBillboardRenderListD3D[v8].pQuads[3].specular = specular; | |
6196 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30; | |
6197 pBillboardRenderListD3D[v8].pQuads[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
1637 | 6198 pBillboardRenderListD3D[v8].pQuads[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); |
1390 | 6199 pBillboardRenderListD3D[v8].pQuads[3].rhw = 1.0 / a2->zbuffer_depth; |
6200 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; | |
6201 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6202 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6203 pBillboardRenderListD3D[v8].uNumVertices = 4; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6204 pBillboardRenderListD3D[v8].pTexture = pSprite->pTexture; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6205 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6206 pBillboardRenderListD3D[v8].field_90 = a2->field_44; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6207 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6208 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6209 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6210 if (a2->uTintColor & 0xFF000000) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6211 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6212 else |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6213 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Transparent; |
0 | 6214 } |
6215 | |
6216 //----- (004A48E4) -------------------------------------------------------- | |
6217 int Render::MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6) | |
6218 { | |
6219 int v6; // ecx@1 | |
6220 int v7; // ebx@1 | |
6221 int v8; // ecx@1 | |
6222 int v9; // edx@1 | |
6223 int v10; // edi@1 | |
6224 unsigned int x; // esi@1 | |
6225 int result; // eax@8 | |
6226 int v13; // [sp+Ch] [bp-10h]@1 | |
6227 int v14; // [sp+10h] [bp-Ch]@1 | |
6228 int v15; // [sp+14h] [bp-8h]@1 | |
6229 int v16; // [sp+18h] [bp-4h]@1 | |
6230 int v17; // [sp+24h] [bp+8h]@1 | |
6231 unsigned int v18; // [sp+28h] [bp+Ch]@1 | |
6232 int v19; // [sp+34h] [bp+18h]@1 | |
6233 | |
6234 v6 = screenSpaceX; | |
6235 v7 = (a6 >> 1) + screenSpaceY; | |
6236 v17 = 0; | |
6237 v15 = 0; | |
6238 v8 = (a6 >> 1) + v6; | |
6239 v14 = (a6 >> 1) * (a6 >> 1); | |
6240 v9 = 2 * (a6 >> 1); | |
6241 v10 = (a6 >> 1) * ((a6 >> 1) - 1); | |
6242 x = v8 - (a6 >> 1); | |
6243 v16 = (a6 >> 1) + screenSpaceY - v8; | |
6244 v19 = a6 >> 1; | |
6245 v13 = v9; | |
6246 v18 = v8; | |
6247 do | |
6248 { | |
6249 sr_4A46E6_draw_particle_segment(x, v16 + v18, z, 2 * v19, lightColor); | |
6250 if ( v15 ) | |
6251 sr_4A46E6_draw_particle_segment(x, v17 + v7, z, 2 * v19, lightColor); | |
6252 v14 -= v15; | |
6253 if ( v14 <= v10 ) | |
6254 { | |
6255 if ( v19 != v17 ) | |
6256 { | |
6257 sr_4A46E6_draw_particle_segment(v18, v16 + x, z, 2 * v17, lightColor); | |
6258 sr_4A46E6_draw_particle_segment(v18, v19 + v7, z, 2 * v17, lightColor); | |
6259 } | |
6260 --v19; | |
6261 v13 -= 2; | |
6262 ++x; | |
6263 v10 -= v13; | |
6264 } | |
6265 result = v17++; | |
6266 v15 += 2; | |
6267 --v18; | |
6268 } | |
6269 while ( result < v19 ); | |
6270 return result; | |
6271 } | |
6272 | |
6273 //----- (004A49D0) -------------------------------------------------------- | |
6274 void Render::DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9) | |
6275 { | |
1159 | 6276 int absXDifference; // eax@1 |
6277 int absYDifference; // eax@1 | |
6278 unsigned int smallerabsdiff; // ebx@1 | |
6279 unsigned int largerabsdiff; | |
0 | 6280 double v16; // st7@7 |
6281 double v17; // st7@7 | |
6282 double v18; // st6@7 | |
6283 double v20; // st4@8 | |
6284 double v21; // st4@10 | |
6285 double v22; // st4@10 | |
6286 double v23; // st4@10 | |
6287 double v25; // st4@11 | |
6288 double v26; // st4@13 | |
6289 double v28; // st4@13 | |
6290 RenderVertexD3D3 v29[4]; // [sp+0h] [bp-94h]@7 | |
1159 | 6291 int xDifference; // [sp+88h] [bp-Ch]@1 |
0 | 6292 signed int v32; // [sp+8Ch] [bp-8h]@1 |
1159 | 6293 int yDifference; // [sp+90h] [bp-4h]@1 |
6294 | |
6295 xDifference = bankersRounding(dstX - srcX); | |
6296 yDifference = bankersRounding(dstY - srcY); | |
6297 absYDifference = abs(yDifference); | |
6298 absXDifference = abs(xDifference); | |
6299 smallerabsdiff = min(absXDifference, absYDifference); | |
6300 largerabsdiff = max(absXDifference, absYDifference); | |
6301 v32 = (11 * smallerabsdiff >> 5) + largerabsdiff; | |
0 | 6302 v16 = 1.0 / (double)v32; |
1159 | 6303 v17 = (double)yDifference * v16 * a4; |
6304 v18 = (double)xDifference * v16 * a4; | |
6305 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
6306 { | |
1637 | 6307 v20 = a3 * 1000.0 / (double)pODMRenderParams->shading_dist_mist; |
6308 v25 = a7 * 1000.0 / (double)pODMRenderParams->shading_dist_mist; | |
1159 | 6309 } |
6310 else | |
6311 { | |
6312 v20 = a3 * 0.061758894; | |
6313 v25 = a7 * 0.061758894; | |
6314 } | |
6315 v21 = 1.0 / a3; | |
6316 v22 = (double)yDifference * v16 * a8; | |
6317 v23 = (double)xDifference * v16 * a8; | |
6318 v26 = 1.0 - 1.0 / v25; | |
6319 v28 = 1.0 / a7; | |
0 | 6320 v29[0].pos.x = srcX + v17; |
6321 v29[0].pos.y = srcY - v18; | |
1159 | 6322 v29[0].pos.z = 1.0 - 1.0 / v20; |
6323 v29[0].rhw = v21; | |
0 | 6324 v29[0].diffuse = -1; |
6325 v29[0].specular = 0; | |
6326 v29[0].texcoord.x = 1.0; | |
6327 v29[0].texcoord.y = 0.0; | |
1159 | 6328 |
0 | 6329 v29[1].pos.x = v22 + dstX; |
6330 v29[1].pos.y = dstY - v23; | |
1159 | 6331 v29[1].pos.z = v26; |
6332 v29[1].rhw = v28; | |
0 | 6333 v29[1].diffuse = -16711936; |
6334 v29[1].specular = 0; | |
6335 v29[1].texcoord.x = 1.0; | |
6336 v29[1].texcoord.y = 1.0; | |
1159 | 6337 |
6338 v29[2].pos.x = dstX - v22; | |
6339 v29[2].pos.y = v23 + dstY; | |
6340 v29[2].pos.z = v26; | |
0 | 6341 v29[2].rhw = v28; |
1159 | 6342 v29[2].diffuse = -1; |
6343 v29[2].specular = 0; | |
0 | 6344 v29[2].texcoord.x = 0.0; |
6345 v29[2].texcoord.y = 1.0; | |
1159 | 6346 |
0 | 6347 v29[3].pos.x = srcX - v17; |
6348 v29[3].pos.y = v18 + srcY; | |
1159 | 6349 v29[3].pos.z = v29[0].pos.z; |
6350 v29[3].rhw = v21; | |
6351 v29[3].diffuse = -1; | |
6352 v29[3].specular = 0; | |
0 | 6353 v29[3].texcoord.x = 0.0; |
6354 v29[3].texcoord.y = 0.0; | |
186 | 6355 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
6356 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
6357 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | |
6358 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | |
6359 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | |
6360 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
0 | 6361 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, a9)); |
6362 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive( | |
6363 D3DPT_TRIANGLEFAN, | |
6364 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
6365 v29, | |
6366 4, | |
6367 24)); | |
186 | 6368 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
6369 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
6370 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
6371 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
6372 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
6373 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); | |
0 | 6374 } |
6375 | |
6376 //----- (004A4CC9) -------------------------------------------------------- | |
1390 | 6377 void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse) |
6378 { | |
0 | 6379 unsigned int v5; // eax@7 |
6380 char *v7; // edx@8 | |
6381 double v10; // st6@9 | |
6382 double v11; // st6@10 | |
6383 int v12; // ebx@13 | |
1390 | 6384 |
6385 if (a1->uNumVertices < 3) | |
6386 return; | |
6387 | |
6388 float depth = 1000000.0; | |
6389 for (uint i = 0; i < a1->uNumVertices; ++i) | |
6390 { | |
6391 if (a1->field_104[i].z < depth) | |
6392 depth = a1->field_104[i * 4].z; | |
6393 } | |
6394 | |
6395 v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth); | |
6396 pBillboardRenderListD3D[v5].field_90 = 0; | |
6397 pBillboardRenderListD3D[v5].uParentBillboardID = -1; | |
6398 pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; | |
6399 pBillboardRenderListD3D[v5].pTexture = 0; | |
6400 pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices; | |
6401 pBillboardRenderListD3D[v5].z_order = depth; | |
6402 | |
6403 for (uint i = 0; i < a1->uNumVertices; ++i) | |
6404 { | |
6405 pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x; | |
6406 pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y; | |
6407 | |
6408 v10 = a1->field_104[i].z; | |
6409 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6410 v11 = v10 * 0.061758894; | |
6411 else | |
1637 | 6412 v11 = v10 * 1000.0 / (double)pODMRenderParams->shading_dist_mist; |
1390 | 6413 pBillboardRenderListD3D[v5].pQuads[i].pos.z = 1.0 - 1.0 / v11; |
6414 pBillboardRenderListD3D[v5].pQuads[i].rhw = 1.0 / a1->field_104[i].z; | |
6415 | |
6416 if (diffuse & 0xFF000000) | |
6417 v12 = a1->field_104[i].diffuse; | |
6418 else | |
6419 v12 = diffuse; | |
6420 pBillboardRenderListD3D[v5].pQuads[i].diffuse = v12; | |
6421 pBillboardRenderListD3D[v5].pQuads[i].specular = 0; | |
6422 | |
6423 pBillboardRenderListD3D[v5].pQuads[i].texcoord.x = 0.0; | |
6424 pBillboardRenderListD3D[v5].pQuads[i].texcoord.y = 0.0; | |
0 | 6425 } |
6426 } | |
6427 | |
6428 //----- (004A4DE1) -------------------------------------------------------- | |
6429 bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture) | |
6430 { | |
6431 HRESULT v12; // eax@14 | |
6432 unsigned __int16 *v13; // ecx@19 | |
6433 unsigned __int16 *v14; // eax@19 | |
6434 DWORD v15; // edx@20 | |
6435 HRESULT v16; // eax@23 | |
6436 stru350 Dst; // [sp+Ch] [bp-F8h]@12 | |
6437 | |
6438 auto pHWLTexture = pD3DBitmaps.LoadTexture(pName, bMipMaps); | |
6439 if ( pHWLTexture ) | |
6440 { | |
6441 bMipMaps = !strncmp(pName, "HDWTR", 5); | |
6442 if ( !pRenderD3D->CreateTexture( | |
6443 pHWLTexture->uWidth, | |
6444 pHWLTexture->uHeight, | |
6445 pOutSurface, | |
6446 pOutTexture, | |
6447 true, | |
6448 bMipMaps, | |
6449 uMinDeviceTextureDim) ) | |
1545 | 6450 Error("HiScreen16::LoadTexture - D3Drend->CreateTexture() failed: %x", 0); |
0 | 6451 //v10 = *pOutSurface; |
6452 //v11 = 0; | |
1578
56cc81b1ed49
workaround for crash on startup
Beri Levi berilevi@gmail.com
parents:
1574
diff
changeset
|
6453 if (bMipMaps) |
0 | 6454 { |
6455 Dst._450DDE(); | |
6456 //v20 = 0; | |
6457 Dst._450DF1(&stru_4EFCBC, &stru_4EFCBC); | |
6458 | |
6459 IDirectDrawSurface4 *pNextSurf = *pOutSurface; | |
6460 while ( 1 ) | |
6461 { | |
6462 DDSCAPS2 v19; | |
6463 memset(&v19, 0, sizeof(DDSCAPS2)); | |
6464 v19.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; | |
6465 | |
6466 DDSURFACEDESC2 desc; | |
6467 memset(&desc, 0, sizeof(DDSURFACEDESC2)); | |
6468 desc.dwSize = sizeof(DDSURFACEDESC2); | |
6469 | |
168 | 6470 if ( LockSurface_DDraw4(pNextSurf, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
0 | 6471 { |
1578
56cc81b1ed49
workaround for crash on startup
Beri Levi berilevi@gmail.com
parents:
1574
diff
changeset
|
6472 /*Dst.sub_451007_scale_image_bicubic( |
0 | 6473 pHWLTexture->pPixels, |
6474 pHWLTexture->uWidth, | |
6475 pHWLTexture->uHeight, | |
6476 pHWLTexture->uWidth, | |
6477 (unsigned short *)desc.lpSurface, | |
6478 desc.dwWidth, | |
6479 desc.dwHeight, | |
6480 desc.lPitch >> 1, | |
6481 0, | |
1578
56cc81b1ed49
workaround for crash on startup
Beri Levi berilevi@gmail.com
parents:
1574
diff
changeset
|
6482 0);*/ |
0 | 6483 ErrD3D(pNextSurf->Unlock(0)); |
6484 //bMipMaps = 0x4D86ACu; | |
6485 } | |
6486 if (FAILED(pNextSurf->GetAttachedSurface(&v19, &pNextSurf))) | |
6487 break; | |
6488 //v10 = (IDirectDrawSurface4 *)pName; | |
6489 //v11 = 0; | |
6490 } | |
6491 //v20 = -1; | |
6492 //nullsub_1(); | |
6493 } | |
6494 else | |
6495 { | |
6496 DDSCAPS2 v19; | |
6497 memset(&v19, 0, sizeof(DDSCAPS2)); | |
6498 v19.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; | |
6499 | |
6500 DDSURFACEDESC2 desc; | |
6501 memset(&desc, 0, sizeof(DDSURFACEDESC2)); | |
6502 desc.dwSize = sizeof(DDSURFACEDESC2); | |
6503 | |
168 | 6504 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
0 | 6505 { |
6506 bMipMaps = 0; | |
6507 v13 = pHWLTexture->pPixels; | |
6508 v14 = (unsigned __int16 *)desc.lpSurface; | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6509 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
|
6510 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6511 for (v15 = 0; v15 < desc.dwWidth; v15++) |
0 | 6512 { |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6513 *v14 = *v13; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6514 ++v14; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6515 ++v13; |
0 | 6516 } |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6517 v14 += (desc.lPitch >> 1) - desc.dwWidth; |
0 | 6518 } |
6519 ErrD3D((*pOutSurface)->Unlock(0)); | |
6520 } | |
6521 } | |
6522 delete [] pHWLTexture->pPixels; | |
6523 delete pHWLTexture; | |
6524 return true; | |
6525 } | |
6526 return false; | |
6527 } | |
6528 | |
6529 //----- (004A5048) -------------------------------------------------------- | |
670 | 6530 bool Render::MoveSpriteToDevice( Sprite *pSprite ) |
6531 { | |
6532 | |
6533 HWLTexture *sprite_texture; // eax@1 | |
0 | 6534 unsigned __int16 *v9; // edx@5 |
6535 LPVOID v10; // eax@5 | |
6536 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 | |
6537 | |
670 | 6538 sprite_texture = pD3DSprites.LoadTexture(pSprite->pName, pSprite->uPaletteID); |
6539 if ( sprite_texture ) | |
6540 { | |
6541 _gpu_memory_used += 2 * sprite_texture->uWidth * sprite_texture->uHeight; | |
6542 pSprite->uAreaX = sprite_texture->uAreaX; | |
6543 pSprite->uAreaY = sprite_texture->uAreaY; | |
6544 pSprite->uBufferWidth = sprite_texture->uBufferWidth; | |
6545 pSprite->uBufferHeight = sprite_texture->uBufferHeight; | |
6546 pSprite->uAreaWidth = sprite_texture->uAreaWidth; | |
6547 pSprite->uAreaHeight = sprite_texture->uAreaHeigth; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6548 //v6 = v3->uMinDeviceTextureDim; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6549 //v7 = v3->pRenderD3D; |
670 | 6550 if (!pRenderD3D->CreateTexture(sprite_texture->uWidth, sprite_texture->uHeight, &pSprite->pTextureSurface, &pSprite->pTexture, 1u, 0, uMinDeviceTextureDim)) |
1545 | 6551 Error("HiScreen16::LoadTexture - D3Drend->CreateTexture() failed: %x", 0); |
0 | 6552 //pSprite = v2->pTextureSurface; |
6553 //pSprite = (Sprite *)pSprite->pName; | |
6554 //v8 = pSprite; | |
670 | 6555 memset(&Dst, 0, sizeof(DDSURFACEDESC2)); |
0 | 6556 Dst.dwSize = 124; |
670 | 6557 if ( LockSurface_DDraw4((IDirectDrawSurface4 *)pSprite->pTextureSurface, &Dst, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
6558 { | |
6559 v9 = sprite_texture->pPixels; | |
6560 v10 = Dst.lpSurface; | |
6561 for (int i=0; i<sprite_texture->uHeight; ++i) | |
0 | 6562 { |
670 | 6563 for (int j=0; j<sprite_texture->uWidth/2; ++j) |
6564 { | |
0 | 6565 *(int *)v10 = *(int *)v9; |
6566 v9 += 2; | |
6567 v10 = (char *)v10 + 4; | |
670 | 6568 } |
6569 v10 = (char *)v10+Dst.lPitch-sprite_texture->uWidth*2; | |
0 | 6570 } |
670 | 6571 ErrD3D(pSprite->pTextureSurface->Unlock(0)); |
6572 } | |
6573 free(sprite_texture->pPixels); | |
6574 free(sprite_texture); | |
6575 return true; | |
6576 } | |
6577 return false; | |
0 | 6578 } |
6579 | |
6580 //----- (004A51CB) -------------------------------------------------------- | |
6581 void Render::BeginScene() | |
6582 { | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6583 //Render *v1; // esi@1 |
0 | 6584 unsigned int v2; // eax@1 |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6585 /*int v3; // eax@5 |
0 | 6586 unsigned __int16 **v4; // edi@6 |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6587 char *v5; // ebx@7*/ |
0 | 6588 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 |
6589 | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6590 //v1 = this; |
0 | 6591 v2 = this->uNumSceneBegins; |
6592 this->uNumSceneBegins = v2 + 1; | |
6593 if ( !v2 ) | |
6594 { | |
6595 if ( this->pRenderD3D ) | |
6596 { | |
6597 if ( this->bColorKeySupported ) | |
6598 { | |
6599 memset(&Dst, 0, 0x7Cu); | |
6600 Dst.dwSize = 124; | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6601 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
|
6602 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6603 this->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6604 this->uTargetSurfacePitch = Dst.lPitch >> 1; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6605 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
|
6606 } |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6607 --this->uNumSceneBegins; |
0 | 6608 } |
6609 } | |
6610 else | |
6611 { | |
6612 if ( !this->pTargetSurface ) | |
6613 { | |
6614 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
|
6615 if ( this->pTargetSurface ) |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6616 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6617 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
|
6618 } |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6619 --this->uNumSceneBegins; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6620 } |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6621 } |
0 | 6622 RestoreFrontBuffer(); |
6623 } | |
6624 } | |
6625 | |
6626 //----- (004A527D) -------------------------------------------------------- | |
6627 void Render::EndScene() | |
6628 { | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6629 if ( this->uNumSceneBegins ) |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6630 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6631 this->uNumSceneBegins--; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6632 if ( !this->uNumSceneBegins ) |
0 | 6633 { |
6634 if ( this->pRenderD3D ) | |
6635 { | |
6636 if ( this->bColorKeySupported ) | |
6637 { | |
6638 this->pTargetSurface = 0; | |
6639 this->uTargetSurfacePitch = 0; | |
6640 this->field_18_locked_pitch = 0; | |
6641 ErrD3D(this->pColorKeySurface4->Unlock(0)); | |
6642 } | |
6643 } | |
6644 else | |
6645 { | |
6646 this->pTargetSurface = 0; | |
6647 this->uTargetSurfacePitch = 0; | |
6648 this->field_18_locked_pitch = 0; | |
6649 UnlockBackBuffer(); | |
6650 } | |
6651 } | |
6652 } | |
6653 } | |
6654 | |
6655 //----- ( ) -------------------------------------------------------- | |
6656 unsigned int Render::_4A52F1(unsigned int this_, float a3) | |
6657 { | |
6658 unsigned int v3; // esi@1 | |
6659 double v4; // st7@2 | |
6660 double v5; // st7@6 | |
6661 double v6; // st6@6 | |
6662 unsigned int v7; // eax@6 | |
6663 double v8; // st5@6 | |
6664 double v9; // st4@6 | |
6665 HRESULT v10; // eax@6 | |
6666 HRESULT v11; // eax@6 | |
6667 unsigned int result; // eax@6 | |
6668 unsigned int v13; // eax@7 | |
6669 unsigned __int16 *v14; // ecx@7 | |
6670 int *v15; // eax@7 | |
6671 unsigned int v16; // ecx@8 | |
6672 __int16 v17; // ax@10 | |
6673 int v18; // esi@10 | |
6674 float v19; // edi@10 | |
6675 void *v20; // esi@10 | |
6676 int v21; // edx@10 | |
6677 int v22; // ecx@11 | |
6678 int v23; // edx@12 | |
6679 __int16 v24; // ax@15 | |
6680 int v25; // esi@15 | |
6681 float v26; // edi@15 | |
6682 char *v27; // esi@15 | |
6683 int v28; // edx@15 | |
6684 int v29; // ecx@16 | |
6685 int v30; // edx@17 | |
6686 int v31; // [sp-Ch] [bp-ACh]@11 | |
6687 int v32; // [sp-Ch] [bp-ACh]@16 | |
6688 const char *v33; // [sp+0h] [bp-A0h]@0 | |
6689 int v34; // [sp+4h] [bp-9Ch]@0 | |
6690 unsigned int v35; // [sp+8h] [bp-98h]@0 | |
6691 RenderVertexD3D3 v36[4]; // [sp+Ch] [bp-94h]@6 | |
6692 unsigned int v37; // [sp+8Ch] [bp-14h]@7 | |
6693 int v38; // [sp+90h] [bp-10h]@7 | |
6694 double v39; // [sp+94h] [bp-Ch]@6 | |
6695 float v40; // [sp+9Ch] [bp-4h]@6 | |
6696 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6697 __debugbreak(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6698 |
0 | 6699 auto ecx0 = this; |
6700 v3 = 0; | |
1574 | 6701 |
6702 if (!this->pRenderD3D) | |
6703 __debugbreak(); // sw render | |
6704 | |
6705 //{ | |
0 | 6706 v4 = a3; |
6707 if ( a3 <= 1.0 ) | |
6708 { | |
6709 if ( v4 < 0.0 ) | |
6710 v4 = 0.0; | |
6711 } | |
6712 else | |
6713 { | |
6714 v4 = 1.0; | |
6715 } | |
1574 | 6716 __debugbreak(); // banker's rounding again |
0 | 6717 a3 = v4 * 255.0; |
6718 v39 = a3 + 6.7553994e15; | |
6719 LODWORD(v40) = LODWORD(v39); | |
693 | 6720 v5 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 6721 v36[0].pos.x = v5; |
693 | 6722 v6 = (double)(signed int)pViewport->uViewportTL_Y; |
0 | 6723 v7 = this_ | (LODWORD(v39) << 24); |
693 | 6724 this_ = pViewport->uViewportBR_Y + 1; |
0 | 6725 v36[0].specular = 0; |
6726 v36[0].pos.y = v6; | |
6727 v36[0].diffuse = v7; | |
6728 v36[1].diffuse = v7; | |
6729 v36[0].pos.z = 0.0; | |
6730 v36[2].diffuse = v7; | |
6731 v36[3].diffuse = v7; | |
6732 v36[0].rhw = 1.0; | |
6733 v36[1].specular = 0; | |
6734 v36[0].texcoord.x = 0.0; | |
6735 v36[2].specular = 0; | |
6736 v36[3].specular = 0; | |
6737 v36[0].texcoord.y = 0.0; | |
6738 v36[1].pos.x = v5; | |
693 | 6739 v8 = (double)(pViewport->uViewportBR_Y + 1); |
0 | 6740 v36[1].pos.y = v8; |
6741 v36[1].pos.z = 0.0; | |
6742 v36[1].rhw = 1.0; | |
6743 v36[1].texcoord.x = 0.0; | |
6744 v36[1].texcoord.y = 0.0; | |
693 | 6745 v9 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 6746 v36[2].pos.x = v9; |
6747 v36[2].pos.y = v8; | |
6748 v36[2].pos.z = 0.0; | |
6749 v36[2].rhw = 1.0; | |
6750 v36[2].texcoord.x = 0.0; | |
6751 v36[2].texcoord.y = 0.0; | |
6752 v36[3].pos.x = v9; | |
6753 v36[3].pos.y = v6; | |
6754 v36[3].pos.z = 0.0; | |
6755 v36[3].rhw = 1.0; | |
6756 v36[3].texcoord.x = 0.0; | |
6757 v36[3].texcoord.y = 0.0; | |
6758 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | |
186 | 6759 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
6760 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
6761 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | |
6762 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); | |
6763 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); | |
6764 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | |
6765 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS)); | |
0 | 6766 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( |
6767 D3DPT_TRIANGLEFAN, | |
6768 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
6769 v36, | |
6770 4, | |
6771 28)); | |
186 | 6772 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
6773 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
6774 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
6775 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
6776 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
6777 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS)); | |
1574 | 6778 /*} |
0 | 6779 else |
6780 { | |
6781 v40 = (1.0 - a3) * 65536.0; | |
6782 v39 = v40 + 6.7553994e15; | |
6783 LODWORD(a3) = LODWORD(v39); | |
693 | 6784 v38 = (signed int)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) >> 1; |
6785 HIDWORD(v39) = pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1; | |
6786 v13 = pViewport->uViewportTL_X + ecx0->uTargetSurfacePitch - pViewport->uViewportBR_X; | |
6787 v14 = &ecx0->pTargetSurface[pViewport->uViewportTL_X + pViewport->uViewportTL_Y * ecx0->uTargetSurfacePitch]; | |
0 | 6788 v37 = 2 * v13; |
6789 LODWORD(v40) = (int)v14; | |
6790 | |
6791 int __i = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6792 v15 = dword_F1B430.data(); |
0 | 6793 do |
6794 { | |
6795 v16 = v3; | |
6796 v3 += LODWORD(a3); | |
6797 dword_F1B430[__i++] = v16 >> 16; | |
6798 } | |
6799 //while ( (signed int)v15 < (signed int)&Aureal3D_SplashScreen ); | |
6800 while (__i < 32); | |
6801 | |
6802 if ( pRenderer->uTargetGBits == 6 ) | |
6803 { | |
1574 | 6804 v17 = sr_42690D_colors_cvt(this_); |
0 | 6805 v18 = (65536 - LODWORD(a3)) * (v17 & 0x1F); |
6806 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); | |
6807 v19 = v40; | |
6808 v20 = off_4EFDB0; | |
6809 v21 = HIDWORD(v39); | |
6810 do | |
6811 { | |
6812 v22 = v38; | |
6813 v31 = v21; | |
6814 do | |
6815 { | |
6816 v23 = (*(int *)((char *)v20 | |
6817 + ((((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; | |
6818 result = this_ | |
6819 + (*((int *)v20 | |
6820 + (((unsigned __int8)(*((char *)v20 | |
6821 + ((((unsigned __int16)(*(short *)((char *)v20 | |
6822 + ((*(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); | |
6823 *(unsigned int *)LODWORD(v19) = result; | |
6824 LODWORD(v19) += 4; | |
6825 --v22; | |
6826 } | |
6827 while ( v22 ); | |
6828 LODWORD(v19) += v37; | |
6829 v21 = v31 - 1; | |
6830 } | |
6831 while ( v31 != 1 ); | |
6832 } | |
6833 else | |
6834 { | |
1574 | 6835 v24 = sr_4268E3_smthn_to_a1r5g5b5(this_); |
0 | 6836 v25 = (65536 - LODWORD(a3)) * (v24 & 0x1F); |
6837 this_ = (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) | |
6838 * (v24 & 0x3E0) & 0x3E00000u) >> 16 << 16) | (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) * (v24 & 0x3E0) & 0x3E00000u) >> 16); | |
6839 v26 = v40; | |
6840 v27 = (char *)off_4EFDB0; | |
6841 v28 = HIDWORD(v39); | |
6842 do | |
6843 { | |
6844 v29 = v38; | |
6845 v32 = v28; | |
6846 do | |
6847 { | |
6848 v30 = 32 | |
6849 * *(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; | |
6850 result = this_ | |
6851 + (*(int *)&v27[4 | |
6852 * (((unsigned __int8)(32 | |
6853 * 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); | |
6854 *(unsigned int *)LODWORD(v26) = result; | |
6855 LODWORD(v26) += 4; | |
6856 --v29; | |
6857 } | |
6858 while ( v29 ); | |
6859 LODWORD(v26) += v37; | |
6860 v28 = v32 - 1; | |
6861 } | |
6862 while ( v32 != 1 ); | |
6863 } | |
1574 | 6864 }*/ |
0 | 6865 return result; |
6866 } | |
6867 | |
6868 //----- (004A5B81) -------------------------------------------------------- | |
727 | 6869 void Render::SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) |
0 | 6870 { |
6871 this->bClip = 1; | |
6872 this->uClipY = uY; | |
6873 this->uClipX = uX; | |
6874 this->uClipW = uW; | |
6875 this->uClipZ = uZ; | |
6876 } | |
6877 | |
6878 //----- (004A5BB6) -------------------------------------------------------- | |
727 | 6879 void Render::ResetTextureClipRect() |
0 | 6880 { |
6881 this->uClipY = 0; | |
6882 this->uClipX = 0; | |
6883 this->bClip = 1; | |
6884 this->uClipW = 480; | |
6885 this->uClipZ = 640; | |
6886 } | |
6887 | |
6888 //----- (004A5BE3) -------------------------------------------------------- | |
6889 void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) | |
6890 { | |
6891 int v4; // edi@3 | |
6892 unsigned __int16 *v5; // edx@3 | |
6893 unsigned __int16 *v6; // esi@3 | |
6894 unsigned int v8; // eax@5 | |
6895 unsigned int v9; // ebx@5 | |
6896 unsigned int v11; // eax@7 | |
6897 unsigned int v12; // ebx@8 | |
6898 unsigned int v15; // eax@14 | |
6899 int v19; // [sp+10h] [bp-8h]@3 | |
6900 unsigned int uOutXa; // [sp+20h] [bp+8h]@16 | |
6901 int v23; // [sp+28h] [bp+10h]@3 | |
6902 | |
6903 if ( this->uNumSceneBegins && a4 ) | |
6904 { | |
6905 v4 = a4->uWidth; | |
6906 v5 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; | |
6907 v6 = a4->pPixels; | |
6908 v23 = a4->uHeight; | |
6909 v19 = v4; | |
6910 if ( this->bClip ) | |
6911 { | |
1152 | 6912 if ( (signed int)uOutX < (signed int)this->uClipX ) |
6913 { | |
6914 v8 = this->uClipX - uOutX; | |
6915 v9 = uOutX - this->uClipX; | |
0 | 6916 v8 *= 2; |
6917 v4 += v9; | |
6918 v6 = (unsigned __int16 *)((char *)v6 + v8); | |
6919 v5 = (unsigned __int16 *)((char *)v5 + v8); | |
6920 } | |
1152 | 6921 if ( (signed int)uOutY < (signed int)this->uClipY ) |
6922 { | |
6923 v11 = this->uClipY - uOutY; | |
0 | 6924 v6 += v19 * v11; |
6925 v23 += uOutY - this->uClipY; | |
6926 v5 += this->uTargetSurfacePitch * v11; | |
6927 } | |
1152 | 6928 v12 = max(this->uClipX, uOutX); |
6929 if ( (signed int)(v4 + v12) > (signed int)this->uClipZ ) | |
6930 { | |
6931 v4 = this->uClipZ - max(this->uClipX, uOutX); | |
6932 } | |
6933 v15 = max(this->uClipY, uOutY); | |
6934 if ( (signed int)(v15 + v23) > (signed int)this->uClipW ) | |
6935 { | |
6936 v23 = this->uClipW - max(this->uClipY, uOutY); | |
6937 } | |
6938 } | |
6939 | |
6940 for (int outerCounter = 0; outerCounter < v23; outerCounter++) | |
6941 { | |
6942 for (int counter = 0; counter < v4; counter++) | |
6943 { | |
6944 *v5 = *v6; | |
6945 ++v5; | |
6946 ++v6; | |
6947 } | |
6948 v6 += v19 - v4; | |
6949 v5 += this->uTargetSurfacePitch - v4; | |
0 | 6950 } |
6951 } | |
6952 } | |
6953 | |
6954 //----- (004A5D33) -------------------------------------------------------- | |
6955 void Render::_4A5D33(unsigned int pX, unsigned int pY, int a4, int a5, RGBTexture *pTexture) | |
6956 { | |
6957 Render *v6; // esi@1 | |
6958 unsigned __int16 *v7; // ebx@3 | |
6959 int v8; // ecx@3 | |
6960 int v9; // edx@3 | |
6961 int v10; // ecx@3 | |
6962 int v11; // edi@3 | |
6963 signed int v12; // eax@4 | |
6964 unsigned int v13; // eax@5 | |
6965 signed int v14; // eax@6 | |
6966 unsigned int v15; // eax@7 | |
6967 unsigned int v16; // edx@8 | |
6968 int v17; // eax@10 | |
6969 unsigned int v18; // ecx@11 | |
6970 unsigned int v19; // ecx@14 | |
6971 int v20; // eax@16 | |
6972 unsigned int v21; // ecx@17 | |
6973 int v22; // eax@21 | |
6974 int v23; // edi@23 | |
6975 int v24; // [sp+Ch] [bp-4h]@3 | |
6976 int a2a; // [sp+18h] [bp+8h]@21 | |
6977 unsigned int teal; // [sp+1Ch] [bp+Ch]@20 | |
6978 int a4a; // [sp+20h] [bp+10h]@3 | |
6979 int a4b; // [sp+20h] [bp+10h]@21 | |
6980 unsigned __int16 *pTexturea; // [sp+28h] [bp+18h]@3 | |
6981 | |
6982 v6 = this; | |
6983 if ( this->uNumSceneBegins && pTexture ) | |
6984 { | |
6985 v7 = &this->pTargetSurface[pX + pY * this->uTargetSurfacePitch]; | |
6986 v8 = pTexture->uWidth; | |
6987 v24 = pTexture->uWidth; | |
6988 v9 = a4 + a5 * v8; | |
6989 v10 = v8 - a4; | |
6990 a4a = v10; | |
6991 v11 = pTexture->uHeight - a5; | |
6992 pTexturea = &pTexture->pPixels[v9]; | |
6993 if ( v6->bClip ) | |
6994 { | |
6995 v12 = v6->uClipX; | |
6996 if ( (signed int)pX < v12 ) | |
6997 { | |
6998 v13 = 2 * (v12 - pX); | |
6999 pTexturea = (unsigned __int16 *)((char *)pTexturea + v13); | |
7000 v10 += pX - v6->uClipX; | |
7001 v7 = (unsigned __int16 *)((char *)v7 + v13); | |
7002 a4a = v10; | |
7003 } | |
7004 v14 = v6->uClipY; | |
7005 if ( (signed int)pY < v14 ) | |
7006 { | |
7007 v15 = v14 - pY; | |
7008 pTexturea += v24 * v15; | |
7009 v11 += pY - v6->uClipY; | |
7010 v10 = a4a; | |
7011 v7 += v6->uTargetSurfacePitch * v15; | |
7012 } | |
7013 v16 = v6->uClipX; | |
7014 if ( (signed int)v16 < (signed int)pX ) | |
7015 v16 = pX; | |
7016 v17 = v6->uClipZ; | |
7017 if ( (signed int)(v10 + v16) > v17 ) | |
7018 { | |
7019 v18 = v6->uClipX; | |
7020 if ( (signed int)v18 < (signed int)pX ) | |
7021 v18 = pX; | |
7022 a4a = v17 - v18; | |
7023 } | |
7024 v19 = v6->uClipY; | |
7025 if ( (signed int)v19 < (signed int)pY ) | |
7026 v19 = pY; | |
7027 v20 = v6->uClipW; | |
7028 if ( (signed int)(v11 + v19) > v20 ) | |
7029 { | |
7030 v21 = v6->uClipY; | |
7031 if ( (signed int)v21 < (signed int)pY ) | |
7032 v21 = pY; | |
7033 v11 = v20 - v21; | |
7034 } | |
7035 } | |
949 | 7036 teal = TargetColor(0, 0xFFu, 0xFFu); |
0 | 7037 if ( v11 > 0 ) |
7038 { | |
7039 v22 = a4a; | |
7040 a2a = v11; | |
7041 a4b = 2 * (v24 - a4a); | |
7042 do | |
7043 { | |
7044 if ( v22 > 0 ) | |
7045 { | |
7046 v23 = v22; | |
7047 do | |
7048 { | |
7049 if ( *pTexturea != teal ) | |
7050 *v7 = *pTexturea; | |
7051 ++pTexturea; | |
7052 ++v7; | |
7053 --v23; | |
7054 } | |
7055 while ( v23 ); | |
7056 } | |
7057 v7 += v6->uTargetSurfacePitch - v22; | |
7058 pTexturea = (unsigned __int16 *)((char *)pTexturea + a4b); | |
7059 --a2a; | |
7060 } | |
7061 while ( a2a ); | |
7062 } | |
7063 } | |
7064 } | |
7065 | |
7066 //----- (004A6E7E) -------------------------------------------------------- | |
7067 void Render::_4A6E7E(unsigned int a2, unsigned int a3, Texture *a4) | |
7068 { | |
7069 unsigned __int16 *v4; // eax@4 | |
7070 int v5; // edx@4 | |
7071 unsigned int v6; // edi@4 | |
7072 unsigned int v7; // edx@5 | |
7073 unsigned int v8; // edx@6 | |
7074 unsigned int v9; // edx@7 | |
7075 unsigned int v10; // edx@8 | |
7076 unsigned int v11; // ebx@9 | |
7077 unsigned int v12; // esi@11 | |
7078 unsigned int v13; // edx@12 | |
7079 unsigned int v14; // ebx@15 | |
7080 unsigned int v15; // esi@17 | |
7081 unsigned int v16; // edi@18 | |
7082 char v17; // zf@29 | |
7083 int v18; // [sp+14h] [bp-Ch]@4 | |
7084 int v19; // [sp+18h] [bp-8h]@4 | |
7085 unsigned __int8 *v20; // [sp+1Ch] [bp-4h]@4 | |
7086 int v21; // [sp+28h] [bp+8h]@25 | |
7087 int v22; // [sp+28h] [bp+8h]@34 | |
7088 unsigned int v23; // [sp+2Ch] [bp+Ch]@23 | |
7089 unsigned int v24; // [sp+2Ch] [bp+Ch]@32 | |
7090 | |
7091 if ( this->uNumSceneBegins && a4 && a4->pPalette16 ) | |
7092 { | |
7093 v4 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 7094 v20 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7095 v5 = a4->uTextureWidth; |
7096 v6 = a4->uTextureHeight; | |
7097 v19 = a4->uTextureWidth; | |
7098 v18 = a4->uTextureWidth; | |
7099 if ( this->bClip ) | |
7100 { | |
7101 v7 = this->uClipX; | |
7102 if ( (signed int)a2 < (signed int)v7 ) | |
7103 { | |
7104 v8 = v7 - a2; | |
7105 v20 += v8; | |
7106 v19 += a2 - this->uClipX; | |
7107 v4 += v8; | |
7108 } | |
7109 v9 = this->uClipY; | |
7110 if ( (signed int)a3 < (signed int)v9 ) | |
7111 { | |
7112 v10 = v9 - a3; | |
7113 v20 += v18 * v10; | |
7114 v6 = a3 - this->uClipY + a4->uTextureHeight; | |
7115 v4 += this->uTargetSurfacePitch * v10; | |
7116 } | |
7117 v11 = this->uClipX; | |
7118 v5 = v19; | |
7119 if ( (signed int)v11 < (signed int)a2 ) | |
7120 v11 = a2; | |
7121 v12 = this->uClipZ; | |
7122 if ( (signed int)(v19 + v11) > (signed int)v12 ) | |
7123 { | |
7124 v13 = this->uClipX; | |
7125 if ( (signed int)v13 < (signed int)a2 ) | |
7126 v13 = a2; | |
7127 v5 = v12 - v13; | |
7128 } | |
7129 v14 = this->uClipY; | |
7130 if ( (signed int)v14 < (signed int)a3 ) | |
7131 v14 = a3; | |
7132 v15 = this->uClipW; | |
7133 if ( (signed int)(v6 + v14) > (signed int)v15 ) | |
7134 { | |
7135 v16 = this->uClipY; | |
7136 if ( (signed int)v16 < (signed int)a3 ) | |
7137 v16 = a3; | |
7138 v6 = v15 - v16; | |
7139 } | |
7140 } | |
7141 if ( pRenderer->uTargetGBits == 5 ) | |
7142 { | |
7143 if ( (signed int)v6 > 0 ) | |
7144 { | |
7145 v23 = v6; | |
7146 do | |
7147 { | |
7148 if ( v5 > 0 ) | |
7149 { | |
7150 v21 = v5; | |
7151 do | |
7152 { | |
7153 if ( *v20 ) | |
7154 *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x3DEF; | |
7155 ++v4; | |
7156 ++v20; | |
7157 --v21; | |
7158 } | |
7159 while ( v21 ); | |
7160 } | |
7161 v20 += v18 - v5; | |
7162 v17 = v23-- == 1; | |
7163 v4 += this->uTargetSurfacePitch - v5; | |
7164 } | |
7165 while ( !v17 ); | |
7166 } | |
7167 } | |
7168 else | |
7169 { | |
7170 if ( (signed int)v6 > 0 ) | |
7171 { | |
7172 v24 = v6; | |
7173 do | |
7174 { | |
7175 if ( v5 > 0 ) | |
7176 { | |
7177 v22 = v5; | |
7178 do | |
7179 { | |
7180 if ( *v20 ) | |
7181 *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF; | |
7182 ++v4; | |
7183 ++v20; | |
7184 --v22; | |
7185 } | |
7186 while ( v22 ); | |
7187 } | |
7188 v20 += v18 - v5; | |
7189 v17 = v24-- == 1; | |
7190 v4 += this->uTargetSurfacePitch - v5; | |
7191 } | |
7192 while ( !v17 ); | |
7193 } | |
7194 } | |
7195 } | |
7196 } | |
7197 | |
7198 //----- (004A6DF5) -------------------------------------------------------- | |
7199 int Render::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) | |
7200 { | |
7201 int result; // eax@0 | |
7202 int v8; // ecx@3 | |
7203 unsigned __int16 *v9; // edi@4 | |
7204 unsigned __int16 *v10; // ebx@4 | |
7205 int v11; // esi@4 | |
7206 unsigned __int16 *pBitmapa; // [sp+14h] [bp+8h]@3 | |
7207 unsigned __int16 *pTargeta; // [sp+20h] [bp+14h]@3 | |
7208 | |
7209 if ( pBitmap ) | |
7210 { | |
7211 if ( pTarget ) | |
7212 { | |
7213 pBitmapa = &pBitmap[pBitmapXY->x + uBitmapPitch * pBitmapXY->y]; | |
7214 pTargeta = &pTarget[a7->x + uTargetPitch * a7->y]; | |
7215 v8 = a7->z - a7->x; | |
7216 result = a7->w - a7->y; | |
7217 if ( result > 0 ) | |
7218 { | |
7219 v9 = pBitmapa; | |
7220 v10 = pTargeta; | |
7221 v11 = a7->w - a7->y; | |
7222 do | |
7223 { | |
7224 if ( v8 > 0 ) | |
7225 { | |
7226 result = v8; | |
7227 do | |
7228 { | |
7229 *v9 = *v10; | |
7230 ++v9; | |
7231 ++v10; | |
7232 --result; | |
7233 } | |
7234 while ( result ); | |
7235 } | |
7236 v9 += uBitmapPitch - v8; | |
7237 v10 += uTargetPitch - v8; | |
7238 --v11; | |
7239 } | |
7240 while ( v11 ); | |
7241 } | |
7242 } | |
7243 } | |
7244 return result; | |
7245 } | |
7246 | |
7247 //----- (004A6D87) -------------------------------------------------------- | |
7248 void Render::FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16) | |
7249 { | |
7250 if (!uNumSceneBegins) | |
7251 return; | |
7252 | |
7253 unsigned __int32 twoColors = (uColor16 << 16) | uColor16; | |
7254 for (uint y = 0; y < uHeight; ++y) | |
7255 { | |
7256 auto pDst = &pTargetSurface[uX + (y + uY) * uTargetSurfacePitch]; | |
7257 | |
7258 memset32(pDst, twoColors, uWidth / 2); | |
7259 if (uWidth & 1) | |
7260 pDst[uWidth - 1] = uColor16; | |
7261 } | |
7262 } | |
7263 | |
7264 //----- (004A6C4F) -------------------------------------------------------- | |
7265 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) | |
7266 { | |
7267 unsigned int v9; // edi@2 | |
7268 unsigned int v10; // esi@2 | |
7269 unsigned __int16 *v11; // eax@2 | |
7270 unsigned int v12; // ebx@3 | |
7271 signed int v13; // edx@5 | |
7272 int v14; // edx@6 | |
7273 signed int v15; // ebx@7 | |
7274 unsigned int v16; // edx@9 | |
7275 signed int v17; // edi@10 | |
7276 signed int v18; // ebx@13 | |
7277 unsigned int v19; // edx@15 | |
7278 signed int v20; // esi@16 | |
7279 unsigned int v21; // esi@22 | |
7280 unsigned __int16 v22; // dx@24 | |
7281 char v23; // zf@28 | |
7282 unsigned __int8 *v24; // [sp+Ch] [bp-4h]@2 | |
7283 unsigned int uOutXa; // [sp+18h] [bp+8h]@20 | |
7284 | |
7285 if ( this->uNumSceneBegins ) | |
7286 { | |
7287 v9 = uCharWidth; | |
7288 v10 = uCharHeight; | |
7289 v11 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; | |
7290 v24 = pFontPixels; | |
7291 if ( this->bClip ) | |
7292 { | |
7293 v12 = this->uClipX; | |
7294 if ( uOutX < (signed int)v12 ) | |
7295 { | |
7296 v24 = &pFontPixels[v12 - uOutX]; | |
7297 v11 += v12 - uOutX; | |
7298 v9 = uCharWidth + uOutX - v12; | |
7299 } | |
7300 v13 = this->uClipY; | |
7301 if ( uOutY < v13 ) | |
7302 { | |
7303 v14 = v13 - uOutY; | |
7304 v24 += uCharWidth * v14; | |
7305 v10 = uCharHeight + uOutY - this->uClipY; | |
7306 v11 += this->uTargetSurfacePitch * v14; | |
7307 } | |
7308 v15 = this->uClipX; | |
7309 if ( v15 < uOutX ) | |
7310 v15 = uOutX; | |
7311 v16 = this->uClipZ; | |
7312 if ( (signed int)(v9 + v15) > (signed int)v16 ) | |
7313 { | |
7314 v17 = this->uClipX; | |
7315 if ( v17 < uOutX ) | |
7316 v17 = uOutX; | |
7317 v9 = v16 - v17; | |
7318 } | |
7319 v18 = this->uClipY; | |
7320 if ( v18 < uOutY ) | |
7321 v18 = uOutY; | |
7322 v19 = this->uClipW; | |
7323 if ( (signed int)(v10 + v18) > (signed int)v19 ) | |
7324 { | |
7325 v20 = this->uClipY; | |
7326 if ( v20 < uOutY ) | |
7327 v20 = uOutY; | |
7328 v10 = v19 - v20; | |
7329 } | |
7330 } | |
7331 if ( (signed int)v10 > 0 ) | |
7332 { | |
7333 uOutXa = v10; | |
7334 do | |
7335 { | |
7336 if ( (signed int)v9 > 0 ) | |
7337 { | |
7338 v21 = v9; | |
7339 do | |
7340 { | |
7341 if ( *v24 ) | |
7342 { | |
7343 v22 = uShadowColor; | |
7344 if ( *v24 != 1 ) | |
7345 v22 = uFaceColor; | |
7346 *v11 = v22; | |
7347 } | |
7348 ++v11; | |
7349 ++v24; | |
7350 --v21; | |
7351 } | |
7352 while ( v21 ); | |
7353 } | |
7354 v24 += uCharWidth - v9; | |
7355 v23 = uOutXa-- == 1; | |
7356 v11 += this->uTargetSurfacePitch - v9; | |
7357 } | |
7358 while ( !v23 ); | |
7359 } | |
7360 } | |
7361 } | |
7362 | |
7363 //----- (004A6A68) -------------------------------------------------------- | |
1496 | 7364 void Render::GetLeather(unsigned int a2, unsigned int a3, Texture *a4, __int16 height) |
7365 { | |
0 | 7366 Texture tex; // [sp+Ch] [bp-48h]@1 |
1496 | 7367 |
0 | 7368 memcpy(&tex, a4, sizeof(tex)); |
1496 | 7369 tex.uTextureHeight = a4->uTextureHeight - height; |
7370 if ( (signed __int16)tex.uTextureHeight > 0 ) | |
0 | 7371 DrawTextureIndexed(a2, a3, &tex); |
7372 } | |
7373 | |
7374 //----- (004A6AB1) -------------------------------------------------------- | |
1268 | 7375 void Render::DrawTextPalette( int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8 ) |
7376 { | |
0 | 7377 int v8; // edi@2 |
7378 unsigned int v9; // esi@2 | |
7379 unsigned __int16 *v10; // eax@2 | |
7380 unsigned char *v11; // edx@2 | |
7381 unsigned int v12; // ebx@3 | |
7382 signed int v13; // edx@5 | |
7383 int v14; // edx@6 | |
7384 signed int v15; // ebx@7 | |
7385 unsigned int v16; // edx@9 | |
7386 signed int v17; // edi@10 | |
7387 signed int v18; // ebx@13 | |
7388 unsigned int v19; // edx@15 | |
7389 signed int v20; // esi@16 | |
7390 int v21; // ebx@22 | |
7391 char v22; // zf@28 | |
7392 int v23; // ebx@31 | |
7393 unsigned __int16 v24; // si@35 | |
7394 int v25; // [sp+Ch] [bp-4h]@2 | |
7395 int v26; // [sp+1Ch] [bp+Ch]@24 | |
7396 int v27; // [sp+1Ch] [bp+Ch]@33 | |
7397 unsigned int v28; // [sp+20h] [bp+10h]@30 | |
7398 unsigned int v29; // [sp+24h] [bp+14h]@22 | |
7399 unsigned int v30; // [sp+24h] [bp+14h]@31 | |
7400 | |
7401 auto a2 = x; | |
7402 auto a3 = y; | |
7403 auto a6 = uFontHeight; | |
7404 if ( this->uNumSceneBegins ) | |
7405 { | |
7406 v8 = a5; | |
7407 v9 = a6; | |
7408 v10 = &pTargetSurface[x + y * uTargetSurfacePitch]; | |
1268 | 7409 v11 = (unsigned char *)font_pixels; |
7410 v25 = (int)font_pixels; | |
0 | 7411 if ( this->bClip ) |
7412 { | |
7413 v12 = this->uClipX; | |
7414 if ( a2 < (signed int)v12 ) | |
7415 { | |
1268 | 7416 v25 = v12 - a2 + (int)font_pixels; |
0 | 7417 v10 += v12 - a2; |
7418 v8 = a5 + a2 - v12; | |
7419 } | |
7420 v13 = this->uClipY; | |
7421 if ( a3 < v13 ) | |
7422 { | |
7423 v14 = v13 - a3; | |
7424 v25 += a5 * v14; | |
7425 v9 = a6 + a3 - this->uClipY; | |
7426 v10 += this->uTargetSurfacePitch * v14; | |
7427 } | |
7428 v15 = this->uClipX; | |
7429 if ( v15 < a2 ) | |
7430 v15 = a2; | |
7431 v16 = this->uClipZ; | |
7432 if ( v8 + v15 > (signed int)v16 ) | |
7433 { | |
7434 v17 = this->uClipX; | |
7435 if ( v17 < a2 ) | |
7436 v17 = a2; | |
7437 v8 = v16 - v17; | |
7438 } | |
7439 v18 = this->uClipY; | |
7440 if ( v18 < a3 ) | |
7441 v18 = a3; | |
7442 v19 = this->uClipW; | |
7443 if ( (signed int)(v9 + v18) > (signed int)v19 ) | |
7444 { | |
7445 v20 = this->uClipY; | |
7446 if ( v20 < a3 ) | |
7447 v20 = a3; | |
7448 v9 = v19 - v20; | |
7449 } | |
7450 v11 = (unsigned char *)v25; | |
7451 } | |
7452 if ( a8 ) | |
7453 { | |
7454 v28 = pRenderer->uTargetGMask | pRenderer->uTargetBMask; | |
7455 if ( (signed int)v9 > 0 ) | |
7456 { | |
7457 v23 = a5; | |
7458 v30 = v9; | |
7459 do | |
7460 { | |
7461 if ( v8 > 0 ) | |
7462 { | |
7463 v27 = v8; | |
7464 do | |
7465 { | |
7466 if ( *v11 ) | |
7467 v24 = pPalette[*v11]; | |
7468 else | |
7469 v24 = v28; | |
7470 *v10 = v24; | |
7471 ++v10; | |
7472 ++v11; | |
7473 --v27; | |
7474 } | |
7475 while ( v27 ); | |
7476 } | |
7477 v11 += v23 - v8; | |
7478 v22 = v30-- == 1; | |
7479 v10 += this->uTargetSurfacePitch - v8; | |
7480 } | |
7481 while ( !v22 ); | |
7482 } | |
7483 } | |
7484 else | |
7485 { | |
7486 if ( (signed int)v9 > 0 ) | |
7487 { | |
7488 v21 = a5; | |
7489 v29 = v9; | |
7490 do | |
7491 { | |
7492 if ( v8 > 0 ) | |
7493 { | |
7494 v26 = v8; | |
7495 do | |
7496 { | |
7497 if ( *v11 ) | |
7498 *v10 = pPalette[*v11]; | |
7499 ++v10; | |
7500 ++v11; | |
7501 --v26; | |
7502 } | |
7503 while ( v26 ); | |
7504 } | |
7505 v11 += v21 - v8; | |
7506 v22 = v29-- == 1; | |
7507 v10 += this->uTargetSurfacePitch - v8; | |
7508 } | |
7509 while ( !v22 ); | |
7510 } | |
7511 } | |
7512 } | |
7513 } | |
7514 | |
7515 //----- (004A68EF) -------------------------------------------------------- | |
7516 void Render::DrawTransparentGreenShade(signed int a2, signed int a3, Texture *pTexture) | |
7517 { | |
7518 Texture *v4; // edi@2 | |
7519 unsigned int v5; // ebx@4 | |
7520 unsigned __int16 *v6; // eax@4 | |
7521 signed int v7; // edx@5 | |
7522 int v8; // edx@6 | |
7523 signed int v9; // edx@7 | |
7524 int v10; // edx@8 | |
7525 signed int v11; // edx@9 | |
7526 signed int v12; // esi@12 | |
7527 signed int v13; // esi@15 | |
7528 unsigned int v14; // edx@17 | |
7529 signed int v15; // esi@18 | |
7530 unsigned __int8 *v16; // ebx@22 | |
7531 char v17; // zf@28 | |
7532 int v18; // [sp+10h] [bp-10h]@4 | |
7533 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
7534 int v20; // [sp+1Ch] [bp-4h]@4 | |
7535 int v21; // [sp+28h] [bp+8h]@24 | |
7536 unsigned int v22; // [sp+2Ch] [bp+Ch]@22 | |
7537 unsigned int pTexturea; // [sp+30h] [bp+10h]@11 | |
7538 | |
7539 if ( this->uNumSceneBegins ) | |
7540 { | |
7541 v4 = pTexture; | |
7542 if ( pTexture ) | |
7543 { | |
7544 if ( pTexture->pPalette16 ) | |
7545 { | |
7546 v5 = pTexture->uTextureHeight; | |
7547 v6 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 7548 v19 = pTexture->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7549 v20 = pTexture->uTextureWidth; |
7550 v18 = pTexture->uTextureWidth; | |
7551 if ( this->bClip ) | |
7552 { | |
7553 v7 = this->uClipX; | |
7554 if ( a2 < v7 ) | |
7555 { | |
7556 v8 = v7 - a2; | |
7557 v19 += v8; | |
7558 v20 += a2 - this->uClipX; | |
7559 v6 += v8; | |
7560 } | |
7561 v9 = this->uClipY; | |
7562 v5 = pTexture->uTextureHeight; | |
7563 if ( a3 < v9 ) | |
7564 { | |
7565 v10 = v9 - a3; | |
7566 v19 += v18 * v10; | |
7567 v5 = a3 - this->uClipY + pTexture->uTextureHeight; | |
7568 v4 = pTexture; | |
7569 v6 += this->uTargetSurfacePitch * v10; | |
7570 } | |
7571 v11 = this->uClipX; | |
7572 if ( v11 < a2 ) | |
7573 v11 = a2; | |
7574 pTexturea = this->uClipZ; | |
7575 if ( v11 + v20 > (signed int)pTexturea ) | |
7576 { | |
7577 v12 = this->uClipX; | |
7578 if ( v12 < a2 ) | |
7579 v12 = a2; | |
7580 v20 = pTexturea - v12; | |
7581 } | |
7582 v13 = this->uClipY; | |
7583 if ( v13 < a3 ) | |
7584 v13 = a3; | |
7585 v14 = this->uClipW; | |
7586 if ( (signed int)(v5 + v13) > (signed int)v14 ) | |
7587 { | |
7588 v15 = this->uClipY; | |
7589 if ( v15 < a3 ) | |
7590 v15 = a3; | |
7591 v5 = v14 - v15; | |
7592 } | |
7593 } | |
7594 if ( (signed int)v5 > 0 ) | |
7595 { | |
7596 v22 = v5; | |
7597 v16 = v19; | |
7598 do | |
7599 { | |
7600 if ( v20 > 0 ) | |
7601 { | |
7602 v21 = v20; | |
7603 do | |
7604 { | |
7605 if ( *v16 ) | |
7606 *v6 = this->uTargetGMask & v4->pPalette16[*v16]; | |
7607 ++v6; | |
7608 ++v16; | |
7609 --v21; | |
7610 } | |
7611 while ( v21 ); | |
7612 } | |
7613 v16 += v18 - v20; | |
7614 v17 = v22-- == 1; | |
7615 v6 += this->uTargetSurfacePitch - v20; | |
7616 } | |
7617 while ( !v17 ); | |
7618 } | |
7619 } | |
7620 } | |
7621 } | |
7622 } | |
7623 | |
7624 //----- (004A6776) -------------------------------------------------------- | |
315 | 7625 void Render::DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4) |
0 | 7626 { |
7627 Texture *v4; // edi@2 | |
7628 unsigned int v5; // ebx@4 | |
7629 unsigned __int16 *v6; // eax@4 | |
7630 unsigned int v7; // edx@5 | |
7631 unsigned int v8; // edx@6 | |
7632 unsigned int v9; // edx@7 | |
7633 unsigned int v10; // edx@8 | |
7634 unsigned int v11; // edx@9 | |
7635 unsigned int v12; // esi@12 | |
7636 unsigned int v13; // esi@15 | |
7637 unsigned int v14; // edx@17 | |
7638 unsigned int v15; // esi@18 | |
7639 unsigned __int8 *v16; // ebx@22 | |
7640 char v17; // zf@28 | |
7641 int v18; // [sp+10h] [bp-10h]@4 | |
7642 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
7643 int v20; // [sp+1Ch] [bp-4h]@4 | |
7644 int a2a; // [sp+28h] [bp+8h]@24 | |
7645 unsigned int a3a; // [sp+2Ch] [bp+Ch]@22 | |
7646 unsigned int a4a; // [sp+30h] [bp+10h]@11 | |
7647 | |
7648 if ( this->uNumSceneBegins ) | |
7649 { | |
7650 v4 = a4; | |
7651 if ( a4 ) | |
7652 { | |
7653 if ( a4->pPalette16 ) | |
7654 { | |
7655 v5 = a4->uTextureHeight; | |
7656 v6 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 7657 v19 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7658 v20 = a4->uTextureWidth; |
7659 v18 = a4->uTextureWidth; | |
7660 if ( this->bClip ) | |
7661 { | |
7662 v7 = this->uClipX; | |
7663 if ( (signed int)a2 < (signed int)v7 ) | |
7664 { | |
7665 v8 = v7 - a2; | |
7666 v19 += v8; | |
7667 v20 += a2 - this->uClipX; | |
7668 v6 += v8; | |
7669 } | |
7670 v9 = this->uClipY; | |
7671 v5 = a4->uTextureHeight; | |
7672 if ( (signed int)a3 < (signed int)v9 ) | |
7673 { | |
7674 v10 = v9 - a3; | |
7675 v19 += v18 * v10; | |
7676 v5 = a3 - this->uClipY + a4->uTextureHeight; | |
7677 v4 = a4; | |
7678 v6 += this->uTargetSurfacePitch * v10; | |
7679 } | |
7680 v11 = this->uClipX; | |
7681 if ( (signed int)v11 < (signed int)a2 ) | |
7682 v11 = a2; | |
7683 a4a = this->uClipZ; | |
7684 if ( (signed int)(v11 + v20) > (signed int)a4a ) | |
7685 { | |
7686 v12 = this->uClipX; | |
7687 if ( (signed int)v12 < (signed int)a2 ) | |
7688 v12 = a2; | |
7689 v20 = a4a - v12; | |
7690 } | |
7691 v13 = this->uClipY; | |
7692 if ( (signed int)v13 < (signed int)a3 ) | |
7693 v13 = a3; | |
7694 v14 = this->uClipW; | |
7695 if ( (signed int)(v5 + v13) > (signed int)v14 ) | |
7696 { | |
7697 v15 = this->uClipY; | |
7698 if ( (signed int)v15 < (signed int)a3 ) | |
7699 v15 = a3; | |
7700 v5 = v14 - v15; | |
7701 } | |
7702 } | |
7703 if ( (signed int)v5 > 0 ) | |
7704 { | |
7705 a3a = v5; | |
7706 v16 = v19; | |
7707 do | |
7708 { | |
7709 if ( v20 > 0 ) | |
7710 { | |
7711 a2a = v20; | |
7712 do | |
7713 { | |
7714 if ( *v16 ) | |
7715 *v6 = this->uTargetRMask & v4->pPalette16[*v16]; | |
7716 ++v6; | |
7717 ++v16; | |
7718 --a2a; | |
7719 } | |
7720 while ( a2a ); | |
7721 } | |
7722 v16 += v18 - v20; | |
7723 v17 = a3a-- == 1; | |
7724 v6 += this->uTargetSurfacePitch - v20; | |
7725 } | |
7726 while ( !v17 ); | |
7727 } | |
7728 } | |
7729 } | |
7730 } | |
7731 } | |
7732 | |
7733 //----- (004A65CC) -------------------------------------------------------- | |
7734 void Render::_4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8) | |
7735 { | |
7736 unsigned __int16 *v8; // esi@6 | |
7737 unsigned int v9; // edi@6 | |
7738 unsigned int v10; // eax@7 | |
7739 unsigned int v11; // eax@8 | |
7740 unsigned int v12; // eax@9 | |
7741 unsigned int v13; // eax@10 | |
7742 unsigned int v14; // edx@11 | |
7743 unsigned int v15; // eax@13 | |
7744 unsigned int v16; // edx@14 | |
7745 unsigned int v17; // edx@17 | |
7746 unsigned int v18; // eax@19 | |
7747 unsigned int v19; // edx@20 | |
7748 int v20; // eax@27 | |
7749 int v21; // edx@29 | |
7750 int v22; // [sp+Ch] [bp-Ch]@6 | |
7751 int v23; // [sp+Ch] [bp-Ch]@24 | |
7752 unsigned __int8 *v24; // [sp+14h] [bp-4h]@6 | |
7753 int xa; // [sp+20h] [bp+8h]@26 | |
7754 unsigned int ya; // [sp+24h] [bp+Ch]@24 | |
7755 int v27; // [sp+2Ch] [bp+14h]@6 | |
7756 | |
7757 if ( this->uNumSceneBegins && a4 && a4->pPalette16 && a5 && a5->pPalette16 ) | |
7758 { | |
7759 v8 = &this->pTargetSurface[x + y * this->uTargetSurfacePitch]; | |
710 | 7760 v24 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7761 v27 = a4->uTextureWidth; |
7762 v9 = a4->uTextureHeight; | |
7763 v22 = a4->uTextureWidth; | |
7764 if ( this->bClip ) | |
7765 { | |
7766 v10 = this->uClipX; | |
7767 if ( (signed int)x < (signed int)v10 ) | |
7768 { | |
7769 v11 = v10 - x; | |
7770 v24 += v11; | |
7771 v27 += x - this->uClipX; | |
7772 v8 += v11; | |
7773 } | |
7774 v12 = this->uClipY; | |
7775 if ( (signed int)y < (signed int)v12 ) | |
7776 { | |
7777 v13 = v12 - y; | |
7778 v24 += v22 * v13; | |
7779 v9 = y - this->uClipY + a4->uTextureHeight; | |
7780 v8 += this->uTargetSurfacePitch * v13; | |
7781 } | |
7782 v14 = this->uClipX; | |
7783 if ( (signed int)v14 < (signed int)x ) | |
7784 v14 = x; | |
7785 v15 = this->uClipZ; | |
7786 if ( (signed int)(v27 + v14) > (signed int)v15 ) | |
7787 { | |
7788 v16 = this->uClipX; | |
7789 if ( (signed int)v16 < (signed int)x ) | |
7790 v16 = x; | |
7791 v27 = v15 - v16; | |
7792 } | |
7793 v17 = this->uClipY; | |
7794 if ( (signed int)v17 < (signed int)y ) | |
7795 v17 = y; | |
7796 v18 = this->uClipW; | |
7797 if ( (signed int)(v9 + v17) > (signed int)v18 ) | |
7798 { | |
7799 v19 = this->uClipY; | |
7800 if ( (signed int)v19 < (signed int)y ) | |
7801 v19 = y; | |
7802 v9 = v18 - v19; | |
7803 } | |
7804 } | |
7805 if ( (signed int)v9 > 0 ) | |
7806 { | |
7807 ya = v9; | |
7808 v23 = v22 - v27; | |
7809 do | |
7810 { | |
7811 if ( v27 > 0 ) | |
7812 { | |
7813 xa = v27; | |
7814 do | |
7815 { | |
7816 v20 = *v24; | |
7817 if ( v20 >= a7 && v20 <= a8 ) | |
7818 { | |
7819 v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); | |
7820 if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) | |
7821 v21 = 2 * a8 - v21 - a7; | |
7822 *v8 = a4->pPalette16[v21]; | |
7823 } | |
7824 ++v8; | |
7825 ++v24; | |
7826 --xa; | |
7827 } | |
7828 while ( xa ); | |
7829 } | |
7830 v8 += this->uTargetSurfacePitch - v27; | |
7831 v24 += v23; | |
7832 --ya; | |
7833 } | |
7834 while ( ya ); | |
7835 } | |
7836 } | |
7837 } | |
7838 | |
7839 //----- (004A63E6) -------------------------------------------------------- | |
1455 | 7840 void Render::DrawAura(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) |
0 | 7841 { |
7842 Texture *v8; // eax@2 | |
7843 Texture *v9; // ebx@4 | |
7844 unsigned __int16 *v10; // esi@6 | |
7845 unsigned int v11; // edi@7 | |
7846 unsigned int v12; // eax@9 | |
7847 unsigned int v13; // eax@10 | |
7848 unsigned int v14; // edx@11 | |
7849 unsigned int v15; // eax@13 | |
7850 unsigned int v16; // edx@14 | |
7851 unsigned int v17; // edx@17 | |
7852 unsigned int v18; // eax@19 | |
7853 unsigned int v19; // edx@20 | |
7854 int v20; // eax@27 | |
7855 int v21; // edx@29 | |
7856 int v22; // [sp+Ch] [bp-Ch]@6 | |
7857 int v23; // [sp+Ch] [bp-Ch]@24 | |
7858 int v24; // [sp+10h] [bp-8h]@6 | |
7859 int v25; // [sp+14h] [bp-4h]@6 | |
7860 int i; // [sp+20h] [bp+8h]@25 | |
7861 int v27; // [sp+24h] [bp+Ch]@23 | |
7862 unsigned __int8 *v28; // [sp+28h] [bp+10h]@6 | |
7863 | |
7864 if ( this->uNumSceneBegins ) | |
7865 { | |
7866 v8 = a4; | |
7867 if ( a4 ) | |
7868 { | |
7869 if ( a4->pPalette16 ) | |
7870 { | |
7871 v9 = a5; | |
7872 if ( a5 ) | |
7873 { | |
7874 if ( a5->pPalette16 ) | |
7875 { | |
7876 v10 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 7877 v28 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7878 v25 = v8->uTextureWidth; |
7879 v24 = v8->uTextureHeight; | |
7880 v22 = v8->uTextureWidth; | |
7881 if ( this->bClip ) | |
7882 { | |
7883 v11 = this->uClipX; | |
7884 if ( (signed int)a2 < (signed int)v11 ) | |
7885 { | |
7886 v28 += v11 - a2; | |
7887 v25 += a2 - v11; | |
7888 v9 = a5; | |
7889 v10 += v11 - a2; | |
7890 } | |
7891 v12 = this->uClipY; | |
7892 if ( (signed int)a3 < (signed int)v12 ) | |
7893 { | |
7894 v13 = v12 - a3; | |
7895 v9 = a5; | |
7896 v28 += v22 * v13; | |
7897 v24 += a3 - this->uClipY; | |
7898 v10 += this->uTargetSurfacePitch * v13; | |
7899 } | |
7900 v14 = this->uClipX; | |
7901 if ( (signed int)v14 < (signed int)a2 ) | |
7902 v14 = a2; | |
7903 v15 = this->uClipZ; | |
7904 if ( (signed int)(v25 + v14) > (signed int)v15 ) | |
7905 { | |
7906 v16 = this->uClipX; | |
7907 if ( (signed int)v16 < (signed int)a2 ) | |
7908 v16 = a2; | |
7909 v25 = v15 - v16; | |
7910 } | |
7911 v17 = this->uClipY; | |
7912 if ( (signed int)v17 < (signed int)a3 ) | |
7913 v17 = a3; | |
7914 v18 = this->uClipW; | |
7915 if ( (signed int)(v24 + v17) > (signed int)v18 ) | |
7916 { | |
7917 v19 = this->uClipY; | |
7918 if ( (signed int)v19 < (signed int)a3 ) | |
7919 v19 = a3; | |
7920 v24 = v18 - v19; | |
7921 } | |
7922 } | |
7923 v27 = 0; | |
7924 if ( v24 > 0 ) | |
7925 { | |
7926 v23 = v22 - v25; | |
7927 do | |
7928 { | |
7929 for ( i = 0; i < v25; ++v28 ) | |
7930 { | |
7931 if ( *v28 ) | |
7932 { | |
710 | 7933 v20 = *(&v9->pLevelOfDetail0_prolly_alpha_mask[i & v9->uWidthMinus1] + v9->uTextureWidth * (v27 & v9->uHeightMinus1)); |
0 | 7934 if ( v20 >= a7 ) |
7935 { | |
7936 if ( v20 <= a8 ) | |
7937 { | |
7938 v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); | |
7939 if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) | |
7940 v21 = 2 * a8 - v21 - a7; | |
7941 v9 = a5; | |
7942 *v10 = a5->pPalette16[v21]; | |
7943 } | |
7944 } | |
7945 } | |
7946 ++i; | |
7947 ++v10; | |
7948 } | |
7949 ++v27; | |
7950 v10 += this->uTargetSurfacePitch - v25; | |
7951 v28 += v23; | |
7952 } | |
7953 while ( v27 < v24 ); | |
7954 } | |
7955 } | |
7956 } | |
7957 } | |
7958 } | |
7959 } | |
7960 } | |
7961 | |
7962 //----- (004A6274) -------------------------------------------------------- | |
7963 void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture) | |
7964 { | |
7965 Texture *pCurrentTexture; // edi@2 | |
7966 int uHeight; // ebx@4 | |
7967 unsigned __int16 *v6; // eax@4 | |
7968 unsigned int v7; // edx@5 | |
7969 unsigned int v8; // edx@6 | |
7970 unsigned int v9; // edx@7 | |
7971 unsigned int v10; // edx@8 | |
7972 unsigned int v11; // edx@9 | |
7973 unsigned int v12; // esi@12 | |
7974 unsigned int v13; // esi@15 | |
7975 unsigned int v14; // edx@17 | |
7976 unsigned int v15; // esi@18 | |
7977 unsigned __int8 *v16; // ebx@22 | |
7978 char uFlag; // zf@28 | |
7979 int v18; // [sp+10h] [bp-10h]@4 | |
7980 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
7981 int uWidth; // [sp+1Ch] [bp-4h]@4 | |
7982 int uXa; // [sp+28h] [bp+8h]@24 | |
7983 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 | |
7984 unsigned int pTexturea; // [sp+30h] [bp+10h]@11 | |
7985 | |
7986 if ( this->uNumSceneBegins ) | |
7987 { | |
7988 pCurrentTexture = pTexture; | |
7989 if ( pTexture ) | |
7990 { | |
7991 if ( pTexture->pPalette16 ) | |
7992 { | |
7993 uHeight = pTexture->uTextureHeight; | |
7994 v6 = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; | |
710 | 7995 v19 = pTexture->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7996 uWidth = pTexture->uTextureWidth; |
7997 v18 = pTexture->uTextureWidth; | |
7998 if ( this->bClip ) | |
7999 { | |
8000 v7 = this->uClipX; | |
8001 if ( (signed int)uX < (signed int)v7 ) | |
8002 { | |
8003 v8 = v7 - uX; | |
8004 v19 += v8; | |
8005 uWidth += uX - this->uClipX; | |
8006 v6 += v8; | |
8007 } | |
8008 v9 = this->uClipY; | |
8009 uHeight = pTexture->uTextureHeight; | |
8010 if ( (signed int)uY < (signed int)v9 ) | |
8011 { | |
8012 v10 = v9 - uY; | |
8013 v19 += v18 * v10; | |
8014 uHeight = uY - this->uClipY + pTexture->uTextureHeight; | |
8015 pCurrentTexture = pTexture; | |
8016 v6 += this->uTargetSurfacePitch * v10; | |
8017 } | |
8018 v11 = this->uClipX; | |
8019 if ( (signed int)v11 < (signed int)uX ) | |
8020 v11 = uX; | |
8021 pTexturea = this->uClipZ; | |
8022 if ( (signed int)(v11 + uWidth) > (signed int)pTexturea ) | |
8023 { | |
8024 v12 = this->uClipX; | |
8025 if ( (signed int)v12 < (signed int)uX ) | |
8026 v12 = uX; | |
8027 uWidth = pTexturea - v12; | |
8028 } | |
8029 v13 = this->uClipY; | |
8030 if ( (signed int)v13 < (signed int)uY ) | |
8031 v13 = uY; | |
8032 v14 = this->uClipW; | |
8033 if ( (signed int)(uHeight + v13) > (signed int)v14 ) | |
8034 { | |
8035 v15 = this->uClipY; | |
8036 if ( (signed int)v15 < (signed int)uY ) | |
8037 v15 = uY; | |
8038 uHeight = v14 - v15; | |
8039 } | |
8040 } | |
8041 if ( (signed int)uHeight > 0 ) | |
8042 { | |
8043 uYa = uHeight; | |
8044 v16 = v19; | |
8045 do | |
8046 { | |
8047 if ( uWidth > 0 ) | |
8048 { | |
8049 uXa = uWidth; | |
8050 do | |
8051 { | |
8052 if ( *v16 ) | |
8053 *v6 = pCurrentTexture->pPalette16[*v16]; | |
8054 ++v6; | |
8055 ++v16; | |
8056 } | |
8057 while ( uXa-- !=1 ); | |
8058 } | |
8059 v16 += v18 - uWidth; | |
8060 uFlag = uYa-- == 1; | |
8061 v6 += this->uTargetSurfacePitch - uWidth; | |
8062 } | |
8063 while ( !uFlag ); | |
8064 } | |
8065 } | |
8066 } | |
8067 } | |
8068 } | |
8069 | |
8070 //----- (004A612A) -------------------------------------------------------- | |
710 | 8071 void Render::DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal) |
0 | 8072 { |
8073 Texture *v5; // eax@2 | |
8074 unsigned int v6; // edx@3 | |
8075 int v7; // ebx@3 | |
8076 int v8; // edi@3 | |
8077 signed int v9; // eax@4 | |
8078 int v10; // eax@5 | |
8079 unsigned int v11; // esi@6 | |
8080 signed int v12; // esi@8 | |
8081 unsigned int v13; // eax@10 | |
8082 signed int v14; // esi@11 | |
8083 unsigned int v15; // esi@14 | |
8084 unsigned int v16; // eax@16 | |
8085 unsigned int v17; // ecx@17 | |
8086 int v18; // edx@23 | |
8087 int v19; // [sp+Ch] [bp-Ch]@3 | |
8088 int v20; // [sp+10h] [bp-8h]@3 | |
8089 int uOutXa; // [sp+20h] [bp+8h]@21 | |
8090 unsigned __int8 *uOutYa; // [sp+24h] [bp+Ch]@3 | |
8091 int *pZBuffer; // [sp+28h] [bp+10h]@3 | |
8092 | |
8093 if ( this->uNumSceneBegins ) | |
8094 { | |
8095 v5 = pTexture; | |
8096 if ( pTexture ) | |
8097 { | |
8098 v6 = uOutY; | |
8099 v7 = pTexture->uTextureHeight; | |
8100 pZBuffer = &this->pActiveZBuffer[uOutX + 640 * uOutY]; | |
710 | 8101 uOutYa = v5->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8102 v8 = v5->uTextureWidth; |
8103 v20 = v5->uTextureWidth; | |
8104 v19 = v5->uTextureWidth; | |
8105 if ( this->bClip ) | |
8106 { | |
8107 v9 = this->uClipX; | |
8108 if ( uOutX < v9 ) | |
8109 { | |
8110 v10 = v9 - uOutX; | |
8111 uOutYa += v10; | |
8112 v8 += uOutX - this->uClipX; | |
8113 v20 = v8; | |
8114 pZBuffer += v10; | |
8115 } | |
8116 v11 = this->uClipY; | |
8117 if ( (signed int)v6 < (signed int)v11 ) | |
8118 { | |
8119 uOutYa += v19 * (v11 - v6); | |
8120 v7 += v6 - v11; | |
8121 pZBuffer += 640 * (v11 - v6); | |
8122 v8 = v20; | |
8123 } | |
8124 v12 = this->uClipX; | |
8125 if ( v12 < uOutX ) | |
8126 v12 = uOutX; | |
8127 v13 = this->uClipZ; | |
8128 if ( v8 + v12 > (signed int)v13 ) | |
8129 { | |
8130 v14 = this->uClipX; | |
8131 if ( v14 < uOutX ) | |
8132 v14 = uOutX; | |
8133 v8 = v13 - v14; | |
8134 } | |
8135 v15 = this->uClipY; | |
8136 if ( (signed int)v15 < (signed int)v6 ) | |
8137 v15 = v6; | |
8138 v16 = this->uClipW; | |
8139 if ( (signed int)(v7 + v15) > (signed int)v16 ) | |
8140 { | |
8141 v17 = this->uClipY; | |
8142 if ( (signed int)v17 >= (signed int)v6 ) | |
8143 v6 = v17; | |
8144 v7 = v16 - v6; | |
8145 } | |
8146 } | |
8147 if ( v7 > 0 ) | |
8148 { | |
8149 uOutXa = v7; | |
8150 do | |
8151 { | |
8152 if ( v8 > 0 ) | |
8153 { | |
8154 v18 = v8; | |
8155 do | |
8156 { | |
8157 if ( *uOutYa ) | |
8158 *pZBuffer = zVal; | |
8159 ++pZBuffer; | |
8160 ++uOutYa; | |
8161 --v18; | |
8162 } | |
8163 while ( v18 ); | |
8164 } | |
8165 pZBuffer += 640 - v8; | |
8166 uOutYa += v19 - v8; | |
8167 --uOutXa; | |
8168 } | |
8169 while ( uOutXa ); | |
8170 } | |
8171 } | |
8172 } | |
8173 } | |
8174 | |
8175 //----- (004A601E) -------------------------------------------------------- | |
991 | 8176 void Render::ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5) |
0 | 8177 { |
8178 signed int v5; // edx@3 | |
8179 int v6; // ebx@3 | |
8180 int v7; // esi@3 | |
8181 void *v8; // esi@3 | |
8182 unsigned int v9; // eax@4 | |
8183 unsigned int v10; // eax@6 | |
8184 signed int v11; // edi@8 | |
8185 unsigned int v12; // eax@10 | |
8186 signed int v13; // edi@11 | |
8187 unsigned int v14; // edi@14 | |
8188 unsigned int v15; // eax@16 | |
8189 unsigned int v16; // ecx@17 | |
8190 int v17; // [sp+18h] [bp+Ch]@3 | |
8191 unsigned int pTexturea; // [sp+1Ch] [bp+10h]@3 | |
8192 | |
8193 if ( this->uNumSceneBegins && pTexture ) | |
8194 { | |
8195 v5 = a3; | |
8196 v6 = pTexture->uTextureHeight; | |
8197 v7 = 5 * a3; | |
8198 v17 = pTexture->uTextureHeight; | |
8199 v8 = &this->pActiveZBuffer[a2 + (v7 << 7)]; | |
8200 pTexturea = pTexture->uTextureWidth; | |
8201 if ( this->bClip ) | |
8202 { | |
8203 v9 = this->uClipX; | |
8204 if ( a2 < (signed int)v9 ) | |
8205 { | |
8206 pTexturea += a2 - v9; | |
8207 v8 = (char *)v8 + 4 * (v9 - a2); | |
8208 } | |
8209 v10 = this->uClipY; | |
8210 if ( v5 < (signed int)v10 ) | |
8211 { | |
8212 v17 += v5 - v10; | |
8213 v8 = (char *)v8 + 2560 * (v10 - v5); | |
8214 } | |
8215 v11 = this->uClipX; | |
8216 if ( v11 < a2 ) | |
8217 v11 = a2; | |
8218 v12 = this->uClipZ; | |
8219 if ( (signed int)(pTexturea + v11) > (signed int)v12 ) | |
8220 { | |
8221 v13 = this->uClipX; | |
8222 if ( v13 < a2 ) | |
8223 v13 = a2; | |
8224 pTexturea = v12 - v13; | |
8225 } | |
8226 v14 = this->uClipY; | |
8227 if ( (signed int)v14 < v5 ) | |
8228 v14 = v5; | |
8229 v6 = v17; | |
8230 v15 = this->uClipW; | |
8231 if ( (signed int)(v17 + v14) > (signed int)v15 ) | |
8232 { | |
8233 v16 = this->uClipY; | |
8234 if ( (signed int)v16 < v5 ) | |
8235 v16 = v5; | |
8236 v6 = v15 - v16; | |
8237 } | |
8238 } | |
8239 if ( v6 > 0 ) | |
8240 { | |
8241 do | |
8242 { | |
8243 if ( (signed int)pTexturea > 0 ) | |
8244 { | |
8245 memset32(v8, a5, pTexturea); | |
8246 v8 = (char *)v8 + 4 * pTexturea; | |
8247 } | |
8248 v8 = (char *)v8 + 4 * (640 - pTexturea); | |
8249 --v6; | |
8250 } | |
8251 while ( v6 ); | |
8252 } | |
8253 } | |
8254 } | |
8255 | |
8256 //----- (004A5EB2) -------------------------------------------------------- | |
8257 void Render::DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4) | |
8258 { | |
8259 Texture *v4; // edi@2 | |
8260 unsigned int v5; // ebx@4 | |
8261 unsigned __int16 *pTarget; // eax@4 | |
8262 unsigned int v7; // edx@5 | |
8263 unsigned int v8; // edx@6 | |
8264 unsigned int v9; // edx@7 | |
8265 unsigned int v10; // edx@8 | |
8266 unsigned int v11; // edx@9 | |
8267 unsigned int v12; // esi@12 | |
8268 unsigned int v13; // esi@15 | |
8269 unsigned int v14; // edx@17 | |
8270 unsigned int v15; // esi@18 | |
8271 unsigned __int8 *v16; // edx@22 | |
8272 char v17; // zf@26 | |
8273 int v18; // [sp+10h] [bp-10h]@4 | |
8274 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
8275 int v20; // [sp+1Ch] [bp-4h]@4 | |
8276 int uXa; // [sp+28h] [bp+8h]@24 | |
8277 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 | |
8278 unsigned int v23; // [sp+30h] [bp+10h]@11 | |
8279 | |
8280 if ( this->uNumSceneBegins ) | |
8281 { | |
8282 v4 = a4; | |
8283 if ( a4 ) | |
8284 { | |
8285 if ( a4->pPalette16 ) | |
8286 { | |
8287 v5 = a4->uTextureHeight; | |
8288 pTarget = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; | |
710 | 8289 v19 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8290 v20 = a4->uTextureWidth; |
8291 v18 = a4->uTextureWidth; | |
8292 if ( this->bClip ) | |
8293 { | |
8294 v7 = this->uClipX; | |
8295 if ( (signed int)uX < (signed int)v7 ) | |
8296 { | |
8297 v8 = v7 - uX; | |
8298 v19 += v8; | |
8299 v20 += uX - this->uClipX; | |
8300 pTarget += v8; | |
8301 } | |
8302 v9 = this->uClipY; | |
8303 v5 = a4->uTextureHeight; | |
8304 if ( (signed int)uY < (signed int)v9 ) | |
8305 { | |
8306 v10 = v9 - uY; | |
8307 v19 += v18 * v10; | |
8308 v5 = uY - this->uClipY + a4->uTextureHeight; | |
8309 v4 = a4; | |
8310 pTarget += this->uTargetSurfacePitch * v10; | |
8311 } | |
8312 v11 = this->uClipX; | |
8313 if ( (signed int)v11 < (signed int)uX ) | |
8314 v11 = uX; | |
8315 v23 = this->uClipZ; | |
8316 if ( (signed int)(v11 + v20) > (signed int)v23 ) | |
8317 { | |
8318 v12 = this->uClipX; | |
8319 if ( (signed int)v12 < (signed int)uX ) | |
8320 v12 = uX; | |
8321 v20 = v23 - v12; | |
8322 } | |
8323 v13 = this->uClipY; | |
8324 if ( (signed int)v13 < (signed int)uY ) | |
8325 v13 = uY; | |
8326 v14 = this->uClipW; | |
8327 if ( (signed int)(v5 + v13) > (signed int)v14 ) | |
8328 { | |
8329 v15 = this->uClipY; | |
8330 if ( (signed int)v15 < (signed int)uY ) | |
8331 v15 = uY; | |
8332 v5 = v14 - v15; | |
8333 } | |
8334 } | |
8335 if ( (signed int)v5 > 0 ) | |
8336 { | |
8337 uYa = v5; | |
8338 v16 = v19; | |
8339 do | |
8340 { | |
8341 if ( v20 > 0 ) | |
8342 { | |
8343 uXa = v20; | |
8344 do | |
8345 { | |
8346 *pTarget = v4->pPalette16[*v16]; | |
8347 ++pTarget; | |
8348 ++v16; | |
8349 --uXa; | |
8350 } | |
8351 while ( uXa ); | |
8352 } | |
8353 v16 += v18 - v20; | |
8354 v17 = uYa-- == 1; | |
8355 pTarget += this->uTargetSurfacePitch - v20; | |
8356 } | |
8357 while ( !v17 ); | |
8358 } | |
8359 } | |
8360 } | |
8361 } | |
8362 } | |
8363 | |
8364 //----- (004667E9) -------------------------------------------------------- | |
8365 void Render::ChangeBetweenWinFullscreenModes() | |
8366 { | |
8367 float v0; // ST14_4@17 | |
8368 int v4; // edx@26 | |
8369 ObjectDesc *v5; // eax@26 | |
8370 RGBTexture *v6; // esi@33 | |
8371 const char *v8; // [sp-4h] [bp-28h]@33 | |
8372 struct tagRECT Rect; // [sp+14h] [bp-10h]@15 | |
8373 | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8374 if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) ) |
0 | 8375 { |
1458 | 8376 ModalWindow(pGlobalTXT_LocalizationStrings[62], UIMSG_0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window." |
0 | 8377 return; |
8378 } | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8379 if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8380 { |
0 | 8381 if ( pEventTimer->bPaused ) |
8382 BYTE1(dword_6BE364_game_settings_1) |= 8u; | |
8383 else | |
8384 pEventTimer->Pause(); | |
8385 if ( pMiscTimer->bPaused ) | |
8386 BYTE1(dword_6BE364_game_settings_1) |= 0x10u; | |
8387 else | |
8388 pMiscTimer->Pause(); | |
8389 pMouse->bActive = 0; | |
8390 if ( pRenderer->pRenderD3D ) | |
8391 { | |
8392 pBitmaps_LOD->ReleaseHardwareTextures(); | |
8393 pSprites_LOD->ReleaseAll(); | |
8394 } | |
8395 if ( pRenderer->bWindowMode ) | |
8396 { | |
8397 if ( GetWindowRect(hWnd, &Rect) ) | |
8398 { | |
8399 WriteWindowsRegistryInt("window X", Rect.left); | |
8400 WriteWindowsRegistryInt("window Y", Rect.top); | |
8401 uWindowX = Rect.left; | |
8402 uWindowY = Rect.top; | |
8403 } | |
8404 SetMenu(hWnd, 0); | |
8405 SetWindowLongA(hWnd, -20, 0); | |
8406 SetWindowLongA(hWnd, -16, 0x10000000u); | |
8407 pRenderer->InitializeFullscreen(hWnd); | |
8408 v0 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
8409 pGame->pGammaController->Initialize(v0); | |
8410 } | |
8411 else | |
8412 { | |
8413 ClipCursor(0); | |
8414 pRenderer->SwitchToWindow(hWnd); | |
8415 SetWindowLongA(hWnd, -16, uWindowStyle); | |
8416 } | |
8417 if ( pRenderer->pRenderD3D ) | |
8418 { | |
8419 pBitmaps_LOD->_410423_move_textures_to_device(); | |
8420 pSprites_LOD->MoveSpritesToVideoMemory(); | |
8421 } | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8422 if (!( pPaletteManager->uNumTargetBBits == pRenderer->uTargetBBits |
0 | 8423 && pPaletteManager->uNumTargetGBits == pRenderer->uTargetGBits |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8424 && pPaletteManager->uNumTargetRBits == pRenderer->uTargetRBits )) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8425 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8426 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8427 pPaletteManager->RecalculateAll(); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8428 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8429 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8430 for (int i = 0; i < pObjectList->uNumObjects; i++) |
0 | 8431 { |
8432 BYTE3(v4) = 0; | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8433 v5 = &pObjectList->pObjects[i]; |
0 | 8434 *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR; |
8435 LOBYTE(v4) = v5->uParticleTrailColorG; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
8436 v5->uParticleTrailColor = v5->uParticleTrailColorB | (v4 << 8); |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8437 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8438 SetUserInterface(pParty->alignment, true); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8439 if ( pVideoPlayer->pVideoFrame.pPixels ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8440 pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1); |
0 | 8441 if ( uCurrentMenuID != 6 ) |
8442 { | |
8443 if ( uCurrentMenuID == 8 ) | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8444 dword_A74C88 = 1; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8445 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8446 else |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8447 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8448 if ( uCurrentMenuID ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8449 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8450 v6 = &pTexture_PCX; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8451 pTexture_PCX.Release(); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8452 v8 = "makeme.pcx"; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8453 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8454 else |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8455 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8456 v6 = &pTexture_PCX; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8457 pTexture_PCX.Release(); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8458 v8 = "title.pcx"; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8459 if ( uCurrentMenuID ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8460 v8 = "lsave640.pcx"; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8461 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8462 v6->Load(v8, 0); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8463 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8464 } |
0 | 8465 viewparams->bRedrawGameUI = 1; |
688 | 8466 viewparams->InitGrayPalette(); |
0 | 8467 pMouse->SetCurrentCursorBitmap(); |
8468 if ( pRenderer->bWindowMode ) | |
8469 { | |
8470 InvalidateRect(0, 0, 0); | |
8471 MoveWindow(hWnd, uWindowX, uWindowY, uWindowWidth, uWindowHeight, 0); | |
1586 | 8472 ShowWindow(hWnd, SW_SHOWNORMAL); |
0 | 8473 } |
8474 pMouse->bActive = 1; | |
8475 if ( pVideoPlayer->AnyMovieLoaded() ) | |
898 | 8476 pVideoPlayer->SelectMovieType(); |
0 | 8477 if ( BYTE1(dword_6BE364_game_settings_1) & 8 ) |
8478 BYTE1(dword_6BE364_game_settings_1) &= 0xF7u; | |
8479 else | |
8480 pEventTimer->Resume(); | |
8481 if ( BYTE1(dword_6BE364_game_settings_1) & 0x10 ) | |
8482 BYTE1(dword_6BE364_game_settings_1) &= 0xEFu; | |
8483 else | |
8484 pMiscTimer->Resume(); | |
8485 } | |
8486 } | |
8487 // 6BE364: using guessed type int dword_6BE364_game_settings_1; | |
8488 // A74C88: using guessed type int dword_A74C88; | |
8489 | |
8490 | |
8491 //----- (004524D8) -------------------------------------------------------- | |
8492 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) | |
8493 { | |
1583 | 8494 //int v11; // eax@13 |
8495 //int v12; // ecx@13 | |
0 | 8496 void *v13; // eax@13 |
1583 | 8497 //unsigned __int8 v14; // zf@13 |
8498 //unsigned __int8 v15; // sf@13 | |
0 | 8499 int v16; // esi@14 |
8500 int v17; // ecx@16 | |
8501 int v18; // esi@16 | |
8502 unsigned __int16 *v19; // eax@16 | |
8503 int v20; // edx@16 | |
8504 int v21; // ecx@16 | |
8505 int v22; // eax@16 | |
8506 int v23; // esi@16 | |
8507 unsigned __int16 *v26; // [sp+24h] [bp-10h]@13 | |
8508 int v27; // [sp+28h] [bp-Ch]@14 | |
8509 int v28; // [sp+2Ch] [bp-8h]@13 | |
8510 int pDestb; // [sp+3Ch] [bp+8h]@15 | |
8511 | |
8512 //v3 = this; | |
8513 //sprintf(Str1, "%s", pName); | |
8514 //v4 = uNumItems; | |
8515 if (!uNumItems) | |
8516 return nullptr; | |
8517 | |
8518 //{ | |
8519 //v5 = 0, pDesta = uNumItems; | |
8520 uint idx1 = 0, | |
8521 idx2 = uNumItems; | |
8522 while (true) | |
8523 { | |
8524 auto i = idx1 + (idx2 - idx1) / 2; | |
8525 | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
8526 auto res = _stricmp(pName, pSpriteNames[i]); |
0 | 8527 if (!res) |
8528 { | |
8529 fseek(pFile, pSpriteOffsets[i], SEEK_SET); | |
8530 break; | |
8531 } | |
8532 else if (res < 0) | |
8533 idx2 = idx1 + (idx2 - idx1) / 2; | |
8534 else | |
8535 idx1 = i + 1; | |
8536 | |
8537 if ( idx1 >= idx2 ) | |
8538 return false; | |
8539 } | |
8540 | |
8541 | |
8542 uint uCompressedSize = 0; | |
8543 fread(&uCompressedSize, 4, 1, pFile); | |
8544 | |
8545 auto pTex = new HWLTexture; | |
670 | 8546 fread(&pTex->uBufferWidth, 4, 1, pFile); |
8547 fread(&pTex->uBufferHeight, 4, 1, pFile); | |
8548 fread(&pTex->uAreaWidth, 4, 1, pFile); | |
8549 fread(&pTex->uAreaHeigth, 4, 1, pFile); | |
0 | 8550 fread(&pTex->uWidth, 4, 1, pFile); |
8551 fread(&pTex->uHeight, 4, 1, pFile); | |
670 | 8552 fread(&pTex->uAreaX, 4, 1, pFile); |
8553 fread(&pTex->uAreaY, 4, 1, pFile); | |
0 | 8554 |
8555 pTex->pPixels = new unsigned __int16[pTex->uWidth * pTex->uHeight]; | |
8556 if (uCompressedSize) | |
8557 { | |
8558 auto pCompressedData = new char[uCompressedSize]; | |
8559 { | |
8560 fread(pCompressedData, 1, uCompressedSize, pFile); | |
8561 auto uDecompressedSize = pTex->uWidth * pTex->uHeight * sizeof(short); | |
8562 zlib::MemUnzip(pTex->pPixels, &uDecompressedSize, pCompressedData, uCompressedSize); | |
8563 } | |
8564 delete [] pCompressedData; | |
8565 } | |
8566 else | |
8567 fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); | |
8568 | |
1583 | 8569 if ( scale_hwls_to_half ) |
8570 { | |
8571 pTex->uHeight /= 2; | |
8572 pTex->uWidth /= 2; | |
8573 v13 = new unsigned __int16[pTex->uWidth * pTex->uHeight]; | |
0 | 8574 v28 = 0; |
8575 v26 = (unsigned __int16 *)v13; | |
1583 | 8576 if ( pTex->uHeight > 0 ) |
0 | 8577 { |
8578 v16 = pTex->uWidth; | |
8579 v27 = 1; | |
8580 do | |
8581 { | |
8582 pDestb = 0; | |
8583 if ( v16 > 0 ) | |
8584 { | |
8585 do | |
8586 { | |
8587 v17 = v16 * v27; | |
8588 v18 = v28 * v16; | |
8589 v19 = pTex->pPixels; | |
8590 v20 = pDestb + 2 * v18; | |
8591 v21 = (int)&v19[2 * (pDestb + v17)]; | |
8592 v22 = (int)&v19[2 * v20]; | |
8593 LOWORD(v20) = *(unsigned short *)(v21 + 2); | |
8594 LOWORD(v21) = *(unsigned short *)v21; | |
8595 v23 = pDestb++ + v18; | |
1583 | 8596 extern unsigned int __fastcall _452442_color_cvt(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4); |
8597 v26[v23] = _452442_color_cvt(*(unsigned short *)v22, *(unsigned short *)(v22 + 2), v21, v20); | |
0 | 8598 v16 = pTex->uWidth; |
8599 } | |
8600 while (pDestb < pTex->uWidth); | |
8601 } | |
8602 ++v28; | |
8603 v27 += 2; | |
8604 } | |
8605 while ( v28 < (signed int)pTex->uHeight ); | |
8606 } | |
8607 delete [] pTex->pPixels; | |
8608 pTex->pPixels = v26; | |
8609 } | |
8610 return pTex; | |
8611 } | |
8612 | |
8613 //----- (0045271F) -------------------------------------------------------- | |
8614 bool RenderHWLContainer::Release() | |
8615 { | |
8616 __int32 v4; // eax@6 | |
8617 FILE *v5; // ST24_4@6 | |
8618 FILE *File; // [sp+4h] [bp-4h]@6 | |
8619 | |
1162 | 8620 if ( this->bDumpDebug) |
0 | 8621 { |
8622 File = fopen("logd3d.txt", "w"); | |
1162 | 8623 v4 = ftell(this->pFile); |
8624 v5 = this->pFile; | |
8625 this->uDataOffset = v4; | |
8626 fwrite(&this->uNumItems, 4u, 1u, v5); | |
8627 for (int i = 0; i < this->uNumItems; i++) | |
8628 { | |
8629 fwrite(this->pSpriteNames[i], 1u, 0x14u, this->pFile); | |
8630 fprintf(File, "D3D texture name: %s\t\toffset: %x\n", this->pSpriteNames[i], *(unsigned int *)(&(this->pSpriteNames[i]) + 200000/sizeof(char*))); | |
8631 } | |
8632 fwrite(this->pSpriteOffsets, 4u, this->uNumItems, this->pFile); | |
8633 fseek(this->pFile, 4, 0); | |
8634 fwrite(&this->uDataOffset, 4u, 1u, this->pFile); | |
8635 fclose(this->pFile); | |
0 | 8636 fclose(File); |
8637 } | |
8638 else | |
8639 { | |
8640 fclose(this->pFile); | |
1162 | 8641 for (int i = 0; i < this->uNumItems; i++) |
8642 { | |
8643 free(this->pSpriteNames[i]); | |
0 | 8644 } |
8645 } | |
1093 | 8646 return true; |
0 | 8647 } |
8648 | |
8649 //----- (00452347) -------------------------------------------------------- | |
8650 RenderHWLContainer::RenderHWLContainer(): | |
8651 bDumpDebug(false) | |
8652 { | |
8653 this->pFile = 0; | |
8654 uSignature = 0; | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8655 this->uDataOffset = 0; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8656 memset(&this->uNumItems, 0, 0x61A84u); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8657 this->uNumItems = 0; |
1583 | 8658 this->scale_hwls_to_half = false; |
0 | 8659 } |
8660 | |
8661 //----- (0045237F) -------------------------------------------------------- | |
8662 bool RenderHWLContainer::Load(const wchar_t *pFilename) | |
8663 { | |
8664 pFile = _wfopen(pFilename, L"rb"); | |
8665 if (!pFile) | |
8666 { | |
8667 Log::Warning(L"Failed to open file: %s", pFilename); | |
8668 return false; | |
8669 } | |
8670 | |
8671 fread(&uSignature, 1, 4, pFile); | |
8672 if (uSignature != 'TD3D') | |
8673 { | |
8674 Log::Warning(L"Invalid format: %s", pFilename); | |
8675 return false; | |
8676 } | |
8677 | |
8678 fread(&uDataOffset, 4, 1, pFile); | |
8679 fseek(pFile, uDataOffset, SEEK_SET); | |
8680 fread(&uNumItems, 4, 1, pFile); | |
8681 | |
8682 memset(pSpriteNames, 0, 50000 * sizeof(char *)); | |
8683 for (uint i = 0; i < uNumItems; ++i) | |
8684 { | |
8685 pSpriteNames[i] = new char[20]; | |
8686 fread(pSpriteNames[i], 1, 20, pFile); | |
8687 } | |
8688 fread(pSpriteOffsets, 4, uNumItems, pFile); | |
8689 | |
8690 return true; | |
8691 } | |
8692 | |
8693 //----- (004A1C1E) -------------------------------------------------------- | |
8694 void DoRenderBillboards_D3D() | |
8695 { | |
186 | 8696 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); |
8697 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
8698 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8699 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8700 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8701 /*if (pRenderer->uNumBillboardsToDraw) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8702 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8703 auto p = &pRenderer->pBillboardRenderListD3D[0]; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8704 for (int i = 0; i < p->uNumVertices; ++i) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8705 { |
1390 | 8706 p->pQuads[i].pos.z -= p->pQuads[i].pos.z * 0.6; |
8707 //p->pQuads[i].rhw = + 0.8 * (1.0f - p->pQuads[i].rhw); | |
8708 } | |
8709 p->pQuads[0].pos.x = 10; | |
8710 p->pQuads[0].pos.y = 10; | |
8711 | |
8712 p->pQuads[1].pos.x = 10; | |
8713 p->pQuads[1].pos.y = 200; | |
8714 | |
8715 p->pQuads[2].pos.x = 100; | |
8716 p->pQuads[2].pos.y = 200; | |
8717 | |
8718 p->pQuads[3].pos.x = 100; | |
8719 p->pQuads[3].pos.y = 10; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8720 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8721 if (p->uOpacity != RenderBillboardD3D::NoBlend) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8722 SetBillboardBlendOptions(p->uOpacity); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8723 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8724 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8725 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8726 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1390 | 8727 p->pQuads, p->uNumVertices, |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8728 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8729 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8730 }*/ |
0 | 8731 |
8732 for (uint i = pRenderer->uNumBillboardsToDraw - 1; i != (uint)-1; --i) | |
8733 { | |
101 | 8734 auto p = &pRenderer->pBillboardRenderListD3D[i]; |
0 | 8735 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8736 if (p->uOpacity != RenderBillboardD3D::NoBlend) |
0 | 8737 SetBillboardBlendOptions(p->uOpacity); |
8738 | |
101 | 8739 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8740 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8741 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1390 | 8742 p->pQuads, p->uNumVertices, |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8743 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); |
0 | 8744 } |
8745 | |
8746 if (pRenderer->bFogEnabled) | |
8747 { | |
8748 pRenderer->bFogEnabled = false; | |
186 | 8749 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 8750 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); |
8751 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
8752 } | |
186 | 8753 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
8754 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
8755 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
8756 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
8757 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
8758 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
0 | 8759 } |
8760 | |
8761 //----- (004A1DA8) -------------------------------------------------------- | |
8762 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1) | |
8763 { | |
8764 switch (a1) | |
8765 { | |
8766 case RenderBillboardD3D::Transparent: | |
8767 { | |
8768 if (pRenderer->bFogEnabled) | |
8769 { | |
8770 pRenderer->bFogEnabled = false; | |
186 | 8771 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 8772 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); |
8773 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
8774 } | |
8775 | |
186 | 8776 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); |
8777 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); | |
8778 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
0 | 8779 } |
8780 break; | |
8781 | |
8782 case RenderBillboardD3D::Opaque_1: | |
8783 case RenderBillboardD3D::Opaque_2: | |
8784 case RenderBillboardD3D::Opaque_3: | |
8785 { | |
8786 if (pRenderer->bUsingSpecular) | |
8787 { | |
8788 if (!pRenderer->bFogEnabled) | |
8789 { | |
8790 pRenderer->bFogEnabled = true; | |
186 | 8791 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
8792 } | |
8793 } | |
8794 | |
8795 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
8796 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | |
8797 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | |
0 | 8798 } |
8799 break; | |
8800 | |
8801 default: | |
8802 Log::Warning(L"SetBillboardBlendOptions: invalid opacity type (%u)", a1); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8803 assert(false); |
0 | 8804 break; |
8805 } | |
8806 } | |
1297 | 8807 //----- (0040DF3D) -------------------------------------------------------- |
1458 | 8808 void CallRenderPresent() |
1297 | 8809 { |
8810 pRenderer->Present(); | |
8811 } |