本文整理汇总了C++中G_UseTargets2函数的典型用法代码示例。如果您正苦于以下问题:C++ G_UseTargets2函数的具体用法?C++ G_UseTargets2怎么用?C++ G_UseTargets2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_UseTargets2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: misc_model_use
void misc_model_use (gentity_t *self, gentity_t *other, gentity_t *activator)
{
if ( self->health <= 0 && self->max_health > 0)
{//used while broken fired target3
G_UseTargets2( self, activator, self->target3 );
return;
}
G_ActivateBehavior( self, BSET_USE );
//Don't explode if they've requested it to not
if ( self->spawnflags & 64 )
{//Usemodels toggling
if ( self->spawnflags & 32 )
{
if( self->s.modelindex == self->sound1to2 )
{
self->s.modelindex = self->sound2to1;
}
else
{
self->s.modelindex = self->sound1to2;
}
}
return;
}
misc_model_breakable_die( self, other, activator, self->health, MOD_UNKNOWN );
}
示例2: for
/*
==============================
G_UseTargets
"activator" should be set to the entity that initiated the firing.
Search for (string)targetname in all entities that
match (string)self.target and call their .use function
==============================
*/
void G_UseTargets (gentity_t *ent, gentity_t *activator)
{
//
// fire targets
//
G_UseTargets2 (ent, activator, ent->target);
}
示例3: fx_runner_use
//----------------------------------------------------------
void fx_runner_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
if ( self->spawnflags & 2 ) // ONESHOT
{
// call the effect with the desired position and orientation, as a safety thing,
// make sure we aren't thinking at all.
fx_runner_think( self );
self->nextthink = -1;
if ( self->target2 )
{
// let our target know that we have spawned an effect
G_UseTargets2( self, self, self->target2 );
}
if ( VALIDSTRING( self->soundSet ) == true )
{
G_AddEvent( self, EV_BMODEL_SOUND, CAS_GetBModelSound( self->soundSet, BMS_START ));
}
}
else
{
// ensure we are working with the right think function
self->e_ThinkFunc = thinkF_fx_runner_think;
// toggle our state
if ( self->nextthink == -1 )
{
// NOTE: we fire the effect immediately on use, the fx_runner_think func will set
// up the nextthink time.
fx_runner_think( self );
if ( VALIDSTRING( self->soundSet ) == true )
{
G_AddEvent( self, EV_BMODEL_SOUND, CAS_GetBModelSound( self->soundSet, BMS_START ));
self->s.loopSound = CAS_GetBModelSound( self->soundSet, BMS_MID );
if ( self->s.loopSound < 0 )
{
self->s.loopSound = 0;
}
}
}
else
{
// turn off for now
self->nextthink = -1;
if ( VALIDSTRING( self->soundSet ) == true )
{
G_AddEvent( self, EV_BMODEL_SOUND, CAS_GetBModelSound( self->soundSet, BMS_END ));
self->s.loopSound = 0;
}
}
}
}
示例4: trigger_cleared_fire
void trigger_cleared_fire (gentity_t *self)
{
G_UseTargets2( self, self->activator, self->target2 );
self->e_ThinkFunc = thinkF_NULL;
// should start the wait timer now, because the trigger's just been cleared, so we must "wait" from this point
if ( self->wait > 0 )
{
self->nextthink = level.time + ( self->wait + self->random * crandom() ) * 1000;
}
}
示例5: func_usable_pain
void func_usable_pain(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, const vec3_t point, int damage, int mod,int hitLoc)
{
if ( self->paintarget )
{
G_UseTargets2 (self, self->activator, self->paintarget);
}
else
{
GEntity_UseFunc( self, attacker, attacker );
}
}
示例6: misc_model_breakable_pain
void misc_model_breakable_pain ( gentity_t *self, gentity_t *inflictor, gentity_t *other, vec3_t point, int damage, int mod,int hitLoc )
{
if ( self->health > 0 )
{
// still alive, react to the pain
if ( self->paintarget )
{
G_UseTargets2 (self, self->activator, self->paintarget);
}
// Don't do script if dead
G_ActivateBehavior( self, BSET_PAIN );
}
}
示例7: misc_model_breakable_pain
//pain function for model_breakables
void misc_model_breakable_pain (gentity_t *self, gentity_t *attacker, int damage)
{
if ( self->health > 0 )
{
// still alive, react to the pain
if ( self->paintarget )
{
G_UseTargets2 (self, self->activator, self->paintarget);
}
// Don't do script if dead
G_ActivateBehavior( self, BSET_PAIN );
}
}
示例8: target_counter_use
void target_counter_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
if ( self->count == 0 )
{
return;
}
//gi.Printf("target_counter %s used by %s, entnum %d\n", self->targetname, activator->targetname, activator->s.number );
self->count--;
if ( activator )
{
Quake3Game()->DebugPrint( IGameInterface::WL_VERBOSE, "target_counter %s used by %s (%d/%d)\n", self->targetname, activator->targetname, (self->max_health-self->count), self->max_health );
}
if ( self->count )
{
if ( self->target2 )
{
//gi.Printf("target_counter %s firing target2 from %s, entnum %d\n", self->targetname, activator->targetname, activator->s.number );
G_UseTargets2( self, activator, self->target2 );
}
return;
}
G_ActivateBehavior( self,BSET_USE );
if ( self->spawnflags & 128 )
{
self->svFlags |= SVF_INACTIVE;
}
self->activator = activator;
G_UseTargets( self, activator );
if ( self->count == 0 )
{
if ( self->bounceCount == 0 )
{
return;
}
self->count = self->max_health;
if ( self->bounceCount > 0 )
{//-1 means bounce back forever
self->bounceCount--;
}
}
}
示例9: target_counter_use
void target_counter_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
if ( self->count == 0 )
{
return;
}
//gi.Printf("target_counter %s used by %s, entnum %d\n", self->targetname, activator->targetname, activator->s.number );
self->count--;
if ( activator )
{
G_DebugPrint( WL_VERBOSE, "target_counter %s used by %s (%d/%d)\n", self->targetname, activator->targetname, (self->genericValue1-self->count), self->genericValue1 );
}
if ( self->count )
{
if ( self->target2 )
{
//gi.Printf("target_counter %s firing target2 from %s, entnum %d\n", self->targetname, activator->targetname, activator->s.number );
G_UseTargets2( self, activator, self->target2 );
}
return;
}
G_ActivateBehavior( self,BSET_USE );
if ( self->spawnflags & 128 )
{
self->flags |= FL_INACTIVE;
}
self->activator = activator;
G_UseTargets( self, activator );
if ( self->count == 0 )
{
if ( self->bounceCount == 0 )
{
return;
}
self->count = self->genericValue1;
if ( self->bounceCount > 0 )
{//-1 means bounce back forever
self->bounceCount--;
}
}
}
示例10: funcBBrushPain
void funcBBrushPain(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, vec3_t point, int damage, int mod,int hitLoc)
{
if ( self->painDebounceTime > level.time )
{
return;
}
if ( self->paintarget )
{
G_UseTargets2 (self, self->activator, self->paintarget);
}
G_ActivateBehavior( self, BSET_PAIN );
if ( self->material == MAT_DRK_STONE
|| self->material == MAT_LT_STONE
|| self->material == MAT_GREY_STONE )
{
vec3_t org, dir;
float scale;
VectorSubtract( self->absmax, self->absmin, org );// size
// This formula really has no logical basis other than the fact that it seemed to be the closest to yielding the results that I wanted.
// Volume is length * width * height...then break that volume down based on how many chunks we have
scale = VectorLength( org ) / 100.0f;
VectorMA( self->absmin, 0.5, org, org );
VectorAdd( self->absmin,self->absmax, org );
VectorScale( org, 0.5f, org );
if ( attacker != NULL && attacker->client )
{
VectorSubtract( attacker->currentOrigin, org, dir );
VectorNormalize( dir );
}
else
{
VectorSet( dir, 0, 0, 1 );
}
CG_Chunks( self->s.number, org, dir, self->mins, self->maxs, 300, Q_irand( 1, 3 ), self->material, 0, scale );
}
if ( self->wait == -1 )
{
self->e_PainFunc = painF_NULL;
return;
}
self->painDebounceTime = level.time + self->wait;
}
示例11: emplaced_gun_pain
//----------------------------------------------------------
void emplaced_gun_pain( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, const vec3_t point, int damage, int mod,int hitLoc )
{
if ( self->health <= 0 )
{
// play pain effect?
}
else
{
if ( self->paintarget )
{
G_UseTargets2( self, self->activator, self->paintarget );
}
// Don't do script if dead
G_ActivateBehavior( self, BSET_PAIN );
}
}
示例12: Svcmd_Use_f
void Svcmd_Use_f( void )
{
char *cmd1 = gi.argv(1);
if ( !cmd1 || !cmd1[0] )
{
//FIXME: warning message
gi.Printf( "'use' takes targetname of ent or 'list' (lists all usable ents)\n" );
return;
}
else if ( !Q_stricmp("list", cmd1) )
{
gentity_t *ent;
gi.Printf("Listing all usable entities:\n");
for ( int i = 1; i < ENTITYNUM_WORLD; i++ )
{
ent = &g_entities[i];
if ( ent )
{
if ( ent->targetname && ent->targetname[0] )
{
if ( ent->e_UseFunc != useF_NULL )
{
if ( ent->NPC )
{
gi.Printf( "%s (NPC)\n", ent->targetname );
}
else
{
gi.Printf( "%s\n", ent->targetname );
}
}
}
}
}
gi.Printf("End of list.\n");
}
else
{
G_UseTargets2( &g_entities[0], &g_entities[0], cmd1 );
}
}
示例13: misc_model_use
void misc_model_use (gentity_t *self, gentity_t *other, gentity_t *activator)
{
if ( self->target4 )
{//throw me at my target!
misc_model_throw_at_target4( self, activator );
return;
}
if ( self->health <= 0 && self->max_health > 0)
{//used while broken fired target3
G_UseTargets2( self, activator, self->target3 );
return;
}
// Become solid again.
if ( !self->count )
{
self->count = 1;
self->activator = activator;
self->svFlags &= ~SVF_NOCLIENT;
self->s.eFlags &= ~EF_NODRAW;
}
G_ActivateBehavior( self, BSET_USE );
//Don't explode if they've requested it to not
if ( self->spawnflags & 64 )
{//Usemodels toggling
if ( self->spawnflags & 32 )
{
if( self->s.modelindex == self->sound1to2 )
{
self->s.modelindex = self->sound2to1;
}
else
{
self->s.modelindex = self->sound1to2;
}
}
return;
}
self->e_DieFunc = dieF_misc_model_breakable_die;
misc_model_breakable_die( self, other, activator, self->health, MOD_UNKNOWN );
}
示例14: TurretG2Pain
void TurretG2Pain( gentity_t *self, gentity_t *attacker, int damage ) {
if ( self->paintarget && self->paintarget[0] ) {
if ( self->genericValue8 < level.time ) {
G_UseTargets2( self, self, self->paintarget );
self->genericValue8 = level.time + self->genericValue4;
}
}
if ( attacker->client && attacker->client->ps.weapon == WP_DEMP2 ) {
self->attackDebounceTime = level.time + 2000 + random() * 500;
self->painDebounceTime = self->attackDebounceTime;
}
if ( !self->enemy ) {//react to being hit
G_SetEnemy( self, attacker );
}
//self->s.health = self->health;
//mmm..yes..bad.
}
示例15: NPC_BSRemove
void NPC_BSRemove (void)
{
NPC_UpdateAngles ( qtrue, qtrue );
if( !gi.inPVS( NPC->currentOrigin, g_entities[0].currentOrigin ) )//FIXME: use cg.vieworg?
{
G_UseTargets2( NPC, NPC, NPC->target3 );
NPC->s.eFlags |= EF_NODRAW;
NPC->s.eFlags &= ~EF_NPC;
NPC->svFlags &= ~SVF_NPC;
NPC->s.eType = ET_INVISIBLE;
NPC->contents = 0;
NPC->health = 0;
NPC->targetname = NULL;
//Disappear in half a second
NPC->e_ThinkFunc = thinkF_G_FreeEntity;
NPC->nextthink = level.time + FRAMETIME;
}//FIXME: else allow for out of FOV???
}