diff options
-rw-r--r-- | scumm/actor.cpp | 9 | ||||
-rw-r--r-- | scumm/actor.h | 3 | ||||
-rw-r--r-- | scumm/akos.cpp | 44 | ||||
-rw-r--r-- | scumm/base-costume.cpp | 4 | ||||
-rw-r--r-- | scumm/base-costume.h | 2 | ||||
-rw-r--r-- | scumm/intern.h | 1 | ||||
-rw-r--r-- | scumm/resource.cpp | 3 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v6he.cpp | 6 | ||||
-rw-r--r-- | scumm/script_v72he.cpp | 22 | ||||
-rw-r--r-- | scumm/sound.cpp | 8 |
11 files changed, 72 insertions, 34 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 8c71367512..941f75691d 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -57,7 +57,7 @@ Actor::Actor() { walkbox = 0; animProgress = 0; skipLimb = false; - actorDrawVirScr = false; + drawToBackBuf = false; memset(animVariable, 0, sizeof(animVariable)); memset(palette, 0, sizeof(palette)); memset(sound, 0, sizeof(sound)); @@ -129,6 +129,7 @@ void Actor::initActor(int mode) { talkStopFrame = 5; } + talking = false; walkScript = 0; talkScript = 0; @@ -1062,7 +1063,7 @@ void Actor::drawActorCostume() { // If the actor is partially hidden, redraw it next frame. // Only done for pre-AKOS, though. - if (bcr->drawCostume(_vm->virtscr[0], cost, actorDrawVirScr) & 1) { + if (bcr->drawCostume(_vm->virtscr[0], cost, drawToBackBuf) & 1) { needRedraw = (_vm->_version <= 6); } @@ -1224,6 +1225,7 @@ void ScummEngine::actorTalk(const byte *msg) { if ((_version <= 7 && !_keepText) || (_version == 8 && VAR(VAR_HAVE_MSG))) stopTalk(); setTalkingActor(a->number); + a->talking = true; if (!_string[0].no_talk_anim) { a->runActorTalkScript(a->talkStartFrame); _useTalkAnims = true; @@ -1287,6 +1289,7 @@ void ScummEngine::stopTalk() { } if (_version <= 7 && !(_features & GF_HUMONGOUS)) setTalkingActor(0xFF); + a->talking = false; } if (_version == 8 || _features & GF_HUMONGOUS) setTalkingActor(0); @@ -1828,7 +1831,7 @@ const SaveLoadEntry *Actor::getSaveLoadEntries() { MKLINE(Actor, speedy, sleUint16, VER(8)), MKLINE(Actor, cost.animCounter, sleUint16, VER(8)), MKLINE(Actor, cost.soundCounter, sleByte, VER(8)), - MKLINE(Actor, actorDrawVirScr, sleByte, VER(32)), + MKLINE(Actor, drawToBackBuf, sleByte, VER(32)), MKLINE(Actor, flip, sleByte, VER(32)), MKLINE(Actor, skipLimb, sleByte, VER(32)), diff --git a/scumm/actor.h b/scumm/actor.h index a4fc5b799c..40c4f5cd6b 100644 --- a/scumm/actor.h +++ b/scumm/actor.h @@ -109,7 +109,8 @@ public: uint16 talkScript, walkScript; bool ignoreTurns; bool skipLimb; - bool actorDrawVirScr; + bool drawToBackBuf; + bool talking; int8 layer; uint16 sound[8]; CostumeData cost; diff --git a/scumm/akos.cpp b/scumm/akos.cpp index aa84edf455..0b69d71eac 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -59,7 +59,7 @@ enum AkosOpcodes { AKC_SetVar = 0xC010, AKC_CmdQue3 = 0xC015, AKC_ComplexChan = 0xC020, - AKC_Unk3 = 0xC021, + AKC_C021 = 0xC021, AKC_ComplexChan2 = 0xC025, AKC_Jump = 0xC030, AKC_JumpIfSet = 0xC031, @@ -88,7 +88,7 @@ enum AkosOpcodes { AKC_Cmd3 = 0xC08B, AKC_Ignore3 = 0xC08C, AKC_Ignore2 = 0xC08D, - AKC_Unk1 = 0xC08E, + AKC_C08E = 0xC08E, AKC_SkipStart = 0xC090, AKC_SkipE = 0xC090, AKC_SkipNE = 0xC091, @@ -97,7 +97,10 @@ enum AkosOpcodes { AKC_SkipG = 0xC094, AKC_SkipGE = 0xC095, AKC_ClearFlag = 0xC09F, - AKC_Unk4 = 0xC0A1, + AKC_C0A0 = 0xC0A0, + AKC_C0A1 = 0xC0A1, + AKC_C0A2 = 0xC0A2, + AKC_C0A3 = 0xC0A3, AKC_EndSeq = 0xC0FF }; @@ -1137,6 +1140,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const case AKC_StartAnim: case AKC_StartVarAnim: case AKC_CmdQue3: + case AKC_C0A3: curpos += 3; break; case AKC_SoundStuff: @@ -1170,7 +1174,9 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const case AKC_Flip: case AKC_Jump: case AKC_StartAnimInActor: - case AKC_Unk4: + case AKC_C0A0: + case AKC_C0A1: + case AKC_C0A2: curpos += 4; break; case AKC_ComplexChan2: @@ -1184,7 +1190,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const curpos += (aksq[curpos] & 0x80) ? 2 : 1; } break; - case AKC_Unk3: + case AKC_C021: curpos += aksq[curpos + 2]; break; default: @@ -1309,9 +1315,9 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const case AKC_Return: case AKC_EndSeq: case AKC_ComplexChan: - case AKC_Unk1: + case AKC_C08E: case AKC_ComplexChan2: - case AKC_Unk3: + case AKC_C021: break; case AKC_Cmd3: @@ -1329,10 +1335,24 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const if (akos_compare(a->getAnimVar(GB(4)), GW(2), code - AKC_SkipStart) == 0) flag_value = true; continue; - - case AKC_Unk4: - curpos = GUW(2); - break; + case AKC_C0A0: + //akos_queCommand(8, a, GB(2), 0); + continue; + case AKC_C0A1: + if (a->talking) { + curpos = GUW(2); + break; + } + continue; + case AKC_C0A2: + if (!a->talking) { + curpos = GUW(2); + break; + } + continue; + case AKC_C0A3: + //akos_queCommand(8, a, a->getAnimVar(GB(2), 0); + continue; default: if ((code & 0xC000) == 0xC000) error("Undefined uSweat token %X", code); @@ -1343,7 +1363,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const int code2 = aksq[curpos]; if (code2 & 0x80) code2 = (code2 << 8) | aksq[curpos + 1]; - assert((code2 & 0xC000) != 0xC000 || code2 == AKC_ComplexChan || code2 == AKC_Return || code2 == AKC_EndSeq || code2 == AKC_Unk1 || code2 == AKC_ComplexChan2); + assert((code2 & 0xC000) != 0xC000 || code2 == AKC_ComplexChan || code2 == AKC_Return || code2 == AKC_EndSeq || code2 == AKC_C08E || code2 == AKC_ComplexChan2); a->cost.curpos[chan] = curpos; diff --git a/scumm/base-costume.cpp b/scumm/base-costume.cpp index e0002af197..9ce7bbf286 100644 --- a/scumm/base-costume.cpp +++ b/scumm/base-costume.cpp @@ -25,11 +25,11 @@ namespace Scumm { -byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, const CostumeData &cost, bool drawVirScr) { +byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, const CostumeData &cost, bool drawToBackBuf) { int i; byte result = 0; - if (drawVirScr) + if (drawToBackBuf) _outptr = vs.getBackPixels(0, 0); else _outptr = vs.getPixels(0, 0); diff --git a/scumm/base-costume.h b/scumm/base-costume.h index 0b89f60f05..3545e4c90c 100644 --- a/scumm/base-costume.h +++ b/scumm/base-costume.h @@ -126,7 +126,7 @@ public: virtual void setCostume(int costume) = 0; - byte drawCostume(const VirtScreen &vs, const CostumeData &cost, bool actorDrawVirScr); + byte drawCostume(const VirtScreen &vs, const CostumeData &cost, bool drawToBackBuf); protected: diff --git a/scumm/intern.h b/scumm/intern.h index 9caffbf13c..249e0dc1f8 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -715,6 +715,7 @@ protected: void o72_readFile(); void o72_writeFile(); void o72_findAllObjects(); + void o72_deleteFile(); void o72_getPixel(); void o72_pickVarRandom(); void o72_redimArray(); diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 61b8fe62a7..599a2c6525 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -2240,9 +2240,6 @@ void ScummEngine::resourceStats() { void ScummEngine::readMAXS(int blockSize) { debug(9, "readMAXS: MAXS has blocksize %d", blockSize); - // FIXME: trying to detect multiple targets probably a better way to do this - if (_heversion >= 70 && blockSize > 38 && _heversion < 72) - _heversion = 72; if (_version == 8) { // CMI _fileHandle.seek(50 + 50, SEEK_CUR); // 176 - 8 diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 2041b65ac8..9b5a462087 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -2922,9 +2922,9 @@ void ScummEngine_v6::o6_stampObject() { a->scalex = state; a->scaley = state; a->putActor(x, y, _currentRoom); - a->actorDrawVirScr = true; + a->drawToBackBuf = true; a->drawActorCostume(); - a->actorDrawVirScr = false; + a->drawToBackBuf = false; a->drawActorCostume(); return; } diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 3b036363b5..b0f842c54b 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -693,10 +693,10 @@ void ScummEngine_v6he::o6_actorOps() { { int top_actor = a->top; int bottom_actor = a->bottom; - a->actorDrawVirScr = true; + a->drawToBackBuf = true; a->needRedraw = true; a->drawActorCostume(); - a->actorDrawVirScr = false; + a->drawToBackBuf = false; a->needRedraw = true; a->drawActorCostume(); a->needRedraw = false; @@ -709,7 +709,7 @@ void ScummEngine_v6he::o6_actorOps() { } break; case 219: - a->actorDrawVirScr = false; + a->drawToBackBuf = false; a->needRedraw = true; a->needBgReset = true; break; diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 91ed426497..2a0b075501 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -323,7 +323,7 @@ void ScummEngine_v72he::setupOpcodes() { /* DC */ OPCODE(o72_writeFile), OPCODE(o72_findAllObjects), - OPCODE(o6_deleteFile), + OPCODE(o72_deleteFile), OPCODE(o6_rename), /* E0 */ OPCODE(o6_soundOps), @@ -1070,6 +1070,20 @@ void ScummEngine_v72he::o72_findAllObjects() { push(readVar(0)); } +void ScummEngine_v72he::o72_deleteFile() { + int len, r; + byte filename[100]; + + copyScriptString(filename); + + for (r = strlen((char*)filename); r != 0; r--) { + if (filename[r - 1] == '\\') + break; + } + + debug(1, "stub o72_deleteFile(\"%s\")", filename + r); +} + void ScummEngine_v72he::o72_getPixel() { byte area; int x = pop(); @@ -1118,7 +1132,11 @@ void ScummEngine_v72he::o72_pickVarRandom() { num = readArray(value, 0, 0); ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, num); - var_A = FROM_LE_32(ah->dim1end); + // FIXME + if (!ah) + var_A = 0; + else + var_A = FROM_LE_32(ah->dim1end); if (var_A-1 <= num) { int16 var_2 = readArray(value, 0, num - 1); diff --git a/scumm/sound.cpp b/scumm/sound.cpp index f71866019f..5284db1084 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -180,7 +180,7 @@ void Sound::playSound(int soundID, int offset) { musicFile.seek(+40, SEEK_CUR); if (musicFile.readUint32LE() == MKID('SGEN')) { - // TODO Work out skpi calcution + // TODO Work out skip calcution //skip = (soundID - 8001) * 21; musicFile.seek(+skip, SEEK_CUR); @@ -191,8 +191,8 @@ void Sound::playSound(int soundID, int offset) { // Rewind musicFile.seek(-44, SEEK_CUR); - // Skip header junk - musicFile.seek(+20, SEEK_CUR); + // Skip SGHD header (16) + musicFile.seek(+16, SEEK_CUR); // Skip to correct music header if (soundID >= 8000) @@ -201,8 +201,6 @@ void Sound::playSound(int soundID, int offset) { skip = (soundID - 4001) * 25; musicFile.seek(+skip, SEEK_CUR); - // Skip to offsets - musicFile.seek(+21, SEEK_CUR); } |