# HG changeset patch # User Ritor1 # Date 1370803023 -21600 # Node ID 77ea5c5f2c0b2512e8de30139981e1c371563466 # Parent 8ee5f1554b643bd23c7660879301ec8974b7ef52 m diff -r 8ee5f1554b64 -r 77ea5c5f2c0b UIHouses.cpp --- a/UIHouses.cpp Sun Jun 09 21:48:48 2013 +0600 +++ b/UIHouses.cpp Mon Jun 10 00:37:03 2013 +0600 @@ -565,10 +565,10 @@ void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound) { //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) ) - if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId ) + if ( pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId ) //temporarily changing uHouseID - 1 to uHouseID pAudioPlayer->PlaySound( //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)), - (SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId + 300)), + (SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId + 300)), //temporarily changing uHouseID - 1 to uHouseID 806, 0, -1, 0, 0, 0, 0); } diff -r 8ee5f1554b64 -r 77ea5c5f2c0b UITransition.cpp --- a/UITransition.cpp Sun Jun 09 21:48:48 2013 +0600 +++ b/UITransition.cpp Mon Jun 10 00:37:03 2013 +0600 @@ -132,7 +132,7 @@ LABEL_20: pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName.data()); //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) - if ( pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].uRoomSoundId ) + if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) //temporarily changing anim_id - 1 to anim_id PlayHouseSound(anim_id, HouseSound_Greeting); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); diff -r 8ee5f1554b64 -r 77ea5c5f2c0b mm7_1.cpp --- a/mm7_1.cpp Sun Jun 09 21:48:48 2013 +0600 +++ b/mm7_1.cpp Mon Jun 10 00:37:03 2013 +0600 @@ -1487,7 +1487,7 @@ //----- (00423B5D) -------------------------------------------------------- int __fastcall sub_423B5D(unsigned int uFaceID) { - BLVFace *v1; // ebx@1 + BLVFace *pFace; // ebx@1 Vec3_short_ *v2; // esi@1 //int v3; // ST28_4@1 __int16 v4; // ST2C_2@1 @@ -1577,45 +1577,39 @@ signed int id; // [sp+24h] [bp-4h]@51 signed int ie; // [sp+24h] [bp-4h]@61 - v1 = &pIndoor->pFaces[uFaceID]; + pFace = &pIndoor->pFaces[uFaceID]; //this = pGame->pIndoorCameraD3D; - v2 = &pIndoor->pVertices[v1->pVertexIDs[0]]; + v2 = &pIndoor->pVertices[pFace->pVertexIDs[0]]; //v3 = *(_DWORD *)&v2->x; v4 = v2->z; //v5 = 0; - if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) - + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) - + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) + if ( pFace->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) + + pFace->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) + + pFace->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) { stru_50B700.field_0 = 1; } else { stru_50B700.field_0 = 0; - if ( !v1->Portal() ) + if ( !pFace->Portal() ) return 0; } //v66 = v1->uNumVertices; - for (uint i = 0; i < v1->uNumVertices; ++i) + for (uint i = 0; i < pFace->uNumVertices; ++i) { - auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]]; - pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( - v6->x, - v6->y, - v6->z, - &stru_50B700._view_transformed_xs[i], - &stru_50B700._view_transformed_zs[i], - &stru_50B700._view_transformed_ys[i], - 0); + auto v6 = &pIndoor->pVertices[pFace->pVertexIDs[i]]; + pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(v6->x, v6->y, v6->z, + &stru_50B700._view_transformed_xs[i], &stru_50B700._view_transformed_zs[i], &stru_50B700._view_transformed_ys[i], 0); } //v7 = v1->uNumVertices; //v8 = 0; - if (v1->uNumVertices <= 0) + if (pFace->uNumVertices <= 0) return 0; bool bFound = false; - for (uint i = 0; i < v1->uNumVertices; ++i) + for (uint i = 0; i < pFace->uNumVertices; ++i) if (stru_50B700._view_transformed_xs[i] >= 0x80000u) { bFound = true; @@ -1625,12 +1619,12 @@ return 0; v79 = 0; - stru_50B700._view_transformed_xs[v1->uNumVertices] = stru_50B700._view_transformed_xs[0]; - stru_50B700._view_transformed_zs[v1->uNumVertices] = stru_50B700._view_transformed_zs[0]; - stru_50B700._view_transformed_ys[v1->uNumVertices] = stru_50B700._view_transformed_ys[0]; + stru_50B700._view_transformed_xs[pFace->uNumVertices] = stru_50B700._view_transformed_xs[0]; + stru_50B700._view_transformed_zs[pFace->uNumVertices] = stru_50B700._view_transformed_zs[0]; + stru_50B700._view_transformed_ys[pFace->uNumVertices] = stru_50B700._view_transformed_ys[0]; thisa = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u; //int i = 1; - for (uint i = 1; i <= v1->uNumVertices; ++i) + for (uint i = 1; i <= pFace->uNumVertices; ++i) { v10 = stru_50B700._view_transformed_xs[i]; v81 = v10 >= (signed int)0x80000u; diff -r 8ee5f1554b64 -r 77ea5c5f2c0b mm7_3.cpp --- a/mm7_3.cpp Sun Jun 09 21:48:48 2013 +0600 +++ b/mm7_3.cpp Mon Jun 10 00:37:03 2013 +0600 @@ -11405,56 +11405,54 @@ //----- (004406BC) -------------------------------------------------------- void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode) { - BLVSector *v2; // esi@2 - BSPNode *v3; // edi@2 - BLVFace *v4; // eax@2 + BLVSector *pSector; // esi@2 + BSPNode *pNode; // edi@2 + BLVFace *pFace; // eax@2 int v5; // ecx@2 __int16 v6; // ax@6 int v7; // ebp@10 int v8; // ebx@10 __int16 v9; // di@18 //int v10; // [sp+10h] [bp-Ch]@1 - bool v11; // [sp+14h] [bp-8h]@5 - BspRenderer_stru0 *v12; // [sp+18h] [bp-4h]@1 + //bool v11; // [sp+14h] [bp-8h]@5 + BspRenderer_stru0 *node; // [sp+18h] [bp-4h]@1 //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode); //v10 = a1; - v12 = &pBspRenderer->nodes[node_id]; + node = &pBspRenderer->nodes[node_id]; while ( 1 ) { - v2 = &pIndoor->pSectors[v12->uSectorID]; - v3 = &pIndoor->pNodes[uFirstNode]; - v4 = &pIndoor->pFaces[v2->pFaceIDs[v3->uCoplanarOffset]]; - v5 = 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; - if (v4->Portal() && v4->uSectorID != v12->uSectorID ) + 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; + if (pFace->Portal() && pFace->uSectorID != node->uSectorID ) v5 = -v5; - v11 = v5 > 0; + //v11 = v5 > 0; if ( v5 <= 0 ) - v6 = v3->uFront; + v6 = pNode->uFront; else - v6 = v3->uBack; + v6 = pNode->uBack; if ( v6 != -1 ) sub_4406BC(node_id, v6); - v7 = v3->uCoplanarOffset; - v8 = v7 + v3->uCoplanarSize; + v7 = pNode->uCoplanarOffset; + v8 = v7 + pNode->uCoplanarSize; //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]); if ( pRenderer->pRenderD3D ) { while ( v7 < v8 ) - pBspRenderer->AddFaceToRenderList_d3d(node_id, v2->pFaceIDs[v7++]); + pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[v7++]); } else { while ( v7 < v8 ) - pBspRenderer->AddFaceToRenderList_sw(node_id, v2->pFaceIDs[v7++]); - } - v9 = v11 ? v3->uFront : v3->uBack; + pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[v7++]); + } + v9 = v5 > 0 ? pNode->uFront : pNode->uBack; if ( v9 == -1 ) break; uFirstNode = v9;