46 static bool _init_flag =
false;
50 for (
uint i = 0; i < 64; ++i)
51 static_DetermineFacetIntersection_array_F8F200[i].flt_2C = 0.0
f;
55 if ((
signed int)
face->uNumVertices > 0) {
56 for (
int i = 0; i <
face->uNumVertices; i++) {
57 static_DetermineFacetIntersection_array_F8F200[i]
60 static_DetermineFacetIntersection_array_F8F200[i]
63 static_DetermineFacetIntersection_array_F8F200[i]
69 uint bmodel_id = pid >> 9;
72 for (
uint i = 0; i <
face->uNumVertices; ++i) {
74 (float)
v[
face->pVertexIDs[i]].x;
76 (
float)
v[
face->pVertexIDs[i]].y;
78 (float)
v[
face->pVertexIDs[i]].z;
85 static_DetermineFacetIntersection_array_F8F200,
face->uNumVertices);
87 face->uNumVertices, 1);
89 SortVectors_x(static_DetermineFacetIntersection_array_F8F200, 0,
90 face->uNumVertices - 1);
91 if (static_DetermineFacetIntersection_array_F8F200[0].vWorldViewPosition.x >
95 float screenspace_center_x, screenspace_center_y;
97 face->uNumVertices, &screenspace_center_x,
98 &screenspace_center_y);
100 static_DetermineFacetIntersection_array_F8F200,
face->uNumVertices,
101 screenspace_center_x, screenspace_center_y))
104 CastPickRay(pRay, screenspace_center_x, screenspace_center_y, pick_depth);
133 int num_vertices,
float x,
float y) {
138 for (
uint i = 0; i <
render->uNumBillboardsToDraw; ++i) {
152 if (v13 == -1)
return false;
157 float min_x = FLT_MAX;
159 float min_y = FLT_MAX;
161 float max_x = -FLT_MAX;
163 float max_y = -FLT_MAX;
164 for (
int i = 0; i < num_vertices; ++i) {
168 if (
v->vWorldViewProjX > max_x) max_x =
v->vWorldViewProjX;
170 if (
v->vWorldViewProjY < min_y) min_y =
v->vWorldViewProjY;
171 if (
v->vWorldViewProjY > max_y) max_y =
v->vWorldViewProjY;
175 if (min_x < render->pBillboardRenderListD3D[v13].pQuads[0].pos.x ||
176 render->pBillboardRenderListD3D[v13].pQuads[0].pos.y > min_y ||
177 render->pBillboardRenderListD3D[v13].pQuads[3].pos.x < max_x ||
178 render->pBillboardRenderListD3D[v13].pQuads[1].pos.y < max_y)
186 unsigned int uNumVertices,
float *pCenterX,
190 memcpy(unk_F8EA00,
pVertices, 32 * uNumVertices);
194 (unk_F8EA00[uNumVertices - 1].
pos.
x - unk_F8EA00[0].
pos.
x) * 0.5 +
199 (unk_F8EA00[uNumVertices - 1].
pos.
y - unk_F8EA00[0].
pos.
y) * 0.5 +
205 int num_vertices,
float *out_center_x,
206 float *out_center_y) {
213 memcpy(static_sub_4C1495_array_F8DDF8, vertices, 48 * num_vertices);
220 static_sub_4C1495_array_F8DDF8[0].vWorldViewProjX;
227 static_sub_4C1495_array_F8DDF8[0].vWorldViewProjY;
234 for (
uint i = 0; i <
render->uNumBillboardsToDraw; ++i) {
268 if (abs(drH) < 5 || abs(drW) < 5) {
273 if (
x >= drX &&
x < (drW + drX) &&
y >= drY &&
y < (drH + drY)) {
281 Sprite *ownerSprite =
nullptr;
289 if (ownerSprite ==
nullptr)
return false;
298 if (sy < 0 || sy >= spriteHeader->
uHeight)
return false;
299 if (sx < 0 || sx >= spriteHeader->
uWidth)
return false;
301 return spriteHeader->
bitmap[sy * spriteHeader->
uWidth + sx] != 0;
311 unsigned int *pNumPointers;
327 face, 0xFFFFFFFFu)) {
348 if (
face->uAttributes & FACE_PICKED)
349 face->uAttributes |= FACE_OUTLINED;
351 face->uAttributes &= ~FACE_OUTLINED;
352 face->uAttributes &= ~FACE_PICKED;
362 bool only_reachable) {
370 if (!reachable && only_reachable) {
381 &blv_face, model.
index)) {
393 face.uAttributes |= FACE_OUTLINED;
395 face.uAttributes &= ~FACE_OUTLINED;
404 int a4,
int a5,
int a6) {
434 v2.vWorldPosition.x = 0.0;
435 v2.vWorldPosition.y = 65536.0;
436 v2.vWorldPosition.z = 0.0;
439 v1.vWorldPosition.x = 65536.0;
440 v1.vWorldPosition.y = 0.0;
441 v1.vWorldPosition.z = 0.0;
444 v3.vWorldPosition.x = 0.0;
445 v3.vWorldPosition.y = 65536.0;
446 v3.vWorldPosition.z = 0.0;
460 int right_sort_index;
465 left_sort_index =
start - 1;
466 right_sort_index =
end;
467 memcpy(&max_array, &pArray[
end],
sizeof(max_array));
471 }
while (pArray[left_sort_index].vWorldViewPosition.x <
475 }
while (pArray[right_sort_index].vWorldViewPosition.x >
477 if (left_sort_index >= right_sort_index)
break;
478 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
479 memcpy(&pArray[left_sort_index], &pArray[right_sort_index],
480 sizeof(pArray[left_sort_index]));
481 memcpy(&pArray[right_sort_index], &temp_array,
482 sizeof(pArray[right_sort_index]));
484 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
485 memcpy(&pArray[left_sort_index], &pArray[
end],
486 sizeof(pArray[left_sort_index]));
487 memcpy(&pArray[
end], &temp_array,
sizeof(pArray[
end]));
501 unsigned short object_pid;
511 L
"Undefined type requested for: CVis::get_object_zbuf_val()");
527 signed int pBModelID) {
530 Vec3_short_ IntersectPoint;
546 if (c1 > 0)
return false;
586 signed int sModelID) {
619 if (v5 <= 0)
return false;
620 for (
int i = 0; i < v5; ++i) {
651 if (v16 != 1)
return false;
653 if (
engine->config->show_picked_face)
736 *
a = IntersectPoint->x;
737 *
b = IntersectPoint->y;
755 *
a = IntersectPoint->x;
756 *
b = IntersectPoint->z;
774 *
a = IntersectPoint->y;
775 *
b = IntersectPoint->z;
801 BLVFace *pFace,
unsigned int uModelID) {
803 *
a = IntersectPoint->x;
804 *
b = IntersectPoint->y;
815 .pVertices.pVertices[pFace->
pVertexIDs[i + 1]]
826 .pVertices.pVertices[pFace->
pVertexIDs[i + 1]]
830 *
a = IntersectPoint->x;
831 *
b = IntersectPoint->z;
842 .pVertices.pVertices[pFace->
pVertexIDs[i + 1]]
853 .pVertices.pVertices[pFace->
pVertexIDs[i + 1]]
857 *
a = IntersectPoint->y;
858 *
b = IntersectPoint->z;
869 .pVertices.pVertices[pFace->
pVertexIDs[i + 1]]
880 .pVertices.pVertices[pFace->
pVertexIDs[i + 1]]
945 Vec3_int_::Rotate(
depth, pRotY, pRotX, pStartR, &outx, &outy, &outz);
966 if (this->
object_pool[i].object_type == pVisObjectType &&
989 for (
uint j = 0; j < i; ++j) {
1002 L
"Unknown pointer creation flag passed to "
1003 L
"::create_object_pointers()");
1011 int forward_sort_index;
1012 signed int backward_sort_index;
1013 unsigned int last_z_val;
1014 unsigned int more_lz_val;
1015 unsigned int less_lz_val;
1023 forward_sort_index = sort_start - 1;
1024 backward_sort_index =
end;
1026 last_z_val = pPointers[
end]->
depth;
1028 ++forward_sort_index;
1029 more_lz_val = pPointers[forward_sort_index]->
depth;
1030 }
while (more_lz_val < last_z_val);
1033 if (backward_sort_index < 1)
break;
1034 --backward_sort_index;
1035 less_lz_val = pPointers[backward_sort_index]->
depth;
1036 }
while (less_lz_val > last_z_val);
1038 temp_pointer = pPointers[forward_sort_index];
1039 if (forward_sort_index >= backward_sort_index) {
1040 pPointers[forward_sort_index] = pPointers[
end];
1041 pPointers[
end] = temp_pointer;
1043 pPointers[forward_sort_index] =
1044 pPointers[backward_sort_index];
1045 pPointers[backward_sort_index] = temp_pointer;
1047 }
while (forward_sort_index < backward_sort_index);
1050 sort_start = forward_sort_index + 1;
1051 }
while (
end > forward_sort_index + 1);
1057 unsigned int uEnd) {
1058 unsigned int left_sort_index;
1061 unsigned int right_sort_index;
1063 if ((
signed int)uEnd > (
signed int)uStart) {
1064 left_sort_index = uStart - 1;
1065 right_sort_index = uEnd;
1067 memcpy(&max_array, &pArray[uEnd],
sizeof(max_array));
1070 }
while (pArray[left_sort_index].pos.x < (
double)max_array.
pos.
x);
1073 }
while (pArray[right_sort_index].pos.x > (
double)max_array.
pos.
x);
1074 if ((
signed int)left_sort_index >= (
signed int)right_sort_index)
1076 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
1077 memcpy(&pArray[left_sort_index], &pArray[right_sort_index],
1078 sizeof(pArray[left_sort_index]));
1079 memcpy(&pArray[right_sort_index], &temp_array,
1080 sizeof(pArray[right_sort_index]));
1082 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
1083 memcpy(&pArray[left_sort_index], &pArray[uEnd],
1084 sizeof(pArray[left_sort_index]));
1085 memcpy(&pArray[uEnd], &temp_array,
sizeof(pArray[uEnd]));
1093 unsigned int uEnd) {
1094 unsigned int left_sort_index;
1097 unsigned int right_sort_index;
1099 if ((
signed int)uEnd > (
signed int)uStart) {
1100 left_sort_index = uStart - 1;
1101 right_sort_index = uEnd;
1103 memcpy(&max_array, &pArray[uEnd],
sizeof(max_array));
1106 }
while (pArray[left_sort_index].pos.y < (
double)max_array.
pos.
y);
1109 }
while (pArray[right_sort_index].pos.y > (
double)max_array.
pos.
y);
1110 if ((
signed int)left_sort_index >= (
signed int)right_sort_index)
1112 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
1113 memcpy(&pArray[left_sort_index], &pArray[right_sort_index],
1114 sizeof(pArray[left_sort_index]));
1115 memcpy(&pArray[right_sort_index], &temp_array,
1116 sizeof(pArray[right_sort_index]));
1118 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
1119 memcpy(&pArray[left_sort_index], &pArray[uEnd],
1120 sizeof(pArray[left_sort_index]));
1121 memcpy(&pArray[uEnd], &temp_array,
sizeof(pArray[uEnd]));
1131 int left_sort_index;
1132 int right_sort_index;
1137 left_sort_index =
start - 1;
1138 right_sort_index =
end;
1139 memcpy(&max_array, &pArray[
end],
sizeof(max_array));
1143 }
while (pArray[left_sort_index].vWorldViewProjX <
1147 }
while (pArray[right_sort_index].vWorldViewProjX >
1149 if (left_sort_index >= right_sort_index)
break;
1150 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
1151 memcpy(&pArray[left_sort_index], &pArray[right_sort_index],
1152 sizeof(pArray[left_sort_index]));
1153 memcpy(&pArray[right_sort_index], &temp_array,
1154 sizeof(pArray[right_sort_index]));
1156 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
1157 memcpy(&pArray[left_sort_index], &pArray[
end],
1158 sizeof(pArray[left_sort_index]));
1159 memcpy(&pArray[
end], &temp_array,
sizeof(pArray[
end]));
1167 int left_sort_index;
1168 int right_sort_index;
1173 left_sort_index =
start - 1;
1174 right_sort_index =
end;
1175 memcpy(&max_array, &pArray[
end],
sizeof(max_array));
1179 }
while (pArray[left_sort_index].vWorldViewProjY <
1183 }
while (pArray[right_sort_index].vWorldViewProjY >
1185 if (left_sort_index >= right_sort_index)
break;
1186 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
1187 memcpy(&pArray[left_sort_index], &pArray[right_sort_index],
1188 sizeof(pArray[left_sort_index]));
1189 memcpy(&pArray[right_sort_index], &temp_array,
1190 sizeof(pArray[right_sort_index]));
1192 memcpy(&temp_array, &pArray[left_sort_index],
sizeof(temp_array));
1193 memcpy(&pArray[left_sort_index], &pArray[
end],
1194 sizeof(pArray[left_sort_index]));
1195 memcpy(&pArray[
end], &temp_array,
sizeof(pArray[
end]));
1210 v3.vWorldPosition.x = 0.0;
1211 v3.vWorldPosition.y = 65536.0;
1212 v3.vWorldPosition.z = 0.0;
1226 v3.vWorldPosition.x = 65536.0;
1227 v3.vWorldPosition.y = 0.0;
1228 v3.vWorldPosition.z = 0.0;
1237 for (
uint i = 0; i < 512; ++i) {
1288 L
"Picking mouse in undefined level");
1305 for (
uint i = 0; i <
render->uNumBillboardsToDraw; ++i) {
1326 switch (
filter->object_type) {
1332 int object_idx = PID_ID(
1335 ->pBillboardRenderListD3D[(
1336 int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace]
1337 .sParentBillboardID]
1339 int object_type = PID_TYPE(
1342 ->pBillboardRenderListD3D[(
1343 int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace]
1344 .sParentBillboardID]
1346 if (
filter->select_flags & 2) {
1347 if (object_type ==
filter->object_id)
return false;
1350 if (
filter->select_flags & 4) {
1352 if (object_type !=
filter->object_id)
return true;
1355 L
"Unsupported \"exclusion if no event\" type in "
1356 L
"CVis::is_part_of_selection");
1364 if (object_type ==
filter->object_id) {
1366 log->
Warning(L
"Default case reached in VIS");
1371 int result = 1 << HEXRAYS_LOBYTE(
pActors[object_idx].uAIState);
1374 filter->select_flags & 8 &&
1376 pActors[object_idx].pMonsterInfo.uID,
1379 if (!(
filter->select_flags & 1))
return true;
1382 if (
result == 0)
return false;
1389 uint face_attrib = 0;
1390 bool no_event =
true;
1394 face_attrib =
face->uAttributes;
1398 face_attrib =
face->uAttributes;
1408 return (face_attrib &
filter->at_ai_state) != 0;
1419 unsigned int uD3DBillboardIdx) {
1465 v3 =
render->pBillboardRenderListD3D[uD3DBillboardIdx].sParentBillboardID;
1466 if (
v3 == -1)
return false;
1494 for (v40 = 0; v40 < 4; ++v40) {
1496 render->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[v40].pos.x;
1498 render->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[v40].pos.y;
1509 &Vis_static_stru_F91E10,
1524 render->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[0].pos.x;
1526 render->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[3].pos.x;
1529 render->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[0].pos.y;
1531 render->pBillboardRenderListD3D[uD3DBillboardIdx].pQuads[1].pos.y;
1544 test_x = (t2_x - t1_x) * 0.5;
1555 &Vis_static_stru_F91E10,
1618 object_info->object, object_info->object_type,
1619 object_info->depth, object_info->object_pid);