mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-20 08:53:51 +00:00
MADS: Add missing handling code for palette _rgbList
This commit is contained in:
parent
8b2a7525cc
commit
9b0f0b6efe
@ -322,7 +322,12 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface,
|
||||
_spriteListIndexes[_header._spritesIndex] = _scene->_sprites.add(sprites);
|
||||
}
|
||||
|
||||
// TODO: List var_420/var_422 population that seems to overwrite other structures?
|
||||
Common::Array<int> usageList;
|
||||
for (int idx = 0; idx < _header._spriteSetsCount; ++idx)
|
||||
usageList.push_back(_spriteSets[idx]->_usageIndex);
|
||||
|
||||
if (usageList.size() > 0 > 0)
|
||||
_vm->_palette->_paletteUsage.updateUsage(usageList, _header._messagesCount);
|
||||
|
||||
if (_header._animMode == 4) {
|
||||
// Remaps the sprite list indexes for frames to the loaded sprite list indexes
|
||||
|
@ -46,6 +46,11 @@ SpriteAsset::SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int
|
||||
load(stream, flags);
|
||||
}
|
||||
|
||||
SpriteAsset::~SpriteAsset() {
|
||||
if (_usageIndex)
|
||||
_vm->_palette->_paletteUsage.resetPalFlags(_usageIndex);
|
||||
}
|
||||
|
||||
void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) {
|
||||
int curFrame = 0;
|
||||
uint32 frameOffset = 0;
|
||||
|
@ -89,6 +89,11 @@ public:
|
||||
*/
|
||||
SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int flags);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~SpriteAsset();
|
||||
|
||||
int getCount() { return _frameCount; }
|
||||
int getFrameRate() const { return _frameRate; }
|
||||
int getPixelSpeed() const { return _pixelSpeed; }
|
||||
|
@ -276,6 +276,21 @@ void PaletteUsage::updateUsage(Common::Array<int> &usageList, int sceneUsageInde
|
||||
_vm->_palette->_rgbList[sceneUsageIndex] = true;
|
||||
}
|
||||
|
||||
void PaletteUsage::resetPalFlags(int idx) {
|
||||
if (idx >= 0 && idx < 32) {
|
||||
uint32 rgbMask = ~(1 << idx);
|
||||
|
||||
uint32 *flagP = _vm->_palette->_palFlags;
|
||||
for (int i = 0; i < 256; ++i, ++flagP) {
|
||||
*flagP &= rgbMask;
|
||||
if (*flagP == 2)
|
||||
*flagP = 0;
|
||||
}
|
||||
|
||||
_vm->_palette->_rgbList[idx] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int PaletteUsage::getGamePalFreeIndex(int *palIndex) {
|
||||
*palIndex = -1;
|
||||
int count = 0;
|
||||
@ -330,6 +345,7 @@ Palette::Palette(MADSEngine *vm) : _vm(vm), _paletteUsage(vm) {
|
||||
_lowRange = 0;
|
||||
_highRange = 0;
|
||||
Common::fill(&_mainPalette[0], &_mainPalette[PALETTE_SIZE], 0);
|
||||
Common::fill(&_palFlags[0], &_palFlags[PALETTE_COUNT], 0);
|
||||
}
|
||||
|
||||
void Palette::setPalette(const byte *colors, uint start, uint num) {
|
||||
@ -423,7 +439,7 @@ void Palette::resetGamePalette(int lowRange, int highRange) {
|
||||
|
||||
// Init low range to common RGB values
|
||||
if (lowRange) {
|
||||
Common::fill(&_palFlags[0], &_palFlags[lowRange], 1);
|
||||
Common::fill(&_palFlags[0], &_palFlags[lowRange - 1], 1);
|
||||
}
|
||||
|
||||
// Init high range to common RGB values
|
||||
|
@ -127,6 +127,8 @@ public:
|
||||
void transform(Common::Array<RGB6> &palette);
|
||||
|
||||
void updateUsage(Common::Array<int> &usageList, int sceneUsageIndex);
|
||||
|
||||
void resetPalFlags(int idx);
|
||||
};
|
||||
|
||||
class RGBList {
|
||||
|
Loading…
x
Reference in New Issue
Block a user