diff options
author | Kamil Zbróg | 2013-12-05 00:02:31 +0000 |
---|---|---|
committer | Kamil Zbróg | 2013-12-05 00:02:31 +0000 |
commit | 8e772f936c43a68e4ae7c68b178bd9fa3a3e4f1f (patch) | |
tree | 0bf73c3bb86ecbf302db281a7963df1bdcd8749a /engines/prince/hero.cpp | |
parent | 69a58457744c662930f5f19b90d95d7647d580b2 (diff) | |
download | scummvm-rg350-8e772f936c43a68e4ae7c68b178bd9fa3a3e4f1f.tar.gz scummvm-rg350-8e772f936c43a68e4ae7c68b178bd9fa3a3e4f1f.tar.bz2 scummvm-rg350-8e772f936c43a68e4ae7c68b178bd9fa3a3e4f1f.zip |
PRINCE: animation added
Diffstat (limited to 'engines/prince/hero.cpp')
-rw-r--r-- | engines/prince/hero.cpp | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/engines/prince/hero.cpp b/engines/prince/hero.cpp index 277e521bee..621a9b8ee1 100644 --- a/engines/prince/hero.cpp +++ b/engines/prince/hero.cpp @@ -19,16 +19,56 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ +#include "common/debug.h" #include "prince/hero.h" +#include "prince/hero_set.h" +#include "prince/animation.h" +#include "prince/resource.h" + namespace Prince { +static const uint32 kMoveSetSize = 26; + Hero::Hero() : _number(0), _visible(false), _state(STAY), _middleX(0), _middleY(0) - , _boreNum(0), _currHeight(0), _moveDelay(0), _shadMinus(1) -{ + , _boreNum(0), _currHeight(0), _moveDelay(0), _shadMinus(1) { } +bool Hero::loadAnimSet(uint32 animSetNr) { + animSetNr = 6; + if (animSetNr > sizeof(heroSetTable)) { + return false; + } + + for (uint32 i = 0; i < _moveSet.size(); ++i) { + delete _moveSet[i]; + } + + const HeroSetAnimNames &animSet = *heroSetTable[animSetNr]; + + _moveSet.resize(kMoveSetSize); + for (uint32 i = 0; i < kMoveSetSize; ++i) { + debug("Anim set item %d %s", i, animSet[i]); + Animation *anim = NULL; + if (animSet[i] != NULL) { + anim = new Animation(); + Resource::loadResource(anim, animSet[i]); + } + _moveSet[i] = anim; + } + + + return true; +} + +const Graphics::Surface * Hero::getSurface() { + if (_moveSet[3]) { + return _moveSet[3]->getSurface(0); + } + return NULL; +} + } /* vim: set tabstop=4 noexpandtab: */ |