本文整理汇总了C++中UTIL_GetCommandClient函数的典型用法代码示例。如果您正苦于以下问题:C++ UTIL_GetCommandClient函数的具体用法?C++ UTIL_GetCommandClient怎么用?C++ UTIL_GetCommandClient使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UTIL_GetCommandClient函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CC_SwitchToPhyscannon
//
// Name: CC_SwitchToPhyscannon
// Author: Hekar Khani
// Description: Concommand. Switches between Physcannon and last weapon
// Notes:
//
void CC_SwitchToPhyscannon( void )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
if ( pPlayer )
{
CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
if ( pWeapon )
{
// Tell the client to stop selecting weapons
engine->ClientCommand( UTIL_GetCommandClient()->edict(), "cancelselect" );
const char *strWeaponName = pWeapon->GetName();
if ( !Q_stricmp( strWeaponName, "weapon_lf_combat_cannon" ) )
{
pPlayer->SelectLastItem();
}
else
{
pPlayer->SelectItem( "weapon_lf_combat_cannon" );
}
}
}
}
示例2: asw_marine_spectate_f
void asw_marine_spectate_f(const CCommand &args)
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if ( args.ArgC() < 2 )
{
Msg( "Usage: asw_marine_spectate [marine_num]\n" );
return;
}
CASW_Game_Resource* pGameResource = ASWGameResource();
if (!pGameResource)
return;
int iMarine = atof(args[1]);
if (iMarine < 0 || iMarine >= pGameResource->GetMaxMarineResources())
return;
CASW_Marine_Resource* pMR = pGameResource->GetMarineResource(iMarine);
if (!pMR)
{
Msg("No marine resource in that index\n");
return;
}
CASW_Marine *pMarine = pMR->GetMarineEntity();
if (!pMarine)
{
Msg("No live marine in that slot\n");
return;
}
pPlayer->SetSpectatingMarine(pMarine);
}
示例3: fire_rocket_projectile_f
static void fire_rocket_projectile_f( void )
{
CBasePlayer *pPlayer = (CBasePlayer *)UTIL_GetCommandClient();
Vector ptEyes, vForward;
QAngle vLookAng;
ptEyes = pPlayer->EyePosition();
pPlayer->EyeVectors( &vForward );
vLookAng = pPlayer->EyeAngles();
CRocket_Turret_Projectile *pRocket = (CRocket_Turret_Projectile *) CBaseEntity::Create( "rocket_turret_projectile", ptEyes, vLookAng, pPlayer );
if ( !pRocket )
return;
pRocket->SetThink( NULL );
pRocket->SetMoveType( MOVETYPE_FLY );
pRocket->SetModel( ROCKET_TURRET_PROJECTILE_NAME );
UTIL_SetSize( pRocket, vec3_origin, vec3_origin );
pRocket->CreateSmokeTrail();
pRocket->SetAbsVelocity( vForward * 550 );
pRocket->SetLauncher ( NULL );
}
示例4: asw_alien_batch_f
// creates a batch of aliens at the mouse cursor
void asw_alien_batch_f( const CCommand& args )
{
MDLCACHE_CRITICAL_SECTION();
bool allowPrecache = CBaseEntity::IsPrecacheAllowed();
CBaseEntity::SetAllowPrecache( true );
// find spawn point
CASW_Player* pPlayer = ToASW_Player(UTIL_GetCommandClient());
if (!pPlayer)
return;
CASW_Marine *pMarine = pPlayer->GetMarine();
if (!pMarine)
return;
trace_t tr;
Vector forward;
AngleVectors( pMarine->EyeAngles(), &forward );
UTIL_TraceLine(pMarine->EyePosition(),
pMarine->EyePosition() + forward * 300.0f,MASK_SOLID,
pMarine, COLLISION_GROUP_NONE, &tr );
if ( tr.fraction != 0.0 )
{
// trace to the floor from this spot
Vector vecSrc = tr.endpos;
tr.endpos.z += 12;
UTIL_TraceLine( vecSrc + Vector(0, 0, 12),
vecSrc - Vector( 0, 0, 512 ) ,MASK_SOLID,
pMarine, COLLISION_GROUP_NONE, &tr );
ASWSpawnManager()->SpawnAlienBatch( "asw_parasite", 25, tr.endpos, vec3_angle );
}
CBaseEntity::SetAllowPrecache( allowPrecache );
}
示例5: asw_path_end_f
void asw_path_end_f()
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if ( !pPlayer || !ASWPathUtils() )
return;
if ( !pPlayer->GetMarine() )
return;
Vector vecPathEnd = pPlayer->GetMarine()->GetAbsOrigin();
debugoverlay->AddBoxOverlay( g_vecPathStart, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 0, 0, 255, 30.0f );
debugoverlay->AddBoxOverlay( vecPathEnd, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 255, 0, 255, 30.0f );
AI_Waypoint_t *pWaypoint = ASWPathUtils()->BuildRoute( g_vecPathStart, vecPathEnd, NULL, 100, NAV_NONE, bits_BUILD_GET_CLOSE );
if ( !pWaypoint )
{
Msg( "Failed to find route\n" );
return;
}
if ( UTIL_ASW_DoorBlockingRoute( pWaypoint, true ) )
{
Msg(" Route blocked by sealed/locked door\n" );
}
ASWPathUtils()->DebugDrawRoute( g_vecPathStart, pWaypoint );
}
示例6: asw_test_turret_f
void asw_test_turret_f()
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if (pPlayer && pPlayer->GetMarine())
{
CASW_Marine *pMarine = pPlayer->GetMarine();
if (pMarine->m_hRemoteTurret.Get())
{
pMarine->m_hRemoteTurret->StopUsingTurret();//m_hUser = NULL;
pMarine->m_hRemoteTurret = NULL;
return;
}
CBaseEntity* pEntity = NULL;
while ((pEntity = gEntList.FindEntityByClassname( pEntity, "asw_remote_turret" )) != NULL)
{
CASW_Remote_Turret* pTurret = dynamic_cast<CASW_Remote_Turret*>(pEntity);
if (pTurret)
{
pTurret->StartedUsingTurret(pMarine);
pMarine->m_hRemoteTurret = pTurret;
Msg("Set turret\n");
return;
}
}
}
Msg("Failed to find a turret\n");
}
示例7: asw_room_info_f
void asw_room_info_f()
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if ( pPlayer && pPlayer->GetMarine() && missionchooser && missionchooser->RandomMissions() )
{
IASW_Room_Details *pRoom = missionchooser->RandomMissions()->GetRoomDetails( pPlayer->GetMarine()->GetAbsOrigin() );
if ( !pRoom )
{
Msg(" Couldn't find room\n" );
}
else
{
char buf[MAX_PATH];
pRoom->GetFullRoomName( buf, MAX_PATH );
Msg( " Room name: %s\n", buf );
Msg( " Room tags: " );
int nNumTags = pRoom->GetNumTags();
for ( int i = 0; i < nNumTags; ++ i )
{
Msg( "%s ", pRoom->GetTag( i ) );
}
Msg( "\n" );
}
}
}
示例8: change_portalgun_linkage_id_f
static void change_portalgun_linkage_id_f( const CCommand &args )
{
if( sv_cheats->GetBool() == false ) //heavy handed version since setting the concommand with FCVAR_CHEATS isn't working like I thought
return;
if( args.ArgC() < 2 )
return;
unsigned char iNewID = (unsigned char)atoi( args[1] );
CPortal_Player *pPlayer = (CPortal_Player *)UTIL_GetCommandClient();
int iWeaponCount = pPlayer->WeaponCount();
for( int i = 0; i != iWeaponCount; ++i )
{
CBaseCombatWeapon *pWeapon = pPlayer->GetWeapon(i);
if( pWeapon == NULL )
continue;
if( dynamic_cast<CWeaponPortalgun *>(pWeapon) != NULL )
{
CWeaponPortalgun *pPortalGun = (CWeaponPortalgun *)pWeapon;
pPortalGun->m_iPortalLinkageGroupID = iNewID;
break;
}
}
}
示例9: CC_ASW_Ent_Create
//------------------------------------------------------------------------------
// Purpose: Create an NPC of the given type
//------------------------------------------------------------------------------
void CC_ASW_Ent_Create( const CCommand& args )
{
MDLCACHE_CRITICAL_SECTION();
bool allowPrecache = CBaseEntity::IsPrecacheAllowed();
CBaseEntity::SetAllowPrecache( true );
// Try to create entity
CBaseEntity *entity = dynamic_cast< CBaseEntity * >( CreateEntityByName(args[1]) );
if (entity)
{
entity->Precache();
// Now attempt to drop into the world
CASW_Player* pPlayer = ToASW_Player( UTIL_GetCommandClient() );
if (!pPlayer)
return;
trace_t tr;
UTIL_TraceLine( pPlayer->GetCrosshairTracePos() + Vector( 0, 0, 30 ),
pPlayer->GetCrosshairTracePos(), MASK_SOLID,
pPlayer, COLLISION_GROUP_NONE, &tr );
if ( tr.fraction != 0.0 )
{
// Raise the end position a little up off the floor, place the npc and drop him down
tr.endpos.z += 12;
entity->Teleport( &tr.endpos, NULL, NULL );
// this was causing aliens to spawn under ground
//UTIL_DropToFloor( entity, MASK_SOLID );
}
DispatchSpawn(entity);
}
CBaseEntity::SetAllowPrecache( allowPrecache );
}
示例10: asw_drop_ammo_f
void asw_drop_ammo_f(const CCommand &args)
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if (!pPlayer)
return;
CASW_Marine *pMarine = pPlayer->GetMarine();
if (!pMarine)
return;
int iBagSlot = atoi(args[1]);
CASW_Weapon_Ammo_Bag *pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(0));
if (pBag)
{
if (pBag->DropAmmoPickup(iBagSlot))
{
return;
}
}
pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(1));
if (pBag)
{
if (pBag->DropAmmoPickup(iBagSlot))
{
return;
}
}
}
示例11: CC_ASW_Shake
//------------------------------------------------------------------------------
// Purpose: Console command to cause a screen shake.
//------------------------------------------------------------------------------
void CC_ASW_Shake( void )
{
CBasePlayer *pPlayer = UTIL_GetCommandClient();
if (pPlayer)
{
UTIL_ASW_ScreenShake( pPlayer->WorldSpaceCenter(), 25.0, 150.0, 1.0, 750, SHAKE_START );
}
}
示例12: CC_WC_Create
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CC_WC_Create( void )
{
// Only allowed in wc_edit_mode
if (engine->IsInEditMode())
{
CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();
if (g_pAINetworkManager->GetEditOps()->m_bLinkEditMode)
{
NWCEdit::CreateAILink(UTIL_GetCommandClient());
}
else
{
NWCEdit::CreateAINode(UTIL_GetCommandClient());
}
}
}
示例13: asw_debug_spectator_server_f
void asw_debug_spectator_server_f(void)
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if (!pPlayer)
return;
Msg("Server: m_bRequestedSpectator=%d\n", pPlayer->m_bRequestedSpectator);
}
示例14: asw_live_marines_f
void asw_live_marines_f()
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if (!pPlayer)
return;
Msg("Has live marines: %d\n", pPlayer->HasLiveMarines());
}
示例15: asw_suicide_f
void asw_suicide_f()
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if (pPlayer && pPlayer->GetMarine() && pPlayer->GetMarine()->GetHealth() > 0)
{
pPlayer->GetMarine()->Suicide();
}
}