diff options
author | David Eriksson | 2003-10-18 11:46:52 +0000 |
---|---|---|
committer | David Eriksson | 2003-10-18 11:46:52 +0000 |
commit | de37ee0c3e064b61b26207b9da3175a477399013 (patch) | |
tree | 71f4b5842da2a85d95723ea2fe558597f490c526 | |
parent | 65883950d84a1fab5320169b3b765be2d814afbb (diff) | |
download | scummvm-rg350-de37ee0c3e064b61b26207b9da3175a477399013.tar.gz scummvm-rg350-de37ee0c3e064b61b26207b9da3175a477399013.tar.bz2 scummvm-rg350-de37ee0c3e064b61b26207b9da3175a477399013.zip |
- Fix some cutaway crashes
- Implement more cutaway animation
svn-id: r10890
-rw-r--r-- | queen/cutaway.cpp | 60 | ||||
-rw-r--r-- | queen/cutaway.h | 24 | ||||
-rw-r--r-- | queen/defs.h | 2 | ||||
-rw-r--r-- | queen/xref.txt | 1 |
4 files changed, 74 insertions, 13 deletions
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp index bdda6db41e..3929c6ab5b 100644 --- a/queen/cutaway.cpp +++ b/queen/cutaway.cpp @@ -538,7 +538,7 @@ byte *Cutaway::getCutawayAnim(byte *ptr, int header, CutawayAnim &anim) { else { if (anim.bank != 13) { /* XXX if (OLDBANK != T) */ { - _graphics->bankLoad(_bankNames[anim.bank], 8); + _graphics->bankLoad(_bankNames[anim.bank-1], 8); // XXX OLDBANK=T; } @@ -678,6 +678,64 @@ byte *Cutaway::handleAnimation(byte *ptr, CutawayObject &object) { if (object.animType != 1) { // lines 1657-1761 in cutaway.c + for (i = 0; i < frameCount; i++) { + BobSlot *bob = _graphics->bob(objAnim[i].object); + bob->active = true; + if (bob->animating) { + bob->animating = false; + bob->frameNum = objAnim[i].originalFrame; + } + + if (objAnim[i].object < 4) + bob->frameNum = 29 + bob->frameNum + FRAMES_JOE_XTRA; + + if (objAnim[i].unpackFrame == 0) { + // Turn off the bob + bob->active = false; + } + else { + if (object.animType == 2 || object.animType == 0) { + // Unpack animation, but do not unpack moving people + + if (!(objAnim[0].mx || objAnim[0].my) && InRange(objAnim[i].object, 0, 3)) + _graphics->bankUnpack( + objAnim[i].unpackFrame, + objAnim[i].originalFrame, + objAnim[i].bank); + } + + if (objAnim[i].cx || objAnim[i].cy) { + bob->x = objAnim[i].cx; + bob->y = objAnim[i].cy; + } + + // Only flip if we are not moving and it is not a person object + if (!(objAnim[i].mx || objAnim[i].my) && + !(objAnim[i].object > 0 && objAnim[i].object < 4)) + bob->xflip = objAnim[i].flip; + + // Add frame alteration + bob->frameNum = objAnim[i].originalFrame; + + int j; + for (j = 0; j < objAnim[i].speed; j++) + _graphics->update(); + } + + if (_quit) + return NULL; + + if (objAnim[i].song > 0) + /* XXX playsong(objAnim[i].song) */ ; + + // Load but don't play + if(objAnim[i].song < 0) { + // XXX loadnoplay=1; + // XXX playsong(abs(OBJ_ANIM[J][11])); + // XXX loadnoplay=0; + } + + } // for() } bool moving = true; diff --git a/queen/cutaway.h b/queen/cutaway.h index 4e6c7ccd9f..3782736be4 100644 --- a/queen/cutaway.h +++ b/queen/cutaway.h @@ -105,18 +105,18 @@ class Cutaway { }; struct CutawayAnim { - int object; - int unpackFrame; // Frame to unpack - int speed; - int bank; - int mx; - int my; - int cx; - int cy; - int scale; - int currentFrame; // Index to Current Frame - int originalFrame; // Index to Original Object Frame - int song; + int16 object; + int16 unpackFrame; // Frame to unpack + int16 speed; + int16 bank; + int16 mx; + int16 my; + int16 cx; + int16 cy; + int16 scale; + int16 currentFrame; // Index to Current Frame + int16 originalFrame; // Index to Original Object Frame + int16 song; bool flip; // set this if unpackFrame is negative }; diff --git a/queen/defs.h b/queen/defs.h index 51524baa7b..c8f4667192 100644 --- a/queen/defs.h +++ b/queen/defs.h @@ -24,6 +24,8 @@ namespace Queen { +// Maybe should be an inlined function somwhere else, feel free to change +#define InRange(x,l,h) ((x)<=(h) && (x)>=(l)) /* X in [l..h] */ enum { GAME_SCREEN_WIDTH = 320, diff --git a/queen/xref.txt b/queen/xref.txt index d2e488757b..c2d961a591 100644 --- a/queen/xref.txt +++ b/queen/xref.txt @@ -360,6 +360,7 @@ zones Logic::_zones (UNSORTED) ========== +in() defs.h InRange() macro game_save() game_load() R_MAP() |