comparison _deleted.cpp @ 1637:2c71fa8913d2

class OutdoorCamera -> ODMRenderParams
author Nomad
date Tue, 17 Sep 2013 14:10:41 +0200
parents 75fafd8ced59
children ccde94f02b75
comparison
equal deleted inserted replaced
1633:384a6b9d1333 1637:2c71fa8913d2
647 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; 647 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26;
648 *(float *)((char *)v2 + (int)v5) = v6; 648 *(float *)((char *)v2 + (int)v5) = v6;
649 } 649 }
650 if ( *(float *)v9 >= 8.0 ) 650 if ( *(float *)v9 >= 8.0 )
651 { 651 {
652 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) 652 if ( (double)pODMRenderParams->shading_dist_mist >= *(float *)v9 )
653 { 653 {
654 *(int *)v2 = 0; 654 *(int *)v2 = 0;
655 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; 655 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pODMRenderParams->int_fov_rad;
656 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX 656 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX
657 - v12 * *(float *)((char *)v2 + (int)v3); 657 - v12 * *(float *)((char *)v2 + (int)v3);
658 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY 658 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY
659 - v12 * *(float *)((char *)v2 + (int)v5); 659 - v12 * *(float *)((char *)v2 + (int)v5);
660 *(float *)((char *)v2 + (int)v16) = v4 660 *(float *)((char *)v2 + (int)v16) = v4
661 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); 661 - v4 / (*(float *)v9 * 1000.0 / (double)pODMRenderParams->shading_dist_mist);
662 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); 662 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001);
663 v13 = *(float *)v9 + 6.7553994e15; 663 v13 = *(float *)v9 + 6.7553994e15;
664 v4 = 1.0; 664 v4 = 1.0;
665 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); 665 *(int *)((char *)v2 + (int)v14) = LODWORD(v13);
666 } 666 }
961 v4->field_108 = 0; 961 v4->field_108 = 0;
962 BYTE3(a4) = v7; 962 BYTE3(a4) = v7;
963 v41 = v8; 963 v41 = v8;
964 if ( v8 > 0 ) 964 if ( v8 > 0 )
965 { 965 {
966 if ( (signed int)pOutdoorCamera->uNumSurfs < 1999 ) 966 if ( (signed int)pODMRenderParams->uNumSurfs < 1999 )
967 { 967 {
968 v7 = pOutdoorCamera->uNumEdges; 968 v7 = pODMRenderParams->uNumEdges;
969 if ( (signed int)pOutdoorCamera->uNumEdges < 5979 ) 969 if ( (signed int)pODMRenderParams->uNumEdges < 5979 )
970 { 970 {
971 v4->uEdgeList1Size = 0; 971 v4->uEdgeList1Size = 0;
972 v4->uEdgeList2Size = 0; 972 v4->uEdgeList2Size = 0;
973 v45 = -1; 973 v45 = -1;
974 v34 = v7; 974 v34 = v7;
983 v49 = &v5->flt_2C; 983 v49 = &v5->flt_2C;
984 v46 = (char *)v47 - (char *)a3; 984 v46 = (char *)v47 - (char *)a3;
985 do 985 do
986 { 986 {
987 v10 = v48; 987 v10 = v48;
988 ++pOutdoorCamera->uNumEdges; 988 ++pODMRenderParams->uNumEdges;
989 if ( v48 >= v41 ) 989 if ( v48 >= v41 )
990 v10 = 0; 990 v10 = 0;
991 v11 = *v9; 991 v11 = *v9;
992 LODWORD(v50) = *v9; 992 LODWORD(v50) = *v9;
993 if ( SLODWORD(v50) > v45 ) 993 if ( SLODWORD(v50) > v45 )
1087 ++v9; 1087 ++v9;
1088 } 1088 }
1089 while ( v48 - 1 < v41 ); 1089 while ( v48 - 1 < v41 );
1090 } 1090 }
1091 LOBYTE(v7) = v34; 1091 LOBYTE(v7) = v34;
1092 if ( pOutdoorCamera->uNumEdges != v34 ) 1092 if ( pODMRenderParams->uNumEdges != v34 )
1093 { 1093 {
1094 v4->ptr_48 = 0; 1094 v4->ptr_48 = 0;
1095 ptr_80C97C_Surfs->field_22 = 0; 1095 ptr_80C97C_Surfs->field_22 = 0;
1096 ptr_80C97C_Surfs->pParent = v4; 1096 ptr_80C97C_Surfs->pParent = v4;
1097 ptr_80C97C_Surfs->field_4 = v4->field_4; 1097 ptr_80C97C_Surfs->field_4 = v4->field_4;
1101 ptr_80C97C_Surfs->field_10 = v4->field_10; 1101 ptr_80C97C_Surfs->field_10 = v4->field_10;
1102 LOBYTE(v7) = (char)pSurfs + 28; 1102 LOBYTE(v7) = (char)pSurfs + 28;
1103 if ( ptr_80C97C_Surfs < &pSurfs[1999] ) 1103 if ( ptr_80C97C_Surfs < &pSurfs[1999] )
1104 { 1104 {
1105 ++ptr_80C97C_Surfs; 1105 ++ptr_80C97C_Surfs;
1106 ++pOutdoorCamera->uNumSurfs; 1106 ++pODMRenderParams->uNumSurfs;
1107 } 1107 }
1108 if ( BYTE3(a4) ) 1108 if ( BYTE3(a4) )
1109 v4->field_108 = 1; 1109 v4->field_108 = 1;
1110 } 1110 }
1111 } 1111 }
1156 int v38; // [sp+98h] [bp-8h]@1 1156 int v38; // [sp+98h] [bp-8h]@1
1157 int X; // [sp+9Ch] [bp-4h]@1 1157 int X; // [sp+9Ch] [bp-4h]@1
1158 1158
1159 v2 = _this; 1159 v2 = _this;
1160 v3 = _this->pParent; 1160 v3 = _this->pParent;
1161 v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); 1161 v4 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A);
1162 v5 = v3->ptr_38; 1162 v5 = v3->ptr_38;
1163 v38 = v4; 1163 v38 = v4;
1164 v37 = v5->field_14; 1164 v37 = v5->field_14;
1165 v38 = (unsigned __int64)(v37 * (signed __int64)v4) >> 16; 1165 v38 = (unsigned __int64)(v37 * (signed __int64)v4) >> 16;
1166 v6 = v3->ptr_38; 1166 v6 = v3->ptr_38;
1174 v38 = (unsigned __int64)(v37 * (signed __int64)v4) >> 16; 1174 v38 = (unsigned __int64)(v37 * (signed __int64)v4) >> 16;
1175 v9 = v3->v_18.x; 1175 v9 = v3->v_18.x;
1176 v28 = v3->sTextureDeltaU << 16; 1176 v28 = v3->sTextureDeltaU << 16;
1177 v35 = v3->sTextureDeltaV << 16; 1177 v35 = v3->sTextureDeltaV << 16;
1178 v10 = v2->field_8; 1178 v10 = v2->field_8;
1179 v29 = pOutdoorCamera->camera_rotation_y_int_sine; 1179 v29 = pODMRenderParams->camera_rotation_y_int_sine;
1180 v32 = pOutdoorCamera->camera_rotation_y_int_cosine; 1180 v32 = pODMRenderParams->camera_rotation_y_int_cosine;
1181 a1.field_28 = v2->field_C; 1181 a1.field_28 = v2->field_C;
1182 v11 = v3->field_24; 1182 v11 = v3->field_24;
1183 v37 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v10); 1183 v37 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v10);
1184 v12 = v3->v_18.y; 1184 v12 = v3->v_18.y;
1185 v13 = -v11; 1185 v13 = -v11;
1186 v36 = v13; 1186 v36 = v13;
1187 X = ((unsigned __int64)(v37 * (signed __int64)v12) >> 16) + v38 + v9; 1187 X = ((unsigned __int64)(v37 * (signed __int64)v12) >> 16) + v38 + v9;
1188 if ( !X || (v14 = abs(v13 >> 14), v14 > abs(X)) ) 1188 if ( !X || (v14 = abs(v13 >> 14), v14 > abs(X)) )
1252 a1.field_30 = v28 + ((unsigned __int64)(v36 * (signed __int64)v38) >> 16) - v20->field_24; 1252 a1.field_30 = v28 + ((unsigned __int64)(v36 * (signed __int64)v38) >> 16) - v20->field_24;
1253 X = (unsigned __int64)(v34 * (signed __int64)v38) >> 16; 1253 X = (unsigned __int64)(v34 * (signed __int64)v38) >> 16;
1254 v21 = X - v3->ptr_38->field_28 - v35; 1254 v21 = X - v3->ptr_38->field_28 - v35;
1255 a1.field_30 >>= v17 + bUseLoResSprites; 1255 a1.field_30 >>= v17 + bUseLoResSprites;
1256 a1.field_2C = v21 >> (v17 + bUseLoResSprites); 1256 a1.field_2C = v21 >> (v17 + bUseLoResSprites);
1257 v35 = pOutdoorCamera->int_fov_rad_inv; 1257 v35 = pODMRenderParams->int_fov_rad_inv;
1258 v37 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v38) >> 16) >> (v17 + bUseLoResSprites); 1258 v37 = (signed int)((unsigned __int64)(pODMRenderParams->int_fov_rad_inv * (signed __int64)v38) >> 16) >> (v17 + bUseLoResSprites);
1259 a1.field_4 = (unsigned __int64)(v37 * (signed __int64)v29) >> 16; 1259 a1.field_4 = (unsigned __int64)(v37 * (signed __int64)v29) >> 16;
1260 X = (unsigned __int64)(v37 * (signed __int64)v32) >> 16; 1260 X = (unsigned __int64)(v37 * (signed __int64)v32) >> 16;
1261 a1.field_0 = -(signed int)((unsigned __int64)(v37 * (signed __int64)v32) >> 16); 1261 a1.field_0 = -(signed int)((unsigned __int64)(v37 * (signed __int64)v32) >> 16);
1262 v22 = v2->field_A; 1262 v22 = v2->field_A;
1263 a1.pColorBuffer = &pRenderer->pTargetSurface[v2->field_8 + pRenderer->uTargetSurfacePitch * v2->field_A]; 1263 a1.pColorBuffer = &pRenderer->pTargetSurface[v2->field_8 + pRenderer->uTargetSurfacePitch * v2->field_A];
1269 v32 = (signed int)v24->uTextureWidth >> v17; 1269 v32 = (signed int)v24->uTextureWidth >> v17;
1270 v25 = (signed int)v24->uTextureHeight >> v17; 1270 v25 = (signed int)v24->uTextureHeight >> v17;
1271 a1.field_10 = v17 - v24->uWidthLn2 + 16; 1271 a1.field_10 = v17 - v24->uWidthLn2 + 16;
1272 a1.field_C = v32 - 1; 1272 a1.field_C = v32 - 1;
1273 a1.field_8 = (v25 << 16) - 65536; 1273 a1.field_8 = (v25 << 16) - 65536;
1274 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v38, v3, pOutdoorCamera->building_gamme, 1u, 1); 1274 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v38, v3, pODMRenderParams->building_gamme, 1u, 1);
1275 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) 1275 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 )
1276 sr_sub_485975(&a1, (stru315 *)&a2); 1276 sr_sub_485975(&a1, (stru315 *)&a2);
1277 else 1277 else
1278 sr_sub_4D6FB0(v1); 1278 sr_sub_4D6FB0(v1);
1279 return 1; 1279 return 1;
1427 v11 = (double)*(signed int *)(v10 + 8) + 4.0; 1427 v11 = (double)*(signed int *)(v10 + 8) + 4.0;
1428 *((float *)v9 - 1) = v11; 1428 *((float *)v9 - 1) = v11;
1429 if ( *(float *)&v84 == v11 ) 1429 if ( *(float *)&v84 == v11 )
1430 ++v82; 1430 ++v82;
1431 pGame->pIndoorCameraD3D->ViewTransform((RenderVertexSoft *)(v9 - 12), 1u); 1431 pGame->pIndoorCameraD3D->ViewTransform((RenderVertexSoft *)(v9 - 12), 1u);
1432 if ( *(float *)v9 < 8.0 || (double)pOutdoorCamera->shading_dist_mist < *(float *)v9 ) 1432 if ( *(float *)v9 < 8.0 || (double)pODMRenderParams->shading_dist_mist < *(float *)v9 )
1433 { 1433 {
1434 if ( *(float *)v9 >= 8.0 ) 1434 if ( *(float *)v9 >= 8.0 )
1435 v75 = 1; 1435 v75 = 1;
1436 else 1436 else
1437 v74 = 1; 1437 v74 = 1;
1447 break; 1447 break;
1448 v5 = v67; 1448 v5 = v67;
1449 } 1449 }
1450 v7 = v77; 1450 v7 = v77;
1451 } 1451 }
1452 v12 = &array_77EC08[pOutdoorCamera->uNumPolygons]; 1452 v12 = &array_77EC08[pODMRenderParams->uNumPolygons];
1453 *(int *)&v12->flags = 0; 1453 *(int *)&v12->flags = 0;
1454 if ( v82 == v7 ) 1454 if ( v82 == v7 )
1455 *(int *)&v12->flags = 65536; 1455 *(int *)&v12->flags = 65536;
1456 v12->pODMFace = v3; 1456 v12->pODMFace = v3;
1457 v12->uNumVertices = v7; 1457 v12->uNumVertices = v7;
1480 v16 = v3->uTextureID; 1480 v16 = v3->uTextureID;
1481 if ( BYTE1(v3->uAttributes) & 0x40 ) 1481 if ( BYTE1(v3->uAttributes) & 0x40 )
1482 v16 = pTextureFrameTable->GetFrameTexture(v16, pEventTimer->uTotalGameTimeElapsed); 1482 v16 = pTextureFrameTable->GetFrameTexture(v16, pEventTimer->uTotalGameTimeElapsed);
1483 v17 = v16; 1483 v17 = v16;
1484 result = (BSPModel *)&pBitmaps_LOD->pTextures[v16]; 1484 result = (BSPModel *)&pBitmaps_LOD->pTextures[v16];
1485 v19 = __OFSUB__(pOutdoorCamera->uNumPolygons, 1999); 1485 v19 = __OFSUB__(pODMRenderParams->uNumPolygons, 1999);
1486 v18 = pOutdoorCamera->uNumPolygons - 1999 < 0; 1486 v18 = pODMRenderParams->uNumPolygons - 1999 < 0;
1487 v12->pTexture = (Texture *)(v17 != -1 ? (int)result : 0); 1487 v12->pTexture = (Texture *)(v17 != -1 ? (int)result : 0);
1488 if ( !(v18 ^ v19) ) 1488 if ( !(v18 ^ v19) )
1489 return result; 1489 return result;
1490 ++pOutdoorCamera->uNumPolygons; 1490 ++pODMRenderParams->uNumPolygons;
1491 ++pOutdoorCamera->field_44; 1491 ++pODMRenderParams->field_44;
1492 if ( !ODMFace::IsBackfaceCulled(v3, array_73D150, v12) ) 1492 if ( !ODMFace::IsBackfaceCulled(v3, array_73D150, v12) )
1493 { 1493 {
1494 LABEL_71: 1494 LABEL_71:
1495 --pOutdoorCamera->uNumPolygons; 1495 --pODMRenderParams->uNumPolygons;
1496 --pOutdoorCamera->field_44; 1496 --pODMRenderParams->field_44;
1497 goto LABEL_72; 1497 goto LABEL_72;
1498 } 1498 }
1499 LOBYTE(v20) = v79; 1499 LOBYTE(v20) = v79;
1500 v21 = a1; 1500 v21 = a1;
1501 v3->bVisible = 1; 1501 v3->bVisible = 1;
1579 } 1579 }
1580 if ( v74 ) 1580 if ( v74 )
1581 { 1581 {
1582 v36 = sr_4250FE(v26); 1582 v36 = sr_4250FE(v26);
1583 v37 = v36; 1583 v37 = v36;
1584 if ( !v36 || (OutdoorCamera::Project(v36), v38 = sr_4254D2(v37), (v12->uNumVertices = v38) == 0) ) 1584 if ( !v36 || (ODMRenderParams::Project(v36), v38 = sr_4254D2(v37), (v12->uNumVertices = v38) == 0) )
1585 goto LABEL_71; 1585 goto LABEL_71;
1586 v12->_48276F_sr(); 1586 v12->_48276F_sr();
1587 v39 = 0; 1587 v39 = 0;
1588 if ( (signed int)v12->uNumVertices > 0 ) 1588 if ( (signed int)v12->uNumVertices > 0 )
1589 { 1589 {
1607 { 1607 {
1608 if ( v75 ) 1608 if ( v75 )
1609 { 1609 {
1610 v43 = sr_4252E8(v26); 1610 v43 = sr_4252E8(v26);
1611 v44 = v43; 1611 v44 = v43;
1612 if ( !v43 || (OutdoorCamera::Project(v43), v45 = sr_4254D2(v44), (v12->uNumVertices = v45) == 0) ) 1612 if ( !v43 || (ODMRenderParams::Project(v43), v45 = sr_4254D2(v44), (v12->uNumVertices = v45) == 0) )
1613 goto LABEL_71; 1613 goto LABEL_71;
1614 v12->_48276F_sr(); 1614 v12->_48276F_sr();
1615 v46 = 0; 1615 v46 = 0;
1616 if ( (signed int)v12->uNumVertices > 0 ) 1616 if ( (signed int)v12->uNumVertices > 0 )
1617 { 1617 {
1734 v11 = a4; 1734 v11 = a4;
1735 if ( a4 < 0 ) 1735 if ( a4 < 0 )
1736 v11 = 0; 1736 v11 = 0;
1737 LODWORD(v12) = a3 << 16; 1737 LODWORD(v12) = a3 << 16;
1738 HIDWORD(v12) = a3 >> 16; 1738 HIDWORD(v12) = a3 >> 16;
1739 a3a = (double)(signed int)(((unsigned __int64)(11 * v12 / (pOutdoorCamera->shading_dist_shade << 16)) >> 16) + 20) 1739 a3a = (double)(signed int)(((unsigned __int64)(11 * v12 / (pODMRenderParams->shading_dist_shade << 16)) >> 16) + 20)
1740 * pOutdoor->fFogDensity; 1740 * pOutdoor->fFogDensity;
1741 v13 = a3a + 6.7553994e15; 1741 v13 = a3a + 6.7553994e15;
1742 v10 = _43F55F_get_billboard_light_level(a1, LODWORD(v13) + v11); 1742 v10 = _43F55F_get_billboard_light_level(a1, LODWORD(v13) + v11);
1743 if ( v10 > 27 ) 1743 if ( v10 > 27 )
1744 v10 = 27; 1744 v10 = 27;
1819 int a1a; // [sp+2Ch] [bp-30h]@26 1819 int a1a; // [sp+2Ch] [bp-30h]@26
1820 unsigned int a1b; // [sp+2Ch] [bp-30h]@116 1820 unsigned int a1b; // [sp+2Ch] [bp-30h]@116
1821 char v41; // [sp+30h] [bp-2Ch]@57 1821 char v41; // [sp+30h] [bp-2Ch]@57
1822 1822
1823 v0 = pRenderer->pTargetSurface; 1823 v0 = pRenderer->pTargetSurface;
1824 v1 = pOutdoorCamera->uNumPolygons; 1824 v1 = pODMRenderParams->uNumPolygons;
1825 a1 = pRenderer->pTargetSurface; 1825 a1 = pRenderer->pTargetSurface;
1826 v2 = array_77EC08.data(); 1826 v2 = array_77EC08.data();
1827 v37 = pOutdoorCamera->uNumPolygons; 1827 v37 = pODMRenderParams->uNumPolygons;
1828 if ( !(pParty->uFlags & 2) ) 1828 if ( !(pParty->uFlags & 2) )
1829 { 1829 {
1830 v1 = uNumElementsIn80AA28; 1830 v1 = uNumElementsIn80AA28;
1831 v2 = ptr_80AA28[0]; 1831 v2 = ptr_80AA28[0];
1832 v37 = uNumElementsIn80AA28; 1832 v37 = uNumElementsIn80AA28;
1866 { 1866 {
1867 if ( *(int *)&v4->flags & 2 ) 1867 if ( *(int *)&v4->flags & 2 )
1868 { 1868 {
1869 while ( 1 ) 1869 while ( 1 )
1870 { 1870 {
1871 if ( pOutdoorCamera->outdoor_no_wavy_water ) 1871 if ( pODMRenderParams->outdoor_no_wavy_water )
1872 sr_sub_48408A_prolly_odm_water_no_waves(v3); 1872 sr_sub_48408A_prolly_odm_water_no_waves(v3);
1873 else 1873 else
1874 sr_sub_485407_prolly_odm_water_wavy(v3); 1874 sr_sub_485407_prolly_odm_water_wavy(v3);
1875 v3->field_E = LOWORD(sr_6BE060[1]); 1875 v3->field_E = LOWORD(sr_6BE060[1]);
1876 if ( v4->prolly_tail == v3 ) 1876 if ( v4->prolly_tail == v3 )
1882 { 1882 {
1883 while ( 1 ) 1883 while ( 1 )
1884 { 1884 {
1885 v16 = v4->pTexture; 1885 v16 = v4->pTexture;
1886 v4->pTexture = pBitmaps_LOD->LoadTexturePtr("wtrtyl"); 1886 v4->pTexture = pBitmaps_LOD->LoadTexturePtr("wtrtyl");
1887 if ( pOutdoorCamera->outdoor_no_wavy_water ) 1887 if ( pODMRenderParams->outdoor_no_wavy_water )
1888 sr_sub_48408A_prolly_odm_water_no_waves(v3); 1888 sr_sub_48408A_prolly_odm_water_no_waves(v3);
1889 else 1889 else
1890 sr_sub_485407_prolly_odm_water_wavy(v3); 1890 sr_sub_485407_prolly_odm_water_wavy(v3);
1891 v18 = v4->terrain_grid_z - 64; 1891 v18 = v4->terrain_grid_z - 64;
1892 v4->pTexture = v16; 1892 v4->pTexture = v16;
2089 } 2089 }
2090 while ( v34 < (signed int)v37 ); 2090 while ( v34 < (signed int)v37 );
2091 } 2091 }
2092 if ( pParty->uFlags & 2 ) 2092 if ( pParty->uFlags & 2 )
2093 { 2093 {
2094 v6 = pOutdoorCamera->uNumPolygons; 2094 v6 = pODMRenderParams->uNumPolygons;
2095 v7 = 0; 2095 v7 = 0;
2096 uNumElementsIn80AA28 = 0; 2096 uNumElementsIn80AA28 = 0;
2097 if ( pOutdoorCamera->uNumPolygons > 0 ) 2097 if ( pODMRenderParams->uNumPolygons > 0 )
2098 { 2098 {
2099 v8 = (char *)&array_77EC08[0].flags; 2099 v8 = (char *)&array_77EC08[0].flags;
2100 do 2100 do
2101 { 2101 {
2102 v2 = *(Polygon **)v8; 2102 v2 = *(Polygon **)v8;
2112 } 2112 }
2113 while ( v6 ); 2113 while ( v6 );
2114 uNumElementsIn80AA28 = v7; 2114 uNumElementsIn80AA28 = v7;
2115 } 2115 }
2116 } 2116 }
2117 v9 = pOutdoorCamera->uNumSpans; 2117 v9 = pODMRenderParams->uNumSpans;
2118 sr_6BE060[0] = pOutdoorCamera->uNumSpans; 2118 sr_6BE060[0] = pODMRenderParams->uNumSpans;
2119 if (pOutdoorCamera->uNumPolygons >= 1999) 2119 if (pODMRenderParams->uNumPolygons >= 1999)
2120 return; 2120 return;
2121 2121
2122 array_77EC08[1999].Create_48607B(&stru_8019C8); 2122 array_77EC08[1999].Create_48607B(&stru_8019C8);
2123 array_77EC08[1999].ptr_38->_48694B_frustum_sky(); 2123 array_77EC08[1999].ptr_38->_48694B_frustum_sky();
2124 2124
2135 v10 = stru_5C6E00->Sin(pIndoorCamera->sRotationX); 2135 v10 = stru_5C6E00->Sin(pIndoorCamera->sRotationX);
2136 array_77EC08[1999].v_18.y = 0; 2136 array_77EC08[1999].v_18.y = 0;
2137 array_77EC08[1999].v_18.x = v10; 2137 array_77EC08[1999].v_18.x = v10;
2138 array_77EC08[1999].v_18.z = stru_5C6E00->Cos(pIndoorCamera->sRotationX); 2138 array_77EC08[1999].v_18.z = stru_5C6E00->Cos(pIndoorCamera->sRotationX);
2139 array_77EC08[1999].field_24 = 2048 - (pIndoorCamera->pos.z << 16); 2139 array_77EC08[1999].field_24 = 2048 - (pIndoorCamera->pos.z << 16);
2140 a1a = (signed __int64)((double)(pIndoorCamera->pos.z * pOutdoorCamera->int_fov_rad) 2140 a1a = (signed __int64)((double)(pIndoorCamera->pos.z * pODMRenderParams->int_fov_rad)
2141 / ((double)pOutdoorCamera->int_fov_rad + 8192.0) 2141 / ((double)pODMRenderParams->int_fov_rad + 8192.0)
2142 + (double)pViewport->uScreenCenterY); 2142 + (double)pViewport->uScreenCenterY);
2143 cos((double)pIndoorCamera->sRotationX * 0.0030664064); 2143 cos((double)pIndoorCamera->sRotationX * 0.0030664064);
2144 sin((double)pIndoorCamera->sRotationX * 0.0030664064); 2144 sin((double)pIndoorCamera->sRotationX * 0.0030664064);
2145 array_77EC08[1999].Create_48607B(&stru_8019C8); 2145 array_77EC08[1999].Create_48607B(&stru_8019C8);
2146 array_77EC08[1999].ptr_38->_48694B_frustum_sky(); 2146 array_77EC08[1999].ptr_38->_48694B_frustum_sky();
2228 v13->field_8 = LOWORD(pViewport->uViewportTL_X); 2228 v13->field_8 = LOWORD(pViewport->uViewportTL_X);
2229 v13->field_C -= LOWORD(pViewport->uViewportTL_X); 2229 v13->field_C -= LOWORD(pViewport->uViewportTL_X);
2230 if ( v13->field_C >= 0 ) 2230 if ( v13->field_C >= 0 )
2231 { 2231 {
2232 LABEL_109: 2232 LABEL_109:
2233 if ( pOutdoorCamera->bNoSky ) 2233 if ( pODMRenderParams->bNoSky )
2234 { 2234 {
2235 const_1_0(); 2235 const_1_0();
2236 } 2236 }
2237 else 2237 else
2238 { 2238 {
2323 v55 = 65536 / SLODWORD(v35); 2323 v55 = 65536 / SLODWORD(v35);
2324 v7 = 65536 / SLODWORD(v35) * (a3 - v4->field_A); 2324 v7 = 65536 / SLODWORD(v35) * (a3 - v4->field_A);
2325 v8 = v3->ptr_38; 2325 v8 = v3->ptr_38;
2326 v42 = ((unsigned __int64)(v3->ptr_38->field_14 * (signed __int64)v7) >> 16) + v8->field_C; 2326 v42 = ((unsigned __int64)(v3->ptr_38->field_14 * (signed __int64)v7) >> 16) + v8->field_C;
2327 v40 = ((unsigned __int64)(v8->field_20 * (signed __int64)v7) >> 16) + v3->ptr_38->field_18; 2327 v40 = ((unsigned __int64)(v8->field_20 * (signed __int64)v7) >> 16) + v3->ptr_38->field_18;
2328 v38 = pOutdoorCamera->camera_rotation_y_int_sine; 2328 v38 = pODMRenderParams->camera_rotation_y_int_sine;
2329 HIDWORD(v35) = pOutdoorCamera->camera_rotation_y_int_cosine; 2329 HIDWORD(v35) = pODMRenderParams->camera_rotation_y_int_cosine;
2330 v45 = v4->field_C; 2330 v45 = v4->field_C;
2331 v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v7) >> 16) + v3->v_18.x; 2331 v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v7) >> 16) + v3->v_18.x;
2332 v10 = 65536 / SLODWORD(v35) * (pViewport->uScreenCenterX - v4->field_8); 2332 v10 = 65536 / SLODWORD(v35) * (pViewport->uScreenCenterX - v4->field_8);
2333 v48 = 0; 2333 v48 = 0;
2334 v50 = 65536 / SLODWORD(v35) * (pViewport->uScreenCenterX - v4->field_8); 2334 v50 = 65536 / SLODWORD(v35) * (pViewport->uScreenCenterX - v4->field_8);
2549 v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2 2549 v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2
2550 pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY);//1536 2550 pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY);//1536
2551 pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512 2551 pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512
2552 v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16;//88 2552 v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16;//88
2553 v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16;// 66 2553 v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16;// 66
2554 v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X 2554 v120 = pODMRenderParams->outdoor_grid_band_3 + v124;//+- range X
2555 v119 = pOutdoorCamera->outdoor_grid_band_3 + v123; 2555 v119 = pODMRenderParams->outdoor_grid_band_3 + v123;
2556 v2 = pOutdoorCamera->uCameraFovInDegrees + 15;//90 2556 v2 = pODMRenderParams->uCameraFovInDegrees + 15;//90
2557 i = v124 - pOutdoorCamera->outdoor_grid_band_3; 2557 i = v124 - pODMRenderParams->outdoor_grid_band_3;
2558 v122 = v123 - pOutdoorCamera->outdoor_grid_band_3; 2558 v122 = v123 - pODMRenderParams->outdoor_grid_band_3;
2559 2559
2560 if ( v2 > 90 ) 2560 if ( v2 > 90 )
2561 v2 = 90; 2561 v2 = 90;
2562 v3 = (v2 << 11) / 720; 2562 v3 = (v2 << 11) / 720;
2563 v4 = stru_5C6E00->uDoublePiMask & (pDirectionIndicator1 - v3); 2563 v4 = stru_5C6E00->uDoublePiMask & (pDirectionIndicator1 - v3);
3212 else 3212 else
3213 Render::DrawTerrainSW(v111, 1, v103, v104); 3213 Render::DrawTerrainSW(v111, 1, v103, v104);
3214 } 3214 }
3215 } 3215 }
3216 result = v126; 3216 result = v126;
3217 pOutdoorCamera->field_40 = v126; 3217 pODMRenderParams->field_40 = v126;
3218 return result; 3218 return result;
3219 } 3219 }
3220 //----- (00482E07) -------------------------------------------------------- 3220 //----- (00482E07) --------------------------------------------------------
3221 signed int __fastcall sr_sub_482E07(Span *ecx0, unsigned __int16 *pRenderTarget) 3221 signed int __fastcall sr_sub_482E07(Span *ecx0, unsigned __int16 *pRenderTarget)
3222 { 3222 {
3307 3307
3308 v85 = ecx0->field_C; 3308 v85 = ecx0->field_C;
3309 v3 = ecx0->pParent; 3309 v3 = ecx0->pParent;
3310 v4 = pViewport->uScreenCenterY - ecx0->field_A; 3310 v4 = pViewport->uScreenCenterY - ecx0->field_A;
3311 v77 = pRenderTarget; 3311 v77 = pRenderTarget;
3312 v5 = pOutdoorCamera->int_fov_rad_inv * v4; 3312 v5 = pODMRenderParams->int_fov_rad_inv * v4;
3313 v6 = v3->ptr_38; 3313 v6 = v3->ptr_38;
3314 v76 = ecx0; 3314 v76 = ecx0;
3315 v81 = v5; 3315 v81 = v5;
3316 v83 = v6->field_14; 3316 v83 = v6->field_14;
3317 v81 = (unsigned __int64)(v83 * (signed __int64)v5) >> 16; 3317 v81 = (unsigned __int64)(v83 * (signed __int64)v5) >> 16;
3325 v83 = v3->v_18.z; 3325 v83 = v3->v_18.z;
3326 v81 = (unsigned __int64)(v83 * (signed __int64)v5) >> 16; 3326 v81 = (unsigned __int64)(v83 * (signed __int64)v5) >> 16;
3327 v68 = v3->sTextureDeltaU << 16; 3327 v68 = v3->sTextureDeltaU << 16;
3328 v69 = v3->sTextureDeltaV << 16; 3328 v69 = v3->sTextureDeltaV << 16;
3329 v72 = -v3->field_24; 3329 v72 = -v3->field_24;
3330 v10 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - ecx0->field_8); 3330 v10 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - ecx0->field_8);
3331 v11 = v3->v_18.y; 3331 v11 = v3->v_18.y;
3332 v66 = v81 + v3->v_18.x; 3332 v66 = v81 + v3->v_18.x;
3333 v83 = v10; 3333 v83 = v10;
3334 v12 = v10 * (signed __int64)v11; 3334 v12 = v10 * (signed __int64)v11;
3335 v81 = v12 >> 16; 3335 v81 = v12 >> 16;
3338 if ( !v13 3338 if ( !v13
3339 || (X = v72 >> 15, v83 = abs(v13), abs(v72 >> 15) >= v83) 3339 || (X = v72 >> 15, v83 = abs(v13), abs(v72 >> 15) >= v83)
3340 || (LODWORD(v14) = v72 << 16, 3340 || (LODWORD(v14) = v72 << 16,
3341 HIDWORD(v14) = v72 >> 16, 3341 HIDWORD(v14) = v72 >> 16,
3342 v79 = v14 / v84, 3342 v79 = v14 / v84,
3343 v80 = v10 - v85 * pOutdoorCamera->int_fov_rad_inv, 3343 v80 = v10 - v85 * pODMRenderParams->int_fov_rad_inv,
3344 v81 = (unsigned __int64)(v80 * (signed __int64)v3->v_18.y) >> 16, 3344 v81 = (unsigned __int64)(v80 * (signed __int64)v3->v_18.y) >> 16,
3345 (v84 = v66 + v81) == 0) 3345 (v84 = v66 + v81) == 0)
3346 || (v15 = abs(v66 + v81), abs(X) >= v15) ) 3346 || (v15 = abs(v66 + v81), abs(X) >= v15) )
3347 return 0; 3347 return 0;
3348 LODWORD(v16) = v72 << 16; 3348 LODWORD(v16) = v72 << 16;
3404 a1.field_8 = (v26 << 16) - 65536; 3404 a1.field_8 = (v26 << 16) - 65536;
3405 a1.field_C = (v25 >> v84) - 1; 3405 a1.field_C = (v25 >> v84) - 1;
3406 if ( v79 >= v70 ) 3406 if ( v79 >= v70 )
3407 { 3407 {
3408 v46 = v76; 3408 v46 = v76;
3409 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v70, v3, pOutdoorCamera->building_gamme, 0, 1); 3409 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v70, v3, pODMRenderParams->building_gamme, 0, 1);
3410 v47 = v3->ptr_38; 3410 v47 = v3->ptr_38;
3411 v79 = v80; 3411 v79 = v80;
3412 v86 = v47->field_10; 3412 v86 = v47->field_10;
3413 v79 = v80; 3413 v79 = v80;
3414 v84 = v67 + ((unsigned __int64)(v86 * (signed __int64)v80) >> 16); 3414 v84 = v67 + ((unsigned __int64)(v86 * (signed __int64)v80) >> 16);
3428 v50 = v46->field_8; 3428 v50 = v46->field_8;
3429 a1.field_20 = dword_80AA14 >> v27; 3429 a1.field_20 = dword_80AA14 >> v27;
3430 v51 = v50 + pRenderer->uTargetSurfacePitch * v46->field_A; 3430 v51 = v50 + pRenderer->uTargetSurfacePitch * v46->field_A;
3431 a1.pDepthBuffer = (unsigned int *)(&pRenderer->pActiveZBuffer[640 * v46->field_A - 1] + v85 + v50); 3431 a1.pDepthBuffer = (unsigned int *)(&pRenderer->pActiveZBuffer[640 * v46->field_A - 1] + v85 + v50);
3432 a1.pColorBuffer = &v77[v85 - 1] + v51; 3432 a1.pColorBuffer = &v77[v85 - 1] + v51;
3433 v80 += pOutdoorCamera->int_fov_rad_inv << v74; 3433 v80 += pODMRenderParams->int_fov_rad_inv << v74;
3434 if ( v78 > 0 ) 3434 if ( v78 > 0 )
3435 { 3435 {
3436 do 3436 do
3437 { 3437 {
3438 v77 = (unsigned __int16 *)v3->v_18.y; 3438 v77 = (unsigned __int16 *)v3->v_18.y;
3484 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F( 3484 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(
3485 &a2, 3485 &a2,
3486 v76, 3486 v76,
3487 v84, 3487 v84,
3488 v3, 3488 v3,
3489 pOutdoorCamera->building_gamme, 3489 pODMRenderParams->building_gamme,
3490 0, 3490 0,
3491 0); 3491 0);
3492 v80 += pOutdoorCamera->int_fov_rad_inv << v74; 3492 v80 += pODMRenderParams->int_fov_rad_inv << v74;
3493 --v78; 3493 --v78;
3494 } 3494 }
3495 while ( v78 ); 3495 while ( v78 );
3496 } 3496 }
3497 if ( !v81 ) 3497 if ( !v81 )
3541 } 3541 }
3542 } 3542 }
3543 } 3543 }
3544 else 3544 else
3545 { 3545 {
3546 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v79, v3, pOutdoorCamera->building_gamme, 1u, 1); 3546 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v79, v3, pODMRenderParams->building_gamme, 1u, 1);
3547 v28 = v3->ptr_38; 3547 v28 = v3->ptr_38;
3548 v85 = v10; 3548 v85 = v10;
3549 v86 = v28->field_10; 3549 v86 = v28->field_10;
3550 v85 = v10; 3550 v85 = v10;
3551 v84 = v67 + ((unsigned __int64)(v86 * (signed __int64)v10) >> 16); 3551 v84 = v67 + ((unsigned __int64)(v86 * (signed __int64)v10) >> 16);
3566 v31 = v76->field_A; 3566 v31 = v76->field_A;
3567 v32 = pRenderer->uTargetSurfacePitch * v76->field_A; 3567 v32 = pRenderer->uTargetSurfacePitch * v76->field_A;
3568 v86 = v76->field_8; 3568 v86 = v76->field_8;
3569 a1.pColorBuffer = &v77[v86 + v32]; 3569 a1.pColorBuffer = &v77[v86 + v32];
3570 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v86 + 640 * v31]; 3570 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v86 + 640 * v31];
3571 v80 = v10 - (pOutdoorCamera->int_fov_rad_inv << v74); 3571 v80 = v10 - (pODMRenderParams->int_fov_rad_inv << v74);
3572 if ( v78 > 0 ) 3572 if ( v78 > 0 )
3573 { 3573 {
3574 v86 = v78; 3574 v86 = v78;
3575 do 3575 do
3576 { 3576 {
3623 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F( 3623 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(
3624 &a2, 3624 &a2,
3625 v76, 3625 v76,
3626 v84, 3626 v84,
3627 v3, 3627 v3,
3628 pOutdoorCamera->building_gamme, 3628 pODMRenderParams->building_gamme,
3629 1u, 3629 1u,
3630 0); 3630 0);
3631 v80 -= pOutdoorCamera->int_fov_rad_inv << v74; 3631 v80 -= pODMRenderParams->int_fov_rad_inv << v74;
3632 --v86; 3632 --v86;
3633 } 3633 }
3634 while ( v86 ); 3634 while ( v86 );
3635 } 3635 }
3636 if ( !v81 ) 3636 if ( !v81 )
3759 int v9; // [sp+34h] [bp-Ch]@1 3759 int v9; // [sp+34h] [bp-Ch]@1
3760 int v10; // [sp+38h] [bp-8h]@1 3760 int v10; // [sp+38h] [bp-8h]@1
3761 //signed int band3a; // [sp+48h] [bp+8h]@2 3761 //signed int band3a; // [sp+48h] [bp+8h]@2
3762 3762
3763 v9 = band2 * 512; 3763 v9 = band2 * 512;
3764 pOutdoorCamera->outdoor_grid_band_3 = band3; 3764 pODMRenderParams->outdoor_grid_band_3 = band3;
3765 v10 = band1 * 512; 3765 v10 = band1 * 512;
3766 v3 = band3 * 512; 3766 v3 = band3 * 512;
3767 pOutdoorCamera->uPickDepth = band3 * 512; 3767 pODMRenderParams->uPickDepth = band3 * 512;
3768 //v4 = terrain_76E5C8; // v4: 0 -> 65536 3768 //v4 = terrain_76E5C8; // v4: 0 -> 65536
3769 for (uint i = 0; i < 16384; ++i) 3769 for (uint i = 0; i < 16384; ++i)
3770 //do 3770 //do
3771 { 3771 {
3772 auto v4 = terrain_76E5C8[i]; 3772 auto v4 = terrain_76E5C8[i];
3820 v7 = a1->vWorldViewPosition.x < 8.0; 3820 v7 = a1->vWorldViewPosition.x < 8.0;
3821 v8 = v5->vWorldViewPosition.x < 8.0; 3821 v8 = v5->vWorldViewPosition.x < 8.0;
3822 v9 = a3->vWorldViewPosition.x < 8.0; 3822 v9 = a3->vWorldViewPosition.x < 8.0;
3823 v10 = a4->vWorldViewPosition.x < 8.0; 3823 v10 = a4->vWorldViewPosition.x < 8.0;
3824 return !(v8 & v9 & v10 & v7) 3824 return !(v8 & v9 & v10 & v7)
3825 && ((v11 = (double)pOutdoorCamera->shading_dist_mist, v11 > v6->vWorldViewPosition.x) ? (v12 = 0) : (v12 = 1), 3825 && ((v11 = (double)pODMRenderParams->shading_dist_mist, v11 > v6->vWorldViewPosition.x) ? (v12 = 0) : (v12 = 1),
3826 v11 > v17->vWorldViewPosition.x ? (v13 = 0) : (v13 = 1), 3826 v11 > v17->vWorldViewPosition.x ? (v13 = 0) : (v13 = 1),
3827 v11 > a3->vWorldViewPosition.x ? (v14 = 0) : (v14 = 1), 3827 v11 > a3->vWorldViewPosition.x ? (v14 = 0) : (v14 = 1),
3828 v11 > a4->vWorldViewPosition.x ? (v15 = 0) : (v15 = 1), 3828 v11 > a4->vWorldViewPosition.x ? (v15 = 0) : (v15 = 1),
3829 !(v13 & v14 & v15 & v12)); 3829 !(v13 & v14 & v15 & v12));
3830 } 3830 }
3990 goto LABEL_105; 3990 goto LABEL_105;
3991 if ( v10->vWorldPosition.z != v11->vWorldPosition.z 3991 if ( v10->vWorldPosition.z != v11->vWorldPosition.z
3992 || v11->vWorldPosition.z != v103->vWorldPosition.z 3992 || v11->vWorldPosition.z != v103->vWorldPosition.z
3993 || v103->vWorldPosition.z != v102->vWorldPosition.z ) 3993 || v103->vWorldPosition.z != v102->vWorldPosition.z )
3994 break; 3994 break;
3995 v17 = &array_77EC08[pOutdoorCamera->uNumPolygons]; 3995 v17 = &array_77EC08[pODMRenderParams->uNumPolygons];
3996 v18 = pOutdoor->GetTileTexture(v101, v100); 3996 v18 = pOutdoor->GetTileTexture(v101, v100);
3997 v17->uTileBitmapID = v18; 3997 v17->uTileBitmapID = v18;
3998 if ( v18 != -1 ) 3998 if ( v18 != -1 )
3999 { 3999 {
4000 v19 = pOutdoor->GetSomeOtherTileInfo(v101, v100); 4000 v19 = pOutdoor->GetSomeOtherTileInfo(v101, v100);
4025 } 4025 }
4026 else 4026 else
4027 { 4027 {
4028 v17->dimming_level = 0; 4028 v17->dimming_level = 0;
4029 } 4029 }
4030 if ( pOutdoorCamera->uNumPolygons >= 1999 ) 4030 if ( pODMRenderParams->uNumPolygons >= 1999 )
4031 return; 4031 return;
4032 ++pOutdoorCamera->uNumPolygons; 4032 ++pODMRenderParams->uNumPolygons;
4033 if ( !_481FC9_terrain(v10, (RenderVertexSoft *)HIDWORD(v101), v102, v17) ) 4033 if ( !_481FC9_terrain(v10, (RenderVertexSoft *)HIDWORD(v101), v102, v17) )
4034 goto LABEL_104; 4034 goto LABEL_104;
4035 v26 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); 4035 v26 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
4036 memcpy(array_50AC10, v104, 0x30u); 4036 memcpy(array_50AC10, v104, 0x30u);
4037 array_50AC10[0]._rhw = v26; 4037 array_50AC10[0]._rhw = v26;
4070 { 4070 {
4071 v36 = sr_4250FE(4u); 4071 v36 = sr_4250FE(4u);
4072 } 4072 }
4073 else 4073 else
4074 { 4074 {
4075 v32 = (double)pOutdoorCamera->shading_dist_mist; 4075 v32 = (double)pODMRenderParams->shading_dist_mist;
4076 if ( v32 >= v104->vWorldViewPosition.x 4076 if ( v32 >= v104->vWorldViewPosition.x
4077 && v32 >= *(float *)(HIDWORD(v101) + 12) 4077 && v32 >= *(float *)(HIDWORD(v101) + 12)
4078 && v32 >= v102->vWorldViewPosition.x 4078 && v32 >= v102->vWorldViewPosition.x
4079 && v32 >= v103->vWorldViewPosition.x ) 4079 && v32 >= v103->vWorldViewPosition.x )
4080 { 4080 {
4093 } 4093 }
4094 v37 = v36; 4094 v37 = v36;
4095 if ( !v36 ) 4095 if ( !v36 )
4096 goto LABEL_104; 4096 goto LABEL_104;
4097 LABEL_41: 4097 LABEL_41:
4098 OutdoorCamera::Project(v37); 4098 ODMRenderParams::Project(v37);
4099 LABEL_102: 4099 LABEL_102:
4100 v33 = sr_4254D2(v37); 4100 v33 = sr_4254D2(v37);
4101 v17->uNumVertices = v33; 4101 v17->uNumVertices = v33;
4102 if ( !v33 ) 4102 if ( !v33 )
4103 goto LABEL_104; 4103 goto LABEL_104;
4107 LABEL_105: 4107 LABEL_105:
4108 v6 = v90++ + 1; 4108 v6 = v90++ + 1;
4109 if ( v90 >= v81 ) 4109 if ( v90 >= v81 )
4110 return; 4110 return;
4111 } 4111 }
4112 v38 = &array_77EC08[pOutdoorCamera->uNumPolygons]; 4112 v38 = &array_77EC08[pODMRenderParams->uNumPolygons];
4113 v39 = pOutdoor->GetTileTexture(v101, v100); 4113 v39 = pOutdoor->GetTileTexture(v101, v100);
4114 v38->uTileBitmapID = v39; 4114 v38->uTileBitmapID = v39;
4115 if ( v39 == -1 ) 4115 if ( v39 == -1 )
4116 goto LABEL_105; 4116 goto LABEL_105;
4117 v40 = pOutdoor->GetSomeOtherTileInfo(v101, v100); 4117 v40 = pOutdoor->GetSomeOtherTileInfo(v101, v100);
4146 { 4146 {
4147 v38->dimming_level = 0; 4147 v38->dimming_level = 0;
4148 } 4148 }
4149 if ( v38->dimming_level < 0 ) 4149 if ( v38->dimming_level < 0 )
4150 v38->dimming_level = 0; 4150 v38->dimming_level = 0;
4151 if ( pOutdoorCamera->uNumPolygons >= 1999 ) 4151 if ( pODMRenderParams->uNumPolygons >= 1999 )
4152 return; 4152 return;
4153 ++pOutdoorCamera->uNumPolygons; 4153 ++pODMRenderParams->uNumPolygons;
4154 if ( !_481FC9_terrain((RenderVertexSoft *)HIDWORD(v101), v103, v104, v38) ) 4154 if ( !_481FC9_terrain((RenderVertexSoft *)HIDWORD(v101), v103, v104, v38) )
4155 goto LABEL_74; 4155 goto LABEL_74;
4156 v48 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); 4156 v48 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
4157 memcpy(array_50AC10, v104, 0x30u); 4157 memcpy(array_50AC10, v104, 0x30u);
4158 array_50AC10[0]._rhw = v48; 4158 array_50AC10[0]._rhw = v48;
4185 { 4185 {
4186 v55 = sr_4250FE(3u); 4186 v55 = sr_4250FE(3u);
4187 } 4187 }
4188 else 4188 else
4189 { 4189 {
4190 v53 = (double)pOutdoorCamera->shading_dist_mist; 4190 v53 = (double)pODMRenderParams->shading_dist_mist;
4191 if ( v53 >= v104->vWorldViewPosition.x 4191 if ( v53 >= v104->vWorldViewPosition.x
4192 && v53 >= *(float *)(HIDWORD(v101) + 12) 4192 && v53 >= *(float *)(HIDWORD(v101) + 12)
4193 && v53 >= v103->vWorldViewPosition.x ) 4193 && v53 >= v103->vWorldViewPosition.x )
4194 { 4194 {
4195 v54 = sr_4254D2(3); 4195 v54 = sr_4254D2(3);
4198 { 4198 {
4199 sr_sub_4829B9((RenderVertexSoft *)HIDWORD(v101), v52, v104, v38, 0); 4199 sr_sub_4829B9((RenderVertexSoft *)HIDWORD(v101), v52, v104, v38, 0);
4200 LABEL_68: 4200 LABEL_68:
4201 sr_sub_481DB2(sr_508690, v54, v38); 4201 sr_sub_481DB2(sr_508690, v54, v38);
4202 LABEL_75: 4202 LABEL_75:
4203 v17 = &array_77EC08[pOutdoorCamera->uNumPolygons]; 4203 v17 = &array_77EC08[pODMRenderParams->uNumPolygons];
4204 v57 = pOutdoor->GetTileTexture(v101, v100); 4204 v57 = pOutdoor->GetTileTexture(v101, v100);
4205 v17->uTileBitmapID = v57; 4205 v17->uTileBitmapID = v57;
4206 if ( v57 == -1 ) 4206 if ( v57 == -1 )
4207 goto LABEL_105; 4207 goto LABEL_105;
4208 *(int *)&v17->flags = pOutdoor->GetSomeOtherTileInfo(v101, v100); 4208 *(int *)&v17->flags = pOutdoor->GetSomeOtherTileInfo(v101, v100);
4236 { 4236 {
4237 v17->dimming_level = 0; 4237 v17->dimming_level = 0;
4238 } 4238 }
4239 if ( v17->dimming_level < 0 ) 4239 if ( v17->dimming_level < 0 )
4240 v17->dimming_level = 0; 4240 v17->dimming_level = 0;
4241 if ( pOutdoorCamera->uNumPolygons >= 1999 ) 4241 if ( pODMRenderParams->uNumPolygons >= 1999 )
4242 return; 4242 return;
4243 ++pOutdoorCamera->uNumPolygons; 4243 ++pODMRenderParams->uNumPolygons;
4244 if ( !_481FC9_terrain(v102, v104, v103, v17) ) 4244 if ( !_481FC9_terrain(v102, v104, v103, v17) )
4245 { 4245 {
4246 LABEL_104: 4246 LABEL_104:
4247 --pOutdoorCamera->uNumPolygons; 4247 --pODMRenderParams->uNumPolygons;
4248 goto LABEL_105; 4248 goto LABEL_105;
4249 } 4249 }
4250 v62 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); 4250 v62 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
4251 memcpy(array_50AC10, v104, 0x30u); 4251 memcpy(array_50AC10, v104, 0x30u);
4252 array_50AC10[0]._rhw = v62; 4252 array_50AC10[0]._rhw = v62;
4274 pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 3, pNormalb); 4274 pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 3, pNormalb);
4275 } 4275 }
4276 if ( v104->vWorldViewPosition.x < 8.0 || v103->vWorldViewPosition.x < 8.0 || v102->vWorldViewPosition.x < 8.0 ) 4276 if ( v104->vWorldViewPosition.x < 8.0 || v103->vWorldViewPosition.x < 8.0 || v102->vWorldViewPosition.x < 8.0 )
4277 { 4277 {
4278 v37 = sr_4250FE(3u); 4278 v37 = sr_4250FE(3u);
4279 OutdoorCamera::Project(v37); 4279 ODMRenderParams::Project(v37);
4280 if ( !v37 ) 4280 if ( !v37 )
4281 goto LABEL_104; 4281 goto LABEL_104;
4282 goto LABEL_102; 4282 goto LABEL_102;
4283 } 4283 }
4284 v66 = (double)pOutdoorCamera->shading_dist_mist; 4284 v66 = (double)pODMRenderParams->shading_dist_mist;
4285 if ( v66 < v104->vWorldViewPosition.x || v66 < v103->vWorldViewPosition.x || v66 < v102->vWorldViewPosition.x ) 4285 if ( v66 < v104->vWorldViewPosition.x || v66 < v103->vWorldViewPosition.x || v66 < v102->vWorldViewPosition.x )
4286 { 4286 {
4287 v37 = sr_4252E8(3u); 4287 v37 = sr_4252E8(3u);
4288 if ( !v37 ) 4288 if ( !v37 )
4289 goto LABEL_105; 4289 goto LABEL_105;
4309 v55 = sr_4252E8(3u); 4309 v55 = sr_4252E8(3u);
4310 } 4310 }
4311 v56 = v55; 4311 v56 = v55;
4312 if ( v55 ) 4312 if ( v55 )
4313 { 4313 {
4314 OutdoorCamera::Project(v55); 4314 ODMRenderParams::Project(v55);
4315 v54 = sr_4254D2(v56); 4315 v54 = sr_4254D2(v56);
4316 v38->uNumVertices = v54; 4316 v38->uNumVertices = v54;
4317 if ( v54 ) 4317 if ( v54 )
4318 { 4318 {
4319 v38->_48276F_sr(); 4319 v38->_48276F_sr();
4320 goto LABEL_68; 4320 goto LABEL_68;
4321 } 4321 }
4322 } 4322 }
4323 LABEL_74: 4323 LABEL_74:
4324 --pOutdoorCamera->uNumPolygons; 4324 --pODMRenderParams->uNumPolygons;
4325 goto LABEL_75; 4325 goto LABEL_75;
4326 } 4326 }
4327 } 4327 }
4328 4328
4329 //----- (00481FC9) -------------------------------------------------------- 4329 //----- (00481FC9) --------------------------------------------------------
4688 } 4688 }
4689 else 4689 else
4690 { 4690 {
4691 LODWORD(v17) = v9 << 16; 4691 LODWORD(v17) = v9 << 16;
4692 HIDWORD(v17) = v9 >> 16; 4692 HIDWORD(v17) = v9 >> 16;
4693 v27 = (double)(signed int)(((unsigned __int64)(v17 / (pOutdoorCamera->shading_dist_shade << 16) * (31 - *a6)) >> 16) 4693 v27 = (double)(signed int)(((unsigned __int64)(v17 / (pODMRenderParams->shading_dist_shade << 16) * (31 - *a6)) >> 16)
4694 + *a6) 4694 + *a6)
4695 * pOutdoor->fFogDensity; 4695 * pOutdoor->fFogDensity;
4696 v18 = v27 + 6.7553994e15; 4696 v18 = v27 + 6.7553994e15;
4697 v29 = LODWORD(v18); 4697 v29 = LODWORD(v18);
4698 } 4698 }
6011 { 6011 {
6012 v13->prolly_head = v0; 6012 v13->prolly_head = v0;
6013 } 6013 }
6014 v13->prolly_tail = v0; 6014 v13->prolly_tail = v0;
6015 } 6015 }
6016 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) 6016 if ( (signed int)pODMRenderParams->uNumSpans >= 12499 )
6017 return; 6017 return;
6018 ++v0; 6018 ++v0;
6019 ++pOutdoorCamera->uNumSpans; 6019 ++pODMRenderParams->uNumSpans;
6020 } 6020 }
6021 v6 = v26; 6021 v6 = v26;
6022 v7->field_20 = (signed __int64)v11; 6022 v7->field_20 = (signed __int64)v11;
6023 v7->pNext = v9; 6023 v7->pNext = v9;
6024 v9->pPrev = v7; 6024 v9->pPrev = v7;
6056 { 6056 {
6057 v17->prolly_head = v0; 6057 v17->prolly_head = v0;
6058 } 6058 }
6059 v17->prolly_tail = v0; 6059 v17->prolly_tail = v0;
6060 } 6060 }
6061 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) 6061 if ( (signed int)pODMRenderParams->uNumSpans >= 12499 )
6062 return; 6062 return;
6063 ++v0; 6063 ++v0;
6064 ++pOutdoorCamera->uNumSpans; 6064 ++pODMRenderParams->uNumSpans;
6065 } 6065 }
6066 v7->pNext->field_20 = (signed __int64)v15; 6066 v7->pNext->field_20 = (signed __int64)v15;
6067 v6 = v26; 6067 v6 = v26;
6068 } 6068 }
6069 v7->pNext->pPrev = v7->pPrev; 6069 v7->pNext->pPrev = v7->pPrev;
6118 } 6118 }
6119 } 6119 }
6120 } 6120 }
6121 6121
6122 //----- (00487355) -------------------------------------------------------- 6122 //----- (00487355) --------------------------------------------------------
6123 bool OutdoorCamera::_487355() 6123 bool ODMRenderParams::ApplyLightmapsSW()
6124 { 6124 {
6125 int v0; // esi@1 6125 int v0; // esi@1
6126 Polygon *v1; // edi@2 6126 Polygon *v1; // edi@2
6127 bool result; // eax@3 6127 bool result; // eax@3
6128 6128
6129 v0 = 0; 6129 v0 = 0;
6130 if ( pOutdoorCamera->uNumPolygons > 0 ) 6130 if ( pODMRenderParams->uNumPolygons > 0 )
6131 { 6131 {
6132 v1 = array_77EC08.data(); 6132 v1 = array_77EC08.data();
6133 do 6133 do
6134 { 6134 {
6135 result = pGame->pLightmapBuilder->_45D3C7(v1); 6135 result = pGame->pLightmapBuilder->_45D3C7_sw(v1);
6136 ++v0; 6136 ++v0;
6137 ++v1; 6137 ++v1;
6138 } 6138 }
6139 while ( v0 < pOutdoorCamera->uNumPolygons ); 6139 while ( v0 < pODMRenderParams->uNumPolygons );
6140 } 6140 }
6141 return result; 6141 return result;
6142 } 6142 }
6143 6143
6144 //----- (00479332) -------------------------------------------------------- 6144 //----- (00479332) --------------------------------------------------------
6162 float v15; // [sp+8h] [bp-30h]@1 6162 float v15; // [sp+8h] [bp-30h]@1
6163 float v16; // [sp+Ch] [bp-2Ch]@1 6163 float v16; // [sp+Ch] [bp-2Ch]@1
6164 6164
6165 v14 = (double)pOutdoor->vSunlight.x / 65536.0; 6165 v14 = (double)pOutdoor->vSunlight.x / 65536.0;
6166 result = 0; 6166 result = 0;
6167 v1 = (unsigned int)&array_77EC08[pOutdoorCamera->uNumPolygons]; 6167 v1 = (unsigned int)&array_77EC08[pODMRenderParams->uNumPolygons];
6168 v15 = (double)pOutdoor->vSunlight.y / 65536.0; 6168 v15 = (double)pOutdoor->vSunlight.y / 65536.0;
6169 v16 = (double)pOutdoor->vSunlight.z / 65536.0; 6169 v16 = (double)pOutdoor->vSunlight.z / 65536.0;
6170 if ( v1 > (unsigned int)array_77EC08.data() ) 6170 if ( v1 > (unsigned int)array_77EC08.data() )
6171 { 6171 {
6172 v2 = (char *)&array_77EC08[0].pODMFace; 6172 v2 = (char *)&array_77EC08[0].pODMFace;
6460 v61 = ecx0; 6460 v61 = ecx0;
6461 v7 = ecx0->field_C; 6461 v7 = ecx0->field_C;
6462 a1.pColorBuffer = &pTargetSurface[v6]; 6462 a1.pColorBuffer = &pTargetSurface[v6];
6463 v74 = v7; 6463 v74 = v7;
6464 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v4 + 640 * v3]; 6464 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v4 + 640 * v3];
6465 v8 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); 6465 v8 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v4);
6466 v9 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v3); 6466 v9 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v3);
6467 v10 = v5->ptr_38->field_14; 6467 v10 = v5->ptr_38->field_14;
6468 v76 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); 6468 v76 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v4);
6469 v72 = v10; 6469 v72 = v10;
6470 v81 = (unsigned __int64)(v10 * (signed __int64)v9) >> 16; 6470 v81 = (unsigned __int64)(v10 * (signed __int64)v9) >> 16;
6471 v11 = v5->ptr_38; 6471 v11 = v5->ptr_38;
6472 v12 = v81 + v11->field_C; 6472 v12 = v81 + v11->field_C;
6473 v72 = v11->field_20; 6473 v72 = v11->field_20;
6530 } 6530 }
6531 a1.pTextureLOD = v21; 6531 a1.pTextureLOD = v21;
6532 LABEL_12: 6532 LABEL_12:
6533 if ( v21 ) 6533 if ( v21 )
6534 { 6534 {
6535 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, v20, v5, pOutdoorCamera->building_gamme, 1u, 1); 6535 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, v20, v5, pODMRenderParams->building_gamme, 1u, 1);
6536 a1.field_28 = 16; 6536 a1.field_28 = 16;
6537 v66 = v74 >> 4; 6537 v66 = v74 >> 4;
6538 v81 = v8; 6538 v81 = v8;
6539 v26 = v5->ptr_38; 6539 v26 = v5->ptr_38;
6540 v72 = v74 - 16 * (v74 >> 4); 6540 v72 = v74 - 16 * (v74 >> 4);
6546 v81 = (unsigned __int64)(v74 * (signed __int64)v20) >> 16; 6546 v81 = (unsigned __int64)(v74 * (signed __int64)v20) >> 16;
6547 v27 = ((unsigned __int64)(v74 * (signed __int64)v20) >> 16) - v5->ptr_38->field_24; 6547 v27 = ((unsigned __int64)(v74 * (signed __int64)v20) >> 16) - v5->ptr_38->field_24;
6548 v81 = (unsigned __int64)(v76 * (signed __int64)v69) >> 16; 6548 v81 = (unsigned __int64)(v76 * (signed __int64)v69) >> 16;
6549 v28 = v63 + ((unsigned __int64)(v76 * (signed __int64)v69) >> 16) - v5->ptr_38->field_28; 6549 v28 = v63 + ((unsigned __int64)(v76 * (signed __int64)v69) >> 16) - v5->ptr_38->field_28;
6550 v76 = v75 + bUseLoResSprites; 6550 v76 = v75 + bUseLoResSprites;
6551 v73 = v8 - 16 * pOutdoorCamera->int_fov_rad_inv; 6551 v73 = v8 - 16 * pODMRenderParams->int_fov_rad_inv;
6552 v29 = v5->pTexture; 6552 v29 = v5->pTexture;
6553 v30 = (v71 + v27) >> v76; 6553 v30 = (v71 + v27) >> v76;
6554 v31 = v28 >> v76; 6554 v31 = v28 >> v76;
6555 v32 = (signed int)v29->uTextureWidth >> v75; 6555 v32 = (signed int)v29->uTextureWidth >> v75;
6556 v74 = (signed __int16)v75; 6556 v74 = (signed __int16)v75;
6607 a1.field_2C = v68 + 4 * v44; 6607 a1.field_2C = v68 + 4 * v44;
6608 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) 6608 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 )
6609 sr_sub_485975(&a1, (stru315 *)&a2); 6609 sr_sub_485975(&a1, (stru315 *)&a2);
6610 else 6610 else
6611 sr_sub_4D6FB0(v2); 6611 sr_sub_4D6FB0(v2);
6612 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, X, v5, pOutdoorCamera->building_gamme, 1u, 0); 6612 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, X, v5, pODMRenderParams->building_gamme, 1u, 0);
6613 v73 -= 16 * pOutdoorCamera->int_fov_rad_inv; 6613 v73 -= 16 * pODMRenderParams->int_fov_rad_inv;
6614 v45 = v74-- == 1; 6614 v45 = v74-- == 1;
6615 a1.field_28 = 16; 6615 a1.field_28 = 16;
6616 v30 = v43; 6616 v30 = v43;
6617 v68 = v79; 6617 v68 = v79;
6618 } 6618 }
6727 int v43; // [sp+90h] [bp-8h]@2 6727 int v43; // [sp+90h] [bp-8h]@2
6728 int v44; // [sp+94h] [bp-4h]@1 6728 int v44; // [sp+94h] [bp-4h]@1
6729 6729
6730 v2 = _this; 6730 v2 = _this;
6731 v3 = _this->pParent; 6731 v3 = _this->pParent;
6732 v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); 6732 v4 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A);
6733 v5 = v3->ptr_38; 6733 v5 = v3->ptr_38;
6734 v44 = v4; 6734 v44 = v4;
6735 v42 = v5->field_14; 6735 v42 = v5->field_14;
6736 v44 = (unsigned __int64)(v42 * (signed __int64)v4) >> 16; 6736 v44 = (unsigned __int64)(v42 * (signed __int64)v4) >> 16;
6737 v6 = v3->ptr_38; 6737 v6 = v3->ptr_38;
6749 v11 = v2->field_8; 6749 v11 = v2->field_8;
6750 v36 = v10; 6750 v36 = v10;
6751 a1.field_28 = v2->field_C; 6751 a1.field_28 = v2->field_C;
6752 v12 = pViewport->uScreenCenterX - v11; 6752 v12 = pViewport->uScreenCenterX - v11;
6753 v13 = v3->field_24; 6753 v13 = v3->field_24;
6754 v42 = pOutdoorCamera->int_fov_rad_inv * v12; 6754 v42 = pODMRenderParams->int_fov_rad_inv * v12;
6755 v14 = v3->v_18.y; 6755 v14 = v3->v_18.y;
6756 v15 = -v13; 6756 v15 = -v13;
6757 v40 = v15; 6757 v40 = v15;
6758 v16 = ((unsigned __int64)(v42 * (signed __int64)v14) >> 16) + v9; 6758 v16 = ((unsigned __int64)(v42 * (signed __int64)v14) >> 16) + v9;
6759 v44 = v16; 6759 v44 = v16;
6821 a1.field_14 = dword_80AA20 >> v27; 6821 a1.field_14 = dword_80AA20 >> v27;
6822 a1.field_18 = dword_80AA1C >> v27; 6822 a1.field_18 = dword_80AA1C >> v27;
6823 a1.field_1C = dword_80AA18 >> v27; 6823 a1.field_1C = dword_80AA18 >> v27;
6824 a1.field_20 = dword_80AA14 >> v27; 6824 a1.field_20 = dword_80AA14 >> v27;
6825 } 6825 }
6826 v41 = pOutdoorCamera->int_fov_rad_inv; 6826 v41 = pODMRenderParams->int_fov_rad_inv;
6827 v42 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v19) >> 16) >> v27; 6827 v42 = (signed int)((unsigned __int64)(pODMRenderParams->int_fov_rad_inv * (signed __int64)v19) >> 16) >> v27;
6828 a1.field_4 = (unsigned __int64)(v42 * (signed __int64)v35) >> 16; 6828 a1.field_4 = (unsigned __int64)(v42 * (signed __int64)v35) >> 16;
6829 v43 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16; 6829 v43 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16;
6830 a1.field_0 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16; 6830 a1.field_0 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16;
6831 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v19, v3, pOutdoorCamera->terrain_gamma, 1u, 1); 6831 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v19, v3, pODMRenderParams->terrain_gamma, 1u, 1);
6832 LOWORD(v19) = 0; 6832 LOWORD(v19) = 0;
6833 v28 = v2->field_A; 6833 v28 = v2->field_A;
6834 v29 = v2->field_A; 6834 v29 = v2->field_A;
6835 a1.field_24 = v19; 6835 a1.field_24 = v19;
6836 v30 = v2->field_8; 6836 v30 = v2->field_8;
6903 int v40; // [sp+94h] [bp-8h]@1 6903 int v40; // [sp+94h] [bp-8h]@1
6904 int v41; // [sp+98h] [bp-4h]@1 6904 int v41; // [sp+98h] [bp-4h]@1
6905 6905
6906 v2 = _this; 6906 v2 = _this;
6907 v3 = _this->pParent; 6907 v3 = _this->pParent;
6908 v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); 6908 v4 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A);
6909 v5 = v3->ptr_38; 6909 v5 = v3->ptr_38;
6910 v40 = v4; 6910 v40 = v4;
6911 v39 = v5->field_14; 6911 v39 = v5->field_14;
6912 v40 = (unsigned __int64)(v39 * (signed __int64)v4) >> 16; 6912 v40 = (unsigned __int64)(v39 * (signed __int64)v4) >> 16;
6913 v6 = v3->ptr_38; 6913 v6 = v3->ptr_38;
6925 v11 = v2->field_8; 6925 v11 = v2->field_8;
6926 v33 = v10; 6926 v33 = v10;
6927 v35.field_28 = v2->field_C; 6927 v35.field_28 = v2->field_C;
6928 v12 = pViewport->uScreenCenterX - v11; 6928 v12 = pViewport->uScreenCenterX - v11;
6929 v13 = v3->field_24; 6929 v13 = v3->field_24;
6930 v41 = pOutdoorCamera->int_fov_rad_inv * v12; 6930 v41 = pODMRenderParams->int_fov_rad_inv * v12;
6931 v14 = -v13; 6931 v14 = -v13;
6932 v31 = v14; 6932 v31 = v14;
6933 v15 = ((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * v12 * (signed __int64)v3->v_18.y) >> 16) + v9; 6933 v15 = ((unsigned __int64)(pODMRenderParams->int_fov_rad_inv * v12 * (signed __int64)v3->v_18.y) >> 16) + v9;
6934 v37 = v15; 6934 v37 = v15;
6935 if ( !v15 || (v39 = abs(v14 >> 14), v39 > abs(v15)) ) 6935 if ( !v15 || (v39 = abs(v14 >> 14), v39 > abs(v15)) )
6936 return 0; 6936 return 0;
6937 LODWORD(v16) = v31 << 16; 6937 LODWORD(v16) = v31 << 16;
6938 HIDWORD(v16) = v31 >> 16; 6938 HIDWORD(v16) = v31 >> 16;
6988 v35.field_14 = dword_80AA20 >> v24; 6988 v35.field_14 = dword_80AA20 >> v24;
6989 v35.field_18 = dword_80AA1C >> v24; 6989 v35.field_18 = dword_80AA1C >> v24;
6990 v35.field_1C = dword_80AA18 >> v24; 6990 v35.field_1C = dword_80AA18 >> v24;
6991 v35.field_20 = dword_80AA14 >> v24; 6991 v35.field_20 = dword_80AA14 >> v24;
6992 } 6992 }
6993 v38 = pOutdoorCamera->int_fov_rad_inv; 6993 v38 = pODMRenderParams->int_fov_rad_inv;
6994 v39 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v40) >> 16) >> v24; 6994 v39 = (signed int)((unsigned __int64)(pODMRenderParams->int_fov_rad_inv * (signed __int64)v40) >> 16) >> v24;
6995 v35.field_4 = (unsigned __int64)(v39 * (signed __int64)v32) >> 16; 6995 v35.field_4 = (unsigned __int64)(v39 * (signed __int64)v32) >> 16;
6996 v41 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16; 6996 v41 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16;
6997 v35.field_0 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16; 6997 v35.field_0 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16;
6998 v35.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&v34, v2, v40, v3, pOutdoorCamera->terrain_gamma, 1u, 1); 6998 v35.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&v34, v2, v40, v3, pODMRenderParams->terrain_gamma, 1u, 1);
6999 v25 = v2->field_8; 6999 v25 = v2->field_8;
7000 v26 = (unsigned int *)&pRenderer->pActiveZBuffer[v25 + 640 * v2->field_A]; 7000 v26 = (unsigned int *)&pRenderer->pActiveZBuffer[v25 + 640 * v2->field_A];
7001 v35.pColorBuffer = &pRenderer->pTargetSurface[v25 + pRenderer->uTargetSurfacePitch * v2->field_A]; 7001 v35.pColorBuffer = &pRenderer->pTargetSurface[v25 + pRenderer->uTargetSurfacePitch * v2->field_A];
7002 v35.pDepthBuffer = v26; 7002 v35.pDepthBuffer = v26;
7003 v27 = v3->pTexture; 7003 v27 = v3->pTexture;
7119 if ( v5 >= texmapping_terrain_subdivsize ) 7119 if ( v5 >= texmapping_terrain_subdivsize )
7120 v73 = texmapping_terrain_subdivsize - (v3 & (texmapping_terrain_subdivsize - 1)); 7120 v73 = texmapping_terrain_subdivsize - (v3 & (texmapping_terrain_subdivsize - 1));
7121 v6 = v5 - v73; 7121 v6 = v5 - v73;
7122 v67 = v6 >> texmapping_terrain_subdivpow2; 7122 v67 = v6 >> texmapping_terrain_subdivpow2;
7123 v62 = v6 - (v6 >> texmapping_terrain_subdivpow2 << texmapping_terrain_subdivpow2); 7123 v62 = v6 - (v6 >> texmapping_terrain_subdivpow2 << texmapping_terrain_subdivpow2);
7124 v7 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); 7124 v7 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v76);
7125 v8 = v4->ptr_38; 7125 v8 = v4->ptr_38;
7126 v79 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); 7126 v79 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v76);
7127 v78 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); 7127 v78 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2);
7128 v76 = v8->field_14; 7128 v76 = v8->field_14;
7129 v78 = (unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; 7129 v78 = (unsigned __int64)(v76 * (signed __int64)(pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16;
7130 v9 = v4->ptr_38; 7130 v9 = v4->ptr_38;
7131 v10 = v78 + v9->field_C; 7131 v10 = v78 + v9->field_C;
7132 v76 = v9->field_20; 7132 v76 = v9->field_20;
7133 v65 = v10; 7133 v65 = v10;
7134 v11 = ((unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16) 7134 v11 = ((unsigned __int64)(v76 * (signed __int64)(pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16)
7135 + v4->ptr_38->field_18; 7135 + v4->ptr_38->field_18;
7136 v78 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); 7136 v78 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2);
7137 v64 = v11; 7137 v64 = v11;
7138 v76 = v4->v_18.z; 7138 v76 = v4->v_18.z;
7139 v78 = (unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; 7139 v78 = (unsigned __int64)(v76 * (signed __int64)(pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16;
7140 v12 = -v4->field_24; 7140 v12 = -v4->field_24;
7141 v63 = v78 + v4->v_18.x; 7141 v63 = v78 + v4->v_18.x;
7142 v66 = -v4->field_24; 7142 v66 = -v4->field_24;
7143 v78 = (unsigned __int64)(v79 * (signed __int64)v4->v_18.y) >> 16; 7143 v78 = (unsigned __int64)(v79 * (signed __int64)v4->v_18.y) >> 16;
7144 v74 = v78 + v63; 7144 v74 = v78 + v63;
7177 v16 = 0; 7177 v16 = 0;
7178 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail0_prolly_alpha_mask; 7178 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail0_prolly_alpha_mask;
7179 } 7179 }
7180 sr.pTextureLOD = v17; 7180 sr.pTextureLOD = v17;
7181 LABEL_14: 7181 LABEL_14:
7182 sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v15, v4, pOutdoorCamera->terrain_gamma, 1u, 1); 7182 sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v15, v4, pODMRenderParams->terrain_gamma, 1u, 1);
7183 v18 = v4->ptr_38; 7183 v18 = v4->ptr_38;
7184 v78 = v7; 7184 v78 = v7;
7185 v79 = v18->field_10; 7185 v79 = v18->field_10;
7186 v78 = v7; 7186 v78 = v7;
7187 v77 = v65 + ((unsigned __int64)(v79 * (signed __int64)v7) >> 16); 7187 v77 = v65 + ((unsigned __int64)(v79 * (signed __int64)v7) >> 16);
7211 sr.field_8 = (v23 << 16) - 65536; 7211 sr.field_8 = (v23 << 16) - 65536;
7212 sr.field_10 = v24; 7212 sr.field_10 = v24;
7213 sr.field_C = v79 - 1; 7213 sr.field_C = v79 - 1;
7214 if ( v73 ) 7214 if ( v73 )
7215 { 7215 {
7216 v25 = v7 - v73 * pOutdoorCamera->int_fov_rad_inv; 7216 v25 = v7 - v73 * pODMRenderParams->int_fov_rad_inv;
7217 v26 = v25; 7217 v26 = v25;
7218 v77 = v4->v_18.y; 7218 v77 = v4->v_18.y;
7219 v79 = v25; 7219 v79 = v25;
7220 v27 = (unsigned __int64)(v77 * (signed __int64)v25) >> 16; 7220 v27 = (unsigned __int64)(v77 * (signed __int64)v25) >> 16;
7221 v28 = v27 + v63; 7221 v28 = v27 + v63;
7266 if ( byte_80AA10 ) 7266 if ( byte_80AA10 )
7267 sr_sub_4D705A(v1); 7267 sr_sub_4D705A(v1);
7268 else 7268 else
7269 sr_sub_4D6FB0(v1); 7269 sr_sub_4D6FB0(v1);
7270 } 7270 }
7271 v39 = v79 - (pOutdoorCamera->int_fov_rad_inv << v69); 7271 v39 = v79 - (pODMRenderParams->int_fov_rad_inv << v69);
7272 } 7272 }
7273 else 7273 else
7274 { 7274 {
7275 v79 = v7 - (pOutdoorCamera->int_fov_rad_inv << v69); 7275 v79 = v7 - (pODMRenderParams->int_fov_rad_inv << v69);
7276 v39 = v7 - (pOutdoorCamera->int_fov_rad_inv << v69); 7276 v39 = v7 - (pODMRenderParams->int_fov_rad_inv << v69);
7277 } 7277 }
7278 sr.field_28 = v68; 7278 sr.field_28 = v68;
7279 while ( v67 > 0 ) 7279 while ( v67 > 0 )
7280 { 7280 {
7281 v40 = v4->v_18.y; 7281 v40 = v4->v_18.y;
7322 if ( byte_80AA10 ) 7322 if ( byte_80AA10 )
7323 sr_sub_4D705A(v1); 7323 sr_sub_4D705A(v1);
7324 else 7324 else
7325 sr_sub_4D6FB0(v1); 7325 sr_sub_4D6FB0(v1);
7326 } 7326 }
7327 sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v73, v4, pOutdoorCamera->terrain_gamma, 1u, 0); 7327 sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v73, v4, pODMRenderParams->terrain_gamma, 1u, 0);
7328 sr.field_28 = v68; 7328 sr.field_28 = v68;
7329 v39 -= pOutdoorCamera->int_fov_rad_inv << v69; 7329 v39 -= pODMRenderParams->int_fov_rad_inv << v69;
7330 } 7330 }
7331 if ( !v62 ) 7331 if ( !v62 )
7332 return 1; 7332 return 1;
7333 v50 = v4->v_18.y; 7333 v50 = v4->v_18.y;
7334 v75 = v50; 7334 v75 = v50;
7446 v5 = a1->pParent; 7446 v5 = a1->pParent;
7447 v43 = a1; 7447 v43 = a1;
7448 v6 = a1->field_C; 7448 v6 = a1->field_C;
7449 a1a.pColorBuffer = &pRenderer->pTargetSurface[v4]; 7449 a1a.pColorBuffer = &pRenderer->pTargetSurface[v4];
7450 v46 = v6; 7450 v46 = v6;
7451 v7 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v3); 7451 v7 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v3);
7452 v8 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); 7452 v8 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterY - v2);
7453 a1a.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v3 + 640 * v2]; 7453 a1a.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v3 + 640 * v2];
7454 v9 = v5->ptr_38; 7454 v9 = v5->ptr_38;
7455 v47 = (Span *)v7; 7455 v47 = (Span *)v7;
7456 X = v8; 7456 X = v8;
7457 v48 = v9->field_14; 7457 v48 = v9->field_14;
7516 } 7516 }
7517 a1a.pTextureLOD = (unsigned __int16 *)pLOD; 7517 a1a.pTextureLOD = (unsigned __int16 *)pLOD;
7518 LABEL_12: 7518 LABEL_12:
7519 if ( !pLOD ) 7519 if ( !pLOD )
7520 return 0; 7520 return 0;
7521 a1a.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v43, v18, v5, pOutdoorCamera->terrain_gamma, 1u, 1); 7521 a1a.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v43, v18, v5, pODMRenderParams->terrain_gamma, 1u, 1);
7522 a1a.field_28 = 16; 7522 a1a.field_28 = 16;
7523 v43 = (Span *)(v46 >> 4); 7523 v43 = (Span *)(v46 >> 4);
7524 X = v7; 7524 X = v7;
7525 v25 = v5->ptr_38; 7525 v25 = v5->ptr_38;
7526 v48 = v46 - 16 * (v46 >> 4); 7526 v48 = v46 - 16 * (v46 >> 4);
7542 v32 = (signed int)v29->uTextureWidth >> v49; 7542 v32 = (signed int)v29->uTextureWidth >> v49;
7543 v33 = (signed int)v29->uTextureHeight >> v49; 7543 v33 = (signed int)v29->uTextureHeight >> v49;
7544 v34 = v49 - v29->uWidthLn2; 7544 v34 = v49 - v29->uWidthLn2;
7545 a1a.field_8 = (v33 << 16) - 65536; 7545 a1a.field_8 = (v33 << 16) - 65536;
7546 X = 2 * pMiscTimer->uTotalGameTimeElapsed; 7546 X = 2 * pMiscTimer->uTotalGameTimeElapsed;
7547 v45 = pOutdoorCamera->int_fov_rad_inv; 7547 v45 = pODMRenderParams->int_fov_rad_inv;
7548 a1a.field_10 = v34 + 16; 7548 a1a.field_10 = v34 + 16;
7549 a1a.field_C = v32 - 1; 7549 a1a.field_C = v32 - 1;
7550 i = (unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)i) >> 16; 7550 i = (unsigned __int64)(pODMRenderParams->int_fov_rad_inv * (signed __int64)i) >> 16;
7551 v47 = (Span *)(i >> v44); 7551 v47 = (Span *)(i >> v44);
7552 v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); 7552 v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY);
7553 v36 = (signed int)v47 * (signed __int64)v35; 7553 v36 = (signed int)v47 * (signed __int64)v35;
7554 i = v36 >> 16; 7554 i = v36 >> 16;
7555 a1a.field_4 = v36 >> 16; 7555 a1a.field_4 = v36 >> 16;
7608 7608
7609 v3 = a1; 7609 v3 = a1;
7610 pPixels = pRenderTarget; 7610 pPixels = pRenderTarget;
7611 v4 = a1->pParent; 7611 v4 = a1->pParent;
7612 v13 = -v4->field_24; 7612 v13 = -v4->field_24;
7613 X = ((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv 7613 X = ((unsigned __int64)(pODMRenderParams->int_fov_rad_inv
7614 * (pViewport->uScreenCenterX - (signed int)a1->field_8) 7614 * (pViewport->uScreenCenterX - (signed int)a1->field_8)
7615 * (signed __int64)v4->v_18.y) >> 16) 7615 * (signed __int64)v4->v_18.y) >> 16)
7616 + ((unsigned __int64)(v4->v_18.z 7616 + ((unsigned __int64)(v4->v_18.z
7617 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv 7617 * (signed __int64)(pODMRenderParams->int_fov_rad_inv
7618 * (pViewport->uScreenCenterY - (signed int)a1->field_A))) >> 16) 7618 * (pViewport->uScreenCenterY - (signed int)a1->field_A))) >> 16)
7619 + v4->v_18.x; 7619 + v4->v_18.x;
7620 if ( X && (v5 = abs(-v4->field_24 >> 14), v5 <= abs(X)) ) 7620 if ( X && (v5 = abs(-v4->field_24 >> 14), v5 <= abs(X)) )
7621 { 7621 {
7622 LODWORD(v6) = v13 << 16; 7622 LODWORD(v6) = v13 << 16;
7624 v7 = v6 / X; 7624 v7 = v6 / X;
7625 v8 = v6 / X; 7625 v8 = v6 / X;
7626 } 7626 }
7627 else 7627 else
7628 { 7628 {
7629 v7 = pOutdoorCamera->shading_dist_mist << 16; 7629 v7 = pODMRenderParams->shading_dist_mist << 16;
7630 v8 = pOutdoorCamera->shading_dist_mist << 16; 7630 v8 = pODMRenderParams->shading_dist_mist << 16;
7631 } 7631 }
7632 v9 = sr_sub_47C178(v8, v4, pOutdoorCamera->terrain_gamma, a4); 7632 v9 = sr_sub_47C178(v8, v4, pODMRenderParams->terrain_gamma, a4);
7633 fill_pixels_fast(*((short *)v9 + v4->pTexture->uDecompressedSize), pPixels, v3->field_C); 7633 fill_pixels_fast(*((short *)v9 + v4->pTexture->uDecompressedSize), pPixels, v3->field_C);
7634 HIWORD(v10) = HIWORD(v7); 7634 HIWORD(v10) = HIWORD(v7);
7635 LOWORD(v10) = 0; 7635 LOWORD(v10) = 0;
7636 j_memset32(v10, &pRenderer->pActiveZBuffer[v3->field_8 + 640 * v3->field_A], v3->field_C); 7636 j_memset32(v10, &pRenderer->pActiveZBuffer[v3->field_8 + 640 * v3->field_A], v3->field_C);
7637 return 1; 7637 return 1;
7665 char *v24; // [sp+24h] [bp-Ch]@5 7665 char *v24; // [sp+24h] [bp-Ch]@5
7666 char *v25; // [sp+28h] [bp-8h]@5 7666 char *v25; // [sp+28h] [bp-8h]@5
7667 char *v26; // [sp+2Ch] [bp-4h]@5 7667 char *v26; // [sp+2Ch] [bp-4h]@5
7668 7668
7669 v1 = uVertexID; 7669 v1 = uVertexID;
7670 v2 = (double)pOutdoorCamera->shading_dist_mist; 7670 v2 = (double)pODMRenderParams->shading_dist_mist;
7671 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); 7671 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
7672 v22 = 0; 7672 v22 = 0;
7673 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; 7673 v18 = array_50AC10[0].vWorldViewPosition.x <= v2;
7674 if ( (signed int)(uVertexID + 1) <= 1 ) 7674 if ( (signed int)(uVertexID + 1) <= 1 )
7675 return 0; 7675 return 0;
8707 WorldPosToGridCellZ(sY); 8707 WorldPosToGridCellZ(sY);
8708 if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !_481EFA_clip_terrain_poly(v8, pVertices, v101, pVertices2, 1)) 8708 if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !_481EFA_clip_terrain_poly(v8, pVertices, v101, pVertices2, 1))
8709 if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y 8709 if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y
8710 || pVertices2->vWorldPosition.y != v101->vWorldPosition.y ) 8710 || pVertices2->vWorldPosition.y != v101->vWorldPosition.y )
8711 break; 8711 break;
8712 pTile = &array_77EC08[pOutdoorCamera->uNumPolygons]; 8712 pTile = &array_77EC08[pODMRenderParams->uNumPolygons];
8713 pTile->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); 8713 pTile->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
8714 if ( pTile->uTileBitmapID != -1 ) 8714 if ( pTile->uTileBitmapID != -1 )
8715 { 8715 {
8716 pTile->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(sX, sY); 8716 pTile->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(sX, sY);
8717 pTile->field_32 = 0; 8717 pTile->field_32 = 0;
8727 norm = &pTerrainNormals[v22]; 8727 norm = &pTerrainNormals[v22];
8728 thisf = 20.0 - ( -(((float)pOutdoor->vSunlight.x / 65536.0) * norm->x) - 8728 thisf = 20.0 - ( -(((float)pOutdoor->vSunlight.x / 65536.0) * norm->x) -
8729 (((float)pOutdoor->vSunlight.y / 65536.0) * norm->y) - 8729 (((float)pOutdoor->vSunlight.y / 65536.0) * norm->y) -
8730 (((float)pOutdoor->vSunlight.z / 65536.0) * norm->z)) * 20.0; 8730 (((float)pOutdoor->vSunlight.z / 65536.0) * norm->z)) * 20.0;
8731 //v25 = thisf + 6.7553994e15; 8731 //v25 = thisf + 6.7553994e15;
8732 //v27 = pOutdoorCamera->uNumPolygons > 1999; 8732 //v27 = pODMRenderParams->uNumPolygons > 1999;
8733 //v26 = pOutdoorCamera->uNumPolygons - 1999 < 0; 8733 //v26 = pODMRenderParams->uNumPolygons - 1999 < 0;
8734 pTile->dimming_level = floorf(thisf + 0.5f); 8734 pTile->dimming_level = floorf(thisf + 0.5f);
8735 if ( pOutdoorCamera->uNumPolygons >= 1999 ) 8735 if ( pODMRenderParams->uNumPolygons >= 1999 )
8736 return; 8736 return;
8737 ++pOutdoorCamera->uNumPolygons; 8737 ++pODMRenderParams->uNumPolygons;
8738 //if ( !_481FC9_terrain(v8, pVertices, v101, v16) )//Ritor1: It's temporary 8738 //if ( !_481FC9_terrain(v8, pVertices, v101, v16) )//Ritor1: It's temporary
8739 //goto LABEL_126; 8739 //goto LABEL_126;
8740 //{ 8740 //{
8741 //--pOutdoorCamera->uNumPolygons; 8741 //--pODMRenderParams->uNumPolygons;
8742 //goto LABEL_162; 8742 //goto LABEL_162;
8743 //} 8743 //}
8744 __debugbreak(); // warning C4700: uninitialized local variable 'v102' used 8744 __debugbreak(); // warning C4700: uninitialized local variable 'v102' used
8745 memcpy(&array_50AC10[0], v102, 0x30u); 8745 memcpy(&array_50AC10[0], v102, 0x30u);
8746 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); 8746 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
8778 thisa->ViewTransform(array_50AC10, a5); 8778 thisa->ViewTransform(array_50AC10, a5);
8779 thisa->Project(array_50AC10, a5, 0); 8779 thisa->Project(array_50AC10, a5, 0);
8780 } 8780 }
8781 this_3 = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 8781 this_3 = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0
8782 || v101->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0; 8782 || v101->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0;
8783 v3a = (double)pOutdoorCamera->shading_dist_mist; 8783 v3a = (double)pODMRenderParams->shading_dist_mist;
8784 v108 = v3a < v102->vWorldViewPosition.x || v3a < pVertices->vWorldViewPosition.x 8784 v108 = v3a < v102->vWorldViewPosition.x || v3a < pVertices->vWorldViewPosition.x
8785 || v3a < v101->vWorldViewPosition.x || v3a < pVertices2->vWorldViewPosition.x; 8785 || v3a < v101->vWorldViewPosition.x || v3a < pVertices2->vWorldViewPosition.x;
8786 v33 = 0; 8786 v33 = 0;
8787 pGame->pLightmapBuilder->std__vector_000004_size = 0; 8787 pGame->pLightmapBuilder->std__vector_000004_size = 0;
8788 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) 8788 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
8804 { 8804 {
8805 if ( this_3 ) 8805 if ( this_3 )
8806 { 8806 {
8807 v36 = sr_424CD7(v34); 8807 v36 = sr_424CD7(v34);
8808 pTile->uNumVertices = v36; 8808 pTile->uNumVertices = v36;
8809 OutdoorCamera::Project(v36); 8809 ODMRenderParams::Project(v36);
8810 } 8810 }
8811 if ( v108 ) 8811 if ( v108 )
8812 { 8812 {
8813 v36 = sr_424EE0_MakeFanFromTriangle(v34); 8813 v36 = sr_424EE0_MakeFanFromTriangle(v34);
8814 pTile->uNumVertices = v36; 8814 pTile->uNumVertices = v36;
8815 OutdoorCamera::Project(v36); 8815 ODMRenderParams::Project(v36);
8816 } 8816 }
8817 } 8817 }
8818 //v37 = *(int *)&v16->flags; 8818 //v37 = *(int *)&v16->flags;
8819 if ( ~pTile->flags & 1 ) 8819 if ( ~pTile->flags & 1 )
8820 { 8820 {
8843 LABEL_162: 8843 LABEL_162:
8844 v4 = v88 + 1; 8844 v4 = v88 + 1;
8845 if ( ++v88 >= v84 ) 8845 if ( ++v88 >= v84 )
8846 return; 8846 return;
8847 } 8847 }
8848 v40 = &array_77EC08[pOutdoorCamera->uNumPolygons]; 8848 v40 = &array_77EC08[pODMRenderParams->uNumPolygons];
8849 v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); 8849 v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
8850 if ( v40->uTileBitmapID == -1 ) 8850 if ( v40->uTileBitmapID == -1 )
8851 goto LABEL_162; 8851 goto LABEL_162;
8852 v42 = pOutdoor->GetSomeOtherTileInfo(sX, sY); 8852 v42 = pOutdoor->GetSomeOtherTileInfo(sX, sY);
8853 BYTE1(v42) |= 0x80u; 8853 BYTE1(v42) |= 0x80u;
8871 thisg = 20.0 - (-v49 - v91 * v48->z - v90 * v48->x) * 20.0; 8871 thisg = 20.0 - (-v49 - v91 * v48->z - v90 * v48->x) * 20.0;
8872 v50 = thisg + 6.755399441055744e15; 8872 v50 = thisg + 6.755399441055744e15;
8873 v40->dimming_level = LOBYTE(v50); 8873 v40->dimming_level = LOBYTE(v50);
8874 if ( LOBYTE(v50) < 0 ) 8874 if ( LOBYTE(v50) < 0 )
8875 v40->dimming_level = 0; 8875 v40->dimming_level = 0;
8876 if ( pOutdoorCamera->uNumPolygons >= 1999 ) 8876 if ( pODMRenderParams->uNumPolygons >= 1999 )
8877 return; 8877 return;
8878 ++pOutdoorCamera->uNumPolygons; 8878 ++pODMRenderParams->uNumPolygons;
8879 if ( !_481FC9_terrain(pVertices, pVertices2, v8, v40) ) // Ritor1: It's temporary 8879 if ( !_481FC9_terrain(pVertices, pVertices2, v8, v40) ) // Ritor1: It's temporary
8880 //goto LABEL_77; 8880 //goto LABEL_77;
8881 { 8881 {
8882 --pOutdoorCamera->uNumPolygons; 8882 --pODMRenderParams->uNumPolygons;
8883 goto LABEL_112; 8883 goto LABEL_112;
8884 } 8884 }
8885 memcpy(&array_50AC10[0], v102, 0x30u); 8885 memcpy(&array_50AC10[0], v102, 0x30u);
8886 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); 8886 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
8887 array_50AC10[0].u = 0.0; 8887 array_50AC10[0].u = 0.0;
8915 { 8915 {
8916 thisb = pGame->pIndoorCameraD3D; 8916 thisb = pGame->pIndoorCameraD3D;
8917 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices ) 8917 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices )
8918 { 8918 {
8919 //LABEL_77: 8919 //LABEL_77:
8920 --pOutdoorCamera->uNumPolygons; 8920 --pODMRenderParams->uNumPolygons;
8921 goto LABEL_112; 8921 goto LABEL_112;
8922 } 8922 }
8923 thisb->ViewTransform(array_50AC10, uNumVertices); 8923 thisb->ViewTransform(array_50AC10, uNumVertices);
8924 thisb->Project(array_50AC10, uNumVertices, 0); 8924 thisb->Project(array_50AC10, uNumVertices, 0);
8925 } 8925 }
8926 this_3a = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0; 8926 this_3a = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0;
8927 v54 = (double)pOutdoorCamera->shading_dist_mist; 8927 v54 = (double)pODMRenderParams->shading_dist_mist;
8928 v108 = v54 < v102->vWorldViewPosition.x || v54 < pVertices->vWorldViewPosition.x || v54 < pVertices2->vWorldViewPosition.x; 8928 v108 = v54 < v102->vWorldViewPosition.x || v54 < pVertices->vWorldViewPosition.x || v54 < pVertices2->vWorldViewPosition.x;
8929 pVertices = 0; 8929 pVertices = 0;
8930 v96->std__vector_000004_size = 0; 8930 v96->std__vector_000004_size = 0;
8931 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) 8931 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
8932 { 8932 {
8955 if ( !v108 ) 8955 if ( !v108 )
8956 goto LABEL_105; 8956 goto LABEL_105;
8957 v56 = sr_424EE0_MakeFanFromTriangle(v55); 8957 v56 = sr_424EE0_MakeFanFromTriangle(v55);
8958 } 8958 }
8959 v40->uNumVertices = v56; 8959 v40->uNumVertices = v56;
8960 OutdoorCamera::Project(v56); 8960 ODMRenderParams::Project(v56);
8961 } 8961 }
8962 LABEL_105: 8962 LABEL_105:
8963 v57 = *(int *)&v40->flags; 8963 v57 = *(int *)&v40->flags;
8964 if ( BYTE1(v57) & 1 ) 8964 if ( BYTE1(v57) & 1 )
8965 { 8965 {
8978 v81 = true; 8978 v81 = true;
8979 } 8979 }
8980 pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81); 8980 pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81);
8981 } 8981 }
8982 LABEL_112: 8982 LABEL_112:
8983 v59 = &array_77EC08[pOutdoorCamera->uNumPolygons]; 8983 v59 = &array_77EC08[pODMRenderParams->uNumPolygons];
8984 //a8 = (RenderVertexSoft *)&array_77EC08[pOutdoorCamera->uNumPolygons]; 8984 //a8 = (RenderVertexSoft *)&array_77EC08[pODMRenderParams->uNumPolygons];
8985 v59->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); 8985 v59->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
8986 if ( v59->uTileBitmapID == -1 ) 8986 if ( v59->uTileBitmapID == -1 )
8987 goto LABEL_162; 8987 goto LABEL_162;
8988 *(int *)&v59->flags = pOutdoor->GetSomeOtherTileInfo(sX, sY); 8988 *(int *)&v59->flags = pOutdoor->GetSomeOtherTileInfo(sX, sY);
8989 v61 = v93; 8989 v61 = v93;
9000 //v99 = v63; 9000 //v99 = v63;
9001 thish = 20.0 - (-v64 - v91 * v63->y - v90 * v63->x) * 20.0; 9001 thish = 20.0 - (-v64 - v91 * v63->y - v90 * v63->x) * 20.0;
9002 v59->dimming_level = floorf(thish + 0.5f); 9002 v59->dimming_level = floorf(thish + 0.5f);
9003 if ( v59->dimming_level < 0 ) 9003 if ( v59->dimming_level < 0 )
9004 v59->dimming_level = 0; 9004 v59->dimming_level = 0;
9005 if ( pOutdoorCamera->uNumPolygons >= 1999 ) 9005 if ( pODMRenderParams->uNumPolygons >= 1999 )
9006 return; 9006 return;
9007 ++pOutdoorCamera->uNumPolygons; 9007 ++pODMRenderParams->uNumPolygons;
9008 if ( !_481FC9_terrain(v101, v102, pVertices2, v59) ) 9008 if ( !_481FC9_terrain(v101, v102, pVertices2, v59) )
9009 { 9009 {
9010 //LABEL_126: 9010 //LABEL_126:
9011 --pOutdoorCamera->uNumPolygons; 9011 --pODMRenderParams->uNumPolygons;
9012 goto LABEL_162; 9012 goto LABEL_162;
9013 } 9013 }
9014 memcpy(&array_50AC10[0], v102, 0x30u); 9014 memcpy(&array_50AC10[0], v102, 0x30u);
9015 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); 9015 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
9016 array_50AC10[0].u = 0.0; 9016 array_50AC10[0].u = 0.0;
9038 { 9038 {
9039 thisc = pGame->pIndoorCameraD3D; 9039 thisc = pGame->pIndoorCameraD3D;
9040 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, (unsigned int *)&v100, 0) == 1 && !v100 ) 9040 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, (unsigned int *)&v100, 0) == 1 && !v100 )
9041 //goto LABEL_126; 9041 //goto LABEL_126;
9042 { 9042 {
9043 --pOutdoorCamera->uNumPolygons; 9043 --pODMRenderParams->uNumPolygons;
9044 goto LABEL_162; 9044 goto LABEL_162;
9045 } 9045 }
9046 thisc->ViewTransform(array_50AC10, v100); 9046 thisc->ViewTransform(array_50AC10, v100);
9047 thisc->Project(array_50AC10, v100, 0); 9047 thisc->Project(array_50AC10, v100, 0);
9048 } 9048 }
9049 this_3b = v102->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0 9049 this_3b = v102->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0
9050 || v101->vWorldViewPosition.x < 8.0; 9050 || v101->vWorldViewPosition.x < 8.0;
9051 v69 = (double)pOutdoorCamera->shading_dist_mist; 9051 v69 = (double)pODMRenderParams->shading_dist_mist;
9052 v108 = v69 < v102->vWorldViewPosition.x || v69 < pVertices2->vWorldViewPosition.x || v69 < v101->vWorldViewPosition.x; 9052 v108 = v69 < v102->vWorldViewPosition.x || v69 < pVertices2->vWorldViewPosition.x || v69 < v101->vWorldViewPosition.x;
9053 v70 = 0; 9053 v70 = 0;
9054 v96->std__vector_000004_size = 0; 9054 v96->std__vector_000004_size = 0;
9055 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) 9055 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
9056 { 9056 {
9105 goto LABEL_56; 9105 goto LABEL_56;
9106 } 9106 }
9107 v73 = sr_424EE0_MakeFanFromTriangle(v72); 9107 v73 = sr_424EE0_MakeFanFromTriangle(v72);
9108 } 9108 }
9109 v71->uNumVertices = v73; 9109 v71->uNumVertices = v73;
9110 OutdoorCamera::Project(v73); 9110 ODMRenderParams::Project(v73);
9111 goto LABEL_154; 9111 goto LABEL_154;
9112 } 9112 }
9113 } 9113 }
9114 //----- (00424579) -------------------------------------------------------- 9114 //----- (00424579) --------------------------------------------------------
9115 int __fastcall sr_424579(int uFaceID, stru320 *a2) 9115 int __fastcall sr_424579(int uFaceID, stru320 *a2)
12277 } 12277 }
12278 } 12278 }
12279 //----- (00481EB7) -------------------------------------------------------- 12279 //----- (00481EB7) --------------------------------------------------------
12280 void ResetPolygons() 12280 void ResetPolygons()
12281 { 12281 {
12282 for (auto i = 0; i < pOutdoorCamera->uNumPolygons; ++i) 12282 for (auto i = 0; i < pODMRenderParams->uNumPolygons; ++i)
12283 { 12283 {
12284 array_77EC08[i].prolly_head = nullptr; 12284 array_77EC08[i].prolly_head = nullptr;
12285 array_77EC08[i].prolly_tail = nullptr; 12285 array_77EC08[i].prolly_tail = nullptr;
12286 12286
12287 array_77EC08[i].flags = 0; 12287 array_77EC08[i].flags = 0;
12398 --v2; 12398 --v2;
12399 } 12399 }
12400 while ( v2 ); 12400 while ( v2 );
12401 } 12401 }
12402 //----- (00486A28) -------------------------------------------------------- 12402 //----- (00486A28) --------------------------------------------------------
12403 void OutdoorCamera::AllocSoftwareDrawBuffers() 12403 void ODMRenderParams::AllocSoftwareDrawBuffers()
12404 { 12404 {
12405 if ( !this || !pSpans ) 12405 if ( !this || !pSpans )
12406 { 12406 {
12407 ReleaseSoftwareDrawBuffers(); 12407 ReleaseSoftwareDrawBuffers();
12408 pSpans = (Span *)malloc(pSpans, 0x493E0u, "SPANS"); 12408 pSpans = (Span *)malloc(pSpans, 0x493E0u, "SPANS");
12414 memset(pSurfs, 0, 0x11940u); 12414 memset(pSurfs, 0, 0x11940u);
12415 memset(pNewEdges, 0, 0x6180u); 12415 memset(pNewEdges, 0, 0x6180u);
12416 } 12416 }
12417 } 12417 }
12418 //----- (00486AFC) -------------------------------------------------------- 12418 //----- (00486AFC) --------------------------------------------------------
12419 void OutdoorCamera::ReleaseSoftwareDrawBuffers() 12419 void ODMRenderParams::ReleaseSoftwareDrawBuffers()
12420 { 12420 {
12421 free(pSpans); 12421 free(pSpans);
12422 free(pEdges); 12422 free(pEdges);
12423 free(pSurfs); 12423 free(pSurfs);
12424 free(pNewEdges); 12424 free(pNewEdges);
12429 } 12429 }
12430 //----- (0048901B) -------------------------------------------------------- 12430 //----- (0048901B) --------------------------------------------------------
12431 bool OutdoorLocation::Release2() 12431 bool OutdoorLocation::Release2()
12432 { 12432 {
12433 Release(); 12433 Release();
12434 pOutdoorCamera->ReleaseSoftwareDrawBuffers(); 12434 pODMRenderParams->ReleaseSoftwareDrawBuffers();
12435 return true; 12435 return true;
12436 } 12436 }
12437 12437
12438 struct Allocator 12438 struct Allocator
12439 { 12439 {
12764 v2 = uSize; 12764 v2 = uSize;
12765 GetSystemInfo(&SystemInfo); 12765 GetSystemInfo(&SystemInfo);
12766 for ( i = 16 * SystemInfo.dwPageSize; i < v2; i += SystemInfo.dwPageSize ) 12766 for ( i = 16 * SystemInfo.dwPageSize; i < v2; i += SystemInfo.dwPageSize )
12767 ; 12767 ;
12768 } 12768 }
12769
12770
12771
12772
12773
12774 //----- (0045D3C7) --------------------------------------------------------
12775 bool LightmapBuilder::_45D3C7_sw(struct Polygon *a1)
12776 {
12777 LightmapBuilder *v2; // ebx@1
12778 struct Polygon *result; // eax@1
12779 float v4; // ecx@2
12780 Span *i; // edi@5
12781
12782 v2 = this;
12783 result = (struct Polygon *)a1->prolly_head;
12784 if ( result && (v4 = result->field_4, *(int *)&v4) != 0 && *(unsigned int *)(LODWORD(v4) + 60) )
12785 {
12786 for ( i = a1->prolly_head; ; i = i->pNext )
12787 {
12788 result = i->pParent;
12789 if ( result->field_108 )
12790 result = (struct Polygon *)_45D426_sw(
12791 i,
12792 a1->pEdgeList1,
12793 a1->uEdgeList1Size,
12794 (Edge *)a1->pEdgeList2,
12795 a1->uEdgeList2Size);
12796 if ( a1->prolly_tail == i )
12797 break;
12798 }
12799 LOBYTE(result) = 1;
12800 }
12801 else
12802 {
12803 LOBYTE(result) = 0;
12804 }
12805 return (bool)result;
12806 }
12807
12808 //----- (0045D426) --------------------------------------------------------
12809 int LightmapBuilder::_45D426_sw(Span *a1, Edge **a2, unsigned int a3, Edge *a4, int a5)
12810 {
12811 int v6; // edi@1
12812 signed int v7; // ebx@3
12813 signed int v8; // ecx@3
12814 Span *v9; // esi@3
12815 double v10; // st7@4
12816 Edge *v11; // edx@5
12817 double v12; // st7@11
12818 int v13; // edx@12
12819 int v14; // ebx@17
12820 Edge *v15; // edi@17
12821 float v16; // ST04_4@17
12822 float v17; // ST04_4@17
12823 double v18; // st7@17
12824 int result; // eax@19
12825 //double v20; // ST14_8@20
12826 //double v21; // ST14_8@20
12827 double v22; // st7@20
12828 int v23; // ecx@20
12829 double v24; // st6@20
12830 double v25; // st7@23
12831 double v26; // st7@28
12832 __int16 v27; // fps@28
12833 char v28; // c0@28
12834 char v29; // c2@28
12835 char v30; // c3@28
12836 double v31; // st7@29
12837 double v32; // st7@30
12838 __int16 v33; // fps@30
12839 char v34; // c0@30
12840 char v35; // c2@30
12841 char v36; // c3@30
12842 LightmapBuilder *this_4; // [sp+14h] [bp-8h]@1
12843 signed int v38; // [sp+18h] [bp-4h]@3
12844 float a1a; // [sp+24h] [bp+8h]@20
12845 float a2a; // [sp+28h] [bp+Ch]@17
12846 float a3a; // [sp+2Ch] [bp+10h]@17
12847 float a5a; // [sp+34h] [bp+18h]@20
12848 float a5b; // [sp+34h] [bp+18h]@20
12849
12850 v6 = 0;
12851 this_4 = this;
12852 if ( a5 && a3 )
12853 {
12854 v7 = -1;
12855 v8 = 0;
12856 v9 = a1;
12857 v38 = -1;
12858 if ( (signed int)a3 > 0 )
12859 {
12860 v10 = (double)a1->field_A;
12861 while ( 1 )
12862 {
12863 v11 = a2[v8];
12864 if ( v10 >= v11->field_2C )
12865 {
12866 if ( v10 <= v11->field_30 )
12867 break;
12868 }
12869 ++v8;
12870 if ( v8 >= (signed int)a3 )
12871 goto LABEL_10;
12872 }
12873 v38 = v8;
12874 }
12875 LABEL_10:
12876 if ( a5 > 0 )
12877 {
12878 v12 = (double)a1->field_A;
12879 while ( 1 )
12880 {
12881 v13 = *((unsigned int *)&a4->field_0 + v6);
12882 if ( v12 >= *(float *)(v13 + 44) )
12883 {
12884 if ( v12 <= *(float *)(v13 + 48) )
12885 break;
12886 }
12887 ++v6;
12888 if ( v6 >= a5 )
12889 goto LABEL_17;
12890 }
12891 v7 = v6;
12892 }
12893 LABEL_17:
12894 v14 = *((unsigned int *)&a4->field_0 + v7);
12895 v15 = a2[v38];
12896 v16 = (double)a1->field_A;
12897 a3a = _45D643_sw(a2[v38], v16);
12898 v17 = (double)a1->field_A;
12899 v18 = _45D643_sw((Edge *)v14, v17);
12900 a2a = v18;
12901 if ( byte_4D864C && BYTE1(pGame->uFlags) & 0x80 )
12902 {
12903 HIWORD(result) = HIWORD(a3a);
12904 a1->field_14 = v18;
12905 a1->field_10 = a3a;
12906 }
12907 else
12908 {
12909 a5a = ((double)a1->field_A - v15->field_2C) * v15->field_4 + v15->field_24 - 0.5;
12910 //v20 = a5a + 6.7553994e15;
12911 //a5b = (double)SLODWORD(v20);
12912 a5b = (double)floorf(a5a + 0.5f);
12913 a1a = ((double)a1->field_A - *(float *)(v14 + 44)) * *(float *)(v14 + 4) + *(float *)(v14 + 36) + 0.5;
12914 //v21 = a1a + 6.7553994e15;
12915 //v22 = (double)SLODWORD(v21);
12916 v22 = (double)floorf(a1a + 0.5f);
12917 result = v9->field_8;
12918 v23 = v9->field_C;
12919 v24 = -((a3a - a2a) / (v22 - a5b));
12920 v9->field_10 = ((double)result - a5b) * v24 + a3a;
12921 v9->field_14 = a2a - (v22 - (double)(result + v23)) * v24;
12922 }
12923 if ( v9->field_10 < 0.0 || v9->field_10 <= 1.0 )
12924 {
12925 if ( v9->field_10 >= 0.0 )
12926 v25 = v9->field_10;
12927 else
12928 v25 = 0.0;
12929 }
12930 else
12931 {
12932 v25 = 1.0;
12933 }
12934 v9->field_10 = v25;
12935 __debugbreak(); // warning C4700: uninitialized local variable 'v27' used
12936 if ( v9->field_14 < 0.0
12937 || (v26 = v9->field_14,
12938 //UNDEF(v27),
12939 v28 = 1.0 < v26,
12940 v29 = 0,
12941 v30 = 1.0 == v26,
12942 BYTE1(result) = HIBYTE(v27),
12943 v26 <= 1.0) )
12944 {
12945 v32 = v9->field_14;
12946 //UNDEF(v33);
12947 v34 = 0.0 < v32;
12948 v35 = 0;
12949 v36 = 0.0 == v32;
12950 __debugbreak(); // warning C4700: uninitialized local variable 'v33' used
12951 BYTE1(result) = HIBYTE(v33);
12952 if ( v32 >= 0.0 )
12953 v31 = v9->field_14;
12954 else
12955 v31 = 0.0;
12956 }
12957 else
12958 {
12959 v31 = 1.0;
12960 }
12961 v9->field_14 = v31;
12962 LOBYTE(result) = 1;
12963 }
12964 else
12965 {
12966 LOBYTE(result) = 0;
12967 }
12968 return result;
12969 }
12970
12971 //----- (0045D643) --------------------------------------------------------
12972 double LightmapBuilder::_45D643_sw(Edge *a1, float a2)
12973 {
12974 double result; // st7@1
12975
12976 result = (a1->field_1C - a1->field_20) * -1.0 / (a1->field_30 - a1->field_2C) * (a2 - a1->field_2C) + a1->field_1C;
12977 if ( result < 0.0 || result <= 1.0 )
12978 {
12979 if ( result < 0.0 )
12980 result = 0.0;
12981 }
12982 else
12983 {
12984 result = 1.0;
12985 }
12986 return result;
12987 }
12988
12989
12990 /*
12991 // 143
12992 #pragma pack(push, 1)
12993 struct Span
12994 {
12995 Span *pNext;
12996 struct Polygon *pParent;
12997 __int16 field_8;
12998 __int16 field_A;
12999 __int16 field_C;
13000 __int16 field_E;
13001 float field_10;
13002 float field_14;
13003 };
13004 #pragma pack(pop)
13005
13006
13007
13008 // 144
13009 #pragma pack(push, 1)
13010 struct Surf
13011 {
13012 float field_0;
13013 float field_4;
13014 float field_8;
13015 float field_C;
13016 float field_10;
13017 Surf *pNext;
13018 Surf *pPrev;
13019 struct Polygon *pParent;
13020 __int16 field_20;
13021 __int16 field_22;
13022 };
13023 #pragma pack(pop)
13024 extern Surf stru_80C980;
13025
13026
13027
13028
13029 // 145
13030 #pragma pack(push, 1)
13031 struct Edge
13032 {
13033 float field_0;
13034 float field_4;
13035 int field_8;
13036 Surf *pSurf;
13037 Edge *pNext;
13038 Edge *pPrev;
13039 Edge *ptr_18;
13040 float field_1C;
13041 float field_20;
13042 float field_24;
13043 float field_28;
13044 float field_2C;
13045 float field_30;
13046 };
13047 #pragma pack(pop)
13048 extern Edge defaultEdge; // weak
13049
13050 extern Edge stru_80C9A4;
13051 extern Edge stru_80C9D8;
13052 */
13053
13054
12769 13055
12770 13056
12771 13057
12772 const wchar_t *UIMessage2String(UIMessageType msg) 13058 const wchar_t *UIMessage2String(UIMessageType msg)
12773 { 13059 {