diff options
author | Filippos Karapetis | 2013-12-10 01:40:46 +0200 |
---|---|---|
committer | Filippos Karapetis | 2013-12-10 01:41:15 +0200 |
commit | fa2ea4fc6190043386f1ee0909d48af72ff7da69 (patch) | |
tree | 7a210410a6027feac2f33d092e0b6d5fb81d4b0a /engines/sci/resource.h | |
parent | 59b7aa354b8d32a8f62fbd67557d04b640695225 (diff) | |
download | scummvm-rg350-fa2ea4fc6190043386f1ee0909d48af72ff7da69.tar.gz scummvm-rg350-fa2ea4fc6190043386f1ee0909d48af72ff7da69.tar.bz2 scummvm-rg350-fa2ea4fc6190043386f1ee0909d48af72ff7da69.zip |
SCI: Add handling for the RAVE resource type, found in KQ6CD
This contains the sync data in the Windows version of KQ6CD.
Note that currently the sync36 resource is 2 bytes bigger
(it contains 2 bytes from the RAVE resource). Some test code
has also been added to dump the RAVE sync resources
Diffstat (limited to 'engines/sci/resource.h')
-rw-r--r-- | engines/sci/resource.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 6fa51754a4..c4c8e543b2 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -112,6 +112,8 @@ enum ResourceType { kResourceTypeMacIconBarPictS, // IBIS resources (icon bar, selected) kResourceTypeMacPict, // PICT resources (inventory) + kResourceTypeRave, // KQ6 hires RAVE (special sync) resources + kResourceTypeInvalid }; @@ -143,6 +145,19 @@ class ResourceId { uint16 _number; uint32 _tuple; // Only used for audio36 and sync36 + static Common::String intToBase36(uint32 number, int minChar) { + // Convert from an integer to a base36 string + Common::String string; + + while (minChar--) { + int character = number % 36; + string = ((character < 10) ? (character + '0') : (character + 'A' - 10)) + string; + number /= 36; + } + + return string; + } + public: ResourceId() : _type(kResourceTypeInvalid), _number(0), _tuple(0) { } @@ -169,6 +184,22 @@ public: return retStr; } + // Convert from a resource ID to a base36 patch name + Common::String toPatchNameBase36() { + Common::String output; + + output += (getType() == kResourceTypeAudio36) ? '@' : '#'; // Identifier + output += intToBase36(getNumber(), 3); // Map + output += intToBase36(getTuple() >> 24, 2); // Noun + output += intToBase36((getTuple() >> 16) & 0xff, 2); // Verb + output += '.'; // Separator + output += intToBase36((getTuple() >> 8) & 0xff, 2); // Cond + output += intToBase36(getTuple() & 0xff, 1); // Seq + + assert(output.size() == 12); // We should always get 12 characters in the end + return output; + } + inline ResourceType getType() const { return _type; } inline uint16 getNumber() const { return _number; } inline uint32 getTuple() const { return _tuple; } |