Mercurial > might-and-magic-trilogy
comparison Render.cpp @ 49:25fabc49627b
Слияние
author | Ritor1 |
---|---|
date | Tue, 23 Oct 2012 17:34:20 +0600 |
parents | 8a8dd0164b12 |
children | fde5c5acb66e |
comparison
equal
deleted
inserted
replaced
48:6a62c4005f0e | 49:25fabc49627b |
---|---|
61 | 61 |
62 | 62 |
63 | 63 |
64 | 64 |
65 | 65 |
66 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); | |
66 | 67 |
67 | 68 |
68 /* 384 */ | 69 /* 384 */ |
69 #pragma pack(push, 1) | 70 #pragma pack(push, 1) |
70 struct PCXHeader_1 | 71 struct PCXHeader_1 |
171 | 172 |
172 | 173 |
173 //----- (00440CB8) -------------------------------------------------------- | 174 //----- (00440CB8) -------------------------------------------------------- |
174 void Render::DrawBillboardList_BLV() | 175 void Render::DrawBillboardList_BLV() |
175 { | 176 { |
176 int v0; // ebx@1 | |
177 char *v1; // esi@2 | |
178 __int16 v2; // ax@3 | 177 __int16 v2; // ax@3 |
179 unsigned __int16 *v3; // eax@6 | |
180 char v4; // zf@6 | |
181 int v5; // eax@11 | 178 int v5; // eax@11 |
182 RenderBillboardTransform_local0 soft_billboard; // [sp+4h] [bp-50h]@1 | 179 RenderBillboardTransform_local0 soft_billboard; // [sp+4h] [bp-50h]@1 |
183 | 180 |
184 soft_billboard.uParentBillboardID = -1; | 181 soft_billboard.uParentBillboardID = -1; |
185 soft_billboard.pTarget = pBLVRenderParams->pRenderTarget; | 182 soft_billboard.pTarget = pBLVRenderParams->pRenderTarget; |
187 soft_billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; | 184 soft_billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; |
188 soft_billboard.uViewportX = pBLVRenderParams->uViewportX; | 185 soft_billboard.uViewportX = pBLVRenderParams->uViewportX; |
189 soft_billboard.uViewportY = pBLVRenderParams->uViewportY; | 186 soft_billboard.uViewportY = pBLVRenderParams->uViewportY; |
190 soft_billboard.uViewportZ = pBLVRenderParams->uViewportZ - 1; | 187 soft_billboard.uViewportZ = pBLVRenderParams->uViewportZ - 1; |
191 soft_billboard.uViewportW = pBLVRenderParams->uViewportW; | 188 soft_billboard.uViewportW = pBLVRenderParams->uViewportW; |
192 v0 = 0; | 189 |
193 pOutdoorCamera->field_3C = uNumBillboardsToDraw; | 190 pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw; |
194 if ( (signed int)uNumBillboardsToDraw > 0 ) | 191 |
195 { | 192 for (uint i = 0; i < uNumBillboardsToDraw; ++i) |
196 v1 = (char *)&pBillboardRenderList[0].field_28; | 193 { |
197 do | 194 auto p = pBillboardRenderList + i; |
198 { | 195 |
199 soft_billboard.field_8 = *((short *)v1 - 1); | 196 soft_billboard.uScreenSpaceX = p->uScreenSpaceX; |
200 soft_billboard.uParentBillboardID = v0; | 197 soft_billboard.uParentBillboardID = i; |
201 soft_billboard.field_C = *(short *)v1; | 198 soft_billboard.uScreenSpaceY = p->uScreenSpaceY; |
202 soft_billboard.field_10 = *((int *)v1 - 10); | 199 soft_billboard.field_10 = p->field_0; |
203 soft_billboard.field_14 = *((int *)v1 - 9); | 200 soft_billboard.field_14 = p->field_4; |
204 soft_billboard.field_28 = *((int *)v1 - 6); | 201 soft_billboard.sZValue = p->sZValue; |
205 soft_billboard.uFlags = *((short *)v1 - 5); | 202 soft_billboard.uFlags = p->field_1E; |
206 soft_billboard.uTintColor = *((int *)v1 + 1); | 203 soft_billboard.uTintColor = p->uTintColor; |
207 v2 = *((short *)v1 - 8); | 204 v2 = p->uHwSpriteID; |
208 if ( v2 != -1 ) | 205 if ( v2 != -1 ) |
209 { | 206 { |
210 if ( pRenderer->pRenderD3D ) | 207 if ( pRenderer->pRenderD3D ) |
211 { | 208 pRenderer->DrawBillboard_Indoor(&soft_billboard, &pSprites_LOD->pHardwareSprites[v2], p->uPaletteSubindex); |
212 pRenderer->_4A43B1(&soft_billboard, &pSprites_LOD->pHardwareSprites[v2], *((short *)v1 + 1)); | |
213 } | |
214 else | 209 else |
215 { | 210 { |
216 v3 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), *((short *)v1 + 1), 1); | 211 soft_billboard.pPalette = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, p->uPaletteSubindex, 1); |
217 v4 = (*(v1 - 9) & 1) == 0; | 212 if (p->field_1E & 0x0100) |
218 soft_billboard.pPalette = v3; | 213 soft_billboard.pPalette = pPaletteManager->field_261600[p->uPalette]; |
219 if ( !v4 ) | |
220 soft_billboard.pPalette = pPaletteManager->field_261600[*((short *)v1 - 7)]; | |
221 if ( !(soft_billboard.uFlags & 0x40) && soft_billboard.uFlags & 0x80 ) | 214 if ( !(soft_billboard.uFlags & 0x40) && soft_billboard.uFlags & 0x80 ) |
222 soft_billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 0, 1); | 215 soft_billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, 0, 1); |
223 v5 = *((short *)v1 - 8); | 216 v5 = p->uHwSpriteID; |
224 if ( v5 >= 0 ) | 217 if ( v5 >= 0 ) |
225 pSprites_LOD->pSpriteHeaders[v5]._4ACC38(&soft_billboard, 1); | 218 pSprites_LOD->pSpriteHeaders[v5]._4ACC38(&soft_billboard, 1); |
226 } | 219 } |
227 } | 220 } |
228 ++v0; | |
229 v1 += 52; | |
230 } | |
231 while ( v0 < (signed int)uNumBillboardsToDraw ); | |
232 } | 221 } |
233 } | 222 } |
234 | 223 |
235 | 224 |
236 | 225 |
2902 billboard.uViewportX = pViewport->uViewportX; | 2891 billboard.uViewportX = pViewport->uViewportX; |
2903 billboard.uViewportY = pViewport->uViewportY; | 2892 billboard.uViewportY = pViewport->uViewportY; |
2904 billboard.uViewportZ = pViewport->uViewportZ - 1; | 2893 billboard.uViewportZ = pViewport->uViewportZ - 1; |
2905 billboard.uViewportW = pViewport->uViewportW; | 2894 billboard.uViewportW = pViewport->uViewportW; |
2906 v0 = 0; | 2895 v0 = 0; |
2907 pOutdoorCamera->field_3C = uNumBillboardsToDraw; | 2896 pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw; |
2908 v16 = 0; | 2897 v16 = 0; |
2909 if ( (signed int)uNumBillboardsToDraw > 0 ) | 2898 if ( (signed int)uNumBillboardsToDraw > 0 ) |
2910 { | 2899 { |
2911 v17 = 0; | 2900 v17 = 0; |
2912 v1 = (char *)&pBillboardRenderList[0].field_28; | 2901 v1 = (char *)&pBillboardRenderList[0].uScreenSpaceY; |
2913 do | 2902 do |
2914 { | 2903 { |
2915 billboard.field_8 = *((short *)v1 - 1); | 2904 billboard.uScreenSpaceX = *((short *)v1 - 1); |
2916 v2 = *((short *)v1 - 5); | 2905 v2 = *((short *)v1 - 5); |
2917 billboard.field_C = *(short *)v1; | 2906 billboard.uScreenSpaceY = *(short *)v1; |
2918 v3 = *((int *)v1 - 10); | 2907 v3 = *((int *)v1 - 10); |
2919 billboard.uParentBillboardID = v0; | 2908 billboard.uParentBillboardID = v0; |
2920 v4 = *((int *)v1 + 1); | 2909 v4 = *((int *)v1 + 1); |
2921 billboard.field_10 = v3; | 2910 billboard.field_10 = v3; |
2922 v5 = *((int *)v1 - 9); | 2911 v5 = *((int *)v1 - 9); |
2923 billboard.uTintColor = v4; | 2912 billboard.uTintColor = v4; |
2924 v6 = *((short *)v1 - 8); | 2913 v6 = *((short *)v1 - 8); |
2925 billboard.field_14 = v5; | 2914 billboard.field_14 = v5; |
2926 v7 = *((int *)v1 - 6); | 2915 v7 = *((int *)v1 - 6); |
2927 billboard.field_28 = *((int *)v1 - 6); | 2916 billboard.sZValue = *((int *)v1 - 6); |
2928 billboard.uFlags = v2; | 2917 billboard.uFlags = v2; |
2929 if ( v6 != -1 ) | 2918 if ( v6 != -1 ) |
2930 { | 2919 { |
2931 v8 = *((short *)v1 + 1); | 2920 v8 = *((short *)v1 + 1); |
2932 if ( pRenderer->pRenderD3D ) | 2921 if ( pRenderer->pRenderD3D ) |
2933 { | 2922 { |
2934 billboard.field_28 = v7; | 2923 billboard.sZValue = v7; |
2935 billboard.uFlags = v2; | 2924 billboard.uFlags = v2; |
2936 pRenderer->TransformBillboard( | 2925 pRenderer->TransformBillboard( |
2937 &billboard, | 2926 &billboard, |
2938 &pSprites_LOD->pHardwareSprites[v6], | 2927 &pSprites_LOD->pHardwareSprites[v6], |
2939 v8, | 2928 v8, |
3139 v3->field_0 = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16; | 3128 v3->field_0 = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16; |
3140 v26 = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16; | 3129 v26 = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16; |
3141 v3->pSpriteFrame = v28; | 3130 v3->pSpriteFrame = v28; |
3142 v3->field_4 = v26; | 3131 v3->field_4 = v26; |
3143 v3->field_1E = v46; | 3132 v3->field_1E = v46; |
3144 v3->field_20 = x; | 3133 v3->some_x = x; |
3145 v3->field_22 = y; | 3134 v3->some_y = y; |
3146 v3->field_24 = z; | 3135 v3->some_z = z; |
3147 v3->field_26 = v35; | 3136 v3->uScreenSpaceX = v35; |
3148 v3->field_28 = v32; | 3137 v3->uScreenSpaceY = v32; |
3149 HIWORD(v26) = HIWORD(v42); | 3138 HIWORD(v26) = HIWORD(v42); |
3150 LOWORD(v26) = 0; | 3139 LOWORD(v26) = 0; |
3151 v27 = (*(v0 - 2) & 0x20) == 0; | 3140 v27 = (*(v0 - 2) & 0x20) == 0; |
3152 v3->sZValue = v26 + (8 * v41 | 2); | 3141 v3->sZValue = v26 + (8 * v41 | 2); |
3153 v3->field_2A = 0; | 3142 v3->uPaletteSubindex = 0; |
3154 v3->field_2C_prolly_tint = 0; | 3143 v3->uTintColor = 0; |
3155 if ( !v27 ) | 3144 if ( !v27 ) |
3156 { | 3145 { |
3157 if ( !pRenderer->pRenderD3D ) | 3146 if ( !pRenderer->pRenderD3D ) |
3158 v3->sZValue = 0; | 3147 v3->sZValue = 0; |
3159 } | 3148 } |
3571 v27->uHwSpriteID = *v37; | 3560 v27->uHwSpriteID = *v37; |
3572 v28 = v9->uPaletteIndex; | 3561 v28 = v9->uPaletteIndex; |
3573 v27->field_0 = v26; | 3562 v27->field_0 = v26; |
3574 v27->field_4 = v26; | 3563 v27->field_4 = v26; |
3575 v29 = v38; | 3564 v29 = v38; |
3576 v27->field_26 = v25; | 3565 v27->uScreenSpaceX = v25; |
3577 HIBYTE(v29) |= 2u; | 3566 HIBYTE(v29) |= 2u; |
3578 v27->uPalette = v28; | 3567 v27->uPalette = v28; |
3579 v27->field_1E = v29; | 3568 v27->field_1E = v29; |
3580 v27->field_20 = x; | 3569 v27->some_x = x; |
3581 v27->field_22 = y; | 3570 v27->some_y = y; |
3582 v27->field_24 = v36; | 3571 v27->some_z = v36; |
3583 v27->field_28 = v40; | 3572 v27->uScreenSpaceY = v40; |
3584 HIWORD(v30) = HIWORD(v39); | 3573 HIWORD(v30) = HIWORD(v39); |
3585 v31 = 8 * v35 | 5; | 3574 v31 = 8 * v35 | 5; |
3586 LOWORD(v30) = 0; | 3575 LOWORD(v30) = 0; |
3587 v27->uIndoorSectorID = 0; | 3576 v27->uIndoorSectorID = 0; |
3588 v27->sZValue = v30 + v31; | 3577 v27->sZValue = v30 + v31; |
3589 v27->field_2A = 0; | 3578 v27->uPaletteSubindex = 0; |
3590 v27->pSpriteFrame = v9; | 3579 v27->pSpriteFrame = v9; |
3591 v27->field_2C_prolly_tint = 0; | 3580 v27->uTintColor = 0; |
3592 } | 3581 } |
3593 } | 3582 } |
3594 goto LABEL_38; | 3583 goto LABEL_38; |
3595 } | 3584 } |
3596 } | 3585 } |
3625 local_0.z = (double)*((signed int *)v0 + 1); | 3614 local_0.z = (double)*((signed int *)v0 + 1); |
3626 local_0.flt_10 = 0.0; | 3615 local_0.flt_10 = 0.0; |
3627 local_0.flt_14 = 0.0; | 3616 local_0.flt_14 = 0.0; |
3628 local_0.flt_18 = 0.0; | 3617 local_0.flt_18 = 0.0; |
3629 local_0.flt_28 = 1.0; | 3618 local_0.flt_28 = 1.0; |
3630 local_0.field_20 = (rand() & 0x80) + 128; | 3619 local_0.timeToLive = (rand() & 0x80) + 128; |
3631 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); | 3620 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); |
3632 pGame->pParticleEngine->AddParticle(&local_0); | 3621 pGame->pParticleEngine->AddParticle(&local_0); |
3633 } | 3622 } |
3634 } | 3623 } |
3635 LABEL_38: | 3624 LABEL_38: |
4509 { | 4498 { |
4510 v35 = *(int *)v34; | 4499 v35 = *(int *)v34; |
4511 *(int *)v34 = 0; | 4500 *(int *)v34 = 0; |
4512 v34 += 32; | 4501 v34 += 32; |
4513 --v33; | 4502 --v33; |
4514 *((int *)v34 - 9) = LODWORD(pRenderer->uFogColor) | v35 & 0xFF000000; | 4503 *((int *)v34 - 9) = pRenderer->uFogColor | v35 & 0xFF000000; |
4515 } | 4504 } |
4516 while ( v33 ); | 4505 while ( v33 ); |
4517 } | 4506 } |
4518 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 4507 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
4519 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6)); | 4508 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6)); |
4622 v1->bRequiredTextureStagesAvailable = 0; | 4611 v1->bRequiredTextureStagesAvailable = 0; |
4623 v1->bTinting = 1; | 4612 v1->bTinting = 1; |
4624 LOBYTE(v1->field_103668) = 0; | 4613 LOBYTE(v1->field_103668) = 0; |
4625 v1->field_1036B8 = 0; | 4614 v1->field_1036B8 = 0; |
4626 v1->_gpu_memory_used = 0; | 4615 v1->_gpu_memory_used = 0; |
4616 uNumBillboardsToDraw = 0; | |
4617 bFogEnabled = false; | |
4627 } | 4618 } |
4628 | 4619 |
4629 bool Render::Initialize(bool bWindowed, uint uDefaultDevice, | 4620 bool Render::Initialize(bool bWindowed, uint uDefaultDevice, |
4630 bool bColoredLights, uint uDetailLevel, uint bTinting) | 4621 bool bColoredLights, uint uDetailLevel, uint bTinting) |
4631 { | 4622 { |
7114 { | 7105 { |
7115 return pRenderer->pBillboardRenderListD3D[uBillboardID].uParentBillboardID; | 7106 return pRenderer->pBillboardRenderListD3D[uBillboardID].uParentBillboardID; |
7116 } | 7107 } |
7117 | 7108 |
7118 //----- (004A1EB6) -------------------------------------------------------- | 7109 //----- (004A1EB6) -------------------------------------------------------- |
7119 void Render::SetGameRenderStates() | 7110 void Render::BeginSceneD3D() |
7120 { | 7111 { |
7121 Render *v1; // esi@1 | 7112 if (!uNumD3DSceneBegins++) |
7122 unsigned int v2; // eax@1 | 7113 { |
7123 RenderD3D *v3; // ecx@2 | |
7124 unsigned int uFogColor; // edi@6 | |
7125 IDirect3DDevice3 *v5; // eax@8 | |
7126 //IDirect3DDevice3Vtbl *v6; // ecx@8 | |
7127 RenderD3D *v7; // eax@9 | |
7128 RenderD3D *v8; // eax@9 | |
7129 std::string v9; // [sp-14h] [bp-2Ch]@4 | |
7130 IDirect3DDevice3 *v10; // [sp-8h] [bp-20h]@9 | |
7131 signed int v11; // [sp-4h] [bp-1Ch]@4 | |
7132 int v12; // [sp+0h] [bp-18h]@4 | |
7133 std::string *v13; // [sp+10h] [bp-8h]@4 | |
7134 int a3; // [sp+17h] [bp-1h]@4 | |
7135 | |
7136 v1 = this; | |
7137 v2 = this->uNumD3DSceneBegins; | |
7138 this->uNumD3DSceneBegins = v2 + 1; | |
7139 if ( !v2 ) | |
7140 { | |
7141 v3 = this->pRenderD3D; | |
7142 if (pRenderD3D) | 7114 if (pRenderD3D) |
7143 { | 7115 { |
7144 pRenderD3D->ClearTarget(1u, 0, 1u, 1.0); | 7116 pRenderD3D->ClearTarget(1u, 0, 1u, 1.0); |
7145 pRenderer->uNumBillboardsToDraw = 0; | 7117 pRenderer->uNumBillboardsToDraw = 0; |
7146 pRenderD3D->pDevice->BeginScene(); | 7118 pRenderD3D->pDevice->BeginScene(); |
7150 } | 7122 } |
7151 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | 7123 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
7152 uFogColor = GetLevelFogColor(); | 7124 uFogColor = GetLevelFogColor(); |
7153 else | 7125 else |
7154 uFogColor = 0; | 7126 uFogColor = 0; |
7155 v5 = v1->pRenderD3D->pDevice; | 7127 |
7156 //v6 = v5->lpVtbl; | |
7157 if ( uFogColor & 0xFF000000 ) | 7128 if ( uFogColor & 0xFF000000 ) |
7158 { | 7129 { |
7159 v12 = 1; | 7130 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1); |
7160 v11 = 28; | |
7161 v10 = v5; | |
7162 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1u); | |
7163 //v7 = v1->pRenderD3D; | |
7164 v12 = uFogColor & 0xFFFFFF; | |
7165 v11 = 34; | |
7166 //v10 = v7->pDevice; | |
7167 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, uFogColor & 0xFFFFFF); | 7131 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, uFogColor & 0xFFFFFF); |
7168 v8 = v1->pRenderD3D; | |
7169 *(float *)&v12 = 0.0; | |
7170 v11 = 35; | |
7171 //v10 = v8->pDevice; | |
7172 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); | 7132 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); |
7173 v1->bUsingSpecular = 1; | 7133 bUsingSpecular = true; |
7174 } | 7134 } |
7175 else | 7135 else |
7176 { | 7136 { |
7177 *(float *)&v12 = 0.0; | |
7178 v11 = 28; | |
7179 v10 = v5; | |
7180 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0); | 7137 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0); |
7181 v1->bUsingSpecular = 0; | 7138 bUsingSpecular = 0; |
7182 } | 7139 } |
7183 } | 7140 } |
7184 else | 7141 else |
7185 { | 7142 { |
7186 LockRenderSurface((void **)&v1->pTargetSurface, &v1->uTargetSurfacePitch); | 7143 LockRenderSurface((void **)&pTargetSurface, &uTargetSurfacePitch); |
7187 if ( v1->pTargetSurface ) | 7144 if (pTargetSurface) |
7188 v1->field_18_locked_pitch = v1->uTargetSurfacePitch; | 7145 field_18_locked_pitch = uTargetSurfacePitch; |
7189 else | 7146 else |
7190 --v1->uNumD3DSceneBegins; | 7147 --uNumD3DSceneBegins; |
7191 } | 7148 } |
7192 } | 7149 } |
7193 } | 7150 } |
7194 | 7151 |
7195 //----- (004A1FE1) -------------------------------------------------------- | 7152 //----- (004A1FE1) -------------------------------------------------------- |
7196 void Render::DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene() | 7153 void Render::DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene() |
7197 { | 7154 { |
7198 char v1; // zf@1 | 7155 --uNumD3DSceneBegins; |
7199 | 7156 if (uNumD3DSceneBegins) |
7200 v1 = this->uNumD3DSceneBegins-- == 1; | 7157 return; |
7201 if ( v1 ) | 7158 |
7202 { | 7159 if (pRenderD3D) |
7203 if ( this->pRenderD3D ) | 7160 { |
7204 { | 7161 pGame->draw_debug_outlines(); |
7205 pGame->draw_debug_outlines(); | 7162 DoRenderBillboards_D3D(); |
7206 DoRenderBillboards_D3D(); | 7163 pGame->pStru6Instance->RenderSpecialEffects(); |
7207 pGame->pStru6Instance->RenderSpecialEffects(); | 7164 pRenderD3D->pDevice->EndScene(); |
7208 pRenderD3D->pDevice->EndScene(); | 7165 } |
7209 } | 7166 else |
7210 else | 7167 pGame->pStru6Instance->RenderSpecialEffects(); |
7211 { | |
7212 pGame->pStru6Instance->RenderSpecialEffects(); | |
7213 } | |
7214 } | |
7215 } | 7168 } |
7216 | 7169 |
7217 | 7170 |
7218 | 7171 |
7219 //----- (004A2031) -------------------------------------------------------- | 7172 //----- (004A2031) -------------------------------------------------------- |
7477 { | 7430 { |
7478 v39 = *(int *)v38; | 7431 v39 = *(int *)v38; |
7479 *(int *)v38 = 0; | 7432 *(int *)v38 = 0; |
7480 v38 += 32; | 7433 v38 += 32; |
7481 --v37; | 7434 --v37; |
7482 *((int *)v38 - 9) = LODWORD(pRenderer->uFogColor) | v39 & 0xFF000000; | 7435 *((int *)v38 - 9) = pRenderer->uFogColor | v39 & 0xFF000000; |
7483 } | 7436 } |
7484 while ( v37 ); | 7437 while ( v37 ); |
7485 } | 7438 } |
7486 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | 7439 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); |
7487 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6u)); | 7440 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6u)); |
7864 } | 7817 } |
7865 // 4D864C: using guessed type char byte_4D864C; | 7818 // 4D864C: using guessed type char byte_4D864C; |
7866 | 7819 |
7867 | 7820 |
7868 //----- (004A43B1) -------------------------------------------------------- | 7821 //----- (004A43B1) -------------------------------------------------------- |
7869 void Render::_4A43B1(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *a3, int a4) | 7822 void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *a3, int uPaletteSubindex) |
7870 { | 7823 { |
7871 RenderBillboardTransform_local0 *v4; // ebx@2 | 7824 RenderBillboardTransform_local0 *v4; // ebx@2 |
7872 double v5; // st7@2 | 7825 double v5; // st7@2 |
7873 float v6; // ST08_4@2 | 7826 float v6; // ST08_4@2 |
7874 unsigned int v7; // eax@2 | 7827 unsigned int v7; // eax@2 |
7901 | 7854 |
7902 v26 = this; | 7855 v26 = this; |
7903 if ( this->uNumD3DSceneBegins ) | 7856 if ( this->uNumD3DSceneBegins ) |
7904 { | 7857 { |
7905 v4 = pSoftBillboard; | 7858 v4 = pSoftBillboard; |
7906 v5 = (double)HIWORD(pSoftBillboard->field_28); | 7859 v5 = (double)HIWORD(pSoftBillboard->sZValue); |
7907 pSoftBillboarda = v5; | 7860 pSoftBillboarda = v5; |
7908 v6 = v5; | 7861 v6 = v5; |
7909 v7 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v6)); | 7862 v7 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v6)); |
7910 v8 = a4; | 7863 v8 = uPaletteSubindex; |
7911 v9 = v7; | 7864 v9 = v7; |
7912 v28 = a4 & 0xFF000000; | 7865 v28 = uPaletteSubindex & 0xFF000000; |
7913 if ( a4 & 0xFF000000 ) | 7866 if ( uPaletteSubindex & 0xFF000000 ) |
7914 pBillboardRenderListD3D[v9].bOpaque = 3; | 7867 pBillboardRenderListD3D[v9].uOpacity = RenderBillboardD3D::Opaque_3; |
7915 else | 7868 else |
7916 pBillboardRenderListD3D[v9].bOpaque = 0; | 7869 pBillboardRenderListD3D[v9].uOpacity = RenderBillboardD3D::Transparent; |
7917 v10 = a3; | 7870 v10 = a3; |
7918 pBillboardRenderListD3D[v9].field_90 = v4->field_44; | 7871 pBillboardRenderListD3D[v9].field_90 = v4->field_44; |
7919 pBillboardRenderListD3D[v9].field_94 = v4->field_28; | 7872 pBillboardRenderListD3D[v9].sZValue = v4->sZValue; |
7920 pBillboardRenderListD3D[v9].uParentBillboardID = v4->uParentBillboardID; | 7873 pBillboardRenderListD3D[v9].uParentBillboardID = v4->uParentBillboardID; |
7921 v25 = v4->field_8; | 7874 v25 = v4->uScreenSpaceX; |
7922 v24 = v4->field_C; | 7875 v24 = v4->uScreenSpaceY; |
7923 a1 = (double)(v4->field_10 & 0xFFFF) * 0.000015260186 + (double)HIWORD(v4->field_10); | 7876 a1 = (double)(v4->field_10 & 0xFFFF) * 0.000015260186 + (double)HIWORD(v4->field_10); |
7924 v29 = (double)(v4->field_14 & 0xFFFF) * 0.000015260186 + (double)HIWORD(v4->field_14); | 7877 v29 = (double)(v4->field_14 & 0xFFFF) * 0.000015260186 + (double)HIWORD(v4->field_14); |
7925 v31 = (double)((v10->uBufferWidth >> 1) - v10->uAreaX); | 7878 v31 = (double)((v10->uBufferWidth >> 1) - v10->uAreaX); |
7926 v27 = (double)(v10->uBufferHeight - v10->uAreaY); | 7879 v27 = (double)(v10->uBufferHeight - v10->uAreaY); |
7927 if ( v4->uFlags & 4 ) | 7880 if ( v4->uFlags & 4 ) |
7954 v18 = (double)(v10->uBufferHeight - v10->uAreaY - v10->uAreaHeight); | 7907 v18 = (double)(v10->uBufferHeight - v10->uAreaY - v10->uAreaHeight); |
7955 if ( v4->uFlags & 4 ) | 7908 if ( v4->uFlags & 4 ) |
7956 v17 = v17 * -1.0; | 7909 v17 = v17 * -1.0; |
7957 pBillboardRenderListD3D[v9].pQuards[1].specular = 0; | 7910 pBillboardRenderListD3D[v9].pQuards[1].specular = 0; |
7958 pBillboardRenderListD3D[v9].pQuards[1].diffuse = v12; | 7911 pBillboardRenderListD3D[v9].pQuards[1].diffuse = v12; |
7959 *(float *)(v9 * 156 + 15684320) = v13 - v17 * a1; | 7912 pBillboardRenderListD3D[v9].pQuards[1].pos.x = v13 - v17 * a1; |
7960 *(float *)(v9 * 156 + 15684324) = v32 - v18 * v29; | 7913 pBillboardRenderListD3D[v9].pQuards[1].pos.y = v32 - v18 * v29; |
7961 *(float *)(v9 * 156 + 15684328) = v15; | 7914 pBillboardRenderListD3D[v9].pQuards[1].pos.z = v15; |
7962 *(float *)(v9 * 156 + 15684332) = v16; | 7915 pBillboardRenderListD3D[v9].pQuards[1].rhw = v16; |
7963 *(float *)(v9 * 156 + 15684344) = 0.0; | 7916 pBillboardRenderListD3D[v9].pQuards[1].texcoord.x = 0.0; |
7964 *(float *)(v9 * 156 + 15684348) = 1.0; | 7917 pBillboardRenderListD3D[v9].pQuards[1].texcoord.y = 1.0; |
7965 v19 = v10->uBufferHeight - v10->uAreaY - v10->uAreaHeight; | 7918 v19 = v10->uBufferHeight - v10->uAreaY - v10->uAreaHeight; |
7966 v20 = (double)(v10->uAreaX + v10->uAreaWidth + (v10->uBufferWidth >> 1) - v10->uBufferWidth); | 7919 v20 = (double)(v10->uAreaX + v10->uAreaWidth + (v10->uBufferWidth >> 1) - v10->uBufferWidth); |
7967 if ( v4->uFlags & 4 ) | 7920 if ( v4->uFlags & 4 ) |
7968 v20 = v20 * -1.0; | 7921 v20 = v20 * -1.0; |
7969 pBillboardRenderListD3D[v9].pQuards[2].specular = 0; | 7922 pBillboardRenderListD3D[v9].pQuards[2].specular = 0; |
7970 pBillboardRenderListD3D[v9].pQuards[2].diffuse = v12; | 7923 pBillboardRenderListD3D[v9].pQuards[2].diffuse = v12; |
7971 *(float *)(v9 * 156 + 15684352) = v20 * a1 + v13; | 7924 pBillboardRenderListD3D[v9].pQuards[2].pos.x = v20 * a1 + v13; |
7972 *(float *)(v9 * 156 + 15684356) = v32 - (double)v19 * v29; | 7925 pBillboardRenderListD3D[v9].pQuards[2].pos.y = v32 - (double)v19 * v29; |
7973 *(float *)(v9 * 156 + 15684360) = v15; | 7926 pBillboardRenderListD3D[v9].pQuards[2].pos.z = v15; |
7974 *(float *)(v9 * 156 + 15684364) = v16; | 7927 pBillboardRenderListD3D[v9].pQuards[2].rhw = v16; |
7975 *(float *)(v9 * 156 + 15684376) = 1.0; | 7928 pBillboardRenderListD3D[v9].pQuards[2].texcoord.x = 1.0; |
7976 *(float *)(v9 * 156 + 15684380) = 1.0; | 7929 pBillboardRenderListD3D[v9].pQuards[2].texcoord.y = 1.0; |
7977 v21 = v10->uBufferHeight - v10->uAreaY; | 7930 v21 = v10->uBufferHeight - v10->uAreaY; |
7978 v22 = (double)(v10->uAreaX + v10->uAreaWidth + (v10->uBufferWidth >> 1) - v10->uBufferWidth); | 7931 v22 = (double)(v10->uAreaX + v10->uAreaWidth + (v10->uBufferWidth >> 1) - v10->uBufferWidth); |
7979 if ( v4->uFlags & 4 ) | 7932 if ( v4->uFlags & 4 ) |
7980 v22 = v22 * -1.0; | 7933 v22 = v22 * -1.0; |
7981 pBillboardRenderListD3D[v9].pQuards[3].specular = 0; | 7934 pBillboardRenderListD3D[v9].pQuards[3].specular = 0; |
7982 pBillboardRenderListD3D[v9].pQuards[3].diffuse = v12; | 7935 pBillboardRenderListD3D[v9].pQuards[3].diffuse = v12; |
7983 *(float *)(v9 * 156 + 15684384) = v22 * a1 + v13; | 7936 pBillboardRenderListD3D[v9].pQuards[3].pos.x = v22 * a1 + v13; |
7984 *(float *)(v9 * 156 + 15684388) = v32 - (double)v21 * v29; | 7937 pBillboardRenderListD3D[v9].pQuards[3].pos.y = v32 - (double)v21 * v29; |
7985 *(float *)(v9 * 156 + 15684392) = v15; | 7938 pBillboardRenderListD3D[v9].pQuards[3].pos.z = v15; |
7986 *(float *)(v9 * 156 + 15684396) = v16; | 7939 pBillboardRenderListD3D[v9].pQuards[3].rhw = v16; |
7987 *(float *)(v9 * 156 + 15684408) = 1.0; | 7940 pBillboardRenderListD3D[v9].pQuards[3].texcoord.x = 1.0; |
7988 *(float *)(v9 * 156 + 15684412) = 0.0; | 7941 pBillboardRenderListD3D[v9].pQuards[3].texcoord.y = 0.0; |
7989 v23 = v10->pTexture; | 7942 v23 = v10->pTexture; |
7990 pBillboardRenderListD3D[v9].uNumVertices = 4; | 7943 pBillboardRenderListD3D[v9].uNumVertices = 4; |
7991 *(float *)(v9 * 156 + 15684416) = pSoftBillboarda; | 7944 pBillboardRenderListD3D[v9].flt_88 = pSoftBillboarda; |
7992 pBillboardRenderListD3D[v9].pTexture = v23; | 7945 pBillboardRenderListD3D[v9].pTexture = v23; |
7993 } | 7946 } |
7994 } | 7947 } |
7995 | 7948 |
7996 | 7949 |
8041 double v45; // st6@3 | 7994 double v45; // st6@3 |
8042 float v46; // eax@3 | 7995 float v46; // eax@3 |
8043 | 7996 |
8044 if ( this->uNumD3DSceneBegins ) | 7997 if ( this->uNumD3DSceneBegins ) |
8045 { | 7998 { |
8046 if ( HIWORD(a2->field_28) ) | 7999 if ( HIWORD(a2->sZValue) ) |
8047 { | 8000 { |
8048 v5 = (double)HIWORD(a2->field_28); | 8001 v5 = (double)HIWORD(a2->sZValue); |
8049 v6 = v5; | 8002 v6 = v5; |
8050 v7 = v5; | 8003 v7 = v5; |
8051 v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); | 8004 v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); |
8052 pBillboardRenderListD3D[v8].bOpaque = 1; | 8005 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; |
8053 pBillboardRenderListD3D[v8].field_90 = a2->field_44; | 8006 pBillboardRenderListD3D[v8].field_90 = a2->field_44; |
8054 pBillboardRenderListD3D[v8].field_94 = a2->field_28; | 8007 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; |
8055 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; | 8008 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; |
8056 v9 = a2->field_8; | 8009 v9 = a2->uScreenSpaceX; |
8057 v10 = a2->field_C; | 8010 v10 = a2->uScreenSpaceY; |
8058 v11 = (double)(a2->field_10 & 0xFFFF) * 0.000015260186 + (double)HIWORD(a2->field_10); | 8011 v11 = (double)(a2->field_10 & 0xFFFF) * 0.000015260186 + (double)HIWORD(a2->field_10); |
8059 v12 = (double)v9; | 8012 v12 = (double)v9; |
8060 v13 = v12; | 8013 v13 = v12; |
8061 v14 = (double)(v10 - 12); | 8014 v14 = (double)(v10 - 12); |
8062 v15 = v14; | 8015 v15 = v14; |
8075 * v11 + v13; | 8028 * v11 + v13; |
8076 v22 = (((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v17 | 8029 v22 = (((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v17 |
8077 + ((double)(unsigned __int16)v20 * 0.000015259022 + (double)(v20 >> 16)) * v16 | 8030 + ((double)(unsigned __int16)v20 * 0.000015259022 + (double)(v20 >> 16)) * v16 |
8078 - 12.0) | 8031 - 12.0) |
8079 * v11 | 8032 * v11 |
8080 + (double)a2->field_C; | 8033 + (double)a2->uScreenSpaceY; |
8081 pBillboardRenderListD3D[v8].pQuards[0].specular = 0; | 8034 pBillboardRenderListD3D[v8].pQuards[0].specular = 0; |
8082 pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; | 8035 pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; |
8083 pBillboardRenderListD3D[v8].pQuards[0].pos.y = v22; | 8036 pBillboardRenderListD3D[v8].pQuards[0].pos.y = v22; |
8084 pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (v6 * 0.061758894); | 8037 pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (v6 * 0.061758894); |
8085 pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / v6; | 8038 pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / v6; |
8086 pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; | 8039 pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; |
8087 pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; | 8040 pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; |
8088 v23 = (double)(a2->field_8 - 12) - v13; | 8041 v31 = (double)(a2->uScreenSpaceX + 12) - v13; |
8089 v24 = (double)a2->field_C - v15; | 8042 v32 = (double)a2->uScreenSpaceY - v15; |
8090 v25 = stru_5C6E00->SinCos(angle); | 8043 v25 = stru_5C6E00->SinCos(angle); |
8091 v26 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); | 8044 v26 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); |
8092 v27 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); | 8045 v27 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); |
8093 v28 = stru_5C6E00->SinCos(angle); | 8046 v28 = stru_5C6E00->SinCos(angle); |
8094 pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 | 8047 pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 |
8100 * v11 + v13; | 8053 * v11 + v13; |
8101 v29 = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v24 | 8054 v29 = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v24 |
8102 + ((double)(unsigned __int16)v27 * 0.000015259022 + (double)(v27 >> 16)) * v23 | 8055 + ((double)(unsigned __int16)v27 * 0.000015259022 + (double)(v27 >> 16)) * v23 |
8103 - 12.0) | 8056 - 12.0) |
8104 * v11 | 8057 * v11 |
8105 + (double)a2->field_C; | 8058 + (double)a2->uScreenSpaceY; |
8106 pBillboardRenderListD3D[v8].pQuards[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuards[0].pos.z; | 8059 pBillboardRenderListD3D[v8].pQuards[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuards[0].pos.z; |
8107 v30 = pBillboardRenderListD3D[v8].pQuards[0].rhw; | 8060 v30 = pBillboardRenderListD3D[v8].pQuards[0].rhw; |
8108 pBillboardRenderListD3D[v8].pQuards[1].pos.y = v29; | 8061 pBillboardRenderListD3D[v8].pQuards[1].pos.y = v29; |
8109 pBillboardRenderListD3D[v8].pQuards[1].specular = 0; | 8062 pBillboardRenderListD3D[v8].pQuards[1].specular = 0; |
8110 pBillboardRenderListD3D[v8].pQuards[1].rhw = v30; | 8063 pBillboardRenderListD3D[v8].pQuards[1].rhw = v30; |
8111 pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; | 8064 pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; |
8112 pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; | 8065 pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; |
8113 pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; | 8066 pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; |
8114 v31 = (double)(a2->field_8 + 12) - v13; | 8067 v23 = (double)(a2->uScreenSpaceX - 12) - v13; |
8115 v32 = (double)a2->field_C - v15; | 8068 v24 = (double)a2->uScreenSpaceY - v15; |
8116 v33 = stru_5C6E00->SinCos(angle); | 8069 v33 = stru_5C6E00->SinCos(angle); |
8117 v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); | 8070 v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); |
8118 v35 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); | 8071 v35 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); |
8119 v36 = stru_5C6E00->SinCos(angle); | 8072 v36 = stru_5C6E00->SinCos(angle); |
8120 pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 | 8073 pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 |
8127 v37 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; | 8080 v37 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; |
8128 v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v32 | 8081 v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v32 |
8129 + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v31 | 8082 + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v31 |
8130 - 12.0) | 8083 - 12.0) |
8131 * v11 | 8084 * v11 |
8132 + (double)a2->field_C; | 8085 + (double)a2->uScreenSpaceY; |
8133 pBillboardRenderListD3D[v8].pQuards[2].specular = 0; | 8086 pBillboardRenderListD3D[v8].pQuards[2].specular = 0; |
8134 pBillboardRenderListD3D[v8].pQuards[2].pos.z = v37; | 8087 pBillboardRenderListD3D[v8].pQuards[2].pos.z = v37; |
8135 pBillboardRenderListD3D[v8].pQuards[2].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; | 8088 pBillboardRenderListD3D[v8].pQuards[2].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; |
8136 pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; | 8089 pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; |
8137 pBillboardRenderListD3D[v8].pQuards[2].pos.y = v38; | 8090 pBillboardRenderListD3D[v8].pQuards[2].pos.y = v38; |
8138 pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; | 8091 pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; |
8139 pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; | 8092 pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; |
8140 v39 = (double)(a2->field_8 + 12) - v13; | 8093 v39 = (double)(a2->uScreenSpaceX + 12) - v13; |
8141 v40 = (double)(a2->field_C - 25) - v15; | 8094 v40 = (double)(a2->uScreenSpaceY - 25) - v15; |
8142 v41 = stru_5C6E00->SinCos(angle); | 8095 v41 = stru_5C6E00->SinCos(angle); |
8143 v42 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); | 8096 v42 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); |
8144 v43 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); | 8097 v43 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); |
8145 v44 = stru_5C6E00->SinCos(angle); | 8098 v44 = stru_5C6E00->SinCos(angle); |
8146 pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 | 8099 pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 |
8152 * v11 + v13; | 8105 * v11 + v13; |
8153 v45 = (((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 | 8106 v45 = (((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 |
8154 + ((double)(unsigned __int16)v43 * 0.000015259022 + (double)(v43 >> 16)) * v39 | 8107 + ((double)(unsigned __int16)v43 * 0.000015259022 + (double)(v43 >> 16)) * v39 |
8155 - 12.0) | 8108 - 12.0) |
8156 * v11 | 8109 * v11 |
8157 + (double)a2->field_C; | 8110 + (double)a2->uScreenSpaceY; |
8158 v46 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; | 8111 v46 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; |
8159 pBillboardRenderListD3D[v8].pQuards[3].specular = 0; | 8112 pBillboardRenderListD3D[v8].pQuards[3].specular = 0; |
8160 pBillboardRenderListD3D[v8].pQuards[3].pos.z = v46; | 8113 pBillboardRenderListD3D[v8].pQuards[3].pos.z = v46; |
8161 pBillboardRenderListD3D[v8].pQuards[3].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; | 8114 pBillboardRenderListD3D[v8].pQuards[3].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; |
8162 pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; | 8115 pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; |
8217 signed int v45; // eax@2 | 8170 signed int v45; // eax@2 |
8218 double v46; // st6@2 | 8171 double v46; // st6@2 |
8219 | 8172 |
8220 if ( this->uNumD3DSceneBegins ) | 8173 if ( this->uNumD3DSceneBegins ) |
8221 { | 8174 { |
8222 v5 = (double)HIWORD(a2->field_28); | 8175 v5 = (double)HIWORD(a2->sZValue); |
8223 v6 = v5; | 8176 v6 = v5; |
8224 v7 = v5; | 8177 v7 = v5; |
8225 v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); | 8178 v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); |
8226 pBillboardRenderListD3D[v8].bOpaque = 1; | 8179 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; |
8227 pBillboardRenderListD3D[v8].field_90 = a2->field_44; | 8180 pBillboardRenderListD3D[v8].field_90 = a2->field_44; |
8228 pBillboardRenderListD3D[v8].field_94 = a2->field_28; | 8181 pBillboardRenderListD3D[v8].sZValue = a2->sZValue; |
8229 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; | 8182 pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; |
8230 v9 = a2->field_8; | 8183 v9 = a2->uScreenSpaceX; |
8231 v10 = a2->field_C; | 8184 v10 = a2->uScreenSpaceY; |
8232 v11 = (double)(a2->field_10 & 0xFFFF) * 0.000015260186 + (double)HIWORD(a2->field_10); | 8185 v11 = (double)(a2->field_10 & 0xFFFF) * 0.000015260186 + (double)HIWORD(a2->field_10); |
8233 v12 = (double)v9; | 8186 v12 = (double)v9; |
8234 v13 = v12; | 8187 v13 = v12; |
8235 v14 = (double)(v10 - 12); | 8188 v14 = (double)(v10 - 12); |
8236 v15 = v14; | 8189 v15 = v14; |
8250 * v11 + v13; | 8203 * v11 + v13; |
8251 v23 = (((double)(unsigned __int16)v22 * 0.000015259022 + (double)(v22 >> 16)) * v17 | 8204 v23 = (((double)(unsigned __int16)v22 * 0.000015259022 + (double)(v22 >> 16)) * v17 |
8252 + ((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v16 | 8205 + ((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v16 |
8253 - 12.0) | 8206 - 12.0) |
8254 * v11 | 8207 * v11 |
8255 + (double)a2->field_C; | 8208 + (double)a2->uScreenSpaceY; |
8256 pBillboardRenderListD3D[v8].pQuards[0].specular = 0; | 8209 pBillboardRenderListD3D[v8].pQuards[0].specular = 0; |
8257 pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; | 8210 pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; |
8258 pBillboardRenderListD3D[v8].pQuards[0].pos.y = v23; | 8211 pBillboardRenderListD3D[v8].pQuards[0].pos.y = v23; |
8259 v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | 8212 v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); |
8260 pBillboardRenderListD3D[v8].pQuards[0].pos.z = v24; | 8213 pBillboardRenderListD3D[v8].pQuards[0].pos.z = v24; |
8261 v25 = 1.0 / v6; | 8214 v25 = 1.0 / v6; |
8262 pBillboardRenderListD3D[v8].pQuards[0].rhw = v25; | 8215 pBillboardRenderListD3D[v8].pQuards[0].rhw = v25; |
8263 pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; | 8216 pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; |
8264 pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; | 8217 pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; |
8265 v26 = (double)(a2->field_8 - 12) - v13; | 8218 v26 = (double)(a2->uScreenSpaceX - 12) - v13; |
8266 v27 = (double)a2->field_C - v15; | 8219 v27 = (double)a2->uScreenSpaceY - v15; |
8267 v28 = stru_5C6E00->SinCos(angle); | 8220 v28 = stru_5C6E00->SinCos(angle); |
8268 v29 = stru_5C6E00->SinCos(v19); | 8221 v29 = stru_5C6E00->SinCos(v19); |
8269 v30 = stru_5C6E00->SinCos(v19); | 8222 v30 = stru_5C6E00->SinCos(v19); |
8270 v31 = stru_5C6E00->SinCos(angle); | 8223 v31 = stru_5C6E00->SinCos(angle); |
8271 pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 | 8224 pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 |
8277 * v11 + v13; | 8230 * v11 + v13; |
8278 v32 = (((double)(unsigned __int16)v31 * 0.000015259022 + (double)(v31 >> 16)) * v27 | 8231 v32 = (((double)(unsigned __int16)v31 * 0.000015259022 + (double)(v31 >> 16)) * v27 |
8279 + ((double)(unsigned __int16)v30 * 0.000015259022 + (double)(v30 >> 16)) * v26 | 8232 + ((double)(unsigned __int16)v30 * 0.000015259022 + (double)(v30 >> 16)) * v26 |
8280 - 12.0) | 8233 - 12.0) |
8281 * v11 | 8234 * v11 |
8282 + (double)a2->field_C; | 8235 + (double)a2->uScreenSpaceY; |
8283 pBillboardRenderListD3D[v8].pQuards[1].pos.z = v24; | 8236 pBillboardRenderListD3D[v8].pQuards[1].pos.z = v24; |
8284 pBillboardRenderListD3D[v8].pQuards[1].pos.y = v32; | 8237 pBillboardRenderListD3D[v8].pQuards[1].pos.y = v32; |
8285 pBillboardRenderListD3D[v8].pQuards[1].specular = 0; | 8238 pBillboardRenderListD3D[v8].pQuards[1].specular = 0; |
8286 pBillboardRenderListD3D[v8].pQuards[1].rhw = v25; | 8239 pBillboardRenderListD3D[v8].pQuards[1].rhw = v25; |
8287 pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; | 8240 pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; |
8288 pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; | 8241 pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; |
8289 pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; | 8242 pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; |
8290 v33 = (double)(a2->field_8 + 12) - v13; | 8243 v33 = (double)(a2->uScreenSpaceX + 12) - v13; |
8291 v34 = (double)a2->field_C - v15; | 8244 v34 = (double)a2->uScreenSpaceY - v15; |
8292 v35 = stru_5C6E00->SinCos(angle); | 8245 v35 = stru_5C6E00->SinCos(angle); |
8293 v36 = stru_5C6E00->SinCos(v19); | 8246 v36 = stru_5C6E00->SinCos(v19); |
8294 v37 = stru_5C6E00->SinCos(v19); | 8247 v37 = stru_5C6E00->SinCos(v19); |
8295 v38 = stru_5C6E00->SinCos(angle); | 8248 v38 = stru_5C6E00->SinCos(angle); |
8296 pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 | 8249 pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 |
8302 * v11 + v13; | 8255 * v11 + v13; |
8303 v39 = (((double)(unsigned __int16)v38 * 0.000015259022 + (double)(v38 >> 16)) * v34 | 8256 v39 = (((double)(unsigned __int16)v38 * 0.000015259022 + (double)(v38 >> 16)) * v34 |
8304 + ((double)(unsigned __int16)v37 * 0.000015259022 + (double)(v37 >> 16)) * v33 | 8257 + ((double)(unsigned __int16)v37 * 0.000015259022 + (double)(v37 >> 16)) * v33 |
8305 - 12.0) | 8258 - 12.0) |
8306 * v11 | 8259 * v11 |
8307 + (double)a2->field_C; | 8260 + (double)a2->uScreenSpaceY; |
8308 pBillboardRenderListD3D[v8].pQuards[2].specular = 0; | 8261 pBillboardRenderListD3D[v8].pQuards[2].specular = 0; |
8309 pBillboardRenderListD3D[v8].pQuards[2].pos.z = v24; | 8262 pBillboardRenderListD3D[v8].pQuards[2].pos.z = v24; |
8310 pBillboardRenderListD3D[v8].pQuards[2].rhw = v25; | 8263 pBillboardRenderListD3D[v8].pQuards[2].rhw = v25; |
8311 pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; | 8264 pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; |
8312 pBillboardRenderListD3D[v8].pQuards[2].pos.y = v39; | 8265 pBillboardRenderListD3D[v8].pQuards[2].pos.y = v39; |
8313 pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; | 8266 pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; |
8314 pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; | 8267 pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; |
8315 v40 = (double)(a2->field_8 + 12) - v13; | 8268 v40 = (double)(a2->uScreenSpaceX + 12) - v13; |
8316 v41 = (double)(a2->field_C - 25) - v15; | 8269 v41 = (double)(a2->uScreenSpaceY - 25) - v15; |
8317 v42 = stru_5C6E00->SinCos(angle); | 8270 v42 = stru_5C6E00->SinCos(angle); |
8318 v43 = stru_5C6E00->SinCos(v19); | 8271 v43 = stru_5C6E00->SinCos(v19); |
8319 v44 = stru_5C6E00->SinCos(v19); | 8272 v44 = stru_5C6E00->SinCos(v19); |
8320 v45 = stru_5C6E00->SinCos(angle); | 8273 v45 = stru_5C6E00->SinCos(angle); |
8321 pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 | 8274 pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 |
8327 * v11 + v13; | 8280 * v11 + v13; |
8328 v46 = (((double)(unsigned __int16)v45 * 0.000015259022 + (double)(v45 >> 16)) * v41 | 8281 v46 = (((double)(unsigned __int16)v45 * 0.000015259022 + (double)(v45 >> 16)) * v41 |
8329 + ((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 | 8282 + ((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 |
8330 - 12.0) | 8283 - 12.0) |
8331 * v11 | 8284 * v11 |
8332 + (double)a2->field_C; | 8285 + (double)a2->uScreenSpaceY; |
8333 pBillboardRenderListD3D[v8].pQuards[3].specular = 0; | 8286 pBillboardRenderListD3D[v8].pQuards[3].specular = 0; |
8334 pBillboardRenderListD3D[v8].pQuards[3].pos.z = v24; | 8287 pBillboardRenderListD3D[v8].pQuards[3].pos.z = v24; |
8335 pBillboardRenderListD3D[v8].pQuards[3].rhw = v25; | 8288 pBillboardRenderListD3D[v8].pQuards[3].rhw = v25; |
8336 pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; | 8289 pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; |
8337 pBillboardRenderListD3D[v8].pTexture = a3; | 8290 pBillboardRenderListD3D[v8].pTexture = a3; |
8381 auto a1 = this; | 8334 auto a1 = this; |
8382 a3 = a1; | 8335 a3 = a1; |
8383 if ( a1->uNumD3DSceneBegins ) | 8336 if ( a1->uNumD3DSceneBegins ) |
8384 { | 8337 { |
8385 v5 = a2; | 8338 v5 = a2; |
8386 v6 = (double)HIWORD(a2->field_28); | 8339 v6 = (double)HIWORD(a2->sZValue); |
8387 v31 = v6; | 8340 v31 = v6; |
8388 v7 = v6; | 8341 v7 = v6; |
8389 v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); | 8342 v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); |
8390 if ( BYTE3(v5->uTintColor) ) | 8343 if ( BYTE3(v5->uTintColor) ) |
8391 pBillboardRenderListD3D[v8].bOpaque = 3; | 8344 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3; |
8392 else | 8345 else |
8393 pBillboardRenderListD3D[v8].bOpaque = 0; | 8346 pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Transparent; |
8394 v9 = pSprite; | 8347 v9 = pSprite; |
8395 pBillboardRenderListD3D[v8].field_90 = v5->field_44; | 8348 pBillboardRenderListD3D[v8].field_90 = v5->field_44; |
8396 pBillboardRenderListD3D[v8].field_94 = v5->field_28; | 8349 pBillboardRenderListD3D[v8].sZValue = v5->sZValue; |
8397 pBillboardRenderListD3D[v8].uParentBillboardID = v5->uParentBillboardID; | 8350 pBillboardRenderListD3D[v8].uParentBillboardID = v5->uParentBillboardID; |
8398 v24 = v5->field_8; | 8351 v24 = v5->uScreenSpaceX; |
8399 v23 = v5->field_C; | 8352 v23 = v5->uScreenSpaceY; |
8400 v30 = (double)(v5->field_10 & 0xFFFF) * 0.000015260186 + (double)HIWORD(v5->field_10); | 8353 v30 = (double)(v5->field_10 & 0xFFFF) * 0.000015260186 + (double)HIWORD(v5->field_10); |
8401 v29 = (double)(v5->field_14 & 0xFFFF) * 0.000015260186 + (double)HIWORD(v5->field_14); | 8354 v29 = (double)(v5->field_14 & 0xFFFF) * 0.000015260186 + (double)HIWORD(v5->field_14); |
8402 pSpritea = (double)((v9->uBufferWidth >> 1) - v9->uAreaX); | 8355 pSpritea = (double)((v9->uBufferWidth >> 1) - v9->uAreaX); |
8403 v26 = (double)(v9->uBufferHeight - v9->uAreaY); | 8356 v26 = (double)(v9->uBufferHeight - v9->uAreaY); |
8404 if ( v5->uFlags & 4 ) | 8357 if ( v5->uFlags & 4 ) |
8479 } | 8432 } |
8480 } | 8433 } |
8481 | 8434 |
8482 | 8435 |
8483 //----- (004A48E4) -------------------------------------------------------- | 8436 //----- (004A48E4) -------------------------------------------------------- |
8484 int Render::_4A48E4(int a2, int a3, int a4, int a5, int a6) | 8437 int Render::MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6) |
8485 { | 8438 { |
8486 int v6; // ecx@1 | 8439 int v6; // ecx@1 |
8487 int v7; // ebx@1 | 8440 int v7; // ebx@1 |
8488 int v8; // ecx@1 | 8441 int v8; // ecx@1 |
8489 int v9; // edx@1 | 8442 int v9; // edx@1 |
8496 int v16; // [sp+18h] [bp-4h]@1 | 8449 int v16; // [sp+18h] [bp-4h]@1 |
8497 int v17; // [sp+24h] [bp+8h]@1 | 8450 int v17; // [sp+24h] [bp+8h]@1 |
8498 unsigned int v18; // [sp+28h] [bp+Ch]@1 | 8451 unsigned int v18; // [sp+28h] [bp+Ch]@1 |
8499 int v19; // [sp+34h] [bp+18h]@1 | 8452 int v19; // [sp+34h] [bp+18h]@1 |
8500 | 8453 |
8501 v6 = a2; | 8454 v6 = screenSpaceX; |
8502 v7 = (a6 >> 1) + a3; | 8455 v7 = (a6 >> 1) + screenSpaceY; |
8503 v17 = 0; | 8456 v17 = 0; |
8504 v15 = 0; | 8457 v15 = 0; |
8505 v8 = (a6 >> 1) + v6; | 8458 v8 = (a6 >> 1) + v6; |
8506 v14 = (a6 >> 1) * (a6 >> 1); | 8459 v14 = (a6 >> 1) * (a6 >> 1); |
8507 v9 = 2 * (a6 >> 1); | 8460 v9 = 2 * (a6 >> 1); |
8508 v10 = (a6 >> 1) * ((a6 >> 1) - 1); | 8461 v10 = (a6 >> 1) * ((a6 >> 1) - 1); |
8509 x = v8 - (a6 >> 1); | 8462 x = v8 - (a6 >> 1); |
8510 v16 = (a6 >> 1) + a3 - v8; | 8463 v16 = (a6 >> 1) + screenSpaceY - v8; |
8511 v19 = a6 >> 1; | 8464 v19 = a6 >> 1; |
8512 v13 = v9; | 8465 v13 = v9; |
8513 v18 = v8; | 8466 v18 = v8; |
8514 do | 8467 do |
8515 { | 8468 { |
8516 sub_4A46E6(x, v16 + v18, a4, 2 * v19, a5); | 8469 sr_4A46E6_draw_particle_segment(x, v16 + v18, z, 2 * v19, lightColor); |
8517 if ( v15 ) | 8470 if ( v15 ) |
8518 sub_4A46E6(x, v17 + v7, a4, 2 * v19, a5); | 8471 sr_4A46E6_draw_particle_segment(x, v17 + v7, z, 2 * v19, lightColor); |
8519 v14 -= v15; | 8472 v14 -= v15; |
8520 if ( v14 <= v10 ) | 8473 if ( v14 <= v10 ) |
8521 { | 8474 { |
8522 if ( v19 != v17 ) | 8475 if ( v19 != v17 ) |
8523 { | 8476 { |
8524 sub_4A46E6(v18, v16 + x, a4, 2 * v17, a5); | 8477 sr_4A46E6_draw_particle_segment(v18, v16 + x, z, 2 * v17, lightColor); |
8525 sub_4A46E6(v18, v19 + v7, a4, 2 * v17, a5); | 8478 sr_4A46E6_draw_particle_segment(v18, v19 + v7, z, 2 * v17, lightColor); |
8526 } | 8479 } |
8527 --v19; | 8480 --v19; |
8528 v13 -= 2; | 8481 v13 -= 2; |
8529 ++x; | 8482 ++x; |
8530 v10 -= v13; | 8483 v10 -= v13; |
8711 } | 8664 } |
8712 v5 = Billboard_ProbablyAddToListAndSortByZOrder(v14); | 8665 v5 = Billboard_ProbablyAddToListAndSortByZOrder(v14); |
8713 v6 = 0; | 8666 v6 = 0; |
8714 pBillboardRenderListD3D[v5].field_90 = 0; | 8667 pBillboardRenderListD3D[v5].field_90 = 0; |
8715 pBillboardRenderListD3D[v5].uParentBillboardID = -1; | 8668 pBillboardRenderListD3D[v5].uParentBillboardID = -1; |
8716 pBillboardRenderListD3D[v5].bOpaque = 2; | 8669 pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; |
8717 if ( a1->field_10 > 0 ) | 8670 if ( a1->field_10 > 0 ) |
8718 { | 8671 { |
8719 v7 = (char *)&a1->field_14[62]; | 8672 v7 = (char *)&a1->field_14[62]; |
8720 v8 = (char *)&pBillboardRenderListD3D[v5].pQuards[0].pos.z; | 8673 v8 = (char *)&pBillboardRenderListD3D[v5].pQuards[0].pos.z; |
8721 do | 8674 do |
8753 | 8706 |
8754 | 8707 |
8755 //----- (004A4DE1) -------------------------------------------------------- | 8708 //----- (004A4DE1) -------------------------------------------------------- |
8756 bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture) | 8709 bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture) |
8757 { | 8710 { |
8758 //const char *v5; // ebx@1 | |
8759 //Render *v6; // edi@1 | |
8760 //HWLTexture *pHWLTexture; // esi@1 | |
8761 //signed int result; // eax@1 | |
8762 //IDirectDrawSurface **v9; // ebx@9 | |
8763 //IDirectDrawSurface4 *v10; // edi@11 | |
8764 //int v11; // ebx@11 | |
8765 HRESULT v12; // eax@14 | 8711 HRESULT v12; // eax@14 |
8766 unsigned __int16 *v13; // ecx@19 | 8712 unsigned __int16 *v13; // ecx@19 |
8767 unsigned __int16 *v14; // eax@19 | 8713 unsigned __int16 *v14; // eax@19 |
8768 DWORD v15; // edx@20 | 8714 DWORD v15; // edx@20 |
8769 HRESULT v16; // eax@23 | 8715 HRESULT v16; // eax@23 |
8770 stru350 Dst; // [sp+Ch] [bp-F8h]@12 | 8716 stru350 Dst; // [sp+Ch] [bp-F8h]@12 |
8771 //DDSURFACEDESC2 desc; // [sp+6Ch] [bp-98h]@13 | |
8772 //DDSCAPS2 v19; // [sp+E8h] [bp-1Ch]@13 | |
8773 //int v20; // [sp+100h] [bp-4h]@12 | |
8774 | 8717 |
8775 auto pHWLTexture = pD3DBitmaps.LoadTexture(pName, bMipMaps); | 8718 auto pHWLTexture = pD3DBitmaps.LoadTexture(pName, bMipMaps); |
8776 if ( pHWLTexture ) | 8719 if ( pHWLTexture ) |
8777 { | 8720 { |
8778 bMipMaps = !strncmp(pName, "HDWTR", 5); | 8721 bMipMaps = !strncmp(pName, "HDWTR", 5); |
11268 } | 11211 } |
11269 fread(pSpriteOffsets, 4, uNumItems, pFile); | 11212 fread(pSpriteOffsets, 4, uNumItems, pFile); |
11270 | 11213 |
11271 return true; | 11214 return true; |
11272 } | 11215 } |
11216 | |
11217 | |
11218 | |
11219 | |
11220 | |
11221 | |
11222 | |
11223 | |
11224 | |
11225 //----- (004A1C1E) -------------------------------------------------------- | |
11226 void DoRenderBillboards_D3D() | |
11227 { | |
11228 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); | |
11229 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); | |
11230 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); | |
11231 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); | |
11232 | |
11233 for (uint i = pRenderer->uNumBillboardsToDraw - 1; i != (uint)-1; --i) | |
11234 { | |
11235 auto p = pRenderer->pBillboardRenderListD3D + i; | |
11236 | |
11237 if (p->uOpacity != RenderBillboardD3D::InvalidOpacity) | |
11238 SetBillboardBlendOptions(p->uOpacity); | |
11239 | |
11240 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture)); | |
11241 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
11242 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
11243 p->pQuards, | |
11244 p->uNumVertices, | |
11245 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); | |
11246 } | |
11247 | |
11248 if (pRenderer->bFogEnabled) | |
11249 { | |
11250 pRenderer->bFogEnabled = false; | |
11251 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1)); | |
11252 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); | |
11253 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
11254 } | |
11255 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 2)); | |
11256 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1)); | |
11257 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); | |
11258 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); | |
11259 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); | |
11260 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u)); | |
11261 } | |
11262 | |
11263 | |
11264 | |
11265 | |
11266 | |
11267 //----- (004A1DA8) -------------------------------------------------------- | |
11268 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1) | |
11269 { | |
11270 switch (a1) | |
11271 { | |
11272 case RenderBillboardD3D::Transparent: | |
11273 { | |
11274 if (pRenderer->bFogEnabled) | |
11275 { | |
11276 pRenderer->bFogEnabled = false; | |
11277 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1u)); | |
11278 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); | |
11279 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | |
11280 } | |
11281 | |
11282 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5)); | |
11283 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6u)); | |
11284 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1)); | |
11285 } | |
11286 break; | |
11287 | |
11288 case RenderBillboardD3D::Opaque_1: | |
11289 case RenderBillboardD3D::Opaque_2: | |
11290 case RenderBillboardD3D::Opaque_3: | |
11291 { | |
11292 if (pRenderer->bUsingSpecular) | |
11293 { | |
11294 if (!pRenderer->bFogEnabled) | |
11295 { | |
11296 pRenderer->bFogEnabled = true; | |
11297 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); | |
11298 } | |
11299 } | |
11300 | |
11301 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); | |
11302 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u)); | |
11303 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); | |
11304 } | |
11305 break; | |
11306 | |
11307 default: | |
11308 Log::Warning(L"SetBillboardBlendOptions: invalid opacity type (%u)", a1); | |
11309 break; | |
11310 } | |
11311 } | |
11312 |