Skip to content
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
65 changes: 65 additions & 0 deletions sp/src/game/client/hl2/c_basehlplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "c_ai_basenpc.h"
#include "in_buttons.h"
#include "collisionutils.h"
#ifdef EZ2
#include "view_scene.h"
#include "viewrender.h"
#endif

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
Expand Down Expand Up @@ -38,6 +42,9 @@ IMPLEMENT_CLIENTCLASS_DT(C_BaseHLPlayer, DT_HL2_Player, CHL2_Player)
RecvPropFloat( RECVINFO( m_flAnimRenderYaw ) ),
RecvPropFloat( RECVINFO( m_flAnimRenderZ ) ),
#endif
#ifdef EZ2
RecvPropFloat( RECVINFO( m_flNextKickAttack ) ),
#endif
END_RECV_TABLE()

BEGIN_PREDICTION_DATA( C_BaseHLPlayer )
Expand Down Expand Up @@ -691,6 +698,64 @@ void C_BaseHLPlayer::BuildTransformations( CStudioHdr *hdr, Vector *pos, Quatern
if (!DrawingLegs() || !InPerspectiveView() || !InFirstPersonView())
#endif*/
BuildFirstPersonMeathookTransformations( hdr, pos, q, cameraTransform, boneMask, boneComputed, "ValveBiped.Bip01_Head1" );

#ifdef EZ2
// While kicking or admiring gloves, retract the playermodel in a 0-1 parabola
if (InPerspectiveView() && InFirstPersonView() && DrawingLegs())
{
if (m_flNextKickAttack > gpGlobals->curtime)
{
float flPerc = sin( (m_flNextKickAttack - gpGlobals->curtime) * M_PI_F );

Vector vDeltaToAdd;
GetVectors( &vDeltaToAdd, NULL, NULL );

vDeltaToAdd *= -(64.0f * flPerc);

for (int i = 0; i < hdr->numbones(); i++)
{
// Only update bones reference by the bone mask.
if (!(hdr->boneFlags( i ) & boneMask))
{
continue;
}
matrix3x4_t &bone = GetBoneForWrite( i );
Vector vBonePos;
MatrixGetTranslation( bone, vBonePos );
vBonePos += vDeltaToAdd;
MatrixSetTranslation( vBonePos, bone );
}
}
else if (C_BaseViewModel *pVM = GetViewModel( 0 ))
{
if (!pVM->GetOwningWeapon() && pVM->GetCycle() < 1.0f)
{
float flPerc = sin( pVM->GetCycle() * M_PI_F );

Vector vDeltaToAdd;
GetVectors( &vDeltaToAdd, NULL, NULL );

vDeltaToAdd *= -(32.0f * flPerc);

FOR_EACH_MAP_FAST( GetFirstPersonArmScales(), i )
{
int nBone = GetFirstPersonArmScales().Key( i );
if (nBone == -1)
continue;

if (!(hdr->boneFlags( nBone ) & boneMask))
continue;

matrix3x4_t &bone = GetBoneForWrite( nBone );
Vector vBonePos;
MatrixGetTranslation( bone, vBonePos );
vBonePos += vDeltaToAdd;
MatrixSetTranslation( vBonePos, bone );
}
}
}
}
#endif
}


Expand Down
4 changes: 4 additions & 0 deletions sp/src/game/client/hl2/c_basehlplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ class C_BaseHLPlayer : public C_BasePlayer
QAngle m_angAnimRender;
#endif

#ifdef EZ2
float m_flNextKickAttack;
#endif

friend class CHL2GameMovement;
};

Expand Down
9 changes: 9 additions & 0 deletions sp/src/game/server/hl2/hl2_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,9 @@ IMPLEMENT_SERVERCLASS_ST(CHL2_Player, DT_HL2_Player)
SendPropFloat( SENDINFO(m_flAnimRenderYaw), 0, SPROP_NOSCALE ),
SendPropFloat( SENDINFO(m_flAnimRenderZ), 0, SPROP_NOSCALE ),
#endif
#ifdef EZ2
SendPropFloat( SENDINFO(m_flNextKickAttack), 0, SPROP_NOSCALE ),
#endif
END_SEND_TABLE()


Expand Down Expand Up @@ -2310,6 +2313,8 @@ bool CHL2_Player::CommanderExecuteOne( CAI_BaseNPC *pNpc, const commandgoal_t &g
if ( GetActiveWeapon() && goal.m_pGoalEntity == this && sv_command_viewmodel_anims.GetBool()) {
GetActiveWeapon()->SendWeaponAnim( ACT_VM_COMMAND_RECALL );
}

AddAnimStateLayer( SelectWeightedSequence( ACT_GESTURE_SIGNAL_GROUP ) );

// 1upD - Fire player proxy output
helperFireSquadCommandOuput("OnPlayerRecallSquad", Allies);
Expand All @@ -2324,6 +2329,8 @@ bool CHL2_Player::CommanderExecuteOne( CAI_BaseNPC *pNpc, const commandgoal_t &g
if (GetActiveWeapon() && sv_command_viewmodel_anims.GetBool()) {
GetActiveWeapon()->SendWeaponAnim( ACT_VM_COMMAND_SEND );
}

AddAnimStateLayer( SelectWeightedSequence( ACT_GESTURE_SIGNAL_ADVANCE ) );

// 1upD - Fire player proxy output
helperFireSquadCommandOuput("OnPlayerSendSquad", Allies);
Expand Down Expand Up @@ -5066,6 +5073,8 @@ void CHL2_Player::StartKickAnimation( void )
vm->SetPlaybackRate( 1.0f );
}
}

SetAnimation( PLAYER_ATTACK3 );
}

void CHL2_Player::HandleKickAnimation( void )
Expand Down
2 changes: 1 addition & 1 deletion sp/src/game/server/hl2/hl2_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class CHL2_Player : public CBasePlayer
EHANDLE m_hFlashlightColorCorrection;
bool m_bHandledColorCorrection; // NOT saved - this tells us that within this session, CC hasn't been cleaned up yet

float m_flNextKickAttack;
CNetworkVar( float, m_flNextKickAttack );
bool m_bKickWeaponLowered;

string_t m_LegModelName;
Expand Down
2 changes: 2 additions & 0 deletions sp/src/game/server/hl2/weapon_pistol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,8 @@ acttable_t CWeaponPulsePistol::m_acttable[] =
{ ACT_GESTURE_RELOAD, ACT_GESTURE_RELOAD_PULSE_PISTOL, false },
{ ACT_COMBINE_AR2_ALTFIRE, ACT_CHARGE_PULSE_PISTOL, false },
{ ACT_GESTURE_COMBINE_AR2_ALTFIRE, ACT_GESTURE_CHARGE_PULSE_PISTOL, false },

{ ACT_HL2MP_GESTURE_RELOAD, ACT_GESTURE_CHARGE_PULSE_PISTOL, false },
};

IMPLEMENT_ACTTABLE( CWeaponPulsePistol );
Expand Down
8 changes: 8 additions & 0 deletions sp/src/game/shared/mapbase/mapbase_playeranimstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ void CMapbasePlayerAnimState::SetPlayerAnimation( PLAYER_ANIM playerAnim )
m_bReloading = false;
m_flReloadCycle = 0;
}
#ifdef EZ2
if ( playerAnim == PLAYER_ATTACK3 )
{
m_iFireSequence = SelectWeightedSequence( TranslateActivity( ACT_GESTURE_MELEE_ATTACK2 ) );
m_bFiring = m_iFireSequence != -1;
m_flFireCycle = 0;
}
#endif
else if ( playerAnim == PLAYER_JUMP )
{
// Play the jump animation.
Expand Down