From 9f499b0590b1a7d56c36ec5d093e82795c3aba19 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 26 Apr 2017 16:02:30 -0700 Subject: sparkler: add virtual flag to particle_props_t The burst particle abused a zero mass to circumvent the effects of aging. Instead use an explicit virtual flag to suppress aging, change busrt_cb to ignore all virtual particles instead of only its center. Previously burst_cb would thrust other bursts like any other particle, and this was incorrect. Now burst centers are always stationary, even when they overlap other bursts. --- src/modules/sparkler/burst.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/modules/sparkler/burst.c') diff --git a/src/modules/sparkler/burst.c b/src/modules/sparkler/burst.c index 828ca02..72cde03 100644 --- a/src/modules/sparkler/burst.c +++ b/src/modules/sparkler/burst.c @@ -23,8 +23,7 @@ static int burst_init(particles_t *particles, particle_t *p) burst_ctxt_t *ctxt = p->ctxt; ctxt->longevity = ctxt->lifetime = BURST_MAX_LIFETIME; - p->props->velocity = 0; /* burst should be stationary */ - p->props->mass = 0; /* no mass prevents gravity's effects */ + p->props->virtual = 1; return 1; } @@ -66,8 +65,8 @@ static void burst_cb(bsp_t *bsp, list_head_t *occupants, void *_s) particle_t *p = container_of(o, particle_t, occupant); float d_sq; - if (p == s->center) { - /* leave ourselves alone */ + if (p->props->virtual) { + /* don't move virtual particles (includes ourself) */ continue; } -- cgit v1.2.1