Change bunnyhop cap via movevar.

This commit is contained in:
Andrey Akhmichin 2023-04-10 02:25:44 +05:00
parent a4a2b34386
commit aec0f79806
No known key found for this signature in database
GPG Key ID: BE329F7886439BC8
6 changed files with 8 additions and 44 deletions

View File

@ -50,20 +50,10 @@ TeamFortressViewport *gViewPort = NULL;
#endif
mobile_engfuncs_t *gMobileEngfuncs = NULL;
extern "C" int g_bhopcap;
void InitInput( void );
void EV_HookEvents( 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
@ -299,8 +289,6 @@ void DLLEXPORT HUD_Init( void )
#if USE_VGUI
Scheme_Init();
#endif
gEngfuncs.pfnHookUserMsg( "Bhopcap", __MsgFunc_Bhopcap );
}
/*

View File

@ -48,16 +48,12 @@ extern DLL_GLOBAL ULONG g_ulFrameCount;
extern void CopyToBodyQue( entvars_t* pev );
extern int giPrecacheGrunt;
extern int gmsgSayText;
extern int gmsgBhopcap;
extern cvar_t allow_spectators;
extern cvar_t multibyte_only;
extern int g_teamplay;
extern cvar_t bhopcap;
extern "C" int g_bhopcap;
void LinkUserMessages( void );
/*
@ -822,15 +818,6 @@ void StartFrame( void )
gpGlobals->teamplay = teamplay.value;
g_ulFrameCount++;
int oldBhopcap = g_bhopcap;
g_bhopcap = ( g_pGameRules && 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 )

View File

@ -42,6 +42,7 @@ extern cvar_t teamlist;
extern cvar_t teamoverride;
extern cvar_t defaultteam;
extern cvar_t allowmonsters;
extern cvar_t bhopcap;
// Engine Cvars
extern cvar_t *g_psv_gravity;

View File

@ -45,8 +45,6 @@ extern DLL_GLOBAL BOOL g_fDrawLines;
int gEvilImpulse101;
extern DLL_GLOBAL int g_iSkillLevel, gDisplayTitle;
extern "C" int g_bhopcap;
BOOL gInitHUD = TRUE;
extern void CopyToBodyQue( entvars_t *pev);
@ -183,7 +181,6 @@ int gmsgSetFOV = 0;
int gmsgShowMenu = 0;
int gmsgGeigerRange = 0;
int gmsgTeamNames = 0;
int gmsgBhopcap = 0;
int gmsgStatusText = 0;
int gmsgStatusValue = 0;
@ -230,7 +227,6 @@ void LinkUserMessages( void )
gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) );
gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 );
gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 );
gmsgBhopcap = REG_USER_MSG( "Bhopcap", 1 );
gmsgStatusText = REG_USER_MSG( "StatusText", -1 );
gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 );
@ -2816,6 +2812,7 @@ void CBasePlayer::Spawn( void )
g_engfuncs.pfnSetPhysicsKeyValue( edict(), "slj", "0" );
g_engfuncs.pfnSetPhysicsKeyValue( edict(), "hl", "1" );
g_engfuncs.pfnSetPhysicsKeyValue( edict(), "fr", "1" );
g_engfuncs.pfnSetPhysicsKeyValue( edict(), "bj", bhopcap.value ? "0" : "1" );
pev->fov = m_iFOV = 0;// init field of view.
m_iClientFOV = -1; // make sure fov reset is sent
@ -3347,7 +3344,6 @@ void CBasePlayer::ForceClientDllUpdate( void )
m_fWeapon = FALSE; // Force weapon send
m_fKnownItem = FALSE; // Force weaponinit messages.
m_fInitHUD = TRUE; // Force HUD gmsgResetHUD message
m_bSentBhopcap = true; // a1ba: Update bhopcap state
memset( m_rgAmmoLast, 0, sizeof( m_rgAmmoLast )); // a1ba: Force update AmmoX
@ -4114,15 +4110,6 @@ void CBasePlayer::UpdateClientData( void )
UpdateStatusBar();
m_flNextSBarUpdateTime = gpGlobals->time + 0.2f;
}
// Send the current bhopcap state.
if( !m_bSentBhopcap )
{
m_bSentBhopcap = true;
MESSAGE_BEGIN( MSG_ONE, gmsgBhopcap, NULL, pev );
WRITE_BYTE( g_bhopcap );
MESSAGE_END();
}
}
//=========================================================

View File

@ -328,8 +328,6 @@ public:
int m_iAutoWepSwitch;
Vector m_vecLastViewAngles;
bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message.
};
#define AUTOAIM_2DEGREES 0.0348994967025

View File

@ -31,8 +31,6 @@
#include "pm_movevars.h"
#include "pm_debug.h"
int g_bhopcap = 1;
#if CLIENT_DLL
// Spectator Mode
int iJumpSpectator;
@ -2481,6 +2479,8 @@ PM_Jump
void PM_Jump( void )
{
int i;
qboolean bunnyjump = false;
qboolean tfc = false;
qboolean cansuperjump = false;
@ -2564,7 +2564,10 @@ void PM_Jump( void )
// In the air now.
pmove->onground = -1;
if( g_bhopcap )
if( pmove->multiplayer )
bunnyjump = atoi( pmove->PM_Info_ValueForKey( pmove->physinfo, "bj" ) ) ? true : false;
if( !bunnyjump )
PM_PreventMegaBunnyJumping();
if( tfc )