aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/ad/ad_actor.cpp14
-rw-r--r--engines/wintermute/ad/ad_entity.cpp6
-rw-r--r--engines/wintermute/ad/ad_item.cpp4
-rw-r--r--engines/wintermute/ad/ad_talk_node.cpp4
-rw-r--r--engines/wintermute/base/base_frame.cpp6
-rw-r--r--engines/wintermute/base/base_frame.h10
-rw-r--r--engines/wintermute/base/base_sprite.cpp11
-rw-r--r--engines/wintermute/base/base_sprite.h37
8 files changed, 54 insertions, 38 deletions
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp
index 074d5afdbb..fa06bb12e8 100644
--- a/engines/wintermute/ad/ad_actor.cpp
+++ b/engines/wintermute/ad/ad_actor.cpp
@@ -602,13 +602,13 @@ bool AdActor::update() {
}
// finished playing animation?
- if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->_finished) {
+ if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) {
_state = _nextState;
_nextState = STATE_READY;
_currentSprite = _animSprite;
}
- if (_state == STATE_PLAYING_ANIM_SET && _animSprite2 != NULL && _animSprite2->_finished) {
+ if (_state == STATE_PLAYING_ANIM_SET && _animSprite2 != NULL && _animSprite2->isFinished()) {
_state = _nextState;
_nextState = STATE_READY;
_currentSprite = _animSprite2;
@@ -649,7 +649,7 @@ bool AdActor::update() {
//////////////////////////////////////////////////////////////////////////
case STATE_TURNING_LEFT:
- if (_tempSprite2 == NULL || _tempSprite2->_finished) {
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished()) {
if (_dir > 0) {
_dir = (TDirection)(_dir - 1);
} else {
@@ -686,7 +686,7 @@ bool AdActor::update() {
//////////////////////////////////////////////////////////////////////////
case STATE_TURNING_RIGHT:
- if (_tempSprite2 == NULL || _tempSprite2->_finished) {
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished()) {
_dir = (TDirection)(_dir + 1);
if ((int)_dir >= (int)NUM_DIRECTIONS) {
@@ -753,7 +753,7 @@ bool AdActor::update() {
}
bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime);
- if (_tempSprite2 == NULL || _tempSprite2->_finished || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
if (timeIsUp) {
_sentence->finish();
_tempSprite2 = NULL;
@@ -798,7 +798,7 @@ bool AdActor::update() {
if (_currentSprite && !already_moved) {
_currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100);
- if (_currentSprite->_changed) {
+ if (_currentSprite->isChanged()) {
_posX += _currentSprite->_moveX;
_posY += _currentSprite->_moveY;
afterMove();
@@ -858,7 +858,7 @@ void AdActor::getNextStep() {
}
_currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100);
- if (!_currentSprite->_changed) {
+ if (!_currentSprite->isChanged()) {
return;
}
diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp
index 00dbc0f3c2..f97284ae1d 100644
--- a/engines/wintermute/ad/ad_entity.cpp
+++ b/engines/wintermute/ad/ad_entity.cpp
@@ -578,7 +578,7 @@ bool AdEntity::update() {
}
// finished playing animation?
- if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->_finished) {
+ if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) {
_state = STATE_READY;
_currentSprite = _animSprite;
}
@@ -613,7 +613,7 @@ bool AdEntity::update() {
}
bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime);
- if (_tempSprite2 == NULL || _tempSprite2->_finished || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
if (timeIsUp) {
_sentence->finish();
_tempSprite2 = NULL;
@@ -639,7 +639,7 @@ bool AdEntity::update() {
if (_currentSprite) {
_currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100);
- if (_currentSprite->_changed) {
+ if (_currentSprite->isChanged()) {
_posX += _currentSprite->_moveX;
_posY += _currentSprite->_moveY;
}
diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp
index bad7223788..55ccca8d0a 100644
--- a/engines/wintermute/ad/ad_item.cpp
+++ b/engines/wintermute/ad/ad_item.cpp
@@ -340,7 +340,7 @@ bool AdItem::update() {
}
// finished playing animation?
- if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->_finished) {
+ if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) {
_state = STATE_READY;
_currentSprite = _animSprite;
}
@@ -379,7 +379,7 @@ bool AdItem::update() {
}
bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime);
- if (_tempSprite2 == NULL || _tempSprite2->_finished || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
+ if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
if (timeIsUp) {
_sentence->finish();
_tempSprite2 = NULL;
diff --git a/engines/wintermute/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp
index b1bcf685f2..c909ee27ff 100644
--- a/engines/wintermute/ad/ad_talk_node.cpp
+++ b/engines/wintermute/ad/ad_talk_node.cpp
@@ -264,9 +264,9 @@ bool AdTalkNode::loadSprite() {
bool AdTalkNode::isInTimeInterval(uint32 time, TDirection dir) {
if (time >= _startTime) {
if (_playToEnd) {
- if ((_spriteFilename && _sprite == NULL) || (_sprite && _sprite->_finished == false)) {
+ if ((_spriteFilename && _sprite == NULL) || (_sprite && _sprite->isFinished() == false)) {
return true;
- } else if ((_spriteSetFilename && _spriteSet == NULL) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->_finished == false)) {
+ } else if ((_spriteSetFilename && _spriteSet == NULL) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->isFinished() == false)) {
return true;
} else {
return false;
diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp
index e1b29a3a5c..3e67c29d2f 100644
--- a/engines/wintermute/base/base_frame.cpp
+++ b/engines/wintermute/base/base_frame.cpp
@@ -87,6 +87,12 @@ bool BaseFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float
return STATUS_OK;
}
+void BaseFrame::stopSound() {
+ if (_sound) {
+ _sound->stop();
+ }
+}
+
//////////////////////////////////////////////////////////////////////////
bool BaseFrame::oneTimeDisplay(BaseObject *owner, bool muted) {
diff --git a/engines/wintermute/base/base_frame.h b/engines/wintermute/base/base_frame.h
index ea5467b6fe..60887210f4 100644
--- a/engines/wintermute/base/base_frame.h
+++ b/engines/wintermute/base/base_frame.h
@@ -41,11 +41,10 @@ class ScStack;
class BaseFrame: public BaseScriptable {
public:
bool _killSound;
- bool _keyframe;
+ void stopSound();
bool oneTimeDisplay(BaseObject *owner, bool muted = false);
DECLARE_PERSISTENT(BaseFrame, BaseScriptable)
- BaseSound *_sound;
- bool _editorExpanded;
+
bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100);
bool saveAsText(BaseDynamicBuffer *buffer, int indent);
int _moveY;
@@ -65,7 +64,10 @@ public:
virtual bool scSetProperty(const char *name, ScValue *value);
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
virtual const char *scToString();
-
+private:
+ bool _keyframe;
+ bool _editorExpanded;
+ BaseSound *_sound;
};
} // end of namespace Wintermute
diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp
index e2dd8bbd39..0baa25af22 100644
--- a/engines/wintermute/base/base_sprite.cpp
+++ b/engines/wintermute/base/base_sprite.cpp
@@ -121,6 +121,13 @@ bool BaseSprite::draw(int x, int y, BaseObject *registerOwner, float zoomX, floa
return display(x, y, registerOwner, zoomX, zoomY, alpha);
}
+bool BaseSprite::isChanged() {
+ return _changed;
+}
+
+bool BaseSprite::isFinished() {
+ return _finished;
+}
//////////////////////////////////////////////////////////////////////
bool BaseSprite::loadFile(const Common::String &filename, int lifeTime, TSpriteCacheType cacheType) {
@@ -804,9 +811,7 @@ const char *BaseSprite::scToString() {
//////////////////////////////////////////////////////////////////////////
bool BaseSprite::killAllSounds() {
for (uint32 i = 0; i < _frames.size(); i++) {
- if (_frames[i]->_sound) {
- _frames[i]->_sound->stop();
- }
+ _frames[i]->stopSound();
}
return STATUS_OK;
}
diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h
index c861ca9930..cef874b254 100644
--- a/engines/wintermute/base/base_sprite.h
+++ b/engines/wintermute/base/base_sprite.h
@@ -39,36 +39,21 @@ class BaseSurface;
class BaseObject;
class BaseSprite: public BaseScriptHolder {
public:
- bool killAllSounds();
BaseSurface *getSurface();
- char *_editorBgFile;
- int _editorBgOffsetX;
- int _editorBgOffsetY;
- int _editorBgAlpha;
- bool _streamed;
- bool _streamedKeepLoaded;
void cleanup();
void setDefaults();
- bool _precise;
DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder)
- bool _editorAllFrames;
bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100);
int _moveY;
int _moveX;
bool display(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
bool getCurrentFrame(float zoomX = 100, float zoomY = 100);
- bool _canBreak;
- bool _editorMuted;
- bool _continuous;
void reset();
- BaseObject *_owner;
- bool _changed;
- bool _paused;
- bool _finished;
+ bool isChanged();
+ bool isFinished();
bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
- uint32 _lastFrameTime;
bool draw(int x, int y, BaseObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF);
bool _looping;
int _currentFrame;
@@ -83,6 +68,24 @@ public:
virtual bool scSetProperty(const char *name, ScValue *value);
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
virtual const char *scToString();
+private:
+ BaseObject *_owner;
+ bool _canBreak;
+ bool _changed;
+ bool _editorAllFrames;
+ char *_editorBgFile;
+ int _editorBgOffsetX;
+ int _editorBgOffsetY;
+ int _editorBgAlpha;
+ bool _editorMuted;
+ bool _finished;
+ bool _continuous;
+ uint32 _lastFrameTime;
+ bool _precise;
+ bool _paused;
+ bool _streamed;
+ bool _streamedKeepLoaded;
+ bool killAllSounds();
};
} // end of namespace Wintermute