[Scummvm-cvs-logs] SF.net SVN: scummvm:[41073] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun May 31 17:34:23 CEST 2009


Revision: 41073
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41073&view=rev
Author:   thebluegr
Date:     2009-05-31 15:34:23 +0000 (Sun, 31 May 2009)

Log Message:
-----------
Removed script_error_flag and script_debug_flag, which were used to error out if something went wrong and open the debugger console. Changed all the places where they were used to error() out instead, as ScummVM's debugger console can open on error()

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/klists.cpp
    scummvm/trunk/engines/sci/engine/kmisc.cpp
    scummvm/trunk/engines/sci/engine/ksound.cpp
    scummvm/trunk/engines/sci/engine/scriptdebug.cpp
    scummvm/trunk/engines/sci/engine/seg_manager.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/engine/vm.h
    scummvm/trunk/engines/sci/sci.cpp
    scummvm/trunk/engines/sci/sfx/core.cpp
    scummvm/trunk/engines/sci/sfx/core.h

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -487,8 +487,7 @@
 
 int kernel_oops(EngineState *s, const char *file, int line, const char *reason) {
 	sciprintf("Kernel Oops in file %s, line %d: %s\n", file, line, reason);
-	warning("Kernel Oops in file %s, line %d: %s", file, line, reason);
-	script_debug_flag = script_error_flag = 1;
+	error("Kernel Oops in file %s, line %d: %s", file, line, reason);
 	return 0;
 }
 

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -91,11 +91,9 @@
 	case SCI_EVT_KEYBOARD:
 		if ((e.buckybits & SCI_EVM_LSHIFT) && (e.buckybits & SCI_EVM_RSHIFT) && (e.data == '-')) {
 			sciprintf("Debug mode activated\n");
-			script_debug_flag = 1; // Enter debug mode
 			_debug_seeking = _debug_step_running = 0;
 		} else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '`')) {
 			sciprintf("Debug mode activated\n");
-			script_debug_flag = 1; // Enter debug mode
 			_debug_seeking = _debug_step_running = 0;
 		} else {
 			PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event
@@ -142,7 +140,6 @@
 
 	if ((s->r_acc.offset) && (stop_on_event)) {
 		stop_on_event = 0;
-		script_debug_flag = 1;
 	}
 
 	return s->r_acc;

Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/engine/klists.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -37,7 +37,7 @@
 		// FIXME: This occurs right at the beginning of SQ4, when walking north from the first screen. It doesn't
 		// seem to have any apparent ill-effects, though, so it's been changed to non-fatal, for now
 		//sciprintf("%s, L%d: Attempt to use non-node %04x:%04x as list node\n", __FILE__, __LINE__, PRINT_REG(addr));
-		//script_debug_flag = script_error_flag = 1;
+		//script_debug_flag = 1;
 		warning("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr));
 		return NULL;
 	}
@@ -45,8 +45,7 @@
 	NodeTable *nt = (NodeTable *)mobj;
 
 	if (!nt->isValidEntry(addr.offset)) {
-		sciprintf("Attempt to use non-node %04x:%04x as list node\n", PRINT_REG(addr));
-		script_debug_flag = script_error_flag = 1;
+		error("Attempt to use non-node %04x:%04x as list node\n", PRINT_REG(addr));
 		return NULL;
 	}
 
@@ -57,16 +56,14 @@
 	MemObject *mobj = GET_SEGMENT(*s->seg_manager, addr.segment, MEM_OBJ_LISTS);
 
 	if (!mobj) {
-		sciprintf("Attempt to use non-list %04x:%04x as list\n", PRINT_REG(addr));
-		script_debug_flag = script_error_flag = 1;
+		error("Attempt to use non-list %04x:%04x as list\n", PRINT_REG(addr));
 		return NULL;
 	}
 
 	ListTable *lt = (ListTable *)mobj;
 
 	if (!lt->isValidEntry(addr.offset)) {
-		sciprintf("Attempt to use non-list %04x:%04x as list\n", PRINT_REG(addr));
-		script_debug_flag = script_error_flag = 1;
+		error("Attempt to use non-list %04x:%04x as list\n", PRINT_REG(addr));
 		return NULL;
 	}
 
@@ -284,7 +281,6 @@
 	Node *n = lookup_node(s, argv[0]);
 	if (!sane_nodep(s, argv[0])) {
 		error("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
-		script_error_flag = script_debug_flag = 0;
 		return NULL_REG;
 	}
 
@@ -303,7 +299,6 @@
 	Node *n = lookup_node(s, argv[0]);
 	if (!sane_nodep(s, argv[0])) {
 		error("List node at %04x:%04x is not sane", PRINT_REG(argv[0]));
-		script_debug_flag = script_error_flag = 0;
 		return NULL_REG;
 	}
 

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -95,7 +95,6 @@
 reg_t kSetDebug(EngineState *s, int funct_nr, int argc, reg_t *argv) {
 	sciprintf("Debug mode activated\n");
 
-	script_debug_flag = 1; // Enter debug mode
 	_debug_seeking = _debug_step_running = 0;
 	return s->r_acc;
 }
@@ -168,7 +167,6 @@
 	case K_MEMORY_ALLOCATE_CRITICAL :
 		if (!s->seg_manager->allocDynmem(UKPV(1), "kMemory() critical", &s->r_acc)) {
 			error("Critical heap allocation failed");
-			script_error_flag = script_debug_flag = 1;
 		}
 		return s->r_acc;
 		break;

Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -119,7 +119,6 @@
 
 #define FROBNICATE_HANDLE(reg) ((reg).segment << 16 | (reg).offset)
 #define DEFROBNICATE_HANDLE(handle) (make_reg((handle >> 16) & 0xffff, handle & 0xffff))
-#define SCRIPT_ASSERT_ZERO(fun) do { if (fun) script_debug_flag = script_error_flag = 1; } while(0)
 
 
 static void script_set_priority(EngineState *s, reg_t obj, int priority) {
@@ -273,11 +272,9 @@
 	case _K_SCI0_SOUND_INIT_HANDLE:
 		if (obj.segment) {
 			sciprintf("Initializing song number %d\n", GET_SEL32V(obj, number));
-			SCRIPT_ASSERT_ZERO(s->_sound.sfx_add_song(
-			                                build_iterator(s, number,
-			                                               SCI_SONG_ITERATOR_TYPE_SCI0,
-			                                               handle),
-			                                0, handle, number));
+			s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI0,
+			                                               handle), 0, handle, number);
+
 			PUT_SEL32V(obj, state, _K_SOUND_STATUS_INITIALIZED);
 			PUT_SEL32(obj, handle, obj); /* ``sound handle'': we use the object address */
 		}
@@ -508,11 +505,8 @@
 
 		if (obj.segment && (s->resmgr->testResource(kResourceTypeSound, number))) {
 			sciprintf("Initializing song number %d\n", number);
-			SCRIPT_ASSERT_ZERO(s->_sound.sfx_add_song(
-			                                build_iterator(s, number,
-			                                               SCI_SONG_ITERATOR_TYPE_SCI1,
-			                                               handle),
-			                                0, handle, number));
+			s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1,
+			                                      handle), 0, handle, number);
 			PUT_SEL32(obj, nodePtr, obj);
 			PUT_SEL32(obj, handle, obj);
 		}
@@ -819,11 +813,8 @@
 			}
 
 			sciprintf("Initializing song number %d\n", number);
-			SCRIPT_ASSERT_ZERO(s->_sound.sfx_add_song(
-			                                build_iterator(s, number,
-			                                               SCI_SONG_ITERATOR_TYPE_SCI1,
-			                                               handle),
-			                                0, handle, number));
+			s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1,
+			                          handle), 0, handle, number);
 			PUT_SEL32(obj, nodePtr, obj);
 			PUT_SEL32(obj, handle, obj);
 		}
@@ -848,11 +839,8 @@
 
 		if (obj.segment && (s->resmgr->testResource(kResourceTypeSound, number))) {
 			sciprintf("Initializing song number %d\n", number);
-			SCRIPT_ASSERT_ZERO(s->_sound.sfx_add_song(
-			                                build_iterator(s, number,
-			                                               SCI_SONG_ITERATOR_TYPE_SCI1,
-			                                               handle),
-			                                0, handle, number));
+			s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1,
+			                                    handle), 0, handle, number);
 			PUT_SEL32(obj, nodePtr, obj);
 			PUT_SEL32(obj, handle, obj);
 		}

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -1400,7 +1400,6 @@
 static int c_go(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
 	_debug_seeking = 0;
 	_debugstate_valid = 0;
-	script_debug_flag = 0;
 	return 0;
 }
 
@@ -1795,7 +1794,7 @@
 
 int c_se(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
 	stop_on_event = 1;
-	_debugstate_valid = script_debug_flag = script_error_flag = 0;
+	_debugstate_valid = 0;
 
 	return 0;
 }
@@ -1908,9 +1907,6 @@
 
 	_debugstate_valid = old_debugstate;
 
-	if (!script_debug_flag)
-		return;
-
 	if (_debug_seeking && !bp) { // Are we looking for something special?
 		MemObject *mobj = GET_SEGMENT(*s->seg_manager, pc->segment, MEM_OBJ_SCRIPT);
 

Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -749,9 +749,8 @@
 			int species = READ_LE_UINT16(seeker + 10);
 
 			if (species < 0 || species >= (int)s->_classtable.size()) {
-				sciprintf("Invalid species %d(0x%x) not in interval [0,%d) while instantiating script %d\n",
+				error("Invalid species %d(0x%x) not in interval [0,%d) while instantiating script %d\n",
 				          species, species, s->_classtable.size(), scr->nr);
-				script_debug_flag = script_error_flag = 1;
 				return;
 			}
 

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -46,8 +46,6 @@
 
 
 int script_abort_flag = 0; // Set to 1 to abort execution
-int script_error_flag = 0; // Set to 1 if an error occured, reset each round by the VM
-int script_debug_flag = 0; // Set to 1 for script debugging
 int script_step_counter = 0; // Counts the number of steps executed
 int script_gc_interval = GC_INTERVAL; // Number of steps in between gcs
 
@@ -84,8 +82,7 @@
 	if (sp >= s->stack_base && sp < s->stack_top)
 		return sp;
 
-	script_debug_flag = script_error_flag = 1;
-	debugC(2, kDebugLevelVM, "[VM] Stack index %d out of valid range [%d..%d]\n", 
+	error("[VM] Stack index %d out of valid range [%d..%d]\n", 
 		(int)(sp - s->stack_base), 0, (int)(s->stack_top - s->stack_base - 1));
 	return 0;
 }
@@ -93,8 +90,7 @@
 static int validate_arithmetic(reg_t reg) {
 	if (reg.segment) {
 		if (!_weak_validations)
-			script_debug_flag = script_error_flag = 1;
-		debugC(2, kDebugLevelVM, "[VM] Attempt to read arithmetic value from non-zero segment [%04x]\n", reg.segment);
+			error("[VM] Attempt to read arithmetic value from non-zero segment [%04x]\n", reg.segment);
 		return 0;
 	}
 
@@ -103,9 +99,10 @@
 
 static int signed_validate_arithmetic(reg_t reg) {
 	if (reg.segment) {
-		if (!_weak_validations)
-			script_debug_flag = script_error_flag = 1;
 		debugC(2, kDebugLevelVM, "[VM] Attempt to read arithmetic value from non-zero segment [%04x]\n", reg.segment);
+		if (!_weak_validations) {
+			error("signed_validate_arithmetic failed");
+		}
 		return 0;
 	}
 
@@ -125,8 +122,9 @@
 		else
 			sciprintf("(out of range [%d..%d])", 0, max - 1);
 		sciprintf(" in %s, line %d\n", __FILE__, line);
-		if (!_weak_validations)
-			script_debug_flag = script_error_flag = 1;
+		if (!_weak_validations) {
+			error("validate_variable failed");
+		}
 
 #ifdef STRICT_READ
 		return 1;
@@ -186,8 +184,7 @@
 #define OBJ_PROPERTY(o, p) (validate_property(o, p))
 
 int script_error(EngineState *s, const char *file, int line, const char *reason) {
-	sciprintf("Script error in file %s, line %d: %s\n", file, line, reason);
-	script_debug_flag = script_error_flag = 1;
+	error("Script error in file %s, line %d: %s\n", file, line, reason);
 	return 0;
 }
 #define CORE_ERROR(area, msg) script_error(s, "[" area "] " __FILE__, __LINE__, msg)
@@ -200,8 +197,7 @@
 	}
 
 	if (classnr < 0 || (int)s->_classtable.size() <= classnr || s->_classtable[classnr].script < 0) {
-		warning("[VM] Attempt to dereference class %x, which doesn't exist (max %x)", classnr, s->_classtable.size());
-		script_error_flag = script_debug_flag = 1;
+		error("[VM] Attempt to dereference class %x, which doesn't exist (max %x)", classnr, s->_classtable.size());
 		return NULL_REG;
 	} else {
 		Class *the_class = &s->_classtable[classnr];
@@ -209,9 +205,8 @@
 			script_get_segment(s, the_class->script, lock);
 
 			if (!the_class->reg.segment) {
-				warning("[VM] Trying to instantiate class %x by instantiating script 0x%x (%03d) failed;"
+				error("[VM] Trying to instantiate class %x by instantiating script 0x%x (%03d) failed;"
 				          " Entering debugger.", classnr, the_class->script, the_class->script);
-				script_error_flag = script_debug_flag = 1;
 				return NULL_REG;
 			}
 		} else
@@ -249,8 +244,7 @@
 
 	int temp = s->seg_manager->validateExportFunc(pubfunct, seg);
 	if (!temp) {
-		sciprintf("Request for invalid exported function 0x%x of script 0x%x\n", pubfunct, script);
-		script_error_flag = script_debug_flag = 1;
+		error("Request for invalid exported function 0x%x of script 0x%x\n", pubfunct, script);
 		return NULL;
 	}
 
@@ -265,7 +259,6 @@
 		while (bp) {
 			if (bp->type == BREAK_EXPORT && bp->data.address == bpaddress) {
 				sciprintf("Break on script %d, export %d\n", script, pubfunct);
-				script_debug_flag = 1;
 				breakpointFlag = true;
 				break;
 			}
@@ -332,7 +325,7 @@
 
 				if (bp->type == BREAK_SELECTOR && !strncmp(bp->data.name, method_name, cmplen)) {
 					sciprintf("Break on %s (in [%04x:%04x])\n", method_name, PRINT_REG(send_obj));
-					script_debug_flag = print_send_action = 1;
+					print_send_action = 1;
 					breakpointFlag = true;
 					break;
 				}
@@ -353,8 +346,6 @@
 				break;
 			}
 
-			script_error_flag = script_debug_flag = 1;
-
 			error("Send to invalid selector 0x%x of object at %04x:%04x\n", 0xffff & selector, PRINT_REG(send_obj));
 
 			break;
@@ -519,8 +510,7 @@
 	MemObject *mobj = GET_SEGMENT_ANY(*s->seg_manager, base.segment);
 
 	if (!mobj) {
-		script_debug_flag = script_error_flag = 1;
-		sciprintf("[VM] Error: Attempt to add %d to invalid pointer %04x:%04x!", offset, PRINT_REG(base));
+		error("[VM] Error: Attempt to add %d to invalid pointer %04x:%04x!", offset, PRINT_REG(base));
 		return NULL_REG;
 	}
 
@@ -674,8 +664,6 @@
 
 		}
 
-		script_error_flag = 0; // Set error condition to false
-
 		if (script_abort_flag)
 			return; // Emergency
 
@@ -750,8 +738,7 @@
 
 			case Script_Invalid:
 			default:
-				sciprintf("opcode %02x: Invalid!", opcode);
-				script_debug_flag = script_error_flag = 1;
+				error("opcode %02x: Invalid", opcode);
 			}
 
 		// TODO: Replace the following by an opcode table, and several methods for
@@ -770,9 +757,8 @@
 				// Pointer arithmetics!
 				if (s->r_acc.segment) {
 					if (r_temp.segment) {
-						sciprintf("Error: Attempt to add two pointers, stack=%04x:%04x and acc=%04x:%04x!\n",
+						error("Attempt to add two pointers, stack=%04x:%04x and acc=%04x:%04x",
 						          PRINT_REG(r_temp), PRINT_REG(s->r_acc));
-						script_debug_flag = script_error_flag = 1;
 						offset = 0;
 					} else {
 						r_ptr = s->r_acc;
@@ -797,9 +783,8 @@
 				// Pointer arithmetics!
 				if (s->r_acc.segment) {
 					if (r_temp.segment) {
-						sciprintf("Error: Attempt to subtract two pointers, stack=%04x:%04x and acc=%04x:%04x!\n",
+						error("Attempt to subtract two pointers, stack=%04x:%04x and acc=%04x:%04x",
 						          PRINT_REG(r_temp), PRINT_REG(s->r_acc));
-						script_debug_flag = script_error_flag = 1;
 						offset = 0;
 					} else {
 						r_ptr = s->r_acc;
@@ -988,8 +973,7 @@
 			}
 
 			if (opparams[0] >= (int)s->_kfuncTable.size()) {
-				sciprintf("Invalid kernel function 0x%x requested\n", opparams[0]);
-				script_debug_flag = script_error_flag = 1;
+				error("Invalid kernel function 0x%x requested\n", opparams[0]);
 			} else {
 				int argc = ASSERT_ARITHMETIC(xs->sp[0]);
 
@@ -998,8 +982,7 @@
 
 				if (s->_kfuncTable[opparams[0]].signature
 				        && !kernel_matches_signature(s, s->_kfuncTable[opparams[0]].signature, argc, xs->sp + 1)) {
-					sciprintf("[VM] Invalid arguments to kernel call %x\n", opparams[0]);
-					script_debug_flag = script_error_flag = 1;
+					error("[VM] Invalid arguments to kernel call %x\n", opparams[0]);
 				} else {
 					s->r_acc = s->_kfuncTable[opparams[0]].fun(s, opparams[0], argc, xs->sp + 1);
 				}
@@ -1225,9 +1208,8 @@
 
 #ifndef DISABLE_VALIDATIONS
 			if (s->r_acc.offset >= code_buf_size) {
-				sciprintf("VM: lofsa operation overflowed: %04x:%04x beyond end"
+				error("VM: lofsa operation overflowed: %04x:%04x beyond end"
 				          " of script (at %04x)\n", PRINT_REG(s->r_acc), code_buf_size);
-				script_error_flag = script_debug_flag = 1;
 			}
 #endif
 			break;
@@ -1241,9 +1223,8 @@
 				r_temp.offset = xs->addr.pc.offset + opparams[0];
 #ifndef DISABLE_VALIDATIONS
 			if (r_temp.offset >= code_buf_size) {
-				sciprintf("VM: lofss operation overflowed: %04x:%04x beyond end"
+				error("VM: lofss operation overflowed: %04x:%04x beyond end"
 				          " of script (at %04x)\n", PRINT_REG(r_temp), code_buf_size);
-				script_error_flag = script_debug_flag = 1;
 			}
 #endif
 			PUSH32(r_temp);
@@ -1439,12 +1420,15 @@
 					opnumber);
 		}
 //#endif
+
+#if 0
 		if (script_error_flag) {
 			_debug_step_running = 0; // Stop multiple execution
 			_debug_seeking = 0; // Stop special seeks
 			xs->addr.pc.offset = old_pc_offset;
 			xs->sp = old_sp;
 		} else
+#endif
 			++script_step_counter;
 	}
 }
@@ -1652,8 +1636,7 @@
 	} else {
 		scr = s->seg_manager->allocateScript(s, script_nr, &seg_id);
 		if (!scr) {  // ALL YOUR SCRIPT BASE ARE BELONG TO US
-			sciprintf("Not enough heap space for script size 0x%x of script 0x%x, should this happen?`\n", (*script)->size, script_nr);
-			script_debug_flag = script_error_flag = 1;
+			error("Not enough heap space for script size 0x%x of script 0x%x (Should this happen?)", (*script)->size, script_nr);
 			return 0;
 		}
 	}
@@ -1754,11 +1737,10 @@
 			int species;
 			species = scr->getHeap(addr.offset - SCRIPT_OBJECT_MAGIC_OFFSET + SCRIPT_SPECIES_OFFSET);
 			if (species < 0 || species >= (int)s->_classtable.size()) {
-				sciprintf("Invalid species %d(0x%x) not in interval "
+				error("Invalid species %d(0x%x) not in interval "
 				          "[0,%d) while instantiating script %d\n",
 				          species, species, s->_classtable.size(),
 				          script_nr);
-				script_debug_flag = script_error_flag = 1;
 				return 1;
 			}
 
@@ -2021,7 +2003,7 @@
 	_init_stack_base_with_selector(s, s->_vocabulary->_selectorMap.play); // Call the play selector
 
 	// Now: Register the first element on the execution stack-
-	if (!send_selector(s, s->game_obj, s->game_obj, s->stack_base, 2, s->stack_base) || script_error_flag) {
+	if (!send_selector(s, s->game_obj, s->game_obj, s->stack_base, 2, s->stack_base)) {
 		objinfo(s, s->game_obj);
 		sciprintf("Failed to run the game! Aborting...\n");
 		return 1;

Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/engine/vm.h	2009-05-31 15:34:23 UTC (rev 41073)
@@ -787,13 +787,6 @@
 	Breakpoint *next;
 };
 
-/** Set this to 1 to activate script debugging */
-extern int script_debug_flag;
-
-/** Set to 1 to move pc back to last position, even though action is executed */
-extern int script_error_flag;
-
-
 #define SCRIPT_ABORT_WITH_REPLAY 1025
 
 /**

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -124,8 +124,6 @@
 
 	// FIXME/TODO: Move some of the stuff below to init()
 
-	script_debug_flag = 0;
-
 	sci_version_t version;
 	int res_version = getResourceVersion();
 

Modified: scummvm/trunk/engines/sci/sfx/core.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.cpp	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/sfx/core.cpp	2009-05-31 15:34:23 UTC (rev 41073)
@@ -783,15 +783,15 @@
 /*  Song basics  */
 /*****************/
 
-int SfxState::sfx_add_song(SongIterator *it, int priority, song_handle_t handle, int number) {
+void SfxState::sfx_add_song(SongIterator *it, int priority, song_handle_t handle, int number) {
 	song_t *song = song_lib_find(_songlib, handle);
 
 #ifdef DEBUG_SONG_API
 	fprintf(stderr, "[sfx-core] Adding song: %08lx at %d, it=%p\n", handle, priority, it);
 #endif
 	if (!it) {
-		warning("[SFX] Attempt to add empty song with handle %08lx", handle);
-		return -1;
+		error("[SFX] Attempt to add empty song with handle %08lx", handle);
+		return;
 	}
 
 	it->init();
@@ -809,10 +809,10 @@
 		fprintf(stderr, "Overwriting old song (%08lx) ...\n", handle);
 		if (song->status == SOUND_STATUS_PLAYING
 		        || song->status == SOUND_STATUS_SUSPENDED) {
-			warning("Unexpected (error): Song %ld still playing/suspended (%d)",
+			delete it;
+			error("Unexpected (error): Song %ld still playing/suspended (%d)",
 			        handle, song->status);
-			delete it;
-			return -1;
+			return;
 		} else
 			song_lib_remove(_songlib, handle); /* No duplicates */
 
@@ -827,7 +827,7 @@
 	_song = NULL; /* As above */
 	update();
 
-	return 0;
+	return;
 }
 
 void SfxState::sfx_remove_song(song_handle_t handle) {

Modified: scummvm/trunk/engines/sci/sfx/core.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.h	2009-05-31 15:08:47 UTC (rev 41072)
+++ scummvm/trunk/engines/sci/sfx/core.h	2009-05-31 15:34:23 UTC (rev 41073)
@@ -112,9 +112,8 @@
 	** Parameters: (SongIterator *) it: The iterator describing the song
 	**             (int) priority: Initial song priority (higher <-> more important)
 	**             (song_handle_t) handle: The handle to associate with the song
-	** Returns   : (int) 0 on success, nonzero on error
 	*/
-	int sfx_add_song(SongIterator *it, int priority, song_handle_t handle, int resnum);
+	void sfx_add_song(SongIterator *it, int priority, song_handle_t handle, int resnum);
 
 
 	/* Deletes a song and its associated song iterator from the song queue


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list