From: Holger Schemel Date: Thu, 4 Feb 1999 19:53:43 +0000 (+0100) Subject: rnd-19990204-3 X-Git-Tag: 1.3.0^2~1 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=afd9659572a8963b24b17340613b396ea49cbe55;p=rocksndiamonds.git rnd-19990204-3 --- diff --git a/src/Makefile b/src/Makefile index 4c0a427b..37352916 100644 --- a/src/Makefile +++ b/src/Makefile @@ -69,9 +69,9 @@ CONFIG = $(CONFIG_GAME_DIR) $(SOUNDS) $(JOYSTICK) \ $(CONFIG_SCORE_ENTRIES) $(XPM_INCLUDE_FILE) # DEBUG = -DDEBUG -g -Wall -ansi -pedantic -DEBUG = -DDEBUG -g -Wall +# DEBUG = -DDEBUG -g -Wall # DEBUG = -O3 -Wall -ansi -pedantic -# DEBUG = -O3 -Wall +DEBUG = -O3 -Wall # DEBUG = -O3 # SYSTEM = -Aa -D_HPUX_SOURCE -Dhpux # for HP-UX (obsolete) diff --git a/src/init.c b/src/init.c index 684cdb4d..7c62ad95 100644 --- a/src/init.c +++ b/src/init.c @@ -497,6 +497,21 @@ void InitGfx() }; #endif +#ifdef DEBUG +#if 0 + static struct PictureFileInfo test_pic1 = + { + "RocksFont2", + FALSE + }; + static struct PictureFileInfo test_pic2 = + { + "mouse", + FALSE + }; +#endif +#endif + static struct { int start; @@ -551,6 +566,19 @@ void InitGfx() debug_print_timestamp(0, NULL); /* initialize timestamp function */ #endif +#ifdef DEBUG +#if 0 + printf("Test: Loading RocksFont2.pcx ...\n"); + LoadGfx(PIX_SMALLFONT,&test_pic1); + printf("Test: Done.\n"); + printf("Test: Loading mouse.pcx ...\n"); + LoadGfx(PIX_SMALLFONT,&test_pic2); + printf("Test: Done.\n"); +#endif +#endif + + + LoadGfx(PIX_SMALLFONT,&pic[PIX_SMALLFONT]); DrawInitText(WINDOW_TITLE_STRING,20,FC_YELLOW); DrawInitText(COPYRIGHT_STRING,50,FC_RED); diff --git a/src/msdos.c b/src/msdos.c index 598aa5d2..5090c55c 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -348,6 +348,11 @@ Window XCreateSimpleWindow(Display *display, Window parent, int x, int y, display->screens[display->default_screen].height = YRES; set_mouse_sprite(display->mouse_ptr); + +#if 0 + set_mouse_sprite_focus(1, 1); +#endif + set_mouse_speed(1, 1); set_mouse_range(display->screens[display->default_screen].x + 1, display->screens[display->default_screen].y + 1, @@ -577,11 +582,17 @@ static BITMAP *Read_PCX_to_AllegroBitmap(char *filename) /* read the graphic file in PCX format to internal image structure */ if ((image = Read_PCX_to_Image(filename)) == NULL) + { + Error(ERR_RETURN, "Read_PCX_to_Image failed"); return NULL; + } /* convert internal image structure to allegro bitmap structure */ if ((bitmap = Image_to_AllegroBitmap(image)) == NULL) + { + Error(ERR_RETURN, "Image_to_AllegroBitmap failed"); return NULL; + } set_palette(global_colormap); diff --git a/src/pcx.c b/src/pcx.c index 514d30de..1c63396a 100644 --- a/src/pcx.c +++ b/src/pcx.c @@ -139,8 +139,9 @@ Image *Read_PCX_to_Image(char *filename) file_length = ftell(file); rewind(file); - if (file_length < PCX_HEADER_SIZE + PCX_COLORMAP_SIZE) + if (file_length < PCX_HEADER_SIZE) { + /* PCX file is too short to contain a valid PCX header */ fclose(file); return NULL; } @@ -185,6 +186,7 @@ Image *Read_PCX_to_Image(char *filename) filename, pcx.xmax, pcx.ymax, pcx.color_planes); printf("depth: %d\n", pcx.bits_per_pixel); + printf("color_planes: %d\n", pcx.color_planes); printf("bytes_per_line: %d\n", pcx.bytes_per_line); printf("palette type: %s\n", (pcx.palette_type == 1 ? "color" : @@ -205,6 +207,13 @@ Image *Read_PCX_to_Image(char *filename) return NULL; } + if (file_length < PCX_HEADER_SIZE + PCX_COLORMAP_SIZE) + { + /* PCX file is too short to contain a valid 256 colors colormap */ + fclose(file); + return NULL; + } + /* read colormap data */ if (!PCX_ReadColormap(image, buffer_ptr, buffer_last)) {