From f416201c6663565fb34260d7bf774377a4babf23 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 30 Dec 2018 21:09:13 +0000 Subject: [PATCH] Some minor fixes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5375 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- CMakeLists.txt | 21 ++++++++++ engine/client/keys.c | 92 +++++++++++++++----------------------------- engine/common/cmd.c | 2 +- engine/common/cmd.h | 1 + engine/gl/glsupp.h | 6 +++ 5 files changed, 60 insertions(+), 62 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32e250ccd..34ca3bb4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -614,6 +614,27 @@ ELSE() ) SET_TARGET_PROPERTIES(iqmtool PROPERTIES COMPILE_DEFINITIONS "${FTE_REVISON}") + IF(1) + ADD_EXECUTABLE(ftemaster + ${FTESV_ARCH_FILES} + engine/server/sv_master.c + engine/common/net_wins.c + engine/common/cvar.c + engine/common/cmd.c + engine/common/sha1.c #for websockets + engine/http/httpclient.c #for the pipe stuff + engine/common/log.c + engine/common/fs.c + engine/common/fs_stdio.c + engine/common/common.c + engine/common/translate.c + engine/common/zone.c + engine/qclib/hash.c + ) + SET_TARGET_PROPERTIES(ftemaster PROPERTIES COMPILE_DEFINITIONS "MASTERONLY;${FTE_LIB_DEFINES};${FTESV_DEFINES};${FTE_REVISON}") + TARGET_LINK_LIBRARIES(ftemaster ${FTESV_LIBS}) + ENDIF() + ADD_EXECUTABLE(httpserver engine/common/fs_stdio.c engine/http/httpserver.c diff --git a/engine/client/keys.c b/engine/client/keys.c index c451af6c7..cafbc9337 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -2421,18 +2421,19 @@ void Key_Bind_f (void) int i, c, b, modifier; char cmd[1024]; int bindmap = 0; - + int level = Cmd_ExecLevel; + qboolean isbindlevel = !strcmp("bindlevel", Cmd_Argv(0)); if (!strcmp("in_bind", Cmd_Argv(0))) { bindmap = atoi(Cmd_Argv(1)); - Cmd_ShiftArgs(1, Cmd_ExecLevel==RESTRICT_LOCAL); + Cmd_ShiftArgs(1, level==RESTRICT_LOCAL); } c = Cmd_Argc(); - if (c < 2) + if (c < 2+isbindlevel) { - Con_Printf ("bind [command] : attach a command to a key\n"); + Con_Printf ("%s %s[command] : attach a command to a key\n", Cmd_Argv(0), isbindlevel?" ":""); return; } b = Key_StringToKeynum (Cmd_Argv(1), &modifier); @@ -2442,6 +2443,25 @@ void Key_Bind_f (void) Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1)); return; } + if (isbindlevel) + { + level = atoi(Cmd_Argv(2)); + if (Cmd_IsInsecure()) + level = Cmd_ExecLevel; + else + { + if (level > RESTRICT_MAX) + level = RESTRICT_INSECURE; + else + { + if (level < RESTRICT_MIN) + level = RESTRICT_MIN; + if (level > Cmd_ExecLevel) + level = Cmd_ExecLevel; //clamp exec levels, so we don't get more rights than we should. + } + } + } + if (bindmap) { if (bindmap <= 0 || bindmap > KEY_MODIFIER_ALTBINDMAP) @@ -2459,7 +2479,7 @@ void Key_Bind_f (void) modifier = (bindmap-1) | KEY_MODIFIER_ALTBINDMAP; } - if (c == 2) + if (c == 2+isbindlevel) { if (modifier == ~0) //modifier unspecified. default to no modifier modifier = 0; @@ -2482,73 +2502,23 @@ void Key_Bind_f (void) return; } - if (c > 3) + if (c > 3+isbindlevel) { - Cmd_ShiftArgs(1, Cmd_ExecLevel==RESTRICT_LOCAL); - Key_SetBinding (b, modifier, Cmd_Args(), Cmd_ExecLevel); + Cmd_ShiftArgs(1+isbindlevel, level==RESTRICT_LOCAL); + Key_SetBinding (b, modifier, Cmd_Args(), level); return; } // copy the rest of the command line cmd[0] = 0; // start out with a null string - for (i=2 ; i< c ; i++) + for (i=2+isbindlevel ; i< c ; i++) { Q_strncatz (cmd, Cmd_Argv(i), sizeof(cmd)); if (i != (c-1)) Q_strncatz (cmd, " ", sizeof(cmd)); } - Key_SetBinding (b, modifier, cmd, Cmd_ExecLevel); -} - -void Key_BindLevel_f (void) -{ - int i, c, b, modifier; - char cmd[1024]; - - c = Cmd_Argc(); - - if (c != 2 && c != 4) - { - Con_Printf ("%s [ ] : attach a command to a key for a specific level of access\n", Cmd_Argv(0)); - return; - } - b = Key_StringToKeynum (Cmd_Argv(1), &modifier); - if (b==-1) - { - if (cl_warncmd.ival) - Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1)); - return; - } - - if (modifier == ~0) //modifier unspecified. default to no modifier - modifier = 0; - - if (c == 2) - { - if (keybindings[b][modifier]) - Con_Printf ("\"%s\" (%i)= \"%s\"\n", Cmd_Argv(1), bindcmdlevel[b][modifier], keybindings[b][modifier] ); - else - Con_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) ); - return; - } - - if (Cmd_IsInsecure()) - { - Con_Printf("Server attempted usage of %s\n", Cmd_Argv(0)); - return; - } - -// copy the rest of the command line - cmd[0] = 0; // start out with a null string - for (i=3 ; i< c ; i++) - { - Q_strncatz (cmd, Cmd_Argv(i), sizeof(cmd)); - if (i != (c-1)) - Q_strncatz (cmd, " ", sizeof(cmd)); - } - - Key_SetBinding (b, modifier, cmd, atoi(Cmd_Argv(2))); + Key_SetBinding (b, modifier, cmd, level); } /* @@ -2713,7 +2683,7 @@ void Key_Init (void) // Cmd_AddCommandAD ("bind",Key_Bind_f, Key_Bind_c, NULL); Cmd_AddCommand ("in_bind",Key_Bind_f); - Cmd_AddCommand ("bindlevel",Key_BindLevel_f); + Cmd_AddCommand ("bindlevel",Key_Bind_f); Cmd_AddCommandAD ("unbind",Key_Unbind_f, Key_Bind_c, NULL); Cmd_AddCommand ("unbindall",Key_Unbindall_f); diff --git a/engine/common/cmd.c b/engine/common/cmd.c index b33230295..184164338 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -3986,7 +3986,7 @@ static void Cmd_WriteConfig_f(void) MasterInfo_WriteServers(); #endif - f = FS_OpenWithFriends(fname, sysname, sizeof(sysname), 3, "quake.rc", "hexen.rc", "*.cfg", "configs/*.cfg"); + f = FS_OpenWithFriends(fname, sysname, sizeof(sysname), 4, "quake.rc", "hexen.rc", "*.cfg", "configs/*.cfg"); all = cfg_save_all.ival; } diff --git a/engine/common/cmd.h b/engine/common/cmd.h index 12ded8ea9..c17687450 100644 --- a/engine/common/cmd.h +++ b/engine/common/cmd.h @@ -159,6 +159,7 @@ void Cmd_ExecuteString (const char *text, int restrictionlevel); void Cmd_Args_Set(const char *newargs, size_t len); +//higher levels have greater access, BUT BE SURE TO CHECK Cmd_IsInsecure() #define RESTRICT_MAX_TOTAL 31 #define RESTRICT_MAX_USER 29 #define RESTRICT_DEFAULT 20 diff --git a/engine/gl/glsupp.h b/engine/gl/glsupp.h index 7452f1278..8926daf1b 100644 --- a/engine/gl/glsupp.h +++ b/engine/gl/glsupp.h @@ -36,6 +36,12 @@ extern qlpMTex2FUNC qglMultiTexCoord2fARB; #define GL_CLAMP_TO_EDGE 0x812F //#endif + +#ifndef GL_MAX_ARRAY_TEXTURE_LAYERS +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF /*opengl 3.0*/ +#endif + + // Added to make morphos and mingw32 crosscompilers to work /* ./gl/gl_draw.c: In function `GL_Upload32_BGRA':