aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/game.cpp
diff options
context:
space:
mode:
authorDenis Kasak2009-07-25 04:36:43 +0000
committerDenis Kasak2009-07-25 04:36:43 +0000
commit20baaf93f5df7871e93162db479fe1ab526fe35c (patch)
tree671559284a77e4164706e1942c94be0b14ed42c8 /engines/draci/game.cpp
parent22c372137f2649fa614966b24918064c2bb44726 (diff)
downloadscummvm-rg350-20baaf93f5df7871e93162db479fe1ab526fe35c.tar.gz
scummvm-rg350-20baaf93f5df7871e93162db479fe1ab526fe35c.tar.bz2
scummvm-rg350-20baaf93f5df7871e93162db479fe1ab526fe35c.zip
* Moved walking code to Game::walkHero().
* Implemented WalkOn GPL command. * Temporarily remaped StayOn and WalkOnPlay to WalkOn (for testing). svn-id: r42735
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r--engines/draci/game.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index d7ae538209..5cfbefebad 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -171,41 +171,44 @@ void Game::loop() {
int y = _vm->_mouse->getPosY();
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];
+ walkHero(x, y);
+ }
+ }
+}
- Animation *anim = _vm->_anims->getAnimation(animID);
+void Game::walkHero(int x, int 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];
- // Calculate scaling factors
- double scaleX = _currentRoom._pers0 + _currentRoom._persStep * y;
- double scaleY = scaleX;
+ Animation *anim = _vm->_anims->getAnimation(animID);
- // Set the Z coordinate for the dragon's animation
- anim->setZ(y+1);
+ // Calculate scaling factors
+ double scaleX = _currentRoom._pers0 + _currentRoom._persStep * y;
+ double scaleY = scaleX;
- // Fetch current frame
- Drawable *frame = anim->getFrame();
+ // Set the Z coordinate for the dragon's animation
+ anim->setZ(y+1);
- // Fetch base height of the frame
- uint height = frame->getHeight();
+ // Fetch current frame
+ Drawable *frame = anim->getFrame();
- // 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
- y -= (int)(scaleY * height);
- anim->setRelative(x, y);
+ // Fetch base height of the frame
+ uint height = frame->getHeight();
- // Set the per-animation scaling factor
- anim->setScaleFactors(scaleX, scaleY);
+ // 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
+ y -= (int)(scaleY * height);
+ anim->setRelative(x, y);
- // Play the animation
- _vm->_anims->play(animID);
+ // Set the per-animation scaling factor
+ anim->setScaleFactors(scaleX, scaleY);
- debugC(4, kDraciLogicDebugLevel, "Walk to x: %d y: %d", x, y);
- }
- }
+ // Play the animation
+ _vm->_anims->play(animID);
+
+ debugC(4, kDraciLogicDebugLevel, "Walk to x: %d y: %d", x, y);
}
void Game::loadRoom(int roomNum) {