Menu-FN: Add proper caching (non-CVAR based) for pkgfile and introvideo

manifest info. This avoids the headache of engine threading getting in the
way and messing up package manager and what have you on ~some~ systems
This commit is contained in:
Marco Cawthorne 2021-03-06 00:23:59 +01:00
parent 7dae291f31
commit 7dcebd140d
5 changed files with 13 additions and 5 deletions

View File

@ -1,5 +1,4 @@
CC=fteqcc
all:
mkdir -p ../../platform/data.pk3dir
$(CC) progs.src

View File

@ -74,6 +74,7 @@ typedef struct
string type;
string hlversion;
string pkgname;
string pkgfile;
int pkgid;
int nomodels;
int nosprays;
@ -84,6 +85,7 @@ typedef struct
string trainingmap;
string fallback_dir;
string chatroom;
string introvideo;
} gameinfo_t;
var int gameinfo_current = -1;

View File

@ -112,12 +112,13 @@ m_init(void)
Strings_Init();
g_initialized = TRUE;
if (cvar_string("gameinfo_gamedir") != "valve") {
if (games[gameinfo_current].gamedir != "valve") {
m_intro_skip();
Music_MenuStart();
}
if (!whichpack(cvar_string("gameinfo_pkgfile")) || autocvar_menu_updating) {
if (games[gameinfo_current].pkgfile != "")
if (!whichpack(games[gameinfo_current].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;
@ -127,7 +128,7 @@ m_init(void)
Menu_GammaHack();
if (g_intro_stage == 0) {
string videofile = cvar_string("gameinfo_introvideo");
string videofile = games[gameinfo_current].introvideo;
if (videofile) {
localcmd(strcat("playvideo ", videofile, "\n"));

View File

@ -319,12 +319,18 @@ games_init(void)
games[id].pkgname = argv(i+1);
games[id].pkgid = game_getpackageid(games[id].pkgname);
break;
case "gameinfo_pkgfile":
games[id].pkgfile = argv(i+1);
break;
case "gameinfo_chatroom":
games[id].chatroom = argv(i+1);
break;
case "gameinfo_readme":
games[id].readme = argv(i+1);
break;
case "gameinfo_introvideo":
games[id].introvideo = argv(i+1);
break;
default:
break;
}

View File

@ -1,5 +1,5 @@
#pragma target fte
#pragma progs_dat "../../platform/data.pk3dir/menu.dat"
#pragma progs_dat "../../platform/menu.dat"
#define MENU
#includelist