aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/game.cpp
diff options
context:
space:
mode:
authorDenis Kasak2009-07-24 01:54:13 +0000
committerDenis Kasak2009-07-24 01:54:13 +0000
commita2bca06b3fe00379d8accf29e7f442fe0a3cd781 (patch)
tree51ece4e3f0baf6da31dbf89905373f356a6945fe /engines/draci/game.cpp
parent1726cc8d247f2ad8ac5b4136b866055d3e30155b (diff)
downloadscummvm-rg350-a2bca06b3fe00379d8accf29e7f442fe0a3cd781.tar.gz
scummvm-rg350-a2bca06b3fe00379d8accf29e7f442fe0a3cd781.tar.bz2
scummvm-rg350-a2bca06b3fe00379d8accf29e7f442fe0a3cd781.zip
Added support for per-animation scaling (via scaling factors). I have decided to go for a mixed approach (where Animation has a global scaling factor for the whole animation which is separate from Drawable's scaled width and height) so the animation can be scaled more naturally when the scale often changes (like with perspective when the dragon is walking). Previously, one had to alter the sizes of each frame of the dragon's animation whenever the dragon moved which was unclean.
svn-id: r42680
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r--engines/draci/game.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 2a0e5dca6f..de925fe11f 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -193,21 +193,11 @@ void Game::loop() {
// 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 current height of the dragon's sprite
- // We also need to do this before we change the frames' scaled dimensions
- // so setRelative() can correctly delete the old frame
y -= (int)(scaleY * height);
anim->setRelative(x, y);
- // Set the scaled dimensions for all frames
- for (uint i = 0; i < anim->getFramesNum(); ++i) {
- frame = anim->getFrame(i);
-
- // Calculate scaled dimensions
- uint scaledWidth = (uint)(scaleX * frame->getWidth());
- uint scaledHeight = (uint)(scaleY * frame->getHeight());
-
- frame->setScaled(scaledWidth, scaledHeight);
- }
+ // Set the per-animation scaling factor
+ anim->setScaleFactors(scaleX, scaleY);
// Play the animation
_vm->_anims->play(animID);