33 int32_t byte_offset = (int32_t)((uintptr_t)entity - (uintptr_t)level->
entity_array);
34 return byte_offset / (int32_t)
sizeof *entity;
42 uint32_t slot = (uint32_t)entity_index_1based - 1;
65 struct Entity *entity_state = entity;
73 int32_t property_value = value;
74 uint8_t property_id_byte = (uint8_t)prop_id;
76 uint32_t property_index = (uint32_t)property_id_byte;
80 switch (property_index)
86 if (!restore_saved_value)
107 if (!restore_saved_value)
112 else if (!restore_saved_value)
122 if (!restore_saved_value)
137 if (!restore_saved_value)
151 if (!restore_saved_value)
152 entity_state->
param_10C = property_value;
161 if (!restore_saved_value)
175 int32_t saved_param_114;
177 if (!restore_saved_value)
178 saved_param_114 = property_value;
182 entity_state->
param_114 = saved_param_114;
186 property_value = -(property_value);
187 value = property_value;
199 if (!restore_saved_value)
200 entity_state->
param_118 = property_value;
209 if (!restore_saved_value)
211 int64_t radius_squared = (int64_t)value * value;
223 if (!restore_saved_value)
225 int64_t height_squared = (int64_t)value * value;
240 entity_state->
flags &= ~property_flag_mask;
242 if (!restore_saved_value)
245 property_flag_mask = 0;
247 entity_state->
flags |= property_flag_mask;
258 uint8_t saved_param_direction_mode;
260 if (!restore_saved_value)
261 saved_param_direction_mode = (uint8_t)property_index - (int32_t)
PROP_TRACEMODE0;
278 char direction_property_id = (uint8_t)prop_id;
302 if (!actor_template_header)
329 *entity_position_binding = &actor->
position;
340 int32_t controller_record_bytes = (
char *)component_record - (
char *)runtime_record;
342 memset(runtime_record, 0, controller_record_bytes);
345 int component_countdown = 2;
347 bool more_components;
353 component_record->
definition = *component_definition_slot;
358 component_definition_slot = &component_definition_slot[1];
359 component_record = &component_record[1];
360 more_components = component_countdown != 1;
361 component_countdown -= 1;
362 }
while (more_components);
409 uint16_t flags = (int16_t)entity->
flags;
438 if (!restore_defaults)
447 entity->
flags = saved_flags;
454 struct Entity *entity_state = entity;
455 uint16_t
flags = (int16_t)entity_state->
flags;
461 if (reactivation_requester_or_null)
463 uint32_t flags_5 = entity_state->
flags;
467 entity_state->
flags = flags_5;
490 uint32_t flags_5 = entity_state->
flags;
494 entity_state->
flags = flags_5;
502 uint32_t flags_1 = entity_state->
flags;
508 entity_state->
flags = flags_1;
510 int32_t distance_delta[3];
524 int32_t active_entry_index = 0;
536 if ((uint32_t)(((uint64_t)((int64_t)distance_delta[0] * distance_delta[0]) + (uint64_t)((int64_t)distance_delta[1] * distance_delta[1]) + (uint64_t)((int64_t)distance_delta[2] * distance_delta[2])) >>
MATH_Q12_SHIFT) < entity->
collision_height_sq)
546 active_entry_index += 1;
548 if (active_entry_index >= (int32_t)active_worklist->
active_count)
551 entity_state = entity;
554 entity_state = entity;
557 if (active_entry_index == active_worklist->
active_count)
559 uint32_t flags_3 = entity_state->
flags;
562 entity_state->
flags = flags_3;
589 int32_t spawn_entry_index = 0;
599 if ((uint32_t)(((uint64_t)((int64_t)distance_delta[0] * distance_delta[0]) + (uint64_t)((int64_t)distance_delta[1] * distance_delta[1]) + (uint64_t)((int64_t)distance_delta[2] * distance_delta[2])) >>
MATH_Q12_SHIFT) < entity->
collision_radius_sq)
607 spawn_entry_index += 1;
609 if (spawn_entry_index >= active_entity_list->
active_count)
612 entity_state = entity;
615 entity_state = entity;
618 if ((uint32_t)spawn_entry_index == (uint32_t)active_entity_list->
active_count)
623 uint32_t flags_2 = entity_state->
flags;
626 entity_state->
flags = flags_2;
630 uint32_t flags_4 = entity_state->
flags;
643 entity_state->
flags = flags_4;
648 entity_state->
flags = flags_4;
656 runtime_actor = (
struct Actor *)(uintptr_t)(spawned_actor);
675 if (target_offset_step)
678 uint32_t offset_phase_upper_bound = entity_state->
param_110 >> 1;
682 int32_t offset_phase_lower_bound = -(offset_phase_upper_bound);
684 if (next_offset_phase <= offset_phase_lower_bound)
689 else if (next_offset_phase >= (int32_t)offset_phase_upper_bound)
697 int32_t pending_live_speed = entity_state->
param_114;
699 if (pending_live_speed)
713 uint32_t cull_flags_1;
714 int32_t cull_radius_1;
723 cull_radius_1 = (int32_t)runtime_actor->
cull_radius;
729 uint32_t flags_6 = entity_state->
flags;
733 entity_state->
flags = flags_6;
740 for (; collision_list_actor != runtime_actor;
741 collision_list_actor = *collision_list_link)
742 collision_list_link = (
struct Actor **)(uintptr_t)(collision_list_actor);
744 *collision_list_link = runtime_actor->
list_next;
762 struct Entity *current_entity = &entity_array[current_entity_index];
767 int32_t entity_index = 0;
770 if (active_count > 0)
778 entity_array = &entity_array[1];
779 }
while (entity_index < active_count);
#define ACTOR_BEHAVIOR_CULL_MODE
#define ACTOR_BEHAVIOR_GROUND_TILT_ENABLED
#define ACTOR_BEHAVIOR_GROUND_TRACKING
#define ACTOR_LIFECYCLE_DESTROYING
void Actor_AddToCollisionList(struct Actor_State *actor)
void Actor_ReleaseBindings(struct Player_ControllerRecordView *record)
#define Actor_CollisionListHead
struct Actor_State * Actor_CloneTemplateWithTemplateRelativeFixups(struct Actor_State *template_actor, struct Actor_State **list_head)
void Actor_CopyEntityDefaultsToRecord(struct Actor_State *actor)
void Actor_ApplyEntitySlotFlags(struct Actor_State *actor)
#define AUDIO_DETACH_EMITTER_MODE
void Audio_StopOrUpdateSoundsAtPosition(int32_t sound_index_or_mode, struct Math_Vec3I32 *position, char looping_only)
void Component_RefreshCollisionRanges(struct Component_CollisionRecord *collision_records, int32_t slot_count)
#define ENTITY_DISTANCE_LIMIT_DISABLED
#define ENTITY_CONTROLLER_COLLISION_SLOT_COUNT
#define ENTITY_FLAG_PERSISTENT_BIT_17
#define ENTITY_RUNTIME_BINDING_BYTES
#define ENTITY_ANGLE_SCALE_Q12
#define ENTITY_FLAG_COLLISION_LIST_UNLINKED
#define ENTITY_UNLIMITED_LIVES
#define ENTITY_FLAG_PAUSE_EXEMPT
#define ENTITY_CONTROLLER_RESET_BYTES
#define ENTITY_FLAG_NAVIGATION_GOAL_ENABLED
#define ENTITY_PROPERTY_FLAG_BASE
#define ENTITY_VISIBILITY_ENTER_MARGIN
#define ENTITY_PROPERTY_RESTORE_SAVED
#define ENTITY_FLAG_FACING_REQUEST
#define ENTITY_FIXED_UPDATE_RATE
#define ENTITY_VISIBILITY_LEAVE_MARGIN
#define ENTITY_FLAG_ACTIVE_WORKLIST_REQUEST
#define ENTITY_FLAG_GROUP_REVERSE
#define ENTITY_FLAG_INDEX_MASK
#define ENTITY_FLAG_SCRIPT_PAUSED
@ ENTITY_DIRECTION_SPEED_HEIGHT_OFFSET_FIRST
#define ENTITY_FLAG_ACTIVE_WORKLIST_DEFERRED
#define ENTITY_FLAG_ACTIVATION_REQUEST
#define ENTITY_FLAG_UPDATE_GUARD
#define ENTITY_FLAG_RESTORE_DEFAULTS
#define ENTITY_ANIMATION_PENDING
#define ENTITY_FLAG_DAMAGE_REACTION_DISABLED
#define ENTITY_RECORD_STRIDE
#define ENTITY_FLAG_PERSISTENT_BIT_15
#define ENTITY_FLAG_ACTOR_COLLISION_SCAN
#define EntityNavigationWorkList_ActiveBufferPtr
BOOL Entity_UpdateVisibilityAndSpawn(struct Entity *entity, struct Entity *reactivation_requester_or_null)
void Entity_SetActorProperty(struct Entity *entity, enum Actor_PropID prop_id, int32_t value)
void Entity_EnsureCameraActorActive(struct Entity *entity)
static int32_t Entity_IndexInLevel(const struct Level_Data *level, const struct Entity *entity)
struct Actor_State * Entity_SpawnActor(struct Entity *entity)
void Entity_EnableChildGroundOrientation(struct Entity *entity)
void Entity_DestroyActor(struct Entity *entity, int32_t restore_defaults)
BOOL Entity_IsInActiveList(int32_t entity_index_1based)
struct Actor_State * Entity_GetCurrentOrFirstActiveActor()
#define GAME_TRANSITION_SCRIPT_PAUSED
#define Game_FrameTransitionFlags
int32_t Graphics_CheckFrustumCull(struct Math_Vec3I32 *position, int32_t cull_radius, uint32_t cull_flags)
void Math_BuildMatrixRotationY(struct Math_Matrix3x3I16 *out_matrix, struct Math_Matrix3x3I16 const *left_factor, int32_t angle)
#define pkg_resource_current_level_data
struct Collision_Node * ground_collision_node
struct Math_Matrix3x3I16 rot_mat
struct Math_Vec3I32 position
struct Pkg_ActorRecord * record_ptr
struct Component_Instance * parent_component
struct Math_Vec2I16 visual_scale
int16_t collision_height_hi
struct Actor * child_actor
struct Component_Definition * definition
struct Actor_State * reference_actor
struct Actor_State * position_source_actor
struct Entity * active_entities[0x4]
uint8_t saved_param_direction_mode
uint8_t param_direction_mode
struct Math_Vec3I32 * runtime_target_pos
uint32_t collision_radius_sq
int32_t saved_param_max_speed_2
int32_t param_max_speed_2
struct Math_Vec3I32 bonus_respawn_pos
struct Actor * actor_template_header
uint32_t collision_height_sq
struct Math_Vec3I32 * position_ptr
uint32_t saved_collision_height_sq
struct Actor * runtime_actor
uint32_t saved_collision_radius_sq
int32_t saved_param_max_health
int32_t target_offset_step
int32_t saved_param_accel_0
int32_t target_offset_phase
int16_t default_anim_state
int32_t path_best_distance
uint8_t behavior_stack[0x3]
int32_t saved_param_turn_step
int16_t current_entity_index
struct Entity * entity_array
struct Actor_ContactSlot contact_slots[4]
struct Math_Vec3I32 * position_ptr
int32_t direction_mode_height_offset
uint16_t reaction_animation_ticks
struct Component_CollisionRecord * component_records
int16_t owner_entity_index