[Scummvm-cvs-logs] CVS: scummvm/bs2 build_display.cpp,1.35,1.36 controls.cpp,1.33,1.34 icons.cpp,1.15,1.16 interpreter.cpp,1.18,1.19 interpreter.h,1.10,1.11 logic.cpp,1.22,1.23 logic.h,1.7,1.8 save_rest.cpp,1.28,1.29 speech.cpp,1.32,1.33 startup.cpp,1.23,1.24 sword2.cpp,1.61,1.62 walker.cpp,1.17,1.18

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Tue Oct 21 02:32:24 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv10523

Modified Files:
	build_display.cpp controls.cpp icons.cpp interpreter.cpp 
	interpreter.h logic.cpp logic.h save_rest.cpp speech.cpp 
	startup.cpp sword2.cpp walker.cpp 
Log Message:
Moved some more stuff into the Logic class.


Index: build_display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/build_display.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- build_display.cpp	18 Oct 2003 08:11:49 -0000	1.35
+++ build_display.cpp	21 Oct 2003 08:54:50 -0000	1.36
@@ -23,6 +23,7 @@
 
 #include "stdafx.h"
 #include "bs2/sword2.h"
+#include "bs2/debug.h"
 #include "bs2/build_display.h"
 #include "bs2/console.h"
 #include "bs2/defs.h"

Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/controls.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- controls.cpp	18 Oct 2003 08:11:49 -0000	1.33
+++ controls.cpp	21 Oct 2003 08:54:50 -0000	1.34
@@ -1427,7 +1427,7 @@
 
 	// reopen global variables resource & send address to interpreter -
 	// it won't be moving
-	SetGlobalInterpreterVariables((int32 *) (res_man.open(1) + sizeof(_standardHeader)));
+	g_logic.setGlobalInterpreterVariables((int32 *) (res_man.open(1) + sizeof(_standardHeader)));
 	res_man.close(1);
 
 	DEMO = temp_demo_flag;

Index: icons.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/icons.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- icons.cpp	18 Oct 2003 08:11:49 -0000	1.15
+++ icons.cpp	21 Oct 2003 08:54:50 -0000	1.16
@@ -98,7 +98,7 @@
 	// objects. Run the 'build_menu' script in the 'menu_master' object
 
 	head = res_man.open(MENU_MASTER_OBJECT);
-	RunScript((char*) head, (char*) head, &null_pc);
+	g_logic.runScript((char*) head, (char*) head, &null_pc);
 	res_man.close(MENU_MASTER_OBJECT);
 
 	// Compare new with old. Anything in master thats not in new gets

Index: interpreter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/interpreter.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- interpreter.cpp	19 Oct 2003 18:01:05 -0000	1.18
+++ interpreter.cpp	21 Oct 2003 08:54:50 -0000	1.19
@@ -215,11 +215,11 @@
 #define POPOFFSTACK(x) { x = stack2[stackPointer2 - 1]; stackPointer2--; CHECKSTACKPOINTER2 }
 #define DOOPERATION(x) { stack2[stackPointer2 - 2] = (x); stackPointer2--; CHECKSTACKPOINTER2 }
 
-void SetGlobalInterpreterVariables(int32 *vars) {
+void Logic::setGlobalInterpreterVariables(int32 *vars) {
 	globalInterpreterVariables2 = vars;
 }
 
-int RunScript(char *scriptData, char *objectData, uint32 *offset) {
+int Logic::runScript(char *scriptData, char *objectData, uint32 *offset) {
 	#define STACK_SIZE		10
 
 	_standardHeader *header = (_standardHeader *) scriptData;
@@ -329,7 +329,7 @@
 			Read8ip(value);
 			debug(5, "Call mcode %d with stack = %x", parameter, stack2 + stackPointer2 - value);
 
-			retVal = g_logic.executeOpcode(parameter, stack2 + stackPointer2 - value);
+			retVal = executeOpcode(parameter, stack2 + stackPointer2 - value);
 
 			stackPointer2 -= value;
 			CHECKSTACKPOINTER2

Index: interpreter.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/interpreter.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- interpreter.h	4 Oct 2003 08:07:01 -0000	1.10
+++ interpreter.h	21 Oct 2003 08:54:50 -0000	1.11
@@ -20,77 +20,74 @@
 #ifndef _INTERPRETER
 #define _INTERPRETER
 
-#include "bs2/debug.h"
-#include "bs2/header.h"
-
 namespace Sword2 {
 
 // Interpreter return codes
 
-#define IR_STOP				0
-#define IR_CONT				1
-#define IR_TERMINATE			2	
-#define IR_REPEAT			3
-#define IR_GOSUB			4
+enum {
+	IR_STOP		= 0,
+	IR_CONT		= 1,
+	IR_TERMINATE	= 2,
+	IR_REPEAT	= 3,
+	IR_GOSUB	= 4
+};
 
 // Get parameter fix so that the playstation version can handle words not on
 // word boundaries
 
-#define Read8ip(var)			{ var = *((const int8 *) (code + ip)); ip++; }
-#define Read16ip(var)			{ var = (int16) READ_LE_UINT16(code + ip); ip += sizeof(int16); }
-#define Read32ip(var)			{ var = (int32) READ_LE_UINT32(code + ip); ip += sizeof(int32); }
-#define Read32ipLeaveip(var)		{ var = (int32) READ_LE_UINT32(code + ip); }
-
-void SetGlobalInterpreterVariables(int32 *vars);
-int RunScript (char *scriptData, char *objectData, uint32 *offset);
-
-// Compiled tokens
+#define Read8ip(var)		{ var = *((const int8 *) (code + ip)); ip++; }
+#define Read16ip(var)		{ var = (int16) READ_LE_UINT16(code + ip); ip += sizeof(int16); }
+#define Read32ip(var)		{ var = (int32) READ_LE_UINT32(code + ip); ip += sizeof(int32); }
+#define Read32ipLeaveip(var)	{ var = (int32) READ_LE_UINT32(code + ip); }
 
-#define	CP_END_SCRIPT			0
-#define	CP_PUSH_LOCAL_VAR32		1	// Push a local variable on to the stack
-#define	CP_PUSH_GLOBAL_VAR32		2	// Push a global variable
-#define	CP_POP_LOCAL_VAR32		3	// Pop a local variable from the stack
-#define	CP_CALL_MCODE			4	// Call a machine code function
-#define	CP_PUSH_LOCAL_ADDR		5	// Push the address of a local variable
-#define	CP_PUSH_INT32			6	// Adjust the stack after calling an fn function
-#define	CP_SKIPONFALSE			7	// Skip if the bottom value on the stack is false
-#define	CP_SKIPALWAYS			8	// Skip a block of code
-#define	CP_SWITCH			9	// Switch on last stack value
-#define	CP_ADDNPOP_LOCAL_VAR32		10	// Add to a local varible
-#define	CP_SUBNPOP_LOCAL_VAR32		11	// Subtract to a local variable
-#define	CP_SKIPONTRUE			12	// Skip if the bottom value on the stack is true
-#define	CP_POP_GLOBAL_VAR32		13	// Pop a global variable
-#define	CP_ADDNPOP_GLOBAL_VAR32		14
-#define	CP_SUBNPOP_GLOBAL_VAR32		15
-#define	CP_DEBUGON			16	// Turn debugging on
-#define	CP_DEBUGOFF			17	// Turn debugging off
-#define	CP_QUIT				18	// Quit for a cycle
-#define	CP_TERMINATE			19	// Quit script completely
+enum {
+	// Compiled tokens
 
-// Operators
+	CP_END_SCRIPT			= 0,
+	CP_PUSH_LOCAL_VAR32		= 1,	// Push a local variable on to the stack
+	CP_PUSH_GLOBAL_VAR32		= 2,	// Push a global variable
+	CP_POP_LOCAL_VAR32		= 3,	// Pop a local variable from the stack
+	CP_CALL_MCODE			= 4,	// Call a machine code function
+	CP_PUSH_LOCAL_ADDR		= 5,	// Push the address of a local variable
+	CP_PUSH_INT32			= 6,	// Adjust the stack after calling an fn function
+	CP_SKIPONFALSE			= 7,	// Skip if the bottom value on the stack is false
+	CP_SKIPALWAYS			= 8,	// Skip a block of code
+	CP_SWITCH			= 9,	// Switch on last stack value
+	CP_ADDNPOP_LOCAL_VAR32		= 10,	// Add to a local varible
+	CP_SUBNPOP_LOCAL_VAR32		= 11,	// Subtract to a local variable
+	CP_SKIPONTRUE			= 12,	// Skip if the bottom value on the stack is true
+	CP_POP_GLOBAL_VAR32		= 13,	// Pop a global variable
+	CP_ADDNPOP_GLOBAL_VAR32		= 14,
+	CP_SUBNPOP_GLOBAL_VAR32		= 15,
+	CP_DEBUGON			= 16,	// Turn debugging on
+	CP_DEBUGOFF			= 17,	// Turn debugging off
+	CP_QUIT				= 18,	// Quit for a cycle
+	CP_TERMINATE			= 19,	// Quit script completely
 
-#define	OP_ISEQUAL			20	// '=='
-#define	OP_PLUS				21	// '+'
-#define	OP_MINUS			22	// '-'
-#define	OP_TIMES			23	// '*'
-#define	OP_DIVIDE			24	// '/'
-#define	OP_NOTEQUAL			25	// '=='
-#define	OP_ANDAND			26	// '&&'
-#define	OP_GTTHAN			27	// '>'
-#define	OP_LSTHAN			28	// '<'
+	// Operators
 
-// More tokens, mixed types
+	OP_ISEQUAL			= 20,	// '=='
+	OP_PLUS				= 21,	// '+'
+	OP_MINUS			= 22,	// '-'
+	OP_TIMES			= 23,	// '*'
+	OP_DIVIDE			= 24,	// '/'
+	OP_NOTEQUAL			= 25,	// '=='
+	OP_ANDAND			= 26,	// '&&'
+	OP_GTTHAN			= 27,	// '>'
+	OP_LSTHAN			= 28,	// '<'
 
-#define	CP_JUMP_ON_RETURNED		29	// Use table of jumps with value returned from fn_mcode
-#define	CP_TEMP_TEXT_PROCESS		30	// A dummy text process command for me
-#define	CP_SAVE_MCODE_START		31	// Save the mcode code start for restarting when necessary
-#define	CP_RESTART_SCRIPT		32	// Start the script from the beginning
-#define	CP_PUSH_STRING			33	// Push a pointer to a string on the stack
-#define	CP_PUSH_DEREFERENCED_STRUCTURE	34	// Push the address of a structure thing
+	// More tokens, mixed types
 
-#define	OP_GTTHANE			35	// >=
-#define	OP_LSTHANE			36	// <=
-#define	OP_OROR				37	// || or OR
+	CP_JUMP_ON_RETURNED		= 29,	// Use table of jumps with value returned from fn_mcode
+	CP_TEMP_TEXT_PROCESS		= 30,	// A dummy text process command for me
+	CP_SAVE_MCODE_START		= 31,	// Save the mcode code start for restarting when necessary
+	CP_RESTART_SCRIPT		= 32,	// Start the script from the beginning
+	CP_PUSH_STRING			= 33,	// Push a pointer to a string on the stack
+	CP_PUSH_DEREFERENCED_STRUCTURE	= 34,	// Push the address of a structure thing
+	OP_GTTHANE			= 35,	// >=
+	OP_LSTHANE			= 36,	// <=
+	OP_OROR				= 37	// || or OR
+};
 
 } // End of namespace Sword2
 

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/logic.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- logic.cpp	18 Oct 2003 08:11:49 -0000	1.22
+++ logic.cpp	21 Oct 2003 08:54:50 -0000	1.23
@@ -126,7 +126,7 @@
 				raw_script_ad = (char*) head;
 
 				// script and data object are us/same
-				ret = RunScript(raw_script_ad, raw_script_ad, &_curObjectHub->script_pc[LEVEL]);
+				ret = runScript(raw_script_ad, raw_script_ad, &_curObjectHub->script_pc[LEVEL]);
 			} else {
 				// we're running the script of another game
 				// object - get our data object address
@@ -147,7 +147,7 @@
 
 				raw_script_ad = (char*) far_head;
 
-				ret = RunScript(raw_script_ad, raw_data_ad, &_curObjectHub->script_pc[LEVEL]);
+				ret = runScript(raw_script_ad, raw_data_ad, &_curObjectHub->script_pc[LEVEL]);
 
 				// close foreign object again
 				res_man.close(script / SIZE);
@@ -199,7 +199,7 @@
 			// call the base script - this is the graphic/mouse
 			// service call
 
-			RunScript(raw_script_ad, raw_script_ad, &null_pc);
+			runScript(raw_script_ad, raw_script_ad, &null_pc);
 		}
 
 		// made for all live objects

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/logic.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- logic.h	18 Oct 2003 08:11:49 -0000	1.7
+++ logic.h	21 Oct 2003 08:54:50 -0000	1.8
@@ -61,6 +61,9 @@
 		setupOpcodes();
 	}
 
+	void setGlobalInterpreterVariables(int32 *vars);
+	int runScript(char *scriptData, char *objectData, uint32 *offset);
+
 	int32 executeOpcode(int op, int32 *params);
 
 	int32 fnTestFunction(int32 *params);

Index: save_rest.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/save_rest.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- save_rest.cpp	18 Oct 2003 08:11:49 -0000	1.28
+++ save_rest.cpp	21 Oct 2003 08:54:50 -0000	1.29
@@ -520,7 +520,7 @@
 		Con_fatal_error("incorrect CUR_PLAYER_ID=%d", CUR_PLAYER_ID);
 
 	raw_script_ad = (char *) head;
-	RunScript(raw_script_ad, raw_script_ad, &null_pc);
+	g_logic.runScript(raw_script_ad, raw_script_ad, &null_pc);
 	res_man.close(CUR_PLAYER_ID);
 }
 
@@ -543,12 +543,12 @@
 	// script no. 8 - 'george_savedata_return' calls fnGetPlayerSaveData
 
 	null_pc = 8;
-	RunScript(raw_script_ad, raw_script_ad, &null_pc);
+	g_logic.runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 	// script no. 14 - 'set_up_nico_anim_tables'
 
 	null_pc = 14;
-	RunScript(raw_script_ad, raw_script_ad, &null_pc);
+	g_logic.runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 	// which megaset was the player at the time of saving?
 
@@ -570,7 +570,7 @@
 		break;
 	}
 
-	RunScript(raw_script_ad, raw_script_ad, &null_pc);
+	g_logic.runScript(raw_script_ad, raw_script_ad, &null_pc);
 	res_man.close(CUR_PLAYER_ID);
 }
 

Index: speech.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/speech.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- speech.cpp	18 Oct 2003 08:11:50 -0000	1.32
+++ speech.cpp	21 Oct 2003 08:54:50 -0000	1.33
@@ -365,8 +365,8 @@
 
 	raw_script_ad = (char *) head;
 
-	//call the base script - this is the graphic/mouse service call
-	RunScript(raw_script_ad, raw_script_ad, &null_pc);
+	// call the base script - this is the graphic/mouse service call
+	runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 	res_man.close(target);
 
@@ -428,7 +428,7 @@
 	raw_script_ad = (char *) head;
 
 	// call the base script - this is the graphic/mouse service call
-	RunScript(raw_script_ad, raw_script_ad, &null_pc);
+	runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 	res_man.close(target);
 
@@ -508,7 +508,7 @@
 	raw_script_ad = (char *) head;
 
 	// call the base script - this is the graphic/mouse service call
-	RunScript(raw_script_ad, raw_script_ad, &null_pc);
+	runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 	res_man.close(target);
 
@@ -556,7 +556,7 @@
 	raw_script_ad = (char *) head;
 
 	// call the base script - this is the graphic/mouse service call
-	RunScript(raw_script_ad, raw_script_ad, &null_pc);
+	runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 	res_man.close(target);
 

Index: startup.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/startup.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- startup.cpp	18 Oct 2003 08:11:50 -0000	1.23
+++ startup.cpp	21 Oct 2003 08:54:50 -0000	1.24
@@ -129,7 +129,7 @@
 			debug(5, "- resource %d ok", res);
 			raw_script = (char*) res_man.open(res);
 			null_pc = 0;
-			RunScript(raw_script, raw_script, &null_pc);
+			g_logic.runScript(raw_script, raw_script, &null_pc);
 			res_man.close(res);
 		} else
 			debug(5, "- resource %d invalid", res);
@@ -267,7 +267,7 @@
 
 			// reopen global variables resource & send address to
 			// interpreter - it won't be moving
-			SetGlobalInterpreterVariables((int32 *) (res_man.open(1) + sizeof(_standardHeader)));
+			g_logic.setGlobalInterpreterVariables((int32 *) (res_man.open(1) + sizeof(_standardHeader)));
 			res_man.close(1);
 
 			// free all the route memory blocks from previous game
@@ -289,7 +289,7 @@
 			null_pc = start_list[start].key & 0xffff;
 
 			Print_to_console("running start %d", start);
-			RunScript(raw_script, raw_data_ad, &null_pc);
+			g_logic.runScript(raw_script, raw_data_ad, &null_pc);
 
 			res_man.close(start_list[start].start_res_id);
 

Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sword2.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- sword2.cpp	18 Oct 2003 08:11:50 -0000	1.61
+++ sword2.cpp	21 Oct 2003 08:54:50 -0000	1.62
@@ -184,7 +184,7 @@
 	// res 1 is the globals list
 	file = res_man.open(1);
 	debug(5, "CALLING: SetGlobalInterpreterVariables");
-	SetGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
+	g_logic.setGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
 
 	// DON'T CLOSE VARIABLES RESOURCE - KEEP IT OPEN AT VERY START OF
 	// MEMORY SO IT CAN'T MOVE!
@@ -466,7 +466,7 @@
 	raw_script = (char *) res_man.open(screen_manager_id);
 
 	// run the start script now (because no console)
-	RunScript(raw_script, raw_data_ad, &null_pc);
+	g_logic.runScript(raw_script, raw_data_ad, &null_pc);
 
 	// close the ScreenManager object
 	res_man.close(screen_manager_id);

Index: walker.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/walker.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- walker.cpp	18 Oct 2003 08:11:50 -0000	1.17
+++ walker.cpp	21 Oct 2003 08:54:50 -0000	1.18
@@ -611,7 +611,7 @@
 		raw_script_ad = (char *) head;
 
 		//call the base script - this is the graphic/mouse service call
-		RunScript(raw_script_ad, raw_script_ad, &null_pc);
+		runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 		res_man.close(params[4]);
 
@@ -674,7 +674,7 @@
 
 		// call the base script - this is the graphic/mouse service
 		// call
-		RunScript(raw_script_ad, raw_script_ad, &null_pc);
+		runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 		res_man.close(params[4]);
 





More information about the Scummvm-git-logs mailing list