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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun May 10 12:27:45 CEST 2009


Revision: 40412
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40412&view=rev
Author:   thebluegr
Date:     2009-05-10 10:27:45 +0000 (Sun, 10 May 2009)

Log Message:
-----------
Moved the code which retrieves the current room number in a separate function and merged _sci1_alloc_system_colors inside _reset_graphics_input

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/game.cpp
    scummvm/trunk/engines/sci/engine/kpathing.cpp
    scummvm/trunk/engines/sci/engine/kstring.cpp
    scummvm/trunk/engines/sci/engine/state.h

Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp	2009-05-10 09:53:39 UTC (rev 40411)
+++ scummvm/trunk/engines/sci/engine/game.cpp	2009-05-10 10:27:45 UTC (rev 40412)
@@ -68,11 +68,6 @@
 
 extern int _allocd_rules;
 
-static void _sci1_alloc_system_colors(EngineState *s) {
-	gfx_color_t black = { PaletteEntry(0, 0, 0), 0, 0, 0, GFX_MASK_VISUAL };
-	gfxop_set_system_color(s->gfx_state, 0, &black);
-}
-
 int _reset_graphics_input(EngineState *s) {
 	Resource *resource;
 	int font_nr;
@@ -90,7 +85,9 @@
 			gfxop_set_system_color(s->gfx_state, i, &(s->ega_colors[i]));
 		}
 	} else {
-		_sci1_alloc_system_colors(s);
+		// Allocate SCI1 system colors
+		gfx_color_t black = { PaletteEntry(0, 0, 0), 0, 0, 0, GFX_MASK_VISUAL };
+		gfxop_set_system_color(s->gfx_state, 0, &black);
 
 		// Check for Amiga palette file.
 		Common::File file;

Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp	2009-05-10 09:53:39 UTC (rev 40411)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp	2009-05-10 10:27:45 UTC (rev 40412)
@@ -1233,8 +1233,7 @@
 	// WORKAROUND: broken polygon in LSL1VGA, room 350, after opening elevator
 	// Polygon has 17 points but size is set to 19
 	if ((size == 19) && (s->_gameName == "LSL1")) {
-		// FIXME: implement function to get current room number
-		if ((KP_UINT(s->script_000->locals_block->locals[13]) == 350)
+		if ((s->currentRoomNumber() == 350)
 		&& (read_point(list, is_reg_t, 18) == Common::Point(108, 137))) {
 			debug(1, "Applying fix for broken polygon in LSL1VGA, room 350");
 			size = 17;
@@ -1243,21 +1242,21 @@
 
 	// WORKAROUND: self-intersecting polygons in ECO, rooms 221, 280 and 300
 	if ((size == 11) && (s->_gameName == "eco")) {
-		if ((KP_UINT(s->script_000->locals_block->locals[13]) == 300)
+		if ((s->currentRoomNumber() == 300)
 		&& (read_point(list, is_reg_t, 10) == Common::Point(221, 0))) {
 			debug(1, "Applying fix for self-intersecting polygon in ECO, room 300");
 			size = 10;
 		}
 	}
 	if ((size == 12) && (s->_gameName == "eco")) {
-		if ((KP_UINT(s->script_000->locals_block->locals[13]) == 280)
+		if ((s->currentRoomNumber() == 280)
 		&& (read_point(list, is_reg_t, 11) == Common::Point(238, 189))) {
 			debug(1, "Applying fix for self-intersecting polygon in ECO, room 280");
 			size = 10;
 		}
 	}
 	if ((size == 16) && (s->_gameName == "eco")) {
-		if ((KP_UINT(s->script_000->locals_block->locals[13]) == 221)
+		if ((s->currentRoomNumber() == 221)
 		&& (read_point(list, is_reg_t, 1) == Common::Point(419, 175))) {
 			debug(1, "Applying fix for self-intersecting polygon in ECO, room 221");
 			// Swap the first two points
@@ -1437,11 +1436,8 @@
 			return NULL;
 		}
 
-		if (s->_gameName == "Longbow") {
-			// FIXME: implement function to get current room number
-			if ((KP_UINT(s->script_000->locals_block->locals[13]) == 210))
+		if (s->_gameName == "Longbow" && s->currentRoomNumber() == 210)
 				fixLongbowRoom210(pf_s, *new_start, *new_end);
-		}
 
 		// Merge start and end points into polygon set
 		pf_s->vertex_start = merge_point(pf_s, *new_start);

Modified: scummvm/trunk/engines/sci/engine/kstring.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kstring.cpp	2009-05-10 09:53:39 UTC (rev 40411)
+++ scummvm/trunk/engines/sci/engine/kstring.cpp	2009-05-10 10:27:45 UTC (rev 40412)
@@ -424,8 +424,7 @@
 	// LSL5 stores the password at the beginning in memory.drv, using XOR encryption,
 	// which means that is_print_str() will fail. Therefore, do not use the heuristic to determine
 	// if we're handling a string or an array for LSL5's password screen (room 155)
-	// FIXME: implement function to get current room number
-	if (s->_gameName.equalsIgnoreCase("lsl5") && (KP_UINT(s->script_000->locals_block->locals[13]) == 155))
+	if (s->_gameName.equalsIgnoreCase("lsl5") && s->currentRoomNumber() == 155)
 		lsl5PasswordWorkaround = true;
 
 	const char* dst = (const char *)dest; // used just for code beautification purposes

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2009-05-10 09:53:39 UTC (rev 40411)
+++ scummvm/trunk/engines/sci/engine/state.h	2009-05-10 10:27:45 UTC (rev 40412)
@@ -231,6 +231,8 @@
 	reg_t parser_event; /**< The event passed to Parse() and later used by Said() */
 	SegmentId script_000_segment;
 	Script *script_000;  /**< script 000, e.g. for globals */
+	
+	uint16 currentRoomNumber() { return KP_UINT(script_000->locals_block->locals[13]); }
 
 	int parser_lastmatch_word; /**< Position of the input word the parser last matched on, or SAID_NO_MATCH */
 


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