diff options
author | Max Horn | 2003-01-06 16:04:01 +0000 |
---|---|---|
committer | Max Horn | 2003-01-06 16:04:01 +0000 |
commit | 9270a0558b8b3cac00d998053450da270a46823d (patch) | |
tree | 34ec16097187bb0cd3a90beb0f7dc53674c6a2f0 | |
parent | 37a64f5d12e0343347cffa57b7e1bbd00ec60db0 (diff) | |
download | scummvm-rg350-9270a0558b8b3cac00d998053450da270a46823d.tar.gz scummvm-rg350-9270a0558b8b3cac00d998053450da270a46823d.tar.bz2 scummvm-rg350-9270a0558b8b3cac00d998053450da270a46823d.zip |
some chore/limb related code
svn-id: r6348
-rw-r--r-- | scumm/actor.cpp | 37 | ||||
-rw-r--r-- | scumm/actor.h | 3 | ||||
-rw-r--r-- | scumm/akos.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 39 |
4 files changed, 53 insertions, 28 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 9599ad32d0..542cdd440e 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -1067,6 +1067,43 @@ void Actor::animateCostume() } } +void Actor::animateLimb(int limb, int f) +{ + // This methods is very similiar to animateCostume(). + // However, instead of animating *all* the limbs, it only animates + // the specified limb to be at the frame specified by "f". + + if (!f) + return; + + animProgress++; + if (animProgress >= animSpeed) { + animProgress = 0; + + if (costume == 0) + return; + + byte *aksq, *akfo; + uint size; + byte *akos = _vm->getResourceAddress(rtCostume, costume); + assert(akos); + + aksq = _vm->findResourceData(MKID('AKSQ'), akos); + akfo = _vm->findResourceData(MKID('AKFO'), akos); + + size = _vm->getResourceDataSize(akfo) >> 1; + + while (f--) { + if (cost.active[limb] != 0) + _vm->akos_increaseAnim(this, limb, aksq, (uint16 *)akfo, size); + } + +// needRedraw = true; +// needBgReset = true; + } +} + + void Scumm::setActorRedrawFlags(bool fg, bool bg) { int i, j; diff --git a/scumm/actor.h b/scumm/actor.h index c32bf8e0a4..684ba86d9a 100644 --- a/scumm/actor.h +++ b/scumm/actor.h @@ -139,6 +139,9 @@ public: void drawActorCostume(); void animateCostume(); void setActorCostume(int c); + + void animateLimb(int limb, int f); + byte *getActorName(); void startWalkActor(int x, int y, int dir); void stopActorMoving(); diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 76ebab7881..9a0bcc6944 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -1339,7 +1339,7 @@ bool Scumm::akos_increaseAnims(byte *akos, Actor *a) size = getResourceDataSize(akfo) >> 1; result = false; - for (i = 0; i != 0x10; i++) { + for (i = 0; i < 16; i++) { if (a->cost.active[i] != 0) result |= akos_increaseAnim(a, i, aksq, (uint16 *)akfo, size); } diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 18b46214a7..8f426e4834 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1362,28 +1362,18 @@ void Scumm_v8::o8_kernelSetFunctions() // warning("o8_kernelSetFunctions: setBannerColors(%d, %d, %d, %d)", args[1], args[2], args[3], args[4]); break; case 23: // setActorChoreLimbFrame - { // FIXME: This is critical, and is the cause of the Cannon "too many scripts" crash // This opcode is used a lot in script 28. + // The problem here is that args[4] is always 0, as it is computed from + // lipSyncWidth and lipSyncHeight, which we currently don't support. As a result, + // actors will currently not move their mouth at all! warning("o8_kernelSetFunctions: setActorChoreLimbFrame(%d, %d, %d, %d)", args[1], args[2], args[3], args[4]); a = derefActorSafe(args[1], "o8_kernelSetFunctions:setActorChoreLimbFrame"); assert(a); -/* - // The naming of this opcode would suggest this labeling of variables: - int chore = args[2]; // mostly the return value of actorTalkAnimation() - int limb = args[3]; // mostly 0 and 1, but also 2, 3 - int frame = args[4]; // some number usually derived from lipSyncWidth and lipSyncHeight - - // However, I am not fully sure that is correct (names can deceive, or can simply be wrong). - // And even if it is, the question is how to use it... + + a->startAnimActor(args[2]); + a->animateLimb(args[3], args[4]); - // Note that akos_decodeData takes as parameter a "chore" = frame and bitmask - // specifiying a set of limbs. That would lead to code like this: - a->frame = chore; - akos_decodeData(a, frame, 0x8000 >> limb); - // But that seems to be quite bogus :-) Anyway, this is just random guessing, and - // it would be much better if somebody would disassmble the code in question. -*/ } break; case 24: // clearTextQueue warning("o8_kernelSetFunctions: clearTextQueue()"); @@ -1478,16 +1468,14 @@ void Scumm_v8::o8_kernelGetFunctions() break; case 0xDA: // lipSyncWidth case 0xDB: // lipSyncHeight - // TODO - these methods are probably for lip syncing? - push(0); + // TODO - get lip sync data for the currently active voice + push(255); break; case 0xDC: // actorTalkAnimation - // TODO - this method is used mostly to compute a parameter for setActorChoreLimbFrame - // (to be precise, the second parameter, i.e. args[1]) { Actor *a = derefActorSafe(args[1], "actorTalkAnimation"); assert(a); - push(0); + push(a->talkFrame1); } break; case 0xDD: // getMasterSFXVol @@ -1512,8 +1500,9 @@ void Scumm_v8::o8_kernelGetFunctions() push(0); } break; - case 0XE2: // musicLipSyncWidth + case 0xE2: // musicLipSyncWidth case 0xE3: // musicLipSyncHeight + // TODO - get lip sync data for the currently active music // FIXME: These are needed for the song intro to Part III - the scene will freeze // without them. warning("o8_kernelGetFunctions: default case 0x%x (len = %d)", args[0], len); @@ -1531,11 +1520,7 @@ void Scumm_v8::o8_getActorChore() Actor *a = derefActorSafe(actnum, "o8_getActorChore"); assert(a); - // FIXME: hack to avoid the "Too many scripts running" in the canon scene - push(11); - // Maybe this would be the correct code here? What scumm calls a "chore" corresponds - // to our actor "frame", I think. -// push(a->frame); + push(a->frame); } void Scumm_v8::o8_getObjectImageX() |