# HG changeset patch # User Nomad # Date 1379419841 -7200 # Node ID 2c71fa8913d2b2b929b2e1243b8f96a9ea5bd0c2 # Parent 384a6b9d133346bc52d68796bbe1281648e01bdf class OutdoorCamera -> ODMRenderParams diff -r 384a6b9d1333 -r 2c71fa8913d2 DecalBuilder.cpp --- a/DecalBuilder.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/DecalBuilder.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -686,10 +686,10 @@ float v15; if (fabs(z_bias) < 1e-5) - v15 = 1.0 - 1.0 / ((1.0f / get_shading_dist_mist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0); + v15 = 1.0 - 1.0 / ((1.0f / pGame->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0); else { - v15 = 1.0 - 1.0 / ((1.0f / get_shading_dist_mist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias; + v15 = 1.0 - 1.0 / ((1.0f / pGame->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias; if (v15 < 0.000099999997) v15 = 0.000099999997; } diff -r 384a6b9d1333 -r 2c71fa8913d2 Indoor.h --- a/Indoor.h Tue Sep 17 12:40:37 2013 +0200 +++ b/Indoor.h Tue Sep 17 14:10:41 2013 +0200 @@ -550,8 +550,7 @@ int field_94; }; #pragma pack(pop) - -extern struct BLVRenderParams *pBLVRenderParams; +extern BLVRenderParams *pBLVRenderParams; diff -r 384a6b9d1333 -r 2c71fa8913d2 IndoorCamera.cpp --- a/IndoorCamera.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/IndoorCamera.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -9,7 +9,7 @@ - +/* IndoorCamera *pIndoorCamera; // idb @@ -109,4 +109,5 @@ _int_sine_2 = stru_5C6E00->Sin(sRotationX); _int_cosine_2 = stru_5C6E00->Cos(sRotationX); } -// 4D864C: using guessed type char byte_4D864C; \ No newline at end of file +// 4D864C: using guessed type char byte_4D864C; +*/ \ No newline at end of file diff -r 384a6b9d1333 -r 2c71fa8913d2 IndoorCamera.h --- a/IndoorCamera.h Tue Sep 17 12:40:37 2013 +0200 +++ b/IndoorCamera.h Tue Sep 17 14:10:41 2013 +0200 @@ -5,8 +5,8 @@ #define INDOOR_CAMERA_DRAW_SW_OUTLINES 1 #define INDOOR_CAMERA_DRAW_D3D_OUTLINES 2 #define INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES 4 -/* 157 */ -#pragma pack(push, 1) +// 157 +/*#pragma pack(push, 1) struct IndoorCamera { //----- (0042391F) -------------------------------------------------------- @@ -47,4 +47,4 @@ -extern IndoorCamera *pIndoorCamera; // idb \ No newline at end of file +extern IndoorCamera *pIndoorCamera; // idb*/ \ No newline at end of file diff -r 384a6b9d1333 -r 2c71fa8913d2 IndoorCameraD3D.cpp --- a/IndoorCameraD3D.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/IndoorCameraD3D.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -4,7 +4,7 @@ #include "Indoor.h" #include "Viewport.h" #include "IndoorCamera.h" -#include "OutdoorCamera.h" +#include "Outdoor_stuff.h" #include "Render.h" #include "LOD.h" #include "mm7_data.h" @@ -100,12 +100,20 @@ //----- (0043643E) -------------------------------------------------------- float IndoorCameraD3D::GetPickDepth() { - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - return pOutdoorCamera->uPickDepth; + if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) + return pODMRenderParams->uPickDepth; else return 16192.0; } +//----- (00436427) -------------------------------------------------------- +float IndoorCameraD3D::GetShadingDistMist() +{ + if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) + return (double)pODMRenderParams->shading_dist_mist; + else + return 16192.0; +} //----- (004364C5) -------------------------------------------------------- void IndoorCameraD3D::ViewTransfrom_OffsetUV(RenderVertexSoft *pVertices, unsigned int uNumVertices, RenderVertexSoft *pOutVertices, stru320 *a5) @@ -1191,7 +1199,7 @@ { *(float *)v7 = 1.0 / (*((float *)v7 - 5) + 0.0000001); memcpy(pOutVertices_ - 28, v7 - 32, 0x30u); - v9 = (double)pOutdoorCamera->int_fov_rad * *(float *)&v7[v8]; + v9 = (double)pODMRenderParams->int_fov_rad * *(float *)&v7[v8]; v10 = (double)pViewport->uScreenCenterX - v9 * *((float *)v7 - 4); v7 += 48; *((float *)pOutVertices_ - 1) = v10; @@ -1230,7 +1238,7 @@ if ( uNumInVertices ) { memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices])); - v6 = (double)pOutdoorCamera->shading_dist_mist; + v6 = (double)pODMRenderParams->shading_dist_mist; v7 = 0; if ( v6 >= pInVertices->vWorldViewPosition.x ) v7 = 1; diff -r 384a6b9d1333 -r 2c71fa8913d2 IndoorCameraD3D.h --- a/IndoorCameraD3D.h Tue Sep 17 12:40:37 2013 +0200 +++ b/IndoorCameraD3D.h Tue Sep 17 14:10:41 2013 +0200 @@ -158,6 +158,7 @@ void ViewTransfrom_OffsetUV(struct RenderVertexSoft *pVertices, unsigned int uNumVertices, struct RenderVertexSoft *pOutVertices, struct stru320 *a5); char ApplyViewTransform_TrueIfStillVisible(int x, int y, int z, signed int *pOutX, int *pOutZ, int *pOutY, char bDoNotShow); float GetPickDepth(); + float GetShadingDistMist(); void DebugDrawPortal(struct BLVFace *pFace); diff -r 384a6b9d1333 -r 2c71fa8913d2 LightmapBuilder.cpp --- a/LightmapBuilder.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/LightmapBuilder.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -6,7 +6,6 @@ #include "Log.h" #include "ErrorHandling.h" -#include "OutdoorCamera.h" #include "Lights.h" #include "mm7_data.h" @@ -1312,223 +1311,6 @@ ++*v53; return 1; } -// 4E94D2: using guessed type char _4E94D2_light_type; - -//----- (0045D3C7) -------------------------------------------------------- -bool LightmapBuilder::_45D3C7(struct Polygon *a1) -{ - LightmapBuilder *v2; // ebx@1 - struct Polygon *result; // eax@1 - float v4; // ecx@2 - Span *i; // edi@5 - - v2 = this; - result = (struct Polygon *)a1->prolly_head; - if ( result && (v4 = result->field_4, *(int *)&v4) != 0 && *(unsigned int *)(LODWORD(v4) + 60) ) - { - for ( i = a1->prolly_head; ; i = i->pNext ) - { - result = i->pParent; - if ( result->field_108 ) - result = (struct Polygon *)_45D426( - i, - a1->pEdgeList1, - a1->uEdgeList1Size, - (Edge *)a1->pEdgeList2, - a1->uEdgeList2Size); - if ( a1->prolly_tail == i ) - break; - } - LOBYTE(result) = 1; - } - else - { - LOBYTE(result) = 0; - } - return (bool)result; -} - -//----- (0045D426) -------------------------------------------------------- -int LightmapBuilder::_45D426(Span *a1, Edge **a2, unsigned int a3, Edge *a4, int a5) -{ - int v6; // edi@1 - signed int v7; // ebx@3 - signed int v8; // ecx@3 - Span *v9; // esi@3 - double v10; // st7@4 - Edge *v11; // edx@5 - double v12; // st7@11 - int v13; // edx@12 - int v14; // ebx@17 - Edge *v15; // edi@17 - float v16; // ST04_4@17 - float v17; // ST04_4@17 - double v18; // st7@17 - int result; // eax@19 - //double v20; // ST14_8@20 - //double v21; // ST14_8@20 - double v22; // st7@20 - int v23; // ecx@20 - double v24; // st6@20 - double v25; // st7@23 - double v26; // st7@28 - __int16 v27; // fps@28 - char v28; // c0@28 - char v29; // c2@28 - char v30; // c3@28 - double v31; // st7@29 - double v32; // st7@30 - __int16 v33; // fps@30 - char v34; // c0@30 - char v35; // c2@30 - char v36; // c3@30 - LightmapBuilder *this_4; // [sp+14h] [bp-8h]@1 - signed int v38; // [sp+18h] [bp-4h]@3 - float a1a; // [sp+24h] [bp+8h]@20 - float a2a; // [sp+28h] [bp+Ch]@17 - float a3a; // [sp+2Ch] [bp+10h]@17 - float a5a; // [sp+34h] [bp+18h]@20 - float a5b; // [sp+34h] [bp+18h]@20 - - v6 = 0; - this_4 = this; - if ( a5 && a3 ) - { - v7 = -1; - v8 = 0; - v9 = a1; - v38 = -1; - if ( (signed int)a3 > 0 ) - { - v10 = (double)a1->field_A; - while ( 1 ) - { - v11 = a2[v8]; - if ( v10 >= v11->field_2C ) - { - if ( v10 <= v11->field_30 ) - break; - } - ++v8; - if ( v8 >= (signed int)a3 ) - goto LABEL_10; - } - v38 = v8; - } -LABEL_10: - if ( a5 > 0 ) - { - v12 = (double)a1->field_A; - while ( 1 ) - { - v13 = *((unsigned int *)&a4->field_0 + v6); - if ( v12 >= *(float *)(v13 + 44) ) - { - if ( v12 <= *(float *)(v13 + 48) ) - break; - } - ++v6; - if ( v6 >= a5 ) - goto LABEL_17; - } - v7 = v6; - } -LABEL_17: - v14 = *((unsigned int *)&a4->field_0 + v7); - v15 = a2[v38]; - v16 = (double)a1->field_A; - a3a = _45D643(a2[v38], v16); - v17 = (double)a1->field_A; - v18 = _45D643((Edge *)v14, v17); - a2a = v18; - if ( byte_4D864C && BYTE1(pGame->uFlags) & 0x80 ) - { - HIWORD(result) = HIWORD(a3a); - a1->field_14 = v18; - a1->field_10 = a3a; - } - else - { - a5a = ((double)a1->field_A - v15->field_2C) * v15->field_4 + v15->field_24 - 0.5; - //v20 = a5a + 6.7553994e15; - //a5b = (double)SLODWORD(v20); - a5b = (double)floorf(a5a + 0.5f); - a1a = ((double)a1->field_A - *(float *)(v14 + 44)) * *(float *)(v14 + 4) + *(float *)(v14 + 36) + 0.5; - //v21 = a1a + 6.7553994e15; - //v22 = (double)SLODWORD(v21); - v22 = (double)floorf(a1a + 0.5f); - result = v9->field_8; - v23 = v9->field_C; - v24 = -((a3a - a2a) / (v22 - a5b)); - v9->field_10 = ((double)result - a5b) * v24 + a3a; - v9->field_14 = a2a - (v22 - (double)(result + v23)) * v24; - } - if ( v9->field_10 < 0.0 || v9->field_10 <= 1.0 ) - { - if ( v9->field_10 >= 0.0 ) - v25 = v9->field_10; - else - v25 = 0.0; - } - else - { - v25 = 1.0; - } - v9->field_10 = v25; - __debugbreak(); // warning C4700: uninitialized local variable 'v27' used - if ( v9->field_14 < 0.0 - || (v26 = v9->field_14, - //UNDEF(v27), - v28 = 1.0 < v26, - v29 = 0, - v30 = 1.0 == v26, - BYTE1(result) = HIBYTE(v27), - v26 <= 1.0) ) - { - v32 = v9->field_14; - //UNDEF(v33); - v34 = 0.0 < v32; - v35 = 0; - v36 = 0.0 == v32; - __debugbreak(); // warning C4700: uninitialized local variable 'v33' used - BYTE1(result) = HIBYTE(v33); - if ( v32 >= 0.0 ) - v31 = v9->field_14; - else - v31 = 0.0; - } - else - { - v31 = 1.0; - } - v9->field_14 = v31; - LOBYTE(result) = 1; - } - else - { - LOBYTE(result) = 0; - } - return result; -} -// 4D864C: using guessed type char byte_4D864C; - -//----- (0045D643) -------------------------------------------------------- -double LightmapBuilder::_45D643(Edge *a1, float a2) -{ - double result; // st7@1 - - result = (a1->field_1C - a1->field_20) * -1.0 / (a1->field_30 - a1->field_2C) * (a2 - a1->field_2C) + a1->field_1C; - if ( result < 0.0 || result <= 1.0 ) - { - if ( result < 0.0 ) - result = 0.0; - } - else - { - result = 1.0; - } - return result; -} //----- (0045D698) -------------------------------------------------------- bool LightmapBuilder::DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2) @@ -1741,7 +1523,7 @@ uint uLightmapColor = uLightmapColorB | (uLightmapColorMaskG << 8) | (uLightmapColorMaskR << 16); if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - v10 = (double)pOutdoorCamera->shading_dist_mist; + v10 = (double)pODMRenderParams->shading_dist_mist; else v10 = 16192.0; v14 = 1.0 / v10; diff -r 384a6b9d1333 -r 2c71fa8913d2 LightmapBuilder.h --- a/LightmapBuilder.h Tue Sep 17 12:40:37 2013 +0200 +++ b/LightmapBuilder.h Tue Sep 17 14:10:41 2013 +0200 @@ -41,9 +41,9 @@ bool DrawLightmaps(int *indices = nullptr); void DrawLightmapsType(int type); bool DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2); - double _45D643(struct Edge *a1, float a2); - int _45D426(struct Span *a1, struct Edge **a2, unsigned int a3, struct Edge *a4, int a5); - bool _45D3C7(struct Polygon *a1); + double _45D643_sw(struct Edge *a1, float a2); + //int _45D426_sw(struct Span *a1, struct Edge **a2, unsigned int a3, struct Edge *a4, int a5); + //bool _45D3C7_sw(struct Polygon *a1); bool StackLight_TerrainFace(struct StationaryLight *pLight, struct Vec3_float_ *pNormal, float *a3, struct RenderVertexSoft *a1, unsigned int uStripType, int X, unsigned int *pSlot); bool StackLights_TerrainFace(struct Vec3_float_ *pNormal, float *a3, struct RenderVertexSoft *a1, unsigned int uStripType, bool bLightBackfaces); bool ApplyLight_ODM(struct StationaryLight *pLight, struct ODMFace *pFace, unsigned int *pSlot, char a4); diff -r 384a6b9d1333 -r 2c71fa8913d2 Outdoor.cpp --- a/Outdoor.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/Outdoor.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -33,7 +33,6 @@ #include "MapInfo.h" -#include "OutdoorCamera.h" #include "Outdoor_stuff.h" #include "BSPModel.h" #include "GUIWindow.h" @@ -41,15 +40,11 @@ MapStartPoint uLevel_StartingPointType; // weak OutdoorLocation *pOutdoor = new OutdoorLocation; -OutdoorCamera *pOutdoorCamera; +ODMRenderParams *pODMRenderParams; stru149 stru_8019C8; std::array array_77EC08; -Surf stru_80C980; -Edge defaultEdge; // weak -Edge stru_80C9A4; -Edge stru_80C9D8; struct FogProbabilityTableEntry @@ -105,8 +100,8 @@ pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel; if (bRedraw || pRenderer->pRenderD3D) { - pOutdoorCamera->RotationToInts(); - sub_481ED9_MessWithOutdoorCamera(); + pODMRenderParams->RotationToInts(); + sub_481ED9_MessWithODMRenderParams(); } pIndoorCamera->uMapGridCellX = WorldPosToGridCellX(pParty->vPosition.x); @@ -138,7 +133,7 @@ pRenderer->DrawBuildingsSW(); pRenderer->DrawBezierTerrain(); sr_sub_486F92_MessWithEdgesAndSpans(); - pOutdoorCamera->_487355(); + pODMRenderParams->ApplyLightmapsSW(); }*/ } @@ -170,7 +165,7 @@ uNumBillboardsToDraw = 0; PrepareActorsDrawList(); - if (!pOutdoorCamera->bDoNotRenderDecorations) + if (!pODMRenderParams->bDoNotRenderDecorations) pRenderer->PrepareDecorationsRenderList_ODM(); pRenderer->DrawSpriteObjects_ODM(); @@ -3018,34 +3013,34 @@ if ( pIndoorCamera->sRotationX ) { v18 = (y - pIndoorCamera->pos.y) << 16; - v47 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - + ((unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - v50 = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - v53 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; + v47 = ((unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) + + ((unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); + v50 = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + v53 = (unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; v44 = (z - pIndoorCamera->pos.z) << 16; - v19 = ((unsigned __int64)(v44 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16) - + ((unsigned __int64)(v47 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16); - X = ((unsigned __int64)(v44 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16) - + ((unsigned __int64)(v47 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16); - if ( v19 < 262144 || v19 > pOutdoorCamera->shading_dist_mist << 16 ) + v19 = ((unsigned __int64)(v44 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16) + + ((unsigned __int64)(v47 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16); + X = ((unsigned __int64)(v44 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16) + + ((unsigned __int64)(v47 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16); + if ( v19 < 262144 || v19 > pODMRenderParams->shading_dist_mist << 16 ) continue; v20 = v53 - v50; v42 = v53 - v50; - v21 = ((unsigned __int64)(v44 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - - ((unsigned __int64)(v47 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); + v21 = ((unsigned __int64)(v44 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16) + - ((unsigned __int64)(v47 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); } else { v48 = (y - pIndoorCamera->pos.y) << 16; - v51 = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - v22 = (unsigned __int64)(v48 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; + v51 = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; + v22 = (unsigned __int64)(v48 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; X = v22 + v51; - if ( v22 + v51 < 262144 || v22 + v51 > pOutdoorCamera->shading_dist_mist << 16 ) + if ( v22 + v51 < 262144 || v22 + v51 > pODMRenderParams->shading_dist_mist << 16 ) continue; v23 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) - * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - v20 = ((unsigned __int64)(v48 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v23; - v42 = ((unsigned __int64)(v48 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v23; + * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + v20 = ((unsigned __int64)(v48 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v23; + v42 = ((unsigned __int64)(v48 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v23; v21 = (z - pIndoorCamera->pos.z) << 16; } v45 = v21; @@ -3053,11 +3048,11 @@ if ( abs(X) >= v24 ) { LODWORD(v25) = 0; - HIDWORD(v25) = SLOWORD(pOutdoorCamera->int_fov_rad); + HIDWORD(v25) = SLOWORD(pODMRenderParams->int_fov_rad); v58 = v25 / X; v26 = v25 / X; LODWORD(v25) = 0; - HIDWORD(v25) = SLOWORD(pOutdoorCamera->int_fov_rad); + HIDWORD(v25) = SLOWORD(pODMRenderParams->int_fov_rad); v57 = v25 / X; v27 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v26 * (signed __int64)v42) >> 16) + 32768) >> 16); @@ -3605,3 +3600,70 @@ pOMAP = 0; } + + + +//----- (00481E55) -------------------------------------------------------- +void ODM_Project(unsigned int uNumVertices) +{ + double v1; // st7@2 + double v2; // st6@2 + double v3; // st5@2 + int v4; // eax@2 + unsigned int v5; // edx@2 + double v6; // st4@3 + double v7; // st3@3 + + if ( (signed int)uNumVertices > 0 ) + { + v1 = (double)pODMRenderParams->int_fov_rad; + v2 = (double)pViewport->uScreenCenterX; + v3 = (double)pViewport->uScreenCenterY; + v4 = 0; + v5 = uNumVertices; + do + { + v6 = v1 * array_507D30[v4]._rhw; + v7 = v6 * array_507D30[v4].vWorldViewPosition.y; + memcpy(&array_50AC10[v4], &array_507D30[v4], sizeof(array_50AC10[v4])); + array_50AC10[v4].vWorldViewProjX = v2 - v7; + array_50AC10[v4].vWorldViewProjY = v3 - v6 * array_507D30[v4].vWorldViewPosition.z; + ++v4; + --v5; + } + while ( v5 ); + } +} +//----- (00485F64) -------------------------------------------------------- +void ODMRenderParams::Initialize() +{ + int v1; // eax@1 + int v2; // eax@2 + signed __int64 v3; // qtt@4 + int v4; // eax@4 + + this->uCameraFovInDegrees = 75; + v1 = stru_5C6E00->uPiMask & 0xD5; + if ( v1 >= (signed int)stru_5C6E00->uIntegerHalfPi ) + v2 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v1]; + else + v2 = stru_5C6E00->pTanTable[v1]; + LODWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 31; + HIDWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 15 >> 16; + v4 = (signed int)(v3 / v2) >> 16; + this->int_fov_rad = v4; + this->field_4C = 360000; + this->int_fov_rad_inv = 65536 / v4; + this->field_50 = 115; + //sr_6BE060[1] = 1; + RotationToInts(); +} + +//----- (0048600E) -------------------------------------------------------- +void ODMRenderParams::RotationToInts() +{ + camera_rotation_y_int_sine = stru_5C6E00->Sin(rotation_y); + camera_rotation_y_int_cosine = stru_5C6E00->Cos(rotation_y); + camera_rotation_x_int_sine = stru_5C6E00->Sin(rotation_x); + camera_rotation_x_int_cosine = stru_5C6E00->Cos(rotation_x); +} \ No newline at end of file diff -r 384a6b9d1333 -r 2c71fa8913d2 OutdoorCamera.cpp --- a/OutdoorCamera.cpp Tue Sep 17 12:40:37 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -#include "OutdoorCamera.h" -#include "IndoorCamera.h" -#include "Outdoor_stuff.h" -#include "Game.h" -#include "LightmapBuilder.h" -#include "Viewport.h" -#include "Math.h" -#include "mm7_data.h" - -//----- (00481E55) -------------------------------------------------------- -void OutdoorCamera::Project(unsigned int uNumVertices) -{ - double v1; // st7@2 - double v2; // st6@2 - double v3; // st5@2 - int v4; // eax@2 - unsigned int v5; // edx@2 - double v6; // st4@3 - double v7; // st3@3 - - if ( (signed int)uNumVertices > 0 ) - { - v1 = (double)pOutdoorCamera->int_fov_rad; - v2 = (double)pViewport->uScreenCenterX; - v3 = (double)pViewport->uScreenCenterY; - v4 = 0; - v5 = uNumVertices; - do - { - v6 = v1 * array_507D30[v4]._rhw; - v7 = v6 * array_507D30[v4].vWorldViewPosition.y; - memcpy(&array_50AC10[v4], &array_507D30[v4], sizeof(array_50AC10[v4])); - array_50AC10[v4].vWorldViewProjX = v2 - v7; - array_50AC10[v4].vWorldViewProjY = v3 - v6 * array_507D30[v4].vWorldViewPosition.z; - ++v4; - --v5; - } - while ( v5 ); - } -} -//----- (00485F64) -------------------------------------------------------- -void OutdoorCamera::_485F64() -{ - int v1; // eax@1 - int v2; // eax@2 - signed __int64 v3; // qtt@4 - int v4; // eax@4 - - this->uCameraFovInDegrees = 75; - v1 = stru_5C6E00->uPiMask & 0xD5; - if ( v1 >= (signed int)stru_5C6E00->uIntegerHalfPi ) - v2 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v1]; - else - v2 = stru_5C6E00->pTanTable[v1]; - LODWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 31; - HIDWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 15 >> 16; - v4 = (signed int)(v3 / v2) >> 16; - this->int_fov_rad = v4; - this->field_4C = 360000; - this->int_fov_rad_inv = 65536 / v4; - this->field_50 = 115; - //sr_6BE060[1] = 1; - RotationToInts(); -} - -//----- (0048600E) -------------------------------------------------------- -void OutdoorCamera::RotationToInts() -{ - camera_rotation_y_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationY); - camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationY); - camera_rotation_x_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationX); - camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationX); -} \ No newline at end of file diff -r 384a6b9d1333 -r 2c71fa8913d2 OutdoorCamera.h --- a/OutdoorCamera.h Tue Sep 17 12:40:37 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -#pragma once - - -/* 88 */ -#pragma pack(push, 1) -struct OutdoorCamera -{ - //----- (00462684) -------------------------------------------------------- - OutdoorCamera() - { - uPickDepth = 0; - this->shading_dist_shade = 2048; - shading_dist_shademist = 4096; - shading_dist_mist = 8192; - int_fov_rad = 0; - this->bNoSky = 0; - this->bDoNotRenderDecorations = 0; - this->field_5C = 0; - this->field_60 = 0; - this->outdoor_no_wavy_water = 0; - this->outdoor_no_mist = 0; - } - - void _485F64(); - void RotationToInts(); - //void AllocSoftwareDrawBuffers(); - //void ReleaseSoftwareDrawBuffers(); - - static void Project(unsigned int uNumVertices); - //static bool _487355(); - - - - - int uPickDepth; - int shading_dist_shade; - int shading_dist_shademist; - int shading_dist_mist; - unsigned int uCameraFovInDegrees; - int int_fov_rad; - int int_fov_rad_inv; - int camera_rotation_y_int_sine; - int camera_rotation_y_int_cosine; - int camera_rotation_x_int_sine; - int camera_rotation_x_int_cosine; - int uNumPolygons; - unsigned int uNumEdges; - unsigned int uNumSurfs; - unsigned int uNumSpans; - unsigned int uNumBillboards; - float field_40; - int field_44; - int outdoor_grid_band_3; - int field_4C; - int field_50; - unsigned int bNoSky; - unsigned int bDoNotRenderDecorations; - int field_5C; - int field_60; - int outdoor_no_wavy_water; - int outdoor_no_mist; - int building_gamme; - int terrain_gamma; -}; -#pragma pack(pop) - - - - -extern struct OutdoorCamera *pOutdoorCamera; \ No newline at end of file diff -r 384a6b9d1333 -r 2c71fa8913d2 Outdoor_stuff.h --- a/Outdoor_stuff.h Tue Sep 17 12:40:37 2013 +0200 +++ b/Outdoor_stuff.h Tue Sep 17 14:10:41 2013 +0200 @@ -89,72 +89,67 @@ -/* 143 */ + + +/* 88 */ #pragma pack(push, 1) -struct Span +struct ODMRenderParams { - Span *pNext; - struct Polygon *pParent; - __int16 field_8; - __int16 field_A; - __int16 field_C; - __int16 field_E; - float field_10; - float field_14; + //----- (00462684) -------------------------------------------------------- + ODMRenderParams() + { + uPickDepth = 0; + this->shading_dist_shade = 2048; + shading_dist_shademist = 4096; + shading_dist_mist = 8192; + int_fov_rad = 0; + this->bNoSky = 0; + this->bDoNotRenderDecorations = 0; + this->field_5C = 0; + this->field_60 = 0; + this->outdoor_no_wavy_water = 0; + this->outdoor_no_mist = 0; + } + + void Initialize(); + void RotationToInts(); + + int uPickDepth; + int shading_dist_shade; + int shading_dist_shademist; + int shading_dist_mist; + unsigned int uCameraFovInDegrees; + int int_fov_rad; + int int_fov_rad_inv; + int camera_rotation_y_int_sine; + int camera_rotation_y_int_cosine; + int camera_rotation_x_int_sine; + int camera_rotation_x_int_cosine; + int uNumPolygons; + unsigned int uNumEdges; + unsigned int uNumSurfs; + unsigned int uNumSpans; + unsigned int uNumBillboards; + float field_40; + int field_44; + int outdoor_grid_band_3; + int field_4C; + int field_50; + unsigned int bNoSky; + unsigned int bDoNotRenderDecorations; + int field_5C; + int field_60; + int outdoor_no_wavy_water; + int outdoor_no_mist; + int building_gamme; + int terrain_gamma; + + int rotation_y; // moved from 157 struct IndoorCamera + int rotation_x; }; #pragma pack(pop) +extern ODMRenderParams *pODMRenderParams; -/* 144 */ -#pragma pack(push, 1) -struct Surf -{ - float field_0; - float field_4; - float field_8; - float field_C; - float field_10; - Surf *pNext; - Surf *pPrev; - struct Polygon *pParent; - __int16 field_20; - __int16 field_22; -}; -#pragma pack(pop) -extern Surf stru_80C980; - - - - -/* 145 */ -#pragma pack(push, 1) -struct Edge -{ - float field_0; - float field_4; - int field_8; - Surf *pSurf; - Edge *pNext; - Edge *pPrev; - Edge *ptr_18; - float field_1C; - float field_20; - float field_24; - float field_28; - float field_2C; - float field_30; -}; -#pragma pack(pop) -extern Edge defaultEdge; // weak - -extern Edge stru_80C9A4; -extern Edge stru_80C9D8; - - - - - - - - +void ODM_Project(unsigned int uNumVertices); \ No newline at end of file diff -r 384a6b9d1333 -r 2c71fa8913d2 ParticleEngine.cpp --- a/ParticleEngine.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/ParticleEngine.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -5,11 +5,11 @@ #include "Outdoor.h" #include "Game.h" #include "IndoorCamera.h" +#include "Outdoor_stuff.h" #include "Math.h" #include "LOD.h" #include "Sprites.h" -#include "OutdoorCamera.h" #include "mm7_data.h" TrailParticleGenerator trail_particle_generator; @@ -534,7 +534,7 @@ //uIDd = (LODWORD(v12) - pIndoorCamera->pos.z) << 16; auto _hidword_v12 = fixpoint_sub0(v11, v3) + fixpoint_mul(v6->z - pIndoorCamera->pos.z, v44); LODWORD(v13) = 0; - HIDWORD(v13) = SLOWORD(pOutdoorCamera->int_fov_rad); + HIDWORD(v13) = SLOWORD(pODMRenderParams->int_fov_rad); //v14 = v13 / _hidword_v12; v6->_screenspace_scale = v13 / _hidword_v12; //v15 = v6->_screenspace_scale; @@ -569,7 +569,7 @@ //v20 = (LODWORD(v19) - pIndoorCamera->pos.y) << 16; //v21 = v6->_z + 6.7553994e15; LODWORD(v22) = 0; - HIDWORD(v22) = SLOWORD(pOutdoorCamera->int_fov_rad); + HIDWORD(v22) = SLOWORD(pODMRenderParams->int_fov_rad); auto _var_123 = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v4) + fixpoint_mul(v6->y - pIndoorCamera->pos.y, v5); //v23 = v22 / _var_123; v6->_screenspace_scale = v22 / _var_123; @@ -586,7 +586,7 @@ v26 = fixpoint_mul(v6->y - pIndoorCamera->pos.y, v5); //v27 = v26 + ((unsigned __int64)(uIDb * (signed __int64)v4) >> 16); X_4 = v26 + fixpoint_mul(v6->x - pIndoorCamera->pos.x, v4); - if ( X_4 < 0x40000 || X_4 > (pOutdoorCamera->uPickDepth - 1000) << 16 ) + if ( X_4 < 0x40000 || X_4 > (pODMRenderParams->uPickDepth - 1000) << 16 ) return 0; v17 = v6->z; v16 = fixpoint_mul(v6->y - pIndoorCamera->pos.y, v4) - fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5); @@ -596,7 +596,7 @@ if ( abs(X_4) >= v28 ) { LODWORD(v29) = 0; - HIDWORD(v29) = SLOWORD(pOutdoorCamera->int_fov_rad); + HIDWORD(v29) = SLOWORD(pODMRenderParams->int_fov_rad); //v30 = v29 / X_4; v6->_screenspace_scale = v29 / X_4; //v31 = v6->_screenspace_scale; @@ -779,7 +779,7 @@ { pLines.pLineVertices[2 * pLines.uNumLines].pos.x = particle->uScreenSpaceX; pLines.pLineVertices[2 * pLines.uNumLines].pos.y = particle->uScreenSpaceY; - pLines.pLineVertices[2 * pLines.uNumLines].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pLines.pLineVertices[2 * pLines.uNumLines].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); pLines.pLineVertices[2 * pLines.uNumLines].rhw = 1.0; pLines.pLineVertices[2 * pLines.uNumLines].diffuse = particle->uLightColor_bgr; pLines.pLineVertices[2 * pLines.uNumLines].specular = 0; @@ -788,7 +788,7 @@ pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.x = particle->uScreenSpaceZ; pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.y = particle->uScreenSpaceW; - pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); pLines.pLineVertices[2 * pLines.uNumLines + 1].rhw = 1.0; pLines.pLineVertices[2 * pLines.uNumLines + 1].diffuse = particle->uLightColor_bgr; pLines.pLineVertices[2 * pLines.uNumLines + 1].specular = 0; diff -r 384a6b9d1333 -r 2c71fa8913d2 Render.cpp --- a/Render.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/Render.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -12,7 +12,6 @@ #include "DecalBuilder.h" #include "ParticleEngine.h" #include "Render.h" -#include "OutdoorCamera.h" #include "IndoorCamera.h" #include "Outdoor.h" #include "Party.h" @@ -145,7 +144,7 @@ soft_billboard.uViewportZ = pBLVRenderParams->uViewportZ - 1; soft_billboard.uViewportW = pBLVRenderParams->uViewportW; - pOutdoorCamera->uNumBillboards = ::uNumBillboardsToDraw; + pODMRenderParams->uNumBillboards = ::uNumBillboardsToDraw; for (uint i = 0; i < ::uNumBillboardsToDraw; ++i) { auto p = pBillboardRenderList + i; @@ -251,7 +250,7 @@ { for (unsigned int x = 0; x < 127; ++x) { - pTilePolygon = &array_77EC08[pOutdoorCamera->uNumPolygons]; + pTilePolygon = &array_77EC08[pODMRenderParams->uNumPolygons]; pTilePolygon->flags = 0; pTilePolygon->field_32 = 0; pTilePolygon->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); @@ -305,9 +304,9 @@ pTilePolygon->dimming_level = 20.0 - floorf(20.0 * _f + 0.5f); //----------------------------------------------------------------------------------------------- - ++pOutdoorCamera->uNumPolygons; - ++pOutdoorCamera->field_44; - assert(pOutdoorCamera->uNumPolygons < 20000); + ++pODMRenderParams->uNumPolygons; + ++pODMRenderParams->field_44; + assert(pODMRenderParams->uNumPolygons < 20000); pTilePolygon->uBModelID = 0; pTilePolygon->uBModelFaceID = 0; @@ -346,8 +345,8 @@ //pTile->DrawBorderTiles(); //-------------------------------------------------------------------------------------------------------------------------------- - --pOutdoorCamera->uNumPolygons; - --pOutdoorCamera->field_44; + --pODMRenderParams->uNumPolygons; + --pODMRenderParams->field_44; } } } @@ -385,7 +384,7 @@ billboard.uViewportY = pViewport->uViewportTL_Y; billboard.uViewportZ = pViewport->uViewportBR_X - 1; billboard.uViewportW = pViewport->uViewportBR_Y; - pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw; + pODMRenderParams->uNumBillboards = uNumBillboardsToDraw; for (int i = 0; i < ::uNumBillboardsToDraw; ++i) { @@ -548,36 +547,36 @@ if ( pIndoorCamera->sRotationX ) { v13 = (y - pIndoorCamera->pos.y) << 16; - v30 = ((unsigned __int64)(v12 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - + ((unsigned __int64)(v13 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - v37 = (unsigned __int64)(v12 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - a6a = (unsigned __int64)(v13 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; + v30 = ((unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) + + ((unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); + v37 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + a6a = (unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; v33 = (z - pIndoorCamera->pos.z) << 16; - v14 = (unsigned __int64)(v30 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; - v15 = (unsigned __int64)(v33 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; + v14 = (unsigned __int64)(v30 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; + v15 = (unsigned __int64)(v33 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; v16 = v15 + v14; v42 = v15 + v14; - if ( v15 + v14 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 ) + if ( v15 + v14 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) { v17 = a6a - v37; v40 = a6a - v37; - v18 = ((unsigned __int64)(v33 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - - ((unsigned __int64)(v30 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); + v18 = ((unsigned __int64)(v33 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16) + - ((unsigned __int64)(v30 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); goto LABEL_29; } } else { v34 = (y - pIndoorCamera->pos.y) << 16; - v19 = (unsigned __int64)(v12 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - v20 = (unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; + v19 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; + v20 = (unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; v16 = v20 + v19; v42 = v20 + v19; - if ( v20 + v19 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 ) + if ( v20 + v19 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) { - v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - v17 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; - v40 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; + v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + v17 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; + v40 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21; v18 = (z - pIndoorCamera->pos.z) << 16; LABEL_29: v31 = v18; @@ -585,11 +584,11 @@ if ( abs(v16) >= v22 ) { LODWORD(v23) = 0; - HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); + HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); v24 = v23 / v42; v25 = v23 / v42; LODWORD(v23) = 0; - HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); + HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); v35 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16); v32 = LOWORD(pViewport->uScreenCenterY) - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16); @@ -1048,23 +1047,23 @@ if ( pIndoorCamera->sRotationX ) { v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; - v18 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); + v18 = ((unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) + + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); v42 = v18; - b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; + b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; v40 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; - v41 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; - v19 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; - v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); - v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); - if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) + v41 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; + v19 = (unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; + v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); + v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16); + if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) { v21 = a5 - b; v41 = a5 - b; - a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; - b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; - v22 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - a5; + a5 = (unsigned __int64)(v42 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16; + b = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16; + v22 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16) - a5; LABEL_30: v42 = v22; v40 = 2 * abs(v20); @@ -1072,7 +1071,7 @@ if ( v40 >= v23 ) { LODWORD(v24) = 0; - HIDWORD(v24) = SLOWORD(pOutdoorCamera->int_fov_rad); + HIDWORD(v24) = SLOWORD(pODMRenderParams->int_fov_rad); a5 = v24 / v39; v25 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16); @@ -1131,16 +1130,16 @@ { v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; - b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - v20 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - v39 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) + b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; + a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + v20 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); + v39 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16); + if ( v20 >= 262144 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) { - a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - v21 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; - v41 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; + a5 = (unsigned __int64)(v42 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + b = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; + v21 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; + v41 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5; v22 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; goto LABEL_30; } @@ -1886,7 +1885,7 @@ d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; - d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); + d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); pGame->AlterGamma_ODM(a4, &d3d_vertex_buffer[i].diffuse); @@ -1929,7 +1928,7 @@ d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; - d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); + d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); d3d_vertex_buffer[i].diffuse = GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); if ( this->bUsingSpecular ) @@ -4651,7 +4650,7 @@ pVertices[0].pos.x = array_50AC10[0].vWorldViewProjX; pVertices[0].pos.y = array_50AC10[0].vWorldViewProjY; - pVertices[0].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[0].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); + pVertices[0].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[0].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist); pVertices[0].rhw = 1.0 / (array_50AC10[0].vWorldViewPosition.x + 0.0000001000000011686097); pVertices[0].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); pVertices[0].specular = 0; @@ -4660,7 +4659,7 @@ pVertices[1].pos.x = array_50AC10[3].vWorldViewProjX; pVertices[1].pos.y = array_50AC10[3].vWorldViewProjY; - pVertices[1].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[3].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); + pVertices[1].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[3].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist); pVertices[1].rhw = 1.0 / (array_50AC10[3].vWorldViewPosition.x + 0.0000001000000011686097); pVertices[1].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[3].vWorldViewPosition.x, 0, 0); pVertices[1].specular = 0; @@ -4669,7 +4668,7 @@ pVertices[2].pos.x = array_50AC10[1].vWorldViewProjX; pVertices[2].pos.y = array_50AC10[1].vWorldViewProjY; - pVertices[2].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[1].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); + pVertices[2].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[1].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist); pVertices[2].rhw = 1.0 / (array_50AC10[1].vWorldViewPosition.x + 0.0000001000000011686097); pVertices[2].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[1].vWorldViewPosition.x, 0, 0); pVertices[2].specular = 0; @@ -4681,7 +4680,7 @@ pVertices[5].pos.x = array_50AC10[2].vWorldViewProjX; pVertices[5].pos.y = array_50AC10[2].vWorldViewProjY; - pVertices[5].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[2].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); + pVertices[5].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[2].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist); pVertices[5].rhw = 1.0 / (array_50AC10[2].vWorldViewPosition.x + 0.0000001000000011686097); pVertices[5].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[2].vWorldViewPosition.x, 0, 0); pVertices[5].specular = 0; @@ -4810,7 +4809,7 @@ d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; - d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); + d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); if ( this->bUsingSpecular ) @@ -4841,7 +4840,7 @@ d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; - d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); + d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); d3d_vertex_buffer[i].diffuse = GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); if ( this->bUsingSpecular ) @@ -6022,7 +6021,7 @@ pBillboardRenderListD3D[v8].pQuads[0].specular = 0; pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse; pBillboardRenderListD3D[v8].pQuads[0].pos.y = v23; - v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pODMRenderParams->shading_dist_mist); pBillboardRenderListD3D[v8].pQuads[0].pos.z = v24; v25 = 1.0 / v6; pBillboardRenderListD3D[v8].pQuads[0].rhw = v25; @@ -6156,7 +6155,7 @@ pBillboardRenderListD3D[v8].pQuads[0].diffuse = diffuse; pBillboardRenderListD3D[v8].pQuads[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30; pBillboardRenderListD3D[v8].pQuads[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth; pBillboardRenderListD3D[v8].pQuads[0].specular = specular; pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0; @@ -6170,7 +6169,7 @@ pBillboardRenderListD3D[v8].pQuads[1].diffuse = diffuse; pBillboardRenderListD3D[v8].pQuads[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30; pBillboardRenderListD3D[v8].pQuads[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuads[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); pBillboardRenderListD3D[v8].pQuads[1].rhw = 1.0 / a2->zbuffer_depth; pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0; pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0; @@ -6183,7 +6182,7 @@ pBillboardRenderListD3D[v8].pQuads[2].specular = specular; pBillboardRenderListD3D[v8].pQuads[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30; pBillboardRenderListD3D[v8].pQuads[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuads[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); pBillboardRenderListD3D[v8].pQuads[2].rhw = 1.0 / a2->zbuffer_depth; pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0; pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0; @@ -6196,7 +6195,7 @@ pBillboardRenderListD3D[v8].pQuads[3].specular = specular; pBillboardRenderListD3D[v8].pQuads[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30; pBillboardRenderListD3D[v8].pQuads[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29; - pBillboardRenderListD3D[v8].pQuads[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuads[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); pBillboardRenderListD3D[v8].pQuads[3].rhw = 1.0 / a2->zbuffer_depth; pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0; pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0; @@ -6305,8 +6304,8 @@ v18 = (double)xDifference * v16 * a4; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) { - v20 = a3 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; - v25 = a7 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; + v20 = a3 * 1000.0 / (double)pODMRenderParams->shading_dist_mist; + v25 = a7 * 1000.0 / (double)pODMRenderParams->shading_dist_mist; } else { @@ -6410,7 +6409,7 @@ if (uCurrentlyLoadedLevelType == LEVEL_Indoor) v11 = v10 * 0.061758894; else - v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; + v11 = v10 * 1000.0 / (double)pODMRenderParams->shading_dist_mist; pBillboardRenderListD3D[v5].pQuads[i].pos.z = 1.0 - 1.0 / v11; pBillboardRenderListD3D[v5].pQuads[i].rhw = 1.0 / a1->field_104[i].z; diff -r 384a6b9d1333 -r 2c71fa8913d2 Vis.cpp --- a/Vis.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/Vis.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -4,7 +4,7 @@ #include "Game.h" #include "Actor.h" #include "IndoorCamera.h" -#include "OutdoorCamera.h" +#include "Outdoor_stuff.h" #include "Viewport.h" #include "Math.h" #include "Log.h" @@ -845,7 +845,7 @@ } else { - v3 = pOutdoorCamera->int_fov_rad; + v3 = pODMRenderParams->int_fov_rad; } return stru_5C6E00->Atan2(x - pViewport->uScreenCenterX, v3) - stru_5C6E00->uIntegerHalfPi; } @@ -864,7 +864,7 @@ } else { - v3 = pOutdoorCamera->int_fov_rad; + v3 = pODMRenderParams->int_fov_rad; } return stru_5C6E00->Atan2(y - pViewport->uScreenCenterY, v3) - stru_5C6E00->uIntegerHalfPi; } diff -r 384a6b9d1333 -r 2c71fa8913d2 _deleted.cpp --- a/_deleted.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/_deleted.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -649,16 +649,16 @@ } if ( *(float *)v9 >= 8.0 ) { - if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) + if ( (double)pODMRenderParams->shading_dist_mist >= *(float *)v9 ) { *(int *)v2 = 0; - v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; + v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pODMRenderParams->int_fov_rad; *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX - v12 * *(float *)((char *)v2 + (int)v3); *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY - v12 * *(float *)((char *)v2 + (int)v5); *(float *)((char *)v2 + (int)v16) = v4 - - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); + - v4 / (*(float *)v9 * 1000.0 / (double)pODMRenderParams->shading_dist_mist); *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); v13 = *(float *)v9 + 6.7553994e15; v4 = 1.0; @@ -963,10 +963,10 @@ v41 = v8; if ( v8 > 0 ) { - if ( (signed int)pOutdoorCamera->uNumSurfs < 1999 ) - { - v7 = pOutdoorCamera->uNumEdges; - if ( (signed int)pOutdoorCamera->uNumEdges < 5979 ) + if ( (signed int)pODMRenderParams->uNumSurfs < 1999 ) + { + v7 = pODMRenderParams->uNumEdges; + if ( (signed int)pODMRenderParams->uNumEdges < 5979 ) { v4->uEdgeList1Size = 0; v4->uEdgeList2Size = 0; @@ -985,7 +985,7 @@ do { v10 = v48; - ++pOutdoorCamera->uNumEdges; + ++pODMRenderParams->uNumEdges; if ( v48 >= v41 ) v10 = 0; v11 = *v9; @@ -1089,7 +1089,7 @@ while ( v48 - 1 < v41 ); } LOBYTE(v7) = v34; - if ( pOutdoorCamera->uNumEdges != v34 ) + if ( pODMRenderParams->uNumEdges != v34 ) { v4->ptr_48 = 0; ptr_80C97C_Surfs->field_22 = 0; @@ -1103,7 +1103,7 @@ if ( ptr_80C97C_Surfs < &pSurfs[1999] ) { ++ptr_80C97C_Surfs; - ++pOutdoorCamera->uNumSurfs; + ++pODMRenderParams->uNumSurfs; } if ( BYTE3(a4) ) v4->field_108 = 1; @@ -1158,7 +1158,7 @@ v2 = _this; v3 = _this->pParent; - v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); + v4 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); v5 = v3->ptr_38; v38 = v4; v37 = v5->field_14; @@ -1176,11 +1176,11 @@ v28 = v3->sTextureDeltaU << 16; v35 = v3->sTextureDeltaV << 16; v10 = v2->field_8; - v29 = pOutdoorCamera->camera_rotation_y_int_sine; - v32 = pOutdoorCamera->camera_rotation_y_int_cosine; + v29 = pODMRenderParams->camera_rotation_y_int_sine; + v32 = pODMRenderParams->camera_rotation_y_int_cosine; a1.field_28 = v2->field_C; v11 = v3->field_24; - v37 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v10); + v37 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v10); v12 = v3->v_18.y; v13 = -v11; v36 = v13; @@ -1254,8 +1254,8 @@ v21 = X - v3->ptr_38->field_28 - v35; a1.field_30 >>= v17 + bUseLoResSprites; a1.field_2C = v21 >> (v17 + bUseLoResSprites); - v35 = pOutdoorCamera->int_fov_rad_inv; - v37 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v38) >> 16) >> (v17 + bUseLoResSprites); + v35 = pODMRenderParams->int_fov_rad_inv; + v37 = (signed int)((unsigned __int64)(pODMRenderParams->int_fov_rad_inv * (signed __int64)v38) >> 16) >> (v17 + bUseLoResSprites); a1.field_4 = (unsigned __int64)(v37 * (signed __int64)v29) >> 16; X = (unsigned __int64)(v37 * (signed __int64)v32) >> 16; a1.field_0 = -(signed int)((unsigned __int64)(v37 * (signed __int64)v32) >> 16); @@ -1271,7 +1271,7 @@ a1.field_10 = v17 - v24->uWidthLn2 + 16; a1.field_C = v32 - 1; a1.field_8 = (v25 << 16) - 65536; - a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v38, v3, pOutdoorCamera->building_gamme, 1u, 1); + a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v38, v3, pODMRenderParams->building_gamme, 1u, 1); if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) sr_sub_485975(&a1, (stru315 *)&a2); else @@ -1429,7 +1429,7 @@ if ( *(float *)&v84 == v11 ) ++v82; pGame->pIndoorCameraD3D->ViewTransform((RenderVertexSoft *)(v9 - 12), 1u); - if ( *(float *)v9 < 8.0 || (double)pOutdoorCamera->shading_dist_mist < *(float *)v9 ) + if ( *(float *)v9 < 8.0 || (double)pODMRenderParams->shading_dist_mist < *(float *)v9 ) { if ( *(float *)v9 >= 8.0 ) v75 = 1; @@ -1449,7 +1449,7 @@ } v7 = v77; } - v12 = &array_77EC08[pOutdoorCamera->uNumPolygons]; + v12 = &array_77EC08[pODMRenderParams->uNumPolygons]; *(int *)&v12->flags = 0; if ( v82 == v7 ) *(int *)&v12->flags = 65536; @@ -1482,18 +1482,18 @@ v16 = pTextureFrameTable->GetFrameTexture(v16, pEventTimer->uTotalGameTimeElapsed); v17 = v16; result = (BSPModel *)&pBitmaps_LOD->pTextures[v16]; - v19 = __OFSUB__(pOutdoorCamera->uNumPolygons, 1999); - v18 = pOutdoorCamera->uNumPolygons - 1999 < 0; + v19 = __OFSUB__(pODMRenderParams->uNumPolygons, 1999); + v18 = pODMRenderParams->uNumPolygons - 1999 < 0; v12->pTexture = (Texture *)(v17 != -1 ? (int)result : 0); if ( !(v18 ^ v19) ) return result; - ++pOutdoorCamera->uNumPolygons; - ++pOutdoorCamera->field_44; + ++pODMRenderParams->uNumPolygons; + ++pODMRenderParams->field_44; if ( !ODMFace::IsBackfaceCulled(v3, array_73D150, v12) ) { LABEL_71: - --pOutdoorCamera->uNumPolygons; - --pOutdoorCamera->field_44; + --pODMRenderParams->uNumPolygons; + --pODMRenderParams->field_44; goto LABEL_72; } LOBYTE(v20) = v79; @@ -1581,7 +1581,7 @@ { v36 = sr_4250FE(v26); v37 = v36; - if ( !v36 || (OutdoorCamera::Project(v36), v38 = sr_4254D2(v37), (v12->uNumVertices = v38) == 0) ) + if ( !v36 || (ODMRenderParams::Project(v36), v38 = sr_4254D2(v37), (v12->uNumVertices = v38) == 0) ) goto LABEL_71; v12->_48276F_sr(); v39 = 0; @@ -1609,7 +1609,7 @@ { v43 = sr_4252E8(v26); v44 = v43; - if ( !v43 || (OutdoorCamera::Project(v43), v45 = sr_4254D2(v44), (v12->uNumVertices = v45) == 0) ) + if ( !v43 || (ODMRenderParams::Project(v43), v45 = sr_4254D2(v44), (v12->uNumVertices = v45) == 0) ) goto LABEL_71; v12->_48276F_sr(); v46 = 0; @@ -1736,7 +1736,7 @@ v11 = 0; LODWORD(v12) = a3 << 16; HIDWORD(v12) = a3 >> 16; - a3a = (double)(signed int)(((unsigned __int64)(11 * v12 / (pOutdoorCamera->shading_dist_shade << 16)) >> 16) + 20) + a3a = (double)(signed int)(((unsigned __int64)(11 * v12 / (pODMRenderParams->shading_dist_shade << 16)) >> 16) + 20) * pOutdoor->fFogDensity; v13 = a3a + 6.7553994e15; v10 = _43F55F_get_billboard_light_level(a1, LODWORD(v13) + v11); @@ -1821,10 +1821,10 @@ char v41; // [sp+30h] [bp-2Ch]@57 v0 = pRenderer->pTargetSurface; - v1 = pOutdoorCamera->uNumPolygons; + v1 = pODMRenderParams->uNumPolygons; a1 = pRenderer->pTargetSurface; v2 = array_77EC08.data(); - v37 = pOutdoorCamera->uNumPolygons; + v37 = pODMRenderParams->uNumPolygons; if ( !(pParty->uFlags & 2) ) { v1 = uNumElementsIn80AA28; @@ -1868,7 +1868,7 @@ { while ( 1 ) { - if ( pOutdoorCamera->outdoor_no_wavy_water ) + if ( pODMRenderParams->outdoor_no_wavy_water ) sr_sub_48408A_prolly_odm_water_no_waves(v3); else sr_sub_485407_prolly_odm_water_wavy(v3); @@ -1884,7 +1884,7 @@ { v16 = v4->pTexture; v4->pTexture = pBitmaps_LOD->LoadTexturePtr("wtrtyl"); - if ( pOutdoorCamera->outdoor_no_wavy_water ) + if ( pODMRenderParams->outdoor_no_wavy_water ) sr_sub_48408A_prolly_odm_water_no_waves(v3); else sr_sub_485407_prolly_odm_water_wavy(v3); @@ -2091,10 +2091,10 @@ } if ( pParty->uFlags & 2 ) { - v6 = pOutdoorCamera->uNumPolygons; + v6 = pODMRenderParams->uNumPolygons; v7 = 0; uNumElementsIn80AA28 = 0; - if ( pOutdoorCamera->uNumPolygons > 0 ) + if ( pODMRenderParams->uNumPolygons > 0 ) { v8 = (char *)&array_77EC08[0].flags; do @@ -2114,9 +2114,9 @@ uNumElementsIn80AA28 = v7; } } - v9 = pOutdoorCamera->uNumSpans; - sr_6BE060[0] = pOutdoorCamera->uNumSpans; - if (pOutdoorCamera->uNumPolygons >= 1999) + v9 = pODMRenderParams->uNumSpans; + sr_6BE060[0] = pODMRenderParams->uNumSpans; + if (pODMRenderParams->uNumPolygons >= 1999) return; array_77EC08[1999].Create_48607B(&stru_8019C8); @@ -2137,8 +2137,8 @@ array_77EC08[1999].v_18.x = v10; array_77EC08[1999].v_18.z = stru_5C6E00->Cos(pIndoorCamera->sRotationX); array_77EC08[1999].field_24 = 2048 - (pIndoorCamera->pos.z << 16); - a1a = (signed __int64)((double)(pIndoorCamera->pos.z * pOutdoorCamera->int_fov_rad) - / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + a1a = (signed __int64)((double)(pIndoorCamera->pos.z * pODMRenderParams->int_fov_rad) + / ((double)pODMRenderParams->int_fov_rad + 8192.0) + (double)pViewport->uScreenCenterY); cos((double)pIndoorCamera->sRotationX * 0.0030664064); sin((double)pIndoorCamera->sRotationX * 0.0030664064); @@ -2230,7 +2230,7 @@ if ( v13->field_C >= 0 ) { LABEL_109: - if ( pOutdoorCamera->bNoSky ) + if ( pODMRenderParams->bNoSky ) { const_1_0(); } @@ -2325,8 +2325,8 @@ v8 = v3->ptr_38; v42 = ((unsigned __int64)(v3->ptr_38->field_14 * (signed __int64)v7) >> 16) + v8->field_C; v40 = ((unsigned __int64)(v8->field_20 * (signed __int64)v7) >> 16) + v3->ptr_38->field_18; - v38 = pOutdoorCamera->camera_rotation_y_int_sine; - HIDWORD(v35) = pOutdoorCamera->camera_rotation_y_int_cosine; + v38 = pODMRenderParams->camera_rotation_y_int_sine; + HIDWORD(v35) = pODMRenderParams->camera_rotation_y_int_cosine; v45 = v4->field_C; v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v7) >> 16) + v3->v_18.x; v10 = 65536 / SLODWORD(v35) * (pViewport->uScreenCenterX - v4->field_8); @@ -2551,11 +2551,11 @@ pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512 v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16;//88 v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16;// 66 - v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X - v119 = pOutdoorCamera->outdoor_grid_band_3 + v123; - v2 = pOutdoorCamera->uCameraFovInDegrees + 15;//90 - i = v124 - pOutdoorCamera->outdoor_grid_band_3; - v122 = v123 - pOutdoorCamera->outdoor_grid_band_3; + v120 = pODMRenderParams->outdoor_grid_band_3 + v124;//+- range X + v119 = pODMRenderParams->outdoor_grid_band_3 + v123; + v2 = pODMRenderParams->uCameraFovInDegrees + 15;//90 + i = v124 - pODMRenderParams->outdoor_grid_band_3; + v122 = v123 - pODMRenderParams->outdoor_grid_band_3; if ( v2 > 90 ) v2 = 90; @@ -3214,7 +3214,7 @@ } } result = v126; - pOutdoorCamera->field_40 = v126; + pODMRenderParams->field_40 = v126; return result; } //----- (00482E07) -------------------------------------------------------- @@ -3309,7 +3309,7 @@ v3 = ecx0->pParent; v4 = pViewport->uScreenCenterY - ecx0->field_A; v77 = pRenderTarget; - v5 = pOutdoorCamera->int_fov_rad_inv * v4; + v5 = pODMRenderParams->int_fov_rad_inv * v4; v6 = v3->ptr_38; v76 = ecx0; v81 = v5; @@ -3327,7 +3327,7 @@ v68 = v3->sTextureDeltaU << 16; v69 = v3->sTextureDeltaV << 16; v72 = -v3->field_24; - v10 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - ecx0->field_8); + v10 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - ecx0->field_8); v11 = v3->v_18.y; v66 = v81 + v3->v_18.x; v83 = v10; @@ -3340,7 +3340,7 @@ || (LODWORD(v14) = v72 << 16, HIDWORD(v14) = v72 >> 16, v79 = v14 / v84, - v80 = v10 - v85 * pOutdoorCamera->int_fov_rad_inv, + v80 = v10 - v85 * pODMRenderParams->int_fov_rad_inv, v81 = (unsigned __int64)(v80 * (signed __int64)v3->v_18.y) >> 16, (v84 = v66 + v81) == 0) || (v15 = abs(v66 + v81), abs(X) >= v15) ) @@ -3406,7 +3406,7 @@ if ( v79 >= v70 ) { v46 = v76; - a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v70, v3, pOutdoorCamera->building_gamme, 0, 1); + a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v70, v3, pODMRenderParams->building_gamme, 0, 1); v47 = v3->ptr_38; v79 = v80; v86 = v47->field_10; @@ -3430,7 +3430,7 @@ v51 = v50 + pRenderer->uTargetSurfacePitch * v46->field_A; a1.pDepthBuffer = (unsigned int *)(&pRenderer->pActiveZBuffer[640 * v46->field_A - 1] + v85 + v50); a1.pColorBuffer = &v77[v85 - 1] + v51; - v80 += pOutdoorCamera->int_fov_rad_inv << v74; + v80 += pODMRenderParams->int_fov_rad_inv << v74; if ( v78 > 0 ) { do @@ -3486,10 +3486,10 @@ v76, v84, v3, - pOutdoorCamera->building_gamme, + pODMRenderParams->building_gamme, 0, 0); - v80 += pOutdoorCamera->int_fov_rad_inv << v74; + v80 += pODMRenderParams->int_fov_rad_inv << v74; --v78; } while ( v78 ); @@ -3543,7 +3543,7 @@ } else { - a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v79, v3, pOutdoorCamera->building_gamme, 1u, 1); + a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v79, v3, pODMRenderParams->building_gamme, 1u, 1); v28 = v3->ptr_38; v85 = v10; v86 = v28->field_10; @@ -3568,7 +3568,7 @@ v86 = v76->field_8; a1.pColorBuffer = &v77[v86 + v32]; a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v86 + 640 * v31]; - v80 = v10 - (pOutdoorCamera->int_fov_rad_inv << v74); + v80 = v10 - (pODMRenderParams->int_fov_rad_inv << v74); if ( v78 > 0 ) { v86 = v78; @@ -3625,10 +3625,10 @@ v76, v84, v3, - pOutdoorCamera->building_gamme, + pODMRenderParams->building_gamme, 1u, 0); - v80 -= pOutdoorCamera->int_fov_rad_inv << v74; + v80 -= pODMRenderParams->int_fov_rad_inv << v74; --v86; } while ( v86 ); @@ -3761,10 +3761,10 @@ //signed int band3a; // [sp+48h] [bp+8h]@2 v9 = band2 * 512; - pOutdoorCamera->outdoor_grid_band_3 = band3; + pODMRenderParams->outdoor_grid_band_3 = band3; v10 = band1 * 512; v3 = band3 * 512; - pOutdoorCamera->uPickDepth = band3 * 512; + pODMRenderParams->uPickDepth = band3 * 512; //v4 = terrain_76E5C8; // v4: 0 -> 65536 for (uint i = 0; i < 16384; ++i) //do @@ -3822,7 +3822,7 @@ v9 = a3->vWorldViewPosition.x < 8.0; v10 = a4->vWorldViewPosition.x < 8.0; return !(v8 & v9 & v10 & v7) - && ((v11 = (double)pOutdoorCamera->shading_dist_mist, v11 > v6->vWorldViewPosition.x) ? (v12 = 0) : (v12 = 1), + && ((v11 = (double)pODMRenderParams->shading_dist_mist, v11 > v6->vWorldViewPosition.x) ? (v12 = 0) : (v12 = 1), v11 > v17->vWorldViewPosition.x ? (v13 = 0) : (v13 = 1), v11 > a3->vWorldViewPosition.x ? (v14 = 0) : (v14 = 1), v11 > a4->vWorldViewPosition.x ? (v15 = 0) : (v15 = 1), @@ -3992,7 +3992,7 @@ || v11->vWorldPosition.z != v103->vWorldPosition.z || v103->vWorldPosition.z != v102->vWorldPosition.z ) break; - v17 = &array_77EC08[pOutdoorCamera->uNumPolygons]; + v17 = &array_77EC08[pODMRenderParams->uNumPolygons]; v18 = pOutdoor->GetTileTexture(v101, v100); v17->uTileBitmapID = v18; if ( v18 != -1 ) @@ -4027,9 +4027,9 @@ { v17->dimming_level = 0; } - if ( pOutdoorCamera->uNumPolygons >= 1999 ) + if ( pODMRenderParams->uNumPolygons >= 1999 ) return; - ++pOutdoorCamera->uNumPolygons; + ++pODMRenderParams->uNumPolygons; if ( !_481FC9_terrain(v10, (RenderVertexSoft *)HIDWORD(v101), v102, v17) ) goto LABEL_104; v26 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); @@ -4072,7 +4072,7 @@ } else { - v32 = (double)pOutdoorCamera->shading_dist_mist; + v32 = (double)pODMRenderParams->shading_dist_mist; if ( v32 >= v104->vWorldViewPosition.x && v32 >= *(float *)(HIDWORD(v101) + 12) && v32 >= v102->vWorldViewPosition.x @@ -4095,7 +4095,7 @@ if ( !v36 ) goto LABEL_104; LABEL_41: - OutdoorCamera::Project(v37); + ODMRenderParams::Project(v37); LABEL_102: v33 = sr_4254D2(v37); v17->uNumVertices = v33; @@ -4109,7 +4109,7 @@ if ( v90 >= v81 ) return; } - v38 = &array_77EC08[pOutdoorCamera->uNumPolygons]; + v38 = &array_77EC08[pODMRenderParams->uNumPolygons]; v39 = pOutdoor->GetTileTexture(v101, v100); v38->uTileBitmapID = v39; if ( v39 == -1 ) @@ -4148,9 +4148,9 @@ } if ( v38->dimming_level < 0 ) v38->dimming_level = 0; - if ( pOutdoorCamera->uNumPolygons >= 1999 ) + if ( pODMRenderParams->uNumPolygons >= 1999 ) return; - ++pOutdoorCamera->uNumPolygons; + ++pODMRenderParams->uNumPolygons; if ( !_481FC9_terrain((RenderVertexSoft *)HIDWORD(v101), v103, v104, v38) ) goto LABEL_74; v48 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); @@ -4187,7 +4187,7 @@ } else { - v53 = (double)pOutdoorCamera->shading_dist_mist; + v53 = (double)pODMRenderParams->shading_dist_mist; if ( v53 >= v104->vWorldViewPosition.x && v53 >= *(float *)(HIDWORD(v101) + 12) && v53 >= v103->vWorldViewPosition.x ) @@ -4200,7 +4200,7 @@ LABEL_68: sr_sub_481DB2(sr_508690, v54, v38); LABEL_75: - v17 = &array_77EC08[pOutdoorCamera->uNumPolygons]; + v17 = &array_77EC08[pODMRenderParams->uNumPolygons]; v57 = pOutdoor->GetTileTexture(v101, v100); v17->uTileBitmapID = v57; if ( v57 == -1 ) @@ -4238,13 +4238,13 @@ } if ( v17->dimming_level < 0 ) v17->dimming_level = 0; - if ( pOutdoorCamera->uNumPolygons >= 1999 ) + if ( pODMRenderParams->uNumPolygons >= 1999 ) return; - ++pOutdoorCamera->uNumPolygons; + ++pODMRenderParams->uNumPolygons; if ( !_481FC9_terrain(v102, v104, v103, v17) ) { LABEL_104: - --pOutdoorCamera->uNumPolygons; + --pODMRenderParams->uNumPolygons; goto LABEL_105; } v62 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); @@ -4276,12 +4276,12 @@ if ( v104->vWorldViewPosition.x < 8.0 || v103->vWorldViewPosition.x < 8.0 || v102->vWorldViewPosition.x < 8.0 ) { v37 = sr_4250FE(3u); - OutdoorCamera::Project(v37); + ODMRenderParams::Project(v37); if ( !v37 ) goto LABEL_104; goto LABEL_102; } - v66 = (double)pOutdoorCamera->shading_dist_mist; + v66 = (double)pODMRenderParams->shading_dist_mist; if ( v66 < v104->vWorldViewPosition.x || v66 < v103->vWorldViewPosition.x || v66 < v102->vWorldViewPosition.x ) { v37 = sr_4252E8(3u); @@ -4311,7 +4311,7 @@ v56 = v55; if ( v55 ) { - OutdoorCamera::Project(v55); + ODMRenderParams::Project(v55); v54 = sr_4254D2(v56); v38->uNumVertices = v54; if ( v54 ) @@ -4321,7 +4321,7 @@ } } LABEL_74: - --pOutdoorCamera->uNumPolygons; + --pODMRenderParams->uNumPolygons; goto LABEL_75; } } @@ -4690,7 +4690,7 @@ { LODWORD(v17) = v9 << 16; HIDWORD(v17) = v9 >> 16; - v27 = (double)(signed int)(((unsigned __int64)(v17 / (pOutdoorCamera->shading_dist_shade << 16) * (31 - *a6)) >> 16) + v27 = (double)(signed int)(((unsigned __int64)(v17 / (pODMRenderParams->shading_dist_shade << 16) * (31 - *a6)) >> 16) + *a6) * pOutdoor->fFogDensity; v18 = v27 + 6.7553994e15; @@ -6013,10 +6013,10 @@ } v13->prolly_tail = v0; } - if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) + if ( (signed int)pODMRenderParams->uNumSpans >= 12499 ) return; ++v0; - ++pOutdoorCamera->uNumSpans; + ++pODMRenderParams->uNumSpans; } v6 = v26; v7->field_20 = (signed __int64)v11; @@ -6058,10 +6058,10 @@ } v17->prolly_tail = v0; } - if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) + if ( (signed int)pODMRenderParams->uNumSpans >= 12499 ) return; ++v0; - ++pOutdoorCamera->uNumSpans; + ++pODMRenderParams->uNumSpans; } v7->pNext->field_20 = (signed __int64)v15; v6 = v26; @@ -6120,23 +6120,23 @@ } //----- (00487355) -------------------------------------------------------- -bool OutdoorCamera::_487355() +bool ODMRenderParams::ApplyLightmapsSW() { int v0; // esi@1 Polygon *v1; // edi@2 bool result; // eax@3 v0 = 0; - if ( pOutdoorCamera->uNumPolygons > 0 ) + if ( pODMRenderParams->uNumPolygons > 0 ) { v1 = array_77EC08.data(); do { - result = pGame->pLightmapBuilder->_45D3C7(v1); + result = pGame->pLightmapBuilder->_45D3C7_sw(v1); ++v0; ++v1; } - while ( v0 < pOutdoorCamera->uNumPolygons ); + while ( v0 < pODMRenderParams->uNumPolygons ); } return result; } @@ -6164,7 +6164,7 @@ v14 = (double)pOutdoor->vSunlight.x / 65536.0; result = 0; - v1 = (unsigned int)&array_77EC08[pOutdoorCamera->uNumPolygons]; + v1 = (unsigned int)&array_77EC08[pODMRenderParams->uNumPolygons]; v15 = (double)pOutdoor->vSunlight.y / 65536.0; v16 = (double)pOutdoor->vSunlight.z / 65536.0; if ( v1 > (unsigned int)array_77EC08.data() ) @@ -6462,10 +6462,10 @@ a1.pColorBuffer = &pTargetSurface[v6]; v74 = v7; a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v4 + 640 * v3]; - v8 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); - v9 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v3); + v8 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); + v9 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v3); v10 = v5->ptr_38->field_14; - v76 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); + v76 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); v72 = v10; v81 = (unsigned __int64)(v10 * (signed __int64)v9) >> 16; v11 = v5->ptr_38; @@ -6532,7 +6532,7 @@ LABEL_12: if ( v21 ) { - a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, v20, v5, pOutdoorCamera->building_gamme, 1u, 1); + a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, v20, v5, pODMRenderParams->building_gamme, 1u, 1); a1.field_28 = 16; v66 = v74 >> 4; v81 = v8; @@ -6548,7 +6548,7 @@ v81 = (unsigned __int64)(v76 * (signed __int64)v69) >> 16; v28 = v63 + ((unsigned __int64)(v76 * (signed __int64)v69) >> 16) - v5->ptr_38->field_28; v76 = v75 + bUseLoResSprites; - v73 = v8 - 16 * pOutdoorCamera->int_fov_rad_inv; + v73 = v8 - 16 * pODMRenderParams->int_fov_rad_inv; v29 = v5->pTexture; v30 = (v71 + v27) >> v76; v31 = v28 >> v76; @@ -6609,8 +6609,8 @@ sr_sub_485975(&a1, (stru315 *)&a2); else sr_sub_4D6FB0(v2); - a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, X, v5, pOutdoorCamera->building_gamme, 1u, 0); - v73 -= 16 * pOutdoorCamera->int_fov_rad_inv; + a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, X, v5, pODMRenderParams->building_gamme, 1u, 0); + v73 -= 16 * pODMRenderParams->int_fov_rad_inv; v45 = v74-- == 1; a1.field_28 = 16; v30 = v43; @@ -6729,7 +6729,7 @@ v2 = _this; v3 = _this->pParent; - v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); + v4 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); v5 = v3->ptr_38; v44 = v4; v42 = v5->field_14; @@ -6751,7 +6751,7 @@ a1.field_28 = v2->field_C; v12 = pViewport->uScreenCenterX - v11; v13 = v3->field_24; - v42 = pOutdoorCamera->int_fov_rad_inv * v12; + v42 = pODMRenderParams->int_fov_rad_inv * v12; v14 = v3->v_18.y; v15 = -v13; v40 = v15; @@ -6823,12 +6823,12 @@ a1.field_1C = dword_80AA18 >> v27; a1.field_20 = dword_80AA14 >> v27; } - v41 = pOutdoorCamera->int_fov_rad_inv; - v42 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v19) >> 16) >> v27; + v41 = pODMRenderParams->int_fov_rad_inv; + v42 = (signed int)((unsigned __int64)(pODMRenderParams->int_fov_rad_inv * (signed __int64)v19) >> 16) >> v27; a1.field_4 = (unsigned __int64)(v42 * (signed __int64)v35) >> 16; v43 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16; a1.field_0 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16; - a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v19, v3, pOutdoorCamera->terrain_gamma, 1u, 1); + a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v19, v3, pODMRenderParams->terrain_gamma, 1u, 1); LOWORD(v19) = 0; v28 = v2->field_A; v29 = v2->field_A; @@ -6905,7 +6905,7 @@ v2 = _this; v3 = _this->pParent; - v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); + v4 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); v5 = v3->ptr_38; v40 = v4; v39 = v5->field_14; @@ -6927,10 +6927,10 @@ v35.field_28 = v2->field_C; v12 = pViewport->uScreenCenterX - v11; v13 = v3->field_24; - v41 = pOutdoorCamera->int_fov_rad_inv * v12; + v41 = pODMRenderParams->int_fov_rad_inv * v12; v14 = -v13; v31 = v14; - v15 = ((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * v12 * (signed __int64)v3->v_18.y) >> 16) + v9; + v15 = ((unsigned __int64)(pODMRenderParams->int_fov_rad_inv * v12 * (signed __int64)v3->v_18.y) >> 16) + v9; v37 = v15; if ( !v15 || (v39 = abs(v14 >> 14), v39 > abs(v15)) ) return 0; @@ -6990,12 +6990,12 @@ v35.field_1C = dword_80AA18 >> v24; v35.field_20 = dword_80AA14 >> v24; } - v38 = pOutdoorCamera->int_fov_rad_inv; - v39 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v40) >> 16) >> v24; + v38 = pODMRenderParams->int_fov_rad_inv; + v39 = (signed int)((unsigned __int64)(pODMRenderParams->int_fov_rad_inv * (signed __int64)v40) >> 16) >> v24; v35.field_4 = (unsigned __int64)(v39 * (signed __int64)v32) >> 16; v41 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16; v35.field_0 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16; - v35.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&v34, v2, v40, v3, pOutdoorCamera->terrain_gamma, 1u, 1); + v35.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&v34, v2, v40, v3, pODMRenderParams->terrain_gamma, 1u, 1); v25 = v2->field_8; v26 = (unsigned int *)&pRenderer->pActiveZBuffer[v25 + 640 * v2->field_A]; v35.pColorBuffer = &pRenderer->pTargetSurface[v25 + pRenderer->uTargetSurfacePitch * v2->field_A]; @@ -7121,22 +7121,22 @@ v6 = v5 - v73; v67 = v6 >> texmapping_terrain_subdivpow2; v62 = v6 - (v6 >> texmapping_terrain_subdivpow2 << texmapping_terrain_subdivpow2); - v7 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); + v7 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); v8 = v4->ptr_38; - v79 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); - v78 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); + v79 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); + v78 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); v76 = v8->field_14; - v78 = (unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; + v78 = (unsigned __int64)(v76 * (signed __int64)(pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; v9 = v4->ptr_38; v10 = v78 + v9->field_C; v76 = v9->field_20; v65 = v10; - v11 = ((unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16) + v11 = ((unsigned __int64)(v76 * (signed __int64)(pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16) + v4->ptr_38->field_18; - v78 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); + v78 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); v64 = v11; v76 = v4->v_18.z; - v78 = (unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; + v78 = (unsigned __int64)(v76 * (signed __int64)(pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; v12 = -v4->field_24; v63 = v78 + v4->v_18.x; v66 = -v4->field_24; @@ -7179,7 +7179,7 @@ } sr.pTextureLOD = v17; LABEL_14: - sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v15, v4, pOutdoorCamera->terrain_gamma, 1u, 1); + sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v15, v4, pODMRenderParams->terrain_gamma, 1u, 1); v18 = v4->ptr_38; v78 = v7; v79 = v18->field_10; @@ -7213,7 +7213,7 @@ sr.field_C = v79 - 1; if ( v73 ) { - v25 = v7 - v73 * pOutdoorCamera->int_fov_rad_inv; + v25 = v7 - v73 * pODMRenderParams->int_fov_rad_inv; v26 = v25; v77 = v4->v_18.y; v79 = v25; @@ -7268,12 +7268,12 @@ else sr_sub_4D6FB0(v1); } - v39 = v79 - (pOutdoorCamera->int_fov_rad_inv << v69); + v39 = v79 - (pODMRenderParams->int_fov_rad_inv << v69); } else { - v79 = v7 - (pOutdoorCamera->int_fov_rad_inv << v69); - v39 = v7 - (pOutdoorCamera->int_fov_rad_inv << v69); + v79 = v7 - (pODMRenderParams->int_fov_rad_inv << v69); + v39 = v7 - (pODMRenderParams->int_fov_rad_inv << v69); } sr.field_28 = v68; while ( v67 > 0 ) @@ -7324,9 +7324,9 @@ else sr_sub_4D6FB0(v1); } - sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v73, v4, pOutdoorCamera->terrain_gamma, 1u, 0); + sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v73, v4, pODMRenderParams->terrain_gamma, 1u, 0); sr.field_28 = v68; - v39 -= pOutdoorCamera->int_fov_rad_inv << v69; + v39 -= pODMRenderParams->int_fov_rad_inv << v69; } if ( !v62 ) return 1; @@ -7448,8 +7448,8 @@ v6 = a1->field_C; a1a.pColorBuffer = &pRenderer->pTargetSurface[v4]; v46 = v6; - v7 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v3); - v8 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); + v7 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v3); + v8 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); a1a.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v3 + 640 * v2]; v9 = v5->ptr_38; v47 = (Span *)v7; @@ -7518,7 +7518,7 @@ LABEL_12: if ( !pLOD ) return 0; - a1a.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v43, v18, v5, pOutdoorCamera->terrain_gamma, 1u, 1); + a1a.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v43, v18, v5, pODMRenderParams->terrain_gamma, 1u, 1); a1a.field_28 = 16; v43 = (Span *)(v46 >> 4); X = v7; @@ -7544,10 +7544,10 @@ v34 = v49 - v29->uWidthLn2; a1a.field_8 = (v33 << 16) - 65536; X = 2 * pMiscTimer->uTotalGameTimeElapsed; - v45 = pOutdoorCamera->int_fov_rad_inv; + v45 = pODMRenderParams->int_fov_rad_inv; a1a.field_10 = v34 + 16; a1a.field_C = v32 - 1; - i = (unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)i) >> 16; + i = (unsigned __int64)(pODMRenderParams->int_fov_rad_inv * (signed __int64)i) >> 16; v47 = (Span *)(i >> v44); v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); v36 = (signed int)v47 * (signed __int64)v35; @@ -7610,11 +7610,11 @@ pPixels = pRenderTarget; v4 = a1->pParent; v13 = -v4->field_24; - X = ((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv + X = ((unsigned __int64)(pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - (signed int)a1->field_8) * (signed __int64)v4->v_18.y) >> 16) + ((unsigned __int64)(v4->v_18.z - * (signed __int64)(pOutdoorCamera->int_fov_rad_inv + * (signed __int64)(pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - (signed int)a1->field_A))) >> 16) + v4->v_18.x; if ( X && (v5 = abs(-v4->field_24 >> 14), v5 <= abs(X)) ) @@ -7626,10 +7626,10 @@ } else { - v7 = pOutdoorCamera->shading_dist_mist << 16; - v8 = pOutdoorCamera->shading_dist_mist << 16; - } - v9 = sr_sub_47C178(v8, v4, pOutdoorCamera->terrain_gamma, a4); + v7 = pODMRenderParams->shading_dist_mist << 16; + v8 = pODMRenderParams->shading_dist_mist << 16; + } + v9 = sr_sub_47C178(v8, v4, pODMRenderParams->terrain_gamma, a4); fill_pixels_fast(*((short *)v9 + v4->pTexture->uDecompressedSize), pPixels, v3->field_C); HIWORD(v10) = HIWORD(v7); LOWORD(v10) = 0; @@ -7667,7 +7667,7 @@ char *v26; // [sp+2Ch] [bp-4h]@5 v1 = uVertexID; - v2 = (double)pOutdoorCamera->shading_dist_mist; + v2 = (double)pODMRenderParams->shading_dist_mist; memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); v22 = 0; v18 = array_50AC10[0].vWorldViewPosition.x <= v2; @@ -8709,7 +8709,7 @@ if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y || pVertices2->vWorldPosition.y != v101->vWorldPosition.y ) break; - pTile = &array_77EC08[pOutdoorCamera->uNumPolygons]; + pTile = &array_77EC08[pODMRenderParams->uNumPolygons]; pTile->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); if ( pTile->uTileBitmapID != -1 ) { @@ -8729,16 +8729,16 @@ (((float)pOutdoor->vSunlight.y / 65536.0) * norm->y) - (((float)pOutdoor->vSunlight.z / 65536.0) * norm->z)) * 20.0; //v25 = thisf + 6.7553994e15; - //v27 = pOutdoorCamera->uNumPolygons > 1999; - //v26 = pOutdoorCamera->uNumPolygons - 1999 < 0; + //v27 = pODMRenderParams->uNumPolygons > 1999; + //v26 = pODMRenderParams->uNumPolygons - 1999 < 0; pTile->dimming_level = floorf(thisf + 0.5f); - if ( pOutdoorCamera->uNumPolygons >= 1999 ) + if ( pODMRenderParams->uNumPolygons >= 1999 ) return; - ++pOutdoorCamera->uNumPolygons; + ++pODMRenderParams->uNumPolygons; //if ( !_481FC9_terrain(v8, pVertices, v101, v16) )//Ritor1: It's temporary //goto LABEL_126; //{ - //--pOutdoorCamera->uNumPolygons; + //--pODMRenderParams->uNumPolygons; //goto LABEL_162; //} __debugbreak(); // warning C4700: uninitialized local variable 'v102' used @@ -8780,7 +8780,7 @@ } this_3 = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 || v101->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0; - v3a = (double)pOutdoorCamera->shading_dist_mist; + v3a = (double)pODMRenderParams->shading_dist_mist; v108 = v3a < v102->vWorldViewPosition.x || v3a < pVertices->vWorldViewPosition.x || v3a < v101->vWorldViewPosition.x || v3a < pVertices2->vWorldViewPosition.x; v33 = 0; @@ -8806,13 +8806,13 @@ { v36 = sr_424CD7(v34); pTile->uNumVertices = v36; - OutdoorCamera::Project(v36); + ODMRenderParams::Project(v36); } if ( v108 ) { v36 = sr_424EE0_MakeFanFromTriangle(v34); pTile->uNumVertices = v36; - OutdoorCamera::Project(v36); + ODMRenderParams::Project(v36); } } //v37 = *(int *)&v16->flags; @@ -8845,7 +8845,7 @@ if ( ++v88 >= v84 ) return; } - v40 = &array_77EC08[pOutdoorCamera->uNumPolygons]; + v40 = &array_77EC08[pODMRenderParams->uNumPolygons]; v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); if ( v40->uTileBitmapID == -1 ) goto LABEL_162; @@ -8873,13 +8873,13 @@ v40->dimming_level = LOBYTE(v50); if ( LOBYTE(v50) < 0 ) v40->dimming_level = 0; - if ( pOutdoorCamera->uNumPolygons >= 1999 ) + if ( pODMRenderParams->uNumPolygons >= 1999 ) return; - ++pOutdoorCamera->uNumPolygons; + ++pODMRenderParams->uNumPolygons; if ( !_481FC9_terrain(pVertices, pVertices2, v8, v40) ) // Ritor1: It's temporary //goto LABEL_77; { - --pOutdoorCamera->uNumPolygons; + --pODMRenderParams->uNumPolygons; goto LABEL_112; } memcpy(&array_50AC10[0], v102, 0x30u); @@ -8917,14 +8917,14 @@ if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices ) { //LABEL_77: - --pOutdoorCamera->uNumPolygons; + --pODMRenderParams->uNumPolygons; goto LABEL_112; } thisb->ViewTransform(array_50AC10, uNumVertices); thisb->Project(array_50AC10, uNumVertices, 0); } this_3a = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0; - v54 = (double)pOutdoorCamera->shading_dist_mist; + v54 = (double)pODMRenderParams->shading_dist_mist; v108 = v54 < v102->vWorldViewPosition.x || v54 < pVertices->vWorldViewPosition.x || v54 < pVertices2->vWorldViewPosition.x; pVertices = 0; v96->std__vector_000004_size = 0; @@ -8957,7 +8957,7 @@ v56 = sr_424EE0_MakeFanFromTriangle(v55); } v40->uNumVertices = v56; - OutdoorCamera::Project(v56); + ODMRenderParams::Project(v56); } LABEL_105: v57 = *(int *)&v40->flags; @@ -8980,8 +8980,8 @@ pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81); } LABEL_112: - v59 = &array_77EC08[pOutdoorCamera->uNumPolygons]; - //a8 = (RenderVertexSoft *)&array_77EC08[pOutdoorCamera->uNumPolygons]; + v59 = &array_77EC08[pODMRenderParams->uNumPolygons]; + //a8 = (RenderVertexSoft *)&array_77EC08[pODMRenderParams->uNumPolygons]; v59->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); if ( v59->uTileBitmapID == -1 ) goto LABEL_162; @@ -9002,13 +9002,13 @@ v59->dimming_level = floorf(thish + 0.5f); if ( v59->dimming_level < 0 ) v59->dimming_level = 0; - if ( pOutdoorCamera->uNumPolygons >= 1999 ) + if ( pODMRenderParams->uNumPolygons >= 1999 ) return; - ++pOutdoorCamera->uNumPolygons; + ++pODMRenderParams->uNumPolygons; if ( !_481FC9_terrain(v101, v102, pVertices2, v59) ) { //LABEL_126: - --pOutdoorCamera->uNumPolygons; + --pODMRenderParams->uNumPolygons; goto LABEL_162; } memcpy(&array_50AC10[0], v102, 0x30u); @@ -9040,7 +9040,7 @@ if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, (unsigned int *)&v100, 0) == 1 && !v100 ) //goto LABEL_126; { - --pOutdoorCamera->uNumPolygons; + --pODMRenderParams->uNumPolygons; goto LABEL_162; } thisc->ViewTransform(array_50AC10, v100); @@ -9048,7 +9048,7 @@ } this_3b = v102->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0 || v101->vWorldViewPosition.x < 8.0; - v69 = (double)pOutdoorCamera->shading_dist_mist; + v69 = (double)pODMRenderParams->shading_dist_mist; v108 = v69 < v102->vWorldViewPosition.x || v69 < pVertices2->vWorldViewPosition.x || v69 < v101->vWorldViewPosition.x; v70 = 0; v96->std__vector_000004_size = 0; @@ -9107,7 +9107,7 @@ v73 = sr_424EE0_MakeFanFromTriangle(v72); } v71->uNumVertices = v73; - OutdoorCamera::Project(v73); + ODMRenderParams::Project(v73); goto LABEL_154; } } @@ -12279,7 +12279,7 @@ //----- (00481EB7) -------------------------------------------------------- void ResetPolygons() { - for (auto i = 0; i < pOutdoorCamera->uNumPolygons; ++i) + for (auto i = 0; i < pODMRenderParams->uNumPolygons; ++i) { array_77EC08[i].prolly_head = nullptr; array_77EC08[i].prolly_tail = nullptr; @@ -12400,7 +12400,7 @@ while ( v2 ); } //----- (00486A28) -------------------------------------------------------- -void OutdoorCamera::AllocSoftwareDrawBuffers() +void ODMRenderParams::AllocSoftwareDrawBuffers() { if ( !this || !pSpans ) { @@ -12416,7 +12416,7 @@ } } //----- (00486AFC) -------------------------------------------------------- -void OutdoorCamera::ReleaseSoftwareDrawBuffers() +void ODMRenderParams::ReleaseSoftwareDrawBuffers() { free(pSpans); free(pEdges); @@ -12431,7 +12431,7 @@ bool OutdoorLocation::Release2() { Release(); - pOutdoorCamera->ReleaseSoftwareDrawBuffers(); + pODMRenderParams->ReleaseSoftwareDrawBuffers(); return true; } @@ -12769,6 +12769,292 @@ + + +//----- (0045D3C7) -------------------------------------------------------- +bool LightmapBuilder::_45D3C7_sw(struct Polygon *a1) +{ + LightmapBuilder *v2; // ebx@1 + struct Polygon *result; // eax@1 + float v4; // ecx@2 + Span *i; // edi@5 + + v2 = this; + result = (struct Polygon *)a1->prolly_head; + if ( result && (v4 = result->field_4, *(int *)&v4) != 0 && *(unsigned int *)(LODWORD(v4) + 60) ) + { + for ( i = a1->prolly_head; ; i = i->pNext ) + { + result = i->pParent; + if ( result->field_108 ) + result = (struct Polygon *)_45D426_sw( + i, + a1->pEdgeList1, + a1->uEdgeList1Size, + (Edge *)a1->pEdgeList2, + a1->uEdgeList2Size); + if ( a1->prolly_tail == i ) + break; + } + LOBYTE(result) = 1; + } + else + { + LOBYTE(result) = 0; + } + return (bool)result; +} + +//----- (0045D426) -------------------------------------------------------- +int LightmapBuilder::_45D426_sw(Span *a1, Edge **a2, unsigned int a3, Edge *a4, int a5) +{ + int v6; // edi@1 + signed int v7; // ebx@3 + signed int v8; // ecx@3 + Span *v9; // esi@3 + double v10; // st7@4 + Edge *v11; // edx@5 + double v12; // st7@11 + int v13; // edx@12 + int v14; // ebx@17 + Edge *v15; // edi@17 + float v16; // ST04_4@17 + float v17; // ST04_4@17 + double v18; // st7@17 + int result; // eax@19 + //double v20; // ST14_8@20 + //double v21; // ST14_8@20 + double v22; // st7@20 + int v23; // ecx@20 + double v24; // st6@20 + double v25; // st7@23 + double v26; // st7@28 + __int16 v27; // fps@28 + char v28; // c0@28 + char v29; // c2@28 + char v30; // c3@28 + double v31; // st7@29 + double v32; // st7@30 + __int16 v33; // fps@30 + char v34; // c0@30 + char v35; // c2@30 + char v36; // c3@30 + LightmapBuilder *this_4; // [sp+14h] [bp-8h]@1 + signed int v38; // [sp+18h] [bp-4h]@3 + float a1a; // [sp+24h] [bp+8h]@20 + float a2a; // [sp+28h] [bp+Ch]@17 + float a3a; // [sp+2Ch] [bp+10h]@17 + float a5a; // [sp+34h] [bp+18h]@20 + float a5b; // [sp+34h] [bp+18h]@20 + + v6 = 0; + this_4 = this; + if ( a5 && a3 ) + { + v7 = -1; + v8 = 0; + v9 = a1; + v38 = -1; + if ( (signed int)a3 > 0 ) + { + v10 = (double)a1->field_A; + while ( 1 ) + { + v11 = a2[v8]; + if ( v10 >= v11->field_2C ) + { + if ( v10 <= v11->field_30 ) + break; + } + ++v8; + if ( v8 >= (signed int)a3 ) + goto LABEL_10; + } + v38 = v8; + } +LABEL_10: + if ( a5 > 0 ) + { + v12 = (double)a1->field_A; + while ( 1 ) + { + v13 = *((unsigned int *)&a4->field_0 + v6); + if ( v12 >= *(float *)(v13 + 44) ) + { + if ( v12 <= *(float *)(v13 + 48) ) + break; + } + ++v6; + if ( v6 >= a5 ) + goto LABEL_17; + } + v7 = v6; + } +LABEL_17: + v14 = *((unsigned int *)&a4->field_0 + v7); + v15 = a2[v38]; + v16 = (double)a1->field_A; + a3a = _45D643_sw(a2[v38], v16); + v17 = (double)a1->field_A; + v18 = _45D643_sw((Edge *)v14, v17); + a2a = v18; + if ( byte_4D864C && BYTE1(pGame->uFlags) & 0x80 ) + { + HIWORD(result) = HIWORD(a3a); + a1->field_14 = v18; + a1->field_10 = a3a; + } + else + { + a5a = ((double)a1->field_A - v15->field_2C) * v15->field_4 + v15->field_24 - 0.5; + //v20 = a5a + 6.7553994e15; + //a5b = (double)SLODWORD(v20); + a5b = (double)floorf(a5a + 0.5f); + a1a = ((double)a1->field_A - *(float *)(v14 + 44)) * *(float *)(v14 + 4) + *(float *)(v14 + 36) + 0.5; + //v21 = a1a + 6.7553994e15; + //v22 = (double)SLODWORD(v21); + v22 = (double)floorf(a1a + 0.5f); + result = v9->field_8; + v23 = v9->field_C; + v24 = -((a3a - a2a) / (v22 - a5b)); + v9->field_10 = ((double)result - a5b) * v24 + a3a; + v9->field_14 = a2a - (v22 - (double)(result + v23)) * v24; + } + if ( v9->field_10 < 0.0 || v9->field_10 <= 1.0 ) + { + if ( v9->field_10 >= 0.0 ) + v25 = v9->field_10; + else + v25 = 0.0; + } + else + { + v25 = 1.0; + } + v9->field_10 = v25; + __debugbreak(); // warning C4700: uninitialized local variable 'v27' used + if ( v9->field_14 < 0.0 + || (v26 = v9->field_14, + //UNDEF(v27), + v28 = 1.0 < v26, + v29 = 0, + v30 = 1.0 == v26, + BYTE1(result) = HIBYTE(v27), + v26 <= 1.0) ) + { + v32 = v9->field_14; + //UNDEF(v33); + v34 = 0.0 < v32; + v35 = 0; + v36 = 0.0 == v32; + __debugbreak(); // warning C4700: uninitialized local variable 'v33' used + BYTE1(result) = HIBYTE(v33); + if ( v32 >= 0.0 ) + v31 = v9->field_14; + else + v31 = 0.0; + } + else + { + v31 = 1.0; + } + v9->field_14 = v31; + LOBYTE(result) = 1; + } + else + { + LOBYTE(result) = 0; + } + return result; +} + +//----- (0045D643) -------------------------------------------------------- +double LightmapBuilder::_45D643_sw(Edge *a1, float a2) +{ + double result; // st7@1 + + result = (a1->field_1C - a1->field_20) * -1.0 / (a1->field_30 - a1->field_2C) * (a2 - a1->field_2C) + a1->field_1C; + if ( result < 0.0 || result <= 1.0 ) + { + if ( result < 0.0 ) + result = 0.0; + } + else + { + result = 1.0; + } + return result; +} + + +/* +// 143 +#pragma pack(push, 1) +struct Span +{ + Span *pNext; + struct Polygon *pParent; + __int16 field_8; + __int16 field_A; + __int16 field_C; + __int16 field_E; + float field_10; + float field_14; +}; +#pragma pack(pop) + + + +// 144 +#pragma pack(push, 1) +struct Surf +{ + float field_0; + float field_4; + float field_8; + float field_C; + float field_10; + Surf *pNext; + Surf *pPrev; + struct Polygon *pParent; + __int16 field_20; + __int16 field_22; +}; +#pragma pack(pop) +extern Surf stru_80C980; + + + + +// 145 +#pragma pack(push, 1) +struct Edge +{ + float field_0; + float field_4; + int field_8; + Surf *pSurf; + Edge *pNext; + Edge *pPrev; + Edge *ptr_18; + float field_1C; + float field_20; + float field_24; + float field_28; + float field_2C; + float field_30; +}; +#pragma pack(pop) +extern Edge defaultEdge; // weak + +extern Edge stru_80C9A4; +extern Edge stru_80C9D8; +*/ + + + + + const wchar_t *UIMessage2String(UIMessageType msg) { #define CASE(xxx) case xxx: swprintf(b, wcslen(L"%03X/%s"), L"%03X/%s", msg, L#xxx); return b; diff -r 384a6b9d1333 -r 2c71fa8913d2 mm7_2.cpp --- a/mm7_2.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/mm7_2.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -12,7 +12,6 @@ #include "VideoPlayer.h" #include "Sprites.h" #include "BSPModel.h" -#include "OutdoorCamera.h" #include "LightmapBuilder.h" #include "DecalBuilder.h" @@ -31,6 +30,7 @@ #include "Party.h" #include "AudioPlayer.h" #include "Outdoor.h" +#include "Outdoor_stuff.h" #include "IndoorCamera.h" #include "Overlays.h" #include "Arcomage.h" @@ -2874,10 +2874,10 @@ } //----- (004610AA) -------------------------------------------------------- -void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2) +void __fastcall PrepareToLoadODM(unsigned int bLoading, ODMRenderParams *a2) { unsigned int v2; // edi@1 - OutdoorCamera *v3; // esi@1 + ODMRenderParams *v3; // esi@1 v2 = bLoading; v3 = a2; @@ -5023,7 +5023,7 @@ assert(sizeof(BLVLightMM7) == 0x10); assert(sizeof(BLVDoor) == 0x50); assert(sizeof(IndoorLocation) == 0x690); - assert(sizeof(OutdoorCamera) == 0x74); + assert(sizeof(ODMRenderParams) == 0x74); assert(sizeof(Mouse) == 0x114); assert(sizeof(Particle_sw) == 0x68); assert(sizeof(Particle) == 0x68); @@ -5362,7 +5362,7 @@ while ( v9 < v2 ); } - pOutdoorCamera = new OutdoorCamera; + pODMRenderParams = new ODMRenderParams; outdoor_day_top_r = GetPrivateProfileIntW(L"outdoor", L"RGBDayTop.r", 81, pIniFilename); outdoor_day_top_g = GetPrivateProfileIntW(L"outdoor", L"RGBDayTop.g", 121, pIniFilename); outdoor_day_top_b = GetPrivateProfileIntW(L"outdoor", L"RGBDayTop.b", 236, pIniFilename); @@ -5375,24 +5375,24 @@ outdoor_night_bottom_r = GetPrivateProfileIntW(L"outdoor", L"RGBNightBottom.r", 11, pIniFilename); outdoor_night_bottom_g = GetPrivateProfileIntW(L"outdoor", L"RGBNightBottom.g", 41, pIniFilename); outdoor_night_bottom_b = GetPrivateProfileIntW(L"outdoor", L"RGBNightBottom.b", 129, pIniFilename); - pOutdoorCamera->outdoor_no_mist = GetPrivateProfileIntW(L"debug", L"noMist", 0, pIniFilename); - pOutdoorCamera->bNoSky = GetPrivateProfileIntW(L"outdoor", L"nosky", 0, pIniFilename); - pOutdoorCamera->bDoNotRenderDecorations = GetPrivateProfileIntW(L"render", L"nodecorations", 0, pIniFilename); - pOutdoorCamera->outdoor_no_wavy_water = GetPrivateProfileIntW(L"outdoor", L"nowavywater", 0, pIniFilename); + pODMRenderParams->outdoor_no_mist = GetPrivateProfileIntW(L"debug", L"noMist", 0, pIniFilename); + pODMRenderParams->bNoSky = GetPrivateProfileIntW(L"outdoor", L"nosky", 0, pIniFilename); + pODMRenderParams->bDoNotRenderDecorations = GetPrivateProfileIntW(L"render", L"nodecorations", 0, pIniFilename); + pODMRenderParams->outdoor_no_wavy_water = GetPrivateProfileIntW(L"outdoor", L"nowavywater", 0, pIniFilename); outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename); outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename); outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename); - pOutdoorCamera->terrain_gamma = GetPrivateProfileIntW(L"outdoor", L"ter_gamma", 0, pIniFilename); - pOutdoorCamera->building_gamme = GetPrivateProfileIntW(L"outdoor", L"bld_gamma", 0, pIniFilename); + pODMRenderParams->terrain_gamma = GetPrivateProfileIntW(L"outdoor", L"ter_gamma", 0, pIniFilename); + pODMRenderParams->building_gamme = GetPrivateProfileIntW(L"outdoor", L"bld_gamma", 0, pIniFilename); mipmapping_terrain_mm1 = GetPrivateProfileIntW(L"mipmapping", L"ter_mm1", 2048, pIniFilename); mipmapping_terrain_mm2 = GetPrivateProfileIntW(L"mipmapping", L"ter_mm2", 4096, pIniFilename); mipmapping_terrain_mm3 = GetPrivateProfileIntW(L"mipmapping", L"ter_mm3", 8192, pIniFilename); mipmapping_building_mm1 = GetPrivateProfileIntW(L"mipmapping", L"bld_mm1", 1024, pIniFilename); mipmapping_building_mm2 = GetPrivateProfileIntW(L"mipmapping", L"bld_mm2", 2048, pIniFilename); mipmapping_building_mm3 = GetPrivateProfileIntW(L"mipmapping", L"bld_mm3", 4096, pIniFilename); - pOutdoorCamera->shading_dist_shade = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename); - pOutdoorCamera->shading_dist_shademist = GetPrivateProfileIntW(L"shading", L"dist_shademist", 4096, pIniFilename); - pOutdoorCamera->shading_dist_mist = GetPrivateProfileIntW(L"shading", L"dist_mist", 8192, pIniFilename); + pODMRenderParams->shading_dist_shade = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename); + pODMRenderParams->shading_dist_shademist = GetPrivateProfileIntW(L"shading", L"dist_shademist", 4096, pIniFilename); + pODMRenderParams->shading_dist_mist = GetPrivateProfileIntW(L"shading", L"dist_mist", 8192, pIniFilename); wchar_t pDefaultSkyTextureW[1024]; GetPrivateProfileStringW(L"textures", L"sky", L"plansky1", pDefaultSkyTextureW, 0x10u, pIniFilename); @@ -5452,25 +5452,25 @@ outdoor_grid_band_1 = 10; outdoor_grid_band_2 = 15; outdoor_grid_band_3 = 20; - pOutdoorCamera->shading_dist_mist = 8192; - pOutdoorCamera->bNoSky = false; + pODMRenderParams->shading_dist_mist = 8192; + pODMRenderParams->bNoSky = false; LOBYTE(viewparams->field_20) = 0; } mipmapping_terrain_mm1 = 1024; mipmapping_terrain_mm2 = 2048; mipmapping_building_mm1 = 1024; mipmapping_building_mm2 = 2048; - pOutdoorCamera->shading_dist_shade = 2048; - pOutdoorCamera->terrain_gamma = 0; - pOutdoorCamera->building_gamme = 0; + pODMRenderParams->shading_dist_shade = 2048; + pODMRenderParams->terrain_gamma = 0; + pODMRenderParams->building_gamme = 0; mipmapping_terrain_mm3 = 4096; mipmapping_building_mm3 = 4096; - pOutdoorCamera->shading_dist_shademist = 4096; - pOutdoorCamera->outdoor_no_wavy_water = 0; + pODMRenderParams->shading_dist_shademist = 4096; + pODMRenderParams->outdoor_no_wavy_water = 0; //_47F4D3_initialize_terrain_bezier_stuff(outdoor_grid_band_1, outdoor_grid_band_2, outdoor_grid_band_3); { - pOutdoorCamera->outdoor_grid_band_3 = outdoor_grid_band_3; - pOutdoorCamera->uPickDepth = outdoor_grid_band_3 * 512; + pODMRenderParams->outdoor_grid_band_3 = outdoor_grid_band_3; + pODMRenderParams->uPickDepth = outdoor_grid_band_3 * 512; } } else @@ -5485,7 +5485,7 @@ pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y); if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) - pOutdoorCamera->_485F64(); + pODMRenderParams->Initialize(); } //----- (00466C40) -------------------------------------------------------- diff -r 384a6b9d1333 -r 2c71fa8913d2 mm7_3.cpp --- a/mm7_3.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/mm7_3.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -7,7 +7,6 @@ #include "mm7_data.h" #include "Sprites.h" #include "BSPModel.h" -#include "OutdoorCamera.h" #include "LightmapBuilder.h" #include "DecalBuilder.h" #include "ParticleEngine.h" @@ -4183,7 +4182,7 @@ } else { - v10 = (double)pOutdoorCamera->shading_dist_mist; + v10 = (double)pODMRenderParams->shading_dist_mist; v3 = 8.0; } v4 = a1->uNumVertices; @@ -4269,7 +4268,7 @@ { for(int i = 0; i < a1->uNumVertices; i++) { - v12 = (double)pOutdoorCamera->int_fov_rad / a1->field_B4[i*4]; + v12 = (double)pODMRenderParams->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]; @@ -4392,7 +4391,7 @@ //v5 = (int)*(v2 - 1); v6 = pFace->pVertexIDs[0]; v53 = 0; - v7 = &array_77EC08[pOutdoorCamera->uNumPolygons]; + v7 = &array_77EC08[pODMRenderParams->uNumPolygons]; v7->flags = 0; v7->field_32 = 0; pLightmapBuilder = (LightmapBuilder *)v2->pVertices.pVertices[v6].z; @@ -4527,7 +4526,7 @@ ++v53; //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); pGame->pIndoorCameraD3D->ViewTransform(v23, 1u); - if ( v23->vWorldViewPosition.x < 8.0 || (double)pOutdoorCamera->shading_dist_mist < v23->vWorldViewPosition.x ) + if ( v23->vWorldViewPosition.x < 8.0 || (double)pODMRenderParams->shading_dist_mist < v23->vWorldViewPosition.x ) { if ( v23->vWorldViewPosition.x >= 8.0 ) v49 = 1; @@ -4566,10 +4565,10 @@ v7->dimming_level = 0; if ( v7->dimming_level > 31 ) v7->dimming_level = 31; - if ( pOutdoorCamera->uNumPolygons >= 1999 + 5000) + if ( pODMRenderParams->uNumPolygons >= 1999 + 5000) return result; - ++pOutdoorCamera->uNumPolygons; - ++pOutdoorCamera->field_44; + ++pODMRenderParams->uNumPolygons; + ++pODMRenderParams->field_44; if ( ODMFace::IsBackfaceCulled(pFace, array_73D150, v7) ) { LOBYTE(v25) = (char)v54; @@ -4646,7 +4645,7 @@ LABEL_76: v7->uNumVertices = v32; uNumVertices = v32; - OutdoorCamera::Project(v32); + ODM_Project(v32); } if ( uNumVertices ) { @@ -4667,8 +4666,8 @@ } goto LABEL_85; } - --pOutdoorCamera->uNumPolygons; - --pOutdoorCamera->field_44; + --pODMRenderParams->uNumPolygons; + --pODMRenderParams->field_44; LABEL_85: v54 = (Vec3_int_ *)((char *)v54 + 1); v2 = v56; @@ -4709,7 +4708,7 @@ //int v22; // [sp+28h] [bp-4h]@3 //v16 = unused; - angle = (signed int)(pOutdoorCamera->uCameraFovInDegrees << 11) / 360 >> 1; + angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 >> 1; //v14 = uModelID; v2 = &pOutdoor->pBModels[uModelID]; v3 = v2->vBoundingCenter.x - pIndoorCamera->pos.x; @@ -4737,7 +4736,7 @@ else v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); v12 = v11 >> 16; - if ( v9 <= pOutdoorCamera->shading_dist_mist + 2048 ) + if ( v9 <= pODMRenderParams->shading_dist_mist + 2048 ) { //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 ) @@ -5126,7 +5125,7 @@ last_camera_rot_x = pParty->sRotationX; float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight; - float fov_x = 3.141592f * (pOutdoorCamera->uCameraFovInDegrees + 0) / 360.0f; + float fov_x = 3.141592f * (pODMRenderParams->uCameraFovInDegrees + 0) / 360.0f; float fov_y = fov_x / aspect; float ray_dx = fov_x / (float)pViewport->uScreenWidth, @@ -5310,11 +5309,11 @@ return; } - v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z) - / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 изменяется при подъёме на высоту - v38 = pViewport->uScreenCenterY - pOutdoorCamera->int_fov_rad / - (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) * - (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z);//61 / 184 / 310 изменяется при наклоне камеры + v30 = ((double)(pODMRenderParams->int_fov_rad * pIndoorCamera->pos.z) + / ((double)pODMRenderParams->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 изменяется при подъёме на высоту + v38 = pViewport->uScreenCenterY - pODMRenderParams->int_fov_rad / + (pODMRenderParams->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) * + (pODMRenderParams->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z);//61 / 184 / 310 изменяется при наклоне камеры pSkyPolygon.Create_48607B(&stru_8019C8); pSkyPolygon.ptr_38->_48694B_frustum_sky();//maybe creating skydome(возможно создание купола неба) @@ -5446,16 +5445,16 @@ pShading = fixpoint_div(v34, v38); if ( pShading < 0 ) - pShading = pOutdoorCamera->shading_dist_mist; + pShading = pODMRenderParams->shading_dist_mist; v37 += ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16); screen_center_x += ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16); v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, pShading) / 8; screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(screen_center_x, pShading) / 8; - //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; + //array_50AC10[i].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist; //array_50AC10[i].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0); - //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); + //array_50AC10[i].vWorldPosition.y = 1.0 / (pODMRenderParams->shading_dist_mist >> 16); //array_50AC10[i].vWorldPosition.z = v35 / (pSky.pTexture->uTextureWidth * 65536.0); //array_50AC10[i]._rhw = 1.0f / (pShading >> 16); //array_50AC10[i].u = (double)v35 / (65536.0 * pSkyPolygon.pTexture->uTextureWidth); @@ -5478,7 +5477,7 @@ } //----- (0047A384) -------------------------------------------------------- -void ODM_LoadAndInitialize(const char *pLevelFilename, OutdoorCamera *thisa) +void ODM_LoadAndInitialize(const char *pLevelFilename, ODMRenderParams *thisa) { int v2; // ebx@3 unsigned int v3; // eax@3 @@ -5495,10 +5494,10 @@ pFilename = pLevelFilename; //thisa->AllocSoftwareDrawBuffers(); - pOutdoorCamera->_485F64(); + pODMRenderParams->Initialize(); pWeather->bRenderSnow = false; pRenderer->ClearZBuffer(0, 479); - thisa = (OutdoorCamera *)1; + thisa = (ODMRenderParams *)1; GetAlertStatus(); if ( qword_A750D8 ) qword_A750D8 = 0; @@ -5529,7 +5528,7 @@ //v5 = 0; if ( !v2 ) thisa = 0; - if ( thisa == (OutdoorCamera *)1 ) + if ( thisa == (ODMRenderParams *)1 ) { //v13 = 0; for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i) @@ -5562,10 +5561,10 @@ pWeather->Initialize(); pIndoorCamera->sRotationY = pParty->sRotationY; pIndoorCamera->sRotationX = pParty->sRotationX; - pOutdoorCamera->RotationToInts(); + pODMRenderParams->RotationToInts(); pOutdoor->UpdateSunlightVectors(); - pOutdoorCamera->int_fov_rad = (signed __int64)pIndoorCamera->flt_1C_fov; - pOutdoorCamera->int_fov_rad_inv = (signed __int64)pIndoorCamera->flt_20_inv_1C; + pODMRenderParams->int_fov_rad = (signed __int64)pIndoorCamera->flt_1C_fov; + pODMRenderParams->int_fov_rad_inv = (signed __int64)pIndoorCamera->flt_20_inv_1C; for (int i = 0; i < 20000; ++i) { @@ -5796,7 +5795,7 @@ float fog_density_mult = 216.0f; if (a4) - fog_density_mult += distance / (double)pOutdoorCamera->shading_dist_shade * 32.0; + fog_density_mult += distance / (double)pODMRenderParams->shading_dist_shade * 32.0; v6 = v11 + floorf(pOutdoor->fFogDensity * fog_density_mult + 0.5f); /*if ( a4 ) @@ -5807,7 +5806,7 @@ } else { - //a3a = (distance / (double)pOutdoorCamera->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; + //a3a = (distance / (double)pODMRenderParams->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; //v13 = a3a + 6.7553994e15; //a4a = floorf(a3a + 0.5f);//LODWORD(v13); } @@ -5881,15 +5880,15 @@ //----- (00481ED9) -------------------------------------------------------- -void sub_481ED9_MessWithOutdoorCamera() +void sub_481ED9_MessWithODMRenderParams() { stru_8019C8._48616B_frustum_odm(65536, 0, 0, 0, 65536, 0); - pOutdoorCamera->uNumPolygons = 0; - pOutdoorCamera->uNumEdges = 0; - pOutdoorCamera->uNumSpans = 0; - pOutdoorCamera->uNumSurfs = 0; - pOutdoorCamera->uNumBillboards = 0; - pOutdoorCamera->field_44 = 0; + pODMRenderParams->uNumPolygons = 0; + pODMRenderParams->uNumEdges = 0; + pODMRenderParams->uNumSpans = 0; + pODMRenderParams->uNumSurfs = 0; + pODMRenderParams->uNumBillboards = 0; + pODMRenderParams->field_44 = 0; } //----- (004823F4) -------------------------------------------------------- @@ -6132,18 +6131,18 @@ //int v28; // [sp+30h] [bp+8h]@10 //int v29; // [sp+3Ch] [bp+14h]@10 - v25 = pOutdoorCamera->camera_rotation_x_int_cosine; - v7 = pOutdoorCamera->camera_rotation_y_int_sine; - v27 = pOutdoorCamera->camera_rotation_x_int_sine; + v25 = pODMRenderParams->camera_rotation_x_int_cosine; + v7 = pODMRenderParams->camera_rotation_y_int_sine; + v27 = pODMRenderParams->camera_rotation_x_int_sine; //v8 = -pIndoorCamera->pos.y; - v9 = pOutdoorCamera->camera_rotation_y_int_cosine; + v9 = pODMRenderParams->camera_rotation_y_int_cosine; //v26 = -pIndoorCamera->pos.z; - v11 = pOutdoorCamera->camera_rotation_y_int_cosine * -pIndoorCamera->pos.x + pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.y; - v24 = pOutdoorCamera->camera_rotation_y_int_cosine * -pIndoorCamera->pos.y - pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.x; + v11 = pODMRenderParams->camera_rotation_y_int_cosine * -pIndoorCamera->pos.x + pODMRenderParams->camera_rotation_y_int_sine * -pIndoorCamera->pos.y; + v24 = pODMRenderParams->camera_rotation_y_int_cosine * -pIndoorCamera->pos.y - pODMRenderParams->camera_rotation_y_int_sine * -pIndoorCamera->pos.x; if ( pIndoorCamera->sRotationX ) { - this->field_0_party_dir_x = fixpoint_sub0(v11, pOutdoorCamera->camera_rotation_x_int_cosine) + - fixpoint_sub0((-pIndoorCamera->pos.z) << 16, pOutdoorCamera->camera_rotation_x_int_sine); + this->field_0_party_dir_x = fixpoint_sub0(v11, pODMRenderParams->camera_rotation_x_int_cosine) + + fixpoint_sub0((-pIndoorCamera->pos.z) << 16, pODMRenderParams->camera_rotation_x_int_sine); this->field_4_party_dir_y = v24; this->field_8_party_dir_z = fixpoint_sub0((-pIndoorCamera->pos.z) << 16, v25) - fixpoint_sub0(v11, v27); } @@ -7338,7 +7337,7 @@ v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001); v->_rhw = v1; - v2 = v1 * (double)pOutdoorCamera->int_fov_rad; + v2 = v1 * (double)pODMRenderParams->int_fov_rad; v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y; v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z; } diff -r 384a6b9d1333 -r 2c71fa8913d2 mm7_4.cpp --- a/mm7_4.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/mm7_4.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -7,7 +7,6 @@ #include "VideoPlayer.h" #include "Sprites.h" #include "BSPModel.h" -#include "OutdoorCamera.h" #include "Mouse.h" #include "stru6.h" diff -r 384a6b9d1333 -r 2c71fa8913d2 mm7_5.cpp --- a/mm7_5.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/mm7_5.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -8,7 +8,6 @@ #include "Sprites.h" #include "MapInfo.h" #include "BSPModel.h" -#include "OutdoorCamera.h" #include "LightmapBuilder.h" #include "DecalBuilder.h" #include "Mouse.h" @@ -1746,7 +1745,7 @@ } if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv") ) bNoNPCHiring = 1; - PrepareToLoadODM(1u, (OutdoorCamera *)1); + PrepareToLoadODM(1u, (ODMRenderParams *)1); pAudioPlayer->SetMapEAX(); bDialogueUI_InitializeActor_NPC_ID = 0; OnMapLoad(); @@ -3585,15 +3584,6 @@ } } -//----- (00436427) -------------------------------------------------------- -double get_shading_dist_mist() -{ - if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - return (double)pOutdoorCamera->shading_dist_mist; - else - return 16192.0; -} - //----- (0043648F) -------------------------------------------------------- void Vec3_short__to_RenderVertexSoft(RenderVertexSoft *_this, Vec3_short_ *a2) { diff -r 384a6b9d1333 -r 2c71fa8913d2 mm7_6.cpp --- a/mm7_6.cpp Tue Sep 17 12:40:37 2013 +0200 +++ b/mm7_6.cpp Tue Sep 17 14:10:41 2013 +0200 @@ -9,7 +9,6 @@ #include "Weather.h" #include "Sprites.h" #include "BSPModel.h" -#include "OutdoorCamera.h" #include "Mouse.h" #include "Keyboard.h" #include "stru6.h" @@ -76,7 +75,7 @@ char *v28; // [sp+30h] [bp-4h]@4 v1 = uVertexID; - v2 = (double)pOutdoorCamera->shading_dist_mist; + v2 = (double)pODMRenderParams->shading_dist_mist; memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); v3 = 0; v22 = 0; diff -r 384a6b9d1333 -r 2c71fa8913d2 mm7_data.h --- a/mm7_data.h Tue Sep 17 12:40:37 2013 +0200 +++ b/mm7_data.h Tue Sep 17 14:10:41 2013 +0200 @@ -1181,7 +1181,7 @@ bool Initialize_GamesLOD_NewLOD(); void SaveNewGame(); void PrepareToLoadBLV(unsigned int bLoading); -void __fastcall PrepareToLoadODM(unsigned int bLoading, struct OutdoorCamera *a2); +void __fastcall PrepareToLoadODM(unsigned int bLoading, struct ODMRenderParams *a2); void _461103_load_level_sub(); void MainMenu_Loop(); char sub_4637E0_is_there_popup_onscreen(); @@ -1236,7 +1236,7 @@ bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx); void UIShop_Buy_Identify_Repair(); bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused); -void ODM_LoadAndInitialize(const char *pLevelFilename, struct OutdoorCamera *thisa); +void ODM_LoadAndInitialize(const char *pLevelFilename, struct ODMRenderParams *thisa); unsigned int GetLevelFogColor(); int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3); int __fastcall GetActorTintColor(int max_dim, int min_dim, float distance, int a4, struct RenderBillboard *a5); @@ -1244,7 +1244,7 @@ unsigned int WorldPosToGridCellZ(int); // weak int GridCellToWorldPosX(int); // weak int GridCellToWorldPosZ(int); // weak -void sub_481ED9_MessWithOutdoorCamera(); +void sub_481ED9_MessWithODMRenderParams(); bool IsTerrainSlopeTooHigh(int pos_x, int pos_y); int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4); void sub_487DA9();