mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-02-03 05:51:02 +00:00
Make it a smidge easier for server admins to run community maps.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6240 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
e0f3c35414
commit
ef74bc83a0
2 changed files with 70 additions and 4 deletions
|
@ -3985,7 +3985,7 @@ void COM_Gamedir (const char *dir, const struct gamepacks *packagespaths)
|
|||
/*quake requires a few settings for compatibility*/
|
||||
#define QRPCOMPAT "set cl_cursor_scale 0.2\nset cl_cursor_bias_x 7.5\nset cl_cursor_bias_y 0.8\n"
|
||||
#define QUAKESPASMSUCKS "set mod_h2holey_bugged 1\n"
|
||||
#define QUAKEOVERRIDES "set v_gammainverted 1\nset con_stayhidden 0\nset allow_download_pakcontents 2\nset allow_download_refpackages 0\nset r_meshpitch -1\nr_sprite_backfacing 1\nset sv_bigcoords \"\"\nmap_autoopenportals 1\n" "sv_port "STRINGIFY(PORT_QWSERVER)" "STRINGIFY(PORT_NQSERVER)"\n" ZFIXHACK EZQUAKECOMPETITIVE QUAKESPASMSUCKS
|
||||
#define QUAKEOVERRIDES "set v_gammainverted 1\nset cl_download_mapsrc \"https://maps.quakeworld.nu/all/\"\nset con_stayhidden 0\nset allow_download_pakcontents 2\nset allow_download_refpackages 0\nset r_meshpitch -1\nr_sprite_backfacing 1\nset sv_bigcoords \"\"\nmap_autoopenportals 1\n" "sv_port "STRINGIFY(PORT_QWSERVER)" "STRINGIFY(PORT_NQSERVER)"\n" ZFIXHACK EZQUAKECOMPETITIVE QUAKESPASMSUCKS
|
||||
#define QCFG "//schemes quake qw\n" QUAKEOVERRIDES "set com_parseutf8 0\n" QRPCOMPAT
|
||||
#define KEXCFG "//schemes quake_r2\n" QUAKEOVERRIDES "set com_parseutf8 1\nset campaign 0\nset net_enable_dtls 1\nset sv_mintic 0.016666667\nset sv_maxtic $sv_mintic\nset cl_netfps 60\n"
|
||||
/*NetQuake reconfiguration, to make certain people feel more at home...*/
|
||||
|
|
|
@ -507,6 +507,62 @@ static void SV_Map_c(int argn, const char *partial, struct xcommandargcompletion
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_CLIENT) && defined(WEBCLIENT)
|
||||
static char *uri_escape(const char *in, char *out, size_t outsize)
|
||||
{
|
||||
static const char *hex = "0123456789ABCDEF";
|
||||
|
||||
const unsigned char *s = in;
|
||||
unsigned char *o = out;
|
||||
while (*s && o < (unsigned char*)out+outsize-4)
|
||||
{
|
||||
//unreserved chars according to RFC3986
|
||||
if ((*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') || (*s >= '0' && *s <= '9')
|
||||
|| *s == '.' || *s == '-' || *s == '_' || *s == '~')
|
||||
*o++ = *s++;
|
||||
else
|
||||
{
|
||||
*o++ = '%';
|
||||
*o++ = hex[*s>>4];
|
||||
*o++ = hex[*s&0xf];
|
||||
s++;
|
||||
}
|
||||
}
|
||||
*o = 0;
|
||||
return out;
|
||||
}
|
||||
static void SV_Map_Downloaded(struct dl_download *dl)
|
||||
{
|
||||
SCR_SetLoadingStage(LS_NONE);
|
||||
if (dl->status == DL_FINISHED)
|
||||
{
|
||||
char buf[1024];
|
||||
Cbuf_AddText(va("map %s\n", COM_QuotedString(dl->user_ctx, buf, sizeof(buf), false)), RESTRICT_LOCAL);
|
||||
}
|
||||
else
|
||||
Con_Printf("Unable to download\n");
|
||||
Z_Free(dl->user_ctx);
|
||||
}
|
||||
extern cvar_t cl_download_mapsrc;
|
||||
static void SV_Map_DownloadPrompted(void *ctx, promptbutton_t buttn)
|
||||
{
|
||||
const char *mapname=ctx;
|
||||
if (buttn == PROMPT_YES)
|
||||
{
|
||||
char buf[512];
|
||||
struct dl_download *dl = HTTP_CL_Get(va("%s%s.bsp", cl_download_mapsrc.string, uri_escape(mapname, buf, sizeof(buf))), va("maps/%s.bsp", mapname), SV_Map_Downloaded);
|
||||
if (dl)
|
||||
{
|
||||
dl->user_ctx = ctx;
|
||||
DL_CreateThread(dl, NULL, NULL); //allows it to run at its own rate. yay speedups.
|
||||
return;
|
||||
}
|
||||
}
|
||||
SCR_SetLoadingStage(LS_NONE);
|
||||
Z_Free(ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
//static void gtcallback(struct cvar_s *var, char *oldvalue)
|
||||
//{
|
||||
// Con_Printf("g_gametype changed\n");
|
||||
|
@ -810,12 +866,22 @@ void SV_Map_f (void)
|
|||
}
|
||||
if (!exts[i])
|
||||
{
|
||||
#ifdef HAVE_CLIENT
|
||||
SCR_SetLoadingStage(LS_NONE);
|
||||
#ifdef WEBCLIENT
|
||||
if (*cl_download_mapsrc.string &&
|
||||
!strcmp(cmd, "map") && !startspot &&
|
||||
!isDedicated && Cmd_ExecLevel==RESTRICT_LOCAL && !strchr(level, '.'))
|
||||
{
|
||||
Menu_Prompt(SV_Map_DownloadPrompted, Z_StrDup(level), va("Download map %s from "S_COLOR_BLUE "%s" S_COLOR_WHITE"?", level, cl_download_mapsrc.string), "Download", NULL, "Cancel", true);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// FTE is still a Quake engine so report BSP missing
|
||||
snprintf (expanded, sizeof(expanded), exts[1], level);
|
||||
Con_TPrintf ("Can't find %s\n", expanded);
|
||||
#ifndef SERVERONLY
|
||||
SCR_SetLoadingStage(LS_NONE);
|
||||
#endif
|
||||
|
||||
if (SSV_IsSubServer() && !sv.state) //subservers don't leave defunct servers with no maps lying around.
|
||||
Cbuf_AddText("\nquit\n", RESTRICT_LOCAL);
|
||||
|
|
Loading…
Reference in a new issue