Skip to content

Commit

Permalink
SERVER: sync server changes from ezquake to mvdsv
Browse files Browse the repository at this point in the history
Missing PCRE2 changes since mvdsv still use PCRE1
  • Loading branch information
qqshka authored and Ivan Bolsunov committed Oct 22, 2023
1 parent 04a786e commit fb16acd
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 25 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion src/qwsvdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 6 additions & 0 deletions src/sv_ccmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ void SV_Map (qbool now)

changed = true;
#ifndef SERVERONLY
if (!com_serveractive) {
Host_EndGame();
}
com_serveractive = true;
#endif
}
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 7 additions & 4 deletions src/sv_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions src/sv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
12 changes: 8 additions & 4 deletions src/sv_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/sv_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 2 additions & 0 deletions src/sv_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -4276,6 +4277,7 @@ static void SV_DebugServerSideWeaponInstruction(client_t* cl)
}
}
}
#endif

static void SV_DebugServerSideWeaponScript(client_t* cl, int best_impulse)
{
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 0 additions & 9 deletions src/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)))


Expand Down
9 changes: 9 additions & 0 deletions src/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions src/vm_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "qwsvdef.h"
#else
#include "quakedef.h"
#include "pr_comp.h"
#include "g_public.h"
#endif
#include "vm_local.h"

Expand Down
2 changes: 1 addition & 1 deletion src/zone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions tools/old_mvs_files/mvdsv_vc2017.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release-NoAsm|Win32'">true</BrowseInformation>
</ClCompile>
<ClCompile Include="..\..\src\world.c">
<ClCompile Include="..\..\src\sv_world.c">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug-NoAsm|Win32'">Disabled</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='debug-noweb|Win32'">Disabled</Optimization>
Expand Down Expand Up @@ -1192,7 +1192,7 @@
<ClInclude Include="..\..\src\sv_windows.h" />
<ClInclude Include="..\..\src\sys.h" />
<ClInclude Include="..\..\src\version.h" />
<ClInclude Include="..\..\src\world.h" />
<ClInclude Include="..\..\src\sv_world.h" />
<ClInclude Include="..\..\src\hash.h" />
<ClInclude Include="..\..\src\vfs.h" />
<ClInclude Include="..\..\src\zone.h" />
Expand Down

0 comments on commit fb16acd

Please sign in to comment.