Display proper build date on MAIN MENU

This commit is contained in:
cypress 2023-07-22 15:41:20 -04:00
parent 9dda9b48ef
commit d268560beb

View file

@ -40,6 +40,8 @@ extern char* loadname2;
extern char* loadnamespec; extern char* loadnamespec;
extern qboolean loadscreeninit; extern qboolean loadscreeninit;
char* game_build_date;
// Backgrounds // Backgrounds
qpic_t *menu_bk; qpic_t *menu_bk;
@ -391,6 +393,9 @@ void M_Main_Draw (void)
menu_bk = Draw_CachePic("gfx/menu/menu_background"); menu_bk = Draw_CachePic("gfx/menu/menu_background");
Draw_Pic (0, 0, menu_bk); Draw_Pic (0, 0, menu_bk);
// Version String
Draw_ColoredString((vid.width - (strlen(game_build_date) * 8)) + 4, 5, game_build_date, 255, 255, 255, 255, 1);
char *MAIN_MENU_ITEMS[MAIN_ITEMS]; char *MAIN_MENU_ITEMS[MAIN_ITEMS];
MAIN_MENU_ITEMS[0] = "Single Player"; MAIN_MENU_ITEMS[0] = "Single Player";
MAIN_MENU_ITEMS[1] = "Multi Player"; MAIN_MENU_ITEMS[1] = "Multi Player";
@ -832,7 +837,7 @@ void M_Menu_CustomMaps_Draw (void)
Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102); Draw_FillByColor(0, 0, 480, 272, 0, 0, 0, 102);
// Version String // Version String
Draw_ColoredString(vid.width - 40, 5, "v1.0", 255, 255, 255, 255, 1); Draw_ColoredString((vid.width - (strlen(game_build_date) * 8)) + 4, 5, game_build_date, 255, 255, 255, 255, 1);
// Header // Header
Draw_ColoredString(10, 10, "CUSTOM MAPS", 255, 255, 255, 255, 2); Draw_ColoredString(10, 10, "CUSTOM MAPS", 255, 255, 255, 255, 2);
@ -2010,6 +2015,25 @@ void M_Init (void)
Cmd_AddCommand ("menu_video", M_Menu_Video_f); Cmd_AddCommand ("menu_video", M_Menu_Video_f);
Cmd_AddCommand ("menu_quit", M_Menu_Quit_f); Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
// Snag the game version
long length;
FILE* f = fopen(va("%s/version.txt", com_gamedir), "rb");
if (f)
{
fseek (f, 0, SEEK_END);
length = ftell (f);
fseek (f, 0, SEEK_SET);
game_build_date = malloc(length);
if (game_build_date)
fread (game_build_date, 1, length, f);
fclose (f);
} else {
game_build_date = "version.txt not found.";
}
Map_Finder(); Map_Finder();
} }