Simplify code

svn-id: r31409
This commit is contained in:
Eugene Sandulenko 2008-04-05 14:18:32 +00:00
parent a52c6e0ba2
commit c8061850ed
2 changed files with 4 additions and 22 deletions

View File

@ -550,10 +550,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) {
// Load the external music file for Mac IHNM
Common::File musicFile;
char musicFileName[40];
if (resourceId <= 16) // F in hex (1 char in hex)
sprintf(musicFileName, "Music/Music0%x", resourceId);
else
sprintf(musicFileName, "Music/Music%x", resourceId);
sprintf(musicFileName, "Music/Music%02x", resourceId);
musicFile.open(musicFileName);
resourceSize = musicFile.size();
resourceData = new byte[resourceSize];

View File

@ -192,29 +192,14 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
dirIndex = floor((float)(resourceId / 64));
if (_voiceSerial == 0) {
if (resourceId <= 16) // F in hex (1 char in hex)
sprintf(soundFileName, "Voices/VoicesS/Voices%d/VoicesS00%x", dirIndex, resourceId);
else if (resourceId <= 255) // FF in hex (2 chars in hex)
sprintf(soundFileName, "Voices/VoicesS/Voices%d/VoicesS0%x", dirIndex, resourceId);
else
sprintf(soundFileName, "Voices/VoicesS/Voices%d/VoicesS%x", dirIndex, resourceId);
sprintf(soundFileName, "Voices/VoicesS/Voices%d/VoicesS%03x", dirIndex, resourceId);
} else {
if (resourceId <= 16) // F in hex (1 char in hex)
sprintf(soundFileName, "Voices/Voices%d/Voices%d/Voices%d00%x", _voiceSerial, dirIndex, _voiceSerial, resourceId);
else if (resourceId <= 255) // FF in hex (2 chars in hex)
sprintf(soundFileName, "Voices/Voices%d/Voices%d/Voices%d0%x", _voiceSerial, dirIndex, _voiceSerial, resourceId);
else
sprintf(soundFileName, "Voices/Voices%d/Voices%d/Voices%d%x", _voiceSerial, dirIndex, _voiceSerial, resourceId);
sprintf(soundFileName, "Voices/Voices%d/Voices%d/Voices%d%03x", _voiceSerial, dirIndex, _voiceSerial, resourceId);
}
} else {
dirIndex = floor((float)(resourceId / 64));
if (resourceId <= 16) // F in hex (1 char in hex)
sprintf(soundFileName, "SFX/SFX%d/SFX00%x", dirIndex, resourceId);
else if (resourceId <= 255) // FF in hex (2 chars in hex)
sprintf(soundFileName, "SFX/SFX%d/SFX0%x", dirIndex, resourceId);
else
sprintf(soundFileName, "SFX/SFX%d/SFX%x", dirIndex, resourceId);
sprintf(soundFileName, "SFX/SFX%d/SFX%02x", dirIndex, resourceId);
}
soundFile.open(soundFileName);
soundResourceLength = soundFile.size();