• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ G_TempEntity函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: NS_SetPrimary

void NS_SetPrimary( gentity_t *ent, int primary ) {
	gentity_t *temp;

	temp = G_TempEntity( ent->client->ps.origin, EV_STOLENWEAPON );
	temp->s.weapon = primary;
	temp->s.otherEntityNum = ent->client->ps.clientNum;

	// copy old primary modifications to the new one [only for some weapon - some can't handle weaponmods]
	if ( BG_WeaponMods( primary ) & ( 1 << WM_SILENCER ) ) {
		ent->client->pers.nsInven.weapon_mods[primary].silencer = ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].silencer;
	}
	if ( BG_WeaponMods( primary ) & ( 1 << WM_LASER ) ) {
		ent->client->pers.nsInven.weapon_mods[primary].lasersight = ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].lasersight;
	}
	if ( BG_WeaponMods( primary ) & ( 1 << WM_SCOPE ) ) {
		ent->client->pers.nsInven.weapon_mods[primary].scope = ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].scope;
	}
	if ( BG_WeaponMods( primary ) & ( 1 << WM_BAYONET ) ) {
		ent->client->pers.nsInven.weapon_mods[primary].bayonet = ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].bayonet;
	}
	if ( BG_WeaponMods( primary ) & ( 1 << WM_GRENADELAUNCHER ) ) {
		ent->client->pers.nsInven.weapon_mods[primary].gl = ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].gl;
	}
	if ( BG_WeaponMods( primary ) & ( 1 << WM_DUCKBILL ) ) {
		ent->client->pers.nsInven.weapon_mods[primary].duckbill = ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].duckbill;
	}
	if ( BG_WeaponMods( primary ) & ( 1 << WM_FLASHLIGHT ) ) {
		ent->client->pers.nsInven.weapon_mods[primary].flashlight = ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].flashlight;
	}

	// delete old mods
	ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].silencer = 0;
	ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].lasersight = 0;
	ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].scope = 0;
	ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].bayonet = 0;
	ent->client->pers.nsInven.weapon_mods[ent->client->pers.nsInven.primaryweapon].gl = 0;


	// now set the new primary weapon
	ent->client->pers.nsInven.primaryweapon = primary;
}
开发者ID:zturtleman,项目名称:navy-seals,代码行数:41,代码来源:g_seal_menu.c


示例17: G_MissileBounceEffect

//-------------------------------------------------------------------------
void G_MissileBounceEffect( gentity_t *ent, vec3_t org, vec3_t dir )
{
	//FIXME: have an EV_BOUNCE_MISSILE event that checks the s.weapon and does the appropriate effect
	switch( ent->s.weapon )
	{
	case WP_BOWCASTER:
		G_PlayEffect( "bowcaster/deflect", ent->currentOrigin, dir );
		break;
	case WP_BLASTER:
	case WP_BRYAR_PISTOL:
		G_PlayEffect( "blaster/deflect", ent->currentOrigin, dir );
		break;
	default:
		{
			gentity_t *tent = G_TempEntity( org, EV_GRENADE_BOUNCE );
			VectorCopy( dir, tent->pos1 );
			tent->s.weapon = ent->s.weapon;
		}
		break;
	}
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:22,代码来源:g_missile.cpp


示例18: Blocked_Tramcar

void Blocked_Tramcar( gentity_t *ent, gentity_t *other ) {
	// remove anything other than a client
	if ( !other->client ) {
		// except CTF flags!!!!
		if ( other->s.eType == ET_ITEM && other->item->giType == IT_TEAM ) {
			Team_DroppedFlagThink( other );
			return;
		}
		G_TempEntity( other->s.origin, EV_ITEM_POP );
		G_FreeEntity( other );
		return;
	}

	if ( other->flags & FL_GODMODE ) {
		other->flags &= ~FL_GODMODE;
		other->client->ps.stats[STAT_HEALTH] = other->health = 0;
	}

	G_Damage( other, ent, ent, NULL, NULL, 99999, 0, MOD_CRUSH );

}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:21,代码来源:g_tramcar.c


示例19: meleeAttack

/*
===============
meleeAttack
===============
*/
void meleeAttack( gentity_t *ent, float range, float width, int damage, meansOfDeath_t mod )
{
  trace_t   tr;
  vec3_t    end;
  gentity_t *tent;
  gentity_t *traceEnt;
  vec3_t    mins, maxs;

  VectorSet( mins, -width, -width, -width );
  VectorSet( maxs, width, width, width );

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

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

  VectorMA( muzzle, range, forward, end );

  G_UnlaggedOn( ent, muzzle, range );
  trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT );
  G_UnlaggedOff( );

  if( tr.surfaceFlags & SURF_NOIMPACT )
    return;

  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;
    tent->s.generic1 = ent->s.generic1; //weaponMode
  }

  if( traceEnt->takedamage )
    G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, mod );
}
开发者ID:AlienHoboken,项目名称:Tremulous-W-Server,代码行数:45,代码来源:g_weapon.c


示例20: AddTeamScore

/*
 * AddTeamScore
 *
 * used for gametype > GT_TEAM
 * for gametype GT_TEAM the level.teamScores is updated in AddScore in g_combat.c
 */
void
AddTeamScore(Vec3 origin, int team, int score)
{
	Gentity *te;

	te = G_TempEntity(origin, EV_GLOBAL_TEAM_SOUND);
	te->r.svFlags |= SVF_BROADCAST;

	if(team == TEAM_RED){
		if(level.teamScores[ TEAM_RED ] + score ==
		   level.teamScores[ TEAM_BLUE ])
			/* teams are tied sound */
			te->s.eventParm = GTS_TEAMS_ARE_TIED;
		else if(level.teamScores[ TEAM_RED ] <=
			level.teamScores[ TEAM_BLUE ] &&
			level.teamScores[ TEAM_RED ] + score >
			level.teamScores[ TEAM_BLUE ])
			/* red took the lead sound */
			te->s.eventParm = GTS_REDTEAM_TOOK_LEAD;
		else
			/* red scored sound */
			te->s.eventParm = GTS_REDTEAM_SCORED;
	}else{
		if(level.teamScores[ TEAM_BLUE ] + score ==
		   level.teamScores[ TEAM_RED ])
			/* teams are tied sound */
			te->s.eventParm = GTS_TEAMS_ARE_TIED;
		else if(level.teamScores[ TEAM_BLUE ] <=
			level.teamScores[ TEAM_RED ] &&
			level.teamScores[ TEAM_BLUE ] + score >
			level.teamScores[ TEAM_RED ])
			/* blue took the lead sound */
			te->s.eventParm = GTS_BLUETEAM_TOOK_LEAD;
		else
			/* blue scored sound */
			te->s.eventParm = GTS_BLUETEAM_SCORED;
	}
	level.teamScores[ team ] += score;
}
开发者ID:icanhas,项目名称:yantar,代码行数:45,代码来源:team.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ G_TouchTriggers函数代码示例发布时间:2022-05-30
下一篇:
C++ G_TYPE_MODULE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap