本文整理汇总了C++中GetPlayerOwner函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPlayerOwner函数的具体用法?C++ GetPlayerOwner怎么用?C++ GetPlayerOwner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPlayerOwner函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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;
}
示例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));
}
示例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);
}
}
}
示例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 );
}
示例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;
}
示例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()));
}
}
示例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 );
}
}
示例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);
}
示例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 );
}
示例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;
}
示例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();
}
示例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();
}
}
示例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);
}
示例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();
}