diff options
author | Nicola Mettifogo | 2008-08-15 04:30:45 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-08-15 04:30:45 +0000 |
commit | 0606fef24e03580d2d2f3c34f9fd254f361d7623 (patch) | |
tree | d436c886cd1387bd5d89d913eeae6e8deaf1fd3f /engines/parallaction/parallaction.cpp | |
parent | c70d09bc26c28b565de022491dfa164bc1d720e6 (diff) | |
download | scummvm-rg350-0606fef24e03580d2d2f3c34f9fd254f361d7623.tar.gz scummvm-rg350-0606fef24e03580d2d2f3c34f9fd254f361d7623.tar.bz2 scummvm-rg350-0606fef24e03580d2d2f3c34f9fd254f361d7623.zip |
Made coordinates and frame number protected into Zone and Animation, and changed client code to use get/set. This will allow various simplifications (e.g. when calculating Z), and is a step towards correct handling of interactive zones of Zone/Animation in BRA.
svn-id: r33892
Diffstat (limited to 'engines/parallaction/parallaction.cpp')
-rw-r--r-- | engines/parallaction/parallaction.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 195dc7a89a..e8621d5fd7 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -352,9 +352,9 @@ void Parallaction::runGame() { if (_input->_inputMode == Input::kInputModeGame) { _programExec->runScripts(_location._programs.begin(), _location._programs.end()); - _char._ani->_z = _char._ani->height() + _char._ani->_top; + _char._ani->setZ(_char._ani->height() + _char._ani->getY()); if (_char._ani->gfxobj) { - _char._ani->gfxobj->z = _char._ani->_z; + _char._ani->gfxobj->z = _char._ani->getZ(); } _char._walker->walk(); drawAnimations(); @@ -452,7 +452,7 @@ void Parallaction::freeZones() { // NOTE : this condition has been relaxed compared to the original, to allow the engine // to retain special - needed - zones that were lost across location switches. ZonePtr z = *it; - if (((z->_top == -1) || (z->_left == -2)) && ((_engineFlags & kEngineQuit) == 0)) { + if (((z->getY() == -1) || (z->getX() == -2)) && ((_engineFlags & kEngineQuit) == 0)) { debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_name); it++; } else { @@ -510,10 +510,10 @@ Character::Character(Parallaction *vm) : _vm(vm), _ani(new Animation) { _dummy = false; - _ani->_left = 150; - _ani->_top = 100; - _ani->_z = 10; - _ani->_frame = 0; + _ani->setX(150); + _ani->setY(100); + _ani->setZ(10); + _ani->setF(0); _ani->_flags = kFlagsActive | kFlagsNoName; _ani->_type = kZoneYou; strncpy(_ani->_name, "yourself", ZONENAME_LENGTH); @@ -540,18 +540,18 @@ Character::~Character() { void Character::getFoot(Common::Point &foot) { Common::Rect rect; - _ani->gfxobj->getRect(_ani->_frame, rect); + _ani->gfxobj->getRect(_ani->getF(), rect); - foot.x = _ani->_left + (rect.left + rect.width() / 2); - foot.y = _ani->_top + (rect.top + rect.height()); + foot.x = _ani->getX() + (rect.left + rect.width() / 2); + foot.y = _ani->getY() + (rect.top + rect.height()); } void Character::setFoot(const Common::Point &foot) { Common::Rect rect; - _ani->gfxobj->getRect(_ani->_frame, rect); + _ani->gfxobj->getRect(_ani->getF(), rect); - _ani->_left = foot.x - (rect.left + rect.width() / 2); - _ani->_top = foot.y - (rect.top + rect.height()); + _ani->setX(foot.x - (rect.left + rect.width() / 2)); + _ani->setY(foot.y - (rect.top + rect.height())); } #if 0 @@ -675,7 +675,7 @@ void Character::updateDirection(const Common::Point& pos, const Common::Point& t _step++; if (dist.x == 0 && dist.y == 0) { - _ani->_frame = frames->stillFrame[_direction]; + _ani->setF(frames->stillFrame[_direction]); return; } @@ -685,7 +685,7 @@ void Character::updateDirection(const Common::Point& pos, const Common::Point& t dist.y = -dist.y; _direction = (dist.x > dist.y) ? ((to.x > pos.x) ? WALK_LEFT : WALK_RIGHT) : ((to.y > pos.y) ? WALK_DOWN : WALK_UP); - _ani->_frame = frames->firstWalkFrame[_direction] + (_step / frames->frameRepeat[_direction]) % frames->numWalkFrames[_direction]; + _ani->setF(frames->firstWalkFrame[_direction] + (_step / frames->frameRepeat[_direction]) % frames->numWalkFrames[_direction]); } |