Mercurial > mm7
annotate Render.cpp @ 1545:c4ab816fcc5e
assert, Abortf, AbortWithError -> Assert, Error
refactors here and there
author | Nomad |
---|---|
date | Sat, 07 Sep 2013 20:05:20 +0200 |
parents | 499761153844 |
children | 2d9c8f609a3c |
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 "OutdoorCamera.h" | |
16 #include "IndoorCamera.h" | |
17 #include "Outdoor.h" | |
18 #include "Party.h" | |
19 #include "LOD.h" | |
20 #include "Viewport.h" | |
21 #include "Math.h" | |
22 #include "PaletteManager.h" | |
23 #include "Time.h" | |
24 #include "Game.h" | |
25 #include "LightmapBuilder.h" | |
26 #include "ObjectList.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
27 #include "SpriteObject.h" |
0 | 28 #include "DecorationList.h" |
29 #include "Allocator.h" | |
30 #include "OSInfo.h" | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
31 #include "Actor.h" |
0 | 32 #include "Log.h" |
179 | 33 #include "TileFrameTable.h" |
189 | 34 #include "texts.h" |
0 | 35 #include "mm7_data.h" |
860 | 36 #include "MM7.h" |
1262 | 37 #include "Lights.h" |
0 | 38 |
39 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") | |
40 #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib") | |
41 | |
42 struct IDirectDrawClipper *pDDrawClipper; | |
43 struct Render *pRenderer; // idb | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
44 struct RenderVertexD3D3 pVertices[50]; |
0 | 45 int uNumDecorationsDrawnThisFrame; // weak |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
46 RenderBillboard pBillboardRenderList[500]; |
0 | 47 unsigned int uNumBillboardsToDraw; |
48 int uNumSpritesDrawnThisFrame; // weak | |
49 | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
50 RenderVertexSoft array_507D30[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
51 RenderVertexSoft array_50AC10[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
52 RenderVertexSoft array_73D150[20]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
53 |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
54 RenderVertexD3D3 d3d_vertex_buffer[50]; |
0 | 55 |
56 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); | |
57 | |
58 /* 384 */ | |
59 #pragma pack(push, 1) | |
60 struct PCXHeader_1 | |
61 { | |
62 char manufacturer; | |
63 char version; | |
64 char encoding; | |
65 char bpp; | |
66 __int16 left; | |
67 __int16 up; | |
68 __int16 right; | |
69 __int16 bottom; | |
70 __int16 hdpi; | |
71 __int16 vdpi; | |
72 }; | |
73 #pragma pack(pop) | |
74 | |
75 /* 385 */ | |
76 #pragma pack(push, 1) | |
77 struct PCXHeader_2 | |
78 { | |
79 char reserved; | |
80 char planes; | |
81 __int16 pitch; | |
82 __int16 palette_info; | |
83 }; | |
84 #pragma pack(pop) | |
85 | |
86 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst); | |
87 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2); | |
88 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, struct RenderD3D_aux *a6); | |
89 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut); // idb | |
90 | |
91 //----- (0049E79F) -------------------------------------------------------- | |
1458 | 92 bool CheckTextureStages() |
0 | 93 { |
94 bool v0; // edi@1 | |
95 IDirectDrawSurface4 *pSurface2; // [sp+Ch] [bp-14h]@1 | |
96 IDirectDrawSurface4 *pSurface1; // [sp+10h] [bp-10h]@1 | |
97 DWORD v4; // [sp+14h] [bp-Ch]@1 | |
98 IDirect3DTexture2 *pTexture2; // [sp+18h] [bp-8h]@1 | |
99 IDirect3DTexture2 *pTexture1; // [sp+1Ch] [bp-4h]@1 | |
100 | |
101 v0 = false; | |
102 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface1, &pTexture1, true, false, 32u); | |
103 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface2, &pTexture2, true, false, 32u); | |
104 | |
105 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture1)); | |
186 | 106 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 107 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 2u)); |
108 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | |
109 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | |
110 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | |
111 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 1u)); | |
112 | |
113 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture2)); | |
186 | 114 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); |
0 | 115 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1u)); |
116 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 7u)); | |
117 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, 2u)); | |
118 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG2, 1u)); | |
119 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MAGFILTER, 2u)); | |
120 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MINFILTER, 2u)); | |
121 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MIPFILTER, 1u)); | |
122 | |
123 if ( !pRenderer->pRenderD3D->pDevice->ValidateDevice(&v4) && v4 == 1 ) | |
124 v0 = true; | |
125 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 1u)); | |
126 pTexture1->Release(); | |
127 pTexture2->Release(); | |
128 pSurface1->Release(); | |
129 pSurface2->Release(); | |
130 return v0; | |
131 } | |
132 | |
133 //----- (00440CB8) -------------------------------------------------------- | |
134 void Render::DrawBillboardList_BLV() | |
135 { | |
136 __int16 v2; // ax@3 | |
137 int v5; // eax@11 | |
138 RenderBillboardTransform_local0 soft_billboard; // [sp+4h] [bp-50h]@1 | |
139 | |
140 soft_billboard.uParentBillboardID = -1; | |
141 soft_billboard.pTarget = pBLVRenderParams->pRenderTarget; | |
142 soft_billboard.pTargetZ = pBLVRenderParams->pTargetZBuffer; | |
143 soft_billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
144 soft_billboard.uViewportX = pBLVRenderParams->uViewportX; | |
145 soft_billboard.uViewportY = pBLVRenderParams->uViewportY; | |
146 soft_billboard.uViewportZ = pBLVRenderParams->uViewportZ - 1; | |
147 soft_billboard.uViewportW = pBLVRenderParams->uViewportW; | |
148 | |
617 | 149 pOutdoorCamera->uNumBillboards = ::uNumBillboardsToDraw; |
150 for (uint i = 0; i < ::uNumBillboardsToDraw; ++i) | |
0 | 151 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
152 auto p = pBillboardRenderList + i; |
0 | 153 |
154 soft_billboard.uScreenSpaceX = p->uScreenSpaceX; | |
155 soft_billboard.uParentBillboardID = i; | |
156 soft_billboard.uScreenSpaceY = p->uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
157 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
|
158 soft_billboard._screenspace_y_scaler_packedfloat = p->_screenspace_y_scaler_packedfloat; |
0 | 159 soft_billboard.sZValue = p->sZValue; |
160 soft_billboard.uFlags = p->field_1E; | |
161 soft_billboard.uTintColor = p->uTintColor; | |
162 v2 = p->uHwSpriteID; | |
163 if ( v2 != -1 ) | |
164 { | |
165 if ( pRenderer->pRenderD3D ) | |
657 | 166 pRenderer->DrawBillboard_Indoor(&soft_billboard, &pSprites_LOD->pHardwareSprites[v2], p->dimming_level); |
0 | 167 else |
168 { | |
657 | 169 soft_billboard.pPalette = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, p->dimming_level, 1); |
0 | 170 if (p->field_1E & 0x0100) |
171 soft_billboard.pPalette = pPaletteManager->field_261600[p->uPalette]; | |
172 if ( !(soft_billboard.uFlags & 0x40) && soft_billboard.uFlags & 0x80 ) | |
173 soft_billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, 0, 1); | |
174 v5 = p->uHwSpriteID; | |
175 if ( v5 >= 0 ) | |
733 | 176 pSprites_LOD->pSpriteHeaders[v5].DrawSprite_sw(&soft_billboard, 1); |
0 | 177 } |
178 } | |
179 } | |
180 } | |
181 | |
182 //----- (004A16A5) -------------------------------------------------------- | |
1458 | 183 bool AreRenderSurfacesOk() |
0 | 184 { |
185 char v0; // zf@4 | |
186 bool result; // eax@8 | |
187 | |
188 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
189 { | |
190 if ( !pRenderer->pBackBuffer4 ) | |
191 goto LABEL_9; | |
192 v0 = pRenderer->pFrontBuffer4 == 0; | |
193 } | |
194 else | |
195 { | |
196 if ( !pRenderer->pBackBuffer2 ) | |
197 goto LABEL_9; | |
198 v0 = pRenderer->pFrontBuffer2 == 0; | |
199 } | |
200 if ( !v0 ) | |
201 { | |
202 LOBYTE(result) = 1; | |
203 return result; | |
204 } | |
205 LABEL_9: | |
206 LOBYTE(result) = 0; | |
207 return result; | |
208 } | |
209 | |
1338 | 210 void Render::RenderTerrainD3D() // New function |
86 | 211 { |
212 int v6; // ecx@8 | |
1427 | 213 struct Polygon *pTilePolygon; // ebx@8 |
186 | 214 |
215 //warning: the game uses CW culling by default, ccw is incosistent | |
216 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); | |
217 | |
1338 | 218 static RenderVertexSoft pTerrainVertices[128 * 128];//vertexCountX and vertexCountZ |
219 | |
220 //Ãåíåðàöèÿ ìåñòîïîëîæåíèÿ âåðøèí------------------------------------------------------------------------- | |
221 //ðåø¸òêà âåðøèí äåëèòñÿ íà äâå ÷àñòè îò -64 äî 0 è îò 0 äî 64 | |
222 // | |
223 // -64 X 0 64 | |
224 // --------------- 64 | |
225 // | | | | |
226 // | | | | |
227 // | | | | |
228 // 0|------+------| Z | |
229 // | | | | |
230 // | | | | |
231 // | | | | |
232 // --------------- | |
233 // -64 | |
234 | |
235 int blockScale = 512; | |
236 int heightScale = 32; | |
237 for (unsigned int z = 0; z < 128; ++z) | |
238 { | |
239 for (unsigned int x = 0; x < 128; ++x) | |
240 { | |
241 pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * blockScale; | |
242 pTerrainVertices[z * 128 + x].vWorldPosition.y = (64 - (signed)z) * blockScale; | |
243 pTerrainVertices[z * 128 + x].vWorldPosition.z = heightScale * pOutdoor->pTerrain.pHeightmap[z * 128 + x]; | |
121 | 244 pGame->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); |
245 pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); | |
106 | 246 } |
247 } | |
1338 | 248 //-------------------------------------------------------------------------------------------------------------------- |
249 | |
250 // | |
1344 | 251 for (unsigned int z = 0; z < 127; ++z) |
252 { | |
253 for (unsigned int x = 0; x < 127; ++x) | |
1338 | 254 { |
1427 | 255 pTilePolygon = &array_77EC08[pOutdoorCamera->uNumPolygons]; |
256 pTilePolygon->flags = 0; | |
257 pTilePolygon->field_32 = 0; | |
258 pTilePolygon->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); | |
259 pTilePolygon->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[pTilePolygon->uTileBitmapID]; | |
260 if (pTilePolygon->uTileBitmapID == 0xFFFF) | |
106 | 261 continue; |
186 | 262 |
1338 | 263 //pTile->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(x, z); |
1427 | 264 pTilePolygon->flags = pOutdoor->GetSomeOtherTileInfo(x, z); |
265 pTilePolygon->field_32 = 0; | |
266 pTilePolygon->field_59 = 1; | |
267 pTilePolygon->sTextureDeltaU = 0; | |
268 pTilePolygon->sTextureDeltaV = 0; | |
1338 | 269 // x,z x+1,z |
270 // .____________. | |
271 // | | | |
272 // | | | |
273 // | | | |
274 // | | | |
275 // | | | |
276 // .____________. | |
277 // x,z+1 x+1,z+1 | |
278 memcpy(&array_73D150[0], &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft));//x, z | |
106 | 279 array_73D150[0].u = 0; |
280 array_73D150[0].v = 0; | |
1338 | 281 memcpy(&array_73D150[1], &pTerrainVertices[z * 128 + x + 1], sizeof(RenderVertexSoft));//x + 1, z |
106 | 282 array_73D150[1].u = 1; |
283 array_73D150[1].v = 0; | |
1338 | 284 memcpy(&array_73D150[2], &pTerrainVertices[(z + 1) * 128 + x + 1], sizeof(RenderVertexSoft));//x + 1, z + 1 |
106 | 285 array_73D150[2].u = 1; |
286 array_73D150[2].v = 1; | |
1338 | 287 memcpy(&array_73D150[3], &pTerrainVertices[(z + 1) * 128 + x], sizeof(RenderVertexSoft));//x, z + 1 |
106 | 288 array_73D150[3].u = 0; |
289 array_73D150[3].v = 1; | |
1338 | 290 //v58 = 0; |
291 //if (v58 == 4) // if all y == first y; primitive in xz plane | |
292 //pTile->field_32 |= 0x0001; | |
1427 | 293 pTilePolygon->pODMFace = nullptr; |
294 pTilePolygon->uNumVertices = 4; | |
295 pTilePolygon->field_59 = 5; | |
1338 | 296 |
297 //shading (çàòåíåíèå)---------------------------------------------------------------------------- | |
298 //uint norm_idx = pTerrainNormalIndices[2 * (z * 128 + x) + 1]; | |
1424 | 299 uint norm_idx = pTerrainNormalIndices[2 * (x * 128 + z) + 2]; |
638 | 300 assert(norm_idx < uNumTerrainNormals); |
301 | |
302 auto norm = pTerrainNormals + norm_idx; | |
1338 | 303 float _f = ((norm->x * (float)pOutdoor->vSunlight.x / 65536.0) - |
304 (norm->y * (float)pOutdoor->vSunlight.y / 65536.0) - | |
305 (norm->z * (float)pOutdoor->vSunlight.z / 65536.0)); | |
1427 | 306 pTilePolygon->dimming_level = 20.0 - floorf(20.0 * _f + 0.5f); |
1338 | 307 //----------------------------------------------------------------------------------------------- |
638 | 308 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
309 ++pOutdoorCamera->uNumPolygons; |
86 | 310 ++pOutdoorCamera->field_44; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
311 assert(pOutdoorCamera->uNumPolygons < 20000); |
265 | 312 |
1427 | 313 pTilePolygon->uBModelID = 0; |
314 pTilePolygon->uBModelFaceID = 0; | |
315 pTilePolygon->field_50 = (8 * (0 | (0 << 6))) | 6; | |
316 for (unsigned int k = 0; k < pTilePolygon->uNumVertices; ++k) | |
106 | 317 { |
318 memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); | |
168 | 319 array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); |
106 | 320 } |
140 | 321 |
1338 | 322 // check the transparency and texture (tiles) mapping (ïðîâåðêà ïðîçðà÷íîñòè è íàëîæåíèå òåêñòóð (òàéëîâ))---------------------- |
186 | 323 bool transparent = false; |
1427 | 324 if ( !( pTilePolygon->flags & 1 ) ) // íå ïîääåðæèâàåòñÿ TextureFrameTable |
325 { | |
326 if ( /*pTile->flags & 2 && */pTilePolygon->uTileBitmapID == pRenderer->hd_water_tile_id) | |
1338 | 327 { |
328 //transparent = false; | |
329 v6 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; | |
330 } | |
331 else | |
332 { | |
1427 | 333 v6 = pTilePolygon->uTileBitmapID; |
334 if ( !_strnicmp(pBitmaps_LOD->pTextures[pTilePolygon->uTileBitmapID].pName, "wtrdr", 5) ) | |
1338 | 335 transparent = true; |
336 } | |
179 | 337 |
140 | 338 assert(v6 < 1000); // many random crashes here |
186 | 339 |
340 // for all shore tiles - draw a tile water under them since they're half-empty | |
1427 | 341 if (!_strnicmp(pBitmaps_LOD->pTextures[pTilePolygon->uTileBitmapID].pName, "wtrdr", 5)) // all shore tile filenames are wtrdrXXX |
342 pTilePolygon->DrawBorderTiles(); | |
343 | |
344 pRenderer->DrawTerrainPolygon(pTilePolygon->uNumVertices, pTilePolygon, pBitmaps_LOD->pHardwareTextures[v6], transparent, true); | |
1338 | 345 } |
346 //else //çäåñü óæå ïîãðàíè÷íûå òàéëû âîäû | |
347 //pTile->DrawBorderTiles(); | |
348 //-------------------------------------------------------------------------------------------------------------------------------- | |
186 | 349 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
350 --pOutdoorCamera->uNumPolygons; |
86 | 351 --pOutdoorCamera->field_44; |
106 | 352 } |
353 } | |
354 } | |
0 | 355 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
356 |
0 | 357 |
358 //----- (0047BACF) -------------------------------------------------------- | |
359 void Render::TransformBillboardsAndSetPalettesODM() | |
360 { | |
142 | 361 //int v0; // edi@1 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
362 //char *v1; // esi@2 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
363 //unsigned int v2; // edx@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
364 //int v3; // eax@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
365 //int v4; // edi@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
366 //int v5; // eax@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
367 //__int16 v6; // di@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
368 //int v7; // eax@3 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
369 //int v8; // ebx@4 |
0 | 370 unsigned __int16 *v9; // eax@7 |
371 char v10; // zf@9 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
372 //DWORD v11; // eax@13 |
0 | 373 int v12; // eax@13 |
374 int v13; // eax@14 | |
375 RenderBillboardTransform_local0 billboard; // [sp+4h] [bp-60h]@1 | |
376 int v15; // [sp+54h] [bp-10h]@13 | |
142 | 377 //int v16; // [sp+58h] [bp-Ch]@1 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
378 //int v17; // [sp+5Ch] [bp-8h]@2 |
0 | 379 int v18; // [sp+60h] [bp-4h]@13 |
380 | |
381 billboard.uParentBillboardID = -1; | |
382 billboard.pTarget = pRenderer->pTargetSurface; | |
383 billboard.pTargetZ = pRenderer->pActiveZBuffer; | |
384 billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
693 | 385 billboard.uViewportX = pViewport->uViewportTL_X; |
386 billboard.uViewportY = pViewport->uViewportTL_Y; | |
387 billboard.uViewportZ = pViewport->uViewportBR_X - 1; | |
388 billboard.uViewportW = pViewport->uViewportBR_Y; | |
0 | 389 pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw; |
142 | 390 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
391 for (int i = 0; i < ::uNumBillboardsToDraw; ++i) |
0 | 392 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
393 auto pBillboard = pBillboardRenderList + i; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
394 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
395 billboard.uScreenSpaceX = pBillboard->uScreenSpaceX; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
396 billboard.uScreenSpaceY = pBillboard->uScreenSpaceY; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
397 billboard.uParentBillboardID = i; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
398 billboard._screenspace_x_scaler_packedfloat = pBillboard->_screenspace_x_scaler_packedfloat; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
399 billboard.uTintColor = pBillboard->uTintColor; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
400 billboard._screenspace_y_scaler_packedfloat = pBillboard->_screenspace_y_scaler_packedfloat; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
401 billboard.sZValue = pBillboard->sZValue; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
402 billboard.uFlags = pBillboard->field_1E; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
403 if (pBillboard->uHwSpriteID != -1) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
404 { |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
405 if (!pRenderer->pRenderD3D) __debugbreak(); // no sw rendering |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
406 //if (pRenderer->pRenderD3D) |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
407 pRenderer->TransformBillboard(&billboard, |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
408 &pSprites_LOD->pHardwareSprites[pBillboard->uHwSpriteID], |
657 | 409 pBillboard->dimming_level, pBillboard); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
410 /*else |
144
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 assert(false); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
413 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
414 auto v1 = (char *)&pBillboard->uScreenSpaceY; |
0 | 415 if ( *(v1 - 10) & 2 ) |
416 v9 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 0, 1); | |
417 else | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
418 v9 = sr_GetBillboardPalette((RenderBillboard *)(v1 - 40), *((short *)v1 - 7), pBillboard->sZValue, *((short *)v1 + 1)); |
0 | 419 v10 = (*(v1 - 9) & 1) == 0; |
420 billboard.pPalette = v9; | |
421 if ( !v10 ) | |
422 billboard.pPalette = pPaletteManager->field_261600[*((short *)v1 - 7)]; | |
423 if ( !(billboard.uFlags & 0x40) && billboard.uFlags & 0x80 ) | |
424 { | |
323 | 425 v12 = stru_5C6E00->Cos(i * 5 + GetTickCount()); |
0 | 426 v15 = abs(v12); |
427 v18 = (unsigned __int64)(15i64 * v15) >> 16; | |
428 billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 15 - v18, 1); | |
429 } | |
430 v13 = *((short *)v1 - 8); | |
431 if ( v13 >= 0 ) | |
733 | 432 pSprites_LOD->pSpriteHeaders[v13].DrawSprite_sw(&billboard, 1); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
433 }*/ |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
434 } |
0 | 435 } |
436 } | |
437 | |
438 //----- (0047AF11) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
439 void Render::DrawSpriteObjects_ODM() |
0 | 440 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
441 //char *v0; // edi@2 |
430 | 442 //ObjectDesc *v1; // ebx@4 |
0 | 443 __int16 v2; // cx@5 |
444 RenderBillboard *v3; // esi@10 | |
445 SpriteFrame *v4; // eax@10 | |
430 | 446 //SpriteFrame *v5; // ebx@10 |
0 | 447 unsigned int v6; // eax@10 |
430 | 448 //int v7; // ecx@10 |
449 //int v8; // edx@10 | |
0 | 450 int v9; // ecx@10 |
451 unsigned __int16 v10; // ax@10 | |
430 | 452 //int *v11; // eax@14 |
0 | 453 int v12; // eax@22 |
454 int v13; // ST3C_4@23 | |
455 int v14; // eax@23 | |
456 int v15; // ecx@23 | |
457 int v16; // ebx@23 | |
458 int v17; // ecx@25 | |
459 int v18; // eax@25 | |
460 int v19; // ST40_4@26 | |
461 int v20; // ecx@26 | |
462 int v21; // ST44_4@28 | |
463 int v22; // ST3C_4@29 | |
464 signed __int64 v23; // qtt@30 | |
465 int v24; // ebx@30 | |
466 int v25; // ST3C_4@30 | |
467 int v26; // eax@31 | |
468 char v27; // zf@31 | |
430 | 469 //SpriteFrame *v28; // [sp+Ch] [bp-34h]@10 |
470 //__int16 a5; // [sp+10h] [bp-30h]@10 | |
0 | 471 int v30; // [sp+14h] [bp-2Ch]@23 |
472 int v31; // [sp+14h] [bp-2Ch]@29 | |
473 __int16 v32; // [sp+14h] [bp-2Ch]@30 | |
474 int v33; // [sp+18h] [bp-28h]@23 | |
475 int v34; // [sp+18h] [bp-28h]@26 | |
476 int v35; // [sp+18h] [bp-28h]@30 | |
477 int v36; // [sp+1Ch] [bp-24h]@10 | |
478 int v37; // [sp+1Ch] [bp-24h]@23 | |
479 int a6; // [sp+20h] [bp-20h]@10 | |
480 int a6a; // [sp+20h] [bp-20h]@23 | |
481 int v40; // [sp+24h] [bp-1Ch]@25 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
482 //signed int v41; // [sp+28h] [bp-18h]@1 |
0 | 483 int v42; // [sp+2Ch] [bp-14h]@23 |
484 int y; // [sp+30h] [bp-10h]@10 | |
485 int x; // [sp+34h] [bp-Ch]@10 | |
486 int z; // [sp+38h] [bp-8h]@10 | |
487 signed __int16 v46; // [sp+3Ch] [bp-4h]@12 | |
488 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
489 //v41 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
490 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
|
491 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
492 auto object = &pSpriteObjects[i]; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
493 //auto v0 = (char *)&pSpriteObjects[i].uSectorID; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
494 //v0 = (char *)&pSpriteObjects[0].uSectorID; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
495 //do |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
496 //{ |
430 | 497 if (!object->uObjectDescID) // item probably pciked up |
498 continue; | |
499 | |
500 assert(object->uObjectDescID < pObjectList->uNumObjects); | |
501 auto object_desc = pObjectList->pObjects + object->uObjectDescID; | |
502 if (object_desc->NoSprite()) | |
503 continue; | |
504 | |
505 //v1 = &pObjectList->pObjects[*((short *)v0 - 13)]; | |
506 //if ( !(v1->uFlags & 1) ) | |
507 //{ | |
508 //v2 = *((short *)v0 - 14) | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
509 v2 = object->uType; |
430 | 510 if ( (v2 < 1000 || v2 >= 10000) && (v2 < 500 || v2 >= 600) || pGame->pStru6Instance->_4A81CA(object) ) |
511 { | |
512 //a5 = *(short *)v0; | |
513 x = object->vPosition.x; | |
514 y = object->vPosition.y; | |
515 z = object->vPosition.z; | |
516 v3 = &pBillboardRenderList[::uNumBillboardsToDraw]; | |
517 v4 = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); | |
518 //v5 = v4; | |
519 //v28 = v4; | |
520 v36 = v4->uFlags; | |
521 a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier; | |
522 v6 = stru_5C6E00->Atan2(object->vPosition.x - pIndoorCamera->pos.x, object->vPosition.y - pIndoorCamera->pos.y); | |
523 //LOWORD(v7) = object->uFacing; | |
524 //v8 = v36; | |
525 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; | |
526 v10 = v4->pHwSpriteIDs[v9]; | |
0 | 527 v3->uHwSpriteID = v10; |
528 if ( v36 & 0x20 ) | |
529 { | |
430 | 530 //v8 = v36; |
531 z -= (signed int)((unsigned __int64)(v4->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; | |
0 | 532 } |
533 v46 = 0; | |
430 | 534 if ( v36 & 2 ) |
0 | 535 v46 = 2; |
430 | 536 //v11 = (int *)(256 << v9); |
537 if ( (256 << v9) & v36 ) | |
0 | 538 v46 |= 4u; |
430 | 539 if ( v36 & 0x40000 ) |
0 | 540 v46 |= 0x40u; |
430 | 541 if ( v36 & 0x20000 ) |
0 | 542 LOBYTE(v46) = v46 | 0x80; |
543 if ( a6 ) | |
544 { | |
430 | 545 //LOBYTE(v11) = byte_4E94D3; |
546 pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); | |
0 | 547 } |
548 v12 = (x - pIndoorCamera->pos.x) << 16; | |
549 if ( pIndoorCamera->sRotationX ) | |
550 { | |
551 v13 = (y - pIndoorCamera->pos.y) << 16; | |
552 v30 = ((unsigned __int64)(v12 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) | |
553 + ((unsigned __int64)(v13 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); | |
554 v37 = (unsigned __int64)(v12 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
555 a6a = (unsigned __int64)(v13 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
556 v33 = (z - pIndoorCamera->pos.z) << 16; | |
557 v14 = (unsigned __int64)(v30 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; | |
558 v15 = (unsigned __int64)(v33 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; | |
559 v16 = v15 + v14; | |
560 v42 = v15 + v14; | |
561 if ( v15 + v14 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 ) | |
562 { | |
563 v17 = a6a - v37; | |
564 v40 = a6a - v37; | |
565 v18 = ((unsigned __int64)(v33 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) | |
566 - ((unsigned __int64)(v30 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); | |
567 goto LABEL_29; | |
568 } | |
569 } | |
570 else | |
571 { | |
572 v34 = (y - pIndoorCamera->pos.y) << 16; | |
573 v19 = (unsigned __int64)(v12 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
574 v20 = (unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
575 v16 = v20 + v19; | |
576 v42 = v20 + v19; | |
577 if ( v20 + v19 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 ) | |
578 { | |
430 | 579 v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; |
580 v17 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; | |
581 v40 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; | |
0 | 582 v18 = (z - pIndoorCamera->pos.z) << 16; |
583 LABEL_29: | |
584 v31 = v18; | |
585 v22 = abs(v17); | |
586 if ( abs(v16) >= v22 ) | |
587 { | |
588 LODWORD(v23) = 0; | |
589 HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
590 v24 = v23 / v42; | |
591 v25 = v23 / v42; | |
592 LODWORD(v23) = 0; | |
593 HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
430 | 594 v35 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16); |
595 v32 = LOWORD(pViewport->uScreenCenterY) - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16); | |
596 | |
597 //if (::uNumBillboardsToDraw >= 500) | |
598 // return; | |
599 assert(::uNumBillboardsToDraw < 500); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
600 ++::uNumBillboardsToDraw; |
0 | 601 ++uNumSpritesDrawnThisFrame; |
430 | 602 |
603 object->uAttributes |= 1; | |
604 v3->uPalette = v4->uPaletteIndex; | |
605 v3->uIndoorSectorID = object->uSectorID; | |
606 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; | |
607 v26 = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; | |
608 v3->pSpriteFrame = v4; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
609 v3->_screenspace_y_scaler_packedfloat = v26; |
0 | 610 v3->field_1E = v46; |
430 | 611 v3->world_x = x; |
612 v3->world_y = y; | |
613 v3->world_z = z; | |
0 | 614 v3->uScreenSpaceX = v35; |
615 v3->uScreenSpaceY = v32; | |
616 HIWORD(v26) = HIWORD(v42); | |
617 LOWORD(v26) = 0; | |
430 | 618 v27 = (object->uAttributes & 0x20) == 0; |
862 | 619 v3->sZValue = v26 + (PID(OBJECT_Item,i)); |
657 | 620 v3->dimming_level = 0; |
0 | 621 v3->uTintColor = 0; |
622 if ( !v27 ) | |
623 { | |
624 if ( !pRenderer->pRenderD3D ) | |
625 v3->sZValue = 0; | |
626 } | |
627 } | |
628 goto LABEL_34; | |
629 } | |
630 } | |
631 } | |
430 | 632 //} |
0 | 633 LABEL_34: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
634 ; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
635 //++v41; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
636 //v0 += 112; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
637 //} |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
638 //while ( v41 < (signed int)uNumSpriteObjects ); |
0 | 639 } |
640 } | |
641 // 4E94D3: using guessed type char byte_4E94D3; | |
642 // 5187E4: using guessed type int uNumSpritesDrawnThisFrame; | |
643 | |
644 //----- (0049D9BC) -------------------------------------------------------- | |
645 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut) | |
646 { | |
647 size_t v4; // eax@1 | |
648 size_t v5; // eax@1 | |
649 IUnknown *v6; // eax@10 | |
650 size_t v7; // eax@13 | |
651 DDDEVICEIDENTIFIER ddDevId; // [sp+4h] [bp-4F8h]@11 | |
652 DDSURFACEDESC2 v10;/*int v10; // [sp+42Ch] [bp-D0h]@16 | |
653 int v11; // [sp+430h] [bp-CCh]@16 | |
654 int v12; // [sp+434h] [bp-C8h]@16 | |
655 int v13; // [sp+438h] [bp-C4h]@16 | |
656 int v14; // [sp+474h] [bp-88h]@16*/ | |
657 DDSCAPS2 ddsCaps; // [sp+4A8h] [bp-54h]@14 | |
658 unsigned int uFreeVideoMem; // [sp+4B8h] [bp-44h]@14 | |
659 RenderD3D_aux aux; // [sp+4BCh] [bp-40h]@19 | |
660 IDirect3D3 *pDirect3D3; // [sp+4C4h] [bp-38h]@18 | |
661 int v19; // [sp+4C8h] [bp-34h]@16 | |
662 RenderD3D_D3DDevDesc v20; // [sp+4CCh] [bp-30h]@1 | |
663 LPDIRECTDRAW pDirectDraw; // [sp+4F4h] [bp-8h]@4 | |
664 IDirectDraw4 *pDirectDraw4; // [sp+4F8h] [bp-4h]@7 | |
665 | |
666 v4 = strlen(lpDriverName); | |
667 v20.pDriverName = new char[v4 + 1]; | |
668 v5 = strlen(lpDevDesc); | |
669 v20.pDeviceDesc = new char[v5 + 1]; | |
670 strcpy(v20.pDriverName, lpDriverName); | |
671 strcpy(v20.pDeviceDesc, lpDevDesc); | |
672 if ( lpGUID ) | |
673 { | |
674 v20.pGUID = new GUID; | |
675 memcpy(v20.pGUID, lpGUID, 0x10u); | |
676 } | |
677 else | |
678 { | |
679 v20.pGUID = 0; | |
680 } | |
681 | |
682 if (FAILED(DirectDrawCreate(v20.pGUID, &pDirectDraw, 0))) | |
683 { | |
684 delete [] v20.pDriverName; | |
685 delete [] v20.pDeviceDesc; | |
686 if ( v20.pGUID ) | |
687 delete v20.pGUID; | |
688 } | |
689 else | |
690 { | |
691 if (FAILED(pDirectDraw->QueryInterface(IID_IDirectDraw4, (LPVOID *)&pDirectDraw4))) | |
692 { | |
693 delete [] v20.pDriverName; | |
694 delete [] v20.pDeviceDesc; | |
695 if ( v20.pGUID ) | |
696 delete v20.pGUID; | |
697 v6 = (IUnknown *)pDirectDraw; | |
698 } | |
699 else | |
700 { | |
701 pDirectDraw->Release(); | |
702 if (FAILED( pDirectDraw4->GetDeviceIdentifier(&ddDevId, 1u))) | |
703 { | |
704 v20.pDDraw4DevDesc = 0; | |
705 } | |
706 else | |
707 { | |
708 v7 = strlen(ddDevId.szDescription); | |
709 v20.pDDraw4DevDesc = new char[v7 + 1]; | |
710 strcpy(v20.pDDraw4DevDesc, ddDevId.szDescription); | |
711 } | |
712 memset(&ddsCaps, 0, 0x10u); | |
713 if (FAILED(pDirectDraw4->GetAvailableVidMem( | |
714 &ddsCaps, | |
715 (LPDWORD)&v20.uVideoMem, | |
716 (LPDWORD)&uFreeVideoMem))) | |
717 v20.uVideoMem = 0; | |
718 memset(&v10, 0, 0x7Cu); | |
719 v10.dwSize = 124; | |
720 v10.dwFlags = 6; | |
721 v10.dwHeight = 640; | |
722 v10.dwWidth = 480; | |
723 v10.ddpfPixelFormat.dwSize = 32; | |
724 | |
725 v19 = 0; | |
726 if ( FAILED(pDirectDraw4->EnumDisplayModes( | |
727 0, | |
728 0, | |
729 &v19, | |
730 (LPDDENUMMODESCALLBACK2)DDrawDisplayModesEnumerator)) | |
731 || !v19 | |
732 || FAILED(pDirectDraw4->QueryInterface(IID_IDirect3D3, (LPVOID *)&pDirect3D3))) | |
733 { | |
734 delete [] v20.pDriverName; | |
735 delete [] v20.pDeviceDesc; | |
736 if ( v20.pDDraw4DevDesc ) | |
737 free(v20.pDDraw4DevDesc); | |
738 if ( v20.pGUID ) | |
739 delete v20.pGUID; | |
740 v6 = (IUnknown *)pDirectDraw4; | |
741 } | |
742 else | |
743 { | |
744 aux.pInfo = pOut; | |
745 aux.ptr_4 = &v20; | |
746 pDirect3D3->EnumDevices((LPD3DENUMDEVICESCALLBACK)D3DDeviceEnumerator, &aux); | |
747 delete [] v20.pDriverName; | |
748 delete [] v20.pDeviceDesc; | |
749 if ( v20.pDDraw4DevDesc ) | |
750 free(v20.pDDraw4DevDesc); | |
751 if ( v20.pGUID ) | |
752 delete v20.pGUID; | |
753 pDirectDraw4->Release(); | |
754 v6 = (IUnknown *)pDirect3D3; | |
755 pDirectDraw4 = 0; | |
756 } | |
757 } | |
758 v6->Release(); | |
759 } | |
760 return 1; | |
761 } | |
762 | |
763 //----- (0049D784) -------------------------------------------------------- | |
764 HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, RenderD3D_aux *a6) | |
765 { | |
766 int v6; // eax@1 | |
767 signed int v7; // edi@1 | |
768 signed int v8; // edi@14 | |
769 size_t v9; // eax@30 | |
770 size_t v10; // eax@30 | |
771 size_t v11; // eax@30 | |
772 size_t v12; // eax@30 | |
773 size_t v13; // eax@30 | |
774 | |
775 v6 = pHWDesc->dwFlags; | |
776 v7 = -1; | |
777 if ( v6 ) | |
778 { | |
779 if ( !a6->ptr_4->pGUID ) | |
780 v7 = 0; | |
781 if ( v6 && a6->ptr_4->pGUID ) | |
782 v7 = 1; | |
783 } | |
784 if ( !strcmp(lpDeviceName, "RGB Emulation") && !a6->ptr_4->pGUID ) | |
785 v7 = 2; | |
786 if ( !strcmp(lpDeviceName, "Reference Rasterizer") && !a6->ptr_4->pGUID ) | |
787 v7 = 3; | |
788 if ( v7 != -1 ) | |
789 { | |
790 v8 = v7; | |
791 a6->pInfo[v8].bIsDeviceCompatible = 1; | |
792 a6->pInfo[v8].uCaps = 0; | |
793 if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 0x10) ) | |
794 a6->pInfo[v8].uCaps |= 2u; | |
795 if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 2) ) | |
796 a6->pInfo[v8].uCaps |= 4u; | |
797 if ( !(pHWDesc->dpcTriCaps.dwSrcBlendCaps & 1) ) | |
798 a6->pInfo[v8].uCaps |= 8u; | |
799 if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 0x20) ) | |
800 a6->pInfo[v8].uCaps |= 0x10u; | |
801 if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 2) ) | |
802 a6->pInfo[v8].uCaps |= 0x20u; | |
803 if ( !(pHWDesc->dpcTriCaps.dwDestBlendCaps & 4) ) | |
804 a6->pInfo[v8].uCaps |= 0x40u; | |
805 if ( !(BYTE1(pHWDesc->dwDevCaps) & 0x10) ) | |
806 BYTE1(a6->pInfo[v8].uCaps) |= 1u; | |
807 if ( pHWDesc->dpcTriCaps.dwTextureCaps & 0x20 ) | |
808 LOBYTE(a6->pInfo[v8].uCaps) |= 0x80u; | |
809 v9 = strlen(lpDeviceName); | |
810 a6->pInfo[v8].pName = new char[v9 + 1]; | |
811 strcpy(a6->pInfo[v8].pName, lpDeviceName); | |
812 v10 = strlen(lpDeviceDesc); | |
813 a6->pInfo[v8].pDescription = new char[v10 + 1]; | |
814 strcpy(a6->pInfo[v8].pDescription, lpDeviceDesc); | |
815 a6->pInfo[v8].pGUID = (GUID *)operator new(0x10u); | |
816 memcpy(a6->pInfo[v8].pGUID, lpGUID, 0x10u); | |
817 v11 = strlen(a6->ptr_4->pDriverName); | |
818 a6->pInfo[v8].pDriverName = new char[v11 + 1]; | |
819 strcpy(a6->pInfo[v8].pDriverName, a6->ptr_4->pDriverName); | |
820 v12 = strlen(a6->ptr_4->pDeviceDesc); | |
821 a6->pInfo[v8].pDeviceDesc = new char[v12 + 1]; | |
822 strcpy(a6->pInfo[v8].pDeviceDesc, a6->ptr_4->pDeviceDesc); | |
823 v13 = strlen(a6->ptr_4->pDDraw4DevDesc); | |
824 a6->pInfo[v8].pDDraw4DevDesc = new char[v13 + 1]; | |
825 strcpy(a6->pInfo[v8].pDDraw4DevDesc, a6->ptr_4->pDDraw4DevDesc); | |
826 if ( a6->ptr_4->pGUID ) | |
827 { | |
828 a6->pInfo[v8].pDirectDrawGUID = new GUID; | |
829 memcpy(a6->pInfo[v8].pDirectDrawGUID, a6->ptr_4->pGUID, 0x10u); | |
830 } | |
831 else | |
832 { | |
833 a6->pInfo[v8].pDirectDrawGUID = 0; | |
834 } | |
835 a6->pInfo[v8].uVideoMem = a6->ptr_4->uVideoMem; | |
836 } | |
837 return 1; | |
838 } | |
839 | |
840 //----- (0049D75C) -------------------------------------------------------- | |
841 HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2) | |
842 { | |
843 HRESULT result; // eax@3 | |
844 | |
845 if ( pSurfaceDesc->ddsCaps.dwCaps | 0x2000 && pSurfaceDesc->ddpfPixelFormat.dwRGBBitCount == 16 ) | |
846 { | |
847 *a2 = 1; | |
848 result = 0; | |
849 } | |
850 else | |
851 { | |
852 result = 1; | |
853 } | |
854 return result; | |
855 } | |
856 | |
857 //----- (0047A95E) -------------------------------------------------------- | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
858 void Render::PrepareDecorationsRenderList_ODM() |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
859 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
860 //char *v0; // esi@2 |
639 | 861 //DecorationDesc *v1; // ebx@6 |
0 | 862 __int16 v2; // ax@6 |
863 double v3; // st7@7 | |
639 | 864 //int v4; // eax@9 |
865 //int v5; // edx@9 | |
0 | 866 unsigned int v6; // edi@9 |
867 int v7; // eax@9 | |
868 SpriteFrame *v8; // eax@9 | |
635 | 869 //SpriteFrame *v9; // edi@9 |
0 | 870 unsigned __int16 *v10; // eax@9 |
871 int v11; // ecx@9 | |
872 int v12; // eax@9 | |
873 int v13; // ecx@9 | |
874 int v14; // ecx@20 | |
875 char v15; // dl@20 | |
876 signed int v16; // eax@20 | |
877 int v17; // eax@23 | |
878 int v18; // ecx@24 | |
879 int v19; // eax@24 | |
880 int v20; // ecx@24 | |
881 int v21; // ebx@26 | |
882 int v22; // eax@26 | |
883 int v23; // eax@30 | |
884 signed __int64 v24; // qtt@31 | |
885 int v25; // ebx@31 | |
886 int v26; // ecx@32 | |
887 RenderBillboard *v27; // eax@37 | |
888 __int16 v28; // dx@37 | |
889 __int16 v29; // cx@37 | |
890 int v30; // ecx@37 | |
891 int v31; // ebx@37 | |
619 | 892 Particle_sw local_0; // [sp+Ch] [bp-98h]@7 |
639 | 893 //int x; // [sp+74h] [bp-30h]@9 |
894 //int y; // [sp+78h] [bp-2Ch]@9 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
895 //int v35; // [sp+7Ch] [bp-28h]@1 |
639 | 896 //int v36; // [sp+80h] [bp-24h]@9 |
0 | 897 unsigned __int16 *v37; // [sp+84h] [bp-20h]@9 |
898 int v38; // [sp+88h] [bp-1Ch]@9 | |
899 int v39; // [sp+8Ch] [bp-18h]@24 | |
900 int v40; // [sp+90h] [bp-14h]@24 | |
901 int v41; // [sp+94h] [bp-10h]@24 | |
902 int v42; // [sp+98h] [bp-Ch]@9 | |
903 int a5; // [sp+9Ch] [bp-8h]@9 | |
904 int b; // [sp+A0h] [bp-4h]@22 | |
905 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
906 //v35 = 0; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
907 //if ( (signed int)uNumLevelDecorations > 0 ) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
908 //{ |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
909 //v0 = (char *)&pLevelDecorations[0].vPosition.y; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
910 //do |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
911 for (int i = 0; i < uNumLevelDecorations; ++i) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
912 { |
1202 | 913 auto decor = &pLevelDecorations[i]; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
914 auto v0 = (char *)&pLevelDecorations[i].vPosition.y; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
915 |
1491
6d21ef91cb2d
Rename LevelDecoration::_47A825 to LevelDecoration::IsObeliskChestActive().
yoctozepto
parents:
1490
diff
changeset
|
916 if ((!(decor->uFlags & LEVEL_DECORATION_OBELISK_CHEST) || decor->IsObeliskChestActive()) && !(decor->uFlags & LEVEL_DECORATION_INVISIBLE)) |
1490 | 917 { |
918 //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; | |
919 auto decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; | |
920 v2 = decor_desc->uFlags; | |
921 if ( (char)v2 >= 0 ) | |
922 { | |
923 if ( !(v2 & 0x22) ) | |
0 | 924 { |
1490 | 925 //v4 = decor->vPosition.x; |
926 //v5 = decor->vPosition.z; | |
927 v6 = pMiscTimer->uTotalGameTimeElapsed; | |
928 //y = decor->vPosition.y; | |
929 //x = decor->vPosition.x; | |
930 //v36 = decor->vPosition.z; | |
931 v7 = abs(decor->vPosition.x + decor->vPosition.y); | |
932 | |
933 | |
934 #pragma region "New: seasons change" | |
935 extern bool change_seasons; | |
936 if (change_seasons) | |
937 switch (pParty->uCurrentMonth) | |
938 { | |
939 // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites | |
940 case 11: case 0: case 1: // winter | |
941 switch (decor_desc->uSpriteID) | |
942 { | |
943 //case 468: //bush02 grows on swamps, which are evergreeen actually | |
944 case 548: // flower10 | |
945 case 547: // flower09 | |
946 case 541: // flower03 | |
947 case 539: continue; // flower01 | |
948 | |
949 case 483: // tree01 | |
950 case 486: // tree04 | |
951 case 492: // tree10 | |
952 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 2); | |
953 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7); | |
954 break; | |
955 | |
956 default: | |
957 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
958 } | |
959 break; | |
960 | |
961 case 2: case 3: case 4: // spring | |
962 switch (decor_desc->uSpriteID) | |
963 { | |
964 } | |
965 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
966 break; | |
967 | |
968 case 8: case 9: case 10: // autumn | |
969 switch (decor_desc->uSpriteID) | |
970 { | |
971 //case 468: //bush02 grows on swamps, which are evergreeen actually | |
972 case 548: // flower10 | |
973 case 547: // flower09 | |
974 case 541: // flower03 | |
975 case 539: continue; // flower01 | |
976 | |
977 case 483: // tree01 | |
978 case 486: // tree04 | |
979 case 492: // tree10 | |
980 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 1); | |
981 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7); | |
982 break; | |
983 | |
984 default: | |
985 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
986 } | |
987 break; | |
988 | |
989 case 5: case 6: case 7: // summer | |
990 //all green by default | |
991 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
992 break; | |
993 | |
994 default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); | |
995 } | |
996 else | |
997 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
998 #pragma endregion | |
999 //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | |
1000 | |
1001 //v9 = v8; | |
1002 v42 = v8->uFlags; | |
1003 a5 = v8->uGlowRadius; | |
1004 v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pIndoorCamera->pos.x, | |
1005 decor->vPosition.y - pIndoorCamera->pos.y); | |
1006 v11 = *((int *)v0 + 2); | |
1007 v37 = v10; | |
1008 v12 = v42; | |
1009 v38 = 0; | |
1010 v13 = ((signed int)(stru_5C6E00->uIntegerPi | |
1011 + ((signed int)stru_5C6E00->uIntegerPi >> 3) | |
1012 + v11 | |
1013 - (signed int)v37) >> 8) & 7; | |
1014 v37 = (unsigned __int16 *)v13; | |
1015 if ( v42 & 2 ) | |
1016 v38 = 2; | |
1017 if ( (256 << v13) & v42 ) | |
1018 v38 |= 4u; | |
1019 if ( v12 & 0x40000 ) | |
1020 v38 |= 0x40u; | |
1021 if ( v12 & 0x20000 ) | |
1022 LOBYTE(v38) = v38 | 0x80; | |
1023 if ( a5 ) | |
0 | 1024 { |
1490 | 1025 if ( pRenderer->pRenderD3D && pRenderer->bUseColoredLights ) |
0 | 1026 { |
1490 | 1027 v14 = decor_desc->uColoredLightRed; |
1028 v15 = decor_desc->uColoredLightGreen; | |
1029 v16 = decor_desc->uColoredLightBlue; | |
0 | 1030 } |
1031 else | |
1032 { | |
1490 | 1033 v16 = 255; |
1034 v14 = 255; | |
1035 v15 = 255; | |
1036 } | |
1037 b = v16; | |
1038 pStationaryLightsStack->AddLight( | |
1039 decor->vPosition.x, | |
1040 decor->vPosition.y, | |
1041 decor->vPosition.z + decor_desc->uDecorationHeight / 2, | |
1042 a5, | |
1043 v14, | |
1044 v15, | |
1045 v16, | |
1046 byte_4E94D0); | |
1047 } | |
1048 v17 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; | |
1049 if ( pIndoorCamera->sRotationX ) | |
1050 { | |
1051 v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; | |
1052 v18 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) | |
1053 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); | |
1054 v42 = v18; | |
1055 b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
1056 a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
1057 v40 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; | |
1058 v41 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; | |
1059 v19 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; | |
1060 v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); | |
1061 v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); | |
1062 if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) | |
1063 { | |
1064 v21 = a5 - b; | |
1065 v41 = a5 - b; | |
1066 a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; | |
1067 b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; | |
1068 v22 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - a5; | |
1069 LABEL_30: | |
1070 v42 = v22; | |
1071 v40 = 2 * abs(v20); | |
1072 v23 = abs(v21); | |
1073 if ( v40 >= v23 ) | |
0 | 1074 { |
1490 | 1075 LODWORD(v24) = 0; |
1076 HIDWORD(v24) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
1077 a5 = v24 / v39; | |
1078 v25 = pViewport->uScreenCenterX | |
1079 - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16); | |
1080 b = (unsigned __int64)(a5 * (signed __int64)v42) >> 16; | |
1081 v41 = v24 / v39; | |
1082 v40 = pViewport->uScreenCenterY | |
1083 - ((signed int)(((unsigned __int64)(a5 * (signed __int64)v42) >> 16) + 32768) >> 16); | |
1084 v42 = v8->scale; | |
1085 v41 = (unsigned __int64)(v42 * v24 / v39) >> 16; | |
1086 v37 = (unsigned __int16 *)&v8->pHwSpriteIDs[(int)v37]; | |
1087 if ( pRenderer->pRenderD3D ) | |
1088 { | |
1089 v26 = v41; | |
1090 v42 = pSprites_LOD->pHardwareSprites[(signed __int16)*v37].uBufferWidth >> 1; | |
1091 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; | |
1092 } | |
1093 else | |
1094 { | |
1095 v26 = v41; | |
1096 v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1; | |
1097 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; | |
1098 } | |
1099 if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) | |
1100 { | |
1101 if (::uNumBillboardsToDraw >= 500) | |
1102 return; | |
1103 v27 = &pBillboardRenderList[::uNumBillboardsToDraw++]; | |
1104 ++uNumDecorationsDrawnThisFrame; | |
1105 v27->uHwSpriteID = *v37; | |
1106 v28 = v8->uPaletteIndex; | |
1107 v27->_screenspace_x_scaler_packedfloat = v26; | |
1108 v27->_screenspace_y_scaler_packedfloat = v26; | |
1109 v29 = v38; | |
1110 v27->uScreenSpaceX = v25; | |
1111 HIBYTE(v29) |= 2u; | |
1112 v27->uPalette = v28; | |
1113 v27->field_1E = v29; | |
1114 v27->world_x = decor->vPosition.x; | |
1115 v27->world_y = decor->vPosition.y; | |
1116 v27->world_z = decor->vPosition.z; | |
1117 v27->uScreenSpaceY = v40; | |
1118 HIWORD(v30) = HIWORD(v39); | |
1119 v31 = PID(OBJECT_Decoration,i); | |
1120 LOWORD(v30) = 0; | |
1121 v27->uIndoorSectorID = 0; | |
1122 v27->sZValue = v30 + v31; | |
1123 v27->dimming_level = 0; | |
1124 v27->pSpriteFrame = v8; | |
1125 v27->uTintColor = 0; | |
1126 } | |
0 | 1127 } |
1490 | 1128 goto LABEL_38; |
1129 } | |
1130 } | |
1131 else | |
1132 { | |
1133 v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; | |
1134 v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; | |
1135 b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
1136 a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
1137 v20 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); | |
1138 v39 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); | |
1139 if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) | |
1140 { | |
1141 a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
1142 b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
1143 v21 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; | |
1144 v41 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; | |
1145 v22 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; | |
1146 goto LABEL_30; | |
0 | 1147 } |
1148 } | |
1149 } | |
1490 | 1150 } |
1151 else | |
1152 { | |
1153 memset(&local_0, 0, 0x68u); | |
1154 v3 = (double)*((signed int *)v0 - 1); | |
1155 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; | |
1156 local_0.uDiffuse = 0xFF3C1E; | |
1157 local_0.x = v3; | |
1158 local_0.y = (double)*(signed int *)v0; | |
1159 local_0.z = (double)*((signed int *)v0 + 1); | |
1160 local_0.r = 0.0; | |
1161 local_0.g = 0.0; | |
1162 local_0.b = 0.0; | |
1163 local_0.flt_28 = 1.0; | |
1164 local_0.timeToLive = (rand() & 0x80) + 128; | |
1165 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); | |
1166 pGame->pParticleEngine->AddParticle(&local_0); | |
1167 } | |
1168 } | |
0 | 1169 LABEL_38: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1170 ; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1171 //++v35; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1172 //v0 += 32; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1173 } |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
1174 //while ( v35 < (signed int)uNumLevelDecorations ); |
0 | 1175 } |
1176 // 4E94D0: using guessed type char byte_4E94D0; | |
1177 // 5187EC: using guessed type int uNumDecorationsDrawnThisFrame; | |
1178 | |
1179 //----- (0049D717) -------------------------------------------------------- | |
1180 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst) | |
1181 { | |
1182 HRESULT v2; // esi@2 | |
1183 | |
1184 if ( Src->dwFlags & 0x400 | 0x2000 ) | |
1185 { | |
1186 v2 = 0; | |
1187 if ( Src->dwRGBBitCount == 16 && !Src->dwRBitMask ) | |
1188 goto LABEL_6; | |
1189 if ( !Dst->dwSize ) | |
1190 { | |
1191 v2 = 1; | |
1192 LABEL_6: | |
1193 memcpy(Dst, Src, 0x20u); | |
1194 return v2; | |
1195 } | |
1196 } | |
1197 return 1; | |
1198 } | |
1199 | |
1200 //----- (0049DC28) -------------------------------------------------------- | |
1201 void RenderD3D::GetAvailableDevices(RenderD3D__DevInfo **pOutDevices) | |
1202 { | |
1203 RenderD3D__DevInfo *v2; // eax@1 | |
1204 | |
1205 v2 = new RenderD3D__DevInfo[4];// 4 items | |
1206 *pOutDevices = v2; | |
1207 memset(v2, 0, 0xA0u); | |
1208 DirectDrawEnumerateA((LPDDENUMCALLBACKA)RenderD3D__DeviceEnumerator, *pOutDevices); | |
1209 } | |
1210 | |
1211 //----- (0049DC58) -------------------------------------------------------- | |
1212 RenderD3D::RenderD3D() | |
1213 { | |
1214 RenderD3D *v1; // esi@1 | |
1215 | |
1216 v1 = this; | |
1217 this->pHost = 0; | |
1218 this->pDirect3D = 0; | |
1219 this->pUnk = 0; | |
1220 this->pBackBuffer = 0; | |
1221 this->pFrontBuffer = 0; | |
1222 this->pZBuffer = 0; | |
1223 this->pDevice = 0; | |
1224 this->pViewport = 0; | |
1225 this->field_40 = 1; | |
1226 this->field_44 = 10; | |
1227 GetAvailableDevices(&this->pAvailableDevices); | |
1228 } | |
1229 | |
1230 //----- (0049DC90) -------------------------------------------------------- | |
1231 void RenderD3D::Release() | |
1232 { | |
1233 RenderD3D *v1; // esi@1 | |
1234 IDirectDraw4 *v2; // eax@2 | |
1235 signed int v3; // edi@4 | |
1236 IDirect3DViewport3 *v4; // eax@22 | |
1237 IUnknown *v5; // eax@24 | |
1238 IDirectDrawSurface4 *v6; // eax@26 | |
1239 IDirect3DDevice3 *v7; // eax@28 | |
1240 IDirect3D3 *v8; // eax@30 | |
1241 IDirectDrawSurface4 *v9; // eax@32 | |
1242 IDirectDrawSurface4 *v10; // eax@34 | |
1243 IDirectDraw4 *v11; // eax@36 | |
1244 | |
1245 v1 = this; | |
1246 if ( !this->bWindowed ) | |
1247 { | |
1248 v2 = this->pHost; | |
1249 if ( v2 ) | |
1250 { | |
1251 v2->RestoreDisplayMode(); | |
1252 v1->pHost->SetCooperativeLevel(v1->hWindow, 8u); | |
1253 v1->pHost->FlipToGDISurface(); | |
1254 } | |
1255 } | |
1256 v3 = 0; | |
1257 do | |
1258 { | |
1259 if ( v1->pAvailableDevices[v3].pDriverName ) | |
1260 { | |
1261 free(v1->pAvailableDevices[v3].pDriverName); | |
1262 v1->pAvailableDevices[v3].pDriverName = 0; | |
1263 } | |
1264 if ( v1->pAvailableDevices[v3].pDeviceDesc ) | |
1265 { | |
1266 free(v1->pAvailableDevices[v3].pDeviceDesc); | |
1267 v1->pAvailableDevices[v3].pDeviceDesc = 0; | |
1268 } | |
1269 if ( v1->pAvailableDevices[v3].pDDraw4DevDesc ) | |
1270 { | |
1271 free(v1->pAvailableDevices[v3].pDDraw4DevDesc); | |
1272 v1->pAvailableDevices[v3].pDDraw4DevDesc = 0; | |
1273 } | |
1274 if ( v1->pAvailableDevices[v3].pDirectDrawGUID ) | |
1275 { | |
1276 free(v1->pAvailableDevices[v3].pDirectDrawGUID); | |
1277 v1->pAvailableDevices[v3].pDirectDrawGUID = 0; | |
1278 } | |
1279 if ( v1->pAvailableDevices[v3].pName ) | |
1280 { | |
1281 free(v1->pAvailableDevices[v3].pName); | |
1282 v1->pAvailableDevices[v3].pName = 0; | |
1283 } | |
1284 if ( v1->pAvailableDevices[v3].pDescription ) | |
1285 { | |
1286 free(v1->pAvailableDevices[v3].pDescription); | |
1287 v1->pAvailableDevices[v3].pDescription = 0; | |
1288 } | |
1289 if ( v1->pAvailableDevices[v3].pGUID ) | |
1290 { | |
1291 free(v1->pAvailableDevices[v3].pGUID); | |
1292 v1->pAvailableDevices[v3].pGUID = 0; | |
1293 } | |
1294 ++v3; | |
1295 } | |
1296 while ( v3 < 4 ); | |
1297 if ( v1->pAvailableDevices ) | |
1298 { | |
1299 free(v1->pAvailableDevices); | |
1300 v1->pAvailableDevices = 0; | |
1301 } | |
1302 v4 = v1->pViewport; | |
1303 if ( v4 ) | |
1304 { | |
1305 v4->Release(); | |
1306 v1->pViewport = 0; | |
1307 } | |
1308 v5 = v1->pUnk; | |
1309 if ( v5 ) | |
1310 { | |
1311 v5->Release(); | |
1312 v1->pUnk = 0; | |
1313 } | |
1314 v6 = v1->pZBuffer; | |
1315 if ( v6 ) | |
1316 { | |
1317 v6->Release(); | |
1318 v1->pZBuffer = 0; | |
1319 } | |
1320 v7 = v1->pDevice; | |
1321 if ( v7 ) | |
1322 { | |
1323 v7->Release(); | |
1324 v1->pDevice = 0; | |
1325 } | |
1326 v8 = v1->pDirect3D; | |
1327 if ( v8 ) | |
1328 { | |
1329 v8->Release(); | |
1330 v1->pDirect3D = 0; | |
1331 } | |
1332 v9 = v1->pBackBuffer; | |
1333 if ( v9 ) | |
1334 { | |
1335 v9->Release(); | |
1336 v1->pBackBuffer = 0; | |
1337 } | |
1338 v10 = v1->pFrontBuffer; | |
1339 if ( v10 ) | |
1340 { | |
1341 v10->Release(); | |
1342 v1->pFrontBuffer = 0; | |
1343 } | |
1344 v11 = v1->pHost; | |
1345 if ( v11 ) | |
1346 { | |
1347 v11->Release(); | |
1348 v1->pHost = 0; | |
1349 } | |
1350 } | |
1351 | |
1352 //----- (0049DE14) -------------------------------------------------------- | |
1353 bool RenderD3D::CreateDevice(unsigned int uDeviceID, int bWindowed, HWND hWnd) | |
1354 { | |
1355 //IDirectDraw4 *v8; // eax@12 | |
1356 //IDirectDraw4 *v9; // eax@16 | |
1357 //IDirectDraw4 *v10; // eax@20 | |
1358 //IDirectDraw4 *v13; // eax@35 | |
1359 const char *v23; // [sp-4h] [bp-DCh]@9 | |
1360 const char *v24; // [sp-4h] [bp-DCh]@13 | |
1361 const char *v25; // [sp-4h] [bp-DCh]@19 | |
1362 DWORD v26; // [sp-4h] [bp-DCh]@30 | |
1363 DDSCAPS2 v27; // [sp+Ch] [bp-CCh]@37 | |
1364 DDSURFACEDESC2 ddsd2; // [sp+1Ch] [bp-BCh]@11 | |
1365 D3DVIEWPORT2 d3dvp2; // [sp+98h] [bp-40h]@28 | |
1366 IDirectDrawClipper *v30; // [sp+C4h] [bp-14h]@18 | |
1367 LPDIRECTDRAW lpDD; // [sp+C8h] [bp-10h]@1 | |
1368 | |
1369 this->bWindowed = bWindowed; | |
1370 this->hWindow = hWnd; | |
1371 | |
1372 if (FAILED(DirectDrawCreate(pAvailableDevices[uDeviceID].pDirectDrawGUID, &lpDD, 0))) | |
1373 { | |
1374 sprintf(pErrorMessage, "Init - Failed to create DirectDraw interface.\n"); | |
1375 return 0; | |
1376 } | |
1377 | |
1378 if (FAILED(lpDD->QueryInterface(IID_IDirectDraw4, (LPVOID *)&pHost))) | |
1379 { | |
1380 sprintf(pErrorMessage, "Init - Failed to create DirectDraw4 interface.\n"); | |
1381 if (lpDD) | |
1382 lpDD->Release(); | |
1383 return 0; | |
1384 } | |
1385 lpDD->Release(); | |
1386 lpDD = 0; | |
1387 | |
1388 if (bWindowed && !pAvailableDevices[uDeviceID].pDirectDrawGUID) | |
1389 { | |
1390 if (FAILED(pHost->SetCooperativeLevel(hWnd, DDSCL_MULTITHREADED | DDSCL_NORMAL))) | |
1391 { | |
1392 v23 = "Init - Failed to set cooperative level.\n"; | |
1393 sprintf(pErrorMessage, v23); | |
1394 LABEL_65: | |
1395 if (pHost) | |
1396 { | |
1397 pHost->Release(); | |
1398 pHost = 0; | |
1399 } | |
1400 return 0; | |
1401 } | |
1402 memset(&ddsd2, 0, sizeof(DDSURFACEDESC2)); | |
1403 ddsd2.dwSize = sizeof(DDSURFACEDESC2); | |
1404 ddsd2.dwFlags = DDSD_CAPS; | |
1405 ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; | |
1406 if ( !pHost->CreateSurface(&ddsd2, &pFrontBuffer, 0) ) | |
1407 { | |
1408 ddsd2.dwSize = sizeof(DDSURFACEDESC2); | |
1409 pHost->GetDisplayMode(&ddsd2); | |
1410 if ( ddsd2.ddpfPixelFormat.dwRGBBitCount != 16 ) | |
1411 { | |
1412 v24 = "Init - Desktop isn't in 16 bit mode.\n"; | |
1413 goto LABEL_14; | |
1414 } | |
1415 | |
1416 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; | |
1417 ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; | |
1418 ddsd2.dwWidth = 640; | |
1419 ddsd2.dwHeight = 480; | |
1420 if (pHost->CreateSurface(&ddsd2, &pBackBuffer, 0) ) | |
1421 { | |
1422 v24 = "Init - Failed to create back buffer.\n"; | |
1423 LABEL_14: | |
1424 sprintf(pErrorMessage, v24); | |
1425 if (pFrontBuffer) | |
1426 { | |
1427 pFrontBuffer->Release(); | |
1428 pFrontBuffer = 0; | |
1429 } | |
1430 goto LABEL_65; | |
1431 } | |
1432 if ( pHost->CreateClipper(0, &v30, 0) ) | |
1433 { | |
1434 v25 = "Init - Failed to create clipper.\n"; | |
1435 goto LABEL_45; | |
1436 } | |
1437 v30->SetHWnd(0, hWnd); | |
1438 pFrontBuffer->SetClipper(v30); | |
1439 | |
1440 v30->Release(); | |
1441 v30 = 0; | |
1442 | |
1443 pHost->QueryInterface(IID_IDirect3D3, (LPVOID *)&pDirect3D); | |
1444 | |
1445 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; | |
1446 ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; | |
1447 ddsd2.dwWidth = 640; | |
1448 ddsd2.dwHeight = 480; | |
1449 | |
1450 if ( pDirect3D->EnumZBufferFormats(*pAvailableDevices[uDeviceID].pGUID, | |
1451 (HRESULT (__stdcall *)(DDPIXELFORMAT *, void *))D3DZBufferFormatEnumerator, | |
1452 &ddsd2.ddpfPixelFormat) ) | |
1453 goto LABEL_21; | |
1454 if ( uDeviceID == 2 || uDeviceID == 3 ) | |
1455 ddsd2.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; | |
1456 | |
1457 if ( !pHost->CreateSurface(&ddsd2, &pZBuffer, 0) ) | |
1458 { | |
1459 if ( !pBackBuffer->AddAttachedSurface(pZBuffer) ) | |
1460 { | |
1461 if ( !pDirect3D->CreateDevice(*pAvailableDevices[uDeviceID].pGUID, | |
1462 pBackBuffer, | |
1463 &pDevice, | |
1464 0) ) | |
1465 { | |
1466 memset(&d3dvp2, 0, sizeof(D3DVIEWPORT2)); | |
1467 d3dvp2.dvClipWidth = 2.0; | |
1468 d3dvp2.dvClipY = 1.0; | |
1469 d3dvp2.dvClipHeight = 2.0; | |
1470 d3dvp2.dvMaxZ = 1.0; | |
1471 d3dvp2.dvMinZ = 0.0; | |
1472 goto LABEL_54; | |
1473 } | |
1474 LABEL_51: | |
1475 sprintf(pErrorMessage, "Init - Failed to create D3D device.\n"); | |
1476 if (pDirect3D) | |
1477 { | |
1478 pDirect3D->Release(); | |
1479 pDirect3D = 0; | |
1480 } | |
1481 goto LABEL_59; | |
1482 } | |
1483 LABEL_48: | |
1484 sprintf(pErrorMessage, "Init - Failed to attach z-buffer to back buffer.\n"); | |
1485 if (pZBuffer) | |
1486 { | |
1487 pZBuffer->Release(); | |
1488 pZBuffer = 0; | |
1489 } | |
1490 goto LABEL_61; | |
1491 } | |
1492 goto LABEL_44; | |
1493 } | |
1494 LABEL_36: | |
1495 v23 = "Init - Failed to create front buffer.\n"; | |
1496 sprintf(pErrorMessage, v23); | |
1497 goto LABEL_65; | |
1498 } | |
1499 if ( uDeviceID == 1 ) | |
1500 v26 = 1045; | |
1501 else | |
1502 v26 = 1041; | |
1503 if (pHost->SetCooperativeLevel(hWnd, v26) ) | |
1504 { | |
1505 v23 = "Init - Failed to set cooperative level.\n"; | |
1506 sprintf(pErrorMessage, v23); | |
1507 goto LABEL_65; | |
1508 } | |
1509 if (pHost->SetDisplayMode(640u, 480u, 16u, 0, 0) ) | |
1510 { | |
1511 v23 = "Init - Failed to set display mode.\n"; | |
1512 sprintf(pErrorMessage, v23); | |
1513 goto LABEL_65; | |
1514 } | |
1515 | |
1516 memset(&ddsd2, 0, sizeof(DDSURFACEDESC2)); | |
1517 ddsd2.dwSize = sizeof(DDSURFACEDESC2); | |
1518 ddsd2.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; | |
1519 ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; | |
1520 ddsd2.dwBackBufferCount = 1; | |
1521 if ( pHost->CreateSurface(&ddsd2, &pFrontBuffer, 0) ) | |
1522 goto LABEL_36; | |
1523 //a3a = &pBackBuffer; | |
1524 //v14 = *v34; | |
1525 memset(&v27, 0, sizeof(DDSCAPS2)); | |
1526 v27.dwCaps = DDSCAPS_BACKBUFFER; | |
1527 //v33 = (IDirect3DDevice3 **)v14->GetAttachedSurface(&v27, &pBackBuffer); | |
1528 //hWnda = &pDirect3D; | |
1529 pHost->QueryInterface(IID_IDirect3D3, (LPVOID *)&pDirect3D); | |
1530 if (FAILED(pFrontBuffer->GetAttachedSurface(&v27, &pBackBuffer))) | |
1531 { | |
1532 v25 = "Init - Failed to get D3D interface.\n"; | |
1533 goto LABEL_45; | |
1534 } | |
1535 | |
1536 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; | |
1537 ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; | |
1538 ddsd2.dwWidth = 640; | |
1539 ddsd2.dwHeight = 480; | |
1540 if ( pDirect3D->EnumZBufferFormats(*pAvailableDevices[uDeviceID].pGUID, | |
1541 (HRESULT (__stdcall *)(DDPIXELFORMAT *, void *))D3DZBufferFormatEnumerator, | |
1542 &ddsd2.ddpfPixelFormat) ) | |
1543 { | |
1544 LABEL_21: | |
1545 v25 = "Init - Failed to enumerate Z buffer formats.\n"; | |
1546 goto LABEL_45; | |
1547 } | |
1548 if ( uDeviceID == 2 || uDeviceID == 3 ) | |
1549 BYTE1(ddsd2.ddsCaps.dwCaps) |= 8u; | |
1550 //uDeviceIDa = &pZBuffer; | |
1551 if (pHost->CreateSurface(&ddsd2, &pZBuffer, 0) ) | |
1552 { | |
1553 LABEL_44: | |
1554 v25 = "Init - Failed to create z-buffer.\n"; | |
1555 LABEL_45: | |
1556 sprintf(pErrorMessage, v25); | |
1557 if (pBackBuffer) | |
1558 { | |
1559 pBackBuffer->Release(); | |
1560 pBackBuffer = 0; | |
1561 } | |
1562 LABEL_63: | |
1563 //v19 = &pFrontBuffer; | |
1564 if (pFrontBuffer) | |
1565 { | |
1566 pFrontBuffer->Release(); | |
1567 pFrontBuffer= 0; | |
1568 } | |
1569 goto LABEL_65; | |
1570 } | |
1571 if (pBackBuffer->AddAttachedSurface(pZBuffer)) | |
1572 goto LABEL_48; | |
1573 //v33 = &pDevice; | |
1574 if (pDirect3D->CreateDevice(*pAvailableDevices[uDeviceID].pGUID, | |
1575 pBackBuffer, | |
1576 &pDevice, | |
1577 0) ) | |
1578 goto LABEL_51; | |
1579 memset(&d3dvp2, 0, sizeof(D3DVIEWPORT2)); | |
1580 d3dvp2.dvClipWidth = 2.0; | |
1581 d3dvp2.dvClipY = 1.0; | |
1582 d3dvp2.dvClipHeight = 2.0; | |
1583 d3dvp2.dvMaxZ = 1.0; | |
1584 | |
1585 LABEL_54: | |
1586 d3dvp2.dwSize = sizeof(D3DVIEWPORT2); | |
1587 //v17 = *hWnda; | |
1588 d3dvp2.dwWidth = 640; | |
1589 d3dvp2.dwHeight = 480; | |
1590 d3dvp2.dvClipX = -1.0; | |
1591 //v18 = v17->lpVtbl; | |
1592 //v32 = &v4->pViewport; | |
1593 if (pDirect3D->CreateViewport(&pViewport, 0)) | |
1594 { | |
1595 sprintf(pErrorMessage, "Init - Failed to create viewport.\n"); | |
1596 if (pDevice) | |
1597 { | |
1598 pDevice->Release(); | |
1599 pDevice = 0; | |
1600 } | |
1601 if (pDirect3D) | |
1602 { | |
1603 pDirect3D->Release(); | |
1604 pDirect3D = 0; | |
1605 } | |
1606 LABEL_59: | |
1607 if (pZBuffer) | |
1608 { | |
1609 pZBuffer->Release(); | |
1610 pZBuffer = 0; | |
1611 } | |
1612 LABEL_61: | |
1613 if (pBackBuffer) | |
1614 { | |
1615 pBackBuffer->Release(); | |
1616 pBackBuffer = 0; | |
1617 } | |
1618 goto LABEL_63; | |
1619 } | |
1620 | |
1621 pDevice->AddViewport(pViewport); | |
1622 pViewport->SetViewport2(&d3dvp2); | |
1623 pDevice->SetCurrentViewport(pViewport); | |
1624 return 1; | |
1625 } | |
1626 | |
1627 //----- (0049E444) -------------------------------------------------------- | |
1628 unsigned int RenderD3D::GetDeviceCaps() | |
1629 { | |
1630 unsigned int v1; // ebx@1 | |
1631 RenderD3D *v2; // edi@1 | |
1632 IDirect3DDevice3 *v3; // eax@1 | |
1633 unsigned int result; // eax@2 | |
1634 D3DDEVICEDESC refCaps; // [sp+Ch] [bp-1F8h]@1 | |
1635 D3DDEVICEDESC halCaps; // [sp+108h] [bp-FCh]@1 | |
1636 | |
1637 v1 = 0; | |
1638 v2 = this; | |
1639 memset(&halCaps, 0, 0xFCu); | |
1640 halCaps.dwSize = 252; | |
1641 memset(&refCaps, 0, 0xFCu); | |
1642 v3 = v2->pDevice; | |
1643 refCaps.dwSize = 252; | |
1644 if ( v3->GetCaps(&halCaps, &refCaps) ) | |
1645 { | |
1646 result = 1; | |
1647 } | |
1648 else | |
1649 { | |
1650 if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 0x10) ) | |
1651 v1 = 2; | |
1652 if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 2) ) | |
1653 v1 |= 4u; | |
1654 if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 1) ) | |
1655 v1 |= 8u; | |
1656 if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 0x20) ) | |
1657 v1 |= 0x10u; | |
1658 if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 2) ) | |
1659 v1 |= 0x20u; | |
1660 if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 4) ) | |
1661 v1 |= 0x40u; | |
1662 if ( halCaps.dpcTriCaps.dwTextureCaps & 0x20 ) | |
1663 LOBYTE(v1) = v1 | 0x80; | |
1664 result = v1; | |
1665 } | |
1666 return result; | |
1667 } | |
1668 | |
1669 //----- (0049E4FC) -------------------------------------------------------- | |
1670 void RenderD3D::ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear) | |
1671 { | |
1672 uint uClearFlags = 0; | |
1673 | |
1674 if (bClearColor) | |
1675 uClearFlags |= D3DCLEAR_TARGET; | |
1676 if (bClearDepth) | |
1677 uClearFlags |= D3DCLEAR_ZBUFFER; | |
1678 | |
1679 D3DRECT rects[] = {{0, 0, 640, 480}}; | |
1680 if (uClearFlags) | |
1681 pViewport->Clear2(1, rects, uClearFlags, uClearColor, z_clear, 0); | |
1682 } | |
1683 | |
1684 //----- (0049E54D) -------------------------------------------------------- | |
1685 void RenderD3D::Present(bool bForceBlit) | |
1686 { | |
1687 RECT v5; // [sp+18h] [bp-18h]@1 | |
1688 struct tagPOINT Point; // [sp+28h] [bp-8h]@4 | |
1689 | |
1690 v5.left = 0; | |
1691 v5.top = 0; | |
1692 v5.bottom = 480; | |
1693 v5.right = 640; | |
1694 | |
1695 if (bWindowed || bForceBlit) | |
1696 { | |
1697 RECT rc; | |
1698 GetClientRect(hWindow, &rc); | |
1699 Point.y = 0; | |
1700 Point.x = 0; | |
1701 ClientToScreen(hWindow, &Point); | |
1702 OffsetRect(&rc, Point.x, Point.y); | |
1703 pFrontBuffer->Blt(&rc, pBackBuffer, &v5, DDBLT_WAIT, 0); | |
1704 } | |
1705 else | |
1706 pFrontBuffer->Flip(0, 1); | |
1707 } | |
1708 | |
1709 //----- (0049E5D4) -------------------------------------------------------- | |
1710 bool RenderD3D::CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim) | |
1711 { | |
1712 unsigned int v8; // edx@4 | |
1713 unsigned int v9; // ebx@5 | |
1714 unsigned int v10; // eax@5 | |
1715 DWORD v11; // edx@5 | |
1716 //int v12; // edx@7 | |
1717 DDSURFACEDESC2 ddsd2; // [sp+Ch] [bp-80h]@1 | |
1718 //RenderD3D *v15; // [sp+88h] [bp-4h]@1 | |
1719 | |
1720 //v15 = this; | |
1721 memset(&ddsd2, 0, 0x7Cu); | |
1722 ddsd2.dwSize = 0x7Cu; | |
1723 ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; | |
1724 ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE; | |
1725 ddsd2.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE; | |
1726 ddsd2.dwHeight = uTextureHeight; | |
1727 ddsd2.dwWidth = uTextureWidth; | |
1728 if ( bMipmaps ) | |
1729 { | |
1730 if ( (signed int)uTextureHeight <= (signed int)uTextureWidth ) | |
1731 { | |
1732 v8 = GetMaxMipLevels(uTextureHeight) - GetMaxMipLevels(uMinDeviceTexDim); | |
1733 LABEL_8: | |
1734 ddsd2.dwMipMapCount = v8; | |
1735 if ( !v8 ) | |
1736 goto LABEL_12; | |
1737 goto LABEL_11; | |
1738 } | |
1739 if ( (signed int)uTextureWidth < (signed int)uMinDeviceTexDim ) | |
1740 { | |
1741 v8 = GetMaxMipLevels(uMinDeviceTexDim); | |
1742 goto LABEL_8; | |
1743 } | |
1744 v9 = GetMaxMipLevels(uTextureWidth); | |
1745 v10 = GetMaxMipLevels(uMinDeviceTexDim); | |
1746 ddsd2.dwMipMapCount = v9 - v10; | |
1747 if ( v9 == v10 ) | |
1748 { | |
1749 ddsd2.dwFlags = 0x1007u; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
1750 __debugbreak(); // warning C4700: uninitialized local variable 'v11' used |
0 | 1751 ddsd2.ddsCaps.dwCaps = v11; |
1752 goto LABEL_12; | |
1753 } | |
1754 } | |
1755 else | |
1756 { | |
1757 ddsd2.dwMipMapCount = 1; | |
1758 } | |
1759 LABEL_11: | |
1760 ddsd2.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_MIPMAPCOUNT; | |
1761 ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP; | |
1762 LABEL_12: | |
1763 ddsd2.ddpfPixelFormat.dwRGBBitCount = 16; | |
1764 ddsd2.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); | |
1765 if (bAlphaChannel) | |
1766 { | |
1767 ddsd2.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; | |
1768 ddsd2.ddpfPixelFormat.dwRBitMask = 0x7C00; | |
1769 ddsd2.ddpfPixelFormat.dwGBitMask = 0x03E0; | |
1770 ddsd2.ddpfPixelFormat.dwBBitMask = 0x001F; | |
1771 ddsd2.ddpfPixelFormat.dwRGBAlphaBitMask = 0x8000u; | |
1772 } | |
1773 else | |
1774 { | |
1775 ddsd2.ddpfPixelFormat.dwFlags = DDPF_RGB; | |
1776 ddsd2.ddpfPixelFormat.dwRBitMask = 0xF800; | |
1777 ddsd2.ddpfPixelFormat.dwGBitMask = 0x07E0; | |
1778 ddsd2.ddpfPixelFormat.dwBBitMask = 0x001F; | |
1779 ddsd2.ddpfPixelFormat.dwRGBAlphaBitMask = 0; | |
1780 } | |
1781 if (FAILED(pHost->CreateSurface(&ddsd2, pOutSurface, 0))) | |
1782 return false; | |
1783 if (FAILED((*pOutSurface)->QueryInterface(IID_IDirect3DTexture2, (void **)pOutTexture))) | |
1784 { | |
1785 (*pOutSurface)->Release(); | |
1786 *pOutSurface = 0; | |
1787 return false; | |
1788 } | |
1789 return true; | |
1790 } | |
1791 | |
1792 //----- (004A5190) -------------------------------------------------------- | |
1793 void RenderD3D::HandleLostResources() | |
1794 { | |
1795 pBitmaps_LOD->ReleaseLostHardwareTextures(); | |
1796 pBitmaps_LOD->_410423_move_textures_to_device(); | |
1797 pSprites_LOD->ReleaseLostHardwareSprites(); | |
1798 } | |
1799 | |
1800 //----- (004A2050) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
1801 void Render::DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture) |
0 | 1802 { |
1803 Render *v5; // edi@1 | |
1804 unsigned int v6; // ebx@1 | |
1805 LightmapBuilder *v7; // esi@3 | |
1806 int v8; // eax@7 | |
1807 ODMFace *v9; // eax@12 | |
1808 char *v10; // esi@12 | |
1809 double v11; // st7@14 | |
1810 double v12; // st7@14 | |
1811 int v13; // eax@14 | |
1812 ODMFace *v14; // ecx@14 | |
1813 double v15; // st7@14 | |
1814 float v16; // ST48_4@15 | |
1815 int v17; // eax@15 | |
1816 char v18; // zf@17 | |
1817 HRESULT v19; // eax@18 | |
1818 HRESULT v20; // eax@18 | |
1819 HRESULT v21; // eax@20 | |
1820 HRESULT v22; // eax@20 | |
1821 unsigned int v23; // ecx@20 | |
1822 char *v24; // eax@21 | |
1823 HRESULT v25; // eax@23 | |
1824 HRESULT v26; // eax@23 | |
1825 HRESULT v27; // eax@24 | |
1826 HRESULT v28; // eax@25 | |
1827 HRESULT v29; // eax@25 | |
1828 HRESULT v30; // eax@25 | |
1829 HRESULT v31; // eax@25 | |
1830 HRESULT v32; // eax@26 | |
1831 unsigned int v33; // ecx@26 | |
1832 char *v34; // eax@27 | |
1833 int v35; // edx@28 | |
1834 HRESULT v36; // eax@29 | |
1835 HRESULT v37; // eax@29 | |
1836 HRESULT v38; // eax@29 | |
1837 HRESULT v39; // eax@29 | |
1838 //IDirect3DDevice3Vtbl *v40; // ebx@29 | |
1839 unsigned int v41; // eax@29 | |
1840 HRESULT v42; // eax@30 | |
1841 HRESULT v43; // eax@30 | |
1842 HRESULT v44; // eax@30 | |
1843 char *v45; // esi@34 | |
1844 int v46; // ecx@35 | |
1845 double v47; // st6@35 | |
1846 int v48; // eax@36 | |
1847 const char *v49; // [sp+4Ch] [bp-1Ch]@0 | |
1848 const char *v50; // [sp+4Ch] [bp-1Ch]@20 | |
1849 int v51; // [sp+50h] [bp-18h]@0 | |
1850 unsigned int v52; // [sp+54h] [bp-14h]@0 | |
1851 LightmapBuilder *v53; // [sp+58h] [bp-10h]@3 | |
1852 unsigned int v54; // [sp+5Ch] [bp-Ch]@3 | |
1853 unsigned int v55; // [sp+5Ch] [bp-Ch]@34 | |
1854 unsigned int v56; // [sp+60h] [bp-8h]@12 | |
1855 int v57; // [sp+60h] [bp-8h]@34 | |
638 | 1856 unsigned int a2; // [sp+64h] [bp-4h]@4 |
0 | 1857 |
1858 v5 = this; | |
1859 v6 = 0; | |
1860 if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 ) | |
1861 { | |
1862 v7 = pGame->pLightmapBuilder; | |
1863 v53 = v7; | |
1864 v54 = v7->std__vector_000004_size; | |
1865 if ( v7->std__vector_000004_size) | |
638 | 1866 a2 = 0xFFFFFFFF; |
1867 pGame->AlterGamma_ODM(a4, &a2); | |
1394 | 1868 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) |
0 | 1869 { |
638 | 1870 v8 = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); |
1394 | 1871 v7->DrawLightmaps(/*v8, 0*/); |
0 | 1872 } |
1873 else | |
1874 { | |
1875 if ( !v54 || byte_4D864C && pGame->uFlags & 2 ) | |
1876 { | |
323 | 1877 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 1878 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
1879 if (bUsingSpecular) | |
1880 { | |
186 | 1881 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
1882 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
1883 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 1884 } |
1073 | 1885 for (uint i = 0; i < uNumVertices; ++i) |
1886 { | |
1887 | |
1888 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
1889 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
1890 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); | |
1891 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
1892 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
1893 pGame->AlterGamma_ODM(a4, &d3d_vertex_buffer[i].diffuse); | |
1894 | |
1895 if ( this->bUsingSpecular ) | |
0 | 1896 { |
1073 | 1897 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 1898 } |
1073 | 1899 else |
1900 { | |
1901 d3d_vertex_buffer[i].specular = 0; | |
1902 } | |
1903 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
1904 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
1905 | |
1906 } | |
323 | 1907 |
1908 if (a4->uAttributes & FACE_OUTLINED) | |
1909 { | |
1910 int color; | |
1911 if (GetTickCount() % 300 >= 150) | |
1912 color = 0xFFFF2020; | |
1913 else color = 0xFF901010; | |
1914 | |
1915 for (uint i = 0; i < uNumVertices; ++i) | |
1916 d3d_vertex_buffer[i].diffuse = color; | |
1917 } | |
1918 | |
0 | 1919 pRenderD3D->pDevice->SetTexture(0, pTexture); |
1920 pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
1921 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1922 d3d_vertex_buffer, |
0 | 1923 uNumVertices, |
1924 D3DDP_DONOTLIGHT); | |
1925 } | |
1926 else | |
1927 { | |
1073 | 1928 for (uint i = 0; i < uNumVertices; ++i) |
1929 { | |
1930 | |
1931 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
1932 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
1933 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); | |
1934 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
1935 d3d_vertex_buffer[i].diffuse = GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
1936 if ( this->bUsingSpecular ) | |
0 | 1937 { |
1073 | 1938 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 1939 } |
1073 | 1940 else |
1941 { | |
1942 d3d_vertex_buffer[i].specular = 0; | |
1943 } | |
1944 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
1945 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
1946 | |
1947 } | |
1948 | |
186 | 1949 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
1950 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
0 | 1951 if (bUsingSpecular) |
186 | 1952 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
0 | 1953 |
1954 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | |
1955 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
1956 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1957 d3d_vertex_buffer, |
0 | 1958 uNumVertices, |
1959 D3DDP_DONOTLIGHT)); | |
1960 //v50 = (const char *)v5->pRenderD3D->pDevice; | |
1961 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
1962 //(*(void (**)(void))(*(int *)v50 + 88))(); | |
1394 | 1963 v53->DrawLightmaps(/*-1, 0*/); |
1073 | 1964 for (uint i = 0; i < uNumVertices; ++i) |
1965 { | |
1966 d3d_vertex_buffer[i].diffuse = a2; | |
1967 } | |
0 | 1968 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); |
186 | 1969 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 1970 if ( !pRenderer->bUsingSpecular ) |
186 | 1971 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
1972 | |
1973 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
1974 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
1975 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
0 | 1976 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
1977 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1978 d3d_vertex_buffer, |
0 | 1979 uNumVertices, |
1980 D3DDP_DONOTLIGHT)); | |
1981 if (bUsingSpecular) | |
1982 { | |
186 | 1983 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
0 | 1984 |
1073 | 1985 for (uint i = 0; i < uNumVertices; ++i) |
1986 { | |
1987 d3d_vertex_buffer[i].diffuse = pRenderer->uFogColor | d3d_vertex_buffer[i].specular & 0xFF000000; | |
1988 d3d_vertex_buffer[i].specular = 0; | |
1989 } | |
1990 | |
0 | 1991 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
186 | 1992 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
1993 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); | |
0 | 1994 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
1995 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1996 d3d_vertex_buffer, |
0 | 1997 uNumVertices, |
1998 D3DDP_DONOTLIGHT)); | |
186 | 1999 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 2000 //v40 = pRenderer->pRenderD3D->pDevice->lpVtbl; |
2001 v41 = GetLevelFogColor(); | |
2002 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF); | |
2003 v6 = 0; | |
2004 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); | |
2005 } | |
186 | 2006 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
2007 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 2008 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v6)); |
2009 } | |
2010 } | |
2011 } | |
2012 } | |
2013 // 4D864C: using guessed type char byte_4D864C; | |
2014 | |
2015 //----- (0049EB79) -------------------------------------------------------- | |
2016 Render::~Render() | |
2017 { | |
2018 Render *v1; // esi@1 | |
2019 | |
2020 v1 = this; | |
2021 pAllocator->FreeChunk(this->pDefaultZBuffer); | |
2022 v1->pD3DBitmaps.Release(); | |
2023 v1->pD3DSprites.Release(); | |
2024 Release(); | |
2025 v1->bWindowMode = 1; | |
2026 //nullsub_1(); | |
2027 //nullsub_1(); | |
2028 } | |
2029 | |
2030 //----- (0049E756) -------------------------------------------------------- | |
2031 bool Render::IsColorKeySupported(IDirectDraw4 *this_) | |
2032 { | |
2033 DDCAPS refCaps; // [sp+0h] [bp-2F8h]@1 | |
2034 DDCAPS halCaps; // [sp+17Ch] [bp-17Ch]@1 | |
2035 | |
2036 halCaps.dwSize = 380; | |
2037 refCaps.dwSize = 380; | |
2038 this_->GetCaps(&halCaps, &refCaps); | |
2039 return halCaps.dwSVBCaps & 0x40 && BYTE1(halCaps.dwSVBCKeyCaps) & 2; | |
2040 } | |
2041 | |
2042 //----- (0049E992) -------------------------------------------------------- | |
2043 Render::Render() | |
2044 { | |
2045 Render *v1; // esi@1 | |
2046 int v2; // eax@1 | |
2047 char v3; // zf@1 | |
2048 | |
2049 v1 = this; | |
2050 this->pDirectDraw4 = 0; | |
2051 this->pFrontBuffer4 = 0; | |
2052 this->pBackBuffer4 = 0; | |
2053 this->pColorKeySurface4 = 0; | |
2054 this->pDirectDraw2 = 0; | |
2055 this->pFrontBuffer2 = 0; | |
2056 this->pBackBuffer2 = 0; | |
2057 this->pSomeSurface2 = 0; | |
2058 //RenderHWLContainer::RenderHWLContainer(&this->pD3DBitmaps); | |
2059 //RenderHWLContainer::RenderHWLContainer(&v1->pD3DSprites); | |
2060 v1->bWindowMode = 1; | |
2061 v1->field_40054 = 0; | |
2062 v1->field_10 = 640; | |
2063 v1->field_14 = 480; | |
2064 v1->field_40030 = 0; | |
2065 v1->field_4002C = 0; | |
2066 v1->pActiveZBuffer = 0; | |
2067 v1->pDefaultZBuffer = 0; | |
709 | 2068 v1->raster_clip_y = 0; |
2069 v1->raster_clip_x = 0; | |
2070 v1->raster_clip_z = 639; | |
2071 v1->raster_clip_w = 479; | |
0 | 2072 v1->field_4003C = (int)&unk_4EED80; |
2073 v1->field_40040 = dword_4EED78; | |
2074 v1->uClipZ = 640; | |
2075 v1->field_40044 = 2; | |
2076 v1->field_40048 = 6; | |
2077 v1->pFrontBuffer4 = 0; | |
2078 v1->pBackBuffer4 = 0; | |
2079 v1->pColorKeySurface4 = 0; | |
2080 v1->pDirectDraw4 = 0; | |
2081 v1->pRenderD3D = 0; | |
2082 v1->uNumSceneBegins = 0; | |
2083 v1->uNumD3DSceneBegins = 0; | |
2084 v1->field_40110 = 0; | |
2085 v1->pTargetSurface = 0; | |
2086 v1->uTargetSurfacePitch = 0; | |
2087 v1->uClipY = 0; | |
2088 v1->uClipX = 0; | |
2089 v1->uClipW = 480; | |
2090 v1->bClip = 1; | |
2091 v1->bColorKeySupported = 0; | |
2092 v1->bRequiredTextureStagesAvailable = 0; | |
2093 v1->bTinting = 1; | |
2094 LOBYTE(v1->field_103668) = 0; | |
2095 v1->field_1036B8 = 0; | |
2096 v1->_gpu_memory_used = 0; | |
2097 uNumBillboardsToDraw = 0; | |
2098 bFogEnabled = false; | |
265 | 2099 |
2100 hd_water_tile_id = -1; | |
2101 hd_water_current_frame = 0; | |
0 | 2102 } |
2103 | |
1512 | 2104 bool Render::Initialize(bool bWindowed, uint32_t uDefaultDevice, bool bColoredLights, uint32_t uDetailLevel, bool bTinting) |
0 | 2105 { |
2106 bUserDirect3D = true;//ReadWindowsRegistryInt("Use D3D", 0); | |
2107 bStartInWindow = bWindowed; | |
2108 | |
2109 uDesiredDirect3DDevice = uDefaultDevice;//ReadWindowsRegistryInt("D3D Device", 1); | |
2110 | |
2111 bUseColoredLights = bColoredLights;//ReadWindowsRegistryInt("Colored Lights", 0); | |
2112 uLevelOfDetail = uDetailLevel;//ReadWindowsRegistryInt("Detail Level", 1); | |
2113 | |
2114 this->bTinting = bTinting; | |
2115 | |
2116 auto r1 = pD3DBitmaps.Load(L"data\\d3dbitmap.hwl"); | |
2117 auto r2 = pD3DSprites.Load(L"data\\d3dsprite.hwl"); | |
2118 | |
2119 return r1 && r2; | |
2120 } | |
2121 | |
2122 //----- (0049EBF1) -------------------------------------------------------- | |
2123 void Render::_49EBF1() | |
2124 { | |
2125 signed int uNumRedBits; // edx@1 | |
2126 signed int uNuGreenBits; // edi@1 | |
2127 signed int uNumBlueBits; // esi@1 | |
2128 unsigned int v4; // edx@4 | |
2129 unsigned int v5; // edi@4 | |
2130 int v6; // ebx@4 | |
2131 int v7; // edx@4 | |
2132 signed int v8; // [sp+8h] [bp-24h]@1 | |
2133 signed int v9; // [sp+Ch] [bp-20h]@1 | |
2134 signed int v10; // [sp+20h] [bp-Ch]@1 | |
2135 signed int i; // [sp+24h] [bp-8h]@2 | |
2136 signed int v12; // [sp+28h] [bp-4h]@3 | |
2137 | |
2138 v10 = 0; | |
2139 uNumRedBits = 1 << this->uTargetRBits; | |
2140 uNuGreenBits = 1 << this->uTargetGBits; | |
2141 uNumBlueBits = 1 << this->uTargetBBits; | |
2142 v9 = 1 << this->uTargetRBits; | |
2143 v8 = 1 << this->uTargetGBits; | |
2144 if ( uNumRedBits > 0 ) | |
2145 { | |
2146 do | |
2147 { | |
2148 for ( i = 0; i < uNuGreenBits; ++i ) | |
2149 { | |
2150 v12 = 0; | |
2151 if ( uNumBlueBits > 0 ) | |
2152 { | |
2153 do | |
2154 { | |
2155 v4 = this->uTargetBBits; | |
2156 v5 = v4 + this->uTargetGBits; | |
2157 v6 = (v12 >> 1) + (v10 >> 1 << v5) + (i >> 1 << this->uTargetBBits); | |
2158 v7 = (v10 << v5) + v12++ + (i << v4); | |
2159 this->field_2C[v7] = v6; | |
2160 } | |
2161 while ( v12 < uNumBlueBits ); | |
2162 uNumRedBits = v9; | |
2163 uNuGreenBits = v8; | |
2164 } | |
2165 } | |
2166 ++v10; | |
2167 } | |
2168 while ( v10 < uNumRedBits ); | |
2169 } | |
2170 } | |
2171 | |
2172 //----- (0049ECC4) -------------------------------------------------------- | |
2173 void Render::ClearBlack() | |
2174 { | |
2175 if (pRenderD3D) | |
2176 { | |
2177 if (field_40110) | |
2178 pRenderD3D->ClearTarget(true, 0, false, 0.0); | |
2179 } | |
2180 else | |
2181 memset(pRenderer->pTargetSurface, 0, 4 * (field_10 * field_14 / 2)); | |
2182 } | |
2183 | |
2184 //----- (0049ED18) -------------------------------------------------------- | |
2185 void Render::PresentBlackScreen() | |
2186 { | |
2187 LONG w; // edx@3 | |
2188 IDirectDrawSurface *v2; // eax@3 | |
2189 DDBLTFX v3; // [sp+4h] [bp-74h]@5 | |
2190 RECT x; // [sp+68h] [bp-10h]@3 | |
2191 | |
2192 memset(&v3, 0, sizeof(DDBLTFX)); | |
2193 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || | |
2194 pVersion->pVersionInfo.dwMajorVersion >= 5) | |
2195 { | |
2196 x.left = uWindowX; | |
2197 x.right = uWindowX + uWindowHeight; | |
2198 x.top = uWindowY; | |
2199 w = uWindowY + uWindowWidth; | |
2200 v2 = (IDirectDrawSurface *)this->pBackBuffer4; | |
2201 } | |
2202 else | |
2203 { | |
2204 x.left = uWindowX; | |
2205 x.right = uWindowX + uWindowHeight; | |
2206 x.top = uWindowY; | |
2207 w = uWindowY + uWindowWidth; | |
2208 v2 = (IDirectDrawSurface *)this->pBackBuffer2; | |
2209 } | |
2210 x.bottom = w; | |
2211 v3.dwFillColor = 0; | |
2212 v3.dwSize = 100; | |
2213 v2->Blt(&x, 0, 0, DDBLT_COLORFILL, &v3); | |
2214 pRenderer->Present(); | |
2215 } | |
2216 | |
2217 //----- (0049EDB6) -------------------------------------------------------- | |
2218 void Render::SavePCXScreenshot() | |
2219 { | |
2220 Render *v1; // esi@1 | |
2221 __int16 v2; // di@1 | |
2222 int v3; // eax@4 | |
2223 int v4; // ecx@4 | |
2224 int v5; // eax@8 | |
2225 FILE *v6; // edi@10 | |
2226 int v7; // ecx@11 | |
2227 int v8; // eax@11 | |
2228 int v9; // eax@13 | |
2229 int v10; // ecx@15 | |
2230 unsigned __int8 v11; // dl@15 | |
2231 signed int v12; // eax@18 | |
2232 char v13; // zf@27 | |
2233 HRESULT v14; // eax@29 | |
2234 char v15[56]; // [sp+Ch] [bp-158h]@10 | |
2235 __int16 v16; // [sp+44h] [bp-120h]@10 | |
2236 DDSURFACEDESC2 Dst; // [sp+48h] [bp-11Ch]@7 | |
2237 char color_map[48]; // [sp+C4h] [bp-A0h]@10 | |
2238 char Filename[40]; // [sp+F4h] [bp-70h]@3 | |
2239 char *v20; // [sp+11Ch] [bp-48h]@14 | |
2240 char *v21; // [sp+120h] [bp-44h]@14 | |
2241 int v24; // [sp+124h] [bp-40h]@11 | |
2242 FILE *File; // [sp+128h] [bp-3Ch]@3 | |
2243 int var38; // [sp+12Ch] [bp-38h]@4 | |
2244 PCXHeader_1 header1; // [sp+130h] [bp-34h]@10 | |
2245 PCXHeader_2 header2; // [sp+140h] [bp-24h]@10 | |
2246 void *ptr; // [sp+148h] [bp-1Ch]@10 | |
2247 void *v28; // [sp+14Ch] [bp-18h]@8 | |
2248 int v29; // [sp+150h] [bp-14h]@4 | |
2249 int v30; // [sp+154h] [bp-10h]@4 | |
2250 char v31; // [sp+15Ah] [bp-Ah]@25 | |
2251 unsigned __int8 v32; // [sp+15Bh] [bp-9h]@17 | |
2252 int i; // [sp+15Ch] [bp-8h]@10 | |
2253 unsigned __int8 v34; // [sp+163h] [bp-1h]@17 | |
2254 | |
2255 v1 = this; | |
2256 v2 = 0; | |
2257 if ( !this->pRenderD3D || this->field_40110 ) | |
2258 { | |
2259 sprintf(Filename, "screen%0.2i.pcx", dword_4EFA80++ % 100); | |
2260 File = fopen(Filename, "wb"); | |
2261 if ( File ) | |
2262 { | |
2263 v3 = v1->field_10; | |
2264 v4 = v1->field_14; | |
2265 var38 = v3; | |
2266 v29 = v4; | |
2267 v30 = v3; | |
2268 if ( v3 & 1 ) | |
2269 v30 = v3 + 1; | |
2270 if ( v1->pRenderD3D ) | |
2271 { | |
2272 memset(&Dst, 0, 0x7Cu); | |
2273 Dst.dwSize = 124; | |
168 | 2274 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 2275 return; |
2276 v28 = Dst.lpSurface; | |
2277 v5 = Dst.lPitch >> 1; | |
2278 v2 = 0; | |
2279 } | |
2280 else | |
2281 { | |
2282 pRenderer->BeginScene(); | |
2283 v28 = pRenderer->pTargetSurface; | |
2284 v5 = pRenderer->uTargetSurfacePitch; | |
2285 } | |
2286 i = v5; | |
2287 header1.right = var38 - 1; | |
2288 header1.left = v2; | |
2289 header1.bottom = v29 - 1; | |
2290 header1.up = v2; | |
2291 header2.pitch = v30; | |
2292 memset(color_map, 0, sizeof(color_map)); | |
2293 memset(v15, 0, sizeof(v15)); | |
2294 header2.reserved = 0; | |
2295 header1.manufacturer = 10; | |
2296 v16 = 0; | |
2297 v6 = File; | |
2298 header1.version = 5; | |
2299 header1.encoding = 1; | |
2300 header1.bpp = 8; | |
2301 header1.hdpi = 75; | |
2302 header1.vdpi = 75; | |
2303 header2.planes = 3; | |
2304 header2.palette_info = 1; | |
2305 fwrite(&header1, 1u, 1u, File); | |
2306 fwrite(&header1.version, 1u, 1u, v6); | |
2307 fwrite(&header1.encoding, 1u, 1u, v6); | |
2308 fwrite(&header1.bpp, 1u, 1u, v6); | |
2309 fwrite(&header1.left, 2u, 1u, v6); | |
2310 fwrite(&header1.up, 2u, 1u, v6); | |
2311 fwrite(&header1.right, 2u, 1u, v6); | |
2312 fwrite(&header1.bottom, 2u, 1u, v6); | |
2313 fwrite(&header1.hdpi, 2u, 1u, v6); | |
2314 fwrite(&header1.vdpi, 2u, 1u, v6); | |
2315 fwrite(color_map, 0x30u, 1u, v6); | |
2316 fwrite(&header2, 1u, 1u, v6); | |
2317 fwrite(&header2.planes, 1u, 1u, v6); | |
2318 fwrite(&header2.pitch, 2u, 1u, v6); | |
2319 fwrite(&header2.palette_info, 2u, 1u, v6); | |
2320 fwrite(v15, 0x3Au, 1u, v6); | |
2321 ptr = pAllocator->AllocNamedChunk(0, 3 * var38 + 6, 0); | |
2322 if ( v29 > 0 ) | |
2323 { | |
2324 v7 = v30; | |
2325 File = (FILE *)v29; | |
2326 v29 = 3 * v30; | |
2327 v24 = 2 * i; | |
2328 v8 = (int)v28; | |
2329 while ( 1 ) | |
2330 { | |
2331 i = v8; | |
2332 v9 = 0; | |
2333 if ( var38 > 0 ) | |
2334 { | |
2335 v21 = (char *)ptr + v7; | |
2336 v20 = (char *)ptr + 2 * v30; | |
2337 do | |
2338 { | |
2339 *((char *)ptr + v9) = (signed int)(v1->uTargetRMask & *(short *)i) >> (LOBYTE(v1->uTargetGBits) | |
2340 + LOBYTE(v1->uTargetBBits) | |
2341 + v1->uTargetRBits | |
2342 - 8); | |
2343 v21[v9] = (signed int)(v1->uTargetGMask & *(short *)i) >> (LOBYTE(v1->uTargetBBits) | |
2344 + LOBYTE(v1->uTargetGBits) | |
2345 - 8); | |
2346 v10 = i; | |
2347 v11 = LOBYTE(v1->uTargetBMask); | |
2348 i += 2; | |
2349 v20[v9++] = (*(char *)v10 & v11) << (8 - LOBYTE(v1->uTargetBBits)); | |
2350 } | |
2351 while ( v9 < var38 ); | |
2352 } | |
2353 for ( i = 0; i < v29; i += v34 ) | |
2354 { | |
2355 v34 = 1; | |
2356 v32 = *((char *)ptr + i); | |
2357 do | |
2358 { | |
2359 v12 = i + v34; | |
2360 if ( *((char *)ptr + v12) != v32 ) | |
2361 break; | |
2362 if ( !(v12 % v30) ) | |
2363 break; | |
2364 ++v34; | |
2365 } | |
2366 while ( v34 < 0x3Fu ); | |
2367 if ( i + v34 > v29 ) | |
2368 v34 = 3 * v30 - i; | |
2369 if ( v34 > 1u || v32 >= 0xC0u ) | |
2370 { | |
2371 v31 = v34 | 0xC0; | |
2372 fwrite(&v31, 1u, 1u, v6); | |
2373 } | |
2374 fwrite(&v32, 1u, 1u, v6); | |
2375 } | |
2376 v8 = (int)((char *)v28 + v24); | |
2377 v13 = File == (FILE *)1; | |
2378 File = (FILE *)((char *)File - 1); | |
2379 v28 = (char *)v28 + v24; | |
2380 if ( v13 ) | |
2381 break; | |
2382 v7 = v30; | |
2383 } | |
2384 } | |
2385 if ( v1->pRenderD3D ) | |
2386 { | |
2387 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2388 } | |
2389 else | |
2390 { | |
2391 pRenderer->EndScene(); | |
2392 } | |
2393 | |
2394 pAllocator->FreeChunk(ptr); | |
2395 fclose(v6); | |
2396 } | |
2397 } | |
2398 } | |
2399 // 4EFA80: using guessed type int dword_4EFA80; | |
2400 | |
2401 //----- (0049F1BC) -------------------------------------------------------- | |
2402 void Render::_49F1BC(const char *a1) | |
2403 { | |
2404 Render *v2; // esi@1 | |
2405 __int16 v3; // di@1 | |
2406 int v4; // eax@4 | |
2407 char *v5; // ecx@4 | |
2408 unsigned int v6; // eax@8 | |
2409 FILE *v7; // edi@10 | |
2410 int v8; // ecx@11 | |
2411 int v9; // eax@11 | |
2412 int v10; // eax@13 | |
2413 const char *v11; // ecx@15 | |
2414 unsigned __int8 v12; // dl@15 | |
2415 signed int v13; // eax@18 | |
2416 char v14; // zf@27 | |
2417 HRESULT v15; // eax@29 | |
2418 char v16; // [sp+Ch] [bp-12Ch]@10 | |
2419 __int16 v17; // [sp+44h] [bp-F4h]@10 | |
2420 int Dst; // [sp+48h] [bp-F0h]@7 | |
2421 int v19; // [sp+58h] [bp-E0h]@8 | |
2422 unsigned __int16 *v20; // [sp+6Ch] [bp-CCh]@8 | |
2423 char v21; // [sp+C4h] [bp-74h]@10 | |
2424 unsigned int v22; // [sp+F4h] [bp-44h]@11 | |
2425 char *v23; // [sp+F8h] [bp-40h]@14 | |
2426 int v24; // [sp+FCh] [bp-3Ch]@11 | |
2427 int v25; // [sp+100h] [bp-38h]@4 | |
2428 FILE *File; // [sp+104h] [bp-34h]@3 | |
2429 char Str; // [sp+108h] [bp-30h]@10 | |
2430 char v28; // [sp+109h] [bp-2Fh]@10 | |
2431 char v29; // [sp+10Ah] [bp-2Eh]@10 | |
2432 char v30; // [sp+10Bh] [bp-2Dh]@10 | |
2433 __int16 v31; // [sp+10Ch] [bp-2Ch]@10 | |
2434 __int16 v32; // [sp+10Eh] [bp-2Ah]@10 | |
2435 __int16 v33; // [sp+110h] [bp-28h]@10 | |
2436 __int16 v34; // [sp+112h] [bp-26h]@10 | |
2437 __int16 v35; // [sp+114h] [bp-24h]@10 | |
2438 __int16 v36; // [sp+116h] [bp-22h]@10 | |
2439 char v37; // [sp+118h] [bp-20h]@10 | |
2440 char v38; // [sp+119h] [bp-1Fh]@10 | |
2441 __int16 v39; // [sp+11Ah] [bp-1Eh]@10 | |
2442 __int16 v40; // [sp+11Ch] [bp-1Ch]@10 | |
2443 void *ptr; // [sp+120h] [bp-18h]@10 | |
2444 unsigned __int16 *v42; // [sp+124h] [bp-14h]@8 | |
2445 int v43; // [sp+128h] [bp-10h]@4 | |
2446 char v44; // [sp+12Fh] [bp-9h]@25 | |
2447 char *i; // [sp+130h] [bp-8h]@10 | |
2448 unsigned __int8 v46; // [sp+137h] [bp-1h]@17 | |
2449 | |
2450 v2 = this; | |
2451 v3 = 0; | |
2452 if ( !this->pRenderD3D || this->field_40110 ) | |
2453 { | |
2454 ++dword_4EFA84; | |
2455 File = fopen(a1, "wb"); | |
2456 if ( File ) | |
2457 { | |
2458 v4 = v2->field_10; | |
2459 v5 = (char *)v2->field_14; | |
2460 v25 = v4; | |
2461 a1 = v5; | |
2462 v43 = v4; | |
2463 if ( v4 & 1 ) | |
2464 v43 = v4 + 1; | |
2465 if ( v2->pRenderD3D ) | |
2466 { | |
2467 memset(&Dst, 0, 0x7Cu); | |
2468 Dst = 124; | |
168 | 2469 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, (DDSURFACEDESC2 *)&Dst, DDLOCK_WAIT) ) |
0 | 2470 return; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
2471 __debugbreak(); // warning C4700: uninitialized local variable 'v20' used |
0 | 2472 v42 = v20; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
2473 __debugbreak(); // warning C4700: uninitialized local variable 'v19' used |
0 | 2474 v6 = v19 >> 1; |
2475 v3 = 0; | |
2476 } | |
2477 else | |
2478 { | |
2479 pRenderer->BeginScene(); | |
2480 v42 = pRenderer->pTargetSurface; | |
2481 v6 = pRenderer->uTargetSurfacePitch; | |
2482 } | |
2483 i = (char *)v6; | |
2484 v33 = v25 - 1; | |
2485 v31 = v3; | |
2486 v34 = (short)a1 - 1; | |
2487 v32 = v3; | |
2488 v39 = v43; | |
2489 memset(&v21, 0, 0x30u); | |
2490 memset(&v16, 0, 0x38u); | |
2491 v37 = 0; | |
2492 Str = 10; | |
2493 v17 = 0; | |
2494 v7 = File; | |
2495 v28 = 5; | |
2496 v29 = 1; | |
2497 v30 = 8; | |
2498 v35 = 75; | |
2499 v36 = 75; | |
2500 v38 = 3; | |
2501 v40 = 1; | |
2502 fwrite(&Str, 1u, 1u, File); | |
2503 fwrite(&v28, 1u, 1u, v7); | |
2504 fwrite(&v29, 1u, 1u, v7); | |
2505 fwrite(&v30, 1u, 1u, v7); | |
2506 fwrite(&v31, 2u, 1u, v7); | |
2507 fwrite(&v32, 2u, 1u, v7); | |
2508 fwrite(&v33, 2u, 1u, v7); | |
2509 fwrite(&v34, 2u, 1u, v7); | |
2510 fwrite(&v35, 2u, 1u, v7); | |
2511 fwrite(&v36, 2u, 1u, v7); | |
2512 fwrite(&v21, 0x30u, 1u, v7); | |
2513 fwrite(&v37, 1u, 1u, v7); | |
2514 fwrite(&v38, 1u, 1u, v7); | |
2515 fwrite(&v39, 2u, 1u, v7); | |
2516 fwrite(&v40, 2u, 1u, v7); | |
2517 fwrite(&v16, 0x3Au, 1u, v7); | |
2518 ptr = pAllocator->AllocNamedChunk(0, 3 * v25 + 6, 0); | |
2519 if ( (signed int)a1 > 0 ) | |
2520 { | |
2521 v8 = v43; | |
2522 File = (FILE *)a1; | |
2523 v24 = 3 * v43; | |
2524 v22 = 2 * (int)i; | |
2525 v9 = (int)v42; | |
2526 while ( 1 ) | |
2527 { | |
2528 a1 = (const char *)v9; | |
2529 v10 = 0; | |
2530 if ( v25 > 0 ) | |
2531 { | |
2532 i = (char *)ptr + v8; | |
2533 v23 = (char *)ptr + 2 * v43; | |
2534 do | |
2535 { | |
2536 *((char *)ptr + v10) = (signed int)(v2->uTargetRMask & *(short *)a1) >> (LOBYTE(v2->uTargetGBits) | |
2537 + LOBYTE(v2->uTargetBBits) | |
2538 + v2->uTargetRBits | |
2539 - 8); | |
2540 i[v10] = (signed int)(v2->uTargetGMask & *(short *)a1) >> (LOBYTE(v2->uTargetBBits) | |
2541 + LOBYTE(v2->uTargetGBits) | |
2542 - 8); | |
2543 v11 = a1; | |
2544 v12 = LOBYTE(v2->uTargetBMask); | |
2545 a1 += 2; | |
2546 v23[v10++] = ((unsigned __int8)*v11 & v12) << (8 - LOBYTE(v2->uTargetBBits)); | |
2547 } | |
2548 while ( v10 < v25 ); | |
2549 } | |
2550 for ( i = 0; (signed int)i < v24; i += BYTE3(a1) ) | |
2551 { | |
2552 BYTE3(a1) = 1; | |
2553 v46 = *((char *)ptr + (int)i); | |
2554 do | |
2555 { | |
2556 v13 = (signed int)&i[BYTE3(a1)]; | |
2557 if ( *((char *)ptr + v13) != v46 ) | |
2558 break; | |
2559 if ( !(v13 % v43) ) | |
2560 break; | |
2561 ++BYTE3(a1); | |
2562 } | |
2563 while ( BYTE3(a1) < 0x3Fu ); | |
2564 if ( (signed int)&i[BYTE3(a1)] > v24 ) | |
2565 BYTE3(a1) = 3 * v43 - (char)i; | |
2566 if ( BYTE3(a1) > 1u || v46 >= 0xC0u ) | |
2567 { | |
2568 v44 = BYTE3(a1) | 0xC0; | |
2569 fwrite(&v44, 1u, 1u, v7); | |
2570 } | |
2571 fwrite(&v46, 1u, 1u, v7); | |
2572 } | |
2573 v9 = (int)&v42[v22 / 2]; | |
2574 v14 = File == (FILE *)1; | |
2575 File = (FILE *)((char *)File - 1); | |
2576 v42 = (unsigned __int16 *)((char *)v42 + v22); | |
2577 if ( v14 ) | |
2578 break; | |
2579 v8 = v43; | |
2580 } | |
2581 } | |
2582 if ( v2->pRenderD3D ) | |
2583 { | |
2584 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2585 } | |
2586 else | |
2587 { | |
2588 pRenderer->EndScene(); | |
2589 } | |
2590 pAllocator->FreeChunk(ptr); | |
2591 fclose(v7); | |
2592 } | |
2593 } | |
2594 } | |
2595 // 4EFA84: using guessed type int dword_4EFA84; | |
2596 | |
2597 //----- (0049F5A2) -------------------------------------------------------- | |
810 | 2598 void Render::PackPCXpicture( unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size ) |
2599 { | |
0 | 2600 Render *v7; // ebx@1 |
2601 void *v8; // esi@3 | |
2602 void *v9; // esi@3 | |
2603 int v10; // ecx@4 | |
810 | 2604 unsigned short* v11; // eax@4 |
0 | 2605 int v12; // eax@6 |
2606 int v13; // eax@8 | |
2607 int v14; // ecx@8 | |
2608 signed int v15; // eax@11 | |
2609 char v16; // zf@20 | |
2610 int result; // eax@21 | |
2611 char v18[58]; // [sp+Ch] [bp-ACh]@3 | |
2612 // __int16 v19; // [sp+44h] [bp-74h]@3 | |
2613 char v20[48]; // [sp+48h] [bp-70h]@3 | |
810 | 2614 char *lineG; // [sp+78h] [bp-40h]@7 |
2615 char *lineB; // [sp+7Ch] [bp-3Ch]@7 | |
0 | 2616 int v23; // [sp+80h] [bp-38h]@4 |
2617 int v24; // [sp+84h] [bp-34h]@4 | |
2618 int v25; // [sp+88h] [bp-30h]@4 | |
2619 int v26; // [sp+8Ch] [bp-2Ch]@4 | |
810 | 2620 PCXHeader_1 Src; // [sp+90h] [bp-28h]@3 |
2621 PCXHeader_2 v27; // [sp+A0h] [bp-18h]@3 | |
2622 char *lineRGB; // [sp+A8h] [bp-10h]@3 | |
2623 int pitch; // [sp+ACh] [bp-Ch]@1 | |
0 | 2624 char v43; // [sp+B3h] [bp-5h]@18 |
2625 int i; // [sp+B4h] [bp-4h]@6 | |
810 | 2626 unsigned short* line_pictute_data; |
2627 byte test_byte; | |
2628 unsigned char pict_byte; | |
0 | 2629 |
2630 v7 = this; | |
810 | 2631 pitch = wight; |
2632 if ( wight & 1 ) | |
2633 pitch = wight + 1; | |
2634 Src.left = 0; | |
2635 Src.up = 0; | |
2636 Src.right = wight - 1; | |
2637 Src.bottom = heidth - 1; | |
2638 v27.pitch = pitch; | |
0 | 2639 memset(&v20, 0, 0x30u); |
2640 memset(&v18, 0, 0x38u); | |
810 | 2641 v8 = data_buff; |
2642 v27.reserved = 0; | |
0 | 2643 *(_WORD *)&v18[56] = 0; |
810 | 2644 Src.manufacturer = 10; |
2645 Src.version = 5; | |
2646 Src.encoding = 1; | |
2647 Src.bpp = 8; | |
2648 Src.hdpi = 75; | |
2649 Src.vdpi = 75; | |
2650 v27.planes = 3; | |
2651 v27.palette_info = 1; | |
2652 memcpy(data_buff, &Src, 1u); | |
0 | 2653 v8 = (char *)v8 + 1; |
810 | 2654 memcpy(v8, &Src.version, 1u); |
0 | 2655 v8 = (char *)v8 + 1; |
810 | 2656 memcpy(v8, &Src.encoding, 1u); |
0 | 2657 v8 = (char *)v8 + 1; |
810 | 2658 memcpy(v8, &Src.bpp, 1u); |
0 | 2659 v8 = (char *)v8 + 1; |
810 | 2660 memcpy(v8, &Src.left, 2u); |
0 | 2661 v8 = (char *)v8 + 2; |
810 | 2662 memcpy(v8, &Src.up, 2u); |
0 | 2663 v8 = (char *)v8 + 2; |
810 | 2664 memcpy(v8, &Src.right, 2u); |
0 | 2665 v8 = (char *)v8 + 2; |
810 | 2666 memcpy(v8, &Src.bottom, 2u); |
0 | 2667 v8 = (char *)v8 + 2; |
810 | 2668 memcpy(v8, &Src.hdpi, 2u); |
0 | 2669 v8 = (char *)v8 + 2; |
810 | 2670 memcpy(v8, &Src.vdpi, 2u); |
0 | 2671 v8 = (char *)v8 + 2; |
2672 memcpy(v8, &v20, 0x30u); | |
2673 v8 = (char *)v8 + 48; | |
810 | 2674 memcpy(v8, &v27, 1u); |
0 | 2675 v8 = (char *)v8 + 1; |
810 | 2676 memcpy(v8, &v27.planes, 1u); |
0 | 2677 v8 = (char *)v8 + 1; |
810 | 2678 memcpy(v8, &v27.pitch, 2u); |
0 | 2679 v8 = (char *)v8 + 2; |
810 | 2680 memcpy(v8, &v27.palette_info, 2u); |
0 | 2681 v8 = (char *)v8 + 2; |
2682 memcpy(v8, &v18, 0x3Au); | |
2683 v9 = (char *)v8 + 58; | |
810 | 2684 |
2685 lineRGB = (char*)pAllocator->AllocNamedChunk(0, 3 * (wight + 2), 0); | |
2686 if ( heidth > 0 ) | |
2687 { | |
2688 v10 = pitch; | |
2689 v25 = heidth; | |
2690 v26 = 3 * pitch; | |
2691 v23 = 2 * wight; | |
2692 v11 = picture_data; | |
2693 v24 = (int)picture_data; | |
0 | 2694 while ( 1 ) |
2695 { | |
810 | 2696 line_pictute_data = v11; |
0 | 2697 v12 = 0; |
2698 i = 0; | |
810 | 2699 if ( wight > 0 ) |
2700 { | |
2701 lineG = (char *)lineRGB + pitch; | |
2702 lineB = (char *)lineRGB + 2 * pitch; | |
0 | 2703 do |
2704 { | |
810 | 2705 lineRGB[v12] = (signed int)(v7->uTargetRMask & *line_pictute_data) >> (v7->uTargetGBits + v7->uTargetBBits + v7->uTargetRBits - 8); |
2706 lineG[v12] = (signed int)(v7->uTargetGMask & *line_pictute_data) >> ( v7->uTargetBBits + v7->uTargetGBits- 8); | |
2707 lineB[v12] = (v7->uTargetBMask & *line_pictute_data) << (8 - v7->uTargetBBits); | |
2708 | |
2709 v12++; | |
2710 } | |
2711 while ( v12 < wight ); | |
0 | 2712 } |
2713 for ( i = 0; i < v26; v9 = (char *)v9 + 1 ) | |
2714 { | |
810 | 2715 test_byte = 1; |
2716 pict_byte = lineRGB [i]; | |
0 | 2717 do |
2718 { | |
810 | 2719 v15 = i + test_byte; |
2720 if ( *((char *)lineRGB + v15) != pict_byte ) | |
0 | 2721 break; |
810 | 2722 if ( !(v15 % pitch) ) |
0 | 2723 break; |
810 | 2724 ++test_byte; |
2725 } | |
2726 while ( test_byte < 0x3Fu ); | |
2727 if ( i + test_byte > v26 ) | |
2728 test_byte = 3 * pitch - i; | |
2729 if ( test_byte > 1u || pict_byte >= 0xC0u ) | |
2730 { | |
2731 v43 = test_byte | 0xC0; | |
0 | 2732 memcpy(v9, &v43, 1u); |
2733 v9 = (char *)v9 + 1; | |
2734 } | |
810 | 2735 memcpy(v9, &pict_byte, 1u); |
2736 i += test_byte; | |
2737 } | |
2738 v11 +=wight ; | |
0 | 2739 v16 = v25-- == 1; |
810 | 2740 |
0 | 2741 if ( v16 ) |
2742 break; | |
810 | 2743 v10 = pitch; |
2744 } | |
2745 } | |
2746 pAllocator->FreeChunk(lineRGB); | |
2747 *(int *)packed_size = (char *)v9 - data_buff; | |
2748 | |
0 | 2749 } |
2750 | |
2751 //----- (0049F8B5) -------------------------------------------------------- | |
2752 FILE *Render::SavePCXImage(const char *Filename, char *a3, int a4, int a5) | |
2753 { | |
1430 | 2754 //Render *v5; // esi@1 |
0 | 2755 FILE *result; // eax@1 |
2756 FILE *v7; // edi@4 | |
2757 int v8; // ecx@5 | |
2758 int v9; // eax@5 | |
2759 int v10; // eax@7 | |
2760 int v11; // ecx@9 | |
2761 signed int v12; // eax@12 | |
2762 char v13; // zf@21 | |
2763 char v14[56]; // [sp+4h] [bp-A0h]@4 | |
2764 __int16 v15; // [sp+3Ch] [bp-68h]@4 | |
2765 char color_map[48]; // [sp+40h] [bp-64h]@4 | |
2766 int v17; // [sp+70h] [bp-34h]@5 | |
2767 int v18; // [sp+74h] [bp-30h]@5 | |
2768 char *v19; // [sp+78h] [bp-2Ch]@5 | |
2769 int v20; // [sp+7Ch] [bp-28h]@5 | |
2770 PCXHeader_1 header1; // [sp+80h] [bp-24h]@4 | |
2771 PCXHeader_2 header2; // [sp+90h] [bp-14h]@4 | |
2772 void *ptr; // [sp+98h] [bp-Ch]@4 | |
2773 int v24; // [sp+9Ch] [bp-8h]@2 | |
2774 char *i; // [sp+A0h] [bp-4h]@8 | |
2775 | |
2776 result = fopen(Filename, "wb"); | |
2777 Filename = (const char *)result; | |
2778 if ( result ) | |
2779 { | |
2780 v24 = a4; | |
2781 if ( a4 & 1 ) | |
2782 v24 = a4 + 1; | |
2783 header1.left = 0; | |
2784 header1.up = 0; | |
2785 header1.right = a4 - 1; | |
2786 header1.bottom = a5 - 1; | |
2787 header2.pitch = v24; | |
2788 memset(color_map, 0, sizeof(color_map)); | |
2789 header2.reserved = 0; | |
2790 memset(v14, 0, sizeof(v14)); | |
2791 v15 = 0; | |
2792 header1.manufacturer = 10; | |
2793 header1.version = 5; | |
2794 header1.encoding = 1; | |
2795 header1.bpp = 8; | |
2796 header1.hdpi = 75; | |
2797 header1.vdpi = 75; | |
2798 header2.planes = 3; | |
2799 header2.palette_info = 1; | |
2800 fwrite(&header1, 1u, 1u, (FILE *)Filename); | |
2801 v7 = (FILE *)Filename; | |
2802 fwrite(&header1.version, 1u, 1u, (FILE *)Filename); | |
2803 fwrite(&header1.encoding, 1u, 1u, v7); | |
2804 fwrite(&header1.bpp, 1u, 1u, v7); | |
2805 fwrite(&header1.left, 2u, 1u, v7); | |
2806 fwrite(&header1.up, 2u, 1u, v7); | |
2807 fwrite(&header1.right, 2u, 1u, v7); | |
2808 fwrite(&header1.bottom, 2u, 1u, v7); | |
2809 fwrite(&header1.hdpi, 2u, 1u, v7); | |
2810 fwrite(&header1.vdpi, 2u, 1u, v7); | |
2811 fwrite(color_map, 0x30u, 1u, v7); | |
2812 fwrite(&header2, 1u, 1u, v7); | |
2813 fwrite(&header2.planes, 1u, 1u, v7); | |
2814 fwrite(&header2.pitch, 2u, 1u, v7); | |
2815 fwrite(&header2.palette_info, 2u, 1u, v7); | |
2816 fwrite(v14, 0x3Au, 1u, v7); | |
2817 ptr = pAllocator->AllocNamedChunk(0, 3 * a4 + 6, 0); | |
2818 if ( a5 > 0 ) | |
2819 { | |
2820 v8 = v24; | |
2821 v18 = a5; | |
2822 v20 = 3 * v24; | |
2823 v17 = 2 * a4; | |
2824 v9 = (int)a3; | |
2825 v19 = a3; | |
2826 while ( 1 ) | |
2827 { | |
2828 a5 = v9; | |
2829 v10 = 0; | |
2830 if ( a4 > 0 ) | |
2831 { | |
2832 a3 = (char *)ptr + v8; | |
2833 i = (char *)ptr + 2 * v24; | |
2834 do | |
2835 { | |
1430 | 2836 *((char *)ptr + v10) = (signed int)(this->uTargetRMask & *(short *)a5) >> (LOBYTE(this->uTargetGBits) |
2837 + LOBYTE(this->uTargetBBits) | |
2838 + this->uTargetRBits | |
0 | 2839 - 8); |
1430 | 2840 a3[v10] = (signed int)(this->uTargetGMask & *(short *)a5) >> (LOBYTE(this->uTargetBBits) |
2841 + LOBYTE(this->uTargetGBits) | |
0 | 2842 - 8); |
2843 v11 = a5; | |
2844 a5 += 2; | |
1430 | 2845 i[v10++] = (this->uTargetBMask & *(char *)v11) << (8 - LOBYTE(this->uTargetBBits)); |
0 | 2846 } |
2847 while ( v10 < a4 ); | |
2848 } | |
2849 for ( i = 0; (signed int)i < v20; i += BYTE3(a5) ) | |
2850 { | |
2851 BYTE3(a5) = 1; | |
2852 BYTE3(Filename) = *((char *)ptr + (int)i); | |
2853 do | |
2854 { | |
2855 v12 = (signed int)&i[BYTE3(a5)]; | |
2856 if ( *((char *)ptr + v12) != BYTE3(Filename) ) | |
2857 break; | |
2858 if ( !(v12 % v24) ) | |
2859 break; | |
2860 ++BYTE3(a5); | |
2861 } | |
2862 while ( BYTE3(a5) < 0x3Fu ); | |
2863 if ( (signed int)&i[BYTE3(a5)] > v20 ) | |
2864 BYTE3(a5) = 3 * v24 - (char)i; | |
2865 if ( BYTE3(a5) > 1u || BYTE3(Filename) >= 0xC0u ) | |
2866 { | |
2867 BYTE3(a3) = BYTE3(a5) | 0xC0; | |
2868 fwrite((char *)&a3 + 3, 1u, 1u, v7); | |
2869 } | |
2870 fwrite((char *)&Filename + 3, 1u, 1u, v7); | |
2871 } | |
2872 v9 = (int)&v19[v17]; | |
2873 v13 = v18-- == 1; | |
2874 v19 += v17; | |
2875 if ( v13 ) | |
2876 break; | |
2877 v8 = v24; | |
2878 } | |
2879 } | |
2880 pAllocator->FreeChunk(ptr); | |
2881 result = (FILE *)fclose(v7); | |
2882 } | |
2883 return result; | |
2884 } | |
2885 | |
2886 //----- (0049FBCD) -------------------------------------------------------- | |
2887 void Render::ClearTarget(unsigned int uColor) | |
2888 { | |
2889 if (pRenderD3D) | |
2890 { | |
2891 if (field_40110) | |
2892 pRenderD3D->ClearTarget(true, uColor, false, 0.0); | |
2893 } | |
2894 else | |
2895 memset32(pTargetSurface, uColor, field_10 * field_14 / 2); | |
2896 } | |
2897 | |
2898 //----- (0049FC23) -------------------------------------------------------- | |
2899 void Render::Release2() | |
2900 { | |
2901 Release(); | |
2902 bWindowMode = 1; | |
2903 } | |
2904 | |
2905 //----- (0049FC37) -------------------------------------------------------- | |
2906 void Render::Present() | |
2907 { | |
2908 Render *v1; // esi@1 | |
2909 struct tagRECT Rect; // [sp+8h] [bp-28h]@11 | |
2910 RECT a4; // [sp+18h] [bp-18h]@11 | |
2911 struct tagPOINT Point; // [sp+28h] [bp-8h]@11 | |
2912 | |
2913 v1 = this; | |
2914 if ( !pRenderer->pRenderD3D || this->field_40110 ) | |
2915 { | |
2916 this->pBeforePresentFunction(); | |
2917 if ( v1->pRenderD3D ) | |
2918 { | |
2919 if ( v1->field_40110 ) | |
2920 { | |
2921 pRenderD3D->Present(false); | |
2922 } | |
2923 } | |
2924 else | |
2925 { | |
2926 if ( v1->bWindowMode ) | |
2927 { | |
2928 RestoreFrontBuffer(); | |
2929 GetClientRect(v1->hWnd, &Rect); | |
2930 Point.y = 0; | |
2931 Point.x = 0; | |
2932 ClientToScreen(v1->hWnd, &Point); | |
2933 OffsetRect(&Rect, Point.x, Point.y); | |
2934 a4.top = 0; | |
2935 a4.bottom = 480; | |
2936 a4.left = 0; | |
2937 a4.right = 640; | |
2938 PresentRect(&Rect, &a4); | |
2939 } | |
2940 else | |
2941 { | |
2942 RestoreFrontBuffer(); | |
2943 a4.top = 0; | |
2944 a4.bottom = 480; | |
2945 a4.left = 0; | |
2946 a4.right = 640; | |
2947 BltBackToFontFast(0, 0, &a4); | |
2948 } | |
2949 } | |
2950 } | |
2951 } | |
2952 | |
2953 //----- (0049FD3A) -------------------------------------------------------- | |
2954 void Render::_49FD3A() | |
2955 { | |
2956 Render *v2; // esi@1 | |
2957 IDirectDrawSurface4 *v3; // eax@6 | |
2958 IDirectDrawSurface4 *v4; // ST0C_4@6 | |
2959 RECT v5; // [sp+8h] [bp-10h]@6 | |
2960 | |
2961 auto a1 = this; | |
2962 v2 = a1; | |
2963 if ( a1->pRenderD3D ) | |
2964 { | |
2965 if (pFrontBuffer4->IsLost() == DDERR_SURFACELOST) | |
2966 pFrontBuffer4->Restore(); | |
2967 if (pBackBuffer4->IsLost() == DDERR_SURFACELOST) | |
2968 pBackBuffer4->Restore(); | |
2969 v3 = v2->pBackBuffer4; | |
2970 v4 = v2->pFrontBuffer4; | |
2971 v5.top = 0; | |
2972 v5.bottom = 480; | |
2973 v5.left = 0; | |
2974 v5.right = 640; | |
2975 v3->BltFast(0, 0, v4, &v5, 16u); | |
2976 } | |
2977 } | |
2978 | |
2979 //----- (0049FDBF) -------------------------------------------------------- | |
2980 void Render::CreateZBuffer() | |
2981 { | |
2982 if (!pDefaultZBuffer) | |
2983 { | |
2984 pDefaultZBuffer = pActiveZBuffer = nullptr; | |
2985 pDefaultZBuffer = pActiveZBuffer = (int *)pAllocator->AllocNamedChunk(0, 0x12C000, "Z Buf."); | |
871 | 2986 memset32(pActiveZBuffer, 0xFFFF0000, 0x4B000u); // // inlined Render::ClearActiveZBuffer (mm8::004A085B) |
0 | 2987 } |
2988 } | |
2989 | |
2990 //----- (0049FE05) -------------------------------------------------------- | |
2991 void Render::Release() | |
2992 { | |
2993 Render *v1; // esi@1 | |
2994 RenderD3D *v2; // ecx@1 | |
2995 char v3; // zf@4 | |
2996 void *v4; // ebx@6 | |
2997 IDirectDraw *v5; // eax@10 | |
2998 IDirectDrawSurface2 *v6; // eax@11 | |
2999 IDirectDrawSurface2 *v7; // eax@13 | |
3000 IDirectDrawSurface2 *v8; // eax@15 | |
3001 IDirectDraw2 *v9; // eax@17 | |
3002 IDirectDraw4 *v10; // eax@19 | |
3003 IDirectDrawSurface4 *v11; // eax@20 | |
3004 IDirectDrawSurface4 *v12; // eax@22 | |
3005 IDirectDrawSurface4 *v13; // eax@24 | |
3006 IDirectDraw4 *v14; // eax@26 | |
3007 unsigned __int16 **v15; // ebx@28 | |
3008 void **v16; // esi@29 | |
3009 | |
3010 v1 = this; | |
3011 v2 = this->pRenderD3D; | |
3012 if ( v2 ) | |
3013 { | |
3014 if ( v1->field_40110 ) | |
3015 { | |
3016 pRenderD3D->ClearTarget(1u, 0, 0, 1.0); | |
3017 pRenderD3D->Present(0); | |
3018 pRenderD3D->ClearTarget(1u, 0, 0, 1.0); | |
3019 } | |
3020 v1->pColorKeySurface4 = 0; | |
3021 v1->pBackBuffer4 = 0; | |
3022 v3 = v1->pTargetSurface == 0; | |
3023 v1->pFrontBuffer4 = 0; | |
3024 v1->pDirectDraw4 = 0; | |
3025 if ( !v3 ) | |
3026 { | |
3027 free(v1->ptr_400E8); | |
3028 v1->pTargetSurface = 0; | |
3029 v1->ptr_400E8 = 0; | |
3030 } | |
3031 v4 = v1->pRenderD3D; | |
3032 if ( v4 ) | |
3033 { | |
3034 pRenderD3D->Release(); | |
3035 free(v4); | |
3036 } | |
3037 v1->pRenderD3D = 0; | |
3038 } | |
3039 else | |
3040 { | |
3041 if ( bWinNT4_0 == 1 ) | |
3042 { | |
3043 v5 = (IDirectDraw *)v1->pDirectDraw2; | |
3044 if ( !v5 ) | |
3045 return; | |
3046 v5->SetCooperativeLevel(v1->hWnd, 8u); | |
3047 v1->pDirectDraw2->FlipToGDISurface(); | |
3048 v6 = v1->pSomeSurface2; | |
3049 if ( v6 ) | |
3050 { | |
3051 v6->Release(); | |
3052 v1->pSomeSurface2 = 0; | |
3053 } | |
3054 v7 = v1->pBackBuffer2; | |
3055 if ( v7 ) | |
3056 { | |
3057 v7->Release(); | |
3058 v1->pBackBuffer2 = 0; | |
3059 } | |
3060 v8 = v1->pFrontBuffer2; | |
3061 if ( v8 ) | |
3062 { | |
3063 v8->Release(); | |
3064 v1->pFrontBuffer2 = 0; | |
3065 } | |
3066 v9 = v1->pDirectDraw2; | |
3067 if ( v9 ) | |
3068 { | |
3069 v9->Release(); | |
3070 v1->pDirectDraw2 = 0; | |
3071 } | |
3072 } | |
3073 else | |
3074 { | |
3075 v10 = v1->pDirectDraw4; | |
3076 if ( !v10 ) | |
3077 return; | |
3078 v10->SetCooperativeLevel(v1->hWnd, 1032u); | |
3079 v1->pDirectDraw4->FlipToGDISurface(); | |
3080 v11 = v1->pColorKeySurface4; | |
3081 if ( v11 ) | |
3082 { | |
3083 v11->Release(); | |
3084 v1->pColorKeySurface4 = 0; | |
3085 } | |
3086 v12 = v1->pBackBuffer4; | |
3087 if ( v12 ) | |
3088 { | |
3089 v12->Release(); | |
3090 v1->pBackBuffer4 = 0; | |
3091 } | |
3092 v13 = v1->pFrontBuffer4; | |
3093 if ( v13 ) | |
3094 { | |
3095 v13->Release(); | |
3096 v1->pFrontBuffer4 = 0; | |
3097 } | |
3098 v14 = v1->pDirectDraw4; | |
3099 if ( v14 ) | |
3100 { | |
3101 v14->Release(); | |
3102 v1->pDirectDraw4 = 0; | |
3103 } | |
3104 } | |
3105 v15 = &v1->pTargetSurface; | |
3106 if ( v1->pTargetSurface ) | |
3107 { | |
3108 v16 = (void **)&v1->ptr_400E8; | |
3109 free(*v16); | |
3110 *v15 = 0; | |
3111 *v16 = 0; | |
3112 } | |
3113 } | |
3114 } | |
3115 | |
3116 //----- (0049FFD7) -------------------------------------------------------- | |
3117 void Render::CreateSomeTexture() | |
3118 { | |
3119 pRenderD3D->CreateTexture(64, 64, &pSurface, &pTexture, true, false, 32); | |
3120 } | |
3121 | |
3122 //----- (0049FFFB) -------------------------------------------------------- | |
3123 bool Render::InitializeFullscreen(HWND hWnd) | |
3124 { | |
3125 //Render *v2; // esi@1 | |
3126 //HWND v3; // ebx@1 | |
3127 //void *v4; // eax@2 | |
3128 //RenderD3D *v5; // eax@3 | |
3129 unsigned int v6; // edx@5 | |
3130 RenderD3D__DevInfo *v7; // ecx@5 | |
3131 bool v8; // eax@6 | |
3132 RenderD3D *v9; // ecx@13 | |
3133 unsigned int v10; // eax@13 | |
3134 RenderD3D *v11; // eax@25 | |
3135 HRESULT v12; // eax@25 | |
3136 int v13; // ecx@25 | |
3137 int v14; // eax@27 | |
3138 signed int v15; // ebx@31 | |
3139 bool v16; // eax@35 | |
3140 char v17; // zf@35 | |
3141 IDirectDraw4 *v18; // eax@38 | |
3142 HRESULT v19; // eax@38 | |
3143 int *v20; // eax@39 | |
3144 int *v22; // eax@42 | |
3145 int v23; // ecx@42 | |
3146 D3DDEVICEDESC refCaps; // [sp+Ch] [bp-300h]@25 | |
3147 DDSURFACEDESC2 pDesc; // [sp+108h] [bp-204h]@40 | |
3148 D3DDEVICEDESC halCaps; // [sp+184h] [bp-188h]@25 | |
3149 DDSURFACEDESC2 ddsd2; // [sp+280h] [bp-8Ch]@38 | |
3150 void *v28; // [sp+2FCh] [bp-10h]@2 | |
3151 int v29; // [sp+308h] [bp-4h]@2 | |
3152 | |
3153 //v2 = this; | |
3154 this->field_40110 = 0; | |
3155 this->pColorKeySurface4 = 0; | |
3156 this->pBackBuffer4 = 0; | |
3157 this->pFrontBuffer4 = 0; | |
3158 this->pDirectDraw4 = 0; | |
3159 this->bColorKeySupported = 0; | |
3160 Release(); | |
3161 //v3 = hWnd; | |
3162 this->hWnd = hWnd; | |
3163 CreateZBuffer(); | |
3164 if ( bUserDirect3D ) | |
3165 { | |
3166 pRenderD3D = new RenderD3D; | |
3167 v28 = pRenderD3D; | |
3168 v6 = uDesiredDirect3DDevice; | |
3169 v29 = -1; | |
3170 v7 = pRenderD3D->pAvailableDevices; | |
3171 if ( v7[v6].bIsDeviceCompatible ) | |
3172 { | |
3173 v8 = pRenderD3D->CreateDevice(v6, 0, hWnd); | |
3174 uAcquiredDirect3DDevice = uDesiredDirect3DDevice; | |
3175 } | |
3176 else | |
3177 { | |
3178 if ( v7[1].bIsDeviceCompatible ) | |
3179 { | |
3180 v8 = pRenderD3D->CreateDevice(1u, 0, hWnd); | |
3181 uAcquiredDirect3DDevice = 1; | |
3182 } | |
3183 else | |
3184 { | |
3185 if ( !v7->bIsDeviceCompatible ) | |
1545 | 3186 Error("There aren't any D3D devices to create."); |
3187 | |
0 | 3188 v8 = pRenderD3D->CreateDevice(0, 0, hWnd); |
3189 uAcquiredDirect3DDevice = 0; | |
3190 } | |
3191 } | |
3192 if ( !v8 ) | |
1545 | 3193 Error("D3Drend->Init failed."); |
3194 | |
0 | 3195 v9 = pRenderD3D; |
3196 pBackBuffer4 = v9->pBackBuffer; | |
3197 pFrontBuffer4 = v9->pFrontBuffer; | |
3198 pDirectDraw4 = v9->pHost; | |
3199 v10 = pRenderD3D->GetDeviceCaps(); | |
3200 if ( v10 & 1 ) | |
3201 { | |
3202 if ( pRenderD3D ) | |
3203 { | |
3204 pRenderD3D->Release(); | |
3205 delete pRenderD3D; | |
3206 } | |
3207 pRenderD3D = 0; | |
3208 pBackBuffer4 = 0; | |
3209 pFrontBuffer4 = 0; | |
3210 pDirectDraw4 = 0; | |
1545 | 3211 Error("Direct3D renderer: The device failed to return capabilities."); |
0 | 3212 } |
3213 if ( v10 & 0x3E ) | |
3214 { | |
3215 if ( pRenderD3D ) | |
3216 { | |
3217 pRenderD3D->Release(); | |
3218 delete pRenderD3D; | |
3219 } | |
3220 pColorKeySurface4 = 0; | |
3221 pRenderD3D = 0; | |
3222 pBackBuffer4 = 0; | |
3223 pFrontBuffer4 = 0; | |
3224 pDirectDraw4 = 0; | |
1545 | 3225 Error("Direct3D renderer: The device doesn't support the necessary alpha blending modes."); |
0 | 3226 } |
3227 if ( (v10 & 0x80u) != 0 ) | |
3228 { | |
3229 if ( pRenderD3D ) | |
3230 { | |
3231 pRenderD3D->Release(); | |
3232 delete pRenderD3D; | |
3233 } | |
3234 pRenderD3D = 0; | |
3235 pBackBuffer4 = 0; | |
3236 pFrontBuffer4 = 0; | |
3237 pDirectDraw4 = 0; | |
1545 | 3238 Error("Direct3D renderer: The device doesn't support non-square textures."); |
0 | 3239 } |
3240 LOBYTE(field_10365C) = ~(unsigned __int8)(v10 >> 6) & 1; | |
3241 bRequiredTextureStagesAvailable = CheckTextureStages(); | |
3242 memset(&halCaps, 0, 0xFCu); | |
3243 halCaps.dwSize = 252; | |
3244 memset(&refCaps, 0, 0xFCu); | |
3245 v11 = pRenderD3D; | |
3246 refCaps.dwSize = 252; | |
3247 ErrD3D(v11->pDevice->GetCaps(&halCaps, &refCaps)); | |
3248 v13 = halCaps.dwMinTextureWidth; | |
3249 if ( (unsigned int)halCaps.dwMinTextureWidth >= halCaps.dwMinTextureHeight ) | |
3250 v13 = halCaps.dwMinTextureHeight; | |
3251 v14 = halCaps.dwMaxTextureWidth; | |
3252 uMinDeviceTextureDim = v13; | |
3253 if ( (unsigned int)v14 < halCaps.dwMaxTextureHeight ) | |
3254 v14 = halCaps.dwMaxTextureHeight; | |
3255 uMaxDeviceTextureDim = v14; | |
3256 if ( (unsigned int)v13 < 4 ) | |
3257 uMinDeviceTextureDim = 4; | |
3258 CreateSomeTexture(); | |
3259 v15 = 1; | |
3260 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, true)); | |
3261 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true)); | |
3262 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u)); | |
3263 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SPECULARENABLE, false)); | |
3264 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, false)); | |
3265 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, false)); | |
3266 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); | |
3267 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | |
3268 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | |
3269 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 3u)); | |
3270 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, 2u)); | |
3271 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, 0)); | |
3272 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, 2u)); | |
3273 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | |
3274 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, 0)); | |
3275 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 4u)); | |
3276 } | |
3277 else | |
3278 { | |
3279 CreateDirectDraw(); | |
3280 SetDirectDrawCooperationMode(hWnd, 1); | |
3281 SetDirectDrawDisplayMode(640u, 480u, 16u); | |
3282 CreateDirectDrawPrimarySurface(); | |
3283 v15 = 1; | |
3284 } | |
3285 ddpfPrimareSuface.dwSize = 32; | |
3286 GetTargetPixelFormat(&ddpfPrimareSuface); | |
3287 ParseTargetPixelFormat(); | |
3288 _49EBF1(); | |
3289 if ( pRenderD3D ) | |
3290 { | |
3291 v16 = IsColorKeySupported(pDirectDraw4); | |
3292 v17 = uAcquiredDirect3DDevice == v15; | |
3293 bColorKeySupported = v16; | |
3294 if ( !v17 ) | |
3295 bColorKeySupported = 0; | |
3296 if ( bColorKeySupported ) | |
3297 { | |
3298 memset(&ddsd2, 0, 0x7Cu); | |
3299 ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue = uTargetGMask | uTargetBMask; | |
3300 ddsd2.ddckCKSrcBlt.dwColorSpaceHighValue = ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue; | |
3301 v18 = pDirectDraw4; | |
3302 ddsd2.dwSize = 124; | |
3303 ddsd2.dwFlags = 65543; | |
3304 ddsd2.ddsCaps.dwCaps = 2112; | |
3305 ddsd2.dwWidth = 640; | |
3306 ddsd2.dwHeight = 480; | |
3307 ErrD3D(v18->CreateSurface(&ddsd2, &pColorKeySurface4, 0)); | |
3308 pBeforePresentFunction = Present_ColorKey; | |
3309 } | |
3310 else | |
3311 { | |
3312 pTargetSurface = 0; | |
3313 ptr_400E8 = 0; | |
3314 v20 = (int *)operator new(0x96020u); | |
3315 ptr_400E8 = v20; | |
3316 if ( !v20 | |
3317 || (memset(&pDesc, 0, 0x7Cu), | |
3318 pDesc.dwSize = 124, | |
3319 !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, v15)) ) | |
3320 return 0; | |
3321 pBackBuffer4->Unlock(0); | |
3322 v22 = ptr_400E8 + 4; | |
3323 v23 = (unsigned int)pDesc.lpSurface & 7; | |
3324 LOBYTE(v22) = (unsigned __int8)v22 & 0xF8; | |
3325 uTargetSurfacePitch = 640; | |
3326 pBeforePresentFunction = Present_NoColorKey; | |
3327 v15 = 1; | |
3328 pTargetSurface = (unsigned __int16 *)((char *)v22 + 2 * v23); | |
3329 } | |
3330 field_40110 = v15; | |
3331 } | |
3332 else | |
3333 { | |
3334 pBeforePresentFunction = 0;//nullsub_1; | |
3335 } | |
3336 bWindowMode = 0; | |
3337 pParty->uFlags |= 2u; | |
3338 LODWORD(flt_6BE3A0) = 0x3F0CCCCDu; | |
3339 pViewport->_4C02F8(36044); | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
3340 return v15 != 0; |
0 | 3341 } |
3342 // 6BE3A0: using guessed type float flt_6BE3A0; | |
3343 | |
3344 //----- (004A05F3) -------------------------------------------------------- | |
3345 bool Render::SwitchToWindow(HWND hWnd) | |
3346 { | |
3347 //Render *v2; // esi@1 | |
3348 //void *v3; // eax@2 | |
3349 //RenderD3D *v4; // eax@3 | |
3350 //unsigned int v5; // edx@5 | |
3351 //RenderD3D__DevInfo *v6; // ecx@5 | |
3352 bool v7; // eax@7 | |
3353 //RenderD3D *v8; // ecx@12 | |
3354 unsigned int v9; // eax@12 | |
3355 RenderD3D *v10; // eax@24 | |
3356 HRESULT v11; // eax@24 | |
3357 int v12; // eax@24 | |
3358 int v13; // eax@26 | |
3359 bool v14; // eax@32 | |
3360 char v15; // zf@32 | |
3361 IDirectDraw4 *v16; // eax@35 | |
3362 HRESULT v17; // eax@35 | |
3363 int *v18; // eax@36 | |
3364 int *v19; // edx@38 | |
3365 int v20; // eax@38 | |
3366 unsigned int v21; // ecx@38 | |
3367 int v22; // eax@41 | |
3368 D3DDEVICEDESC refCaps; // [sp+Ch] [bp-300h]@24 | |
3369 DDSURFACEDESC2 pDesc; // [sp+108h] [bp-204h]@37 | |
3370 D3DDEVICEDESC halCaps; // [sp+184h] [bp-188h]@24 | |
3371 DDSURFACEDESC2 ddsd2; // [sp+280h] [bp-8Ch]@35 | |
3372 //RenderD3D *thisa; // [sp+2FCh] [bp-10h]@2 | |
3373 int v29; // [sp+308h] [bp-4h]@2 | |
3374 | |
3375 pParty->uFlags |= 2u; | |
3376 //v2 = this; | |
3377 flt_6BE3A0 = 0.55000001f; | |
3378 pViewport->_4C02F8(36044); | |
3379 field_40110 = 0; | |
3380 Release(); | |
3381 pColorKeySurface4 = 0; | |
3382 pBackBuffer4 = 0; | |
3383 pFrontBuffer4 = 0; | |
3384 pDirectDraw4 = 0; | |
3385 bColorKeySupported = 0; | |
3386 CreateZBuffer(); | |
3387 if ( bUserDirect3D ) | |
3388 { | |
3389 /*v3 = operator new(0x148u); | |
3390 thisa = (RenderD3D *)v3; | |
3391 v29 = 0; | |
3392 if ( v3 ) | |
3393 v4 = RenderD3D::RenderD3D((RenderD3D *)v3); | |
3394 else | |
3395 v4 = 0;*/ | |
3396 pRenderD3D = new RenderD3D; | |
3397 //v4 = pRenderD3D; | |
3398 //v5 = uDesiredDirect3DDevice; | |
3399 v29 = -1; | |
3400 //v6 = pRenderD3D->pAvailableDevices; | |
3401 if (pRenderD3D->pAvailableDevices[uDesiredDirect3DDevice].bIsDeviceCompatible && | |
3402 uDesiredDirect3DDevice != 1 ) | |
3403 { | |
3404 v7 = pRenderD3D->CreateDevice(uDesiredDirect3DDevice, 1, hWnd); | |
3405 uAcquiredDirect3DDevice = uDesiredDirect3DDevice; | |
3406 } | |
3407 else | |
3408 { | |
3409 if ( !pRenderD3D->pAvailableDevices[0].bIsDeviceCompatible ) | |
1545 | 3410 Error("There aren't any D3D devices to init."); |
3411 | |
0 | 3412 v7 = pRenderD3D->CreateDevice(0, 1, hWnd); |
3413 uAcquiredDirect3DDevice = 0; | |
3414 } | |
3415 if ( !v7 ) | |
1545 | 3416 Error("D3Drend->Init failed."); |
0 | 3417 |
3418 //v8 = pRenderD3D; | |
3419 pColorKeySurface4 = 0; | |
3420 pBackBuffer4 = pRenderD3D->pBackBuffer; | |
3421 pFrontBuffer4 = pRenderD3D->pFrontBuffer; | |
3422 pDirectDraw4 = pRenderD3D->pHost; | |
3423 v9 = pRenderD3D->GetDeviceCaps(); | |
3424 if ( v9 & 1 ) | |
3425 { | |
3426 if (pRenderD3D) | |
3427 { | |
3428 pRenderD3D->Release(); | |
3429 delete pRenderD3D; | |
3430 } | |
3431 pRenderD3D = 0; | |
3432 pBackBuffer4 = 0; | |
3433 pFrontBuffer4 = 0; | |
3434 pDirectDraw4 = 0; | |
1545 | 3435 Error("Direct3D renderer: The device failed to return capabilities."); |
0 | 3436 } |
3437 if ( v9 & 0x3E ) | |
3438 { | |
3439 if (pRenderD3D) | |
3440 { | |
3441 pRenderD3D->Release(); | |
3442 delete pRenderD3D; | |
3443 } | |
3444 pColorKeySurface4 = 0; | |
3445 pRenderD3D = 0; | |
3446 pBackBuffer4 = 0; | |
3447 pFrontBuffer4 = 0; | |
3448 pDirectDraw4 = 0; | |
1545 | 3449 Error("Direct3D renderer: The device doesn't support the necessary alpha blending modes."); |
0 | 3450 } |
3451 if ( (v9 & 0x80u) != 0 ) | |
3452 { | |
3453 if (pRenderD3D) | |
3454 { | |
3455 pRenderD3D->Release(); | |
3456 delete pRenderD3D; | |
3457 } | |
3458 pRenderD3D = 0; | |
3459 pBackBuffer4 = 0; | |
3460 pFrontBuffer4 = 0; | |
3461 pDirectDraw4 = 0; | |
1545 | 3462 Error("Direct3D renderer: The device doesn't support non-square textures."); |
0 | 3463 } |
3464 LOBYTE(field_10365C) = ~(unsigned __int8)(v9 >> 6) & 1; | |
3465 bRequiredTextureStagesAvailable = CheckTextureStages(); | |
3466 memset(&halCaps, 0, 0xFCu); | |
3467 halCaps.dwSize = 252; | |
3468 memset(&refCaps, 0, 0xFCu); | |
3469 //v10 = v2->pRenderD3D; | |
3470 refCaps.dwSize = 252; | |
3471 ErrD3D(pRenderD3D->pDevice->GetCaps(&halCaps, &refCaps)); | |
3472 v12 = halCaps.dwMinTextureWidth; | |
3473 if ( (unsigned int)halCaps.dwMinTextureWidth >= halCaps.dwMinTextureHeight ) | |
3474 v12 = halCaps.dwMinTextureHeight; | |
3475 uMinDeviceTextureDim = v12; | |
3476 v13 = halCaps.dwMaxTextureWidth; | |
3477 if ( (unsigned int)halCaps.dwMaxTextureWidth < halCaps.dwMaxTextureHeight ) | |
3478 v13 = halCaps.dwMaxTextureHeight; | |
3479 uMaxDeviceTextureDim = v13; | |
3480 CreateSomeTexture(); | |
3481 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, 1u)); | |
3482 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); | |
3483 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u)); | |
3484 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SPECULARENABLE, 0)); | |
3485 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, 0)); | |
3486 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); | |
3487 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | |
3488 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | |
3489 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 3u)); | |
3490 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, 2u)); | |
3491 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, 0)); | |
3492 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, 2u)); | |
3493 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | |
3494 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, 0)); | |
3495 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 4u)); | |
3496 } | |
3497 else | |
3498 { | |
3499 CreateDirectDraw(); | |
3500 SetDirectDrawCooperationMode(hWnd, 0); | |
3501 field_4004C = 1; | |
3502 CreateFrontBuffer(); | |
3503 CreateClipper(hWnd); | |
3504 CreateBackBuffer(); | |
3505 field_40030 = 0; | |
3506 field_18_locked_pitch = 0; | |
3507 } | |
3508 ddpfPrimareSuface.dwSize = 32; | |
3509 GetTargetPixelFormat(&ddpfPrimareSuface); | |
3510 ParseTargetPixelFormat(); | |
3511 _49EBF1(); | |
3512 if ( !pRenderD3D ) | |
3513 { | |
3514 pBeforePresentFunction = 0;//nullsub_1; | |
3515 goto LABEL_47; | |
3516 } | |
3517 v14 = IsColorKeySupported(pDirectDraw4); | |
3518 v15 = uAcquiredDirect3DDevice == 1; | |
3519 bColorKeySupported = v14; | |
3520 if ( !v15 ) | |
3521 bColorKeySupported = 0; | |
3522 if ( bColorKeySupported ) | |
3523 { | |
3524 memset(&ddsd2, 0, 0x7Cu); | |
3525 ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue = uTargetGMask | uTargetBMask; | |
3526 ddsd2.ddckCKSrcBlt.dwColorSpaceHighValue = ddsd2.ddckCKSrcBlt.dwColorSpaceLowValue; | |
3527 v16 = pDirectDraw4; | |
3528 ddsd2.dwSize = 124; | |
3529 ddsd2.dwFlags = 65543; | |
3530 ddsd2.ddsCaps.dwCaps = 2112; | |
3531 ddsd2.dwWidth = 640; | |
3532 ddsd2.dwHeight = 480; | |
3533 ErrD3D(v16->CreateSurface(&ddsd2, &pColorKeySurface4, 0)); | |
3534 pBeforePresentFunction = Present_ColorKey; | |
3535 LABEL_45: | |
3536 field_40110 = 1; | |
3537 LABEL_47: | |
3538 bWindowMode = 1; | |
3539 hWnd = hWnd; | |
3540 return 0; | |
3541 } | |
3542 pTargetSurface = 0; | |
3543 ptr_400E8 = 0; | |
3544 v18 = (int *)new char[0x96020]; | |
3545 memset(v18, -1, 0x96020); | |
3546 ptr_400E8 = v18; | |
3547 if ( v18 ) | |
3548 { | |
3549 memset(&pDesc, 0, 0x7Cu); | |
3550 pDesc.dwSize = 124; | |
168 | 3551 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, DDLOCK_WAIT) ) |
0 | 3552 { |
3553 pRenderer->pBackBuffer4->Unlock(0); | |
3554 v19 = ptr_400E8; | |
3555 v20 = (unsigned int)pDesc.lpSurface & 7; | |
3556 v21 = (unsigned int)ptr_400E8 & 7; | |
3557 if ( v21 == v20 ) | |
3558 { | |
3559 pTargetSurface = (unsigned __int16 *)v19; | |
3560 } | |
3561 else | |
3562 { | |
3563 if ( (signed int)v21 >= v20 ) | |
3564 v22 = (int)((char *)v19 + 2 * (v21 - v20) + 16); | |
3565 else | |
3566 v22 = (int)((char *)v19 + 2 * (v20 - v21) + 16); | |
3567 pTargetSurface = (unsigned __int16 *)v22; | |
3568 } | |
3569 uTargetSurfacePitch = 640; | |
3570 pBeforePresentFunction = Present_NoColorKey; | |
3571 goto LABEL_45; | |
3572 } | |
3573 } | |
3574 return 0; | |
3575 } | |
3576 | |
3577 //----- (004A0BEE) -------------------------------------------------------- | |
709 | 3578 char Render::RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) |
0 | 3579 { |
3580 int v6; // edi@1 | |
3581 int v7; // edx@5 | |
3582 unsigned int v8; // ebx@5 | |
3583 int v9; // eax@7 | |
3584 unsigned int v10; // ecx@9 | |
3585 unsigned int v11; // esi@13 | |
3586 int v12; // eax@17 | |
3587 int v13; // eax@21 | |
3588 Render *v14; // edi@21 | |
3589 int v15; // eax@25 | |
3590 int v16; // eax@27 | |
3591 signed int v17; // eax@28 | |
3592 signed int v18; // edi@30 | |
3593 signed __int64 v19; // qax@41 | |
3594 int v20; // edi@41 | |
3595 unsigned int v21; // edi@46 | |
3596 int v22; // esi@47 | |
3597 int v23; // ebx@47 | |
3598 signed int v24; // edx@50 | |
3599 signed int v25; // esi@52 | |
3600 unsigned __int16 *v26; // ecx@52 | |
3601 int v27; // ebx@54 | |
3602 int v28; // edi@55 | |
3603 int v29; // edx@55 | |
3604 int v30; // ebx@60 | |
3605 int v31; // edx@61 | |
3606 int v32; // edi@61 | |
3607 int v34; // [sp+Ch] [bp-10h]@3 | |
3608 Render *v35; // [sp+10h] [bp-Ch]@1 | |
3609 __int64 v36; // [sp+14h] [bp-8h]@1 | |
3610 signed int v37; // [sp+18h] [bp-4h]@28 | |
3611 unsigned int uXa; // [sp+24h] [bp+8h]@49 | |
3612 unsigned int uYa; // [sp+28h] [bp+Ch]@28 | |
3613 int uYb; // [sp+28h] [bp+Ch]@47 | |
3614 int uZa; // [sp+2Ch] [bp+10h]@38 | |
3615 | |
3616 v36 = 0i64; | |
709 | 3617 v6 = this->raster_clip_x; |
0 | 3618 v35 = this; |
3619 if ( (signed int)uX < v6 ) | |
3620 HIDWORD(v36) = 8; | |
709 | 3621 v34 = this->raster_clip_z; |
3622 if ( (signed int)uX > this->raster_clip_z ) | |
0 | 3623 HIDWORD(v36) |= 4u; |
709 | 3624 v7 = this->raster_clip_y; |
0 | 3625 v8 = uY; |
3626 if ( (signed int)uY < v7 ) | |
3627 HIDWORD(v36) |= 2u; | |
709 | 3628 v9 = this->raster_clip_w; |
0 | 3629 if ( (signed int)uY > v9 ) |
3630 HIDWORD(v36) |= 1u; | |
3631 v10 = uZ; | |
3632 if ( (signed int)uZ < v6 ) | |
3633 LODWORD(v36) = 8; | |
3634 if ( (signed int)uZ > v34 ) | |
3635 LODWORD(v36) = v36 | 4; | |
3636 v11 = uW; | |
3637 if ( (signed int)uW < v7 ) | |
3638 LODWORD(v36) = v36 | 2; | |
3639 if ( (signed int)uW > v9 ) | |
3640 LODWORD(v36) = v36 | 1; | |
3641 LOBYTE(v12) = v36; | |
3642 if ( (unsigned int)v36 & HIDWORD(v36) ) | |
3643 return v12; | |
3644 if ( !v36 ) | |
3645 { | |
3646 LABEL_46: | |
3647 v21 = pRenderer->uTargetSurfacePitch; | |
3648 if ( pRenderer->uTargetSurfacePitch ) | |
3649 { | |
3650 v12 = uX + v8 * pRenderer->uTargetSurfacePitch; | |
3651 v22 = v11 - v8; | |
3652 v23 = v22; | |
3653 uYb = v22; | |
3654 if ( v22 < 0 ) | |
3655 { | |
3656 v23 = -v22; | |
3657 uYb = -v22; | |
3658 v21 = -pRenderer->uTargetSurfacePitch; | |
3659 } | |
3660 uXa = v10 - uX; | |
3661 if ( (uXa & 0x80000000u) == 0 ) | |
3662 { | |
3663 v24 = 1; | |
3664 } | |
3665 else | |
3666 { | |
3667 uXa = -uXa; | |
3668 v24 = -1; | |
3669 } | |
3670 v25 = 0; | |
3671 v26 = v35->pTargetSurface; | |
3672 if ( v26 ) | |
3673 { | |
3674 if ( (signed int)uXa <= v23 ) | |
3675 { | |
3676 v30 = v23 + 1; | |
3677 if ( v30 > 0 ) | |
3678 { | |
3679 v31 = 2 * v24; | |
3680 v32 = 2 * v21; | |
3681 v12 = (int)&v26[v12]; | |
3682 do | |
3683 { | |
3684 v25 += uXa; | |
3685 *(short *)v12 = uColor; | |
3686 v12 += v32; | |
3687 if ( v25 > 0 ) | |
3688 { | |
3689 v25 -= uYb; | |
3690 v12 += v31; | |
3691 } | |
3692 --v30; | |
3693 } | |
3694 while ( v30 ); | |
3695 } | |
3696 } | |
3697 else | |
3698 { | |
3699 v27 = uXa + 1; | |
3700 if ( (signed int)(uXa + 1) > 0 ) | |
3701 { | |
3702 v28 = 2 * v21; | |
3703 v29 = 2 * v24; | |
3704 v12 = (int)&v26[v12]; | |
3705 do | |
3706 { | |
3707 v25 += uYb; | |
3708 *(short *)v12 = uColor; | |
3709 v12 += v29; | |
3710 if ( v25 > (signed int)uXa ) | |
3711 { | |
3712 v25 -= uXa; | |
3713 v12 += v28; | |
3714 } | |
3715 --v27; | |
3716 } | |
3717 while ( v27 ); | |
3718 } | |
3719 } | |
3720 } | |
3721 } | |
3722 return v12; | |
3723 } | |
3724 if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 ) | |
3725 { | |
3726 if ( BYTE4(v36) & 8 ) | |
3727 { | |
3728 v13 = (signed int)((uW - uY) * (v6 - uX)) / (signed int)(uZ - uX); | |
3729 v14 = v35; | |
3730 v8 = v13 + uY; | |
709 | 3731 uX = v35->raster_clip_x; |
0 | 3732 goto LABEL_24; |
3733 } | |
3734 v10 = v6; | |
3735 v11 = (signed int)((uY - uW) * (v6 - uZ)) / (signed int)(uX - uZ) + uW; | |
3736 } | |
3737 v14 = v35; | |
3738 LABEL_24: | |
3739 if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 ) | |
3740 { | |
709 | 3741 v15 = v14->raster_clip_z; |
0 | 3742 if ( BYTE4(v36) & 4 ) |
3743 { | |
3744 v14 = v35; | |
3745 v8 += (signed int)((v11 - v8) * (v15 - uX)) / (signed int)(v10 - uX); | |
709 | 3746 uX = v35->raster_clip_z; |
0 | 3747 } |
3748 else | |
3749 { | |
3750 v16 = (signed int)((v8 - v11) * (v15 - v10)) / (signed int)(uX - v10); | |
709 | 3751 v10 = v14->raster_clip_z; |
0 | 3752 v11 += v16; |
3753 } | |
3754 } | |
709 | 3755 v17 = v14->raster_clip_y; |
0 | 3756 v37 = 0; |
709 | 3757 uYa = v14->raster_clip_y; |
0 | 3758 if ( (signed int)v8 < v17 ) |
3759 v37 = 2; | |
709 | 3760 v18 = v14->raster_clip_w; |
0 | 3761 if ( (signed int)v8 > v18 ) |
3762 v37 |= 1u; | |
3763 if ( (signed int)v11 >= v17 ) | |
3764 v12 = 0; | |
3765 else | |
3766 v12 = 2; | |
3767 if ( (signed int)v11 > v18 ) | |
3768 LOBYTE(v12) = v12 | 1; | |
3769 if ( !(v12 & v37) ) | |
3770 { | |
3771 v12 ^= v37; | |
3772 uZa = v12; | |
3773 if ( v12 & 2 ) | |
3774 { | |
3775 if ( v37 & 2 ) | |
3776 { | |
3777 uX += (signed int)((v10 - uX) * (uYa - v8)) / (signed int)(v11 - v8); | |
3778 LOBYTE(v12) = (char)v35; | |
709 | 3779 v8 = v35->raster_clip_y; |
0 | 3780 } |
3781 else | |
3782 { | |
3783 v19 = (signed int)((uX - v10) * (uYa - v11)); | |
3784 v20 = v8 - v11; | |
3785 v11 = uYa; | |
3786 v12 = v19 / v20; | |
3787 v10 += v12; | |
3788 } | |
3789 } | |
3790 if ( uZa & 1 ) | |
3791 { | |
3792 if ( v37 & 1 ) | |
3793 { | |
709 | 3794 uX += (signed int)((v10 - uX) * (v35->raster_clip_w - v8)) / (signed int)(v11 - v8); |
0 | 3795 LOBYTE(v12) = (char)v35; |
709 | 3796 v8 = v35->raster_clip_w; |
0 | 3797 } |
3798 else | |
3799 { | |
709 | 3800 v12 = (signed int)((uX - v10) * (v35->raster_clip_w - v11)) / (signed int)(v8 - v11); |
3801 v11 = v35->raster_clip_w; | |
0 | 3802 v10 += v12; |
3803 } | |
3804 } | |
3805 goto LABEL_46; | |
3806 } | |
3807 return v12; | |
3808 } | |
3809 | |
3810 //----- (004A0E80) -------------------------------------------------------- | |
3811 void Render::ClearZBuffer(int a2, int a3) | |
3812 { | |
3813 memset32(this->pActiveZBuffer, -65536, 0x4B000u); | |
3814 } | |
3815 | |
3816 //----- (004A0E97) -------------------------------------------------------- | |
709 | 3817 void Render::SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) |
3818 { | |
3819 this->raster_clip_x = uX; | |
3820 this->raster_clip_y = uY; | |
3821 this->raster_clip_z = uZ; | |
3822 this->raster_clip_w = uW; | |
0 | 3823 } |
3824 | |
3825 //----- (004A0EB6) -------------------------------------------------------- | |
3826 void Render::ParseTargetPixelFormat() | |
3827 { | |
3828 Render *v1; // eax@1 | |
3829 signed int v2; // ecx@1 | |
3830 DWORD uRedMask; // edx@1 | |
3831 unsigned int uGreenMask; // esi@5 | |
3832 signed int v5; // ecx@5 | |
3833 unsigned int uBlueMask; // edx@9 | |
3834 signed int v7; // ecx@9 | |
3835 unsigned int v8; // ecx@13 | |
3836 | |
3837 v1 = this; | |
3838 v2 = 0; | |
3839 uRedMask = v1->ddpfPrimareSuface.dwRBitMask; | |
3840 v1->uTargetBBits = 0; | |
3841 v1->uTargetGBits = 0; | |
3842 v1->uTargetRBits = 0; | |
3843 do | |
3844 { | |
3845 if ( (1 << v2) & uRedMask ) | |
3846 ++v1->uTargetRBits; | |
3847 ++v2; | |
3848 } | |
3849 while ( v2 < 16 ); | |
3850 uGreenMask = v1->ddpfPrimareSuface.dwGBitMask; | |
3851 v5 = 0; | |
3852 do | |
3853 { | |
3854 if ( (1 << v5) & uGreenMask ) | |
3855 ++v1->uTargetGBits; | |
3856 ++v5; | |
3857 } | |
3858 while ( v5 < 16 ); | |
3859 uBlueMask = v1->ddpfPrimareSuface.dwBBitMask; | |
3860 v7 = 0; | |
3861 do | |
3862 { | |
3863 if ( (1 << v7) & uBlueMask ) | |
3864 ++v1->uTargetBBits; | |
3865 ++v7; | |
3866 } | |
3867 while ( v7 < 16 ); | |
3868 v8 = v1->ddpfPrimareSuface.dwRBitMask; | |
3869 v1->uTargetGMask = uGreenMask; | |
3870 v1->uTargetRMask = v8; | |
3871 v1->uTargetBMask = uBlueMask; | |
3872 } | |
3873 | |
3874 //----- (004A0F40) -------------------------------------------------------- | |
3875 bool Render::LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags) | |
3876 { | |
3877 IDirectDrawSurface4 *v4; // esi@1 | |
168 | 3878 HRESULT result; // eax@1 |
0 | 3879 HRESULT v6; // eax@4 |
3880 int v7; // [sp-8h] [bp-14h]@10 | |
3881 unsigned int v8; // [sp-4h] [bp-10h]@10 | |
3882 char v9; // [sp+Bh] [bp-1h]@1 | |
3883 | |
3884 v4 = pSurface; | |
3885 v9 = 1; | |
3886 result = pSurface->Lock(0, pDesc, uLockFlags, 0); | |
3887 if ( result == DDERR_SURFACELOST ) | |
3888 { | |
3889 v6 = v4->Restore(); | |
3890 if ( v6 ) | |
3891 { | |
3892 if ( v6 != DDERR_IMPLICITLYCREATED ) | |
3893 { | |
3894 LABEL_20: | |
3895 v9 = 0; | |
3896 result = (bool)memset(pDesc, 0, 4u); | |
3897 goto LABEL_21; | |
3898 } | |
3899 pRenderer->pFrontBuffer4->Restore(); | |
3900 v4->Restore(); | |
3901 } | |
3902 result = v4->Lock(0, pDesc, DDLOCK_WAIT, 0); | |
3903 if ( result == DDERR_INVALIDRECT || result == DDERR_SURFACEBUSY ) | |
3904 goto LABEL_20; | |
3905 ErrD3D(result); | |
3906 if ( result ) | |
3907 { | |
3908 //v8 = 0; | |
3909 //v7 = 2161; | |
3910 LABEL_19: | |
3911 //CheckHRESULT((CheckHRESULT_stru0 *)&pSurface, result, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp", v7, v8); | |
3912 goto LABEL_20; | |
3913 } | |
3914 if ( pRenderer->pRenderD3D ) | |
3915 pRenderD3D->HandleLostResources(); | |
3916 result = pRenderer->pDirectDraw4->RestoreAllSurfaces(); | |
3917 } | |
3918 else | |
3919 { | |
3920 if ( result ) | |
3921 { | |
3922 if ( result == DDERR_INVALIDRECT || result == DDERR_SURFACEBUSY ) | |
3923 goto LABEL_20; | |
3924 ErrD3D(result); | |
3925 //v8 = 0; | |
3926 //v7 = 2199; | |
3927 //goto LABEL_19; | |
3928 } | |
3929 } | |
3930 LABEL_21: | |
3931 LOBYTE(result) = v9; | |
3932 return result; | |
3933 } | |
3934 | |
3935 //----- (004A1032) -------------------------------------------------------- | |
3936 bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags) | |
3937 { | |
3938 IDirectDrawSurface2 *v4; // esi@1 | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
3939 HRESULT v5; // eax@1 |
0 | 3940 HRESULT v6; // eax@2 |
3941 int v7; // [sp-8h] [bp-10h]@8 | |
3942 unsigned int v8; // [sp-4h] [bp-Ch]@8 | |
3943 | |
3944 v4 = pSurface; | |
3945 v5 = pSurface->Lock( | |
3946 0, | |
3947 pDesc, | |
3948 uLockFlags, | |
3949 0); | |
3950 BYTE3(pSurface) = 1; | |
3951 if ( v5 == DDERR_SURFACELOST ) | |
3952 { | |
3953 v6 = v4->Restore(); | |
3954 if ( !v6 ) | |
3955 goto LABEL_5; | |
3956 if ( v6 == DDERR_IMPLICITLYCREATED ) | |
3957 { | |
3958 pRenderer->pFrontBuffer2->Restore(); | |
3959 v4->Restore(); | |
3960 LABEL_5: | |
3961 v5 = v4->Lock(0, pDesc, 1u, 0) != 0; | |
3962 if ( v5 == DDERR_INVALIDRECT || v5 == DDERR_SURFACEBUSY ) | |
3963 goto LABEL_14; | |
3964 if ( !v5 ) | |
3965 return true; | |
3966 ErrD3D(v5); | |
3967 //v8 = 0; | |
3968 //v7 = 2247; | |
3969 goto LABEL_13; | |
3970 } | |
3971 else | |
3972 { | |
3973 pDesc->dwSize = 0; | |
3974 return false; | |
3975 } | |
3976 } | |
3977 else | |
3978 { | |
3979 if ( !v5 ) | |
3980 return true; | |
3981 if ( v5 != DDERR_INVALIDRECT && v5 != DDERR_SURFACEBUSY ) | |
3982 { | |
3983 //v8 = 0; | |
3984 //v7 = 2269; | |
3985 ErrD3D(v5); | |
3986 pDesc->dwSize = 0; | |
3987 return false; | |
3988 LABEL_13: | |
3989 //CheckHRESULT((CheckHRESULT_stru0 *)&pSurface, v5, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp", v7, v8); | |
3990 goto LABEL_14; | |
3991 } | |
3992 } | |
3993 LABEL_14: | |
3994 return true; | |
3995 } | |
3996 | |
3997 //----- (004A10E4) -------------------------------------------------------- | |
3998 void Render::CreateDirectDraw() | |
3999 { | |
4000 Render *v1; // edi@1 | |
4001 HRESULT v2; // eax@1 | |
4002 HRESULT v3; // eax@5 | |
4003 int v6; // [sp-Ch] [bp-20h]@3 | |
4004 unsigned int v9; // [sp+0h] [bp-14h]@0 | |
4005 IDirectDraw *lpDD; // [sp+10h] [bp-4h]@1 | |
4006 | |
4007 v1 = this; | |
4008 ErrD3D(DirectDrawCreate(0, &lpDD, 0)); | |
4009 | |
4010 pDirectDraw2 = nullptr; | |
4011 pDirectDraw4 = nullptr; | |
4012 | |
4013 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4014 ErrD3D(lpDD->QueryInterface(IID_IDirectDraw4, (void **)&pDirectDraw4)); | |
4015 else | |
4016 ErrD3D(lpDD->QueryInterface(IID_IDirectDraw2, (void **)&pDirectDraw2)); | |
4017 | |
4018 lpDD->Release(); | |
4019 lpDD = nullptr; | |
4020 } | |
4021 | |
4022 //----- (004A1169) -------------------------------------------------------- | |
4023 void Render::SetDirectDrawCooperationMode(HWND hWnd, bool bFullscreen) | |
4024 { | |
4025 DWORD flags; // eax@1 | |
4026 IDirectDraw *v4; // ecx@3 | |
4027 HRESULT v5; // eax@5 | |
4028 int v6; // [sp-8h] [bp-8h]@3 | |
4029 unsigned int v7; // [sp-4h] [bp-4h]@3 | |
4030 | |
4031 flags = bFullscreen ? DDSCL_NORMAL | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : | |
4032 DDSCL_NORMAL; | |
4033 | |
4034 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4035 ErrD3D(pDirectDraw4->SetCooperativeLevel(hWnd, flags | DDSCL_MULTITHREADED)); | |
4036 else | |
4037 ErrD3D(pDirectDraw2->SetCooperativeLevel(hWnd, flags)); | |
4038 } | |
4039 | |
4040 //----- (004A11C6) -------------------------------------------------------- | |
4041 void Render::SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP) | |
4042 { | |
4043 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4044 ErrD3D(pDirectDraw4->SetDisplayMode(uWidth, uHeight, uBPP, 0, 0)); | |
4045 else | |
4046 ErrD3D(pDirectDraw2->SetDisplayMode(uWidth, uHeight, uBPP, 0, 0)); | |
4047 } | |
4048 | |
4049 //----- (004A121C) -------------------------------------------------------- | |
4050 void Render::CreateFrontBuffer() | |
4051 { | |
4052 Render *v1; // esi@1 | |
4053 IDirectDraw *pDD; // eax@3 | |
4054 IDirectDrawSurface **pOutSurf; // esi@3 | |
4055 struct _DDSURFACEDESC *v4; // edx@3 | |
4056 HRESULT v5; // eax@5 | |
4057 int v6; // [sp-8h] [bp-8Ch]@3 | |
4058 unsigned int v7; // [sp-4h] [bp-88h]@3 | |
4059 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3 | |
4060 | |
4061 v1 = this; | |
4062 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4063 { | |
4064 memset(&a2, 0, 0x7Cu); | |
4065 pDD = (IDirectDraw *)v1->pDirectDraw4; | |
4066 a2.dwSize = 124; | |
4067 a2.dwFlags = 1; | |
4068 v7 = 0; | |
4069 a2.ddsCaps.dwCaps = 512; | |
4070 v6 = 2357; | |
4071 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer4; | |
4072 v4 = (struct _DDSURFACEDESC *)&a2; | |
4073 } | |
4074 else | |
4075 { | |
4076 memset(&a2.lPitch, 0, 0x6Cu); // DDSURFACEDESC here | |
4077 pDD = (IDirectDraw *)v1->pDirectDraw2; | |
4078 a2.lPitch = 108; | |
4079 a2.dwBackBufferCount = 1; | |
4080 v7 = 0; | |
4081 a2.dwTextureStage = 512; | |
4082 v6 = 2346; | |
4083 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer2; | |
4084 v4 = (struct _DDSURFACEDESC *)&a2.lPitch; | |
4085 } | |
4086 ErrD3D(pDD->CreateSurface(v4, pOutSurf, 0)); | |
4087 } | |
4088 | |
4089 //----- (004A12CD) -------------------------------------------------------- | |
4090 void Render::CreateBackBuffer() | |
4091 { | |
4092 Render *v1; // esi@1 | |
4093 IDirectDraw *v2; // eax@3 | |
4094 IDirectDrawSurface **ppBackBuffer; // esi@3 | |
4095 struct _DDSURFACEDESC *v4; // edx@3 | |
4096 HRESULT v5; // eax@5 | |
4097 int v6; // [sp-8h] [bp-8Ch]@3 | |
4098 unsigned int v7; // [sp-4h] [bp-88h]@3 | |
4099 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3 | |
4100 | |
4101 v1 = this; | |
4102 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4103 { | |
4104 memset(&a2, 0, 0x7Cu); | |
4105 v2 = (IDirectDraw *)v1->pDirectDraw4; | |
4106 a2.dwSize = 124; | |
4107 a2.dwFlags = 7; | |
4108 v7 = 0; | |
4109 a2.ddsCaps.dwCaps = 2112; | |
4110 a2.dwWidth = 640; | |
4111 a2.dwHeight = 480; | |
4112 v6 = 2387; | |
4113 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4; | |
4114 v4 = (struct _DDSURFACEDESC *)&a2; | |
4115 } | |
4116 else | |
4117 { | |
4118 memset(&a2.lPitch, 0, 0x6Cu); | |
4119 v2 = (IDirectDraw *)v1->pDirectDraw2; | |
4120 a2.lPitch = 108; | |
4121 a2.dwBackBufferCount = 7; | |
4122 v7 = 0; | |
4123 a2.dwTextureStage = 2112; | |
4124 a2.dwAlphaBitDepth = 640; | |
4125 a2.dwMipMapCount = 480; | |
4126 v6 = 2374; | |
4127 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2; | |
4128 v4 = (struct _DDSURFACEDESC *)&a2.lPitch; // //DDSURFACEDESC here fo ddraw2 | |
4129 } | |
4130 ErrD3D(v2->CreateSurface(v4, ppBackBuffer, 0)); | |
4131 } | |
4132 | |
4133 //----- (004A139A) -------------------------------------------------------- | |
4134 void Render::CreateDirectDrawPrimarySurface() | |
4135 { | |
4136 Render *v1; // esi@1 | |
4137 int v2; // ebx@3 | |
4138 IDirectDraw2 *v3; // eax@3 | |
4139 HRESULT v4; // eax@3 | |
4140 IDirectDrawSurface *pFrontBuffer; // eax@3 | |
4141 DDSCAPS2 *v6; // edx@3 | |
4142 IDirectDraw4 *v7; // eax@4 | |
4143 HRESULT v8; // eax@4 | |
4144 int v9; // ST14_4@5 | |
4145 IDirectDrawSurface *v10; // ST10_4@5 | |
4146 HRESULT v11; // eax@5 | |
4147 IDirectDrawSurface **ppBackBuffer; // [sp-4h] [bp-A4h]@3 | |
4148 const char *v13; // [sp+0h] [bp-A0h]@0 | |
4149 int v14; // [sp+4h] [bp-9Ch]@0 | |
4150 unsigned int v15; // [sp+8h] [bp-98h]@0 | |
4151 DDSURFACEDESC2 ddsd2; // [sp+Ch] [bp-94h]@3 | |
4152 DDSCAPS2 v17; // [sp+88h] [bp-18h]@4 | |
4153 int a4; // [sp+98h] [bp-8h]@3 | |
4154 | |
4155 v1 = this; | |
4156 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4157 { | |
4158 v2 = 0; | |
4159 this->field_4004C = 1; | |
4160 memset(&ddsd2, 0, 0x7Cu); | |
4161 v7 = v1->pDirectDraw4; | |
4162 ddsd2.dwBackBufferCount = 1; | |
4163 ddsd2.dwSize = 0x7Cu; | |
4164 ddsd2.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; | |
4165 ddsd2.ddsCaps.dwCaps = DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_3DDEVICE | DDSCAPS_PRIMARYSURFACE; | |
4166 ErrD3D(v7->CreateSurface( | |
4167 &ddsd2, | |
4168 &pFrontBuffer4, | |
4169 0)); | |
4170 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer4; | |
4171 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4; | |
4172 } | |
4173 else | |
4174 { | |
4175 v2 = 0; | |
4176 this->field_4004C = 1; | |
4177 | |
4178 DDSURFACEDESC ddsd; | |
4179 memset(&ddsd, 0, sizeof(DDSURFACEDESC)); | |
4180 | |
4181 ddsd.lpSurface = (LPVOID)1; | |
4182 ddsd.lPitch = 108; | |
4183 ddsd.dwBackBufferCount = 33; | |
4184 ddsd.ddsCaps.dwCaps = 8728; | |
4185 ErrD3D(pDirectDraw2->CreateSurface( | |
4186 &ddsd, | |
4187 (IDirectDrawSurface **)&pFrontBuffer2, | |
4188 0)); | |
4189 | |
4190 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer2; | |
4191 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2; | |
4192 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
4193 __debugbreak(); // warning C4700: uninitialized local variable 'v6' used |
0 | 4194 v9 = (int)v6; |
4195 v10 = pFrontBuffer; // BUG | |
4196 | |
4197 v17.dwCaps = 4; | |
4198 ErrD3D(pFrontBuffer->GetAttachedSurface((DDSCAPS *)&v17, ppBackBuffer));// hr = this->pFrontBuffer->GetAttachedSurface(&ddsCaps2, ppBackBuffer); | |
4199 //CheckHRESULT(&thisa, v11, (const char *)v10, v9, (unsigned int)ppBackBuffer); | |
4200 v1->field_40030 = v2; | |
4201 v1->field_18_locked_pitch = v2; | |
4202 } | |
4203 | |
4204 //----- (004A14F4) -------------------------------------------------------- | |
4205 void Render::CreateClipper(HWND a2) | |
4206 { | |
4207 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4208 { | |
4209 ErrD3D(pDirectDraw4->CreateClipper(0, &pDDrawClipper, 0)); | |
4210 ErrD3D(pDDrawClipper->SetHWnd(0, a2)); | |
4211 ErrD3D(pFrontBuffer4->SetClipper(pDDrawClipper)); | |
4212 } | |
4213 else | |
4214 { | |
4215 ErrD3D(pDirectDraw2->CreateClipper(0, &pDDrawClipper, 0)); | |
4216 ErrD3D(pDDrawClipper->SetHWnd(0, a2)); | |
4217 } | |
4218 } | |
4219 | |
4220 //----- (004A15D8) -------------------------------------------------------- | |
4221 void Render::GetTargetPixelFormat(DDPIXELFORMAT *pOut) | |
4222 { | |
4223 IDirectDrawSurface *v2; // eax@3 | |
4224 | |
4225 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4226 v2 = (IDirectDrawSurface *)this->pFrontBuffer4; | |
4227 else | |
4228 v2 = (IDirectDrawSurface *)this->pFrontBuffer2; | |
4229 v2->GetPixelFormat(pOut); | |
4230 } | |
4231 | |
4232 //----- (004A1605) -------------------------------------------------------- | |
4233 void Render::LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow) | |
4234 { | |
4235 Render *v3; // esi@1 | |
4236 signed int v4; // eax@3 | |
4237 | |
4238 v3 = this; | |
4239 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4240 { | |
4241 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 | |
4242 memset(&pDesc, 0, 0x7Cu); | |
4243 pDesc.dwSize = 124; | |
168 | 4244 LockSurface_DDraw4(v3->pBackBuffer4, &pDesc, DDLOCK_WAIT); |
0 | 4245 *pOutSurfacePtr = pDesc.lpSurface; |
4246 v4 = pDesc.lPitch; | |
4247 } | |
4248 else | |
4249 { | |
4250 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 | |
4251 memset(&pDesc.lPitch, 0, 0x6Cu); | |
4252 pDesc.lPitch = 108; | |
4253 LockSurface_DDraw2(v3->pBackBuffer2, &pDesc, 1u); | |
4254 *pOutSurfacePtr = (void *)pDesc.lpSurface; | |
4255 v4 = pDesc.dwReserved; | |
4256 } | |
4257 *pOutPixelsPerRow = v4 >> 1; | |
4258 } | |
4259 | |
4260 //----- (004A169E) -------------------------------------------------------- | |
4261 bool Render::UsingDirect3D() | |
4262 { | |
4263 return bUserDirect3D == 0; | |
4264 } | |
4265 | |
4266 //----- (004A16E1) -------------------------------------------------------- | |
4267 void Render::UnlockBackBuffer() | |
4268 { | |
4269 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4270 ErrD3D(pBackBuffer4->Unlock(0)); | |
4271 else | |
4272 ErrD3D(pBackBuffer2->Unlock(0)); | |
4273 } | |
4274 | |
4275 //----- (004A172E) -------------------------------------------------------- | |
4276 void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow) | |
4277 { | |
4278 Render *v3; // esi@1 | |
4279 signed int v4; // eax@3 | |
4280 | |
4281 v3 = this; | |
4282 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4283 { | |
4284 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 | |
4285 memset(&pDesc, 0, 0x7Cu); | |
4286 pDesc.dwSize = 124; | |
168 | 4287 LockSurface_DDraw4(v3->pFrontBuffer4, &pDesc, DDLOCK_WAIT); |
0 | 4288 *pOutSurface = pDesc.lpSurface; |
4289 v4 = pDesc.lPitch; | |
4290 } | |
4291 else | |
4292 { | |
4293 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 | |
4294 memset(&pDesc.lPitch, 0, 0x6Cu); | |
4295 pDesc.lPitch = 108; | |
4296 LockSurface_DDraw2(v3->pFrontBuffer2, &pDesc, 1u); | |
4297 *pOutSurface = (void *)pDesc.lpSurface; | |
4298 v4 = pDesc.dwReserved; | |
4299 } | |
4300 *pOutPixelsPerRow = v4 >> 1; | |
4301 } | |
4302 | |
4303 //----- (004A17C7) -------------------------------------------------------- | |
4304 void Render::UnlockFrontBuffer() | |
4305 { | |
4306 IDirectDrawSurface *pFront; // eax@3 | |
4307 HRESULT v2; // eax@5 | |
4308 signed int v3; // [sp-8h] [bp-Ch]@3 | |
4309 int v4; // [sp-4h] [bp-8h]@3 | |
4310 | |
4311 auto a5 = this; | |
4312 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4313 { | |
4314 pFront = (IDirectDrawSurface *)a5->pFrontBuffer4; | |
4315 v4 = 0; | |
4316 v3 = 2615; | |
4317 } | |
4318 else | |
4319 { | |
4320 pFront = (IDirectDrawSurface *)a5->pFrontBuffer2; | |
4321 v4 = 0; | |
4322 v3 = 2611; | |
4323 } | |
4324 ErrD3D(pFront->Unlock(0)); | |
4325 } | |
4326 | |
4327 //----- (004A1814) -------------------------------------------------------- | |
4328 void Render::RestoreFrontBuffer() | |
4329 { | |
4330 IDirectDrawSurface **v1; // esi@2 | |
4331 | |
4332 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT | |
4333 || (v1 = (IDirectDrawSurface **)&this->pFrontBuffer2, pVersion->pVersionInfo.dwMajorVersion >= 5u) ) | |
4334 v1 = (IDirectDrawSurface **)&this->pFrontBuffer4; | |
4335 if ( (*v1)->IsLost() == DDERR_SURFACELOST ) | |
4336 (*v1)->Restore(); | |
4337 } | |
4338 | |
4339 //----- (004A184C) -------------------------------------------------------- | |
4340 HRESULT Render::_4A184C() | |
4341 { | |
4342 IDirectDrawSurface **pBack; // esi@2 | |
4343 HRESULT result; // eax@4 | |
4344 | |
4345 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT | |
4346 || (pBack = (IDirectDrawSurface **)&this->pBackBuffer2, pVersion->pVersionInfo.dwMajorVersion != 4) ) | |
4347 pBack = (IDirectDrawSurface **)&this->pBackBuffer4; | |
4348 result = (*pBack)->IsLost(); | |
4349 if ( result == DDERR_SURFACELOST ) | |
4350 result = (*pBack)->Restore(); | |
4351 return result; | |
4352 } | |
4353 | |
4354 //----- (004A1884) -------------------------------------------------------- | |
4355 void Render::PresentRect(RECT *a2, RECT *a3) | |
4356 { | |
4357 IDirectDrawSurface *pFront; // eax@3 | |
4358 HRESULT v4; // eax@5 | |
4359 IDirectDrawSurface *pBack; // [sp-1Ch] [bp-1Ch]@3 | |
4360 struct tagRECT *v6; // [sp-18h] [bp-18h]@3 | |
4361 DWORD v7; // [sp-14h] [bp-14h]@3 | |
4362 DDBLTFX *v8; // [sp-10h] [bp-10h]@3 | |
4363 const char *v9; // [sp-Ch] [bp-Ch]@3 | |
4364 int v10; // [sp-8h] [bp-8h]@3 | |
4365 unsigned int v11; // [sp-4h] [bp-4h]@3 | |
4366 | |
4367 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4368 { | |
4369 v11 = 0; | |
4370 pFront = (IDirectDrawSurface *)this->pFrontBuffer4; | |
4371 v10 = 2657; | |
4372 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp"; | |
4373 v8 = 0; | |
4374 v7 = DDBLT_WAIT; | |
4375 v6 = a3; | |
4376 pBack = (IDirectDrawSurface *)this->pBackBuffer4; | |
4377 } | |
4378 else | |
4379 { | |
4380 v11 = 0; | |
4381 pFront = (IDirectDrawSurface *)this->pFrontBuffer2; | |
4382 v10 = 2653; | |
4383 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp"; | |
4384 v8 = 0; | |
4385 v7 = DDBLT_WAIT; | |
4386 v6 = a3; | |
4387 pBack = (IDirectDrawSurface *)this->pBackBuffer2; | |
4388 } | |
4389 ErrD3D(pFront->Blt(a2, pBack, v6, v7, v8)); | |
4390 } | |
4391 | |
4392 //----- (004A18F5) -------------------------------------------------------- | |
4393 void Render::BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags) | |
4394 { | |
4395 IDirectDrawSurface *pFront; // eax@3 | |
4396 HRESULT v6; // eax@5 | |
4397 int v7; // [sp-8h] [bp-8h]@3 | |
4398 unsigned int v8; // [sp-4h] [bp-4h]@3 | |
4399 | |
4400 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u ) | |
4401 ErrD3D(pFrontBuffer4->Blt(pDstRect, (IDirectDrawSurface4 *)pSrcSurface, pSrcRect, uBltFlags, nullptr)); | |
4402 else | |
4403 ErrD3D(pFrontBuffer2->Blt(pDstRect, (IDirectDrawSurface2 *)pSrcSurface, pSrcRect, uBltFlags, nullptr)); | |
4404 } | |
4405 | |
4406 //----- (004A194A) -------------------------------------------------------- | |
4407 void Render::BltBackToFontFast(int a2, int a3, RECT *a4) | |
4408 { | |
4409 IDirectDrawSurface *pFront; // eax@3 | |
4410 IDirectDrawSurface *pBack; // [sp-Ch] [bp-Ch]@3 | |
4411 | |
4412 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | |
4413 { | |
4414 pFront = (IDirectDrawSurface *)this->pFrontBuffer4; | |
4415 pBack = (IDirectDrawSurface *)this->pBackBuffer4; | |
4416 } | |
4417 else | |
4418 { | |
4419 pFront = (IDirectDrawSurface *)this->pFrontBuffer2; | |
4420 pBack = (IDirectDrawSurface *)this->pBackBuffer2; | |
4421 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4422 pFront->BltFast(0, 0, pBack, a4, DDBLTFAST_WAIT); |
0 | 4423 } |
4424 | |
4425 //----- (004A1B22) -------------------------------------------------------- | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4426 unsigned int Render::Billboard_ProbablyAddToListAndSortByZOrder(float z) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4427 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4428 //unsigned int v2; // ebx@1 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4429 //double v4; // st7@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4430 //unsigned int v5; // esi@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4431 //int v6; // ecx@5 |
0 | 4432 unsigned int v7; // edx@6 |
4433 char *v8; // ecx@12 | |
4434 void *v9; // edi@16 | |
4435 unsigned int v10; // eax@16 | |
4436 void *v11; // edi@21 | |
4437 unsigned int v12; // eax@21 | |
4438 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4439 //v2 = uNumBillboardsToDraw; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4440 if (uNumBillboardsToDraw >= 999 ) |
0 | 4441 return 0; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4442 if (!uNumBillboardsToDraw) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4443 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4444 uNumBillboardsToDraw = 1; |
0 | 4445 return 0; |
4446 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4447 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4448 //v4 = *(float *)&a1; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4449 //v5 = pRenderer->uNumBillboardsToDraw; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4450 //v6 = 0; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4451 for (int left = 0, right = uNumBillboardsToDraw; left < right; ) // binsearch |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4452 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4453 v7 = left + (right - left) / 2; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4454 if (z <= pRenderer->pBillboardRenderListD3D[v7].z_order) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4455 right = v7; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4456 else |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4457 left = v7 + 1; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4458 } |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4459 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4460 v8 = (char *)&pRenderer->pBillboardRenderListD3D[v7].z_order; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4461 if (z > *(float *)v8 ) |
0 | 4462 { |
4463 if ( v7 == pRenderer->uNumBillboardsToDraw - 1 ) | |
4464 { | |
4465 v7 = pRenderer->uNumBillboardsToDraw; | |
4466 } | |
4467 else | |
4468 { | |
4469 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) | |
4470 { | |
4471 v9 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw]; | |
4472 v10 = pRenderer->uNumBillboardsToDraw - v7; | |
4473 do | |
4474 { | |
4475 memcpy(v9, (char *)v9 - 156, 0x9Cu); | |
4476 v9 = (char *)v9 - 156; | |
4477 --v10; | |
4478 } | |
4479 while ( v10 ); | |
4480 } | |
4481 ++v7; | |
4482 } | |
717 | 4483 //LABEL_23: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4484 uNumBillboardsToDraw++; |
0 | 4485 return v7; |
4486 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
4487 if (z <= *(float *)v8 ) |
0 | 4488 { |
4489 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) | |
4490 { | |
4491 v11 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw]; | |
4492 v12 = pRenderer->uNumBillboardsToDraw - v7; | |
4493 do | |
4494 { | |
4495 memcpy(v11, (char *)v11 - 156, 0x9Cu); | |
4496 v11 = (char *)v11 - 156; | |
4497 --v12; | |
4498 } | |
4499 while ( v12 ); | |
4500 } | |
717 | 4501 //goto LABEL_23; |
4502 uNumBillboardsToDraw++; | |
4503 return v7; | |
0 | 4504 } |
4505 return v7; | |
4506 } | |
4507 | |
4508 //----- (004A1E9D) -------------------------------------------------------- | |
4509 unsigned int Render::GetBillboardDrawListSize() | |
4510 { | |
4511 return pRenderer->uNumBillboardsToDraw; | |
4512 } | |
4513 | |
4514 //----- (004A1EA3) -------------------------------------------------------- | |
4515 unsigned int Render::GetParentBillboardID(unsigned int uBillboardID) | |
4516 { | |
4517 return pRenderer->pBillboardRenderListD3D[uBillboardID].uParentBillboardID; | |
4518 } | |
4519 | |
4520 //----- (004A1EB6) -------------------------------------------------------- | |
4521 void Render::BeginSceneD3D() | |
4522 { | |
4523 if (!uNumD3DSceneBegins++) | |
4524 { | |
4525 if (pRenderD3D) | |
4526 { | |
4527 pRenderD3D->ClearTarget(true, 0x00F08020, true, 1.0); | |
4528 pRenderer->uNumBillboardsToDraw = 0; | |
4529 pRenderD3D->pDevice->BeginScene(); | |
1390 | 4530 |
0 | 4531 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
4532 uFogColor = GetLevelFogColor(); | |
4533 else | |
4534 uFogColor = 0; | |
4535 | |
4536 if ( uFogColor & 0xFF000000 ) | |
4537 { | |
4538 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1); | |
4539 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, uFogColor & 0xFFFFFF); | |
4540 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); | |
4541 bUsingSpecular = true; | |
4542 } | |
4543 else | |
4544 { | |
4545 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0); | |
4546 bUsingSpecular = 0; | |
4547 } | |
4548 } | |
4549 else | |
4550 { | |
4551 LockRenderSurface((void **)&pTargetSurface, &uTargetSurfacePitch); | |
4552 if (pTargetSurface) | |
4553 field_18_locked_pitch = uTargetSurfacePitch; | |
4554 else | |
4555 --uNumD3DSceneBegins; | |
4556 } | |
4557 } | |
4558 } | |
4559 | |
4560 //----- (004A1FE1) -------------------------------------------------------- | |
4561 void Render::DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene() | |
4562 { | |
4563 --uNumD3DSceneBegins; | |
4564 if (uNumD3DSceneBegins) | |
4565 return; | |
4566 | |
4567 if (pRenderD3D) | |
4568 { | |
4569 pGame->draw_debug_outlines(); | |
161 | 4570 DoRenderBillboards_D3D(); |
0 | 4571 pGame->pStru6Instance->RenderSpecialEffects(); |
4572 pRenderD3D->pDevice->EndScene(); | |
4573 } | |
4574 else | |
4575 pGame->pStru6Instance->RenderSpecialEffects(); | |
4576 } | |
4577 | |
4578 //----- (004A2031) -------------------------------------------------------- | |
349 | 4579 unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) |
4580 { | |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4581 // __debugbreak(); // should not fire outside decal builder |
349 | 4582 return ::GetActorTintColor(tint, a4, a2, a5, a6); |
0 | 4583 } |
4584 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4585 /*void Render::DrawTerrainPolygon_new(Polygon *a3, IDirect3DTexture2 *pTexture)//new function |
86 | 4586 { |
4587 int v5; // ebx@1 | |
4588 int v6; // edi@1 | |
4589 int v8; // eax@7 | |
4590 float v9; // eax@12 | |
4591 float *v10; // esi@12 | |
4592 float v11; // ecx@14 | |
4593 double v12; // st7@14 | |
4594 double v13; // st7@14 | |
4595 double v14; // st7@14 | |
4596 signed int v15; // eax@14 | |
4597 int v16; // eax@15 | |
4598 float v17; // ST48_4@15 | |
4599 char v18; // zf@17 | |
4600 int v19; // eax@18 | |
4601 int v20; // eax@18 | |
4602 int v21; // edx@20 | |
4603 signed int v22; // ecx@20 | |
4604 int v23; // eax@20 | |
4605 const char *v24; // ST4C_4@20 | |
4606 unsigned int v25; // ST50_4@20 | |
4607 int v26; // ST54_4@20 | |
4608 int v27; // eax@20 | |
4609 _UNKNOWN *v28; // eax@21 | |
4610 int v29; // ecx@23 | |
4611 int v30; // eax@23 | |
4612 int v31; // eax@23 | |
4613 int v32; // eax@24 | |
4614 int v33; // eax@25 | |
4615 int v34; // eax@25 | |
4616 int v35; // eax@25 | |
4617 int v36; // eax@25 | |
4618 signed int v37; // ecx@26 | |
4619 int v38; // eax@26 | |
4620 _UNKNOWN *v39; // eax@27 | |
4621 int v40; // edx@28 | |
4622 int v41; // eax@29 | |
4623 int v42; // eax@29 | |
4624 int v43; // eax@29 | |
4625 int v44; // eax@29 | |
4626 unsigned int v46; // eax@29 | |
4627 int v47; // eax@30 | |
4628 int v48; // eax@30 | |
4629 int v49; // eax@30 | |
4630 double v52; // st6@35 | |
4631 const char *v55; // [sp+4Ch] [bp-1Ch]@20 | |
4632 int v57; // [sp+5Ch] [bp-Ch]@3 | |
4633 signed int v59; // [sp+60h] [bp-8h]@12 | |
4634 int v61; // [sp+64h] [bp-4h]@4 | |
4635 int i; | |
4636 | |
4637 v6 = (int)this; | |
4638 v5 = 0; | |
4639 if (!this->uNumD3DSceneBegins) | |
4640 return; | |
4641 | |
4642 | |
4643 | |
4644 | |
186 | 4645 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
86 | 4646 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); |
4647 if (this->bUsingSpecular) | |
4648 { | |
186 | 4649 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
4650 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); | |
4651 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | |
86 | 4652 } |
4653 | |
4654 pVertices[0].pos.x = array_50AC10[0].vWorldViewProjX; | |
4655 pVertices[0].pos.y = array_50AC10[0].vWorldViewProjY; | |
4656 pVertices[0].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[0].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); | |
4657 pVertices[0].rhw = 1.0 / (array_50AC10[0].vWorldViewPosition.x + 0.0000001000000011686097); | |
4658 pVertices[0].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); | |
4659 pVertices[0].specular = 0; | |
4660 pVertices[0].texcoord.x = array_50AC10[0].u; | |
4661 pVertices[0].texcoord.y = array_50AC10[0].v; | |
4662 | |
4663 pVertices[1].pos.x = array_50AC10[3].vWorldViewProjX; | |
4664 pVertices[1].pos.y = array_50AC10[3].vWorldViewProjY; | |
4665 pVertices[1].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[3].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); | |
4666 pVertices[1].rhw = 1.0 / (array_50AC10[3].vWorldViewPosition.x + 0.0000001000000011686097); | |
4667 pVertices[1].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[3].vWorldViewPosition.x, 0, 0); | |
4668 pVertices[1].specular = 0; | |
4669 pVertices[1].texcoord.x = array_50AC10[3].u; | |
4670 pVertices[1].texcoord.y = array_50AC10[3].v; | |
4671 | |
4672 pVertices[2].pos.x = array_50AC10[1].vWorldViewProjX; | |
4673 pVertices[2].pos.y = array_50AC10[1].vWorldViewProjY; | |
4674 pVertices[2].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[1].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); | |
4675 pVertices[2].rhw = 1.0 / (array_50AC10[1].vWorldViewPosition.x + 0.0000001000000011686097); | |
4676 pVertices[2].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[1].vWorldViewPosition.x, 0, 0); | |
4677 pVertices[2].specular = 0; | |
4678 pVertices[2].texcoord.x = array_50AC10[1].u; | |
4679 pVertices[2].texcoord.y = array_50AC10[1].v; | |
4680 | |
4681 memcpy(pVertices + 3, pVertices + 2, sizeof(RenderVertexD3D3)); | |
4682 memcpy(pVertices + 4, pVertices + 1, sizeof(RenderVertexD3D3)); | |
4683 | |
4684 pVertices[5].pos.x = array_50AC10[2].vWorldViewProjX; | |
4685 pVertices[5].pos.y = array_50AC10[2].vWorldViewProjY; | |
4686 pVertices[5].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[2].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); | |
4687 pVertices[5].rhw = 1.0 / (array_50AC10[2].vWorldViewPosition.x + 0.0000001000000011686097); | |
4688 pVertices[5].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[2].vWorldViewPosition.x, 0, 0); | |
4689 pVertices[5].specular = 0; | |
4690 pVertices[5].texcoord.x = array_50AC10[2].u; | |
4691 pVertices[5].texcoord.y = array_50AC10[2].v; | |
4692 | |
4693 | |
4694 this->pRenderD3D->pDevice->SetTexture(0, pTexture); | |
4695 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, 6, D3DDP_DONOTLIGHT); | |
4696 | |
186 | 4697 }*/ |
4698 | |
0 | 4699 //----- (004A26BC) -------------------------------------------------------- |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4700 void Render::DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders) |
186 | 4701 { |
4702 //RenderVertexSoft *pVertices; // esi@0 | |
4703 //int v7; // edi@1 | |
0 | 4704 unsigned int v8; // ebx@1 |
4705 LightmapBuilder *v9; // esi@3 | |
4706 unsigned int v10; // edx@3 | |
4707 int v11; // eax@5 | |
4708 int v12; // eax@11 | |
4709 char *v13; // esi@11 | |
4710 double v14; // st7@13 | |
4711 double v15; // st7@13 | |
4712 signed int v16; // eax@13 | |
4713 int v17; // ecx@13 | |
4714 double v18; // st7@13 | |
4715 float v19; // ST78_4@14 | |
4716 int v20; // eax@14 | |
4717 char v21; // zf@16 | |
4718 HRESULT v22; // eax@17 | |
4719 HRESULT v23; // eax@17 | |
4720 HRESULT v24; // eax@19 | |
4721 HRESULT v25; // eax@19 | |
4722 unsigned int v26; // ecx@19 | |
4723 char *v27; // eax@20 | |
4724 HRESULT v28; // eax@22 | |
4725 HRESULT v29; // eax@22 | |
4726 HRESULT v30; // eax@23 | |
4727 HRESULT v31; // eax@24 | |
4728 HRESULT v32; // eax@24 | |
4729 HRESULT v33; // eax@24 | |
4730 HRESULT v34; // eax@24 | |
4731 HRESULT v35; // eax@25 | |
4732 HRESULT v36; // eax@25 | |
4733 unsigned int v37; // ecx@25 | |
4734 char *v38; // eax@26 | |
4735 int v39; // edx@27 | |
4736 HRESULT v40; // eax@28 | |
4737 HRESULT v41; // eax@28 | |
4738 HRESULT v42; // eax@28 | |
4739 HRESULT v43; // eax@28 | |
4740 //IDirect3DDevice3Vtbl *v44; // ebx@28 | |
4741 unsigned int v45; // eax@28 | |
4742 HRESULT v46; // eax@29 | |
4743 HRESULT v47; // eax@29 | |
4744 HRESULT v48; // eax@29 | |
186 | 4745 //IDirect3DDevice3 *v49; // eax@35 |
0 | 4746 //IDirect3DDevice3Vtbl *v50; // ecx@35 |
4747 int v51; // eax@40 | |
4748 char *v52; // esi@40 | |
4749 double v53; // st7@42 | |
4750 double v54; // st7@42 | |
4751 signed int v55; // eax@42 | |
4752 int v56; // ecx@42 | |
4753 double v57; // st7@42 | |
4754 float v58; // ST7C_4@43 | |
4755 int v59; // eax@43 | |
186 | 4756 //signed int v60; // [sp+78h] [bp-14h]@31 |
4757 //RenderVertexSoft *v61; // [sp+7Ch] [bp-10h]@3 | |
0 | 4758 const char *v62; // [sp+80h] [bp-Ch]@0 |
4759 const char *v63; // [sp+80h] [bp-Ch]@19 | |
4760 int v64; // [sp+84h] [bp-8h]@0 | |
4761 LightmapBuilder *v65; // [sp+88h] [bp-4h]@3 | |
4762 unsigned int v66; // [sp+88h] [bp-4h]@40 | |
4763 unsigned int a6a; // [sp+A0h] [bp+14h]@11 | |
186 | 4764 int a7; |
4765 | |
4766 //v7 = (int)this; | |
0 | 4767 v8 = 0; |
186 | 4768 if (!this->uNumD3DSceneBegins) |
75 | 4769 return; |
4770 if ( uNumVertices < 3) | |
4771 return; | |
4772 | |
186 | 4773 //v61 = pVertices; |
4774 | |
75 | 4775 /* v9 = pGame->pLightmapBuilder; |
0 | 4776 v65 = v9; |
75 | 4777 v10 = v9->std__vector_000004_size;*/ |
1394 | 4778 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) |
0 | 4779 { |
638 | 4780 v11 = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); |
1394 | 4781 pGame->pLightmapBuilder->DrawLightmaps(/*v11, 0*/); |
0 | 4782 } |
4783 else | |
4784 { | |
186 | 4785 if (transparent || !pGame->pLightmapBuilder->std__vector_000004_size || |
75 | 4786 byte_4D864C && pGame->uFlags & 2 ) |
4787 { | |
186 | 4788 if (clampAtTextureBorders) |
4789 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP); | |
0 | 4790 else |
186 | 4791 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
4792 | |
4793 if (transparent || this->bUsingSpecular) | |
4794 { | |
4795 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); | |
4796 if (transparent) | |
0 | 4797 { |
186 | 4798 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA); |
4799 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA); | |
4800 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO); | |
4801 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); | |
0 | 4802 } |
4803 else | |
4804 { | |
186 | 4805 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); |
4806 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | |
0 | 4807 } |
186 | 4808 } |
1073 | 4809 |
4810 for (uint i = 0; i < uNumVertices; ++i) | |
4811 { | |
4812 | |
4813 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
4814 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
4815 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); | |
4816 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
4817 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
4818 if ( this->bUsingSpecular ) | |
0 | 4819 { |
1073 | 4820 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 4821 } |
1073 | 4822 else |
4823 { | |
4824 d3d_vertex_buffer[i].specular = 0; | |
4825 } | |
4826 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
4827 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
4828 } | |
4829 | |
4830 this->pRenderD3D->pDevice->SetTexture(0, a5); | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4831 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer, uNumVertices, 16); |
186 | 4832 if (transparent) |
4833 { | |
4834 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
4835 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
4836 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 4837 } |
4838 } | |
4839 else | |
4840 { | |
1073 | 4841 for (uint i = 0; i < uNumVertices; ++i) |
4842 { | |
4843 | |
4844 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
4845 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
4846 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); | |
4847 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
4848 d3d_vertex_buffer[i].diffuse = GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
4849 if ( this->bUsingSpecular ) | |
0 | 4850 { |
1073 | 4851 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
0 | 4852 } |
1073 | 4853 else |
4854 { | |
4855 d3d_vertex_buffer[i].specular = 0; | |
4856 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
4857 __debugbreak(); // warning C4700: uninitialized local variable 'v20' used |
1073 | 4858 d3d_vertex_buffer[i].specular = v20; |
4859 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
4860 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
4861 } | |
186 | 4862 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
4863 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
4864 if (pRenderer->bUsingSpecular) | |
4865 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); | |
0 | 4866 |
4867 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | |
186 | 4868 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
0 | 4869 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4870 d3d_vertex_buffer, |
0 | 4871 uNumVertices, |
4872 16)); | |
4873 //v63 = (const char *)v7->pRenderD3D->pDevice; | |
186 | 4874 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
0 | 4875 //(*(void (**)(void))(*(int *)v63 + 88))(); |
1394 | 4876 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
1073 | 4877 for (uint i = 0; i < uNumVertices; ++i) |
4878 { | |
4879 d3d_vertex_buffer[i].diffuse = -1; | |
4880 } | |
0 | 4881 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); |
186 | 4882 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 4883 if ( !pRenderer->bUsingSpecular ) |
4884 { | |
186 | 4885 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
4886 } | |
4887 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
4888 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
4889 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
4890 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
0 | 4891 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4892 d3d_vertex_buffer, |
0 | 4893 uNumVertices, |
4894 16)); | |
4895 if ( pRenderer->bUsingSpecular ) | |
4896 { | |
186 | 4897 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
0 | 4898 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); |
1073 | 4899 for (uint i = 0; i < uNumVertices; ++i) |
4900 { | |
4901 d3d_vertex_buffer[i].diffuse = pRenderer->uFogColor | d3d_vertex_buffer[i].specular & 0xFF000000; | |
4902 d3d_vertex_buffer[i].specular = 0; | |
4903 } | |
4904 | |
75 | 4905 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem |
186 | 4906 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
4907 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); | |
4908 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
0 | 4909 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4910 d3d_vertex_buffer, |
0 | 4911 uNumVertices, |
4912 16)); | |
186 | 4913 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 4914 //v44 = pRenderer->pRenderD3D->pDevice; |
4915 v45 = GetLevelFogColor(); | |
4916 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, v45 & 0xFFFFFF)); | |
4917 v8 = 0; | |
4918 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
4919 } | |
186 | 4920 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
4921 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
0 | 4922 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v8)); |
4923 } | |
4924 } | |
186 | 4925 |
791 | 4926 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
|
4927 pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); |
0 | 4928 } |
4929 // 4A26BC: could not find valid save-restore pair for esi | |
4930 // 4D864C: using guessed type char byte_4D864C; | |
4931 | |
4932 //----- (004A2DA3) -------------------------------------------------------- | |
1427 | 4933 void Render::DrawSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture) |
852 | 4934 { |
67 | 4935 int v7; // eax@7 |
4936 | |
4937 if ( !this->uNumD3DSceneBegins ) | |
4938 return; | |
4939 if ( uNumVertices >= 3 ) | |
4940 { | |
186 | 4941 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
67 | 4942 if ( this->bUsingSpecular ) |
4943 { | |
186 | 4944 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
4945 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); | |
4946 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | |
67 | 4947 } |
1427 | 4948 for ( uint i = 0; i < uNumVertices; ++i ) |
67 | 4949 { |
4950 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
4951 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
4952 pVertices[i].pos.z = 0.99989998; | |
168 | 4953 pVertices[i].rhw = array_50AC10[i]._rhw; |
67 | 4954 |
840 | 4955 pVertices[i].diffuse = ::GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); |
67 | 4956 v7 = 0; |
4957 if (this->bUsingSpecular) | |
1427 | 4958 v7 = sub_47C3D7_get_fog_related_stuff(0, 1, array_50AC10[i].vWorldViewPosition.x); |
67 | 4959 pVertices[i].specular = v7; |
4960 pVertices[i].texcoord.x = array_50AC10[i].u; | |
4961 pVertices[i].texcoord.y = array_50AC10[i].v; | |
4962 } | |
4963 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture); | |
4964 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
840 | 4965 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); |
0 | 4966 } |
4967 } | |
4968 | |
4969 //----- (004A2ED5) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4970 void Render::_4A2ED5(signed int a2, struct Polygon *a3, IDirect3DTexture2 *pHwTex) |
0 | 4971 { |
4972 signed int v4; // edi@2 | |
4973 int v5; // eax@3 | |
4974 int v6; // edx@5 | |
1072 | 4975 RenderVertexD3D3 *v7; // eax@6 |
4976 RenderVertexSoft *v8; // ecx@6 | |
4977 //double v9; // st6@7 | |
4978 //int v10; // ebx@7 | |
4979 //int v11; // ebx@7 | |
0 | 4980 |
4981 if ( this->uNumD3DSceneBegins ) | |
4982 { | |
4983 v4 = a2; | |
4984 if ( a2 >= 3 ) | |
4985 { | |
186 | 4986 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
638 | 4987 v5 = 31 - (a3->dimming_level & 0x1F); |
4988 if ( v5 < pOutdoor->max_terrain_dimming_level ) | |
4989 v5 = pOutdoor->max_terrain_dimming_level; | |
0 | 4990 v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); |
1072 | 4991 for (uint i = 0; i < a2; ++i) |
4992 { | |
4993 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | |
4994 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
4995 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / array_507D30[i].vWorldViewPosition.y; | |
4996 d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw; | |
4997 d3d_vertex_buffer[i].diffuse = v6; | |
4998 d3d_vertex_buffer[i].specular = 0; | |
4999 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u; | |
5000 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v; | |
5001 } | |
5002 | |
0 | 5003 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
186 | 5004 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
0 | 5005 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5006 d3d_vertex_buffer, |
0 | 5007 a2, |
5008 28)); | |
5009 } | |
5010 } | |
5011 } | |
5012 | |
1390 | 5013 |
5014 //----- (00479A53) -------------------------------------------------------- | |
5015 void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID) | |
5016 { | |
5017 BLVFace *pFace; // esi@1 | |
5018 unsigned int v3; // edi@1 | |
5019 PolygonType v4; // al@1 | |
5020 double v5; // st7@3 | |
5021 signed __int64 v6; // qax@3 | |
5022 PolygonType v7; // cl@3 | |
5023 int v8; // esi@7 | |
5024 int v9; // eax@7 | |
5025 unsigned int v10; // eax@7 | |
5026 double v11; // st6@7 | |
5027 int v12; // edx@7 | |
5028 int v13; // eax@7 | |
5029 char *v14; // esi@8 | |
5030 void *v15; // ecx@9 | |
5031 int v16; // eax@9 | |
5032 int v17; // edi@9 | |
5033 double v18; // st7@9 | |
5034 signed int v19; // ebx@9 | |
5035 void *v20; // ecx@9 | |
5036 int v21; // ebx@11 | |
5037 int v22; // eax@14 | |
5038 signed __int64 v23; // qtt@16 | |
5039 double v24; // st7@16 | |
5040 unsigned __int8 v25; // sf@16 | |
5041 unsigned __int8 v26; // of@16 | |
5042 Render *v27; // ecx@17 | |
5043 double v28; // st7@20 | |
5044 char *v29; // ebx@20 | |
5045 char *v30; // edx@20 | |
5046 unsigned __int8 v31; // c0@21 | |
5047 unsigned __int8 v32; // c3@21 | |
5048 double v33; // st6@23 | |
5049 char *v34; // esi@30 | |
5050 const void *v35; // ecx@31 | |
5051 int v36; // eax@31 | |
5052 const void *v37; // edi@31 | |
5053 signed __int64 v38; // qax@31 | |
5054 int v39; // ecx@31 | |
5055 int v40; // ebx@33 | |
5056 int v41; // eax@36 | |
5057 signed __int64 v42; // qtt@39 | |
5058 int v43; // eax@39 | |
5059 char v44; // zf@39 | |
5060 double v45; // st7@39 | |
5061 double v46; // st7@39 | |
5062 unsigned int v47; // edx@40 | |
5063 double v48; // st7@41 | |
5064 RenderVertexSoft *v49; // ebx@41 | |
5065 void *v50; // edi@43 | |
5066 double v51; // st7@46 | |
5067 RenderVertexSoft *v52; // edx@46 | |
5068 void *v53; // edi@48 | |
5069 char *v54; // ebx@52 | |
5070 unsigned int v55; // eax@53 | |
5071 unsigned int v56; // eax@55 | |
5072 int v57; // ST10_4@55 | |
5073 Texture *v58; // eax@55 | |
5074 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
|
5075 struct Polygon *v60; // [sp+0h] [bp-174h]@17 |
1390 | 5076 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
|
5077 struct Polygon v62; // [sp+14h] [bp-160h]@6 |
1390 | 5078 unsigned int v63; // [sp+120h] [bp-54h]@7 |
5079 double v64; // [sp+124h] [bp-50h]@7 | |
5080 unsigned int v65; // [sp+128h] [bp-4Ch]@1 | |
5081 unsigned int v66; // [sp+12Ch] [bp-48h]@7 | |
5082 float v67; // [sp+130h] [bp-44h]@7 | |
5083 __int64 v68; // [sp+134h] [bp-40h]@3 | |
5084 __int64 v69; // [sp+13Ch] [bp-38h]@3 | |
5085 int v70; // [sp+144h] [bp-30h]@3 | |
5086 int X; // [sp+148h] [bp-2Ch]@9 | |
5087 int v72; // [sp+14Ch] [bp-28h]@7 | |
5088 float v73; // [sp+150h] [bp-24h]@16 | |
5089 unsigned int v74; // [sp+154h] [bp-20h]@3 | |
5090 RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3 | |
5091 float v76; // [sp+15Ch] [bp-18h]@9 | |
5092 int v77; // [sp+160h] [bp-14h]@9 | |
5093 int v78; // [sp+164h] [bp-10h]@7 | |
5094 void *v79; // [sp+168h] [bp-Ch]@9 | |
5095 float v80; // [sp+16Ch] [bp-8h]@3 | |
5096 const void *v81; // [sp+170h] [bp-4h]@7 | |
5097 | |
5098 __debugbreak(); | |
5099 | |
5100 pFace = &pIndoor->pFaces[uFaceID]; | |
5101 v65 = uFaceID; | |
5102 v3 = uNumVertices; | |
5103 v4 = pFace->uPolygonType; | |
5104 if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor ) | |
5105 { | |
5106 if ( (signed int)uNumVertices > 0 ) | |
5107 { | |
5108 v54 = (char *)&array_507D30[0].u; | |
5109 LODWORD(v80) = uNumVertices; | |
5110 do | |
5111 { | |
5112 v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x; | |
5113 *(float *)v54 = (double)v69 + *(float *)v54; | |
5114 *(float *)v54 = *(float *)v54 * 0.25; | |
5115 v55 = GetTickCount(); | |
5116 v54 += 48; | |
5117 v44 = LODWORD(v80)-- == 1; | |
5118 v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5); | |
5119 *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; | |
5120 } | |
5121 while ( !v44 ); | |
5122 uFaceID = v65; | |
5123 } | |
5124 v56 = 8 * uFaceID; | |
5125 LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); | |
5126 v57 = v56; | |
5127 v58 = pFace->GetTexture(); | |
5128 pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); | |
5129 return; | |
5130 } | |
5131 HIDWORD(v69) = pIndoorCamera->sRotationX; | |
5132 HIDWORD(v68) = pIndoorCamera->pos.z; | |
5133 *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; | |
5134 v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z) | |
5135 / (((double)pBLVRenderParams->field_40 + 16192.0) | |
5136 * 65536.0) | |
5137 + *(float *)&v74); | |
5138 v5 = (double)pIndoorCamera->sRotationX * 0.0030664064; | |
5139 *(float *)&v75 = v5; | |
5140 v80 = cos(v5) * 16192.0; | |
5141 v6 = (signed __int64)(*(float *)&v74 | |
5142 - (double)pBLVRenderParams->field_40 | |
5143 / ((v80 + 0.0000001) | |
5144 * 65535.0) | |
5145 * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68))); | |
5146 v7 = pFace->uPolygonType; | |
5147 if ( v7 == 4 || v7 == 3 ) | |
5148 v70 = v6; | |
1544 | 5149 stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); |
1427 | 5150 v62.Create_48607B(&stru_8019C8); |
1390 | 5151 v62.uTileBitmapID = pFace->uBitmapID; |
5152 v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); | |
5153 if ( !v62.pTexture ) | |
5154 return; | |
5155 v8 = pBLVRenderParams->sPartyRotX; | |
5156 v62.dimming_level = 0; | |
5157 v62.uNumVertices = v3; | |
5158 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); | |
5159 v62.v_18.y = 0; | |
5160 v62.v_18.x = -v9; | |
5161 v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); | |
5162 v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; | |
5163 memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); | |
5164 LODWORD(v80) = v10; | |
5165 v62.field_24 = 33554432; | |
5166 v64 = (double)(signed int)v10 * 0.5; | |
5167 v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); | |
5168 LODWORD(v80) = v62.pTexture->uTextureWidth; | |
5169 v11 = 1.0 / (double)SLODWORD(v80); | |
5170 LODWORD(v80) = v62.pTexture->uTextureHeight; | |
5171 v12 = v62.pTexture->uWidthMinus1; | |
5172 v13 = v62.pTexture->uHeightMinus1; | |
5173 v67 = v11; | |
5174 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; | |
5175 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; | |
5176 v78 = 0; | |
5177 v81 = 0; | |
5178 *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80); | |
5179 if ( (signed int)v62.uNumVertices <= 0 ) | |
5180 { | |
5181 LABEL_17: | |
5182 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; | |
5183 v27 = pRenderer; | |
5184 v60 = &v62; | |
5185 v59 = v62.uNumVertices; | |
5186 goto LABEL_18; | |
5187 } | |
5188 v14 = (char *)&array_507D30[0].vWorldViewProjY; | |
5189 while ( 2 ) | |
5190 { | |
5191 v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14)); | |
5192 LODWORD(v80) = v62.ptr_38->field_14; | |
5193 v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; | |
5194 v16 = v77 + v62.ptr_38->field_C; | |
5195 v77 = (int)v15; | |
5196 v74 = v16; | |
5197 LODWORD(v80) = v62.ptr_38->field_20; | |
5198 v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; | |
5199 v79 = v15; | |
5200 v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18); | |
5201 LODWORD(v80) = v62.v_18.z; | |
5202 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16); | |
5203 v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1)); | |
5204 v18 = *(float *)v14 - 1.0; | |
5205 v19 = -v62.field_24; | |
5206 v77 = -v62.field_24; | |
5207 X = (int)((char *)v79 + v62.v_18.x); | |
5208 LODWORD(v76) = (signed __int64)v18; | |
5209 v20 = (void *)(v72 * (v70 - LODWORD(v76))); | |
5210 while ( 1 ) | |
5211 { | |
5212 v79 = v20; | |
5213 if ( !X ) | |
5214 goto LABEL_14; | |
5215 v21 = abs(v19 >> 14); | |
5216 if ( v21 <= abs(X) ) | |
5217 break; | |
5218 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) | |
5219 break; | |
5220 v19 = v77; | |
5221 v20 = v79; | |
5222 LABEL_14: | |
5223 LODWORD(v80) = v62.v_18.z; | |
5224 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16); | |
5225 v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16; | |
5226 --LODWORD(v76); | |
5227 v20 = (char *)v20 + v72; | |
5228 X = v22 + v62.v_18.x; | |
5229 v78 = 1; | |
5230 } | |
5231 if ( !v78 ) | |
5232 { | |
5233 LODWORD(v23) = v77 << 16; | |
5234 HIDWORD(v23) = v77 >> 16; | |
5235 v79 = (void *)(v23 / X); | |
5236 v77 = v17; | |
5237 LODWORD(v80) = v62.ptr_38->field_10; | |
5238 v77 = v17; | |
5239 LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16); | |
5240 LODWORD(v80) = v62.ptr_38->field_1C; | |
5241 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16)); | |
5242 v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; | |
5243 LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; | |
5244 v14 += 48; | |
5245 LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); | |
5246 v81 = (char *)v81 + 1; | |
5247 v24 = (double)SLODWORD(v80) * 0.000015259022; | |
5248 LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); | |
5249 v26 = __OFSUB__((int)v81, v62.uNumVertices); | |
5250 v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0; | |
5251 *((float *)v14 - 10) = v24 * v67; | |
5252 *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1); | |
5253 *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79; | |
5254 if ( !(v25 ^ v26) ) | |
5255 goto LABEL_17; | |
5256 continue; | |
5257 } | |
5258 break; | |
5259 } | |
5260 LODWORD(v73) = 0; | |
5261 v80 = v76; | |
5262 if ( (signed int)v62.uNumVertices > 0 ) | |
5263 { | |
5264 v28 = (double)SLODWORD(v76); | |
5265 LODWORD(v76) = (int)(char *)array_50AC10 + 28; | |
5266 v29 = (char *)&array_50AC10[0].vWorldViewProjX; | |
5267 v30 = (char *)&array_507D30[1].vWorldViewProjY; | |
5268 v79 = array_50AC10; | |
5269 v81 = array_507D30; | |
5270 v78 = v62.uNumVertices; | |
5271 do | |
5272 { | |
5273 v31 = v28 < *((float *)v30 - 12); | |
5274 v32 = v28 == *((float *)v30 - 12); | |
5275 ++LODWORD(v73); | |
5276 memcpy(v79, v81, 0x30u); | |
5277 v79 = (char *)v79 + 48; | |
5278 LODWORD(v76) += 48; | |
5279 v29 += 48; | |
5280 if ( v31 | v32 || v28 >= *(float *)v30 ) | |
5281 { | |
5282 if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 ) | |
5283 goto LABEL_28; | |
5284 v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12)) | |
5285 + *((float *)v30 - 1); | |
5286 } | |
5287 else | |
5288 { | |
5289 v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30) | |
5290 + *((float *)v30 - 13); | |
5291 } | |
5292 *(float *)v29 = v33; | |
5293 v79 = (char *)v79 + 48; | |
5294 v29 += 48; | |
5295 ++LODWORD(v73); | |
5296 *(unsigned int *)LODWORD(v76) = v28; | |
5297 LODWORD(v76) += 48; | |
5298 LABEL_28: | |
5299 v81 = (char *)v81 + 48; | |
5300 v30 += 48; | |
5301 --v78; | |
5302 } | |
5303 while ( v78 ); | |
5304 } | |
5305 if ( SLODWORD(v73) <= 0 ) | |
5306 goto LABEL_40; | |
5307 v34 = (char *)&array_50AC10[0].vWorldViewProjY; | |
5308 v65 = v77 >> 14; | |
5309 HIDWORD(v69) = LODWORD(v73); | |
5310 do | |
5311 { | |
5312 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); | |
5313 v78 = v62.ptr_38->field_14; | |
5314 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); | |
5315 v36 = (int)((char *)v81 + v62.ptr_38->field_C); | |
5316 v81 = v35; | |
5317 v74 = v36; | |
5318 v78 = v62.ptr_38->field_20; | |
5319 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); | |
5320 v78 = (int)v35; | |
5321 v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->field_18); | |
5322 v81 = (const void *)v62.v_18.z; | |
5323 v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16; | |
5324 v37 = (const void *)(v72 | |
5325 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); | |
5326 v38 = (signed __int64)(*(float *)v34 - 1.0); | |
5327 v81 = 0; | |
5328 LODWORD(v76) = v38; | |
5329 v39 = v72 * (v70 - v38); | |
5330 while ( 1 ) | |
5331 { | |
5332 v78 = v39; | |
5333 if ( !X ) | |
5334 goto LABEL_36; | |
5335 v40 = abs(X); | |
5336 if ( abs((signed __int64)v65) <= v40 ) | |
5337 break; | |
5338 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) | |
5339 break; | |
5340 v39 = v78; | |
5341 LABEL_36: | |
5342 v78 = v62.v_18.z; | |
5343 v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; | |
5344 --LODWORD(v76); | |
5345 v39 += v72; | |
5346 X = v41 + v62.v_18.x; | |
5347 v81 = (const void *)1; | |
5348 } | |
5349 if ( v81 ) | |
5350 { | |
5351 v79 = (void *)v62.v_18.z; | |
5352 v78 = 2 * LODWORD(v76); | |
5353 v81 = (const void *)((unsigned __int64)(v62.v_18.z | |
5354 * (signed __int64)(signed int)(signed __int64)(((double)v70 | |
5355 - ((double)(2 * LODWORD(v76)) | |
5356 - *(float *)v34)) | |
5357 * (double)v72)) >> 16); | |
5358 X = (int)((char *)v81 + v62.v_18.x); | |
5359 } | |
5360 LODWORD(v42) = v77 << 16; | |
5361 HIDWORD(v42) = v77 >> 16; | |
5362 v79 = (void *)(v42 / X); | |
5363 v81 = v37; | |
5364 v78 = v62.ptr_38->field_10; | |
5365 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); | |
5366 v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); | |
5367 v74 = (unsigned int)v37; | |
5368 LODWORD(v76) = v43; | |
5369 v78 = v62.ptr_38->field_1C; | |
5370 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); | |
5371 v74 = (unsigned __int64)(v43 * v42 / X) >> 16; | |
5372 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); | |
5373 v34 += 48; | |
5374 v78 = v66 + ((signed int)v74 >> 4); | |
5375 v44 = HIDWORD(v69)-- == 1; | |
5376 v45 = (double)v78 * 0.000015259022; | |
5377 v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); | |
5378 *((float *)v34 - 10) = v45 * v67; | |
5379 *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1); | |
5380 v46 = (double)(signed int)v79; | |
5381 *((float *)v34 - 16) = 0.000015258789 * v46; | |
5382 *((float *)v34 - 11) = 65536.0 / v46; | |
5383 } | |
5384 while ( !v44 ); | |
5385 LABEL_40: | |
5386 v47 = 0; | |
5387 if ( SLODWORD(v73) > 0 ) | |
5388 { | |
5389 v48 = (double)SLODWORD(v80); | |
5390 v75 = array_507D30; | |
5391 v49 = array_50AC10; | |
5392 HIDWORD(v69) = LODWORD(v73); | |
5393 do | |
5394 { | |
5395 if ( v48 >= v49->vWorldViewProjY ) | |
5396 { | |
5397 v50 = v75; | |
5398 ++v47; | |
5399 ++v75; | |
5400 memcpy(v50, v49, 0x30u); | |
5401 } | |
5402 ++v49; | |
5403 --HIDWORD(v69); | |
5404 } | |
5405 while ( HIDWORD(v69) ); | |
5406 } | |
5407 v62.uNumVertices = v47; | |
5408 pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]); | |
5409 *(float *)&v74 = 0.0; | |
5410 if ( SLODWORD(v73) > 0 ) | |
5411 { | |
5412 v51 = (double)SLODWORD(v80); | |
5413 v75 = array_507D30; | |
5414 v52 = array_50AC10; | |
5415 v80 = v73; | |
5416 do | |
5417 { | |
5418 if ( v51 <= v52->vWorldViewProjY ) | |
5419 { | |
5420 v53 = v75; | |
5421 ++v74; | |
5422 ++v75; | |
5423 memcpy(v53, v52, 0x30u); | |
5424 } | |
5425 ++v52; | |
5426 --LODWORD(v80); | |
5427 } | |
5428 while ( v80 != 0.0 ); | |
5429 } | |
5430 v62.uNumVertices = v74; | |
5431 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; | |
5432 v60 = &v62; | |
5433 v59 = v74; | |
5434 v27 = pRenderer; | |
5435 LABEL_18: | |
5436 v27->_4A2ED5(v59, v60, v61); | |
5437 } | |
5438 | |
5439 | |
0 | 5440 //----- (004A2FC0) -------------------------------------------------------- |
5441 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) | |
5442 { | |
5443 //Render *v8; // edi@1 | |
5444 //unsigned int v9; // esi@3 | |
1072 | 5445 RenderVertexSoft *v12; // ecx@9 |
5446 RenderVertexD3D3 *v13; // eax@9 | |
0 | 5447 double v14; // st6@10 |
5448 int v15; // edx@10 | |
5449 Texture *v16; // edx@10 | |
5450 double v17; // st6@10 | |
5451 //char v18; // zf@10 | |
5452 Texture *v19; // edx@10 | |
595 | 5453 //Texture *v23; // edx@16 |
5454 //char *v24; // ecx@16 | |
5455 //char *v25; // eax@16 | |
5456 //double v26; // st6@17 | |
5457 //int v27; // esi@17 | |
5458 //double v28; // st6@17 | |
5459 //unsigned int v33; // ecx@18 | |
5460 //char *v34; // eax@19 | |
0 | 5461 //Texture *v45; // edx@23 |
5462 //char *v46; // ecx@23 | |
5463 //char *v47; // eax@23 | |
5464 //double v48; // st6@24 | |
5465 //int v49; // esi@24 | |
5466 //double v50; // st6@24 | |
5467 const char *v53; // [sp-Ch] [bp-20h]@21 | |
5468 //int v54; // [sp-8h] [bp-1Ch]@21 | |
5469 //unsigned int v55; // [sp-4h] [bp-18h]@21 | |
5470 const char *v56; // [sp+0h] [bp-14h]@0 | |
5471 int v57; // [sp+4h] [bp-10h]@0 | |
5472 unsigned int v58; // [sp+8h] [bp-Ch]@0 | |
5473 //LightmapBuilder *v59; // [sp+Ch] [bp-8h]@3 | |
5474 //int a3a; // [sp+10h] [bp-4h]@4 | |
5475 | |
5476 //v8 = this; | |
5477 if (!uNumD3DSceneBegins || uNumVertices < 3) | |
5478 return; | |
5479 | |
5480 //auto a3 = pFace; | |
5481 //auto a6 = uPackedID; | |
5482 //v59 = pGame->pLightmapBuilder; | |
5483 //v9 = v59->std__vector_000004_size; | |
5484 | |
5485 auto uCorrectedColor = uColor; | |
5486 if (pGame->pLightmapBuilder->std__vector_000004_size) | |
5487 uCorrectedColor = 0xFFFFFFFF; | |
638 | 5488 pGame->AlterGamma_BLV(pFace, &uCorrectedColor); |
0 | 5489 |
792 | 5490 |
5491 if (pFace->uAttributes & FACE_OUTLINED) | |
5492 { | |
5493 int color; | |
5494 if (GetTickCount() % 300 >= 150) | |
5495 uColor = uCorrectedColor = 0xFF20FF20; | |
5496 else uColor = uCorrectedColor = 0xFF109010; | |
5497 } | |
5498 | |
1394 | 5499 if (byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) |
0 | 5500 { |
5501 __debugbreak(); | |
5502 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | |
186 | 5503 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
1072 | 5504 for (uint i = 0; i < uNumVertices; ++i) |
5505 { | |
5506 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | |
5507 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
5508 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | |
5509 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | |
5510 d3d_vertex_buffer[i].diffuse = uCorrectedColor; | |
5511 d3d_vertex_buffer[i].specular = 0; | |
5512 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | |
5513 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | |
5514 } | |
5515 | |
186 | 5516 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 5517 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
5518 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | |
5519 D3DPT_TRIANGLEFAN, | |
5520 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5521 d3d_vertex_buffer, |
0 | 5522 uNumVertices, |
5523 28)); | |
1394 | 5524 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
0 | 5525 } |
5526 else | |
5527 { | |
5528 if (!pGame->pLightmapBuilder->std__vector_000004_size || | |
5529 byte_4D864C && pGame->uFlags & 2) | |
5530 { | |
5531 for (uint i = 0; i < uNumVertices; ++i) | |
5532 { | |
186 | 5533 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; |
5534 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
5535 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | |
5536 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | |
5537 d3d_vertex_buffer[i].diffuse = uCorrectedColor; | |
5538 d3d_vertex_buffer[i].specular = 0; | |
5539 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | |
5540 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | |
5541 } | |
5542 | |
5543 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
0 | 5544 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
5545 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
5546 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5547 d3d_vertex_buffer, |
0 | 5548 uNumVertices, |
5549 28)); | |
5550 } | |
5551 else | |
5552 { | |
595 | 5553 for (uint i = 0; i < uNumVertices; ++i) |
5554 { | |
5555 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | |
5556 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | |
5557 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | |
5558 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | |
5559 d3d_vertex_buffer[i].diffuse = uColor; | |
5560 d3d_vertex_buffer[i].specular = 0; | |
5561 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | |
5562 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | |
5563 } | |
5564 //__debugbreak(); | |
5565 //if ( (signed int)uNumVertices > 0 ) | |
5566 //{ | |
5567 //v23 = pTex; | |
5568 //v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
5569 //v25 = (char *)&d3d_vertex_buffer[0].pos.y; | |
5570 //pTex = (Texture *)uNumVertices; | |
5571 //uint v18; | |
5572 //do | |
5573 //{ | |
5574 //v26 = *(float *)v24 * 0.061758894; | |
5575 //v27 = *((int *)v24 + 3); | |
5576 //*((int *)v25 + 4) = 0; | |
5577 //*((int *)v25 - 1) = v27; | |
5578 //*(int *)v25 = *((int *)v24 + 4); | |
5579 //*((int *)v25 + 3) = uColor; | |
5580 //v25 += 32; | |
5581 //*((float *)v25 - 7) = 1.0 - 1.0 / v26; | |
5582 //v28 = 1.0 / *(float *)v24; | |
5583 //v24 += 48; | |
5584 //v18 = pTex == (Texture *)1; | |
5585 //pTex = (Texture *)((char *)pTex - 1); | |
5586 //*((float *)v25 - 6) = v28; | |
0 | 5587 //a3 = (BLVFace *)v23->uTextureWidth; |
595 | 5588 //*((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth; |
0 | 5589 //a3 = (BLVFace *)v23->uTextureHeight; |
595 | 5590 //*((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; |
5591 //} | |
5592 //while ( !v18 ); | |
5593 //} | |
0 | 5594 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); |
186 | 5595 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
0 | 5596 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
186 | 5597 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
0 | 5598 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5599 d3d_vertex_buffer, |
0 | 5600 uNumVertices, |
5601 28)); | |
595 | 5602 |
5603 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
1394 | 5604 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
595 | 5605 |
5606 for (uint i = 0; i < uNumVertices; ++i) | |
5607 d3d_vertex_buffer[i].diffuse = uCorrectedColor; | |
5608 /*v33 = uNumVertices; | |
0 | 5609 if ( (signed int)uNumVertices > 0 ) |
5610 { | |
186 | 5611 v34 = (char *)&d3d_vertex_buffer[0].diffuse; |
0 | 5612 do |
5613 { | |
5614 *(int *)v34 = uCorrectedColor; | |
5615 v34 += 32; | |
5616 --v33; | |
5617 } | |
5618 while ( v33 ); | |
595 | 5619 }*/ |
0 | 5620 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
186 | 5621 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
5622 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
5623 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
5624 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
5625 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
5626 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
0 | 5627 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
5628 d3d_vertex_buffer, |
0 | 5629 uNumVertices, |
5630 28)); | |
186 | 5631 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
5632 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
5633 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
0 | 5634 } |
5635 } | |
5636 } | |
5637 // 4D864C: using guessed type char byte_4D864C; | |
5638 | |
5639 //----- (004A43B1) -------------------------------------------------------- | |
717 | 5640 void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level) |
5641 { | |
5642 //RenderBillboardTransform_local0 *v4; // ebx@2 | |
5643 //double v5; // st7@2 | |
5644 //float v6; // ST08_4@2 | |
0 | 5645 unsigned int v7; // eax@2 |
717 | 5646 //int v8; // ecx@2 |
5647 //unsigned int v9; // esi@2 | |
5648 //Sprite *v10; // edi@5 | |
0 | 5649 signed int v11; // eax@9 |
5650 signed int v12; // eax@9 | |
717 | 5651 //double v13; // st7@12 |
5652 //double v14; // st6@12 | |
0 | 5653 double v15; // st5@12 |
5654 double v16; // st4@12 | |
5655 double v17; // st3@12 | |
5656 double v18; // st2@12 | |
5657 int v19; // ecx@14 | |
5658 double v20; // st3@14 | |
5659 int v21; // ecx@16 | |
5660 double v22; // st3@16 | |
717 | 5661 //IDirect3DTexture2 *v23; // eax@18 |
5662 //signed int v24; // [sp+18h] [bp-18h]@5 | |
5663 //signed int v25; // [sp+1Ch] [bp-14h]@5 | |
5664 //Render *v26; // [sp+20h] [bp-10h]@1 | |
0 | 5665 float v27; // [sp+24h] [bp-Ch]@5 |
5666 int v28; // [sp+28h] [bp-8h]@2 | |
5667 float v29; // [sp+2Ch] [bp-4h]@5 | |
717 | 5668 //float pSoftBillboarda; // [sp+38h] [bp+8h]@2 |
0 | 5669 float v31; // [sp+3Ch] [bp+Ch]@5 |
717 | 5670 //float v32; // [sp+3Ch] [bp+Ch]@12 |
0 | 5671 float a1; // [sp+40h] [bp+10h]@5 |
5672 | |
717 | 5673 //v26 = this; |
0 | 5674 if ( this->uNumD3DSceneBegins ) |
5675 { | |
717 | 5676 //v4 = pSoftBillboard; |
5677 //v5 = (double)pSoftBillboard->zbuffer_depth; | |
5678 //pSoftBillboarda = pSoftBillboard->zbuffer_depth; | |
5679 //v6 = pSoftBillboard->zbuffer_depth; | |
5680 v7 = Billboard_ProbablyAddToListAndSortByZOrder(pSoftBillboard->zbuffer_depth); | |
5681 //v8 = dimming_level; | |
5682 //v9 = v7; | |
657 | 5683 v28 = dimming_level & 0xFF000000; |
5684 if ( dimming_level & 0xFF000000 ) | |
717 | 5685 pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Opaque_3; |
0 | 5686 else |
717 | 5687 pBillboardRenderListD3D[v7].uOpacity = RenderBillboardD3D::Transparent; |
5688 //v10 = a3; | |
5689 pBillboardRenderListD3D[v7].field_90 = pSoftBillboard->field_44; | |
5690 pBillboardRenderListD3D[v7].sZValue = pSoftBillboard->sZValue; | |
5691 pBillboardRenderListD3D[v7].uParentBillboardID = pSoftBillboard->uParentBillboardID; | |
5692 //v25 = pSoftBillboard->uScreenSpaceX; | |
5693 //v24 = pSoftBillboard->uScreenSpaceY; | |
5694 a1 = (pSoftBillboard->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_x_scaler_packedfloat); | |
5695 v29 = (pSoftBillboard->_screenspace_y_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_y_scaler_packedfloat); | |
5696 v31 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); | |
5697 v27 = (double)(pSprite->uBufferHeight - pSprite->uAreaY); | |
5698 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 5699 v31 = v31 * -1.0; |
717 | 5700 if ( pSoftBillboard->uTintColor && this->bTinting ) |
5701 { | |
5702 v11 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); | |
737 | 5703 v12 = BlendColors(pSoftBillboard->uTintColor, v11); |
0 | 5704 if ( v28 ) |
5705 v12 = (unsigned int)((char *)&array_77EC08[1852].pEdgeList1[17] + 3) & ((unsigned int)v12 >> 1); | |
5706 } | |
5707 else | |
5708 { | |
717 | 5709 v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); |
5710 } | |
5711 //v13 = (double)v25; | |
1390 | 5712 pBillboardRenderListD3D[v7].pQuads[0].specular = 0; |
5713 pBillboardRenderListD3D[v7].pQuads[0].diffuse = v12; | |
5714 pBillboardRenderListD3D[v7].pQuads[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1; | |
717 | 5715 //v14 = (double)v24; |
5716 //v32 = v14; | |
1390 | 5717 pBillboardRenderListD3D[v7].pQuads[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29; |
717 | 5718 v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894); |
1390 | 5719 pBillboardRenderListD3D[v7].pQuads[0].pos.z = v15; |
717 | 5720 v16 = 1.0 / pSoftBillboard->zbuffer_depth; |
1390 | 5721 pBillboardRenderListD3D[v7].pQuads[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth; |
5722 pBillboardRenderListD3D[v7].pQuads[0].texcoord.x = 0.0; | |
5723 pBillboardRenderListD3D[v7].pQuads[0].texcoord.y = 0.0; | |
717 | 5724 v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); |
5725 v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight); | |
5726 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 5727 v17 = v17 * -1.0; |
1390 | 5728 pBillboardRenderListD3D[v7].pQuads[1].specular = 0; |
5729 pBillboardRenderListD3D[v7].pQuads[1].diffuse = v12; | |
5730 pBillboardRenderListD3D[v7].pQuads[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1; | |
5731 pBillboardRenderListD3D[v7].pQuads[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29; | |
5732 pBillboardRenderListD3D[v7].pQuads[1].pos.z = v15; | |
5733 pBillboardRenderListD3D[v7].pQuads[1].rhw = v16; | |
5734 pBillboardRenderListD3D[v7].pQuads[1].texcoord.x = 0.0; | |
5735 pBillboardRenderListD3D[v7].pQuads[1].texcoord.y = 1.0; | |
717 | 5736 v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight; |
5737 v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); | |
5738 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 5739 v20 = v20 * -1.0; |
1390 | 5740 pBillboardRenderListD3D[v7].pQuads[2].specular = 0; |
5741 pBillboardRenderListD3D[v7].pQuads[2].diffuse = v12; | |
5742 pBillboardRenderListD3D[v7].pQuads[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX; | |
5743 pBillboardRenderListD3D[v7].pQuads[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29; | |
5744 pBillboardRenderListD3D[v7].pQuads[2].pos.z = v15; | |
5745 pBillboardRenderListD3D[v7].pQuads[2].rhw = v16; | |
5746 pBillboardRenderListD3D[v7].pQuads[2].texcoord.x = 1.0; | |
5747 pBillboardRenderListD3D[v7].pQuads[2].texcoord.y = 1.0; | |
717 | 5748 v21 = pSprite->uBufferHeight - pSprite->uAreaY; |
5749 v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); | |
5750 if ( pSoftBillboard->uFlags & 4 ) | |
0 | 5751 v22 = v22 * -1.0; |
1390 | 5752 pBillboardRenderListD3D[v7].pQuads[3].specular = 0; |
5753 pBillboardRenderListD3D[v7].pQuads[3].diffuse = v12; | |
5754 pBillboardRenderListD3D[v7].pQuads[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX; | |
5755 pBillboardRenderListD3D[v7].pQuads[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29; | |
5756 pBillboardRenderListD3D[v7].pQuads[3].pos.z = v15; | |
5757 pBillboardRenderListD3D[v7].pQuads[3].rhw = v16; | |
5758 pBillboardRenderListD3D[v7].pQuads[3].texcoord.x = 1.0; | |
5759 pBillboardRenderListD3D[v7].pQuads[3].texcoord.y = 0.0; | |
717 | 5760 //v23 = pSprite->pTexture; |
5761 pBillboardRenderListD3D[v7].uNumVertices = 4; | |
5762 pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth; | |
5763 pBillboardRenderListD3D[v7].pTexture = pSprite->pTexture; | |
0 | 5764 } |
5765 } | |
5766 | |
5767 //----- (004A354F) -------------------------------------------------------- | |
5768 void Render::MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) | |
5769 { | |
743 | 5770 //double v5; // st7@3 |
5771 //float v6; // ST20_4@3 | |
5772 //float v7; // ST00_4@3 | |
0 | 5773 unsigned int v8; // esi@3 |
743 | 5774 //int v9; // eax@3 |
5775 //int v10; // ebx@3 | |
0 | 5776 float v11; // ST28_4@3 |
743 | 5777 //double v12; // st7@3 |
5778 //float v13; // ST24_4@3 | |
5779 //double v14; // st6@3 | |
5780 //float v15; // ST1C_4@3 | |
0 | 5781 float v16; // ST2C_4@3 |
5782 float v17; // ST30_4@3 | |
5783 signed int v18; // ST18_4@3 | |
5784 signed int v19; // ST14_4@3 | |
5785 signed int v20; // ST10_4@3 | |
5786 signed int v21; // eax@3 | |
5787 double v22; // st6@3 | |
5788 float v23; // ST2C_4@3 | |
5789 float v24; // ST30_4@3 | |
5790 signed int v25; // ST10_4@3 | |
5791 signed int v26; // ST14_4@3 | |
5792 signed int v27; // ST18_4@3 | |
5793 signed int v28; // eax@3 | |
5794 double v29; // st6@3 | |
5795 float v30; // ecx@3 | |
5796 float v31; // ST2C_4@3 | |
5797 float v32; // ST30_4@3 | |
5798 signed int v33; // ST10_4@3 | |
5799 signed int v34; // ST14_4@3 | |
5800 signed int v35; // ST18_4@3 | |
5801 signed int v36; // eax@3 | |
5802 float v37; // ecx@3 | |
5803 double v38; // st6@3 | |
5804 float v39; // ST2C_4@3 | |
5805 float v40; // ST30_4@3 | |
5806 signed int v41; // ST10_4@3 | |
5807 signed int v42; // ST14_4@3 | |
5808 signed int v43; // ST18_4@3 | |
5809 signed int v44; // eax@3 | |
5810 double v45; // st6@3 | |
5811 float v46; // eax@3 | |
5812 | |
5813 if ( this->uNumD3DSceneBegins ) | |
5814 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5815 if (a2->zbuffer_depth) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5816 { |
743 | 5817 //v5 = (double)a2->zbuffer_depth; |
5818 //v6 = v5; | |
5819 //v7 = v5; | |
5820 v8 = Billboard_ProbablyAddToListAndSortByZOrder(a2->zbuffer_depth); | |
0 | 5821 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; |
5822 pBillboardRenderListD3D[v8].field_90 = a2->field_44; | |
5823 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; | |
5824 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; | |
743 | 5825 //v9 = a2->uScreenSpaceX; |
5826 //v10 = a2->uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5827 v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); |
743 | 5828 //v12 = (double) a2->uScreenSpaceX; |
5829 //v13 = v12; | |
5830 //v14 = (double)(a2->uScreenSpaceY - 12); | |
5831 //v15 = v14; | |
5832 v16 = (double)( a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; | |
5833 v17 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); | |
323 | 5834 v18 = stru_5C6E00->Cos(angle); |
5835 v19 = stru_5C6E00->Sin(angle); | |
5836 v20 = stru_5C6E00->Sin(angle); | |
5837 v21 = stru_5C6E00->Cos(angle); | |
1390 | 5838 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 |
0 | 5839 + (double)(v18 >> 16)) |
5840 * v16 | |
5841 - ((double)(unsigned __int16)v19 * 0.000015259022 | |
5842 + (double)(v19 >> 16)) | |
5843 * v17) | |
743 | 5844 * v11 + (double) a2->uScreenSpaceX; |
0 | 5845 v22 = (((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v17 |
5846 + ((double)(unsigned __int16)v20 * 0.000015259022 + (double)(v20 >> 16)) * v16 | |
5847 - 12.0) | |
5848 * v11 | |
5849 + (double)a2->uScreenSpaceY; | |
1390 | 5850 pBillboardRenderListD3D[v8].pQuads[0].specular = 0; |
5851 pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; | |
5852 pBillboardRenderListD3D[v8].pQuads[0].pos.y = v22; | |
5853 pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894); | |
5854 pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; | |
5855 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; | |
5856 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; | |
743 | 5857 v31 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; |
5858 v32 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); | |
323 | 5859 v25 = stru_5C6E00->Cos(angle); |
5860 v26 = stru_5C6E00->Sin(angle); | |
5861 v27 = stru_5C6E00->Sin(angle); | |
5862 v28 = stru_5C6E00->Cos(angle); | |
1390 | 5863 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 |
0 | 5864 + (double)(v25 >> 16)) |
740 | 5865 * v31 |
0 | 5866 - ((double)(unsigned __int16)v26 * 0.000015259022 |
5867 + (double)(v26 >> 16)) | |
740 | 5868 * v32) |
743 | 5869 * v11 + (double) a2->uScreenSpaceX; |
740 | 5870 v29 = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v32 |
5871 + ((double)(unsigned __int16)v27 * 0.000015259022 + (double)(v27 >> 16)) * v31 | |
0 | 5872 - 12.0) |
5873 * v11 | |
5874 + (double)a2->uScreenSpaceY; | |
1390 | 5875 pBillboardRenderListD3D[v8].pQuads[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuads[0].pos.z; |
5876 v30 = pBillboardRenderListD3D[v8].pQuads[0].rhw; | |
5877 pBillboardRenderListD3D[v8].pQuads[1].pos.y = v29; | |
5878 pBillboardRenderListD3D[v8].pQuads[1].specular = 0; | |
5879 pBillboardRenderListD3D[v8].pQuads[1].rhw = v30; | |
5880 pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; | |
5881 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; | |
5882 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; | |
743 | 5883 v23 = (double)(a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; |
5884 v24 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); | |
323 | 5885 v33 = stru_5C6E00->Cos(angle); |
5886 v34 = stru_5C6E00->Sin(angle); | |
5887 v35 = stru_5C6E00->Sin(angle); | |
5888 v36 = stru_5C6E00->Cos(angle); | |
1390 | 5889 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 |
0 | 5890 + (double)(v33 >> 16)) |
740 | 5891 * v23 |
0 | 5892 - ((double)(unsigned __int16)v34 * 0.000015259022 |
5893 + (double)(v34 >> 16)) | |
740 | 5894 * v24) |
743 | 5895 * v11 + (double) a2->uScreenSpaceX; |
1390 | 5896 v37 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; |
740 | 5897 v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v24 |
5898 + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v23 | |
0 | 5899 - 12.0) |
5900 * v11 | |
5901 + (double)a2->uScreenSpaceY; | |
1390 | 5902 pBillboardRenderListD3D[v8].pQuads[2].specular = 0; |
5903 pBillboardRenderListD3D[v8].pQuads[2].pos.z = v37; | |
5904 pBillboardRenderListD3D[v8].pQuads[2].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; | |
5905 pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; | |
5906 pBillboardRenderListD3D[v8].pQuads[2].pos.y = v38; | |
5907 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; | |
5908 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; | |
743 | 5909 v39 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; |
5910 v40 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); | |
323 | 5911 v41 = stru_5C6E00->Cos(angle); |
5912 v42 = stru_5C6E00->Sin(angle); | |
5913 v43 = stru_5C6E00->Sin(angle); | |
5914 v44 = stru_5C6E00->Cos(angle); | |
1390 | 5915 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 |
0 | 5916 + (double)(v41 >> 16)) |
5917 * v39 | |
5918 - ((double)(unsigned __int16)v42 * 0.000015259022 | |
5919 + (double)(v42 >> 16)) | |
5920 * v40) | |
743 | 5921 * v11 + (double) a2->uScreenSpaceX; |
0 | 5922 v45 = (((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 |
5923 + ((double)(unsigned __int16)v43 * 0.000015259022 + (double)(v43 >> 16)) * v39 | |
5924 - 12.0) | |
5925 * v11 | |
5926 + (double)a2->uScreenSpaceY; | |
1390 | 5927 v46 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; |
5928 pBillboardRenderListD3D[v8].pQuads[3].specular = 0; | |
5929 pBillboardRenderListD3D[v8].pQuads[3].pos.z = v46; | |
5930 pBillboardRenderListD3D[v8].pQuads[3].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; | |
5931 pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; | |
0 | 5932 pBillboardRenderListD3D[v8].pTexture = a3; |
743 | 5933 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; |
0 | 5934 pBillboardRenderListD3D[v8].uNumVertices = 4; |
1390 | 5935 pBillboardRenderListD3D[v8].pQuads[3].pos.y = v45; |
5936 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; | |
5937 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; | |
0 | 5938 } |
5939 } | |
5940 } | |
5941 | |
5942 //----- (004A3AD9) -------------------------------------------------------- | |
5943 void Render::MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) | |
5944 { | |
5945 double v5; // st7@2 | |
5946 float v6; // ST28_4@2 | |
5947 float v7; // ST00_4@2 | |
5948 unsigned int v8; // esi@2 | |
5949 int v9; // eax@2 | |
5950 int v10; // ebx@2 | |
5951 float v11; // ST34_4@2 | |
5952 double v12; // st7@2 | |
5953 float v13; // ST2C_4@2 | |
5954 double v14; // st6@2 | |
5955 float v15; // ST24_4@2 | |
5956 float v16; // ST38_4@2 | |
5957 float v17; // ST3C_4@2 | |
5958 signed int v18; // ST1C_4@2 | |
5959 int v19; // ST30_4@2 | |
5960 signed int v20; // ST20_4@2 | |
5961 signed int v21; // ST18_4@2 | |
5962 signed int v22; // eax@2 | |
5963 double v23; // st6@2 | |
5964 float v24; // ST20_4@2 | |
5965 float v25; // ST1C_4@2 | |
5966 float v26; // ST38_4@2 | |
5967 float v27; // ST3C_4@2 | |
5968 signed int v28; // ST18_4@2 | |
5969 signed int v29; // ST14_4@2 | |
5970 signed int v30; // ST10_4@2 | |
5971 signed int v31; // eax@2 | |
5972 double v32; // st6@2 | |
5973 float v33; // ST38_4@2 | |
5974 float v34; // ST3C_4@2 | |
5975 signed int v35; // ST10_4@2 | |
5976 signed int v36; // ST14_4@2 | |
5977 signed int v37; // ST18_4@2 | |
5978 signed int v38; // eax@2 | |
5979 double v39; // st6@2 | |
5980 float v40; // ST38_4@2 | |
5981 float v41; // ST3C_4@2 | |
5982 signed int v42; // ST10_4@2 | |
5983 signed int v43; // ST14_4@2 | |
5984 signed int v44; // ST18_4@2 | |
5985 signed int v45; // eax@2 | |
5986 double v46; // st6@2 | |
5987 | |
5988 if ( this->uNumD3DSceneBegins ) | |
5989 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
5990 v5 = (double)a2->zbuffer_depth; |
0 | 5991 v6 = v5; |
5992 v7 = v5; | |
5993 v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); | |
5994 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; | |
5995 pBillboardRenderListD3D[v8].field_90 = a2->field_44; | |
5996 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; | |
5997 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; | |
5998 v9 = a2->uScreenSpaceX; | |
5999 v10 = a2->uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6000 v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); |
0 | 6001 v12 = (double)v9; |
6002 v13 = v12; | |
6003 v14 = (double)(v10 - 12); | |
6004 v15 = v14; | |
6005 v16 = (double)(v9 - 12) - v12; | |
6006 v17 = (double)(v10 - 25) - v14; | |
323 | 6007 v18 = stru_5C6E00->Cos(angle); |
0 | 6008 v19 = angle - stru_5C6E00->uIntegerHalfPi; |
323 | 6009 v20 = stru_5C6E00->Sin(angle); |
6010 v21 = stru_5C6E00->Sin(angle); | |
6011 v22 = stru_5C6E00->Cos(angle); | |
1390 | 6012 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 |
0 | 6013 + (double)(v18 >> 16)) |
6014 * v16 | |
6015 - ((double)(unsigned __int16)v20 * 0.000015259022 | |
6016 + (double)(v20 >> 16)) | |
6017 * v17) | |
6018 * v11 + v13; | |
6019 v23 = (((double)(unsigned __int16)v22 * 0.000015259022 + (double)(v22 >> 16)) * v17 | |
6020 + ((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v16 | |
6021 - 12.0) | |
6022 * v11 | |
6023 + (double)a2->uScreenSpaceY; | |
1390 | 6024 pBillboardRenderListD3D[v8].pQuads[0].specular = 0; |
6025 pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; | |
6026 pBillboardRenderListD3D[v8].pQuads[0].pos.y = v23; | |
0 | 6027 v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); |
1390 | 6028 pBillboardRenderListD3D[v8].pQuads[0].pos.z = v24; |
0 | 6029 v25 = 1.0 / v6; |
1390 | 6030 pBillboardRenderListD3D[v8].pQuads[0].rhw = v25; |
6031 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; | |
6032 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; | |
0 | 6033 v26 = (double)(a2->uScreenSpaceX - 12) - v13; |
6034 v27 = (double)a2->uScreenSpaceY - v15; | |
323 | 6035 v28 = stru_5C6E00->Cos(angle); |
6036 v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6037 v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6038 v31 = stru_5C6E00->Cos(angle); | |
1390 | 6039 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 |
0 | 6040 + (double)(v28 >> 16)) |
6041 * v26 | |
6042 - ((double)(unsigned __int16)v29 * 0.000015259022 | |
6043 + (double)(v29 >> 16)) | |
6044 * v27) | |
6045 * v11 + v13; | |
6046 v32 = (((double)(unsigned __int16)v31 * 0.000015259022 + (double)(v31 >> 16)) * v27 | |
6047 + ((double)(unsigned __int16)v30 * 0.000015259022 + (double)(v30 >> 16)) * v26 | |
6048 - 12.0) | |
6049 * v11 | |
6050 + (double)a2->uScreenSpaceY; | |
1390 | 6051 pBillboardRenderListD3D[v8].pQuads[1].pos.z = v24; |
6052 pBillboardRenderListD3D[v8].pQuads[1].pos.y = v32; | |
6053 pBillboardRenderListD3D[v8].pQuads[1].specular = 0; | |
6054 pBillboardRenderListD3D[v8].pQuads[1].rhw = v25; | |
6055 pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; | |
6056 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; | |
6057 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; | |
0 | 6058 v33 = (double)(a2->uScreenSpaceX + 12) - v13; |
6059 v34 = (double)a2->uScreenSpaceY - v15; | |
323 | 6060 v35 = stru_5C6E00->Cos(angle); |
6061 v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6062 v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6063 v38 = stru_5C6E00->Cos(angle); | |
1390 | 6064 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 |
0 | 6065 + (double)(v35 >> 16)) |
6066 * v33 | |
6067 - ((double)(unsigned __int16)v36 * 0.000015259022 | |
6068 + (double)(v36 >> 16)) | |
6069 * v34) | |
6070 * v11 + v13; | |
6071 v39 = (((double)(unsigned __int16)v38 * 0.000015259022 + (double)(v38 >> 16)) * v34 | |
6072 + ((double)(unsigned __int16)v37 * 0.000015259022 + (double)(v37 >> 16)) * v33 | |
6073 - 12.0) | |
6074 * v11 | |
6075 + (double)a2->uScreenSpaceY; | |
1390 | 6076 pBillboardRenderListD3D[v8].pQuads[2].specular = 0; |
6077 pBillboardRenderListD3D[v8].pQuads[2].pos.z = v24; | |
6078 pBillboardRenderListD3D[v8].pQuads[2].rhw = v25; | |
6079 pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; | |
6080 pBillboardRenderListD3D[v8].pQuads[2].pos.y = v39; | |
6081 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; | |
6082 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; | |
0 | 6083 v40 = (double)(a2->uScreenSpaceX + 12) - v13; |
6084 v41 = (double)(a2->uScreenSpaceY - 25) - v15; | |
323 | 6085 v42 = stru_5C6E00->Cos(angle); |
6086 v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6087 v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); | |
6088 v45 = stru_5C6E00->Cos(angle); | |
1390 | 6089 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 |
0 | 6090 + (double)(v42 >> 16)) |
6091 * v40 | |
6092 - ((double)(unsigned __int16)v43 * 0.000015259022 | |
6093 + (double)(v43 >> 16)) | |
6094 * v41) | |
6095 * v11 + v13; | |
6096 v46 = (((double)(unsigned __int16)v45 * 0.000015259022 + (double)(v45 >> 16)) * v41 | |
6097 + ((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 | |
6098 - 12.0) | |
6099 * v11 | |
6100 + (double)a2->uScreenSpaceY; | |
1390 | 6101 pBillboardRenderListD3D[v8].pQuads[3].specular = 0; |
6102 pBillboardRenderListD3D[v8].pQuads[3].pos.z = v24; | |
6103 pBillboardRenderListD3D[v8].pQuads[3].rhw = v25; | |
6104 pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; | |
0 | 6105 pBillboardRenderListD3D[v8].pTexture = a3; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6106 pBillboardRenderListD3D[v8].z_order = v6; |
0 | 6107 pBillboardRenderListD3D[v8].uNumVertices = 4; |
1390 | 6108 pBillboardRenderListD3D[v8].pQuads[3].pos.y = v46; |
6109 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; | |
6110 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; | |
0 | 6111 } |
6112 } | |
6113 | |
6114 //----- (004A4023) -------------------------------------------------------- | |
657 | 6115 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
|
6116 { |
0 | 6117 unsigned int v8; // esi@2 |
6118 double v14; // st6@14 | |
6119 double v15; // st5@14 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6120 //unsigned int v16; // ecx@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6121 //double v17; // st7@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6122 //double v18; // st5@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6123 //double v19; // st4@16 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6124 //double v20; // st5@18 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6125 //double v21; // st4@18 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6126 //signed int v23; // [sp+18h] [bp-18h]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6127 //signed int v24; // [sp+1Ch] [bp-14h]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6128 //float v26; // [sp+20h] [bp-10h]@5 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6129 //float v27; // [sp+20h] [bp-10h]@12 |
0 | 6130 float v29; // [sp+28h] [bp-8h]@5 |
6131 float v30; // [sp+2Ch] [bp-4h]@5 | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6132 //float pSpritea; // [sp+3Ch] [bp+Ch]@5 |
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 if (!uNumD3DSceneBegins) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6135 return; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6136 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6137 v8 = Billboard_ProbablyAddToListAndSortByZOrder(a2->zbuffer_depth); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6138 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6139 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
|
6140 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
|
6141 |
657 | 6142 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
|
6143 if (a2->uTintColor & 0x00FFFFFF && bTinting) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6144 { |
737 | 6145 diffuse = BlendColors(a2->uTintColor, diffuse); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6146 if (a2->uTintColor & 0xFF000000) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6147 diffuse = 0x007F7F7F & ((unsigned int)diffuse >> 1); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6148 } |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6149 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6150 unsigned int specular = 0; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6151 if (bUsingSpecular) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6152 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
|
6153 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6154 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6155 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6156 if (a2->uFlags & 4) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6157 v14 *= -1.0; |
1390 | 6158 pBillboardRenderListD3D[v8].pQuads[0].diffuse = diffuse; |
6159 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30; | |
6160 pBillboardRenderListD3D[v8].pQuads[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
6161 pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
6162 pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; | |
6163 pBillboardRenderListD3D[v8].pQuads[0].specular = specular; | |
6164 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; | |
6165 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6166 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6167 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6168 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6169 if ( a2->uFlags & 4 ) |
0 | 6170 v14 = v14 * -1.0; |
1390 | 6171 pBillboardRenderListD3D[v8].pQuads[1].specular = specular; |
6172 pBillboardRenderListD3D[v8].pQuads[1].diffuse = diffuse; | |
6173 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30; | |
6174 pBillboardRenderListD3D[v8].pQuads[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
6175 pBillboardRenderListD3D[v8].pQuads[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
6176 pBillboardRenderListD3D[v8].pQuads[1].rhw = 1.0 / a2->zbuffer_depth; | |
6177 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; | |
6178 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6179 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6180 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
|
6181 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6182 if ( a2->uFlags & 4 ) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6183 v14 *= -1.0; |
1390 | 6184 pBillboardRenderListD3D[v8].pQuads[2].diffuse = diffuse; |
6185 pBillboardRenderListD3D[v8].pQuads[2].specular = specular; | |
6186 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30; | |
6187 pBillboardRenderListD3D[v8].pQuads[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
6188 pBillboardRenderListD3D[v8].pQuads[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
6189 pBillboardRenderListD3D[v8].pQuads[2].rhw = 1.0 / a2->zbuffer_depth; | |
6190 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; | |
6191 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6192 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6193 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
|
6194 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6195 if ( a2->uFlags & 4 ) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6196 v14 *= -1.0; |
1390 | 6197 pBillboardRenderListD3D[v8].pQuads[3].diffuse = diffuse; |
6198 pBillboardRenderListD3D[v8].pQuads[3].specular = specular; | |
6199 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30; | |
6200 pBillboardRenderListD3D[v8].pQuads[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29; | |
6201 pBillboardRenderListD3D[v8].pQuads[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
6202 pBillboardRenderListD3D[v8].pQuads[3].rhw = 1.0 / a2->zbuffer_depth; | |
6203 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; | |
6204 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6205 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6206 pBillboardRenderListD3D[v8].uNumVertices = 4; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6207 pBillboardRenderListD3D[v8].pTexture = pSprite->pTexture; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6208 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6209 pBillboardRenderListD3D[v8].field_90 = a2->field_44; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6210 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6211 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6212 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6213 if (a2->uTintColor & 0xFF000000) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6214 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6215 else |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6216 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Transparent; |
0 | 6217 } |
6218 | |
6219 //----- (004A48E4) -------------------------------------------------------- | |
6220 int Render::MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6) | |
6221 { | |
6222 int v6; // ecx@1 | |
6223 int v7; // ebx@1 | |
6224 int v8; // ecx@1 | |
6225 int v9; // edx@1 | |
6226 int v10; // edi@1 | |
6227 unsigned int x; // esi@1 | |
6228 int result; // eax@8 | |
6229 int v13; // [sp+Ch] [bp-10h]@1 | |
6230 int v14; // [sp+10h] [bp-Ch]@1 | |
6231 int v15; // [sp+14h] [bp-8h]@1 | |
6232 int v16; // [sp+18h] [bp-4h]@1 | |
6233 int v17; // [sp+24h] [bp+8h]@1 | |
6234 unsigned int v18; // [sp+28h] [bp+Ch]@1 | |
6235 int v19; // [sp+34h] [bp+18h]@1 | |
6236 | |
6237 v6 = screenSpaceX; | |
6238 v7 = (a6 >> 1) + screenSpaceY; | |
6239 v17 = 0; | |
6240 v15 = 0; | |
6241 v8 = (a6 >> 1) + v6; | |
6242 v14 = (a6 >> 1) * (a6 >> 1); | |
6243 v9 = 2 * (a6 >> 1); | |
6244 v10 = (a6 >> 1) * ((a6 >> 1) - 1); | |
6245 x = v8 - (a6 >> 1); | |
6246 v16 = (a6 >> 1) + screenSpaceY - v8; | |
6247 v19 = a6 >> 1; | |
6248 v13 = v9; | |
6249 v18 = v8; | |
6250 do | |
6251 { | |
6252 sr_4A46E6_draw_particle_segment(x, v16 + v18, z, 2 * v19, lightColor); | |
6253 if ( v15 ) | |
6254 sr_4A46E6_draw_particle_segment(x, v17 + v7, z, 2 * v19, lightColor); | |
6255 v14 -= v15; | |
6256 if ( v14 <= v10 ) | |
6257 { | |
6258 if ( v19 != v17 ) | |
6259 { | |
6260 sr_4A46E6_draw_particle_segment(v18, v16 + x, z, 2 * v17, lightColor); | |
6261 sr_4A46E6_draw_particle_segment(v18, v19 + v7, z, 2 * v17, lightColor); | |
6262 } | |
6263 --v19; | |
6264 v13 -= 2; | |
6265 ++x; | |
6266 v10 -= v13; | |
6267 } | |
6268 result = v17++; | |
6269 v15 += 2; | |
6270 --v18; | |
6271 } | |
6272 while ( result < v19 ); | |
6273 return result; | |
6274 } | |
6275 | |
6276 //----- (004A49D0) -------------------------------------------------------- | |
6277 void Render::DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9) | |
6278 { | |
1159 | 6279 int absXDifference; // eax@1 |
6280 int absYDifference; // eax@1 | |
6281 unsigned int smallerabsdiff; // ebx@1 | |
6282 unsigned int largerabsdiff; | |
0 | 6283 double v16; // st7@7 |
6284 double v17; // st7@7 | |
6285 double v18; // st6@7 | |
6286 double v20; // st4@8 | |
6287 double v21; // st4@10 | |
6288 double v22; // st4@10 | |
6289 double v23; // st4@10 | |
6290 double v25; // st4@11 | |
6291 double v26; // st4@13 | |
6292 double v28; // st4@13 | |
6293 RenderVertexD3D3 v29[4]; // [sp+0h] [bp-94h]@7 | |
1159 | 6294 int xDifference; // [sp+88h] [bp-Ch]@1 |
0 | 6295 signed int v32; // [sp+8Ch] [bp-8h]@1 |
1159 | 6296 int yDifference; // [sp+90h] [bp-4h]@1 |
6297 | |
6298 xDifference = bankersRounding(dstX - srcX); | |
6299 yDifference = bankersRounding(dstY - srcY); | |
6300 absYDifference = abs(yDifference); | |
6301 absXDifference = abs(xDifference); | |
6302 smallerabsdiff = min(absXDifference, absYDifference); | |
6303 largerabsdiff = max(absXDifference, absYDifference); | |
6304 v32 = (11 * smallerabsdiff >> 5) + largerabsdiff; | |
0 | 6305 v16 = 1.0 / (double)v32; |
1159 | 6306 v17 = (double)yDifference * v16 * a4; |
6307 v18 = (double)xDifference * v16 * a4; | |
6308 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
6309 { | |
6310 v20 = a3 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
6311 v25 = a7 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
6312 } | |
6313 else | |
6314 { | |
6315 v20 = a3 * 0.061758894; | |
6316 v25 = a7 * 0.061758894; | |
6317 } | |
6318 v21 = 1.0 / a3; | |
6319 v22 = (double)yDifference * v16 * a8; | |
6320 v23 = (double)xDifference * v16 * a8; | |
6321 v26 = 1.0 - 1.0 / v25; | |
6322 v28 = 1.0 / a7; | |
0 | 6323 v29[0].pos.x = srcX + v17; |
6324 v29[0].pos.y = srcY - v18; | |
1159 | 6325 v29[0].pos.z = 1.0 - 1.0 / v20; |
6326 v29[0].rhw = v21; | |
0 | 6327 v29[0].diffuse = -1; |
6328 v29[0].specular = 0; | |
6329 v29[0].texcoord.x = 1.0; | |
6330 v29[0].texcoord.y = 0.0; | |
1159 | 6331 |
0 | 6332 v29[1].pos.x = v22 + dstX; |
6333 v29[1].pos.y = dstY - v23; | |
1159 | 6334 v29[1].pos.z = v26; |
6335 v29[1].rhw = v28; | |
0 | 6336 v29[1].diffuse = -16711936; |
6337 v29[1].specular = 0; | |
6338 v29[1].texcoord.x = 1.0; | |
6339 v29[1].texcoord.y = 1.0; | |
1159 | 6340 |
6341 v29[2].pos.x = dstX - v22; | |
6342 v29[2].pos.y = v23 + dstY; | |
6343 v29[2].pos.z = v26; | |
0 | 6344 v29[2].rhw = v28; |
1159 | 6345 v29[2].diffuse = -1; |
6346 v29[2].specular = 0; | |
0 | 6347 v29[2].texcoord.x = 0.0; |
6348 v29[2].texcoord.y = 1.0; | |
1159 | 6349 |
0 | 6350 v29[3].pos.x = srcX - v17; |
6351 v29[3].pos.y = v18 + srcY; | |
1159 | 6352 v29[3].pos.z = v29[0].pos.z; |
6353 v29[3].rhw = v21; | |
6354 v29[3].diffuse = -1; | |
6355 v29[3].specular = 0; | |
0 | 6356 v29[3].texcoord.x = 0.0; |
6357 v29[3].texcoord.y = 0.0; | |
186 | 6358 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
6359 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
6360 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | |
6361 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | |
6362 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | |
6363 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
0 | 6364 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, a9)); |
6365 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive( | |
6366 D3DPT_TRIANGLEFAN, | |
6367 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
6368 v29, | |
6369 4, | |
6370 24)); | |
186 | 6371 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
6372 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
6373 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
6374 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
6375 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
6376 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); | |
0 | 6377 } |
6378 | |
6379 //----- (004A4CC9) -------------------------------------------------------- | |
1390 | 6380 void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse) |
6381 { | |
0 | 6382 unsigned int v5; // eax@7 |
6383 char *v7; // edx@8 | |
6384 double v10; // st6@9 | |
6385 double v11; // st6@10 | |
6386 int v12; // ebx@13 | |
1390 | 6387 |
6388 if (a1->uNumVertices < 3) | |
6389 return; | |
6390 | |
6391 float depth = 1000000.0; | |
6392 for (uint i = 0; i < a1->uNumVertices; ++i) | |
6393 { | |
6394 if (a1->field_104[i].z < depth) | |
6395 depth = a1->field_104[i * 4].z; | |
6396 } | |
6397 | |
6398 v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth); | |
6399 pBillboardRenderListD3D[v5].field_90 = 0; | |
6400 pBillboardRenderListD3D[v5].uParentBillboardID = -1; | |
6401 pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; | |
6402 pBillboardRenderListD3D[v5].pTexture = 0; | |
6403 pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices; | |
6404 pBillboardRenderListD3D[v5].z_order = depth; | |
6405 | |
6406 for (uint i = 0; i < a1->uNumVertices; ++i) | |
6407 { | |
6408 pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x; | |
6409 pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y; | |
6410 | |
6411 v10 = a1->field_104[i].z; | |
6412 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6413 v11 = v10 * 0.061758894; | |
6414 else | |
6415 v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
6416 pBillboardRenderListD3D[v5].pQuads[i].pos.z = 1.0 - 1.0 / v11; | |
6417 pBillboardRenderListD3D[v5].pQuads[i].rhw = 1.0 / a1->field_104[i].z; | |
6418 | |
6419 if (diffuse & 0xFF000000) | |
6420 v12 = a1->field_104[i].diffuse; | |
6421 else | |
6422 v12 = diffuse; | |
6423 pBillboardRenderListD3D[v5].pQuads[i].diffuse = v12; | |
6424 pBillboardRenderListD3D[v5].pQuads[i].specular = 0; | |
6425 | |
6426 pBillboardRenderListD3D[v5].pQuads[i].texcoord.x = 0.0; | |
6427 pBillboardRenderListD3D[v5].pQuads[i].texcoord.y = 0.0; | |
0 | 6428 } |
6429 } | |
6430 | |
6431 //----- (004A4DE1) -------------------------------------------------------- | |
6432 bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture) | |
6433 { | |
6434 HRESULT v12; // eax@14 | |
6435 unsigned __int16 *v13; // ecx@19 | |
6436 unsigned __int16 *v14; // eax@19 | |
6437 DWORD v15; // edx@20 | |
6438 HRESULT v16; // eax@23 | |
6439 stru350 Dst; // [sp+Ch] [bp-F8h]@12 | |
6440 | |
6441 auto pHWLTexture = pD3DBitmaps.LoadTexture(pName, bMipMaps); | |
6442 if ( pHWLTexture ) | |
6443 { | |
6444 bMipMaps = !strncmp(pName, "HDWTR", 5); | |
6445 if ( !pRenderD3D->CreateTexture( | |
6446 pHWLTexture->uWidth, | |
6447 pHWLTexture->uHeight, | |
6448 pOutSurface, | |
6449 pOutTexture, | |
6450 true, | |
6451 bMipMaps, | |
6452 uMinDeviceTextureDim) ) | |
1545 | 6453 Error("HiScreen16::LoadTexture - D3Drend->CreateTexture() failed: %x", 0); |
0 | 6454 //v10 = *pOutSurface; |
6455 //v11 = 0; | |
6456 if ( bMipMaps ) | |
6457 { | |
6458 Dst._450DDE(); | |
6459 //v20 = 0; | |
6460 Dst._450DF1(&stru_4EFCBC, &stru_4EFCBC); | |
6461 | |
6462 IDirectDrawSurface4 *pNextSurf = *pOutSurface; | |
6463 while ( 1 ) | |
6464 { | |
6465 DDSCAPS2 v19; | |
6466 memset(&v19, 0, sizeof(DDSCAPS2)); | |
6467 v19.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; | |
6468 | |
6469 DDSURFACEDESC2 desc; | |
6470 memset(&desc, 0, sizeof(DDSURFACEDESC2)); | |
6471 desc.dwSize = sizeof(DDSURFACEDESC2); | |
6472 | |
168 | 6473 if ( LockSurface_DDraw4(pNextSurf, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
0 | 6474 { |
6475 Dst.sub_451007_scale_image_bicubic( | |
6476 pHWLTexture->pPixels, | |
6477 pHWLTexture->uWidth, | |
6478 pHWLTexture->uHeight, | |
6479 pHWLTexture->uWidth, | |
6480 (unsigned short *)desc.lpSurface, | |
6481 desc.dwWidth, | |
6482 desc.dwHeight, | |
6483 desc.lPitch >> 1, | |
6484 0, | |
6485 0); | |
6486 ErrD3D(pNextSurf->Unlock(0)); | |
6487 //bMipMaps = 0x4D86ACu; | |
6488 } | |
6489 if (FAILED(pNextSurf->GetAttachedSurface(&v19, &pNextSurf))) | |
6490 break; | |
6491 //v10 = (IDirectDrawSurface4 *)pName; | |
6492 //v11 = 0; | |
6493 } | |
6494 //v20 = -1; | |
6495 //nullsub_1(); | |
6496 } | |
6497 else | |
6498 { | |
6499 DDSCAPS2 v19; | |
6500 memset(&v19, 0, sizeof(DDSCAPS2)); | |
6501 v19.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; | |
6502 | |
6503 DDSURFACEDESC2 desc; | |
6504 memset(&desc, 0, sizeof(DDSURFACEDESC2)); | |
6505 desc.dwSize = sizeof(DDSURFACEDESC2); | |
6506 | |
168 | 6507 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
0 | 6508 { |
6509 bMipMaps = 0; | |
6510 v13 = pHWLTexture->pPixels; | |
6511 v14 = (unsigned __int16 *)desc.lpSurface; | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6512 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
|
6513 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6514 for (v15 = 0; v15 < desc.dwWidth; v15++) |
0 | 6515 { |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6516 *v14 = *v13; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6517 ++v14; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6518 ++v13; |
0 | 6519 } |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6520 v14 += (desc.lPitch >> 1) - desc.dwWidth; |
0 | 6521 } |
6522 ErrD3D((*pOutSurface)->Unlock(0)); | |
6523 } | |
6524 } | |
6525 delete [] pHWLTexture->pPixels; | |
6526 delete pHWLTexture; | |
6527 return true; | |
6528 } | |
6529 return false; | |
6530 } | |
6531 | |
6532 //----- (004A5048) -------------------------------------------------------- | |
670 | 6533 bool Render::MoveSpriteToDevice( Sprite *pSprite ) |
6534 { | |
6535 | |
6536 HWLTexture *sprite_texture; // eax@1 | |
0 | 6537 unsigned __int16 *v9; // edx@5 |
6538 LPVOID v10; // eax@5 | |
6539 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 | |
6540 | |
670 | 6541 sprite_texture = pD3DSprites.LoadTexture(pSprite->pName, pSprite->uPaletteID); |
6542 if ( sprite_texture ) | |
6543 { | |
6544 _gpu_memory_used += 2 * sprite_texture->uWidth * sprite_texture->uHeight; | |
6545 pSprite->uAreaX = sprite_texture->uAreaX; | |
6546 pSprite->uAreaY = sprite_texture->uAreaY; | |
6547 pSprite->uBufferWidth = sprite_texture->uBufferWidth; | |
6548 pSprite->uBufferHeight = sprite_texture->uBufferHeight; | |
6549 pSprite->uAreaWidth = sprite_texture->uAreaWidth; | |
6550 pSprite->uAreaHeight = sprite_texture->uAreaHeigth; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6551 //v6 = v3->uMinDeviceTextureDim; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
6552 //v7 = v3->pRenderD3D; |
670 | 6553 if (!pRenderD3D->CreateTexture(sprite_texture->uWidth, sprite_texture->uHeight, &pSprite->pTextureSurface, &pSprite->pTexture, 1u, 0, uMinDeviceTextureDim)) |
1545 | 6554 Error("HiScreen16::LoadTexture - D3Drend->CreateTexture() failed: %x", 0); |
0 | 6555 //pSprite = v2->pTextureSurface; |
6556 //pSprite = (Sprite *)pSprite->pName; | |
6557 //v8 = pSprite; | |
670 | 6558 memset(&Dst, 0, sizeof(DDSURFACEDESC2)); |
0 | 6559 Dst.dwSize = 124; |
670 | 6560 if ( LockSurface_DDraw4((IDirectDrawSurface4 *)pSprite->pTextureSurface, &Dst, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
6561 { | |
6562 v9 = sprite_texture->pPixels; | |
6563 v10 = Dst.lpSurface; | |
6564 for (int i=0; i<sprite_texture->uHeight; ++i) | |
0 | 6565 { |
670 | 6566 for (int j=0; j<sprite_texture->uWidth/2; ++j) |
6567 { | |
0 | 6568 *(int *)v10 = *(int *)v9; |
6569 v9 += 2; | |
6570 v10 = (char *)v10 + 4; | |
670 | 6571 } |
6572 v10 = (char *)v10+Dst.lPitch-sprite_texture->uWidth*2; | |
0 | 6573 } |
670 | 6574 ErrD3D(pSprite->pTextureSurface->Unlock(0)); |
6575 } | |
6576 free(sprite_texture->pPixels); | |
6577 free(sprite_texture); | |
6578 return true; | |
6579 } | |
6580 return false; | |
0 | 6581 } |
6582 | |
6583 //----- (004A51CB) -------------------------------------------------------- | |
6584 void Render::BeginScene() | |
6585 { | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6586 //Render *v1; // esi@1 |
0 | 6587 unsigned int v2; // eax@1 |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6588 /*int v3; // eax@5 |
0 | 6589 unsigned __int16 **v4; // edi@6 |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6590 char *v5; // ebx@7*/ |
0 | 6591 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 |
6592 | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6593 //v1 = this; |
0 | 6594 v2 = this->uNumSceneBegins; |
6595 this->uNumSceneBegins = v2 + 1; | |
6596 if ( !v2 ) | |
6597 { | |
6598 if ( this->pRenderD3D ) | |
6599 { | |
6600 if ( this->bColorKeySupported ) | |
6601 { | |
6602 memset(&Dst, 0, 0x7Cu); | |
6603 Dst.dwSize = 124; | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6604 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
|
6605 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6606 this->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6607 this->uTargetSurfacePitch = Dst.lPitch >> 1; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6608 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
|
6609 } |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6610 --this->uNumSceneBegins; |
0 | 6611 } |
6612 } | |
6613 else | |
6614 { | |
6615 if ( !this->pTargetSurface ) | |
6616 { | |
6617 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
|
6618 if ( this->pTargetSurface ) |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6619 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6620 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
|
6621 } |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6622 --this->uNumSceneBegins; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6623 } |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6624 } |
0 | 6625 RestoreFrontBuffer(); |
6626 } | |
6627 } | |
6628 | |
6629 //----- (004A527D) -------------------------------------------------------- | |
6630 void Render::EndScene() | |
6631 { | |
1151
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6632 if ( this->uNumSceneBegins ) |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6633 { |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6634 this->uNumSceneBegins--; |
4eca5bb63dc0
some small rendering cleanups - if+do while to for, unnecessary variable removal
Grumpy7
parents:
1117
diff
changeset
|
6635 if ( !this->uNumSceneBegins ) |
0 | 6636 { |
6637 if ( this->pRenderD3D ) | |
6638 { | |
6639 if ( this->bColorKeySupported ) | |
6640 { | |
6641 this->pTargetSurface = 0; | |
6642 this->uTargetSurfacePitch = 0; | |
6643 this->field_18_locked_pitch = 0; | |
6644 ErrD3D(this->pColorKeySurface4->Unlock(0)); | |
6645 } | |
6646 } | |
6647 else | |
6648 { | |
6649 this->pTargetSurface = 0; | |
6650 this->uTargetSurfacePitch = 0; | |
6651 this->field_18_locked_pitch = 0; | |
6652 UnlockBackBuffer(); | |
6653 } | |
6654 } | |
6655 } | |
6656 } | |
6657 | |
6658 //----- ( ) -------------------------------------------------------- | |
6659 unsigned int Render::_4A52F1(unsigned int this_, float a3) | |
6660 { | |
6661 unsigned int v3; // esi@1 | |
6662 double v4; // st7@2 | |
6663 double v5; // st7@6 | |
6664 double v6; // st6@6 | |
6665 unsigned int v7; // eax@6 | |
6666 double v8; // st5@6 | |
6667 double v9; // st4@6 | |
6668 HRESULT v10; // eax@6 | |
6669 HRESULT v11; // eax@6 | |
6670 unsigned int result; // eax@6 | |
6671 unsigned int v13; // eax@7 | |
6672 unsigned __int16 *v14; // ecx@7 | |
6673 int *v15; // eax@7 | |
6674 unsigned int v16; // ecx@8 | |
6675 __int16 v17; // ax@10 | |
6676 int v18; // esi@10 | |
6677 float v19; // edi@10 | |
6678 void *v20; // esi@10 | |
6679 int v21; // edx@10 | |
6680 int v22; // ecx@11 | |
6681 int v23; // edx@12 | |
6682 __int16 v24; // ax@15 | |
6683 int v25; // esi@15 | |
6684 float v26; // edi@15 | |
6685 char *v27; // esi@15 | |
6686 int v28; // edx@15 | |
6687 int v29; // ecx@16 | |
6688 int v30; // edx@17 | |
6689 int v31; // [sp-Ch] [bp-ACh]@11 | |
6690 int v32; // [sp-Ch] [bp-ACh]@16 | |
6691 const char *v33; // [sp+0h] [bp-A0h]@0 | |
6692 int v34; // [sp+4h] [bp-9Ch]@0 | |
6693 unsigned int v35; // [sp+8h] [bp-98h]@0 | |
6694 RenderVertexD3D3 v36[4]; // [sp+Ch] [bp-94h]@6 | |
6695 unsigned int v37; // [sp+8Ch] [bp-14h]@7 | |
6696 int v38; // [sp+90h] [bp-10h]@7 | |
6697 double v39; // [sp+94h] [bp-Ch]@6 | |
6698 float v40; // [sp+9Ch] [bp-4h]@6 | |
6699 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6700 __debugbreak(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6701 |
0 | 6702 auto ecx0 = this; |
6703 v3 = 0; | |
6704 if ( ecx0->pRenderD3D ) | |
6705 { | |
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 } | |
6716 a3 = v4 * 255.0; | |
6717 v39 = a3 + 6.7553994e15; | |
6718 LODWORD(v40) = LODWORD(v39); | |
693 | 6719 v5 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 6720 v36[0].pos.x = v5; |
693 | 6721 v6 = (double)(signed int)pViewport->uViewportTL_Y; |
0 | 6722 v7 = this_ | (LODWORD(v39) << 24); |
693 | 6723 this_ = pViewport->uViewportBR_Y + 1; |
0 | 6724 v36[0].specular = 0; |
6725 v36[0].pos.y = v6; | |
6726 v36[0].diffuse = v7; | |
6727 v36[1].diffuse = v7; | |
6728 v36[0].pos.z = 0.0; | |
6729 v36[2].diffuse = v7; | |
6730 v36[3].diffuse = v7; | |
6731 v36[0].rhw = 1.0; | |
6732 v36[1].specular = 0; | |
6733 v36[0].texcoord.x = 0.0; | |
6734 v36[2].specular = 0; | |
6735 v36[3].specular = 0; | |
6736 v36[0].texcoord.y = 0.0; | |
6737 v36[1].pos.x = v5; | |
693 | 6738 v8 = (double)(pViewport->uViewportBR_Y + 1); |
0 | 6739 v36[1].pos.y = v8; |
6740 v36[1].pos.z = 0.0; | |
6741 v36[1].rhw = 1.0; | |
6742 v36[1].texcoord.x = 0.0; | |
6743 v36[1].texcoord.y = 0.0; | |
693 | 6744 v9 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 6745 v36[2].pos.x = v9; |
6746 v36[2].pos.y = v8; | |
6747 v36[2].pos.z = 0.0; | |
6748 v36[2].rhw = 1.0; | |
6749 v36[2].texcoord.x = 0.0; | |
6750 v36[2].texcoord.y = 0.0; | |
6751 v36[3].pos.x = v9; | |
6752 v36[3].pos.y = v6; | |
6753 v36[3].pos.z = 0.0; | |
6754 v36[3].rhw = 1.0; | |
6755 v36[3].texcoord.x = 0.0; | |
6756 v36[3].texcoord.y = 0.0; | |
6757 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | |
186 | 6758 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
6759 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
6760 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | |
6761 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); | |
6762 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); | |
6763 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | |
6764 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS)); | |
0 | 6765 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( |
6766 D3DPT_TRIANGLEFAN, | |
6767 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
6768 v36, | |
6769 4, | |
6770 28)); | |
186 | 6771 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
6772 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
6773 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
6774 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
6775 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
6776 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS)); | |
0 | 6777 } |
6778 else | |
6779 { | |
6780 v40 = (1.0 - a3) * 65536.0; | |
6781 v39 = v40 + 6.7553994e15; | |
6782 LODWORD(a3) = LODWORD(v39); | |
693 | 6783 v38 = (signed int)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) >> 1; |
6784 HIDWORD(v39) = pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1; | |
6785 v13 = pViewport->uViewportTL_X + ecx0->uTargetSurfacePitch - pViewport->uViewportBR_X; | |
6786 v14 = &ecx0->pTargetSurface[pViewport->uViewportTL_X + pViewport->uViewportTL_Y * ecx0->uTargetSurfacePitch]; | |
0 | 6787 v37 = 2 * v13; |
6788 LODWORD(v40) = (int)v14; | |
6789 | |
6790 int __i = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6791 v15 = dword_F1B430.data(); |
0 | 6792 do |
6793 { | |
6794 v16 = v3; | |
6795 v3 += LODWORD(a3); | |
6796 dword_F1B430[__i++] = v16 >> 16; | |
6797 } | |
6798 //while ( (signed int)v15 < (signed int)&Aureal3D_SplashScreen ); | |
6799 while (__i < 32); | |
6800 | |
6801 if ( pRenderer->uTargetGBits == 6 ) | |
6802 { | |
6803 v17 = _42690D_colors_cvt(this_); | |
6804 v18 = (65536 - LODWORD(a3)) * (v17 & 0x1F); | |
6805 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); | |
6806 v19 = v40; | |
6807 v20 = off_4EFDB0; | |
6808 v21 = HIDWORD(v39); | |
6809 do | |
6810 { | |
6811 v22 = v38; | |
6812 v31 = v21; | |
6813 do | |
6814 { | |
6815 v23 = (*(int *)((char *)v20 | |
6816 + ((((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; | |
6817 result = this_ | |
6818 + (*((int *)v20 | |
6819 + (((unsigned __int8)(*((char *)v20 | |
6820 + ((((unsigned __int16)(*(short *)((char *)v20 | |
6821 + ((*(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); | |
6822 *(unsigned int *)LODWORD(v19) = result; | |
6823 LODWORD(v19) += 4; | |
6824 --v22; | |
6825 } | |
6826 while ( v22 ); | |
6827 LODWORD(v19) += v37; | |
6828 v21 = v31 - 1; | |
6829 } | |
6830 while ( v31 != 1 ); | |
6831 } | |
6832 else | |
6833 { | |
6834 v24 = _4268E3_smthn_to_a1r5g5b5(this_); | |
6835 v25 = (65536 - LODWORD(a3)) * (v24 & 0x1F); | |
6836 this_ = (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) | |
6837 * (v24 & 0x3E0) & 0x3E00000u) >> 16 << 16) | (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) * (v24 & 0x3E0) & 0x3E00000u) >> 16); | |
6838 v26 = v40; | |
6839 v27 = (char *)off_4EFDB0; | |
6840 v28 = HIDWORD(v39); | |
6841 do | |
6842 { | |
6843 v29 = v38; | |
6844 v32 = v28; | |
6845 do | |
6846 { | |
6847 v30 = 32 | |
6848 * *(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; | |
6849 result = this_ | |
6850 + (*(int *)&v27[4 | |
6851 * (((unsigned __int8)(32 | |
6852 * 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); | |
6853 *(unsigned int *)LODWORD(v26) = result; | |
6854 LODWORD(v26) += 4; | |
6855 --v29; | |
6856 } | |
6857 while ( v29 ); | |
6858 LODWORD(v26) += v37; | |
6859 v28 = v32 - 1; | |
6860 } | |
6861 while ( v32 != 1 ); | |
6862 } | |
6863 } | |
6864 return result; | |
6865 } | |
6866 | |
6867 //----- (004A5B81) -------------------------------------------------------- | |
727 | 6868 void Render::SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) |
0 | 6869 { |
6870 this->bClip = 1; | |
6871 this->uClipY = uY; | |
6872 this->uClipX = uX; | |
6873 this->uClipW = uW; | |
6874 this->uClipZ = uZ; | |
6875 } | |
6876 | |
6877 //----- (004A5BB6) -------------------------------------------------------- | |
727 | 6878 void Render::ResetTextureClipRect() |
0 | 6879 { |
6880 this->uClipY = 0; | |
6881 this->uClipX = 0; | |
6882 this->bClip = 1; | |
6883 this->uClipW = 480; | |
6884 this->uClipZ = 640; | |
6885 } | |
6886 | |
6887 //----- (004A5BE3) -------------------------------------------------------- | |
6888 void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) | |
6889 { | |
6890 int v4; // edi@3 | |
6891 unsigned __int16 *v5; // edx@3 | |
6892 unsigned __int16 *v6; // esi@3 | |
6893 unsigned int v8; // eax@5 | |
6894 unsigned int v9; // ebx@5 | |
6895 unsigned int v11; // eax@7 | |
6896 unsigned int v12; // ebx@8 | |
6897 unsigned int v15; // eax@14 | |
6898 int v19; // [sp+10h] [bp-8h]@3 | |
6899 unsigned int uOutXa; // [sp+20h] [bp+8h]@16 | |
6900 int v23; // [sp+28h] [bp+10h]@3 | |
6901 | |
6902 if ( this->uNumSceneBegins && a4 ) | |
6903 { | |
6904 v4 = a4->uWidth; | |
6905 v5 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; | |
6906 v6 = a4->pPixels; | |
6907 v23 = a4->uHeight; | |
6908 v19 = v4; | |
6909 if ( this->bClip ) | |
6910 { | |
1152 | 6911 if ( (signed int)uOutX < (signed int)this->uClipX ) |
6912 { | |
6913 v8 = this->uClipX - uOutX; | |
6914 v9 = uOutX - this->uClipX; | |
0 | 6915 v8 *= 2; |
6916 v4 += v9; | |
6917 v6 = (unsigned __int16 *)((char *)v6 + v8); | |
6918 v5 = (unsigned __int16 *)((char *)v5 + v8); | |
6919 } | |
1152 | 6920 if ( (signed int)uOutY < (signed int)this->uClipY ) |
6921 { | |
6922 v11 = this->uClipY - uOutY; | |
0 | 6923 v6 += v19 * v11; |
6924 v23 += uOutY - this->uClipY; | |
6925 v5 += this->uTargetSurfacePitch * v11; | |
6926 } | |
1152 | 6927 v12 = max(this->uClipX, uOutX); |
6928 if ( (signed int)(v4 + v12) > (signed int)this->uClipZ ) | |
6929 { | |
6930 v4 = this->uClipZ - max(this->uClipX, uOutX); | |
6931 } | |
6932 v15 = max(this->uClipY, uOutY); | |
6933 if ( (signed int)(v15 + v23) > (signed int)this->uClipW ) | |
6934 { | |
6935 v23 = this->uClipW - max(this->uClipY, uOutY); | |
6936 } | |
6937 } | |
6938 | |
6939 for (int outerCounter = 0; outerCounter < v23; outerCounter++) | |
6940 { | |
6941 for (int counter = 0; counter < v4; counter++) | |
6942 { | |
6943 *v5 = *v6; | |
6944 ++v5; | |
6945 ++v6; | |
6946 } | |
6947 v6 += v19 - v4; | |
6948 v5 += this->uTargetSurfacePitch - v4; | |
0 | 6949 } |
6950 } | |
6951 } | |
6952 | |
6953 //----- (004A5D33) -------------------------------------------------------- | |
6954 void Render::_4A5D33(unsigned int pX, unsigned int pY, int a4, int a5, RGBTexture *pTexture) | |
6955 { | |
6956 Render *v6; // esi@1 | |
6957 unsigned __int16 *v7; // ebx@3 | |
6958 int v8; // ecx@3 | |
6959 int v9; // edx@3 | |
6960 int v10; // ecx@3 | |
6961 int v11; // edi@3 | |
6962 signed int v12; // eax@4 | |
6963 unsigned int v13; // eax@5 | |
6964 signed int v14; // eax@6 | |
6965 unsigned int v15; // eax@7 | |
6966 unsigned int v16; // edx@8 | |
6967 int v17; // eax@10 | |
6968 unsigned int v18; // ecx@11 | |
6969 unsigned int v19; // ecx@14 | |
6970 int v20; // eax@16 | |
6971 unsigned int v21; // ecx@17 | |
6972 int v22; // eax@21 | |
6973 int v23; // edi@23 | |
6974 int v24; // [sp+Ch] [bp-4h]@3 | |
6975 int a2a; // [sp+18h] [bp+8h]@21 | |
6976 unsigned int teal; // [sp+1Ch] [bp+Ch]@20 | |
6977 int a4a; // [sp+20h] [bp+10h]@3 | |
6978 int a4b; // [sp+20h] [bp+10h]@21 | |
6979 unsigned __int16 *pTexturea; // [sp+28h] [bp+18h]@3 | |
6980 | |
6981 v6 = this; | |
6982 if ( this->uNumSceneBegins && pTexture ) | |
6983 { | |
6984 v7 = &this->pTargetSurface[pX + pY * this->uTargetSurfacePitch]; | |
6985 v8 = pTexture->uWidth; | |
6986 v24 = pTexture->uWidth; | |
6987 v9 = a4 + a5 * v8; | |
6988 v10 = v8 - a4; | |
6989 a4a = v10; | |
6990 v11 = pTexture->uHeight - a5; | |
6991 pTexturea = &pTexture->pPixels[v9]; | |
6992 if ( v6->bClip ) | |
6993 { | |
6994 v12 = v6->uClipX; | |
6995 if ( (signed int)pX < v12 ) | |
6996 { | |
6997 v13 = 2 * (v12 - pX); | |
6998 pTexturea = (unsigned __int16 *)((char *)pTexturea + v13); | |
6999 v10 += pX - v6->uClipX; | |
7000 v7 = (unsigned __int16 *)((char *)v7 + v13); | |
7001 a4a = v10; | |
7002 } | |
7003 v14 = v6->uClipY; | |
7004 if ( (signed int)pY < v14 ) | |
7005 { | |
7006 v15 = v14 - pY; | |
7007 pTexturea += v24 * v15; | |
7008 v11 += pY - v6->uClipY; | |
7009 v10 = a4a; | |
7010 v7 += v6->uTargetSurfacePitch * v15; | |
7011 } | |
7012 v16 = v6->uClipX; | |
7013 if ( (signed int)v16 < (signed int)pX ) | |
7014 v16 = pX; | |
7015 v17 = v6->uClipZ; | |
7016 if ( (signed int)(v10 + v16) > v17 ) | |
7017 { | |
7018 v18 = v6->uClipX; | |
7019 if ( (signed int)v18 < (signed int)pX ) | |
7020 v18 = pX; | |
7021 a4a = v17 - v18; | |
7022 } | |
7023 v19 = v6->uClipY; | |
7024 if ( (signed int)v19 < (signed int)pY ) | |
7025 v19 = pY; | |
7026 v20 = v6->uClipW; | |
7027 if ( (signed int)(v11 + v19) > v20 ) | |
7028 { | |
7029 v21 = v6->uClipY; | |
7030 if ( (signed int)v21 < (signed int)pY ) | |
7031 v21 = pY; | |
7032 v11 = v20 - v21; | |
7033 } | |
7034 } | |
949 | 7035 teal = TargetColor(0, 0xFFu, 0xFFu); |
0 | 7036 if ( v11 > 0 ) |
7037 { | |
7038 v22 = a4a; | |
7039 a2a = v11; | |
7040 a4b = 2 * (v24 - a4a); | |
7041 do | |
7042 { | |
7043 if ( v22 > 0 ) | |
7044 { | |
7045 v23 = v22; | |
7046 do | |
7047 { | |
7048 if ( *pTexturea != teal ) | |
7049 *v7 = *pTexturea; | |
7050 ++pTexturea; | |
7051 ++v7; | |
7052 --v23; | |
7053 } | |
7054 while ( v23 ); | |
7055 } | |
7056 v7 += v6->uTargetSurfacePitch - v22; | |
7057 pTexturea = (unsigned __int16 *)((char *)pTexturea + a4b); | |
7058 --a2a; | |
7059 } | |
7060 while ( a2a ); | |
7061 } | |
7062 } | |
7063 } | |
7064 | |
7065 //----- (004A6E7E) -------------------------------------------------------- | |
7066 void Render::_4A6E7E(unsigned int a2, unsigned int a3, Texture *a4) | |
7067 { | |
7068 unsigned __int16 *v4; // eax@4 | |
7069 int v5; // edx@4 | |
7070 unsigned int v6; // edi@4 | |
7071 unsigned int v7; // edx@5 | |
7072 unsigned int v8; // edx@6 | |
7073 unsigned int v9; // edx@7 | |
7074 unsigned int v10; // edx@8 | |
7075 unsigned int v11; // ebx@9 | |
7076 unsigned int v12; // esi@11 | |
7077 unsigned int v13; // edx@12 | |
7078 unsigned int v14; // ebx@15 | |
7079 unsigned int v15; // esi@17 | |
7080 unsigned int v16; // edi@18 | |
7081 char v17; // zf@29 | |
7082 int v18; // [sp+14h] [bp-Ch]@4 | |
7083 int v19; // [sp+18h] [bp-8h]@4 | |
7084 unsigned __int8 *v20; // [sp+1Ch] [bp-4h]@4 | |
7085 int v21; // [sp+28h] [bp+8h]@25 | |
7086 int v22; // [sp+28h] [bp+8h]@34 | |
7087 unsigned int v23; // [sp+2Ch] [bp+Ch]@23 | |
7088 unsigned int v24; // [sp+2Ch] [bp+Ch]@32 | |
7089 | |
7090 if ( this->uNumSceneBegins && a4 && a4->pPalette16 ) | |
7091 { | |
7092 v4 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 7093 v20 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7094 v5 = a4->uTextureWidth; |
7095 v6 = a4->uTextureHeight; | |
7096 v19 = a4->uTextureWidth; | |
7097 v18 = a4->uTextureWidth; | |
7098 if ( this->bClip ) | |
7099 { | |
7100 v7 = this->uClipX; | |
7101 if ( (signed int)a2 < (signed int)v7 ) | |
7102 { | |
7103 v8 = v7 - a2; | |
7104 v20 += v8; | |
7105 v19 += a2 - this->uClipX; | |
7106 v4 += v8; | |
7107 } | |
7108 v9 = this->uClipY; | |
7109 if ( (signed int)a3 < (signed int)v9 ) | |
7110 { | |
7111 v10 = v9 - a3; | |
7112 v20 += v18 * v10; | |
7113 v6 = a3 - this->uClipY + a4->uTextureHeight; | |
7114 v4 += this->uTargetSurfacePitch * v10; | |
7115 } | |
7116 v11 = this->uClipX; | |
7117 v5 = v19; | |
7118 if ( (signed int)v11 < (signed int)a2 ) | |
7119 v11 = a2; | |
7120 v12 = this->uClipZ; | |
7121 if ( (signed int)(v19 + v11) > (signed int)v12 ) | |
7122 { | |
7123 v13 = this->uClipX; | |
7124 if ( (signed int)v13 < (signed int)a2 ) | |
7125 v13 = a2; | |
7126 v5 = v12 - v13; | |
7127 } | |
7128 v14 = this->uClipY; | |
7129 if ( (signed int)v14 < (signed int)a3 ) | |
7130 v14 = a3; | |
7131 v15 = this->uClipW; | |
7132 if ( (signed int)(v6 + v14) > (signed int)v15 ) | |
7133 { | |
7134 v16 = this->uClipY; | |
7135 if ( (signed int)v16 < (signed int)a3 ) | |
7136 v16 = a3; | |
7137 v6 = v15 - v16; | |
7138 } | |
7139 } | |
7140 if ( pRenderer->uTargetGBits == 5 ) | |
7141 { | |
7142 if ( (signed int)v6 > 0 ) | |
7143 { | |
7144 v23 = v6; | |
7145 do | |
7146 { | |
7147 if ( v5 > 0 ) | |
7148 { | |
7149 v21 = v5; | |
7150 do | |
7151 { | |
7152 if ( *v20 ) | |
7153 *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x3DEF; | |
7154 ++v4; | |
7155 ++v20; | |
7156 --v21; | |
7157 } | |
7158 while ( v21 ); | |
7159 } | |
7160 v20 += v18 - v5; | |
7161 v17 = v23-- == 1; | |
7162 v4 += this->uTargetSurfacePitch - v5; | |
7163 } | |
7164 while ( !v17 ); | |
7165 } | |
7166 } | |
7167 else | |
7168 { | |
7169 if ( (signed int)v6 > 0 ) | |
7170 { | |
7171 v24 = v6; | |
7172 do | |
7173 { | |
7174 if ( v5 > 0 ) | |
7175 { | |
7176 v22 = v5; | |
7177 do | |
7178 { | |
7179 if ( *v20 ) | |
7180 *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF; | |
7181 ++v4; | |
7182 ++v20; | |
7183 --v22; | |
7184 } | |
7185 while ( v22 ); | |
7186 } | |
7187 v20 += v18 - v5; | |
7188 v17 = v24-- == 1; | |
7189 v4 += this->uTargetSurfacePitch - v5; | |
7190 } | |
7191 while ( !v17 ); | |
7192 } | |
7193 } | |
7194 } | |
7195 } | |
7196 | |
7197 //----- (004A6DF5) -------------------------------------------------------- | |
7198 int Render::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) | |
7199 { | |
7200 int result; // eax@0 | |
7201 int v8; // ecx@3 | |
7202 unsigned __int16 *v9; // edi@4 | |
7203 unsigned __int16 *v10; // ebx@4 | |
7204 int v11; // esi@4 | |
7205 unsigned __int16 *pBitmapa; // [sp+14h] [bp+8h]@3 | |
7206 unsigned __int16 *pTargeta; // [sp+20h] [bp+14h]@3 | |
7207 | |
7208 if ( pBitmap ) | |
7209 { | |
7210 if ( pTarget ) | |
7211 { | |
7212 pBitmapa = &pBitmap[pBitmapXY->x + uBitmapPitch * pBitmapXY->y]; | |
7213 pTargeta = &pTarget[a7->x + uTargetPitch * a7->y]; | |
7214 v8 = a7->z - a7->x; | |
7215 result = a7->w - a7->y; | |
7216 if ( result > 0 ) | |
7217 { | |
7218 v9 = pBitmapa; | |
7219 v10 = pTargeta; | |
7220 v11 = a7->w - a7->y; | |
7221 do | |
7222 { | |
7223 if ( v8 > 0 ) | |
7224 { | |
7225 result = v8; | |
7226 do | |
7227 { | |
7228 *v9 = *v10; | |
7229 ++v9; | |
7230 ++v10; | |
7231 --result; | |
7232 } | |
7233 while ( result ); | |
7234 } | |
7235 v9 += uBitmapPitch - v8; | |
7236 v10 += uTargetPitch - v8; | |
7237 --v11; | |
7238 } | |
7239 while ( v11 ); | |
7240 } | |
7241 } | |
7242 } | |
7243 return result; | |
7244 } | |
7245 | |
7246 //----- (004A6D87) -------------------------------------------------------- | |
7247 void Render::FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16) | |
7248 { | |
7249 if (!uNumSceneBegins) | |
7250 return; | |
7251 | |
7252 unsigned __int32 twoColors = (uColor16 << 16) | uColor16; | |
7253 for (uint y = 0; y < uHeight; ++y) | |
7254 { | |
7255 auto pDst = &pTargetSurface[uX + (y + uY) * uTargetSurfacePitch]; | |
7256 | |
7257 memset32(pDst, twoColors, uWidth / 2); | |
7258 if (uWidth & 1) | |
7259 pDst[uWidth - 1] = uColor16; | |
7260 } | |
7261 } | |
7262 | |
7263 //----- (004A6C4F) -------------------------------------------------------- | |
7264 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) | |
7265 { | |
7266 unsigned int v9; // edi@2 | |
7267 unsigned int v10; // esi@2 | |
7268 unsigned __int16 *v11; // eax@2 | |
7269 unsigned int v12; // ebx@3 | |
7270 signed int v13; // edx@5 | |
7271 int v14; // edx@6 | |
7272 signed int v15; // ebx@7 | |
7273 unsigned int v16; // edx@9 | |
7274 signed int v17; // edi@10 | |
7275 signed int v18; // ebx@13 | |
7276 unsigned int v19; // edx@15 | |
7277 signed int v20; // esi@16 | |
7278 unsigned int v21; // esi@22 | |
7279 unsigned __int16 v22; // dx@24 | |
7280 char v23; // zf@28 | |
7281 unsigned __int8 *v24; // [sp+Ch] [bp-4h]@2 | |
7282 unsigned int uOutXa; // [sp+18h] [bp+8h]@20 | |
7283 | |
7284 if ( this->uNumSceneBegins ) | |
7285 { | |
7286 v9 = uCharWidth; | |
7287 v10 = uCharHeight; | |
7288 v11 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; | |
7289 v24 = pFontPixels; | |
7290 if ( this->bClip ) | |
7291 { | |
7292 v12 = this->uClipX; | |
7293 if ( uOutX < (signed int)v12 ) | |
7294 { | |
7295 v24 = &pFontPixels[v12 - uOutX]; | |
7296 v11 += v12 - uOutX; | |
7297 v9 = uCharWidth + uOutX - v12; | |
7298 } | |
7299 v13 = this->uClipY; | |
7300 if ( uOutY < v13 ) | |
7301 { | |
7302 v14 = v13 - uOutY; | |
7303 v24 += uCharWidth * v14; | |
7304 v10 = uCharHeight + uOutY - this->uClipY; | |
7305 v11 += this->uTargetSurfacePitch * v14; | |
7306 } | |
7307 v15 = this->uClipX; | |
7308 if ( v15 < uOutX ) | |
7309 v15 = uOutX; | |
7310 v16 = this->uClipZ; | |
7311 if ( (signed int)(v9 + v15) > (signed int)v16 ) | |
7312 { | |
7313 v17 = this->uClipX; | |
7314 if ( v17 < uOutX ) | |
7315 v17 = uOutX; | |
7316 v9 = v16 - v17; | |
7317 } | |
7318 v18 = this->uClipY; | |
7319 if ( v18 < uOutY ) | |
7320 v18 = uOutY; | |
7321 v19 = this->uClipW; | |
7322 if ( (signed int)(v10 + v18) > (signed int)v19 ) | |
7323 { | |
7324 v20 = this->uClipY; | |
7325 if ( v20 < uOutY ) | |
7326 v20 = uOutY; | |
7327 v10 = v19 - v20; | |
7328 } | |
7329 } | |
7330 if ( (signed int)v10 > 0 ) | |
7331 { | |
7332 uOutXa = v10; | |
7333 do | |
7334 { | |
7335 if ( (signed int)v9 > 0 ) | |
7336 { | |
7337 v21 = v9; | |
7338 do | |
7339 { | |
7340 if ( *v24 ) | |
7341 { | |
7342 v22 = uShadowColor; | |
7343 if ( *v24 != 1 ) | |
7344 v22 = uFaceColor; | |
7345 *v11 = v22; | |
7346 } | |
7347 ++v11; | |
7348 ++v24; | |
7349 --v21; | |
7350 } | |
7351 while ( v21 ); | |
7352 } | |
7353 v24 += uCharWidth - v9; | |
7354 v23 = uOutXa-- == 1; | |
7355 v11 += this->uTargetSurfacePitch - v9; | |
7356 } | |
7357 while ( !v23 ); | |
7358 } | |
7359 } | |
7360 } | |
7361 | |
7362 //----- (004A6A68) -------------------------------------------------------- | |
1496 | 7363 void Render::GetLeather(unsigned int a2, unsigned int a3, Texture *a4, __int16 height) |
7364 { | |
0 | 7365 Texture tex; // [sp+Ch] [bp-48h]@1 |
1496 | 7366 |
0 | 7367 memcpy(&tex, a4, sizeof(tex)); |
1496 | 7368 tex.uTextureHeight = a4->uTextureHeight - height; |
7369 if ( (signed __int16)tex.uTextureHeight > 0 ) | |
0 | 7370 DrawTextureIndexed(a2, a3, &tex); |
7371 } | |
7372 | |
7373 //----- (004A6AB1) -------------------------------------------------------- | |
1268 | 7374 void Render::DrawTextPalette( int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8 ) |
7375 { | |
0 | 7376 int v8; // edi@2 |
7377 unsigned int v9; // esi@2 | |
7378 unsigned __int16 *v10; // eax@2 | |
7379 unsigned char *v11; // edx@2 | |
7380 unsigned int v12; // ebx@3 | |
7381 signed int v13; // edx@5 | |
7382 int v14; // edx@6 | |
7383 signed int v15; // ebx@7 | |
7384 unsigned int v16; // edx@9 | |
7385 signed int v17; // edi@10 | |
7386 signed int v18; // ebx@13 | |
7387 unsigned int v19; // edx@15 | |
7388 signed int v20; // esi@16 | |
7389 int v21; // ebx@22 | |
7390 char v22; // zf@28 | |
7391 int v23; // ebx@31 | |
7392 unsigned __int16 v24; // si@35 | |
7393 int v25; // [sp+Ch] [bp-4h]@2 | |
7394 int v26; // [sp+1Ch] [bp+Ch]@24 | |
7395 int v27; // [sp+1Ch] [bp+Ch]@33 | |
7396 unsigned int v28; // [sp+20h] [bp+10h]@30 | |
7397 unsigned int v29; // [sp+24h] [bp+14h]@22 | |
7398 unsigned int v30; // [sp+24h] [bp+14h]@31 | |
7399 | |
7400 auto a2 = x; | |
7401 auto a3 = y; | |
7402 auto a6 = uFontHeight; | |
7403 if ( this->uNumSceneBegins ) | |
7404 { | |
7405 v8 = a5; | |
7406 v9 = a6; | |
7407 v10 = &pTargetSurface[x + y * uTargetSurfacePitch]; | |
1268 | 7408 v11 = (unsigned char *)font_pixels; |
7409 v25 = (int)font_pixels; | |
0 | 7410 if ( this->bClip ) |
7411 { | |
7412 v12 = this->uClipX; | |
7413 if ( a2 < (signed int)v12 ) | |
7414 { | |
1268 | 7415 v25 = v12 - a2 + (int)font_pixels; |
0 | 7416 v10 += v12 - a2; |
7417 v8 = a5 + a2 - v12; | |
7418 } | |
7419 v13 = this->uClipY; | |
7420 if ( a3 < v13 ) | |
7421 { | |
7422 v14 = v13 - a3; | |
7423 v25 += a5 * v14; | |
7424 v9 = a6 + a3 - this->uClipY; | |
7425 v10 += this->uTargetSurfacePitch * v14; | |
7426 } | |
7427 v15 = this->uClipX; | |
7428 if ( v15 < a2 ) | |
7429 v15 = a2; | |
7430 v16 = this->uClipZ; | |
7431 if ( v8 + v15 > (signed int)v16 ) | |
7432 { | |
7433 v17 = this->uClipX; | |
7434 if ( v17 < a2 ) | |
7435 v17 = a2; | |
7436 v8 = v16 - v17; | |
7437 } | |
7438 v18 = this->uClipY; | |
7439 if ( v18 < a3 ) | |
7440 v18 = a3; | |
7441 v19 = this->uClipW; | |
7442 if ( (signed int)(v9 + v18) > (signed int)v19 ) | |
7443 { | |
7444 v20 = this->uClipY; | |
7445 if ( v20 < a3 ) | |
7446 v20 = a3; | |
7447 v9 = v19 - v20; | |
7448 } | |
7449 v11 = (unsigned char *)v25; | |
7450 } | |
7451 if ( a8 ) | |
7452 { | |
7453 v28 = pRenderer->uTargetGMask | pRenderer->uTargetBMask; | |
7454 if ( (signed int)v9 > 0 ) | |
7455 { | |
7456 v23 = a5; | |
7457 v30 = v9; | |
7458 do | |
7459 { | |
7460 if ( v8 > 0 ) | |
7461 { | |
7462 v27 = v8; | |
7463 do | |
7464 { | |
7465 if ( *v11 ) | |
7466 v24 = pPalette[*v11]; | |
7467 else | |
7468 v24 = v28; | |
7469 *v10 = v24; | |
7470 ++v10; | |
7471 ++v11; | |
7472 --v27; | |
7473 } | |
7474 while ( v27 ); | |
7475 } | |
7476 v11 += v23 - v8; | |
7477 v22 = v30-- == 1; | |
7478 v10 += this->uTargetSurfacePitch - v8; | |
7479 } | |
7480 while ( !v22 ); | |
7481 } | |
7482 } | |
7483 else | |
7484 { | |
7485 if ( (signed int)v9 > 0 ) | |
7486 { | |
7487 v21 = a5; | |
7488 v29 = v9; | |
7489 do | |
7490 { | |
7491 if ( v8 > 0 ) | |
7492 { | |
7493 v26 = v8; | |
7494 do | |
7495 { | |
7496 if ( *v11 ) | |
7497 *v10 = pPalette[*v11]; | |
7498 ++v10; | |
7499 ++v11; | |
7500 --v26; | |
7501 } | |
7502 while ( v26 ); | |
7503 } | |
7504 v11 += v21 - v8; | |
7505 v22 = v29-- == 1; | |
7506 v10 += this->uTargetSurfacePitch - v8; | |
7507 } | |
7508 while ( !v22 ); | |
7509 } | |
7510 } | |
7511 } | |
7512 } | |
7513 | |
7514 //----- (004A68EF) -------------------------------------------------------- | |
7515 void Render::DrawTransparentGreenShade(signed int a2, signed int a3, Texture *pTexture) | |
7516 { | |
7517 Texture *v4; // edi@2 | |
7518 unsigned int v5; // ebx@4 | |
7519 unsigned __int16 *v6; // eax@4 | |
7520 signed int v7; // edx@5 | |
7521 int v8; // edx@6 | |
7522 signed int v9; // edx@7 | |
7523 int v10; // edx@8 | |
7524 signed int v11; // edx@9 | |
7525 signed int v12; // esi@12 | |
7526 signed int v13; // esi@15 | |
7527 unsigned int v14; // edx@17 | |
7528 signed int v15; // esi@18 | |
7529 unsigned __int8 *v16; // ebx@22 | |
7530 char v17; // zf@28 | |
7531 int v18; // [sp+10h] [bp-10h]@4 | |
7532 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
7533 int v20; // [sp+1Ch] [bp-4h]@4 | |
7534 int v21; // [sp+28h] [bp+8h]@24 | |
7535 unsigned int v22; // [sp+2Ch] [bp+Ch]@22 | |
7536 unsigned int pTexturea; // [sp+30h] [bp+10h]@11 | |
7537 | |
7538 if ( this->uNumSceneBegins ) | |
7539 { | |
7540 v4 = pTexture; | |
7541 if ( pTexture ) | |
7542 { | |
7543 if ( pTexture->pPalette16 ) | |
7544 { | |
7545 v5 = pTexture->uTextureHeight; | |
7546 v6 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 7547 v19 = pTexture->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7548 v20 = pTexture->uTextureWidth; |
7549 v18 = pTexture->uTextureWidth; | |
7550 if ( this->bClip ) | |
7551 { | |
7552 v7 = this->uClipX; | |
7553 if ( a2 < v7 ) | |
7554 { | |
7555 v8 = v7 - a2; | |
7556 v19 += v8; | |
7557 v20 += a2 - this->uClipX; | |
7558 v6 += v8; | |
7559 } | |
7560 v9 = this->uClipY; | |
7561 v5 = pTexture->uTextureHeight; | |
7562 if ( a3 < v9 ) | |
7563 { | |
7564 v10 = v9 - a3; | |
7565 v19 += v18 * v10; | |
7566 v5 = a3 - this->uClipY + pTexture->uTextureHeight; | |
7567 v4 = pTexture; | |
7568 v6 += this->uTargetSurfacePitch * v10; | |
7569 } | |
7570 v11 = this->uClipX; | |
7571 if ( v11 < a2 ) | |
7572 v11 = a2; | |
7573 pTexturea = this->uClipZ; | |
7574 if ( v11 + v20 > (signed int)pTexturea ) | |
7575 { | |
7576 v12 = this->uClipX; | |
7577 if ( v12 < a2 ) | |
7578 v12 = a2; | |
7579 v20 = pTexturea - v12; | |
7580 } | |
7581 v13 = this->uClipY; | |
7582 if ( v13 < a3 ) | |
7583 v13 = a3; | |
7584 v14 = this->uClipW; | |
7585 if ( (signed int)(v5 + v13) > (signed int)v14 ) | |
7586 { | |
7587 v15 = this->uClipY; | |
7588 if ( v15 < a3 ) | |
7589 v15 = a3; | |
7590 v5 = v14 - v15; | |
7591 } | |
7592 } | |
7593 if ( (signed int)v5 > 0 ) | |
7594 { | |
7595 v22 = v5; | |
7596 v16 = v19; | |
7597 do | |
7598 { | |
7599 if ( v20 > 0 ) | |
7600 { | |
7601 v21 = v20; | |
7602 do | |
7603 { | |
7604 if ( *v16 ) | |
7605 *v6 = this->uTargetGMask & v4->pPalette16[*v16]; | |
7606 ++v6; | |
7607 ++v16; | |
7608 --v21; | |
7609 } | |
7610 while ( v21 ); | |
7611 } | |
7612 v16 += v18 - v20; | |
7613 v17 = v22-- == 1; | |
7614 v6 += this->uTargetSurfacePitch - v20; | |
7615 } | |
7616 while ( !v17 ); | |
7617 } | |
7618 } | |
7619 } | |
7620 } | |
7621 } | |
7622 | |
7623 //----- (004A6776) -------------------------------------------------------- | |
315 | 7624 void Render::DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4) |
0 | 7625 { |
7626 Texture *v4; // edi@2 | |
7627 unsigned int v5; // ebx@4 | |
7628 unsigned __int16 *v6; // eax@4 | |
7629 unsigned int v7; // edx@5 | |
7630 unsigned int v8; // edx@6 | |
7631 unsigned int v9; // edx@7 | |
7632 unsigned int v10; // edx@8 | |
7633 unsigned int v11; // edx@9 | |
7634 unsigned int v12; // esi@12 | |
7635 unsigned int v13; // esi@15 | |
7636 unsigned int v14; // edx@17 | |
7637 unsigned int v15; // esi@18 | |
7638 unsigned __int8 *v16; // ebx@22 | |
7639 char v17; // zf@28 | |
7640 int v18; // [sp+10h] [bp-10h]@4 | |
7641 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
7642 int v20; // [sp+1Ch] [bp-4h]@4 | |
7643 int a2a; // [sp+28h] [bp+8h]@24 | |
7644 unsigned int a3a; // [sp+2Ch] [bp+Ch]@22 | |
7645 unsigned int a4a; // [sp+30h] [bp+10h]@11 | |
7646 | |
7647 if ( this->uNumSceneBegins ) | |
7648 { | |
7649 v4 = a4; | |
7650 if ( a4 ) | |
7651 { | |
7652 if ( a4->pPalette16 ) | |
7653 { | |
7654 v5 = a4->uTextureHeight; | |
7655 v6 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 7656 v19 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7657 v20 = a4->uTextureWidth; |
7658 v18 = a4->uTextureWidth; | |
7659 if ( this->bClip ) | |
7660 { | |
7661 v7 = this->uClipX; | |
7662 if ( (signed int)a2 < (signed int)v7 ) | |
7663 { | |
7664 v8 = v7 - a2; | |
7665 v19 += v8; | |
7666 v20 += a2 - this->uClipX; | |
7667 v6 += v8; | |
7668 } | |
7669 v9 = this->uClipY; | |
7670 v5 = a4->uTextureHeight; | |
7671 if ( (signed int)a3 < (signed int)v9 ) | |
7672 { | |
7673 v10 = v9 - a3; | |
7674 v19 += v18 * v10; | |
7675 v5 = a3 - this->uClipY + a4->uTextureHeight; | |
7676 v4 = a4; | |
7677 v6 += this->uTargetSurfacePitch * v10; | |
7678 } | |
7679 v11 = this->uClipX; | |
7680 if ( (signed int)v11 < (signed int)a2 ) | |
7681 v11 = a2; | |
7682 a4a = this->uClipZ; | |
7683 if ( (signed int)(v11 + v20) > (signed int)a4a ) | |
7684 { | |
7685 v12 = this->uClipX; | |
7686 if ( (signed int)v12 < (signed int)a2 ) | |
7687 v12 = a2; | |
7688 v20 = a4a - v12; | |
7689 } | |
7690 v13 = this->uClipY; | |
7691 if ( (signed int)v13 < (signed int)a3 ) | |
7692 v13 = a3; | |
7693 v14 = this->uClipW; | |
7694 if ( (signed int)(v5 + v13) > (signed int)v14 ) | |
7695 { | |
7696 v15 = this->uClipY; | |
7697 if ( (signed int)v15 < (signed int)a3 ) | |
7698 v15 = a3; | |
7699 v5 = v14 - v15; | |
7700 } | |
7701 } | |
7702 if ( (signed int)v5 > 0 ) | |
7703 { | |
7704 a3a = v5; | |
7705 v16 = v19; | |
7706 do | |
7707 { | |
7708 if ( v20 > 0 ) | |
7709 { | |
7710 a2a = v20; | |
7711 do | |
7712 { | |
7713 if ( *v16 ) | |
7714 *v6 = this->uTargetRMask & v4->pPalette16[*v16]; | |
7715 ++v6; | |
7716 ++v16; | |
7717 --a2a; | |
7718 } | |
7719 while ( a2a ); | |
7720 } | |
7721 v16 += v18 - v20; | |
7722 v17 = a3a-- == 1; | |
7723 v6 += this->uTargetSurfacePitch - v20; | |
7724 } | |
7725 while ( !v17 ); | |
7726 } | |
7727 } | |
7728 } | |
7729 } | |
7730 } | |
7731 | |
7732 //----- (004A65CC) -------------------------------------------------------- | |
7733 void Render::_4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8) | |
7734 { | |
7735 unsigned __int16 *v8; // esi@6 | |
7736 unsigned int v9; // edi@6 | |
7737 unsigned int v10; // eax@7 | |
7738 unsigned int v11; // eax@8 | |
7739 unsigned int v12; // eax@9 | |
7740 unsigned int v13; // eax@10 | |
7741 unsigned int v14; // edx@11 | |
7742 unsigned int v15; // eax@13 | |
7743 unsigned int v16; // edx@14 | |
7744 unsigned int v17; // edx@17 | |
7745 unsigned int v18; // eax@19 | |
7746 unsigned int v19; // edx@20 | |
7747 int v20; // eax@27 | |
7748 int v21; // edx@29 | |
7749 int v22; // [sp+Ch] [bp-Ch]@6 | |
7750 int v23; // [sp+Ch] [bp-Ch]@24 | |
7751 unsigned __int8 *v24; // [sp+14h] [bp-4h]@6 | |
7752 int xa; // [sp+20h] [bp+8h]@26 | |
7753 unsigned int ya; // [sp+24h] [bp+Ch]@24 | |
7754 int v27; // [sp+2Ch] [bp+14h]@6 | |
7755 | |
7756 if ( this->uNumSceneBegins && a4 && a4->pPalette16 && a5 && a5->pPalette16 ) | |
7757 { | |
7758 v8 = &this->pTargetSurface[x + y * this->uTargetSurfacePitch]; | |
710 | 7759 v24 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7760 v27 = a4->uTextureWidth; |
7761 v9 = a4->uTextureHeight; | |
7762 v22 = a4->uTextureWidth; | |
7763 if ( this->bClip ) | |
7764 { | |
7765 v10 = this->uClipX; | |
7766 if ( (signed int)x < (signed int)v10 ) | |
7767 { | |
7768 v11 = v10 - x; | |
7769 v24 += v11; | |
7770 v27 += x - this->uClipX; | |
7771 v8 += v11; | |
7772 } | |
7773 v12 = this->uClipY; | |
7774 if ( (signed int)y < (signed int)v12 ) | |
7775 { | |
7776 v13 = v12 - y; | |
7777 v24 += v22 * v13; | |
7778 v9 = y - this->uClipY + a4->uTextureHeight; | |
7779 v8 += this->uTargetSurfacePitch * v13; | |
7780 } | |
7781 v14 = this->uClipX; | |
7782 if ( (signed int)v14 < (signed int)x ) | |
7783 v14 = x; | |
7784 v15 = this->uClipZ; | |
7785 if ( (signed int)(v27 + v14) > (signed int)v15 ) | |
7786 { | |
7787 v16 = this->uClipX; | |
7788 if ( (signed int)v16 < (signed int)x ) | |
7789 v16 = x; | |
7790 v27 = v15 - v16; | |
7791 } | |
7792 v17 = this->uClipY; | |
7793 if ( (signed int)v17 < (signed int)y ) | |
7794 v17 = y; | |
7795 v18 = this->uClipW; | |
7796 if ( (signed int)(v9 + v17) > (signed int)v18 ) | |
7797 { | |
7798 v19 = this->uClipY; | |
7799 if ( (signed int)v19 < (signed int)y ) | |
7800 v19 = y; | |
7801 v9 = v18 - v19; | |
7802 } | |
7803 } | |
7804 if ( (signed int)v9 > 0 ) | |
7805 { | |
7806 ya = v9; | |
7807 v23 = v22 - v27; | |
7808 do | |
7809 { | |
7810 if ( v27 > 0 ) | |
7811 { | |
7812 xa = v27; | |
7813 do | |
7814 { | |
7815 v20 = *v24; | |
7816 if ( v20 >= a7 && v20 <= a8 ) | |
7817 { | |
7818 v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); | |
7819 if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) | |
7820 v21 = 2 * a8 - v21 - a7; | |
7821 *v8 = a4->pPalette16[v21]; | |
7822 } | |
7823 ++v8; | |
7824 ++v24; | |
7825 --xa; | |
7826 } | |
7827 while ( xa ); | |
7828 } | |
7829 v8 += this->uTargetSurfacePitch - v27; | |
7830 v24 += v23; | |
7831 --ya; | |
7832 } | |
7833 while ( ya ); | |
7834 } | |
7835 } | |
7836 } | |
7837 | |
7838 //----- (004A63E6) -------------------------------------------------------- | |
1455 | 7839 void Render::DrawAura(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) |
0 | 7840 { |
7841 Texture *v8; // eax@2 | |
7842 Texture *v9; // ebx@4 | |
7843 unsigned __int16 *v10; // esi@6 | |
7844 unsigned int v11; // edi@7 | |
7845 unsigned int v12; // eax@9 | |
7846 unsigned int v13; // eax@10 | |
7847 unsigned int v14; // edx@11 | |
7848 unsigned int v15; // eax@13 | |
7849 unsigned int v16; // edx@14 | |
7850 unsigned int v17; // edx@17 | |
7851 unsigned int v18; // eax@19 | |
7852 unsigned int v19; // edx@20 | |
7853 int v20; // eax@27 | |
7854 int v21; // edx@29 | |
7855 int v22; // [sp+Ch] [bp-Ch]@6 | |
7856 int v23; // [sp+Ch] [bp-Ch]@24 | |
7857 int v24; // [sp+10h] [bp-8h]@6 | |
7858 int v25; // [sp+14h] [bp-4h]@6 | |
7859 int i; // [sp+20h] [bp+8h]@25 | |
7860 int v27; // [sp+24h] [bp+Ch]@23 | |
7861 unsigned __int8 *v28; // [sp+28h] [bp+10h]@6 | |
7862 | |
7863 if ( this->uNumSceneBegins ) | |
7864 { | |
7865 v8 = a4; | |
7866 if ( a4 ) | |
7867 { | |
7868 if ( a4->pPalette16 ) | |
7869 { | |
7870 v9 = a5; | |
7871 if ( a5 ) | |
7872 { | |
7873 if ( a5->pPalette16 ) | |
7874 { | |
7875 v10 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
710 | 7876 v28 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7877 v25 = v8->uTextureWidth; |
7878 v24 = v8->uTextureHeight; | |
7879 v22 = v8->uTextureWidth; | |
7880 if ( this->bClip ) | |
7881 { | |
7882 v11 = this->uClipX; | |
7883 if ( (signed int)a2 < (signed int)v11 ) | |
7884 { | |
7885 v28 += v11 - a2; | |
7886 v25 += a2 - v11; | |
7887 v9 = a5; | |
7888 v10 += v11 - a2; | |
7889 } | |
7890 v12 = this->uClipY; | |
7891 if ( (signed int)a3 < (signed int)v12 ) | |
7892 { | |
7893 v13 = v12 - a3; | |
7894 v9 = a5; | |
7895 v28 += v22 * v13; | |
7896 v24 += a3 - this->uClipY; | |
7897 v10 += this->uTargetSurfacePitch * v13; | |
7898 } | |
7899 v14 = this->uClipX; | |
7900 if ( (signed int)v14 < (signed int)a2 ) | |
7901 v14 = a2; | |
7902 v15 = this->uClipZ; | |
7903 if ( (signed int)(v25 + v14) > (signed int)v15 ) | |
7904 { | |
7905 v16 = this->uClipX; | |
7906 if ( (signed int)v16 < (signed int)a2 ) | |
7907 v16 = a2; | |
7908 v25 = v15 - v16; | |
7909 } | |
7910 v17 = this->uClipY; | |
7911 if ( (signed int)v17 < (signed int)a3 ) | |
7912 v17 = a3; | |
7913 v18 = this->uClipW; | |
7914 if ( (signed int)(v24 + v17) > (signed int)v18 ) | |
7915 { | |
7916 v19 = this->uClipY; | |
7917 if ( (signed int)v19 < (signed int)a3 ) | |
7918 v19 = a3; | |
7919 v24 = v18 - v19; | |
7920 } | |
7921 } | |
7922 v27 = 0; | |
7923 if ( v24 > 0 ) | |
7924 { | |
7925 v23 = v22 - v25; | |
7926 do | |
7927 { | |
7928 for ( i = 0; i < v25; ++v28 ) | |
7929 { | |
7930 if ( *v28 ) | |
7931 { | |
710 | 7932 v20 = *(&v9->pLevelOfDetail0_prolly_alpha_mask[i & v9->uWidthMinus1] + v9->uTextureWidth * (v27 & v9->uHeightMinus1)); |
0 | 7933 if ( v20 >= a7 ) |
7934 { | |
7935 if ( v20 <= a8 ) | |
7936 { | |
7937 v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); | |
7938 if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) | |
7939 v21 = 2 * a8 - v21 - a7; | |
7940 v9 = a5; | |
7941 *v10 = a5->pPalette16[v21]; | |
7942 } | |
7943 } | |
7944 } | |
7945 ++i; | |
7946 ++v10; | |
7947 } | |
7948 ++v27; | |
7949 v10 += this->uTargetSurfacePitch - v25; | |
7950 v28 += v23; | |
7951 } | |
7952 while ( v27 < v24 ); | |
7953 } | |
7954 } | |
7955 } | |
7956 } | |
7957 } | |
7958 } | |
7959 } | |
7960 | |
7961 //----- (004A6274) -------------------------------------------------------- | |
7962 void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture) | |
7963 { | |
7964 Texture *pCurrentTexture; // edi@2 | |
7965 int uHeight; // ebx@4 | |
7966 unsigned __int16 *v6; // eax@4 | |
7967 unsigned int v7; // edx@5 | |
7968 unsigned int v8; // edx@6 | |
7969 unsigned int v9; // edx@7 | |
7970 unsigned int v10; // edx@8 | |
7971 unsigned int v11; // edx@9 | |
7972 unsigned int v12; // esi@12 | |
7973 unsigned int v13; // esi@15 | |
7974 unsigned int v14; // edx@17 | |
7975 unsigned int v15; // esi@18 | |
7976 unsigned __int8 *v16; // ebx@22 | |
7977 char uFlag; // zf@28 | |
7978 int v18; // [sp+10h] [bp-10h]@4 | |
7979 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
7980 int uWidth; // [sp+1Ch] [bp-4h]@4 | |
7981 int uXa; // [sp+28h] [bp+8h]@24 | |
7982 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 | |
7983 unsigned int pTexturea; // [sp+30h] [bp+10h]@11 | |
7984 | |
7985 if ( this->uNumSceneBegins ) | |
7986 { | |
7987 pCurrentTexture = pTexture; | |
7988 if ( pTexture ) | |
7989 { | |
7990 if ( pTexture->pPalette16 ) | |
7991 { | |
7992 uHeight = pTexture->uTextureHeight; | |
7993 v6 = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; | |
710 | 7994 v19 = pTexture->pLevelOfDetail0_prolly_alpha_mask; |
0 | 7995 uWidth = pTexture->uTextureWidth; |
7996 v18 = pTexture->uTextureWidth; | |
7997 if ( this->bClip ) | |
7998 { | |
7999 v7 = this->uClipX; | |
8000 if ( (signed int)uX < (signed int)v7 ) | |
8001 { | |
8002 v8 = v7 - uX; | |
8003 v19 += v8; | |
8004 uWidth += uX - this->uClipX; | |
8005 v6 += v8; | |
8006 } | |
8007 v9 = this->uClipY; | |
8008 uHeight = pTexture->uTextureHeight; | |
8009 if ( (signed int)uY < (signed int)v9 ) | |
8010 { | |
8011 v10 = v9 - uY; | |
8012 v19 += v18 * v10; | |
8013 uHeight = uY - this->uClipY + pTexture->uTextureHeight; | |
8014 pCurrentTexture = pTexture; | |
8015 v6 += this->uTargetSurfacePitch * v10; | |
8016 } | |
8017 v11 = this->uClipX; | |
8018 if ( (signed int)v11 < (signed int)uX ) | |
8019 v11 = uX; | |
8020 pTexturea = this->uClipZ; | |
8021 if ( (signed int)(v11 + uWidth) > (signed int)pTexturea ) | |
8022 { | |
8023 v12 = this->uClipX; | |
8024 if ( (signed int)v12 < (signed int)uX ) | |
8025 v12 = uX; | |
8026 uWidth = pTexturea - v12; | |
8027 } | |
8028 v13 = this->uClipY; | |
8029 if ( (signed int)v13 < (signed int)uY ) | |
8030 v13 = uY; | |
8031 v14 = this->uClipW; | |
8032 if ( (signed int)(uHeight + v13) > (signed int)v14 ) | |
8033 { | |
8034 v15 = this->uClipY; | |
8035 if ( (signed int)v15 < (signed int)uY ) | |
8036 v15 = uY; | |
8037 uHeight = v14 - v15; | |
8038 } | |
8039 } | |
8040 if ( (signed int)uHeight > 0 ) | |
8041 { | |
8042 uYa = uHeight; | |
8043 v16 = v19; | |
8044 do | |
8045 { | |
8046 if ( uWidth > 0 ) | |
8047 { | |
8048 uXa = uWidth; | |
8049 do | |
8050 { | |
8051 if ( *v16 ) | |
8052 *v6 = pCurrentTexture->pPalette16[*v16]; | |
8053 ++v6; | |
8054 ++v16; | |
8055 } | |
8056 while ( uXa-- !=1 ); | |
8057 } | |
8058 v16 += v18 - uWidth; | |
8059 uFlag = uYa-- == 1; | |
8060 v6 += this->uTargetSurfacePitch - uWidth; | |
8061 } | |
8062 while ( !uFlag ); | |
8063 } | |
8064 } | |
8065 } | |
8066 } | |
8067 } | |
8068 | |
8069 //----- (004A612A) -------------------------------------------------------- | |
710 | 8070 void Render::DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal) |
0 | 8071 { |
8072 Texture *v5; // eax@2 | |
8073 unsigned int v6; // edx@3 | |
8074 int v7; // ebx@3 | |
8075 int v8; // edi@3 | |
8076 signed int v9; // eax@4 | |
8077 int v10; // eax@5 | |
8078 unsigned int v11; // esi@6 | |
8079 signed int v12; // esi@8 | |
8080 unsigned int v13; // eax@10 | |
8081 signed int v14; // esi@11 | |
8082 unsigned int v15; // esi@14 | |
8083 unsigned int v16; // eax@16 | |
8084 unsigned int v17; // ecx@17 | |
8085 int v18; // edx@23 | |
8086 int v19; // [sp+Ch] [bp-Ch]@3 | |
8087 int v20; // [sp+10h] [bp-8h]@3 | |
8088 int uOutXa; // [sp+20h] [bp+8h]@21 | |
8089 unsigned __int8 *uOutYa; // [sp+24h] [bp+Ch]@3 | |
8090 int *pZBuffer; // [sp+28h] [bp+10h]@3 | |
8091 | |
8092 if ( this->uNumSceneBegins ) | |
8093 { | |
8094 v5 = pTexture; | |
8095 if ( pTexture ) | |
8096 { | |
8097 v6 = uOutY; | |
8098 v7 = pTexture->uTextureHeight; | |
8099 pZBuffer = &this->pActiveZBuffer[uOutX + 640 * uOutY]; | |
710 | 8100 uOutYa = v5->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8101 v8 = v5->uTextureWidth; |
8102 v20 = v5->uTextureWidth; | |
8103 v19 = v5->uTextureWidth; | |
8104 if ( this->bClip ) | |
8105 { | |
8106 v9 = this->uClipX; | |
8107 if ( uOutX < v9 ) | |
8108 { | |
8109 v10 = v9 - uOutX; | |
8110 uOutYa += v10; | |
8111 v8 += uOutX - this->uClipX; | |
8112 v20 = v8; | |
8113 pZBuffer += v10; | |
8114 } | |
8115 v11 = this->uClipY; | |
8116 if ( (signed int)v6 < (signed int)v11 ) | |
8117 { | |
8118 uOutYa += v19 * (v11 - v6); | |
8119 v7 += v6 - v11; | |
8120 pZBuffer += 640 * (v11 - v6); | |
8121 v8 = v20; | |
8122 } | |
8123 v12 = this->uClipX; | |
8124 if ( v12 < uOutX ) | |
8125 v12 = uOutX; | |
8126 v13 = this->uClipZ; | |
8127 if ( v8 + v12 > (signed int)v13 ) | |
8128 { | |
8129 v14 = this->uClipX; | |
8130 if ( v14 < uOutX ) | |
8131 v14 = uOutX; | |
8132 v8 = v13 - v14; | |
8133 } | |
8134 v15 = this->uClipY; | |
8135 if ( (signed int)v15 < (signed int)v6 ) | |
8136 v15 = v6; | |
8137 v16 = this->uClipW; | |
8138 if ( (signed int)(v7 + v15) > (signed int)v16 ) | |
8139 { | |
8140 v17 = this->uClipY; | |
8141 if ( (signed int)v17 >= (signed int)v6 ) | |
8142 v6 = v17; | |
8143 v7 = v16 - v6; | |
8144 } | |
8145 } | |
8146 if ( v7 > 0 ) | |
8147 { | |
8148 uOutXa = v7; | |
8149 do | |
8150 { | |
8151 if ( v8 > 0 ) | |
8152 { | |
8153 v18 = v8; | |
8154 do | |
8155 { | |
8156 if ( *uOutYa ) | |
8157 *pZBuffer = zVal; | |
8158 ++pZBuffer; | |
8159 ++uOutYa; | |
8160 --v18; | |
8161 } | |
8162 while ( v18 ); | |
8163 } | |
8164 pZBuffer += 640 - v8; | |
8165 uOutYa += v19 - v8; | |
8166 --uOutXa; | |
8167 } | |
8168 while ( uOutXa ); | |
8169 } | |
8170 } | |
8171 } | |
8172 } | |
8173 | |
8174 //----- (004A601E) -------------------------------------------------------- | |
991 | 8175 void Render::ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5) |
0 | 8176 { |
8177 signed int v5; // edx@3 | |
8178 int v6; // ebx@3 | |
8179 int v7; // esi@3 | |
8180 void *v8; // esi@3 | |
8181 unsigned int v9; // eax@4 | |
8182 unsigned int v10; // eax@6 | |
8183 signed int v11; // edi@8 | |
8184 unsigned int v12; // eax@10 | |
8185 signed int v13; // edi@11 | |
8186 unsigned int v14; // edi@14 | |
8187 unsigned int v15; // eax@16 | |
8188 unsigned int v16; // ecx@17 | |
8189 int v17; // [sp+18h] [bp+Ch]@3 | |
8190 unsigned int pTexturea; // [sp+1Ch] [bp+10h]@3 | |
8191 | |
8192 if ( this->uNumSceneBegins && pTexture ) | |
8193 { | |
8194 v5 = a3; | |
8195 v6 = pTexture->uTextureHeight; | |
8196 v7 = 5 * a3; | |
8197 v17 = pTexture->uTextureHeight; | |
8198 v8 = &this->pActiveZBuffer[a2 + (v7 << 7)]; | |
8199 pTexturea = pTexture->uTextureWidth; | |
8200 if ( this->bClip ) | |
8201 { | |
8202 v9 = this->uClipX; | |
8203 if ( a2 < (signed int)v9 ) | |
8204 { | |
8205 pTexturea += a2 - v9; | |
8206 v8 = (char *)v8 + 4 * (v9 - a2); | |
8207 } | |
8208 v10 = this->uClipY; | |
8209 if ( v5 < (signed int)v10 ) | |
8210 { | |
8211 v17 += v5 - v10; | |
8212 v8 = (char *)v8 + 2560 * (v10 - v5); | |
8213 } | |
8214 v11 = this->uClipX; | |
8215 if ( v11 < a2 ) | |
8216 v11 = a2; | |
8217 v12 = this->uClipZ; | |
8218 if ( (signed int)(pTexturea + v11) > (signed int)v12 ) | |
8219 { | |
8220 v13 = this->uClipX; | |
8221 if ( v13 < a2 ) | |
8222 v13 = a2; | |
8223 pTexturea = v12 - v13; | |
8224 } | |
8225 v14 = this->uClipY; | |
8226 if ( (signed int)v14 < v5 ) | |
8227 v14 = v5; | |
8228 v6 = v17; | |
8229 v15 = this->uClipW; | |
8230 if ( (signed int)(v17 + v14) > (signed int)v15 ) | |
8231 { | |
8232 v16 = this->uClipY; | |
8233 if ( (signed int)v16 < v5 ) | |
8234 v16 = v5; | |
8235 v6 = v15 - v16; | |
8236 } | |
8237 } | |
8238 if ( v6 > 0 ) | |
8239 { | |
8240 do | |
8241 { | |
8242 if ( (signed int)pTexturea > 0 ) | |
8243 { | |
8244 memset32(v8, a5, pTexturea); | |
8245 v8 = (char *)v8 + 4 * pTexturea; | |
8246 } | |
8247 v8 = (char *)v8 + 4 * (640 - pTexturea); | |
8248 --v6; | |
8249 } | |
8250 while ( v6 ); | |
8251 } | |
8252 } | |
8253 } | |
8254 | |
8255 //----- (004A5EB2) -------------------------------------------------------- | |
8256 void Render::DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4) | |
8257 { | |
8258 Texture *v4; // edi@2 | |
8259 unsigned int v5; // ebx@4 | |
8260 unsigned __int16 *pTarget; // eax@4 | |
8261 unsigned int v7; // edx@5 | |
8262 unsigned int v8; // edx@6 | |
8263 unsigned int v9; // edx@7 | |
8264 unsigned int v10; // edx@8 | |
8265 unsigned int v11; // edx@9 | |
8266 unsigned int v12; // esi@12 | |
8267 unsigned int v13; // esi@15 | |
8268 unsigned int v14; // edx@17 | |
8269 unsigned int v15; // esi@18 | |
8270 unsigned __int8 *v16; // edx@22 | |
8271 char v17; // zf@26 | |
8272 int v18; // [sp+10h] [bp-10h]@4 | |
8273 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | |
8274 int v20; // [sp+1Ch] [bp-4h]@4 | |
8275 int uXa; // [sp+28h] [bp+8h]@24 | |
8276 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 | |
8277 unsigned int v23; // [sp+30h] [bp+10h]@11 | |
8278 | |
8279 if ( this->uNumSceneBegins ) | |
8280 { | |
8281 v4 = a4; | |
8282 if ( a4 ) | |
8283 { | |
8284 if ( a4->pPalette16 ) | |
8285 { | |
8286 v5 = a4->uTextureHeight; | |
8287 pTarget = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; | |
710 | 8288 v19 = a4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 8289 v20 = a4->uTextureWidth; |
8290 v18 = a4->uTextureWidth; | |
8291 if ( this->bClip ) | |
8292 { | |
8293 v7 = this->uClipX; | |
8294 if ( (signed int)uX < (signed int)v7 ) | |
8295 { | |
8296 v8 = v7 - uX; | |
8297 v19 += v8; | |
8298 v20 += uX - this->uClipX; | |
8299 pTarget += v8; | |
8300 } | |
8301 v9 = this->uClipY; | |
8302 v5 = a4->uTextureHeight; | |
8303 if ( (signed int)uY < (signed int)v9 ) | |
8304 { | |
8305 v10 = v9 - uY; | |
8306 v19 += v18 * v10; | |
8307 v5 = uY - this->uClipY + a4->uTextureHeight; | |
8308 v4 = a4; | |
8309 pTarget += this->uTargetSurfacePitch * v10; | |
8310 } | |
8311 v11 = this->uClipX; | |
8312 if ( (signed int)v11 < (signed int)uX ) | |
8313 v11 = uX; | |
8314 v23 = this->uClipZ; | |
8315 if ( (signed int)(v11 + v20) > (signed int)v23 ) | |
8316 { | |
8317 v12 = this->uClipX; | |
8318 if ( (signed int)v12 < (signed int)uX ) | |
8319 v12 = uX; | |
8320 v20 = v23 - v12; | |
8321 } | |
8322 v13 = this->uClipY; | |
8323 if ( (signed int)v13 < (signed int)uY ) | |
8324 v13 = uY; | |
8325 v14 = this->uClipW; | |
8326 if ( (signed int)(v5 + v13) > (signed int)v14 ) | |
8327 { | |
8328 v15 = this->uClipY; | |
8329 if ( (signed int)v15 < (signed int)uY ) | |
8330 v15 = uY; | |
8331 v5 = v14 - v15; | |
8332 } | |
8333 } | |
8334 if ( (signed int)v5 > 0 ) | |
8335 { | |
8336 uYa = v5; | |
8337 v16 = v19; | |
8338 do | |
8339 { | |
8340 if ( v20 > 0 ) | |
8341 { | |
8342 uXa = v20; | |
8343 do | |
8344 { | |
8345 *pTarget = v4->pPalette16[*v16]; | |
8346 ++pTarget; | |
8347 ++v16; | |
8348 --uXa; | |
8349 } | |
8350 while ( uXa ); | |
8351 } | |
8352 v16 += v18 - v20; | |
8353 v17 = uYa-- == 1; | |
8354 pTarget += this->uTargetSurfacePitch - v20; | |
8355 } | |
8356 while ( !v17 ); | |
8357 } | |
8358 } | |
8359 } | |
8360 } | |
8361 } | |
8362 | |
8363 //----- (004667E9) -------------------------------------------------------- | |
8364 void Render::ChangeBetweenWinFullscreenModes() | |
8365 { | |
8366 float v0; // ST14_4@17 | |
8367 int v4; // edx@26 | |
8368 ObjectDesc *v5; // eax@26 | |
8369 RGBTexture *v6; // esi@33 | |
8370 const char *v8; // [sp-4h] [bp-28h]@33 | |
8371 struct tagRECT Rect; // [sp+14h] [bp-10h]@15 | |
8372 | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8373 if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) ) |
0 | 8374 { |
1458 | 8375 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 | 8376 return; |
8377 } | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8378 if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8379 { |
0 | 8380 if ( pEventTimer->bPaused ) |
8381 BYTE1(dword_6BE364_game_settings_1) |= 8u; | |
8382 else | |
8383 pEventTimer->Pause(); | |
8384 if ( pMiscTimer->bPaused ) | |
8385 BYTE1(dword_6BE364_game_settings_1) |= 0x10u; | |
8386 else | |
8387 pMiscTimer->Pause(); | |
8388 pMouse->bActive = 0; | |
8389 if ( pRenderer->pRenderD3D ) | |
8390 { | |
8391 pBitmaps_LOD->ReleaseHardwareTextures(); | |
8392 pSprites_LOD->ReleaseAll(); | |
8393 } | |
8394 if ( pRenderer->bWindowMode ) | |
8395 { | |
8396 if ( GetWindowRect(hWnd, &Rect) ) | |
8397 { | |
8398 WriteWindowsRegistryInt("window X", Rect.left); | |
8399 WriteWindowsRegistryInt("window Y", Rect.top); | |
8400 uWindowX = Rect.left; | |
8401 uWindowY = Rect.top; | |
8402 } | |
8403 SetMenu(hWnd, 0); | |
8404 SetWindowLongA(hWnd, -20, 0); | |
8405 SetWindowLongA(hWnd, -16, 0x10000000u); | |
8406 pRenderer->InitializeFullscreen(hWnd); | |
8407 v0 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
8408 pGame->pGammaController->Initialize(v0); | |
8409 } | |
8410 else | |
8411 { | |
8412 ClipCursor(0); | |
8413 pRenderer->SwitchToWindow(hWnd); | |
8414 SetWindowLongA(hWnd, -16, uWindowStyle); | |
8415 } | |
8416 if ( pRenderer->pRenderD3D ) | |
8417 { | |
8418 pBitmaps_LOD->_410423_move_textures_to_device(); | |
8419 pSprites_LOD->MoveSpritesToVideoMemory(); | |
8420 } | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8421 if (!( pPaletteManager->uNumTargetBBits == pRenderer->uTargetBBits |
0 | 8422 && pPaletteManager->uNumTargetGBits == pRenderer->uTargetGBits |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8423 && pPaletteManager->uNumTargetRBits == pRenderer->uTargetRBits )) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8424 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8425 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8426 pPaletteManager->RecalculateAll(); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8427 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8428 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8429 for (int i = 0; i < pObjectList->uNumObjects; i++) |
0 | 8430 { |
8431 BYTE3(v4) = 0; | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8432 v5 = &pObjectList->pObjects[i]; |
0 | 8433 *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR; |
8434 LOBYTE(v4) = v5->uParticleTrailColorG; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1110
diff
changeset
|
8435 v5->uParticleTrailColor = v5->uParticleTrailColorB | (v4 << 8); |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8436 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8437 SetUserInterface(pParty->alignment, true); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8438 if ( pVideoPlayer->pVideoFrame.pPixels ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8439 pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1); |
0 | 8440 if ( uCurrentMenuID != 6 ) |
8441 { | |
8442 if ( uCurrentMenuID == 8 ) | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8443 dword_A74C88 = 1; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8444 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8445 else |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8446 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8447 if ( uCurrentMenuID ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8448 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8449 v6 = &pTexture_PCX; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8450 pTexture_PCX.Release(); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8451 v8 = "makeme.pcx"; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8452 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8453 else |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8454 { |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8455 v6 = &pTexture_PCX; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8456 pTexture_PCX.Release(); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8457 v8 = "title.pcx"; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8458 if ( uCurrentMenuID ) |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8459 v8 = "lsave640.pcx"; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8460 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8461 v6->Load(v8, 0); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8462 } |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8463 } |
0 | 8464 viewparams->bRedrawGameUI = 1; |
688 | 8465 viewparams->InitGrayPalette(); |
0 | 8466 pMouse->SetCurrentCursorBitmap(); |
8467 if ( pRenderer->bWindowMode ) | |
8468 { | |
8469 InvalidateRect(0, 0, 0); | |
8470 MoveWindow(hWnd, uWindowX, uWindowY, uWindowWidth, uWindowHeight, 0); | |
8471 ShowWindow(hWnd, 1); | |
8472 } | |
8473 pMouse->bActive = 1; | |
8474 if ( pVideoPlayer->AnyMovieLoaded() ) | |
898 | 8475 pVideoPlayer->SelectMovieType(); |
0 | 8476 if ( BYTE1(dword_6BE364_game_settings_1) & 8 ) |
8477 BYTE1(dword_6BE364_game_settings_1) &= 0xF7u; | |
8478 else | |
8479 pEventTimer->Resume(); | |
8480 if ( BYTE1(dword_6BE364_game_settings_1) & 0x10 ) | |
8481 BYTE1(dword_6BE364_game_settings_1) &= 0xEFu; | |
8482 else | |
8483 pMiscTimer->Resume(); | |
8484 } | |
8485 } | |
8486 // 6BE364: using guessed type int dword_6BE364_game_settings_1; | |
8487 // A74C88: using guessed type int dword_A74C88; | |
8488 | |
8489 | |
8490 //----- (004524D8) -------------------------------------------------------- | |
8491 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) | |
8492 { | |
8493 int v11; // eax@13 | |
8494 int v12; // ecx@13 | |
8495 void *v13; // eax@13 | |
8496 unsigned __int8 v14; // zf@13 | |
8497 unsigned __int8 v15; // sf@13 | |
8498 int v16; // esi@14 | |
8499 int v17; // ecx@16 | |
8500 int v18; // esi@16 | |
8501 unsigned __int16 *v19; // eax@16 | |
8502 int v20; // edx@16 | |
8503 int v21; // ecx@16 | |
8504 int v22; // eax@16 | |
8505 int v23; // esi@16 | |
8506 unsigned __int16 *v26; // [sp+24h] [bp-10h]@13 | |
8507 int v27; // [sp+28h] [bp-Ch]@14 | |
8508 int v28; // [sp+2Ch] [bp-8h]@13 | |
8509 int pDestb; // [sp+3Ch] [bp+8h]@15 | |
8510 | |
8511 //v3 = this; | |
8512 //sprintf(Str1, "%s", pName); | |
8513 //v4 = uNumItems; | |
8514 if (!uNumItems) | |
8515 return nullptr; | |
8516 | |
8517 //{ | |
8518 //v5 = 0, pDesta = uNumItems; | |
8519 uint idx1 = 0, | |
8520 idx2 = uNumItems; | |
8521 while (true) | |
8522 { | |
8523 auto i = idx1 + (idx2 - idx1) / 2; | |
8524 | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1164
diff
changeset
|
8525 auto res = _stricmp(pName, pSpriteNames[i]); |
0 | 8526 if (!res) |
8527 { | |
8528 fseek(pFile, pSpriteOffsets[i], SEEK_SET); | |
8529 break; | |
8530 } | |
8531 else if (res < 0) | |
8532 idx2 = idx1 + (idx2 - idx1) / 2; | |
8533 else | |
8534 idx1 = i + 1; | |
8535 | |
8536 if ( idx1 >= idx2 ) | |
8537 return false; | |
8538 } | |
8539 | |
8540 | |
8541 uint uCompressedSize = 0; | |
8542 fread(&uCompressedSize, 4, 1, pFile); | |
8543 | |
8544 auto pTex = new HWLTexture; | |
670 | 8545 fread(&pTex->uBufferWidth, 4, 1, pFile); |
8546 fread(&pTex->uBufferHeight, 4, 1, pFile); | |
8547 fread(&pTex->uAreaWidth, 4, 1, pFile); | |
8548 fread(&pTex->uAreaHeigth, 4, 1, pFile); | |
0 | 8549 fread(&pTex->uWidth, 4, 1, pFile); |
8550 fread(&pTex->uHeight, 4, 1, pFile); | |
670 | 8551 fread(&pTex->uAreaX, 4, 1, pFile); |
8552 fread(&pTex->uAreaY, 4, 1, pFile); | |
0 | 8553 |
8554 pTex->pPixels = new unsigned __int16[pTex->uWidth * pTex->uHeight]; | |
8555 if (uCompressedSize) | |
8556 { | |
8557 auto pCompressedData = new char[uCompressedSize]; | |
8558 { | |
8559 fread(pCompressedData, 1, uCompressedSize, pFile); | |
8560 auto uDecompressedSize = pTex->uWidth * pTex->uHeight * sizeof(short); | |
8561 zlib::MemUnzip(pTex->pPixels, &uDecompressedSize, pCompressedData, uCompressedSize); | |
8562 } | |
8563 delete [] pCompressedData; | |
8564 } | |
8565 else | |
8566 fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); | |
8567 | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8568 if ( field_61A94_scale_hwls_to_half ) //is it even possible to ever get here? field_61A94_scale_hwls_to_half is only set to zero |
0 | 8569 { |
8570 v11 = pTex->uHeight / 2; | |
8571 v12 = pTex->uWidth / 2; | |
8572 pTex->uHeight = v11; | |
8573 pTex->uWidth = v12; | |
8574 v13 = new unsigned __int16[v12 * v11]; | |
8575 v28 = 0; | |
8576 v14 = pTex->uHeight == 0; | |
8577 v15 = (pTex->uHeight & 0x80000000u) != 0; | |
8578 v26 = (unsigned __int16 *)v13; | |
8579 if ( !(v15 | v14) ) | |
8580 { | |
8581 v16 = pTex->uWidth; | |
8582 v27 = 1; | |
8583 do | |
8584 { | |
8585 pDestb = 0; | |
8586 if ( v16 > 0 ) | |
8587 { | |
8588 do | |
8589 { | |
8590 v17 = v16 * v27; | |
8591 v18 = v28 * v16; | |
8592 v19 = pTex->pPixels; | |
8593 v20 = pDestb + 2 * v18; | |
8594 v21 = (int)&v19[2 * (pDestb + v17)]; | |
8595 v22 = (int)&v19[2 * v20]; | |
8596 LOWORD(v20) = *(unsigned short *)(v21 + 2); | |
8597 LOWORD(v21) = *(unsigned short *)v21; | |
8598 v23 = pDestb++ + v18; | |
8599 v26[v23] = sub_452442(*(unsigned short *)v22, *(unsigned short *)(v22 + 2), v21, v20); | |
8600 v16 = pTex->uWidth; | |
8601 } | |
8602 while (pDestb < pTex->uWidth); | |
8603 } | |
8604 ++v28; | |
8605 v27 += 2; | |
8606 } | |
8607 while ( v28 < (signed int)pTex->uHeight ); | |
8608 } | |
8609 delete [] pTex->pPixels; | |
8610 pTex->pPixels = v26; | |
8611 } | |
8612 return pTex; | |
8613 //result = pTex; | |
8614 // } | |
8615 // else | |
8616 // { | |
8617 //LABEL_8: | |
8618 // return nullptr; | |
8619 // } | |
8620 } | |
8621 | |
8622 //----- (0045271F) -------------------------------------------------------- | |
8623 bool RenderHWLContainer::Release() | |
8624 { | |
8625 __int32 v4; // eax@6 | |
8626 FILE *v5; // ST24_4@6 | |
8627 FILE *File; // [sp+4h] [bp-4h]@6 | |
8628 | |
1162 | 8629 if ( this->bDumpDebug) |
0 | 8630 { |
8631 File = fopen("logd3d.txt", "w"); | |
1162 | 8632 v4 = ftell(this->pFile); |
8633 v5 = this->pFile; | |
8634 this->uDataOffset = v4; | |
8635 fwrite(&this->uNumItems, 4u, 1u, v5); | |
8636 for (int i = 0; i < this->uNumItems; i++) | |
8637 { | |
8638 fwrite(this->pSpriteNames[i], 1u, 0x14u, this->pFile); | |
8639 fprintf(File, "D3D texture name: %s\t\toffset: %x\n", this->pSpriteNames[i], *(unsigned int *)(&(this->pSpriteNames[i]) + 200000/sizeof(char*))); | |
8640 } | |
8641 fwrite(this->pSpriteOffsets, 4u, this->uNumItems, this->pFile); | |
8642 fseek(this->pFile, 4, 0); | |
8643 fwrite(&this->uDataOffset, 4u, 1u, this->pFile); | |
8644 fclose(this->pFile); | |
0 | 8645 fclose(File); |
8646 } | |
8647 else | |
8648 { | |
8649 fclose(this->pFile); | |
1162 | 8650 for (int i = 0; i < this->uNumItems; i++) |
8651 { | |
8652 free(this->pSpriteNames[i]); | |
0 | 8653 } |
8654 } | |
1093 | 8655 return true; |
0 | 8656 } |
8657 | |
8658 //----- (00452347) -------------------------------------------------------- | |
8659 RenderHWLContainer::RenderHWLContainer(): | |
8660 bDumpDebug(false) | |
8661 { | |
8662 this->pFile = 0; | |
8663 uSignature = 0; | |
1164
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8664 this->uDataOffset = 0; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8665 memset(&this->uNumItems, 0, 0x61A84u); |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8666 this->uNumItems = 0; |
6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
Grumpy7
parents:
1162
diff
changeset
|
8667 this->field_61A94_scale_hwls_to_half = 0; |
0 | 8668 } |
8669 | |
8670 //----- (0045237F) -------------------------------------------------------- | |
8671 bool RenderHWLContainer::Load(const wchar_t *pFilename) | |
8672 { | |
8673 pFile = _wfopen(pFilename, L"rb"); | |
8674 if (!pFile) | |
8675 { | |
8676 Log::Warning(L"Failed to open file: %s", pFilename); | |
8677 return false; | |
8678 } | |
8679 | |
8680 fread(&uSignature, 1, 4, pFile); | |
8681 if (uSignature != 'TD3D') | |
8682 { | |
8683 Log::Warning(L"Invalid format: %s", pFilename); | |
8684 return false; | |
8685 } | |
8686 | |
8687 fread(&uDataOffset, 4, 1, pFile); | |
8688 fseek(pFile, uDataOffset, SEEK_SET); | |
8689 fread(&uNumItems, 4, 1, pFile); | |
8690 | |
8691 memset(pSpriteNames, 0, 50000 * sizeof(char *)); | |
8692 for (uint i = 0; i < uNumItems; ++i) | |
8693 { | |
8694 pSpriteNames[i] = new char[20]; | |
8695 fread(pSpriteNames[i], 1, 20, pFile); | |
8696 } | |
8697 fread(pSpriteOffsets, 4, uNumItems, pFile); | |
8698 | |
8699 return true; | |
8700 } | |
8701 | |
8702 //----- (004A1C1E) -------------------------------------------------------- | |
8703 void DoRenderBillboards_D3D() | |
8704 { | |
186 | 8705 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); |
8706 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
8707 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8708 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8709 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8710 /*if (pRenderer->uNumBillboardsToDraw) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8711 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8712 auto p = &pRenderer->pBillboardRenderListD3D[0]; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8713 for (int i = 0; i < p->uNumVertices; ++i) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8714 { |
1390 | 8715 p->pQuads[i].pos.z -= p->pQuads[i].pos.z * 0.6; |
8716 //p->pQuads[i].rhw = + 0.8 * (1.0f - p->pQuads[i].rhw); | |
8717 } | |
8718 p->pQuads[0].pos.x = 10; | |
8719 p->pQuads[0].pos.y = 10; | |
8720 | |
8721 p->pQuads[1].pos.x = 10; | |
8722 p->pQuads[1].pos.y = 200; | |
8723 | |
8724 p->pQuads[2].pos.x = 100; | |
8725 p->pQuads[2].pos.y = 200; | |
8726 | |
8727 p->pQuads[3].pos.x = 100; | |
8728 p->pQuads[3].pos.y = 10; | |
144
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 if (p->uOpacity != RenderBillboardD3D::NoBlend) |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8731 SetBillboardBlendOptions(p->uOpacity); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8732 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8733 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8734 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8735 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1390 | 8736 p->pQuads, p->uNumVertices, |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8737 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8738 |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8739 }*/ |
0 | 8740 |
8741 for (uint i = pRenderer->uNumBillboardsToDraw - 1; i != (uint)-1; --i) | |
8742 { | |
101 | 8743 auto p = &pRenderer->pBillboardRenderListD3D[i]; |
0 | 8744 |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8745 if (p->uOpacity != RenderBillboardD3D::NoBlend) |
0 | 8746 SetBillboardBlendOptions(p->uOpacity); |
8747 | |
101 | 8748 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8749 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8750 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
1390 | 8751 p->pQuads, p->uNumVertices, |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8752 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); |
0 | 8753 } |
8754 | |
8755 if (pRenderer->bFogEnabled) | |
8756 { | |
8757 pRenderer->bFogEnabled = false; | |
186 | 8758 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 8759 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); |
8760 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
8761 } | |
186 | 8762 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
8763 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
8764 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
8765 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
8766 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
8767 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
0 | 8768 } |
8769 | |
8770 //----- (004A1DA8) -------------------------------------------------------- | |
8771 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1) | |
8772 { | |
8773 switch (a1) | |
8774 { | |
8775 case RenderBillboardD3D::Transparent: | |
8776 { | |
8777 if (pRenderer->bFogEnabled) | |
8778 { | |
8779 pRenderer->bFogEnabled = false; | |
186 | 8780 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
0 | 8781 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); |
8782 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
8783 } | |
8784 | |
186 | 8785 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); |
8786 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); | |
8787 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); | |
0 | 8788 } |
8789 break; | |
8790 | |
8791 case RenderBillboardD3D::Opaque_1: | |
8792 case RenderBillboardD3D::Opaque_2: | |
8793 case RenderBillboardD3D::Opaque_3: | |
8794 { | |
8795 if (pRenderer->bUsingSpecular) | |
8796 { | |
8797 if (!pRenderer->bFogEnabled) | |
8798 { | |
8799 pRenderer->bFogEnabled = true; | |
186 | 8800 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
8801 } | |
8802 } | |
8803 | |
8804 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
8805 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | |
8806 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | |
0 | 8807 } |
8808 break; | |
8809 | |
8810 default: | |
8811 Log::Warning(L"SetBillboardBlendOptions: invalid opacity type (%u)", a1); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
143
diff
changeset
|
8812 assert(false); |
0 | 8813 break; |
8814 } | |
8815 } | |
1297 | 8816 //----- (0040DF3D) -------------------------------------------------------- |
1458 | 8817 void CallRenderPresent() |
1297 | 8818 { |
8819 pRenderer->Present(); | |
8820 } |