diff options
author | Nicola Mettifogo | 2007-08-25 20:34:10 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-08-25 20:34:10 +0000 |
commit | 39e4a9b180d37f2fef108391d5f04a3c7e3b2ea0 (patch) | |
tree | bd7bd96adb2d8df6677d1e25b9e4b98e2851bbad /engines/parallaction/parallaction.cpp | |
parent | 9f8b0884fa2814b04567a86596cdae7953d8eb1e (diff) | |
download | scummvm-rg350-39e4a9b180d37f2fef108391d5f04a3c7e3b2ea0.tar.gz scummvm-rg350-39e4a9b180d37f2fef108391d5f04a3c7e3b2ea0.tar.bz2 scummvm-rg350-39e4a9b180d37f2fef108391d5f04a3c7e3b2ea0.zip |
Added an abstract base class for representing multiple-frames for animations. Changed user code to rely on the new interface. Cnv has been turned into an implementation of the new interface, and it is now known as a concrete class only to Disk and Font code for Nippon Safes.
svn-id: r28734
Diffstat (limited to 'engines/parallaction/parallaction.cpp')
-rw-r--r-- | engines/parallaction/parallaction.cpp | 182 |
1 files changed, 4 insertions, 178 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 4a93ee968b..7d150e8813 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -89,9 +89,6 @@ uint16 _introSarcData2 = 1; // private stuff static Job *_jDrawInventory = NULL; -Job *_jDrawLabel = NULL; -Job *_jEraseLabel = NULL; -Zone *_hoverZone = NULL; static Job *_jRunScripts = NULL; @@ -177,6 +174,10 @@ int Parallaction::init() { initInventory(); // needs to be pushed into subclass + _jDrawLabel = NULL; + _jEraseLabel = NULL; + _hoverZone = NULL; + _animations.push_front(&_char._ani); _gfx = new Gfx(this); @@ -664,55 +665,7 @@ void Parallaction::freeCharacter() { return; } -void Parallaction::changeCharacter(const char *name) { - debugC(1, kDebugLocation, "changeCharacter(%s)", name); - - char baseName[20]; - if (IS_MINI_CHARACTER(name)) { - strcpy(baseName, name+4); - } else { - strcpy(baseName, name); - } - - char fullName[20]; - strcpy(fullName, name); - if (_engineFlags & kEngineTransformedDonna) - strcat(fullName, "tras"); - - if (scumm_stricmp(fullName, _characterName1)) { - - // freeCharacter takes responsibility for checking - // character for sanity before memory is freed - freeCharacter(); - - Common::String oldArchive = _disk->selectArchive((getFeatures() & GF_LANG_MULT) ? "disk1" : "disk0"); - _char._ani._cnv = _disk->loadFrames(fullName); - - if (!IS_DUMMY_CHARACTER(name)) { - if (getPlatform() == Common::kPlatformAmiga && (getFeatures() & GF_LANG_MULT)) - _disk->selectArchive("disk0"); - _char._head = _disk->loadHead(baseName); - _char._talk = _disk->loadTalk(baseName); - _char._objs = _disk->loadObjects(baseName); - _objectsNames = _disk->loadTable(baseName); - - _soundMan->playCharacterMusic(name); - - if (!(getFeatures() & GF_DEMO)) - parseLocation("common"); - } - - if (!oldArchive.empty()) - _disk->selectArchive(oldArchive); - } - - strcpy(_characterName1, fullName); - - debugC(1, kDebugLocation, "changeCharacter() done"); - - return; -} /* helper function to provide *descending* ordering of the job list @@ -1036,9 +989,6 @@ void Parallaction::switchBackground(const char* background, const char* mask) { return; } -extern Zone *_hoverZone; -extern Job *_jDrawLabel; -extern Job *_jEraseLabel; void Parallaction::showSlide(const char *name) { @@ -1061,131 +1011,7 @@ void Parallaction::showSlide(const char *name) { return; } -/* - changeLocation handles transitions between locations, and is able to display slides - between one and the other. The input parameter 'location' exists in some flavours: - - 1 - [S].slide.[L]{.[C]} - 2 - [L]{.[C]} - - where: - - [S] is the slide to be shown - [L] is the location to switch to (immediately in case 2, or right after slide [S] in case 1) - [C] is the character to be selected, and is optional - - The routine tells one form from the other by searching for the '.slide.' - - NOTE: there exists one script in which [L] is not used in the case 1, but its use - is commented out, and would definitely crash the current implementation. -*/ -void Parallaction::changeLocation(char *location) { - debugC(1, kDebugLocation, "changeLocation(%s)", location); - - _soundMan->playLocationMusic(location); - - // WORKAROUND: this if-statement has been added to avoid crashes caused by - // execution of label jobs after a location switch. The other workaround in - // Parallaction::runGame should have been rendered useless by this one. - if (_jDrawLabel != NULL) { - removeJob(_jDrawLabel); - removeJob(_jEraseLabel); - _jDrawLabel = NULL; - _jEraseLabel = NULL; - } - - - _hoverZone = NULL; - if (_engineFlags & kEngineBlockInput) { - changeCursor( kCursorArrow ); - } - - _animations.remove(&_char._ani); - - freeLocation(); - char buf[100]; - strcpy(buf, location); - - Common::StringList list; - char *tok = strtok(location, "."); - while (tok) { - list.push_back(tok); - tok = strtok(NULL, "."); - } - - if (list.size() < 1 || list.size() > 4) - error("changeLocation: ill-formed location string '%s'", location); - - if (list.size() > 1) { - if (list[1] == "slide") { - showSlide(list[0].c_str()); - _gfx->setFont(_menuFont); - _gfx->displayCenteredString(14, _slideText[0]); // displays text on screen - _gfx->updateScreen(); - waitUntilLeftClick(); - - list.remove_at(0); // removes slide name - list.remove_at(0); // removes 'slide' - } - - // list is now only [L].{[C]} (see above comment) - if (list.size() == 2) { - changeCharacter(list[1].c_str()); - strcpy(_characterName, list[1].c_str()); - } - } - - _animations.push_front(&_char._ani); - - strcpy(_saveData1, list[0].c_str()); - parseLocation(list[0].c_str()); - - _char._ani._oldPos.x = -1000; - _char._ani._oldPos.y = -1000; - - _char._ani.field_50 = 0; - if (_location._startPosition.x != -1000) { - _char._ani._left = _location._startPosition.x; - _char._ani._top = _location._startPosition.y; - _char._ani._frame = _location._startFrame; - _location._startPosition.y = -1000; - _location._startPosition.x = -1000; - } - - - _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); - _gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2); - _gfx->setBlackPalette(); - _gfx->updateScreen(); - - if (_location._commands.size() > 0) { - runCommands(_location._commands); - runJobs(); - _gfx->swapBuffers(); - runJobs(); - _gfx->swapBuffers(); - } - - if (_location._comment) { - doLocationEnterTransition(); - } - - runJobs(); - _gfx->swapBuffers(); - _gfx->setPalette(_gfx->_palette); - if (_location._aCommands.size() > 0) { - runCommands(_location._aCommands); - } - - if (_hasLocationSound) - _soundMan->playSfx(_locationSound, 0, true); - - debugC(1, kDebugLocation, "changeLocation() done"); - - return; - -} // displays transition before a new location // |