From 783185cc594e24d4f812ac6b289a09120db37265 Mon Sep 17 00:00:00 2001 From: Spoike Date: Thu, 19 Aug 2021 06:02:18 +0000 Subject: [PATCH] Comment/etc tweaks. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6025 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 76 ++++++++++++++++++++--------------------- engine/client/keys.c | 8 ++--- engine/client/keys.h | 22 +++++++++--- engine/common/net.h | 1 + engine/server/sv_user.c | 1 + 5 files changed, 61 insertions(+), 47 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index e8a9fcfa..4438c157 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -143,7 +143,7 @@ extern int total_loading_size, current_loading_size, loading_stage; // info mirrors // cvar_t password = CVARAF("password", "", "pq_password", CVAR_USERINFO | CVAR_NOUNSAFEEXPAND); //this is parhaps slightly dodgy... added pq_password alias because baker seems to be using this for user accounts. -cvar_t spectator = CVARF("spectator", "", CVAR_USERINFO); +static cvar_t spectator = CVARF("spectator", "", CVAR_USERINFO); cvar_t name = CVARFC("name", "Player", CVAR_ARCHIVE | CVAR_USERINFO, Name_Callback); cvar_t team = CVARF("team", "", CVAR_ARCHIVE | CVAR_USERINFO); cvar_t skin = CVARAF("skin", "", "_cl_playerskin", CVAR_ARCHIVE | CVAR_USERINFO); @@ -151,11 +151,11 @@ cvar_t model = CVARAF("model", "", "_cl_playermodel", CVAR_ARCHIVE | CVAR_US cvar_t topcolor = CVARF("topcolor", "", CVAR_ARCHIVE | CVAR_USERINFO); cvar_t bottomcolor = CVARF("bottomcolor", "", CVAR_ARCHIVE | CVAR_USERINFO); cvar_t rate = CVARFD("rate", "30000"/*"6480"*/, CVAR_ARCHIVE | CVAR_USERINFO, "A rough measure of the bandwidth to try to use while playing. Too high a value may result in 'buffer bloat'."); -cvar_t drate = CVARFD("drate", "3000000", CVAR_ARCHIVE | CVAR_USERINFO, "A rough measure of the bandwidth to try to use while downloading (in bytes per second)."); // :) -cvar_t noaim = CVARF("noaim", "", CVAR_ARCHIVE | CVAR_USERINFO); +static cvar_t drate = CVARFD("drate", "3000000", CVAR_ARCHIVE | CVAR_USERINFO, "A rough measure of the bandwidth to try to use while downloading (in bytes per second)."); // :) +static cvar_t noaim = CVARF("noaim", "", CVAR_ARCHIVE | CVAR_USERINFO); cvar_t msg = CVARFD("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, "Filter console prints/messages. Only functions on QuakeWorld servers. 0=pickup messages. 1=death messages. 2=critical messages. 3=chat."); -cvar_t b_switch = CVARF("b_switch", "", CVAR_ARCHIVE | CVAR_USERINFO); -cvar_t w_switch = CVARF("w_switch", "", CVAR_ARCHIVE | CVAR_USERINFO); +static cvar_t b_switch = CVARF("b_switch", "", CVAR_ARCHIVE | CVAR_USERINFO); +static cvar_t w_switch = CVARF("w_switch", "", CVAR_ARCHIVE | CVAR_USERINFO); #ifdef HEXEN2 cvar_t cl_playerclass=CVARF("cl_playerclass","", CVAR_ARCHIVE | CVAR_USERINFO); #endif @@ -354,7 +354,7 @@ void CL_UpdateWindowTitle(void) switch (cls.state) { default: -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state) Q_snprintfz(title, sizeof(title), "%s: %s", fs_gamename.string, svs.name); else @@ -452,7 +452,7 @@ void CL_Quit_f (void) TP_ExecTrigger("f_quit", true); Cbuf_Execute(); /* -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (!isDedicated) #endif { @@ -1329,7 +1329,7 @@ void CL_BeginServerConnect(const char *host, int port, qboolean noproxy) void CL_BeginServerReconnect(void) { -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (isDedicated) { Con_TPrintf ("Connect ignored - dedicated. set a renderer first\n"); @@ -1409,7 +1409,7 @@ void CL_Connect_f (void) server = Cmd_Argv (1); server = strcpy(alloca(strlen(server)+1), server); -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state == ss_clustermode) CL_Disconnect (NULL); else @@ -1445,7 +1445,7 @@ static void CL_ConnectBestRoute_f (void) else Con_TPrintf ("Routing table favours chaining through %i proxies (%ims vs %ims)\n", proxies, chainedcost, directcost); -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state == ss_clustermode) CL_Disconnect (NULL); else @@ -1773,7 +1773,7 @@ void CL_ClearState (qboolean gamestart) extern cvar_t cfg_save_auto; int i, j; downloadlist_t *pendingdownloads, *faileddownloads; -#ifndef CLIENTONLY +#ifdef HAVE_SERVER #define serverrunning (sv.state != ss_dead) #define tolocalserver NET_IsLoopBackAddress(&cls.netchan.remote_address) #else @@ -1797,7 +1797,7 @@ void CL_ClearState (qboolean gamestart) Con_DPrintf ("Clearing memory\n"); if (!serverrunning || !tolocalserver) { -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (serverrunning && sv.state != ss_clustermode) SV_UnspawnServer(); #endif @@ -1913,7 +1913,7 @@ void CL_ClearState (qboolean gamestart) cl.gamespeed = 1; cl.protocol_qw = PROTOCOL_VERSION_QW; //until we get an svc_serverdata cl.allocated_client_slots = QWMAX_CLIENTS; -#ifndef CLIENTONLY +#ifdef HAVE_SERVER //FIXME: we should just set it to 0 to make sure its set up properly elsewhere. if (sv.state) cl.allocated_client_slots = sv.allocated_client_slots; @@ -2043,7 +2043,7 @@ void CL_Disconnect (const char *reason) cls.demoplayback = DPB_NONE; cls.demorecording = cls.timedemo = false; -#ifndef CLIENTONLY +#ifdef HAVE_SERVER //running a server, and it's our own if (serverrunning && !tolocalserver && sv.state != ss_clustermode) SV_UnspawnServer(); @@ -2077,7 +2077,7 @@ void CL_Disconnect (const char *reason) CL_FlushClientCommands(); -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (!isDedicated) #endif { @@ -2111,7 +2111,7 @@ void CL_Disconnect (const char *reason) void CL_Disconnect_f (void) { -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state) SV_UnspawnServer(); #endif @@ -2140,7 +2140,7 @@ void CL_User_f (void) int i; qboolean found = false; -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state) { SV_User_f(); @@ -2360,7 +2360,7 @@ void CL_CheckServerInfo(void) #ifdef QUAKESTATS int oldstate; #endif -#ifndef CLIENTONLY +#ifdef HAVE_SERVER extern cvar_t sv_cheats; #endif int oldteamplay = cl.teamplay; @@ -2413,7 +2413,7 @@ void CL_CheckServerInfo(void) if (spectating || cls.demoplayback || !stricmp(s, "on")) cls.allow_cheats = true; -#ifndef CLIENTONLY +#ifdef HAVE_SERVER //allow cheats in single player regardless of sv_cheats. //(also directly read the sv_cheats cvar to avoid issues with nq protocols that don't support serverinfo. if (sv.state == ss_active && (sv.allocated_client_slots == 1 || sv_cheats.ival)) @@ -3725,7 +3725,7 @@ client_connect: //fixme: make function { Con_TPrintf ("connection\n"); -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state && sv.state != ss_clustermode) SV_UnspawnServer(); #endif @@ -3735,7 +3735,7 @@ client_connect: //fixme: make function { if (!NET_CompareAdr(&cls.netchan.remote_address, &net_from)) { -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state != ss_clustermode) #endif CL_Disconnect (NULL); @@ -4149,7 +4149,7 @@ void CL_ReadPackets (void) if (cls.state >= ca_connected && realtime - cls.netchan.last_received > cl_timeout.value && !cls.demoplayback) { -#ifndef CLIENTONLY +#ifdef HAVE_SERVER /*don't timeout when we're the actual server*/ if (!sv.state) #endif @@ -4500,7 +4500,7 @@ void CL_Windows_f (void) } #endif -#ifndef CLIENTONLY +#ifdef HAVE_SERVER void CL_ServerInfo_f(void) { if (!sv.state && cls.state && Cmd_Argc() < 2) @@ -5018,7 +5018,7 @@ void CL_Init (void) Cvar_Register (&cl_splitscreen, cl_controlgroup); #ifndef SERVERONLY - Cvar_Register (&cl_loopbackprotocol, cl_controlgroup); + Cvar_Register (&cl_loopbackprotocol, cl_controlgroup); #endif Cvar_Register (&cl_verify_urischeme, cl_controlgroup); @@ -5182,10 +5182,10 @@ void CL_Init (void) Cmd_AddCommandAD ("me", CL_SayMe_f, Key_EmojiCompletion_c, NULL); Cmd_AddCommandAD ("sayone", CL_Say_f, Key_EmojiCompletion_c, NULL); Cmd_AddCommandAD ("say_team", CL_SayTeam_f, Key_EmojiCompletion_c, NULL); -#ifdef CLIENTONLY - Cmd_AddCommand ("serverinfo", NULL); -#else +#ifdef HAVE_SERVER Cmd_AddCommand ("serverinfo", CL_ServerInfo_f); +#else + Cmd_AddCommand ("serverinfo", NULL); #endif Cmd_AddCommandD ("fog", CL_Fog_f, "fog "); @@ -6210,7 +6210,7 @@ double Host_Frame (double time) #endif if ((realtime - oldrealtime) < idlesec) { -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state) { RSpeedRemark(); @@ -6245,7 +6245,7 @@ double Host_Frame (double time) RelightThink(); //think even on idle (which means small walls and a fast cpu can get more surfaces done. #endif -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state && cls.state != ca_active) { maxfpsignoreserver = false; @@ -6332,7 +6332,7 @@ double Host_Frame (double time) // process console commands from said click/button events Cbuf_Execute (); -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (isDedicated) //someone changed it. { if (sv.state) @@ -6405,7 +6405,7 @@ double Host_Frame (double time) if (host_speeds.ival) time0 = Sys_DoubleTime (); -#ifndef CLIENTONLY +#ifdef HAVE_SERVER if (sv.state) { float ohft = host_frametime; @@ -6728,7 +6728,7 @@ void CL_ExecInitialConfigs(char *resetcommand) Cbuf_AddText("cl_warncmd 0\n", RESTRICT_LOCAL); Cbuf_AddText("cvar_purgedefaults\n", RESTRICT_LOCAL); //reset cvar defaults to their engine-specified values. the tail end of 'exec default.cfg' will update non-cheat defaults to mod-specified values. Cbuf_AddText("cvarreset *\n", RESTRICT_LOCAL); //reset all cvars to their current (engine) defaults -#ifndef CLIENTONLY +#ifdef HAVE_SERVER Cbuf_AddText(va("sv_gamedir \"%s\"\n", FS_GetGamedir(true)), RESTRICT_LOCAL); #endif Cbuf_AddText(resetcommand, RESTRICT_LOCAL); @@ -6793,7 +6793,7 @@ void CL_ExecInitialConfigs(char *resetcommand) //the configs should be fully loaded. //so convert the backwards compable commandline parameters in cvar sets. CL_ArgumentOverrides(); -#ifndef CLIENTONLY +#ifdef HAVE_SERVER SV_ArgumentOverrides(); #endif @@ -6840,7 +6840,7 @@ void Host_FinishLoading(void) Cbuf_Execute (); CL_ArgumentOverrides(); - #ifndef CLIENTONLY + #ifdef HAVE_SERVER SV_ArgumentOverrides(); #endif @@ -6984,7 +6984,7 @@ void Host_Init (quakeparms_t *parms) #if defined(CSQC_DAT) || defined(MENU_DAT) PF_Common_RegisterCvars(); #endif -#ifndef CLIENTONLY +#ifdef HAVE_SERVER SV_Init(parms); #endif @@ -7088,7 +7088,7 @@ void Host_Shutdown(void) Mod_Shutdown(true); Wads_Flush(); Con_History_Save(); //do this outside of the console code so that the filesystem is still running at this point but still allowing the filesystem to make console prints (you might not see them, but they should be visible to sys_printf still, for debugging). -#ifndef CLIENTONLY +#ifdef HAVE_SERVER SV_Shutdown(); #else Log_ShutDown(); @@ -7127,14 +7127,14 @@ void Host_Shutdown(void) COM_BiDi_Shutdown(); Memory_DeInit(); -#ifndef CLIENTONLY +#ifdef HAVE_SERVER SV_WipeServerState(); memset(&svs, 0, sizeof(svs)); #endif Sys_Shutdown(); } -#ifdef CLIENTONLY +#ifndef HAVE_SERVER void SV_EndRedirect (void) { } diff --git a/engine/client/keys.c b/engine/client/keys.c index 0f778998..30066872 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -303,10 +303,10 @@ keyname_t keynames[] = {"GP_UNKNOWN", K_GP_UNKNOWN}, //names for playstation controllers - {"GP_CROSS", K_GP_A}, - {"GP_CIRCLE", K_GP_B}, - {"GP_SQUARE", K_GP_X}, - {"GP_TRIANGLE", K_GP_Y}, + {"GP_CROSS", K_GP_PS_CROSS}, + {"GP_CIRCLE", K_GP_PS_CIRCLE}, + {"GP_SQUARE", K_GP_PS_SQUARE}, + {"GP_TRIANGLE", K_GP_PS_TRIANGLE}, {"GP_MIC", K_GP_MISC1}, //axis->button emulation diff --git a/engine/client/keys.h b/engine/client/keys.h index af3d5c1d..df59aede 100644 --- a/engine/client/keys.h +++ b/engine/client/keys.h @@ -168,10 +168,10 @@ typedef enum { * remapping keys for that too */ /* Section dedicated to SDL controller definitions */ - K_GP_A, - K_GP_B, - K_GP_X, - K_GP_Y, + K_GP_DIAMOND_DOWN, + K_GP_DIAMOND_RIGHT, + K_GP_DIAMOND_LEFT, + K_GP_DIAMOND_UP, K_GP_BACK, K_GP_GUIDE, K_GP_START, @@ -240,7 +240,19 @@ typedef enum { K_MM_TRACK_PREV, K_MM_TRACK_STOP, K_MM_TRACK_PLAYPAUSE, - K_MAX + K_MAX, + + //360 buttons + K_GP_A = K_GP_DIAMOND_DOWN, + K_GP_B = K_GP_DIAMOND_RIGHT, + K_GP_X = K_GP_DIAMOND_LEFT, + K_GP_Y = K_GP_DIAMOND_UP, + + //ps buttons + K_GP_PS_CROSS = K_GP_DIAMOND_DOWN, + K_GP_PS_CIRCLE = K_GP_DIAMOND_RIGHT, + K_GP_PS_SQUARE = K_GP_DIAMOND_LEFT, + K_GP_PS_TRIANGLE = K_GP_DIAMOND_UP, } keynum_t; #define KEY_MODIFIER_SHIFT (1<<0) diff --git a/engine/common/net.h b/engine/common/net.h index 5013bb6a..5c72eff7 100644 --- a/engine/common/net.h +++ b/engine/common/net.h @@ -337,6 +337,7 @@ void Huff_EmitByte(int ch, qbyte *buffer, int *count); #define CCREQ_SERVER_INFO 0x02 #define CCREQ_PLAYER_INFO 0x03 #define CCREQ_RULE_INFO 0x04 +#define CCREQ_PROQUAKE_RCON 0x05 #define CCREP_ACCEPT 0x81 #define CCREP_REJECT 0x82 diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index ca17ceb8..43a81cb1 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -3129,6 +3129,7 @@ qboolean SV_FindRemotePackage(const char *package, char *url, size_t urlsize) line[sep-package+1] = 0; package = sep+1; + /*compat with xonotic*/ Q_strncatz(line, "curl_urls.txt", sizeof(line)); f = FS_OpenVFS(line, "rb", FS_ROOT); //this is for server admins to deal with. urls are too unreliable for paks. if (f)