From 59d6b036dc66b6988ee189ba8e55a0b858a81449 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 27 Sep 2011 19:39:43 -0400 Subject: PEGASUS: Fader values should be signed --- engines/pegasus/compass.cpp | 4 ++-- engines/pegasus/compass.h | 2 +- engines/pegasus/fader.cpp | 16 ++++++++-------- engines/pegasus/fader.h | 22 +++++++++++----------- engines/pegasus/transition.cpp | 2 +- engines/pegasus/transition.h | 2 +- 6 files changed, 24 insertions(+), 24 deletions(-) (limited to 'engines/pegasus') diff --git a/engines/pegasus/compass.cpp b/engines/pegasus/compass.cpp index 37728272d4..2c80c5c41d 100755 --- a/engines/pegasus/compass.cpp +++ b/engines/pegasus/compass.cpp @@ -53,8 +53,8 @@ void Compass::deallocateCompass() { _compassImage.deallocateSurface(); } -void Compass::setFaderValue(const uint32 angle) { - int16 a = (int32)angle % 360; +void Compass::setFaderValue(const int32 angle) { + int16 a = angle % 360; if (a < 0) a += 360; diff --git a/engines/pegasus/compass.h b/engines/pegasus/compass.h index f669dd335d..d66b432a38 100755 --- a/engines/pegasus/compass.h +++ b/engines/pegasus/compass.h @@ -43,7 +43,7 @@ public: void deallocateCompass(); bool isCompassValid() const { return _compassImage.isSurfaceValid(); } - void setFaderValue(const uint32); + void setFaderValue(const int32); protected: void draw(const Common::Rect &); diff --git a/engines/pegasus/fader.cpp b/engines/pegasus/fader.cpp index fe292d91f7..77ad2cbe4e 100755 --- a/engines/pegasus/fader.cpp +++ b/engines/pegasus/fader.cpp @@ -35,13 +35,13 @@ Fader::Fader() { _currentFaderMove._numKnots = 0; } -void Fader::setFaderValue(const uint32 newValue) { +void Fader::setFaderValue(const int32 newValue) { _currentValue = newValue; } bool Fader::initFaderMove(const FaderMoveSpec &spec) { bool faderMoves = false; - uint32 value = 0; + int32 value = 0; if (spec._numKnots > 0) { stopFader(); @@ -135,7 +135,7 @@ void Fader::timeChanged(const TimeValue newTime) { if (_currentFaderMove._knots[i].knotTime > newTime) break; - uint32 newValue; + int32 newValue; if (i == 0) newValue = _currentFaderMove._knots[0].knotValue; else if (i == _currentFaderMove._numKnots) @@ -148,13 +148,13 @@ void Fader::timeChanged(const TimeValue newTime) { } } -void FaderMoveSpec::makeOneKnotFaderSpec(const uint32 knotValue) { +void FaderMoveSpec::makeOneKnotFaderSpec(const int32 knotValue) { _numKnots = 1; _knots[0].knotTime = 0; _knots[0].knotValue = knotValue; } -void FaderMoveSpec::makeTwoKnotFaderSpec(const TimeScale faderScale, const TimeValue time1, const uint32 value1, const TimeValue time2, const uint32 value2) { +void FaderMoveSpec::makeTwoKnotFaderSpec(const TimeScale faderScale, const TimeValue time1, const int32 value1, const TimeValue time2, const int32 value2) { _numKnots = 2; _faderScale = faderScale; _knots[0].knotTime = time1; @@ -163,7 +163,7 @@ void FaderMoveSpec::makeTwoKnotFaderSpec(const TimeScale faderScale, const TimeV _knots[1].knotValue = value2; } -void FaderMoveSpec::insertFaderKnot(const TimeValue knotTime, const uint32 knotValue) { +void FaderMoveSpec::insertFaderKnot(const TimeValue knotTime, const int32 knotValue) { if (_numKnots != kMaxFaderKnots) { uint32 index; for (index = 0; index < _numKnots; index++) { @@ -184,7 +184,7 @@ void FaderMoveSpec::insertFaderKnot(const TimeValue knotTime, const uint32 knotV } } -void FaderAnimation::setFaderValue(const uint32 newValue) { +void FaderAnimation::setFaderValue(const int32 newValue) { if (getFaderValue() != newValue) { Fader::setFaderValue(newValue); triggerRedraw(); @@ -203,7 +203,7 @@ void SoundFader::attachSound(Sound *sound) { _sound = sound; } -void SoundFader::setFaderValue(const uint32 newVolume) { +void SoundFader::setFaderValue(const int32 newVolume) { if (_sound) _sound->setVolume((newVolume * _masterVolume) >> 8); diff --git a/engines/pegasus/fader.h b/engines/pegasus/fader.h index fe5b1ae1ba..8c4fb0ba81 100755 --- a/engines/pegasus/fader.h +++ b/engines/pegasus/fader.h @@ -49,19 +49,19 @@ public: void setFaderScale(const TimeScale scale) { _faderScale = scale; } TimeScale getFaderScale() const { return _faderScale; } - void makeOneKnotFaderSpec(const uint32); - void makeTwoKnotFaderSpec(const TimeScale, const TimeValue, const uint32, const TimeValue, const uint32); + void makeOneKnotFaderSpec(const int32); + void makeTwoKnotFaderSpec(const TimeScale, const TimeValue, const int32, const TimeValue, const int32); - void insertFaderKnot(const TimeValue, const uint32); + void insertFaderKnot(const TimeValue, const int32); uint32 getNumKnots() const { return _numKnots; } - uint32 getNthKnotTime(const uint32 index) const { return _knots[index].knotTime; } - uint32 getNthKnotValue(const uint32 index) const { return _knots[index].knotValue; } + TimeValue getNthKnotTime(const uint32 index) const { return _knots[index].knotTime; } + int32 getNthKnotValue(const uint32 index) const { return _knots[index].knotValue; } protected: struct FaderKnot { TimeValue knotTime; - uint32 knotValue; + int32 knotValue; }; TimeScale _faderScale; @@ -76,8 +76,8 @@ public: Fader(); virtual ~Fader() {} - virtual void setFaderValue(const uint32); - uint32 getFaderValue() const { return _currentValue; } + virtual void setFaderValue(const int32); + int32 getFaderValue() const { return _currentValue; } virtual void startFader(const FaderMoveSpec &); virtual void startFaderSync(const FaderMoveSpec &); virtual void loopFader(const FaderMoveSpec &); @@ -93,7 +93,7 @@ protected: bool initFaderMove(const FaderMoveSpec &); virtual void timeChanged(const TimeValue); - uint32 _currentValue; + int32 _currentValue; FaderMoveSpec _currentFaderMove; }; @@ -102,7 +102,7 @@ public: FaderAnimation(const tDisplayElementID id) : DisplayElement(id) {} virtual ~FaderAnimation() {} - void setFaderValue(const uint32); + void setFaderValue(const int32); }; class Sound; @@ -113,7 +113,7 @@ public: SoundFader(); virtual ~SoundFader() {} - void setFaderValue(const uint32); + void setFaderValue(const int32); void setMasterVolume(const uint16); uint16 getMasterVolume() const { return _masterVolume; } diff --git a/engines/pegasus/transition.cpp b/engines/pegasus/transition.cpp index 20b9959358..73bd277233 100755 --- a/engines/pegasus/transition.cpp +++ b/engines/pegasus/transition.cpp @@ -51,7 +51,7 @@ void ScreenFader::doFadeInSync(const TimeValue duration, const TimeValue scale, startFaderSync(spec); } -void ScreenFader::setFaderValue(const uint32 value) { +void ScreenFader::setFaderValue(const int32 value) { if (value != getFaderValue()) { Fader::setFaderValue(value); diff --git a/engines/pegasus/transition.h b/engines/pegasus/transition.h index d34f3184d4..718808c5d8 100755 --- a/engines/pegasus/transition.h +++ b/engines/pegasus/transition.h @@ -38,7 +38,7 @@ public: void doFadeOutSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, const uint32 = getBlack()); void doFadeInSync(const TimeValue = kHalfSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, const uint32 = getBlack()); - void setFaderValue(const uint32); + void setFaderValue(const int32); protected: uint32 _fadeTarget; -- cgit v1.2.3