diff --git a/main-src/eu/ha3/matmos/engine/core/implem/HelperFadeCalculator.java b/main-src/eu/ha3/matmos/engine/core/implem/HelperFadeCalculator.java index 0fba98cd..5d007dd6 100644 --- a/main-src/eu/ha3/matmos/engine/core/implem/HelperFadeCalculator.java +++ b/main-src/eu/ha3/matmos/engine/core/implem/HelperFadeCalculator.java @@ -59,21 +59,37 @@ public float calculateFadeFactor() long curTime = this.time.getMilliseconds(); if (this.foLast) { - this.fade = 1 - (curTime - this.fadeOutTime) / (float) this.fadeOutDuration; - if (this.fade < 0f) + if (this.fadeOutDuration <= 0f) { this.fade = 0f; this.complete = true; } + else + { + this.fade = 1 - (curTime - this.fadeOutTime) / (float) this.fadeOutDuration; + if (this.fade < 0f) + { + this.fade = 0f; + this.complete = true; + } + } } else { - this.fade = (curTime - this.fadeInTime) / (float) this.fadeInDuration; - if (this.fade > 1f) + if (this.fadeInDuration <= 0f) { this.fade = 1f; this.complete = true; } + else + { + this.fade = (curTime - this.fadeInTime) / (float) this.fadeInDuration; + if (this.fade > 1f) + { + this.fade = 1f; + this.complete = true; + } + } } return this.fade;