2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 01:47:45 +01:00
Night Owl 2017-07-05 23:50:55 +05:00
parent e98f45b279
commit cf5b2f9e14
6 changed files with 56 additions and 10 deletions

View File

@ -21,6 +21,7 @@
#include "hud.h"
#include "cl_util.h"
#include "netadr.h"
#include "parsemsg.h"
extern "C"
{
@ -32,10 +33,21 @@ extern "C"
cl_enginefunc_t gEngfuncs;
CHud gHUD;
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
@ -196,6 +208,8 @@ void DLLEXPORT HUD_Init( void )
{
InitInput();
gHUD.Init();
gEngfuncs.pfnHookUserMsg( "Bhopcap", __MsgFunc_Bhopcap );
}
/*

View File

@ -48,11 +48,15 @@ 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 int g_teamplay;
extern cvar_t bhopcap;
extern "C" int g_bhopcap;
void LinkUserMessages( void );
/*
@ -799,8 +803,16 @@ void StartFrame( void )
gpGlobals->teamplay = teamplay.value;
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 )
{

View File

@ -38,6 +38,7 @@ cvar_t teamlist = { "mp_teamlist","hgrunt;scientist", FCVAR_SERVER };
cvar_t teamoverride = { "mp_teamoverride","1" };
cvar_t defaultteam = { "mp_defaultteam","0" };
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
@ -473,6 +474,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &teamoverride );
CVAR_REGISTER( &defaultteam );
CVAR_REGISTER( &allowmonsters );
CVAR_REGISTER( &bhopcap );
CVAR_REGISTER( &mp_chattime );

View File

@ -45,6 +45,8 @@ 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);
@ -181,6 +183,7 @@ int gmsgSetFOV = 0;
int gmsgShowMenu = 0;
int gmsgGeigerRange = 0;
int gmsgTeamNames = 0;
int gmsgBhopcap = 0;
int gmsgStatusText = 0;
int gmsgStatusValue = 0;
@ -227,6 +230,7 @@ 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 );
@ -4072,6 +4076,15 @@ void CBasePlayer::UpdateClientData( void )
UpdateStatusBar();
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();
}
}
//=========================================================

View File

@ -313,13 +313,15 @@ public:
//Player ID
void InitStatusBar( void );
void UpdateStatusBar( void );
int m_izSBarState[ SBAR_END ];
int m_izSBarState[SBAR_END];
float m_flNextSBarUpdateTime;
float m_flStatusBarDisappearDelay;
char m_SbarString0[ SBAR_STRING_SIZE ];
char m_SbarString1[ SBAR_STRING_SIZE ];
char m_SbarString0[SBAR_STRING_SIZE];
char m_SbarString1[SBAR_STRING_SIZE];
float m_flNextChatTime;
bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message.
};
#define AUTOAIM_2DEGREES 0.0348994967025
@ -327,7 +329,7 @@ public:
#define AUTOAIM_8DEGREES 0.1391731009601
#define AUTOAIM_10DEGREES 0.1736481776669
extern int gmsgHudText;
extern int gmsgHudText;
extern BOOL gInitHUD;
#endif // PLAYER_H

View File

@ -27,11 +27,13 @@
#include <stdlib.h> // atoi
#include <ctype.h> // isspace
int g_bhopcap = 1;
#ifdef CLIENT_DLL
// Spectator Mode
int iJumpSpectator;
extern float vJumpOrigin[3];
extern float vJumpAngles[3];
// Spectator Mode
int iJumpSpectator;
extern float vJumpOrigin[3];
extern float vJumpAngles[3];
#endif
static int pm_shared_initialized = 0;
@ -2556,7 +2558,8 @@ void PM_Jump( void )
// In the air now.
pmove->onground = -1;
PM_PreventMegaBunnyJumping();
if( g_bhopcap )
PM_PreventMegaBunnyJumping();
if( tfc )
{