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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Oct 1 01:00:04 CEST 2009


Revision: 44505
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44505&view=rev
Author:   thebluegr
Date:     2009-09-30 23:00:03 +0000 (Wed, 30 Sep 2009)

Log Message:
-----------
Added a new special reg_t, SIGNAL_REG, for signaling when an error occurs (usually), or to signal success in some special occasions

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kfile.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/kmath.cpp
    scummvm/trunk/engines/sci/engine/kmisc.cpp
    scummvm/trunk/engines/sci/engine/kmovement.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/engine/vm_types.h
    scummvm/trunk/engines/sci/gfx/menubar.cpp

Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp	2009-09-30 22:54:30 UTC (rev 44504)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2009-09-30 23:00:03 UTC (rev 44505)
@@ -148,7 +148,7 @@
 
 	if (!inFile && !outFile) { // Failed
 		debug(3, "file_open() failed");
-		s->r_acc = make_reg(0, SIGNAL_OFFSET);
+		s->r_acc = SIGNAL_REG;
 		return;
 	}
 
@@ -755,7 +755,7 @@
 
 		if (name.empty()) {
 			warning("Attempted to open a file with an empty filename");
-			return make_reg(0, SIGNAL_OFFSET);
+			return SIGNAL_REG;
 		}
 		file_open(s, name.c_str(), mode);
 		debug(3, "K_FILEIO_OPEN(%s,0x%x)", name.c_str(), mode);

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-09-30 22:54:30 UTC (rev 44504)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-09-30 23:00:03 UTC (rev 44505)
@@ -876,7 +876,7 @@
 
 	if (!res) {
 		warning("[GFX] Attempt to get cel parameters for invalid view %d", view);
-		return make_reg(0, SIGNAL_OFFSET);
+		return SIGNAL_REG;
 	}
 
 	pxm = res->loops[loop].cels[cel];

Modified: scummvm/trunk/engines/sci/engine/kmath.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmath.cpp	2009-09-30 22:54:30 UTC (rev 44504)
+++ scummvm/trunk/engines/sci/engine/kmath.cpp	2009-09-30 23:00:03 UTC (rev 44505)
@@ -130,7 +130,7 @@
 
 	if ((cosval < 0.0001) && (cosval > -0.0001)) {
 		warning("kCosDiv: Attempted division by zero");
-		return make_reg(0, SIGNAL_OFFSET);
+		return SIGNAL_REG;
 	} else
 		return make_reg(0, (int16)(value / cosval));
 }
@@ -142,7 +142,7 @@
 
 	if ((sinval < 0.0001) && (sinval > -0.0001)) {
 		warning("kSinDiv: Attempted division by zero");
-		return make_reg(0, SIGNAL_OFFSET);
+		return SIGNAL_REG;
 	} else
 		return make_reg(0, (int16)(value / sinval));
 }
@@ -154,7 +154,7 @@
 	param -= 90;
 	if ((param % 90) == 0) {
 		warning("kTimesTan: Attempted tan(pi/2)");
-		return make_reg(0, SIGNAL_OFFSET);
+		return SIGNAL_REG;
 	} else
 		return make_reg(0, (int16) - (tan(param * PI / 180.0) * scale));
 }
@@ -165,7 +165,7 @@
 
 	if ((param % 90) == 0) {
 		warning("kTimesCot: Attempted tan(pi/2)");
-		return make_reg(0, SIGNAL_OFFSET);
+		return SIGNAL_REG;
 	} else
 		return make_reg(0, (int16)(tan(param * PI / 180.0) * scale));
 }

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2009-09-30 22:54:30 UTC (rev 44504)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2009-09-30 23:00:03 UTC (rev 44505)
@@ -60,7 +60,7 @@
 }
 
 reg_t kHaveMouse(EngineState *s, int argc, reg_t *argv) {
-	return make_reg(0, SIGNAL_OFFSET);
+	return SIGNAL_REG;
 }
 
 enum kMemoryInfoFunc {

Modified: scummvm/trunk/engines/sci/engine/kmovement.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmovement.cpp	2009-09-30 22:54:30 UTC (rev 44504)
+++ scummvm/trunk/engines/sci/engine/kmovement.cpp	2009-09-30 23:00:03 UTC (rev 44505)
@@ -401,7 +401,7 @@
 	int dx, dy;
 	int destx, desty;
 
-	s->r_acc = make_reg(0, SIGNAL_OFFSET);
+	s->r_acc = SIGNAL_REG;
 
 	if (!s->segMan->isHeapObject(avoider)) {
 		warning("DoAvoider() where avoider %04x:%04x is not an object", PRINT_REG(avoider));

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-09-30 22:54:30 UTC (rev 44504)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-09-30 23:00:03 UTC (rev 44505)
@@ -40,6 +40,7 @@
 namespace Sci {
 
 reg_t NULL_REG = {0, 0};
+reg_t SIGNAL_REG = {0, SIGNAL_OFFSET};
 
 //#define VM_DEBUG_SEND
 #undef STRICT_SEND // Disallows variable sends with more than one parameter

Modified: scummvm/trunk/engines/sci/engine/vm_types.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm_types.h	2009-09-30 22:54:30 UTC (rev 44504)
+++ scummvm/trunk/engines/sci/engine/vm_types.h	2009-09-30 23:00:03 UTC (rev 44505)
@@ -81,6 +81,7 @@
 }
 
 extern reg_t NULL_REG;
+extern reg_t SIGNAL_REG;
 
 } // End of namespace Sci
 

Modified: scummvm/trunk/engines/sci/gfx/menubar.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/menubar.cpp	2009-09-30 22:54:30 UTC (rev 44504)
+++ scummvm/trunk/engines/sci/gfx/menubar.cpp	2009-09-30 23:00:03 UTC (rev 44505)
@@ -345,10 +345,10 @@
 
 reg_t Menubar::getAttribute(int menu_nr, int item_nr, int attribute) const {
 	if ((menu_nr < 0) || (item_nr < 0))
-		return make_reg(0, SIGNAL_OFFSET);
+		return SIGNAL_REG;
 
 	if ((menu_nr >= (int)_menus.size()) || (item_nr >= (int)_menus[menu_nr]._items.size()))
-		return make_reg(0, SIGNAL_OFFSET);
+		return SIGNAL_REG;
 
 	const MenuItem &item = _menus[menu_nr]._items[item_nr];
 
@@ -370,7 +370,7 @@
 
 	default:
 		warning("Attempt to read invalid attribute from menu %d, item %d: 0x%04x", menu_nr, item_nr, attribute);
-		return make_reg(0, SIGNAL_OFFSET);
+		return SIGNAL_REG;
 	}
 }
 


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