Mercurial > mm7
changeset 1117:ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
* stru6_stru1_indoor_sw_billboard struct changes
* added inline round()
author | zipi |
---|---|
date | Wed, 29 May 2013 19:55:25 +0100 |
parents | 6a4d654ef9fb |
children | ca415f6bac1c |
files | MM7.h Render.cpp mm7_3.cpp stru6.h |
diffstat | 4 files changed, 47 insertions(+), 82 deletions(-) [+] |
line wrap: on
line diff
--- a/MM7.h Wed May 29 03:21:19 2013 +0200 +++ b/MM7.h Wed May 29 19:55:25 2013 +0100 @@ -23,7 +23,7 @@ #define PID(type, id) (unsigned int)((((8 * (id))) | (type)) & 0xFFFF) // packed id #define PID_TYPE(pid) (unsigned int)((pid) & 7) // extract type #define PID_ID(pid) (unsigned int)(((pid) & 0xFFFF) >> 3) // extract value - +inline int round(float x) { return (floor(x + 0.5)); } typedef unsigned __int16 _WORD; typedef unsigned __int64 _QWORD;
--- a/Render.cpp Wed May 29 03:21:19 2013 +0200 +++ b/Render.cpp Wed May 29 19:55:25 2013 +0100 @@ -7162,7 +7162,7 @@ //----- (004A2031) -------------------------------------------------------- unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) { - __debugbreak(); // should not fire outside decal builder +// __debugbreak(); // should not fire outside decal builder return ::GetActorTintColor(tint, a4, a2, a5, a6); }
--- a/mm7_3.cpp Wed May 29 03:21:19 2013 +0200 +++ b/mm7_3.cpp Wed May 29 19:55:25 2013 +0100 @@ -4384,96 +4384,60 @@ //----- (0047802A) -------------------------------------------------------- int stru6_stru1_indoor_sw_billboard::sub_47802A() { - int v1; // edx@1 - stru6_stru1_indoor_sw_billboard *v2; // edi@1 - int v3; // ebx@2 - char *v4; // esi@3 - float v5; // eax@4 double v6; // st7@4 - double v7; // ST30_8@5 - double v8; // st6@6 - double v9; // st5@6 - char *v10; // ecx@15 - float v11; // eax@16 double v12; // st7@16 - double v13; // st6@16 - double v14; // st5@16 signed int v16; // [sp+38h] [bp-Ch]@1 int a6; // [sp+3Ch] [bp-8h]@5 int a5; // [sp+40h] [bp-4h]@5 auto a1 = this; - v1 = 0; - v2 = a1; v16 = 0; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { - v3 = 0; - if ( a1->field_10 > 0 ) - { - v4 = (char *)&a1->field_14[42]; - do - { - LODWORD(v5) = *((int *)v4 - 2); - v6 = (double)pBLVRenderParams->field_40 * 0.000015258789 / *((float *)v4 - 2); - if ( pRenderer->pRenderD3D ) - { - v7 = v5 + 6.7553994e15; - pGame->pIndoorCameraD3D->Project( - COERCE_UNSIGNED_INT64(v5 + 6.7553994e15), - COERCE_UNSIGNED_INT64(*((float *)v4 - 1) + 6.7553994e15), - COERCE_UNSIGNED_INT64(*(float *)v4 + 6.7553994e15), - &a5, - &a6); - *((float *)v4 + 18) = (double)a5; - *((float *)v4 + 19) = (double)a6; - *((float *)v4 + 20) = (double)SLODWORD(v7); - } - else - { - *((float *)v4 + 18) = (double)pBLVRenderParams->uViewportCenterX - v6 * *((float *)v4 - 1); - v8 = (double)pBLVRenderParams->uViewportCenterY; - v9 = v6 * *(float *)v4; - *((int *)v4 + 20) = LODWORD(v5); - *((float *)v4 + 19) = v8 - v9; - } - *((int *)v4 + 21) = *((int *)v4 + 1); - if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v4 + 18) - && (double)(signed int)pViewport->uViewportBR_X > *((float *)v4 + 18) - && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v4 + 19) - && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v4 + 19) ) - v16 = 1; - ++v3; - v4 += 16; - } - while ( v3 < v2->field_10 ); - } - } - else - { - if ( a1->field_10 > 0 ) - { - v10 = (char *)&a1->field_14[40]; - do - { - LODWORD(v11) = *(int *)v10; - v12 = (double)pOutdoorCamera->int_fov_rad / *(float *)v10; - *((float *)v10 + 20) = (double)pViewport->uScreenCenterX - v12 * *((float *)v10 + 1); - v13 = (double)pViewport->uScreenCenterY; - v14 = v12 * *((float *)v10 + 2); - *((int *)v10 + 22) = LODWORD(v11); - *((int *)v10 + 23) = *((int *)v10 + 3); - *((float *)v10 + 21) = v13 - v14; - if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v10 + 20) - && (double)(signed int)pViewport->uViewportBR_X > *((float *)v10 + 20) - && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v10 + 21) - && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v10 + 21) ) - v16 = 1; - ++v1; - v10 += 16; - } - while ( v1 < v2->field_10 ); + for(int i = 0; i < a1->field_10; i++) + { + v6 = (double)pBLVRenderParams->field_40 * 0.000015258789 / a1->field_B4[i*4]; + if ( pRenderer->pRenderD3D ) + { + pGame->pIndoorCameraD3D->Project( + round(a1->field_B4[i*4]), + round(a1->field_B4[i*4+1]), + round(a1->field_B4[i*4+2]), + &a5, + &a6); + a1->field_B4[i*4+16] = (double)a5; + a1->field_B4[i*4+17] = (double)a6; + a1->field_B4[i*4+18] = round(a1->field_B4[i*4]); + } + else + { + a1->field_B4[i*4+16] = (double)pBLVRenderParams->uViewportCenterX - v6 * a1->field_B4[i*4+1]; + a1->field_B4[i*4+17] = (double)pBLVRenderParams->uViewportCenterY - v6 * a1->field_B4[i*4+2]; + a1->field_B4[i*4+18] = a1->field_B4[i*4]; + } + a1->field_B4[i*4+19] = a1->field_B4[i*4+3]; + if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+16] + && (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+16] + && (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+17] + && (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+17] ) + v16 = 1; + } + } + else + { + for(int i = 0; i < a1->field_10; i++) + { + v12 = (double)pOutdoorCamera->int_fov_rad / a1->field_B4[i*4]; + a1->field_B4[i*4+20] = (double)pViewport->uScreenCenterX - v12 * a1->field_B4[i*4+1]; + a1->field_B4[i*4+21] = (double)pViewport->uScreenCenterY - v12 * a1->field_B4[i*4+2]; + *((int *)&a1->field_B4[i*4+22]) = (int)a1->field_B4[i*4]; + *((int *)&a1->field_B4[i*4+23]) = a1->field_B4[i*4+3]; + if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+20] + && (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+20] + && (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+21] + && (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+21] ) + v16 = 1; } } return v16;