aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-05-19 14:19:16 +0000
committerMartin Kiewitz2010-05-19 14:19:16 +0000
commit9b4f35287027d6c9dafca8f6157fe60c620ee9c4 (patch)
tree93f6a2e2d4c2915d7d4b4d850881f4f471d07283
parentbb10dabe904605505ab1dfb2cb46ed61e4d2d67e (diff)
downloadscummvm-rg350-9b4f35287027d6c9dafca8f6157fe60c620ee9c4.tar.gz
scummvm-rg350-9b4f35287027d6c9dafca8f6157fe60c620ee9c4.tar.bz2
scummvm-rg350-9b4f35287027d6c9dafca8f6157fe60c620ee9c4.zip
SCI: cleanup soundcode - number renamed to resourceId, prio renamed to priority
svn-id: r49098
-rw-r--r--engines/sci/engine/savegame.cpp8
-rw-r--r--engines/sci/sound/music.cpp14
-rw-r--r--engines/sci/sound/music.h4
-rw-r--r--engines/sci/sound/soundcmd.cpp34
4 files changed, 30 insertions, 30 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index e5e3d8a02f..fef2b9a19e 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -112,8 +112,8 @@ void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) {
uint32 handle = 0;
s.syncAsSint32LE(handle);
soundObj = DEFROBNICATE_HANDLE(handle);
- s.syncAsSint32LE(resnum);
- s.syncAsSint32LE(prio);
+ s.syncAsSint32LE(resourceId);
+ s.syncAsSint32LE(priority);
s.syncAsSint32LE(status);
s.skip(4); // restoreBehavior
uint32 restoreTime = 0;
@@ -133,11 +133,11 @@ void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) {
} else {
// A bit more optimized saving
sync_reg_t(s, soundObj);
- s.syncAsSint16LE(resnum);
+ s.syncAsSint16LE(resourceId);
s.syncAsSint16LE(dataInc);
s.syncAsSint16LE(ticker);
s.syncAsSint16LE(signal, VER(17));
- s.syncAsByte(prio);
+ s.syncAsByte(priority);
s.syncAsSint16LE(loop, VER(17));
s.syncAsByte(volume);
s.syncAsByte(hold, VER(17));
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index f8b02f5a58..446e1e0131 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -171,7 +171,7 @@ void SciMusic::setReverb(byte reverb) {
}
static int f_compare(const void *arg1, const void *arg2) {
- return ((const MusicEntry *)arg2)->prio - ((const MusicEntry *)arg1)->prio;
+ return ((const MusicEntry *)arg2)->priority - ((const MusicEntry *)arg1)->priority;
}
void SciMusic::sortPlayList() {
@@ -302,7 +302,7 @@ void SciMusic::soundSetVolume(MusicEntry *pSnd, byte volume) {
void SciMusic::soundSetPriority(MusicEntry *pSnd, byte prio) {
Common::StackLock lock(_mutex);
- pSnd->prio = prio;
+ pSnd->priority = prio;
sortPlayList();
}
@@ -392,7 +392,7 @@ void SciMusic::printPlayList(Console *con) {
for (uint32 i = 0; i < _playList.size(); i++) {
MusicEntry *song = _playList[i];
con->DebugPrintf("%d: %04x:%04x, resource id: %d, status: %s, %s type\n", i,
- PRINT_REG(song->soundObj), song->resnum,
+ PRINT_REG(song->soundObj), song->resourceId,
musicStatus[song->status], song->pMidiParser ? "MIDI" : "digital audio");
}
}
@@ -406,9 +406,9 @@ void SciMusic::printSongInfo(reg_t obj, Console *con) {
for (MusicList::iterator i = _playList.begin(); i != end; ++i) {
MusicEntry *song = *i;
if (song->soundObj == obj) {
- con->DebugPrintf("Resource id: %d, status: %s\n", song->resnum, musicStatus[song->status]);
+ con->DebugPrintf("Resource id: %d, status: %s\n", song->resourceId, musicStatus[song->status]);
con->DebugPrintf("dataInc: %d, hold: %d, loop: %d\n", song->dataInc, song->hold, song->loop);
- con->DebugPrintf("signal: %d, priority: %d\n", song->signal, song->prio);
+ con->DebugPrintf("signal: %d, priority: %d\n", song->signal, song->priority);
con->DebugPrintf("ticker: %d, volume: %d\n", song->ticker, song->volume);
if (song->pMidiParser) {
@@ -442,12 +442,12 @@ MusicEntry::MusicEntry() {
soundObj = NULL_REG;
soundRes = 0;
- resnum = 0;
+ resourceId = 0;
dataInc = 0;
ticker = 0;
signal = 0;
- prio = 0;
+ priority = 0;
loop = 0;
volume = MUSIC_VOLUME_DEFAULT;
hold = 0;
diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h
index 679a9928e4..159e72b39e 100644
--- a/engines/sci/sound/music.h
+++ b/engines/sci/sound/music.h
@@ -69,12 +69,12 @@ public:
reg_t soundObj;
SoundResource *soundRes;
- uint16 resnum;
+ uint16 resourceId;
uint16 dataInc;
uint16 ticker;
uint16 signal;
- byte prio;
+ byte priority;
uint16 loop;
int16 volume;
byte hold;
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index ab49caf64a..b6792b710f 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -253,7 +253,7 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) {
if (!obj.segment)
return;
- int number = GET_SEL32V(_segMan, obj, SELECTOR(number));
+ int resourceId = GET_SEL32V(_segMan, obj, SELECTOR(number));
#ifdef USE_OLD_MUSIC_FUNCTIONS
@@ -273,10 +273,10 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) {
}
}
- if (!obj.segment || !_resMan->testResource(ResourceId(kResourceTypeSound, number)))
+ if (!obj.segment || !_resMan->testResource(ResourceId(kResourceTypeSound, resourceId)))
return;
- _state->sfx_add_song(build_iterator(_resMan, number, type, handle), 0, handle, number);
+ _state->sfx_add_song(build_iterator(_resMan, resourceId, type, handle), 0, handle, resourceId);
// Notify the engine
@@ -295,15 +295,15 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) {
cmdDisposeSound(obj, value);
MusicEntry *newSound = new MusicEntry();
- newSound->resnum = number;
- if (number && _resMan->testResource(ResourceId(kResourceTypeSound, number)))
- newSound->soundRes = new SoundResource(number, _resMan, _soundVersion);
+ newSound->resourceId = resourceId;
+ if (resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, resourceId)))
+ newSound->soundRes = new SoundResource(resourceId, _resMan, _soundVersion);
else
newSound->soundRes = 0;
newSound->soundObj = obj;
newSound->loop = GET_SEL32V(_segMan, obj, SELECTOR(loop));
- newSound->prio = GET_SEL32V(_segMan, obj, SELECTOR(pri)) & 0xFF;
+ newSound->priority = GET_SEL32V(_segMan, obj, SELECTOR(pri)) & 0xFF;
if (_soundVersion >= SCI_VERSION_1_LATE)
newSound->volume = CLIP<int>(GET_SEL32V(_segMan, obj, SELECTOR(vol)), 0, MUSIC_VOLUME_MAX);
@@ -312,10 +312,10 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) {
// effects. If the resource exists, play it using map 65535 (sound
// effects map)
- if (getSciVersion() >= SCI_VERSION_1_1 && _resMan->testResource(ResourceId(kResourceTypeAudio, number))) {
+ if (getSciVersion() >= SCI_VERSION_1_1 && _resMan->testResource(ResourceId(kResourceTypeAudio, resourceId))) {
// Found a relevant audio resource, play it
int sampleLen;
- newSound->pStreamAud = _audio->getAudioStream(number, 65535, &sampleLen);
+ newSound->pStreamAud = _audio->getAudioStream(resourceId, 65535, &sampleLen);
newSound->soundType = Audio::Mixer::kSpeechSoundType;
} else {
if (newSound->soundRes)
@@ -415,16 +415,16 @@ void SoundCommandParser::cmdPlaySound(reg_t obj, int16 value) {
return;
}
- int number = obj.segment ? GET_SEL32V(_segMan, obj, SELECTOR(number)) : -1;
+ int resourceId = obj.segment ? GET_SEL32V(_segMan, obj, SELECTOR(number)) : -1;
- if (musicSlot->resnum != number) { // another sound loaded into struct
+ if (musicSlot->resourceId != resourceId) { // another sound loaded into struct
cmdDisposeSound(obj, value);
cmdInitSound(obj, value);
// Find slot again :)
musicSlot = _music->getSlot(obj);
}
int16 loop = GET_SEL32V(_segMan, obj, SELECTOR(loop));
- debugC(2, kDebugLevelSound, "cmdPlaySound: resource number %d, loop %d", number, loop);
+ debugC(2, kDebugLevelSound, "cmdPlaySound: resource number %d, loop %d", resourceId, loop);
PUT_SEL32(_segMan, obj, SELECTOR(handle), obj);
@@ -439,7 +439,7 @@ void SoundCommandParser::cmdPlaySound(reg_t obj, int16 value) {
}
musicSlot->loop = GET_SEL32V(_segMan, obj, SELECTOR(loop));
- musicSlot->prio = GET_SEL32V(_segMan, obj, SELECTOR(priority));
+ musicSlot->priority = GET_SEL32V(_segMan, obj, SELECTOR(priority));
if (_soundVersion >= SCI_VERSION_1_LATE)
musicSlot->volume = GET_SEL32V(_segMan, obj, SELECTOR(vol));
_music->soundPlay(musicSlot);
@@ -729,7 +729,7 @@ void SoundCommandParser::cmdUpdateSound(reg_t obj, int16 value) {
if (objVol != musicSlot->volume)
_music->soundSetVolume(musicSlot, objVol);
uint32 objPrio = GET_SEL32V(_segMan, obj, SELECTOR(pri));
- if (objPrio != musicSlot->prio)
+ if (objPrio != musicSlot->priority)
_music->soundSetPriority(musicSlot, objPrio);
#endif
@@ -984,7 +984,7 @@ void SoundCommandParser::cmdSetSoundPriority(reg_t obj, int16 value) {
if (value == -1) {
// Set priority from the song data
- Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, musicSlot->resnum), 0);
+ Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, musicSlot->resourceId), 0);
if (song->data[0] == 0xf0)
_music->soundSetPriority(musicSlot, song->data[1]);
else
@@ -1077,8 +1077,8 @@ void SoundCommandParser::reconstructPlayList(int savegame_version) {
const MusicList::iterator end = _music->getPlayListEnd();
for (MusicList::iterator i = _music->getPlayListStart(); i != end; ++i) {
- if ((*i)->resnum && _resMan->testResource(ResourceId(kResourceTypeSound, (*i)->resnum))) {
- (*i)->soundRes = new SoundResource((*i)->resnum, _resMan, _soundVersion);
+ if ((*i)->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, (*i)->resourceId))) {
+ (*i)->soundRes = new SoundResource((*i)->resourceId, _resMan, _soundVersion);
_music->soundInitSnd(*i);
} else {
(*i)->soundRes = 0;