# HG changeset patch # User Ritor1 # Date 1363376678 -21600 # Node ID 687b4365ee84c39ff4590016ecf0828c3f3fe6ce # Parent 0f25d026acfa5a7bf33ecb59bc4e4ff03b750298 Indoor Portal diff -r 0f25d026acfa -r 687b4365ee84 LightmapBuilder.cpp --- a/LightmapBuilder.cpp Fri Mar 15 19:03:53 2013 +0600 +++ b/LightmapBuilder.cpp Sat Mar 16 01:44:38 2013 +0600 @@ -59,7 +59,7 @@ for (uint i = 0; i < uNumVertices; ++i) memcpy(static_69B140 + i, a5 + i, sizeof(RenderVertexSoft)); - __debugbreak(); + //__debugbreak(); if (pGame->pIndoorCameraD3D->_437376( a3, static_69B140, diff -r 0f25d026acfa -r 687b4365ee84 stru9.cpp --- a/stru9.cpp Fri Mar 15 19:03:53 2013 +0600 +++ b/stru9.cpp Sat Mar 16 01:44:38 2013 +0600 @@ -8,30 +8,30 @@ //----- (00498377) -------------------------------------------------------- bool stru9::_498377(struct RenderVertexSoft *a1, unsigned int uNumVertices, struct IndoorCameraD3D_Vec4 *a3, struct RenderVertexSoft *pVertices, unsigned int *pOutNumVertices) { - bool result; // eax@7 - unsigned int *v7; // ebx@7 - char *v8; // esi@8 + int result; // eax@7 + //unsigned int *v7; // ebx@7 + //char *v8; // esi@8 RenderVertexSoft *v9; // ecx@9 - double v10; // st7@12 - double v11; // st6@12 - RenderVertexSoft *v12; // esi@13 - int v13; // ecx@25 + //double v10; // st7@12 + //double v11; // st6@12 + //RenderVertexSoft *v12; // esi@13 + //int v13; // ecx@25 VertexBuffer *v14; // edx@26 char *v15; // eax@26 unsigned int i; // ecx@26 - bool v17; // [sp+0h] [bp-28h]@9 - char *v18; // [sp+10h] [bp-18h]@8 + int v17; // [sp+0h] [bp-28h]@9 + //char *v18; // [sp+10h] [bp-18h]@8 RenderVertexSoft *v19; // [sp+14h] [bp-14h]@0 - RenderVertexSoft *v20; // [sp+18h] [bp-10h]@0 + //RenderVertexSoft *v20; // [sp+18h] [bp-10h]@0 signed int v21; // [sp+1Ch] [bp-Ch]@7 - RenderVertexSoft *a2; // [sp+20h] [bp-8h]@8 - stru9 *thisa; // [sp+24h] [bp-4h]@1 + //RenderVertexSoft *a2; // [sp+20h] [bp-8h]@8 + //stru9 *thisa; // [sp+24h] [bp-4h]@1 signed int a3a; // [sp+38h] [bp+10h]@12 int a3b; // [sp+38h] [bp+10h]@25 - __debugbreak(); + //__debugbreak(); - thisa = this; + //thisa = this; static RenderVertexSoft static_AE3FB4; static bool __init_flag1 = false; @@ -61,58 +61,70 @@ } result = 0; - v7 = pOutNumVertices; + //v7 = pOutNumVertices; v21 = 0; if ( (signed int)uNumVertices <= 0 ) - goto LABEL_32; - a2 = a1; - v8 = (char *)&a3->y; - v18 = (char *)&a3->y; - do { - v17 = result + 1; + *pOutNumVertices = 0; + return true; + } + //a2 = a1; + //v8 = (char *)&a3->y; + //v18 = (char *)&a3->y; + //do + for (v17 = 0; v17 < uNumVertices; v17++ ) + { + //v17 = result + 1; + result = v17; v9 = &a1[(result + 1) % (signed int)uNumVertices]; - if ( a2->vWorldPosition.x != v9->vWorldPosition.x - || a2->vWorldPosition.y != v9->vWorldPosition.y - || a2->vWorldPosition.z != v9->vWorldPosition.z ) + if ( a1->vWorldPosition.x != v9->vWorldPosition.x + || a1->vWorldPosition.y != v9->vWorldPosition.y + || a1->vWorldPosition.z != v9->vWorldPosition.z ) { - v10 = *((float *)v8 + 1); - v11 = *(float *)v8; + //v10 = a3->z; + //v11 = a3->y; ++v21; - result = 0; - static_AE3FA4.x = *((float *)v8 - 1); + //result = 0; static_AE33A0.uNumVertices = 0; - a3a = 0; - static_AE3FA4.y = v11; - static_AE3FA4.z = v10; - if ( (signed int)*v7 <= 0 ) - goto LABEL_32; - do + //a3a = 0; + static_AE3FA4.x = a3->x; + static_AE3FA4.y = a3->y; + static_AE3FA4.z = a3->z; + if ( (signed int)*pOutNumVertices <= 0 ) { - v12 = &pVertices[result]; + *pOutNumVertices = 0; + return true; + } + //do + for ( int i = 0; i < (signed int)*pOutNumVertices; i++ ) + { + //v12 = &pVertices[result]; if ( result ) { - if ( _4989E1(v20, &pVertices[result], a2, &static_AE3FA4) - && _498774(v20, v12, a2, &static_AE3FA4, &static_AE3FB4) ) + if ( _4989E1(&pVertices[i], &pVertices[i], a1, &static_AE3FA4) + && _498774(&pVertices[i], &pVertices[i], a1, &static_AE3FA4, &static_AE3FB4) ) AddVertex(&static_AE33A0, &static_AE3FB4); } else { - v19 = &pVertices[result]; + v19 = &pVertices[i]; } - v20 = v12; - if ( AreVectorsCollinear(v12, a2, &static_AE3FA4) ) - AddVertex(&static_AE33A0, v12); - v7 = pOutNumVertices; - result = a3a++ + 1; + //v20 = v12; + if ( AreVectorsCollinear(&pVertices[i], a1, &static_AE3FA4) )// + AddVertex(&static_AE33A0, &pVertices[i]); + //pOutNumVertices = pOutNumVertices; + //a3a++; } - while ( a3a < (signed int)*pOutNumVertices ); + //while ( a3a < (signed int)*pOutNumVertices ); if ( !static_AE33A0.uNumVertices ) - goto LABEL_32; - if ( _4989E1(v12, v19, a2, &static_AE3FA4) - && _498774(v12, v19, a2, &static_AE3FA4, &static_AE3FB4) ) + { + *pOutNumVertices = 0; + return true; + } + if ( _4989E1(&pVertices[result], v19, a1, &static_AE3FA4) + && _498774(&pVertices[result], v19, a1, &static_AE3FA4, &static_AE3FB4) ) AddVertex(&static_AE33A0, &static_AE3FB4); - v13 = static_AE33A0.uNumVertices; + //v13 = static_AE33A0.uNumVertices; a3b = 0; if ( static_AE33A0.uNumVertices > 0 ) { @@ -123,33 +135,33 @@ i = (char *)&static_AE33A0.pVertices[0].vWorldPosition.y - (char *)pVertices ) { ++a3b; - *((int *)v15 - 1) = *(unsigned int *)(&v14->pVertices[0].vWorldPosition.x); + pVertices->vWorldPosition.x = v14->pVertices[0].vWorldPosition.x; v14 = (VertexBuffer *)((char *)v14 + 48); - *(float *)v15 = *(float *)&v15[(char *)&static_AE33A0 - (char *)pVertices]; - *((float *)v15 + 1) = *(float *)&v15[i]; - *((float *)v15 + 8) = *(float *)&v15[(char *)&static_AE33A0.pVertices[0]._rhw - (char *)pVertices]; - *((float *)v15 + 9) = *(float *)&v15[(char *)&static_AE33A0.pVertices[0].u - (char *)pVertices]; - v13 = static_AE33A0.uNumVertices; + pVertices->vWorldPosition.y = *(float *)&v15[(char *)&static_AE33A0 - (char *)pVertices]; + pVertices->vWorldPosition.z = *(float *)&v15[i]; + pVertices->u = *(float *)&v15[(char *)&static_AE33A0.pVertices[0]._rhw - (char *)pVertices]; + pVertices->v = *(float *)&v15[(char *)&static_AE33A0.pVertices[0].u - (char *)pVertices]; + //static_AE33A0.uNumVertices = static_AE33A0.uNumVertices; v15 += 48; if ( a3b >= static_AE33A0.uNumVertices ) break; } } - v7 = pOutNumVertices; - v8 = v18; - *pOutNumVertices = v13; + //v7 = pOutNumVertices; + //a3->y = a3->y; + *pOutNumVertices = static_AE33A0.uNumVertices; } - result = v17; - ++a2; - v8 += 24; - v18 = v8; + //result = v17; + ++a1; + a3++; + //v18 = (char *)&a3->y; } - while ( v17 < (signed int)uNumVertices ); + //while ( v17 < (signed int)uNumVertices ); if ( v21 < 3 ) -LABEL_32: - *v7 = 0; - return 1; + *pOutNumVertices = 0; + return true; } + // AE3FE4: using guessed type char static_init_flag__AE3FB4_bit1__AE3FA4_bit2__AE33A0_bit3; //----- (004985FB) --------------------------------------------------------