43 if (distance_or_reference_selector < 0)
45 struct Actor_State **out_reference_actor = other_actor_or_out_reference;
47 UINT32_MAX - distance_or_reference_selector, out_reference_actor);
49 if (component_reference_result && *out_reference_actor)
50 return component_reference_result;
62 *out_reference_actor = (
struct Actor_State *)target;
67 struct Actor_State *other_actor = other_actor_or_out_reference;
68 int32_t contact_distance_q6 = distance_or_reference_selector >> 6;
70 struct Actor_State *contact_candidate = other_actor;
88 int32_t horizontal_separation_y = 0;
90 int64_t separation_x_squared_wide = (int64_t)separation_x * separation_x;
91 int64_t separation_y_squared_wide = (int64_t)horizontal_separation_y * horizontal_separation_y;
92 int64_t separation_xy_squared_wide = separation_x_squared_wide + separation_y_squared_wide;
93 int64_t separation_z_squared_wide = (int64_t)separation_z * separation_z;
94 int32_t horizontal_separation_length =
100 if (horizontal_separation_length)
103 int64_t repulsion_x_wide = (int64_t)repulsion_scale_q16 * separation_x;
107 int64_t repulsion_y_wide = (int64_t)repulsion_scale_q16 * horizontal_separation_y;
108 int64_t repulsion_z_wide = (int64_t)repulsion_scale_q16 * separation_z;
111 repulsion_x = separation_x;
134 contact_candidate = NULL;
143 contact->
target = (
struct Actor *)contact_candidate;
144 contact->
distance = contact_distance_q6;
183 if (movement_handler > 0)
202 int32_t preprocess_behavior_flags = behavior_flags_8;
227 int32_t ground_world_y = actor->
sub_pos.
y;
228 int32_t previous_position_y = actor->
position.
y;
232 int32_t previous_position_z = actor->
position.
z;
233 int32_t ground_world_z = actor->
sub_pos.
z;
254 int32_t current_facing = (int32_t)(int16_t)blended_facing_word;
256 if (current_facing == facing_target)
261 blended_facing_word = (uint16_t)blended_facing_word + actor->
facing_blend;
271 int32_t rotation_q12 =
274 int32_t facing_blend_cosine_q14 =
Math_SinQ14(angle);
277 int32_t facing_blend_sine_q14;
283 int16_t ground_facing_angle;
289 uint16_t combined_facing_angle = actor->
facing_current + ground_facing_angle;
292 int16_t combined_facing_cosine_q12 = (int16_t)(combined_facing_cosine_q14 >> 2);
295 actor->
rot_mat.
m00 = combined_facing_cosine_q12;
296 actor->
rot_mat.
m20 = (uint16_t)-combined_facing_sine_q12;
297 actor->
rot_mat.
m02 = (uint16_t)combined_facing_sine_q12;
298 actor->
rot_mat.
m22 = combined_facing_cosine_q12;
308 if (ground_tilt_child)
312 if (airborne_movement_bit)
348 int32_t blended_tilt_x_squared = blended_tilt_x * blended_tilt_x;
351 int32_t blended_tilt_y_squared = blended_tilt_y * blended_tilt_y;
354 int32_t blended_tilt_zy = blended_tilt_z * blended_tilt_y;
356 int32_t blended_tilt_xy = blended_tilt_y * blended_tilt_x;
357 int32_t blended_tilt_wx = blended_tilt_w * blended_tilt_x;
358 int32_t blended_tilt_zx = blended_tilt_z * blended_tilt_x;
359 int32_t blended_tilt_wz = blended_tilt_w * blended_tilt_z;
360 int32_t blended_tilt_wy = blended_tilt_w * blended_tilt_y;
385 else if (!airborne_movement_bit)
404 int32_t target_tilt_x_squared = target_tilt_x * target_tilt_x;
406 int32_t target_tilt_y_squared = target_tilt_y * target_tilt_y;
408 int32_t target_tilt_zy = target_tilt_z * target_tilt_y;
409 int32_t target_tilt_w = (int32_t)target_tilt_wx_pair.
w;
410 int32_t target_tilt_xy = target_tilt_y * target_tilt_x;
411 int32_t target_tilt_wx = target_tilt_w * target_tilt_x;
412 int32_t target_tilt_zx = target_tilt_z * target_tilt_x;
413 int32_t target_tilt_wz = target_tilt_w * target_tilt_z;
414 int32_t target_tilt_wy = target_tilt_w * target_tilt_y;
447 int32_t child_sub_position_y = actor->
sub_pos.
y;
448 int32_t child_sub_position_z = actor->
sub_pos.
z;
487 int32_t post_collision_x = actor->
velocity.
x;
489 int64_t post_collision_x_squared_wide = (int64_t)post_collision_x * post_collision_x;
490 int32_t post_collision_z = actor->
velocity.
z;
491 int64_t post_collision_z_squared_wide = (int64_t)post_collision_z * post_collision_z;
495 int32_t resolved_velocity_x = actor->
velocity.
x;
499 int32_t resolved_velocity_y = actor->
velocity.
y;
518 int64_t velocity_alignment_x_wide = (int64_t)quaternion_or_saved_velocity.
saved_velocity_q12.
x *
520 int64_t velocity_alignment_z_wide = (int64_t)quaternion_or_saved_velocity.
saved_velocity_q12.
z *
528 .
x = actor->
sub_pos.
x - resolved_velocity_x,
529 .y = actor->
sub_pos.
y - resolved_velocity_y,
537 int32_t post_collision_y = actor->
velocity.
y;
540 if (post_collision_y > saved_velocity_y)