102 Dalmatians: Puppies to the Rescue
Decompilation Source Reference | GitLab repository
Loading...
Searching...
No Matches
movement.c
Go to the documentation of this file.
1/* Recovered game implementation; original addresses identify provenance. */
14#include "pcdogs/actor/types.h"
15#include "pcdogs/camera/types.h"
21#include "pcdogs/game/globals.h"
22#include "pcdogs/game/types.h"
24#include "pcdogs/level/types.h"
26#include "pcdogs/math/types.h"
32#include <math.h>
33#include <stdarg.h>
34#include <string.h>
35
36// Original pcdogs.exe: 0x425080
37// Builds a temporary collision probe for a movement segment and returns its Q12 blocked fraction. Zero means unobstructed, and the input positions and optional actor remain read-only.
38int32_t Physics_CalculateMovementWithCollision(struct Math_Vec3I32 const *start_pos, struct Math_Vec3I32 const *end_pos, struct Actor_State const *collision_actor, int16_t probe_radius, int32_t collision_flags)
39{
40 struct Camera_CollisionProbeView probe;
41
42 if (!collision_actor)
43 probe.rot_mat = (struct Math_Matrix3x3I16){
45 .m01 = 0,
46 .m02 = 0,
47 .m10 = 0,
48 .m11 = PHYSICS_FIXED_ONE,
49 .m12 = 0,
50 .m20 = 0,
51 .m21 = 0,
52 .m22 = PHYSICS_FIXED_ONE};
53 else
54 {
55 struct Math_Matrix3x3I16 matrix_first_pair;
56
57 matrix_first_pair.m00 = collision_actor->rot_mat.m00;
58 matrix_first_pair.m01 = collision_actor->rot_mat.m01;
59 probe.rot_mat.m00 = matrix_first_pair.m00;
60 probe.rot_mat.m01 = matrix_first_pair.m01;
61
62 struct Math_Matrix3x3I16 matrix_second_pair;
63
64 matrix_second_pair.m02 = collision_actor->rot_mat.m02;
65 matrix_second_pair.m10 = collision_actor->rot_mat.m10;
66 probe.rot_mat.m02 = matrix_second_pair.m02;
67 probe.rot_mat.m10 = matrix_second_pair.m10;
68
69 struct Math_Matrix3x3I16 matrix_middle_pair;
70
71 matrix_middle_pair.m11 = collision_actor->rot_mat.m11;
72 matrix_middle_pair.m12 = collision_actor->rot_mat.m12;
73 probe.rot_mat.m11 = matrix_middle_pair.m11;
74 probe.rot_mat.m12 = matrix_middle_pair.m12;
75
76 struct Math_Matrix3x3I16 matrix_last_pair;
77
78 matrix_last_pair.m20 = collision_actor->rot_mat.m20;
79 matrix_last_pair.m21 = collision_actor->rot_mat.m21;
80 probe.rot_mat.m20 = matrix_last_pair.m20;
81 probe.rot_mat.m21 = matrix_last_pair.m21;
82 probe.rot_mat.m22 = collision_actor->rot_mat.m22;
83 }
84
86 probe.collision_component = 0;
87
88 int32_t start_y = start_pos->y;
89 int32_t sweep_delta_x = end_pos->x - start_pos->x;
90 int32_t end_y = end_pos->y;
91
92 probe.sweep_delta.x = sweep_delta_x;
93
94 int32_t sweep_delta_y = end_y - start_y;
95 int32_t start_z = start_pos->z;
96
97 probe.sweep_delta.y = sweep_delta_y;
98 probe.velocity.x = sweep_delta_x;
99
100 int32_t start_x_or_quarter_radius = start_pos->x;
101
102 probe.velocity.y = sweep_delta_y;
103
104 int32_t start_y_or_half_radius = start_pos->y;
105
106 probe.sweep_origin.z = start_z;
107
108 int32_t end_z = end_pos->z;
109
110 probe.sweep_origin.y = start_y_or_half_radius;
111 probe.sweep_origin.x = start_x_or_quarter_radius;
112 probe.collision_radius = probe_radius;
113 probe.collision_height_hi = probe_radius;
114 probe.collision_height = probe_radius;
115
116 int32_t delta_z = end_z - start_z;
117 int16_t probe_radius_limit = (uint16_t)(probe_radius >> 2) + probe_radius + (uint16_t)(probe_radius >> 1);
118
119 probe.cull_radius = probe_radius_limit;
120
121 BOOL use_cached_collision_list = !collision_flags;
122
123 probe.sweep_delta.z = delta_z;
124 probe.velocity.z = delta_z;
125 probe.ground_collision_node = 0;
126 probe.collision_class = (collision_flags <= 0) - 2;
128 Collision_DetectActorCollisions((struct Actor_State *)(&probe), use_cached_collision_list);
129
130 return PHYSICS_FIXED_ONE - (int32_t)probe.collision_fraction_q12;
131}
132
133// Original pcdogs.exe: 0x436c80
134// Integrates steering, drag, ground effects, collision modifiers and queued impulses into actor velocity. The speed cap precedes queued impulses, so a new impact can exceed the ordinary cap.
135void Physics_CalculateActorVelocity(struct Actor_State *actor, struct Math_Vec3I32 *inout_velocity, struct Math_Vec3I32 *steering_vec)
136{
137 // Physics_CalculateActorVelocity: Core physics function calculating actor's final velocity from input and
138 // forces. Integrates gravity, friction, input acceleration, platform forces, and velocity clamping. Uses
139 // 12-bit fixed point (0x1000 = 1.0). Outputs final velocity vector and updates actor velocity state.
140 int32_t turn_acceleration_gate = 0;
141 struct Player_ControllerRecordView *controller_record = actor->record_ptr;
142 // Special-case: clamp player position within specific world bounds (bridge area hardcoded check)
143 struct Collision_Node *ground_collision_node = actor->ground_collision_node;
144 struct Math_Vec3I32 *initial_actor_velocity = &actor->velocity;
145 uint32_t button_bits = controller_record->input.button_bits;
146 bool outside_bridge_game_mode = g_currentGameMode != GAME_MODE_GAMEPLAY_3D;
147 struct Math_Vec3I32 *actor_velocity = initial_actor_velocity;
148 int32_t vertical_velocity_component = actor->velocity.y;
149
150 if (!outside_bridge_game_mode)
151 {
152 struct Level_Data *current_level = pkg_resource_current_level_data;
153 int32_t current_entity_index = (uint16_t)(current_level->current_entity_index);
154
155 if (actor == (struct Actor_State *)current_level->entity_array[current_entity_index].runtime_actor)
156 {
157 int32_t world_z_units = actor->world_render_pos.z >> PHYSICS_FIXED_FRACTION_BITS;
158 int32_t world_x_units = actor->world_render_pos.x >> PHYSICS_FIXED_FRACTION_BITS;
159
160 if (world_z_units >= PHYSICS_BRIDGE_WORLD_Z_MIN && world_z_units <= PHYSICS_BRIDGE_WORLD_Z_MAX && world_x_units >= PHYSICS_BRIDGE_WORLD_X_MIN && world_x_units <= PHYSICS_BRIDGE_WORLD_X_MAX && (world_z_units <= PHYSICS_BRIDGE_CENTER_Z_MIN || world_z_units >= PHYSICS_BRIDGE_CENTER_Z_MAX))
161 {
164
165 if (actor->velocity.y > 0)
166 actor->velocity.y = 0;
167
168 // link_targets[2]==0x1e: special ground-state update via Actor_UpdateGroundedState
169 vertical_velocity_component = 0;
170 actor_velocity = &actor->velocity;
171 initial_actor_velocity = &actor->velocity;
172 }
173 }
174 }
175
176 int32_t drag_or_normalization_bits;
177 int32_t acceleration_q12;
178 int32_t inout_speed_limit_q12;
179
181 {
182 inout_speed_limit_q12 = controller_record->param_accel_0;
183 drag_or_normalization_bits = controller_record->param_accel_3;
184 acceleration_q12 = controller_record->param_accel_4;
185 vertical_velocity_component = 0;
186 }
187 else
188 {
189 inout_speed_limit_q12 = controller_record->movement_param_4c;
190 drag_or_normalization_bits = controller_record->param_accel_1;
191 acceleration_q12 = controller_record->param_accel_2;
192 initial_actor_velocity->y = 0;
193 }
194
196 {
197 int32_t ground_jump_velocity = controller_record->ground_jump_velocity;
198
199 if (ground_jump_velocity)
200 {
201 Actor_UpdateGroundedState(actor, controller_record, ground_jump_velocity, &vertical_velocity_component);
202
203 int32_t landing_button_mask = (uint8_t)(g_inputLandingFlagsPtr[3]);
204
205 button_bits |= landing_button_mask;
206 }
207 }
208
209 struct Player_ControllerRecordView *controller_record_for_turn = actor->record_ptr;
210 int16_t saved_turn_step = (int16_t)controller_record->turn_step;
211
212 if (controller_record_for_turn->attachment_ticks > 0)
213 controller_record->turn_step = (int32_t)Component_GetMovementTurnStep(
214 (struct Component_MovementParametersView *)controller_record_for_turn->component_records[1].definition);
215
216 int32_t turn_step;
217
219 turn_step = 0;
220 else
221 turn_step = controller_record->turn_step;
222
223 turn_step = (uint16_t)(turn_step + controller_record->turn_step);
224
225 if (Actor_UpdateRotationFromVelocity(actor, steering_vec, turn_step))
226 turn_acceleration_gate = -1;
227
228 controller_record->turn_step = (int32_t)saved_turn_step;
229
230 int64_t initial_x_squared_wide = (int64_t)actor_velocity->x * actor_velocity->x;
231 int64_t initial_y_squared_wide = (int64_t)actor_velocity->y * actor_velocity->y;
232
233 // Query collision target type 3 (speed modifier): scales movementVec by +0x70, gets speedMultiplier from
234 // +0x74
235 int64_t initial_z_squared_wide = (int64_t)actor_velocity->z * actor_velocity->z;
236 int32_t initial_actor_speed =
237 Math_SqrtFP12(((int32_t)((int64_t)((uint64_t)initial_z_squared_wide + (uint64_t)initial_x_squared_wide + (uint64_t)initial_y_squared_wide) >> PHYSICS_FIXED_FRACTION_BITS)));
238 struct Actor_State *moving_actor = actor;
239 int32_t steering_magnitude = initial_actor_speed;
240 struct Physics_SpeedJumpModifierView *speed_jump_modifier =
242 int32_t jump_multiplier_q12;
243
244 // Query collision target type 4 (accel/maxvel modifier): scales accelRate and maxVelocity; computes
245 // frictionReduction if modifier < 1.0
246 if (speed_jump_modifier)
247 {
248 int64_t modified_speed_limit_wide = (int64_t)speed_jump_modifier->speed_multiplier_q12 * inout_speed_limit_q12;
249
250 inout_speed_limit_q12 = (int32_t)((uint64_t)modified_speed_limit_wide >> PHYSICS_FIXED_FRACTION_BITS);
251 jump_multiplier_q12 = speed_jump_modifier->jump_multiplier_q12;
252 }
253 else
255
256 int32_t acceleration_reduction_q12 = 0;
257 struct Physics_AccelerationDragModifierView *acceleration_drag_modifier =
259 int32_t drag_q12;
260
261 if (!acceleration_drag_modifier)
262 drag_q12 = drag_or_normalization_bits;
263 else
264 {
265 int64_t modified_acceleration_wide = (int64_t)acceleration_drag_modifier->acceleration_multiplier_q12 * acceleration_q12;
266
267 acceleration_q12 = (int32_t)((uint64_t)modified_acceleration_wide >> PHYSICS_FIXED_FRACTION_BITS);
268
269 // Path-following branch: if path_facing byte3 > 0, use component chain for movement direction instead of
270 // input
271 int64_t modified_drag_wide = (int64_t)acceleration_drag_modifier->drag_multiplier_q12 * drag_or_normalization_bits;
273 acceleration_drag_modifier->acceleration_multiplier_q12;
274
275 drag_q12 = (int32_t)((uint64_t)modified_drag_wide >> PHYSICS_FIXED_FRACTION_BITS);
276
278 acceleration_reduction_q12 = PHYSICS_FIXED_ONE - acceleration_multiplier_q12;
279 }
280
281 struct Player_ControllerRecordView *controller_record_for_movement = moving_actor->record_ptr;
282 struct Math_Vec3I32 *inout_velocity_q12;
283
284 if (controller_record_for_movement->attachment_ticks <= 0)
285 {
286 int32_t airborne_behavior_bit = moving_actor->behavior_flags & ACTOR_BEHAVIOR_AIRBORNE;
287
288 if ((!airborne_behavior_bit || controller_record->jump_phase_ticks > (int8_t)controller_record->configured_jump_hold_ticks) && ground_collision_node)
289 {
290 uint16_t ground_surface_flags = moving_actor->ground_contact_polygon->flags;
291
292 if ((ground_surface_flags >> COLLISION_SURFACE_TRAIL_SHIFT & COLLISION_SURFACE_TRAIL_MASK) == COLLISION_SURFACE_TRAIL_IMPACT && airborne_behavior_bit)
293 {
294 int32_t initial_jump_speed_limit = controller_record->movement_param_40;
295
296 controller_record->movement_param_4c = inout_speed_limit_q12;
297
298 int64_t modified_jump_speed_wide = (int64_t)jump_multiplier_q12 * initial_jump_speed_limit;
299
300 controller_record->movement_param_40 = (int32_t)((uint64_t)modified_jump_speed_wide >> PHYSICS_FIXED_FRACTION_BITS);
301 Trail_SpawnFromEntry(moving_actor, 4);
302 }
303 }
304
305 int32_t speed_after_drag = initial_actor_speed - drag_q12;
306
307 steering_magnitude = speed_after_drag;
308
309 if (speed_after_drag <= 0)
310 {
311 steering_magnitude = 0;
312 *(struct Math_Vec3I32 *)actor_velocity = (struct Math_Vec3I32){
313 .z = 0,
314 .y = 0,
315 .x = 0};
316 }
317 else
318 {
319 int32_t speed_before_drag = speed_after_drag + drag_q12;
320 int64_t dragged_velocity_x_wide = (int64_t)((int64_t)steering_magnitude * PHYSICS_FIXED_ONE) / speed_before_drag * actor_velocity->x;
321
322 actor_velocity->x = (int32_t)((uint64_t)dragged_velocity_x_wide >> PHYSICS_FIXED_FRACTION_BITS);
323
324 int64_t dragged_velocity_y_wide = (int64_t)((int64_t)steering_magnitude * PHYSICS_FIXED_ONE) / speed_before_drag * actor_velocity->y;
325
326 actor_velocity->y = (int32_t)((uint64_t)dragged_velocity_y_wide >> PHYSICS_FIXED_FRACTION_BITS);
327 drag_or_normalization_bits = ((int64_t)steering_magnitude * PHYSICS_FIXED_ONE) / speed_before_drag;
328
329 int64_t dragged_velocity_z_wide = (int64_t)drag_or_normalization_bits * actor_velocity->z;
330
331 actor_velocity->z = (int32_t)((uint64_t)dragged_velocity_z_wide >> PHYSICS_FIXED_FRACTION_BITS);
332 }
333
334 int64_t input_x_squared_wide = (int64_t)inout_velocity->x * inout_velocity->x;
335 int64_t input_y_squared_wide = (int64_t)inout_velocity->y * inout_velocity->y;
336 int64_t input_z_squared_wide = (int64_t)inout_velocity->z * inout_velocity->z;
337 int32_t input_magnitude_squared_q12 = ((int32_t)((int64_t)((uint64_t)input_z_squared_wide + (uint64_t)input_x_squared_wide + (uint64_t)input_y_squared_wide) >> PHYSICS_FIXED_FRACTION_BITS));
338
339 if (input_magnitude_squared_q12 <= 1)
340 {
341 controller_record->input.axis = (struct Math_Vec2I16){
342 .y = 0,
343 .x = 0};
344
345 inout_velocity->z = 0;
346 inout_velocity->x = 0;
347 }
348 else
349 {
350 controller_record->input.axis.x = inout_velocity->x;
351 controller_record->input.axis.y = inout_velocity->z;
352
353 if (input_magnitude_squared_q12 < PHYSICS_INPUT_UNIT_THRESHOLD_Q12)
354 {
355 int32_t input_magnitude_q12 = Math_SqrtFP12(input_magnitude_squared_q12);
356
357 turn_acceleration_gate = input_magnitude_q12 < PHYSICS_FIXED_HALF ? 1 - turn_acceleration_gate : 0;
358
359 int32_t input_x_before_normalize = inout_velocity->x;
360 int32_t input_z_before_normalize = inout_velocity->z;
361
362 inout_velocity->x = ((int64_t)input_x_before_normalize * PHYSICS_FIXED_ONE) / input_magnitude_q12;
363 inout_velocity->z = ((int64_t)input_z_before_normalize * PHYSICS_FIXED_ONE) / input_magnitude_q12;
364
365 int64_t input_scaled_speed_limit_wide = (int64_t)input_magnitude_q12 * inout_speed_limit_q12;
366
367 inout_speed_limit_q12 = (int32_t)((uint64_t)input_scaled_speed_limit_wide >> PHYSICS_FIXED_FRACTION_BITS);
368 }
369 }
370
371 inout_velocity_q12 = inout_velocity;
372 moving_actor = actor;
373 }
374 else
375 {
376 inout_speed_limit_q12 = Component_GetMovementSpeedLimitQ12(
377 (struct Component_MovementParametersView *)controller_record_for_movement->component_records[1].definition);
378 inout_velocity_q12 = inout_velocity;
379 acceleration_q12 = Component_GetMovementAccelerationQ12(
380 (struct Component_MovementParametersView *)((struct Player_ControllerRecordView *)moving_actor->record_ptr)->component_records[1].definition);
381
382 int16_t m02 = moving_actor->rot_mat.m02;
383
384 controller_record->input.axis.x = m02;
385 // Apply friction: reduce velocity toward zero by (currentSpeed - maxVelocity) / (currentSpeed + maxVelocity)
386 // ratio
387 inout_velocity_q12->x = (int32_t)m02;
388
389 int16_t m22 = moving_actor->rot_mat.m22;
390
391 controller_record->input.axis.y = m22;
392 acceleration_reduction_q12 = 0;
393 inout_velocity_q12->z = (int32_t)m22;
394 }
395
396 int32_t steering_x = inout_velocity_q12->x;
397
398 if (!(steering_x || inout_velocity_q12->z) || !acceleration_q12)
399 {
400 // No input or turning too sharply: copy current velocity into direction (maintain current heading)
401 inout_velocity_q12->x = actor_velocity->x;
402 inout_velocity_q12->y = actor_velocity->y;
403 inout_velocity_q12->z = actor_velocity->z;
404 }
405 else
406 {
407 // Apply acceleration: scale direction by accelRate then add current velocity to get new desired velocity
408 uint8_t movement_mode = controller_record->movement_mode;
409
410 if ((!movement_mode || movement_mode == PHYSICS_MOVE_FREE_STEERING_AIR_ROLL) && !(moving_actor->behavior_flags & ACTOR_BEHAVIOR_AIRBORNE) && (turn_acceleration_gate > 1 || (turn_acceleration_gate <= 0 && (int32_t)moving_actor->rot_mat.m22 * inout_velocity_q12->z + (int32_t)moving_actor->rot_mat.m02 * steering_x < PHYSICS_TURN_FORWARD_DOT_THRESHOLD_Q24)))
411 {
412 // No input or turning too sharply: copy current velocity into direction (maintain current heading)
413 inout_velocity_q12->x = actor_velocity->x;
414 inout_velocity_q12->y = actor_velocity->y;
415 inout_velocity_q12->z = actor_velocity->z;
416 }
417 else
418 {
419 if (movement_mode == PHYSICS_MOVE_FACING_DRIVE || movement_mode == PHYSICS_MOVE_FACING_DRIVE_AIR_ROLL)
420 {
421 inout_velocity_q12->x = (int32_t)moving_actor->rot_mat.m02;
422 inout_velocity_q12->z = (int32_t)moving_actor->rot_mat.m22;
423 }
424
425 int64_t acceleration_x_wide = (int64_t)acceleration_q12 * inout_velocity_q12->x;
426
427 inout_velocity_q12->x = (int32_t)((uint64_t)acceleration_x_wide >> PHYSICS_FIXED_FRACTION_BITS);
428
429 int64_t acceleration_y_wide = (int64_t)acceleration_q12 * inout_velocity_q12->y;
430 int32_t steering_z = inout_velocity_q12->z;
431
432 inout_velocity_q12->y = (int32_t)((uint64_t)acceleration_y_wide >> PHYSICS_FIXED_FRACTION_BITS);
433
434 int64_t acceleration_z_wide = (int64_t)acceleration_q12 * steering_z;
435 int32_t acceleration_z_q12 = (int32_t)((uint64_t)acceleration_z_wide >> PHYSICS_FIXED_FRACTION_BITS);
436 int32_t acceleration_x_q12 = inout_velocity_q12->x;
437
438 inout_velocity_q12->z = acceleration_z_q12;
439 inout_velocity_q12->x = acceleration_x_q12 + actor_velocity->x;
440 inout_velocity_q12->y += actor_velocity->y;
441 inout_velocity_q12->z = actor_velocity->z + acceleration_z_q12;
442 }
443 }
444
445 struct Actor_State *force_emitter = Collision_GetValidCollisionTarget(moving_actor, 0);
446
447 if (force_emitter)
448 Actor_UpdateGroundedState(moving_actor, controller_record,
449 Physics_ApplyCollisionForceEmitter(moving_actor, (struct Pkg_ActorRecord *)controller_record, (struct Physics_CollisionForceEmitterActorView *)force_emitter,
450 inout_velocity_q12, &inout_speed_limit_q12),
451 &vertical_velocity_component);
452
453 if (acceleration_reduction_q12 && !(moving_actor->behavior_flags & ACTOR_BEHAVIOR_AIRBORNE))
454 {
455 int32_t ground_normal_up_q12;
456 struct Pkg_CollisionFacePlane *face_plane;
457
458 if (ground_collision_node->transform_matrix.m11 != PHYSICS_FIXED_ONE)
459 {
460 face_plane = moving_actor->ground_contact_polygon->face_plane;
461 ground_normal_up_q12 = ((int32_t)face_plane->normal.z * (int32_t)ground_collision_node->transform_matrix.m12 + (int32_t)face_plane->normal.x * (int32_t)ground_collision_node->transform_matrix.m10 + (int32_t)face_plane->normal.y * (int32_t)ground_collision_node->transform_matrix.m11) >> PHYSICS_FIXED_FRACTION_BITS;
462 }
463 else
464 {
465 face_plane = moving_actor->ground_contact_polygon->face_plane;
466 ground_normal_up_q12 = (int32_t)face_plane->normal.y;
467 }
468
469 if (ground_normal_up_q12 < PHYSICS_FIXED_ONE)
470 {
471 struct Math_Vec3I16 *world_ground_normal = &face_plane->normal;
472 struct Math_Vec3I16 slope_normal;
473
475 {
476 int32_t ground_normal_local_z = (int32_t)world_ground_normal->z;
477 int32_t ground_normal_local_y = (int32_t)world_ground_normal->y;
478 int32_t ground_normal_local_x = (int32_t)world_ground_normal->x;
479 int32_t ground_normal_y_from_x = (int32_t)ground_collision_node->transform_matrix.m10 * ground_normal_local_x;
480
481 slope_normal.x = (int16_t)(((int32_t)ground_collision_node->transform_matrix.m00 * ground_normal_local_x + (int32_t)ground_collision_node->transform_matrix.m01 * ground_normal_local_y + (int32_t)ground_collision_node->transform_matrix.m02 * ground_normal_local_z) >> PHYSICS_FIXED_FRACTION_BITS);
482 slope_normal.y = (int16_t)((ground_normal_y_from_x + (int32_t)ground_collision_node->transform_matrix.m12 * ground_normal_local_z + (int32_t)ground_collision_node->transform_matrix.m11 * ground_normal_local_y) >> PHYSICS_FIXED_FRACTION_BITS);
483 slope_normal.z = (int16_t)((
484 (int32_t)ground_collision_node->transform_matrix.m20 * ground_normal_local_x + (int32_t)ground_collision_node->transform_matrix.m21 * ground_normal_local_y + (int32_t)ground_collision_node->transform_matrix.m22 * ground_normal_local_z) >>
486 world_ground_normal = &slope_normal;
487 }
488
489 int64_t slope_force_scale_wide = (int64_t)acceleration_reduction_q12 * controller_record->param_CC * 3;
490
491 // Clamp final velocity magnitude to maxSpeed; normalize and rescale if exceeded
492 int32_t slope_force_q12 = -(((int32_t)((uint64_t)slope_force_scale_wide >> PHYSICS_FIXED_FRACTION_BITS)));
493 int64_t slope_force_x_wide = (int64_t)slope_force_q12 * (int32_t)world_ground_normal->x;
494 int16_t slope_force_x_word = (int16_t)((uint64_t)slope_force_x_wide >> PHYSICS_FIXED_FRACTION_BITS);
495 int64_t slope_force_z_wide = (int64_t)slope_force_q12 * (int32_t)world_ground_normal->z;
496 int32_t slope_force_x = (int32_t)slope_force_x_word;
497 int64_t slope_force_x_squared_wide = (int64_t)slope_force_x * slope_force_x;
498 int32_t slope_force_z = (int32_t)((int16_t)((uint64_t)slope_force_z_wide >> PHYSICS_FIXED_FRACTION_BITS));
499 int64_t slope_force_z_squared_wide = (int64_t)slope_force_z * slope_force_z;
500
501 if (((int32_t)((uint64_t)slope_force_z_squared_wide >> PHYSICS_FIXED_FRACTION_BITS)) + ((int32_t)((uint64_t)slope_force_x_squared_wide >> PHYSICS_FIXED_FRACTION_BITS)) >= 7)
502 {
503 int32_t velocity_z_with_slope = inout_velocity_q12->z + slope_force_z;
504
505 inout_velocity_q12->x += slope_force_x;
506 inout_velocity_q12->z = velocity_z_with_slope;
507 }
508 }
509 }
510
511 if (steering_magnitude > inout_speed_limit_q12 + PHYSICS_SPEED_LIMIT_SLOP)
512 inout_speed_limit_q12 = steering_magnitude;
513
514 // Spin speed interpolation: smoothly adjust spin_speed toward target, handling angle wrapping at 0x1000
515 // (4096=360deg)
516 int64_t candidate_x_squared_wide = (int64_t)inout_velocity->x * inout_velocity->x;
517 int64_t candidate_y_squared_wide = (int64_t)inout_velocity->y * inout_velocity->y;
518 int64_t candidate_z_squared_wide = (int64_t)inout_velocity->z * inout_velocity->z;
519 int32_t speed_squared_q12 = ((int32_t)((int64_t)((uint64_t)candidate_z_squared_wide + (uint64_t)candidate_x_squared_wide + (uint64_t)candidate_y_squared_wide) >> PHYSICS_FIXED_FRACTION_BITS));
520 int64_t speed_limit_squared_wide = (int64_t)inout_speed_limit_q12 * inout_speed_limit_q12;
521 int32_t speed_limit_squared_q12 = (int32_t)((uint64_t)speed_limit_squared_wide >> PHYSICS_FIXED_FRACTION_BITS);
522 struct Math_Vec3I32 *movement_velocity;
523
524 if (speed_squared_q12 <= speed_limit_squared_q12)
525 movement_velocity = inout_velocity;
526 else
527 {
528 steering_magnitude = Math_SqrtFP12(speed_squared_q12);
529
530 int32_t clamp_speed_q12 = inout_speed_limit_q12;
531
532 movement_velocity = inout_velocity;
533 steering_magnitude =
534 ((int64_t)clamp_speed_q12 * PHYSICS_FIXED_ONE) / steering_magnitude;
535
536 int64_t clamped_velocity_x_wide = (int64_t)steering_magnitude * movement_velocity->x;
537
538 movement_velocity->x = (int32_t)((uint64_t)clamped_velocity_x_wide >> PHYSICS_FIXED_FRACTION_BITS);
539
540 int64_t clamped_velocity_y_wide = (int64_t)steering_magnitude * movement_velocity->y;
541
542 speed_squared_q12 = movement_velocity->z;
543 movement_velocity->y = (int32_t)((uint64_t)clamped_velocity_y_wide >> PHYSICS_FIXED_FRACTION_BITS);
544
545 int64_t clamped_velocity_z_wide = (int64_t)steering_magnitude * speed_squared_q12;
546
547 // Add external impulse from record +0x98/+0x9c/+0xa0 then clear them (one-shot force application)
548 speed_limit_squared_q12 = (int32_t)((uint64_t)clamped_velocity_z_wide >> PHYSICS_FIXED_FRACTION_BITS);
549 movement_velocity->z = speed_limit_squared_q12;
550 }
551
552 struct Actor_State *integration_actor = actor;
553 uint16_t roll_angle = integration_actor->roll_angle;
554 uint16_t facing_delta;
555
556 if ((uint16_t)roll_angle || (controller_record->movement_mode >= PHYSICS_MOVE_FACING_DRIVE_AIR_ROLL && integration_actor->behavior_flags & ACTOR_BEHAVIOR_AIRBORNE))
557 {
558 // Apply gravity (3D mode): accelerate velocity_y toward terminal velocity with jump boost from input flags
559 if (integration_actor->behavior_flags & ACTOR_BEHAVIOR_AIRBORNE)
560 {
561 facing_delta = integration_actor->facing_current - integration_actor->facing_target;
562 }
563
564 if (!(integration_actor->behavior_flags & ACTOR_BEHAVIOR_AIRBORNE) || !(uint16_t)facing_delta)
565 integration_actor->roll_angle = Math_ClampAngleDelta(0, (uint16_t)roll_angle, ACTOR_ROLL_RECENTER_STEP);
566 else
567 {
568 if ((int16_t)facing_delta > PHYSICS_ANGLE_HALF_TURN)
569 facing_delta -= PHYSICS_FIXED_ONE;
570 else if ((int16_t)facing_delta < -PHYSICS_ANGLE_HALF_TURN)
571 facing_delta += PHYSICS_FIXED_ONE;
572
573 int32_t next_roll_angle = roll_angle - 0x20;
574
575 if ((int16_t)facing_delta >= 0)
576 next_roll_angle = roll_angle + 0x20;
577
578 if ((int16_t)next_roll_angle > PHYSICS_ANGLE_HALF_TURN)
579 next_roll_angle -= PHYSICS_FIXED_ONE;
580 else if ((int16_t)next_roll_angle < -PHYSICS_ANGLE_HALF_TURN)
581 next_roll_angle += PHYSICS_FIXED_ONE;
582
583 if ((int16_t)next_roll_angle <= PHYSICS_AIR_ROLL_LIMIT)
584 {
585 if ((int16_t)next_roll_angle < -PHYSICS_AIR_ROLL_LIMIT)
586 next_roll_angle += 0x20;
587
588 integration_actor->roll_angle = (uint16_t)next_roll_angle & PHYSICS_ANGLE_MASK;
589 }
590 else
591 integration_actor->roll_angle = ((uint16_t)next_roll_angle - PHYSICS_AIR_ROLL_STEP) & PHYSICS_ANGLE_MASK;
592 }
593 }
594
595 int32_t velocity_y_before_impulse = movement_velocity->y;
596
597 movement_velocity->x += controller_record->queued_impulse_q12.x;
598
599 int32_t velocity_z_before_impulse = movement_velocity->z;
600
601 movement_velocity->y = velocity_y_before_impulse + controller_record->queued_impulse_q12.y;
602 movement_velocity->z = velocity_z_before_impulse + controller_record->queued_impulse_q12.z;
603 controller_record->queued_impulse_q12 = (struct Math_Vec3I32){
604 .z = 0,
605 .y = 0,
606 .x = 0};
607
608 actor_velocity->x = movement_velocity->x;
609 actor_velocity->y = movement_velocity->y;
610 actor_velocity->z = movement_velocity->z;
611
612 if (integration_actor->behavior_flags & ACTOR_BEHAVIOR_AIRBORNE)
613 {
614 // Gravity integration: velocity_y += gravity_accel (component+0x3C). Clamped to terminal velocity at
615 // component+0x44
616 actor_velocity->y += vertical_velocity_component;
617
618 int32_t vertical_velocity_before_gravity = integration_actor->velocity.y;
619
620 if (!controller_record->jump_phase_ticks)
621 {
622 if (vertical_velocity_before_gravity >= controller_record->movement_param_44)
623 {
624 int32_t velocity_y_after_gravity = vertical_velocity_before_gravity + controller_record->param_CC;
625
626 integration_actor->velocity.y = velocity_y_after_gravity;
627
628 int32_t terminal_fall_velocity = controller_record->movement_param_44;
629
630 if (velocity_y_after_gravity < terminal_fall_velocity)
631 integration_actor->velocity.y = terminal_fall_velocity;
632 }
633 }
634 else if (vertical_velocity_before_gravity <= controller_record->movement_param_40)
635 // JUMP IMPULSE: When jump button held (g_inputLandingFlagsPtr[3] & local_30), applies upward velocity
636 // from component+0x38
637 {
638 int32_t jump_velocity_boost;
639
640 if (!(g_inputLandingFlagsPtr[3] & (uint8_t)button_bits))
641 jump_velocity_boost = 0;
642 else
643 jump_velocity_boost = controller_record->param_C8;
644
645 int32_t velocity_y_after_jump_boost = integration_actor->velocity.y + jump_velocity_boost;
646
647 integration_actor->velocity.y = velocity_y_after_jump_boost;
648
649 int32_t jump_speed_limit = controller_record->movement_param_40;
650
651 if (velocity_y_after_jump_boost > jump_speed_limit)
652 integration_actor->velocity.y = jump_speed_limit;
653 }
654 }
655 else if ((movement_velocity->x || movement_velocity->z) && (integration_actor->child_actor->contact_basis.m00 != PHYSICS_Q14_ONE || movement_velocity->y))
656 {
657 if (movement_velocity->y)
658 {
659 int64_t untilted_x_squared_wide = (int64_t)inout_velocity->x * inout_velocity->x;
660 int64_t untilted_y_squared_wide = (int64_t)inout_velocity->y * inout_velocity->y;
661 int64_t untilted_z_squared_wide = (int64_t)inout_velocity->z * inout_velocity->z;
662
663 steering_magnitude =
664 Math_SqrtFP12(((int32_t)((int64_t)((uint64_t)untilted_z_squared_wide + (uint64_t)untilted_x_squared_wide + (uint64_t)untilted_y_squared_wide) >> PHYSICS_FIXED_FRACTION_BITS)));
665 inout_velocity->y = 0;
666
667 int64_t horizontal_x_squared_wide = (int64_t)inout_velocity->x * inout_velocity->x;
668 int64_t horizontal_y_squared_wide = (int64_t)inout_velocity->y * inout_velocity->y;
669 int64_t horizontal_z_squared_wide = (int64_t)inout_velocity->z * inout_velocity->z;
670 int32_t horizontal_speed =
671 Math_SqrtFP12(((int32_t)((int64_t)((uint64_t)horizontal_z_squared_wide + (uint64_t)horizontal_x_squared_wide + (uint64_t)horizontal_y_squared_wide) >> PHYSICS_FIXED_FRACTION_BITS)));
672
673 if (horizontal_speed)
674 {
675 steering_magnitude <<= 4;
676
677 int32_t horizontal_restore_scale_q16 = ((int64_t)steering_magnitude * PHYSICS_FIXED_ONE) / horizontal_speed;
678 int64_t restored_horizontal_x_wide = (int64_t)horizontal_restore_scale_q16 * inout_velocity->x;
679
680 inout_velocity->x = ((int32_t)((uint64_t)restored_horizontal_x_wide >> PHYSICS_FIXED_FRACTION_BITS)) >> 4;
681
682 int64_t restored_horizontal_y_wide = (int64_t)horizontal_restore_scale_q16 * inout_velocity->y;
683 int32_t horizontal_velocity_z = inout_velocity->z;
684
685 inout_velocity->y = ((int32_t)((uint64_t)restored_horizontal_y_wide >> PHYSICS_FIXED_FRACTION_BITS)) >> 4;
686
687 int64_t restored_horizontal_z_wide = (int64_t)horizontal_restore_scale_q16 * horizontal_velocity_z;
688
689 inout_velocity->z = ((int32_t)((uint64_t)restored_horizontal_z_wide >> PHYSICS_FIXED_FRACTION_BITS)) >> 4;
690 }
691 else
692 *(struct Math_Vec3I32 *)inout_velocity = (struct Math_Vec3I32){
693 .z = 0,
694 .y = 0,
695 .x = 0};
696
697 integration_actor = actor;
698 }
699
700 struct Physics_GroundTiltChildView *ground_tilt_child = (struct Physics_GroundTiltChildView *)integration_actor->child_actor;
701 int32_t tilt_x_q14 = (int32_t)ground_tilt_child->target_tilt_q14.x;
702 int32_t tilt_x_squared = tilt_x_q14 * tilt_x_q14;
703 int32_t tilt_y_q14 = (int32_t)ground_tilt_child->target_tilt_q14.y;
704 int32_t tilt_y_squared = tilt_y_q14 * tilt_y_q14;
705 int32_t tilt_z_q14 = (int32_t)ground_tilt_child->target_tilt_q14.z;
706 int32_t tilt_xy = tilt_y_q14 * tilt_x_q14;
707 int32_t tilt_zy = tilt_z_q14 * tilt_y_q14;
708 int32_t tilt_w_q14 = (int32_t)ground_tilt_child->target_tilt_q14.w;
709 int32_t tilt_zx = tilt_z_q14 * tilt_x_q14;
710 int32_t tilt_wx = tilt_w_q14 * tilt_x_q14;
711 int32_t tilt_wz = tilt_w_q14 * tilt_z_q14;
712 int32_t tilt_wy = tilt_w_q14 * tilt_y_q14;
713 struct Math_Matrix3x3I16 ground_tilt_rotation_q12;
714
715 ground_tilt_rotation_q12.m00 = (int16_t)((PHYSICS_QUATERNION_DIAGONAL_HALF_Q28 - tilt_z_q14 * tilt_z_q14 - tilt_y_squared) >> PHYSICS_QUATERNION_MATRIX_SHIFT);
716 ground_tilt_rotation_q12.m10 = (int16_t)((tilt_xy - tilt_wz) >> PHYSICS_QUATERNION_MATRIX_SHIFT);
717 ground_tilt_rotation_q12.m20 = (int16_t)((tilt_wy + tilt_zx) >> PHYSICS_QUATERNION_MATRIX_SHIFT);
718 ground_tilt_rotation_q12.m11 = (int16_t)((PHYSICS_QUATERNION_DIAGONAL_HALF_Q28 - tilt_z_q14 * tilt_z_q14 - tilt_x_squared) >> PHYSICS_QUATERNION_MATRIX_SHIFT);
719 ground_tilt_rotation_q12.m01 = (int16_t)((tilt_wz + tilt_xy) >> PHYSICS_QUATERNION_MATRIX_SHIFT);
720 ground_tilt_rotation_q12.m21 = (int16_t)((tilt_zy - tilt_wx) >> PHYSICS_QUATERNION_MATRIX_SHIFT);
721 ground_tilt_rotation_q12.m02 = (int16_t)((tilt_zx - tilt_wy) >> PHYSICS_QUATERNION_MATRIX_SHIFT);
722 ground_tilt_rotation_q12.m12 = (int16_t)((tilt_wx + tilt_zy) >> PHYSICS_QUATERNION_MATRIX_SHIFT);
723 ground_tilt_rotation_q12.m22 = (int16_t)((PHYSICS_QUATERNION_DIAGONAL_HALF_Q28 - tilt_y_squared - tilt_x_squared) >> PHYSICS_QUATERNION_MATRIX_SHIFT);
724
725 int64_t tilted_x_from_x_wide = (int64_t)(int32_t)ground_tilt_rotation_q12.m00 * inout_velocity->x;
726 int64_t tilted_x_from_y_wide = (int64_t)(int32_t)ground_tilt_rotation_q12.m01 * inout_velocity->y;
727 int64_t tilted_x_from_z_wide = (int64_t)(int32_t)ground_tilt_rotation_q12.m02 * inout_velocity->z;
728
729 actor_velocity->x = ((int32_t)((int64_t)((uint64_t)tilted_x_from_z_wide + (uint64_t)tilted_x_from_x_wide + (uint64_t)tilted_x_from_y_wide) >> PHYSICS_FIXED_FRACTION_BITS));
730
731 int64_t tilted_y_from_x_wide = (int64_t)(int32_t)ground_tilt_rotation_q12.m10 * inout_velocity->x;
732 int64_t tilted_y_from_y_wide = (int64_t)(int32_t)ground_tilt_rotation_q12.m11 * inout_velocity->y;
733 int64_t tilted_y_from_z_wide = (int64_t)(int32_t)ground_tilt_rotation_q12.m12 * inout_velocity->z;
734
735 actor_velocity->y = ((int32_t)((int64_t)((uint64_t)tilted_y_from_z_wide + (uint64_t)tilted_y_from_x_wide + (uint64_t)tilted_y_from_y_wide) >> PHYSICS_FIXED_FRACTION_BITS));
736
737 int64_t tilted_z_from_x_wide = (int64_t)(int32_t)ground_tilt_rotation_q12.m20 * inout_velocity->x;
738 int64_t tilted_z_from_y_wide = (int64_t)(int32_t)ground_tilt_rotation_q12.m21 * inout_velocity->y;
739
740 // GRAVITY APPLICATION: When actor is airborne (grounded flag 0x40 clear), adds gravity acceleration
741 // to Y velocity. Gravity value from component+0x3C (puVar2[0xF]). Jump velocity applied via
742 // render_velocity_x accumulator.
743 int64_t tilted_z_from_z_wide = (int64_t)(int32_t)ground_tilt_rotation_q12.m22 * inout_velocity->z;
744
745 actor_velocity->z = ((int32_t)((int64_t)((uint64_t)tilted_z_from_z_wide + (uint64_t)tilted_z_from_x_wide + (uint64_t)tilted_z_from_y_wide) >> PHYSICS_FIXED_FRACTION_BITS));
746 }
747}
#define ACTOR_BEHAVIOR_AIRBORNE
Definition constants.h:13
#define ACTOR_BEHAVIOR_GROUND_TILT_ENABLED
Definition constants.h:21
#define ACTOR_ROLL_RECENTER_STEP
Definition constants.h:249
#define ACTOR_REACTION_ANIMATION_TICKS
Definition constants.h:91
void Actor_UpdateGroundedState(struct Actor_State *actor, struct Player_ControllerRecordView *record, int32_t vertical_delta, int32_t *inout_vertical_accum)
Definition collision.c:1232
BOOL Actor_UpdateRotationFromVelocity(struct Actor_State *actor, struct Math_Vec3I32 const *velocity, int32_t turn_step)
Definition movement.c:532
#define COLLISION_NODE_TRANSFORM_SECONDARY
Definition constants.h:59
#define COLLISION_SURFACE_TRAIL_MASK
Definition constants.h:97
@ COLLISION_SURFACE_TRAIL_IMPACT
Definition constants.h:102
#define COLLISION_SURFACE_TRAIL_SHIFT
Definition constants.h:96
#define COLLISION_NODE_TRANSFORM_PRIMARY
Definition constants.h:58
void Collision_DetectActorCollisions(struct Actor_State *actor, BOOL use_cached_collision_list)
Definition actors.c:136
struct Actor_State * Collision_GetValidCollisionTarget(struct Actor_State *actor, int32_t collision_slot)
Definition actors.c:868
int32_t Component_GetMovementSpeedLimitQ12(struct Component_MovementParametersView *movement)
Definition properties.c:40
int32_t Component_GetMovementAccelerationQ12(struct Component_MovementParametersView *movement)
Definition properties.c:60
int16_t Component_GetMovementTurnStep(struct Component_MovementParametersView *movement)
Definition properties.c:50
@ GAME_MODE_GAMEPLAY_3D
Definition enums.h:38
#define g_currentGameMode
Definition globals.h:74
#define g_inputLandingFlagsPtr
Definition globals.h:32
int32_t Math_SqrtFP12(uint32_t value)
uint16_t Math_ClampAngleDelta(int16_t target_angle, int16_t current_angle, int16_t max_delta)
#define pkg_resource_current_level_data
Definition globals.h:117
#define PHYSICS_ANGLE_HALF_TURN
Definition constants.h:10
#define PHYSICS_BRIDGE_CENTER_Z_MAX
Definition constants.h:51
#define PHYSICS_ANGLE_MASK
Definition constants.h:8
#define PHYSICS_AIR_ROLL_LIMIT
Definition constants.h:44
#define PHYSICS_AIR_ROLL_STEP
Definition constants.h:45
#define PHYSICS_QUATERNION_DIAGONAL_HALF_Q28
Definition constants.h:32
#define PHYSICS_BRIDGE_WORLD_X_MAX
Definition constants.h:53
#define PHYSICS_TURN_FORWARD_DOT_THRESHOLD_Q24
Definition constants.h:40
#define PHYSICS_SPEED_LIMIT_SLOP
Definition constants.h:41
#define PHYSICS_BRIDGE_WORLD_X_MIN
Definition constants.h:52
#define PHYSICS_FIXED_ONE
Definition constants.h:7
#define PHYSICS_BRIDGE_WORLD_Z_MIN
Definition constants.h:48
#define PHYSICS_Q14_ONE
Definition constants.h:11
#define PHYSICS_BRIDGE_HEIGHT_MAX
Definition constants.h:54
#define PHYSICS_BRIDGE_HEIGHT_MAX_Q12
Definition constants.h:55
#define PHYSICS_QUATERNION_MATRIX_SHIFT
Definition constants.h:31
#define PHYSICS_INPUT_UNIT_THRESHOLD_Q12
Definition constants.h:39
#define PHYSICS_FIXED_FRACTION_BITS
Definition constants.h:6
@ PHYSICS_MOVE_FACING_DRIVE
Definition constants.h:25
@ PHYSICS_MOVE_FACING_DRIVE_AIR_ROLL
Definition constants.h:26
@ PHYSICS_MOVE_FREE_STEERING_AIR_ROLL
Definition constants.h:27
#define PHYSICS_FIXED_HALF
Definition constants.h:38
int32_t Physics_ApplyCollisionForceEmitter(struct Actor_State *affected_actor, struct Pkg_ActorRecord *unused_record, struct Physics_CollisionForceEmitterActorView *force_emitter, struct Math_Vec3I32 *inout_velocity_q12, int32_t *inout_speed_limit_q12)
void Physics_CalculateActorVelocity(struct Actor_State *actor, struct Math_Vec3I32 *inout_velocity, struct Math_Vec3I32 *steering_vec)
Definition movement.c:135
int32_t Physics_CalculateMovementWithCollision(struct Math_Vec3I32 const *start_pos, struct Math_Vec3I32 const *end_pos, struct Actor_State const *collision_actor, int16_t probe_radius, int32_t collision_flags)
Definition movement.c:38
struct Math_Vec3I32 velocity
Definition types.h:446
int16_t facing_current
Definition types.h:447
struct Collision_Polygon * ground_contact_polygon
Definition types.h:452
struct Collision_Node * ground_collision_node
Definition types.h:451
int32_t behavior_flags
Definition types.h:407
int16_t facing_target
Definition types.h:448
struct Math_Vec3I32 world_render_pos
Definition types.h:420
void * record_ptr
Definition types.h:477
struct Math_Matrix3x3I16 rot_mat
Definition types.h:383
int16_t roll_angle
Definition types.h:450
struct Math_Matrix3x3I16 rot_mat
Definition types.h:74
struct Component_Instance * collision_component
Definition types.h:89
int16_t collision_fraction_q12
Definition types.h:91
struct Math_Vec3I32 velocity
Definition types.h:93
struct Collision_Node * ground_collision_node
Definition types.h:95
int16_t collision_height_hi
Definition types.h:83
struct Math_Vec3I32 sweep_origin
Definition types.h:81
uint32_t behavior_flags
Definition types.h:79
struct Math_Vec3I32 sweep_delta
Definition types.h:77
uint32_t flags
Definition types.h:297
struct Math_Matrix3x3I16 transform_matrix
Definition types.h:281
uint16_t flags
Definition types.h:66
struct Pkg_CollisionFacePlane * face_plane
Definition types.h:62
struct Component_Definition * definition
Definition types.h:43
struct Actor * runtime_actor
Definition types.h:107
struct Math_Vec2I16 axis
Definition types.h:84
uint32_t button_bits
Definition types.h:83
int16_t current_entity_index
Definition types.h:43
struct Entity * entity_array
Definition types.h:45
int16_t m21
Definition types.h:169
int16_t m00
Definition types.h:162
int16_t m01
Definition types.h:163
int16_t m12
Definition types.h:167
int16_t m11
Definition types.h:166
int16_t m20
Definition types.h:168
int16_t m22
Definition types.h:170
int16_t m02
Definition types.h:164
int16_t m10
Definition types.h:165
int16_t x
Definition types.h:402
int16_t y
Definition types.h:403
int16_t z
Definition types.h:460
int16_t x
Definition types.h:458
int16_t y
Definition types.h:459
int32_t y
Definition types.h:471
int32_t x
Definition types.h:470
int32_t z
Definition types.h:472
struct Math_QuaternionI16 target_tilt_q14
Definition types.h:84
struct Math_Vec3I16 normal
Definition types.h:1135
struct Input_State input
Definition types.h:125
uint8_t configured_jump_hold_ticks
Definition types.h:153
uint16_t reaction_animation_ticks
Definition types.h:136
struct Component_CollisionRecord * component_records
Definition types.h:209
struct Math_Vec3I32 queued_impulse_q12
Definition types.h:177
struct Actor_State * Trail_SpawnFromEntry(struct Actor_State *actor, int32_t trail_index)
Definition effects.c:124