added some preliminary V8 work. Nope, it is not useful at all, and it doesn't mean we will have CMI support in this millenium, so don't hold your breath
svn-id: r6060
This commit is contained in:
parent
3ce3a5be5b
commit
df3c41fa24
13 changed files with 1549 additions and 379 deletions
430
scumm/intern.h
Normal file
430
scumm/intern.h
Normal file
|
@ -0,0 +1,430 @@
|
|||
/* ScummVM - Scumm Interpreter
|
||||
* Copyright (C) 2001 Ludvig Strigeus
|
||||
* Copyright (C) 2001/2002 The ScummVM project
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INTERN_H
|
||||
#define INTERN_H
|
||||
|
||||
#include "scumm.h"
|
||||
|
||||
|
||||
class Scumm_v5 : public Scumm
|
||||
{
|
||||
protected:
|
||||
typedef void (Scumm_v5::*OpcodeProcV5)();
|
||||
struct OpcodeEntryV5 {
|
||||
OpcodeProcV5 proc;
|
||||
const char *desc;
|
||||
};
|
||||
|
||||
const OpcodeEntryV5 *_opcodesV5;
|
||||
|
||||
public:
|
||||
Scumm_v5(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
|
||||
|
||||
protected:
|
||||
virtual void setupOpcodes();
|
||||
virtual void executeOpcode(int i);
|
||||
virtual const char *getOpcodeDesc(int i);
|
||||
|
||||
void decodeParseString();
|
||||
int getWordVararg(int16 *ptr);
|
||||
int getVarOrDirectWord(byte mask);
|
||||
int getVarOrDirectByte(byte mask);
|
||||
|
||||
/* Version 5 script opcodes */
|
||||
void o5_actorFollowCamera();
|
||||
void o5_actorFromPos();
|
||||
void o5_actorSet();
|
||||
void o5_add();
|
||||
void o5_and();
|
||||
void o5_animateActor();
|
||||
void o5_badOpcode();
|
||||
void o5_breakHere();
|
||||
void o5_chainScript();
|
||||
void o5_cursorCommand();
|
||||
void o5_cutscene();
|
||||
void o5_debug();
|
||||
void o5_decrement();
|
||||
void o5_delay();
|
||||
void o5_delayVariable();
|
||||
void o5_divide();
|
||||
void o5_doSentence();
|
||||
void o5_drawBox();
|
||||
void o5_drawObject();
|
||||
void o5_dummy();
|
||||
void o5_endCutscene();
|
||||
void o5_equalZero();
|
||||
void o5_expression();
|
||||
void o5_faceActor();
|
||||
void o5_findInventory();
|
||||
void o5_findObject();
|
||||
void o5_freezeScripts();
|
||||
void o5_getActorCostume();
|
||||
void o5_getActorElevation();
|
||||
void o5_getActorFacing();
|
||||
void o5_getActorMoving();
|
||||
void o5_getActorRoom();
|
||||
void o5_getActorScale();
|
||||
void o5_getActorWalkBox();
|
||||
void o5_getActorWidth();
|
||||
void o5_getActorX();
|
||||
void o5_getActorY();
|
||||
void o5_getAnimCounter();
|
||||
void o5_getClosestObjActor();
|
||||
void o5_getDist();
|
||||
void o5_getInventoryCount();
|
||||
void o5_getObjectOwner();
|
||||
void o5_getObjectState();
|
||||
void o5_getRandomNr();
|
||||
void o5_isScriptRunning();
|
||||
void o5_getVerbEntrypoint();
|
||||
void o5_ifClassOfIs();
|
||||
void o5_increment();
|
||||
void o5_isActorInBox();
|
||||
void o5_isEqual();
|
||||
void o5_isGreater();
|
||||
void o5_isGreaterEqual();
|
||||
void o5_isLess();
|
||||
void o5_isNotEqual();
|
||||
void o5_ifState();
|
||||
void o5_ifNotState();
|
||||
void o5_isSoundRunning();
|
||||
void o5_jumpRelative();
|
||||
void o5_lessOrEqual();
|
||||
void o5_lights();
|
||||
void o5_loadRoom();
|
||||
void o5_loadRoomWithEgo();
|
||||
void o5_matrixOps();
|
||||
void o5_move();
|
||||
void o5_multiply();
|
||||
void o5_notEqualZero();
|
||||
void o5_or();
|
||||
void o5_overRide();
|
||||
void o5_panCameraTo();
|
||||
void o5_pickupObject();
|
||||
void o5_print();
|
||||
void o5_printEgo();
|
||||
void o5_pseudoRoom();
|
||||
void o5_putActor();
|
||||
void o5_putActorAtObject();
|
||||
void o5_putActorInRoom();
|
||||
void o5_quitPauseRestart();
|
||||
void o5_resourceRoutines();
|
||||
void o5_roomOps();
|
||||
void o5_saveRestoreVerbs();
|
||||
void o5_setCameraAt();
|
||||
void o5_setClass();
|
||||
void o5_setObjectName();
|
||||
void o5_setOwnerOf();
|
||||
void o5_setState();
|
||||
void o5_setVarRange();
|
||||
void o5_soundKludge();
|
||||
void o5_startMusic();
|
||||
void o5_startObject();
|
||||
void o5_startScript();
|
||||
void o5_startSound();
|
||||
void o5_stopMusic();
|
||||
void o5_stopObjectCode();
|
||||
void o5_stopObjectScript();
|
||||
void o5_stopScript();
|
||||
void o5_stopSound();
|
||||
void o5_stringOps();
|
||||
void o5_subtract();
|
||||
void o5_verbOps();
|
||||
void o5_wait();
|
||||
void o5_walkActorTo();
|
||||
void o5_walkActorToActor();
|
||||
void o5_walkActorToObject();
|
||||
void o5_oldRoomEffect();
|
||||
void o5_pickupObjectOld();
|
||||
};
|
||||
|
||||
// FIXME - subclassing V2 from Scumm_v5 is a hack: V2 should have its own opcode table
|
||||
class Scumm_v2 : public Scumm_v5
|
||||
{
|
||||
public:
|
||||
Scumm_v2(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}
|
||||
|
||||
virtual void readIndexFile();
|
||||
};
|
||||
|
||||
// FIXME - maybe we should move the opcodes from v5 to v3, and change the inheritance
|
||||
// accordingly - that would be more logical I guess. However, if you do so, take care
|
||||
// of preserving the right readIndexFile / loadCharset !!!
|
||||
class Scumm_v3 : public Scumm_v5
|
||||
{
|
||||
public:
|
||||
Scumm_v3(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}
|
||||
|
||||
void readIndexFile();
|
||||
virtual void loadCharset(int no);
|
||||
};
|
||||
|
||||
class Scumm_v4 : public Scumm_v3
|
||||
{
|
||||
public:
|
||||
Scumm_v4(GameDetector *detector, OSystem *syst) : Scumm_v3(detector, syst) {}
|
||||
|
||||
void loadCharset(int no);
|
||||
};
|
||||
|
||||
class Scumm_v6 : public Scumm
|
||||
{
|
||||
protected:
|
||||
typedef void (Scumm_v6::*OpcodeProcV6)();
|
||||
struct OpcodeEntryV6 {
|
||||
OpcodeProcV6 proc;
|
||||
const char *desc;
|
||||
};
|
||||
|
||||
const OpcodeEntryV6 *_opcodesV6;
|
||||
|
||||
public:
|
||||
Scumm_v6(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
|
||||
|
||||
protected:
|
||||
virtual void setupOpcodes();
|
||||
|
||||
virtual void executeOpcode(int i);
|
||||
virtual const char *getOpcodeDesc(int i);
|
||||
|
||||
int popRoomAndObj(int *room);
|
||||
|
||||
void decodeParseString2(int a, int b);
|
||||
int getStackList(int16 *args, uint maxnum);
|
||||
|
||||
/* Version 6 script opcodes */
|
||||
void o6_setBlastObjectWindow();
|
||||
void o6_pushByte();
|
||||
void o6_pushWord();
|
||||
void o6_pushByteVar();
|
||||
void o6_pushWordVar();
|
||||
void o6_invalid();
|
||||
void o6_byteArrayRead();
|
||||
void o6_wordArrayRead();
|
||||
void o6_byteArrayIndexedRead();
|
||||
void o6_wordArrayIndexedRead();
|
||||
void o6_dup();
|
||||
void o6_not();
|
||||
void o6_eq();
|
||||
void o6_neq();
|
||||
void o6_gt();
|
||||
void o6_lt();
|
||||
void o6_le();
|
||||
void o6_ge();
|
||||
void o6_add();
|
||||
void o6_sub();
|
||||
void o6_mul();
|
||||
void o6_div();
|
||||
void o6_land();
|
||||
void o6_lor();
|
||||
void o6_kill();
|
||||
void o6_writeByteVar();
|
||||
void o6_writeWordVar();
|
||||
void o6_byteArrayWrite();
|
||||
void o6_wordArrayWrite();
|
||||
void o6_byteArrayIndexedWrite();
|
||||
void o6_wordArrayIndexedWrite();
|
||||
void o6_byteVarInc();
|
||||
void o6_wordVarInc();
|
||||
void o6_byteArrayInc();
|
||||
void o6_wordArrayInc();
|
||||
void o6_byteVarDec();
|
||||
void o6_wordVarDec();
|
||||
void o6_byteArrayDec();
|
||||
void o6_wordArrayDec();
|
||||
void o6_jumpTrue();
|
||||
void o6_jumpFalse();
|
||||
void o6_jump();
|
||||
void o6_startScriptEx();
|
||||
void o6_startScript();
|
||||
void o6_startObject();
|
||||
void o6_setObjectState();
|
||||
void o6_setObjectXY();
|
||||
void o6_stopObjectCode();
|
||||
void o6_endCutscene();
|
||||
void o6_cutScene();
|
||||
void o6_stopMusic();
|
||||
void o6_freezeUnfreeze();
|
||||
void o6_cursorCommand();
|
||||
void o6_breakHere();
|
||||
void o6_ifClassOfIs();
|
||||
void o6_setClass();
|
||||
void o6_getState();
|
||||
void o6_setState();
|
||||
void o6_setOwner();
|
||||
void o6_getOwner();
|
||||
void o6_startSound();
|
||||
void o6_stopSound();
|
||||
void o6_startMusic();
|
||||
void o6_stopObjectScript();
|
||||
void o6_panCameraTo();
|
||||
void o6_actorFollowCamera();
|
||||
void o6_setCameraAt();
|
||||
void o6_loadRoom();
|
||||
void o6_stopScript();
|
||||
void o6_walkActorToObj();
|
||||
void o6_walkActorTo();
|
||||
void o6_putActorInRoom();
|
||||
void o6_putActorAtObject();
|
||||
void o6_faceActor();
|
||||
void o6_animateActor();
|
||||
void o6_doSentence();
|
||||
void o6_pickupObject();
|
||||
void o6_loadRoomWithEgo();
|
||||
void o6_getRandomNumber();
|
||||
void o6_getRandomNumberRange();
|
||||
void o6_getActorMoving();
|
||||
void o6_isScriptRunning();
|
||||
void o6_getActorRoom();
|
||||
void o6_getObjectX();
|
||||
void o6_getObjectY();
|
||||
void o6_getObjectOldDir();
|
||||
void o6_getObjectNewDir();
|
||||
void o6_getActorWalkBox();
|
||||
void o6_getActorCostume();
|
||||
void o6_findInventory();
|
||||
void o6_getInventoryCount();
|
||||
void o6_getVerbFromXY();
|
||||
void o6_beginOverride();
|
||||
void o6_endOverride();
|
||||
void o6_setObjectName();
|
||||
void o6_isSoundRunning();
|
||||
void o6_setBoxFlags();
|
||||
void o6_createBoxMatrix();
|
||||
void o6_resourceRoutines();
|
||||
void o6_roomOps();
|
||||
void o6_actorSet();
|
||||
void o6_verbOps();
|
||||
void o6_getActorFromXY();
|
||||
void o6_findObject();
|
||||
void o6_pseudoRoom();
|
||||
void o6_getActorElevation();
|
||||
void o6_getVerbEntrypoint();
|
||||
void o6_arrayOps();
|
||||
void o6_saveRestoreVerbs();
|
||||
void o6_drawBox();
|
||||
void o6_getActorWidth();
|
||||
void o6_wait();
|
||||
void o6_getActorScaleX();
|
||||
void o6_getActorAnimCounter1();
|
||||
void o6_soundKludge();
|
||||
void o6_isAnyOf();
|
||||
void o6_quitPauseRestart();
|
||||
void o6_isActorInBox();
|
||||
void o6_delay();
|
||||
void o6_delayLonger();
|
||||
void o6_delayVeryLong();
|
||||
void o6_stopSentence();
|
||||
void o6_print_0();
|
||||
void o6_print_1();
|
||||
void o6_print_2();
|
||||
void o6_print_3();
|
||||
void o6_printActor();
|
||||
void o6_printEgo();
|
||||
void o6_talkActor();
|
||||
void o6_talkEgo();
|
||||
void o6_dim();
|
||||
void o6_dummy();
|
||||
void o6_runVerbCodeQuick();
|
||||
void o6_runScriptQuick();
|
||||
void o6_dim2();
|
||||
void o6_abs();
|
||||
void o6_distObjectObject();
|
||||
void o6_distObjectPt();
|
||||
void o6_distPtPt();
|
||||
void o6_miscOps();
|
||||
void o6_delayFrames();
|
||||
void o6_pickOneOf();
|
||||
void o6_pickOneOfDefault();
|
||||
void o6_jumpToScript();
|
||||
void o6_isRoomScriptRunning();
|
||||
void o6_kernelFunction();
|
||||
void o6_getAnimateVariable();
|
||||
void o6_drawBlastObject();
|
||||
void o6_getActorPriority();
|
||||
void o6_unknownCD();
|
||||
void o6_bor();
|
||||
void o6_band();
|
||||
};
|
||||
|
||||
class Scumm_v7 : public Scumm_v6
|
||||
{
|
||||
public:
|
||||
Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm_v6(detector, syst) {}
|
||||
|
||||
protected:
|
||||
virtual void setupScummVars();
|
||||
};
|
||||
|
||||
class Scumm_v8 : public Scumm
|
||||
{
|
||||
protected:
|
||||
typedef void (Scumm_v8::*OpcodeProcV8)();
|
||||
struct OpcodeEntryV8 {
|
||||
OpcodeProcV8 proc;
|
||||
const char *desc;
|
||||
};
|
||||
|
||||
const OpcodeEntryV8 *_opcodesV8;
|
||||
|
||||
public:
|
||||
Scumm_v8(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
|
||||
|
||||
protected:
|
||||
virtual void setupOpcodes();
|
||||
|
||||
virtual void executeOpcode(int i);
|
||||
virtual const char *getOpcodeDesc(int i);
|
||||
|
||||
/* Version 8 script opcodes */
|
||||
void o8_unknown();
|
||||
void o8_invalid();
|
||||
|
||||
void o8_pushNumber();
|
||||
void o8_pushVariable();
|
||||
void o8_dup();
|
||||
void o8_pop();
|
||||
void o8_not();
|
||||
void o8_eq();
|
||||
void o8_neq();
|
||||
void o8_gt();
|
||||
void o8_lt();
|
||||
void o8_le();
|
||||
void o8_ge();
|
||||
void o8_add();
|
||||
void o8_sub();
|
||||
void o8_mul();
|
||||
void o8_div();
|
||||
void o8_land();
|
||||
void o8_lor();
|
||||
void o8_band();
|
||||
void o8_bor();
|
||||
void o8_mod();
|
||||
void o8_jump();
|
||||
void o8_breakHere();
|
||||
void o8_startScript();
|
||||
void o8_startObject();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -20,6 +20,7 @@ SCUMM_OBJS = \
|
|||
scumm/script.o \
|
||||
scumm/script_v5.o \
|
||||
scumm/script_v6.o \
|
||||
scumm/script_v8.o \
|
||||
scumm/scummvm.o \
|
||||
scumm/sound.o \
|
||||
scumm/string.o \
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
uint16 newTag2Old(uint32 oldTag);
|
||||
|
||||
|
||||
/* Open a room */
|
||||
void Scumm::openRoom(int room)
|
||||
{
|
||||
|
@ -39,6 +38,7 @@ void Scumm::openRoom(int room)
|
|||
char buf[256];
|
||||
|
||||
debug(9, "openRoom(%d)", room);
|
||||
assert(room >= 0);
|
||||
|
||||
/* Don't load the same room again */
|
||||
if (_lastLoadedRoom == room)
|
||||
|
@ -125,7 +125,17 @@ void Scumm::openRoom(int room)
|
|||
} while (1);
|
||||
|
||||
deleteRoomOffsets();
|
||||
_fileOffset = 0; /* start of file */
|
||||
_fileOffset = 0; // start of file
|
||||
}
|
||||
|
||||
void Scumm::closeRoom()
|
||||
{
|
||||
if (_lastLoadedRoom != -1) {
|
||||
_lastLoadedRoom = -1;
|
||||
_encbyte = 0;
|
||||
deleteRoomOffsets();
|
||||
_fileHandle.close();
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete the currently loaded room offsets */
|
||||
|
@ -202,7 +212,7 @@ void Scumm::readIndexFile()
|
|||
|
||||
debug(9, "readIndexFile()");
|
||||
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
openRoom(0);
|
||||
|
||||
if (!(_features & GF_AFTER_V6)) {
|
||||
|
@ -330,12 +340,17 @@ void Scumm::readIndexFile()
|
|||
break;
|
||||
|
||||
case MKID('AARY'):
|
||||
debug(3, "Going to call readArrayFromIndexFile (pos = 0x%08x)", _fileHandle.pos());
|
||||
readArrayFromIndexFile();
|
||||
debug(3, "After readArrayFromIndexFile (pos = 0x%08x)", _fileHandle.pos());
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Bad ID %c%c%c%c found in directory!", blocktype & 0xFF,
|
||||
blocktype >> 8, blocktype >> 16, blocktype >> 24);
|
||||
error("Bad ID %c%c%c%c found in directory!",
|
||||
(byte)blocktype,
|
||||
(byte)(blocktype >> 8),
|
||||
(byte)(blocktype >> 16),
|
||||
(byte)(blocktype >> 24));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -343,14 +358,33 @@ void Scumm::readIndexFile()
|
|||
// if (numblock!=9)
|
||||
// error("Not enough blocks read from directory");
|
||||
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
}
|
||||
|
||||
void Scumm::readArrayFromIndexFile()
|
||||
{
|
||||
int num;
|
||||
int a, b, c;
|
||||
int a, b, c, d;
|
||||
|
||||
if (_features & GF_AFTER_V8) {
|
||||
// FIXME - I am not quite sure how to interpret the AARY format of COMI.
|
||||
// Each entry seems to be 12 bytes, while in V7 games it is only 8 bytes.
|
||||
// 2 of the additional bytes seem to be used for num. But what about the
|
||||
// other 2?. Either one of the three fields grew, too (but which). Or there
|
||||
// is a new field, but then what does it mean? Endy or ludde probably know more :-)
|
||||
while ((num = _fileHandle.readUint32LE()) != 0) {
|
||||
a = _fileHandle.readUint16LE();
|
||||
b = _fileHandle.readUint16LE();
|
||||
c = _fileHandle.readUint16LE();
|
||||
d = _fileHandle.readUint16LE();
|
||||
|
||||
printf("Reading array (0x%08x,%d,%d,%d,%d) - (pos = 0x%08x)\n", num, a, b, c, d, _fileHandle.pos());
|
||||
if (c == 1)
|
||||
defineArray(num, 1, a, b);
|
||||
else
|
||||
defineArray(num, 5, a, b);
|
||||
}
|
||||
} else {
|
||||
while ((num = _fileHandle.readUint16LE()) != 0) {
|
||||
a = _fileHandle.readUint16LE();
|
||||
b = _fileHandle.readUint16LE();
|
||||
|
@ -361,6 +395,7 @@ void Scumm::readArrayFromIndexFile()
|
|||
defineArray(num, 5, a, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Scumm::readResTypeList(int id, uint32 tag, const char *name)
|
||||
{
|
||||
|
@ -1514,6 +1549,10 @@ void Scumm::readMAXS()
|
|||
_fileHandle.readUint32LE();
|
||||
_numArray = _fileHandle.readUint32LE();
|
||||
|
||||
// FIXME - uhm... COMI seems to have an ARRY with 143 entries, but
|
||||
// indeed _numArray gets set to 50 ?!?
|
||||
_numArray = 150;
|
||||
|
||||
_objectRoomTable = (byte *)calloc(_numGlobalObjects, 1);
|
||||
_numGlobalScripts = 2000;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "scumm.h"
|
||||
#include "intern.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
|
@ -29,7 +30,7 @@ void Scumm_v2::readIndexFile()
|
|||
int magic = 0;
|
||||
debug(9, "readIndexFile()");
|
||||
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
openRoom(0);
|
||||
|
||||
magic = _fileHandle.readUint16LE();
|
||||
|
@ -81,5 +82,5 @@ void Scumm_v2::readIndexFile()
|
|||
readResTypeList(rtScript, MKID('SCRP'), "script");
|
||||
readResTypeList(rtSound, MKID('SOUN'), "sound");
|
||||
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "scumm.h"
|
||||
#include "intern.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
|
@ -34,7 +35,7 @@ void Scumm_v3::readIndexFile()
|
|||
|
||||
debug(9, "readIndexFile()");
|
||||
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
openRoom(0);
|
||||
|
||||
while (!_fileHandle.eof()) {
|
||||
|
@ -147,7 +148,7 @@ void Scumm_v3::readIndexFile()
|
|||
}
|
||||
}
|
||||
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
}
|
||||
|
||||
void Scumm_v3::loadCharset(int no)
|
||||
|
@ -156,12 +157,12 @@ void Scumm_v3::loadCharset(int no)
|
|||
memset(_charsetData, 0, sizeof(_charsetData));
|
||||
|
||||
checkRange(4, 0, no, "Loading illegal charset %d");
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
|
||||
openRoom(98 + no);
|
||||
|
||||
size = _fileHandle.readUint16LE();
|
||||
|
||||
_fileHandle.read(createResource(6, no, size), size);
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "scumm.h"
|
||||
#include "intern.h"
|
||||
|
||||
void Scumm_v4::loadCharset(int no)
|
||||
{
|
||||
|
@ -29,12 +30,12 @@ void Scumm_v4::loadCharset(int no)
|
|||
memset(_charsetData, 0, sizeof(_charsetData));
|
||||
|
||||
checkRange(4, 0, no, "Loading illegal charset %d");
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
|
||||
openRoom(900 + no);
|
||||
|
||||
size = _fileHandle.readUint32LE() + 11;
|
||||
|
||||
_fileHandle.read(createResource(6, no, size), size);
|
||||
openRoom(-1);
|
||||
closeRoom();
|
||||
}
|
||||
|
|
|
@ -111,7 +111,8 @@ bool Scumm::loadState(int slot, bool compat, SaveFileManager *mgr)
|
|||
_sound->stopCD();
|
||||
_sound->pauseSounds(true);
|
||||
|
||||
CHECK_HEAP openRoom(-1);
|
||||
CHECK_HEAP
|
||||
closeRoom();
|
||||
memset(_inventory, 0, sizeof(_inventory[0]) * _numInventory);
|
||||
|
||||
/* Nuke all resources */
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
#include "stdafx.h"
|
||||
#include "scumm.h"
|
||||
#include "actor.h"
|
||||
#include "intern.h"
|
||||
#include "sound.h"
|
||||
#include "verbs.h"
|
||||
#include "scumm/sound.h"
|
||||
|
||||
#define OPCODE(x) { &Scumm_v5::x, #x }
|
||||
|
||||
|
|
|
@ -24,13 +24,14 @@
|
|||
#include "stdafx.h"
|
||||
#include "scumm.h"
|
||||
#include "actor.h"
|
||||
#include "imuse.h"
|
||||
#include "intern.h"
|
||||
#include "sound.h"
|
||||
#include "verbs.h"
|
||||
#include "smush/player.h"
|
||||
#include "smush/scumm_renderer.h"
|
||||
|
||||
#include "sound/mididrv.h"
|
||||
#include "scumm/sound.h"
|
||||
#include "scumm/imuse.h"
|
||||
|
||||
#include "dialogs.h" // FIXME: This is just for the FT-INSANE warning.
|
||||
// Remove when INSANE is implemented
|
||||
|
|
1040
scumm/script_v8.cpp
Normal file
1040
scumm/script_v8.cpp
Normal file
File diff suppressed because it is too large
Load diff
352
scumm/scumm.h
352
scumm/scumm.h
|
@ -48,7 +48,6 @@ extern Scumm *g_scumm;
|
|||
|
||||
/* System Wide Constants */
|
||||
enum {
|
||||
NUM_MIXER = 4,
|
||||
NUM_SCRIPT_SLOT = 40,
|
||||
NUM_LOCALSCRIPT = 60,
|
||||
NUM_SHADOW_PALETTE = 8,
|
||||
|
@ -528,6 +527,7 @@ public:
|
|||
|
||||
void allocateArrays();
|
||||
void openRoom(int room);
|
||||
void closeRoom();
|
||||
void deleteRoomOffsets();
|
||||
void readRoomsOffsets();
|
||||
void askForDisk(const char *filename);
|
||||
|
@ -1063,356 +1063,6 @@ public:
|
|||
void updatePalette();
|
||||
};
|
||||
|
||||
class Scumm_v5 : public Scumm
|
||||
{
|
||||
protected:
|
||||
typedef void (Scumm_v5::*OpcodeProcV5)();
|
||||
struct OpcodeEntryV5 {
|
||||
OpcodeProcV5 proc;
|
||||
const char *desc;
|
||||
};
|
||||
|
||||
const OpcodeEntryV5 *_opcodesV5;
|
||||
|
||||
public:
|
||||
Scumm_v5(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
|
||||
|
||||
protected:
|
||||
virtual void setupOpcodes();
|
||||
virtual void executeOpcode(int i);
|
||||
virtual const char *getOpcodeDesc(int i);
|
||||
|
||||
void decodeParseString();
|
||||
int getWordVararg(int16 *ptr);
|
||||
int getVarOrDirectWord(byte mask);
|
||||
int getVarOrDirectByte(byte mask);
|
||||
|
||||
/* Version 5 script opcodes */
|
||||
void o5_actorFollowCamera();
|
||||
void o5_actorFromPos();
|
||||
void o5_actorSet();
|
||||
void o5_add();
|
||||
void o5_and();
|
||||
void o5_animateActor();
|
||||
void o5_badOpcode();
|
||||
void o5_breakHere();
|
||||
void o5_chainScript();
|
||||
void o5_cursorCommand();
|
||||
void o5_cutscene();
|
||||
void o5_debug();
|
||||
void o5_decrement();
|
||||
void o5_delay();
|
||||
void o5_delayVariable();
|
||||
void o5_divide();
|
||||
void o5_doSentence();
|
||||
void o5_drawBox();
|
||||
void o5_drawObject();
|
||||
void o5_dummy();
|
||||
void o5_endCutscene();
|
||||
void o5_equalZero();
|
||||
void o5_expression();
|
||||
void o5_faceActor();
|
||||
void o5_findInventory();
|
||||
void o5_findObject();
|
||||
void o5_freezeScripts();
|
||||
void o5_getActorCostume();
|
||||
void o5_getActorElevation();
|
||||
void o5_getActorFacing();
|
||||
void o5_getActorMoving();
|
||||
void o5_getActorRoom();
|
||||
void o5_getActorScale();
|
||||
void o5_getActorWalkBox();
|
||||
void o5_getActorWidth();
|
||||
void o5_getActorX();
|
||||
void o5_getActorY();
|
||||
void o5_getAnimCounter();
|
||||
void o5_getClosestObjActor();
|
||||
void o5_getDist();
|
||||
void o5_getInventoryCount();
|
||||
void o5_getObjectOwner();
|
||||
void o5_getObjectState();
|
||||
void o5_getRandomNr();
|
||||
void o5_isScriptRunning();
|
||||
void o5_getVerbEntrypoint();
|
||||
void o5_ifClassOfIs();
|
||||
void o5_increment();
|
||||
void o5_isActorInBox();
|
||||
void o5_isEqual();
|
||||
void o5_isGreater();
|
||||
void o5_isGreaterEqual();
|
||||
void o5_isLess();
|
||||
void o5_isNotEqual();
|
||||
void o5_ifState();
|
||||
void o5_ifNotState();
|
||||
void o5_isSoundRunning();
|
||||
void o5_jumpRelative();
|
||||
void o5_lessOrEqual();
|
||||
void o5_lights();
|
||||
void o5_loadRoom();
|
||||
void o5_loadRoomWithEgo();
|
||||
void o5_matrixOps();
|
||||
void o5_move();
|
||||
void o5_multiply();
|
||||
void o5_notEqualZero();
|
||||
void o5_or();
|
||||
void o5_overRide();
|
||||
void o5_panCameraTo();
|
||||
void o5_pickupObject();
|
||||
void o5_print();
|
||||
void o5_printEgo();
|
||||
void o5_pseudoRoom();
|
||||
void o5_putActor();
|
||||
void o5_putActorAtObject();
|
||||
void o5_putActorInRoom();
|
||||
void o5_quitPauseRestart();
|
||||
void o5_resourceRoutines();
|
||||
void o5_roomOps();
|
||||
void o5_saveRestoreVerbs();
|
||||
void o5_setCameraAt();
|
||||
void o5_setClass();
|
||||
void o5_setObjectName();
|
||||
void o5_setOwnerOf();
|
||||
void o5_setState();
|
||||
void o5_setVarRange();
|
||||
void o5_soundKludge();
|
||||
void o5_startMusic();
|
||||
void o5_startObject();
|
||||
void o5_startScript();
|
||||
void o5_startSound();
|
||||
void o5_stopMusic();
|
||||
void o5_stopObjectCode();
|
||||
void o5_stopObjectScript();
|
||||
void o5_stopScript();
|
||||
void o5_stopSound();
|
||||
void o5_stringOps();
|
||||
void o5_subtract();
|
||||
void o5_verbOps();
|
||||
void o5_wait();
|
||||
void o5_walkActorTo();
|
||||
void o5_walkActorToActor();
|
||||
void o5_walkActorToObject();
|
||||
void o5_oldRoomEffect();
|
||||
void o5_pickupObjectOld();
|
||||
};
|
||||
|
||||
// FIXME - subclassing V2 from Scumm_v5 is a hack: V2 should have its own opcode table
|
||||
class Scumm_v2 : public Scumm_v5
|
||||
{
|
||||
public:
|
||||
Scumm_v2(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}
|
||||
|
||||
virtual void readIndexFile();
|
||||
};
|
||||
|
||||
// FIXME - maybe we should move the opcodes from v5 to v3, and change the inheritance
|
||||
// accordingly - that would be more logical I guess. However, if you do so, take care
|
||||
// of preserving the right readIndexFile / loadCharset !!!
|
||||
class Scumm_v3 : public Scumm_v5
|
||||
{
|
||||
public:
|
||||
Scumm_v3(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {}
|
||||
|
||||
void readIndexFile();
|
||||
virtual void loadCharset(int no);
|
||||
};
|
||||
|
||||
class Scumm_v4 : public Scumm_v3
|
||||
{
|
||||
public:
|
||||
Scumm_v4(GameDetector *detector, OSystem *syst) : Scumm_v3(detector, syst) {}
|
||||
|
||||
void loadCharset(int no);
|
||||
};
|
||||
|
||||
class Scumm_v6 : public Scumm
|
||||
{
|
||||
protected:
|
||||
typedef void (Scumm_v6::*OpcodeProcV6)();
|
||||
struct OpcodeEntryV6 {
|
||||
OpcodeProcV6 proc;
|
||||
const char *desc;
|
||||
};
|
||||
|
||||
const OpcodeEntryV6 *_opcodesV6;
|
||||
|
||||
public:
|
||||
Scumm_v6(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
|
||||
|
||||
protected:
|
||||
virtual void setupOpcodes();
|
||||
|
||||
virtual void executeOpcode(int i);
|
||||
virtual const char *getOpcodeDesc(int i);
|
||||
|
||||
int popRoomAndObj(int *room);
|
||||
|
||||
void decodeParseString2(int a, int b);
|
||||
int getStackList(int16 *args, uint maxnum);
|
||||
|
||||
/* Version 6 script opcodes */
|
||||
void o6_setBlastObjectWindow();
|
||||
void o6_pushByte();
|
||||
void o6_pushWord();
|
||||
void o6_pushByteVar();
|
||||
void o6_pushWordVar();
|
||||
void o6_invalid();
|
||||
void o6_byteArrayRead();
|
||||
void o6_wordArrayRead();
|
||||
void o6_byteArrayIndexedRead();
|
||||
void o6_wordArrayIndexedRead();
|
||||
void o6_dup();
|
||||
void o6_not();
|
||||
void o6_eq();
|
||||
void o6_neq();
|
||||
void o6_gt();
|
||||
void o6_lt();
|
||||
void o6_le();
|
||||
void o6_ge();
|
||||
void o6_add();
|
||||
void o6_sub();
|
||||
void o6_mul();
|
||||
void o6_div();
|
||||
void o6_land();
|
||||
void o6_lor();
|
||||
void o6_kill();
|
||||
void o6_writeByteVar();
|
||||
void o6_writeWordVar();
|
||||
void o6_byteArrayWrite();
|
||||
void o6_wordArrayWrite();
|
||||
void o6_byteArrayIndexedWrite();
|
||||
void o6_wordArrayIndexedWrite();
|
||||
void o6_byteVarInc();
|
||||
void o6_wordVarInc();
|
||||
void o6_byteArrayInc();
|
||||
void o6_wordArrayInc();
|
||||
void o6_byteVarDec();
|
||||
void o6_wordVarDec();
|
||||
void o6_byteArrayDec();
|
||||
void o6_wordArrayDec();
|
||||
void o6_jumpTrue();
|
||||
void o6_jumpFalse();
|
||||
void o6_jump();
|
||||
void o6_startScriptEx();
|
||||
void o6_startScript();
|
||||
void o6_startObject();
|
||||
void o6_setObjectState();
|
||||
void o6_setObjectXY();
|
||||
void o6_stopObjectCode();
|
||||
void o6_endCutscene();
|
||||
void o6_cutScene();
|
||||
void o6_stopMusic();
|
||||
void o6_freezeUnfreeze();
|
||||
void o6_cursorCommand();
|
||||
void o6_breakHere();
|
||||
void o6_ifClassOfIs();
|
||||
void o6_setClass();
|
||||
void o6_getState();
|
||||
void o6_setState();
|
||||
void o6_setOwner();
|
||||
void o6_getOwner();
|
||||
void o6_startSound();
|
||||
void o6_stopSound();
|
||||
void o6_startMusic();
|
||||
void o6_stopObjectScript();
|
||||
void o6_panCameraTo();
|
||||
void o6_actorFollowCamera();
|
||||
void o6_setCameraAt();
|
||||
void o6_loadRoom();
|
||||
void o6_stopScript();
|
||||
void o6_walkActorToObj();
|
||||
void o6_walkActorTo();
|
||||
void o6_putActorInRoom();
|
||||
void o6_putActorAtObject();
|
||||
void o6_faceActor();
|
||||
void o6_animateActor();
|
||||
void o6_doSentence();
|
||||
void o6_pickupObject();
|
||||
void o6_loadRoomWithEgo();
|
||||
void o6_getRandomNumber();
|
||||
void o6_getRandomNumberRange();
|
||||
void o6_getActorMoving();
|
||||
void o6_isScriptRunning();
|
||||
void o6_getActorRoom();
|
||||
void o6_getObjectX();
|
||||
void o6_getObjectY();
|
||||
void o6_getObjectOldDir();
|
||||
void o6_getObjectNewDir();
|
||||
void o6_getActorWalkBox();
|
||||
void o6_getActorCostume();
|
||||
void o6_findInventory();
|
||||
void o6_getInventoryCount();
|
||||
void o6_getVerbFromXY();
|
||||
void o6_beginOverride();
|
||||
void o6_endOverride();
|
||||
void o6_setObjectName();
|
||||
void o6_isSoundRunning();
|
||||
void o6_setBoxFlags();
|
||||
void o6_createBoxMatrix();
|
||||
void o6_resourceRoutines();
|
||||
void o6_roomOps();
|
||||
void o6_actorSet();
|
||||
void o6_verbOps();
|
||||
void o6_getActorFromXY();
|
||||
void o6_findObject();
|
||||
void o6_pseudoRoom();
|
||||
void o6_getActorElevation();
|
||||
void o6_getVerbEntrypoint();
|
||||
void o6_arrayOps();
|
||||
void o6_saveRestoreVerbs();
|
||||
void o6_drawBox();
|
||||
void o6_getActorWidth();
|
||||
void o6_wait();
|
||||
void o6_getActorScaleX();
|
||||
void o6_getActorAnimCounter1();
|
||||
void o6_soundKludge();
|
||||
void o6_isAnyOf();
|
||||
void o6_quitPauseRestart();
|
||||
void o6_isActorInBox();
|
||||
void o6_delay();
|
||||
void o6_delayLonger();
|
||||
void o6_delayVeryLong();
|
||||
void o6_stopSentence();
|
||||
void o6_print_0();
|
||||
void o6_print_1();
|
||||
void o6_print_2();
|
||||
void o6_print_3();
|
||||
void o6_printActor();
|
||||
void o6_printEgo();
|
||||
void o6_talkActor();
|
||||
void o6_talkEgo();
|
||||
void o6_dim();
|
||||
void o6_dummy();
|
||||
void o6_runVerbCodeQuick();
|
||||
void o6_runScriptQuick();
|
||||
void o6_dim2();
|
||||
void o6_abs();
|
||||
void o6_distObjectObject();
|
||||
void o6_distObjectPt();
|
||||
void o6_distPtPt();
|
||||
void o6_miscOps();
|
||||
void o6_delayFrames();
|
||||
void o6_pickOneOf();
|
||||
void o6_pickOneOfDefault();
|
||||
void o6_jumpToScript();
|
||||
void o6_isRoomScriptRunning();
|
||||
void o6_kernelFunction();
|
||||
void o6_getAnimateVariable();
|
||||
void o6_drawBlastObject();
|
||||
void o6_getActorPriority();
|
||||
void o6_unknownCD();
|
||||
void o6_bor();
|
||||
void o6_band();
|
||||
};
|
||||
|
||||
class Scumm_v7 : public Scumm_v6
|
||||
{
|
||||
public:
|
||||
Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm_v6(detector, syst) {}
|
||||
|
||||
protected:
|
||||
virtual void setupScummVars();
|
||||
};
|
||||
|
||||
// This is a constant lookup table of reverse bit masks
|
||||
extern const byte revBitMask[8];
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "debugger.h"
|
||||
#include "dialogs.h"
|
||||
#include "imuse.h"
|
||||
#include "intern.h"
|
||||
#include "object.h"
|
||||
#include "resource.h"
|
||||
#include "sound.h"
|
||||
|
@ -61,6 +62,8 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst)
|
|||
engine = new Scumm_v3(detector, syst);
|
||||
else if (detector->_features & GF_SMALL_HEADER) // this forces loomCD as v4
|
||||
engine = new Scumm_v4(detector, syst);
|
||||
else if (detector->_features & GF_AFTER_V8)
|
||||
engine = new Scumm_v8(detector, syst);
|
||||
else if (detector->_features & GF_AFTER_V7)
|
||||
engine = new Scumm_v7(detector, syst);
|
||||
else if (detector->_features & GF_AFTER_V6) // this forces SamnmaxCD as v6
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "scumm.h"
|
||||
#include "intern.h"
|
||||
|
||||
void Scumm::setupScummVars()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue