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

C++ G_AddEvent函数代码示例

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

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



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

示例1: 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:Hasimir,项目名称:jedi-academy-1,代码行数:42,代码来源:g_fx.cpp


示例2: NPC_MineMonster_Pain

/*
-------------------------
NPC_MineMonster_Pain
-------------------------
*/
void NPC_MineMonster_Pain(gentity_t *self, gentity_t *attacker, int damage)
{
	G_AddEvent( self, EV_PAIN, floor((float)self->health/self->client->pers.maxHealth*100.0f) );

	if ( damage >= 10 )
	{
		TIMER_Remove( self, "attacking" );
		TIMER_Remove( self, "attacking1_dmg" );
		TIMER_Remove( self, "attacking2_dmg" );
		TIMER_Set( self, "takingPain", 1350 );

		VectorCopy( &self->NPC->lastPathAngles, &self->s.angles );

		NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );

		if ( self->NPC )
		{
			self->NPC->localState = LSTATE_WAITING;
		}
	}
}
开发者ID:Geptun,项目名称:japp,代码行数:26,代码来源:NPC_AI_MineMonster.c


示例3: Slay

void __cdecl Slay(void) {
    int argc = Cmd_Argc();
    if (argc < 2) {
        Com_Printf("Usage: %s <client_id>\n", Cmd_Argv(0));
        return;
    }
    int i = atoi(Cmd_Argv(1));
    if (i < 0 || i > sv_maxclients->integer) {
        Com_Printf("client_id must be a number between 0 and %d\n.", sv_maxclients->integer);
        return;
    }
    else if (g_entities[i].inuse && g_entities[i].health > 0) {
        Com_Printf("Slaying player...\n");
        SV_SendServerCommand(NULL, "print \"%s^7 was slain!\n\"\n", svs->clients[i].name);
        DebugPrint("Slaying '%s'!\n", svs->clients[i].name);
		g_entities[i].health = -40;
		G_AddEvent(&g_entities[i], EV_GIB_PLAYER, g_entities[i].s.number);
    }
    else
        Com_Printf("The player is currently not active.\n");
}
开发者ID:JoolsJealous,项目名称:minqlx,代码行数:21,代码来源:commands.c


示例4: AICast_AimAtEnemy

/*
=======================================================================================================================================
AIFunc_Helga_MeleeStart
=======================================================================================================================================
*/
char *AIFunc_Helga_MeleeStart(cast_state_t *cs) {
	gentity_t *ent;

	ent = &g_entities[cs->entityNum];
	ent->s.effect1Time = level.time;
	cs->ideal_viewangles[YAW] = cs->viewangles[YAW];
	cs->weaponFireTimes[cs->weaponNum] = level.time;
	cs->animHitCount = 0;
	cs->aiFlags |= AIFL_SPECIAL_FUNC;
	// face them
	AICast_AimAtEnemy(cs);
	// play an anim
	BG_UpdateConditionValue(cs->entityNum, ANIM_COND_WEAPON, cs->weaponNum, qtrue);
	BG_AnimScriptEvent(&ent->client->ps, ANIM_ET_FIREWEAPON, qfalse, qtrue);
	// play a sound
	G_AddEvent(ent, EV_GENERAL_SOUND, G_SoundIndex(aiDefaults[ent->aiCharacter].soundScripts[ATTACKSOUNDSCRIPT]));

	cs->aifunc = AIFunc_Helga_Melee;
	cs->aifunc(cs);  // think once now, to prevent a delay
	return "AIFunc_Helga_Melee";
}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:26,代码来源:ai_cast_func_boss1.c


示例5: G_ScriptAction_PlaySound

/*
================
G_ScriptAction_PlaySound

  syntax: playsound <soundname OR scriptname> [LOOPING]

  Currently only allows playing on the VOICE channel, unless you use a sound script.

  Use the optional LOOPING paramater to attach the sound to the entities looping channel.
================
*/
qboolean G_ScriptAction_PlaySound( gentity_t *ent, char *params ) {
    char *pString, *token;
    char sound[MAX_QPATH];

    if ( !params ) {
        G_Error( "G_Scripting: syntax error\n\nplaysound <soundname OR scriptname>\n" );
    }

    pString = params;
    token = COM_ParseExt( &pString, qfalse );
    Q_strncpyz( sound, token, sizeof( sound ) );

    token = COM_ParseExt( &pString, qfalse );
    if ( !token[0] || Q_strcasecmp( token, "looping" ) ) {
        G_AddEvent( ent, EV_GENERAL_SOUND, G_SoundIndex( sound ) );
    } else {    // looping channel
        ent->s.loopSound = G_SoundIndex( sound );
    }

    return qtrue;
}
开发者ID:aleksandr-pushkarev,项目名称:RTCW-SP,代码行数:32,代码来源:g_script_actions.c


示例6: NPC_MineMonster_Pain

/*
-------------------------
NPC_MineMonster_Pain
-------------------------
*/
void NPC_MineMonster_Pain( gentity_t *self, gentity_t *inflictor, gentity_t *other, const vec3_t point, int damage, int mod,int hitLoc ) 
{
	G_AddEvent( self, EV_PAIN, floor((float)self->health/self->max_health*100.0f) );

	if ( damage >= 10 )
	{
		TIMER_Remove( self, "attacking" );
		TIMER_Remove( self, "attacking1_dmg" );
		TIMER_Remove( self, "attacking2_dmg" );
		TIMER_Set( self, "takingPain", 1350 );

		VectorCopy( self->NPC->lastPathAngles, self->s.angles );

		NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );

		if ( self->NPC )
		{
			self->NPC->localState = LSTATE_WAITING;
		}
	}
}
开发者ID:Arbixal,项目名称:OpenJK,代码行数:26,代码来源:AI_MineMonster.cpp


示例7: G_GiveClientMaxAmmo

/*
=================
G_GiveClientMaxAmmo
=================
*/
void G_GiveClientMaxAmmo( gentity_t *ent, qboolean buyingEnergyAmmo )
{
  int       i;
  int       maxAmmo, maxClips;
  qboolean  weaponType, restoredAmmo = qfalse;

  for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
  {
    if( buyingEnergyAmmo )
      weaponType = BG_FindUsesEnergyForWeapon( i );
    else
      weaponType = !BG_FindUsesEnergyForWeapon( i );

    if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) &&
        weaponType && !BG_FindInfinteAmmoForWeapon( i ) &&
        !BG_WeaponIsFull( i, ent->client->ps.stats,
          ent->client->ps.ammo, ent->client->ps.powerups ) )
    {
      BG_FindAmmoForWeapon( i, &maxAmmo, &maxClips );

      if( buyingEnergyAmmo )
      {
        G_AddEvent( ent, EV_RPTUSE_SOUND, 0 );

        if( BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) )
          maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER );
      }
      else if ( BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) )
	maxClips = (int)( (float)maxAmmo * BATTPACK_MODIFIER );

      BG_PackAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups,
                        maxAmmo, maxClips );

      restoredAmmo = qtrue;
    }
  }

  if( restoredAmmo )
    G_ForceWeaponChange( ent, ent->client->ps.weapon );
}
开发者ID:ZdrytchX,项目名称:Lolards_old,代码行数:45,代码来源:g_weapon.c


示例8: LetGoOfGatling

/*
========================
LetGoOfGatling

Make a player let go of the deployed gatling he's using.
========================
*/
static void LetGoOfGatling(gclient_t *client, gentity_t *gatling) {
	// add the ammo into the gatling
	gatling->count = client->ps.ammo[WP_GATLING];
	client->ps.weaponTime = 0;
	client->ps.eFlags &= ~EF_RELOAD;
	client->ps.stats[STAT_GATLING_MODE] = 0;

	// only do that if player doesn't carry another gatling
	if(!(client->ps.stats[STAT_FLAGS] & SF_GAT_CARRY)) {
		client->ps.stats[STAT_WEAPONS] &= ~(1 << WP_GATLING);
		client->ps.ammo[WP_GATLING] = 0;
	}
	else {
		client->ps.ammo[WP_GATLING] = client->carriedGatlingAmmo;
	}

	if(!client->ps.stats[STAT_OLDWEAPON] ||
			  (client->ps.stats[STAT_OLDWEAPON] == WP_GATLING &&
			  !(client->ps.stats[STAT_FLAGS] & SF_GAT_CARRY))) {
		int i;

		for ( i = WP_GATLING ; i > 0 ; i-- ) {
			if ( client->ps.stats[STAT_WEAPONS] & ( 1 << i ) ) {
				client->ps.stats[STAT_OLDWEAPON] = i;
				break;
			}
		}

		//G_Printf("away %i\n", client->ps.stats[STAT_OLDWEAPON]);
	}

	client->pers.cmd.weapon = client->ps.stats[STAT_OLDWEAPON];
	G_AddEvent(&g_entities[gatling->s.eventParm], EV_CHANGE_TO_WEAPON, client->ps.stats[STAT_OLDWEAPON]);

	gatling->s.eventParm = -1;

	// Tequila comment: Gatling is now an object in the world
	gatling->r.contents = MASK_SHOT;
}
开发者ID:Mixone-FinallyHere,项目名称:SmokinGuns,代码行数:46,代码来源:g_sg_utils.c


示例9: Use_Shooter

void Use_Shooter( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
	vec3_t		dir;
	float		deg;
	vec3_t		up, right;

	// see if we have a target
	if ( ent->enemy ) {
		VectorSubtract( ent->enemy->r.currentOrigin, ent->s.origin, dir );
		VectorNormalize( dir );
	} else {
		VectorCopy( ent->movedir, dir );
	}

	// randomize a bit
	PerpendicularVector( up, dir );
	CrossProduct( up, dir, right );

	deg = crandom() * ent->random;
	VectorMA( dir, deg, up, dir );

	deg = crandom() * ent->random;
	VectorMA( dir, deg, right, dir );

	VectorNormalize( dir );

	switch ( ent->s.weapon ) {
	case WP_GRENADE_LAUNCHER:
		fire_grenade( ent, ent->s.origin, dir );
		break;
	case WP_ROCKET_LAUNCHER:
		fire_rocket( ent, ent->s.origin, dir );
		break;
	case WP_PLASMAGUN:
		fire_plasma( ent, ent->s.origin, dir );
		break;
	}

	G_AddEvent( ent, EV_FIRE_WEAPON, 0 );
}
开发者ID:d00man,项目名称:openarena-vm,代码行数:39,代码来源:g_misc.c


示例10: buildFire

/*
===============
buildFire
===============
*/
void buildFire( gentity_t *ent, dynMenu_t menu )
{
  if( ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
  {
    if( ent->client->ps.stats[ STAT_MISC ] > 0 )
    {
      G_AddEvent( ent, EV_BUILD_DELAY, ent->client->ps.clientNum );
      return;
    }

    if( G_ValidateBuild( ent, ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) )
    {
      if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && !G_isOvermind( ) )
      {
        ent->client->ps.stats[ STAT_MISC ] +=
          BG_FindBuildDelayForWeapon( ent->s.weapon ) * 2;
      }
      else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && !G_isPower( muzzle ) &&
          ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) != BA_H_REPEATER ) //hack
      {
        ent->client->ps.stats[ STAT_MISC ] +=
          BG_FindBuildDelayForWeapon( ent->s.weapon ) * 2;
      }
      else
        ent->client->ps.stats[ STAT_MISC ] +=
          BG_FindBuildDelayForWeapon( ent->s.weapon );

      ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;

      // don't want it bigger than 32k
      if( ent->client->ps.stats[ STAT_MISC ] > 30000 )
        ent->client->ps.stats[ STAT_MISC ] = 30000;
    }
    return;
  }

  G_TriggerMenu( ent->client->ps.clientNum, menu );
}
开发者ID:wtfbbqhax,项目名称:thz,代码行数:43,代码来源:g_weapon.c


示例11: Cmd_UseSentry_f

void Cmd_UseSentry_f(gentity_t *ent)
{
	if ( ent->health < 1 || in_camera )
	{
		return;
	}

	if ( ent->client->ps.inventory[INV_SENTRY] <= 0 )
	{
		// have none to place...play sound?
		return;
	}

	if ( place_portable_assault_sentry( ent, ent->currentOrigin, ent->client->ps.viewangles ))
	{
		ent->client->ps.inventory[INV_SENTRY]--;
		G_AddEvent( ent, EV_USE_INV_SENTRY, 0 );
	}
	else
	{
		// couldn't be placed....play a notification sound!!
	}
}
开发者ID:PJayB,项目名称:jk2src,代码行数:23,代码来源:g_cmds.cpp


示例12: ObeliskPain

/*
=======================================================================================================================================
ObeliskPain
=======================================================================================================================================
*/
void ObeliskPain(gentity_t *self, gentity_t *attacker, int damage) {
	int actualDamage;

	actualDamage = damage / 10;

	if (actualDamage <= 0) {
		actualDamage = 1;
	}

	self->activator->s.modelindex2 = self->health * 0xff / g_obeliskHealth.integer;

	if (!self->activator->s.frame) {
		G_AddEvent(self, EV_OBELISKPAIN, 0);
	}

	self->activator->s.frame = 1;

	if (self->spawnflags == attacker->client->sess.sessionTeam) {
		AddScore(attacker, self->r.currentOrigin, -actualDamage);
	} else {
		AddScore(attacker, self->r.currentOrigin, actualDamage);
	}
}
开发者ID:KuehnhammerTobias,项目名称:ioqw,代码行数:28,代码来源:g_team.c


示例13: alarmbox_use

/**
 * @brief alarmbox_use
 * @param[in,out] ent
 * @param[in] other
 * @param foo - unused
 */
void alarmbox_use(gentity_t *ent, gentity_t *other, gentity_t *foo)
{
	if (!(ent->active))
	{
		return;
	}

	if (ent->s.frame)
	{
		ent->s.frame = 0;
	}
	else
	{
		ent->s.frame = 1;
	}

	alarmbox_updateparts(ent, qtrue);
	if (other->client)
	{
		G_AddEvent(ent, EV_GENERAL_SOUND, ent->soundPos3);
	}
	//	G_Printf("touched alarmbox\n");
}
开发者ID:zturtleman,项目名称:etlegacy,代码行数:29,代码来源:g_alarm.c


示例14: G_minethink

void
G_minethink(gentity_t *ent)
{
  trace_t tr;
  vec3_t end, origin, dir;
  gentity_t *traceEnt;

  ent->nextthink = level.time + 100;

  BG_EvaluateTrajectory(&ent->s.pos, level.time, origin);
  SnapVector(origin);
  G_SetOrigin(ent, origin);

  // set aiming directions
  VectorCopy(origin,end);
  end[2] += 10;//aim up

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

  traceEnt = &g_entities[tr.entityNum];

  dir[0] = dir[1] = 0;
  dir[2] = 1;

  if (traceEnt->client && (traceEnt->r.svFlags & SVF_BOT)
      && traceEnt->health > 0 && traceEnt->client->ps.stats[STAT_PTEAM] == PTE_ALIENS)//FIRE IN ZE HOLE!
  {//Might want to check team too
    ent->s.eType = ET_GENERAL;
    G_AddEvent(ent, EV_MISSILE_MISS, DirToByte(dir));
    ent->freeAfterEvent = qtrue;
    G_RadiusDamage(ent->r.currentOrigin, ent->parent, ent->splashDamage, ent->splashRadius, ent, ent->splashMethodOfDeath);
    ent->parent->numMines -= 1;
    trap_LinkEntity(ent);
  }
}
开发者ID:AlienHoboken,项目名称:Tremulous-Z-Server,代码行数:37,代码来源:g_missile.c


示例15: ProximityMine_Player

/*
================
ProximityMine_Player
================
*/
static void ProximityMine_Player(gentity_t * mine, gentity_t * player)
{
	if(mine->s.eFlags & EF_NODRAW)
	{
		return;
	}

	G_AddEvent(mine, EV_PROXIMITY_MINE_STICK, 0);

	if(player->s.eFlags & EF_TICKING)
	{
		player->activator->splashDamage += mine->splashDamage;
		player->activator->splashRadius *= 1.50;
		mine->think = G_FreeEntity;
		mine->nextthink = level.time;
		return;
	}

	player->client->ps.eFlags |= EF_TICKING;
	player->activator = mine;

	mine->s.eFlags |= EF_NODRAW;
	mine->r.svFlags |= SVF_NOCLIENT;
	mine->s.pos.trType = TR_LINEAR;
	VectorClear(mine->s.pos.trDelta);

	mine->enemy = player;
	mine->think = ProximityMine_ExplodeOnPlayer;
	if(player->client->invulnerabilityTime > level.time)
	{
		mine->nextthink = level.time + 2 * 1000;
	}
	else
	{
		mine->nextthink = level.time + 10 * 1000;
	}
}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:42,代码来源:g_missile.c


示例16: laserTrapExplode

void laserTrapExplode( gentity_t *self )
{
	vec3_t v;
	self->takedamage = qfalse;

	if (self->activator)
	{
		G_RadiusDamage( self->r.currentOrigin, self->activator, self->splashDamage, self->splashRadius, self, self, MOD_TRIP_MINE_SPLASH/*MOD_LT_SPLASH*/ );
	}

	if (self->s.weapon != WP_FLECHETTE)
	{
		G_AddEvent( self, EV_MISSILE_MISS, 0);
	}

	VectorCopy(self->s.pos.trDelta, v);
	//Explode outward from the surface

	if (self->s.time == -2)
	{
		v[0] = 0;
		v[1] = 0;
		v[2] = 0;
	}

	if (self->s.weapon == WP_FLECHETTE)
	{
		G_PlayEffect(EFFECT_EXPLOSION_FLECHETTE, self->r.currentOrigin, v);
	}
	else
	{
		G_PlayEffect(EFFECT_EXPLOSION_TRIPMINE, self->r.currentOrigin, v);
	}

	self->think = G_FreeEntity;
	self->nextthink = level.time;
}
开发者ID:mehmehsomeone,项目名称:OpenRP,代码行数:37,代码来源:WP_Trip_Mine.cpp


示例17: GibEntity

/*
==================
GibEntity
==================
*/
void GibEntity( gentity_t *self, int killer ) {
	gentity_t *ent;
	int i;

	//if this entity still has kamikaze
	if (self->s.eFlags & EF_KAMIKAZE) {
		// check if there is a kamikaze timer around for this owner
		for (i = 0; i < MAX_GENTITIES; i++) {
			ent = &g_entities[i];
			if (!ent->inuse)
				continue;
			if (ent->activator != self)
				continue;
			if (strcmp(ent->classname, "kamikaze timer"))
				continue;
			G_FreeEntity(ent);
			break;
		}
	}
	G_AddEvent( self, EV_GIB_PLAYER, killer );
	self->takedamage = qfalse;
	self->s.eType = ET_INVISIBLE;
	self->r.contents = 0;
}
开发者ID:DingoOz,项目名称:Quake3-GLES-for-armv7,代码行数:29,代码来源:g_combat.c


示例18: DoRespawn

void DoRespawn( edict_t *ent )
{
	if( ent->team )
	{
		edict_t	*master;
		int count;
		int choice;

		master = ent->teammaster;

		for( count = 0, ent = master; ent; ent = ent->chain, count++ );

		choice = rand() % count;

		for( count = 0, ent = master; count < choice; ent = ent->chain, count++ );
	}

	ent->r.solid = SOLID_TRIGGER;
	ent->r.svflags &= ~SVF_NOCLIENT;

	GClip_LinkEntity( ent );

	// send an effect
	G_AddEvent( ent, EV_ITEM_RESPAWN, ent->item ? ent->item->tag : 0, qtrue );

	// powerups announce their presence with a global sound
	if( ent->item && ( ent->item->type & IT_POWERUP ) )
	{
		if( ent->item->tag == POWERUP_QUAD )
			G_GlobalSound( CHAN_AUTO, trap_SoundIndex( S_ITEM_QUAD_RESPAWN ) );
		if( ent->item->tag == POWERUP_SHELL )
			G_GlobalSound( CHAN_AUTO, trap_SoundIndex( S_ITEM_WARSHELL_RESPAWN ) );
		if( ent->item->tag == POWERUP_REGEN )
			G_GlobalSound( CHAN_AUTO, trap_SoundIndex( S_ITEM_REGEN_RESPAWN ) );
	}
}
开发者ID:hettoo,项目名称:racesow,代码行数:36,代码来源:g_items.c


示例19: G_ExplodeMissile

/*
================
G_ExplodeMissile

Explode a missile without an impact
================
*/
void G_ExplodeMissile( gentity_t *ent ) {
    vec3_t		dir;
    vec3_t		origin;

    BG_EvaluateTrajectory( &ent->s.pos, level.time, origin );
    SnapVector( origin );
    G_SetOrigin( ent, origin );

    // we don't have a valid direction, so just point straight up
    dir[0] = dir[1] = 0;
    dir[2] = 1;

    ent->s.eType = ET_GENERAL;
    G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( dir ) );

    ent->freeAfterEvent = qtrue;

    ent->takedamage = qfalse;
    // splash damage
    if ( ent->splashDamage ) {
        if( G_RadiusDamage( ent->r.currentOrigin, ent->parent, ent->splashDamage, ent->splashRadius, ent,
                            ent, ent->splashMethodOfDeath ) )
        {
            if (ent->parent)
            {
                g_entities[ent->parent->s.number].client->accuracy_hits++;
            }
            else if (ent->activator)
            {
                g_entities[ent->activator->s.number].client->accuracy_hits++;
            }
        }
    }

    trap->LinkEntity( (sharedEntity_t *)ent );
}
开发者ID:Mauii,项目名称:Rend2,代码行数:43,代码来源:g_missile.c


示例20: fx_target_beam_fire

//------------------------------------------
void fx_target_beam_fire( gentity_t *ent )
{
	trace_t		trace;
	vec3_t		dir, org, end;
	int			ignore;
	qboolean	open;

	if ( !ent->enemy || !ent->enemy->inuse )
	{//info_null most likely
		ignore = ent->s.number;
		ent->enemy = NULL;
		VectorCopy( ent->s.origin2, org );
	}
	else
	{
		ignore = ent->enemy->s.number;
		VectorCopy( ent->enemy->currentOrigin, org );
	}

	VectorCopy( org, ent->s.origin2 );
	VectorSubtract( org, ent->s.origin, dir );
	VectorNormalize( dir );

	gi.trace( &trace, ent->s.origin, NULL, NULL, org, ENTITYNUM_NONE, MASK_SHOT );//ignore
	if ( ent->spawnflags & 2 )
	{
		open = qtrue;
		VectorCopy( org, end );
	}
	else
	{
		open = qfalse;
		VectorCopy( trace.endpos, end );
	}

	if ( trace.fraction < 1.0 )
	{
		if ( trace.entityNum < ENTITYNUM_WORLD )
		{
			gentity_t *victim = &g_entities[trace.entityNum];
			if ( victim && victim->takedamage )
			{
				if ( ent->spawnflags & 4 ) // NO_KNOCKBACK
				{
					G_Damage( victim, ent, ent->activator, dir, trace.endpos, ent->damage, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN );
				}
				else
				{
					G_Damage( victim, ent, ent->activator, dir, trace.endpos, ent->damage, 0, MOD_UNKNOWN );
				}
			}
		}
	}

	G_AddEvent( ent, EV_TARGET_BEAM_DRAW, ent->fxID );
	VectorCopy( end, ent->s.origin2 );

	if ( open )
	{
		VectorScale( dir, -1, ent->pos1 );
	}
	else
	{
		VectorCopy( trace.plane.normal, ent->pos1 );
	}

	ent->e_ThinkFunc = thinkF_fx_target_beam_think;
	ent->nextthink = level.time + FRAMETIME;
}
开发者ID:LTolosa,项目名称:Jedi-Outcast,代码行数:70,代码来源:g_fx.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ G_AddVoiceEvent函数代码示例发布时间:2022-05-30
下一篇:
C++ G_ASSERT函数代码示例发布时间: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