From bc0a839175899462bc4a79a6e4f3853ac5ee9aaf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Jun 2015 15:34:11 -0400 Subject: SHERLOCK: RT: Move more methods from Sprite to TattooPerson --- engines/sherlock/objects.cpp | 130 ------------------------------------------- 1 file changed, 130 deletions(-) (limited to 'engines/sherlock/objects.cpp') diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index e9c6b00c9a..1c74f62d5d 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -38,38 +38,6 @@ namespace Sherlock { #define CLEAR_DIST_X 5 #define CLEAR_DIST_Y 0 -struct AdjustWalk { - char _vgsName[9]; - int _xAdjust; - int _flipXAdjust; - int _yAdjust; -} ; - -#define NUM_ADJUSTED_WALKS 21 -static const AdjustWalk ADJUST_WALKS[NUM_ADJUSTED_WALKS] = { - { "TUPRIGHT", -7, -19, 6 }, - { "TRIGHT", 8, -14, 0 }, - { "TDOWNRG", 14, -12, 0 }, - { "TWUPRIGH", 12, 4, 2 }, - { "TWRIGHT", 31, -14, 0 }, - { "TWDOWNRG", 6, -24, 0 }, - { "HTUPRIGH", 2, -20, 0 }, - { "HTRIGHT", 28, -20, 0 }, - { "HTDOWNRG", 8, -2, 0 }, - { "GTUPRIGH", 4, -12, 0 }, - { "GTRIGHT", 12, -16, 0 }, - { "GTDOWNRG", 10, -18, 0 }, - { "JTUPRIGH", 8, -10, 0 }, - { "JTRIGHT", 22, -6, 0 }, - { "JTDOWNRG", 4, -20, 0 }, - { "CTUPRIGH", 10, 0, 0 }, - { "CTRIGHT", 26, -22, 0 }, - { "CTDOWNRI", 16, 4, 0 }, - { "ITUPRIGH", 0, 0, 0 }, - { "ITRIGHT", 20, 0, 0 }, - { "ITDOWNRG", 8, 0, 0 } -}; - SherlockEngine *BaseObject::_vm; bool BaseObject::_countCAnimFrames; @@ -844,104 +812,6 @@ const Common::Rect Sprite::getOldBounds() const { return Common::Rect(_oldPosition.x, _oldPosition.y, _oldPosition.x + _oldSize.x, _oldPosition.y + _oldSize.y); } -void Sprite::setObjTalkSequence(int seq) { - assert(seq != -1 && _type == CHARACTER); - - if (_seqTo) { - // reset to previous value - _walkSequences[_sequenceNumber]._sequences[_frameNumber] = _seqTo; - _seqTo = 0; - } - - _sequenceNumber = _gotoSeq; - _frameNumber = 0; - checkWalkGraphics(); -} - -void Sprite::checkWalkGraphics() { - People &people = *_vm->_people; - - if (_images == nullptr) { - freeAltGraphics(); - return; - } - - Common::String filename = Common::String::format("%s.vgs", _walkSequences[_sequenceNumber]._vgsName.c_str()); - - // Set the adjust depending on if we have to fine tune the x position of this particular graphic - _adjust.x = _adjust.y = 0; - - for (int idx = 0; idx < NUM_ADJUSTED_WALKS; ++idx) { - if (!scumm_strnicmp(_walkSequences[_sequenceNumber]._vgsName.c_str(), ADJUST_WALKS[idx]._vgsName, - strlen(ADJUST_WALKS[idx]._vgsName))) { - if (_walkSequences[_sequenceNumber]._horizFlip) - _adjust.x = ADJUST_WALKS[idx]._flipXAdjust; - else - _adjust.x = ADJUST_WALKS[idx]._xAdjust; - - _adjust.y = ADJUST_WALKS[idx]._yAdjust; - break; - } - } - - // See if we're already using Alternate Graphics - if (_altSeq) { - // See if the VGS file called for is different than the alternate graphics already loaded - if (!_walkSequences[_sequenceNumber]._vgsName.compareToIgnoreCase(_walkSequences[_altSeq - 1]._vgsName)) { - // Different AltGraphics, Free the old ones - freeAltGraphics(); - } - } - - // If there is no Alternate Sequence set, see if we need to load a new one - if (!_altSeq) { - int npcNum = -1; - // Find which NPC this is so we can check the name of the graphics loaded - for (int idx = 0; idx < MAX_CHARACTERS; ++idx) { - if (this == &people[idx]) { - npcNum = idx; - break; - } - } - - if (npcNum != -1) { - // See if the VGS file called for is different than the main graphics which are already loaded - if (!filename.compareToIgnoreCase(people[npcNum]._walkVGSName)) { - // See if this is one of the more used Walk Graphics stored in WALK.LIB - for (int idx = 0; idx < NUM_IN_WALK_LIB; ++idx) { - if (!scumm_stricmp(filename.c_str(), WALK_LIB_NAMES[idx])) { - people._useWalkLib = true; - break; - } - } - - _altImages = new ImageFile(filename); - people._useWalkLib = false; - - _altSeq = _sequenceNumber + 1; - } - } - } - - // If this is a different seqeunce from the current sequence, reset the appropriate variables - if (_sequences != &_walkSequences[_sequenceNumber]._sequences[0]) { - _seqTo = _seqCounter = _seqCounter2 = _seqStack = _startSeq = 0; - _sequences = &_walkSequences[_sequenceNumber]._sequences[0]; - _seqSize = _walkSequences[_sequenceNumber]._sequences.size(); - } - - setImageFrame(); -} - -void Sprite::freeAltGraphics() { - if (_altImages != nullptr) { - delete _altImages; - _altImages = nullptr; - } - - _altSeq = 0; -} - /*----------------------------------------------------------------*/ void WalkSequence::load(Common::SeekableReadStream &s) { -- cgit v1.2.3