diff options
author | Denis Kasak | 2009-07-20 17:25:57 +0000 |
---|---|---|
committer | Denis Kasak | 2009-07-20 17:25:57 +0000 |
commit | a2a71cb8fbdbf1426d73c6f09f315abf04cfcbb9 (patch) | |
tree | 9775895526760b51efd16912422aacb122859368 /engines/draci/game.cpp | |
parent | 18301b6f78fd6d7eb77b5055129b71d2b8dce270 (diff) | |
download | scummvm-rg350-a2a71cb8fbdbf1426d73c6f09f315abf04cfcbb9.tar.gz scummvm-rg350-a2a71cb8fbdbf1426d73c6f09f315abf04cfcbb9.tar.bz2 scummvm-rg350-a2a71cb8fbdbf1426d73c6f09f315abf04cfcbb9.zip |
* Added scaling support
* Made the dragon scale when it is in different parts of the room
* Added getters for relative coordinates (Animation::getRelativeX() and Animation::getRelativeY())
* Commented Game::loop() and Sprite::draw*() methods in more detail
svn-id: r42627
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r-- | engines/draci/game.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index d913eb904f..46de4825fc 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -171,16 +171,33 @@ void Game::loop() { if (_vm->_mouse->lButtonPressed() && _currentRoom._walkingMap.isWalkable(x, y)) { + // Fetch dragon's animation ID + // FIXME: Need to add proper walking (this only warps the dragon to position) int animID = getObject(kDragonObject)->_anims[0]; Animation *anim = _vm->_anims->getAnimation(animID); Drawable *frame = anim->getFrame(); + // Calculate scaling factor + double scaleX = _currentRoom._pers0 + _currentRoom._persStep * y; + double scaleY = scaleX; + + // Calculate scaled height of sprite + int height = frame->getScaledHeight(scaleY); + + // Set the Z coordinate for the dragon's animation anim->setZ(y+1); - y -= frame->getHeight(); - anim->setRelative(x, y); + // We naturally want the dragon to position its feet to the location of the + // click but sprites are drawn from their top-left corner so we subtract + // the height of the dragon's sprite + y -= height; + anim->setRelative(x, y); + + // Set the scaling factor + anim->setScaling(scaleX, scaleY); + // Play the animation _vm->_anims->play(animID); debugC(4, kDraciLogicDebugLevel, "Walk to x: %d y: %d", x, y); @@ -221,6 +238,7 @@ void Game::loadRoom(int roomNum) { for (int i = 5; i >= 0; --i) { real[i] = roomReader.readByte(); + debug(2, "%d", real[i]); } _currentRoom._pers0 = real_to_double(real); |