From 2d9ec83c208390acacd1b71f931cc786d932263a Mon Sep 17 00:00:00 2001 From: Shpoike Date: Fri, 20 Jan 2023 02:04:26 +0000 Subject: [PATCH] Fix some build targets, fix csqc's setpause builtin. --- engine/client/cl_pred.c | 3 ++- engine/client/cl_screen.c | 2 +- engine/client/in_generic.c | 6 +++++- engine/server/pr_cmds.c | 4 +++- engine/server/sv_main.c | 6 +++++- engine/server/sv_sys_win.c | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/engine/client/cl_pred.c b/engine/client/cl_pred.c index 4e57aef62..233d133fa 100644 --- a/engine/client/cl_pred.c +++ b/engine/client/cl_pred.c @@ -615,7 +615,8 @@ void CL_CalcClientTime(void) { if (!cls.state) { - cl.servertime += host_frametime; + if (!cl.implicitpause) + cl.servertime += host_frametime; cl.time = cl.servertime; return; } diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index f3787c86f..057d0f694 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -1399,7 +1399,7 @@ const char *SCR_ShowPics_ClickCommand(float cx, float cy, qboolean istouch) float x, y, w, h; showpic_t *sp; mpic_t *p; - qboolean tryload = !showpics_touchtime; + qboolean tryload = istouch && !showpics_touchtime; float bestdist = istouch?16:1; const char *best = NULL; showpics_touchtime = realtime; diff --git a/engine/client/in_generic.c b/engine/client/in_generic.c index 223f1561a..8b50da45a 100644 --- a/engine/client/in_generic.c +++ b/engine/client/in_generic.c @@ -745,8 +745,10 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum, float frame mx *= 1.75; my *= 1.75; +#ifdef QUAKESTATS if (IN_WeaponWheelAccumulate(pnum, mx, my, 0)) - mx = my = 0; + mx = my = 0; +#endif } } else @@ -1017,10 +1019,12 @@ void IN_MoveJoystick(struct joy_s *joy, float *movements, int pnum, float framet } } +#ifdef QUAKESTATS if (IN_WeaponWheelAccumulate(joy->qdeviceid, jstrafe[1]*50, -jstrafe[0]*50, 20)) jstrafe[0] = jstrafe[1] = 0; if (IN_WeaponWheelAccumulate(joy->qdeviceid, jlook[1]*50, jlook[0]*50, 20)) jlook[0] = jlook[1] = 0; +#endif if (Key_Dest_Has(~kdm_game)) { diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 4c9903f9d..4008594e6 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -12201,7 +12201,9 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs // {"delayedparticle", PF_Fixme, 0, 0, 0, 528, D("float(vector org, vector vel, float delay, float collisiondelay, optional float theme)","Basically just extra args for 'particle'.")}, {"loadfromdata", PF_loadfromdata, 0, 0, 0, 529, D("void(string s)", "Reads a set of entities from the given string. This string should have the same format as a .ent file or a saved game. Entities will be spawned as required. If you need to see the entities that were created, you should use parseentitydata instead.")}, {"loadfromfile", PF_loadfromfile, 0, 0, 0, 530, D("void(string s)", "Reads a set of entities from the named file. This file should have the same format as a .ent file or a saved game. Entities will be spawned as required. If you need to see the entities that were created, you should use parseentitydata instead.")}, - {"setpause", PF_setpause, 0, 0, 0, 531, D("void(float pause)", "Sets whether the server should or should not be paused. This does not affect auto-paused things like when the console is down.")}, + {"setpause", PF_setpause, 0, 0, 0, 531, D("void(float pause)", "SSQC: Sets whether the server should or should not be paused.\n" + "CSQC: Only works in singleplayer, suitable for menu auto-pause. To pause in multiplayer use eg localcmd(\"cmd pause\n\") to ask the server side to pause.\n" + "Pause state between modules will be ORed, along with engine reasons for auto pausing.")}, //end dp extras //begin mvdsv extras #ifdef HAVE_LEGACY diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 89a14f5ad..1fd6e6cbd 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -5380,7 +5380,11 @@ float SV_Frame (void) #endif #ifdef HAVE_CLIENT - isidle = !isDedicated && sv.allocated_client_slots == 1 && (Key_Dest_Has(~kdm_game) || IN_WeaponWheelIsShown()) && cls.state == ca_active && !cl.implicitpause; + isidle = !isDedicated && sv.allocated_client_slots == 1 && (Key_Dest_Has(~kdm_game) +#ifdef QUAKESTATS + || IN_WeaponWheelIsShown() +#endif + || cl.implicitpause) && cls.state == ca_active; /*server is effectively paused in SP/coop if there are no clients/spectators*/ if (sv.spawned_client_slots == 0 && sv.spawned_observer_slots == 0 && !deathmatch.ival) isidle = true; diff --git a/engine/server/sv_sys_win.c b/engine/server/sv_sys_win.c index dbdf36a16..06a5ee1fc 100644 --- a/engine/server/sv_sys_win.c +++ b/engine/server/sv_sys_win.c @@ -753,6 +753,38 @@ int Sys_EnumerateFiles (const char *gpath, const char *match, int (QDECL *func)( return Sys_EnumerateFiles2(fullmatch, start, start, func, parm, spath); } +//wide only. we let the windows api sort out the mess of file urls. system-wide consistancy. +qboolean Sys_ResolveFileURL(const char *inurl, int inlen, char *out, int outlen) +{ + char *cp; + wchar_t wurl[MAX_PATH]; + wchar_t local[MAX_PATH]; + DWORD grr; + static HRESULT (WINAPI *pPathCreateFromUrlW)(PCWSTR pszUrl, PWSTR pszPath, DWORD *pcchPath, DWORD dwFlags); + if (!pPathCreateFromUrlW) + pPathCreateFromUrlW = Sys_GetAddressForName(Sys_LoadLibrary("Shlwapi.dll", NULL), "PathCreateFromUrlW"); + if (!pPathCreateFromUrlW) + return false; + + //need to make a copy, because we can't terminate the inurl easily. + cp = malloc(inlen+1); + memcpy(cp, inurl, inlen); + cp[inlen] = 0; + widen(wurl, sizeof(wurl), cp); + free(cp); + grr = sizeof(local)/sizeof(wchar_t); + if (FAILED(pPathCreateFromUrlW(wurl, local, &grr, 0))) + return false; + narrowen(out, outlen, local); + while(*out) + { + if (*out == '\\') + *out = '/'; + out++; + } + return true; +} + /* ================ Sys_Error