102 Dalmatians: Puppies to the Rescue
Decompilation Source Reference | GitLab repository
Loading...
Searching...
No Matches
follow.c
Go to the documentation of this file.
1/* Recovered game implementation; original addresses identify provenance. */
15#include "pcdogs/math/types.h"
20#include <math.h>
21#include <stdarg.h>
22#include <string.h>
23
24// Original pcdogs.exe: no direct counterpart (decomp helper)
25// Computes a signed matrix-row dot product, accumulating modulo 64 bits and returning the low 32 bits after a twelve-bit shift.
26static int32_t Camera_DotMatrixRowQ12(int16_t row_x, int16_t row_y, int16_t row_z, const struct Math_Vec3I32 *vector)
27{
28 uint64_t sum = (uint64_t)((int64_t)row_x * vector->x) + (uint64_t)((int64_t)row_y * vector->y) + (uint64_t)((int64_t)row_z * vector->z);
29
30 return (int32_t)(sum >> MATH_Q12_SHIFT);
31}
32
33// Original pcdogs.exe: no direct counterpart (decomp helper)
34// Computes a vector's squared length with modulo-64-bit accumulation and returns the low 32 bits after a twelve-bit shift.
35static int32_t Camera_LengthSquaredQ12(int32_t x, int32_t y, int32_t z)
36{
37 uint64_t sum = (uint64_t)((int64_t)x * x) + (uint64_t)((int64_t)y * y) + (uint64_t)((int64_t)z * z);
38
39 return (int32_t)(sum >> MATH_Q12_SHIFT);
40}
41
42// Original pcdogs.exe: no direct counterpart (decomp helper)
43// Initializes a collision sweep from the camera eye and supplied origin, preserving the native axis ordering and Q12 collision fraction.
45 const struct Camera_Pose *pose)
46{
47 probe->sweep_delta = (struct Math_Vec3I32){
48 pose->eye_pos.x - probe->sweep_origin.x,
49 pose->eye_pos.z - probe->sweep_origin.y,
50 pose->eye_pos.y - probe->sweep_origin.z};
51
52 probe->velocity = probe->sweep_delta;
54}
55
56// Original pcdogs.exe: no direct counterpart (decomp helper)
57// Multiplies two signed Q12 values and returns the low 32 bits of the product shifted right by twelve bits.
58static int32_t Camera_MultiplyQ12(int32_t a, int32_t b)
59{
60 return (int32_t)((uint64_t)((int64_t)a * b) >> MATH_Q12_SHIFT);
61}
62
63// Original pcdogs.exe: no direct counterpart (decomp helper)
64// Transforms a vector by three Q12 matrix-row dot products.
65static struct Math_Vec3I32 Camera_TransformVectorQ12(const struct Math_Matrix3x3I16 *matrix,
66 const struct Math_Vec3I32 *vector)
67{
68 return (struct Math_Vec3I32){Camera_DotMatrixRowQ12(matrix->m00, matrix->m01, matrix->m02, vector),
69 Camera_DotMatrixRowQ12(matrix->m10, matrix->m11, matrix->m12, vector),
70 Camera_DotMatrixRowQ12(matrix->m20, matrix->m21, matrix->m22, vector)};
71}
72
73// Original pcdogs.exe: 0x407ee0
74// Calculates the camera eye position from its target, pitch, yaw and distance using fixed-point trigonometry.
75void Camera_CalculatePosition(struct Camera_Pose *camera_pose, int32_t target_distance)
76{
77 int32_t vertical_offset = Camera_MultiplyQ12(target_distance,
78 Math_SinQ14(camera_pose->angle_vertical) >> 2);
79 int16_t complement_pitch = MATH_ANGLE_QUARTER_TURN - camera_pose->angle_vertical;
80
81 camera_pose->eye_pos.z = camera_pose->target_pos.z + vertical_offset;
82
83 int32_t horizontal_distance = Camera_MultiplyQ12(target_distance,
84 Math_SinQ14(complement_pitch) >> 2);
85 int32_t lateral_offset = Camera_MultiplyQ12(
86 Math_SinQ14(camera_pose->angle_horizontal) >> 2, horizontal_distance);
87 int16_t complement_yaw = MATH_ANGLE_QUARTER_TURN - camera_pose->angle_horizontal;
88
89 camera_pose->eye_pos.x = camera_pose->target_pos.x - lateral_offset;
90 camera_pose->eye_pos.y = camera_pose->target_pos.y - Camera_MultiplyQ12(Math_SinQ14(complement_yaw) >> 2, horizontal_distance);
91}
92
93// Original pcdogs.exe: 0x408460
94// Updates camera follow angles and eye position from the actor, camera definition and collision probes. Returns false while camera transitions are paused.
96 struct Actor_State *actor,
97 struct Camera_Pose *pose,
98 struct Pkg_CameraDef *definition)
99{
101 return false;
102
103 bool definition_is_current = pkg_resource_current_level_data->cam_current == definition;
104
105 if (definition_is_current)
106 *(uint8_t *)&camera->pose_state_flags |= CAMERA_POSE_FOLLOW_UPDATED;
107 else
108 {
110
111 if (!g_frameCounter)
113 }
114
115 struct Collision_Node *ground = actor->ground_collision_node;
116 int32_t direction_x, direction_z;
117 struct Math_Matrix3x3I16 matrix;
118
120 {
122 direction_x = Math_SinQ14(pose->angle_horizontal) >> 2;
123 direction_z = Math_SinQ14(MATH_ANGLE_QUARTER_TURN - pose->angle_horizontal) >> 2;
124 }
125 else
126 {
127 Math_MulMat3x3Q12(&matrix, &actor->contact_basis, &ground->transform_matrix);
128
129 if (!definition_is_current)
130 {
132
135
136 direction_x = Math_SinQ14(pose->angle_horizontal) >> 2;
137 direction_z = Math_SinQ14(MATH_ANGLE_QUARTER_TURN - pose->angle_horizontal) >> 2;
138 }
139 else if (actor->facing_blend)
140 {
141 struct Math_Vec3I32 local_forward = {
144
145 struct Math_Vec3I32 world_forward = Camera_TransformVectorQ12(&matrix, &local_forward);
146
147 pose->angle_horizontal = Math_CalculateAtan2FP12(world_forward.z, world_forward.x);
148 world_forward.y = 0;
149
150 int32_t length = Math_SqrtFP12(Camera_LengthSquaredQ12(world_forward.x, world_forward.y, world_forward.z));
151
152 if (length)
153 {
154 int32_t scale = (int32_t)(INT64_C(0x100000000) / length);
155
156 direction_x = Camera_MultiplyQ12(scale, world_forward.x) >> 8;
157 direction_z = Camera_MultiplyQ12(scale, world_forward.z) >> 8;
158 }
159 else
160 direction_x = direction_z = 0;
161 }
162 else
163 {
165 direction_x = Math_SinQ14(pose->angle_horizontal) >> 2;
166 direction_z = Math_SinQ14(MATH_ANGLE_QUARTER_TURN - pose->angle_horizontal) >> 2;
167 }
168 }
169
170 int32_t yaw = pose->angle_horizontal;
171 uint32_t input = 0;
172
175 else if (definition->flags & CAMERA_DEFINITION_AVOID_NEGATIVE_YAW)
177 else
178 {
179 uint32_t buttons = g_inputStateCurrentP1[0].button_bits;
180
181 if (buttons != INPUT_STATE_DISABLED)
182 {
183 input = buttons;
184
186 {
189 }
192 }
193
194 bool moving = actor->velocity.x || actor->velocity.z;
195
196 if (moving)
197 input = 0;
198
199 if (moving || actor->facing_current != actor->facing_target)
200 {
201 int32_t target_yaw = (actor->facing_current + actor->facing_blend) & MATH_ANGLE_WRAP_MASK;
202 int32_t delta = (target_yaw - yaw) & MATH_ANGLE_WRAP_MASK;
203
204 if (actor->facing_current == actor->facing_target && (delta & MATH_ANGLE_HALF_MASK))
205 {
206 int32_t remaining_yaw;
207
208 if (delta >= MATH_ANGLE_HALF_TURN)
209 {
211 remaining_yaw = yaw - target_yaw;
212 }
213 else
214 {
216 remaining_yaw = target_yaw - yaw;
217 }
218
219 if ((remaining_yaw & MATH_ANGLE_WRAP_MASK) > ((remaining_yaw + CAMERA_AUTOMATIC_YAW_STEP) & MATH_ANGLE_WRAP_MASK))
220 yaw = target_yaw;
221 }
222 }
223 }
224
225 if ((uint16_t)yaw != (uint16_t)pose->angle_horizontal)
226 {
228 pose->angle_horizontal = (uint16_t)yaw;
229 direction_x = Math_SinQ14(yaw) >> 2;
230 direction_z = Math_SinQ14(MATH_ANGLE_QUARTER_TURN - yaw) >> 2;
231 }
232
233 int32_t distance = Math_SqrtFP12(Camera_LengthSquaredQ12(definition->cam_offset.x, definition->cam_offset.y, definition->cam_offset.z));
234
235 pose->angle_vertical = Math_AsinRatioFP12(definition->cam_offset.y, distance) & MATH_ANGLE_WRAP_MASK;
236
237 if ((definition->flags & CAMERA_DEFINITION_FOLLOW_CHILD) && actor->child_actor)
238 {
239 int32_t height = pose->target_pos.z - actor->child_actor->position.y - definition->target_offset.y - Camera_MultiplyQ12(distance, Math_SinQ14(pose->angle_vertical) >> 2);
240
241 pose->angle_vertical = -Math_AsinRatioFP12(height, distance) & MATH_ANGLE_WRAP_MASK;
242 }
243
244 bool follow_orientation = !(actor->behavior_flags & ACTOR_BEHAVIOR_AIRBORNE);
245
246 if (!follow_orientation && ground)
247 {
248 const struct Math_Vec3I16 *normal = &actor->ground_contact_polygon->face_plane->normal;
249 int32_t dot = normal->x * ground->transform_matrix.m10 + normal->y * ground->transform_matrix.m11 + normal->z * ground->transform_matrix.m12;
250
251 follow_orientation = (int32_t)((uint32_t)dot & 0xfffff000) > CAMERA_GROUND_ALIGNMENT_THRESHOLD_Q24;
252 }
253
254 int32_t tilt = 0;
255
256 if (follow_orientation)
257 {
258 const struct Math_Matrix3x3I16 *contact_quaternion = &actor->child_actor->contact_basis;
259 int32_t w = contact_quaternion->m00, x = contact_quaternion->m01, y = contact_quaternion->m02, z = contact_quaternion->m10;
260 int16_t up_basis[3] = {(x * y - w * z) >> 15,
261 (CAMERA_UP_BASIS_SQUARED_SCALE - z * z - x * x) >> 15,
262 (w * x + z * y) >> 15};
263 struct Math_Vec3I32 forward = {direction_x * CAMERA_DIRECTION_NORMALIZATION_SCALE, 0, direction_z * CAMERA_DIRECTION_NORMALIZATION_SCALE};
264
265 tilt = Math_AsinRatioFP12(-Camera_DotMatrixRowQ12(up_basis[0], up_basis[1], up_basis[2], &forward), CAMERA_NORMALIZED_DIRECTION_LENGTH);
266 pose->angle_vertical = (pose->angle_vertical + (uint16_t)tilt) & MATH_ANGLE_WRAP_MASK;
267
268 if ((int16_t)tilt > MATH_ANGLE_HALF_TURN)
269 tilt -= MATH_Q12_ONE;
270 }
271
272 int32_t horizontal_distance = Camera_MultiplyQ12(distance, Math_SinQ14(MATH_ANGLE_QUARTER_TURN - pose->angle_vertical) >> 2);
273
274 pose->eye_pos.x = pose->target_pos.x - Camera_MultiplyQ12(direction_x, horizontal_distance);
275 pose->eye_pos.z = pose->target_pos.z + Camera_MultiplyQ12(distance, Math_SinQ14(pose->angle_vertical) >> 2);
276 pose->eye_pos.y = pose->target_pos.y - Camera_MultiplyQ12(direction_z, horizontal_distance);
277
278 struct Camera_CollisionProbeView probe;
279
280 probe.rot_mat = actor->rot_mat;
281 probe.collision_component = 0;
284 probe.sweep_origin = actor->world_render_pos;
285 probe.sweep_origin.y += actor->collision_height_hi;
286 probe.collision_height = actor->collision_height;
287 probe.collision_height_hi = actor->collision_height_hi >> 4;
288 probe.collision_radius = actor->collision_radius;
289 probe.cull_radius = actor->cull_radius;
293 Collision_DetectActorCollisions((struct Actor_State *)&probe, 0);
294
295 int16_t collision_pitch = MATH_ANGLE_HALF_TURN;
296
298 {
299 struct Math_Vec3I32 offset = {0, 0, (actor->collision_radius - CAMERA_COLLISION_PROBE_RADIUS_Q6) * 64};
300
301 offset = Camera_TransformVectorQ12(&actor->rot_mat, &offset);
302
303 struct Math_Vec3I32 left = {probe.sweep_origin.x - offset.x,
304 probe.sweep_origin.y - offset.y,
305 probe.sweep_origin.z - offset.z};
306 struct Math_Vec3I32 right = {probe.sweep_origin.x + offset.x,
307 probe.sweep_origin.y + offset.y,
308 probe.sweep_origin.z + offset.z};
309
310 if (!probe.collision_fraction_q12)
311 {
312 int32_t fraction = Physics_CalculateMovementWithCollision(&left, &right, actor, CAMERA_COLLISION_PROBE_RADIUS_Q6, 0);
313
314 if (fraction)
315 {
316 right.x += Camera_MultiplyQ12(fraction, left.x - right.x);
317 right.y += Camera_MultiplyQ12(fraction, left.y - right.y);
318 right.z += Camera_MultiplyQ12(fraction, left.z - right.z);
319 }
320
322
323 if (fraction)
324 {
325 left.x += Camera_MultiplyQ12(fraction, right.x - left.x);
326 left.y += Camera_MultiplyQ12(fraction, right.y - left.y);
327 left.z += Camera_MultiplyQ12(fraction, right.z - left.z);
328 }
329 }
330
331 bool collision_probe_resolved = false;
332
333 while (true)
334 {
336 {
337 for (int retry = 0; retry < CAMERA_YAW_RETRY_BATCH_SIZE; ++retry)
338 {
340 Camera_CalculatePosition(pose, distance);
341
342 if (!probe.collision_fraction_q12)
343 {
344 const struct Math_Vec3I32 *eye = (const struct Math_Vec3I32 *)&pose->eye_pos;
345
347 {
348 collision_probe_resolved = true;
349
350 break;
351 }
352 }
353 else
354 {
356 Collision_DetectActorCollisions((struct Actor_State *)&probe, 1);
357
358 if (probe.collision_fraction_q12 == MATH_Q12_ONE)
359 {
360 collision_probe_resolved = true;
361
362 break;
363 }
364 }
365 }
366
367 if (collision_probe_resolved)
368 break;
369 }
370
371 int32_t expanded_distance = distance + actor->cull_radius * CAMERA_OBSTRUCTION_RADIUS_EXPANSION_Q6;
372
373 horizontal_distance = Camera_MultiplyQ12(expanded_distance, Math_SinQ14(MATH_ANGLE_QUARTER_TURN - tilt) >> 2);
374
375 struct Math_Vec3I32 behind = {
376 actor->position.x - Camera_MultiplyQ12(Math_SinQ14(pose->angle_horizontal) >> 2, horizontal_distance),
377 actor->position.y + Camera_MultiplyQ12(expanded_distance, Math_SinQ14(tilt) >> 2),
378 actor->position.z - Camera_MultiplyQ12(Math_SinQ14(MATH_ANGLE_QUARTER_TURN - pose->angle_horizontal) >> 2, horizontal_distance)};
379
380 int32_t right_collision_fraction = Physics_CalculateMovementWithCollision(&right, &behind, actor, CAMERA_COLLISION_PROBE_RADIUS_Q6, 0);
381
382 if (right_collision_fraction && Physics_CalculateMovementWithCollision(&left, &behind, actor, CAMERA_COLLISION_PROBE_RADIUS_Q6, 0))
383 break;
384
386 {
387 collision_probe_resolved = true;
388
389 break;
390 }
391
393 break;
394
395 int32_t actor_yaw = Math_CalculateAtan2FP12(
396 actor->world_render_pos.z - pose->eye_pos.y,
397 actor->world_render_pos.x - pose->eye_pos.x);
398 int32_t delta = ((right_collision_fraction ? MATH_ANGLE_HALF_TURN : 0) + actor->facing_blend + actor->facing_current - actor_yaw) & MATH_ANGLE_WRAP_MASK;
399
400 if (!(delta & MATH_ANGLE_HALF_MASK))
401 break;
402
404 }
405
406 if (!collision_probe_resolved)
407 {
409
410 int32_t dx = Camera_MultiplyQ12(probe.collision_fraction_q12, probe.sweep_delta.x);
411 int32_t dz = Camera_MultiplyQ12(probe.collision_fraction_q12, probe.sweep_delta.z);
412 int16_t pitch = Math_AcosRatioFP12(
413 Math_SqrtFP12(Camera_MultiplyQ12(dx, dx) + Camera_MultiplyQ12(dz, dz)), distance);
414
415 if (pitch >= MATH_ANGLE_QUARTER_TURN)
417 else if (pitch > CAMERA_PITCH_PROBE_MINIMUM)
418 {
423 Collision_DetectActorCollisions((struct Actor_State *)&probe, 1);
424
425 if (probe.collision_fraction_q12 == MATH_Q12_ONE)
426 pitch = pose->angle_vertical;
427 }
428
429 collision_pitch = pitch;
430 pose->angle_vertical = pitch;
431 Camera_CalculatePosition(pose, distance);
432 }
433 }
434 else
436
437 int32_t delta = (pose->angle_vertical - camera->look_pitch) & MATH_ANGLE_WRAP_MASK;
438
439 if (delta)
440 {
441 if (collision_pitch != MATH_ANGLE_HALF_TURN)
442 {
443 if (delta > MATH_ANGLE_HALF_TURN)
444 {
445 delta -= MATH_Q12_ONE;
446
447 if (delta < -CAMERA_PITCH_COARSE_STEP)
449 else if (delta < -CAMERA_PITCH_MEDIUM_STEP)
450 delta = -CAMERA_PITCH_FINE_STEP;
451 }
452 else if (delta > CAMERA_PITCH_COARSE_THRESHOLD)
454 else if (delta > CAMERA_PITCH_COARSE_STEP)
456 else if (delta > CAMERA_PITCH_MEDIUM_STEP)
458 }
459 else if (delta > MATH_ANGLE_HALF_TURN)
460 {
461 delta -= MATH_Q12_ONE;
462
463 if (delta < -CAMERA_PITCH_FINE_STEP)
465 else if (delta < -CAMERA_PITCH_SMOOTH_STEP)
467 }
468 else if (delta > CAMERA_PITCH_FINE_STEP)
470 else if (delta > CAMERA_PITCH_SMOOTH_STEP)
472
473 pose->angle_vertical = (camera->look_pitch + delta) & MATH_ANGLE_WRAP_MASK;
474 Camera_CalculatePosition(pose, distance);
475 }
476
477 return true;
478}
479
480// Original pcdogs.exe: 0x444ad0
481// Recomputes camera pitch and yaw from the eye-to-target displacement and returns its fixed-point length. Invalid-angle sentinels leave the corresponding angle unchanged.
483{
484 int64_t lateral_square, vertical_square, depth_square, lateral_vertical_squares;
485 int32_t target_vertical = pose->target_pos.z;
486 int32_t eye_vertical = pose->eye_pos.z;
487 int32_t eye_depth = pose->eye_pos.y;
488 int32_t lateral_delta = pose->target_pos.x - pose->eye_pos.x;
489 int32_t vertical_delta = target_vertical - eye_vertical;
490 int32_t depth_delta = pose->target_pos.y - eye_depth;
491
492 lateral_square = (int64_t)lateral_delta * lateral_delta;
493
494 vertical_square = (int64_t)vertical_delta * vertical_delta;
495
496 lateral_vertical_squares = lateral_square + vertical_square;
497
498 depth_square = (int64_t)depth_delta * depth_delta;
499
500 int32_t distance = Math_SqrtFP12((int32_t)((depth_square + lateral_vertical_squares) >> MATH_Q12_SHIFT));
501 int16_t horizontal_angle = Math_CalculateAtan2FP12(depth_delta, lateral_delta);
502
503 if (horizontal_angle != MATH_Q12_ONE)
504
505 pose->angle_horizontal = horizontal_angle;
506
507 int32_t vertical_angle = Math_AsinRatioFP12(vertical_delta, distance);
508
509 if ((uint16_t)vertical_angle != MATH_Q12_ONE)
510 pose->angle_vertical = (int16_t)-(vertical_angle)&MATH_ANGLE_WRAP_MASK;
511
512 return distance;
513}
#define ACTOR_BEHAVIOR_AIRBORNE
Definition constants.h:13
#define ACTOR_BEHAVIOR_GROUND_BASIS_CHANGED
Definition constants.h:32
#define ACTOR_BEHAVIOR_GROUND_TILT_ENABLED
Definition constants.h:21
#define CAMERA_PITCH_SMOOTH_STEP
Definition constants.h:46
#define CAMERA_DEFINITION_AVOID_POSITIVE_YAW
Definition constants.h:12
#define CAMERA_YAW_RETRY_BATCH_SIZE
Definition constants.h:66
#define CAMERA_UP_BASIS_SQUARED_SCALE
Definition constants.h:51
#define CAMERA_GROUND_ALIGNMENT_THRESHOLD_Q24
Definition constants.h:53
#define CAMERA_PITCH_PROBE_MAXIMUM
Definition constants.h:39
#define CAMERA_FOLLOW_BASIS_TOLERANCE_RANGE_Q12
Definition constants.h:48
#define CAMERA_PITCH_PROBE_DISTANCE_PADDING_Q12
Definition constants.h:40
#define CAMERA_PITCH_PROBE_LOW
Definition constants.h:36
#define CAMERA_PITCH_MEDIUM_STEP
Definition constants.h:42
#define CAMERA_PITCH_COARSE_THRESHOLD
Definition constants.h:44
#define CAMERA_AUTOMATIC_YAW_STEP
Definition constants.h:21
#define CAMERA_MANUAL_YAW_STEP
Definition constants.h:22
#define CAMERA_DIRECTION_NORMALIZATION_SCALE
Definition constants.h:49
#define CAMERA_DEFINITION_AVOID_NEGATIVE_YAW
Definition constants.h:13
#define CAMERA_NORMALIZED_DIRECTION_LENGTH
Definition constants.h:52
#define CAMERA_DEFINITION_FOLLOW_CHILD
Definition constants.h:14
#define CAMERA_PITCH_PROBE_MINIMUM
Definition constants.h:35
#define CAMERA_OBSTRUCTION_RADIUS_EXPANSION_Q6
Definition constants.h:50
#define CAMERA_PITCH_PROBE_HIGH
Definition constants.h:38
#define CAMERA_PITCH_COARSE_STEP
Definition constants.h:43
#define CAMERA_COLLISION_PROBE_RADIUS_Q6
Definition constants.h:65
#define CAMERA_PITCH_FINE_STEP
Definition constants.h:41
#define CAMERA_POSE_FOLLOW_UPDATED
Definition constants.h:18
#define CAMERA_PITCH_SMOOTH_FINE_STEP
Definition constants.h:45
#define CAMERA_PITCH_PROBE_MIDDLE
Definition constants.h:37
#define CAMERA_FOLLOW_BASIS_TOLERANCE_Q12
Definition constants.h:47
#define g_cameraPreviousYaw
Definition globals.h:42
#define g_cameraTransitionPaused
Definition globals.h:45
@ COLLISION_CLASS_CAMERA_PROBE
Definition constants.h:15
@ COLLISION_NODE_ORIENTED_BOX
Definition constants.h:8
void Collision_DetectActorCollisions(struct Actor_State *actor, BOOL use_cached_collision_list)
Definition actors.c:136
bool Camera_CalculateFollowAngles(struct Camera_Runtime *camera, struct Actor_State *actor, struct Camera_Pose *pose, struct Pkg_CameraDef *definition)
Definition follow.c:95
int32_t Camera_RecomputePitchYawFromEyeTarget(struct Camera_Pose *pose)
Definition follow.c:482
static int32_t Camera_MultiplyQ12(int32_t a, int32_t b)
Definition follow.c:58
void Camera_CalculatePosition(struct Camera_Pose *camera_pose, int32_t target_distance)
Definition follow.c:75
static struct Math_Vec3I32 Camera_TransformVectorQ12(const struct Math_Matrix3x3I16 *matrix, const struct Math_Vec3I32 *vector)
Definition follow.c:65
static void Camera_InitializeCollisionProbeSweep(struct Camera_CollisionProbeView *probe, const struct Camera_Pose *pose)
Definition follow.c:44
static int32_t Camera_LengthSquaredQ12(int32_t x, int32_t y, int32_t z)
Definition follow.c:35
static int32_t Camera_DotMatrixRowQ12(int16_t row_x, int16_t row_y, int16_t row_z, const struct Math_Vec3I32 *vector)
Definition follow.c:26
#define INPUT_STATE_DISABLED
Definition constants.h:20
#define INPUT_BUTTON_LEFT_TRIGGER
Definition constants.h:12
#define INPUT_BUTTON_CAMERA_YAW_NEGATIVE
Definition constants.h:14
#define INPUT_BUTTON_CAMERA_YAW_POSITIVE
Definition constants.h:15
#define INPUT_BUTTON_RIGHT_TRIGGER
Definition constants.h:13
#define g_inputStateCurrentP1
Definition globals.h:72
#define MATH_Q12_SHIFT
Definition constants.h:8
#define MATH_ANGLE_QUARTER_TURN
Definition constants.h:15
#define MATH_ANGLE_HALF_MASK
Definition constants.h:17
#define MATH_ANGLE_WRAP_MASK
Definition constants.h:16
#define MATH_Q12_ONE
Definition constants.h:9
#define MATH_ANGLE_HALF_TURN
Definition constants.h:14
int32_t Math_SinQ14(int32_t angle)
int32_t Math_SqrtFP12(uint32_t value)
int32_t Math_AcosRatioFP12(int32_t numerator, int32_t denominator)
void Math_MulMat3x3Q12(struct Math_Matrix3x3I16 *out_matrix, struct Math_Matrix3x3I16 const *right_factor, struct Math_Matrix3x3I16 const *left_factor)
Definition matrices.c:11
int16_t Math_CalculateAtan2FP12(int32_t y, int32_t x)
int32_t Math_AsinRatioFP12(int32_t numerator, int32_t denominator)
int32_t Math_CalculateAtan2Fast(int32_t y, int32_t x)
#define pkg_resource_current_level_data
Definition globals.h:117
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
struct Math_Matrix3x3I16 contact_basis
Definition types.h:380
int16_t facing_current
Definition types.h:447
int16_t cull_radius
Definition types.h:424
struct Actor_State * child_actor
Definition types.h:478
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 collision_radius
Definition types.h:423
int16_t facing_target
Definition types.h:448
struct Math_Vec3I32 world_render_pos
Definition types.h:420
int16_t collision_height
Definition types.h:421
int16_t collision_height_hi
Definition types.h:422
int16_t facing_blend
Definition types.h:449
struct Math_Matrix3x3I16 rot_mat
Definition types.h:383
struct Math_Vec3I32 position
Definition types.h:385
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 Collision_Polygon * ground_contact_polygon
Definition types.h:96
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
int16_t angle_vertical
Definition types.h:159
struct Math_Vec3I32XZY eye_pos
Definition types.h:164
int16_t angle_horizontal
Definition types.h:160
struct Math_Vec3I32XZY target_pos
Definition types.h:165
int16_t pose_state_flags
Definition types.h:255
int16_t look_pitch
Definition types.h:257
uint8_t node_type
Definition types.h:286
struct Math_Matrix3x3I16 transform_matrix
Definition types.h:281
struct Pkg_CollisionFacePlane * face_plane
Definition types.h:62
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 m22
Definition types.h:170
int16_t m02
Definition types.h:164
int16_t m10
Definition types.h:165
int16_t z
Definition types.h:460
int16_t x
Definition types.h:458
int16_t y
Definition types.h:459
int32_t x
Definition types.h:482
int32_t z
Definition types.h:483
int32_t y
Definition types.h:484
int32_t y
Definition types.h:471
int32_t x
Definition types.h:470
int32_t z
Definition types.h:472
struct Pkg_CameraDef::@025200157226127377100327225206264140320351074277 target_offset
int32_t z
Definition types.h:190
uint8_t flags
Definition types.h:180
int32_t x
Definition types.h:188
int32_t y
Definition types.h:189
struct Pkg_CameraDef::@210005072027223003043342324112202256330206330217 cam_offset
struct Math_Vec3I16 normal
Definition types.h:1135
#define g_frameCounter
Definition values.h:501