diff options
-rw-r--r-- | engines/kyra/kyra_lok.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/resource.h | 38 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 98 |
3 files changed, 73 insertions, 67 deletions
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index 24850c7d37..a1ee5c84fb 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -75,7 +75,7 @@ KyraEngine_LoK::KyraEngine_LoK(OSystem *system, const GameFlags &flags) _winterScrollTableSize = _winterScroll1TableSize = _winterScroll2TableSize = 0; _drinkAnimationTable = _brandonToWispTable = _magicAnimationTable = _brandonStoneTable = 0; _drinkAnimationTableSize = _brandonToWispTableSize = _magicAnimationTableSize = _brandonStoneTableSize = 0; - memset(&_specialPalettes, 0, sizeof(_specialPalettes)); + _specialPalettes = 0; _sprites = 0; _animator = 0; _seq = 0; @@ -126,6 +126,8 @@ KyraEngine_LoK::~KyraEngine_LoK() { delete[] _defaultShapeTable; + delete[] _specialPalettes; + delete[] _gui->_scrollUpButton.data0ShapePtr; delete[] _gui->_scrollUpButton.data1ShapePtr; delete[] _gui->_scrollUpButton.data2ShapePtr; diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index f82985e331..504d3deac4 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -166,7 +166,39 @@ enum KyraResources { k1MagicAnimShapes, k1BranStoneShapes, - k1PaletteList, + k1SpecialPalette1, + k1SpecialPalette2, + k1SpecialPalette3, + k1SpecialPalette4, + k1SpecialPalette5, + k1SpecialPalette6, + k1SpecialPalette7, + k1SpecialPalette8, + k1SpecialPalette9, + k1SpecialPalette10, + k1SpecialPalette11, + k1SpecialPalette12, + k1SpecialPalette13, + k1SpecialPalette14, + k1SpecialPalette15, + k1SpecialPalette16, + k1SpecialPalette17, + k1SpecialPalette18, + k1SpecialPalette19, + k1SpecialPalette20, + k1SpecialPalette21, + k1SpecialPalette22, + k1SpecialPalette23, + k1SpecialPalette24, + k1SpecialPalette25, + k1SpecialPalette26, + k1SpecialPalette27, + k1SpecialPalette28, + k1SpecialPalette29, + k1SpecialPalette30, + k1SpecialPalette31, + k1SpecialPalette32, + k1SpecialPalette33, k1GUIStrings, k1ConfigStrings, @@ -328,7 +360,6 @@ public: const Shape *loadShapeTable(int id, int &entries); const AmigaSfxTable *loadAmigaSfxTable(int id, int &entries); const Room *loadRoomTable(int id, int &entries); - const uint8 * const *loadPaletteTable(int id, int &entries); const HofSeqData *loadHofSequenceData(int id, int &entries); const ItemAnimData_v1 *loadShapeAnimData_v1(int id, int &entries); const ItemAnimData_v2 *loadShapeAnimData_v2(int id, int &entries); @@ -369,7 +400,6 @@ private: bool loadShapeTable(const char *filename, void *&ptr, int &size); bool loadAmigaSfxTable(const char *filename, void *&ptr, int &size); bool loadRoomTable(const char *filename, void *&ptr, int &size); - bool loadPaletteTable(const char *filename, void *&ptr, int &size); bool loadHofSequenceData(const char *filename, void *&ptr, int &size); bool loadShapeAnimData_v1(const char *filename, void *&ptr, int &size); bool loadShapeAnimData_v2(const char *filename, void *&ptr, int &size); @@ -388,7 +418,6 @@ private: void freeShapeTable(void *&ptr, int &size); void freeAmigaSfxTable(void *&ptr, int &size); void freeRoomTable(void *&ptr, int &size); - void freePaletteTable(void *&ptr, int &size); void freeHofSequenceData(void *&ptr, int &size); void freeHofShapeAnimDataV1(void *&ptr, int &size); void freeHofShapeAnimDataV2(void *&ptr, int &size); @@ -411,7 +440,6 @@ private: kRoomList, kShapeList, kRawData, - kPaletteTable, kAmigaSfxTable, k2SeqData, diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index d5ebd07dd1..4fd77a6b9c 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -241,7 +241,6 @@ bool StaticResource::init() { { kShapeList, proc(loadShapeTable), proc(freeShapeTable) }, { kAmigaSfxTable, proc(loadAmigaSfxTable), proc(freeAmigaSfxTable) }, { kRawData, proc(loadRawData), proc(freeRawData) }, - { kPaletteTable, proc(loadPaletteTable), proc(freePaletteTable) }, { k2SeqData, proc(loadHofSequenceData), proc(freeHofSequenceData) }, { k2ShpAnimDataV1, proc(loadShapeAnimData_v1), proc(freeHofShapeAnimDataV1) }, @@ -333,7 +332,39 @@ bool StaticResource::init() { { k1AmuleteAnimSeq, kRawData, "AMULETEANIM.SEQ" }, // PALETTE table - { k1PaletteList, kPaletteTable, "1 33 PALTABLE" }, + { k1SpecialPalette1, kRawData, "PALTABLE1.PAL" }, + { k1SpecialPalette2, kRawData, "PALTABLE2.PAL" }, + { k1SpecialPalette3, kRawData, "PALTABLE3.PAL" }, + { k1SpecialPalette4, kRawData, "PALTABLE4.PAL" }, + { k1SpecialPalette5, kRawData, "PALTABLE5.PAL" }, + { k1SpecialPalette6, kRawData, "PALTABLE6.PAL" }, + { k1SpecialPalette7, kRawData, "PALTABLE7.PAL" }, + { k1SpecialPalette8, kRawData, "PALTABLE8.PAL" }, + { k1SpecialPalette9, kRawData, "PALTABLE9.PAL" }, + { k1SpecialPalette10, kRawData, "PALTABLE10.PAL" }, + { k1SpecialPalette11, kRawData, "PALTABLE11.PAL" }, + { k1SpecialPalette12, kRawData, "PALTABLE12.PAL" }, + { k1SpecialPalette13, kRawData, "PALTABLE13.PAL" }, + { k1SpecialPalette14, kRawData, "PALTABLE14.PAL" }, + { k1SpecialPalette15, kRawData, "PALTABLE15.PAL" }, + { k1SpecialPalette16, kRawData, "PALTABLE16.PAL" }, + { k1SpecialPalette17, kRawData, "PALTABLE17.PAL" }, + { k1SpecialPalette18, kRawData, "PALTABLE18.PAL" }, + { k1SpecialPalette19, kRawData, "PALTABLE19.PAL" }, + { k1SpecialPalette20, kRawData, "PALTABLE20.PAL" }, + { k1SpecialPalette21, kRawData, "PALTABLE21.PAL" }, + { k1SpecialPalette22, kRawData, "PALTABLE22.PAL" }, + { k1SpecialPalette23, kRawData, "PALTABLE23.PAL" }, + { k1SpecialPalette24, kRawData, "PALTABLE24.PAL" }, + { k1SpecialPalette25, kRawData, "PALTABLE25.PAL" }, + { k1SpecialPalette26, kRawData, "PALTABLE26.PAL" }, + { k1SpecialPalette27, kRawData, "PALTABLE27.PAL" }, + { k1SpecialPalette28, kRawData, "PALTABLE28.PAL" }, + { k1SpecialPalette29, kRawData, "PALTABLE29.PAL" }, + { k1SpecialPalette30, kRawData, "PALTABLE30.PAL" }, + { k1SpecialPalette31, kRawData, "PALTABLE31.PAL" }, + { k1SpecialPalette32, kRawData, "PALTABLE32.PAL" }, + { k1SpecialPalette33, kRawData, "PALTABLE33.PAL" }, // AUDIO files { k1AudioTracks, kStringList, "TRACKS.TXT" }, @@ -549,10 +580,6 @@ const Room *StaticResource::loadRoomTable(int id, int &entries) { return (const Room *)getData(id, StaticResource::kRoomList, entries); } -const uint8 * const *StaticResource::loadPaletteTable(int id, int &entries) { - return (const uint8* const *)getData(id, kPaletteTable, entries); -} - const HofSeqData *StaticResource::loadHofSequenceData(int id, int &entries) { return (const HofSeqData *)getData(id, k2SeqData, entries); } @@ -855,51 +882,6 @@ bool StaticResource::loadRoomTable(const char *filename, void *&ptr, int &size) return true; } -bool StaticResource::loadPaletteTable(const char *filename, void *&ptr, int &size) { - const char *temp = filename; - int start = atoi(temp); - temp = strstr(temp, " "); - if (temp == NULL) - return false; - ++temp; - int end = atoi(temp); - - uint8 **table = new uint8*[end-start+1]; - assert(table); - - char baseFilename[64]; - temp = filename; - temp = strstr(temp, " "); - ++temp; - temp = strstr(temp, " "); - if (temp == NULL) - return false; - ++temp; - strncpy(baseFilename, temp, 64); - - char name[64]; - for (int i = start; i <= end; ++i) { - snprintf(name, 64, "%s%d.PAL", baseFilename, i); - - Common::SeekableReadStream *file = getFile(name); - if (!file) { - for (int j = start; j < i; ++i) - delete[] table[j-start]; - delete[] table; - - return false; - } - - table[i-start] = new uint8[file->size()]; - file->read(table[i-start], file->size()); - delete file; - } - - ptr = table; - size = end - start + 1; - return true; -} - bool StaticResource::loadHofSequenceData(const char *filename, void *&ptr, int &size) { Common::SeekableReadStream *file = getFile(filename); @@ -1361,15 +1343,6 @@ void StaticResource::freeButtonDefs(void *&ptr, int &size) { } #endif // ENABLE_LOL -void StaticResource::freePaletteTable(void *&ptr, int &size) { - uint8 **data = (uint8 **)ptr; - while (size--) - delete[] data[size]; - delete[] data; - ptr = 0; - size = 0; -} - const char *StaticResource::getFilename(const char *name) { static Common::String filename; @@ -1464,7 +1437,10 @@ void KyraEngine_LoK::initStaticResource() { _amuleteAnim = _staticres->loadRawData(k1AmuleteAnimSeq, temp); - _specialPalettes = _staticres->loadPaletteTable(k1PaletteList, temp); + const uint8 **palTable = new const uint8 *[k1SpecialPalette33 - k1SpecialPalette1 + 1]; + for (int i = k1SpecialPalette1; i <= k1SpecialPalette33; ++i) + palTable[i - k1SpecialPalette1] = _staticres->loadRawData(i, temp); + _specialPalettes = palTable; _guiStrings = _staticres->loadStrings(k1GUIStrings, _guiStringsSize); _configStrings = _staticres->loadStrings(k1ConfigStrings, _configStringsSize); |