freesci-develop
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freesci-develop] r1579 - in freesci/branches/glutton: . src/gfx src/gfx


From: freesci
Subject: [freesci-develop] r1579 - in freesci/branches/glutton: . src/gfx src/gfx/resource src/include
Date: Thu, 02 Nov 2006 17:08:42 +0100

Author: skovmanden
Date: 2006-11-02 17:08:31 +0100 (Thu, 02 Nov 2006)
New Revision: 1579

Modified:
   freesci/branches/glutton/ChangeLog
   freesci/branches/glutton/src/gfx/resmgr.c
   freesci/branches/glutton/src/gfx/resource/sci_pic_0.c
   freesci/branches/glutton/src/include/gfx_resource.h
Log:
Implement proper overlay support for SCI1 pics. This one is actually visible!

Lars



Modified: freesci/branches/glutton/ChangeLog
===================================================================
--- freesci/branches/glutton/ChangeLog  2006-11-02 11:41:20 UTC (rev 1578)
+++ freesci/branches/glutton/ChangeLog  2006-11-02 16:08:31 UTC (rev 1579)
@@ -1,5 +1,8 @@
 2006-11-02  Lars Skovlund  <address@hidden>
 
+       * src/gfx/resource/sci_pic_0.c: Proper support for overlaid pics
+       in SCI1.
+
        * src/tools/scidisasm.c: Fix long-standing name clobbering bug
        caused by LRU resource management.
 

Modified: freesci/branches/glutton/src/gfx/resmgr.c
===================================================================
--- freesci/branches/glutton/src/gfx/resmgr.c   2006-11-02 11:41:20 UTC (rev 
1578)
+++ freesci/branches/glutton/src/gfx/resmgr.c   2006-11-02 16:08:31 UTC (rev 
1579)
@@ -429,8 +429,8 @@
                res->lock_sequence_nr = state->options->buffer_pics_nr;
 
                gfxr_interpreter_calculate_pic(state, res->scaled_data.pic, 
need_unscaled? res->unscaled_data.pic : NULL,
-                                              flags, default_palette, new_nr,
-                                              state->misc_payload);
+                                              flags | 
DRAWPIC01_FLAG_OVERLAID_PIC, 
+                                              default_palette, new_nr, 
state->misc_payload);
        }
 
        res->mode = MODE_INVALID; /* Invalidate */

Modified: freesci/branches/glutton/src/gfx/resource/sci_pic_0.c
===================================================================
--- freesci/branches/glutton/src/gfx/resource/sci_pic_0.c       2006-11-02 
11:41:20 UTC (rev 1578)
+++ freesci/branches/glutton/src/gfx/resource/sci_pic_0.c       2006-11-02 
16:08:31 UTC (rev 1579)
@@ -1901,11 +1901,31 @@
 
 }
 
+static void
+view_transparentize(gfx_pixmap_t *view, byte *pic_index_data,
+                   int posx, int posy,
+                   int width, int height)
+{
+       int i,j;
+
+       for (i=0;i<width;i++)
+               for (j=0;j<height;j++)
+               {
+                       if (view->index_data[j*width+i] == view->color_key)
+                       {
+                               view->index_data[j*width+i] = 
+                                       pic_index_data[(j+posy)*width+i+posx];
+                       }
+               }
+}
+
 extern gfx_pixmap_t *
+gfxr_draw_cel0(int id, int loop, int cel, byte *resource, int size, 
gfxr_view_t *view, int mirrored);
+extern gfx_pixmap_t *
 gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *resource, int 
size, gfxr_view_t *view);
 
 void
-gfxr_draw_pic01(gfxr_pic_t *pic, int fill_normally, int default_palette, int 
size,
+gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size,
               byte *resource, gfxr_pic0_params_t *style, int resid, int sci1)
 {
        const int default_palette_table[GFXR_PIC0_PALETTE_SIZE] = {
@@ -2093,8 +2113,8 @@
                                GET_ABS_COORDS(x, y);
                                p0printf("Abs coords %d,%d\n", x, y);
                                /*fprintf(stderr,"C=(%d,%d)\n", x, y + 
sci_titlebar_size);*/
-                               _gfxr_fill(pic, x, y + sci_titlebar_size, 
(fill_normally)? color : 0, priority, control, 
-                                          drawenable, sci_titlebar_size);
+                               _gfxr_fill(pic, x, y + sci_titlebar_size, 
(flags & DRAWPIC01_FLAG_FILL_NORMALLY)? 
+                                          color : 0, priority, control, 
drawenable, sci_titlebar_size);
 
                                if (fill_count++ > SCI_PIC0_MAX_FILL) {
                                        sci_sched_yield();
@@ -2342,6 +2362,11 @@
 
                                gfx_xlate_pixmap(view, mode, 
GFX_XLATE_FILTER_NONE);
 
+                               if (flags & DRAWPIC01_FLAG_OVERLAID_PIC)
+                                       view_transparentize(view, 
pic->visual_map->index_data, 
+                                                           posx, 
sci_titlebar_size+posy, 
+                                                           view->index_xl, 
view->index_yl);
+
                                
_gfx_crossblit_simple(pic->visual_map->index_data+(sci_titlebar_size*320)+
                                                      posy*320+posx,
                                                      view->index_data,
@@ -2366,7 +2391,7 @@
                                        pic->internal = sci_malloc(16 * 
sizeof(int)); 
                                } else
                                {
-                                       GFXERROR("pic->internal is not NULL 
(%08x); possible memory corruption!\n", pic->internal); 
+                                       GFXERROR("pic->internal is not NULL 
(%08x); this only occurs with overlaid pics, otherwise it's a bug!\n", 
pic->internal); 
                                }       
 
                                pri_table = pic->internal;

Modified: freesci/branches/glutton/src/include/gfx_resource.h
===================================================================
--- freesci/branches/glutton/src/include/gfx_resource.h 2006-11-02 11:41:20 UTC 
(rev 1578)
+++ freesci/branches/glutton/src/include/gfx_resource.h 2006-11-02 16:08:31 UTC 
(rev 1579)
@@ -44,6 +44,9 @@
 
 #define SCI_TITLEBAR_SIZE 10
 
+#define DRAWPIC01_FLAG_FILL_NORMALLY 1
+#define DRAWPIC01_FLAG_OVERLAID_PIC 2
+
 #define GFXR_AUX_MAP_SIZE (320*200)
 
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]