From 5b054dd98bd0c8fdb554b1d7d98b7eac1bb95a32 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 12 Aug 2012 11:42:18 +0900 Subject: [PATCH] Add "slow grav" for smoke. Removes one more set of hard codings from particle types. --- libs/video/renderer/r_part.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libs/video/renderer/r_part.c b/libs/video/renderer/r_part.c index 1790289c8..e4e299fb9 100644 --- a/libs/video/renderer/r_part.c +++ b/libs/video/renderer/r_part.c @@ -90,6 +90,12 @@ static int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 }; static int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 }; static int ramp3[8] = { 0x6d, 0x6b, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 }; +static inline float +slow_grav (void) +{ + return -vr_data.frametime * vr_data.gravity * 0.0375; +} + static inline float grav (void) { @@ -108,6 +114,12 @@ add_vel (particle_t *part) VectorMultAdd (part->org, vr_data.frametime, part->vel, part->org); } +static inline void +sub_slowgrav (particle_t *part) +{ + part->vel[2] -= slow_grav (); +} + static inline void add_grav (particle_t *part) { @@ -218,7 +230,7 @@ part_phys_smoke (particle_t *part) return; add_vel (part); part->scale += vr_data.frametime * 4.0; - //part->org[2] += vr_data.frametime * 30.0; + //sub_slowgrav (part); } static void @@ -228,7 +240,7 @@ part_phys_smokecloud (particle_t *part) return; add_vel (part); part->scale += vr_data.frametime * 50.0; - part->vel[2] += vr_data.frametime * 30.0; + sub_slowgrav (part); } static void