Mercurial > mm7
diff DecalBuilder.cpp @ 2314:8e9be4fa33a8
for Bloodsplat
author | Ritor1 |
---|---|
date | Tue, 18 Mar 2014 23:50:35 +0600 |
parents | 47b87aea14ba |
children | 846e28e41fb4 |
line wrap: on
line diff
--- a/DecalBuilder.cpp Tue Mar 18 17:34:33 2014 +0600 +++ b/DecalBuilder.cpp Tue Mar 18 23:50:35 2014 +0600 @@ -37,24 +37,18 @@ } //----- (0043B6EF) -------------------------------------------------------- -void BloodsplatContainer::AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b) +void BloodsplatContainer::AddBloodsplat(float x, float y, float z, float radius, unsigned char r, unsigned char g, unsigned char b) { - int v8; // esi@1 - int v9; // eax@3 - Bloodsplat *v10; // eax@3 - - v8 = this->uNumBloodsplats; + int i = this->uNumBloodsplats; if ( this->uNumBloodsplats == 64 ) - v8 = 0; - v9 = 5 * (v8 + 1); - v10 = &this->std__vector_pBloodsplats[8 * v9 / 40]; - v10->x = x; - v10->y = y; - v10->z = z; - v10->radius = radius; - v10->r = r; - v10->g = g; - v10->b = b; + i = 0; + this->std__vector_pBloodsplats[i].x = x; + this->std__vector_pBloodsplats[i].y = y; + this->std__vector_pBloodsplats[i].z = z; + this->std__vector_pBloodsplats[i].radius = radius; + this->std__vector_pBloodsplats[i].r = r; + this->std__vector_pBloodsplats[i].g = g; + this->std__vector_pBloodsplats[i].b = b; this->std__vector_pBloodsplats_size = min(this->std__vector_pBloodsplats_size + 1, 64); } @@ -99,44 +93,44 @@ //----- (0049B540) -------------------------------------------------------- char DecalBuilder::ApplyDecals(int light_level, char a3, stru154 *a4, int a5, RenderVertexSoft *a6, IndoorCameraD3D_Vec4 *a7, char a8, unsigned int uSectorID) { - char *v9; // eax@3 - signed int v10; // ecx@3 - RenderVertexSoft *v11; // eax@10 - unsigned int v12; // edx@10 - RenderVertexSoft *v13; // esi@11 - RenderVertexSoft *v14; // edi@11 - char v15; // zf@11 + //char *v9; // eax@3 + //signed int v10; // ecx@3 + //RenderVertexSoft *v11; // eax@10 + //unsigned int v12; // edx@10 + //RenderVertexSoft *v13; // esi@11 + //RenderVertexSoft *v14; // edi@11 + //char v15; // zf@11 stru154 *v16; // esi@12 - double v18; // st7@17 - double v19; // st6@17 - float v20; // eax@17 - Bloodsplat *v21; // esi@21 - int v22; // eax@21 - int v23; // ecx@21 - double v24; // st7@21 + //double v18; // st7@17 + //double v19; // st6@17 + //float v20; // eax@17 + //Bloodsplat *v21; // esi@21 + //int v22; // eax@21 + //int v23; // ecx@21 + //double v24; // st7@21 int v25; // ebx@21 - double v26; // st7@21 - int v27; // edi@21 - double v28; // st7@21 - float v29; // ST10_4@21 + //double v26; // st7@21 + //int v27; // edi@21 + //double v28; // st7@21 + //float v29; // ST10_4@21 int v30; // ST08_4@21 //DecalBuilder *v31; // esi@21 - int v32; // [sp+4h] [bp-44h]@18 - float v33; // [sp+8h] [bp-40h]@21 - stru314 *v34; // [sp+Ch] [bp-3Ch]@21 - float v35; // [sp+10h] [bp-38h]@21 - float v36; // [sp+14h] [bp-34h]@17 - int v37; // [sp+18h] [bp-30h]@17 - int a5a; // [sp+28h] [bp-20h]@21 - int v39; // [sp+2Ch] [bp-1Ch]@21 - int v40; // [sp+30h] [bp-18h]@21 - int v41; // [sp+34h] [bp-14h]@22 - int v42; // [sp+38h] [bp-10h]@21 + //int v32; // [sp+4h] [bp-44h]@18 + //float v33; // [sp+8h] [bp-40h]@21 + //stru314 *v34; // [sp+Ch] [bp-3Ch]@21 + //float v35; // [sp+10h] [bp-38h]@21 + //float v36; // [sp+14h] [bp-34h]@17 + //int v37; // [sp+18h] [bp-30h]@17 + //int a5a; // [sp+28h] [bp-20h]@21 + //int v39; // [sp+2Ch] [bp-1Ch]@21 + //int v40; // [sp+30h] [bp-18h]@21 + //int v41; // [sp+34h] [bp-14h]@22 + //int v42; // [sp+38h] [bp-10h]@21 int v43; // [sp+3Ch] [bp-Ch]@21 //DecalBuilder *thisa; // [sp+40h] [bp-8h]@1 //RenderVertexSoft *a11; // [sp+44h] [bp-4h]@8 int a6a; - int *a6b; + //int *a6b; // __debugbreak(); @@ -184,61 +178,63 @@ } } else - { v16 = a4; - } - v18 = v16->face_plane.vNormal.z; - v19 = v16->face_plane.vNormal.y; - v20 = v16->face_plane.vNormal.x; - v37 = (int)&static_AE4F60.field_1C; - static_AE4F60.field_4.y = v19; - static_AE4F60.field_4.x = v20; - LODWORD(v36) = (DWORD)&static_AE4F60.field_10; - static_AE4F60.field_4.z = v18; + //v18 = v16->face_plane.vNormal.z; + //v19 = v16->face_plane.vNormal.y; + //v20 = v16->face_plane.vNormal.x; + //v37 = (int)&static_AE4F60.field_1C; + static_AE4F60.field_4.y = v16->face_plane.vNormal.y; + static_AE4F60.field_4.x = v16->face_plane.vNormal.x; + //LODWORD(v36) = (DWORD)&static_AE4F60.field_10; + static_AE4F60.field_4.z = v16->face_plane.vNormal.z; static_AE4F60.dist = v16->face_plane.dist; - if ( !pGame->pIndoorCameraD3D->GetFacetOrientation(v16->polygonType, &static_AE4F60.field_4, &static_AE4F60.field_10, &static_AE4F60.field_1C) ) - { + if ( !pGame->pIndoorCameraD3D->GetFacetOrientation(v16->polygonType, &static_AE4F60.field_4, + &static_AE4F60.field_10, &static_AE4F60.field_1C) ) MessageBoxW(nullptr, L"Error: Failed to get the facet orientation", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:101", 0); - } - int _a7 = 0; + if ( this->uNumDecals > 0 ) { - a6b = this->std__vector_30B00C; - do + //a6b = this->std__vector_30B00C; + for ( int i = 0; i < this->uNumDecals; ++i ) { - v21 = &pBloodsplatContainer->std__vector_pBloodsplats[*a6b]; - v22 = _43F5C8_get_point_light_level_with_respect_to_lights(light_level, uSectorID, v21->x, v21->y, v21->z); - v23 = v21->b; - v24 = v21->x; - v42 = v22; - BYTE3(v22) = 0; - *(short *)((char *)&v22 + 1) = v21->r; - LOBYTE(v22) = v21->g; - v43 = v23 | (v22 << 8); - v25 = (signed __int64)v24; - v26 = v21->z; - v27 = (signed __int64)v21->y; - v37 = a8; - v40 = (signed __int64)v26; - v28 = v21->dot_dist; + //v21 = &pBloodsplatContainer->std__vector_pBloodsplats[*a6b]; + int point_light_level = _43F5C8_get_point_light_level_with_respect_to_lights(light_level, uSectorID, + pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].x, + pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].y, + pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].z); + //v23 = pBloodsplatContainer->std__vector_pBloodsplats[*a6b].b; + //v24 = pBloodsplatContainer->std__vector_pBloodsplats[*a6b].x; + //v42 = v22; + //BYTE3(v22) = 0; + //*(short *)((char *)&v22 + 1) = pBloodsplatContainer->std__vector_pBloodsplats[*a6b].r; + //LOBYTE(v22) = pBloodsplatContainer->std__vector_pBloodsplats[*a6b].g; + v43 = pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].b | + ((unsigned int)pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].g << 8) | + ((unsigned int)pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].r << 16); + v25 = (signed __int64)pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].x; + //v27 = (signed __int64)pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].y; + //v37 = a8; + //v40 = (signed __int64)pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].z; + //v28 = pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].dot_dist; //LODWORD(v36) = (uint32)a6; - a5a = v25; - v39 = v27; - LODWORD(v35) = a5; - v34 = &static_AE4F60; - v33 = v28; - v32 = v23 | (v22 << 8); - v29 = v21->radius; + //a5a = v25; + //v39 = v27; + //LODWORD(v35) = a5; + //v34 = &static_AE4F60; + //v33 = v28; + //v32 = pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].b | (v22 << 8); + //v29 = pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].radius; //v30 = (int)v21; //v31 = thisa; - if ( !this->_49B790_build_decal_geometry(v42, a3, (Bloodsplat *)v21, (int)&a5a, SLODWORD(v29), v43, v33, &static_AE4F60, a5, a6, a8) ) - { - MessageBoxW(nullptr, L"Error: Failed to build decal geometry", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:114", 0); - } - ++_a7; - ++a6b; + if ( !this->_49B790_build_decal_geometry(point_light_level, a3, + &pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]], + (int)&v25, + pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].radius, + v43, + pBloodsplatContainer->std__vector_pBloodsplats[this->std__vector_30B00C[i]].dot_dist, + &static_AE4F60, a5, a6, a8) ) + MessageBoxW(nullptr, L"Error: Failed to build decal geometry", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:114", 0); } - while ( _a7 < this->uNumDecals ); } return 1; } @@ -296,16 +292,17 @@ //v17 = a5; //v18 = a9; this->flt_30C030 = 1.0 - (a6 - this->field_30C02C) / a6; - v13->field_C08 = (signed __int64)((double)*(signed int *)a5 - a8 * a9->field_4.x); - v13->field_C0A = (signed __int64)((double)*(signed int *)(a5 + 4) - a8 * a9->field_4.y); + v13->field_C08 = (signed __int64)(a4->x - a8 * a9->field_4.x); + v13->field_C0A = (signed __int64)(a4->y - a8 * a9->field_4.y); //v19 = a6; - v13->field_C0C = (signed __int64)((double)*(signed int *)(a5 + 8) - a8 * a9->field_4.z); + v13->field_C0C = (signed __int64)(a4->z - a8 * a9->field_4.z); //v20 = a6 * this->flt_30C030; //a8a = v13->pVertices; this->field_30C034 = a6 * this->flt_30C030; this->field_30C010 = this->field_30C034 * a9->field_10.x; this->field_30C014 = this->field_30C034 * a9->field_10.y; this->field_30C018 = this->field_30C034 * a9->field_10.z; + this->field_30C01C = this->field_30C034 * a9->field_1C.x; this->field_30C020 = this->field_30C034 * a9->field_1C.y; this->field_30C024 = this->field_30C034 * a9->field_1C.z;