diff options
-rw-r--r-- | engines/draci/animation.cpp | 2 | ||||
-rw-r--r-- | engines/draci/animation.h | 6 | ||||
-rw-r--r-- | engines/draci/font.h | 8 | ||||
-rw-r--r-- | engines/draci/game.cpp | 14 | ||||
-rw-r--r-- | engines/draci/game.h | 2 | ||||
-rw-r--r-- | engines/draci/mouse.h | 2 | ||||
-rw-r--r-- | engines/draci/script.cpp | 8 | ||||
-rw-r--r-- | engines/draci/sprite.cpp | 2 | ||||
-rw-r--r-- | engines/draci/sprite.h | 22 | ||||
-rw-r--r-- | engines/draci/surface.cpp | 2 | ||||
-rw-r--r-- | engines/draci/surface.h | 2 | ||||
-rw-r--r-- | engines/draci/walking.h | 5 |
12 files changed, 39 insertions, 36 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp index 37ef609ea4..0c1718c1d7 100644 --- a/engines/draci/animation.cpp +++ b/engines/draci/animation.cpp @@ -127,7 +127,7 @@ void Animation::drawFrame(Surface *surface) { const Drawable *frame = _frames[_currentFrame]; if (_id == kOverlayImage) { - frame->draw(surface, false); + frame->draw(surface, false, 0, 0); } else { // Draw frame frame->drawReScaled(surface, false, _displacement); diff --git a/engines/draci/animation.h b/engines/draci/animation.h index ceebf04261..a0cf43efb8 100644 --- a/engines/draci/animation.h +++ b/engines/draci/animation.h @@ -160,9 +160,9 @@ public: AnimationManager(DraciEngine *vm) : _vm(vm), _lastIndex(-1) {} ~AnimationManager() { deleteAll(); } - Animation *addAnimation(int id, uint z, bool playing = false); - Animation *addText(int id, bool playing = false); - Animation *addItem(int id, bool playing = false); + Animation *addAnimation(int id, uint z, bool playing); + Animation *addText(int id, bool playing); + Animation *addItem(int id, bool playing); void addOverlay(Drawable *overlay, uint z); void play(int id); diff --git a/engines/draci/font.h b/engines/draci/font.h index 4fb4ae58cb..0f1bdb298d 100644 --- a/engines/draci/font.h +++ b/engines/draci/font.h @@ -66,13 +66,13 @@ public: void drawChar(Surface *dst, uint8 chr, int tx, int ty, int with_colour) const; void drawString(Surface *dst, const byte *str, uint len, int x, int y, int with_colour, - int spacing, bool markDirty = true) const; + int spacing, bool markDirty) const; void drawString(Surface *dst, const Common::String &str, - int x, int y, int with_colour, int spacing, bool markDirty = true) const; + int x, int y, int with_colour, int spacing, bool markDirty) const; - uint getStringWidth(const Common::String &str, int spacing = 0) const; + uint getStringWidth(const Common::String &str, int spacing) const; uint getStringHeight(const Common::String &str) const; - uint getLineWidth(const Common::String &str, uint startIndex, int spacing = 0) const; + uint getLineWidth(const Common::String &str, uint startIndex, int spacing) const; private: uint8 _fontHeight; diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 2fbbe54a8d..6d3700cde2 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -186,12 +186,12 @@ void Game::init() { // Initialize animation for object / room titles Animation *titleAnim = _vm->_anims->addText(kTitleText, true); - Text *title = new Text("", _vm->_smallFont, kTitleColour, 0, 0); + Text *title = new Text("", _vm->_smallFont, kTitleColour, 0, 0, 0); titleAnim->addFrame(title, NULL); // Initialize animation for speech text Animation *speechAnim = _vm->_anims->addText(kSpeechText, true); - Text *speech = new Text("", _vm->_bigFont, kFontColour1, 0, 0); + Text *speech = new Text("", _vm->_bigFont, kFontColour1, 0, 0, 0); speechAnim->addFrame(speech, NULL); // Initialize inventory animation @@ -204,7 +204,7 @@ void Game::init() { for (uint i = 0; i < kDialogueLines; ++i) { _dialogueAnims[i] = _vm->_anims->addText(kDialogueLinesID - i, true); - Text *dialogueLine = new Text("", _vm->_smallFont, kLineInactiveColour, 0, 0); + Text *dialogueLine = new Text("", _vm->_smallFont, kLineInactiveColour, 0, 0, 0); _dialogueAnims[i]->addFrame(dialogueLine, NULL); _dialogueAnims[i]->setZ(254); @@ -503,7 +503,7 @@ void Game::updateCursor() { if (_currentItem == kNoItem) { _vm->_mouse->setCursorType(kNormalCursor); } else { - _vm->_mouse->loadItemCursor(_currentItem); + _vm->_mouse->loadItemCursor(_currentItem, false); } } @@ -561,7 +561,7 @@ void Game::updateCursor() { if (_currentItem == kNoItem) { _vm->_mouse->setCursorType(kNormalCursor); } else { - _vm->_mouse->loadItemCursor(_currentItem); + _vm->_mouse->loadItemCursor(_currentItem, false); } } } @@ -667,7 +667,7 @@ void Game::putItem(int itemID, int position) { const int anim_id = kInventoryItemsID - itemID; Animation *anim = _vm->_anims->getAnimation(anim_id); if (!anim) { - anim = _vm->_anims->addItem(anim_id); + anim = _vm->_anims->addItem(anim_id, false); const BAFile *img = _vm->_itemImagesArchive->getFile(2 * itemID); Sprite *sp = new Sprite(img->_data, img->_length, 0, 0, true); anim->addFrame(sp, NULL); @@ -982,7 +982,7 @@ void Game::walkHero(int x, int y, SightDirection dir) { return; Surface *surface = _vm->_screen->getSurface(); - _hero = _currentRoom._walkingMap.findNearestWalkable(x, y, surface->getRect()); + _hero = _currentRoom._walkingMap.findNearestWalkable(x, y, surface->getDimensions()); debugC(3, kDraciLogicDebugLevel, "Walk to x: %d y: %d", _hero.x, _hero.y); // FIXME: Need to add proper walking (this only warps the dragon to position) diff --git a/engines/draci/game.h b/engines/draci/game.h index 181b93d0a7..04a1f28d3d 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -220,7 +220,7 @@ public: int loadAnimation(uint animNum, uint z); void loadOverlays(); void loadObject(uint numObj); - void loadWalkingMap(int mapID); + void loadWalkingMap(int mapID); // <0 means the room's default walking map void loadItem(int itemID); uint getNumObjects() const; diff --git a/engines/draci/mouse.h b/engines/draci/mouse.h index 1dcd988ff5..90c5b919ad 100644 --- a/engines/draci/mouse.h +++ b/engines/draci/mouse.h @@ -58,7 +58,7 @@ public: void setPosition(uint16 x, uint16 y); CursorType getCursorType() const { return _cursorType; } void setCursorType(CursorType cur); - void loadItemCursor(int itemID, bool highlighted = false); + void loadItemCursor(int itemID, bool highlighted); bool lButtonPressed() const { return _lButton; } bool rButtonPressed() const { return _rButton; } void lButtonSet(bool state) { _lButton = state; } diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 1868bfed34..7fc74e4607 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -573,7 +573,7 @@ void Script::icoStat(Common::Queue<int> ¶ms) { if (_vm->_game->getItemStatus(itemID) == 1) { if (itemID != kNoItem) { - Animation *itemAnim = _vm->_anims->addItem(kInventoryItemsID - itemID); + Animation *itemAnim = _vm->_anims->addItem(kInventoryItemsID - itemID, false); const BAFile *f = _vm->_itemImagesArchive->getFile(2 * itemID); Sprite *sp = new Sprite(f->_data, f->_length, 0, 0, true); itemAnim->addFrame(sp, NULL); @@ -581,7 +581,7 @@ void Script::icoStat(Common::Queue<int> ¶ms) { _vm->_game->setCurrentItem(itemID); - _vm->_mouse->loadItemCursor(itemID); + _vm->_mouse->loadItemCursor(itemID, false); // TODO: This is probably not needed but I'm leaving it to be sure for now // The original engine needed to turn off the mouse temporarily when changing @@ -718,7 +718,7 @@ void Script::talk(Common::Queue<int> ¶ms) { ? NULL : _vm->_dubbingArchive->getSample(sentenceID, 0); // Set the string and text colour - surface->markDirtyRect(speechFrame->getRect()); + surface->markDirtyRect(speechFrame->getRect(kNoDisplacement)); if (_vm->_sound->showSubtitles() || !sample) { speechFrame->setText(Common::String((const char *)f->_data+1, f->_length-1)); } else { @@ -780,7 +780,7 @@ void Script::talk(Common::Queue<int> ¶ms) { _vm->_game->loop(); // Delete the text - _vm->_screen->getSurface()->markDirtyRect(speechFrame->getRect()); + _vm->_screen->getSurface()->markDirtyRect(speechFrame->getRect(kNoDisplacement)); speechFrame->setText(""); // Stop the playing sample and deallocate it. Stopping should only be diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index 0b9d61e8c1..183a3d1030 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -332,7 +332,7 @@ uint Text::getLength() const { } void Text::draw(Surface *surface, bool markDirty, int relX, int relY) const { - _font->drawString(surface, _text, _x + relX, _y + relY, _colour, _spacing); + _font->drawString(surface, _text, _x + relX, _y + relY, _colour, _spacing, true); } // TODO: Handle scaled parameter properly by implementing Text scaling diff --git a/engines/draci/sprite.h b/engines/draci/sprite.h index 5f0a425183..25c255547e 100644 --- a/engines/draci/sprite.h +++ b/engines/draci/sprite.h @@ -44,8 +44,8 @@ extern const Displacement kNoDisplacement; class Drawable { public: - virtual void draw(Surface *surface, bool markDirty, int relX=0, int relY=0) const = 0; - virtual void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement = kNoDisplacement) const = 0; + virtual void draw(Surface *surface, bool markDirty, int relX, int relY) const = 0; + virtual void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement) const = 0; virtual ~Drawable() {}; @@ -69,7 +69,7 @@ public: void setDelay(int delay) { _delay = delay; } int getDelay() const { return _delay; } - virtual Common::Rect getRect(const Displacement &displacement = kNoDisplacement) const = 0; + virtual Common::Rect getRect(const Displacement &displacement) const = 0; virtual DrawableType getType() const = 0; @@ -106,16 +106,16 @@ public: ~Sprite(); - void draw(Surface *surface, bool markDirty, int relX=0, int relY=0) const; - void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement = kNoDisplacement) const; + void draw(Surface *surface, bool markDirty, int relX, int relY) const; + void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement) const; void setMirrorOn(); void setMirrorOff(); - Common::Rect getRect(const Displacement &displacement = kNoDisplacement) const; + Common::Rect getRect(const Displacement &displacement) const; const byte *getBuffer() const { return _data; } - int getPixel(int x, int y, const Displacement &displacement = kNoDisplacement) const; + int getPixel(int x, int y, const Displacement &displacement) const; DrawableType getType() const { return kDrawableSprite; } @@ -128,7 +128,7 @@ class Text : public Drawable { public: Text(const Common::String &str, const Font *font, byte fontColour, - int x, int y, uint spacing = 0); + int x, int y, uint spacing); ~Text() {}; void setText(const Common::String &str); @@ -138,13 +138,13 @@ public: uint getLength() const; - void draw(Surface *surface, bool markDirty, int relX=0, int relY=0) const; + void draw(Surface *surface, bool markDirty, int relX, int relY) const; // TODO: drawReScaled just calls draw so Text can be accessed through a Drawable pointer. // Handle scaling text sometimes (not essential). - void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement = kNoDisplacement) const { draw(surface, markDirty, displacement.relX, displacement.relY); } - Common::Rect getRect(const Displacement &displacement = kNoDisplacement) const; + void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement) const { draw(surface, markDirty, displacement.relX, displacement.relY); } + Common::Rect getRect(const Displacement &displacement) const; DrawableType getType() const { return kDrawableText; } private: diff --git a/engines/draci/surface.cpp b/engines/draci/surface.cpp index 6330c17cb3..1832aa6b02 100644 --- a/engines/draci/surface.cpp +++ b/engines/draci/surface.cpp @@ -168,7 +168,7 @@ uint Surface::putAboveY(int y, int height) const { /** * @brief Returns a Common::Rect corresponding to the surface. */ -Common::Rect Surface::getRect() const { +Common::Rect Surface::getDimensions() const { return Common::Rect(w, h); } diff --git a/engines/draci/surface.h b/engines/draci/surface.h index be2e6626c5..f026357a2a 100644 --- a/engines/draci/surface.h +++ b/engines/draci/surface.h @@ -47,7 +47,7 @@ public: void fill(uint colour); uint putAboveY(int y, int height) const; uint centerOnX(int x, int width) const; - Common::Rect getRect() const; + Common::Rect getDimensions() const; private: /** The current transparent colour of the surface. See getTransparentColour() and diff --git a/engines/draci/walking.h b/engines/draci/walking.h index aff4fe7f95..47157b03f8 100644 --- a/engines/draci/walking.h +++ b/engines/draci/walking.h @@ -32,7 +32,8 @@ namespace Draci { class WalkingMap { public: - WalkingMap() : _realWidth(0), _realHeight(0), _mapWidth(0), _mapHeight(0), _byteWidth(0), _data(NULL) { } + WalkingMap() : _realWidth(0), _realHeight(0), _deltaX(1), _deltaY(1), + _mapWidth(0), _mapHeight(0), _byteWidth(0), _data(NULL) { } void load(const byte *data, uint length); bool isWalkable(int x, int y) const; @@ -43,6 +44,8 @@ private: int _deltaX, _deltaY; int _mapWidth, _mapHeight; int _byteWidth; + + // We don't own the pointer. It points to the BArchive cache for this room. const byte *_data; }; |