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;
|
_index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
Drawable *Animation::getFrame(int frameNum) {
|
Drawable *Animation::getCurrentFrame() {
|
||||||
// If there are no frames stored, return NULL
|
// If there are no frames stored, return NULL
|
||||||
if (_frames.size() == 0) {
|
return _frames.size() > 0 ? _frames[_currentFrame] : NULL;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no argument is passed, return the current frame
|
Drawable *Animation::getFrame(int frameNum) {
|
||||||
if (frameNum == kCurrentFrame) {
|
// If there are no frames stored, return NULL
|
||||||
return _frames[_currentFrame];
|
return _frames.size() > 0 ? _frames[frameNum] : NULL;
|
||||||
} else {
|
|
||||||
return _frames[frameNum];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint Animation::getFrameCount() const {
|
uint Animation::getFrameCount() const {
|
||||||
|
@ -417,7 +413,7 @@ void AnimationManager::drawScene(Surface *surf) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*it)->nextFrame();
|
(*it)->nextFrame(false);
|
||||||
(*it)->drawFrame(surf);
|
(*it)->drawFrame(surf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,7 +555,7 @@ int AnimationManager::getTopAnimationID(int x, int y) const {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Drawable *frame = anim->getFrame();
|
const Drawable *frame = anim->getCurrentFrame();
|
||||||
|
|
||||||
if (frame == NULL) {
|
if (frame == NULL) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -46,12 +46,6 @@ enum {
|
||||||
kInventoryItemsID = -11
|
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
|
* Used by overlays as a neutral index that won't get
|
||||||
* released with the GPL Release command.
|
* released with the GPL Release command.
|
||||||
|
@ -74,11 +68,12 @@ public:
|
||||||
void setID(int id);
|
void setID(int id);
|
||||||
int getID() const;
|
int getID() const;
|
||||||
|
|
||||||
void nextFrame(bool force = false);
|
void nextFrame(bool force);
|
||||||
void drawFrame(Surface *surface);
|
void drawFrame(Surface *surface);
|
||||||
|
|
||||||
void addFrame(Drawable *frame, const SoundSample *sample);
|
void addFrame(Drawable *frame, const SoundSample *sample);
|
||||||
Drawable *getFrame(int frameNum = kCurrentFrame);
|
Drawable *getCurrentFrame();
|
||||||
|
Drawable *getFrame(int frameNum);
|
||||||
void setCurrentFrame(uint frame);
|
void setCurrentFrame(uint frame);
|
||||||
uint currentFrameNum() const;
|
uint currentFrameNum() const;
|
||||||
uint getFrameCount() const;
|
uint getFrameCount() const;
|
||||||
|
|
|
@ -211,7 +211,7 @@ void Game::init() {
|
||||||
_dialogueAnims[i]->setRelative(1,
|
_dialogueAnims[i]->setRelative(1,
|
||||||
kScreenHeight - (i + 1) * _vm->_smallFont->getFontHeight());
|
kScreenHeight - (i + 1) * _vm->_smallFont->getFontHeight());
|
||||||
|
|
||||||
Text *text = reinterpret_cast<Text *>(_dialogueAnims[i]->getFrame());
|
Text *text = reinterpret_cast<Text *>(_dialogueAnims[i]->getCurrentFrame());
|
||||||
text->setText("");
|
text->setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ void Game::loop() {
|
||||||
if (_loopStatus == kStatusDialogue && _loopSubstatus == kSubstatusOrdinary) {
|
if (_loopStatus == kStatusDialogue && _loopSubstatus == kSubstatusOrdinary) {
|
||||||
Text *text;
|
Text *text;
|
||||||
for (int i = 0; i < kDialogueLines; ++i) {
|
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()) {
|
if (_animUnderCursor == _dialogueAnims[i]->getID()) {
|
||||||
text->setColour(kLineActiveColour);
|
text->setColour(kLineActiveColour);
|
||||||
|
@ -285,7 +285,7 @@ void Game::loop() {
|
||||||
if (_vm->_mouse->isCursorOn()) {
|
if (_vm->_mouse->isCursorOn()) {
|
||||||
// Fetch the dedicated objects' title animation / current frame
|
// Fetch the dedicated objects' title animation / current frame
|
||||||
Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);
|
Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);
|
||||||
Text *title = reinterpret_cast<Text *>(titleAnim->getFrame());
|
Text *title = reinterpret_cast<Text *>(titleAnim->getCurrentFrame());
|
||||||
|
|
||||||
updateCursor();
|
updateCursor();
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
@ -581,7 +581,7 @@ void Game::updateTitle() {
|
||||||
|
|
||||||
// Fetch the dedicated objects' title animation / current frame
|
// Fetch the dedicated objects' title animation / current frame
|
||||||
Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);
|
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
|
// Mark dirty rectangle to delete the previous text
|
||||||
titleAnim->markDirtyRect(surface);
|
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);
|
Sprite *sp = new Sprite(img->_data, img->_length, 0, 0, true);
|
||||||
anim->addFrame(sp, NULL);
|
anim->addFrame(sp, NULL);
|
||||||
}
|
}
|
||||||
Drawable *frame = anim->getFrame();
|
Drawable *frame = anim->getCurrentFrame();
|
||||||
|
|
||||||
const int x = kInventoryX +
|
const int x = kInventoryX +
|
||||||
(column * kInventoryItemWidth) -
|
(column * kInventoryItemWidth) -
|
||||||
|
@ -810,7 +810,7 @@ int Game::dialogueDraw() {
|
||||||
debugC(3, kDraciLogicDebugLevel, "Testing dialogue block %d", i);
|
debugC(3, kDraciLogicDebugLevel, "Testing dialogue block %d", i);
|
||||||
if (_vm->_script->testExpression(blockTest, 1)) {
|
if (_vm->_script->testExpression(blockTest, 1)) {
|
||||||
anim = _dialogueAnims[_dialogueLinesNum];
|
anim = _dialogueAnims[_dialogueLinesNum];
|
||||||
dialogueLine = reinterpret_cast<Text *>(anim->getFrame());
|
dialogueLine = reinterpret_cast<Text *>(anim->getCurrentFrame());
|
||||||
dialogueLine->setText(_dialogueBlocks[i]._title);
|
dialogueLine->setText(_dialogueBlocks[i]._title);
|
||||||
|
|
||||||
dialogueLine->setColour(kLineInactiveColour);
|
dialogueLine->setColour(kLineInactiveColour);
|
||||||
|
@ -823,7 +823,7 @@ int Game::dialogueDraw() {
|
||||||
for (i = _dialogueLinesNum; i < kDialogueLines; ++i) {
|
for (i = _dialogueLinesNum; i < kDialogueLines; ++i) {
|
||||||
_lines[i] = -1;
|
_lines[i] = -1;
|
||||||
anim = _dialogueAnims[i];
|
anim = _dialogueAnims[i];
|
||||||
dialogueLine = reinterpret_cast<Text *>(anim->getFrame());
|
dialogueLine = reinterpret_cast<Text *>(anim->getCurrentFrame());
|
||||||
dialogueLine->setText("");
|
dialogueLine->setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,7 +853,7 @@ int Game::dialogueDraw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < kDialogueLines; ++i) {
|
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());
|
_dialogueAnims[i]->markDirtyRect(_vm->_screen->getSurface());
|
||||||
dialogueLine->setText("");
|
dialogueLine->setText("");
|
||||||
}
|
}
|
||||||
|
@ -1421,7 +1421,7 @@ void Game::positionAnimAsHero(Animation *anim) {
|
||||||
anim->setZ(_hero.y + 1);
|
anim->setZ(_hero.y + 1);
|
||||||
|
|
||||||
// Fetch current frame
|
// Fetch current frame
|
||||||
Drawable *frame = anim->getFrame();
|
Drawable *frame = anim->getCurrentFrame();
|
||||||
|
|
||||||
// Fetch base dimensions of the frame
|
// Fetch base dimensions of the frame
|
||||||
uint height = frame->getHeight();
|
uint height = frame->getHeight();
|
||||||
|
|
|
@ -708,7 +708,7 @@ void Script::talk(Common::Queue<int> ¶ms) {
|
||||||
|
|
||||||
// Fetch frame for the speech text
|
// Fetch frame for the speech text
|
||||||
Animation *speechAnim = _vm->_anims->getAnimation(kSpeechText);
|
Animation *speechAnim = _vm->_anims->getAnimation(kSpeechText);
|
||||||
Text *speechFrame = reinterpret_cast<Text *>(speechAnim->getFrame());
|
Text *speechFrame = reinterpret_cast<Text *>(speechAnim->getCurrentFrame());
|
||||||
|
|
||||||
// Fetch person info
|
// Fetch person info
|
||||||
const Person *person = _vm->_game->getPerson(personID);
|
const Person *person = _vm->_game->getPerson(personID);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue