Menu-FN: set create-server maxplayers to 8 when cvar is at 1, search pak
archives in reverse for liblist etc. files to ensure we read the latest + more fixes
This commit is contained in:
parent
0ca3d03927
commit
3ca7b5451c
3 changed files with 28 additions and 12 deletions
|
@ -118,9 +118,14 @@ menu_creategame_init(void)
|
||||||
create_tbMaxplayers = spawn(CTextBox);
|
create_tbMaxplayers = spawn(CTextBox);
|
||||||
create_tbMaxplayers.SetPos(216,226);
|
create_tbMaxplayers.SetPos(216,226);
|
||||||
create_tbMaxplayers.m_length = 156;
|
create_tbMaxplayers.m_length = 156;
|
||||||
create_tbMaxplayers.SetText(cvar_string("sv_playerslots"));
|
|
||||||
Widget_Add(fn_createshared, create_tbMaxplayers);
|
Widget_Add(fn_createshared, create_tbMaxplayers);
|
||||||
|
|
||||||
|
/* if it's 1, that means we recently played a SP game, reset to default for now */
|
||||||
|
if (cvar("sv_playerslots") <= 1)
|
||||||
|
create_tbMaxplayers.SetText("8");
|
||||||
|
else
|
||||||
|
create_tbMaxplayers.SetText(cvar_string("sv_playerslots"));
|
||||||
|
|
||||||
create_tbPassword = spawn(CTextBox);
|
create_tbPassword = spawn(CTextBox);
|
||||||
create_tbPassword.SetPos(216,280);
|
create_tbPassword.SetPos(216,280);
|
||||||
create_tbPassword.m_length = 156;
|
create_tbPassword.m_length = 156;
|
||||||
|
|
|
@ -178,18 +178,20 @@ customgame_liblist_parse(int id, string strKey, string strValue)
|
||||||
switch (strtolower(strValue)) {
|
switch (strtolower(strValue)) {
|
||||||
case "multiplayer_only":
|
case "multiplayer_only":
|
||||||
case "multiplayer only":
|
case "multiplayer only":
|
||||||
case "mp":
|
|
||||||
case "multi":
|
|
||||||
case "multiplayer":
|
|
||||||
games[id].type = "Multiplayer";
|
games[id].type = "Multiplayer";
|
||||||
break;
|
break;
|
||||||
case "singleplayer_only":
|
case "singleplayer_only":
|
||||||
case "singleplayer only":
|
case "singleplayer only":
|
||||||
|
games[id].type = "Singleplayer";
|
||||||
|
break;
|
||||||
|
/* this... kind of sucks, but some games (gearbox) never updated
|
||||||
|
* their liblist to reflect that they do multiplayer */
|
||||||
case "sp":
|
case "sp":
|
||||||
case "single":
|
case "single":
|
||||||
case "singleplayer":
|
case "singleplayer":
|
||||||
games[id].type = "Singleplayer";
|
case "mp":
|
||||||
break;
|
case "multi":
|
||||||
|
case "multiplayer":
|
||||||
default:
|
default:
|
||||||
games[id].type = "Both";
|
games[id].type = "Both";
|
||||||
}
|
}
|
||||||
|
@ -262,9 +264,13 @@ games_find_in_gamedir(string filename, string gamedirname)
|
||||||
/* let's search for every pk3 in the gamedir and search for a liblist, one at a time. */
|
/* let's search for every pk3 in the gamedir and search for a liblist, one at a time. */
|
||||||
psh = search_begin("*.pk3", SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, gamedirname);
|
psh = search_begin("*.pk3", SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, gamedirname);
|
||||||
|
|
||||||
/* loop through each pk3 */
|
/* loop through each pk3 in reverse (newest to old) */
|
||||||
for (int i = 0; i < search_getsize(psh); i++) {
|
for (int i = search_getsize(psh); i >= 0; i--) {
|
||||||
string full = search_getfilename(psh, i);
|
string full = search_getfilename(psh, i);
|
||||||
|
|
||||||
|
if (!full)
|
||||||
|
continue;
|
||||||
|
|
||||||
sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, strcat(gamedirname, "/", full));
|
sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, strcat(gamedirname, "/", full));
|
||||||
fh = search_fopen(sh, 0);
|
fh = search_fopen(sh, 0);
|
||||||
|
|
||||||
|
@ -277,12 +283,16 @@ games_find_in_gamedir(string filename, string gamedirname)
|
||||||
|
|
||||||
/* still nothing. let's search for pk4's to sift through */
|
/* still nothing. let's search for pk4's to sift through */
|
||||||
if (fh < 0) {
|
if (fh < 0) {
|
||||||
/* let's search for every pk3 in the gamedir and search for a liblist, one at a time. */
|
/* let's search for every pk4 in the gamedir and search for a liblist, one at a time. */
|
||||||
psh = search_begin("*.pk4", SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, gamedirname);
|
psh = search_begin("*.pk4", SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, gamedirname);
|
||||||
|
|
||||||
/* loop through each pk3 */
|
/* loop through each pk4 in reverse (newest to old) */
|
||||||
for (int i = 0; i < search_getsize(psh); i++) {
|
for (int i = search_getsize(psh); i >= 0; i--) {
|
||||||
string full = search_getfilename(psh, i);
|
string full = search_getfilename(psh, i);
|
||||||
|
|
||||||
|
if (!full)
|
||||||
|
continue;
|
||||||
|
|
||||||
sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, strcat(gamedirname, "/", full));
|
sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, strcat(gamedirname, "/", full));
|
||||||
fh = search_fopen(sh, 0);
|
fh = search_fopen(sh, 0);
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,8 @@ menu_main_init(void)
|
||||||
main_btn2Multiplayer = spawn(CMainButton);
|
main_btn2Multiplayer = spawn(CMainButton);
|
||||||
main_btn2Multiplayer.SetImage(BTN_MULTIPLAYER);
|
main_btn2Multiplayer.SetImage(BTN_MULTIPLAYER);
|
||||||
main_btn2Multiplayer.SetPos(70,348);
|
main_btn2Multiplayer.SetPos(70,348);
|
||||||
main_btn2Multiplayer.SetExecute(btn_multiplayer_start);
|
if (games[gameinfo_current].type != "Singleplayer")
|
||||||
|
main_btn2Multiplayer.SetExecute(btn_multiplayer_start);
|
||||||
Widget_Add(fn_main2, main_btn2Multiplayer);
|
Widget_Add(fn_main2, main_btn2Multiplayer);
|
||||||
|
|
||||||
/* Custom game */
|
/* Custom game */
|
||||||
|
|
Loading…
Reference in a new issue