diff options
Diffstat (limited to 'src/effect_system.cpp')
| -rw-r--r-- | src/effect_system.cpp | 44 |
1 files changed, 6 insertions, 38 deletions
| diff --git a/src/effect_system.cpp b/src/effect_system.cpp index 4dff13c..9b24d3e 100644 --- a/src/effect_system.cpp +++ b/src/effect_system.cpp | |||
| @@ -4,23 +4,9 @@ | |||
| 4 | void EffectSystem::tick(double dt) { | 4 | void EffectSystem::tick(double dt) { |
| 5 | if (game_.isGameplayPaused()) return; | 5 | if (game_.isGameplayPaused()) return; |
| 6 | 6 | ||
| 7 | if (screenFade_ != screenFadeDest_) { | 7 | screenFade_.tick(dt); |
| 8 | screenFadeThus_ += dt; | 8 | mapFade_.tick(dt); |
| 9 | if (screenFadeThus_ >= screenFadeLength_) { | 9 | circleEffect_.tick(dt); |
| 10 | screenFadeThus_ = screenFadeLength_; | ||
| 11 | } | ||
| 12 | |||
| 13 | screenFade_ = (screenFadeDest_ - screenFadeStart_) / screenFadeLength_ * screenFadeThus_ + screenFadeStart_; | ||
| 14 | } | ||
| 15 | |||
| 16 | if (mapFade_ != mapFadeDest_) { | ||
| 17 | mapFadeThus_ += dt; | ||
| 18 | if (mapFadeThus_ >= mapFadeLength_) { | ||
| 19 | mapFadeThus_ = mapFadeLength_; | ||
| 20 | } | ||
| 21 | |||
| 22 | mapFade_ = (mapFadeDest_ - mapFadeStart_) / mapFadeLength_ * mapFadeThus_ + mapFadeStart_; | ||
| 23 | } | ||
| 24 | 10 | ||
| 25 | if (cameraShaking_) { | 11 | if (cameraShaking_) { |
| 26 | cameraShakeTimer_.accumulate(dt); | 12 | cameraShakeTimer_.accumulate(dt); |
| @@ -37,29 +23,14 @@ void EffectSystem::tick(double dt) { | |||
| 37 | cameraShakeOffset_.y() = 0; | 23 | cameraShakeOffset_.y() = 0; |
| 38 | } | 24 | } |
| 39 | } | 25 | } |
| 40 | |||
| 41 | if (circleEffect_ != circleEffectDest_) { | ||
| 42 | circleEffectThus_ += dt; | ||
| 43 | if (circleEffectThus_ >= circleEffectLength_) { | ||
| 44 | circleEffectThus_ = circleEffectLength_; | ||
| 45 | } | ||
| 46 | |||
| 47 | circleEffect_ = (circleEffectDest_ - circleEffectStart_) / circleEffectLength_ * circleEffectThus_ + circleEffectStart_; | ||
| 48 | } | ||
| 49 | } | 26 | } |
| 50 | 27 | ||
| 51 | void EffectSystem::fadeScreen(int length, double amount) { | 28 | void EffectSystem::fadeScreen(int length, double amount) { |
| 52 | screenFadeStart_ = screenFade_; | 29 | screenFade_.start(length, amount); |
| 53 | screenFadeDest_ = amount; | ||
| 54 | screenFadeLength_ = length; | ||
| 55 | screenFadeThus_ = 0; | ||
| 56 | } | 30 | } |
| 57 | 31 | ||
| 58 | void EffectSystem::fadeMap(int length, double amount) { | 32 | void EffectSystem::fadeMap(int length, double amount) { |
| 59 | mapFadeStart_ = mapFade_; | 33 | mapFade_.start(length, amount); |
| 60 | mapFadeDest_ = amount; | ||
| 61 | mapFadeLength_ = length; | ||
| 62 | mapFadeThus_ = 0; | ||
| 63 | } | 34 | } |
| 64 | 35 | ||
| 65 | void EffectSystem::shakeCamera(int period) { | 36 | void EffectSystem::shakeCamera(int period) { |
| @@ -75,8 +46,5 @@ void EffectSystem::stopShakingCamera() { | |||
| 75 | } | 46 | } |
| 76 | 47 | ||
| 77 | void EffectSystem::circleTransition(int length, double amount) { | 48 | void EffectSystem::circleTransition(int length, double amount) { |
| 78 | circleEffectStart_ = circleEffect_; | 49 | circleEffect_.start(length, amount); |
| 79 | circleEffectDest_ = amount; | ||
| 80 | circleEffectLength_ = length; | ||
| 81 | circleEffectThus_ = 0; | ||
| 82 | } | 50 | } |
