diff --git a/scumm/actor.cpp b/scumm/actor.cpp index eb8a66f44e7..8c713675120 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -928,6 +928,9 @@ static int compareDrawOrder(const void* a, const void* b) } void ScummEngine::processActors() { + if (_skipProcessActors) + return; + int numactors = 0; // TODO : put this actors as a member array. It never has to grow or shrink diff --git a/scumm/intern.h b/scumm/intern.h index 2f42b8300a4..9caffbf13cb 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -623,6 +623,7 @@ protected: void o7_getActorRoom(); void o7_resourceRoutines(); void o7_quitPauseRestart(); + void o7_kernelSetFunctions(); void o7_unknownED(); void o7_stringLen(); void o7_unknownEF(); @@ -690,7 +691,6 @@ protected: void o72_wordArrayIndexedWrite(); void o72_compareStackList(); void o72_unknown1C(); - void o72_unknown26(); void o72_unknown50(); void o72_wordArrayInc(); void o72_objectX(); @@ -704,6 +704,7 @@ protected: void o72_unknown62(); void o72_getArrayDimSize(); void o72_getNumFreeArrays(); + void o72_pickupObject(); void o72_arrayOps(); void o72_dimArray(); void o72_dim2dimArray(); diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 4a9b0382d35..3b036363b5a 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -778,16 +778,6 @@ void ScummEngine_v6he::o6_kernelSetFunctions() { case 5: //Used before mini games in 3DO versions, seems safe to ignore. break; - case 21: - _skipDrawObject = 1; - break; - case 22: - _skipDrawObject = 0; - break; - case 23: - _charset->clearCharsetMask(); - _fullRedraw = 1; - break; default: warning("o6_kernelSetFunctions: default case %d (param count %d)", args[0], num); break; diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index f332eda2dfc..92c6c06c348 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -93,7 +93,7 @@ void ScummEngine_v72he::setupOpcodes() { /* 24 */ OPCODE(o6_invalid), OPCODE(o6_invalid), - OPCODE(o72_unknown26), + OPCODE(o6_invalid), OPCODE(o6_invalid), /* 28 */ OPCODE(o6_invalid), @@ -211,7 +211,7 @@ void ScummEngine_v72he::setupOpcodes() { OPCODE(o6_animateActor), OPCODE(o6_doSentence), /* 84 */ - OPCODE(o7_pickupObject), + OPCODE(o72_pickupObject), OPCODE(o6_loadRoomWithEgo), OPCODE(o6_invalid), OPCODE(o6_getRandomNumber), @@ -297,7 +297,7 @@ void ScummEngine_v72he::setupOpcodes() { OPCODE(o6_distPtPt), /* C8 */ OPCODE(o6_kernelGetFunctions), - OPCODE(o6_kernelSetFunctions), + OPCODE(o7_kernelSetFunctions), OPCODE(o6_delayFrames), OPCODE(o6_pickOneOf), /* CC */ @@ -563,8 +563,11 @@ void ScummEngine_v72he::o72_compareStackList() { } void ScummEngine_v72he::o72_unknown1C() { - // For Pajame Sam 2 - // Maybe HE 7.3? + // HE 90+ specific + if (_heversion < 90) + error("Invalid opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer); + + // For Pajame Sam 2 demo // Incomplete int value = fetchScriptByte(); value -= 46; @@ -580,55 +583,6 @@ void ScummEngine_v72he::o72_unknown1C() { warning("o72_unknown1C stub (%d)", value); } -void ScummEngine_v72he::o72_unknown26() { - // Maybe HE 7.3? - // Incomplete - int args[16]; - int subOp = fetchScriptByte(); - switch (subOp) { - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 43: - case 52: - case 63: - case 68: - case 82: - case 92: - case 97: - case 98: - case 124: - pop(); - break; - case 42: - case 198: - pop(); - pop(); - break; - case 45: - pop(); - pop(); - pop(); - break; - case 125: - getStackList(args, ARRAYSIZE(args)); - pop(); - break; - default: - error("o72_unknown26: Unknown case %d", subOp); - } - push(0); - - warning("o72_unknown26 stub (%d)", subOp); -} - void ScummEngine_v72he::o72_wordArrayWrite() { int a = pop(); writeArray(fetchScriptWord(), 0, pop(), a); @@ -815,6 +769,19 @@ void ScummEngine_v72he::o72_getNumFreeArrays() { push (num); } +void ScummEngine_v72he::o72_pickupObject() { + int obj, room; + + room = pop(); + obj = pop(); + if (room == 0) + room = getObjectRoom(obj); + + addObjectToInventory(obj, room); + putOwner(obj, VAR(VAR_EGO)); + runInventoryScript(obj); +} + void ScummEngine_v72he::o72_arrayOps() { byte subOp = fetchScriptByte(); int array = 0; diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index 039a7ac07bd..e904f308371 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -297,7 +297,7 @@ void ScummEngine_v7he::setupOpcodes() { OPCODE(o6_distPtPt), /* C8 */ OPCODE(o6_kernelGetFunctions), - OPCODE(o6_kernelSetFunctions), + OPCODE(o7_kernelSetFunctions), OPCODE(o6_delayFrames), OPCODE(o6_pickOneOf), /* CC */ @@ -538,7 +538,6 @@ void ScummEngine_v7he::o7_pickupObject() { runInventoryScript(obj); /* Difference */ } - void ScummEngine_v7he::o7_getActorRoom() { int act = pop(); @@ -720,6 +719,45 @@ void ScummEngine_v7he::o7_unknownED() { warning("stub o7_unknownED (%d, %d, %d)", c, b, a); } +void ScummEngine_v7he::o7_kernelSetFunctions() { + int args[29]; + int num; + + num = getStackList(args, ARRAYSIZE(args)); + + switch (args[0]) { + case 1: + // Used to restore images when decorating cake in + // Fatty Bear's Birthday Surprise + virtScreenLoad(args[1], args[2], args[3], args[4], args[5]); + break; + case 20: + // Clear/stop unknown animation queue + break; + case 21: + _skipDrawObject = 1; + break; + case 22: + _skipDrawObject = 0; + break; + case 23: + _charset->clearCharsetMask(); + _fullRedraw = 1; + break; + case 24: + _skipProcessActors = 1; + _fullRedraw = 1; + break; + case 25: + _skipProcessActors = 0; + _fullRedraw = 1; + break; + default: + error("o6_kernelSetFunctions: default case %d (param count %d)", args[0], num); + break; + } +} + void ScummEngine_v7he::o7_stringLen() { int id, len; byte *addr; diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index db4cd307c9a..c6ddc9179ce 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -654,6 +654,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _V1_talkingActor = 0; _skipDrawObject = 0; + _skipProcessActors = 0; _heSndSoundId = 0; _heSndOffset = 0; _heSndTimer = 0; diff --git a/scumm/scumm.h b/scumm/scumm.h index ec25ace1d4a..ca9523e7971 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -1044,7 +1044,7 @@ public: byte _roomPalette[256]; byte *_shadowPalette; int _heSndSoundFreq, _heSndOffset, _heSndTimer, _heSndSoundId, _heSndLoop; - bool _skipDrawObject; + bool _skipDrawObject, _skipProcessActors; int _timers[4]; protected: