Night Owl 8 years ago
parent
commit
cf5b2f9e14
  1. 14
      cl_dll/cdll_int.cpp
  2. 14
      dlls/client.cpp
  3. 2
      dlls/game.cpp
  4. 13
      dlls/player.cpp
  5. 2
      dlls/player.h
  6. 3
      pm_shared/pm_shared.c

14
cl_dll/cdll_int.cpp

@ -21,6 +21,7 @@
#include "hud.h" #include "hud.h"
#include "cl_util.h" #include "cl_util.h"
#include "netadr.h" #include "netadr.h"
#include "parsemsg.h"
extern "C" extern "C"
{ {
@ -32,10 +33,21 @@ extern "C"
cl_enginefunc_t gEngfuncs; cl_enginefunc_t gEngfuncs;
CHud gHUD; CHud gHUD;
mobile_engfuncs_t *gMobileEngfuncs = NULL; mobile_engfuncs_t *gMobileEngfuncs = NULL;
extern "C" int g_bhopcap;
void InitInput( void ); void InitInput( void );
void EV_HookEvents( void ); void EV_HookEvents( void );
void IN_Commands( void ); void IN_Commands( void );
int __MsgFunc_Bhopcap( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
g_bhopcap = READ_BYTE();
return 1;
}
/* /*
========================== ==========================
Initialize Initialize
@ -196,6 +208,8 @@ void DLLEXPORT HUD_Init( void )
{ {
InitInput(); InitInput();
gHUD.Init(); gHUD.Init();
gEngfuncs.pfnHookUserMsg( "Bhopcap", __MsgFunc_Bhopcap );
} }
/* /*

14
dlls/client.cpp

@ -48,11 +48,15 @@ extern DLL_GLOBAL ULONG g_ulFrameCount;
extern void CopyToBodyQue( entvars_t* pev ); extern void CopyToBodyQue( entvars_t* pev );
extern int giPrecacheGrunt; extern int giPrecacheGrunt;
extern int gmsgSayText; extern int gmsgSayText;
extern int gmsgBhopcap;
extern cvar_t allow_spectators; extern cvar_t allow_spectators;
extern int g_teamplay; extern int g_teamplay;
extern cvar_t bhopcap;
extern "C" int g_bhopcap;
void LinkUserMessages( void ); void LinkUserMessages( void );
/* /*
@ -799,8 +803,16 @@ void StartFrame( void )
gpGlobals->teamplay = teamplay.value; gpGlobals->teamplay = teamplay.value;
g_ulFrameCount++; g_ulFrameCount++;
}
int oldBhopcap = g_bhopcap;
g_bhopcap = ( g_pGameRules->IsMultiplayer() && bhopcap.value != 0.0f ) ? 1 : 0;
if( g_bhopcap != oldBhopcap )
{
MESSAGE_BEGIN( MSG_ALL, gmsgBhopcap, NULL );
WRITE_BYTE( g_bhopcap );
MESSAGE_END();
}
}
void ClientPrecache( void ) void ClientPrecache( void )
{ {

2
dlls/game.cpp

@ -38,6 +38,7 @@ cvar_t teamlist = { "mp_teamlist","hgrunt;scientist", FCVAR_SERVER };
cvar_t teamoverride = { "mp_teamoverride","1" }; cvar_t teamoverride = { "mp_teamoverride","1" };
cvar_t defaultteam = { "mp_defaultteam","0" }; cvar_t defaultteam = { "mp_defaultteam","0" };
cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER }; cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER };
cvar_t bhopcap = { "mp_bhopcap", "1", FCVAR_SERVER };
cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators
@ -473,6 +474,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &teamoverride ); CVAR_REGISTER( &teamoverride );
CVAR_REGISTER( &defaultteam ); CVAR_REGISTER( &defaultteam );
CVAR_REGISTER( &allowmonsters ); CVAR_REGISTER( &allowmonsters );
CVAR_REGISTER( &bhopcap );
CVAR_REGISTER( &mp_chattime ); CVAR_REGISTER( &mp_chattime );

13
dlls/player.cpp

@ -45,6 +45,8 @@ extern DLL_GLOBAL BOOL g_fDrawLines;
int gEvilImpulse101; int gEvilImpulse101;
extern DLL_GLOBAL int g_iSkillLevel, gDisplayTitle; extern DLL_GLOBAL int g_iSkillLevel, gDisplayTitle;
extern "C" int g_bhopcap;
BOOL gInitHUD = TRUE; BOOL gInitHUD = TRUE;
extern void CopyToBodyQue( entvars_t *pev); extern void CopyToBodyQue( entvars_t *pev);
@ -181,6 +183,7 @@ int gmsgSetFOV = 0;
int gmsgShowMenu = 0; int gmsgShowMenu = 0;
int gmsgGeigerRange = 0; int gmsgGeigerRange = 0;
int gmsgTeamNames = 0; int gmsgTeamNames = 0;
int gmsgBhopcap = 0;
int gmsgStatusText = 0; int gmsgStatusText = 0;
int gmsgStatusValue = 0; int gmsgStatusValue = 0;
@ -227,6 +230,7 @@ void LinkUserMessages( void )
gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) ); gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) );
gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 ); gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 );
gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 ); gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 );
gmsgBhopcap = REG_USER_MSG( "Bhopcap", 1 );
gmsgStatusText = REG_USER_MSG( "StatusText", -1 ); gmsgStatusText = REG_USER_MSG( "StatusText", -1 );
gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 ); gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 );
@ -4072,6 +4076,15 @@ void CBasePlayer::UpdateClientData( void )
UpdateStatusBar(); UpdateStatusBar();
m_flNextSBarUpdateTime = gpGlobals->time + 0.2; m_flNextSBarUpdateTime = gpGlobals->time + 0.2;
} }
// Send the current bhopcap state.
if( !m_bSentBhopcap )
{
m_bSentBhopcap = true;
MESSAGE_BEGIN( MSG_ONE, gmsgBhopcap, NULL, pev );
WRITE_BYTE( g_bhopcap );
MESSAGE_END();
}
} }
//========================================================= //=========================================================

2
dlls/player.h

@ -320,6 +320,8 @@ public:
char m_SbarString1[SBAR_STRING_SIZE]; char m_SbarString1[SBAR_STRING_SIZE];
float m_flNextChatTime; float m_flNextChatTime;
bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message.
}; };
#define AUTOAIM_2DEGREES 0.0348994967025 #define AUTOAIM_2DEGREES 0.0348994967025

3
pm_shared/pm_shared.c

@ -27,6 +27,8 @@
#include <stdlib.h> // atoi #include <stdlib.h> // atoi
#include <ctype.h> // isspace #include <ctype.h> // isspace
int g_bhopcap = 1;
#ifdef CLIENT_DLL #ifdef CLIENT_DLL
// Spectator Mode // Spectator Mode
int iJumpSpectator; int iJumpSpectator;
@ -2556,6 +2558,7 @@ void PM_Jump( void )
// In the air now. // In the air now.
pmove->onground = -1; pmove->onground = -1;
if( g_bhopcap )
PM_PreventMegaBunnyJumping(); PM_PreventMegaBunnyJumping();
if( tfc ) if( tfc )

Loading…
Cancel
Save