mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-03 23:31:57 +00:00
fix for bug #928549.
Animations on objects/persons setup by cutaways can still be played after the end of the cutscene. (the only ?) one room in which this is reproducable is the first time you talk to the Oracle (first c44, then c47). As a Cutaway object is created for each cutscene, the _cutAnim member should be moved to an more "persistant" object. Otherwise we're reading data from free'd memory... svn-id: r13488
This commit is contained in:
parent
36d667b2b5
commit
4fef6d8972
@ -1229,23 +1229,20 @@ void Cutaway::talk(char *nextFilename) {
|
|||||||
int Cutaway::makeComplexAnimation(int16 currentImage, Cutaway::CutawayAnim *objAnim, int frameCount) {
|
int Cutaway::makeComplexAnimation(int16 currentImage, Cutaway::CutawayAnim *objAnim, int frameCount) {
|
||||||
int frameIndex[256];
|
int frameIndex[256];
|
||||||
int i;
|
int i;
|
||||||
int bobNum = objAnim[0].object;
|
assert(frameCount < 30);
|
||||||
assert(bobNum < 21);
|
AnimFrame cutAnim[30];
|
||||||
|
|
||||||
memset(frameIndex, 0, sizeof(frameIndex));
|
memset(frameIndex, 0, sizeof(frameIndex));
|
||||||
debug(6, "[Cutaway::makeComplexAnimation] currentImage = %i", currentImage);
|
debug(6, "[Cutaway::makeComplexAnimation] currentImage = %i", currentImage);
|
||||||
|
|
||||||
BobSlot *bob = _vm->graphics()->bob(bobNum);
|
|
||||||
bob->xflip = objAnim[0].flip;
|
|
||||||
|
|
||||||
for (i = 0; i < frameCount; i++) {
|
for (i = 0; i < frameCount; i++) {
|
||||||
_cutAnim[bobNum][i].frame = objAnim[i].unpackFrame;
|
cutAnim[i].frame = objAnim[i].unpackFrame;
|
||||||
_cutAnim[bobNum][i].speed = objAnim[i].speed;
|
cutAnim[i].speed = objAnim[i].speed;
|
||||||
frameIndex[objAnim[i].unpackFrame] = 1;
|
frameIndex[objAnim[i].unpackFrame] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_cutAnim[bobNum][frameCount].frame = 0;
|
cutAnim[frameCount].frame = 0;
|
||||||
_cutAnim[bobNum][frameCount].speed = 0;
|
cutAnim[frameCount].speed = 0;
|
||||||
|
|
||||||
int nextFrameIndex = 1;
|
int nextFrameIndex = 1;
|
||||||
|
|
||||||
@ -1254,20 +1251,17 @@ int Cutaway::makeComplexAnimation(int16 currentImage, Cutaway::CutawayAnim *objA
|
|||||||
frameIndex[i] = nextFrameIndex++;
|
frameIndex[i] = nextFrameIndex++;
|
||||||
|
|
||||||
for (i = 0; i < frameCount; i++) {
|
for (i = 0; i < frameCount; i++) {
|
||||||
_cutAnim[bobNum][i].frame = currentImage + frameIndex[objAnim[i].unpackFrame];
|
cutAnim[i].frame = currentImage + frameIndex[objAnim[i].unpackFrame];
|
||||||
//debug(6, "_cutAnim[%i][%i].frame = %i", bobNum, i, _cutAnim[bobNum][i].frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < 256; i++) {
|
for (i = 1; i < 256; i++) {
|
||||||
if (frameIndex[i]) {
|
if (frameIndex[i]) {
|
||||||
currentImage++;
|
currentImage++;
|
||||||
//debug(6, "bankUnpack(%i, %i, %i)", i, currentImage, objAnim[0].bank);
|
|
||||||
_vm->bankMan()->unpack(i, currentImage, objAnim[0].bank);
|
_vm->bankMan()->unpack(i, currentImage, objAnim[0].bank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bob->animString(_cutAnim[bobNum]);
|
_vm->graphics()->setBobCutawayAnim(objAnim[0].object, objAnim[0].flip, cutAnim, frameCount + 1);
|
||||||
|
|
||||||
return currentImage;
|
return currentImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,8 +194,6 @@ class Cutaway {
|
|||||||
|
|
||||||
int16 _currentImage;
|
int16 _currentImage;
|
||||||
|
|
||||||
AnimFrame _cutAnim[21][30];
|
|
||||||
|
|
||||||
Cutaway(const char *filename,
|
Cutaway(const char *filename,
|
||||||
QueenEngine *vm);
|
QueenEngine *vm);
|
||||||
~Cutaway();
|
~Cutaway();
|
||||||
|
@ -600,6 +600,13 @@ void Graphics::setupNewRoom(const char *room, uint16 roomNum, int16 *furniture,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Graphics::setBobCutawayAnim(uint16 bobNum, bool xflip, const AnimFrame *af, uint8 frameCount) {
|
||||||
|
assert(bobNum < 21 && frameCount < 30);
|
||||||
|
memcpy(_cutAnim[bobNum], af, sizeof(AnimFrame) * frameCount);
|
||||||
|
_bobs[bobNum].xflip = xflip;
|
||||||
|
_bobs[bobNum].animString(_cutAnim[bobNum]);
|
||||||
|
}
|
||||||
|
|
||||||
void Graphics::fillAnimBuffer(const char *anim, AnimFrame *af) {
|
void Graphics::fillAnimBuffer(const char *anim, AnimFrame *af) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// anim frame format is "%3hu,%3hu," (frame number, frame speed)
|
// anim frame format is "%3hu,%3hu," (frame number, frame speed)
|
||||||
|
@ -115,6 +115,7 @@ public:
|
|||||||
|
|
||||||
void setupNewRoom(const char *room, uint16 roomNum, int16 *furniture, uint16 furnitureCount);
|
void setupNewRoom(const char *room, uint16 roomNum, int16 *furniture, uint16 furnitureCount);
|
||||||
|
|
||||||
|
void setBobCutawayAnim(uint16 bobNum, bool xflip, const AnimFrame *af, uint8 frameCount);
|
||||||
void fillAnimBuffer(const char *anim, AnimFrame *af);
|
void fillAnimBuffer(const char *anim, AnimFrame *af);
|
||||||
uint16 countAnimFrames(const char *anim);
|
uint16 countAnimFrames(const char *anim);
|
||||||
void setupObjectAnim(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible);
|
void setupObjectAnim(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible);
|
||||||
@ -165,8 +166,12 @@ private:
|
|||||||
//! used to scale a BobFrame
|
//! used to scale a BobFrame
|
||||||
BobFrame _shrinkBuffer;
|
BobFrame _shrinkBuffer;
|
||||||
|
|
||||||
|
//! in-game objects/persons animations
|
||||||
AnimFrame _newAnim[17][30];
|
AnimFrame _newAnim[17][30];
|
||||||
|
|
||||||
|
//! cutaway objects/persons animations
|
||||||
|
AnimFrame _cutAnim[21][30];
|
||||||
|
|
||||||
uint16 _personFrames[4];
|
uint16 _personFrames[4];
|
||||||
|
|
||||||
//! Number of animated furniture in current room
|
//! Number of animated furniture in current room
|
||||||
|
Loading…
x
Reference in New Issue
Block a user