Mercurial > mm7
comparison Indoor.cpp @ 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 | ccde94f02b75 |
children | 466c5e15f524 |
comparison
equal
deleted
inserted
replaced
1639:b60ddd777d50 | 1640:afc1c3514dd5 |
---|---|
110 | 110 |
111 pBLVRenderParams->Reset(_this); | 111 pBLVRenderParams->Reset(_this); |
112 pMobileLightsStack->uNumLightsActive = 0; | 112 pMobileLightsStack->uNumLightsActive = 0; |
113 //uNumMobileLightsApplied = 0; | 113 //uNumMobileLightsApplied = 0; |
114 uNumDecorationsDrawnThisFrame = 0; | 114 uNumDecorationsDrawnThisFrame = 0; |
115 _unused000 = 0; | |
116 uNumSpritesDrawnThisFrame = 0; | 115 uNumSpritesDrawnThisFrame = 0; |
117 uNumBillboardsToDraw = 0; | 116 uNumBillboardsToDraw = 0; |
118 | 117 |
119 if ( !byte_4D864C || !(pGame->uFlags & 0x1000) ) // lightspot around party | 118 if ( !byte_4D864C || !(pGame->uFlags & 0x1000) ) // lightspot around party |
120 { | 119 { |
124 if (pParty->TorchlightActive()) | 123 if (pParty->TorchlightActive()) |
125 v5 *= pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; | 124 v5 *= pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; |
126 //LOBYTE(v1) = byte_4E94D0; | 125 //LOBYTE(v1) = byte_4E94D0; |
127 //v4 = pParty->flt_TorchlightColorR + 6.7553994e15; | 126 //v4 = pParty->flt_TorchlightColorR + 6.7553994e15; |
128 //v3 = pParty->flt_TorchlightColorG + 6.7553994e15; | 127 //v3 = pParty->flt_TorchlightColorG + 6.7553994e15; |
129 pMobileLightsStack->AddLight(pBLVRenderParams->vPartyPos.x, | 128 pMobileLightsStack->AddLight(pGame->pIndoorCameraD3D->vPartyPos.x, |
130 pBLVRenderParams->vPartyPos.y, | 129 pGame->pIndoorCameraD3D->vPartyPos.y, |
131 pBLVRenderParams->vPartyPos.z, | 130 pGame->pIndoorCameraD3D->vPartyPos.z, |
132 pBLVRenderParams->uPartySectorID, | 131 pBLVRenderParams->uPartySectorID, |
133 v5, | 132 v5, |
134 floorf(pParty->flt_TorchlightColorR + 0.5f), | 133 floorf(pParty->flt_TorchlightColorR + 0.5f), |
135 floorf(pParty->flt_TorchlightColorG + 0.5f), | 134 floorf(pParty->flt_TorchlightColorG + 0.5f), |
136 floorf(pParty->flt_TorchlightColorB + 0.5f), | 135 floorf(pParty->flt_TorchlightColorB + 0.5f), |
165 | 164 |
166 //----- (004407D9) -------------------------------------------------------- | 165 //----- (004407D9) -------------------------------------------------------- |
167 int BLVRenderParams::Reset(IndoorLocation_drawstru *a2) | 166 int BLVRenderParams::Reset(IndoorLocation_drawstru *a2) |
168 { | 167 { |
169 IndoorLocation_drawstru *v2; // ebx@1 | 168 IndoorLocation_drawstru *v2; // ebx@1 |
170 int v4; // ST08_4@1 | 169 //int v4; // ST08_4@1 |
171 int v5; // ST04_4@1 | 170 //int v5; // ST04_4@1 |
172 int v6; // ST00_4@1 | 171 //int v6; // ST00_4@1 |
173 int v7; // eax@1 | 172 int v7; // eax@1 |
174 int v8; // ST08_4@2 | 173 int v8; // ST08_4@2 |
175 int v9; // ST04_4@2 | 174 int v9; // ST04_4@2 |
176 int v10; // ST00_4@2 | 175 int v10; // ST00_4@2 |
177 unsigned int v11; // edi@4 | 176 unsigned int v11; // edi@4 |
195 int v29; // [sp+24h] [bp+8h]@5 | 194 int v29; // [sp+24h] [bp+8h]@5 |
196 | 195 |
197 v2 = a2; | 196 v2 = a2; |
198 this->field_0_timer_ = a2->field_0_timer; | 197 this->field_0_timer_ = a2->field_0_timer; |
199 this->uFlags = a2->uFlags; | 198 this->uFlags = a2->uFlags; |
200 this->vPartyPos.x = a2->vPosition.x; | 199 //this->vPartyPos.x = a2->vPosition.x; |
201 this->vPartyPos.y = a2->vPosition.y; | 200 //this->vPartyPos.y = a2->vPosition.y; |
202 this->vPartyPos.z = a2->vPosition.z; | 201 //this->vPartyPos.z = a2->vPosition.z; |
203 v4 = this->vPartyPos.z; | 202 //v4 = this->vPartyPos.z; |
204 v5 = this->vPartyPos.y; | 203 //v5 = this->vPartyPos.y; |
205 this->sPartyRotY = a2->sRotationY; | 204 //this->sPartyRotY = a2->sRotationY; |
206 v6 = this->vPartyPos.x; | 205 //v6 = this->vPartyPos.x; |
207 this->sPartyRotX = a2->sRotationX; | 206 //this->sPartyRotX = a2->sRotationX; |
208 v7 = pIndoor->GetSector(v6, v5, v4); | 207 v7 = pIndoor->GetSector(pGame->pIndoorCameraD3D->vPartyPos.x, |
208 pGame->pIndoorCameraD3D->vPartyPos.y, | |
209 pGame->pIndoorCameraD3D->vPartyPos.z); | |
209 this->uPartySectorID = v7; | 210 this->uPartySectorID = v7; |
210 if ( !v7 ) | 211 if ( !v7 ) |
211 { | 212 { |
212 v8 = this->vPartyPos.z; | 213 __debugbreak(); // shouldnt happen, please provide savegame |
214 /*v8 = this->vPartyPos.z; | |
213 this->vPartyPos.x = pParty->vPosition.x; | 215 this->vPartyPos.x = pParty->vPosition.x; |
214 v9 = pParty->vPosition.y; | 216 v9 = pParty->vPosition.y; |
215 v10 = this->vPartyPos.x; | 217 v10 = this->vPartyPos.x; |
216 this->vPartyPos.y = pParty->vPosition.y; | 218 this->vPartyPos.y = pParty->vPosition.y;*/ |
217 this->uPartySectorID = pIndoor->GetSector(v10, v9, v8); | 219 this->uPartySectorID = pIndoor->GetSector(v10, v9, v8); |
218 } | 220 } |
219 if ( pRenderer->pRenderD3D ) | 221 if ( pRenderer->pRenderD3D ) |
220 { | 222 { |
221 this->sCosineY = stru_5C6E00->Cos(this->sPartyRotY); | 223 this->sCosineY = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); |
222 this->sSineY = stru_5C6E00->Sin(this->sPartyRotY); | 224 this->sSineY = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); |
223 this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX); | 225 this->sCosineNegX = stru_5C6E00->Cos(-pGame->pIndoorCameraD3D->sRotationX); |
224 this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX); | 226 this->sSineNegX = stru_5C6E00->Sin(-pGame->pIndoorCameraD3D->sRotationX); |
225 this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125); | 227 this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); |
226 this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)this->sPartyRotY * 0.00048828125); | 228 this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125); |
227 this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125); | 229 this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); |
228 this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-this->sPartyRotX * 0.00048828125); | 230 this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125); |
229 this->field_64 = a2->field_3C; | 231 this->field_64 = a2->field_3C; |
230 v11 = this->uViewportW; | 232 v11 = this->uViewportW; |
231 v12 = this->uViewportX; | 233 v12 = this->uViewportX; |
232 v13 = this->uViewportZ - v12; | 234 v13 = this->uViewportZ - v12; |
233 v14 = this->uViewportZ + v12; | 235 v14 = this->uViewportZ + v12; |
238 this->uViewportCenterX = v14 >> 1; | 240 this->uViewportCenterX = v14 >> 1; |
239 this->uViewportCenterY = (signed int)(v16 + v15) >> 1; | 241 this->uViewportCenterY = (signed int)(v16 + v15) >> 1; |
240 } | 242 } |
241 else | 243 else |
242 { | 244 { |
243 this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY); | 245 __debugbreak(); // no sw |
246 /*this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY); | |
244 this->sSineY = stru_5C6E00->Sin(-this->sPartyRotY); | 247 this->sSineY = stru_5C6E00->Sin(-this->sPartyRotY); |
245 this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX); | 248 this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX); |
246 this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX); | 249 this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX); |
247 v17 = cos((double)-this->sPartyRotY * 0.0030664064); | 250 v17 = cos((double)-this->sPartyRotY * 0.0030664064); |
248 v18 = this->sPartyRotY; | 251 v18 = this->sPartyRotY; |
261 v25 = this->uViewportW - this->uViewportY + 1; | 264 v25 = this->uViewportW - this->uViewportY + 1; |
262 this->uViewportHeight = v25; | 265 this->uViewportHeight = v25; |
263 v29 = v25; | 266 v29 = v25; |
264 v26 = this->field_64; | 267 v26 = this->field_64; |
265 this->uViewportCenterX = (signed int)(v24 + v23) >> 1; | 268 this->uViewportCenterX = (signed int)(v24 + v23) >> 1; |
266 this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16); | 269 this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);*/ |
267 } | 270 } |
268 v27 = (unsigned int)(signed __int64)((double)this->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329) | 271 v27 = (unsigned int)(signed __int64)((double)this->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329) |
269 + 0.5) << 16; | 272 + 0.5) << 16; |
270 this->field_40 = v27; | 273 this->field_40 = v27; |
271 this->field_44 = 0x100000000i64 / v27; | 274 this->field_44 = 0x100000000i64 / v27; |
697 } | 700 } |
698 | 701 |
699 if (nodes[node_id].uFaceID == uFaceID) | 702 if (nodes[node_id].uFaceID == uFaceID) |
700 return; | 703 return; |
701 if (!node_id && | 704 if (!node_id && |
702 pBLVRenderParams->vPartyPos.x >= pFace->pBounding.x1 - 16 && // we are probably standing at the portal plane | 705 pGame->pIndoorCameraD3D->vPartyPos.x >= pFace->pBounding.x1 - 16 && // we are probably standing at the portal plane |
703 pBLVRenderParams->vPartyPos.x <= pFace->pBounding.x2 + 16 && | 706 pGame->pIndoorCameraD3D->vPartyPos.x <= pFace->pBounding.x2 + 16 && |
704 pBLVRenderParams->vPartyPos.y >= pFace->pBounding.y1 - 16 && | 707 pGame->pIndoorCameraD3D->vPartyPos.y >= pFace->pBounding.y1 - 16 && |
705 pBLVRenderParams->vPartyPos.y <= pFace->pBounding.y2 + 16 && | 708 pGame->pIndoorCameraD3D->vPartyPos.y <= pFace->pBounding.y2 + 16 && |
706 pBLVRenderParams->vPartyPos.z >= pFace->pBounding.z1 - 16 && | 709 pGame->pIndoorCameraD3D->vPartyPos.z >= pFace->pBounding.z1 - 16 && |
707 pBLVRenderParams->vPartyPos.z <= pFace->pBounding.z2 + 16 ) | 710 pGame->pIndoorCameraD3D->vPartyPos.z <= pFace->pBounding.z2 + 16 ) |
708 { | 711 { |
709 if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x | 712 if ( abs(pFace->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x |
710 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y | 713 + pGame->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y |
711 + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane | 714 + pGame->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane |
712 { | 715 { |
713 pTransitionSector = pFace->uSectorID; | 716 pTransitionSector = pFace->uSectorID; |
714 if ( nodes[0].uSectorID == pTransitionSector ) // draw back sector | 717 if ( nodes[0].uSectorID == pTransitionSector ) // draw back sector |
715 pTransitionSector = pFace->uBackSectorID; | 718 pTransitionSector = pFace->uBackSectorID; |
716 nodes[num_nodes].uSectorID = pTransitionSector; | 719 nodes[num_nodes].uSectorID = pTransitionSector; |
724 AddBspNodeToRenderList(++num_nodes - 1); | 727 AddBspNodeToRenderList(++num_nodes - 1); |
725 return; | 728 return; |
726 } | 729 } |
727 } | 730 } |
728 | 731 |
729 v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) | 732 v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pGame->pIndoorCameraD3D->vPartyPos.x) |
730 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) | 733 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pGame->pIndoorCameraD3D->vPartyPos.y) |
731 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z); | 734 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pGame->pIndoorCameraD3D->vPartyPos.z); |
732 if (nodes[node_id].uSectorID != pFace->uSectorID) | 735 if (nodes[node_id].uSectorID != pFace->uSectorID) |
733 v9 = -v9; | 736 v9 = -v9; |
734 if (v9 >= 0) | 737 if (v9 >= 0) |
735 return; | 738 return; |
736 | 739 |
841 v5 = (char *)this + 2252 * node_id; | 844 v5 = (char *)this + 2252 * node_id; |
842 v20 = v5; | 845 v20 = v5; |
843 if ( uFaceID == *((short *)v5 + 2982) ) | 846 if ( uFaceID == *((short *)v5 + 2982) ) |
844 return; | 847 return; |
845 if (!node_id | 848 if (!node_id |
846 && pBLVRenderParams->vPartyPos.x >= v4->pBounding.x1 - 16 | 849 && pGame->pIndoorCameraD3D->vPartyPos.x >= v4->pBounding.x1 - 16 |
847 && pBLVRenderParams->vPartyPos.x <= v4->pBounding.x2 + 16 | 850 && pGame->pIndoorCameraD3D->vPartyPos.x <= v4->pBounding.x2 + 16 |
848 && pBLVRenderParams->vPartyPos.y >= v4->pBounding.y1 - 16 | 851 && pGame->pIndoorCameraD3D->vPartyPos.y >= v4->pBounding.y1 - 16 |
849 && pBLVRenderParams->vPartyPos.y <= v4->pBounding.y2 + 16 | 852 && pGame->pIndoorCameraD3D->vPartyPos.y <= v4->pBounding.y2 + 16 |
850 && pBLVRenderParams->vPartyPos.z >= v4->pBounding.z1 - 16 | 853 && pGame->pIndoorCameraD3D->vPartyPos.z >= v4->pBounding.z1 - 16 |
851 && pBLVRenderParams->vPartyPos.z <= v4->pBounding.z2 + 16 ) | 854 && pGame->pIndoorCameraD3D->vPartyPos.z <= v4->pBounding.z2 + 16 ) |
852 { | 855 { |
853 if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x | 856 if ( abs(v4->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * v4->pFacePlane_old.vNormal.x |
854 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y | 857 + pGame->pIndoorCameraD3D->vPartyPos.y * v4->pFacePlane_old.vNormal.y |
855 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) | 858 + pGame->pIndoorCameraD3D->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) |
856 { | 859 { |
857 v6 = v21->uSectorID; | 860 v6 = v21->uSectorID; |
858 if ( v3->nodes[0].uSectorID == v6 ) | 861 if ( v3->nodes[0].uSectorID == v6 ) |
859 v6 = v21->uBackSectorID; | 862 v6 = v21->uBackSectorID; |
860 v3->nodes[v3->num_nodes].uSectorID = v6; | 863 v3->nodes[v3->num_nodes].uSectorID = v6; |
873 } | 876 } |
874 v4 = v21; | 877 v4 = v21; |
875 v5 = v20; | 878 v5 = v20; |
876 } | 879 } |
877 v8 = &pIndoor->pVertices[*v4->pVertexIDs]; | 880 v8 = &pIndoor->pVertices[*v4->pVertexIDs]; |
878 v9 = v4->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x) | 881 v9 = v4->pFacePlane_old.vNormal.x * (v8->x - pGame->pIndoorCameraD3D->vPartyPos.x) |
879 + v4->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y) | 882 + v4->pFacePlane_old.vNormal.y * (v8->y - pGame->pIndoorCameraD3D->vPartyPos.y) |
880 + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); | 883 + v4->pFacePlane_old.vNormal.z * (v8->z - pGame->pIndoorCameraD3D->vPartyPos.z); |
881 if ( *((short *)v5 + 2004) != v4->uSectorID ) | 884 if ( *((short *)v5 + 2004) != v4->uSectorID ) |
882 v9 = -v9; | 885 v9 = -v9; |
883 if ( v9 < 0 ) | 886 if ( v9 < 0 ) |
884 { | 887 { |
885 v10 = GetPortalScreenCoord(uFaceID); | 888 v10 = GetPortalScreenCoord(uFaceID); |
4496 | 4499 |
4497 a5 = p->uSectorID; | 4500 a5 = p->uSectorID; |
4498 a2 = p->vPosition.y; | 4501 a2 = p->vPosition.y; |
4499 a1a = p->vPosition.x; | 4502 a1a = p->vPosition.x; |
4500 a3 = p->vPosition.z; | 4503 a3 = p->vPosition.z; |
4501 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | 4504 v4 = stru_5C6E00->Atan2(a1a - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y); |
4502 LOWORD(v0) = p->uYawAngle; | 4505 LOWORD(v0) = p->uYawAngle; |
4503 v5 = p->uCurrentActionAnimation; | 4506 v5 = p->uCurrentActionAnimation; |
4504 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | 4507 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; |
4505 v32 = v6; | 4508 v32 = v6; |
4506 if ( pParty->bTurnBasedModeOn ) | 4509 if ( pParty->bTurnBasedModeOn ) |
4563 { | 4566 { |
4564 ++v12; | 4567 ++v12; |
4565 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | 4568 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) |
4566 goto _continue; | 4569 goto _continue; |
4567 } | 4570 } |
4568 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | 4571 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1a, a2, a3, &x, &y, &z, 1) |
4569 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | 4572 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) |
4570 continue; | 4573 continue; |
4571 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | 4574 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); |
4572 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | 4575 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; |
4573 if (uNumBillboardsToDraw >= 500) | 4576 if (uNumBillboardsToDraw >= 500) |
4710 v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, p->uSpriteFrameID); | 4713 v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, p->uSpriteFrameID); |
4711 v5 = v4; | 4714 v5 = v4; |
4712 v24 = v4; | 4715 v24 = v4; |
4713 v30 = v4->uFlags; | 4716 v30 = v4->uFlags; |
4714 a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier; | 4717 a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier; |
4715 v6 = stru_5C6E00->Atan2(p->vPosition.x - pBLVRenderParams->vPartyPos.x, | 4718 v6 = stru_5C6E00->Atan2(p->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, |
4716 p->vPosition.y - pBLVRenderParams->vPartyPos.y); | 4719 p->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); |
4717 LOWORD(v7) = p->uFacing; | 4720 LOWORD(v7) = p->uFacing; |
4718 v8 = v30; | 4721 v8 = v30; |
4719 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7; | 4722 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7; |
4720 v10 = v5->pHwSpriteIDs[v9]; | 4723 v10 = v5->pHwSpriteIDs[v9]; |
4721 v3->uHwSpriteID = v10; | 4724 v3->uHwSpriteID = v10; |
4746 v1->uParticleTrailColorR, | 4749 v1->uParticleTrailColorR, |
4747 v1->uParticleTrailColorG, | 4750 v1->uParticleTrailColorG, |
4748 v1->uParticleTrailColorB, | 4751 v1->uParticleTrailColorB, |
4749 byte_4E94D3); | 4752 byte_4E94D3); |
4750 } | 4753 } |
4751 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( | 4754 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV( |
4752 a1, | 4755 a1, |
4753 a2, | 4756 a2, |
4754 a3, | 4757 a3, |
4755 &x, | 4758 &x, |
4756 &y, | 4759 &y, |
4860 while ( 1 ) | 4863 while ( 1 ) |
4861 { | 4864 { |
4862 pSector = &pIndoor->pSectors[node->uSectorID]; | 4865 pSector = &pIndoor->pSectors[node->uSectorID]; |
4863 pNode = &pIndoor->pNodes[uFirstNode]; | 4866 pNode = &pIndoor->pNodes[uFirstNode]; |
4864 pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]]; | 4867 pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]]; |
4865 v5 = pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x | 4868 v5 = pFace->pFacePlane_old.dist + |
4866 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation | 4869 pGame->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x + |
4870 pGame->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + | |
4871 pGame->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation | |
4867 if (pFace->Portal() && pFace->uSectorID != node->uSectorID ) | 4872 if (pFace->Portal() && pFace->uSectorID != node->uSectorID ) |
4868 v5 = -v5; | 4873 v5 = -v5; |
4869 //v11 = v5 > 0; | 4874 //v11 = v5 > 0; |
4870 if ( v5 <= 0 ) | 4875 if ( v5 <= 0 ) |
4871 v6 = pNode->uFront; | 4876 v6 = pNode->uFront; |
4970 a2 = v2->vPosition.y; | 4975 a2 = v2->vPosition.y; |
4971 a1 = v6; | 4976 a1 = v6; |
4972 a3 = v7; | 4977 a3 = v7; |
4973 v8 = v2->field_10_y_rot | 4978 v8 = v2->field_10_y_rot |
4974 + ((signed int)stru_5C6E00->uIntegerPi >> 3) | 4979 + ((signed int)stru_5C6E00->uIntegerPi >> 3) |
4975 - stru_5C6E00->Atan2(v6 - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | 4980 - stru_5C6E00->Atan2(v6 - pGame->pIndoorCameraD3D->vPartyPos.x, a2 - pGame->pIndoorCameraD3D->vPartyPos.y); |
4976 v37 = pBLVRenderParams->field_0_timer_; | 4981 v37 = pBLVRenderParams->field_0_timer_; |
4977 v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7; | 4982 v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7; |
4978 if (pParty->bTurnBasedModeOn) | 4983 if (pParty->bTurnBasedModeOn) |
4979 v37 = pMiscTimer->uTotalGameTimeElapsed; | 4984 v37 = pMiscTimer->uTotalGameTimeElapsed; |
4980 v10 = abs(v2->vPosition.x + v2->vPosition.y); | 4985 v10 = abs(v2->vPosition.x + v2->vPosition.y); |
4988 v30 |= 0x40u; | 4993 v30 |= 0x40u; |
4989 if ( v13 & 0x20000 ) | 4994 if ( v13 & 0x20000 ) |
4990 LOBYTE(v30) = v30 | 0x80; | 4995 LOBYTE(v30) = v30 | 0x80; |
4991 if ( (256 << v9) & v13 ) | 4996 if ( (256 << v9) & v13 ) |
4992 v30 |= 4u; | 4997 v30 |= 4u; |
4993 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1, a2, a3, &x, &y, &z, 1) ) | 4998 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(a1, a2, a3, &x, &y, &z, 1) ) |
4994 { | 4999 { |
4995 v14 = abs(x); | 5000 v14 = abs(x); |
4996 if ( v14 >= abs(y) ) | 5001 if ( v14 >= abs(y) ) |
4997 { | 5002 { |
4998 pGame->pIndoorCameraD3D->Project(x, y, z, &a5, &a6); | 5003 pGame->pIndoorCameraD3D->Project(x, y, z, &a5, &a6); |
5131 int v28; // [sp+1Ch] [bp-Ch]@1 | 5136 int v28; // [sp+1Ch] [bp-Ch]@1 |
5132 int v29; // [sp+24h] [bp-4h]@1 | 5137 int v29; // [sp+24h] [bp-4h]@1 |
5133 //int v30; // [sp+30h] [bp+8h]@10 | 5138 //int v30; // [sp+30h] [bp+8h]@10 |
5134 //int v31; // [sp+3Ch] [bp+14h]@10 | 5139 //int v31; // [sp+3Ch] [bp+14h]@10 |
5135 | 5140 |
5136 v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY); | 5141 v8 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); |
5137 v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY); | 5142 v29 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); |
5138 v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX); | 5143 v28 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); |
5139 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX); | 5144 v9 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); |
5140 //v11 = -pBLVRenderParams->vPartyPos.y; | 5145 //v11 = -pBLVRenderParams->vPartyPos.y; |
5141 //v26 = -pBLVRenderParams->vPartyPos.x; | 5146 //v26 = -pBLVRenderParams->vPartyPos.x; |
5142 //v27 = v9; | 5147 //v27 = v9; |
5143 //v12 = -pBLVRenderParams->vPartyPos.z; | 5148 //v12 = -pBLVRenderParams->vPartyPos.z; |
5144 if ( pBLVRenderParams->sPartyRotX ) | 5149 if (pGame->pIndoorCameraD3D->sRotationX) |
5145 { | 5150 { |
5146 v16 = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; | 5151 v16 = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y; |
5147 v17 = -65536 * pBLVRenderParams->vPartyPos.z; | 5152 v17 = -65536 * pGame->pIndoorCameraD3D->vPartyPos.z; |
5148 this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pBLVRenderParams->vPartyPos.z) << 16, v9); | 5153 this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v9); |
5149 this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; | 5154 this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x; |
5150 this->field_8_party_dir_z = fixpoint_sub0(v17, v28) - fixpoint_sub0(v16, v9); | 5155 this->field_8_party_dir_z = fixpoint_sub0(v17, v28) - fixpoint_sub0(v16, v9); |
5151 } | 5156 } |
5152 else | 5157 else |
5153 { | 5158 { |
5154 this->field_0_party_dir_x = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; | 5159 this->field_0_party_dir_x = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y; |
5155 this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; | 5160 this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x; |
5156 this->field_8_party_dir_z = (-pBLVRenderParams->vPartyPos.z) << 16; | 5161 this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16; |
5157 } | 5162 } |
5158 | 5163 |
5159 if (pBLVRenderParams->sPartyRotX) | 5164 if (pGame->pIndoorCameraD3D->sRotationX) |
5160 { | 5165 { |
5161 v19 = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29); | 5166 v19 = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29); |
5162 | 5167 |
5163 this->field_C = fixpoint_sub0(v19, v28) + fixpoint_sub0(a4, v9); | 5168 this->field_C = fixpoint_sub0(v19, v28) + fixpoint_sub0(a4, v9); |
5164 this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29); | 5169 this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29); |
5169 this->field_C = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29); | 5174 this->field_C = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29); |
5170 this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29); | 5175 this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29); |
5171 this->field_14 = a4; | 5176 this->field_14 = a4; |
5172 } | 5177 } |
5173 | 5178 |
5174 if (pBLVRenderParams->sPartyRotX) | 5179 if (pGame->pIndoorCameraD3D->sRotationX) |
5175 { | 5180 { |
5176 v21 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29); | 5181 v21 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29); |
5177 | 5182 |
5178 this->field_18 = fixpoint_sub0(v21, v28) + fixpoint_sub0(a7, v9); | 5183 this->field_18 = fixpoint_sub0(v21, v28) + fixpoint_sub0(a7, v9); |
5179 this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29); | 5184 this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29); |
6461 | 6466 |
6462 pFace = &pIndoor->pFaces[uFaceID]; | 6467 pFace = &pIndoor->pFaces[uFaceID]; |
6463 memset(&PortalFace, 0, sizeof(stru367)); | 6468 memset(&PortalFace, 0, sizeof(stru367)); |
6464 | 6469 |
6465 //get direction the face(определение направленности фейса)********************************************************************************* | 6470 //get direction the face(определение направленности фейса)********************************************************************************* |
6466 if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) | 6471 if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pGame->pIndoorCameraD3D->vPartyPos.x) |
6467 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) | 6472 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pGame->pIndoorCameraD3D->vPartyPos.y) |
6468 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) | 6473 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pGame->pIndoorCameraD3D->vPartyPos.z) < 0 ) |
6469 { | 6474 { |
6470 PortalFace.direction = true; | 6475 PortalFace.direction = true; |
6471 } | 6476 } |
6472 else | 6477 else |
6473 { | 6478 { |
6496 | 6501 |
6497 if ( (signed int)pFace->uNumVertices > 0 ) | 6502 if ( (signed int)pFace->uNumVertices > 0 ) |
6498 { | 6503 { |
6499 for (uint i = 0; i < pFace->uNumVertices; ++i) | 6504 for (uint i = 0; i < pFace->uNumVertices; ++i) |
6500 { | 6505 { |
6501 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(pIndoor->pVertices[pFace->pVertexIDs[i]].x, | 6506 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pIndoor->pVertices[pFace->pVertexIDs[i]].x, |
6502 pIndoor->pVertices[pFace->pVertexIDs[i]].y, | 6507 pIndoor->pVertices[pFace->pVertexIDs[i]].y, |
6503 pIndoor->pVertices[pFace->pVertexIDs[i]].z, | 6508 pIndoor->pVertices[pFace->pVertexIDs[i]].z, |
6504 &PortalFace._view_transformed_z[i + 3], &PortalFace._view_transformed_x[i + 3], &PortalFace._view_transformed_y[i + 3], 0); | 6509 &PortalFace._view_transformed_z[i + 3], &PortalFace._view_transformed_x[i + 3], &PortalFace._view_transformed_y[i + 3], 0); |
6505 } | 6510 } |
6506 } | 6511 } |
6864 float v11; // [sp+8h] [bp-8h]@2 | 6869 float v11; // [sp+8h] [bp-8h]@2 |
6865 float v12; // [sp+8h] [bp-8h]@6 | 6870 float v12; // [sp+8h] [bp-8h]@6 |
6866 float v13; // [sp+Ch] [bp-4h]@2 | 6871 float v13; // [sp+Ch] [bp-4h]@2 |
6867 float v14; // [sp+Ch] [bp-4h]@6 | 6872 float v14; // [sp+Ch] [bp-4h]@6 |
6868 | 6873 |
6869 if ( pBLVRenderParams->sPartyRotX ) | 6874 if (pGame->pIndoorCameraD3D->sRotationX) |
6870 { | 6875 { |
6871 v13 = a1->vWorldPosition.x - (double)pParty->vPosition.x; | 6876 v13 = a1->vWorldPosition.x - (double)pParty->vPosition.x; |
6872 v11 = a1->vWorldPosition.y - (double)pParty->vPosition.y; | 6877 v11 = a1->vWorldPosition.y - (double)pParty->vPosition.y; |
6873 v4 = a1->vWorldPosition.z - (double)pParty->vPosition.z; | 6878 v4 = a1->vWorldPosition.z - (double)pParty->vPosition.z; |
6874 if ( pRenderer->pRenderD3D ) | 6879 //if ( pRenderer->pRenderD3D ) |
6875 { | 6880 //{ |
6876 v5 = v11 * pBLVRenderParams->fSineY + v13 * pBLVRenderParams->fCosineY; | 6881 v5 = v11 * pBLVRenderParams->fSineY + v13 * pBLVRenderParams->fCosineY; |
6877 a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY - v11 * pBLVRenderParams->fCosineY; | 6882 a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY - v11 * pBLVRenderParams->fCosineY; |
6878 } | 6883 /*} |
6879 else | 6884 else |
6880 { | 6885 { |
6881 v5 = v13 * pBLVRenderParams->fCosineY - v11 * pBLVRenderParams->fSineY; | 6886 v5 = v13 * pBLVRenderParams->fCosineY - v11 * pBLVRenderParams->fSineY; |
6882 a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY + v11 * pBLVRenderParams->fCosineY; | 6887 a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY + v11 * pBLVRenderParams->fCosineY; |
6883 } | 6888 }*/ |
6884 a1->vWorldViewPosition.x = v5 * pBLVRenderParams->fCosineNegX - v4 * pBLVRenderParams->fSineNegX; | 6889 a1->vWorldViewPosition.x = v5 * pBLVRenderParams->fCosineNegX - v4 * pBLVRenderParams->fSineNegX; |
6885 a1->vWorldViewPosition.z = v5 * pBLVRenderParams->fSineNegX + v4 * pBLVRenderParams->fCosineNegX; | 6890 a1->vWorldViewPosition.z = v5 * pBLVRenderParams->fSineNegX + v4 * pBLVRenderParams->fCosineNegX; |
6886 } | 6891 } |
6887 else | 6892 else |
6888 { | 6893 { |
6889 v14 = a1->vWorldPosition.x - (double)pParty->vPosition.x; | 6894 v14 = a1->vWorldPosition.x - (double)pParty->vPosition.x; |
6890 v12 = a1->vWorldPosition.y - (double)pParty->vPosition.y; | 6895 v12 = a1->vWorldPosition.y - (double)pParty->vPosition.y; |
6891 a1->vWorldViewPosition.z = a1->vWorldPosition.z - (double)pParty->vPosition.z; | 6896 a1->vWorldViewPosition.z = a1->vWorldPosition.z - (double)pParty->vPosition.z; |
6892 if ( pRenderer->pRenderD3D ) | 6897 //if ( pRenderer->pRenderD3D ) |
6893 { | 6898 //{ |
6894 a1->vWorldViewPosition.x = v12 * pBLVRenderParams->fSineY + v14 * pBLVRenderParams->fCosineY; | 6899 a1->vWorldViewPosition.x = v12 * pBLVRenderParams->fSineY + v14 * pBLVRenderParams->fCosineY; |
6895 a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY - v12 * pBLVRenderParams->fCosineY; | 6900 a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY - v12 * pBLVRenderParams->fCosineY; |
6896 } | 6901 /*} |
6897 else | 6902 else |
6898 { | 6903 { |
6899 a1->vWorldViewPosition.x = v14 * pBLVRenderParams->fCosineY - v12 * pBLVRenderParams->fSineY; | 6904 a1->vWorldViewPosition.x = v14 * pBLVRenderParams->fCosineY - v12 * pBLVRenderParams->fSineY; |
6900 a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY + v12 * pBLVRenderParams->fCosineY; | 6905 a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY + v12 * pBLVRenderParams->fCosineY; |
6901 } | 6906 }*/ |
6902 } | 6907 } |
6903 return 0; | 6908 return 0; |
6904 } | 6909 } |