diff options
author | Nicola Mettifogo | 2007-09-22 18:45:43 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-09-22 18:45:43 +0000 |
commit | d7ae40b65d9e6b8f30c071fb3327f39484eae898 (patch) | |
tree | a7239fb51168c22e83292e0ae0407298d77aff5d /engines/parallaction/parallaction_ns.cpp | |
parent | 7524244581bcec8d95da2fc65455704a31c3a517 (diff) | |
download | scummvm-rg350-d7ae40b65d9e6b8f30c071fb3327f39484eae898.tar.gz scummvm-rg350-d7ae40b65d9e6b8f30c071fb3327f39484eae898.tar.bz2 scummvm-rg350-d7ae40b65d9e6b8f30c071fb3327f39484eae898.zip |
Refactored a lot of Character-related code and put it into the Character class.
svn-id: r29025
Diffstat (limited to 'engines/parallaction/parallaction_ns.cpp')
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 40d5f30a30..9f1b172bb5 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -187,7 +187,7 @@ int Parallaction_ns::go() { _globalTable = _disk->loadTable("global"); _engineFlags &= ~kEngineChangeLocation; - changeCharacter(_characterName); + changeCharacter(_char.getName()); strcpy(_saveData1, _location._name); parseLocation(_location._name); @@ -272,7 +272,6 @@ void Parallaction_ns::changeLocation(char *location) { // list is now only [L].{[C]} (see above comment) if (list.size() == 2) { changeCharacter(list[1].c_str()); - strcpy(_characterName, list[1].c_str()); } } @@ -331,49 +330,41 @@ void Parallaction_ns::changeLocation(char *location) { void Parallaction_ns::changeCharacter(const char *name) { debugC(1, kDebugExec, "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)) { + _char.setName(name); - // freeCharacter takes responsibility for checking - // character for sanity before memory is freed - freeCharacter(); + if (!scumm_stricmp(_char.getFullName(), _characterName1)) { + debugC(3, kDebugExec, "changeCharacter: nothing done"); + return; + } - Common::String oldArchive = _disk->selectArchive((getFeatures() & GF_LANG_MULT) ? "disk1" : "disk0"); - _char._ani._cnv = _disk->loadFrames(fullName); + // freeCharacter takes responsibility for checking + // character for sanity before memory is freed + freeCharacter(); - if (!IS_DUMMY_CHARACTER(name)) { - if (getPlatform() == Common::kPlatformAmiga && (getFeatures() & GF_LANG_MULT)) - _disk->selectArchive("disk0"); + Common::String oldArchive = _disk->selectArchive((getFeatures() & GF_LANG_MULT) ? "disk1" : "disk0"); + _char._ani._cnv = _disk->loadFrames(_char.getFullName()); - _char._head = _disk->loadHead(baseName); - _char._talk = _disk->loadTalk(baseName); - _char._objs = _disk->loadObjects(baseName); - _objectsNames = _disk->loadTable(baseName); + if (_char.getBaseName()[0] != '\0') { + if (getPlatform() == Common::kPlatformAmiga && (getFeatures() & GF_LANG_MULT)) + _disk->selectArchive("disk0"); - _soundMan->playCharacterMusic(name); + _char._head = _disk->loadHead(_char.getBaseName()); + _char._talk = _disk->loadTalk(_char.getBaseName()); + _char._objs = _disk->loadObjects(_char.getBaseName()); + _objectsNames = _disk->loadTable(_char.getBaseName()); - if (!(getFeatures() & GF_DEMO)) - parseLocation("common"); - } + _soundMan->playCharacterMusic(_char.getBaseName()); - if (!oldArchive.empty()) - _disk->selectArchive(oldArchive); + if (!(getFeatures() & GF_DEMO)) + parseLocation("common"); } - strcpy(_characterName1, fullName); + if (!oldArchive.empty()) + _disk->selectArchive(oldArchive); + + strcpy(_characterName1, _char.getFullName()); - debugC(1, kDebugExec, "changeCharacter() done"); + debugC(3, kDebugExec, "changeCharacter: switch completed"); return; } |