diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 8e3526f9f65..9f65bfbf948 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1173,7 +1173,6 @@ int ScummEngine::getActorFromPos(int x, int y) { return 0; } -#ifndef DISABLE_HE int ScummEngine_v70he::getActorFromPos(int x, int y) { int curActor, i; @@ -1190,7 +1189,6 @@ int ScummEngine_v70he::getActorFromPos(int x, int y) { return curActor; } -#endif #pragma mark - diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 604846602ea..7b5e8421d7a 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -148,7 +148,6 @@ void ScummEngine::setCursorFromBuffer(const byte *ptr, int width, int height, in updateCursor(); } -#ifndef DISABLE_HE void ScummEngine_v70he::setCursorFromImg(uint img, uint room, uint imgindex) { _resExtractor->setCursor(img); } @@ -183,7 +182,6 @@ void ScummEngine_v70he::setDefaultCursor() { updateCursor(); } -#endif void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) { int w, h; diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 02d0d23666f..8eb59ea66a8 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -878,10 +878,10 @@ PluginError Engine_SCUMM_create(OSystem *syst, Engine **engine) { case 71: *engine = new ScummEngine_v71he(syst, res); break; +#endif case 70: *engine = new ScummEngine_v70he(syst, res); break; -#endif case 61: *engine = new ScummEngine_v60he(syst, res); break; diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index 1d47de29ed5..3190be2b85a 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -73,6 +73,7 @@ static const PlainGameDescriptor gameDescriptions[] = { { "comi", "The Curse of Monkey Island" }, #endif + { "activity", "Putt-Putt & Fatty Bear's Activity Pack" }, { "brstorm", "Bear Stormin'" }, { "fbear", "Fatty Bear's Birthday Surprise" }, { "fbpack", "Fatty Bear's Fun Pack" }, @@ -81,7 +82,6 @@ static const PlainGameDescriptor gameDescriptions[] = { { "puttputt", "Putt-Putt Joins the Parade" }, #ifndef DISABLE_HE - { "activity", "Putt-Putt & Fatty Bear's Activity Pack" }, { "airport", "Let's Explore the Airport with Buzzy" }, { "arttime", "Blue's Art Time Activities" }, { "balloon", "Putt-Putt and Pep's Balloon-O-Rama" }, @@ -245,6 +245,7 @@ static const GameSettings gameVariantsTable[] = { {"brstorm", 0, 0, GID_FBEAR, 6, 61, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK}, {"fbear", "HE 61", 0, GID_FBEAR, 6, 61, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK}, + {"fbear", "HE 70", 0, GID_FBEAR, 6, 70, MDT_NONE, GF_USE_KEY, Common::kPlatformWindows}, {"puttmoon", "", 0, GID_HEGAME, 6, 61, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK}, @@ -252,10 +253,12 @@ static const GameSettings gameVariantsTable[] = { {"puttputt", "HE 60", 0, GID_HEGAME, 6, 60, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, Common::kPlatformPC}, {"puttputt", "Demo", 0, GID_PUTTDEMO, 6, 60, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK}, -#ifndef DISABLE_HE - // Humongous Entertainment Scumm Version 7.0 - {"fbear", "HE 70", 0, GID_FBEAR, 6, 70, MDT_NONE, GF_USE_KEY, Common::kPlatformWindows}, + // The following are meant to be generic HE game variants and as such do + // not specify a game ID. Make sure that these are last in the table, else + // they'll override more specific entries that follow later on. + {"", "HE 70", 0, GID_HEGAME, 6, 70, MDT_NONE, GF_USE_KEY, UNK}, +#ifndef DISABLE_HE // HE CUP demos {"", "HE CUP", 0, GID_HECUP, 6, 200, MDT_NONE, 0, UNK}, @@ -354,7 +357,6 @@ static const GameSettings gameVariantsTable[] = { // The following are meant to be generic HE game variants and as such do // not specify a game ID. Make sure that these are last in the table, else // they'll override more specific entries that follow later on. - {"", "HE 70", 0, GID_HEGAME, 6, 70, MDT_NONE, GF_USE_KEY, UNK}, {"", "HE 71", 0, GID_HEGAME, 6, 71, MDT_NONE, GF_USE_KEY, UNK}, {"", "HE 72", 0, GID_HEGAME, 6, 72, MDT_NONE, GF_USE_KEY, UNK}, {"", "HE 73", 0, GID_HEGAME, 6, 73, MDT_NONE, GF_USE_KEY, UNK}, diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index 5f474b6c68c..5e79b043579 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -39,8 +39,8 @@ class WriteStream; namespace Scumm { -#ifndef DISABLE_HE class ResExtractor; +#ifndef DISABLE_HE class LogicHE; class MoviePlayer; class Sprite; @@ -109,7 +109,6 @@ protected: void o60_readFilePos(); }; -#ifndef DISABLE_HE class ScummEngine_v70he : public ScummEngine_v60he { friend class ResExtractor; friend class Wiz; @@ -138,8 +137,6 @@ public: ScummEngine_v70he(OSystem *syst, const DetectorResult &dr); ~ScummEngine_v70he(); - Wiz *_wiz; - byte *heFindResourceData(uint32 tag, byte *ptr); byte *heFindResource(uint32 tag, byte *ptr); byte *findWrappedBlock(uint32 tag, byte *ptr, int state, bool flagError); @@ -177,17 +174,12 @@ protected: virtual void setCursorFromImg(uint img, uint room, uint imgindex); virtual void setDefaultCursor(); - virtual void clearDrawQueues(); - - void remapHEPalette(const uint8 *src, uint8 *dst); - /* HE version 70 script opcodes */ void o70_startSound(); void o70_pickupObject(); void o70_getActorRoom(); void o70_resourceRoutines(); void o70_systemOps(); - void o70_kernelSetFunctions(); void o70_copyString(); void o70_getStringWidth(); void o70_getStringLen(); @@ -202,18 +194,33 @@ protected: void o70_createDirectory(); void o70_findBox(); void o70_setSystemMessage(); - void o70_polygonOps(); - void o70_polygonHit(); byte VAR_NUM_SOUND_CHANNELS; byte VAR_WIZ_TCOLOR; }; +#ifndef DISABLE_HE class ScummEngine_v71he : public ScummEngine_v70he { +protected: + typedef void (ScummEngine_v71he::*OpcodeProcv71he)(); + struct OpcodeEntryv71he { + OpcodeProcv71he proc; + const char *desc; + }; + + const OpcodeEntryv71he *_opcodesv71he; + public: ScummEngine_v71he(OSystem *syst, const DetectorResult &dr); + ~ScummEngine_v71he(); + + Wiz *_wiz; protected: + virtual void setupOpcodes(); + virtual void executeOpcode(byte i); + virtual const char *getOpcodeDesc(byte i); + virtual void saveOrLoad(Serializer *s); virtual void redrawBGAreas(); @@ -222,6 +229,13 @@ protected: void preProcessAuxQueue(); void postProcessAuxQueue(); + virtual void clearDrawQueues(); + + /* HE version 70 script opcodes */ + void o71_kernelSetFunctions(); + void o71_polygonOps(); + void o71_polygonHit(); + public: /* Actor AuxQueue stuff (HE) */ AuxBlock _auxBlocks[16]; @@ -231,6 +245,8 @@ public: void queueAuxBlock(Actor *a); void queueAuxEntry(int actorNum, int subIndex); + + void remapHEPalette(const uint8 *src, uint8 *dst); }; class ScummEngine_v72he : public ScummEngine_v71he { diff --git a/engines/scumm/he/palette_he.cpp b/engines/scumm/he/palette_he.cpp index aac7bb5848f..d055b77ee23 100644 --- a/engines/scumm/he/palette_he.cpp +++ b/engines/scumm/he/palette_he.cpp @@ -31,7 +31,7 @@ namespace Scumm { -void ScummEngine_v70he::remapHEPalette(const uint8 *src, uint8 *dst) { +void ScummEngine_v71he::remapHEPalette(const uint8 *src, uint8 *dst) { int r, g, b, sum, bestitem, bestsum; int ar, ag, ab; uint8 *palPtr; diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 9bebd7a47d4..9bec74c62ad 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -1520,6 +1520,7 @@ void ScummEngine_v70he::readGlobalObjects() { #endif } +#ifndef DISABLE_HE void ScummEngine_v99he::readMAXS(int blockSize) { if (blockSize == 52) { debug(0, "ScummEngine_v99he readMAXS: MAXS has blocksize %d", blockSize); @@ -1773,5 +1774,6 @@ void ScummEngine_v80he::createSound(int snd1id, int snd2id) { _sndTmrOffs += sdat2size; } } +#endif } // End of namespace Scumm diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h index d7f4d99754b..5e7a6bb96b4 100644 --- a/engines/scumm/he/resource_he.h +++ b/engines/scumm/he/resource_he.h @@ -23,7 +23,7 @@ * */ -#if !defined(SCUMM_HE_RESOURCE_HE_H) && !defined(DISABLE_HE) +#ifndef SCUMM_HE_RESOURCE_HE_H #define SCUMM_HE_RESOURCE_HE_H namespace Scumm { diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 87be57d56fa..32b83f19baa 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -148,7 +148,7 @@ void ScummEngine_v100he::setupOpcodes() { /* 50 */ OPCODE(o100_paletteOps), OPCODE(o70_pickupObject), - OPCODE(o70_polygonOps), + OPCODE(o71_polygonOps), OPCODE(o6_pop), /* 54 */ OPCODE(o6_printDebug), @@ -267,7 +267,7 @@ void ScummEngine_v100he::setupOpcodes() { OPCODE(o72_findObject), /* B0 */ OPCODE(o72_findObjectWithClassOf), - OPCODE(o70_polygonHit), + OPCODE(o71_polygonHit), OPCODE(o90_getLinesIntersectionPoint), OPCODE(o90_fontUnk), /* B4 */ diff --git a/engines/scumm/he/script_v70he.cpp b/engines/scumm/he/script_v70he.cpp index b2009452b4b..4f3c95f5a6d 100644 --- a/engines/scumm/he/script_v70he.cpp +++ b/engines/scumm/he/script_v70he.cpp @@ -296,7 +296,7 @@ void ScummEngine_v70he::setupOpcodes() { OPCODE(o6_distPtPt), /* C8 */ OPCODE(o60_kernelGetFunctions), - OPCODE(o70_kernelSetFunctions), + OPCODE(o60_kernelSetFunctions), OPCODE(o6_delayFrames), OPCODE(o6_pickOneOf), /* CC */ @@ -358,9 +358,9 @@ void ScummEngine_v70he::setupOpcodes() { OPCODE(o6_invalid), OPCODE(o70_createDirectory), OPCODE(o70_setSystemMessage), - OPCODE(o70_polygonOps), + OPCODE(o6_invalid), /* FC */ - OPCODE(o70_polygonHit), + OPCODE(o6_invalid), OPCODE(o6_invalid), OPCODE(o6_invalid), OPCODE(o6_invalid), @@ -765,68 +765,6 @@ void ScummEngine_v70he::o70_getStringWidth() { push(width); } -void ScummEngine_v70he::o70_kernelSetFunctions() { - int args[29]; - int num; - Actor *a; - - 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: // HE72+ - a = derefActor(args[1], "o70_kernelSetFunctions: 20"); - ((ScummEngine_v71he *)this)->queueAuxBlock(a); - break; - case 21: - _skipDrawObject = 1; - break; - case 22: - _skipDrawObject = 0; - break; - case 23: - clearCharsetMask(); - _fullRedraw = true; - break; - case 24: - _skipProcessActors = 1; - redrawAllActors(); - break; - case 25: - _skipProcessActors = 0; - redrawAllActors(); - break; - case 26: - a = derefActor(args[1], "o70_kernelSetFunctions: 26"); - a->_auxBlock.r.left = 0; - a->_auxBlock.r.right = -1; - a->_auxBlock.r.top = 0; - a->_auxBlock.r.bottom = -2; - break; - case 30: - a = derefActor(args[1], "o70_kernelSetFunctions: 30"); - a->_clipOverride.bottom = args[2]; - break; - case 42: - _wiz->_rectOverrideEnabled = true; - _wiz->_rectOverride.left = args[1]; - _wiz->_rectOverride.top = args[2]; - _wiz->_rectOverride.right = args[3]; - _wiz->_rectOverride.bottom = args[4]; - adjustRect(_wiz->_rectOverride); - break; - case 43: - _wiz->_rectOverrideEnabled = false; - break; - default: - error("o70_kernelSetFunctions: default case %d (param count %d)", args[0], num); - } -} - void ScummEngine_v70he::o70_getStringLen() { int id, len; byte *addr; @@ -1118,45 +1056,4 @@ void ScummEngine_v70he::o70_setSystemMessage() { } } -void ScummEngine_v70he::o70_polygonOps() { - int vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y; - int id, fromId, toId; - bool flag; - - byte subOp = fetchScriptByte(); - - switch (subOp) { - case 68: // HE 100 - case 69: // HE 100 - case 246: - case 248: - vert4y = pop(); - vert4x = pop(); - vert3y = pop(); - vert3x = pop(); - vert2y = pop(); - vert2x = pop(); - vert1y = pop(); - vert1x = pop(); - flag = (subOp == 69 || subOp == 248); - id = pop(); - _wiz->polygonStore(id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y); - break; - case 28: // HE 100 - case 247: - toId = pop(); - fromId = pop(); - _wiz->polygonErase(fromId, toId); - break; - default: - error("o70_polygonOps: default case %d", subOp); - } -} - -void ScummEngine_v70he::o70_polygonHit() { - int y = pop(); - int x = pop(); - push(_wiz->polygonHit(0, x, y)); -} - } // End of namespace Scumm diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp new file mode 100644 index 00000000000..5ed4e6c6f2d --- /dev/null +++ b/engines/scumm/he/script_v71he.cpp @@ -0,0 +1,478 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + + + +#include "common/config-manager.h" +#include "common/system.h" + +#include "scumm/actor.h" +#include "scumm/he/intern_he.h" +#include "scumm/scumm.h" + +namespace Scumm { + +#define OPCODE(x) _OPCODE(ScummEngine_v71he, x) + +void ScummEngine_v71he::setupOpcodes() { + static const OpcodeEntryv71he opcodes[256] = { + /* 00 */ + OPCODE(o6_pushByte), + OPCODE(o6_pushWord), + OPCODE(o6_pushByteVar), + OPCODE(o6_pushWordVar), + /* 04 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_byteArrayRead), + OPCODE(o6_wordArrayRead), + /* 08 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_byteArrayIndexedRead), + OPCODE(o6_wordArrayIndexedRead), + /* 0C */ + OPCODE(o6_dup), + OPCODE(o6_not), + OPCODE(o6_eq), + OPCODE(o6_neq), + /* 10 */ + OPCODE(o6_gt), + OPCODE(o6_lt), + OPCODE(o6_le), + OPCODE(o6_ge), + /* 14 */ + OPCODE(o6_add), + OPCODE(o6_sub), + OPCODE(o6_mul), + OPCODE(o6_div), + /* 18 */ + OPCODE(o6_land), + OPCODE(o6_lor), + OPCODE(o6_pop), + OPCODE(o6_invalid), + /* 1C */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* 20 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* 24 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* 28 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* 2C */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* 30 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* 34 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* 38 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* 3C */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* 40 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_writeByteVar), + OPCODE(o6_writeWordVar), + /* 44 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_byteArrayWrite), + OPCODE(o6_wordArrayWrite), + /* 48 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_byteArrayIndexedWrite), + OPCODE(o6_wordArrayIndexedWrite), + /* 4C */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_byteVarInc), + OPCODE(o6_wordVarInc), + /* 50 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_byteArrayInc), + OPCODE(o6_wordArrayInc), + /* 54 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_byteVarDec), + OPCODE(o6_wordVarDec), + /* 58 */ + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_byteArrayDec), + OPCODE(o6_wordArrayDec), + /* 5C */ + OPCODE(o6_if), + OPCODE(o6_ifNot), + OPCODE(o6_startScript), + OPCODE(o6_startScriptQuick), + /* 60 */ + OPCODE(o6_startObject), + OPCODE(o6_drawObject), + OPCODE(o6_drawObjectAt), + OPCODE(o6_invalid), + /* 64 */ + OPCODE(o6_invalid), + OPCODE(o6_stopObjectCode), + OPCODE(o6_stopObjectCode), + OPCODE(o6_endCutscene), + /* 68 */ + OPCODE(o6_cutscene), + OPCODE(o6_stopMusic), + OPCODE(o6_freezeUnfreeze), + OPCODE(o6_cursorCommand), + /* 6C */ + OPCODE(o6_breakHere), + OPCODE(o6_ifClassOfIs), + OPCODE(o6_setClass), + OPCODE(o6_getState), + /* 70 */ + OPCODE(o60_setState), + OPCODE(o6_setOwner), + OPCODE(o6_getOwner), + OPCODE(o6_jump), + /* 74 */ + OPCODE(o70_startSound), + OPCODE(o6_stopSound), + OPCODE(o6_startMusic), + OPCODE(o6_stopObjectScript), + /* 78 */ + OPCODE(o6_panCameraTo), + OPCODE(o6_actorFollowCamera), + OPCODE(o6_setCameraAt), + OPCODE(o6_loadRoom), + /* 7C */ + OPCODE(o6_stopScript), + OPCODE(o6_walkActorToObj), + OPCODE(o6_walkActorTo), + OPCODE(o6_putActorAtXY), + /* 80 */ + OPCODE(o6_putActorAtObject), + OPCODE(o6_faceActor), + OPCODE(o6_animateActor), + OPCODE(o6_doSentence), + /* 84 */ + OPCODE(o70_pickupObject), + OPCODE(o6_loadRoomWithEgo), + OPCODE(o6_invalid), + OPCODE(o6_getRandomNumber), + /* 88 */ + OPCODE(o6_getRandomNumberRange), + OPCODE(o6_invalid), + OPCODE(o6_getActorMoving), + OPCODE(o6_isScriptRunning), + /* 8C */ + OPCODE(o70_getActorRoom), + OPCODE(o6_getObjectX), + OPCODE(o6_getObjectY), + OPCODE(o6_getObjectOldDir), + /* 90 */ + OPCODE(o6_getActorWalkBox), + OPCODE(o6_getActorCostume), + OPCODE(o6_findInventory), + OPCODE(o6_getInventoryCount), + /* 94 */ + OPCODE(o6_getVerbFromXY), + OPCODE(o6_beginOverride), + OPCODE(o6_endOverride), + OPCODE(o6_setObjectName), + /* 98 */ + OPCODE(o6_isSoundRunning), + OPCODE(o6_setBoxFlags), + OPCODE(o6_invalid), + OPCODE(o70_resourceRoutines), + /* 9C */ + OPCODE(o60_roomOps), + OPCODE(o60_actorOps), + OPCODE(o6_verbOps), + OPCODE(o6_getActorFromXY), + /* A0 */ + OPCODE(o6_findObject), + OPCODE(o6_pseudoRoom), + OPCODE(o6_getActorElevation), + OPCODE(o6_getVerbEntrypoint), + /* A4 */ + OPCODE(o6_arrayOps), + OPCODE(o6_saveRestoreVerbs), + OPCODE(o6_drawBox), + OPCODE(o6_pop), + /* A8 */ + OPCODE(o6_getActorWidth), + OPCODE(o6_wait), + OPCODE(o6_getActorScaleX), + OPCODE(o6_getActorAnimCounter), + /* AC */ + OPCODE(o6_invalid), + OPCODE(o6_isAnyOf), + OPCODE(o70_systemOps), + OPCODE(o6_isActorInBox), + /* B0 */ + OPCODE(o6_delay), + OPCODE(o6_delaySeconds), + OPCODE(o6_delayMinutes), + OPCODE(o6_stopSentence), + /* B4 */ + OPCODE(o6_printLine), + OPCODE(o6_printText), + OPCODE(o6_printDebug), + OPCODE(o6_printSystem), + /* B8 */ + OPCODE(o6_printActor), + OPCODE(o6_printEgo), + OPCODE(o6_talkActor), + OPCODE(o6_talkEgo), + /* BC */ + OPCODE(o6_dimArray), + OPCODE(o6_stopObjectCode), + OPCODE(o6_startObjectQuick), + OPCODE(o6_startScriptQuick2), + /* C0 */ + OPCODE(o6_dim2dimArray), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* C4 */ + OPCODE(o6_abs), + OPCODE(o6_distObjectObject), + OPCODE(o6_distObjectPt), + OPCODE(o6_distPtPt), + /* C8 */ + OPCODE(o60_kernelGetFunctions), + OPCODE(o71_kernelSetFunctions), + OPCODE(o6_delayFrames), + OPCODE(o6_pickOneOf), + /* CC */ + OPCODE(o6_pickOneOfDefault), + OPCODE(o6_stampObject), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* D0 */ + OPCODE(o6_getDateTime), + OPCODE(o6_stopTalking), + OPCODE(o6_getAnimateVariable), + OPCODE(o6_invalid), + /* D4 */ + OPCODE(o6_shuffle), + OPCODE(o6_jumpToScript), + OPCODE(o6_band), + OPCODE(o6_bor), + /* D8 */ + OPCODE(o6_isRoomScriptRunning), + OPCODE(o60_closeFile), + OPCODE(o60_openFile), + OPCODE(o60_readFile), + /* DC */ + OPCODE(o60_writeFile), + OPCODE(o6_findAllObjects), + OPCODE(o60_deleteFile), + OPCODE(o60_rename), + /* E0 */ + OPCODE(o60_soundOps), + OPCODE(o6_getPixel), + OPCODE(o60_localizeArrayToScript), + OPCODE(o6_pickVarRandom), + /* E4 */ + OPCODE(o6_setBoxSet), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + /* E8 */ + OPCODE(o6_invalid), + OPCODE(o60_seekFilePos), + OPCODE(o60_redimArray), + OPCODE(o60_readFilePos), + /* EC */ + OPCODE(o70_copyString), + OPCODE(o70_getStringWidth), + OPCODE(o70_getStringLen), + OPCODE(o70_appendString), + /* F0 */ + OPCODE(o70_concatString), + OPCODE(o70_compareString), + OPCODE(o70_isResourceLoaded), + OPCODE(o70_readINI), + /* F4 */ + OPCODE(o70_writeINI), + OPCODE(o70_getStringLenForWidth), + OPCODE(o70_getCharIndexInString), + OPCODE(o70_findBox), + /* F8 */ + OPCODE(o6_invalid), + OPCODE(o70_createDirectory), + OPCODE(o70_setSystemMessage), + OPCODE(o71_polygonOps), + /* FC */ + OPCODE(o71_polygonHit), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + }; + + _opcodesv71he = opcodes; +} + +void ScummEngine_v71he::executeOpcode(byte i) { + OpcodeProcv71he op = _opcodesv71he[i].proc; + (this->*op) (); +} + +const char *ScummEngine_v71he::getOpcodeDesc(byte i) { + return _opcodesv71he[i].desc; +} + +void ScummEngine_v71he::o71_kernelSetFunctions() { + int args[29]; + int num; + Actor *a; + + 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: // HE72+ + a = derefActor(args[1], "o71_kernelSetFunctions: 20"); + ((ScummEngine_v71he *)this)->queueAuxBlock(a); + break; + case 21: + _skipDrawObject = 1; + break; + case 22: + _skipDrawObject = 0; + break; + case 23: + clearCharsetMask(); + _fullRedraw = true; + break; + case 24: + _skipProcessActors = 1; + redrawAllActors(); + break; + case 25: + _skipProcessActors = 0; + redrawAllActors(); + break; + case 26: + a = derefActor(args[1], "o71_kernelSetFunctions: 26"); + a->_auxBlock.r.left = 0; + a->_auxBlock.r.right = -1; + a->_auxBlock.r.top = 0; + a->_auxBlock.r.bottom = -2; + break; + case 30: + a = derefActor(args[1], "o71_kernelSetFunctions: 30"); + a->_clipOverride.bottom = args[2]; + break; + case 42: + _wiz->_rectOverrideEnabled = true; + _wiz->_rectOverride.left = args[1]; + _wiz->_rectOverride.top = args[2]; + _wiz->_rectOverride.right = args[3]; + _wiz->_rectOverride.bottom = args[4]; + adjustRect(_wiz->_rectOverride); + break; + case 43: + _wiz->_rectOverrideEnabled = false; + break; + default: + error("o71_kernelSetFunctions: default case %d (param count %d)", args[0], num); + } +} + +void ScummEngine_v71he::o71_polygonOps() { + int vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y; + int id, fromId, toId; + bool flag; + + byte subOp = fetchScriptByte(); + + switch (subOp) { + case 68: // HE 100 + case 69: // HE 100 + case 246: + case 248: + vert4y = pop(); + vert4x = pop(); + vert3y = pop(); + vert3x = pop(); + vert2y = pop(); + vert2x = pop(); + vert1y = pop(); + vert1x = pop(); + flag = (subOp == 69 || subOp == 248); + id = pop(); + _wiz->polygonStore(id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y); + break; + case 28: // HE 100 + case 247: + toId = pop(); + fromId = pop(); + _wiz->polygonErase(fromId, toId); + break; + default: + error("o71_polygonOps: default case %d", subOp); + } +} + +void ScummEngine_v71he::o71_polygonHit() { + int y = pop(); + int x = pop(); + push(_wiz->polygonHit(0, x, y)); +} + +} // End of namespace Scumm diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index f229837414f..ba7d4b9d0ad 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -300,7 +300,7 @@ void ScummEngine_v72he::setupOpcodes() { OPCODE(o6_distPtPt), /* C8 */ OPCODE(o72_kernelGetFunctions), - OPCODE(o70_kernelSetFunctions), + OPCODE(o71_kernelSetFunctions), OPCODE(o6_delayFrames), OPCODE(o6_pickOneOf), /* CC */ @@ -362,9 +362,9 @@ void ScummEngine_v72he::setupOpcodes() { OPCODE(o72_getResourceSize), OPCODE(o72_createDirectory), OPCODE(o72_setSystemMessage), - OPCODE(o70_polygonOps), + OPCODE(o71_polygonOps), /* FC */ - OPCODE(o70_polygonHit), + OPCODE(o71_polygonHit), OPCODE(o6_invalid), OPCODE(o6_invalid), OPCODE(o6_invalid), diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index be17bbe3df8..cd31e88eb7e 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -297,7 +297,7 @@ void ScummEngine_v80he::setupOpcodes() { OPCODE(o6_distPtPt), /* C8 */ OPCODE(o72_kernelGetFunctions), - OPCODE(o70_kernelSetFunctions), + OPCODE(o71_kernelSetFunctions), OPCODE(o6_delayFrames), OPCODE(o6_pickOneOf), /* CC */ @@ -359,9 +359,9 @@ void ScummEngine_v80he::setupOpcodes() { OPCODE(o72_getResourceSize), OPCODE(o72_createDirectory), OPCODE(o72_setSystemMessage), - OPCODE(o70_polygonOps), + OPCODE(o71_polygonOps), /* FC */ - OPCODE(o70_polygonHit), + OPCODE(o71_polygonHit), OPCODE(o6_invalid), OPCODE(o6_invalid), OPCODE(o6_invalid), diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index e4d101e2e17..daabb1795e2 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -358,9 +358,9 @@ void ScummEngine_v90he::setupOpcodes() { OPCODE(o72_getResourceSize), OPCODE(o72_createDirectory), OPCODE(o72_setSystemMessage), - OPCODE(o70_polygonOps), + OPCODE(o71_polygonOps), /* FC */ - OPCODE(o70_polygonHit), + OPCODE(o71_polygonHit), OPCODE(o6_invalid), OPCODE(o6_invalid), OPCODE(o6_invalid), diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index 05052fcd2ad..644fad78836 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -36,7 +36,7 @@ namespace Scumm { -Wiz::Wiz(ScummEngine_v70he *vm) : _vm(vm) { +Wiz::Wiz(ScummEngine_v71he *vm) : _vm(vm) { _imagesNum = 0; memset(&_images, 0, sizeof(_images)); memset(&_polygons, 0, sizeof(_polygons)); diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h index 68be9d65e26..186dbced6da 100644 --- a/engines/scumm/he/wiz_he.h +++ b/engines/scumm/he/wiz_he.h @@ -142,7 +142,7 @@ enum { kWizCopy }; -class ScummEngine_v70he; +class ScummEngine_v71he; class Wiz { public: @@ -155,7 +155,7 @@ public: uint16 _imagesNum; WizPolygon _polygons[NUM_POLYGONS]; - Wiz(ScummEngine_v70he *vm); + Wiz(ScummEngine_v71he *vm); void clearWizBuffer(); Common::Rect _rectOverride; @@ -214,7 +214,7 @@ public: void computeRawWizHistogram(uint32 *histogram, const uint8 *data, int srcPitch, const Common::Rect& rCapt); private: - ScummEngine_v70he *_vm; + ScummEngine_v71he *_vm; }; } // End of namespace Scumm diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk index 2d70b167eae..ee3573975be 100644 --- a/engines/scumm/module.mk +++ b/engines/scumm/module.mk @@ -16,7 +16,9 @@ MODULE_OBJS := \ file.o \ file_nes.o \ gfx.o \ + he/resource_he.o \ he/script_v60he.o \ + he/script_v70he.o \ he/sound_he.o \ help.o \ imuse/imuse.o \ @@ -103,8 +105,7 @@ MODULE_OBJS += \ he/floodfill_he.o \ he/logic_he.o \ he/palette_he.o \ - he/resource_he.o \ - he/script_v70he.o \ + he/script_v71he.o \ he/script_v72he.o \ he/script_v80he.o \ he/script_v90he.o \ diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index d3e96e5bef1..34b8433ad3b 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -28,9 +28,7 @@ #include "scumm/actor.h" #include "scumm/bomp.h" #include "scumm/intern.h" -#ifndef DISABLE_HE #include "scumm/he/intern_he.h" -#endif #include "scumm/object.h" #include "scumm/resource.h" #include "scumm/usage_bits.h" @@ -496,8 +494,8 @@ int ScummEngine::findObject(int x, int y) { b = _objs[b].parent; if (b == 0) { #ifndef DISABLE_HE - if (_game.heversion >= 70) { - if (((ScummEngine_v70he *)this)->_wiz->polygonHit(_objs[i].obj_nr, x, y)) + if (_game.heversion >= 71) { + if (((ScummEngine_v71he *)this)->_wiz->polygonHit(_objs[i].obj_nr, x, y)) return _objs[i].obj_nr; } #endif @@ -654,7 +652,6 @@ void ScummEngine::clearRoomObjects() { } } -#ifndef DISABLE_HE void ScummEngine_v70he::resetRoomObjects() { ScummEngine_v60he::resetRoomObjects(); restoreFlObjects(); @@ -682,7 +679,6 @@ void ScummEngine_v70he::clearRoomObjects() { restoreFlObjects(); } - void ScummEngine_v70he::storeFlObject(int slot) { memcpy(&_storedFlObjects[_numStoredFlObjects], &_objs[slot], sizeof(_objs[slot])); _numStoredFlObjects++; @@ -700,7 +696,6 @@ void ScummEngine_v70he::restoreFlObjects() { _numStoredFlObjects = 0; } -#endif void ScummEngine::resetRoomObjects() { int i, j; @@ -1079,7 +1074,7 @@ void ScummEngine_v6::clearDrawQueues() { } #ifndef DISABLE_HE -void ScummEngine_v70he::clearDrawQueues() { +void ScummEngine_v71he::clearDrawQueues() { ScummEngine_v6::clearDrawQueues(); _wiz->polygonClear(); @@ -1756,7 +1751,6 @@ int ScummEngine::findFlObjectSlot() { return -1; } -#ifndef DISABLE_HE void ScummEngine_v70he::loadFlObject(uint object, uint room) { // Don't load an already stored object for (int i = 0; i < _numStoredFlObjects; i++) { @@ -1766,7 +1760,6 @@ void ScummEngine_v70he::loadFlObject(uint object, uint room) { ScummEngine_v60he::loadFlObject(object, room); } -#endif void ScummEngine::loadFlObject(uint object, uint room) { FindObjectInRoom foir; diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 698cdd61ed8..19c27b4bc39 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -32,9 +32,7 @@ #include "scumm/imuse/imuse.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/intern.h" -#ifndef DISABLE_HE #include "scumm/he/intern_he.h" -#endif #include "scumm/object.h" #include "scumm/resource.h" #include "scumm/scumm.h" @@ -59,9 +57,7 @@ extern const char *resTypeFromId(int id); static uint16 newTag2Old(uint32 newTag); static const byte *findResourceSmall(uint32 tag, const byte *searchin); -#ifndef DISABLE_HE static bool checkTryMedia(BaseScummFile *handle); -#endif /* Open a room */ @@ -293,14 +289,12 @@ void ScummEngine::readIndexFile() { _fileHandle->seek(0, SEEK_SET); } -#ifndef DISABLE_HE if (checkTryMedia(_fileHandle)) { displayMessage(NULL, "You're trying to run game encrypted by ActiveMark. This is not supported."); _quit = true; return; } -#endif while (true) { blocktype = _fileHandle->readUint32BE(); @@ -320,7 +314,6 @@ void ScummEngine::readIndexFile() { } -#ifndef DISABLE_HE #define TRYMEDIA_MARK_LEN 6 @@ -352,7 +345,6 @@ bool checkTryMedia(BaseScummFile *handle) { return false; } -#endif #ifndef DISABLE_SCUMM_7_8 @@ -378,7 +370,6 @@ void ScummEngine_v7::readIndexBlock(uint32 blocktype, uint32 itemsize) { } #endif -#ifndef DISABLE_HE void ScummEngine_v70he::readIndexBlock(uint32 blocktype, uint32 itemsize) { int i; switch (blocktype) { @@ -421,7 +412,6 @@ void ScummEngine_v70he::readIndexBlock(uint32 blocktype, uint32 itemsize) { ScummEngine::readIndexBlock(blocktype, itemsize); } } -#endif void ScummEngine::readIndexBlock(uint32 blocktype, uint32 itemsize) { int i; diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index 11ac1ea1ed9..04cd13e1268 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -565,7 +565,7 @@ void ScummEngine::resetRoomSubBlocks() { if (_game.heversion >= 80) { ptr = findResourceData(MKID_BE('POLD'), roomptr); if (ptr) { - ((ScummEngine_v70he *)this)->_wiz->polygonLoad(ptr); + ((ScummEngine_v71he *)this)->_wiz->polygonLoad(ptr); } } #endif diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 6a4ebdc907c..629ac31901d 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -1261,7 +1261,6 @@ void ScummEngine_v60he::saveOrLoad(Serializer *s) { s->saveLoadArrayOf(_arraySlot, _numArray, sizeof(_arraySlot[0]), sleByte); } -#ifndef DISABLE_HE void ScummEngine_v70he::saveOrLoad(Serializer *s) { ScummEngine_v60he::saveOrLoad(s); @@ -1276,6 +1275,7 @@ void ScummEngine_v70he::saveOrLoad(Serializer *s) { s->saveLoadEntries(this, HE70Entries); } +#ifndef DISABLE_HE void ScummEngine_v71he::saveOrLoad(Serializer *s) { ScummEngine_v70he::saveOrLoad(s); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 78bd9321e6b..18b170dacb3 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -727,7 +727,6 @@ ScummEngine_v60he::~ScummEngine_v60he() { } } -#ifndef DISABLE_HE ScummEngine_v70he::ScummEngine_v70he(OSystem *syst, const DetectorResult &dr) : ScummEngine_v60he(syst, dr) { if (_game.platform == Common::kPlatformMacintosh && (_game.heversion >= 72 && _game.heversion <= 73)) @@ -735,8 +734,6 @@ ScummEngine_v70he::ScummEngine_v70he(OSystem *syst, const DetectorResult &dr) else _resExtractor = new Win32ResExtractor(this); - _wiz = new Wiz(this); - _heV7RoomOffsets = NULL; _heSndSoundId = 0; @@ -756,19 +753,25 @@ ScummEngine_v70he::ScummEngine_v70he(OSystem *syst, const DetectorResult &dr) ScummEngine_v70he::~ScummEngine_v70he() { delete _resExtractor; - delete _wiz; free(_heV7DiskOffsets); free(_heV7RoomIntOffsets); free(_heV7RoomOffsets); free(_storedFlObjects); } +#ifndef DISABLE_HE ScummEngine_v71he::ScummEngine_v71he(OSystem *syst, const DetectorResult &dr) : ScummEngine_v70he(syst, dr) { _auxBlocksNum = 0; memset(_auxBlocks, 0, sizeof(_auxBlocks)); _auxEntriesNum = 0; memset(_auxEntries, 0, sizeof(_auxEntries)); + + _wiz = new Wiz(this); +} + +ScummEngine_v71he::~ScummEngine_v71he() { + delete _wiz; } ScummEngine_v72he::ScummEngine_v72he(OSystem *syst, const DetectorResult &dr) diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index a00da335d25..8917a80aeaf 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -27,9 +27,7 @@ #include "common/config-manager.h" #include "scumm/scumm.h" #include "scumm/intern.h" -#ifndef DISABLE_HE #include "scumm/he/intern_he.h" -#endif #include "scumm/he/logic_he.h" #include "sound/mididrv.h" @@ -207,7 +205,6 @@ void ScummEngine_v6::setupScummVars() { } } -#ifndef DISABLE_HE void ScummEngine_v70he::setupScummVars() { ScummEngine_v6::setupScummVars(); @@ -219,6 +216,7 @@ void ScummEngine_v70he::setupScummVars() { VAR_SOUND_CHANNEL = 14; } +#ifndef DISABLE_HE void ScummEngine_v72he::setupScummVars() { VAR_KEYPRESS = 0; VAR_DEBUGMODE = 1; @@ -624,7 +622,6 @@ void ScummEngine_v8::resetScummVars() { } #endif -#ifndef DISABLE_HE void ScummEngine_v70he::resetScummVars() { ScummEngine::resetScummVars(); @@ -636,6 +633,7 @@ void ScummEngine_v70he::resetScummVars() { VAR(VAR_TALK_CHANNEL) = 2; } +#ifndef DISABLE_HE void ScummEngine_v72he::resetScummVars() { ScummEngine_v70he::resetScummVars();