Mercurial > mm7
comparison mm7_3.cpp @ 1401:3161094869e0
Слияние
author | Ritor1 |
---|---|
date | Fri, 19 Jul 2013 12:50:44 +0600 |
parents | 91ff22cc755b 8d4ec56416ef |
children | 38df78aba732 468f434a8d8a |
comparison
equal
deleted
inserted
replaced
1400:9b091098c88c | 1401:3161094869e0 |
---|---|
2096 if (uFaceEvent) | 2096 if (uFaceEvent) |
2097 EventProcessor(uFaceEvent, 0, 1); | 2097 EventProcessor(uFaceEvent, 0, 1); |
2098 } | 2098 } |
2099 | 2099 |
2100 //----- (00473893) -------------------------------------------------------- | 2100 //----- (00473893) -------------------------------------------------------- |
2101 void __cdecl ODM_ProcessPartyActions() | 2101 void ODM_ProcessPartyActions() |
2102 { | 2102 { |
2103 //int _zero; // esi@1 | 2103 //int _zero; // esi@1 |
2104 int v1; // edi@1 | 2104 int v1; // edi@1 |
2105 int v2; // ebx@1 | 2105 int v2; // ebx@1 |
2106 int v3; // eax@14 | 2106 int v3; // eax@14 |
2281 { | 2281 { |
2282 //LOBYTE(pParty->uFlags) &= 0x7Fu; | 2282 //LOBYTE(pParty->uFlags) &= 0x7Fu; |
2283 bWaterWalk = 1; | 2283 bWaterWalk = 1; |
2284 *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; | 2284 *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; |
2285 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) && | 2285 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) && |
2286 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster-1].sMana <= 0 ) | 2286 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 ) |
2287 //*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 10] <= 0 ) | |
2288 bWaterWalk = 0; | 2287 bWaterWalk = 0; |
2289 } | 2288 } |
2290 v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &v130, &v108, bWaterWalk); | 2289 v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &v130, &v108, bWaterWalk); |
2291 v111 = v3; | 2290 v111 = v3; |
2292 if ( bFeatherFall ) | 2291 if ( bFeatherFall ) |
4415 } | 4414 } |
4416 | 4415 |
4417 //----- (0047840D) -------------------------------------------------------- | 4416 //----- (0047840D) -------------------------------------------------------- |
4418 char Render::DrawBuildingsD3D() | 4417 char Render::DrawBuildingsD3D() |
4419 { | 4418 { |
4420 IndoorCameraD3D *v0; // eax@3 | 4419 //IndoorCameraD3D *v0; // eax@3 |
4421 char result; // al@3 | 4420 char result; // al@3 |
4422 BSPModel *v2; // ebx@4 | 4421 BSPModel *v2; // ebx@4 |
4423 int v3; // eax@6 | 4422 int v3; // eax@6 |
4424 ODMFace *pFace; // esi@6 | 4423 ODMFace *pFace; // esi@6 |
4425 Vec3_int_ *v5; // ecx@8 | 4424 Vec3_int_ *v5; // ecx@8 |
4426 int v6; // eax@8 | 4425 int v6; // eax@8 |
4427 stru148 *v7; // ebx@8 | 4426 struct Polygon *v7; // ebx@8 |
4428 LightmapBuilder *v8; // eax@8 | 4427 LightmapBuilder *v8; // eax@8 |
4429 int v9; // ecx@8 | 4428 int v9; // ecx@8 |
4430 char v10; // zf@8 | 4429 char v10; // zf@8 |
4431 Texture *pFaceTexture; // eax@10 | 4430 Texture *pFaceTexture; // eax@10 |
4432 signed int v12; // ecx@10 | 4431 signed int v12; // ecx@10 |
4446 int v24; // eax@50 | 4445 int v24; // eax@50 |
4447 int v25; // ecx@55 | 4446 int v25; // ecx@55 |
4448 int v26; // eax@57 | 4447 int v26; // eax@57 |
4449 int v27; // eax@57 | 4448 int v27; // eax@57 |
4450 int v28; // eax@58 | 4449 int v28; // eax@58 |
4451 int v29; // edx@58 | 4450 //int v29; // edx@58 |
4452 double v30; // st7@59 | 4451 //double v30; // st7@59 |
4453 LightmapBuilder *v31; // edi@63 | 4452 //LightmapBuilder *v31; // edi@63 |
4454 signed int v32; // eax@73 | 4453 signed int v32; // eax@73 |
4455 int v33; // eax@78 | 4454 int v33; // eax@78 |
4456 unsigned int v34; // eax@80 | 4455 unsigned int v34; // eax@80 |
4457 std::string v35; // [sp-18h] [bp-70h]@2 | 4456 std::string v35; // [sp-18h] [bp-70h]@2 |
4458 int v36; // [sp-14h] [bp-6Ch]@69 | 4457 int v36; // [sp-14h] [bp-6Ch]@69 |
4459 RenderVertexSoft *v37; // [sp-10h] [bp-68h]@69 | 4458 RenderVertexSoft *v37; // [sp-10h] [bp-68h]@69 |
4460 int v38; // [sp-Ch] [bp-64h]@69 | 4459 int v38; // [sp-Ch] [bp-64h]@69 |
4461 LightmapBuilder *v39; // [sp-8h] [bp-60h]@2 | 4460 //LightmapBuilder *v39; // [sp-8h] [bp-60h]@2 |
4462 int v40; // [sp-4h] [bp-5Ch]@2 | 4461 int v40; // [sp-4h] [bp-5Ch]@2 |
4463 std::string *v41; // [sp+Ch] [bp-4Ch]@2 | 4462 //std::string *v41; // [sp+Ch] [bp-4Ch]@2 |
4464 int v41b; | 4463 int v41b; |
4465 int v42; // [sp+10h] [bp-48h]@6 | 4464 int v42; // [sp+10h] [bp-48h]@6 |
4466 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8 | 4465 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8 |
4467 float v44; // [sp+18h] [bp-40h]@10 | 4466 float v44; // [sp+18h] [bp-40h]@10 |
4468 float v45; // [sp+1Ch] [bp-3Ch]@10 | 4467 float v45; // [sp+1Ch] [bp-3Ch]@10 |
4469 ODMFace *v46; // [sp+20h] [bp-38h]@6 | 4468 ODMFace *v46; // [sp+20h] [bp-38h]@6 |
4470 IndoorCameraD3D *v47; // [sp+24h] [bp-34h]@3 | 4469 //IndoorCameraD3D *v47; // [sp+24h] [bp-34h]@3 |
4471 unsigned int v48; // [sp+28h] [bp-30h]@8 | 4470 unsigned int v48; // [sp+28h] [bp-30h]@8 |
4472 int v49; // [sp+2Ch] [bp-2Ch]@10 | 4471 int v49; // [sp+2Ch] [bp-2Ch]@10 |
4473 int v50; // [sp+30h] [bp-28h]@34 | 4472 int v50; // [sp+30h] [bp-28h]@34 |
4474 int v51; // [sp+34h] [bp-24h]@35 | 4473 int v51; // [sp+34h] [bp-24h]@35 |
4475 int v52; // [sp+38h] [bp-20h]@36 | 4474 int v52; // [sp+38h] [bp-20h]@36 |
4481 int unused; // [sp+50h] [bp-8h]@3 | 4480 int unused; // [sp+50h] [bp-8h]@3 |
4482 int a3; // [sp+57h] [bp-1h]@2 | 4481 int a3; // [sp+57h] [bp-1h]@2 |
4483 | 4482 |
4484 if ( !pRenderer->pRenderD3D ) | 4483 if ( !pRenderer->pRenderD3D ) |
4485 { | 4484 { |
4486 MessageBoxW(nullptr, L"D3D version of RenderBuildings called in software!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odbuild.cpp:73", 0); | 4485 MessageBoxW(nullptr, L"D3D version of RenderBuildings called in software!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odbuild.cpp:73", 0); |
4487 } | 4486 } |
4487 | |
4488 unused = 0; | 4488 unused = 0; |
4489 v0 = pGame->pIndoorCameraD3D; | |
4490 a1 = 0; | 4489 a1 = 0; |
4491 v47 = v0; | |
4492 result = LOBYTE(pOutdoor->pBModels); | 4490 result = LOBYTE(pOutdoor->pBModels); |
4493 v41b = pOutdoor->uNumBModels; | 4491 v41b = pOutdoor->uNumBModels; |
4494 if ( (signed int)pOutdoor->uNumBModels > 0 ) | 4492 if ( (signed int)pOutdoor->uNumBModels > 0 ) |
4495 { | 4493 { |
4496 v2 = pOutdoor->pBModels; | 4494 v2 = pOutdoor->pBModels; |
4522 goto LABEL_85; | 4520 goto LABEL_85; |
4523 //v5 = (int)*(v2 - 1); | 4521 //v5 = (int)*(v2 - 1); |
4524 v5 = v2->pVertices.pVertices; | 4522 v5 = v2->pVertices.pVertices; |
4525 v6 = pFace->pVertexIDs[0]; | 4523 v6 = pFace->pVertexIDs[0]; |
4526 v53 = 0; | 4524 v53 = 0; |
4527 v7 = &array_77EC08[pOutdoorCamera->numStru148s]; | 4525 v7 = &array_77EC08[pOutdoorCamera->uNumPolygons]; |
4528 //v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8); | 4526 //v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8); |
4529 v8 = (LightmapBuilder *)v5[v6].z; | 4527 v8 = (LightmapBuilder *)v5[v6].z; |
4530 *(int *)&v7->flags = 0; | 4528 v7->flags = 0; |
4529 v7->field_32 = 0; | |
4531 pLightmapBuilder = v8; | 4530 pLightmapBuilder = v8; |
4532 v9 = pFace->uTextureID; | 4531 v9 = pFace->uTextureID; |
4533 v10 = (BYTE1(pFace->uAttributes) & 0x40) == 0; | 4532 v10 = (BYTE1(pFace->uAttributes) & 0x40) == 0; |
4534 v48 = pFace->uTextureID; | 4533 v48 = pFace->uTextureID; |
4535 if ( !v10 ) | 4534 if ( !v10 ) |
4664 { | 4663 { |
4665 //if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) ) | 4664 //if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) ) |
4666 if ( *(float *)&pLightmapBuilder == v23->vWorldPosition.z ) | 4665 if ( *(float *)&pLightmapBuilder == v23->vWorldPosition.z ) |
4667 ++v53; | 4666 ++v53; |
4668 //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); | 4667 //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); |
4669 v47->ViewTransform(v23, 1u); | 4668 pGame->pIndoorCameraD3D->ViewTransform(v23, 1u); |
4670 if ( v23->vWorldViewPosition.x < 8.0 || (double)pOutdoorCamera->shading_dist_mist < v23->vWorldViewPosition.x ) | 4669 if ( v23->vWorldViewPosition.x < 8.0 || (double)pOutdoorCamera->shading_dist_mist < v23->vWorldViewPosition.x ) |
4671 { | 4670 { |
4672 if ( v23->vWorldViewPosition.x >= 8.0 ) | 4671 if ( v23->vWorldViewPosition.x >= 8.0 ) |
4673 v49 = 1; | 4672 v49 = 1; |
4674 else | 4673 else |
4675 v50 = 1; | 4674 v50 = 1; |
4676 } | 4675 } |
4677 else | 4676 else |
4678 { | 4677 { |
4679 v47->Project(v23, 1u, 0); | 4678 pGame->pIndoorCameraD3D->Project(v23, 1u, 0); |
4680 } | 4679 } |
4681 ++v23;// += 48; | 4680 ++v23;// += 48; |
4682 --v51; | 4681 --v51; |
4683 } | 4682 } |
4684 while ( v51 ); | 4683 while ( v51 ); |
4704 v7->dimming_level = result; | 4703 v7->dimming_level = result; |
4705 if ( result < 0 ) | 4704 if ( result < 0 ) |
4706 v7->dimming_level = 0; | 4705 v7->dimming_level = 0; |
4707 if ( v7->dimming_level > 31 ) | 4706 if ( v7->dimming_level > 31 ) |
4708 v7->dimming_level = 31; | 4707 v7->dimming_level = 31; |
4709 if ( pOutdoorCamera->numStru148s >= 1999 + 5000) | 4708 if ( pOutdoorCamera->uNumPolygons >= 1999 + 5000) |
4710 return result; | 4709 return result; |
4711 ++pOutdoorCamera->numStru148s; | 4710 ++pOutdoorCamera->uNumPolygons; |
4712 ++pOutdoorCamera->field_44; | 4711 ++pOutdoorCamera->field_44; |
4713 if ( ODMFace::IsBackfaceCulled(pFace, array_73D150, v7) ) | 4712 if ( ODMFace::IsBackfaceCulled(pFace, array_73D150, v7) ) |
4714 { | 4713 { |
4715 LOBYTE(v25) = (char)v54; | 4714 LOBYTE(v25) = (char)v54; |
4716 v26 = a1; | 4715 v26 = a1; |
4719 LOWORD(v25) = (unsigned __int8)v25; | 4718 LOWORD(v25) = (unsigned __int8)v25; |
4720 v7->uBModelID = v26; | 4719 v7->uBModelID = v26; |
4721 v27 = 8 * (v25 | (v26 << 6)); | 4720 v27 = 8 * (v25 | (v26 << 6)); |
4722 LOBYTE(v27) = v27 | 6; | 4721 LOBYTE(v27) = v27 | 6; |
4723 v7->field_50 = v27; | 4722 v7->field_50 = v27; |
4724 if ( v18 > 0 ) | 4723 |
4724 for (v28 = 0; v28 < v18; ++v28) | |
4725 { | 4725 { |
4726 v28 = 0; | |
4727 v29 = v18; | |
4728 do | |
4729 { | |
4730 v30 = 1.0 / (array_73D150[v28].vWorldViewPosition.x + 0.0000001); | |
4731 memcpy(&array_50AC10[v28], &array_73D150[v28], sizeof(array_50AC10[v28])); | 4726 memcpy(&array_50AC10[v28], &array_73D150[v28], sizeof(array_50AC10[v28])); |
4732 ++v28; | 4727 array_50AC10[v28]._rhw = 1.0 / (array_73D150[v28].vWorldViewPosition.x + 0.0000001); |
4733 --v29; | 4728 |
4734 array_50A2B0[v28 + 49]._rhw = v30; | |
4735 } | |
4736 while ( v29 ); | |
4737 pFace = v46; | 4729 pFace = v46; |
4738 } | 4730 } |
4739 | 4731 |
4740 static stru154 static_RenderBuildingsD3D_stru_73C834; | 4732 static stru154 static_RenderBuildingsD3D_stru_73C834; |
4741 /*static bool __init_flag = false; | 4733 /*static bool __init_flag = false; |
4747 stru154::stru154(&static_RenderBuildingsD3D_stru_73C834); | 4739 stru154::stru154(&static_RenderBuildingsD3D_stru_73C834); |
4748 atexit(loc_4789D4); | 4740 atexit(loc_4789D4); |
4749 }*/ | 4741 }*/ |
4750 | 4742 |
4751 v40 = (int)pFace; | 4743 v40 = (int)pFace; |
4752 pLightmapBuilder = pGame->pLightmapBuilder; | 4744 pGame->pLightmapBuilder->ApplyLights_OutdoorFace(pFace); |
4753 v31 = pLightmapBuilder; | |
4754 pLightmapBuilder->ApplyLights_OutdoorFace(pFace); | |
4755 pDecalBuilder->ApplyDecals_OutdoorFace(pFace); | 4745 pDecalBuilder->ApplyDecals_OutdoorFace(pFace); |
4756 v31->std__vector_000004_size = 0; | 4746 pGame->pLightmapBuilder->std__vector_000004_size = 0; |
4757 LOBYTE(v31) = 0; | 4747 |
4748 int v31 = 0; | |
4758 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | 4749 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) |
4759 { | 4750 { |
4760 v31 = (LightmapBuilder *)(v50 ? 3 : v49 != 0 ? 5 : 0); | 4751 v31 = v50 ? 3 : v49 != 0 ? 5 : 0; |
4761 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(pFace, &v56->pVertices); | 4752 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(pFace, &v56->pVertices); |
4762 if ( pDecalBuilder->uNumDecals > 0 ) | 4753 if ( pDecalBuilder->uNumDecals > 0 ) |
4763 { | 4754 { |
4764 v40 = -1; | 4755 v40 = -1; |
4765 v39 = v31; | |
4766 v38 = 0; | 4756 v38 = 0; |
4767 v37 = array_50AC10; | 4757 v37 = array_50AC10; |
4768 v36 = uNumVertices; | 4758 v36 = uNumVertices; |
4769 pDecalBuilder->ApplyDecals(31 - v7->dimming_level, | 4759 pDecalBuilder->ApplyDecals(31 - v7->dimming_level, |
4770 2, | 4760 2, |
4775 (char)v31, | 4765 (char)v31, |
4776 -1); | 4766 -1); |
4777 } | 4767 } |
4778 } | 4768 } |
4779 if ( stru_F8AD28.uNumLightsApplied > 0 ) | 4769 if ( stru_F8AD28.uNumLightsApplied > 0 ) |
4780 pLightmapBuilder->ApplyLights( | 4770 pGame->pLightmapBuilder->ApplyLights( |
4781 &stru_F8AD28, | 4771 &stru_F8AD28, |
4782 &static_RenderBuildingsD3D_stru_73C834, | 4772 &static_RenderBuildingsD3D_stru_73C834, |
4783 uNumVertices, | 4773 uNumVertices, |
4784 array_50AC10, | 4774 array_50AC10, |
4785 0, | 4775 0, |
4814 } | 4804 } |
4815 pRenderer->DrawPolygon(uNumVertices, v7, pFace, (IDirect3DTexture2 *)v40); | 4805 pRenderer->DrawPolygon(uNumVertices, v7, pFace, (IDirect3DTexture2 *)v40); |
4816 } | 4806 } |
4817 goto LABEL_85; | 4807 goto LABEL_85; |
4818 } | 4808 } |
4819 --pOutdoorCamera->numStru148s; | 4809 --pOutdoorCamera->uNumPolygons; |
4820 --pOutdoorCamera->field_44; | 4810 --pOutdoorCamera->field_44; |
4821 LABEL_85: | 4811 LABEL_85: |
4822 v54 = (Vec3_int_ *)((char *)v54 + 1); | 4812 v54 = (Vec3_int_ *)((char *)v54 + 1); |
4823 v2 = v56; | 4813 v2 = v56; |
4824 ++pFace; | 4814 ++pFace; |
4829 } | 4819 } |
4830 return result; | 4820 return result; |
4831 } | 4821 } |
4832 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag; | 4822 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag; |
4833 | 4823 |
4834 //----- (004789DE) -------------------------------------------------------- | |
4835 BSPModel *Render::DrawBuildingsSW() | |
4836 { | |
4837 BSPModel *result; // eax@1 | |
4838 BSPModel *v1; // ebx@2 | |
4839 int v2; // eax@4 | |
4840 ODMFace *v3; // edi@4 | |
4841 int v4; // ecx@6 | |
4842 int v5; // eax@6 | |
4843 int v6; // ecx@6 | |
4844 int v7; // ecx@6 | |
4845 double v8; // st7@7 | |
4846 char *v9; // ebx@7 | |
4847 int v10; // eax@9 | |
4848 double v11; // st7@9 | |
4849 stru148 *v12; // ebx@19 | |
4850 double v13; // st7@21 | |
4851 double v14; // ST4C_8@23 | |
4852 int v15; // eax@23 | |
4853 int v16; // eax@27 | |
4854 int v17; // ecx@29 | |
4855 unsigned __int8 v18; // sf@29 | |
4856 unsigned __int8 v19; // of@29 | |
4857 int v20; // ecx@30 | |
4858 int v21; // eax@31 | |
4859 int v22; // eax@31 | |
4860 int v23; // eax@35 | |
4861 int v24; // eax@39 | |
4862 Texture *v25; // eax@43 | |
4863 int v26; // esi@43 | |
4864 signed int v27; // ecx@43 | |
4865 double v28; // st6@43 | |
4866 double v29; // st5@43 | |
4867 unsigned short *v30; // edx@44 | |
4868 int v31; // eax@44 | |
4869 double v32; // st4@45 | |
4870 int v33; // ecx@45 | |
4871 char v34; // zf@45 | |
4872 BSPVertexBuffer *v35; // eax@50 | |
4873 unsigned int v36; // eax@53 | |
4874 signed int v37; // esi@53 | |
4875 int v38; // eax@54 | |
4876 signed int v39; // edx@55 | |
4877 char *v40; // ecx@56 | |
4878 double v41; // ST1C_8@57 | |
4879 double v42; // ST24_8@57 | |
4880 signed int v43; // eax@60 | |
4881 signed int v44; // esi@60 | |
4882 int v45; // eax@61 | |
4883 signed int v46; // edx@62 | |
4884 char *v47; // ecx@63 | |
4885 double v48; // ST34_8@64 | |
4886 double v49; // ST44_8@64 | |
4887 int v50; // eax@66 | |
4888 signed int v51; // ecx@67 | |
4889 char *v52; // edx@68 | |
4890 double v53; // ST3C_8@69 | |
4891 double v54; // ST2C_8@69 | |
4892 float v55; // [sp+44h] [bp-7Ch]@50 | |
4893 float v56; // [sp+48h] [bp-78h]@50 | |
4894 float v57; // [sp+4Ch] [bp-74h]@50 | |
4895 float v58; // [sp+50h] [bp-70h]@64 | |
4896 int v59; // [sp+54h] [bp-6Ch]@64 | |
4897 int v60; // [sp+58h] [bp-68h]@69 | |
4898 float v61; // [sp+5Ch] [bp-64h]@64 | |
4899 float v62; // [sp+60h] [bp-60h]@69 | |
4900 float v63; // [sp+64h] [bp-5Ch]@57 | |
4901 float v64; // [sp+68h] [bp-58h]@57 | |
4902 int v65; // [sp+6Ch] [bp-54h]@64 | |
4903 int v66; // [sp+70h] [bp-50h]@1 | |
4904 int v67; // [sp+74h] [bp-4Ch]@6 | |
4905 int v68; // [sp+78h] [bp-48h]@4 | |
4906 int v69; // [sp+7Ch] [bp-44h]@57 | |
4907 int v70; // [sp+80h] [bp-40h]@69 | |
4908 int v71; // [sp+84h] [bp-3Ch]@23 | |
4909 float v72; // [sp+88h] [bp-38h]@69 | |
4910 int v73; // [sp+8Ch] [bp-34h]@57 | |
4911 int v74; // [sp+90h] [bp-30h]@6 | |
4912 int v75; // [sp+94h] [bp-2Ch]@6 | |
4913 ODMFace *v76; // [sp+98h] [bp-28h]@4 | |
4914 int v77; // [sp+9Ch] [bp-24h]@6 | |
4915 BSPModel *v78; // [sp+A0h] [bp-20h]@2 | |
4916 int v79; // [sp+A4h] [bp-1Ch]@4 | |
4917 int a1; // [sp+A8h] [bp-18h]@1 | |
4918 unsigned short *v81; // [sp+ACh] [bp-14h]@7 | |
4919 int v82; // [sp+B0h] [bp-10h]@6 | |
4920 int v83; // [sp+B4h] [bp-Ch]@6 | |
4921 signed int v84; // [sp+B8h] [bp-8h]@7 | |
4922 int a2; // [sp+BCh] [bp-4h]@1 | |
4923 | |
4924 a2 = 0; | |
4925 a1 = 0; | |
4926 result = (BSPModel *)pOutdoor->pBModels; | |
4927 v66 = pOutdoor->uNumBModels; | |
4928 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
4929 { | |
4930 v1 = pOutdoor->pBModels; | |
4931 v78 = pOutdoor->pBModels; | |
4932 while ( 1 ) | |
4933 { | |
4934 if ( IsBModelVisible(a1, &a2) ) | |
4935 { | |
4936 v1->field_40 |= 1u; | |
4937 v2 = v1->uNumFaces; | |
4938 v3 = v1->pFaces; | |
4939 v74 = 0; | |
4940 v76 = v3; | |
4941 v68 = v2; | |
4942 if ( v2 > 0 ) | |
4943 break; | |
4944 } | |
4945 LABEL_73: | |
4946 ++a1; | |
4947 ++v1; | |
4948 result = (BSPModel *)a1; | |
4949 v78 = v1; | |
4950 if ( a1 >= v66 ) | |
4951 return result; | |
4952 } | |
4953 while ( 1 ) | |
4954 { | |
4955 if ( !v3->Invisible() ) | |
4956 { | |
4957 v4 = 3 * v3->pVertexIDs[0]; | |
4958 v5 = (int)((char *)v1 - 8); | |
4959 v67 = (int)((char *)v1 - 8); | |
4960 v6 = *(_DWORD *)(*(&v1->uNumConvexFaces - 2) + 4 * v4 + 8) + 4; | |
4961 v82 = 0; | |
4962 v83 = v6; | |
4963 v74 = 0; | |
4964 v7 = v3->uNumVertices; | |
4965 v75 = 0; | |
4966 v77 = v7; | |
4967 if ( v7 > 0 ) | |
4968 { | |
4969 v8 = (double)v83; | |
4970 v9 = (char *)&array_73D150[0].vWorldViewPosition; | |
4971 v81 = v3->pVertexIDs; | |
4972 v83 = v7; | |
4973 *(float *)&v84 = v8; | |
4974 while ( 1 ) | |
4975 { | |
4976 v10 = *(int *)(v5 + 4) + 12 * *(short *)v81; | |
4977 *((float *)v9 - 3) = (double)*(signed int *)v10 + 4.0; | |
4978 *((float *)v9 - 2) = (double)*(signed int *)(v10 + 4) + 4.0; | |
4979 v11 = (double)*(signed int *)(v10 + 8) + 4.0; | |
4980 *((float *)v9 - 1) = v11; | |
4981 if ( *(float *)&v84 == v11 ) | |
4982 ++v82; | |
4983 pGame->pIndoorCameraD3D->ViewTransform((RenderVertexSoft *)(v9 - 12), 1u); | |
4984 if ( *(float *)v9 < 8.0 || (double)pOutdoorCamera->shading_dist_mist < *(float *)v9 ) | |
4985 { | |
4986 if ( *(float *)v9 >= 8.0 ) | |
4987 v75 = 1; | |
4988 else | |
4989 v74 = 1; | |
4990 } | |
4991 else | |
4992 { | |
4993 pGame->pIndoorCameraD3D->Project((RenderVertexSoft *)(v9 - 12), 1u, 0); | |
4994 } | |
4995 v81 += 2; | |
4996 v9 += 48; | |
4997 --v83; | |
4998 if ( !v83 ) | |
4999 break; | |
5000 v5 = v67; | |
5001 } | |
5002 v7 = v77; | |
5003 } | |
5004 v12 = &array_77EC08[pOutdoorCamera->numStru148s]; | |
5005 *(int *)&v12->flags = 0; | |
5006 if ( v82 == v7 ) | |
5007 *(int *)&v12->flags = 65536; | |
5008 v12->pODMFace = v3; | |
5009 v12->uNumVertices = v7; | |
5010 v12->field_59 = 5; | |
5011 v84 = v3->pFacePlane.vNormal.x; | |
5012 v83 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.x) >> 16; | |
5013 v82 = -pOutdoor->vSunlight.y; | |
5014 v84 = v3->pFacePlane.vNormal.y; | |
5015 v82 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.y) >> 16; | |
5016 v81 = (unsigned __int16 *)-pOutdoor->vSunlight.z; | |
5017 v84 = v3->pFacePlane.vNormal.z; | |
5018 v81 = (unsigned __int16 *)((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16); | |
5019 v84 = v83 + v82 + ((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16); | |
5020 v13 = (double)v84 * 0.000015258789; | |
5021 if ( v13 < 0.0 ) | |
5022 v13 = 0.0; | |
5023 *(float *)&v84 = v13 * 31.0; | |
5024 v14 = *(float *)&v84 + 6.7553994e15; | |
5025 v71 = LODWORD(v14); | |
5026 v15 = (int)&v12->dimming_level; | |
5027 v12->dimming_level = 31 - LOBYTE(v14); | |
5028 if ( (char)(31 - LOBYTE(v14)) < 0 ) | |
5029 *(char *)v15 = 0; | |
5030 if ( *(char *)v15 > 31 ) | |
5031 *(char *)v15 = 31; | |
5032 v16 = v3->uTextureID; | |
5033 if ( BYTE1(v3->uAttributes) & 0x40 ) | |
5034 v16 = pTextureFrameTable->GetFrameTexture(v16, pEventTimer->uTotalGameTimeElapsed); | |
5035 v17 = v16; | |
5036 result = (BSPModel *)&pBitmaps_LOD->pTextures[v16]; | |
5037 v19 = __OFSUB__(pOutdoorCamera->numStru148s, 1999); | |
5038 v18 = pOutdoorCamera->numStru148s - 1999 < 0; | |
5039 v12->pTexture = (Texture *)(v17 != -1 ? (int)result : 0); | |
5040 if ( !(v18 ^ v19) ) | |
5041 return result; | |
5042 ++pOutdoorCamera->numStru148s; | |
5043 ++pOutdoorCamera->field_44; | |
5044 if ( !ODMFace::IsBackfaceCulled(v3, array_73D150, v12) ) | |
5045 { | |
5046 LABEL_71: | |
5047 --pOutdoorCamera->numStru148s; | |
5048 --pOutdoorCamera->field_44; | |
5049 goto LABEL_72; | |
5050 } | |
5051 LOBYTE(v20) = v79; | |
5052 v21 = a1; | |
5053 v3->bVisible = 1; | |
5054 v12->uBModelFaceID = v20; | |
5055 LOWORD(v20) = (unsigned __int8)v20; | |
5056 v12->uBModelID = v21; | |
5057 v22 = 8 * (v20 | (v21 << 6)); | |
5058 LOBYTE(v22) = v22 | 6; | |
5059 v12->field_50 = v22; | |
5060 if ( v3->uAttributes & 0x10 ) | |
5061 *(int *)&v12->flags |= 2u; | |
5062 if ( BYTE2(v3->uAttributes) & 0x40 ) | |
5063 HIBYTE(v12->flags) |= 4u; | |
5064 v23 = v3->uAttributes; | |
5065 if ( v23 & 4 ) | |
5066 { | |
5067 HIBYTE(v12->flags) |= 4u; | |
5068 } | |
5069 else | |
5070 { | |
5071 if ( v23 & 0x20 ) | |
5072 HIBYTE(v12->flags) |= 8u; | |
5073 } | |
5074 v24 = v3->uAttributes; | |
5075 if ( BYTE1(v24) & 8 ) | |
5076 { | |
5077 HIBYTE(v12->flags) |= 0x20u; | |
5078 } | |
5079 else | |
5080 { | |
5081 if ( v24 & 0x40 ) | |
5082 HIBYTE(v12->flags) |= 0x10u; | |
5083 } | |
5084 v25 = v12->pTexture; | |
5085 v26 = v77; | |
5086 v27 = v25->uTextureWidth; | |
5087 v84 = v25->uTextureHeight; | |
5088 v28 = 1.0 / (double)v27; | |
5089 v29 = 1.0 / (double)v84; | |
5090 if ( v77 > 0 ) | |
5091 { | |
5092 v30 = v3->pTextureVIDs; | |
5093 v31 = 0; | |
5094 v83 = v77; | |
5095 do | |
5096 { | |
5097 v32 = 1.0 / (*(float *)(v31 * 48 + 7590236) + 0.0000001); | |
5098 memcpy(&array_50AC10[v31], &array_73D150[v31], sizeof(array_50AC10[v31])); | |
5099 ++v31; | |
5100 array_50A2B0[v31 + 49]._rhw = v32; | |
5101 v84 = v12->sTextureDeltaU + *(short *)(v30 - 40); | |
5102 array_50A2B0[v31 + 49].u = (double)v84 * v28; | |
5103 v33 = v12->sTextureDeltaV + *(short *)v30; | |
5104 v30 += 2; | |
5105 v34 = v83-- == 1; | |
5106 v84 = v33; | |
5107 array_50A2B0[v31 + 49].v = (double)v33 * v29; | |
5108 } | |
5109 while ( !v34 ); | |
5110 v3 = v76; | |
5111 v26 = v77; | |
5112 } | |
5113 | |
5114 static stru154 static_sub_004789DE_stru_73C818; // idb | |
5115 /*static bool __init_flag = false; | |
5116 if (!__init_flag) | |
5117 { | |
5118 __init_flag = true; | |
5119 | |
5120 static_sub_004789DE_byte_73C830__init_flag |= 1u; | |
5121 stru154::stru154(&static_sub_004789DE_stru_73C818); | |
5122 }*/ | |
5123 | |
5124 pGame->pLightmapBuilder->ApplyLights_OutdoorFace((ODMFace *)v3); | |
5125 if ( stru_F8AD28.uNumLightsApplied <= 0 ) | |
5126 { | |
5127 v12->field_108 = 0; | |
5128 } | |
5129 else | |
5130 { | |
5131 v35 = (BSPVertexBuffer *)(v78 - 2); | |
5132 v12->field_108 = 1; | |
5133 | |
5134 static_sub_004789DE_stru_73C818.GetFacePlaneAndClassify((ODMFace *)v3, v35); | |
5135 v55 = static_sub_004789DE_stru_73C818.face_plane.vNormal.x; | |
5136 v56 = static_sub_004789DE_stru_73C818.face_plane.vNormal.y; | |
5137 v57 = static_sub_004789DE_stru_73C818.face_plane.vNormal.z; | |
5138 pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, v26, (Vec3_float_ *)&v55); | |
5139 } | |
5140 if ( v74 ) | |
5141 { | |
5142 v36 = sr_4250FE(v26); | |
5143 v37 = v36; | |
5144 if ( !v36 || (OutdoorCamera::Project(v36), v38 = sr_4254D2(v37), (v12->uNumVertices = v38) == 0) ) | |
5145 goto LABEL_71; | |
5146 v12->_48276F_sr(); | |
5147 v39 = 0; | |
5148 if ( (signed int)v12->uNumVertices > 0 ) | |
5149 { | |
5150 v40 = (char *)&array_508690[0].vWorldViewProjY; | |
5151 do | |
5152 { | |
5153 LODWORD(v64) = *((int *)v40 - 1); | |
5154 v41 = v64 + 6.7553994e15; | |
5155 v69 = LODWORD(v41); | |
5156 dword_50B638[v39] = LODWORD(v41); | |
5157 LODWORD(v63) = *(int *)v40; | |
5158 v42 = v63 + 6.7553994e15; | |
5159 v73 = LODWORD(v42); | |
5160 v40 += 48; | |
5161 dword_50B570[v39++] = LODWORD(v42); | |
5162 } | |
5163 while ( v39 < (signed int)v12->uNumVertices ); | |
5164 } | |
5165 } | |
5166 else | |
5167 { | |
5168 if ( v75 ) | |
5169 { | |
5170 v43 = sr_4252E8(v26); | |
5171 v44 = v43; | |
5172 if ( !v43 || (OutdoorCamera::Project(v43), v45 = sr_4254D2(v44), (v12->uNumVertices = v45) == 0) ) | |
5173 goto LABEL_71; | |
5174 v12->_48276F_sr(); | |
5175 v46 = 0; | |
5176 if ( (signed int)v12->uNumVertices > 0 ) | |
5177 { | |
5178 v47 = (char *)&array_508690[0].vWorldViewProjY; | |
5179 do | |
5180 { | |
5181 LODWORD(v61) = *((int *)v47 - 1); | |
5182 v48 = v61 + 6.7553994e15; | |
5183 v65 = LODWORD(v48); | |
5184 dword_50B638[v46] = LODWORD(v48); | |
5185 LODWORD(v58) = *(int *)v47; | |
5186 v49 = v58 + 6.7553994e15; | |
5187 v59 = LODWORD(v49); | |
5188 v47 += 48; | |
5189 dword_50B570[v46++] = LODWORD(v49); | |
5190 } | |
5191 while ( v46 < (signed int)v12->uNumVertices ); | |
5192 } | |
5193 } | |
5194 else | |
5195 { | |
5196 v50 = sr_4254D2(v26); | |
5197 v12->uNumVertices = v50; | |
5198 if ( !v50 ) | |
5199 goto LABEL_71; | |
5200 sr_sub_4829B9( | |
5201 &array_73D150[v3->uGradientVertex1], | |
5202 &array_73D150[v3->uGradientVertex2], | |
5203 &array_73D150[v3->uGradientVertex3], | |
5204 v12, | |
5205 0); | |
5206 v51 = 0; | |
5207 if ( (signed int)v12->uNumVertices > 0 ) | |
5208 { | |
5209 v52 = (char *)&array_508690[0].vWorldViewProjY; | |
5210 do | |
5211 { | |
5212 LODWORD(v62) = *((int *)v52 - 1); | |
5213 v53 = v62 + 6.7553994e15; | |
5214 v60 = LODWORD(v53); | |
5215 dword_50B638[v51] = LODWORD(v53); | |
5216 LODWORD(v72) = *(int *)v52; | |
5217 v54 = v72 + 6.7553994e15; | |
5218 v70 = LODWORD(v54); | |
5219 v52 += 48; | |
5220 dword_50B570[v51++] = LODWORD(v54); | |
5221 } | |
5222 while ( v51 < (signed int)v12->uNumVertices ); | |
5223 } | |
5224 } | |
5225 } | |
5226 sr_sub_486B4E_push_outdoor_edges(array_508690, dword_50B638.data(), dword_50B570.data(), v12); | |
5227 } | |
5228 LABEL_72: | |
5229 ++v79; | |
5230 v1 = v78; | |
5231 ++v3; | |
5232 v76 = v3; | |
5233 if ( v79 >= v68 ) | |
5234 goto LABEL_73; | |
5235 } | |
5236 } | |
5237 return result; | |
5238 } | |
5239 // 50B570: using guessed type int dword_50B570[]; | |
5240 // 50B638: using guessed type int dword_50B638[]; | |
5241 // 73C830: using guessed type char static_sub_004789DE_byte_73C830__init_flag; | |
5242 | 4824 |
5243 //----- (00479089) -------------------------------------------------------- | 4825 //----- (00479089) -------------------------------------------------------- |
5244 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable) | 4826 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable) |
5245 { | 4827 { |
5246 BSPModel *v2; // eax@1 | 4828 BSPModel *v2; // eax@1 |
5308 } | 4890 } |
5309 return false; | 4891 return false; |
5310 } | 4892 } |
5311 | 4893 |
5312 //----- (00479295) -------------------------------------------------------- | 4894 //----- (00479295) -------------------------------------------------------- |
5313 int stru148::_479295() | 4895 int Polygon::_479295() |
5314 { | 4896 { |
5315 stru148 *v1; // edi@1 | |
5316 ODMFace *v2; // esi@1 | 4897 ODMFace *v2; // esi@1 |
5317 int v3; // ecx@4 | 4898 int v3; // ecx@4 |
5318 int v4; // eax@4 | 4899 int v4; // eax@4 |
5319 int v5; // edx@4 | 4900 int v5; // edx@4 |
5320 int v6; // ST14_4@5 | 4901 int v6; // ST14_4@5 |
5321 int v7; // ST04_4@5 | 4902 int v7; // ST04_4@5 |
5322 stru149 *v8; // ecx@5 | 4903 stru149 *v8; // ecx@5 |
5323 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8 | 4904 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8 |
5324 int v11; // [sp+18h] [bp-4h]@4 | 4905 int v11; // [sp+18h] [bp-4h]@4 |
5325 | 4906 |
5326 v1 = this; | |
5327 v2 = this->pODMFace; | 4907 v2 = this->pODMFace; |
5328 if ( !v2->pFacePlane.vNormal.z ) | 4908 if ( !v2->pFacePlane.vNormal.z ) |
5329 { | 4909 { |
5330 v3 = v2->pFacePlane.vNormal.x; | 4910 v3 = v2->pFacePlane.vNormal.x; |
5331 v4 = -v2->pFacePlane.vNormal.y; | 4911 v4 = -v2->pFacePlane.vNormal.y; |
5348 v4 = 65536; | 4928 v4 = 65536; |
5349 v11 = 0; | 4929 v11 = 0; |
5350 v5 = -65536; | 4930 v5 = -65536; |
5351 LABEL_5: | 4931 LABEL_5: |
5352 v6 = v11; | 4932 v6 = v11; |
5353 v1->sTextureDeltaU = v2->sTextureDeltaU; | 4933 sTextureDeltaU = v2->sTextureDeltaU; |
5354 v7 = v3; | 4934 v7 = v3; |
5355 v8 = v1->ptr_38; | 4935 v8 = ptr_38; |
5356 v1->sTextureDeltaV = v2->sTextureDeltaV; | 4936 sTextureDeltaV = v2->sTextureDeltaV; |
5357 v8->_48616B(v4, v7, 0, 0, v5, v6); | 4937 v8->_48616B(v4, v7, 0, 0, v5, v6); |
5358 return 1; | 4938 return 1; |
5359 } | 4939 } |
5360 | 4940 |
5361 //----- (00479332) -------------------------------------------------------- | |
5362 int Render::OnOutdoorRedrawSW() | |
5363 { | |
5364 signed int result; // eax@1 | |
5365 unsigned int v1; // edi@1 | |
5366 char *v2; // esi@2 | |
5367 char v3; // cl@3 | |
5368 double v4; // st7@4 | |
5369 float v5; // ST34_4@6 | |
5370 double v6; // ST24_8@6 | |
5371 int v7; // eax@6 | |
5372 unsigned int v8; // eax@11 | |
5373 signed int v9; // eax@13 | |
5374 Vec3_float_ *v10; // eax@14 | |
5375 double v11; // st7@17 | |
5376 float v12; // ST34_4@19 | |
5377 double v13; // ST1C_8@19 | |
5378 float v14; // [sp+4h] [bp-34h]@1 | |
5379 float v15; // [sp+8h] [bp-30h]@1 | |
5380 float v16; // [sp+Ch] [bp-2Ch]@1 | |
5381 | |
5382 v14 = (double)pOutdoor->vSunlight.x / 65536.0; | |
5383 result = 0; | |
5384 v1 = (unsigned int)&array_77EC08[pOutdoorCamera->numStru148s]; | |
5385 v15 = (double)pOutdoor->vSunlight.y / 65536.0; | |
5386 v16 = (double)pOutdoor->vSunlight.z / 65536.0; | |
5387 if ( v1 > (unsigned int)array_77EC08.data() ) | |
5388 { | |
5389 v2 = (char *)&array_77EC08[0].pODMFace; | |
5390 while ( 1 ) | |
5391 { | |
5392 v3 = v2[5]; | |
5393 if ( v3 == 5 ) | |
5394 break; | |
5395 if ( v3 == 1 ) | |
5396 { | |
5397 v9 = pTerrainNormalIndices[((*((int *)v2 - 9) >> 15) & 1) | |
5398 + 2 * ((unsigned __int8)v2[9] + ((unsigned __int8)v2[8] << 7))]; | |
5399 if ( v9 > (signed int)(uNumTerrainNormals - 1) ) | |
5400 v10 = 0; | |
5401 else | |
5402 v10 = &pTerrainNormals[v9]; | |
5403 if ( v10 ) | |
5404 { | |
5405 v11 = -(v16 * v10->z + v15 * v10->y + v14 * v10->x); | |
5406 if ( v11 < 0.0 ) | |
5407 v11 = 0.0; | |
5408 v12 = v11 * 31.0; | |
5409 v13 = v12 + 6.7553994e15; | |
5410 v2[4] = 31 - LOBYTE(v13); | |
5411 } | |
5412 else | |
5413 { | |
5414 v2[4] = 0; | |
5415 } | |
5416 if ( v2[4] < 0 ) | |
5417 v2[4] = 0; | |
5418 goto LABEL_23; | |
5419 } | |
5420 LABEL_24: | |
5421 v2 += 268; | |
5422 if ( (unsigned int)(v2 - 84) >= v1 ) | |
5423 return result; | |
5424 } | |
5425 v4 = (double)(signed int)(((unsigned __int64)(**(int **)v2 * (signed __int64)-pOutdoor->vSunlight.x) >> 16) | |
5426 + ((unsigned __int64)(*(int *)(*(int *)v2 + 4) * (signed __int64)-pOutdoor->vSunlight.y) >> 16) | |
5427 + ((unsigned __int64)(*(int *)(*(int *)v2 + 8) * (signed __int64)-pOutdoor->vSunlight.z) >> 16)) | |
5428 * 0.000015258789; | |
5429 if ( v4 < 0.0 ) | |
5430 v4 = 0.0; | |
5431 v5 = v4 * 31.0; | |
5432 v6 = v5 + 6.7553994e15; | |
5433 v7 = (int)(v2 + 4); | |
5434 v2[4] = 31 - LOBYTE(v6); | |
5435 if ( (char)(31 - LOBYTE(v6)) < 0 ) | |
5436 *(char *)v7 = 0; | |
5437 if ( *(char *)v7 > 31 ) | |
5438 *(char *)v7 = 31; | |
5439 if ( *(char *)(*(int *)v2 + 29) & 0x40 ) | |
5440 { | |
5441 v8 = pTextureFrameTable->GetFrameTexture( | |
5442 *((short *)v2 - 4), | |
5443 pEventTimer->uTotalGameTimeElapsed); | |
5444 *((int *)v2 - 6) = v8 != -1 ? (int)&pBitmaps_LOD->pTextures[v8] : 0; | |
5445 } | |
5446 LABEL_23: | |
5447 result = 1; | |
5448 goto LABEL_24; | |
5449 } | |
5450 return result; | |
5451 } | |
5452 | 4941 |
5453 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr) | 4942 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr) |
5454 { | 4943 { |
5455 #pragma pack(push, 1) | 4944 #pragma pack(push, 1) |
5456 struct TGAHeader | 4945 struct TGAHeader |
5938 int v14; // ecx@6 | 5427 int v14; // ecx@6 |
5939 //int v15; // eax@8 | 5428 //int v15; // eax@8 |
5940 int v16; // eax@12 | 5429 int v16; // eax@12 |
5941 signed __int64 v17; // qtt@13 | 5430 signed __int64 v17; // qtt@13 |
5942 signed int pShading; // ecx@13 | 5431 signed int pShading; // ecx@13 |
5943 stru148 pSky; // [sp+14h] [bp-150h]@1 | 5432 struct Polygon pSky; // [sp+14h] [bp-150h]@1 |
5944 float v28; // [sp+12Ch] [bp-38h]@2 | 5433 float v28; // [sp+12Ch] [bp-38h]@2 |
5945 int v29; // [sp+130h] [bp-34h]@4 | 5434 int v29; // [sp+130h] [bp-34h]@4 |
5946 int v30; // [sp+134h] [bp-30h]@1 | 5435 int v30; // [sp+134h] [bp-30h]@1 |
5947 int v32; // [sp+13Ch] [bp-28h]@6 | 5436 int v32; // [sp+13Ch] [bp-28h]@6 |
5948 int v33; // [sp+140h] [bp-24h]@2 | 5437 int v33; // [sp+140h] [bp-24h]@2 |
6355 return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1); | 5844 return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1); |
6356 } | 5845 } |
6357 v7 = 0; | 5846 v7 = 0; |
6358 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1); | 5847 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1); |
6359 } | 5848 } |
6360 // 6BE030: using guessed type int day_attrib; | |
6361 // 6BE040: using guessed type int day_fogrange_1; | |
6362 // 6BE044: using guessed type int day_fogrange_2; | |
6363 | |
6364 //----- (0047BEB1) -------------------------------------------------------- | |
6365 int __fastcall sr_sub_47BEB1(signed int a1, stru148 *a2, int terrain_gamma, int a4, int *a5, int *a6, int a7, int a8) | |
6366 { | |
6367 stru148 *v8; // ebx@1 | |
6368 signed int v9; // edx@1 | |
6369 int v10; // eax@5 | |
6370 signed int v11; // eax@9 | |
6371 signed int v12; // eax@15 | |
6372 signed __int64 v13; // qtt@21 | |
6373 int *v14; // ecx@30 | |
6374 int *v15; // edi@30 | |
6375 int v16; // ebx@32 | |
6376 signed __int64 v17; // qtt@37 | |
6377 double v18; // ST10_8@37 | |
6378 double v19; // ST10_8@38 | |
6379 int v20; // edi@39 | |
6380 int result; // eax@46 | |
6381 int *v22; // eax@48 | |
6382 signed int v23; // edx@51 | |
6383 signed __int64 v24; // qtt@51 | |
6384 int v25; // ecx@51 | |
6385 signed int v26; // [sp+14h] [bp-4h]@1 | |
6386 float v27; // [sp+28h] [bp+10h]@37 | |
6387 float v28; // [sp+28h] [bp+10h]@38 | |
6388 int v29; // [sp+2Ch] [bp+14h]@37 | |
6389 | |
6390 v8 = a2; | |
6391 v9 = a1; | |
6392 v26 = a1; | |
6393 if ( pParty->armageddon_timer ) | |
6394 { | |
6395 *a5 = -1; | |
6396 *a6 = -1; | |
6397 *(char *)a7 = 1; | |
6398 LABEL_46: | |
6399 result = a8; | |
6400 *(char *)a8 = 0; | |
6401 return result; | |
6402 } | |
6403 if ( a1 < 0 ) | |
6404 { | |
6405 v26 = v8->field_34 << 16; | |
6406 v9 = v8->field_34 << 16; | |
6407 } | |
6408 v10 = pWeather->bNight; | |
6409 if ( bUnderwater == 1 ) | |
6410 v10 = 0; | |
6411 if ( !v10 ) | |
6412 { | |
6413 if ( !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater ) | |
6414 { | |
6415 v14 = a5; | |
6416 v15 = a6; | |
6417 if ( !v9 ) | |
6418 { | |
6419 *a5 = 31; | |
6420 *a6 = -1; | |
6421 } | |
6422 v16 = v8->dimming_level - terrain_gamma; | |
6423 if ( v16 >= 0 ) | |
6424 { | |
6425 if ( v16 > 27 ) | |
6426 v16 = 27; | |
6427 } | |
6428 else | |
6429 { | |
6430 v16 = 0; | |
6431 } | |
6432 *a6 = 27; | |
6433 if ( a4 ) | |
6434 { | |
6435 v28 = pOutdoor->fFogDensity * 27.0; | |
6436 v19 = v28 + 6.7553994e15; | |
6437 v29 = LODWORD(v19); | |
6438 } | |
6439 else | |
6440 { | |
6441 LODWORD(v17) = v9 << 16; | |
6442 HIDWORD(v17) = v9 >> 16; | |
6443 v27 = (double)(signed int)(((unsigned __int64)(v17 / (pOutdoorCamera->shading_dist_shade << 16) * (31 - *a6)) >> 16) | |
6444 + *a6) | |
6445 * pOutdoor->fFogDensity; | |
6446 v18 = v27 + 6.7553994e15; | |
6447 v29 = LODWORD(v18); | |
6448 } | |
6449 *v14 = v16 + v29; | |
6450 v20 = *v15; | |
6451 if ( v16 + v29 > v20 ) | |
6452 *v14 = v20; | |
6453 if ( *v14 < v16 ) | |
6454 *v14 = v16; | |
6455 if ( *v14 > pOutdoor->max_terrain_dimming_level ) | |
6456 *v14 = pOutdoor->max_terrain_dimming_level; | |
6457 goto LABEL_45; | |
6458 } | |
6459 if ( v9 >= day_fogrange_1 << 16 ) | |
6460 { | |
6461 if ( v9 <= day_fogrange_2 << 16 ) | |
6462 { | |
6463 v23 = v9 - (day_fogrange_1 << 16); | |
6464 LODWORD(v24) = v23 << 16; | |
6465 HIDWORD(v24) = v23 >> 16; | |
6466 v25 = (unsigned __int64)(27 * v24 / ((day_fogrange_2 - day_fogrange_1) << 16)) >> 16; | |
6467 v22 = a5; | |
6468 *a5 = v25; | |
6469 if ( v25 > 27 ) | |
6470 goto LABEL_54; | |
6471 v9 = v26; | |
6472 } | |
6473 else | |
6474 { | |
6475 v22 = a5; | |
6476 *a5 = 27; | |
6477 } | |
6478 } | |
6479 else | |
6480 { | |
6481 v22 = a5; | |
6482 *a5 = 0; | |
6483 } | |
6484 if ( v9 ) | |
6485 { | |
6486 LABEL_55: | |
6487 if ( a4 ) | |
6488 *v22 = 31; | |
6489 *a6 = 31; | |
6490 *(char *)a7 = 0; | |
6491 goto LABEL_59; | |
6492 } | |
6493 LABEL_54: | |
6494 *v22 = 27; | |
6495 goto LABEL_55; | |
6496 } | |
6497 if ( v10 == 1 ) | |
6498 { | |
6499 v11 = 1; | |
6500 if ( byte_4D864C && BYTE1(pGame->uFlags) & 0x10 ) | |
6501 { | |
6502 v12 = 0; | |
6503 } | |
6504 else | |
6505 { | |
6506 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) | |
6507 { | |
6508 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime <= 0 ) | |
6509 v11 = 0; | |
6510 else | |
6511 v11 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; | |
6512 } | |
6513 v12 = v11 << 26; | |
6514 } | |
6515 if ( a4 ) | |
6516 goto LABEL_24; | |
6517 if ( v9 <= v12 ) | |
6518 { | |
6519 if ( v9 > 0 ) | |
6520 { | |
6521 LODWORD(v13) = v9 << 16; | |
6522 HIDWORD(v13) = v9 >> 16; | |
6523 v9 = v26; | |
6524 *a5 = (unsigned __int64)(27 * v13 / v12) >> 16; | |
6525 } | |
6526 if ( *a5 > 27 ) | |
6527 goto LABEL_24; | |
6528 } | |
6529 else | |
6530 { | |
6531 *a5 = 27; | |
6532 } | |
6533 if ( v9 ) | |
6534 { | |
6535 LABEL_25: | |
6536 if ( v8->field_32 & 4 ) | |
6537 *a5 = 27; | |
6538 *a6 = 27; | |
6539 LABEL_45: | |
6540 *(char *)a7 = 0; | |
6541 goto LABEL_46; | |
6542 } | |
6543 LABEL_24: | |
6544 *a5 = 27; | |
6545 goto LABEL_25; | |
6546 } | |
6547 *a5 = -1; | |
6548 *a6 = -1; | |
6549 *(char *)a7 = 1; | |
6550 LABEL_59: | |
6551 result = a8; | |
6552 *(char *)a8 = 1; | |
6553 return result; | |
6554 } | |
6555 | |
6556 //----- (0047C178) -------------------------------------------------------- | |
6557 void *__fastcall sr_sub_47C178(signed int a1, stru148 *a2, int terrain_gamma, int a4) | |
6558 { | |
6559 stru148 *v4; // esi@1 | |
6560 void *result; // eax@2 | |
6561 int v6; // [sp+4h] [bp-8h]@3 | |
6562 int v7; // [sp+8h] [bp-4h]@3 | |
6563 | |
6564 v4 = a2; | |
6565 if ( pParty->armageddon_timer ) | |
6566 { | |
6567 result = PaletteManager::Get(a2->pTexture->palette_id2); | |
6568 } | |
6569 else | |
6570 { | |
6571 sr_sub_47BEB1(a1, a2, terrain_gamma, a4, &v6, &v7, (int)((char *)&terrain_gamma + 3), (int)((char *)&a4 + 3)); | |
6572 result = sr_sub_47C1CA(v4, SBYTE3(a4), v6, v7); | |
6573 } | |
6574 return result; | |
6575 } | |
6576 | |
6577 //----- (0047C1CA) -------------------------------------------------------- | |
6578 void *__fastcall sr_sub_47C1CA(stru148 *a1, char a2, int a3, signed int a4) | |
6579 { | |
6580 stru148 *v4; // esi@1 | |
6581 void *result; // eax@2 | |
6582 int v6; // edx@3 | |
6583 int v7; // ecx@8 | |
6584 int a3a; // [sp+4h] [bp-8h]@1 | |
6585 char v9; // [sp+8h] [bp-4h]@1 | |
6586 | |
6587 v9 = a2; | |
6588 v4 = a1; | |
6589 a3a = 1; | |
6590 if ( pParty->armageddon_timer ) | |
6591 { | |
6592 result = PaletteManager::Get(a1->pTexture->palette_id2); | |
6593 } | |
6594 else | |
6595 { | |
6596 v6 = pGame->_44EC23(a1, &a3a, a4); | |
6597 if ( v6 == -1 ) | |
6598 v6 = a3; | |
6599 if ( v9 == 1 ) | |
6600 { | |
6601 if ( v6 != -1 || a4 != -1 ) | |
6602 { | |
6603 v7 = v4->pTexture->palette_id2; | |
6604 } | |
6605 else | |
6606 { | |
6607 v6 = 0; | |
6608 v7 = 0; | |
6609 } | |
6610 result = PaletteManager::Get_Mist_or_Red_LUT(v7, v6, a3a); | |
6611 } | |
6612 else | |
6613 { | |
6614 result = PaletteManager::Get_Dark_or_Red_LUT(v4->pTexture->palette_id2, v6, a3a); | |
6615 } | |
6616 } | |
6617 return result; | |
6618 } | |
6619 | |
6620 //----- (0047C24C) -------------------------------------------------------- | |
6621 unsigned __int16 *__fastcall sr_sub_47C24C_get_palette(BLVFace *a1, int a2, int a3, char a4) | |
6622 { | |
6623 int v4; // esi@1 | |
6624 int v5; // eax@2 | |
6625 int a3a; // [sp+4h] [bp-4h]@1 | |
6626 | |
6627 v4 = a2; | |
6628 a3a = 1; | |
6629 if ( a4 ) | |
6630 { | |
6631 v5 = pGame->_44ED0A(a1, &a3a, 31); | |
6632 if ( v5 != -1 ) | |
6633 a3 = v5; | |
6634 } | |
6635 return PaletteManager::Get_Dark_or_Red_LUT(v4, a3, a3a); | |
6636 } | |
6637 | |
6638 //----- (0047C28C) -------------------------------------------------------- | |
6639 char *__fastcall sr_sub_47C28C_get_palette(stru148 *a1, char a2, signed int a3, signed int a4) | |
6640 { | |
6641 stru148 *v4; // esi@1 | |
6642 char *result; // eax@2 | |
6643 signed int v6; // eax@3 | |
6644 int v7; // ecx@8 | |
6645 int a2a; // [sp+4h] [bp-8h]@1 | |
6646 char v9; // [sp+8h] [bp-4h]@1 | |
6647 | |
6648 v9 = a2; | |
6649 v4 = a1; | |
6650 a2a = 1; | |
6651 if ( pParty->armageddon_timer ) | |
6652 { | |
6653 result = (char *)pPaletteManager->field_199600_palettes[a1->pTexture->palette_id2]; | |
6654 } | |
6655 else | |
6656 { | |
6657 v6 = pGame->_44EC23(a1, &a2a, a4); | |
6658 if ( v6 != -1 ) | |
6659 a3 = v6; | |
6660 if ( v9 == 1 ) | |
6661 { | |
6662 if ( a3 != -1 || a4 != -1 ) | |
6663 v7 = v4->pTexture->palette_id2; | |
6664 else | |
6665 v7 = 0; | |
6666 result = (char *)PaletteManager::_47C30E_get_palette(v7, a2a); | |
6667 } | |
6668 else | |
6669 { | |
6670 result = (char *)PaletteManager::_47C33F_get_palette(v4->pTexture->palette_id2, a2a); | |
6671 } | |
6672 } | |
6673 return result; | |
6674 } | |
6675 // 4D864C: using guessed type char byte_4D864C; | |
6676 | 5849 |
6677 //----- (0047C370) -------------------------------------------------------- | 5850 //----- (0047C370) -------------------------------------------------------- |
6678 unsigned int __cdecl GetLevelFogColor() | 5851 unsigned int __cdecl GetLevelFogColor() |
6679 { | 5852 { |
6680 unsigned int result; // eax@2 | 5853 unsigned int result; // eax@2 |
6989 } | 6162 } |
6990 //while ( (signed int)v4 < (signed int)arary_77E5C8 ); | 6163 //while ( (signed int)v4 < (signed int)arary_77E5C8 ); |
6991 } | 6164 } |
6992 | 6165 |
6993 //----- (004811A3) -------------------------------------------------------- | 6166 //----- (004811A3) -------------------------------------------------------- |
6994 void stru148::DrawBorderTiles() | 6167 void Polygon::DrawBorderTiles() |
6995 { | 6168 { |
6996 //__debugbreak(); | 6169 //__debugbreak(); |
6997 | 6170 |
6998 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); | 6171 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); |
6999 pRenderer->DrawTerrainPolygon(uNumVertices, this, | 6172 pRenderer->DrawTerrainPolygon(uNumVertices, this, |
7001 | 6174 |
7002 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); | 6175 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); |
7003 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true); | 6176 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true); |
7004 } | 6177 } |
7005 | 6178 |
7006 //----- (00481DB2) -------------------------------------------------------- | |
7007 char __fastcall sr_sub_481DB2(RenderVertexSoft *a1, signed int a2, stru148 *a3) | |
7008 { | |
7009 int v3; // eax@2 | |
7010 int v4; // esi@2 | |
7011 signed int v5; // esi@2 | |
7012 char *v6; // edi@3 | |
7013 double v7; // ST14_8@4 | |
7014 double v8; // ST0C_8@4 | |
7015 char result; // al@5 | |
7016 | |
7017 if ( a2 >= 3 ) | |
7018 { | |
7019 v3 = a3->uTileBitmapID; | |
7020 v4 = a3->uTileBitmapID; | |
7021 a3->ptr_38 = &stru_8019C8; | |
7022 a3->pTexture = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
7023 v5 = 0; | |
7024 if ( (signed int)a3->uNumVertices > 0 ) | |
7025 { | |
7026 v6 = (char *)&array_508690[0].vWorldViewProjY; | |
7027 do | |
7028 { | |
7029 v7 = *((float *)v6 - 1) + 6.7553994e15; | |
7030 dword_50B638[v5] = LODWORD(v7); | |
7031 v8 = *(float *)v6 + 6.7553994e15; | |
7032 v6 += 48; | |
7033 dword_50B570[v5++] = LODWORD(v8); | |
7034 } | |
7035 while ( v5 < (signed int)a3->uNumVertices ); | |
7036 } | |
7037 result = sr_sub_486B4E_push_outdoor_edges(a1, dword_50B638.data(), dword_50B570.data(), a3); | |
7038 } | |
7039 return result; | |
7040 } | |
7041 // 50B570: using guessed type int dword_50B570[]; | |
7042 // 50B638: using guessed type int dword_50B638[]; | |
7043 | 6179 |
7044 //----- (00481EB7) -------------------------------------------------------- | 6180 //----- (00481EB7) -------------------------------------------------------- |
7045 void __cdecl ResetStru148s() | 6181 void __cdecl ResetPolygons() |
7046 { | 6182 { |
7047 int v0; // ecx@1 | 6183 int v0; // ecx@1 |
7048 char *v1; // eax@2 | 6184 char *v1; // eax@2 |
7049 | 6185 |
7050 v0 = pOutdoorCamera->numStru148s; | 6186 v0 = pOutdoorCamera->uNumPolygons; |
7051 if ( pOutdoorCamera->numStru148s > 0 ) | 6187 if ( pOutdoorCamera->uNumPolygons > 0 ) |
7052 { | 6188 { |
7053 v1 = (char *)&array_77EC08[0].prolly_tail; | 6189 v1 = (char *)&array_77EC08[0].prolly_tail; |
7054 do | 6190 do |
7055 { | 6191 { |
7056 *((int *)v1 - 1) = 0; | 6192 *((int *)v1 - 1) = 0; |
7065 | 6201 |
7066 //----- (00481ED9) -------------------------------------------------------- | 6202 //----- (00481ED9) -------------------------------------------------------- |
7067 void __cdecl sub_481ED9_MessWithOutdoorCamera() | 6203 void __cdecl sub_481ED9_MessWithOutdoorCamera() |
7068 { | 6204 { |
7069 stru_8019C8._48616B(65536, 0, 0, 0, 65536, 0); | 6205 stru_8019C8._48616B(65536, 0, 0, 0, 65536, 0); |
7070 pOutdoorCamera->numStru148s = 0; | 6206 pOutdoorCamera->uNumPolygons = 0; |
7071 pOutdoorCamera->uNumEdges = 0; | 6207 pOutdoorCamera->uNumEdges = 0; |
7072 pOutdoorCamera->uNumSpans = 0; | 6208 pOutdoorCamera->uNumSpans = 0; |
7073 pOutdoorCamera->uNumSurfs = 0; | 6209 pOutdoorCamera->uNumSurfs = 0; |
7074 pOutdoorCamera->uNumBillboards = 0; | 6210 pOutdoorCamera->uNumBillboards = 0; |
7075 pOutdoorCamera->field_44 = 0; | 6211 pOutdoorCamera->field_44 = 0; |
7105 v11 > a4->vWorldViewPosition.x ? (v15 = 0) : (v15 = 1), | 6241 v11 > a4->vWorldViewPosition.x ? (v15 = 0) : (v15 = 1), |
7106 !(v13 & v14 & v15 & v12)); | 6242 !(v13 & v14 & v15 & v12)); |
7107 } | 6243 } |
7108 | 6244 |
7109 //----- (00481FC9) -------------------------------------------------------- | 6245 //----- (00481FC9) -------------------------------------------------------- |
7110 int __fastcall sub_481FC9(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, stru148 *a4)//Rotate camera | 6246 int __fastcall sub_481FC9(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, struct Polygon *a4)//Rotate camera |
7111 { | 6247 { |
7112 float arg_0, arg_4, var_4, var_8, var_c, var_10, var_14; | 6248 float arg_0, arg_4, var_4, var_8, var_c, var_10, var_14; |
7113 | 6249 |
7114 if (a1->vWorldPosition.y == a2->vWorldPosition.y && a2->vWorldPosition.y == a3->vWorldPosition.y) | 6250 if (a1->vWorldPosition.y == a2->vWorldPosition.y && a2->vWorldPosition.y == a3->vWorldPosition.y) |
7115 a4->flags |= 0x10; | 6251 a4->flags |= 0x10; |
7305 } | 6441 } |
7306 else | 6442 else |
7307 return y_x1z1; | 6443 return y_x1z1; |
7308 } | 6444 } |
7309 | 6445 |
7310 //----- (0048276F) -------------------------------------------------------- | |
7311 void stru148::_48276F_sr() | |
7312 { | |
7313 unsigned int v1; // ebx@1 | |
7314 float v2; // edx@2 | |
7315 double v3; // st7@2 | |
7316 char *v4; // ecx@3 | |
7317 float v5; // eax@5 | |
7318 float v6; // eax@7 | |
7319 float v7; // eax@9 | |
7320 float v8; // ecx@13 | |
7321 int i; // eax@16 | |
7322 int v10; // edx@20 | |
7323 RenderVertexSoft *v11; // ecx@22 | |
7324 RenderVertexSoft *v12; // edx@22 | |
7325 RenderVertexSoft *v13; // esi@22 | |
7326 int v14; // ebx@26 | |
7327 RenderVertexSoft *v15; // ebx@27 | |
7328 double v16; // st6@28 | |
7329 double v17; // st5@28 | |
7330 double v18; // st4@28 | |
7331 int v19; // [sp+4h] [bp-2Ch]@20 | |
7332 int v20; // [sp+8h] [bp-28h]@22 | |
7333 int v21; // [sp+Ch] [bp-24h]@22 | |
7334 stru148 *v22; // [sp+10h] [bp-20h]@1 | |
7335 float v23; // [sp+14h] [bp-1Ch]@11 | |
7336 float v24; // [sp+18h] [bp-18h]@7 | |
7337 float v25; // [sp+1Ch] [bp-14h]@5 | |
7338 float v26; // [sp+20h] [bp-10h]@2 | |
7339 float v27; // [sp+24h] [bp-Ch]@2 | |
7340 float v28; // [sp+28h] [bp-8h]@2 | |
7341 float v29; // [sp+2Ch] [bp-4h]@9 | |
7342 | |
7343 v1 = this->uNumVertices; | |
7344 v22 = this; | |
7345 if ( (signed int)v1 >= 3 ) | |
7346 { | |
7347 LODWORD(v2) = 0; | |
7348 v26 = 10000.0; | |
7349 v28 = 10000.0; | |
7350 v3 = -10000.0; | |
7351 v27 = -10000.0; | |
7352 if ( (signed int)v1 > 0 ) | |
7353 { | |
7354 v4 = (char *)&array_508690[0].vWorldViewProjY; | |
7355 do | |
7356 { | |
7357 if ( *((float *)v4 - 1) < (double)v26 ) | |
7358 { | |
7359 LODWORD(v5) = *((int *)v4 - 1); | |
7360 v25 = v2; | |
7361 v26 = v5; | |
7362 } | |
7363 if ( *((float *)v4 - 1) > (double)v27 ) | |
7364 { | |
7365 LODWORD(v6) = *((int *)v4 - 1); | |
7366 v24 = v2; | |
7367 v27 = v6; | |
7368 } | |
7369 if ( *(float *)v4 < (double)v28 ) | |
7370 { | |
7371 LODWORD(v7) = *(int *)v4; | |
7372 v29 = v2; | |
7373 v28 = v7; | |
7374 } | |
7375 if ( v3 < *(float *)v4 ) | |
7376 { | |
7377 v3 = *(float *)v4; | |
7378 v23 = v2; | |
7379 } | |
7380 ++LODWORD(v2); | |
7381 v4 += 48; | |
7382 } | |
7383 while ( SLODWORD(v2) < (signed int)v1 ); | |
7384 } | |
7385 v8 = v29; | |
7386 if ( LODWORD(v29) == LODWORD(v25) || LODWORD(v29) == LODWORD(v24) ) | |
7387 v8 = v23; | |
7388 v29 = 0.0; | |
7389 for ( i = 0; i < (signed int)v1; ++i ) | |
7390 { | |
7391 if ( i == LODWORD(v25) || i == LODWORD(v24) || i == LODWORD(v8) ) | |
7392 { | |
7393 v10 = LODWORD(v29)++; | |
7394 *(&v19 + v10) = i; | |
7395 } | |
7396 } | |
7397 v11 = &array_508690[v19]; | |
7398 v12 = &array_508690[v20]; | |
7399 v13 = &array_508690[v21]; | |
7400 if ( LODWORD(v29) != 3 ) | |
7401 { | |
7402 v11 = array_508690; | |
7403 v13 = (RenderVertexSoft *)((char *)array_508690 + 16 * (3 * v1 - 3)); | |
7404 v12 = &array_508690[1]; | |
7405 v28 = array_508690[1].vWorldPosition.x - array_508690[0].vWorldPosition.x; | |
7406 v27 = array_508690[1].vWorldPosition.y - array_508690[0].vWorldPosition.y; | |
7407 v29 = array_508690[1].vWorldPosition.z - array_508690[0].vWorldPosition.z; | |
7408 v26 = v13->vWorldPosition.x - array_508690[0].vWorldPosition.x; | |
7409 v25 = v13->vWorldPosition.y - array_508690[0].vWorldPosition.y; | |
7410 v24 = v13->vWorldPosition.z - array_508690[0].vWorldPosition.z; | |
7411 if ( v24 * v27 - v25 * v29 == 0.0 ) | |
7412 { | |
7413 if ( v26 * v29 - v24 * v28 == 0.0 ) | |
7414 { | |
7415 if ( v25 * v28 - v26 * v27 == 0.0 ) | |
7416 { | |
7417 v14 = v1 - 2; | |
7418 LODWORD(v26) = v14; | |
7419 if ( v14 >= 2 ) | |
7420 { | |
7421 v15 = &array_508690[v14]; | |
7422 do | |
7423 { | |
7424 v16 = v15->vWorldPosition.x - array_508690[0].vWorldPosition.x; | |
7425 v17 = v15->vWorldPosition.y - array_508690[0].vWorldPosition.y; | |
7426 v18 = v15->vWorldPosition.z - array_508690[0].vWorldPosition.z; | |
7427 v13 = v15; | |
7428 if ( v27 * v18 - v17 * v29 != 0.0 ) | |
7429 break; | |
7430 if ( v16 * v29 - v18 * v28 != 0.0 ) | |
7431 break; | |
7432 if ( v28 * v17 - v16 * v27 != 0.0 ) | |
7433 break; | |
7434 --LODWORD(v26); | |
7435 --v15; | |
7436 } | |
7437 while ( SLODWORD(v26) >= 2 ); | |
7438 } | |
7439 } | |
7440 } | |
7441 } | |
7442 } | |
7443 sr_sub_4829B9(v11, v12, v13, v22, 1); | |
7444 } | |
7445 } | |
7446 | |
7447 //----- (004829B9) -------------------------------------------------------- | |
7448 stru148 *__fastcall sr_sub_4829B9(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, stru148 *a4, int a5) | |
7449 { | |
7450 double v5; // st7@1 | |
7451 RenderVertexSoft *v6; // esi@1 | |
7452 double v7; // st6@1 | |
7453 stru148 *result; // eax@3 | |
7454 double v9; // st6@3 | |
7455 double v10; // st5@3 | |
7456 float v11; // ST0C_4@3 | |
7457 float v12; // ST04_4@3 | |
7458 double v13; // st4@3 | |
7459 float v14; // [sp+8h] [bp-Ch]@1 | |
7460 float v15; // [sp+10h] [bp-4h]@1 | |
7461 float v16; // [sp+1Ch] [bp+8h]@1 | |
7462 float v17; // [sp+1Ch] [bp+8h]@3 | |
7463 | |
7464 v5 = a2->vWorldViewProjX - a1->vWorldViewProjX; | |
7465 v6 = a3; | |
7466 v16 = a3->vWorldViewProjY - a1->vWorldViewProjY; | |
7467 v15 = a2->vWorldViewProjY - a1->vWorldViewProjY; | |
7468 v14 = v6->vWorldViewProjX - a1->vWorldViewProjX; | |
7469 v7 = v16 * v5 - v14 * v15; | |
7470 if ( v7 == 0.0 ) | |
7471 v7 = 0.0000001; | |
7472 result = a4; | |
7473 v9 = 1.0 / v7; | |
7474 v10 = 1.0 / a1->vWorldViewPosition.x; | |
7475 v11 = 1.0 / a2->vWorldViewPosition.x - v10; | |
7476 v12 = 1.0 / v6->vWorldViewPosition.x - v10; | |
7477 v13 = (v11 * v16 - v12 * v15) * v9; | |
7478 v17 = (v11 * v14 - v12 * v5) * -v9; | |
7479 a4->field_C = a1->vWorldViewProjX; | |
7480 a4->field_10 = a1->vWorldViewProjY; | |
7481 a4->field_0 = v10; | |
7482 a4->field_8 = v17; | |
7483 a4->field_4 = v13; | |
7484 return result; | |
7485 } | |
7486 | |
7487 //----- (00482A90) -------------------------------------------------------- | 6446 //----- (00482A90) -------------------------------------------------------- |
7488 signed int __cdecl const_1_0() | 6447 signed int __cdecl const_1_0() |
7489 { | 6448 { |
7490 return 1; | 6449 return 1; |
7491 } | 6450 } |
7492 | 6451 |
7493 //----- (00482A94) -------------------------------------------------------- | 6452 |
7494 int sr_sub_482A94(Span *_this) | 6453 |
7495 { | 6454 |
7496 stru315 *v1; // ebp@0 | |
7497 Span *v2; // edi@1 | |
7498 stru148 *v3; // esi@1 | |
7499 int v4; // ecx@1 | |
7500 stru149 *v5; // eax@1 | |
7501 stru149 *v6; // eax@1 | |
7502 int v7; // edx@1 | |
7503 int v8; // eax@1 | |
7504 int v9; // ecx@1 | |
7505 int v10; // edx@1 | |
7506 int v11; // ebx@1 | |
7507 int v12; // eax@1 | |
7508 signed int v13; // ebx@1 | |
7509 int v14; // ebx@2 | |
7510 signed __int64 v15; // qtt@3 | |
7511 stru149 *v16; // eax@3 | |
7512 signed int v17; // ebx@3 | |
7513 Texture *v18; // eax@14 | |
7514 unsigned __int16 *v19; // eax@15 | |
7515 stru149 *v20; // eax@21 | |
7516 signed int v21; // eax@21 | |
7517 int v22; // eax@21 | |
7518 int v23; // ecx@21 | |
7519 Texture *v24; // edx@21 | |
7520 signed int v25; // eax@21 | |
7521 signed int v27; // [sp-4h] [bp-A4h]@8 | |
7522 int v28; // [sp+Ch] [bp-94h]@1 | |
7523 int v29; // [sp+10h] [bp-90h]@1 | |
7524 stru316 a2; // [sp+14h] [bp-8Ch]@21 | |
7525 stru315 a1; // [sp+3Ch] [bp-64h]@1 | |
7526 int v32; // [sp+80h] [bp-20h]@1 | |
7527 int v33; // [sp+84h] [bp-1Ch]@1 | |
7528 int v34; // [sp+88h] [bp-18h]@1 | |
7529 int v35; // [sp+8Ch] [bp-14h]@1 | |
7530 int v36; // [sp+90h] [bp-10h]@1 | |
7531 int v37; // [sp+94h] [bp-Ch]@1 | |
7532 int v38; // [sp+98h] [bp-8h]@1 | |
7533 int X; // [sp+9Ch] [bp-4h]@1 | |
7534 | |
7535 v2 = _this; | |
7536 v3 = _this->pParent; | |
7537 v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); | |
7538 v5 = v3->ptr_38; | |
7539 v38 = v4; | |
7540 v37 = v5->field_14; | |
7541 v38 = (unsigned __int64)(v37 * (signed __int64)v4) >> 16; | |
7542 v6 = v3->ptr_38; | |
7543 v7 = v38 + v6->field_C; | |
7544 v37 = v6->field_20; | |
7545 v33 = v7; | |
7546 v8 = ((unsigned __int64)(v37 * (signed __int64)v4) >> 16) + v3->ptr_38->field_18; | |
7547 v38 = v4; | |
7548 v34 = v8; | |
7549 v37 = v3->v_18.z; | |
7550 v38 = (unsigned __int64)(v37 * (signed __int64)v4) >> 16; | |
7551 v9 = v3->v_18.x; | |
7552 v28 = v3->sTextureDeltaU << 16; | |
7553 v35 = v3->sTextureDeltaV << 16; | |
7554 v10 = v2->field_8; | |
7555 v29 = pOutdoorCamera->camera_rotation_y_int_sine; | |
7556 v32 = pOutdoorCamera->camera_rotation_y_int_cosine; | |
7557 a1.field_28 = v2->field_C; | |
7558 v11 = v3->field_24; | |
7559 v37 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v10); | |
7560 v12 = v3->v_18.y; | |
7561 v13 = -v11; | |
7562 v36 = v13; | |
7563 X = ((unsigned __int64)(v37 * (signed __int64)v12) >> 16) + v38 + v9; | |
7564 if ( !X || (v14 = abs(v13 >> 14), v14 > abs(X)) ) | |
7565 return 0; | |
7566 LODWORD(v15) = v36 << 16; | |
7567 HIDWORD(v15) = v36 >> 16; | |
7568 v38 = v15 / X; | |
7569 v16 = v3->ptr_38; | |
7570 X = v37; | |
7571 v36 = v16->field_10; | |
7572 X = v37; | |
7573 v36 = v33 + ((unsigned __int64)(v36 * (signed __int64)v37) >> 16); | |
7574 v33 = v3->ptr_38->field_1C; | |
7575 X = (unsigned __int64)(v33 * (signed __int64)v37) >> 16; | |
7576 v34 += (unsigned __int64)(v33 * (signed __int64)v37) >> 16; | |
7577 v17 = 2; | |
7578 a1.pTextureLOD = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
7579 if ( v38 >= mipmapping_building_mm1 << 16 ) | |
7580 { | |
7581 if ( v38 >= mipmapping_building_mm2 << 16 ) | |
7582 { | |
7583 if ( v38 >= mipmapping_building_mm3 << 16 ) | |
7584 { | |
7585 if ( bUseLoResSprites ) | |
7586 goto LABEL_12; | |
7587 v27 = 3; | |
7588 } | |
7589 else | |
7590 { | |
7591 v27 = 2; | |
7592 } | |
7593 v17 = v27; | |
7594 goto LABEL_12; | |
7595 } | |
7596 v17 = 1; | |
7597 } | |
7598 else | |
7599 { | |
7600 v17 = 0; | |
7601 } | |
7602 LABEL_12: | |
7603 if ( v17 < (signed int)v3->ptr_48 ) | |
7604 v17 = (signed int)v3->ptr_48; | |
7605 v18 = v3->pTexture; | |
7606 if ( v17 ) | |
7607 { | |
7608 if ( v17 == 1 ) | |
7609 { | |
7610 v19 = (unsigned __int16 *)v18->pLevelOfDetail1; | |
7611 } | |
7612 else | |
7613 { | |
7614 if ( v17 == 2 ) | |
7615 v19 = (unsigned __int16 *)v18->pLevelOfDetail2; | |
7616 else | |
7617 v19 = (unsigned __int16 *)v18->pLevelOfDetail3; | |
7618 } | |
7619 } | |
7620 else | |
7621 { | |
7622 v19 = (unsigned __int16 *)v18->pLevelOfDetail0_prolly_alpha_mask; | |
7623 } | |
7624 a1.pTextureLOD = v19; | |
7625 X = (unsigned __int64)(v36 * (signed __int64)v38) >> 16; | |
7626 v20 = v3->ptr_38; | |
7627 X = v38; | |
7628 a1.field_30 = v28 + ((unsigned __int64)(v36 * (signed __int64)v38) >> 16) - v20->field_24; | |
7629 X = (unsigned __int64)(v34 * (signed __int64)v38) >> 16; | |
7630 v21 = X - v3->ptr_38->field_28 - v35; | |
7631 a1.field_30 >>= v17 + bUseLoResSprites; | |
7632 a1.field_2C = v21 >> (v17 + bUseLoResSprites); | |
7633 v35 = pOutdoorCamera->int_fov_rad_inv; | |
7634 v37 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v38) >> 16) >> (v17 + bUseLoResSprites); | |
7635 a1.field_4 = (unsigned __int64)(v37 * (signed __int64)v29) >> 16; | |
7636 X = (unsigned __int64)(v37 * (signed __int64)v32) >> 16; | |
7637 a1.field_0 = -(signed int)((unsigned __int64)(v37 * (signed __int64)v32) >> 16); | |
7638 v22 = v2->field_A; | |
7639 a1.pColorBuffer = &pRenderer->pTargetSurface[v2->field_8 + pRenderer->uTargetSurfacePitch * v2->field_A]; | |
7640 HIWORD(v23) = HIWORD(v38); | |
7641 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v2->field_8 + 640 * v22]; | |
7642 LOWORD(v23) = 0; | |
7643 a1.field_24 = v23 | v3->field_50; | |
7644 v24 = v3->pTexture; | |
7645 v32 = (signed int)v24->uTextureWidth >> v17; | |
7646 v25 = (signed int)v24->uTextureHeight >> v17; | |
7647 a1.field_10 = v17 - v24->uWidthLn2 + 16; | |
7648 a1.field_C = v32 - 1; | |
7649 a1.field_8 = (v25 << 16) - 65536; | |
7650 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v38, v3, pOutdoorCamera->building_gamme, 1u, 1); | |
7651 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
7652 sr_sub_485975(&a1, (stru315 *)&a2); | |
7653 else | |
7654 sr_sub_4D6FB0(v1); | |
7655 return 1; | |
7656 } | |
7657 | |
7658 //----- (00482E07) -------------------------------------------------------- | |
7659 signed int __fastcall sr_sub_482E07(Span *ecx0, unsigned __int16 *pRenderTarget) | |
7660 { | |
7661 stru315 *v2; // ebp@0 | |
7662 stru148 *v3; // esi@1 | |
7663 int v4; // edi@1 | |
7664 int v5; // edi@1 | |
7665 stru149 *v6; // eax@1 | |
7666 stru149 *v7; // eax@1 | |
7667 int v8; // edx@1 | |
7668 int v9; // eax@1 | |
7669 int v10; // edi@1 | |
7670 int v11; // eax@1 | |
7671 unsigned __int64 v12; // qax@1 | |
7672 int v13; // eax@1 | |
7673 signed __int64 v14; // qtt@3 | |
7674 int v15; // ebx@4 | |
7675 signed __int64 v16; // qtt@5 | |
7676 int v17; // eax@5 | |
7677 unsigned __int16 *v18; // eax@7 | |
7678 Texture *v19; // eax@8 | |
7679 Texture *v20; // eax@10 | |
7680 Texture *v21; // eax@12 | |
7681 Texture *v22; // eax@14 | |
7682 int v23; // ecx@17 | |
7683 Texture *v24; // ebx@17 | |
7684 signed int v25; // edx@17 | |
7685 signed int v26; // eax@17 | |
7686 char v27; // bl@17 | |
7687 stru149 *v28; // eax@18 | |
7688 stru149 *v29; // eax@18 | |
7689 int v30; // eax@18 | |
7690 int v31; // eax@18 | |
7691 unsigned int v32; // edx@18 | |
7692 int v33; // edi@21 | |
7693 signed __int64 v34; // qtt@22 | |
7694 signed int v35; // ecx@22 | |
7695 int v36; // eax@24 | |
7696 stru149 *v37; // eax@24 | |
7697 int v38; // edi@24 | |
7698 int v39; // eax@24 | |
7699 int v40; // edi@35 | |
7700 signed __int64 v41; // qtt@36 | |
7701 int v42; // edx@36 | |
7702 stru149 *v43; // eax@36 | |
7703 int v44; // edi@36 | |
7704 int v45; // eax@36 | |
7705 Span *v46; // edi@44 | |
7706 stru149 *v47; // eax@44 | |
7707 stru149 *v48; // eax@44 | |
7708 int v49; // eax@44 | |
7709 int v50; // ecx@44 | |
7710 unsigned int v51; // edx@44 | |
7711 int v52; // edi@46 | |
7712 signed __int64 v53; // qtt@47 | |
7713 unsigned int v54; // ecx@47 | |
7714 int v55; // eax@49 | |
7715 stru149 *v56; // eax@49 | |
7716 int v57; // edi@49 | |
7717 int v58; // eax@49 | |
7718 int v59; // edi@60 | |
7719 signed __int64 v60; // qtt@61 | |
7720 int v61; // edx@61 | |
7721 stru149 *v62; // eax@61 | |
7722 int v63; // edi@61 | |
7723 int v64; // eax@61 | |
7724 int v66; // [sp+Ch] [bp-B8h]@1 | |
7725 int v67; // [sp+10h] [bp-B4h]@1 | |
7726 int v68; // [sp+14h] [bp-B0h]@1 | |
7727 int v69; // [sp+18h] [bp-ACh]@1 | |
7728 int v70; // [sp+1Ch] [bp-A8h]@5 | |
7729 int v71; // [sp+20h] [bp-A4h]@1 | |
7730 signed int v72; // [sp+24h] [bp-A0h]@1 | |
7731 stru316 a2; // [sp+28h] [bp-9Ch]@18 | |
7732 int v74; // [sp+50h] [bp-74h]@17 | |
7733 stru315 a1; // [sp+54h] [bp-70h]@5 | |
7734 Span *v76; // [sp+98h] [bp-2Ch]@1 | |
7735 unsigned __int16 *v77; // [sp+9Ch] [bp-28h]@1 | |
7736 int v78; // [sp+A0h] [bp-24h]@17 | |
7737 int v79; // [sp+A4h] [bp-20h]@3 | |
7738 int v80; // [sp+A8h] [bp-1Ch]@3 | |
7739 int v81; // [sp+ACh] [bp-18h]@1 | |
7740 int X; // [sp+B0h] [bp-14h]@2 | |
7741 int v83; // [sp+B4h] [bp-10h]@1 | |
7742 int v84; // [sp+B8h] [bp-Ch]@1 | |
7743 int v85; // [sp+BCh] [bp-8h]@1 | |
7744 int v86; // [sp+C0h] [bp-4h]@18 | |
7745 | |
7746 v85 = ecx0->field_C; | |
7747 v3 = ecx0->pParent; | |
7748 v4 = pViewport->uScreenCenterY - ecx0->field_A; | |
7749 v77 = pRenderTarget; | |
7750 v5 = pOutdoorCamera->int_fov_rad_inv * v4; | |
7751 v6 = v3->ptr_38; | |
7752 v76 = ecx0; | |
7753 v81 = v5; | |
7754 v83 = v6->field_14; | |
7755 v81 = (unsigned __int64)(v83 * (signed __int64)v5) >> 16; | |
7756 v7 = v3->ptr_38; | |
7757 v8 = v81 + v7->field_C; | |
7758 v83 = v7->field_20; | |
7759 v67 = v8; | |
7760 v9 = ((unsigned __int64)(v83 * (signed __int64)v5) >> 16) + v3->ptr_38->field_18; | |
7761 v81 = v5; | |
7762 v71 = v9; | |
7763 v83 = v3->v_18.z; | |
7764 v81 = (unsigned __int64)(v83 * (signed __int64)v5) >> 16; | |
7765 v68 = v3->sTextureDeltaU << 16; | |
7766 v69 = v3->sTextureDeltaV << 16; | |
7767 v72 = -v3->field_24; | |
7768 v10 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - ecx0->field_8); | |
7769 v11 = v3->v_18.y; | |
7770 v66 = v81 + v3->v_18.x; | |
7771 v83 = v10; | |
7772 v12 = v10 * (signed __int64)v11; | |
7773 v81 = v12 >> 16; | |
7774 v13 = v66 + (v12 >> 16); | |
7775 v84 = v13; | |
7776 if ( !v13 | |
7777 || (X = v72 >> 15, v83 = abs(v13), abs(v72 >> 15) >= v83) | |
7778 || (LODWORD(v14) = v72 << 16, | |
7779 HIDWORD(v14) = v72 >> 16, | |
7780 v79 = v14 / v84, | |
7781 v80 = v10 - v85 * pOutdoorCamera->int_fov_rad_inv, | |
7782 v81 = (unsigned __int64)(v80 * (signed __int64)v3->v_18.y) >> 16, | |
7783 (v84 = v66 + v81) == 0) | |
7784 || (v15 = abs(v66 + v81), abs(X) >= v15) ) | |
7785 return 0; | |
7786 LODWORD(v16) = v72 << 16; | |
7787 HIDWORD(v16) = v72 >> 16; | |
7788 v70 = v16 / v84; | |
7789 v17 = v16 / v84; | |
7790 a1.field_24 = v79; | |
7791 if ( v79 >= v17 ) | |
7792 a1.field_24 = v17; | |
7793 v18 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
7794 a1.pTextureLOD = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
7795 v84 = 2; | |
7796 if ( a1.field_24 >= mipmapping_building_mm1 << 16 ) | |
7797 { | |
7798 if ( a1.field_24 >= mipmapping_building_mm2 << 16 ) | |
7799 { | |
7800 if ( a1.field_24 >= mipmapping_building_mm3 << 16 ) | |
7801 { | |
7802 if ( bUseLoResSprites ) | |
7803 goto LABEL_16; | |
7804 v22 = v3->pTexture; | |
7805 v84 = 3; | |
7806 v18 = (unsigned __int16 *)v22->pLevelOfDetail3; | |
7807 } | |
7808 else | |
7809 { | |
7810 v21 = v3->pTexture; | |
7811 v84 = 2; | |
7812 v18 = (unsigned __int16 *)v21->pLevelOfDetail2; | |
7813 } | |
7814 } | |
7815 else | |
7816 { | |
7817 v20 = v3->pTexture; | |
7818 v84 = 1; | |
7819 v18 = (unsigned __int16 *)v20->pLevelOfDetail1; | |
7820 } | |
7821 } | |
7822 else | |
7823 { | |
7824 v19 = v3->pTexture; | |
7825 v84 = 0; | |
7826 v18 = (unsigned __int16 *)v19->pLevelOfDetail0_prolly_alpha_mask; | |
7827 } | |
7828 a1.pTextureLOD = v18; | |
7829 LABEL_16: | |
7830 if ( v18 ) | |
7831 { | |
7832 v23 = v3->field_5A; | |
7833 v83 = v3->field_52; | |
7834 v24 = v3->pTexture; | |
7835 v74 = v23; | |
7836 v78 = v85 >> v23; | |
7837 v25 = v24->uTextureWidth; | |
7838 v81 = v85 - (v85 >> v23 << v23); | |
7839 v26 = (signed int)v24->uTextureHeight >> v84; | |
7840 a1.field_10 = v84 - v24->uWidthLn2 + 16; | |
7841 v27 = v84 + bUseLoResSprites; | |
7842 a1.field_8 = (v26 << 16) - 65536; | |
7843 a1.field_C = (v25 >> v84) - 1; | |
7844 if ( v79 >= v70 ) | |
7845 { | |
7846 v46 = v76; | |
7847 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v70, v3, pOutdoorCamera->building_gamme, 0, 1); | |
7848 v47 = v3->ptr_38; | |
7849 v79 = v80; | |
7850 v86 = v47->field_10; | |
7851 v79 = v80; | |
7852 v84 = v67 + ((unsigned __int64)(v86 * (signed __int64)v80) >> 16); | |
7853 v86 = v3->ptr_38->field_1C; | |
7854 v86 = v71 + ((unsigned __int64)(v86 * (signed __int64)v80) >> 16); | |
7855 v79 = (unsigned __int64)(v84 * (signed __int64)v70) >> 16; | |
7856 v48 = v3->ptr_38; | |
7857 v79 = v70; | |
7858 a1.field_30 = v68 + ((unsigned __int64)(v84 * (signed __int64)v70) >> 16) - v48->field_24; | |
7859 v79 = (unsigned __int64)(v86 * (signed __int64)v70) >> 16; | |
7860 v49 = ((unsigned __int64)(v86 * (signed __int64)v70) >> 16) - v3->ptr_38->field_28; | |
7861 a1.field_30 >>= v27; | |
7862 a1.field_2C = (v69 + v49) >> v27; | |
7863 a1.field_14 = dword_80AA20 >> v27; | |
7864 a1.field_18 = dword_80AA1C >> v27; | |
7865 a1.field_1C = dword_80AA18 >> v27; | |
7866 v50 = v46->field_8; | |
7867 a1.field_20 = dword_80AA14 >> v27; | |
7868 v51 = v50 + pRenderer->uTargetSurfacePitch * v46->field_A; | |
7869 a1.pDepthBuffer = (unsigned int *)(&pRenderer->pActiveZBuffer[640 * v46->field_A - 1] + v85 + v50); | |
7870 a1.pColorBuffer = &v77[v85 - 1] + v51; | |
7871 v80 += pOutdoorCamera->int_fov_rad_inv << v74; | |
7872 if ( v78 > 0 ) | |
7873 { | |
7874 do | |
7875 { | |
7876 v77 = (unsigned __int16 *)v3->v_18.y; | |
7877 v86 = (unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16; | |
7878 v84 = v66 + ((unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16); | |
7879 if ( v66 + (unsigned int)((unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16) | |
7880 && (v52 = abs((signed __int64)v66 + ((__int64)((signed int)v77 * (signed __int64)v80) >> 16)), abs((signed __int64)X) < v52) ) | |
7881 { | |
7882 LODWORD(v53) = v72 << 16; | |
7883 HIDWORD(v53) = v72 >> 16; | |
7884 v86 = v53 / v84; | |
7885 v54 = v53 / v84; | |
7886 v84 = v53 / v84; | |
7887 } | |
7888 else | |
7889 { | |
7890 v84 = 0x40000000u; | |
7891 v54 = 0x40000000u; | |
7892 } | |
7893 HIWORD(v55) = HIWORD(v54); | |
7894 LOWORD(v55) = 0; | |
7895 a1.field_24 = v3->field_50 | v55; | |
7896 v77 = (unsigned __int16 *)v3->ptr_38->field_10; | |
7897 v77 = (unsigned __int16 *)(v67 + ((unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16)); | |
7898 v86 = (unsigned __int64)((signed int)v77 * (signed __int64)(signed int)v54) >> 16; | |
7899 v56 = v3->ptr_38; | |
7900 v57 = ((unsigned __int64)((signed int)v77 * (signed __int64)(signed int)v54) >> 16) - v56->field_24; | |
7901 v77 = (unsigned __int16 *)v56->field_1C; | |
7902 v77 = (unsigned __int16 *)(v71 + ((unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16)); | |
7903 v86 = (unsigned __int64)((signed int)v77 * (signed __int64)(signed int)v54) >> 16; | |
7904 v58 = (((v69 + v86 - v3->ptr_38->field_28) >> v27) - a1.field_2C) >> v74; | |
7905 a1.field_4 = (((v68 + v57) >> v27) - a1.field_30) >> v74; | |
7906 a1.field_0 = v58; | |
7907 a1.field_28 = v83; | |
7908 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
7909 { | |
7910 if ( v3->pODMFace->uPolygonType == 1 ) | |
7911 sr_sub_485BAE(&a1, &a2); | |
7912 else | |
7913 sr_sub_485AFF(&a1, &a2); | |
7914 } | |
7915 else | |
7916 { | |
7917 if ( v3->pODMFace->uPolygonType == 1 ) | |
7918 sr_sub_4D71F8(&a1); | |
7919 else | |
7920 sr_sub_4D714C(&a1); | |
7921 } | |
7922 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F( | |
7923 &a2, | |
7924 v76, | |
7925 v84, | |
7926 v3, | |
7927 pOutdoorCamera->building_gamme, | |
7928 0, | |
7929 0); | |
7930 v80 += pOutdoorCamera->int_fov_rad_inv << v74; | |
7931 --v78; | |
7932 } | |
7933 while ( v78 ); | |
7934 } | |
7935 if ( !v81 ) | |
7936 return 1; | |
7937 v83 = v3->v_18.y; | |
7938 v86 = (unsigned __int64)(v83 * (signed __int64)v80) >> 16; | |
7939 v84 = v66 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
7940 if ( v66 + (unsigned int)((unsigned __int64)(v83 * (signed __int64)v80) >> 16) ) | |
7941 { | |
7942 v59 = abs((signed __int64)v66 + ((__int64)(v83 * (signed __int64)v80) >> 16)); | |
7943 if ( abs(X) < v59 ) | |
7944 { | |
7945 LODWORD(v60) = v72 << 16; | |
7946 HIDWORD(v60) = v72 >> 16; | |
7947 v86 = v60 / v84; | |
7948 HIWORD(v61) = (unsigned int)(v60 / v84) >> 16; | |
7949 LOWORD(v61) = 0; | |
7950 a1.field_24 = v61 | v3->field_50; | |
7951 v83 = v3->ptr_38->field_10; | |
7952 v83 = v67 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
7953 v86 = (unsigned __int64)(v83 * v60 / v84) >> 16; | |
7954 v62 = v3->ptr_38; | |
7955 v63 = ((unsigned __int64)(v83 * v60 / v84) >> 16) - v62->field_24; | |
7956 v83 = v62->field_1C; | |
7957 v83 = v71 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
7958 v86 = (unsigned __int64)(v83 * v60 / v84) >> 16; | |
7959 v64 = (((signed int)(v69 + ((unsigned __int64)(v83 * v60 / v84) >> 16) - v3->ptr_38->field_28) >> v27) | |
7960 - a1.field_2C) >> v74; | |
7961 a1.field_4 = (((v68 + v63) >> v27) - a1.field_30) >> v74; | |
7962 a1.field_0 = v64; | |
7963 a1.field_28 = v81; | |
7964 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
7965 { | |
7966 if ( v3->pODMFace->uPolygonType == 1 ) | |
7967 sr_sub_485BAE(&a1, &a2); | |
7968 else | |
7969 sr_sub_485AFF(&a1, &a2); | |
7970 } | |
7971 else | |
7972 { | |
7973 if ( v3->pODMFace->uPolygonType == 1 ) | |
7974 sr_sub_4D71F8(&a1); | |
7975 else | |
7976 sr_sub_4D714C(&a1); | |
7977 } | |
7978 return 1; | |
7979 } | |
7980 } | |
7981 } | |
7982 else | |
7983 { | |
7984 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v79, v3, pOutdoorCamera->building_gamme, 1u, 1); | |
7985 v28 = v3->ptr_38; | |
7986 v85 = v10; | |
7987 v86 = v28->field_10; | |
7988 v85 = v10; | |
7989 v84 = v67 + ((unsigned __int64)(v86 * (signed __int64)v10) >> 16); | |
7990 v86 = v3->ptr_38->field_1C; | |
7991 v86 = v71 + ((unsigned __int64)(v86 * (signed __int64)v10) >> 16); | |
7992 v85 = (unsigned __int64)(v84 * (signed __int64)v79) >> 16; | |
7993 v29 = v3->ptr_38; | |
7994 v85 = v79; | |
7995 a1.field_30 = v68 + ((unsigned __int64)(v84 * (signed __int64)v79) >> 16) - v29->field_24; | |
7996 v85 = (unsigned __int64)(v86 * (signed __int64)v79) >> 16; | |
7997 v30 = ((unsigned __int64)(v86 * (signed __int64)v79) >> 16) - v3->ptr_38->field_28; | |
7998 a1.field_30 >>= v27; | |
7999 a1.field_2C = (v69 + v30) >> v27; | |
8000 a1.field_14 = dword_80AA20 >> v27; | |
8001 a1.field_18 = dword_80AA1C >> v27; | |
8002 a1.field_1C = dword_80AA18 >> v27; | |
8003 a1.field_20 = dword_80AA14 >> v27; | |
8004 v31 = v76->field_A; | |
8005 v32 = pRenderer->uTargetSurfacePitch * v76->field_A; | |
8006 v86 = v76->field_8; | |
8007 a1.pColorBuffer = &v77[v86 + v32]; | |
8008 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v86 + 640 * v31]; | |
8009 v80 = v10 - (pOutdoorCamera->int_fov_rad_inv << v74); | |
8010 if ( v78 > 0 ) | |
8011 { | |
8012 v86 = v78; | |
8013 do | |
8014 { | |
8015 v78 = v3->v_18.y; | |
8016 v85 = (unsigned __int64)(v78 * (signed __int64)v80) >> 16; | |
8017 v84 = v66 + ((unsigned __int64)(v78 * (signed __int64)v80) >> 16); | |
8018 if ( v66 + (unsigned int)((unsigned __int64)(v78 * (signed __int64)v80) >> 16) | |
8019 && (v33 = abs((signed __int64)v66 + ((__int64)(v78 * (signed __int64)v80) >> 16)), abs((signed __int64)X) < v33) ) | |
8020 { | |
8021 LODWORD(v34) = v72 << 16; | |
8022 HIDWORD(v34) = v72 >> 16; | |
8023 v85 = v34 / v84; | |
8024 v35 = v34 / v84; | |
8025 v84 = v34 / v84; | |
8026 } | |
8027 else | |
8028 { | |
8029 v84 = 1073741824; | |
8030 v35 = 1073741824; | |
8031 } | |
8032 HIWORD(v36) = HIWORD(v35); | |
8033 LOWORD(v36) = 0; | |
8034 a1.field_24 = v3->field_50 | v36; | |
8035 v78 = v3->ptr_38->field_10; | |
8036 v78 = v67 + ((unsigned __int64)(v78 * (signed __int64)v80) >> 16); | |
8037 v85 = (unsigned __int64)(v78 * (signed __int64)v35) >> 16; | |
8038 v37 = v3->ptr_38; | |
8039 v38 = ((unsigned __int64)(v78 * (signed __int64)v35) >> 16) - v37->field_24; | |
8040 v78 = v37->field_1C; | |
8041 v78 = v71 + ((unsigned __int64)(v78 * (signed __int64)v80) >> 16); | |
8042 v85 = (unsigned __int64)(v78 * (signed __int64)v35) >> 16; | |
8043 v39 = (((v69 + v85 - v3->ptr_38->field_28) >> v27) - a1.field_2C) >> v74; | |
8044 a1.field_4 = (((v68 + v38) >> v27) - a1.field_30) >> v74; | |
8045 a1.field_0 = v39; | |
8046 a1.field_28 = v83; | |
8047 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
8048 { | |
8049 if ( v3->pODMFace->uPolygonType == 1 ) | |
8050 sr_sub_485A24(&a1, (stru315 *)&a2); | |
8051 else | |
8052 sr_sub_485975(&a1, (stru315 *)&a2); | |
8053 } | |
8054 else | |
8055 { | |
8056 if ( v3->pODMFace->uPolygonType == 1 ) | |
8057 sr_sub_4D705A(v2); | |
8058 else | |
8059 sr_sub_4D6FB0(v2); | |
8060 } | |
8061 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F( | |
8062 &a2, | |
8063 v76, | |
8064 v84, | |
8065 v3, | |
8066 pOutdoorCamera->building_gamme, | |
8067 1u, | |
8068 0); | |
8069 v80 -= pOutdoorCamera->int_fov_rad_inv << v74; | |
8070 --v86; | |
8071 } | |
8072 while ( v86 ); | |
8073 } | |
8074 if ( !v81 ) | |
8075 return 1; | |
8076 v83 = v3->v_18.y; | |
8077 v76 = (Span *)((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
8078 v84 = v66 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
8079 if ( v66 + (unsigned int)((unsigned __int64)(v83 * (signed __int64)v80) >> 16) ) | |
8080 { | |
8081 v40 = abs((signed __int64)v66 + ((__int64)(v83 * (signed __int64)v80) >> 16)); | |
8082 if ( abs(X) < v40 ) | |
8083 { | |
8084 LODWORD(v41) = v72 << 16; | |
8085 HIDWORD(v41) = v72 >> 16; | |
8086 X = v41 / v84; | |
8087 HIWORD(v42) = (unsigned int)(v41 / v84) >> 16; | |
8088 LOWORD(v42) = 0; | |
8089 a1.field_24 = v42 | v3->field_50; | |
8090 v83 = v3->ptr_38->field_10; | |
8091 v83 = v67 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
8092 X = (unsigned __int64)(v83 * v41 / v84) >> 16; | |
8093 v43 = v3->ptr_38; | |
8094 v44 = ((unsigned __int64)(v83 * v41 / v84) >> 16) - v43->field_24; | |
8095 v83 = v43->field_1C; | |
8096 v83 = v71 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
8097 X = (unsigned __int64)(v83 * v41 / v84) >> 16; | |
8098 v45 = (((signed int)(v69 + ((unsigned __int64)(v83 * v41 / v84) >> 16) - v3->ptr_38->field_28) >> v27) | |
8099 - a1.field_2C) >> v74; | |
8100 a1.field_4 = (((v68 + v44) >> v27) - a1.field_30) >> v74; | |
8101 a1.field_0 = v45; | |
8102 a1.field_28 = v81; | |
8103 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
8104 { | |
8105 if ( v3->pODMFace->uPolygonType == 1 ) | |
8106 sr_sub_485A24(&a1, (stru315 *)&a2); | |
8107 else | |
8108 sr_sub_485975(&a1, (stru315 *)&a2); | |
8109 } | |
8110 else | |
8111 { | |
8112 if ( v3->pODMFace->uPolygonType == 1 ) | |
8113 sr_sub_4D705A(v2); | |
8114 else | |
8115 sr_sub_4D6FB0(v2); | |
8116 } | |
8117 return 1; | |
8118 } | |
8119 } | |
8120 } | |
8121 } | |
8122 return 0; | |
8123 } | |
8124 | |
8125 //----- (004839BD) -------------------------------------------------------- | |
8126 signed int __fastcall sr_sub_4839BD(Span *ecx0, unsigned __int16 *pTargetSurface) | |
8127 { | |
8128 stru315 *v2; // ebp@0 | |
8129 int v3; // eax@1 | |
8130 int v4; // edi@1 | |
8131 stru148 *v5; // esi@1 | |
8132 unsigned int v6; // ebx@1 | |
8133 int v7; // ecx@1 | |
8134 int v8; // ebx@1 | |
8135 int v9; // ecx@1 | |
8136 int v10; // eax@1 | |
8137 stru149 *v11; // eax@1 | |
8138 int v12; // edx@1 | |
8139 int v13; // eax@1 | |
8140 int v14; // edi@1 | |
8141 int v15; // ecx@1 | |
8142 int v16; // eax@1 | |
8143 signed int v17; // edi@1 | |
8144 int v18; // edi@2 | |
8145 signed __int64 v19; // qtt@3 | |
8146 int v20; // edi@3 | |
8147 unsigned __int16 *v21; // eax@3 | |
8148 Texture *v22; // eax@4 | |
8149 Texture *v23; // eax@6 | |
8150 Texture *v24; // eax@8 | |
8151 Texture *v25; // eax@10 | |
8152 stru149 *v26; // eax@13 | |
8153 int v27; // edi@13 | |
8154 signed int v28; // edx@13 | |
8155 Texture *v29; // ebx@13 | |
8156 int v30; // edi@13 | |
8157 signed int v31; // edx@13 | |
8158 signed int v32; // eax@13 | |
8159 signed int v33; // eax@13 | |
8160 int v34; // ebx@13 | |
8161 int v35; // eax@15 | |
8162 int v36; // ebx@15 | |
8163 int v37; // eax@16 | |
8164 signed __int64 v38; // qtt@17 | |
8165 int v39; // ecx@17 | |
8166 int v40; // eax@19 | |
8167 stru149 *v41; // eax@21 | |
8168 int v42; // ebx@21 | |
8169 int v43; // ebx@21 | |
8170 int v44; // eax@21 | |
8171 char v45; // zf@25 | |
8172 int v46; // eax@28 | |
8173 int v47; // eax@28 | |
8174 int v48; // ebx@28 | |
8175 int v49; // eax@29 | |
8176 signed __int64 v50; // qtt@30 | |
8177 int v51; // ecx@30 | |
8178 int v52; // eax@30 | |
8179 int v53; // edx@31 | |
8180 stru149 *v54; // eax@33 | |
8181 int v55; // ebx@33 | |
8182 signed int v56; // ebx@33 | |
8183 int v57; // eax@33 | |
8184 unsigned __int64 v58; // qax@33 | |
8185 int v60; // [sp+Ch] [bp-BCh]@1 | |
8186 Span *v61; // [sp+10h] [bp-B8h]@1 | |
8187 int v62; // [sp+14h] [bp-B4h]@2 | |
8188 int v63; // [sp+18h] [bp-B0h]@1 | |
8189 stru315 a1; // [sp+1Ch] [bp-ACh]@1 | |
8190 stru316 a2; // [sp+60h] [bp-68h]@13 | |
8191 int v66; // [sp+88h] [bp-40h]@13 | |
8192 int v67; // [sp+8Ch] [bp-3Ch]@1 | |
8193 int v68; // [sp+90h] [bp-38h]@13 | |
8194 int v69; // [sp+94h] [bp-34h]@3 | |
8195 int v70; // [sp+98h] [bp-30h]@1 | |
8196 int v71; // [sp+9Ch] [bp-2Ch]@1 | |
8197 int v72; // [sp+A0h] [bp-28h]@1 | |
8198 int v73; // [sp+A4h] [bp-24h]@13 | |
8199 int v74; // [sp+A8h] [bp-20h]@1 | |
8200 int v75; // [sp+ACh] [bp-1Ch]@3 | |
8201 int v76; // [sp+B0h] [bp-18h]@1 | |
8202 int v77; // [sp+B4h] [bp-14h]@1 | |
8203 int X; // [sp+B8h] [bp-10h]@1 | |
8204 int v79; // [sp+BCh] [bp-Ch]@21 | |
8205 int v80; // [sp+C0h] [bp-8h]@13 | |
8206 unsigned int v81; // [sp+C4h] [bp-4h]@1 | |
8207 | |
8208 v3 = ecx0->field_A; | |
8209 v4 = ecx0->field_8; | |
8210 v5 = ecx0->pParent; | |
8211 v6 = v4 + pRenderer->uTargetSurfacePitch * ecx0->field_A; | |
8212 v61 = ecx0; | |
8213 v7 = ecx0->field_C; | |
8214 a1.pColorBuffer = &pTargetSurface[v6]; | |
8215 v74 = v7; | |
8216 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v4 + 640 * v3]; | |
8217 v8 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); | |
8218 v9 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v3); | |
8219 v10 = v5->ptr_38->field_14; | |
8220 v76 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); | |
8221 v72 = v10; | |
8222 v81 = (unsigned __int64)(v10 * (signed __int64)v9) >> 16; | |
8223 v11 = v5->ptr_38; | |
8224 v12 = v81 + v11->field_C; | |
8225 v72 = v11->field_20; | |
8226 v67 = v12; | |
8227 v13 = ((unsigned __int64)(v72 * (signed __int64)v9) >> 16) + v5->ptr_38->field_18; | |
8228 v81 = v9; | |
8229 v70 = v13; | |
8230 v72 = v5->v_18.z; | |
8231 v81 = (unsigned __int64)(v72 * (signed __int64)v9) >> 16; | |
8232 v14 = v5->field_24; | |
8233 v15 = v81 + v5->v_18.x; | |
8234 v71 = v5->sTextureDeltaU << 16; | |
8235 v63 = v5->sTextureDeltaV << 16; | |
8236 v16 = v5->v_18.y; | |
8237 v17 = -v14; | |
8238 v60 = v15; | |
8239 v77 = v17; | |
8240 v81 = (unsigned __int64)(v76 * (signed __int64)v16) >> 16; | |
8241 X = v81 + v15; | |
8242 if ( !(v81 + v15) || (v62 = v17 >> 14, v18 = abs(v17 >> 14), v18 > abs(X)) ) | |
8243 return 0; | |
8244 LODWORD(v19) = v77 << 16; | |
8245 HIDWORD(v19) = v77 >> 16; | |
8246 v69 = v19 / X; | |
8247 v20 = v19 / X; | |
8248 v21 = (unsigned __int16 *)v5->pTexture->pLevelOfDetail2; | |
8249 a1.pTextureLOD = (unsigned __int16 *)v5->pTexture->pLevelOfDetail2; | |
8250 v75 = 2; | |
8251 if ( v20 >= mipmapping_building_mm1 << 16 ) | |
8252 { | |
8253 if ( v20 >= mipmapping_building_mm2 << 16 ) | |
8254 { | |
8255 if ( v20 >= mipmapping_building_mm3 << 16 ) | |
8256 { | |
8257 if ( bUseLoResSprites ) | |
8258 goto LABEL_12; | |
8259 v25 = v5->pTexture; | |
8260 v75 = 3; | |
8261 v21 = (unsigned __int16 *)v25->pLevelOfDetail3; | |
8262 } | |
8263 else | |
8264 { | |
8265 v24 = v5->pTexture; | |
8266 v75 = 2; | |
8267 v21 = (unsigned __int16 *)v24->pLevelOfDetail2; | |
8268 } | |
8269 } | |
8270 else | |
8271 { | |
8272 v23 = v5->pTexture; | |
8273 v75 = 1; | |
8274 v21 = (unsigned __int16 *)v23->pLevelOfDetail1; | |
8275 } | |
8276 } | |
8277 else | |
8278 { | |
8279 v22 = v5->pTexture; | |
8280 v75 = 0; | |
8281 v21 = (unsigned __int16 *)v22->pLevelOfDetail0_prolly_alpha_mask; | |
8282 } | |
8283 a1.pTextureLOD = v21; | |
8284 LABEL_12: | |
8285 if ( v21 ) | |
8286 { | |
8287 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, v20, v5, pOutdoorCamera->building_gamme, 1u, 1); | |
8288 a1.field_28 = 16; | |
8289 v66 = v74 >> 4; | |
8290 v81 = v8; | |
8291 v26 = v5->ptr_38; | |
8292 v72 = v74 - 16 * (v74 >> 4); | |
8293 v76 = v26->field_10; | |
8294 v81 = v8; | |
8295 v74 = v67 + ((unsigned __int64)(v76 * (signed __int64)v8) >> 16); | |
8296 v76 = v5->ptr_38->field_1C; | |
8297 v76 = v70 + ((unsigned __int64)(v76 * (signed __int64)v8) >> 16); | |
8298 v81 = (unsigned __int64)(v74 * (signed __int64)v20) >> 16; | |
8299 v27 = ((unsigned __int64)(v74 * (signed __int64)v20) >> 16) - v5->ptr_38->field_24; | |
8300 v81 = (unsigned __int64)(v76 * (signed __int64)v69) >> 16; | |
8301 v28 = v63 + ((unsigned __int64)(v76 * (signed __int64)v69) >> 16) - v5->ptr_38->field_28; | |
8302 v76 = v75 + bUseLoResSprites; | |
8303 v73 = v8 - 16 * pOutdoorCamera->int_fov_rad_inv; | |
8304 v29 = v5->pTexture; | |
8305 v30 = (v71 + v27) >> v76; | |
8306 v31 = v28 >> v76; | |
8307 v32 = (signed int)v29->uTextureWidth >> v75; | |
8308 v74 = (signed __int16)v75; | |
8309 v68 = v31; | |
8310 v80 = v32; | |
8311 v33 = (signed int)v29->uTextureHeight >> v75; | |
8312 v34 = v75 - v29->uWidthLn2; | |
8313 a1.field_8 = (v33 << 16) - 65536; | |
8314 v81 = 2 * pMiscTimer->uTotalGameTimeElapsed; | |
8315 a1.field_10 = v34 + 16; | |
8316 a1.field_C = v80 - 1; | |
8317 if ( v66 > 0 ) | |
8318 { | |
8319 v74 = v66; | |
8320 v66 = 12 - v75; | |
8321 do | |
8322 { | |
8323 v80 = v5->v_18.y; | |
8324 v35 = (unsigned __int64)(v80 * (signed __int64)v73) >> 16; | |
8325 v36 = v35 + v60; | |
8326 X = v35 + v60; | |
8327 if ( v35 + v60 && (v80 = abs(v62), v37 = abs(v36), v80 <= v37) ) | |
8328 { | |
8329 LODWORD(v38) = v77 << 16; | |
8330 HIDWORD(v38) = v77 >> 16; | |
8331 v80 = v38 / X; | |
8332 v39 = v38 / X; | |
8333 X = v38 / X; | |
8334 } | |
8335 else | |
8336 { | |
8337 X = 0x40000000u; | |
8338 v39 = 0x40000000u; | |
8339 } | |
8340 HIWORD(v40) = HIWORD(v39); | |
8341 if ( v39 <= v69 ) | |
8342 HIWORD(v40) = HIWORD(v69); | |
8343 LOWORD(v40) = 0; | |
8344 a1.field_24 = v5->field_50 | v40; | |
8345 v79 = v5->ptr_38->field_10; | |
8346 v79 = v67 + ((unsigned __int64)(v79 * (signed __int64)v73) >> 16); | |
8347 v80 = (unsigned __int64)(v79 * (signed __int64)v39) >> 16; | |
8348 v41 = v5->ptr_38; | |
8349 v42 = ((unsigned __int64)(v79 * (signed __int64)v39) >> 16) - v41->field_24; | |
8350 v79 = v41->field_1C; | |
8351 v79 = v70 + ((unsigned __int64)(v79 * (signed __int64)v73) >> 16); | |
8352 v80 = (unsigned __int64)(v79 * (signed __int64)v39) >> 16; | |
8353 v43 = (v71 + v42) >> v76; | |
8354 v79 = (signed int)(v63 + ((unsigned __int64)(v79 * (signed __int64)v39) >> 16) - v5->ptr_38->field_28) >> v76; | |
8355 a1.field_4 = (v43 - v30) >> 4; | |
8356 a1.field_0 = (v79 - v68) >> 4; | |
8357 a1.field_30 = v30 + 4 * stru_5C6E00->Cos(v81 + (v68 >> v66)); | |
8358 v44 = stru_5C6E00->Sin(v81 + (v30 >> v66)); | |
8359 a1.field_2C = v68 + 4 * v44; | |
8360 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
8361 sr_sub_485975(&a1, (stru315 *)&a2); | |
8362 else | |
8363 sr_sub_4D6FB0(v2); | |
8364 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, X, v5, pOutdoorCamera->building_gamme, 1u, 0); | |
8365 v73 -= 16 * pOutdoorCamera->int_fov_rad_inv; | |
8366 v45 = v74-- == 1; | |
8367 a1.field_28 = 16; | |
8368 v30 = v43; | |
8369 v68 = v79; | |
8370 } | |
8371 while ( !v45 ); | |
8372 v31 = v79; | |
8373 } | |
8374 if ( !v72 ) | |
8375 return 1; | |
8376 v66 = 12 - v75; | |
8377 a1.field_30 = v30 + 4 * stru_5C6E00->Cos(v81 + (v31 >> (12 - v75))); | |
8378 v46 = stru_5C6E00->Sin(v81 + (v30 >> v66)); | |
8379 a1.field_2C = v68 + 4 * v46; | |
8380 v79 = v5->v_18.y; | |
8381 v80 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; | |
8382 v47 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; | |
8383 v48 = v47 + v60; | |
8384 X = v47 + v60; | |
8385 if ( v47 + v60 ) | |
8386 { | |
8387 v79 = abs(v62); | |
8388 v49 = abs(v48); | |
8389 if ( v79 <= v49 ) | |
8390 { | |
8391 LODWORD(v50) = v77 << 16; | |
8392 HIDWORD(v50) = v77 >> 16; | |
8393 v77 = v50 / X; | |
8394 v51 = v50 / X; | |
8395 HIWORD(v52) = HIWORD(v69); | |
8396 if ( v51 <= v69 ) | |
8397 { | |
8398 LOWORD(v52) = 0; | |
8399 a1.field_24 = v52 | v5->field_50; | |
8400 } | |
8401 else | |
8402 { | |
8403 HIWORD(v53) = HIWORD(v51); | |
8404 LOWORD(v53) = 0; | |
8405 a1.field_24 = v53 | v5->field_50; | |
8406 } | |
8407 v79 = v5->ptr_38->field_10; | |
8408 v77 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; | |
8409 v79 = v67 + ((unsigned __int64)(v79 * (signed __int64)v73) >> 16); | |
8410 v67 = (unsigned __int64)(v79 * (signed __int64)v51) >> 16; | |
8411 v54 = v5->ptr_38; | |
8412 v55 = v67 - v54->field_24; | |
8413 v79 = v54->field_1C; | |
8414 v56 = v71 + v55; | |
8415 v71 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; | |
8416 v57 = v70 + ((unsigned __int64)(v79 * (signed __int64)v73) >> 16); | |
8417 v79 = v57; | |
8418 v58 = v57 * (signed __int64)v51; | |
8419 v70 = v58 >> 16; | |
8420 LODWORD(v58) = (signed int)(v63 + (v58 >> 16) - v5->ptr_38->field_28) >> v76; | |
8421 a1.field_4 = ((v56 >> v76) - v30) >> 4; | |
8422 a1.field_0 = ((signed int)v58 - v68) >> 4; | |
8423 a1.field_28 = v72; | |
8424 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
8425 sr_sub_485975(&a1, (stru315 *)&a2); | |
8426 else | |
8427 sr_sub_4D6FB0(v2); | |
8428 return 1; | |
8429 } | |
8430 } | |
8431 } | |
8432 return 0; | |
8433 } | |
8434 // 4D864C: using guessed type char byte_4D864C; | |
8435 // 6BE0E4: using guessed type int mipmapping_building_mm1; | |
8436 // 6BE0E8: using guessed type int mipmapping_building_mm2; | |
8437 // 6BE0EC: using guessed type int mipmapping_building_mm3; | |
8438 | |
8439 //----- (0048408A) -------------------------------------------------------- | |
8440 signed int sr_sub_48408A_prolly_odm_water_no_waves(Span *_this) | |
8441 { | |
8442 stru315 *v1; // ebp@0 | |
8443 Span *v2; // edi@1 | |
8444 stru148 *v3; // esi@1 | |
8445 int v4; // ecx@1 | |
8446 stru149 *v5; // eax@1 | |
8447 stru149 *v6; // eax@1 | |
8448 int v7; // edx@1 | |
8449 int v8; // eax@1 | |
8450 int v9; // ebx@1 | |
8451 int v10; // eax@1 | |
8452 int v11; // ecx@1 | |
8453 int v12; // eax@1 | |
8454 int v13; // ecx@1 | |
8455 int v14; // eax@1 | |
8456 signed int v15; // ecx@1 | |
8457 int v16; // ebx@1 | |
8458 signed __int64 v17; // qtt@3 | |
8459 stru149 *v18; // eax@3 | |
8460 int v19; // ebx@3 | |
8461 Texture *v20; // eax@4 | |
8462 unsigned __int16 *v21; // eax@4 | |
8463 Texture *v22; // eax@6 | |
8464 Texture *v23; // ecx@8 | |
8465 Texture *v24; // eax@10 | |
8466 stru149 *v25; // eax@12 | |
8467 signed int v26; // eax@12 | |
8468 int v27; // ecx@12 | |
8469 int v28; // eax@14 | |
8470 int v29; // edx@14 | |
8471 int v30; // ecx@14 | |
8472 Texture *v31; // esi@14 | |
8473 int v32; // edx@14 | |
8474 int v33; // eax@14 | |
8475 int v35; // [sp+Ch] [bp-8Ch]@1 | |
8476 int v36; // [sp+10h] [bp-88h]@1 | |
8477 stru316 a2; // [sp+14h] [bp-84h]@14 | |
8478 stru315 a1; // [sp+3Ch] [bp-5Ch]@1 | |
8479 int v39; // [sp+80h] [bp-18h]@1 | |
8480 int v40; // [sp+84h] [bp-14h]@1 | |
8481 int v41; // [sp+88h] [bp-10h]@1 | |
8482 int v42; // [sp+8Ch] [bp-Ch]@1 | |
8483 int v43; // [sp+90h] [bp-8h]@2 | |
8484 int v44; // [sp+94h] [bp-4h]@1 | |
8485 | |
8486 v2 = _this; | |
8487 v3 = _this->pParent; | |
8488 v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); | |
8489 v5 = v3->ptr_38; | |
8490 v44 = v4; | |
8491 v42 = v5->field_14; | |
8492 v44 = (unsigned __int64)(v42 * (signed __int64)v4) >> 16; | |
8493 v6 = v3->ptr_38; | |
8494 v7 = v44 + v6->field_C; | |
8495 v42 = v6->field_20; | |
8496 v39 = v7; | |
8497 v8 = ((unsigned __int64)(v42 * (signed __int64)v4) >> 16) + v3->ptr_38->field_18; | |
8498 v44 = v4; | |
8499 v41 = v8; | |
8500 v42 = v3->v_18.z; | |
8501 v44 = (unsigned __int64)(v42 * (signed __int64)v4) >> 16; | |
8502 v9 = v44 + v3->v_18.x; | |
8503 v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
8504 v10 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); | |
8505 v11 = v2->field_8; | |
8506 v36 = v10; | |
8507 a1.field_28 = v2->field_C; | |
8508 v12 = pViewport->uScreenCenterX - v11; | |
8509 v13 = v3->field_24; | |
8510 v42 = pOutdoorCamera->int_fov_rad_inv * v12; | |
8511 v14 = v3->v_18.y; | |
8512 v15 = -v13; | |
8513 v40 = v15; | |
8514 v16 = ((unsigned __int64)(v42 * (signed __int64)v14) >> 16) + v9; | |
8515 v44 = v16; | |
8516 if ( !v16 || (v43 = abs(v15 >> 14), v43 > abs(v16)) ) | |
8517 return 0; | |
8518 LODWORD(v17) = v40 << 16; | |
8519 HIDWORD(v17) = v40 >> 16; | |
8520 v43 = v17 / v44; | |
8521 v18 = v3->ptr_38; | |
8522 v44 = v42; | |
8523 v40 = v18->field_10; | |
8524 v44 = v42; | |
8525 v40 = v39 + ((unsigned __int64)(v40 * (signed __int64)v42) >> 16); | |
8526 v39 = v3->ptr_38->field_1C; | |
8527 v44 = (unsigned __int64)(v39 * (signed __int64)v42) >> 16; | |
8528 v19 = v43; | |
8529 v41 += (unsigned __int64)(v39 * (signed __int64)v42) >> 16; | |
8530 a1.pTextureLOD = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
8531 v44 = 2; | |
8532 if ( v43 < mipmapping_terrain_mm1 << 16 ) | |
8533 { | |
8534 v20 = v3->pTexture; | |
8535 v44 = 0; | |
8536 v21 = (unsigned __int16 *)v20->pLevelOfDetail0_prolly_alpha_mask; | |
8537 LABEL_11: | |
8538 a1.pTextureLOD = v21; | |
8539 goto LABEL_12; | |
8540 } | |
8541 if ( v43 < mipmapping_terrain_mm2 << 16 ) | |
8542 { | |
8543 v22 = v3->pTexture; | |
8544 v44 = 1; | |
8545 v21 = (unsigned __int16 *)v22->pLevelOfDetail1; | |
8546 goto LABEL_11; | |
8547 } | |
8548 if ( v43 >= mipmapping_terrain_mm3 << 16 ) | |
8549 { | |
8550 if ( !bUseLoResSprites ) | |
8551 { | |
8552 v24 = v3->pTexture; | |
8553 v44 = 3; | |
8554 v21 = (unsigned __int16 *)v24->pLevelOfDetail3; | |
8555 goto LABEL_11; | |
8556 } | |
8557 } | |
8558 else | |
8559 { | |
8560 v23 = v3->pTexture; | |
8561 v44 = 2; | |
8562 a1.pTextureLOD = (unsigned __int16 *)v23->pLevelOfDetail2; | |
8563 } | |
8564 LABEL_12: | |
8565 v43 = (unsigned __int64)(v40 * (signed __int64)v43) >> 16; | |
8566 v25 = v3->ptr_38; | |
8567 v43 = v19; | |
8568 a1.field_30 = ((unsigned __int64)(v40 * (signed __int64)v19) >> 16) - v25->field_24; | |
8569 v43 = (unsigned __int64)(v41 * (signed __int64)v19) >> 16; | |
8570 v26 = ((unsigned __int64)(v41 * (signed __int64)v19) >> 16) - v3->ptr_38->field_28; | |
8571 v27 = bUseLoResSprites + v44 + 2; | |
8572 a1.field_30 >>= v27; | |
8573 v41 = bUseLoResSprites + v44 + 2; | |
8574 a1.field_2C = v26 >> v27; | |
8575 if ( byte_80AA10 ) | |
8576 { | |
8577 a1.field_14 = dword_80AA20 >> v27; | |
8578 a1.field_18 = dword_80AA1C >> v27; | |
8579 a1.field_1C = dword_80AA18 >> v27; | |
8580 a1.field_20 = dword_80AA14 >> v27; | |
8581 } | |
8582 v41 = pOutdoorCamera->int_fov_rad_inv; | |
8583 v42 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v19) >> 16) >> v27; | |
8584 a1.field_4 = (unsigned __int64)(v42 * (signed __int64)v35) >> 16; | |
8585 v43 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16; | |
8586 a1.field_0 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16; | |
8587 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v19, v3, pOutdoorCamera->terrain_gamma, 1u, 1); | |
8588 LOWORD(v19) = 0; | |
8589 v28 = v2->field_A; | |
8590 v29 = v2->field_A; | |
8591 a1.field_24 = v19; | |
8592 v30 = v2->field_8; | |
8593 a1.pColorBuffer = &pRenderer->pTargetSurface[v30 + pRenderer->uTargetSurfacePitch * v29]; | |
8594 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v30 + 640 * v28]; | |
8595 v31 = v3->pTexture; | |
8596 v32 = ((signed int)v31->uTextureWidth >> v44) - 1; | |
8597 v33 = ((signed int)v31->uTextureHeight >> v44 << 16) - 65536; | |
8598 a1.field_10 = v44 - v31->uWidthLn2 + 16; | |
8599 a1.field_C = v32; | |
8600 a1.field_8 = v33; | |
8601 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
8602 { | |
8603 if ( byte_80AA10 ) | |
8604 sr_sub_485A24(&a1, (stru315 *)&a2); | |
8605 else | |
8606 sr_sub_485975(&a1, (stru315 *)&a2); | |
8607 } | |
8608 else | |
8609 { | |
8610 if ( byte_80AA10 ) | |
8611 sr_sub_4D705A(v1); | |
8612 else | |
8613 sr_sub_4D6FB0(v1); | |
8614 } | |
8615 return 1; | |
8616 } | |
8617 | |
8618 //----- (00484442) -------------------------------------------------------- | |
8619 signed int sr_sub_484442(Span *_this) | |
8620 { | |
8621 int v1; // ebp@0 | |
8622 Span *v2; // edi@1 | |
8623 stru148 *v3; // esi@1 | |
8624 int v4; // ecx@1 | |
8625 stru149 *v5; // eax@1 | |
8626 stru149 *v6; // eax@1 | |
8627 int v7; // edx@1 | |
8628 int v8; // eax@1 | |
8629 int v9; // ebx@1 | |
8630 int v10; // eax@1 | |
8631 int v11; // ecx@1 | |
8632 int v12; // eax@1 | |
8633 int v13; // ecx@1 | |
8634 signed int v14; // ecx@1 | |
8635 int v15; // ebx@1 | |
8636 signed __int64 v16; // qtt@3 | |
8637 int v17; // ecx@3 | |
8638 int v18; // ebx@3 | |
8639 int v19; // eax@3 | |
8640 signed int v20; // ebx@3 | |
8641 unsigned __int16 *v21; // eax@4 | |
8642 stru149 *v22; // eax@12 | |
8643 signed int v23; // eax@12 | |
8644 int v24; // ecx@12 | |
8645 int v25; // ecx@14 | |
8646 unsigned int *v26; // eax@14 | |
8647 Texture *v27; // esi@14 | |
8648 signed int v28; // edi@14 | |
8649 signed int v29; // eax@14 | |
8650 signed int v31; // [sp+Ch] [bp-90h]@1 | |
8651 int v32; // [sp+10h] [bp-8Ch]@1 | |
8652 int v33; // [sp+14h] [bp-88h]@1 | |
8653 stru316 v34; // [sp+18h] [bp-84h]@14 | |
8654 stru315 v35; // [sp+40h] [bp-5Ch]@1 | |
8655 int v36; // [sp+84h] [bp-18h]@1 | |
8656 int v37; // [sp+88h] [bp-14h]@1 | |
8657 int v38; // [sp+8Ch] [bp-10h]@1 | |
8658 int v39; // [sp+90h] [bp-Ch]@1 | |
8659 int v40; // [sp+94h] [bp-8h]@1 | |
8660 int v41; // [sp+98h] [bp-4h]@1 | |
8661 | |
8662 v2 = _this; | |
8663 v3 = _this->pParent; | |
8664 v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); | |
8665 v5 = v3->ptr_38; | |
8666 v40 = v4; | |
8667 v39 = v5->field_14; | |
8668 v40 = (unsigned __int64)(v39 * (signed __int64)v4) >> 16; | |
8669 v6 = v3->ptr_38; | |
8670 v7 = v40 + v6->field_C; | |
8671 v39 = v6->field_20; | |
8672 v36 = v7; | |
8673 v8 = ((unsigned __int64)(v39 * (signed __int64)v4) >> 16) + v3->ptr_38->field_18; | |
8674 v40 = v4; | |
8675 v38 = v8; | |
8676 v39 = v3->v_18.z; | |
8677 v40 = (unsigned __int64)(v39 * (signed __int64)v4) >> 16; | |
8678 v9 = v40 + v3->v_18.x; | |
8679 v32 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
8680 v10 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); | |
8681 v11 = v2->field_8; | |
8682 v33 = v10; | |
8683 v35.field_28 = v2->field_C; | |
8684 v12 = pViewport->uScreenCenterX - v11; | |
8685 v13 = v3->field_24; | |
8686 v41 = pOutdoorCamera->int_fov_rad_inv * v12; | |
8687 v14 = -v13; | |
8688 v31 = v14; | |
8689 v15 = ((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * v12 * (signed __int64)v3->v_18.y) >> 16) + v9; | |
8690 v37 = v15; | |
8691 if ( !v15 || (v39 = abs(v14 >> 14), v39 > abs(v15)) ) | |
8692 return 0; | |
8693 LODWORD(v16) = v31 << 16; | |
8694 HIDWORD(v16) = v31 >> 16; | |
8695 v40 = v16 / v37; | |
8696 v17 = v16 / v37; | |
8697 v18 = v41; | |
8698 HIWORD(v19) = (unsigned int)(v16 / v37) >> 16; | |
8699 LOWORD(v19) = 0; | |
8700 v35.field_24 = v19; | |
8701 v37 = v36 + ((unsigned __int64)(v3->ptr_38->field_10 * (signed __int64)v41) >> 16); | |
8702 v36 = v3->ptr_38->field_1C; | |
8703 v41 = (unsigned __int64)(v36 * (signed __int64)v41) >> 16; | |
8704 v38 += (unsigned __int64)(v36 * (signed __int64)v18) >> 16; | |
8705 v20 = 2; | |
8706 v35.pTextureLOD = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
8707 if ( v17 < mipmapping_terrain_mm1 << 16 ) | |
8708 { | |
8709 v20 = 0; | |
8710 v21 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail0_prolly_alpha_mask; | |
8711 LABEL_11: | |
8712 v35.pTextureLOD = v21; | |
8713 goto LABEL_12; | |
8714 } | |
8715 if ( v17 < mipmapping_terrain_mm2 << 16 ) | |
8716 { | |
8717 v20 = 1; | |
8718 v21 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail1; | |
8719 goto LABEL_11; | |
8720 } | |
8721 if ( v17 < mipmapping_terrain_mm3 << 16 ) | |
8722 { | |
8723 v21 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
8724 goto LABEL_11; | |
8725 } | |
8726 if ( !bUseLoResSprites ) | |
8727 { | |
8728 v20 = 3; | |
8729 v21 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail3; | |
8730 goto LABEL_11; | |
8731 } | |
8732 LABEL_12: | |
8733 v41 = (unsigned __int64)(v37 * (signed __int64)v17) >> 16; | |
8734 v22 = v3->ptr_38; | |
8735 v41 = v17; | |
8736 v35.field_30 = ((unsigned __int64)(v37 * (signed __int64)v17) >> 16) - v22->field_24; | |
8737 v23 = ((unsigned __int64)(v38 * (signed __int64)v17) >> 16) - v3->ptr_38->field_28; | |
8738 v24 = bUseLoResSprites + v20 + 2; | |
8739 v35.field_30 >>= v24; | |
8740 v38 = bUseLoResSprites + v20 + 2; | |
8741 v35.field_2C = v23 >> v24; | |
8742 if ( byte_80AA10 ) | |
8743 { | |
8744 v35.field_14 = dword_80AA20 >> v24; | |
8745 v35.field_18 = dword_80AA1C >> v24; | |
8746 v35.field_1C = dword_80AA18 >> v24; | |
8747 v35.field_20 = dword_80AA14 >> v24; | |
8748 } | |
8749 v38 = pOutdoorCamera->int_fov_rad_inv; | |
8750 v39 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v40) >> 16) >> v24; | |
8751 v35.field_4 = (unsigned __int64)(v39 * (signed __int64)v32) >> 16; | |
8752 v41 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16; | |
8753 v35.field_0 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16; | |
8754 v35.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&v34, v2, v40, v3, pOutdoorCamera->terrain_gamma, 1u, 1); | |
8755 v25 = v2->field_8; | |
8756 v26 = (unsigned int *)&pRenderer->pActiveZBuffer[v25 + 640 * v2->field_A]; | |
8757 v35.pColorBuffer = &pRenderer->pTargetSurface[v25 + pRenderer->uTargetSurfacePitch * v2->field_A]; | |
8758 v35.pDepthBuffer = v26; | |
8759 v27 = v3->pTexture; | |
8760 v28 = (signed int)v27->uTextureWidth >> v20; | |
8761 v29 = (signed int)v27->uTextureHeight >> v20; | |
8762 v35.field_10 = v20 - v27->uWidthLn2 + 16; | |
8763 v35.field_C = v28 - 1; | |
8764 v35.field_8 = (v29 << 16) - 65536; | |
8765 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
8766 { | |
8767 if ( byte_80AA10 ) | |
8768 sr_sub_485D3E(&v35, &v34); | |
8769 else | |
8770 sr_sub_485C89(&v35, &v34); | |
8771 } | |
8772 else | |
8773 { | |
8774 if ( byte_80AA10 ) | |
8775 sr_sub_4D72EC(v1); | |
8776 else | |
8777 sr_sub_4D73DF(v1); | |
8778 } | |
8779 return 1; | |
8780 } | |
8781 | |
8782 //----- (004847EB) -------------------------------------------------------- | |
8783 int sr_sub_4847EB(Span *_this) | |
8784 { | |
8785 stru315 *v1; // ebp@0 | |
8786 int v2; // ebx@1 | |
8787 int v3; // edx@1 | |
8788 stru148 *v4; // esi@1 | |
8789 int v5; // eax@1 | |
8790 signed int v6; // eax@3 | |
8791 int v7; // edi@3 | |
8792 stru149 *v8; // eax@3 | |
8793 stru149 *v9; // eax@3 | |
8794 int v10; // edx@3 | |
8795 int v11; // eax@3 | |
8796 signed int v12; // ebx@3 | |
8797 int v13; // ebx@4 | |
8798 signed __int64 v14; // qtt@5 | |
8799 int v15; // eax@5 | |
8800 signed int v16; // ebx@5 | |
8801 unsigned __int16 *v17; // ecx@6 | |
8802 stru149 *v18; // eax@14 | |
8803 stru149 *v19; // eax@14 | |
8804 signed int v20; // eax@14 | |
8805 int v21; // ecx@14 | |
8806 Texture *v22; // edx@16 | |
8807 signed int v23; // eax@16 | |
8808 int v24; // ebx@16 | |
8809 int v25; // edi@17 | |
8810 int v26; // ebx@17 | |
8811 int v27; // eax@17 | |
8812 int v28; // edi@17 | |
8813 int v29; // eax@18 | |
8814 signed __int64 v30; // qtt@19 | |
8815 int v31; // ecx@19 | |
8816 int v32; // eax@19 | |
8817 stru149 *v33; // eax@21 | |
8818 signed int v34; // edi@21 | |
8819 int v35; // ebx@21 | |
8820 signed int v36; // edi@21 | |
8821 signed __int64 v37; // qtt@21 | |
8822 signed int v38; // ebx@21 | |
8823 int v39; // ebx@29 | |
8824 int v40; // eax@32 | |
8825 unsigned __int64 v41; // qax@32 | |
8826 int v42; // edi@32 | |
8827 int v43; // eax@33 | |
8828 signed __int64 v44; // qtt@34 | |
8829 int v45; // ecx@34 | |
8830 int v46; // eax@34 | |
8831 stru149 *v47; // eax@36 | |
8832 signed int v48; // edi@36 | |
8833 int v49; // eax@36 | |
8834 int v50; // eax@47 | |
8835 unsigned __int64 v51; // qax@47 | |
8836 int v52; // edi@47 | |
8837 int v53; // eax@48 | |
8838 signed __int64 v54; // qtt@49 | |
8839 int v55; // ecx@49 | |
8840 int v56; // eax@49 | |
8841 stru149 *v57; // eax@51 | |
8842 signed int v58; // edi@51 | |
8843 int v59; // eax@51 | |
8844 Span *v61; // [sp+Ch] [bp-B0h]@1 | |
8845 int v62; // [sp+10h] [bp-ACh]@3 | |
8846 int v63; // [sp+14h] [bp-A8h]@3 | |
8847 int v64; // [sp+18h] [bp-A4h]@3 | |
8848 int v65; // [sp+1Ch] [bp-A0h]@3 | |
8849 signed int v66; // [sp+20h] [bp-9Ch]@3 | |
8850 signed int v67; // [sp+24h] [bp-98h]@3 | |
8851 int v68; // [sp+28h] [bp-94h]@1 | |
8852 char v69; // [sp+2Ch] [bp-90h]@1 | |
8853 stru315 sr; // [sp+30h] [bp-8Ch]@1 | |
8854 stru316 sr2; // [sp+74h] [bp-48h]@14 | |
8855 int v72; // [sp+9Ch] [bp-20h]@5 | |
8856 int v73; // [sp+A0h] [bp-1Ch]@1 | |
8857 int v74; // [sp+A4h] [bp-18h]@3 | |
8858 int v75; // [sp+A8h] [bp-14h]@21 | |
8859 int v76; // [sp+ACh] [bp-10h]@1 | |
8860 int v77; // [sp+B0h] [bp-Ch]@14 | |
8861 int v78; // [sp+B4h] [bp-8h]@3 | |
8862 int v79; // [sp+B8h] [bp-4h]@3 | |
8863 | |
8864 v2 = _this->field_A; | |
8865 v3 = _this->field_8; | |
8866 v4 = _this->pParent; | |
8867 v73 = 0; | |
8868 v61 = _this; | |
8869 sr.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v3 + 640 * v2]; | |
8870 v76 = v3; | |
8871 v5 = _this->field_C; | |
8872 sr.pColorBuffer = &pRenderer->pTargetSurface[v3 + pRenderer->uTargetSurfacePitch * v2]; | |
8873 v68 = texmapping_terrain_subdivsize; | |
8874 v69 = texmapping_terrain_subdivpow2; | |
8875 if ( v5 >= texmapping_terrain_subdivsize ) | |
8876 v73 = texmapping_terrain_subdivsize - (v3 & (texmapping_terrain_subdivsize - 1)); | |
8877 v6 = v5 - v73; | |
8878 v67 = v6 >> texmapping_terrain_subdivpow2; | |
8879 v62 = v6 - (v6 >> texmapping_terrain_subdivpow2 << texmapping_terrain_subdivpow2); | |
8880 v7 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); | |
8881 v8 = v4->ptr_38; | |
8882 v79 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); | |
8883 v78 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); | |
8884 v76 = v8->field_14; | |
8885 v78 = (unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; | |
8886 v9 = v4->ptr_38; | |
8887 v10 = v78 + v9->field_C; | |
8888 v76 = v9->field_20; | |
8889 v65 = v10; | |
8890 v11 = ((unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16) | |
8891 + v4->ptr_38->field_18; | |
8892 v78 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); | |
8893 v64 = v11; | |
8894 v76 = v4->v_18.z; | |
8895 v78 = (unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; | |
8896 v12 = -v4->field_24; | |
8897 v63 = v78 + v4->v_18.x; | |
8898 v66 = -v4->field_24; | |
8899 v78 = (unsigned __int64)(v79 * (signed __int64)v4->v_18.y) >> 16; | |
8900 v74 = v78 + v63; | |
8901 if ( !(v78 + v63) || (v76 = v12 >> 14, v13 = abs(v12 >> 14), v13 > abs(v74)) ) | |
8902 return 0; | |
8903 LODWORD(v14) = v66 << 16; | |
8904 HIDWORD(v14) = v66 >> 16; | |
8905 v72 = v14 / v74; | |
8906 sr.pTextureLOD = (unsigned __int16 *)v4->pTexture->pLevelOfDetail2; | |
8907 v15 = v14 / v74; | |
8908 v16 = 2; | |
8909 if ( v15 >= mipmapping_terrain_mm1 << 16 ) | |
8910 { | |
8911 if ( v15 >= mipmapping_terrain_mm2 << 16 ) | |
8912 { | |
8913 if ( v15 >= mipmapping_terrain_mm3 << 16 ) | |
8914 { | |
8915 if ( bUseLoResSprites ) | |
8916 goto LABEL_14; | |
8917 v16 = 3; | |
8918 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail3; | |
8919 } | |
8920 else | |
8921 { | |
8922 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail2; | |
8923 } | |
8924 } | |
8925 else | |
8926 { | |
8927 v16 = 1; | |
8928 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail1; | |
8929 } | |
8930 } | |
8931 else | |
8932 { | |
8933 v16 = 0; | |
8934 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail0_prolly_alpha_mask; | |
8935 } | |
8936 sr.pTextureLOD = v17; | |
8937 LABEL_14: | |
8938 sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v15, v4, pOutdoorCamera->terrain_gamma, 1u, 1); | |
8939 v18 = v4->ptr_38; | |
8940 v78 = v7; | |
8941 v79 = v18->field_10; | |
8942 v78 = v7; | |
8943 v77 = v65 + ((unsigned __int64)(v79 * (signed __int64)v7) >> 16); | |
8944 v79 = v4->ptr_38->field_1C; | |
8945 v79 = v64 + ((unsigned __int64)(v79 * (signed __int64)v7) >> 16); | |
8946 v78 = (unsigned __int64)(v77 * (signed __int64)v72) >> 16; | |
8947 v19 = v4->ptr_38; | |
8948 v78 = v72; | |
8949 sr.field_30 = ((unsigned __int64)(v77 * (signed __int64)v72) >> 16) - v19->field_24; | |
8950 v78 = (unsigned __int64)(v79 * (signed __int64)v72) >> 16; | |
8951 v20 = ((unsigned __int64)(v79 * (signed __int64)v72) >> 16) - v4->ptr_38->field_28; | |
8952 v21 = bUseLoResSprites + v16 + 2; | |
8953 sr.field_30 >>= v21; | |
8954 v78 = bUseLoResSprites + v16 + 2; | |
8955 sr.field_2C = v20 >> v21; | |
8956 if ( byte_80AA10 ) | |
8957 { | |
8958 sr.field_14 = dword_80AA20 >> v21; | |
8959 sr.field_18 = dword_80AA1C >> v21; | |
8960 sr.field_1C = dword_80AA18 >> v21; | |
8961 sr.field_20 = dword_80AA14 >> v21; | |
8962 } | |
8963 v22 = v4->pTexture; | |
8964 v79 = (signed int)v22->uTextureWidth >> v16; | |
8965 v23 = (signed int)v22->uTextureHeight >> v16; | |
8966 v24 = v16 - v22->uWidthLn2 + 16; | |
8967 sr.field_8 = (v23 << 16) - 65536; | |
8968 sr.field_10 = v24; | |
8969 sr.field_C = v79 - 1; | |
8970 if ( v73 ) | |
8971 { | |
8972 v25 = v7 - v73 * pOutdoorCamera->int_fov_rad_inv; | |
8973 v26 = v25; | |
8974 v77 = v4->v_18.y; | |
8975 v79 = v25; | |
8976 v27 = (unsigned __int64)(v77 * (signed __int64)v25) >> 16; | |
8977 v28 = v27 + v63; | |
8978 v74 = v27 + v63; | |
8979 if ( !(v27 + v63) || (v77 = abs(v76), v29 = abs(v28), v77 > v29) ) | |
8980 return 0; | |
8981 LODWORD(v30) = v66 << 16; | |
8982 HIDWORD(v30) = v66 >> 16; | |
8983 v77 = v30 / v74; | |
8984 v31 = v30 / v74; | |
8985 HIWORD(v32) = HIWORD(v72); | |
8986 if ( v72 <= v31 ) | |
8987 HIWORD(v32) = HIWORD(v31); | |
8988 LOWORD(v32) = 0; | |
8989 v77 = v26; | |
8990 sr.field_24 = v32; | |
8991 v74 = v4->ptr_38->field_10; | |
8992 v74 = v65 + ((unsigned __int64)(v74 * (signed __int64)v26) >> 16); | |
8993 v77 = (unsigned __int64)(v74 * (signed __int64)v31) >> 16; | |
8994 v33 = v4->ptr_38; | |
8995 v77 = v26; | |
8996 v34 = ((unsigned __int64)(v74 * (signed __int64)v31) >> 16) - v33->field_24; | |
8997 v74 = v33->field_1C; | |
8998 v74 = v64 + ((unsigned __int64)(v74 * (signed __int64)v26) >> 16); | |
8999 v77 = (unsigned __int64)(v74 * (signed __int64)v31) >> 16; | |
9000 v35 = (v77 - v4->ptr_38->field_28) >> v78; | |
9001 v74 = v73 << 16; | |
9002 v36 = (v34 >> v78) - sr.field_30; | |
9003 LODWORD(v37) = v36 << 16; | |
9004 HIDWORD(v37) = v36 >> 16; | |
9005 v38 = v35 - sr.field_2C; | |
9006 sr.field_4 = v37 / (v73 << 16); | |
9007 v75 = v73 << 16; | |
9008 LODWORD(v37) = v38 << 16; | |
9009 HIDWORD(v37) = v38 >> 16; | |
9010 v77 = v37 / (v73 << 16); | |
9011 sr.field_0 = v37 / (v73 << 16); | |
9012 sr.field_28 = v73; | |
9013 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
9014 { | |
9015 if ( byte_80AA10 ) | |
9016 sr_sub_485A24(&sr, (stru315 *)&sr2); | |
9017 else | |
9018 sr_sub_485975(&sr, (stru315 *)&sr2); | |
9019 } | |
9020 else | |
9021 { | |
9022 if ( byte_80AA10 ) | |
9023 sr_sub_4D705A(v1); | |
9024 else | |
9025 sr_sub_4D6FB0(v1); | |
9026 } | |
9027 v39 = v79 - (pOutdoorCamera->int_fov_rad_inv << v69); | |
9028 } | |
9029 else | |
9030 { | |
9031 v79 = v7 - (pOutdoorCamera->int_fov_rad_inv << v69); | |
9032 v39 = v7 - (pOutdoorCamera->int_fov_rad_inv << v69); | |
9033 } | |
9034 sr.field_28 = v68; | |
9035 while ( v67 > 0 ) | |
9036 { | |
9037 v40 = v4->v_18.y; | |
9038 --v67; | |
9039 v75 = v40; | |
9040 v41 = v40 * (signed __int64)v39; | |
9041 v79 = v41 >> 16; | |
9042 LODWORD(v41) = v41 >> 16; | |
9043 v42 = v41 + v63; | |
9044 v74 = v41 + v63; | |
9045 if ( !((int)v41 + v63) || (v75 = abs(v76), v43 = abs(v42), v75 > v43) ) | |
9046 return 0; | |
9047 LODWORD(v44) = v66 << 16; | |
9048 HIDWORD(v44) = v66 >> 16; | |
9049 v73 = v44 / v74; | |
9050 v45 = v44 / v74; | |
9051 HIWORD(v46) = HIWORD(v72); | |
9052 if ( v72 <= v45 ) | |
9053 HIWORD(v46) = HIWORD(v45); | |
9054 LOWORD(v46) = 0; | |
9055 v79 = v39; | |
9056 sr.field_24 = v46; | |
9057 v75 = v4->ptr_38->field_10; | |
9058 v75 = v65 + ((unsigned __int64)(v75 * (signed __int64)v39) >> 16); | |
9059 v79 = (unsigned __int64)(v75 * (signed __int64)v45) >> 16; | |
9060 v47 = v4->ptr_38; | |
9061 v79 = v39; | |
9062 v48 = ((unsigned __int64)(v75 * (signed __int64)v45) >> 16) - v47->field_24; | |
9063 v75 = v47->field_1C; | |
9064 v75 = v64 + ((unsigned __int64)(v75 * (signed __int64)v39) >> 16); | |
9065 v79 = (unsigned __int64)(v75 * (signed __int64)v45) >> 16; | |
9066 v49 = (((v79 - v4->ptr_38->field_28) >> v78) - sr.field_2C) >> v69; | |
9067 sr.field_4 = ((v48 >> v78) - sr.field_30) >> v69; | |
9068 sr.field_0 = v49; | |
9069 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
9070 { | |
9071 if ( byte_80AA10 ) | |
9072 sr_sub_485A24(&sr, (stru315 *)&sr2); | |
9073 else | |
9074 sr_sub_485975(&sr, (stru315 *)&sr2); | |
9075 } | |
9076 else | |
9077 { | |
9078 if ( byte_80AA10 ) | |
9079 sr_sub_4D705A(v1); | |
9080 else | |
9081 sr_sub_4D6FB0(v1); | |
9082 } | |
9083 sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v73, v4, pOutdoorCamera->terrain_gamma, 1u, 0); | |
9084 sr.field_28 = v68; | |
9085 v39 -= pOutdoorCamera->int_fov_rad_inv << v69; | |
9086 } | |
9087 if ( !v62 ) | |
9088 return 1; | |
9089 v50 = v4->v_18.y; | |
9090 v75 = v50; | |
9091 v51 = v50 * (signed __int64)v39; | |
9092 v79 = v51 >> 16; | |
9093 LODWORD(v51) = v51 >> 16; | |
9094 v52 = v51 + v63; | |
9095 v74 = v51 + v63; | |
9096 if ( (int)v51 + v63 ) | |
9097 { | |
9098 v75 = abs(v76); | |
9099 v53 = abs(v52); | |
9100 if ( v75 <= v53 ) | |
9101 { | |
9102 LODWORD(v54) = v66 << 16; | |
9103 HIDWORD(v54) = v66 >> 16; | |
9104 v76 = v54 / v74; | |
9105 v55 = v54 / v74; | |
9106 HIWORD(v56) = HIWORD(v72); | |
9107 if ( v72 <= v55 ) | |
9108 HIWORD(v56) = HIWORD(v55); | |
9109 LOWORD(v56) = 0; | |
9110 v76 = v39; | |
9111 sr.field_24 = v56; | |
9112 v75 = v4->ptr_38->field_10; | |
9113 v75 = v65 + ((unsigned __int64)(v75 * (signed __int64)v39) >> 16); | |
9114 v76 = (unsigned __int64)(v75 * (signed __int64)v55) >> 16; | |
9115 v57 = v4->ptr_38; | |
9116 v76 = v39; | |
9117 v58 = ((unsigned __int64)(v75 * (signed __int64)v55) >> 16) - v57->field_24; | |
9118 v75 = v57->field_1C; | |
9119 v75 = v64 + ((unsigned __int64)(v75 * (signed __int64)v39) >> 16); | |
9120 v76 = (unsigned __int64)(v75 * (signed __int64)v55) >> 16; | |
9121 v59 = (((v76 - v4->ptr_38->field_28) >> v78) - sr.field_2C) >> v69; | |
9122 sr.field_4 = ((v58 >> v78) - sr.field_30) >> v69; | |
9123 sr.field_0 = v59; | |
9124 sr.field_28 = v62; | |
9125 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
9126 { | |
9127 if ( byte_80AA10 ) | |
9128 sr_sub_485A24(&sr, (stru315 *)&sr2); | |
9129 else | |
9130 sr_sub_485975(&sr, (stru315 *)&sr2); | |
9131 } | |
9132 else | |
9133 { | |
9134 if ( byte_80AA10 ) | |
9135 sr_sub_4D705A(v1); | |
9136 else | |
9137 sr_sub_4D6FB0(v1); | |
9138 } | |
9139 return 1; | |
9140 } | |
9141 } | |
9142 return 0; | |
9143 } | |
9144 // 4D864C: using guessed type char byte_4D864C; | |
9145 // 6BE050: using guessed type int texmapping_terrain_subdivsize; | |
9146 // 6BE054: using guessed type int texmapping_terrain_subdivpow2; | |
9147 // 6BE0F0: using guessed type int mipmapping_terrain_mm1; | |
9148 // 6BE0F4: using guessed type int mipmapping_terrain_mm2; | |
9149 // 6BE0F8: using guessed type int mipmapping_terrain_mm3; | |
9150 // 80AA10: using guessed type char byte_80AA10; | |
9151 // 80AA14: using guessed type int dword_80AA14; | |
9152 // 80AA18: using guessed type int dword_80AA18; | |
9153 // 80AA1C: using guessed type int dword_80AA1C; | |
9154 // 80AA20: using guessed type int dword_80AA20; | |
9155 | |
9156 //----- (00485407) -------------------------------------------------------- | |
9157 signed int __fastcall sr_sub_485407_prolly_odm_water_wavy(Span *a1) | |
9158 { | |
9159 stru315 *v1; // ebp@0 | |
9160 int v2; // eax@1 | |
9161 int v3; // edx@1 | |
9162 unsigned int v4; // edi@1 | |
9163 stru148 *v5; // esi@1 | |
9164 int v6; // ecx@1 | |
9165 int v7; // ebx@1 | |
9166 int v8; // ecx@1 | |
9167 stru149 *v9; // eax@1 | |
9168 stru149 *v10; // eax@1 | |
9169 int v11; // edx@1 | |
9170 int v12; // eax@1 | |
9171 int v13; // eax@1 | |
9172 int v14; // ecx@1 | |
9173 signed int v15; // edi@1 | |
9174 int v16; // edi@2 | |
9175 signed __int64 v17; // qtt@3 | |
9176 int v18; // edi@3 | |
9177 int v19; // eax@3 | |
9178 unsigned __int8 *pLOD; // eax@3 | |
9179 Texture *v21; // eax@4 | |
9180 Texture *v22; // eax@6 | |
9181 Texture *v23; // eax@8 | |
9182 Texture *v24; // eax@10 | |
9183 stru149 *v25; // eax@13 | |
9184 stru149 *v26; // eax@13 | |
9185 signed int v27; // ebx@13 | |
9186 stru149 *v28; // eax@13 | |
9187 Texture *v29; // esi@13 | |
9188 signed int v30; // ebx@13 | |
9189 signed int v31; // edi@13 | |
9190 signed int v32; // edx@13 | |
9191 signed int v33; // eax@13 | |
9192 int v34; // esi@13 | |
9193 int v35; // eax@13 | |
9194 unsigned __int64 v36; // qax@13 | |
9195 int v37; // eax@13 | |
9196 unsigned __int64 v38; // qax@13 | |
9197 char v39; // cl@14 | |
9198 stru316 a2; // [sp+Ch] [bp-90h]@13 | |
9199 stru315 a1a; // [sp+34h] [bp-68h]@1 | |
9200 Span *v43; // [sp+78h] [bp-24h]@1 | |
9201 int v44; // [sp+7Ch] [bp-20h]@1 | |
9202 int v45; // [sp+80h] [bp-1Ch]@1 | |
9203 int v46; // [sp+84h] [bp-18h]@1 | |
9204 Span *v47; // [sp+88h] [bp-14h]@1 | |
9205 int v48; // [sp+8Ch] [bp-10h]@1 | |
9206 int v49; // [sp+90h] [bp-Ch]@3 | |
9207 int i; // [sp+94h] [bp-8h]@3 | |
9208 int X; // [sp+98h] [bp-4h]@1 | |
9209 | |
9210 v2 = a1->field_A; | |
9211 v3 = a1->field_8; | |
9212 v4 = v3 + pRenderer->uTargetSurfacePitch * a1->field_A; | |
9213 v5 = a1->pParent; | |
9214 v43 = a1; | |
9215 v6 = a1->field_C; | |
9216 a1a.pColorBuffer = &pRenderer->pTargetSurface[v4]; | |
9217 v46 = v6; | |
9218 v7 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v3); | |
9219 v8 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); | |
9220 a1a.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v3 + 640 * v2]; | |
9221 v9 = v5->ptr_38; | |
9222 v47 = (Span *)v7; | |
9223 X = v8; | |
9224 v48 = v9->field_14; | |
9225 X = (unsigned __int64)(v48 * (signed __int64)v8) >> 16; | |
9226 v10 = v5->ptr_38; | |
9227 v11 = X + v10->field_C; | |
9228 v48 = v10->field_20; | |
9229 v44 = v11; | |
9230 v12 = ((unsigned __int64)(v48 * (signed __int64)v8) >> 16) + v5->ptr_38->field_18; | |
9231 X = v8; | |
9232 v45 = v12; | |
9233 v48 = v5->v_18.z; | |
9234 X = (unsigned __int64)(v48 * (signed __int64)v8) >> 16; | |
9235 v13 = v5->v_18.y; | |
9236 v14 = X + v5->v_18.x; | |
9237 v15 = -v5->field_24; | |
9238 v48 = -v5->field_24; | |
9239 X = ((unsigned __int64)(v7 * (signed __int64)v13) >> 16) + v14; | |
9240 if ( !X || (v16 = abs(v15 >> 14), v16 > abs(X)) ) | |
9241 return 0; | |
9242 LODWORD(v17) = v48 << 16; | |
9243 HIDWORD(v17) = v48 >> 16; | |
9244 i = v17 / X; | |
9245 v18 = v17 / X; | |
9246 HIWORD(v19) = (unsigned int)(v17 / X) >> 16; | |
9247 LOWORD(v19) = 0; | |
9248 a1a.field_24 = v19; | |
9249 pLOD = v5->pTexture->pLevelOfDetail2; | |
9250 a1a.pTextureLOD = (unsigned __int16 *)v5->pTexture->pLevelOfDetail2; | |
9251 v49 = 2; | |
9252 if ( v18 >= mipmapping_terrain_mm1 << 16 ) | |
9253 { | |
9254 if ( v18 >= mipmapping_terrain_mm2 << 16 ) | |
9255 { | |
9256 if ( v18 >= mipmapping_terrain_mm3 << 16 ) | |
9257 { | |
9258 if ( bUseLoResSprites ) | |
9259 goto LABEL_12; | |
9260 v24 = v5->pTexture; | |
9261 v49 = 3; | |
9262 pLOD = v24->pLevelOfDetail3; | |
9263 } | |
9264 else | |
9265 { | |
9266 v23 = v5->pTexture; | |
9267 v49 = 2; | |
9268 pLOD = v23->pLevelOfDetail2; | |
9269 } | |
9270 } | |
9271 else | |
9272 { | |
9273 v22 = v5->pTexture; | |
9274 v49 = 1; | |
9275 pLOD = v22->pLevelOfDetail1; | |
9276 } | |
9277 } | |
9278 else | |
9279 { | |
9280 v21 = v5->pTexture; | |
9281 v49 = 0; | |
9282 pLOD = v21->pLevelOfDetail0_prolly_alpha_mask; | |
9283 } | |
9284 a1a.pTextureLOD = (unsigned __int16 *)pLOD; | |
9285 LABEL_12: | |
9286 if ( !pLOD ) | |
9287 return 0; | |
9288 a1a.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v43, v18, v5, pOutdoorCamera->terrain_gamma, 1u, 1); | |
9289 a1a.field_28 = 16; | |
9290 v43 = (Span *)(v46 >> 4); | |
9291 X = v7; | |
9292 v25 = v5->ptr_38; | |
9293 v48 = v46 - 16 * (v46 >> 4); | |
9294 v46 = v25->field_10; | |
9295 X = v7; | |
9296 v46 = v44 + ((unsigned __int64)(v46 * (signed __int64)v7) >> 16); | |
9297 v44 = v5->ptr_38->field_1C; | |
9298 v45 += (unsigned __int64)(v44 * (signed __int64)v7) >> 16; | |
9299 X = (unsigned __int64)(v46 * (signed __int64)v18) >> 16; | |
9300 v26 = v5->ptr_38; | |
9301 X = v18; | |
9302 v27 = ((unsigned __int64)(v46 * (signed __int64)v18) >> 16) - v26->field_24; | |
9303 X = (unsigned __int64)(v45 * (signed __int64)v18) >> 16; | |
9304 v28 = v5->ptr_38; | |
9305 v29 = v5->pTexture; | |
9306 v44 = bUseLoResSprites + v49 + 2; | |
9307 v30 = v27 >> v44; | |
9308 v31 = (signed int)(((unsigned __int64)(v45 * (signed __int64)v18) >> 16) - v28->field_28) >> v44; | |
9309 v32 = (signed int)v29->uTextureWidth >> v49; | |
9310 v33 = (signed int)v29->uTextureHeight >> v49; | |
9311 v34 = v49 - v29->uWidthLn2; | |
9312 a1a.field_8 = (v33 << 16) - 65536; | |
9313 X = 2 * pMiscTimer->uTotalGameTimeElapsed; | |
9314 v45 = pOutdoorCamera->int_fov_rad_inv; | |
9315 a1a.field_10 = v34 + 16; | |
9316 a1a.field_C = v32 - 1; | |
9317 i = (unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)i) >> 16; | |
9318 v47 = (Span *)(i >> v44); | |
9319 v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
9320 v36 = (signed int)v47 * (signed __int64)v35; | |
9321 i = v36 >> 16; | |
9322 a1a.field_4 = v36 >> 16; | |
9323 v37 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); | |
9324 v38 = (signed int)v47 * (signed __int64)v37; | |
9325 i = v38 >> 16; | |
9326 a1a.field_0 = v38 >> 16; | |
9327 if ( (signed int)v43 > 0 ) | |
9328 { | |
9329 v47 = v43; | |
9330 v39 = 12 - v49; | |
9331 for ( i = 12 - v49; ; v39 = i ) | |
9332 { | |
9333 a1a.field_30 = v30 + 4 * stru_5C6E00->Cos(X + (v31 >> v39)); | |
9334 a1a.field_2C = v31 + 4 * stru_5C6E00->Sin(X + (v30 >> i)); | |
9335 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
9336 sr_sub_485975(&a1a, (stru315 *)&a2); | |
9337 else | |
9338 sr_sub_4D6FB0(v1); | |
9339 a1a.field_28 = 16; | |
9340 v30 += 16 * a1a.field_4; | |
9341 v31 += 16 * a1a.field_0; | |
9342 v47 = (Span *)((char *)v47 - 1); | |
9343 if ( !v47 ) | |
9344 break; | |
9345 } | |
9346 } | |
9347 if ( v48 ) | |
9348 { | |
9349 i = 12 - v49; | |
9350 a1a.field_30 = v30 + 4 * stru_5C6E00->Cos(X + (v31 >> (12 - v49))); | |
9351 a1a.field_2C = v31 + 4 * stru_5C6E00->Sin(X + (v30 >> i)); | |
9352 a1a.field_28 = v48; | |
9353 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
9354 sr_sub_485975(&a1a, (stru315 *)&a2); | |
9355 else | |
9356 sr_sub_4D6FB0(v1); | |
9357 } | |
9358 return 1; | |
9359 } | |
9360 | |
9361 //----- (0048585C) -------------------------------------------------------- | |
9362 signed int __fastcall sr_sub_48585C_mb_DrawSpan(Span *a1, unsigned __int16 *pRenderTarget, int a4) | |
9363 { | |
9364 Span *v3; // esi@1 | |
9365 stru148 *v4; // edi@1 | |
9366 int v5; // ebx@2 | |
9367 signed __int64 v6; // qtt@3 | |
9368 int v7; // ebx@3 | |
9369 signed int v8; // ecx@3 | |
9370 void *v9; // eax@5 | |
9371 int v10; // ecx@5 | |
9372 unsigned __int16 *pPixels; // [sp+Ch] [bp-14h]@1 | |
9373 signed int v13; // [sp+10h] [bp-10h]@1 | |
9374 int X; // [sp+18h] [bp-8h]@1 | |
9375 | |
9376 v3 = a1; | |
9377 pPixels = pRenderTarget; | |
9378 v4 = a1->pParent; | |
9379 v13 = -v4->field_24; | |
9380 X = ((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv | |
9381 * (pViewport->uScreenCenterX - (signed int)a1->field_8) | |
9382 * (signed __int64)v4->v_18.y) >> 16) | |
9383 + ((unsigned __int64)(v4->v_18.z | |
9384 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv | |
9385 * (pViewport->uScreenCenterY - (signed int)a1->field_A))) >> 16) | |
9386 + v4->v_18.x; | |
9387 if ( X && (v5 = abs(-v4->field_24 >> 14), v5 <= abs(X)) ) | |
9388 { | |
9389 LODWORD(v6) = v13 << 16; | |
9390 HIDWORD(v6) = v13 >> 16; | |
9391 v7 = v6 / X; | |
9392 v8 = v6 / X; | |
9393 } | |
9394 else | |
9395 { | |
9396 v7 = pOutdoorCamera->shading_dist_mist << 16; | |
9397 v8 = pOutdoorCamera->shading_dist_mist << 16; | |
9398 } | |
9399 v9 = sr_sub_47C178(v8, v4, pOutdoorCamera->terrain_gamma, a4); | |
9400 fill_pixels_fast(*((short *)v9 + v4->pTexture->uDecompressedSize), pPixels, v3->field_C); | |
9401 HIWORD(v10) = HIWORD(v7); | |
9402 LOWORD(v10) = 0; | |
9403 j_memset32(v10, &pRenderer->pActiveZBuffer[v3->field_8 + 640 * v3->field_A], v3->field_C); | |
9404 return 1; | |
9405 } | |
9406 | |
9407 //----- (00485975) -------------------------------------------------------- | |
9408 stru315 *__fastcall sr_sub_485975(stru315 *a1, stru315 *a2) | |
9409 { | |
9410 stru315 *result; // eax@1 | |
9411 int i; // ecx@1 | |
9412 int v4; // esi@2 | |
9413 int v5; // esi@2 | |
9414 int v6; // ecx@2 | |
9415 int v7; // esi@3 | |
9416 int v8; // edi@3 | |
9417 int v9; // ebx@3 | |
9418 int v10; // ecx@8 | |
9419 unsigned __int16 *v11; // esi@10 | |
9420 unsigned int *v12; // ecx@12 | |
9421 int v13; // esi@12 | |
9422 int v14; // [sp+0h] [bp-4h]@2 | |
9423 | |
9424 result = a1; | |
9425 for ( i = a1->field_28; i; i = result->field_28 ) | |
9426 { | |
9427 v4 = result->field_8 & result->field_2C; | |
9428 result->field_28 = i - 1; | |
9429 v5 = (result->field_C & HIWORD(result->field_30)) + (v4 >> result->field_10); | |
9430 v6 = *((char *)result->pTextureLOD + v5); | |
9431 v14 = *((char *)result->pTextureLOD + v5); | |
9432 if ( a2->field_20 ) | |
9433 { | |
9434 v7 = HIWORD(a2->field_10); | |
9435 v8 = a2->field_C; | |
9436 v9 = v7; | |
9437 if ( v7 >= v8 ) | |
9438 v9 = a2->field_C; | |
9439 if ( a2->field_8 - v9 <= 0 ) | |
9440 { | |
9441 v10 = 0; | |
9442 } | |
9443 else | |
9444 { | |
9445 if ( v7 >= v8 ) | |
9446 v7 = a2->field_C; | |
9447 v10 = a2->field_8 - v7; | |
9448 } | |
9449 v11 = (unsigned __int16 *)a2->field_24; | |
9450 v6 = v14 + (v10 << 8); | |
9451 } | |
9452 else | |
9453 { | |
9454 v11 = result->field_34_palette; | |
9455 } | |
9456 *result->pColorBuffer = v11[v6]; | |
9457 v12 = result->pDepthBuffer; | |
9458 v13 = result->field_24; | |
9459 ++result->pColorBuffer; | |
9460 *v12 = v13; | |
9461 ++result->pDepthBuffer; | |
9462 a2->field_10 += a2->field_18; | |
9463 result->field_30 += result->field_4; | |
9464 result->field_2C += result->field_0; | |
9465 } | |
9466 --result->field_28; | |
9467 return result; | |
9468 } | |
9469 | |
9470 //----- (00485A24) -------------------------------------------------------- | |
9471 stru315 *__fastcall sr_sub_485A24(stru315 *a1, stru315 *a2) | |
9472 { | |
9473 stru315 *result; // eax@1 | |
9474 int i; // ecx@1 | |
9475 int v4; // ecx@2 | |
9476 int v5; // ecx@4 | |
9477 int v6; // ecx@6 | |
9478 int v7; // ecx@8 | |
9479 int v8; // esi@10 | |
9480 int v9; // ecx@10 | |
9481 int v10; // esi@11 | |
9482 int v11; // edi@11 | |
9483 int v12; // ebx@11 | |
9484 int v13; // ecx@16 | |
9485 unsigned __int16 *v14; // esi@18 | |
9486 unsigned int *v15; // ecx@20 | |
9487 int v16; // esi@20 | |
9488 int v17; // [sp+0h] [bp-4h]@10 | |
9489 | |
9490 result = a1; | |
9491 for ( i = a1->field_28; i; i = result->field_28 ) | |
9492 { | |
9493 result->field_28 = i - 1; | |
9494 v4 = result->field_18; | |
9495 if ( result->field_30 > v4 ) | |
9496 result->field_30 = v4; | |
9497 v5 = result->field_20; | |
9498 if ( result->field_2C > v5 ) | |
9499 result->field_2C = v5; | |
9500 v6 = result->field_14; | |
9501 if ( result->field_30 < v6 ) | |
9502 result->field_30 = v6; | |
9503 v7 = result->field_1C; | |
9504 if ( result->field_2C < v7 ) | |
9505 result->field_2C = v7; | |
9506 v8 = (result->field_C & HIWORD(result->field_30)) + ((result->field_2C & result->field_8) >> result->field_10); | |
9507 v9 = *((char *)result->pTextureLOD + v8); | |
9508 v17 = *((char *)result->pTextureLOD + v8); | |
9509 if ( a2->field_20 ) | |
9510 { | |
9511 v10 = HIWORD(a2->field_10); | |
9512 v11 = a2->field_C; | |
9513 v12 = v10; | |
9514 if ( v10 >= v11 ) | |
9515 v12 = a2->field_C; | |
9516 if ( a2->field_8 - v12 <= 0 ) | |
9517 { | |
9518 v13 = 0; | |
9519 } | |
9520 else | |
9521 { | |
9522 if ( v10 >= v11 ) | |
9523 v10 = a2->field_C; | |
9524 v13 = a2->field_8 - v10; | |
9525 } | |
9526 v14 = (unsigned __int16 *)a2->field_24; | |
9527 v9 = v17 + (v13 << 8); | |
9528 } | |
9529 else | |
9530 { | |
9531 v14 = result->field_34_palette; | |
9532 } | |
9533 *result->pColorBuffer = v14[v9]; | |
9534 v15 = result->pDepthBuffer; | |
9535 v16 = result->field_24; | |
9536 ++result->pColorBuffer; | |
9537 *v15 = v16; | |
9538 ++result->pDepthBuffer; | |
9539 a2->field_10 += a2->field_18; | |
9540 result->field_30 += result->field_4; | |
9541 result->field_2C += result->field_0; | |
9542 } | |
9543 --result->field_28; | |
9544 return result; | |
9545 } | |
9546 | |
9547 //----- (00485AFF) -------------------------------------------------------- | |
9548 stru315 *__fastcall sr_sub_485AFF(stru315 *a1, stru316 *a2) | |
9549 { | |
9550 stru315 *result; // eax@1 | |
9551 int i; // ecx@1 | |
9552 int v4; // esi@2 | |
9553 int v5; // esi@2 | |
9554 int v6; // ecx@2 | |
9555 int v7; // esi@3 | |
9556 int v8; // edi@3 | |
9557 int v9; // ebx@3 | |
9558 int v10; // ecx@8 | |
9559 unsigned __int16 *v11; // esi@10 | |
9560 unsigned int *v12; // ecx@12 | |
9561 int v13; // esi@12 | |
9562 int v14; // [sp+0h] [bp-4h]@2 | |
9563 | |
9564 result = a1; | |
9565 for ( i = a1->field_28; i; i = result->field_28 ) | |
9566 { | |
9567 v4 = result->field_8 & result->field_2C; | |
9568 result->field_28 = i - 1; | |
9569 v5 = (result->field_C & HIWORD(result->field_30)) + (v4 >> result->field_10); | |
9570 v6 = *((char *)result->pTextureLOD + v5); | |
9571 v14 = *((char *)result->pTextureLOD + v5); | |
9572 if ( a2->field_20 ) | |
9573 { | |
9574 v7 = HIWORD(a2->field_14); | |
9575 v8 = a2->field_C; | |
9576 v9 = v7; | |
9577 if ( v7 >= v8 ) | |
9578 v9 = a2->field_C; | |
9579 if ( a2->field_8 - v9 <= 0 ) | |
9580 { | |
9581 v10 = 0; | |
9582 } | |
9583 else | |
9584 { | |
9585 if ( v7 >= v8 ) | |
9586 v7 = a2->field_C; | |
9587 v10 = a2->field_8 - v7; | |
9588 } | |
9589 v11 = a2->field_24_palette; | |
9590 v6 = v14 + (v10 << 8); | |
9591 } | |
9592 else | |
9593 { | |
9594 v11 = result->field_34_palette; | |
9595 } | |
9596 *result->pColorBuffer = v11[v6]; | |
9597 v12 = result->pDepthBuffer; | |
9598 v13 = result->field_24; | |
9599 --result->pColorBuffer; | |
9600 *v12 = v13; | |
9601 --result->pDepthBuffer; | |
9602 a2->field_14 -= a2->field_18; | |
9603 result->field_30 += result->field_4; | |
9604 result->field_2C += result->field_0; | |
9605 } | |
9606 --result->field_28; | |
9607 return result; | |
9608 } | |
9609 | |
9610 //----- (00485BAE) -------------------------------------------------------- | |
9611 stru315 *__fastcall sr_sub_485BAE(stru315 *a1, stru316 *a2) | |
9612 { | |
9613 stru315 *result; // eax@1 | |
9614 int i; // ecx@1 | |
9615 int v4; // ecx@2 | |
9616 int v5; // ecx@4 | |
9617 int v6; // ecx@6 | |
9618 int v7; // ecx@8 | |
9619 int v8; // esi@10 | |
9620 int v9; // ecx@10 | |
9621 int v10; // esi@11 | |
9622 int v11; // edi@11 | |
9623 int v12; // ebx@11 | |
9624 int v13; // ecx@16 | |
9625 unsigned __int16 *v14; // esi@18 | |
9626 unsigned int *v15; // ecx@20 | |
9627 int v16; // esi@20 | |
9628 int v17; // [sp+0h] [bp-4h]@10 | |
9629 | |
9630 result = a1; | |
9631 for ( i = a1->field_28; i; i = result->field_28 ) | |
9632 { | |
9633 result->field_28 = i - 1; | |
9634 v4 = result->field_18; | |
9635 if ( result->field_30 > v4 ) | |
9636 result->field_30 = v4; | |
9637 v5 = result->field_20; | |
9638 if ( result->field_2C > v5 ) | |
9639 result->field_2C = v5; | |
9640 v6 = result->field_14; | |
9641 if ( result->field_30 < v6 ) | |
9642 result->field_30 = v6; | |
9643 v7 = result->field_1C; | |
9644 if ( result->field_2C < v7 ) | |
9645 result->field_2C = v7; | |
9646 v8 = (result->field_C & HIWORD(result->field_30)) + ((result->field_2C & result->field_8) >> result->field_10); | |
9647 v9 = *((char *)result->pTextureLOD + v8); | |
9648 v17 = *((char *)result->pTextureLOD + v8); | |
9649 if ( a2->field_20 ) | |
9650 { | |
9651 v10 = HIWORD(a2->field_14); | |
9652 v11 = a2->field_C; | |
9653 v12 = v10; | |
9654 if ( v10 >= v11 ) | |
9655 v12 = a2->field_C; | |
9656 if ( a2->field_8 - v12 <= 0 ) | |
9657 { | |
9658 v13 = 0; | |
9659 } | |
9660 else | |
9661 { | |
9662 if ( v10 >= v11 ) | |
9663 v10 = a2->field_C; | |
9664 v13 = a2->field_8 - v10; | |
9665 } | |
9666 v14 = a2->field_24_palette; | |
9667 v9 = v17 + (v13 << 8); | |
9668 } | |
9669 else | |
9670 { | |
9671 v14 = result->field_34_palette; | |
9672 } | |
9673 *result->pColorBuffer = v14[v9]; | |
9674 v15 = result->pDepthBuffer; | |
9675 v16 = result->field_24; | |
9676 --result->pColorBuffer; | |
9677 *v15 = v16; | |
9678 --result->pDepthBuffer; | |
9679 a2->field_14 -= a2->field_18; | |
9680 result->field_30 += result->field_4; | |
9681 result->field_2C += result->field_0; | |
9682 } | |
9683 --result->field_28; | |
9684 return result; | |
9685 } | |
9686 | |
9687 //----- (00485C89) -------------------------------------------------------- | |
9688 stru315 *__fastcall sr_sub_485C89(stru315 *a1, stru316 *a2) | |
9689 { | |
9690 stru315 *result; // eax@1 | |
9691 int i; // ecx@1 | |
9692 int v4; // esi@2 | |
9693 int v5; // esi@2 | |
9694 int v6; // ecx@2 | |
9695 int v7; // esi@4 | |
9696 int v8; // edi@4 | |
9697 int v9; // ecx@9 | |
9698 unsigned __int16 *v10; // esi@11 | |
9699 unsigned int *v11; // ecx@14 | |
9700 int v12; // esi@14 | |
9701 int v13; // [sp+0h] [bp-4h]@2 | |
9702 | |
9703 result = a1; | |
9704 for ( i = a1->field_28; i; i = result->field_28 ) | |
9705 { | |
9706 v4 = result->field_8 & result->field_2C; | |
9707 result->field_28 = i - 1; | |
9708 v5 = (result->field_C & HIWORD(result->field_30)) + (v4 >> result->field_10); | |
9709 v6 = *((char *)result->pTextureLOD + v5); | |
9710 v13 = *((char *)result->pTextureLOD + v5); | |
9711 if ( *((char *)result->pTextureLOD + v5) ) | |
9712 { | |
9713 if ( a2->field_20 ) | |
9714 { | |
9715 v7 = HIWORD(a2->field_10); | |
9716 v8 = v7; | |
9717 if ( v7 >= a2->field_C ) | |
9718 v8 = a2->field_C; | |
9719 if ( a2->field_8 - v8 <= 0 ) | |
9720 { | |
9721 v9 = 0; | |
9722 } | |
9723 else | |
9724 { | |
9725 if ( v7 >= a2->field_C ) | |
9726 v7 = a2->field_C; | |
9727 v9 = a2->field_8 - v7; | |
9728 } | |
9729 v10 = a2->field_24_palette; | |
9730 v6 = v13 + (v9 << 8); | |
9731 } | |
9732 else | |
9733 { | |
9734 v10 = result->field_34_palette; | |
9735 } | |
9736 *result->pColorBuffer = v10[v6]; | |
9737 } | |
9738 v11 = result->pDepthBuffer; | |
9739 v12 = result->field_24; | |
9740 ++result->pColorBuffer; | |
9741 *v11 = v12; | |
9742 ++result->pDepthBuffer; | |
9743 a2->field_10 += a2->field_18; | |
9744 result->field_30 += result->field_4; | |
9745 result->field_2C += result->field_0; | |
9746 } | |
9747 --result->field_28; | |
9748 return result; | |
9749 } | |
9750 | |
9751 //----- (00485D3E) -------------------------------------------------------- | |
9752 stru315 *__fastcall sr_sub_485D3E(stru315 *a1, stru316 *a2) | |
9753 { | |
9754 stru315 *result; // eax@1 | |
9755 int i; // ecx@1 | |
9756 int v4; // ecx@2 | |
9757 int v5; // ecx@4 | |
9758 int v6; // ecx@6 | |
9759 int v7; // ecx@8 | |
9760 int v8; // esi@10 | |
9761 int v9; // ecx@10 | |
9762 int v10; // esi@12 | |
9763 int v11; // edi@12 | |
9764 int v12; // ecx@17 | |
9765 unsigned __int16 *v13; // esi@19 | |
9766 unsigned int *v14; // ecx@22 | |
9767 int v15; // esi@22 | |
9768 int v16; // [sp+0h] [bp-4h]@10 | |
9769 | |
9770 result = a1; | |
9771 for ( i = a1->field_28; i; i = result->field_28 ) | |
9772 { | |
9773 result->field_28 = i - 1; | |
9774 v4 = result->field_18; | |
9775 if ( result->field_30 > v4 ) | |
9776 result->field_30 = v4; | |
9777 v5 = result->field_20; | |
9778 if ( result->field_2C > v5 ) | |
9779 result->field_2C = v5; | |
9780 v6 = result->field_14; | |
9781 if ( result->field_30 < v6 ) | |
9782 result->field_30 = v6; | |
9783 v7 = result->field_1C; | |
9784 if ( result->field_2C < v7 ) | |
9785 result->field_2C = v7; | |
9786 v8 = (result->field_C & HIWORD(result->field_30)) + ((result->field_2C & result->field_8) >> result->field_10); | |
9787 v9 = *((char *)result->pTextureLOD + v8); | |
9788 v16 = *((char *)result->pTextureLOD + v8); | |
9789 if ( *((char *)result->pTextureLOD + v8) ) | |
9790 { | |
9791 if ( a2->field_20 ) | |
9792 { | |
9793 v10 = HIWORD(a2->field_10); | |
9794 v11 = v10; | |
9795 if ( v10 >= a2->field_C ) | |
9796 v11 = a2->field_C; | |
9797 if ( a2->field_8 - v11 <= 0 ) | |
9798 { | |
9799 v12 = 0; | |
9800 } | |
9801 else | |
9802 { | |
9803 if ( v10 >= a2->field_C ) | |
9804 v10 = a2->field_C; | |
9805 v12 = a2->field_8 - v10; | |
9806 } | |
9807 v13 = a2->field_24_palette; | |
9808 v9 = v16 + (v12 << 8); | |
9809 } | |
9810 else | |
9811 { | |
9812 v13 = result->field_34_palette; | |
9813 } | |
9814 *result->pColorBuffer = v13[v9]; | |
9815 } | |
9816 v14 = result->pDepthBuffer; | |
9817 v15 = result->field_24; | |
9818 ++result->pColorBuffer; | |
9819 *v14 = v15; | |
9820 ++result->pDepthBuffer; | |
9821 a2->field_10 += a2->field_18; | |
9822 result->field_30 += result->field_4; | |
9823 result->field_2C += result->field_0; | |
9824 } | |
9825 --result->field_28; | |
9826 return result; | |
9827 } | |
9828 | |
9829 //----- (00485E1F) -------------------------------------------------------- | |
9830 void *__fastcall sr_sub_485E1F(stru316 *a1, Span *a2, int a3, stru148 *a4, int a5, unsigned __int8 a6, char a7) | |
9831 { | |
9832 stru316 *v7; // esi@1 | |
9833 signed int *v8; // edi@1 | |
9834 signed int *v9; // ebx@1 | |
9835 char v10; // zf@1 | |
9836 int v11; // eax@1 | |
9837 Span *v12; // ecx@3 | |
9838 double v13; // ST24_8@3 | |
9839 double v14; // ST24_8@3 | |
9840 int v15; // eax@3 | |
9841 signed int v16; // ST14_4@4 | |
9842 char v17; // dl@4 | |
9843 signed int v18; // ST10_4@4 | |
9844 void *v19; // eax@4 | |
9845 signed int v20; // ST14_4@5 | |
9846 char v21; // dl@5 | |
9847 int v22; // ST10_4@5 | |
9848 signed int v23; // ST14_4@6 | |
9849 char v24; // dl@6 | |
9850 Span *v26; // [sp+10h] [bp-8h]@1 | |
9851 char v27; // [sp+16h] [bp-2h]@1 | |
9852 char v28; // [sp+17h] [bp-1h]@1 | |
9853 float v29; // [sp+30h] [bp+18h]@3 | |
9854 float v30; // [sp+30h] [bp+18h]@3 | |
9855 | |
9856 v7 = a1; | |
9857 v26 = a2; | |
9858 v8 = &a1->field_C; | |
9859 v9 = &a1->field_8; | |
9860 v10 = a1->field_0 == 0; | |
9861 v27 = a1->field_4 != 0; | |
9862 v28 = !v10; | |
9863 sr_sub_47BEB1(a3, a4, a5, 0, &a1->field_8, &a1->field_C, (int)&v27, (int)&v28); | |
9864 v7->field_24_palette = (unsigned __int16 *)sr_sub_47C28C_get_palette(a4, v28, *v9, *v8); | |
9865 v11 = a4->field_108; | |
9866 v7->field_20 = v11; | |
9867 if ( v11 ) | |
9868 { | |
9869 if ( a7 ) | |
9870 { | |
9871 v12 = v26; | |
9872 v29 = v26->field_10 * 31.0; | |
9873 v13 = v29 + 6.7553994e15; | |
9874 v7->field_10 = LODWORD(v13) << 16; | |
9875 v30 = v12->field_14 * 31.0; | |
9876 v14 = v30 + 6.7553994e15; | |
9877 v15 = v7->field_10; | |
9878 v7->field_14 = LODWORD(v14) << 16; | |
9879 v7->field_18 = -((v15 - (LODWORD(v14) << 16)) / v12->field_C); | |
9880 } | |
9881 v16 = *v8; | |
9882 v17 = v28; | |
9883 v18 = *v9; | |
9884 v7->field_1C = a6; | |
9885 v19 = sr_sub_47C28C_get_palette(a4, v17, v18, v16); | |
9886 } | |
9887 else | |
9888 { | |
9889 v20 = *v8; | |
9890 v21 = v28; | |
9891 v7->field_10 = 0; | |
9892 v7->field_14 = 0; | |
9893 v22 = *v9; | |
9894 v7->field_18 = 0; | |
9895 v7->field_1C = 0; | |
9896 v19 = sr_sub_47C1CA(a4, v21, v22, v20); | |
9897 } | |
9898 v23 = *v8; | |
9899 v24 = v28; | |
9900 v7->field_24_palette = (unsigned __int16 *)v19; | |
9901 return sr_sub_47C1CA(a4, v24, *v9, v23); | |
9902 } | |
9903 | 6455 |
9904 //----- (00485F53) -------------------------------------------------------- | 6456 //----- (00485F53) -------------------------------------------------------- |
9905 void __thiscall sub_485F53(Vec2_int_ *v) | 6457 void __thiscall sr_485F53(Vec2_int_ *v) |
9906 { | 6458 { |
9907 ++v->y; | 6459 ++v->y; |
9908 if ( v->y > 1000 ) | 6460 if ( v->y > 1000 ) |
9909 v->y = 0; | 6461 v->y = 0; |
9910 } | 6462 } |
9911 | 6463 |
9912 //----- (0048607B) -------------------------------------------------------- | 6464 //----- (0048607B) -------------------------------------------------------- |
9913 void stru148::_48607B(stru149 *a2) | 6465 void Polygon::_48607B(stru149 *a2) |
9914 { | 6466 { |
9915 this->pTexture = 0; | 6467 this->pTexture = 0; |
9916 this->ptr_38 = a2; | 6468 this->ptr_38 = a2; |
9917 } | 6469 } |
9918 | 6470 |
9919 //----- (00486089) -------------------------------------------------------- | 6471 //----- (00486089) -------------------------------------------------------- |
9920 void stru148::_486089_normalize_v_18() | 6472 void Polygon::_486089_normalize_v_18() |
9921 { | 6473 { |
9922 //stru148 *v1; // esi@1 | 6474 //Polygon *v1; // esi@1 |
9923 double v2; // st7@1 | 6475 double v2; // st7@1 |
9924 double v3; // st6@1 | 6476 double v3; // st6@1 |
9925 float v4; // ST18_4@2 | 6477 float v4; // ST18_4@2 |
9926 double v5; // st5@1 | 6478 double v5; // st5@1 |
9927 float v6; // ST14_4@2 | 6479 float v6; // ST14_4@2 |
10097 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; | 6649 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; |
10098 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); | 6650 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); |
10099 return result; | 6651 return result; |
10100 } | 6652 } |
10101 | 6653 |
10102 //----- (00486B4E) -------------------------------------------------------- | |
10103 char __fastcall sr_sub_486B4E_push_outdoor_edges(RenderVertexSoft *a1, int *a2, int *a3, stru148 *a4)//maybe DrawPolygonSW | |
10104 { | |
10105 stru148 *v4; // esi@1 | |
10106 RenderVertexSoft *v5; // edi@1 | |
10107 char v6; // zf@1 | |
10108 unsigned int v7; // eax@3 | |
10109 int v8; // ebx@3 | |
10110 int *v9; // ecx@7 | |
10111 int v10; // ebx@8 | |
10112 int v11; // eax@10 | |
10113 double v12; // st7@14 | |
10114 int *v13; // edx@14 | |
10115 double v14; // st6@14 | |
10116 double v15; // st7@16 | |
10117 int v16; // edi@16 | |
10118 double v17; // st7@16 | |
10119 double v18; // st7@16 | |
10120 int v19; // edi@18 | |
10121 double v20; // st7@18 | |
10122 double v21; // st7@18 | |
10123 Edge *i; // edx@20 | |
10124 double v23; // st7@28 | |
10125 Edge *v24; // eax@28 | |
10126 std::string v26; // [sp-18h] [bp-98h]@2 | |
10127 const char *v27; // [sp-8h] [bp-88h]@2 | |
10128 int v28; // [sp-4h] [bp-84h]@2 | |
10129 double v29; // [sp+Ch] [bp-74h]@28 | |
10130 double v30; // [sp+14h] [bp-6Ch]@28 | |
10131 double v31; // [sp+1Ch] [bp-64h]@20 | |
10132 double v32; // [sp+24h] [bp-5Ch]@16 | |
10133 double v33; // [sp+2Ch] [bp-54h]@14 | |
10134 unsigned int v34; // [sp+34h] [bp-4Ch]@2 | |
10135 unsigned __int64 v35; // [sp+38h] [bp-48h]@28 | |
10136 int v36; // [sp+40h] [bp-40h]@28 | |
10137 int v37; // [sp+44h] [bp-3Ch]@20 | |
10138 float v38; // [sp+48h] [bp-38h]@18 | |
10139 int v39; // [sp+4Ch] [bp-34h]@16 | |
10140 int v40; // [sp+50h] [bp-30h]@14 | |
10141 int v41; // [sp+54h] [bp-2Ch]@3 | |
10142 RenderVertexSoft *v42; // [sp+58h] [bp-28h]@1 | |
10143 int v43; // [sp+5Ch] [bp-24h]@14 | |
10144 int v44; // [sp+60h] [bp-20h]@6 | |
10145 int v45; // [sp+64h] [bp-1Ch]@6 | |
10146 unsigned int v46; // [sp+68h] [bp-18h]@7 | |
10147 int *v47; // [sp+6Ch] [bp-14h]@1 | |
10148 int v48; // [sp+70h] [bp-10h]@7 | |
10149 float *v49; // [sp+74h] [bp-Ch]@7 | |
10150 float v50; // [sp+78h] [bp-8h]@10 | |
10151 float v51; // [sp+7Ch] [bp-4h]@14 | |
10152 | |
10153 v4 = a4; | |
10154 v5 = a1; | |
10155 v47 = a2; | |
10156 v6 = (HIBYTE(a4->flags) & 0x40) == 0; | |
10157 v42 = a1; | |
10158 if ( !v6 ) | |
10159 { | |
10160 MessageBoxW(nullptr, L"The Texture Frame Table is not a supported feature.", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odspan.cpp:162", 0); | |
10161 } | |
10162 LOBYTE(v7) = v4->field_108; | |
10163 v8 = v4->uNumVertices; | |
10164 v4->field_108 = 0; | |
10165 BYTE3(a4) = v7; | |
10166 v41 = v8; | |
10167 if ( v8 > 0 ) | |
10168 { | |
10169 if ( (signed int)pOutdoorCamera->uNumSurfs < 1999 ) | |
10170 { | |
10171 v7 = pOutdoorCamera->uNumEdges; | |
10172 if ( (signed int)pOutdoorCamera->uNumEdges < 5979 ) | |
10173 { | |
10174 v4->uEdgeList1Size = 0; | |
10175 v4->uEdgeList2Size = 0; | |
10176 v45 = -1; | |
10177 v34 = v7; | |
10178 v28 = v8; | |
10179 v27 = (const char *)v5; | |
10180 v44 = 10000; | |
10181 pGame->pLightmapBuilder->_45CB89(v5, v8); | |
10182 if ( v8 > 0 ) | |
10183 { | |
10184 v9 = a3; | |
10185 v48 = 1; | |
10186 v49 = &v5->flt_2C; | |
10187 v46 = (char *)v47 - (char *)a3; | |
10188 do | |
10189 { | |
10190 v10 = v48; | |
10191 ++pOutdoorCamera->uNumEdges; | |
10192 if ( v48 >= v41 ) | |
10193 v10 = 0; | |
10194 v11 = *v9; | |
10195 LODWORD(v50) = *v9; | |
10196 if ( SLODWORD(v50) > v45 ) | |
10197 v45 = v11; | |
10198 if ( v11 < v44 ) | |
10199 v44 = v11; | |
10200 v12 = (double)SLODWORD(v50); | |
10201 v13 = &a3[v10]; | |
10202 v51 = v12; | |
10203 v14 = (double)*v13; | |
10204 v50 = v14; | |
10205 *(float *)&v40 = v14 - v12; | |
10206 v33 = *(float *)&v40 + 6.7553994e15; | |
10207 v43 = LODWORD(v33); | |
10208 if ( LODWORD(v33) ) | |
10209 { | |
10210 if ( SLODWORD(v33) >= 0 ) | |
10211 { | |
10212 v19 = (int)((char *)v9 + v46); | |
10213 ptr_80C978_Edges->field_8 = 1; | |
10214 LODWORD(v38) = (int)&v47[v10]; | |
10215 v40 = *(unsigned int *)LODWORD(v38) - *(int *)v19; | |
10216 v6 = BYTE3(a4) == 0; | |
10217 v20 = (double)v40; | |
10218 v40 = *v13 - *v9; | |
10219 v21 = v20 / (double)v40; | |
10220 ptr_80C978_Edges->field_4 = v21; | |
10221 ptr_80C978_Edges->field_0 = (v51 - (double)*v9) * v21 + (double)*(signed int *)v19; | |
10222 if ( !v6 ) | |
10223 { | |
10224 ptr_80C978_Edges->field_1C = *v49; | |
10225 ptr_80C978_Edges->field_20 = v42[v10].flt_2C; | |
10226 ptr_80C978_Edges->field_24 = (double)*(signed int *)v19; | |
10227 ptr_80C978_Edges->field_28 = (double)(signed int)*(unsigned int *)LODWORD(v38); | |
10228 ptr_80C978_Edges->field_2C = (double)*v9; | |
10229 ptr_80C978_Edges->field_30 = (double)*v13; | |
10230 v4->pEdgeList1[v4->uEdgeList1Size++] = ptr_80C978_Edges; | |
10231 } | |
10232 } | |
10233 else | |
10234 { | |
10235 v32 = v51 + 6.7553994e15; | |
10236 v39 = LODWORD(v32); | |
10237 v51 = v50; | |
10238 v15 = (double)SLODWORD(v32); | |
10239 ptr_80C978_Edges->field_8 = 0; | |
10240 v16 = (int)&v47[v10]; | |
10241 v50 = v15; | |
10242 v40 = *(int *)((char *)v9 + v46) - *(int *)v16; | |
10243 v6 = BYTE3(a4) == 0; | |
10244 v17 = (double)v40; | |
10245 v40 = *v9 - *v13; | |
10246 v18 = v17 / (double)v40; | |
10247 ptr_80C978_Edges->field_4 = v18; | |
10248 ptr_80C978_Edges->field_0 = (v51 - (double)*v13) * v18 + (double)*(signed int *)v16; | |
10249 if ( !v6 ) | |
10250 { | |
10251 ptr_80C978_Edges->field_1C = v42[v10].flt_2C; | |
10252 ptr_80C978_Edges->field_20 = *v49; | |
10253 ptr_80C978_Edges->field_24 = (double)*(signed int *)v16; | |
10254 ptr_80C978_Edges->field_28 = (double)*(int *)((char *)v9 + v46); | |
10255 ptr_80C978_Edges->field_2C = (double)*v13; | |
10256 ptr_80C978_Edges->field_30 = (double)*v9; | |
10257 v4->pEdgeList2[v4->uEdgeList2Size++] = ptr_80C978_Edges; | |
10258 } | |
10259 } | |
10260 v31 = v51 + 6.7553994e15; | |
10261 v37 = LODWORD(v31); | |
10262 for ( i = &pNewEdges[LODWORD(v31)]; i->pNext->field_0 < (double)ptr_80C978_Edges->field_0; i = i->pNext ) | |
10263 ; | |
10264 if ( i->field_0 != ptr_80C978_Edges->field_0 || i->field_8 || ptr_80C978_Edges->field_8 != 1 ) | |
10265 { | |
10266 ptr_80C978_Edges->pNext = i->pNext; | |
10267 i->pNext = ptr_80C978_Edges; | |
10268 } | |
10269 else | |
10270 { | |
10271 ptr_80C978_Edges->pNext = i; | |
10272 i->pPrev->pNext = ptr_80C978_Edges; | |
10273 } | |
10274 v23 = v50 - 1.0; | |
10275 *(float *)&v40 = v23; | |
10276 v38 = v23; | |
10277 v30 = v38 + 6.7553994e15; | |
10278 v36 = LODWORD(v30); | |
10279 ptr_80C978_Edges->ptr_18 = ptr_80CA10[LODWORD(v30)]; | |
10280 v29 = *(float *)&v40 + 6.7553994e15; | |
10281 v35 = __PAIR__(v40, LODWORD(v29)); | |
10282 v24 = ptr_80C978_Edges; | |
10283 ptr_80CA10[LODWORD(v29)] = ptr_80C978_Edges; | |
10284 v24->pSurf = ptr_80C97C_Surfs; | |
10285 if ( ptr_80C978_Edges < &pEdges[5999] ) | |
10286 ++ptr_80C978_Edges; | |
10287 } | |
10288 ++v48; | |
10289 v49 += 12; | |
10290 ++v9; | |
10291 } | |
10292 while ( v48 - 1 < v41 ); | |
10293 } | |
10294 LOBYTE(v7) = v34; | |
10295 if ( pOutdoorCamera->uNumEdges != v34 ) | |
10296 { | |
10297 v4->ptr_48 = 0; | |
10298 ptr_80C97C_Surfs->field_22 = 0; | |
10299 ptr_80C97C_Surfs->pParent = v4; | |
10300 ptr_80C97C_Surfs->field_4 = v4->field_4; | |
10301 ptr_80C97C_Surfs->field_8 = v4->field_8; | |
10302 ptr_80C97C_Surfs->field_0 = v4->field_0; | |
10303 ptr_80C97C_Surfs->field_C = v4->field_C; | |
10304 ptr_80C97C_Surfs->field_10 = v4->field_10; | |
10305 LOBYTE(v7) = (char)pSurfs + 28; | |
10306 if ( ptr_80C97C_Surfs < &pSurfs[1999] ) | |
10307 { | |
10308 ++ptr_80C97C_Surfs; | |
10309 ++pOutdoorCamera->uNumSurfs; | |
10310 } | |
10311 if ( BYTE3(a4) ) | |
10312 v4->field_108 = 1; | |
10313 } | |
10314 } | |
10315 } | |
10316 } | |
10317 return v7; | |
10318 } | |
10319 | 6654 |
10320 //----- (00440DF5) -------------------------------------------------------- | 6655 //----- (00440DF5) -------------------------------------------------------- |
10321 int stru167_wrap::Push(__int16 a2, __int16 a3, __int16 a4, int a5, __int16 bgr) | 6656 int stru167_wrap::Push(__int16 a2, __int16 a3, __int16 a4, int a5, __int16 bgr) |
10322 { | 6657 { |
10323 int result; // eax@1 | 6658 int result; // eax@1 |