29 int32_t quotient, remainder;
31 __asm__(
"idivl %4" :
"=a"(quotient),
"=d"(remainder)
32 :
"a"(low),
"d"(high),
"rm"(divisor) :
"cc");
42 int32_t quotient, remainder;
44 __asm__(
"idivl %4" :
"=a"(quotient),
"=d"(remainder)
45 :
"a"((uint32_t)value <<
MATH_Q12_SHIFT),
"d"(value >> 20),
"rm"(divisor) :
"cc");
56 memcpy(&p, &node->vertices[index].pos,
sizeof(p));
59 int32_t x = p.
x, y = p.
y, z = p.
z;
96 int32_t
x = v->
pos.
x,
y = v->pos.y,
z = v->pos.z;
116 for (
int i = 3 - triangle; i >= 0; --i)
119 int16_t dx = (int16_t)(px - vertices[1].
x), dz = (int16_t)(pz - vertices[1].
z);
120 int16_t selector = triangle, vertex_z;
124 vertices[3] = vertices[0];
125 vertex_z = vertices[2].
z;
129 int32_t ex = (int16_t)(vertices[3].
x - vertices[1].
x);
130 int32_t ez = (int16_t)(vertices[3].
z - vertices[1].
z);
131 int32_t side = ((int32_t)vertices[0].
x - vertices[1].
x) * ez -
132 ((int32_t)vertices[0].
z - vertices[1].
z) * ex;
134 if ((side ^ (dx * ez - dz * ex)) >= 0)
136 vertices[2].
x = vertices[0].
x;
137 vertices[2].
y = vertices[0].
y;
138 vertex_z = vertices[0].
z;
143 vertex_z = vertices[2].
z;
148 int32_t a = (int16_t)(vertices[1].
x - vertices[2].
x);
149 int32_t b = (int16_t)(vertex_z - vertices[1].
z);
150 int32_t determinant = ((int32_t)vertices[3].
x - vertices[1].
x) * b +
151 ((int32_t)vertices[3].
z - vertices[1].
z) * a;
154 weights[0] = selector;
157 int32_t numerator = (int16_t)(vertices[1].
z - vertices[3].
z) * (int32_t)dx +
158 (int16_t)(vertices[3].
x - vertices[1].
x) * (int32_t)dz;
161 weights[3] = (int16_t)(
MATH_Q12_ONE - weights[1] - weights[2]);
174 int16_t weighted_local_x;
175 int16_t weighted_local_y;
176 int32_t weighted_z_first_term;
178 int32_t weighted_z_second_term;
179 int32_t weight_c_q12;
183 int32_t triangle_vertex_one_index = (uint16_t)(contact_poly->
vertex_idx[1]);
185 tri_vertex_a = &node_vertices[triangle_vertex_one_index];
186 weight_c_q12 = (int32_t)barycentric_storage->
weightC_q12;
188 int32_t triangle_vertex_two_index = (uint16_t)(contact_poly->
vertex_idx[2]);
189 struct Collision_Vertex const *triangle_vertex_two = &node_vertices[triangle_vertex_two_index];
190 int32_t triangle_weight_two = (int32_t)barycentric_storage->
weightB_q12;
191 int32_t triangle_vertex_three_index = (uint16_t)(contact_poly->
vertex_idx[3]);
192 struct Collision_Vertex const *triangle_vertex_three = &node_vertices[triangle_vertex_three_index];
193 int32_t triangle_weight_three = (int32_t)barycentric_storage->
weightA_q12;
195 weighted_z_first_term = (int32_t)triangle_vertex_two->
pos.
z * triangle_weight_two;
196 weighted_local_x = (int16_t)(((int32_t)triangle_vertex_three->
pos.
x * triangle_weight_three + (int32_t)tri_vertex_a->
pos.
x * weight_c_q12 + (int32_t)triangle_vertex_two->
pos.
x * triangle_weight_two) >>
MATH_Q12_SHIFT);
197 weighted_local_y = (int16_t)(((int32_t)triangle_vertex_two->
pos.
y * triangle_weight_two + (int32_t)triangle_vertex_three->
pos.
y * triangle_weight_three + (int32_t)tri_vertex_a->
pos.
y * weight_c_q12) >>
MATH_Q12_SHIFT);
198 weighted_z_second_term = (int32_t)triangle_vertex_three->
pos.
z * triangle_weight_three;
202 int32_t quad_vertex_one_index = (uint16_t)(contact_poly->
vertex_idx[1]);
204 tri_vertex_a = &node_vertices[quad_vertex_one_index];
205 weight_c_q12 = (int32_t)barycentric_storage->
weightC_q12;
207 int32_t quad_vertex_zero_index = (uint16_t)(contact_poly->
vertex_idx[0]);
208 struct Collision_Vertex const *tri_vertex_b = &node_vertices[quad_vertex_zero_index];
209 int32_t quad_weight_zero = (int32_t)barycentric_storage->
weightB_q12;
210 int32_t quad_vertex_three_index = (uint16_t)(contact_poly->
vertex_idx[3]);
211 struct Collision_Vertex const *tri_vertex_c = &node_vertices[quad_vertex_three_index];
212 int32_t quad_weight_three = (int32_t)barycentric_storage->
weightA_q12;
214 weighted_local_x = (int16_t)(((int32_t)tri_vertex_c->
pos.
x * quad_weight_three + (int32_t)tri_vertex_a->
pos.
x * weight_c_q12 + (int32_t)tri_vertex_b->
pos.
x * quad_weight_zero) >>
MATH_Q12_SHIFT);
215 weighted_z_first_term = (int32_t)tri_vertex_c->
pos.
z * quad_weight_three;
216 weighted_local_y = (int16_t)(((int32_t)tri_vertex_c->
pos.
y * quad_weight_three + (int32_t)tri_vertex_b->
pos.
y * quad_weight_zero + (int32_t)tri_vertex_a->
pos.
y * weight_c_q12) >>
MATH_Q12_SHIFT);
217 weighted_z_second_term = (int32_t)tri_vertex_b->
pos.
z * quad_weight_zero;
220 int32_t local_y = (int32_t)weighted_local_y;
221 int32_t local_x = (int32_t)weighted_local_x;
222 int32_t local_z = (int32_t)(int16_t)((weighted_z_first_term + weighted_z_second_term + (int32_t)tri_vertex_a->
pos.
z * weight_c_q12) >>
MATH_Q12_SHIFT);
227 out_world_pos->
y = (rotated_local_y << 6) + collision_node->
origin.
y;
228 out_world_pos->
z = ((int32_t)(int16_t)(rotated_local_z_sum >>
MATH_Q12_SHIFT) << 6) + collision_node->
origin.
z;
240 out_world_pos->
x = world_pos->
x - node->
origin.
x;
241 out_world_pos->
y = world_pos->
y - node->
origin.
y;
242 out_world_pos->
z = world_pos->
z - node->
origin.
z;
267 height = (int32_t)(((int64_t)sum *
MATH_Q12_ONE) / -ny);
275 int32_t side = ((out_world_pos->
x >> 6) - v1->
pos.
x) * (v3->
pos.
z - v1->
pos.
z) - ((out_world_pos->
z >> 6) - v1->
pos.
z) * (v3->
pos.
x - v1->
pos.
x);
295 out_world_pos->
y = height + node->
origin.
y;
303 int32_t packed_adjacency = (uint16_t)(polygon->
face_plane->
adj_edges[*(uint32_t *)edge_index_in_out]);
305 if (!packed_adjacency)
307 *(uint32_t *)edge_index_in_out = 0xffffffff;
313 struct Collision_Polygon *adjacent_polygon = &polygons[(packed_adjacency >> 2) - 1];
330 int32_t local_x_fp6 = actor_view->
position.
x - ground_collision_node->
origin.
x;
332 int32_t actor_local_y_q6 = actor_view->
position.
y - ground_collision_node->
origin.
y;
333 int32_t local_y_fp6 = actor_local_y_q6;
334 int32_t query_local_z_q6 = actor_view->
position.
z - ground_collision_node->
origin.
z;
335 int32_t local_z_fp6 = query_local_z_q6;
342 local_x_fp6 += actor_view->
sub_pos.
x;
343 local_y_fp6 = actor_local_y_q6 + actor_view->
sub_pos.
y;
344 query_local_z_q6 += actor_view->
sub_pos.
z;
345 local_z_fp6 = query_local_z_q6;
348 int16_t point_z = (int16_t)(query_local_z_q6 >> 6);
349 int16_t point_x = (int16_t)(local_x_fp6 >> 6);
355 *out_polygon = ground_contact_polygon;
357 return ground_collision_node;
363 int32_t segment_end_y_q6;
376 int32_t centroid[3] = {0, 0, 0};
378 for (
int index = 0; index < 4; ++index)
381 &vertices[ground_contact_polygon->
vertex_idx[index]];
383 centroid[0] += vertex->
pos.
x;
384 centroid[1] += vertex->
pos.
y;
385 centroid[2] += vertex->
pos.
z;
388 from_point.
x = (int16_t)(centroid[0] >> 2);
389 from_point.
y = (int16_t)(centroid[1] >> 2);
390 from_point.
z = (int16_t)(centroid[2] >> 2);
394 int32_t
x = from_point.
x,
y = from_point.
y,
z = from_point.
z;
404 segment_end_y_q6 = local_y_fp6;
408 segment_end_y_q6 = local_y_fp6;
409 from_point.
x = (int16_t)((local_x_fp6 - actor_view->
sub_pos.
x) >> 6);
410 from_point.
y = (int16_t)((segment_end_y_q6 - actor_view->
sub_pos.
y) >> 6);
411 from_point.
z = ((local_z_fp6 - actor_view->
sub_pos.
z) >> 6);
414 to_point.
x = point_x;
415 to_point.
y = (int16_t)(segment_end_y_q6 >> 6);
416 to_point.
z = point_z;
419 ground_contact_polygon, &from_point, &to_point);
420 int32_t crossed_edge = initial_crossed_edge;
422 if (initial_crossed_edge < 0)
464 excluded_polygon = NULL;
478 ground_contact_polygon = polygon;
481 &from_point, &to_point);
483 crossed_edge = next_crossed_edge;
485 if (next_crossed_edge < 0)
487 excluded_polygon = previous_polygon;
505 *out_polygon = ground_contact_polygon;
507 return ground_collision_node;
521 if ((int32_t)((uint32_t)normal_y & 0xfffff000u) <= 0)
530 int16_t previous[3], current[3];
536 for (; edge < 4; ++edge)
540 int32_t previous_z = (int32_t)previous[2] - point_z;
541 int32_t current_z = (int32_t)current[2] - point_z;
545 if (previous[0] == point_x)
550 if (current[0] == point_x || (((int32_t)previous[0] - point_x) ^ ((int32_t)current[0] - point_x)) < 0)
555 if ((previous_z ^ current_z) < 0)
557 int32_t dz = (int32_t)current[2] - previous[2];
558 int32_t left = ((int32_t)previous[0] - point_x) * dz;
559 int32_t right = ((int32_t)current[0] - previous[0]) * previous_z;
561 if (left == right || (dz ^ (left - right)) >= 0)
565 memcpy(previous, current,
sizeof previous);
568 return crossings & 1;
587 uint16_t index = poly->
vertex_idx[first ? 0 : 3];
589 int32_t dx = (int32_t)to->
x - from->
x, dz = (int32_t)to->
z - from->
z;
591 for (
int i = first; i < 4; i++)
597 if (((int32_t)current.
x - from->
x) * dz - ((int32_t)current.
z - from->
z) * dx > 0 &&
598 ((int32_t)old.
x - from->
x) * dz - ((int32_t)old.
z - from->
z) * dx <= 0)
600 int32_t ex = (int32_t)old.
x - current.
x, ez = (int32_t)old.
z - current.
z;
602 if (((int32_t)from->
x - current.
x) * ez - ((int32_t)from->
z - current.
z) * ex < 0 &&
603 ((int32_t)to->
x - current.
x) * ez - ((int32_t)to->
z - current.
z) * ex >= 0)
624 int32_t ground_height;
638 ground_height = out_world_pos.
y;
645 runtime_vertices; runtime_vertices = runtime_vertices->
next_in_list)
649 int32_t bounds_delta_x =
650 moving_actor->
position.
x - (uint32_t)runtime_vertices->bounds.sphere.center.x;
651 int32_t bounds_query_y = moving_actor->
position.
y;
653 out_world_pos.
x = bounds_delta_x;
657 out_world_pos.
y = bounds_query_y - (uint32_t)runtime_vertices->bounds.sphere.center.y;
659 int32_t half_bounds_delta_z = (int32_t)((uint32_t)
z - (uint32_t)runtime_vertices->bounds.sphere.center.z) >> 1;
661 out_world_pos.
x = bounds_delta_x >> 1;
662 out_world_pos.
z = half_bounds_delta_z;
664 int64_t squared_half_x_wide = (int64_t)out_world_pos.
x * out_world_pos.
x;
665 int64_t squared_half_z_wide = (int64_t)out_world_pos.
z * out_world_pos.
z;
666 int32_t sphere = (int32_t)runtime_vertices->bounds.sphere.radius;
668 if (((uint32_t)((uint64_t)squared_half_z_wide >>
MATH_Q12_SHIFT)) + ((uint32_t)((uint64_t)squared_half_x_wide >>
MATH_Q12_SHIFT)) <= (uint32_t)(sphere * sphere) >> 2 && (-((out_world_pos.
y >> 6)) <= sphere || !moving_actor->
ground_collision_node))
670 int32_t polygon_count = (int32_t)runtime_vertices->polygon_count;
671 int32_t remaining_polygons = polygon_count;
672 int32_t polygon_test_x = (moving_actor->
position.
x - runtime_vertices->origin.x) >> 6;
673 int32_t saved_polygon_test_x = polygon_test_x;
674 int32_t polygon_test_z = (moving_actor->
position.
z - runtime_vertices->origin.z) >> 6;
675 int32_t saved_polygon_test_z = polygon_test_z;
676 struct Collision_Polygon *polygon_cursor = &runtime_vertices->polygons[polygon_count];
683 (uint16_t)polygon_test_z))
686 &moving_actor->
position, &out_world_pos);
688 int32_t y = runtime_vertices->collision_offset.y;
689 int32_t projected_surface_y = out_world_pos.
y;
694 int32_t actor_world_y = moving_actor->
position.
y;
696 if (projected_surface_y > actor_world_y)
698 if (projected_surface_y - y < actor_world_y)
701 if (projected_surface_y - y >= actor_world_y || runtime_vertices == ground_collision_node)
702 projected_surface_y = out_world_pos.
y;
705 projected_surface_y = actor_world_y;
706 out_world_pos.
y = projected_surface_y;
708 if (ground_collision_node != runtime_vertices)
726 ground_height = projected_surface_y;
735 if (ground_collision_node)
737 int32_t candidate_ground_y = ground_height;
739 if (projected_surface_y > candidate_ground_y)
749 if (ground_collision_node != runtime_vertices)
767 ground_height = projected_surface_y;
769 }
while (--remaining_polygons &&
770 (polygon_test_x = saved_polygon_test_x, polygon_test_z = saved_polygon_test_z, 1));
783 moving_actor->
position.
y = ground_height;
792 int32_t out_vertex_base = 0;
797 int32_t active_actor_cell_x;
798 int32_t active_actor_cell_z;
799 int32_t active_actor_cell_y;
801 if (!outside_mode_two)
826 uint16_t polygon_flags = contact_polygon->
flags;
831 int32_t saved_contact_edge = edge_index;
832 int32_t next_edge_vertex_index = edge_index + 1;
833 intptr_t edge_vertex_field_offset = edge_index * 2 + 4;
834 int32_t previous_edge_index;
839 int32_t edge_start_vertex_index = (uint16_t)(contact_polygon->
vertex_idx[(edge_vertex_field_offset - offsetof(
struct Collision_Polygon, vertex_idx)) /
sizeof(contact_polygon->
vertex_idx[0])]);
840 int32_t edge_end_vertex_index;
842 if (!*(uint8_t *)((uint8_t *)&vertices[edge_start_vertex_index].
reserved_0a + 1))
847 if (!*(uint8_t *)((uint8_t *)&vertices[edge_start_vertex_index].
reserved_0a + 1) && !*(uint8_t *)((uint8_t *)&vertices[edge_end_vertex_index].
reserved_0a + 1))
849 ground_node = saved_ground_node;
850 contact_polygon = out_polygon_local;
854 ground_node = saved_ground_node;
856 int32_t edge_index_in_out = edge_index;
858 uint16_t adjacent_polygon_flags;
866 adjacent_polygon_flags = polygon->
flags;
869 contact_polygon = out_polygon_local;
876 int32_t saved_adjacent_edge = adjacent_edge;
880 edge_index_in_out = adjacent_edge;
886 if (second_neighbor_polygon)
888 if (second_neighbor_polygon != out_polygon_local)
890 uint16_t neighbor_flags = second_neighbor_polygon->
flags;
899 edge_index_in_out = second_neighbor_edge;
902 &edge_index_in_out) &&
909 saved_ground_node, second_neighbor_polygon, second_neighbor_edge,
910 out_polygon, wall_vertices,
913 out_vertex_base += 4;
919 j = second_neighbor_edge;
920 second_neighbor_edge -= 1;
923 adjacent_edge = saved_adjacent_edge;
932 source_polygon, adjacent_edge, out_polygon, wall_vertices,
935 out_vertex_base += 4;
941 int32_t previous_adjacent_edge = adjacent_edge;
944 saved_adjacent_edge = adjacent_edge;
946 if (!previous_adjacent_edge)
949 polygon = source_polygon;
950 ground_node = saved_ground_node;
953 edge_index = saved_contact_edge;
954 ground_node = saved_ground_node;
955 contact_polygon = out_polygon_local;
960 contact_polygon = out_polygon_local;
969 if (x * x != -((z * z)))
978 edge_index, out_polygon, wall_vertices, out_vertex_base))
980 out_vertex_base += 4;
985 contact_polygon = out_polygon_local;
990 previous_edge_index = edge_index;
992 edge_vertex_field_offset -= 2;
993 saved_contact_edge = edge_index;
994 next_edge_vertex_index -= 1;
995 }
while (previous_edge_index);
997 moving_actor = actor;
1001 int32_t wall_count = (int32_t)(out_polygon - wall_polygons);
1026 wall_polygons, wall_count);
1033 int32_t edge_start_index;
1038 edge_start_index = source_polygon->
vertex_idx[edge_index];
1042 if (edge_start_index == edge_end_index)
1048 int16_t *edge_start_position = (int16_t *)&vertices[edge_start_index];
1049 int16_t *edge_end_position = (int16_t *)&vertices[edge_end_index];
1050 int16_t *saved_edge_start_position = edge_start_position;
1057 saved_edge_start_position = edge_start_position = (int16_t *)&transformed_a;
1058 edge_end_position = (int16_t *)&transformed_b;
1061 int32_t wall_normal_y_unscaled = 0;
1062 int32_t edge_delta_x = (int32_t)*edge_start_position - (int32_t)*edge_end_position;
1063 int32_t wall_normal_x_unscaled = ((int32_t)edge_end_position[2] - (int32_t)edge_start_position[2]) << 6;
1064 int32_t wall_normal_z_unscaled = edge_delta_x << 6;
1065 int64_t normal_x_squared_wide = (int64_t)wall_normal_x_unscaled * wall_normal_x_unscaled;
1066 int64_t normal_y_squared_wide = (int64_t)wall_normal_y_unscaled * wall_normal_y_unscaled;
1067 int64_t normal_z_squared_wide = (int64_t)wall_normal_z_unscaled * wall_normal_z_unscaled;
1068 int32_t normal_length =
Math_SqrtFP12((int32_t)(((uint64_t)normal_x_squared_wide + (uint64_t)normal_y_squared_wide + (uint64_t)normal_z_squared_wide) >>
MATH_Q12_SHIFT));
1074 int64_t normalized_x_product_wide = (int64_t)inverse_normal_length * wall_normal_x_unscaled;
1076 contact_polygon_out = out_polygon;
1079 int64_t normalized_y_product_wide = (int64_t)inverse_normal_length * wall_normal_y_unscaled;
1083 int64_t normalized_z_product_wide = (int64_t)inverse_normal_length * wall_normal_z_unscaled;
1089 contact_polygon_out = out_polygon;
1095 if (!wall_normal_x_unscaled && !wall_normal_y_unscaled && !wall_normal_z_unscaled)
1100 int16_t origin_y = (int16_t)((collision_node->
origin.
y - actor->
position.
y) >> 6);
1103 output[0].
pos.
x = edge_end_position[0];
1104 output[0].
pos.
y = edge_end_position[1] + origin_y;
1105 output[0].
pos.
z = edge_end_position[2];
1107 __builtin_memcpy(&output[3], &output[0], 8);
1109 int32_t motion_y = actor->
sub_pos.
y >> 6;
1111 if ((int16_t)motion_y < 0)
1112 motion_y = -motion_y;
1114 int16_t half_height = motion_y + actor->
cull_radius;
1116 output[1].
pos.
x = saved_edge_start_position[0];
1117 output[1].
pos.
y = saved_edge_start_position[1] + origin_y;
1118 output[1].
pos.
z = saved_edge_start_position[2];
1119 __builtin_memcpy(&output[2], &output[1], 8);
1123 output[0].
pos.
y = output[1].
pos.
y = bottom;
1124 output[2].
pos.
y = output[3].
pos.
y = bottom + 2 * half_height;
1126 for (
unsigned j = 0; j < 4; ++j)
1127 contact_polygon_out->
vertex_idx[j] = (uint16_t)(out_vertex_base + j);
1131 int32_t dot = (int32_t)first->
x * face_plane->
normal.
x + (int32_t)first->
y * face_plane->
normal.
y + (int32_t)first->
z * face_plane->
normal.
z;
1141 uint32_t dot = (uint32_t)(edge->
nx * eye.
x) + (uint32_t)(edge->
ny * eye.
y) + (uint32_t)(edge->
nz * eye.
z);
1155 (position->
y - eye->
z) >> 8,
1156 (position->
z - eye->
y) >> 8};
1157 int32_t radius = cull_radius >> 2;
1165 int16_t x = (position->
x - occluder->
position.
x) >> 7;
1166 int16_t y = (position->
y - occluder->
position.
y) >> 7;
1167 int16_t z = (position->
z - occluder->
position.
z) >> 7;
1168 uint32_t dot = (uint32_t)(base->
normal.
x * x) + (uint32_t)(base->
normal.
y * y) + (uint32_t)(base->
normal.
z * z);
1169 int32_t projection = ((int32_t)dot >> 1) & ~1;
1170 int32_t distance = (int32_t)((uint32_t)projection + base->
plane_distance) >> 2;
1171 if (distance <= threshold)
#define ACTOR_BEHAVIOR_AIRBORNE
#define ACTOR_BEHAVIOR_GROUND_TRACKING
#define ACTOR_BEHAVIOR_MOVEMENT_ACTIVE
#define ACTOR_BEHAVIOR_PREPROCESSED
#define COLLISION_POLYGON_STEEP_GROUND_REJECT
#define COLLISION_NODE_TRANSFORM_SECONDARY
#define COLLISION_EXCLUDED_REGION_MIN_Z
#define COLLISION_POLYGON_GROUND_EXCLUSION_LOW
#define COLLISION_NO_GROUND_HEIGHT_BITS
#define COLLISION_POLYGON_TRIANGLE
#define COLLISION_TRIANGLE_HEIGHT_MIN_NORMAL_Q12
#define COLLISION_POLYGON_GROUND_EXCLUSION_HIGH
#define COLLISION_NODE_CULL_DISABLED
#define COLLISION_GROUND_NORMAL_MIN_Q12
#define COLLISION_POLYGON_GROUND_ADJACENCY
#define COLLISION_EXCLUDED_REGION_MAX_X
#define COLLISION_POLYGON_REVERSE_FACE
#define COLLISION_NODE_SKIP_GROUND_QUERY
#define COLLISION_PLANE_REVERSE_TEST
#define COLLISION_GROUND_HEIGHT_TOLERANCE_Q6
#define COLLISION_EXCLUDED_REGION_MIN_X
#define COLLISION_NODE_COLLIDABLE
#define COLLISION_NODE_SPECIAL_CONTACT
#define COLLISION_NODE_TRANSFORM_PRIMARY
#define COLLISION_NODE_CULL_FORCE_HIDDEN
#define COLLISION_WALL_VERTEX_CAPACITY
#define COLLISION_WALL_PLANE_CAPACITY
#define COLLISION_CULL_CENTER_TEST
@ COLLISION_NODE_ORIENTED_BOX
#define COLLISION_EXCLUDED_REGION_MAX_Y
#define COLLISION_GROUND_SLOPE_THRESHOLD_Q24
#define COLLISION_POLYGON_EDGE_CONTACT
#define COLLISION_EDGE_INDEX_MASK
#define COLLISION_EXCLUDED_REGION_MIN_Y
void Collision_DetectDynamicObject(struct Actor_State *actor, int32_t *in_out_ground_y)
void Collision_DetectAndResolve3DCollision(struct Actor_State *actor, struct Collision_Node *collision_source, struct Collision_Vertex *vertices, struct Collision_Polygon *polygons, int32_t polygon_count)
#define g_collisionGroundCheckResult
#define g_collisionGroundNormalZ
#define g_collisionGroundDist
#define g_collisionGroundNormalX
int32_t global_type_g_collisionGroundNormalX
#define g_collisionGroundNormalY
int32_t global_type_g_collisionGroundNormalZ
static int32_t occlusion_edge_distance(const struct Shadow_EdgePlane *edge, struct Math_Vec3I16 eye)
uint8_t Collision_BuildWallCollisionPlane(struct Actor_State *actor, struct Collision_Node *collision_node, struct Collision_Polygon *source_polygon, int32_t edge_index, struct Collision_Polygon *out_polygon, struct Collision_Vertex *out_vertices, int32_t out_vertex_base)
static struct Math_Vec3I16 Collision_TransformIndexedVertexPosition(const struct Collision_Node *node, uint16_t index)
static void Collision_ReadPolygonVertexPosition(const struct Collision_Node *node, uint16_t index, int transformed, int16_t out[3])
struct Collision_Polygon * Collision_GetAdjacentPolygon(struct Collision_Node const *collision_node, struct Collision_Polygon const *polygon, int32_t *edge_index_in_out)
static struct Collision_Vertex Collision_TransformVertex(const struct Math_Matrix3x3I16 *m, const struct Collision_Vertex *v)
void Collision_UpdateActorGroundBarycentric(struct Actor_State *actor)
void Collision_TransformGroundBarycentricToWorld(struct Actor_State const *actor_state, struct Math_Vec3I32 *out_world_pos)
uint8_t Collision_CheckActorGround(struct Math_Vec3I32 *position, int32_t cull_radius, uint32_t cull_flags)
struct Collision_Node * Collision_FindGroundPolygonUnderActor(struct Actor_State *actor, struct Collision_Polygon **out_polygon)
int32_t Collision_FindIntersectingPolygonEdge(const struct Collision_Node *node, const struct Collision_Polygon *poly, const struct Math_Vec3I16 *from, const struct Math_Vec3I16 *to)
struct Collision_Node * Collision_FindActorGroundContact(struct Actor_State *actor, struct Collision_Polygon **out_polygon)
void Collision_ProjectPointOntoPolygonSurface(const struct Collision_Node *node, const struct Collision_Polygon *polygon, const struct Math_Vec3I32 *world_pos, struct Math_Vec3I32 *out_world_pos)
static int32_t Math_DivideQ12WithOverflowTrap(int32_t value, int32_t divisor)
static int32_t Math_DivideSignedWordPair(int32_t high, uint32_t low, int32_t divisor)
void Collision_BuildAndResolveGroundEdgeWalls(struct Actor_State *actor)
void Collision_ResolveActorGroundContact(struct Actor_State *actor)
int32_t Collision_IsPointInsidePolygon(struct Collision_Node const *collision_node, struct Collision_Polygon const *polygon, int16_t point_x, int16_t point_z)
struct Actor_State * Entity_GetCurrentOrFirstActiveActor(void)
@ GAME_MODE_COLLISION_CHECK
void Player_CacheGroundJumpVelocity(struct Actor_State *actor)
#define g_currentGameMode
#define render_list_state
#define graphics_shadow_render_list
int32_t Math_CalculateTriangleHeight(int32_t local_xq6, int32_t local_zq6, struct Collision_Vertex const *tri_a, struct Collision_Vertex const *tri_b, struct Collision_Vertex const *tri_c)
int32_t Math_SqrtFP12(uint32_t value)
uint16_t triangleSelector
struct Collision_Polygon * ground_contact_polygon
struct Collision_Node * ground_collision_node
uint8_t behavior_flags_high
struct Math_Vec3I32 world_render_pos
struct Math_Vec3I32 sub_pos
struct Math_Vec3I32 position
struct Math_Vec3I32 attach_offset
struct Math_Vec3I16 normal
struct Collision_Vertex * vertices
struct Math_Vec3I32 collision_offset
struct Collision_Polygon * polygons
struct Math_Matrix3x3I16 transform_matrix
struct Math_Vec3I32 origin
struct Collision_Node * next_in_list
struct Collision_Plane::@141200322312224221361126047031300120201020162362 normal
struct Collision_Plane * plane_data
struct Pkg_CollisionFacePlane * face_plane
struct Math_Vec3I32 origin
struct Math_Matrix3x3I16 transform_matrix
struct Math_Vec3I32 collision_offset
struct Collision_Vertex::@111126275124057154070202104324102117233165176236::@061322026074334072070347216127267241215241121036 pos
struct Math_Vec3I16 normal
struct Math_Vec3I32 position
struct Shadow_EdgePlane * edge_planes
struct Mesh_Polygon * source_polygon
struct Shadow_OccluderView * next_occluder
int16_t plane_group_count