Mercurial > mm7
changeset 1640:afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
author | Nomad |
---|---|
date | Tue, 17 Sep 2013 17:40:59 +0200 |
parents | b60ddd777d50 |
children | 466c5e15f524 |
files | Actor.cpp AudioPlayer.cpp GUIWindow.cpp Game.cpp Indoor.cpp Indoor.h IndoorCameraD3D.cpp IndoorCameraD3D.h Math.h Outdoor.cpp Outdoor_stuff.h ParticleEngine.cpp Render.cpp UI/UIHouses.cpp UI/UISaveLoad.cpp Vis.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_data.cpp mm7_data.h stru10.cpp |
diffstat | 22 files changed, 376 insertions(+), 462 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/Actor.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -2927,12 +2927,7 @@ actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Bored]].uAnimLength; - if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - v7 = stru_5C6E00->Atan2(actor->vPosition.x - pODMRenderParams->vPartyPos.x, actor->vPosition.y - pODMRenderParams->vPartyPos.y); - else if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - v7 = stru_5C6E00->Atan2(actor->vPosition.x - pBLVRenderParams->vPartyPos.x, actor->vPosition.y - pBLVRenderParams->vPartyPos.y); - else Error("(%u)", uCurrentlyLoadedLevelType); - + v7 = stru_5C6E00->Atan2(actor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, actor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); v9 = stru_5C6E00->uIntegerPi + actor->uYawAngle + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v7; if ( BYTE1(v9) & 7 ) // turned away - just stand
--- a/AudioPlayer.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/AudioPlayer.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -1498,7 +1498,7 @@ v17 = pBLVRenderParams->fSineNegX; v55 = pBLVRenderParams->fCosineY; v56 = pBLVRenderParams->fSineY; - if ( pBLVRenderParams->sPartyRotX ) + if (pGame->pIndoorCameraD3D->sRotationX) { v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
--- a/GUIWindow.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/GUIWindow.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -26,7 +26,7 @@ #include "Awards.h" #include "Chest.h" #include "Outdoor.h" -#include "Outdoor_stuff.h" +#include "Game.h" #include "mm7_data.h" @@ -297,16 +297,8 @@ dword_5C35D4 = 0; if ( bFlipOnExit ) { - /*pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi - + pIndoorCamera->sRotationY); - pParty->sRotationY = pIndoorCamera->sRotationY;*/ - pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi + pParty->sRotationY); - if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - pBLVRenderParams->sPartyRotY = pParty->sRotationY; - else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - pODMRenderParams->rotation_y = pParty->sRotationY; - else Error("(%u)", uCurrentlyLoadedLevelType); + pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; } pParty->uFlags |= 2u; break;
--- a/Game.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/Game.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -74,53 +74,25 @@ if ( pParty->_497FC5_check_party_perception_against_level() ) uFlags2 |= 2u; - if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - { - pBLVRenderParams->sPartyRotX = pParty->sRotationX; - pBLVRenderParams->sPartyRotY = pParty->sRotationY; - pBLVRenderParams->vPartyPos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * 3.141592653589 * pBLVRenderParams->sPartyRotY / 2048.0); - pBLVRenderParams->vPartyPos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * 3.141592653589 * pBLVRenderParams->sPartyRotY / 2048.0); - pBLVRenderParams->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353 - } - else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - pODMRenderParams->rotation_x = pParty->sRotationX; - pODMRenderParams->rotation_y = pParty->sRotationY; - pODMRenderParams->vPartyPos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * 3.141592653589 * pODMRenderParams->rotation_y / 2048.0); - pODMRenderParams->vPartyPos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * 3.141592653589 * pODMRenderParams->rotation_y / 2048.0); - pODMRenderParams->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353 - } + pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX; + pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; + pGame->pIndoorCameraD3D->vPartyPos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * 3.141592653589 * pParty->sRotationY / 2048.0); + pGame->pIndoorCameraD3D->vPartyPos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * 3.141592653589 * pParty->sRotationY / 2048.0); + pGame->pIndoorCameraD3D->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353 //pIndoorCamera->Initialize2(); { - float fRotationYSine = sin((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationY * 0.00048828125); - float fRotationYCosine = cos((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationY * 0.00048828125); - float fRotationXSine; - float fRotationXCosine; + pIndoorCameraD3D->fRotationYSine = sin((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationY / 2048.0); + pIndoorCameraD3D->fRotationYCosine = cos((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationY / 2048.0); if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor) { - fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)-pParty->sRotationX * 0.00048828125); - fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)-pParty->sRotationX* 0.00048828125); + pIndoorCameraD3D->fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)-pParty->sRotationX / 2048.0); + pIndoorCameraD3D->fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)-pParty->sRotationX / 2048.0); } else { - fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationX * 0.00048828125); - fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationX * 0.00048828125); - } - - if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - { - pBLVRenderParams->fRotationYSine = fRotationYSine; - pBLVRenderParams->fRotationYCosine = fRotationYCosine; - pBLVRenderParams->fRotationXSine = fRotationXSine; - pBLVRenderParams->fRotationXCosine = fRotationXCosine; - } - else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - pODMRenderParams->fRotationYSine = fRotationYSine; - pODMRenderParams->fRotationYCosine = fRotationYCosine; - pODMRenderParams->fRotationXSine = fRotationXSine; - pODMRenderParams->fRotationXCosine = fRotationXCosine; + pIndoorCameraD3D->fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationX / 2048.0); + pIndoorCameraD3D->fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)pParty->sRotationX / 2048.0); } } pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff();
--- a/Indoor.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/Indoor.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -112,7 +112,6 @@ pMobileLightsStack->uNumLightsActive = 0; //uNumMobileLightsApplied = 0; uNumDecorationsDrawnThisFrame = 0; - _unused000 = 0; uNumSpritesDrawnThisFrame = 0; uNumBillboardsToDraw = 0; @@ -126,9 +125,9 @@ //LOBYTE(v1) = byte_4E94D0; //v4 = pParty->flt_TorchlightColorR + 6.7553994e15; //v3 = pParty->flt_TorchlightColorG + 6.7553994e15; - pMobileLightsStack->AddLight(pBLVRenderParams->vPartyPos.x, - pBLVRenderParams->vPartyPos.y, - pBLVRenderParams->vPartyPos.z, + pMobileLightsStack->AddLight(pGame->pIndoorCameraD3D->vPartyPos.x, + pGame->pIndoorCameraD3D->vPartyPos.y, + pGame->pIndoorCameraD3D->vPartyPos.z, pBLVRenderParams->uPartySectorID, v5, floorf(pParty->flt_TorchlightColorR + 0.5f), @@ -167,9 +166,9 @@ int BLVRenderParams::Reset(IndoorLocation_drawstru *a2) { IndoorLocation_drawstru *v2; // ebx@1 - int v4; // ST08_4@1 - int v5; // ST04_4@1 - int v6; // ST00_4@1 + //int v4; // ST08_4@1 + //int v5; // ST04_4@1 + //int v6; // ST00_4@1 int v7; // eax@1 int v8; // ST08_4@2 int v9; // ST04_4@2 @@ -197,35 +196,38 @@ v2 = a2; this->field_0_timer_ = a2->field_0_timer; this->uFlags = a2->uFlags; - this->vPartyPos.x = a2->vPosition.x; - this->vPartyPos.y = a2->vPosition.y; - this->vPartyPos.z = a2->vPosition.z; - v4 = this->vPartyPos.z; - v5 = this->vPartyPos.y; - this->sPartyRotY = a2->sRotationY; - v6 = this->vPartyPos.x; - this->sPartyRotX = a2->sRotationX; - v7 = pIndoor->GetSector(v6, v5, v4); + //this->vPartyPos.x = a2->vPosition.x; + //this->vPartyPos.y = a2->vPosition.y; + //this->vPartyPos.z = a2->vPosition.z; + //v4 = this->vPartyPos.z; + //v5 = this->vPartyPos.y; + //this->sPartyRotY = a2->sRotationY; + //v6 = this->vPartyPos.x; + //this->sPartyRotX = a2->sRotationX; + v7 = pIndoor->GetSector(pGame->pIndoorCameraD3D->vPartyPos.x, + pGame->pIndoorCameraD3D->vPartyPos.y, + pGame->pIndoorCameraD3D->vPartyPos.z); this->uPartySectorID = v7; if ( !v7 ) { - v8 = this->vPartyPos.z; + __debugbreak(); // shouldnt happen, please provide savegame + /*v8 = this->vPartyPos.z; this->vPartyPos.x = pParty->vPosition.x; v9 = pParty->vPosition.y; v10 = this->vPartyPos.x; - this->vPartyPos.y = pParty->vPosition.y; + this->vPartyPos.y = pParty->vPosition.y;*/ this->uPartySectorID = pIndoor->GetSector(v10, v9, v8); } if ( pRenderer->pRenderD3D ) { - this->sCosineY = stru_5C6E00->Cos(this->sPartyRotY); - this->sSineY = stru_5C6E00->Sin(this->sPartyRotY); - this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX); - this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX); - this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125); - this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125); - this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125); - this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125); + this->sCosineY = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); + this->sSineY = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); + this->sCosineNegX = stru_5C6E00->Cos(-pGame->pIndoorCameraD3D->sRotationX); + this->sSineNegX = stru_5C6E00->Sin(-pGame->pIndoorCameraD3D->sRotationX); + this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); + this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); + this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); + this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); this->field_64 = a2->field_3C; v11 = this->uViewportW; v12 = this->uViewportX; @@ -240,7 +242,8 @@ } else { - this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY); + __debugbreak(); // no sw + /*this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY); this->sSineY = stru_5C6E00->Sin(-this->sPartyRotY); this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX); this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX); @@ -263,7 +266,7 @@ v29 = v25; v26 = this->field_64; this->uViewportCenterX = (signed int)(v24 + v23) >> 1; - this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16); + this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);*/ } v27 = (unsigned int)(signed __int64)((double)this->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329) + 0.5) << 16; @@ -699,16 +702,16 @@ if (nodes[node_id].uFaceID == uFaceID) return; if (!node_id && - pBLVRenderParams->vPartyPos.x >= pFace->pBounding.x1 - 16 && // we are probably standing at the portal plane - pBLVRenderParams->vPartyPos.x <= pFace->pBounding.x2 + 16 && - pBLVRenderParams->vPartyPos.y >= pFace->pBounding.y1 - 16 && - pBLVRenderParams->vPartyPos.y <= pFace->pBounding.y2 + 16 && - pBLVRenderParams->vPartyPos.z >= pFace->pBounding.z1 - 16 && - pBLVRenderParams->vPartyPos.z <= pFace->pBounding.z2 + 16 ) + pGame->pIndoorCameraD3D->vPartyPos.x >= pFace->pBounding.x1 - 16 && // we are probably standing at the portal plane + pGame->pIndoorCameraD3D->vPartyPos.x <= pFace->pBounding.x2 + 16 && + pGame->pIndoorCameraD3D->vPartyPos.y >= pFace->pBounding.y1 - 16 && + pGame->pIndoorCameraD3D->vPartyPos.y <= pFace->pBounding.y2 + 16 && + pGame->pIndoorCameraD3D->vPartyPos.z >= pFace->pBounding.z1 - 16 && + pGame->pIndoorCameraD3D->vPartyPos.z <= pFace->pBounding.z2 + 16 ) { - if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x - + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y - + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane + if ( abs(pFace->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x + + pGame->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + + pGame->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane { pTransitionSector = pFace->uSectorID; if ( nodes[0].uSectorID == pTransitionSector ) // draw back sector @@ -726,9 +729,9 @@ } } - v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) - + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) - + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z); + v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pGame->pIndoorCameraD3D->vPartyPos.x) + + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pGame->pIndoorCameraD3D->vPartyPos.y) + + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pGame->pIndoorCameraD3D->vPartyPos.z); if (nodes[node_id].uSectorID != pFace->uSectorID) v9 = -v9; if (v9 >= 0) @@ -843,16 +846,16 @@ if ( uFaceID == *((short *)v5 + 2982) ) return; if (!node_id - && pBLVRenderParams->vPartyPos.x >= v4->pBounding.x1 - 16 - && pBLVRenderParams->vPartyPos.x <= v4->pBounding.x2 + 16 - && pBLVRenderParams->vPartyPos.y >= v4->pBounding.y1 - 16 - && pBLVRenderParams->vPartyPos.y <= v4->pBounding.y2 + 16 - && pBLVRenderParams->vPartyPos.z >= v4->pBounding.z1 - 16 - && pBLVRenderParams->vPartyPos.z <= v4->pBounding.z2 + 16 ) + && pGame->pIndoorCameraD3D->vPartyPos.x >= v4->pBounding.x1 - 16 + && pGame->pIndoorCameraD3D->vPartyPos.x <= v4->pBounding.x2 + 16 + && pGame->pIndoorCameraD3D->vPartyPos.y >= v4->pBounding.y1 - 16 + && pGame->pIndoorCameraD3D->vPartyPos.y <= v4->pBounding.y2 + 16 + && pGame->pIndoorCameraD3D->vPartyPos.z >= v4->pBounding.z1 - 16 + && pGame->pIndoorCameraD3D->vPartyPos.z <= v4->pBounding.z2 + 16 ) { - if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x - + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y - + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) + if ( abs(v4->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * v4->pFacePlane_old.vNormal.x + + pGame->pIndoorCameraD3D->vPartyPos.y * v4->pFacePlane_old.vNormal.y + + pGame->pIndoorCameraD3D->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) { v6 = v21->uSectorID; if ( v3->nodes[0].uSectorID == v6 ) @@ -875,9 +878,9 @@ v5 = v20; } v8 = &pIndoor->pVertices[*v4->pVertexIDs]; - v9 = v4->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x) - + v4->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y) - + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); + v9 = v4->pFacePlane_old.vNormal.x * (v8->x - pGame->pIndoorCameraD3D->vPartyPos.x) + + v4->pFacePlane_old.vNormal.y * (v8->y - pGame->pIndoorCameraD3D->vPartyPos.y) + + v4->pFacePlane_old.vNormal.z * (v8->z - pGame->pIndoorCameraD3D->vPartyPos.z); if ( *((short *)v5 + 2004) != v4->uSectorID ) v9 = -v9; if ( v9 < 0 ) @@ -4498,7 +4501,7 @@ a2 = p->vPosition.y; a1a = p->vPosition.x; a3 = p->vPosition.z; - v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); + v4 = stru_5C6E00->Atan2(a1a - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y); LOWORD(v0) = p->uYawAngle; v5 = p->uCurrentActionAnimation; v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; @@ -4565,7 +4568,7 @@ if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) goto _continue; } - if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) + if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1a, a2, a3, &x, &y, &z, 1) || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) continue; pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); @@ -4712,8 +4715,8 @@ v24 = v4; v30 = v4->uFlags; a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier; - v6 = stru_5C6E00->Atan2(p->vPosition.x - pBLVRenderParams->vPartyPos.x, - p->vPosition.y - pBLVRenderParams->vPartyPos.y); + v6 = stru_5C6E00->Atan2(p->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, + p->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); LOWORD(v7) = p->uFacing; v8 = v30; v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7; @@ -4748,7 +4751,7 @@ v1->uParticleTrailColorB, byte_4E94D3); } - if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( + if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV( a1, a2, a3, @@ -4862,8 +4865,10 @@ pSector = &pIndoor->pSectors[node->uSectorID]; pNode = &pIndoor->pNodes[uFirstNode]; pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]]; - v5 = pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x - + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation + v5 = pFace->pFacePlane_old.dist + + pGame->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x + + pGame->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + + pGame->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation if (pFace->Portal() && pFace->uSectorID != node->uSectorID ) v5 = -v5; //v11 = v5 > 0; @@ -4972,7 +4977,7 @@ a3 = v7; v8 = v2->field_10_y_rot + ((signed int)stru_5C6E00->uIntegerPi >> 3) - - stru_5C6E00->Atan2(v6 - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); + - stru_5C6E00->Atan2(v6 - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y); v37 = pBLVRenderParams->field_0_timer_; v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7; if (pParty->bTurnBasedModeOn) @@ -4990,7 +4995,7 @@ LOBYTE(v30) = v30 | 0x80; if ( (256 << v9) & v13 ) v30 |= 4u; - if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1, a2, a3, &x, &y, &z, 1) ) + if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1, a2, a3, &x, &y, &z, 1) ) { v14 = abs(x); if ( v14 >= abs(y) ) @@ -5133,30 +5138,30 @@ //int v30; // [sp+30h] [bp+8h]@10 //int v31; // [sp+3Ch] [bp+14h]@10 - v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY); - v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY); - v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX); - v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX); + v8 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); + v29 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); + v28 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); + v9 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); //v11 = -pBLVRenderParams->vPartyPos.y; //v26 = -pBLVRenderParams->vPartyPos.x; //v27 = v9; //v12 = -pBLVRenderParams->vPartyPos.z; - if ( pBLVRenderParams->sPartyRotX ) + if (pGame->pIndoorCameraD3D->sRotationX) { - v16 = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; - v17 = -65536 * pBLVRenderParams->vPartyPos.z; - this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pBLVRenderParams->vPartyPos.z) << 16, v9); - this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; + v16 = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y; + v17 = -65536 * pGame->pIndoorCameraD3D->vPartyPos.z; + this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v9); + this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x; this->field_8_party_dir_z = fixpoint_sub0(v17, v28) - fixpoint_sub0(v16, v9); } else { - this->field_0_party_dir_x = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; - this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; - this->field_8_party_dir_z = (-pBLVRenderParams->vPartyPos.z) << 16; + this->field_0_party_dir_x = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y; + this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x; + this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16; } - if (pBLVRenderParams->sPartyRotX) + if (pGame->pIndoorCameraD3D->sRotationX) { v19 = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29); @@ -5171,7 +5176,7 @@ this->field_14 = a4; } - if (pBLVRenderParams->sPartyRotX) + if (pGame->pIndoorCameraD3D->sRotationX) { v21 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29); @@ -6463,9 +6468,9 @@ memset(&PortalFace, 0, sizeof(stru367)); //get direction the face(определение направленности фейса)********************************************************************************* - if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) - + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) - + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) + if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pGame->pIndoorCameraD3D->vPartyPos.x) + + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pGame->pIndoorCameraD3D->vPartyPos.y) + + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pGame->pIndoorCameraD3D->vPartyPos.z) < 0 ) { PortalFace.direction = true; } @@ -6498,7 +6503,7 @@ { for (uint i = 0; i < pFace->uNumVertices; ++i) { - pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(pIndoor->pVertices[pFace->pVertexIDs[i]].x, + pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pIndoor->pVertices[pFace->pVertexIDs[i]].x, pIndoor->pVertices[pFace->pVertexIDs[i]].y, pIndoor->pVertices[pFace->pVertexIDs[i]].z, &PortalFace._view_transformed_z[i + 3], &PortalFace._view_transformed_x[i + 3], &PortalFace._view_transformed_y[i + 3], 0); @@ -6866,21 +6871,21 @@ float v13; // [sp+Ch] [bp-4h]@2 float v14; // [sp+Ch] [bp-4h]@6 - if ( pBLVRenderParams->sPartyRotX ) + if (pGame->pIndoorCameraD3D->sRotationX) { v13 = a1->vWorldPosition.x - (double)pParty->vPosition.x; v11 = a1->vWorldPosition.y - (double)pParty->vPosition.y; v4 = a1->vWorldPosition.z - (double)pParty->vPosition.z; - if ( pRenderer->pRenderD3D ) - { + //if ( pRenderer->pRenderD3D ) + //{ v5 = v11 * pBLVRenderParams->fSineY + v13 * pBLVRenderParams->fCosineY; a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY - v11 * pBLVRenderParams->fCosineY; - } + /*} else { v5 = v13 * pBLVRenderParams->fCosineY - v11 * pBLVRenderParams->fSineY; a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY + v11 * pBLVRenderParams->fCosineY; - } + }*/ a1->vWorldViewPosition.x = v5 * pBLVRenderParams->fCosineNegX - v4 * pBLVRenderParams->fSineNegX; a1->vWorldViewPosition.z = v5 * pBLVRenderParams->fSineNegX + v4 * pBLVRenderParams->fCosineNegX; } @@ -6889,16 +6894,16 @@ v14 = a1->vWorldPosition.x - (double)pParty->vPosition.x; v12 = a1->vWorldPosition.y - (double)pParty->vPosition.y; a1->vWorldViewPosition.z = a1->vWorldPosition.z - (double)pParty->vPosition.z; - if ( pRenderer->pRenderD3D ) - { + //if ( pRenderer->pRenderD3D ) + //{ a1->vWorldViewPosition.x = v12 * pBLVRenderParams->fSineY + v14 * pBLVRenderParams->fCosineY; a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY - v12 * pBLVRenderParams->fCosineY; - } + /*} else { a1->vWorldViewPosition.x = v14 * pBLVRenderParams->fCosineY - v12 * pBLVRenderParams->fSineY; a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY + v12 * pBLVRenderParams->fCosineY; - } + }*/ } return 0; } \ No newline at end of file
--- a/Indoor.h Tue Sep 17 15:40:36 2013 +0200 +++ b/Indoor.h Tue Sep 17 17:40:59 2013 +0200 @@ -516,9 +516,9 @@ int field_0_timer_; int uFlags; // & INDOOR_CAMERA_DRAW_D3D_OUTLINES: render d3d outlines - Vec3_int_ vPartyPos; - int sPartyRotY; - int sPartyRotX; + Vec3_int_ _unused_vPartyPos; + int _unused_sPartyRotY; + int _unused_sPartyRotX; int uPartySectorID; int sCosineY; int sSineY; @@ -550,11 +550,6 @@ int field_8C; int field_90; int field_94; - - float fRotationYSine; // moved from 157 struct IndoorCamera::2C - float fRotationYCosine; // moved from 157 struct IndoorCamera::30 - float fRotationXSine; // moved from 157 struct IndoorCamera::34 - float fRotationXCosine; // moved from 157 struct IndoorCamera::38 }; #pragma pack(pop) extern BLVRenderParams *pBLVRenderParams;
--- a/IndoorCameraD3D.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/IndoorCameraD3D.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -6,10 +6,12 @@ #include "Outdoor_stuff.h" #include "Render.h" #include "LOD.h" +#include "Math.h" #include "mm7_data.h" #include "stru9.h" + //----- (004361EF) -------------------------------------------------------- IndoorCameraD3D::IndoorCameraD3D() { @@ -34,16 +36,16 @@ //v3 = 0;//(double)pBLVRenderParams->vPartyPos.y; //v4 = 0;//(double)pBLVRenderParams->vPartyPos.x; v1->field_108 = 0.0; - v1->blv_party_x = 0; - v1->blv_party_y = 0; - v1->blv_party_z = 0; + //v1->blv_party_x = 0; + //v1->blv_party_y = 0; + //v1->blv_party_z = 0; //v5 = 0;//(double)pBLVRenderParams->vPartyPos.z; //v6 = 0;//(double)pBLVRenderParams->vPartyPos.y; //v7 = 300;//(double)(pBLVRenderParams->vPartyPos.x + 300); v1->field_138 = 0.0; - v1->blv_party_x_2 = 300; - v1->blv_party_y_2 = 0; - v1->blv_party_z_2 = 0; + //v1->blv_party_x_2 = 300; + //v1->blv_party_y_2 = 0; + //v1->blv_party_z_2 = 0; v1->field_168 = 0.0; v1->field_198 = 0.0; v1->field_1C8 = 0.0; @@ -130,68 +132,56 @@ } //----- (0043669D) -------------------------------------------------------- -char IndoorCameraD3D::ApplyViewTransform_TrueIfStillVisible(int x, int y, int z, signed int *pOutX, int *pOutZ, int *pOutY, char bDoNotShow) +bool IndoorCameraD3D::ApplyViewTransform_TrueIfStillVisible_BLV(int x, int y, int z, signed int *pOutX, int *pOutZ, int *pOutY, char bDoNotShow) { int to_z; // esi@2 int v9; // ecx@3 - signed int *v10; // esi@5 - int pOutY_; // ecx@5 - signed int v12; // esi@7 + //signed int *v10; // esi@5 + //int pOutY_; // ecx@5 + //signed int v12; // esi@7 int v14; // [sp+8h] [bp-4h]@3 int to_x; // [sp+14h] [bp+8h]@1 int to_y; // [sp+18h] [bp+Ch]@1 int a2b; // [sp+18h] [bp+Ch]@5 int a3a; // [sp+1Ch] [bp+10h]@5 - to_x = x - pBLVRenderParams->vPartyPos.x; - to_y = y - pBLVRenderParams->vPartyPos.y; - if ( pBLVRenderParams->sPartyRotX ) + to_x = x - pGame->pIndoorCameraD3D->vPartyPos.x; + to_y = y - pGame->pIndoorCameraD3D->vPartyPos.y; + if (pGame->pIndoorCameraD3D->sRotationX) { - to_z = (z - pBLVRenderParams->vPartyPos.z) << 16; - if ( pRenderer->pRenderD3D ) - { + to_z = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; + //if ( pRenderer->pRenderD3D ) + //{ v14 = (unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) + (unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY); v9 = (unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) - (unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY); - } - else - { - v14 = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - v9 = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - } - a3a = (z - pBLVRenderParams->vPartyPos.z) << 16; + //} + a3a = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; a2b = (unsigned __int64)(to_z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - v10 = pOutX; + //v10 = pOutX; *pOutX = ((unsigned __int64)(v14 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - a2b; *pOutZ = v9; - pOutY_ = ((unsigned __int64)(v14 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) + *pOutY = ((unsigned __int64)(v14 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) + ((unsigned __int64)(a3a * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); } else { - pOutY_ = (z - pBLVRenderParams->vPartyPos.z) << 16; - if ( pRenderer->pRenderD3D ) - { - v10 = pOutX; + *pOutY = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; + //if ( pRenderer->pRenderD3D ) + //{ + //v10 = pOutX; *pOutX = (unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) + (unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY); *pOutZ = (unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) - (unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY); - } - else - { - v10 = pOutX; - *pOutX = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - *pOutZ = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - } + //} } - *pOutY = pOutY_; - return !bDoNotShow || (v12 = *v10, v12 >= (signed int)0x40000u) && v12 <= (signed int)0x1F400000u; + if (!bDoNotShow) + return false; + + return *pOutX >= fixpoint_from_int(4, 0) && + *pOutX <= fixpoint_from_int(8000, 0); } //----- (00436455) -------------------------------------------------------- @@ -204,60 +194,20 @@ } - -//----- (00481CCE) -------------------------------------------------------- -float ViewTransform_ODM(RenderVertexSoft *a1) -{ - float result; // eax@1 - double vCamToVertexZ; // st7@1 - double v3; // st6@1 - double v4; // st5@1 - double v5; // st4@1 - float v6; // ST04_4@3 - float v7; // [sp+0h] [bp-14h]@1 - float v8; // [sp+8h] [bp-Ch]@1 - float vCamToVertexX; // [sp+Ch] [bp-8h]@1 - float vCamToVertexY; // [sp+10h] [bp-4h]@1 - - v8 = pODMRenderParams->fRotationXCosine; - result = pODMRenderParams->fRotationXSine; - v7 = pODMRenderParams->fRotationXSine; - vCamToVertexX = a1->vWorldPosition.x - (double)pODMRenderParams->vPartyPos.x; - vCamToVertexY = a1->vWorldPosition.y - (double)pODMRenderParams->vPartyPos.y; - vCamToVertexZ = a1->vWorldPosition.z - (double)pODMRenderParams->vPartyPos.z; - v3 = pODMRenderParams->fRotationYCosine; - v4 = pODMRenderParams->fRotationYSine; - v5 = vCamToVertexY * pODMRenderParams->fRotationYSine + pODMRenderParams->fRotationYCosine * vCamToVertexX; - if (pODMRenderParams->rotation_x) - { - v6 = vCamToVertexY * pODMRenderParams->fRotationYSine + pODMRenderParams->fRotationYCosine * vCamToVertexX; - a1->vWorldViewPosition.x = v5 * pODMRenderParams->fRotationXCosine + pODMRenderParams->fRotationXSine * vCamToVertexZ; - a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX; - a1->vWorldViewPosition.z = v8 * vCamToVertexZ - v6 * v7; - } - else - { - a1->vWorldViewPosition.x = vCamToVertexY * pODMRenderParams->fRotationYSine + pODMRenderParams->fRotationYCosine * vCamToVertexX; - a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX; - a1->vWorldViewPosition.z = vCamToVertexZ; - } - return result; -} - //----- (00436523) -------------------------------------------------------- void IndoorCameraD3D::ViewTransform(RenderVertexSoft *a1a, unsigned int uNumVertices) { if (byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor) { - float sin_x = pBLVRenderParams->fRotationXSine, - cos_x = pBLVRenderParams->fRotationXCosine; - float sin_y = pBLVRenderParams->fRotationYSine, - cos_y = pBLVRenderParams->fRotationYCosine; + float sin_x = fRotationXSine, + cos_x = fRotationXCosine; + float sin_y = fRotationYSine, + cos_y = fRotationYCosine; //v4 = uNumVertices; //v7 = pIndoorCamera->fRotationXSine; - if (pBLVRenderParams->sPartyRotX) + if (pGame->pIndoorCameraD3D->sRotationX) { //_EAX = a1a; @@ -304,9 +254,9 @@ // 4[pIndoorCamera->fRotationYSine] // 5[pIndoorCamera->fRotationYCosine] }*/ - st0 = sin_y * (a1a[i].vWorldPosition.x - pBLVRenderParams->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pBLVRenderParams->vPartyPos.y); - st1 = cos_y * (a1a[i].vWorldPosition.x - pBLVRenderParams->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pBLVRenderParams->vPartyPos.y); - st2 = (a1a[i].vWorldPosition.z - pBLVRenderParams->vPartyPos.z); + st0 = sin_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); + st1 = cos_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); + st2 = (a1a[i].vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z); } else { @@ -372,9 +322,9 @@ // 4[pIndoorCamera->fRotationYSine] // 5[pIndoorCamera->fRotationYCosine] }*/ - st0 = cos_y * (a1a[i].vWorldPosition.y - pBLVRenderParams->vPartyPos.y) + sin_y * (a1a[i].vWorldPosition.x - pBLVRenderParams->vPartyPos.x); - st1 = cos_y * (a1a[i].vWorldPosition.x - pBLVRenderParams->vPartyPos.x) - sin_y * (a1a[i].vWorldPosition.y - pBLVRenderParams->vPartyPos.y); - st2 = (a1a[i].vWorldPosition.z - pBLVRenderParams->vPartyPos.z); + st0 = cos_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) + sin_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x); + st1 = cos_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) - sin_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); + st2 = (a1a[i].vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z); } a1a[i].vWorldViewPosition.x = st1*cos_x - st2*sin_x; @@ -438,9 +388,9 @@ fstp dword ptr [eax+10h] fstp dword ptr [eax+14h] }*/ - a1a[i].vWorldViewPosition.x = cos_y * (a1a[i].vWorldPosition.x - pBLVRenderParams->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pBLVRenderParams->vPartyPos.y); - a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pBLVRenderParams->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pBLVRenderParams->vPartyPos.y); - a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pBLVRenderParams->vPartyPos.z); + a1a[i].vWorldViewPosition.x = cos_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); + a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); + a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z); } else { @@ -468,7 +418,48 @@ } else for (uint i = 0; i < uNumVertices; ++i) //pIndoorCamera->ViewTransform_ODM(a1a + i); - ViewTransform_ODM(a1a + i); + { + //ViewTransform_ODM(a1a + i); + + auto a1 = a1a + i; + //----- (00481CCE) -------------------------------------------------------- + //void ViewTransform_ODM(RenderVertexSoft *a1) + { + float result; // eax@1 + double vCamToVertexZ; // st7@1 + double v3; // st6@1 + double v4; // st5@1 + double v5; // st4@1 + float v6; // ST04_4@3 + float v7; // [sp+0h] [bp-14h]@1 + float v8; // [sp+8h] [bp-Ch]@1 + float vCamToVertexX; // [sp+Ch] [bp-8h]@1 + float vCamToVertexY; // [sp+10h] [bp-4h]@1 + + v8 = fRotationXCosine; + result = fRotationXSine; + v7 = fRotationXSine; + vCamToVertexX = a1->vWorldPosition.x - (double)pGame->pIndoorCameraD3D->vPartyPos.x; + vCamToVertexY = a1->vWorldPosition.y - (double)pGame->pIndoorCameraD3D->vPartyPos.y; + vCamToVertexZ = a1->vWorldPosition.z - (double)pGame->pIndoorCameraD3D->vPartyPos.z; + v3 = fRotationYCosine; + v4 = fRotationYSine; + v5 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX; + if (pGame->pIndoorCameraD3D->sRotationX) + { + v6 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX; + a1->vWorldViewPosition.x = v5 * fRotationXCosine + fRotationXSine * vCamToVertexZ; + a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX; + a1->vWorldViewPosition.z = v8 * vCamToVertexZ - v6 * v7; + } + else + { + a1->vWorldViewPosition.x = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX; + a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX; + a1->vWorldViewPosition.z = vCamToVertexZ; + } + } + } } @@ -540,24 +531,10 @@ if (pFace->Portal()) return false; - float pos_x, pos_y, pos_z; - if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - { - pos_x = pBLVRenderParams->vPartyPos.x; - pos_y = pBLVRenderParams->vPartyPos.y; - pos_z = pBLVRenderParams->vPartyPos.z; - } - else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - pos_x = pODMRenderParams->vPartyPos.x; - pos_y = pODMRenderParams->vPartyPos.y; - pos_z = pODMRenderParams->vPartyPos.z; - } - //really strange cull; dot(to_cam, normal) < 0 means we see the BACK face, not font %_% - if ( (a2->vWorldPosition.z - (double)pos_z) * (double)pFace->pFacePlane_old.vNormal.z - + (a2->vWorldPosition.y - (double)pos_y) * (double)pFace->pFacePlane_old.vNormal.y - + (a2->vWorldPosition.x - (double)pos_x) * (double)pFace->pFacePlane_old.vNormal.x < 0.0) + if ( (a2->vWorldPosition.z - (double)pGame->pIndoorCameraD3D->vPartyPos.z) * (double)pFace->pFacePlane_old.vNormal.z + + (a2->vWorldPosition.y - (double)pGame->pIndoorCameraD3D->vPartyPos.y) * (double)pFace->pFacePlane_old.vNormal.y + + (a2->vWorldPosition.x - (double)pGame->pIndoorCameraD3D->vPartyPos.x) * (double)pFace->pFacePlane_old.vNormal.x < 0.0) return false; return true; @@ -911,15 +888,15 @@ m5._21 = -sinf(0); m5._22 = cosf(0); m5._23 = 0; m5._31 = 0; m5._32 = 0; m5._33 = 1; - float cos_x1 = uCurrentlyLoadedLevelType == LEVEL_Indoor ? pBLVRenderParams->fRotationXCosine : pODMRenderParams->fRotationXCosine, - sin_x1 = uCurrentlyLoadedLevelType == LEVEL_Indoor ? pBLVRenderParams->fRotationXSine : pODMRenderParams->fRotationXSine; + float cos_x1 = fRotationXCosine, + sin_x1 = fRotationXSine; //RotationX(x) m4._11 = 1; m4._12 = 0; m4._13 = 0; m4._21 = 0; m4._22 = cos_x1; m4._23 = sin_x1; m4._31 = 0; m4._32 = -sin_x1; m4._33 = cos_x1; - float cos_y1 = uCurrentlyLoadedLevelType == LEVEL_Indoor ? pBLVRenderParams->fRotationYCosine : pODMRenderParams->fRotationYCosine, - sin_y1 = uCurrentlyLoadedLevelType == LEVEL_Indoor ? pBLVRenderParams->fRotationYSine : pODMRenderParams->fRotationYSine; + float cos_y1 = fRotationYCosine, + sin_y1 = fRotationYSine; //RotationY(some_angle) m3._11 = cos_y1; m3._12 = 0; m3._13 = -sin_y1; m3._21 = 0; m3._22 = 1; m3._23 = 0; @@ -960,9 +937,9 @@ double v4; // st7@1 IndoorCameraD3D_Vec3 v8; // [sp+8h] [bp-1Ch]@1 - v8.x = (double)(uCurrentlyLoadedLevelType == LEVEL_Indoor ? pBLVRenderParams->vPartyPos.x : pODMRenderParams->vPartyPos.x); - v8.y = (double)(uCurrentlyLoadedLevelType == LEVEL_Indoor ? pBLVRenderParams->vPartyPos.y : pODMRenderParams->vPartyPos.y); - v8.z = (double)(uCurrentlyLoadedLevelType == LEVEL_Indoor ? pBLVRenderParams->vPartyPos.z : pODMRenderParams->vPartyPos.z); + v8.x = (double)pGame->pIndoorCameraD3D->vPartyPos.x; + v8.y = (double)pGame->pIndoorCameraD3D->vPartyPos.y; + v8.z = (double)pGame->pIndoorCameraD3D->vPartyPos.z; Vec3Transform(a1, a2); v4 = v8.x * a2->x + v8.y * a2->y + v8.z * a2->z; @@ -997,9 +974,9 @@ v7.x = -sin(v3); v7.y = 0.0; v7.z = cos(v3); - _437607(&v7, std__vector_000034_prolly_frustrum); + _437607(&v7, std__vector_000034_prolly_frustrum + 0); v7.x = sin(v3); - _437607(&v7, &std__vector_000034_prolly_frustrum[1]); + _437607(&v7, std__vector_000034_prolly_frustrum + 1); v5 = atan(2.0 / inv_fov * fov / (fov_y + 0.5)); //v12 = v5; //v11 = sin(v5); @@ -1040,9 +1017,9 @@ if ( (signed int)*pOutNumVertices <= 3 || ((v5 = a2, memcpy(&v18, a2, sizeof(v18)), - (v18.vWorldPosition.z - (double)pBLVRenderParams->vPartyPos.z) * thisa->face_plane.vNormal.z - + (v18.vWorldPosition.y - (double)pBLVRenderParams->vPartyPos.y) * thisa->face_plane.vNormal.y - + (v18.vWorldPosition.x - (double)pBLVRenderParams->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0), + (v18.vWorldPosition.z - (double)pGame->pIndoorCameraD3D->vPartyPos.z) * thisa->face_plane.vNormal.z + + (v18.vWorldPosition.y - (double)pGame->pIndoorCameraD3D->vPartyPos.y) * thisa->face_plane.vNormal.y + + (v18.vWorldPosition.x - (double)pGame->pIndoorCameraD3D->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0), a2_3 = 0, memcpy(&v5[v4], v5, sizeof(v5[v4])), memcpy(&v5[*pOutNumVertices + 1], &v5[1], sizeof(v5[*pOutNumVertices + 1])),
--- a/IndoorCameraD3D.h Tue Sep 17 15:40:36 2013 +0200 +++ b/IndoorCameraD3D.h Tue Sep 17 17:40:59 2013 +0200 @@ -1,5 +1,5 @@ #pragma once - +#include "VectorTypes.h" @@ -156,7 +156,7 @@ void ViewTransform(struct RenderVertexSoft *a1a, unsigned int uNumVertices); bool IsCulled(struct BLVFace *pFace); 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); + bool ApplyViewTransform_TrueIfStillVisible_BLV(int x, int y, int z, signed int *pOutX, int *pOutZ, int *pOutY, char bDoNotShow); float GetPickDepth(); float GetShadingDistMist(); @@ -173,14 +173,14 @@ float fov_x; float fov_y; float inv_fov; - float blv_party_x; - float blv_party_y; - float blv_party_z; + float _unused_blv_party_x; + float _unused_blv_party_y; + float _unused_blv_party_z; char field_E8[32]; float field_108; - float blv_party_x_2; - float blv_party_y_2; - float blv_party_z_2; + float _unused_blv_party_x_2; + float _unused_blv_party_y_2; + float _unused_blv_party_z_2; char field_118[32]; float field_138; char field_13C[44]; @@ -223,5 +223,14 @@ unsigned int list_0037C_size; IndoorCameraD3D_stru2 list_E0380[256]; int list_E0380_size; + + int sRotationY; // moved from 157 struct IndoorCamera::18 + int sRotationX; // moved from 157 struct IndoorCamera::14 + float fRotationYSine; // moved from 157 struct IndoorCamera::2C + float fRotationYCosine; // moved from 157 struct IndoorCamera::30 + float fRotationXSine; // moved from 157 struct IndoorCamera::34 + float fRotationXCosine; // moved from 157 struct IndoorCamera::38 + Vec3<int> vPartyPos; // moved from 157 struct IndoorCamera::00 + // merged from 162 struct BLVRenderParams::08 }; #pragma pack(pop) \ No newline at end of file
--- a/Math.h Tue Sep 17 15:40:36 2013 +0200 +++ b/Math.h Tue Sep 17 17:40:59 2013 +0200 @@ -30,6 +30,7 @@ __int64 fixpoint_div(int, int); __int64 fixpoint_mul(int, int); int fixpoint_from_float(float value); +int fixpoint_from_int(int lhv, int rhv); template <typename FloatType> inline int bankersRounding(
--- a/Outdoor.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/Outdoor.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -92,11 +92,6 @@ pODMRenderParams->flags |= ODM_RENDER_DRAW_D3D_OUTLINES; //INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES - pODMRenderParams->rotation_x = pParty->sRotationX; - pODMRenderParams->rotation_y = pParty->sRotationY; - pODMRenderParams->vPartyPos.x = pParty->vPosition.x - fixpoint_sub0(stru_5C6E00->Cos(pParty->sRotationY), pParty->y_rotation_granularity); - pODMRenderParams->vPartyPos.y = pParty->vPosition.y - fixpoint_sub0(stru_5C6E00->Sin(pParty->sRotationY), pParty->y_rotation_granularity); - pODMRenderParams->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel; if (bRedraw || pRenderer->pRenderD3D) { pODMRenderParams->RotationToInts(); @@ -159,7 +154,6 @@ pGame->pLightmapBuilder->uFlags &= 0xFFFFFFFEu; uNumDecorationsDrawnThisFrame = 0; - _unused000 = 0; uNumSpritesDrawnThisFrame = 0; uNumBillboardsToDraw = 0; @@ -169,7 +163,6 @@ pRenderer->DrawSpriteObjects_ODM(); pRenderer->TransformBillboardsAndSetPalettesODM(); - //sr_485F53((Vec2_int_ *)sr_6BE060.data()); } @@ -752,9 +745,9 @@ v22 = v6->vWorldViewPosition.y - v4->vWorldViewPosition.y; v23 = v6->vWorldViewPosition.z - v4->vWorldViewPosition.z; } - if ( ((double)pODMRenderParams->vPartyPos.x - v4->vWorldPosition.x) * v26 - + ((double)pODMRenderParams->vPartyPos.z - v4->vWorldPosition.z) * v25 - + ((double)pODMRenderParams->vPartyPos.y - v4->vWorldPosition.y) * v24 > 0.0 ) + if ( ((double)pGame->pIndoorCameraD3D->vPartyPos.x - v4->vWorldPosition.x) * v26 + + ((double)pGame->pIndoorCameraD3D->vPartyPos.z - v4->vWorldPosition.z) * v25 + + ((double)pGame->pIndoorCameraD3D->vPartyPos.y - v4->vWorldPosition.y) * v24 > 0.0 ) { a3b = v23 * v18 - v22 * v20; v14 = a3b + 6.7553994e15; @@ -2952,8 +2945,8 @@ z = actor->vPosition.z; } } - v8 = stru_5C6E00->Atan2(actor->vPosition.x - pODMRenderParams->vPartyPos.x, - actor->vPosition.y - pODMRenderParams->vPartyPos.y); + v8 = stru_5C6E00->Atan2(actor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, + actor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); LOWORD(v9) = actor->uYawAngle; v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7; v10 = actor->uCurrentActionAnimation; @@ -3008,15 +3001,15 @@ //LOBYTE(v16) = byte_4E94D3; pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); } - v17 = (x - pODMRenderParams->vPartyPos.x) << 16; - if (pODMRenderParams->rotation_x) + v17 = (x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; + if (pGame->pIndoorCameraD3D->sRotationX) { - v18 = (y - pODMRenderParams->vPartyPos.y) << 16; + v18 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 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 - pODMRenderParams->vPartyPos.z) << 16; + v44 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 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) @@ -3030,17 +3023,17 @@ } else { - v48 = (y - pODMRenderParams->vPartyPos.y) << 16; + v48 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 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 > pODMRenderParams->shading_dist_mist << 16 ) continue; - v23 = (unsigned __int64)(((x - pODMRenderParams->vPartyPos.x) << 16) + v23 = (unsigned __int64)(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16) * (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 - pODMRenderParams->vPartyPos.z) << 16; + v21 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; } v45 = v21; v24 = abs(v20); @@ -3122,8 +3115,6 @@ } //return result; } -// 4E94D3: using guessed type char byte_4E94D3; -// 5187E4: using guessed type int uNumSpritesDrawnThisFrame; //----- (0044C1E8) -------------------------------------------------------- bool ODMFace::HasEventHint() @@ -3661,8 +3652,8 @@ //----- (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); + camera_rotation_y_int_sine = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); + camera_rotation_y_int_cosine = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); + camera_rotation_x_int_sine = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); + camera_rotation_x_int_cosine = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); } \ No newline at end of file
--- a/Outdoor_stuff.h Tue Sep 17 15:40:36 2013 +0200 +++ b/Outdoor_stuff.h Tue Sep 17 17:40:59 2013 +0200 @@ -145,17 +145,10 @@ int outdoor_no_mist; int building_gamme; int terrain_gamma; - - int rotation_y; // moved from 157 struct IndoorCamera::18 - int rotation_x; // moved from 157 struct IndoorCamera::14 - Vec3_int_ vPartyPos; // moved from 157 struct IndoorCamera::00 + unsigned int flags; // moved from 157 struct IndoorCamera::4C unsigned int uMapGridCellX; // moved from 157 struct IndoorCamera::0C unsigned int uMapGridCellZ; // moved from 157 struct IndoorCamera::10 - float fRotationYSine; // moved from 157 struct IndoorCamera::2C - float fRotationYCosine; // moved from 157 struct IndoorCamera::30 - float fRotationXSine; // moved from 157 struct IndoorCamera::34 - float fRotationXCosine; // moved from 157 struct IndoorCamera::38 }; #pragma pack(pop) extern ODMRenderParams *pODMRenderParams;
--- a/ParticleEngine.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/ParticleEngine.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -303,9 +303,9 @@ //uParticleID = LODWORD(pParticle->z); //z_int_ = *(float *)&uParticleID + 6.7553994e15; z_int_ = floorf(pParticle->z + 0.5f); - if ( !pRenderer->pRenderD3D ) + /*if ( !pRenderer->pRenderD3D ) { - if ( pBLVRenderParams->sPartyRotX ) + if (pGame->pIndoorCameraD3D->sRotationX) { if (pParticle->type & ParticleType_Line) { @@ -420,10 +420,10 @@ return true; } return false; - } + }*/ int x; - if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( + if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV( x_int, y_int_, z_int_, @@ -506,10 +506,10 @@ //int uIDf; // [sp+58h] [bp+8h]@8 //int uIDb; // [sp+58h] [bp+8h]@9 - v3 = stru_5C6E00->Cos(pODMRenderParams->rotation_x); - v44 = stru_5C6E00->Sin(pODMRenderParams->rotation_x); - v4 = stru_5C6E00->Cos(pODMRenderParams->rotation_y); - v5 = stru_5C6E00->Sin(pODMRenderParams->rotation_y); + v3 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); + v44 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); + v4 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); + v5 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); v6 = &pParticles[uID]; if (v6->type == ParticleType_Invalid) @@ -527,11 +527,11 @@ //uIDc = (LODWORD(v8) - pIndoorCamera->pos.x) << 16; //v9 = v6->_y + 6.7553994e15; //v10 = (LODWORD(v9) - pIndoorCamera->pos.y) << 16; - v11 = fixpoint_mul(v6->x - pODMRenderParams->vPartyPos.x, v4) + fixpoint_mul(v6->y - pODMRenderParams->vPartyPos.y, v5); + v11 = fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); //HIDWORD(v8) = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5); //v12 = v6->_z + 6.7553994e15; //uIDd = (LODWORD(v12) - pIndoorCamera->pos.z) << 16; - auto _hidword_v12 = fixpoint_sub0(v11, v3) + fixpoint_mul(v6->z - pODMRenderParams->vPartyPos.z, v44); + auto _hidword_v12 = fixpoint_sub0(v11, v3) + fixpoint_mul(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v44); LODWORD(v13) = 0; HIDWORD(v13) = SLOWORD(pODMRenderParams->int_fov_rad); //v14 = v13 / _hidword_v12; @@ -539,24 +539,24 @@ //v15 = v6->_screenspace_scale; v6->uScreenSpaceX = pViewport->uScreenCenterX - ((signed int)((unsigned __int64)(v6->_screenspace_scale - * (signed __int64)(fixpoint_mul(v6->y - pODMRenderParams->vPartyPos.y, v4) - - fixpoint_mul(v6->x - pODMRenderParams->vPartyPos.x, v5))) >> 16) >> 16); + * (signed __int64)(fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) + - fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16) >> 16); v6->uScreenSpaceY = pViewport->uScreenCenterY - ((signed int)((unsigned __int64)(v6->_screenspace_scale - * (signed __int64)(fixpoint_mul(v6->z - pODMRenderParams->vPartyPos.z, v3) + * (signed __int64)(fixpoint_mul(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v3) - ((unsigned __int64)(v11 * (signed __int64)v44) >> 16))) >> 16) >> 16); v6->sZValue = _hidword_v12; } //uIDe = (v41 - pIndoorCamera->pos.x) << 16; //v47 = (LODWORD(v39) - pIndoorCamera->pos.y) << 16; - v45 = fixpoint_mul(v6->x - pODMRenderParams->vPartyPos.x, v4) + fixpoint_mul(v6->y - pODMRenderParams->vPartyPos.y, v5); + v45 = fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); //HIDWORD(v42) = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5); //uIDa = (LODWORD(v42) - pIndoorCamera->pos.z) << 16; - X_4 = fixpoint_mul(v6->z - pODMRenderParams->vPartyPos.z, v44) + fixpoint_sub0(v45, v3); + X_4 = fixpoint_mul(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v44) + fixpoint_sub0(v45, v3); if ( X_4 < 0x40000 ) return 0; - v16 = fixpoint_mul(v6->y - pODMRenderParams->vPartyPos.y, v4) - fixpoint_mul(v6->x - pODMRenderParams->vPartyPos.x, v5); - v17 = fixpoint_mul(v6->z - pODMRenderParams->vPartyPos.z, v3) - fixpoint_sub0(v45, v44); + v16 = fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); + v17 = fixpoint_mul(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v3) - fixpoint_sub0(v45, v44); } else { @@ -569,26 +569,26 @@ //v21 = v6->_z + 6.7553994e15; LODWORD(v22) = 0; HIDWORD(v22) = SLOWORD(pODMRenderParams->int_fov_rad); - auto _var_123 = fixpoint_mul(v6->x - pODMRenderParams->vPartyPos.x, v4) + fixpoint_mul(v6->y - pODMRenderParams->vPartyPos.y, v5); + auto _var_123 = fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); //v23 = v22 / _var_123; v6->_screenspace_scale = v22 / _var_123; //v24 = v6->_screenspace_scale; v6->uScreenSpaceX = pViewport->uScreenCenterX - ((signed int)((unsigned __int64)(v6->_screenspace_scale - * (signed __int64)(fixpoint_mul(v6->y - pODMRenderParams->vPartyPos.y, v4) - - fixpoint_mul(v6->x - pODMRenderParams->vPartyPos.x, v5))) >> 16) >> 16); + * (signed __int64)(fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) + - fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16) >> 16); v6->uScreenSpaceY = pViewport->uScreenCenterY - (fixpoint_mul(v6->z, v6->_screenspace_scale) >> 16); v6->sZValue = _var_123; } //uIDb = (v41 - pIndoorCamera->pos.x) << 16; //v48 = (LODWORD(v39) - pIndoorCamera->pos.y) << 16; - v26 = fixpoint_mul(v6->y - pODMRenderParams->vPartyPos.y, v5); + v26 = fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); //v27 = v26 + ((unsigned __int64)(uIDb * (signed __int64)v4) >> 16); - X_4 = v26 + fixpoint_mul(v6->x - pODMRenderParams->vPartyPos.x, v4); + X_4 = v26 + fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4); if ( X_4 < 0x40000 || X_4 > (pODMRenderParams->uPickDepth - 1000) << 16 ) return 0; v17 = v6->z; - v16 = fixpoint_mul(v6->y - pODMRenderParams->vPartyPos.y, v4) - fixpoint_mul(v6->x - pODMRenderParams->vPartyPos.x, v5); + v16 = fixpoint_mul(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - fixpoint_mul(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); } v40 = v17; v28 = abs(v16);
--- a/Render.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/Render.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -516,7 +516,7 @@ //v28 = v4; v36 = v4->uFlags; a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier; - v6 = stru_5C6E00->Atan2(object->vPosition.x - pODMRenderParams->vPartyPos.x, object->vPosition.y - pODMRenderParams->vPartyPos.y); + v6 = stru_5C6E00->Atan2(object->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, object->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); //LOWORD(v7) = object->uFacing; //v8 = v36; v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; @@ -542,15 +542,15 @@ //LOBYTE(v11) = byte_4E94D3; pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); } - v12 = (x - pODMRenderParams->vPartyPos.x) << 16; - if (pODMRenderParams->rotation_x) + v12 = (x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; + if (pGame->pIndoorCameraD3D->sRotationX) { - v13 = (y - pODMRenderParams->vPartyPos.y) << 16; + v13 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 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 - pODMRenderParams->vPartyPos.z) << 16; + v33 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 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; @@ -566,17 +566,17 @@ } else { - v34 = (y - pODMRenderParams->vPartyPos.y) << 16; + v34 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 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 <= pODMRenderParams->shading_dist_mist << 16 ) { - v21 = (unsigned __int64)(((x - pODMRenderParams->vPartyPos.x) << 16) * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16; + v21 = (unsigned __int64)(((x - pGame->pIndoorCameraD3D->vPartyPos.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 - pODMRenderParams->vPartyPos.z) << 16; + v18 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; LABEL_29: v31 = v18; v22 = abs(v17); @@ -996,8 +996,8 @@ //v9 = v8; v42 = v8->uFlags; a5 = v8->uGlowRadius; - v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pODMRenderParams->vPartyPos.x, - decor->vPosition.y - pODMRenderParams->vPartyPos.y); + v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, + decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); v11 = *((int *)v0 + 2); v37 = v10; v12 = v42; @@ -1040,16 +1040,16 @@ v16, byte_4E94D0); } - v17 = (decor->vPosition.x - pODMRenderParams->vPartyPos.x) << 16; - if (pODMRenderParams->rotation_x) + v17 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; + if (pGame->pIndoorCameraD3D->sRotationX) { - v40 = (decor->vPosition.y - pODMRenderParams->vPartyPos.y) << 16; + v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 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)pODMRenderParams->camera_rotation_y_int_sine) >> 16; a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16; - v40 = (decor->vPosition.z - pODMRenderParams->vPartyPos.z) << 16; + v40 = (decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 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); @@ -1125,8 +1125,8 @@ } else { - v42 = (decor->vPosition.x - pODMRenderParams->vPartyPos.x) << 16; - v40 = (decor->vPosition.y - pODMRenderParams->vPartyPos.y) << 16; + v42 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; + v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 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); @@ -1137,7 +1137,7 @@ 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 - pODMRenderParams->vPartyPos.z) << 16; + v22 = (decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; goto LABEL_30; } } @@ -5102,13 +5102,13 @@ LODWORD(v80) = uNumVertices; do { - v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x; + v69 = (GetTickCount() >> 5) - pGame->pIndoorCameraD3D->vPartyPos.x; *(float *)v54 = (double)v69 + *(float *)v54; *(float *)v54 = *(float *)v54 * 0.25; v55 = GetTickCount(); v54 += 48; v44 = LODWORD(v80)-- == 1; - v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5); + v68 = pGame->pIndoorCameraD3D->vPartyPos.y + (v55 >> 5); *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25; } while ( !v44 ); @@ -5121,14 +5121,14 @@ pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0); return; } - HIDWORD(v69) = pBLVRenderParams->sPartyRotX; - HIDWORD(v68) = pBLVRenderParams->vPartyPos.z; + HIDWORD(v69) = pGame->pIndoorCameraD3D->sRotationX; + HIDWORD(v68) = pGame->pIndoorCameraD3D->vPartyPos.z; *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; - v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z) + v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pGame->pIndoorCameraD3D->vPartyPos.z) / (((double)pBLVRenderParams->field_40 + 16192.0) * 65536.0) + *(float *)&v74); - v5 = (double)pBLVRenderParams->sPartyRotX * 0.0030664064; + v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064; *(float *)&v75 = v5; v80 = cos(v5) * 16192.0; v6 = (signed __int64)(*(float *)&v74 @@ -5145,10 +5145,10 @@ v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0); if ( !v62.pTexture ) return; - v8 = pBLVRenderParams->sPartyRotX; + v8 = pGame->pIndoorCameraD3D->sRotationX; v62.dimming_level = 0; v62.uNumVertices = v3; - v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); + v9 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16); v62.v_18.y = 0; v62.v_18.x = -v9; v62.v_18.z = -stru_5C6E00->Cos(v8 + 16);
--- a/UI/UIHouses.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/UI/UIHouses.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -2069,10 +2069,7 @@ } else { - if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - pODMRenderParams->rotation_y = 0; - else if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - pBLVRenderParams->sPartyRotY = 0; + pGame->pIndoorCameraD3D->sRotationY = 0; pParty->uFlags |= 2u; pParty->vPosition.x = pTravel->arrival_x;
--- a/UI/UISaveLoad.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/UI/UISaveLoad.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -79,7 +79,7 @@ v3 = uTextureID_LS_loadU; } pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v3)); - pRenderer->DrawTextureIndexed (18, 139, pIcons_LOD->GetTexture(v2)); + pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(v2)); pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); v1 = 255; } @@ -147,7 +147,7 @@ auto ampm = aAMPMNames[HIDWORD(pAMPM2)]; auto month = aMonthNames[pMonthNum]; //sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID); - sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear); + sprintfex(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear); pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3u); v1 = 255; }
--- a/Vis.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/Vis.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -880,32 +880,17 @@ int outx; int outz; // [sp+94h] [bp-Ch]@1 int outy; // [sp+98h] [bp-8h]@1 + + pRotY = pGame->pIndoorCameraD3D->sRotationY + UnprojectX(fMouseX); + pRotX = pGame->pIndoorCameraD3D->sRotationX + UnprojectY(fMouseY); - if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - { - pRotY = pBLVRenderParams->sPartyRotY + UnprojectX(fMouseX); - pStartR.z = pBLVRenderParams->vPartyPos.z; - pStartR.x = pBLVRenderParams->vPartyPos.x; - pStartR.y = pBLVRenderParams->vPartyPos.y; - pRotX = pBLVRenderParams->sPartyRotX + UnprojectY(fMouseY); - - v11[1].vWorldPosition.x = (double)pBLVRenderParams->vPartyPos.x; - v11[1].vWorldPosition.y = (double)pBLVRenderParams->vPartyPos.y; - v11[1].vWorldPosition.z = (double)pBLVRenderParams->vPartyPos.z; - } - else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - pRotY = pODMRenderParams->rotation_y + UnprojectX(fMouseX); - pStartR.z = pODMRenderParams->vPartyPos.z; - pStartR.x = pODMRenderParams->vPartyPos.x; - pStartR.y = pODMRenderParams->vPartyPos.y; - pRotX = pODMRenderParams->rotation_x + UnprojectY(fMouseY); + pStartR.z = pGame->pIndoorCameraD3D->vPartyPos.z; + pStartR.x = pGame->pIndoorCameraD3D->vPartyPos.x; + pStartR.y = pGame->pIndoorCameraD3D->vPartyPos.y; - v11[1].vWorldPosition.x = (double)pODMRenderParams->vPartyPos.x; - v11[1].vWorldPosition.y = (double)pODMRenderParams->vPartyPos.y; - v11[1].vWorldPosition.z = (double)pODMRenderParams->vPartyPos.z; - } - else Error("Invalid level type (%u)", uCurrentlyLoadedLevelType); + v11[1].vWorldPosition.x = (double)pGame->pIndoorCameraD3D->vPartyPos.x; + v11[1].vWorldPosition.y = (double)pGame->pIndoorCameraD3D->vPartyPos.y; + v11[1].vWorldPosition.z = (double)pGame->pIndoorCameraD3D->vPartyPos.z; pDepth = fixpoint_from_float(fPickDepth); Vec3_int_::Rotate(pDepth, pRotY, pRotX, pStartR, &outx, &outy, &outz);
--- a/mm7_2.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/mm7_2.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -2892,7 +2892,7 @@ // 6BE35C: using guessed type int uLevel_StartingPointType; //----- (00461103) -------------------------------------------------------- -void _461103_load_level_sub() +void _461103_load_level_sub() { //GUIProgressBar *v0; // ebx@1 //signed int v1; // ebp@1 @@ -3050,11 +3050,11 @@ pGameLoadingUI_ProgressBar->Progress(); - pODMRenderParams->vPartyPos.x = 0; - pODMRenderParams->vPartyPos.y = 0; - pODMRenderParams->vPartyPos.z = 100; - pODMRenderParams->rotation_y = 0; - pODMRenderParams->rotation_x = 0; + pGame->pIndoorCameraD3D->vPartyPos.x = 0; + pGame->pIndoorCameraD3D->vPartyPos.y = 0; + pGame->pIndoorCameraD3D->vPartyPos.z = 100; + pGame->pIndoorCameraD3D->sRotationX = 0; + pGame->pIndoorCameraD3D->sRotationY = 0; viewparams->bRedrawGameUI = true; uLevel_StartingPointType = MapStartPoint_Party; pSprites_LOD->_461397(); @@ -5036,7 +5036,7 @@ assert(sizeof(stru6) == 0x5F8); assert(sizeof(IndoorCameraD3D_Vec3) == 0x10); assert(sizeof(IndoorCameraD3D_Vec4) == 0x18); //should be 14 (10 vec3 + 4 vdtor) but 18 coz of his +4 from own vdtor, but it is odd since vdtor already present from vec3 - assert(sizeof(IndoorCameraD3D) == 0x1A1384); + //assert(sizeof(IndoorCameraD3D) == 0x1A1384); assert(sizeof(StationaryLight) == 0xC); assert(sizeof(LightsStack_StationaryLight_) == 0x12C8); assert(sizeof(MobileLight) == 0x12);
--- a/mm7_3.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/mm7_3.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -4061,41 +4061,41 @@ v4 = *(float *)(v3 - 4); LODWORD(v37) = *(int *)v3; LODWORD(v36) = *(int *)(v3 + 4); - if ( pBLVRenderParams->sPartyRotX ) + if (pGame->pIndoorCameraD3D->sRotationX) { - v5 = v4 - (double)pBLVRenderParams->vPartyPos.x; - v6 = v37 - (double)pBLVRenderParams->vPartyPos.y; - if ( pRenderer->pRenderD3D ) - { + v5 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x; + v6 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; + //if ( pRenderer->pRenderD3D ) + //{ v41 = pBLVRenderParams->fSineY * v6 + pBLVRenderParams->fCosineY * v5; v7 = pBLVRenderParams->fSineY * v5 - pBLVRenderParams->fCosineY * v6; - } + /*} else { v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6; v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6; - } + }*/ v8 = v7; - v9 = v36 - (double)pBLVRenderParams->vPartyPos.z; + v9 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; v10 = pBLVRenderParams->fCosineNegX * v41 - pBLVRenderParams->fSineNegX * v9; v11 = v8; v12 = pBLVRenderParams->fCosineNegX * v9 + pBLVRenderParams->fSineNegX * v41; } else { - v42 = v4 - (double)pBLVRenderParams->vPartyPos.x; - v39 = v37 - (double)pBLVRenderParams->vPartyPos.y; - if ( pRenderer->pRenderD3D ) - { + v42 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x; + v39 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; + //if ( pRenderer->pRenderD3D ) + //{ v10 = pBLVRenderParams->fSineY * v39 + pBLVRenderParams->fCosineY * v42; v11 = pBLVRenderParams->fSineY * v42 - pBLVRenderParams->fCosineY * v39; - } + /*} else { v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39; v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39; - } - v12 = v36 - (double)pBLVRenderParams->vPartyPos.z; + }*/ + v12 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; } v13 = v12; ++v2; @@ -4115,29 +4115,29 @@ v31 = 3; do { - v40 = (double)stru_5C6E00->Cos(pODMRenderParams->rotation_x) * 0.0000152587890625; - v32 = (double)stru_5C6E00->Sin(pODMRenderParams->rotation_x) * 0.0000152587890625; - v34 = (double)stru_5C6E00->Cos(pODMRenderParams->rotation_y) * 0.0000152587890625; - v33 = (double)stru_5C6E00->Sin(pODMRenderParams->rotation_y) * 0.0000152587890625; + v40 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625; + v32 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625; + v34 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625; + v33 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625; //v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y); LODWORD(v38) = *(int *)v15; //UNDEF(v17); - v20 = *((float *)v15 - 1) - (double)pODMRenderParams->vPartyPos.x; + v20 = *((float *)v15 - 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.x; //if ( v19 | v18 ) - if (pODMRenderParams->vPartyPos.x == 0) + if (pGame->pIndoorCameraD3D->vPartyPos.x == 0) { v27 = v20; LODWORD(v35) = *((int *)v15 + 1); - v28 = v38 - (double)pODMRenderParams->vPartyPos.y; + v28 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; v25 = v33 * v28 + v34 * v27; v26 = v34 * v28 - v33 * v27; } else { v21 = v20; - v22 = v38 - (double)pODMRenderParams->vPartyPos.y; + v22 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; v23 = v33 * v22 + v34 * v21; - v24 = *((float *)v15 + 1) - (double)pODMRenderParams->vPartyPos.z; + v24 = *((float *)v15 + 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.z; v25 = v32 * v24 + v40 * v23; v26 = v34 * v22 - v33 * v21; v35 = v40 * v24 - v32 * v23; @@ -4710,15 +4710,15 @@ angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 >> 1; //v14 = uModelID; v2 = &pOutdoor->pBModels[uModelID]; - v3 = v2->vBoundingCenter.x - pODMRenderParams->vPartyPos.x; - v4 = v2->vBoundingCenter.y - pODMRenderParams->vPartyPos.y; - v5 = stru_5C6E00->Cos(pODMRenderParams->rotation_y); - v21 = stru_5C6E00->Sin(pODMRenderParams->rotation_y); - v18 = stru_5C6E00->Cos(pODMRenderParams->rotation_x); - stru_5C6E00->Sin(pODMRenderParams->rotation_x); + v3 = v2->vBoundingCenter.x - pGame->pIndoorCameraD3D->vPartyPos.x; + v4 = v2->vBoundingCenter.y - pGame->pIndoorCameraD3D->vPartyPos.y; + v5 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); + v21 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); + v18 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); + stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); v6 = v5; v17 = v3 * v5 + v4 * v21; - if (pODMRenderParams->rotation_x) + if (pGame->pIndoorCameraD3D->sRotationX) v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16; v19 = v4 * v6 - v3 * v21; v7 = abs(v4); @@ -5308,11 +5308,11 @@ return; } - v30 = ((double)(pODMRenderParams->int_fov_rad * pODMRenderParams->vPartyPos.z) + v30 = ((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z) / ((double)pODMRenderParams->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 изменяется при подъёме на высоту v38 = pViewport->uScreenCenterY - pODMRenderParams->int_fov_rad / - (pODMRenderParams->shading_dist_mist * cos(pODMRenderParams->rotation_x * 0.003066406352445483) + 0.0000001000000011686097) * - (pODMRenderParams->shading_dist_mist * -sin(pODMRenderParams->rotation_x * 0.003066406352445483) - pODMRenderParams->vPartyPos.z);//61 / 184 / 310 изменяется при наклоне камеры + (pODMRenderParams->shading_dist_mist * cos(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) * + (pODMRenderParams->shading_dist_mist * -sin(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) - pGame->pIndoorCameraD3D->vPartyPos.z);//61 / 184 / 310 изменяется при наклоне камеры pSkyPolygon.Create_48607B(&stru_8019C8); pSkyPolygon.ptr_38->_48694B_frustum_sky();//maybe creating skydome(возможно создание купола неба) @@ -5325,9 +5325,9 @@ pSkyPolygon.uNumVertices = 4;//количество вершин //centering(центруем)--наклон камеры ----------------------------------------// - pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pODMRenderParams->rotation_x + 16);//-3216, вверх: -28020, вниз: 22078 + pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);//-3216, вверх: -28020, вниз: 22078 pSkyPolygon.v_18.y = 0; - pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pODMRenderParams->rotation_x + 16);//-65457, вверх: -59244, вниз: -61705 + pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);//-65457, вверх: -59244, вниз: -61705 //---------------------------------------------------------------------------// pSkyPolygon.field_24 = 0x2000000; @@ -5558,8 +5558,8 @@ strcpy(Source, &pFilename[v7]); strcpy(pOutdoor->pLevelFilename, Source); pWeather->Initialize(); - pODMRenderParams->rotation_y = pParty->sRotationY; - pODMRenderParams->rotation_x = pParty->sRotationX; + pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; + pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX; pODMRenderParams->RotationToInts(); pOutdoor->UpdateSunlightVectors(); @@ -6156,23 +6156,23 @@ //v8 = -pIndoorCamera->pos.y; v9 = pODMRenderParams->camera_rotation_y_int_cosine; //v26 = -pIndoorCamera->pos.z; - v11 = pODMRenderParams->camera_rotation_y_int_cosine * -pODMRenderParams->vPartyPos.x + pODMRenderParams->camera_rotation_y_int_sine * -pODMRenderParams->vPartyPos.y; - v24 = pODMRenderParams->camera_rotation_y_int_cosine * -pODMRenderParams->vPartyPos.y - pODMRenderParams->camera_rotation_y_int_sine * -pODMRenderParams->vPartyPos.x; - if (pODMRenderParams->rotation_x) + v11 = pODMRenderParams->camera_rotation_y_int_cosine * -pGame->pIndoorCameraD3D->vPartyPos.x + pODMRenderParams->camera_rotation_y_int_sine * -pGame->pIndoorCameraD3D->vPartyPos.y; + v24 = pODMRenderParams->camera_rotation_y_int_cosine * -pGame->pIndoorCameraD3D->vPartyPos.y - pODMRenderParams->camera_rotation_y_int_sine * -pGame->pIndoorCameraD3D->vPartyPos.x; + if (pGame->pIndoorCameraD3D->sRotationX) { this->field_0_party_dir_x = fixpoint_sub0(v11, pODMRenderParams->camera_rotation_x_int_cosine) + - fixpoint_sub0((-pODMRenderParams->vPartyPos.z) << 16, pODMRenderParams->camera_rotation_x_int_sine); + fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pODMRenderParams->camera_rotation_x_int_sine); this->field_4_party_dir_y = v24; - this->field_8_party_dir_z = fixpoint_sub0((-pODMRenderParams->vPartyPos.z) << 16, v25) - fixpoint_sub0(v11, v27); + this->field_8_party_dir_z = fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_sub0(v11, v27); } else { this->field_0_party_dir_x = v11; this->field_4_party_dir_y = v24; - this->field_8_party_dir_z = (-pODMRenderParams->vPartyPos.z) << 16; - } - - if (pODMRenderParams->rotation_x) + this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16; + } + + if (pGame->pIndoorCameraD3D->sRotationX) { v17 = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7); @@ -6187,7 +6187,7 @@ this->field_14 = a4; } - if (pODMRenderParams->rotation_x) + if (pGame->pIndoorCameraD3D->sRotationX) { v19 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7);
--- a/mm7_4.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/mm7_4.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -432,6 +432,11 @@ return (left << 16) | right; } +int fixpoint_from_int(int lhv, int rhv) +{ + return (lhv << 16) | rhv; +} + //----- (00491E3A) -------------------------------------------------------- void sub_491E3A() {
--- a/mm7_data.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/mm7_data.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -1013,8 +1013,6 @@ std::array<char, 54> party_has_equipment; std::array<char, 17> byte_5111F6; -int _unused000; // weak - std::array<std::array<unsigned __int16, 137>, 117> pOdmMinimap; unsigned int uNumBlueFacesInBLVMinimap; std::array<unsigned __int16, 50> pBlueFacesInBLVMinimapIDs;
--- a/mm7_data.h Tue Sep 17 15:40:36 2013 +0200 +++ b/mm7_data.h Tue Sep 17 17:40:59 2013 +0200 @@ -663,7 +663,6 @@ extern std::array<unsigned int, 16> papredoll_dbrds; extern int bRingsShownInCharScreen; // weak -extern int _unused000; // weak extern std::array<std::array<unsigned __int16, 137>, 117> pOdmMinimap; extern unsigned int uNumBlueFacesInBLVMinimap; @@ -1373,7 +1372,7 @@ for ( int i=0; i < count; i++ ) *p++ = value; } -inline void __fastcall j_memset32(int a2, void *a1, unsigned int a3) {memset32(a1, a2, a3);} +//inline void __fastcall j_memset32(int a2, void *a1, unsigned int a3) {memset32(a1, a2, a3);} #define ErrD3D(hr) do {extern void ErrHR(HRESULT, const char *, const char *, const char *, int); ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__);} while(0)
--- a/stru10.cpp Tue Sep 17 15:40:36 2013 +0200 +++ b/stru10.cpp Tue Sep 17 17:40:59 2013 +0200 @@ -668,9 +668,9 @@ RenderVertexSoft v25; // [sp+10h] [bp-90h]@20 memcpy(&v25, pOutBounding, sizeof(RenderVertexSoft)); - float _dp = (v25.vWorldPosition.x - pBLVRenderParams->vPartyPos.x) * a1.x + - (v25.vWorldPosition.y - pBLVRenderParams->vPartyPos.y) * a1.y + - (v25.vWorldPosition.z - pBLVRenderParams->vPartyPos.z) * a1.z; + float _dp = (v25.vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) * a1.x + + (v25.vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) * a1.y + + (v25.vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) * a1.z; if (fabs(_dp) < 1e-6f) { memcpy(&v25, &pOutBounding[1], sizeof(RenderVertexSoft)); @@ -784,9 +784,9 @@ char stru10::_49C720(RenderVertexSoft *pFaceBounding, IndoorCameraD3D_Vec4 *pPortalDataFrustum) { Vec3_float_ pRayStart; // [sp+4h] [bp-34h]@1 - pRayStart.x = (double)pBLVRenderParams->vPartyPos.x; - pRayStart.y = (double)pBLVRenderParams->vPartyPos.y; - pRayStart.z = (double)pBLVRenderParams->vPartyPos.z; + pRayStart.x = (double)pGame->pIndoorCameraD3D->vPartyPos.x; + pRayStart.y = (double)pGame->pIndoorCameraD3D->vPartyPos.y; + pRayStart.z = (double)pGame->pIndoorCameraD3D->vPartyPos.z; if (FindFaceNormal(&pFaceBounding[0], &pFaceBounding[1], &pRayStart, &pPortalDataFrustum[0]) && FindFaceNormal(&pFaceBounding[1], &pFaceBounding[2], &pRayStart, &pPortalDataFrustum[1]) &&