aboutsummaryrefslogtreecommitdiff
path: root/engines/draci
diff options
context:
space:
mode:
authorRobert Špalek2009-10-30 01:56:52 +0000
committerRobert Špalek2009-10-30 01:56:52 +0000
commitd662c4aa20342e74ed5d82a14e3fc8e62a45ca8c (patch)
treef75bfb0465e398fac23955f526207ee9b50fec13 /engines/draci
parentc778efaca5b9d20f73e9d12cc8404d8948f8e522 (diff)
downloadscummvm-rg350-d662c4aa20342e74ed5d82a14e3fc8e62a45ca8c.tar.gz
scummvm-rg350-d662c4aa20342e74ed5d82a14e3fc8e62a45ca8c.tar.bz2
scummvm-rg350-d662c4aa20342e74ed5d82a14e3fc8e62a45ca8c.zip
Remove the last 2 default parameter values.
They usually just add unnecessary confusion and this is definitely such an example. Removal will clarify the code. svn-id: r45512
Diffstat (limited to 'engines/draci')
-rw-r--r--engines/draci/animation.cpp20
-rw-r--r--engines/draci/animation.h11
-rw-r--r--engines/draci/game.cpp18
-rw-r--r--engines/draci/script.cpp2
4 files changed, 21 insertions, 30 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp
index 0c1718c1d7..1c729e9c85 100644
--- a/engines/draci/animation.cpp
+++ b/engines/draci/animation.cpp
@@ -219,18 +219,14 @@ void Animation::setIndex(int index) {
_index = index;
}
-Drawable *Animation::getFrame(int frameNum) {
+Drawable *Animation::getCurrentFrame() {
// If there are no frames stored, return NULL
- if (_frames.size() == 0) {
- return NULL;
- }
+ return _frames.size() > 0 ? _frames[_currentFrame] : NULL;
+}
- // If no argument is passed, return the current frame
- if (frameNum == kCurrentFrame) {
- return _frames[_currentFrame];
- } else {
- return _frames[frameNum];
- }
+Drawable *Animation::getFrame(int frameNum) {
+ // If there are no frames stored, return NULL
+ return _frames.size() > 0 ? _frames[frameNum] : NULL;
}
uint Animation::getFrameCount() const {
@@ -417,7 +413,7 @@ void AnimationManager::drawScene(Surface *surf) {
continue;
}
- (*it)->nextFrame();
+ (*it)->nextFrame(false);
(*it)->drawFrame(surf);
}
}
@@ -559,7 +555,7 @@ int AnimationManager::getTopAnimationID(int x, int y) const {
continue;
}
- const Drawable *frame = anim->getFrame();
+ const Drawable *frame = anim->getCurrentFrame();
if (frame == NULL) {
continue;
diff --git a/engines/draci/animation.h b/engines/draci/animation.h
index a0cf43efb8..c0d536f2a2 100644
--- a/engines/draci/animation.h
+++ b/engines/draci/animation.h
@@ -47,12 +47,6 @@ enum {
};
/**
- * Default argument to Animation::getFrame() that makes it return
- * the current frame instead of the user specifying it.
- */
-enum { kCurrentFrame = -1 };
-
-/**
* Used by overlays as a neutral index that won't get
* released with the GPL Release command.
*/
@@ -74,11 +68,12 @@ public:
void setID(int id);
int getID() const;
- void nextFrame(bool force = false);
+ void nextFrame(bool force);
void drawFrame(Surface *surface);
void addFrame(Drawable *frame, const SoundSample *sample);
- Drawable *getFrame(int frameNum = kCurrentFrame);
+ Drawable *getCurrentFrame();
+ Drawable *getFrame(int frameNum);
void setCurrentFrame(uint frame);
uint currentFrameNum() const;
uint getFrameCount() const;
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 6d3700cde2..b6d8e08486 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -211,7 +211,7 @@ void Game::init() {
_dialogueAnims[i]->setRelative(1,
kScreenHeight - (i + 1) * _vm->_smallFont->getFontHeight());
- Text *text = reinterpret_cast<Text *>(_dialogueAnims[i]->getFrame());
+ Text *text = reinterpret_cast<Text *>(_dialogueAnims[i]->getCurrentFrame());
text->setText("");
}
@@ -266,7 +266,7 @@ void Game::loop() {
if (_loopStatus == kStatusDialogue && _loopSubstatus == kSubstatusOrdinary) {
Text *text;
for (int i = 0; i < kDialogueLines; ++i) {
- text = reinterpret_cast<Text *>(_dialogueAnims[i]->getFrame());
+ text = reinterpret_cast<Text *>(_dialogueAnims[i]->getCurrentFrame());
if (_animUnderCursor == _dialogueAnims[i]->getID()) {
text->setColour(kLineActiveColour);
@@ -285,7 +285,7 @@ void Game::loop() {
if (_vm->_mouse->isCursorOn()) {
// Fetch the dedicated objects' title animation / current frame
Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);
- Text *title = reinterpret_cast<Text *>(titleAnim->getFrame());
+ Text *title = reinterpret_cast<Text *>(titleAnim->getCurrentFrame());
updateCursor();
updateTitle();
@@ -581,7 +581,7 @@ void Game::updateTitle() {
// Fetch the dedicated objects' title animation / current frame
Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);
- Text *title = reinterpret_cast<Text *>(titleAnim->getFrame());
+ Text *title = reinterpret_cast<Text *>(titleAnim->getCurrentFrame());
// Mark dirty rectangle to delete the previous text
titleAnim->markDirtyRect(surface);
@@ -672,7 +672,7 @@ void Game::putItem(int itemID, int position) {
Sprite *sp = new Sprite(img->_data, img->_length, 0, 0, true);
anim->addFrame(sp, NULL);
}
- Drawable *frame = anim->getFrame();
+ Drawable *frame = anim->getCurrentFrame();
const int x = kInventoryX +
(column * kInventoryItemWidth) -
@@ -810,7 +810,7 @@ int Game::dialogueDraw() {
debugC(3, kDraciLogicDebugLevel, "Testing dialogue block %d", i);
if (_vm->_script->testExpression(blockTest, 1)) {
anim = _dialogueAnims[_dialogueLinesNum];
- dialogueLine = reinterpret_cast<Text *>(anim->getFrame());
+ dialogueLine = reinterpret_cast<Text *>(anim->getCurrentFrame());
dialogueLine->setText(_dialogueBlocks[i]._title);
dialogueLine->setColour(kLineInactiveColour);
@@ -823,7 +823,7 @@ int Game::dialogueDraw() {
for (i = _dialogueLinesNum; i < kDialogueLines; ++i) {
_lines[i] = -1;
anim = _dialogueAnims[i];
- dialogueLine = reinterpret_cast<Text *>(anim->getFrame());
+ dialogueLine = reinterpret_cast<Text *>(anim->getCurrentFrame());
dialogueLine->setText("");
}
@@ -853,7 +853,7 @@ int Game::dialogueDraw() {
}
for (i = 0; i < kDialogueLines; ++i) {
- dialogueLine = reinterpret_cast<Text *>(_dialogueAnims[i]->getFrame());
+ dialogueLine = reinterpret_cast<Text *>(_dialogueAnims[i]->getCurrentFrame());
_dialogueAnims[i]->markDirtyRect(_vm->_screen->getSurface());
dialogueLine->setText("");
}
@@ -1421,7 +1421,7 @@ void Game::positionAnimAsHero(Animation *anim) {
anim->setZ(_hero.y + 1);
// Fetch current frame
- Drawable *frame = anim->getFrame();
+ Drawable *frame = anim->getCurrentFrame();
// Fetch base dimensions of the frame
uint height = frame->getHeight();
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp
index 7fc74e4607..608dac598b 100644
--- a/engines/draci/script.cpp
+++ b/engines/draci/script.cpp
@@ -708,7 +708,7 @@ void Script::talk(Common::Queue<int> &params) {
// Fetch frame for the speech text
Animation *speechAnim = _vm->_anims->getAnimation(kSpeechText);
- Text *speechFrame = reinterpret_cast<Text *>(speechAnim->getFrame());
+ Text *speechFrame = reinterpret_cast<Text *>(speechAnim->getCurrentFrame());
// Fetch person info
const Person *person = _vm->_game->getPerson(personID);