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) { void _c_ridux(void *parm) {
_vm->changeCharacter("minidino"); _vm->changeCharacter(_minidinoName);
return; return;
} }

View file

@ -461,9 +461,9 @@ void runDialogue(SpeakData *data) {
g_system->delayMillis(20); g_system->delayMillis(20);
} }
if ((!scumm_stricmp(_vm->_characterName, "dough") && !scumm_strnicmp(password, "1732461", 7)) || if ((!scumm_stricmp(_vm->_characterName, _doughName) && !scumm_strnicmp(password, "1732461", 7)) ||
(!scumm_stricmp(_vm->_characterName, "donna") && !scumm_strnicmp(password, "1622", 4)) || (!scumm_stricmp(_vm->_characterName, _donnaName) && !scumm_strnicmp(password, "1622", 4)) ||
(!scumm_stricmp(_vm->_characterName, "dino") && !scumm_strnicmp(password, "179", 3))) { (!scumm_stricmp(_vm->_characterName, _dinoName) && !scumm_strnicmp(password, "179", 3))) {
askPassword = false; askPassword = false;
@ -509,7 +509,7 @@ void runDialogue(SpeakData *data) {
// that's why this hack (with hardcoded Dino) works // that's why this hack (with hardcoded Dino) works
if (!scumm_stricmp(_location, "museum")) { if (!scumm_stricmp(_location, "museum")) {
_vm->_disk->selectArchive("disk1"); _vm->_disk->selectArchive("disk1");
_vm->_disk->loadFrames("dino", &_tempFrames); _vm->_disk->loadFrames(_dinoName, &_tempFrames);
memcpy(&_yourself._cnv, &_tempFrames, sizeof(Cnv)); memcpy(&_yourself._cnv, &_tempFrames, sizeof(Cnv));

View file

@ -180,10 +180,10 @@ void Disk::loadTalk(const char *name, Cnv *cnv) {
} else { } else {
// character talk // character talk
if (scumm_stricmp(name, "dough") && if (scumm_stricmp(name, _doughName) &&
scumm_stricmp(name, "dino") && scumm_stricmp(name, _dinoName) &&
scumm_stricmp(name, "donna") && scumm_stricmp(name, _donnaName) &&
scumm_stricmp(name, "drki")) return; scumm_stricmp(name, _drkiName)) return;
char v20[PATH_LEN]; char v20[PATH_LEN];
char *v24 = const_cast<char*>(name); char *v24 = const_cast<char*>(name);
@ -258,10 +258,10 @@ void Disk::loadHead(const char* name, StaticCnv* cnv) {
char path[PATH_LEN]; char path[PATH_LEN];
if (scumm_stricmp(name, "dough") && if (scumm_stricmp(name, _doughName) &&
scumm_stricmp(name, "dino") && scumm_stricmp(name, _dinoName) &&
scumm_stricmp(name, "donna") && scumm_stricmp(name, _donnaName) &&
scumm_stricmp(name, "drki")) return; scumm_stricmp(name, _drkiName)) return;
if (!scumm_strnicmp(name, "mini", 4)) { if (!scumm_strnicmp(name, "mini", 4)) {
name += 4; name += 4;

View file

@ -285,15 +285,8 @@ void Parallaction::changeLocation(char *location) {
// printf("changeLocation('%s')", location); // printf("changeLocation('%s')", location);
if (_musicData1 != 0) { if (_musicData1 != 0) {
if (!scumm_stricmp(_characterName, "dino")) selectCharacterMusic(_vm->_characterName);
_vm->_midiPlayer->play("dino");
else if (!scumm_stricmp(_characterName, "donna"))
_vm->_midiPlayer->play("donna");
else
_vm->_midiPlayer->play("nuts");
_musicData1 = 0; _musicData1 = 0;
debugC(2, kDebugLocation, "changeLocation: started character specific music"); 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) { if (_dino_points > _donna_points && _dino_points > _dough_points) {
strcat(_location, ".dino"); sprintf(_location, "test.%s", _dinoName);
} else { } else {
if (_donna_points > _dino_points && _donna_points > _dough_points) { if (_donna_points > _dino_points && _donna_points > _dough_points) {
strcat(_location, ".donna"); sprintf(_location, "test.%s", _donnaName);
} else { } else {
strcat(_location, ".dough"); sprintf(_location, "test.%s", _doughName);
} }
} }

View file

@ -839,16 +839,29 @@ void freeCharacterFrames() {
return; 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) { void Parallaction::changeCharacter(const char *name) {
// printf("changeCharacter(%s)\n", name); // printf("changeCharacter(%s)\n", name);
uint16 _si = 0; bool miniCharacter = false;
if (!scumm_strnicmp(name, "mini", 4)) { if (!scumm_strnicmp(name, "mini", 4)) {
name+=4; name+=4;
_si = 1; miniCharacter = true;
} }
char v32[20]; char v32[20];
@ -884,21 +897,14 @@ void Parallaction::changeCharacter(const char *name) {
refreshInventory(name); refreshInventory(name);
if (scumm_stricmp(name, "night") && scumm_stricmp(name, "intsushi")) { if (scumm_stricmp(name, "night") && scumm_stricmp(name, "intsushi"))
if (!scumm_stricmp(name, "dino") || !scumm_stricmp(name, "minidino")) { selectCharacterMusic(name);
_midiPlayer->play("dino");
} else if (!scumm_stricmp(name, "donna") || !scumm_stricmp(name, "minidonna")) {
_midiPlayer->play("donna");
} else {
_midiPlayer->play("nuts");
}
}
} }
} }
if (_si == 1) { if (miniCharacter) {
memcpy(&_yourself._cnv, &_miniCharacterFrames, sizeof(Cnv)); memcpy(&_yourself._cnv, &_miniCharacterFrames, sizeof(Cnv));
} else { } else {
memcpy(&_yourself._cnv, &_tempFrames, sizeof(Cnv)); memcpy(&_yourself._cnv, &_tempFrames, sizeof(Cnv));

View file

@ -140,6 +140,15 @@ extern const char *commands_names[];
extern const char *_instructionNames[]; extern const char *_instructionNames[];
extern const char *_callableNames[]; 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 waitUntilLeftClick();
void addNode(Node *list, Node *n); void addNode(Node *list, Node *n);
@ -332,6 +341,8 @@ protected: // members
void loadProgram(Animation *a, char *filename); void loadProgram(Animation *a, char *filename);
void changeLocation(char *location); void changeLocation(char *location);
void selectCharacterMusic(const char *name);
}; };
// FIXME: remove global // FIXME: remove global

View file

@ -119,7 +119,7 @@ void Parallaction::doLoadGame(uint16 slot) {
} }
if (!scumm_stricmp(_vm->_characterName, "minidonnatras")) { if (!scumm_stricmp(_vm->_characterName, "minidonnatras")) {
_engineFlags |= kEngineMiniDonna; _engineFlags |= kEngineMiniDonna;
strcpy(_vm->_characterName, "minidonna"); strcpy(_vm->_characterName, _minidonnaName);
} }
if (_vm->_characterName[0] == 'm') { if (_vm->_characterName[0] == 'm') {

View file

@ -227,6 +227,15 @@ Credit _credits[] = {
{"CLICK MOUSE BUTTON TO START", 0} {"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 } // namespace Parallaction