added tag2str helper function
svn-id: r10866
This commit is contained in:
parent
ae6e6a4885
commit
012450de73
3 changed files with 18 additions and 21 deletions
|
@ -426,11 +426,7 @@ void ScummEngine::readIndexFile() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error("Bad ID %c%c%c%c found in directory!",
|
error("Bad ID '%s' found in directory!", tag2str(blocktype));
|
||||||
(byte)blocktype,
|
|
||||||
(byte)(blocktype >> 8),
|
|
||||||
(byte)(blocktype >> 16),
|
|
||||||
(byte)(blocktype >> 24));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -712,10 +708,7 @@ int ScummEngine::readSoundResource(int type, int idx) {
|
||||||
basetag = fileReadDword();
|
basetag = fileReadDword();
|
||||||
total_size = _fileHandle.readUint32BE();
|
total_size = _fileHandle.readUint32BE();
|
||||||
|
|
||||||
debug(8, " basetag: %c%c%c%c, total_size=%d",
|
debug(8, " basetag: %s, total_size=%d", tag2str(TO_BE_32(basetag)), total_size);
|
||||||
(char)((basetag >> 24) & 0xff),
|
|
||||||
(char)((basetag >> 16) & 0xff),
|
|
||||||
(char)((basetag >> 8) & 0xff), (char)(basetag & 0xff), total_size);
|
|
||||||
|
|
||||||
if (basetag == MKID('MIDI') || basetag == MKID('iMUS')) {
|
if (basetag == MKID('MIDI') || basetag == MKID('iMUS')) {
|
||||||
if (_midiDriver != MD_PCSPK && _midiDriver != MD_PCJR) {
|
if (_midiDriver != MD_PCSPK && _midiDriver != MD_PCJR) {
|
||||||
|
@ -768,9 +761,7 @@ int ScummEngine::readSoundResource(int type, int idx) {
|
||||||
if ((_midiDriver == MD_PCSPK || _midiDriver == MD_PCJR) && pri != 11)
|
if ((_midiDriver == MD_PCSPK || _midiDriver == MD_PCJR) && pri != 11)
|
||||||
pri = -1;
|
pri = -1;
|
||||||
|
|
||||||
debug(8, " tag: %c%c%c%c, total_size=%d, pri=%d",
|
debug(8, " tag: %s, total_size=%d, pri=%d", tag2str(TO_BE_32(tag)), size, pri);
|
||||||
(char)((tag >> 24) & 0xff),
|
|
||||||
(char)((tag >> 16) & 0xff), (char)((tag >> 8) & 0xff), (char)(tag & 0xff), size, pri);
|
|
||||||
|
|
||||||
|
|
||||||
if (pri > best_pri) {
|
if (pri > best_pri) {
|
||||||
|
@ -1034,11 +1025,7 @@ static inline byte Mac0ToGMInstrument(uint32 type, int &transpose) {
|
||||||
case MKID('BONG'): return 115;
|
case MKID('BONG'): return 115;
|
||||||
case MKID('BASS'): transpose = -24; return 35;
|
case MKID('BASS'): transpose = -24; return 35;
|
||||||
default:
|
default:
|
||||||
error("Unknown Mac0 instrument %c%c%c%c found",
|
error("Unknown Mac0 instrument %s found", tag2str(type));
|
||||||
(byte)type,
|
|
||||||
(byte)(type >> 8),
|
|
||||||
(byte)(type >> 16),
|
|
||||||
(byte)(type >> 24));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2311,8 +2298,7 @@ const byte *findResource(uint32 tag, const byte *searchin) {
|
||||||
|
|
||||||
size = READ_BE_UINT32(searchin + 4);
|
size = READ_BE_UINT32(searchin + 4);
|
||||||
if ((int32)size <= 0) {
|
if ((int32)size <= 0) {
|
||||||
error("(%c%c%c%c) Not found in %d... illegal block len %d",
|
error("(%s) Not found in %d... illegal block len %d", tag2str(tag), 0, size);
|
||||||
tag & 0xFF, (tag >> 8) & 0xFF, (tag >> 16) & 0xFF, (tag >> 24) & 0xFF, 0, size);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2344,8 +2330,7 @@ const byte *findResourceSmall(uint32 tag, const byte *searchin) {
|
||||||
return searchin;
|
return searchin;
|
||||||
|
|
||||||
if ((int32)size <= 0) {
|
if ((int32)size <= 0) {
|
||||||
error("(%c%c%c%c) Not found in %d... illegal block len %d",
|
error("(%s) Not found in %d... illegal block len %d", tag2str(tag), 0, size);
|
||||||
tag & 0xFF, (tag >> 8) & 0xFF, (tag >> 16) & 0xFF, (tag >> 24) & 0xFF, 0, size);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1210,6 +1210,8 @@ int toSimpleDir(int dirtype, int dir);
|
||||||
|
|
||||||
void checkRange(int max, int min, int no, const char *str);
|
void checkRange(int max, int min, int no, const char *str);
|
||||||
|
|
||||||
|
const char *tag2str(uint32 tag);
|
||||||
|
|
||||||
} // End of namespace Scumm
|
} // End of namespace Scumm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2625,6 +2625,16 @@ int normalizeAngle(int angle) {
|
||||||
return toSimpleDir(1, temp) * 45;
|
return toSimpleDir(1, temp) * 45;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *tag2str(uint32 tag) {
|
||||||
|
static char str[5];
|
||||||
|
str[0] = (char)(tag >> 24);
|
||||||
|
str[1] = (char)(tag >> 16);
|
||||||
|
str[2] = (char)(tag >> 8);
|
||||||
|
str[3] = (char)tag;
|
||||||
|
str[4] = '\0';
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Scumm
|
} // End of namespace Scumm
|
||||||
|
|
||||||
using namespace Scumm;
|
using namespace Scumm;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue