Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0.0-alpha3 #59

Merged
merged 9 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions mp/src/game/client/ff/c_ff_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ extern IFileSystem** pFilesystem;
// Need this to remove the HUD context menus on spawn
extern void HudContextForceClose();

// this needs to match the value from ff_player.cpp!!
// the values should match with ff_player.cpp!!
// grenade information
//ConVar gren_timer("ffdev_gren_timer","3.81",0,"Timer length for all grenades.");
#define GREN_TIMER 3.81f
//ConVar gren_throw_delay("ffdev_throw_delay","0.5",0,"Delay before primed grenades can be thrown.");
#define GREN_THROW_DELAY 0.5f

// #0000331: impulse 81 not working (weapon_cubemap)
Expand Down Expand Up @@ -432,7 +436,7 @@ bool CC_PrimeOne(const CCommand& args)

// dexter: uncomment this timer - use to to manage our number of active grenade sounds fuck
/* JUST KIDDING IT DOESNT WORK
C_FFTimer *pTimer = g_FFTimers.Create("PrimeGren", 3.81f);
C_FFTimer *pTimer = g_FFTimers.Create("PrimeGren", GREN_TIMER);
if (pTimer)
{
pTimer->m_bRemoveWhenExpired = true;
Expand All @@ -459,7 +463,7 @@ bool CC_PrimeOne(const CCommand& args)
pLocalPlayer->EmitSound(filter, pLocalPlayer->entindex(), params);

Assert(g_pGrenade1Timer);
g_pGrenade1Timer->SetTimer(3.81f);
g_pGrenade1Timer->SetTimer(GREN_TIMER);

// dexter: increase their active nade sound
//pLocalPlayer->m_iActiveGrenTimers++;
Expand Down Expand Up @@ -547,7 +551,7 @@ bool CC_PrimeTwo(const CCommand& args)
pLocalPlayer->EmitSound(filter, pLocalPlayer->entindex(), params);

Assert(g_pGrenade2Timer);
g_pGrenade2Timer->SetTimer(3.81f);
g_pGrenade2Timer->SetTimer(GREN_TIMER);

// Tracks gren prime time to see if a player released the grenade right away (unprimed)
pLocalPlayer->m_flGrenPrimeTime = gpGlobals->curtime;
Expand Down Expand Up @@ -881,6 +885,7 @@ RecvPropBool(RECVINFO(m_bCanUseJetpack)),
RecvPropInt(RECVINFO(m_bCanDoubleJump)),
RecvPropTime(RECVINFO(m_flNextJumpTimeForDouble)),
RecvPropTime(RECVINFO(m_flLastSpawnTime)),
RecvPropBool(RECVINFO(m_bClassicViewModelsParity)),
END_RECV_TABLE()

BEGIN_PREDICTION_DATA(C_FFPlayer)
Expand All @@ -890,7 +895,8 @@ DEFINE_PRED_FIELD(m_iJetpackFuel, FIELD_INTEGER, FTYPEDESC_INSENDTABLE),
DEFINE_PRED_FIELD(m_flNextClassSpecificSkill, FIELD_FLOAT, FTYPEDESC_INSENDTABLE),
DEFINE_PRED_FIELD(m_flJetpackNextFuelRechargeTime, FIELD_FLOAT, FTYPEDESC_OVERRIDE | FTYPEDESC_PRIVATE | FTYPEDESC_NOERRORCHECK),
DEFINE_PRED_FIELD(m_bCanDoubleJump, FIELD_BOOLEAN, FTYPEDESC_OVERRIDE ),
DEFINE_PRED_FIELD_TOL(m_flNextJumpTimeForDouble, FIELD_FLOAT, FTYPEDESC_OVERRIDE | FTYPEDESC_NOERRORCHECK, TD_MSECTOLERANCE)
DEFINE_PRED_FIELD_TOL(m_flNextJumpTimeForDouble, FIELD_FLOAT, FTYPEDESC_OVERRIDE | FTYPEDESC_NOERRORCHECK, TD_MSECTOLERANCE),
DEFINE_PRED_FIELD(m_iGrenadeState, FIELD_INTEGER, FTYPEDESC_INSENDTABLE)
END_PREDICTION_DATA()

class C_FFRagdoll : public C_BaseAnimatingOverlay
Expand Down Expand Up @@ -1313,6 +1319,9 @@ C_FFPlayer::C_FFPlayer() :

m_bMathackDetected = false;

m_bClassicViewModels = false;
m_bClassicViewModelsParity = false;

// dexter - hook up a lua client relevent message
usermessages->HookMessage("FFStopGrenTimers", &StopGrenTimersListener);

Expand Down Expand Up @@ -1546,6 +1555,8 @@ extern void ClearStatusIcons();
//-----------------------------------------------------------------------------
void C_FFPlayer::Spawn(void)
{
m_bClassicViewModels = m_bClassicViewModelsParity;

// Okay, not calling the base spawn when this was created
// was breaking a lot of stuff.
if (m_bFirstSpawn)
Expand Down Expand Up @@ -2714,6 +2725,12 @@ void C_FFPlayer::ClientThink(void)
}
}

// see CFFPlayer::GrenadeThink()
if (m_iGrenadeState != 0 && m_flGrenPrimeTime > 0 && gpGlobals->curtime - m_flGrenPrimeTime >= GREN_TIMER)
{
CC_ThrowGren();
}

_mathackman.Update();

BaseClass::ClientThink();
Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/client/ff/c_ff_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@ class C_FFPlayer : public C_BasePlayer, public IFFPlayerAnimStateHelpers
public:
CNetworkVar(float, m_flLastSpawnTime);
float GetNextCloak() { return m_flNextCloak; }
bool m_bClassicViewModels;
CNetworkVar(bool, m_bClassicViewModelsParity);
};

// Just straight up copying the server version. Tired
Expand Down
4 changes: 1 addition & 3 deletions mp/src/game/client/hud_crosshair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,7 @@ void CHudCrosshair::Paint(void)
x = ScreenWidth() / 2;
y = ScreenHeight() / 2;

float x_chargebar, y_chargebar;
x_chargebar = ScreenWidth() / 2;
y_chargebar = ScreenHeight() / 2;
float x_chargebar = x, y_chargebar = y;

// MattB - m_vecCrossHairOffsetAngle is the autoaim angle.
// if we're not using autoaim, just draw in the middle of the
Expand Down
5 changes: 5 additions & 0 deletions mp/src/game/server/ff/ff_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ IMPLEMENT_SERVERCLASS_ST( CFFPlayer, DT_FFPlayer )
SendPropBool(SENDINFO(m_bCanDoubleJump)),
SendPropTime(SENDINFO(m_flNextJumpTimeForDouble)),
SendPropTime(SENDINFO(m_flLastSpawnTime)),
SendPropBool(SENDINFO(m_bClassicViewModelsParity)),
END_SEND_TABLE( )

LINK_ENTITY_TO_CLASS( ff_ragdoll, CFFRagdoll );
Expand Down Expand Up @@ -634,6 +635,8 @@ CFFPlayer::CFFPlayer()
//m_iStatsID = -1;
m_bRequireRePressBuildable = false;
m_bQueueDetonation = false;
m_bClassicViewModels = false;
m_bClassicViewModelsParity = false;
}

CFFPlayer::~CFFPlayer()
Expand Down Expand Up @@ -1369,6 +1372,8 @@ void CFFPlayer::Spawn( void )
m_iSabotagedSentries = 0;
m_iSabotagedDispensers = 0;

m_bClassicViewModels = m_bClassicViewModelsParity;

// If we get spawned, kill any primed grenades!
ResetGrenadeState();

Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/server/ff/ff_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,8 @@ class CFFPlayer : public CBasePlayer, public IFFPlayerAnimStateHelpers
bool m_bRequireRePressBuildable;
CNetworkVar(float, m_flLastSpawnTime);
bool m_bQueueDetonation;
bool m_bClassicViewModels;
CNetworkVar(bool, m_bClassicViewModelsParity);
};

inline CFFPlayer *ToFFPlayer( CBaseEntity *pEntity )
Expand Down
20 changes: 20 additions & 0 deletions mp/src/game/shared/ff/ff_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ ConVar mp_friendlyfire_armorstrip( "mp_friendlyfire_armorstrip",


#ifdef CLIENT_DLL
ConVar cl_classic_viewmodels( "cl_classic_viewmodels", "0", FCVAR_ARCHIVE | FCVAR_USERINFO );

#else
ConVar sv_force_classic_viewmodels( "sv_force_classic_viewmodels", "0", FCVAR_REPLICATED );

// --> Mirv: Class limits

Expand Down Expand Up @@ -479,6 +481,23 @@ ConVar mp_friendlyfire_armorstrip( "mp_friendlyfire_armorstrip",
func.CallFunction( "player_namechange" );
}

CFFPlayer *pFFPlayer = ToFFPlayer( pPlayer );
if( pFFPlayer )
{
if( sv_force_classic_viewmodels.GetBool() )
{
pFFPlayer->m_bClassicViewModelsParity = true;
}
else
{
const char *pszViewmodel = engine->GetClientConVarValue( pPlayer->entindex(), "cl_classic_viewmodels" );
if( pszViewmodel && pszViewmodel[0] )
{
pFFPlayer->m_bClassicViewModelsParity = Q_atoi( pszViewmodel ) ? true : false;
}
}
}

BaseClass::ClientSettingsChanged( pPlayer );
}

Expand Down Expand Up @@ -636,6 +655,7 @@ ConVar mp_friendlyfire_armorstrip( "mp_friendlyfire_armorstrip",
pPlayer->ResetFortPointsCount();
pPlayer->ResetDeathCount();
pPlayer->ResetAsisstsCount();
FF_SendStopGrenTimerMessage(pPlayer);

if( FF_IsPlayerSpec( pPlayer ) )
continue;
Expand Down
23 changes: 23 additions & 0 deletions mp/src/game/shared/ff/weapons/ff_weapon_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ void CFFWeaponBase::Spawn()
CBaseCombatWeapon::Spawn();
}

void CFFWeaponBase::Precache()
{
BaseClass::Precache();

#ifdef GAME_DLL
PrecacheModel( GetNewViewModel() );
#endif
}

//----------------------------------------------------------------------------
// Purpose: All weapons use the same silence sound
//----------------------------------------------------------------------------
Expand Down Expand Up @@ -213,6 +222,20 @@ CFFPlayer * CFFWeaponBase::GetPlayerOwner() const
return ToFFPlayer(GetOwner());
}

const char *CFFWeaponBase::GetViewModel( int /*viewmodelindex = 0 -- this is ignored in the base class here*/ ) const
{
CFFPlayer *pFFPlayer = GetPlayerOwner();
if( pFFPlayer && !pFFPlayer->m_bClassicViewModels )
return GetNewViewModel();

return GetWpnData().szViewModel;
}

const char *CFFWeaponBase::GetNewViewModel( int /*viewmodelindex = 0 -- this is ignored in the base class here*/ ) const
{
return GetFFWpnData().szNewViewModel;
}

const char *CFFWeaponBase::GetWorldModel( void ) const
{
#ifdef CLIENT_DLL
Expand Down
3 changes: 3 additions & 0 deletions mp/src/game/shared/ff/weapons/ff_weapon_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class CFFWeaponBase : public CBaseCombatWeapon
#endif

virtual void Spawn( void );
virtual void Precache( void );

// All FF weapons are predicted
virtual bool IsPredicted() const { return true; }
Expand Down Expand Up @@ -251,6 +252,8 @@ class CFFWeaponBase : public CBaseCombatWeapon
// Should override the fov
virtual float GetFOV() { return -1; }

virtual const char *GetViewModel( int viewmodelindex = 0 ) const;
virtual const char *GetNewViewModel( int viewmodelindex = 0 ) const;
const char *GetWorldModel( void ) const;
int GetWorldModelIndex( void );

Expand Down
32 changes: 32 additions & 0 deletions mp/src/game/shared/ff/weapons/ff_weapon_deploymancannon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include "cbase.h"
#include "ff_weapon_base.h"
#include "ff_buildableobject.h"
#include "ff_buildable_mancannon.h"
#include "ff_fx_shared.h"
#include "in_buttons.h"

Expand Down Expand Up @@ -340,3 +342,33 @@ bool CFFWeaponDeployManCannon::Deploy()

return BaseClass::Deploy();
}

#ifdef GAME_DLL
CON_COMMAND(detmancannon, "Detonates mancannon")
{
CFFPlayer *pPlayer = ToFFPlayer(UTIL_GetCommandClient());

if ( !pPlayer )
return;

if( !pPlayer->IsAlive() )
{
ClientPrint( pPlayer, HUD_PRINTCENTER, "#FF_ENGY_CANTDETWHENDEAD" );
return;
}

// Bug #0000333: Buildable Behavior (non build slot) while building
if( pPlayer->IsBuilding() && ( pPlayer->GetCurrentBuild() == FF_BUILD_MANCANNON ) )
{
ClientPrint( pPlayer, HUD_PRINTCENTER, "#FF_ENGY_CANTDETMIDBUILD" );
return;
}

CFFManCannon* pJumpPadToDet = pPlayer->GetManCannon();
if ( pJumpPadToDet )
{
pJumpPadToDet->DetonateNextFrame();
ClientPrint(pPlayer, HUD_PRINTCENTER, "#FF_MANCANNON_DESTROYED");
}
}
#endif
3 changes: 3 additions & 0 deletions mp/src/game/shared/ff/weapons/ff_weapon_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ void CFFWeaponInfo::Parse( KeyValues *pKeyValuesData, const char *szWeaponName )

const char *pAnimEx = pKeyValuesData->GetString( "PlayerAnimationExtension", "mp5" );
Q_strncpy( m_szAnimExtension, pAnimEx, sizeof( m_szAnimExtension ) );

const char *pNewViewmodel = pKeyValuesData->GetString( "viewmodel_new", szViewModel );
Q_strncpy( szNewViewModel, pNewViewmodel, sizeof( szNewViewModel ) );
}


3 changes: 3 additions & 0 deletions mp/src/game/shared/ff/weapons/ff_weapon_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class CFFWeaponInfo : public FileWeaponInfo_t
float m_flRange;

float m_flRecoilAmount;

// SDK2013
char szNewViewModel[MAX_WEAPON_STRING];
};


Expand Down