aboutsummaryrefslogtreecommitdiff
path: root/engines/toon/anim.cpp
diff options
context:
space:
mode:
authorSylvain Dupont2010-10-26 22:18:14 +0000
committerSylvain Dupont2010-10-26 22:18:14 +0000
commit66da19552ea855d825c6a68b00e3e5ea8b84d932 (patch)
tree6d3cc2502a4e0a16ca16cd8264f3c3db4ae833a8 /engines/toon/anim.cpp
parent83eb3b36541aa9ca2872db6fd173e628d16b094a (diff)
downloadscummvm-rg350-66da19552ea855d825c6a68b00e3e5ea8b84d932.tar.gz
scummvm-rg350-66da19552ea855d825c6a68b00e3e5ea8b84d932.tar.bz2
scummvm-rg350-66da19552ea855d825c6a68b00e3e5ea8b84d932.zip
TOON: Implement cmd_Set_Anim_Scale_Size
Used to rescale the knight animation when the knight is moved around the room in Chapter 2 svn-id: r53865
Diffstat (limited to 'engines/toon/anim.cpp')
-rw-r--r--engines/toon/anim.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index be53c12dc7..c5769f5081 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -425,6 +425,7 @@ AnimationInstance::AnimationInstance(ToonEngine *vm, AnimationInstanceType type)
_playing = false;
_rangeEnd = 0;
_useMask = false;
+ _alignBottom = false;
_rangeStart = 0;
_scale = 1024;
_x = 0;
@@ -433,6 +434,7 @@ AnimationInstance::AnimationInstance(ToonEngine *vm, AnimationInstanceType type)
_layerZ = 0;
}
+
void AnimationInstance::render() {
debugC(5, kDebugAnim, "render()");
if (_visible && _animation) {
@@ -443,11 +445,22 @@ void AnimationInstance::render() {
if (frame >= _animation->_numFrames)
frame = _animation->_numFrames - 1;
+ int32 x = _x;
+ int32 y = _y;
+
+ if (_alignBottom) {
+ int32 offsetX = (_animation->_x2 - _animation->_x1) / 2 * (_scale - 1024);
+ int32 offsetY = (_animation->_y2 - _animation->_y1) * (_scale - 1024);
+
+ x -= offsetX >> 10;
+ y -= offsetY >> 10;
+ }
+
if (_useMask) {
//if (_scale == 100) { // 100% scale
// _animation->drawFrameWithMask(_vm->getMainSurface(), _currentFrame, _x, _y, _z, _vm->getMask());
//} else {
- _animation->drawFrameWithMaskAndScale(_vm->getMainSurface(), frame, _x, _y, _z, _vm->getMask(), _scale);
+ _animation->drawFrameWithMaskAndScale(_vm->getMainSurface(), frame, x, y, _z, _vm->getMask(), _scale);
//}
} else {
_animation->drawFrame(_vm->getMainSurface(), frame, _x, _y);
@@ -534,9 +547,10 @@ void AnimationInstance::setVisible(bool visible) {
_visible = visible;
}
-void AnimationInstance::setScale(int32 scale) {
+void AnimationInstance::setScale(int32 scale, bool align) {
debugC(4, kDebugAnim, "setScale(%d)", scale);
_scale = scale;
+ _alignBottom = align;
}
void AnimationInstance::setUseMask(bool useMask) {