rnd-19980907
authorHolger Schemel <info@artsoft.org>
Mon, 7 Sep 1998 08:09:15 +0000 (10:09 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:30:34 +0000 (10:30 +0200)
src/cartoons.c
src/game.c
src/gif.c
src/main.h
src/new.c
src/send.c
src/tools.c

index 1c193f6f689ae3b334210ee8ed3c04b27530df27..2edb0e4e942932d859ffc02e106e8146f4ad37ca 100644 (file)
@@ -140,9 +140,16 @@ void HandleAnimation(int mode)
       }
 
       if (soft_scrolling_on && game_status==PLAYING)
+      {
+       int fx = FX, fy = FY;
+
+        fx += (PlayerMovDir & (MV_LEFT|MV_RIGHT) ? ScreenMovPos : 0);
+        fy += (PlayerMovDir & (MV_UP|MV_DOWN)    ? ScreenMovPos : 0);
+
        XCopyArea(display,fieldbuffer,backbuffer,gc,
-                 FX,FY, SXSIZE,SYSIZE,
+                 fx,fy, SXSIZE,SYSIZE,
                  SX,SY);
+      }
 
       return;
       break;
index 802c9f5b7874dd4ae8c5641b9e4468c750f335f6..1df5a24e7bcedc7316cc72dc0e4aca6abf037eac 100644 (file)
@@ -1791,7 +1791,13 @@ void StartMoving(int x, int y)
       else if (element == EL_BUTTERFLY || element == EL_FIREFLY)
        DrawGraphicAnimation(x,y, el2gfx(element), 2, 4, ANIM_NORMAL);
       else if (element==EL_SONDE)
-       DrawGraphicAnimation(x,y, GFX_SONDE_START, 8, 2, ANIM_NORMAL);
+      {
+       int nextJX = JX + (JX - lastJX);
+       int nextJY = JY + (JY - lastJY);
+
+       if (!(PlayerPushing && PlayerGfxPos && x == nextJX && y == nextJY))
+         DrawGraphicAnimation(x,y, GFX_SONDE_START, 8, 2, ANIM_NORMAL);
+      }
 
       return;
     }
index d8f56a4a2e176797b0b04cbf3a7e3cc4d8cc4203..bbeb6aba3baf73f0ea10d8eb2f319c057e50d900 100644 (file)
--- a/src/gif.c
+++ b/src/gif.c
@@ -1,18 +1,5 @@
 
-/* gif.c:
- *
- * adapted from code by kirk johnson (tuna@athena.mit.edu).  most of this
- * code is unchanged. -- jim frost 12.31.89
- *
- * gifin.c
- * kirk johnson
- * november 1989
- *
- * routines for reading GIF files
- *
- * Copyright 1989 Kirk L. Johnson (see the included file
- * "kljcpyrght.h" for complete copyright information)
- */
+/* gif.c */
 
 #define GIF_C
 
@@ -150,7 +137,7 @@ static int gifin_open_file(FILE *s)
   buf[GIF_SIG_LEN] = '\0';
   if (strcmp((char *) buf, GIF_SIG) == 0)
     gifin_version = GIF87a;
-  else if(strcmp((char *) buf, GIF_SIG_89) == 0)
+  else if (strcmp((char *) buf, GIF_SIG_89) == 0)
     gifin_version = GIF89a;
   else
     return GIFIN_ERR_BAD_SIG;
@@ -364,7 +351,7 @@ static int gifin_get_pixel(pel)
         pstk[place] = first;
       }
 
-      if((errno = gifin_add_string(prev_code, first)) != GIFIN_SUCCESS)
+      if ((errno = gifin_add_string(prev_code, first)) != GIFIN_SUCCESS)
         return errno;
       prev_code = code;
     }
@@ -481,77 +468,64 @@ static int gifin_add_string(int p, int e)
   return GIFIN_SUCCESS;
 }
 
-/* these are the routines added for interfacing to xli
- */
-
-/* tell someone what the image we're loading is.  this could be a little more
- * descriptive but I don't care
- */
-
-static void tellAboutImage(char *name)
-{
-  printf("\n%s:\n  %dx%d %s%s image with %d colors\n",
-        name, gifin_img_width, gifin_img_height,
-        (gifin_interlace_flag ? "interlaced " : ""),
-        gif_version_name[gifin_version],
-        (gifin_l_cmap_flag ? gifin_l_ncolors : gifin_g_ncolors));
-}
-
 Image *gifLoad(char *fullname)
 {
-  FILE *zf;
+  FILE *f;
   Image *image;
   int x, y, pixel, pass, scanlen;
   byte *pixptr, *pixline;
   int errno;
 
-  if (!(zf = fopen(fullname,"r")))
+  if (!(f = fopen(fullname,"r")))
   {
     perror("gifLoad");
     return(NULL);
   }
 
-  if ((gifin_open_file(zf) != GIFIN_SUCCESS) || /* read GIF header */
-      (gifin_open_image() != GIFIN_SUCCESS))    /* read image header */
+  if ((gifin_open_file(f) != GIFIN_SUCCESS) || /* read GIF header */
+      (gifin_open_image() != GIFIN_SUCCESS))   /* read image header */
   {
     printf("gifin_open_file or gifin_open_image failed!\n");
 
     gifin_close_file();
-    fclose(zf);
+    fclose(f);
     return(NULL);
   }
 
-  /*
-  tellAboutImage(fullname);
-  */
+  printf("%s:\n   %dx%d %s%s image with %d colors at depth %d\n",
+        fullname, gifin_img_width, gifin_img_height,
+        (gifin_interlace_flag ? "interlaced " : ""),
+        gif_version_name[gifin_version],
+        (gifin_l_cmap_flag ? gifin_l_ncolors : gifin_g_ncolors),
+        (gifin_l_cmap_flag ? gifin_l_pixel_bits : gifin_g_pixel_bits));
 
-  image= newRGBImage(gifin_img_width, gifin_img_height, (gifin_l_cmap_flag ?
-                                                        gifin_l_pixel_bits :
-                                                        gifin_g_pixel_bits));
-  image->title= dupString(fullname);
+  image = newRGBImage(gifin_img_width, gifin_img_height, (gifin_l_cmap_flag ?
+                                                         gifin_l_pixel_bits :
+                                                         gifin_g_pixel_bits));
+  image->title = dupString(fullname);
 
   /* if image has a local colormap, override global colormap
    */
 
   if (gifin_l_cmap_flag)
   {
-    for (x= 0; x < gifin_l_ncolors; x++)
+    for (x=0; x<gifin_l_ncolors; x++)
     {
-      image->rgb.red[x]= gifin_l_cmap[GIF_RED][x] << 8;
-      image->rgb.green[x]= gifin_l_cmap[GIF_GRN][x] << 8;
-      image->rgb.blue[x]= gifin_l_cmap[GIF_BLU][x] << 8;
+      image->rgb.red[x] = gifin_l_cmap[GIF_RED][x] << 8;
+      image->rgb.green[x] = gifin_l_cmap[GIF_GRN][x] << 8;
+      image->rgb.blue[x] = gifin_l_cmap[GIF_BLU][x] << 8;
     }
-    image->rgb.used= gifin_l_ncolors;
+    image->rgb.used = gifin_l_ncolors;
   }
   else
   {
-    for (x= 0; x < gifin_g_ncolors; x++)
+    for (x=0; x<gifin_g_ncolors; x++)
     {
-      image->rgb.red[x]= gifin_g_cmap[GIF_RED][x] << 8;
-      image->rgb.green[x]= gifin_g_cmap[GIF_GRN][x] << 8;
-      image->rgb.blue[x]= gifin_g_cmap[GIF_BLU][x] << 8;
+      image->rgb.red[x] = gifin_g_cmap[GIF_RED][x] << 8;
+      image->rgb.green[x] = gifin_g_cmap[GIF_GRN][x] << 8;
+      image->rgb.blue[x] = gifin_g_cmap[GIF_BLU][x] << 8;
     }
-    image->rgb.used= gifin_g_ncolors;
+    image->rgb.used = gifin_g_ncolors;
   }
 
   /* interlaced image -- futz with the vertical trace.  i wish i knew what
@@ -561,26 +535,27 @@ Image *gifLoad(char *fullname)
 
   if (gifin_interlace_flag)
   {
-    scanlen= image->height * image->pixlen;
+    scanlen = image->height * image->pixlen;
 
     /* interlacing takes four passes to read, each starting at a different
      * vertical point.
      */
 
-    for (pass= 0; pass < 4; pass++)
+    for (pass=0; pass<4; pass++)
     {
-      y= interlace_start[pass];
-      scanlen= image->width * image->pixlen * interlace_rate[pass];
-      pixline= image->data + (y * image->width * image->pixlen);
+      y = interlace_start[pass];
+      scanlen = image->width * image->pixlen * interlace_rate[pass];
+      pixline = image->data + (y * image->width * image->pixlen);
       while (y < gifin_img_height)
       {
-       pixptr= pixline;
-       for (x= 0; x < gifin_img_width; x++)
+       pixptr = pixline;
+       for (x=0; x<gifin_img_width; x++)
        {
          if ((errno = gifin_get_pixel(&pixel)) != GIFIN_SUCCESS)
          {
            fprintf(stderr, "gifLoad: %s - Short read within image data, '%s'\n", fullname, get_err_string(errno));
-           y = gifin_img_height; x = gifin_img_width;
+           y = gifin_img_height;
+           x = gifin_img_width;
          }
          valToMem(pixel, pixptr, image->pixlen);
          pixptr += image->pixlen;
@@ -595,16 +570,17 @@ Image *gifLoad(char *fullname)
     /* not an interlaced image, just read in sequentially
      */
 
-    if(image->pixlen == 1)      /* the usual case */
+    if (image->pixlen == 1)      /* the usual case */
     {
-      pixptr= image->data;
-      for (y= 0; y < gifin_img_height; y++)
-        for (x= 0; x < gifin_img_width; x++)
+      pixptr = image->data;
+      for (y=0; y<gifin_img_height; y++)
+        for (x=0; x<gifin_img_width; x++)
        {
           if ((errno = gifin_get_pixel(&pixel)) != GIFIN_SUCCESS)
          {
            fprintf(stderr, "gifLoad: %s - Short read within image data, '%s'\n", fullname, get_err_string(errno));
-            y = gifin_img_height; x = gifin_img_width;
+            y = gifin_img_height;
+           x = gifin_img_width;
           }
           valToMem(pixel, pixptr, 1);
           pixptr += 1;
@@ -612,14 +588,15 @@ Image *gifLoad(char *fullname)
     }
     else                       /* less ususal case */
     {
-      pixptr= image->data;
-      for (y= 0; y < gifin_img_height; y++)
-        for (x= 0; x < gifin_img_width; x++)
+      pixptr = image->data;
+      for (y=0; y<gifin_img_height; y++)
+        for (x=0; x<gifin_img_width; x++)
        {
           if ((errno = gifin_get_pixel(&pixel)) != GIFIN_SUCCESS)
          {
            fprintf(stderr, "gifLoad: %s - Short read within image data, '%s'\n", fullname, get_err_string(errno));
-            y = gifin_img_height; x = gifin_img_width;
+            y = gifin_img_height;
+           x = gifin_img_width;
           }
           valToMem(pixel, pixptr, image->pixlen);
           pixptr += image->pixlen;
@@ -628,7 +605,7 @@ Image *gifLoad(char *fullname)
   }
 
   gifin_close_file();
-  fclose(zf);
+  fclose(f);
 
   return(image);
 }
index 87db2010f30b8ea93c488a25e79e38398f368b78..be08fcdbb205d9baa2a1fe9a7ff8ea28c082efde 100644 (file)
@@ -993,7 +993,7 @@ extern char         *progname;
 #define LEVELREC_COOKIE_LEN    (strlen(LEVELREC_COOKIE)+1)
 #define JOYSTICK_COOKIE_LEN    (strlen(JOYSTICK_COOKIE)+1)
 
-#define VERSION_STRING         "1.1"
+#define VERSION_STRING         "1.2"
 #define GAMETITLE_STRING       "Rocks'n'Diamonds"
 #define WINDOWTITLE_STRING     GAMETITLE_STRING " " VERSION_STRING
 #define COPYRIGHT_STRING       "Copyright ^1995-98 by Holger Schemel"
index 0491352d887fb5b35b0cefa683f73ace60d97478..901df518f1691bdee31ea1d4831537e8b4534df1 100644 (file)
--- a/src/new.c
+++ b/src/new.c
@@ -1,13 +1,5 @@
 
-/* new.c:
- *
- * functions to allocate and deallocate structures and structure data
- *
- * jim frost 09.29.89
- *
- * Copyright 1989, 1991 Jim Frost.
- * See included file "copyright.h" for complete copyright information.
- */
+/* new.c */
 
 #include "xli.h"
 
index 56a65dc8efc527cb6f066f4201dcc6ea50ae3dc5..8b51d362c8e86a556c06abcecd03e6fd0d247a71 100644 (file)
@@ -1,8 +1,5 @@
 
-/* send.c
- *
- * send an Image to an X pixmap
- */
+/* send.c */
 
 #include "xli.h"
 
index 53290c195d93d05deb93c5ba8f24387e6cedbddc..18f90a06b333a41a5039e7784341ebc0525c5771 100644 (file)
@@ -108,15 +108,6 @@ void BackToFront()
       XCopyArea(display,buffer,window,gc,
                fx,fy, SXSIZE,SYSIZE,
                SX,SY);
-
-
-
-#if 0
-      printf("FULL SCREEN REDRAW [%d]\n", ScreenMovPos);
-#endif
-
-
-
     }
     redraw_mask &= ~REDRAW_MAIN;
   }
@@ -1475,6 +1466,9 @@ BOOL AreYouSure(char *text, unsigned int ays_state)
              break;
          }
          break;
+       case KeyRelease:
+         key_joystick_mapping = 0;
+         break;
        case FocusIn:
        case FocusOut:
          HandleFocusEvent((XFocusChangeEvent *) &event);