From 60735e58d375d58df42e7d2e9341a2a8aeb11e18 Mon Sep 17 00:00:00 2001 From: Jonas Volman Date: Wed, 15 Jul 2026 07:54:19 -0700 Subject: [PATCH] Match particle system orphaning --- source/effects/particle_systems.c | 11 +++++++++++ source/effects/particle_systems.h | 25 ++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/source/effects/particle_systems.c b/source/effects/particle_systems.c index 778f8063..a2785e23 100644 --- a/source/effects/particle_systems.c +++ b/source/effects/particle_systems.c @@ -121,6 +121,17 @@ void particle_systems_initialize_for_new_map( return; } +void particle_system_orphan( + long system_index) +{ + struct particle_system_datum *system = particle_system_get(system_index); + + SET_FLAG(system->flags, _particle_system_attached_bit, FALSE); + system->object_index = NONE; + + return; +} + void particle_systems_dispose_from_old_map( void) { diff --git a/source/effects/particle_systems.h b/source/effects/particle_systems.h index d20ffa55..03450ca1 100644 --- a/source/effects/particle_systems.h +++ b/source/effects/particle_systems.h @@ -13,10 +13,32 @@ header included in hcex build. /* ---------- constants */ +enum +{ + _particle_system_attached_bit, +}; + /* ---------- macros */ +#define particle_system_get(system_index) ((struct particle_system_datum *)datum_get(particle_systems, (system_index))) + /* ---------- structures */ +struct particle_system_datum +{ + struct datum_header header; + short pad; + unsigned long flags; + long definition_index; + long object_index; + short attachment_index; + short type_state_index; + byte opaque[0x144]; +}; + +typedef char particle_system_datum_size_assert[ + sizeof(struct particle_system_datum) == 0x158 ? 1 : -1]; + /* ---------- prototypes/PARTICLE_SYSTEMS.C */ void particle_systems_initialize( @@ -31,7 +53,8 @@ void particle_systems_disconnect_from_structure_bsp( void); long particle_system_new_attached(long definition_index, long object_index, short attachment_index); -void particle_system_orphan(long system_index); +void particle_system_orphan( + long system_index); /* ---------- globals */