Skip to content

Commit

Permalink
Resolve c_hl2mp_player.cpp.rej
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmcwatters committed Dec 24, 2024
1 parent 354ff73 commit faad2dc
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions mp/src/game/client/hl2mp/c_hl2mp_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
#include "r_efx.h"
#include "dlight.h"

#if defined( ARGG )
#include "iclientmode.h"
#endif

#if defined( LUA_SDK )
#include "luamanager.h"
#include "lgametrace.h"
#include "lhl2mp_player_shared.h"
#include "ltakedamageinfo.h"
#include "mathlib/lvector.h"
#endif

// Don't alias here
#if defined( CHL2MP_Player )
#undef CHL2MP_Player
Expand Down Expand Up @@ -105,22 +117,57 @@ void C_HL2MP_Player::UpdateIDTarget()

void C_HL2MP_Player::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator )
{
#if defined ( LUA_SDK )
// Andrew; push a copy of the damageinfo/vector, bring the changes back out
// of Lua and set info/vecDir to the new value if it's been modified.
CTakeDamageInfo lInfo = info;
Vector lvecDir = vecDir;

BEGIN_LUA_CALL_HOOK( "PlayerTraceAttack" );
lua_pushhl2mpplayer( L, this );
lua_pushdamageinfo( L, lInfo );
lua_pushvector( L, lvecDir );
lua_pushtrace( L, *ptr );
END_LUA_CALL_HOOK( 4, 1 );

RETURN_LUA_NONE();
#endif

#if defined ( LUA_SDK )
Vector vecOrigin = ptr->endpos - lvecDir * 4;
#else
Vector vecOrigin = ptr->endpos - vecDir * 4;
#endif

float flDistance = 0.0f;

#if defined ( LUA_SDK )
if ( lInfo.GetAttacker() )
{
flDistance = (ptr->endpos - lInfo.GetAttacker()->GetAbsOrigin()).Length();
}
#else
if ( info.GetAttacker() )
{
flDistance = (ptr->endpos - info.GetAttacker()->GetAbsOrigin()).Length();
}
#endif

if ( m_takedamage )
{
#if defined ( LUA_SDK )
AddMultiDamage( lInfo, this );
#else
AddMultiDamage( info, this );
#endif

int blood = BloodColor();

#if defined ( LUA_SDK )
CBaseEntity *pAttacker = lInfo.GetAttacker();
#else
CBaseEntity *pAttacker = info.GetAttacker();
#endif

if ( pAttacker )
{
Expand Down

0 comments on commit faad2dc

Please sign in to comment.