61 int32_t spawn_count = (uint8_t)(definition->
spawn_count);
63 int32_t remaining_child_spawns = spawn_count;
64 int32_t accumulated_duration_stagger = initial_duration_stagger;
65 int32_t spawn_index_remaining = spawn_count - 1;
69 spawn_owner = owner_actor;
72 bool more_projectiles;
76 spawn_owner = owner_actor;
80 if (spawned_projectile)
103 record_ptr->collision.reference_actor = reference_actor;
117 record_ptr->position_source_actor = position_source_actor;
119 if (!position_source_actor)
120 record_ptr->position_source_actor = spawn_owner;
122 uint32_t flags = definition->
flags;
136 position_source_actor_1 =
record_ptr->position_source_actor;
144 if (attachment_joint_index)
147 uint16_t joint_yaw = component_array[attachment_joint_index - 1].
angle_param[2];
149 &component_array[attachment_joint_index - 1];
150 uint16_t joint_pitch = joint_angle_record->
angle_param[3];
156 int16_t joint_facing_angle =
158 int32_t
m12 = (int32_t)joint_rotation.
m12;
172 int32_t staggered_duration_extra = accumulated_duration_stagger + random_duration_extra;
174 if (base_duration != -(staggered_duration_extra))
176 spawned_projectile->
fade_timer = (uint16_t)base_duration + (uint16_t)staggered_duration_extra;
180 spawned_projectile->
position.
x = spawn_position->
x;
181 spawned_projectile->
position.
y = spawn_position->
y;
182 spawned_projectile->
position.
z = spawn_position->
z;
188 int16_t facing_blend = spawned_projectile->
facing_blend;
192 spawned_projectile->
roll_angle = facing_blend;
200 accumulated_duration_stagger += duration_stagger_step;
202 if (remaining_child_spawns)
204 remaining_child_spawns -= 1;
214 uint32_t child_flags = definition->
flags;
229 spawn_owner = owner_actor;
236 spawned_projectile->facing_current = spawned_projectile->
facing_target;
237 spawned_projectile->facing_blend =
roll_angle;
242 int32_t y = spawned_projectile->
position.
y;
259 more_projectiles = spawn_index_remaining;
260 spawn_index_remaining -= 1;
261 }
while (more_projectiles);
268 if (spawn_camera_shake_amplitude)
271 return spawned_projectile;
284 if (position_source_actor)
346 struct Actor **list_head;
357 return spawned_actor;
361 *(uint16_t *)&spawned_actor->
rotation = (uint16_t)actor_kind;
362 spawn_params->
owner = (
struct Actor *)owner_actor;
402 return spawned_actor;
430 uint8_t old_state_flags = spawn_params->
state_flags;
450 if (!apply_gravity_after_tracking)
464 int32_t target_delta_x;
480 int32_t target_delta_z = target_z - owner->
position.
z;
494 int32_t gravity = definition->
gravity;
500 int32_t velocity_magnitude =
502 int16_t velocity_pitch_angle;
507 int32_t extended_velocity_pitch = (int32_t)velocity_pitch_angle;
524 uint16_t flags = (int16_t)definition->
flags;
545 if (followup_camera_shake_amplitude)
554 return followup_actor;
558 uint32_t flags = component_def->
flags;
565 int32_t source_velocity_x = source_actor->
velocity.
x;
581 return followup_actor;
625 struct Actor *old_owner = spawn_params->
owner;
639 spawn_params->
owner = new_owner;
644 uint16_t reversed_yaw = projectile->
yaw_angle;
659 if (!projectile_actor)
664 struct Actor *next_projectile_actor;
671 next_projectile_actor = projectile_actor->
list_next;
673 projectile_actor = next_projectile_actor;
674 }
while (next_projectile_actor);
#define ACTOR_BEHAVIOR_MOVEMENT_LOCKED
#define ACTOR_BEHAVIOR_DESTROY_AFTER_ANIMATION
#define ACTOR_BEHAVIOR_AIRBORNE
#define ACTOR_LIFECYCLE_DISABLED
#define ACTOR_BEHAVIOR_GROUND_TRACKING
#define ACTOR_BEHAVIOR_MOVING_LEFT
#define ACTOR_BEHAVIOR_BYPASS_COLLISION
#define ACTOR_ROOT_MOTION_LOOP
struct Scene_TransformNodePrefix * Actor_AttachToParent(struct Actor_State *child_actor, struct Actor_State *parent_actor, struct Scene_TransformNodePrefix *attach_point_or_auto_sentinel, uint32_t attachment_flags_and_face_selector)
void Actor_DetachFromParent(struct Actor_State *actor)
struct Actor_State * Actor_CloneTemplateWithTemplateRelativeFixups(struct Actor_State *template_actor, struct Actor_State **list_head)
void Actor_Destroy(struct Actor_State *actor)
#define AUDIO_INVALID_SOUND_INDEX
void Audio_StopOrUpdateSoundsAtPosition(int32_t sound_index_or_mode, struct Math_Vec3I32 *position, char looping_only)
void Camera_StartShake(struct Math_Vec3I32 *unused_position, int16_t amplitude)
@ COLLISION_ACTOR_CLASS_PROJECTILE
#define COMPONENT_FLAG_PROJECTILE_ATTACHMENT_OPTION
#define COMPONENT_STATE_DIRECTION_DIRTY
#define COMPONENT_FLAG_CHILD_ATTACH_POSITION_SOURCE
#define COMPONENT_SPAWN_INDEX_MULTIPLIER
@ COMPONENT_SOUND_FOLLOWUP
#define COMPONENT_SPAWN_INDEX_SHIFT
#define COMPONENT_FLAG_FOLLOWUP_ATTACHMENT_OPTION
#define COMPONENT_FLAG_FOLLOWUP_ATTACH_PARENT
#define COMPONENT_FLAG_PROJECTILE_ATTACH_PARENT
#define COMPONENT_FLAG_CHILD_ATTACH_OWNER
#define COMPONENT_STATE_TARGET_CLEARED
#define COMPONENT_FIXED_POSITION_TARGET
@ COMPONENT_MOVEMENT_IDLE
@ COMPONENT_MOVEMENT_PROJECTILE
#define COMPONENT_FLAG_FOLLOWUP_ATTACH_SENTINEL
#define COMPONENT_FLAG_CHILD_ATTACHMENT_OPTION
#define COMPONENT_FLAG_YAW_ONLY_ORIENTATION
#define COMPONENT_STATE_HAS_TARGET
#define COMPONENT_FLAG_PROJECTILE_ATTACH_POSITION_SOURCE
@ COMPONENT_PHASE_INITIAL
@ COMPONENT_PHASE_DEFERRED_PROJECTILE
#define COMPONENT_FLAG_CLEAR_TARGET
@ COMPONENT_ACTOR_PROJECTILE
@ COMPONENT_ACTOR_FOLLOWUP
#define COMPONENT_FLAG_CLEAR_TARGET_IF_UNTRACKED
#define COMPONENT_COLLISION_ALL_FLAGS
#define COMPONENT_COLLISION_PROJECTILE_BEHAVIOR_MODE
void Component_TrackTarget(struct Component_ProjectileActorView *comp, struct Component_Definition *definition, int16_t turn_rate)
void Component_PlayPositionalSound(struct Component_Definition *component_def, struct Actor_State *actor, int32_t sound_slot_index)
void Component_ApplyImpactReflection(struct Component_ProjectileActorView *comp)
void Component_RefreshCollisionRanges(struct Component_CollisionRecord *collision_records, int32_t slot_count)
void Component_SetVelocityFromDirection(struct Component_ProjectileActorView *comp, struct Component_Definition *definition)
void Component_CalculateOrientation(struct Component_ProjectileActorView *comp, struct Component_Definition *definition)
void Projectile_DestroyAllLiveActors(void)
#define Projectile_LiveActorListHead
struct Actor_State * Component_GetOwnerActor(struct Actor_State *actor)
int32_t Component_GetSpawnFrame(struct Actor_State *actor)
void Component_AttachToOwner(struct Actor_State *owner_actor, struct Component_ProjectileActorView *projectile, struct Math_Vec3I32 *local_pos)
struct Actor_State * Component_SpawnFollowupProjectile(struct Component_Definition *component_def, struct Actor_State *source_actor, struct Actor_State *parent_actor)
BOOL Component_HasSpawnCapacity(struct Component_Definition *definition)
struct Actor_State * Component_CreateActor(struct Component_Definition *component_def, struct Actor_State *spawn_source, struct Actor_State *owner_actor, int32_t actor_kind)
struct Actor_State * Component_SpawnFromCollisionRecord(struct Actor_State *owner_actor, struct Actor_State *target_actor, struct Component_CollisionRecord *collision_record)
void Component_InitializeProjectile(struct Component_ProjectileActorView *projectile, struct Component_Definition *definition)
void Component_UpdateProjectileLogic(struct Component_ProjectileActorView *projectile)
#define MATH_ANGLE_WRAP_MASK
#define MATH_ANGLE_HALF_TURN
#define MATH_ANGLE_FULL_TURN
void Math_BuildMatrixRotationY(struct Math_Matrix3x3I16 *out_matrix, struct Math_Matrix3x3I16 const *left_factor, int32_t angle)
int32_t Math_SqrtFP12(uint32_t value)
int16_t Math_CalculateAtan2FP12(int32_t y, int32_t x)
uint32_t Math_GenerateRandom(uint32_t range)
void Math_BuildMatrixRotationXY(struct Math_Matrix3x3I16 *out_matrix, struct Math_Matrix3x3I16 const *left_factor, int32_t angle_x, int32_t angle_y)
int32_t Math_AsinRatioFP12(int32_t numerator, int32_t denominator)
int32_t Math_CalculateAtan2Fast(int32_t y, int32_t x)
#define SCENE_NODE_DISABLED
struct Math_Vec3I32 velocity
struct Bone_JointTrackState * component_array
uint8_t movement_handler_index
struct Actor_State * child_actor
struct Collision_Polygon * ground_contact_polygon
struct Collision_Node * ground_collision_node
struct Actor_State * parent_actor
struct Math_Vec3I32 world_render_pos
struct Math_Matrix3x3I16 rot_mat
struct Math_Vec3I32 position
struct Math_Vec3I32 position
uint16_t attachment_joint_index
struct Component_Definition * definition
struct Math_Vec3I32 position
struct Actor_State * reference_actor
struct Actor_State * position_source_actor
int32_t homing_turn_step_angle12
uint8_t max_active_instances
int32_t spawn_camera_shake_amplitude
int32_t owner_turn_step_angle12
struct Actor * actor_templates[0x4]
uint16_t type0_duration_base
uint16_t type0_duration_range
Component_CollisionTargetMask collision_neutral_mask
uint16_t type2_duration_base
uint16_t type2_duration_range
int32_t followup_camera_shake_amplitude
uint8_t active_instance_count
uint16_t type2_duration_stagger
struct Scene_Node ** render_node_list
struct Math_Vec3I32 position
struct Math_Matrix3x3I16 rot_mat
struct Math_Vec3I32 world_render_pos
struct Collision_Node * ground_collision_node
int16_t collision_fraction_q12
struct Component_SpawnParams * spawn_context
struct Math_Vec3I32 velocity
uint8_t movement_handler_index
int16_t homing_response_scale
struct Math_Vec3I32 target_pos
struct Component_Definition * definition
struct Actor_State * position_source_actor
struct Component_CollisionRecord collision
struct Actor * attached_actor
struct Math_Matrix3x3I16 world_rot_matrix