From: Holger Schemel Date: Sun, 5 Sep 2021 18:54:49 +0000 (+0200) Subject: improved code for drawing init text to screen X-Git-Tag: 4.3.0.0~75 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3e44421a400e6349d1e97f047391489bc1b396fb;p=rocksndiamonds.git improved code for drawing init text to screen --- diff --git a/src/init.c b/src/init.c index 3f8c253b..ae0e16c8 100644 --- a/src/init.c +++ b/src/init.c @@ -5530,7 +5530,7 @@ static void InitGfx(void) DrawProgramInfo(); - DrawInitText("Loading graphics", 120, FC_GREEN); + DrawInitTextHead("Loading graphics"); // initialize settings for busy animation with default values int parameter[NUM_GFX_ARGS]; diff --git a/src/libgame/misc.c b/src/libgame/misc.c index e7c2e098..e27c3e7e 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -3780,8 +3780,8 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) char *filename_base = UNDEFINED_FILENAME, *filename_local; int i, j; - DrawInitText("Loading artwork config", 120, FC_GREEN); - DrawInitText(ARTWORKINFO_FILENAME(artwork_info->type), 150, FC_YELLOW); + DrawInitTextHead("Loading artwork config"); + DrawInitTextItem(ARTWORKINFO_FILENAME(artwork_info->type)); // always start with reliable default values for (i = 0; i < num_file_list_entries; i++) @@ -3939,8 +3939,8 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, return; } - DrawInitText(init_text[artwork_info->type], 120, FC_GREEN); - DrawInitText(basename, 150, FC_YELLOW); + DrawInitTextHead(init_text[artwork_info->type]); + DrawInitTextItem(basename); if ((*listnode = artwork_info->load_artwork(filename)) != NULL) { diff --git a/src/libgame/setup.c b/src/libgame/setup.c index f1223d0d..f6d5bd11 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -3598,7 +3598,7 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, (leveldir_new->user_defined || !leveldir_new->handicap ? leveldir_new->last_level : leveldir_new->first_level); - DrawInitText(leveldir_new->name, 150, FC_YELLOW); + DrawInitTextItem(leveldir_new->name); pushTreeInfo(node_first, leveldir_new); @@ -3714,7 +3714,7 @@ void LoadLevelInfo(void) { InitUserLevelDirectory(getLoginName()); - DrawInitText("Loading level series", 120, FC_GREEN); + DrawInitTextHead("Loading level series"); LoadLevelInfoFromLevelDir(&leveldir_first, NULL, options.level_directory); LoadLevelInfoFromLevelDir(&leveldir_first, NULL, getUserLevelDir(NULL)); @@ -3987,7 +3987,7 @@ void LoadArtworkInfo(void) { LoadArtworkInfoCache(); - DrawInitText("Looking for custom artwork", 120, FC_GREEN); + DrawInitTextHead("Looking for custom artwork"); LoadArtworkInfoFromArtworkDir(&artwork.gfx_first, NULL, options.graphics_directory, @@ -4122,7 +4122,7 @@ static void LoadArtworkInfoFromLevelInfoExt(ArtworkDirTree **artwork_node, setArtworkInfoCacheEntry(artwork_new, level_node, type); } - DrawInitText(level_node->name, 150, FC_YELLOW); + DrawInitTextItem(level_node->name); if (level_node->node_group != NULL) { @@ -4191,7 +4191,7 @@ void LoadLevelArtworkInfo(void) { print_timestamp_init("LoadLevelArtworkInfo"); - DrawInitText("Looking for custom level artwork", 120, FC_GREEN); + DrawInitTextHead("Looking for custom level artwork"); print_timestamp_time("DrawTimeText"); diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 2375c06f..d7ec9504 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -619,7 +619,7 @@ static void LoadCustomMusic_NoConf(void) } if (draw_init_text) - DrawInitText("Loading music", 120, FC_GREEN); + DrawInitTextHead("Loading music"); while ((dir_entry = readDirectory(dir)) != NULL) // loop all entries { @@ -644,7 +644,7 @@ static void LoadCustomMusic_NoConf(void) continue; if (draw_init_text) - DrawInitText(basename, 150, FC_YELLOW); + DrawInitTextItem(basename); if (FileIsMusic(dir_entry->filename)) mus_info = Load_WAV_or_MOD(dir_entry->filename); diff --git a/src/libgame/text.c b/src/libgame/text.c index c10583d3..3fb6ab06 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -159,6 +159,16 @@ void DrawInitText(char *text, int ypos, int font_nr) } } +void DrawInitTextHead(char *text) +{ + DrawInitText(text, 120, FC_GREEN); +} + +void DrawInitTextItem(char *text) +{ + DrawInitText(text, 150, FC_YELLOW); +} + void DrawTextF(int x, int y, int font_nr, char *format, ...) { char buffer[MAX_OUTPUT_LINESIZE + 1]; diff --git a/src/libgame/text.h b/src/libgame/text.h index 26df7816..407cb31a 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -92,6 +92,8 @@ void getFontCharSource(int, char, Bitmap **, int *, int *); int maxWordLengthInRequestString(char *); void DrawInitText(char *, int, int); +void DrawInitTextHead(char *); +void DrawInitTextItem(char *); void DrawTextF(int, int, int, char *, ...); void DrawTextFCentered(int, int, char *, ...);