本文整理汇总了C++中GetEntityName函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEntityName函数的具体用法?C++ GetEntityName怎么用?C++ GetEntityName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetEntityName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEntityName
// Lists all doors in the same movement group as this one
int CBaseDoor::GetDoorMovementGroup( CBaseDoor *pDoorList[], int listMax )
{
int count = 0;
CBaseEntity *pTarget = NULL;
// Block all door pieces with the same targetname here.
if ( GetEntityName() != NULL_STRING )
{
for (;;)
{
pTarget = gEntList.FindEntityByName( pTarget, GetEntityName(), NULL );
if ( pTarget != this )
{
if ( !pTarget )
break;
CBaseDoor *pDoor = dynamic_cast<CBaseDoor *>(pTarget);
if ( pDoor && count < listMax )
{
pDoorList[count] = pDoor;
count++;
}
}
}
}
return count;
}
示例2: Warning
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropCrane::Activate( void )
{
BaseClass::Activate();
// If we load a game, we don't need to set this all up again.
if ( m_hCraneMagnet )
return;
// Find our magnet
if ( m_iszMagnetName == NULL_STRING )
{
Warning( "prop_vehicle_crane %s has no magnet entity specified!\n", STRING(GetEntityName()) );
UTIL_Remove( this );
return;
}
m_hCraneMagnet = dynamic_cast<CPhysMagnet *>(gEntList.FindEntityByName( NULL, STRING(m_iszMagnetName) ));
if ( !m_hCraneMagnet )
{
Warning( "prop_vehicle_crane %s failed to find magnet %s.\n", STRING(GetEntityName()), STRING(m_iszMagnetName) );
UTIL_Remove( this );
return;
}
// We want the magnet to cast a long shadow
m_hCraneMagnet->SetShadowCastDistance( 2048 );
// Create our constraint group
constraint_groupparams_t group;
group.Defaults();
m_pConstraintGroup = physenv->CreateConstraintGroup( group );
m_hCraneMagnet->SetConstraintGroup( m_pConstraintGroup );
// Create our crane tip
Vector vecOrigin;
QAngle vecAngles;
GetCraneTipPosition( &vecOrigin, &vecAngles );
m_hCraneTip = CCraneTip::Create( m_hCraneMagnet, m_pConstraintGroup, vecOrigin, vecAngles );
if ( !m_hCraneTip )
{
UTIL_Remove( this );
return;
}
m_pConstraintGroup->Activate();
// Make a rope to connect 'em
int iIndex = m_hCraneMagnet->LookupAttachment("magnetcable_a");
m_hRope = CRopeKeyframe::Create( this, m_hCraneMagnet, 1, iIndex );
if ( m_hRope )
{
m_hRope->m_Width = 3;
m_hRope->m_nSegments = ROPE_MAX_SEGMENTS / 2;
m_hRope->EnableWind( false );
m_hRope->SetupHangDistance( 0 );
m_hRope->m_RopeLength = (m_hCraneMagnet->GetAbsOrigin() - m_hCraneTip->GetAbsOrigin()).Length() * 1.1;
}
// Start with the magnet off
TurnMagnetOff();
}
示例3: GetAbsOrigin
bool CFuncLadderEndPoint::Validate()
{
// Find the the other end
Vector startPos = GetAbsOrigin();
CFuncLadderEndPoint *other = dynamic_cast< CFuncLadderEndPoint * >( GetNextTarget() );
if ( !other )
{
DevMsg( 1, "func_ladderendpoint(%s) without matching target\n", STRING(GetEntityName()) );
return false;
}
Vector endPos = other->GetAbsOrigin();
CFuncLadder *ladder = ( CFuncLadder * )CreateEntityByName( "func_useableladder" );
if ( ladder )
{
ladder->SetEndPoints( startPos, endPos );
ladder->SetAbsOrigin( GetAbsOrigin() );
ladder->SetParent( GetParent() );
ladder->SetName( GetEntityName() );
ladder->Spawn();
}
// Delete both endpoints
UTIL_Remove( other );
UTIL_Remove( this );
return true;
}
示例4: Put
static void Put( const char *name, const TNetInputValue &value )
{
FILE *fout = 0;
if (dump)
{
fout = fopen("netinput.log", "at");
}
FILETIME tm;
GetSystemTimeAsFileTime(&tm);
ITextModeConsole *pTMC = gEnv->pSystem->GetITextModeConsole();
if (lastFrame != gEnv->pRenderer->GetFrameID())
{
ypos = 0;
lastFrame = gEnv->pRenderer->GetFrameID();
tstamp = (uint64(tm.dwHighDateTime) << 32) | tm.dwLowDateTime;
}
float white[] = {1, 1, 1, 1};
char buf[256];
if (const Vec3 *pVec = value.GetPtr<Vec3>())
{
sprintf(buf, "%s: %f %f %f", name, pVec->x, pVec->y, pVec->z);
gEnv->pRenderer->Draw2dLabel(10.f, (float)(ypos += 20), 2.f, white, false, "%s", buf);
if (pTMC)
{
pTMC->PutText( 0, ypos / 20, buf );
}
if (fout)
{
fprintf(fout, "%I64d %s %s %f %f %f\n", tstamp, GetEntityName(), name, pVec->x, pVec->y, pVec->z);
}
}
else if (const float *pFloat = value.GetPtr<float>())
{
sprintf(buf, "%s: %f", name, *pFloat);
gEnv->pRenderer->Draw2dLabel(10.f, (float)(ypos += 20), 2, white, false, "%s", buf);
if (pTMC)
{
pTMC->PutText( 0, ypos / 20, buf );
}
if (fout)
{
fprintf(fout, "%I64d %s %s %f\n", tstamp, GetEntityName(), name, *pFloat);
}
}
if (fout)
{
fclose(fout);
}
}
示例5: SetThink
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEnvBeam::Spawn( void )
{
if ( !m_iszSpriteName )
{
SetThink( &CEnvBeam::SUB_Remove );
return;
}
BaseClass::Spawn();
m_noiseAmplitude = MIN(MAX_BEAM_NOISEAMPLITUDE, m_noiseAmplitude);
// Check for tapering
if ( HasSpawnFlags( SF_BEAM_TAPEROUT ) )
{
SetWidth( m_boltWidth );
SetEndWidth( 0 );
}
else
{
SetWidth( m_boltWidth );
SetEndWidth( GetWidth() ); // Note: EndWidth is not scaled
}
if ( ServerSide() )
{
SetThink( &CEnvBeam::UpdateThink );
SetNextThink( gpGlobals->curtime );
SetFireTime( gpGlobals->curtime );
if ( GetEntityName() != NULL_STRING )
{
if ( !(m_spawnflags & SF_BEAM_STARTON) )
{
AddEffects( EF_NODRAW );
m_active = 0;
SetNextThink( TICK_NEVER_THINK );
}
else
{
m_active = 1;
}
}
}
else
{
m_active = 0;
if ( !GetEntityName() || FBitSet(m_spawnflags, SF_BEAM_STARTON) )
{
SetThink( &CEnvBeam::StrikeThink );
SetNextThink( gpGlobals->curtime + 1.0f );
}
}
}
示例6: 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()));
}
}
示例7: dsp_speaker
//-----------------------------------------------------------------------------
// Purpose: If we've got a speaker, add ourselves to the list of microphones that want to listen
//-----------------------------------------------------------------------------
void CEnvMicrophone::ActivateSpeaker( void )
{
// If we're enabled, set the dsp_speaker preset to my specified one
if ( !m_bDisabled )
{
ConVarRef dsp_speaker( "dsp_speaker" );
if ( dsp_speaker.IsValid() )
{
int iDSPPreset = m_iSpeakerDSPPreset;
if ( !iDSPPreset )
{
// Reset it to the default
iDSPPreset = atoi( dsp_speaker.GetDefault() );
}
DevMsg( 2, "Microphone %s set dsp_speaker to %d.\n", STRING(GetEntityName()), iDSPPreset);
dsp_speaker.SetValue( m_iSpeakerDSPPreset );
}
}
if ( m_iszSpeakerName != NULL_STRING )
{
// We've got a speaker to play heard sounds through. To do this, we need to add ourselves
// to the list of microphones who want to be told whenever a sound is played.
if ( s_Microphones.Find(this) == -1 )
{
s_Microphones.AddToTail( this );
}
}
}
示例8: Warning
//-----------------------------------------------------------------------------
// Purpose: Pick up a specified object
// Input : &inputdata -
//-----------------------------------------------------------------------------
void CNPC_CombineDropship::InputPickup( inputdata_t &inputdata )
{
// Can't pickup if we're already carrying something
if ( m_hContainer )
{
Warning("npc_combinedropship %s was told to pickup, but is already carrying something.\n", STRING(GetEntityName()) );
return;
}
string_t iszTargetName = inputdata.value.StringID();
if ( iszTargetName == NULL_STRING )
{
Warning("npc_combinedropship %s tried to pickup with no specified pickup target.\n", STRING(GetEntityName()) );
return;
}
CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, iszTargetName, NULL );
if ( !pTarget )
{
Warning("npc_combinedropship %s couldn't find pickup target named %s\n", STRING(GetEntityName()), STRING(iszTargetName) );
return;
}
// Start heading to the point
m_hPickupTarget = pTarget;
// Disable collisions to my target
m_hPickupTarget->SetOwnerEntity(this);
if ( m_NPCState == NPC_STATE_IDLE )
{
SetState( NPC_STATE_ALERT );
}
m_iLandState = LANDING_SWOOPING;
m_flLandingSpeed = GetAbsVelocity().Length();
}
示例9: Warning
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CNPC_VehicleDriver::InputGotoPathCorner( inputdata_t &inputdata )
{
string_t iszPathName = inputdata.value.StringID();
if ( iszPathName != NULL_STRING )
{
CBaseEntity *pEntity = gEntList.FindEntityByName( NULL, iszPathName );
if ( !pEntity )
{
Warning("npc_vehicledriver %s couldn't find entity named %s\n", STRING(GetEntityName()), STRING(iszPathName) );
return;
}
ClearWaypoints();
// Drive to the point
SetGoalEnt( pEntity );
if ( m_NPCState == NPC_STATE_IDLE )
{
SetState( NPC_STATE_ALERT );
}
SetCondition( COND_PROVOKED );
// Force him to start forward
InputStartForward( inputdata );
}
}
示例10: switch
void CWorldItem::Spawn( void )
{
CBaseEntity *pEntity = NULL;
switch (m_iType)
{
case 44: // ITEM_BATTERY:
pEntity = CBaseEntity::Create( "item_battery", GetLocalOrigin(), GetLocalAngles() );
break;
case 45: // ITEM_SUIT:
pEntity = CBaseEntity::Create( "item_suit", GetLocalOrigin(), GetLocalAngles() );
break;
}
if (!pEntity)
{
Warning("unable to create world_item %d\n", m_iType );
}
else
{
pEntity->m_target = m_target;
pEntity->SetName( GetEntityName() );
pEntity->ClearSpawnFlags();
pEntity->AddSpawnFlags( m_spawnflags );
}
UTIL_RemoveImmediate( this );
}
示例11: SetMoveType
void CFuncBrush::Spawn( void )
{
SetMoveType( MOVETYPE_PUSH ); // so it doesn't get pushed by anything
SetSolid( SOLID_VPHYSICS );
AddEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID );
if ( m_iSolidity == BRUSHSOLID_NEVER )
{
AddSolidFlags( FSOLID_NOT_SOLID );
}
SetModel( STRING( GetModelName() ) );
if ( m_iDisabled )
TurnOff();
// If it can't move/go away, it's really part of the world
if ( !GetEntityName() || !m_iParent )
AddFlag( FL_WORLDBRUSH );
CreateVPhysics();
// Slam the object back to solid - if we really want it to be solid.
if ( m_bSolidBsp )
{
SetSolid( SOLID_BSP );
}
}
示例12: DevMsg
void CPoseController::InputGetFMod( inputdata_t &inputdata )
{
DevMsg( "FMod values for pose controller %s\nTYPE: %i\nTIME OFFSET: %f\nRATE: %f\nAMPLITUDE: %f\n",
STRING(GetEntityName()),
m_nFModType.Get(),
m_fFModTimeOffset.Get(),
m_fFModRate.Get(),
m_fFModAmplitude.Get() );
}
示例13: Activate
//-----------------------------------------------------------------------------
// Activate!
//-----------------------------------------------------------------------------
void CPathTrack::Activate( void )
{
BaseClass::Activate();
if ( GetEntityName() != NULL_STRING ) // Link to next, and back-link
{
Link();
}
}
示例14: Warning
void CTemplateNPCMaker::Precache()
{
BaseClass::Precache();
if ( !m_iszTemplateData )
{
//
// This must be the first time we're activated, not a load from save game.
// Look up the template in the template database.
//
if (!m_iszTemplateName)
{
Warning( "npc_template_maker %s has no template NPC!\n", STRING(GetEntityName()) );
UTIL_Remove( this );
return;
}
else
{
m_iszTemplateData = Templates_FindByTargetName(STRING(m_iszTemplateName));
if ( m_iszTemplateData == NULL_STRING )
{
DevWarning( "npc_template_maker %s: template NPC %s not found!\n", STRING(GetEntityName()), STRING(m_iszTemplateName) );
UTIL_Remove( this );
return;
}
}
}
Assert( m_iszTemplateData != NULL_STRING );
// If the mapper marked this as "preload", then instance the entity preache stuff and delete the entity
//if ( !HasSpawnFlags(SF_NPCMAKER_NOPRELOADMODELS) )
if ( m_iszTemplateData != NULL_STRING )
{
CBaseEntity *pEntity = NULL;
MapEntity_ParseEntity( pEntity, STRING(m_iszTemplateData), NULL );
if ( pEntity != NULL )
{
PrecacheTemplateEntity( pEntity );
UTIL_RemoveImmediate( pEntity );
}
}
}
示例15: Warning
//-----------------------------------------------------------------------------
// Purpose:
// Input : &inputdata -
//-----------------------------------------------------------------------------
void CEnvScreenOverlay::InputStartOverlay( inputdata_t &inputdata )
{
if ( m_iszOverlayNames[0] == NULL_STRING )
{
Warning("env_screenoverlay %s has no overlays to display.\n", STRING(GetEntityName()) );
return;
}
m_flStartTime = gpGlobals->curtime;
}