102 Dalmatians: Puppies to the Rescue
Decompilation Source Reference | GitLab repository
Loading...
Searching...
No Matches
events.c
Go to the documentation of this file.
1/* Recovered game implementation; original addresses identify provenance. */
13#include "pcdogs/game/types.h"
16#include "pcdogs/math/types.h"
21#include <math.h>
22#include <stdarg.h>
23#include <string.h>
24
25// Original pcdogs.exe: 0x42f260
26// Returns the fixed collision cooldown of 15 frames and ignores the actor argument.
28{
29 (void)actor;
31}
32
33// Original pcdogs.exe: 0x42fda0
34// Handles projectile collision probes and contacts, recording hit actors, impact data and cooldowns. Negative depth values select probe behavior, and at most six contacts are recorded.
35int32_t Collision_ProcessProjectileHit(void *subject, void *other_object, struct Collision_Polygon *collision_poly, int32_t collision_depth)
36{
37 struct Component_ProjectileActorView *projectile = subject;
38 struct Actor_State *other_actor = other_object;
39
40 if (collision_depth == COLLISION_CALLBACK_CONTACT_PROBE)
41 {
42 return Collision_HandleComponentCollision(projectile, other_actor);
43 }
44
45 if (collision_depth == COLLISION_CALLBACK_DAMAGE_PROBE)
46 return Collision_CheckEnemyCanBeHit(projectile, other_actor);
47
48 int32_t hit_actor_type = (uint8_t)(other_actor->actor_type);
49 struct Math_Vec3I32 impact_motion;
50
52 switch (hit_actor_type)
53 {
56 {
57 struct Component_SpawnParams *spawn_params = projectile->spawn_context;
58
59 if (!spawn_params->definition->homing_strength)
60 spawn_params->homing_response_scale = MATH_Q12_ONE;
61 else if (MATH_Q12_ONE - collision_depth > (int32_t)spawn_params->homing_response_scale)
62 {
63 impact_motion = (struct Math_Vec3I32){
64 .x = projectile->sub_pos.x - other_actor->sub_pos.x,
65 .y = projectile->sub_pos.y - other_actor->sub_pos.y,
66 .z = projectile->sub_pos.z - other_actor->sub_pos.z,
67 };
68
69 struct
70 {
71 struct Math_Vec3I16 normal;
72 uint8_t reserved[2];
73 } normal_record;
74
75 if (Physics_CheckGroundSlopeDirection(other_actor, collision_poly, &normal_record.normal, &impact_motion))
76 {
77 spawn_params = projectile->spawn_context;
78 /* The original copies two dwords, including scratch bytes after the three normal components. */
79 spawn_params->impact_normal = normal_record.normal;
80 spawn_params->pad_104[0] = normal_record.reserved[0];
81 spawn_params->pad_104[1] = normal_record.reserved[1];
82 spawn_params->impact_delta = impact_motion;
83 spawn_params->homing_response_scale = MATH_Q12_ONE - collision_depth;
84 }
85 }
86
87 int32_t behavior_flags = projectile->behavior_flags;
88
89 if ((behavior_flags & ACTOR_BEHAVIOR_PREPROCESSED))
90 return ((behavior_flags & COLLISION_PROJECTILE_RESPONSE_POLARITY) ? 1 : -1);
91
92 return (behavior_flags & COLLISION_PROJECTILE_RESPONSE_POLARITY) ? -1 : 1;
93 }
94
96 {
97 char needs_contact_position = 0;
98 uint8_t hit_response_policy = 1;
99 struct Component_SpawnParams *spawn_params_hits = projectile->spawn_context;
100 uint8_t collision_class_or_hit_index = other_actor->collision_class;
101 struct Component_Definition *definition = spawn_params_hits->definition;
102
103 if (collision_class_or_hit_index != COLLISION_ACTOR_CLASS_PROJECTILE)
104 {
105 if (collision_class_or_hit_index != COLLISION_ACTOR_CLASS_CHARACTER)
106 {
107 if (collision_class_or_hit_index == COLLISION_ACTOR_CLASS_POWERUP)
108 {
109 hit_response_policy = 0;
110 needs_contact_position = 1;
111 }
112 }
113 else
114 {
115 if (!definition->damage_amount)
116 break;
117
118 needs_contact_position = 1;
119
120 if (definition->flags_high & (COMPONENT_FLAG_REJECT_HIT_RESPONSE >> 8))
121 hit_response_policy = 0;
122 }
123 }
124 else
125 {
126 uint32_t flags = definition->flags;
127 struct Component_Definition *other_definition =
128 ((const struct Component_SpawnParams *)other_actor->record_ptr)->definition;
129
131 {
132 hit_response_policy = 0;
133 needs_contact_position = 1;
134 }
135 else if ((flags & COMPONENT_FLAG_REJECT_HIT_RESPONSE))
136 hit_response_policy = 0;
138 spawn_params_hits->homing_response_scale = MATH_Q12_ONE;
139 else
140 {
141 if (!Collision_RegisterHitEvent((struct Component_HitEvent *)(&spawn_params_hits->hit_events), other_actor))
142 break;
143
144 hit_response_policy = 0;
145 }
146 }
147
148 collision_class_or_hit_index = spawn_params_hits->hit_count;
149
150 if (collision_class_or_hit_index < COLLISION_MAX_PROJECTILE_CONTACTS)
151 {
152 int32_t depth_write_index;
153
154 spawn_params_hits->hit_actors[(uint32_t)collision_class_or_hit_index] = (struct Actor *)(other_actor);
155 depth_write_index = spawn_params_hits->hit_count;
156 spawn_params_hits->hit_depths[depth_write_index] = (uint16_t)collision_depth;
157
158 if (needs_contact_position)
159 {
160 int32_t position_write_index = (uint8_t)(spawn_params_hits->hit_count);
161
162 Collision_CalculateImpactContactData((struct Actor_State *)(projectile), other_actor,
163 collision_depth, &spawn_params_hits->hit_positions[position_write_index],
164 &impact_motion);
165 }
166
167 spawn_params_hits->hit_count += 1;
168 }
169
170 return hit_response_policy ? -1 : 0;
171 }
172
174 {
176 return 1;
177
178 Actor_ResetChainState(other_actor, collision_depth);
179
180 break;
181 }
182 }
183
184 return 0;
185}
186
187// Original pcdogs.exe: 0x430040
188// Checks hit admission and stores an event in the first expired slot of the eight-entry table. It still returns true when admission succeeds but every slot is occupied.
190{
191 // Check if hit event already exists for this component+birth timestamp pair
192 struct Component_HitEvent *event = hit_events;
193 uint8_t result =
194 Collision_CanRegisterHitEvent(event, actor, (uint32_t)((const struct Component_SpawnParams *)actor->record_ptr)->spawn_frame);
195
196 if (!result) // Loop through 8 hit event slots
197 return result;
198
199 int32_t occupied_slots_scanned = 0;
200
201 while ((uint32_t)event->frame_range.max >= (uint32_t)g_frameCounter) // Store component pointer in hit event slot+0
202 {
203 occupied_slots_scanned += 1;
204 event = &event[1]; // Store current frame counter in hit event slot+4
205
206 if (occupied_slots_scanned >= 8)
207 {
208 return 1;
209 }
210 }
211
212 event->actor = (struct Actor *)(actor);
213 // Store expiration frame in hit event slot+8
214 event->frame_range.min = g_frameCounter;
215 event->frame_range.max = COLLISION_HIT_COOLDOWN_FRAMES + g_frameCounter;
216
217 return 1;
218}
219
220// Original pcdogs.exe: 0x4300b0
221// Checks eight hit entries for a matching actor and spawn key. It rejects only a prior-frame match whose cooldown remains active; same-frame and expired matches are allowed.
222uint8_t Collision_CanRegisterHitEvent(struct Component_HitEvent *hit_events, struct Actor_State *actor, int32_t actor_collision_key)
223{
224 struct Component_HitEvent *event_cursor = hit_events;
225
226 for (int32_t i = 0; i < 8;)
227 {
228 struct Actor *event_actor = event_cursor->actor;
229
230 if ((void *)event_actor == (void *)actor && event_actor->record_ptr->local_vars[2] == actor_collision_key)
231 {
232 int32_t current_frame = g_frameCounter;
233
234 if (event_cursor->frame_range.min != current_frame)
235 return (uint32_t)current_frame >= (uint32_t)event_cursor->frame_range.max;
236
237 break;
238 }
239
240 i += 1;
241 event_cursor = &event_cursor[1];
242 }
243
244 return 1;
245}
246
247// Original pcdogs.exe: 0x430100
248// Returns -1 for type-4 targets with render layer at most 11, otherwise zero; the component argument is ignored.
250{
251 (void)comp;
252 return ((other_actor->actor_type == COLLISION_TARGET_CHAIN && other_actor->render_layer <= COLLISION_DAMAGEABLE_CHAIN_MAX_RENDER_LAYER) ? -1 : 0);
253}
254
255// Original pcdogs.exe: 0x430750
256// Updates projectile ownership, delayed activation, child spawning, attachments and fade or destruction state. The subtype is read as a signed 16-bit value.
258{
259 struct Actor_State *projectile_actor = actor;
260 /* Native MOVSX reads subtype at +F0; adjacent +F2 is separate state. */
261 int32_t projectile_subtype = (int16_t)projectile_actor->rotation;
262
263 if (projectile_actor->behavior_flags & ACTOR_BEHAVIOR_FADE_DESTROY)
264 {
265 if (Actor_UpdateFadeOut(projectile_actor, 0) && projectile_subtype == COMPONENT_ACTOR_PROJECTILE)
266 {
267 struct Component_Definition *expiring_definition =
268 ((const struct Component_SpawnParams *)projectile_actor->record_ptr)->definition;
269
270 expiring_definition->active_instance_count -= 1;
271 }
272 }
273 else if (projectile_subtype == COMPONENT_ACTOR_PROJECTILE)
274 {
275 struct Component_SpawnParams *spawn_params = projectile_actor->record_ptr;
276 int32_t projectile_hit_count = 0;
277 struct Actor_State *owner_actor = (struct Actor_State *)(spawn_params->owner);
278 struct Component_Definition *definition = spawn_params->definition;
279 struct Component_Definition *saved_definition = definition;
280 uint8_t released_reference_count;
281
282 if (owner_actor)
283 {
284 if (owner_actor->lifecycle_flags & ACTOR_LIFECYCLE_DESTROYING ||
285 (owner_actor->behavior_flags & ACTOR_BEHAVIOR_GROUND_TRACKING && ((const struct Player_ControllerRecordView *)owner_actor->record_ptr)->death_stage == ACTOR_DEATH_WAIT_FOR_LANDING))
286 {
287 released_reference_count = owner_actor->attach_refcount;
288
289 if (released_reference_count)
290 owner_actor->attach_refcount = released_reference_count - 1;
291
292 spawn_params->owner = 0;
293
294 uint8_t lifecycle_flags = projectile_actor->lifecycle_flags;
295
297 {
298 Actor_DetachFromParent(projectile_actor);
299 lifecycle_flags = projectile_actor->lifecycle_flags & (uint8_t)~ACTOR_LIFECYCLE_DISABLED;
300 projectile_actor->fade_timer = 1;
301 projectile_actor->lifecycle_flags = lifecycle_flags;
302 }
303 }
304 }
305
306 uint8_t cleared_projectile_state_flags = spawn_params->state_flags & (uint8_t)~COMPONENT_STATE_TARGET_CLEARED;
307
308 spawn_params->state_flags = cleared_projectile_state_flags;
309
310 if (cleared_projectile_state_flags & COMPONENT_STATE_HAS_TARGET)
311 {
312 struct Actor_State *attached_actor = (struct Actor_State *)spawn_params->attached_actor;
313
314 if ((uintptr_t)attached_actor != UINT32_MAX && attached_actor->lifecycle_flags & ACTOR_LIFECYCLE_DESTROYING)
315 {
316 released_reference_count = attached_actor->attach_refcount;
317
318 if (released_reference_count)
319 attached_actor->attach_refcount = released_reference_count - 1;
320
321 uint8_t state_flags = spawn_params->state_flags;
322
323 spawn_params->attached_actor = NULL;
324 state_flags &= (uint8_t)~COMPONENT_STATE_HAS_TARGET;
325 spawn_params->state_flags = state_flags;
326 }
327 }
328
329 uint8_t lifecycle_flags = projectile_actor->lifecycle_flags;
330
332 {
333 uint8_t collision_class = projectile_actor->collision_class;
334 struct Actor_State *spawned_followup_actor = NULL;
335
337 {
338 int32_t recorded_hit_count;
339 int32_t attachment_hit_counter = 0;
340
341 recorded_hit_count = spawn_params->hit_count;
342
343 int32_t followup_target_hit_index = 0xffffffff;
344 int32_t hit_scan_index = recorded_hit_count - 1;
345 int32_t projectile_hit_indices[COLLISION_MAX_PROJECTILE_CONTACTS];
346
347 if (recorded_hit_count)
348 {
349 struct Actor **hit_actor_cursor = &spawn_params->hit_actors[hit_scan_index];
350 int32_t *hit_index_write_cursor = (int32_t *)(&projectile_hit_indices);
351 int16_t *hit_depth_cursor = &spawn_params->hit_depths[hit_scan_index];
352 int32_t previous_hit_scan_index;
353
354 do
355 {
356 int32_t hit_depth = (uint16_t)(*(uint16_t *)hit_depth_cursor);
357
358 if (hit_depth <= (int32_t)projectile_actor->scale_factor)
359 {
360 int32_t collision_class =
361 (int32_t)(*(struct Actor_State **)hit_actor_cursor)->collision_class;
362
364 followup_target_hit_index = hit_scan_index;
366 {
367 *(uint32_t *)hit_index_write_cursor = hit_scan_index;
368 attachment_hit_counter += 1;
369 hit_index_write_cursor = &hit_index_write_cursor[1];
370 }
371 }
372
373 previous_hit_scan_index = hit_scan_index;
374 hit_scan_index -= 1;
375 hit_depth_cursor -= 1;
376 hit_actor_cursor -= 1;
377 } while (previous_hit_scan_index);
378
379 definition = saved_definition;
380 projectile_hit_count = attachment_hit_counter;
381 }
382
384 {
385 attachment_hit_counter = projectile_hit_count - 1;
386
387 if (projectile_hit_count)
388 {
389 int32_t *attachment_hit_index_cursor = &projectile_hit_indices[projectile_hit_count - 1];
390 int32_t hit_indices_remaining = projectile_hit_count;
391
392 do
393 {
394 int32_t attachment_hit_index = *(uint32_t *)attachment_hit_index_cursor;
395
396 Component_AttachToOwner(projectile_actor, (struct Component_ProjectileActorView *)(spawn_params->hit_actors[attachment_hit_index]),
397 &spawn_params->hit_positions[attachment_hit_index]);
398 hit_indices_remaining -= 1;
399 attachment_hit_index_cursor -= 1;
400 attachment_hit_counter -= 1;
401 } while (hit_indices_remaining > 0);
402
403 definition = saved_definition;
404 }
405 }
406
407 if (followup_target_hit_index >= 0)
408 {
409 struct Actor_State *followup_actor_result = Component_SpawnFollowupProjectile(
410 definition, projectile_actor, (struct Actor_State *)(spawn_params->hit_actors[followup_target_hit_index]));
411
412 spawned_followup_actor = followup_actor_result;
413
414 if (followup_actor_result && !(definition->flags & (COMPONENT_FLAG_FOLLOWUP_ATTACH_PARENT | COMPONENT_FLAG_FOLLOWUP_ATTACH_SENTINEL)))
415 {
416 struct Math_Vec3I32 *selected_hit_position =
417 &spawn_params->hit_positions[followup_target_hit_index];
418
419 spawned_followup_actor->position.x = spawn_params->hit_positions[followup_target_hit_index].x;
420 spawned_followup_actor->position.y = selected_hit_position->y;
421 spawned_followup_actor->position.z = selected_hit_position->z;
422 }
423 }
424
425 if (attachment_hit_counter > 0 || projectile_actor->scale_factor < MATH_Q12_ONE ||
426 (spawn_params->homing_response_scale && !definition->homing_strength))
427 {
428 if (!spawned_followup_actor)
429 {
430 Component_SpawnFollowupProjectile(definition, projectile_actor, NULL);
431
432 uint8_t behavior_flags = projectile_actor->behavior_flags;
433
434 if (behavior_flags & ACTOR_BEHAVIOR_GROUNDED_MOTION)
435 {
436 uint16_t ground_polygon_flag_bits = projectile_actor->ground_contact_polygon->flags;
437
439 Trail_SpawnFromEntry(projectile_actor, 3);
440 }
441 }
442
443 projectile_actor->fade_timer = 1;
444 }
445 }
446
447 int16_t fade_timer_before_tick = projectile_actor->fade_timer;
448
449 if (fade_timer_before_tick)
450 projectile_actor->fade_timer = fade_timer_before_tick - 1;
451
452 if (fade_timer_before_tick == 1 || projectile_actor->lifecycle_flags & ACTOR_LIFECYCLE_DESTROYING)
453 {
454 struct Actor *owner = spawn_params->owner;
455 uint8_t attach_refcount;
456
457 if (owner)
458 {
460
461 if (attach_refcount)
462 owner->attach_refcount = attach_refcount - 1;
463 }
464
465 if (spawn_params->state_flags & COMPONENT_STATE_HAS_TARGET)
466 {
467 struct Actor *attached_actor = spawn_params->attached_actor;
468
469 if ((uintptr_t)attached_actor != UINT32_MAX)
470 {
471 attach_refcount = attached_actor->attach_refcount;
472
473 if (attach_refcount)
474 attached_actor->attach_refcount = attach_refcount - 1;
475 }
476 }
477
478 projectile_actor->lifecycle_flags |= ACTOR_LIFECYCLE_DESTROYING;
479 definition->active_instance_count -= 1;
480
481 return;
482 }
483
484 int32_t frequency_code = definition->flags >> COMPONENT_AUDIO_FREQUENCY_SHIFT & COMPONENT_AUDIO_FREQUENCY_MASK;
485 int64_t elapsed_duration;
486
487 if (frequency_code)
488 {
489 int32_t duration_base = (uint16_t)(definition->type0_duration_base);
490
491 elapsed_duration = duration_base - (int32_t)projectile_actor->fade_timer;
492 }
493
494 if (!frequency_code || !(elapsed_duration % (frequency_code + 1)))
495 {
496 struct Actor_State *periodic_child_actor;
497
498 periodic_child_actor = Component_CreateActor(definition, projectile_actor, (struct Actor_State *)(spawn_params->owner), 3);
499
500 if (periodic_child_actor)
501 {
502 int16_t pitch = projectile_actor->facing_blend;
503 int16_t yaw = periodic_child_actor->facing_current;
504
505 periodic_child_actor->facing_blend = pitch;
506 Math_BuildMatrixRotationXY(&periodic_child_actor->rot_mat, NULL, -(int32_t)pitch, yaw);
507 }
508 }
509 }
510 else
511 {
512 projectile_actor->fade_timer -= 1;
513
514 if (!projectile_actor->fade_timer)
515 {
517 Component_InitializeProjectile((struct Component_ProjectileActorView *)(projectile_actor), definition);
518
519 int32_t behavior_flags = projectile_actor->behavior_flags;
520
522 projectile_actor->behavior_flags = behavior_flags;
523 }
524 }
525 }
526}
527
528// Original pcdogs.exe: 0x435290
529// Scans active powerups, runs their collision filter and resolves actor pairs that pass bounds and swept-sphere tests.
531{
533
534 for (struct Actor *candidate_powerup = Powerup_LiveActorListHead; candidate_powerup; candidate_powerup = candidate_powerup->list_next)
535 {
536 if (Physics_UpdateActorPreprocess((struct Actor_State *)(candidate_powerup)) && candidate_powerup->collision_class && powerup_collision_filter((struct Actor_State *)candidate_powerup, actor, 0, COLLISION_CALLBACK_CONTACT_PROBE) != COLLISION_PROBE_SKIP_PAIR)
537 {
538 int32_t dy = g_collisionTestMotionYQ12 - candidate_powerup->sub_pos.y;
539 int32_t dx = g_collisionTestMotionXQ12 - candidate_powerup->sub_pos.x;
540 int32_t cull_radius = (int32_t)candidate_powerup->cull_radius;
541 int32_t dz = g_collisionTestMotionZQ12 - candidate_powerup->sub_pos.z;
542 struct Math_Vec3I32 segment_delta = (struct Math_Vec3I32){
543 .x = dx,
544 .y = dy,
545 .z = dz};
546
547 int32_t relative_motion_distance = Math_ApproxDistance3DWeighted(dx, dy, dz);
548 int32_t x = candidate_powerup->world_render_pos.x;
549 int32_t swept_bounding_radius = relative_motion_distance + ((cull_radius + g_collisionTestRadiusQ6) << 6);
550 int32_t swept_bounding_diameter = swept_bounding_radius * 2;
551
552 if ((uint32_t)(x - g_collisionTestPosX + swept_bounding_radius) <= (uint32_t)swept_bounding_diameter && (uint32_t)(candidate_powerup->world_render_pos.y - g_collisionTestPosY + swept_bounding_radius) <= (uint32_t)swept_bounding_diameter)
553 {
554 int32_t z = candidate_powerup->world_render_pos.z;
555
556 if ((uint32_t)(z - g_collisionTestPosZ + swept_bounding_radius) <= (uint32_t)swept_bounding_diameter)
557 {
558 struct Math_Vec3I32 line_start = (struct Math_Vec3I32){
559 .x = candidate_powerup->sub_pos.x + x,
560 .y = candidate_powerup->sub_pos.y + candidate_powerup->world_render_pos.y,
561 .z = candidate_powerup->sub_pos.z + z};
562
563 if (Collision_TestLineSphereIntersection(&line_start, &segment_delta,
564 cull_radius))
565 Collision_ResolveActorToActorCollision(actor, (struct Actor_State *)(candidate_powerup), 0xffffffff, 0);
566 }
567 }
568 }
569 }
570}
#define ACTOR_BEHAVIOR_AIRBORNE
Definition constants.h:13
#define ACTOR_LIFECYCLE_HIDDEN
Definition constants.h:40
#define ACTOR_LIFECYCLE_DISABLED
Definition constants.h:39
#define ACTOR_BEHAVIOR_GROUND_TRACKING
Definition constants.h:12
@ ACTOR_DEATH_WAIT_FOR_LANDING
Definition constants.h:132
#define ACTOR_LIFECYCLE_DESTROYING
Definition constants.h:43
#define ACTOR_BEHAVIOR_GROUNDED_MOTION
Definition constants.h:14
#define ACTOR_BEHAVIOR_FADE_DESTROY
Definition constants.h:29
#define ACTOR_BEHAVIOR_PREPROCESSED
Definition constants.h:20
void Actor_ResetChainState(struct Actor_State *actor, int32_t chain_index)
Definition animation.c:748
uint8_t Actor_UpdateFadeOut(struct Actor_State *actor, int16_t fade_ticks)
Definition rendering.c:755
void Actor_DetachFromParent(struct Actor_State *actor)
#define COLLISION_SURFACE_TRAIL_MASK
Definition constants.h:97
@ COLLISION_PROBE_SKIP_PAIR
Definition constants.h:126
@ COLLISION_SURFACE_TRAIL_IMPACT
Definition constants.h:102
@ COLLISION_ACTOR_CLASS_POWERUP
Definition constants.h:70
@ COLLISION_ACTOR_CLASS_PROJECTILE
Definition constants.h:69
@ COLLISION_ACTOR_CLASS_CHARACTER
Definition constants.h:68
#define COLLISION_CALLBACK_DAMAGE_PROBE
Definition constants.h:46
#define COLLISION_CALLBACK_CONTACT_PROBE
Definition constants.h:45
#define COLLISION_MAX_PROJECTILE_CONTACTS
Definition constants.h:49
#define COLLISION_SURFACE_TRAIL_SHIFT
Definition constants.h:96
@ COLLISION_TARGET_MESH
Definition constants.h:90
@ COLLISION_TARGET_CHAIN
Definition constants.h:93
@ COLLISION_TARGET_ORIENTED_BOX
Definition constants.h:91
@ COLLISION_TARGET_ACTOR
Definition constants.h:92
#define COLLISION_PROJECTILE_RESPONSE_POLARITY
Definition constants.h:47
#define COLLISION_HIT_COOLDOWN_FRAMES
Definition constants.h:48
#define COLLISION_DAMAGEABLE_CHAIN_MAX_RENDER_LAYER
Definition constants.h:79
void Collision_CalculateImpactContactData(struct Actor_State *actor, struct Actor_State *other_actor, int32_t collision_fraction_q12, struct Math_Vec3I32 *out_contact_pos, struct Math_Vec3I32 *out_impact_motion)
Definition actors.c:355
void Collision_ResolveActorToActorCollision(struct Actor_State *actor_a, struct Actor_State *actor_b, int32_t actor_a_response, int32_t actor_b_response)
Definition actors.c:681
int32_t Collision_HandleComponentCollision(struct Component_ProjectileActorView *comp, struct Actor_State *other_actor)
Definition actors.c:80
uint8_t Collision_TestLineSphereIntersection(struct Math_Vec3I32 *line_start, struct Math_Vec3I32 *segment_delta, uint32_t sphere_radius)
Definition geometry.c:102
#define g_collisionTestRadiusQ6
Definition globals.h:45
#define g_collisionTestMotionXQ12
Definition globals.h:36
#define g_collisionTestPosZ
Definition globals.h:33
#define g_collisionTestPosX
Definition globals.h:27
#define g_collisionTestMotionZQ12
Definition globals.h:42
#define g_collisionTestPosY
Definition globals.h:30
#define g_collisionTestMotionYQ12
Definition globals.h:39
#define COMPONENT_FLAG_FOLLOWUP_FOR_PROJECTILE_HITS
Definition constants.h:50
#define COMPONENT_FLAG_FOLLOWUP_ATTACH_PARENT
Definition constants.h:9
#define COMPONENT_AUDIO_FREQUENCY_SHIFT
Definition constants.h:51
#define COMPONENT_FLAG_PROJECTILE_ATTACH_PARENT
Definition constants.h:13
#define COMPONENT_STATE_TARGET_CLEARED
Definition constants.h:22
#define COMPONENT_FLAG_FOLLOWUP_ATTACH_SENTINEL
Definition constants.h:10
#define COMPONENT_STATE_HAS_TARGET
Definition constants.h:23
#define COMPONENT_FLAG_PROJECTILE_ATTACH_POSITION_SOURCE
Definition constants.h:12
#define COMPONENT_FLAG_REJECT_HIT_RESPONSE
Definition constants.h:49
#define COMPONENT_AUDIO_FREQUENCY_MASK
Definition constants.h:52
@ COMPONENT_ACTOR_PROJECTILE
Definition constants.h:34
void Component_InitializeProjectile(struct Component_ProjectileActorView *comp, struct Component_Definition *definition)
Definition lifecycle.c:276
struct Actor_State * Component_SpawnFollowupProjectile(struct Component_Definition *component_def, struct Actor_State *source_actor, struct Actor_State *parent_actor)
Definition lifecycle.c:538
void Component_AttachToOwner(struct Actor_State *owner_actor, struct Component_ProjectileActorView *comp, struct Math_Vec3I32 *local_pos)
Definition lifecycle.c:586
struct Actor_State * Component_CreateActor(struct Component_Definition *component_def, struct Actor_State *spawn_source, struct Actor_State *owner_actor, int32_t actor_kind)
Definition lifecycle.c:344
uint8_t Collision_RegisterHitEvent(struct Component_HitEvent *hit_events, struct Actor_State *actor)
Definition events.c:189
void Collision_ProcessPowerupCollisions(struct Actor_State *actor)
Definition events.c:530
int32_t Collision_CheckEnemyCanBeHit(struct Component_ProjectileActorView *comp, struct Actor_State *other_actor)
Definition events.c:249
void Collision_ProcessProjectileLifecycle(struct Actor_State *actor)
Definition events.c:257
uint8_t Collision_CanRegisterHitEvent(struct Component_HitEvent *hit_events, struct Actor_State *actor, int32_t actor_collision_key)
Definition events.c:222
int32_t Collision_ProcessProjectileHit(void *subject, void *other_object, struct Collision_Polygon *collision_poly, int32_t collision_depth)
Definition events.c:35
int32_t Collision_GetCooldownFrames(struct Actor_State *actor)
Definition events.c:27
#define MATH_Q12_ONE
Definition constants.h:9
int32_t Math_ApproxDistance3DWeighted(int32_t dx, int32_t dy, int32_t dz)
Definition fixed_point.c:59
void Math_BuildMatrixRotationXY(struct Math_Matrix3x3I16 *out_matrix, struct Math_Matrix3x3I16 const *left_factor, int32_t angle_x, int32_t angle_y)
Definition matrices.c:120
bool Physics_CheckGroundSlopeDirection(struct Actor_State *actor, struct Collision_Polygon *collision_poly, struct Math_Vec3I16 *out_normal, struct Math_Vec3I32 *delta_vec)
Definition ground.c:34
uint8_t Physics_UpdateActorPreprocess(struct Actor_State *actor)
Definition behavior.c:153
int32_t(* global_type_Powerup_CollisionFilterCallback)(struct Actor_State *powerup_actor, struct Actor_State *other_actor, int32_t reserved_zero, int32_t collision_result)
Definition globals.h:8
#define Powerup_CollisionFilterCallback
Definition globals.h:9
#define Powerup_LiveActorListHead
Definition globals.h:15
uint8_t collision_class
Definition types.h:435
int16_t facing_current
Definition types.h:447
int16_t cull_radius
Definition types.h:424
uint8_t lifecycle_flags
Definition types.h:392
uint8_t actor_type
Definition types.h:391
struct Collision_Polygon * ground_contact_polygon
Definition types.h:452
uint8_t render_layer
Definition types.h:394
int32_t behavior_flags
Definition types.h:407
int16_t scale_factor
Definition types.h:439
struct Math_Vec3I32 world_render_pos
Definition types.h:420
void * record_ptr
Definition types.h:477
int16_t fade_timer
Definition types.h:438
struct Math_Vec3I32 sub_pos
Definition types.h:386
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
uint8_t attach_refcount
Definition types.h:436
int32_t rotation
Definition types.h:476
Definition types.h:118
uint8_t collision_class
Definition types.h:188
struct Pkg_ActorRecord * record_ptr
Definition types.h:207
uint8_t attach_refcount
Definition types.h:189
uint16_t flags
Definition types.h:66
int32_t homing_strength
Definition types.h:86
uint16_t damage_amount
Definition types.h:112
uint16_t type0_duration_base
Definition types.h:99
uint8_t flags_high
Definition types.h:79
uint8_t active_instance_count
Definition types.h:104
uint32_t flags
Definition types.h:74
struct Actor * actor
Definition types.h:131
struct Math_RangeI32 frame_range
Definition types.h:132
struct Math_Vec3I32 sub_pos
Definition types.h:170
struct Component_SpawnParams * spawn_context
Definition types.h:221
int16_t homing_response_scale
Definition types.h:345
uint8_t pad_104[0x4]
Definition types.h:343
struct Component_Definition * definition
Definition types.h:322
struct Actor * hit_actors[0x6]
Definition types.h:337
int16_t hit_depths[0x6]
Definition types.h:338
struct Math_Vec3I16 impact_normal
Definition types.h:342
struct Actor * owner
Definition types.h:314
struct Math_Vec3I32 hit_positions[0x6]
Definition types.h:339
struct Math_Vec3I32 impact_delta
Definition types.h:344
uint8_t state_flags
Definition types.h:333
struct Actor * attached_actor
Definition types.h:327
struct Component_HitEvent hit_events[0x8]
Definition types.h:336
int32_t min
Definition types.h:242
int32_t max
Definition types.h:243
int32_t y
Definition types.h:471
int32_t x
Definition types.h:470
int32_t z
Definition types.h:472
int32_t local_vars[0x9]
Definition types.h:1062
struct Actor_State * Trail_SpawnFromEntry(struct Actor_State *actor, int32_t trail_index)
Definition effects.c:124
#define g_frameCounter
Definition values.h:501