Mercurial > mm7
diff Vis.cpp @ 82:1faa29fd4c2d
many type, memory, boundary fixes
author | zipi |
---|---|
date | Sun, 03 Feb 2013 23:37:17 +0000 |
parents | 6ad816231528 |
children | b9196a36b7c9 |
line wrap: on
line diff
--- a/Vis.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/Vis.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -119,10 +119,10 @@ char Vis::_4C12C3_FindSomeBillboard(RenderVertexSoft *a1, int a2, float a3, float a4) { signed int v5; // esi@1 - char *v6; // edi@2 + RenderBillboardD3D *v6; // edi@2 double v7; // st7@9 int v8; // edx@9 - char *v9; // ecx@10 + RenderVertexSoft *v9; // ecx@10 char result; // al@24 Vis *thisa; // [sp+10h] [bp-8h]@1 float thisb; // [sp+10h] [bp-8h]@9 @@ -134,20 +134,24 @@ v5 = 0; thisa = this; if ( (signed int)pRenderer->uNumBillboardsToDraw <= 0 ) - goto LABEL_28; - v6 = (char *)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID; + { + return 0; + } + v6 = pRenderer->pBillboardRenderListD3D; do { - if ( IsPointInsideD3DBillboard((RenderBillboardD3D *)(v6 - 152), a3, a4) + if ( IsPointInsideD3DBillboard(v6, a3, a4) && (v13 == -1 - || (unsigned int)pBillboardRenderList[*(int *)v6].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) ) + || (unsigned int)pBillboardRenderList[v6->uParentBillboardID].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) ) v13 = v5; ++v5; - v6 += 156; + ++v6; } while ( v5 < (signed int)pRenderer->uNumBillboardsToDraw ); if ( v13 == -1 ) - goto LABEL_28; + { + return 0; + } v7 = 3.4028235e38; v8 = a2; a4a = 3.4028235e38; @@ -155,18 +159,18 @@ thisb = -3.4028235e38; if ( a2 > 0 ) { - v9 = (char *)&a1->vWorldViewProjY; + v9 = a1; do { - if ( *((float *)v9 - 1) < v7 ) - v7 = *((float *)v9 - 1); - if ( *((float *)v9 - 1) > (double)a3a ) - a3a = *((float *)v9 - 1); - if ( *(float *)v9 < (double)a4a ) - a4a = *(float *)v9; - if ( *(float *)v9 > (double)thisb ) - thisb = *(float *)v9; - v9 += 48; + if ( v9->vWorldViewProjX < v7 ) + v7 = v9->vWorldViewProjX; + if ( v9->vWorldViewProjX > (double)a3a ) + a3a = v9->vWorldViewProjX; + if ( v9->vWorldViewProjY < (double)a4a ) + a4a = v9->vWorldViewProjY; + if ( v9->vWorldViewProjY > (double)thisb ) + thisb = v9->vWorldViewProjY; + ++v9; --v8; } while ( v8 ); @@ -175,7 +179,6 @@ || pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.y > (double)a4a || pRenderer->pBillboardRenderListD3D[v13].pQuards[3].pos.x < (double)a3a || pRenderer->pBillboardRenderListD3D[v13].pQuards[1].pos.y < (double)thisb ) -LABEL_28: result = 0; else result = 1; @@ -237,14 +240,14 @@ int v6; // ST1C_4@6 Vis_stru1_stru0 *v7; // edi@6 Vis *thisa; // [sp+20h] [bp-Ch]@1 - void **v9; // [sp+24h] [bp-8h]@2 + RenderBillboardD3D *v9; // [sp+24h] [bp-8h]@2 unsigned int uD3DBillboardIdx; // [sp+28h] [bp-4h]@1 uD3DBillboardIdx = 0; thisa = this; if ( (signed int)pRenderer->uNumBillboardsToDraw > 0 ) { - v9 = (void **)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID; + v9 = pRenderer->pBillboardRenderListD3D;//[0].uParentBillboardID; do { if ( is_part_of_selection((BLVFace *)uD3DBillboardIdx, a2) @@ -252,9 +255,9 @@ { if ( DoesRayIntersectBillboard(fPickDepth, uD3DBillboardIdx) ) { - v6 = pBillboardRenderList[(int)*v9].sZValue; + v6 = pBillboardRenderList[v9->uParentBillboardID].sZValue; v7 = &a4->array_0004[a4->uNumPointers]; - v7->pObjectInfo = *v9; + v7->pObjectInfo = (void *)v9->uParentBillboardID; v7 = (Vis_stru1_stru0 *)((char *)v7 + 4); v7->pObjectInfo = (void *)v6; v7->sZValue = 1; @@ -262,7 +265,7 @@ } } ++uD3DBillboardIdx; - v9 += 39; + ++v9; } while ( (signed int)uD3DBillboardIdx < (signed int)pRenderer->uNumBillboardsToDraw ); }