Menu: Switch to the new manifest based mod/game info stuff

This commit is contained in:
Marco Cawthorne 2020-04-01 12:27:45 +02:00
parent 3058015aa0
commit 5dde0fb486
13 changed files with 118 additions and 117 deletions

View file

@ -1,8 +0,0 @@
game "Counter-Strike"
nohimodel "1"
nomodels "1"
size "184000000"
trainmap "tr_1"
type "multiplayer_only"
url_info "www.counter-strike.net"
version "1.5"

View file

@ -6,3 +6,21 @@ basegame logos
basegame valve
disablehomedir 1
rtcbroker master.frag-net.com:27950
// hastily converted
-seta gameinfo_game "Nuclide"
-seta gameinfo_gamedir "valve"
-seta gameinfo_fallback_dir ""
-seta gameinfo_mpentity "info_player_deathmatch"
-seta gameinfo_size "496200000"
-seta gameinfo_url_info "www.icculus.org/~marco/"
-seta gameinfo_version "1.0"
-seta gameinfo_url_dl ""
-seta gameinfo_type ""
-seta gameinfo_nomodels 0
-seta gameinfo_gamedll "progs.dat"
-seta gameinfo_startmap "c0a0"
-seta gameinfo_trainingmap "t0a0"
-seta gameinfo_cldll 1
-seta gameinfo_hlversion "1110"
-seta gameinfo_svonly "0"

View file

@ -1,8 +0,0 @@
gamedir "gearbox"
game "Opposing Force"
size "96000000"
startmap "of0a0"
trainmap "ofboot0"
type "Single"
url_info "www.gearboxsoftware.com"
version "1"

View file

@ -1,6 +0,0 @@
game "They Hunger"
url_info "www.planethalflife.com/manke"
version "3.0"
size "142600000"
startmap "thintro"
trainmap "they30"

View file

@ -1,11 +0,0 @@
game "Poke646"
url_info "www.poke646.com"
url_dl ""
version "1.0"
startmap "po_intro"
trainmap "po_haz01"
type "singleplayer_only"
svonly "0"
cldll "1"
nomodels "0"
size "123055258"

View file

@ -1,7 +0,0 @@
game "Scientist Hunt"
mpentity "info_player_deathmatch"
size "800000"
startmap "c1a0"
type "multiplayer_only"
url_info "www.richwhitehouse.com"
version "1.0"

View file

@ -58,7 +58,7 @@ void cr_btndone_start(void)
static void cr_btndone_end(void) {
g_menupage = PAGE_MULTIPLAYER;
}
cr_closeconnection();
//cr_closeconnection();
localsound("../media/launch_dnmenu1.wav");
header.SetStartEndPos(45,45,50,239);
header.SetStartEndSize(460,80,156,26);
@ -85,7 +85,7 @@ void cr_btnlistrooms_start(void)
/* 'Done' button */
void cr_btnservers_prepare(void)
{
cr_closeconnection();
//cr_closeconnection();
cr_btnservers_start();
}
@ -174,13 +174,6 @@ void menu_chatrooms_draw(void)
int tab_id;
string tmp;
/* establish the connection */
if (!g_iIRCActive) {
cr_makeconnection();
g_iIRCActive = TRUE;
g_irc.timer = 10.0f;
}
Widget_Draw(fn_chatrooms);
drawpic([g_menuofs[0]+550,g_menuofs[1]+10], "gfx/shell/fragnet",[80,80], [1,1,1], 1.0f, 0);
@ -210,6 +203,13 @@ void menu_chatrooms_draw(void)
}
g_irc.cur_tab = g_irc.show_tab;
/* establish the connection if nothing is found */
if (!g_iIRCActive && !g_irc.show_tab) {
cr_makeconnection();
g_iIRCActive = TRUE;
g_irc.timer = 10.0f;
}
/* draw the irc-log buffer when ready */
if (g_irc.show_tab) {
drawsetcliparea(g_menuofs[0] + 33, g_menuofs[1] + 104, 450,331);

View file

@ -31,6 +31,11 @@ void games_init(void)
gameinfo_count = 0;
for (id = 0; (gamedirname = getgamedirinfo(id, 0)); id++) {
/* skip any manifest (or modinfo) without cvars setting things */
if (getgamedirinfo(id, 2) == "") {
continue;
}
gameinfo_count++;
}
@ -43,7 +48,13 @@ void games_init(void)
games = memalloc(sizeof(gameinfo_t) * gameinfo_count);
for (id = 0; (gamedirname = getgamedirinfo(id, 0)); id++) {
gamedescription = getgamedirinfo(id, 1);
gamedescription = getgamedirinfo(id, 2);
/* CONT: skip any manifest (or modinfo) without cvars setting things */
if (gamedescription == "") {
continue;
}
county = tokenize_console(gamedescription);
/* Fill in the defaults */
@ -64,55 +75,54 @@ void games_init(void)
games[id].svonly = 0;
games[id].installed = 1;
for ( int i = 0; i < county; i+=2 ) {
for ( int i = 0; i < county; i++ ) {
switch( argv(i) ) {
case "game":
case "gameinfo_game":
games[id].game = argv(i+1);
break;
case "gamedir":
case "gameinfo_gamedir":
games[id].gamedir = argv(i+1);
break;
case "fallback_dir":
case "gameinfo_fallback_dir":
games[id].fallback_dir = argv(i+1);
break;
case "url_info":
case "gameinfo_url_info":
games[id].url_info = argv(i+1);
break;
case "url_dl":
case "gameinfo_url_dl":
games[id].url_dl = argv(i+1);
break;
case "version":
case "gameinfo_version":
games[id].version = argv(i+1);
break;
case "size":
games[id].size = stof(argv(i+1));
case "gameinfo_size":
games[id].size = (int)stof(argv(i+1));
break;
case "svonly":
games[id].svonly = stof(argv(i+1));
case "gameinfo_svonly":
games[id].svonly = (int)stof(argv(i+1));
break;
case "cldll":
games[id].cldll = stof(argv(i+1));
case "gameinfo_cldll":
games[id].cldll = (int)stof(argv(i+1));
break;
case "type":
case "gameinfo_type":
games[id].type = argv(i+1);
break;
case "hlversion":
case "gameinfo_hlversion":
games[id].hlversion = argv(i+1);
break;
case "nomodels":
games[id].nomodels = stof(argv(i+1));
case "gameinfo_nomodels":
games[id].nomodels = (int)stof(argv(i+1));
break;
case "mpentity":
case "gameinfo_mpentity":
games[id].mpentity = argv(i+1);
break;
case "gamedll":
case "gameinfo_gamedll":
games[id].gamedll = argv(i+1);
break;
case "startmap":
case "gameinfo_startmap":
games[id].startmap = argv(i+1);
break;
case "trainingmap":
case "trainmap":
case "gameinfo_trainingmap":
games[id].trainingmap = argv(i+1);
break;
default:
@ -164,7 +174,8 @@ void customgame_btnactivate_start(void)
void customgame_btninstall_start(void)
{
int gid = customgame_lbMods.GetSelected();
localcmd(sprintf("fs_changegame %s\n", games[gid].url_dl));
print(sprintf("Requesting download for http://www.frag-net.com/mods/%s.fmf...\n", games[gid].gamedir));
localcmd(sprintf("fs_changegame http://www.frag-net.com/mods/%s.fmf\n", games[gid].game));
}
void customgame_btndeactivate_start(void)
{

View file

@ -119,7 +119,11 @@ void menu_customize_init(void)
cz_psSpray.SetCallback(cz_cbSprayChanged);
cz_psSpray.SetValueS(cvar_string("_cl_playerspray"));
Widget_Add(fn_customize, cz_psSpray);
if (games[gameinfo_current].nomodels == 1) {
return;
}
cz_psModel = spawn(CPictureSwitch);
cz_psModel.SetPos(410,160);
cz_psModel.SetSize(170,221);

View file

@ -26,7 +26,13 @@ void*
memrealloc(__variant *oldptr, int elementsize, int old_num, int new_num)
{
void *n = memalloc(elementsize * new_num);
memcpy(n, oldptr, elementsize * min(old_num, new_num));
if (!n) {
print("^1memrealloc^7: Out of memory\n");
return 0;
}
memcpy(n, oldptr, elementsize * old_num);
memfree(oldptr);
return n;
}
@ -64,7 +70,7 @@ ModServer_ParseList(string data)
}
print(sprintf("^2ModServer_ParseList^7: Querying mod-data for %s\n", gamedir));
uri_get(sprintf("http://www.frag-net.com/mods/%s.txt",gamedir), 101);
uri_get(sprintf("http://www.frag-net.com/mods/%s.fmf",uri_escape(gamedir)), MODSERVER_REQ_ITEM);
finalcount++;
}
@ -109,55 +115,54 @@ ModServer_ParseItem(string data)
games[id].svonly = 0;
games[id].installed = 0;
for (int i = 0; i < c; i+=2) {
for (int i = 0; i < c; i++) {
switch( argv(i) ) {
case "game":
case "gameinfo_game":
games[id].game = argv(i+1);
break;
case "gamedir":
case "gameinfo_gamedir":
games[id].gamedir = argv(i+1);
break;
case "fallback_dir":
case "gameinfo_fallback_dir":
games[id].fallback_dir = argv(i+1);
break;
case "url_info":
case "gameinfo_url_info":
games[id].url_info = argv(i+1);
break;
case "url_dl":
case "gameinfo_url_dl":
games[id].url_dl = argv(i+1);
break;
case "version":
case "gameinfo_version":
games[id].version = argv(i+1);
break;
case "size":
case "gameinfo_size":
games[id].size = stof(argv(i+1));
break;
case "svonly":
case "gameinfo_svonly":
games[id].svonly = stof(argv(i+1));
break;
case "cldll":
case "gameinfo_cldll":
games[id].cldll = stof(argv(i+1));
break;
case "type":
case "gameinfo_type":
games[id].type = argv(i+1);
break;
case "hlversion":
case "gameinfo_hlversion":
games[id].hlversion = argv(i+1);
break;
case "nomodels":
case "gameinfo_nomodels":
games[id].nomodels = stof(argv(i+1));
break;
case "mpentity":
case "gameinfo_mpentity":
games[id].mpentity = argv(i+1);
break;
case "gamedll":
case "gameinfo_gamedll":
games[id].gamedll = argv(i+1);
break;
case "startmap":
case "gameinfo_startmap":
games[id].startmap = argv(i+1);
break;
case "trainingmap":
case "trainmap":
case "gameinfo_trainingmap":
games[id].trainingmap = argv(i+1);
break;
default:

View file

@ -70,8 +70,10 @@ void CModList::Draw(void)
}
if (games[i].type != "") {
WLabel_Static(m_x + 2, pos + 3, sprintf("%.8s...",games[i].type),
drawsetcliparea(g_menuofs[0] + m_x + 2, g_menuofs[1] + pos + 3, 50,30);
WLabel_Static(m_x + 2, pos + 3, games[i].type,
11, 11, colo, 1.0f, 0, font_arial);
drawresetcliparea();
}
/* Game */
@ -92,15 +94,29 @@ void CModList::Draw(void)
/* Rating */
WLabel_Static(m_x + 277, pos + 3, "0.0", 11, 11, colo,
1.0f, 0, font_arial);
/* Installed */
WLabel_Static(m_x + 327, pos + 3, (games[i].installed == 1) ? "Yes" : "No", 11, 11, ML_COL_3,
1.0f, 0, font_arial);
/* Servers */
WLabel_Static(m_x + 377, pos + 3, "0", 11, 11, ML_COL_3,
1.0f, 0, font_arial);
/* Players */
WLabel_Static(m_x + 427, pos + 3, "0", 11, 11, ML_COL_3,
1.0f, 0, font_arial);
if (games[i].installed == 1) {
/* Installed */
WLabel_Static(m_x + 327, pos + 3, "Yes", 11, 11, ML_COL_3,
1.0f, 0, font_arial);
/* Servers */
WLabel_Static(m_x + 377, pos + 3, "0", 11, 11, ML_COL_3,
1.0f, 0, font_arial);
/* Players */
WLabel_Static(m_x + 427, pos + 3, "0", 11, 11, ML_COL_3,
1.0f, 0, font_arial);
} else {
/* Installed */
WLabel_Static(m_x + 327, pos + 3, "No", 11, 11, ML_COL_4,
1.0f, 0, font_arial);
/* Servers */
WLabel_Static(m_x + 377, pos + 3, "0", 11, 11, ML_COL_4,
1.0f, 0, font_arial);
/* Players */
WLabel_Static(m_x + 427, pos + 3, "0", 11, 11, ML_COL_4,
1.0f, 0, font_arial);
}
pos += 29;
}
}

View file

@ -1,8 +0,0 @@
game "Team Fortress"
mpentity "info_tfdetect"
nomodels "1"
size "37000000"
type "multiplayer_only"
url_dl ""
url_info "www.teamfortressclassic.com"
version "1.5"

View file

@ -1,5 +0,0 @@
game "Half-Life"
mpentity "info_player_deathmatch"
size "496200000"
url_info "www.valvesoftware.com"
version "1.0"