48 int32_t hit_actor_type = (uint8_t)(other_actor->
actor_type);
52 switch (hit_actor_type)
80 spawn_params->
pad_104[0] = normal_record.reserved[0];
81 spawn_params->
pad_104[1] = normal_record.reserved[1];
97 char needs_contact_position = 0;
98 uint8_t hit_response_policy = 1;
109 hit_response_policy = 0;
110 needs_contact_position = 1;
118 needs_contact_position = 1;
121 hit_response_policy = 0;
132 hit_response_policy = 0;
133 needs_contact_position = 1;
136 hit_response_policy = 0;
144 hit_response_policy = 0;
148 collision_class_or_hit_index = spawn_params_hits->
hit_count;
152 int32_t depth_write_index;
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;
158 if (needs_contact_position)
160 int32_t position_write_index = (uint8_t)(spawn_params_hits->
hit_count);
163 collision_depth, &spawn_params_hits->
hit_positions[position_write_index],
170 return hit_response_policy ? -1 : 0;
199 int32_t occupied_slots_scanned = 0;
201 while ((uint32_t)event->frame_range.max >= (uint32_t)
g_frameCounter)
203 occupied_slots_scanned += 1;
206 if (occupied_slots_scanned >= 8)
212 event->actor = (
struct Actor *)(actor);
226 for (int32_t i = 0; i < 8;)
228 struct Actor *event_actor = event_cursor->
actor;
230 if ((
void *)event_actor == (
void *)actor && event_actor->
record_ptr->
local_vars[2] == actor_collision_key)
235 return (uint32_t)current_frame >= (uint32_t)event_cursor->
frame_range.
max;
241 event_cursor = &event_cursor[1];
261 int32_t projectile_subtype = (int16_t)projectile_actor->
rotation;
276 int32_t projectile_hit_count = 0;
280 uint8_t released_reference_count;
289 if (released_reference_count)
292 spawn_params->
owner = 0;
308 spawn_params->
state_flags = cleared_projectile_state_flags;
318 if (released_reference_count)
338 int32_t recorded_hit_count;
339 int32_t attachment_hit_counter = 0;
341 recorded_hit_count = spawn_params->
hit_count;
343 int32_t followup_target_hit_index = 0xffffffff;
344 int32_t hit_scan_index = recorded_hit_count - 1;
347 if (recorded_hit_count)
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;
356 int32_t hit_depth = (uint16_t)(*(uint16_t *)hit_depth_cursor);
358 if (hit_depth <= (int32_t)projectile_actor->
scale_factor)
361 (int32_t)(*(
struct Actor_State **)hit_actor_cursor)->collision_class;
364 followup_target_hit_index = hit_scan_index;
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];
373 previous_hit_scan_index = hit_scan_index;
375 hit_depth_cursor -= 1;
376 hit_actor_cursor -= 1;
377 }
while (previous_hit_scan_index);
379 definition = saved_definition;
380 projectile_hit_count = attachment_hit_counter;
385 attachment_hit_counter = projectile_hit_count - 1;
387 if (projectile_hit_count)
389 int32_t *attachment_hit_index_cursor = &projectile_hit_indices[projectile_hit_count - 1];
390 int32_t hit_indices_remaining = projectile_hit_count;
394 int32_t attachment_hit_index = *(uint32_t *)attachment_hit_index_cursor;
398 hit_indices_remaining -= 1;
399 attachment_hit_index_cursor -= 1;
400 attachment_hit_counter -= 1;
401 }
while (hit_indices_remaining > 0);
403 definition = saved_definition;
407 if (followup_target_hit_index >= 0)
410 definition, projectile_actor, (
struct Actor_State *)(spawn_params->
hit_actors[followup_target_hit_index]));
412 spawned_followup_actor = followup_actor_result;
420 spawned_followup_actor->
position.
y = selected_hit_position->
y;
421 spawned_followup_actor->
position.
z = selected_hit_position->
z;
428 if (!spawned_followup_actor)
447 int16_t fade_timer_before_tick = projectile_actor->
fade_timer;
449 if (fade_timer_before_tick)
450 projectile_actor->
fade_timer = fade_timer_before_tick - 1;
469 if ((uintptr_t)attached_actor != UINT32_MAX)
485 int64_t elapsed_duration;
491 elapsed_duration = duration_base - (int32_t)projectile_actor->
fade_timer;
494 if (!frequency_code || !(elapsed_duration % (frequency_code + 1)))
500 if (periodic_child_actor)
550 int32_t swept_bounding_diameter = swept_bounding_radius * 2;
556 if ((uint32_t)(z -
g_collisionTestPosZ + swept_bounding_radius) <= (uint32_t)swept_bounding_diameter)
#define ACTOR_BEHAVIOR_AIRBORNE
#define ACTOR_LIFECYCLE_HIDDEN
#define ACTOR_LIFECYCLE_DISABLED
#define ACTOR_BEHAVIOR_GROUND_TRACKING
@ ACTOR_DEATH_WAIT_FOR_LANDING
#define ACTOR_LIFECYCLE_DESTROYING
#define ACTOR_BEHAVIOR_GROUNDED_MOTION
#define ACTOR_BEHAVIOR_FADE_DESTROY
#define ACTOR_BEHAVIOR_PREPROCESSED
void Actor_ResetChainState(struct Actor_State *actor, int32_t chain_index)
uint8_t Actor_UpdateFadeOut(struct Actor_State *actor, int16_t fade_ticks)
void Actor_DetachFromParent(struct Actor_State *actor)
#define COLLISION_SURFACE_TRAIL_MASK
@ COLLISION_PROBE_SKIP_PAIR
@ COLLISION_SURFACE_TRAIL_IMPACT
@ COLLISION_ACTOR_CLASS_POWERUP
@ COLLISION_ACTOR_CLASS_PROJECTILE
@ COLLISION_ACTOR_CLASS_CHARACTER
#define COLLISION_CALLBACK_DAMAGE_PROBE
#define COLLISION_CALLBACK_CONTACT_PROBE
#define COLLISION_MAX_PROJECTILE_CONTACTS
#define COLLISION_SURFACE_TRAIL_SHIFT
@ COLLISION_TARGET_ORIENTED_BOX
#define COLLISION_PROJECTILE_RESPONSE_POLARITY
#define COLLISION_HIT_COOLDOWN_FRAMES
#define COLLISION_DAMAGEABLE_CHAIN_MAX_RENDER_LAYER
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)
void Collision_ResolveActorToActorCollision(struct Actor_State *actor_a, struct Actor_State *actor_b, int32_t actor_a_response, int32_t actor_b_response)
int32_t Collision_HandleComponentCollision(struct Component_ProjectileActorView *comp, struct Actor_State *other_actor)
uint8_t Collision_TestLineSphereIntersection(struct Math_Vec3I32 *line_start, struct Math_Vec3I32 *segment_delta, uint32_t sphere_radius)
#define g_collisionTestRadiusQ6
#define g_collisionTestMotionXQ12
#define g_collisionTestPosZ
#define g_collisionTestPosX
#define g_collisionTestMotionZQ12
#define g_collisionTestPosY
#define g_collisionTestMotionYQ12
#define COMPONENT_FLAG_FOLLOWUP_FOR_PROJECTILE_HITS
#define COMPONENT_FLAG_FOLLOWUP_ATTACH_PARENT
#define COMPONENT_AUDIO_FREQUENCY_SHIFT
#define COMPONENT_FLAG_PROJECTILE_ATTACH_PARENT
#define COMPONENT_STATE_TARGET_CLEARED
#define COMPONENT_FLAG_FOLLOWUP_ATTACH_SENTINEL
#define COMPONENT_STATE_HAS_TARGET
#define COMPONENT_FLAG_PROJECTILE_ATTACH_POSITION_SOURCE
#define COMPONENT_FLAG_REJECT_HIT_RESPONSE
#define COMPONENT_AUDIO_FREQUENCY_MASK
@ COMPONENT_ACTOR_PROJECTILE
void Component_InitializeProjectile(struct Component_ProjectileActorView *comp, struct Component_Definition *definition)
struct Actor_State * Component_SpawnFollowupProjectile(struct Component_Definition *component_def, struct Actor_State *source_actor, struct Actor_State *parent_actor)
void Component_AttachToOwner(struct Actor_State *owner_actor, struct Component_ProjectileActorView *comp, struct Math_Vec3I32 *local_pos)
struct Actor_State * Component_CreateActor(struct Component_Definition *component_def, struct Actor_State *spawn_source, struct Actor_State *owner_actor, int32_t actor_kind)
uint8_t Collision_RegisterHitEvent(struct Component_HitEvent *hit_events, struct Actor_State *actor)
void Collision_ProcessPowerupCollisions(struct Actor_State *actor)
int32_t Collision_CheckEnemyCanBeHit(struct Component_ProjectileActorView *comp, struct Actor_State *other_actor)
void Collision_ProcessProjectileLifecycle(struct Actor_State *actor)
uint8_t Collision_CanRegisterHitEvent(struct Component_HitEvent *hit_events, struct Actor_State *actor, int32_t actor_collision_key)
int32_t Collision_ProcessProjectileHit(void *subject, void *other_object, struct Collision_Polygon *collision_poly, int32_t collision_depth)
int32_t Collision_GetCooldownFrames(struct Actor_State *actor)
int32_t Math_ApproxDistance3DWeighted(int32_t dx, int32_t dy, int32_t dz)
void Math_BuildMatrixRotationXY(struct Math_Matrix3x3I16 *out_matrix, struct Math_Matrix3x3I16 const *left_factor, int32_t angle_x, int32_t angle_y)
bool Physics_CheckGroundSlopeDirection(struct Actor_State *actor, struct Collision_Polygon *collision_poly, struct Math_Vec3I16 *out_normal, struct Math_Vec3I32 *delta_vec)
uint8_t Physics_UpdateActorPreprocess(struct Actor_State *actor)
int32_t(* global_type_Powerup_CollisionFilterCallback)(struct Actor_State *powerup_actor, struct Actor_State *other_actor, int32_t reserved_zero, int32_t collision_result)
#define Powerup_CollisionFilterCallback
#define Powerup_LiveActorListHead
struct Collision_Polygon * ground_contact_polygon
struct Math_Vec3I32 world_render_pos
struct Math_Vec3I32 sub_pos
struct Math_Matrix3x3I16 rot_mat
struct Math_Vec3I32 position
struct Pkg_ActorRecord * record_ptr
uint16_t type0_duration_base
uint8_t active_instance_count
struct Math_RangeI32 frame_range
struct Math_Vec3I32 sub_pos
struct Component_SpawnParams * spawn_context
int16_t homing_response_scale
struct Component_Definition * definition
struct Actor * hit_actors[0x6]
struct Math_Vec3I16 impact_normal
struct Math_Vec3I32 hit_positions[0x6]
struct Math_Vec3I32 impact_delta
struct Actor * attached_actor
struct Component_HitEvent hit_events[0x8]
struct Actor_State * Trail_SpawnFromEntry(struct Actor_State *actor, int32_t trail_index)