Browse Source

engine: share playermove ClearPhysEnts function

pull/2/head
Alibek Omarov 2 years ago
parent
commit
787d3bc5dd
  1. 1
      engine/client/cl_game.c
  2. 3
      engine/client/cl_main.c
  3. 16
      engine/client/cl_pmove.c
  4. 1
      engine/client/client.h
  5. 1
      engine/common/pm_local.h
  6. 8
      engine/common/pm_trace.c
  7. 1
      engine/server/server.h
  8. 3
      engine/server/sv_init.c
  9. 8
      engine/server/sv_pmove.c

1
engine/client/cl_game.c

@ -2458,7 +2458,6 @@ pfnSetTraceHull @@ -2458,7 +2458,6 @@ pfnSetTraceHull
void GAME_EXPORT CL_SetTraceHull( int hull )
{
clgame.pmove->usehull = bound( 0, hull, 3 );
}
/*

3
engine/client/cl_main.c

@ -22,6 +22,7 @@ GNU General Public License for more details. @@ -22,6 +22,7 @@ GNU General Public License for more details.
#include "vgui_draw.h"
#include "library.h"
#include "vid_common.h"
#include "pm_local.h"
#define MAX_TOTAL_CMDS 32
#define MAX_CMD_BUFFER 8000
@ -1380,7 +1381,7 @@ void CL_ClearState( void ) @@ -1380,7 +1381,7 @@ void CL_ClearState( void )
CL_ClearEffects ();
CL_FreeEdicts ();
CL_ClearPhysEnts ();
PM_ClearPhysEnts( clgame.pmove );
NetAPI_CancelAllRequests();
// wipe the entire cl structure

16
engine/client/cl_pmove.c

@ -26,20 +26,6 @@ GNU General Public License for more details. @@ -26,20 +26,6 @@ GNU General Public License for more details.
#define MIN_PREDICTION_EPSILON 0.5f // complain if error is > this and we have cl_showerror set
#define MAX_PREDICTION_ERROR 64.0f // above this is assumed to be a teleport, don't smooth, etc.
/*
=============
CL_ClearPhysEnts
=============
*/
void CL_ClearPhysEnts( void )
{
clgame.pmove->numtouch = 0;
clgame.pmove->numvisent = 0;
clgame.pmove->nummoveent = 0;
clgame.pmove->numphysent = 0;
}
/*
=============
CL_PushPMStates
@ -807,7 +793,7 @@ void CL_InitClientMove( void ) @@ -807,7 +793,7 @@ void CL_InitClientMove( void )
clgame.pmove->Con_Printf = Con_Printf;
clgame.pmove->Sys_FloatTime = Sys_DoubleTime;
clgame.pmove->PM_StuckTouch = pfnStuckTouch;
clgame.pmove->PM_PointContents = PM_CL_PointContents;
clgame.pmove->PM_PointContents = (void*)PM_CL_PointContents;
clgame.pmove->PM_TruePointContents = pfnTruePointContents;
clgame.pmove->PM_HullPointContents = pfnHullPointContents;
clgame.pmove->PM_PlayerTrace = pfnPlayerTrace;

1
engine/client/client.h

@ -926,7 +926,6 @@ void CL_PopTraceBounds( void ); @@ -926,7 +926,6 @@ void CL_PopTraceBounds( void );
void CL_MoveSpectatorCamera( void );
void CL_SetLastUpdate( void );
void CL_RedoPrediction( void );
void CL_ClearPhysEnts( void );
void CL_PushPMStates( void );
void CL_PopPMStates( void );
void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );

1
engine/common/pm_local.h

@ -30,6 +30,7 @@ void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int @@ -30,6 +30,7 @@ void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int
// pm_trace.c
//
void Pmove_Init( void );
void PM_ClearPhysEnts( playermove_t *pmove );
void PM_InitBoxHull( void );
hull_t *PM_HullForBsp( physent_t *pe, playermove_t *pmove, float *offset );
qboolean PM_RecursiveHullCheck( hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, pmtrace_t *trace );

8
engine/common/pm_trace.c

@ -55,6 +55,14 @@ void Pmove_Init( void ) @@ -55,6 +55,14 @@ void Pmove_Init( void )
memcpy( host.player_maxs, pm_hullmaxs, sizeof( pm_hullmaxs ));
}
void PM_ClearPhysEnts( playermove_t *pmove )
{
pmove->nummoveent = 0;
pmove->numphysent = 0;
pmove->numvisent = 0;
pmove->numtouch = 0;
}
/*
===================
PM_InitBoxHull

1
engine/server/server.h

@ -697,6 +697,5 @@ void SV_RunLightStyles( void ); @@ -697,6 +697,5 @@ void SV_RunLightStyles( void );
void SV_SetLightStyle( int style, const char* s, float f );
const char *SV_GetLightStyle( int style );
int SV_LightForEntity( edict_t *pEdict );
void SV_ClearPhysEnts( void );
#endif//SERVER_H

3
engine/server/sv_init.c

@ -18,6 +18,7 @@ GNU General Public License for more details. @@ -18,6 +18,7 @@ GNU General Public License for more details.
#include "net_encode.h"
#include "library.h"
#include "voice.h"
#include "pm_local.h"
#if XASH_LOW_MEMORY != 2
int SV_UPDATE_BACKUP = SINGLEPLAYER_BACKUP;
@ -651,7 +652,7 @@ void SV_DeactivateServer( void ) @@ -651,7 +652,7 @@ void SV_DeactivateServer( void )
SV_FreeEdicts ();
SV_ClearPhysEnts ();
PM_ClearPhysEnts( svgame.pmove );
SV_EmptyStringPool();

8
engine/server/sv_pmove.c

@ -22,14 +22,6 @@ GNU General Public License for more details. @@ -22,14 +22,6 @@ GNU General Public License for more details.
static qboolean has_update = false;
void SV_ClearPhysEnts( void )
{
svgame.pmove->numtouch = 0;
svgame.pmove->numvisent = 0;
svgame.pmove->nummoveent = 0;
svgame.pmove->numphysent = 0;
}
qboolean SV_PlayerIsFrozen( edict_t *pClient )
{
if( sv_background_freeze.value && sv.background )

Loading…
Cancel
Save