本文整理匯總了C++中GetClassname函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetClassname函數的具體用法?C++ GetClassname怎麽用?C++ GetClassname使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetClassname函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: ComputeSoundlevel
//-----------------------------------------------------------------------------
// Spawn
//-----------------------------------------------------------------------------
void CAmbientGeneric::Spawn()
{
m_iSoundLevel = ComputeSoundlevel( m_radius, FBitSet(m_spawnflags, SF_AMBIENT_SOUND_EVERYWHERE) ? true : false );
ComputeMaxAudibleDistance();
char *szSoundFile = (char *)STRING(m_iszSound);
if ( !m_iszSound || strlen( szSoundFile ) < 1 )
{
Warning( "Empty %s (%s) at %.2f, %.2f, %.2f\n", GetClassname(), GetDebugName(), GetAbsOrigin().x, GetAbsOrigin().y, GetAbsOrigin().z );
UTIL_Remove(this);
return;
}
SetSolid(SOLID_NONE);
SetMoveType(MOVETYPE_NONE);
// Set up think function for dynamic modification
// of ambient sound's pitch or volume. Don't
// start thinking yet.
SetThink(&CAmbientGeneric::RampThink);
SetNextThink(TICK_NEVER_THINK);
m_fActive = false;
if ( FBitSet (m_spawnflags, SF_AMBIENT_SOUND_NOT_LOOPING) )
m_fLooping = false;
else
m_fLooping = true;
m_hSoundSource = NULL;
m_nSoundSourceEntIndex = -1;
Precache();
// init all dynamic modulation parms
InitModulationParms();
}
示例2: Vector
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPlayer -
//-----------------------------------------------------------------------------
void CWeaponFrag::RollGrenade( CBasePlayer *pPlayer )
{
// BUGBUG: Hardcoded grenade width of 4 - better not change the model :)
Vector vecSrc;
pPlayer->CollisionProp()->NormalizedToWorldSpace( Vector( 0.5f, 0.5f, 0.0f ), &vecSrc );
vecSrc.z += GRENADE_RADIUS;
Vector vecFacing = pPlayer->BodyDirection2D( );
// no up/down direction
vecFacing.z = 0;
VectorNormalize( vecFacing );
trace_t tr;
UTIL_TraceLine( vecSrc, vecSrc - Vector(0,0,16), MASK_PLAYERSOLID, pPlayer, COLLISION_GROUP_NONE, &tr );
if ( tr.fraction != 1.0 )
{
// compute forward vec parallel to floor plane and roll grenade along that
Vector tangent;
CrossProduct( vecFacing, tr.plane.normal, tangent );
CrossProduct( tr.plane.normal, tangent, vecFacing );
}
vecSrc += (vecFacing * 18.0);
CheckThrowPosition( pPlayer, pPlayer->WorldSpaceCenter(), vecSrc );
Vector vecThrow;
pPlayer->GetVelocity( &vecThrow, NULL );
vecThrow += vecFacing * 700;
// put it on its side
QAngle orientation(0,pPlayer->GetLocalAngles().y,-90);
// roll it
AngularImpulse rotSpeed(0,0,720);
Fraggrenade_Create( vecSrc, orientation, vecThrow, rotSpeed, pPlayer, GRENADE_TIMER, false );
WeaponSound( SPECIAL1 );
m_bRedraw = true;
m_iPrimaryAttacks++;
gamestats->Event_WeaponFired( pPlayer, true, GetClassname() );
}
示例3: CreateServerRagdoll
bool QUA_helicopter::BecomeRagdoll( const CTakeDamageInfo &info, const Vector &forceVector )
{
/*CRagdollProp *pRagdoll = NULL;
pRagdoll = assert_cast<CRagdollProp *>( CreateServerRagdoll( this, m_nForceBone, info, COLLISION_GROUP_VEHICLE ) );
pRagdoll->GetBaseAnimating()->Dissolve( NULL, gpGlobals->curtime+2.0f, false, ENTITY_DISSOLVE_NORMAL );
*/
//CreateRagdollEntity();
//pRagdoll->Dissolve
//pRagdoll->DisableAutoFade();
// Creamos un nuevo fantastico Strider
QUA_helicopter *pHeli = (QUA_helicopter *)CreateEntityByName( "vehicle_helicopter" );
if ( pHeli )
{
pHeli->m_bSpawn=true;
//pHeli->m_iSpawnTry=0;
//pHeli->m_hRagdoll=m_hRagdoll;
pHeli->SetThink( &QUA_helicopter::Materialize );
pHeli->SetContextThink( &QUA_helicopter::Materialize, gpGlobals->curtime + 5.0f, "RESPAWNING" );
pHeli->SetNextThink( gpGlobals->curtime + 5.0f );
pHeli->Teleport( &m_vOriginalSpawnOrigin, &m_vOriginalSpawnAngles, NULL );
//pStrider->AddEffects(EF_NODRAW);
//pStrider->AddSolidFlags(FSOLID_NOT_SOLID);
}
else
{
Warning("Respawn failed to create %s!\n", GetClassname() );
}
//this->Dissolve( NULL, gpGlobals->curtime+2.0f, false, ENTITY_DISSOLVE_NORMAL );
return true;
}
示例4: CheckThrowPosition
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPlayer -
//-----------------------------------------------------------------------------
void CWeaponFrag::ThrowGrenade( CBasePlayer *pPlayer )
{
Vector vecEye = pPlayer->EyePosition();
Vector vForward, vRight;
pPlayer->EyeVectors( &vForward, &vRight, NULL );
Vector vecSrc = vecEye + vForward * 18.0f + vRight * 8.0f;
CheckThrowPosition( pPlayer, vecEye, vecSrc );
// vForward[0] += 0.1f;
vForward[2] += 0.1f;
Vector vecThrow;
pPlayer->GetVelocity( &vecThrow, NULL );
vecThrow += vForward * 1200;
Fraggrenade_Create( vecSrc, vec3_angle, vecThrow, AngularImpulse(600,random->RandomInt(-1200,1200),0), pPlayer, GRENADE_TIMER, false );
m_bRedraw = true;
WeaponSound( SINGLE );
m_iPrimaryAttacks++;
gamestats->Event_WeaponFired( pPlayer, true, GetClassname() );
}
示例5: Vector
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPlayer -
//-----------------------------------------------------------------------------
void CWeaponFrag::LobGrenade( CBasePlayer *pPlayer )
{
Vector vecEye = pPlayer->EyePosition();
Vector vForward, vRight;
pPlayer->EyeVectors( &vForward, &vRight, NULL );
Vector vecSrc = vecEye + vForward * 18.0f + vRight * 8.0f + Vector( 0, 0, -8 );
CheckThrowPosition( pPlayer, vecEye, vecSrc );
Vector vecThrow;
pPlayer->GetVelocity( &vecThrow, NULL );
vecThrow += vForward * 350 + Vector( 0, 0, 50 );
Fraggrenade_Create( vecSrc, vec3_angle, vecThrow, AngularImpulse(200,random->RandomInt(-600,600),0), pPlayer, GRENADE_TIMER, false );
WeaponSound( WPN_DOUBLE );
// Send the player 'attack' animation.
pPlayer->SetAnimation(PLAYER_ATTACK1);
m_bRedraw = true;
m_iPrimaryAttacks++;
gamestats->Event_WeaponFired( pPlayer, true, GetClassname() );
}
示例6: GetOwner
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponBugBait::PrimaryAttack( void )
{
if ( m_bRedraw )
return;
CBaseCombatCharacter *pOwner = GetOwner();
if ( pOwner == NULL )
return;
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if ( pPlayer == NULL )
return;
SendWeaponAnim( ACT_VM_HAULBACK );
m_flTimeWeaponIdle = FLT_MAX;
m_flNextPrimaryAttack = FLT_MAX;
m_iPrimaryAttacks++;
gamestats->Event_WeaponFired( pPlayer, true, GetClassname() );
}
示例7: CheckThrowPosition
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPlayer -
//-----------------------------------------------------------------------------
void CWeaponFrag::ThrowGrenade( CBasePlayer *pPlayer )
{
// VR Source - if weapon tracking through based on weapon angle vector.
Vector vecEye = pPlayer->EyePosition();
Vector vForward, vRight;
pPlayer->EyeVectors( &vForward, &vRight, NULL );
Vector vecSrc = vecEye + vForward * 18.0f + vRight * 8.0f;
CheckThrowPosition( pPlayer, vecEye, vecSrc );
vForward[2] += 0.1f;
Vector vecThrow;
pPlayer->GetVelocity( &vecThrow, NULL );
// VR Source - use weapon angle vectors if available
if ( pPlayer->Weapon_Tracking() )
{
vecThrow += pPlayer->Weapon_ShootDirection() * 1200;
}
else
{
vecThrow += vForward * 1200;
}
//todo: do I need to replace the vec3_angle as well?
Fraggrenade_Create( vecSrc, vec3_angle, vecThrow, AngularImpulse(600,random->RandomInt(-1200,1200),0), pPlayer, GRENADE_TIMER, false );
m_bRedraw = true;
WeaponSound( SINGLE );
m_iPrimaryAttacks++;
gamestats->Event_WeaponFired( pPlayer, true, GetClassname() );
}
示例8: FireBolt
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponCrossbow::PrimaryAttack( void )
{
if ( m_bInZoom && g_pGameRules->IsMultiplayer() )
{
// FireSniperBolt();
FireBolt();
}
else
{
FireBolt();
}
// Signal a reload
m_bMustReload = true;
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration( ACT_VM_PRIMARYATTACK ) );
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if ( pPlayer )
{
m_iPrimaryAttacks++;
gamestats->Event_WeaponFired( pPlayer, true, GetClassname() );
}
}
示例9: SquadRecruit
//=========================================================
//
// SquadRecruit(), get some monsters of my classification and
// link them as a group. returns the group size
//
//=========================================================
int CSquadMonster :: SquadRecruit( int searchRadius, int maxMembers )
{
int squadCount;
EntityClassification_t iMyClass = Classify();// cache this monster's class
// Don't recruit if I'm already in a group
if ( InSquad() )
return 0;
if ( maxMembers < 2 )
return 0;
// I am my own leader
m_hSquadLeader = this;
squadCount = 1;
CBaseEntity *pEntity = NULL;
if ( HasNetName() )
{
// I have a netname, so unconditionally recruit everyone else with that name.
pEntity = UTIL_FindEntityByString( pEntity, "netname", GetNetName() );
while ( pEntity )
{
CSquadMonster *pRecruit = pEntity->MySquadMonsterPointer();
if ( pRecruit )
{
if ( !pRecruit->InSquad() && pRecruit->Classify() == iMyClass && pRecruit != this )
{
// minimum protection here against user error.in worldcraft.
if (!SquadAdd( pRecruit ))
break;
squadCount++;
}
}
pEntity = UTIL_FindEntityByString( pEntity, "netname", GetNetName() );
}
}
else
{
while ((pEntity = UTIL_FindEntityInSphere( pEntity, GetAbsOrigin(), searchRadius )) != NULL)
{
CSquadMonster *pRecruit = pEntity->MySquadMonsterPointer( );
if ( pRecruit && pRecruit != this && pRecruit->IsAlive() && !pRecruit->m_pCine )
{
// Can we recruit this guy?
if ( !pRecruit->InSquad() && pRecruit->Classify() == iMyClass &&
( (iMyClass != EntityClassifications().GetClassificationId( classify::ALIEN_MONSTER )) || FStrEq( GetClassname(), pRecruit->GetClassname() )) &&
!pRecruit->HasNetName() )
{
TraceResult tr;
UTIL_TraceLine( GetAbsOrigin() + GetViewOffset(), pRecruit->GetAbsOrigin() + GetViewOffset(), ignore_monsters, pRecruit->edict(), &tr );// try to hit recruit with a traceline.
if ( tr.flFraction == 1.0 )
{
if (!SquadAdd( pRecruit ))
break;
squadCount++;
}
}
}
}
}
// no single member squads
if (squadCount == 1)
{
m_hSquadLeader = NULL;
}
return squadCount;
}
示例10: Q_strncpy
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CMaterialModifyControl::InputStartFloatLerp( inputdata_t &inputdata )
{
char parseString[255];
Q_strncpy(parseString, inputdata.value.String(), sizeof(parseString));
// if( debug_materialmodifycontrol.GetBool() )//&& Q_stristr( GetDebugName(), "alyx" ) )
// {
// DevMsg( 1, "CMaterialModifyControl::InputStartFloatLerp %s %s %s \"%s\"\n",
// GetDebugName(), m_szMaterialName.Get(), m_szMaterialVar.Get(), inputdata.value.String() );
// }
// Get the start & end values
char *pszParam = strtok(parseString," ");
if ( pszParam && pszParam[0] )
{
float flStartValue = atof(pszParam);
pszParam = strtok(NULL," ");
if ( pszParam && pszParam[0] )
{
float flEndValue = atof(pszParam);
pszParam = strtok(NULL," ");
if ( pszParam && pszParam[0] )
{
float flTransitionTime = atof(pszParam);
pszParam = strtok(NULL," ");
if ( pszParam && pszParam[0] )
{
bool bWrap = atoi(pszParam) != 0;
// We don't implement wrap currently.
bWrap = bWrap;
// Got all the parameters. Save 'em and return;
m_flFloatLerpStartValue = flStartValue;
m_flFloatLerpEndValue = flEndValue;
m_flFloatLerpTransitionTime = flTransitionTime;
m_nModifyMode = MATERIAL_MODIFY_MODE_FLOAT_LERP;
m_bNewAnimCommandsSemaphore = !m_bNewAnimCommandsSemaphore;
return;
}
}
}
}
Warning("%s (%s) received StartFloatLerp input without correct parameters. Syntax: <Start Value> <End Value> <Transition Time> <Loop>\n<Loop> should be 1 or 0.\n", GetClassname(), GetDebugName() );
}
示例11: Warning
//-----------------------------------------------------------------------------
// Purpose: set a base and minimum bloom scale
//-----------------------------------------------------------------------------
void CEnvTonemapController::InputSetBloomScaleRange( inputdata_t &inputdata )
{
float bloom_max=1, bloom_min=1;
int nargs=sscanf("%f %f",inputdata.value.String(), bloom_max, bloom_min );
if (nargs != 2)
{
Warning("%s (%s) received SetBloomScaleRange input without 2 arguments. Syntax: <max bloom> <min bloom>\n", GetClassname(), GetDebugName() );
return;
}
m_flCustomBloomScale=bloom_max;
m_flCustomBloomScale=bloom_min;
}
示例12: Q_strncpy
//-----------------------------------------------------------------------------
// Purpose: Blend the tonemap scale to the specified value
//-----------------------------------------------------------------------------
void CEnvTonemapController::InputBlendTonemapScale( inputdata_t &inputdata )
{
char parseString[255];
Q_strncpy(parseString, inputdata.value.String(), sizeof(parseString));
// Get the target tonemap scale
char *pszParam = strtok(parseString," ");
if ( !pszParam || !pszParam[0] )
{
Warning("%s (%s) received BlendTonemapScale input without a target tonemap scale. Syntax: <target tonemap scale> <blend time>\n", GetClassname(), GetDebugName() );
return;
}
m_flBlendTonemapEnd = atof( pszParam );
// Get the blend time
pszParam = strtok(NULL," ");
if ( !pszParam || !pszParam[0] )
{
Warning("%s (%s) received BlendTonemapScale input without a blend time. Syntax: <target tonemap scale> <blend time>\n", GetClassname(), GetDebugName() );
return;
}
m_flBlendEndTime = gpGlobals->curtime + atof( pszParam );
m_flBlendStartTime = gpGlobals->curtime;
m_flBlendTonemapStart = mat_hdr_tonemapscale.GetFloat();
// Start thinking
SetNextThink( gpGlobals->curtime + 0.1 );
SetThink( &CEnvTonemapController::UpdateTonemapScaleBlend );
}
示例13: ToBasePlayer
//-----------------------------------------------------------------------------
// Purpose:
//
//
//-----------------------------------------------------------------------------
void CWeaponShotgun::PrimaryAttack( void )
{
// Only the player fires this way so we can cast
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if (!pPlayer)
{
return;
}
// MUST call sound before removing a round from the clip of a CMachineGun
WeaponSound(SINGLE);
pPlayer->DoMuzzleFlash();
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
// Don't fire again until fire animation has completed
m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration();
m_iClip1 -= 1;
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
ToHL2MPPlayer(pPlayer)->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );
Vector vecSrc = pPlayer->Weapon_ShootPosition( );
Vector vecAiming = pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
#ifdef HL2SB
#ifndef CLIENT_DLL
pPlayer->SetMuzzleFlashTime( gpGlobals->curtime + 1.0 );
#endif
#endif
#ifndef HL2SB
FireBulletsInfo_t info( 7, vecSrc, vecAiming, GetBulletSpread(), MAX_TRACE_LENGTH, m_iPrimaryAmmoType );
#else
FireBulletsInfo_t info( sk_plr_num_shotgun_pellets.GetInt(), vecSrc, vecAiming, GetBulletSpread(), MAX_TRACE_LENGTH, m_iPrimaryAmmoType );
#endif
info.m_pAttacker = pPlayer;
// Fire the bullets, and force the first shot to be perfectly accuracy
pPlayer->FireBullets( info );
QAngle punch;
punch.Init( SharedRandomFloat( "shotgunpax", -2, -1 ), SharedRandomFloat( "shotgunpay", -2, 2 ), 0 );
pPlayer->ViewPunch( punch );
#ifdef HL2SB
#ifndef CLIENT_DLL
CSoundEnt::InsertSound( SOUND_COMBAT, GetAbsOrigin(), SOUNDENT_VOLUME_SHOTGUN, 0.2, GetOwner() );
#endif
#endif
if (!m_iClip1 && pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <= 0)
{
// HEV suit - indicate out of ammo condition
pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
}
m_bNeedPump = true;
#ifdef HL2SB
#ifndef CLIENT_DLL
gamestats->Event_WeaponFired( pPlayer, true, GetClassname() );
#endif
#endif
}
示例14: defined
void CBaseScripted::InitScriptedEntity( void )
{
#if defined ( LUA_SDK )
#if 0
#ifndef CLIENT_DLL
// Let the instance reinitialize itself for the client.
if ( m_nTableReference != LUA_NOREF )
return;
#endif
#endif
SetThink( &CBaseScripted::Think );
#ifdef CLIENT_DLL
SetNextClientThink( gpGlobals->curtime );
#endif
SetNextThink( gpGlobals->curtime );
SetTouch( &CBaseScripted::Touch );
char className[ 255 ];
#if defined ( CLIENT_DLL )
if ( strlen( GetScriptedClassname() ) > 0 )
Q_strncpy( className, GetScriptedClassname(), sizeof( className ) );
else
Q_strncpy( className, GetClassname(), sizeof( className ) );
#else
Q_strncpy( m_iScriptedClassname.GetForModify(), GetClassname(), sizeof( className ) );
Q_strncpy( className, GetClassname(), sizeof( className ) );
#endif
Q_strlower( className );
SetClassname( className );
if ( m_nTableReference == LUA_NOREF )
{
LoadScriptedEntity();
m_nTableReference = luaL_ref( L, LUA_REGISTRYINDEX );
}
else
{
lua_getglobal( L, "table" );
if ( lua_istable( L, -1 ) )
{
lua_getfield( L, -1, "merge" );
if ( lua_isfunction( L, -1 ) )
{
lua_remove( L, -2 );
lua_getref( L, m_nTableReference );
LoadScriptedEntity();
luasrc_pcall( L, 2, 0, 0 );
}
else
{
lua_pop( L, 2 );
}
}
else
{
lua_pop( L, 1 );
}
}
BEGIN_LUA_CALL_ENTITY_METHOD( "Initialize" );
END_LUA_CALL_ENTITY_METHOD( 0, 0 );
#endif
}
示例15: MakeNPCInRadius
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTemplateNPCMaker::MakeNPC( void )
{
// If we should be using the radius spawn method instead, do so
if ( m_flRadius && HasSpawnFlags(SF_NPCMAKER_ALWAYSUSERADIUS) )
{
MakeNPCInRadius();
return;
}
if (!CanMakeNPC( ( m_iszDestinationGroup != NULL_STRING ) ))
return;
CNPCSpawnDestination *pDestination = NULL;
if ( m_iszDestinationGroup != NULL_STRING )
{
pDestination = FindSpawnDestination();
if ( !pDestination )
{
DevMsg( 2, "%s '%s' failed to find a valid spawnpoint in destination group: '%s'\n", GetClassname(), STRING(GetEntityName()), STRING(m_iszDestinationGroup) );
return;
}
}
CAI_BaseNPC *pent = NULL;
CBaseEntity *pEntity = NULL;
MapEntity_ParseEntity( pEntity, STRING(m_iszTemplateData), NULL );
if ( pEntity != NULL )
{
pent = (CAI_BaseNPC *)pEntity;
}
if ( !pent )
{
Warning("NULL Ent in NPCMaker!\n" );
return;
}
if ( pDestination )
{
pent->SetAbsOrigin( pDestination->GetAbsOrigin() );
// Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC.
QAngle angles = pDestination->GetAbsAngles();
angles.x = 0.0;
angles.z = 0.0;
pent->SetAbsAngles( angles );
pDestination->OnSpawnedNPC( pent );
}
else
{
pent->SetAbsOrigin( GetAbsOrigin() );
// Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC.
QAngle angles = GetAbsAngles();
angles.x = 0.0;
angles.z = 0.0;
pent->SetAbsAngles( angles );
}
m_OnSpawnNPC.Set( pEntity, pEntity, this );
if ( m_spawnflags & SF_NPCMAKER_FADE )
{
pent->AddSpawnFlags( SF_NPC_FADE_CORPSE );
}
pent->RemoveSpawnFlags( SF_NPC_TEMPLATE );
if ( ( m_spawnflags & SF_NPCMAKER_NO_DROP ) == false )
{
pent->RemoveSpawnFlags( SF_NPC_FALL_TO_GROUND ); // don't fall, slam
}
ChildPreSpawn( pent );
DispatchSpawn( pent );
pent->SetOwnerEntity( this );
DispatchActivate( pent );
ChildPostSpawn( pent );
m_nLiveChildren++;// count this NPC
if (!(m_spawnflags & SF_NPCMAKER_INF_CHILD))
{
m_nMaxNumNPCs--;
if ( IsDepleted() )
{
m_OnAllSpawned.FireOutput( this, this );
// Disable this forever. Don't kill it because it still gets death notices
SetThink( NULL );
SetUse( NULL );
}
}
//.........這裏部分代碼省略.........