Mercurial > mm7
comparison Vis.cpp @ 82:1faa29fd4c2d
many type, memory, boundary fixes
author | zipi |
---|---|
date | Sun, 03 Feb 2013 23:37:17 +0000 |
parents | 6ad816231528 |
children | b9196a36b7c9 |
comparison
equal
deleted
inserted
replaced
81:377535d6e366 | 82:1faa29fd4c2d |
---|---|
117 | 117 |
118 //----- (004C12C3) -------------------------------------------------------- | 118 //----- (004C12C3) -------------------------------------------------------- |
119 char Vis::_4C12C3_FindSomeBillboard(RenderVertexSoft *a1, int a2, float a3, float a4) | 119 char Vis::_4C12C3_FindSomeBillboard(RenderVertexSoft *a1, int a2, float a3, float a4) |
120 { | 120 { |
121 signed int v5; // esi@1 | 121 signed int v5; // esi@1 |
122 char *v6; // edi@2 | 122 RenderBillboardD3D *v6; // edi@2 |
123 double v7; // st7@9 | 123 double v7; // st7@9 |
124 int v8; // edx@9 | 124 int v8; // edx@9 |
125 char *v9; // ecx@10 | 125 RenderVertexSoft *v9; // ecx@10 |
126 char result; // al@24 | 126 char result; // al@24 |
127 Vis *thisa; // [sp+10h] [bp-8h]@1 | 127 Vis *thisa; // [sp+10h] [bp-8h]@1 |
128 float thisb; // [sp+10h] [bp-8h]@9 | 128 float thisb; // [sp+10h] [bp-8h]@9 |
129 signed int v13; // [sp+14h] [bp-4h]@1 | 129 signed int v13; // [sp+14h] [bp-4h]@1 |
130 float a3a; // [sp+28h] [bp+10h]@9 | 130 float a3a; // [sp+28h] [bp+10h]@9 |
132 | 132 |
133 v13 = -1; | 133 v13 = -1; |
134 v5 = 0; | 134 v5 = 0; |
135 thisa = this; | 135 thisa = this; |
136 if ( (signed int)pRenderer->uNumBillboardsToDraw <= 0 ) | 136 if ( (signed int)pRenderer->uNumBillboardsToDraw <= 0 ) |
137 goto LABEL_28; | 137 { |
138 v6 = (char *)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID; | 138 return 0; |
139 } | |
140 v6 = pRenderer->pBillboardRenderListD3D; | |
139 do | 141 do |
140 { | 142 { |
141 if ( IsPointInsideD3DBillboard((RenderBillboardD3D *)(v6 - 152), a3, a4) | 143 if ( IsPointInsideD3DBillboard(v6, a3, a4) |
142 && (v13 == -1 | 144 && (v13 == -1 |
143 || (unsigned int)pBillboardRenderList[*(int *)v6].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) ) | 145 || (unsigned int)pBillboardRenderList[v6->uParentBillboardID].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) ) |
144 v13 = v5; | 146 v13 = v5; |
145 ++v5; | 147 ++v5; |
146 v6 += 156; | 148 ++v6; |
147 } | 149 } |
148 while ( v5 < (signed int)pRenderer->uNumBillboardsToDraw ); | 150 while ( v5 < (signed int)pRenderer->uNumBillboardsToDraw ); |
149 if ( v13 == -1 ) | 151 if ( v13 == -1 ) |
150 goto LABEL_28; | 152 { |
153 return 0; | |
154 } | |
151 v7 = 3.4028235e38; | 155 v7 = 3.4028235e38; |
152 v8 = a2; | 156 v8 = a2; |
153 a4a = 3.4028235e38; | 157 a4a = 3.4028235e38; |
154 a3a = -3.4028235e38; | 158 a3a = -3.4028235e38; |
155 thisb = -3.4028235e38; | 159 thisb = -3.4028235e38; |
156 if ( a2 > 0 ) | 160 if ( a2 > 0 ) |
157 { | 161 { |
158 v9 = (char *)&a1->vWorldViewProjY; | 162 v9 = a1; |
159 do | 163 do |
160 { | 164 { |
161 if ( *((float *)v9 - 1) < v7 ) | 165 if ( v9->vWorldViewProjX < v7 ) |
162 v7 = *((float *)v9 - 1); | 166 v7 = v9->vWorldViewProjX; |
163 if ( *((float *)v9 - 1) > (double)a3a ) | 167 if ( v9->vWorldViewProjX > (double)a3a ) |
164 a3a = *((float *)v9 - 1); | 168 a3a = v9->vWorldViewProjX; |
165 if ( *(float *)v9 < (double)a4a ) | 169 if ( v9->vWorldViewProjY < (double)a4a ) |
166 a4a = *(float *)v9; | 170 a4a = v9->vWorldViewProjY; |
167 if ( *(float *)v9 > (double)thisb ) | 171 if ( v9->vWorldViewProjY > (double)thisb ) |
168 thisb = *(float *)v9; | 172 thisb = v9->vWorldViewProjY; |
169 v9 += 48; | 173 ++v9; |
170 --v8; | 174 --v8; |
171 } | 175 } |
172 while ( v8 ); | 176 while ( v8 ); |
173 } | 177 } |
174 if ( v7 < pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.x | 178 if ( v7 < pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.x |
175 || pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.y > (double)a4a | 179 || pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.y > (double)a4a |
176 || pRenderer->pBillboardRenderListD3D[v13].pQuards[3].pos.x < (double)a3a | 180 || pRenderer->pBillboardRenderListD3D[v13].pQuards[3].pos.x < (double)a3a |
177 || pRenderer->pBillboardRenderListD3D[v13].pQuards[1].pos.y < (double)thisb ) | 181 || pRenderer->pBillboardRenderListD3D[v13].pQuards[1].pos.y < (double)thisb ) |
178 LABEL_28: | |
179 result = 0; | 182 result = 0; |
180 else | 183 else |
181 result = 1; | 184 result = 1; |
182 return result; | 185 return result; |
183 } | 186 } |
235 void Vis::PickBillboards(float fPickDepth, float fX, float fY, Vis_stru1 *a4, stru157 *a2) | 238 void Vis::PickBillboards(float fPickDepth, float fX, float fY, Vis_stru1 *a4, stru157 *a2) |
236 { | 239 { |
237 int v6; // ST1C_4@6 | 240 int v6; // ST1C_4@6 |
238 Vis_stru1_stru0 *v7; // edi@6 | 241 Vis_stru1_stru0 *v7; // edi@6 |
239 Vis *thisa; // [sp+20h] [bp-Ch]@1 | 242 Vis *thisa; // [sp+20h] [bp-Ch]@1 |
240 void **v9; // [sp+24h] [bp-8h]@2 | 243 RenderBillboardD3D *v9; // [sp+24h] [bp-8h]@2 |
241 unsigned int uD3DBillboardIdx; // [sp+28h] [bp-4h]@1 | 244 unsigned int uD3DBillboardIdx; // [sp+28h] [bp-4h]@1 |
242 | 245 |
243 uD3DBillboardIdx = 0; | 246 uD3DBillboardIdx = 0; |
244 thisa = this; | 247 thisa = this; |
245 if ( (signed int)pRenderer->uNumBillboardsToDraw > 0 ) | 248 if ( (signed int)pRenderer->uNumBillboardsToDraw > 0 ) |
246 { | 249 { |
247 v9 = (void **)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID; | 250 v9 = pRenderer->pBillboardRenderListD3D;//[0].uParentBillboardID; |
248 do | 251 do |
249 { | 252 { |
250 if ( is_part_of_selection((BLVFace *)uD3DBillboardIdx, a2) | 253 if ( is_part_of_selection((BLVFace *)uD3DBillboardIdx, a2) |
251 && IsPointInsideD3DBillboard((RenderBillboardD3D *)(v9 - 38), fX, fY) ) | 254 && IsPointInsideD3DBillboard((RenderBillboardD3D *)(v9 - 38), fX, fY) ) |
252 { | 255 { |
253 if ( DoesRayIntersectBillboard(fPickDepth, uD3DBillboardIdx) ) | 256 if ( DoesRayIntersectBillboard(fPickDepth, uD3DBillboardIdx) ) |
254 { | 257 { |
255 v6 = pBillboardRenderList[(int)*v9].sZValue; | 258 v6 = pBillboardRenderList[v9->uParentBillboardID].sZValue; |
256 v7 = &a4->array_0004[a4->uNumPointers]; | 259 v7 = &a4->array_0004[a4->uNumPointers]; |
257 v7->pObjectInfo = *v9; | 260 v7->pObjectInfo = (void *)v9->uParentBillboardID; |
258 v7 = (Vis_stru1_stru0 *)((char *)v7 + 4); | 261 v7 = (Vis_stru1_stru0 *)((char *)v7 + 4); |
259 v7->pObjectInfo = (void *)v6; | 262 v7->pObjectInfo = (void *)v6; |
260 v7->sZValue = 1; | 263 v7->sZValue = 1; |
261 ++a4->uNumPointers; | 264 ++a4->uNumPointers; |
262 } | 265 } |
263 } | 266 } |
264 ++uD3DBillboardIdx; | 267 ++uD3DBillboardIdx; |
265 v9 += 39; | 268 ++v9; |
266 } | 269 } |
267 while ( (signed int)uD3DBillboardIdx < (signed int)pRenderer->uNumBillboardsToDraw ); | 270 while ( (signed int)uD3DBillboardIdx < (signed int)pRenderer->uNumBillboardsToDraw ); |
268 } | 271 } |
269 } | 272 } |
270 | 273 |