本文整理匯總了C++中ActivateTargets函數的典型用法代碼示例。如果您正苦於以下問題:C++ ActivateTargets函數的具體用法?C++ ActivateTargets怎麽用?C++ ActivateTargets使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ActivateTargets函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: Hide
void hhGibbable::Explode(idEntity *activator) {
hhFxInfo fxInfo;
Hide();
fl.takedamage = false;
GetPhysics()->SetContents( 0 );
ActivateTargets( activator );
SetSkinByName(NULL);
if ( spawnArgs.GetFloat( "respawn", "0" ) ) {
PostEventSec( &EV_Respawn, spawnArgs.GetFloat( "respawn", "0" ) );
} else {
PostEventMS( &EV_Remove, 200 ); // Remove after a small delay to allow sound commands to execute
}
StartSound( "snd_gib", SND_CHANNEL_ANY );
// Find thinnest axis in the bounds and use for fx normal
idVec3 thinnest = vec3_origin;
int axisIndex = DetermineThinnestAxis();
thinnest[axisIndex] = 1.0f;
thinnest *= GetAxis();
fxInfo.RemoveWhenDone( true );
fxInfo.SetNormal(thinnest);
// Spawn FX system for gib
BroadcastFxInfo( spawnArgs.GetString("fx_gib"), GetOrigin(), GetAxis(), &fxInfo );
// Spawn gibs
if (spawnArgs.FindKey("def_debrisspawner")) {
hhUtils::SpawnDebrisMass(spawnArgs.GetString("def_debrisspawner"), this );
}
}
示例2: GetPhysics
/*
================
idTrigger_Hurt::Event_Touch
================
*/
void idTrigger_Hurt::Event_Touch( idEntity* other, trace_t* trace )
{
const char* damage;
if( common->IsClient() )
{
return;
}
if( on && other && gameLocal.time >= nextTime )
{
bool playerOnly = spawnArgs.GetBool( "playerOnly" );
if( playerOnly )
{
if( !other->IsType( idPlayer::Type ) )
{
return;
}
}
damage = spawnArgs.GetString( "def_damage", "damage_painTrigger" );
idVec3 dir = vec3_origin;
if( spawnArgs.GetBool( "kick_from_center", "0" ) )
{
dir = other->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin();
dir.Normalize();
}
other->Damage( NULL, NULL, dir, damage, 1.0f, INVALID_JOINT );
ActivateTargets( other );
CallScript();
nextTime = gameLocal.time + SEC2MS( delay );
}
}
示例3: if
/*
================
idBrittleFracture::AddForce
================
*/
void idBrittleFracture::AddForce( idEntity *ent, int id, const idVec3 &point, const idVec3 &force ) {
//if ( id < 0 || id >= shards.Num() )
if ( id < 0)
{
return;
}
if (id >= shards.Num())
id = shards.Num() - 1;
if ( shards[id]->droppedTime != -1 )
{
shards[id]->physicsObj.AddForce( 0, point, force );
}
//else if ( health <= 0 && !disableFracture )
else if ( !disableFracture )
{
Shatter( point, force, gameLocal.time );
//StartSound( "snd_shatter", SND_CHANNEL_ANY, 0, false, NULL );
//BC Trigger any alarm things.
ActivateTargets( gameLocal.GetLocalPlayer() );
}
}
示例4: Unbind
/*
============
idMoveable::Killed
============
*/
void idMoveable::Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location )
{
if( unbindOnDeath )
{
Unbind();
}
if( brokenModel != "" )
{
SetModel( brokenModel );
}
if( explode )
{
if( brokenModel == "" )
{
PostEventMS( &EV_Remove, 1000 );
}
}
if( renderEntity.gui[ 0 ] )
{
renderEntity.gui[ 0 ] = NULL;
}
ActivateTargets( this );
fl.takedamage = false;
}
示例5: GetName
/*
=====================
idCameraView::Stop
=====================
*/
void idCameraView::Stop( void ) {
if ( g_debugCinematic.GetBool() ) {
gameLocal.Printf( "%d: '%s' stop\n", gameLocal.framenum, GetName() );
}
gameLocal.SetCamera(NULL);
ActivateTargets( gameLocal.GetLocalPlayer() );
}
示例6: MaskForFruit
void hhSlots::CheckVictory() {
#define NUM_VICTORIES 16
static victory_t victoryTable[NUM_VICTORIES] = {
{ MASK_BARBARBAR, MASK_BARBARBAR, MASK_BARBARBAR, 10000},
{ MASK_BARBAR, MASK_BARBAR, MASK_BARBAR, 1000},
{ MASK_BAR, MASK_BAR, MASK_BAR, 500},
{ MASK_ANYBAR, MASK_ANYBAR, MASK_ANYBAR, 100},
{ MASK_MELON, MASK_MELON, MASK_MELON, 60},
{ MASK_GRAPE, MASK_GRAPE, MASK_GRAPE, 50},
{ MASK_APPLE, MASK_APPLE, MASK_APPLE, 40},
{ MASK_LEMON, MASK_LEMON, MASK_LEMON, 30},
{ MASK_ORANGE, MASK_ORANGE, MASK_ORANGE, 20},
{ MASK_CHERRY, MASK_CHERRY, MASK_CHERRY, 10},
{ MASK_CHERRY, MASK_CHERRY, MASK_ANY, 5},
{ MASK_ANY, MASK_CHERRY, MASK_CHERRY, 5},
{ MASK_CHERRY, MASK_ANY, MASK_CHERRY, 5},
{ MASK_CHERRY, MASK_ANY, MASK_ANY, 2},
{ MASK_ANY, MASK_CHERRY, MASK_ANY, 2},
{ MASK_ANY, MASK_ANY, MASK_CHERRY, 2}
};
PlayerCredits -= Bet;
result = SLOTRESULT_LOSE;
creditsWon = 0;
for (int ix=0; ix<NUM_VICTORIES; ix++) {
int fruitmask1 = MaskForFruit(reel1[ReelPos2Slot(reelPos1)]);
int fruitmask2 = MaskForFruit(reel2[ReelPos2Slot(reelPos2)]);
int fruitmask3 = MaskForFruit(reel3[ReelPos2Slot(reelPos3)]);
if ((fruitmask1 & victoryTable[ix].f1) &&
(fruitmask2 & victoryTable[ix].f2) &&
(fruitmask3 & victoryTable[ix].f3) ) {
result = SLOTRESULT_WIN;
creditsWon = Bet * victoryTable[ix].payoff;
PlayerCredits += creditsWon;
PlayerCredits = idMath::ClampInt(0, 999999999, PlayerCredits);
// Play victory sound
if (victoryAmount && PlayerCredits >= victoryAmount) {
StartSound( "snd_victory", SND_CHANNEL_ANY );
ActivateTargets( gameLocal.GetLocalPlayer() );
victoryAmount = 0;
}
else if (victoryTable[ix].payoff > 5) {
StartSound( "snd_winbig", SND_CHANNEL_ANY );
}
else {
StartSound( "snd_win", SND_CHANNEL_ANY );
}
break;
}
}
PlayerBet = idMath::ClampInt(0, PlayerCredits, PlayerBet);
}
示例7: ActivateTargets
/*
================
idTrigger_Count::Event_TriggerAction
================
*/
void idTrigger_Count::Event_TriggerAction( idEntity *activator ) {
ActivateTargets( activator );
CallScript( activator );
if ( goal == -1 ) {
PostEventMS( &EV_Remove, 0 );
}
}
示例8: CallScript
/*
================
idTrigger_Multi::TriggerAction
================
*/
void idTrigger_Multi::TriggerAction( idEntity *activator ) {
// RAVEN BEGIN
// jdischler: added for Aweldon. The trigger, when activated, will call the listed func with all attached targets, then return.
if ( spawnArgs.GetBool( "_callWithTargets", "0" ))
{
idEntity *ent;
for( int i = 0; i < targets.Num(); i++ )
{
ent = targets[ i ].GetEntity();
if ( !ent )
{
continue;
}
CallScript( ent );
}
return;
}
// RAVEN END
ActivateTargets( triggerWithSelf ? this : activator );
CallScript( triggerWithSelf ? this : activator );
if ( wait >= 0 ) {
nextTriggerTime = gameLocal.time + SEC2MS( wait + random * gameLocal.random.CRandomFloat() );
} else {
// we can't just remove (this) here, because this is a touch function
// called while looping through area links...
nextTriggerTime = gameLocal.time + 1;
PostEventMS( &EV_Remove, 0 );
}
}
示例9: ActivateTargets
/*
================
idTrigger_Timer::Event_Timer
================
*/
void idTrigger_Timer::Event_Timer( void ) {
ActivateTargets( this );
// set time before next firing
if( wait >= 0.0f ) {
PostEventSec( &EV_Timer, wait + gameLocal.random.CRandomFloat() * random );
}
}
示例10: CheckSpawn
/*
==============
idSpawner::Event_Activate
==============
*/
void idSpawner::Event_Activate( idEntity *activator ) {
// "trigger_only" spawners will attempt to spawn when triggered
if ( spawnArgs.GetBool( "trigger_only" ) ) {
// Update next spawn time to follo CheckSpawn into thinking its time to spawn again
nextSpawnTime = gameLocal.time;
CheckSpawn();
return;
}
// If nextSpawnTime is zero then the spawner is currently deactivated
if ( nextSpawnTime == 0 ) {
// Start thinking
BecomeActive( TH_THINK );
// Allow immediate spawn
nextSpawnTime = gameLocal.time;
// Spawn any ai targets and add them to the current count
ActivateTargets( this );
} else {
nextSpawnTime = 0;
BecomeInactive( TH_THINK );
// Remove the spawner if need be
if ( spawnArgs.GetBool( "remove", "1" ) ) {
PostEventMS( &EV_Remove, 0 );
}
}
}
示例11: sizeof
/*
================
idBrittleFracture::Shatter
================
*/
void idBrittleFracture::Shatter( const idVec3 &point, const idVec3 &impulse, const int time ) {
int i;
idVec3 dir;
shard_t *shard;
float m;
if ( gameLocal.isServer ) {
idBitMsg msg;
byte msgBuf[MAX_EVENT_PARAM_SIZE];
msg.Init( msgBuf, sizeof( msgBuf ) );
msg.BeginWriting();
msg.WriteFloat( point[0] );
msg.WriteFloat( point[1] );
msg.WriteFloat( point[2] );
msg.WriteFloat( impulse[0] );
msg.WriteFloat( impulse[1] );
msg.WriteFloat( impulse[2] );
ServerSendEvent( EVENT_SHATTER, &msg, true, -1 );
}
if ( time > ( gameLocal.time - SHARD_ALIVE_TIME ) ) {
StartSound( "snd_shatter", SND_CHANNEL_ANY, 0, false, NULL );
}
if ( !IsBroken() ) {
Break();
}
if ( fxFracture.Length() ) {
idEntityFx::StartFx( fxFracture, &point, &GetPhysics()->GetAxis(), this, true );
}
dir = impulse;
m = dir.Normalize();
for ( i = 0; i < shards.Num(); i++ ) {
shard = shards[i];
if ( shard->droppedTime != -1 ) {
continue;
}
if ( ( shard->clipModel->GetOrigin() - point ).LengthSqr() > Square( maxShatterRadius ) ) {
continue;
}
DropShard( shard, point, dir, m, time );
}
DropFloatingIslands( point, impulse, time );
//trigger it.
if (!firedTargets)
{
firedTargets = true;
ActivateTargets(this);
}
}
示例12: ActivateTargets
/*
================
idBrittleFracture::Killed
================
*/
void idBrittleFracture::Killed( idEntity* inflictor, idEntity* attacker, int damage, const idVec3& dir, int location )
{
if( !disableFracture )
{
ActivateTargets( this );
Break();
}
}
示例13: ServerSendEvent
/*
================
idItem::Pickup
================
*/
bool idItem::Pickup(idPlayer *player)
{
if (!GiveToPlayer(player)) {
return false;
}
if (gameLocal.isServer) {
ServerSendEvent(EVENT_PICKUP, NULL, false, -1);
}
// play pickup sound
StartSound("snd_acquire", SND_CHANNEL_ITEM, 0, false, NULL);
// trigger our targets
ActivateTargets(player);
// clear our contents so the object isn't picked up twice
GetPhysics()->SetContents(0);
// hide the model
Hide();
// add the highlight shell
if (itemShellHandle != -1) {
gameRenderWorld->FreeEntityDef(itemShellHandle);
itemShellHandle = -1;
}
float respawn = spawnArgs.GetFloat("respawn");
bool dropped = spawnArgs.GetBool("dropped");
bool no_respawn = spawnArgs.GetBool("no_respawn");
if (gameLocal.isMultiplayer && respawn == 0.0f) {
respawn = 20.0f;
}
if (respawn && !dropped && !no_respawn) {
const char *sfx = spawnArgs.GetString("fxRespawn");
if (sfx && *sfx) {
PostEventSec(&EV_RespawnFx, respawn - 0.5f);
}
PostEventSec(&EV_RespawnItem, respawn);
} else if (!spawnArgs.GetBool("inv_objective") && !no_respawn) {
// give some time for the pickup sound to play
// FIXME: Play on the owner
if (!spawnArgs.GetBool("inv_carry")) {
PostEventMS(&EV_Remove, 5000);
}
}
BecomeInactive(TH_THINK);
return true;
}
示例14: SetModel
/*
================
idLight::BecomeBroken
================
*/
void idLight::BecomeBroken( idEntity *activator ) {
const char *damageDefName;
fl.takedamage = false;
if ( brokenModel.Length() ) {
SetModel( brokenModel );
if ( !spawnArgs.GetBool( "nonsolid" ) ) {
GetPhysics()->SetClipModel( new idClipModel( brokenModel.c_str() ), 1.0f );
GetPhysics()->SetContents( CONTENTS_SOLID );
}
} else if ( spawnArgs.GetBool( "hideModelOnBreak" ) ) {
SetModel( "" );
GetPhysics()->SetContents( 0 );
}
if ( gameLocal.isServer ) {
ServerSendEvent( EVENT_BECOMEBROKEN, NULL, true, -1 );
if ( spawnArgs.GetString( "def_damage", "", &damageDefName ) ) {
idVec3 origin = renderEntity.origin + renderEntity.bounds.GetCenter() * renderEntity.axis;
gameLocal.RadiusDamage( origin, activator, activator, this, this, damageDefName );
}
}
ActivateTargets( activator );
// offset the start time of the shader to sync it to the game time
renderEntity.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( gameLocal.time );
renderLight.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( gameLocal.time );
// set the state parm
renderEntity.shaderParms[ SHADERPARM_MODE ] = 1;
renderLight.shaderParms[ SHADERPARM_MODE ] = 1;
// if the light has a sound, either start the alternate (broken) sound, or stop the sound
const char *parm = spawnArgs.GetString( "snd_broken" );
if ( refSound.shader || ( parm && *parm ) ) {
StopSound( SND_CHANNEL_ANY, false );
const idSoundShader *alternate = refSound.shader ? refSound.shader->GetAltSound() : declManager->FindSound( parm );
if ( alternate ) {
// start it with no diversity, so the leadin break sound plays
refSound.referenceSound->StartSound( alternate, SND_CHANNEL_ANY, 0.0, 0 );
}
}
parm = spawnArgs.GetString( "mtr_broken" );
if ( parm && *parm ) {
SetShader( parm );
}
UpdateVisuals();
}
示例15: SetAlertMode
/*
================
idSecurityCamera::Event_Alert
================
*/
void idSecurityCamera::Event_Alert( void ) {
float wait;
SetAlertMode( ACTIVATED );
StopSound( SND_CHANNEL_ANY, false );
StartSound( "snd_activate", SND_CHANNEL_BODY, 0, false, NULL );
ActivateTargets( this );
CancelEvents( &EV_SecurityCam_ContinueSweep );
wait = spawnArgs.GetFloat( "wait", "20" );
PostEventSec( &EV_SecurityCam_ContinueSweep, wait );
}