这篇教程C++ G_AddEvent函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中G_AddEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ G_AddEvent函数的具体用法?C++ G_AddEvent怎么用?C++ G_AddEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了G_AddEvent函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例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,
示例3: Slayvoid __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,
示例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,
示例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,
示例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,
示例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,
示例8: LetGoOfGatling/*========================LetGoOfGatlingMake 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,
示例9: Use_Shootervoid 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,
示例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,
示例11: Cmd_UseSentry_fvoid 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,
示例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,
示例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,
示例14: G_minethinkvoidG_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,
示例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,
示例16: laserTrapExplodevoid 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,
示例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,
示例18: DoRespawnvoid 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,
示例19: G_ExplodeMissile/*================G_ExplodeMissileExplode 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,
示例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,
示例21: player_die//.........这里部分代码省略......... } }#ifdef MISSIONPACK TossClientPersistantPowerups( self ); if( g_gametype.integer == GT_HARVESTER ) { TossClientCubes( self ); }#endif Cmd_Score_f( self ); // show scores // send updated scores to any clients that are following this one, // or they would get stale scoreboards for ( i = 0 ; i < level.maxclients ; i++ ) { gclient_t *client; client = &level.clients[i]; if ( client->pers.connected != CON_CONNECTED ) { continue; } if ( client->sess.sessionTeam != TEAM_SPECTATOR ) { continue; } if ( client->sess.spectatorClient == self->s.number ) { Cmd_Score_f( g_entities + i ); } } self->takedamage = qtrue; // can still be gibbed self->s.weapon = WP_NONE; self->s.powerups = 0; self->r.contents = CONTENTS_CORPSE; self->s.angles[0] = 0; self->s.angles[2] = 0; LookAtKiller (self, inflictor, attacker); VectorCopy( self->s.angles, self->client->ps.viewangles ); self->s.loopSound = 0; self->r.maxs[2] = -8; // don't allow respawn until the death anim is done // g_forcerespawn may force spawning at some later time self->client->respawnTime = level.time + 1700; // remove powerups memset( self->client->ps.powerups, 0, sizeof(self->client->ps.powerups) ); // never gib in a nodrop if ( (self->health <= GIB_HEALTH && !(contents & CONTENTS_NODROP) && g_blood.integer) || meansOfDeath == MOD_SUICIDE) { // gib death GibEntity( self, killer ); } else { // normal death static int i; switch ( i ) { case 0: anim = BOTH_DEATH1; break; case 1: anim = BOTH_DEATH2; break; case 2: default: anim = BOTH_DEATH3; break; } // for the no-blood option, we need to prevent the health // from going to gib level if ( self->health <= GIB_HEALTH ) { self->health = GIB_HEALTH+1; } self->client->ps.legsAnim = ( ( self->client->ps.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; self->client->ps.torsoAnim = ( ( self->client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; G_AddEvent( self, EV_DEATH1 + i, killer ); // the body can still be gibbed self->die = body_die; // globally cycle through the different death animations i = ( i + 1 ) % 3;#ifdef MISSIONPACK if (self->s.eFlags & EF_KAMIKAZE) { Kamikaze_DeathTimer( self ); }#endif } trap_LinkEntity (self);}
开发者ID:DingoOz,项目名称:Quake3-GLES-for-armv7,代码行数:101,
示例22: Rancor_Attackvoid Rancor_Attack( float distance, qboolean doCharge ){ if ( !TIMER_Exists( NPCS.NPC, "attacking" ) ) { if ( NPCS.NPC->count == 2 && NPCS.NPC->activator ) { } else if ( NPCS.NPC->count == 1 && NPCS.NPC->activator ) {//holding enemy if ( NPCS.NPC->activator->health > 0 && Q_irand( 0, 1 ) ) {//quick bite NPC_SetAnim( NPCS.NPC, SETANIM_BOTH, BOTH_ATTACK1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD ); TIMER_Set( NPCS.NPC, "attack_dmg", 450 ); } else {//full eat NPC_SetAnim( NPCS.NPC, SETANIM_BOTH, BOTH_ATTACK3, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD ); TIMER_Set( NPCS.NPC, "attack_dmg", 900 ); //Make victim scream in fright if ( NPCS.NPC->activator->health > 0 && NPCS.NPC->activator->client ) { G_AddEvent( NPCS.NPC->activator, Q_irand(EV_DEATH1, EV_DEATH3), 0 ); NPC_SetAnim( NPCS.NPC->activator, SETANIM_TORSO, BOTH_FALLDEATH1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD ); if ( NPCS.NPC->activator->NPC ) {//no more thinking for you TossClientItems( NPCS.NPC ); NPCS.NPC->activator->NPC->nextBStateThink = Q3_INFINITE; } } } } else if ( NPCS.NPC->enemy->health > 0 && doCharge ) {//charge vec3_t fwd, yawAng; VectorSet( yawAng, 0, NPCS.NPC->client->ps.viewangles[YAW], 0 ); AngleVectors( yawAng, fwd, NULL, NULL ); VectorScale( fwd, distance*1.5f, NPCS.NPC->client->ps.velocity ); NPCS.NPC->client->ps.velocity[2] = 150; NPCS.NPC->client->ps.groundEntityNum = ENTITYNUM_NONE; NPC_SetAnim( NPCS.NPC, SETANIM_BOTH, BOTH_MELEE2, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD ); TIMER_Set( NPCS.NPC, "attack_dmg", 1250 ); } else if ( !Q_irand(0, 1) ) {//smash NPC_SetAnim( NPCS.NPC, SETANIM_BOTH, BOTH_MELEE1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD ); TIMER_Set( NPCS.NPC, "attack_dmg", 1000 ); } else {//try to grab NPC_SetAnim( NPCS.NPC, SETANIM_BOTH, BOTH_ATTACK2, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD ); TIMER_Set( NPCS.NPC, "attack_dmg", 1000 ); } TIMER_Set( NPCS.NPC, "attacking", NPCS.NPC->client->ps.legsTimer + random() * 200 ); } // Need to do delayed damage since the attack animations encapsulate multiple mini-attacks if ( TIMER_Done2( NPCS.NPC, "attack_dmg", qtrue ) ) { vec3_t shakePos; switch ( NPCS.NPC->client->ps.legsAnim ) { case BOTH_MELEE1: Rancor_Smash(); G_GetBoltPosition( NPCS.NPC, NPCS.NPC->client->renderInfo.handLBolt, shakePos, 0 ); G_ScreenShake( shakePos, NULL, 4.0f, 1000, qfalse ); //CGCam_Shake( 1.0f*playerDist/128.0f, 1000 ); break; case BOTH_MELEE2: Rancor_Bite(); TIMER_Set( NPCS.NPC, "attack_dmg2", 450 ); break; case BOTH_ATTACK1: if ( NPCS.NPC->count == 1 && NPCS.NPC->activator ) { G_Damage( NPCS.NPC->activator, NPCS.NPC, NPCS.NPC, vec3_origin, NPCS.NPC->activator->r.currentOrigin, Q_irand( 25, 40 ), DAMAGE_NO_ARMOR|DAMAGE_NO_KNOCKBACK, MOD_MELEE ); if ( NPCS.NPC->activator->health <= 0 ) {//killed him //make it look like we bit his head off //NPC->activator->client->dismembered = qfalse; G_Dismember( NPCS.NPC->activator, NPCS.NPC, NPCS.NPC->activator->r.currentOrigin, G2_MODELPART_HEAD, 90, 0, NPCS.NPC->activator->client->ps.torsoAnim, qtrue); //G_DoDismemberment( NPC->activator, NPC->activator->r.currentOrigin, MOD_SABER, 1000, HL_HEAD, qtrue ); NPCS.NPC->activator->client->ps.forceHandExtend = HANDEXTEND_NONE; NPCS.NPC->activator->client->ps.forceHandExtendTime = 0; NPC_SetAnim( NPCS.NPC->activator, SETANIM_BOTH, BOTH_SWIM_IDLE1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD ); } G_Sound( NPCS.NPC->activator, CHAN_AUTO, G_SoundIndex( "sound/chars/rancor/chomp.wav" ) ); } break; case BOTH_ATTACK2: //try to grab Rancor_Swing( qtrue ); break; case BOTH_ATTACK3: if ( NPCS.NPC->count == 1 && NPCS.NPC->activator ) { //cut in half//.........这里部分代码省略.........
开发者ID:Almightygir,项目名称:OpenJK,代码行数:101,
示例23: G_MissileImpactvoid G_MissileImpact( gentity_t *ent, trace_t *trace ) { gentity_t *other; qboolean hitClient = qfalse; qboolean isKnockedSaber = qfalse; other = &g_entities[trace->entityNum]; // check for bounce if ( !other->takedamage && (ent->bounceCount > 0 || ent->bounceCount == -5) && (ent->flags & (FL_BOUNCE | FL_BOUNCE_HALF)) ) { G_BounceMissile( ent, trace ); G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 ); return; } else if ( ent->neverFree && ent->s.weapon == WP_SABER && (ent->flags & FL_BOUNCE_HALF) ) { //this is a knocked-away saber if ( ent->bounceCount > 0 || ent->bounceCount == -5 ) { G_BounceMissile( ent, trace ); G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 ); return; } isKnockedSaber = qtrue; } // I would glom onto the FL_BOUNCE code section above, but don't feel like risking breaking something else if ( (!other->takedamage && (ent->bounceCount > 0 || ent->bounceCount == -5) && (ent->flags&(FL_BOUNCE_SHRAPNEL))) || ((trace->surfaceFlags&SURF_FORCEFIELD) && !ent->splashDamage&&!ent->splashRadius && (ent->bounceCount > 0 || ent->bounceCount == -5)) ) { G_BounceMissile( ent, trace ); if ( ent->bounceCount < 1 ) { ent->flags &= ~FL_BOUNCE_SHRAPNEL; } return; } /* if ( !other->takedamage && ent->s.weapon == WP_THERMAL && !ent->alt_fire ) {//rolling thermal det - FIXME: make this an eFlag like bounce & stick!!! //G_BounceRollMissile( ent, trace ); if ( ent->owner && ent->owner->s.number == 0 ) { G_MissileAddAlerts( ent ); } //gi.linkentity( ent ); return; } */ if ( (other->r.contents & CONTENTS_LIGHTSABER) && !isKnockedSaber ) { //hit this person's saber, so.. gentity_t *otherOwner = &g_entities[other->r.ownerNum]; if ( otherOwner->takedamage && otherOwner->client && otherOwner->client->ps.duelInProgress && otherOwner->client->ps.duelIndex != ent->r.ownerNum ) { goto killProj; } } else if ( !isKnockedSaber ) { if ( other->takedamage && other->client && other->client->ps.duelInProgress && other->client->ps.duelIndex != ent->r.ownerNum ) { goto killProj; } } if ( other->flags & FL_DMG_BY_HEAVY_WEAP_ONLY ) { if ( ent->methodOfDeath != MOD_REPEATER_ALT && ent->methodOfDeath != MOD_ROCKET && ent->methodOfDeath != MOD_FLECHETTE_ALT_SPLASH && ent->methodOfDeath != MOD_ROCKET_HOMING && ent->methodOfDeath != MOD_THERMAL && ent->methodOfDeath != MOD_THERMAL_SPLASH && ent->methodOfDeath != MOD_TRIP_MINE_SPLASH && ent->methodOfDeath != MOD_TIMED_MINE_SPLASH && ent->methodOfDeath != MOD_DET_PACK_SPLASH && ent->methodOfDeath != MOD_VEHICLE && ent->methodOfDeath != MOD_CONC && ent->methodOfDeath != MOD_CONC_ALT && ent->methodOfDeath != MOD_SABER && ent->methodOfDeath != MOD_TURBLAST ) { vector3 fwd; if ( trace ) { VectorCopy( &trace->plane.normal, &fwd ); } else { //oh well AngleVectors( &other->r.currentAngles, &fwd, NULL, NULL ); } G_DeflectMissile( other, ent, &fwd ); G_MissileBounceEffect( ent, &ent->r.currentOrigin, &fwd ); return; } } if ( (other->flags & FL_SHIELDED) && ent->s.weapon != WP_ROCKET_LAUNCHER && ent->s.weapon != WP_THERMAL && ent->s.weapon != WP_TRIP_MINE && ent->s.weapon != WP_DET_PACK && ent->s.weapon != WP_DEMP2 && ent->s.weapon != WP_EMPLACED_GUN &&//.........这里部分代码省略.........
开发者ID:Arcadiaprime,项目名称:japp,代码行数:101,
示例24: Use_BinaryMover/*================Use_BinaryMover================*/void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) { int total; int partial; // only the master should be used if ( ent->flags & FL_TEAMSLAVE ) { Use_BinaryMover( ent->teammaster, other, activator ); return; } ent->activator = activator; if ( ent->moverState == MOVER_POS1 ) { // start moving 50 msec later, becase if this was player // triggered, level.time hasn't been advanced yet MatchTeam( ent, MOVER_1TO2, level.time + 50 ); // starting sound if ( ent->sound1to2 ) { G_AddEvent( ent, EV_GENERAL_SOUND, ent->sound1to2 ); } // looping sound ent->s.loopSound = ent->soundLoop; // open areaportal if ( ent->teammaster == ent || !ent->teammaster ) { trap_AdjustAreaPortalState( ent, qtrue ); } return; } // if all the way up, just delay before coming down if ( ent->moverState == MOVER_POS2 ) { ent->nextthink = level.time + ent->wait; return; } // only partway down before reversing if ( ent->moverState == MOVER_2TO1 ) { total = ent->s.pos.trDuration; partial = level.time - ent->s.pos.trTime; if ( partial > total ) { partial = total; } MatchTeam( ent, MOVER_1TO2, level.time - ( total - partial ) ); if ( ent->sound1to2 ) { G_AddEvent( ent, EV_GENERAL_SOUND, ent->sound1to2 ); } return; } // only partway up before reversing if ( ent->moverState == MOVER_1TO2 ) { total = ent->s.pos.trDuration; partial = level.time - ent->s.pos.trTime; if ( partial > total ) { partial = total; } MatchTeam( ent, MOVER_2TO1, level.time - ( total - partial ) ); if ( ent->sound2to1 ) { G_AddEvent( ent, EV_GENERAL_SOUND, ent->sound2to1 ); } return; }}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:75,
示例25: W_Touch_Grenade/** W_Touch_Grenade*/static void W_Touch_Grenade( edict_t *ent, edict_t *other, cplane_t *plane, int surfFlags ){ int hitType; vec3_t dir; if( surfFlags & SURF_NOIMPACT ) { G_FreeEdict( ent ); return; } hitType = G_Projectile_HitStyle( ent, other ); if( hitType == PROJECTILE_TOUCH_NOT ) return; // don't explode on doors and plats that take damage if( !other->takedamage || ISBRUSHMODEL( other->s.modelindex ) ) { // kill some velocity on each bounce float fric; static cvar_t *g_grenade_friction = NULL; if( !g_grenade_friction ) g_grenade_friction = trap_Cvar_Get( "g_grenade_friction", "0.85", CVAR_DEVELOPER ); fric = bound( 0, g_grenade_friction->value, 1 ); VectorScale( ent->velocity, fric, ent->velocity ); G_AddEvent( ent, EV_GRENADE_BOUNCE, ( ent->s.effects & EF_STRONG_WEAPON ) ? FIRE_MODE_STRONG : FIRE_MODE_WEAK, qtrue ); return; } if( other->takedamage ) { int directHitDamage = ent->projectileInfo.maxDamage; VectorNormalize2( ent->velocity, dir ); if( hitType == PROJECTILE_TOUCH_DIRECTSPLASH ) // use hybrid direction from splash and projectile { G_SplashFrac4D( ENTNUM( other ), ent->s.origin, ent->projectileInfo.radius, dir, NULL, NULL, ent->timeDelta ); } else { VectorNormalize2( ent->velocity, dir ); // no direct hit bonuses for grenades /* if( hitType == PROJECTILE_TOUCH_DIRECTAIRHIT ) directHitDamage += DIRECAIRTHIT_DAMAGE_BONUS; else if( hitType == PROJECTILE_TOUCH_DIRECTHIT ) directHitDamage += DIRECTHIT_DAMAGE_BONUS; */ } G_Damage( other, ent, ent->r.owner, dir, ent->velocity, ent->s.origin, directHitDamage, ent->projectileInfo.maxKnockback, ent->projectileInfo.stun, 0, ent->style ); } ent->enemy = other; W_Grenade_ExplodeDir( ent, plane ? plane->normal : NULL );}
开发者ID:Kaperstone,项目名称:warsow,代码行数:64,
示例26: G_MoverPush/*============G_MoverPushObjects need to be moved back on a failed push,otherwise riders would continue to slide.If qfalse is returned, *obstacle will be the blocking entity============*/qboolean G_MoverPush( gentity_t *pusher, vec3_t move, vec3_t amove, gentity_t **obstacle ) { int i, e; gentity_t *check; vec3_t mins, maxs; pushed_t *p; int entityList[MAX_GENTITIES]; int listedEntities; vec3_t totalMins, totalMaxs; *obstacle = NULL; // mins/maxs are the bounds at the destination // totalMins / totalMaxs are the bounds for the entire move if ( pusher->r.currentAngles[0] || pusher->r.currentAngles[1] || pusher->r.currentAngles[2] || amove[0] || amove[1] || amove[2] ) { float radius; radius = RadiusFromBounds( pusher->r.mins, pusher->r.maxs ); for ( i = 0 ; i < 3 ; i++ ) { mins[i] = pusher->r.currentOrigin[i] + move[i] - radius; maxs[i] = pusher->r.currentOrigin[i] + move[i] + radius; totalMins[i] = mins[i] - move[i]; totalMaxs[i] = maxs[i] - move[i]; } } else { for (i=0 ; i<3 ; i++) { mins[i] = pusher->r.absmin[i] + move[i]; maxs[i] = pusher->r.absmax[i] + move[i]; } VectorCopy( pusher->r.absmin, totalMins ); VectorCopy( pusher->r.absmax, totalMaxs ); for (i=0 ; i<3 ; i++) { if ( move[i] > 0 ) { totalMaxs[i] += move[i]; } else { totalMins[i] += move[i]; } } } // unlink the pusher so we don't get it in the entityList trap_UnlinkEntity( pusher ); listedEntities = trap_EntitiesInBox( totalMins, totalMaxs, entityList, MAX_GENTITIES ); // move the pusher to it's final position VectorAdd( pusher->r.currentOrigin, move, pusher->r.currentOrigin ); VectorAdd( pusher->r.currentAngles, amove, pusher->r.currentAngles ); trap_LinkEntity( pusher ); // see if any solid entities are inside the final position for ( e = 0 ; e < listedEntities ; e++ ) { check = &g_entities[ entityList[ e ] ];#ifdef MISSIONPACK if ( check->s.eType == ET_MISSILE ) { // if it is a prox mine if ( !strcmp(check->classname, "prox mine") ) { // if this prox mine is attached to this mover try to move it with the pusher if ( check->enemy == pusher ) { if (!G_TryPushingProxMine( check, pusher, move, amove )) { //explode check->s.loopSound = 0; G_AddEvent( check, EV_PROXIMITY_MINE_TRIGGER, 0 ); G_ExplodeMissile(check); if (check->activator) { G_FreeEntity(check->activator); check->activator = NULL; } //G_Printf("prox mine explodes/n"); } } else { //check if the prox mine is crushed by the mover if (!G_CheckProxMinePosition( check )) { //explode check->s.loopSound = 0; G_AddEvent( check, EV_PROXIMITY_MINE_TRIGGER, 0 ); G_ExplodeMissile(check); if (check->activator) { G_FreeEntity(check->activator); check->activator = NULL; } //G_Printf("prox mine explodes/n"); } } continue; } }//.........这里部分代码省略.........
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:101,
示例27: player_die//.........这里部分代码省略......... if ( client->sess.spectatorClient == self->s.number ) { ScoreboardMessage( g_entities + i ); } } VectorCopy( self->s.origin, self->client->pers.lastDeathLocation ); self->takedamage = qfalse; // can still be gibbed self->s.weapon = WP_NONE; if ( self->client->noclip ) { self->client->cliprcontents = CONTENTS_CORPSE; } else { self->r.contents = CONTENTS_CORPSE; } self->s.angles[ PITCH ] = 0; self->s.angles[ ROLL ] = 0; self->s.angles[ YAW ] = self->s.apos.trBase[ YAW ]; LookAtKiller( self, inflictor, attacker ); VectorCopy( self->s.angles, self->client->ps.viewangles ); self->s.loopSound = 0; self->r.maxs[ 2 ] = -8; // don't allow respawn until the death anim is done // g_forcerespawn may force spawning at some later time self->client->respawnTime = level.time + 1700; // clear misc memset( self->client->ps.misc, 0, sizeof( self->client->ps.misc ) ); { static int i; if ( !( self->client->ps.persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) { switch ( i ) { case 0: anim = BOTH_DEATH1; break; case 1: anim = BOTH_DEATH2; break; case 2: default: anim = BOTH_DEATH3; break; } } else { switch ( i ) { case 0: anim = NSPA_DEATH1; break; case 1: anim = NSPA_DEATH2; break; case 2: default: anim = NSPA_DEATH3; break; } } self->client->ps.legsAnim = ( ( self->client->ps.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; if ( !( self->client->ps.persistant[ PERS_STATE ] & PS_NONSEGMODEL ) ) { self->client->ps.torsoAnim = ( ( self->client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; } // use own entityid if killed by non-client to prevent uint8_t overflow G_AddEvent( self, EV_DEATH1 + i, ( killer < MAX_CLIENTS ) ? killer : self - g_entities ); // globally cycle through the different death animations i = ( i + 1 ) % 3; } trap_LinkEntity( self ); self->client->pers.infoChangeTime = level.time;}
开发者ID:luislezcair,项目名称:Unvanquished,代码行数:101,
示例28: target_rumble_thinkvoid target_rumble_think (gentity_t * ent){ gentity_t *tent; float ratio; float time, time2; float dapitch, dayaw; qboolean validrumble = qtrue; if (!(ent->count)) { ent->timestamp = level.time; ent->count ++; // start sound here if (ent->soundPos1) G_AddEvent( ent, EV_GENERAL_SOUND, ent->soundPos1); } else { // looping sound ent->s.loopSound = ent->soundLoop; } dapitch = ent->delay; dayaw = ent->random; ratio = 1.0f; if (ent->start_size) { if (level.time < (ent->timestamp + ent->start_size)) { time = level.time - ent->timestamp; time2 = (ent->timestamp + ent->start_size) - ent->timestamp; ratio = time / time2; } else if (level.time < (ent->timestamp + ent->end_size + ent->start_size)) { time = level.time - ent->timestamp; time2 = (ent->timestamp + ent->start_size + ent->end_size) - ent->timestamp; ratio = time2 / time; } else validrumble = qfalse; } if (validrumble) { tent = G_TempEntity (ent->r.currentOrigin, EV_RUMBLE_EFX); tent->s.angles[0] = dapitch * ratio; tent->s.angles[1] = dayaw * ratio; } // end sound if (level.time > ent->duration + ent->timestamp) { if (ent->soundPos2) { G_AddEvent( ent, EV_GENERAL_SOUND, ent->soundPos2 ); ent->s.loopSound = 0; } ent->nextthink = 0; } else ent->nextthink = level.time + 50;}
开发者ID:nobowned,项目名称:rtcw,代码行数:67,
示例29: NPC_Touchvoid NPC_Touch(gentity_t *self, gentity_t *other, trace_t *trace){ if(!self->NPC) return; SaveNPCGlobals(); SetNPCGlobals( self ); if ( self->message && self->health <= 0 ) {//I am dead and carrying a key if ( other && player && player->health > 0 && other == player ) {//player touched me char *text; qboolean keyTaken; //give him my key if ( Q_stricmp( "goodie", self->message ) == 0 ) {//a goodie key if ( (keyTaken = INV_GoodieKeyGive( other )) == qtrue ) { text = "cp @SP_INGAME_TOOK_IMPERIAL_GOODIE_KEY"; G_AddEvent( other, EV_ITEM_PICKUP, (FindItemForInventory( INV_GOODIE_KEY )-bg_itemlist) ); } else { text = "cp @SP_INGAME_CANT_CARRY_GOODIE_KEY"; } } else {//a named security key if ( (keyTaken = INV_SecurityKeyGive( player, self->message )) == qtrue ) { text = "cp @SP_INGAME_TOOK_IMPERIAL_SECURITY_KEY"; G_AddEvent( other, EV_ITEM_PICKUP, (FindItemForInventory( INV_SECURITY_KEY )-bg_itemlist) ); } else { text = "cp @SP_INGAME_CANT_CARRY_SECURITY_KEY"; } } if ( keyTaken ) {//remove my key gi.G2API_SetSurfaceOnOff( &self->ghoul2[self->playerModel], "l_arm_key", 0x00000002 ); self->message = NULL; self->client->ps.eFlags &= ~EF_FORCE_VISIBLE; //remove sight flag G_Sound( player, G_SoundIndex( "sound/weapons/key_pkup.wav" ) ); } gi.SendServerCommand( 0, text ); } } if ( other->client ) {//FIXME: if pushing against another bot, both ucmd.rightmove = 127??? //Except if not facing one another... if ( other->health > 0 ) { NPCInfo->touchedByPlayer = other; } if ( other == NPCInfo->goalEntity ) { NPCInfo->aiFlags |= NPCAI_TOUCHED_GOAL; } if( !(self->svFlags&SVF_LOCKEDENEMY) && !(self->svFlags&SVF_IGNORE_ENEMIES) && !(other->flags & FL_NOTARGET) ) { if ( self->client->enemyTeam ) {//See if we bumped into an enemy if ( other->client->playerTeam == self->client->enemyTeam ) {//bumped into an enemy if( NPCInfo->behaviorState != BS_HUNT_AND_KILL && !NPCInfo->tempBehavior ) {//MCG - Begin: checking specific BS mode here, this is bad, a HACK //FIXME: not medics? if ( NPC->enemy != other ) {//not already mad at them G_SetEnemy( NPC, other ); } // NPCInfo->tempBehavior = BS_HUNT_AND_KILL; } } } } //FIXME: do this if player is moving toward me and with a certain dist? /* if ( other->s.number == 0 && self->client->playerTeam == other->client->playerTeam ) { VectorAdd( self->client->pushVec, other->client->ps.velocity, self->client->pushVec ); } */ } else {//FIXME: check for SVF_NONNPC_ENEMY flag here? if ( other->health > 0 ) { if ( NPC->enemy == other && (other->svFlags&SVF_NONNPC_ENEMY) ) { NPCInfo->touchedByPlayer = other; } }//.........这里部分代码省略.........
开发者ID:Avygeil,项目名称:NewJK,代码行数:101,
示例30: G_Damage//.........这里部分代码省略......... if ( !(dflags & DAMAGE_NO_PROTECTION) ) { // if TF_NO_FRIENDLY_FIRE is set, don't do damage to the target // if the attacker was on the same team#ifdef MISSIONPACK if ( mod != MOD_JUICED && targ != attacker && !(dflags & DAMAGE_NO_TEAM_PROTECTION) && OnSameTeam (targ, attacker) ) {#else if ( targ != attacker && OnSameTeam (targ, attacker) ) {#endif if ( !g_friendlyFire.integer ) { return; } }#ifdef MISSIONPACK if (mod == MOD_PROXIMITY_MINE) { if (inflictor && inflictor->parent && OnSameTeam(targ, inflictor->parent)) { return; } if (targ == attacker) { return; } }#endif // check for godmode if ( targ->flags & FL_GODMODE ) { return; } } // battlesuit protects from all radius damage (but takes knockback) // and protects 50% against all damage if ( client && client->ps.powerups[PW_BATTLESUIT] ) { G_AddEvent( targ, EV_POWERUP_BATTLESUIT, 0 ); if ( ( dflags & DAMAGE_RADIUS ) || ( mod == MOD_FALLING ) ) { return; } damage *= 0.5; } // add to the attacker's hit counter (if the target isn't a general entity like a prox mine) if ( attacker->client && client && targ != attacker && targ->health > 0 && targ->s.eType != ET_MISSILE && targ->s.eType != ET_GENERAL) { if ( OnSameTeam( targ, attacker ) ) { attacker->client->ps.persistant[PERS_HITS]--; } else { attacker->client->ps.persistant[PERS_HITS]++; } attacker->client->ps.persistant[PERS_ATTACKEE_ARMOR] = (targ->health<<8)|(client->ps.stats[STAT_ARMOR]); } // always give half damage if hurting self // calculated after knockback, so rocket jumping works if ( targ == attacker) { damage *= 0.5; } if ( damage < 1 ) { damage = 1; } take = damage; save = 0; // save some from armor
开发者ID:DingoOz,项目名称:Quake3-GLES-for-armv7,代码行数:67,
注:本文中的G_AddEvent函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ G_AddVoiceEvent函数代码示例 C++ G_ASSERT函数代码示例 |