#include "b_local.h"#include "g_nav.h"#include "../namespace_begin.h"#include "../namespace_end.h"Go to the source code of this file.
|
|
Definition at line 14 of file NPC_AI_Mark1.c. Referenced by NPC_Mark1_Pain(), and NPC_Mark2_Pain(). |
|
|
Definition at line 17 of file NPC_AI_Mark1.c. |
|
|
Definition at line 19 of file NPC_AI_Mark1.c. |
|
|
Definition at line 18 of file NPC_AI_Mark1.c. |
|
|
Definition at line 20 of file NPC_AI_Mark1.c. |
|
|
Definition at line 21 of file NPC_AI_Mark1.c. |
|
|
Definition at line 22 of file NPC_AI_Mark1.c. |
|
|
Definition at line 16 of file NPC_AI_Mark1.c. |
|
|
Definition at line 12 of file NPC_AI_Mark1.c. |
|
|
Definition at line 7 of file NPC_AI_Mark1.c. |
|
|
Definition at line 8 of file NPC_AI_Mark1.c. |
|
|
Definition at line 4 of file NPC_AI_Mark1.c. |
|
|
Definition at line 5 of file NPC_AI_Mark1.c. |
|
|
Definition at line 13 of file NPC_AI_Mark1.c. |
|
|
Definition at line 10 of file NPC_AI_Mark1.c. |
|
|
Definition at line 25 of file NPC_AI_Mark1.c.
00026 {
00027 LSTATE_NONE = 0,
00028 LSTATE_ASLEEP,
00029 LSTATE_WAKEUP,
00030 LSTATE_FIRED0,
00031 LSTATE_FIRED1,
00032 LSTATE_FIRED2,
00033 LSTATE_FIRED3,
00034 LSTATE_FIRED4,
00035 };
|
|
|
Definition at line 1941 of file bg_misc.c.
|
|
|
Definition at line 1882 of file g_combat.c. References AngleVectors(), CHAN_AUTO, CLASS_ATST, CLASS_GONK, CLASS_INTERROGATOR, CLASS_MARK1, CLASS_MARK2, CLASS_MOUSE, CLASS_PROBE, CLASS_PROTOCOL, CLASS_R2D2, CLASS_R5D2, CLASS_REMOTE, CLASS_SEEKER, CLASS_SENTRY, gentity_s::client, entityShared_t::currentAngles, entityShared_t::currentOrigin, G_EffectIndex(), G_PlayEffectID(), G_Sound(), G_SoundIndex(), gentity_t, gclient_s::NPC_class, NULL, Q_irand(), gentity_s::r, va(), vec3_t, VectorCopy, VectorMA, and VectorSet. Referenced by player_die().
01883 {
01884 vec3_t effectPos, right;
01885 vec3_t defaultDir;
01886
01887 if ( !ent || !ent->client )
01888 return;
01889
01890 VectorSet(defaultDir, 0, 0, 1);
01891
01892 // team no longer indicates species/race. NPC_class should be used to identify certain npc types
01893 switch(ent->client->NPC_class)
01894 {
01895 case CLASS_MOUSE:
01896 VectorCopy( ent->r.currentOrigin, effectPos );
01897 effectPos[2] -= 20;
01898 G_PlayEffectID( G_EffectIndex("env/small_explode"), effectPos, defaultDir );
01899 G_Sound( ent, CHAN_AUTO, G_SoundIndex("sound/chars/mouse/misc/death1") );
01900 break;
01901
01902 case CLASS_PROBE:
01903 VectorCopy( ent->r.currentOrigin, effectPos );
01904 effectPos[2] += 50;
01905 G_PlayEffectID( G_EffectIndex("explosions/probeexplosion1"), effectPos, defaultDir );
01906 break;
01907
01908 case CLASS_ATST:
01909 AngleVectors( ent->r.currentAngles, NULL, right, NULL );
01910 VectorMA( ent->r.currentOrigin, 20, right, effectPos );
01911 effectPos[2] += 180;
01912 G_PlayEffectID( G_EffectIndex("explosions/droidexplosion1"), effectPos, defaultDir );
01913 VectorMA( effectPos, -40, right, effectPos );
01914 G_PlayEffectID( G_EffectIndex("explosions/droidexplosion1"), effectPos, defaultDir );
01915 break;
01916
01917 case CLASS_SEEKER:
01918 case CLASS_REMOTE:
01919 G_PlayEffectID( G_EffectIndex("env/small_explode"), ent->r.currentOrigin, defaultDir );
01920 break;
01921
01922 case CLASS_GONK:
01923 VectorCopy( ent->r.currentOrigin, effectPos );
01924 effectPos[2] -= 5;
01925 // statusTextIndex = Q_irand( IGT_RESISTANCEISFUTILE, IGT_NAMEIS8OF12 );
01926 G_Sound( ent, CHAN_AUTO, G_SoundIndex(va("sound/chars/gonk/misc/death%d.wav",Q_irand( 1, 3 ))) );
01927 G_PlayEffectID( G_EffectIndex("env/med_explode"), effectPos, defaultDir );
01928 break;
01929
01930 // should list all remaining droids here, hope I didn't miss any
01931 case CLASS_R2D2:
01932 VectorCopy( ent->r.currentOrigin, effectPos );
01933 effectPos[2] -= 10;
01934 G_PlayEffectID( G_EffectIndex("env/med_explode"), effectPos, defaultDir );
01935 G_Sound( ent, CHAN_AUTO, G_SoundIndex("sound/chars/mark2/misc/mark2_explo") );
01936 break;
01937
01938 case CLASS_PROTOCOL: //c3p0
01939 case CLASS_R5D2:
01940 VectorCopy( ent->r.currentOrigin, effectPos );
01941 effectPos[2] -= 10;
01942 G_PlayEffectID( G_EffectIndex("env/med_explode"), effectPos, defaultDir );
01943 G_Sound( ent, CHAN_AUTO, G_SoundIndex("sound/chars/mark2/misc/mark2_explo") );
01944 break;
01945
01946 case CLASS_MARK2:
01947 VectorCopy( ent->r.currentOrigin, effectPos );
01948 effectPos[2] -= 15;
01949 G_PlayEffectID( G_EffectIndex("explosions/droidexplosion1"), effectPos, defaultDir );
01950 G_Sound( ent, CHAN_AUTO, G_SoundIndex("sound/chars/mark2/misc/mark2_explo") );
01951 break;
01952
01953 case CLASS_INTERROGATOR:
01954 VectorCopy( ent->r.currentOrigin, effectPos );
01955 effectPos[2] -= 15;
01956 G_PlayEffectID( G_EffectIndex("explosions/droidexplosion1"), effectPos, defaultDir );
01957 G_Sound( ent, CHAN_AUTO, G_SoundIndex("sound/chars/interrogator/misc/int_droid_explo") );
01958 break;
01959
01960 case CLASS_MARK1:
01961 AngleVectors( ent->r.currentAngles, NULL, right, NULL );
01962 VectorMA( ent->r.currentOrigin, 10, right, effectPos );
01963 effectPos[2] -= 15;
01964 G_PlayEffectID( G_EffectIndex("explosions/droidexplosion1"), effectPos, defaultDir );
01965 VectorMA( effectPos, -20, right, effectPos );
01966 G_PlayEffectID( G_EffectIndex("explosions/droidexplosion1"), effectPos, defaultDir );
01967 VectorMA( effectPos, -20, right, effectPos );
01968 G_PlayEffectID( G_EffectIndex("explosions/droidexplosion1"), effectPos, defaultDir );
01969 G_Sound( ent, CHAN_AUTO, G_SoundIndex("sound/chars/mark1/misc/mark1_explo") );
01970 break;
01971
01972 case CLASS_SENTRY:
01973 G_Sound( ent, CHAN_AUTO, G_SoundIndex("sound/chars/sentry/misc/sentry_explo") );
01974 VectorCopy( ent->r.currentOrigin, effectPos );
01975 G_PlayEffectID( G_EffectIndex("env/med_explode"), effectPos, defaultDir );
01976 break;
01977
01978 default:
01979 break;
01980
01981 }
01982
01983 }
|
|
|
Definition at line 625 of file NPC_AI_Mark1.c. References gentity_s::client, entityShared_t::currentOrigin, gentity_s::die, DIST_LONG, DIST_MELEE, distance_e, DistanceHorizontalSquared(), gentity_s::enemy, gentity_s::ghoul2, gentity_s::health, Mark1_BlasterAttack(), Mark1_Hunt(), Mark1_RocketAttack(), MIN_DISTANCE_SQR, MIN_MELEE_RANGE_SQR, MOD_UNKNOWN, NPC, NPC_CheckEnemyExt(), NPC_ClearLOS4(), NPC_FaceEnemy(), NULL, gclient_s::ps, Q_irand(), qboolean, qfalse, qtrue, gentity_s::r, STAT_HEALTH, playerState_s::stats, TIMER_Done(), TIMER_Set(), and trap_G2API_GetSurfaceRenderStatus(). Referenced by NPC_BSMark1_Default().
00626 {
00627 int blasterTest,rocketTest;
00628 float distance;
00629 distance_e distRate;
00630 qboolean visible;
00631 qboolean advance;
00632
00633 //randomly talk
00634 if ( TIMER_Done(NPC,"patrolNoise") )
00635 {
00636 if (TIMER_Done(NPC,"angerNoise"))
00637 {
00638 // G_Sound( NPC, G_SoundIndex(va("sound/chars/mark1/misc/talk%d.wav", Q_irand(1, 4))));
00639 TIMER_Set( NPC, "patrolNoise", Q_irand( 4000, 10000 ) );
00640 }
00641 }
00642
00643 // Enemy is dead or he has no enemy.
00644 if ((NPC->enemy->health<1) || ( NPC_CheckEnemyExt(qfalse) == qfalse ))
00645 {
00646 NPC->enemy = NULL;
00647 return;
00648 }
00649
00650 // Rate our distance to the target and visibility
00651 distance = (int) DistanceHorizontalSquared( NPC->r.currentOrigin, NPC->enemy->r.currentOrigin );
00652 distRate = ( distance > MIN_MELEE_RANGE_SQR ) ? DIST_LONG : DIST_MELEE;
00653 visible = NPC_ClearLOS4( NPC->enemy );
00654 advance = (qboolean)(distance > MIN_DISTANCE_SQR);
00655
00656 // If we cannot see our target, move to see it
00657 if ((!visible) || (!NPC_FaceEnemy(qtrue)))
00658 {
00659 Mark1_Hunt();
00660 return;
00661 }
00662
00663 // See if the side weapons are there
00664 blasterTest = trap_G2API_GetSurfaceRenderStatus( NPC->ghoul2, 0, "l_arm" );
00665 rocketTest = trap_G2API_GetSurfaceRenderStatus( NPC->ghoul2, 0, "r_arm" );
00666
00667 // It has both side weapons
00668 if (!blasterTest && !rocketTest)
00669 {
00670 ; // So do nothing.
00671 }
00672 else if (blasterTest!=-1
00673 &&blasterTest)
00674 {
00675 distRate = DIST_LONG;
00676 }
00677 else if (rocketTest!=-1
00678 &&rocketTest)
00679 {
00680 distRate = DIST_MELEE;
00681 }
00682 else // It should never get here, but just in case
00683 {
00684 NPC->health = 0;
00685 NPC->client->ps.stats[STAT_HEALTH] = 0;
00686 //GEntity_DieFunc(NPC, NPC, NPC, 100, MOD_UNKNOWN);
00687 if (NPC->die)
00688 {
00689 NPC->die(NPC, NPC, NPC, 100, MOD_UNKNOWN);
00690 }
00691 }
00692
00693 // We can see enemy so shoot him if timers let you.
00694 NPC_FaceEnemy( qtrue );
00695
00696 if (distRate == DIST_MELEE)
00697 {
00698 Mark1_BlasterAttack(advance);
00699 }
00700 else if (distRate == DIST_LONG)
00701 {
00702 Mark1_RocketAttack(advance);
00703 }
00704 }
|
|
|
Definition at line 495 of file NPC_AI_Mark1.c. References BOTH_ATTACK1, gNPC_t::burstCount, gentity_s::client, Mark1_FireBlaster(), Mark1_Hunt(), NPC, NPC_SetAnim(), NPCInfo, gclient_s::ps, Q_irand(), SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, TIMER_Done(), TIMER_Set(), playerState_s::torsoAnim, and playerState_s::torsoTimer. Referenced by Mark1_AttackDecision().
00496 {
00497 int chance;
00498
00499 if ( TIMER_Done( NPC, "attackDelay" ) ) // Attack?
00500 {
00501 chance = Q_irand( 1, 5);
00502
00503 NPCInfo->burstCount++;
00504
00505 if (NPCInfo->burstCount<3) // Too few shots this burst?
00506 {
00507 chance = 2; // Force it to keep firing.
00508 }
00509 else if (NPCInfo->burstCount>12) // Too many shots fired this burst?
00510 {
00511 NPCInfo->burstCount = 0;
00512 chance = 1; // Force it to stop firing.
00513 }
00514
00515 // Stop firing.
00516 if (chance == 1)
00517 {
00518 NPCInfo->burstCount = 0;
00519 TIMER_Set( NPC, "attackDelay", Q_irand( 1000, 3000) );
00520 NPC->client->ps.torsoTimer=0; // Just in case the firing anim is running.
00521 }
00522 else
00523 {
00524 if (TIMER_Done( NPC, "attackDelay2" )) // Can't be shooting every frame.
00525 {
00526 TIMER_Set( NPC, "attackDelay2", Q_irand( 50, 50) );
00527 Mark1_FireBlaster();
00528 NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_ATTACK1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00529 }
00530 return;
00531 }
00532 }
00533 else if (advance)
00534 {
00535 if ( NPC->client->ps.torsoAnim == BOTH_ATTACK1 )
00536 {
00537 NPC->client->ps.torsoTimer=0; // Just in case the firing anim is running.
00538 }
00539 Mark1_Hunt();
00540 }
00541 else // Make sure he's not firing.
00542 {
00543 if ( NPC->client->ps.torsoAnim == BOTH_ATTACK1 )
00544 {
00545 NPC->client->ps.torsoTimer=0; // Just in case the firing anim is running.
00546 }
00547 }
00548 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 209 of file NPC_AI_Mark1.c. References BOTH_DEATH1, BOTH_DEATH2, CHAN_AUTO, G_Sound(), G_SoundIndex(), gentity_t, NPC_SetAnim(), Q_irand(), SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, and va().
00210 {
00211 /*
00212 int anim;
00213
00214 // Is he dead already?
00215 anim = self->client->ps.legsAnim;
00216 if (((anim==BOTH_DEATH1) || (anim==BOTH_DEATH2)) && (self->client->ps.torsoTimer<=0))
00217 { // This is because self->health keeps getting zeroed out. HL_NONE acts as health in this case.
00218 self->locationDamage[HL_NONE] += damage;
00219 if (self->locationDamage[HL_NONE] > 50)
00220 {
00221 DeathFX(self);
00222 self->client->ps.eFlags |= EF_NODRAW;
00223 self->contents = CONTENTS_CORPSE;
00224 // G_FreeEntity( self ); // Is this safe? I can't see why we'd mark it nodraw and then just leave it around??
00225 self->e_ThinkFunc = thinkF_G_FreeEntity;
00226 self->nextthink = level.time + FRAMETIME;
00227 }
00228 return;
00229 }
00230 */
00231
00232 G_Sound( self, CHAN_AUTO, G_SoundIndex(va("sound/chars/mark1/misc/death%d.wav",Q_irand( 1, 2))));
00233
00234 // Choose a death anim
00235 if (Q_irand( 1, 10) > 5)
00236 {
00237 NPC_SetAnim( self, SETANIM_BOTH, BOTH_DEATH2, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00238 }
00239 else
00240 {
00241 NPC_SetAnim( self, SETANIM_BOTH, BOTH_DEATH1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00242 }
00243 }
|
|
|
Definition at line 250 of file NPC_AI_Mark1.c. References gentity_s::client, gentity_t, gentity_s::ghoul2, Mark1Dead_FireBlaster(), Mark1Dead_FireRocket(), NPC_Mark1_Part_Explode(), NPC_SetSurfaceOnOff(), gclient_s::ps, Q_irand(), RestoreNPCGlobals(), SaveNPCGlobals(), SetNPCGlobals(), TIMER_Done(), TIMER_Set(), playerState_s::torsoTimer, trap_G2API_AddBolt(), trap_G2API_GetSurfaceRenderStatus(), TURN_OFF, and va(). Referenced by NPC_RemoveBody().
00251 {
00252 int num,newBolt;
00253
00254 if (self->client->ps.torsoTimer>0)
00255 {
00256 if (TIMER_Done(self,"dyingExplosion"))
00257 {
00258 num = Q_irand( 1, 3);
00259
00260 // Find place to generate explosion
00261 if (num == 1)
00262 {
00263 num = Q_irand( 8, 10);
00264 newBolt = trap_G2API_AddBolt( self->ghoul2, 0, va("*flash%d",num) );
00265 NPC_Mark1_Part_Explode(self,newBolt);
00266 }
00267 else
00268 {
00269 num = Q_irand( 1, 6);
00270 newBolt = trap_G2API_AddBolt( self->ghoul2, 0, va("*torso_tube%d",num) );
00271 NPC_Mark1_Part_Explode(self,newBolt);
00272 NPC_SetSurfaceOnOff( self, va("torso_tube%d",num), TURN_OFF );
00273 }
00274
00275 TIMER_Set( self, "dyingExplosion", Q_irand( 300, 1000 ) );
00276 }
00277
00278
00279 // int dir;
00280 // vec3_t right;
00281
00282 // Shove to the side
00283 // AngleVectors( self->client->renderInfo.eyeAngles, NULL, right, NULL );
00284 // VectorMA( self->client->ps.velocity, -80, right, self->client->ps.velocity );
00285
00286 // See which weapons are there
00287 // Randomly fire blaster
00288 if (!trap_G2API_GetSurfaceRenderStatus( self->ghoul2, 0, "l_arm" )) // Is the blaster still on the model?
00289 {
00290 if (Q_irand( 1, 5) == 1)
00291 {
00292 SaveNPCGlobals();
00293 SetNPCGlobals( self );
00294 Mark1Dead_FireBlaster();
00295 RestoreNPCGlobals();
00296 }
00297 }
00298
00299 // Randomly fire rocket
00300 if (!trap_G2API_GetSurfaceRenderStatus( self->ghoul2, 0, "r_arm" )) // Is the rocket still on the model?
00301 {
00302 if (Q_irand( 1, 10) == 1)
00303 {
00304 SaveNPCGlobals();
00305 SetNPCGlobals( self );
00306 Mark1Dead_FireRocket();
00307 RestoreNPCGlobals();
00308 }
00309 }
00310 }
00311
00312 }
|
|
|
|
Definition at line 555 of file NPC_AI_Mark1.c. References AngleVectors(), gentity_s::bounceCount, BOWCASTER_SIZE, BOWCASTER_SPLASH_DAMAGE, BOWCASTER_SPLASH_RADIUS, BOWCASTER_VELOCITY, CalcEntitySpot(), CHAN_AUTO, gentity_s::classname, gentity_s::clipmask, CONTENTS_LIGHTSABER, CreateMissile(), entityShared_t::currentAngles, entityShared_t::currentOrigin, gentity_s::damage, DAMAGE_DEATH_KNOCKBACK, gentity_s::dflags, gentity_s::enemy, G_Sound(), G_SoundIndex(), gentity_t, gentity_s::ghoul2, level, MASK_SHOT, entityShared_t::maxs, gentity_s::methodOfDeath, entityShared_t::mins, MOD_ROCKET, gentity_s::modelScale, NPC, NULL, ORIGIN, qfalse, gentity_s::r, gentity_s::s, gentity_s::splashDamage, gentity_s::splashRadius, SPOT_HEAD, level_locals_t::time, trap_G2API_AddBolt(), trap_G2API_GetBoltMatrix(), vec3_t, vectoangles(), VectorScale, VectorSet, VectorSubtract, entityState_s::weapon, and WP_BOWCASTER. Referenced by Mark1_RocketAttack().
00556 {
00557 mdxaBone_t boltMatrix;
00558 vec3_t muzzle1,enemy_org1,delta1,angleToEnemy1;
00559 static vec3_t forward, vright, up;
00560 int bolt = trap_G2API_AddBolt(NPC->ghoul2, 0, "*flash5");
00561 gentity_t *missile;
00562
00563 int damage = 50;
00564
00565 trap_G2API_GetBoltMatrix( NPC->ghoul2, 0,
00566 bolt,
00567 &boltMatrix, NPC->r.currentAngles, NPC->r.currentOrigin, level.time,
00568 NULL, NPC->modelScale );
00569
00570 BG_GiveMeVectorFromMatrix( &boltMatrix, ORIGIN, muzzle1 );
00571
00572 // G_PlayEffect( "blaster/muzzle_flash", muzzle1 );
00573
00574 CalcEntitySpot( NPC->enemy, SPOT_HEAD, enemy_org1 );
00575 VectorSubtract (enemy_org1, muzzle1, delta1);
00576 vectoangles ( delta1, angleToEnemy1 );
00577 AngleVectors (angleToEnemy1, forward, vright, up);
00578
00579 G_Sound( NPC, CHAN_AUTO, G_SoundIndex("sound/chars/mark1/misc/mark1_fire" ));
00580
00581 missile = CreateMissile( muzzle1, forward, BOWCASTER_VELOCITY, 10000, NPC, qfalse );
00582
00583 missile->classname = "bowcaster_proj";
00584 missile->s.weapon = WP_BOWCASTER;
00585
00586 VectorSet( missile->r.maxs, BOWCASTER_SIZE, BOWCASTER_SIZE, BOWCASTER_SIZE );
00587 VectorScale( missile->r.maxs, -1, missile->r.mins );
00588
00589 missile->damage = damage;
00590 missile->dflags = DAMAGE_DEATH_KNOCKBACK;
00591 missile->methodOfDeath = MOD_ROCKET;
00592 missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
00593 missile->splashDamage = BOWCASTER_SPLASH_DAMAGE;
00594 missile->splashRadius = BOWCASTER_SPLASH_RADIUS;
00595
00596 // we don't want it to bounce
00597 missile->bounceCount = 0;
00598
00599 }
|
|
|
Definition at line 404 of file NPC_AI_Mark1.c. References gNPC_t::combatMove, gentity_s::enemy, gNPC_t::goalEntity, NPC, NPC_FaceEnemy(), NPC_MoveToGoal(), NPCInfo, NULL, and qtrue. Referenced by Mark1_AttackDecision(), Mark1_BlasterAttack(), and Mark1_RocketAttack().
00405 {
00406
00407 if ( NPCInfo->goalEntity == NULL )
00408 {
00409 NPCInfo->goalEntity = NPC->enemy;
00410 }
00411
00412 NPC_FaceEnemy( qtrue );
00413
00414 NPCInfo->combatMove = qtrue;
00415 NPC_MoveToGoal( qtrue );
00416 }
|
|
|
Definition at line 109 of file NPC_AI_Mark1.c. References BOTH_SLEEP1, NPC, NPC_BSIdle(), NPC_SetAnim(), SETANIM_BOTH, and SETANIM_FLAG_NORMAL. Referenced by NPC_BSMark1_Default().
00110 {
00111
00112 NPC_BSIdle();
00113
00114 NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_SLEEP1, SETANIM_FLAG_NORMAL );
00115 }
|
|
|
Definition at line 711 of file NPC_AI_Mark1.c. References BUTTON_WALKING, usercmd_s::buttons, CHAN_AUTO, gentity_s::enemy, G_Sound(), G_SoundIndex(), NPC, NPC_CheckPlayerTeamStealth(), NPC_MoveToGoal(), NPC_UpdateAngles(), qtrue, ucmd, and UpdateGoal(). Referenced by NPC_BSMark1_Default().
00712 {
00713 if ( NPC_CheckPlayerTeamStealth() )
00714 {
00715 G_Sound( NPC, CHAN_AUTO, G_SoundIndex("sound/chars/mark1/misc/mark1_wakeup"));
00716 NPC_UpdateAngles( qtrue, qtrue );
00717 return;
00718 }
00719
00720 //If we have somewhere to go, then do that
00721 if (!NPC->enemy)
00722 {
00723 if ( UpdateGoal() )
00724 {
00725 ucmd.buttons |= BUTTON_WALKING;
00726 NPC_MoveToGoal( qtrue );
00727 NPC_UpdateAngles( qtrue, qtrue );
00728 }
00729
00730 //randomly talk
00731 // if (TIMER_Done(NPC,"patrolNoise"))
00732 // {
00733 // G_Sound( NPC, G_SoundIndex(va("sound/chars/mark1/misc/talk%d.wav", Q_irand(1, 4))));
00734 //
00735 // TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
00736 // }
00737 }
00738
00739 }
|
|
|
Definition at line 606 of file NPC_AI_Mark1.c. References BOTH_ATTACK2, Mark1_FireRocket(), Mark1_Hunt(), NPC, NPC_SetAnim(), Q_irand(), SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, SETANIM_TORSO, TIMER_Done(), and TIMER_Set(). Referenced by Mark1_AttackDecision().
00607 {
00608 if ( TIMER_Done( NPC, "attackDelay" ) ) // Attack?
00609 {
00610 TIMER_Set( NPC, "attackDelay", Q_irand( 1000, 3000) );
00611 NPC_SetAnim( NPC, SETANIM_TORSO, BOTH_ATTACK2, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00612 Mark1_FireRocket();
00613 }
00614 else if (advance)
00615 {
00616 Mark1_Hunt();
00617 }
00618 }
|
|
|
|
|
Definition at line 747 of file NPC_AI_Mark1.c. References gentity_s::enemy, gNPC_t::goalEntity, Mark1_AttackDecision(), Mark1_Idle(), Mark1_Patrol(), NPC, NPCInfo, SCF_LOOK_FOR_ENEMIES, and gNPC_t::scriptFlags. Referenced by NPC_BehaviorSet_Mark1().
00748 {
00749 //NPC->e_DieFunc = dieF_Mark1_die;
00750
00751 if ( NPC->enemy )
00752 {
00753 NPCInfo->goalEntity = NPC->enemy;
00754 Mark1_AttackDecision();
00755 }
00756 else if ( NPCInfo->scriptFlags & SCF_LOOK_FOR_ENEMIES )
00757 {
00758 Mark1_Patrol();
00759 }
00760 else
00761 {
00762 Mark1_Idle();
00763 }
00764 }
|
|
|
|
|
||||||||||||||||
|
Definition at line 320 of file NPC_AI_Mark1.c. References AMMO_POD_HEALTH, BOTH_PAIN1, CHAN_AUTO, G_Damage(), G_Sound(), G_SoundIndex(), gentity_t, gentity_s::ghoul2, gPainHitLoc, gentity_s::health, HL_ARM_LT, HL_ARM_RT, HL_CHEST, HL_GENERIC1, LEFT_ARM_HEALTH, gentity_s::locationDamage, MOD_UNKNOWN, NPC_Mark1_Part_Explode(), NPC_Pain(), NPC_SetAnim(), NPC_SetSurfaceOnOff(), NULL, Q_irand(), RIGHT_ARM_HEALTH, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, trap_G2API_AddBolt(), trap_G2API_GetSurfaceRenderStatus(), TURN_OFF, and va(). Referenced by NPC_PainFunc().
00321 {
00322 int newBolt,i,chance;
00323 int hitLoc = gPainHitLoc;
00324
00325 NPC_Pain( self, attacker, damage );
00326
00327 G_Sound( self, CHAN_AUTO, G_SoundIndex("sound/chars/mark1/misc/mark1_pain"));
00328
00329 // Hit in the CHEST???
00330 if (hitLoc==HL_CHEST)
00331 {
00332 chance = Q_irand( 1, 4);
00333
00334 if ((chance == 1) && (damage > 5))
00335 {
00336 NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00337 }
00338 }
00339 // Hit in the left arm?
00340 else if ((hitLoc==HL_ARM_LT) && (self->locationDamage[HL_ARM_LT] > LEFT_ARM_HEALTH))
00341 {
00342 if (self->locationDamage[hitLoc] >= LEFT_ARM_HEALTH) // Blow it up?
00343 {
00344 newBolt = trap_G2API_AddBolt( self->ghoul2, 0, "*flash3" );
00345 if ( newBolt != -1 )
00346 {
00347 NPC_Mark1_Part_Explode(self,newBolt);
00348 }
00349
00350 NPC_SetSurfaceOnOff( self, "l_arm", TURN_OFF );
00351 }
00352 }
00353 // Hit in the right arm?
00354 else if ((hitLoc==HL_ARM_RT) && (self->locationDamage[HL_ARM_RT] > RIGHT_ARM_HEALTH)) // Blow it up?
00355 {
00356 if (self->locationDamage[hitLoc] >= RIGHT_ARM_HEALTH)
00357 {
00358 newBolt = trap_G2API_AddBolt( self->ghoul2, 0, "*flash4" );
00359 if ( newBolt != -1 )
00360 {
00361 // G_PlayEffect( "small_chunks", self->playerModel, self->genericBolt2, self->s.number);
00362 NPC_Mark1_Part_Explode( self, newBolt );
00363 }
00364
00365 NPC_SetSurfaceOnOff( self, "r_arm", TURN_OFF );
00366 }
00367 }
00368 // Check ammo pods
00369 else
00370 {
00371 for (i=0;i<6;i++)
00372 {
00373 if ((hitLoc==HL_GENERIC1+i) && (self->locationDamage[HL_GENERIC1+i] > AMMO_POD_HEALTH)) // Blow it up?
00374 {
00375 if (self->locationDamage[hitLoc] >= AMMO_POD_HEALTH)
00376 {
00377 newBolt = trap_G2API_AddBolt( self->ghoul2, 0, va("*torso_tube%d",(i+1)) );
00378 if ( newBolt != -1 )
00379 {
00380 NPC_Mark1_Part_Explode(self,newBolt);
00381 }
00382 NPC_SetSurfaceOnOff( self, va("torso_tube%d",(i+1)), TURN_OFF );
00383 NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00384 break;
00385 }
00386 }
00387 }
00388 }
00389
00390 // Are both guns shot off?
00391 if ((trap_G2API_GetSurfaceRenderStatus( self->ghoul2, 0, "l_arm" )>0) &&
00392 (trap_G2API_GetSurfaceRenderStatus( self->ghoul2, 0, "r_arm" )>0))
00393 {
00394 G_Damage(self,NULL,NULL,NULL,NULL,self->health,0,MOD_UNKNOWN);
00395 }
00396 }
|
|
||||||||||||
|
Definition at line 81 of file NPC_AI_Mark1.c. References entityShared_t::currentAngles, entityShared_t::currentOrigin, G_EffectIndex(), G_PlayEffectID(), gentity_t, gentity_s::ghoul2, level, gentity_s::modelScale, NEGATIVE_Y, NULL, ORIGIN, gentity_s::r, level_locals_t::time, trap_G2API_GetBoltMatrix(), and vec3_t. Referenced by Mark1_dying(), and NPC_Mark1_Pain().
00082 {
00083 if ( bolt >=0 )
00084 {
00085 mdxaBone_t boltMatrix;
00086 vec3_t org, dir;
00087
00088 trap_G2API_GetBoltMatrix( self->ghoul2, 0,
00089 bolt,
00090 &boltMatrix, self->r.currentAngles, self->r.currentOrigin, level.time,
00091 NULL, self->modelScale );
00092
00093 BG_GiveMeVectorFromMatrix( &boltMatrix, ORIGIN, org );
00094 BG_GiveMeVectorFromMatrix( &boltMatrix, NEGATIVE_Y, dir );
00095
00096 G_PlayEffectID( G_EffectIndex("env/med_explode2"), org, dir );
00097
00098 G_PlayEffectID( G_EffectIndex("blaster/smoke_bolton"), org, dir );
00099 }
00100
00101 //G_PlayEffectID( G_EffectIndex("blaster/smoke_bolton"), self->playerModel, bolt, self->s.number );
00102 }
|
|
|
Definition at line 50 of file NPC_AI_Mark1.c. References AMMO_BLASTER, AMMO_METAL_BOLTS, BG_FindItemForAmmo(), BG_FindItemForWeapon(), G_EffectIndex(), G_SoundIndex(), RegisterItem(), WP_BOWCASTER, and WP_BRYAR_PISTOL. Referenced by NPC_SpawnType(), and SP_NPC_Droid_Mark1().
00051 {
00052 G_SoundIndex( "sound/chars/mark1/misc/mark1_wakeup");
00053 G_SoundIndex( "sound/chars/mark1/misc/shutdown");
00054 G_SoundIndex( "sound/chars/mark1/misc/walk");
00055 G_SoundIndex( "sound/chars/mark1/misc/run");
00056 G_SoundIndex( "sound/chars/mark1/misc/death1");
00057 G_SoundIndex( "sound/chars/mark1/misc/death2");
00058 G_SoundIndex( "sound/chars/mark1/misc/anger");
00059 G_SoundIndex( "sound/chars/mark1/misc/mark1_fire");
00060 G_SoundIndex( "sound/chars/mark1/misc/mark1_pain");
00061 G_SoundIndex( "sound/chars/mark1/misc/mark1_explo");
00062
00063 // G_EffectIndex( "small_chunks");
00064 G_EffectIndex( "env/med_explode2");
00065 G_EffectIndex( "explosions/probeexplosion1");
00066 G_EffectIndex( "blaster/smoke_bolton");
00067 G_EffectIndex( "bryar/muzzle_flash");
00068 G_EffectIndex( "explosions/droidexplosion1" );
00069
00070 RegisterItem( BG_FindItemForAmmo( AMMO_METAL_BOLTS));
00071 RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER ));
00072 RegisterItem( BG_FindItemForWeapon( WP_BOWCASTER ));
00073 RegisterItem( BG_FindItemForWeapon( WP_BRYAR_PISTOL ));
00074 }
|