# HG changeset patch # User Nomad # Date 1351092826 -7200 # Node ID fd2fd234a66c330e51db10ba24f7336bb247f945 # Parent 0f4ed4f0f4728fef4cd56dc876f61599914d13ad BLV minimap: 2/3 diff -r 0f4ed4f0f472 -r fd2fd234a66c Indoor.cpp --- a/Indoor.cpp Wed Oct 24 17:02:44 2012 +0200 +++ b/Indoor.cpp Wed Oct 24 17:33:46 2012 +0200 @@ -1733,7 +1733,7 @@ pAllocator->FreeChunk(v1->pLights); pAllocator->FreeChunk(v1->pDoors); pAllocator->FreeChunk(v1->pNodes); - pAllocator->FreeChunk(v1->pMapVertices); + pAllocator->FreeChunk(v1->pMapOutlines); v1->pVertices = 0; v1->pFaces = 0; v1->pFaceExtras = 0; @@ -1741,7 +1741,7 @@ v1->pLights = 0; v1->pDoors = 0; v1->pNodes = 0; - v1->pMapVertices = 0; + v1->pMapOutlines = 0; v1->bLoaded = 0; } @@ -1787,11 +1787,11 @@ v13 = v1->pNodes; v1->pDoors = (BLVDoor *)v12; v14 = pAllocator->AllocNamedChunk(v13, 0x9C40u, "L.BSP"); - v15 = v1->pMapVertices; + v15 = v1->pMapOutlines; v1->pNodes = (BSPNode *)v14; v16 = pAllocator->AllocNamedChunk(v15, 0x14824u, "L.Map"); v17 = v1->pVertices; - v1->pMapVertices = (BLVMapVertices *)v16; + v1->pMapOutlines = (BLVMapOutlines *)v16; if ( v17 && v1->pFaces && v1->pFaceExtras && v1->pSectors && v1->pLights && v1->pDoors && v1->pNodes && v16 ) { memset(v17, 90000, 0); @@ -1801,7 +1801,7 @@ memset(v1->pLights, 6400, 0); memset(v1->pDoors, 16000, 0); memset(v1->pNodes, 40000, 0); - memset(v1->pMapVertices, 84004, 0); + memset(v1->pMapOutlines, 84004, 0); result = 1; } else @@ -2461,7 +2461,7 @@ fseek(v7, v234, 0); fread(&uLastVisitDay, 1u, 0x38u, v7); fseek(v7, v223, 0); - v80 = (void **)&pMapVertices; + v80 = (void **)&pMapOutlines; fread(*v80, 4u, 1u, v7); fread((char *)*v80 + 4, 0xCu, *(int *)*v80, v7); fclose(v7); @@ -2550,6 +2550,7 @@ assert(sizeof(LayingItem) == 112); assert(sizeof(Chest) == 5324); assert(sizeof(stru123) == 0xC8); + assert(sizeof(BLVMapOutline) == 12); bLoaded = true; @@ -2835,10 +2836,10 @@ pGameLoadingUI_ProgressBar->Progress(); //v201 = (const char *)v148; - //v200 = (size_t)pMapVertices; - memcpy(&pMapVertices->uNumVertices, pData, 4); - memcpy(pMapVertices->pVertices, pData + 4, pMapVertices->uNumVertices * sizeof(Vec3_int_)); - //v149 = pMapVertices; + //v200 = (size_t)pMapOutlines; + memcpy(&pMapOutlines->uNumOutlines, pData, 4); + memcpy(pMapOutlines->pOutlines, pData + 4, pMapOutlines->uNumOutlines * sizeof(BLVMapOutline)); + //v149 = pMapOutlines; //v199 = 12 * *v149; //memcpy(v149 + 1, (const void *)(v148 + 4), v199); free(pRawBLV); @@ -2959,9 +2960,9 @@ if ( *(int *)pDest ) memcpy(_visible_outlines, v203, 875); - for (uint i = 0; i < pMapVertices->uNumVertices; ++i) + for (uint i = 0; i < pMapOutlines->uNumOutlines; ++i) { - auto pVertex = pMapVertices->pVertices + i; + auto pVertex = pMapOutlines->pOutlines + i; if ((unsigned __int8)(1 << (7 - i % 8)) & _visible_outlines[i / 8]) pVertex->uFlags |= 1; } diff -r 0f4ed4f0f472 -r fd2fd234a66c Indoor.h --- a/Indoor.h Wed Oct 24 17:02:44 2012 +0200 +++ b/Indoor.h Wed Oct 24 17:33:46 2012 +0200 @@ -238,7 +238,7 @@ /* 101 */ #pragma pack(push, 1) -struct BLVMapVertex +struct BLVMapOutline { unsigned __int16 uVertex1ID; unsigned __int16 uVertex2ID; @@ -373,10 +373,10 @@ #pragma pack(push, 1) -struct BLVMapVertices +struct BLVMapOutlines { - uint uNumVertices; - BLVMapVertex pVertices[1]; + uint uNumOutlines; + BLVMapOutline pOutlines[1]; }; #pragma pack(pop) @@ -411,7 +411,7 @@ pLights = 0; pDoors = 0; pNodes = 0; - pMapVertices = 0; + pMapOutlines = 0; uNumSpawnPoints = 0; pSpawnPoints = 0; } @@ -447,7 +447,7 @@ struct BLVDoor *pDoors; unsigned int uNumNodes; struct BSPNode *pNodes; - BLVMapVertices *pMapVertices; + BLVMapOutlines *pMapOutlines; unsigned __int16 *ptr_2AC; unsigned __int16 *ptr_0002B0_sector_rdata; unsigned __int16 *ptr_0002B4_doors_ddata; diff -r 0f4ed4f0f472 -r fd2fd234a66c mm7_2.cpp --- a/mm7_2.cpp Wed Oct 24 17:02:44 2012 +0200 +++ b/mm7_2.cpp Wed Oct 24 17:33:46 2012 +0200 @@ -13086,8 +13086,8 @@ char *v3; // eax@1 //char *v4; // eax@1 unsigned int v5; // eax@3 - size_t v6; // ecx@10 - char *v7; // eax@11 + //size_t v6; // ecx@10 + //char *v7; // eax@11 char Str1[20]; // [sp+Ch] [bp-18h]@1 unsigned int v9; // [sp+20h] [bp-4h]@1 @@ -13127,20 +13127,13 @@ sub_461103(); if ( !_strcmpi(pCurrentMapName, "d11.blv") || !_strcmpi(pCurrentMapName, "d10.blv") ) { - __debugbreak(); - v6 = uNumActors; - if ( (signed int)uNumActors > 0 ) - { - v7 = (char *)&pActors[0].pMonsterInfo.uTreasureType; - do - { - *v7 = 0; - *(v7 - 3) = 0; - *(int *)(v7 + 59) = 0; - v7 += 836; - --v6; - } - while ( v6 ); + //spawning grounds & good analogue - no loot & exp from monsters + + for (uint i = 0; i < uNumActors; ++i) + { + pActors[i].pMonsterInfo.uTreasureType = 0; + pActors[i].pMonsterInfo.uTreasureDiceRolls = 0; + pActors[i].pMonsterInfo.uExp = 0; } } bDialogueUI_InitializeActor_NPC_ID = 0; diff -r 0f4ed4f0f472 -r fd2fd234a66c mm7_3.cpp --- a/mm7_3.cpp Wed Oct 24 17:02:44 2012 +0200 +++ b/mm7_3.cpp Wed Oct 24 17:33:46 2012 +0200 @@ -13694,14 +13694,14 @@ void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int flags) { int uHeight; // ebx@6 - unsigned int v9; // edx@9 - unsigned int v10; // ebx@10 + //unsigned int v9; // edx@9 + //unsigned int v10; // ebx@10 __int16 v11; // cx@11 - BLVFace *v12; // ecx@17 - unsigned int v13; // ecx@21 + //BLVFace *v12; // ecx@17 + //unsigned int v13; // ecx@21 unsigned int v14; // ebx@23 int v15; // eax@23 - unsigned int *v16; // ecx@28 + //unsigned int *v16; // ecx@28 __int16 v17; // di@30 double v18; // st7@30 float v19; // ST38_4@30 @@ -13906,57 +13906,51 @@ pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); uNumBlueFacesInBLVMinimap = 0; - for (uint i = 0; i < pIndoor->pMapVertices->uNumVertices; ++i) - { - auto pMapVertex = &pIndoor->pMapVertices->pVertices[i]; - v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes; - if ( !(BYTE1(v9) & 0x20) ) - { - v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes; - if ( !(BYTE1(v10) & 0x20) ) - { - v11 = pMapVertex->uFlags; + for (uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i) + { + auto pOutline = &pIndoor->pMapOutlines->pOutlines[i]; + + auto pFace1 = pIndoor->pFaces + pOutline->uFace1ID; + auto pFace2 = pIndoor->pFaces + pOutline->uFace2ID; + //v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes; + if (~pFace1->uAttributes & 0x2000) + { + //v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes; + if (~pFace2->uAttributes & 0x2000) + { + v11 = pOutline->uFlags; if ( v11 & 1 ) goto LABEL_15; - if ( (v9 & 0x80u) != 0 || (v10 & 0x80u) != 0 ) + if (pFace1->uAttributes & 0x80 || pFace2->uAttributes & 0x80u != 0 ) goto LABEL_ABC; } } continue; LABEL_ABC: - pIndoor->pMapVertices->pVertices[i].uFlags = v11 | 1; + pOutline->uFlags = v11 | 1; pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); LABEL_15: - if ( bWizardEyeActive - && uWizardEyeSkillLevel >= 3 - && ((v12 = &pIndoor->pFaces[pMapVertex->uFace1ID], v12->uAttributes & 0x2000000) || pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes & 0x2000000) - && (pIndoor->pFaceExtras[v12->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pMapVertex->uFace2ID].uFaceExtraID].uEventID) - && (v13 = uNumBlueFacesInBLVMinimap, (signed int)uNumBlueFacesInBLVMinimap < 49) ) - { - pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap] = i; - uNumBlueFacesInBLVMinimap = v13 + 1; - } - else - { - v69 = uCenterX - + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[pMapVertex->uVertex1ID].x) >> 16) << 16) + //v12 = &pIndoor->pFaces[pOutline->uFace1ID]; + if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && + (pFace1->uAttributes & 0x2000000 || pFace2->uAttributes & 0x2000000) && + (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID)) + { + if (uNumBlueFacesInBLVMinimap < 49) + pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; + } + 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)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[pMapVertex->uVertex1ID].y) >> 16) << 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)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[pMapVertex->uVertex2ID].x) >> 16) << 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)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[pMapVertex->uVertex2ID].y) >> 16) << 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(pMapVertex->sZ - pParty->vPosition.y) / 8; + v15 = abs(pOutline->sZ - pParty->vPosition.y) / 8; if ( v15 > 100 ) v15 = 100; pRenderer->Line2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); @@ -13966,23 +13960,24 @@ for ( uZb = 0; uZb < (signed int)uNumBlueFacesInBLVMinimap; ++uZb ) { - v16 = (uint *)&pIndoor->pMapVertices->pVertices[3 * pBlueFacesInBLVMinimapIDs[uZb]]; + //v16 = (uint *)&pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]]; + auto pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]]; pRenderer->Line2D( uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[*(short *)v16].x) >> 16) << 16) + * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16), uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[*(short *)v16].y) >> 16) << 16) + * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.z) >> 16), uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[HIWORD(pIndoor->pMapVertices[3 * pBlueFacesInBLVMinimapIDs[uZb] + 1])].x) >> 16) << 16) + * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16), uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom - * (signed __int64)pIndoor->pVertices[HIWORD(pIndoor->pMapVertices[3 * pBlueFacesInBLVMinimapIDs[uZb] + 1])].y) >> 16) << 16) + * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.z) >> 16), uBlue); } @@ -14440,10 +14435,10 @@ LABEL_8: black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); - v7 = (uint *)pIndoor->pMapVertices; + v7 = (uint *)pIndoor->pMapOutlines; uNumBlueFacesInBLVMinimap = 0; - v8 = pIndoor->pMapVertices->uNumVertices == 0; - v9 = (pIndoor->pMapVertices->uNumVertices & 0x80000000u) != 0; + v8 = pIndoor->pMapOutlines->uNumOutlines == 0; + v9 = (pIndoor->pMapOutlines->uNumOutlines & 0x80000000u) != 0; v94 = 0; if ( !(v9 | v8) ) { @@ -14486,7 +14481,7 @@ v85 + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), v90 - v92, black); - v7 = (uint *)pIndoor->pMapVertices; + v7 = (uint *)pIndoor->pMapOutlines; LABEL_17: ++v94; i += 12; @@ -14523,7 +14518,7 @@ ++v21; if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) break; - v7 = (uint *)pIndoor->pMapVertices; + v7 = (uint *)pIndoor->pMapOutlines; } v6 = v86; } @@ -14896,11 +14891,11 @@ v14 = 0x40000000u; v17 = 0xC0000000u; v15 = 0xC0000000u; - if ( (signed int)pIndoor->pMapVertices->uNumVertices > 0 ) - { - v2 = (__int16 *)(pIndoor->pMapVertices->pVertices); - v11 = pIndoor->pMapVertices->uNumVertices; - v12 = (uint *)pIndoor->pMapVertices->pVertices; + if ( (signed int)pIndoor->pMapOutlines->uNumOutlines > 0 ) + { + v2 = (__int16 *)(pIndoor->pMapOutlines->pOutlines); + v11 = pIndoor->pMapOutlines->uNumOutlines; + v12 = (uint *)pIndoor->pMapOutlines->pOutlines; do { v3 = &pIndoor->pVertices[*v2];