当前位置: 首页>>代码示例>>C++>>正文


C++ G_TempEntity函数代码示例

本文整理汇总了C++中G_TempEntity函数的典型用法代码示例。如果您正苦于以下问题:C++ G_TempEntity函数的具体用法?C++ G_TempEntity怎么用?C++ G_TempEntity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了G_TempEntity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CheckGauntletAttack

/*
===============
CheckGauntletAttack
===============
*/
qboolean CheckGauntletAttack( gentity_t *ent ) {
    trace_t		tr;
    vec3_t		end;
    gentity_t	*tent;
    gentity_t	*traceEnt;
    int			damage;

    // set aiming directions
    AngleVectors (ent->client->ps.viewangles, forward, right, up);

    CalcMuzzlePoint ( ent, forward, right, up, muzzle );

    VectorMA (muzzle, 32, forward, end);

    trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT);
    if ( tr.surfaceFlags & SURF_NOIMPACT ) {
        return qfalse;
    }

    traceEnt = &g_entities[ tr.entityNum ];

    // send blood impact
    if ( traceEnt->takedamage && traceEnt->client ) {
        tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT );
        tent->s.otherEntityNum = traceEnt->s.number;
        tent->s.eventParm = DirToByte( tr.plane.normal );
        tent->s.weapon = ent->s.weapon;
    }

    if ( !traceEnt->takedamage) {
        return qfalse;
    }

    if (ent->client->ps.powerups[PW_QUAD] ) {
        G_AddEvent( ent, EV_POWERUP_QUAD, 0 );
        s_quadFactor = g_quadfactor.value;
    } else {
        s_quadFactor = 1;
    }

    damage = 50 * s_quadFactor;
    G_Damage( traceEnt, ent, ent, forward, tr.endpos,
              damage, 0, MOD_GAUNTLET );

    return qtrue;
}
开发者ID:Clever-Boy,项目名称:entityplus,代码行数:51,代码来源:g_weapon.c

示例2: G_PlayEffect

//-----------------------------
void G_PlayEffect( int fxID, vec3_t origin, vec3_t fwd )
{
	gentity_t	*tent;
	vec3_t	temp;

	tent = G_TempEntity( origin, EV_PLAY_EFFECT );
	tent->s.eventParm = fxID;

	VectorSet( tent->maxs, FX_ENT_RADIUS, FX_ENT_RADIUS, FX_ENT_RADIUS );
	VectorScale( tent->maxs, -1, tent->mins );

	VectorCopy( fwd, tent->pos3 );

	// Assume angles, we'll do a cross product on the other end to finish up
	MakeNormalVectors( fwd, tent->pos4, temp );
	gi.linkentity( tent );
}
开发者ID:blaenk,项目名称:jedioutcast,代码行数:18,代码来源:g_utils.cpp

示例3: Team_CaptureFlagSound

void Team_CaptureFlagSound( gentity_t *ent, int team ) {
	gentity_t	*te;

	if (ent == NULL) {
		G_Printf ("Warning:  NULL passed to Team_CaptureFlagSound\n");
		return;
	}

	te = G_TempEntity( ent->s.pos.trBase, EV_GLOBAL_TEAM_SOUND );
	if( team == TEAM_BLUE ) {
		te->s.eventParm = GTS_BLUE_CAPTURE;
	}
	else {
		te->s.eventParm = GTS_RED_CAPTURE;
	}
	te->r.svFlags |= SVF_BROADCAST;
}
开发者ID:Avatarchik,项目名称:Quake-III-Arena-D3D11,代码行数:17,代码来源:g_team.c

示例4: teslaFire

void teslaFire( gentity_t *ent )
{
    trace_t   tr;
    vec3_t    end;
    gentity_t *traceEnt, *tent;

    VectorMA( muzzle, TESLAGEN_RANGE, forward, end );

    trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );

    if( tr.entityNum == ENTITYNUM_NONE )
        return;

    traceEnt = &g_entities[ tr.entityNum ];

    if( !traceEnt->client )
        return;

    if( traceEnt->client && traceEnt->client->ps.stats[ STAT_PTEAM ] != PTE_ALIENS &&
            !traceEnt->client->pers.bleeder )
        return;

    //so the client side knows
    ent->s.eFlags |= EF_FIRING;

    if( traceEnt->takedamage )
    {
        G_Damage( traceEnt, ent, ent, forward, tr.endpos,
                  TESLAGEN_DMG, 0, MOD_TESLAGEN );
    }

    // snap the endpos to integers to save net bandwidth, but nudged towards the line
    SnapVectorTowards( tr.endpos, muzzle );

    // send railgun beam effect
    tent = G_TempEntity( tr.endpos, EV_TESLATRAIL );

    VectorCopy( muzzle, tent->s.origin2 );

    tent->s.generic1 = ent->s.number; //src
    tent->s.clientNum = traceEnt->s.number; //dest

    // move origin a bit to come closer to the drawn gun muzzle
    VectorMA( tent->s.origin2, 28, up, tent->s.origin2 );
}
开发者ID:guzza,项目名称:Xserver,代码行数:45,代码来源:g_weapon.c

示例5: teslaFire

void teslaFire( gentity_t *self )
{
	trace_t   tr;
	vec3_t    origin, target;
	gentity_t *tent;

	if ( !self->enemy )
	{
		return;
	}

	// Move the muzzle from the entity origin up a bit to fire over turrets
	VectorMA( muzzle, self->r.maxs[ 2 ], self->s.origin2, origin );

	// Don't aim for the center, aim at the top of the bounding box
	VectorCopy( self->enemy->s.origin, target );
	target[ 2 ] += self->enemy->r.maxs[ 2 ];

	// Trace to the target entity
	trap_Trace( &tr, origin, NULL, NULL, target, self->s.number, MASK_SHOT );

	if ( tr.entityNum != self->enemy->s.number )
	{
		return;
	}

	// Client side firing effect
	self->s.eFlags |= EF_FIRING;

	// Deal damage
	if ( self->enemy->takedamage )
	{
		vec3_t dir;

		VectorSubtract( target, origin, dir );
		G_Damage( self->enemy, self, self, dir, tr.endpos,
		          TESLAGEN_DMG, 0, MOD_TESLAGEN );
	}

	// Send tesla zap trail
	tent = G_TempEntity( tr.endpos, EV_TESLATRAIL );
	tent->s.generic1 = self->s.number; // src
	tent->s.clientNum = self->enemy->s.number; // dest
}
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:44,代码来源:g_weapon.c

示例6: massDriverFire

void massDriverFire( gentity_t *ent )
{
  trace_t   tr;
  vec3_t    end;
  gentity_t *tent;
  gentity_t *traceEnt;

  G_CombatStats_Fire( ent, CSW_MDRIVER, MDRIVER_DMG );

  VectorMA( muzzle, 8192.0f * 16.0f, forward, end );

  G_UnlaggedOn( ent, muzzle, 8192.0f * 16.0f );
  trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
  G_UnlaggedOff( );

  if( tr.surfaceFlags & SURF_NOIMPACT )
    return;

  traceEnt = &g_entities[ tr.entityNum ];

  // snap the endpos to integers, but nudged towards the line
  SnapVectorTowards( tr.endpos, muzzle );

  // send impact
  if( traceEnt->takedamage && 
      (traceEnt->s.eType == ET_BUILDABLE || 
       traceEnt->s.eType == ET_PLAYER ) )
  {
    BloodSpurt( ent, traceEnt, &tr );
  }
  else
  {
    tent = G_TempEntity( tr.endpos, EV_MISSILE_MISS );
    tent->s.eventParm = DirToByte( tr.plane.normal );
    tent->s.weapon = ent->s.weapon;
    tent->s.generic1 = ent->s.generic1; //weaponMode
  }

  if( traceEnt->takedamage )
  {
    G_Damage( traceEnt, ent, ent, forward, tr.endpos,
      MDRIVER_DMG, 0, MOD_MDRIVER );
  }
}
开发者ID:massivehaxxor,项目名称:new-edge,代码行数:44,代码来源:g_weapon.c

示例7: ProximityMine_ExplodeOnPlayer

/*
================
ProximityMine_ExplodeOnPlayer
================
*/
static void ProximityMine_ExplodeOnPlayer( gentity_t *mine ) {
	gentity_t	*player;

	player = mine->enemy;
	player->client->ps.eFlags &= ~EF_TICKING;

	if ( player->client->invulnerabilityTime > level.time ) {
		G_Damage( player, mine->parent, mine->parent, vec3_origin, mine->s.origin, 1000, DAMAGE_NO_KNOCKBACK, MOD_JUICED );
		player->client->invulnerabilityTime = 0;
		G_TempEntity( player->client->ps.origin, EV_JUICED );
	}
	else {
		G_SetOrigin( mine, player->s.pos.trBase );
		// make sure the explosion gets to the client
		mine->r.svFlags &= ~SVF_NOCLIENT;
		mine->splashMethodOfDeath = MOD_PROXIMITY_MINE;
		G_ExplodeMissile( mine );
	}
}
开发者ID:OADoctor,项目名称:SmokinGuns,代码行数:24,代码来源:g_missile.c

示例8: G_PlayEffect

// Play an effect at a position on an entity.
// Mostly for G_MissileBounceEffect so we can play an effect on the bouncee.
//-----------------------------
void G_PlayEffect( int fxID, int clientNum, vec3_t origin, vec3_t fwd )
{
	gentity_t	*tent;
	vec3_t	temp;

	tent = G_TempEntity( origin, EV_PLAY_EFFECT );
	tent->s.eventParm = fxID;
	if ( clientNum != -1 )
	{
		tent->s.saberActive = 1;
		tent->s.otherEntityNum = clientNum;
	}
	VectorSet( tent->maxs, FX_ENT_RADIUS, FX_ENT_RADIUS, FX_ENT_RADIUS );
	VectorScale( tent->maxs, -1, tent->mins );
	VectorCopy( fwd, tent->s.angles );

	// Assume angles, we'll do a cross product on the other end to finish up
	MakeNormalVectors( fwd, tent->s.angles2, temp );
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:22,代码来源:g_utils.cpp

示例9: trap_SetConfigstring

bool Gametype_inf::onItemTouch(gitem_t *item, gclient_s *other){
	if (other->sess.team == TEAM_BLUE){
		trap_SetConfigstring(CS_GAMETYPE_MESSAGE, va("%i,%s", level.time + 5000, va("@%s ^7has taken the briefcase!", other->pers.netname.c_str()))); // Taken.
		trap_SendServerCommand(-1, va("print\"^3[INF] %s ^7has taken the briefcase.\n\"", other->pers.netname.c_str()));
		// Boe!Man 11/29/12: Global sound.
		if (!level.intermissionQueued && !level.intermissiontime){
			gentity_t* tent;
			tent = G_TempEntity(vec3_origin, EV_GLOBAL_SOUND);
			tent->s.eventParm = caseTakenSound;
			tent->r.svFlags = SVF_BROADCAST;
		}

		// Boe!Man 11/29/12: Radio message.
		G_Voice(&g_entities[other->ps.clientNum], NULL, SAY_TEAM, "got_it", qfalse);
		return true;
	}
	else
		return false;
}
开发者ID:Jordi1990,项目名称:Sof2MPSDK,代码行数:19,代码来源:gametype_inf.cpp

示例10: gas_think

void gas_think( gentity_t *ent ) {
	gentity_t *tent;

	ent->count++;

	if ( ent->health < ent->count ) {
		ent->think = G_FreeEntity;
		if ( ent->s.density == 5 ) {
			ent->nextthink = level.time + FRAMETIME;
		} else {
			ent->nextthink = level.time + 3000;
		}
		return;
	}

	ent->r.maxs[0] = ent->r.maxs[1] = ent->r.maxs[2]++;
	ent->r.mins[0] = ent->r.mins[1] = ent->r.mins[2]--;

	ent->nextthink = level.time + FRAMETIME;

	tent = G_TempEntity( ent->r.currentOrigin, EV_SMOKE );
	VectorCopy( ent->r.currentOrigin, tent->s.origin );

	if ( ent->s.density == 5 ) {
		tent->s.time = 500;
		tent->s.time2 = 100;
		tent->s.density = 5;

		tent->s.angles2[0] = 8;
		tent->s.angles2[1] = 32;
	} else
	{
		tent->s.time = 5000;
		tent->s.time2 = 3000;
		tent->s.density = 5;

		tent->s.angles2[0] = 24;
		tent->s.angles2[1] = 96;
	}

	trap_LinkEntity( ent );
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:42,代码来源:g_trigger.c

示例11: G_TempEntity

/*
==============
fire_mortar
	dir is a non-normalized direction/power vector
==============
*/
gentity_t *fire_mortar( gentity_t *self, vec3_t start, vec3_t dir ) {
	gentity_t   *bolt;

//	VectorNormalize (dir);

	if ( self->spawnflags ) {
		gentity_t   *tent;
		tent = G_TempEntity( self->s.pos.trBase, EV_MORTAREFX );
		tent->s.density = self->spawnflags; // send smoke and muzzle flash flags
		VectorCopy( self->s.pos.trBase, tent->s.origin );
		VectorCopy( self->s.apos.trBase, tent->s.angles );
	}

	bolt = G_Spawn();
	bolt->classname = const_cast<char*>("mortar");
	bolt->nextthink = level.time + 20000;   // push it out a little
	bolt->think = G_ExplodeMissile;
	bolt->s.eType = ET_MISSILE;

	bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN | SVF_BROADCAST;   // broadcast sound.  not multiplayer friendly, but for mortars it should be okay
	// bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN;

	bolt->s.weapon = WP_MORTAR;
	bolt->r.ownerNum = self->s.number;
	bolt->parent = self;
	bolt->damage = G_GetWeaponDamage( WP_MORTAR ); // JPW NERVE
	bolt->splashDamage = G_GetWeaponDamage( WP_MORTAR ); // JPW NERVE
	bolt->splashRadius = 120;
	bolt->methodOfDeath = MOD_MORTAR;
	bolt->splashMethodOfDeath = MOD_MORTAR_SPLASH;
	bolt->clipmask = MASK_MISSILESHOT;

	bolt->s.pos.trType = TR_GRAVITY;
	bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME;     // move a bit on the very first frame
	VectorCopy( start, bolt->s.pos.trBase );
//	VectorScale( dir, 900, bolt->s.pos.trDelta );
	VectorCopy( dir, bolt->s.pos.trDelta );
	SnapVector( bolt->s.pos.trDelta );          // save net bandwidth
	VectorCopy( start, bolt->r.currentOrigin );

	return bolt;
}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:48,代码来源:g_missile.cpp

示例12: weapon_supershotgun_fire

void weapon_supershotgun_fire (gentity_t *ent) {
	gentity_t		*tent;

	// send shotgun blast
	tent = G_TempEntity( muzzle, EV_SHOTGUN );
	VectorScale( forward, 4096, tent->s.origin2 );
	SnapVector( tent->s.origin2 );
	tent->s.eventParm = rand() & 255;		// seed for spread pattern
//unlagged - attack prediction #2
	if ( g_unlagged.integer ) {
		// this has to be something the client can predict now
		tent->s.eventParm = ent->client->attackTime % 256; // seed for spread pattern
	} else {
		tent->s.eventParm = rand() & 255;		// seed for spread pattern
	}
//unlagged - attack prediction #2
	tent->s.otherEntityNum = ent->s.number;

	ShotgunPattern( tent->s.pos.trBase, tent->s.origin2, tent->s.eventParm, ent );
}
开发者ID:themuffinator,项目名称:fnq3,代码行数:20,代码来源:g_weapon.c

示例13: BloodSpurt

/*
===============
BloodSpurt

Generates a blood spurt event for traces with accurate end points
===============
*/
static void BloodSpurt( gentity_t *attacker, gentity_t *victim, trace_t *tr )
{
	gentity_t *tent;

	if ( !attacker->client )
	{
		return;
	}

	if ( victim->health <= 0 )
	{
		return;
	}

	tent = G_TempEntity( tr->endpos, EV_MISSILE_HIT );
	tent->s.otherEntityNum = victim->s.number;
	tent->s.eventParm = DirToByte( tr->plane.normal );
	tent->s.weapon = attacker->s.weapon;
	tent->s.generic1 = attacker->s.generic1; // weaponMode
}
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:27,代码来源:g_weapon.c

示例14: smoke_think

void smoke_think(gentity_t *ent)
{
    gentity_t   *tent;

    ent->nextthink = level.time + ent->delay;

    if(!(ent->spawnflags & 4))
    {
        return;
    }

    if(ent->health)
    {
        ent->health--;

        if(!ent->health)
        {
            ent->think = G_FreeEntity;
            ent->nextthink = level.time + FRAMETIME;
        }
    }

    tent = G_TempEntity(ent->r.currentOrigin, EV_SMOKE);
    VectorCopy(ent->r.currentOrigin, tent->s.origin);
    tent->s.time = ent->speed;
    tent->s.time2 = ent->duration;
    tent->s.density = ent->s.density;

    // this is used to set the size of the smoke particle
    tent->s.angles2[0] = ent->start_size;
    tent->s.angles2[1] = ent->end_size;
    tent->s.angles2[2] = ent->wait;

    VectorCopy(ent->pos3, tent->s.origin2);

    if(ent->s.frame)      // denotes reverse gravity effect
    {
        tent->s.frame = 1;
    }

}
开发者ID:Justasic,项目名称:RTCW-SP,代码行数:41,代码来源:g_target.c

示例15: CheckObeliskAttack

/*
 * CheckObeliskAttack
 */
qbool
CheckObeliskAttack(Gentity *obelisk, Gentity *attacker)
{
	Gentity *te;

	/* if this really is an obelisk */
	if(obelisk->die != ObeliskDie)
		return qfalse;

	/* if the attacker is a client */
	if(!attacker->client)
		return qfalse;

	/* if the obelisk is on the same team as the attacker then don't hurt it */
	if(obelisk->spawnflags == attacker->client->sess.team)
		return qtrue;

	/* obelisk may be hurt */

	/* if not played any sounds recently */
	if((obelisk->spawnflags == TEAM_RED &&
	    teamgame.redObeliskAttackedTime < level.time -
	    OVERLOAD_ATTACK_BASE_SOUND_TIME) ||
	   (obelisk->spawnflags == TEAM_BLUE &&
	    teamgame.blueObeliskAttackedTime < level.time -
	    OVERLOAD_ATTACK_BASE_SOUND_TIME)){

		/* tell which obelisk is under attack */
		te = G_TempEntity(obelisk->s.pos.base, EV_GLOBAL_TEAM_SOUND);
		if(obelisk->spawnflags == TEAM_RED){
			te->s.eventParm = GTS_REDOBELISK_ATTACKED;
			teamgame.redObeliskAttackedTime = level.time;
		}else{
			te->s.eventParm = GTS_BLUEOBELISK_ATTACKED;
			teamgame.blueObeliskAttackedTime = level.time;
		}
		te->r.svFlags |= SVF_BROADCAST;
	}

	return qfalse;
}
开发者ID:icanhas,项目名称:yantar,代码行数:44,代码来源:team.c


注:本文中的G_TempEntity函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。