Mercurial > might-and-magic-trilogy
view Indoor.cpp @ 7:1200e31f08e5
10.10.12
author | Серик@ПончиК |
---|---|
date | Wed, 10 Oct 2012 21:05:53 +0600 |
parents | ac0fb48cd27a |
children | 2ca04ccb612a |
line wrap: on
line source
#include "Outdoor.h" #include "Render.h" #include "LayingItem.h" #include "Events.h" #include "Game.h" #include "Viewport.h" #include "Time.h" #include "Party.h" #include "Math.h" #include "Allocator.h" #include "LOD.h" #include "DecorationList.h" #include "ObjectList.h" #include "Actor.h" #include "Chest.h" #include "GUIProgressBar.h" #include "stru123.h" #include "AudioPlayer.h" #include "mm7_data.h" IndoorLocation *pIndoor; BLVRenderParams *pBLVRenderParams; struct DecorationList *pDecorationList; LevelDecoration pLevelDecorations[3000]; size_t uNumLevelDecorations; LevelDecoration *_5C3420_pDecoration; LEVEL_TYPE uCurrentlyLoadedLevelType; stru320 stru_F8AD28; // idb stru337 stru_F81018; stru167_wrap array_5118E8; stru170_stru2 stru_F8A590; stru170 *pStru170; // idb stru141 stru_721530; stru352 stru_F83B80[480]; //----- (0043F39E) -------------------------------------------------------- void __fastcall sub_43F39E(IndoorLocation_drawstru *_this) { int *v1; // ecx@1 double v2; // ST30_8@3 double v3; // ST30_8@6 double v4; // ST28_8@6 int v5; // eax@4 int v6; // eax@7 unsigned int v7; // ebx@8 BLVSector *v8; // esi@8 unsigned __int16 *v9; // edi@8 int i; // [sp+18h] [bp-8h]@7 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3 signed int v12; // [sp+1Ch] [bp-4h]@8 pBLVRenderParams->Set(_this); uNumMobileLightsApplied = 0; uNumDecorationsDrawnThisFrame = 0; _unused000 = 0; uNumSpritesDrawnThisFrame = 0; uNumBillboardsToDraw = 0; if ( !byte_4D864C || !(BYTE1(pGame->uFlags) & 0x10) ) { v2 = pParty->flt_TorchlightColorB + 6.7553994e15; v11 = LOBYTE(v2); if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime <= 0 ) v5 = 800; else v5 = 800 * pParty->pPartyBuffs[16].uPower; LOBYTE(v1) = byte_4E94D0; 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), v5, LOBYTE(v4), LOBYTE(v3), v11, v1); } PrepareWallsRenderList_BLV(); PrepareItemsRenderList_BLV(); PrepareActorRenderList_BLV(); v6 = 0; for ( i = 0; i < pStru170->field_53730; ++i ) { v7 = pStru170->pSectorIDs_toDrawDecorationsFrom[v6]; v12 = 0; v8 = &pIndoor->pSectors[pStru170->pSectorIDs_toDrawDecorationsFrom[v6]]; v9 = v8->pDecorationIDs; if ( v8->uNumDecorations > 0 ) { do PrepareDecorationsRenderList_BLV((signed __int16)v9[v12++], v7); while ( v12 < v8->uNumDecorations ); } v6 = i + 1; } MessWithBillboards_BLV(); pGame->PushStru165s(); } //----- (004407D9) -------------------------------------------------------- int BLVRenderParams::Set(IndoorLocation_drawstru *a2) { IndoorLocation_drawstru *v2; // ebx@1 BLVRenderParams *v3; // esi@1 int v4; // ST08_4@1 int v5; // ST04_4@1 int v6; // ST00_4@1 int v7; // eax@1 int v8; // ST08_4@2 int v9; // ST04_4@2 int v10; // ST00_4@2 unsigned int v11; // edi@4 unsigned int v12; // ecx@4 int v13; // edx@4 signed int v14; // ecx@4 unsigned int v15; // edx@4 unsigned int v16; // eax@4 double v17; // st7@5 int v18; // eax@5 double v19; // st7@5 int v20; // eax@5 double v21; // st7@5 int v22; // eax@5 unsigned int v23; // edx@5 unsigned int v24; // ecx@5 int v25; // eax@5 int v26; // eax@5 signed int v27; // eax@6 int result; // eax@6 int v29; // [sp+24h] [bp+8h]@5 v2 = a2; v3 = this; this->field_0_timer_ = a2->field_0_timer; this->uFlags = a2->uFlags; this->vPartyPos.x = a2->vPosition.x; this->vPartyPos.y = a2->vPosition.y; this->vPartyPos.z = a2->vPosition.z; v4 = this->vPartyPos.z; v5 = this->vPartyPos.y; this->sPartyRotY = a2->sRotationY; v6 = this->vPartyPos.x; this->sPartyRotX = a2->sRotationX; v7 = pIndoor->GetSector(v6, v5, v4); v3->uRadius = v7; if ( !v7 ) { v8 = v3->vPartyPos.z; v3->vPartyPos.x = pParty->vPosition.x; v9 = pParty->vPosition.z; v10 = v3->vPartyPos.x; v3->vPartyPos.y = pParty->vPosition.z; v3->uRadius = pIndoor->GetSector(v10, v9, v8); } if ( pRenderer->pRenderD3D ) { v3->sCosineY = stru_5C6E00->SinCos(v3->sPartyRotY); v3->sSineY = stru_5C6E00->SinCos(v3->sPartyRotY - stru_5C6E00->uIntegerHalfPi); v3->sCosineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX); v3->sSineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX - stru_5C6E00->uIntegerHalfPi); v3->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); v3->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); v3->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125); v3->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125); v3->field_64 = a2->field_3C; v11 = v3->uViewportW; v12 = v3->uViewportX; v13 = v3->uViewportZ - v12; v14 = v3->uViewportZ + v12; v3->field_70 = v13 + 1; v15 = v3->uViewportY; v3->uViewportHeight = v11 - v15 + 1; v16 = v3->uViewportW; v3->uViewportCenterX = v14 >> 1; v3->uViewportCenterY = (signed int)(v16 + v15) >> 1; } else { v3->sCosineY = stru_5C6E00->SinCos(-v3->sPartyRotY); v3->sSineY = stru_5C6E00->SinCos(-v3->sPartyRotY - stru_5C6E00->uIntegerHalfPi); v3->sCosineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX); v3->sSineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX - stru_5C6E00->uIntegerHalfPi); v17 = cos((double)-v3->sPartyRotY * 0.0030664064); v18 = v3->sPartyRotY; v3->fCosineY = v17; v19 = sin((double)-v18 * 0.0030664064); v20 = v3->sPartyRotX; v3->fSineY = v19; v21 = cos((double)-v20 * 0.0030664064); v22 = v3->sPartyRotX; v3->fCosineNegX = v21; v3->fSineNegX = sin((double)-v22 * 0.0030664064); v23 = v3->uViewportX; v3->field_64 = a2->field_3C; v24 = v3->uViewportZ; v3->field_70 = v3->uViewportZ - v23 + 1; v25 = v3->uViewportW - v3->uViewportY + 1; v3->uViewportHeight = v25; v29 = v25; v26 = v3->field_64; v3->uViewportCenterX = (signed int)(v24 + v23) >> 1; v3->uViewportCenterY = v3->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16); } v27 = (unsigned int)(signed __int64)((double)v3->field_70 * 0.5 / tan((double)(v2->field_1C_mb_fov >> 1) * 0.01745329) + 0.5) << 16; v3->field_40 = v27; LODWORD(v3->field_44) = 4294967296i64 / v27; v3->pRenderTarget = v2->pRenderTarget; v3->uTargetWidth = v2->uTargetWidth; v3->uTargetHeight = v2->uTargetHeight; v3->uViewportX = v2->uViewportX; v3->uViewportY = v2->uViewportY; v3->uViewportZ = v2->uViewportZ; v3->uViewportW = v2->uViewportW; v3->pTargetZBuffer = v2->pTargetZ; result = 0; v3->field_8C = 0; v3->field_84 = 0; v3->field_80 = 0; v3->field_88 = 0; pBLVRenderParams->field_90 = 64; pBLVRenderParams->field_94 = 6; return result; } //----- (00440B44) -------------------------------------------------------- void IndoorLocation::ExecDraw(char a1) { signed int i; // esi@2 int v2; // eax@3 IndoorCameraD3D_Vec4 *v3; // edx@4 signed int j; // esi@8 unsigned int v5; // ecx@9 RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4 if ( a1 ) { pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y); for ( i = 0; i < (signed int)pStru170->uNumFaceIDs; ++i ) { v2 = pStru170->pFaceIDs[2 * i + 1]; if ( pStru170->field_FA8[v2].std__vector_0007A8 == -1 ) { v6 = 0; v3 = 0; } else { v3 = pStru170->field_FA8[v2].std__vector_0007AC; v6 = pStru170->field_FA8[v2].pVertices; } IndoorLocation::ExecDraw_sub0(pStru170->pFaceIDs[2 * i], v3, 4u, v6); } } else { for ( j = 0; j < (signed int)pStru170->uNumFaceIDs; ++j ) { v5 = pStru170->pFaceIDs[2 * j]; pBLVRenderParams->field_7C = &pStru170->field_FA8[pStru170->pFaceIDs[2 * j + 1]].field_C; IndoorLocation::ExecDraw_sub1(v5); } } } //----- (00440BED) -------------------------------------------------------- void __fastcall sub_440BED(IndoorLocation_drawstru *_this) { unsigned __int16 *v1; // edi@7 char *v2; // esi@8 int v3; // ecx@9 unsigned int v4; // edx@9 char *v5; // eax@10 signed int v6; // [sp+8h] [bp-8h]@7 int v7; // [sp+Ch] [bp-4h]@8 sub_43F39E(_this); if ( pBLVRenderParams->uRadius ) IndoorLocation::ExecDraw(pRenderer->pRenderD3D != 0); pRenderer->DrawBillboardList_BLV(); if ( !pRenderer->pRenderD3D ) { if ( pBLVRenderParams->uFlags & 2 ) stru170_sub_4B0967(); if ( pBLVRenderParams->uFlags & 1 ) { v1 = pBLVRenderParams->pRenderTarget; v6 = 0; if ( (signed int)pStru170->std__vector_000FA8 > 0 ) { v7 = 0; v2 = (char *)&pStru170->field_FA8[0].field_C.field_4; do { v3 = *((int *)v2 - 1); v4 = pRenderer->uTargetSurfacePitch * *((int *)v2 - 1); if ( v3 <= *(int *)v2 ) { v5 = (char *)&pStru170->field_FA8[0].field_C.array_3D8[v3 + v7]; do { v1[v4 + *((short *)v5 - 480)] = 255; ++v3; v1[v4 + *(short *)v5] = 255; v4 += pRenderer->uTargetSurfacePitch; v5 += 2; } while ( v3 <= *(int *)v2 ); } ++v6; v7 += 1126; v2 += 2252; } while ( v6 < (signed int)pStru170->std__vector_000FA8 ); } } } } //----- (00441BD4) -------------------------------------------------------- void IndoorLocation::Draw() { 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 v0 = 0; if ( viewparams->field_50_draw_debug_outlines ) v0 = 1; if ( viewparams->field_54 ) LOBYTE(v0) = v0 | 2; _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed; _this.uFlags = v0; _this.vPosition.x = pParty->vPosition.x - ((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; _this.field_1C_mb_fov = 65; _this.vPosition.y = pParty->vPosition.z - LODWORD(v3); _this.sRotationY = pParty->sRotationY; _this.sRotationX = pParty->sRotationX; _this.pRenderTarget = pRenderer->pTargetSurface; _this.uViewportX = pViewport->uScreenX; _this.uViewportY = pViewport->uScreenY; _this.uViewportZ = pViewport->uScreenZ; _this.uViewportW = pViewport->uScreenW; _this.field_3C = pViewport->field_30; _this.vPosition.z = pParty->vPosition.y + pParty->sEyelevel; _this.uTargetWidth = 640; _this.uTargetHeight = 480; _this.pTargetZ = pRenderer->pActiveZBuffer; sub_440BED(&_this); pParty->uFlags &= 0xFFFFFFFDu; pGame->DrawParticles(); array_5118E8._440F07(); } //----- (004C0EF2) -------------------------------------------------------- void BLVFace::FromODM(ODMFace *a2) { this->pFacePlane_old.vNormal.x = a2->pFacePlane.vNormal.x; this->pFacePlane_old.vNormal.y = a2->pFacePlane.vNormal.y; this->pFacePlane_old.vNormal.z = a2->pFacePlane.vNormal.z; this->pFacePlane_old.dist = a2->pFacePlane.dist; this->pFacePlane.vNormal.x = (double)(a2->pFacePlane.vNormal.x & 0xFFFF) * 0.000015259022 + (double)(a2->pFacePlane.vNormal.x >> 16); this->pFacePlane.vNormal.y = (double)(a2->pFacePlane.vNormal.y & 0xFFFF) * 0.000015259022 + (double)(a2->pFacePlane.vNormal.y >> 16); this->pFacePlane.vNormal.z = (double)(a2->pFacePlane.vNormal.z & 0xFFFF) * 0.000015259022 + (double)(a2->pFacePlane.vNormal.z >> 16); this->pFacePlane.dist = (double)(a2->pFacePlane.dist & 0xFFFF) * 0.000015259022 + (double)(a2->pFacePlane.dist >> 16); this->uAttributes = a2->uFaceAttributes; this->pBounding.x1 = a2->pBoundingBox.x1; this->pBounding.y1 = a2->pBoundingBox.y1; this->pBounding.z1 = a2->pBoundingBox.z1; this->pBounding.x2 = a2->pBoundingBox.x2; this->pBounding.y2 = a2->pBoundingBox.y2; this->pBounding.z2 = a2->pBoundingBox.z2; this->zCalc1 = a2->zCalc1; this->zCalc2 = a2->zCalc2; this->zCalc3 = a2->zCalc3; this->pXInterceptDisplacements = a2->pXInterceptDisplacements; this->pYInterceptDisplacements = a2->pYInterceptDisplacements; this->pZInterceptDisplacements = a2->pZInterceptDisplacements; this->uPolygonType = (PolygonType)a2->uPolygonType; this->uNumVertices = a2->uNumVertices; this->uBitmapID = a2->uTextureID; this->pVertexIDs = a2->pVertexIDs; } //----- (004B0A25) -------------------------------------------------------- void IndoorLocation::ExecDraw_sub0(unsigned int uFaceID, IndoorCameraD3D_Vec4 *pVertices, unsigned int uNumVertices, RenderVertexSoft *a4) { unsigned int v4; // esi@1 char *v5; // eax@4 signed int v6; // ecx@4 char *v7; // eax@8 signed int v8; // ecx@8 BLVFace *v9; // esi@13 IndoorCameraD3D *v10; // edi@16 int v11; // ebx@17 Vec3_short_ *v12; // ecx@18 char *v13; // edx@18 int v14; // eax@19 unsigned __int8 v15; // sf@19 unsigned __int8 v16; // of@19 int v17; // ebx@25 double v18; // st7@27 double v19; // st6@27 double v20; // st5@27 char v21; // dl@27 unsigned int v22; // eax@44 unsigned int v23; // eax@35 DWORD v24; // eax@37 int v25; // eax@38 char *v26; // edi@38 IDirect3DTexture2 *v27; // eax@42 Texture *v28; // [sp+Ch] [bp-1Ch]@15 int i; // [sp+10h] [bp-18h]@38 LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16 IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16 IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1 unsigned int uFaceID_; // [sp+20h] [bp-8h]@1 unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17 int a4a; // [sp+34h] [bp+Ch]@25 unsigned int a4b; // [sp+34h] [bp+Ch]@38 v4 = uFaceID; a7 = pVertices; uFaceID_ = uFaceID; if ( (uFaceID & 0x80000000u) == 0 && (signed int)uFaceID < (signed int)pIndoor->uNumFaces ) { static RenderVertexSoft static_vertices_F7C228[64]; static bool __init_flag1 = false; if (!__init_flag1) { __init_flag1 = true; for (uint i = 0; i < 64; ++i) static_vertices_F7C228[i].flt_2C = 0.0f; } static RenderVertexSoft static_vertices_F7B628[64]; static bool __init_flag2 = false; if (!__init_flag2) { __init_flag2 = true; for (uint i = 0; i < 64; ++i) static_vertices_F7B628[i].flt_2C = 0.0f; } static stru154 stru_F7B60C; // idb /*static bool __init_flag3 = false; if (!__init_flag3) { __init_flag3 = true; stru154::stru154(&stru_F7B60C); }*/ v9 = &pIndoor->pFaces[v4]; if ( v9->uNumVertices >= 3u ) { if ( !(BYTE1(v9->uAttributes) & 0x20) ) { ++pBLVRenderParams->field_80; LOBYTE(v9->uAttributes) |= 0x80u; v28 = v9->GetTexture(); if ( v28 ) { v10 = pGame->pIndoorCameraD3D; v31 = pGame->pIndoorCameraD3D; pStru4 = pGame->pLightmapBuilder; if ( !pGame->pIndoorCameraD3D->IsFaceFacedTowardsCamera(v9) ) { v11 = 0; uNumVerticesa = v9->uNumVertices; if ( (signed int)uNumVerticesa > 0 ) { v12 = pIndoor->pVertices; v13 = (char *)&static_vertices_F7C228[0].vWorldPosition.z; do { v14 = v11++; *((float *)v13 - 2) = (double)v12[v9->pVertexIDs[v14]].x; *((float *)v13 - 1) = (double)v12[v9->pVertexIDs[v14]].y; *(float *)v13 = (double)v12[v9->pVertexIDs[v14]].z; v13 += 48; v16 = __OFSUB__(v11, uNumVerticesa); v15 = ((v11 - uNumVerticesa) & 0x80000000u) != 0; *((float *)v13 - 5) = (double)v9->pVertexUIDs[v14]; *((float *)v13 - 4) = (double)v9->pVertexVIDs[v14]; } while ( v15 ^ v16 ); v10 = v31; } if ( !a7 || (pGame->pStru9Instance->_498377(a4, 4u, a7, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) ) { if ( v10->_437285_prolly_colide_vertices_against_frustrum( static_vertices_F7C228, &uNumVerticesa, static_vertices_F7B628, v10->std__vector_000034_prolly_frustrum, 4, 0, 0) != 1 || uNumVerticesa ) { a4a = SHIWORD(stru_F8AD28.field_2C); v17 = (248 - 8 * SHIWORD(stru_F8AD28.field_2C)) | (((248 - 8 * SHIWORD(stru_F8AD28.field_2C)) | ((248 - 8 * SHIWORD(stru_F8AD28.field_2C)) << 8)) << 8); sub_4B0E07(uFaceID_); pStru4->ApplyLights_IndoorFace(uFaceID_); pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID_); v31->_4364C5(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28); v31->_436BB7_project_and_stuff(array_507D30, uNumVerticesa, 0); pStru4->std__vector_000004_size = 0; if ( stru_F8AD28.field_AC > 0 || pDecalBuilder->uNumDecals > 0 ) { v18 = v9->pFacePlane.dist; v19 = v9->pFacePlane.vNormal.z; v20 = v9->pFacePlane.vNormal.y; v21 = v9->uPolygonType; stru_F7B60C.vNormal.x = v9->pFacePlane.vNormal.x; stru_F7B60C.field_14 = v21; stru_F7B60C.vNormal.y = v20; stru_F7B60C.vNormal.z = v19; stru_F7B60C.field_10 = v18; } if ( stru_F8AD28.field_AC > 0 && !(BYTE2(v9->uAttributes) & 0x40) ) pStru4->ApplyLights( &stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, *(float *)&a7, 0); if ( pDecalBuilder->uNumDecals > 0 ) pDecalBuilder->ApplyDecals( a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, (int)a7, 0, v9->uSectorID); if ( v9->uAttributes & 0x10 && v9->uBitmapID == pRenderer->field_1036AC_bitmapid ) { v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]; goto LABEL_42; } if ( v9->uAttributes & 0x10 ) { v24 = GetTickCount() >> 2; if ( (signed int)uNumVerticesa > 0 ) { v25 = v24 - stru_5C6E00->uIntegerHalfPi; v26 = (char *)&array_507D30[0].v; a4b = uNumVerticesa; for ( i = v25; ; v25 = i ) { *(float *)v26 = (double)(pBitmaps_LOD->pTextures[v9->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8)) + *(float *)v26; v26 += 48; --a4b; if ( !a4b ) break; } } } else { v22 = v9->uAttributes; if ( BYTE1(v22) & 0x40 ) { v23 = pTextureFrameTable->GetFrameTexture( v9->uBitmapID, pBLVRenderParams->field_0_timer_); LABEL_42: v27 = pBitmaps_LOD->pHardwareTextures[v23]; if ( BYTE2(v9->uAttributes) & 0x40 ) sub_479A53(uNumVerticesa, uFaceID_); else pRenderer->DrawIndoorPolygon(uNumVerticesa, v9, v27, v28, 8 * uFaceID_ | 6, v17, 0); return; } } v23 = v9->uBitmapID; goto LABEL_42; } } } } } } } } // F7CE28: using guessed type char static_init_flag__F7C228_bit1__F7B628_bit2__F7B60C_bit3; //----- (004AFF79) -------------------------------------------------------- void IndoorLocation::ExecDraw_sub1(unsigned int uFaceID) { unsigned int v1; // ebx@1 BLVFace *v2; // esi@3 unsigned int v3; // eax@3 Texture *v4; // eax@8 Texture *v5; // edi@8 int v6; // eax@9 int v7; // eax@9 int v8; // ecx@17 int v9; // ebx@17 int v10; // eax@17 int v11; // esi@17 unsigned int v12; // eax@17 int j; // ecx@19 int v14; // edx@20 int v15; // eax@20 int v16; // edx@20 int i; // ebx@22 int v18; // ecx@23 int v19; // eax@23 int v20; // eax@23 int v21; // eax@24 unsigned __int8 *v22; // ecx@24 int v23; // ebx@24 int v24; // esi@25 int v25; // eax@28 unsigned __int16 *v26; // eax@28 unsigned int v27; // eax@29 int v28; // eax@30 char *v29; // esi@31 int v30; // eax@33 int v31; // eax@33 int v32; // eax@35 int v33; // edx@35 signed int v34; // ebx@35 int v35; // eax@35 int v36; // ebx@35 signed int v37; // ebx@35 signed int v38; // edi@35 unsigned int v39; // edi@36 int v40; // edx@40 int v41; // ecx@40 signed int v42; // edx@40 int v43; // edx@42 int v44; // eax@42 unsigned __int16 *v45; // eax@43 int *v46; // esi@44 unsigned __int16 *v47; // edi@44 unsigned int v48; // edx@44 int v49; // ebx@44 char v50; // cl@44 char v51; // ch@44 unsigned int v52; // ebx@46 int v53; // edx@46 unsigned int v54; // ebx@46 int v55; // edx@46 unsigned int v56; // ebx@47 int v57; // edx@47 int v58; // ebx@47 int v59; // edx@47 unsigned __int16 *v60; // eax@50 int *v61; // esi@51 unsigned __int16 *v62; // edi@51 unsigned int v63; // edx@51 int v64; // ebx@51 char v65; // cl@51 char v66; // ch@51 unsigned int v67; // ebx@53 int v68; // edx@53 unsigned int v69; // ebx@53 int v70; // edx@53 unsigned int v71; // ebx@54 int v72; // edx@54 int v73; // ebx@54 int v74; // edx@54 unsigned __int16 *v75; // eax@58 int *v76; // esi@59 int v77; // edi@59 unsigned int v78; // edx@59 int v79; // ebx@59 char v80; // cl@59 char v81; // ch@59 int v82; // ebx@61 int v83; // edx@61 unsigned int v84; // ebx@62 int v85; // edx@62 unsigned __int16 *v86; // eax@65 int *v87; // esi@66 int v88; // edi@66 unsigned int v89; // edx@66 int v90; // ebx@66 char v91; // cl@66 char v92; // ch@66 int v93; // ebx@68 int v94; // edx@68 unsigned __int16 v95; // bx@69 int v96; // edx@69 unsigned __int8 *v97; // [sp+Ch] [bp-9Ch]@24 unsigned __int8 *v98; // [sp+10h] [bp-98h]@24 unsigned __int8 *v99; // [sp+14h] [bp-94h]@24 unsigned __int8 *v100; // [sp+18h] [bp-90h]@24 int v101; // [sp+1Ch] [bp-8Ch]@40 int v102; // [sp+20h] [bp-88h]@31 BLVFace *v103; // [sp+24h] [bp-84h]@3 unsigned __int16 *v104; // [sp+28h] [bp-80h]@24 int v105; // [sp+2Ch] [bp-7Ch]@30 int v106; // [sp+30h] [bp-78h]@24 int v107; // [sp+34h] [bp-74h]@9 Texture *v108; // [sp+38h] [bp-70h]@8 int v109; // [sp+3Ch] [bp-6Ch]@9 unsigned int v110; // [sp+40h] [bp-68h]@24 unsigned int v111; // [sp+44h] [bp-64h]@1 int *k; // [sp+48h] [bp-60h]@31 int v113; // [sp+4Ch] [bp-5Ch]@35 int v114; // [sp+50h] [bp-58h]@35 int v115; // [sp+54h] [bp-54h]@42 unsigned __int8 *v116; // [sp+58h] [bp-50h]@35 int v117; // [sp+5Ch] [bp-4Ch]@33 int a1; // [sp+60h] [bp-48h]@27 int v119; // [sp+64h] [bp-44h]@17 int v120; // [sp+68h] [bp-40h]@23 unsigned int v121; // [sp+6Ch] [bp-3Ch]@40 unsigned int v122; // [sp+70h] [bp-38h]@35 int v123; // [sp+74h] [bp-34h]@30 int v124; // [sp+78h] [bp-30h]@17 int v125; // [sp+7Ch] [bp-2Ch]@35 unsigned int v126; // [sp+80h] [bp-28h]@9 int v127; // [sp+84h] [bp-24h]@17 int v128; // [sp+88h] [bp-20h]@9 int *pZPixel; // [sp+8Ch] [bp-1Ch]@28 int a2; // [sp+90h] [bp-18h]@16 unsigned int v131; // [sp+94h] [bp-14h]@17 unsigned __int16 *pColorPixel; // [sp+98h] [bp-10h]@28 int v133; // [sp+9Ch] [bp-Ch]@17 int v134; // [sp+A0h] [bp-8h]@17 int v135; // [sp+A4h] [bp-4h]@24 v1 = uFaceID; v111 = pRenderer->uTargetSurfacePitch; if ( (uFaceID & 0x80000000u) == 0 ) { if ( (signed int)uFaceID < (signed int)pIndoor->uNumFaces ) { v2 = &pIndoor->pFaces[uFaceID]; v103 = v2; v3 = v2->uAttributes; if ( !(BYTE1(v3) & 0x20) ) { if ( v3 & 0x400000 ) { sub_4ADD1D(uFaceID); return; } if ( !(v3 & 0x10) || (sub_4AD504(uFaceID), pRenderer->pRenderD3D) ) { v4 = v2->GetTexture(); ++pBLVRenderParams->field_80; v5 = v4; v108 = v4; if ( v4 ) { v6 = v4->palette_id2; LOBYTE(v2->uAttributes) |= 0x80u; v109 = v6; sub_4AE5F1(v1); v126 = stru_F8AD28.pDeltaUV[0]; v128 = stru_F8AD28.pDeltaUV[1]; v107 = bUseLoResSprites; v7 = sub_423B5D(v1); if ( v7 ) { if ( sub_424829(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) { if ( v2->uPolygonType == 1 ) { for ( i = 0; i < stru_F8AD28.field_AC; stru_F8AD28._blv_lights_ys[v18] = v20 ) { v18 = i; v120 = stru_F8AD28._blv_lights_xs[i]; v134 = (unsigned __int64)(v120 * (signed __int64)-stru_F8AD28.plane_4.vNormal.y) >> 16; v133 = stru_F8AD28.plane_4.vNormal.x; v120 = stru_F8AD28._blv_lights_ys[i]; v133 = (unsigned __int64)(v120 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16; v19 = v128; stru_F8AD28._blv_lights_xs[i] = v126 + v134 + ((unsigned __int64)(v120 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16); v20 = v19 - stru_F8AD28._blv_lights_zs[i++]; } } else { if ( v2->uPolygonType != 3 ) { if ( v2->uPolygonType == 4 ) { LABEL_16: a2 = 0; if ( stru_F8AD28.field_AC > 0 ) { do { v8 = a2; v9 = stru_F8AD28._blv_lights_xs[a2]; v131 = stru_F8AD28._blv_lights_ys[a2]; v10 = stru_F8AD28._blv_lights_zs[a2]; v11 = (signed int)(v10 * stru_F8AD28.plane_4.vNormal.z + stru_F8AD28.plane_4.dist + v9 * stru_F8AD28.plane_4.vNormal.x + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16; v119 = v9 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)((signed int)(v10 * stru_F8AD28.plane_4.vNormal.z + stru_F8AD28.plane_4.dist + v9 * stru_F8AD28.plane_4.vNormal.x + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16)) >> 16); v131 -= (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)v11) >> 16; v127 = v10 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)v11) >> 16); stru_F8AD28._blv_lights_xs[a2] = ((unsigned __int64)(v119 * (signed __int64)stru_F8AD28.vec_14.x) >> 16) + ((unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_14.y) >> 16); v124 = (unsigned __int64)(v119 * (signed __int64)stru_F8AD28.vec_20.x) >> 16; v134 = (unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_20.y) >> 16; v133 = (unsigned __int64)(v127 * (signed __int64)stru_F8AD28.vec_20.z) >> 16; v12 = v126; stru_F8AD28._blv_lights_ys[v8] = v124 + ((unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_20.y) >> 16) + ((unsigned __int64)(v127 * (signed __int64)stru_F8AD28.vec_20.z) >> 16); stru_F8AD28._blv_lights_xs[v8] += v12; stru_F8AD28._blv_lights_ys[v8] += v128; ++a2; } while ( a2 < stru_F8AD28.field_AC ); v2 = v103; } goto LABEL_24; } if ( v2->uPolygonType != 5 ) { if ( v2->uPolygonType != 6 ) goto LABEL_24; goto LABEL_16; } } for ( j = 0; j < stru_F8AD28.field_AC; *(int *)v15 = v16 ) { v14 = v128; stru_F8AD28._blv_lights_xs[j] += v126; v15 = 4 * j + 16297672; v16 = v14 - stru_F8AD28._blv_lights_ys[j++]; } } LABEL_24: v135 = 1; pGame->_44ED0A(v2, &v135, 31); v104 = sr_sub_47C24C_get_palette(v2, v109, 0, 1); v134 = stru_F8AD28.field_44; v106 = stru_F8AD28.field_48; v21 = stru_F8A590._viewport_space_y; a2 = stru_F8A590._viewport_space_y; v110 = v111 * stru_F8A590._viewport_space_y; v97 = v5->pLevelOfDetail0; v98 = v5->pLevelOfDetail1; v99 = v5->pLevelOfDetail2; v22 = v5->pLevelOfDetail3; v23 = 640 * stru_F8A590._viewport_space_y; v119 = 640 * stru_F8A590._viewport_space_y; v100 = v22; if ( stru_F8A590._viewport_space_y <= stru_F8A590.field_4 ) { v24 = 2 * stru_F8A590._viewport_space_y; v120 = 2 * stru_F8A590._viewport_space_y; while ( 1 ) { a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v24); sub_4AE313(a1, v21, &stru_F81018.field_0); if ( LOBYTE(viewparams->field_20) ) { v27 = v111 * (v24 - pBLVRenderParams->uViewportY); pZPixel = &pBLVRenderParams->pTargetZBuffer[2 * (*(__int16 *)((char *)stru_F8A590.array_18 + v24) + 320 * (v24 - pBLVRenderParams->uViewportY)) - pBLVRenderParams->uViewportX]; pColorPixel = &pBLVRenderParams->pRenderTarget[v27 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v24) - pBLVRenderParams->uViewportX]; v26 = &pBLVRenderParams->pRenderTarget[v27 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v24) - pBLVRenderParams->uViewportX]; v23 = v119; } else { v25 = *(__int16 *)((char *)stru_F8A590.array_18 + v24); pZPixel = &pBLVRenderParams->pTargetZBuffer[v25 + v23]; pColorPixel = &pBLVRenderParams->pRenderTarget[v25 + v110]; v26 = &pBLVRenderParams->pRenderTarget[v110 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v24)]; } v131 = (unsigned int)v26; HIWORD(v28) = HIWORD(stru_F81018.field_0.field_0); LOWORD(v28) = 0; v105 = stru_F8AD28.field_0 | v28; v123 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); if ( (unsigned int)pColorPixel < v131 ) { v102 = v107 + v106; v29 = (char *)&stru_F81018.field_34.field_8; a1 += v134; for ( k = &stru_F81018.field_34.field_8; ; v29 = (char *)k ) { sub_4AE313(a1, a2, (stru337_stru0 *)(v29 - 8)); v30 = *((int *)v29 - 2); LOWORD(v30) = 0; v117 = v105; v31 = stru_F8AD28.field_0 | v30; if ( v105 <= (unsigned int)v31 ) v117 = v31; v105 = v31; v32 = *((int *)v29 - 14); v122 = *((int *)v29 - 14) >> v107; v33 = *((int *)v29 - 13); v125 = *((int *)v29 - 13) >> v107; v34 = *((int *)v29 - 1) - v32; v113 = (*(int *)v29 - v33) >> v102; v35 = *((int *)v29 - 11); v114 = v34 >> v102; v116 = (&v97)[4 * v35]; v36 = v35 + 16 - v5->uWidthLn2; v133 = v35 + 16; v127 = v35 + v36; v37 = v5->uWidthMinus1 >> v35; v38 = v5->uHeightMinus1 >> v35 << (v35 + 16); v128 = v37; v126 = v38; v39 = (unsigned int)(LOBYTE(viewparams->field_20) ? &pColorPixel[2 * v134] : &pColorPixel[v134]); if ( v39 > v131 ) v39 = v131; v40 = *((short *)v29 + 1); v41 = *((short *)v29 - 1); v121 = v39; v42 = sub_4AE491(v41, v40); v101 = v42; v124 = (signed int)(v39 - (int)pColorPixel) >> 1; if ( v123 >> 16 == v42 >> 16 || v135 & 2 ) { v123 = (int)sr_sub_47C24C_get_palette(v103, v109, v123 >> 16, 1); if ( LOBYTE(viewparams->field_20) ) { v86 = pColorPixel; if ( (unsigned int)pColorPixel < v121 ) { v87 = pZPixel; v88 = v123; v89 = v122; v90 = v125; v91 = v133; v92 = v127; if ( v124 & 2 ) { *pZPixel = v117; v87 -= 2; v86 = pColorPixel + 2; goto LABEL_69; } do { v86 += 4; v93 = *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92)); v94 = v117; LOWORD(v93) = *(short *)(v88 + 2 * v93); *v87 = v117; v87[1] = v94; v87[640] = v94; v87[641] = v94; *(v86 - 4) = v93; *(v86 - 3) = v93; v86[636] = v93; v86[637] = v93; v87[2] = v94; v87[3] = v94; v87[642] = v94; v87[643] = v94; v122 += v114; v125 += v113; v89 = v122; v90 = v125; LABEL_69: v87 += 4; v95 = *(short *)(v88 + 2 * *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92))); v96 = v114; *(v86 - 2) = v95; *(v86 - 1) = v95; v86[638] = v95; v86[639] = v95; v122 += v96; v125 += v113; v89 = v122; v90 = v125; } while ( (unsigned int)v86 < v121 ); pColorPixel = v86; pZPixel = v87; } } else { v75 = pColorPixel; if ( (unsigned int)pColorPixel < v121 ) { v76 = pZPixel; v77 = v123; v78 = v122; v79 = v125; v80 = v133; v81 = v127; if ( v124 & 1 ) { *pZPixel = v117; --v76; v75 = pColorPixel + 1; goto LABEL_62; } do { v75 += 2; v82 = *(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); v83 = v117; LOWORD(v82) = *(short *)(v77 + 2 * v82); *v76 = v117; *(v75 - 2) = v82; v76[1] = v83; v122 += v114; v125 += v113; v78 = v122; v79 = v125; LABEL_62: v84 = (unsigned int)(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); v76 += 2; v85 = v114; *(v75 - 1) = *(short *)(v77 + 2 * *(char *)v84); v122 += v85; v125 += v113; v78 = v122; v79 = v125; } while ( (unsigned int)v75 < v121 ); pColorPixel = v75; pZPixel = v76; } } } else { v43 = (v42 - v123) >> v106; v44 = v123 - v43; v123 = v43; v115 = v44; if ( LOBYTE(viewparams->field_20) ) { v60 = pColorPixel; if ( (unsigned int)pColorPixel < v121 ) { v61 = pZPixel; v62 = v104; v63 = v122; v64 = v125; v65 = v133; v66 = v127; if ( v124 & 2 ) { *pZPixel = v117; v61 += 2; v60 = pColorPixel + 2; goto LABEL_54; } do { v67 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); v68 = v123 + v115; v60 += 4; v115 = v68; v69 = ((v68 & 0xFFFF0000u) >> 8) + v116[v67]; v70 = v117; LOWORD(v69) = v62[v69]; *v61 = v117; v61[1] = v70; v61[640] = v70; v61[641] = v70; *(v60 - 4) = v69; *(v60 - 3) = v69; v60[636] = v69; v60[637] = v69; v61[2] = v70; v61[3] = v70; v61[642] = v70; v61[643] = v70; v122 += v114; v125 += v113; v63 = v122; v64 = v125; v61 += 4; LABEL_54: v71 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); v72 = v123 + v115; v73 = v116[v71]; v115 = v72; LOWORD(v73) = v62[((v72 & 0xFFFF0000u) >> 8) + v73]; v74 = v114; *(v60 - 2) = v73; *(v60 - 1) = v73; v60[638] = v73; v60[639] = v73; v122 += v74; v125 += v113; v63 = v122; v64 = v125; } while ( (unsigned int)v60 < v121 ); pColorPixel = v60; pZPixel = v61; } } else { v45 = pColorPixel; if ( (unsigned int)pColorPixel < v121 ) { v46 = pZPixel; v47 = v104; v48 = v122; v49 = v125; v50 = v133; v51 = v127; if ( v124 & 1 ) { *pZPixel = v117; ++v46; v45 = pColorPixel + 1; goto LABEL_47; } do { v52 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); v53 = v123 + v115; v45 += 2; v115 = v53; v54 = ((v53 & 0xFFFF0000u) >> 8) + v116[v52]; v55 = v117; LOWORD(v54) = v47[v54]; *v46 = v117; *(v45 - 2) = v54; v46[1] = v55; v122 += v114; v125 += v113; v48 = v122; v49 = v125; v46 += 2; LABEL_47: v56 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); v57 = v123 + v115; v58 = v116[v56]; v115 = v57; LOWORD(v58) = v47[((v57 & 0xFFFF0000u) >> 8) + v58]; v59 = v114; *(v45 - 1) = v58; v122 += v59; v125 += v113; v48 = v122; v49 = v125; } while ( (unsigned int)v45 < v121 ); pColorPixel = v45; pZPixel = v46; } } } k += 13; v5 = v108; v123 = v101; a1 += v134; if ( (unsigned int)pColorPixel >= v131 ) break; } v23 = v119; v24 = v120; } ++a2; v110 += v111; v23 += 640; v24 += 2; v120 = v24; v119 = v23; if ( a2 > stru_F8A590.field_4 ) break; v21 = a2; } } return; } } } } } } } } // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); //----- (004B0E07) -------------------------------------------------------- unsigned int __fastcall sub_4B0E07(unsigned int uFaceID) { BLVFace *v1; // edi@1 BLVFaceExtra *v2; // ecx@1 Texture *v3; // esi@1 unsigned int v4; // eax@1 unsigned int v5; // ecx@1 unsigned int result; // eax@1 unsigned int v7; // ecx@5 v1 = &pIndoor->pFaces[uFaceID]; v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; v3 = (Texture *)(v1->uBitmapID != -1 ? (int)&pBitmaps_LOD->pTextures[v1->uBitmapID] : 0); stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; v4 = GetTickCount(); v5 = v1->uAttributes; result = v4 >> 3; if ( v5 & 4 ) { stru_F8AD28.pDeltaUV[1] -= result & v3->uHeightMinus1; } else { if ( v5 & 0x20 ) stru_F8AD28.pDeltaUV[1] += result & v3->uHeightMinus1; } v7 = v1->uAttributes; if ( BYTE1(v7) & 8 ) { stru_F8AD28.pDeltaUV[0] -= result & v3->uWidthMinus1; } else { if ( v7 & 0x40 ) stru_F8AD28.pDeltaUV[0] += result & v3->uWidthMinus1; } return result; } //----- (004B0EA8) -------------------------------------------------------- void stru170::_4B0EA8(signed int a2, unsigned int uFaceID) { unsigned int v3; // edx@1 stru170 *v4; // ebx@1 BLVFace *v5; // eax@1 int v6; // ecx@2 unsigned __int16 v7; // ax@11 Vec3_short_ *v8; // esi@15 int v9; // edx@15 signed int v10; // eax@18 signed int v11; // edi@19 signed int v12; // ecx@19 signed int v13; // esi@19 signed int v14; // edx@20 int v15; // edx@24 int v16; // esi@29 BLVFace *v17; // edi@34 unsigned __int16 v18; // ax@34 char *v19; // eax@38 signed int v20; // ecx@38 char *v21; // eax@42 signed int v22; // ecx@42 signed int v23; // edx@45 char *v24; // ecx@46 int v25; // eax@47 Vec3_short_ *v26; // eax@47 double v27; // st7@47 signed int v28; // ST28_4@47 char v29; // al@48 signed int v30; // eax@51 int v31; // eax@52 unsigned int v32; // eax@55 __int16 v33; // cx@56 signed int v34; // [sp+Ch] [bp-14h]@18 int a0; // [sp+14h] [bp-Ch]@2 IndoorCameraD3D *a0a; // [sp+14h] [bp-Ch]@36 signed int v37; // [sp+18h] [bp-8h]@19 stru10 *v38; // [sp+18h] [bp-8h]@36 BLVFace *v39; // [sp+1Ch] [bp-4h]@1 v3 = uFaceID; v4 = this; v5 = &pIndoor->pFaces[uFaceID]; this->field_FA8[this->std__vector_000FA8].std__vector_0007A8 = -1; v39 = v5; if ( v5->uAttributes & 1 ) { v6 = (int)((char *)this + 2252 * a2); a0 = v6; if ( v3 == *(short *)(v6 + 5964) ) // stru170_stru0[a2]::uFaceID return; if ( !a2 && pBLVRenderParams->vPartyPos.x >= v5->pBounding.x1 - 16 && pBLVRenderParams->vPartyPos.x <= v5->pBounding.x2 + 16 && pBLVRenderParams->vPartyPos.y >= v5->pBounding.y1 - 16 && pBLVRenderParams->vPartyPos.y <= v5->pBounding.y2 + 16 && pBLVRenderParams->vPartyPos.z >= v5->pBounding.z1 - 16 && pBLVRenderParams->vPartyPos.z <= v5->pBounding.z2 + 16 ) { if ( abs(v5->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v5->pFacePlane_old.vNormal.x + pBLVRenderParams->vPartyPos.y * v5->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * v5->pFacePlane_old.vNormal.z) <= 589824 ) { v7 = v39->uSectorID; if ( v4->field_FA8[0].uSectorID == v7 ) v7 = v39->uBackSectorID; v4->field_FA8[v4->std__vector_000FA8].uSectorID = v7; v4->field_FA8[v4->std__vector_000FA8].uFaceID = uFaceID; v4->field_FA8[v4->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); v4->field_FA8[v4->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); v4->field_FA8[v4->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); v4->field_FA8[v4->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); v4->field_FA8[v4->std__vector_000FA8++].field_C._43F9E1( SLOWORD(pBLVRenderParams->uViewportX), pBLVRenderParams->uViewportY, SLOWORD(pBLVRenderParams->uViewportZ), pBLVRenderParams->uViewportW); sub_440639(v4->std__vector_000FA8 - 1); return; } v5 = v39; v6 = a0; } v8 = &pIndoor->pVertices[*v5->pVertexIDs]; v9 = v5->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x) + v5->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y) + v5->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); if ( *(short *)(v6 + 4008) != v5->uSectorID )// stru170_stru0[a2]::uSectorID v9 = -v9; if ( v9 < 0 ) { v10 = sub_423B5D(uFaceID); v34 = v10; if ( v10 ) { v11 = dword_50BAC8[0]; v12 = dword_50B9D8_ys[0]; a2 = dword_50BAC8[0]; v13 = 1; v37 = dword_50B9D8_ys[0]; if ( v10 > 1 ) { do { v14 = dword_50BAC8[v13]; if ( v14 < a2 ) a2 = dword_50BAC8[v13]; if ( v14 > v11 ) v11 = v14; v15 = dword_50B9D8_ys[v13]; if ( v15 < v37 ) v37 = dword_50B9D8_ys[v13]; if ( v15 > v12 ) v12 = dword_50B9D8_ys[v13]; v10 = v34; ++v13; } while ( v13 < v34 ); } v16 = a0; if ( v11 >= *(short *)(a0 + 4010) // stru170_stru0[a2]::uViewportX && a2 <= *(short *)(a0 + 4014) // stru170_stru0[a2]::uViewportZ && v12 >= *(short *)(a0 + 4012) // stru170_stru0[a2]::uViewportY && v37 <= *(short *)(a0 + 4016) // stru170_stru0[a2]::uViewportW && sub_424829(v10, &v4->field_FA8[v4->std__vector_000FA8].field_C, (stru170_stru2 *)(a0 + 4020), uFaceID) ) { v17 = v39; v18 = v39->uSectorID; if ( *(short *)(a0 + 4008) == v18 ) v18 = v39->uBackSectorID; v4->field_FA8[v4->std__vector_000FA8].uSectorID = v18; v4->field_FA8[v4->std__vector_000FA8].uFaceID = uFaceID; v4->field_FA8[v4->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); v4->field_FA8[v4->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); v4->field_FA8[v4->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); v4->field_FA8[v4->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); v38 = pGame->pStru10Instance; a0a = pGame->pIndoorCameraD3D; if ( *(int *)(v16 + 5968) == -1 ) // [a2]::std__vector_0007A8 { v29 = pGame->pStru10Instance->_49C681( v39, v4->field_FA8[v4->std__vector_000FA8].std__vector_0007AC, v4->field_FA8[v4->std__vector_000FA8].pVertices); } else { static RenderVertexSoft static_sub_4B0EA8_stru_F7AA08[64]; static bool __init_flag1 = false; if (!__init_flag1) { __init_flag1 = true; for (uint i = 0; i < 64; ++i) static_sub_4B0EA8_stru_F7AA08[i].flt_2C = 0.0f; } static RenderVertexSoft static_sub_4B0EA8_stru_F79E08[64]; static bool __init_flag2 = false; if (!__init_flag2) { __init_flag2 = true; for (uint i = 0; i < 64; ++i) static_sub_4B0EA8_stru_F79E08[i].flt_2C = 0.0f; } v23 = 0; a2 = v39->uNumVertices; if ( a2 > 0 ) { v24 = (char *)&static_sub_4B0EA8_stru_F7AA08[0].vWorldPosition.z; do { v25 = v17->pVertexIDs[v23++]; v26 = &pIndoor->pVertices[v25]; v27 = (double)v26->z; v28 = v26->y; v17 = v39; *((float *)v24 - 2) = (double)v26->x; *((float *)v24 - 1) = (double)v28; *(float *)v24 = v27; v24 += 48; } while ( v23 < a2 ); } a0a->_437285_prolly_colide_vertices_against_frustrum( static_sub_4B0EA8_stru_F7AA08, (unsigned int *)&a2, static_sub_4B0EA8_stru_F79E08, (IndoorCameraD3D_Vec4 *)(v16 + 5972), 4, 0, 0); v29 = v38->_49C5DA( v17, static_sub_4B0EA8_stru_F79E08, &a2, v4->field_FA8[v4->std__vector_000FA8].std__vector_0007AC, v4->field_FA8[v4->std__vector_000FA8].pVertices); } if ( v29 ) { v4->field_FA8[v4->std__vector_000FA8].std__vector_0007A8 = uFaceID; v30 = v4->std__vector_000FA8; if ( v30 < 150 ) { v31 = v30 + 1; v4->std__vector_000FA8 = v31; sub_440639(v31 - 1); } } if ( pBLVRenderParams->uFlags & 1 ) a0a->PrepareAndDrawDebugOutline(v17, 0x1E1EFFu); } } } } else { v32 = this->uNumFaceIDs; if ( (signed int)this->uNumFaceIDs < 1000 ) { v33 = a2; v4->pFaceIDs[2 * v32] = v3; v4->pFaceIDs[2 * v4->uNumFaceIDs++ + 1] = v33; } } } // F7B608: using guessed type char static_sub_4B0EA8_byte_F7B608_init_flags; //----- (004AFB86) -------------------------------------------------------- void stru170::_4AFB86(int a2, unsigned int uFaceID) { stru170 *v3; // ebx@1 BLVFace *v4; // eax@1 char *v5; // ecx@2 unsigned __int16 v6; // ax@11 int v7; // ecx@13 Vec3_short_ *v8; // esi@16 int v9; // edx@16 signed int v10; // eax@19 signed int v11; // edi@20 signed int v12; // ecx@20 signed int v13; // esi@20 int v14; // edx@21 int v15; // edx@25 unsigned __int16 v16; // ax@35 signed int v17; // eax@37 int v18; // eax@38 signed int v19; // [sp+Ch] [bp-14h]@19 char *v20; // [sp+14h] [bp-Ch]@2 BLVFace *v21; // [sp+18h] [bp-8h]@1 signed int v22; // [sp+1Ch] [bp-4h]@20 signed int v23; // [sp+28h] [bp+8h]@20 v3 = this; v4 = &pIndoor->pFaces[uFaceID]; v21 = v4; if ( v4->uAttributes & 1 ) { v5 = (char *)this + 2252 * a2; v20 = v5; if ( uFaceID == *((short *)v5 + 2982) ) return; if ( !a2 && pBLVRenderParams->vPartyPos.x >= v4->pBounding.x1 - 16 && pBLVRenderParams->vPartyPos.x <= v4->pBounding.x2 + 16 && pBLVRenderParams->vPartyPos.y >= v4->pBounding.y1 - 16 && pBLVRenderParams->vPartyPos.y <= v4->pBounding.y2 + 16 && pBLVRenderParams->vPartyPos.z >= v4->pBounding.z1 - 16 && pBLVRenderParams->vPartyPos.z <= v4->pBounding.z2 + 16 ) { if ( abs(v4->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 ) { v6 = v21->uSectorID; if ( v3->field_FA8[0].uSectorID == v6 ) v6 = v21->uBackSectorID; v3->field_FA8[v3->std__vector_000FA8].uSectorID = v6; v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID; v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); v3->field_FA8[v3->std__vector_000FA8++].field_C._43F9E1( SLOWORD(pBLVRenderParams->uViewportX), pBLVRenderParams->uViewportY, SLOWORD(pBLVRenderParams->uViewportZ), pBLVRenderParams->uViewportW); v7 = v3->std__vector_000FA8 - 1; goto LABEL_14; } v4 = v21; v5 = v20; } v8 = &pIndoor->pVertices[*v4->pVertexIDs]; v9 = v4->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x) + v4->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y) + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); if ( *((short *)v5 + 2004) != v4->uSectorID ) v9 = -v9; if ( v9 < 0 ) { v10 = sub_423B5D(uFaceID); v19 = v10; if ( v10 ) { v11 = dword_50BAC8[0]; v12 = dword_50B9D8_ys[0]; v23 = dword_50BAC8[0]; v13 = 1; v22 = dword_50B9D8_ys[0]; if ( v10 > 1 ) { do { v14 = dword_50BAC8[v13]; if ( v14 < v23 ) v23 = dword_50BAC8[v13]; if ( v14 > v11 ) v11 = dword_50BAC8[v13]; v15 = dword_50B9D8_ys[v13]; if ( v15 < v22 ) v22 = dword_50B9D8_ys[v13]; if ( v15 > v12 ) v12 = dword_50B9D8_ys[v13]; v10 = v19; ++v13; } while ( v13 < v19 ); } if ( v11 >= *((short *)v20 + 2005) && v23 <= *((short *)v20 + 2007) && v12 >= *((short *)v20 + 2006) && v22 <= *((short *)v20 + 2008) && sub_424829(v10, &v3->field_FA8[v3->std__vector_000FA8].field_C, (stru170_stru2 *)(v20 + 4020), uFaceID) ) { v16 = v21->uSectorID; if ( *((short *)v20 + 2004) == v16 ) v16 = v21->uBackSectorID; v3->field_FA8[v3->std__vector_000FA8].uSectorID = v16; v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID; v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); v17 = v3->std__vector_000FA8; if ( v17 < 150 ) { v18 = v17 + 1; v3->std__vector_000FA8 = v18; v7 = v18 - 1; LABEL_14: sub_440639(v7); return; } } } } } else { if ( (signed int)this->uNumFaceIDs < 1000 ) { this->pFaceIDs[2 * this->uNumFaceIDs] = uFaceID; this->pFaceIDs[2 * this->uNumFaceIDs++ + 1] = a2; } } } //----- (004B0967) -------------------------------------------------------- void __cdecl stru170_sub_4B0967() { signed int i; // edi@1 int v1; // esi@2 unsigned int v2; // ecx@4 int v3; // eax@4 int v4; // eax@6 unsigned __int16 *v5; // edx@6 int v6; // ecx@7 int v7; // esi@8 for ( i = 0; i < (signed int)pStru170->uNumFaceIDs; ++i ) { v1 = pStru170->pFaceIDs[2 * i]; if ( v1 >= 0 ) { if ( v1 < (signed int)pIndoor->uNumFaces ) { v2 = pStru170->pFaceIDs[2 * i]; pBLVRenderParams->field_7C = &pStru170->field_FA8[pStru170->pFaceIDs[2 * i + 1]].field_C; v3 = sub_423B5D(v2); if ( v3 ) { if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) { v4 = stru_F8A590._viewport_space_y; v5 = pBLVRenderParams->pRenderTarget; if ( stru_F8A590._viewport_space_y <= stru_F8A590.field_4 ) { v6 = 640 * stru_F8A590._viewport_space_y; do { v5[v6 + stru_F8A590.array_18[v4]] = -1; v7 = v6 + stru_F8A590.array_3D8[v4]; v6 += 640; v5[v7] = -1; ++v4; } while ( v4 <= stru_F8A590.field_4 ); } } } } } } } //----- (004AE5BA) -------------------------------------------------------- Texture *BLVFace::GetTexture() { unsigned int v1; // ecx@2 if ( uAttributes & 0x4000 ) v1 = pTextureFrameTable->GetFrameTexture(this->uBitmapID, pBLVRenderParams->field_0_timer_); else v1 = uBitmapID; return (Texture *)(v1 != -1 ? (int)&pBitmaps_LOD->pTextures[v1] : 0); } //----- (00498B15) -------------------------------------------------------- void IndoorLocation::Release() { IndoorLocation *v1; // esi@1 char *v2; // ebp@1 void *v3; // ST00_4@1 v1 = this; v2 = (char *)&this->ptr_0002B4_doors_ddata; pAllocator->FreeChunk(this->ptr_0002B4_doors_ddata); *(int *)v2 = 0; pAllocator->FreeChunk(v1->ptr_0002B0_sector_rdata); v1->ptr_0002B0_sector_rdata = 0; pAllocator->FreeChunk(v1->ptr_0002B8_sector_lrdata); v1->ptr_0002B8_sector_lrdata = 0; pAllocator->FreeChunk(v1->ptr_2AC); v1->ptr_2AC = 0; pAllocator->FreeChunk(v1->pSpawnPoints); v3 = v1->pVertices; v1->pSpawnPoints = 0; v1->uNumSectors = 0; v1->uNumFaces = 0; v1->uNumVertices = 0; v1->uNumNodes = 0; v1->uNumDoors = 0; v1->uNumLights = 0; pAllocator->FreeChunk(v3); pAllocator->FreeChunk(v1->pFaces); pAllocator->FreeChunk(v1->pFaceExtras); pAllocator->FreeChunk(v1->pSectors); pAllocator->FreeChunk(v1->pLights); pAllocator->FreeChunk(v1->pDoors); pAllocator->FreeChunk(v1->pNodes); pAllocator->FreeChunk(v1->pMapVertices); v1->pVertices = 0; v1->pFaces = 0; v1->pFaceExtras = 0; v1->pSectors = 0; v1->pLights = 0; v1->pDoors = 0; v1->pNodes = 0; v1->pMapVertices = 0; v1->bLoaded = 0; } //----- (00498C45) -------------------------------------------------------- int IndoorLocation::Alloc() { IndoorLocation *v1; // esi@1 void *v2; // eax@1 const void *v3; // ST3C_4@1 void *v4; // eax@1 const void *v5; // ST3C_4@1 void *v6; // eax@1 const void *v7; // ST3C_4@1 void *v8; // eax@1 const void *v9; // ST3C_4@1 void *v10; // eax@1 const void *v11; // ST3C_4@1 void *v12; // eax@1 const void *v13; // ST3C_4@1 void *v14; // eax@1 const void *v15; // ST3C_4@1 void *v16; // eax@1 void *v17; // ecx@1 signed int result; // eax@9 v1 = this; v2 = pAllocator->AllocNamedChunk(this->pVertices, 0x15F90u, "L.V"); v3 = v1->pFaces; v1->pVertices = (Vec3_short_ *)v2; v4 = pAllocator->AllocNamedChunk(v3, 0xEA600u, "L.F"); v5 = v1->pFaceExtras; v1->pFaces = (BLVFace *)v4; v6 = pAllocator->AllocNamedChunk(v5, 0x2BF20u, "L.FX"); v7 = v1->pSectors; v1->pFaceExtras = (BLVFaceExtra *)v6; v8 = pAllocator->AllocNamedChunk(v7, 0xE800u, "L.R"); v9 = v1->pLights; v1->pSectors = (BLVSector *)v8; v10 = pAllocator->AllocNamedChunk(v9, 0x1900u, "L.L"); v11 = v1->pDoors; v1->pLights = (BLVLightMM7 *)v10; v12 = pAllocator->AllocNamedChunk(v11, 0x3E80u, "L.D"); v13 = v1->pNodes; v1->pDoors = (BLVDoor *)v12; v14 = pAllocator->AllocNamedChunk(v13, 0x9C40u, "L.BSP"); v15 = v1->pMapVertices; v1->pNodes = (BSPNode *)v14; v16 = pAllocator->AllocNamedChunk(v15, 0x14824u, "L.Map"); v17 = v1->pVertices; v1->pMapVertices = (unsigned int *)v16; if ( v17 && v1->pFaces && v1->pFaceExtras && v1->pSectors && v1->pLights && v1->pDoors && v1->pNodes && v16 ) { memset(v17, 90000, 0); memset(v1->pFaces, 960000, 0); memset(v1->pFaceExtras, 180000, 0); memset(v1->pSectors, 59392, 0); memset(v1->pLights, 6400, 0); memset(v1->pDoors, 16000, 0); memset(v1->pNodes, 40000, 0); memset(v1->pMapVertices, 84004, 0); result = 1; } else { result = 0; } return result; } //----- (00444810) -------------------------------------------------------- unsigned int IndoorLocation::GetLocationIndex(const char *Str1) { const char *v1; // edi@1 signed int v2; // esi@1 v1 = Str1; v2 = 0; while ( _strcmpi(v1, _4E6BDC_loc_names[v2]) ) { ++v2; if ( v2 >= 11 ) return 0; } return v2 + 1; } //----- (004488F7) -------------------------------------------------------- void IndoorLocation::ToggleLight(unsigned int uLightID, unsigned int bToggle) { char *v2; // eax@4 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (signed int)uLightID <= pIndoor->uNumLights - 1 && (uLightID & 0x80000000u) == 0 ) { v2 = (char *)&pIndoor->pLights[uLightID].uAtributes; if ( bToggle ) *v2 &= 0xF7u; else *v2 |= 8u; pParty->uFlags |= 2u; } } //----- (00498E0A) -------------------------------------------------------- bool IndoorLocation::Load(char *pFilename, int a3, size_t i, char *pDest) { unsigned int v5; // ebx@1 IndoorLocation *v6; // esi@1 FILE *v7; // edi@3 bool result; // eax@3 char *v9; // ecx@4 void *v10; // eax@4 unsigned __int8 v11; // zf@4 unsigned __int8 v12; // sf@4 int v13; // eax@5 size_t v14; // ecx@6 char *v15; // ecx@6 int v16; // edx@6 size_t v17; // ecx@6 char *v18; // ecx@6 int v19; // edx@6 unsigned __int16 *v20; // edx@6 unsigned __int16 *v21; // edx@6 unsigned __int16 *v22; // edx@6 __int16 v23; // ax@10 char *v24; // ecx@10 __int16 v25; // cx@10 __int16 v26; // ax@11 char *v27; // ecx@11 unsigned __int16 v28; // ax@17 BLVFaceExtra *v29; // ecx@17 char *v30; // edx@17 int v31; // ecx@20 void *v32; // eax@25 int v33; // eax@26 unsigned __int16 *v34; // edx@27 size_t v35; // ecx@27 char *v36; // ecx@27 int v37; // edx@27 size_t v38; // ecx@27 char *v39; // ecx@27 int v40; // edx@27 unsigned __int16 *v41; // edx@27 unsigned __int16 *v42; // edx@27 unsigned __int16 *v43; // edx@27 unsigned __int16 *v44; // edx@27 size_t v45; // ecx@27 unsigned __int16 *v46; // edx@27 void *v47; // eax@28 BLVSector *v48; // eax@29 size_t v49; // ecx@29 unsigned __int16 *v50; // edx@31 void *v51; // eax@32 int v52; // eax@33 unsigned __int16 *v53; // edx@34 size_t v54; // ecx@34 char *v55; // ecx@34 int v56; // edx@34 size_t v57; // ecx@34 char *v58; // ecx@34 int v59; // edx@34 unsigned __int16 *v60; // edx@34 unsigned __int16 *v61; // edx@34 unsigned __int16 *v62; // edx@34 unsigned __int16 *v63; // edx@34 int v64; // ecx@34 BLVDoor *v65; // ecx@36 char *v66; // eax@37 int v67; // edx@38 int v68; // ecx@38 BLVFace *v69; // edx@38 int v70; // ecx@38 int v71; // edx@38 int v72; // eax@38 unsigned __int16 v73; // ax@42 char *v74; // ecx@42 LayingItem *v75; // ecx@44 size_t v76; // eax@45 int j; // edx@46 unsigned __int16 v78; // ax@50 void *v79; // eax@52 void **v80; // esi@52 size_t v81; // eax@56 FILE *v82; // eax@56 unsigned int v83; // edi@67 void *v84; // eax@67 void *v85; // ebx@67 const void *v86; // ebx@72 const void *v87; // ebx@72 const void *v88; // ebx@72 void *v89; // eax@72 size_t v90; // ecx@72 const void *v91; // ebx@72 int v92; // eax@72 BLVFace *v93; // ecx@73 BLVSector *v94; // ecx@73 unsigned __int16 *v95; // edx@73 int v96; // ecx@73 BLVSector *v97; // ecx@73 unsigned __int16 *v98; // edx@73 unsigned __int16 *v99; // edx@73 unsigned __int16 *v100; // edx@73 unsigned __int16 *v101; // edx@73 __int16 v102; // ax@77 BLVSector *v103; // ecx@77 __int16 v104; // ax@77 __int16 v105; // ax@78 BLVSector *v106; // ecx@78 const void *v107; // ebx@82 const void *v108; // ebx@82 unsigned __int16 v109; // ax@86 BLVFaceExtra *v110; // ecx@86 int v111; // edx@86 BLVFaceExtra *v112; // ecx@89 const void *v113; // ebx@94 const void *v114; // ebx@94 void *v115; // eax@94 size_t v116; // ecx@94 const void *v117; // ebx@94 int v118; // eax@94 unsigned __int16 *v119; // edx@95 int v120; // ecx@95 BLVFace *v121; // ecx@95 unsigned __int16 *v122; // edx@95 int v123; // ecx@95 BLVFace *v124; // ecx@95 unsigned __int16 *v125; // edx@95 unsigned __int16 *v126; // edx@95 unsigned __int16 *v127; // edx@95 unsigned __int16 *v128; // edx@95 unsigned __int16 *v129; // edx@95 int v130; // ecx@95 unsigned __int16 *v131; // edx@95 void *v132; // eax@96 size_t v133; // ecx@96 const void *v134; // ebx@96 BLVSector *v135; // eax@97 FILE *v136; // ecx@97 unsigned __int16 *v137; // edx@99 const void *v138; // ebx@100 const void *v139; // ebx@100 unsigned __int16 v140; // ax@102 FILE *v141; // ecx@102 const void *v142; // ebx@103 const void *v143; // ebx@103 const void *v144; // ebx@103 unsigned int v145; // eax@103 void *v146; // eax@103 unsigned int v147; // ecx@103 int v148; // ebx@103 unsigned int *v149; // ecx@103 size_t v150; // eax@103 unsigned int v151; // ebx@109 unsigned int v152; // ecx@116 unsigned int v153; // eax@117 size_t v154; // ebx@126 unsigned int v155; // ebx@134 size_t v156; // eax@140 signed int v157; // ebx@142 int v158; // ebx@148 BLVFace *v159; // eax@149 BLVFaceExtra *v160; // ecx@149 BLVFaceExtra *v161; // ecx@149 signed int v162; // ebx@154 unsigned int v163; // ebx@157 unsigned int v164; // ebx@157 unsigned int v165; // edx@158 char *v166; // ecx@158 unsigned __int16 v167; // ax@161 __int16 v168; // ax@165 unsigned int v169; // ebx@168 void *v170; // eax@168 size_t v171; // ebx@168 int v172; // edx@168 BLVDoor *v173; // ecx@169 int k; // eax@169 BLVDoor *v175; // ecx@172 int v176; // edx@172 BLVDoor *v177; // ecx@172 int v178; // edx@172 BLVDoor *v179; // ecx@172 int v180; // edx@172 BLVDoor *v181; // ecx@172 int v182; // edx@172 BLVDoor *v183; // ecx@172 int v184; // edx@172 BLVDoor *v185; // ecx@172 int v186; // edx@172 BLVDoor *v187; // ecx@172 int v188; // edx@172 unsigned __int16 *v189; // ebx@172 char *v190; // edx@173 BLVDoor *v191; // ecx@174 BLVDoor *l; // eax@175 signed int v193; // ebx@176 int v194; // ecx@176 BLVFaceExtra *v195; // ecx@176 BLVFace *v196; // ebx@178 std::string v197; // [sp-18h] [bp-680h]@66 void *v198; // [sp-14h] [bp-67Ch]@72 size_t v199; // [sp-10h] [bp-678h]@72 size_t v200; // [sp-Ch] [bp-674h]@72 const char *v201; // [sp-8h] [bp-670h]@4 int v202; // [sp-4h] [bp-66Ch]@4 char v203[875]; // [sp+Ch] [bp-65Ch]@130 char FileName[260]; // [sp+378h] [bp-2F0h]@1 char DstBuf; // [sp+47Ch] [bp-1ECh]@4 __int32 Offset; // [sp+480h] [bp-1E8h]@4 __int32 v207; // [sp+48Ch] [bp-1DCh]@4 __int32 v208; // [sp+498h] [bp-1D0h]@4 __int32 v209; // [sp+4A4h] [bp-1C4h]@4 __int32 v210; // [sp+4B0h] [bp-1B8h]@4 __int32 v211; // [sp+4BCh] [bp-1ACh]@15 __int32 v212; // [sp+4C8h] [bp-1A0h]@15 __int32 v213; // [sp+4D4h] [bp-194h]@25 __int32 v214; // [sp+4E0h] [bp-188h]@25 __int32 v215; // [sp+4ECh] [bp-17Ch]@32 __int32 v216; // [sp+4F8h] [bp-170h]@32 __int32 v217; // [sp+504h] [bp-164h]@40 __int32 v218; // [sp+510h] [bp-158h]@40 __int32 v219; // [sp+51Ch] [bp-14Ch]@43 __int32 v220; // [sp+528h] [bp-140h]@43 __int32 v221; // [sp+534h] [bp-134h]@52 __int32 v222; // [sp+540h] [bp-128h]@52 __int32 v223; // [sp+54Ch] [bp-11Ch]@52 __int32 v224; // [sp+558h] [bp-110h]@52 __int32 v225; // [sp+564h] [bp-104h]@52 __int32 v226; // [sp+570h] [bp-F8h]@52 __int32 v227; // [sp+57Ch] [bp-ECh]@52 __int32 v228; // [sp+588h] [bp-E0h]@52 __int32 v229; // [sp+594h] [bp-D4h]@52 __int32 v230; // [sp+5A0h] [bp-C8h]@52 __int32 v231; // [sp+5ACh] [bp-BCh]@52 __int32 v232; // [sp+5B8h] [bp-B0h]@52 __int32 v233; // [sp+5C4h] [bp-A4h]@52 __int32 v234; // [sp+5D0h] [bp-98h]@52 char pName[40]; // [sp+5FCh] [bp-6Ch]@42 size_t pSource; // [sp+624h] [bp-44h]@67 char Dst[12]; // [sp+628h] [bp-40h]@9 char *v238; // [sp+634h] [bp-34h]@38 ODMHeader header; // [sp+638h] [bp-30h]@61 void *ptr; // [sp+648h] [bp-20h]@66 size_t Count; // [sp+64Ch] [bp-1Ch]@109 int uSourceLen; // [sp+653h] [bp-15h]@66 FILE *File; // [sp+658h] [bp-10h]@56 BLVSector *v244; // [sp+65Ch] [bp-Ch]@72 int v245; // [sp+660h] [bp-8h]@72 BLVFace *Src; // [sp+664h] [bp-4h]@73 signed int Argsa; // [sp+670h] [bp+8h]@4 signed int Argsb; // [sp+670h] [bp+8h]@7 signed int Argsc; // [sp+670h] [bp+8h]@15 signed int Argsd; // [sp+670h] [bp+8h]@18 int Argse; // [sp+670h] [bp+8h]@25 int Argsf; // [sp+670h] [bp+8h]@28 int Argsg; // [sp+670h] [bp+8h]@32 int Argsh; // [sp+670h] [bp+8h]@35 signed int Argsi; // [sp+670h] [bp+8h]@40 signed int Argsj; // [sp+670h] [bp+8h]@45 int Argsk; // [sp+670h] [bp+8h]@143 void *Argsl; // [sp+670h] [bp+8h]@155 signed int Argsm; // [sp+670h] [bp+8h]@161 signed int Argsn; // [sp+670h] [bp+8h]@175 v5 = 0; v6 = this; _6807E0_num_decorations_6807B8 = 0; sprintfex(FileName, "levels\\%s", pFilename); if ( GetFileAttributesA(FileName) != -1 ) { v6->Release(); if ( v6->Alloc() ) { v7 = fopen(FileName, "rb"); result = 1; if ( !v7 ) return result; v9 = pDest; v6->bLoaded = 1; v202 = (int)v7; v201 = (const char *)1; *(int *)v9 = 1; fread(&DstBuf, 0x180u, (size_t)v201, (FILE *)v202); fseek(v7, Offset, 0); fread(&v6->blv, 0x88u, 1u, v7); fseek(v7, v207, 0); fread(&v6->uNumVertices, 1u, 4u, v7); fseek(v7, v208, 0); fread(v6->pVertices, 6u, v6->uNumVertices, v7); fseek(v7, v209, 0); fread(&v6->uNumFaces, 4u, 1u, v7); fseek(v7, v210, 0); fread(v6->pFaces, 0x60u, v6->uNumFaces, v7); v10 = pAllocator->AllocNamedChunk(v6->ptr_2AC, v6->blv.uFaces_fdata_Size, "L.FData"); v202 = (int)v7; v6->ptr_2AC = (unsigned __int16 *)v10; fread(v10, 1u, v6->blv.uFaces_fdata_Size, (FILE *)v202); v11 = v6->uNumFaces == 0; v12 = (v6->uNumFaces & 0x80000000u) != 0; pDest = 0; Argsa = 0; if ( !(v12 | v11) ) { v13 = 0; do { v6->pFaces[v13].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)v6->ptr_2AC]; v14 = (size_t)&v6->pFaces[v13]; i = v14; v15 = &pDest[2 * *(char *)(v14 + 93) + 2]; v16 = (int)&v15[(unsigned int)v6->ptr_2AC]; pDest = v15; *(int *)(i + 52) = v16; v17 = (size_t)&v6->pFaces[v13]; i = v17; v18 = &pDest[2 * *(char *)(v17 + 93) + 2]; v19 = (int)&v18[(unsigned int)v6->ptr_2AC]; pDest = v18; *(int *)(i + 56) = v19; i = (size_t)&v6->pFaces[v13]; v20 = v6->ptr_2AC; pDest += 2 * *(char *)(i + 93) + 2; *(int *)(i + 60) = (int)(char *)v20 + (int)pDest; i = (size_t)&v6->pFaces[v13]; v21 = v6->ptr_2AC; pDest += 2 * *(char *)(i + 93) + 2; *(int *)(i + 64) = (int)(char *)v21 + (int)pDest; i = (size_t)&v6->pFaces[v13]; ++v13; v22 = v6->ptr_2AC; pDest += 2 * *(char *)(i + 93) + 2; ++Argsa; *(int *)(i + 68) = (int)(char *)v22 + (int)pDest; pDest += 2 * *((char *)&v6->pFaces[v13] - 3) + 2; } while ( Argsa < (signed int)v6->uNumFaces ); } Argsb = 0; if ( (signed int)v6->uNumFaces > 0 ) { pDest = 0; do { fread(Dst, 1u, 0xAu, v7); if ( pDest[(unsigned int)v6->pFaces + 45] & 0x40 ) { v23 = pTextureFrameTable->FindTextureByName(Dst); v24 = pDest; *(short *)&pDest[(unsigned int)v6->pFaces + 74] = v23; v25 = *(short *)&v24[(unsigned int)v6->pFaces + 74]; if ( v25 ) { pTextureFrameTable->LoadAnimationSequenceAndPalettes(v25); } else { v26 = pBitmaps_LOD->LoadTexture(Dst); v27 = pDest; *(short *)&pDest[(unsigned int)v6->pFaces + 74] = v26; v27[(unsigned int)v6->pFaces + 45] &= 0xBFu; } } else { *(short *)&pDest[(unsigned int)v6->pFaces + 74] = pBitmaps_LOD->LoadTexture(Dst); } ++Argsb; pDest += 96; } while ( Argsb < (signed int)v6->uNumFaces ); } fseek(v7, v211, 0); fread(&v6->uNumFaceExtras, 4u, 1u, v7); fseek(v7, v212, 0); fread(v6->pFaceExtras, 0x24u, v6->uNumFaceExtras, v7); Argsc = 0; if ( (signed int)v6->uNumFaceExtras > 0 ) { pDest = 0; do { fread(Dst, 1u, 0xAu, v7); v28 = pBitmaps_LOD->LoadTexture(Dst); v29 = v6->pFaceExtras; v30 = pDest; ++Argsc; pDest += 36; *(unsigned __int16 *)((char *)&v29->uAdditionalBitmapID + (int)v30) = v28; } while ( Argsc < (signed int)v6->uNumFaceExtras ); } Argsd = 0; if ( (signed int)v6->uNumFaces > 0 ) { pDest = 0; do { v31 = (int)&v6->pFaceExtras[*(short *)&pDest[(unsigned int)v6->pFaces + 72]]; if ( *(short *)(v31 + 26) ) { if ( ((BLVFaceExtra *)v31)->HasEventint() ) pDest[(unsigned int)v6->pFaces + 46] |= 0x10u; else pDest[(unsigned int)v6->pFaces + 46] &= 0xEFu; } ++Argsd; pDest += 96; } while ( Argsd < (signed int)v6->uNumFaces ); } fseek(v7, v213, 0); fread(&v6->uNumSectors, 4u, 1u, v7); fseek(v7, v214, 0); fread(v6->pSectors, 0x74u, v6->uNumSectors, v7); v32 = pAllocator->AllocNamedChunk(v6->ptr_0002B0_sector_rdata, v6->blv.uSector_rdata_Size, "L.RData"); v202 = (int)v7; v6->ptr_0002B0_sector_rdata = (unsigned __int16 *)v32; fread(v32, 1u, v6->blv.uSector_rdata_Size, (FILE *)v202); v11 = v6->uNumSectors == 0; v12 = v6->uNumSectors < 0; pDest = 0; Argse = 0; if ( !(v12 | v11) ) { v33 = 0; do { v6->pSectors[v33].pFloors = (unsigned __int16 *)&pDest[(unsigned int)v6->ptr_0002B0_sector_rdata]; i = (size_t)&v6->pSectors[v33]; v34 = v6->ptr_0002B0_sector_rdata; pDest += 2 * *(short *)(i + 4); *(int *)(i + 16) = (int)(char *)v34 + (int)pDest; v35 = (size_t)&v6->pSectors[v33]; i = v35; v36 = &pDest[2 * *(short *)(v35 + 12)]; v37 = (int)&v36[(unsigned int)v6->ptr_0002B0_sector_rdata]; pDest = v36; *(int *)(i + 24) = v37; v38 = (size_t)&v6->pSectors[v33]; i = v38; v39 = &pDest[2 * *(short *)(v38 + 20)]; v40 = (int)&v39[(unsigned int)v6->ptr_0002B0_sector_rdata]; pDest = v39; *(int *)(i + 32) = v40; i = (size_t)&v6->pSectors[v33]; v41 = v6->ptr_0002B0_sector_rdata; pDest += 2 * *(short *)(i + 28); *(int *)(i + 40) = (int)(char *)v41 + (int)pDest; i = (size_t)&v6->pSectors[v33]; v42 = v6->ptr_0002B0_sector_rdata; pDest += 2 * *(short *)(i + 36); *(int *)(i + 48) = (int)(char *)v42 + (int)pDest; i = (size_t)&v6->pSectors[v33]; v43 = v6->ptr_0002B0_sector_rdata; pDest += 2 * *(short *)(i + 44); *(int *)(i + 64) = (int)(char *)v43 + (int)pDest; i = (size_t)&v6->pSectors[v33]; v44 = v6->ptr_0002B0_sector_rdata; pDest += 2 * *(short *)(i + 60); *(int *)(i + 72) = (int)(char *)v44 + (int)pDest; v45 = (size_t)&v6->pSectors[v33]; ++v33; i = v45; v46 = v6->ptr_0002B0_sector_rdata; pDest += 2 * *(short *)(v45 + 68); ++Argse; *(int *)(v45 + 80) = (int)(char *)v46 + (int)pDest; pDest += 2 * *((short *)&v6->pSectors[v33] - 20); } while ( Argse < v6->uNumSectors ); } v47 = pAllocator->AllocNamedChunk( v6->ptr_0002B8_sector_lrdata, v6->blv.uSector_lrdata_Size, "L.RLData"); v202 = (int)v7; v6->ptr_0002B8_sector_lrdata = (unsigned __int16 *)v47; fread(v47, 1u, v6->blv.uSector_lrdata_Size, (FILE *)v202); v11 = v6->uNumSectors == 0; v12 = v6->uNumSectors < 0; pDest = 0; Argsf = 0; if ( !(v12 | v11) ) { v48 = v6->pSectors; v49 = 0; for ( i = 0; ; v49 = i ) { v50 = v6->ptr_0002B8_sector_lrdata; i += 116; ++Argsf; *(BLVLightMM7 **)((char *)&v48->pLights + v49) = (BLVLightMM7 *)((char *)v50 + (int)pDest); v48 = v6->pSectors; pDest += 2 * *(__int16 *)((char *)&v48->uNumLights + v49); if ( Argsf >= v6->uNumSectors ) break; } } fseek(v7, v215, 0); fread(&v6->uNumDoors, 4u, 1u, v7); fseek(v7, v216, 0); fread(v6->pDoors, 0x50u, 0xC8u, v7); v51 = pAllocator->AllocNamedChunk(v6->ptr_0002B4_doors_ddata, v6->blv.uDoors_ddata_Size, "L.DData"); v202 = (int)v7; v6->ptr_0002B4_doors_ddata = (unsigned __int16 *)v51; fread(v51, 1u, v6->blv.uDoors_ddata_Size, (FILE *)v202); v11 = v6->uNumDoors == 0; v12 = v6->uNumDoors < 0; pDest = 0; Argsg = 0; if ( !(v12 | v11) ) { v52 = 0; do { v6->pDoors[v52].pVertexIDs = (unsigned __int16 *)&pDest[(unsigned int)v6->ptr_0002B4_doors_ddata]; i = (size_t)&v6->pDoors[v52]; v53 = v6->ptr_0002B4_doors_ddata; pDest += 2 * *(short *)(i + 68); *(int *)(i + 40) = (int)(char *)v53 + (int)pDest; v54 = (size_t)&v6->pDoors[v52]; i = v54; v55 = &pDest[2 * *(short *)(v54 + 70)]; v56 = (int)&v55[(unsigned int)v6->ptr_0002B4_doors_ddata]; pDest = v55; *(int *)(i + 44) = v56; v57 = (size_t)&v6->pDoors[v52]; i = v57; v58 = &pDest[2 * *(short *)(v57 + 72)]; v59 = (int)&v58[(unsigned int)v6->ptr_0002B4_doors_ddata]; pDest = v58; *(int *)(i + 48) = v59; i = (size_t)&v6->pDoors[v52]; v60 = v6->ptr_0002B4_doors_ddata; pDest += 2 * *(short *)(i + 70); *(int *)(i + 52) = (int)(char *)v60 + (int)pDest; i = (size_t)&v6->pDoors[v52]; v61 = v6->ptr_0002B4_doors_ddata; pDest += 2 * *(short *)(i + 70); *(int *)(i + 56) = (int)(char *)v61 + (int)pDest; i = (size_t)&v6->pDoors[v52]; v62 = v6->ptr_0002B4_doors_ddata; pDest += 2 * *(short *)(i + 74); *(int *)(i + 60) = (int)(char *)v62 + (int)pDest; i = (size_t)&v6->pDoors[v52]; v63 = v6->ptr_0002B4_doors_ddata; pDest += 2 * *(short *)(i + 74); *(int *)(i + 64) = (int)(char *)v63 + (int)pDest; ++Argsg; v64 = v6->pDoors[v52].uNumOffsets; ++v52; pDest += 2 * v64; } while ( Argsg < v6->uNumDoors ); } Argsh = 0; if ( v6->uNumDoors > 0 ) { v65 = v6->pDoors; pDest = 0; do { i = 0; v66 = &pDest[(int)v65]; if ( *(short *)&pDest[(int)v65 + 70] > 0 ) { do { v67 = *((int *)v66 + 10); a3 = 2 * i; v68 = *(short *)(v67 + 2 * i); v69 = v6->pFaces; ++i; v70 = (int)&v6->pFaceExtras[v69[v68].uFaceExtraID]; v71 = *((int *)v66 + 12); v72 = a3; v238 = (char *)v70; *(short *)(a3 + v71) = *(short *)(v70 + 20); *(__int16 *)(*(char **)((char *)&v6->pDoors->pDeltaVs + (unsigned int)pDest) + v72) = *((short *)v238 + 11); v65 = v6->pDoors; v66 = &pDest[(int)v65]; } while ( (signed int)i < *(short *)&pDest[(int)v65 + 70] ); } ++Argsh; pDest += 80; } while ( Argsh < v6->uNumDoors ); } fseek(v7, v217, 0); fread(&uNumLevelDecorations, 4u, 1u, v7); fseek(v7, v218, 0); fread(pLevelDecorations, 0x20u, uNumLevelDecorations, v7); Argsi = 0; if ( (signed int)uNumLevelDecorations > 0 ) { pDest = (char *)pLevelDecorations; do { fread(pName, 1u, 0x20u, v7); v73 = pDecorationList->GetDecorIdByName(pName); v74 = pDest; ++Argsi; pDest += 32; *(short *)v74 = v73; } while ( Argsi < (signed int)uNumLevelDecorations ); } fseek(v7, v219, 0); fread(&uNumLayingItems, 4u, 1u, v7); fseek(v7, v220, 0); fread(pLayingItems, 0x70u, uNumLayingItems, v7); if ( (signed int)uNumLayingItems > 0 ) { v75 = pLayingItems; pDest = (char *)uNumLayingItems; do { Argsj = 0; v76 = 48 * v75->stru_24.uItemID; v11 = pObjectList->uNumObjects == 0; v12 = (pObjectList->uNumObjects & 0x80000000u) != 0; LOWORD(v76) = *(unsigned __int16 *)((char *)&pItemsTable->pItems[0].uSpriteID + v76); i = v76; v75->uItemType = v76; if ( v12 | v11 ) { LABEL_50: v78 = 0; } else { for ( j = (int)&pObjectList->pObjects->uObjectID; (short)v76 != *(short *)j; j = a3 ) { ++Argsj; a3 = j + 56; if ( Argsj >= (signed int)pObjectList->uNumObjects ) goto LABEL_50; LOWORD(v76) = i; } v78 = Argsj; } v75->uObjectDescID = v78; ++v75; --pDest; } while ( pDest ); } fseek(v7, v221, 0); fread(&uNumActors, 4u, 1u, v7); fseek(v7, v222, 0); fread(pActors, 0x344u, uNumActors, v7); fseek(v7, v228, 0); fread(&uNumChests, 4u, 1u, v7); fseek(v7, v229, 0); fread(pChests, 0x14CCu, uNumChests, v7); fseek(v7, v224, 0); fread(&v6->uNumLights, 4u, 1u, v7); fseek(v7, v225, 0); fread(v6->pLights, 0x10u, v6->uNumLights, v7); fseek(v7, v226, 0); fread(&v6->uNumNodes, 4u, 1u, v7); fseek(v7, v227, 0); fread(v6->pNodes, 8u, v6->uNumNodes, v7); fseek(v7, v230, 0); fread(&v6->uNumSpawnPoints, 4u, 1u, v7); v79 = pAllocator->AllocNamedChunk(v6->pSpawnPoints, 24 * v6->uNumSpawnPoints, "Spawn"); v202 = 0; v6->pSpawnPoints = (SpawnPointMM7 *)v79; fseek(v7, v231, v202); fread(v6->pSpawnPoints, 0x18u, v6->uNumSpawnPoints, v7); fseek(v7, v232, 0); fread(&v6->dlv, 0x28u, 1u, v7); fseek(v7, v233, 0); fread(&stru_5E4C90, 1u, 0xC8u, v7); fseek(v7, v234, 0); fread(&v6->uLastVisitDay, 1u, 0x38u, v7); fseek(v7, v223, 0); v80 = (void **)&v6->pMapVertices; fread(*v80, 4u, 1u, v7); fread((char *)*v80 + 4, 0xCu, *(int *)*v80, v7); fclose(v7); goto LABEL_179; } return 4; } if ( !pGames_LOD->DoesContainerExist(pFilename) ) Abortf("Unable to find %s in Games.LOD", pFilename); v238 = pFilename - 4; v81 = strlen(pFilename); strcpy(&v238[v81], ".blv"); v82 = pGames_LOD->FindContainer(pFilename, 1); v11 = v6->bLoaded == 0; File = v82; if ( !v11 ) return 3; Release(); if ( !Alloc() ) return 4; header.pMagic[0] = 'm'; header.uVersion = 91969; header.pMagic[1] = 'v'; header.pMagic[2] = 'i'; header.pMagic[3] = 'i'; header.uCompressedSize = 0; header.uDecompressedSize = 0; fread(&header, 0x10u, 1u, File); if ( header.uVersion != 91969 || header.pMagic[0] != 'm' || header.pMagic[1] != 'v' || header.pMagic[2] != 'i' || header.pMagic[3] != 'i' ) { MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:792", 0); } v83 = header.uCompressedSize; pSource = header.uDecompressedSize; v84 = malloc(header.uDecompressedSize); v85 = v84; ptr = v84; if ( v83 <= pSource ) { if ( v83 == pSource ) { fread(v84, pSource, 1u, File); } else { *(int *)((char *)&uSourceLen + 1) = (int)malloc(v83); fread(*(void **)((char *)&uSourceLen + 1), v83, 1u, File); zlib::MemUnzip(v85, &pSource, *(const void **)((char *)&uSourceLen + 1), v83); free(*(void **)((char *)&uSourceLen + 1)); } } else { MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:803", 0); } strcpy(v6->pFilename, pFilename); v200 = 136; v199 = (size_t)v85; v198 = &v6->blv; v6->bLoaded = 1; memcpy(v198, (const void *)v199, v200); v86 = (char *)v85 + 136; pGameLoadingUI_ProgressBar->Progress(); memcpy(&v6->uNumVertices, v86, 4u); v86 = (char *)v86 + 4; pGameLoadingUI_ProgressBar->Progress(); v202 = 6 * v6->uNumVertices; v201 = (const char *)v86; v200 = (size_t)v6->pVertices; v245 = v202; memcpy((void *)v200, v86, v202); v87 = (char *)v86 + v245; pGameLoadingUI_ProgressBar->Progress(); memcpy(&v6->uNumFaces, v87, 4u); v87 = (char *)v87 + 4; pGameLoadingUI_ProgressBar->Progress(); v202 = 96 * v6->uNumFaces; v201 = (const char *)v87; v200 = (size_t)v6->pFaces; v245 = v202; memcpy((void *)v200, v87, v202); v88 = (char *)v87 + v245; v202 = (int)"L.FData"; v201 = (const char *)v6->blv.uFaces_fdata_Size; v200 = (size_t)v6->ptr_2AC; v89 = pAllocator->AllocNamedChunk((const void *)v200, (unsigned int)v201, "L.FData"); v90 = v6->blv.uFaces_fdata_Size; v6->ptr_2AC = (unsigned __int16 *)v89; v245 = v90; memcpy(v89, v88, v90); v91 = (char *)v88 + v245; v92 = 0; v11 = v6->uNumFaces == 0; v12 = (v6->uNumFaces & 0x80000000u) != 0; v244 = 0; v245 = 0; if ( !(v12 | v11) ) { do { v6->pFaces[v92].pVertexIDs = (unsigned __int16 *)((char *)v244 + (unsigned int)v6->ptr_2AC); v93 = &v6->pFaces[v92]; Src = v93; v94 = (BLVSector *)((char *)v244 + 2 * v93->uNumVertices + 2); v95 = (unsigned __int16 *)((char *)v94 + (unsigned int)v6->ptr_2AC); v244 = v94; Src->pXInterceptDisplacements = v95; v96 = (int)&v6->pFaces[v92]; Src = (BLVFace *)v96; v97 = (BLVSector *)((char *)v244 + 2 * *(char *)(v96 + 93) + 2); v98 = (unsigned __int16 *)((char *)v97 + (unsigned int)v6->ptr_2AC); v244 = v97; Src->pYInterceptDisplacements = v98; Src = &v6->pFaces[v92]; v99 = v6->ptr_2AC; v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); Src->pZInterceptDisplacements = (unsigned __int16 *)((char *)v99 + (int)v244); Src = &v6->pFaces[v92]; v100 = v6->ptr_2AC; v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); Src->pVertexUIDs = (unsigned __int16 *)((char *)v100 + (int)v244); Src = &v6->pFaces[v92]; ++v92; v101 = v6->ptr_2AC; v244 = (BLVSector *)((char *)v244 + 2 * Src->uNumVertices + 2); ++v245; Src->pVertexVIDs = (unsigned __int16 *)((char *)v101 + (int)v244); v244 = (BLVSector *)((char *)v244 + 2 * *((char *)&v6->pFaces[v92] - 3) + 2); } while ( v245 < (signed int)v6->uNumFaces ); } v11 = v6->uNumFaces == 0; v12 = (v6->uNumFaces & 0x80000000u) != 0; v245 = 0; if ( !(v12 | v11) ) { v244 = 0; do { memcpy(Dst, v91, 0xAu); v91 = (char *)v91 + 10; if ( *((char *)&v244->field_2C + (unsigned int)v6->pFaces + 1) & 0x40 ) { v102 = pTextureFrameTable->FindTextureByName(Dst); v103 = v244; *(short *)((char *)&v244->pDecorationIDs + (unsigned int)v6->pFaces + 2) = v102; v104 = *(short *)((char *)&v103->pDecorationIDs + (unsigned int)v6->pFaces + 2); if ( v104 ) { pTextureFrameTable->LoadAnimationSequenceAndPalettes(v104); } else { v105 = pBitmaps_LOD->LoadTexture(Dst); v106 = v244; *(short *)((char *)&v244->pDecorationIDs + (unsigned int)v6->pFaces + 2) = v105; *((char *)&v106->field_2C + (unsigned int)v6->pFaces + 1) &= 0xBFu; } } else { *(short *)((char *)&v244->pDecorationIDs + (unsigned int)v6->pFaces + 2) = pBitmaps_LOD->LoadTexture(Dst); } ++v245; v244 = (BLVSector *)((char *)v244 + 96); } while ( v245 < (signed int)v6->uNumFaces ); } pGameLoadingUI_ProgressBar->Progress(); memcpy(&v6->uNumFaceExtras, v91, 4u); v107 = (char *)v91 + 4; pGameLoadingUI_ProgressBar->Progress(); v202 = 36 * v6->uNumFaceExtras; v201 = (const char *)v107; v200 = (size_t)v6->pFaceExtras; v245 = v202; memcpy((void *)v200, v107, v202); v108 = (char *)v107 + v245; v245 = 0; if ( (signed int)v6->uNumFaceExtras > 0 ) { *(int *)((char *)&uSourceLen + 1) = 0; do { memcpy(Dst, v108, 0xAu); v108 = (char *)v108 + 10; if ( !_strcmpi(Dst, nullstring) ) *(unsigned __int16 *)((char *)&v6->pFaceExtras->uAdditionalBitmapID + *(int *)((char *)&uSourceLen + 1)) = -1; v109 = pBitmaps_LOD->LoadTexture(Dst); v110 = v6->pFaceExtras; v111 = *(int *)((char *)&uSourceLen + 1); ++v245; *(int *)((char *)&uSourceLen + 1) += 36; *(unsigned __int16 *)((char *)&v110->uAdditionalBitmapID + v111) = v109; } while ( v245 < (signed int)v6->uNumFaceExtras ); } v11 = v6->uNumFaces == 0; v12 = (v6->uNumFaces & 0x80000000u) != 0; v245 = 0; if ( !(v12 | v11) ) { v244 = 0; do { v112 = &v6->pFaceExtras[*(short *)((char *)&v244->pDecorationIDs + (unsigned int)v6->pFaces)]; if ( v112->uEventID ) { if ( v112->HasEventint() ) *((char *)&v244->uNumNonBSPFaces + (unsigned int)v6->pFaces) |= 0x10u; else *((char *)&v244->uNumNonBSPFaces + (unsigned int)v6->pFaces) &= 0xEFu; } ++v245; v244 = (BLVSector *)((char *)v244 + 96); } while ( v245 < (signed int)v6->uNumFaces ); } pGameLoadingUI_ProgressBar->Progress(); memcpy(&v6->uNumSectors, v108, 4u); v113 = (char *)v108 + 4; pGameLoadingUI_ProgressBar->Progress(); v202 = 116 * v6->uNumSectors; v201 = (const char *)v113; v200 = (size_t)v6->pSectors; v245 = v202; memcpy((void *)v200, v113, v202); v114 = (char *)v113 + v245; v202 = (int)"L.RData"; v201 = (const char *)v6->blv.uSector_rdata_Size; v200 = (size_t)v6->ptr_0002B0_sector_rdata; v115 = pAllocator->AllocNamedChunk((const void *)v200, (unsigned int)v201, "L.RData"); v116 = v6->blv.uSector_rdata_Size; v6->ptr_0002B0_sector_rdata = (unsigned __int16 *)v115; v245 = v116; memcpy(v115, v114, v116); v117 = (char *)v114 + v245; v118 = 0; v11 = v6->uNumSectors == 0; v12 = v6->uNumSectors < 0; Src = 0; v245 = 0; if ( !(v12 | v11) ) { do { v6->pSectors[v118].pFloors = (unsigned __int16 *)((char *)Src + (unsigned int)v6->ptr_0002B0_sector_rdata); v244 = &v6->pSectors[v118]; v119 = v6->ptr_0002B0_sector_rdata; Src = (BLVFace *)((char *)Src + 2 * v244->field_4); v244->pWalls = (unsigned __int16 *)((char *)v119 + (int)Src); v120 = (int)&v6->pSectors[v118]; v244 = (BLVSector *)v120; v121 = (BLVFace *)((char *)Src + 2 * *(short *)(v120 + 12)); v122 = (unsigned __int16 *)((char *)v121 + (unsigned int)v6->ptr_0002B0_sector_rdata); Src = v121; v244->pCeilings = v122; v123 = (int)&v6->pSectors[v118]; v244 = (BLVSector *)v123; v124 = (BLVFace *)((char *)Src + 2 * *(short *)(v123 + 20)); v125 = (unsigned __int16 *)((char *)v124 + (unsigned int)v6->ptr_0002B0_sector_rdata); Src = v124; v244->pFluids = v125; v244 = &v6->pSectors[v118]; v126 = v6->ptr_0002B0_sector_rdata; Src = (BLVFace *)((char *)Src + 2 * v244->field_1C); v244->pPortals = (unsigned __int16 *)((char *)v126 + (int)Src); v244 = &v6->pSectors[v118]; v127 = v6->ptr_0002B0_sector_rdata; Src = (BLVFace *)((char *)Src + 2 * v244->uNumPortals); v244->pFaceIDs = (unsigned __int16 *)((char *)v127 + (int)Src); v244 = &v6->pSectors[v118]; v128 = v6->ptr_0002B0_sector_rdata; Src = (BLVFace *)((char *)Src + 2 * v244->field_2C); v244->pCogs = (unsigned __int16 *)((char *)v128 + (int)Src); v244 = &v6->pSectors[v118]; v129 = v6->ptr_0002B0_sector_rdata; Src = (BLVFace *)((char *)Src + 2 * v244->field_3C); v244->pDecorationIDs = (unsigned __int16 *)((char *)v129 + (int)Src); v130 = (int)&v6->pSectors[v118]; ++v118; v244 = (BLVSector *)v130; v131 = v6->ptr_0002B0_sector_rdata; Src = (BLVFace *)((char *)Src + 2 * *(short *)(v130 + 68)); ++v245; *(int *)(v130 + 80) = (int)(char *)v131 + (int)Src; Src = (BLVFace *)((char *)Src + 2 * *((short *)&v6->pSectors[v118] - 20)); } while ( v245 < v6->uNumSectors ); } v202 = (int)"L.RLData"; v201 = (const char *)v6->blv.uSector_lrdata_Size; v200 = (size_t)v6->ptr_0002B8_sector_lrdata; v132 = pAllocator->AllocNamedChunk((const void *)v200, (unsigned int)v201, "L.RLData"); v133 = v6->blv.uSector_lrdata_Size; v6->ptr_0002B8_sector_lrdata = (unsigned __int16 *)v132; v245 = v133; memcpy(v132, v117, v133); v134 = (char *)v117 + v245; pGameLoadingUI_ProgressBar->Progress(); v11 = v6->uNumSectors == 0; v12 = v6->uNumSectors < 0; Src = 0; v245 = 0; if ( !(v12 | v11) ) { v135 = v6->pSectors; v136 = 0; for ( File = 0; ; v136 = File ) { v137 = v6->ptr_0002B8_sector_lrdata; File = (FILE *)((char *)File + 116); ++v245; *(int *)((char *)&v136[2]._bufsiz + (int)v135) = (int)((char *)v137 + (int)Src); v135 = v6->pSectors; Src = (BLVFace *)((char *)Src + 2 * *(short *)((char *)&v136[2]._charbuf + (int)v135)); if ( v245 >= v6->uNumSectors ) break; } } pGameLoadingUI_ProgressBar->Progress(); memcpy(&v6->uNumDoors, v134, 4u); v138 = (char *)v134 + 4; pGameLoadingUI_ProgressBar->Progress(); memcpy(&uNumLevelDecorations, v138, 4u); v138 = (char *)v138 + 4; pGameLoadingUI_ProgressBar->Progress(); v245 = 32 * uNumLevelDecorations; memcpy(pLevelDecorations, v138, 32 * uNumLevelDecorations); v139 = (char *)v138 + v245; v245 = 0; if ( (signed int)uNumLevelDecorations > 0 ) { File = (FILE *)pLevelDecorations; do { memcpy(pName, v139, 0x20u); v139 = (char *)v139 + 32; v140 = pDecorationList->GetDecorIdByName(pName); v141 = File; ++v245; ++File; LOWORD(v141->_ptr) = v140; } while ( v245 < (signed int)uNumLevelDecorations ); } pGameLoadingUI_ProgressBar->Progress(); memcpy(&v6->uNumLights, v139, 4u); v142 = (char *)v139 + 4; pGameLoadingUI_ProgressBar->Progress(); v202 = 16 * v6->uNumLights; v201 = (const char *)v142; v200 = (size_t)v6->pLights; v245 = v202; memcpy((void *)v200, v142, v202); v143 = (char *)v142 + v245; pGameLoadingUI_ProgressBar->Progress(); memcpy(&v6->uNumNodes, v143, 4u); v143 = (char *)v143 + 4; pGameLoadingUI_ProgressBar->Progress(); v202 = 8 * v6->uNumNodes; v201 = (const char *)v143; v200 = (size_t)v6->pNodes; v245 = v202; memcpy((void *)v200, v143, v202); v144 = (char *)v143 + v245; pGameLoadingUI_ProgressBar->Progress(); memcpy(&v6->uNumSpawnPoints, v144, 4u); v144 = (char *)v144 + 4; pGameLoadingUI_ProgressBar->Progress(); v145 = v6->uNumSpawnPoints; v202 = (int)"Spawn"; v201 = (const char *)(24 * v145); v200 = (size_t)v6->pSpawnPoints; v146 = pAllocator->AllocNamedChunk((const void *)v200, 24 * v145, "Spawn"); v147 = v6->uNumSpawnPoints; v6->pSpawnPoints = (SpawnPointMM7 *)v146; v245 = 24 * v147; memcpy(v146, v144, 24 * v147); v148 = (int)((char *)v144 + v245); pGameLoadingUI_ProgressBar->Progress(); v202 = 4; v201 = (const char *)v148; v200 = (size_t)v6->pMapVertices; memcpy((void *)v200, (const void *)v148, 4u); v149 = v6->pMapVertices; v199 = 12 * *v149; memcpy(v149 + 1, (const void *)(v148 + 4), v199); free(ptr); v202 = (int)".dlv"; v150 = strlen(pFilename); strcpy(&v238[v150], (const char *)v202); v245 = (int)pNew_LOD->FindContainer(pFilename, 1); fread(&header, 0x10u, 1u, (FILE *)v245); v244 = 0; if ( header.uVersion != 91969 || header.pMagic[0] != 'm' || header.pMagic[1] != 'v' || header.pMagic[2] != 'i' || header.pMagic[3] != 'i' ) { MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1090", 0); v244 = (BLVSector *)1; } v151 = header.uCompressedSize; Count = header.uDecompressedSize; Src = 0; File = 0; if ( !v244 ) { Src = (BLVFace *)malloc(header.uDecompressedSize); File = (FILE *)Src; if ( v151 <= Count ) { if ( v151 == Count ) { fread(Src, 1u, Count, (FILE *)v245); } else { *(int *)((char *)&uSourceLen + 1) = (int)malloc(v151); fread(*(void **)((char *)&uSourceLen + 1), v151, 1u, (FILE *)v245); zlib::MemUnzip(Src, &Count, *(const void **)((char *)&uSourceLen + 1), v151); free(*(void **)((char *)&uSourceLen + 1)); } } else { MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1108", 0); } memcpy(&v6->dlv, Src, 0x28u); Src = (BLVFace *)((char *)Src + 40); } v152 = v6->dlv.uNumFacesInBModels; if ( v152 ) { v153 = v6->dlv.uNumDecorations; if ( v153 ) { if ( v152 != pIndoor->uNumFaces || v153 != uNumLevelDecorations ) v244 = (BLVSector *)1; } } if ( BYTE1(dword_6BE364_game_settings_1) & 0x20 ) i = 29030400; *(int *)((char *)&uSourceLen + 1) = 0; if ( a3 - v6->dlv.uLastRepawnDay >= i && _strcmpi(pCurrentMapName, "d29.dlv") ) *(int *)((char *)&uSourceLen + 1) = 1; v154 = 875; if ( v244 ) { memset(v203, 0, 0x36Bu); goto LABEL_132; } if ( *(int *)((char *)&uSourceLen + 1) || !v6->dlv.uLastRepawnDay ) { memcpy(v203, Src, 0x36Bu); LABEL_132: free(File); v11 = v244 == (BLVSector *)1; v6->dlv.uLastRepawnDay = a3; if ( v11 ) ++v6->dlv.uNumRespawns; v202 = 0; v201 = pFilename; *(int *)pDest = 1; v245 = (int)pGames_LOD->FindContainer(v201, v202); fread(&header, 0x10u, 1u, (FILE *)v245); v155 = header.uCompressedSize; Count = header.uDecompressedSize; Src = (BLVFace *)malloc(header.uDecompressedSize); File = (FILE *)Src; if ( v155 <= Count ) { if ( v155 == Count ) { fread(Src, 1u, Count, (FILE *)v245); } else { *(int *)((char *)&uSourceLen + 1) = (int)malloc(v155); fread(*(void **)((char *)&uSourceLen + 1), v155, 1u, (FILE *)v245); zlib::MemUnzip(Src, &Count, *(const void **)((char *)&uSourceLen + 1), v155); free(*(void **)((char *)&uSourceLen + 1)); } } else { MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0); } Src = (BLVFace *)((char *)Src + 40); v154 = 875; goto LABEL_140; } *(int *)pDest = 0; LABEL_140: v202 = (int)".blv"; v156 = strlen(pFilename); strcpy(&v238[v156], (const char *)v202); memcpy(v6->_visible_outlines, Src, v154); Src = (BLVFace *)((char *)Src + v154); if ( *(int *)pDest ) memcpy(v6->_visible_outlines, v203, v154); v157 = 0; if ( (signed int)*pIndoor->pMapVertices > 0 ) { Argsk = 0; do { if ( (unsigned __int8)(1 << (7 - v157 % 8)) & v6->_visible_outlines[v157 / 8] ) BYTE2(v6->pMapVertices[Argsk + 3]) |= 1u; Argsk += 3; ++v157; } while ( v157 < (signed int)*pIndoor->pMapVertices ); } v245 = 0; if ( (signed int)v6->uNumFaces > 0 ) { v158 = 0; do { v200 = (size_t)&v6->pFaces[v158].uAttributes; memcpy((void *)v200, Src, 4u); v159 = v6->pFaces; v160 = v6->pFaceExtras; Src = (BLVFace *)((char *)Src + 4); v161 = &v160[v159[v158].uFaceExtraID]; if ( v161->uEventID ) { if ( v161->HasEventint() ) BYTE2(v6->pFaces[v158].uAttributes) |= 0x10u; else BYTE2(v6->pFaces[v158].uAttributes) &= 0xEFu; } ++v245; ++v158; } while ( v245 < (signed int)v6->uNumFaces ); } pGameLoadingUI_ProgressBar->Progress(); v162 = 0; if ( (signed int)uNumLevelDecorations > 0 ) { Argsl = &pLevelDecorations[0].field_2; do { memcpy(Argsl, Src, 2u); Src = (BLVFace *)((char *)Src + 2); Argsl = (char *)Argsl + 32; ++v162; } while ( v162 < (signed int)uNumLevelDecorations ); } pGameLoadingUI_ProgressBar->Progress(); memcpy(&uNumActors, Src, 4u); Src = (BLVFace *)((char *)Src + 4); pGameLoadingUI_ProgressBar->Progress(); v163 = 836 * uNumActors; memcpy(pActors, Src, 836 * uNumActors); Src = (BLVFace *)((char *)Src + v163); pGameLoadingUI_ProgressBar->Progress(); memcpy(&uNumLayingItems, Src, 4u); Src = (BLVFace *)((char *)Src + 4); pGameLoadingUI_ProgressBar->Progress(); v164 = 112 * uNumLayingItems; memcpy(pLayingItems, Src, 112 * uNumLayingItems); Src = (BLVFace *)((char *)Src + v164); if ( (signed int)uNumLayingItems > 0 ) { v165 = pObjectList->uNumObjects; v166 = (char *)&pLayingItems[0].stru_24; i = uNumLayingItems; do { if ( *(int *)v166 && !(*(v166 - 9) & 1) ) { Argsm = 0; v167 = pItemsTable->pItems[*(int *)v166].uSpriteID; *((short *)v166 - 18) = v167; if ( (signed int)v165 <= 0 ) { LABEL_165: v168 = 0; } else { pDest = (char *)&pObjectList->pObjects->uObjectID; while ( v167 != *(short *)pDest ) { ++Argsm; pDest += 56; if ( Argsm >= (signed int)v165 ) goto LABEL_165; } v168 = Argsm; } *((short *)v166 - 17) = v168; } v166 += 112; --i; } while ( i ); } pGameLoadingUI_ProgressBar->Progress(); memcpy(&uNumChests, Src, 4u); Src = (BLVFace *)((char *)Src + 4); pGameLoadingUI_ProgressBar->Progress(); v169 = 5324 * uNumChests; memcpy(pChests, Src, 5324 * uNumChests); Src = (BLVFace *)((char *)Src + v169); pGameLoadingUI_ProgressBar->Progress(); v202 = 16000; v201 = (const char *)Src; v200 = (size_t)v6->pDoors; memcpy((void *)v200, Src, 0x3E80u); Src = (BLVFace *)((char *)Src + 16000); v202 = (int)"L.DData"; v201 = (const char *)v6->blv.uDoors_ddata_Size; v200 = (size_t)v6->ptr_0002B4_doors_ddata; v170 = pAllocator->AllocNamedChunk((const void *)v200, (unsigned int)v201, "L.DData"); v171 = v6->blv.uDoors_ddata_Size; v6->ptr_0002B4_doors_ddata = (unsigned __int16 *)v170; memcpy(v170, Src, v171); Src = (BLVFace *)((char *)Src + v171); v172 = 0; v11 = v6->uNumDoors == 0; v12 = v6->uNumDoors < 0; v245 = 0; if ( !(v12 | v11) ) { v173 = v6->pDoors; for ( k = 0; ; v172 = v188 + 2 * *((short *)&v173[k] - 3) ) { v173[k].pVertexIDs = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v172); v175 = &v6->pDoors[k]; v176 = v172 + 2 * v175->uNumVertices; v175->pFaceIDs = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v176); v177 = &v6->pDoors[k]; v178 = v176 + 2 * v177->uNumFaces; v177->pSectorIDs = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v178); v179 = &v6->pDoors[k]; v180 = v178 + 2 * v179->field_48; v179->pDeltaUs = (__int16 *)((char *)v6->ptr_0002B4_doors_ddata + v180); v181 = &v6->pDoors[k]; v182 = v180 + 2 * v181->uNumFaces; v181->pDeltaVs = (__int16 *)((char *)v6->ptr_0002B4_doors_ddata + v182); v183 = &v6->pDoors[k]; v184 = v182 + 2 * v183->uNumFaces; v183->pXOffsets = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v184); v185 = &v6->pDoors[k]; v186 = v184 + 2 * v185->uNumOffsets; v185->pYOffsets = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v186); v187 = &v6->pDoors[k]; ++k; v188 = v186 + 2 * v187->uNumOffsets; v189 = (unsigned __int16 *)((char *)v6->ptr_0002B4_doors_ddata + v188); ++v245; v187->pZOffsets = v189; v173 = v6->pDoors; if ( v245 >= v6->uNumDoors ) break; } } v190 = 0; v11 = v6->uNumDoors == 0; v12 = v6->uNumDoors < 0; v245 = 0; if ( !(v12 | v11) ) { v191 = v6->pDoors; pDest = 0; do { Argsn = 0; for ( l = (BLVDoor *)&v190[(int)v191]; Argsn < *(short *)&v190[(int)v191 + 70]; l = (BLVDoor *)&v190[(int)v191] ) { v193 = Argsn; v194 = l->pFaceIDs[Argsn++]; v195 = &v6->pFaceExtras[v6->pFaces[v194].uFaceExtraID]; l->pDeltaUs[v193] = v195->sTextureDeltaU; v190 = pDest; *(short *)(v193 * 2 + *(int *)&pDest[(unsigned int)v6->pDoors + 52]) = v195->sTextureDeltaV; v191 = v6->pDoors; } ++v245; v190 += 80; pDest = v190; } while ( v245 < v6->uNumDoors ); } pGameLoadingUI_ProgressBar->Progress(); v196 = Src; memcpy(&stru_5E4C90, Src, 0xC8u); pGameLoadingUI_ProgressBar->Progress(); memcpy(&v6->uLastVisitDay, &v196[2].pFacePlane.vNormal.z, 0x38u); free(File); v5 = 0; LABEL_179: pSoundList->_4A9A67(64, v5); pSoundList->_4A9A67(103, v5); pSoundList->_4A9A67(63, v5); pSoundList->_4A9A67(102, v5); pSoundList->_4A9A67(50, v5); pSoundList->_4A9A67(89, v5); return 0; } // 6807E0: using guessed type int _6807E0_num_decorations_6807B8; // 6BE364: using guessed type int dword_6BE364_game_settings_1; //----- (0049AC17) -------------------------------------------------------- int IndoorLocation::GetSector(int sX, int sY, int sZ) { int v4; // esi@1 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 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 signed int v32; // edi@27 signed __int64 v33; // qtt@27 Vec3_short_ *v34; // edx@27 int v35; // edx@32 int v37; // edi@38 int v38; // ebx@40 int v39; // eax@41 BLVFace *v40; // esi@42 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 bool v50; // [sp+ECh] [bp-28h]@19 int v51; // [sp+F0h] [bp-24h]@9 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 int v59; // [sp+110h] [bp-4h]@16 v4 = 0; v7 = __OFSUB__(this->uNumSectors, 1); v5 = this->uNumSectors == 1; v6 = this->uNumSectors - 1 < 0; v55 = 0; v43[0] = 0; v56 = 1; if ( (unsigned __int8)(v6 ^ v7) | v5 ) return 0; v52 = 116; do { v8 = &this->pSectors[v52 / 0x74]; if ( v8->pBounding.x1 <= sX ) { if ( v8->pBounding.x2 >= sX ) { if ( v8->pBounding.y1 <= sY ) { 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]; 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 ( !v5 ) { 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; } } } v11 = v48 + 1; v12 = v53 + 2; v7 = __OFSUB__(v48 + 1, v51); v6 = v48++ + 1 - v51 < 0; v53 += 2; } while ( v6 ^ v7 ); v4 = v43[0]; } } } } } } } ++v56; v52 += 116; } while ( v56 < this->uNumSectors ); if ( v55 == 1 ) return this->pFaces[v4].uSectorID; v37 = 0; if ( !v55 ) return 0; v38 = 0; v53 = 0xFFFFFFu; if ( v55 > 0 ) { v39 = sY; while ( 1 ) { v40 = &this->pFaces[v43[v37]]; v41 = v40->uPolygonType; if ( v41 == 3 ) break; if ( v41 == 4 ) { v51 = v40->zCalc1; v57 = (unsigned __int64)(v51 * (signed __int64)(sX << 16)) >> 16; v56 = sY << 16; v51 = v40->zCalc2; v56 = (unsigned __int64)(v51 * (signed __int64)(sY << 16)) >> 16; v42 = (v56 + v40->zCalc3 + v57 + 32768) >> 16; goto LABEL_46; } LABEL_47: if ( v39 >= 0 ) { if ( v39 < v53 ) { v38 = v40->uSectorID; v53 = v39; } } ++v37; if ( v37 >= v55 ) return v38; } v42 = this->pVertices[*v40->pVertexIDs].z; LABEL_46: v39 = sZ - v42; goto LABEL_47; } return v38; } // 49AC17: using guessed type int var_108[50]; //----- (00498A41) -------------------------------------------------------- char BLVFace::_get_normals(Vec3_int_ *a2, Vec3_int_ *a3) { BLVFace *v3; // ebx@1 int v4; // eax@1 signed __int64 v5; // qax@2 double v6; // st7@8 Vec3_float_ a1; // [sp+Ch] [bp-Ch]@8 v3 = this; LOBYTE(v4) = this->uPolygonType; if ( (char)v4 == POLYGON_VerticalWall ) { a2->x = -this->pFacePlane_old.vNormal.y; LODWORD(v5) = this->pFacePlane_old.vNormal.x; LABEL_9: a2->y = v5; v4 = 0; a2->z = 0; a3->y = 0; a3->z = 0xFFFF0000u; LABEL_11: a3->x = v4; goto LABEL_12; } if ( (char)v4 == POLYGON_Floor || (char)v4 == POLYGON_Ceiling ) { LABEL_10: v4 = 0; a2->x = 0x10000u; a2->z = 0; a2->y = 0; a3->y = 0xFFFF0000u; a3->z = 0; goto LABEL_11; } if ( (char)v4 == POLYGON_InBetweenFloorAndWall || (char)v4 == POLYGON_InBetweenCeilingAndWall ) { if ( abs(this->pFacePlane_old.vNormal.z) < 46441 ) { a1.x = (double)-v3->pFacePlane_old.vNormal.y; a1.y = (double)v3->pFacePlane_old.vNormal.x; a1.z = 0.0; a1.Normalize(); v6 = a1.y * 65536.0; a2->x = (signed __int64)(a1.x * 65536.0); v5 = (signed __int64)v6; goto LABEL_9; } goto LABEL_10; } LABEL_12: if ( BYTE2(v3->uAttributes) & 0x80 ) { a2->x = -a2->x; a2->y = -a2->y; a2->z = -a2->z; } if ( BYTE3(v3->uAttributes) & 1 ) { a3->x = -a3->x; a3->y = -a3->y; a3->z = -a3->z; } return v4; } //----- (0044C23B) -------------------------------------------------------- int BLVFaceExtra::HasEventint() { signed int v1; // eax@1 Event *v2; // esi@2 signed int result; // eax@5 signed int v4; // eax@6 v1 = 0; if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 ) goto LABEL_5; v2 = pLevelEVT_Events; while ( v2->uEventID != this->uEventID ) { ++v1; ++v2; if ( v1 >= (signed int)(uLevelEVT_NumEvents - 1) ) goto LABEL_5; } v4 = v1; if ( pLevelEVT[pLevelEVT_Events[v4 + 1].uEventOffsetInEVT + 4] != 1 || pLevelEVT[pLevelEVT_Events[v4].uEventOffsetInEVT + 4] != 4 ) LABEL_5: result = 0; else result = 1; return result; }