Mercurial > might-and-magic-trilogy
changeset 58:41cbaabde2cb
BLV render
author | Nomad |
---|---|
date | Thu, 25 Oct 2012 02:05:16 +0200 |
parents | fd2fd234a66c |
children | 5159d2e6f559 |
files | Actor.cpp AudioPlayer.cpp Game.cpp Indoor.cpp Indoor.h IndoorCameraD3D.cpp LayingItem.cpp Outdoor.cpp Party.cpp Party.h SaveLoad.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp stru10.cpp |
diffstat | 18 files changed, 809 insertions(+), 765 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/Actor.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -729,10 +729,10 @@ } if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) return; - v118 = pParty->vPosition.y; + v118 = pParty->vPosition.z; v111 = pParty->vPosition.x; - v114 = pParty->vPosition.y + 2500; - v113 = pParty->vPosition.z; + v114 = pParty->vPosition.z + 2500; + v113 = pParty->vPosition.y; v23 = 8; if ( uSkillLevel & 0x0100 ) { @@ -1786,8 +1786,8 @@ if ( !v4 ) { outx = pParty->vPosition.x; - outy = pParty->vPosition.z; - v14 = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + outy = pParty->vPosition.y; + v14 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; LABEL_27: outz = v14; goto LABEL_28; @@ -1807,21 +1807,21 @@ v39 = &outy; v38 = &outx; v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi; - v37.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; goto LABEL_20; } v40 = &outz; v39 = &outy; v38 = &outx; v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi; - v37.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; } else { v40 = &outz; v39 = &outy; v38 = &outx; - v37.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY; } *(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x; @@ -1834,7 +1834,7 @@ v40 = &outz; v39 = &outy; v38 = &outx; - v37.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY; LABEL_20: *(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x; @@ -1891,11 +1891,11 @@ if ( v21 == 4 ) { LODWORD(v45) = pParty->vPosition.x; - LODWORD(v44) = pParty->vPosition.z; + LODWORD(v44) = pParty->vPosition.y; v29 = a4; if ( !a4 ) v29 = pParty->sEyelevel; - v28 = pParty->vPosition.y + v29; + v28 = pParty->vPosition.z + v29; goto LABEL_44; } if ( v21 == 5 ) @@ -2155,8 +2155,8 @@ if ( (edx0 & 7) == 4 ) { v6 = (AIDirection *)pParty->vPosition.x; - v7 = (AIDirection *)pParty->vPosition.z; - v23 = pParty->vPosition.y + pParty->sEyelevel; + v7 = (AIDirection *)pParty->vPosition.y; + v23 = pParty->vPosition.z + pParty->sEyelevel; } else { @@ -2554,8 +2554,8 @@ if ( (edx0 & 7) == 4 ) { v4 = (AIDirection *)pParty->vPosition.x; - v5 = (AIDirection *)pParty->vPosition.z; - v21 = pParty->vPosition.y + pParty->sEyelevel; + v5 = (AIDirection *)pParty->vPosition.y; + v21 = pParty->vPosition.z + pParty->sEyelevel; } else { @@ -2666,8 +2666,8 @@ if ( (edx0 & 7) == 4 ) { v4 = (AIDirection *)pParty->vPosition.x; - v5 = (AIDirection *)pParty->vPosition.z; - v21 = pParty->vPosition.y + pParty->sEyelevel; + v5 = (AIDirection *)pParty->vPosition.y; + v21 = pParty->vPosition.z + pParty->sEyelevel; } else { @@ -2777,8 +2777,8 @@ if ( (edx0 & 7) == 4 ) { v4 = (AIDirection *)pParty->vPosition.x; - v5 = (AIDirection *)pParty->vPosition.z; - v20 = pParty->vPosition.y + pParty->sEyelevel; + v5 = (AIDirection *)pParty->vPosition.y; + v20 = pParty->vPosition.z + pParty->sEyelevel; } else { @@ -2873,8 +2873,8 @@ if ( (edx0 & 7) == 4 ) { v4 = pParty->vPosition.x; - v5 = pParty->vPosition.z; - v22 = pParty->vPosition.y + pParty->sEyelevel; + v5 = pParty->vPosition.y; + v22 = pParty->vPosition.z + pParty->sEyelevel; } else { @@ -3436,7 +3436,7 @@ v19 = stru_5C6E00->SinCos(v18 + v13 - stru_5C6E00->uIntegerHalfPi); v7->uYawAngle = stru_5C6E00->Atan2( v17 - v7->vPosition.x, - pParty->vPosition.z + pParty->vPosition.y + ((unsigned __int64)(v19 * (signed __int64)v10->uDistanceXZ) >> 16) - v7->vPosition.y); if ( uActionLength ) @@ -3800,8 +3800,8 @@ if ( !v3->pMonsterInfo.uHostilityType ) v15 = dword_4DF380[v14]; v16 = abs(v3->vPosition.x - pParty->vPosition.x); - v28 = abs(v3->vPosition.y - pParty->vPosition.z); - v17 = abs(v3->vPosition.z - pParty->vPosition.y); + v28 = abs(v3->vPosition.y - pParty->vPosition.y); + v17 = abs(v3->vPosition.z - pParty->vPosition.z); if ( v16 <= v15 && v28 <= v15 && v17 <= v15 ) { if ( v16 * v16 + v28 * v28 + v17 * v17 < (unsigned int)v25 )
--- a/AudioPlayer.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/AudioPlayer.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -825,12 +825,12 @@ if ( !a5 ) v75 = pParty->vPosition.x; if ( !a6 ) - a6 = pParty->vPosition.z; + a6 = pParty->vPosition.y; if ( uNumRepeats ) AIL_set_sample_loop_count(v73->hSample, uNumRepeats - 1); v83 = sub_4AB66C(v75, a6); AIL_set_sample_pan(v73->hSample, v83); - v84 = GetSoundStrengthByDistanceFromParty(v75, a6, pParty->vPosition.y); + v84 = GetSoundStrengthByDistanceFromParty(v75, a6, pParty->vPosition.z); AIL_set_sample_volume(v73->hSample, v84); v76 = a3; goto LABEL_184; @@ -1049,8 +1049,8 @@ v12 = 10; LABEL_46: a1.vWorldPosition.x = (double)pParty->vPosition.x; - a1.vWorldPosition.y = (double)pParty->vPosition.z; - v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.y; + a1.vWorldPosition.y = (double)pParty->vPosition.y; + v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_47; } v12 = 10 * v13 / 16; @@ -1259,10 +1259,10 @@ if ( (a3 & 7) != 5 ) { a1.vWorldPosition.x = (double)pParty->vPosition.x; - v43 = (double)pParty->vPosition.z; + v43 = (double)pParty->vPosition.y; LABEL_100: a1.vWorldPosition.y = v43; - v47 = (double)pParty->sEyelevel + (double)pParty->vPosition.y; + v47 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_101; } v44 = (LayingItem *)&pLevelDecorations[a3 >> 3]; @@ -1427,8 +1427,8 @@ if ( v10 != 2 ) { a1.vWorldPosition.x = (double)pParty->vPosition.x; - a1.vWorldPosition.y = (double)pParty->vPosition.z; - v11 = (double)pParty->sEyelevel + (double)pParty->vPosition.y; + a1.vWorldPosition.y = (double)pParty->vPosition.y; + v11 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_21; } v12 = (LayingItem *)&pLevelDecorations[v6->field_4 >> 3]; @@ -1451,8 +1451,8 @@ if ( pBLVRenderParams->sPartyRotX ) { v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; - *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.z; - v18 = a1.vWorldPosition.z - (double)pParty->vPosition.y; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; + v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z; if ( pRenderer->pRenderD3D ) { v19 = *(float *)&uNumRepeats * v56 + v58 * v55; @@ -1470,7 +1470,7 @@ else { v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; - *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.z; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; if ( pRenderer->pRenderD3D ) { a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55; @@ -1482,7 +1482,7 @@ v21 = v58 * v56 + *(float *)&uNumRepeats * v55; } a1.vWorldViewPosition.y = v21; - a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.y; + a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z; } } else @@ -1623,8 +1623,8 @@ LODWORD(v56) = 1; v43 = 4 * v59 + 6817720; v44 = &pLevelDecorations[_6807B8_level_decorations_ids[v59]]; - v45 = abs(v44->vPosition.z - pParty->vPosition.y); - v46 = abs(v44->vPosition.y - pParty->vPosition.z); + v45 = abs(v44->vPosition.z - pParty->vPosition.z); + v46 = abs(v44->vPosition.y - pParty->vPosition.y); v47 = abs(v44->vPosition.x - pParty->vPosition.x); if ( sub_4621DA(v47, v46, v45) <= 8192 ) break; @@ -1692,7 +1692,7 @@ { signed int v2; // eax@1 - v2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->Atan2(a1 - pParty->vPosition.x, a2 - pParty->vPosition.z) + v2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->Atan2(a1 - pParty->vPosition.x, a2 - pParty->vPosition.y) - stru_5C6E00->uIntegerHalfPi - pParty->sRotationY); if ( v2 > (signed int)stru_5C6E00->uIntegerPi ) @@ -1714,8 +1714,8 @@ v3 = a2; v4 = a1; - v5 = abs(a3 - pParty->vPosition.y); - v6 = abs(v3 - pParty->vPosition.z); + v5 = abs(a3 - pParty->vPosition.z); + v6 = abs(v3 - pParty->vPosition.y); v7 = abs(v4 - pParty->vPosition.x); v9 = sub_4621DA(v7, v6, v5); if ( v9 <= 8192 ) @@ -2201,8 +2201,8 @@ if ( pBLVRenderParams->sPartyRotX ) { v13 = a1->vWorldPosition.x - (double)pParty->vPosition.x; - v11 = a1->vWorldPosition.y - (double)pParty->vPosition.z; - v4 = a1->vWorldPosition.z - (double)pParty->vPosition.y; + v11 = a1->vWorldPosition.y - (double)pParty->vPosition.y; + v4 = a1->vWorldPosition.z - (double)pParty->vPosition.z; if ( pRenderer->pRenderD3D ) { v5 = v11 * pBLVRenderParams->fSineY + v13 * pBLVRenderParams->fCosineY; @@ -2220,8 +2220,8 @@ else { v14 = a1->vWorldPosition.x - (double)pParty->vPosition.x; - v12 = a1->vWorldPosition.y - (double)pParty->vPosition.z; - v7 = a1->vWorldPosition.z - (double)pParty->vPosition.y; + v12 = a1->vWorldPosition.y - (double)pParty->vPosition.y; + v7 = a1->vWorldPosition.z - (double)pParty->vPosition.z; if ( pRenderer->pRenderD3D ) { a1->vWorldViewPosition.x = v12 * pBLVRenderParams->fSineY + v14 * pBLVRenderParams->fCosineY;
--- a/Game.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/Game.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -61,11 +61,11 @@ pIndoorCamera->pos.x = pParty->vPosition.x - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) * (signed __int64)pParty->field_18) >> 16); - pIndoorCamera->pos.y = pParty->vPosition.z + pIndoorCamera->pos.y = pParty->vPosition.y - ((unsigned __int64)(stru_5C6E00->SinCos( pParty->sRotationY - stru_5C6E00->uIntegerHalfPi) * (signed __int64)pParty->field_18) >> 16); - pIndoorCamera->pos.z = pParty->vPosition.y + pParty->sEyelevel; + pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel; pIndoorCamera->Initialize2(); pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff(); pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum(); @@ -79,13 +79,13 @@ } else { - if ( pParty->vPosition.x != pParty->vPrevPosition.x | pParty->sRotationY != pParty->sPrevRotationY | pParty->vPosition.z != pParty->vPrevPosition.z | pParty->sRotationX != pParty->sPrevRotationX | pParty->vPosition.y != pParty->vPrevPosition.y | pParty->sEyelevel != pParty->sPrevEyelevel ) + if ( pParty->vPosition.x != pParty->vPrevPosition.x | pParty->sRotationY != pParty->sPrevRotationY | pParty->vPosition.y != pParty->vPrevPosition.z | pParty->sRotationX != pParty->sPrevRotationX | pParty->vPosition.z != pParty->vPrevPosition.y | pParty->sEyelevel != pParty->sPrevEyelevel ) pParty->uFlags |= 2u; pParty->vPrevPosition.x = pParty->vPosition.x; - pParty->vPrevPosition.y = pParty->vPosition.y; + pParty->vPrevPosition.y = pParty->vPosition.z; //v0 = &pRenderer; pParty->sPrevRotationY = pParty->sRotationY; - pParty->vPrevPosition.z = pParty->vPosition.z; + pParty->vPrevPosition.z = pParty->vPosition.y; pParty->sPrevRotationX = pParty->sRotationX; pParty->sPrevEyelevel = pParty->sEyelevel; pRenderer->BeginSceneD3D(); @@ -419,21 +419,21 @@ if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 136) ) { pParty->vPosition.x = -17331; // respawn in harmondale - pParty->vPosition.z = 12547; - pParty->vPosition.y = 465; + pParty->vPosition.y = 12547; + pParty->vPosition.z = 465; pParty->sRotationY = 0; v13 = "out02.odm"; } else { pParty->vPosition.x = 12552; // respawn on emerald isle - pParty->vPosition.z = 1816; - pParty->vPosition.y = 0; + pParty->vPosition.y = 1816; + pParty->vPosition.z = 0; pParty->sRotationY = 512; v13 = "out01.odm"; } strcpy(Source, v13); - pParty->uFallStartY = pParty->vPosition.y; + pParty->uFallStartY = pParty->vPosition.z; pParty->sRotationX = 0; pParty->uFallSpeed = 0; pParty->field_6E4 = 0; @@ -442,8 +442,8 @@ { strcpy(pCurrentMapName, Source); _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x; - _5B65AC_npcdata_fame_or_other = pParty->vPosition.z; - _5B65B0_npcdata_rep_or_other = pParty->vPosition.y; + _5B65AC_npcdata_fame_or_other = pParty->vPosition.y; + _5B65B0_npcdata_rep_or_other = pParty->vPosition.z; _5B65B4_npcdata_loword_house_or_other = pParty->sRotationY; _5B65B8_npcdata_hiword_house_or_other = pParty->sRotationX; dword_5B65C0 = 1;
--- a/Indoor.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/Indoor.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -100,10 +100,10 @@ //v4 = pParty->flt_TorchlightColorR + 6.7553994e15; //v3 = pParty->flt_TorchlightColorG + 6.7553994e15; pMobileLightsStack->AddLight( - SLOWORD(pBLVRenderParams->vPartyPos.x), - SLOWORD(pBLVRenderParams->vPartyPos.y), - SLOWORD(pBLVRenderParams->vPartyPos.z), - SLOWORD(pBLVRenderParams->uRadius), + pBLVRenderParams->vPartyPos.x, + pBLVRenderParams->vPartyPos.y, + pBLVRenderParams->vPartyPos.z, + pBLVRenderParams->uPartySectorID, v5, floorf(pParty->flt_TorchlightColorR + 0.5f), floorf(pParty->flt_TorchlightColorG + 0.5f), @@ -179,15 +179,15 @@ v6 = this->vPartyPos.x; this->sPartyRotX = a2->sRotationX; v7 = pIndoor->GetSector(v6, v5, v4); - v3->uRadius = v7; + v3->uPartySectorID = v7; if ( !v7 ) { v8 = v3->vPartyPos.z; v3->vPartyPos.x = pParty->vPosition.x; - v9 = pParty->vPosition.z; + v9 = pParty->vPosition.y; v10 = v3->vPartyPos.x; - v3->vPartyPos.y = pParty->vPosition.z; - v3->uRadius = pIndoor->GetSector(v10, v9, v8); + v3->vPartyPos.y = pParty->vPosition.y; + v3->uPartySectorID = pIndoor->GetSector(v10, v9, v8); } if ( pRenderer->pRenderD3D ) { @@ -270,7 +270,7 @@ if (bD3D) { - pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y); + pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); for (uint i = 0; i < pStru170->uNumFaceIDs; ++i) { v2 = pStru170->pFaceIDs[2 * i + 1]; @@ -310,7 +310,7 @@ int v7; // [sp+Ch] [bp-4h]@8 sub_43F39E(_this); - if ( pBLVRenderParams->uRadius ) + if (pBLVRenderParams->uPartySectorID) IndoorLocation::ExecDraw(pRenderer->pRenderD3D != 0); pRenderer->DrawBillboardList_BLV(); if ( !pRenderer->pRenderD3D ) @@ -362,7 +362,7 @@ int v0; // eax@1 IndoorLocation_drawstru _this; // [sp+0h] [bp-4Ch]@5 int v2; // [sp+44h] [bp-8h]@5 - float v3; // [sp+48h] [bp-4h]@5 + int v3; // [sp+48h] [bp-4h]@5 v0 = 0; if ( viewparams->field_50_draw_debug_outlines ) @@ -375,9 +375,9 @@ - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) * (signed __int64)pParty->field_18) >> 16); v2 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); - LODWORD(v3) = (unsigned __int64)(v2 * (signed __int64)pParty->field_18) >> 16; + v3 = (unsigned __int64)(v2 * (signed __int64)pParty->field_18) >> 16; _this.field_1C_mb_fov = 65; - _this.vPosition.y = pParty->vPosition.z - LODWORD(v3); + _this.vPosition.y = pParty->vPosition.y - v3; _this.sRotationY = pParty->sRotationY; _this.sRotationX = pParty->sRotationX; _this.pRenderTarget = pRenderer->pTargetSurface; @@ -386,7 +386,7 @@ _this.uViewportZ = pViewport->uScreenZ; _this.uViewportW = pViewport->uScreenW; _this.field_3C = pViewport->field_30; - _this.vPosition.z = pParty->vPosition.y + pParty->sEyelevel; + _this.vPosition.z = pParty->vPosition.z + pParty->sEyelevel; _this.uTargetWidth = 640; _this.uTargetHeight = 480; _this.pTargetZ = pRenderer->pActiveZBuffer; @@ -2706,7 +2706,7 @@ auto pSector = pSectors + i; pSector->pFloors = ptr_0002B0_sector_rdata + j; - j += pSector->field_4; + j += pSector->uNumFloors; pSector->pWalls = ptr_0002B0_sector_rdata + j; j += pSector->field_C; @@ -3180,33 +3180,33 @@ //unsigned __int8 v5; // zf@1 //unsigned __int8 v6; // sf@1 //unsigned __int8 v7; // of@1 - BLVSector *v8; // eax@3 - int v9; // edi@9 - int v10; // eax@9 - int v11; // edx@9 - int v12; // eax@10 - unsigned __int16 v13; // ax@12 - int v14; // edi@14 - BLVFace *v15; // eax@14 - BLVFace *v16; // edi@14 - PolygonType v17; // al@14 - unsigned __int16 *pVertexIDs; // esi@16 - Vec3_short_ *v19; // eax@16 - int v20; // edx@16 - unsigned __int16 *v21; // esi@17 - int v22; // edi@19 - int v23; // edi@20 - Vec3_short_ *v24; // edx@20 + //BLVSector *v8; // eax@3 + //int v9; // edi@9 + //int v10; // eax@9 + //int v11; // edx@9 + //int v12; // eax@10 + //unsigned __int16 v13; // ax@12 + //int v14; // edi@14 + //BLVFace *v15; // eax@14 + //BLVFace *v16; // edi@14 + //PolygonType v17; // al@14 + //unsigned __int16 *pVertexIDs; // esi@16 + //Vec3_short_ *v19; // eax@16 + //int v20; // edx@16 + //unsigned __int16 *v21; // esi@17 + //int v22; // edi@19 + //int v23; // edi@20 + //Vec3_short_ *v24; // edx@20 signed int v25; // edx@21 int v26; // ebx@23 - int v27; // edx@26 - signed __int64 v28; // qtt@26 - Vec3_short_ *v29; // eax@26 - Vec3_short_ *v30; // edx@26 - int v31; // edx@26 + //int v27; // edx@26 + //signed __int64 v28; // qtt@26 + ///Vec3_short_ *v29; // eax@26 + //Vec3_short_ *v30; // edx@26 + //int v31; // edx@26 signed int v32; // edi@27 signed __int64 v33; // qtt@27 - Vec3_short_ *v34; // edx@27 + //Vec3_short_ *v34; // edx@27 int v35; // edx@32 int v37; // edi@38 int v38; // ebx@40 @@ -3215,21 +3215,21 @@ PolygonType v41; // dl@42 int v42; // edx@43 int v43[50]; // [sp+Ch] [bp-108h]@1 - int v44; // [sp+D4h] [bp-40h]@9 - int v45; // [sp+D8h] [bp-3Ch]@14 - int v46; // [sp+DCh] [bp-38h]@14 - int v47; // [sp+E0h] [bp-34h]@19 - int v48; // [sp+E4h] [bp-30h]@9 - Vec3_short_ *v49; // [sp+E8h] [bp-2Ch]@19 + //int v44; // [sp+D4h] [bp-40h]@9 + //int v45; // [sp+D8h] [bp-3Ch]@14 + //int v46; // [sp+DCh] [bp-38h]@14 + //int v47; // [sp+E0h] [bp-34h]@19 + //int v48; // [sp+E4h] [bp-30h]@9 + //Vec3_short_ *v49; // [sp+E8h] [bp-2Ch]@19 bool v50; // [sp+ECh] [bp-28h]@19 int v51; // [sp+F0h] [bp-24h]@9 - unsigned int v52; // [sp+F4h] [bp-20h]@2 + //unsigned int v52; // [sp+F4h] [bp-20h]@2 int v53; // [sp+F8h] [bp-1Ch]@10 int v54; // [sp+FCh] [bp-18h]@16 int v55; // [sp+100h] [bp-14h]@1 int v56; // [sp+104h] [bp-10h]@1 int v57; // [sp+108h] [bp-Ch]@16 - Vec3_short_ *v58; // [sp+10Ch] [bp-8h]@20 + //Vec3_short_ *v58; // [sp+10Ch] [bp-8h]@20 int v59; // [sp+110h] [bp-4h]@16 v4 = 0; @@ -3238,140 +3238,134 @@ //v6 = this->uNumSectors - 1 < 0; v55 = 0; v43[0] = 0; - v56 = 1; + //v56 = 1; if (uNumSectors < 2) return 0; - v52 = 116; - do + for (uint i = 1; i < uNumSectors; ++i) { - v8 = &this->pSectors[v52 / 0x74]; - if ( v8->pBounding.x1 <= sX ) - { - if ( v8->pBounding.x2 >= sX ) - { - if ( v8->pBounding.y1 <= sY ) + auto pSector = pSectors + i; + + if (pSector->pBounding.x1 <= sX && pSector->pBounding.x2 >= sX) + if (pSector->pBounding.y1 <= sY && pSector->pBounding.y2 >= sY) + if (pSector->pBounding.z1 - 64 <= sZ && pSector->pBounding.z2 + 64 >= sZ) { - if ( v8->pBounding.y2 >= sY ) - { - if ( v8->pBounding.z1 - 64 <= sZ ) - { - if ( v8->pBounding.z2 + 64 >= sZ ) - { - v9 = v8->field_4; - v10 = v9 + v8->uNumPortals; - v11 = 0; - v44 = v9; - v51 = v10; - v48 = 0; - if ( v10 > 0 ) - { - v12 = -2 * v9; - v53 = -2 * v9; - do - { - if ( v11 < v44 ) - v13 = this->pSectors[v52 / 0x74].pFloors[v11]; + Log::Warning(L"Sector[%u]", i); + v51 = pSector->uNumFloors + pSector->uNumPortals; + if (!v51) + continue; + + //v9 = pSector->uNumFloors; + //v10 = v9 + pSector->uNumPortals; + //v11 = 0; + //v44 = v9; + //v48 = 0; + + //v12 = -2 * v9; + //v53 = -2 * v9; + for (uint j = 0; j < v51; ++j) + { + unsigned int uFaceID; + if (j < pSector->uNumFloors) + uFaceID = pSector->pFloors[j]; + else + uFaceID = pSector->pPortals[j - pSector->uNumFloors]; + + auto pFace = pFaces + uFaceID; + //v14 = (signed __int16)v13; + //v15 = this->pFaces; + //v46 = v13; + //v14 *= 96; + //v45 = v13 * sizeof(BLVFace); + //v16 = pFaces + uFaceID; + //v17 = v16->uPolygonType; + if (pFace->uPolygonType == POLYGON_Floor || + pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) + { + //pVertexIDs = pFace->pVertexIDs; + //v19 = this->pVertices; + //v20 = pVertices[pFace->pVertexIDs[0]].y; + v54 = 0; + //v57 = 0; + //v5 = v16->uNumVertices == 0; + v59 = pVertices[pFace->pVertexIDs[0]].y >= sY; + + //v21 = pFace->pVertexIDs + 1; + for (uint k = 1; k < pFace->uNumVertices; ++k) + { + if (v54 >= 2) + break; + + //v49 = &pVertices[pFace->pVertexIDs[k]]; + auto v2 = &pVertices[pFace->pVertexIDs[k]]; + //v22 = pVertex->y; + //v47 = pVertex->y; + v50 = v2->y >= sY; + if ( v59 ^ v50 ) + { + //v58 = &pVertices[pFace->pVertexIDs[k - 1]]; + auto v1 = &pVertices[pFace->pVertexIDs[k - 1]]; + //v23 = v58->x; + //HIWORD(v24) = HIWORD(v49); + //LOWORD(v24) = v49->x; + //v49 = v24; + //v59 = v49->x; + v25 = v1->x >= sX ? 0 : 2; // BUG TODO TROLOLO + v26 = v25 | v2->x < sX; // SWAP v1 and v2 till the result's correct + if ( v26 != 3 ) + { + if (!v26) + ++v54; else - v13 = *(unsigned __int16 *)((char *)this->pSectors[v52 / 0x74].pPortals + v12); - v14 = (signed __int16)v13; - v15 = this->pFaces; - v46 = v14; - v14 *= 96; - v45 = v14; - v16 = (BLVFace *)((char *)v15 + v14); - v17 = v16->uPolygonType; - if ( v17 == 3 || v17 == 4 ) { - pVertexIDs = v16->pVertexIDs; - v19 = this->pVertices; - v20 = v19[*pVertexIDs].y; - v54 = 0; - v57 = 0; - //v5 = v16->uNumVertices == 0; - v59 = v20 >= sY; - if (v16->uNumVertices) + if (v1->x >= v2->x) { - v21 = pVertexIDs + 1; - do - { - if ( v54 >= 2 ) - break; - v49 = &v19[*v21]; - v22 = v49->y; - v47 = v49->y; - v50 = v22 >= sY; - if ( v59 ^ v50 ) - { - v58 = &v19[*(v21 - 1)]; - v23 = v58->x; - HIWORD(v24) = HIWORD(v49); - LOWORD(v24) = v49->x; - v49 = v24; - v59 = (signed __int16)v24; - v25 = (signed __int16)v24 >= sX ? 0 : 2; - v26 = v25 | v23 < sX; - if ( v26 != 3 ) - { - if ( !v26 - || (v58->x >= (signed __int16)v49 ? (v32 = v23 - v59, - v58 = (Vec3_short_ *)(v58->y - v47), - LODWORD(v33) = v32 << 16, - HIDWORD(v33) = v32 >> 16, - v59 = v33 / (signed int)v58, - v34 = this->pVertices, - v58 = (Vec3_short_ *)(v33 / (signed int)v58), - v59 = sY - v34[*v21].y, - v59 = (unsigned __int64)((signed int)v58 - * (signed __int64)v59) >> 16, - v31 = *v21) : (v27 = v58->y, - v59 -= v23, - v58 = (Vec3_short_ *)(v47 - v27), - LODWORD(v28) = v59 << 16, - HIDWORD(v28) = v59 >> 16, - v59 = v28 / (v47 - v27), - v29 = (Vec3_short_ *)(v28 / (v47 - v27)), - v30 = this->pVertices, - v58 = v29, - v59 = sY - v30[*(v21 - 1)].y, - v59 = (unsigned __int64)((signed int)v29 * (signed __int64)v59) >> 16, - v31 = *(v21 - 1)), - v19 = this->pVertices, - v59 + v19[v31].x > sX) ) - ++v54; - } - } - ++v57; - v59 = v50; - ++v21; - } - while ( v57 < *(&this->pFaces->uNumVertices + v45) ); - if ( v54 == 1 ) - { - v35 = v55++; - v43[v35] = v46; - } + int _a58; + int _a59; + + v32 = v1->x - v2->x; + LODWORD(v33) = v32 << 16; + HIDWORD(v33) = v32 >> 16; + _a58 = v33 / (v1->y - v2->y); + _a59 = (unsigned __int64)(_a58 * (__int64)(sY - v2->y)) >> 16; + + if (v59 + pVertices[k].x > sX) + ++v54; + } + else + { + int _a58; + int _a59; + v32 = v2->x - v1->x; + LODWORD(v33) = v32 << 16; + HIDWORD(v33) = v32 >> 16; + _a58 = v33 / (v2->y - v1->y); + _a59 = (unsigned __int64)(_a58 * (signed __int64)(sY - v1->y)) >> 16; + + if (_a59 + pVertices[k - 1].x > sX) + ++v54; } } - v11 = v48 + 1; - v12 = v53 + 2; - //v7 = __OFSUB__(v48 + 1, v51); - //v6 = v48++ + 1 - v51 < 0; - v53 += 2; - } - while ( ++v48 < v51 ); - v4 = v43[0]; - } - } + } + } + + v59 = v50; + } + + if (pFace->uNumVertices) + { + if (v54 == 1) + { + v35 = v55++; + v43[v35] = uFaceID; + } + } + } } + v4 = v43[0]; } - } - } - } - ++v56; - v52 += 116; } - while ( v56 < this->uNumSectors ); + if ( v55 == 1 ) return this->pFaces[v4].uSectorID; v37 = 0; @@ -4760,8 +4754,8 @@ { pParty->sRotationX = 0; pParty->sRotationY = 0; + pParty->vPosition.z = 0; pParty->vPosition.y = 0; - pParty->vPosition.z = 0; pParty->vPosition.x = 0; pParty->uFallStartY = 0; pParty->uFallSpeed = 0;
--- a/Indoor.h Wed Oct 24 17:33:46 2012 +0200 +++ b/Indoor.h Thu Oct 25 02:05:16 2012 +0200 @@ -328,7 +328,7 @@ struct BLVSector { int field_0; - __int16 field_4; + unsigned __int16 uNumFloors; __int16 field_6; unsigned __int16 *pFloors; __int16 field_C; @@ -517,7 +517,7 @@ Vec3_int_ vPartyPos; int sPartyRotY; int sPartyRotX; - int uRadius; + int uPartySectorID; int sCosineY; int sSineY; int sCosineNegX;
--- a/IndoorCameraD3D.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/IndoorCameraD3D.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -123,138 +123,205 @@ //----- (00436523) -------------------------------------------------------- void IndoorCameraD3D::ViewTransform(RenderVertexSoft *a1a, unsigned int uNumVertices) { - __debugbreak(); - /* - unsigned int v3; // esi@4 - unsigned int v4; // ecx@7 - float v7; // [sp+4h] [bp-4h]@7 - - auto a1 = this; - if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor) + if (byte_4D864C && pGame->uFlags & 0x80 || + uCurrentlyLoadedLevelType == LEVEL_Indoor) { - __asm - { - fld pIndoorCamera->fRotationYCosine - fld pIndoorCamera->fRotationYSine - fld pIndoorCamera->fRotationXCosine - } - v4 = uNumVertices; - v7 = pIndoorCamera->fRotationXSine; + float sin_x = pIndoorCamera->fRotationXSine, + cos_x = pIndoorCamera->fRotationXCosine; + float sin_y = pIndoorCamera->fRotationYSine, + cos_y = pIndoorCamera->fRotationYCosine; + + //v4 = uNumVertices; + //v7 = pIndoorCamera->fRotationXSine; if ( pIndoorCamera->sRotationX ) { - if ( (signed int)uNumVertices > 0 ) - { - _EAX = a1a; - do - { - __asm - { - fild pIndoorCamera->pos.x - fsubr dword ptr [eax] - fstp [ebp+a1] - fild pIndoorCamera->pos.y - fsubr dword ptr [eax+4] - fstp [ebp+uNumVertices] - fild pIndoorCamera->pos.z - fsubr dword ptr [eax+8] - } + + //_EAX = a1a; + for (uint i = 0; i < uNumVertices; ++i) + { + float st0, st1, st2; if ( pRenderer->pRenderD3D ) { - __asm + /*__asm { - fld [ebp+uNumVertices] - fmul st, st(3) - fld [ebp+a1] - fmul st, st(5) - faddp st(1), st - fld [ebp+a1] - fmul st, st(4) - fld [ebp+uNumVertices] - fmul st, st(6) - fsubp st(1), st - } + fld [ebp+uNumVertices] // [(a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] + fmul st, st(3) // [pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] + fld [ebp+a1] // [(a1a[i].x - pIndoorCamera->pos.x)] [pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] + fmul st, st(5) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)] + // 1[pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[pIndoorCamera->fRotationXCosine] + // 4[pIndoorCamera->fRotationYSine] + // 5[pIndoorCamera->fRotationYCosine] + faddp st(1), st // [pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] + fld [ebp+a1] // [(a1a[i].x - pIndoorCamera->pos.x)] [pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] + fmul st, st(4) // [pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] [pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine] + + fld [ebp+uNumVertices] // 0[a1a[i].y - pIndoorCamera->pos.y] + // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] + // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 3[(a1a[i].z - pIndoorCamera->pos.z)] + // 4[pIndoorCamera->fRotationXCosine] + // 5[pIndoorCamera->fRotationYSine] + // 6[pIndoorCamera->fRotationYCosine] + + fmul st, st(6) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y)] + // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] + // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 3[(a1a[i].z - pIndoorCamera->pos.z)] + // 4[pIndoorCamera->fRotationXCosine] + // 5[pIndoorCamera->fRotationYSine] + // 6[pIndoorCamera->fRotationYCosine] + + fsubp st(1), st // 0[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y)] + // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[pIndoorCamera->fRotationXCosine] + // 4[pIndoorCamera->fRotationYSine] + // 5[pIndoorCamera->fRotationYCosine] + }*/ + st0 = sin_y * (a1a[i].vWorldPosition.x - pIndoorCamera->pos.x) - cos_y * (a1a[i].vWorldPosition.y - pIndoorCamera->pos.y); + st1 = cos_y * (a1a[i].vWorldPosition.x - pIndoorCamera->pos.x) + sin_y * (a1a[i].vWorldPosition.y - pIndoorCamera->pos.y); + st2 = (a1a[i].vWorldPosition.z - pIndoorCamera->pos.z); } else { - __asm + /*__asm { - fld [ebp+a1] - fmul st, st(4) - fld [ebp+uNumVertices] - fmul st, st(4) - fsubp st(1), st - fld [ebp+a1] - fmul st, st(4) - fld [ebp+uNumVertices] - fmul st, st(6) - faddp st(1), st - } + fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)] + // 1[(a1a[i].z - pIndoorCamera->pos.z)] + // 2[pIndoorCamera->fRotationXCosine] + // 3[pIndoorCamera->fRotationYSine] + // 4[pIndoorCamera->fRotationYCosine] + fmul st, st(4) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)] + // 1[(a1a[i].z - pIndoorCamera->pos.z)] + // 2[pIndoorCamera->fRotationXCosine] + // 3[pIndoorCamera->fRotationYSine] + // 4[pIndoorCamera->fRotationYCosine] + fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)] + // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[pIndoorCamera->fRotationXCosine] + // 4[pIndoorCamera->fRotationYSine] + // 5[pIndoorCamera->fRotationYCosine] + fmul st, st(4) // 0[pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[pIndoorCamera->fRotationXCosine] + // 4[pIndoorCamera->fRotationYSine] + // 5[pIndoorCamera->fRotationYCosine] + fsubp st(1), st // 0[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 1[(a1a[i].z - pIndoorCamera->pos.z)] + // 2[pIndoorCamera->fRotationXCosine] + // 3[pIndoorCamera->fRotationYSine] + // 4[pIndoorCamera->fRotationYCosine] + fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)] + // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[pIndoorCamera->fRotationXCosine] + // 4[pIndoorCamera->fRotationYSine] + // 5[pIndoorCamera->fRotationYCosine] + fmul st, st(4) // 0[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] + // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[pIndoorCamera->fRotationXCosine] + // 4[pIndoorCamera->fRotationYSine] + // 5[pIndoorCamera->fRotationYCosine] + fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)] + // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] + // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 3[(a1a[i].z - pIndoorCamera->pos.z)] + // 4[pIndoorCamera->fRotationXCosine] + // 5[pIndoorCamera->fRotationYSine] + // 6[pIndoorCamera->fRotationYCosine] + fmul st, st(6) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y)] + // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] + // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 3[(a1a[i].z - pIndoorCamera->pos.z)] + // 4[pIndoorCamera->fRotationXCosine] + // 5[pIndoorCamera->fRotationYSine] + // 6[pIndoorCamera->fRotationYCosine] + faddp st(1), st // 0[pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y) + pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] + // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[pIndoorCamera->fRotationXCosine] + // 4[pIndoorCamera->fRotationYSine] + // 5[pIndoorCamera->fRotationYCosine] + }*/ + st0 = cos_y * (a1a[i].vWorldPosition.y - pIndoorCamera->pos.y) + sin_y * (a1a[i].vWorldPosition.x - pIndoorCamera->pos.x); + st1 = cos_y * (a1a[i].vWorldPosition.x - pIndoorCamera->pos.x) - sin_y * (a1a[i].vWorldPosition.y - pIndoorCamera->pos.y); + st2 = (a1a[i].vWorldPosition.z - pIndoorCamera->pos.z); } - __asm - { - fld st(1) - fmul st, st(4) - fld st(3) - fmul [ebp+var_4] - } - ++_EAX; - --v4; - __asm - { - fsubp st(1), st - fstp dword ptr [eax-24h] - fstp dword ptr [eax-20h] - fmul [ebp+var_4] - fld st(1) - fmul st, st(3) - faddp st(1), st - fstp dword ptr [eax-1Ch] - fstp st - } - } - while ( v4 ); + + a1a[i].vWorldViewPosition.x = st1*cos_x - st2*sin_x; + a1a[i].vWorldViewPosition.y = st0; + a1a[i].vWorldViewPosition.z = st2*cos_x + st1*sin_x; } - __asm { fstp st } } else { - __asm { fstp st } - if ( (signed int)uNumVertices > 0 ) + for (uint i = 0; i < uNumVertices; ++i) { - _EAX = a1a; - do - { - __asm - { - fild pIndoorCamera->pos.x - fsubr dword ptr [eax] - fstp [ebp+a1] - fild pIndoorCamera->pos.y - fsubr dword ptr [eax+4] - fstp [ebp+uNumVertices] - fild pIndoorCamera->pos.z - fsubr dword ptr [eax+8] - } if ( pRenderer->pRenderD3D ) { - __asm + /*__asm { - fld [ebp+uNumVertices] - fmul st, st(2) - fld [ebp+a1] - fmul st, st(4) - faddp st(1), st + fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)] + // 1[(a1a[i].z - pIndoorCamera->pos.z)] + // 2[sin_y] + // 3[cos_y] + fmul st, st(2) // 0[sin_y * (a1a[i].y - pIndoorCamera->pos.y)] + // 1[(a1a[i].z - pIndoorCamera->pos.z)] + // 2[sin_y] + // 3[cos_y] + fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)] + // 1[sin_y * (a1a[i].y - pIndoorCamera->pos.y)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[sin_y] + // 4[cos_y] + fmul st, st(4) // 0[cos_y * (a1a[i].x - pIndoorCamera->pos.x)] + // 1[sin_y * (a1a[i].y - pIndoorCamera->pos.y)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[sin_y] + // 4[cos_y] + faddp st(1), st // 0[cos_y * (a1a[i].x - pIndoorCamera->pos.x) + sin_y * (a1a[i].y - pIndoorCamera->pos.y)] + // 1[(a1a[i].z - pIndoorCamera->pos.z)] + // 2[sin_y] + // 3[cos_y] fstp dword ptr [eax+0Ch] - fld [ebp+a1] - fmul st, st(2) - fld [ebp+uNumVertices] - fmul st, st(4) - fsubp st(1), st - } + fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)] + // 1[(a1a[i].z - pIndoorCamera->pos.z)] + // 2[sin_y] + // 3[cos_y] + fmul st, st(2) // 0[sin_y * (a1a[i].x - pIndoorCamera->pos.x)] + // 1[(a1a[i].z - pIndoorCamera->pos.z)] + // 2[sin_y] + // 3[cos_y] + fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)] + // 1[sin_y * (a1a[i].x - pIndoorCamera->pos.x)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[sin_y] + // 4[cos_y] + fmul st, st(4) // 0[cos_y * (a1a[i].y - pIndoorCamera->pos.y)] + // 1[sin_y * (a1a[i].x - pIndoorCamera->pos.x)] + // 2[(a1a[i].z - pIndoorCamera->pos.z)] + // 3[sin_y] + // 4[cos_y] + fsubp st(1), st // 0[sin_y * (a1a[i].x - pIndoorCamera->pos.x) - cos_y * (a1a[i].y - pIndoorCamera->pos.y)] + // 1[(a1a[i].z - pIndoorCamera->pos.z)] + // 2[sin_y] + // 3[cos_y] + fstp dword ptr [eax+10h] + fstp dword ptr [eax+14h] + }*/ + a1a[i].vWorldViewPosition.x = cos_y * (a1a[i].vWorldPosition.x - pIndoorCamera->pos.x) + sin_y * (a1a[i].vWorldPosition.y - pIndoorCamera->pos.y); + a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pIndoorCamera->pos.x) - cos_y * (a1a[i].vWorldPosition.y - pIndoorCamera->pos.y); + a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pIndoorCamera->pos.z); } else { - __asm + __debugbreak(); + /*__asm { fld [ebp+a1] fmul st, st(3) @@ -267,39 +334,16 @@ fld [ebp+uNumVertices] fmul st, st(4) faddp st(1), st - } + + fstp dword ptr [eax+10h] + fstp dword ptr [eax+14h] + }*/ } - __asm - { - fstp dword ptr [eax+10h] - fstp dword ptr [eax+14h] - } - ++_EAX; - --v4; - } - while ( v4 ); } } - __asm - { - fstp st - fstp st - } } - else - { - v3 = uNumVertices; - if ( (signed int)uNumVertices > 0 ) - { - do - { - :ViewTransform(a1a); - ++a1a; - --v3; - } - while ( v3 ); - } - }*/ + else for (uint i = 0; i < uNumVertices; ++i) + pIndoorCamera->ViewTransform(a1a + i); }
--- a/LayingItem.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/LayingItem.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -36,8 +36,8 @@ v1 = this; pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]; v3 = abs(pParty->vPosition.x - v1->vPosition.x); - v15 = abs(pParty->vPosition.z - v1->vPosition.y); - v16 = abs(pParty->vPosition.y + pParty->sEyelevel - v1->vPosition.z); + v15 = abs(pParty->vPosition.y - v1->vPosition.y); + v16 = abs(pParty->vPosition.z + pParty->sEyelevel - v1->vPosition.z); v4 = v3; v5 = v15; v6 = v16;
--- a/Outdoor.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/Outdoor.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -61,8 +61,8 @@ * (signed __int64)pParty->field_18) >> 16); v3 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); pIndoorCamera->field_4C = v1; - pIndoorCamera->pos.y = pParty->vPosition.z - ((unsigned __int64)(v3 * (signed __int64)pParty->field_18) >> 16); - pIndoorCamera->pos.z = pParty->vPosition.y + pParty->sEyelevel; + pIndoorCamera->pos.y = pParty->vPosition.y - ((unsigned __int64)(v3 * (signed __int64)pParty->field_18) >> 16); + pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel; if ( v2 || pRenderer->pRenderD3D ) { ResetStru148s(); @@ -70,7 +70,7 @@ sub_481ED9_MessWithOutdoorCamera(); } pIndoorCamera->uMapGridCellX = WorldPosToGridCellX(pParty->vPosition.x); - pIndoorCamera->uMapGridCellZ = WorldPosToGridCellZ(pParty->vPosition.z); + pIndoorCamera->uMapGridCellZ = WorldPosToGridCellZ(pParty->vPosition.y); if ( v2 ) { Software_ResetNewEdges(); @@ -115,7 +115,7 @@ pGame->PrepareBloodsplats(); if ( v2 ) { - v4 = WorldPosToGridCellZ(pParty->vPosition.z); + v4 = WorldPosToGridCellZ(pParty->vPosition.y); v5 = WorldPosToGridCellX(pParty->vPosition.x); pOutdoor->_47EF60(v5, v4, 1); } @@ -500,7 +500,7 @@ || v15 ) return 2; v5 = WorldPosToGridCellX(pParty->vPosition.x); - v6 = WorldPosToGridCellZ(pParty->vPosition.z); + v6 = WorldPosToGridCellZ(pParty->vPosition.y); v7 = _47ED83(v5, v6 - 1); v8 = pTileTable->pTiles[_47ECC1(v7)].uTerrainType; if ( v8 )
--- a/Party.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/Party.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -777,8 +777,8 @@ if ( ((Actor *)((char *)v0 - 59))->Actor::CanAct() && *((char *)v0 + 2) != 4 && *(char *)v0 != 5 ) { v1 = abs(*(short *)((char *)v0 + 83) - pParty->vPosition.x); - v2 = abs(*(short *)((char *)v0 + 85) - pParty->vPosition.z); - v3 = abs(*(short *)((char *)v0 + 87) - pParty->vPosition.y); + v2 = abs(*(short *)((char *)v0 + 85) - pParty->vPosition.y); + v3 = abs(*(short *)((char *)v0 + 87) - pParty->vPosition.z); if ( (double)sub_4621DA(v1, v2, v3) < 512.0 ) Actor::_402968(v4, 4, 0, 0); }
--- a/Party.h Wed Oct 24 17:33:46 2012 +0200 +++ b/Party.h Thu Oct 25 02:05:16 2012 +0200 @@ -148,8 +148,12 @@ static void TakeFood(unsigned int uNumFood); static __int16 GiveFood(unsigned int _this); - inline bool WizardEyeActive() {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uExpireTime > 0;} - inline int WizardEyeSkillLevel() {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uSkill;} + inline bool WizardEyeActive() {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uExpireTime > 0;} + inline int WizardEyeSkillLevel() {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uSkill;} + inline bool FlyActive() {return pPartyBuffs[PARTY_BUFF_FLY].uExpireTime > 0;} + inline bool WaterWalkActive() {return pPartyBuffs[PARTY_BUFF_WATER_WALK].uExpireTime > 0;} + inline bool ImmolationActive() {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uExpireTime > 0;} + inline bool ImmolationSkillLevel() {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uSkill;} int field_0;
--- a/SaveLoad.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/SaveLoad.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -340,13 +340,13 @@ DstBuf = operator new(0xF4240u); pDir.Reset(); v52 = pParty->vPosition.x; - v51 = pParty->vPosition.z; - v62 = pParty->vPosition.y; + v51 = pParty->vPosition.y; + v62 = pParty->vPosition.z; v53 = pParty->sRotationY; v54 = pParty->sRotationX; pParty->vPosition.x = pParty->vPrevPosition.x; - pParty->vPosition.z = pParty->vPrevPosition.z; - pParty->vPosition.y = pParty->vPrevPosition.y; + pParty->vPosition.y = pParty->vPrevPosition.z; + pParty->vPosition.z = pParty->vPrevPosition.y; pParty->uFallStartY = pParty->vPrevPosition.y; pParty->sRotationY = pParty->sPrevRotationY; pParty->sRotationX = pParty->sPrevRotationX; @@ -669,8 +669,8 @@ } } pParty->vPosition.x = v52; - pParty->vPosition.z = v51; - pParty->vPosition.y = v62; + pParty->vPosition.y = v51; + pParty->vPosition.z = v62; pParty->uFallStartY = v62; pParty->sRotationY = v53; result = v54;
--- a/mm7_1.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/mm7_1.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -3811,8 +3811,8 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos( pParty->vPosition.x, - pParty->vPosition.z, - pParty->vPosition.y); + pParty->vPosition.y, + pParty->vPosition.z); if ( sub_476387() ) { v0 = (char *)&pParty->pPlayers[0].uClass; @@ -4542,9 +4542,9 @@ } v18 = (double)pParty->vPosition.x - (double)v14; *(float *)&a4 = v18; - v19 = (double)pParty->vPosition.z - (double)v38; + v19 = (double)pParty->vPosition.y - (double)v38; v33 = v19; - v41 = (double)pParty->sEyelevel + (double)pParty->vPosition.y - (double)v15; + v41 = (double)pParty->sEyelevel + (double)pParty->vPosition.z - (double)v15; *(float *)&sRotY = v19 * v19; *(float *)&sRotX = v18 * v18; v20 = sqrt(v41 * v41 + *(float *)&sRotX + *(float *)&sRotY); @@ -5566,16 +5566,16 @@ } a1.field_58 = 4; a1.uObjectDescID = v6; - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.y; + a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; a1.uSoundID = 0; a1.uFacing = 0; a1.uAttributes = 8; v8 = pIndoor->GetSector( pParty->vPosition.x, - pParty->vPosition.z, - pParty->sEyelevel + pParty->vPosition.y); + pParty->vPosition.y, + pParty->sEyelevel + pParty->vPosition.z); a1.uSpriteFrameID = 0; a1.uSectorID = v8; memcpy(&a1.stru_24, &pParty->pPickedItem, sizeof(a1.stru_24)); @@ -5918,17 +5918,17 @@ } } a1.uObjectDescID = v6; - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.field_58 = 4; a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.y; + a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; a1.uSoundID = 0; a1.uFacing = 0; a1.uAttributes = 8; a1.uSectorID = pIndoor->GetSector( pParty->vPosition.x, - pParty->vPosition.z, - pParty->sEyelevel + pParty->vPosition.y); + pParty->vPosition.y, + pParty->sEyelevel + pParty->vPosition.z); a1.uSpriteFrameID = 0; memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); v8 = (int *)pMouse->GetCursorPos(&v25); @@ -6481,13 +6481,13 @@ v1 = &pIndoor->pFaces[uFaceID]; //this = pGame->pIndoorCameraD3D; - v2 = &pIndoor->pVertices[*v1->pVertexIDs]; + v2 = &pIndoor->pVertices[v1->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 * (v4 - pBLVRenderParams->vPartyPos.z) < 0 ) + + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) { dword_50B700 = 1; }
--- a/mm7_2.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/mm7_2.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -3273,8 +3273,8 @@ { uDialogueType = 90; pParty->vPosition.x = 3849; - pParty->vPosition.z = 5770; - pParty->vPosition.y = 1; + pParty->vPosition.y = 5770; + pParty->vPosition.z = 1; pParty->uFallStartY = 1; pParty->sRotationY = 512; pParty->sRotationX = 0; @@ -3470,8 +3470,8 @@ pRenderer->EndScene(); pRenderer->Present(); pParty->vPosition.x = 3849; - pParty->vPosition.z = 5770; - pParty->vPosition.y = 1; + pParty->vPosition.y = 5770; + pParty->vPosition.z = 1; pParty->uFallStartY = 1; pParty->sRotationY = 512; pParty->sRotationX = 0; @@ -7852,9 +7852,9 @@ if ( v20 != uNumActors || (result = uNumActors + 1, (signed int)(uNumActors + 1) < 500) ) { v21 = 0; - v22 = pParty->vPosition.y; + v22 = pParty->vPosition.z; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - v21 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y); + v21 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v6 = &pActors[v20]; v7 = (char *)&pMonsterStats->pInfos[v23 + 1]; v19 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; @@ -7875,7 +7875,7 @@ v11 = ((unsigned __int64)(stru_5C6E00->SinCos(v10) * (signed __int64)v19) >> 16) + pParty->vPosition.x; v18 = stru_5C6E00->SinCos(v10 - stru_5C6E00->uIntegerHalfPi); v23 = (unsigned __int64)(v18 * (signed __int64)v19) >> 16; - v12 = pParty->vPosition.z; + v12 = pParty->vPosition.y; v13 = (unsigned __int64)(v18 * (signed __int64)v19) >> 16; v6->vInitialPosition.x = v11; v14 = v13 + v12; @@ -7897,8 +7897,8 @@ v6->uCurrentActionLength = 256; v6->UpdateAnimation(); if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor - || (v22 = pParty->vPosition.y, - result = pIndoor->GetSector(v11, v14, pParty->vPosition.y), + || (v22 = pParty->vPosition.z, + result = pIndoor->GetSector(v11, v14, pParty->vPosition.z), result == v21) && (result = _46CEC3_get_floor_level(v11, v14, v22, result, &v18), result != -30000) && (result = abs(result - v22), result <= 1024) ) @@ -8408,14 +8408,14 @@ v23 = (unsigned __int64)(v20 * (signed __int64)v6) >> 16; v8 = 0; v19.uIndex = v24; - v19.vPosition.y = v23 + pParty->vPosition.z; - v19.vPosition.z = pParty->vPosition.y; + v19.vPosition.y = v23 + pParty->vPosition.y; + v19.vPosition.z = pParty->vPosition.z; v26 = 0; v27 = 0; v19.vPosition.z = sub_46D49E_prolly_get_world_y_under_party( v19.vPosition.x, - v23 + pParty->vPosition.z, - pParty->vPosition.y, + v23 + pParty->vPosition.y, + pParty->vPosition.z, 0, &v26, &v27, @@ -8450,7 +8450,7 @@ else { v26 = 0; - v22 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y); + v22 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); do { ++v26; @@ -8464,17 +8464,17 @@ v16 = stru_5C6E00->SinCos(v14 - stru_5C6E00->uIntegerHalfPi); v20 = v16; v23 = (unsigned __int64)(v16 * (signed __int64)v12) >> 16; - v19.vPosition.y = v23 + pParty->vPosition.z; - v19.vPosition.z = pParty->vPosition.y; + v19.vPosition.y = v23 + pParty->vPosition.y; + v19.vPosition.z = pParty->vPosition.z; v19.uIndex = v24; - v17 = pIndoor->GetSector(v19.vPosition.x, v23 + pParty->vPosition.z, pParty->vPosition.y); + v17 = pIndoor->GetSector(v19.vPosition.x, v23 + pParty->vPosition.y, pParty->vPosition.z); if ( v17 == v22 ) { v18 = _46CEC3_get_floor_level(v19.vPosition.x, v19.vPosition.y, v19.vPosition.z, v17, &v25); v19.vPosition.z = v18; if ( v18 != -30000 ) { - if ( abs(v18 - pParty->vPosition.y) <= 1024 ) + if ( abs(v18 - pParty->vPosition.z) <= 1024 ) break; } } @@ -9003,111 +9003,109 @@ // return value: angle in integer format (multiplier of Pi/1024) unsigned int stru193_math::Atan2(int x, int y) { - stru193_math *v3; // esi@1 - int v4; // edi@1 - int v5; // ebx@1 - int v6; // eax@1 - signed int v7; // ecx@1 - unsigned int result; // eax@5 - signed int v9; // ebx@14 - signed __int64 v10; // qtt@20 - unsigned int v11; // eax@20 - int v12; // edx@20 - int v13; // ecx@38 - int v14; // eax@38 - unsigned int v15; // eax@43 - signed int v16; // [sp-4h] [bp-10h]@13 - - v3 = this; - v4 = y; - v5 = abs(x); - v6 = abs(y); - v7 = 0; - if ( v5 < 65536 && v6 >> 15 >= v5 ) - x = 0; - if ( !x ) - { - result = v3->uIntegerHalfPi; - if ( y <= 0 ) - result += v3->uIntegerPi; - return result; - } - if ( y ) - { - if ( x <= 0 ) - { - x = -x; - if ( y >= 0 ) - { - v16 = 4; - goto LABEL_19; - } - v16 = 3; + signed int quadrant; + __int64 dividend; + int quotient; + int lowIdx; + int highIdx; + int angle; + + auto X = x; + auto Y = y; + + if ( abs(X) < 65536 ) + { + if ( (abs(Y) >> 15) >= abs(X) ) + X = 0; + } + + if ( !X ) + { + if ( Y > 0 ) + { + return uIntegerHalfPi; //Pi/2 + } + else + { + return uIntegerHalfPi + uIntegerPi; //3*(Pi/2) + } + } + + if ( Y ) + { + if ( X < 0 ) + { + X = -X; + if ( Y > 0 ) + { + quadrant = 4; + } + else + { + quadrant = 3; + } } else { - if ( y >= 0 ) - { - v9 = 1; - goto LABEL_20; - } - v16 = 2; - } - v4 = -y; -LABEL_19: - v9 = v16; -LABEL_20: - LODWORD(v10) = v4 << 16; - HIDWORD(v10) = v4 >> 16; - v11 = v3->uIntegerHalfPi; - v12 = v10 / x; - if ( v12 <= v3->pTanTable[(signed int)v3->uIntegerHalfPi >> 1] ) - v11 = (signed int)v3->uIntegerHalfPi >> 1; - else - v7 = (signed int)v3->uIntegerHalfPi >> 1; - if ( v12 <= v3->pTanTable[(signed int)(v7 + v11) >> 1] ) - v11 = (signed int)(v7 + v11) >> 1; - else - v7 = (signed int)(v7 + v11) >> 1; - if ( v12 <= v3->pTanTable[(signed int)(v7 + v11) >> 1] ) - v11 = (signed int)(v7 + v11) >> 1; - else - v7 = (signed int)(v7 + v11) >> 1; - if ( v12 <= v3->pTanTable[(signed int)(v7 + v11) >> 1] ) - v11 = (signed int)(v7 + v11) >> 1; - else - v7 = (signed int)(v7 + v11) >> 1; - if ( v12 <= v3->pTanTable[(signed int)(v7 + v11) >> 1] ) - v11 = (signed int)(v7 + v11) >> 1; - else - v7 = (signed int)(v7 + v11) >> 1; - if ( v12 <= v3->pTanTable[(signed int)(v7 + v11) >> 1] ) - v11 = (signed int)(v7 + v11) >> 1; - else - v7 = (signed int)(v7 + v11) >> 1; - v13 = v7 + 1; - v14 = v11 - 1; - while ( v13 < v14 && v12 >= v3->pTanTable[v13] ) - ++v13; - if ( v9 == 2 ) - { - v15 = v3->uIntegerDoublePi; - } - else - { - if ( v9 == 3 ) - return v13 + v3->uIntegerPi; - if ( v9 != 4 ) - return v13; - v15 = v3->uIntegerPi; - } - return v15 - v13; - } - if ( x <= 0 ) - result = v3->uIntegerPi; - else - result = 0; - return result; + if ( Y > 0 ) + { + quadrant = 1; + } + else + { + quadrant = 2; + } + } + + if ( Y < 0 ) + Y = -Y; + + LODWORD(dividend) = Y << 16; + HIDWORD(dividend) = Y >> 16; + quotient = dividend / X; + + //looks like binary search + { + int i; + highIdx = uIntegerHalfPi; + lowIdx = 0; + + for (i = 0; i < 6; ++i) + { + if (quotient <= pTanTable[(lowIdx + highIdx) / 2]) + highIdx = (lowIdx + highIdx) / 2; + else + lowIdx = (lowIdx + highIdx) / 2; + } + } + + angle = lowIdx + 1; + while ( angle < (highIdx - 1) && quotient >= pTanTable[angle] ) + ++angle; + + switch (quadrant) + { + case 1: //X > 0, Y > 0 + return angle; + + case 2: //X > 0, Y < 0 + return uIntegerDoublePi - angle; //2*Pi - angle + + case 3: //X > 0, Y < 0 + return uIntegerPi + angle; //Pi + angle + + case 4: //X < 0, Y > 0 + return uIntegerPi - angle; //Pi - angle + } + + //should newer get here + return 0; + } + + if ( X < 0 ) //Y == 0, X < 0 + return uIntegerPi; + + return 0; } @@ -11783,12 +11781,12 @@ pParty->vPrevPosition.y = v0; pParty->vPrevPosition.x = 12552; pParty->vPosition.x = 12552; - pParty->vPosition.y = v0; + pParty->vPosition.z = v0; pParty->uFallStartY = v0; pParty->sPrevRotationX = v0; pParty->sRotationX = v0; pParty->vPrevPosition.z = 1816; - pParty->vPosition.z = 1816; + pParty->vPosition.y = 1816; v0 = 1; pParty->sPrevRotationY = 512; pParty->sRotationY = 512; @@ -16153,8 +16151,8 @@ do { v5 = abs(*((short *)v4 - 17) - pParty->vPosition.x); - v17 = abs(*((short *)v4 - 16) - pParty->vPosition.z); - v18 = abs(*((short *)v4 - 15) - pParty->vPosition.y); + v17 = abs(*((short *)v4 - 16) - pParty->vPosition.y); + v18 = abs(*((short *)v4 - 15) - pParty->vPosition.z); v6 = v5; v7 = v17; v8 = v18; @@ -16465,21 +16463,21 @@ ODM_ProcessPartyActions(); if ( pParty->vPosition.x < -22528 || pParty->vPosition.x > 22528 - || pParty->vPosition.z < -22528 - || pParty->vPosition.z > 22528 ) + || pParty->vPosition.y < -22528 + || pParty->vPosition.y > 22528 ) { strcpy(pOutdoor->pLevelFilename, pCurrentMapName); - v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.z, (char *)&pOut, 32); + v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, (char *)&pOut, 32); if ( !bUnderwater && (pParty->uFlags & 0x8C || BYTE1(pParty->uFlags) & 2 || pParty->bFlying) || !v0 ) { if ( pParty->vPosition.x < -22528 ) pParty->vPosition.x = -22528; if ( pParty->vPosition.x > 22528 ) pParty->vPosition.x = 22528; - if ( pParty->vPosition.z < -22528 ) - pParty->vPosition.z = -22528; - if ( pParty->vPosition.z > 22528 ) - pParty->vPosition.z = 22528; + if ( pParty->vPosition.y < -22528 ) + pParty->vPosition.y = -22528; + if ( pParty->vPosition.y > 22528 ) + pParty->vPosition.y = 22528; } else {
--- a/mm7_3.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/mm7_3.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -122,7 +122,7 @@ { v9 = &pIndoor->pSectors[v33[result]]; v10 = 0; - v32 = v9->field_4 + v9->field_C + v9->field_14; + v32 = v9->uNumFloors + v9->field_C + v9->field_14; v26 = 0; if ( v32 > 0 ) break; @@ -649,21 +649,21 @@ { if ( stru_721530.sMinX >= pParty->vPosition.x - v1 ) { - if ( stru_721530.sMaxY <= pParty->vPosition.z + v1 ) - { - if ( stru_721530.sMinY >= pParty->vPosition.z - v1 ) - { - if ( stru_721530.sMaxZ <= (signed int)(pParty->vPosition.y + pParty->uPartyHeight) ) - { - if ( stru_721530.sMinZ >= pParty->vPosition.y ) + if ( stru_721530.sMaxY <= pParty->vPosition.y + v1 ) + { + if ( stru_721530.sMinY >= pParty->vPosition.y - v1 ) + { + if ( stru_721530.sMaxZ <= (signed int)(pParty->vPosition.z + pParty->uPartyHeight) ) + { + if ( stru_721530.sMinZ >= pParty->vPosition.z ) { v3 = stru_721530.prolly_normal_d + v1; v11 = pParty->vPosition.x - stru_721530.normal.x; v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y - - (pParty->vPosition.z - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; - v10 = pParty->vPosition.z - stru_721530.normal.y; + - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; + v10 = pParty->vPosition.y - stru_721530.normal.y; result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y - - (pParty->vPosition.z - stru_721530.normal.y) * stru_721530.field_58.x) >> 16); + - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16); if ( result <= v3 ) { result = v10 * stru_721530.field_58.y; @@ -671,11 +671,11 @@ if ( v5 > 0 ) { v6 = ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v5) >> 16) + stru_721530.normal.z; - result = pParty->vPosition.y; - if ( v6 >= pParty->vPosition.y ) + result = pParty->vPosition.z; + if ( v6 >= pParty->vPosition.z ) { - result = v9 + pParty->vPosition.y; - if ( v6 <= (signed int)(v9 + pParty->vPosition.y) || v8 ) + result = v9 + pParty->vPosition.z; + if ( v6 <= (signed int)(v9 + pParty->vPosition.z) || v8 ) { result = sub_452A9E(v3 * v3 - v4 * v4); v7 = v5 - result; @@ -2214,6 +2214,7 @@ v20 = 0; if ( (signed int)uNumLayingItems > 0 ) { + __debugbreak(); v2 = (char *)&pLayingItems[0].uSpriteFrameID; do { @@ -2272,8 +2273,8 @@ if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) ) goto LABEL_36; v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26)); - v18 = abs(pParty->vPosition.z - *(int *)(v2 - 22)); - v19 = abs(pParty->vPosition.y - *(int *)(v2 - 18)); + v18 = abs(pParty->vPosition.y - *(int *)(v2 - 22)); + v19 = abs(pParty->vPosition.z - *(int *)(v2 - 18)); v13 = v12; v14 = v18; v15 = v19; @@ -2446,15 +2447,15 @@ int v89; // [sp+58h] [bp-8h]@1 int angle; // [sp+5Ch] [bp-4h]@47 - v0 = pParty->vPosition.y; + v0 = pParty->vPosition.z; v89 = pParty->uFallSpeed; v1 = 0; - v85 = pParty->vPosition.z; + v85 = pParty->vPosition.y; v70 = 0; v2 = 0; v86 = pParty->vPosition.x; - v87 = pParty->vPosition.y; - v77 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y); + v87 = pParty->vPosition.z; + v77 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v72 = 0; v78 = 0; v71 = 0; @@ -2473,15 +2474,15 @@ if ( i == -30000 ) { pParty->vPosition.x = blv_prev_party_x; - pParty->vPosition.z = blv_prev_party_z; - pParty->vPosition.y = blv_prev_party_y; + pParty->vPosition.y = blv_prev_party_z; + pParty->vPosition.z = blv_prev_party_y; pParty->uFallStartY = blv_prev_party_y; return; } } blv_prev_party_x = pParty->vPosition.x; - blv_prev_party_z = pParty->vPosition.z; - blv_prev_party_y = pParty->vPosition.y; + blv_prev_party_z = pParty->vPosition.y; + blv_prev_party_y = pParty->vPosition.z; if ( pParty->bTurnBasedModeOn != 1 ) { v4 = (double)(GetTickCount() / 0x1F4); @@ -2489,8 +2490,8 @@ if ( *(int *)&word_720C10_intercepts_xs[102] != LODWORD(v67) ) { dword_4F8584[3 * dword_4F8580[0]] = pParty->vPosition.x; - dword_4F8588[3 * dword_4F8580[0]] = pParty->vPosition.z; - dword_4F8580[3 * dword_4F8580[0]++ + 3] = pParty->vPosition.y; + dword_4F8588[3 * dword_4F8580[0]] = pParty->vPosition.y; + dword_4F8580[3 * dword_4F8580[0]++ + 3] = pParty->vPosition.z; if ( dword_4F8580[0] > 60 ) dword_4F8580[0] = 1; } @@ -2938,10 +2939,10 @@ } if ( bWalkSound && pParty->field_6F8 <= 0 ) { - if ( sub_452A9E((pParty->vPosition.x - v86) * (pParty->vPosition.x - v86) + (pParty->vPosition.z - v85) - * (pParty->vPosition.z - v85) - + (pParty->vPosition.y - v37) - * (pParty->vPosition.y - v37)) <= 16 ) + if ( sub_452A9E((pParty->vPosition.x - v86) * (pParty->vPosition.x - v86) + (pParty->vPosition.y - v85) + * (pParty->vPosition.y - v85) + + (pParty->vPosition.z - v37) + * (pParty->vPosition.z - v37)) <= 16 ) goto LABEL_188; if ( v72 && (!bJumping || bFeatherFalla) ) { @@ -3001,8 +3002,8 @@ pParty->uFlags |= 8u; BYTE1(pParty->uFlags) &= 0xFDu; pParty->vPosition.x = v86; - pParty->vPosition.y = v37; - pParty->vPosition.z = v85; + pParty->vPosition.z = v37; + pParty->vPosition.y = v85; pParty->uFallSpeed = v89; if ( !bJumping && BYTE3(pIndoor->pFaces[v79].uAttributes) & 0x40 ) BYTE1(pParty->uFlags) |= 2u; @@ -3147,17 +3148,17 @@ int v130; // [sp+90h] [bp-4h]@14 v121 = pParty->uFallSpeed; - v123 = pParty->vPosition.y; + v123 = pParty->vPosition.z; _zero = 0; v1 = 0; v103 = 0; v2 = 0; *(float *)&v128 = 0.0; v116 = pParty->vPosition.x; - v117 = pParty->vPosition.z; + v117 = pParty->vPosition.y; v113 = pParty->field_6F0; bJumping = 0; - v118 = GetTerrainHeightsAroundParty(pParty->vPosition.x, pParty->vPosition.z); + v118 = GetTerrainHeightsAroundParty(pParty->vPosition.x, pParty->vPosition.y); v114 = 0; v124 = 0; v108 = 0; @@ -3286,7 +3287,7 @@ || pParty->pPartyBuffs[7].uFlags & 1 || *(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) { - if ( pParty->vPosition.y < 4000 || bJumping ) + if ( pParty->vPosition.z < 4000 || bJumping ) { v123 += 30; v113 += 30; @@ -3306,7 +3307,7 @@ pParty->field_6E4 = 0; pPartyActionQueue->uNumActions = 0; BYTE1(pParty->uFlags) |= 1u; - pParty->vPosition.y = v109 - pParty->uPartyHeight - 31; + pParty->vPosition.z = v109 - pParty->uPartyHeight - 31; pParty->field_6F0 = v123; pParty->bFlying = 0; v123 = v109 - pParty->uPartyHeight - 31; @@ -3635,7 +3636,7 @@ { if ( v34 < -500 && !pParty->bFlying - && pParty->vPosition.y - v111 > 1000 + && pParty->vPosition.z - v111 > 1000 && SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 && (SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0 || !LODWORD(pParty->pPartyBuffs[5].uExpireTime)) ) { @@ -3683,7 +3684,7 @@ if ( stru_721530._47050A(v36) ) break; _46E889_collide_against_bmodels(1u); - v37 = WorldPosToGridCellZ(pParty->vPosition.z); + v37 = WorldPosToGridCellZ(pParty->vPosition.y); v38 = WorldPosToGridCellX(pParty->vPosition.x); _46E26D_collide_against_sprites(v38, v37); _46ED8A_collide_against_layingItems(4u); @@ -3894,8 +3895,8 @@ if ( bWalkSound && pParty->field_6F8 <= 0 ) { v122 = abs(pParty->vPosition.x - v116); - v126 = abs(pParty->vPosition.z - v117); - v62 = abs(pParty->vPosition.y - v123); + v126 = abs(pParty->vPosition.y - v117); + v62 = abs(pParty->vPosition.z - v123); if ( sub_452A9E(v122 * v122 + v126 * v126 + v62 * v62) < 8 ) goto LABEL_344; if ( v114 && (!bJumping || v101) ) @@ -3922,7 +3923,7 @@ v88 = 804; v86 = 1; LABEL_255: - v63 = WorldPosToGridCellZ(pParty->vPosition.z) - 1; + v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; v64 = WorldPosToGridCellX(pParty->vPosition.x); v87 = pOutdoor->_47EE49(v64, v63, v86); goto LABEL_257; @@ -3965,7 +3966,7 @@ else pParty->uFlags |= 8u; v126 = WorldPosToGridCellX(pParty->vPosition.x); - v65 = WorldPosToGridCellZ(pParty->vPosition.z) - 1; + v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; v114 = WorldPosToGridCellX(v116); v66 = WorldPosToGridCellZ(v117) - 1; v127 = (BSPModel *)(((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1); @@ -3985,25 +3986,25 @@ pParty->uFallSpeed = v121; v73 = v123; pParty->vPosition.x = v116; - pParty->vPosition.z = v117; - pParty->vPosition.y = v123; + pParty->vPosition.y = v117; + pParty->vPosition.z = v123; pParty->field_6F0 = v113; if ( v123 > 8160 ) { v73 = 8160; pParty->uFallStartY = 8160; - pParty->vPosition.y = 8160; + pParty->vPosition.z = 8160; } if ( !v103 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v71) - && pParty->vPosition.z == v72 - && (v73 = pParty->vPosition.y, pParty->vPosition.y == v70) ) + && pParty->vPosition.y == v72 + && (v73 = pParty->vPosition.z, pParty->vPosition.z == v70) ) { if ( v73 < v111 ) { pParty->uFallSpeed = 0; v73 = v105; - pParty->vPosition.y = v105; + pParty->vPosition.z = v105; if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater ) { if ( pParty->uFlags & 0x100 ) @@ -4026,7 +4027,7 @@ ++v74; } while ( (signed int)v74 <= (signed int)&pPlayers[4] ); - v73 = pParty->vPosition.y; + v73 = pParty->vPosition.z; } } pParty->uFallStartY = v70; @@ -4035,7 +4036,7 @@ { if ( (signed int)(pParty->uPartyHeight + v73) >= v109 ) { - pParty->vPosition.y = v109 - pParty->uPartyHeight - 1; + pParty->vPosition.z = v109 - pParty->uPartyHeight - 1; pParty->field_6F0 = v109 - pParty->uPartyHeight - 1; } } @@ -4070,7 +4071,7 @@ if ( v78 ) { LABEL_312: - pParty->vPosition.z = v117; + pParty->vPosition.y = v117; LABEL_313: if ( bWaterWalk ) { @@ -4097,33 +4098,33 @@ LABEL_318: v81 = v123; v82 = v123; - pParty->vPosition.y = v123; + pParty->vPosition.z = v123; if ( v123 > 8160 ) { v82 = 8160; pParty->uFallStartY = 8160; - pParty->vPosition.y = 8160; + pParty->vPosition.z = 8160; } LOWORD(pParty->uFlags) &= 0xFDFBu; pParty->uFallSpeed = v121; pParty->field_6F0 = v113; if ( v114 ) { - v83 = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.z, &v110, 1); - v82 = pParty->vPosition.y; - if ( pParty->vPosition.y <= v83 ) + v83 = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1); + v82 = pParty->vPosition.z; + if ( pParty->vPosition.z <= v83 ) pParty->uFlags |= 4u; } if ( !v103 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v116) - && pParty->vPosition.z == v117 - && (v82 = pParty->vPosition.y, pParty->vPosition.y == v81) ) + && pParty->vPosition.y == v117 + && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) { if ( v82 < v111 ) { v82 = v105; pParty->uFallSpeed = 0; - pParty->vPosition.y = v105; + pParty->vPosition.z = v105; if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater ) { if ( pParty->uFlags & 0x100 ) @@ -4145,14 +4146,14 @@ ++v84; } while ( (signed int)v84 <= (signed int)&pPlayers[4] ); - v82 = pParty->vPosition.y; + v82 = pParty->vPosition.z; } } pParty->uFallStartY = v81; } if ( v102 && v82 < v109 && (signed int)(pParty->uPartyHeight + v82) >= v109 ) { - pParty->vPosition.y = v82 + pParty->uPartyHeight - v109 + 1; + pParty->vPosition.z = v82 + pParty->uPartyHeight - v109 + 1; pParty->field_6F0 = v82 + pParty->uPartyHeight - v109 + 1; } } @@ -12905,18 +12906,18 @@ void PrepareWallsRenderList_BLV() { pStru170->uNumFaceIDs = 0; - if ( pBLVRenderParams->uRadius ) - { - pStru170->field_FA8[0].uSectorID = LOWORD(pBLVRenderParams->uRadius); - pStru170->field_FA8[0].uViewportW = LOWORD(pBLVRenderParams->uViewportW); - pStru170->field_FA8[0].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); - pStru170->field_FA8[0].uViewportY = LOWORD(pBLVRenderParams->uViewportY); - pStru170->field_FA8[0].uViewportX = LOWORD(pBLVRenderParams->uViewportX); + if ( pBLVRenderParams->uPartySectorID ) + { + pStru170->field_FA8[0].uSectorID = pBLVRenderParams->uPartySectorID; + pStru170->field_FA8[0].uViewportW = pBLVRenderParams->uViewportW; + pStru170->field_FA8[0].uViewportZ = pBLVRenderParams->uViewportZ; + pStru170->field_FA8[0].uViewportY = pBLVRenderParams->uViewportY; + pStru170->field_FA8[0].uViewportX = pBLVRenderParams->uViewportX; pStru170->field_FA8[0].field_C._43F9E1( - SLOWORD(pBLVRenderParams->uViewportX), - SLOWORD(pBLVRenderParams->uViewportY), - SLOWORD(pBLVRenderParams->uViewportZ), - SLOWORD(pBLVRenderParams->uViewportW)); + pBLVRenderParams->uViewportX, + pBLVRenderParams->uViewportY, + pBLVRenderParams->uViewportZ, + pBLVRenderParams->uViewportW); pStru170->field_FA8[0].uFaceID = -1; pStru170->field_FA8[0].std__vector_0007A8 = -1; pStru170->std__vector_000FA8 = 1; @@ -13809,7 +13810,7 @@ v18 = (double)(1 << (16 - v17)); v19 = v18; v20 = (double)(pParty->vPosition.x + 32768) / v18; - v21 = (double)(32768 - pParty->vPosition.z) / v19; + v21 = (double)(32768 - pParty->vPosition.y) / v19; uWb = v21; if ( uZoom == 512 ) { @@ -13942,15 +13943,15 @@ } else { - v69 = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - - uZoom * pParty->vPosition.x) >> 16); - lPitcha = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - - uZoom * pParty->vPosition.z) >> 16); - uWa = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - - uZoom * pParty->vPosition.x) >> 16); - v14 = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - - uZoom * pParty->vPosition.z) >> 16); - v15 = abs(pOutline->sZ - pParty->vPosition.y) / 8; + auto _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x); + auto _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16); + auto _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16); + v69 = uCenterX + _c; + v69 = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); + lPitcha = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); + uWa = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); + v14 = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); + v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; if ( v15 > 100 ) v15 = 100; pRenderer->Line2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); @@ -13970,7 +13971,7 @@ uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - - uZoom * pParty->vPosition.z) >> 16), + - uZoom * pParty->vPosition.y) >> 16), uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) @@ -13978,7 +13979,7 @@ uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - - uZoom * pParty->vPosition.z) >> 16), + - uZoom * pParty->vPosition.y) >> 16), uBlue); } } @@ -14055,7 +14056,7 @@ || uWizardEyeSkillLevel == 1 || (v37 = ((unsigned __int64)((*(int *)(a2c + 2) - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) + uCenterX, - v79 = (unsigned __int64)((*(int *)(a2c + 6) - pParty->vPosition.z) * (signed __int64)(signed int)uZoom) >> 16, + v79 = (unsigned __int64)((*(int *)(a2c + 6) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16, v38 = uCenterY - v79, v37 < pRenderer->field_1C_clipx) || v37 > pRenderer->field_24_clipz @@ -14115,7 +14116,7 @@ v40 = ((unsigned __int64)(((signed int)*((short *)flagsc - 17) - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) + uCenterX; - v76 = (unsigned __int64)(((signed int)*((short *)flagsc - 16) - pParty->vPosition.z) + v76 = (unsigned __int64)(((signed int)*((short *)flagsc - 16) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; v41 = uCenterY - v76; if ( v40 >= pRenderer->field_1C_clipx ) @@ -14174,7 +14175,7 @@ { v46 = ((unsigned __int64)((*(int *)v45 - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) + uCenterX; - v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.z) * (signed __int64)(signed int)uZoom) >> 16; + v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; v47 = uCenterY - v77; if ( v46 >= pRenderer->field_1C_clipx ) { @@ -14524,8 +14525,8 @@ } LABEL_38: v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 3; - v81 = pParty->vPosition.z - v84; - v97 = (const void *)((unsigned __int64)((pParty->vPosition.z - v84) * (signed __int64)v5) >> 16); + v81 = pParty->vPosition.y - v84; + v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16); v48 = 1; v49 = v90 - (int)v97 - 3; if ( v47 >= (signed int)x_ ) @@ -14789,7 +14790,7 @@ if ( v1 < 384 ) this->field_2C = 384; this->sPartyPosX = pParty->vPosition.x; - this->sPartyPosZ = pParty->vPosition.z; + this->sPartyPosZ = pParty->vPosition.y; return _4432E7(); } @@ -14807,7 +14808,7 @@ if ( v1 > v2 ) this->field_2C = v2; this->sPartyPosX = pParty->vPosition.x; - this->sPartyPosZ = pParty->vPosition.z; + this->sPartyPosZ = pParty->vPosition.y; return _4432E7(); } @@ -15620,7 +15621,7 @@ int pX; // [sp+28h] [bp-4h]@1 v24 = pParty->vPosition.x; - v0 = pParty->vPosition.z; + v0 = pParty->vPosition.y; v1 = pOutdoor->uNumBModels; *(float *)&v23 = (double)(signed int)viewparams->uMinimapZoom * 0.000015258789; v2 = 0; @@ -15954,7 +15955,7 @@ memcpy(&v7, pGUIWindow0, sizeof(v7)); v9 = pMapStats->GetMapInfo(pCurrentMapName); - pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.z, pDestinationMapName, 20); + pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20); v0 = pMapStats->GetMapInfo(pDestinationMapName); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); pRenderer->DrawTextureTransparent(0x1D4u, 0, @@ -18094,8 +18095,8 @@ if ( v100 ) { pParty->vPosition.x = v135; - pParty->vPosition.z = v132; - pParty->vPosition.y = v126; + pParty->vPosition.y = v132; + pParty->vPosition.z = v126; pParty->uFallStartY = v126; if ( _5B65B4_npcdata_loword_house_or_other != -1 ) pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; @@ -18839,9 +18840,9 @@ { v10 = (double)pParty->vPosition.x - (double)fromx; v53 = v10; - v11 = (double)pParty->vPosition.z - (double)fromy; + v11 = (double)pParty->vPosition.y - (double)fromy; v54 = v11; - v12 = (double)(pParty->vPosition.y + pParty->sEyelevel); + v12 = (double)(pParty->vPosition.z + pParty->sEyelevel); } a7a = v12 - (double)fromz; toza = v11 * v11; @@ -19403,9 +19404,9 @@ } v7 = v5; pParty->vPosition.x = pLevelDecorations[v7].vPosition.x; - pParty->vPosition.z = pLevelDecorations[v7].vPosition.y; - pParty->vPosition.y = pLevelDecorations[v7].vPosition.z; - pParty->uFallStartY = pParty->vPosition.y; + pParty->vPosition.y = pLevelDecorations[v7].vPosition.y; + pParty->vPosition.z = pLevelDecorations[v7].vPosition.z; + pParty->uFallStartY = pParty->vPosition.z; v8 = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[v7].field_1A) / 90; v9 = pLevelDecorations[v7].field_10_y_rot; pParty->sRotationY = v8; @@ -19420,10 +19421,10 @@ if ( _5B65A8_npcdata_uflags_or_other ) pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other; if ( _5B65AC_npcdata_fame_or_other ) - pParty->vPosition.z = _5B65AC_npcdata_fame_or_other; + pParty->vPosition.y = _5B65AC_npcdata_fame_or_other; if ( _5B65B0_npcdata_rep_or_other ) { - pParty->vPosition.y = _5B65B0_npcdata_rep_or_other; + pParty->vPosition.z = _5B65B0_npcdata_rep_or_other; pParty->uFallStartY = _5B65B0_npcdata_rep_or_other; } if ( _5B65B4_npcdata_loword_house_or_other ) @@ -19969,8 +19970,8 @@ *(char *)(v0 + 1) &= 0xFBu; if ( ! ((Actor *)(v0 - offsetof(Actor, uAttributes)))->CanAct() ) goto LABEL_37; - v22 = abs(pParty->vPosition.y - *(short *)(v0 + 110)); - v21 = abs(pParty->vPosition.z - *(short *)(v0 + 108)); + v22 = abs(pParty->vPosition.z - *(short *)(v0 + 110)); + v21 = abs(pParty->vPosition.y - *(short *)(v0 + 108)); v1 = abs(pParty->vPosition.x - *(short *)(v0 + 106)); v2 = v21; v3 = v22; @@ -20127,7 +20128,7 @@ int v45; // [sp+20h] [bp-4h]@1 pParty->uFlags &= 0xFFFFFFCFu; - v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y); + v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v45 = 0; v43 = 0; if ( (signed int)uNumActors > 0 ) @@ -20138,8 +20139,8 @@ v0[1] &= 0xFBu; if ( ! ((Actor *)(v0 - 36))->CanAct() ) goto LABEL_60; - v39 = abs(pParty->vPosition.y - *((short *)v0 + 55)); - v38 = abs(pParty->vPosition.z - *((short *)v0 + 54)); + v39 = abs(pParty->vPosition.z - *((short *)v0 + 55)); + v38 = abs(pParty->vPosition.y - *((short *)v0 + 54)); v1 = abs(pParty->vPosition.x - *((short *)v0 + 53)); v2 = v38; v3 = v39; @@ -21052,19 +21053,19 @@ //----- (00402CAE) -------------------------------------------------------- int stru193_math::SinCos(int angle) { - unsigned int v2; // edx@1 - unsigned int v3; // eax@1 - int result; // eax@4 - - v2 = this->uIntegerPi; - v3 = this->uDoublePiMask & angle; - if ( (signed int)v3 > (signed int)v2 ) - v3 = this->uIntegerDoublePi - v3; - if ( (signed int)v3 >= (signed int)this->uIntegerHalfPi ) - result = -this->pCosTable[v2 - v3]; - else - result = this->pCosTable[v3]; - return result; + int v2; // eax@1 + + //a2: (angle - uIntegerHalfPi) for sin(angle) + // (angle) for cos(angle) + + v2 = uDoublePiMask & angle; + + if ( v2 > uIntegerPi ) + v2 = uIntegerDoublePi - v2; + if ( v2 >= uIntegerHalfPi ) + return -pCosTable[uIntegerPi - v2]; + else + return pCosTable[v2]; }
--- a/mm7_4.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/mm7_4.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -123,8 +123,8 @@ if ( v1->field_2 & 1 ) { v36 = abs(v1->vPosition.x - pParty->vPosition.x); - v25 = abs(v3 - pParty->vPosition.z); - v28 = abs(v35 - pParty->vPosition.y); + v25 = abs(v3 - pParty->vPosition.y); + v28 = abs(v35 - pParty->vPosition.z); v4 = v36; v5 = v25; v6 = v28; @@ -300,7 +300,7 @@ v43 = v5; v42 = v5->pFloors; v7 = pIndoor->pVertices; - v39 = v5->field_4; + v39 = v5->uNumFloors; for ( uSectorIDa = 0; uSectorIDa < v39; ++uSectorIDa ) { v40 = (int)&v42[v6]; @@ -3404,7 +3404,7 @@ signed int v20; // ebx@25 Player *v21; // esi@25 ITEM_EQUIP_TYPE v22; // edi@30 - int v23; // edx@31 + //int v23; // edx@31 signed int v24; // ecx@32 signed int v25; // eax@33 int v26; // eax@35 @@ -3442,13 +3442,14 @@ { v51 = 0; v4 = (v0 - v2) / 5; - if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 ) + if (pParty->FlyActive()) { if ( pParty->bFlying ) { if ( !(pParty->pPartyBuffs[7].uFlags & 1) ) { v5 = v4 * pParty->pPartyBuffs[7].uPower; + __debugbreak(); v6 = &stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; v7 = *(int *)v6 - v5 < 0; *(int *)v6 -= v5; @@ -3462,12 +3463,13 @@ } } } - if ( (signed __int64)pParty->pPartyBuffs[18].uExpireTime > 0 ) - { - if ( pParty->uFlags & 0x80 ) + if (pParty->WaterWalkActive()) + { + if (pParty->uFlags & 0x80 ) { if ( !(pParty->pPartyBuffs[18].uFlags & 1) ) { + __debugbreak(); v8 = &stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; v7 = *(int *)v8 - v4 < 0; *(int *)v8 -= v4; @@ -3480,8 +3482,7 @@ } } } - if ( SHIDWORD(pParty->pPartyBuffs[10].uExpireTime) >= 0 - && (SHIDWORD(pParty->pPartyBuffs[10].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[10].uExpireTime)) ) + if (pParty->ImmolationActive()) { //LayingItem::LayingItem(&a1); v9 = 0; @@ -3490,7 +3491,7 @@ a3.x = 0; a1.stru_24.Reset(); a1.field_4C = pParty->pPartyBuffs[10].uPower; - a1.field_50 = pParty->pPartyBuffs[10].uSkill; + a1.field_50 = pParty->ImmolationSkillLevel(); v10 = 0; a1.uItemType = 1070; a1.field_48 = 8; @@ -3563,7 +3564,9 @@ { if ( v21->HasItemEquipped(v22) ) { - v24 = *(int *)&v21->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v23 + 5]; + //v23 = v21->pEquipment.pIndices; + auto _idx = v21->pEquipment.pIndices[v22]; + v24 = v21->pInventoryItems[_idx].uItemID; if ( v24 > 134 ) { if ( v24 == 529 ) @@ -3582,7 +3585,7 @@ } else { - v25 = *(int *)&v21->field_1F5[36 * *(int *)v23 + 7]; + v25 = v21->pInventoryItems[_idx].uAdditionalValue; if ( v25 <= 50 ) { if ( v25 != 50 ) @@ -14786,9 +14789,9 @@ v7 = *((int *)v5 + 4); pIndoorCamera->sRotationY = 0; pParty->uFlags |= 2u; - pParty->vPosition.z = v7; - pParty->vPosition.y = *((int *)v5 + 5); - pParty->uFallStartY = pParty->vPosition.y; + pParty->vPosition.y = v7; + pParty->vPosition.z = *((int *)v5 + 5); + pParty->uFallStartY = pParty->vPosition.z; pParty->sRotationY = *((int *)v5 + 6); } HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2);
--- a/mm7_5.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/mm7_5.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -1210,7 +1210,7 @@ pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); viewparams->sPartyPosX = pParty->vPosition.x; - viewparams->sPartyPosZ = pParty->vPosition.z; + viewparams->sPartyPosZ = pParty->vPosition.y; pAudioPlayer->StopChannels(-1, -1); v26 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); v27 = 353; @@ -1527,10 +1527,10 @@ pParty->vPosition.x = -22528; if ( pParty->vPosition.x > 22528 ) pParty->vPosition.x = 22528; - if ( pParty->vPosition.z < -22528 ) - pParty->vPosition.z = -22528; - if ( pParty->vPosition.z > 22528 ) - pParty->vPosition.z = 22528; + if ( pParty->vPosition.y < -22528 ) + pParty->vPosition.y = -22528; + if ( pParty->vPosition.y > 22528 ) + pParty->vPosition.y = 22528; goto LABEL_317; case 16: pVideoPlayer->Unload(); @@ -1738,12 +1738,12 @@ } if ( dword_591178_teleporty ) { - pParty->vPosition.z = dword_591178_teleporty; + pParty->vPosition.y = dword_591178_teleporty; _5B65AC_npcdata_fame_or_other = dword_591178_teleporty; } if ( dword_591174_teleportz ) { - pParty->vPosition.y = dword_591174_teleportz; + pParty->vPosition.z = dword_591174_teleportz; _5B65B0_npcdata_rep_or_other = dword_591174_teleportz; pParty->uFallStartY = dword_591174_teleportz; } @@ -1799,7 +1799,7 @@ v195 = (NPCData *)GetTravelTime(); strcpy(pOutdoor->pLevelFilename, pCurrentMapName); if ( bUnderwater != 1 && pParty->bFlying - || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.z, &pOut, 20) != v0 ) + || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, &pOut, 20) != v0 ) { viewparams->bRedrawGameUI = v0; LABEL_387: @@ -1808,10 +1808,10 @@ pParty->vPosition.x = -22528; if ( pParty->vPosition.x > 22528 ) pParty->vPosition.x = 22528; - if ( pParty->vPosition.z < -22528 ) - pParty->vPosition.z = -22528; - if ( pParty->vPosition.z > 22528 ) - pParty->vPosition.z = 22528; + if ( pParty->vPosition.y < -22528 ) + pParty->vPosition.y = -22528; + if ( pParty->vPosition.y > 22528 ) + pParty->vPosition.y = 22528; LABEL_317: sub_44603D(); pCurrentScreen = 0; @@ -1882,8 +1882,8 @@ OnMapLoad(); pOutdoor->SetFog(); TeleportToStartingPoint(uLevel_StartingPointType); - pParty->vPosition.y = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.z, (int *)&v213, 0); - pParty->uFallStartY = pParty->vPosition.y; + pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, (int *)&v213, 0); + pParty->uFallStartY = pParty->vPosition.z; sub_461103(); pEventTimer->Resume(); viewparams->bRedrawGameUI = 1; @@ -2133,9 +2133,9 @@ else { pParty->vPosition.x = v195->uFlags; - pParty->vPosition.z = v195->fame; - pParty->vPosition.y = v195->rep; - pParty->uFallStartY = pParty->vPosition.y; + pParty->vPosition.y = v195->fame; + pParty->vPosition.z = v195->rep; + pParty->uFallStartY = pParty->vPosition.z; pParty->sRotationY = LOWORD(v195->house); pParty->sRotationX = HIWORD(v195->house); } @@ -2164,8 +2164,8 @@ v195->pName = (char *)v62; v61->uPortraitID = HIDWORD(v62); v61->uFlags = pParty->vPosition.x; - v61->fame = pParty->vPosition.z; - v61->rep = pParty->vPosition.y; + v61->fame = pParty->vPosition.y; + v61->rep = pParty->vPosition.z; LOWORD(v61->house) = LOWORD(pParty->sRotationY); HIWORD(v61->house) = LOWORD(pParty->sRotationX); if ( (signed int)pGames_LOD->uNumSubIndices / 2 <= 0 ) @@ -2208,9 +2208,9 @@ if ( v64 == stru_4ECBB8[uMessageParam].uMapInfoID ) { pParty->vPosition.x = stru_4ECBB8[v65].pos.x; - pParty->vPosition.z = stru_4ECBB8[v65].pos.y; - pParty->vPosition.y = stru_4ECBB8[v65].pos.z; - pParty->uFallStartY = pParty->vPosition.y; + pParty->vPosition.y = stru_4ECBB8[v65].pos.y; + pParty->vPosition.z = stru_4ECBB8[v65].pos.z; + pParty->uFallStartY = pParty->vPosition.z; pParty->sRotationY = stru_4ECBB8[v65].rot_y; pParty->sRotationX = stru_4ECBB8[v65].rot_x; } @@ -2397,8 +2397,8 @@ v77 = thisi; LABEL_544: pParty->vPosition.x = v74; - pParty->vPosition.z = v77; - pParty->vPosition.y = v76; + pParty->vPosition.y = v77; + pParty->vPosition.z = v76; pParty->uFallStartY = v76; goto LABEL_90; } @@ -4713,18 +4713,18 @@ if ( v8 == 1 ) { v9 = *(short *)v1; - v10 = pParty->vPosition.z - *((short *)v1 - 100); + v10 = pParty->vPosition.y - *((short *)v1 - 100); a1 = pParty->vPosition.x - *((short *)v1 - 200); v48 = v10; if ( a1 * a1 + v10 * v10 - + ((signed int)(pParty->vPosition.y + pParty->uPartyHeight) >> (1 - v9)) - * ((signed int)(pParty->vPosition.y + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) + + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) + * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) { v11.z = *(short *)v1; v11.y = *((short *)v1 - 100); v11.x = *((short *)v1 - 200); - if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y + pParty->sEyelevel, v11) ) + if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v11) ) { v12 = stru_50C198.which_player_would_attack(&pActors[v39]); DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v12); @@ -4772,16 +4772,16 @@ } else { - v23 = pParty->vPosition.z - *((short *)v1 - 100); + v23 = pParty->vPosition.y - *((short *)v1 - 100); v24 = ((signed int)pParty->uPartyHeight >> 1) - *(short *)v1; a1 = pParty->vPosition.x - *((short *)v1 - 200); v48 = v23; - if ( a1 * a1 + v23 * v23 + (pParty->vPosition.y + v24) * (pParty->vPosition.y + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) + if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) { v25.z = *(short *)v1; v25.y = *((short *)v1 - 100); v25.x = *((short *)v1 - 200); - if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y + pParty->sEyelevel, v25) ) + if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) { v26 = 0; v27 = (char *)&pParty->pPlayers[0].pConditions[15]; @@ -5011,9 +5011,9 @@ v9 = (LayingItem *)uDamageAmount; v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4); v55 = abs(v50); - pMonsterName = (char *)(pParty->vPosition.z - v9->vPosition.y); + pMonsterName = (char *)(pParty->vPosition.y - v9->vPosition.y); v51 = (unsigned __int64 *)abs((int)pMonsterName); - pPlayerName = (char *)(pParty->vPosition.y - v9->vPosition.z); + pPlayerName = (char *)(pParty->vPosition.z - v9->vPosition.z); v52 = abs((int)pPlayerName); v61 = v55; v10 = v55; @@ -10585,10 +10585,10 @@ else { v18 = pParty->vPosition.x; - v17 = pParty->sEyelevel + pParty->vPosition.y; - v60 = pParty->vPosition.z; - v44 = pParty->sEyelevel + pParty->vPosition.y; - v43 = pParty->vPosition.z; + v17 = pParty->sEyelevel + pParty->vPosition.z; + v60 = pParty->vPosition.y; + v44 = pParty->sEyelevel + pParty->vPosition.z; + v43 = pParty->vPosition.y; } v19 = pIndoor->GetSector(v18, v43, v44); } @@ -11275,7 +11275,7 @@ sDepthb = 0; for ( i = 116 * v59; sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->field_C + v61) - + 2 * *(__int16 *)((char *)&pIndoor->pSectors->field_4 + v61); + + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); ++sDepthb ) { v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]]; @@ -11429,7 +11429,7 @@ v162 = 0; v112 = v89; if ( *(__int16 *)((char *)&pIndoor->pSectors->field_C + v89) - + 2 * *(__int16 *)((char *)&pIndoor->pSectors->field_4 + v89) > 0 ) + + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) break; LABEL_148: ++a5c; @@ -11509,7 +11509,7 @@ v88 = pIndoor->pSectors; ++v162; if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->field_C + v89) - + 2 * *(__int16 *)((char *)&pIndoor->pSectors->field_4 + v89) ) + + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) ) goto LABEL_148; } } @@ -13959,7 +13959,7 @@ if ( v7 ) v22.DrawText2(pBook2Font, 0xFFFFFFF2u, 0xCu, 0, pMapStats->pInfos[v7].pName, 3u); v22.uFrameX = 0; - sprintfex(Str, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.z); + sprintfex(Str, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); return v22.DrawText2(pFontComic, 0, 0x140u, 0, Str, 0); } @@ -15615,7 +15615,7 @@ v42 = (int *)&a2.y; v41 = (int *)&y.y; v40 = (int *)&pOut; - v39.z = pParty->vPosition.y + pParty->sEyelevel; + v39.z = pParty->vPosition.z + pParty->sEyelevel; } else { @@ -15689,7 +15689,7 @@ v42 = (int *)&a2.y; v41 = (int *)&y.y; v40 = (int *)&pOut; - v39.z = pParty->vPosition.y + pParty->sEyelevel; + v39.z = pParty->vPosition.z + pParty->sEyelevel; } *(_QWORD *)&v39.x = *(_QWORD *)&pParty->vPosition.x; Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, v40, v41, v42);
--- a/mm7_6.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/mm7_6.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -3490,10 +3490,10 @@ if ( v17->WearsItem(510, 2) ) a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.uAttributes = 0; a1.uSpriteFrameID = 0; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v19 = 8 * v3->uPlayerID; LOBYTE(v19) = v19 | 4; a1.field_58 = v19; @@ -3528,10 +3528,10 @@ a1.field_50 = v731; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.uAttributes = 0; a1.uSpriteFrameID = 0; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 2; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; v22 = 8 * v3->uPlayerID; LOBYTE(v22) = v22 | 4; a1.field_58 = v22; @@ -3545,7 +3545,7 @@ * pParty->pPlayers[v3->uPlayerID].pEquipment.uMainHand + 5], sizeof(a1.stru_24)); - v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, a1.vPosition.z); + v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, a1.vPosition.z); HIBYTE(a1.uAttributes) |= 1u; a1.uSectorID = v23; if ( pParty->bTurnBasedModeOn == 1 ) @@ -3629,14 +3629,14 @@ a1.field_4C = v2; a1.field_50 = v731; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = v1; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; a1.uSectorID = pIndoor->GetSector( pParty->vPosition.x, - pParty->vPosition.z, - pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3); + pParty->vPosition.y, + pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v34 = 8 * v3->uPlayerID; LOBYTE(v34) = v34 | 4; @@ -3791,14 +3791,14 @@ a1.field_4C = v2; a1.field_50 = v731; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = v1; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; a1.uSectorID = pIndoor->GetSector( pParty->vPosition.x, - pParty->vPosition.z, - pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3); + pParty->vPosition.y, + pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v50 = 8 * v3->uPlayerID; LOBYTE(v50) = v50 | 4; @@ -3823,10 +3823,10 @@ a1.field_4C = v2; a1.field_50 = v731; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); - v51 = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 2; - a1.vPosition.y = pParty->vPosition.z; - v671 = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 2; - v660 = pParty->vPosition.z; + v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; + a1.vPosition.y = pParty->vPosition.y; + v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; + v660 = pParty->vPosition.y; goto LABEL_153; case 87: if ( uCurrentlyLoadedLevelType == LEVEL_Indoor @@ -3937,13 +3937,13 @@ a1.stru_24.Reset(); a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.uAttributes = v1; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; a1.uSectorID = pIndoor->GetSector( pParty->vPosition.x, - pParty->vPosition.z, - pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3); + pParty->vPosition.y, + pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v62 = 8 * v3->uPlayerID; LOBYTE(v62) = v62 | 4; @@ -4308,8 +4308,8 @@ { v730 = a2 >> 3; v112 = &pActors[a2 >> 3]; - v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.y); - v721 = abs(v112->vPosition.y - pParty->vPosition.z); + v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); + v721 = abs(v112->vPosition.y - pParty->vPosition.y); v113 = abs(v112->vPosition.x - pParty->vPosition.x); _this = (ItemGen *)v113; v114 = v721; @@ -4504,8 +4504,8 @@ v155 = stru_5C6E00->SinCos(pParty->sRotationY); uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); v156 = stru_5C6E00->_42EBDB(pParty->sRotationY); - LODWORD(v727) = pParty->vPosition.z + sub_42EBBE(2048, v156); - v154 = pParty->vPosition.y; + LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); + v154 = pParty->vPosition.z; } HIDWORD(v733) = v154; v713 = v154 + 2500; @@ -4728,14 +4728,14 @@ a1.field_4C = v2; a1.field_50 = v731; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = v1; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; a1.uSectorID = pIndoor->GetSector( pParty->vPosition.x, - pParty->vPosition.z, - pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3); + pParty->vPosition.y, + pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v187 = 8 * v3->uPlayerID; LOBYTE(v187) = v187 | 4; @@ -4909,8 +4909,8 @@ LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); v213 = stru_5C6E00->_42EBDB(pParty->sRotationY); v214 = sub_42EBBE(2048, v213); - v211 = pParty->vPosition.y; - v713 = pParty->vPosition.z + v214; + v211 = pParty->vPosition.z; + v713 = pParty->vPosition.y + v214; v208 = LODWORD(v725); } v726 = (Player *)v211; @@ -5038,10 +5038,10 @@ a1.field_50 = v731; a1.field_4C = v2; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); - a1.vPosition.y = pParty->vPosition.z; - v51 = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; - v671 = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; - v660 = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; + v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + v660 = pParty->vPosition.y; LABEL_153: a1.uAttributes = v1; a1.vPosition.x = pParty->vPosition.x; @@ -5076,14 +5076,14 @@ a1.field_4C = v2; a1.field_50 = v731; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = v1; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; a1.uSectorID = pIndoor->GetSector( pParty->vPosition.x, - pParty->vPosition.z, - pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3); + pParty->vPosition.y, + pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v226 = 8 * v3->uPlayerID; LOBYTE(v226) = v226 | 4; @@ -5661,14 +5661,14 @@ a1.field_4C = v2; a1.field_50 = v731; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.uAttributes = v1; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; a1.uSectorID = pIndoor->GetSector( pParty->vPosition.x, - pParty->vPosition.z, - pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3); + pParty->vPosition.y, + pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v326 = 8 * v3->uPlayerID; LOBYTE(v326) = v326 | 4; @@ -5695,11 +5695,11 @@ a1.field_50 = v731; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.uAttributes = v1; a1.uSectorID = v1; a1.uSpriteFrameID = v1; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 3; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v327 = 8 * v3->uPlayerID; LOBYTE(v327) = v327 | 4; a1.field_60_distance_related_prolly_lod = 0; @@ -7360,13 +7360,13 @@ a1.field_50 = v731; a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.z; + a1.vPosition.y = pParty->vPosition.y; a1.uAttributes = v1; - a1.vPosition.z = pParty->vPosition.y + (signed int)pParty->uPartyHeight / 2; + a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; a1.uSectorID = pIndoor->GetSector( pParty->vPosition.x, - pParty->vPosition.z, - pParty->vPosition.y + (signed int)pParty->uPartyHeight / 2); + pParty->vPosition.y, + pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); a1.uSpriteFrameID = v1; v595 = 8 * v3->uPlayerID; LOBYTE(v595) = v595 | 4; @@ -7694,7 +7694,7 @@ v642 = rand() % 4096 - 2048; v643 = rand(); v721 = v642 + pParty->vPosition.x; - y = (char *)(pParty->vPosition.z + v643 % 4096 - 2048); + y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, v1); v644 = rand(); sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, v1, v1, (ItemGen *)v1); @@ -7909,7 +7909,7 @@ { a2 = v34 >> 3; v8 = &pActors[v34 >> 3]; - v34 = sub_452A9E((v8->vPosition.x - pParty->vPosition.x) * (v8->vPosition.x - pParty->vPosition.x) + (v8->vPosition.y - pParty->vPosition.z) * (v8->vPosition.y - pParty->vPosition.z) + (v8->vPosition.z - pParty->vPosition.y) * (v8->vPosition.z - pParty->vPosition.y)) + v34 = sub_452A9E((v8->vPosition.x - pParty->vPosition.x) * (v8->vPosition.x - pParty->vPosition.x) + (v8->vPosition.y - pParty->vPosition.y) * (v8->vPosition.y - pParty->vPosition.y) + (v8->vPosition.z - pParty->vPosition.z) * (v8->vPosition.z - pParty->vPosition.z)) - v8->uActorRadius; if ( v34 >= 0 ) { @@ -7956,8 +7956,8 @@ if ( (double)v34 <= 407.2 ) { a3.x = v8->vPosition.x - pParty->vPosition.x; - a3.y = v8->vPosition.y - pParty->vPosition.z; - a3.z = v8->vPosition.z - pParty->vPosition.y; + a3.y = v8->vPosition.y - pParty->vPosition.y; + a3.z = v8->vPosition.z - pParty->vPosition.z; Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); DamageMonsterFromParty((8 * v0 - 8) | 4, a2, &a3); if ( v1->WearsItem(506, 1) || v1->WearsItem(506, 0) ) @@ -8321,8 +8321,8 @@ while ( 1 ) { v2 = abs(*((short *)v1 - 17) - pParty->vPosition.x); - v11 = abs(*((short *)v1 - 16) - pParty->vPosition.z); - v12 = abs(*((short *)v1 - 15) - pParty->vPosition.y); + v11 = abs(*((short *)v1 - 16) - pParty->vPosition.y); + v12 = abs(*((short *)v1 - 15) - pParty->vPosition.z); v3 = v2; v4 = v11; v5 = v12;
--- a/stru10.cpp Wed Oct 24 17:33:46 2012 +0200 +++ b/stru10.cpp Thu Oct 25 02:05:16 2012 +0200 @@ -711,8 +711,8 @@ if ( !LOBYTE(field_4) ) { v26.vWorldPosition.x = pParty->vPosition.x; - v26.vWorldPosition.y = pParty->vPosition.z; - v26.vWorldPosition.z = pParty->vPosition.y + pParty->sEyelevel; + v26.vWorldPosition.y = pParty->vPosition.y; + v26.vWorldPosition.z = pParty->vPosition.z + pParty->sEyelevel; pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF0000u, arg0, 0xFF0000u, 0, 0); pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF00u, arg0 + 1, 0xFF00u, 0, 0);