rnd-19980820
authorHolger Schemel <info@artsoft.org>
Thu, 20 Aug 1998 08:08:59 +0000 (10:08 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:30:25 +0000 (10:30 +0200)
src/Makefile
src/game.c
src/gfxloader.c

index 01a64c2edfd228a89205bbb2bb456abf9a5ceca2..510e71d4de186c118e87b5be7620c0e4c9a574b0 100644 (file)
@@ -20,7 +20,8 @@ SCORE_ENTRIES = -DMANY_PER_NAME               # many score entries per name
 # because the GIF loading routines are still a bit beta.
 # If you use the Xpm library, convert the GIF files to Xpm
 # files (and the mask files ('*Maske.gif') to xbm files).
 # because the GIF loading routines are still a bit beta.
 # If you use the Xpm library, convert the GIF files to Xpm
 # files (and the mask files ('*Maske.gif') to xbm files).
-XPM_INCLUDE_FILE = -DXPM_INCLUDE_FILE="<X11/xpm.h>"
+
+# XPM_INCLUDE_FILE = -DXPM_INCLUDE_FILE="<X11/xpm.h>"
 
 CONFIG = $(GAME_DIR) $(SOUNDS) $(JOYSTICK)     \
         $(SCORE_ENTRIES) $(XPM_INCLUDE_FILE)
 
 CONFIG = $(GAME_DIR) $(SOUNDS) $(JOYSTICK)     \
         $(SCORE_ENTRIES) $(XPM_INCLUDE_FILE)
index eb64c053d27d23f99731ebf76662efa253c5cfa3..c75c9dd466177a3bbd8cbab9d79879e9853492e1 100644 (file)
@@ -2781,7 +2781,7 @@ void ScrollLevel(int dx, int dy)
 
 BOOL MoveFigureOneStep(int dx, int dy, int real_dx, int real_dy)
 {
 
 BOOL MoveFigureOneStep(int dx, int dy, int real_dx, int real_dy)
 {
-  int oldJX,oldJY, newJX = JX+dx,newJY = JY+dy;
+  int newJX = JX+dx, newJY = JY+dy;
   int element;
   int can_move;
 
   int element;
   int can_move;
 
@@ -2819,30 +2819,15 @@ BOOL MoveFigureOneStep(int dx, int dy, int real_dx, int real_dy)
   if (can_move != MF_MOVING)
     return(can_move);
 
   if (can_move != MF_MOVING)
     return(can_move);
 
-  oldJX = JX;
-  oldJY = JY;
+  lastJX = JX;
+  lastJY = JY;
   JX = newJX;
   JY = newJY;
 
   JX = newJX;
   JY = newJY;
 
-
-  lastJX = oldJX;
-  lastJY = oldJY;
-
   PlayerMovPos = (dx > 0 || dy > 0 ? -1 : 1) * 3*TILEX/4;
 
   ScrollFigure(-1);
 
   PlayerMovPos = (dx > 0 || dy > 0 ? -1 : 1) * 3*TILEX/4;
 
   ScrollFigure(-1);
 
-  if (Store[oldJX][oldJY])
-  {
-    DrawGraphic(SCROLLX(oldJX),SCROLLY(oldJY),el2gfx(Store[oldJX][oldJY]));
-    DrawGraphicThruMask(SCROLLX(oldJX),SCROLLY(oldJY),
-                       el2gfx(Feld[oldJX][oldJY]));
-  }
-  else if (Feld[oldJX][oldJY]==EL_DYNAMIT)
-    DrawDynamite(oldJX,oldJY);
-  else
-    DrawLevelField(oldJX,oldJY);
-
   return(MF_MOVING);
 }
 
   return(MF_MOVING);
 }
 
@@ -2882,18 +2867,18 @@ BOOL MoveFigure(int dx, int dy)
 
   if (moved & MF_MOVING)
   {
 
   if (moved & MF_MOVING)
   {
-    int old_scroll_x=scroll_x, old_scroll_y=scroll_y;
+    int old_scroll_x = scroll_x, old_scroll_y = scroll_y;
     int offset = (scroll_delay_on ? 3 : 0);
 
     if ((scroll_x < JX-MIDPOSX-offset || scroll_x > JX-MIDPOSX+offset) &&
     int offset = (scroll_delay_on ? 3 : 0);
 
     if ((scroll_x < JX-MIDPOSX-offset || scroll_x > JX-MIDPOSX+offset) &&
-       JX>=MIDPOSX-1-offset && JX<=lev_fieldx-(MIDPOSX-offset))
+       JX >= MIDPOSX-1-offset && JX <= lev_fieldx-(MIDPOSX-offset))
       scroll_x = JX-MIDPOSX + (scroll_x < JX-MIDPOSX ? -offset : offset);
     if ((scroll_y < JY-MIDPOSY-offset || scroll_y > JY-MIDPOSY+offset) &&
       scroll_x = JX-MIDPOSX + (scroll_x < JX-MIDPOSX ? -offset : offset);
     if ((scroll_y < JY-MIDPOSY-offset || scroll_y > JY-MIDPOSY+offset) &&
-       JY>=MIDPOSY-1-offset && JY<=lev_fieldy-(MIDPOSY-offset))
+       JY >= MIDPOSY-1-offset && JY <= lev_fieldy-(MIDPOSY-offset))
       scroll_y = JY-MIDPOSY + (scroll_y < JY-MIDPOSY ? -offset : offset);
 
       scroll_y = JY-MIDPOSY + (scroll_y < JY-MIDPOSY ? -offset : offset);
 
-    if (scroll_x!=old_scroll_x || scroll_y!=old_scroll_y)
-      ScrollLevel(old_scroll_x-scroll_x,old_scroll_y-scroll_y);
+    if (scroll_x != old_scroll_x || scroll_y != old_scroll_y)
+      ScrollLevel(old_scroll_x - scroll_x, old_scroll_y - scroll_y);
   }
 
   if (!(moved & MF_MOVING) && !PlayerPushing)
   }
 
   if (!(moved & MF_MOVING) && !PlayerPushing)
@@ -2953,6 +2938,18 @@ void ScrollFigure(int init)
 
     DrawPlayerField();
 
 
     DrawPlayerField();
 
+    if (Store[lastJX][lastJY])
+    {
+      DrawGraphic(SCROLLX(lastJX),SCROLLY(lastJY),
+                 el2gfx(Store[lastJX][lastJY]));
+      DrawGraphicThruMask(SCROLLX(lastJX),SCROLLY(lastJY),
+                         el2gfx(Feld[lastJX][lastJY]));
+    }
+    else if (Feld[lastJX][lastJY]==EL_DYNAMIT)
+      DrawDynamite(lastJX,lastJY);
+    else
+      DrawLevelField(lastJX,lastJY);
+
     return;
   }
   else if (!FrameReached(&actual_frame_counter,1))
     return;
   }
   else if (!FrameReached(&actual_frame_counter,1))
index c84a3cd711a00b8dd5176894fe907decbeb88cfd..9a28f43541d85a40420b30655833bf729c820dff 100644 (file)
 
 #include "gfxloader.h"
 
 
 #include "gfxloader.h"
 
+
+
+
+
+
+extern Window                  window;
+extern void Delay(long);
+
+
+
+
+
+
 #ifdef DEBUG
 /*
 #define DEBUG_GIF
 #ifdef DEBUG
 /*
 #define DEBUG_GIF
@@ -63,12 +76,22 @@ static int Read_GIF_to_Pixmap_or_Bitmap(Display *, char *, Pixmap *, int);
 
 int Read_GIF_to_Bitmap(Display *display, char *filename, Pixmap *pixmap)
 {
 
 int Read_GIF_to_Bitmap(Display *display, char *filename, Pixmap *pixmap)
 {
+  printf("Read_GIF_to_Bitmap\n");
+
+
+
+
   return(Read_GIF_to_Pixmap_or_Bitmap(display, filename,
                                      pixmap, READ_GIF_TO_BITMAP));
 }
 
 int Read_GIF_to_Pixmap(Display *display, char *filename, Pixmap *pixmap)
 {
   return(Read_GIF_to_Pixmap_or_Bitmap(display, filename,
                                      pixmap, READ_GIF_TO_BITMAP));
 }
 
 int Read_GIF_to_Pixmap(Display *display, char *filename, Pixmap *pixmap)
 {
+  printf("Read_GIF_to_Pixmap\n");
+
+
+
+
   return(Read_GIF_to_Pixmap_or_Bitmap(display, filename,
                                      pixmap, READ_GIF_TO_PIXMAP));
 }
   return(Read_GIF_to_Pixmap_or_Bitmap(display, filename,
                                      pixmap, READ_GIF_TO_PIXMAP));
 }
@@ -141,6 +164,22 @@ int Read_GIF_to_Pixmap_or_Bitmap(Display *display, char *filename,
       gcv.background = WhitePixel(display,screen);
       gc = XCreateGC(display, root, GCForeground | GCBackground, &gcv);
       XPutImage(display,new_pixmap,gc,image,0,0,0,0,width,height);
       gcv.background = WhitePixel(display,screen);
       gc = XCreateGC(display, root, GCForeground | GCBackground, &gcv);
       XPutImage(display,new_pixmap,gc,image,0,0,0,0,width,height);
+
+
+
+
+
+
+      Delay(1000000);
+
+      XPutImage(display,window,gc,image,0,0,0,0,width,height);
+
+      Delay(3000000);
+
+
+
+
+
       XFreeGC(display, gc);
     }
 
       XFreeGC(display, gc);
     }
 
@@ -770,15 +809,42 @@ static int ConvertXImageDepth(Display *display, XImage **image)
   int screen = DefaultScreen(display);
   int depth = DefaultDepth(display, screen);
 
   int screen = DefaultScreen(display);
   int depth = DefaultDepth(display, screen);
 
+
+
+
+
+
+  printf("ConvertXImageDepth:\n");
+  printf("(*image)->depth == %d\n",
+        (*image)->depth);
+  printf("DefaultDepth(display, screen) == %d\n",
+        DefaultDepth(display, screen));
+
+
+
+
   if ((*image)->depth != depth)
   {
     XImage *old_image, *new_image;
   if ((*image)->depth != depth)
   {
     XImage *old_image, *new_image;
+    /*
     Visual *visual = DefaultVisual(display,screen);
     Visual *visual = DefaultVisual(display,screen);
+    */
     int width = (*image)->width;
     int height = (*image)->height;
     register int dwx, dwy;
     byte *data;
 
     int width = (*image)->width;
     int height = (*image)->height;
     register int dwx, dwy;
     byte *data;
 
+
+
+
+
+    printf("ConvertXImageDepth: ---------> CONVERTING...\n");
+
+
+
+
+
+
     data = (byte *)malloc(width * height * depth);
     old_image = *image;
 
     data = (byte *)malloc(width * height * depth);
     old_image = *image;
 
@@ -913,6 +979,15 @@ int Read_ILBM_to_Bitmap(Display *display, char *filename, Pixmap *pixmap)
   int bytes_per_line, bitmap_size;
   FILE *file;
 
   int bytes_per_line, bitmap_size;
   FILE *file;
 
+
+
+
+
+  printf("Read_ILBM_to_Bitmap\n");
+
+
+
+
   if (!(file = fopen(filename,"r")))
     return(ILBM_OpenFailed);
 
   if (!(file = fopen(filename,"r")))
     return(ILBM_OpenFailed);