Mercurial > mm7
changeset 1390:613c77e51e38
Messed with spell effects drawing a bit.
author | Nomad |
---|---|
date | Thu, 18 Jul 2013 04:08:20 +0200 |
parents | 4dc34f7acb0b |
children | cc9a3a24d61d 91ff22cc755b |
files | Indoor.cpp LightmapBuilder.cpp ParticleEngine.cpp ParticleEngine.h Render.cpp Render.h SpriteObject.cpp Vis.cpp mm7_3.cpp mm7_4.cpp mm7_data.h stru6.cpp stru6.h |
diffstat | 13 files changed, 918 insertions(+), 1123 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Wed Jul 17 00:40:15 2013 +0200 +++ b/Indoor.cpp Thu Jul 18 04:08:20 2013 +0200 @@ -589,7 +589,7 @@ } if (pFace->uAttributes & FACE_DO_NOT_LIGHT) - _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); + pRenderer->DrawIndoorPolygonNoLight(uNumVerticesa, uFaceID); else pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0); return; @@ -5612,9 +5612,9 @@ local_0.x = v5; local_0.y = (double)v2->vPosition.y; local_0.z = (double)v2->vPosition.z; - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 0.0; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.flt_28 = 1.0; local_0.timeToLive = (rand() & 0x80) + 128; local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); @@ -7066,7 +7066,7 @@ break; } if ( min_y >= max_y ) - return false;// incorect working portal faceID 1105(не до конца корректно работает портал фейс 1105 под определённым углом) + return false; //************************************************************************************************************************************* v59 = min_y; for ( v46 = max_y - min_y + 1; v46; --v46 )
--- a/LightmapBuilder.cpp Wed Jul 17 00:40:15 2013 +0200 +++ b/LightmapBuilder.cpp Thu Jul 18 04:08:20 2013 +0200 @@ -1,3 +1,5 @@ +#include <assert.h> + #include "LightmapBuilder.h" #include "Game.h" #include "stru314.h" @@ -1584,7 +1586,7 @@ //----- (0045D74F) -------------------------------------------------------- char LightmapBuilder::_45D74F_MessWithLight(int a2, int *a3) { - char v3; // zf@1 + //char v3; // zf@1 IDirect3DDevice3 *v4; // eax@2 HRESULT v5; // eax@2 //char *v6; // eax@2 @@ -1595,15 +1597,15 @@ HRESULT v11; // eax@8 HRESULT v12; // eax@8 int *v13; // eax@8 - float v14; // ecx@15 - IDirect3DDevice3 *v15; // eax@21 - HRESULT v16; // eax@21 - IDirect3DDevice3 *v17; // eax@21 - HRESULT v18; // eax@21 - IDirect3DDevice3 *v19; // eax@21 - HRESULT v20; // eax@21 - IDirect3DDevice3 *v21; // eax@21 - HRESULT v22; // eax@21 + //float v14; // ecx@15 + //IDirect3DDevice3 *v15; // eax@21 + //HRESULT v16; // eax@21 + //IDirect3DDevice3 *v17; // eax@21 + //HRESULT v18; // eax@21 + //IDirect3DDevice3 *v19; // eax@21 + //HRESULT v20; // eax@21 + //IDirect3DDevice3 *v21; // eax@21 + //HRESULT v22; // eax@21 //IDirect3DDevice3 *v23; // eax@23 std::string v25; // [sp+44h] [bp-44h]@12 signed int v26; // [sp+48h] [bp-40h]@21 @@ -1617,16 +1619,16 @@ int v34; // [sp+74h] [bp-14h]@19 int v35; // [sp+78h] [bp-10h]@2 int *v36; // [sp+7Ch] [bp-Ch]@10 - int a1; // [sp+80h] [bp-8h]@12 - float v38; // [sp+84h] [bp-4h]@1 + //int a1; // [sp+80h] [bp-8h]@12 + //float v38; // [sp+84h] [bp-4h]@1 - v3 = this->std__vector_000004_size == 0; - LODWORD(v38) = (int)this; - if ( !v3 ) - { + if (std__vector_000004_size == 0) + return 1; + + __debugbreak(); //v30 = 0.0; //v4 = pRenderer->pRenderD3D->pDevice; - ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3)); //v6 = (char *)stru_69BD44.c_str(); //if ( !stru_69BD44.c_str() ) // v6 = (char *)&dword_4D86F0; @@ -1651,12 +1653,9 @@ v36 = a3; do { - v28 = (Lightmap *)(3100 * *v13 + LODWORD(v38) + 4); + v28 = &std__vector_000004[*v13]; if ( !DrawLightmap(v28, (Vec3_float_ *)&arg4, 0.0) ) - { - MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1230", 0); - a1 = 5080812; - } + assert(false && "Invalid lightmap detected!"); v13 = v36 + 1; v36 = v13; } @@ -1665,31 +1664,27 @@ } else { - v14 = v38; v36 = 0; - if ( *(unsigned int *)(LODWORD(v38) + 1587204) > 0 ) + if (std__vector_000004_size > 0 ) { - a1 = LODWORD(v38) + 4; while ( 1 ) { - if ( !DrawLightmap((Lightmap *)a1, (Vec3_float_ *)&arg4, 0.0) ) + auto _a1 = &std__vector_000004[(int)v36]; + if ( !DrawLightmap(_a1, (Vec3_float_ *)&arg4, 0.0) ) { MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0); v35 = 5080812; } v36 = (int *)((char *)v36 + 1); - a1 += 3100; - if ( (signed int)v36 >= *(unsigned int *)(LODWORD(v38) + 1587204) ) + if ( (signed int)v36 >= std__vector_000004_size) break; - v14 = v38; } } } - v15 = pRenderer->pRenderD3D->pDevice; - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); } if ( pRenderer->bUsingSpecular ) { @@ -1705,7 +1700,7 @@ //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice; ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); } - } + return 1; }
--- a/ParticleEngine.cpp Wed Jul 17 00:40:15 2013 +0200 +++ b/ParticleEngine.cpp Thu Jul 18 04:08:20 2013 +0200 @@ -65,9 +65,9 @@ v4->_x = a2->x; v4->_y = a2->y; v4->_z = a2->z; - v4->flt_10 = a2->flt_10; - v4->flt_14 = a2->flt_14; - v4->flt_18 = a2->flt_18; + v4->flt_10 = a2->r; + v4->flt_14 = a2->g; + v4->flt_18 = a2->b; v5 = a2->uDiffuse; v4->uParticleColor = v5; v4->uLightColor_bgr = v5;
--- a/ParticleEngine.h Wed Jul 17 00:40:15 2013 +0200 +++ b/ParticleEngine.h Thu Jul 18 04:08:20 2013 +0200 @@ -23,9 +23,9 @@ float x; float y; float z; - float flt_10; - float flt_14; - float flt_18; + float r; + float g; + float b; unsigned int uDiffuse; int timeToLive; unsigned int uTextureID;
--- a/Render.cpp Wed Jul 17 00:40:15 2013 +0200 +++ b/Render.cpp Thu Jul 18 04:08:20 2013 +0200 @@ -3715,9 +3715,9 @@ local_0.x = v3; local_0.y = (double)*(signed int *)v0; local_0.z = (double)*((signed int *)v0 + 1); - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 0.0; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.flt_28 = 1.0; local_0.timeToLive = (rand() & 0x80) + 128; local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); @@ -7079,10 +7079,7 @@ pRenderD3D->ClearTarget(true, 0x00F08020, true, 1.0); pRenderer->uNumBillboardsToDraw = 0; pRenderD3D->pDevice->BeginScene(); - if (!pRenderD3D->DoesRaiseExceptions()) - { - MessageBoxW(nullptr, L"Error executing scratch 3D operations", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\screen16_3d.cpp:360", 0); - } + if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) uFogColor = GetLevelFogColor(); else @@ -7569,6 +7566,433 @@ } } + +//----- (00479A53) -------------------------------------------------------- +void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID) +{ + BLVFace *pFace; // esi@1 + unsigned int v3; // edi@1 + PolygonType v4; // al@1 + double v5; // st7@3 + signed __int64 v6; // qax@3 + PolygonType v7; // cl@3 + int v8; // esi@7 + int v9; // eax@7 + unsigned int v10; // eax@7 + double v11; // st6@7 + int v12; // edx@7 + int v13; // eax@7 + char *v14; // esi@8 + void *v15; // ecx@9 + int v16; // eax@9 + int v17; // edi@9 + double v18; // st7@9 + signed int v19; // ebx@9 + void *v20; // ecx@9 + int v21; // ebx@11 + int v22; // eax@14 + signed __int64 v23; // qtt@16 + double v24; // st7@16 + unsigned __int8 v25; // sf@16 + unsigned __int8 v26; // of@16 + Render *v27; // ecx@17 + double v28; // st7@20 + char *v29; // ebx@20 + char *v30; // edx@20 + unsigned __int8 v31; // c0@21 + unsigned __int8 v32; // c3@21 + double v33; // st6@23 + char *v34; // esi@30 + const void *v35; // ecx@31 + int v36; // eax@31 + const void *v37; // edi@31 + signed __int64 v38; // qax@31 + int v39; // ecx@31 + int v40; // ebx@33 + int v41; // eax@36 + signed __int64 v42; // qtt@39 + int v43; // eax@39 + char v44; // zf@39 + double v45; // st7@39 + double v46; // st7@39 + unsigned int v47; // edx@40 + double v48; // st7@41 + RenderVertexSoft *v49; // ebx@41 + void *v50; // edi@43 + double v51; // st7@46 + RenderVertexSoft *v52; // edx@46 + void *v53; // edi@48 + char *v54; // ebx@52 + unsigned int v55; // eax@53 + unsigned int v56; // eax@55 + int v57; // ST10_4@55 + Texture *v58; // eax@55 + signed int v59; // [sp-4h] [bp-178h]@17 + stru148 *v60; // [sp+0h] [bp-174h]@17 + IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 + stru148 v62; // [sp+14h] [bp-160h]@6 + unsigned int v63; // [sp+120h] [bp-54h]@7 + double v64; // [sp+124h] [bp-50h]@7 + unsigned int v65; // [sp+128h] [bp-4Ch]@1 + unsigned int v66; // [sp+12Ch] [bp-48h]@7 + float v67; // [sp+130h] [bp-44h]@7 + __int64 v68; // [sp+134h] [bp-40h]@3 + __int64 v69; // [sp+13Ch] [bp-38h]@3 + int v70; // [sp+144h] [bp-30h]@3 + int X; // [sp+148h] [bp-2Ch]@9 + int v72; // [sp+14Ch] [bp-28h]@7 + float v73; // [sp+150h] [bp-24h]@16 + unsigned int v74; // [sp+154h] [bp-20h]@3 + RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3 + float v76; // [sp+15Ch] [bp-18h]@9 + int v77; // [sp+160h] [bp-14h]@9 + int v78; // [sp+164h] [bp-10h]@7 + void *v79; // [sp+168h] [bp-Ch]@9 + float v80; // [sp+16Ch] [bp-8h]@3 + const void *v81; // [sp+170h] [bp-4h]@7 + + __debugbreak(); + + pFace = &pIndoor->pFaces[uFaceID]; + v65 = uFaceID; + v3 = uNumVertices; + v4 = pFace->uPolygonType; + if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor ) + { + if ( (signed int)uNumVertices > 0 ) + { + v54 = (char *)&array_507D30[0].u; + LODWORD(v80) = uNumVertices; + do + { + v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x; + *(float *)v54 = (double)v69 + *(float *)v54; + *(float *)v54 = *(float *)v54 * 0.25; + v55 = GetTickCount(); + v54 += 48; + v44 = LODWORD(v80)-- == 1; + v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5); + *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; + } + while ( !v44 ); + uFaceID = v65; + } + v56 = 8 * uFaceID; + LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); + v57 = v56; + v58 = pFace->GetTexture(); + pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); + return; + } + HIDWORD(v69) = pIndoorCamera->sRotationX; + HIDWORD(v68) = pIndoorCamera->pos.z; + *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; + v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z) + / (((double)pBLVRenderParams->field_40 + 16192.0) + * 65536.0) + + *(float *)&v74); + v5 = (double)pIndoorCamera->sRotationX * 0.0030664064; + *(float *)&v75 = v5; + v80 = cos(v5) * 16192.0; + v6 = (signed __int64)(*(float *)&v74 + - (double)pBLVRenderParams->field_40 + / ((v80 + 0.0000001) + * 65535.0) + * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68))); + v7 = pFace->uPolygonType; + if ( v7 == 4 || v7 == 3 ) + v70 = v6; + stru_8019C8._48653D(65536, 0, 0, 0, 65536, 0); + v62._48607B(&stru_8019C8); + v62.uTileBitmapID = pFace->uBitmapID; + v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); + if ( !v62.pTexture ) + return; + v8 = pBLVRenderParams->sPartyRotX; + v62.dimming_level = 0; + v62.uNumVertices = v3; + v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); + v62.v_18.y = 0; + v62.v_18.x = -v9; + v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); + v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; + memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); + LODWORD(v80) = v10; + v62.field_24 = 33554432; + v64 = (double)(signed int)v10 * 0.5; + v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); + LODWORD(v80) = v62.pTexture->uTextureWidth; + v11 = 1.0 / (double)SLODWORD(v80); + LODWORD(v80) = v62.pTexture->uTextureHeight; + v12 = v62.pTexture->uWidthMinus1; + v13 = v62.pTexture->uHeightMinus1; + v67 = v11; + v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; + v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; + v78 = 0; + v81 = 0; + *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80); + if ( (signed int)v62.uNumVertices <= 0 ) + { +LABEL_17: + v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; + v27 = pRenderer; + v60 = &v62; + v59 = v62.uNumVertices; + goto LABEL_18; + } + v14 = (char *)&array_507D30[0].vWorldViewProjY; + while ( 2 ) + { + v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14)); + LODWORD(v80) = v62.ptr_38->field_14; + v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; + v16 = v77 + v62.ptr_38->field_C; + v77 = (int)v15; + v74 = v16; + LODWORD(v80) = v62.ptr_38->field_20; + v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; + v79 = v15; + v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18); + LODWORD(v80) = v62.v_18.z; + v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16); + v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1)); + v18 = *(float *)v14 - 1.0; + v19 = -v62.field_24; + v77 = -v62.field_24; + X = (int)((char *)v79 + v62.v_18.x); + LODWORD(v76) = (signed __int64)v18; + v20 = (void *)(v72 * (v70 - LODWORD(v76))); + while ( 1 ) + { + v79 = v20; + if ( !X ) + goto LABEL_14; + v21 = abs(v19 >> 14); + if ( v21 <= abs(X) ) + break; + if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) + break; + v19 = v77; + v20 = v79; +LABEL_14: + LODWORD(v80) = v62.v_18.z; + v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16); + v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16; + --LODWORD(v76); + v20 = (char *)v20 + v72; + X = v22 + v62.v_18.x; + v78 = 1; + } + if ( !v78 ) + { + LODWORD(v23) = v77 << 16; + HIDWORD(v23) = v77 >> 16; + v79 = (void *)(v23 / X); + v77 = v17; + LODWORD(v80) = v62.ptr_38->field_10; + v77 = v17; + LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16); + LODWORD(v80) = v62.ptr_38->field_1C; + v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16)); + v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; + LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; + v14 += 48; + LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); + v81 = (char *)v81 + 1; + v24 = (double)SLODWORD(v80) * 0.000015259022; + LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); + v26 = __OFSUB__((int)v81, v62.uNumVertices); + v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0; + *((float *)v14 - 10) = v24 * v67; + *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1); + *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79; + if ( !(v25 ^ v26) ) + goto LABEL_17; + continue; + } + break; + } + LODWORD(v73) = 0; + v80 = v76; + if ( (signed int)v62.uNumVertices > 0 ) + { + v28 = (double)SLODWORD(v76); + LODWORD(v76) = (int)(char *)array_50AC10 + 28; + v29 = (char *)&array_50AC10[0].vWorldViewProjX; + v30 = (char *)&array_507D30[1].vWorldViewProjY; + v79 = array_50AC10; + v81 = array_507D30; + v78 = v62.uNumVertices; + do + { + v31 = v28 < *((float *)v30 - 12); + v32 = v28 == *((float *)v30 - 12); + ++LODWORD(v73); + memcpy(v79, v81, 0x30u); + v79 = (char *)v79 + 48; + LODWORD(v76) += 48; + v29 += 48; + if ( v31 | v32 || v28 >= *(float *)v30 ) + { + if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 ) + goto LABEL_28; + v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12)) + + *((float *)v30 - 1); + } + else + { + v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30) + + *((float *)v30 - 13); + } + *(float *)v29 = v33; + v79 = (char *)v79 + 48; + v29 += 48; + ++LODWORD(v73); + *(unsigned int *)LODWORD(v76) = v28; + LODWORD(v76) += 48; +LABEL_28: + v81 = (char *)v81 + 48; + v30 += 48; + --v78; + } + while ( v78 ); + } + if ( SLODWORD(v73) <= 0 ) + goto LABEL_40; + v34 = (char *)&array_50AC10[0].vWorldViewProjY; + v65 = v77 >> 14; + HIDWORD(v69) = LODWORD(v73); + do + { + v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); + v78 = v62.ptr_38->field_14; + v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); + v36 = (int)((char *)v81 + v62.ptr_38->field_C); + v81 = v35; + v74 = v36; + v78 = v62.ptr_38->field_20; + v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); + v78 = (int)v35; + v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->field_18); + v81 = (const void *)v62.v_18.z; + v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16; + v37 = (const void *)(v72 + * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); + v38 = (signed __int64)(*(float *)v34 - 1.0); + v81 = 0; + LODWORD(v76) = v38; + v39 = v72 * (v70 - v38); + while ( 1 ) + { + v78 = v39; + if ( !X ) + goto LABEL_36; + v40 = abs(X); + if ( abs((signed __int64)v65) <= v40 ) + break; + if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) + break; + v39 = v78; +LABEL_36: + v78 = v62.v_18.z; + v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; + --LODWORD(v76); + v39 += v72; + X = v41 + v62.v_18.x; + v81 = (const void *)1; + } + if ( v81 ) + { + v79 = (void *)v62.v_18.z; + v78 = 2 * LODWORD(v76); + v81 = (const void *)((unsigned __int64)(v62.v_18.z + * (signed __int64)(signed int)(signed __int64)(((double)v70 + - ((double)(2 * LODWORD(v76)) + - *(float *)v34)) + * (double)v72)) >> 16); + X = (int)((char *)v81 + v62.v_18.x); + } + LODWORD(v42) = v77 << 16; + HIDWORD(v42) = v77 >> 16; + v79 = (void *)(v42 / X); + v81 = v37; + v78 = v62.ptr_38->field_10; + v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); + v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); + v74 = (unsigned int)v37; + LODWORD(v76) = v43; + v78 = v62.ptr_38->field_1C; + v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); + v74 = (unsigned __int64)(v43 * v42 / X) >> 16; + v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); + v34 += 48; + v78 = v66 + ((signed int)v74 >> 4); + v44 = HIDWORD(v69)-- == 1; + v45 = (double)v78 * 0.000015259022; + v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); + *((float *)v34 - 10) = v45 * v67; + *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1); + v46 = (double)(signed int)v79; + *((float *)v34 - 16) = 0.000015258789 * v46; + *((float *)v34 - 11) = 65536.0 / v46; + } + while ( !v44 ); +LABEL_40: + v47 = 0; + if ( SLODWORD(v73) > 0 ) + { + v48 = (double)SLODWORD(v80); + v75 = array_507D30; + v49 = array_50AC10; + HIDWORD(v69) = LODWORD(v73); + do + { + if ( v48 >= v49->vWorldViewProjY ) + { + v50 = v75; + ++v47; + ++v75; + memcpy(v50, v49, 0x30u); + } + ++v49; + --HIDWORD(v69); + } + while ( HIDWORD(v69) ); + } + v62.uNumVertices = v47; + pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]); + *(float *)&v74 = 0.0; + if ( SLODWORD(v73) > 0 ) + { + v51 = (double)SLODWORD(v80); + v75 = array_507D30; + v52 = array_50AC10; + v80 = v73; + do + { + if ( v51 <= v52->vWorldViewProjY ) + { + v53 = v75; + ++v74; + ++v75; + memcpy(v53, v52, 0x30u); + } + ++v52; + --LODWORD(v80); + } + while ( v80 != 0.0 ); + } + v62.uNumVertices = v74; + v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; + v60 = &v62; + v59 = v74; + v27 = pRenderer; +LABEL_18: + v27->_4A2ED5(v59, v60, v61); +} + + //----- (004A2FC0) -------------------------------------------------------- void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) { @@ -7841,54 +8265,54 @@ v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); } //v13 = (double)v25; - pBillboardRenderListD3D[v7].pQuards[0].specular = 0; - pBillboardRenderListD3D[v7].pQuards[0].diffuse = v12; - pBillboardRenderListD3D[v7].pQuards[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1; + pBillboardRenderListD3D[v7].pQuads[0].specular = 0; + pBillboardRenderListD3D[v7].pQuads[0].diffuse = v12; + pBillboardRenderListD3D[v7].pQuads[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1; //v14 = (double)v24; //v32 = v14; - pBillboardRenderListD3D[v7].pQuards[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29; + pBillboardRenderListD3D[v7].pQuads[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29; v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894); - pBillboardRenderListD3D[v7].pQuards[0].pos.z = v15; + pBillboardRenderListD3D[v7].pQuads[0].pos.z = v15; v16 = 1.0 / pSoftBillboard->zbuffer_depth; - pBillboardRenderListD3D[v7].pQuards[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth; - pBillboardRenderListD3D[v7].pQuards[0].texcoord.x = 0.0; - pBillboardRenderListD3D[v7].pQuards[0].texcoord.y = 0.0; + pBillboardRenderListD3D[v7].pQuads[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth; + pBillboardRenderListD3D[v7].pQuads[0].texcoord.x = 0.0; + pBillboardRenderListD3D[v7].pQuads[0].texcoord.y = 0.0; v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight); if ( pSoftBillboard->uFlags & 4 ) v17 = v17 * -1.0; - pBillboardRenderListD3D[v7].pQuards[1].specular = 0; - pBillboardRenderListD3D[v7].pQuards[1].diffuse = v12; - pBillboardRenderListD3D[v7].pQuards[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1; - pBillboardRenderListD3D[v7].pQuards[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29; - pBillboardRenderListD3D[v7].pQuards[1].pos.z = v15; - pBillboardRenderListD3D[v7].pQuards[1].rhw = v16; - pBillboardRenderListD3D[v7].pQuards[1].texcoord.x = 0.0; - pBillboardRenderListD3D[v7].pQuards[1].texcoord.y = 1.0; + pBillboardRenderListD3D[v7].pQuads[1].specular = 0; + pBillboardRenderListD3D[v7].pQuads[1].diffuse = v12; + pBillboardRenderListD3D[v7].pQuads[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1; + pBillboardRenderListD3D[v7].pQuads[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29; + pBillboardRenderListD3D[v7].pQuads[1].pos.z = v15; + pBillboardRenderListD3D[v7].pQuads[1].rhw = v16; + pBillboardRenderListD3D[v7].pQuads[1].texcoord.x = 0.0; + pBillboardRenderListD3D[v7].pQuads[1].texcoord.y = 1.0; v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight; v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); if ( pSoftBillboard->uFlags & 4 ) v20 = v20 * -1.0; - pBillboardRenderListD3D[v7].pQuards[2].specular = 0; - pBillboardRenderListD3D[v7].pQuards[2].diffuse = v12; - pBillboardRenderListD3D[v7].pQuards[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX; - pBillboardRenderListD3D[v7].pQuards[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29; - pBillboardRenderListD3D[v7].pQuards[2].pos.z = v15; - pBillboardRenderListD3D[v7].pQuards[2].rhw = v16; - pBillboardRenderListD3D[v7].pQuards[2].texcoord.x = 1.0; - pBillboardRenderListD3D[v7].pQuards[2].texcoord.y = 1.0; + pBillboardRenderListD3D[v7].pQuads[2].specular = 0; + pBillboardRenderListD3D[v7].pQuads[2].diffuse = v12; + pBillboardRenderListD3D[v7].pQuads[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX; + pBillboardRenderListD3D[v7].pQuads[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29; + pBillboardRenderListD3D[v7].pQuads[2].pos.z = v15; + pBillboardRenderListD3D[v7].pQuads[2].rhw = v16; + pBillboardRenderListD3D[v7].pQuads[2].texcoord.x = 1.0; + pBillboardRenderListD3D[v7].pQuads[2].texcoord.y = 1.0; v21 = pSprite->uBufferHeight - pSprite->uAreaY; v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); if ( pSoftBillboard->uFlags & 4 ) v22 = v22 * -1.0; - pBillboardRenderListD3D[v7].pQuards[3].specular = 0; - pBillboardRenderListD3D[v7].pQuards[3].diffuse = v12; - pBillboardRenderListD3D[v7].pQuards[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX; - pBillboardRenderListD3D[v7].pQuards[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29; - pBillboardRenderListD3D[v7].pQuards[3].pos.z = v15; - pBillboardRenderListD3D[v7].pQuards[3].rhw = v16; - pBillboardRenderListD3D[v7].pQuards[3].texcoord.x = 1.0; - pBillboardRenderListD3D[v7].pQuards[3].texcoord.y = 0.0; + pBillboardRenderListD3D[v7].pQuads[3].specular = 0; + pBillboardRenderListD3D[v7].pQuads[3].diffuse = v12; + pBillboardRenderListD3D[v7].pQuads[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX; + pBillboardRenderListD3D[v7].pQuads[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29; + pBillboardRenderListD3D[v7].pQuads[3].pos.z = v15; + pBillboardRenderListD3D[v7].pQuads[3].rhw = v16; + pBillboardRenderListD3D[v7].pQuads[3].texcoord.x = 1.0; + pBillboardRenderListD3D[v7].pQuads[3].texcoord.y = 0.0; //v23 = pSprite->pTexture; pBillboardRenderListD3D[v7].uNumVertices = 4; pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth; @@ -7967,7 +8391,7 @@ v19 = stru_5C6E00->Sin(angle); v20 = stru_5C6E00->Sin(angle); v21 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + (double)(v18 >> 16)) * v16 - ((double)(unsigned __int16)v19 * 0.000015259022 @@ -7979,20 +8403,20 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[0].specular = 0; - pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[0].pos.y = v22; - pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894); - pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].specular = 0; + pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[0].pos.y = v22; + pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894); + pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; v31 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; v32 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); v25 = stru_5C6E00->Cos(angle); v26 = stru_5C6E00->Sin(angle); v27 = stru_5C6E00->Sin(angle); v28 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 + (double)(v25 >> 16)) * v31 - ((double)(unsigned __int16)v26 * 0.000015259022 @@ -8004,47 +8428,47 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuards[0].pos.z; - v30 = pBillboardRenderListD3D[v8].pQuards[0].rhw; - pBillboardRenderListD3D[v8].pQuards[1].pos.y = v29; - pBillboardRenderListD3D[v8].pQuards[1].specular = 0; - pBillboardRenderListD3D[v8].pQuards[1].rhw = v30; - pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuads[0].pos.z; + v30 = pBillboardRenderListD3D[v8].pQuads[0].rhw; + pBillboardRenderListD3D[v8].pQuads[1].pos.y = v29; + pBillboardRenderListD3D[v8].pQuads[1].specular = 0; + pBillboardRenderListD3D[v8].pQuads[1].rhw = v30; + pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; v23 = (double)(a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; v24 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); v33 = stru_5C6E00->Cos(angle); v34 = stru_5C6E00->Sin(angle); v35 = stru_5C6E00->Sin(angle); v36 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 + (double)(v33 >> 16)) * v23 - ((double)(unsigned __int16)v34 * 0.000015259022 + (double)(v34 >> 16)) * v24) * v11 + (double) a2->uScreenSpaceX; - v37 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; + v37 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v24 + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v23 - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[2].specular = 0; - pBillboardRenderListD3D[v8].pQuards[2].pos.z = v37; - pBillboardRenderListD3D[v8].pQuards[2].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; - pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[2].pos.y = v38; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].specular = 0; + pBillboardRenderListD3D[v8].pQuads[2].pos.z = v37; + pBillboardRenderListD3D[v8].pQuads[2].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; + pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[2].pos.y = v38; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; v39 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; v40 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); v41 = stru_5C6E00->Cos(angle); v42 = stru_5C6E00->Sin(angle); v43 = stru_5C6E00->Sin(angle); v44 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 + (double)(v41 >> 16)) * v39 - ((double)(unsigned __int16)v42 * 0.000015259022 @@ -8056,17 +8480,17 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - v46 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; - pBillboardRenderListD3D[v8].pQuards[3].specular = 0; - pBillboardRenderListD3D[v8].pQuards[3].pos.z = v46; - pBillboardRenderListD3D[v8].pQuards[3].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; - pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; + v46 = pBillboardRenderListD3D[v8].pQuads[0].pos.z; + pBillboardRenderListD3D[v8].pQuads[3].specular = 0; + pBillboardRenderListD3D[v8].pQuads[3].pos.z = v46; + pBillboardRenderListD3D[v8].pQuads[3].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw; + pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; pBillboardRenderListD3D[v8].pTexture = a3; pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; pBillboardRenderListD3D[v8].uNumVertices = 4; - pBillboardRenderListD3D[v8].pQuards[3].pos.y = v45; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[3].pos.y = v45; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; } } } @@ -8141,7 +8565,7 @@ v20 = stru_5C6E00->Sin(angle); v21 = stru_5C6E00->Sin(angle); v22 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + (double)(v18 >> 16)) * v16 - ((double)(unsigned __int16)v20 * 0.000015259022 @@ -8153,22 +8577,22 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[0].specular = 0; - pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[0].pos.y = v23; + pBillboardRenderListD3D[v8].pQuads[0].specular = 0; + pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[0].pos.y = v23; v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[0].pos.z = v24; + pBillboardRenderListD3D[v8].pQuads[0].pos.z = v24; v25 = 1.0 / v6; - pBillboardRenderListD3D[v8].pQuards[0].rhw = v25; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].rhw = v25; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; v26 = (double)(a2->uScreenSpaceX - 12) - v13; v27 = (double)a2->uScreenSpaceY - v15; v28 = stru_5C6E00->Cos(angle); v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v31 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v26 - ((double)(unsigned __int16)v29 * 0.000015259022 @@ -8180,20 +8604,20 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[1].pos.z = v24; - pBillboardRenderListD3D[v8].pQuards[1].pos.y = v32; - pBillboardRenderListD3D[v8].pQuards[1].specular = 0; - pBillboardRenderListD3D[v8].pQuards[1].rhw = v25; - pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[1].pos.z = v24; + pBillboardRenderListD3D[v8].pQuads[1].pos.y = v32; + pBillboardRenderListD3D[v8].pQuads[1].specular = 0; + pBillboardRenderListD3D[v8].pQuads[1].rhw = v25; + pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; v33 = (double)(a2->uScreenSpaceX + 12) - v13; v34 = (double)a2->uScreenSpaceY - v15; v35 = stru_5C6E00->Cos(angle); v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v38 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v33 - ((double)(unsigned __int16)v36 * 0.000015259022 @@ -8205,20 +8629,20 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[2].specular = 0; - pBillboardRenderListD3D[v8].pQuards[2].pos.z = v24; - pBillboardRenderListD3D[v8].pQuards[2].rhw = v25; - pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; - pBillboardRenderListD3D[v8].pQuards[2].pos.y = v39; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].specular = 0; + pBillboardRenderListD3D[v8].pQuads[2].pos.z = v24; + pBillboardRenderListD3D[v8].pQuads[2].rhw = v25; + pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[2].pos.y = v39; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; v40 = (double)(a2->uScreenSpaceX + 12) - v13; v41 = (double)(a2->uScreenSpaceY - 25) - v15; v42 = stru_5C6E00->Cos(angle); v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); v45 = stru_5C6E00->Cos(angle); - pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 + pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 + (double)(v42 >> 16)) * v40 - ((double)(unsigned __int16)v43 * 0.000015259022 @@ -8230,16 +8654,16 @@ - 12.0) * v11 + (double)a2->uScreenSpaceY; - pBillboardRenderListD3D[v8].pQuards[3].specular = 0; - pBillboardRenderListD3D[v8].pQuards[3].pos.z = v24; - pBillboardRenderListD3D[v8].pQuards[3].rhw = v25; - pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; + pBillboardRenderListD3D[v8].pQuads[3].specular = 0; + pBillboardRenderListD3D[v8].pQuads[3].pos.z = v24; + pBillboardRenderListD3D[v8].pQuads[3].rhw = v25; + pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse; pBillboardRenderListD3D[v8].pTexture = a3; pBillboardRenderListD3D[v8].z_order = v6; pBillboardRenderListD3D[v8].uNumVertices = 4; - pBillboardRenderListD3D[v8].pQuards[3].pos.y = v46; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[3].pos.y = v46; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; } } @@ -8287,53 +8711,53 @@ v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); if (a2->uFlags & 4) v14 *= -1.0; - pBillboardRenderListD3D[v8].pQuards[0].diffuse = diffuse; - pBillboardRenderListD3D[v8].pQuards[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30; - pBillboardRenderListD3D[v8].pQuards[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[0].specular = specular; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].diffuse = diffuse; + pBillboardRenderListD3D[v8].pQuads[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30; + pBillboardRenderListD3D[v8].pQuads[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29; + pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[0].specular = specular; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0; v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); if ( a2->uFlags & 4 ) v14 = v14 * -1.0; - pBillboardRenderListD3D[v8].pQuards[1].specular = specular; - pBillboardRenderListD3D[v8].pQuards[1].diffuse = diffuse; - pBillboardRenderListD3D[v8].pQuards[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30; - pBillboardRenderListD3D[v8].pQuards[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuards[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[1].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; - pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[1].specular = specular; + pBillboardRenderListD3D[v8].pQuads[1].diffuse = diffuse; + pBillboardRenderListD3D[v8].pQuads[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30; + pBillboardRenderListD3D[v8].pQuads[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29; + pBillboardRenderListD3D[v8].pQuads[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[1].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; + pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth); v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); if ( a2->uFlags & 4 ) v14 *= -1.0; - pBillboardRenderListD3D[v8].pQuards[2].diffuse = diffuse; - pBillboardRenderListD3D[v8].pQuards[2].specular = specular; - pBillboardRenderListD3D[v8].pQuards[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30; - pBillboardRenderListD3D[v8].pQuards[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuards[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[2].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].diffuse = diffuse; + pBillboardRenderListD3D[v8].pQuads[2].specular = specular; + pBillboardRenderListD3D[v8].pQuads[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30; + pBillboardRenderListD3D[v8].pQuads[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29; + pBillboardRenderListD3D[v8].pQuads[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[2].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth); v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); if ( a2->uFlags & 4 ) v14 *= -1.0; - pBillboardRenderListD3D[v8].pQuards[3].diffuse = diffuse; - pBillboardRenderListD3D[v8].pQuards[3].specular = specular; - pBillboardRenderListD3D[v8].pQuards[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30; - pBillboardRenderListD3D[v8].pQuards[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuards[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - pBillboardRenderListD3D[v8].pQuards[3].rhw = 1.0 / a2->zbuffer_depth; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; - pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; + pBillboardRenderListD3D[v8].pQuads[3].diffuse = diffuse; + pBillboardRenderListD3D[v8].pQuads[3].specular = specular; + pBillboardRenderListD3D[v8].pQuads[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30; + pBillboardRenderListD3D[v8].pQuads[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29; + pBillboardRenderListD3D[v8].pQuads[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[3].rhw = 1.0 / a2->zbuffer_depth; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; + pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; pBillboardRenderListD3D[v8].uNumVertices = 4; pBillboardRenderListD3D[v8].pTexture = pSprite->pTexture; @@ -8509,79 +8933,54 @@ } //----- (004A4CC9) -------------------------------------------------------- -void Render::_4A4CC9(stru6_stru1_indoor_sw_billboard *a1, int a2) -{ - int v3; // eax@1 - int v4; // edx@3 +void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse) +{ unsigned int v5; // eax@7 - int v6; // edi@7 char *v7; // edx@8 - char *v8; // ecx@8 - char v9; // zf@9 double v10; // st6@9 double v11; // st6@10 int v12; // ebx@13 - int v13; // ecx@16 - unsigned int v14; // [sp+Ch] [bp-4h]@1 - - auto _this = this; - - *(float *)&v14 = 1000000.0; - v3 = a1->field_10; - if ( v3 >= 3 ) - { - if ( v3 > 0 ) - { - _this = (Render *)&a1->field_14[62]; - v4 = a1->field_10; - do - { - if ( *(float *)&this->bUserDirect3D < (double)*(float *)&v14 ) - v14 = this->bUserDirect3D; - _this = (Render *)((char *)_this + 16); - --v4; - } - while ( v4 ); - } - v5 = Billboard_ProbablyAddToListAndSortByZOrder(v14); - v6 = 0; - pBillboardRenderListD3D[v5].field_90 = 0; - pBillboardRenderListD3D[v5].uParentBillboardID = -1; - pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; - if ( a1->field_10 > 0 ) - { - v7 = (char *)&a1->field_14[62]; - v8 = (char *)&pBillboardRenderListD3D[v5].pQuards[0].pos.z; - do - { - v9 = uCurrentlyLoadedLevelType == LEVEL_Indoor; - *((int *)v8 - 2) = *((int *)v7 - 2); - *((int *)v8 - 1) = *((int *)v7 - 1); - v10 = *(float *)v7; - if ( v9 ) - v11 = v10 * 0.061758894; - else - v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; - *(float *)v8 = 1.0 - 1.0 / v11; - *((float *)v8 + 1) = 1.0 / *(float *)v7; - if ( a2 & 0xFF000000 ) - v12 = *((int *)v7 + 1); - else - v12 = a2; - *((int *)v8 + 3) = 0; - *((int *)v8 + 2) = v12; - ++v6; - v7 += 16; - *((float *)v8 + 4) = 0.0; - *((float *)v8 + 5) = 0.0; - v8 += 32; - } - while ( v6 < a1->field_10 ); - } - v13 = a1->field_10; - pBillboardRenderListD3D[v5].pTexture = 0; - pBillboardRenderListD3D[v5].uNumVertices = v13; - LODWORD(pBillboardRenderListD3D[v5].z_order) = v14; + + if (a1->uNumVertices < 3) + return; + + float depth = 1000000.0; + for (uint i = 0; i < a1->uNumVertices; ++i) + { + if (a1->field_104[i].z < depth) + depth = a1->field_104[i * 4].z; + } + + v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth); + pBillboardRenderListD3D[v5].field_90 = 0; + pBillboardRenderListD3D[v5].uParentBillboardID = -1; + pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; + pBillboardRenderListD3D[v5].pTexture = 0; + pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices; + pBillboardRenderListD3D[v5].z_order = depth; + + for (uint i = 0; i < a1->uNumVertices; ++i) + { + pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x; + pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y; + + v10 = a1->field_104[i].z; + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + v11 = v10 * 0.061758894; + else + v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; + pBillboardRenderListD3D[v5].pQuads[i].pos.z = 1.0 - 1.0 / v11; + pBillboardRenderListD3D[v5].pQuads[i].rhw = 1.0 / a1->field_104[i].z; + + if (diffuse & 0xFF000000) + v12 = a1->field_104[i].diffuse; + else + v12 = diffuse; + pBillboardRenderListD3D[v5].pQuads[i].diffuse = v12; + pBillboardRenderListD3D[v5].pQuads[i].specular = 0; + + pBillboardRenderListD3D[v5].pQuads[i].texcoord.x = 0.0; + pBillboardRenderListD3D[v5].pQuads[i].texcoord.y = 0.0; } } @@ -10649,12 +11048,6 @@ // 6BE364: using guessed type int dword_6BE364_game_settings_1; // A74C88: using guessed type int dword_A74C88; -//----- (0044EC20) -------------------------------------------------------- -bool RenderD3D::DoesRaiseExceptions() -{ - return true; -} - //----- (004524D8) -------------------------------------------------------- HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) @@ -10881,20 +11274,20 @@ auto p = &pRenderer->pBillboardRenderListD3D[0]; for (int i = 0; i < p->uNumVertices; ++i) { - p->pQuards[i].pos.z -= p->pQuards[i].pos.z * 0.6; - //p->pQuards[i].rhw = + 0.8 * (1.0f - p->pQuards[i].rhw); - } - p->pQuards[0].pos.x = 10; - p->pQuards[0].pos.y = 10; - - p->pQuards[1].pos.x = 10; - p->pQuards[1].pos.y = 200; - - p->pQuards[2].pos.x = 100; - p->pQuards[2].pos.y = 200; - - p->pQuards[3].pos.x = 100; - p->pQuards[3].pos.y = 10; + p->pQuads[i].pos.z -= p->pQuads[i].pos.z * 0.6; + //p->pQuads[i].rhw = + 0.8 * (1.0f - p->pQuads[i].rhw); + } + p->pQuads[0].pos.x = 10; + p->pQuads[0].pos.y = 10; + + p->pQuads[1].pos.x = 10; + p->pQuads[1].pos.y = 200; + + p->pQuads[2].pos.x = 100; + p->pQuads[2].pos.y = 200; + + p->pQuads[3].pos.x = 100; + p->pQuads[3].pos.y = 10; if (p->uOpacity != RenderBillboardD3D::NoBlend) SetBillboardBlendOptions(p->uOpacity); @@ -10902,7 +11295,7 @@ pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - p->pQuards, p->uNumVertices, + p->pQuads, p->uNumVertices, D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); }*/ @@ -10917,7 +11310,7 @@ pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - p->pQuards, p->uNumVertices, + p->pQuads, p->uNumVertices, D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); } @@ -10987,3 +11380,11 @@ { pRenderer->Present(); } + + + +//----- (0044EC20) -------------------------------------------------------- +/*bool RenderD3D::DoesRaiseExceptions() +{ + return true; +}*/ \ No newline at end of file
--- a/Render.h Wed Jul 17 00:40:15 2013 +0200 +++ b/Render.h Thu Jul 18 04:08:20 2013 +0200 @@ -196,7 +196,7 @@ IDirect3DTexture2 *pTexture; unsigned int uNumVertices; - RenderVertexD3D3 pQuards[4]; + RenderVertexD3D3 pQuads[4]; float z_order; OpacityType uOpacity; int field_90; @@ -223,8 +223,6 @@ struct RenderD3D { RenderD3D(); - - static bool DoesRaiseExceptions(); void GetAvailableDevices(RenderD3D__DevInfo **pOutDevices); void Release(); @@ -325,13 +323,14 @@ void DrawSkyPolygon(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture); void _4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex); void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8); + void DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID); void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard); void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level); int MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6); void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9); - void _4A4CC9(struct stru6_stru1_indoor_sw_billboard *a1, int a2); + void _4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse); bool LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture); bool MoveSpriteToDevice(Sprite *pSprite); void BeginScene();
--- a/SpriteObject.cpp Wed Jul 17 00:40:15 2013 +0200 +++ b/SpriteObject.cpp Thu Jul 18 04:08:20 2013 +0200 @@ -331,9 +331,9 @@ Dst.x = (double)v1->vPosition.x; Dst.y = (double)v1->vPosition.y; Dst.z = (double)v1->vPosition.z; - Dst.flt_10 = 0.0; - Dst.flt_14 = 0.0; - Dst.flt_18 = 0.0; + Dst.r = 0.0; + Dst.g = 0.0; + Dst.b = 0.0; if (v2->uFlags & OBJECT_DESC_TRIAL_FIRE ) { Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; @@ -455,9 +455,9 @@ Dst.x = (double)v1->vPosition.x; Dst.y = (double)v1->vPosition.y; Dst.z = (double)v1->vPosition.z; - Dst.flt_10 = 0.0; - Dst.flt_14 = 0.0; - Dst.flt_18 = 0.0; + Dst.r = 0.0; + Dst.g = 0.0; + Dst.b = 0.0; if ( v2->uFlags & OBJECT_DESC_TRIAL_FIRE ) { Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; @@ -738,9 +738,9 @@ Dst.x = (double)pSpriteObject->vPosition.x; Dst.y = (double)pSpriteObject->vPosition.y; Dst.z = (double)pSpriteObject->vPosition.z; - Dst.flt_10 = 0.0; - Dst.flt_14 = 0.0; - Dst.flt_18 = 0.0; + Dst.r = 0.0; + Dst.g = 0.0; + Dst.b = 0.0; if ( v29 & 0x200 ) { Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; @@ -928,9 +928,9 @@ Dst.x = (double)pSpriteObject->vPosition.x; Dst.y = (double)pSpriteObject->vPosition.y; Dst.z = (double)pSpriteObject->vPosition.z; - Dst.flt_10 = 0.0; - Dst.flt_14 = 0.0; - Dst.flt_18 = 0.0; + Dst.r = 0.0; + Dst.g = 0.0; + Dst.b = 0.0; if ( v10 & 0x200 ) { Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
--- a/Vis.cpp Wed Jul 17 00:40:15 2013 +0200 +++ b/Vis.cpp Thu Jul 18 04:08:20 2013 +0200 @@ -173,8 +173,8 @@ //while ( v8 ); } - if (min_x < pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.x || pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.y > min_y || - pRenderer->pBillboardRenderListD3D[v13].pQuards[3].pos.x < max_x || pRenderer->pBillboardRenderListD3D[v13].pQuards[1].pos.y < max_y) + if (min_x < pRenderer->pBillboardRenderListD3D[v13].pQuads[0].pos.x || pRenderer->pBillboardRenderListD3D[v13].pQuads[0].pos.y > min_y || + pRenderer->pBillboardRenderListD3D[v13].pQuads[3].pos.x < max_x || pRenderer->pBillboardRenderListD3D[v13].pQuads[1].pos.y < max_y) return false; return true; @@ -265,12 +265,12 @@ return false; //result = a1; - v5 = a1->pQuards[0].pos.x; - a1a = a1->pQuards[3].pos.x; - v6 = a1->pQuards[0].pos.y; - //result = (RenderBillboardD3D *)LODWORD(result->pQuards[1].pos.y); + v5 = a1->pQuads[0].pos.x; + a1a = a1->pQuads[3].pos.x; + v6 = a1->pQuads[0].pos.y; + //result = (RenderBillboardD3D *)LODWORD(result->pQuads[1].pos.y); v29 = v6; - v28 = a1->pQuards[1].pos.y; + v28 = a1->pQuads[1].pos.y; if ( v5 > a1a ) { v7 = v5; @@ -1548,7 +1548,7 @@ return false; - GetPolygonCenter(pRenderer->pBillboardRenderListD3D[v3].pQuards, 4, &test_x, &test_y); + GetPolygonCenter(pRenderer->pBillboardRenderListD3D[v3].pQuads, 4, &test_x, &test_y); CastPickRay(pPickingRay, test_x, test_y, fDepth); if (uCurrentlyLoadedLevelType == LEVEL_Indoor) PickIndoorFaces_Mouse(fDepth, pPickingRay, &Vis_static_stru_F91E10, &vis_face_filter); @@ -1569,8 +1569,8 @@ for (v40 = 0; v40 < 4; ++v40) { - test_x=pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[v40].pos.x; - test_y= pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[v40].pos.y; + test_x=pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[v40].pos.x; + test_y= pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[v40].pos.y; if ((double)(pViewport->uScreen_TL_X) <= test_x && (double)pViewport->uScreen_BR_X >= test_x && (double)pViewport->uScreen_TL_Y <= test_y && @@ -1595,11 +1595,11 @@ { if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) return false; - t1_x = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[0].pos.x; - t2_x = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[3].pos.x; + t1_x = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[0].pos.x; + t2_x = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[3].pos.x; - t1_y = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[0].pos.y; - t2_y = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[1].pos.y; + t1_y = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[0].pos.y; + t2_y = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[1].pos.y; if ( t1_x > t2_x ) { swap_temp = t1_x;
--- a/mm7_3.cpp Wed Jul 17 00:40:15 2013 +0200 +++ b/mm7_3.cpp Thu Jul 18 04:08:20 2013 +0200 @@ -3854,7 +3854,6 @@ return result; } -// 47730C: using guessed type int __stdcall const_1(int); //----- (004775ED) -------------------------------------------------------- int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) @@ -3899,20 +3898,20 @@ float v39; // [sp+D0h] [bp-8h]@6 int *v40; // [sp+D4h] [bp-4h]@2 - v2 = (char *)&this->field_14[4 * this->field_10 + 20]; + v2 = (char *)&this->field_64[4 * this->uNumVertices]; v38 = 0; - *(int *)v2 = this->field_14[20]; + *(int *)v2 = this->field_64[0]; v2 += 4; - *(int *)v2 = this->field_14[21]; + *(int *)v2 = this->field_64[1]; v2 += 4; - *(int *)v2 = this->field_14[22]; - *((int *)v2 + 1) = this->field_14[23]; - v3 = this->field_10; + *(int *)v2 = this->field_64[2]; + *((int *)v2 + 1) = this->field_64[3]; + v3 = this->uNumVertices; v35 = this; if ( v3 > 0 ) { - v40 = &this->field_14[40]; - v4 = (char *)&this->field_14[23] + 3; + v40 = &this->field_64[20]; + v4 = (char *)&this->field_64[3] + 3; v34 = v3; while ( 1 ) { @@ -3998,9 +3997,7 @@ goto LABEL_10; } LABEL_12: - result = v38; - this->field_10 = v38; - return result; + return this->uNumVertices = v38; } //----- (00477927) -------------------------------------------------------- @@ -4046,20 +4043,20 @@ float v39; // [sp+D0h] [bp-8h]@6 int *v40; // [sp+D4h] [bp-4h]@2 - v2 = (char *)&this->field_14[4 * this->field_10 + 20]; + v2 = (char *)&this->field_64[4 * this->uNumVertices]; v38 = 0; - *(int *)v2 = this->field_14[20]; + *(int *)v2 = this->field_64[0]; v2 += 4; - *(int *)v2 = this->field_14[21]; + *(int *)v2 = this->field_64[1]; v2 += 4; - *(int *)v2 = this->field_14[22]; - *((int *)v2 + 1) = this->field_14[23]; - v3 = this->field_10; + *(int *)v2 = this->field_64[2]; + *((int *)v2 + 1) = this->field_64[3]; + v3 = this->uNumVertices; v35 = this; if ( v3 > 0 ) { - v40 = &this->field_14[40]; - v4 = (char *)&this->field_14[23] + 3; + v40 = &this->field_64[20]; + v4 = (char *)&this->field_64[3] + 3; v34 = v3; while ( 1 ) { @@ -4145,9 +4142,7 @@ goto LABEL_10; } LABEL_12: - result = v38; - this->field_10 = v38; - return result; + return this->uNumVertices = v38; } //----- (00477C61) -------------------------------------------------------- @@ -4199,7 +4194,7 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { v2 = 0; - if ( this->field_10 > 0 ) + if ( this->uNumVertices > 0 ) { v3 = (int)&this->field_14[1]; do @@ -4252,7 +4247,7 @@ *(float *)(v3 + 80) = v11; v3 += 16; } - while ( v2 < this->field_10 ); + while ( v2 < this->uNumVertices ); } } else @@ -4298,7 +4293,7 @@ } while ( v31 ); } - this->field_10 = 3; + this->uNumVertices = 3; return 1; } @@ -4330,7 +4325,7 @@ v10 = (double)pOutdoorCamera->shading_dist_mist; v3 = 8.0; } - v4 = a1->field_10; + v4 = a1->uNumVertices; if ( v4 <= 0 ) goto LABEL_16; v5 = (char *)&a1->field_14[20]; @@ -4353,15 +4348,15 @@ if ( v9 ) { v2->_477927(v10); - return v2->field_10 != 0; + return v2->uNumVertices != 0; } LABEL_16: memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4); - return v2->field_10 != 0; + return v2->uNumVertices != 0; } v7 = v3; _4775ED(v7); - return v2->field_10 != 0; + return v2->uNumVertices != 0; } //----- (0047802A) -------------------------------------------------------- @@ -4378,7 +4373,7 @@ v16 = 0; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { - for(int i = 0; i < a1->field_10; i++) + for(int i = 0; i < a1->uNumVertices; i++) { v6 = (double)pBLVRenderParams->field_40 * 0.000015258789 / a1->field_B4[i*4]; if ( pRenderer->pRenderD3D ) @@ -4409,7 +4404,7 @@ } else { - for(int i = 0; i < a1->field_10; i++) + for(int i = 0; i < a1->uNumVertices; i++) { v12 = (double)pOutdoorCamera->int_fov_rad / a1->field_B4[i*4]; a1->field_B4[i*4+20] = (double)pViewport->uScreenCenterX - v12 * a1->field_B4[i*4+1]; @@ -6142,431 +6137,6 @@ //} } -//----- (00479A53) -------------------------------------------------------- -void __fastcall _479A53_draw_some_blv_poly(unsigned int uNumVertices, unsigned int uFaceID) -{ - BLVFace *pFace; // esi@1 - unsigned int v3; // edi@1 - PolygonType v4; // al@1 - double v5; // st7@3 - signed __int64 v6; // qax@3 - PolygonType v7; // cl@3 - int v8; // esi@7 - int v9; // eax@7 - unsigned int v10; // eax@7 - double v11; // st6@7 - int v12; // edx@7 - int v13; // eax@7 - char *v14; // esi@8 - void *v15; // ecx@9 - int v16; // eax@9 - int v17; // edi@9 - double v18; // st7@9 - signed int v19; // ebx@9 - void *v20; // ecx@9 - int v21; // ebx@11 - int v22; // eax@14 - signed __int64 v23; // qtt@16 - double v24; // st7@16 - unsigned __int8 v25; // sf@16 - unsigned __int8 v26; // of@16 - Render *v27; // ecx@17 - double v28; // st7@20 - char *v29; // ebx@20 - char *v30; // edx@20 - unsigned __int8 v31; // c0@21 - unsigned __int8 v32; // c3@21 - double v33; // st6@23 - char *v34; // esi@30 - const void *v35; // ecx@31 - int v36; // eax@31 - const void *v37; // edi@31 - signed __int64 v38; // qax@31 - int v39; // ecx@31 - int v40; // ebx@33 - int v41; // eax@36 - signed __int64 v42; // qtt@39 - int v43; // eax@39 - char v44; // zf@39 - double v45; // st7@39 - double v46; // st7@39 - unsigned int v47; // edx@40 - double v48; // st7@41 - RenderVertexSoft *v49; // ebx@41 - void *v50; // edi@43 - double v51; // st7@46 - RenderVertexSoft *v52; // edx@46 - void *v53; // edi@48 - char *v54; // ebx@52 - unsigned int v55; // eax@53 - unsigned int v56; // eax@55 - int v57; // ST10_4@55 - Texture *v58; // eax@55 - signed int v59; // [sp-4h] [bp-178h]@17 - stru148 *v60; // [sp+0h] [bp-174h]@17 - IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 - stru148 v62; // [sp+14h] [bp-160h]@6 - unsigned int v63; // [sp+120h] [bp-54h]@7 - double v64; // [sp+124h] [bp-50h]@7 - unsigned int v65; // [sp+128h] [bp-4Ch]@1 - unsigned int v66; // [sp+12Ch] [bp-48h]@7 - float v67; // [sp+130h] [bp-44h]@7 - __int64 v68; // [sp+134h] [bp-40h]@3 - __int64 v69; // [sp+13Ch] [bp-38h]@3 - int v70; // [sp+144h] [bp-30h]@3 - int X; // [sp+148h] [bp-2Ch]@9 - int v72; // [sp+14Ch] [bp-28h]@7 - float v73; // [sp+150h] [bp-24h]@16 - unsigned int v74; // [sp+154h] [bp-20h]@3 - RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3 - float v76; // [sp+15Ch] [bp-18h]@9 - int v77; // [sp+160h] [bp-14h]@9 - int v78; // [sp+164h] [bp-10h]@7 - void *v79; // [sp+168h] [bp-Ch]@9 - float v80; // [sp+16Ch] [bp-8h]@3 - const void *v81; // [sp+170h] [bp-4h]@7 - - __debugbreak(); - - pFace = &pIndoor->pFaces[uFaceID]; - v65 = uFaceID; - v3 = uNumVertices; - v4 = pFace->uPolygonType; - if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor ) - { - if ( (signed int)uNumVertices > 0 ) - { - v54 = (char *)&array_507D30[0].u; - LODWORD(v80) = uNumVertices; - do - { - v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x; - *(float *)v54 = (double)v69 + *(float *)v54; - *(float *)v54 = *(float *)v54 * 0.25; - v55 = GetTickCount(); - v54 += 48; - v44 = LODWORD(v80)-- == 1; - v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5); - *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; - } - while ( !v44 ); - uFaceID = v65; - } - v56 = 8 * uFaceID; - LOBYTE(v56) = PID(OBJECT_BModel,uFaceID); - v57 = v56; - v58 = pFace->GetTexture(); - pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); - return; - } - HIDWORD(v69) = pIndoorCamera->sRotationX; - HIDWORD(v68) = pIndoorCamera->pos.z; - *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; - v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z) - / (((double)pBLVRenderParams->field_40 + 16192.0) - * 65536.0) - + *(float *)&v74); - v5 = (double)pIndoorCamera->sRotationX * 0.0030664064; - *(float *)&v75 = v5; - v80 = cos(v5) * 16192.0; - v6 = (signed __int64)(*(float *)&v74 - - (double)pBLVRenderParams->field_40 - / ((v80 + 0.0000001) - * 65535.0) - * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68))); - v7 = pFace->uPolygonType; - if ( v7 == 4 || v7 == 3 ) - v70 = v6; - stru_8019C8._48653D(65536, 0, 0, 0, 65536, 0); - v62._48607B(&stru_8019C8); - v62.uTileBitmapID = pFace->uBitmapID; - v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); - if ( !v62.pTexture ) - return; - v8 = pBLVRenderParams->sPartyRotX; - v62.dimming_level = 0; - v62.uNumVertices = v3; - v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); - v62.v_18.y = 0; - v62.v_18.x = -v9; - v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); - v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; - memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); - LODWORD(v80) = v10; - v62.field_24 = 33554432; - v64 = (double)(signed int)v10 * 0.5; - v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); - LODWORD(v80) = v62.pTexture->uTextureWidth; - v11 = 1.0 / (double)SLODWORD(v80); - LODWORD(v80) = v62.pTexture->uTextureHeight; - v12 = v62.pTexture->uWidthMinus1; - v13 = v62.pTexture->uHeightMinus1; - v67 = v11; - v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; - v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; - v78 = 0; - v81 = 0; - *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80); - if ( (signed int)v62.uNumVertices <= 0 ) - { -LABEL_17: - v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; - v27 = pRenderer; - v60 = &v62; - v59 = v62.uNumVertices; - goto LABEL_18; - } - v14 = (char *)&array_507D30[0].vWorldViewProjY; - while ( 2 ) - { - v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14)); - LODWORD(v80) = v62.ptr_38->field_14; - v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; - v16 = v77 + v62.ptr_38->field_C; - v77 = (int)v15; - v74 = v16; - LODWORD(v80) = v62.ptr_38->field_20; - v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16; - v79 = v15; - v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18); - LODWORD(v80) = v62.v_18.z; - v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16); - v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1)); - v18 = *(float *)v14 - 1.0; - v19 = -v62.field_24; - v77 = -v62.field_24; - X = (int)((char *)v79 + v62.v_18.x); - LODWORD(v76) = (signed __int64)v18; - v20 = (void *)(v72 * (v70 - LODWORD(v76))); - while ( 1 ) - { - v79 = v20; - if ( !X ) - goto LABEL_14; - v21 = abs(v19 >> 14); - if ( v21 <= abs(X) ) - break; - if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) - break; - v19 = v77; - v20 = v79; -LABEL_14: - LODWORD(v80) = v62.v_18.z; - v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16); - v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16; - --LODWORD(v76); - v20 = (char *)v20 + v72; - X = v22 + v62.v_18.x; - v78 = 1; - } - if ( !v78 ) - { - LODWORD(v23) = v77 << 16; - HIDWORD(v23) = v77 >> 16; - v79 = (void *)(v23 / X); - v77 = v17; - LODWORD(v80) = v62.ptr_38->field_10; - v77 = v17; - LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16); - LODWORD(v80) = v62.ptr_38->field_1C; - v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16)); - v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; - LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; - v14 += 48; - LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); - v81 = (char *)v81 + 1; - v24 = (double)SLODWORD(v80) * 0.000015259022; - LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); - v26 = __OFSUB__((int)v81, v62.uNumVertices); - v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0; - *((float *)v14 - 10) = v24 * v67; - *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1); - *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79; - if ( !(v25 ^ v26) ) - goto LABEL_17; - continue; - } - break; - } - LODWORD(v73) = 0; - v80 = v76; - if ( (signed int)v62.uNumVertices > 0 ) - { - v28 = (double)SLODWORD(v76); - LODWORD(v76) = (int)(char *)array_50AC10 + 28; - v29 = (char *)&array_50AC10[0].vWorldViewProjX; - v30 = (char *)&array_507D30[1].vWorldViewProjY; - v79 = array_50AC10; - v81 = array_507D30; - v78 = v62.uNumVertices; - do - { - v31 = v28 < *((float *)v30 - 12); - v32 = v28 == *((float *)v30 - 12); - ++LODWORD(v73); - memcpy(v79, v81, 0x30u); - v79 = (char *)v79 + 48; - LODWORD(v76) += 48; - v29 += 48; - if ( v31 | v32 || v28 >= *(float *)v30 ) - { - if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 ) - goto LABEL_28; - v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12)) - + *((float *)v30 - 1); - } - else - { - v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30) - + *((float *)v30 - 13); - } - *(float *)v29 = v33; - v79 = (char *)v79 + 48; - v29 += 48; - ++LODWORD(v73); - *(unsigned int *)LODWORD(v76) = v28; - LODWORD(v76) += 48; -LABEL_28: - v81 = (char *)v81 + 48; - v30 += 48; - --v78; - } - while ( v78 ); - } - if ( SLODWORD(v73) <= 0 ) - goto LABEL_40; - v34 = (char *)&array_50AC10[0].vWorldViewProjY; - v65 = v77 >> 14; - HIDWORD(v69) = LODWORD(v73); - do - { - v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); - v78 = v62.ptr_38->field_14; - v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); - v36 = (int)((char *)v81 + v62.ptr_38->field_C); - v81 = v35; - v74 = v36; - v78 = v62.ptr_38->field_20; - v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); - v78 = (int)v35; - v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->field_18); - v81 = (const void *)v62.v_18.z; - v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16; - v37 = (const void *)(v72 - * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); - v38 = (signed __int64)(*(float *)v34 - 1.0); - v81 = 0; - LODWORD(v76) = v38; - v39 = v72 * (v70 - v38); - while ( 1 ) - { - v78 = v39; - if ( !X ) - goto LABEL_36; - v40 = abs(X); - if ( abs((signed __int64)v65) <= v40 ) - break; - if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) - break; - v39 = v78; -LABEL_36: - v78 = v62.v_18.z; - v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; - --LODWORD(v76); - v39 += v72; - X = v41 + v62.v_18.x; - v81 = (const void *)1; - } - if ( v81 ) - { - v79 = (void *)v62.v_18.z; - v78 = 2 * LODWORD(v76); - v81 = (const void *)((unsigned __int64)(v62.v_18.z - * (signed __int64)(signed int)(signed __int64)(((double)v70 - - ((double)(2 * LODWORD(v76)) - - *(float *)v34)) - * (double)v72)) >> 16); - X = (int)((char *)v81 + v62.v_18.x); - } - LODWORD(v42) = v77 << 16; - HIDWORD(v42) = v77 >> 16; - v79 = (void *)(v42 / X); - v81 = v37; - v78 = v62.ptr_38->field_10; - v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); - v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); - v74 = (unsigned int)v37; - LODWORD(v76) = v43; - v78 = v62.ptr_38->field_1C; - v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); - v74 = (unsigned __int64)(v43 * v42 / X) >> 16; - v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); - v34 += 48; - v78 = v66 + ((signed int)v74 >> 4); - v44 = HIDWORD(v69)-- == 1; - v45 = (double)v78 * 0.000015259022; - v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); - *((float *)v34 - 10) = v45 * v67; - *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1); - v46 = (double)(signed int)v79; - *((float *)v34 - 16) = 0.000015258789 * v46; - *((float *)v34 - 11) = 65536.0 / v46; - } - while ( !v44 ); -LABEL_40: - v47 = 0; - if ( SLODWORD(v73) > 0 ) - { - v48 = (double)SLODWORD(v80); - v75 = array_507D30; - v49 = array_50AC10; - HIDWORD(v69) = LODWORD(v73); - do - { - if ( v48 >= v49->vWorldViewProjY ) - { - v50 = v75; - ++v47; - ++v75; - memcpy(v50, v49, 0x30u); - } - ++v49; - --HIDWORD(v69); - } - while ( HIDWORD(v69) ); - } - v62.uNumVertices = v47; - pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]); - *(float *)&v74 = 0.0; - if ( SLODWORD(v73) > 0 ) - { - v51 = (double)SLODWORD(v80); - v75 = array_507D30; - v52 = array_50AC10; - v80 = v73; - do - { - if ( v51 <= v52->vWorldViewProjY ) - { - v53 = v75; - ++v74; - ++v75; - memcpy(v53, v52, 0x30u); - } - ++v52; - --LODWORD(v80); - } - while ( v80 != 0.0 ); - } - v62.uNumVertices = v74; - v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; - v60 = &v62; - v59 = v74; - v27 = pRenderer; -LABEL_18: - v27->_4A2ED5(v59, v60, v61); -} - //----- (0047A384) -------------------------------------------------------- void ODM_LoadAndInitialize(const char *pLevelFilename, OutdoorCamera *thisa) {
--- a/mm7_4.cpp Wed Jul 17 00:40:15 2013 +0200 +++ b/mm7_4.cpp Thu Jul 18 04:08:20 2013 +0200 @@ -3310,50 +3310,25 @@ } //----- (004A7063) -------------------------------------------------------- -int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) +unsigned int ModulateColor(unsigned int diffuse, float multiplier) { - float v2; // ST1C_4@1 - double v3; // ST14_8@1 - signed int v4; // ebx@1 - float v5; // ST1C_4@1 - double v6; // ST14_8@1 - signed int v7; // edi@1 - double v8; // ST0C_8@1 - signed int v9; // esi@1 - signed int v10; // ecx@1 - double v12; // [sp+8h] [bp-18h]@1 - unsigned __int64 v13; // [sp+18h] [bp-8h]@1 - - v2 = (double)(uDiffuse >> 24) * a2; - v3 = v2 + 6.7553994e15; - v4 = LODWORD(v3); - v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; - v6 = v5 + 6.7553994e15; - v7 = LODWORD(v6); - *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; - v8 = *((float *)&v6 + 1) + 6.7553994e15; - v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); - v9 = LODWORD(v8); - *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; - v12 = *((float *)&v6 + 1) + 6.7553994e15; - v10 = LODWORD(v12); - if ( v4 > 255 ) - v4 = 255; - if ( v4 < 0 ) - v4 = 0; - if ( SHIDWORD(v13) > 255 ) - v7 = 255; - if ( v7 < 0 ) - v7 = 0; - if ( (signed int)v13 > 255 ) - v9 = 255; - if ( v9 < 0 ) - v9 = 0; - if ( SLODWORD(v12) > 255 ) - v10 = 255; - if ( v10 < 0 ) - v10 = 0; - return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); + float alpha = multiplier * ((diffuse >> 24) & 0xFF); + int a = (int)floorf(alpha + 0.5f); + a = max(0, min(255, a)); + + float red = multiplier * ((diffuse >> 16) & 0xFF); + int r = (int)floorf(red + 0.5f); + r = max(0, min(255, r)); + + float green = multiplier * ((diffuse >> 8) & 0xFF); + int g = (int)floorf(green + 0.5f); + g = max(0, min(255, g)); + + float blue = multiplier * ((diffuse >> 0) & 0xFF); + int b = (int)floorf(blue + 0.5f); + b = max(0, min(255, b)); + + return (a << 24) | (r << 16) | (g << 8) | b; } //----- (004AD504) --------------------------------------------------------
--- a/mm7_data.h Wed Jul 17 00:40:15 2013 +0200 +++ b/mm7_data.h Thu Jul 18 04:08:20 2013 +0200 @@ -1385,7 +1385,6 @@ void __cdecl loc_4789D4(); // idb void __cdecl loc_47907F(); // idb bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused); -void __fastcall _479A53_draw_some_blv_poly(unsigned int uNumVertices, unsigned int uFaceID); // idb void __thiscall ODM_LoadAndInitialize(const char *pLevelFilename, struct OutdoorCamera *thisa); unsigned __int16 *__fastcall GetBillboardPalette(struct RenderBillboard *a1, int a2, signed int a3, int a4); int __fastcall sr_sub_47BEB1(signed int a1, stru148 *a2, int terrain_gamma, int a4, int *a5, int *a6, int a7, int a8); @@ -1464,7 +1463,7 @@ int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int z, int a4, unsigned int lightColor); void Present_ColorKey(); void Present_NoColorKey(); -int __thiscall sub_4A7063(unsigned int uDiffuse, float a2); // idb +unsigned int ModulateColor(unsigned int diffuse, float multiplier); // idb struct SoundHeader *__fastcall FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName); struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID); int __fastcall sub_4AAEA6_transform(RenderVertexSoft *a1);
--- a/stru6.cpp Wed Jul 17 00:40:15 2013 +0200 +++ b/stru6.cpp Thu Jul 18 04:08:20 2013 +0200 @@ -61,40 +61,28 @@ } //----- (0047829F) -------------------------------------------------------- -void stru6_stru1_indoor_sw_billboard::_47829F_fireball_collision(float arg0, float a3, float a4, float a5, int a2) +void stru6_stru1_indoor_sw_billboard::_47829F_sphere_particle(float x_offset, float y_offset, float z_offset, float scale, int diffuse) { - stru6_stru1_indoor_sw_billboard *v6; // esi@1 - int v7; // edi@1 - char *v8; // eax@2 - signed int v9; // ecx@2 - int v10; // edx@3 - signed int i; // [sp+8h] [bp-4h]@1 + int v7 = 0; - auto a1 = this; - - v6 = a1; - v7 = 0; - for ( i = 0; i < (signed int)v6->uNumVec3sInArray2; ++i ) + for (unsigned int i = 0; i < uNumVec3sInArray2; ++i) { - v8 = (char *)&v6->field_14[1]; - v9 = 3; - do + for (unsigned int j = 0; j < 3; ++j) { - *((float *)v8 - 1) = a5 * *(&v6->pArray1->field_0 + 4 * *(int *)((char *)&v6->pArray2->field_0 + v7)) + arg0; - *(float *)v8 = a5 * *(&v6->pArray1->field_4 + 4 * *(int *)((char *)&v6->pArray2->field_0 + v7)) + a3; - v8 += 16; - *((float *)v8 - 3) = a5 * *(&v6->pArray1->field_8 + 4 * *(int *)((char *)&v6->pArray2->field_0 + v7)) + a4; - v10 = *(int *)((char *)&v6->pArray2->field_0 + v7); + field_14[j].x = x_offset + scale * *(&pArray1->field_0 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); + field_14[j].y = y_offset + scale * *(&pArray1->field_4 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); + field_14[j].z = z_offset + scale * *(&pArray1->field_8 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); + int v10 = *(int *)((char *)&pArray2->field_0 + v7); + + field_14[j].diffuse = *((int *)&pArray1[1].field_0 + 4 * v10); v7 += 4; - --v9; - *((int *)v8 - 2) = *((int *)&v6->pArray1[1].field_0 + 4 * v10); } - while ( v9 ); - v6->field_10 = 3; - if ( v6->sub_477C61() && v6->sub_477F63() ) + + uNumVertices = 3; + if ( sub_477C61() && sub_477F63() ) { - if ( v6->sub_47802A() ) - pRenderer->_4A4CC9(v6, a2); + if ( sub_47802A() ) + pRenderer->_4A4CC9_AddSomeBillboard(this, diffuse); } } } @@ -192,9 +180,9 @@ local_0.x = x + 4.0; local_0.y = v8; local_0.z = v9; - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 0.0; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.timeToLive = (rand() & 0x40) + 96; local_0.uTextureID = uTextureID; local_0.flt_28 = 1.0; @@ -223,9 +211,9 @@ local_0.x = v10 + 4.0; local_0.y = (double)a2->vPosition.y; local_0.z = (double)a2->vPosition.z; - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 0.0; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.flt_28 = 1.0; local_0.timeToLive = (rand() & 0x7F) + 128; local_0.uTextureID = uTextureID; @@ -255,9 +243,9 @@ local_0.flt_28 = 1.0; do { - local_0.flt_10 = (double)(rand() & 0x1FF) - 255.0; - local_0.flt_14 = (double)(rand() & 0x1FF) - 255.0; - local_0.flt_18 = (double)(rand() & 0x1FF) - 255.0; + local_0.r = (double)(rand() & 0x1FF) - 255.0; + local_0.g = (double)(rand() & 0x1FF) - 255.0; + local_0.b = (double)(rand() & 0x1FF) - 255.0; pGame->pParticleEngine->AddParticle(&local_0); --v5; } @@ -267,98 +255,76 @@ //----- (004A7688) -------------------------------------------------------- void stru6::_4A7688_fireball_collision_particle(SpriteObject *a2) { - SpriteObject *v2; // esi@1 double v3; // st7@1 double v4; // st7@2 - double v5; // st7@4 int v6; // eax@6 float v7; // ST0C_4@6 float v8; // ST08_4@6 float v9; // ST04_4@6 float v10; // ST00_4@6 Particle_sw local_0; // [sp+1Ch] [bp-7Ch]@1 - stru6 *v12; // [sp+84h] [bp-14h]@1 float v13; // [sp+88h] [bp-10h]@1 - double v14; // [sp+8Ch] [bp-Ch]@5 - float v15; // [sp+94h] [bp-4h]@4 - signed int i; // [sp+A0h] [bp+8h]@4 - signed int a2b; // [sp+A0h] [bp+8h]@6 - v12 = this; memset(&local_0, 0, 0x68u); - v2 = a2; + v3 = (double)a2->uSpriteFrameID / (double)pObjectList->pObjects[a2->uObjectDescID].uLifetime; v13 = 512.0 * v3; if ( v3 >= 0.75 ) v4 = (1.0 - v3) * 4.0; else v4 = v3 * 1.333333333333333; - v15 = v4; - v5 = (double)a2->vPosition.x; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; local_0.uDiffuse = 0xFF3C1E; - local_0.x = v5; + local_0.x = (double)a2->vPosition.x; local_0.y = (double)a2->vPosition.y; local_0.z = (double)a2->vPosition.z; local_0.timeToLive = (rand() & 0x7F) + 128; local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); - i = 10; local_0.flt_28 = 1.0; - do + + // 10 fireball sparks + for (unsigned int i = 0; i < 10; ++i) { - HIDWORD(v14) = rand() & 0x1FF; - local_0.flt_10 = (double)SHIDWORD(v14) - 255.0; - HIDWORD(v14) = rand() & 0x1FF; - local_0.flt_14 = (double)SHIDWORD(v14) - 255.0; - WORD2(v14) = rand() & 0x1FF; - HIDWORD(v14) = WORD2(v14); - local_0.flt_18 = (double)WORD2(v14) - 255.0; + local_0.r = (rand() & 0x1FF) - 255; + local_0.g = (rand() & 0x1FF) - 255; + local_0.b = (rand() & 0x1FF) - 255; pGame->pParticleEngine->AddParticle(&local_0); - --i; } - while ( i ); - v14 = v13 + 6.7553994e15; - a2b = LODWORD(v14); - v6 = sub_4A7063(0xFF3C1Eu, v15); - v7 = (double)a2b; - v8 = (double)v2->vPosition.z; - v9 = (double)v2->vPosition.y; - v10 = (double)v2->vPosition.x; - v12->pStru1->_47829F_fireball_collision(v10, v9, v8, v7, v6); + + v6 = ModulateColor(0xFF3C1E, v4); + v7 = (double)floorf(0.5f + v13); + v8 = (double)a2->vPosition.z; + v9 = (double)a2->vPosition.y; + v10 = (double)a2->vPosition.x; + pStru1->_47829F_sphere_particle(v10, v9, v8, v7, v6); } //----- (004A77FD) -------------------------------------------------------- -void stru6::_4A77FD_some_stuff_d3d(SpriteObject *a1) +void stru6::_4A77FD_implosion_particle(SpriteObject *a1) { - SpriteObject *v2; // esi@1 - stru6 *v3; // edi@1 double v4; // st7@1 double v5; // st7@2 - double v6; // ST1C_8@4 int v7; // eax@4 float v8; // ST0C_4@4 float v9; // ST08_4@4 float v10; // ST04_4@4 float v11; // ST00_4@4 float v12; // [sp+28h] [bp-4h]@1 - float a1a; // [sp+34h] [bp+8h]@4 - v2 = a1; - v3 = this; v4 = (double)a1->uSpriteFrameID / (double)pObjectList->pObjects[a1->uObjectDescID].uLifetime; v12 = 512.0 - v4 * 512.0; if ( v4 >= 0.75 ) v5 = v4 * 4.0; else v5 = v4 * 1.333333333333333; - a1a = v5; - v6 = v12 + 6.7553994e15; - v7 = sub_4A7063(0x7E7E7Eu, a1a); - v8 = (double)SLODWORD(v6); - v9 = (double)v2->vPosition.z; - v10 = (double)v2->vPosition.y; - v11 = (double)v2->vPosition.x; - v3->pStru1->_47829F_fireball_collision(v11, v10, v9, v8, v7); + + v7 = ModulateColor(0x7E7E7E, v5); + v8 = (double)floorf(0.5f + v12); + v9 = (double)a1->vPosition.z; + v10 = (double)a1->vPosition.y; + v11 = (double)a1->vPosition.x; + pStru1->_47829F_sphere_particle(v11, v10, v9, v8, v7); } //----- (004A78AE) -------------------------------------------------------- @@ -379,9 +345,9 @@ local_0.timeToLive = 1; local_0.y = v4; local_0.z = (double)a1->vPosition.z; - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 0.0; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.uTextureID = pSpriteFrameTable->GetFrame(v2->uSpriteID, v3)->pHwSpriteIDs[0]; LODWORD(local_0.flt_28) = 0x40000000u; pGame->pParticleEngine->AddParticle(&local_0); @@ -413,9 +379,9 @@ Dst.timeToLive = (v5 & 0x7F) + 128; do { - Dst.flt_10 = (double)(rand() & 0x1FF) - 255.0; - Dst.flt_14 = (double)(rand() & 0x1FF) - 255.0; - Dst.flt_18 = (double)(rand() & 0x1FF) - 255.0; + Dst.r = (double)(rand() & 0x1FF) - 255.0; + Dst.g = (double)(rand() & 0x1FF) - 255.0; + Dst.b = (double)(rand() & 0x1FF) - 255.0; pGame->pParticleEngine->AddParticle(&Dst); --v6; } @@ -466,43 +432,43 @@ local_0.timeToLive = (v6 & 0x7F) + 128; local_0.uTextureID = uTextureID; a1a = v7; - local_0.flt_10 = v7; - local_0.flt_14 = a4; - local_0.flt_18 = a4; + local_0.r = v7; + local_0.g = a4; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); v8 = 0.70710677 * a4; uDiffusea = v8; - local_0.flt_10 = v8; - local_0.flt_14 = v8; - local_0.flt_18 = a4; + local_0.r = v8; + local_0.g = v8; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_14 = a1a; - local_0.flt_10 = a4; - local_0.flt_18 = a4; + local_0.g = a1a; + local_0.r = a4; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_10 = uDiffusea; - local_0.flt_18 = a4; + local_0.r = uDiffusea; + local_0.b = a4; v9 = -uDiffusea; uTextureIDa = v9; - local_0.flt_14 = v9; + local_0.g = v9; pGame->pParticleEngine->AddParticle(&local_0); v10 = -1.0 * a4; - local_0.flt_10 = a1a; + local_0.r = a1a; v12 = v10; - local_0.flt_14 = v10; - local_0.flt_18 = a4; + local_0.g = v10; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_18 = a4; - local_0.flt_10 = uTextureIDa; - local_0.flt_14 = uTextureIDa; + local_0.b = a4; + local_0.r = uTextureIDa; + local_0.g = uTextureIDa; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_10 = v12; - local_0.flt_14 = a1a; - local_0.flt_18 = a4; + local_0.r = v12; + local_0.g = a1a; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); - local_0.flt_10 = uTextureIDa; - local_0.flt_14 = uDiffusea; - local_0.flt_18 = a4; + local_0.r = uTextureIDa; + local_0.g = uDiffusea; + local_0.b = a4; pGame->pParticleEngine->AddParticle(&local_0); } @@ -540,9 +506,9 @@ local_0.x = v7; local_0.z = a2a; local_0.y = v8; - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 0.0; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; v10 = rand(); LODWORD(local_0.flt_28) = 0x40400000u; local_0.timeToLive = (v10 & 0x3F) + 64; @@ -572,9 +538,9 @@ local_0.x = v12; local_0.y = (double)a2->vPosition.y; local_0.z = (double)a2->vPosition.z; - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 0.0; + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; local_0.timeToLive = (rand() & 0x3F) + 64; local_0.uTextureID = pSpriteFrameTable->GetFrame(v5->uSpriteID, a2->uSpriteFrameID)->pHwSpriteIDs[0]; pGame->pParticleEngine->AddParticle(&local_0); @@ -584,32 +550,22 @@ //----- (004A7E05) -------------------------------------------------------- void stru6::AddProjectile(SpriteObject *a2, int a3, unsigned int uTextureID) { - int v4; // edx@1 - float v5; // ST14_4@2 - float v6; // ST10_4@2 - float v7; // ST0C_4@2 - - v4 = a2->field_54; - if ( v4 ) + if (a2->field_54) { - v5 = (double)a2->vPosition.z; - v6 = (double)a2->vPosition.y; - v7 = (double)a2->vPosition.x; - DoAddProjectile( - this->array_4[v4 & 0x1F].flt_0_x, - this->array_4[v4 & 0x1F].flt_4_y, - this->array_4[v4 & 0x1F].flt_8_z, - v7, - v6, - v5, - uTextureID); + DoAddProjectile(array_4[a2->field_54 & 0x1F].flt_0_x, + array_4[a2->field_54 & 0x1F].flt_4_y, + array_4[a2->field_54 & 0x1F].flt_8_z, + a2->vPosition.x, + a2->vPosition.y, + a2->vPosition.z, + uTextureID); } else { - a2->field_54 = this->field_0++; - this->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x; - this->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y; - this->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z; + a2->field_54 = field_0++; + array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x; + array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y; + array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z; } } @@ -687,9 +643,9 @@ z1 = (double)z; local_0.z = z1; local_0.y = v9 * 40.0 - 20.0 + v11; - local_0.flt_10 = pRnd->GetRandom() * 400.0 - 200.0; - local_0.flt_14 = pRnd->GetRandom() * 400.0 - 200.0; - local_0.flt_18 = pRnd->GetRandom() * 150.0 + 50.0; + local_0.r = pRnd->GetRandom() * 400.0 - 200.0; + local_0.g = pRnd->GetRandom() * 400.0 - 200.0; + local_0.b = pRnd->GetRandom() * 150.0 + 50.0; pGame->pParticleEngine->AddParticle(&local_0); --v6; } @@ -731,16 +687,14 @@ //----- (004A80DC) -------------------------------------------------------- void stru6::_4A80DC_some_stuff_sw(SpriteObject *a2) { - stru6 *v2; // esi@1 signed int v3; // ebx@1 Particle_sw local_0; // [sp+Ch] [bp-68h]@1 - v2 = this; memset(&local_0, 0, 0x68u); local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; local_0.uDiffuse = 0x7E7E7E; local_0.timeToLive = (rand() & 0x7F) + 128; - local_0.uTextureID = v2->uTextureID_effpar1; + local_0.uTextureID = uTextureID_effpar1; v3 = 8; local_0.flt_28 = 1.0; do @@ -748,9 +702,9 @@ local_0.x = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.x - 20.0; local_0.y = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.y - 20.0; local_0.z = (double)a2->vPosition.z; - local_0.flt_10 = pRnd->GetRandom() * 800.0 - 400.0; - local_0.flt_14 = pRnd->GetRandom() * 800.0 - 400.0; - local_0.flt_18 = pRnd->GetRandom() * 350.0 + 50.0; + local_0.r = pRnd->GetRandom() * 800.0 - 400.0; + local_0.g = pRnd->GetRandom() * 800.0 - 400.0; + local_0.b = pRnd->GetRandom() * 350.0 + 50.0; pGame->pParticleEngine->AddParticle(&local_0); --v3; } @@ -1048,7 +1002,7 @@ if ( result <= 2081 ) { if ( pRenderer->pRenderD3D ) - _4A77FD_some_stuff_d3d(a2); + _4A77FD_implosion_particle(a2); else _4A80DC_some_stuff_sw(a2); return false; @@ -1399,14 +1353,8 @@ //----- (004A8BFC) -------------------------------------------------------- int stru6::_4A8BFC() { - stru6 *v1; // esi@1 - int result; // eax@1 - - v1 = this; - result = 8 - * pSpriteFrameTable->pSpriteSFrames[pSpriteFrameTable->FastFindSprite("spell84")].uAnimLength; - v1->uAnimLength = result; - return result; + uAnimLength = 8 * pSpriteFrameTable->pSpriteSFrames[pSpriteFrameTable->FastFindSprite("spell84")].uAnimLength; + return uAnimLength; } //----- (004A8C27) -------------------------------------------------------- @@ -1580,162 +1528,60 @@ //----- (004A90A0) -------------------------------------------------------- void stru6::LoadAnimations() { - stru6 *v1; // esi@1 - unsigned int v2; // eax@1 - unsigned int v3; // eax@1 - unsigned int v4; // eax@1 - unsigned int v5; // eax@1 - unsigned int v6; // eax@1 - unsigned int v7; // eax@1 - unsigned int v8; // eax@1 - unsigned int v9; // eax@1 - unsigned int v10; // eax@1 - unsigned int v11; // eax@1 - unsigned int v12; // eax@1 - unsigned int v13; // eax@1 - unsigned int v14; // eax@1 - unsigned int v15; // eax@1 - unsigned int v16; // eax@1 - unsigned int v17; // eax@1 - unsigned int v18; // eax@1 - unsigned int v19; // eax@1 - unsigned int v20; // eax@1 - unsigned int v21; // eax@1 - unsigned int v22; // eax@1 - unsigned int v23; // eax@1 - unsigned int v24; // eax@1 - unsigned int v25; // eax@1 - unsigned int v26; // eax@1 - unsigned int v27; // eax@1 - unsigned int v28; // eax@1 - unsigned int v29; // eax@1 - unsigned int v30; // eax@1 - unsigned int v31; // eax@1 - unsigned int v32; // eax@1 - unsigned int v33; // eax@1 - unsigned int v34; // eax@1 - unsigned int v35; // eax@1 - unsigned int v36; // eax@1 - unsigned int v37; // eax@1 - unsigned int v38; // eax@1 - unsigned int v39; // eax@1 - unsigned int v40; // eax@1 - unsigned int v41; // eax@1 - unsigned int v42; // eax@1 - unsigned int v43; // eax@1 - unsigned int v44; // eax@1 - unsigned int v45; // eax@1 - unsigned int v46; // eax@1 - unsigned int v47; // eax@1 - unsigned int v48; // eax@1 - unsigned int v49; // eax@1 - unsigned int v50; // eax@1 - unsigned int v51; // eax@1 - - v1 = this; uTextureID_effpar1 = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); uTextureID_effpar2 = pBitmaps_LOD->LoadTexture("effpar02", TEXTURE_DEFAULT); uTextureID_effpar3 = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT); uSpriteID_sp57c = pSprites_LOD->LoadSprite("sp57c", 6); - v2 = pIconsFrameTable->FindIcon("zapp"); - pIconsFrameTable->InitializeAnimation(v2); - v3 = pIconsFrameTable->FindIcon("spheal1"); - pIconsFrameTable->InitializeAnimation(v3); - v4 = pIconsFrameTable->FindIcon("spheal2"); - pIconsFrameTable->InitializeAnimation(v4); - v5 = pIconsFrameTable->FindIcon("spheal3"); - pIconsFrameTable->InitializeAnimation(v5); - v6 = pIconsFrameTable->FindIcon("spboost1"); - pIconsFrameTable->InitializeAnimation(v6); - v7 = pIconsFrameTable->FindIcon("spboost2"); - pIconsFrameTable->InitializeAnimation(v7); - v8 = pIconsFrameTable->FindIcon("spboost3"); - pIconsFrameTable->InitializeAnimation(v8); - v9 = pIconsFrameTable->FindIcon("spell03"); - pIconsFrameTable->InitializeAnimation(v9); - v10 = pIconsFrameTable->FindIcon("spell05"); - pIconsFrameTable->InitializeAnimation(v10); - v11 = pIconsFrameTable->FindIcon("spell14"); - pIconsFrameTable->InitializeAnimation(v11); - v12 = pIconsFrameTable->FindIcon("spell17"); - pIconsFrameTable->InitializeAnimation(v12); - v13 = pIconsFrameTable->FindIcon("spell21"); - pIconsFrameTable->InitializeAnimation(v13); - v14 = pIconsFrameTable->FindIcon("spell25"); - pIconsFrameTable->InitializeAnimation(v14); - v15 = pIconsFrameTable->FindIcon("spell27"); - pIconsFrameTable->InitializeAnimation(v15); - v16 = pIconsFrameTable->FindIcon("spell36"); - pIconsFrameTable->InitializeAnimation(v16); - v17 = pIconsFrameTable->FindIcon("spell38"); - pIconsFrameTable->InitializeAnimation(v17); - v18 = pIconsFrameTable->FindIcon("spell46"); - pIconsFrameTable->InitializeAnimation(v18); - v19 = pIconsFrameTable->FindIcon("spell51"); - pIconsFrameTable->InitializeAnimation(v19); - v20 = pIconsFrameTable->FindIcon("spell55"); - pIconsFrameTable->InitializeAnimation(v20); - v21 = pIconsFrameTable->FindIcon("spell58"); - pIconsFrameTable->InitializeAnimation(v21); - v22 = pIconsFrameTable->FindIcon("spell69"); - pIconsFrameTable->InitializeAnimation(v22); - v23 = pIconsFrameTable->FindIcon("spell71"); - pIconsFrameTable->InitializeAnimation(v23); - v24 = pIconsFrameTable->FindIcon("spell73"); - pIconsFrameTable->InitializeAnimation(v24); - v25 = pIconsFrameTable->FindIcon("spell75"); - pIconsFrameTable->InitializeAnimation(v25); - v26 = pIconsFrameTable->FindIcon("spell96"); - pIconsFrameTable->InitializeAnimation(v26); + + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("zapp")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spheal1")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spheal2")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spheal3")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spboost1")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spboost2")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spboost3")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell03")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell05")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell14")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell17")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell21")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell25")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell27")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell36")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell38")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell46")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell51")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell55")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell58")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell69")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell71")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell73")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell75")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell96")); - v27 = pSpriteFrameTable->FastFindSprite("spell01"); - pSpriteFrameTable->InitializeSprite(v27); - v28 = pSpriteFrameTable->FastFindSprite("spell02"); - pSpriteFrameTable->InitializeSprite(v28); - v29 = pSpriteFrameTable->FastFindSprite("spell03"); - pSpriteFrameTable->InitializeSprite(v29); - v30 = pSpriteFrameTable->FastFindSprite("spell09"); - pSpriteFrameTable->InitializeSprite(v30); - v31 = pSpriteFrameTable->FastFindSprite("spell11"); - pSpriteFrameTable->InitializeSprite(v31); - v32 = pSpriteFrameTable->FastFindSprite("spell18"); - pSpriteFrameTable->InitializeSprite(v32); - v33 = pSpriteFrameTable->FastFindSprite("spell22"); - pSpriteFrameTable->InitializeSprite(v33); - v34 = pSpriteFrameTable->FastFindSprite("spell26"); - pSpriteFrameTable->InitializeSprite(v34); - v35 = pSpriteFrameTable->FastFindSprite("spell29"); - pSpriteFrameTable->InitializeSprite(v35); - v36 = pSpriteFrameTable->FastFindSprite("spell39"); - pSpriteFrameTable->InitializeSprite(v36); - v37 = pSpriteFrameTable->FastFindSprite("spell39c"); - pSpriteFrameTable->InitializeSprite(v37); - v38 = pSpriteFrameTable->FastFindSprite("spell41"); - pSpriteFrameTable->InitializeSprite(v38); - v39 = pSpriteFrameTable->FastFindSprite("spell57c"); - pSpriteFrameTable->InitializeSprite(v39); - v40 = pSpriteFrameTable->FastFindSprite("spell62"); - pSpriteFrameTable->InitializeSprite(v40); - v41 = pSpriteFrameTable->FastFindSprite("spell65"); - pSpriteFrameTable->InitializeSprite(v41); - v42 = pSpriteFrameTable->FastFindSprite("spell66"); - pSpriteFrameTable->InitializeSprite(v42); - v43 = pSpriteFrameTable->FastFindSprite("spell70"); - pSpriteFrameTable->InitializeSprite(v43); - v44 = pSpriteFrameTable->FastFindSprite("spell76"); - pSpriteFrameTable->InitializeSprite(v44); - v45 = pSpriteFrameTable->FastFindSprite("spell84"); - pSpriteFrameTable->InitializeSprite(v45); - v46 = pSpriteFrameTable->FastFindSprite("spell90"); - pSpriteFrameTable->InitializeSprite(v46); - v47 = pSpriteFrameTable->FastFindSprite("spell92"); - pSpriteFrameTable->InitializeSprite(v47); - v48 = pSpriteFrameTable->FastFindSprite("spell93"); - pSpriteFrameTable->InitializeSprite(v48); - v49 = pSpriteFrameTable->FastFindSprite("spell97"); - pSpriteFrameTable->InitializeSprite(v49); - v50 = pSpriteFrameTable->FastFindSprite("spell97c"); - pSpriteFrameTable->InitializeSprite(v50); - v51 = pSpriteFrameTable->FastFindSprite("spell97c"); - pSpriteFrameTable->InitializeSprite(v51); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell01")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell02")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell03")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell09")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell11")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell18")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell22")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell26")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell29")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell39")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell39c")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell41")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell57c")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell62")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell65")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell66")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell70")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell76")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell84")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell90")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell92")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell93")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell97")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell97c")); + pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell97c")); }
--- a/stru6.h Wed Jul 17 00:40:15 2013 +0200 +++ b/stru6.h Thu Jul 18 04:08:20 2013 +0200 @@ -8,7 +8,7 @@ //----- (004775B1) -------------------------------------------------------- inline stru6_stru1_indoor_sw_billboard() { - field_10 = 0; + uNumVertices = 0; uNumVec4sInArray1 = 0; uNumVec3sInArray2 = 0; pArray1 = nullptr; @@ -24,16 +24,26 @@ bool sub_477F63(); int sub_47802A(); void Initialize(int a2); - void _47829F_fireball_collision(float arg0, float a3, float a4, float a5, int a2); + void _47829F_sphere_particle(float x_offset, float y_offset, float z_offset, float scale, int diffuse); + + struct local_01 + { + float x; + float y; + float z; + int diffuse; + }; unsigned int uNumVec4sInArray1; struct stru16x *pArray1; unsigned int uNumVec3sInArray2; struct stru160 *pArray2; - int field_10; - int field_14[40]; - float field_B4[40]; + int uNumVertices; + local_01 field_14[5]; + int field_64[20]; + float field_B4[20]; + local_01 field_104[5]; }; #pragma pack(pop) @@ -112,7 +122,7 @@ void _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(struct SpriteObject *a2, unsigned int uDiffuse, unsigned int uTextureID); void _4A75CC_single_spell_collision_particle(struct SpriteObject *a1, unsigned int uDiffuse, unsigned int uTextureID); void _4A7688_fireball_collision_particle(struct SpriteObject *a2); - void _4A77FD_some_stuff_d3d(struct SpriteObject *a1); + void _4A77FD_implosion_particle(struct SpriteObject *a1); void _4A78AE_sparks_spell(struct SpriteObject *a1); void _4A7948_mind_blast_after_effect(struct SpriteObject *a1); bool AddMobileLight(struct SpriteObject *a1, unsigned int uDiffuse, int uRadius);