X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=184ea73f333c5beef4801ae7a5ff229041c3039e;hb=ab0879a8bcb3e816912bc89b8e21c22cc2a4c0c2;hp=7a5f5eeb521a651bff36cf587fed803df82831df;hpb=2357c391b4a587709627cc30316734b3c83c8134;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 7a5f5eeb..184ea73f 100644 --- a/src/init.c +++ b/src/init.c @@ -20,15 +20,14 @@ #include "tools.h" #include "files.h" #include "joystick.h" -#include "gfxload.h" -#include "gifload.h" +#include "image.h" #include "network.h" #include "netserv.h" #ifdef DEBUG -/* + #define DEBUG_TIMING -*/ + #endif struct PictureFileInfo @@ -139,7 +138,7 @@ void InitSound() return; #ifndef MSDOS - if (access(sound_device_name,W_OK)<0) + if (access(sound_device_name, W_OK) != 0) { Error(ERR_WARN, "cannot access sound device - no sounds"); sound_status = SOUND_OFF; @@ -245,7 +244,7 @@ void InitJoysticks() if (!setup.input[i].use_joystick) continue; - if (access(device_name, R_OK) < 0) + if (access(device_name, R_OK) != 0) { Error(ERR_WARN, "cannot access joystick device '%s'", device_name); continue; @@ -356,14 +355,18 @@ void InitWindow(int argc, char *argv[]) XChangeProperty(display, window, proto_atom, XA_ATOM, 32, PropModePrepend, (unsigned char *) &delete_atom, 1); - sprintf(icon_filename,"%s/%s",GFX_PATH,icon_pic.picture_filename); + sprintf(icon_filename, "%s/%s/%s", + options.base_directory, GRAPHICS_DIRECTORY, + icon_pic.picture_filename); XReadBitmapFile(display,window,icon_filename, &icon_width,&icon_height, &icon_pixmap,&icon_hot_x,&icon_hot_y); if (!icon_pixmap) Error(ERR_EXIT, "cannot read icon bitmap file '%s'", icon_filename); - sprintf(icon_filename,"%s/%s",GFX_PATH,icon_pic.picturemask_filename); + sprintf(icon_filename, "%s/%s/%s", + options.base_directory, GRAPHICS_DIRECTORY, + icon_pic.picturemask_filename); XReadBitmapFile(display,window,icon_filename, &icon_width,&icon_height, &iconmask_pixmap,&icon_hot_x,&icon_hot_y); @@ -637,8 +640,8 @@ void LoadGfx(int pos, struct PictureFileInfo *pic) char *picture_ext = ".xpm"; char *picturemask_ext = "Mask.xbm"; #else - int gif_err; - char *picture_ext = ".gif"; + int pcx_err; + char *picture_ext = ".pcx"; #endif #ifdef DEBUG_TIMING @@ -648,9 +651,10 @@ void LoadGfx(int pos, struct PictureFileInfo *pic) /* Grafik laden */ if (pic->picture_filename) { - sprintf(basefilename,"%s%s",pic->picture_filename,picture_ext); - DrawInitText(basefilename,150,FC_YELLOW); - sprintf(filename,"%s/%s",GFX_PATH,basefilename); + sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext); + DrawInitText(basefilename, 150, FC_YELLOW); + sprintf(filename, "%s/%s/%s", + options.base_directory, GRAPHICS_DIRECTORY, basefilename); #ifdef MSDOS rest(100); @@ -689,30 +693,30 @@ void LoadGfx(int pos, struct PictureFileInfo *pic) #else - gif_err = Read_GIF_to_Pixmaps(display, window, filename, + pcx_err = Read_PCX_to_Pixmaps(display, window, filename, &pix[pos], &clipmask[pos]); - switch(gif_err) + switch(pcx_err) { - case GIF_Success: + case PCX_Success: break; - case GIF_OpenFailed: - Error(ERR_EXIT, "cannot open GIF file '%s'", filename); - case GIF_ReadFailed: - Error(ERR_EXIT, "cannot read GIF file '%s'", filename); - case GIF_FileInvalid: - Error(ERR_EXIT, "invalid GIF file '%s'", filename); - case GIF_NoMemory: - Error(ERR_EXIT, "not enough memory for GIF file '%s'", filename); - case GIF_ColorFailed: - Error(ERR_EXIT, "cannot get colors for GIF file '%s'", filename); + case PCX_OpenFailed: + Error(ERR_EXIT, "cannot open PCX file '%s'", filename); + case PCX_ReadFailed: + Error(ERR_EXIT, "cannot read PCX file '%s'", filename); + case PCX_FileInvalid: + Error(ERR_EXIT, "invalid PCX file '%s'", filename); + case PCX_NoMemory: + Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename); + case PCX_ColorFailed: + Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename); default: break; } #ifdef DEBUG_TIMING count2 = Counter(); - printf("GIF LOADING %s IN %.2f SECONDS\n", + printf("PCX LOADING %s IN %.2f SECONDS\n", filename,(float)(count2-count1)/1000.0); #endif @@ -728,9 +732,10 @@ void LoadGfx(int pos, struct PictureFileInfo *pic) #ifdef XPM_INCLUDE_FILE - sprintf(basefilename,"%s%s",pic->picture_filename,picturemask_ext); - DrawInitText(basefilename,150,FC_YELLOW); - sprintf(filename,"%s/%s",GFX_PATH,basefilename); + sprintf(basefilename, "%s%s", pic->picture_filename, picturemask_ext); + DrawInitText(basefilename, 150, FC_YELLOW); + sprintf(filename, "%s/%s/%s", + options.base_directory, GRAPHICS_DIRECTORY, basefilename); #ifdef DEBUG_TIMING count1 = Counter();