aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/particles/part_particle.cpp
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-26 15:59:26 +0200
committerEinar Johan Trøan Sømåen2012-07-26 15:59:26 +0200
commitef11f9d0c53cbdd9d88a99143de6f43f34d7e24d (patch)
tree8dfaee0ba16e18a8e3772dd5afc9123d5c4e78d2 /engines/wintermute/base/particles/part_particle.cpp
parent38507fa9895620639d8733dbb4e085dfb2282a33 (diff)
downloadscummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.tar.gz
scummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.tar.bz2
scummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.zip
WINTERMUTE: Run Astyle with add-braces to break one-line statements into easier-to-read-code.
Diffstat (limited to 'engines/wintermute/base/particles/part_particle.cpp')
-rw-r--r--engines/wintermute/base/particles/part_particle.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp
index b63a82f926..4a5239edfe 100644
--- a/engines/wintermute/base/particles/part_particle.cpp
+++ b/engines/wintermute/base/particles/part_particle.cpp
@@ -99,24 +99,29 @@ bool PartParticle::update(PartEmitter *emitter, uint32 currentTime, uint32 timer
if (currentTime - _fadeStart >= (uint32)_fadeTime) {
_state = PARTICLE_NORMAL;
_currentAlpha = _alpha1;
- } else _currentAlpha = (int)(((float)currentTime - (float)_fadeStart) / (float)_fadeTime * _alpha1);
+ } else {
+ _currentAlpha = (int)(((float)currentTime - (float)_fadeStart) / (float)_fadeTime * _alpha1);
+ }
return STATUS_OK;
} else if (_state == PARTICLE_FADEOUT) {
if (currentTime - _fadeStart >= (uint32)_fadeTime) {
_isDead = true;
return STATUS_OK;
- } else _currentAlpha = _fadeStartAlpha - (int)(((float)currentTime - (float)_fadeStart) / (float)_fadeTime * _fadeStartAlpha);
+ } else {
+ _currentAlpha = _fadeStartAlpha - (int)(((float)currentTime - (float)_fadeStart) / (float)_fadeTime * _fadeStartAlpha);
+ }
return STATUS_OK;
} else {
// time is up
if (_lifeTime > 0) {
if (currentTime - _creationTime >= (uint32)_lifeTime) {
- if (emitter->_fadeOutTime > 0)
+ if (emitter->_fadeOutTime > 0) {
fadeOut(currentTime, emitter->_fadeOutTime);
- else
+ } else {
_isDead = true;
+ }
}
}
@@ -125,10 +130,13 @@ bool PartParticle::update(PartEmitter *emitter, uint32 currentTime, uint32 timer
Point32 p;
p.x = (int32)_pos.x;
p.y = (int32)_pos.y;
- if (!BasePlatform::ptInRect(&_border, p))
+ if (!BasePlatform::ptInRect(&_border, p)) {
fadeOut(currentTime, emitter->_fadeOutTime);
+ }
+ }
+ if (_state != PARTICLE_NORMAL) {
+ return STATUS_OK;
}
- if (_state != PARTICLE_NORMAL) return STATUS_OK;
// update alpha
if (_lifeTime > 0) {
@@ -166,13 +174,15 @@ bool PartParticle::update(PartEmitter *emitter, uint32 currentTime, uint32 timer
_rotation = BaseUtils::normalizeAngle(_rotation);
// update scale
- if (_exponentialGrowth)
+ if (_exponentialGrowth) {
_scale += _scale / 100.0f * _growthRate * elapsedTime;
- else
+ } else {
_scale += _growthRate * elapsedTime;
+ }
- if (_scale <= 0.0f)
+ if (_scale <= 0.0f) {
_isDead = true;
+ }
return STATUS_OK;
@@ -181,8 +191,12 @@ bool PartParticle::update(PartEmitter *emitter, uint32 currentTime, uint32 timer
//////////////////////////////////////////////////////////////////////////
bool PartParticle::display(PartEmitter *emitter) {
- if (!_sprite) return STATUS_FAILED;
- if (_isDead) return STATUS_OK;
+ if (!_sprite) {
+ return STATUS_FAILED;
+ }
+ if (_isDead) {
+ return STATUS_OK;
+ }
_sprite->GetCurrentFrame();
return _sprite->display(_pos.x, _pos.y,