rnd-19980917
authorHolger Schemel <info@artsoft.org>
Thu, 17 Sep 1998 12:21:00 +0000 (14:21 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:30:38 +0000 (10:30 +0200)
15 files changed:
src/buttons.c
src/cartoons.c
src/editor.c
src/events.c
src/game.c
src/game.h
src/gifload.c
src/init.c
src/main.c
src/main.h
src/misc.c
src/misc.h
src/screens.c
src/tools.c
src/tools.h

index 7b0279ee183b98f1f8bde950d5a4082839125351..dc4860e008ed8f135d0c1ab7d01594b4758d079a 100644 (file)
@@ -408,12 +408,12 @@ void DrawElemButton(int button_nr, int button_state)
     XCopyArea(display,pix[PIX_DOOR],drawto,gc,
              from_x,from_y, size_x,size_y, to_x,to_y);
 
-    DrawMiniGraphicExtHiRes(drawto,gc,
-                           DX+ED_BUTTON_ELEM_XPOS+3+shift + 
-                           (elem_pos % MAX_ELEM_X)*ED_BUTTON_ELEM_XSIZE,
-                           DY+ED_BUTTON_ELEM_YPOS+3-shift +
-                           (elem_pos / MAX_ELEM_X)*ED_BUTTON_ELEM_YSIZE,
-                           graphic);
+    DrawMiniGraphicExt(drawto,gc,
+                      DX+ED_BUTTON_ELEM_XPOS+3+shift + 
+                      (elem_pos % MAX_ELEM_X)*ED_BUTTON_ELEM_XSIZE,
+                      DY+ED_BUTTON_ELEM_YPOS+3-shift +
+                      (elem_pos / MAX_ELEM_X)*ED_BUTTON_ELEM_YSIZE,
+                      graphic);
   }
 
   redraw_mask |= REDRAW_DOOR_1;
index 1d5373142b4a6fa18a90b2402383f5884f2570a3..b1b31921c03f0f1cc01131a9160a9fe4a77f447d 100644 (file)
@@ -175,7 +175,7 @@ void HandleAnimation(int mode)
   if (reset_delay)
   {
     animstart_delay = Counter();
-    animstart_delay_value = SimpleRND(500);
+    animstart_delay_value = SimpleRND(3000);
     reset_delay = FALSE;
   }
 
@@ -406,7 +406,7 @@ BOOL AnimateToon(int toon_nr, BOOL restart)
   {
     horiz_move = (anim->direction & (ANIMDIR_LEFT | ANIMDIR_RIGHT));
     vert_move = (anim->direction & (ANIMDIR_UP | ANIMDIR_DOWN));
-    anim_delay_value = 100/anim->frames_per_second;
+    anim_delay_value = 1000/anim->frames_per_second;
     frame = 0;
 
     if (horiz_move)
index b5567dfdf13120b884ed6ba111d53282bf261238..17677e8dec42d4520c39a2d481f87a50c5f0f030 100644 (file)
@@ -350,26 +350,26 @@ void DrawLevelEd()
     else
       graphic = GFX_LEERRAUM;
 
-    DrawMiniGraphicExtHiRes(pix[PIX_DB_DOOR],gc,
-                           DOOR_GFX_PAGEX1+ED_BUTTON_ELEM_XPOS+3 + 
-                           (i%MAX_ELEM_X)*ED_BUTTON_ELEM_XSIZE,
-                           DOOR_GFX_PAGEY1+ED_BUTTON_ELEM_YPOS+3 +
-                           (i/MAX_ELEM_X)*ED_BUTTON_ELEM_YSIZE,
-                           graphic);
+    DrawMiniGraphicExt(pix[PIX_DB_DOOR],gc,
+                      DOOR_GFX_PAGEX1+ED_BUTTON_ELEM_XPOS+3 + 
+                      (i%MAX_ELEM_X)*ED_BUTTON_ELEM_XSIZE,
+                      DOOR_GFX_PAGEY1+ED_BUTTON_ELEM_YPOS+3 +
+                      (i/MAX_ELEM_X)*ED_BUTTON_ELEM_YSIZE,
+                      graphic);
   }
 
-  DrawMiniGraphicExtHiRes(pix[PIX_DB_DOOR],gc,
-                         DOOR_GFX_PAGEX1+ED_WIN_MB_LEFT_XPOS,
-                         DOOR_GFX_PAGEY1+ED_WIN_MB_LEFT_YPOS,
-                         el2gfx(new_element1));
-  DrawMiniGraphicExtHiRes(pix[PIX_DB_DOOR],gc,
-                         DOOR_GFX_PAGEX1+ED_WIN_MB_MIDDLE_XPOS,
-                         DOOR_GFX_PAGEY1+ED_WIN_MB_MIDDLE_YPOS,
-                         el2gfx(new_element2));
-  DrawMiniGraphicExtHiRes(pix[PIX_DB_DOOR],gc,
-                         DOOR_GFX_PAGEX1+ED_WIN_MB_RIGHT_XPOS,
-                         DOOR_GFX_PAGEY1+ED_WIN_MB_RIGHT_YPOS,
-                         el2gfx(new_element3));
+  DrawMiniGraphicExt(pix[PIX_DB_DOOR],gc,
+                    DOOR_GFX_PAGEX1+ED_WIN_MB_LEFT_XPOS,
+                    DOOR_GFX_PAGEY1+ED_WIN_MB_LEFT_YPOS,
+                    el2gfx(new_element1));
+  DrawMiniGraphicExt(pix[PIX_DB_DOOR],gc,
+                    DOOR_GFX_PAGEX1+ED_WIN_MB_MIDDLE_XPOS,
+                    DOOR_GFX_PAGEY1+ED_WIN_MB_MIDDLE_YPOS,
+                    el2gfx(new_element2));
+  DrawMiniGraphicExt(pix[PIX_DB_DOOR],gc,
+                    DOOR_GFX_PAGEX1+ED_WIN_MB_RIGHT_XPOS,
+                    DOOR_GFX_PAGEY1+ED_WIN_MB_RIGHT_YPOS,
+                    el2gfx(new_element3));
   DrawTextExt(pix[PIX_DB_DOOR],gc,
              DOOR_GFX_PAGEX2+ED_WIN_LEVELNR_XPOS,
              DOOR_GFX_PAGEY1+ED_WIN_LEVELNR_YPOS,
@@ -709,18 +709,18 @@ void LevelEd(int mx, int my, int button)
       else if (last_button==3)
        new_element3 = new_element;
 
-      DrawMiniGraphicExtHiRes(drawto,gc,
-                             DX+ED_WIN_MB_LEFT_XPOS,
-                             DY+ED_WIN_MB_LEFT_YPOS,
-                             el2gfx(new_element1));
-      DrawMiniGraphicExtHiRes(drawto,gc,
-                             DX+ED_WIN_MB_MIDDLE_XPOS,
-                             DY+ED_WIN_MB_MIDDLE_YPOS,
-                             el2gfx(new_element2));
-      DrawMiniGraphicExtHiRes(drawto,gc,
-                             DX+ED_WIN_MB_RIGHT_XPOS,
-                             DY+ED_WIN_MB_RIGHT_YPOS,
-                             el2gfx(new_element3));
+      DrawMiniGraphicExt(drawto,gc,
+                        DX+ED_WIN_MB_LEFT_XPOS,
+                        DY+ED_WIN_MB_LEFT_YPOS,
+                        el2gfx(new_element1));
+      DrawMiniGraphicExt(drawto,gc,
+                        DX+ED_WIN_MB_MIDDLE_XPOS,
+                        DY+ED_WIN_MB_MIDDLE_YPOS,
+                        el2gfx(new_element2));
+      DrawMiniGraphicExt(drawto,gc,
+                        DX+ED_WIN_MB_RIGHT_XPOS,
+                        DY+ED_WIN_MB_RIGHT_YPOS,
+                        el2gfx(new_element3));
       redraw_mask |= REDRAW_DOOR_1;
     }
   
index c669e5e7b5d24f189f297768a4c1c116515b31d8..73d681d72efa38f7f274741b390aade98a81c311 100644 (file)
@@ -72,7 +72,7 @@ void EventLoop(void)
       if (game_status != PLAYING)
       {
        XSync(display, FALSE);
-       Delay(10000);
+       Delay(10);
       }
     }
 
@@ -592,15 +592,15 @@ void HandleKey(KeySym key, int key_status)
                    }
                    else
                    {
-                     Delay(1000);
+                     Delay(1);
                    }
                  }
   
                  /*
-                 Delay(160000 / num_steps);
+                 Delay(160 / num_steps);
                  */
                  /*
-                 Delay(120000 / num_steps);
+                 Delay(120 / num_steps);
                  */
                }
              }
@@ -619,7 +619,7 @@ void HandleKey(KeySym key, int key_status)
                      0,0);
            XFlush(display);
            XSync(display,FALSE);
-           Delay(1000000);
+           Delay(1000);
          }
 
          break;
index f551a1fac7f0e3c1a9cd112ad31539a786304bba..0561c22c2afbc7d07601ec8378a241641b99f11e 100644 (file)
@@ -375,7 +375,7 @@ void GameWon()
        TimeLeft--;
       DrawText(DX_TIME,DY_TIME,int2str(TimeLeft,3),FS_SMALL,FC_YELLOW);
       BackToFront();
-      Delay(10000);
+      Delay(10);
     }
 
     if (sound_loops_on)
@@ -488,7 +488,7 @@ void InitMovingField(int x, int y, int direction)
 
   MovDir[x][y] = direction;
   MovDir[newx][newy] = direction;
-  if (Feld[newx][newy]==EL_LEERRAUM)
+  if (Feld[newx][newy] == EL_LEERRAUM)
     Feld[newx][newy] = EL_BLOCKED;
 }
 
@@ -865,7 +865,7 @@ void Blurb(int x, int y)
     if (MovDelay[x][y])                /* neue Phase / in Wartezustand */
     {
       MovDelay[x][y]--;
-      if (MovDelay[x][y] && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
+      if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
        DrawGraphic(SCROLLX(x),SCROLLY(y),graphic+4-MovDelay[x][y]/2);
 
       if (!MovDelay[x][y])
@@ -2051,7 +2051,7 @@ void AmoebeWaechst(int x, int y)
   if (MovDelay[x][y])          /* neue Phase / in Wartezustand */
   {
     MovDelay[x][y]--;
-    if (MovDelay[x][y] && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
+    if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
       DrawGraphic(SCROLLX(x),SCROLLY(y),GFX_AMOEBING+3-MovDelay[x][y]/2);
 
     if (!MovDelay[x][y])
@@ -2312,7 +2312,10 @@ void Birne(int x, int y)
 
 void Blubber(int x, int y)
 {
-  DrawGraphicAnimation(x,y, GFX_GEBLUBBER, 4, 10, ANIM_NORMAL);
+  if (y > 0 && IS_MOVING(x,y-1) && MovDir[x][y-1] == MV_DOWN)
+    DrawLevelField(x,y-1);
+  else
+    DrawGraphicAnimation(x,y, GFX_GEBLUBBER, 4, 10, ANIM_NORMAL);
 }
 
 void NussKnacken(int x, int y)
@@ -2323,7 +2326,7 @@ void NussKnacken(int x, int y)
   if (MovDelay[x][y])          /* neue Phase / in Wartezustand */
   {
     MovDelay[x][y]--;
-    if (MovDelay[x][y] && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
+    if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
       DrawGraphic(SCROLLX(x),SCROLLY(y),GFX_CRACKINGNUT+3-MovDelay[x][y]/2);
 
     if (!MovDelay[x][y])
@@ -2409,14 +2412,25 @@ void EdelsteinFunkeln(int x, int y)
        int src_x,src_y, dest_x,dest_y;
        int phase = (MovDelay[x][y]-1)/2;
 
-       src_x  = SX+GFX_PER_LINE*TILEX;
-       src_y  = SY+(phase > 2 ? 4-phase : phase)*TILEY;
-       dest_x = FX+SCROLLX(x)*TILEX;
-       dest_y = FY+SCROLLY(y)*TILEY;
+       if (phase > 2)
+         phase = 4-phase;
+
+       src_x  = SX + GFX_PER_LINE*TILEX;
+       src_y  = SY + phase*TILEY;
+       dest_x = FX + SCROLLX(x)*TILEX;
+       dest_y = FY + SCROLLY(y)*TILEY;
 
+       /*
        XSetClipOrigin(display,clip_gc[PIX_BACK],dest_x-src_x,dest_y-src_y);
        XCopyArea(display,pix[PIX_BACK],drawto_field,clip_gc[PIX_BACK],
                  src_x,src_y, TILEX,TILEY, dest_x,dest_y);
+                 */
+
+       XSetClipMask(display, tile_clip_gc,
+                    tile_clipmask[GFX_MASK_SPARKLING + phase]);
+       XSetClipOrigin(display, tile_clip_gc, dest_x,dest_y);
+       XCopyArea(display, pix[PIX_BACK], drawto_field, tile_clip_gc,
+                 src_x,src_y, TILEX,TILEY, dest_x,dest_y);
 
        if (direct_draw_on)
        {
@@ -2584,7 +2598,7 @@ void GameActions()
     ScrollFigure(0);
 
   while(!DelayReached(&action_delay, action_delay_value))
-    Delay(5000);
+    Delay(5);
 
   if (tape.pausing || (tape.playing && !TapePlayDelay()))
     return;
@@ -2892,10 +2906,15 @@ void ScrollFigure(int init)
     PlayerGfxPos = ScrollStepSize * (PlayerMovPos / ScrollStepSize);
     actual_frame_counter = FrameCounter;
 
+    /*
     if (Feld[lastJX][lastJY] == EL_LEERRAUM &&
        IN_LEV_FIELD(lastJX,lastJY-1) &&
        CAN_FALL(Feld[lastJX][lastJY-1]))
       Feld[lastJX][lastJY] = EL_PLAYER_IS_LEAVING;
+      */
+
+    if (Feld[lastJX][lastJY] == EL_LEERRAUM)
+      Feld[lastJX][lastJY] = EL_PLAYER_IS_LEAVING;
 
     DrawPlayerField();
     return;
@@ -3199,12 +3218,12 @@ int DigField(int x, int y, int real_dx, int real_dy, int mode)
       Feld[x][y] = EL_LEERRAUM;
       Key[key_nr] = TRUE;
       RaiseScoreElement(EL_SCHLUESSEL);
-      DrawMiniGraphicExtHiRes(drawto,gc,
-                             DX_KEYS+key_nr*MINI_TILEX,DY_KEYS,
-                             GFX_SCHLUESSEL1+key_nr);
-      DrawMiniGraphicExtHiRes(window,gc,
-                             DX_KEYS+key_nr*MINI_TILEX,DY_KEYS,
-                             GFX_SCHLUESSEL1+key_nr);
+      DrawMiniGraphicExt(drawto,gc,
+                        DX_KEYS+key_nr*MINI_TILEX,DY_KEYS,
+                        GFX_SCHLUESSEL1+key_nr);
+      DrawMiniGraphicExt(window,gc,
+                        DX_KEYS+key_nr*MINI_TILEX,DY_KEYS,
+                        GFX_SCHLUESSEL1+key_nr);
       PlaySoundLevel(x,y,SND_PONG);
       break;
     }
index 54c3784f8687a09218c38fa418e0fe9641dc0f0b..18a9010d3e35710c760201fec43f1dcbe19e67a7 100644 (file)
@@ -31,9 +31,9 @@
 #define EX_BORDER              2
 
 /* fundamental game speed */
-#define GAME_FRAME_DELAY       2
+#define GAME_FRAME_DELAY       20      /* frame delay in milliseconds */
 #define FFWD_FRAME_DELAY       1
-#define FRAMES_PER_SECOND      (100 / GAME_FRAME_DELAY)
+#define FRAMES_PER_SECOND      (1000 / GAME_FRAME_DELAY)
 
 void GetPlayerConfig(void);
 void InitGame(void);
index 215d32a0cc988f69ea8f1da10de8c0bf4b57aa7a..ac64df6aba0a0ce9c79877fda0a4496c1f2a4de1 100644 (file)
@@ -53,7 +53,7 @@ int Read_GIF_to_Pixmaps(Display *display, Window window, char *filename,
 #ifdef DEBUG_TIMING
   count2 = Counter();
   printf("   LOADING '%s' IN %.2f SECONDS\n",
-        filename, (float)(count2-count1)/100.0);
+        filename, (float)(count2-count1)/1000.0);
   count1 = Counter();
 #endif
 
@@ -69,7 +69,7 @@ int Read_GIF_to_Pixmaps(Display *display, Window window, char *filename,
 #ifdef DEBUG_TIMING
   count2 = Counter();
   printf("   COMPRESSING IMAGE COLORMAP IN %.2f SECONDS\n",
-        (float)(count2-count1)/100.0);
+        (float)(count2-count1)/1000.0);
   count1 = Counter();
 #endif
 
@@ -87,7 +87,7 @@ int Read_GIF_to_Pixmaps(Display *display, Window window, char *filename,
 #ifdef DEBUG_TIMING
   count2 = Counter();
   printf("   CONVERTING IMAGE TO XIMAGE IN %.2f SECONDS\n",
-        (float)(count2-count1)/100.0);
+        (float)(count2-count1)/1000.0);
   count1 = Counter();
 #endif
 
@@ -104,7 +104,7 @@ int Read_GIF_to_Pixmaps(Display *display, Window window, char *filename,
 #ifdef DEBUG_TIMING
   count2 = Counter();
   printf("   CONVERTING IMAGE TO PIXMAP IN %.2f SECONDS\n",
-        (float)(count2-count1)/100.0);
+        (float)(count2-count1)/1000.0);
   count1 = Counter();
 #endif
 
@@ -114,7 +114,7 @@ int Read_GIF_to_Pixmaps(Display *display, Window window, char *filename,
 #ifdef DEBUG_TIMING
   count2 = Counter();
   printf("   CONVERTING IMAGE TO MASK IN %.2f SECONDS\n",
-        (float)(count2-count1)/100.0);
+        (float)(count2-count1)/1000.0);
   count1 = Counter();
 #endif
 
@@ -129,7 +129,7 @@ int Read_GIF_to_Pixmaps(Display *display, Window window, char *filename,
 #ifdef DEBUG_TIMING
   count2 = Counter();
   printf("   CONVERTING MASK TO XIMAGE IN %.2f SECONDS\n",
-        (float)(count2-count1)/100.0);
+        (float)(count2-count1)/1000.0);
   count1 = Counter();
 #endif
 
@@ -143,7 +143,7 @@ int Read_GIF_to_Pixmaps(Display *display, Window window, char *filename,
 #ifdef DEBUG_TIMING
   count2 = Counter();
   printf("   CONVERTING MASK TO PIXMAP IN %.2f SECONDS\n",
-        (float)(count2-count1)/100.0);
+        (float)(count2-count1)/1000.0);
   count1 = Counter();
 #endif
 
index 61055359839d2aa0bcb82835e30d98995ac60c07..726f78560b8f25eae13d3a5cd26c8c0337879221 100644 (file)
@@ -228,8 +228,6 @@ void InitDisplay(int argc, char *argv[])
   visual = DefaultVisual(display, screen);
   depth  = DefaultDepth(display, screen);
   cmap   = DefaultColormap(display, screen);
-  pen_fg = WhitePixel(display,screen);
-  pen_bg = BlackPixel(display,screen);
 
   /* look for good enough visual */
   vinfo_template.screen = screen;
@@ -276,6 +274,8 @@ void InitWindow(int argc, char *argv[])
   Atom proto_atom = None, delete_atom = None;
   int screen_width, screen_height;
   int win_xpos = WIN_XPOS, win_ypos = WIN_YPOS;
+  unsigned long pen_fg = WhitePixel(display,screen);
+  unsigned long pen_bg = BlackPixel(display,screen);
 
 #ifndef MSDOS
   static struct IconFileInfo icon_pic =
@@ -373,8 +373,8 @@ void InitWindow(int argc, char *argv[])
                       ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
                       KeyPressMask | KeyReleaseMask;
   XSelectInput(display, window, window_event_mask);
-
 #endif
+
   /* create GC for drawing with window depth */
   gc_values.graphics_exposures = False;
   gc_values.foreground = pen_bg;
@@ -397,8 +397,10 @@ void DrawInitText(char *text, int ypos, int color)
 void InitGfx()
 {
   int i,j;
+  GC copy_clipmask_gc;
   XGCValues clip_gc_values;
   unsigned long clip_gc_valuemask;
+
 #ifdef MSDOS
   static struct PictureFileInfo pic[NUM_PICTURES] =
   {
@@ -421,6 +423,27 @@ void InitGfx()
   }; 
 #endif
 
+  static struct
+  {
+    int start;
+    int count;
+  }
+  tile_needs_clipping[] =
+  {
+    { GFX_SPIELER_UP, 4 },
+    { GFX_SPIELER_DOWN, 4 },
+    { GFX_SPIELER_LEFT, 4 },
+    { GFX_SPIELER_RIGHT, 4 },
+    { GFX_SPIELER_PUSH_LEFT, 4 },
+    { GFX_SPIELER_PUSH_RIGHT, 4 },
+    { GFX_GEBLUBBER, 4 },
+    { GFX_DYNAMIT, 7 },
+    { GFX_DYNABOMB, 4 },
+    { GFX_SOKOBAN_OBJEKT, 1 },
+    { GFX_MASK_SPARKLING, 3 },
+    { -1, 0 }
+  };
+
 #ifdef DEBUG_TIMING
   long count1, count2;
   count1 = Counter();
@@ -435,13 +458,13 @@ void InitGfx()
 #endif MSDOS
   DrawInitText("Loading graphics:",120,FC_GREEN);
 
-  for(i=0;i<NUM_PICTURES;i++)
-    if (i!=PIX_SMALLFONT)
+  for(i=0; i<NUM_PICTURES; i++)
+    if (i != PIX_SMALLFONT)
       LoadGfx(i,&pic[i]);
 
 #ifdef DEBUG_TIMING
   count2 = Counter();
-  printf("SUMMARY: %.2f SECONDS LOADING TIME\n",(float)(count2-count1)/100.0);
+  printf("SUMMARY: %.2f SECONDS LOADING TIME\n",(float)(count2-count1)/1000.0);
 #endif
 
 
@@ -455,6 +478,72 @@ void InitGfx()
                                    FXSIZE,FYSIZE,
                                    XDefaultDepth(display,screen));
 
+  clip_gc_values.graphics_exposures = False;
+  clip_gc_valuemask = GCGraphicsExposures;
+  copy_clipmask_gc =
+    XCreateGC(display,clipmask[PIX_BACK],clip_gc_valuemask,&clip_gc_values);
+
+  clip_gc_values.graphics_exposures = False;
+  clip_gc_valuemask = GCGraphicsExposures;
+  tile_clip_gc =
+    XCreateGC(display,window,clip_gc_valuemask,&clip_gc_values);
+
+  /* initialize pixmap array to Pixmap 'None' */
+  for(i=0; i<NUM_TILES; i++)
+    tile_clipmask[i] = None;
+
+  /* create only those clipping Pixmaps we really need */
+  for(i=0; tile_needs_clipping[i].start>=0; i++)
+  {
+    for(j=0; j<tile_needs_clipping[i].count; j++)
+    {
+      int tile = tile_needs_clipping[i].start + j;
+      int graphic = tile;
+      int src_x, src_y;
+      Pixmap src_pixmap;
+
+      if (tile_needs_clipping[i].start == GFX_MASK_SPARKLING)
+      {
+       /* special case -- should be cleaned up sometimes... */
+       src_pixmap = clipmask[PIX_BACK];
+       src_x  = SX + GFX_PER_LINE*TILEX;
+       src_y  = SY + j*TILEY;
+      }
+      else if (graphic >= GFX_START_ROCKSSCREEN &&
+              graphic <= GFX_END_ROCKSSCREEN)
+      {
+       src_pixmap = clipmask[PIX_BACK];
+       graphic -= GFX_START_ROCKSSCREEN;
+       src_x = SX + (graphic % GFX_PER_LINE) * TILEX;
+       src_y = SY + (graphic / GFX_PER_LINE) * TILEY;
+      }
+      else if (graphic >= GFX_START_ROCKSHEROES &&
+              graphic <= GFX_END_ROCKSHEROES)
+      {
+       src_pixmap = clipmask[PIX_HEROES];
+       graphic -= GFX_START_ROCKSHEROES;
+       src_x = (graphic % HEROES_PER_LINE) * TILEX;
+       src_y = (graphic / HEROES_PER_LINE) * TILEY;
+      }
+      else if (graphic >= GFX_START_ROCKSFONT &&
+              graphic <= GFX_END_ROCKSFONT)
+      {
+       src_pixmap = clipmask[PIX_BIGFONT];
+       graphic -= GFX_START_ROCKSFONT;
+       src_x = (graphic % FONT_CHARS_PER_LINE) * TILEX;
+       src_y = (graphic / FONT_CHARS_PER_LINE) * TILEY +
+         FC_SPECIAL1 * FONT_LINES_PER_FONT * TILEY;
+      }
+      else
+       break;
+
+      tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
+
+      XCopyArea(display,src_pixmap,tile_clipmask[tile],copy_clipmask_gc,
+               src_x,src_y, TILEX,TILEY, 0,0);
+    }
+  }
+
   if (!pix[PIX_DB_BACK] || !pix[PIX_DB_DOOR])
   {
     fprintf(stderr, "%s: cannot create additional Pixmaps!\n",progname);
@@ -467,11 +556,8 @@ void InitGfx()
     if (clipmask[i])
     {
       clip_gc_values.graphics_exposures = False;
-      clip_gc_values.foreground = pen_fg;
-      clip_gc_values.background = pen_bg;
       clip_gc_values.clip_mask = clipmask[i];
-      clip_gc_valuemask =
-       GCGraphicsExposures | GCForeground | GCBackground | GCClipMask;
+      clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
       clip_gc[i] = XCreateGC(display,window,clip_gc_valuemask,&clip_gc_values);
     }
   }
@@ -562,7 +648,7 @@ void LoadGfx(int pos, struct PictureFileInfo *pic)
 #ifdef DEBUG_TIMING
     count2 = Counter();
     printf("XPM LOADING %s IN %.2f SECONDS\n",
-          filename,(float)(count2-count1)/100.0);
+          filename,(float)(count2-count1)/1000.0);
 #endif
 
 #else 
@@ -601,7 +687,7 @@ void LoadGfx(int pos, struct PictureFileInfo *pic)
 #ifdef DEBUG_TIMING
     count2 = Counter();
     printf("GIF LOADING %s IN %.2f SECONDS\n",
-          filename,(float)(count2-count1)/100.0);
+          filename,(float)(count2-count1)/1000.0);
 #endif
 
 #endif
@@ -658,7 +744,7 @@ void LoadGfx(int pos, struct PictureFileInfo *pic)
 #ifdef DEBUG_TIMING
     count2 = Counter();
     printf("XBM LOADING %s IN %.2f SECONDS\n",
-          filename,(float)(count2-count1)/100.0);
+          filename,(float)(count2-count1)/1000.0);
 #endif
 
 #endif
index 302b5418e8d7e87878eb8c1948dd8e9de23d5742..fd9804cc03ee729a778705edee6389c1e470256a 100644 (file)
@@ -27,9 +27,9 @@ Display        *display;
 Visual        *visual;
 int            screen;
 Window         window;
-GC             gc, clip_gc[NUM_PIXMAPS];
+GC             gc, clip_gc[NUM_PIXMAPS], tile_clip_gc;
 Pixmap         pix[NUM_PIXMAPS];
-Pixmap         clipmask[NUM_PIXMAPS];
+Pixmap         clipmask[NUM_PIXMAPS], tile_clipmask[NUM_TILES];
 
 #ifdef XPM_INCLUDE_FILE
 XpmAttributes  xpm_att[NUM_PICTURES];
@@ -45,7 +45,6 @@ int           joystick_device = 0;
 char          *joystick_device_name[2] = { DEV_JOYSTICK_0, DEV_JOYSTICK_1 };
 char          *level_directory = LEVEL_PATH;
 int            width, height;
-unsigned long  pen_fg, pen_bg;
 
 int            game_status = MAINMENU;
 int            game_emulation = EMU_NONE;
index 37131fef9f8460bec5828fee51731761b706732f..3d8267d5f1c48dd75107506d73c6346cd8d02c6d 100644 (file)
@@ -266,10 +266,9 @@ extern Display            *display;
 extern Visual         *visual;
 extern int             screen;
 extern Window                  window;
-extern GC              gc, clip_gc[];
-extern XImage         *image[];
-extern Pixmap          clipmask[];
+extern GC              gc, clip_gc[], tile_clip_gc;
 extern Pixmap          pix[];
+extern Pixmap          clipmask[], tile_clipmask[];
 
 #ifdef XPM_INCLUDE_FILE
 extern XpmAttributes   xpm_att[];
@@ -285,7 +284,6 @@ extern int          joystick_device;
 extern char           *joystick_device_name[2];
 extern char           *level_directory;
 extern int                     width, height;
-extern unsigned long   pen_fg, pen_bg;
 
 extern int             game_status;
 extern int             game_emulation;
@@ -603,6 +601,8 @@ extern char         *progname;
 #define GFX_START_ROCKSHEROES  512
 #define GFX_END_ROCKSHEROES    767
 
+#define NUM_TILES              768
+
 /* graphics from "RocksScreen" */
 /* Zeile 0 (0) */
 #define GFX_LEERRAUM           (-1)
@@ -751,6 +751,10 @@ extern char                *progname;
 #define GFX_FIREFLY_L          206
 #define GFX_FIREFLY_U          207
 
+/* CHANGE THIS!!!! (NO REGULAR POSITIONS...) */
+#define GFX_MASK_SPARKLING     210
+/* CHANGE THIS!!!! (NO REGULAR POSITIONS...) */
+
 #define GFX_SCHLUESSEL         GFX_SCHLUESSEL1
 #define GFX_SPIELFIGUR         GFX_SPIELER1
 
index 657bc164f495b6f61e09fcbfcf9e4d6d53e6d99d..28d04a6d1b3844eb59994f17142859aa4905a3ff 100644 (file)
@@ -33,12 +33,12 @@ void microsleep(unsigned long usec)
        therefore it's better to do a short interval of busy waiting
        to get our sleeping time more accurate */
 
-    long base_counter = Counter2(), actual_counter = Counter2();
+    long base_counter = Counter(), actual_counter = Counter();
     long delay = usec/1000;
 
     while (actual_counter < base_counter+delay &&
           actual_counter >= base_counter)
-      actual_counter = Counter2();
+      actual_counter = Counter();
   }
   else
   {
@@ -66,10 +66,7 @@ long mainCounter(int mode)
   counter_ms = (current_time.tv_sec - base_time.tv_sec)*1000
              + (current_time.tv_usec - base_time.tv_usec)/1000;
 
-  if (mode == READ_COUNTER_100)
-    return(counter_ms/10);     /* return 1/100 secs since last init */
-  else /*    READ_COUNTER_1000 */
-    return(counter_ms);                /* return 1/1000 secs since last init */
+  return counter_ms;           /* return milliseconds since last init */
 }
 
 void InitCounter() /* set counter back to zero */
@@ -77,14 +74,9 @@ void InitCounter() /* set counter back to zero */
   mainCounter(INIT_COUNTER);
 }
 
-long Counter() /* returns 1/100 secs since last call of InitCounter() */
+long Counter() /* get milliseconds since last call of InitCounter() */
 {
-  return(mainCounter(READ_COUNTER_100));
-}
-
-long Counter2()        /* returns 1/1000 secs since last call of InitCounter() */
-{
-  return(mainCounter(READ_COUNTER_1000));
+  return(mainCounter(READ_COUNTER));
 }
 
 void WaitCounter(long value)   /* wait for counter to reach value */
@@ -92,20 +84,12 @@ void WaitCounter(long value)        /* wait for counter to reach value */
   long wait;
 
   while((wait=value-Counter())>0)
-    microsleep(wait*10000);
-}
-
-void WaitCounter2(long value)  /* wait for counter to reach value */
-{
-  long wait;
-
-  while((wait=value-Counter2())>0)
-    microsleep(wait*1000);
+    microsleep(wait * 1000);
 }
 
-void Delay(long value)
+void Delay(long value)         /* Delay 'value' milliseconds */
 {
-  microsleep(value);
+  microsleep(value * 1000);
 }
 
 BOOL DelayReached(long *counter_var, int delay)
@@ -125,8 +109,8 @@ BOOL FrameReached(long *frame_counter_var, int frame_delay)
 {
   long actual_frame_counter = FrameCounter;
 
-  if (actual_frame_counter >= *frame_counter_var+frame_delay
-      || actual_frame_counter < *frame_counter_var)
+  if (actual_frame_counter >= *frame_counter_var+frame_delay ||
+      actual_frame_counter < *frame_counter_var)
   {
     *frame_counter_var = actual_frame_counter;
     return(TRUE);
index 5a0baab0a709ee4b0c1fab48a4784605bedbfb3d..9641265fc28c607f81b6b01894f093b0f16cf5a7 100644 (file)
@@ -18,8 +18,7 @@
 #include "main.h"
 
 #define INIT_COUNTER           0
-#define READ_COUNTER_100       1
-#define READ_COUNTER_1000      2
+#define READ_COUNTER           1
 
 #define NEW_RANDOMIZE          -1
 
@@ -27,9 +26,7 @@ void microsleep(unsigned long);
 long mainCounter(int);
 void InitCounter(void);
 long Counter(void);
-long Counter2(void);
 void WaitCounter(long);
-void WaitCounter2(long);
 void Delay(long);
 BOOL DelayReached(long *, int);
 BOOL FrameReached(long *, int);
index e4f8f8a157e45872c9365ee880775663b92958b8..907878bf6dac80c1bddbc9e2836f24d68705fa7f 100644 (file)
@@ -481,8 +481,7 @@ void DrawHelpScreenElAction(int start)
     }
     j++;
 
-    DrawGraphicExtHiRes(drawto,gc,xstart,ystart+(i-start)*ystep,
-                       graphic+frame);
+    DrawGraphicExt(drawto, gc, xstart, ystart+(i-start)*ystep, graphic+frame);
     i++;
   }
 
@@ -1176,7 +1175,7 @@ void CalibrateJoystick()
       joystick_status=JOYSTICK_OFF;
       goto error_out;
     }
-    Delay(10000);
+    Delay(10);
   }
 
   new_joystick_xleft = joy_ctrl.x;
@@ -1205,7 +1204,7 @@ void CalibrateJoystick()
       joystick_status=JOYSTICK_OFF;
       goto error_out;
     }
-    Delay(10000);
+    Delay(10);
   }
 
   new_joystick_xright = joy_ctrl.x;
@@ -1233,7 +1232,7 @@ void CalibrateJoystick()
       joystick_status=JOYSTICK_OFF;
       goto error_out;
     }
-    Delay(10000);
+    Delay(10);
   }
 
   new_joystick_xmiddle = joy_ctrl.x;
@@ -1296,7 +1295,7 @@ void CalibrateJoystick()
   DrawText(SX+16, SY+16, "NO JOYSTICK",FS_BIG,FC_YELLOW);
   DrawText(SX+16, SY+48, " AVAILABLE ",FS_BIG,FC_YELLOW);
   BackToFront();
-  Delay(3000000);
+  Delay(3000);
   DrawSetupScreen();
 }
 
index f611f5cd7344c54a6b6940f8562ce4d1ea8bfdf3..efcba4dbc2ba57b619a2291a2ac4477977a558e5 100644 (file)
@@ -187,7 +187,7 @@ void BackToFront()
 void FadeToFront()
 {
 /*
-  long fading_delay = 300000;
+  long fading_delay = 300;
 
   if (fading_on && (redraw_mask & REDRAW_FIELD))
   {
@@ -208,7 +208,7 @@ void FadeToFront()
                  REAL_SX,REAL_SY+i, FULL_SXSIZE,1, REAL_SX,REAL_SY+i);
       }
       XFlush(display);
-      Delay(10000);
+      Delay(10);
     }
 */
 
@@ -513,13 +513,30 @@ static int getGraphicAnimationPhase(int frames, int delay, int mode)
   return(phase);
 }
 
-void DrawGraphicAnimation(int x, int y, int graphic,
-                         int frames, int delay, int mode)
+void DrawGraphicAnimationExt(int x, int y, int graphic,
+                            int frames, int delay, int mode, int mask_mode)
 {
   int phase = getGraphicAnimationPhase(frames, delay, mode);
 
   if (!(FrameCounter % delay) && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
-    DrawGraphic(SCROLLX(x),SCROLLY(y), graphic + phase);
+  {
+    if (mask_mode == USE_MASKING)
+      DrawGraphicThruMask(SCROLLX(x),SCROLLY(y), graphic + phase);
+    else
+      DrawGraphic(SCROLLX(x),SCROLLY(y), graphic + phase);
+  }
+}
+
+void DrawGraphicAnimation(int x, int y, int graphic,
+                         int frames, int delay, int mode)
+{
+  DrawGraphicAnimationExt(x,y, graphic, frames,delay,mode, NO_MASKING);
+}
+
+void DrawGraphicAnimationThruMask(int x, int y, int graphic,
+                                 int frames, int delay, int mode)
+{
+  DrawGraphicAnimationExt(x,y, graphic, frames,delay,mode, USE_MASKING);
 }
 
 void DrawGraphic(int x, int y, int graphic)
@@ -534,40 +551,35 @@ void DrawGraphic(int x, int y, int graphic)
   }
 #endif
 
-  DrawGraphicExt(drawto_field, gc, x, y, graphic);
+  DrawGraphicExt(drawto_field, gc, FX+x*TILEX, FY+y*TILEY, graphic);
   MarkTileDirty(x,y);
 }
 
 void DrawGraphicExt(Drawable d, GC gc, int x, int y, int graphic)
-{
-  DrawGraphicExtHiRes(d, gc, FX+x*TILEX, FY+y*TILEY, graphic);
-}
-
-void DrawGraphicExtHiRes(Drawable d, GC gc, int x, int y, int graphic)
 {
   if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN)
   {
     graphic -= GFX_START_ROCKSSCREEN;
     XCopyArea(display,pix[PIX_BACK],d,gc,
-             SX+(graphic % GFX_PER_LINE)*TILEX,
-             SY+(graphic / GFX_PER_LINE)*TILEY,
+             SX + (graphic % GFX_PER_LINE) * TILEX,
+             SY + (graphic / GFX_PER_LINE) * TILEY,
              TILEX,TILEY, x,y);
   }
   else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
   {
     graphic -= GFX_START_ROCKSHEROES;
     XCopyArea(display,pix[PIX_HEROES],d,gc,
-             (graphic % HEROES_PER_LINE)*TILEX,
-             (graphic / HEROES_PER_LINE)*TILEY,
+             (graphic % HEROES_PER_LINE) * TILEX,
+             (graphic / HEROES_PER_LINE) * TILEY,
              TILEX,TILEY, x,y);
   }
   else if (graphic >= GFX_START_ROCKSFONT && graphic <= GFX_END_ROCKSFONT)
   {
     graphic -= GFX_START_ROCKSFONT;
     XCopyArea(display,pix[PIX_BIGFONT],d,gc,
-             (graphic % FONT_CHARS_PER_LINE)*TILEX,
-             (graphic / FONT_CHARS_PER_LINE)*TILEY +
-             FC_SPECIAL1*TILEY*FONT_LINES_PER_FONT,
+             (graphic % FONT_CHARS_PER_LINE) * TILEX,
+             (graphic / FONT_CHARS_PER_LINE) * TILEY +
+             FC_SPECIAL1 * FONT_LINES_PER_FONT * TILEY,
              TILEX,TILEY, x,y);
   }
   else
@@ -577,6 +589,9 @@ void DrawGraphicExtHiRes(Drawable d, GC gc, int x, int y, int graphic)
 void DrawGraphicThruMask(int x, int y, int graphic)
 {
   int src_x,src_y, dest_x,dest_y;
+  int tile = graphic;
+  Pixmap src_pixmap;
+  GC drawing_gc;
 
 #if DEBUG
   if (!IN_SCR_FIELD(x,y))
@@ -589,27 +604,19 @@ void DrawGraphicThruMask(int x, int y, int graphic)
 
   if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN)
   {
+    src_pixmap = pix[PIX_BACK];
+    drawing_gc = clip_gc[PIX_BACK];
     graphic -= GFX_START_ROCKSSCREEN;
     src_x  = SX+(graphic % GFX_PER_LINE)*TILEX;
     src_y  = SY+(graphic / GFX_PER_LINE)*TILEY;
-    dest_x = FX+x*TILEX;
-    dest_y = FY+y*TILEY;
-
-    XSetClipOrigin(display,clip_gc[PIX_BACK],dest_x-src_x,dest_y-src_y);
-    XCopyArea(display,pix[PIX_BACK],drawto_field,clip_gc[PIX_BACK],
-             src_x,src_y, TILEX,TILEY, dest_x,dest_y);
   }
   else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
   {
+    src_pixmap = pix[PIX_HEROES];
+    drawing_gc = clip_gc[PIX_HEROES];
     graphic -= GFX_START_ROCKSHEROES;
     src_x  = (graphic % HEROES_PER_LINE)*TILEX;
     src_y  = (graphic / HEROES_PER_LINE)*TILEY;
-    dest_x = FX+x*TILEX;
-    dest_y = FY+y*TILEY;
-
-    XSetClipOrigin(display,clip_gc[PIX_HEROES],dest_x-src_x,dest_y-src_y);
-    XCopyArea(display,pix[PIX_HEROES],drawto_field,clip_gc[PIX_HEROES],
-             src_x,src_y, TILEX,TILEY, dest_x,dest_y);
   }
   else
   {
@@ -617,32 +624,37 @@ void DrawGraphicThruMask(int x, int y, int graphic)
     return;
   }
 
-  MarkTileDirty(x,y);
-}
+  dest_x = FX + x*TILEX;
+  dest_y = FY + y*TILEY;
 
-void DrawScreenElementThruMask(int x, int y, int element)
-{
-  DrawGraphicThruMask(x,y,el2gfx(element));
-}
+  if (tile_clipmask[tile] != None)
+  {
+    XSetClipMask(display, tile_clip_gc, tile_clipmask[tile]);
+    XSetClipOrigin(display, tile_clip_gc, dest_x,dest_y);
+    XCopyArea(display, src_pixmap, drawto_field, tile_clip_gc,
+             src_x,src_y, TILEX,TILEY, dest_x,dest_y);
+  }
+  else
+  {
+#if DEBUG
+    printf("DrawGraphicThruMask(): tile '%d' needs clipping!\n", tile);
+#endif
 
-void DrawLevelElementThruMask(int x, int y, int element)
-{
-  if (IN_LEV_FIELD(x,y) && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
-    DrawScreenElementThruMask(SCROLLX(x),SCROLLY(y),element);
+    XSetClipOrigin(display, drawing_gc, dest_x-src_x, dest_y-src_y);
+    XCopyArea(display, src_pixmap, drawto_field, drawing_gc,
+             src_x,src_y, TILEX,TILEY, dest_x,dest_y);
+  }
+
+  MarkTileDirty(x,y);
 }
 
 void DrawMiniGraphic(int x, int y, int graphic)
 {
-  DrawMiniGraphicExt(drawto, gc, x, y, graphic);
+  DrawMiniGraphicExt(drawto,gc, SX+x*MINI_TILEX,SY+y*MINI_TILEY, graphic);
   MarkTileDirty(x/2, y/2);
 }
 
 void DrawMiniGraphicExt(Drawable d, GC gc, int x, int y, int graphic)
-{
-  DrawMiniGraphicExtHiRes(d,gc, SX+x*MINI_TILEX,SY+y*MINI_TILEY, graphic);
-}
-
-void DrawMiniGraphicExtHiRes(Drawable d, GC gc, int x, int y, int graphic)
 {
   if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN)
   {
@@ -671,6 +683,9 @@ void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic,
   int width = TILEX, height = TILEY;
   int cx = 0, cy = 0;
   int src_x,src_y, dest_x,dest_y;
+  int tile = graphic;
+  Pixmap src_pixmap;
+  GC drawing_gc;
 
   if (graphic < 0)
   {
@@ -744,41 +759,24 @@ void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic,
 
   if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN)
   {
+    src_pixmap = pix[PIX_BACK];
+    drawing_gc = clip_gc[PIX_BACK];
     graphic -= GFX_START_ROCKSSCREEN;
     src_x  = SX+(graphic % GFX_PER_LINE)*TILEX+cx;
     src_y  = SY+(graphic / GFX_PER_LINE)*TILEY+cy;
-    dest_x = FX+x*TILEX+dx;
-    dest_y = FY+y*TILEY+dy;
-
-    if (mask_mode == USE_MASKING)
-    {
-      XSetClipOrigin(display,clip_gc[PIX_BACK],dest_x-src_x,dest_y-src_y);
-      XCopyArea(display,pix[PIX_BACK],drawto_field,clip_gc[PIX_BACK],
-               src_x,src_y, width,height, dest_x,dest_y);
-    }
-    else
-      XCopyArea(display,pix[PIX_BACK],drawto_field,gc,
-               src_x,src_y, width,height, dest_x,dest_y);
   }
   else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
   {
+    src_pixmap = pix[PIX_HEROES];
+    drawing_gc = clip_gc[PIX_HEROES];
     graphic -= GFX_START_ROCKSHEROES;
     src_x  = (graphic % HEROES_PER_LINE)*TILEX+cx;
     src_y  = (graphic / HEROES_PER_LINE)*TILEY+cy;
-    dest_x = FX+x*TILEX+dx;
-    dest_y = FY+y*TILEY+dy;
-
-    if (mask_mode == USE_MASKING)
-    {
-      XSetClipOrigin(display,clip_gc[PIX_HEROES],dest_x-src_x,dest_y-src_y);
-      XCopyArea(display,pix[PIX_HEROES],drawto_field,clip_gc[PIX_HEROES],
-               src_x,src_y, width,height, dest_x,dest_y);
-    }
-    else
-      XCopyArea(display,pix[PIX_HEROES],drawto_field,gc,
-               src_x,src_y, width,height, dest_x,dest_y);
   }
 
+  dest_x = FX + x*TILEX + dx;
+  dest_y = FY + y*TILEY + dy;
+
 #if DEBUG
   if (!IN_SCR_FIELD(x,y))
   {
@@ -788,6 +786,30 @@ void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic,
   }
 #endif
 
+  if (mask_mode == USE_MASKING)
+  {
+    if (tile_clipmask[tile] != None)
+    {
+      XSetClipMask(display, tile_clip_gc, tile_clipmask[tile]);
+      XSetClipOrigin(display, tile_clip_gc, dest_x,dest_y);
+      XCopyArea(display, src_pixmap, drawto_field, tile_clip_gc,
+               src_x,src_y, TILEX,TILEY, dest_x,dest_y);
+    }
+    else
+    {
+#if DEBUG
+      printf("DrawGraphicShifted(): tile '%d' needs clipping!\n", tile);
+#endif
+
+      XSetClipOrigin(display, drawing_gc, dest_x-src_x, dest_y-src_y);
+      XCopyArea(display, src_pixmap, drawto_field, drawing_gc,
+               src_x,src_y, width,height, dest_x,dest_y);
+    }
+  }
+  else
+    XCopyArea(display, src_pixmap, drawto_field, gc,
+             src_x,src_y, width,height, dest_x,dest_y);
+
   MarkTileDirty(x,y);
 }
 
@@ -797,8 +819,8 @@ void DrawGraphicShiftedThruMask(int x,int y, int dx,int dy, int graphic,
   DrawGraphicShifted(x,y, dx,dy, graphic, cut_mode, USE_MASKING);
 }
 
-void DrawScreenElementShifted(int x, int y, int dx, int dy, int element,
-                             int cut_mode)
+void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
+                         int cut_mode, int mask_mode)
 {
   int ux = UNSCROLLX(x), uy = UNSCROLLY(y);
   int graphic = el2gfx(element);
@@ -843,6 +865,10 @@ void DrawScreenElementShifted(int x, int y, int dx, int dy, int element,
   {
     graphic = GFX_SONDE_START + getGraphicAnimationPhase(8, 2, ANIM_NORMAL);
   }
+  else if (element==EL_SALZSAEURE)
+  {
+    graphic = GFX_GEBLUBBER + getGraphicAnimationPhase(4, 10, ANIM_NORMAL);
+  }
   else if (element==EL_BUTTERFLY || element==EL_FIREFLY)
   {
     graphic += !phase;
@@ -879,16 +905,41 @@ void DrawScreenElementShifted(int x, int y, int dx, int dy, int element,
   }
 
   if (dx || dy)
-    DrawGraphicShifted(x,y, dx,dy, graphic, cut_mode, NO_MASKING);
+    DrawGraphicShifted(x,y, dx,dy, graphic, cut_mode, mask_mode);
+  else if (mask_mode == USE_MASKING)
+    DrawGraphicThruMask(x,y, graphic);
   else
     DrawGraphic(x,y, graphic);
 }
 
+void DrawLevelElementExt(int x, int y, int dx, int dy, int element,
+                        int cut_mode, int mask_mode)
+{
+  if (IN_LEV_FIELD(x,y) && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
+    DrawScreenElementExt(SCROLLX(x),SCROLLY(y), dx,dy, element,
+                        cut_mode, mask_mode);
+}
+
+void DrawScreenElementShifted(int x, int y, int dx, int dy, int element,
+                             int cut_mode)
+{
+  DrawScreenElementExt(x,y, dx,dy, element, cut_mode, NO_MASKING);
+}
+
 void DrawLevelElementShifted(int x, int y, int dx, int dy, int element,
                             int cut_mode)
 {
-  if (IN_LEV_FIELD(x,y) && IN_SCR_FIELD(SCROLLX(x),SCROLLY(y)))
-    DrawScreenElementShifted(SCROLLX(x),SCROLLY(y), dx,dy, element, cut_mode);
+  DrawLevelElementExt(x,y, dx,dy, element, cut_mode, NO_MASKING);
+}
+
+void DrawScreenElementThruMask(int x, int y, int element)
+{
+  DrawScreenElementExt(x,y, 0,0, element, NO_CUTTING, USE_MASKING);
+}
+
+void DrawLevelElementThruMask(int x, int y, int element)
+{
+  DrawLevelElementExt(x,y, 0,0, element, NO_CUTTING, USE_MASKING);
 }
 
 void ErdreichAnbroeckeln(int x, int y)
@@ -998,7 +1049,7 @@ void ErdreichAnbroeckeln(int x, int y)
 
 void DrawScreenElement(int x, int y, int element)
 {
-  DrawScreenElementShifted(x,y, 0,0, element, NO_CUTTING);
+  DrawScreenElementExt(x,y, 0,0, element, NO_CUTTING, NO_MASKING);
   ErdreichAnbroeckeln(x,y);
 }
 
@@ -1032,9 +1083,13 @@ void DrawScreenField(int x, int y)
        Store[ux][uy]==EL_AMOEBE_NASS)
       cut_mode = CUT_ABOVE;
     else if (Store[ux][uy]==EL_MORAST_VOLL ||
+
+#if 0
+       Store[ux][uy]==EL_SALZSAEURE ||
+#endif
+
        Store[ux][uy]==EL_SIEB_VOLL ||
-       Store[ux][uy]==EL_SIEB2_VOLL ||
-       Store[ux][uy]==EL_SALZSAEURE)
+       Store[ux][uy]==EL_SIEB2_VOLL)
       cut_mode = CUT_BELOW;
 
     if (cut_mode==CUT_ABOVE)
@@ -1046,6 +1101,12 @@ void DrawScreenField(int x, int y)
       DrawScreenElementShifted(x,y, MovPos[ux][uy],0, element, NO_CUTTING);
     else
       DrawScreenElementShifted(x,y, 0,MovPos[ux][uy], element, cut_mode);
+
+#if 1
+    if (Store[ux][uy] == EL_SALZSAEURE)
+      DrawLevelElementThruMask(ux,uy+1, EL_SALZSAEURE);
+#endif
+
   }
   else if (IS_BLOCKED(ux,uy))
   {
@@ -1290,7 +1351,7 @@ BOOL AreYouSure(char *text, unsigned int ays_state)
   while(result<0)
   {
     DoAnimation();
-    Delay(10000);
+    Delay(10);
 
     if (XPending(display))
     {
@@ -1447,7 +1508,7 @@ unsigned int MoveDoor(unsigned int door_state)
   static unsigned int door2 = DOOR_CLOSE_2;
   static long door_delay = 0;
   int x, start, stepsize = 2;
-  long door_delay_value = stepsize * 5000;
+  long door_delay_value = stepsize * 5;
 
   if (door_state == DOOR_GET_STATE)
     return(door1 | door2);
@@ -1477,8 +1538,8 @@ unsigned int MoveDoor(unsigned int door_state)
 
     for(x=start; x<=DXSIZE; x+=stepsize)
     {
-      while(!DelayReached(&door_delay, door_delay_value/10000))
-       Delay(1000);
+      while(!DelayReached(&door_delay, door_delay_value/10))
+       Delay(1);
 
       if (door_state & DOOR_ACTION_1)
       {
index 459011a13212ef4559899c80a419e6e5b4221c34..4b7edaf10449bdecd1007157c5893fa54cd840ee 100644 (file)
@@ -64,20 +64,22 @@ void ClearWindow();
 void DrawText(int, int, char *, int, int);
 void DrawTextExt(Drawable, GC, int, int, char *, int, int);
 void DrawPlayerField(void);
+void DrawGraphicAnimationExt(int, int, int, int, int, int, int);
 void DrawGraphicAnimation(int, int, int, int, int, int);
+void DrawGraphicAnimationThruMask(int, int, int, int, int, int);
 void DrawGraphic(int, int, int);
 void DrawGraphicExt(Drawable, GC, int, int, int);
-void DrawGraphicExtHiRes(Drawable, GC, int, int, int);
 void DrawGraphicThruMask(int, int, int);
-void DrawScreenElementThruMask(int, int, int);
-void DrawLevelElementThruMask(int, int, int);
 void DrawMiniGraphic(int, int, int);
 void DrawMiniGraphicExt(Drawable, GC, int, int, int);
-void DrawMiniGraphicExtHiRes(Drawable, GC, int, int, int);
 void DrawGraphicShifted(int, int, int, int, int, int, int);
 void DrawGraphicShiftedThruMask(int, int, int, int, int, int);
+void DrawScreenElementExt(int, int, int, int, int, int, int);
+void DrawLevelElementExt(int, int, int, int, int, int, int);
 void DrawScreenElementShifted(int, int, int, int, int, int);
 void DrawLevelElementShifted(int, int, int, int, int, int);
+void DrawScreenElementThruMask(int, int, int);
+void DrawLevelElementThruMask(int, int, int);
 void ErdreichAnbroeckeln(int, int);
 void DrawScreenElement(int, int, int);
 void DrawLevelElement(int, int, int);