aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/palette.cpp24
-rw-r--r--engines/mads/palette.h2
-rw-r--r--engines/mads/scene_data.cpp6
3 files changed, 29 insertions, 3 deletions
diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index aeb97d2ff2..7e0d5bbdb5 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -304,6 +304,30 @@ void PaletteUsage::transform(Common::Array<RGB6> &palette) {
}
}
+void PaletteUsage::updateUsage(Common::Array<int> &usageList, int sceneUsageIndex) {
+ uint32 mask1 = 0xFFFFFFFF;
+ uint32 mask2 = 0;
+
+ for (uint idx = 0; idx < usageList.size(); ++idx) {
+ uint32 bitMask = 1 << usageList[idx];
+ mask1 ^= bitMask;
+ mask2 |= bitMask;
+ _vm->_palette->_rgbList[usageList[idx]] = 0;
+ }
+
+ uint32 mask3 = 1 << sceneUsageIndex;
+
+ for (uint idx = 0; idx < PALETTE_COUNT; ++idx) {
+ uint32 mask = mask2 & _vm->_palette->_palFlags[idx];
+ if (mask) {
+ _vm->_palette->_palFlags[idx] = (_vm->_palette->_palFlags[idx] &
+ mask1) | mask3;
+ }
+ }
+
+ _vm->_palette->_rgbList[sceneUsageIndex] = -1;
+}
+
int PaletteUsage::getGamePalFreeIndex(int *palIndex) {
*palIndex = -1;
int count = 0;
diff --git a/engines/mads/palette.h b/engines/mads/palette.h
index 2744d47190..5f21bd9a21 100644
--- a/engines/mads/palette.h
+++ b/engines/mads/palette.h
@@ -94,6 +94,8 @@ public:
int process(Common::Array<RGB6> &palette, uint flags);
void transform(Common::Array<RGB6> &palette);
+
+ void updateUsage(Common::Array<int> &usageList, int sceneUsageIndex);
};
class RGBList {
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index d4fefff4f6..18a3b6ceda 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -522,7 +522,7 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName,
artFile.close();
Common::Array<SpriteAsset *> spriteSets;
- Common::Array<int> indexList;
+ Common::Array<int> usageList;
if (flags & 1) {
for (uint i = 0; i < setNames.size(); ++i) {
@@ -533,11 +533,11 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName,
SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags);
spriteSets.push_back(sprites);
- indexList.push_back(-1); // TODO:: sprites->_field6
+ usageList.push_back(sprites->_usageIndex);
}
}
- warning("TODO: sub_201E4(indexList, namesCount, &pal data2");
+ _vm->_palette->_paletteUsage.updateUsage(usageList, _usageIndex);
for (uint i = 0; i < spriteInfo.size(); ++i) {
SpriteInfo &si = spriteInfo[i];