particles: combine two soft_start() overloads created by #769

This commit is contained in:
rdb 2019-11-11 03:29:11 +01:00
parent d088263f6f
commit d08219584d
2 changed files with 9 additions and 17 deletions

View File

@ -48,25 +48,18 @@ clear_to_initial() {
} }
/** /**
* Causes system to use birth rate set by set_birth_rate() * Causes system to use birth rate set by set_birth_rate().
*/ * If first_birth_delay is specified, it specifies the number of seconds to wait
INLINE void ParticleSystem:: * in addition to the birth rate before the first particle is birthed. It is
soft_start(PN_stdfloat br) { * legal for this to be a negative value, which causes the first birth to happen
if (br > 0.0)
set_birth_rate(br);
_cur_birth_rate = _birth_rate;
_tics_since_birth = 0.0f;
}
/**
* Causes system to use birth rate set by set_birth_rate(), with the system's
* first birth being delayed by the value of first_birth_delay. Note that a
* negative delay is perfectly valid, causing the first birth to happen
* sooner rather than later. * sooner rather than later.
*/ */
INLINE void ParticleSystem:: INLINE void ParticleSystem::
soft_start(PN_stdfloat br, PN_stdfloat first_birth_delay) { soft_start(PN_stdfloat br, PN_stdfloat first_birth_delay) {
soft_start(br); if (br > 0.0) {
set_birth_rate(br);
}
_cur_birth_rate = _birth_rate;
_tics_since_birth = -first_birth_delay; _tics_since_birth = -first_birth_delay;
} }

View File

@ -96,8 +96,7 @@ PUBLISHED:
INLINE void induce_labor(); INLINE void induce_labor();
INLINE void clear_to_initial(); INLINE void clear_to_initial();
INLINE void soft_stop(PN_stdfloat br = 0.0); INLINE void soft_stop(PN_stdfloat br = 0.0);
INLINE void soft_start(PN_stdfloat br = 0.0); INLINE void soft_start(PN_stdfloat br = 0.0, PN_stdfloat first_birth_delay = 0.0);
INLINE void soft_start(PN_stdfloat br, PN_stdfloat first_birth_delay);
void update(PN_stdfloat dt); void update(PN_stdfloat dt);
virtual void output(std::ostream &out) const; virtual void output(std::ostream &out) const;