mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
MADS: Implemented PaletteUsage::updateUsage
This commit is contained in:
parent
98f7ba9643
commit
d9bb593b5f
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user