To implement the ARGG physics gun to your half-life 2 mod its actually very simple here is what you need to do:
go to c_baseplayer.cpp and in line 240 add
// adnan
// get the use angles
RecvPropVector ( RECVINFO( m_vecUseAngles ) ),
// end adnan
in line 298 add
// adnan
// get the use angles
RecvPropVector ( RECVINFO( m_vecUseAngles ) ),
// end adnan
in line 1401 add
#ifdef ARGG
// adnan
// OVERRIDING THE VIEW
// need to override the angles too
C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
if ( pWeapon )
{
// adnan
if(pWeapon->OverrideViewAngles()) {
// use the useAngles!
// override with the angles the server sends to us as useAngles
// use the useAngles only if we're holding and rotating with the grav gun
pSetup->angles = m_vecUseAngles;
}
}
// end adnan
#endif
in c_baseplayer.h in line 439 add
// adnan
// store the use angles
// set when the player presses use
QAngle m_vecUseAngles;
// end adnan
in clientmode_shared.cpp in line 511 add
//-----------------------------------------------------------------------------
// Purpose: Allow weapons to override mouse input to view angles (for orbiting)
//-----------------------------------------------------------------------------
// adnan
// control the mouse input in the grav gun through this
bool ClientModeShared::OverrideViewAngles( void )
{
C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
if ( pWeapon )
{
// adnan
return pWeapon->OverrideViewAngles();
}
return false;
}
// end adnan
#endif
in clientmode_shared.h line 89 add
// adnan
// does this weapon need to override the view angles?
virtual bool OverrideViewAngles( void );
// end adnan
open c_hl2mp_player.cpp and in line 18 add #include "iclientmode.h"
in hud.cpp line 390 add
m_bSkipClear = false;
in line 1184 (under gHUD.m_iKeyBits &= (~(IN_WEAPON1|IN_WEAPON2));) the following code
#else
if ( !gHUD.m_bSkipClear )
{
// clear the weapon bits.
gHUD.m_iKeyBits &= (~(IN_WEAPON1|IN_WEAPON2));
}
in hud.h line 167 add
bool m_bSkipClear;
in iclientmode.h line 89 add
// adnan
// does this weapon need to override the view angles?
virtual bool OverrideViewAngles( void ) = 0;
// end adnan
in in_mouse.cpp line 689 add
// adnan
// only set the new viewangles if we're not supposed to override them
if( !(g_pClientMode->OverrideViewAngles()) )
{
in line 697 add
}
// end adnan
in player.cpp line 421
// adnan
// set the use angles
// set when the player presses use
DEFINE_FIELD( m_vecUseAngles, FIELD_VECTOR ),
// end adnan
in line 7979
// adnan
// send the use angles
// set when the player presses use
SendPropVector ( SENDINFO( m_vecUseAngles), 0, SPROP_NOSCALE ),
// end adnan
in player.h line 1128
public:
// adnan
// send the use angles for the current player... set when they press use
// UPDATE: this could be improved somehow by only storing these on the server side
// - set a flag on the client and send that, stating that the viewangles shouldnt change
// - ... maybe not
CNetworkQAngle( m_vecUseAngles );
// end adnan
private:
in basecombatweapon_shared.h line 515 add
// adnan
// does this weapon need to override the setting of view angles?
virtual bool OverrideViewAngles( void ) { return false; };
// end adnan
Finally add the physics gun to vpc and rebuild your project you should now have a rotational physics gun
(make sure to have weapon_physgun.txt)