From 2a445343ad4514a539770f820eb970df1a43d477 Mon Sep 17 00:00:00 2001 From: qqshka Date: Sun, 22 Oct 2023 18:45:05 +0400 Subject: [PATCH] SERVER: sync server changes from ezquake to mvdsv Missing PCRE2 changes since mvdsv still use PCRE1 --- CMakeLists.txt | 2 +- src/qwsvdef.h | 2 +- src/sv_ccmds.c | 6 ++++++ src/sv_init.c | 11 +++++++---- src/sv_main.c | 2 ++ src/sv_save.c | 12 ++++++++---- src/sv_send.c | 4 ++-- src/sv_user.c | 2 ++ src/{world.c => sv_world.c} | 0 src/{world.h => sv_world.h} | 0 src/sys.h | 9 --------- src/vm.h | 9 +++++++++ src/vm_x86.c | 2 ++ src/zone.c | 2 +- src/zone.h | 2 +- tools/old_mvs_files/mvdsv_vc2017.vcxproj | 4 ++-- 16 files changed, 44 insertions(+), 25 deletions(-) rename src/{world.c => sv_world.c} (100%) rename src/{world.h => sv_world.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c9ff644..869a2a3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,7 @@ set(SRC_COMMON "${DIR_SRC}/sv_user.c" "${DIR_SRC}/vfs_os.c" "${DIR_SRC}/vfs_pak.c" - "${DIR_SRC}/world.c" + "${DIR_SRC}/sv_world.c" "${DIR_SRC}/zone.c" ) diff --git a/src/qwsvdef.h b/src/qwsvdef.h index 5921f6ee..b1f9bbe7 100644 --- a/src/qwsvdef.h +++ b/src/qwsvdef.h @@ -78,7 +78,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "server.h" -#include "world.h" +#include "sv_world.h" #include "pmove.h" #include "log.h" diff --git a/src/sv_ccmds.c b/src/sv_ccmds.c index 39fdab35..e85b7b5c 100644 --- a/src/sv_ccmds.c +++ b/src/sv_ccmds.c @@ -496,6 +496,9 @@ void SV_Map (qbool now) changed = true; #ifndef SERVERONLY + if (!com_serveractive) { + Host_EndGame(); + } com_serveractive = true; #endif } @@ -1830,7 +1833,10 @@ void SV_InitOperatorCommands (void) Cmd_AddCommand ("snap", SV_Snap_f); Cmd_AddCommand ("snapall", SV_SnapAll_f); Cmd_AddCommand ("kick", SV_Kick_f); + + // Add sv_status as client allows 'status' alias to over-ride (ezQuake #532) Cmd_AddCommand ("status", SV_Status_f); + Cmd_AddCommand ("sv_status", SV_Status_f); //bliP: init -> Cmd_AddCommand ("rmdir", SV_RemoveDirectory_f); diff --git a/src/sv_init.c b/src/sv_init.c index 14c26476..806b11c6 100644 --- a/src/sv_init.c +++ b/src/sv_init.c @@ -22,6 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef CLIENTONLY #include "qwsvdef.h" +#ifndef SERVERONLY +void CL_ClearState(void); +void CL_ClearQueuedPackets(void); +#endif + server_static_t svs; // persistent server info server_t sv; // local server demo_t demo; // server demo struct @@ -214,9 +219,6 @@ void SV_SpawnServer(char *mapname, qbool devmap, char* entityfile, qbool loading char oldmap[MAP_NAME_LEN]; extern qbool sv_allow_cheats; extern cvar_t sv_cheats, sv_paused, sv_bigcoords; -#ifndef SERVERONLY - extern void CL_ClearState (void); -#endif // store old map name snprintf (oldmap, MAP_NAME_LEN, "%s", sv.mapname); @@ -630,7 +632,8 @@ void SV_SpawnServer(char *mapname, qbool devmap, char* entityfile, qbool loading SV_MVD_Record(NULL, true); #ifndef SERVERONLY - CL_ClearState (); + CL_ClearState(); + CL_ClearQueuedPackets(); #endif } diff --git a/src/sv_main.c b/src/sv_main.c index 8c7a018f..97935baf 100644 --- a/src/sv_main.c +++ b/src/sv_main.c @@ -3503,7 +3503,9 @@ void SV_InitLocal (void) #endif Cvar_Register (&sv_extlimits); +#ifdef MVD_PEXT1_SERVERSIDEWEAPON Cvar_Register (&sv_pext_mvdsv_serversideweapon); +#endif Cvar_Register (&sv_reliable_sound); diff --git a/src/sv_save.c b/src/sv_save.c index 64da507b..536c52f4 100644 --- a/src/sv_save.c +++ b/src/sv_save.c @@ -36,14 +36,18 @@ extern cvar_t maxclients; #define SAVEGAME_COMMENT_LENGTH 39 #define SAVEGAME_VERSION 6 +#ifdef SERVERONLY static void SV_SaveGameFileName(char* buffer, int buffer_size, char* name) { -#ifdef SERVERONLY - snprintf (buffer, buffer_size, "%s/save/%s", fs_gamedir, name); + snprintf(buffer, buffer_size, "%s/save/%s", fs_gamedir, name); +} #else - snprintf (buffer, buffer_size, "%s/save/%s", com_gamedir, name); -#endif +static void SV_SaveGameFileName(char* buffer, int buffer_size, char* name) +{ + FS_SaveGameDirectory(buffer, buffer_size); + strlcat(buffer, name, buffer_size); } +#endif //Writes a SAVEGAME_COMMENT_LENGTH character comment void SV_SavegameComment (char *buffer) { diff --git a/src/sv_send.c b/src/sv_send.c index 4101b6e8..ce987e76 100644 --- a/src/sv_send.c +++ b/src/sv_send.c @@ -646,8 +646,8 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume, floa if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION) channel |= SND_ATTENUATION; - // use the entity origin unless it is a bmodel - if (entity->v->solid == SOLID_BSP) + // use the entity origin unless it is a bmodel or a trigger + if (entity->v->solid == SOLID_BSP || (entity->v->solid == SOLID_TRIGGER && entity->v->modelindex == 0)) { for (i=0 ; i<3 ; i++) origin[i] = entity->v->origin[i]+0.5*(entity->v->mins[i]+entity->v->maxs[i]); diff --git a/src/sv_user.c b/src/sv_user.c index d8e14c86..71f6d70d 100644 --- a/src/sv_user.c +++ b/src/sv_user.c @@ -4241,6 +4241,7 @@ static void SV_DebugClientSideWeaponScript(client_t* cl) SV_DebugWriteWeaponScript(playernum, false, items, shells, nails, rockets, cells, choice, weaponlist); } +#ifdef MVD_PEXT1_SERVERSIDEWEAPON static void SV_DebugServerSideWeaponInstruction(client_t* cl) { if (sv_debug_weapons.value >= 1) { @@ -4276,6 +4277,7 @@ static void SV_DebugServerSideWeaponInstruction(client_t* cl) } } } +#endif static void SV_DebugServerSideWeaponScript(client_t* cl, int best_impulse) { diff --git a/src/world.c b/src/sv_world.c similarity index 100% rename from src/world.c rename to src/sv_world.c diff --git a/src/world.h b/src/sv_world.h similarity index 100% rename from src/world.h rename to src/sv_world.h diff --git a/src/sys.h b/src/sys.h index 34cbf354..ce950cd1 100644 --- a/src/sys.h +++ b/src/sys.h @@ -88,15 +88,6 @@ void Sys_Sleep (unsigned long ms); int Sys_Script (const char *path, const char *args); -typedef union floatint_u -{ - int i; - unsigned int u; - float f; - byte b[4]; -} -floatint_t; - #define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x))) diff --git a/src/vm.h b/src/vm.h index 6b309813..9fedfb54 100644 --- a/src/vm.h +++ b/src/vm.h @@ -69,6 +69,15 @@ void *VM_ExplicitArgPtr( vm_t *vm, intptr_t intValue ); intptr_t VM_Ptr2VM( void* ptr ) ; intptr_t VM_ExplicitPtr2VM( vm_t *vm, void* ptr ); +typedef union floatint_u +{ + int i; + unsigned int u; + float f; + byte b[4]; +} +floatint_t; + #define VMA(x) VM_ArgPtr(args[x]) static inline float _vmf(intptr_t x) { diff --git a/src/vm_x86.c b/src/vm_x86.c index f3f623b5..bdd384a9 100644 --- a/src/vm_x86.c +++ b/src/vm_x86.c @@ -21,6 +21,8 @@ #include "qwsvdef.h" #else #include "quakedef.h" +#include "pr_comp.h" +#include "g_public.h" #endif #include "vm_local.h" diff --git a/src/zone.c b/src/zone.c index aac9d622..1cf2c7f5 100644 --- a/src/zone.c +++ b/src/zone.c @@ -285,7 +285,7 @@ Hunk_TempFlush Free the temporary memory zone to baseline. ================= */ -void Hunk_TempFlush() +void Hunk_TempFlush(void) { if (hunk_tempactive) { Hunk_FreeToHighMark(hunk_tempmark); diff --git a/src/zone.h b/src/zone.h index fa8a3888..056d9ca5 100644 --- a/src/zone.h +++ b/src/zone.h @@ -88,7 +88,7 @@ void *Hunk_AllocName (int size, const char *name); int Hunk_LowMark (void); void Hunk_FreeToLowMark (int mark); -void Hunk_TempFlush(); +void Hunk_TempFlush(void); void *Hunk_TempAlloc (int size); void *Hunk_TempAllocMore(int size); diff --git a/tools/old_mvs_files/mvdsv_vc2017.vcxproj b/tools/old_mvs_files/mvdsv_vc2017.vcxproj index db263e35..f82401b1 100644 --- a/tools/old_mvs_files/mvdsv_vc2017.vcxproj +++ b/tools/old_mvs_files/mvdsv_vc2017.vcxproj @@ -1086,7 +1086,7 @@ true true - + Disabled Disabled Disabled @@ -1192,7 +1192,7 @@ - +