some refactoring

svn-id: r26072
This commit is contained in:
Nicola Mettifogo 2007-03-10 22:13:47 +00:00
parent 096579ecbc
commit 72ef7093fa
9 changed files with 56 additions and 38 deletions

View File

@ -346,7 +346,7 @@ void _c_finito(void *parm) {
}
void _c_ridux(void *parm) {
_vm->changeCharacter("minidino");
_vm->changeCharacter(_minidinoName);
return;
}

View File

@ -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));

View File

@ -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;

View File

@ -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");
}

View File

@ -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);
}
}

View File

@ -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));

View File

@ -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

View File

@ -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') {

View File

@ -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