[Scummvm-cvs-logs] CVS: scummvm/scumm script_v72he.cpp,NONE,2.1 intern.h,2.181,2.182 module.mk,1.39,1.40 script_v6.cpp,1.382,1.383 script_v7he.cpp,2.41,2.42

Travis Howell kirben at users.sourceforge.net
Mon Aug 23 03:37:02 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32723/scumm

Modified Files:
	intern.h module.mk script_v6.cpp script_v7he.cpp 
Added Files:
	script_v72he.cpp 
Log Message:

Add He 7.2 class


--- NEW FILE: script_v72he.cpp ---
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2001  Ludvig Strigeus
 * Copyright (C) 2001-2004 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: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v 2.1 2004/08/23 10:34:50 kirben Exp $
 *
 */


#include "stdafx.h"

#include "common/config-manager.h"

#include "scumm/actor.h"
#include "scumm/charset.h"
#include "scumm/intern.h"
#include "scumm/object.h"
#include "scumm/resource.h"
#include "scumm/resource_v7he.h"
#include "scumm/scumm.h"
#include "scumm/sound.h"
#include "scumm/verbs.h"
#include "scumm/smush/smush_player.h"

#include "sound/mididrv.h"
#include "sound/mixer.h"

namespace Scumm {

#define OPCODE(x)	{ &ScummEngine_v72he::x, #x }

void ScummEngine_v72he::setupOpcodes() {
	static const OpcodeEntryV72he opcodes[256] = {
		/* 00 */
		OPCODE(o6_pushByte),
		OPCODE(o6_pushWord),
		OPCODE(o6_pushByteVar),
		OPCODE(o6_pushWordVar),
		/* 04 */
		OPCODE(o7_getString),
		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(o7_objectX),
		OPCODE(o7_objectY),
		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(o7_startScript),
		OPCODE(o6_startScriptQuick),
		/* 60 */
		OPCODE(o6_startObject),
		OPCODE(o6_drawObject),
		OPCODE(o6_drawObjectAt),
		OPCODE(o7_unknown63),
		/* 64 */
		OPCODE(o6_invalid),
		OPCODE(o6_stopObjectCode),
		OPCODE(o6_stopObjectCode),
		OPCODE(o6_endCutscene),
		/* 68 */
		OPCODE(o6_cutscene),
		OPCODE(o6_stopMusic),
		OPCODE(o6_freezeUnfreeze),
		OPCODE(o7_cursorCommand),
		/* 6C */
		OPCODE(o6_breakHere),
		OPCODE(o6_ifClassOfIs),
		OPCODE(o6_setClass),
		OPCODE(o6_getState),
		/* 70 */
		OPCODE(o6_setState),
		OPCODE(o6_setOwner),
		OPCODE(o6_getOwner),
		OPCODE(o6_jump),
		/* 74 */
		OPCODE(o7_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(o7_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(o7_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(o6_resourceRoutines),
		/* 9C */
		OPCODE(o6_roomOps),
		OPCODE(o6_actorOps),
		OPCODE(o6_verbOps),
		OPCODE(o6_getActorFromXY),
		/* A0 */
		OPCODE(o6_findObject),
		OPCODE(o6_pseudoRoom),
		OPCODE(o6_getActorElevation),
		OPCODE(o6_getVerbEntrypoint),
		/* A4 */
		OPCODE(o7_arrayOps),
		OPCODE(o6_saveRestoreVerbs),
		OPCODE(o6_drawBox),
		OPCODE(o6_pop),
		/* A8 */
		OPCODE(o6_getActorWidth),
		OPCODE(o6_wait),
		OPCODE(o6_getActorScaleX),
		OPCODE(o6_getActorAnimCounter1),
		/* AC */
		OPCODE(o6_invalid),
		OPCODE(o6_isAnyOf),
		OPCODE(o7_quitPauseRestart),
		OPCODE(o6_isActorInBox),
		/* B0 */
		OPCODE(o6_delay),
		OPCODE(o6_delaySeconds),
		OPCODE(o6_delayMinutes),
		OPCODE(o6_stopSentence),
		/* B4 */
		OPCODE(o6_printLine),
		OPCODE(o6_printCursor),
		OPCODE(o6_printDebug),
		OPCODE(o6_printSystem),
		/* B8 */
		OPCODE(o6_printActor),
		OPCODE(o6_printEgo),
		OPCODE(o6_talkActor),
		OPCODE(o6_talkEgo),
		/* BC */
		OPCODE(o7_dimArray),
		OPCODE(o6_dummy),
		OPCODE(o6_startObjectQuick),
		OPCODE(o6_startScriptQuick2),
		/* C0 */
		OPCODE(o7_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(o6_kernelGetFunctions),
		OPCODE(o6_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(o7_jumpToScript),
		OPCODE(o6_band),
		OPCODE(o6_bor),
		/* D8 */
		OPCODE(o6_isRoomScriptRunning),
		OPCODE(o6_closeFile),
		OPCODE(o6_openFile),
		OPCODE(o6_readFile),
		/* DC */
		OPCODE(o6_writeFile),
		OPCODE(o6_findAllObjects),
		OPCODE(o6_deleteFile),
		OPCODE(o6_rename),
		/* E0 */
		OPCODE(o6_soundOps),
		OPCODE(o6_getPixel),
		OPCODE(o6_localizeArray),
		OPCODE(o6_pickVarRandom),
		/* E4 */
		OPCODE(o6_setBoxSet),
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
		/* E8 */
		OPCODE(o6_invalid),
		OPCODE(o6_seekFilePos),
		OPCODE(o6_redimArray),
		OPCODE(o6_readFilePos),
		/* EC */
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
		OPCODE(o7_stringLen),
		OPCODE(o6_invalid),
		/* F0 */
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
		OPCODE(o7_readINI),
		/* F4 */
		OPCODE(o7_unknownF4),
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
		/* F8 */
		OPCODE(o6_invalid),
		OPCODE(o7_unknownF9),
		OPCODE(o7_unknownFA),
		OPCODE(o7_unknownFB),
		/* FC */
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
		OPCODE(o6_invalid),
	};

	_opcodesV72he = opcodes;
}

void ScummEngine_v72he::executeOpcode(byte i) {
	OpcodeProcV72he op = _opcodesV72he[i].proc;
	(this->*op) ();
}

const char *ScummEngine_v72he::getOpcodeDesc(byte i) {
	return _opcodesV72he[i].desc;
}


void ScummEngine_v72he::o7_objectX() {
	int object = pop();
	int objnum = getObjectIndex(object);

	if (objnum == -1) {
		push(0);
		return;
	}

	push(_objs[objnum].x_pos);
}


void ScummEngine_v72he::o7_objectY() {
	int object = pop();
	int objnum = getObjectIndex(object);

	if (objnum == -1) {
		push(0);
		return;
	}

	push(_objs[objnum].y_pos);
}

void ScummEngine_v72he::o7_getString() {
	int len;
	
	len = resStrLen(_scriptPointer);
	warning("stub o7_getString(\"%s\")", _scriptPointer);
	_scriptPointer += len;
	fetchScriptWord();
	fetchScriptWord();
}

void ScummEngine_v72he::o7_unknown63() {
	int a = fetchScriptByte();
	warning("o7_unknown63 stub (%d)", a);
	push(1);
}

void ScummEngine_v72he::o7_unknownFA() {
	warning("stub o7_unknownFA(%d)", fetchScriptByte());
}

void ScummEngine_v72he::o7_stringLen() {
	int a, len;
	byte *addr;

	a = pop();

	addr = getStringAddress(a);
	if (!addr) {
		// FIXME: should be error here
		warning("o7_stringLen: Reference to zeroed array pointer (%d)", a);
		push(0);
		return;
	}

	len = strlen((char *)getStringAddress(a));
	push(len);
}

void ScummEngine_v72he::o7_readINI() {
	int type;
	int retval;

	// we pretend that we don't have .ini file
	type = fetchScriptByte();
	switch (type) {
	case 6: // number
		push(0);
		break;
	case 7: // string
		defineArray(0, kStringArray, 0, 0);
		retval = readVar(0);
		writeArray(0, 0, 0, 0);
		push(retval); // var ID string
		break;
	default:
		warning("o7_readINI(..., %d): read-ini string not implemented", type);
	}
}

void ScummEngine_v72he::o7_unknownF4() {
	byte b;
	int len;
	b = fetchScriptByte();

	switch (b) {
	case 6:
		pop();
		len = resStrLen(_scriptPointer);
		_scriptPointer += len + 1;
		break;
	case 7:
		len = resStrLen(_scriptPointer);
		_scriptPointer += len + 1;
		len = resStrLen(_scriptPointer);
		_scriptPointer += len + 1;
		break;
	}
	warning("o7_unknownF4 stub");
}

void ScummEngine_v72he::o7_unknownFB() {
	byte b;
	b = fetchScriptByte();

	switch (b) {
	case 246:
	case 248:
		pop();
		pop();
		pop();
		pop();
		pop();
		pop();
		pop();
		pop();
		pop();
		break;
	case 247:
		pop();
		pop();
		break;
	}
	warning("o7_unknownFB stub");
}

void ScummEngine_v72he::o7_dim2dimArray() {
	if (_heversion <= 71) {
		ScummEngine_v6::o6_dim2dimArray();
		return;
	}

	int a, b, data;
	int type = fetchScriptByte();
	switch (type - 2) {
	case 0:		// SO_INT_ARRAY
		data = kIntArray;
		break;
	case 1:		// SO_BIT_ARRAY
		data = kBitArray;
		break;
	case 2:		// SO_NIBBLE_ARRAY
		data = kNibbleArray;
		break;
	case 3:		// SO_BYTE_ARRAY
		data = kByteArray;
		break;
	case 4:		// SO_STRING_ARRAY
		data = kStringArray;
		break;
	default:
		error("o7_dim2dimArray: default case %d", type);
	}

	b = pop();
	a = pop();
	defineArray(fetchScriptWord(), data, a, b);
}

void ScummEngine_v72he::o7_dimArray() {
	if (_heversion <= 71) {
		ScummEngine_v6::o6_dimArray();
		return;
	}

	int data;
	int type = fetchScriptByte();

	switch (type) {
	case 5:		// SO_INT_ARRAY
		data = kIntArray;
		break;
	case 2:		// SO_BIT_ARRAY
		data = kBitArray;
		break;
	case 3:		// SO_NIBBLE_ARRAY
		data = kNibbleArray;
		break;
	case 4:		// SO_BYTE_ARRAY
		data = kByteArray;
		break;
	case 7:		// SO_STRING_ARRAY
		data = kStringArray;
		break;
	case 204:		// SO_UNDIM_ARRAY
		nukeArray(fetchScriptWord());
		return;
	default:
		error("o7_dimArray: default case %d", type);
	}

	defineArray(fetchScriptWord(), data, 0, pop());
}

void ScummEngine_v72he::o7_arrayOps() {
	byte subOp = fetchScriptByte();
	int array = fetchScriptWord();
	int b, c, d, len;
	ArrayHeader *ah;
	int list[128];

	switch (subOp) {
	case 7:			// SO_ASSIGN_STRING
		len = resStrLen(_scriptPointer);
		ah = defineArray(array, kStringArray, 0, len + 1);
		copyScriptString(ah->data);
		break;
	case 205:		// SO_ASSIGN_STRING
		b = pop();
		len = resStrLen(_scriptPointer);
		ah = defineArray(array, kStringArray, 0, len + 1);
		copyScriptString(ah->data + b);
		break;
	case 208:		// SO_ASSIGN_INT_LIST
		b = pop();
		c = pop();
		d = readVar(array);
		if (d == 0) {
			defineArray(array, kIntArray, 0, b + c);
		}
		while (c--) {
			writeArray(array, 0, b + c, pop());
		}
		break;
	case 212:		// SO_ASSIGN_2DIM_LIST
		b = pop();
		len = getStackList(list, ARRAYSIZE(list));
		d = readVar(array);
		if (d == 0)
			error("Must DIM a two dimensional array before assigning");
		c = pop();
		while (--len >= 0) {
			writeArray(array, c, b + len, list[len]);
		}
		break;
	default:
		error("o7_arrayOps: default case %d (array %d)", subOp, array);
	}
}

void ScummEngine_v72he::o7_jumpToScript() {
	if (_heversion <= 71) {
		ScummEngine_v6::o6_jumpToScript();
		return;
	}
	int args[16];
	int script, flags;

	getStackList(args, ARRAYSIZE(args));
	script = pop();
	flags = fetchScriptByte();
	stopObjectCode();
	runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
}

void ScummEngine_v72he::o7_startScript() {
	if (_heversion <= 71) {
		ScummEngine_v6::o6_startScript();
		return;
	}

	int args[16];
	int script, flags;

	getStackList(args, ARRAYSIZE(args));
	script = pop();
	flags = fetchScriptByte();
	
	runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
}

} // End of namespace Scumm

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.181
retrieving revision 2.182
diff -u -d -r2.181 -r2.182
--- intern.h	23 Aug 2004 09:18:54 -0000	2.181
+++ intern.h	23 Aug 2004 10:34:50 -0000	2.182
@@ -623,8 +623,6 @@
 
 	/* Version 7 script opcodes */
 	void o7_getString();
-	void o7_objectX();
-	void o7_objectY();
 	void o7_stringLen();
 	void o7_readINI();
 	void o7_unknownF4();
@@ -634,12 +632,47 @@
 	void o7_quitPauseRestart();
 	void o7_getActorRoom();
 	void o7_pickupObject();
+	void o7_startSound();
+	void o7_cursorCommand();
+};
+
+class ScummEngine_v72he : public ScummEngine_v7he {
+protected:
+	typedef void (ScummEngine_v72he::*OpcodeProcV72he)();
+	struct OpcodeEntryV72he {
+		OpcodeProcV72he proc;
+		const char *desc;
+	};
+	
+	const OpcodeEntryV72he *_opcodesV72he;
+
+public:
+	ScummEngine_v72he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs);
+
+protected:
+	virtual void setupScummVars();
+
+	virtual void setupOpcodes();
+	virtual void executeOpcode(byte i);
+	virtual const char *getOpcodeDesc(byte i);
+
+	byte stringLen(byte *);
+
+	/* Version 7 script opcodes */
+	void o7_getString();
+	void o7_objectX();
+	void o7_objectY();
+	void o7_stringLen();
+	void o7_readINI();
+	void o7_unknownF4();
+	void o7_unknownFA();
+	void o7_unknownFB();
 	void o7_arrayOps();
 	void o7_dimArray();
 	void o7_jumpToScript();
 	void o7_startScript();
-	void o7_startSound();
-	void o7_cursorCommand();
+	void o7_unknown63();
+	void o7_dim2dimArray();
 };
 
 class ScummEngine_v7 : public ScummEngine_v6 {

Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- module.mk	22 Aug 2004 10:52:55 -0000	1.39
+++ module.mk	23 Aug 2004 10:34:50 -0000	1.40
@@ -39,6 +39,7 @@
 	scumm/script_v6.o \
 	scumm/script_v6he.o \
 	scumm/script_v7he.o \
+	scumm/script_v72he.o \
 	scumm/script_v8.o \
 	scumm/scumm.o \
 	scumm/sound.o \

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.382
retrieving revision 1.383
diff -u -d -r1.382 -r1.383
--- script_v6.cpp	22 Aug 2004 23:38:00 -0000	1.382
+++ script_v6.cpp	23 Aug 2004 10:34:50 -0000	1.383
@@ -1653,6 +1653,34 @@
 			// QL_QueGlobForLoad(1, resid, 1);
 			break;
 		}
+	case 201:
+		{
+			if (_heversion < 70)
+				error("o6_resourceRoutines: default case %d", op);
+
+			resid = pop();
+			ensureResourceLoaded(rtImage, resid);
+			break;
+		}
+	case 202:
+		{
+			if (_heversion < 70)
+				error("o6_resourceRoutines: default case %d", op);
+
+			resid = pop();
+			lock(rtImage, resid);
+			break;
+		}
+	case 203:
+		{
+			if (_heversion < 70)
+				error("o6_resourceRoutines: default case %d", op);
+
+			resid = pop();
+			debug(1,"stub stub queueload resource 19, %d", resid);
+			// QL_QueGlobForLoad(19, resid, 1);
+			break;
+		}
 	case 233:
 		resid = pop();
 		debug(1,"stub o6_resourceRoutines resource %d, 1", resid);

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.41
retrieving revision 2.42
diff -u -d -r2.41 -r2.42
--- script_v7he.cpp	23 Aug 2004 09:25:37 -0000	2.41
+++ script_v7he.cpp	23 Aug 2004 10:34:50 -0000	2.42
@@ -57,7 +57,7 @@
 		OPCODE(o6_pushByteVar),
 		OPCODE(o6_pushWordVar),
 		/* 04 */
-		OPCODE(o7_getString),
+		OPCODE(o6_invalid),
 		OPCODE(o6_invalid),
 		OPCODE(o6_byteArrayRead),
 		OPCODE(o6_wordArrayRead),
@@ -157,8 +157,8 @@
 		OPCODE(o6_byteArrayInc),
 		OPCODE(o6_wordArrayInc),
 		/* 54 */
-		OPCODE(o7_objectX),
-		OPCODE(o7_objectY),
+		OPCODE(o6_invalid),
+		OPCODE(o6_invalid),
 		OPCODE(o6_byteVarDec),
 		OPCODE(o6_wordVarDec),
 		/* 58 */
@@ -169,7 +169,7 @@
 		/* 5C */
 		OPCODE(o6_if),
 		OPCODE(o6_ifNot),
-		OPCODE(o7_startScript),
+		OPCODE(o6_startScript),
 		OPCODE(o6_startScriptQuick),
 		/* 60 */
 		OPCODE(o6_startObject),
@@ -257,7 +257,7 @@
 		OPCODE(o6_getActorElevation),
 		OPCODE(o6_getVerbEntrypoint),
 		/* A4 */
-		OPCODE(o7_arrayOps),
+		OPCODE(o6_arrayOps),
 		OPCODE(o6_saveRestoreVerbs),
 		OPCODE(o6_drawBox),
 		OPCODE(o6_pop),
@@ -287,7 +287,7 @@
 		OPCODE(o6_talkActor),
 		OPCODE(o6_talkEgo),
 		/* BC */
-		OPCODE(o7_dimArray),
+		OPCODE(o6_dimArray),
 		OPCODE(o6_dummy),
 		OPCODE(o6_startObjectQuick),
 		OPCODE(o6_startScriptQuick2),
@@ -318,7 +318,7 @@
 		OPCODE(o6_invalid),
 		/* D4 */
 		OPCODE(o6_shuffle),
-		OPCODE(o7_jumpToScript),
+		OPCODE(o6_jumpToScript),
 		OPCODE(o6_band),
 		OPCODE(o6_bor),
 		/* D8 */
@@ -386,59 +386,11 @@
 }
 
 
-void ScummEngine_v7he::o7_objectX() {
-	if (_heversion <= 71) {
-		o6_invalid();
-	}
-
-	int object = pop();
-	int objnum = getObjectIndex(object);
-
-	if (objnum == -1) {
-		push(0);
-		return;
-	}
-
-	push(_objs[objnum].x_pos);
-}
-
-
-void ScummEngine_v7he::o7_objectY() {
-	if (_heversion <= 71) {
-		o6_invalid();
-	}
-
-	int object = pop();
-	int objnum = getObjectIndex(object);
-
-	if (objnum == -1) {
-		push(0);
-		return;
-	}
-
-	push(_objs[objnum].y_pos);
-}
-
-void ScummEngine_v7he::o7_getString() {
-	int len;
-	
-	len = resStrLen(_scriptPointer);
-	warning("stub o7_getString(\"%s\")", _scriptPointer);
-	_scriptPointer += len;
-	fetchScriptWord();
-	fetchScriptWord();
-}
-
 void ScummEngine_v7he::o7_unknownFA() {
-	int len, a = fetchScriptByte();
-	
-	if (_heversion <= 71) {
-		len = resStrLen(_scriptPointer);
-		warning("stub o7_unknownFA(%d, \"%s\")", a, _scriptPointer);
-		_scriptPointer += len + 1;
-	} else {
-		warning("stub o7_unknownFA(%d)", a);
-	}
+	int num = fetchScriptByte();
+	int len = resStrLen(_scriptPointer);
+	warning("stub o7_unknownFA(%d, \"%s\")", num, _scriptPointer);
+	_scriptPointer += len + 1;
 }
 
 void ScummEngine_v7he::o7_stringLen() {
@@ -455,11 +407,7 @@
 		return;
 	}
 
-	if (_gameId == GID_FREDDEMO) {
-		len = strlen((char *)getStringAddress(a));
-	} else { // FREDDI, PUTTMOON
-		len = stringLen(addr);
-	}
+	len = stringLen(addr);
 	push(len);
 }
 
@@ -496,22 +444,14 @@
 	int retval;
 
 	// we pretend that we don't have .ini file
-	if (_heversion <= 71) {
-		len = resStrLen(_scriptPointer);
-		_scriptPointer += len + 1;
-		type = pop();
-	} else {
-		type = fetchScriptByte();
-	}
-
-
+	len = resStrLen(_scriptPointer);
+	_scriptPointer += len + 1;
+	type = pop();
 	switch (type) {
 	case 1: // number
-	case 6: // HE 7.2
 		push(0);
 		break;
 	case 2: // string
-	case 7: // HE 7.2
 		defineArray(0, kStringArray, 0, 0);
 		retval = readVar(0);
 		writeArray(0, 0, 0, 0);
@@ -523,54 +463,34 @@
 }
 
 void ScummEngine_v7he::o7_unknownF4() {
-	if (_gameId == GID_FREDDEMO) {
-		byte b;
-		int len;
-		b = fetchScriptByte();
-
-		switch (b) {
-		case 6:
-			pop();
-			len = resStrLen(_scriptPointer);
-			_scriptPointer += len + 1;
-			break;
-		case 7:
-			len = resStrLen(_scriptPointer);
-			_scriptPointer += len + 1;
-			len = resStrLen(_scriptPointer);
-			_scriptPointer += len + 1;
-			break;
-		}
-	} else { // FREDDI, PUTTMOON
-		int a, b;
-		byte filename1[256], filename2[256];
-		int len;
+	int a, b;
+	byte filename1[256], filename2[256];
+	int len;
 
-		
-		b = pop();
-		a = pop();
+	
+	b = pop();
+	a = pop();
 
-		switch (b) {
-		case 1:
-			addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
+	switch (b) {
+	case 1:
+		addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
 
-			len = resStrLen(_scriptPointer);
-			_scriptPointer += len + 1;
-			debug(1, "o7_unknownF4(%d, %d, \"%s\")", a, b, filename1);
-			break;
-		case 2:
-			addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
+		len = resStrLen(_scriptPointer);
+		_scriptPointer += len + 1;
+		debug(1, "o7_unknownF4(%d, %d, \"%s\")", a, b, filename1);
+		break;
+	case 2:
+		addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
 
-			len = resStrLen(_scriptPointer);
-			_scriptPointer += len + 1;
+		len = resStrLen(_scriptPointer);
+		_scriptPointer += len + 1;
 
-			addMessageToStack(_scriptPointer, filename2, sizeof(filename2));
+		addMessageToStack(_scriptPointer, filename2, sizeof(filename2));
 
-			len = resStrLen(_scriptPointer);
-			_scriptPointer += len + 1;
-			debug(1, "o7_unknownF4(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
-			break;
-		}
+		len = resStrLen(_scriptPointer);
+		_scriptPointer += len + 1;
+		debug(1, "o7_unknownF4(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
+		break;
 	}
 	warning("o7_unknownF4 stub");
 }
@@ -677,118 +597,6 @@
 		push(getObjectRoom(act));
 }
 
-void ScummEngine_v7he::o7_dimArray() {
-	if (_heversion <= 71) {
-		ScummEngine_v6::o6_dimArray();
-		return;
-	}
-
-	int data;
-	int type = fetchScriptByte();
-
-	switch (type) {
-	case 5:		// SO_INT_ARRAY
-		data = kIntArray;
-		break;
-	case 2:		// SO_BIT_ARRAY
-		data = kBitArray;
-		break;
-	case 3:		// SO_NIBBLE_ARRAY
-		data = kNibbleArray;
-		break;
-	case 4:		// SO_BYTE_ARRAY
-		data = kByteArray;
-		break;
-	case 7:		// SO_STRING_ARRAY
-		data = kStringArray;
-		break;
-	case 204:		// SO_UNDIM_ARRAY
-		nukeArray(fetchScriptWord());
-		return;
-	default:
-		error("o7_dimArray: default case %d", type);
-	}
-
-	defineArray(fetchScriptWord(), data, 0, pop());
-}
-
-void ScummEngine_v7he::o7_arrayOps() {
-	byte subOp = fetchScriptByte();
-	int array = fetchScriptWord();
-	int b, c, d, len;
-	ArrayHeader *ah;
-	int list[128];
-
-	switch (subOp) {
-	case 7:			// SO_ASSIGN_STRING
-		len = resStrLen(_scriptPointer);
-		ah = defineArray(array, kStringArray, 0, len + 1);
-		copyScriptString(ah->data);
-		break;
-	case 205:		// SO_ASSIGN_STRING
-		b = pop();
-		len = resStrLen(_scriptPointer);
-		ah = defineArray(array, kStringArray, 0, len + 1);
-		copyScriptString(ah->data + b);
-		break;
-	case 208:		// SO_ASSIGN_INT_LIST
-		b = pop();
-		c = pop();
-		d = readVar(array);
-		if (d == 0) {
-			defineArray(array, kIntArray, 0, b + c);
-		}
-		while (c--) {
-			writeArray(array, 0, b + c, pop());
-		}
-		break;
-	case 212:		// SO_ASSIGN_2DIM_LIST
-		b = pop();
-		len = getStackList(list, ARRAYSIZE(list));
-		d = readVar(array);
-		if (d == 0)
-			error("Must DIM a two dimensional array before assigning");
-		c = pop();
-		while (--len >= 0) {
-			writeArray(array, c, b + len, list[len]);
-		}
-		break;
-	default:
-		error("o7_arrayOps: default case %d (array %d)", subOp, array);
-	}
-}
-
-void ScummEngine_v7he::o7_jumpToScript() {
-	if (_heversion <= 71) {
-		ScummEngine_v6::o6_jumpToScript();
-		return;
-	}
-	int args[16];
-	int script, flags;
-
-	getStackList(args, ARRAYSIZE(args));
-	script = pop();
-	flags = fetchScriptByte();
-	stopObjectCode();
-	runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
-}
-
-void ScummEngine_v7he::o7_startScript() {
-	if (_heversion <= 71) {
-		ScummEngine_v6::o6_startScript();
-		return;
-	}
-
-	int args[16];
-	int script, flags;
-
-	getStackList(args, ARRAYSIZE(args));
-	script = pop();
-	flags = fetchScriptByte();
-	
-	runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
-}
-
 void ScummEngine_v7he::o7_startSound() {
 	byte op;
 	op = fetchScriptByte();
@@ -885,7 +693,7 @@
 		setCursorTransparency(pop());
 		break;
 	default:
-		error("o6_cursorCommand: default case %x", subOp);
+		error("o7_cursorCommand: default case %x", subOp);
 	}
 
 	VAR(VAR_CURSORSTATE) = _cursor.state;





More information about the Scummvm-git-logs mailing list