COMPOSER: Don't die on missing/bad anims.
This commit is contained in:
parent
70ae2c74e0
commit
9e127a1032
1 changed files with 13 additions and 4 deletions
|
@ -296,6 +296,10 @@ void ComposerEngine::playAnimation(uint16 animId, int16 x, int16 y, int16 eventP
|
||||||
|
|
||||||
// If we didn't find it, try the libraries.
|
// If we didn't find it, try the libraries.
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
|
if (!hasResource(ID_ANIM, animId)) {
|
||||||
|
warning("ignoring attempt to play invalid anim %d", animId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
stream = getResource(ID_ANIM, animId);
|
stream = getResource(ID_ANIM, animId);
|
||||||
|
|
||||||
uint32 type = 0;
|
uint32 type = 0;
|
||||||
|
@ -350,6 +354,12 @@ void ComposerEngine::processAnimFrame() {
|
||||||
for (Common::List<Animation *>::iterator i = _anims.begin(); i != _anims.end(); i++) {
|
for (Common::List<Animation *>::iterator i = _anims.begin(); i != _anims.end(); i++) {
|
||||||
Animation *anim = *i;
|
Animation *anim = *i;
|
||||||
|
|
||||||
|
anim->seekToCurrPos();
|
||||||
|
if (anim->_stream->pos() == anim->_stream->size()) {
|
||||||
|
warning("anim with id %d ended too soon", anim->_id);
|
||||||
|
anim->_state = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (anim->_state <= 1) {
|
if (anim->_state <= 1) {
|
||||||
if (anim->_state == 1) {
|
if (anim->_state == 1) {
|
||||||
runEvent(2, anim->_id, anim->_eventParam, 0);
|
runEvent(2, anim->_id, anim->_eventParam, 0);
|
||||||
|
@ -363,8 +373,6 @@ void ComposerEngine::processAnimFrame() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
anim->seekToCurrPos();
|
|
||||||
|
|
||||||
for (uint j = 0; j < anim->_entries.size(); j++) {
|
for (uint j = 0; j < anim->_entries.size(); j++) {
|
||||||
AnimationEntry &entry = anim->_entries[j];
|
AnimationEntry &entry = anim->_entries[j];
|
||||||
if (entry.op != 1)
|
if (entry.op != 1)
|
||||||
|
@ -679,8 +687,9 @@ void ComposerEngine::loadLibrary(uint id) {
|
||||||
Common::hexdump(buf, stream->size());
|
Common::hexdump(buf, stream->size());
|
||||||
delete stream;*/
|
delete stream;*/
|
||||||
|
|
||||||
// TODO: set background properly
|
// add background sprite, if it exists
|
||||||
addSprite(1000, 0, 0, Common::Point());
|
if (hasResource(ID_BMAP, 1000))
|
||||||
|
addSprite(1000, 0, -1, Common::Point());
|
||||||
|
|
||||||
// TODO: better CTBL logic
|
// TODO: better CTBL logic
|
||||||
loadCTBL(1000, 100);
|
loadCTBL(1000, 100);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue