[Scummvm-cvs-logs] CVS: scummvm/scumm script.h,NONE,2.1 actor.cpp,1.167,1.168 boxes.cpp,1.59,1.60 debugger.cpp,1.81,1.82 object.h,1.5,1.6 resource.cpp,1.157,1.158 resource.h,1.5,1.6 saveload.cpp,1.108,1.109 script.cpp,1.131,1.132 script_v2.cpp,2.195,2.196 script_v5.cpp,1.181,1.182 script_v6.cpp,1.185,1.186 script_v8.cpp,2.192,2.193 scumm.h,1.299,1.300 scummvm.cpp,2.385,2.386 string.cpp,1.158,1.159

Max Horn fingolfin at users.sourceforge.net
Thu Sep 11 03:37:34 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv23721

Modified Files:
	actor.cpp boxes.cpp debugger.cpp object.h resource.cpp 
	resource.h saveload.cpp script.cpp script_v2.cpp script_v5.cpp 
	script_v6.cpp script_v8.cpp scumm.h scummvm.cpp string.cpp 
Added Files:
	script.h 
Log Message:
cleanup

--- NEW FILE: script.h ---
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2001  Ludvig Strigeus
 * Copyright (C) 2001-2003 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.h,v 2.1 2003/09/11 10:32:14 fingolfin Exp $
 *
 */

#ifndef SCRIPT_H
#define SCRIPT_H

#include "common/engine.h"


/* System Wide Constants */
enum {
	NUM_SCRIPT_SLOT = 80
};

/* Script status type (slot.status) */
enum {
	ssDead = 0,
	ssPaused = 1,
	ssRunning = 2
};

struct ScriptSlot {
	uint32 offs;
	int32 delay;
	uint16 number;
	uint16 delayFrameCount;
	bool freezeResistant, recursive;
	bool didexec;
	byte status;
	byte where;
	byte freezeCount;
	byte cutsceneOverride;
};

struct NestedScript {
	uint16 number;
	uint8 where;
	uint8 slot;
};

struct VirtualMachineState {
	uint32 cutScenePtr[5];
	byte cutSceneScript[5];
	int16 cutSceneData[5];
	int16 cutSceneScriptIndex;
	byte cutSceneStackPointer;
	ScriptSlot slot[NUM_SCRIPT_SLOT];
	int32 localvar[NUM_SCRIPT_SLOT][26];

	NestedScript nest[15];
	byte numNestedScripts;
};


#endif

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- actor.cpp	9 Sep 2003 17:33:29 -0000	1.167
+++ actor.cpp	11 Sep 2003 10:32:14 -0000	1.168
@@ -32,8 +32,6 @@
 #include "sound.h"
 #include "usage_bits.h"
 
-#include <math.h>
-
 byte Actor::kInvalidBox = 0;
 Scumm *Actor::_vm = 0;
 

Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/boxes.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- boxes.cpp	9 Sep 2003 17:29:21 -0000	1.59
+++ boxes.cpp	11 Sep 2003 10:32:14 -0000	1.60
@@ -26,8 +26,6 @@
 #include "boxes.h"
 #include "common/util.h"
 
-#include <math.h>
-
 #if !defined(__GNUC__)
 	#pragma START_PACK_STRUCTS
 #endif

Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- debugger.cpp	8 Sep 2003 17:06:44 -0000	1.81
+++ debugger.cpp	11 Sep 2003 10:32:14 -0000	1.82
@@ -19,15 +19,18 @@
  *
  */
 #include "stdafx.h"
-#include "scumm.h"
-#include "sound.h"
-#include "actor.h"
-#include "boxes.h"
-#include "imuse.h"
-#include "player_v2.h"
-#include "debugger.h"
-#include "common/util.h"
+
 #include "common/file.h"
+#include "common/util.h"
+
+#include "scumm/actor.h"
+#include "scumm/boxes.h"
+#include "scumm/debugger.h"
+#include "scumm/imuse.h"
+#include "scumm/object.h"
+#include "scumm/player_v2.h"
+#include "scumm/scumm.h"
+#include "scumm/sound.h"
 
 #if USE_CONSOLE
 	#include "gui/console.h"

Index: object.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- object.h	28 May 2003 20:01:45 -0000	1.5
+++ object.h	11 Sep 2003 10:32:14 -0000	1.6
@@ -21,6 +21,22 @@
 #ifndef OBJECT_H
 #define OBJECT_H
 
+struct ObjectData {
+	uint32 OBIMoffset;
+	uint32 OBCDoffset;
+	int16 walk_x, walk_y;
+	uint16 obj_nr;
+	int16 x_pos;
+	int16 y_pos;
+	uint16 width;
+	uint16 height;
+	byte actordir;
+	byte parent;
+	byte parentstate;
+	byte state;
+	byte fl_object_index;
+};
+
 #if !defined(__GNUC__)
 	#pragma START_PACK_STRUCTS
 #endif	

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- resource.cpp	10 Sep 2003 03:50:03 -0000	1.157
+++ resource.cpp	11 Sep 2003 10:32:14 -0000	1.158
@@ -21,17 +21,18 @@
  */
 
 #include "stdafx.h"
-#include "imuse.h"
-#include "scumm.h"
-#include "resource.h"
-#include "bundle.h"
-#include "verbs.h"
-#include "scumm/sound.h"
 #include "common/map.h"
 #include "common/str.h"
-#include "sound/mididrv.h" // Need MD_ enum values
 #include "gui/message.h"
-#include "dialogs.h"
+#include "scumm/bundle.h"
+#include "scumm/dialogs.h"
+#include "scumm/imuse.h"
+#include "scumm/object.h"
+#include "scumm/resource.h"
+#include "scumm/scumm.h"
+#include "scumm/sound.h"
+#include "scumm/verbs.h"
+#include "sound/mididrv.h" // Need MD_ enum values
 
 static uint16 newTag2Old(uint32 oldTag);
 static const char *resTypeFromId(int id);
@@ -238,9 +239,8 @@
 			error("Cannot find file: '%s'", filename);
 	} else { 
 		sprintf(buf, "Cannot find file: '%s'", filename);
-		InfoDialog* dialog = new InfoDialog(_newgui, this, (char*)buf);
-		runDialog (dialog);
-		delete dialog;
+		InfoDialog dialog(_newgui, this, (char*)buf);
+		runDialog(dialog);
 		error("Cannot find file: '%s'", filename);
 	}
 }

Index: resource.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- resource.h	26 Jun 2003 00:47:39 -0000	1.5
+++ resource.h	11 Sep 2003 10:32:14 -0000	1.6
@@ -50,6 +50,15 @@
 };
 
 
+#define ARRAY_HDR_SIZE 6
+struct ArrayHeader {
+	int16 dim1_size;
+	int16 type;
+	int16 dim2_size;
+	byte data[1];
+};
+
+
 const byte *findResource(uint32 tag, const byte *searchin);
 const byte *findResourceSmall(uint32 tag, const byte *searchin);
 

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- saveload.cpp	9 Sep 2003 17:29:21 -0000	1.108
+++ saveload.cpp	11 Sep 2003 10:32:14 -0000	1.109
@@ -21,18 +21,23 @@
  */
 
 #include "stdafx.h"
-#include "actor.h"
-#include "charset.h"
-#include "imuse.h"
-#include "imuse_digi.h"
-#include "resource.h"
-#include "saveload.h"
-#include "scumm.h"
-#include "sound.h"
-#include "verbs.h"
+
 #include "common/config-file.h"
+
+#include "scumm/actor.h"
+#include "scumm/charset.h"
+#include "scumm/imuse_digi.h"
+#include "scumm/imuse.h"
+#include "scumm/object.h"
+#include "scumm/resource.h"
+#include "scumm/saveload.h"
+#include "scumm/scumm.h"
+#include "scumm/sound.h"
+#include "scumm/verbs.h"
+
 #include "sound/mixer.h"
 
+
 struct SaveGameHeader {
 	uint32 type;
 	uint32 size;
@@ -394,7 +399,7 @@
 		MKARRAY(Scumm, vm.cutSceneData[0], sleInt16, 5, VER(8)),
 		MKLINE(Scumm, vm.cutSceneScriptIndex, sleInt16, VER(8)),
 
-		MKLINE(Scumm, _numNestedScripts, sleByte, VER(8)),
+		MKLINE(Scumm, vm.numNestedScripts, sleByte, VER(8)),
 		MKLINE(Scumm, _userPut, sleByte, VER(8)),
 		MKLINE(Scumm, _userState, sleUint16, VER(17)),
 		MKLINE(Scumm, _cursor.state, sleByte, VER(8)),

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- script.cpp	10 Sep 2003 17:15:44 -0000	1.131
+++ script.cpp	11 Sep 2003 10:32:14 -0000	1.132
@@ -21,18 +21,13 @@
  */
 
 #include "stdafx.h"
-#include "scumm.h"
-#include "actor.h"
-#include "resource.h"
-#include "common/util.h"
 
-/* Script status type (slot.status) */
-enum {
-	ssDead = 0,
-	ssPaused = 1,
-	ssRunning = 2
-};
+#include "common/util.h"
 
+#include "scumm/actor.h"
+#include "scumm/object.h"
+#include "scumm/resource.h"
+#include "scumm/scumm.h"
 
 /* Start executing script 'script' with the given parameters */
 void Scumm::runScript(int script, bool freezeResistant, bool recursive, int *lvarptr) {
@@ -221,7 +216,7 @@
 	}
 
 	nest = vm.nest;
-	num = _numNestedScripts;
+	num = vm.numNestedScripts;
 
 	while (num > 0) {
 		if (nest->number == script &&
@@ -258,7 +253,7 @@
 	}
 
 	nest = vm.nest;
-	num = _numNestedScripts;
+	num = vm.numNestedScripts;
 
 	while (num > 0) {
 		if (nest->number == script &&
@@ -293,7 +288,7 @@
 
 	updateScriptPtr();
 
-	nest = &vm.nest[_numNestedScripts];
+	nest = &vm.nest[vm.numNestedScripts];
 
 	if (_currentScript == 0xFF) {
 		nest->number = 0xFF;
@@ -306,9 +301,9 @@
 		nest->slot = _currentScript;
 	}
 
-	_numNestedScripts++;
+	vm.numNestedScripts++;
 	
-	if (_numNestedScripts > ARRAYSIZE(vm.nest))
+	if (vm.numNestedScripts > ARRAYSIZE(vm.nest))
 		error("Too many nested scripts");
 
 	_currentScript = script;
@@ -316,7 +311,7 @@
 	getScriptEntryPoint();
 	executeScript();
 
-	_numNestedScripts--;
+	vm.numNestedScripts--;
 
 	if (nest->number != 0xFF) {
 		// Try to resume the script which called us, if its status has not changed
@@ -360,7 +355,7 @@
 		_lastCodePtr = &_baseInventoryItems[idx];
 		break;
 
-	case 3:
+	case WIO_LOCAL:
 	case WIO_ROOM:								/* room script */
 		if (_version == 8) {
 			_scriptOrgPointer = getResourceAddress(rtRoomScripts, _roomResource);
@@ -865,6 +860,7 @@
 
 void Scumm::checkAndRunSentenceScript() {
 	int i;
+	int localParamList[16];
 	const ScriptSlot *ss;
 	int sentenceScript;
 	if (_version <= 2)
@@ -872,7 +868,7 @@
 	else
 		sentenceScript = VAR(VAR_SENTENCE_SCRIPT);
 
-	memset(_localParamList, 0, sizeof(_localParamList));
+	memset(localParamList, 0, sizeof(localParamList));
 	if (isScriptInUse(sentenceScript)) {
 		ss = vm.slot;
 		for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++)
@@ -895,13 +891,13 @@
 		_scummVars[VAR_ACTIVE_OBJECT2] = _sentence[_sentenceNum].objectB;
 		_scummVars[VAR_VERB_ALLOWED] = (0 != getVerbEntrypoint(_sentence[_sentenceNum].objectA, _sentence[_sentenceNum].verb));
 	} else {
-		_localParamList[0] = _sentence[_sentenceNum].verb;
-		_localParamList[1] = _sentence[_sentenceNum].objectA;
-		_localParamList[2] = _sentence[_sentenceNum].objectB;
+		localParamList[0] = _sentence[_sentenceNum].verb;
+		localParamList[1] = _sentence[_sentenceNum].objectA;
+		localParamList[2] = _sentence[_sentenceNum].objectB;
 	}
 	_currentScript = 0xFF;
 	if (sentenceScript)
-		runScript(sentenceScript, 0, 0, _localParamList);
+		runScript(sentenceScript, 0, 0, localParamList);
 }
 
 void Scumm::runInputScript(int a, int cmd, int mode) {

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.195
retrieving revision 2.196
diff -u -d -r2.195 -r2.196
--- script_v2.cpp	10 Sep 2003 17:15:44 -0000	2.195
+++ script_v2.cpp	11 Sep 2003 10:32:14 -0000	2.196
@@ -21,12 +21,13 @@
  */
 
 #include "stdafx.h"
-#include "scumm.h"
-#include "actor.h"
-#include "charset.h"
-#include "intern.h"
-#include "sound.h"
-#include "verbs.h"
+#include "scumm/actor.h"
+#include "scumm/charset.h"
+#include "scumm/intern.h"
+#include "scumm/object.h"
+#include "scumm/scumm.h"
+#include "scumm/sound.h"
+#include "scumm/verbs.h"
 
 #define OPCODE(x)	{ &Scumm_v2::x, #x }
 

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- script_v5.cpp	11 Sep 2003 09:28:50 -0000	1.181
+++ script_v5.cpp	11 Sep 2003 10:32:14 -0000	1.182
@@ -21,12 +21,13 @@
  */
 
 #include "stdafx.h"
-#include "scumm.h"
-#include "actor.h"
-#include "charset.h"
-#include "intern.h"
-#include "sound.h"
-#include "verbs.h"
+#include "scumm/actor.h"
+#include "scumm/charset.h"
+#include "scumm/intern.h"
+#include "scumm/object.h"
+#include "scumm/scumm.h"
+#include "scumm/sound.h"
+#include "scumm/verbs.h"
 
 #define OPCODE(x)	{ &Scumm_v5::x, #x }
 
@@ -623,7 +624,7 @@
 	}
 
 	vm.slot[cur].number = 0;
-	vm.slot[cur].status = 0;
+	vm.slot[cur].status = ssDead;
 	_currentScript = 0xFF;
 
 	runScript(script, vm.slot[cur].freezeResistant, vm.slot[cur].recursive, vars);
@@ -731,13 +732,13 @@
 	delay |= fetchScriptByte() << 8;
 	delay |= fetchScriptByte() << 16;
 	vm.slot[_currentScript].delay = delay;
-	vm.slot[_currentScript].status = 1;
+	vm.slot[_currentScript].status = ssPaused;
 	o5_breakHere();
 }
 
 void Scumm_v5::o5_delayVariable() {
 	vm.slot[_currentScript].delay = getVar();
-	vm.slot[_currentScript].status = 1;
+	vm.slot[_currentScript].status = ssPaused;
 	o5_breakHere();
 }
 

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -d -r1.185 -r1.186
--- script_v6.cpp	9 Sep 2003 20:54:18 -0000	1.185
+++ script_v6.cpp	11 Sep 2003 10:32:14 -0000	1.186
@@ -22,20 +22,22 @@
 
 
 #include "stdafx.h"
-#include <time.h>
 
-#include "actor.h"
-#include "charset.h"
-#include "imuse.h"
-#include "intern.h"
-#include "scumm.h"
-#include "sound.h"
-#include "verbs.h"
-#include "smush/smush_player.h"
+#include "scumm/actor.h"
+#include "scumm/charset.h"
+#include "scumm/imuse.h"
+#include "scumm/intern.h"
+#include "scumm/object.h"
+#include "scumm/resource.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"
 
-#include "dialogs.h"		// FIXME: This is just for the FT-INSANE warning. 
+#include "scumm/dialogs.h"		// FIXME: This is just for the FT-INSANE warning. 
 				// Remove when INSANE is implemented
 
 #define OPCODE(x)	{ &Scumm_v6::x, #x }
@@ -2184,7 +2186,7 @@
 	// CMI it would seem this should delay for 1/10th of a second...
 	uint32 delay = (uint16)pop();
 	vm.slot[_currentScript].delay = delay;
-	vm.slot[_currentScript].status = 1;
+	vm.slot[_currentScript].status = ssPaused;
 	o6_breakHere();
 }
 
@@ -2199,7 +2201,7 @@
 		delay = delay * 90;
 
 	vm.slot[_currentScript].delay = delay;
-	vm.slot[_currentScript].status = 1;
+	vm.slot[_currentScript].status = ssPaused;
 	o6_breakHere();
 }
 
@@ -2207,7 +2209,7 @@
 	// FIXME - are we really measuring minutes here?
 	uint32 delay = (uint16)pop() * 3600;
 	vm.slot[_currentScript].delay = delay;
-	vm.slot[_currentScript].status = 1;
+	vm.slot[_currentScript].status = ssPaused;
 	o6_breakHere();
 }
 
@@ -2422,29 +2424,26 @@
 						case 2:
 							sp->play("tovista1.san", getGameDataPath());
 							break;
-						case 3: {
-								if (readArray(233,0,50) == 0) {
-									InfoDialog *dialog = new InfoDialog(_newgui, this,
-														"Set MineRoad - You can now jump the gorge.");
-									runDialog (dialog);
-									delete dialog;
+						case 3:
+							if (readArray(233,0,50) == 0) {
+								InfoDialog info(_newgui, this, "Set MineRoad - You can now jump the gorge.");
+								runDialog(info);
 
-									writeArray(233, 0, 50, 1); // INSANE callback: Chain
-									writeArray(233, 0, 51, 1); // INSANE callback: Chainsaw
-									writeArray(233, 0, 52, 1); // INSANE callback: Mace
-									writeArray(233, 0, 53, 1); // INSANE callback: 2x4
-									writeArray(233, 0, 54, 1); // INSANE callback: Wrench
-									writeArray(233, 0, 55, 1); // INSANE callback: Dust
+								writeArray(233, 0, 50, 1); // INSANE callback: Chain
+								writeArray(233, 0, 51, 1); // INSANE callback: Chainsaw
+								writeArray(233, 0, 52, 1); // INSANE callback: Mace
+								writeArray(233, 0, 53, 1); // INSANE callback: 2x4
+								writeArray(233, 0, 54, 1); // INSANE callback: Wrench
+								writeArray(233, 0, 55, 1); // INSANE callback: Dust
 
-									writeArray(233, 0, 8, 1);  // INSANE callback: Give Googles
-									writeArray(233, 0, 7, 1);  // INSANE callback: Give nitro fuel
+								writeArray(233, 0, 8, 1);  // INSANE callback: Give Googles
+								writeArray(233, 0, 7, 1);  // INSANE callback: Give nitro fuel
 
-									putState(235, 1);	   // Cheat and activate Ramp
-									writeVar(142 | 0x8000, 1); // Cheat and activate auto-booster (fan)
-								}
-//								smush->play("minefite.san", getGameDataPath());
+								putState(235, 1);	   // Cheat and activate Ramp
+								writeVar(142 | 0x8000, 1); // Cheat and activate auto-booster (fan)
+							}
+//							sp->play("minefite.san", getGameDataPath());
 							break;
-						}
 						case 4:
 							sp->play("rottopen.san", getGameDataPath());
 							break;

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.192
retrieving revision 2.193
diff -u -d -r2.192 -r2.193
--- script_v8.cpp	9 Sep 2003 20:54:18 -0000	2.192
+++ script_v8.cpp	11 Sep 2003 10:32:14 -0000	2.193
@@ -20,18 +20,17 @@
  */
 
 #include "stdafx.h"
-#include "scumm.h"
-#include "actor.h"
-#include "akos.h"
-#include "charset.h"
-#include "intern.h"
-#include "sound.h"
-#include "verbs.h"
-#include "smush/smush_player.h"
-
+#include "scumm/actor.h"
+#include "scumm/akos.h"
+#include "scumm/charset.h"
+#include "scumm/intern.h"
+#include "scumm/object.h"
+#include "scumm/resource.h"
+#include "scumm/scumm.h"
+#include "scumm/sound.h"
+#include "scumm/verbs.h"
+#include "scumm/smush/smush_player.h"
 #include "sound/mixer.h"
-
-#include <time.h>
 
 
 #define OPCODE(x)	{ &Scumm_v8::x, #x }

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.299
retrieving revision 1.300
diff -u -d -r1.299 -r1.300
--- scumm.h	10 Sep 2003 17:15:44 -0000	1.299
+++ scumm.h	11 Sep 2003 10:32:14 -0000	1.300
@@ -30,6 +30,7 @@
 #include "common/str.h"
 
 #include "scumm/gfx.h"
+#include "scumm/script.h"
 
 class Actor;
 class BaseCostumeRenderer;
@@ -59,7 +60,6 @@
 
 /* System Wide Constants */
 enum {
-	NUM_SCRIPT_SLOT = 80,
 	NUM_LOCALSCRIPT = 60,
 	NUM_SENTENCE = 6,
 	NUM_SHADOW_PALETTE = 8,
@@ -110,41 +110,7 @@
 };
 
 struct VerbSlot;
-
-struct ObjectData {
-	uint32 OBIMoffset;
-	uint32 OBCDoffset;
-	int16 walk_x, walk_y;
-	uint16 obj_nr;
-	int16 x_pos;
-	int16 y_pos;
-	uint16 width;
-	uint16 height;
-	byte actordir;
-	byte parent;
-	byte parentstate;
-	byte state;
-	byte fl_object_index;
-};
-
-struct ScriptSlot {
-	uint32 offs;
-	int32 delay;
-	uint16 number;
-	uint16 delayFrameCount;
-	bool freezeResistant, recursive;
-	bool didexec;
-	byte status;
-	byte where;
-	byte freezeCount;
-	byte cutsceneOverride;
-};
-
-struct NestedScript {
-	uint16 number;
-	uint8 where;
-	uint8 slot;
-};
+struct ObjectData;
 
 struct BlastText {
 	int16 xpos, ypos;
@@ -246,14 +212,6 @@
 
 #define _roomFileOffsets res.roomoffs[rtRoom]
 
-#define ARRAY_HDR_SIZE 6
-struct ArrayHeader {
-	int16 dim1_size;
-	int16 type;
-	int16 dim2_size;
-	byte data[1];
-};
-
 struct SentenceTab {
 	byte verb;
 	byte preposition;
@@ -286,11 +244,6 @@
 	WIO_FLOBJECT = 4
 };
 
-enum MouseButtonStatus {
-	msDown = 1,
-	msClicked = 2
-};
-
 struct LangIndexNode {
 	char tag[12+1];
 	int32 offset;
@@ -332,16 +285,7 @@
 	} res;
 
 protected:
-	struct {
-		uint32 cutScenePtr[5];
-		byte cutSceneScript[5];
-		int16 cutSceneData[5];
-		int16 cutSceneScriptIndex;
-		byte cutSceneStackPointer;
-		ScriptSlot slot[NUM_SCRIPT_SLOT];
-		NestedScript nest[15];
-		int32 localvar[NUM_SCRIPT_SLOT][26];
-	} vm;
+	VirtualMachineState vm;
 
 public:
 	// Constructor / Destructor
@@ -405,7 +349,7 @@
 	ConsoleDialog *_debuggerDialog;
 
 protected:
-	int runDialog(Dialog *dialog);
+	int runDialog(Dialog &dialog);
 	void confirmexitDialog();
 	void pauseDialog();
 	void saveloadDialog();
@@ -540,11 +484,11 @@
 	/* Script VM - should be in Script class */
 	uint32 _localScriptList[NUM_LOCALSCRIPT];
 	const byte *_scriptPointer, *_scriptOrgPointer;
-	byte _opcode, _numNestedScripts, _currentScript;
+	byte _opcode, _currentScript;
 	uint16 _curExecScript;
 	byte **_lastCodePtr;
 	int _resultVarNumber, _scummStackPos;
-	int _localParamList[16],  _scummStack[150];
+	int _scummStack[150];
 	int _keyScriptKey, _keyScriptNo;
 	
 	virtual void setupOpcodes() = 0;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.385
retrieving revision 2.386
diff -u -d -r2.385 -r2.386
--- scummvm.cpp	11 Sep 2003 04:06:18 -0000	2.385
+++ scummvm.cpp	11 Sep 2003 10:32:14 -0000	2.386
@@ -21,33 +21,35 @@
  */
 
 #include "stdafx.h"
-#include "scumm.h"
-#include "actor.h"
-#include "boxes.h"
-#include "charset.h"
-#include "debugger.h"
-#include "dialogs.h"
-#include "imuse.h"
-#include "imuse_digi.h"
-#include "intern.h"
-#include "object.h"
-#include "player_v3a.h"
-#include "player_v2.h"
-#include "player_v1.h"
-#include "resource.h"
-#include "sound.h"
-#include "string.h"
-#include "verbs.h"
-#include "common/gameDetector.h"
+
 #include "common/config-file.h"
+#include "common/gameDetector.h"
+
 #include "gui/console.h"
-#include "gui/newgui.h"
 #include "gui/message.h"
-#include "sound/mixer.h"
-#include "sound/mididrv.h"
+#include "gui/newgui.h"
 
-#include "akos.h"
-#include "costume.h"
+#include "scumm/actor.h"
+#include "scumm/akos.h"
+#include "scumm/boxes.h"
+#include "scumm/charset.h"
+#include "scumm/costume.h"
+#include "scumm/debugger.h"
+#include "scumm/dialogs.h"
+#include "scumm/imuse_digi.h"
+#include "scumm/imuse.h"
+#include "scumm/intern.h"
+#include "scumm/object.h"
+#include "scumm/player_v1.h"
+#include "scumm/player_v2.h"
+#include "scumm/player_v3a.h"
+#include "scumm/resource.h"
+#include "scumm/scumm.h"
+#include "scumm/sound.h"
+#include "scumm/verbs.h"
+
+#include "sound/mididrv.h"
+#include "sound/mixer.h"
 
 #ifdef MACOSX
 #include <sys/types.h>
@@ -58,6 +60,11 @@
 extern bool isSmartphone(void);
 #endif
 
+enum MouseButtonStatus {
+	msDown = 1,
+	msClicked = 2
+};
+
 // Use g_scumm from error() ONLY
 Scumm *g_scumm = 0;
 ScummDebugger *g_debugger;
@@ -368,13 +375,12 @@
 	_scriptPointer = NULL;
 	_scriptOrgPointer = NULL;
 	_opcode = 0;
-	_numNestedScripts = 0;
+	vm.numNestedScripts = 0;
 	_currentScript = 0;
 	_curExecScript = 0;
 	_lastCodePtr = NULL;
 	_resultVarNumber = 0;
 	_scummStackPos = 0;
-	memset(_localParamList, 0, sizeof(_localParamList));
 	memset(_scummStack, 0, sizeof(_scummStack));
 	_keyScriptKey = 0;
 	_keyScriptNo = 0;
@@ -1007,7 +1013,7 @@
 			_actors[i].setActorCostume(i);
 	}
 
-	_numNestedScripts = 0;
+	vm.numNestedScripts = 0;
 	vm.cutSceneStackPointer = 0;
 
 	memset(vm.cutScenePtr, 0, sizeof(vm.cutScenePtr));
@@ -1368,9 +1374,8 @@
 #endif
 			sprintf(buf, "Successfully saved game state in file:\n\n%s", filename);
 	
-			Dialog *dialog = new MessageDialog(_newgui, buf, 1500, false);
+			MessageDialog dialog(_newgui, buf, 1500, false);
 			runDialog(dialog);
-			delete dialog;
 		}
 		if (success && _saveLoadFlag != 1)
 			clearClickedStatus();
@@ -2392,8 +2397,8 @@
 	setShake(0);
 	_sound->stopAllSounds();
 
-        // Empty variables
-	for (i=0;i<255;i++)
+	// Clear the script variables
+	for (i = 0; i < 255; i++)
 		_scummVars[i] = 0;
 
 	// Empty inventory
@@ -2419,7 +2424,7 @@
 #pragma mark --- GUI ---
 #pragma mark -
 
-int Scumm::runDialog(Dialog *dialog) {
+int Scumm::runDialog(Dialog &dialog) {
 	// Pause sound put
 	bool old_soundsPaused = _sound->_soundsPaused;
 	_sound->pauseSounds(true);
@@ -2429,7 +2434,7 @@
 	_smushPlay = false;
 
 	// Open & run the dialog
-	int result = dialog->runModal();
+	int result = dialog.runModal();
 
 	// Restore old cursor
 	updateCursor();
@@ -2447,35 +2452,35 @@
 void Scumm::pauseDialog() {
 	if (!_pauseDialog)
 		_pauseDialog = new PauseDialog(_newgui, this);
-	runDialog(_pauseDialog);
+	runDialog(*_pauseDialog);
 }
 
 void Scumm::saveloadDialog() {
 	if (!_saveLoadDialog)
 		_saveLoadDialog = new SaveLoadDialog(_newgui, this);
-	runDialog(_saveLoadDialog);
+	runDialog(*_saveLoadDialog);
 }
 
 void Scumm::optionsDialog() {
 	if (!_optionsDialog)
 		_optionsDialog = new OptionsDialog(_newgui, this);
-	runDialog(_optionsDialog);
+	runDialog(*_optionsDialog);
 }
 
 void Scumm::confirmexitDialog() {
 	if (!_confirmExitDialog)
 		_confirmExitDialog = new ConfirmExitDialog(_newgui, this);
 
-	if (runDialog(_confirmExitDialog)) {
+	if (runDialog(*_confirmExitDialog)) {
 		_quit = true;
 	}
 }
 
 char Scumm::displayError(bool showCancel, const char *message, ...) {
 #ifdef __PALM_OS__
-	char buf[256], result; // 1024 is too big overflow the stack
+	char buf[256]; // 1024 is too big overflow the stack
 #else
-	char buf[1024], result;
+	char buf[1024];
 #endif
 	va_list va;
 
@@ -2483,11 +2488,8 @@
 	vsprintf(buf, message, va);
 	va_end(va);
 
-	Dialog *dialog = new MessageDialog(_newgui, buf, 0, true, showCancel);
-	result = runDialog(dialog);
-	delete dialog;
-
-	return result;
+	MessageDialog dialog(_newgui, buf, 0, true, showCancel);
+	return runDialog(dialog);
 }
 
 #pragma mark -

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- string.cpp	9 Sep 2003 20:54:19 -0000	1.158
+++ string.cpp	11 Sep 2003 10:32:15 -0000	1.159
@@ -76,11 +76,10 @@
 	if (_string[3].color == 0)
 		_string[3].color = 4;
 
-	InfoDialog* dialog = new InfoDialog(_newgui, this, (char*)buf);
 	// FIXME: I know this is the right thing to do for MI1 and MI2. For
 	// all other games it's just a guess.
-	VAR(VAR_KEYPRESS) = runDialog (dialog);
-	delete dialog;
+	InfoDialog dialog(_newgui, this, (char*)buf);
+	VAR(VAR_KEYPRESS) = runDialog(dialog);
 
 	_messagePtr = tmp;
 }





More information about the Scummvm-git-logs mailing list