aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-10 22:13:47 +0000
committerNicola Mettifogo2007-03-10 22:13:47 +0000
commit72ef7093fa98618f54d5a1961f5f313d6a23e5d0 (patch)
tree6fb471e4e0b25cdf6b29cbcc6082d8499ab1d8f7 /engines/parallaction
parent096579ecbcd20e14bb01b2180f295229ba3d3387 (diff)
downloadscummvm-rg350-72ef7093fa98618f54d5a1961f5f313d6a23e5d0.tar.gz
scummvm-rg350-72ef7093fa98618f54d5a1961f5f313d6a23e5d0.tar.bz2
scummvm-rg350-72ef7093fa98618f54d5a1961f5f313d6a23e5d0.zip
some refactoring
svn-id: r26072
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/callables.cpp2
-rw-r--r--engines/parallaction/dialogue.cpp8
-rw-r--r--engines/parallaction/disk.cpp16
-rw-r--r--engines/parallaction/location.cpp9
-rw-r--r--engines/parallaction/menu.cpp7
-rw-r--r--engines/parallaction/parallaction.cpp30
-rw-r--r--engines/parallaction/parallaction.h11
-rw-r--r--engines/parallaction/saveload.cpp2
-rw-r--r--engines/parallaction/staticres.cpp9
9 files changed, 56 insertions, 38 deletions
diff --git a/engines/parallaction/callables.cpp b/engines/parallaction/callables.cpp
index 1ae2cf7357..33bb09c382 100644
--- a/engines/parallaction/callables.cpp
+++ b/engines/parallaction/callables.cpp
@@ -346,7 +346,7 @@ void _c_finito(void *parm) {
}
void _c_ridux(void *parm) {
- _vm->changeCharacter("minidino");
+ _vm->changeCharacter(_minidinoName);
return;
}
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index e4f10a6314..0682b471d9 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -461,9 +461,9 @@ void runDialogue(SpeakData *data) {
g_system->delayMillis(20);
}
- if ((!scumm_stricmp(_vm->_characterName, "dough") && !scumm_strnicmp(password, "1732461", 7)) ||
- (!scumm_stricmp(_vm->_characterName, "donna") && !scumm_strnicmp(password, "1622", 4)) ||
- (!scumm_stricmp(_vm->_characterName, "dino") && !scumm_strnicmp(password, "179", 3))) {
+ if ((!scumm_stricmp(_vm->_characterName, _doughName) && !scumm_strnicmp(password, "1732461", 7)) ||
+ (!scumm_stricmp(_vm->_characterName, _donnaName) && !scumm_strnicmp(password, "1622", 4)) ||
+ (!scumm_stricmp(_vm->_characterName, _dinoName) && !scumm_strnicmp(password, "179", 3))) {
askPassword = false;
@@ -509,7 +509,7 @@ void runDialogue(SpeakData *data) {
// that's why this hack (with hardcoded Dino) works
if (!scumm_stricmp(_location, "museum")) {
_vm->_disk->selectArchive("disk1");
- _vm->_disk->loadFrames("dino", &_tempFrames);
+ _vm->_disk->loadFrames(_dinoName, &_tempFrames);
memcpy(&_yourself._cnv, &_tempFrames, sizeof(Cnv));
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp
index 5b37bb9345..7fa2f4c666 100644
--- a/engines/parallaction/disk.cpp
+++ b/engines/parallaction/disk.cpp
@@ -180,10 +180,10 @@ void Disk::loadTalk(const char *name, Cnv *cnv) {
} else {
// character talk
- if (scumm_stricmp(name, "dough") &&
- scumm_stricmp(name, "dino") &&
- scumm_stricmp(name, "donna") &&
- scumm_stricmp(name, "drki")) return;
+ if (scumm_stricmp(name, _doughName) &&
+ scumm_stricmp(name, _dinoName) &&
+ scumm_stricmp(name, _donnaName) &&
+ scumm_stricmp(name, _drkiName)) return;
char v20[PATH_LEN];
char *v24 = const_cast<char*>(name);
@@ -258,10 +258,10 @@ void Disk::loadHead(const char* name, StaticCnv* cnv) {
char path[PATH_LEN];
- if (scumm_stricmp(name, "dough") &&
- scumm_stricmp(name, "dino") &&
- scumm_stricmp(name, "donna") &&
- scumm_stricmp(name, "drki")) return;
+ if (scumm_stricmp(name, _doughName) &&
+ scumm_stricmp(name, _dinoName) &&
+ scumm_stricmp(name, _donnaName) &&
+ scumm_stricmp(name, _drkiName)) return;
if (!scumm_strnicmp(name, "mini", 4)) {
name += 4;
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp
index 3f1ebba1e8..9023e13afc 100644
--- a/engines/parallaction/location.cpp
+++ b/engines/parallaction/location.cpp
@@ -285,15 +285,8 @@ void Parallaction::changeLocation(char *location) {
// printf("changeLocation('%s')", location);
if (_musicData1 != 0) {
- if (!scumm_stricmp(_characterName, "dino"))
- _vm->_midiPlayer->play("dino");
- else if (!scumm_stricmp(_characterName, "donna"))
- _vm->_midiPlayer->play("donna");
- else
- _vm->_midiPlayer->play("nuts");
-
+ selectCharacterMusic(_vm->_characterName);
_musicData1 = 0;
-
debugC(2, kDebugLocation, "changeLocation: started character specific music");
}
diff --git a/engines/parallaction/menu.cpp b/engines/parallaction/menu.cpp
index f3ed307172..55b5caa659 100644
--- a/engines/parallaction/menu.cpp
+++ b/engines/parallaction/menu.cpp
@@ -390,14 +390,13 @@ void Menu::selectCharacter() {
}
- strcpy(_location, "test");
if (_dino_points > _donna_points && _dino_points > _dough_points) {
- strcat(_location, ".dino");
+ sprintf(_location, "test.%s", _dinoName);
} else {
if (_donna_points > _dino_points && _donna_points > _dough_points) {
- strcat(_location, ".donna");
+ sprintf(_location, "test.%s", _donnaName);
} else {
- strcat(_location, ".dough");
+ sprintf(_location, "test.%s", _doughName);
}
}
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 1a958eb3e9..2c99ee79a6 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -839,16 +839,29 @@ void freeCharacterFrames() {
return;
}
+void Parallaction::selectCharacterMusic(const char *name) {
+ if (!scumm_strnicmp(name, "mini", 4))
+ name+=4;
+
+ if (!scumm_stricmp(name, _dinoName)) {
+ _midiPlayer->play("dino");
+ } else if (!scumm_stricmp(name, _donnaName)) {
+ _midiPlayer->play("donna");
+ } else {
+ _midiPlayer->play("nuts");
+ }
+ return;
+}
void Parallaction::changeCharacter(const char *name) {
// printf("changeCharacter(%s)\n", name);
- uint16 _si = 0;
+ bool miniCharacter = false;
if (!scumm_strnicmp(name, "mini", 4)) {
name+=4;
- _si = 1;
+ miniCharacter = true;
}
char v32[20];
@@ -884,21 +897,14 @@ void Parallaction::changeCharacter(const char *name) {
refreshInventory(name);
- if (scumm_stricmp(name, "night") && scumm_stricmp(name, "intsushi")) {
- if (!scumm_stricmp(name, "dino") || !scumm_stricmp(name, "minidino")) {
- _midiPlayer->play("dino");
- } else if (!scumm_stricmp(name, "donna") || !scumm_stricmp(name, "minidonna")) {
- _midiPlayer->play("donna");
- } else {
- _midiPlayer->play("nuts");
- }
- }
+ if (scumm_stricmp(name, "night") && scumm_stricmp(name, "intsushi"))
+ selectCharacterMusic(name);
}
}
- if (_si == 1) {
+ if (miniCharacter) {
memcpy(&_yourself._cnv, &_miniCharacterFrames, sizeof(Cnv));
} else {
memcpy(&_yourself._cnv, &_tempFrames, sizeof(Cnv));
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 6309fd442b..0b45e1915a 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -140,6 +140,15 @@ extern const char *commands_names[];
extern const char *_instructionNames[];
extern const char *_callableNames[];
+extern const char *_dinoName;
+extern const char *_donnaName;
+extern const char *_doughName;
+extern const char *_drkiName;
+extern const char *_minidinoName;
+extern const char *_minidonnaName;
+extern const char *_minidoughName;
+extern const char *_minidrkiName;
+
void waitUntilLeftClick();
void addNode(Node *list, Node *n);
@@ -332,6 +341,8 @@ protected: // members
void loadProgram(Animation *a, char *filename);
void changeLocation(char *location);
+ void selectCharacterMusic(const char *name);
+
};
// FIXME: remove global
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 19b41dae64..4e1cf8f52f 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -119,7 +119,7 @@ void Parallaction::doLoadGame(uint16 slot) {
}
if (!scumm_stricmp(_vm->_characterName, "minidonnatras")) {
_engineFlags |= kEngineMiniDonna;
- strcpy(_vm->_characterName, "minidonna");
+ strcpy(_vm->_characterName, _minidonnaName);
}
if (_vm->_characterName[0] == 'm') {
diff --git a/engines/parallaction/staticres.cpp b/engines/parallaction/staticres.cpp
index c1b0faf306..d3ff33a711 100644
--- a/engines/parallaction/staticres.cpp
+++ b/engines/parallaction/staticres.cpp
@@ -227,6 +227,15 @@ Credit _credits[] = {
{"CLICK MOUSE BUTTON TO START", 0}
};
+const char *_dinoName = "dino";
+const char *_donnaName = "donna";
+const char *_doughName = "dough";
+const char *_drkiName = "drki";
+
+const char *_minidinoName = "minidino";
+const char *_minidonnaName = "minidonna";
+const char *_minidoughName = "minidough";
+const char *_minidrkiName = "minidrki";
} // namespace Parallaction