-#define COMPILE_DATE_STRING "[2002-11-30 00:17]"
+#define COMPILE_DATE_STRING "[2002-11-30 12:50]"
InitGraphicInfo(); /* initialize graphic info from config file */
- InitFontInfo(new_graphic_info[IMG_MENU_FONT_BIG].bitmap,
+ 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);
-
- if (bitmap_font_initial)
- {
- FreeBitmap(bitmap_font_initial);
- bitmap_font_initial = NULL;
- }
}
static void InitImages()
#else
bitmap_font_initial = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
- InitFontInfo(NULL, NULL, bitmap_font_initial, NULL);
+ InitFontInfo(bitmap_font_initial, NULL, NULL, NULL, NULL);
#endif
DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
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
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
FreeBitmap(pix[i]);
#endif
+ if (bitmap_font_initial)
+ FreeBitmap(bitmap_font_initial);
+
CloseVideoDisplay();
ClosePlatformDependantStuff();
static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info,
struct ListNodeInfo **listnode,
- char *filename)
+ char *basename)
{
+ char *init_text[] =
+ { "",
+ "Loading graphics:",
+ "Loading sounds:",
+ "Loading music:"
+ };
+
ListNode *node;
+ char *filename = getCustomArtworkFilename(basename, artwork_info->type);
+
+ if (filename == NULL)
+ {
+ Error(ERR_WARN, "cannot find artwork file '%s'", basename);
+ return;
+ }
/* check if the old and the new artwork file are the same */
if (*listnode && strcmp((*listnode)->source_filename, filename) == 0)
*listnode = (struct ListNodeInfo *)node->content;
(*listnode)->num_references++;
+
+ return;
}
- else if ((*listnode = artwork_info->load_artwork(filename)) != NULL)
+
+ DrawInitText(init_text[artwork_info->type], 120, FC_GREEN);
+ DrawInitText(basename, 150, FC_YELLOW);
+
+ if ((*listnode = artwork_info->load_artwork(filename)) != NULL)
{
#if 0
printf("[adding new artwork '%s']\n", filename);
struct ListNodeInfo **listnode,
char *basename)
{
+#if 0
char *filename = getCustomArtworkFilename(basename, artwork_info->type);
+#endif
#if 0
printf("GOT CUSTOM ARTWORK FILE '%s'\n", filename);
return;
}
+#if 0
if (filename == NULL)
{
Error(ERR_WARN, "cannot find artwork file '%s'", basename);
}
replaceArtworkListEntry(artwork_info, listnode, filename);
+#else
+ replaceArtworkListEntry(artwork_info, listnode, basename);
+#endif
}
static void LoadArtworkToList(struct ArtworkListInfo *artwork_info,
void ReloadCustomArtworkList(struct ArtworkListInfo *artwork_info)
{
+#if 0
static struct
{
char *text;
{ "Loading sounds:", TRUE },
{ "Loading music:", TRUE }
};
+#endif
int num_file_list_entries = artwork_info->num_file_list_entries;
struct FileInfo *file_list = artwork_info->file_list;
LoadArtworkConfig(artwork_info);
+#if 0
if (draw_init[artwork_info->type].do_it)
DrawInitText(draw_init[artwork_info->type].text, 120, FC_GREEN);
+#endif
#if 0
printf("DEBUG: reloading %d artwork files ...\n", num_file_list_entries);
for(i=0; i<num_file_list_entries; i++)
{
+#if 0
if (draw_init[artwork_info->type].do_it)
DrawInitText(file_list[i].token, 150, FC_YELLOW);
+#endif
LoadArtworkToList(artwork_info, file_list[i].filename, i);
#endif
}
+#if 0
draw_init[artwork_info->type].do_it = FALSE;
+#endif
/*
printf("list size == %d\n", getNumNodes(artwork_info->content_list));
/* font functions */
/* ========================================================================= */
-void InitFontInfo(Bitmap *bitmap_big, Bitmap *bitmap_medium,
+void InitFontInfo(Bitmap *bitmap_initial,
+ Bitmap *bitmap_big, Bitmap *bitmap_medium,
Bitmap *bitmap_small, Bitmap *bitmap_tile)
{
+ font.bitmap_initial = bitmap_initial;
font.bitmap_big = bitmap_big;
font.bitmap_medium = bitmap_medium;
font.bitmap_small = bitmap_small;
int getFontWidth(int font_size, int font_type)
{
- return (font_size == FS_BIG ? FONT1_XSIZE :
- font_size == FS_MEDIUM ? FONT6_XSIZE :
- font_type == FC_SPECIAL1 ? FONT3_XSIZE :
+ return (font_type == FC_SPECIAL1 ? FONT3_XSIZE :
font_type == FC_SPECIAL2 ? FONT4_XSIZE :
font_type == FC_SPECIAL3 ? FONT5_XSIZE :
+ font_size == FS_BIG ? FONT1_XSIZE :
+ font_size == FS_MEDIUM ? FONT6_XSIZE :
+ font_size == FS_SMALL ? FONT2_XSIZE :
FONT2_XSIZE);
}
int getFontHeight(int font_size, int font_type)
{
- return (font_size == FS_BIG ? FONT1_YSIZE :
- font_size == FS_MEDIUM ? FONT6_YSIZE :
- font_type == FC_SPECIAL1 ? FONT3_YSIZE :
+ return (font_type == FC_SPECIAL1 ? FONT3_YSIZE :
font_type == FC_SPECIAL2 ? FONT4_YSIZE :
font_type == FC_SPECIAL3 ? FONT5_YSIZE :
+ font_size == FS_BIG ? FONT1_YSIZE :
+ font_size == FS_MEDIUM ? FONT6_YSIZE :
+ font_size == FS_SMALL ? FONT2_YSIZE :
FONT2_YSIZE);
}
void DrawInitText(char *text, int ypos, int color)
{
- if (window && font.bitmap_small)
+ if (window && font.bitmap_initial)
{
ClearRectangle(window, 0, ypos, video.width, FONT2_YSIZE);
DrawTextExt(window, (video.width - strlen(text) * FONT2_XSIZE)/2,
- ypos, text, FS_SMALL, color);
+ ypos, text, FS_INITIAL, color);
FlushDisplay();
}
}
redraw_mask |= REDRAW_DOOR_1;
}
-void DrawTextExt(DrawBuffer *bitmap, int x, int y,
- char *text, int font_size, int font_type)
+void DrawTextExt(DrawBuffer *bitmap, int x, int y, char *text,
+ int font_size, int font_type)
{
Bitmap *font_bitmap;
int font_width, font_height, font_starty;
boolean print_inverse = FALSE;
- if (font_size != FS_SMALL && font_size != FS_BIG && font_size != FS_MEDIUM)
- font_size = FS_SMALL;
+ if (font_size != FS_BIG && font_size != FS_MEDIUM && font_size != FS_SMALL)
+ font_size = FS_INITIAL;
if (font_type < FC_RED || font_type > FC_SPECIAL3)
font_type = FC_RED;
font_size == FS_BIG ? font.bitmap_big :
font_size == FS_MEDIUM ? font.bitmap_medium :
font_size == FS_SMALL ? font.bitmap_small :
- font.bitmap_small);
+ font.bitmap_initial);
if (font_bitmap == NULL)
return;
else
font_starty = (font_type * (font_size == FS_BIG ? FONT1_YSIZE :
font_size == FS_MEDIUM ? FONT6_YSIZE :
+ font_size == FS_SMALL ? FONT2_YSIZE :
FONT2_YSIZE) *
FONT_LINES_PER_FONT);
/* font types */
-#define FS_SMALL 0
+#define FS_INITIAL 0
#define FS_BIG 1
#define FS_MEDIUM 2
-#define FS_TILE 3
+#define FS_SMALL 3
+#define FS_TILE 4
/* font colors */
#define FC_RED 0
struct FontInfo
{
+ Bitmap *bitmap_initial;
Bitmap *bitmap_big;
Bitmap *bitmap_medium;
Bitmap *bitmap_small;
};
-void InitFontInfo(Bitmap *, Bitmap *, Bitmap *, Bitmap *);
+void InitFontInfo(Bitmap *, Bitmap *, Bitmap *, Bitmap *, Bitmap *);
int getFontWidth(int, int);
int getFontHeight(int, int);
void DrawInitText(char *, int, int);