+void LoadGfx(int pos, struct PictureFileInfo *pic)
+{
+ char basefilename[256];
+ char filename[256];
+
+#ifdef USE_XPM_LIBRARY
+ int xpm_err, xbm_err;
+ unsigned int width,height;
+ int hot_x,hot_y;
+ Pixmap shapemask;
+ char *picture_ext = ".xpm";
+ char *picturemask_ext = "Mask.xbm";
+#else
+ int pcx_err;
+ char *picture_ext = ".pcx";
+#endif
+
+ /* Grafik laden */
+ if (pic->picture_filename)
+ {
+ sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
+ DrawInitText(basefilename, 150, FC_YELLOW);
+ sprintf(filename, "%s/%s/%s",
+ options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
+
+#ifdef MSDOS
+ rest(100);
+#endif /* MSDOS */
+
+#if DEBUG_TIMING
+ debug_print_timestamp(1, NULL); /* initialize timestamp function */
+#endif
+
+#ifdef USE_XPM_LIBRARY
+
+ xpm_att[pos].valuemask = XpmCloseness;
+ xpm_att[pos].closeness = 20000;
+ xpm_err = XpmReadFileToPixmap(display,window,filename,
+ &pix[pos],&shapemask,&xpm_att[pos]);
+ switch(xpm_err)
+ {
+ case XpmOpenFailed:
+ Error(ERR_EXIT, "cannot open XPM file '%s'", filename);
+ case XpmFileInvalid:
+ Error(ERR_EXIT, "invalid XPM file '%s'", filename);
+ case XpmNoMemory:
+ Error(ERR_EXIT, "not enough memory for XPM file '%s'", filename);
+ case XpmColorFailed:
+ Error(ERR_EXIT, "cannot get colors for XPM file '%s'", filename);
+ default:
+ break;
+ }
+
+#if DEBUG_TIMING
+ printf("LOADING XPM FILE %s:", filename);
+ debug_print_timestamp(1, "");
+#endif
+
+#else /* !USE_XPM_LIBRARY */
+
+ pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
+ &pix[pos], &clipmask[pos]);
+ switch(pcx_err)
+ {
+ case PCX_Success:
+ break;
+ 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;
+ }
+
+#if DEBUG_TIMING
+ printf("SUMMARY LOADING PCX FILE %s:", filename);
+ debug_print_timestamp(1, "");
+#endif
+
+#endif /* !USE_XPM_LIBRARY */
+
+ if (!pix[pos])
+ Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
+ }
+
+ /* zugehörige Maske laden (wenn vorhanden) */
+ if (pic->picture_with_mask)
+ {
+#ifdef USE_XPM_LIBRARY
+
+ sprintf(basefilename, "%s%s", pic->picture_filename, picturemask_ext);
+ DrawInitText(basefilename, 150, FC_YELLOW);
+ sprintf(filename, "%s/%s/%s",
+ options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
+
+#if DEBUG_TIMING
+ debug_print_timestamp(1, NULL); /* initialize timestamp function */
+#endif
+
+ xbm_err = XReadBitmapFile(display,window,filename,
+ &width,&height,&clipmask[pos],&hot_x,&hot_y);
+ switch(xbm_err)
+ {
+ case BitmapSuccess:
+ break;
+ case BitmapOpenFailed:
+ Error(ERR_EXIT, "cannot open XBM file '%s'", filename);
+ case BitmapFileInvalid:
+ Error(ERR_EXIT, "invalid XBM file '%s'", filename);
+ case BitmapNoMemory:
+ Error(ERR_EXIT, "not enough memory for XBM file '%s'", filename);
+ break;
+ default:
+ break;
+ }
+
+#if DEBUG_TIMING
+ printf("LOADING XBM FILE %s:", filename);
+ debug_print_timestamp(1, "");
+#endif
+
+#endif /* USE_XPM_LIBRARY */
+
+ if (!clipmask[pos])
+ Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
+ }
+}
+
+void InitGadgets()
+{
+ CreateLevelEditorGadgets();
+ CreateGameButtons();
+ CreateTapeButtons();
+ CreateToolButtons();
+ CreateScreenGadgets();