Mercurial > mm7
comparison Render.cpp @ 67:3b4f8bd48e3b
25.01.13 (I did sky)
author | Ritor1 |
---|---|
date | Fri, 25 Jan 2013 16:48:21 +0600 |
parents | 31feb3432bbd |
children | 6ef241d53522 |
comparison
equal
deleted
inserted
replaced
66:653fdf29c654 | 67:3b4f8bd48e3b |
---|---|
30 | 30 |
31 | 31 |
32 | 32 |
33 struct IDirectDrawClipper *pDDrawClipper; | 33 struct IDirectDrawClipper *pDDrawClipper; |
34 struct Render *pRenderer; // idb | 34 struct Render *pRenderer; // idb |
35 | 35 struct RenderVertexD3D3 pVertices[50]; |
36 | |
37 int uNumDecorationsDrawnThisFrame; // weak | 36 int uNumDecorationsDrawnThisFrame; // weak |
38 RenderBillboard pBillboardRenderList[500]; | 37 RenderBillboard pBillboardRenderList[500]; |
39 unsigned int uNumBillboardsToDraw; | 38 unsigned int uNumBillboardsToDraw; |
40 int uNumSpritesDrawnThisFrame; // weak | 39 int uNumSpritesDrawnThisFrame; // weak |
41 | 40 |
923 int v11; // ebx@9 | 922 int v11; // ebx@9 |
924 int v12; // edi@9 | 923 int v12; // edi@9 |
925 int v13; // eax@21 | 924 int v13; // eax@21 |
926 int v14; // eax@31 | 925 int v14; // eax@31 |
927 int v15; // edi@33 | 926 int v15; // edi@33 |
928 float v16; // eax@34 | 927 int v16; // eax@34 |
929 int v17; // edx@34 | 928 int v17; // edx@34 |
930 int v18; // ebx@34 | 929 int v18; // ebx@34 |
931 int v19; // eax@36 | 930 int v19; // eax@36 |
932 int v20; // eax@39 | 931 int v20; // eax@39 |
933 int v21; // ecx@43 | 932 int v21; // ecx@43 |
934 char v22; // zf@44 | 933 char v22; // zf@44 |
935 int v23; // ecx@47 | 934 int v23; // ecx@47 |
936 int v24; // edi@52 | 935 int v24; // edi@52 |
937 float v25; // eax@54 | 936 int v25; // eax@54 |
938 int v26; // ecx@54 | 937 int v26; // ecx@54 |
939 int v27; // eax@56 | 938 int v27; // eax@56 |
940 int v28; // edx@60 | 939 int v28; // edx@60 |
941 int v29; // ecx@61 | 940 int v29; // ecx@61 |
942 int v30; // ecx@64 | 941 int v30; // ecx@64 |
945 int v33; // ecx@71 | 944 int v33; // ecx@71 |
946 int v34; // eax@73 | 945 int v34; // eax@73 |
947 int v35; // ecx@77 | 946 int v35; // ecx@77 |
948 int v36; // ecx@81 | 947 int v36; // ecx@81 |
949 int v37; // ecx@86 | 948 int v37; // ecx@86 |
950 float v38; // eax@88 | 949 int v38; // eax@88 |
951 IndoorCameraD3D *v39; // ecx@88 | 950 int v39; // ecx@88 |
952 int v40; // eax@90 | 951 int v40; // eax@90 |
953 int v41; // edx@94 | 952 int v41; // edx@94 |
954 int v42; // ecx@95 | 953 int v42; // ecx@95 |
955 int v43; // ecx@98 | 954 int v43; // ecx@98 |
956 int v44; // ecx@102 | 955 int v44; // ecx@102 |
957 int v45; // eax@104 | 956 int v45; // eax@104 |
958 int v46; // eax@107 | 957 int v46; // eax@107 |
959 int v47; // ecx@111 | 958 int v47; // ecx@111 |
960 int v48; // ecx@115 | 959 int v48; // ecx@115 |
961 int v49; // edi@120 | 960 int v49; // edi@120 |
962 float v50; // eax@122 | 961 int v50; // eax@122 |
963 int v51; // ecx@122 | 962 int v51; // ecx@122 |
964 int v52; // eax@124 | 963 int v52; // eax@124 |
965 int v53; // edx@128 | 964 int v53; // edx@128 |
966 int v54; // ecx@129 | 965 int v54; // ecx@129 |
967 int v55; // ecx@132 | 966 int v55; // ecx@132 |
970 int v58; // eax@142 | 969 int v58; // eax@142 |
971 int v59; // ecx@146 | 970 int v59; // ecx@146 |
972 int v60; // ecx@147 | 971 int v60; // ecx@147 |
973 int v61; // ecx@150 | 972 int v61; // ecx@150 |
974 int v62; // ecx@155 | 973 int v62; // ecx@155 |
975 float v63; // eax@157 | 974 int v63; // eax@157 |
976 IndoorCameraD3D *v64; // ecx@157 | 975 int v64; // ecx@157 |
977 int v65; // eax@159 | 976 int v65; // eax@159 |
978 int v66; // edx@163 | 977 int v66; // edx@163 |
979 int v67; // ecx@164 | 978 int v67; // ecx@164 |
980 int v68; // ecx@167 | 979 int v68; // ecx@167 |
981 int v69; // eax@173 | 980 int v69; // eax@173 |
983 int v71; // eax@178 | 982 int v71; // eax@178 |
984 int v72; // ecx@178 | 983 int v72; // ecx@178 |
985 int v73; // ebx@180 | 984 int v73; // ebx@180 |
986 int v74; // eax@182 | 985 int v74; // eax@182 |
987 int v75; // eax@184 | 986 int v75; // eax@184 |
988 IndoorCameraD3D *v76; // ecx@184 | 987 IndoorCameraD3D *pIndoorCameraD3D_3; // ecx@184 |
989 int v77; // ecx@184 | 988 int v77; // ecx@184 |
990 int v79; // ebx@185 | 989 int v79; // ebx@185 |
991 int v127; // esi@185 | 990 int v127; // esi@185 |
992 int v86; // edi@196 | 991 int v86; // edi@196 |
993 int v87; // eax@196 | 992 int v87; // eax@196 |
996 int v90; // ecx@200 | 995 int v90; // ecx@200 |
997 int v92; // ebx@203 | 996 int v92; // ebx@203 |
998 int v93; // ST08_4@204 | 997 int v93; // ST08_4@204 |
999 int v97; // ST08_4@204 | 998 int v97; // ST08_4@204 |
1000 float result; // eax@212 | 999 float result; // eax@212 |
1001 char v102; // [sp+Ch] [bp-68h]@191 | 1000 struct |
1001 { | |
1002 char v102[4]; // [sp+Ch] [bp-68h]@191 | |
1002 __int16 v103; // [sp+10h] [bp-64h]@190 | 1003 __int16 v103; // [sp+10h] [bp-64h]@190 |
1003 __int16 v104; // [sp+12h] [bp-62h]@190 | 1004 __int16 v104; // [sp+12h] [bp-62h]@190 |
1005 } v102; | |
1004 int pHeight; // [sp+1Ch] [bp-58h]@1 | 1006 int pHeight; // [sp+1Ch] [bp-58h]@1 |
1005 int v106; // [sp+20h] [bp-54h]@3 | 1007 int v106; // [sp+20h] [bp-54h]@3 |
1006 int v107; // [sp+24h] [bp-50h]@3 | 1008 int v107; // [sp+24h] [bp-50h]@3 |
1007 int v108; // [sp+28h] [bp-4Ch]@9 | 1009 int v108; // [sp+28h] [bp-4Ch]@9 |
1008 int v109; // [sp+2Ch] [bp-48h]@9 | 1010 int v109; // [sp+2Ch] [bp-48h]@9 |
1009 int v110; // [sp+30h] [bp-44h]@9 | 1011 int v110; // [sp+30h] [bp-44h]@9 |
1010 int v111; // [sp+34h] [bp-40h]@3 | 1012 int v111; // [sp+34h] [bp-40h]@3 |
1011 int v112; // [sp+38h] [bp-3Ch]@6 | 1013 int v112; // [sp+38h] [bp-3Ch]@6 |
1012 IndoorCameraD3D *a1; // [sp+3Ch] [bp-38h]@9 | 1014 IndoorCameraD3D *pIndoorCameraD3D_4; // [sp+3Ch] [bp-38h]@9 |
1013 int v114; // [sp+40h] [bp-34h]@9 | 1015 int v114; // [sp+40h] [bp-34h]@9 |
1014 int v115; // [sp+44h] [bp-30h]@9 | 1016 int v115; // [sp+44h] [bp-30h]@9 |
1015 int v116; // [sp+48h] [bp-2Ch]@9 | 1017 int v116; // [sp+48h] [bp-2Ch]@9 |
1016 int v117; // [sp+4Ch] [bp-28h]@9 | 1018 int v117; // [sp+4Ch] [bp-28h]@9 |
1017 int v118; // [sp+50h] [bp-24h]@9 | 1019 int v118; // [sp+50h] [bp-24h]@9 |
1018 int v119; // [sp+54h] [bp-20h]@1 | 1020 int v119; // [sp+54h] [bp-20h]@1 |
1019 int v120; // [sp+58h] [bp-1Ch]@1 | 1021 int v120; // [sp+58h] [bp-1Ch]@1 |
1020 int i; // [sp+5Ch] [bp-18h]@1 | 1022 int i; // [sp+5Ch] [bp-18h]@1 |
1021 int v122; // [sp+60h] [bp-14h]@1 | 1023 int v122; // [sp+60h] [bp-14h]@1 |
1022 int v123; // [sp+64h] [bp-10h]@1 | 1024 int v123; // [sp+64h] [bp-10h]@1 |
1023 float v124; // [sp+68h] [bp-Ch]@1 | 1025 int v124; // [sp+68h] [bp-Ch]@1 |
1024 int v125; // [sp+6Ch] [bp-8h]@9 | 1026 int v125; // [sp+6Ch] [bp-8h]@9 |
1025 float v126; // [sp+70h] [bp-4h]@9 | 1027 int v126; // [sp+70h] [bp-4h]@9 |
1026 | 1028 |
1027 memset(&v102, 0, sizeof(v102)); | |
1028 pHeight = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2); | 1029 pHeight = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2); |
1029 v0 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY); | 1030 v0 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY); |
1030 v1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + v0); | 1031 v1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + v0); |
1031 LODWORD(v124) = (signed int)((pIndoorCamera->uMapGridCellX << 16) | 1032 v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->SinCos( |
1032 + 3 | |
1033 * stru_5C6E00->SinCos( | |
1034 stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + v0))) >> 16; | 1033 stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + v0))) >> 16; |
1035 v123 = (signed int)((pIndoorCamera->uMapGridCellZ << 16) | 1034 v123 = ((pIndoorCamera->uMapGridCellZ << 16) |
1036 + 3 * stru_5C6E00->SinCos(v1 - stru_5C6E00->uIntegerHalfPi)) >> 16; | 1035 + 3 * stru_5C6E00->SinCos(v1 - stru_5C6E00->uIntegerHalfPi)) >> 16; |
1037 v120 = pOutdoorCamera->outdoor_grid_band_3 + LODWORD(v124); | 1036 v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X |
1038 v119 = pOutdoorCamera->outdoor_grid_band_3 + v123; | 1037 v119 = pOutdoorCamera->outdoor_grid_band_3 + v123; |
1039 v2 = pOutdoorCamera->uCameraFovInDegrees + 15; | 1038 v2 = pOutdoorCamera->uCameraFovInDegrees + 15; |
1040 i = LODWORD(v124) - pOutdoorCamera->outdoor_grid_band_3; | 1039 i = v124 - pOutdoorCamera->outdoor_grid_band_3; |
1041 v122 = v123 - pOutdoorCamera->outdoor_grid_band_3; | 1040 v122 = v123 - pOutdoorCamera->outdoor_grid_band_3; |
1042 if ( (signed int)(pOutdoorCamera->uCameraFovInDegrees + 15) > 90 ) | 1041 |
1042 if ( v2 > 90 ) | |
1043 v2 = 90; | 1043 v2 = 90; |
1044 v3 = (signed int)(v2 << 11) / 720; | 1044 v3 = (v2 << 11) / 720; |
1045 v4 = stru_5C6E00->uDoublePiMask & (v0 - v3); | 1045 v4 = stru_5C6E00->uDoublePiMask & (v0 - v3); |
1046 v5 = stru_5C6E00->uDoublePiMask & (v3 + v0); | 1046 v5 = stru_5C6E00->uDoublePiMask & (v3 + v0); |
1047 v106 = stru_5C6E00->SinCos(v4); | 1047 v106 = stru_5C6E00->SinCos(v4); |
1048 v107 = stru_5C6E00->SinCos(v4 - stru_5C6E00->uIntegerHalfPi); | 1048 v107 = stru_5C6E00->SinCos(v4 - stru_5C6E00->uIntegerHalfPi); |
1049 v111 = stru_5C6E00->SinCos(v5); | 1049 v111 = stru_5C6E00->SinCos(v5); |
1050 v6 = stru_5C6E00->SinCos(v5 - stru_5C6E00->uIntegerHalfPi); | 1050 v6 = stru_5C6E00->SinCos(v5 - stru_5C6E00->uIntegerHalfPi); |
1051 v7 = v4 & stru_5C6E00->uPiMask; | 1051 v7 = v4 & stru_5C6E00->uPiMask; |
1052 if ( (signed int)(v4 & stru_5C6E00->uPiMask) >= (signed int)stru_5C6E00->uIntegerHalfPi ) | 1052 |
1053 if ( (v4 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) | |
1053 v8 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v7]; | 1054 v8 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v7]; |
1054 else | 1055 else |
1055 v8 = stru_5C6E00->pTanTable[v7]; | 1056 v8 = stru_5C6E00->pTanTable[v7]; |
1056 v112 = abs(v8); | 1057 v112 = abs(v8); |
1057 v9 = v5 & stru_5C6E00->uPiMask; | 1058 v9 = v5 & stru_5C6E00->uPiMask; |
1058 if ( (signed int)(v5 & stru_5C6E00->uPiMask) >= (signed int)stru_5C6E00->uIntegerHalfPi ) | 1059 if ( (v5 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) |
1059 v10 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v9]; | 1060 v10 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v9]; |
1060 else | 1061 else |
1061 v10 = stru_5C6E00->pTanTable[v9]; | 1062 v10 = stru_5C6E00->pTanTable[v9]; |
1062 v108 = abs(v10); | 1063 v108 = abs(v10); |
1063 v11 = LODWORD(v124); | 1064 v11 = v124; |
1064 v12 = v123; | 1065 v12 = v123; |
1065 v114 = 0; | 1066 v114 = 0; |
1066 v115 = 0; | 1067 v115 = 0; |
1067 a1 = 0; | 1068 pIndoorCameraD3D_4 = 0; |
1068 v125 = 0; | 1069 v125 = 0; |
1069 v110 = 2 * (v106 >= 0) - 1; | 1070 v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1; |
1070 v126 = v124; | 1071 v126 = v124; |
1071 v118 = v123; | 1072 v118 = v123; |
1072 v109 = 2 * (v107 >= 0) - 1; | 1073 v109 = (v107 >= 0 ? 1: -1);//2 * (v107 >= 0) - 1; |
1073 v107 = 2 * (v111 >= 0) - 1; | 1074 v107 = (v111 >= 0 ? 1: -1);//2 * (v111 >= 0) - 1; |
1074 terrain_76E1C8[0] = 65535; | 1075 terrain_76E1C8[0] = 65535; |
1075 v116 = 1; | 1076 //v116 = 1; |
1076 v106 = 2 * (v6 >= 0) - 1; | 1077 v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1; |
1077 v117 = 1; | 1078 //v117 = 1; |
1078 terrain_76E3C8[0] = 65535; | 1079 terrain_76E3C8[0] = 65535; |
1079 terrain_76DDC8[0] = 65535; | 1080 terrain_76DDC8[0] = 65535; |
1080 terrain_76DFC8[0] = 65535; | 1081 terrain_76DFC8[0] = 65535; |
1081 while ( 1 ) | 1082 for( v116=1; v116 < 128; v116++) |
1082 { | 1083 { |
1083 if ( v112 >= 65536 ) | 1084 if ( v112 >= 0x10000 ) |
1084 { | 1085 { |
1085 v111 = 4294967296i64 / v112; | 1086 int v1, v2; |
1087 /*v111 = 4294967296i64 / v112; | |
1086 v114 += v111; | 1088 v114 += v111; |
1087 if ( v114 >= 65536 ) | 1089 if ( v114 >= 65536 ) |
1088 { | 1090 { |
1089 v11 += v110; | 1091 v11 += v110; |
1090 v114 = (unsigned __int16)v114; | 1092 v114 = (unsigned __int16)v114; |
1091 } | 1093 } |
1092 v12 += v109; | 1094 v12 += v109;*/ |
1093 } | 1095 } |
1094 else | 1096 else |
1095 { | 1097 { |
1096 v11 += v110; | 1098 v11 += v110; |
1097 v115 += v112; | 1099 v115 += v112; |
1098 if ( v115 >= 65536 ) | 1100 if ( v112 + v115 >= 65536 ) |
1099 { | 1101 { |
1100 v12 += v109; | 1102 v12 += v109; |
1101 v115 = (unsigned __int16)v115; | 1103 v115 = (unsigned __int16)v115; |
1102 } | 1104 } |
1103 } | 1105 } |
1104 if ( v116 > 128 || v11 < i || v11 > v120 || v12 < v122 || v12 > v119 ) | 1106 if ( v11 < i || v11 > v120 || v12 < v122 || v12 > v119 ) |
1105 break; | 1107 break; |
1106 v13 = v116++; | 1108 //v13 = v116++; |
1107 terrain_76E3C8[v13] = v11; | 1109 terrain_76E3C8[v116] = v11; |
1108 terrain_76E1C8[v13] = v12; | 1110 terrain_76E1C8[v116] = v12; |
1109 } | 1111 } |
1110 while ( 1 ) | 1112 |
1113 for( v117=1; v117 < 128; v117++ ) | |
1111 { | 1114 { |
1112 if ( v108 >= 65536 ) | 1115 if ( v108 >= 65536 ) |
1113 { | 1116 { |
1114 v111 = 4294967296i64 / v108; | 1117 v111 = 4294967296i64 / v108; |
1115 a1 = (IndoorCameraD3D *)((char *)a1 + v111); | 1118 v114 += v111;// |
1116 if ( (signed int)a1 >= 65536 ) | 1119 if ( v111 + v114 >= 65536 ) |
1117 { | 1120 { |
1118 LODWORD(v126) += v107; | 1121 v126 += v107; |
1119 a1 = (IndoorCameraD3D *)(unsigned __int16)a1; | 1122 v114 = (unsigned __int16)v114;// |
1120 } | 1123 } |
1121 v118 += v106; | 1124 v118 += v106; |
1122 } | 1125 } |
1123 else | 1126 else |
1124 { | 1127 { |
1125 v125 += v108; | 1128 v125 += v108; |
1126 LODWORD(v126) += v107; | 1129 v126 += v107; |
1127 if ( v125 >= 65536 ) | 1130 if ( v125 >= 65536 ) |
1128 { | 1131 { |
1129 v118 += v106; | 1132 v118 += v106; |
1130 v125 = (unsigned __int16)v125; | 1133 v125 = (unsigned __int16)v125; |
1131 } | 1134 } |
1132 } | 1135 } |
1133 if ( v117 >= 128 ) | 1136 //if ( v117 >= 128 ) |
1137 //break; | |
1138 if ( v126 < i ) | |
1134 break; | 1139 break; |
1135 if ( SLODWORD(v126) < i ) | 1140 if ( v126 > v120 ) |
1136 break; | |
1137 if ( SLODWORD(v126) > v120 ) | |
1138 break; | 1141 break; |
1139 v14 = v118; | 1142 v14 = v118; |
1140 if ( v118 < v122 ) | 1143 if ( v118 < v122 ) |
1141 break; | 1144 break; |
1142 if ( v118 > v119 ) | 1145 if ( v118 > v119 ) |
1143 break; | 1146 break; |
1144 v15 = v117++; | 1147 terrain_76DFC8[v117] = v126; |
1145 terrain_76DFC8[v15] = LODWORD(v126); | 1148 terrain_76DDC8[v117] = v14; |
1146 terrain_76DDC8[v15] = v14; | 1149 } |
1147 } | 1150 v16 = 0; |
1148 LODWORD(v16) = 0; | 1151 v126 = 0; |
1149 LODWORD(v126) = 0; | |
1150 v17 = v117 - 1; | 1152 v17 = v117 - 1; |
1151 v18 = v116 - 1; | 1153 v18 = v116 - 1; |
1152 switch ( pHeight ) | 1154 switch ( pHeight ) |
1153 { | 1155 { |
1154 case 0: | 1156 case 0: |
1155 case 7: | 1157 case 7: |
1158 { | |
1156 v116 = terrain_76DFC8[v17]; | 1159 v116 = terrain_76DFC8[v17]; |
1157 if ( v120 > v116 ) | 1160 if ( v120 > v116 ) |
1158 { | 1161 { |
1159 v125 = v120; | 1162 v125 = v120; |
1160 memset32(terrain_76D9C8, v119 + 1, v120 - v116 + 1); | 1163 memset32(terrain_76D9C8, v119 + 1, 4 * (v120 - v116 + 1)); |
1161 v19 = v120; | 1164 v19 = v120; |
1162 do | 1165 do |
1163 terrain_76DBC8[LODWORD(v126)++] = v19--; | 1166 terrain_76DBC8[v126++] = v19--; |
1164 while ( v19 >= v116 ); | 1167 while ( v19 >= v116 ); |
1165 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 + 127] ) | 1168 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 + 127] ) |
1166 { | 1169 { |
1167 do | 1170 do |
1168 v20 = terrain_76DDC8[v17-- + 127]; | 1171 v20 = terrain_76DDC8[v17-- -1]; |
1169 while ( v20 == terrain_76DDC8[v17 + 127] ); | 1172 while ( v20 == terrain_76DDC8[v17 -1] ); |
1170 } | 1173 } |
1171 v16 = v126; | 1174 v16 = v126; |
1172 --v17; | 1175 --v17; |
1173 } | 1176 } |
1174 if ( v17 < 0 ) | 1177 if ( v17 < 0 ) |
1175 v17 = 0; | 1178 v17 = 0; |
1176 v21 = terrain_76DFC8[v17]; | 1179 v21 = terrain_76DFC8[v17]; |
1177 while ( 1 ) | 1180 while ( 1 ) |
1178 { | 1181 { |
1179 v125 = v21; | 1182 v125 = v21; |
1180 if ( v21 < SLODWORD(v124) ) | 1183 if ( v21 < v124 ) |
1181 break; | 1184 break; |
1182 terrain_76DBC8[LODWORD(v16)] = v21; | 1185 terrain_76DBC8[v16] = v21; |
1183 v22 = terrain_76DDC8[v17] == 65535; | 1186 v22 = terrain_76DDC8[v17] == 65535; |
1184 terrain_76D9C8[LODWORD(v16)] = terrain_76DDC8[v17] + 1; | 1187 terrain_76D9C8[v16] = terrain_76DDC8[v17] + 1; |
1185 if ( v22 ) | 1188 if ( v22 ) |
1186 { | 1189 { |
1187 terrain_76D9C8[LODWORD(v16)] = v123 + 1; | 1190 terrain_76D9C8[v16] = v123 + 1; |
1188 break; | 1191 break; |
1189 } | 1192 } |
1190 if ( !v17 ) | 1193 if ( !v17 ) |
1191 break; | 1194 break; |
1192 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 + 127] ) | 1195 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 - 1] ) |
1193 { | 1196 { |
1194 do | 1197 do |
1195 v23 = terrain_76DDC8[v17-- + 127]; | 1198 v23 = terrain_76DDC8[v17-- -1]; |
1196 while ( v23 == terrain_76DDC8[v17 + 127] ); | 1199 while ( v23 == terrain_76DDC8[v17 -1] ); |
1197 } | 1200 } |
1198 --v17; | 1201 --v17; |
1199 v21 = v125 - 1; | 1202 v21 = v125 - 1; |
1200 ++LODWORD(v16); | 1203 ++v16; |
1201 } | 1204 } |
1202 LODWORD(v16) = 0; | 1205 v16 = 0; |
1203 v24 = terrain_76E3C8[v18]; | 1206 v24 = terrain_76E3C8[v18]; |
1204 LODWORD(v126) = 0; | 1207 v126 = 0; |
1205 if ( v120 > v24 ) | 1208 if ( v120 > v24 ) |
1206 { | 1209 { |
1207 v125 = v120; | 1210 v125 = v120; |
1208 memset32(terrain_76D5C8, v122, v120 - v24 + 1); | 1211 memset32(terrain_76D5C8, v122, 4 * (v120 - v24 + 1)); |
1209 do | 1212 do |
1210 { | 1213 { |
1211 v25 = v126; | 1214 v25 = v126; |
1212 v26 = v125--; | 1215 v26 = v125--; |
1213 ++LODWORD(v126); | 1216 ++v126; |
1214 terrain_76D7C8[LODWORD(v25)] = v26; | 1217 terrain_76D7C8[v25] = v26; |
1215 } | 1218 } |
1216 while ( v125 >= terrain_76E3C8[v18] ); | 1219 while ( v125 >= terrain_76E3C8[v18] ); |
1217 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 + 127] ) | 1220 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 -1] ) |
1218 { | 1221 { |
1219 do | 1222 do |
1220 v27 = terrain_76E1C8[v18-- + 127]; | 1223 v27 = terrain_76E1C8[v18-- -1]; |
1221 while ( v27 == terrain_76E1C8[v18 + 127] ); | 1224 while ( v27 == terrain_76E1C8[v18 -1] ); |
1222 } | 1225 } |
1223 v16 = v126; | 1226 v16 = v126; |
1224 --v18; | 1227 --v18; |
1225 } | 1228 } |
1226 if ( v18 < 0 ) | 1229 if ( v18 < 0 ) |
1227 v18 = 0; | 1230 v18 = 0; |
1228 v28 = terrain_76E3C8[v18]; | 1231 v28 = terrain_76E3C8[v18]; |
1229 while ( v28 >= SLODWORD(v124) ) | 1232 while ( v28 >= v124 ) |
1230 { | 1233 { |
1231 v29 = terrain_76E1C8[v18]; | 1234 v29 = terrain_76E1C8[v18]; |
1232 terrain_76D7C8[LODWORD(v16)] = v28; | 1235 terrain_76D7C8[v16] = v28; |
1233 terrain_76D5C8[LODWORD(v16)] = v29; | 1236 terrain_76D5C8[v16] = v29; |
1234 if ( v29 == 65535 ) | 1237 if ( v29 == 65535 ) |
1235 { | 1238 { |
1236 v31 = v123; | 1239 v31 = v123; |
1237 goto LABEL_172; | 1240 terrain_76D5C8[v16] = v31; |
1241 break; | |
1238 } | 1242 } |
1239 if ( !v18 ) | 1243 if ( !v18 ) |
1240 break; | 1244 break; |
1241 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 + 127] ) | 1245 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 -1] ) |
1242 { | 1246 { |
1243 do | 1247 do |
1244 v30 = terrain_76E1C8[v18-- + 127]; | 1248 v30 = terrain_76E1C8[v18-- -1]; |
1245 while ( v30 == terrain_76E1C8[v18 + 127] ); | 1249 while ( v30 == terrain_76E1C8[v18 -1] ); |
1246 } | 1250 } |
1247 --v18; | 1251 --v18; |
1248 --v28; | 1252 --v28; |
1249 ++LODWORD(v16); | 1253 ++v16; |
1250 } | 1254 } |
1251 break; | 1255 break; |
1256 } | |
1252 case 1: | 1257 case 1: |
1253 case 2: | 1258 case 2: |
1259 { | |
1254 v116 = terrain_76DDC8[v17]; | 1260 v116 = terrain_76DDC8[v17]; |
1255 if ( v122 < v116 ) | 1261 if ( v122 < v116 ) |
1256 { | 1262 { |
1257 v106 = v122; | 1263 v106 = v122; |
1258 memset32(terrain_76DBC8, v120 + 1, v116 - v122 + 1); | 1264 memset32(terrain_76DBC8, v120 + 1, 4 * (v116 - v122 + 1)); |
1259 v32 = v122; | 1265 v32 = v122; |
1260 do | 1266 do |
1261 { | 1267 { |
1262 v33 = LODWORD(v126)++; | 1268 v33 = v126++; |
1263 terrain_76D9C8[v33] = v32++; | 1269 terrain_76D9C8[v33] = v32++; |
1264 } | 1270 } |
1265 while ( v32 <= v116 ); | 1271 while ( v32 <= v116 ); |
1266 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 + 127] ) | 1272 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) |
1267 { | 1273 { |
1268 do | 1274 do |
1269 v34 = terrain_76DBC8[v17-- + 127]; | 1275 v34 = terrain_76DBC8[v17-- -1]; |
1270 while ( v34 == terrain_76DBC8[v17 + 127] ); | 1276 while ( v34 == terrain_76DBC8[v17 -1] ); |
1271 } | 1277 } |
1272 v16 = v126; | 1278 v16 = v126; |
1273 --v17; | 1279 --v17; |
1274 } | 1280 } |
1275 if ( v17 < 0 ) | 1281 if ( v17 < 0 ) |
1277 v35 = terrain_76DDC8[v17]; | 1283 v35 = terrain_76DDC8[v17]; |
1278 v125 = terrain_76DDC8[v17]; | 1284 v125 = terrain_76DDC8[v17]; |
1279 while ( v35 <= v123 ) | 1285 while ( v35 <= v123 ) |
1280 { | 1286 { |
1281 v22 = terrain_76DFC8[v17] == 65535; | 1287 v22 = terrain_76DFC8[v17] == 65535; |
1282 terrain_76DBC8[LODWORD(v16)] = terrain_76DFC8[v17] + 1; | 1288 terrain_76DBC8[v16] = terrain_76DFC8[v17] + 1; |
1283 terrain_76D9C8[LODWORD(v16)] = v125; | 1289 terrain_76D9C8[v16] = v125; |
1284 if ( v22 ) | 1290 if ( v22 ) |
1285 { | 1291 { |
1286 terrain_76DBC8[LODWORD(v16)] = LODWORD(v124) + 1; | 1292 terrain_76DBC8[v16] = v124 + 1; |
1287 break; | 1293 break; |
1288 } | 1294 } |
1289 if ( !v17 ) | 1295 if ( !v17 ) |
1290 break; | 1296 break; |
1291 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 + 127] ) | 1297 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) |
1292 { | 1298 { |
1293 do | 1299 do |
1294 v36 = terrain_76DBC8[v17-- + 127]; | 1300 v36 = terrain_76DBC8[v17-- -1]; |
1295 while ( v36 == terrain_76DBC8[v17 + 127] ); | 1301 while ( v36 == terrain_76DBC8[v17 -1] ); |
1296 } | 1302 } |
1297 --v17; | 1303 --v17; |
1298 ++v125; | 1304 ++v125; |
1299 v35 = v125; | 1305 v35 = v125; |
1300 ++LODWORD(v16); | 1306 ++v16; |
1301 } | 1307 } |
1302 LODWORD(v16) = 0; | 1308 v16 = 0; |
1303 LODWORD(v126) = 0; | 1309 v126 = 0; |
1304 v37 = terrain_76E1C8[v18]; | 1310 v37 = terrain_76E1C8[v18]; |
1305 if ( v122 < v37 ) | 1311 if ( v122 < v37 ) |
1306 { | 1312 { |
1307 a1 = (IndoorCameraD3D *)v122; | 1313 v114 = v122; |
1308 memset32(terrain_76D7C8, i, v37 - v122 + 1); | 1314 memset32(terrain_76D7C8, i, 4 * (v37 - v122 + 1)); |
1309 do | 1315 do |
1310 { | 1316 { |
1311 v38 = v126; | 1317 v38 = v126; |
1312 v39 = a1; | 1318 v39 = v114; |
1313 ++LODWORD(v126); | 1319 ++v126; |
1314 a1 = (IndoorCameraD3D *)((char *)a1 + 1); | 1320 ++v114; |
1315 terrain_76D5C8[LODWORD(v38)] = (int)v39; | 1321 terrain_76D5C8[v38] = v39; |
1316 } | 1322 } |
1317 while ( (signed int)a1 <= terrain_76E1C8[v18] ); | 1323 while ( v114 <= terrain_76E1C8[v18] ); |
1318 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 + 127] ) | 1324 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 -1] ) |
1319 { | 1325 { |
1320 do | 1326 do |
1321 v40 = terrain_76DFC8[v18-- + 127]; | 1327 v40 = terrain_76DFC8[v18-- -1]; |
1322 while ( v40 == terrain_76DFC8[v18 + 127] ); | 1328 while ( v40 == terrain_76DFC8[v18 -1] ); |
1323 } | 1329 } |
1324 v16 = v126; | 1330 v16 = v126; |
1325 --v18; | 1331 --v18; |
1326 } | 1332 } |
1327 if ( v18 < 0 ) | 1333 if ( v18 < 0 ) |
1328 v18 = 0; | 1334 v18 = 0; |
1329 v41 = terrain_76E1C8[v18]; | 1335 v41 = terrain_76E1C8[v18]; |
1330 while ( v41 <= v123 ) | 1336 while ( v41 <= v123 ) |
1331 { | 1337 { |
1332 v42 = terrain_76E3C8[v18]; | 1338 v42 = terrain_76E3C8[v18]; |
1333 terrain_76D5C8[LODWORD(v16)] = v41; | 1339 terrain_76D5C8[v16] = v41; |
1334 terrain_76D7C8[LODWORD(v16)] = v42; | 1340 terrain_76D7C8[v16] = v42; |
1335 if ( v42 == 65535 ) | 1341 if ( v42 == 65535 ) |
1336 { | 1342 { |
1337 v44 = LODWORD(v124); | 1343 terrain_76D7C8[v16] = v124; |
1338 goto LABEL_137; | 1344 break; |
1339 } | 1345 } |
1340 if ( !v18 ) | 1346 if ( !v18 ) |
1341 break; | 1347 break; |
1342 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 + 127] ) | 1348 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 -1] ) |
1343 { | 1349 { |
1344 do | 1350 do |
1345 v43 = terrain_76DFC8[v18-- + 127]; | 1351 v43 = terrain_76DFC8[v18-- -1]; |
1346 while ( v43 == terrain_76DFC8[v18 + 127] ); | 1352 while ( v43 == terrain_76DFC8[v18 -1] ); |
1347 } | 1353 } |
1348 --v18; | 1354 --v18; |
1349 ++v41; | 1355 ++v41; |
1350 ++LODWORD(v16); | 1356 ++v16; |
1351 } | 1357 } |
1352 break; | 1358 break; |
1359 } | |
1353 case 5: | 1360 case 5: |
1354 case 6: | 1361 case 6: |
1362 { | |
1355 v116 = terrain_76DDC8[v17]; | 1363 v116 = terrain_76DDC8[v17]; |
1356 if ( v119 > v116 ) | 1364 if ( v119 > v116 ) |
1357 { | 1365 { |
1358 v106 = v119; | 1366 v106 = v119; |
1359 memset32(terrain_76DBC8, i, v119 - v116 + 1); | 1367 memset32(terrain_76DBC8, i, 4 * (v119 - v116 + 1)); |
1360 v45 = v119; | 1368 v45 = v119; |
1361 do | 1369 do |
1362 terrain_76D9C8[LODWORD(v126)++] = v45--; | 1370 terrain_76D9C8[v126++] = v45--; |
1363 while ( v45 >= v116 ); | 1371 while ( v45 >= v116 ); |
1364 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 + 127] ) | 1372 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) |
1365 { | 1373 { |
1366 do | 1374 do |
1367 v46 = terrain_76DBC8[v17-- + 127]; | 1375 v46 = terrain_76DBC8[v17-- -1]; |
1368 while ( v46 == terrain_76DBC8[v17 + 127] ); | 1376 while ( v46 == terrain_76DBC8[v17 -1] ); |
1369 } | 1377 } |
1370 v16 = v126; | 1378 v16 = v126; |
1371 --v17; | 1379 --v17; |
1372 } | 1380 } |
1373 if ( v17 < 0 ) | 1381 if ( v17 < 0 ) |
1375 v47 = terrain_76DDC8[v17]; | 1383 v47 = terrain_76DDC8[v17]; |
1376 v125 = terrain_76DDC8[v17]; | 1384 v125 = terrain_76DDC8[v17]; |
1377 while ( v47 >= v123 ) | 1385 while ( v47 >= v123 ) |
1378 { | 1386 { |
1379 v22 = terrain_76DFC8[v17] == 65535; | 1387 v22 = terrain_76DFC8[v17] == 65535; |
1380 terrain_76DBC8[LODWORD(v16)] = terrain_76DFC8[v17]; | 1388 terrain_76DBC8[v16] = terrain_76DFC8[v17]; |
1381 terrain_76D9C8[LODWORD(v16)] = v125; | 1389 terrain_76D9C8[v16] = v125; |
1382 if ( v22 ) | 1390 if ( v22 ) |
1383 { | 1391 { |
1384 terrain_76DBC8[LODWORD(v16)] = LODWORD(v124); | 1392 terrain_76DBC8[v16] = v124; |
1385 break; | 1393 break; |
1386 } | 1394 } |
1387 if ( !v17 ) | 1395 if ( !v17 ) |
1388 break; | 1396 break; |
1389 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 + 127] ) | 1397 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) |
1390 { | 1398 { |
1391 do | 1399 do |
1392 v48 = terrain_76DBC8[v17-- + 127]; | 1400 v48 = terrain_76DBC8[v17-- -1]; |
1393 while ( v48 == terrain_76DBC8[v17 + 127] ); | 1401 while ( v48 == terrain_76DBC8[v17 -1] ); |
1394 } | 1402 } |
1395 --v17; | 1403 --v17; |
1396 --v125; | 1404 --v125; |
1397 v47 = v125; | 1405 v47 = v125; |
1398 ++LODWORD(v16); | 1406 ++v16; |
1399 } | 1407 } |
1400 LODWORD(v16) = 0; | 1408 v16 = 0; |
1401 v49 = terrain_76E1C8[v18]; | 1409 v49 = terrain_76E1C8[v18]; |
1402 LODWORD(v126) = 0; | 1410 v126 = 0; |
1403 if ( v119 > v49 ) | 1411 if ( v119 > v49 ) |
1404 { | 1412 { |
1405 v125 = v119; | 1413 v125 = v119; |
1406 memset32(terrain_76D7C8, v120 + 1, v119 - v49 + 1); | 1414 memset32(terrain_76D7C8, v120 + 1, 4 * (v119 - v49 + 1)); |
1407 do | 1415 do |
1408 { | 1416 { |
1409 v50 = v126; | 1417 v50 = v126; |
1410 v51 = v125--; | 1418 v51 = v125--; |
1411 ++LODWORD(v126); | 1419 ++v126; |
1412 terrain_76D5C8[LODWORD(v50)] = v51; | 1420 terrain_76D5C8[v50] = v51; |
1413 } | 1421 } |
1414 while ( v125 >= terrain_76E1C8[v18] ); | 1422 while ( v125 >= terrain_76E1C8[v18] ); |
1415 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 + 127] ) | 1423 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 -1] ) |
1416 { | 1424 { |
1417 do | 1425 do |
1418 v52 = terrain_76DFC8[v18-- + 127]; | 1426 v52 = terrain_76DFC8[v18-- -1]; |
1419 while ( v52 == terrain_76DFC8[v18 + 127] ); | 1427 while ( v52 == terrain_76DFC8[v18 -1] ); |
1420 } | 1428 } |
1421 v16 = v126; | 1429 v16 = v126; |
1422 --v18; | 1430 --v18; |
1423 } | 1431 } |
1424 if ( v18 < 0 ) | 1432 if ( v18 < 0 ) |
1425 v18 = 0; | 1433 v18 = 0; |
1426 v53 = terrain_76E1C8[v18]; | 1434 v53 = terrain_76E1C8[v18]; |
1427 while ( v53 >= v123 ) | 1435 while ( v53 >= v123 ) |
1428 { | 1436 { |
1429 v54 = terrain_76E3C8[v18]; | 1437 v54 = terrain_76E3C8[v18]; |
1430 terrain_76D5C8[LODWORD(v16)] = v53; | 1438 terrain_76D5C8[v16] = v53; |
1431 terrain_76D7C8[LODWORD(v16)] = v54 + 1; | 1439 terrain_76D7C8[v16] = v54 + 1; |
1432 if ( v54 == 65535 ) | 1440 if ( v54 == 65535 ) |
1433 { | 1441 { |
1434 v44 = LODWORD(v124) + 1; | 1442 terrain_76D7C8[v16] = v124 + 1; |
1435 LABEL_137: | 1443 break; |
1436 terrain_76D7C8[LODWORD(v16)] = v44; | |
1437 goto LABEL_173; | |
1438 } | 1444 } |
1439 if ( !v18 ) | 1445 if ( !v18 ) |
1440 goto LABEL_173; | 1446 break; |
1441 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 + 127] ) | 1447 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 -1] ) |
1442 { | 1448 { |
1443 do | 1449 do |
1444 v55 = terrain_76DFC8[v18-- + 127]; | 1450 v55 = terrain_76DFC8[v18-- -1]; |
1445 while ( v55 == terrain_76DFC8[v18 + 127] ); | 1451 while ( v55 == terrain_76DFC8[v18 -1] ); |
1446 } | 1452 } |
1447 --v18; | 1453 --v18; |
1448 --v53; | 1454 --v53; |
1449 ++LODWORD(v16); | 1455 ++v16; |
1450 } | 1456 } |
1451 break; | 1457 break; |
1458 } | |
1452 case 3: | 1459 case 3: |
1453 case 4: | 1460 case 4: |
1461 { | |
1454 v116 = terrain_76DFC8[v17]; | 1462 v116 = terrain_76DFC8[v17]; |
1455 if ( i < v116 ) | 1463 if ( i < v116 ) |
1456 { | 1464 { |
1457 v106 = i; | 1465 v106 = i; |
1458 memset32(terrain_76D9C8, v122, v116 - i + 1); | 1466 memset32(terrain_76D9C8, v122, 4 * (v116 - i + 1)); |
1459 v56 = i; | 1467 v56 = i; |
1460 do | 1468 do |
1461 { | 1469 { |
1462 v57 = LODWORD(v126)++; | 1470 v57 = v126++; |
1463 terrain_76DBC8[v57] = v56++; | 1471 terrain_76DBC8[v57] = v56++; |
1464 } | 1472 } |
1465 while ( v56 <= v116 ); | 1473 while ( v56 <= v116 ); |
1466 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 + 127] ) | 1474 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 -1] ) |
1467 { | 1475 { |
1468 do | 1476 do |
1469 v58 = terrain_76DDC8[v17-- + 127]; | 1477 v58 = terrain_76DDC8[v17-- -1]; |
1470 while ( v58 == terrain_76DDC8[v17 + 127] ); | 1478 while ( v58 == terrain_76DDC8[v17 -1] ); |
1471 } | 1479 } |
1472 v16 = v126; | 1480 v16 = v126; |
1473 --v17; | 1481 --v17; |
1474 } | 1482 } |
1475 if ( v17 < 0 ) | 1483 if ( v17 < 0 ) |
1476 v17 = 0; | 1484 v17 = 0; |
1477 v59 = terrain_76DFC8[v17]; | 1485 v59 = terrain_76DFC8[v17]; |
1478 while ( 1 ) | 1486 while ( 1 ) |
1479 { | 1487 { |
1480 v125 = v59; | 1488 v125 = v59; |
1481 if ( v59 > SLODWORD(v124) ) | 1489 if ( v59 > v124 ) |
1482 break; | 1490 break; |
1483 terrain_76DBC8[LODWORD(v16)] = v59; | 1491 terrain_76DBC8[v16] = v59; |
1484 v60 = terrain_76DDC8[v17]; | 1492 v60 = terrain_76DDC8[v17]; |
1485 terrain_76D9C8[LODWORD(v16)] = v60; | 1493 terrain_76D9C8[v16] = v60; |
1486 if ( v60 == 65535 ) | 1494 if ( v60 == 65535 ) |
1487 { | 1495 { |
1488 terrain_76D9C8[LODWORD(v16)] = v123; | 1496 terrain_76D9C8[v16] = v123; |
1489 break; | 1497 break; |
1490 } | 1498 } |
1491 if ( !v17 ) | 1499 if ( !v17 ) |
1492 break; | 1500 break; |
1493 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 + 127] ) | 1501 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 -1] ) |
1494 { | 1502 { |
1495 do | 1503 do |
1496 v61 = terrain_76DDC8[v17-- + 127]; | 1504 v61 = terrain_76DDC8[v17-- -1]; |
1497 while ( v61 == terrain_76DDC8[v17 + 127] ); | 1505 while ( v61 == terrain_76DDC8[v17 -1] ); |
1498 } | 1506 } |
1499 --v17; | 1507 --v17; |
1500 v59 = v125 + 1; | 1508 v59 = v125 + 1; |
1501 ++LODWORD(v16); | 1509 ++v16; |
1502 } | 1510 } |
1503 LODWORD(v16) = 0; | 1511 v16 = 0; |
1504 LODWORD(v126) = 0; | 1512 v126 = 0; |
1505 v62 = terrain_76E3C8[v18]; | 1513 v62 = terrain_76E3C8[v18]; |
1506 if ( i < v62 ) | 1514 if ( i < v62 ) |
1507 { | 1515 { |
1508 a1 = (IndoorCameraD3D *)i; | 1516 v114 = i; |
1509 memset32(terrain_76D5C8, v119 + 1, v62 - i + 1); | 1517 memset32(terrain_76D5C8, v119 + 1, 4 * (v62 - i + 1)); |
1510 do | 1518 do |
1511 { | 1519 { |
1512 v63 = v126; | 1520 v63 = v126; |
1513 v64 = a1; | 1521 v64 = v114; |
1514 ++LODWORD(v126); | 1522 ++v126; |
1515 a1 = (IndoorCameraD3D *)((char *)a1 + 1); | 1523 ++v114; |
1516 terrain_76D7C8[LODWORD(v63)] = (int)v64; | 1524 terrain_76D7C8[v63] = v64; |
1517 } | 1525 } |
1518 while ( (signed int)a1 <= terrain_76E3C8[v18] ); | 1526 while ( v114 <= terrain_76E3C8[v18] ); |
1519 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 + 127] ) | 1527 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 -1] ) |
1520 { | 1528 { |
1521 do | 1529 do |
1522 v65 = terrain_76E1C8[v18-- + 127]; | 1530 v65 = terrain_76E1C8[v18-- -1]; |
1523 while ( v65 == terrain_76E1C8[v18 + 127] ); | 1531 while ( v65 == terrain_76E1C8[v18 -1] ); |
1524 } | 1532 } |
1525 v16 = v126; | 1533 v16 = v126; |
1526 --v18; | 1534 --v18; |
1527 } | 1535 } |
1528 if ( v18 < 0 ) | 1536 if ( v18 < 0 ) |
1529 v18 = 0; | 1537 v18 = 0; |
1530 v66 = terrain_76E3C8[v18]; | 1538 v66 = terrain_76E3C8[v18]; |
1531 while ( v66 <= SLODWORD(v124) ) | 1539 while ( v66 <= v124 ) |
1532 { | 1540 { |
1533 v67 = terrain_76E1C8[v18]; | 1541 v67 = terrain_76E1C8[v18]; |
1534 terrain_76D7C8[LODWORD(v16)] = v66; | 1542 terrain_76D7C8[v16] = v66; |
1535 terrain_76D5C8[LODWORD(v16)] = v67 + 1; | 1543 terrain_76D5C8[v16] = v67 + 1; |
1536 if ( v67 == 65535 ) | 1544 if ( v67 == 65535 ) |
1537 { | 1545 { |
1538 v31 = v123 + 1; | 1546 v31 = v123 + 1; |
1539 LABEL_172: | 1547 terrain_76D5C8[v16] = v31; |
1540 terrain_76D5C8[LODWORD(v16)] = v31; | 1548 break; |
1541 goto LABEL_173; | |
1542 } | 1549 } |
1543 if ( !v18 ) | 1550 if ( !v18 ) |
1544 goto LABEL_173; | 1551 break; |
1545 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 + 127] ) | 1552 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 -1] ) |
1546 { | 1553 { |
1547 do | 1554 do |
1548 v68 = terrain_76E1C8[v18-- + 127]; | 1555 v68 = terrain_76E1C8[v18-- -1]; |
1549 while ( v68 == terrain_76E1C8[v18 + 127] ); | 1556 while ( v68 == terrain_76E1C8[v18 -1] ); |
1550 } | 1557 } |
1551 --v18; | 1558 --v18; |
1552 ++v66; | 1559 ++v66; |
1553 ++LODWORD(v16); | 1560 ++v16; |
1554 } | 1561 } |
1555 break; | 1562 break; |
1563 } | |
1556 default: | 1564 default: |
1557 break; | 1565 break; |
1558 } | 1566 } |
1559 LABEL_173: | 1567 v69 = v16 - 1; |
1560 v69 = LODWORD(v16) - 1; | |
1561 ptr_801A08 = pVerticesSR_806210; | 1568 ptr_801A08 = pVerticesSR_806210; |
1562 ptr_801A04 = pVerticesSR_801A10; | 1569 ptr_801A04 = pVerticesSR_801A10; |
1563 LODWORD(v126) = v69; | 1570 v126 = v69; |
1564 if ( pHeight && pHeight != 7 && pHeight != 3 && pHeight != 4 ) | 1571 if ( pHeight && pHeight != 7 && pHeight != 3 && pHeight != 4 ) |
1565 { | 1572 { |
1566 for ( i = v69; i >= 1; --i ) | 1573 for ( i = v69; i >= 1; --i ) |
1567 { | 1574 { |
1568 v70 = i; | 1575 //v70 = i; |
1569 v71 = terrain_76D7C8[i]; | 1576 v71 = terrain_76D7C8[i]; |
1570 v72 = terrain_76DBC8[i]; | 1577 v72 = terrain_76DBC8[i]; |
1571 if ( v71 < v72 ) | 1578 if ( v71 < v72 )//swap |
1572 { | 1579 { |
1573 terrain_76DBC8[v70] = v71; | 1580 terrain_76DBC8[i] = v71; |
1574 terrain_76D7C8[v70] = v72; | 1581 terrain_76D7C8[i] = v72; |
1575 } | 1582 } |
1576 v73 = terrain_76DBC8[v70]; | 1583 v73 = terrain_76DBC8[i]; |
1577 v111 = 0; | 1584 v111 = 0; |
1578 if ( v73 <= 0 ) | 1585 if ( v73 <= 0 ) |
1579 v73 = -v73; | 1586 v73 = -v73; |
1580 v74 = terrain_76D7C8[v70]; | 1587 v74 = terrain_76D7C8[i]; |
1581 if ( v74 <= 0 ) | 1588 if ( v74 <= 0 ) |
1582 v74 = -v74; | 1589 v74 = -v74; |
1583 v75 = v74 + 2; | 1590 v75 = v74 + 2; |
1584 v76 = pGame->pIndoorCameraD3D; | 1591 //pIndoorCameraD3D_3 = pGame->pIndoorCameraD3D; |
1585 v107 = v75; | 1592 v107 = v75; |
1586 a1 = v76; | 1593 //pIndoorCameraD3D_4 = pIndoorCameraD3D_3; |
1587 v77 = v73 - 2; | 1594 v77 = v73 - 2; |
1588 if ( v73 - 2 < v75 ) | 1595 if ( v73 - 2 < v75 ) |
1589 { | 1596 { |
1590 v127 = 0; | 1597 v127 = 0; |
1591 v79 = (v73 - 66) << 9; | 1598 //v79 = (v73 - 66) << 9; |
1592 v116 = v77; | 1599 //v116 = v77; |
1593 pHeight = v79; | 1600 //pHeight = v79; |
1594 v111 = v75 - v77; | 1601 v111 = v75 - v77; |
1595 do | 1602 for (int j = v77; j < v107; ++j) |
1596 {// âûñîòà ÷åòûðåõ âåðøèí ÿ÷åéêè | 1603 {// âûñîòà ÷åòûðåõ âåðøèí ÿ÷åéêè |
1597 *(float *)&v106 = (double)pHeight; | 1604 /* *(float *)&v106 = (double)pHeight; |
1598 *(float *)((char *)&ptr_801A08->vWorldPosition.x + v127) = *(float *)&v106;//x | 1605 *(float *)((char *)&ptr_801A08->vWorldPosition.x + v127) = *(float *)&v106;//x |
1599 pHeight = (64 - *(int *)((char *)terrain_76D9C8 + v70)) << 9; | 1606 pHeight = (64 - *(int *)((char *)terrain_76D9C8 + v70)) << 9; |
1600 *(float *)((char *)&ptr_801A08->vWorldPosition.y + v127) = (double)pHeight;//y | 1607 *(float *)((char *)&ptr_801A08->vWorldPosition.y + v127) = (double)pHeight;//y |
1601 pHeight = pOutdoor->GetHeightOnTerrain(v112, *(int *)((char *)terrain_76D9C8 + v70)); | 1608 pHeight = pOutdoor->GetHeightOnTerrain(v112, *(int *)((char *)terrain_76D9C8 + v70)); |
1602 *(float *)((char *)&ptr_801A08->vWorldPosition.z + v127) = (double)pHeight;//z | 1609 *(float *)((char *)&ptr_801A08->vWorldPosition.z + v127) = (double)pHeight;//z*/ |
1603 *(float *)((char *)&ptr_801A04->vWorldPosition.x + v127) = *(float *)&v106;//x | 1610 ptr_801A08[v127].vWorldPosition.x = (v73 - 66 + v127) * 512; |
1611 ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512; | |
1612 ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( j, terrain_76D9C8[i]); | |
1613 | |
1614 /* *(float *)((char *)&ptr_801A04->vWorldPosition.x + v127) = *(float *)&v106;//x | |
1604 pHeight = (63 - *(int *)((char *)terrain_76D9C8 + v70)) << 9; | 1615 pHeight = (63 - *(int *)((char *)terrain_76D9C8 + v70)) << 9; |
1605 *(float *)((char *)&ptr_801A04->vWorldPosition.y + v127) = (double)pHeight;//y | 1616 *(float *)((char *)&ptr_801A04->vWorldPosition.y + v127) = (double)pHeight;//y |
1606 pHeight = pOutdoor->GetHeightOnTerrain(v112, *(int *)((char *)terrain_76D9C8 + v70) + 1); | 1617 pHeight = pOutdoor->GetHeightOnTerrain(v112, *(int *)((char *)terrain_76D9C8 + v70) + 1); |
1607 *(float *)((char *)&ptr_801A04->vWorldPosition.z + v127) = (double)pHeight;//z | 1618 *(float *)((char *)&ptr_801A04->vWorldPosition.z + v127) = (double)pHeight;//z */ |
1619 ptr_801A04[v127].vWorldPosition.x = (v73 - 66 + v127) * 512; | |
1620 ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512; | |
1621 ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( j, terrain_76D9C8[i] + 1); | |
1622 | |
1608 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) | 1623 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) |
1609 { | 1624 { |
1610 a1->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v127, 1); | 1625 pIndoorCameraD3D_4->ViewTransform(&ptr_801A08[v127], 1); |
1611 a1->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v127, 1); | 1626 pIndoorCameraD3D_4->ViewTransform(&ptr_801A04[v127], 1); |
1612 a1->Project((RenderVertexSoft *)(char *)ptr_801A08 + v127, 1, 0); | 1627 pIndoorCameraD3D_4->Project(&ptr_801A08[v127], 1, 0); |
1613 a1->Project((RenderVertexSoft *)(char *)ptr_801A04 + v127, 1, 0); | 1628 pIndoorCameraD3D_4->Project(&ptr_801A04[v127], 1, 0); |
1614 } | 1629 } |
1615 v79 += 512; | 1630 //v79 += 512; |
1616 v127 += 48; | 1631 v127 ++; |
1617 ++v116; | 1632 //++v116; |
1618 pHeight = v79; | 1633 //pHeight = v79; |
1619 } | 1634 } |
1620 while ( v116 < v107 ); | 1635 //while ( v116 < v107 ); |
1621 } | 1636 } |
1622 v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v70]); | 1637 v102.v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]); |
1623 v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v70]); | 1638 v102.v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]); |
1624 //if ( pRenderer->pRenderD3D )//Ritor1: do comment to test | 1639 if ( pRenderer->pRenderD3D )//Ritor1: do comment to test |
1625 //Render::DrawTerrainD3D(v111, 0, (int)&v102); | 1640 Render::DrawTerrainD3D(v111, 1, (int)&v102); |
1626 //else | 1641 else |
1627 //Render::DrawTerrainSW(v111, 0, (int)&v102); | 1642 Render::DrawTerrainSW(v111, 0, (int)&v102); |
1628 } | 1643 } |
1629 } | 1644 } |
1630 else | 1645 /* else |
1631 { | 1646 { |
1632 for ( i = v69; i >= 1; --i ) | 1647 for ( i = v69; i >= 1; --i ) |
1633 { | 1648 { |
1634 v86 = i; | 1649 v86 = i; |
1635 v87 = terrain_76D5C8[i]; | 1650 v87 = terrain_76D5C8[i]; |
1644 if ( v89 <= 0 ) | 1659 if ( v89 <= 0 ) |
1645 v89 = -v89; | 1660 v89 = -v89; |
1646 v90 = terrain_76D5C8[v86]; | 1661 v90 = terrain_76D5C8[v86]; |
1647 if ( v90 <= 0 ) | 1662 if ( v90 <= 0 ) |
1648 v90 = -v90; | 1663 v90 = -v90; |
1649 a1 = pGame->pIndoorCameraD3D; | 1664 pIndoorCameraD3D_4 = pGame->pIndoorCameraD3D; |
1650 v107 = v90 + 2; | 1665 v107 = v90 + 2; |
1651 if ( v89 - 2 < v90 + 2 ) | 1666 if ( v89 - 2 < v90 + 2 ) |
1652 { | 1667 { |
1653 v86 = 0; | 1668 v86 = 0; |
1654 v116 = v89 - 2; | 1669 v116 = v89 - 2; |
1670 *(float *)((char *)&ptr_801A04->vWorldPosition.y + v86) = *(float *)&pHeight; | 1685 *(float *)((char *)&ptr_801A04->vWorldPosition.y + v86) = *(float *)&pHeight; |
1671 pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97); | 1686 pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97); |
1672 *(float *)((char *)&ptr_801A04->vWorldPosition.z + v86) = (double)pHeight; | 1687 *(float *)((char *)&ptr_801A04->vWorldPosition.z + v86) = (double)pHeight; |
1673 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) | 1688 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) |
1674 { | 1689 { |
1675 a1->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1); | 1690 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1); |
1676 a1->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1); | 1691 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1); |
1677 a1->Project((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1, 0); | 1692 pIndoorCameraD3D_4->Project((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1, 0); |
1678 a1->Project((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1, 0); | 1693 pIndoorCameraD3D_4->Project((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1, 0); |
1679 } | 1694 } |
1680 v92 -= 512; | 1695 v92 -= 512; |
1681 v86 += 48; | 1696 v86 += 48; |
1682 ++v116; | 1697 ++v116; |
1683 pHeight = v92; | 1698 pHeight = v92; |
1684 } | 1699 } |
1685 while ( v116 < v107 ); | 1700 while ( v116 < v107 ); |
1686 } | 1701 } |
1687 v103 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v86]); | 1702 v103 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v86]); |
1688 v104 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v86]); | 1703 v104 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v86]); |
1689 //if ( pRenderer->pRenderD3D ) | 1704 if ( pRenderer->pRenderD3D ) |
1690 //Render::DrawTerrainD3D(v111, 1, (int)&v102); | 1705 Render::DrawTerrainD3D(v111, 1, (int)&v102); |
1691 //else | 1706 else |
1692 //Render::DrawTerrainSW(v111, 1, (int)&v102); | 1707 Render::DrawTerrainSW(v111, 1, (int)&v102); |
1693 } | 1708 } |
1694 } | 1709 }*/ |
1695 result = v126; | 1710 result = v126; |
1696 pOutdoorCamera->field_40 = v126; | 1711 pOutdoorCamera->field_40 = v126; |
1697 return result; | 1712 return result; |
1698 } | 1713 } |
1699 // 47FFC4: inconsistent fpu stack | 1714 // 47FFC4: inconsistent fpu stack |
1700 // 4D864C: using guessed type char byte_4D864C; | 1715 // 4D864C: using guessed type char byte_4D864C; |
1701 | 1716 |
1702 | 1717 |
1703 | 1718 |
1704 //----- (0048034E) -------------------------------------------------------- | 1719 //----- (0048034E) -------------------------------------------------------- |
1705 void Render::DrawTerrainD3D(int a1, int edx0, int a3) | 1720 void Render::DrawTerrainD3D(int a1, int a2, int a3) |
1706 { | 1721 { |
1707 int v3; // esi@1 | 1722 int v3; // esi@1 |
1708 int v4; // edi@1 | 1723 int v4; // edi@1 |
1709 int v5; // ebx@2 | 1724 int v5; // ebx@2 |
1710 int v6; // eax@2 | 1725 int v6; // eax@2 |
1718 int v14; // eax@6 | 1733 int v14; // eax@6 |
1719 double v15; // st7@6 | 1734 double v15; // st7@6 |
1720 stru148 *v16; // ebx@12 | 1735 stru148 *v16; // ebx@12 |
1721 unsigned __int16 v17; // ax@12 | 1736 unsigned __int16 v17; // ax@12 |
1722 int v18; // eax@13 | 1737 int v18; // eax@13 |
1723 LightmapBuilder *v19; // ecx@13 | 1738 int v19; // ecx@13 |
1724 stru220 *v20; // eax@13 | 1739 int v20; // eax@13 |
1725 int v21; // eax@13 | 1740 int v21; // eax@13 |
1726 signed int v22; // eax@13 | 1741 signed int v22; // eax@13 |
1727 Vec3_float_ *v23; // eax@15 | 1742 Vec3_float_ *v23; // eax@15 |
1728 double v24; // st6@17 | 1743 double v24; // st6@17 |
1729 double v25; // ST54_8@17 | 1744 double v25; // ST54_8@17 |
1731 unsigned __int8 v27; // of@17 | 1746 unsigned __int8 v27; // of@17 |
1732 double v28; // st5@19 | 1747 double v28; // st5@19 |
1733 double v29; // st5@19 | 1748 double v29; // st5@19 |
1734 double v30; // st5@19 | 1749 double v30; // st5@19 |
1735 double v31; // st5@19 | 1750 double v31; // st5@19 |
1736 double v32; // st7@32 | 1751 struct struct8 *v32; // esi@21 |
1752 double v3a; // st7@32 | |
1737 int v33; // edi@38 | 1753 int v33; // edi@38 |
1738 unsigned int v34; // ecx@47 | 1754 unsigned int v34; // ecx@47 |
1739 char v35; // zf@47 | 1755 char v35; // zf@47 |
1740 unsigned int v36; // eax@50 | 1756 unsigned int v36; // eax@50 |
1741 int v37; // eax@54 | 1757 int v37; // eax@54 |
1743 unsigned int v39; // eax@59 | 1759 unsigned int v39; // eax@59 |
1744 stru148 *v40; // ebx@62 | 1760 stru148 *v40; // ebx@62 |
1745 unsigned __int16 v41; // ax@62 | 1761 unsigned __int16 v41; // ax@62 |
1746 int v42; // eax@63 | 1762 int v42; // eax@63 |
1747 LightmapBuilder *v43; // ecx@63 | 1763 LightmapBuilder *v43; // ecx@63 |
1748 stru220 *v44; // eax@63 | 1764 int v44; // eax@63 |
1749 int v45; // eax@63 | 1765 int v45; // eax@63 |
1750 int v46; // eax@63 | 1766 int v46; // eax@63 |
1751 signed int v47; // eax@63 | 1767 signed int v47; // eax@63 |
1752 Vec3_float_ *v48; // eax@65 | 1768 Vec3_float_ *v48; // eax@65 |
1753 double v49; // st6@67 | 1769 double v49; // st6@67 |
1760 unsigned int v56; // eax@101 | 1776 unsigned int v56; // eax@101 |
1761 int v57; // eax@105 | 1777 int v57; // eax@105 |
1762 unsigned int v58; // eax@109 | 1778 unsigned int v58; // eax@109 |
1763 stru148 *v59; // esi@112 | 1779 stru148 *v59; // esi@112 |
1764 unsigned __int16 v60; // ax@112 | 1780 unsigned __int16 v60; // ax@112 |
1765 stru220 *v61; // eax@113 | 1781 int v61; // eax@113 |
1766 signed int v62; // eax@113 | 1782 signed int v62; // eax@113 |
1767 Vec3_float_ *v63; // eax@114 | 1783 Vec3_float_ *v63; // eax@114 |
1768 double v64; // st6@116 | 1784 double v64; // st6@116 |
1769 double v65; // ST3C_8@116 | 1785 double v65; // ST3C_8@116 |
1770 double v66; // st5@120 | 1786 double v66; // st5@120 |
1773 double v69; // st7@133 | 1789 double v69; // st7@133 |
1774 int v70; // edi@138 | 1790 int v70; // edi@138 |
1775 RenderVertexSoft *v71; // esi@147 | 1791 RenderVertexSoft *v71; // esi@147 |
1776 unsigned int v72; // ecx@147 | 1792 unsigned int v72; // ecx@147 |
1777 unsigned int v73; // eax@150 | 1793 unsigned int v73; // eax@150 |
1778 float v74; // eax@154 | 1794 int v74; // eax@154 |
1779 unsigned int v75; // eax@158 | 1795 unsigned int v75; // eax@158 |
1780 unsigned int v76; // [sp-10h] [bp-E0h]@61 | 1796 unsigned int v76; // [sp-10h] [bp-E0h]@61 |
1781 stru148 *v77; // [sp-Ch] [bp-DCh]@61 | 1797 int v77; // [sp-Ch] [bp-DCh]@61 |
1782 IDirect3DTexture2 *v78; // [sp-8h] [bp-D8h]@61 | 1798 IDirect3DTexture2 *v78; // [sp-8h] [bp-D8h]@61 |
1783 int v79; // [sp-4h] [bp-D4h]@61 | 1799 int v79; // [sp-4h] [bp-D4h]@61 |
1784 int v80; // [sp+0h] [bp-D0h]@59 | 1800 int v80; // [sp+0h] [bp-D0h]@59 |
1785 int v81; // [sp+0h] [bp-D0h]@109 | 1801 int v81; // [sp+0h] [bp-D0h]@109 |
1786 int v82; // [sp+54h] [bp-7Ch]@1 | 1802 int v82; // [sp+54h] [bp-7Ch]@1 |
1792 int v88; // [sp+7Ch] [bp-54h]@1 | 1808 int v88; // [sp+7Ch] [bp-54h]@1 |
1793 int v89; // [sp+80h] [bp-50h]@6 | 1809 int v89; // [sp+80h] [bp-50h]@6 |
1794 float v90; // [sp+84h] [bp-4Ch]@1 | 1810 float v90; // [sp+84h] [bp-4Ch]@1 |
1795 float v91; // [sp+88h] [bp-48h]@1 | 1811 float v91; // [sp+88h] [bp-48h]@1 |
1796 float v92; // [sp+8Ch] [bp-44h]@1 | 1812 float v92; // [sp+8Ch] [bp-44h]@1 |
1797 stru220 *v93; // [sp+90h] [bp-40h]@2 | 1813 int v93; // [sp+90h] [bp-40h]@2 |
1798 int X; // [sp+94h] [bp-3Ch]@1 | 1814 int X; // [sp+94h] [bp-3Ch]@1 |
1799 float v95; // [sp+98h] [bp-38h]@21 | 1815 float v95; // [sp+98h] [bp-38h]@21 |
1800 LightmapBuilder *v96; // [sp+9Ch] [bp-34h]@73 | 1816 LightmapBuilder *v96; // [sp+9Ch] [bp-34h]@73 |
1801 LightmapBuilder *_this; // [sp+A0h] [bp-30h]@6 | 1817 int v97; // [sp+A0h] [bp-30h]@6 |
1802 int sX; // [sp+A4h] [bp-2Ch]@6 | 1818 int sX; // [sp+A4h] [bp-2Ch]@6 |
1803 unsigned int uNumVertices; // [sp+A8h] [bp-28h]@73 | 1819 unsigned int uNumVertices; // [sp+A8h] [bp-28h]@73 |
1804 int v100; // [sp+ACh] [bp-24h]@122 | 1820 int v100; // [sp+ACh] [bp-24h]@122 |
1805 int sY; // [sp+B0h] [bp-20h]@6 | 1821 int sY; // [sp+B0h] [bp-20h]@6 |
1806 RenderVertexSoft *a2; // [sp+B4h] [bp-1Ch]@3 | 1822 RenderVertexSoft *v102; // [sp+B4h] [bp-1Ch]@3 |
1807 unsigned int a5; // [sp+B8h] [bp-18h]@21 | 1823 unsigned int a5; // [sp+B8h] [bp-18h]@21 |
1808 RenderVertexSoft *v101; // [sp+BCh] [bp-14h]@6 | 1824 RenderVertexSoft *v101; // [sp+BCh] [bp-14h]@6 |
1809 Vec3_float_ *v99; // [sp+C0h] [bp-10h]@17 | 1825 Vec3_float_ *v99; // [sp+C0h] [bp-10h]@17 |
1810 RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6 | 1826 RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6 |
1811 RenderVertexSoft *a8; // [sp+C8h] [bp-8h]@6 | 1827 RenderVertexSoft *pVertices2; // [sp+C8h] [bp-8h]@6 |
1812 char v108; // [sp+CFh] [bp-1h]@36 | 1828 char v108; // [sp+CFh] [bp-1h]@36 |
1813 float thisd; // [sp+D8h] [bp+8h]@6 | 1829 float thisd; // [sp+D8h] [bp+8h]@6 |
1814 float thise; // [sp+D8h] [bp+8h]@6 | 1830 float thise; // [sp+D8h] [bp+8h]@6 |
1815 float thisf; // [sp+D8h] [bp+8h]@17 | 1831 float thisf; // [sp+D8h] [bp+8h]@17 |
1816 IndoorCameraD3D *thisa; // [sp+D8h] [bp+8h]@23 | 1832 IndoorCameraD3D *thisa; // [sp+D8h] [bp+8h]@23 |
1820 IndoorCameraD3D *thisc; // [sp+D8h] [bp+8h]@124 | 1836 IndoorCameraD3D *thisc; // [sp+D8h] [bp+8h]@124 |
1821 char this_3; // [sp+DBh] [bp+Bh]@30 | 1837 char this_3; // [sp+DBh] [bp+Bh]@30 |
1822 char this_3a; // [sp+DBh] [bp+Bh]@82 | 1838 char this_3a; // [sp+DBh] [bp+Bh]@82 |
1823 char this_3b; // [sp+DBh] [bp+Bh]@131 | 1839 char this_3b; // [sp+DBh] [bp+Bh]@131 |
1824 | 1840 |
1841 static stru154 static_sub_0048034E_stru_154; | |
1842 static stru154 stru_76D5A8; | |
1825 v3 = a1; | 1843 v3 = a1; |
1826 v82 = edx0; | 1844 v82 = a2; |
1827 v83 = *(/*short **/_WORD *)(a3 + 4); | 1845 v83 = *(/*short **/_WORD *)(a3 + 4); |
1828 X = abs(*(/*short **/_WORD *)(a3 + 6)); | 1846 X = abs(*(/*short **/_WORD *)(a3 + 6)); |
1829 v4 = 0; | 1847 v4 = 0; |
1830 v88 = 0; | 1848 v88 = 0; |
1831 v84 = v3 - 1; | 1849 v84 = v3 - 1; |
1832 v90 = (double)pOutdoor->vSunlight.x * 0.000015258789; | 1850 v90 = (float)pOutdoor->vSunlight.x / 65536,0; |
1833 v91 = (double)pOutdoor->vSunlight.y * 0.000015258789; | 1851 v91 = (float)pOutdoor->vSunlight.y / 65536.0; |
1834 v92 = (double)pOutdoor->vSunlight.z * 0.000015258789; | 1852 v92 = (float)pOutdoor->vSunlight.z / 65536.0; |
1835 if ( v3 - 1 > 0 ) | 1853 if ( v3 - 1 > 0 ) |
1836 { | 1854 { |
1837 while ( 1 ) | 1855 while ( 1 ) |
1838 { | 1856 { |
1839 v5 = abs(X);//v5 = 13108 | 1857 v5 = abs(X);//v5 = 13108 |
1840 v6 = abs(v83);//v6 = 13108 | 1858 v6 = abs(v83);//v6 = 13108 |
1841 --X; | 1859 --X; |
1842 v93 = &stru_76E5C8[(v5 << 7) + v6]; | 1860 v93 = (int)&stru_76E5C8[(v5 << 7) + v6]; |
1843 if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), | 1861 /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), |
1844 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), | 1862 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), |
1845 ((a8 = v9, | 1863 ((a8 = v9, |
1846 pVertices = &pVerticesSR_801A10[1] + v7, | 1864 pVertices = &pVerticesSR_801A10[1] + v7, |
1847 v11 = v8->vWorldPosition.x, | 1865 v11 = v8->vWorldPosition.x, |
1848 v101 = v10, | 1866 v101 = v10, |
1858 _this = (LightmapBuilder *)WorldPosToGridCellZ(floorf(thisd + 0.5f)),//maybe current camera position Z | 1876 _this = (LightmapBuilder *)WorldPosToGridCellZ(floorf(thisd + 0.5f)),//maybe current camera position Z |
1859 WorldPosToGridCellX(sX), | 1877 WorldPosToGridCellX(sX), |
1860 WorldPosToGridCellZ(sY), | 1878 WorldPosToGridCellZ(sY), |
1861 !byte_4D864C) | 1879 !byte_4D864C) |
1862 || !(pGame->uFlags & 0x80)) | 1880 || !(pGame->uFlags & 0x80)) |
1863 && !sub_481EFA(v8, v9, v101, pVertices, 1)) ) | 1881 && !sub_481EFA(v8, v9, v101, pVertices, 1)) )*/ |
1882 if ( !&stru_76E5C8[(v5 << 7) + v6] ) | |
1864 goto LABEL_162; | 1883 goto LABEL_162; |
1865 if ( v8->vWorldPosition.z != v9->vWorldPosition.z || v9->vWorldPosition.z != pVertices->vWorldPosition.z || pVertices->vWorldPosition.z != v101->vWorldPosition.z ) | 1884 |
1866 break; | 1885 v8 = &pVerticesSR_806210[v4]; |
1867 v16 = &array_77EC08[pOutdoorCamera->numStru148s]; | 1886 pVertices2 = &pVerticesSR_801A10[v4 + 1]; |
1868 v17 = pOutdoor->GetTileTexture(sX, sY); | 1887 v102 = v8; |
1869 v16->uTileBitmapID = v17; | 1888 if (!v82) |
1870 if ( v17 != -1 ) | 1889 { |
1871 { | 1890 pVertices = &pVerticesSR_801A10[v4]; |
1872 v18 = pOutdoor->GetSomeOtherTileInfo(sX, sY); | 1891 v101 = &pVerticesSR_806210[v4 + 1]; |
1873 LOWORD(v18) = v18 | 0x8010; | 1892 } |
1874 v19 = _this; | 1893 else |
1875 *(int *)&v16->flags = v18; | 1894 { |
1876 v20 = v93; | 1895 pVertices = &pVerticesSR_801A10[v4 + 1]; |
1877 v16->field_59 = 1; | 1896 v101 = &pVerticesSR_806210[v4]; |
1878 v16->field_5D = (char)v19; | 1897 } |
1879 v16->field_34 = v20->distance; | 1898 |
1880 v21 = v89; | 1899 sX = floorf(v8->vWorldPosition.x + 0.5f); |
1881 v16->field_5C = v89; | 1900 sY = floorf(v8->vWorldPosition.z + 0.5f); |
1882 v22 = pTerrainNormalIndices[2 * (signed int)((char *)v19 + 128 * v21) + 1]; | 1901 |
1883 if ( v22 < 0 || v22 > (signed int)(uNumTerrainNormals - 1) ) | 1902 v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f)); |
1903 v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f)); | |
1904 WorldPosToGridCellX(sX); | |
1905 WorldPosToGridCellZ(sY); | |
1906 | |
1907 if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !sub_481EFA(v8, pVertices, v101, pVertices2, 1)) | |
1908 if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y || pVertices2->vWorldPosition.y != v101->vWorldPosition.y ) | |
1909 break; | |
1910 v16 = &array_77EC08[pOutdoorCamera->numStru148s]; | |
1911 v16->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); | |
1912 if ( v16->uTileBitmapID != -1 ) | |
1913 { | |
1914 v19 = v97; | |
1915 v16->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(sX, sY); | |
1916 v16->field_32 = 0; | |
1917 v20 = v93; | |
1918 v16->field_59 = 1; | |
1919 v16->field_5D = (char)v19; | |
1920 v16->field_34 = *(_WORD *)(v20 + 2); | |
1921 v21 = v89; | |
1922 v16->field_5C = v89; | |
1923 v22 = pTerrainNormalIndices[2 * (v19 + 128 * v21) + 1]; | |
1924 if ( v22 < 0 || v22 > uNumTerrainNormals - 1 ) | |
1884 v23 = 0; | 1925 v23 = 0; |
1885 else | 1926 else |
1886 v23 = &pTerrainNormals[v22]; | 1927 v23 = &pTerrainNormals[v22]; |
1887 v24 = v92 * v23->z; | 1928 v24 = v92 * v23->y; |
1888 v99 = v23; | 1929 //v99 = v23; |
1889 thisf = 20.0 - (-v24 - v91 * v23->y - v90 * v23->x) * 20.0; | 1930 thisf = 20.0 - (-v24 - v91 * v23->z - v90 * v23->x) * 20.0; |
1890 v25 = thisf + 6.7553994e15; | 1931 //v25 = thisf + 6.7553994e15; |
1891 v27 = pOutdoorCamera->numStru148s > 1999; | 1932 //v27 = pOutdoorCamera->numStru148s > 1999; |
1892 v26 = pOutdoorCamera->numStru148s - 1999 < 0; | 1933 //v26 = pOutdoorCamera->numStru148s - 1999 < 0; |
1893 v16->field_58 = LOBYTE(v25); | 1934 v16->field_58 = floorf(thisf + 0.5f); |
1894 if ( !(v26 ^ v27) ) | 1935 if ( pOutdoorCamera->numStru148s >= 1999 ) |
1895 return; | 1936 return; |
1896 ++pOutdoorCamera->numStru148s; | 1937 ++pOutdoorCamera->numStru148s; |
1897 if ( !sub_481FC9(v8, a8, v101, v16) ) | 1938 if ( !sub_481FC9(v8, pVertices, v101, v16) ) |
1898 //goto LABEL_126; | 1939 //goto LABEL_126; |
1899 { | 1940 { |
1900 --pOutdoorCamera->numStru148s; | 1941 --pOutdoorCamera->numStru148s; |
1901 goto LABEL_162; | 1942 goto LABEL_162; |
1902 } | 1943 } |
1903 v28 = 1.0 / (a2->vWorldViewPosition.x + 0.0000001); | 1944 v28 = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); |
1904 memcpy(array_50AC10, a2, 0x30u); | 1945 memcpy(&array_50AC10[0], v102, 0x30u); |
1905 array_50AC10[0].flt_20 = v28; | 1946 array_50AC10[0].flt_20 = v28; |
1906 array_50AC10[0].u = 0.0; | 1947 array_50AC10[0].u = 0.0; |
1907 array_50AC10[0].v = 0.0; | 1948 array_50AC10[0].v = 0.0; |
1908 v29 = a8->vWorldViewPosition.x + 0.0000001; | 1949 v29 = pVertices->vWorldViewPosition.x + 0.0000001000000011686097; |
1909 memcpy(&array_50AC10[1], a8, sizeof(array_50AC10[1])); | 1950 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); |
1910 array_50AC10[1].flt_20 = 1.0 / v29; | 1951 array_50AC10[1].flt_20 = 1.0 / v29; |
1911 array_50AC10[1].u = 0.0; | 1952 array_50AC10[1].u = 0.0; |
1912 array_50AC10[1].v = 1.0; | 1953 array_50AC10[1].v = 1.0; |
1913 v30 = pVertices->vWorldViewPosition.x + 0.0000001; | 1954 v30 = pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; |
1914 memcpy(&array_50AC10[2], pVertices, sizeof(array_50AC10[2])); | 1955 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); |
1915 array_50AC10[2].flt_20 = 1.0 / v30; | 1956 array_50AC10[2].flt_20 = 1.0 / v30; |
1916 array_50AC10[2].u = 1.0; | 1957 array_50AC10[2].u = 1.0; |
1917 array_50AC10[2].v = 1.0; | 1958 array_50AC10[2].v = 1.0; |
1918 v31 = v101->vWorldViewPosition.x + 0.0000001; | 1959 v31 = v101->vWorldViewPosition.x + 0.0000001000000011686097; |
1919 memcpy(&array_50AC10[3], v101, sizeof(array_50AC10[3])); | 1960 memcpy(&array_50AC10[3], v101, sizeof(array_50AC10[3])); |
1920 array_50AC10[3].flt_20 = 1.0 / v31; | 1961 array_50AC10[3].flt_20 = 1.0 / v31; |
1921 array_50AC10[3].u = 1.0; | 1962 array_50AC10[3].u = 1.0; |
1922 array_50AC10[3].v = 0.0; | 1963 array_50AC10[3].v = 0.0; |
1923 | 1964 |
1924 static stru154 static_sub_0048034E_stru_154; | 1965 /*if ( !(byte_76D5C0 & 1) ) |
1925 /*static bool __init_flag3 = false; | 1966 { |
1926 if (!__init_flag3) | 1967 byte_76D5C0 |= 1u; |
1927 { | 1968 stru154(stru_76D5A8); |
1928 __init_flag3 = true; | 1969 atexit(loc_481199); |
1929 | |
1930 stru154::stru154(&static_sub_0048034E_stru_154); | |
1931 }*/ | 1970 }*/ |
1932 | 1971 v32 = (struct8 *)array_50AC10; |
1933 _this = pGame->pLightmapBuilder; | 1972 v97 = (int)pGame->pLightmapBuilder; |
1934 pGame->pLightmapBuilder->StackLights_TerrainFace(v99, &v95, array_50AC10, 4u, 1); | 1973 pGame->pLightmapBuilder->StackLights_TerrainFace(v99, &v95, array_50AC10, 4, 1); |
1935 pDecalBuilder->_49BE8A(v16, *(float *)&v99, (int)&v95, array_50AC10, 4u, 1); | 1974 pDecalBuilder->_49BE8A(v16, *(float *)&v99, (int)&v95, array_50AC10, 4u, 1); |
1936 a5 = 4; | 1975 a5 = 4; |
1937 if ( byte_4D864C && pGame->uFlags & 0x80 ) | 1976 if ( byte_4D864C && pGame->uFlags & 0x80 ) |
1938 { | 1977 { |
1939 thisa = pGame->pIndoorCameraD3D; | 1978 thisa = pGame->pIndoorCameraD3D; |
1940 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 ) | 1979 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 ) |
1941 goto LABEL_162; | 1980 goto LABEL_162; |
1942 thisa->ViewTransform(array_50AC10, a5); | 1981 thisa->ViewTransform(array_50AC10, a5); |
1943 thisa->Project(array_50AC10, a5, 0); | 1982 thisa->Project(array_50AC10, a5, 0); |
1944 } | 1983 } |
1945 this_3 = a2->vWorldViewPosition.x < 8.0 | 1984 this_3 = v102->vWorldViewPosition.x < 8.0 |
1946 || a8->vWorldViewPosition.x < 8.0 | 1985 || pVertices->vWorldViewPosition.x < 8.0 |
1947 || v101->vWorldViewPosition.x < 8.0 | 1986 || v101->vWorldViewPosition.x < 8.0 |
1948 || pVertices->vWorldViewPosition.x < 8.0; | 1987 || pVertices2->vWorldViewPosition.x < 8.0; |
1949 v32 = (double)pOutdoorCamera->shading_dist_mist; | 1988 v3a = (double)pOutdoorCamera->shading_dist_mist; |
1950 v108 = v32 < a2->vWorldViewPosition.x | 1989 v108 = v3a < v102->vWorldViewPosition.x |
1951 || v32 < a8->vWorldViewPosition.x | 1990 || v3a < pVertices->vWorldViewPosition.x |
1952 || v32 < v101->vWorldViewPosition.x | 1991 || v3a < v101->vWorldViewPosition.x |
1953 || v32 < pVertices->vWorldViewPosition.x; | 1992 || v3a < pVertices2->vWorldViewPosition.x; |
1954 LOBYTE(v33) = 0; | 1993 v33 = 0; |
1955 pGame->pLightmapBuilder->std__vector_000004_size = 0; | 1994 pGame->pLightmapBuilder->std__vector_000004_size = 0; |
1956 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | 1995 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) |
1957 { | 1996 { |
1958 if ( this_3 ) | 1997 if ( this_3 ) |
1959 LOBYTE(v33) = 3; | 1998 v33 = 3; |
1960 else | 1999 else |
1961 v33 = v108 != 0 ? 5 : 0; | 2000 v33 = v108 != 0 ? 5 : 0; |
1962 static_sub_0048034E_stru_154._49B0C9(v99, v95); | 2001 static_sub_0048034E_stru_154._49B0C9(v99, v95); |
1963 if ( pDecalBuilder->uNumDecals > 0 ) | 2002 if ( pDecalBuilder->uNumDecals > 0 ) |
1964 pDecalBuilder->ApplyDecals( | 2003 pDecalBuilder->ApplyDecals(31 - v16->field_58, |
1965 31 - v16->field_58, | |
1966 4, | 2004 4, |
1967 &static_sub_0048034E_stru_154, | 2005 &static_sub_0048034E_stru_154, |
1968 a5, | 2006 a5, |
1969 array_50AC10, | 2007 array_50AC10, |
1970 0, | 2008 0, |
1971 v33, | 2009 *(float *)&v33, |
1972 -1); | 2010 -1); |
1973 } | 2011 } |
1974 if ( stru_F8AD28.uNumLightsApplied > 0 ) | 2012 if ( stru_F8AD28.uNumLightsApplied > 0 ) |
1975 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33); | 2013 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33); |
1976 v34 = a5; | 2014 v34 = a5; |
1977 v35 = byte_4D864C == 0; | 2015 //v35 = byte_4D864C == 0; |
1978 v16->uNumVertices = a5; | 2016 v16->uNumVertices = a5; |
1979 if ( v35 || !(pGame->uFlags & 0x80) ) | 2017 if ( !byte_4D864C || ~pGame->uFlags & 0x80 ) |
1980 { | 2018 { |
1981 if ( this_3 ) | 2019 if ( this_3 ) |
1982 { | 2020 { |
1983 v36 = sr_424CD7(v34); | 2021 v36 = sr_424CD7(v34); |
1984 goto LABEL_53; | 2022 v16->uNumVertices = v36; |
2023 OutdoorCamera::Project(v36); | |
1985 } | 2024 } |
1986 if ( v108 ) | 2025 if ( v108 ) |
1987 { | 2026 { |
1988 v36 = sr_424EE0_MakeFanFromTriangle(v34); | 2027 v36 = sr_424EE0_MakeFanFromTriangle(v34); |
1989 LABEL_53: | |
1990 v16->uNumVertices = v36; | 2028 v16->uNumVertices = v36; |
1991 OutdoorCamera::Project(v36); | 2029 OutdoorCamera::Project(v36); |
1992 } | 2030 } |
1993 } | 2031 } |
1994 v37 = *(int *)&v16->flags; | 2032 //v37 = *(int *)&v16->flags; |
1995 if ( !(BYTE1(v37) & 1) ) | 2033 if ( ~v16->flags & 1 ) |
1996 { | 2034 { |
1997 if ( v37 & 2 && v16->uTileBitmapID == pRenderer->field_1036AC_bitmapid ) | 2035 if ( v16->flags & 2 && v16->uTileBitmapID == pRenderer->field_1036AC_bitmapid ) |
1998 { | 2036 { |
1999 v80 = 0; | 2037 v80 = false; |
2000 v39 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]; | 2038 v39 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]; |
2001 } | 2039 } |
2002 else | 2040 else |
2003 { | 2041 { |
2004 v39 = v16->uTileBitmapID; | 2042 v39 = v16->uTileBitmapID; |
2005 v80 = 1; | 2043 v80 = true; |
2006 } | 2044 } |
2007 v79 = 0; | 2045 //v79 = 0; |
2008 v78 = pBitmaps_LOD->pHardwareTextures[v39]; | 2046 v78 = pBitmaps_LOD->pHardwareTextures[v39]; |
2009 v77 = v16; | 2047 v77 = (int)v16; |
2010 v76 = v16->uNumVertices; | 2048 v76 = v16->uNumVertices; |
2011 //LABEL_161: | 2049 //LABEL_161: |
2012 pRenderer->DrawTerrainPolygon(v76, v77, v78, v79, v80); | 2050 pRenderer->DrawTerrainPolygon(v76, v16, v78, false, v80); |
2013 goto LABEL_162; | 2051 goto LABEL_162; |
2014 } | 2052 } |
2015 v38 = v16; | 2053 v38 = v16; |
2016 LABEL_56: | 2054 LABEL_56: |
2017 v38->_4811A3(); | 2055 v38->_4811A3(); |
2018 } | 2056 } |
2019 LABEL_162: | 2057 LABEL_162: |
2020 v4 = v88++ + 1; | 2058 v4 = v88 + 1; |
2021 if ( v88 >= v84 ) | 2059 if ( ++v88 >= v84 ) |
2022 return; | 2060 return; |
2023 } | 2061 } |
2024 v40 = &array_77EC08[pOutdoorCamera->numStru148s]; | 2062 v40 = &array_77EC08[pOutdoorCamera->numStru148s]; |
2025 v41 = pOutdoor->GetTileTexture(sX, sY); | 2063 v41 = pOutdoor->GetTileTexture(sX, sY); |
2026 v40->uTileBitmapID = v41; | 2064 v40->uTileBitmapID = v41; |
2031 v43 = pGame->pLightmapBuilder; | 2069 v43 = pGame->pLightmapBuilder; |
2032 *(int *)&v40->flags = v42; | 2070 *(int *)&v40->flags = v42; |
2033 v44 = v93; | 2071 v44 = v93; |
2034 v40->field_59 = 1; | 2072 v40->field_59 = 1; |
2035 v40->field_5D = (char)v43; | 2073 v40->field_5D = (char)v43; |
2036 v40->field_34 = v44->distance; | 2074 v40->field_34 = *(_WORD *)(v44 + 2); |
2037 v45 = v89; | 2075 v45 = v89; |
2038 v40->field_5C = v89; | 2076 v40->field_5C = v89; |
2039 v46 = 2 * (int)((char *)v43 + 128 * v45); | 2077 v46 = 4 * ((char)v43 + (v45 << 7)); |
2040 v85 = v46 * 2; | 2078 v85 = v46; |
2041 v47 = pTerrainNormalIndices[v46 + 1]; | 2079 v47 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + v46 + 2);// v47 = pTerrainNormalIndices[v46 + 1]; |
2042 if ( v47 < 0 || v47 > (signed int)(uNumTerrainNormals - 1) ) | 2080 if ( v47 < 0 || v47 > (signed int)(uNumTerrainNormals - 1) ) |
2043 v48 = 0; | 2081 v48 = 0; |
2044 else | 2082 else |
2045 v48 = &pTerrainNormals[v47]; | 2083 v48 = &pTerrainNormals[v47]; |
2046 v49 = v92 * v48->z; | 2084 v49 = v92 * v48->y; |
2047 v99 = v48; | 2085 //v99 = v48; |
2048 thisg = 20.0 - (-v49 - v91 * v48->y - v90 * v48->x) * 20.0; | 2086 thisg = 20.0 - (-v49 - v91 * v48->z - v90 * v48->x) * 20.0; |
2049 v50 = thisg + 6.7553994e15; | 2087 v50 = thisg + 6.755399441055744e15; |
2050 v40->field_58 = LOBYTE(v50); | 2088 v40->field_58 = LOBYTE(v50); |
2051 if ( SLOBYTE(v50) < 0 ) | 2089 if ( LOBYTE(v50) < 0 ) |
2052 v40->field_58 = 0; | 2090 v40->field_58 = 0; |
2053 if ( pOutdoorCamera->numStru148s >= 1999 ) | 2091 if ( pOutdoorCamera->numStru148s >= 1999 ) |
2054 return; | 2092 return; |
2055 ++pOutdoorCamera->numStru148s; | 2093 ++pOutdoorCamera->numStru148s; |
2056 if ( !sub_481FC9(a8, pVertices, v8, v40) ) | 2094 if ( !sub_481FC9(pVertices, pVertices2, v8, v40) ) |
2057 //goto LABEL_77; | 2095 //goto LABEL_77; |
2058 { | 2096 { |
2059 --pOutdoorCamera->numStru148s; | 2097 --pOutdoorCamera->numStru148s; |
2060 goto LABEL_112; | 2098 goto LABEL_112; |
2061 } | 2099 } |
2062 v51 = 1.0 / (a2->vWorldViewPosition.x + 0.0000001); | 2100 v51 = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); |
2063 memcpy(array_50AC10, a2, 0x30u); | 2101 memcpy(&array_50AC10[0], v102, 0x30u); |
2064 array_50AC10[0].flt_20 = v51; | 2102 array_50AC10[0].flt_20 = v51; |
2065 array_50AC10[0].u = 0.0; | 2103 array_50AC10[0].u = 0.0; |
2066 array_50AC10[0].v = 0.0; | 2104 array_50AC10[0].v = 0.0; |
2067 v52 = a8->vWorldViewPosition.x + 0.0000001; | 2105 v52 = pVertices->vWorldViewPosition.x + 0.0000001000000011686097; |
2068 memcpy(&array_50AC10[1], a8, sizeof(array_50AC10[1])); | 2106 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); |
2069 array_50AC10[1].flt_20 = 1.0 / v52; | 2107 array_50AC10[1].flt_20 = 1.0 / v52; |
2070 array_50AC10[1].u = 0.0; | 2108 array_50AC10[1].u = 0.0; |
2071 array_50AC10[1].v = 1.0; | 2109 array_50AC10[1].v = 1.0; |
2072 v53 = pVertices->vWorldViewPosition.x + 0.0000001; | 2110 v53 = pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; |
2073 memcpy(&array_50AC10[2], pVertices, sizeof(array_50AC10[2])); | 2111 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); |
2074 array_50AC10[2].flt_20 = 1.0 / v53; | 2112 array_50AC10[2].flt_20 = 1.0 / v53; |
2075 array_50AC10[2].u = 1.0; | 2113 array_50AC10[2].u = 1.0; |
2076 array_50AC10[2].v = 1.0; | 2114 array_50AC10[2].v = 1.0; |
2077 | 2115 |
2078 static stru154 static_sub_0048034E_stru_76D590; | 2116 static stru154 static_sub_0048034E_stru_76D590; |
2081 { | 2119 { |
2082 __init_flag2 = true; | 2120 __init_flag2 = true; |
2083 | 2121 |
2084 stru154::stru154(&static_sub_0048034E_stru_76D590); | 2122 stru154::stru154(&static_sub_0048034E_stru_76D590); |
2085 }*/ | 2123 }*/ |
2086 | 2124 /*if ( !(byte_76D5C0 & 2) ) |
2125 { | |
2126 byte_76D5C0 |= 2; | |
2127 stru148(stru_76D590); | |
2128 atexit(loc_48118F); | |
2129 }*/ | |
2087 v96 = pGame->pLightmapBuilder; | 2130 v96 = pGame->pLightmapBuilder; |
2088 pGame->pLightmapBuilder->StackLights_TerrainFace(v99, (float *)&a4, array_50AC10, 3u, 0); | 2131 pGame->pLightmapBuilder->StackLights_TerrainFace(v99, (float *)&a4, array_50AC10, 3, 0); |
2089 pDecalBuilder->_49BE8A(v40, *(float *)&v99, (int)&a4, array_50AC10, 3u, 0); | 2132 pDecalBuilder->_49BE8A(v40, *(float *)&v99, (int)&a4, array_50AC10, 3, 0); |
2090 uNumVertices = 3; | 2133 uNumVertices = 3; |
2091 if ( byte_4D864C && pGame->uFlags & 0x80 ) | 2134 if ( byte_4D864C && pGame->uFlags & 0x80 ) |
2092 { | 2135 { |
2093 thisb = pGame->pIndoorCameraD3D; | 2136 thisb = pGame->pIndoorCameraD3D; |
2094 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices ) | 2137 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices ) |
2098 goto LABEL_112; | 2141 goto LABEL_112; |
2099 } | 2142 } |
2100 thisb->ViewTransform(array_50AC10, uNumVertices); | 2143 thisb->ViewTransform(array_50AC10, uNumVertices); |
2101 thisb->Project(array_50AC10, uNumVertices, 0); | 2144 thisb->Project(array_50AC10, uNumVertices, 0); |
2102 } | 2145 } |
2103 this_3a = a2->vWorldViewPosition.x < 8.0 || a8->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0; | 2146 this_3a = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0; |
2104 v54 = (double)pOutdoorCamera->shading_dist_mist; | 2147 v54 = (double)pOutdoorCamera->shading_dist_mist; |
2105 v108 = v54 < a2->vWorldViewPosition.x || v54 < a8->vWorldViewPosition.x || v54 < pVertices->vWorldViewPosition.x; | 2148 v108 = v54 < v102->vWorldViewPosition.x || v54 < pVertices->vWorldViewPosition.x || v54 < pVertices2->vWorldViewPosition.x; |
2106 a8 = 0; | 2149 pVertices = 0; |
2107 v96->std__vector_000004_size = 0; | 2150 v96->std__vector_000004_size = 0; |
2108 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | 2151 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) |
2109 { | 2152 { |
2110 a8 = (RenderVertexSoft *)(this_3a ? 3 : v108 != 0 ? 5 : 0); | 2153 if ( this_3a ) |
2154 pVertices = (RenderVertexSoft *)3; | |
2155 else | |
2156 pVertices = (RenderVertexSoft *)(v108 != 0 ? 5 : 0); | |
2157 //a8 = (RenderVertexSoft *)(this_3a ? 3 : v108 != 0 ? 5 : 0); | |
2111 static_sub_0048034E_stru_76D590._49B0C9(v99, *(float *)&a4); | 2158 static_sub_0048034E_stru_76D590._49B0C9(v99, *(float *)&a4); |
2112 if ( pDecalBuilder->uNumDecals > 0 ) | 2159 if ( pDecalBuilder->uNumDecals > 0 ) |
2113 pDecalBuilder->ApplyDecals(31 - v40->field_58, 4, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)a8, -1); | 2160 pDecalBuilder->ApplyDecals(31 - v40->field_58, 4, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)pVertices, -1); |
2114 } | 2161 } |
2115 if ( stru_F8AD28.uNumLightsApplied > 0 ) | 2162 if ( stru_F8AD28.uNumLightsApplied > 0 ) |
2116 v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)a8); | 2163 v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)pVertices); |
2117 v55 = uNumVertices; | 2164 v55 = uNumVertices; |
2118 v35 = byte_4D864C == 0; | 2165 //v35 = byte_4D864C == 0; |
2119 v40->uNumVertices = uNumVertices; | 2166 v40->uNumVertices = uNumVertices; |
2120 if ( v35 || !(pGame->uFlags & 0x80) ) | 2167 if ( !byte_76D5C0 || !(pGame->uFlags & 0x80) ) |
2121 { | 2168 { |
2122 if ( this_3a ) | 2169 if ( this_3a ) |
2123 { | 2170 { |
2124 v56 = sr_424CD7(v55); | 2171 v56 = sr_424CD7(v55); |
2125 } | 2172 } |
2152 } | 2199 } |
2153 pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81); | 2200 pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81); |
2154 } | 2201 } |
2155 LABEL_112: | 2202 LABEL_112: |
2156 v59 = &array_77EC08[pOutdoorCamera->numStru148s]; | 2203 v59 = &array_77EC08[pOutdoorCamera->numStru148s]; |
2157 a8 = (RenderVertexSoft *)&array_77EC08[pOutdoorCamera->numStru148s]; | 2204 //a8 = (RenderVertexSoft *)&array_77EC08[pOutdoorCamera->numStru148s]; |
2158 v60 = pOutdoor->GetTileTexture(sX, sY); | 2205 v59->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); |
2159 v59->uTileBitmapID = v60; | 2206 if ( v59->uTileBitmapID == -1 ) |
2160 if ( v60 == -1 ) | |
2161 goto LABEL_162; | 2207 goto LABEL_162; |
2162 *(int *)&v59->flags = pOutdoor->GetSomeOtherTileInfo(sX, sY); | 2208 *(int *)&v59->flags = pOutdoor->GetSomeOtherTileInfo(sX, sY); |
2163 v61 = v93; | 2209 v61 = v93; |
2164 v59->field_59 = 1; | 2210 v59->field_59 = 1; |
2165 v59->field_34 = v61->distance; | 2211 v59->field_34 = *(_WORD *)(v61 + 2); |
2166 v59->field_5C = v89; | 2212 v59->field_5C = v89; |
2167 v59->field_5D = (char)_this; | 2213 v59->field_5D = v97; |
2168 v62 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + v85); | 2214 v62 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + v85); |
2169 if ( v62 > (signed int)(uNumTerrainNormals - 1) ) | 2215 if ( v62 > (signed int)(uNumTerrainNormals - 1) ) |
2170 v63 = 0; | 2216 v63 = 0; |
2171 else | 2217 else |
2172 v63 = &pTerrainNormals[v62]; | 2218 v63 = &pTerrainNormals[v62]; |
2173 v64 = v92 * v63->z; | 2219 v64 = v92 * v63->y; |
2174 v99 = v63; | 2220 //v99 = v63; |
2175 thish = 20.0 - (-v64 - v91 * v63->y - v90 * v63->x) * 20.0; | 2221 thish = 20.0 - (-v64 - v91 * v63->y - v90 * v63->x) * 20.0; |
2176 v65 = thish + 6.7553994e15; | 2222 v59->field_58 = floorf(thish + 0.5f); |
2177 v59->field_58 = LOBYTE(v65); | 2223 if ( v59->field_58 < 0 ) |
2178 if ( SLOBYTE(v65) < 0 ) | |
2179 v59->field_58 = 0; | 2224 v59->field_58 = 0; |
2180 if ( pOutdoorCamera->numStru148s >= 1999 ) | 2225 if ( pOutdoorCamera->numStru148s >= 1999 ) |
2181 return; | 2226 return; |
2182 ++pOutdoorCamera->numStru148s; | 2227 ++pOutdoorCamera->numStru148s; |
2183 if ( !sub_481FC9(v101, a2, pVertices, v59) ) | 2228 if ( !sub_481FC9(v101, v102, pVertices2, v59) ) |
2184 { | 2229 { |
2185 //LABEL_126: | 2230 //LABEL_126: |
2186 --pOutdoorCamera->numStru148s; | 2231 --pOutdoorCamera->numStru148s; |
2187 goto LABEL_162; | 2232 goto LABEL_162; |
2188 } | 2233 } |
2189 v66 = 1.0 / (a2->vWorldViewPosition.x + 0.0000001); | 2234 v66 = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); |
2190 memcpy(array_50AC10, a2, 0x30u); | 2235 memcpy(&array_50AC10[0], v102, 0x30u); |
2191 array_50AC10[0].flt_20 = v66; | 2236 array_50AC10[0].flt_20 = v66; |
2192 array_50AC10[0].u = 0.0; | 2237 array_50AC10[0].u = 0.0; |
2193 array_50AC10[0].v = 0.0; | 2238 array_50AC10[0].v = 0.0; |
2194 v67 = pVertices->vWorldViewPosition.x + 0.0000001; | 2239 v67 = pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; |
2195 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); | 2240 memcpy(&array_50AC10[1], pVertices2, sizeof(array_50AC10[1])); |
2196 array_50AC10[1].flt_20 = 1.0 / v67; | 2241 array_50AC10[1].flt_20 = 1.0 / v67; |
2197 array_50AC10[1].u = 1.0; | 2242 array_50AC10[1].u = 1.0; |
2198 array_50AC10[1].v = 1.0; | 2243 array_50AC10[1].v = 1.0; |
2199 v68 = v101->vWorldViewPosition.x + 0.0000001; | 2244 v68 = v101->vWorldViewPosition.x + 0.0000001000000011686097; |
2200 memcpy(&array_50AC10[2], v101, sizeof(array_50AC10[2])); | 2245 memcpy(&array_50AC10[2], v101, sizeof(array_50AC10[2])); |
2201 array_50AC10[2].flt_20 = 1.0 / v68; | 2246 array_50AC10[2].flt_20 = 1.0 / v68; |
2202 array_50AC10[2].u = 1.0; | 2247 array_50AC10[2].u = 1.0; |
2203 array_50AC10[2].v = 0.0; | 2248 array_50AC10[2].v = 0.0; |
2204 | 2249 |
2225 goto LABEL_162; | 2270 goto LABEL_162; |
2226 } | 2271 } |
2227 thisc->ViewTransform(array_50AC10, v100); | 2272 thisc->ViewTransform(array_50AC10, v100); |
2228 thisc->Project(array_50AC10, v100, 0); | 2273 thisc->Project(array_50AC10, v100, 0); |
2229 } | 2274 } |
2230 this_3b = a2->vWorldViewPosition.x < 8.0 | 2275 this_3b = v102->vWorldViewPosition.x < 8.0 |
2231 || pVertices->vWorldViewPosition.x < 8.0 | 2276 || pVertices2->vWorldViewPosition.x < 8.0 |
2232 || v101->vWorldViewPosition.x < 8.0; | 2277 || v101->vWorldViewPosition.x < 8.0; |
2233 v69 = (double)pOutdoorCamera->shading_dist_mist; | 2278 v69 = (double)pOutdoorCamera->shading_dist_mist; |
2234 v108 = v69 < a2->vWorldViewPosition.x || v69 < pVertices->vWorldViewPosition.x || v69 < v101->vWorldViewPosition.x; | 2279 v108 = v69 < v102->vWorldViewPosition.x || v69 < pVertices2->vWorldViewPosition.x || v69 < v101->vWorldViewPosition.x; |
2235 LOBYTE(v70) = 0; | 2280 v70 = 0; |
2236 v96->std__vector_000004_size = 0; | 2281 v96->std__vector_000004_size = 0; |
2237 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | 2282 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) |
2238 { | 2283 { |
2239 if ( this_3b ) | 2284 if ( this_3b ) |
2240 LOBYTE(v70) = 3; | 2285 v70 = 3; |
2241 else | 2286 else |
2242 v70 = v108 != 0 ? 5 : 0; | 2287 v70 = v108 != 0 ? 5 : 0; |
2243 static_sub_0048034E_stru_76D578._49B0C9(v99, v87); | 2288 static_sub_0048034E_stru_76D578._49B0C9(v99, v87); |
2244 if ( pDecalBuilder->uNumDecals > 0 ) | 2289 if ( pDecalBuilder->uNumDecals > 0 ) |
2245 pDecalBuilder->ApplyDecals(31 - v40->field_58, 4, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70, -1); | 2290 pDecalBuilder->ApplyDecals(31 - v40->field_58, 4, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70, -1); |
2246 } | 2291 } |
2247 if ( stru_F8AD28.uNumLightsApplied > 0 ) | 2292 if ( stru_F8AD28.uNumLightsApplied > 0 ) |
2248 v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70); | 2293 v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70); |
2249 v71 = a8; | 2294 v71 = (RenderVertexSoft *)v59; |
2250 v72 = v100; | 2295 v72 = v100; |
2251 v35 = byte_4D864C == 0; | 2296 //v35 = byte_4D864C == 0; |
2252 LODWORD(a8->vWorldViewPosition.z) = v100; | 2297 v59->uNumVertices = v100;//??? |
2253 if ( !v35 && pGame->uFlags & 0x80 ) | 2298 if ( !byte_4D864C && pGame->uFlags & 0x80 ) |
2254 goto LABEL_154; | 2299 goto LABEL_154; |
2255 if ( this_3b ) | 2300 if ( this_3b ) |
2256 { | 2301 { |
2257 v73 = sr_424CD7(v72); | 2302 v73 = sr_424CD7(v72); |
2258 } | 2303 } |
2262 { | 2307 { |
2263 LABEL_154: | 2308 LABEL_154: |
2264 v74 = v71[1].vWorldPosition.x; | 2309 v74 = v71[1].vWorldPosition.x; |
2265 if ( !(BYTE1(v74) & 1) ) | 2310 if ( !(BYTE1(v74) & 1) ) |
2266 { | 2311 { |
2267 if ( LOBYTE(v74) & 2 && LOWORD(v71[1].vWorldViewProjY) == pRenderer->field_1036AC_bitmapid ) | 2312 if ( v74 & 2 && LOWORD(v71[1].vWorldViewProjY) == pRenderer->field_1036AC_bitmapid ) |
2268 { | 2313 { |
2269 v80 = 0; | 2314 v80 = false; |
2270 v75 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]; | 2315 v75 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]; |
2271 } | 2316 } |
2272 else | 2317 else |
2273 { | 2318 { |
2274 v75 = LOWORD(v71[1].vWorldViewProjY); | 2319 v75 = v71[1].vWorldViewProjY; |
2275 v80 = 1; | 2320 v80 = true; |
2276 } | 2321 } |
2277 v79 = 0; | 2322 //v79 = 0; |
2278 v78 = pBitmaps_LOD->pHardwareTextures[v75]; | 2323 v78 = pBitmaps_LOD->pHardwareTextures[v75]; |
2279 v77 = (stru148 *)v71; | 2324 v77 = (int)v71; |
2280 v76 = LODWORD(v71->vWorldViewPosition.z); | 2325 v76 = v71->vWorldViewPosition.z; |
2281 //goto LABEL_161; | 2326 //goto LABEL_161; |
2282 { | 2327 { |
2283 pRenderer->DrawTerrainPolygon(v76, v77, v78, v79, v80); | 2328 pRenderer->DrawTerrainPolygon(v76, (stru148 *)v71, v78, v79, v80); |
2284 goto LABEL_162; | 2329 goto LABEL_162; |
2285 } | 2330 } |
2286 } | 2331 } |
2287 v38 = (stru148 *)v71; | 2332 v38 = (stru148 *)v71; |
2288 goto LABEL_56; | 2333 goto LABEL_56; |
2289 } | 2334 } |
2290 v73 = sr_424EE0_MakeFanFromTriangle(v72); | 2335 v73 = sr_424EE0_MakeFanFromTriangle(v72); |
2291 } | 2336 } |
2292 LODWORD(v71->vWorldViewPosition.z) = v73; | 2337 v71->vWorldViewPosition.z = v73; |
2293 OutdoorCamera::Project(v73); | 2338 OutdoorCamera::Project(v73); |
2294 goto LABEL_154; | 2339 goto LABEL_154; |
2295 } | 2340 } |
2296 } | 2341 } |
2297 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); | 2342 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); |
7368 } | 7413 } |
7369 } | 7414 } |
7370 // 4A26BC: could not find valid save-restore pair for esi | 7415 // 4A26BC: could not find valid save-restore pair for esi |
7371 // 4D864C: using guessed type char byte_4D864C; | 7416 // 4D864C: using guessed type char byte_4D864C; |
7372 | 7417 |
7373 | |
7374 //----- (004A2DA3) -------------------------------------------------------- | 7418 //----- (004A2DA3) -------------------------------------------------------- |
7375 void Render::DrawFan(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *a4) | 7419 void Render::DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture) |
7376 { | 7420 { |
7377 Render *v4; // ebx@1 | 7421 int v4; // ebx@1 |
7378 char *v5; // esi@6 | 7422 int v7; // eax@7 |
7379 char *v6; // edi@6 | 7423 float v12; // ST3C_4@8 |
7380 double v7; // st7@7 | 7424 int i; |
7381 float v8; // ST34_4@7 | 7425 |
7382 int v9; // eax@7 | 7426 v4 = (int)this; |
7383 signed int v10; // eax@7 | 7427 if (!this->uNumD3DSceneBegins) |
7384 double v11; // st7@7 | 7428 return; |
7385 int v12; // eax@7 | 7429 |
7430 if (uNumVertices >= 3) | |
7431 { | |
7432 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1); | |
7433 if (this->bUsingSpecular) | |
7434 { | |
7435 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); | |
7436 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); | |
7437 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); | |
7438 } | |
7439 | |
7440 for (i = 0; i < uNumVertices; ++i) | |
7441 { | |
7442 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; | |
7443 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; | |
7444 pVertices[i].pos.z = 0.99989998; | |
7445 pVertices[i].rhw = array_50AC10[i].flt_20; | |
7446 | |
7447 pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); | |
7448 v7 = 0; | |
7449 if (this->bUsingSpecular) | |
7450 { | |
7451 v12 = array_50AC10[i].vWorldViewPosition.x; | |
7452 v7 = sub_47C3D7_get_fog_related_stuff(0, 1, v12); | |
7453 } | |
7454 pVertices[i].specular = v7; | |
7455 pVertices[i].texcoord.x = array_50AC10[i].u; | |
7456 pVertices[i].texcoord.y = array_50AC10[i].v; | |
7457 } | |
7458 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture); | |
7459 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
7460 } | |
7461 } | |
7462 //----- (004A2DA3) -------------------------------------------------------- | |
7463 void Render::DrawFan(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture) | |
7464 { | |
7465 int v4; // ebx@1 | |
7466 int v7; // eax@7 | |
7386 float v13; // ST3C_4@8 | 7467 float v13; // ST3C_4@8 |
7387 unsigned int v14; // [sp+4Ch] [bp-4h]@6 | 7468 int i; |
7388 | 7469 |
7389 v4 = this; | 7470 v4 = (int)this; |
7390 if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 ) | 7471 if ( !this->uNumD3DSceneBegins ) |
7391 { | 7472 return; |
7392 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); | 7473 if ( uNumVertices >= 3 ) |
7393 if ( v4->bUsingSpecular ) | 7474 { |
7394 { | 7475 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1); |
7395 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); | 7476 if ( this->bUsingSpecular ) |
7396 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); | 7477 { |
7397 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); | 7478 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); |
7398 } | 7479 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); |
7399 if ( (signed int)uNumVertices > 0 ) | 7480 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); |
7400 { | 7481 } |
7401 v5 = (char *)&arary_77E5C8[0].pos.y; | 7482 for (i = 0; i < uNumVertices; ++i) |
7402 v6 = (char *)&array_50AC10[0].vWorldViewProjY; | 7483 { |
7403 v14 = uNumVertices; | 7484 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; |
7404 do | 7485 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; |
7405 { | 7486 pVertices[i].pos.z = 0.99989998; |
7406 v7 = *((float *)v6 - 4); | 7487 pVertices[i].rhw = array_50AC10[i].flt_20; |
7407 *((int *)v5 - 1) = *((int *)v6 - 1); | 7488 |
7408 v8 = v7; | 7489 pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); |
7409 *(int *)v5 = *(int *)v6; | 7490 v7 = 0; |
7410 v9 = *((int *)v6 + 1); | 7491 if (this->bUsingSpecular) |
7411 *((int *)v5 + 1) = 0x3F7FF972u; | 7492 { |
7412 *((int *)v5 + 2) = v9; | 7493 v13 = array_50AC10[i].vWorldViewPosition.x; |
7413 v10 = GetActorTintColor(31, 0, v8, 1, 0); | 7494 v7 = sub_47C3D7_get_fog_related_stuff(0, 1, v13); |
7414 v11 = *((float *)v6 - 4); | 7495 } |
7415 *((int *)v5 + 3) = v10; | 7496 pVertices[i].specular = v7; |
7416 v12 = 0; | 7497 pVertices[i].texcoord.x = array_50AC10[i].u; |
7417 if ( v4->bUsingSpecular ) | 7498 pVertices[i].texcoord.y = array_50AC10[i].v; |
7418 { | 7499 } |
7419 v13 = v11; | 7500 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture); |
7420 v12 = sub_47C3D7_get_fog_related_stuff(0, 1, v13); | 7501 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7421 } | 7502 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); |
7422 *((int *)v5 + 4) = v12; | |
7423 *((int *)v5 + 5) = *((int *)v6 + 2); | |
7424 *((int *)v5 + 6) = *((int *)v6 + 3); | |
7425 v6 += 48; | |
7426 v5 += 32; | |
7427 --v14; | |
7428 } | |
7429 while ( v14 ); | |
7430 } | |
7431 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a4)); | |
7432 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | |
7433 D3DPT_TRIANGLEFAN, | |
7434 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
7435 arary_77E5C8, | |
7436 uNumVertices, | |
7437 24)); | |
7438 } | 7503 } |
7439 } | 7504 } |
7440 | 7505 |
7441 | 7506 |
7442 //----- (004A2ED5) -------------------------------------------------------- | 7507 //----- (004A2ED5) -------------------------------------------------------- |