Mercurial > mm7
diff mm7_4.cpp @ 1391:cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
stru148 -> struct Polygon
author | Nomad |
---|---|
date | Thu, 18 Jul 2013 14:42:54 +0200 |
parents | 613c77e51e38 |
children | 28f87f5234a1 |
line wrap: on
line diff
--- a/mm7_4.cpp Thu Jul 18 04:08:20 2013 +0200 +++ b/mm7_4.cpp Thu Jul 18 14:42:54 2013 +0200 @@ -12,8 +12,6 @@ #include "OutdoorCamera.h" #include "Mouse.h" #include "stru6.h" -#include "stru11.h" -#include "stru12.h" #include "LightmapBuilder.h" #include "MM7.h" @@ -529,252 +527,6 @@ } } -//----- (00486F92) -------------------------------------------------------- -void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() -{ - Span *v0; // ebx@1 - int v1; // eax@2 - Edge *v2; // ecx@3 - Edge *v3; // edx@3 - Edge *v4; // esi@6 - Edge *v5; // eax@7 - Edge *v6; // ecx@8 - Surf *v7; // esi@11 - double v8; // st7@13 - Surf *v9; // edi@13 - double v10; // st6@13 - double v11; // st7@14 - signed __int64 v12; // qax@14 - stru148 *v13; // eax@15 - Span *v14; // ecx@17 - double v15; // st7@28 - signed __int64 v16; // qax@28 - stru148 *v17; // eax@29 - Span *v18; // ecx@31 - Edge *i; // eax@40 - Edge *v20; // ecx@43 - Edge *v21; // esi@44 - double v22; // st7@45 - Edge *v23; // edx@48 - unsigned int v24; // [sp+10h] [bp-10h]@2 - float v25; // [sp+14h] [bp-Ch]@3 - Edge *v26; // [sp+18h] [bp-8h]@8 - unsigned int v27; // [sp+1Ch] [bp-4h]@1 - - v0 = pSpans; - stru_80C9D8.pSurf = &stru_80C980; - stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; - stru_80C9A4.pSurf = &stru_80C980; - stru_80C980.pPrev = &stru_80C980; - stru_80C980.pNext = &stru_80C980; - stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; - stru_80C980.field_8 = 0.0; - stru_80C980.field_4 = 0.0; - stru_80C9D8.pNext = &stru_80C9A4; - stru_80C9D8.pPrev = 0; - stru_80C9D8.field_8 = 1; - stru_80C9A4.pNext = 0; - stru_80C9A4.pPrev = &stru_80C9D8; - stru_80C9A4.field_8 = 0; - LODWORD(stru_80C980.field_0) = 0xC97423F0u; - v27 = pViewport->uViewportTL_Y; - if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) - { -LABEL_51: - v0->field_8 = -1; - } - else - { - v1 = 52 * pViewport->uViewportTL_Y; - v24 = 52 * pViewport->uViewportTL_Y; - while ( 1 ) - { - v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); - v3 = &stru_80C9D8; - v25 = (double)(signed int)v27; - if ( v2 != &defaultEdge ) - { - do - { - while ( 1 ) - { - v4 = v3->pNext; - if ( v2->field_0 <= (double)v4->field_0 ) - break; - v3 = v3->pNext; - } - v5 = v2->pNext; - v2->pNext = v4; - v2->pPrev = v3; - v3->pNext->pPrev = v2; - v3->pNext = v2; - v3 = v2; - v2 = v5; - } - while ( v5 != &defaultEdge ); - } - v6 = stru_80C9D8.pNext; - stru_80C980.field_20 = 0; - stru_80C980.field_22 = 1; - v26 = stru_80C9D8.pNext; - if ( stru_80C9D8.pNext ) - { - while ( 1 ) - { - v7 = v6->pSurf; - if ( v6->field_8 ) - { - ++v7->field_22; - if ( v7->field_22 == 1 ) - { - v8 = v6->field_0 + 2.0; - v9 = stru_80C980.pNext; - v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; - if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 - + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 - + stru_80C980.pNext->field_0 ) - { - do - v9 = v9->pNext; - while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); - v7->pNext = v9; - v7->pPrev = v9->pPrev; - v9->pPrev->pNext = v7; - v9->pPrev = v7; - } - else - { - v11 = v6->field_0 + 0.5; - v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); - v0->field_C = v12; - if ( (signed __int16)v12 > 0 ) - { - v0->field_A = v27; - v0->field_8 = v9->field_20; - v13 = v9->pParent; - v0->pParent = v13; - if ( v13 ) - { - if ( v13->prolly_head ) - { - v14 = v13->prolly_tail; - if ( !v14 ) - return; - v14->pNext = v0; - } - else - { - v13->prolly_head = v0; - } - v13->prolly_tail = v0; - } - if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) - return; - ++v0; - ++pOutdoorCamera->uNumSpans; - } - v6 = v26; - v7->field_20 = (signed __int64)v11; - v7->pNext = v9; - v9->pPrev = v7; - stru_80C980.pNext = v7; - v7->pPrev = &stru_80C980; - } - } - } - else - { - --v7->field_22; - if ( !v7->field_22 ) - { - if ( stru_80C980.pNext == v7 ) - { - v15 = v6->field_0 + 0.5; - v16 = (signed __int64)(v15 - (double)v7->field_20); - v0->field_C = v16; - if ( (signed __int16)v16 > 0 ) - { - v0->field_A = v27; - v0->field_8 = v7->field_20; - v17 = v7->pParent; - v0->pParent = v17; - if ( v17 ) - { - if ( v17->prolly_head ) - { - v18 = v17->prolly_tail; - if ( !v18 ) - return; - v18->pNext = v0; - } - else - { - v17->prolly_head = v0; - } - v17->prolly_tail = v0; - } - if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) - return; - ++v0; - ++pOutdoorCamera->uNumSpans; - } - v7->pNext->field_20 = (signed __int64)v15; - v6 = v26; - } - v7->pNext->pPrev = v7->pPrev; - v7->pPrev->pNext = v7->pNext; - } - } - v26 = v6->pNext; - if ( !v26 ) - break; - v6 = v6->pNext; - } - } - for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) - { - i->pPrev->pNext = i->pNext; - i->pNext->pPrev = i->pPrev; - } - v20 = stru_80C9D8.pNext; - if ( stru_80C9D8.pNext != &stru_80C9A4 ) - break; -LABEL_50: - ++v27; - v1 = v24 + 52; - v24 += 52; - if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) - goto LABEL_51; - } - while ( 1 ) - { - v21 = v20->pNext; - if ( !v21 ) - break; - v22 = v20->field_4 + v20->field_0; - v20->field_0 = v22; - if ( v22 < stru_80C9D8.field_0 ) - v20->field_0 = stru_80C9D8.field_0 + 0.0000001; - while ( 1 ) - { - v23 = v20->pPrev; - if ( v20->field_0 >= (double)v23->field_0 ) - break; - v23->pNext = v20->pNext; - v20->pNext->pPrev = v23; - v23->pPrev->pNext = v20; - v20->pPrev = v23->pPrev; - v20->pNext = v23; - v23->pPrev = v20; - } - v20 = v21; - if ( v21 == &stru_80C9A4 ) - goto LABEL_50; - } - } -} -// 4EC3EC: using guessed type Edge defaultEdge; - //----- (00487DA9) -------------------------------------------------------- void __cdecl sub_487DA9() { @@ -814,170 +566,6 @@ } while ( v2 ); } -// 4EC3EC: using guessed type Edge defaultEdge; - -//----- (0048958E) -------------------------------------------------------- -stru12_MemoryBlock::stru12_MemoryBlock(int a2) -{ - stru12_MemoryBlock *v2; // esi@1 - void *v3; // eax@1 - void *v4; // ecx@1 - stru12_MemoryBlock *result; // eax@1 - - v2 = this; - v3 = operator new(8 * a2 + 16); - v2->pBlockBase = v3; - v4 = (char *)v3 + PID_TYPE(-(signed int)v3); - result = v2; - v2->pAlignedBlock = v4; -} - -//----- (004895B7) -------------------------------------------------------- -stru12::stru12(stru11 *pStru11) -{ - stru12 *v2; // esi@1 - - v2 = this; - this->field_44 = 0x41000000u; - this->field_4C = 0x46000000u; - //this->vdestructor_ptr = stru12::_4898E6; - this->field_48 = 0; - this->field_50 = 0; - this->field_54 = 0x33D6BF95u; - this->field_58 = 0; - - for (int i = 0; i < 12; ++i) - v2->pMemBlocks[i] = new stru12_MemoryBlock(640); -} - -//----- (00489810) -------------------------------------------------------- -stru12::~stru12() -{ - for (int i = 0; i < 12; ++i) - delete pMemBlocks[i]; -} - -//----- (004898BF) -------------------------------------------------------- -stru12_MemoryBlock::~stru12_MemoryBlock() -{ - stru12_MemoryBlock *v2; // esi@1 - void *v3; // ST00_4@1 - - v2 = this; - v3 = this->pBlockBase; - this->pAlignedBlock = 0; - free(v3); - v2->pBlockBase = 0; - /*if ( a2 & 1 ) - free(v2);*/ -} - -//----- (004898E6) -------------------------------------------------------- -void stru12::_4898E6() -{ - void *v1; // eax@1 - void *v2; // edx@1 - char *v3; // edi@2 - double v4; // st7@2 - char *v5; // ebx@2 - double v6; // st6@3 - double v7; // st5@3 - double v8; // st4@3 - int v9; // esi@3 - double v10; // st3@3 - float v11; // ST34_4@5 - double v12; // st6@10 - double v13; // ST0C_8@10 - char *v14; // [sp+14h] [bp-44h]@2 - char *v15; // [sp+18h] [bp-40h]@2 - char *v16; // [sp+1Ch] [bp-3Ch]@2 - char *v17; // [sp+20h] [bp-38h]@2 - char *v18; // [sp+24h] [bp-34h]@2 - float v19; // [sp+30h] [bp-28h]@3 - float v20; // [sp+38h] [bp-20h]@3 - char *v21; // [sp+3Ch] [bp-1Ch]@2 - int v22; // [sp+40h] [bp-18h]@1 - char *v23; // [sp+44h] [bp-14h]@2 - char *v24; // [sp+48h] [bp-10h]@2 - int v25; // [sp+4Ch] [bp-Ch]@2 - float v26; // [sp+50h] [bp-8h]@3 - float v27; // [sp+54h] [bp-4h]@3 - - __debugbreak(); - v22 = 0; - v1 = this->pMemBlocks[1]->pAlignedBlock; - v2 = this->pMemBlocks[6]->pAlignedBlock; - if ( this->field_8C > 0 ) - { - v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); - v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); - v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); - v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); - v25 = (int)v1 - (int)v2; - v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); - v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); - v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); - v4 = 1.0; - v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); - v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); - v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); - do - { - v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; - v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; - v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; - v7 = pIndoorCamera->fRotationYCosine; - v8 = pIndoorCamera->fRotationYSine; - v20 = pIndoorCamera->fRotationXCosine; - v19 = pIndoorCamera->fRotationXSine; - v9 = (int)((char *)v2 + (int)v21); - v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; - if ( pIndoorCamera->sRotationX ) - { - v11 = v10; - *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; - *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; - *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; - } - else - { - *(float *)v9 = v10; - *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; - *(float *)((char *)v2 + (int)v5) = v6; - } - if ( *(float *)v9 >= 8.0 ) - { - if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) - { - *(int *)v2 = 0; - v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; - *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX - - v12 * *(float *)((char *)v2 + (int)v3); - *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY - - v12 * *(float *)((char *)v2 + (int)v5); - *(float *)((char *)v2 + (int)v16) = v4 - - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); - *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); - v13 = *(float *)v9 + 6.7553994e15; - v4 = 1.0; - *(int *)((char *)v2 + (int)v14) = LODWORD(v13); - } - else - { - *(int *)v2 = 2; - } - } - else - { - *(int *)v2 = 1; - } - ++v22; - v2 = (char *)v2 + 4; - } - while ( v22 < this->field_8C ); - } - this->field_8C = 0; -} //----- (0048A959) -------------------------------------------------------- unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) @@ -3331,1636 +2919,7 @@ return (a << 24) | (r << 16) | (g << 8) | b; } -//----- (004AD504) -------------------------------------------------------- -int __fastcall sub_4AD504(signed int sFaceID) -{ - int result; // eax@1 - signed int v2; // ebx@1 - BLVFace *v3; // esi@3 - Texture *v4; // edi@6 - int v5; // eax@7 - int v6; // edx@7 - int v7; // ecx@7 - int v8; // ebx@8 - int v9; // eax@8 - int v10; // ebx@8 - unsigned int v11; // ebx@9 - int v12; // esi@10 - int v13; // eax@13 - unsigned __int16 *v14; // eax@13 - unsigned int v15; // eax@14 - unsigned __int16 *v16; // ebx@14 - int v17; // eax@15 - int v18; // ebx@15 - int v19; // esi@15 - int v20; // ecx@15 - int v21; // eax@15 - stru193_math *v22; // ebx@15 - int v23; // eax@15 - char *v24; // esi@16 - int v25; // eax@18 - int v26; // eax@18 - int v27; // eax@20 - signed int v28; // esi@20 - signed int v29; // edx@20 - signed int v30; // esi@20 - signed int v31; // edi@20 - int v32; // esi@20 - int v33; // eax@26 - int *v34; // esi@27 - unsigned __int16 *v35; // edi@27 - unsigned int v36; // edx@27 - int v37; // ebx@27 - char v38; // cl@27 - char v39; // ch@27 - int v40; // ebx@29 - int v41; // edx@29 - unsigned int v42; // ebx@30 - int v43; // edx@30 - int v44; // eax@33 - int *v45; // esi@34 - unsigned __int16 *v46; // edi@34 - unsigned int v47; // edx@34 - int v48; // ebx@34 - char v49; // cl@34 - char v50; // ch@34 - int v51; // ebx@36 - int v52; // edx@36 - unsigned __int16 v53; // bx@37 - int v54; // edx@37 - int v55; // eax@40 - int v56; // eax@41 - int *v57; // esi@42 - unsigned __int16 *v58; // edi@42 - unsigned int v59; // edx@42 - int v60; // ebx@42 - char v61; // cl@42 - char v62; // ch@42 - unsigned int v63; // ebx@44 - int v64; // edx@44 - unsigned int v65; // ebx@44 - int v66; // edx@44 - unsigned int v67; // ebx@45 - int v68; // edx@45 - int v69; // ebx@45 - int v70; // edx@45 - int v71; // eax@48 - int *v72; // esi@49 - unsigned __int16 *v73; // edi@49 - unsigned int v74; // edx@49 - int v75; // ebx@49 - char v76; // cl@49 - char v77; // ch@49 - unsigned int v78; // ebx@51 - int v79; // edx@51 - unsigned int v80; // ebx@51 - int v81; // edx@51 - unsigned int v82; // ebx@52 - int v83; // edx@52 - int v84; // ebx@52 - int v85; // edx@52 - unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 - unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 - unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 - unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 - int v90; // [sp+1Ch] [bp-88h]@20 - BLVFace *v91; // [sp+20h] [bp-84h]@3 - int v92; // [sp+24h] [bp-80h]@7 - int i; // [sp+28h] [bp-7Ch]@7 - unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 - unsigned int v95; // [sp+30h] [bp-74h]@1 - Texture *v96; // [sp+34h] [bp-70h]@6 - int v97; // [sp+38h] [bp-6Ch]@15 - unsigned int v98; // [sp+3Ch] [bp-68h]@9 - int v99; // [sp+40h] [bp-64h]@9 - int v100; // [sp+44h] [bp-60h]@24 - int v101; // [sp+48h] [bp-5Ch]@10 - int v102; // [sp+4Ch] [bp-58h]@20 - int v103; // [sp+50h] [bp-54h]@20 - int v104; // [sp+54h] [bp-50h]@9 - unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 - int v106; // [sp+5Ch] [bp-48h]@24 - int v107; // [sp+60h] [bp-44h]@20 - int v108; // [sp+64h] [bp-40h]@20 - int v109; // [sp+68h] [bp-3Ch]@20 - int v110; // [sp+6Ch] [bp-38h]@15 - int v111; // [sp+70h] [bp-34h]@20 - int a1; // [sp+74h] [bp-30h]@12 - int a2; // [sp+78h] [bp-2Ch]@9 - int *v114; // [sp+7Ch] [bp-28h]@16 - int v115; // [sp+80h] [bp-24h]@18 - int v116; // [sp+84h] [bp-20h]@7 - unsigned int v117; // [sp+88h] [bp-1Ch]@15 - unsigned int v118; // [sp+8Ch] [bp-18h]@24 - int *v119; // [sp+90h] [bp-14h]@13 - int v120; // [sp+94h] [bp-10h]@15 - unsigned int v121; // [sp+98h] [bp-Ch]@15 - unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 - unsigned int v123; // [sp+A0h] [bp-4h]@13 - result = pRenderer->uTargetSurfacePitch; - v2 = sFaceID; - v95 = pRenderer->uTargetSurfacePitch; - if ( sFaceID >= 0 ) - { - if ( sFaceID < (signed int)pIndoor->uNumFaces ) - { - v3 = &pIndoor->pFaces[sFaceID]; - v91 = &pIndoor->pFaces[sFaceID]; - if ( !pRenderer->pRenderD3D ) - { - result = GetPortalScreenCoord(sFaceID); - if ( result ) - { - result = PortalFrustrum(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); - if ( result ) - { - result = (int)v3->GetTexture(); - v4 = (Texture *)result; - v96 = (Texture *)result; - if ( result ) - { - v5 = *(short *)(result + 38); - LOBYTE(v3->uAttributes) |= 0x80u; - v92 = v5; - sub_4AE5F1(v2); - ++pBLVRenderParams->field_84; - v6 = stru_F8AD28.pDeltaUV[0]; - v116 = stru_F8AD28.pDeltaUV[1]; - v7 = 0; - for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) - { - v8 = v116; - stru_F8AD28._blv_lights_xs[v7] += v6; - v9 = 4 * v7 + 16297672; - v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; - } - v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); - result = stru_F8A590._viewport_space_y; - a2 = stru_F8A590._viewport_space_y; - v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; - v99 = 640 * stru_F8A590._viewport_space_y; - v86 = v4->pLevelOfDetail0_prolly_alpha_mask; - v87 = v4->pLevelOfDetail1; - v88 = v4->pLevelOfDetail2; - v89 = v4->pLevelOfDetail3; - v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; - v104 = 2 * pBLVRenderParams->field_0_timer_; - if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) - { - v12 = 2 * stru_F8A590._viewport_space_y; - v101 = 2 * stru_F8A590._viewport_space_y; - while ( 1 ) - { - a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12); - sub_4AE313(a1, result, &stru_F81018.field_0); - if ( LOBYTE(viewparams->field_20) ) - { - v15 = v95 * (v12 - pBLVRenderParams->uViewportY); - v119 = &pBLVRenderParams->pTargetZBuffer[2 - * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v12) - + 320 * (v12 - pBLVRenderParams->uViewportY)) - - pBLVRenderParams->uViewportX]; - v16 = &pBLVRenderParams->pRenderTarget[v15 - + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12) - - pBLVRenderParams->uViewportX]; - v14 = &pBLVRenderParams->pRenderTarget[v15 - + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12) - - pBLVRenderParams->uViewportX]; - v123 = (unsigned int)v16; - } - else - { - v13 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12); - v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; - v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; - v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12)]; - } - v117 = (unsigned int)v14; - HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); - v18 = stru_F81018.field_0.field_10; - LOWORD(v17) = 0; - v97 = stru_F8AD28.field_0 | v17; - v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); - v19 = stru_F81018.field_0.field_4 >> i; - v20 = 11 - v18; - v116 = stru_F81018.field_0.field_8 >> i; - v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); - v22 = stru_5C6E00; - v122 = (unsigned __int16 *)v20; - v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); - v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); - v120 = v116 + 4 * v23; - if ( v123 < v117 ) - { - v24 = (char *)&stru_F81018.field_34.field_8; - v114 = &stru_F81018.field_34.field_8; - a1 += 16; - while ( 1 ) - { - sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); - v25 = *((int *)v24 - 2); - LOWORD(v25) = 0; - v115 = v97; - v26 = stru_F8AD28.field_0 | v25; - if ( v97 <= (unsigned int)v26 ) - v115 = v26; - v97 = v26; - v27 = *((int *)v24 - 11); - v28 = *((int *)v24 - 1); - v105 = (&v86)[4 * v27]; - v111 = v27 + 16; - v29 = v4->uWidthMinus1; - v109 = v27 + v27 + 16 - v4->uWidthLn2; - v107 = v29 >> v27; - v30 = v28 >> i; - v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); - v31 = *v114 >> i; - v122 = (unsigned __int16 *)(11 - v27); - v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); - v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); - v108 = (signed int)(v116 - v121) >> 4; - v103 = (v90 - v120) >> 4; - v32 = v123 + 32; - if ( LOBYTE(viewparams->field_20) ) - v32 = v123 + 64; - if ( v32 > v117 ) - v32 = v117; - v118 = v32; - v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); - v106 = (signed int)(v32 - v123) >> 1; - if ( v110 >> 16 == v100 >> 16 ) - { - v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); - if ( LOBYTE(viewparams->field_20) ) - { - v44 = v123; - if ( v123 < v118 ) - { - v45 = v119; - v46 = v122; - v47 = v121; - v48 = v120; - v49 = v111; - v50 = v109; - if ( v106 & 2 ) - { - *v119 = v115; - v45 -= 2; - v44 = v123 + 4; - goto LABEL_37; - } - do - { - v44 += 8; - v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); - v52 = v115; - LOWORD(v51) = v46[v51]; - *v45 = v115; - v45[1] = v52; - v45[640] = v52; - v45[641] = v52; - *(short *)(v44 - 8) = v51; - *(short *)(v44 - 6) = v51; - *(short *)(v44 + 1272) = v51; - *(short *)(v44 + 1274) = v51; - v45[2] = v52; - v45[3] = v52; - v45[642] = v52; - v45[643] = v52; - v121 += v108; - v120 += v103; - v47 = v121; - v48 = v120; -LABEL_37: - v45 += 4; - v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; - v54 = v108; - *(short *)(v44 - 4) = v53; - *(short *)(v44 - 2) = v53; - *(short *)(v44 + 1276) = v53; - *(short *)(v44 + 1278) = v53; - v121 += v54; - v120 += v103; - v47 = v121; - v48 = v120; - } - while ( v44 < v118 ); - v123 = v44; - v119 = v45; - } - } - else - { - v33 = v123; - if ( v123 < v118 ) - { - v34 = v119; - v35 = v122; - v36 = v121; - v37 = v120; - v38 = v111; - v39 = v109; - if ( v106 & 1 ) - { - *v119 = v115; - --v34; - v33 = v123 + 2; - goto LABEL_30; - } - do - { - v33 += 4; - v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); - v41 = v115; - LOWORD(v40) = v35[v40]; - *v34 = v115; - *(short *)(v33 - 4) = v40; - v34[1] = v41; - v121 += v108; - v120 += v103; - v36 = v121; - v37 = v120; -LABEL_30: - v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); - v34 += 2; - v43 = v108; - *(short *)(v33 - 2) = v35[*(char *)v42]; - v121 += v43; - v120 += v103; - v36 = v121; - v37 = v120; - } - while ( v33 < v118 ); - v123 = v33; - v119 = v34; - } - } - } - else - { - v55 = v110 - ((v100 - v110) >> 4); - v110 = (v100 - v110) >> 4; - v122 = (unsigned __int16 *)v55; - if ( LOBYTE(viewparams->field_20) ) - { - v71 = v123; - if ( v123 < v118 ) - { - v72 = v119; - v73 = v94; - v74 = v121; - v75 = v120; - v76 = v111; - v77 = v109; - if ( v106 & 2 ) - { - *v119 = v115; - v72 += 2; - v71 = v123 + 4; - goto LABEL_52; - } - do - { - v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); - v79 = (int)((char *)v122 + v110); - v71 += 8; - v122 = (unsigned __int16 *)v79; - v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; - v81 = v115; - LOWORD(v80) = v73[v80]; - *v72 = v115; - v72[1] = v81; - v72[640] = v81; - v72[641] = v81; - *(short *)(v71 - 8) = v80; - *(short *)(v71 - 6) = v80; - *(short *)(v71 + 1272) = v80; - *(short *)(v71 + 1274) = v80; - v72[2] = v81; - v72[3] = v81; - v72[642] = v81; - v72[643] = v81; - v121 += v108; - v120 += v103; - v74 = v121; - v75 = v120; - v72 += 4; -LABEL_52: - v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); - v83 = (int)((char *)v122 + v110); - v84 = v105[v82]; - v122 = (unsigned __int16 *)v83; - LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; - v85 = v108; - *(short *)(v71 - 4) = v84; - *(short *)(v71 - 2) = v84; - *(short *)(v71 + 1276) = v84; - *(short *)(v71 + 1278) = v84; - v121 += v85; - v120 += v103; - v74 = v121; - v75 = v120; - } - while ( v71 < v118 ); - v123 = v71; - v119 = v72; - } - } - else - { - v56 = v123; - if ( v123 < v118 ) - { - v57 = v119; - v58 = v94; - v59 = v121; - v60 = v120; - v61 = v111; - v62 = v109; - if ( v106 & 1 ) - { - *v119 = v115; - ++v57; - v56 = v123 + 2; - goto LABEL_45; - } - do - { - v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); - v64 = (int)((char *)v122 + v110); - v56 += 4; - v122 = (unsigned __int16 *)v64; - v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; - v66 = v115; - LOWORD(v65) = v58[v65]; - *v57 = v115; - *(short *)(v56 - 4) = v65; - v57[1] = v66; - v121 += v108; - v120 += v103; - v59 = v121; - v60 = v120; - v57 += 2; -LABEL_45: - v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); - v68 = (int)((char *)v122 + v110); - v69 = v105[v67]; - v122 = (unsigned __int16 *)v68; - LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; - v70 = v108; - *(short *)(v56 - 2) = v69; - v121 += v70; - v120 += v103; - v59 = v121; - v60 = v120; - } - while ( v56 < v118 ); - v123 = v56; - v119 = v57; - } - } - } - v114 += 13; - v110 = v100; - a1 += 16; - v4 = v96; - v121 = v116; - v120 = v90; - if ( v123 >= v117 ) - break; - v24 = (char *)v114; - v22 = stru_5C6E00; - } - } - ++a2; - v98 += v95; - result = a2; - v101 += 2; - v99 += 640; - if ( a2 > stru_F8A590._viewport_space_w ) - break; - v12 = v101; - result = a2; - v11 = v98; - } - } - } - } - } - } - } - } - return result; -} -// 4AE491: using guessed type int __fastcall sub_4AE491(int, int); - -//----- (004ADD1D) -------------------------------------------------------- -void __fastcall sub_4ADD1D(int uFaceID) -{ - int v1; // edi@1 - BLVFace *v2; // esi@3 - signed int v3; // ebx@4 - Texture *v4; // edi@9 - signed int v5; // eax@9 - char *v6; // edi@12 - signed int v7; // eax@15 - unsigned int v8; // eax@16 - __int16 v9; // cx@19 - unsigned __int8 *v10; // eax@19 - unsigned __int16 *v11; // eax@19 - int v12; // edi@19 - int v13; // ebx@20 - stru352 *v14; // esi@20 - DWORD v15; // eax@22 - signed int v16; // ecx@22 - signed int v17; // ST68_4@22 - int v18; // eax@22 - int v19; // ecx@22 - unsigned int v20; // esi@23 - int v21; // edi@23 - int v22; // eax@23 - int *v23; // ebx@24 - int v24; // edx@24 - int v25; // ebx@25 - unsigned __int16 v26; // cx@25 - int v27; // edx@26 - unsigned __int16 v28; // cx@26 - unsigned __int8 v29; // sf@27 - unsigned __int8 v30; // of@27 - unsigned int v31; // esi@29 - int v32; // edi@29 - unsigned __int16 *v33; // eax@29 - int *v34; // ebx@30 - int v35; // edx@30 - int v36; // ebx@31 - unsigned __int16 v37; // cx@31 - int v38; // edx@32 - unsigned __int16 v39; // cx@32 - Texture *v40; // [sp-10h] [bp-6Ch]@16 - int v41; // [sp-Ch] [bp-68h]@15 - unsigned int v42; // [sp+10h] [bp-4Ch]@1 - signed int v43; // [sp+14h] [bp-48h]@12 - signed int v44; // [sp+14h] [bp-48h]@22 - int v45; // [sp+1Ch] [bp-40h]@22 - int v46; // [sp+20h] [bp-3Ch]@22 - int v47; // [sp+24h] [bp-38h]@19 - char v48; // [sp+28h] [bp-34h]@19 - int v49; // [sp+2Ch] [bp-30h]@19 - unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 - unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 - int v52; // [sp+38h] [bp-24h]@22 - int v53; // [sp+3Ch] [bp-20h]@22 - signed int v54; // [sp+40h] [bp-1Ch]@12 - int v55; // [sp+40h] [bp-1Ch]@20 - int v56; // [sp+44h] [bp-18h]@20 - stru352 *i; // [sp+48h] [bp-14h]@20 - unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 - int v59; // [sp+50h] [bp-Ch]@4 - int v60; // [sp+50h] [bp-Ch]@19 - int v61; // [sp+54h] [bp-8h]@22 - int *v62; // [sp+58h] [bp-4h]@23 - int *v63; // [sp+58h] [bp-4h]@29 - - v1 = uFaceID; - v42 = pRenderer->uTargetSurfacePitch; - if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) - { - v2 = &pIndoor->pFaces[uFaceID]; - if ( pRenderer->pRenderD3D ) - { - v3 = sub_424579(uFaceID, &stru_F8AD28); - v59 = v3; - } - else - { - v59 = GetPortalScreenCoord(uFaceID); - v3 = v59; - } - if ( v3 && (pRenderer->pRenderD3D || PortalFrustrum(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) - { - v4 = v2->GetTexture(); - v5 = 0; - if ( v4 ) - { - if ( pRenderer->pRenderD3D ) - { - if ( v3 > 0 ) - { - v54 = v3; - v43 = v3; - v6 = (char *)&array_507D30[0].v; - do - { - *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); - *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; - v6 += 48; - --v54; - } - while ( v54 ); - v3 = v59; - v5 = v43; - } - v7 = v5; - v41 = stru_F8AD28.field_0; - array_507D30[v7].u = array_507D30[v7].u * 0.25; - array_507D30[v7].v = array_507D30[v7].v * 0.25; - if ( BYTE1(v2->uAttributes) & 0x40 ) - { - v40 = v2->GetTexture(); - v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); - } - else - { - v40 = v2->GetTexture(); - v8 = v2->uBitmapID; - } - pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); - } - else - { - v49 = v4->uWidthMinus1; - v47 = v4->uHeightMinus1 << 16; - v9 = 16 - v4->uWidthLn2; - v10 = v4->pLevelOfDetail0_prolly_alpha_mask; - LOBYTE(v2->uAttributes) |= 0x80u; - v48 = v9; - v50 = v10; - sub_4AF412(); - ++pBLVRenderParams->uNumFacesRenderedThisFrame; - v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); - v12 = stru_F8A590._viewport_space_y; - v51 = v11; - v60 = stru_F8A590._viewport_space_y; - if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) - { - v13 = 2 * stru_F8A590._viewport_space_y; - v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; - v55 = 2 * stru_F8A590._viewport_space_y; - v56 = 640 * stru_F8A590._viewport_space_y; - for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) - { - sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13), v12); - v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); - v15 = GetTickCount(); - v16 = v14->field_0; - v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; - v45 = v14->field_4 >> 3; - v44 = v16 >> 3; - v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; - v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; - v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; - v18 = v14->field_28; - v19 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13); - LOWORD(v18) = 0; - v46 = stru_F8AD28.field_0 | v18; - v61 = *(__int16 *)((char *)stru_F8A590.viewport_right_side + v13) - v19; - if ( LOBYTE(viewparams->field_20) ) - { - v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) - - pBLVRenderParams->uViewportX]; - v31 = v44; - v32 = v45; - v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) - + 2 * v19 - - pBLVRenderParams->uViewportX]; - if ( v61 & 1 ) - { - --v61; - v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) - + 2 * v19 - - pBLVRenderParams->uViewportX - - 2]; - v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) - - pBLVRenderParams->uViewportX]; - v35 = v46; - v63 += 2; - goto LABEL_32; - } - while ( 1 ) - { - v30 = __OFSUB__(v61, 2); - v29 = v61 - 2 < 0; - v61 -= 2; - if ( v29 ^ v30 ) - break; - v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); - v31 += v52; - v37 = v51[v36]; - v32 += v53; - v34 = v63; - v35 = v46; - *v33 = v37; - v33[1] = v37; - v33[640] = v37; - v33[641] = v37; - v63 += 4; - v34[2] = v46; - v34[3] = v46; - v34[642] = v46; - v34[643] = v46; -LABEL_32: - *v34 = v35; - v34[1] = v35; - v34[640] = v35; - v34[641] = v35; - v38 = v49 & (v31 >> 16); - v33 += 4; - v31 += v52; - v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; - v32 += v53; - *(v33 - 2) = v39; - *(v33 - 1) = v39; - v33[638] = v39; - v33[639] = v39; - } - } - else - { - v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; - v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; - v20 = v44; - v21 = v45; - v22 = (int)v58; - if ( v61 & 1 ) - { - --v61; - v22 = (int)(v58 - 1); - v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; - v24 = v46; - ++v62; - goto LABEL_26; - } - while ( 1 ) - { - v30 = __OFSUB__(v61, 2); - v29 = v61 - 2 < 0; - v61 -= 2; - if ( v29 ^ v30 ) - break; - v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); - v20 += v52; - v26 = v51[v25]; - v21 += v53; - v23 = v62; - v24 = v46; - *(short *)v22 = v26; - v62 += 2; - v23[1] = v46; -LABEL_26: - *v23 = v24; - v27 = v49 & (v20 >> 16); - v22 += 4; - v20 += v52; - v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; - v21 += v53; - *(short *)(v22 - 2) = v28; - } - } - ++v60; - ++i; - v56 += 640; - v55 += 2; - if ( v60 > stru_F8A590._viewport_space_w ) - break; - v13 = v55; - v12 = v60; - } - } - } - } - } - } -} - -//----- (004AE1E7) -------------------------------------------------------- -int __fastcall sub_4AE1E7(int a1, int a2, int a3) -{ - int v3; // ebx@1 - int v4; // edi@1 - int v5; // esi@1 - signed __int64 v6; // qtt@3 - int v7; // esi@3 - int v8; // eax@5 - int result; // eax@5 - int v10; // edx@5 - int v11; // [sp+Ch] [bp-8h]@1 - int v12; // [sp+1Ch] [bp+8h]@2 - - v3 = pBLVRenderParams->uViewportCenterY - a3; - v4 = pBLVRenderParams->uViewportCenterX - a2; - v11 = a1; - v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y - + stru_F8AD28.field_7C - + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; - if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) - { - LODWORD(v6) = stru_F8AD28.vec_80.z << 16; - HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; - v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); - } - else - { - v7 = 1073741824; - } - v8 = stru_F8AD28.vec_9C.z; - stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z - + stru_F8AD28.vec_8C.x - + v4 * stru_F8AD28.vec_8C.y) - * (signed __int64)v7) >> 16) - + stru_F8AD28.field_98; - result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; - v10 = result + stru_F8AD28.field_A8; - stru_F83B80[v11].field_28 = v7; - stru_F83B80[v11].field_4 = v10; - return result; -} - -//----- (004AE313) -------------------------------------------------------- -int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) -{ - int _dy; // ebx@1 - int _dx; // edi@1 - int v5; // ecx@1 - int v6; // esi@1 - int v7; // ST18_4@2 - signed __int64 v8; // qtt@3 - unsigned int v9; // ecx@3 - int result; // eax@8 - int v11; // [sp+Ch] [bp-8h]@1 - - _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; - _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; - ++pBLVRenderParams->field_88; - v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; - v6 = v5 + _dx * stru_F8AD28.vec_80.x; - v11 = v5 + _dx * stru_F8AD28.vec_80.x; - if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) - { - LODWORD(v8) = stru_F8AD28.vec_80.z << 16; - HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; - v9 = v8 / v11; - } - else - { - v9 = 0x40000000u; - } - if ( (signed int)v9 >= stru_F8AD28.field_34 ) - p->field_0 = v9; - else - p->field_0 = stru_F8AD28.field_34; - p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) - * (signed __int64)(signed int)v9) >> 16) - + stru_F8AD28.field_98 - + (stru_F8AD28.pDeltaUV[0] << 16); - p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) - * (signed __int64)(signed int)v9) >> 16) - + stru_F8AD28.field_A8 - + (stru_F8AD28.pDeltaUV[1] << 16); - result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); - if ( result < 369620 || bUseLoResSprites ) - { - if ( result < 184810 ) - p->field_10 = result > 92405; - else - p->field_10 = 2; - } - else - { - p->field_10 = 3; - } - return result; -} - -//----- (004AE491) -------------------------------------------------------- -int __fastcall sub_4AE491(signed int a1, signed int a2) -{ - signed int v2; // eax@1 - signed int v3; // edi@1 - int v4; // ecx@1 - int v5; // esi@2 - int v6; // eax@2 - int v7; // ebx@2 - unsigned int v8; // ecx@2 - int v9; // edx@5 - int v10; // edx@7 - unsigned int v11; // eax@8 - int v13; // [sp+4h] [bp-18h]@2 - int v14; // [sp+8h] [bp-14h]@2 - signed int v15; // [sp+Ch] [bp-10h]@1 - int v16; // [sp+14h] [bp-8h]@1 - int v17; // [sp+18h] [bp-4h]@1 - - v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); - v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); - v17 = stru_F8AD28.uCurrentAmbientLightLevel; - v4 = 0; - v15 = v2; - v16 = 0; - if ( stru_F8AD28.uNumLightsApplied > 0 ) - { - do - { - v5 = v16; - v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); - v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); - v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; - v7 = v13; - v8 = v14; - if ( v6 < v13 ) - { - v6 = v13; - v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; - } - if ( v6 < v14 ) - { - v9 = v6; - v6 = v14; - v8 = v9; - } - if ( v7 < (signed int)v8 ) - { - v10 = v8; - v8 = v7; - v7 = v10; - } - v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; - if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) - v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); - ++v16; - v2 = v15; - } - while ( v16 < stru_F8AD28.uNumLightsApplied ); - v4 = 0; - } - if ( stru_F8AD28.field_3E4 != v4 ) - v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); - if ( v17 >= v4 ) - { - if ( v17 > 2031616 ) - v17 = 2031616; - } - else - { - v17 = v4; - } - ++pBLVRenderParams->field_8C; - return v17; -} -// 4AE491: using guessed type int __fastcall sub_4AE491(int, int); - -//----- (004AE5F1) -------------------------------------------------------- -void __fastcall sub_4AE5F1(unsigned int uFaceID) -{ - BLVFace *v1; // esi@1 - BLVFaceExtra *v2; // ebx@1 - int v3; // eax@1 - int v4; // edi@1 - Texture *v5; // edi@1 - int v6; // eax@1 - unsigned int v7; // eax@1 - unsigned int v8; // ecx@1 - unsigned int v9; // eax@1 - unsigned int v10; // ecx@5 - int v11; // edi@10 - int v12; // ecx@10 - int v13; // eax@10 - int v14; // edx@10 - int v15; // ebx@12 - double v16; // st7@16 - int v17; // eax@16 - char *v18; // ebx@17 - int v19; // ecx@19 - int v20; // eax@19 - int v21; // edx@21 - int v22; // eax@23 - int v23; // ST04_4@26 - int v24; // edi@26 - double v25; // st6@26 - int v26; // eax@26 - double v27; // st6@26 - int v28; // ecx@26 - char v29; // al@26 - int v30; // edx@28 - int v31; // ecx@28 - BLVLightMM7 *v32; // ecx@32 - int v33; // edi@33 - int v34; // edx@33 - int v35; // eax@33 - int v36; // edi@35 - int v37; // edx@37 - int v38; // ebx@39 - int v39; // edi@42 - int v40; // eax@42 - char *v41; // ebx@45 - signed int v42; // ecx@47 - int v43; // edi@47 - int v44; // eax@49 - int v45; // edx@51 - int v46; // eax@53 - int v47; // ST04_4@55 - int v48; // edi@55 - double v49; // st6@55 - int v50; // eax@55 - double v51; // st6@55 - int v52; // eax@55 - int v53; // ecx@57 - int v54; // ecx@58 - int v55; // ecx@59 - int v56; // edx@62 - int v57; // ecx@62 - int v58; // eax@63 - int v59; // edx@64 - int v60; // ecx@67 - int v61; // edx@67 - int v62; // eax@68 - int v63; // edx@69 - signed int v64; // ecx@72 - double v65; // st7@75 - Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 - Vec3_int_ v67; // [sp+18h] [bp-28h]@9 - BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 - int v69; // [sp+28h] [bp-18h]@10 - int v70; // [sp+2Ch] [bp-14h]@10 - int X; // [sp+30h] [bp-10h]@10 - int v72; // [sp+34h] [bp-Ch]@10 - int v73; // [sp+38h] [bp-8h]@10 - int v74; // [sp+3Ch] [bp-4h]@10 - - v1 = &pIndoor->pFaces[uFaceID]; - v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; - v3 = v1->uBitmapID; - v4 = v1->uBitmapID; - v68 = v2; - v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); - v6 = 8 * uFaceID; - LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); - stru_F8AD28.field_0 = v6; - stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; - stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; - stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; - stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; - stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; - stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; - v7 = GetTickCount(); - v8 = v1->uAttributes; - v9 = v7 >> 3; - if ( v8 & 4 ) - { - stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; - } - else - { - if ( v8 & 0x20 ) - stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; - } - v10 = v1->uAttributes; - if ( BYTE1(v10) & 8 ) - { - stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; - } - else - { - if ( v10 & 0x40 ) - stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; - } - v1->_get_normals(&v67, &v66); - stru_F8AD28.vec_14.x = v67.x; - stru_F8AD28.vec_14.y = v67.y; - stru_F8AD28.vec_14.z = v67.z; - stru_F8AD28.vec_20.x = v66.x; - stru_F8AD28.vec_20.y = v66.y; - stru_F8AD28.vec_20.z = v66.z; - stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; - if ( pBLVRenderParams->sPartyRotX ) - { - v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; - X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; - stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z - * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; - v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; - stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; - X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; - v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; - stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y - - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; - v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y - + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); - v73 = -65536 * pBLVRenderParams->vPartyPos.z; - v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; - v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - v13 = pBLVRenderParams->vPartyPos.y; - v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v14 = pBLVRenderParams->vPartyPos.x; - } - else - { - v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - v70; - stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; - stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - v70; - stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; - stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - v70; - v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v14 = pBLVRenderParams->vPartyPos.x; - stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; - v13 = pBLVRenderParams->vPartyPos.y; - stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y - - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; - v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y - + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); - v70 = -65536 * pBLVRenderParams->vPartyPos.z; - } - stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; - stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z - + stru_F8AD28.plane_4.dist - + stru_F8AD28.plane_4.vNormal.y * v13 - + stru_F8AD28.plane_4.vNormal.x * v14; - stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) - * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; - stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) - * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; - stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; - stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; - stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; - stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; - X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; - v15 = v70; - v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; - stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; - stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); - stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; - stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; - X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; - v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; - v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; - stru_F8AD28.field_38 = 0; - stru_F8AD28.field_A8 = -(X - + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); - if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) - { - stru_F8AD28.field_3E4 = 1; - stru_F8AD28.field_3E8 = *(int *)&v68->field_4; - stru_F8AD28.field_3EC = *(int *)&v68->field_8; - stru_F8AD28.field_3F0 = v68->field_1E; - stru_F8AD28.field_3F4 = v68->field_20; - } - else - { - stru_F8AD28.field_3E4 = 0; - } - v16 = 0.0039215689; - v17 = 116 * v1->uSectorID; - v69 = v17; - v74 = 0; - v73 = 0; - stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; - v70 = pMobileLightsStack->uNumLightsActive; - if ( pMobileLightsStack->uNumLightsActive > 0 ) - { - v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; - do - { - if ( v74 >= 20 ) - break; - v19 = *((short *)v18 + 2); - v20 = *((short *)v18 - 1); - if ( v20 > v1->pBounding.x1 - v19 ) - { - if ( v20 < v19 + v1->pBounding.x2 ) - { - v21 = *(short *)v18; - if ( v21 > v1->pBounding.y1 - v19 ) - { - if ( v21 < v19 + v1->pBounding.y2 ) - { - v22 = *((short *)v18 + 1); - if ( v22 > v1->pBounding.z1 - v19 ) - { - if ( v22 < v19 + v1->pBounding.z2 ) - { - X = (v1->pFacePlane_old.dist - + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z - + v21 * v1->pFacePlane_old.vNormal.y - + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; - if ( X <= v19 ) - { - v23 = X; - v24 = v74; - stru_F8AD28._blv_lights_radii[v74] = v19; - stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; - *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; - stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); - stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; - stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); - v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; - v25 = (double)(signed int)v68 * v16; - v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; - v26 = (unsigned __int8)v18[8]; - *(float *)(v24 * 4 + 16297992) = v25; - v27 = (double)(signed int)v68; - v68 = (BLVFaceExtra *)v26; - *(float *)(v24 * 4 + 16298072) = v27 * v16; - *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; - v16 = 0.0039215689; - stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); - v28 = v74; - v29 = v18[9]; - ++v74; - stru_F8AD28._blv_lights_types[v28] = v29; - } - } - } - } - } - } - } - ++v73; - v18 += 18; - v17 = v69; - } - while ( v73 < v70 ); - } - v30 = 0; - v73 = 0; - v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); - v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); - if ( v31 > 0 ) - { - while ( v74 < 20 ) - { - v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; - if ( !(v32->uAtributes & 8) ) - { - v33 = v1->pBounding.x1; - v34 = v32->vPosition.x; - X = v32->uBrightness; - v35 = v32->uRadius; - v68 = (BLVFaceExtra *)v32->uRadius; - if ( v34 > v33 - v35 ) - { - if ( v34 < v35 + v1->pBounding.x2 ) - { - v36 = v32->vPosition.y; - if ( v36 > v1->pBounding.y1 - v35 ) - { - if ( v36 < v35 + v1->pBounding.y2 ) - { - v37 = v32->vPosition.z; - if ( v37 > v1->pBounding.z1 - v35 ) - { - if ( v37 < v35 + v1->pBounding.z2 ) - { - v38 = (v1->pFacePlane_old.dist - + v32->vPosition.x * v1->pFacePlane_old.vNormal.x - + v37 * v1->pFacePlane_old.vNormal.z - + v36 * v1->pFacePlane_old.vNormal.y) >> 16; - if ( v38 >= 0 ) - { - if ( v38 <= v35 && v35 ) - { - v39 = v74; - stru_F8AD28._blv_lights_radii[v74] = v35; - stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; - *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; - stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; - stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; - stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; - v68 = (BLVFaceExtra *)v32->uRed; - stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; - v68 = (BLVFaceExtra *)v32->uGreen; - stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; - v68 = (BLVFaceExtra *)v32->uBlue; - stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; - v16 = 0.0039215689; - stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); - v40 = v74++; - stru_F8AD28._blv_lights_types[v40] = 1; - } - } - } - } - } - } - } - } - } - v30 = v73++ + 1; - if ( v73 >= v70 ) - break; - v17 = v69; - } - } - v73 = 0; - if ( pStationaryLightsStack->uNumLightsActive > 0 ) - { - v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; - do - { - if ( v74 >= 20 ) - break; - v42 = *((short *)v41 + 2); - v43 = *((short *)v41 - 1); - if ( v43 > v1->pBounding.x1 - v42 ) - { - if ( v43 < v42 + v1->pBounding.x2 ) - { - v44 = *(short *)v41; - if ( v44 > v1->pBounding.y1 - v42 ) - { - if ( v44 < v42 + v1->pBounding.y2 ) - { - v45 = *((short *)v41 + 1); - if ( v45 > v1->pBounding.z1 - v42 ) - { - if ( v45 < v42 + v1->pBounding.z2 ) - { - v46 = (v1->pFacePlane_old.dist - + *(short *)v41 * v1->pFacePlane_old.vNormal.y - + v43 * v1->pFacePlane_old.vNormal.x - + v45 * v1->pFacePlane_old.vNormal.z) >> 16; - v69 = v46; - if ( v46 >= 0 ) - { - if ( v46 <= v42 ) - { - v47 = v69; - v48 = v74; - stru_F8AD28._blv_lights_radii[v74] = v42; - stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; - stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); - stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; - stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); - v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; - v49 = (double)(signed int)v68 * v16; - v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; - v50 = (unsigned __int8)v41[8]; - stru_F8AD28._blv_lights_rs[v48] = v49; - v51 = (double)(signed int)v68; - v68 = (BLVFaceExtra *)v50; - stru_F8AD28._blv_lights_gs[v48] = v51 * v16; - stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; - v16 = 0.0039215689; - stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); - v52 = v74++; - stru_F8AD28._blv_lights_types[v52] = 1; - } - } - } - } - } - } - } - } - ++v73; - v41 += 12; - } - while ( v73 < pStationaryLightsStack->uNumLightsActive ); - } - stru_F8AD28.uNumLightsApplied = v74; - v53 = v1->pBounding.x2; - if ( pBLVRenderParams->vPartyPos.x <= v53 ) - { - v55 = v1->pBounding.x1; - if ( pBLVRenderParams->vPartyPos.x >= v55 ) - v54 = 0; - else - v54 = v55 - pBLVRenderParams->vPartyPos.x; - } - else - { - v54 = pBLVRenderParams->vPartyPos.x - v53; - } - v56 = v1->pBounding.y2; - v57 = v54 * v54; - if ( pBLVRenderParams->vPartyPos.y <= v56 ) - { - v59 = v1->pBounding.y1; - if ( pBLVRenderParams->vPartyPos.y >= v59 ) - v58 = 0; - else - v58 = v59 - pBLVRenderParams->vPartyPos.y; - } - else - { - v58 = pBLVRenderParams->vPartyPos.y - v56; - } - v60 = v58 * v58 + v57; - v61 = v1->pBounding.z2; - if ( pBLVRenderParams->vPartyPos.z <= v61 ) - { - v63 = v1->pBounding.z1; - if ( pBLVRenderParams->vPartyPos.z >= v63 ) - v62 = 0; - else - v62 = v63 - pBLVRenderParams->vPartyPos.z; - } - else - { - v62 = pBLVRenderParams->vPartyPos.z - v61; - } - v64 = v62 * v62 + v60; - if ( v64 ) - stru_F8AD28.field_34 = integer_sqrt(v64) << 16; - else - stru_F8AD28.field_34 = 0; - v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); - v65 = (double)(signed int)v68; - if ( v65 >= 655.36 ) - { - if ( v65 >= 26214.4 ) - { - if ( v65 >= 45875.2 ) - { - stru_F8AD28.field_44 = 8; - stru_F8AD28.field_48 = 3; - } - else - { - stru_F8AD28.field_44 = 16; - stru_F8AD28.field_48 = 4; - } - } - else - { - stru_F8AD28.field_44 = 32; - stru_F8AD28.field_48 = 5; - } - } - else - { - stru_F8AD28.field_44 = 64; - stru_F8AD28.field_48 = 6; - } -} -// 519AB4: using guessed type int uNumStationaryLightsApplied; - -//----- (004AF412) -------------------------------------------------------- -int __cdecl sub_4AF412() -{ - int v0; // ST20_4@2 - int v1; // ST20_4@2 - int v2; // ST20_4@2 - int v3; // esi@2 - int v4; // ST20_4@2 - int v5; // ecx@2 - int v6; // ebx@2 - int v7; // edi@2 - int v8; // edx@2 - int v9; // eax@2 - int result; // eax@4 - - stru_F8AD28.plane_4.vNormal.z = -65536; - stru_F8AD28.vec_20.y = -65536; - stru_F8AD28.plane_4.vNormal.x = 0; - stru_F8AD28.plane_4.vNormal.y = 0; - stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; - stru_F8AD28.vec_14.x = 65536; - stru_F8AD28.vec_14.y = 0; - stru_F8AD28.vec_14.z = 0; - stru_F8AD28.vec_20.x = 0; - stru_F8AD28.vec_20.z = 0; - stru_F8AD28.uDefaultAmbientLightLevel = 0; - if ( pBLVRenderParams->sPartyRotX ) - { - v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z - * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); - stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z - * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); - stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); - stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); - v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y - + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); - v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y - - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; - v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); - v6 = pBLVRenderParams->vPartyPos.z; - v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); - v8 = pBLVRenderParams->vPartyPos.y; - v9 = pBLVRenderParams->vPartyPos.x; - } - else - { - stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sSineY) >> 16); - stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; - stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y - * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; - stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - v8 = pBLVRenderParams->vPartyPos.y; - stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; - v9 = pBLVRenderParams->vPartyPos.x; - v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y - - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; - v6 = pBLVRenderParams->vPartyPos.z; - v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y - + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); - v7 = -65536 * pBLVRenderParams->vPartyPos.z; - } - stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; - stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 - + stru_F8AD28.plane_4.dist - + stru_F8AD28.plane_4.vNormal.x * v9 - + stru_F8AD28.plane_4.vNormal.z * v6; - stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) - * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; - stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) - * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; - stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; - stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; - stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; - stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; - stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; - stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) - + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); - stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; - stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; - result = 0; - stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) - + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); - stru_F8AD28.field_38 = 0; - stru_F8AD28.field_3E4 = 0; - stru_F8AD28.uCurrentAmbientLightLevel = 0; - stru_F8AD28.uNumLightsApplied = 0; - stru_F8AD28.field_34 = 0; - return result; -} //----- (004B1447) -------------------------------------------------------- Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3)