mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
COMPOSER: Implement kFuncChangeBackground.
This commit is contained in:
parent
6dfbf74a74
commit
6646be1da1
@ -335,7 +335,7 @@ void ComposerEngine::loadLibrary(uint id) {
|
||||
|
||||
// add background sprite, if it exists
|
||||
if (hasResource(ID_BMAP, 1000))
|
||||
addSprite(1000, 0, 0xffff, Common::Point());
|
||||
setBackground(1000);
|
||||
|
||||
// TODO: better CTBL logic
|
||||
loadCTBL(1000, 100);
|
||||
|
@ -183,13 +183,14 @@ private:
|
||||
void processAnimFrame();
|
||||
|
||||
bool spriteVisible(uint16 id, uint16 animId);
|
||||
void addSprite(uint16 id, uint16 animId, uint16 zorder, const Common::Point &pos);
|
||||
Sprite *addSprite(uint16 id, uint16 animId, uint16 zorder, const Common::Point &pos);
|
||||
void removeSprite(uint16 id, uint16 animId);
|
||||
const Sprite *getSpriteAtPos(const Common::Point &pos);
|
||||
const Button *getButtonFor(const Sprite *sprite, const Common::Point &pos);
|
||||
|
||||
void redraw();
|
||||
void loadCTBL(uint id, uint fadePercent);
|
||||
void loadCTBL(uint16 id, uint fadePercent);
|
||||
void setBackground(uint16 id);
|
||||
void decompressBitmap(uint16 type, Common::SeekableReadStream *stream, byte *buffer, uint32 size, uint width, uint height);
|
||||
bool initSprite(Sprite &sprite);
|
||||
Common::SeekableReadStream *getStreamForSprite(uint16 id);
|
||||
|
@ -369,7 +369,7 @@ bool ComposerEngine::spriteVisible(uint16 id, uint16 animId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ComposerEngine::addSprite(uint16 id, uint16 animId, uint16 zorder, const Common::Point &pos) {
|
||||
Sprite *ComposerEngine::addSprite(uint16 id, uint16 animId, uint16 zorder, const Common::Point &pos) {
|
||||
Sprite sprite;
|
||||
bool foundSprite = false;
|
||||
|
||||
@ -385,7 +385,7 @@ void ComposerEngine::addSprite(uint16 id, uint16 animId, uint16 zorder, const Co
|
||||
if (i->_zorder == zorder) {
|
||||
i->_animId = animId;
|
||||
i->_pos = pos;
|
||||
return;
|
||||
return &(*i);
|
||||
}
|
||||
|
||||
// otherwise, take a copy and remove it from the list
|
||||
@ -403,7 +403,7 @@ void ComposerEngine::addSprite(uint16 id, uint16 animId, uint16 zorder, const Co
|
||||
sprite._id = id;
|
||||
if (!initSprite(sprite)) {
|
||||
warning("ignoring addSprite on invalid sprite %d", id);
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,9 +412,11 @@ void ComposerEngine::addSprite(uint16 id, uint16 animId, uint16 zorder, const Co
|
||||
continue;
|
||||
// insert *before* this sprite
|
||||
_sprites.insert(i, sprite);
|
||||
return;
|
||||
--i;
|
||||
return &(*i);
|
||||
}
|
||||
_sprites.push_back(sprite);
|
||||
return &_sprites.back();
|
||||
}
|
||||
|
||||
void ComposerEngine::removeSprite(uint16 id, uint16 animId) {
|
||||
@ -453,7 +455,7 @@ void ComposerEngine::redraw() {
|
||||
_needsUpdate = false;
|
||||
}
|
||||
|
||||
void ComposerEngine::loadCTBL(uint id, uint fadePercent) {
|
||||
void ComposerEngine::loadCTBL(uint16 id, uint fadePercent) {
|
||||
Common::SeekableReadStream *stream = getResource(ID_CTBL, id);
|
||||
|
||||
uint16 numEntries = stream->readUint16LE();
|
||||
@ -472,6 +474,22 @@ void ComposerEngine::loadCTBL(uint id, uint fadePercent) {
|
||||
_system->getPaletteManager()->setPalette(buffer, 0, numEntries);
|
||||
}
|
||||
|
||||
void ComposerEngine::setBackground(uint16 id) {
|
||||
for (Common::List<Sprite>::iterator i = _sprites.begin(); i != _sprites.end(); i++) {
|
||||
if (i->_id)
|
||||
continue;
|
||||
i->_surface.free();
|
||||
i->_id = id;
|
||||
initSprite(*i);
|
||||
i->_id = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
Sprite *background = addSprite(id, 0, 0xffff, Common::Point());
|
||||
if (background)
|
||||
background->_id = 0;
|
||||
}
|
||||
|
||||
static void decompressSLWM(byte *buffer, Common::SeekableReadStream *stream) {
|
||||
uint bitsLeft = 0;
|
||||
uint16 lastBits;
|
||||
|
@ -652,10 +652,10 @@ int16 ComposerEngine::scriptFuncCall(uint16 id, int16 param1, int16 param2, int1
|
||||
_vars[param2] = _lastMousePos.y;
|
||||
return 0;
|
||||
case kFuncChangeBackground:
|
||||
// TODO
|
||||
warning("ignoring kFuncChangeBackground(%d)", param1);
|
||||
debug(3, "kFuncChangeBackground(%d)", param1);
|
||||
// TODO: return 1 if background existed, else 0
|
||||
return 0;
|
||||
setBackground(param1);
|
||||
return 1;
|
||||
case kFuncSetBackgroundColor:
|
||||
// TODO
|
||||
warning("ignoring kFuncSetBackgroundColor(%d)", param1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user