[Scummvm-cvs-logs] SF.net SVN: scummvm:[53865] scummvm/trunk/engines/toon
sylvaintv at users.sourceforge.net
sylvaintv at users.sourceforge.net
Wed Oct 27 00:18:14 CEST 2010
Revision: 53865
http://scummvm.svn.sourceforge.net/scummvm/?rev=53865&view=rev
Author: sylvaintv
Date: 2010-10-26 22:18:14 +0000 (Tue, 26 Oct 2010)
Log Message:
-----------
TOON: Implement cmd_Set_Anim_Scale_Size
Used to rescale the knight animation when the knight
is moved around the room in Chapter 2
Modified Paths:
--------------
scummvm/trunk/engines/toon/anim.cpp
scummvm/trunk/engines/toon/anim.h
scummvm/trunk/engines/toon/script_func.cpp
Modified: scummvm/trunk/engines/toon/anim.cpp
===================================================================
--- scummvm/trunk/engines/toon/anim.cpp 2010-10-26 22:00:44 UTC (rev 53864)
+++ scummvm/trunk/engines/toon/anim.cpp 2010-10-26 22:18:14 UTC (rev 53865)
@@ -425,6 +425,7 @@
_playing = false;
_rangeEnd = 0;
_useMask = false;
+ _alignBottom = false;
_rangeStart = 0;
_scale = 1024;
_x = 0;
@@ -433,6 +434,7 @@
_layerZ = 0;
}
+
void AnimationInstance::render() {
debugC(5, kDebugAnim, "render()");
if (_visible && _animation) {
@@ -443,11 +445,22 @@
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 @@
_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) {
Modified: scummvm/trunk/engines/toon/anim.h
===================================================================
--- scummvm/trunk/engines/toon/anim.h 2010-10-26 22:00:44 UTC (rev 53864)
+++ scummvm/trunk/engines/toon/anim.h 2010-10-26 22:18:14 UTC (rev 53865)
@@ -102,7 +102,7 @@
void forceFrame(int32 position);
void setPosition(int32 x, int32 y, int32 z, bool relative = false);
Animation *getAnimation() const { return _animation; }
- void setScale(int32 scale);
+ void setScale(int32 scale, bool align = false);
void setVisible(bool visible);
bool getVisible() const { return _visible; }
void setUseMask(bool useMask);
@@ -150,6 +150,7 @@
bool _playing;
bool _looping;
bool _visible;
+ bool _alignBottom;
ToonEngine *_vm;
};
Modified: scummvm/trunk/engines/toon/script_func.cpp
===================================================================
--- scummvm/trunk/engines/toon/script_func.cpp 2010-10-26 22:00:44 UTC (rev 53864)
+++ scummvm/trunk/engines/toon/script_func.cpp 2010-10-26 22:18:14 UTC (rev 53865)
@@ -473,6 +473,14 @@
}
int32 ScriptFunc::sys_Cmd_Set_Anim_Scale_Size(EMCState *state) {
+ int32 animID = stackPos(0);
+ int32 scale = stackPos(1);
+
+ SceneAnimation *sceneAnim = _vm->getSceneAnimation(animID);
+ if (sceneAnim) {
+ sceneAnim->_animInstance->setUseMask(true);
+ sceneAnim->_animInstance->setScale(scale,true);
+ }
return 0;
}
int32 ScriptFunc::sys_Cmd_Delete_Item_From_Inventory(EMCState *state) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list