mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-03 08:40:59 +00:00
Logic::anim / BobSlot cleanup
svn-id: r10909
This commit is contained in:
parent
e25bda32ec
commit
769f033b00
@ -143,32 +143,34 @@ void Graphics::bobSetupControl() {
|
||||
|
||||
void Graphics::bobAnimString(uint32 bobnum, const AnimFrame *animBuf) {
|
||||
|
||||
BobSlot *pbs = &_bobs[bobnum];
|
||||
pbs->active = true;
|
||||
pbs->animating = true;
|
||||
pbs->anim.string.buffer = animBuf;
|
||||
pbs->anim.string.curPos = animBuf;
|
||||
pbs->frameNum = animBuf->frame;
|
||||
pbs->anim.speed = animBuf->speed / 4;
|
||||
debug(9, "Graphics::bobAnimString(%d)", bobnum);
|
||||
_bobs[bobnum].animString(animBuf);
|
||||
}
|
||||
|
||||
|
||||
void Graphics::bobAnimNormal(uint32 bobnum, uint16 firstFrame, uint16 lastFrame, uint16 speed, bool rebound, bool xflip) {
|
||||
|
||||
debug(9, "Graphics::bobAnimNormal(%d, %d, %d, %d)", bobnum, firstFrame, lastFrame, speed);
|
||||
_bobs[bobnum].animNormal(firstFrame, lastFrame, speed, rebound, xflip);
|
||||
}
|
||||
|
||||
|
||||
void Graphics::bobAnimReset(uint32 bobnum) {
|
||||
|
||||
BobSlot *pbs = &_bobs[bobnum];
|
||||
pbs->active = true;
|
||||
pbs->animating = true;
|
||||
pbs->frameNum = firstFrame;
|
||||
pbs->anim.speed = speed;
|
||||
pbs->anim.speedBak = speed;
|
||||
pbs->anim.string.buffer = NULL;
|
||||
pbs->anim.normal.firstFrame = firstFrame;
|
||||
pbs->anim.normal.lastFrame = lastFrame;
|
||||
pbs->anim.normal.rebound = rebound;
|
||||
pbs->frameDir = 1;
|
||||
pbs->xflip = xflip;
|
||||
if(pbs->active && pbs->animating) {
|
||||
const AnimFrame *anim = pbs->anim.string.buffer;
|
||||
if (anim != NULL) {
|
||||
pbs->anim.string.curPos = anim;
|
||||
pbs->frameNum = anim->frame;
|
||||
pbs->anim.speed = anim->speed / 4;
|
||||
}
|
||||
else {
|
||||
pbs->anim.speed = pbs->anim.speedBak;
|
||||
pbs->frameNum = pbs->anim.normal.firstFrame;
|
||||
pbs->frameDir = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -296,7 +298,34 @@ void BobSlot::animOneStep() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BobSlot::animString(const AnimFrame *animBuf) {
|
||||
|
||||
active = true;
|
||||
animating = true;
|
||||
anim.string.buffer = animBuf;
|
||||
anim.string.curPos = animBuf;
|
||||
frameNum = animBuf->frame;
|
||||
anim.speed = animBuf->speed / 4;
|
||||
}
|
||||
|
||||
|
||||
void BobSlot::animNormal(uint16 firstFrame, uint16 lastFrame, uint16 spd, bool rebound, bool flip) {
|
||||
|
||||
active = true;
|
||||
animating = true;
|
||||
frameNum = firstFrame;
|
||||
anim.speed = spd;
|
||||
anim.speedBak = spd;
|
||||
anim.string.buffer = NULL;
|
||||
anim.normal.firstFrame = firstFrame;
|
||||
anim.normal.lastFrame = lastFrame;
|
||||
anim.normal.rebound = rebound;
|
||||
frameDir = 1;
|
||||
xflip = flip;
|
||||
}
|
||||
|
||||
|
||||
void Graphics::bobDraw(uint32 bobnum, int16 x, int16 y, uint16 scale, bool xflip, const Box& box) {
|
||||
|
||||
|
@ -90,6 +90,9 @@ struct BobSlot {
|
||||
|
||||
void moveOneStep();
|
||||
void animOneStep();
|
||||
|
||||
void animString(const AnimFrame *animBuf);
|
||||
void animNormal(uint16 firstFrame, uint16 lastFrame, uint16 speed, bool rebound, bool xflip);
|
||||
};
|
||||
|
||||
|
||||
@ -117,6 +120,7 @@ public:
|
||||
void bobSetupControl();
|
||||
void bobAnimString(uint32 bobnum, const AnimFrame *buf); // stringanim()
|
||||
void bobAnimNormal(uint32 bobnum, uint16 firstFrame, uint16 lastFrame, uint16 speed, bool rebound, bool xflip); // makeanim()
|
||||
void bobAnimReset(uint32 bobnum);
|
||||
void bobMove(uint32 bobnum, int16 endx, int16 endy, int16 speed); // movebob()
|
||||
void bobDraw(uint32 bobnum, int16 x, int16 y, uint16 scale, bool xflip, const Box& box); // bob()
|
||||
void bobDrawInventoryItem(uint32 bobnum, uint16 x, uint16 y); // invbob()
|
||||
|
@ -900,7 +900,9 @@ void Logic::roomSetupObjects() {
|
||||
if (pgd->firstFrame < 0) {
|
||||
// FIXME: if(TEMPA[1]<0) bobs[CURRBOB].xflip=1;
|
||||
curBob = 5 + _numFurnitureAnimated;
|
||||
AnimFrame *paf = NULL;
|
||||
animSetup(pgd, curImage + 1, curBob + numObjectAnimated, pod->name > 0);
|
||||
curImage += pgd->lastFrame;
|
||||
/* AnimFrame *paf = NULL;
|
||||
if (pod->name > 0) {
|
||||
paf = _newAnim[curBob + numObjectAnimated];
|
||||
}
|
||||
@ -918,7 +920,7 @@ void Logic::roomSetupObjects() {
|
||||
}
|
||||
else {
|
||||
pbs->animating = false;
|
||||
}
|
||||
}*/
|
||||
++numObjectAnimated;
|
||||
}
|
||||
else if (lastFrame != 0) {
|
||||
@ -1062,7 +1064,9 @@ uint16 Logic::roomRefreshObject(uint16 obj) {
|
||||
rebound = true;
|
||||
}
|
||||
if (pgd->firstFrame < 0) {
|
||||
AnimFrame *paf = NULL;
|
||||
animSetup(pgd, curImage, curBob, pod->name != 0);
|
||||
curImage += pgd->lastFrame - 1;
|
||||
/* AnimFrame *paf = NULL;
|
||||
if (pod->name != 0) {
|
||||
paf = _newAnim[curBob];
|
||||
}
|
||||
@ -1079,7 +1083,7 @@ uint16 Logic::roomRefreshObject(uint16 obj) {
|
||||
}
|
||||
else {
|
||||
pbs->animating = false;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else if (lastFrame != 0) {
|
||||
// turn on an animated bob
|
||||
@ -1331,6 +1335,7 @@ uint16 Logic::personAllocate(uint16 noun, uint16 curImage) {
|
||||
++curImage;
|
||||
}
|
||||
}
|
||||
// FIXME: shouldn't this line be executed BEFORE curImage is incremented ?
|
||||
_personFrames[bobNum] = curImage + 1;
|
||||
}
|
||||
}
|
||||
@ -1399,6 +1404,7 @@ uint16 Logic::animCreate(uint16 curImage, const Person *person) {
|
||||
|
||||
|
||||
void Logic::animErase(uint16 bobNum) {
|
||||
|
||||
_newAnim[bobNum][0].frame = 0;
|
||||
BobSlot *pbs = _graphics->bob(bobNum);
|
||||
pbs->animating = false;
|
||||
@ -1406,7 +1412,7 @@ void Logic::animErase(uint16 bobNum) {
|
||||
}
|
||||
|
||||
|
||||
int16 Logic::animFindAll(const GraphicData *gd, uint16 firstImage, AnimFrame *paf) {
|
||||
void Logic::animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible) {
|
||||
|
||||
int16 tempFrames[20];
|
||||
memset(tempFrames, 0, sizeof(tempFrames));
|
||||
@ -1450,7 +1456,15 @@ int16 Logic::animFindAll(const GraphicData *gd, uint16 firstImage, AnimFrame *pa
|
||||
for (i = 0; i < gd->lastFrame; ++i) {
|
||||
_graphics->bankUnpack(ABS(tempFrames[i]), firstImage + i, 15);
|
||||
}
|
||||
if (paf != NULL) {
|
||||
BobSlot *pbs = _graphics->bob(bobNum);
|
||||
pbs->animating = false;
|
||||
if (visible) {
|
||||
pbs->x = gd->x;
|
||||
pbs->y = gd->y;
|
||||
if (tempFrames[0] < 0) {
|
||||
pbs->xflip = true;
|
||||
}
|
||||
AnimFrame *paf = _newAnim[bobNum];
|
||||
for (i = 1; i <= _numGraphicAnim; ++i) {
|
||||
const GraphicAnim *pga = &_graphicAnim[i];
|
||||
if (pga->keyFrame == gd->firstFrame) {
|
||||
@ -1472,8 +1486,8 @@ int16 Logic::animFindAll(const GraphicData *gd, uint16 firstImage, AnimFrame *pa
|
||||
}
|
||||
paf->frame = 0;
|
||||
paf->speed = 0;
|
||||
pbs->animString(_newAnim[bobNum]);
|
||||
}
|
||||
return tempFrames[0];
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
|
||||
uint16 animCreate(uint16 curImage, const Person *person); // CREATE_ANIM
|
||||
void animErase(uint16 bobNum);
|
||||
int16 animFindAll(const GraphicData *gd, uint16 firstImage, AnimFrame *paf); // FIND_GRAPHIC_ANIMS
|
||||
void animSetup(const GraphicData *gd, uint16 firstImage, uint16 bobNum, bool visible); // FIND_GRAPHIC_ANIMS
|
||||
|
||||
StateDirection findStateDirection(uint16 state); // == FIND_STATE(state, "DIR");
|
||||
StateTalk findStateTalk (uint16 state); // == FIND_STATE(state, "TALK");
|
||||
@ -240,7 +240,7 @@ protected:
|
||||
//! Last frame number used for person animation
|
||||
uint16 _personFrames[4];
|
||||
|
||||
//! Describe an string based animation (30 frames maximum, bob number must be < 17)
|
||||
//! Describe a string based animation (30 frames maximum, bob number must be < 17)
|
||||
AnimFrame _newAnim[17][30];
|
||||
|
||||
Resource *_resource;
|
||||
|
Loading…
x
Reference in New Issue
Block a user