Skip to content

Commit

Permalink
Merge pull request #37 from TomyLobo/delay-setskill
Browse files Browse the repository at this point in the history
Don't update style skill until after a respawn
  • Loading branch information
TomyLobo committed Mar 29, 2016
2 parents c7ae70b + 7e166e8 commit b3993b6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
3 changes: 2 additions & 1 deletion mp/src/game/client/da/c_da_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ BEGIN_RECV_TABLE_NOBASE( CDAPlayerShared, DT_DAPlayerShared )
RecvPropBool( RECVINFO( m_bAimedIn ) ),
RecvPropFloat( RECVINFO( m_flAimIn ) ),
RecvPropFloat( RECVINFO( m_flSlowAimIn ) ),
RecvPropInt( RECVINFO( m_iStyleSkill ), 0, RecvProxy_Skill ),
RecvPropInt( RECVINFO( m_iStyleSkill ) ),
RecvPropInt( RECVINFO( m_iStyleSkillAfterRespawn ), 0, RecvProxy_Skill ),
RecvPropBool( RECVINFO( m_bSuperSkill ) ),
RecvPropDataTable( "dasharedlocaldata", 0, 0, &REFERENCE_RECV_TABLE(DT_DASharedLocalPlayerExclusive) ),

Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/client/da/vgui/folder_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ bool CFolderMenu::IsLoadoutComplete()
if (!pPlayer->HasCharacterBeenChosen())
return false;

if (pPlayer->m_Shared.m_iStyleSkill == SKILL_NONE)
if (pPlayer->m_Shared.m_iStyleSkillAfterRespawn == SKILL_NONE)
return false;

return true;
Expand Down
28 changes: 10 additions & 18 deletions mp/src/game/server/da/da_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ BEGIN_SEND_TABLE_NOBASE( CDAPlayerShared, DT_DAPlayerShared )
SendPropFloat( SENDINFO( m_flAimIn ) ),
SendPropFloat( SENDINFO( m_flSlowAimIn ) ),
SendPropInt( SENDINFO( m_iStyleSkill ) ),
SendPropInt( SENDINFO( m_iStyleSkillAfterRespawn ) ),
SendPropBool( SENDINFO( m_bSuperSkill ) ),

SendPropInt (SENDINFO (m_iWallFlipCount)),
Expand Down Expand Up @@ -1110,6 +1111,8 @@ void CDAPlayer::Spawn()
}

m_hRagdoll = NULL;

UpdateStyleSkill();

BaseClass::Spawn();
#if defined ( SDK_USE_STAMINA ) || defined ( SDK_USE_SPRINTING )
Expand Down Expand Up @@ -3260,28 +3263,17 @@ void CDAPlayer::SetStyleSkill(SkillID eSkill)
if (eSkill <= SKILL_NONE || eSkill >= SKILL_MAX)
eSkill = SKILL_MARKSMAN;

m_Shared.m_iStyleSkill = eSkill;
m_Shared.m_iStyleSkillAfterRespawn = eSkill;
}

void CDAPlayer::UpdateStyleSkill()
{
m_Shared.m_iStyleSkill = m_Shared.m_iStyleSkillAfterRespawn;

SetStylePoints(0);
m_flStyleSkillCharge = 0;

m_bHasSuperSlowMo = false;

if (m_Shared.m_iStyleSkill != SKILL_TROLL)
{
ConVarRef da_max_grenades("da_max_grenades");
while (GetAmmoCount("grenades") > da_max_grenades.GetInt())
{
QAngle gunAngles;
VectorAngles( BodyDirection2D(), gunAngles );

Vector vecForward;
AngleVectors( gunAngles, &vecForward, NULL, NULL );

float flDiameter = sqrt( CollisionProp()->OBBSize().x * CollisionProp()->OBBSize().x + CollisionProp()->OBBSize().y * CollisionProp()->OBBSize().y );

SDKThrowWeapon(FindWeapon(DA_WEAPON_GRENADE), vecForward, gunAngles, flDiameter);
}
}
}

#if defined ( SDK_USE_PRONE )
Expand Down
1 change: 1 addition & 0 deletions mp/src/game/server/da/da_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class CDAPlayer : public CBaseMultiplayerPlayer
void ShowSkillMenu();

void SetStyleSkill(SkillID eSkill);
void UpdateStyleSkill();

/*These 3 were made virtual for Double Action.
They enable us to have new shadow hulls.*/
Expand Down
1 change: 1 addition & 0 deletions mp/src/game/shared/da/da_player_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ class CDAPlayerShared
float m_flAimInSpeed;

CNetworkVar( int, m_iStyleSkill );
CNetworkVar( int, m_iStyleSkillAfterRespawn );
CNetworkVar( bool, m_bSuperSkill );

private:
Expand Down

0 comments on commit b3993b6

Please sign in to comment.