aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kgraphics.cpp12
-rw-r--r--engines/sci/engine/vm.cpp4
-rw-r--r--engines/sci/gfx/gfx_resource.h1
-rw-r--r--engines/sci/gfx/res_pic.cpp21
-rw-r--r--engines/sci/gfx/res_view1.cpp3
5 files changed, 27 insertions, 14 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 59c9eba0c3..602a5e8bbf 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -972,16 +972,22 @@ void _k_view_list_free_backgrounds(EngineState *s, ViewObject *list, int list_nr
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 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
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 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
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;
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 75e31261b1..409f7527e4 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -371,8 +371,8 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
// 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;
}
diff --git a/engines/sci/gfx/gfx_resource.h b/engines/sci/gfx/gfx_resource.h
index 51e1e2b75a..96e72b1e2a 100644
--- a/engines/sci/gfx/gfx_resource.h
+++ b/engines/sci/gfx/gfx_resource.h
@@ -50,6 +50,7 @@ namespace Sci {
#define DRAWPIC01_FLAG_FILL_NORMALLY 1
#define DRAWPIC01_FLAG_OVERLAID_PIC 2
+#define DRAWPIC1_FLAG_MIRRORED 4
#define GFXR_AUX_MAP_SIZE (320*200)
diff --git a/engines/sci/gfx/res_pic.cpp b/engines/sci/gfx/res_pic.cpp
index 1e028ca3dc..f88e36eb40 100644
--- a/engines/sci/gfx/res_pic.cpp
+++ b/engines/sci/gfx/res_pic.cpp
@@ -1015,14 +1015,16 @@ namespace Sci {
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 @@ namespace Sci {
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 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size,
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 @@ void gfxr_draw_pic11(gfxr_pic_t *pic, int flags, int default_palette, int size,
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();
diff --git a/engines/sci/gfx/res_view1.cpp b/engines/sci/gfx/res_view1.cpp
index b53702601b..64ba5d4907 100644
--- a/engines/sci/gfx/res_view1.cpp
+++ b/engines/sci/gfx/res_view1.cpp
@@ -388,10 +388,9 @@ gfxr_view_t *gfxr_draw_view11(int id, byte *resource, int size) {
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);