Skip to content

Commit

Permalink
engine: client: rename CL_LegacyMode to CL_Protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Oct 8, 2024
1 parent 5efa687 commit 3a1bb12
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
5 changes: 5 additions & 0 deletions engine/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ int CL_IsDevOverviewMode( void )
return 0;
}

connprotocol_t CL_Protocol( void )
{
return cls.legacymode;
}

/*
===============
CL_CheckClientState
Expand Down
5 changes: 0 additions & 5 deletions engine/client/cl_parse_48.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,3 @@ void CL_LegacyPrecache_f( void )
MSG_WriteStringf( &cls.netchan.message, "begin %i", spawncount );
cls.signon = SIGNONS - 1;
}

qboolean CL_LegacyMode( void )
{
return cls.legacymode == PROTO_LEGACY;
}
8 changes: 0 additions & 8 deletions engine/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,6 @@ typedef enum
CL_CHANGELEVEL, // draw 'loading' during changelevel
} scrstate_t;

typedef enum
{
PROTO_CURRENT = 0, // Xash3D 49
PROTO_LEGACY = 1, // Xash3D 48
PROTO_QUAKE = 2, // Quake 15
PROTO_GOLDSRC = 3, // GoldSrc 48
} connprotocol_t;

typedef struct
{
char name[32];
Expand Down
18 changes: 18 additions & 0 deletions engine/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,15 @@ void HPAK_FlushHostQueue( void );
#define INPUT_DEVICE_JOYSTICK (1<<2)
#define INPUT_DEVICE_VR (1<<3)


typedef enum connprotocol_e
{
PROTO_CURRENT = 0, // Xash3D 49
PROTO_LEGACY, // Xash3D 48
PROTO_QUAKE, // Quake 15
PROTO_GOLDSRC, // GoldSrc 48
} connprotocol_t;

// shared calls
struct physent_s;
struct sv_client_s;
Expand Down Expand Up @@ -768,6 +777,15 @@ int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCom
char *va( const char *format, ... ) _format( 1 );
qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multiplayer );

#if !XASH_DEDICATED
connprotocol_t CL_Protocol( void );
#else
static inline connprotocol_t CL_Protocol( void )
{
return PROTO_CURRENT;
}
#endif

static inline qboolean Host_IsLocalGame( void )
{
if( SV_Active( ))
Expand Down
2 changes: 1 addition & 1 deletion engine/common/net_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ static qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size
memcpy( data, buf, ret );
*length = ret;
#if !XASH_DEDICATED
if( CL_LegacyMode( ))
if( CL_Protocol( ) == PROTO_LEGACY )
return NET_LagPacket( true, sock, from, length, data );

// check for split message
Expand Down
1 change: 0 additions & 1 deletion engine/common/net_ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ void NET_IP6BytesToNetadr( netadr_t *adr, const uint8_t *ip6 );
void NET_NetadrToIP6Bytes( uint8_t *ip6, const netadr_t *adr );

#if !XASH_DEDICATED
qboolean CL_LegacyMode( void );
int CL_GetSplitSize( void );
#endif

Expand Down

0 comments on commit 3a1bb12

Please sign in to comment.