• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetPlayerOwner函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetPlayerOwner函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPlayerOwner函数的具体用法?C++ GetPlayerOwner怎么用?C++ GetPlayerOwner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetPlayerOwner函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetPlayerOwner

void CBuffer::UpdateInfo(tstring& s)
{
	tstring p;

	s = "";
	s += "MACRO-BUFFER INFO\n";
	s += "Network extender\n \n";

	if (GetPlayerOwner())
	{
		s += "Team: " + GetPlayerOwner()->GetPlayerName() + "\n";
		if (GetDigitanksPlayer() == DigitanksGame()->GetCurrentLocalDigitanksPlayer())
			s += " Friendly\n \n";
		else
			s += " Hostile\n \n";
	}
	else
	{
		s += "Team: Neutral\n \n";
	}

	if (IsConstructing())
	{
		s += "(Constructing)\n";
		s += tsprintf(tstring("Turns left: %d\n"), GetTurnsRemainingToConstruct());
		return;
	}

	s += tsprintf(tstring("Fleet Points: %d\n"), FleetPoints());
	s += tsprintf(tstring("Bandwidth: %.1f/turn\n"), Bandwidth());
	s += tsprintf(tstring("Network Size: %d\n"), (int)GetDataFlowRadius());
	s += tsprintf(tstring("Efficiency: %d\n"), (int)(GetChildEfficiency() * 100));
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:33,代码来源:buffer.cpp


示例2: GameServer

CWreckage* CDigitanksEntity::CreateWreckage()
{
	// Figure out what to do about structures later.
	if (dynamic_cast<CDigitank*>(this) == NULL)
		return NULL;

	CWreckage* pWreckage = GameServer()->Create<CWreckage>("CWreckage");
	pWreckage->SetGlobalOrigin(GetRenderOrigin());
	pWreckage->SetGlobalAngles(GetRenderAngles());
	pWreckage->SetModel(GetModelID());
	pWreckage->SetGlobalGravity(Vector(0, 0, DigitanksGame()->GetGravity()));
	pWreckage->SetOldPlayer(GetDigitanksPlayer());

	pWreckage->CalculateVisibility();

	CDigitank* pTank = dynamic_cast<CDigitank*>(this);
	if (pTank)
		pWreckage->SetTurretModel(pTank->GetTurretModel());

	bool bColorSwap = GetPlayerOwner() && (dynamic_cast<CDigitank*>(this));
	if (bColorSwap)
		pWreckage->SetColorSwap(GetPlayerOwner()->GetColor());

	return pWreckage;
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:25,代码来源:digitanksentity.cpp


示例3: r

void CSupplyLine::PostRender() const
{
	BaseClass::PostRender();

	if (!GameServer()->GetRenderer()->IsRenderingTransparent())
		return;

	if (!m_hSupplier || !m_hEntity)
		return;

	Vector vecDestination = m_hEntity->GetGlobalOrigin();

	Vector vecPath = vecDestination - m_hSupplier->GetGlobalOrigin();
	vecPath.z = 0;

	float flDistance = vecPath.Length2D();
	Vector vecDirection = vecPath.Normalized();
	size_t iSegments = (size_t)(flDistance/3);

	CRenderingContext r(GameServer()->GetRenderer(), true);
	if (DigitanksGame()->ShouldRenderFogOfWar())
		r.UseFrameBuffer(DigitanksGame()->GetDigitanksRenderer()->GetVisibilityMaskedBuffer());

	Color clrTeam(255, 255, 255, 255);
	if (GetPlayerOwner())
		clrTeam = GetPlayerOwner()->GetColor();
	clrTeam = (Vector(clrTeam) + Vector(1,1,1))/2;

	CRopeRenderer oRope(GameServer()->GetRenderer(), s_hSupplyBeam, DigitanksGame()->GetTerrain()->GetPointHeight(m_hSupplier->GetGlobalOrigin()) + Vector(0, 0, 2), 2.5f);
	if (dynamic_cast<CStructure*>(m_hEntity.GetPointer()))
	{
		oRope.SetTextureScale(500000);
		oRope.SetTextureOffset(-(float)fmod(GameServer()->GetGameTime(), 1));
	}
	else
	{
		oRope.SetTextureScale(5);
		oRope.SetTextureOffset(-(float)fmod(GameServer()->GetGameTime(), 1)*2);
	}

	float flVisibility = 1;
	CDigitanksEntity* pDTEnt = dynamic_cast<CDigitanksEntity*>(m_hEntity.GetPointer());
	if (pDTEnt)
		flVisibility = pDTEnt->GetVisibility();

	for (size_t i = 1; i < iSegments; i++)
	{
		if (m_flIntegrity < 1 && i%2 == 0)
			clrTeam.SetAlpha((int)(50 * m_flIntegrity * flVisibility));
		else
			clrTeam.SetAlpha((int)(255 * m_flIntegrity * flVisibility));

		oRope.SetColor(clrTeam);

		float flCurrentDistance = ((float)i*flDistance)/iSegments;
		oRope.AddLink(DigitanksGame()->GetTerrain()->GetPointHeight(m_hSupplier->GetGlobalOrigin() + vecDirection*flCurrentDistance) + Vector(0, 0, 2));
	}

	oRope.Finish(DigitanksGame()->GetTerrain()->GetPointHeight(vecDestination) + Vector(0, 0, 2));
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:60,代码来源:supplyline.cpp


示例4: InterceptSupplyLines

void CDigitanksEntity::InterceptSupplyLines()
{
	// Haha... no.
	if (dynamic_cast<CSupplyLine*>(this))
		return;

	if (!GetPlayerOwner())
		return;

	for (size_t i = 0; i < GameServer()->GetMaxEntities(); i++)
	{
		CBaseEntity* pEntity = CBaseEntity::GetEntity(i);
		if (!pEntity)
			continue;

		CSupplyLine* pSupplyLine = dynamic_cast<CSupplyLine*>(pEntity);
		if (!pSupplyLine)
			continue;

		if (pSupplyLine->GetPlayerOwner() == GetPlayerOwner())
			continue;

		if (!pSupplyLine->GetPlayerOwner())
			continue;

		if (!pSupplyLine->GetSupplier() || !pSupplyLine->GetEntity())
			continue;

		Vector vecEntity = GetGlobalOrigin();
		vecEntity.z = 0;

		Vector vecSupplier = pSupplyLine->GetSupplier()->GetGlobalOrigin();
		vecSupplier.z = 0;

		Vector vecUnit = pSupplyLine->GetEntity()->GetGlobalOrigin();
		vecUnit.z = 0;

		if (DistanceToLineSegment(vecEntity, vecSupplier, vecUnit) > GetBoundingRadius()+4)
			continue;

		bool bFound = false;
		for (size_t j = 0; j < m_ahSupplyLinesIntercepted.size(); j++)
		{
			if (pSupplyLine == m_ahSupplyLinesIntercepted[j])
			{
				bFound = true;
				break;
			}
		}

		if (!bFound)
		{
			pSupplyLine->Intercept(0.2f);
			m_ahSupplyLinesIntercepted.push_back(pSupplyLine);
		}
	}
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:57,代码来源:digitanksentity.cpp


示例5: GetPlayerOwner

// -----------------------------------------------------------------------------
// Purpose:
// -----------------------------------------------------------------------------
bool CTFWeaponBaseMelee::Holster( CBaseCombatWeapon *pSwitchingTo )
{
	m_flSmackTime = -1.0f;
	if ( GetPlayerOwner() )
	{
		GetPlayerOwner()->m_flNextAttack = gpGlobals->curtime + 0.5;
	}
	return BaseClass::Holster( pSwitchingTo );
}
开发者ID:staticfox,项目名称:TF2Classic,代码行数:12,代码来源:tf_weaponbase_melee.cpp


示例6: GetPlayerOwner

bool CWeaponShotgun::Reload()
{
	CSDKPlayer *pPlayer = GetPlayerOwner();

	if (pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) <= 0 || m_iClip1 == GetMaxClip1())
		return true;

	// don't reload until recoil is done
	if (m_flNextPrimaryAttack > gpGlobals->curtime)
		return true;
		
	// check to see if we're ready to reload
	if (m_fInSpecialReload == 0)
	{
		pPlayer->SetAnimation( PLAYER_RELOAD );

		SendWeaponAnim( ACT_SHOTGUN_RELOAD_START );
		m_fInSpecialReload = 1;
		pPlayer->m_flNextAttack = gpGlobals->curtime + 0.5;
		m_flNextPrimaryAttack = gpGlobals->curtime + 0.5;
		m_flNextSecondaryAttack = gpGlobals->curtime + 0.5;
		SetWeaponIdleTime( gpGlobals->curtime + 0.5 );
		return true;
	}
	else if (m_fInSpecialReload == 1)
	{
		if (m_flTimeWeaponIdle > gpGlobals->curtime)
			return true;
		// was waiting for gun to move to side
		m_fInSpecialReload = 2;

		SendWeaponAnim( ACT_VM_RELOAD );
		SetWeaponIdleTime( gpGlobals->curtime + 0.45 );
	}
	else
	{
		// Add them to the clip
		m_iClip1 += 1;
		
#ifdef GAME_DLL
		SendReloadEvents();
#endif
		
		CSDKPlayer *pPlayer = GetPlayerOwner();

		if ( pPlayer )
			 pPlayer->RemoveAmmo( 1, m_iPrimaryAmmoType );

		m_fInSpecialReload = 1;
	}

	return true;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:53,代码来源:weapon_shotgun.cpp


示例7: FindGround

void CStructure::StartTurn()
{
	BaseClass::StartTurn();

	FindGround();

	if (!GetSupplier() && !dynamic_cast<CCPU*>(this))
	{
		if (GetPlayerOwner())
			GetPlayerOwner()->RemoveUnit(this);
		SetSupplier(NULL);
	}

	if (GetSupplier() && !GetSupplier()->GetPlayerOwner())
	{
		GetSupplier()->RemoveChild(this);
		if (GetPlayerOwner())
			GetPlayerOwner()->RemoveUnit(this);
		SetSupplier(NULL);
	}

	if (GetPlayerOwner() == NULL)
		return;

	if (IsConstructing())
	{
		m_iTurnsToConstruct--;

		if (m_iTurnsToConstruct == (size_t)0)
		{
			GetDigitanksPlayer()->AppendTurnInfo(tstring("Construction finished on ") + GetEntityName());
			CompleteConstruction();

			GetDigitanksPlayer()->AddActionItem(this, ACTIONTYPE_NEWSTRUCTURE);
		}
		else
			GetDigitanksPlayer()->AppendTurnInfo(tsprintf(tstring("Constructing ") + GetEntityName() + " (%d turns left)", m_iTurnsToConstruct.Get()));
	}

	if (IsUpgrading())
	{
		m_iTurnsToUpgrade--;

		if (m_iTurnsToUpgrade == (size_t)0)
		{
			GetDigitanksPlayer()->AppendTurnInfo(GetEntityName() + " finished upgrading.");

			UpgradeComplete();
		}
		else
			GetDigitanksPlayer()->AppendTurnInfo(tsprintf(tstring("Upgrading ") + GetEntityName() + " (%d turns left)", GetTurnsToUpgrade()));
	}
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:53,代码来源:structure.cpp


示例8: GetPlayerOwner

void CWeaponUSP::PrimaryAttack()
{
	CCSPlayer *pPlayer = GetPlayerOwner();

	if ( m_bSilencerOn )
	{
		if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
			USPFire( (1.3) * (1 - m_flAccuracy), 0.225, false );
		else if (pPlayer->GetAbsVelocity().Length2D() > 0)
			USPFire( (0.25) * (1 - m_flAccuracy), 0.225, false );
		else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
			USPFire( (0.125) * (1 - m_flAccuracy), 0.225, false );
		else
			USPFire( (0.15) * (1 - m_flAccuracy), 0.225, false );
	}
	else
	{
		if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
			USPFire( (1.2) * (1 - m_flAccuracy), 0.225, false );
		else if (pPlayer->GetAbsVelocity().Length2D() > 0)
			USPFire( (0.225) * (1 - m_flAccuracy), 0.225, false );
		else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
			USPFire( (0.08) * (1 - m_flAccuracy), 0.225, false );
		else
			USPFire( (0.1) * (1 - m_flAccuracy), 0.225, false );
	}

}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:28,代码来源:weapon_usp.cpp


示例9: GetCSWpnData

void CWeaponAug::AUGFire(float flSpread, bool bZoomed)
{
    float flCycleTime = GetCSWpnData().m_flCycleTime;

    if (bZoomed)
        flCycleTime = 0.135f;

    if (!CSBaseGunFire(flSpread, flCycleTime, true))
        return;

    CMomentumPlayer *pPlayer = GetPlayerOwner();

    // CSBaseGunFire can kill us, forcing us to drop our weapon, if we shoot something that explodes
    if (!pPlayer)
        return;

    if (pPlayer->GetAbsVelocity().Length2D() > 5)
        pPlayer->KickBack(1, 0.45, 0.275, 0.05, 4, 2.5, 7);

    else if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        pPlayer->KickBack(1.25, 0.45, 0.22, 0.18, 5.5, 4, 5);

    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        pPlayer->KickBack(0.575, 0.325, 0.2, 0.011, 3.25, 2, 8);

    else
        pPlayer->KickBack(0.625, 0.375, 0.25, 0.0125, 3.5, 2.25, 8);
}
开发者ID:Asunaya,项目名称:game,代码行数:28,代码来源:weapon_cs_rifles.cpp


示例10: GetPlayerOwner

//=====================================================================================//
// Purpose: Performs the screen shake and it checks to see if we hit an entity to
//          handle the proper damage
//			An entity here can be another player or a wood plank
//=====================================================================================//
void CTDPBludgeonWeaponBase::Hit( trace_t &tr, Activity nHitActivity )
{
	// Do we have a valid owner holding the weapon?
	CTDPPlayer *pPlayer = GetPlayerOwner();
	if ( !pPlayer )
		return;

	// Let's shake the screen a little
	AddViewKick();

	// if tr.m_pEnt is not NULL it means we have hit a target
	if ( tr.m_pEnt != NULL )
	{
		Vector vForward;
		pPlayer->EyeVectors( &vForward, NULL, NULL );
		VectorNormalize( vForward );

		// Process the damage and send it to the entity we just hit
		CTakeDamageInfo dmgInfo( GetOwner(), GetOwner(), GetDamageForActivity( nHitActivity ), DMG_CLUB );
		CalculateMeleeDamageForce( &dmgInfo, vForward, tr.endpos );
		tr.m_pEnt->DispatchTraceAttack( dmgInfo, vForward, &tr );
		ApplyMultiDamage();

#if defined( GAME_DLL )
		// Now hit all triggers along the ray that...
		TraceAttackToTriggers( dmgInfo, tr.startpos, tr.endpos, vForward );
#endif
	}

	// Apply an impact effect
	ImpactEffect( tr );
}
开发者ID:jrbedard,项目名称:troy-divine-playground,代码行数:37,代码来源:tdp_weapon_basebludgeon.cpp


示例11: GetPlayerOwner

bool CWeaponBaseGun::Reload()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return false;

    if (pPlayer->GetAmmoCount(GetPrimaryAmmoType()) <= 0)
        return false;

    int iResult = DefaultReload(GetMaxClip1(), GetMaxClip2(), ACT_VM_RELOAD);
    if (!iResult)
        return false;

    pPlayer->SetAnimation(PLAYER_RELOAD);

#ifndef CLIENT_DLL
    if ((iResult) && (pPlayer->GetFOV() != pPlayer->GetDefaultFOV()))
    {
        pPlayer->SetFOV(pPlayer, pPlayer->GetDefaultFOV());
    }
#endif

    m_flAccuracy = 0.2;
    pPlayer->m_iShotsFired = 0;
    m_bDelayFire = false;

    return true;
}
开发者ID:bonjorno7,项目名称:GAME,代码行数:28,代码来源:weapon_base_gun.cpp


示例12: ToTFPlayer

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFMinigun::WindUp( void )
{
	// Get the player owning the weapon.
	CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
	if ( !pPlayer )
		return;

	// Play wind-up animation and sound (SPECIAL1).
	SendWeaponAnim( ACT_MP_ATTACK_STAND_PREFIRE );

	// Set the appropriate firing state.
	m_iWeaponState = AC_STATE_STARTFIRING;
	pPlayer->m_Shared.AddCond( TF_COND_AIMING );

#ifndef CLIENT_DLL
	pPlayer->StopRandomExpressions();
#endif

#ifdef CLIENT_DLL 
	WeaponSoundUpdate();
#endif


	// Update player's speed
	pPlayer->TeamFortress_SetSpeed();
}
开发者ID:Navton,项目名称:TF2Classic,代码行数:29,代码来源:tf_weapon_minigun.cpp


示例13: ToTFPlayer

//-----------------------------------------------------------------------------
// Purpose:
// NOTE: Should this be put into fire gun
//-----------------------------------------------------------------------------
void CTFWeaponBaseGun::DoFireEffects()
{
	CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
	if ( !pPlayer )
		return;

	// Muzzle flash on weapon.
	bool bMuzzleFlash = true;

	// We no longer need this
	/*
	if ( pPlayer->IsPlayerClass( TF_CLASS_HEAVYWEAPONS ) )
	{
		//CTFWeaponBase *pWeapon = pPlayer->GetActiveTFWeapon();
		//if ( pWeapon && pWeapon->GetWeaponID() == TF_WEAPON_MINIGUN )
		if (pPlayer->IsActiveTFWeapon(TF_WEAPON_MINIGUN))
		{
			bMuzzleFlash = false;
		}
	}*/

	if ( bMuzzleFlash )
	{
		pPlayer->DoMuzzleFlash();
	}
}
开发者ID:Navton,项目名称:TF2Classic,代码行数:30,代码来源:tf_weaponbase_gun.cpp


示例14: GetPlayerOwner

void CWeaponG3SG1::G3SG1Fire(float flSpread)
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    // If we are not zoomed in, or we have very recently zoomed and are still transitioning, the bullet diverts more.
    if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV() || (gpGlobals->curtime < m_zoomFullyActiveTime))
        flSpread += 0.025;

    // Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
    m_flAccuracy = 0.55 + (0.3) * (gpGlobals->curtime - m_flLastFire);

    if (m_flAccuracy > 0.98)
        m_flAccuracy = 0.98;

    m_flLastFire = gpGlobals->curtime;

    if (!CSBaseGunFire(flSpread, GetCSWpnData().m_flCycleTime, true))
        return;

    // Adjust the punch angle.
    QAngle angle = pPlayer->GetPunchAngle();
    angle.x -= SharedRandomFloat("G3SG1PunchAngleX", 0.75, 1.75) + (angle.x / 4);
    angle.y += SharedRandomFloat("G3SG1PunchAngleY", -0.75, 0.75);
    pPlayer->SetPunchAngle(angle);
}
开发者ID:Asunaya,项目名称:game,代码行数:27,代码来源:weapon_cs_rifles.cpp


示例15: GetPlayerOwner

void CWeaponCSBaseGun::ItemPostFrame()
{
	CCSPlayer *pPlayer = GetPlayerOwner();

	if ( !pPlayer )
		return;

	//GOOSEMAN : Return zoom level back to previous zoom level before we fired a shot. This is used only for the AWP.
	// And Scout.
	if ( (m_flNextPrimaryAttack <= gpGlobals->curtime) && (pPlayer->m_bResumeZoom == TRUE) )
	{
#ifndef CLIENT_DLL
		pPlayer->SetFOV( pPlayer, pPlayer->m_iLastZoom, 0.05f );
		m_zoomFullyActiveTime = gpGlobals->curtime + 0.05f;// Make sure we think that we are zooming on the server so we don't get instant acc bonus

		if ( pPlayer->GetFOV() == pPlayer->m_iLastZoom )
		{
			// return the fade level in zoom.
			pPlayer->m_bResumeZoom = false;
		}
#endif
	}

	BaseClass::ItemPostFrame();
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:25,代码来源:weapon_csbasegun.cpp


示例16: OnTeamChange

void CSupplier::OnTeamChange()
{
	if (!GetPlayerOwner())
	{
		for (size_t i = 0; i < m_ahChildren.size(); i++)
		{
			if (!m_ahChildren[i])
				continue;

			m_ahChildren[i]->SetSupplier(NULL);

			CStructure* pStructure = dynamic_cast<CStructure*>(m_ahChildren[i].GetPointer());
			if (!pStructure)
				continue;

			if (pStructure->GetPlayerOwner())
			{
				pStructure->GetPlayerOwner()->RemoveUnit(pStructure);
				DigitanksGame()->OnDisabled(pStructure, NULL, NULL);
			}
		}
	}

	BaseClass::OnTeamChange();
	UpdateTendrils();

	// This happens in UpdateTendrils() but do it again here anyway because UpdateTendrils only does it if there's a new tendril created.
	DigitanksGame()->GetTerrain()->DirtyChunkTexturesWithinDistance(GetGlobalOrigin(), GetDataFlowRadius() + GetBoundingRadius());
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:29,代码来源:structure.cpp


示例17: GetDigitanksPlayer

bool CSupplier::IsAvailableAreaActive(int iArea) const
{
	if (iArea != 1)
		return BaseClass::IsAvailableAreaActive(iArea);

	if (!GetDigitanksPlayer())
		return false;

	if (!GetDigitanksPlayer()->GetPrimaryCPU())
		return false;

	unittype_t ePreviewStructure = GetDigitanksPlayer()->GetPrimaryCPU()->GetPreviewStructure();
	if (ePreviewStructure == STRUCTURE_PSU || ePreviewStructure == STRUCTURE_BATTERY)
		return false;

	if (GetPlayerOwner() != DigitanksGame()->GetCurrentLocalDigitanksPlayer())
		return false;

	if (IsConstructing())
		return false;

	// In build mode show everybody, otherwise only show the selected structure.
	if (DigitanksGame()->GetControlMode() == MODE_BUILD || GetDigitanksPlayer()->IsSelected(this))
		return true;

	return false;
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:27,代码来源:structure.cpp


示例18: ToBasePlayer

//-----------------------------------------------------------------------------
// Animation event handlers
//-----------------------------------------------------------------------------
void CWeaponZMFists::HandleAnimEventMeleeHit( CBaseCombatCharacter *pOperator )
{
	//do the trace stuff here so we can pass it to the Hit() function
	trace_t traceHit;

	// Try a ray
	CBasePlayer *pOwner = ToBasePlayer(pOperator);
	if ( !pOwner )
		return;

	Vector swingStart = pOwner->Weapon_ShootPosition( );
	Vector forward;

	pOwner->EyeVectors( &forward, NULL, NULL );

	Vector swingEnd = swingStart + forward * GetRange();

#ifndef CLIENT_DLL
	CHL2MP_Player *pPlayer = ToHL2MPPlayer( GetPlayerOwner() );
	// Move other players back to history positions based on local player's lag
	lagcompensation->StartLagCompensation( pPlayer, pPlayer->GetCurrentCommand() );
#endif
	UTIL_TraceLine( swingStart, swingEnd, MASK_SHOT_HULL, pOwner, COLLISION_GROUP_NONE, &traceHit );
	Hit( traceHit, ACT_VM_HITCENTER);
#ifndef CLIENT_DLL
	// Move other players back to history positions based on local player's lag
	lagcompensation->FinishLagCompensation( pPlayer );
#endif
}
开发者ID:TotallyMehis,项目名称:ZM-Updated,代码行数:32,代码来源:weapon_zm_fists.cpp


示例19: GetPlayerOwner

void CWeaponScout::SCOUTFire( float flSpread )
{
    CCSPlayer *pPlayer = GetPlayerOwner();
    if (pPlayer == NULL)
    {
        Assert(pPlayer != NULL);
        return;
    }

    // If we are not zoomed in, or we have very recently zoomed and are still transitioning, the bullet diverts more.
    if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV() || (gpGlobals->curtime < m_zoomFullyActiveTime))
    {
        flSpread += 0.025;
    }

    if (pPlayer->GetFOV() != pPlayer->GetDefaultFOV())
    {
        pPlayer->m_bResumeZoom = true;
        pPlayer->m_iLastZoom = pPlayer->GetFOV();

#ifndef CLIENT_DLL
        pPlayer->SetFOV( pPlayer, pPlayer->GetDefaultFOV(), 0.05f );
#endif
    }

    if ( !CSBaseGunFire( flSpread, GetCSWpnData().m_flCycleTime, true ) )
        return;

    QAngle angle = pPlayer->GetPunchAngle();
    angle.x -= 2;
    pPlayer->SetPunchAngle( angle );
}
开发者ID:steadyfield,项目名称:SourceEngine2007,代码行数:32,代码来源:weapon_scout.cpp


示例20: ToTFPlayer

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CTFWeaponBaseMelee::CalcIsAttackCriticalHelper( void )
{
	CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
	if ( !pPlayer )
		return false;

	int nCvarValue = tf_weapon_criticals_melee.GetInt();

	if ( nCvarValue == 0 )
		return false;

	if ( nCvarValue == 1 && !tf_weapon_criticals.GetBool() )
		return false;

	float flPlayerCritMult = pPlayer->GetCritMult();

	float flCritChance = TF_DAMAGE_CRIT_CHANCE_MELEE * flPlayerCritMult;
	CALL_ATTRIB_HOOK_FLOAT( flCritChance, mult_crit_chance );

	// If the chance is 0, just bail.
	if ( flCritChance == 0.0f )
		return false;

	return ( RandomInt( 0, WEAPON_RANDOM_RANGE-1 ) <= flCritChance * WEAPON_RANDOM_RANGE );
}
开发者ID:TenmaPL,项目名称:TF2Classic,代码行数:28,代码来源:tf_weaponbase_melee.cpp



注:本文中的GetPlayerOwner函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetPlayers函数代码示例发布时间:2022-05-30
下一篇:
C++ GetPlayerName函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap