From e2d2518810a4ab32f6dfd32faa83869307b3aa3d Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 7 Sep 1998 10:09:15 +0200 Subject: [PATCH] rnd-19980907 --- src/cartoons.c | 9 +++- src/game.c | 8 +++- src/gif.c | 121 ++++++++++++++++++++----------------------------- src/main.h | 2 +- src/new.c | 10 +--- src/send.c | 5 +- src/tools.c | 12 ++--- 7 files changed, 70 insertions(+), 97 deletions(-) diff --git a/src/cartoons.c b/src/cartoons.c index 1c193f6f..2edb0e4e 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -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; diff --git a/src/game.c b/src/game.c index 802c9f5b..1df5a24e 100644 --- a/src/game.c +++ b/src/game.c @@ -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; } diff --git a/src/gif.c b/src/gif.c index d8f56a4a..bbeb6aba 100644 --- 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; xrgb.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; xrgb.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; xpixlen); 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; ydata; - for (y= 0; y < gifin_img_height; y++) - for (x= 0; x < gifin_img_width; x++) + pixptr = image->data; + for (y=0; ypixlen); pixptr += image->pixlen; @@ -628,7 +605,7 @@ Image *gifLoad(char *fullname) } gifin_close_file(); - fclose(zf); + fclose(f); return(image); } diff --git a/src/main.h b/src/main.h index 87db2010..be08fcdb 100644 --- a/src/main.h +++ b/src/main.h @@ -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" diff --git a/src/new.c b/src/new.c index 0491352d..901df518 100644 --- 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" diff --git a/src/send.c b/src/send.c index 56a65dc8..8b51d362 100644 --- a/src/send.c +++ b/src/send.c @@ -1,8 +1,5 @@ -/* send.c - * - * send an Image to an X pixmap - */ +/* send.c */ #include "xli.h" diff --git a/src/tools.c b/src/tools.c index 53290c19..18f90a06 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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); -- 2.34.1