#endif
};
+static Bitmap *bitmap_font_initial = NULL;
+
static void InitSetup(void);
static void InitPlayerInfo(void);
static void InitLevelInfo(void);
InitEventFilter(FilterMouseMotionEvents);
- InitGfx();
InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
InitElementInfo();
+ InitGfx();
+
InitLevelInfo();
InitLevelArtworkInfo();
+
InitImages(); /* needs to know current level directory */
InitSound(); /* needs to know current level directory */
InitGadgets(); /* needs images + number of level series */
#endif
}
+static void ReinitializeGraphics()
+{
+ ReloadCustomImages(); /* load custom image files */
+
+ InitGraphicInfo(); /* initialize graphic info from config file */
+
+ InitFontInfo(bitmap_font_initial,
+ new_graphic_info[IMG_MENU_FONT_BIG].bitmap,
+ new_graphic_info[IMG_MENU_FONT_MEDIUM].bitmap,
+ new_graphic_info[IMG_MENU_FONT_SMALL].bitmap,
+ new_graphic_info[IMG_MENU_FONT_EM].bitmap);
+}
+
static void InitImages()
{
InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES);
- /* load custom images */
- ReloadCustomImages();
-
- InitGraphicInfo();
+ ReinitializeGraphics();
}
static void InitMixer()
tile_clip_gc = XCreateGC(display, window->drawable,
clip_gc_valuemask, &clip_gc_values);
+#if 0
for (i=0; i<NUM_BITMAPS; i++)
{
if (pix[i]->clip_mask)
clip_gc_valuemask, &clip_gc_values);
}
}
+#endif
#if defined(TARGET_X11_NATIVE)
XFreeGC(display, tile_clip_gc);
tile_clip_gc = None;
+#if 0
for (i=0; i<NUM_BITMAPS; i++)
{
if (pix[i] != NULL && pix[i]->stored_clip_gc)
pix[i]->stored_clip_gc = None;
}
}
+#endif
+
#endif /* TARGET_X11 */
}
void InitGfx()
{
+#if 0
int i;
+#endif
/* initialize some global variables */
global.frames_per_second = 0;
InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
/* create additional image buffers for double-buffering */
- pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
- pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
+ bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
+ bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
+#if 0
pix[PIX_FONT_SMALL] = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
InitFontInfo(NULL, NULL, pix[PIX_FONT_SMALL], NULL);
+#else
+ bitmap_font_initial = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
+
+ InitFontInfo(bitmap_font_initial, NULL, NULL, NULL, NULL);
+#endif
DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
DrawInitText("Loading graphics:", 120, FC_GREEN);
+#if 0
for (i=0; i<NUM_PICTURES; i++)
{
+#if 0
if (i != PIX_FONT_SMALL)
+#endif
{
DrawInitText(image_filename[i], 150, FC_YELLOW);
pix[i] = LoadCustomImage(image_filename[i]);
}
}
+#endif
+#if 0
InitFontInfo(pix[PIX_FONT_BIG], pix[PIX_FONT_MEDIUM], pix[PIX_FONT_SMALL],
pix[PIX_FONT_EM]);
+#endif
InitTileClipmasks();
}
int x, y;
drawto = backbuffer;
- fieldbuffer = pix[PIX_DB_FIELD];
+ fieldbuffer = bitmap_db_field;
SetDrawtoField(DRAW_BACKBUFFER);
- BlitBitmap(pix[PIX_BACK], backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+ BlitBitmap(new_graphic_info[IMG_MENU_BACK].bitmap, backbuffer,
+ 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
- ClearRectangle(pix[PIX_DB_DOOR], 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE);
+ ClearRectangle(bitmap_db_door, 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE);
for (x=0; x<MAX_BUF_XSIZE; x++)
for (y=0; y<MAX_BUF_YSIZE; y++)
static boolean last_override_level_graphics = FALSE;
static boolean last_override_level_sounds = FALSE;
static boolean last_override_level_music = FALSE;
-
/* identifier for new artwork; default: artwork configured in setup */
char *gfx_new_identifier = artwork.gfx_current->identifier;
char *snd_new_identifier = artwork.snd_current->identifier;
char *mus_new_identifier = artwork.mus_current->identifier;
+ boolean redraw_screen = FALSE;
+
+ if (leveldir_current_identifier == NULL)
+ leveldir_current_identifier = leveldir_current->identifier;
+
+#if 0
+ printf("CURRENT GFX: '%s' ['%s']\n", artwork.gfx_current->identifier,
+ leveldir_current->graphics_set);
+ printf("CURRENT LEV: '%s' / '%s'\n", leveldir_current_identifier,
+ leveldir_current->identifier);
+#endif
#if 0
printf("graphics --> '%s' ('%s')\n",
if (strcmp(artwork.gfx_current_identifier, gfx_new_identifier) != 0 ||
last_override_level_graphics != setup.override_level_graphics)
{
+#if 0
+ printf("CHANGED GFX: '%s' -> '%s'\n",
+ artwork.gfx_current_identifier, gfx_new_identifier);
+#endif
+
+#if 0
int i;
+#endif
setLevelArtworkDir(artwork.gfx_first);
ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE);
+#if 0
for (i=0; i<NUM_PICTURES; i++)
{
DrawInitText(image_filename[i], 150, FC_YELLOW);
ReloadCustomImage(pix[i], image_filename[i]);
}
+#endif
- ReloadCustomImages();
- InitGraphicInfo();
+ ReinitializeGraphics();
FreeTileClipmasks();
InitTileClipmasks();
+
+#if 0
InitGfxBackground();
/* force redraw of (open or closed) door graphics */
SetDoorState(DOOR_OPEN_ALL);
CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
+#endif
+#if 0
artwork.gfx_current_identifier = gfx_new_identifier;
+#else
+ artwork.gfx_current_identifier = artwork.gfx_current->identifier;
+#endif
last_override_level_graphics = setup.override_level_graphics;
+
+ redraw_screen = TRUE;
}
if (strcmp(artwork.snd_current_identifier, snd_new_identifier) != 0 ||
artwork.snd_current_identifier = snd_new_identifier;
last_override_level_sounds = setup.override_level_sounds;
+
+ redraw_screen = TRUE;
}
if (strcmp(artwork.mus_current_identifier, mus_new_identifier) != 0 ||
artwork.mus_current_identifier = mus_new_identifier;
last_override_level_music = setup.override_level_music;
+
+ redraw_screen = TRUE;
+ }
+
+ if (redraw_screen)
+ {
+ InitGfxBackground();
+
+ /* force redraw of (open or closed) door graphics */
+ SetDoorState(DOOR_OPEN_ALL);
+ CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
}
#if 0
static void InitGraphicInfo()
{
static int gfx_action[NUM_IMAGE_FILES];
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+ int last_frame;
int i;
image_files = getCurrentImageList();
/* animation synchronized with global frame counter, not move position */
new_graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC];
#endif
+
+ /* now check if the loaded image is large enough for the animation */
+ last_frame = new_graphic_info[i].anim_frames - 1;
+
+ getGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
+ if (src_x + TILEX > src_bitmap->width ||
+ src_y + TILEY > src_bitmap->height)
+ Error(ERR_EXIT, "InitGraphicInfo: image bitmap '%s' too small for graphic object %d (normal size)", src_bitmap->source_filename, i);
+
+ getMiniGraphicSource(i, &src_bitmap, &src_x, &src_y);
+ if (src_x + MINI_TILEX > src_bitmap->width ||
+ src_y + MINI_TILEY > src_bitmap->height)
+ Error(ERR_EXIT, "InitGraphicInfo: image bitmap '%s' too small for graphic object %d ('mini' size)", src_bitmap->source_filename, i);
+
+ getMicroGraphicSource(i, &src_bitmap, &src_x, &src_y);
+ if (src_x + MICRO_TILEX > src_bitmap->width ||
+ src_y + MICRO_TILEY > src_bitmap->height)
+ Error(ERR_EXIT, "InitGraphicInfo: image bitmap '%s' too small for graphic object %d ('micro' size)", src_bitmap->source_filename, i);
+
+
+#if 0
+ {
+ int j;
+
+ if (i == IMG_EMERALD)
+ {
+ for (j=0; j<NUM_GFX_ARGS; j++)
+ printf("%s -> %d\n", image_config_suffix[j].token, parameter[j]);
+ printf("-> %d\n", new_graphic_info[i].anim_frames);
+ printf("\n");
+ }
+ }
+#endif
+
}
+
#if 0
printf("D> %d\n", image_files[GFX_BD_DIAMOND].parameter[GFX_ARG_NUM_FRAMES]);
printf("W> %d\n", image_files[GFX_ROBOT_WHEEL].parameter[GFX_ARG_NUM_FRAMES]);
void CloseAllAndExit(int exit_value)
{
+#if 0
int i;
+#endif
StopSounds();
FreeAllSounds();
FreeAllImages();
FreeTileClipmasks();
+#if 0
for (i=0; i<NUM_BITMAPS; i++)
FreeBitmap(pix[i]);
+#endif
+
+ if (bitmap_font_initial)
+ FreeBitmap(bitmap_font_initial);
CloseVideoDisplay();
ClosePlatformDependantStuff();