2019-03-13 19:20:07 +00:00
|
|
|
/*
|
2020-06-04 21:01:28 +00:00
|
|
|
===========================================================================
|
2019-03-13 19:20:07 +00:00
|
|
|
Copyright (C) 1997-2001 Id Software, Inc.
|
|
|
|
|
2020-06-04 21:01:28 +00:00
|
|
|
This file is part of Quake 2 source code.
|
2019-03-13 19:20:07 +00:00
|
|
|
|
2020-06-04 21:01:28 +00:00
|
|
|
Quake 2 source code is free software; you can redistribute it
|
|
|
|
and/or modify it under the terms of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation; either version 2 of the License,
|
|
|
|
or (at your option) any later version.
|
2019-03-13 19:20:07 +00:00
|
|
|
|
2020-06-04 21:01:28 +00:00
|
|
|
Quake 2 source code is distributed in the hope that it will be
|
|
|
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2019-03-13 19:20:07 +00:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2020-06-04 21:01:28 +00:00
|
|
|
along with Quake 2 source code; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
===========================================================================
|
2019-03-13 19:20:07 +00:00
|
|
|
*/
|
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
// menu_mp_download.c -- the autodownload options menu
|
2019-03-13 19:20:07 +00:00
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <io.h>
|
|
|
|
#endif
|
|
|
|
#include "../client/client.h"
|
|
|
|
#include "ui_local.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============================================================================
|
|
|
|
|
|
|
|
DOWNLOAD OPTIONS BOOK MENU
|
|
|
|
|
|
|
|
=============================================================================
|
|
|
|
*/
|
|
|
|
static menuframework_s s_downloadoptions_menu;
|
|
|
|
|
|
|
|
static menuseparator_s s_download_title;
|
|
|
|
static menulist_s s_allow_download_box;
|
|
|
|
|
|
|
|
#ifdef USE_CURL // HTTP downloading from R1Q2
|
|
|
|
static menulist_s s_allow_http_download_box;
|
2020-05-05 01:24:51 +00:00
|
|
|
static menulist_s s_allow_http_fallback_box;
|
2019-03-13 19:20:07 +00:00
|
|
|
#endif // USE_CURL
|
|
|
|
|
|
|
|
static menulist_s s_allow_download_maps_box;
|
|
|
|
static menulist_s s_allow_download_textures_24bit_box; // option to allow downloading 24-bit textures
|
|
|
|
static menulist_s s_allow_download_models_box;
|
|
|
|
static menulist_s s_allow_download_players_box;
|
|
|
|
static menulist_s s_allow_download_sounds_box;
|
|
|
|
|
|
|
|
static menuaction_s s_download_back_action;
|
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
static void DownloadCallback (void *self)
|
2019-03-13 19:20:07 +00:00
|
|
|
{
|
2021-08-12 19:30:51 +00:00
|
|
|
menulist_s *f = (menulist_s *) self;
|
2019-03-13 19:20:07 +00:00
|
|
|
|
|
|
|
if (f == &s_allow_download_box)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("allow_download", f->curvalue);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USE_CURL // HTTP downloading from R1Q2
|
|
|
|
if (f == &s_allow_http_download_box)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("cl_http_downloads", f->curvalue);
|
|
|
|
}
|
2020-05-05 01:24:51 +00:00
|
|
|
else if (f == &s_allow_http_fallback_box)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("cl_http_fallback", f->curvalue);
|
|
|
|
}
|
2019-03-13 19:20:07 +00:00
|
|
|
#endif // USE_CURL
|
|
|
|
|
|
|
|
else if (f == &s_allow_download_maps_box)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("allow_download_maps", f->curvalue);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Knightmare- option to allow downloading 24-bit textures
|
|
|
|
else if (f == &s_allow_download_textures_24bit_box)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("allow_download_textures_24bit", f->curvalue);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (f == &s_allow_download_models_box)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("allow_download_models", f->curvalue);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (f == &s_allow_download_players_box)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("allow_download_players", f->curvalue);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (f == &s_allow_download_sounds_box)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("allow_download_sounds", f->curvalue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
void Menu_DownloadOptions_Init (void)
|
2019-03-13 19:20:07 +00:00
|
|
|
{
|
|
|
|
static const char *yes_no_names[] =
|
|
|
|
{
|
2020-04-16 07:18:49 +00:00
|
|
|
"no",
|
|
|
|
"yes",
|
|
|
|
0
|
2019-03-13 19:20:07 +00:00
|
|
|
};
|
2020-04-16 07:18:49 +00:00
|
|
|
|
|
|
|
// int y = 0;
|
|
|
|
int y = 3*MENU_LINE_SIZE;
|
2019-03-13 19:20:07 +00:00
|
|
|
|
|
|
|
s_downloadoptions_menu.x = SCREEN_WIDTH*0.5;
|
2020-04-16 07:18:49 +00:00
|
|
|
s_downloadoptions_menu.y = SCREEN_HEIGHT*0.5 - 58;
|
2019-03-13 19:20:07 +00:00
|
|
|
// s_downloadoptions_menu.x = viddef.width * 0.50;
|
|
|
|
// s_downloadoptions_menu.y = 0;
|
|
|
|
s_downloadoptions_menu.nitems = 0;
|
|
|
|
|
2020-04-16 07:18:49 +00:00
|
|
|
s_download_title.generic.type = MTYPE_SEPARATOR;
|
|
|
|
s_download_title.generic.textSize = MENU_HEADER_FONT_SIZE;
|
|
|
|
s_download_title.generic.name = "Download Options";
|
2020-07-29 10:05:09 +00:00
|
|
|
s_download_title.generic.x = MENU_HEADER_FONT_SIZE/2 * (int)strlen(s_download_title.generic.name); // was 48
|
2020-04-16 07:18:49 +00:00
|
|
|
s_download_title.generic.y = y - 2.75*MENU_LINE_SIZE; // y
|
|
|
|
|
|
|
|
s_allow_download_box.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_allow_download_box.generic.textSize = MENU_FONT_SIZE;
|
|
|
|
s_allow_download_box.generic.x = 0;
|
|
|
|
s_allow_download_box.generic.y = y += 2*MENU_LINE_SIZE;
|
|
|
|
s_allow_download_box.generic.name = "allow downloading";
|
|
|
|
s_allow_download_box.generic.callback = DownloadCallback;
|
|
|
|
s_allow_download_box.itemnames = yes_no_names;
|
|
|
|
s_allow_download_box.curvalue = (Cvar_VariableValue("allow_download") != 0);
|
2020-05-05 01:24:51 +00:00
|
|
|
s_allow_download_box.generic.statusbar = "enable or disable all downloading";
|
2019-03-13 19:20:07 +00:00
|
|
|
|
|
|
|
#ifdef USE_CURL // HTTP downloading from R1Q2
|
2020-04-16 07:18:49 +00:00
|
|
|
s_allow_http_download_box.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_allow_http_download_box.generic.textSize = MENU_FONT_SIZE;
|
|
|
|
s_allow_http_download_box.generic.x = 0;
|
|
|
|
s_allow_http_download_box.generic.y = y += MENU_LINE_SIZE;
|
|
|
|
s_allow_http_download_box.generic.name = "HTTP downloading";
|
|
|
|
s_allow_http_download_box.generic.callback = DownloadCallback;
|
|
|
|
s_allow_http_download_box.itemnames = yes_no_names;
|
|
|
|
s_allow_http_download_box.curvalue = (Cvar_VariableValue("cl_http_downloads") != 0);
|
2020-05-05 01:24:51 +00:00
|
|
|
s_allow_http_download_box.generic.statusbar = "use HTTP downloading on supported servers";
|
|
|
|
|
|
|
|
s_allow_http_fallback_box.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_allow_http_fallback_box.generic.textSize = MENU_FONT_SIZE;
|
|
|
|
s_allow_http_fallback_box.generic.x = 0;
|
|
|
|
s_allow_http_fallback_box.generic.y = y += MENU_LINE_SIZE;
|
|
|
|
s_allow_http_fallback_box.generic.name = "HTTP fallback";
|
|
|
|
s_allow_http_fallback_box.generic.callback = DownloadCallback;
|
|
|
|
s_allow_http_fallback_box.itemnames = yes_no_names;
|
|
|
|
s_allow_http_fallback_box.curvalue = (Cvar_VariableValue("cl_http_fallback") != 0);
|
|
|
|
s_allow_http_fallback_box.generic.statusbar = "enable to allow HTTP downloads to fall back to Q2Pro path and UDP";
|
2019-03-13 19:20:07 +00:00
|
|
|
#endif // USE_CURL
|
|
|
|
|
2020-04-16 07:18:49 +00:00
|
|
|
s_allow_download_maps_box.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_allow_download_maps_box.generic.textSize = MENU_FONT_SIZE;
|
|
|
|
s_allow_download_maps_box.generic.x = 0;
|
|
|
|
s_allow_download_maps_box.generic.y = y += 2*MENU_LINE_SIZE;
|
|
|
|
s_allow_download_maps_box.generic.name = "maps/textures";
|
|
|
|
s_allow_download_maps_box.generic.callback = DownloadCallback;
|
|
|
|
s_allow_download_maps_box.itemnames = yes_no_names;
|
|
|
|
s_allow_download_maps_box.curvalue = (Cvar_VariableValue("allow_download_maps") != 0);
|
2020-05-05 01:24:51 +00:00
|
|
|
s_allow_download_maps_box.generic.statusbar = "enable to allow downloading of maps and textures";
|
2019-03-13 19:20:07 +00:00
|
|
|
|
|
|
|
// Knightmare- option to allow downloading 24-bit textures
|
|
|
|
s_allow_download_textures_24bit_box.generic.type = MTYPE_SPINCONTROL;
|
2020-04-16 07:18:49 +00:00
|
|
|
s_allow_download_textures_24bit_box.generic.textSize = MENU_FONT_SIZE;
|
2019-03-13 19:20:07 +00:00
|
|
|
s_allow_download_textures_24bit_box.generic.x = 0;
|
|
|
|
s_allow_download_textures_24bit_box.generic.y = y += MENU_LINE_SIZE;
|
|
|
|
s_allow_download_textures_24bit_box.generic.name = "24-bit textures";
|
|
|
|
s_allow_download_textures_24bit_box.generic.callback = DownloadCallback;
|
|
|
|
s_allow_download_textures_24bit_box.generic.statusbar = "enable to allow downloading of JPG and TGA textures";
|
|
|
|
s_allow_download_textures_24bit_box.itemnames = yes_no_names;
|
|
|
|
s_allow_download_textures_24bit_box.curvalue = (Cvar_VariableValue("allow_download_textures_24bit") != 0);
|
2020-05-05 01:24:51 +00:00
|
|
|
s_allow_download_textures_24bit_box.generic.statusbar = "enable to allow downloading of JPG and TGA textures";
|
2019-03-13 19:20:07 +00:00
|
|
|
|
2020-04-16 07:18:49 +00:00
|
|
|
s_allow_download_players_box.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_allow_download_players_box.generic.textSize = MENU_FONT_SIZE;
|
|
|
|
s_allow_download_players_box.generic.x = 0;
|
|
|
|
s_allow_download_players_box.generic.y = y += MENU_LINE_SIZE;
|
|
|
|
s_allow_download_players_box.generic.name = "player models/skins";
|
|
|
|
s_allow_download_players_box.generic.callback = DownloadCallback;
|
|
|
|
s_allow_download_players_box.itemnames = yes_no_names;
|
|
|
|
s_allow_download_players_box.curvalue = (Cvar_VariableValue("allow_download_players") != 0);
|
2020-05-05 01:24:51 +00:00
|
|
|
s_allow_download_players_box.generic.statusbar = "enable to allow downloading of player models";
|
2020-04-16 07:18:49 +00:00
|
|
|
|
|
|
|
s_allow_download_models_box.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_allow_download_models_box.generic.textSize = MENU_FONT_SIZE;
|
|
|
|
s_allow_download_models_box.generic.x = 0;
|
|
|
|
s_allow_download_models_box.generic.y = y += MENU_LINE_SIZE;
|
|
|
|
s_allow_download_models_box.generic.name = "models";
|
|
|
|
s_allow_download_models_box.generic.callback = DownloadCallback;
|
|
|
|
s_allow_download_models_box.itemnames = yes_no_names;
|
|
|
|
s_allow_download_models_box.curvalue = (Cvar_VariableValue("allow_download_models") != 0);
|
2020-05-05 01:24:51 +00:00
|
|
|
s_allow_download_models_box.generic.statusbar = "enable to allow downloading of models";
|
2020-04-16 07:18:49 +00:00
|
|
|
|
|
|
|
s_allow_download_sounds_box.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_allow_download_sounds_box.generic.textSize = MENU_FONT_SIZE;
|
|
|
|
s_allow_download_sounds_box.generic.x = 0;
|
|
|
|
s_allow_download_sounds_box.generic.y = y += MENU_LINE_SIZE;
|
|
|
|
s_allow_download_sounds_box.generic.name = "sounds";
|
|
|
|
s_allow_download_sounds_box.generic.callback = DownloadCallback;
|
|
|
|
s_allow_download_sounds_box.itemnames = yes_no_names;
|
|
|
|
s_allow_download_sounds_box.curvalue = (Cvar_VariableValue("allow_download_sounds") != 0);
|
2020-05-05 01:24:51 +00:00
|
|
|
s_allow_download_sounds_box.generic.statusbar = "enable to allow downloading of sounds";
|
2020-04-16 07:18:49 +00:00
|
|
|
|
|
|
|
s_download_back_action.generic.type = MTYPE_ACTION;
|
|
|
|
s_download_back_action.generic.textSize = MENU_FONT_SIZE;
|
|
|
|
s_download_back_action.generic.flags = QMF_LEFT_JUSTIFY;
|
|
|
|
s_download_back_action.generic.x = 0;
|
|
|
|
s_download_back_action.generic.y = y += 3*MENU_LINE_SIZE;
|
|
|
|
s_download_back_action.generic.name = " back";
|
|
|
|
s_download_back_action.generic.callback = UI_BackMenu;
|
2019-03-13 19:20:07 +00:00
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_download_title);
|
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_download_box);
|
2019-03-13 19:20:07 +00:00
|
|
|
|
|
|
|
#ifdef USE_CURL // HTTP downloading from R1Q2
|
2021-08-12 19:30:51 +00:00
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_http_download_box);
|
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_http_fallback_box);
|
2019-03-13 19:20:07 +00:00
|
|
|
#endif // USE_CURL
|
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_download_maps_box);
|
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_download_textures_24bit_box); // option to allow downloading 24-bit textures
|
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_download_players_box);
|
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_download_models_box);
|
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_download_sounds_box);
|
2019-03-13 19:20:07 +00:00
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
UI_AddMenuItem (&s_downloadoptions_menu, &s_download_back_action );
|
2019-03-13 19:20:07 +00:00
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
UI_CenterMenu (&s_downloadoptions_menu);
|
2019-03-13 19:20:07 +00:00
|
|
|
|
|
|
|
// skip over title
|
|
|
|
if (s_downloadoptions_menu.cursor == 0)
|
|
|
|
s_downloadoptions_menu.cursor = 1;
|
|
|
|
}
|
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
void Menu_DownloadOptions_Draw(void)
|
2019-03-13 19:20:07 +00:00
|
|
|
{
|
2021-08-12 19:30:51 +00:00
|
|
|
UI_DrawBanner ("m_banner_multiplayer");
|
|
|
|
UI_DrawMenu (&s_downloadoptions_menu);
|
2019-03-13 19:20:07 +00:00
|
|
|
}
|
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
const char *Menu_DownloadOptions_Key (int key)
|
2019-03-13 19:20:07 +00:00
|
|
|
{
|
2021-08-12 19:30:51 +00:00
|
|
|
return UI_DefaultMenuKey (&s_downloadoptions_menu, key);
|
2019-03-13 19:20:07 +00:00
|
|
|
}
|
|
|
|
|
2021-08-12 19:30:51 +00:00
|
|
|
void Menu_DownloadOptions_f (void)
|
2019-03-13 19:20:07 +00:00
|
|
|
{
|
2021-08-12 19:30:51 +00:00
|
|
|
Menu_DownloadOptions_Init ();
|
|
|
|
UI_PushMenu (Menu_DownloadOptions_Draw, Menu_DownloadOptions_Key);
|
2019-03-13 19:20:07 +00:00
|
|
|
}
|