From 0d9a269ab4ccf25642f428d72e42d4ed22932683 Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 8 Mar 2022 05:34:13 +0000 Subject: [PATCH] Remove last plugin stubs. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6217 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 9 ++++++--- engine/common/cvar.c | 4 ++++ engine/common/plugin.c | 11 +++++++++++ plugins/plugin.h | 11 +++++++++++ plugins/quake3/clq3_cg.c | 2 +- plugins/quake3/clq3_parse.c | 28 ++++++---------------------- plugins/quake3/clq3_ui.c | 10 +++++----- plugins/quake3/q3common.c | 2 +- 8 files changed, 45 insertions(+), 32 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 79969745..3b929d98 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -115,7 +115,7 @@ cvar_t cl_predict_players_latency = CVARD("cl_predict_players_latency", "1.0", " cvar_t cl_predict_players_nudge = CVARD("cl_predict_players_nudge", "0.02", "An extra nudge of time, to cover video latency."); cvar_t cl_solid_players = CVARD("cl_solid_players", "1", "Consider other players as solid for player prediction."); cvar_t cl_noblink = CVARD("cl_noblink", "0", "Disable the ^^b text blinking feature."); -cvar_t cl_servername = CVARD("cl_servername", "none", "The hostname of the last server you connected to"); +cvar_t cl_servername = CVARFD("cl_servername", "", CVAR_NOSET, "The hostname of the last server you connected to"); cvar_t cl_serveraddress = CVARD("cl_serveraddress", "none", "The address of the last server you connected to"); cvar_t qtvcl_forceversion1 = CVAR("qtvcl_forceversion1", "0"); cvar_t qtvcl_eztvextensions = CVAR("qtvcl_eztvextensions", "0"); @@ -1181,7 +1181,11 @@ void CL_CheckForResend (void) #endif if (!connectinfo.trying) + { + if (*cl_servername.string) + Cvar_ForceSet(&cl_servername, ""); return; + } if (startuppending || r_blockvidrestart) return; //don't send connect requests until we've actually initialised fully. this isn't a huge issue, but makes the startup prints a little more sane. @@ -2197,7 +2201,7 @@ void CL_Disconnect (const char *reason) FTENET_AddToCollection(cls.sockets, "conn", NULL, NA_INVALID, NP_DGRAM); #endif - Cvar_ForceSet(&cl_servername, "none"); + Cvar_ForceSet(&cl_servername, ""); CL_ClearState(false); @@ -2672,7 +2676,6 @@ void CL_CheckServerInfo(void) CL_CheckServerPacks(); Cvar_ForceCheatVars(cls.allow_semicheats, cls.allow_cheats); - Validation_Apply_Ruleset(); if (oldteamplay != cl.teamplay) Skin_FlushPlayers(); diff --git a/engine/common/cvar.c b/engine/common/cvar.c index 309e1f15..028c576d 100644 --- a/engine/common/cvar.c +++ b/engine/common/cvar.c @@ -1115,6 +1115,7 @@ qboolean Cvar_ApplyLatchFlag(cvar_t *var, char *value, unsigned int newflag, uns return result; } +#ifdef HAVE_CLIENT void Cvar_ForceCheatVars(qboolean semicheats, qboolean absolutecheats) { //this either unlatches if the cheat type is allowed, or enforces a default for full cheats and blank for semicheats. //this is clientside only. @@ -1167,7 +1168,10 @@ void Cvar_ForceCheatVars(qboolean semicheats, qboolean absolutecheats) var->latched_string = latch; } } + + Validation_Apply_Ruleset(); } +#endif int Cvar_ApplyLatches(int latchflag, qboolean clearflag) { diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 54d6f431..7dc43b32 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -2120,9 +2120,15 @@ static void *QDECL PlugBI_GetEngineInterface(const char *interfacename, size_t s NULL, #endif + Con_ClearNotify, Plug_CL_ClearState, Plug_CL_SetLoadscreenState, Plug_CL_UpdateGameTime, + + Cvar_ForceCheatVars, + DL_Begun, + CL_DownloadFinished, + CL_DownloadFailed, }; if (structsize == sizeof(funcs)) return &funcs; @@ -2150,6 +2156,11 @@ static void *QDECL PlugBI_GetEngineInterface(const char *interfacename, size_t s Plug_Input_GetMoveCount, Plug_Input_GetMoveEntry, + Sys_Clipboard_PasteText, + Sys_SaveClipboard, + utf8_decode, + utf8_encode, + IN_GetKeyDest, IN_KeyEvent, IN_MouseMove, diff --git a/plugins/plugin.h b/plugins/plugin.h index fbf2deac..68eadb62 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -310,9 +310,15 @@ typedef struct //q1 client/network info F(float, GetTrackerOwnFrags, (int seat, char *text, size_t textsize)); F(void, GetPredInfo, (int seat, vec3_t outvel)); + F(void, ClearNotify, (void)); //called for fast map restarts. F(void, ClearClientState, (void)); //called at the start of map changes. F(void, SetLoadingState, (qboolean newstate)); //Change the client's loading screen state. F(void, UpdateGameTime, (double)); //tells the client an updated snapshot time for interpolation/timedrift. + + void (*ForceCheatVars) (qboolean semicheats, qboolean absolutecheats); + qboolean (*DownloadBegun)(qdownload_t *dl); + void (*DownloadFinished)(qdownload_t *dl); + downloadlist_t *(*DownloadFailed)(const char *name, qdownload_t *qdl, enum dlfailreason_e failreason); #define plugclientfuncs_name "Client" } plugclientfuncs_t; @@ -339,6 +345,11 @@ typedef struct //for menu-like stuff F(unsigned int, GetMoveCount, (void)); F(usercmd_t*, GetMoveEntry, (unsigned int move)); //GetMoveEntry(GetMoveCount()) gives you the partial entry. forgotten entries return NULL. + void (*ClipboardGet) (clipboardtype_t clipboardtype, void (*callback)(void *ctx, const char *utf8), void *ctx); + void (*ClipboardSet) (clipboardtype_t clipboardtype, const char *utf8); + unsigned int (*utf8_decode)(int *error, const void *in, char const**out); + unsigned int (*utf8_encode)(void *out, unsigned int unicode, int maxlen); + unsigned int (*GetKeyDest) (void); void (*KeyEvent) (unsigned int devid, int down, int keycode, int unicode); void (*MouseMove) (unsigned int devid, int abs, float x, float y, float z, float size); diff --git a/plugins/quake3/clq3_cg.c b/plugins/quake3/clq3_cg.c index 76fd0b9a..6043905d 100644 --- a/plugins/quake3/clq3_cg.c +++ b/plugins/quake3/clq3_cg.c @@ -384,7 +384,7 @@ qboolean CG_GetServerCommand(int cmdnum) if (!strcmp(arg0, "cs")) CG_InsertIntoGameState(atoi(cmdfuncs->Argv(1, NULL, 0)), cmdfuncs->Argv(2, NULL, 0)); else if (!strcmp(arg0, "map_restart")) - Con_ClearNotify(); + clientfuncs->ClearNotify(); else if (!strcmp(arg0, "disconnect")) plugfuncs->EndGame("Server disconnected - %s", (cmdfuncs->Argc()>1)?cmdfuncs->Argv(1, NULL, 0):"No reason given"); return true; diff --git a/plugins/quake3/clq3_parse.c b/plugins/quake3/clq3_parse.c index fd7079d2..7d8f70c9 100644 --- a/plugins/quake3/clq3_parse.c +++ b/plugins/quake3/clq3_parse.c @@ -7,22 +7,6 @@ #include "shader.h" #include "cl_master.h" -#ifndef STATIC_Q3 -void Cvar_ForceCheatVars(qboolean semicheats, qboolean absolutecheats){} //locks/unlocks cheat cvars depending on weather we are allowed them. - -void Con_ClearNotify (void){} - -unsigned int key_dest_mask; -void Sys_Clipboard_PasteText(clipboardtype_t clipboardtype, void (*callback)(void *cb, const char *utf8), void *ctx){}; //calls the callback once the text is available (maybe instantly). utf8 arg may be NULL if the clipboard was unavailable. -unsigned int utf8_decode(int *error, const void *in, char const**out){return 0;} - -char *CL_TryingToConnect(void){return NULL;} - -downloadlist_t *CL_DownloadFailed(const char *name, qdownload_t *qdl, enum dlfailreason_e failreason){return NULL;} -qboolean DL_Begun(qdownload_t *dl){return 0;} -void CL_DownloadFinished(qdownload_t *dl){} -#endif - //urm, yeah, this is more than just parse. #ifdef Q3CLIENT @@ -383,7 +367,7 @@ void CLQ3_ParseDownload(void) { //the only downloads we should be getting is pk3s. //if they're advertised-but-failing then its probably due to permissions rather than file-not-found s = msgfuncs->ReadString(); - CL_DownloadFailed(dl->remotename, dl, DLFAIL_SERVERCVAR); + clientfuncs->DownloadFailed(dl->remotename, dl, DLFAIL_SERVERCVAR); plugfuncs->EndGame("%s", s); return; } @@ -411,9 +395,9 @@ void CLQ3_ParseDownload(void) if (!dl->file) { - if (!DL_Begun(dl)) + if (!clientfuncs->DownloadBegun(dl)) { - CL_DownloadFailed(dl->remotename, dl, DLFAIL_CLIENTFILE); + clientfuncs->DownloadFailed(dl->remotename, dl, DLFAIL_CLIENTFILE); return; } } @@ -422,7 +406,7 @@ void CLQ3_ParseDownload(void) if (!chunksize) { - CL_DownloadFinished(dl); + clientfuncs->DownloadFinished(dl); ccs.servercount = -1; //make sure the server resends us that vital gamestate. ccs.downloadchunknum = -1; @@ -515,7 +499,7 @@ qboolean CLQ3_SystemInfoChanged(const char *str) Con_Printf("Server's sv_pure: \"%s\"\n", worldfuncs->GetInfoKey(str, "sv_pure")); usingpure = atoi(worldfuncs->GetInfoKey(str, "sv_pure")); usingcheats = atoi(worldfuncs->GetInfoKey(str, "sv_cheats")); - Cvar_ForceCheatVars(usingpure||usingcheats, usingcheats); + clientfuncs->ForceCheatVars(usingpure||usingcheats, usingcheats); // if (atoi(value)) // Host_EndGame("Unable to connect to Q3 Pure Servers\n"); @@ -909,7 +893,7 @@ void CLQ3_SendCmd(struct ftenet_connections_s *socket, usercmd_t *cmd, unsigned cmd->upmove = 100; cmd->buttons &= ~2; } - if (Key_Dest_Has(~kdm_game)) + if (inputfuncs->GetKeyDest() & ~kdm_game) cmd->buttons |= 2; //add in the 'at console' button //FIXME: q3 generates a new command every video frame, but a new packet at a more limited rate. diff --git a/plugins/quake3/clq3_ui.c b/plugins/quake3/clq3_ui.c index 2ee17322..4920eab6 100644 --- a/plugins/quake3/clq3_ui.c +++ b/plugins/quake3/clq3_ui.c @@ -835,7 +835,7 @@ static void UI_SimulateTextEntry(void *cb, const char *utf8) int err; while(*line) { - unicode = utf8_decode(&err, line, &line); + unicode = inputfuncs->utf8_decode(&err, line, &line); if (uivm) vmfuncs->Call(uivm, UI_KEY_EVENT, unicode|1024, true); } @@ -1089,7 +1089,7 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con //but do we really want to let mods read the system clipboard? I suppose it SHOULD be okay if the UI was manually installed by the user. //side note: q3's text entry logic is kinda flawed. - Sys_Clipboard_PasteText(CBT_CLIPBOARD, UI_SimulateTextEntry, NULL); + inputfuncs->ClipboardGet(CBT_CLIPBOARD, UI_SimulateTextEntry, NULL); break; case UI_KEY_KEYNUMTOSTRINGBUF: @@ -1124,7 +1124,7 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con inputfuncs->ClearKeyStates(); break; case UI_KEY_GETCATCHER: - if (Key_Dest_Has(kdm_console)) + if (inputfuncs->GetKeyDest() & kdm_console) VM_LONG(ret) = keycatcher | 1; else VM_LONG(ret) = keycatcher; @@ -1185,10 +1185,11 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con uiClientState_t *state = VM_POINTER(arg[0]); state->connectPacketCount = 0;//clc.connectPacketCount; + cvarfuncs->GetString("cl_servername", state->servername, sizeof(state->servername)); //server we're connected to switch(ccs.state) { case ca_disconnected: - if (CL_TryingToConnect()) + if (*state->servername) state->connState = Q3CA_CONNECTING; else state->connState = Q3CA_DISCONNECTED; @@ -1206,7 +1207,6 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con state->connState = Q3CA_ACTIVE; break; } - cvarfuncs->GetString("cl_servername", state->servername, sizeof(state->servername)); //error message from game server Q_strncpyz(state->updateInfoString, "FTE!", sizeof(state->updateInfoString)); //warning/motd message from update server cvarfuncs->GetString("com_errorMessage", state->messageString, sizeof(state->messageString)); //error message from game server state->clientNum = ccs.playernum; diff --git a/plugins/quake3/q3common.c b/plugins/quake3/q3common.c index 61b474a0..fb0433c3 100644 --- a/plugins/quake3/q3common.c +++ b/plugins/quake3/q3common.c @@ -347,7 +347,7 @@ int VM_GetFileList(const char *path, const char *ext, char *output, int buffersi #include "clq3defs.h" //okay, urr, this is bad for dedicated servers. urhum. Maybe they're not looking? It's only typedefs and one extern. #define MAX_VMQ3_CVARS 512 //can be blindly increased -cvar_t *q3cvlist[MAX_VMQ3_CVARS]; +static cvar_t *q3cvlist[MAX_VMQ3_CVARS]; int VMQ3_Cvar_Register(q3vmcvar_t *v, char *name, char *defval, int flags) { int i;