Mercurial > mm7
comparison Render.cpp @ 2166:00bd098f6435
fixpoint_mul in different functions and others
author | Ritor1 |
---|---|
date | Fri, 17 Jan 2014 17:58:48 +0600 |
parents | 0a1438c16c2b |
children | 5b27c035a241 |
comparison
equal
deleted
inserted
replaced
2165:47ac9e87690c | 2166:00bd098f6435 |
---|---|
4321 } | 4321 } |
4322 | 4322 |
4323 //----- (004A1B22) -------------------------------------------------------- | 4323 //----- (004A1B22) -------------------------------------------------------- |
4324 unsigned int Render::Billboard_ProbablyAddToListAndSortByZOrder(float z) | 4324 unsigned int Render::Billboard_ProbablyAddToListAndSortByZOrder(float z) |
4325 { | 4325 { |
4326 //unsigned int v2; // ebx@1 | |
4327 //double v4; // st7@5 | |
4328 //unsigned int v5; // esi@5 | |
4329 //int v6; // ecx@5 | |
4330 unsigned int v7; // edx@6 | 4326 unsigned int v7; // edx@6 |
4331 char *v8; // ecx@12 | 4327 |
4332 void *v9; // edi@16 | |
4333 unsigned int v10; // eax@16 | |
4334 void *v11; // edi@21 | |
4335 unsigned int v12; // eax@21 | |
4336 | |
4337 //v2 = uNumBillboardsToDraw; | |
4338 if (uNumBillboardsToDraw >= 999 ) | 4328 if (uNumBillboardsToDraw >= 999 ) |
4339 return 0; | 4329 return 0; |
4340 if (!uNumBillboardsToDraw) | 4330 if (!uNumBillboardsToDraw) |
4341 { | 4331 { |
4342 uNumBillboardsToDraw = 1; | 4332 uNumBillboardsToDraw = 1; |
4343 return 0; | 4333 return 0; |
4344 } | 4334 } |
4345 | 4335 |
4346 //v4 = *(float *)&a1; | |
4347 //v5 = pRenderer->uNumBillboardsToDraw; | |
4348 //v6 = 0; | |
4349 for (int left = 0, right = uNumBillboardsToDraw; left < right; ) // binsearch | 4336 for (int left = 0, right = uNumBillboardsToDraw; left < right; ) // binsearch |
4350 { | 4337 { |
4351 v7 = left + (right - left) / 2; | 4338 v7 = left + (right - left) / 2; |
4352 if (z <= pRenderer->pBillboardRenderListD3D[v7].z_order) | 4339 if (z <= pRenderer->pBillboardRenderListD3D[v7].z_order) |
4353 right = v7; | 4340 right = v7; |
4354 else | 4341 else |
4355 left = v7 + 1; | 4342 left = v7 + 1; |
4356 } | 4343 } |
4357 | 4344 |
4358 v8 = (char *)&pRenderer->pBillboardRenderListD3D[v7].z_order; | 4345 if (z > pRenderer->pBillboardRenderListD3D[v7].z_order ) |
4359 if (z > *(float *)v8 ) | |
4360 { | 4346 { |
4361 if ( v7 == pRenderer->uNumBillboardsToDraw - 1 ) | 4347 if ( v7 == pRenderer->uNumBillboardsToDraw - 1 ) |
4362 { | |
4363 v7 = pRenderer->uNumBillboardsToDraw; | 4348 v7 = pRenderer->uNumBillboardsToDraw; |
4364 } | |
4365 else | 4349 else |
4366 { | 4350 { |
4367 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) | 4351 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) |
4368 { | 4352 { |
4369 v9 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw]; | 4353 for ( uint i = 0; i < pRenderer->uNumBillboardsToDraw - v7; i++ ) |
4370 v10 = pRenderer->uNumBillboardsToDraw - v7; | |
4371 do | |
4372 { | 4354 { |
4373 memcpy(v9, (char *)v9 - 156, 0x9Cu); | 4355 memcpy(&pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - i], |
4374 v9 = (char *)v9 - 156; | 4356 &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - (i + 1)], |
4375 --v10; | 4357 sizeof(pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - i])); |
4376 } | 4358 } |
4377 while ( v10 ); | |
4378 } | 4359 } |
4379 ++v7; | 4360 ++v7; |
4380 } | 4361 } |
4381 //LABEL_23: | |
4382 uNumBillboardsToDraw++; | 4362 uNumBillboardsToDraw++; |
4383 return v7; | 4363 return v7; |
4384 } | 4364 } |
4385 if (z <= *(float *)v8 ) | 4365 if (z <= pRenderer->pBillboardRenderListD3D[v7].z_order ) |
4386 { | 4366 { |
4387 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) | 4367 if ( (signed int)pRenderer->uNumBillboardsToDraw > (signed int)v7 ) |
4388 { | 4368 { |
4389 v11 = &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw]; | 4369 for ( uint i = 0; i < pRenderer->uNumBillboardsToDraw - v7; i++ ) |
4390 v12 = pRenderer->uNumBillboardsToDraw - v7; | 4370 { |
4391 do | 4371 memcpy(&pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - i], |
4392 { | 4372 &pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw -(i + 1)], |
4393 memcpy(v11, (char *)v11 - 156, 0x9Cu); | 4373 sizeof(pRenderer->pBillboardRenderListD3D[pRenderer->uNumBillboardsToDraw - i])); |
4394 v11 = (char *)v11 - 156; | 4374 } |
4395 --v12; | 4375 } |
4396 } | |
4397 while ( v12 ); | |
4398 } | |
4399 //goto LABEL_23; | |
4400 uNumBillboardsToDraw++; | 4376 uNumBillboardsToDraw++; |
4401 return v7; | 4377 return v7; |
4402 } | 4378 } |
4403 return v7; | 4379 return v7; |
4404 } | 4380 } |
8585 | 8561 |
8586 for (int i = uNumBillboardsToDraw - 1; i >= 0; --i) | 8562 for (int i = uNumBillboardsToDraw - 1; i >= 0; --i) |
8587 { | 8563 { |
8588 if (pBillboardRenderListD3D[i].opacity != RenderBillboardD3D::NoBlend) | 8564 if (pBillboardRenderListD3D[i].opacity != RenderBillboardD3D::NoBlend) |
8589 SetBillboardBlendOptions(pBillboardRenderListD3D[i].opacity); | 8565 SetBillboardBlendOptions(pBillboardRenderListD3D[i].opacity); |
8590 | |
8591 | 8566 |
8592 pRenderD3D->pDevice->SetTexture(0, pBillboardRenderListD3D[i].pTexture); | 8567 pRenderD3D->pDevice->SetTexture(0, pBillboardRenderListD3D[i].pTexture); |
8593 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 8568 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
8594 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 8569 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
8595 pBillboardRenderListD3D[i].pQuads, pBillboardRenderListD3D[i].uNumVertices, | 8570 pBillboardRenderListD3D[i].pQuads, pBillboardRenderListD3D[i].uNumVertices, |
8815 array_77EC08[pODMRenderParams->uNumPolygons].pTexture = pFaceTexture; | 8790 array_77EC08[pODMRenderParams->uNumPolygons].pTexture = pFaceTexture; |
8816 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_FLUID) | 8791 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_FLUID) |
8817 array_77EC08[pODMRenderParams->uNumPolygons].flags |= 2; | 8792 array_77EC08[pODMRenderParams->uNumPolygons].flags |= 2; |
8818 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_INDOOR_SKY ) | 8793 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_INDOOR_SKY ) |
8819 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4; | 8794 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4; |
8820 if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & 4 ) | 8795 if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_UNKNOW8 ) |
8821 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4; | 8796 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4; |
8822 else | 8797 else |
8823 { | 8798 { |
8824 if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & 0x20 ) | 8799 if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_UNKNOW9 ) |
8825 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 8; | 8800 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 8; |
8826 } | 8801 } |
8827 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & 0x0800) | 8802 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_UNKNOW10) |
8828 array_77EC08[pODMRenderParams->uNumPolygons].flags |= 0x2000; | 8803 array_77EC08[pODMRenderParams->uNumPolygons].flags |= 0x2000; |
8829 else | 8804 else |
8830 { | 8805 { |
8831 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_DONT_CACHE_TEXTURE) | 8806 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_DONT_CACHE_TEXTURE) |
8832 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 0x10u; | 8807 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 0x10u; |