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

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Sun May 17 15:37:54 CEST 2009


Revision: 40648
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40648&view=rev
Author:   waltervn
Date:     2009-05-17 13:37:54 +0000 (Sun, 17 May 2009)

Log Message:
-----------
SCI: LSL6 invalid selector workaround is now always active, not just at
startup. Added support for mirrored pic drawing.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resource.h
    scummvm/trunk/engines/sci/gfx/res_pic.cpp
    scummvm/trunk/engines/sci/gfx/res_view1.cpp

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-05-17 13:35:37 UTC (rev 40647)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-05-17 13:37:54 UTC (rev 40648)
@@ -972,16 +972,22 @@
 
 int sci01_priority_table_flags = 0;
 
+#define K_DRAWPIC_FLAG_MIRRORED (1 << 14)
+
 reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
 	drawn_pic_t dp;
 	int add_to_pic = 1;
 	gfx_color_t transparent = s->wm_port->_bgcolor;
+	int picFlags = DRAWPIC01_FLAG_FILL_NORMALLY;
 
 	CHECK_THIS_KERNEL_FUNCTION;
 
 	dp.nr = SKPV(0);
 	dp.palette = SKPV_OR_ALT(3, 0);
 
+	if ((argc > 1) && (UKPV(1) & K_DRAWPIC_FLAG_MIRRORED))
+		picFlags |= DRAWPIC1_FLAG_MIRRORED;
+
 	if (s->flags & GF_SCI0_OLDGFXFUNCS) {
 		if (!SKPV_OR_ALT(2, 0))
 			add_to_pic = 0;
@@ -1002,11 +1008,11 @@
 
 	if (add_to_pic) {
 		s->_pics.push_back(dp);
-		GFX_ASSERT(gfxop_add_to_pic(s->gfx_state, dp.nr, 1, dp.palette));
+		GFX_ASSERT(gfxop_add_to_pic(s->gfx_state, dp.nr, picFlags, dp.palette));
 	} else {
 		s->_pics.clear();
 		s->_pics.push_back(dp);
-		GFX_ASSERT(gfxop_new_pic(s->gfx_state, dp.nr, 1, dp.palette));
+		GFX_ASSERT(gfxop_new_pic(s->gfx_state, dp.nr, picFlags, dp.palette));
 	}
 
 	delete s->wm_port;
@@ -1040,7 +1046,7 @@
 		s->pic_priority_table = NULL;
 
 	if (argc > 1)
-		s->pic_animate = SKPV(1); // The animation used during kAnimate() later on
+		s->pic_animate = SKPV(1) & 0xff; // The animation used during kAnimate() later on
 
 	s->dyn_views = NULL;
 	s->drop_views = NULL;

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-05-17 13:35:37 UTC (rev 40647)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-05-17 13:37:54 UTC (rev 40648)
@@ -371,8 +371,8 @@
 
 			// WORKAROUND: LSL6 tries to access the invalid 'keep' selector of the game object.
 			// FIXME: Find out if this is a game bug.
-			if ((s->_gameName == "LSL6") && (s->currentRoomNumber() == 100)) {
-				debug("LSL6 room 100 detected, continuing...");
+			if ((s->_gameName == "LSL6") && (selector == 0x18c)) {
+				debug("LSL6 detected, continuing...");
 				break;
 			}
 

Modified: scummvm/trunk/engines/sci/gfx/gfx_resource.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resource.h	2009-05-17 13:35:37 UTC (rev 40647)
+++ scummvm/trunk/engines/sci/gfx/gfx_resource.h	2009-05-17 13:37:54 UTC (rev 40648)
@@ -50,6 +50,7 @@
 
 #define DRAWPIC01_FLAG_FILL_NORMALLY 1
 #define DRAWPIC01_FLAG_OVERLAID_PIC 2
+#define DRAWPIC1_FLAG_MIRRORED 4
 
 #define GFXR_AUX_MAP_SIZE (320*200)
 

Modified: scummvm/trunk/engines/sci/gfx/res_pic.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/res_pic.cpp	2009-05-17 13:35:37 UTC (rev 40647)
+++ scummvm/trunk/engines/sci/gfx/res_pic.cpp	2009-05-17 13:37:54 UTC (rev 40648)
@@ -1015,14 +1015,16 @@
 	x = *(resource + pos++); \
 	y = *(resource + pos++); \
 	x |= (temp & 0xf0) << 4; \
-	y |= (temp & 0x0f) << 8;
+	y |= (temp & 0x0f) << 8; \
+	if (flags & DRAWPIC1_FLAG_MIRRORED) \
+		x = 319 - x;
 
 #define GET_REL_COORDS(x, y) \
 	temp = *(resource + pos++); \
 	if (temp & 0x80) \
-		x -= ((temp >> 4) & 0x7); \
+		x -= ((temp >> 4) & 0x7) * (flags & DRAWPIC1_FLAG_MIRRORED ? -1 : 1); \
 	else \
-		x += (temp >> 4); \
+		x += (temp >> 4) * (flags & DRAWPIC1_FLAG_MIRRORED ? -1 : 1); \
 	\
 	if (temp & 0x08) \
 		y -= (temp & 0x7); \
@@ -1035,7 +1037,7 @@
 		y = oldy - (temp & 0x7f); \
 	else \
 		y = oldy + temp; \
-	x = oldx + *((signed char *) resource + pos++);
+	x = oldx + *((signed char *) resource + pos++) * (flags & DRAWPIC1_FLAG_MIRRORED ? -1 : 1);
 
 
 static void check_and_remove_artifact(byte *dest, byte* srcp, int legalcolor, byte l, byte r, byte u, byte d) {
@@ -1505,12 +1507,17 @@
 				p0printf("(%d, %d)\n", posx, posy);
 				pos += 2;
 				if (!sci1 && !nodraw)
-					view = gfxr_draw_cel0(-1, -1, -1, resource + pos, bytesize, NULL, 0);
+					view = gfxr_draw_cel0(-1, -1, -1, resource + pos, bytesize, NULL, flags & DRAWPIC1_FLAG_MIRRORED);
 				else
-					view = gfxr_draw_cel1(-1, -1, -1, 0, resource + pos, resource + pos, bytesize, NULL, (static_pal && static_pal->size() == GFX_SCI1_AMIGA_COLORS_NR), false);
+					view = gfxr_draw_cel1(-1, -1, -1, flags & DRAWPIC1_FLAG_MIRRORED, resource + pos, resource + pos,
+										  bytesize, NULL, (static_pal && static_pal->size() == GFX_SCI1_AMIGA_COLORS_NR), false);
 				pos += bytesize;
 				if (nodraw)
 					continue;
+
+				if (flags & DRAWPIC1_FLAG_MIRRORED)
+					posx -= view->index_width - 1;
+
 				p0printf("(%d, %d)-(%d, %d)\n", posx, posy, posx + view->index_width, posy + view->index_height);
 
 				// we can only safely replace the palette if it's static
@@ -1642,7 +1649,7 @@
 	pic->visual_map->palette = gfxr_read_pal11(-1, resource + palette_data_ptr, 1284);
 
 	if (has_bitmap)
-		view = gfxr_draw_cel1(-1, 0, 0, 0, resource, resource + bitmap_data_ptr, size - bitmap_data_ptr, NULL, 0, true);
+		view = gfxr_draw_cel1(-1, 0, 0, flags & DRAWPIC1_FLAG_MIRRORED, resource, resource + bitmap_data_ptr, size - bitmap_data_ptr, NULL, 0, true);
 
 	if (view) {
 		view->palette = pic->visual_map->palette->getref();

Modified: scummvm/trunk/engines/sci/gfx/res_view1.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/res_view1.cpp	2009-05-17 13:35:37 UTC (rev 40647)
+++ scummvm/trunk/engines/sci/gfx/res_view1.cpp	2009-05-17 13:37:54 UTC (rev 40648)
@@ -388,10 +388,9 @@
 	for (i = 0; i < view->loops_nr; i++) {
 		int loop_offset = READ_LE_UINT16(seeker + V2_LOOP_OFFSET);
 		int cels = seeker[V2_CELS_NUM];
-		int mirrored = seeker[V2_IS_MIRROR];
+		// int mirrored = seeker[V2_IS_MIRROR];
 		int copy_entry = seeker[V2_COPY_OF_LOOP];
 
-		printf("%d\n", mirrored);
 		if (copy_entry == 255)
 			gfxr_draw_loop11(id, i, 0, resource, resource + loop_offset, size, cels, view->loops + i,
 			                 view, bytes_per_cel);


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