Skip to content

Commit

Permalink
Merged pull request "Sync with Q2PRO: Server-related tweaks": #428
Browse files Browse the repository at this point in the history
  • Loading branch information
apanteleev committed Feb 18, 2025
2 parents b3d0ba6 + d010209 commit 0153160
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion doc/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ jumping hack only for compatible clients).
#### `sv_waterjump_hack`
Makes underwater movement speed equal in all directions for clients using
Q2PRO protocol. Values higher than 1 will force this mode for all clients,
regardless of their protocol version. Default value is 0 (disabled).
regardless of their protocol version. Default value is 1 (enabled).

#### Water jump bug
Quake 2 player movement code contains a bug that causes surfacing velocity
Expand Down
28 changes: 18 additions & 10 deletions src/server/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void SV_SetMaster_f(void)
for (i = 0; i < MAX_MASTERS; i++) {
Z_Free(sv_masters[i].name);
}
memset(&sv_masters, 0, sizeof(sv_masters));
memset(sv_masters, 0, sizeof(sv_masters));

total = 0;
for (i = 1; i < Cmd_Argc(); i++) {
Expand Down Expand Up @@ -302,16 +302,21 @@ SV_DemoMap_f
Puts the server in demo mode on a specific map/cinematic
==================
*/
#if USE_CLIENT
static void SV_DemoMap_f(void)
{
Com_Printf("'%s' command is no longer supported.\n", Cmd_Argv(0));
#if USE_CLIENT
Com_Printf("To play a client demo, use 'demo' command instead.\n");
#endif
#if USE_MVD_CLIENT
Com_Printf("To play a MVD, use 'mvdplay' command.\n");
#endif
char *s = Cmd_Argv(1);

if (!COM_CompareExtension(s, ".dm2"))
Cbuf_InsertText(&cmd_buffer, va("demo \"%s\"\n", s));
else if (!COM_CompareExtension(s, ".cin"))
Cbuf_InsertText(&cmd_buffer, va("map \"%s\" force\n", s));
else if (*s)
Com_Printf("\"%s\" only supports .dm2 and .cin files\n", Cmd_Argv(0));
else
Com_Printf("Usage: %s <demo>\n", Cmd_Argv(0));
}
#endif

/*
==================
Expand Down Expand Up @@ -417,12 +422,13 @@ static void SV_Map_f(void)

static void SV_Map_c(genctx_t *ctx, int argnum)
{
unsigned flags = FS_SEARCH_SAVEPATH | FS_SEARCH_BYFILTER | FS_SEARCH_STRIPEXT;
if (argnum == 1) {
FS_File_g("maps", ".bsp", FS_SEARCH_STRIPEXT, ctx);
FS_File_g("maps", "*.bsp", flags, ctx);
const char *s = Cvar_VariableString("map_override_path");
if (*s) {
int pos = ctx->count;
FS_File_g(s, ".bsp.override", FS_SEARCH_STRIPEXT, ctx);
FS_File_g(s, "*.bsp.override", flags, ctx);
for (int i = pos; i < ctx->count; i++)
*COM_FileExtension(ctx->matches[i]) = 0;
}
Expand Down Expand Up @@ -1749,7 +1755,9 @@ static const cmdreg_t c_server[] = {
{ "stuffcvar", SV_StuffCvar_f, SV_SetPlayer_c },
{ "printall", SV_PrintAll_f },
{ "map", SV_Map_f, SV_Map_c },
#if USE_CLIENT
{ "demomap", SV_DemoMap_f },
#endif
{ "gamemap", SV_GameMap_f, SV_Map_c },
{ "dumpents", SV_DumpEnts_f },
{ "setmaster", SV_SetMaster_f },
Expand Down
2 changes: 1 addition & 1 deletion src/server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2213,7 +2213,7 @@ void SV_Init(void)
sv_max_packet_entities = Cvar_Get("sv_max_packet_entities", STRINGIFY(MAX_PACKET_ENTITIES), 0);

sv_strafejump_hack = Cvar_Get("sv_strafejump_hack", "1", CVAR_LATCH);
sv_waterjump_hack = Cvar_Get("sv_waterjump_hack", "0", CVAR_LATCH);
sv_waterjump_hack = Cvar_Get("sv_waterjump_hack", "1", CVAR_LATCH);

#if USE_PACKETDUP
sv_packetdup_hack = Cvar_Get("sv_packetdup_hack", "0", 0);
Expand Down

0 comments on commit 0153160

Please sign in to comment.