本文整理汇总了C++中G_UseTargets2函数的典型用法代码示例。如果您正苦于以下问题:C++ G_UseTargets2函数的具体用法?C++ G_UseTargets2怎么用?C++ G_UseTargets2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_UseTargets2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );
}
开发者ID:Hasimir,项目名称:jedi-outcast-1,代码行数:29,代码来源:g_breakable.cpp
示例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);
}
开发者ID:kikili,项目名称:OpenJK,代码行数:18,代码来源:g_utils.cpp
示例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;
}
}
}
}
开发者ID:LTolosa,项目名称:Jedi-Outcast,代码行数:57,代码来源:g_fx.cpp
示例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;
}
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:10,代码来源:g_trigger.cpp
示例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 );
}
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:11,代码来源:g_usable.cpp
示例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 );
}
}
开发者ID:Hasimir,项目名称:jedi-outcast-1,代码行数:14,代码来源:g_breakable.cpp
示例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 );
}
}
开发者ID:ForcePush,项目名称:OJPRPFZ,代码行数:15,代码来源:g_breakable.c
示例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--;
}
}
}
开发者ID:AlexCSilva,项目名称:jediacademy,代码行数:48,代码来源:g_target.cpp
示例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--;
}
}
}
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:48,代码来源:g_target.cpp
示例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;
}
开发者ID:Hasimir,项目名称:jedi-outcast-1,代码行数:47,代码来源:g_breakable.cpp
示例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 );
}
}
开发者ID:kikili,项目名称:OpenJK,代码行数:18,代码来源:g_emplaced.cpp
示例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 );
}
}
开发者ID:kikili,项目名称:OpenJK,代码行数:45,代码来源:g_utils.cpp
示例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 );
}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:45,代码来源:g_breakable.cpp
示例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.
}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:18,代码来源:g_turret_G2.cpp
示例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???
}
开发者ID:Chedo,项目名称:OpenJK,代码行数:19,代码来源:NPC_behavior.cpp
示例16: fx_runner_think
//----------------------------------------------------------
void fx_runner_think( gentity_t *ent )
{
vec3_t temp;
EvaluateTrajectory( &ent->s.pos, level.time, ent->currentOrigin );
EvaluateTrajectory( &ent->s.apos, level.time, ent->currentAngles );
// call the effect with the desired position and orientation
G_AddEvent( ent, EV_PLAY_EFFECT, ent->fxID );
// Assume angles, we'll do a cross product on the other end to finish up
AngleVectors( ent->currentAngles, ent->pos3, NULL, NULL );
MakeNormalVectors( ent->pos3, ent->pos4, temp ); // there IS a reason this is done...it's so that it doesn't break every effect in the game...
ent->nextthink = level.time + ent->delay + random() * ent->random;
if ( ent->spawnflags & 4 ) // damage
{
G_RadiusDamage( ent->currentOrigin, ent, ent->splashDamage, ent->splashRadius, ent, MOD_UNKNOWN );
}
if ( ent->target2 )
{
// let our target know that we have spawned an effect
G_UseTargets2( ent, ent, ent->target2 );
}
if ( !(ent->spawnflags & 2 ) && !ent->s.loopSound ) // NOT ONESHOT...this is an assy thing to do
{
if ( VALIDSTRING( ent->soundSet ) == true )
{
ent->s.loopSound = CAS_GetBModelSound( ent->soundSet, BMS_MID );
if ( ent->s.loopSound < 0 )
{
ent->s.loopSound = 0;
}
}
}
}
开发者ID:LTolosa,项目名称:Jedi-Outcast,代码行数:42,代码来源:g_fx.cpp
示例17: func_wait_return_solid
void func_wait_return_solid( gentity_t *self )
{
//once a frame, see if it's clear.
self->clipmask = CONTENTS_BODY;//|CONTENTS_MONSTERCLIP|CONTENTS_BOTCLIP;
if ( !(self->spawnflags&16) || G_TestEntityPosition( self ) == NULL )
{
gi.SetBrushModel( self, self->model );
VectorCopy( self->currentOrigin, self->pos1 );
InitMover( self );
/*
VectorCopy( self->s.origin, self->s.pos.trBase );
VectorCopy( self->s.origin, self->currentOrigin );
*/
//if we moved, we want the *current* origin, not our start origin!
VectorCopy( self->currentOrigin, self->s.pos.trBase );
gi.linkentity( self );
self->svFlags &= ~SVF_NOCLIENT;
self->s.eFlags &= ~EF_NODRAW;
self->e_UseFunc = useF_func_usable_use;
self->clipmask = 0;
if ( self->target2 && self->target2[0] )
{
G_UseTargets2( self, self->activator, self->target2 );
}
if ( self->s.eFlags & EF_ANIM_ONCE )
{//Start our anim
self->s.frame = 0;
}
//NOTE: be sure to reset the brushmodel before doing this or else CONTENTS_OPAQUE may not be on when you call this
if ( !(self->spawnflags&1) )
{//START_OFF doesn't effect area portals
gi.AdjustAreaPortalState( self, qfalse );
}
}
else
{
self->clipmask = 0;
self->e_ThinkFunc = thinkF_func_wait_return_solid;
self->nextthink = level.time + FRAMETIME;
}
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:41,代码来源:g_usable.cpp
示例18: G_FindLocalInterestPoint
int G_FindLocalInterestPoint( gentity_t *self )
{
int i, bestPoint = ENTITYNUM_NONE;
float dist, bestDist = Q3_INFINITE;
vec3_t diffVec, eyes;
CalcEntitySpot( self, SPOT_HEAD_LEAN, eyes );
for ( i = 0; i < level.numInterestPoints; i++ )
{
//Don't ignore portals? If through a portal, need to look at portal!
if ( gi.inPVS( level.interestPoints[i].origin, eyes ) )
{
VectorSubtract( level.interestPoints[i].origin, eyes, diffVec );
if ( (fabs(diffVec[0]) + fabs(diffVec[1])) / 2 < 48 &&
fabs(diffVec[2]) > (fabs(diffVec[0]) + fabs(diffVec[1])) / 2 )
{//Too close to look so far up or down
continue;
}
dist = VectorLengthSquared( diffVec );
//Some priority to more interesting points
//dist -= ((int)level.interestPoints[i].lookMode * 5) * ((int)level.interestPoints[i].lookMode * 5);
if ( dist < MAX_INTEREST_DIST && dist < bestDist )
{
if ( G_ClearLineOfSight( eyes, level.interestPoints[i].origin, self->s.number, MASK_OPAQUE ) )
{
bestDist = dist;
bestPoint = i;
}
}
}
}
if ( bestPoint != ENTITYNUM_NONE && level.interestPoints[bestPoint].target )
{
G_UseTargets2( self, self, level.interestPoints[bestPoint].target );
}
return bestPoint;
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:37,代码来源:NPC_senses.cpp
示例19: turretG2_find_enemies
//.........这里部分代码省略.........
//else: we will shoot at bbrushes!
}
if ( target == self || !target->takedamage || target->health <= 0 || ( target->flags & FL_NOTARGET ))
{
continue;
}
if ( target->client && target->client->sess.sessionTeam == TEAM_SPECTATOR )
{
continue;
}
if ( self->alliedTeam )
{
if ( target->client )
{
if ( target->client->sess.sessionTeam == self->alliedTeam )
{
// A bot/client/NPC we don't want to shoot
continue;
}
}
else if ( target->teamnodmg == self->alliedTeam )
{
// An ent we don't want to shoot
continue;
}
}
if ( !trap_InPVS( org2, target->r.currentOrigin ))
{
continue;
}
if ( target->client )
{
VectorCopy( target->client->renderInfo.eyePoint, org );
}
else
{
VectorCopy( target->r.currentOrigin, org );
}
if ( self->spawnflags & 2 )
{
org[2] -= 15;
}
else
{
org[2] += 5;
}
trap_Trace( &tr, org2, NULL, NULL, org, self->s.number, MASK_SHOT );
if ( !tr.allsolid && !tr.startsolid && ( tr.fraction == 1.0 || tr.entityNum == target->s.number ))
{
// Only acquire if have a clear shot, Is it in range and closer than our best?
VectorSubtract( target->r.currentOrigin, self->r.currentOrigin, enemyDir );
enemyDist = VectorLengthSquared( enemyDir );
if ( enemyDist < bestDist || (target->client && !foundClient))// all things equal, keep current
{
if ( self->attackDebounceTime < level.time )
{
// We haven't fired or acquired an enemy in the last 2 seconds-start-up sound
if ( !(self->spawnflags&SPF_TURRETG2_TURBO) )
{
G_Sound( self, CHAN_BODY, G_SoundIndex( "sound/chars/turret/startup.wav" ));
}
// Wind up turrets for a bit
self->attackDebounceTime = level.time + 1400;
}
bestTarget = target;
bestDist = enemyDist;
found = qtrue;
if ( target->client )
{ //prefer clients over non-clients
foundClient = qtrue;
}
}
}
}
if ( found )
{
/*
if ( !self->enemy )
{//just aquired one
AddSoundEvent( bestTarget, self->r.currentOrigin, 256, AEL_DISCOVERED );
AddSightEvent( bestTarget, self->r.currentOrigin, 512, AEL_DISCOVERED, 20 );
}
*/
G_SetEnemy( self, bestTarget );
if ( VALIDSTRING( self->target2 ))
{
G_UseTargets2( self, self, self->target2 );
}
}
return found;
}
开发者ID:Atlas-zz,项目名称:SDK-JKA-ACADEMIE-HCF,代码行数:101,代码来源:g_turret_G2.c
示例20: trigger_entdist_use
void trigger_entdist_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
vec3_t diff;
gentity_t *found = NULL;
gentity_t *owner = NULL;
qboolean useflag;
const char *token, *holdString;
if ( self->svFlags & SVF_INACTIVE ) // Don't use INACTIVE
return;
G_ActivateBehavior(self,BSET_USE);
if(self->ownername && self->ownername[0])
{
owner = G_Find(NULL, FOFS(targetname), self->ownername);
}
if(owner == NULL)
{
owner = self;
}
self->activator = activator;
useflag = qfalse;
self->svFlags |= SVF_INACTIVE; // Make it inactive after one use
if (self->spawnflags & ENTDIST_PLAYER) // Look for player???
{
found = &g_entities[0];
if (found)
{
VectorSubtract(owner->currentOrigin, found->currentOrigin, diff);
if(VectorLength(diff) < self->count)
{
useflag = qtrue;
}
}
}
if ((self->spawnflags & ENTDIST_NPC) && (!useflag))
{
holdString = self->NPC_target;
while (holdString)
{
token = COM_Parse( &holdString);
if ( !token ) // Nothing left to look at
{
break;
}
found = G_Find(found, FOFS(targetname), token); // Look for the specified NPC
if (found) //Found???
{
VectorSubtract(owner->currentOrigin, found->currentOrigin, diff);
if(VectorLength(diff) < self->count) // Within distance
{
useflag = qtrue;
break;
}
}
}
}
if (useflag)
{
G_UseTargets2 (self, self->activator, self->target);
}
else if (self->target2)
{
// This is the negative target
G_UseTargets2 (self, self->activator, self->target2);
}
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:80,代码来源:g_trigger.cpp
注:本文中的G_UseTargets2函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论