diff options
author | Nicola Mettifogo | 2010-05-19 17:16:15 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2010-05-19 17:16:15 +0000 |
commit | f84b23244322f440e9503eb3519688a6a255be40 (patch) | |
tree | fed285abcc89c06f0a32ca4be337548dbd13a768 /engines/parallaction | |
parent | 92c1f4625d7a8e7b119dc005539145f59ce6c49b (diff) | |
download | scummvm-rg350-f84b23244322f440e9503eb3519688a6a255be40.tar.gz scummvm-rg350-f84b23244322f440e9503eb3519688a6a255be40.tar.bz2 scummvm-rg350-f84b23244322f440e9503eb3519688a6a255be40.zip |
Add a parser for HEAR zones in BRA, and handle the relative MUSIC command. Patch 3003382 by fuzzie, with enhancements.
svn-id: r49105
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/objects.h | 6 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 13 | ||||
-rw-r--r-- | engines/parallaction/parser.h | 1 | ||||
-rw-r--r-- | engines/parallaction/parser_br.cpp | 17 |
4 files changed, 31 insertions, 6 deletions
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h index f84c930241..50a789247f 100644 --- a/engines/parallaction/objects.h +++ b/engines/parallaction/objects.h @@ -186,7 +186,9 @@ struct Dialogue { ~Dialogue(); }; -#define MAX_WALKPOINT_LISTS 20 +#define MAX_WALKPOINT_LISTS 20 +#define FREE_HEAR_CHANNEL -1 +#define MUSIC_HEAR_CHANNEL -2 struct TypeData { // common @@ -232,7 +234,7 @@ struct TypeData { _doorStartFrame2_br = 0; _doorStartPos2_br.x = -1000; _doorStartPos2_br.y = -1000; - _hearChannel = -1; + _hearChannel = FREE_HEAR_CHANNEL; _hearFreq = -1; _mergeObj1 = 0; _mergeObj2 = 0; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index f31b7abcd2..cb208a17ff 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -591,10 +591,15 @@ void Parallaction::runZone(ZonePtr z) { break; case kZoneHear: - _soundMan->execute(SC_SETSFXCHANNEL, z->u._hearChannel); - _soundMan->execute(SC_SETSFXLOOPING, (int)((z->_flags & kFlagsLooping) == kFlagsLooping)); - _soundMan->execute(SC_SETSFXVOLUME, 60); - _soundMan->execute(SC_PLAYSFX, z->u._filename.c_str()); + if (z->u._hearChannel == MUSIC_HEAR_CHANNEL) { + _soundMan->execute(SC_SETMUSICFILE, z->u._filename.c_str()); + _soundMan->execute(SC_PLAYMUSIC); + } else { + _soundMan->execute(SC_SETSFXCHANNEL, z->u._hearChannel); + _soundMan->execute(SC_SETSFXLOOPING, (int)((z->_flags & kFlagsLooping) == kFlagsLooping)); + _soundMan->execute(SC_SETSFXVOLUME, 60); + _soundMan->execute(SC_PLAYSFX, z->u._filename.c_str()); + } break; case kZoneSpeak: diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index 3672fd3b09..3e46e99180 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -293,6 +293,7 @@ public: virtual void parsePathData(ZonePtr z); virtual void parseGetData(ZonePtr z); virtual void parseDoorData(ZonePtr z); + virtual void parseHearData(ZonePtr z); protected: void parseAnswerCounter(Answer *answer); virtual Answer *parseAnswer(); diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp index 563faa16e6..d3ce1235c1 100644 --- a/engines/parallaction/parser_br.cpp +++ b/engines/parallaction/parser_br.cpp @@ -808,6 +808,23 @@ void LocationParser_br::parseDoorData(ZonePtr z) { } } +void LocationParser_br::parseHearData(ZonePtr z) { + TypeData *data = &z->u; + if (!scumm_stricmp(_tokens[0], "sound")) { + assert(!data->_filename.size()); + data->_filename = _tokens[1]; + data->_hearChannel = atoi(_tokens[2]); + } else + if (!scumm_stricmp(_tokens[0], "freq")) { + data->_hearFreq = atoi(_tokens[1]); + } else + if (!scumm_stricmp(_tokens[0], "music")) { + assert(data->_hearChannel == FREE_HEAR_CHANNEL); + data->_filename = _tokens[1]; + data->_hearChannel = MUSIC_HEAR_CHANNEL; + } +} + typedef void (LocationParser_br::*ZoneTypeParser)(ZonePtr); static ZoneTypeParser parsers[] = { 0, // no type |