Menu-FN: Add support for gameinfo_introvideo, check for gameinfo_pkgfile

to determine if a file exists before force-opening the update page.
This commit is contained in:
Marco Cawthorne 2021-02-17 11:17:28 +01:00
parent 3037d38b9a
commit 40bbca0dc4
5 changed files with 86 additions and 76 deletions

View File

@ -34,26 +34,26 @@ Colors_RGB8_to_HEX(vector color)
float b = rint(color[i] * 15);
switch (b) {
case 10:
a = "A";
break;
case 11:
a = "B";
break;
case 12:
a = "C";
break;
case 13:
a = "D";
break;
case 14:
a = "E";
break;
case 15:
a = "F";
break;
default:
a = ftos(b);
case 10:
a = "A";
break;
case 11:
a = "B";
break;
case 12:
a = "C";
break;
case 13:
a = "D";
break;
case 14:
a = "E";
break;
case 15:
a = "F";
break;
default:
a = ftos(b);
}
out = sprintf("%s%s", out, a);
}
@ -75,7 +75,7 @@ Colors_Init(void)
filestream fs_colors;
/* Defaults */
col_help = [127,127,127] / 255;
col_help = [127,127,127] / 255;
col_prompt_bg = [56,56,56] / 255;
col_prompt_text = [240,180,24] / 255;
col_prompt_title = [255,255,255] / 255;
@ -105,31 +105,31 @@ Colors_Init(void)
}
coltmp = [stof(argv(1)),stof(argv(2)),stof(argv(3))] / 255;
switch(argv(0)) {
case "HELP_COLOR":
case "HELP_COLOR":
col_help = coltmp;
break;
case "PROMPT_BG_COLOR":
case "PROMPT_BG_COLOR":
col_prompt_bg = coltmp;
break;
case "PROMPT_TEXT_COLOR":
case "PROMPT_TEXT_COLOR":
col_prompt_text = coltmp;
break;
case "PROMPT_TITLE_COLOR":
case "PROMPT_TITLE_COLOR":
col_prompt_title = coltmp;
break;
case "INPUT_TEXT_COLOR":
case "INPUT_TEXT_COLOR":
col_input_text = coltmp;
break;
case "INPUT_BG_COLOR":
case "INPUT_BG_COLOR":
col_input_bg = coltmp;
break;
case "REFRESH_TITLE_COLOR":
case "REFRESH_TITLE_COLOR":
col_refresh_title = coltmp;
break;
case "REFRESH_TEXT_COLOR":
case "REFRESH_TEXT_COLOR":
col_refresh_text = coltmp;
break;
case "REFRESH_BG_COLOR":
case "REFRESH_BG_COLOR":
col_refresh_bg = coltmp;
break;
}

View File

@ -17,12 +17,12 @@
var int autocvar_menu_intro = TRUE;
var int autocvar__menu_singleplayer;
#define KEY_UNKNOWN -1
#define KEY_GAME 0
#define KEY_MENU 2
#define KEY_UNKNOWN -1
#define KEY_GAME 0
#define KEY_MENU 2
#define KEY_MENU_GRABBED 3
#define TARGET_MENU 1
#define TARGET_MENU 1
#define TARGET_CLIENT 2
enumflags

View File

@ -117,13 +117,22 @@ m_init(void)
Music_MenuStart();
}
if (game_updateinstallcount() == 0 || autocvar_menu_updating) {
if (!whichpack(cvar_string("gameinfo_pkgfile")) || autocvar_menu_updating) {
/* reload in case of video restarts? */
shaderforname("logo_avi", "{\n{\nvideomap av:media/logo.avi\n}\n}");
g_menupage = PAGE_UPDATES;
}
Menu_AutoScale();
Menu_GammaHack();
if (g_intro_stage == 0) {
string videofile = cvar_string("gameinfo_introvideo");
if (videofile) {
localcmd(strcat("playvideo ", videofile, "\n"));
}
}
}
/* called upon vid_reload, vid_restart, but not menu init/restart */
@ -240,21 +249,21 @@ float
Menu_InputEvent(float evtype, float scanx, float chary, float devid)
{
switch (evtype) {
case IE_KEYDOWN:
if (chary == K_ESCAPE) {
if (clientstate() == 2 && !g_background) {
m_toggle(0);
}
case IE_KEYDOWN:
if (chary == K_ESCAPE) {
if (clientstate() == 2 && !g_background) {
m_toggle(0);
}
break;
case IE_MOUSEABS:
g_mousepos[0] = scanx;
g_mousepos[1] = chary;
break;
case IE_MOUSEDELTA:
g_mousepos[0] += scanx;
g_mousepos[1] += chary;
break;
}
break;
case IE_MOUSEABS:
g_mousepos[0] = scanx;
g_mousepos[1] = chary;
break;
case IE_MOUSEDELTA:
g_mousepos[0] += scanx;
g_mousepos[1] += chary;
break;
}
main_input(evtype, scanx, chary, devid);
@ -304,32 +313,32 @@ m_consolecommand(string cmd)
{
tokenize(cmd);
switch (argv(0)) {
case "menu_musicstart":
Music_MenuStart();
break;
case "menu_musictrack":
Music_ParseTrack(argv(1));
break;
case "menu_musicloop":
Music_ParseLoop(argv(1));
break;
case "menu_updates":
g_menupage = PAGE_UPDATES;
m_intro_skip();
break;
case "menu_customgame":
g_menupage = PAGE_CUSTOMGAME;
m_intro_skip();
break;
case "togglemenu":
m_display();
break;
case "map_background":
localcmd(sprintf("maxplayers 2\nset coop 1\nset sv_background 1\nmap %s\n",
argv(1)));
break;
default:
return FALSE;
case "menu_musicstart":
Music_MenuStart();
break;
case "menu_musictrack":
Music_ParseTrack(argv(1));
break;
case "menu_musicloop":
Music_ParseLoop(argv(1));
break;
case "menu_updates":
g_menupage = PAGE_UPDATES;
m_intro_skip();
break;
case "menu_customgame":
g_menupage = PAGE_CUSTOMGAME;
m_intro_skip();
break;
case "togglemenu":
m_display();
break;
case "map_background":
localcmd(sprintf("maxplayers 2\nset coop 1\nset sv_background 1\nmap %s\n",
argv(1)));
break;
default:
return FALSE;
}
return TRUE;
}

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any

View File

@ -30,6 +30,7 @@ void
m_intro_skip(void)
{
g_intro_progress = INTRO_TIME;
g_intro_stage = INTRO_DONE;
}
void