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
This commit is contained in:
parent
c778efaca5
commit
d662c4aa20
4 changed files with 21 additions and 30 deletions
|
@ -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;
|
||||
|
|
|
@ -46,12 +46,6 @@ enum {
|
|||
kInventoryItemsID = -11
|
||||
};
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -708,7 +708,7 @@ void Script::talk(Common::Queue<int> ¶ms) {
|
|||
|
||||
// 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue