Mercurial > mm7
changeset 2314:8e9be4fa33a8
for Bloodsplat
author | Ritor1 |
---|---|
date | Tue, 18 Mar 2014 23:50:35 +0600 |
parents | b75a8f15568d |
children | 58be29479e75 |
files | DecalBuilder.cpp DecalBuilder.h MMT.cpp OurMath.h mm7_2.cpp |
diffstat | 5 files changed, 121 insertions(+), 119 deletions(-) [+] |
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;
--- a/DecalBuilder.h Tue Mar 18 17:34:33 2014 +0600 +++ b/DecalBuilder.h Tue Mar 18 23:50:35 2014 +0600 @@ -31,9 +31,9 @@ float z; float radius; float dot_dist; - char r; - char g; - char b; + unsigned char r; + unsigned char g; + unsigned char b; char field_1B; int field_1C; unsigned long long field_20; @@ -66,7 +66,7 @@ void AddBloodsplat(float x, float y, float z, float r, float g, float b, float radius, int a8, int a9); - void AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b); + void AddBloodsplat(float x, float y, float z, float radius, unsigned char r, unsigned char g, unsigned char b); //void ( ***vdestructor_ptr)(BloodsplatContainer *, bool);
--- a/MMT.cpp Tue Mar 18 17:34:33 2014 +0600 +++ b/MMT.cpp Tue Mar 18 23:50:35 2014 +0600 @@ -12,7 +12,7 @@ #include "CShow.h" #include "GUIFont.h" #include "lib/libpng/png.h" -#include "MediaPlayer.h" +//#include "MediaPlayer.h" void ShowLogoVideo() { @@ -183,9 +183,12 @@ pGUIWindow2 = 0; pAudioPlayer->StopChannels(-1, -1);//остановить/подготовить канал - //Media::Player *p = new Media::Player;//создаётся плеер - //Media::ITrack *track = p->LoadTrack(L"Sounds\\New_Sounds/Stronghold_Theme.mp3"); - //track->Play(); + if (!bNoSound ) + { + //Media::Player *p = new Media::Player;//создаётся плеер + //Media::ITrack *track = p->LoadTrack(L"Sounds\\New_Sounds/Stronghold_Theme.mp3"); + //track->Play(); + } pMouse->RemoveHoldingItem();//избавить курсор от вещи
--- a/OurMath.h Tue Mar 18 17:34:33 2014 +0600 +++ b/OurMath.h Tue Mar 18 23:50:35 2014 +0600 @@ -32,9 +32,8 @@ int fixpoint_from_int(int lhv, int rhv); template <typename FloatType> -inline int bankersRounding( - const FloatType& value - ) { +inline int bankersRounding(const FloatType& value) +{ assert("Method unsupported for this type" && false); return value; }
--- a/mm7_2.cpp Tue Mar 18 17:34:33 2014 +0600 +++ b/mm7_2.cpp Tue Mar 18 23:50:35 2014 +0600 @@ -881,7 +881,7 @@ int v160; // [sp+3Ch] [bp-4Ch]@13 unsigned __int16 *v175; // [sp+4Ch] [bp-3Ch]@13 unsigned __int16 *v193; // [sp+5Ch] [bp-2Ch]@7 - signed int v231; // [sp+78h] [bp-10h]@7 + //signed int v231; // [sp+78h] [bp-10h]@7 __int64 v240; // [sp+7Ch] [bp-Ch]@12 unsigned int v251; // [sp+80h] [bp-8h]@218 unsigned int v252; // [sp+84h] [bp-4h]@218 @@ -922,18 +922,20 @@ return result; //do - for ( v231 = 0; v231 < dstHeight; v231++ ) + for ( int height = 0; height < dstHeight; height++ ) { - for (int counter = 0; counter < dstWidth; counter++) + for (int width = 0; width < dstWidth; width++) { - a6s = (double)counter / (double)dstWidth * (double)srcWidth; + a6s = (double)width / (double)dstWidth * (double)srcWidth; widthRatio = bankersRounding(a6s); - a6t = (double)(counter + 1) / (double)dstWidth * (double)srcWidth; + a6t = (double)(width + 1) / (double)dstWidth * (double)srcWidth; widthRatioPlusOne = bankersRounding(a6t); - v17 = (double)v231 / (double)dstHeight * (double)srcHeight; + + v17 = (double)height / (double)dstHeight * (double)srcHeight; heightRatio = bankersRounding(v17); - v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; + v18 = (double)(height + 1) / (double)dstHeight * (double)srcHeight; heightRatioPlusOne = bankersRounding(v18); + v251 = 0; v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); v252 = 0; @@ -943,15 +945,15 @@ v175 = (unsigned short*)((char *)pSrc + field_0_bits * (widthRatio + srcPitch * heightRatio)); for (int heightDiff = 0; heightDiff < heightRatioPlusOne - heightRatio; heightDiff++) { - int ratioDiff = widthRatioPlusOne - widthRatio; - for(int i = 0; i < ratioDiff; i++) + //int ratioDiff = widthRatioPlusOne - widthRatio; + for(int ratioDiff = 0; ratioDiff < widthRatioPlusOne - widthRatio; ratioDiff++) { if(field0value == 32) - v21 = _450FB1(((int*)v175)[i]); + v21 = _450FB1(((int*)v175)[ratioDiff]); else if(field0value == 16) - v21 = _450FB1(((_WORD*)v175)[i]); + v21 = _450FB1(((_WORD*)v175)[ratioDiff]); else if (field0value == 8) - v21 = _450FB1(((unsigned __int8*)v175)[i]); + v21 = _450FB1(((unsigned __int8*)v175)[ratioDiff]); v240 += ((unsigned int)v21 >> 24); a6b += BYTE2(v21); v252 += BYTE1(v21); @@ -960,10 +962,11 @@ if (field0value == 32) v175 += 2 * srcPitch; else if (field0value == 16) - v175 += srcPitch; + v175 += srcPitch; else if (field0value == 8) v175 = (unsigned short*)((char *)v175 + 2 * srcPitch); } + v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); if ( v19 ) { @@ -979,7 +982,7 @@ } v193 = (unsigned __int16 *)((char *)v193 + field_20_bits * (dstPitch - dstWidth)); //++v231; - result = v231; + result = height; } //while(v231 < dstHeight); return result;