codemp/game/NPC_spawn.c File Reference

#include "b_local.h"
#include "anims.h"
#include "w_saber.h"
#include "bg_saga.h"
#include "bg_vehicles.h"
#include "g_nav.h"
#include "../namespace_begin.h"
#include "../namespace_end.h"

Go to the source code of this file.

Defines

#define NSF_DROP_TO_FLOOR   16
#define SHY_THINK_TIME   1000
#define SHY_SPAWN_DISTANCE   128
#define SHY_SPAWN_DISTANCE_SQR   ( SHY_SPAWN_DISTANCE * SHY_SPAWN_DISTANCE )

Typedefs

typedef void( PAIN_FUNC )(gentity_t *self, gentity_t *attacker, int damage)
typedef void( TOUCH_FUNC )(gentity_t *self, gentity_t *other, trace_t *trace)

Functions

void G_DebugPrint (int level, const char *format,...)
qboolean G_CheckInSolid (gentity_t *self, qboolean fix)
void ClientUserinfoChanged (int clientNum)
qboolean SpotWouldTelefrag2 (gentity_t *mover, vec3_t dest)
void Jedi_Cloak (gentity_t *self)
void Q3_SetParm (int entID, int parmNum, const char *parmValue)
team_t TranslateTeamName (const char *name)
void PM_SetTorsoAnimTimer (gentity_t *ent, int *torsoAnimTimer, int time)
void PM_SetLegsAnimTimer (gentity_t *ent, int *legsAnimTimer, int time)
void ST_ClearTimers (gentity_t *ent)
void Jedi_ClearTimers (gentity_t *ent)
void NPC_ShadowTrooper_Precache (void)
void NPC_Gonk_Precache (void)
void NPC_Mouse_Precache (void)
void NPC_Seeker_Precache (void)
void NPC_Remote_Precache (void)
void NPC_R2D2_Precache (void)
void NPC_R5D2_Precache (void)
void NPC_Probe_Precache (void)
void NPC_Interrogator_Precache (gentity_t *self)
void NPC_MineMonster_Precache (void)
void NPC_Howler_Precache (void)
void NPC_ATST_Precache (void)
void NPC_Sentry_Precache (void)
void NPC_Mark1_Precache (void)
void NPC_Mark2_Precache (void)
void NPC_GalakMech_Precache (void)
void NPC_GalakMech_Init (gentity_t *ent)
void NPC_Protocol_Precache (void)
void Boba_Precache (void)
void NPC_Wampa_Precache (void)
gentity_tNPC_SpawnType (gentity_t *ent, char *npc_type, char *targetname, qboolean isVehicle)
void Rancor_SetBolts (gentity_t *self)
void Wampa_SetBolts (gentity_t *self)
void funcBBrushPain (gentity_t *self, gentity_t *attacker, int damage)
void misc_model_breakable_pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Pain (gentity_t *self, gentity_t *attacker, int damage)
void station_pain (gentity_t *self, gentity_t *attacker, int damage)
void func_usable_pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_ATST_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_ST_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Jedi_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Droid_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Probe_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_MineMonster_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Howler_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Seeker_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Remote_Pain (gentity_t *self, gentity_t *attacker, int damage)
void emplaced_gun_pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Mark1_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_GM_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Sentry_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Mark2_Pain (gentity_t *self, gentity_t *attacker, int damage)
void PlayerPain (gentity_t *self, gentity_t *attacker, int damage)
void GasBurst (gentity_t *self, gentity_t *attacker, int damage)
void CrystalCratePain (gentity_t *self, gentity_t *attacker, int damage)
void TurretPain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Wampa_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Rancor_Pain (gentity_t *self, gentity_t *attacker, int damage)
int WP_SetSaberModel (gclient_t *client, class_t npcClass)
PAIN_FUNCNPC_PainFunc (gentity_t *ent)
TOUCH_FUNCNPC_TouchFunc (gentity_t *ent)
void G_CreateG2AttachedWeaponModel (gentity_t *ent, const char *weaponModel, int boltNum, int weaponNum)
void NPC_SetMiscDefaultData (gentity_t *ent)
int NPC_WeaponsForTeam (team_t team, int spawnflags, const char *NPC_type)
void ChangeWeapon (gentity_t *ent, int newWeapon)
void NPC_SetWeapons (gentity_t *ent)
void NPC_SpawnEffect (gentity_t *ent)
void NPC_SetFX_SpawnStates (gentity_t *ent)
qboolean NPC_SpotWouldTelefrag (gentity_t *npc)
void NPC_Begin (gentity_t *ent)
gNPC_tNew_NPC_t (int entNum)
void NPC_DefaultScriptFlags (gentity_t *ent)
void G_CreateAnimalNPC (Vehicle_t **pVeh, const char *strAnimalType)
void G_CreateSpeederNPC (Vehicle_t **pVeh, const char *strType)
void G_CreateWalkerNPC (Vehicle_t **pVeh, const char *strAnimalType)
void G_CreateFighterNPC (Vehicle_t **pVeh, const char *strType)
gentity_tNPC_Spawn_Do (gentity_t *ent)
void NPC_Spawn_Go (gentity_t *ent)
void NPC_ShySpawn (gentity_t *ent)
void NPC_Spawn (gentity_t *ent, gentity_t *other, gentity_t *activator)
void NPC_PrecacheAnimationCFG (const char *NPC_type)
void NPC_Precache (gentity_t *spawner)
void NPC_PrecacheType (char *NPC_type)
void SP_NPC_spawner (gentity_t *self)
void G_VehicleSpawn (gentity_t *self)
qboolean NPC_VehiclePrecache (gentity_t *spawner)
void NPC_VehicleSpawnUse (gentity_t *self, gentity_t *other, gentity_t *activator)
void SP_NPC_Vehicle (gentity_t *self)
void SP_NPC_Kyle (gentity_t *self)
void SP_NPC_Lando (gentity_t *self)
void SP_NPC_Jan (gentity_t *self)
void SP_NPC_Luke (gentity_t *self)
void SP_NPC_MonMothma (gentity_t *self)
void SP_NPC_Tavion (gentity_t *self)
void SP_NPC_Tavion_New (gentity_t *self)
void SP_NPC_Alora (gentity_t *self)
void SP_NPC_Reborn_New (gentity_t *self)
void SP_NPC_Cultist_Saber (gentity_t *self)
void SP_NPC_Cultist_Saber_Powers (gentity_t *self)
void SP_NPC_Cultist (gentity_t *self)
void SP_NPC_Cultist_Commando (gentity_t *self)
void SP_NPC_Cultist_Destroyer (gentity_t *self)
void SP_NPC_Reelo (gentity_t *self)
void SP_NPC_Galak (gentity_t *self)
void SP_NPC_Desann (gentity_t *self)
void SP_NPC_Bartender (gentity_t *self)
void SP_NPC_MorganKatarn (gentity_t *self)
void SP_NPC_Jedi (gentity_t *self)
void SP_NPC_Prisoner (gentity_t *self)
void SP_NPC_Rebel (gentity_t *self)
void SP_NPC_Stormtrooper (gentity_t *self)
void SP_NPC_StormtrooperOfficer (gentity_t *self)
void SP_NPC_Snowtrooper (gentity_t *self)
void SP_NPC_Tie_Pilot (gentity_t *self)
void SP_NPC_Ugnaught (gentity_t *self)
void SP_NPC_Jawa (gentity_t *self)
void SP_NPC_Gran (gentity_t *self)
void SP_NPC_Rodian (gentity_t *self)
void SP_NPC_Weequay (gentity_t *self)
void SP_NPC_Trandoshan (gentity_t *self)
void SP_NPC_Tusken (gentity_t *self)
void SP_NPC_Noghri (gentity_t *self)
void SP_NPC_SwampTrooper (gentity_t *self)
void SP_NPC_Imperial (gentity_t *self)
void SP_NPC_ImpWorker (gentity_t *self)
void SP_NPC_BespinCop (gentity_t *self)
void SP_NPC_Reborn (gentity_t *self)
void SP_NPC_ShadowTrooper (gentity_t *self)
void SP_NPC_Monster_Murjj (gentity_t *self)
void SP_NPC_Monster_Swamp (gentity_t *self)
void SP_NPC_Monster_Howler (gentity_t *self)
void SP_NPC_MineMonster (gentity_t *self)
void SP_NPC_Monster_Claw (gentity_t *self)
void SP_NPC_Monster_Glider (gentity_t *self)
void SP_NPC_Monster_Flier2 (gentity_t *self)
void SP_NPC_Monster_Lizard (gentity_t *self)
void SP_NPC_Monster_Fish (gentity_t *self)
void SP_NPC_Monster_Wampa (gentity_t *self)
void SP_NPC_Monster_Rancor (gentity_t *self)
void SP_NPC_Droid_Interrogator (gentity_t *self)
void SP_NPC_Droid_Probe (gentity_t *self)
void SP_NPC_Droid_Mark1 (gentity_t *self)
void SP_NPC_Droid_Mark2 (gentity_t *self)
void SP_NPC_Droid_ATST (gentity_t *self)
void SP_NPC_Droid_Remote (gentity_t *self)
void SP_NPC_Droid_Seeker (gentity_t *self)
void SP_NPC_Droid_Sentry (gentity_t *self)
void SP_NPC_Droid_Gonk (gentity_t *self)
void SP_NPC_Droid_Mouse (gentity_t *self)
void SP_NPC_Droid_R2D2 (gentity_t *self)
void SP_NPC_Droid_R5D2 (gentity_t *self)
void SP_NPC_Droid_Protocol (gentity_t *self)
void NPC_Spawn_f (gentity_t *ent)
void NPC_Kill_f (void)
void NPC_PrintScore (gentity_t *ent)
void Cmd_NPC_f (gentity_t *ent)

Variables

char * TeamNames [TEAM_NUM_TEAMS]
gNPC_tgNPCPtrs [MAX_GENTITIES]
stringID_table_t TeamTable []
qboolean showBBoxes = qfalse


Define Documentation

#define NSF_DROP_TO_FLOOR   16
 

Definition at line 57 of file NPC_spawn.c.

Referenced by NPC_Spawn_Do().

#define SHY_SPAWN_DISTANCE   128
 

Definition at line 1805 of file NPC_spawn.c.

#define SHY_SPAWN_DISTANCE_SQR   ( SHY_SPAWN_DISTANCE * SHY_SPAWN_DISTANCE )
 

Definition at line 1806 of file NPC_spawn.c.

Referenced by NPC_ShySpawn().

#define SHY_THINK_TIME   1000
 

Definition at line 1804 of file NPC_spawn.c.

Referenced by NPC_ShySpawn().


Typedef Documentation

typedef void( PAIN_FUNC)(gentity_t *self, gentity_t *attacker, int damage)
 

Definition at line 101 of file NPC_spawn.c.

Referenced by NPC_PainFunc().

typedef void( TOUCH_FUNC)(gentity_t *self, gentity_t *other, trace_t *trace)
 

Definition at line 197 of file NPC_spawn.c.

Referenced by NPC_TouchFunc().


Function Documentation

void Boba_Precache void   ) 
 

Definition at line 182 of file NPC_AI_Jedi.c.

References G_EffectIndex(), and G_SoundIndex().

Referenced by NPC_SetMiscDefaultData().

00183 {
00184         G_SoundIndex( "sound/boba/jeton.wav" );
00185         G_SoundIndex( "sound/boba/jethover.wav" );
00186         G_SoundIndex( "sound/effects/combustfire.mp3" );
00187         G_EffectIndex( "boba/jet" );
00188         G_EffectIndex( "boba/fthrw" );
00189 }

void ChangeWeapon gentity_t ent,
int  newWeapon
 

void ClientUserinfoChanged int  clientNum  ) 
 

Definition at line 1888 of file g_client.c.

References atoi(), BG_SiegeCheckClassLegality(), BG_SiegeFindClassIndexByName(), bgSiegeClasses, gentity_s::client, client, CON_CONNECTED, clientPersistant_t::connected, CS_PLAYERS, playerState_s::customRGBA, d_perPlayerGhoul2, clientSession_t::duelTeam, siegeClass_t::forcedModel, g_entities, g_gametype, G_GetStringEdString(), g_logClientInfo, G_LogPrintf(), G_PlayerHasCustomSkeleton(), G_SaberModelSetup(), G_SetSaber(), G_ValidateSiegeClassForTeam(), gclient_t, gentity_t, gentity_s::ghoul2, GT_SIEGE, GT_TEAM, Info_SetValueForKey(), Info_Validate(), Info_ValueForKey(), vmCvar_t::integer, renderInfo_s::lastG2, gclient_s::legsAnimExecute, gclient_s::legsLastFlip, level, gentity_s::localAnimIndex, clientPersistant_t::localClient, clientSession_t::losses, MAX_INFO_STRING, MAX_QPATH, MAX_STRING_CHARS, clientPersistant_t::maxHealth, siegeClass_t::maxhealth, gclient_s::modelname, clientPersistant_t::netname, clientPersistant_t::netnameTime, NULL, gclient_s::pers, PickTeam(), clientPersistant_t::predictItemPickup, gclient_s::ps, Q_stricmp(), Q_strncpyz(), qboolean, qfalse, qtrue, gentity_s::r, gclient_s::renderInfo, S_COLOR_WHITE, siegeClass_t::saber1, siegeClass_t::saber2, clientSession_t::saber2Type, clientSession_t::saberType, gclient_s::sess, clientSession_t::sessionTeam, SetupGameGhoul2Model(), gclient_s::siegeClass, clientSession_t::siegeClass, clientSession_t::siegeDesiredTeam, SPECTATOR_SCOREBOARD, clientSession_t::spectatorState, STAT_MAX_HEALTH, playerState_s::stats, strcmp(), strcpy(), SVF_BOT, entityShared_t::svFlags, TEAM_BLUE, TEAM_RED, TEAM_SPECTATOR, clientPersistant_t::teamInfo, clientSession_t::teamLeader, level_locals_t::time, gclient_s::torsoAnimExecute, gclient_s::torsoLastFlip, trap_GetUserinfo(), trap_SendServerCommand(), trap_SetConfigstring(), trap_SetUserinfo(), va(), and clientSession_t::wins.

Referenced by AdjustTournamentScores(), ClientBegin(), ClientConnect(), ClientDisconnect(), ClientSpawn(), Cmd_DuelTeam_f(), Cmd_SiegeClass_f(), Cmd_TeamTask_f(), G_AddPowerDuelLoserScore(), G_AddPowerDuelScore(), SetLeader(), SetTeam(), SetTeamQuick(), and vmMain().

01888                                             {
01889         gentity_t *ent;
01890         int             teamTask, teamLeader, team, health;
01891         char    *s;
01892         char    model[MAX_QPATH];
01893         //char  headModel[MAX_QPATH];
01894         char    forcePowers[MAX_QPATH];
01895         char    oldname[MAX_STRING_CHARS];
01896         gclient_t       *client;
01897         char    c1[MAX_INFO_STRING];
01898         char    c2[MAX_INFO_STRING];
01899 //      char    redTeam[MAX_INFO_STRING];
01900 //      char    blueTeam[MAX_INFO_STRING];
01901         char    userinfo[MAX_INFO_STRING];
01902         char    className[MAX_QPATH]; //name of class type to use in siege
01903         char    saberName[MAX_QPATH];
01904         char    saber2Name[MAX_QPATH];
01905         char    *value;
01906         int             maxHealth;
01907         qboolean        modelChanged = qfalse;
01908 
01909         ent = g_entities + clientNum;
01910         client = ent->client;
01911 
01912         trap_GetUserinfo( clientNum, userinfo, sizeof( userinfo ) );
01913 
01914         // check for malformed or illegal info strings
01915         if ( !Info_Validate(userinfo) ) {
01916                 strcpy (userinfo, "\\name\\badinfo");
01917         }
01918 
01919         // check for local client
01920         s = Info_ValueForKey( userinfo, "ip" );
01921         if ( !strcmp( s, "localhost" ) ) {
01922                 client->pers.localClient = qtrue;
01923         }
01924 
01925         // check the item prediction
01926         s = Info_ValueForKey( userinfo, "cg_predictItems" );
01927         if ( !atoi( s ) ) {
01928                 client->pers.predictItemPickup = qfalse;
01929         } else {
01930                 client->pers.predictItemPickup = qtrue;
01931         }
01932 
01933         // set name
01934         Q_strncpyz ( oldname, client->pers.netname, sizeof( oldname ) );
01935         s = Info_ValueForKey (userinfo, "name");
01936         ClientCleanName( s, client->pers.netname, sizeof(client->pers.netname) );
01937 
01938         if ( client->sess.sessionTeam == TEAM_SPECTATOR ) {
01939                 if ( client->sess.spectatorState == SPECTATOR_SCOREBOARD ) {
01940                         Q_strncpyz( client->pers.netname, "scoreboard", sizeof(client->pers.netname) );
01941                 }
01942         }
01943 
01944         if ( client->pers.connected == CON_CONNECTED ) {
01945                 if ( strcmp( oldname, client->pers.netname ) ) 
01946                 {
01947                         if ( client->pers.netnameTime > level.time  )
01948                         {
01949                                 trap_SendServerCommand( clientNum, va("print \"%s\n\"", G_GetStringEdString("MP_SVGAME", "NONAMECHANGE")) );
01950 
01951                                 Info_SetValueForKey( userinfo, "name", oldname );
01952                                 trap_SetUserinfo( clientNum, userinfo );                        
01953                                 strcpy ( client->pers.netname, oldname );
01954                         }
01955                         else
01956                         {                               
01957                                 trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " %s %s\n\"", oldname, G_GetStringEdString("MP_SVGAME", "PLRENAME"), client->pers.netname) );
01958                                 client->pers.netnameTime = level.time + 5000;
01959                         }
01960                 }
01961         }
01962 
01963         // set model
01964         Q_strncpyz( model, Info_ValueForKey (userinfo, "model"), sizeof( model ) );
01965 
01966         if (d_perPlayerGhoul2.integer)
01967         {
01968                 if (Q_stricmp(model, client->modelname))
01969                 {
01970                         strcpy(client->modelname, model);
01971                         modelChanged = qtrue;
01972                 }
01973         }
01974 
01975         //Get the skin RGB based on his userinfo
01976         value = Info_ValueForKey (userinfo, "char_color_red");
01977         if (value)
01978         {
01979                 client->ps.customRGBA[0] = atoi(value);
01980         }
01981         else
01982         {
01983                 client->ps.customRGBA[0] = 255;
01984         }
01985 
01986         value = Info_ValueForKey (userinfo, "char_color_green");
01987         if (value)
01988         {
01989                 client->ps.customRGBA[1] = atoi(value);
01990         }
01991         else
01992         {
01993                 client->ps.customRGBA[1] = 255;
01994         }
01995 
01996         value = Info_ValueForKey (userinfo, "char_color_blue");
01997         if (value)
01998         {
01999                 client->ps.customRGBA[2] = atoi(value);
02000         }
02001         else
02002         {
02003                 client->ps.customRGBA[2] = 255;
02004         }
02005 
02006         if ((client->ps.customRGBA[0]+client->ps.customRGBA[1]+client->ps.customRGBA[2]) < 100)
02007         { //hmm, too dark!
02008                 client->ps.customRGBA[0] = client->ps.customRGBA[1] = client->ps.customRGBA[2] = 255;
02009         }
02010 
02011         client->ps.customRGBA[3]=255;
02012 
02013         Q_strncpyz( forcePowers, Info_ValueForKey (userinfo, "forcepowers"), sizeof( forcePowers ) );
02014 
02015         // bots set their team a few frames later
02016         if (g_gametype.integer >= GT_TEAM && g_entities[clientNum].r.svFlags & SVF_BOT) {
02017                 s = Info_ValueForKey( userinfo, "team" );
02018                 if ( !Q_stricmp( s, "red" ) || !Q_stricmp( s, "r" ) ) {
02019                         team = TEAM_RED;
02020                 } else if ( !Q_stricmp( s, "blue" ) || !Q_stricmp( s, "b" ) ) {
02021                         team = TEAM_BLUE;
02022                 } else {
02023                         // pick the team with the least number of players
02024                         team = PickTeam( clientNum );
02025                 }
02026         }
02027         else {
02028                 team = client->sess.sessionTeam;
02029         }
02030 
02031         //Set the siege class
02032         if (g_gametype.integer == GT_SIEGE)
02033         {
02034                 strcpy(className, client->sess.siegeClass);
02035 
02036                 //This function will see if the given class is legal for the given team.
02037                 //If not className will be filled in with the first legal class for this team.
02038 /*              if (!BG_SiegeCheckClassLegality(team, className) &&
02039                         Q_stricmp(client->sess.siegeClass, "none"))
02040                 { //if it isn't legal pop up the class menu
02041                         trap_SendServerCommand(ent-g_entities, "scl");
02042                 }
02043 */
02044                 //Now that the team is legal for sure, we'll go ahead and get an index for it.
02045                 client->siegeClass = BG_SiegeFindClassIndexByName(className);
02046                 if (client->siegeClass == -1)
02047                 { //ok, get the first valid class for the team you're on then, I guess.
02048                         BG_SiegeCheckClassLegality(team, className);
02049                         strcpy(client->sess.siegeClass, className);
02050                         client->siegeClass = BG_SiegeFindClassIndexByName(className);
02051                 }
02052                 else
02053                 { //otherwise, make sure the class we are using is legal.
02054                         G_ValidateSiegeClassForTeam(ent, team);
02055                         strcpy(className, client->sess.siegeClass);
02056                 }
02057 
02058                 //Set the sabers if the class dictates
02059                 if (client->siegeClass != -1)
02060                 {
02061                         siegeClass_t *scl = &bgSiegeClasses[client->siegeClass];
02062 
02063                         if (scl->saber1[0])
02064                         {
02065                                 G_SetSaber(ent, 0, scl->saber1, qtrue);
02066                         }
02067                         else
02068                         { //default I guess
02069                                 G_SetSaber(ent, 0, "Kyle", qtrue);
02070                         }
02071                         if (scl->saber2[0])
02072                         {
02073                                 G_SetSaber(ent, 1, scl->saber2, qtrue);
02074                         }
02075                         else
02076                         { //no second saber then
02077                                 G_SetSaber(ent, 1, "none", qtrue);
02078                         }
02079 
02080                         //make sure the saber models are updated
02081                         G_SaberModelSetup(ent);
02082 
02083                         if (scl->forcedModel[0])
02084                         { //be sure to override the model we actually use
02085                                 strcpy(model, scl->forcedModel);
02086                                 if (d_perPlayerGhoul2.integer)
02087                                 {
02088                                         if (Q_stricmp(model, client->modelname))
02089                                         {
02090                                                 strcpy(client->modelname, model);
02091                                                 modelChanged = qtrue;
02092                                         }
02093                                 }
02094                         }
02095 
02096                         //force them to use their class model on the server, if the class dictates
02097                         if (G_PlayerHasCustomSkeleton(ent))
02098                         {
02099                                 if (Q_stricmp(model, client->modelname) || ent->localAnimIndex == 0)
02100                                 {
02101                                         strcpy(client->modelname, model);
02102                                         modelChanged = qtrue;
02103                                 }
02104                         }
02105                 }
02106         }
02107         else
02108         {
02109                 strcpy(className, "none");
02110         }
02111 
02112         //Set the saber name
02113         strcpy(saberName, client->sess.saberType);
02114         strcpy(saber2Name, client->sess.saber2Type);
02115 
02116         // set max health
02117         if (g_gametype.integer == GT_SIEGE && client->siegeClass != -1)
02118         {
02119                 siegeClass_t *scl = &bgSiegeClasses[client->siegeClass];
02120                 maxHealth = 100;
02121 
02122                 if (scl->maxhealth)
02123                 {
02124                         maxHealth = scl->maxhealth;
02125                 }
02126 
02127                 health = maxHealth;
02128         }
02129         else
02130         {
02131                 maxHealth = 100;
02132                 health = 100; //atoi( Info_ValueForKey( userinfo, "handicap" ) );
02133         }
02134         client->pers.maxHealth = health;
02135         if ( client->pers.maxHealth < 1 || client->pers.maxHealth > maxHealth ) {
02136                 client->pers.maxHealth = 100;
02137         }
02138         client->ps.stats[STAT_MAX_HEALTH] = client->pers.maxHealth;
02139 
02140 /*      NOTE: all client side now
02141 
02142         // team
02143         switch( team ) {
02144         case TEAM_RED:
02145                 ForceClientSkin(client, model, "red");
02146 //              ForceClientSkin(client, headModel, "red");
02147                 break;
02148         case TEAM_BLUE:
02149                 ForceClientSkin(client, model, "blue");
02150 //              ForceClientSkin(client, headModel, "blue");
02151                 break;
02152         }
02153         // don't ever use a default skin in teamplay, it would just waste memory
02154         // however bots will always join a team but they spawn in as spectator
02155         if ( g_gametype.integer >= GT_TEAM && team == TEAM_SPECTATOR) {
02156                 ForceClientSkin(client, model, "red");
02157 //              ForceClientSkin(client, headModel, "red");
02158         }
02159 */
02160 
02161         if (g_gametype.integer >= GT_TEAM) {
02162                 client->pers.teamInfo = qtrue;
02163         } else {
02164                 s = Info_ValueForKey( userinfo, "teamoverlay" );
02165                 if ( ! *s || atoi( s ) != 0 ) {
02166                         client->pers.teamInfo = qtrue;
02167                 } else {
02168                         client->pers.teamInfo = qfalse;
02169                 }
02170         }
02171         /*
02172         s = Info_ValueForKey( userinfo, "cg_pmove_fixed" );
02173         if ( !*s || atoi( s ) == 0 ) {
02174                 client->pers.pmoveFixed = qfalse;
02175         }
02176         else {
02177                 client->pers.pmoveFixed = qtrue;
02178         }
02179         */
02180 
02181         // team task (0 = none, 1 = offence, 2 = defence)
02182         teamTask = atoi(Info_ValueForKey(userinfo, "teamtask"));
02183         // team Leader (1 = leader, 0 is normal player)
02184         teamLeader = client->sess.teamLeader;
02185 
02186         // colors
02187         strcpy(c1, Info_ValueForKey( userinfo, "color1" ));
02188         strcpy(c2, Info_ValueForKey( userinfo, "color2" ));
02189 
02190 //      strcpy(redTeam, Info_ValueForKey( userinfo, "g_redteam" ));
02191 //      strcpy(blueTeam, Info_ValueForKey( userinfo, "g_blueteam" ));
02192 
02193         // send over a subset of the userinfo keys so other clients can
02194         // print scoreboards, display models, and play custom sounds
02195         if ( ent->r.svFlags & SVF_BOT ) {
02196                 s = va("n\\%s\\t\\%i\\model\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\skill\\%s\\tt\\%d\\tl\\%d\\siegeclass\\%s\\st\\%s\\st2\\%s\\dt\\%i\\sdt\\%i",
02197                         client->pers.netname, team, model,  c1, c2, 
02198                         client->pers.maxHealth, client->sess.wins, client->sess.losses,
02199                         Info_ValueForKey( userinfo, "skill" ), teamTask, teamLeader, className, saberName, saber2Name, client->sess.duelTeam, client->sess.siegeDesiredTeam );
02200         } else {
02201                 if (g_gametype.integer == GT_SIEGE)
02202                 { //more crap to send
02203                         s = va("n\\%s\\t\\%i\\model\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\tt\\%d\\tl\\%d\\siegeclass\\%s\\st\\%s\\st2\\%s\\dt\\%i\\sdt\\%i",
02204                                 client->pers.netname, client->sess.sessionTeam, model, c1, c2, 
02205                                 client->pers.maxHealth, client->sess.wins, client->sess.losses, teamTask, teamLeader, className, saberName, saber2Name, client->sess.duelTeam, client->sess.siegeDesiredTeam);
02206                 }
02207                 else
02208                 {
02209                         s = va("n\\%s\\t\\%i\\model\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\tt\\%d\\tl\\%d\\st\\%s\\st2\\%s\\dt\\%i",
02210                                 client->pers.netname, client->sess.sessionTeam, model, c1, c2, 
02211                                 client->pers.maxHealth, client->sess.wins, client->sess.losses, teamTask, teamLeader, saberName, saber2Name, client->sess.duelTeam);
02212                 }
02213         }
02214 
02215         trap_SetConfigstring( CS_PLAYERS+clientNum, s );
02216 
02217         if (modelChanged) //only going to be true for allowable server-side custom skeleton cases
02218         { //update the server g2 instance if appropriate
02219                 char *modelname = Info_ValueForKey (userinfo, "model");
02220                 SetupGameGhoul2Model(ent, modelname, NULL);
02221 
02222                 if (ent->ghoul2 && ent->client)
02223                 {
02224                         ent->client->renderInfo.lastG2 = NULL; //update the renderinfo bolts next update.
02225                 }
02226 
02227                 client->torsoAnimExecute = client->legsAnimExecute = -1;
02228                 client->torsoLastFlip = client->legsLastFlip = qfalse;
02229         }
02230 
02231         if (g_logClientInfo.integer)
02232         {
02233                 G_LogPrintf( "ClientUserinfoChanged: %i %s\n", clientNum, s );
02234         }
02235 }

void Cmd_NPC_f gentity_t ent  ) 
 

Definition at line 4177 of file NPC_spawn.c.

References gentity_s::client, Com_Printf(), ENTITYNUM_WORLD, FOFS, g_entities, G_Find(), gentity_t, NPC_Kill_f(), NPC_PrintScore(), NPC_Spawn_f(), NULL, Q_stricmp(), qfalse, qtrue, showBBoxes, and trap_Argv().

Referenced by ClientCommand().

04178 {
04179         char    cmd[1024];
04180 
04181         trap_Argv( 1, cmd, 1024 );
04182 
04183         if ( !cmd[0] ) 
04184         {
04185                 Com_Printf( "Valid NPC commands are:\n" );
04186                 Com_Printf( " spawn [NPC type (from NCPCs.cfg)]\n" );
04187                 Com_Printf( " kill [NPC targetname] or [all(kills all NPCs)] or 'team [teamname]'\n" );
04188                 Com_Printf( " showbounds (draws exact bounding boxes of NPCs)\n" );
04189                 Com_Printf( " score [NPC targetname] (prints number of kills per NPC)\n" );
04190         }
04191         else if ( Q_stricmp( cmd, "spawn" ) == 0 )
04192         {
04193                 NPC_Spawn_f( ent );
04194         }
04195         else if ( Q_stricmp( cmd, "kill" ) == 0 ) 
04196         {
04197                 NPC_Kill_f();
04198         }
04199         else if ( Q_stricmp( cmd, "showbounds" ) == 0 )
04200         {//Toggle on and off
04201                 showBBoxes = showBBoxes ? qfalse : qtrue;
04202         }
04203         else if ( Q_stricmp ( cmd, "score" ) == 0 )
04204         {
04205                 char            cmd2[1024];
04206                 gentity_t *ent = NULL;
04207 
04208                 trap_Argv(2, cmd2, 1024);
04209 
04210                 if ( !cmd2[0] )
04211                 {//Show the score for all NPCs
04212                         int i;
04213 
04214                         Com_Printf( "SCORE LIST:\n" );
04215                         for ( i = 0; i < ENTITYNUM_WORLD; i++ )
04216                         {
04217                                 ent = &g_entities[i];
04218                                 if ( !ent || !ent->client )
04219                                 {
04220                                         continue;
04221                                 }
04222                                 NPC_PrintScore( ent );
04223                         }
04224                 }
04225                 else
04226                 {
04227                         if ( (ent = G_Find( NULL, FOFS(targetname), cmd2 )) != NULL && ent->client )
04228                         {
04229                                 NPC_PrintScore( ent );
04230                         }
04231                         else
04232                         {
04233                                 Com_Printf( "ERROR: NPC score - no such NPC %s\n", cmd2 );
04234                         }
04235                 }
04236         }
04237 }

void CrystalCratePain gentity_t self,
gentity_t attacker,
int  damage
 

void emplaced_gun_pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 4781 of file g_weapon.c.

References BSET_PAIN, G_ActivateBehavior(), gentity_t, gentity_s::health, entityState_s::health, and gentity_s::s.

Referenced by SP_emplaced_gun().

04782 {
04783         self->s.health = self->health;
04784 
04785         if ( self->health <= 0 )
04786         {
04787                 //death effect.. for now taken care of on cgame
04788         }
04789         else
04790         {
04791                 //if we have a pain behavior set then use it I guess
04792                 G_ActivateBehavior( self, BSET_PAIN );
04793         }
04794 }

void func_usable_pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 3094 of file g_mover.c.

References gentity_t, and GlobalUse().

Referenced by SP_func_usable().

03095 {
03096         GlobalUse(self, attacker, attacker);
03097 }

void funcBBrushPain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 2518 of file g_mover.c.

References entityShared_t::absmax, entityShared_t::absmin, gentity_s::activator, BSET_PAIN, ceil(), gentity_s::client, entityShared_t::currentOrigin, G_ActivateBehavior(), G_Chunks(), G_UseTargets2(), gentity_t, gentity_s::inuse, level, gentity_s::mass, MAT_DRK_STONE, MAT_GREY_STONE, MAT_LT_STONE, MAT_SNOWY_ROCK, gentity_s::material, NULL, entityState_s::number, gentity_s::pain, gentity_s::painDebounceTime, gentity_s::paintarget, Q_irand(), gentity_s::r, gentity_s::radius, gentity_s::s, level_locals_t::time, vec3_t, VectorAdd, VectorMA, VectorNormalize(), VectorScale, VectorSet, VectorSubtract, and gentity_s::wait.

Referenced by SP_func_breakable().

02519 {
02520         if ( self->painDebounceTime > level.time )
02521         {
02522                 return;
02523         }
02524 
02525         if ( self->paintarget && self->paintarget[0] )
02526         {
02527                 if (!self->activator)
02528                 {
02529                         if (attacker && attacker->inuse && attacker->client)
02530                         {
02531                                 G_UseTargets2 (self, attacker, self->paintarget);
02532                         }
02533                 }
02534                 else
02535                 {
02536                         G_UseTargets2 (self, self->activator, self->paintarget);
02537                 }
02538         }
02539 
02540         G_ActivateBehavior( self, BSET_PAIN );
02541 
02542         if ( self->material == MAT_DRK_STONE
02543                 || self->material == MAT_LT_STONE
02544                 || self->material == MAT_GREY_STONE 
02545                 || self->material == MAT_SNOWY_ROCK )
02546         {
02547                 vec3_t  org, dir;
02548                 float   scale;
02549                 int             numChunks;
02550                 VectorSubtract( self->r.absmax, self->r.absmin, org );// size
02551                 // This formula really has no logical basis other than the fact that it seemed to be the closest to yielding the results that I wanted.
02552                 // Volume is length * width * height...then break that volume down based on how many chunks we have
02553                 scale = VectorLength( org ) / 100.0f;
02554                 VectorMA( self->r.absmin, 0.5, org, org );
02555                 VectorAdd( self->r.absmin,self->r.absmax, org );
02556                 VectorScale( org, 0.5f, org );
02557                 if ( attacker != NULL && attacker->client )
02558                 {
02559                         VectorSubtract( attacker->r.currentOrigin, org, dir );
02560                         VectorNormalize( dir );
02561                 }
02562                 else
02563                 {
02564                         VectorSet( dir, 0, 0, 1 );
02565                 } 
02566                 numChunks = Q_irand( 1, 3 );
02567                 if ( self->radius > 0.0f )
02568                 {
02569                         // designer wants to scale number of chunks, helpful because the above scale code is far from perfect
02570                         //      I do this after the scale calculation because it seems that the chunk size generally seems to be very close, it's just the number of chunks is a bit weak
02571                         numChunks = ceil(numChunks*self->radius);
02572                 }
02573                 G_Chunks( self->s.number, org, dir, self->r.absmin, self->r.absmax, 300, numChunks, self->material, 0, (scale*self->mass) );
02574         }
02575 
02576         if ( self->wait == -1 )
02577         {
02578                 self->pain = 0;
02579                 return;
02580         }
02581 
02582         self->painDebounceTime = level.time + self->wait;
02583 }

qboolean G_CheckInSolid gentity_t self,
qboolean  fix
 

Definition at line 1965 of file g_utils.c.

References trace_t::allsolid, gentity_s::clipmask, entityShared_t::currentOrigin, trace_t::endpos, trace_t::fraction, G_SetOrigin(), gentity_t, entityShared_t::maxs, entityShared_t::mins, entityState_s::number, qboolean, qfalse, qtrue, gentity_s::r, gentity_s::s, trace_t::startsolid, trap_LinkEntity(), trap_Trace(), vec3_t, and VectorCopy.

Referenced by NPC_Begin(), SP_point_combat(), SP_waypoint(), SP_waypoint_navgoal(), SP_waypoint_navgoal_1(), SP_waypoint_navgoal_2(), SP_waypoint_navgoal_4(), SP_waypoint_navgoal_8(), and SP_waypoint_small().

01966 {
01967         trace_t trace;
01968         vec3_t  end, mins;
01969 
01970         VectorCopy(self->r.currentOrigin, end);
01971         end[2] += self->r.mins[2];
01972         VectorCopy(self->r.mins, mins);
01973         mins[2] = 0;
01974 
01975         trap_Trace(&trace, self->r.currentOrigin, mins, self->r.maxs, end, self->s.number, self->clipmask);
01976         if(trace.allsolid || trace.startsolid)
01977         {
01978                 return qtrue;
01979         }
01980         
01981         if(trace.fraction < 1.0)
01982         {
01983                 if(fix)
01984                 {//Put them at end of trace and check again
01985                         vec3_t  neworg;
01986 
01987                         VectorCopy(trace.endpos, neworg);
01988                         neworg[2] -= self->r.mins[2];
01989                         G_SetOrigin(self, neworg);
01990                         trap_LinkEntity(self);
01991 
01992                         return G_CheckInSolid(self, qfalse);
01993                 }
01994                 else
01995                 {
01996                         return qtrue;
01997                 }
01998         }
01999                 
02000         return qfalse;
02001 }

void G_CreateAnimalNPC Vehicle_t **  pVeh,
const char *  strAnimalType
 

Definition at line 904 of file AnimalNPC.c.

References BG_Alloc(), BG_VehicleGetIndex(), G_AllocateVehicleObject(), g_vehicleInfo, memset(), qtrue, and Vehicle_t.

Referenced by CG_G2AnimEntModelLoad(), and NPC_Spawn_Do().

00905 {
00906         // Allocate the Vehicle.
00907 #ifdef _JK2MP
00908 #ifdef QAGAME
00909         //these will remain on entities on the client once allocated because the pointer is
00910         //never stomped. on the server, however, when an ent is freed, the entity struct is
00911         //memset to 0, so this memory would be lost..
00912     G_AllocateVehicleObject(pVeh);
00913 #else
00914         if (!*pVeh)
00915         { //only allocate a new one if we really have to
00916                 (*pVeh) = (Vehicle_t *) BG_Alloc( sizeof(Vehicle_t) );
00917         }
00918 #endif
00919         memset(*pVeh, 0, sizeof(Vehicle_t));
00920         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strAnimalType )];
00921 #else
00922         (*pVeh) = (Vehicle_t *) gi.Malloc( sizeof(Vehicle_t), TAG_G_ALLOC, qtrue );
00923         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strAnimalType )];
00924 #endif
00925 }

void G_CreateFighterNPC Vehicle_t **  pVeh,
const char *  strType
 

Definition at line 1998 of file FighterNPC.c.

References BG_Alloc(), BG_VehicleGetIndex(), G_AllocateVehicleObject(), g_vehicleInfo, memset(), qtrue, and Vehicle_t.

Referenced by CG_G2AnimEntModelLoad(), and NPC_Spawn_Do().

01999 {
02000         // Allocate the Vehicle.
02001 #ifdef _JK2MP
02002 #ifdef QAGAME
02003         //these will remain on entities on the client once allocated because the pointer is
02004         //never stomped. on the server, however, when an ent is freed, the entity struct is
02005         //memset to 0, so this memory would be lost..
02006     G_AllocateVehicleObject(pVeh);
02007 #else
02008         if (!*pVeh)
02009         { //only allocate a new one if we really have to
02010                 (*pVeh) = (Vehicle_t *) BG_Alloc( sizeof(Vehicle_t) );
02011         }
02012 #endif
02013         memset(*pVeh, 0, sizeof(Vehicle_t));
02014 #else
02015         (*pVeh) = (Vehicle_t *) gi.Malloc( sizeof(Vehicle_t), TAG_G_ALLOC, qtrue );
02016 #endif
02017         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strType )];
02018 }

void G_CreateG2AttachedWeaponModel gentity_t ent,
const char *  weaponModel,
int  boltNum,
int  weaponNum
 

void G_CreateSpeederNPC Vehicle_t **  pVeh,
const char *  strType
 

Definition at line 1092 of file SpeederNPC.c.

References BG_Alloc(), BG_VehicleGetIndex(), G_AllocateVehicleObject(), g_vehicleInfo, memset(), qtrue, and Vehicle_t.

Referenced by CG_G2AnimEntModelLoad(), and NPC_Spawn_Do().

01093 {
01094 #ifdef _JK2MP
01095 #ifdef QAGAME
01096         //these will remain on entities on the client once allocated because the pointer is
01097         //never stomped. on the server, however, when an ent is freed, the entity struct is
01098         //memset to 0, so this memory would be lost..
01099     G_AllocateVehicleObject(pVeh);
01100 #else
01101         if (!*pVeh)
01102         { //only allocate a new one if we really have to
01103                 (*pVeh) = (Vehicle_t *) BG_Alloc( sizeof(Vehicle_t) );
01104         }
01105 #endif
01106         memset(*pVeh, 0, sizeof(Vehicle_t));
01107         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strType )];
01108 #else
01109         // Allocate the Vehicle.
01110         (*pVeh) = (Vehicle_t *) gi.Malloc( sizeof(Vehicle_t), TAG_G_ALLOC, qtrue );
01111         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strType )];
01112 #endif
01113 }

void G_CreateWalkerNPC Vehicle_t **  pVeh,
const char *  strAnimalType
 

Definition at line 594 of file WalkerNPC.c.

References BG_Alloc(), BG_VehicleGetIndex(), G_AllocateVehicleObject(), g_vehicleInfo, memset(), qtrue, and Vehicle_t.

Referenced by CG_G2AnimEntModelLoad(), and NPC_Spawn_Do().

00595 {
00596         // Allocate the Vehicle.
00597 #ifdef _JK2MP
00598 #ifdef QAGAME
00599         //these will remain on entities on the client once allocated because the pointer is
00600         //never stomped. on the server, however, when an ent is freed, the entity struct is
00601         //memset to 0, so this memory would be lost..
00602     G_AllocateVehicleObject(pVeh);
00603 #else
00604         if (!*pVeh)
00605         { //only allocate a new one if we really have to
00606                 (*pVeh) = (Vehicle_t *) BG_Alloc( sizeof(Vehicle_t) );
00607         }
00608 #endif
00609         memset(*pVeh, 0, sizeof(Vehicle_t));
00610         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strAnimalType )];
00611 #else
00612         (*pVeh) = (Vehicle_t *) gi.Malloc( sizeof(Vehicle_t), TAG_G_ALLOC, qtrue );
00613         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strAnimalType )];
00614 #endif
00615 }

void G_DebugPrint int  level,
const char *  format,
... 
 

Definition at line 275 of file g_ICARUScb.c.

00276 {
00277         va_list         argptr;
00278         char            text[1024];
00279 
00280         //Don't print messages they don't want to see
00281         //if ( g_ICARUSDebug->integer < level )
00282         if (g_developer.integer != 2)
00283                 return;
00284 
00285         va_start (argptr, format);
00286         vsprintf (text, format, argptr);
00287         va_end (argptr);
00288 
00289         //Add the color formatting
00290         switch ( level )
00291         {
00292                 case WL_ERROR:
00293                         Com_Printf ( S_COLOR_RED"ERROR: %s", text );
00294                         break;
00295                 
00296                 case WL_WARNING:
00297                         Com_Printf ( S_COLOR_YELLOW"WARNING: %s", text );
00298                         break;
00299                 
00300                 case WL_DEBUG:
00301                         {
00302                                 int             entNum;
00303                                 char    *buffer;
00304 
00305                                 sscanf( text, "%d", &entNum );
00306 
00307                                 //if ( ( ICARUS_entFilter >= 0 ) && ( ICARUS_entFilter != entNum ) )
00308                                 //      return;
00309 
00310                                 buffer = (char *) text;
00311                                 buffer += 5;
00312 
00313                                 if ( ( entNum < 0 ) || ( entNum > MAX_GENTITIES ) )
00314                                         entNum = 0;
00315 
00316                                 Com_Printf ( S_COLOR_BLUE"DEBUG: %s(%d): %s\n", g_entities[entNum].script_targetname, entNum, buffer );
00317                                 break;
00318                         }
00319                 default:
00320                 case WL_VERBOSE:
00321                         Com_Printf ( S_COLOR_GREEN"INFO: %s", text );
00322                         break;
00323         }
00324 }

void G_VehicleSpawn gentity_t self  ) 
 

Definition at line 183 of file g_vehicles.c.

References entityState_s::angles, gNPC_t::behaviorState, BS_CINEMATIC, gentity_s::count, gentity_s::damage, gentity_t, level, Vehicle_s::m_iPilotTime, gentity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, gentity_s::NPC, NPC_Spawn_Do(), entityState_s::origin, qtrue, gentity_s::s, gentity_s::spawnflags, gentity_s::speed, level_locals_t::time, trap_LinkEntity(), vehicleInfo_t::type, VectorCopy, VH_ANIMAL, and YAW.

Referenced by NPC_VehicleSpawnUse(), and SP_NPC_Vehicle().

00184 {
00185         float yaw;
00186         gentity_t *vehEnt;
00187 
00188         VectorCopy( self->currentOrigin, self->s.origin );
00189 
00190 #ifdef _JK2MP
00191         trap_LinkEntity( self );
00192 #else
00193         gi.linkentity( self );
00194 #endif
00195 
00196         if ( !self->count )
00197         {
00198                 self->count = 1;
00199         }
00200 
00201         //save this because self gets removed in next func
00202         yaw = self->s.angles[YAW];
00203         
00204 #ifdef _JK2MP
00205         vehEnt = NPC_Spawn_Do( self );
00206 #else
00207         vehEnt = NPC_Spawn_Do( self, qtrue );
00208 #endif
00209         
00210         if ( !vehEnt )
00211         {
00212                 return;//return NULL;
00213         }
00214         
00215         vehEnt->s.angles[YAW] = yaw;
00216         if ( vehEnt->m_pVehicle->m_pVehicleInfo->type != VH_ANIMAL )
00217         {
00218                 vehEnt->NPC->behaviorState = BS_CINEMATIC;
00219         }
00220 
00221 #ifdef _JK2MP //special check in case someone disconnects/dies while boarding
00222         if (vehEnt->spawnflags & 1)
00223         { //die without pilot
00224                 if (!vehEnt->damage)
00225                 { //default 10 sec
00226                         vehEnt->damage = 10000;
00227                 }
00228                 if (!vehEnt->speed)
00229                 { //default 512 units
00230                         vehEnt->speed = 512.0f;
00231                 }
00232                 vehEnt->m_pVehicle->m_iPilotTime = level.time + vehEnt->damage;
00233         }
00234 #else
00235         if (vehEnt->spawnflags & 1)
00236         { //die without pilot
00237                 vehEnt->m_pVehicle->m_iPilotTime = level.time + vehEnt->endFrame;
00238         }
00239 #endif
00240         //return vehEnt;
00241 }

void GasBurst gentity_t self,
gentity_t attacker,
int  damage
 

void Jedi_ClearTimers gentity_t ent  ) 
 

Definition at line 110 of file NPC_AI_Jedi.c.

References gentity_t, and TIMER_Set().

Referenced by NPC_SetMiscDefaultData().

00111 {
00112         TIMER_Set( ent, "roamTime", 0 );
00113         TIMER_Set( ent, "chatter", 0 );
00114         TIMER_Set( ent, "strafeLeft", 0 );
00115         TIMER_Set( ent, "strafeRight", 0 );
00116         TIMER_Set( ent, "noStrafe", 0 );
00117         TIMER_Set( ent, "walking", 0 );
00118         TIMER_Set( ent, "taunting", 0 );
00119         TIMER_Set( ent, "parryTime", 0 );
00120         TIMER_Set( ent, "parryReCalcTime", 0 );
00121         TIMER_Set( ent, "forceJumpChasing", 0 );
00122         TIMER_Set( ent, "jumpChaseDebounce", 0 );
00123         TIMER_Set( ent, "moveforward", 0 );
00124         TIMER_Set( ent, "moveback", 0 );
00125         TIMER_Set( ent, "movenone", 0 );
00126         TIMER_Set( ent, "moveright", 0 );
00127         TIMER_Set( ent, "moveleft", 0 );
00128         TIMER_Set( ent, "movecenter", 0 );
00129         TIMER_Set( ent, "saberLevelDebounce", 0 );
00130         TIMER_Set( ent, "noRetreat", 0 );
00131         TIMER_Set( ent, "holdLightning", 0 );
00132         TIMER_Set( ent, "gripping", 0 );
00133         TIMER_Set( ent, "draining", 0 );
00134         TIMER_Set( ent, "noturn", 0 );
00135 }

void Jedi_Cloak gentity_t self  ) 
 

Definition at line 799 of file NPC_AI_Jedi.c.

References CHAN_ITEM, gentity_s::client, FL_NOTARGET, gentity_s::flags, G_Sound(), G_SoundIndex(), gentity_t, playerState_s::powerups, gclient_s::ps, PW_CLOAKED, and Q3_INFINITE.

Referenced by ClientThink_real(), ItemUse_UseCloak(), Jedi_CheckCloak(), and NPC_SetMiscDefaultData().

00800 {
00801         if ( self )
00802         {
00803                 self->flags |= FL_NOTARGET;
00804                 if ( self->client )
00805                 {
00806                         if ( !self->client->ps.powerups[PW_CLOAKED] )
00807                         {//cloak
00808                                 self->client->ps.powerups[PW_CLOAKED] = Q3_INFINITE;
00809 
00810                                 //FIXME: debounce attacks?
00811                                 //FIXME: temp sound
00812                                 G_Sound( self, CHAN_ITEM, G_SoundIndex("sound/chars/shadowtrooper/cloak.wav") );
00813                         }
00814                 }
00815         }
00816 }

void misc_model_breakable_pain gentity_t self,
gentity_t attacker,
int  damage
 

gNPC_t* New_NPC_t int  entNum  ) 
 

Definition at line 1272 of file NPC_spawn.c.

References BG_Alloc(), gNPCPtrs, and memset().

Referenced by NPC_Spawn_Do().

01273 {
01274         gNPC_t *ptr;
01275 
01276         if (!gNPCPtrs[entNum])
01277         {
01278                 gNPCPtrs[entNum] = (gNPC_t *)BG_Alloc (sizeof(gNPC_t));
01279         }
01280                 
01281         ptr = gNPCPtrs[entNum];
01282 
01283         if (ptr)
01284         {
01285                 // clear it...
01286                 //
01287                 memset(ptr, 0, sizeof( *ptr ) );
01288         }
01289 
01290         return ptr;
01291 }

void NPC_ATST_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 119 of file NPC_AI_Atst.c.

References G_ATSTCheckPain(), gentity_t, and NPC_Pain().

Referenced by NPC_PainFunc(), and NPC_SetMiscDefaultData().

00120 {
00121         G_ATSTCheckPain( self, attacker, damage );
00122         NPC_Pain( self, attacker, damage );
00123 }

void NPC_ATST_Precache void   ) 
 

Definition at line 20 of file NPC_AI_Atst.c.

References BG_FindItemForWeapon(), G_EffectIndex(), G_SoundIndex(), RegisterItem(), WP_BOWCASTER, and WP_ROCKET_LAUNCHER.

Referenced by NPC_SpawnType(), and SP_NPC_Droid_ATST().

00021 {
00022         G_SoundIndex( "sound/chars/atst/atst_damaged1" );
00023         G_SoundIndex( "sound/chars/atst/atst_damaged2" );
00024 
00025 //      RegisterItem( BG_FindItemForWeapon( WP_ATST_MAIN ));    //precache the weapon
00026         //rwwFIXMEFIXME: add this weapon
00027         RegisterItem( BG_FindItemForWeapon( WP_BOWCASTER ));    //precache the weapon
00028         RegisterItem( BG_FindItemForWeapon( WP_ROCKET_LAUNCHER ));      //precache the weapon
00029 
00030         G_EffectIndex( "env/med_explode2" );
00031 //      G_EffectIndex( "smaller_chunks" );
00032         G_EffectIndex( "blaster/smoke_bolton" );
00033         G_EffectIndex( "explosions/droidexplosion1" );
00034 }

void NPC_Begin gentity_t ent  ) 
 

Definition at line 862 of file NPC_spawn.c.

References gentity_s::activator, gNPC_t::aiFlags, gNPCstats_e::aim, gclient_s::airOutTime, playerState_s::ammo, usercmd_s::angles, entityState_s::angles, gNPC_t::behaviorState, bgEntity_t, BOTH_STAND1, BS_CINEMATIC, BSET_SPAWN, ChangeWeapon(), CLASS_GONK, CLASS_IMPWORKER, CLASS_JEDI, CLASS_MOUSE, CLASS_PROTOCOL, CLASS_R2D2, CLASS_R5D2, CLASS_REBORN, CLASS_SEEKER, CLASS_SHADOWTROOPER, CLASS_STORMTROOPER, CLASS_SWAMPTROOPER, CLASS_VEHICLE, gentity_s::classname, gentity_s::client, client, playerState_s::clientNum, ClientThink(), gentity_s::clipmask, clientPersistant_t::cmd, entityShared_t::contents, CONTENTS_BODY, gNPC_t::currentAmmo, entityShared_t::currentAngles, entityShared_t::currentOrigin, gNPC_t::desiredPitch, gNPC_t::desiredYaw, gentity_s::die, vehicleInfo_t::droidNPC, EF_NODRAW, entityState_s::eFlags, gentity_s::enemy, ENTITYNUM_NONE, ET_NPC, entityState_s::eType, renderInfo_s::eyePoint, FL_NOTARGET, FL_UNDYING, gentity_s::flags, FRAMETIME, G_ActivateBehavior(), G_CheckInSolid(), G_DebugPrint(), g_entities, G_FreeEntity(), g_gametype, g_inactivity, G_KillBox(), G_ScaleNetHealth(), G_SetAngles(), G_SetOrigin(), g_spskill, G_UseTargets(), G_UseTargets2(), gclient_t, gentity_t, playerState_s::groundEntityNum, entityState_s::groundEntityNum, GT_SIEGE, gNPCstats_e::health, gentity_s::health, gNPC_t::homeWp, gclient_s::inactivityTime, vmCvar_t::integer, gentity_s::inuse, gNPC_t::lastClearOrigin, gclient_s::latched_buttons, level, renderInfo_s::lookTarget, Vehicle_s::m_iDroidUnitTag, playerState_s::m_iVehicleNum, entityState_s::m_iVehicleNum, Vehicle_s::m_pDroidUnit, gentity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, MASK_NPCSOLID, gentity_s::mass, gentity_s::maxHealth, clientPersistant_t::maxHealth, memset(), gentity_s::model2, gentity_s::nextthink, gentity_s::NPC, NPC_Begin(), NPC_ChangeWeapon(), entityState_s::NPC_class, gclient_s::NPC_class, NPC_ClearGoal(), NPC_PainFunc(), NPC_SetAnim(), NPC_SetFX_SpawnStates(), NPC_SetMiscDefaultData(), NPC_SetWeapons(), NPC_SpawnEffect(), NPC_SpawnType(), NPC_SpotWouldTelefrag(), NPC_Think(), NPC_TouchFunc(), gentity_s::NPC_type, NPC_Use(), NPCAI_MATCHPLAYERWEAPON, NPCInfo, NPCTEAM_ENEMY, NULL, entityState_s::number, entityState_s::origin, playerState_s::origin, entityState_s::owner, entityShared_t::ownerNum, gentity_s::pain, gclient_s::pers, PERS_SPAWN_COUNT, PERS_TEAM, playerState_s::persistant, playerState_s::ping, PITCH, player_die(), gclient_s::playerTeam, playerState_s::pm_flags, playerState_s::pm_time, PMF_RESPAWNED, PMF_TIME_KNOCKBACK, gclient_s::ps, Q_irand(), Q_stricmp(), qfalse, qtrue, gentity_s::r, gNPCstats_e::reactions, gclient_s::renderInfo, gclient_s::respawnTime, playerState_s::rocketLockIndex, playerState_s::rocketLockTime, gentity_s::s, SETANIM_BOTH, SETANIM_FLAG_NORMAL, SetClientViewAngle(), SetNPCGlobals(), SFB_CINEMATIC, SFB_NOTSOLID, SFB_STARTINSOLID, gNPC_t::shotTime, entityState_s::shouldtarget, gentity_s::spawnflags, STAT_HEALTH, STAT_MAX_HEALTH, gNPC_t::stats, playerState_s::stats, gentity_s::takedamage, gentity_s::target3, gentity_s::targetname, gentity_s::think, level_locals_t::time, gNPC_t::timeOfDeath, gentity_s::touch, trap_ICARUS_InitEnt(), trap_ICARUS_MaintainTaskManager(), trap_LinkEntity(), ucmd, gentity_s::use, usercmd_t, vmCvar_t::value, vec3_t, VectorClear, VectorCopy, gentity_s::wait, gentity_s::waterlevel, gentity_s::watertype, gentity_s::waypoint, WAYPOINT_NONE, playerState_s::weapon, WEAPON_IDLE, weaponData, playerState_s::weaponstate, WL_DEBUG, WP_NONE, YAW, and gNPCstats_e::yawSpeed.

Referenced by NPC_Begin(), and NPC_Spawn_Do().

00863 {
00864         vec3_t  spawn_origin, spawn_angles;
00865         gclient_t       *client;
00866         usercmd_t       ucmd;
00867         gentity_t       *spawnPoint = NULL;
00868 
00869         memset( &ucmd, 0, sizeof( ucmd ) );
00870 
00871         if ( !(ent->spawnflags & SFB_NOTSOLID) )
00872         {//No NPCs should telefrag
00873                 if (NPC_SpotWouldTelefrag(ent))
00874                 {
00875                         if ( ent->wait < 0 )
00876                         {//remove yourself
00877                                 G_DebugPrint( WL_DEBUG, "NPC %s could not spawn, firing target3 (%s) and removing self\n", ent->targetname, ent->target3 );
00878                                 //Fire off our target3
00879                                 G_UseTargets2( ent, ent, ent->target3 );
00880 
00881                                 //Kill us
00882                                 ent->think = G_FreeEntity;
00883                                 ent->nextthink = level.time + 100;
00884                         }
00885                         else
00886                         {
00887                                 G_DebugPrint( WL_DEBUG, "NPC %s could not spawn, waiting %4.2 secs to try again\n", ent->targetname, ent->wait/1000.0f );
00888                                 ent->think = NPC_Begin;
00889                                 ent->nextthink = level.time + ent->wait;//try again in half a second
00890                         }
00891                         return;
00892                 }
00893         }
00894         //Spawn effect
00895         NPC_SpawnEffect( ent );
00896 
00897         VectorCopy( ent->client->ps.origin, spawn_origin);
00898         VectorCopy( ent->s.angles, spawn_angles);
00899         spawn_angles[YAW] = ent->NPC->desiredYaw;
00900 
00901         client = ent->client;
00902 
00903         // increment the spawncount so the client will detect the respawn
00904         client->ps.persistant[PERS_SPAWN_COUNT]++;
00905 
00906         client->airOutTime = level.time + 12000;
00907 
00908         client->ps.clientNum = ent->s.number;
00909         // clear entity values
00910 
00911         if ( ent->health )      // Was health supplied in map
00912         {
00913                 client->pers.maxHealth = client->ps.stats[STAT_MAX_HEALTH] = ent->health;
00914         }
00915         else if ( ent->NPC->stats.health )      // Was health supplied in NPC.cfg?
00916         {
00917                 
00918                 if ( ent->client->NPC_class != CLASS_REBORN
00919                         && ent->client->NPC_class != CLASS_SHADOWTROOPER 
00920                         //&& ent->client->NPC_class != CLASS_TAVION
00921                         //&& ent->client->NPC_class != CLASS_DESANN 
00922                         && ent->client->NPC_class != CLASS_JEDI )
00923                 {// up everyone except jedi
00924                         ent->NPC->stats.health += ent->NPC->stats.health/4 * g_spskill.integer; // 100% on easy, 125% on medium, 150% on hard
00925                 }
00926                 
00927                 client->pers.maxHealth = client->ps.stats[STAT_MAX_HEALTH] = ent->NPC->stats.health;
00928         }
00929         else
00930         {
00931                 client->pers.maxHealth = client->ps.stats[STAT_MAX_HEALTH] = 100;
00932         }
00933 
00934         if ( !Q_stricmp( "rodian", ent->NPC_type ) )
00935         {//sniper
00936                 //NOTE: this will get overridden by any aim settings in their spawnscripts
00937                 switch ( g_spskill.integer )
00938                 {
00939                 case 0:
00940                         ent->NPC->stats.aim = 1;
00941                         break;
00942                 case 1:
00943                         ent->NPC->stats.aim = Q_irand( 2, 3 );
00944                         break;
00945                 case 2:
00946                         ent->NPC->stats.aim = Q_irand( 3, 4 );
00947                         break;
00948                 }
00949         }
00950         else if ( ent->client->NPC_class == CLASS_STORMTROOPER
00951                 || ent->client->NPC_class == CLASS_SWAMPTROOPER
00952                 || ent->client->NPC_class == CLASS_IMPWORKER
00953                 || !Q_stricmp( "rodian2", ent->NPC_type ) )
00954         {//tweak yawspeed for these NPCs based on difficulty
00955                 switch ( g_spskill.integer )
00956                 {
00957                 case 0:
00958                         ent->NPC->stats.yawSpeed *= 0.75f;
00959                         if ( ent->client->NPC_class == CLASS_IMPWORKER )
00960                         {
00961                                 ent->NPC->stats.aim -= Q_irand( 3, 6 );
00962                         }
00963                         break;
00964                 case 1:
00965                         if ( ent->client->NPC_class == CLASS_IMPWORKER )
00966                         {
00967                                 ent->NPC->stats.aim -= Q_irand( 2, 4 );
00968                         }
00969                         break;
00970                 case 2:
00971                         ent->NPC->stats.yawSpeed *= 1.5f;
00972                         if ( ent->client->NPC_class == CLASS_IMPWORKER )
00973                         {
00974                                 ent->NPC->stats.aim -= Q_irand( 0, 2 );
00975                         }
00976                         break;
00977                 }
00978         }
00979         else if ( ent->client->NPC_class == CLASS_REBORN
00980                 || ent->client->NPC_class == CLASS_SHADOWTROOPER )
00981         {
00982                 switch ( g_spskill.integer )
00983                 {
00984                 case 1:
00985                         ent->NPC->stats.yawSpeed *= 1.25f;
00986                         break;
00987                 case 2:
00988                         ent->NPC->stats.yawSpeed *= 1.5f;
00989                         break;
00990                 }
00991         }
00992 
00993 
00994         ent->s.groundEntityNum = ENTITYNUM_NONE;
00995         ent->mass = 10;
00996         ent->takedamage = qtrue;
00997         ent->inuse = qtrue;
00998         ent->classname = "NPC";
00999 //      if ( ent->client->race == RACE_HOLOGRAM )
01000 //      {//can shoot through holograms, but not walk through them
01001 //              ent->contents = CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP|CONTENTS_ITEM;//contents_corspe to make them show up in ID and use traces
01002 //              ent->clipmask = MASK_NPCSOLID;
01003 //      } else
01004         if(!(ent->spawnflags & SFB_NOTSOLID))
01005         {
01006                 ent->r.contents = CONTENTS_BODY;
01007                 ent->clipmask = MASK_NPCSOLID;
01008         }
01009         else
01010         {
01011                 ent->r.contents = 0;
01012                 ent->clipmask = MASK_NPCSOLID&~CONTENTS_BODY;
01013         }
01014         /*
01015         if(!ent->client->moveType)//Static?
01016         {
01017                 ent->client->moveType = MT_RUNJUMP;
01018         }
01019         */
01020         //rwwFIXMEFIXME: movetype support
01021 
01022         ent->die = player_die;
01023         ent->waterlevel = 0;
01024         ent->watertype = 0;
01025         ent->client->ps.rocketLockIndex = ENTITYNUM_NONE;
01026         ent->client->ps.rocketLockTime = 0;
01027         
01028         //visible to player and NPCs
01029         if ( ent->client->NPC_class != CLASS_R2D2 &&
01030                 ent->client->NPC_class != CLASS_R5D2 &&
01031                 ent->client->NPC_class != CLASS_MOUSE &&
01032                 ent->client->NPC_class != CLASS_GONK &&
01033                 ent->client->NPC_class != CLASS_PROTOCOL )
01034         {
01035                 ent->flags &= ~FL_NOTARGET;
01036         }
01037         ent->s.eFlags &= ~EF_NODRAW;
01038 
01039         NPC_SetFX_SpawnStates( ent );
01040         
01041         //client->ps.friction = 6;
01042         //rwwFIXMEFIXME: per ent friction?
01043 
01044         if ( ent->client->ps.weapon == WP_NONE )
01045         {//not set by the NPCs.cfg
01046                 NPC_SetWeapons(ent);
01047         }
01048         //select the weapon
01049         ent->NPC->currentAmmo = ent->client->ps.ammo[weaponData[ent->client->ps.weapon].ammoIndex];
01050         ent->client->ps.weaponstate = WEAPON_IDLE;
01051         ChangeWeapon( ent, ent->client->ps.weapon );
01052 
01053         VectorCopy( spawn_origin, client->ps.origin );
01054 
01055         // the respawned flag will be cleared after the attack and jump keys come up
01056         client->ps.pm_flags |= PMF_RESPAWNED;
01057 
01058         // clear entity state values
01059         //ent->s.eType = ET_PLAYER;
01060         ent->s.eType = ET_NPC;
01061 //      ent->s.skinNum = ent - g_entities - 1;  // used as index to get custom models
01062 
01063         VectorCopy (spawn_origin, ent->s.origin);
01064 //      ent->s.origin[2] += 1;  // make sure off ground
01065 
01066         SetClientViewAngle( ent, spawn_angles );
01067         client->renderInfo.lookTarget = ENTITYNUM_NONE;
01068 
01069         if(!(ent->spawnflags & 64))
01070         {
01071                 G_KillBox( ent );
01072                 trap_LinkEntity (ent);
01073         }
01074 
01075         // don't allow full run speed for a bit
01076         client->ps.pm_flags |= PMF_TIME_KNOCKBACK;
01077         client->ps.pm_time = 100;
01078 
01079         client->respawnTime = level.time;
01080         client->inactivityTime = level.time + g_inactivity.value * 1000;
01081         client->latched_buttons = 0;
01082         if ( ent->s.m_iVehicleNum )
01083         {//I'm an NPC in a vehicle (or a vehicle), I already have owner set
01084         }
01085         else if ( client->NPC_class == CLASS_SEEKER && ent->activator != NULL )
01086         {//somebody else "owns" me
01087                 ent->s.owner = ent->r.ownerNum = ent->activator->s.number;
01088         }
01089         else
01090         {
01091                 ent->s.owner = ENTITYNUM_NONE;
01092         }
01093 
01094         // set default animations
01095         if ( ent->client->NPC_class != CLASS_VEHICLE )
01096         {
01097                 NPC_SetAnim( ent, SETANIM_BOTH, BOTH_STAND1, SETANIM_FLAG_NORMAL );
01098         }
01099 
01100         if( spawnPoint )
01101         {
01102                 // fire the targets of the spawn point
01103                 G_UseTargets( spawnPoint, ent );
01104         }
01105 
01106         //ICARUS include
01107         trap_ICARUS_InitEnt( ent );
01108 
01109 //==NPC initialization
01110         SetNPCGlobals( ent );
01111 
01112         ent->enemy = NULL;
01113         NPCInfo->timeOfDeath = 0;
01114         NPCInfo->shotTime = 0;
01115         NPC_ClearGoal();
01116         NPC_ChangeWeapon( ent->client->ps.weapon );
01117 
01118 //==Final NPC initialization
01119         ent->pain  = NPC_PainFunc( ent ); //painF_NPC_Pain;
01120         ent->touch = NPC_TouchFunc( ent ); //touchF_NPC_Touch;
01121 //      ent->NPC->side = 1;
01122 
01123         ent->client->ps.ping = ent->NPC->stats.reactions * 50;
01124 
01125         //MCG - Begin: NPC hacks
01126         //FIXME: Set the team correctly
01127         if (ent->s.NPC_class != CLASS_VEHICLE || g_gametype.integer != GT_SIEGE)
01128         {
01129                 ent->client->ps.persistant[PERS_TEAM] = ent->client->playerTeam;
01130         }
01131 
01132         ent->use   = NPC_Use;
01133         ent->think = NPC_Think;
01134         ent->nextthink = level.time + FRAMETIME + Q_irand(0, 100);
01135 
01136         NPC_SetMiscDefaultData( ent );
01137         if ( ent->health <= 0 )
01138         {
01139                 //ORIGINAL ID: health will count down towards max_health
01140                 ent->health = client->ps.stats[STAT_HEALTH] = ent->client->pers.maxHealth;
01141         }
01142         else
01143         {
01144                 client->ps.stats[STAT_HEALTH] = ent->health;
01145         }
01146 
01147         if (ent->s.shouldtarget)
01148         {
01149                 ent->maxHealth = ent->health;
01150                 G_ScaleNetHealth(ent);
01151         }
01152 
01153         ChangeWeapon( ent, ent->client->ps.weapon );//yes, again... sigh
01154 
01155         if ( !(ent->spawnflags & SFB_STARTINSOLID) )
01156         {//Not okay to start in solid
01157                 G_CheckInSolid( ent, qtrue );
01158         }
01159         VectorClear( ent->NPC->lastClearOrigin );
01160 
01161         //Run a script if you have one assigned to you
01162         if ( G_ActivateBehavior( ent, BSET_SPAWN ) )
01163         {
01164                 trap_ICARUS_MaintainTaskManager(ent->s.number);
01165         }
01166 
01167         VectorCopy( ent->r.currentOrigin, ent->client->renderInfo.eyePoint );
01168 
01169         // run a client frame to drop exactly to the floor,
01170         // initialize animations and other things
01171         memset( &ucmd, 0, sizeof( ucmd ) );
01172         //_VectorCopy( client->pers.cmd_angles, ucmd.angles );
01173         VectorCopy(client->pers.cmd.angles, ucmd.angles);
01174         
01175         ent->client->ps.groundEntityNum = ENTITYNUM_NONE;
01176 
01177         if ( ent->NPC->aiFlags & NPCAI_MATCHPLAYERWEAPON )
01178         {
01179                 //G_MatchPlayerWeapon( ent );
01180                 //rwwFIXMEFIXME: Use this? Probably doesn't really matter for MP.
01181         }
01182 
01183         ClientThink( ent->s.number, &ucmd );
01184 
01185         trap_LinkEntity( ent );
01186 
01187         if ( ent->client->playerTeam == NPCTEAM_ENEMY )
01188         {//valid enemy spawned
01189                 if ( !(ent->spawnflags&SFB_CINEMATIC) && ent->NPC->behaviorState != BS_CINEMATIC )
01190                 {//not a cinematic enemy
01191                         if ( g_entities[0].client )
01192                         {
01193                                 //g_entities[0].client->sess.missionStats.enemiesSpawned++;
01194                                 //rwwFIXMEFIXME: Do something here? And this is a rather strange place to be storing
01195                                 //this sort of data.
01196                         }
01197                 }
01198         }
01199         ent->waypoint = ent->NPC->homeWp = WAYPOINT_NONE;
01200 
01201         if ( ent->m_pVehicle )
01202         {//a vehicle
01203                 //check for droidunit
01204                 if ( ent->m_pVehicle->m_iDroidUnitTag != -1 )
01205                 {
01206                         char    *droidNPCType = NULL;
01207                         gentity_t *droidEnt = NULL;
01208                         if ( ent->model2 
01209                                 && ent->model2[0] )
01210                         {//specified on the NPC_Vehicle spawner ent
01211                                 droidNPCType = ent->model2;
01212                         }
01213                         else if ( ent->m_pVehicle->m_pVehicleInfo->droidNPC
01214                                 && ent->m_pVehicle->m_pVehicleInfo->droidNPC[0] )
01215                         {//specified in the vehicle's .veh file
01216                                 droidNPCType = ent->m_pVehicle->m_pVehicleInfo->droidNPC;
01217                         }
01218 
01219                         if ( droidNPCType != NULL )
01220                         {
01221                                 if ( Q_stricmp( "random", droidNPCType ) == 0
01222                                         || Q_stricmp( "default", droidNPCType ) == 0 )
01223                                 {//use default - R2D2 or R5D2
01224                                         if ( Q_irand( 0, 1 ) )
01225                                         {
01226                                                 droidNPCType = "r2d2";
01227                                         }
01228                                         else
01229                                         {
01230                                                 droidNPCType = "r5d2";
01231                                         }
01232                                 }
01233                                 droidEnt = NPC_SpawnType( ent, droidNPCType, NULL, qfalse );
01234                                 if ( droidEnt != NULL )
01235                                 {
01236                                         if ( droidEnt->client )
01237                                         {
01238                                                 droidEnt->client->ps.m_iVehicleNum =
01239                                                         droidEnt->s.m_iVehicleNum =
01240                                                         //droidEnt->s.otherEntityNum2 = 
01241                                                         droidEnt->s.owner = 
01242                                                         droidEnt->r.ownerNum = ent->s.number;
01243                                                 ent->m_pVehicle->m_pDroidUnit = (bgEntity_t *)droidEnt;
01244                                                 //SP way:
01245                                                 //droidEnt->s.m_iVehicleNum = ent->s.number;
01246                                                 //droidEnt->owner = ent;
01247                                                 VectorCopy( ent->r.currentOrigin, droidEnt->s.origin );
01248                                                 VectorCopy( ent->r.currentOrigin, droidEnt->client->ps.origin );
01249                                                 G_SetOrigin( droidEnt, droidEnt->s.origin );
01250                                                 trap_LinkEntity( droidEnt );
01251                                                 VectorCopy( ent->r.currentAngles, droidEnt->s.angles );
01252                                                 G_SetAngles( droidEnt, droidEnt->s.angles );
01253                                                 if ( droidEnt->NPC )
01254                                                 {
01255                                                         droidEnt->NPC->desiredYaw = droidEnt->s.angles[YAW];
01256                                                         droidEnt->NPC->desiredPitch = droidEnt->s.angles[PITCH];
01257                                                 }
01258                                                 droidEnt->flags |= FL_UNDYING;
01259                                         }
01260                                         else
01261                                         {//wtf?
01262                                                 G_FreeEntity( droidEnt );
01263                                         }
01264                                 }
01265                         }
01266                 }
01267         }
01268 }

void NPC_DefaultScriptFlags gentity_t ent  ) 
 

Definition at line 1350 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC, SCF_CHASE_ENEMIES, SCF_LOOK_FOR_ENEMIES, and gNPC_t::scriptFlags.

Referenced by NPC_Spawn_Do().

01351 {
01352         if ( !ent || !ent->NPC )
01353         {
01354                 return;
01355         }
01356         //Set up default script flags
01357         ent->NPC->scriptFlags = (SCF_CHASE_ENEMIES|SCF_LOOK_FOR_ENEMIES);
01358 }

void NPC_Droid_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 273 of file NPC_AI_Droid.c.

References entityState_s::angles, AngleVectors(), BOTH_PAIN1, BOTH_PAIN2, BOTH_STAND2, CLASS_INTERROGATOR, CLASS_MOUSE, CLASS_R2D2, CLASS_R5D2, gentity_s::client, entityShared_t::currentAngles, entityShared_t::currentOrigin, playerState_s::electrifyTime, G_EffectIndex(), G_PlayEffectID(), gentity_t, gentity_s::ghoul2, gPainMOD, gentity_s::health, gNPC_t::lastPathAngles, playerState_s::legsAnim, level, gNPC_t::localState, LSTATE_BACKINGUP, LSTATE_SPINNING, playerState_s::m_iVehicleNum, entityState_s::m_iVehicleNum, MOD_DEMP2, MOD_DEMP2_ALT, gentity_s::NPC, gclient_s::NPC_class, NPC_GetPainChance(), NPC_Pain(), NPC_SetAnim(), NPC_SetSurfaceOnOff(), NULL, gclient_s::ps, Q_irand(), gentity_s::r, random, gentity_s::s, SCF_LOOK_FOR_ENEMIES, gNPC_t::scriptFlags, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, gentity_s::spawnflags, level_locals_t::time, TIMER_Set(), trap_G2API_GetSurfaceRenderStatus(), TURN_OFF, vec3_origin, vec3_t, VectorCopy, VectorMA, VectorNormalize(), VectorSubtract, and playerState_s::velocity.

Referenced by NPC_PainFunc().

00274 {
00275         gentity_t *other = attacker;
00276         int             anim;
00277         int             mod = gPainMOD;
00278         float   pain_chance;
00279 
00280         VectorCopy( self->NPC->lastPathAngles, self->s.angles );
00281 
00282         if ( self->client->NPC_class == CLASS_R5D2 )
00283         {
00284                 pain_chance = NPC_GetPainChance( self, damage );
00285 
00286                 // Put it in pain
00287                 if ( mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT || random() < pain_chance )       // Spin around in pain? Demp2 always does this
00288                 {
00289                         // Health is between 0-30 or was hit by a DEMP2 so pop his head
00290                         if ( !self->s.m_iVehicleNum
00291                                 && ( self->health < 30 || mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT ) )
00292                         {
00293                                 if (!(self->spawnflags & 2))    // Doesn't have to ALWAYSDIE
00294                                 {
00295                                         if ((self->NPC->localState != LSTATE_SPINNING) && 
00296                                                 (!trap_G2API_GetSurfaceRenderStatus( self->ghoul2, 0, "head" )))
00297                                         {
00298                                                 NPC_SetSurfaceOnOff( self, "head", TURN_OFF );
00299 
00300                                                 if ( self->client->ps.m_iVehicleNum )
00301                                                 {
00302                                                         vec3_t  up;
00303                                                         AngleVectors( self->r.currentAngles, NULL, NULL, up );
00304                                                         G_PlayEffectID( G_EffectIndex("chunks/r5d2head_veh"), self->r.currentOrigin, up );
00305                                                 }
00306                                                 else
00307                                                 {
00308                                                         G_PlayEffectID( G_EffectIndex("small_chunks") , self->r.currentOrigin, vec3_origin );
00309                                                         G_PlayEffectID( G_EffectIndex("chunks/r5d2head"), self->r.currentOrigin, vec3_origin );
00310                                                 }
00311 
00312                                                 //self->s.powerups |= ( 1 << PW_SHOCKED );
00313                                                 //self->client->ps.powerups[PW_SHOCKED] = level.time + 3000;
00314                                                 self->client->ps.electrifyTime = level.time + 3000;
00315 
00316                                                 TIMER_Set( self, "droidsmoketotal", 5000);
00317                                                 TIMER_Set( self, "droidspark", 100);
00318                                                 self->NPC->localState = LSTATE_SPINNING;
00319                                         }
00320                                 }
00321                         }
00322                         // Just give him normal pain for a little while
00323                         else
00324                         {
00325                                 anim = self->client->ps.legsAnim;
00326 
00327                                 if ( anim == BOTH_STAND2 )      // On two legs?
00328                                 {
00329                                         anim = BOTH_PAIN1;
00330                                 }
00331                                 else                                            // On three legs
00332                                 {
00333                                         anim = BOTH_PAIN2;
00334                                 }
00335 
00336                                 NPC_SetAnim( self, SETANIM_BOTH, anim, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00337 
00338                                 // Spin around in pain
00339                                 self->NPC->localState = LSTATE_SPINNING;
00340                                 TIMER_Set( self, "roam", Q_irand(1000,2000));
00341                         } 
00342                 }
00343         }
00344         else if (self->client->NPC_class == CLASS_MOUSE)
00345         {
00346                 if ( mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT )
00347                 {
00348                         self->NPC->localState = LSTATE_SPINNING;
00349                         //self->s.powerups |= ( 1 << PW_SHOCKED );
00350                         //self->client->ps.powerups[PW_SHOCKED] = level.time + 3000;
00351                         self->client->ps.electrifyTime = level.time + 3000;
00352                 }
00353                 else
00354                 {
00355                         self->NPC->localState = LSTATE_BACKINGUP;
00356                 }
00357 
00358                 self->NPC->scriptFlags &= ~SCF_LOOK_FOR_ENEMIES;
00359         }
00360         else if ((self->client->NPC_class == CLASS_R2D2))
00361         {
00362 
00363                 pain_chance = NPC_GetPainChance( self, damage );
00364 
00365                 if ( mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT || random() < pain_chance )       // Spin around in pain? Demp2 always does this
00366                 {
00367                         // Health is between 0-30 or was hit by a DEMP2 so pop his head
00368                         if ( !self->s.m_iVehicleNum
00369                                 && ( self->health < 30 || mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT ) )
00370                         {
00371                                 if (!(self->spawnflags & 2))    // Doesn't have to ALWAYSDIE
00372                                 {
00373                                         if ((self->NPC->localState != LSTATE_SPINNING) && 
00374                                                 (!trap_G2API_GetSurfaceRenderStatus( self->ghoul2, 0, "head" )))
00375                                         {
00376                                                 NPC_SetSurfaceOnOff( self, "head", TURN_OFF );
00377 
00378                                                 if ( self->client->ps.m_iVehicleNum )
00379                                                 {
00380                                                         vec3_t  up;
00381                                                         AngleVectors( self->r.currentAngles, NULL, NULL, up );
00382                                                         G_PlayEffectID( G_EffectIndex("chunks/r2d2head_veh"), self->r.currentOrigin, up );
00383                                                 }
00384                                                 else
00385                                                 {
00386                                                         G_PlayEffectID( G_EffectIndex("small_chunks") , self->r.currentOrigin, vec3_origin );
00387                                                         G_PlayEffectID( G_EffectIndex("chunks/r2d2head"), self->r.currentOrigin, vec3_origin );
00388                                                 }
00389 
00390                                                 //self->s.powerups |= ( 1 << PW_SHOCKED );
00391                                                 //self->client->ps.powerups[PW_SHOCKED] = level.time + 3000;
00392                                                 self->client->ps.electrifyTime = level.time + 3000;
00393 
00394                                                 TIMER_Set( self, "droidsmoketotal", 5000);
00395                                                 TIMER_Set( self, "droidspark", 100);
00396                                                 self->NPC->localState = LSTATE_SPINNING;
00397                                         }
00398                                 }
00399                         }
00400                         // Just give him normal pain for a little while
00401                         else
00402                         {
00403                                 anim = self->client->ps.legsAnim;
00404 
00405                                 if ( anim == BOTH_STAND2 )      // On two legs?
00406                                 {
00407                                         anim = BOTH_PAIN1;
00408                                 }
00409                                 else                                            // On three legs
00410                                 {
00411                                         anim = BOTH_PAIN2;
00412                                 }
00413 
00414                                 NPC_SetAnim( self, SETANIM_BOTH, anim, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00415 
00416                                 // Spin around in pain
00417                                 self->NPC->localState = LSTATE_SPINNING;
00418                                 TIMER_Set( self, "roam", Q_irand(1000,2000));
00419                         }
00420                 } 
00421         }
00422         else if ( self->client->NPC_class == CLASS_INTERROGATOR && ( mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT ) && other )
00423         {
00424                 vec3_t dir;
00425 
00426                 VectorSubtract( self->r.currentOrigin, other->r.currentOrigin, dir );
00427                 VectorNormalize( dir );
00428 
00429                 VectorMA( self->client->ps.velocity, 550, dir, self->client->ps.velocity );
00430                 self->client->ps.velocity[2] -= 127;
00431         }
00432 
00433         NPC_Pain( self, attacker, damage);
00434 }

void NPC_GalakMech_Init gentity_t ent  ) 
 

Definition at line 59 of file NPC_AI_GalakMech.c.

References gNPC_t::behaviorState, BS_CINEMATIC, gentity_s::client, FL_NO_KNOCKBACK, FL_SHIELDED, gentity_s::flags, GALAK_SHIELD_HEALTH, gentity_t, gNPC_t::investigateCount, gNPC_t::investigateDebounceTime, entityShared_t::maxs, entityShared_t::mins, gentity_s::NPC, NPC_SetSurfaceOnOff(), gclient_s::ps, gentity_s::r, STAT_ARMOR, playerState_s::stats, TIMER_Set(), TURN_OFF, TURN_ON, and VectorSet.

Referenced by NPC_SetMiscDefaultData().

00060 {
00061         if (ent->NPC->behaviorState != BS_CINEMATIC)
00062         {
00063                 ent->client->ps.stats[STAT_ARMOR] = GALAK_SHIELD_HEALTH;
00064                 ent->NPC->investigateCount = ent->NPC->investigateDebounceTime = 0;
00065                 ent->flags |= FL_SHIELDED;//reflect normal shots
00066                 //rwwFIXMEFIXME: Support PW_GALAK_SHIELD
00067                 //ent->client->ps.powerups[PW_GALAK_SHIELD] = Q3_INFINITE;//temp, for effect
00068                 //ent->fx_time = level.time;
00069                 VectorSet( ent->r.mins, -60, -60, -24 );
00070                 VectorSet( ent->r.maxs, 60, 60, 80 );
00071                 ent->flags |= FL_NO_KNOCKBACK;//don't get pushed
00072                 TIMER_Set( ent, "attackDelay", 0 );     //FIXME: Slant for difficulty levels
00073                 TIMER_Set( ent, "flee", 0 );
00074                 TIMER_Set( ent, "smackTime", 0 );
00075                 TIMER_Set( ent, "beamDelay", 0 );
00076                 TIMER_Set( ent, "noLob", 0 );
00077                 TIMER_Set( ent, "noRapid", 0 );
00078                 TIMER_Set( ent, "talkDebounce", 0 );
00079 
00080                 NPC_SetSurfaceOnOff( ent, "torso_shield", TURN_ON );
00081                 NPC_SetSurfaceOnOff( ent, "torso_galakface", TURN_OFF );
00082                 NPC_SetSurfaceOnOff( ent, "torso_galakhead", TURN_OFF );
00083                 NPC_SetSurfaceOnOff( ent, "torso_eyes_mouth", TURN_OFF );
00084                 NPC_SetSurfaceOnOff( ent, "torso_collar", TURN_OFF );
00085                 NPC_SetSurfaceOnOff( ent, "torso_galaktorso", TURN_OFF );
00086         }
00087         else
00088         {
00089 //              NPC_SetSurfaceOnOff( ent, "helmet", TURN_OFF );
00090                 NPC_SetSurfaceOnOff( ent, "torso_shield", TURN_OFF );
00091                 NPC_SetSurfaceOnOff( ent, "torso_galakface", TURN_ON );
00092                 NPC_SetSurfaceOnOff( ent, "torso_galakhead", TURN_ON );
00093                 NPC_SetSurfaceOnOff( ent, "torso_eyes_mouth", TURN_ON );
00094                 NPC_SetSurfaceOnOff( ent, "torso_collar", TURN_ON );
00095                 NPC_SetSurfaceOnOff( ent, "torso_galaktorso", TURN_ON );
00096         }
00097 
00098 }

void NPC_GalakMech_Precache void   ) 
 

Definition at line 42 of file NPC_AI_GalakMech.c.

References G_EffectIndex(), and G_SoundIndex().

Referenced by NPC_SpawnType(), and SP_NPC_Galak().

00043 {
00044         G_SoundIndex( "sound/weapons/galak/skewerhit.wav" );
00045         G_SoundIndex( "sound/weapons/galak/lasercharge.wav" );
00046         G_SoundIndex( "sound/weapons/galak/lasercutting.wav" );
00047         G_SoundIndex( "sound/weapons/galak/laserdamage.wav" );
00048 
00049         G_EffectIndex( "galak/trace_beam" );
00050         G_EffectIndex( "galak/beam_warmup" );
00051 //      G_EffectIndex( "small_chunks");
00052         G_EffectIndex( "env/med_explode2");
00053         G_EffectIndex( "env/small_explode2");
00054         G_EffectIndex( "galak/explode");
00055         G_EffectIndex( "blaster/smoke_bolton");
00056 //      G_EffectIndex( "env/exp_trail_comp");
00057 }

void NPC_GM_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 238 of file NPC_AI_GalakMech.c.

References gentity_s::alt_fire, gNPC_t::blockedSpeechDebounceTime, gentity_s::client, gentity_s::count, gentity_s::delay, playerState_s::electrifyTime, EV_DETECTED1, EV_PUSHED1, EV_PUSHED2, EV_PUSHED3, G_AddVoiceEvent(), gentity_t, gPainMOD, gPainPoint, gentity_s::health, HL_GENERIC1, gentity_s::lastEnemy, level, gentity_s::lockCount, MOD_REPEATER, MOD_REPEATER_ALT, gentity_s::NPC, NPC_Pain(), NPC_SetPainEvent(), gclient_s::ps, Q_irand(), qfalse, qtrue, SCF_ALT_FIRE, gNPC_t::scriptFlags, level_locals_t::time, TIMER_Done(), TIMER_Set(), playerState_s::torsoTimer, vec3_t, and VectorCopy.

Referenced by NPC_PainFunc().

00239 {
00240         vec3_t point;
00241         gentity_t *inflictor = attacker;
00242         int hitLoc = 1;
00243         int mod = gPainMOD;
00244 
00245         VectorCopy(gPainPoint, point);
00246 
00247         //if ( self->client->ps.powerups[PW_GALAK_SHIELD] == 0 )
00248         if (0) //rwwFIXMEFIXME: do all of this
00249         {//shield is currently down
00250                 //FIXME: allow for radius damage?
00251                 /*
00252                 if ( (hitLoc==HL_GENERIC1) && (self->locationDamage[HL_GENERIC1] > GENERATOR_HEALTH) )
00253                 {
00254                         int newBolt = gi.G2API_AddBolt( &self->ghoul2[self->playerModel], "*antenna_base" );
00255                         if ( newBolt != -1 )
00256                         {
00257                                 GM_CreateExplosion( self, newBolt, qfalse );
00258                         }
00259 
00260                         NPC_SetSurfaceOnOff( self, "torso_shield", TURN_OFF );
00261                         NPC_SetSurfaceOnOff( self, "torso_antenna", TURN_OFF );
00262                         NPC_SetSurfaceOnOff( self, "torso_antenna_base_cap", TURN_ON );
00263                         self->client->ps.powerups[PW_GALAK_SHIELD] = 0;//temp, for effect
00264                         self->client->ps.stats[STAT_ARMOR] = 0;//no more armor
00265                         self->NPC->investigateDebounceTime = 0;//stop recharging
00266 
00267                         NPC_SetAnim( self, SETANIM_BOTH, BOTH_ALERT1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00268                         TIMER_Set( self, "attackDelay", self->client->ps.torsoTimer );
00269                         G_AddEvent( self, Q_irand( EV_DEATH1, EV_DEATH3 ), self->health );
00270                 }
00271                 */
00272         }
00273         else
00274         {//store the point for shield impact
00275                 if ( point )
00276                 {
00277                 //      VectorCopy( point, self->pos4 );
00278                 //      self->client->poisonTime = level.time;
00279                         //rwwFIXMEFIXME: ..do this is as well.
00280                 }
00281         }
00282 
00283         if ( !self->lockCount && self->client->ps.torsoTimer <= 0 )
00284         {//don't interrupt laser sweep attack or other special attacks/moves
00285                 if ( self->count < 4 && self->health > 100 && hitLoc != HL_GENERIC1 )
00286                 {
00287                         if ( self->delay < level.time )
00288                         {
00289                                 int speech;
00290                                 switch( self->count )
00291                                 {
00292                                 default:
00293                                 case 0:
00294                                         speech = EV_PUSHED1;
00295                                         break;
00296                                 case 1:
00297                                         speech = EV_PUSHED2;
00298                                         break;
00299                                 case 2:
00300                                         speech = EV_PUSHED3;
00301                                         break;
00302                                 case 3:
00303                                         speech = EV_DETECTED1;
00304                                         break;
00305                                 }
00306                                 self->count++;
00307                                 self->NPC->blockedSpeechDebounceTime = 0;
00308                                 G_AddVoiceEvent( self, speech, Q_irand( 3000, 5000 ) );
00309                                 self->delay = level.time + Q_irand( 5000, 7000 );
00310                         }
00311                 }
00312                 else
00313                 {
00314                         NPC_Pain(self, attacker, damage);
00315                 }
00316         }
00317         else if ( hitLoc == HL_GENERIC1 )
00318         {
00319                 NPC_SetPainEvent( self );
00320                 //self->s.powerups |= ( 1 << PW_SHOCKED );
00321                 //self->client->ps.powerups[PW_SHOCKED] = level.time + Q_irand( 500, 2500 );
00322                 self->client->ps.electrifyTime = level.time + Q_irand(500, 2500);
00323         }
00324 
00325         if ( inflictor && inflictor->lastEnemy == self )
00326         {//He force-pushed my own lobfires back at me
00327                 if ( mod == MOD_REPEATER_ALT && !Q_irand( 0, 2 ) )
00328                 {
00329                         if ( TIMER_Done( self, "noRapid" ) )
00330                         {
00331                                 self->NPC->scriptFlags &= ~SCF_ALT_FIRE;
00332                                 self->alt_fire = qfalse;
00333                                 TIMER_Set( self, "noLob", Q_irand( 2000, 6000 ) );
00334                         }
00335                         else
00336                         {//hopefully this will make us fire the laser
00337                                 TIMER_Set( self, "noLob", Q_irand( 1000, 2000 ) );
00338                         }
00339                 }
00340                 else if ( mod == MOD_REPEATER && !Q_irand( 0, 5 ) )
00341                 {
00342                         if ( TIMER_Done( self, "noLob" ) )
00343                         {
00344                                 self->NPC->scriptFlags |= SCF_ALT_FIRE;
00345                                 self->alt_fire = qtrue;
00346                                 TIMER_Set( self, "noRapid", Q_irand( 2000, 6000 ) );
00347                         }
00348                         else
00349                         {//hopefully this will make us fire the laser
00350                                 TIMER_Set( self, "noRapid", Q_irand( 1000, 2000 ) );
00351                         }
00352                 }
00353         }
00354 }

void NPC_Gonk_Precache void   ) 
 

Definition at line 520 of file NPC_AI_Droid.c.

References G_EffectIndex(), and G_SoundIndex().

Referenced by NPC_SpawnType(), and SP_NPC_Droid_Gonk().

00521 {
00522         G_SoundIndex("sound/chars/gonk/misc/gonktalk1.wav");
00523         G_SoundIndex("sound/chars/gonk/misc/gonktalk2.wav");
00524 
00525         G_SoundIndex("sound/chars/gonk/misc/death1.wav");
00526         G_SoundIndex("sound/chars/gonk/misc/death2.wav");
00527         G_SoundIndex("sound/chars/gonk/misc/death3.wav");
00528 
00529         G_EffectIndex( "env/med_explode");
00530 }

void NPC_Howler_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 178 of file NPC_AI_Howler.c.

References entityState_s::angles, BOTH_PAIN1, gentity_t, gNPC_t::lastPathAngles, gNPC_t::localState, LSTATE_WAITING, gentity_s::NPC, NPC_SetAnim(), gentity_s::s, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, TIMER_Remove(), TIMER_Set(), and VectorCopy.

Referenced by NPC_PainFunc().

00179 {
00180         if ( damage >= 10 )
00181         {
00182                 TIMER_Remove( self, "attacking" );
00183                 TIMER_Set( self, "takingPain", 2900 );
00184 
00185                 VectorCopy( self->NPC->lastPathAngles, self->s.angles );
00186 
00187                 NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );
00188 
00189                 if ( self->NPC )
00190                 {
00191                         self->NPC->localState = LSTATE_WAITING;
00192                 }
00193         }
00194 }

void NPC_Howler_Precache void   ) 
 

Definition at line 18 of file NPC_AI_Howler.c.

Referenced by NPC_SpawnType().

00019 {
00020 }

void NPC_Interrogator_Precache gentity_t self  ) 
 

Definition at line 20 of file NPC_AI_Interrogator.c.

References G_EffectIndex(), G_SoundIndex(), and gentity_t.

Referenced by NPC_SpawnType(), and SP_NPC_Droid_Interrogator().

00021 {
00022         G_SoundIndex( "sound/chars/interrogator/misc/torture_droid_lp" );
00023         G_SoundIndex("sound/chars/mark1/misc/anger.wav");
00024         G_SoundIndex( "sound/chars/probe/misc/talk");
00025         G_SoundIndex( "sound/chars/interrogator/misc/torture_droid_inject" );
00026         G_SoundIndex( "sound/chars/interrogator/misc/int_droid_explo" );
00027         G_EffectIndex( "explosions/droidexplosion1" );
00028 }

void NPC_Jedi_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 5358 of file NPC_AI_Jedi.c.

References entityShared_t::absmin, gNPCstats_e::aggression, AngleVectors(), BOTH_CEILING_CLING, BOTH_CEILING_DROP, CLASS_DESANN, gentity_s::client, Com_Printf(), d_JediAI, DotProduct, gNPC_t::enemyCheckDebounceTime, EV_PUSHED1, EV_PUSHED3, renderInfo_s::eyePoint, playerState_s::fd, FORCE_LEVEL_1, FORCE_LEVEL_3, forcedata_s::forcePowerDebounce, FP_GRIP, FP_SABER_DEFENSE, G_AddVoiceEvent(), g_spskill, gentity_t, gPainPoint, gentity_s::health, vmCvar_t::integer, Jedi_WaitingAmbush(), playerState_s::legsAnim, level, gclient_s::noclip, gentity_s::NPC, gclient_s::NPC_class, NPC_Pain(), NPC_SetAnim(), gentity_s::NPC_type, NULL, gclient_s::ps, Q_irand(), Q_stricmp(), qfalse, gentity_s::r, gNPC_t::rank, RANK_LT_JG, gclient_s::renderInfo, gentity_s::s, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, SETANIM_LEGS, SETANIM_TORSO, gNPC_t::stats, level_locals_t::time, TIMER_Set(), playerState_s::torsoAnim, vec3_t, VectorCopy, VectorSubtract, playerState_s::viewangles, entityState_s::weapon, WP_ForcePowerStop(), and WP_SABER.

Referenced by NPC_PainFunc().

05359 {
05360         gentity_t *other = attacker;
05361         vec3_t point;
05362 
05363         VectorCopy(gPainPoint, point);
05364 
05365         //FIXME: base the actual aggression add/subtract on health?
05366         //FIXME: don't do this more than once per frame?
05367         //FIXME: when take pain, stop force gripping....?
05368         if ( other->s.weapon == WP_SABER )
05369         {//back off
05370                 TIMER_Set( self, "parryTime", -1 );
05371                 if ( self->client->NPC_class == CLASS_DESANN || !Q_stricmp("Yoda",self->NPC_type) )
05372                 {//less for Desann
05373                         self->client->ps.fd.forcePowerDebounce[FP_SABER_DEFENSE] = level.time + (3-g_spskill.integer)*50;
05374                 }
05375                 else if ( self->NPC->rank >= RANK_LT_JG )
05376                 {
05377                         self->client->ps.fd.forcePowerDebounce[FP_SABER_DEFENSE] = level.time + (3-g_spskill.integer)*100;//300
05378                 }
05379                 else
05380                 {
05381                         self->client->ps.fd.forcePowerDebounce[FP_SABER_DEFENSE] = level.time + (3-g_spskill.integer)*200;//500
05382                 }
05383                 if ( !Q_irand( 0, 3 ) )
05384                 {//ouch... maybe switch up which saber power level we're using
05385                         Jedi_AdjustSaberAnimLevel( self, Q_irand( FORCE_LEVEL_1, FORCE_LEVEL_3 ) );
05386                 }
05387                 if ( !Q_irand( 0, 1 ) )//damage > 20 || self->health < 40 || 
05388                 {
05389                         //Com_Printf( "(%d) drop agg - hit by saber\n", level.time );
05390                         Jedi_Aggression( self, -1 );
05391                 }
05392                 if ( d_JediAI.integer )
05393                 {
05394                         Com_Printf( "(%d) PAIN: agg %d, no parry until %d\n", level.time, self->NPC->stats.aggression, level.time+500 );
05395                 }
05396                 //for testing only
05397                 // Figure out what quadrant the hit was in.
05398                 if ( d_JediAI.integer )
05399                 {
05400                         vec3_t  diff, fwdangles, right;
05401                         float rightdot, zdiff;
05402 
05403                         VectorSubtract( point, self->client->renderInfo.eyePoint, diff );
05404                         diff[2] = 0;
05405                         fwdangles[1] = self->client->ps.viewangles[1];
05406                         AngleVectors( fwdangles, NULL, right, NULL );
05407                         rightdot = DotProduct(right, diff);
05408                         zdiff = point[2] - self->client->renderInfo.eyePoint[2];
05409                 
05410                         Com_Printf( "(%d) saber hit at height %4.2f, zdiff: %4.2f, rightdot: %4.2f\n", level.time, point[2]-self->r.absmin[2],zdiff,rightdot);
05411                 }
05412         }
05413         else
05414         {//attack
05415                 //Com_Printf( "(%d) raise agg - hit by ranged\n", level.time );
05416                 Jedi_Aggression( self, 1 );
05417         }
05418 
05419         self->NPC->enemyCheckDebounceTime = 0;
05420 
05421         WP_ForcePowerStop( self, FP_GRIP );
05422 
05423         //NPC_Pain( self, inflictor, other, point, damage, mod );
05424         NPC_Pain(self, attacker, damage);
05425 
05426         if ( !damage && self->health > 0 )
05427         {//FIXME: better way to know I was pushed
05428                 G_AddVoiceEvent( self, Q_irand(EV_PUSHED1, EV_PUSHED3), 2000 );
05429         }
05430 
05431         //drop me from the ceiling if I'm on it
05432         if ( Jedi_WaitingAmbush( self ) )
05433         {
05434                 self->client->noclip = qfalse;
05435         }
05436         if ( self->client->ps.legsAnim == BOTH_CEILING_CLING )
05437         {
05438                 NPC_SetAnim( self, SETANIM_LEGS, BOTH_CEILING_DROP, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
05439         }
05440         if ( self->client->ps.torsoAnim == BOTH_CEILING_CLING )
05441         {
05442                 NPC_SetAnim( self, SETANIM_TORSO, BOTH_CEILING_DROP, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
05443         }
05444 }

void NPC_Kill_f void   ) 
 

Definition at line 4039 of file NPC_spawn.c.

References gentity_s::classname, gentity_s::client, Com_Printf(), gentity_s::die, ENTITYNUM_MAX_NORMAL, g_entities, G_FreeEntity(), gentity_t, GetIDForString(), gentity_s::health, gentity_s::inuse, clientPersistant_t::maxHealth, MOD_UNKNOWN, name, gentity_s::NPC, gentity_s::NPC_targetname, gentity_s::NPC_type, NPCTEAM_PLAYER, gclient_s::pers, gclient_s::playerTeam, gclient_s::ps, Q_stricmp(), qboolean, qfalse, qtrue, S_COLOR_GREEN, S_COLOR_RED, STAT_HEALTH, playerState_s::stats, gentity_s::targetname, TEAM_FREE, TEAM_NUM_TEAMS, team_t, TeamNames, TeamTable, and trap_Argv().

Referenced by Cmd_NPC_f().

04040 {
04041         int                     n;
04042         gentity_t       *player;
04043         char            name[1024];
04044         team_t          killTeam = TEAM_FREE;
04045         qboolean        killNonSF = qfalse;
04046 
04047         trap_Argv(2, name, 1024);
04048 
04049         if ( !name[0] )
04050         {
04051                 Com_Printf( S_COLOR_RED"Error, Expected:\n");
04052                 Com_Printf( S_COLOR_RED"NPC kill '[NPC targetname]' - kills NPCs with certain targetname\n" );
04053                 Com_Printf( S_COLOR_RED"or\n" );
04054                 Com_Printf( S_COLOR_RED"NPC kill 'all' - kills all NPCs\n" );
04055                 Com_Printf( S_COLOR_RED"or\n" );
04056                 Com_Printf( S_COLOR_RED"NPC team '[teamname]' - kills all NPCs of a certain team ('nonally' is all but your allies)\n" );
04057                 return;
04058         }
04059 
04060         if ( Q_stricmp( "team", name ) == 0 )
04061         {
04062                 trap_Argv(3, name, 1024);
04063 
04064                 if ( !name[0] )
04065                 {
04066                         Com_Printf( S_COLOR_RED"NPC_Kill Error: 'npc kill team' requires a team name!\n" );
04067                         Com_Printf( S_COLOR_RED"Valid team names are:\n");
04068                         for ( n = (TEAM_FREE + 1); n < TEAM_NUM_TEAMS; n++ )
04069                         {
04070                                 Com_Printf( S_COLOR_RED"%s\n", TeamNames[n] );
04071                         }
04072                         Com_Printf( S_COLOR_RED"nonally - kills all but your teammates\n" );
04073                         return;
04074                 }
04075 
04076                 if ( Q_stricmp( "nonally", name ) == 0 )
04077                 {
04078                         killNonSF = qtrue;
04079                 }
04080                 else
04081                 {
04082                         killTeam = (team_t)GetIDForString( TeamTable, name );
04083 
04084                         if ( killTeam == TEAM_FREE )
04085                         {
04086                                 Com_Printf( S_COLOR_RED"NPC_Kill Error: team '%s' not recognized\n", name );
04087                                 Com_Printf( S_COLOR_RED"Valid team names are:\n");
04088                                 for ( n = (TEAM_FREE + 1); n < TEAM_NUM_TEAMS; n++ )
04089                                 {
04090                                         Com_Printf( S_COLOR_RED"%s\n", TeamNames[n] );
04091                                 }
04092                                 Com_Printf( S_COLOR_RED"nonally - kills all but your teammates\n" );
04093                                 return;
04094                         }
04095                 }
04096         }
04097 
04098         for ( n = 1; n < ENTITYNUM_MAX_NORMAL; n++) 
04099         {
04100                 player = &g_entities[n];
04101                 if (!player->inuse) {
04102                         continue;
04103                 }
04104                 if ( killNonSF )
04105                 {
04106                         if ( player )
04107                         {
04108                                 if ( player->client )
04109                                 {
04110                                         if ( player->client->playerTeam != NPCTEAM_PLAYER )
04111                                         {
04112                                                 Com_Printf( S_COLOR_GREEN"Killing NPC %s named %s\n", player->NPC_type, player->targetname );
04113                                                 player->health = 0;
04114 
04115                                                 if (player->die && player->client)
04116                                                 {
04117                                                         player->die(player, player, player, player->client->pers.maxHealth, MOD_UNKNOWN);
04118                                                 }
04119                                         }
04120                                 }
04121                                 else if ( player->NPC_type && player->classname && player->classname[0] && Q_stricmp( "NPC_starfleet", player->classname ) != 0 )
04122                                 {//A spawner, remove it
04123                                         Com_Printf( S_COLOR_GREEN"Removing NPC spawner %s with NPC named %s\n", player->NPC_type, player->NPC_targetname );
04124                                         G_FreeEntity( player );
04125                                         //FIXME: G_UseTargets2(player, player, player->NPC_target & player->target);?
04126                                 }
04127                         }
04128                 }
04129                 else if ( player && player->NPC && player->client )
04130                 {
04131                         if ( killTeam != TEAM_FREE )
04132                         {
04133                                 if ( player->client->playerTeam == killTeam )
04134                                 {
04135                                         Com_Printf( S_COLOR_GREEN"Killing NPC %s named %s\n", player->NPC_type, player->targetname );
04136                                         player->health = 0;
04137                                         if (player->die)
04138                                         {
04139                                                 player->die(player, player, player, player->client->pers.maxHealth, MOD_UNKNOWN);
04140                                         }
04141                                 }
04142                         }
04143                         else if( (player->targetname && Q_stricmp( name, player->targetname ) == 0)
04144                                 || Q_stricmp( name, "all" ) == 0 )
04145                         {
04146                                 Com_Printf( S_COLOR_GREEN"Killing NPC %s named %s\n", player->NPC_type, player->targetname );
04147                                 player->health = 0;
04148                                 player->client->ps.stats[STAT_HEALTH] = 0;
04149                                 if (player->die)
04150                                 {
04151                                         player->die(player, player, player, 100, MOD_UNKNOWN);
04152                                 }
04153                         }
04154                 }
04155                 /*
04156                 else if ( player && (player->r.svFlags&SVF_NPC_PRECACHE) )
04157                 {//a spawner
04158                         Com_Printf( S_COLOR_GREEN"Removing NPC spawner %s named %s\n", player->NPC_type, player->targetname );
04159                         G_FreeEntity( player );
04160                 }
04161                 */
04162                 //rwwFIXMEFIXME: should really do something here.
04163         }
04164 }

void NPC_Mark1_Pain gentity_t self,
gentity_t attacker,
int  damage
 

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 }

void NPC_Mark1_Precache void   ) 
 

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 }

void NPC_Mark2_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 80 of file NPC_AI_Mark2.c.

References AMMO_POD_HEALTH, CHAN_AUTO, gentity_s::count, DAMAGE_NO_PROTECTION, G_Damage(), G_Sound(), G_SoundIndex(), gentity_t, gentity_s::ghoul2, gPainHitLoc, gentity_s::health, HL_GENERIC1, gentity_s::locationDamage, MOD_UNKNOWN, NPC_Mark2_Part_Explode(), NPC_Pain(), NPC_SetSurfaceOnOff(), NULL, trap_G2API_AddBolt(), TURN_OFF, and va().

Referenced by NPC_PainFunc().

00081 {
00082         int newBolt,i;
00083         int hitLoc = gPainHitLoc;
00084         
00085         NPC_Pain( self, attacker, damage );
00086 
00087         for (i=0;i<3;i++)
00088         {
00089                 if ((hitLoc==HL_GENERIC1+i) && (self->locationDamage[HL_GENERIC1+i] > AMMO_POD_HEALTH)) // Blow it up?
00090                 {
00091                         if (self->locationDamage[hitLoc] >= AMMO_POD_HEALTH)
00092                         {                       
00093                                 newBolt = trap_G2API_AddBolt( self->ghoul2, 0, va("torso_canister%d",(i+1)) );
00094                                 if ( newBolt != -1 )
00095                                 {
00096                                         NPC_Mark2_Part_Explode(self,newBolt);
00097                                 }
00098                                 NPC_SetSurfaceOnOff( self, va("torso_canister%d",(i+1)), TURN_OFF );
00099                                 break;
00100                         }
00101                 }
00102         }
00103 
00104         G_Sound( self, CHAN_AUTO, G_SoundIndex( "sound/chars/mark2/misc/mark2_pain" ));
00105 
00106         // If any pods were blown off, kill him
00107         if (self->count > 0)
00108         {
00109                 G_Damage( self, NULL, NULL, NULL, NULL, self->health, DAMAGE_NO_PROTECTION, MOD_UNKNOWN );
00110         }
00111 }

void NPC_Mark2_Precache void   ) 
 

Definition at line 27 of file NPC_AI_Mark2.c.

References AMMO_BLASTER, AMMO_METAL_BOLTS, AMMO_POWERCELL, BG_FindItemForAmmo(), BG_FindItemForWeapon(), G_EffectIndex(), G_SoundIndex(), RegisterItem(), and WP_BRYAR_PISTOL.

Referenced by NPC_SpawnType(), and SP_NPC_Droid_Mark2().

00028 {
00029         G_SoundIndex( "sound/chars/mark2/misc/mark2_explo" );// blows up on death
00030         G_SoundIndex( "sound/chars/mark2/misc/mark2_pain" );
00031         G_SoundIndex( "sound/chars/mark2/misc/mark2_fire" );
00032         G_SoundIndex( "sound/chars/mark2/misc/mark2_move_lp" );
00033 
00034         G_EffectIndex( "explosions/droidexplosion1" );
00035         G_EffectIndex( "env/med_explode2" );
00036         G_EffectIndex( "blaster/smoke_bolton" );
00037         G_EffectIndex( "bryar/muzzle_flash" );
00038 
00039         RegisterItem( BG_FindItemForWeapon( WP_BRYAR_PISTOL ));
00040         RegisterItem( BG_FindItemForAmmo(       AMMO_METAL_BOLTS));
00041         RegisterItem( BG_FindItemForAmmo( AMMO_POWERCELL ));
00042         RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER ));
00043 }

void NPC_MineMonster_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 234 of file NPC_AI_MineMonster.c.

References entityState_s::angles, BOTH_PAIN1, gentity_s::client, EV_PAIN, floor(), G_AddEvent(), gentity_t, gentity_s::health, gNPC_t::lastPathAngles, gNPC_t::localState, LSTATE_WAITING, clientPersistant_t::maxHealth, gentity_s::NPC, NPC_SetAnim(), gclient_s::pers, gentity_s::s, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, TIMER_Remove(), TIMER_Set(), and VectorCopy.

Referenced by NPC_PainFunc().

00235 {
00236         G_AddEvent( self, EV_PAIN, floor((float)self->health/self->client->pers.maxHealth*100.0f) );
00237 
00238         if ( damage >= 10 )
00239         {
00240                 TIMER_Remove( self, "attacking" );
00241                 TIMER_Remove( self, "attacking1_dmg" );
00242                 TIMER_Remove( self, "attacking2_dmg" );
00243                 TIMER_Set( self, "takingPain", 1350 );
00244 
00245                 VectorCopy( self->NPC->lastPathAngles, self->s.angles );
00246 
00247                 NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );
00248 
00249                 if ( self->NPC )
00250                 {
00251                         self->NPC->localState = LSTATE_WAITING;
00252                 }
00253         }
00254 }

void NPC_MineMonster_Precache void   ) 
 

Definition at line 18 of file NPC_AI_MineMonster.c.

References G_SoundIndex(), and va().

Referenced by NPC_SpawnType(), and SP_NPC_MineMonster().

00019 {
00020         int i;
00021 
00022         for ( i = 0; i < 4; i++ )
00023         {
00024                 G_SoundIndex( va("sound/chars/mine/misc/bite%i.wav", i+1 ));
00025                 G_SoundIndex( va("sound/chars/mine/misc/miss%i.wav", i+1 ));
00026         }
00027 }

void NPC_Mouse_Precache void   ) 
 

Definition at line 455 of file NPC_AI_Droid.c.

References G_EffectIndex(), G_SoundIndex(), and va().

Referenced by NPC_SpawnType(), and SP_NPC_Droid_Mouse().

00456 {
00457         int     i;
00458 
00459         for (i = 1; i < 4; i++)
00460         {
00461                 G_SoundIndex( va( "sound/chars/mouse/misc/mousego%d.wav", i ) );
00462         }
00463 
00464         G_EffectIndex( "env/small_explode" );
00465         G_SoundIndex( "sound/chars/mouse/misc/death1" );
00466         G_SoundIndex( "sound/chars/mouse/misc/mouse_lp" );
00467 }

void NPC_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 363 of file NPC_reactions.c.

References gNPC_t::behaviorState, gNPC_t::blockedSpeechDebounceTime, BS_DEFAULT, BSET_FFIRE, BSET_FLEE, BSET_PAIN, gNPC_t::charmedTime, gentity_s::client, gNPC_t::confusionTime, gNPC_t::defaultBehavior, gentity_s::enemy, EV_FFTURN, EV_FFWARN, gNPC_t::ffireCount, FL_NOTARGET, gentity_s::flags, G_ActivateBehavior(), G_SetEnemy(), g_spskill, G_UseTargets2(), gentity_t, gPainHitLoc, gPainMOD, gPainPoint, gentity_s::health, gNPC_t::ignorePain, vmCvar_t::integer, killPlayerTimer, level, NPC, gentity_s::NPC, NPC_ChoosePainAnimation(), NPCInfo, NULL, entityState_s::number, gentity_s::paintarget, gclient_s::playerTeam, PM_DEAD, playerState_s::pm_type, gclient_s::ps, Q_irand(), qfalse, gentity_s::r, RestoreNPCGlobals(), gentity_s::s, SaveNPCGlobals(), SCF_CHASE_ENEMIES, SCF_CROUCHED, SCF_DONT_FIRE, SCF_FORCED_MARCH, SCF_NO_COMBAT_TALK, SCF_NO_MIND_TRICK, SCF_WALKING, gNPC_t::scriptFlags, SetNPCGlobals(), STAT_MAX_HEALTH, playerState_s::stats, SVF_ICARUS_FREEZE, entityShared_t::svFlags, TEAM_FREE, team_t, gNPC_t::tempBehavior, level_locals_t::time, vec3_t, and VectorCopy.

Referenced by NPC_ATST_Pain(), NPC_Droid_Pain(), NPC_GM_Pain(), NPC_Grenadier_Pain(), NPC_Jedi_Pain(), NPC_Mark1_Pain(), NPC_Mark2_Pain(), NPC_Probe_Pain(), NPC_Remote_Pain(), NPC_Seeker_Pain(), NPC_Sentry_Pain(), NPC_Sniper_Pain(), and NPC_ST_Pain().

00364 {
00365         team_t otherTeam = TEAM_FREE;
00366         int             voiceEvent = -1;
00367         gentity_t *other = attacker;
00368         int mod = gPainMOD;
00369         int hitLoc = gPainHitLoc;
00370         vec3_t point;
00371 
00372         VectorCopy(gPainPoint, point);
00373 
00374         if ( self->NPC == NULL ) 
00375                 return;
00376 
00377         if ( other == NULL ) 
00378                 return;
00379 
00380         //or just remove ->pain in player_die?
00381         if ( self->client->ps.pm_type == PM_DEAD )
00382                 return;
00383 
00384         if ( other == self ) 
00385                 return;
00386 
00387         //MCG: Ignore damage from your own team for now
00388         if ( other->client )
00389         {
00390                 otherTeam = other->client->playerTeam;
00391         //      if ( otherTeam == TEAM_DISGUISE )
00392         //      {
00393         //              otherTeam = TEAM_PLAYER;
00394         //      }
00395         }
00396 
00397         if ( self->client->playerTeam 
00398                 && other->client 
00399                 && otherTeam == self->client->playerTeam 
00400         /*      && (!player->client->ps.viewEntity || other->s.number != player->client->ps.viewEntity)*/) 
00401         //rwwFIXMEFIXME: Will need modification when player controllable npcs are done
00402         {//hit by a teammate
00403                 if ( other != self->enemy && self != other->enemy )
00404                 {//we weren't already enemies
00405                         if ( self->enemy || other->enemy 
00406                                 
00407                                 //|| (other->s.number&&other->s.number!=player->client->ps.viewEntity) 
00408                                 //rwwFIXMEFIXME: same
00409 
00410                                 /*|| (!other->s.number&&Q_irand( 0, 3 ))*/ )
00411                         {//if one of us actually has an enemy already, it's okay, just an accident OR wasn't hit by player or someone controlled by player OR player hit ally and didn't get 25% chance of getting mad (FIXME:accumulate anger+base on diff?)
00412                                 //FIXME: player should have to do a certain amount of damage to ally or hit them several times to make them mad
00413                                 //Still run pain and flee scripts
00414                                 if ( self->client && self->NPC )
00415                                 {//Run any pain instructions
00416                                         if ( self->health <= (self->client->ps.stats[STAT_MAX_HEALTH]/3) && G_ActivateBehavior(self, BSET_FLEE) )
00417                                         {
00418                                                 
00419                                         }
00420                                         else// if( VALIDSTRING( self->behaviorSet[BSET_PAIN] ) )
00421                                         {
00422                                                 G_ActivateBehavior(self, BSET_PAIN);
00423                                         }
00424                                 }
00425                                 if ( damage != -1 )
00426                                 {//-1 == don't play pain anim
00427                                         //Set our proper pain animation
00428                                         if ( Q_irand( 0, 1 ) )
00429                                         {
00430                                                 NPC_ChoosePainAnimation( self, other, point, damage, mod, hitLoc, EV_FFWARN );
00431                                         }
00432                                         else
00433                                         {
00434                                                 NPC_ChoosePainAnimation( self, other, point, damage, mod, hitLoc, -1 );
00435                                         }
00436                                 }
00437                                 return;
00438                         }
00439                         else if ( self->NPC && !other->s.number )//should be assumed, but...
00440                         {//dammit, stop that!
00441                                 if ( self->NPC->charmedTime )
00442                                 {//mindtricked
00443                                         return;
00444                                 }
00445                                 else if ( self->NPC->ffireCount < 3+((2-g_spskill.integer)*2) )
00446                                 {//not mad enough yet
00447                                         //Com_Printf( "chck: %d < %d\n", self->NPC->ffireCount, 3+((2-g_spskill.integer)*2) );
00448                                         if ( damage != -1 )
00449                                         {//-1 == don't play pain anim
00450                                                 //Set our proper pain animation
00451                                                 if ( Q_irand( 0, 1 ) )
00452                                                 {
00453                                                         NPC_ChoosePainAnimation( self, other, point, damage, mod, hitLoc, EV_FFWARN );
00454                                                 }
00455                                                 else
00456                                                 {
00457                                                         NPC_ChoosePainAnimation( self, other, point, damage, mod, hitLoc, -1 );
00458                                                 }
00459                                         }
00460                                         return;
00461                                 }
00462                                 else if ( G_ActivateBehavior( self, BSET_FFIRE ) )
00463                                 {//we have a specific script to run, so do that instead
00464                                         return;
00465                                 }
00466                                 else
00467                                 {//okay, we're going to turn on our ally, we need to set and lock our enemy and put ourselves in a bstate that lets us attack him (and clear any flags that would stop us)
00468                                         self->NPC->blockedSpeechDebounceTime = 0;
00469                                         voiceEvent = EV_FFTURN;
00470                                         self->NPC->behaviorState = self->NPC->tempBehavior = self->NPC->defaultBehavior = BS_DEFAULT;
00471                                         other->flags &= ~FL_NOTARGET;
00472                                         //self->svFlags &= ~(SVF_IGNORE_ENEMIES|SVF_ICARUS_FREEZE|SVF_NO_COMBAT_SOUNDS);
00473                                         self->r.svFlags &= ~SVF_ICARUS_FREEZE;
00474                                         G_SetEnemy( self, other );
00475                                         //self->svFlags |= SVF_LOCKEDENEMY; //rwwFIXMEFIXME: proper support for these flags.
00476                                         self->NPC->scriptFlags &= ~(SCF_DONT_FIRE|SCF_CROUCHED|SCF_WALKING|SCF_NO_COMBAT_TALK|SCF_FORCED_MARCH);
00477                                         self->NPC->scriptFlags |= (SCF_CHASE_ENEMIES|SCF_NO_MIND_TRICK);
00478                                         //NOTE: we also stop ICARUS altogether
00479                                         //stop_icarus = qtrue;
00480                                         //rwwFIXMEFIXME: stop icarus?
00481                                         if ( !killPlayerTimer )
00482                                         {
00483                                                 killPlayerTimer = level.time + 10000;
00484                                         }
00485                                 }
00486                         }
00487                 }
00488         }
00489 
00490         SaveNPCGlobals();
00491         SetNPCGlobals( self );
00492 
00493         //Do extra bits
00494         if ( NPCInfo->ignorePain == qfalse )
00495         {
00496                 NPCInfo->confusionTime = 0;//clear any charm or confusion, regardless
00497                 if ( damage != -1 )
00498                 {//-1 == don't play pain anim
00499                         //Set our proper pain animation
00500                         NPC_ChoosePainAnimation( self, other, point, damage, mod, hitLoc, voiceEvent );
00501                 }
00502                 //Check to take a new enemy
00503                 if ( NPC->enemy != other && NPC != other )
00504                 {//not already mad at them
00505                         NPC_CheckAttacker( other, mod );
00506                 }
00507         }
00508 
00509         //Attempt to run any pain instructions
00510         if ( self->client && self->NPC )
00511         {
00512                 //FIXME: This needs better heuristics perhaps
00513                 if(self->health <= (self->client->ps.stats[STAT_MAX_HEALTH]/3) && G_ActivateBehavior(self, BSET_FLEE) )
00514                 {
00515                 }
00516                 else //if( VALIDSTRING( self->behaviorSet[BSET_PAIN] ) )
00517                 {
00518                         G_ActivateBehavior(self, BSET_PAIN);
00519                 }
00520         }
00521 
00522         //Attempt to fire any paintargets we might have
00523         if( self->paintarget && self->paintarget[0] )
00524         {
00525                 G_UseTargets2(self, other, self->paintarget);
00526         }
00527 
00528         RestoreNPCGlobals();
00529 }

PAIN_FUNC* NPC_PainFunc gentity_t ent  ) 
 

Definition at line 103 of file NPC_spawn.c.

References CLASS_ATST, CLASS_GALAKMECH, CLASS_GONK, CLASS_HOWLER, CLASS_INTERROGATOR, CLASS_MARK1, CLASS_MARK2, CLASS_MINEMONSTER, CLASS_MOUSE, CLASS_PROBE, CLASS_PROTOCOL, CLASS_R2D2, CLASS_R5D2, CLASS_RANCOR, CLASS_REMOTE, CLASS_SEEKER, CLASS_SENTRY, CLASS_STORMTROOPER, CLASS_SWAMPTROOPER, CLASS_WAMPA, gentity_s::client, gentity_t, NPC_ATST_Pain(), gclient_s::NPC_class, NPC_Droid_Pain(), NPC_GM_Pain(), NPC_Howler_Pain(), NPC_Jedi_Pain(), NPC_Mark1_Pain(), NPC_Mark2_Pain(), NPC_MineMonster_Pain(), NPC_Pain(), NPC_Probe_Pain(), NPC_Rancor_Pain(), NPC_Remote_Pain(), NPC_Seeker_Pain(), NPC_Sentry_Pain(), NPC_ST_Pain(), NPC_Wampa_Pain(), PAIN_FUNC, gclient_s::ps, playerState_s::weapon, and WP_SABER.

Referenced by NPC_Begin().

00104 {
00105         void (*func)(gentity_t *self, gentity_t *attacker, int damage);
00106 
00107         if ( ent->client->ps.weapon == WP_SABER )
00108         {
00109                 func = NPC_Jedi_Pain;
00110         }
00111         else
00112         {
00113                 // team no longer indicates race/species, use NPC_class to determine different npc types
00114                 /*
00115                 switch ( ent->client->playerTeam )
00116                 {
00117                 default:
00118                         func = painF_NPC_Pain;
00119                         break;
00120                 }
00121                 */
00122                 switch( ent->client->NPC_class )
00123                 {
00124                 // troopers get special pain
00125                 case CLASS_STORMTROOPER:
00126                 case CLASS_SWAMPTROOPER:
00127                         func = NPC_ST_Pain;
00128                         break;
00129 
00130                 case CLASS_SEEKER:
00131                         func = NPC_Seeker_Pain;
00132                         break;
00133 
00134                 case CLASS_REMOTE:
00135                         func = NPC_Remote_Pain;
00136                         break;
00137 
00138                 case CLASS_MINEMONSTER:
00139                         func = NPC_MineMonster_Pain;
00140                         break;
00141 
00142                 case CLASS_HOWLER:
00143                         func = NPC_Howler_Pain;
00144                         break;
00145 
00146                 // all other droids, did I miss any?
00147                 case CLASS_GONK:
00148                 case CLASS_R2D2:
00149                 case CLASS_R5D2:
00150                 case CLASS_MOUSE:
00151                 case CLASS_PROTOCOL:
00152                 case CLASS_INTERROGATOR:
00153                         func = NPC_Droid_Pain;
00154                         break;
00155                 case CLASS_PROBE:
00156                         func = NPC_Probe_Pain;
00157                         break;
00158 
00159                 case CLASS_SENTRY:
00160                         func = NPC_Sentry_Pain;
00161                         break;
00162                 case CLASS_MARK1:
00163                         func = NPC_Mark1_Pain;
00164                         break;
00165                 case CLASS_MARK2:
00166                         func = NPC_Mark2_Pain;
00167                         break;
00168                 case CLASS_ATST:  
00169                         func = NPC_ATST_Pain;
00170                         break;
00171                 case CLASS_GALAKMECH:
00172                         func = NPC_GM_Pain;
00173                         break;
00174                 case CLASS_RANCOR:
00175                         func = NPC_Rancor_Pain;
00176                         break;
00177                 case CLASS_WAMPA:
00178                         func = NPC_Wampa_Pain;
00179                         break;
00180                 // everyone else gets the normal pain func
00181                 default:
00182                         func = NPC_Pain;
00183                         break;
00184                 }
00185 
00186         }
00187 
00188         return func;
00189 }

void NPC_Precache gentity_t spawner  ) 
 

Definition at line 599 of file NPC_stats.c.

References BG_FindItemForWeapon(), BG_ParseLiteral(), CLASS_VEHICLE, gentity_s::client, COM_BeginParseSession(), COM_ParseExt(), COM_ParseString(), Com_Printf(), Com_sprintf(), entityState_s::csSounds_Combat, entityState_s::csSounds_Extra, entityState_s::csSounds_Jedi, entityState_s::csSounds_Std, G_ModelIndex(), G_SoundIndex(), gentity_t, GetIDForString(), MAX_QPATH, gclient_s::NPC_class, NPC_PrecacheWeapons(), gentity_s::NPC_type, NPCFile, NPCParms, NPCTEAM_FREE, npcteam_t, Q_stricmp(), Q_strncpyz(), qboolean, qfalse, qtrue, gentity_s::r, RegisterItem(), gentity_s::s, S_COLOR_RED, SkipBracedSection(), gentity_s::spawnflags, strcat(), strcpy(), strstr(), SVF_NO_BASIC_SOUNDS, SVF_NO_COMBAT_SOUNDS, SVF_NO_EXTRA_SOUNDS, entityShared_t::svFlags, team_t, TeamTable, va(), weapon_t, WP_NONE, WP_NUM_WEAPONS, and WPTable.

Referenced by NPC_ParseParms(), NPC_PrecacheType(), and SP_NPC_spawner().

00600 {
00601         npcteam_t                       playerTeam = NPCTEAM_FREE;
00602         const char      *token;
00603         const char      *value;
00604         const char      *p;
00605         char    *patch;
00606         char    sound[MAX_QPATH];
00607         qboolean        md3Model = qfalse;
00608         char    playerModel[MAX_QPATH];
00609         char    customSkin[MAX_QPATH];
00610 
00611         if ( !Q_stricmp( "random", spawner->NPC_type ) )
00612         {//sorry, can't precache a random just yet
00613                 return;
00614         }
00615         strcpy(customSkin,"default");
00616 
00617         p = NPCParms;
00618         COM_BeginParseSession(NPCFile);
00619 
00620         // look for the right NPC
00621         while ( p ) 
00622         {
00623                 token = COM_ParseExt( &p, qtrue );
00624                 if ( token[0] == 0 )
00625                         return;
00626 
00627                 if ( !Q_stricmp( token, spawner->NPC_type ) ) 
00628                 {
00629                         break;
00630                 }
00631 
00632                 SkipBracedSection( &p );
00633         }
00634 
00635         if ( !p ) 
00636         {
00637                 return;
00638         }
00639 
00640         if ( BG_ParseLiteral( &p, "{" ) ) 
00641         {
00642                 return;
00643         }
00644 
00645         // parse the NPC info block
00646         while ( 1 ) 
00647         {
00648                 token = COM_ParseExt( &p, qtrue );
00649                 if ( !token[0] ) 
00650                 {
00651                         Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", spawner->NPC_type );
00652                         return;
00653                 }
00654 
00655                 if ( !Q_stricmp( token, "}" ) ) 
00656                 {
00657                         break;
00658                 }
00659 
00660                 // headmodel
00661                 if ( !Q_stricmp( token, "headmodel" ) ) 
00662                 {
00663                         if ( COM_ParseString( &p, &value ) ) 
00664                         {
00665                                 continue;
00666                         }
00667 
00668                         if(!Q_stricmp("none", value))
00669                         {
00670                         }
00671                         else
00672                         {
00673                                 //Q_strncpyz( ri.headModelName, value, sizeof(ri.headModelName), qtrue);
00674                         }
00675                         md3Model = qtrue;
00676                         continue;
00677                 }
00678                 
00679                 // torsomodel
00680                 if ( !Q_stricmp( token, "torsomodel" ) ) 
00681                 {
00682                         if ( COM_ParseString( &p, &value ) ) 
00683                         {
00684                                 continue;
00685                         }
00686 
00687                         if(!Q_stricmp("none", value))
00688                         {
00689                         }
00690                         else
00691                         {
00692                                 //Q_strncpyz( ri.torsoModelName, value, sizeof(ri.torsoModelName), qtrue);
00693                         }
00694                         md3Model = qtrue;
00695                         continue;
00696                 }
00697 
00698                 // legsmodel
00699                 if ( !Q_stricmp( token, "legsmodel" ) ) 
00700                 {
00701                         if ( COM_ParseString( &p, &value ) ) 
00702                         {
00703                                 continue;
00704                         }
00705                         //Q_strncpyz( ri.legsModelName, value, sizeof(ri.legsModelName), qtrue);                        
00706                         md3Model = qtrue;
00707                         continue;
00708                 }
00709 
00710                 // playerModel
00711                 if ( !Q_stricmp( token, "playerModel" ) ) 
00712                 {
00713                         if ( COM_ParseString( &p, &value ) ) 
00714                         {
00715                                 continue;
00716                         }
00717                         Q_strncpyz( playerModel, value, sizeof(playerModel));                   
00718                         md3Model = qfalse;
00719                         continue;
00720                 }
00721 
00722                 // customSkin
00723                 if ( !Q_stricmp( token, "customSkin" ) ) 
00724                 {
00725                         if ( COM_ParseString( &p, &value ) ) 
00726                         {
00727                                 continue;
00728                         }
00729                         Q_strncpyz( customSkin, value, sizeof(customSkin));                     
00730                         continue;
00731                 }
00732 
00733                 // playerTeam
00734                 if ( !Q_stricmp( token, "playerTeam" ) ) 
00735                 {
00736                         char tk[4096]; //rww - hackilicious!
00737 
00738                         if ( COM_ParseString( &p, &value ) ) 
00739                         {
00740                                 continue;
00741                         }
00742                         //playerTeam = TranslateTeamName(value);
00743                         Com_sprintf(tk, sizeof(tk), "NPC%s", token);
00744                         playerTeam = (team_t)GetIDForString( TeamTable, tk );
00745                         continue;
00746                 }
00747 
00748         
00749                 // snd
00750                 if ( !Q_stricmp( token, "snd" ) ) {
00751                         if ( COM_ParseString( &p, &value ) ) {
00752                                 continue;
00753                         }
00754                         if ( !(spawner->r.svFlags&SVF_NO_BASIC_SOUNDS) )
00755                         {
00756                                 //FIXME: store this in some sound field or parse in the soundTable like the animTable...
00757                                 Q_strncpyz( sound, value, sizeof( sound ) );
00758                                 patch = strstr( sound, "/" );
00759                                 if ( patch ) 
00760                                 {
00761                                         *patch = 0;
00762                                 }
00763                                 spawner->s.csSounds_Std = G_SoundIndex( va("*$%s", sound) );
00764                         }
00765                         continue;
00766                 }
00767 
00768                 // sndcombat
00769                 if ( !Q_stricmp( token, "sndcombat" ) ) {
00770                         if ( COM_ParseString( &p, &value ) ) {
00771                                 continue;
00772                         }
00773                         if ( !(spawner->r.svFlags&SVF_NO_COMBAT_SOUNDS) )
00774                         {
00775                                 //FIXME: store this in some sound field or parse in the soundTable like the animTable...
00776                                 Q_strncpyz( sound, value, sizeof( sound ) );
00777                                 patch = strstr( sound, "/" );
00778                                 if ( patch ) 
00779                                 {
00780                                         *patch = 0;
00781                                 }
00782                                 spawner->s.csSounds_Combat = G_SoundIndex( va("*$%s", sound) );
00783                         }
00784                         continue;
00785                 }
00786                 
00787                 // sndextra
00788                 if ( !Q_stricmp( token, "sndextra" ) ) {
00789                         if ( COM_ParseString( &p, &value ) ) {
00790                                 continue;
00791                         }
00792                         if ( !(spawner->r.svFlags&SVF_NO_EXTRA_SOUNDS) )
00793                         {
00794                                 //FIXME: store this in some sound field or parse in the soundTable like the animTable...
00795                                 Q_strncpyz( sound, value, sizeof( sound ) );
00796                                 patch = strstr( sound, "/" );
00797                                 if ( patch ) 
00798                                 {
00799                                         *patch = 0;
00800                                 }
00801                                 spawner->s.csSounds_Extra = G_SoundIndex( va("*$%s", sound) );
00802                         }
00803                         continue;
00804                 }
00805 
00806                 // sndjedi
00807                 if ( !Q_stricmp( token, "sndjedi" ) ) {
00808                         if ( COM_ParseString( &p, &value ) ) {
00809                                 continue;
00810                         }
00811                         if ( !(spawner->r.svFlags&SVF_NO_EXTRA_SOUNDS) )
00812                         {
00813                                 //FIXME: store this in some sound field or parse in the soundTable like the animTable...
00814                                 Q_strncpyz( sound, value, sizeof( sound ) );
00815                                 patch = strstr( sound, "/" );
00816                                 if ( patch ) 
00817                                 {
00818                                         *patch = 0;
00819                                 }
00820                                 spawner->s.csSounds_Jedi = G_SoundIndex( va("*$%s", sound) );
00821                         }
00822                         continue;
00823                 }
00824 
00825                 if (!Q_stricmp(token, "weapon"))
00826                 {
00827                         int curWeap;
00828 
00829                         if (COM_ParseString(&p, &value))
00830                         {
00831                                 continue;
00832                         }
00833 
00834                         curWeap = GetIDForString( WPTable, value );
00835 
00836                         if (curWeap > WP_NONE && curWeap < WP_NUM_WEAPONS)
00837                         {
00838                                 RegisterItem(BG_FindItemForWeapon((weapon_t)curWeap));
00839                         }
00840                         continue;
00841                 }
00842         }
00843 
00844         // If we're not a vehicle, then an error here would be valid...
00845         if ( !spawner->client || spawner->client->NPC_class != CLASS_VEHICLE )
00846         {
00847                 if ( md3Model )
00848                 {
00849                         Com_Printf("MD3 model using NPCs are not supported in MP\n");
00850                 }
00851                 else
00852                 { //if we have a model/skin then index them so they'll be registered immediately
00853                         //when the client gets a configstring update.
00854                         char modelName[MAX_QPATH];
00855 
00856                         Com_sprintf(modelName, sizeof(modelName), "models/players/%s/model.glm", playerModel);
00857                         if (customSkin[0])
00858                         { //append it after a *
00859                                 strcat( modelName, va("*%s", customSkin) );
00860                         }
00861 
00862                         G_ModelIndex(modelName);
00863                 }
00864         }
00865 
00866         //precache this NPC's possible weapons
00867         NPC_PrecacheWeapons( playerTeam, spawner->spawnflags, spawner->NPC_type );
00868 
00869 //      CG_RegisterNPCCustomSounds( &ci );
00870 //      CG_RegisterNPCEffects( playerTeam );
00871         //rwwFIXMEFIXME: same
00872         //FIXME: Look for a "sounds" directory and precache death, pain, alert sounds
00873 }

void NPC_PrecacheAnimationCFG const char *  NPC_type  ) 
 

Definition at line 439 of file NPC_stats.c.

References BG_ParseLiteral(), COM_BeginParseSession(), COM_ParseExt(), COM_ParseString(), Com_Printf(), G_ParseAnimFileSet(), MAX_QPATH, NPCFile, NPCParms, Q_stricmp(), Q_strncpyz(), qtrue, S_COLOR_RED, and SkipBracedSection().

Referenced by SP_NPC_spawner().

00440 {
00441 #if 0 //rwwFIXMEFIXME: Actually precache stuff here.
00442         char    filename[MAX_QPATH];
00443         const char      *token;
00444         const char      *value;
00445         const char      *p;
00446         int             junk;
00447 
00448         if ( !Q_stricmp( "random", NPC_type ) )
00449         {//sorry, can't precache a random just yet
00450                 return;
00451         }
00452 
00453         p = NPCParms;
00454         COM_BeginParseSession(NPCFile);
00455 
00456         // look for the right NPC
00457         while ( p ) 
00458         {
00459                 token = COM_ParseExt( &p, qtrue );
00460                 if ( token[0] == 0 )
00461                         return;
00462 
00463                 if ( !Q_stricmp( token, NPC_type ) ) 
00464                 {
00465                         break;
00466                 }
00467 
00468                 SkipBracedSection( &p );
00469         }
00470 
00471         if ( !p ) 
00472         {
00473                 return;
00474         }
00475 
00476         if ( BG_ParseLiteral( &p, "{" ) ) 
00477         {
00478                 return;
00479         }
00480 
00481         // parse the NPC info block
00482         while ( 1 ) 
00483         {
00484                 token = COM_ParseExt( &p, qtrue );
00485                 if ( !token[0] ) 
00486                 {
00487                         Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", NPC_type );
00488                         return;
00489                 }
00490 
00491                 if ( !Q_stricmp( token, "}" ) ) 
00492                 {
00493                         break;
00494                 }
00495 
00496                 // legsmodel
00497                 if ( !Q_stricmp( token, "legsmodel" ) ) 
00498                 {
00499                         if ( COM_ParseString( &p, &value ) ) 
00500                         {
00501                                 continue;
00502                         }
00503                         //must copy data out of this pointer into a different part of memory because the funcs we're about to call will call COM_ParseExt
00504                         Q_strncpyz( filename, value, sizeof( filename ) );
00505                         G_ParseAnimFileSet( filename, filename, &junk );
00506                         return;
00507                 }
00508 
00509                 // playerModel
00510                 if ( !Q_stricmp( token, "playerModel" ) ) 
00511                 {
00512                         if ( COM_ParseString( &p, &value ) ) 
00513                         {
00514                                 continue;
00515                         }
00516                         /*
00517                         char    animName[MAX_QPATH];
00518                         char    *GLAName;
00519                         char    *slash = NULL;
00520                         char    *strippedName;
00521                         
00522                         int handle = gi.G2API_PrecacheGhoul2Model( va( "models/players/%s/model.glm", value ) );
00523                         if ( handle > 0 )//FIXME: isn't 0 a valid handle?
00524                         {
00525                                 GLAName = gi.G2API_GetAnimFileNameIndex( handle );
00526                                 if ( GLAName )
00527                                 {
00528                                         Q_strncpyz( animName, GLAName, sizeof( animName ), qtrue );
00529                                         slash = strrchr( animName, '/' );
00530                                         if ( slash )
00531                                         {
00532                                                 *slash = 0;
00533                                         }
00534                                         strippedName = COM_SkipPath( animName );
00535 
00536                                         //must copy data out of this pointer into a different part of memory because the funcs we're about to call will call COM_ParseExt
00537                                         Q_strncpyz( filename, value, sizeof( filename ), qtrue );
00538                                         G_ParseAnimFileSet( value, strippedName, &junk );//qfalse );
00539                                         //FIXME: still not precaching the animsounds.cfg?
00540                                         return;
00541                                 }
00542                         }
00543                         */
00544                         //rwwFIXMEFIXME: Do this properly.
00545                 }
00546         }
00547 #endif
00548 }

void NPC_PrecacheType char *  NPC_type  ) 
 

Definition at line 1955 of file NPC_spawn.c.

References G_FreeEntity(), G_Spawn(), gentity_t, NPC_Precache(), and gentity_s::NPC_type.

Referenced by NPC_VehiclePrecache().

01956 {
01957         gentity_t *fakespawner = G_Spawn();
01958         if ( fakespawner )
01959         {
01960                 fakespawner->NPC_type = NPC_type;
01961                 NPC_Precache( fakespawner );
01962                 //NOTE: does the spawner have to stay around to send any precached info to the clients...?
01963                 G_FreeEntity( fakespawner );
01964         }
01965 }

void NPC_PrintScore gentity_t ent  ) 
 

Definition at line 4166 of file NPC_spawn.c.

References gentity_s::client, Com_Printf(), gentity_t, PERS_SCORE, playerState_s::persistant, gclient_s::ps, and gentity_s::targetname.

Referenced by Cmd_NPC_f().

04167 {
04168         Com_Printf( "%s: %d\n", ent->targetname, ent->client->ps.persistant[PERS_SCORE] );
04169 }

void NPC_Probe_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 433 of file NPC_AI_ImperialProbe.c.

References entityState_s::angles, BOTH_PAIN1, gentity_s::client, entityShared_t::currentOrigin, playerState_s::electrifyTime, trace_t::fraction, gentity_t, gPainMOD, gentity_s::health, gNPC_t::lastPathAngles, level, gNPC_t::localState, LSTATE_DROP, MASK_SOLID, MOD_DEMP2, MOD_DEMP2_ALT, gentity_s::NPC, NPC_GetPainChance(), NPC_Pain(), NPC_SetAnim(), NULL, entityState_s::number, gclient_s::ps, gentity_s::r, random, gentity_s::s, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, level_locals_t::time, trap_Trace(), vec3_t, VectorCopy, VectorMA, VectorNormalize(), VectorSet, VectorSubtract, and playerState_s::velocity.

Referenced by NPC_PainFunc().

00434 {
00435         float   pain_chance;
00436         gentity_t *other = attacker;
00437         int mod = gPainMOD;
00438         
00439         VectorCopy( self->NPC->lastPathAngles, self->s.angles );
00440 
00441         if ( self->health < 30 || mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT ) // demp2 always messes them up real good
00442         {
00443                 vec3_t endPos;
00444                 trace_t trace;
00445 
00446                 VectorSet( endPos, self->r.currentOrigin[0], self->r.currentOrigin[1], self->r.currentOrigin[2] - 128 );
00447                 trap_Trace( &trace, self->r.currentOrigin, NULL, NULL, endPos, self->s.number, MASK_SOLID );
00448 
00449                 if ( trace.fraction == 1.0f || mod == MOD_DEMP2 ) // demp2 always does this
00450                 {
00451                         /*
00452                         if (self->client->clientInfo.headModel != 0)
00453                         {
00454                                 vec3_t origin;
00455 
00456                                 VectorCopy(self->r.currentOrigin,origin);
00457                                 origin[2] +=50;
00458 //                              G_PlayEffect( "small_chunks", origin );
00459                                 G_PlayEffect( "chunks/probehead", origin );
00460                                 G_PlayEffect( "env/med_explode2", origin );
00461                                 self->client->clientInfo.headModel = 0;
00462                                 self->client->moveType = MT_RUNJUMP;
00463                                 self->client->ps.gravity = g_gravity->value*.1;
00464                         }
00465                         */
00466                         
00467                         if ( (mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT) && other )
00468                         {
00469                                 vec3_t dir;
00470 
00471                                 NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD);
00472 
00473                                 VectorSubtract( self->r.currentOrigin, other->r.currentOrigin, dir );
00474                                 VectorNormalize( dir );
00475 
00476                                 VectorMA( self->client->ps.velocity, 550, dir, self->client->ps.velocity );
00477                                 self->client->ps.velocity[2] -= 127;
00478                         }
00479 
00480                         //self->s.powerups |= ( 1 << PW_SHOCKED );
00481                         //self->client->ps.powerups[PW_SHOCKED] = level.time + 3000;
00482                         self->client->ps.electrifyTime = level.time + 3000;
00483 
00484                         self->NPC->localState = LSTATE_DROP;
00485                 } 
00486         }
00487         else
00488         {
00489                 pain_chance = NPC_GetPainChance( self, damage );
00490 
00491                 if ( random() < pain_chance )   // Spin around in pain?
00492                 {
00493                         NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE);
00494                 }       
00495         }
00496 
00497         NPC_Pain( self, attacker, damage );
00498 }

void NPC_Probe_Precache void   ) 
 

Definition at line 21 of file NPC_AI_ImperialProbe.c.

References AMMO_BLASTER, BG_FindItemForAmmo(), BG_FindItemForWeapon(), G_EffectIndex(), G_SoundIndex(), RegisterItem(), va(), and WP_BRYAR_PISTOL.

Referenced by NPC_SpawnType(), and SP_NPC_Droid_Probe().

00022 {
00023         int i;
00024 
00025         for ( i = 1; i < 4; i++)
00026         {
00027                 G_SoundIndex( va( "sound/chars/probe/misc/probetalk%d", i ) );
00028         }
00029         G_SoundIndex( "sound/chars/probe/misc/probedroidloop" );
00030         G_SoundIndex("sound/chars/probe/misc/anger1");
00031         G_SoundIndex("sound/chars/probe/misc/fire");
00032 
00033         G_EffectIndex( "chunks/probehead" );
00034         G_EffectIndex( "env/med_explode2" );
00035         G_EffectIndex( "explosions/probeexplosion1");
00036         G_EffectIndex( "bryar/muzzle_flash" );
00037 
00038         RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER ));
00039         RegisterItem( BG_FindItemForWeapon( WP_BRYAR_PISTOL ) );
00040 }

void NPC_Protocol_Precache void   ) 
 

Definition at line 537 of file NPC_AI_Droid.c.

References G_EffectIndex(), and G_SoundIndex().

Referenced by NPC_SpawnType(), and SP_NPC_Droid_Protocol().

00538 {
00539         G_SoundIndex( "sound/chars/mark2/misc/mark2_explo" );
00540         G_EffectIndex( "env/med_explode");
00541 }

void NPC_R2D2_Precache void   ) 
 

Definition at line 497 of file NPC_AI_Droid.c.

References G_EffectIndex(), G_SoundIndex(), and va().

Referenced by NPC_SpawnType(), and SP_NPC_Droid_R2D2().

00498 {
00499         int i;
00500 
00501         for ( i = 1; i < 4; i++)
00502         {
00503                 G_SoundIndex( va( "sound/chars/r2d2/misc/r2d2talk0%d.wav", i ) );
00504         }
00505         //G_SoundIndex( "sound/chars/r2d2/misc/falling1.wav" );
00506         G_SoundIndex( "sound/chars/mark2/misc/mark2_explo" ); // ??
00507         G_SoundIndex( "sound/chars/r2d2/misc/r2_move_lp.wav" );
00508         G_EffectIndex( "env/med_explode");
00509         G_EffectIndex( "volumetric/droid_smoke" );
00510         G_EffectIndex("sparks/spark");
00511         G_EffectIndex( "chunks/r2d2head");
00512         G_EffectIndex( "chunks/r2d2head_veh");
00513 }

void NPC_R5D2_Precache void   ) 
 

Definition at line 474 of file NPC_AI_Droid.c.

References G_EffectIndex(), G_SoundIndex(), and va().

Referenced by NPC_SpawnType(), and SP_NPC_Droid_R5D2().

00475 {
00476         int i;
00477 
00478         for ( i = 1; i < 5; i++)
00479         {
00480                 G_SoundIndex( va( "sound/chars/r5d2/misc/r5talk%d.wav", i ) );
00481         }
00482         //G_SoundIndex( "sound/chars/r5d2/misc/falling1.wav" );
00483         G_SoundIndex( "sound/chars/mark2/misc/mark2_explo" ); // ??
00484         G_SoundIndex( "sound/chars/r2d2/misc/r2_move_lp2.wav" );
00485         G_EffectIndex( "env/med_explode");
00486         G_EffectIndex( "volumetric/droid_smoke" );
00487         G_EffectIndex("sparks/spark");
00488         G_EffectIndex( "chunks/r5d2head");
00489         G_EffectIndex( "chunks/r5d2head_veh");
00490 }

void NPC_Rancor_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 703 of file NPC_AI_Rancor.c.

References gentity_s::activator, entityState_s::angles, BOTH_ATTACK2, BOTH_MELEE1, BOTH_MELEE2, BOTH_PAIN1, BOTH_PAIN2, BOTH_STAND1TO2, CLASS_RANCOR, gentity_s::client, gNPC_t::consecutiveBlockedMoves, gentity_s::count, entityShared_t::currentOrigin, gentity_s::enemy, FL_NOTARGET, gentity_s::flags, G_SetEnemy(), gentity_t, gentity_s::health, gentity_s::inuse, gNPC_t::lastPathAngles, playerState_s::legsAnim, playerState_s::legsTimer, gNPC_t::localState, LSTATE_WAITING, gentity_s::NPC, gclient_s::NPC_class, NPC_SetAnim(), entityState_s::number, gclient_s::ps, Q_irand(), qboolean, qfalse, qtrue, gentity_s::r, Rancor_CheckRoar(), gentity_s::s, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, TIMER_Done(), TIMER_Remove(), TIMER_Set(), and VectorCopy.

Referenced by NPC_PainFunc(), and NPC_SetMiscDefaultData().

00704 {
00705         qboolean hitByRancor = qfalse;
00706         if ( attacker&&attacker->client&&attacker->client->NPC_class==CLASS_RANCOR )
00707         {
00708                 hitByRancor = qtrue;
00709         }
00710         if ( attacker 
00711                 && attacker->inuse 
00712                 && attacker != self->enemy
00713                 && !(attacker->flags&FL_NOTARGET) )
00714         {
00715                 if ( !self->count )
00716                 {
00717                         if ( (!attacker->s.number&&!Q_irand(0,3))
00718                                 || !self->enemy
00719                                 || self->enemy->health == 0
00720                                 || (self->enemy->client&&self->enemy->client->NPC_class == CLASS_RANCOR)
00721                                 || (self->NPC && self->NPC->consecutiveBlockedMoves>=10 && DistanceSquared( attacker->r.currentOrigin, self->r.currentOrigin ) < DistanceSquared( self->enemy->r.currentOrigin, self->r.currentOrigin )) ) 
00722                         {//if my enemy is dead (or attacked by player) and I'm not still holding/eating someone, turn on the attacker
00723                                 //FIXME: if can't nav to my enemy, take this guy if I can nav to him
00724                                 G_SetEnemy( self, attacker );
00725                                 TIMER_Set( self, "lookForNewEnemy", Q_irand( 5000, 15000 ) );
00726                                 if ( hitByRancor )
00727                                 {//stay mad at this Rancor for 2-5 secs before looking for attacker enemies
00728                                         TIMER_Set( self, "rancorInfight", Q_irand( 2000, 5000 ) );
00729                                 }
00730 
00731                         }
00732                 }
00733         }
00734         if ( (hitByRancor|| (self->count==1&&self->activator&&!Q_irand(0,4)) || Q_irand( 0, 200 ) < damage )//hit by rancor, hit while holding live victim, or took a lot of damage
00735                 && self->client->ps.legsAnim != BOTH_STAND1TO2
00736                 && TIMER_Done( self, "takingPain" ) )
00737         {
00738                 if ( !Rancor_CheckRoar( self ) )
00739                 {
00740                         if ( self->client->ps.legsAnim != BOTH_MELEE1
00741                                 && self->client->ps.legsAnim != BOTH_MELEE2
00742                                 && self->client->ps.legsAnim != BOTH_ATTACK2 )
00743                         {//cant interrupt one of the big attack anims
00744                                 /*
00745                                 if ( self->count != 1 
00746                                         || attacker == self->activator
00747                                         || (self->client->ps.legsAnim != BOTH_ATTACK1&&self->client->ps.legsAnim != BOTH_ATTACK3) )
00748                                 */
00749                                 {//if going to bite our victim, only victim can interrupt that anim
00750                                         if ( self->health > 100 || hitByRancor )
00751                                         {
00752                                                 TIMER_Remove( self, "attacking" );
00753 
00754                                                 VectorCopy( self->NPC->lastPathAngles, self->s.angles );
00755 
00756                                                 if ( self->count == 1 )
00757                                                 {
00758                                                         NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN2, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );
00759                                                 }
00760                                                 else
00761                                                 {
00762                                                         NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );
00763                                                 }
00764                                                 TIMER_Set( self, "takingPain", self->client->ps.legsTimer+Q_irand(0, 500) );
00765 
00766                                                 if ( self->NPC )
00767                                                 {
00768                                                         self->NPC->localState = LSTATE_WAITING;
00769                                                 }
00770                                         }
00771                                 }
00772                         }
00773                 }
00774                 //let go
00775                 /*
00776                 if ( !Q_irand( 0, 3 ) && self->count == 1 )
00777                 {
00778                         Rancor_DropVictim( self );
00779                 }
00780                 */
00781         }
00782 }

void NPC_Remote_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 29 of file NPC_AI_Remote.c.

References gentity_t, NPC_Pain(), Remote_Strafe(), RestoreNPCGlobals(), SaveNPCGlobals(), and SetNPCGlobals().

Referenced by NPC_PainFunc().

00030 {
00031         SaveNPCGlobals();
00032         SetNPCGlobals( self );
00033         Remote_Strafe();
00034         RestoreNPCGlobals();
00035 
00036         NPC_Pain( self, attacker, damage );
00037 }

void NPC_Remote_Precache void   ) 
 

Definition at line 17 of file NPC_AI_Remote.c.

References G_EffectIndex(), and G_SoundIndex().

Referenced by NPC_SpawnType(), and SP_NPC_Droid_Remote().

00018 {
00019         G_SoundIndex("sound/chars/remote/misc/fire.wav");
00020         G_SoundIndex( "sound/chars/remote/misc/hiss.wav");
00021         G_EffectIndex( "env/small_explode");
00022 }

void NPC_Seeker_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 34 of file NPC_AI_Seeker.c.

References gNPC_t::aiFlags, G_Damage(), gentity_t, MOD_FALLING, gentity_s::NPC, NPC_Pain(), NPCAI_CUSTOM_GRAVITY, NULL, RestoreNPCGlobals(), SaveNPCGlobals(), Seeker_Strafe(), SetNPCGlobals(), and vec3_origin.

Referenced by NPC_PainFunc().

00035 {
00036         if ( !(self->NPC->aiFlags&NPCAI_CUSTOM_GRAVITY ))
00037         {//void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod, int hitLoc=HL_NONE );
00038                 G_Damage( self, NULL, NULL, (float*)vec3_origin, (float*)vec3_origin, 999, 0, MOD_FALLING );
00039         }
00040 
00041         SaveNPCGlobals();
00042         SetNPCGlobals( self );
00043         Seeker_Strafe();
00044         RestoreNPCGlobals();
00045         NPC_Pain( self, attacker, damage );
00046 }

void NPC_Seeker_Precache void   ) 
 

Definition at line 26 of file NPC_AI_Seeker.c.

References G_EffectIndex(), and G_SoundIndex().

Referenced by NPC_SpawnType(), and SP_NPC_Droid_Seeker().

00027 {
00028         G_SoundIndex("sound/chars/seeker/misc/fire.wav");
00029         G_SoundIndex( "sound/chars/seeker/misc/hiss.wav");
00030         G_EffectIndex( "env/small_explode");
00031 }

void NPC_Sentry_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 79 of file NPC_AI_Sentry.c.

References BOTH_FLY_SHIELDED, gNPC_t::burstCount, CHAN_AUTO, FL_SHIELDED, gentity_s::flags, G_Sound(), G_SoundIndex(), gentity_t, gPainMOD, gNPC_t::localState, LSTATE_ACTIVE, MOD_DEMP2, MOD_DEMP2_ALT, gentity_s::NPC, NPC_Pain(), NPC_SetAnim(), Q_irand(), SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, and TIMER_Set().

Referenced by NPC_PainFunc().

00080 {               
00081         int mod = gPainMOD;
00082 
00083         NPC_Pain( self, attacker, damage );
00084 
00085         if ( mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT )
00086         {
00087                 self->NPC->burstCount = 0;
00088                 TIMER_Set( self, "attackDelay", Q_irand( 9000, 12000) );
00089                 self->flags |= FL_SHIELDED;
00090                 NPC_SetAnim( self, SETANIM_BOTH, BOTH_FLY_SHIELDED, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00091                 G_Sound( self, CHAN_AUTO, G_SoundIndex("sound/chars/sentry/misc/sentry_pain") );                
00092 
00093                 self->NPC->localState = LSTATE_ACTIVE;
00094         }
00095 
00096         // You got hit, go after the enemy
00097 //      if (self->NPC->localState == LSTATE_ASLEEP)
00098 //      {
00099 //              G_Sound( self, G_SoundIndex("sound/chars/sentry/misc/shieldsopen.wav"));
00100 //
00101 //              self->flags &= ~FL_SHIELDED;
00102 //              NPC_SetAnim( self, SETANIM_BOTH, BOTH_POWERUP1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
00103 //              self->NPC->localState = LSTATE_WAKEUP;
00104 //      }
00105 }

void NPC_Sentry_Precache void   ) 
 

Definition at line 37 of file NPC_AI_Sentry.c.

References AMMO_BLASTER, BG_FindItemForAmmo(), G_EffectIndex(), G_SoundIndex(), RegisterItem(), and va().

Referenced by NPC_SpawnType(), and SP_NPC_Droid_Sentry().

00038 {
00039         int i;
00040 
00041         G_SoundIndex( "sound/chars/sentry/misc/sentry_explo" );
00042         G_SoundIndex( "sound/chars/sentry/misc/sentry_pain" );
00043         G_SoundIndex( "sound/chars/sentry/misc/sentry_shield_open" );
00044         G_SoundIndex( "sound/chars/sentry/misc/sentry_shield_close" );
00045         G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_1_lp" );
00046         G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_2_lp" );
00047 
00048         for ( i = 1; i < 4; i++)
00049         {
00050                 G_SoundIndex( va( "sound/chars/sentry/misc/talk%d", i ) );
00051         }
00052 
00053         G_EffectIndex( "bryar/muzzle_flash");
00054         G_EffectIndex( "env/med_explode");
00055 
00056         RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER ));
00057 }

void NPC_SetFX_SpawnStates gentity_t ent  ) 
 

Definition at line 817 of file NPC_spawn.c.

References gNPC_t::aiFlags, gentity_s::client, g_gravity, gentity_t, playerState_s::gravity, gentity_s::NPC, NPCAI_CUSTOM_GRAVITY, gclient_s::ps, and vmCvar_t::value.

Referenced by NPC_Begin().

00818 {
00819         if ( !(ent->NPC->aiFlags&NPCAI_CUSTOM_GRAVITY) )
00820         {
00821                 ent->client->ps.gravity = g_gravity.value;
00822         }
00823 }

void NPC_SetMiscDefaultData gentity_t ent  ) 
 

Definition at line 215 of file NPC_spawn.c.

References gentity_s::activator, gNPC_t::aiFlags, gNPC_t::behaviorState, Boba_Precache(), BS_CINEMATIC, BS_DEFAULT, CLASS_ATST, CLASS_BOBAFETT, CLASS_DESANN, CLASS_INTERROGATOR, CLASS_JEDI, CLASS_KYLE, CLASS_LUKE, CLASS_MARK1, CLASS_PROBE, CLASS_RANCOR, CLASS_REBORN, CLASS_REMOTE, CLASS_SEEKER, CLASS_SENTRY, CLASS_SHADOWTROOPER, CLASS_TAVION, CLASS_VEHICLE, gentity_s::client, gentity_s::count, gNPC_t::defaultBehavior, EF2_FLYING, playerState_s::eFlags2, gclient_s::enemyTeam, playerState_s::fd, FL_NO_KNOCKBACK, FL_SHIELDED, gentity_s::flags, FORCE_LEVEL_3, forcedata_s::forcePower, forcedata_s::forcePowerLevel, forcedata_s::forcePowersKnown, FP_LEVITATION, entityState_s::g2radius, g_gametype, gentity_t, gentity_s::ghoul2, playerState_s::gravity, GT_SIEGE, gentity_s::health, vmCvar_t::integer, Jedi_ClearTimers(), Jedi_Cloak(), JSF_AMBUSH, gentity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, gentity_s::mass, gclient_s::noclip, gentity_s::NPC, NPC_ATST_Pain(), entityState_s::NPC_class, gclient_s::NPC_class, NPC_GalakMech_Init(), NPC_Rancor_Pain(), gentity_s::NPC_type, NPC_Wampa_Pain(), NPCAI_CUSTOM_GRAVITY, NPCTEAM_ENEMY, NPCTEAM_NEUTRAL, NPCTEAM_PLAYER, gentity_s::pain, gclient_s::playerTeam, gclient_s::ps, Q_stricmp(), qtrue, gentity_s::r, Rancor_SetBolts(), gNPC_t::rank, RANK_COMMANDER, RANK_LT, gentity_s::s, playerState_s::saberHolstered, SCF_ALT_FIRE, SCF_DONT_FIRE, SCF_IGNORE_ALERTS, SCF_NO_FORCE, SCF_NO_GROUPS, gNPC_t::scriptFlags, gclient_s::sess, clientSession_t::sessionTeam, SFB_CINEMATIC, SIEGETEAM_TEAM1, SIEGETEAM_TEAM2, gentity_s::spawnflags, ST_ClearTimers(), SVF_PLAYER_USABLE, entityShared_t::svFlags, TEAM_FREE, trap_G2API_SetSurfaceOnOff(), vehicleInfo_t::type, VH_WALKER, Wampa_SetBolts(), playerState_s::weapon, WP_BLASTER, WP_BOWCASTER, WP_BRYAR_PISTOL, WP_DEMP2, WP_DISRUPTOR, WP_FLECHETTE, WP_InitForcePowers(), WP_REPEATER, WP_ROCKET_LAUNCHER, WP_SABER, WP_SaberInitBladeData(), WP_SpawnInitForcePowers(), WP_STUN_BATON, and WP_THERMAL.

Referenced by NPC_Begin().

00216 {
00217         if ( ent->spawnflags & SFB_CINEMATIC )
00218         {//if a cinematic guy, default us to wait bState
00219                 ent->NPC->behaviorState = BS_CINEMATIC;
00220         }
00221         if ( ent->client->NPC_class == CLASS_BOBAFETT )
00222         {//set some stuff, precache
00223                 Boba_Precache();
00224                 ent->client->ps.fd.forcePowersKnown |= ( 1 << FP_LEVITATION );
00225                 ent->client->ps.fd.forcePowerLevel[FP_LEVITATION] = FORCE_LEVEL_3;
00226                 ent->client->ps.fd.forcePower = 100;
00227                 ent->NPC->scriptFlags |= (SCF_ALT_FIRE|SCF_NO_GROUPS);
00228         }
00229         //if ( !Q_stricmp( "atst_vehicle", ent->NPC_type ) )//FIXME: has to be a better, easier way to tell this, no?
00230         if (ent->s.NPC_class == CLASS_VEHICLE && ent->m_pVehicle)
00231         {
00232                 ent->s.g2radius = 255;//MAX for this value, was (ent->r.maxs[2]-ent->r.mins[2]), which is 272 or something
00233 
00234                 if (ent->m_pVehicle->m_pVehicleInfo->type == VH_WALKER)
00235                 {
00236                         ent->mass = 2000;//???
00237                         ent->flags |= (FL_SHIELDED|FL_NO_KNOCKBACK);
00238                         ent->pain = NPC_ATST_Pain;
00239                 }
00240                 //turn the damn hatch cover on and LEAVE it on
00241                 trap_G2API_SetSurfaceOnOff( ent->ghoul2, "head_hatchcover", 0/*TURN_ON*/ );
00242         }
00243         if ( !Q_stricmp( "wampa", ent->NPC_type ) )
00244         {//FIXME: extern this into NPC.cfg?
00245                 Wampa_SetBolts( ent );
00246                 ent->s.g2radius = 80;//???
00247                 ent->mass = 300;//???
00248                 ent->flags |= FL_NO_KNOCKBACK;
00249                 ent->pain = NPC_Wampa_Pain;
00250         }
00251         if ( ent->client->NPC_class == CLASS_RANCOR )
00252         {
00253                 Rancor_SetBolts( ent );
00254                 ent->s.g2radius = 255;//MAX for this value, was (ent->r.maxs[2]-ent->r.mins[2]), which is 272 or something
00255                 ent->mass = 1000;//???
00256                 ent->flags |= FL_NO_KNOCKBACK;
00257                 ent->pain = NPC_Rancor_Pain;
00258                 ent->health *= 4;
00259         }
00260         if ( !Q_stricmp( "Yoda", ent->NPC_type ) )
00261         {//FIXME: extern this into NPC.cfg?
00262                 ent->NPC->scriptFlags |= SCF_NO_FORCE;//force powers don't work on him
00263         }
00264         if ( !Q_stricmp( "emperor", ent->NPC_type ) )
00265         {//FIXME: extern this into NPC.cfg?
00266                 ent->NPC->scriptFlags |= SCF_DONT_FIRE;//so he uses only force powers
00267         }
00268         //==================
00269 //      if ( ent->client->ps.saber[0].type != SABER_NONE )
00270         if (ent->client->ps.weapon == WP_SABER) //rwwFIXMEFIXME: is this going to work?
00271         {//if I'm equipped with a saber, initialize it (them)
00272         //      ent->client->ps.SaberDeactivate();
00273         //      ent->client->ps.SetSaberLength( 0 );
00274                 WP_SaberInitBladeData( ent );
00275                 ent->client->ps.saberHolstered = 2;
00276         //      G_CreateG2AttachedWeaponModel( ent, ent->client->ps.saber[0].model, ent->handRBolt, 0 );
00277         //      if ( ent->client->ps.dualSabers )
00278         //      {
00279         //              G_CreateG2AttachedWeaponModel( ent, ent->client->ps.saber[1].model, ent->handLBolt, 1 );
00280         //      }
00281                 Jedi_ClearTimers( ent );
00282         }
00283         if ( ent->client->ps.fd.forcePowersKnown != 0 )
00284         {
00285                 WP_InitForcePowers( ent );
00286                 WP_SpawnInitForcePowers(ent); //rww
00287         }
00288         if ( ent->client->NPC_class == CLASS_SEEKER )
00289         {               
00290                 ent->NPC->defaultBehavior = BS_DEFAULT;
00291                 ent->client->ps.gravity = 0;
00292                 ent->NPC->aiFlags |= NPCAI_CUSTOM_GRAVITY;
00293                 ent->client->ps.eFlags2 |= EF2_FLYING;
00294                 ent->count = 30; // SEEKER shot ammo count
00295         }
00296         //***I'm not sure whether I should leave this as a TEAM_ switch, I think NPC_class may be more appropriate - dmv
00297         switch(ent->client->playerTeam)
00298         {
00299         case NPCTEAM_PLAYER:
00300                 //ent->flags |= FL_NO_KNOCKBACK;
00301                 if ( ent->client->NPC_class == CLASS_JEDI || ent->client->NPC_class == CLASS_LUKE )
00302                 {//good jedi
00303                         ent->client->enemyTeam = NPCTEAM_ENEMY;
00304                         if ( ent->spawnflags & JSF_AMBUSH )
00305                         {//ambusher
00306                                 ent->NPC->scriptFlags |= SCF_IGNORE_ALERTS;
00307                                 ent->client->noclip = qtrue;//hang
00308                         }
00309                 }
00310                 else
00311                 {
00312                         /*
00313                         if (ent->client->ps.weapon != WP_NONE)
00314                         {
00315                                 G_CreateG2AttachedWeaponModel( ent, weaponData[ent->client->ps.weapon].weaponMdl, ent->handRBolt, 0 );
00316                         }
00317                         */
00318                         switch ( ent->client->ps.weapon )
00319                         {
00320                         case WP_BRYAR_PISTOL://FIXME: new weapon: imp blaster pistol
00321         //              case WP_BLASTER_PISTOL:
00322                         case WP_DISRUPTOR:
00323                         case WP_BOWCASTER:
00324                         case WP_REPEATER:
00325                         case WP_DEMP2:
00326                         case WP_FLECHETTE:
00327                         case WP_ROCKET_LAUNCHER:
00328                         default:
00329                                 break;
00330                         case WP_THERMAL:
00331                         case WP_BLASTER:
00332                                 //FIXME: health in NPCs.cfg, and not all blaster users are stormtroopers
00333                                 //ent->health = 25;
00334                                 //FIXME: not necc. a ST
00335                                 ST_ClearTimers( ent );
00336                                 if ( ent->NPC->rank >= RANK_LT || ent->client->ps.weapon == WP_THERMAL )
00337                                 {//officers, grenade-throwers use alt-fire
00338                                         //ent->health = 50;
00339                                         //ent->NPC->scriptFlags |= SCF_ALT_FIRE;
00340                                 }
00341                                 break;
00342                         }
00343                 }
00344                 if ( ent->client->NPC_class == CLASS_KYLE || ent->client->NPC_class == CLASS_VEHICLE || (ent->spawnflags & SFB_CINEMATIC) )
00345                 {
00346                         ent->NPC->defaultBehavior = BS_CINEMATIC;
00347                 }
00348                 else
00349                 {
00350                         /*
00351                         ent->NPC->defaultBehavior = BS_FOLLOW_LEADER;
00352                         ent->client->leader = &g_entities[0];
00353                         */
00354                 }
00355                 break;
00356 
00357         case NPCTEAM_NEUTRAL: 
00358 
00359                 if ( Q_stricmp( ent->NPC_type, "gonk" ) == 0 ) 
00360                 {
00361                         // I guess we generically make them player usable
00362                         ent->r.svFlags |= SVF_PLAYER_USABLE;
00363 
00364                         // Not even sure if we want to give different levels of batteries?  ...Or even that these are the values we'd want to use.
00365                         /*
00366                         switch ( g_spskill.integer )
00367                         {
00368                         case 0: //      EASY
00369                                 ent->client->ps.batteryCharge = MAX_BATTERIES * 0.8f; 
00370                                 break;
00371                         case 1: //      MEDIUM
00372                                 ent->client->ps.batteryCharge = MAX_BATTERIES * 0.75f; 
00373                                 break;
00374                         default :
00375                         case 2: //      HARD
00376                                 ent->client->ps.batteryCharge = MAX_BATTERIES * 0.5f; 
00377                                 break;
00378                         }*/
00379                         //rwwFIXMEFIXME: Make use of this.
00380                 }
00381                 break;
00382 
00383         case NPCTEAM_ENEMY:
00384                 {
00385                         ent->NPC->defaultBehavior = BS_DEFAULT;
00386                         if ( ent->client->NPC_class == CLASS_SHADOWTROOPER )
00387                         {//FIXME: a spawnflag?
00388                                 Jedi_Cloak( ent );
00389                         }
00390                         if( ent->client->NPC_class == CLASS_TAVION ||
00391                                 ent->client->NPC_class == CLASS_REBORN ||
00392                                 ent->client->NPC_class == CLASS_DESANN ||
00393                                 ent->client->NPC_class == CLASS_SHADOWTROOPER )
00394                         {
00395                                 ent->client->enemyTeam = NPCTEAM_PLAYER;
00396                                 if ( ent->spawnflags & JSF_AMBUSH )
00397                                 {//ambusher
00398                                         ent->NPC->scriptFlags |= SCF_IGNORE_ALERTS;
00399                                         ent->client->noclip = qtrue;//hang
00400                                 }
00401                         }
00402                         else if( ent->client->NPC_class == CLASS_PROBE || ent->client->NPC_class == CLASS_REMOTE ||
00403                                                 ent->client->NPC_class == CLASS_INTERROGATOR || ent->client->NPC_class == CLASS_SENTRY)
00404                         {               
00405                                 ent->NPC->defaultBehavior = BS_DEFAULT;
00406                                 ent->client->ps.gravity = 0;
00407                                 ent->NPC->aiFlags |= NPCAI_CUSTOM_GRAVITY;
00408                                 ent->client->ps.eFlags2 |= EF2_FLYING;
00409                         }
00410                         else 
00411                         {
00412                 //              G_CreateG2AttachedWeaponModel( ent, weaponData[ent->client->ps.weapon].weaponMdl, ent->handRBolt, 0 );
00413                                 switch ( ent->client->ps.weapon )
00414                                 {
00415                                 case WP_BRYAR_PISTOL:
00416                                         break;
00417                 //              case WP_BLASTER_PISTOL:
00418                 //                      break;
00419                                 case WP_DISRUPTOR:
00420                                         //Sniper
00421                                         //ent->NPC->scriptFlags |= SCF_ALT_FIRE;//FIXME: use primary fire sometimes?  Up close?  Different class of NPC?
00422                                         break;
00423                                 case WP_BOWCASTER:
00424                                         break;
00425                                 case WP_REPEATER:
00426                                         //machine-gunner
00427                                         break;
00428                                 case WP_DEMP2:
00429                                         break;
00430                                 case WP_FLECHETTE:
00431                                         //shotgunner
00432                                         if ( !Q_stricmp( "stofficeralt", ent->NPC_type ) )
00433                                         {
00434                                                 //ent->NPC->scriptFlags |= SCF_ALT_FIRE;
00435                                         }
00436                                         break;
00437                                 case WP_ROCKET_LAUNCHER:
00438                                         break;
00439                                 case WP_THERMAL:
00440                                         //Gran, use main, bouncy fire
00441 //                                      ent->NPC->scriptFlags |= SCF_ALT_FIRE;
00442                                         break;
00443                                 case WP_STUN_BATON:
00444                                         break;
00445                                 default:
00446                                 case WP_BLASTER:
00447                                         //FIXME: health in NPCs.cfg, and not all blaster users are stormtroopers
00448                                         //FIXME: not necc. a ST
00449                                         ST_ClearTimers( ent );
00450                                         if ( ent->NPC->rank >= RANK_COMMANDER )
00451                                         {//commanders use alt-fire
00452                                                 //ent->NPC->scriptFlags |= SCF_ALT_FIRE;
00453                                         }
00454                                         if ( !Q_stricmp( "rodian2", ent->NPC_type ) )
00455                                         {
00456                                                 //ent->NPC->scriptFlags |= SCF_ALT_FIRE;
00457                                         }
00458                                         break;
00459                                 }
00460                                 if ( !Q_stricmp( "galak_mech", ent->NPC_type ) )
00461                                 {//starts with armor
00462                                         NPC_GalakMech_Init( ent );
00463                                 }
00464                         }
00465                 }
00466                 break;
00467 
00468         default:
00469                 break;
00470         }
00471 
00472 
00473         if ( ent->client->NPC_class == CLASS_SEEKER
00474                 && ent->activator )
00475         {//assume my teams are already set correctly
00476         }
00477         else
00478         {
00479                 //for siege, want "bad" npc's allied with the "bad" team
00480                 if (g_gametype.integer == GT_SIEGE && ent->s.NPC_class != CLASS_VEHICLE)
00481                 {
00482                         if (ent->client->enemyTeam == NPCTEAM_PLAYER)
00483                         {
00484                                 ent->client->sess.sessionTeam = SIEGETEAM_TEAM1;
00485                         }
00486                         else if (ent->client->enemyTeam == NPCTEAM_ENEMY)
00487                         {
00488                                 ent->client->sess.sessionTeam = SIEGETEAM_TEAM2;
00489                         }
00490                         else
00491                         {
00492                                 ent->client->sess.sessionTeam = TEAM_FREE;
00493                         }
00494                 }
00495         }
00496 
00497         if ( ent->client->NPC_class == CLASS_ATST || ent->client->NPC_class == CLASS_MARK1 ) // chris/steve/kevin requested that the mark1 be shielded also
00498         {
00499                 ent->flags |= (FL_SHIELDED|FL_NO_KNOCKBACK);
00500         }
00501 }

void NPC_SetWeapons gentity_t ent  ) 
 

Definition at line 759 of file NPC_spawn.c.

References playerState_s::ammo, weaponData_s::ammoIndex, gentity_s::client, gNPC_t::currentAmmo, gentity_t, gentity_s::NPC, gentity_s::NPC_type, NPC_WeaponsForTeam(), gclient_s::playerTeam, gclient_s::ps, gentity_s::spawnflags, STAT_WEAPONS, playerState_s::stats, playerState_s::weapon, weaponData, WP_NONE, WP_NUM_WEAPONS, WP_SABER, and WP_STUN_BATON.

Referenced by NPC_Begin().

00760 {
00761         int                     bestWeap = WP_NONE;
00762         int                     curWeap;
00763         int                     weapons = NPC_WeaponsForTeam( ent->client->playerTeam, ent->spawnflags, ent->NPC_type );
00764 
00765         ent->client->ps.stats[STAT_WEAPONS] = 0;
00766         for ( curWeap = WP_SABER; curWeap < WP_NUM_WEAPONS; curWeap++ )
00767         {
00768                 if ( (weapons & ( 1 << curWeap )) )
00769                 {
00770                         ent->client->ps.stats[STAT_WEAPONS] |= ( 1 << curWeap );
00771 //                      RegisterItem( FindItemForWeapon( (weapon_t)(curWeap) ) );       //precache the weapon
00772                         //rwwFIXMEFIXME: Precache
00773                         ent->NPC->currentAmmo = ent->client->ps.ammo[weaponData[curWeap].ammoIndex] = 100;//FIXME: max ammo
00774 
00775                         if ( bestWeap == WP_SABER )
00776                         {
00777                                 // still want to register other weapons -- force saber to be best weap
00778                                 continue;
00779                         }
00780 
00781                         if ( curWeap == WP_STUN_BATON )
00782                         {
00783                                 if ( bestWeap == WP_NONE )
00784                                 {// We'll only consider giving Melee since we haven't found anything better yet.
00785                                         bestWeap = curWeap;
00786                                 }
00787                         }
00788                         else if ( curWeap > bestWeap || bestWeap == WP_STUN_BATON )
00789                         {
00790                                 // This will never override saber as best weap.  Also will override WP_STUN_BATON if something better comes later in the list
00791                                 bestWeap = curWeap;
00792                         }
00793                 }
00794         }
00795 
00796         ent->client->ps.weapon = bestWeap;
00797 }

void NPC_ShadowTrooper_Precache void   ) 
 

Definition at line 103 of file NPC_AI_Jedi.c.

References AMMO_FORCE, BG_FindItemForAmmo(), G_SoundIndex(), and RegisterItem().

Referenced by NPC_SpawnType(), and SP_NPC_ShadowTrooper().

00104 {
00105         RegisterItem( BG_FindItemForAmmo( AMMO_FORCE ) );
00106         G_SoundIndex( "sound/chars/shadowtrooper/cloak.wav" );
00107         G_SoundIndex( "sound/chars/shadowtrooper/decloak.wav" );
00108 }

void NPC_ShySpawn gentity_t ent  ) 
 

Definition at line 1808 of file NPC_spawn.c.

References entityShared_t::currentOrigin, g_entities, gentity_t, InFOV(), level, gentity_s::nextthink, NPC_ClearLOS2(), NPC_ShySpawn(), NPC_Spawn_Go(), gentity_s::r, SHY_SPAWN_DISTANCE_SQR, SHY_THINK_TIME, gentity_s::think, and level_locals_t::time.

Referenced by NPC_ShySpawn(), and NPC_Spawn().

01809 {
01810         ent->nextthink = level.time + SHY_THINK_TIME;
01811         ent->think = NPC_ShySpawn;
01812 
01813         //rwwFIXMEFIXME: Care about other clients not just 0?
01814         if ( DistanceSquared( g_entities[0].r.currentOrigin, ent->r.currentOrigin ) <= SHY_SPAWN_DISTANCE_SQR )
01815                 return;
01816 
01817         if ( (InFOV( ent, &g_entities[0], 80, 64 )) ) // FIXME: hardcoded fov
01818                 if ( (NPC_ClearLOS2( &g_entities[0], ent->r.currentOrigin )) )
01819                         return;
01820 
01821         ent->think = 0;
01822         ent->nextthink = 0;
01823 
01824         NPC_Spawn_Go( ent );
01825 }

void NPC_Spawn gentity_t ent,
gentity_t other,
gentity_t activator
 

Definition at line 1833 of file NPC_spawn.c.

References gentity_s::delay, gentity_t, level, gentity_s::nextthink, NPC_ShySpawn(), NPC_Spawn_Do(), NPC_Spawn_Go(), gentity_s::spawnflags, gentity_s::think, and level_locals_t::time.

Referenced by SP_NPC_spawner().

01834 {
01835         //delay before spawning NPC
01836         if( ent->delay )
01837         {
01838 /*              //Stasis does an extra step
01839                 if ( Q_stricmp( ent->classname, "NPC_Stasis" ) == 0 )
01840                 {
01841                         if ( NPC_StasisSpawn_Go( ent ) == qfalse )
01842                                 return;
01843                 }
01844 */
01845                 if ( ent->spawnflags & 2048 )  // SHY
01846                 {
01847                         ent->think = NPC_ShySpawn;
01848                 }
01849                 else
01850                 {
01851                         ent->think = NPC_Spawn_Go;
01852                 }
01853 
01854                 ent->nextthink = level.time + ent->delay;
01855         }
01856         else
01857         {
01858                 if ( ent->spawnflags & 2048 )  // SHY
01859                 {
01860                         NPC_ShySpawn( ent );
01861                 }
01862                 else
01863                 {
01864                         NPC_Spawn_Do( ent );
01865                 }
01866         }
01867 }

gentity_t* NPC_Spawn_Do gentity_t ent  ) 
 

Definition at line 1371 of file NPC_spawn.c.

References gNPC_t::aiFlags, gentity_s::alliedTeam, trace_t::allsolid, entityState_s::angles, entityState_s::apos, atoi(), gentity_s::behaviorSet, gNPC_t::behaviorState, BG_VehicleGetIndex(), bgEntity_t, BS_WAIT, BSET_FIRST, CLASS_VEHICLE, gentity_s::classname, gentity_s::client, gentity_s::closetarget, Com_Printf(), gNPC_t::combatPoint, gentity_s::count, entityShared_t::currentAngles, entityShared_t::currentOrigin, gentity_s::damage, gNPC_t::defaultBehavior, gNPC_t::desiredYaw, EF_NODRAW, entityState_s::eFlags, trace_t::endpos, ET_NPC, entityState_s::eType, FL_DMG_BY_HEAVY_WEAP_ONLY, FL_NO_KNOCKBACK, FL_NOTARGET, FL_SHIELDED, gentity_s::flags, gentity_s::fly_sound_debounce_time, trace_t::fraction, FRAMETIME, gentity_s::fullName, G_CreateAnimalNPC(), G_CreateFakeClient(), G_CreateFighterNPC(), G_CreateSpeederNPC(), G_CreateWalkerNPC(), g_entities, G_FreeEntity(), G_NewString(), G_SetAngles(), G_SetOrigin(), G_Spawn(), G_UseTargets(), g_vehicleInfo, gentity_t, gentity_s::healingclass, gentity_s::healingrate, gentity_s::healingsound, gentity_s::health, vehicleInfo_t::Initialize, level, Vehicle_s::m_pParentEntity, gentity_s::m_pVehicle, Vehicle_s::m_pVehicleInfo, Vehicle_s::m_vOrientation, MASK_NPCSOLID, MAX_PARMS, entityShared_t::maxs, memset(), gentity_s::message, MIN_WORLD_COORD, entityShared_t::mins, gentity_s::model2, New_NPC_t(), gentity_s::nextthink, gentity_s::NPC, NPC_Begin(), gclient_s::NPC_class, NPC_DefaultScriptFlags(), NPC_ParseParms(), gentity_s::NPC_target, gentity_s::NPC_targetname, gentity_s::NPC_type, NPCAI_MATCHPLAYERWEAPON, NSF_DROP_TO_FLOOR, NULL, NUM_BSETS, entityState_s::number, gentity_s::opentarget, playerState_s::origin, entityState_s::origin, gentity_s::paintarget, gentity_s::parent, parms_t::parm, gentity_s::parms, PERS_TEAM, playerState_s::persistant, PITCH, gentity_s::playerState, gclient_s::playerTeam, entityState_s::pos, gclient_s::ps, Q3_SetParm(), Q_stricmp(), Q_strlwr(), gentity_s::r, vehicleInfo_t::RegisterAssets, ROLL, gentity_s::s, S_COLOR_RED, gentity_s::script_targetname, gclient_s::sess, clientSession_t::sessionTeam, SetClientViewAngle(), entityState_s::shouldtarget, gentity_s::spawnflags, gentity_s::speed, trace_t::startsolid, SVF_NO_BASIC_SOUNDS, SVF_NO_COMBAT_SOUNDS, SVF_NO_EXTRA_SOUNDS, SVF_NOCLIENT, entityShared_t::svFlags, gentity_s::target, gentity_s::target2, gentity_s::target3, gentity_s::target4, gentity_s::targetname, gentity_s::team, TEAM_FREE, gentity_s::teamnodmg, entityState_s::teamowner, gNPC_t::tempGoal, gentity_s::think, level_locals_t::time, TR_INTERPOLATE, trap_LinkEntity(), trap_Trace(), trap_UnlinkEntity(), trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trDuration, trajectory_t::trTime, trajectory_t::trType, vehicleInfo_t::type, gentity_s::use, vec3_t, VectorClear, VectorCopy, VEHICLE_NONE, playerState_s::vehOrientation, VH_ANIMAL, VH_FIGHTER, VH_SPEEDER, VH_WALKER, playerState_s::viewangles, gentity_s::wait, playerState_s::weapon, WP_NONE, and YAW.

Referenced by G_VehicleSpawn(), NPC_Spawn(), NPC_Spawn_Go(), and NPC_SpawnType().

01372 {
01373         gentity_t       *newent = NULL;
01374         int                     index;
01375         vec3_t          saveOrg;
01376 
01377 /*      //Do extra code for stasis spawners
01378         if ( Q_stricmp( ent->classname, "NPC_Stasis" ) == 0 )
01379         {
01380                 if ( NPC_StasisSpawn_Go( ent ) == qfalse )
01381                         return;
01382         }
01383 */
01384 
01385         //Test for drop to floor
01386         if ( ent->spawnflags & NSF_DROP_TO_FLOOR )
01387         {
01388                 trace_t         tr;
01389                 vec3_t          bottom;
01390 
01391                 VectorCopy( ent->r.currentOrigin, saveOrg );
01392                 VectorCopy( ent->r.currentOrigin, bottom );
01393                 bottom[2] = MIN_WORLD_COORD;
01394                 trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, bottom, ent->s.number, MASK_NPCSOLID );
01395                 if ( !tr.allsolid && !tr.startsolid && tr.fraction < 1.0 )
01396                 {
01397                         G_SetOrigin( ent, tr.endpos );
01398                 }
01399         }
01400 
01401         //Check the spawner's count
01402         if( ent->count != -1 )
01403         {
01404                 ent->count--;
01405                 
01406                 if( ent->count <= 0 )
01407                 {
01408                         ent->use = 0;//never again
01409                         //FIXME: why not remove me...?  Because of all the string pointers?  Just do G_NewStrings?
01410                 }
01411         }
01412 
01413         newent = G_Spawn();
01414 
01415         if ( newent == NULL ) 
01416         {
01417                 Com_Printf ( S_COLOR_RED"ERROR: NPC G_Spawn failed\n" );
01418                 return NULL;
01419         }
01420         
01421         newent->fullName = ent->fullName;
01422 
01423         newent->NPC = New_NPC_t(newent->s.number);      
01424         if ( newent->NPC == NULL ) 
01425         {               
01426                 Com_Printf ( S_COLOR_RED"ERROR: NPC G_Alloc NPC failed\n" );            
01427                 goto finish;
01428                 return NULL;
01429         }       
01430 
01431         //newent->client = (gclient_s *)G_Alloc (sizeof(gclient_s));
01432         G_CreateFakeClient(newent->s.number, &newent->client);
01433 
01434         newent->NPC->tempGoal = G_Spawn();
01435         
01436         if ( newent->NPC->tempGoal == NULL ) 
01437         {
01438                 newent->NPC = NULL;
01439                 goto finish;
01440                 return NULL;
01441         }
01442 
01443         newent->NPC->tempGoal->classname = "NPC_goal";
01444         newent->NPC->tempGoal->parent = newent;
01445         newent->NPC->tempGoal->r.svFlags |= SVF_NOCLIENT;
01446 
01447         if ( newent->client == NULL ) 
01448         {
01449                 Com_Printf ( S_COLOR_RED"ERROR: NPC BG_Alloc client failed\n" );
01450                 goto finish;
01451                 return NULL;
01452         }
01453         
01454         memset ( newent->client, 0, sizeof(*newent->client) );
01455 
01456         //Assign the pointer for bg entity access
01457         newent->playerState = &newent->client->ps;
01458 
01459 //==NPC_Connect( newent, net_name );===================================
01460 
01461         if ( ent->NPC_type == NULL ) 
01462         {
01463                 ent->NPC_type = "random";
01464         }
01465         else
01466         {
01467                 ent->NPC_type = Q_strlwr( G_NewString( ent->NPC_type ) );
01468         }
01469 
01470         if ( ent->r.svFlags & SVF_NO_BASIC_SOUNDS )
01471         {
01472                 newent->r.svFlags |= SVF_NO_BASIC_SOUNDS;
01473         }
01474         if ( ent->r.svFlags & SVF_NO_COMBAT_SOUNDS )
01475         {
01476                 newent->r.svFlags |= SVF_NO_COMBAT_SOUNDS;
01477         }
01478         if ( ent->r.svFlags & SVF_NO_EXTRA_SOUNDS )
01479         {
01480                 newent->r.svFlags |= SVF_NO_EXTRA_SOUNDS;
01481         }
01482         
01483         if ( ent->message )
01484         {//has a key
01485                 newent->message = ent->message;//transfer the key name
01486                 newent->flags |= FL_NO_KNOCKBACK;//don't fall off ledges
01487         }
01488 
01489         // If this is a vehicle we need to see what kind it is so we properlly allocate it.
01490         if ( Q_stricmp( ent->classname, "NPC_Vehicle" ) == 0 )
01491         {
01492                 // Get the vehicle entry index.
01493                 int iVehIndex = BG_VehicleGetIndex( ent->NPC_type );
01494 
01495                 if ( iVehIndex == VEHICLE_NONE )
01496                 {
01497                         G_FreeEntity( newent );
01498                         //get rid of the spawner, too, I guess
01499                         G_FreeEntity( ent );
01500                         return NULL;
01501                 }
01502                 // NOTE: If you change/add any of these, update NPC_Spawn_f for the new vehicle you
01503                 // want to be able to spawn in manually.
01504 
01505                 // See what kind of vehicle this is and allocate it properly.
01506                 switch( g_vehicleInfo[iVehIndex].type )
01507                 {
01508                         case VH_ANIMAL:
01509                                 // Create the animal (making sure all it's data is initialized).
01510                                 G_CreateAnimalNPC( &newent->m_pVehicle, ent->NPC_type );
01511                                 break;
01512                         case VH_SPEEDER:
01513                                 // Create the speeder (making sure all it's data is initialized).
01514                                 G_CreateSpeederNPC( &newent->m_pVehicle, ent->NPC_type );
01515                                 break;
01516                         case VH_FIGHTER:
01517                                 // Create the fighter (making sure all it's data is initialized).
01518                                 G_CreateFighterNPC( &newent->m_pVehicle, ent->NPC_type );
01519                                 break;
01520                         case VH_WALKER:
01521                                 // Create the walker (making sure all it's data is initialized).
01522                                 G_CreateWalkerNPC( &newent->m_pVehicle, ent->NPC_type );
01523                                 break;
01524 
01525                         default:
01526                                 Com_Printf ( S_COLOR_RED "ERROR: Couldn't spawn NPC %s\n", ent->NPC_type );
01527                                 G_FreeEntity( newent );
01528                                 //get rid of the spawner, too, I guess
01529                                 G_FreeEntity( ent );
01530                                 return NULL;
01531                 }
01532 
01533                 assert(newent->m_pVehicle &&
01534                         newent->m_pVehicle->m_pVehicleInfo &&
01535                         newent->m_pVehicle->m_pVehicleInfo->Initialize);
01536 
01537                 //set up my happy prediction hack
01538                 newent->m_pVehicle->m_vOrientation = &newent->client->ps.vehOrientation[0];
01539 
01540                 // Setup the vehicle.
01541                 newent->m_pVehicle->m_pParentEntity = (bgEntity_t *)newent;
01542                 newent->m_pVehicle->m_pVehicleInfo->Initialize( newent->m_pVehicle );
01543 
01544                 //cache all the assets
01545                 newent->m_pVehicle->m_pVehicleInfo->RegisterAssets( newent->m_pVehicle );
01546                 //set the class
01547                 newent->client->NPC_class = CLASS_VEHICLE;
01548                 if ( g_vehicleInfo[iVehIndex].type == VH_FIGHTER )
01549                 {//FIXME: EXTERN!!!
01550                         newent->flags |= (FL_NO_KNOCKBACK|FL_SHIELDED|FL_DMG_BY_HEAVY_WEAP_ONLY);//don't get pushed around, blasters bounce off, only damage from heavy weaps
01551                 }
01552                 //WTF?!!! Ships spawning in pointing straight down!
01553                 //set them up to start landed
01554                 newent->m_pVehicle->m_vOrientation[YAW] = ent->s.angles[YAW];
01555                 newent->m_pVehicle->m_vOrientation[PITCH] = newent->m_pVehicle->m_vOrientation[ROLL] = 0.0f;
01556                 G_SetAngles( newent, newent->m_pVehicle->m_vOrientation );
01557                 SetClientViewAngle( newent, newent->m_pVehicle->m_vOrientation );
01558 
01559                 //newent->m_pVehicle->m_ulFlags |= VEH_GEARSOPEN;
01560                 //why? this would just make it so the initial anim never got played... -rww
01561                 //There was no initial anim, it would just open the gear even though it's already on the ground (fixed now, made an initial anim)
01562                 
01563                 //For SUSPEND spawnflag, the amount of time to drop like a rock after SUSPEND turns off
01564                 newent->fly_sound_debounce_time = ent->fly_sound_debounce_time;
01565 
01566                 //for no-pilot-death delay
01567                 newent->damage = ent->damage;
01568 
01569                 //no-pilot-death distance
01570                 newent->speed = ent->speed;
01571 
01572                 //for veh transfer all healy stuff
01573                 newent->healingclass = ent->healingclass;
01574                 newent->healingsound = ent->healingsound;
01575                 newent->healingrate = ent->healingrate;
01576                 newent->model2 = ent->model2;//for droidNPC
01577         }
01578         else
01579         {
01580                 newent->client->ps.weapon = WP_NONE;//init for later check in NPC_Begin
01581         }
01582     
01583         VectorCopy(ent->s.origin, newent->s.origin);
01584         VectorCopy(ent->s.origin, newent->client->ps.origin);
01585         VectorCopy(ent->s.origin, newent->r.currentOrigin);
01586         G_SetOrigin(newent, ent->s.origin);//just to be sure!
01587         //NOTE: on vehicles, anything in the .npc file will STOMP data on the NPC that's set by the vehicle
01588         if ( !NPC_ParseParms( ent->NPC_type, newent ) )
01589         {
01590                 Com_Printf ( S_COLOR_RED "ERROR: Couldn't spawn NPC %s\n", ent->NPC_type );
01591                 G_FreeEntity( newent );
01592                 //get rid of the spawner, too, I guess
01593                 G_FreeEntity( ent );
01594                 return NULL;
01595         }
01596 
01597         if ( ent->NPC_type )
01598         {
01599                 if ( !Q_stricmp( ent->NPC_type, "kyle" ) )
01600                 {//FIXME: "player", not Kyle?  Or check NPC_type against player's NPC_type?
01601                         newent->NPC->aiFlags |= NPCAI_MATCHPLAYERWEAPON;
01602                 }
01603                 else if ( !Q_stricmp( ent->NPC_type, "test" ) )
01604                 {
01605                         int     n;
01606                         for ( n = 0; n < 1 ; n++) 
01607                         {
01608                                 if ( g_entities[n].s.eType != ET_NPC && g_entities[n].client) 
01609                                 {
01610                                         VectorCopy(g_entities[n].s.origin, newent->s.origin);
01611                                         newent->client->playerTeam = newent->s.teamowner = g_entities[n].client->playerTeam;
01612                                         break;
01613                                 }
01614                         }
01615                         newent->NPC->defaultBehavior = newent->NPC->behaviorState = BS_WAIT;
01616                         newent->classname = "NPC";
01617         //              newent->r.svFlags |= SVF_NOPUSH;
01618                 }
01619         }
01620 //=====================================================================
01621         //set the info we want
01622         if ( !newent->health )
01623         {
01624                 newent->health = ent->health;
01625         }
01626         newent->script_targetname = ent->NPC_targetname;
01627         newent->targetname = ent->NPC_targetname;
01628         newent->target = ent->NPC_target;//death
01629         newent->target2 = ent->target2;//knocked out death
01630         newent->target3 = ent->target3;//???
01631         newent->target4 = ent->target4;//ffire death
01632         newent->wait = ent->wait;
01633         
01634         for( index = BSET_FIRST; index < NUM_BSETS; index++)
01635         {
01636                 if ( ent->behaviorSet[index] )
01637                 {
01638                         newent->behaviorSet[index] = ent->behaviorSet[index];
01639                 }
01640         }
01641 
01642         newent->classname = "NPC";
01643         newent->NPC_type = ent->NPC_type;
01644         trap_UnlinkEntity(newent);
01645         
01646         VectorCopy(ent->s.angles, newent->s.angles);
01647         VectorCopy(ent->s.angles, newent->r.currentAngles);
01648         VectorCopy(ent->s.angles, newent->client->ps.viewangles);
01649         newent->NPC->desiredYaw =ent->s.angles[YAW];
01650         
01651         trap_LinkEntity(newent);
01652         newent->spawnflags = ent->spawnflags;
01653 
01654         if(ent->paintarget)
01655         {       //safe to point at owner's string since memory is never freed during game
01656                 newent->paintarget = ent->paintarget;
01657         }
01658         if(ent->opentarget)
01659         {
01660                 newent->opentarget = ent->opentarget;
01661         }
01662 
01663 //==New stuff=====================================================================
01664         newent->s.eType = ET_NPC;//ET_PLAYER;
01665         
01666         //FIXME: Call CopyParms
01667         if ( ent->parms )
01668         {
01669                 int parmNum;
01670 
01671                 for ( parmNum = 0; parmNum < MAX_PARMS; parmNum++ )
01672                 {
01673                         if ( ent->parms->parm[parmNum] && ent->parms->parm[parmNum][0] )
01674                         {
01675                                 Q3_SetParm( newent->s.number, parmNum, ent->parms->parm[parmNum] );
01676                         }
01677                 }
01678         }
01679         //FIXME: copy cameraGroup, store mine in message or other string field
01680 
01681         //set origin
01682         newent->s.pos.trType = TR_INTERPOLATE;
01683         newent->s.pos.trTime = level.time;
01684         VectorCopy( newent->r.currentOrigin, newent->s.pos.trBase );
01685         VectorClear( newent->s.pos.trDelta );
01686         newent->s.pos.trDuration = 0;
01687         //set angles
01688         newent->s.apos.trType = TR_INTERPOLATE;
01689         newent->s.apos.trTime = level.time;
01690         //VectorCopy( newent->r.currentOrigin, newent->s.apos.trBase );
01691         //Why was the origin being used as angles? Typo I'm assuming -rww
01692         VectorCopy( newent->s.angles, newent->s.apos.trBase );
01693 
01694         VectorClear( newent->s.apos.trDelta );
01695         newent->s.apos.trDuration = 0;
01696         
01697         newent->NPC->combatPoint = -1;
01698 
01699         newent->flags |= FL_NOTARGET;//So he's ignored until he's fully spawned
01700         newent->s.eFlags |= EF_NODRAW;//So he's ignored until he's fully spawned
01701 
01702         newent->think = NPC_Begin;
01703         newent->nextthink = level.time + FRAMETIME;
01704         NPC_DefaultScriptFlags( newent );
01705 
01706         //copy over team variables, too
01707         newent->s.shouldtarget = ent->s.shouldtarget;
01708         newent->s.teamowner = ent->s.teamowner;
01709         newent->alliedTeam = ent->alliedTeam;
01710         newent->teamnodmg = ent->teamnodmg;
01711         if ( ent->team && ent->team[0] )
01712         {//specified team directly?
01713                 newent->client->sess.sessionTeam = atoi(ent->team);
01714         }
01715         else if ( newent->s.teamowner != TEAM_FREE )
01716         {
01717                 newent->client->sess.sessionTeam = newent->s.teamowner;
01718         }
01719         else if ( newent->alliedTeam != TEAM_FREE )
01720         {
01721                 newent->client->sess.sessionTeam = newent->alliedTeam;
01722         }
01723         else if ( newent->teamnodmg != TEAM_FREE )
01724         {
01725                 newent->client->sess.sessionTeam = newent->teamnodmg;
01726         }
01727         else
01728         {
01729                 newent->client->sess.sessionTeam = TEAM_FREE;
01730         }
01731         newent->client->ps.persistant[PERS_TEAM] = newent->client->sess.sessionTeam;
01732 
01733         trap_LinkEntity (newent);
01734 
01735         if(!ent->use)
01736         {
01737                 if( ent->target )
01738                 {//use any target we're pointed at
01739                         G_UseTargets ( ent, ent );
01740                 }
01741                 if(ent->closetarget)
01742                 {//last guy should fire this target when he dies
01743                         newent->target = ent->closetarget;
01744                 }
01745                 ent->targetname = NULL;
01746                 //why not remove me...?  Because of all the string pointers?  Just do G_NewStrings?
01747                 G_FreeEntity( ent );//bye!
01748         }
01749 
01750 finish:
01751         if ( ent->spawnflags & NSF_DROP_TO_FLOOR )
01752         {
01753                 G_SetOrigin( ent, saveOrg );
01754         }
01755 
01756         return newent;
01757 }

void NPC_Spawn_f gentity_t ent  ) 
 

Definition at line 4014 of file NPC_spawn.c.

References gentity_t, NPC_SpawnType(), Q_stricmp(), qboolean, qfalse, qtrue, and trap_Argv().

Referenced by Cmd_NPC_f().

04015 {
04016         char    npc_type[1024];
04017         char    targetname[1024];
04018         qboolean        isVehicle = qfalse;
04019 
04020         trap_Argv(2, npc_type, 1024);
04021         if ( Q_stricmp( "vehicle", npc_type ) == 0 )
04022         {
04023                 isVehicle = qtrue;
04024                 trap_Argv(3, npc_type, 1024);
04025                 trap_Argv(4, targetname, 1024);
04026         }
04027         else
04028         {
04029                 trap_Argv(3, targetname, 1024);
04030         }
04031 
04032         NPC_SpawnType( ent, npc_type, targetname, isVehicle );
04033 }

void NPC_Spawn_Go gentity_t ent  ) 
 

Definition at line 1759 of file NPC_spawn.c.

References gentity_t, and NPC_Spawn_Do().

Referenced by NPC_ShySpawn(), NPC_Spawn(), and SP_NPC_spawner().

01760 {
01761         NPC_Spawn_Do(ent);
01762 }

void NPC_SpawnEffect gentity_t ent  ) 
 

Definition at line 808 of file NPC_spawn.c.

References gentity_t.

Referenced by NPC_Begin().

00809 {
00810 }

gentity_t* NPC_SpawnType gentity_t ent,
char *  npc_type,
char *  targetname,
qboolean  isVehicle
 

Referenced by ItemUse_Seeker(), NPC_Begin(), and NPC_Spawn_f().

qboolean NPC_SpotWouldTelefrag gentity_t npc  ) 
 

Definition at line 831 of file NPC_spawn.c.

References gentity_s::client, entityShared_t::contents, entityShared_t::currentOrigin, g_entities, gentity_t, gentity_s::inuse, MASK_NPCSOLID, MAX_GENTITIES, entityShared_t::maxs, entityShared_t::mins, entityState_s::number, entityShared_t::ownerNum, qboolean, qfalse, qtrue, gentity_s::r, gentity_s::s, trap_EntitiesInBox(), vec3_t, and VectorAdd.

Referenced by NPC_Begin().

00832 {
00833         int                     i, num;
00834         int                     touch[MAX_GENTITIES];
00835         gentity_t       *hit;
00836         vec3_t          mins, maxs;
00837 
00838         VectorAdd( npc->r.currentOrigin, npc->r.mins, mins );
00839         VectorAdd( npc->r.currentOrigin, npc->r.maxs, maxs );
00840         num = trap_EntitiesInBox( mins, maxs, touch, MAX_GENTITIES );
00841 
00842         for (i=0 ; i<num ; i++)
00843         {
00844                 hit = &g_entities[touch[i]];
00845                 //if ( hit->client && hit->client->ps.stats[STAT_HEALTH] > 0 ) {
00846                 if (hit->inuse 
00847                         && hit->client 
00848                         && hit->s.number != npc->s.number 
00849                         && (hit->r.contents&MASK_NPCSOLID)
00850                         && hit->s.number != npc->r.ownerNum
00851                         && hit->r.ownerNum != npc->s.number)
00852                 {
00853                         return qtrue;
00854                 }
00855 
00856         }
00857 
00858         return qfalse;
00859 }

void NPC_ST_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 260 of file NPC_AI_Stormtrooper.c.

References EV_PUSHED1, EV_PUSHED3, G_AddVoiceEvent(), gentity_t, gentity_s::health, gNPC_t::localState, LSTATE_UNDERFIRE, gentity_s::NPC, NPC_Pain(), Q_irand(), and TIMER_Set().

Referenced by NPC_PainFunc().

00261 {
00262         self->NPC->localState = LSTATE_UNDERFIRE;
00263 
00264         TIMER_Set( self, "duck", -1 );
00265         TIMER_Set( self, "hideTime", -1 );
00266         TIMER_Set( self, "stand", 2000 );
00267 
00268         NPC_Pain( self, attacker, damage );
00269 
00270         if ( !damage && self->health > 0 )
00271         {//FIXME: better way to know I was pushed
00272                 G_AddVoiceEvent( self, Q_irand(EV_PUSHED1, EV_PUSHED3), 2000 );
00273         }
00274 }

TOUCH_FUNC* NPC_TouchFunc gentity_t ent  ) 
 

Definition at line 199 of file NPC_spawn.c.

References gentity_t, NPC_Touch(), and TOUCH_FUNC.

Referenced by NPC_Begin().

00200 {
00201         void (*func)(gentity_t *self, gentity_t *other, trace_t *trace);
00202 
00203         func = NPC_Touch;
00204 
00205         return func;
00206 }

qboolean NPC_VehiclePrecache gentity_t spawner  ) 
 

Definition at line 2097 of file NPC_spawn.c.

References BG_ParseAnimationFile(), BG_VehicleGetIndex(), vehicleInfo_t::droidNPC, G_ModelIndex(), g_vehicleInfo, gentity_t, vehicleInfo_t::model, gentity_s::model2, NPC_PrecacheType(), gentity_s::NPC_type, NULL, Q_stricmp(), Q_strrchr(), qboolean, qfalse, qtrue, vehicleInfo_t::skin, strcpy(), trap_G2API_CleanGhoul2Models(), trap_G2API_GetGLAName(), trap_G2API_InitGhoul2Model(), trap_R_RegisterSkin(), va(), and VEHICLE_NONE.

Referenced by SP_NPC_Vehicle().

02098 {
02099         char *droidNPCType = NULL;
02100         //This will precache the vehicle
02101         vehicleInfo_t *pVehInfo;
02102         int iVehIndex = BG_VehicleGetIndex( spawner->NPC_type );
02103         if ( iVehIndex == VEHICLE_NONE )
02104         {//fixme: error msg?
02105                 return qfalse;
02106         }
02107 
02108         G_ModelIndex(va("$%s", spawner->NPC_type)); //make sure the thing is frickin precached
02109         //now cache his model/skin/anim config
02110         pVehInfo = &g_vehicleInfo[iVehIndex];
02111         if (pVehInfo->model && pVehInfo->model[0])
02112         {
02113                 void *tempG2 = NULL;
02114                 int skin = 0;
02115                 if (pVehInfo->skin && pVehInfo->skin[0])
02116                 {
02117                         skin = trap_R_RegisterSkin(va("models/players/%s/model_%s.skin", pVehInfo->model, pVehInfo->skin));
02118                 }
02119                 trap_G2API_InitGhoul2Model(&tempG2, va("models/players/%s/model.glm", pVehInfo->model), 0, skin, 0, 0, 0);
02120                 if (tempG2)
02121                 { //now, cache the anim config.
02122                         char GLAName[1024];
02123 
02124                         GLAName[0] = 0;
02125                         trap_G2API_GetGLAName(tempG2, 0, GLAName);
02126 
02127                         if (GLAName[0])
02128                         {
02129                                 char *slash = Q_strrchr( GLAName, '/' );
02130                                 if ( slash )
02131                                 {
02132                                         strcpy(slash, "/animation.cfg");
02133 
02134                                         BG_ParseAnimationFile(GLAName, NULL, qfalse);
02135                                 }
02136                         }
02137                         trap_G2API_CleanGhoul2Models(&tempG2);
02138                 }
02139         }
02140 
02141         //also precache the droid NPC if there is one
02142         if ( spawner->model2 
02143                 && spawner->model2[0] )
02144         {
02145                 droidNPCType = spawner->model2;
02146         }
02147         else if ( g_vehicleInfo[iVehIndex].droidNPC
02148                 && g_vehicleInfo[iVehIndex].droidNPC[0] )
02149         {
02150                 droidNPCType = g_vehicleInfo[iVehIndex].droidNPC;
02151         }
02152 
02153         if ( droidNPCType )
02154         {
02155                 if ( Q_stricmp( "random", droidNPCType ) == 0
02156                         || Q_stricmp( "default", droidNPCType ) == 0 )
02157                 {//precache both r2 and r5, as defaults
02158                         NPC_PrecacheType( "r2d2" );
02159                         NPC_PrecacheType( "r5d2" );
02160                 }
02161                 else
02162                 {
02163                         NPC_PrecacheType( droidNPCType );
02164                 }
02165         }
02166         return qtrue;
02167 }

void NPC_VehicleSpawnUse gentity_t self,
gentity_t other,
gentity_t activator
 

Definition at line 2169 of file NPC_spawn.c.

References gentity_s::delay, G_VehicleSpawn(), gentity_t, level, gentity_s::nextthink, gentity_s::think, and level_locals_t::time.

Referenced by SP_NPC_Vehicle().

02170 {
02171         if ( self->delay )
02172         {
02173                 self->think = G_VehicleSpawn;
02174                 self->nextthink = level.time + self->delay;
02175         }
02176         else
02177         {
02178                 G_VehicleSpawn( self );
02179         }
02180 }

void NPC_Wampa_Pain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 433 of file NPC_AI_Wampa.c.

References entityState_s::angles, BOTH_ATTACK1, BOTH_ATTACK2, BOTH_ATTACK3, BOTH_GESTURE1, BOTH_GESTURE2, BOTH_PAIN1, BOTH_PAIN2, CLASS_WAMPA, gentity_s::client, entityShared_t::currentOrigin, gentity_s::enemy, FL_NOTARGET, gentity_s::flags, G_SetEnemy(), gentity_t, gentity_s::health, gentity_s::inuse, gNPC_t::lastPathAngles, playerState_s::legsAnim, playerState_s::legsTimer, gNPC_t::localState, LSTATE_WAITING, gentity_s::NPC, gclient_s::NPC_class, NPC_SetAnim(), entityState_s::number, gclient_s::ps, Q_irand(), qboolean, qfalse, qtrue, gentity_s::r, gentity_s::s, SETANIM_BOTH, SETANIM_FLAG_HOLD, SETANIM_FLAG_OVERRIDE, TIMER_Done(), TIMER_Remove(), TIMER_Set(), VectorCopy, and Wampa_CheckRoar().

Referenced by NPC_PainFunc(), and NPC_SetMiscDefaultData().

00434 {
00435         qboolean hitByWampa = qfalse;
00436         if ( attacker&&attacker->client&&attacker->client->NPC_class==CLASS_WAMPA )
00437         {
00438                 hitByWampa = qtrue;
00439         }
00440         if ( attacker 
00441                 && attacker->inuse 
00442                 && attacker != self->enemy
00443                 && !(attacker->flags&FL_NOTARGET) )
00444         {
00445                 if ( (!attacker->s.number&&!Q_irand(0,3))
00446                         || !self->enemy
00447                         || self->enemy->health == 0
00448                         || (self->enemy->client&&self->enemy->client->NPC_class == CLASS_WAMPA)
00449                         || (!Q_irand(0, 4 ) && DistanceSquared( attacker->r.currentOrigin, self->r.currentOrigin ) < DistanceSquared( self->enemy->r.currentOrigin, self->r.currentOrigin )) ) 
00450                 {//if my enemy is dead (or attacked by player) and I'm not still holding/eating someone, turn on the attacker
00451                         //FIXME: if can't nav to my enemy, take this guy if I can nav to him
00452                         G_SetEnemy( self, attacker );
00453                         TIMER_Set( self, "lookForNewEnemy", Q_irand( 5000, 15000 ) );
00454                         if ( hitByWampa )
00455                         {//stay mad at this Wampa for 2-5 secs before looking for attacker enemies
00456                                 TIMER_Set( self, "wampaInfight", Q_irand( 2000, 5000 ) );
00457                         }
00458                 }
00459         }
00460         if ( (hitByWampa|| Q_irand( 0, 100 ) < damage )//hit by wampa, hit while holding live victim, or took a lot of damage
00461                 && self->client->ps.legsAnim != BOTH_GESTURE1
00462                 && self->client->ps.legsAnim != BOTH_GESTURE2
00463                 && TIMER_Done( self, "takingPain" ) )
00464         {
00465                 if ( !Wampa_CheckRoar( self ) )
00466                 {
00467                         if ( self->client->ps.legsAnim != BOTH_ATTACK1
00468                                 && self->client->ps.legsAnim != BOTH_ATTACK2
00469                                 && self->client->ps.legsAnim != BOTH_ATTACK3 )
00470                         {//cant interrupt one of the big attack anims
00471                                 if ( self->health > 100 || hitByWampa )
00472                                 {
00473                                         TIMER_Remove( self, "attacking" );
00474 
00475                                         VectorCopy( self->NPC->lastPathAngles, self->s.angles );
00476 
00477                                         if ( !Q_irand( 0, 1 ) )
00478                                         {
00479                                                 NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN2, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );
00480                                         }
00481                                         else
00482                                         {
00483                                                 NPC_SetAnim( self, SETANIM_BOTH, BOTH_PAIN1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );
00484                                         }
00485                                         TIMER_Set( self, "takingPain", self->client->ps.legsTimer+Q_irand(0, 500) );
00486                                         //allow us to re-evaluate our running speed/anim
00487                                         TIMER_Set( self, "runfar", -1 );
00488                                         TIMER_Set( self, "runclose", -1 );
00489                                         TIMER_Set( self, "walk", -1 );
00490 
00491                                         if ( self->NPC )
00492                                         {
00493                                                 self->NPC->localState = LSTATE_WAITING;
00494                                         }
00495                                 }
00496                         }
00497                 }
00498         }
00499 }

void NPC_Wampa_Precache void   ) 
 

Definition at line 43 of file NPC_AI_Wampa.c.

References G_SoundIndex().

Referenced by NPC_SpawnType(), and SP_NPC_Monster_Wampa().

00044 {
00045         /*
00046         int i;
00047         for ( i = 1; i < 4; i ++ )
00048         {
00049                 G_SoundIndex( va("sound/chars/wampa/growl%d.wav", i) );
00050         }
00051         for ( i = 1; i < 3; i ++ )
00052         {
00053                 G_SoundIndex( va("sound/chars/wampa/snort%d.wav", i) );
00054         }
00055         */
00056         G_SoundIndex( "sound/chars/rancor/swipehit.wav" );
00057         //G_SoundIndex( "sound/chars/wampa/chomp.wav" );
00058 }

int NPC_WeaponsForTeam team_t  team,
int  spawnflags,
const char *  NPC_type
 

Definition at line 509 of file NPC_spawn.c.

References NPCTEAM_ENEMY, NPCTEAM_NEUTRAL, NPCTEAM_PLAYER, Q_stricmp(), Q_strncmp(), SFB_PHASER, SFB_RIFLEMAN, team_t, WP_BLASTER, WP_BOWCASTER, WP_DISRUPTOR, WP_FLECHETTE, WP_NONE, WP_REPEATER, WP_ROCKET_LAUNCHER, WP_SABER, WP_STUN_BATON, and WP_THERMAL.

Referenced by NPC_PrecacheWeapons(), and NPC_SetWeapons().

00510 {
00511         //*** not sure how to handle this, should I pass in class instead of team and go from there? - dmv
00512         switch(team)
00513         {
00514         // no longer exists
00515 //      case TEAM_BORG:
00516 //              break;
00517 
00518 //      case TEAM_HIROGEN:
00519 //              if( Q_stricmp( "hirogenalpha", NPC_type ) == 0 )
00520 //                      return ( 1 << WP_BLASTER);
00521                 //Falls through
00522 
00523 //      case TEAM_KLINGON:
00524 
00525                 //NOTENOTE: Falls through
00526 
00527 //      case TEAM_IMPERIAL:
00528         case NPCTEAM_ENEMY:
00529                 if ( Q_stricmp( "tavion", NPC_type ) == 0 || 
00530                         Q_strncmp( "reborn", NPC_type, 6 ) == 0 || 
00531                         Q_stricmp( "desann", NPC_type ) == 0 || 
00532                         Q_strncmp( "shadowtrooper", NPC_type, 13 ) == 0 )
00533                         return ( 1 << WP_SABER);
00534 //                      return ( 1 << WP_IMPERIAL_BLADE);
00535                 //NOTENOTE: Falls through if not a knife user
00536 
00537 //      case TEAM_SCAVENGERS:
00538 //      case TEAM_MALON:
00539                 //FIXME: default weapon in npc config?
00540                 if ( Q_strncmp( "stofficer", NPC_type, 9 ) == 0 )
00541                 {
00542                         return ( 1 << WP_FLECHETTE);
00543                 }
00544                 if ( Q_stricmp( "stcommander", NPC_type ) == 0 )
00545                 {
00546                         return ( 1 << WP_REPEATER);
00547                 }
00548                 if ( Q_stricmp( "swamptrooper", NPC_type ) == 0 )
00549                 {
00550                         return ( 1 << WP_FLECHETTE);
00551                 }
00552                 if ( Q_stricmp( "swamptrooper2", NPC_type ) == 0 )
00553                 {
00554                         return ( 1 << WP_REPEATER);
00555                 }
00556                 if ( Q_stricmp( "rockettrooper", NPC_type ) == 0 )
00557                 {
00558                         return ( 1 << WP_ROCKET_LAUNCHER);
00559                 }
00560                 if ( Q_strncmp( "shadowtrooper", NPC_type, 13 ) == 0 )
00561                 {
00562                         return ( 1 << WP_SABER);//|( 1 << WP_RAPID_CONCUSSION)?
00563                 }
00564                 if ( Q_stricmp( "imperial", NPC_type ) == 0 )
00565                 {
00566                         //return ( 1 << WP_BLASTER_PISTOL);
00567                         return ( 1 << WP_BLASTER);
00568                 }
00569                 if ( Q_strncmp( "impworker", NPC_type, 9 ) == 0 )
00570                 {
00571                         //return ( 1 << WP_BLASTER_PISTOL);
00572                         return ( 1 << WP_BLASTER);
00573                 }
00574                 if ( Q_stricmp( "stormpilot", NPC_type ) == 0 )
00575                 {
00576                         //return ( 1 << WP_BLASTER_PISTOL);
00577                         return ( 1 << WP_BLASTER);
00578                 }
00579                 if ( Q_stricmp( "galak", NPC_type ) == 0 )
00580                 {
00581                         return ( 1 << WP_BLASTER);
00582                 }
00583                 if ( Q_stricmp( "galak_mech", NPC_type ) == 0 )
00584                 {
00585                         return ( 1 << WP_REPEATER);
00586                 }
00587                 if ( Q_strncmp( "ugnaught", NPC_type, 8 ) == 0 )
00588                 {
00589                         return WP_NONE;
00590                 }
00591                 if ( Q_stricmp( "granshooter", NPC_type ) == 0 )
00592                 {
00593                         return ( 1 << WP_BLASTER);
00594                 }
00595                 if ( Q_stricmp( "granboxer", NPC_type ) == 0 )
00596                 {
00597                         return ( 1 << WP_STUN_BATON);
00598                 }
00599                 if ( Q_strncmp( "gran", NPC_type, 4 ) == 0 )
00600                 {
00601                         return (( 1 << WP_THERMAL)|( 1 << WP_STUN_BATON));
00602                 }
00603                 if ( Q_stricmp( "rodian", NPC_type ) == 0 )
00604                 {
00605                         return ( 1 << WP_DISRUPTOR);
00606                 }
00607                 if ( Q_stricmp( "rodian2", NPC_type ) == 0 )
00608                 {
00609                         return ( 1 << WP_BLASTER);
00610                 }
00611 
00612                 if (( Q_stricmp( "interrogator",NPC_type) == 0) || ( Q_stricmp( "sentry",NPC_type) == 0) || (Q_strncmp( "protocol",NPC_type,8) == 0) )
00613                 {
00614                         return WP_NONE;
00615                 }
00616 
00617                 if ( Q_strncmp( "weequay", NPC_type, 7 ) == 0 )
00618                 {
00619                         return ( 1 << WP_BOWCASTER);//|( 1 << WP_STAFF )(FIXME: new weap?)
00620                 }
00621                 if ( Q_stricmp( "impofficer", NPC_type ) == 0 )
00622                 {
00623                         return ( 1 << WP_BLASTER);
00624                 }
00625                 if ( Q_stricmp( "impcommander", NPC_type ) == 0 )
00626                 {
00627                         return ( 1 << WP_BLASTER);
00628                 }
00629                 if (( Q_stricmp( "probe", NPC_type ) == 0 ) || ( Q_stricmp( "seeker", NPC_type ) == 0 ))
00630                 {
00631                         //return ( 1 << WP_BOT_LASER);
00632                         return 0;
00633                 }       
00634                 if ( Q_stricmp( "remote", NPC_type ) == 0 )
00635                 {
00636                         //return ( 1 << WP_BOT_LASER );
00637                         return 0;
00638                 }       
00639                 if ( Q_stricmp( "trandoshan", NPC_type ) == 0 )
00640                 {
00641                         return (1<<WP_REPEATER);
00642                 }
00643                 if ( Q_stricmp( "atst", NPC_type ) == 0 )
00644                 {
00645                         //return (( 1 << WP_ATST_MAIN)|( 1 << WP_ATST_SIDE));
00646                         return 0;
00647                 }
00648                 if ( Q_stricmp( "mark1", NPC_type ) == 0 )
00649                 {
00650                         //return ( 1 << WP_BOT_LASER);
00651                         return 0;
00652                 }
00653                 if ( Q_stricmp( "mark2", NPC_type ) == 0 )
00654                 {
00655                         //return ( 1 << WP_BOT_LASER);
00656                         return 0;
00657                 }
00658                 if ( Q_stricmp( "minemonster", NPC_type ) == 0 )
00659                 {
00660                         return (( 1 << WP_STUN_BATON));
00661                 }
00662                 if ( Q_stricmp( "howler", NPC_type ) == 0 )
00663                 {
00664                         return (( 1 << WP_STUN_BATON));
00665                 }
00666                 //Stormtroopers, etc.
00667                 return ( 1 << WP_BLASTER);
00668                 break;
00669 
00670         case NPCTEAM_PLAYER:
00671                 
00672 //              if(spawnflags & SFB_TRICORDER)
00673 //                      return ( 1 << WP_TRICORDER);
00674                 
00675                 if(spawnflags & SFB_RIFLEMAN)
00676                         return ( 1 << WP_REPEATER);
00677                 
00678                 if(spawnflags & SFB_PHASER)
00679                         //return ( 1 << WP_BLASTER_PISTOL);
00680                         return ( 1 << WP_BLASTER);
00681 
00682                 if ( Q_strncmp( "jedi", NPC_type, 4 ) == 0 || Q_stricmp( "luke", NPC_type ) == 0 )
00683                         return ( 1 << WP_SABER);
00684 
00685                 if ( Q_strncmp( "prisoner", NPC_type, 8 ) == 0 )
00686                 {
00687                         return WP_NONE;
00688                 }
00689                 if ( Q_strncmp( "bespincop", NPC_type, 9 ) == 0 )
00690                 {
00691                         //return ( 1 << WP_BLASTER_PISTOL);
00692                         return ( 1 << WP_BLASTER);
00693                 }
00694 
00695                 if ( Q_stricmp( "MonMothma", NPC_type ) == 0 )
00696                 {
00697                         return WP_NONE;
00698                 }
00699 
00700                 //rebel
00701                 return ( 1 << WP_BLASTER);
00702                 break;
00703 
00704         case NPCTEAM_NEUTRAL:
00705 
00706                 if ( Q_stricmp( "mark1", NPC_type ) == 0 )
00707                 {
00708                         return WP_NONE;
00709                 }       
00710                 if ( Q_stricmp( "mark2", NPC_type ) == 0 )
00711                 {
00712                         return WP_NONE;
00713                 }       
00714                 if ( Q_strncmp( "ugnaught", NPC_type, 8 ) == 0 )
00715                 {
00716                         return WP_NONE;
00717                 }       
00718                 if ( Q_stricmp( "bartender", NPC_type ) == 0 )
00719                 {
00720                         return WP_NONE;
00721                 }
00722                 if ( Q_stricmp( "morgankatarn", NPC_type ) == 0 )
00723                 {
00724                         return WP_NONE;
00725                 }
00726         
00727                 break;
00728 
00729         // these no longer exist
00730 //      case TEAM_FORGE:
00731 //              return ( 1 << WP_STUN_BATON);
00732 //              break;
00733 
00734 //      case TEAM_STASIS:
00735 //              return ( 1 << WP_STUN_BATON);
00736 //              break;
00737 
00738 //      case TEAM_PARASITE:
00739 //              break;
00740 
00741 //      case TEAM_8472:
00742 //              break;
00743 
00744         default:
00745                 break;
00746         }
00747 
00748         return WP_NONE;
00749 }

void PlayerPain gentity_t self,
gentity_t attacker,
int  damage
 

void PM_SetLegsAnimTimer gentity_t ent,
int *  legsAnimTimer,
int  time
 

Referenced by Eject().

void PM_SetTorsoAnimTimer gentity_t ent,
int *  torsoAnimTimer,
int  time
 

Referenced by Eject().

void Q3_SetParm int  entID,
int  parmNum,
const char *  parmValue
 

Definition at line 3637 of file g_ICARUScb.c.

References atof(), Com_sprintf(), G_Alloc(), G_DebugPrint(), g_entities, gentity_t, MAX_PARMS, memset(), parms_t::parm, gentity_s::parms, strncpy(), and WL_WARNING.

Referenced by BG_ParseField(), NPC_Spawn_Do(), and Q3_Set().

03638 {
03639         gentity_t       *ent = &g_entities[entID];
03640         float           val;
03641 
03642         if ( !ent )
03643         {
03644                 G_DebugPrint( WL_WARNING, "Q3_SetParm: invalid entID %d\n", entID);
03645                 return;
03646         }
03647 
03648         if ( parmNum < 0 || parmNum >= MAX_PARMS )
03649         {
03650                 G_DebugPrint( WL_WARNING, "SET_PARM: parmNum %d out of range!\n", parmNum );
03651                 return;
03652         }
03653 
03654         if( !ent->parms )
03655         {
03656                 ent->parms = (parms_t *)G_Alloc( sizeof(parms_t) );
03657                 memset( ent->parms, 0, sizeof(parms_t) );
03658         }
03659 
03660         if ( (val = Q3_GameSideCheckStringCounterIncrement( parmValue )) )
03661         {
03662                 val += atof( ent->parms->parm[parmNum] );
03663                 Com_sprintf( ent->parms->parm[parmNum], sizeof(ent->parms->parm), "%f", val );
03664         }
03665         else
03666         {//Just copy the string
03667                 //copy only 16 characters
03668                 strncpy( ent->parms->parm[parmNum], parmValue, sizeof(ent->parms->parm[0]) );
03669                 //set the last charcter to null in case we had to truncate their passed string
03670                 if ( ent->parms->parm[parmNum][sizeof(ent->parms->parm[0]) - 1] != 0 )
03671                 {//Tried to set a string that is too long
03672                         ent->parms->parm[parmNum][sizeof(ent->parms->parm[0]) - 1] = 0;
03673                         G_DebugPrint( WL_WARNING, "SET_PARM: parm%d string too long, truncated to '%s'!\n", parmNum, ent->parms->parm[parmNum] );
03674                 }
03675         }
03676 }

void Rancor_SetBolts gentity_t self  ) 
 

Definition at line 19 of file NPC_AI_Rancor.c.

References gentity_s::client, gentity_t, gentity_s::ghoul2, renderInfo_s::handLBolt, renderInfo_s::handRBolt, renderInfo_s::headBolt, gclient_s::renderInfo, renderInfo_t, renderInfo_s::torsoBolt, and trap_G2API_AddBolt().

Referenced by NPC_SetMiscDefaultData().

00020 {
00021         if ( self && self->client )
00022         {
00023                 renderInfo_t *ri = &self->client->renderInfo;
00024                 ri->handRBolt = trap_G2API_AddBolt( self->ghoul2, 0, "*r_hand" );
00025                 ri->handLBolt = trap_G2API_AddBolt( self->ghoul2, 0, "*l_hand" );
00026                 ri->headBolt = trap_G2API_AddBolt( self->ghoul2, 0, "*head_eyes" );
00027                 ri->torsoBolt = trap_G2API_AddBolt( self->ghoul2, 0, "jaw_bone" );
00028         }
00029 }

void SP_NPC_Alora gentity_t self  ) 
 

Definition at line 2454 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

02455 {
02456         if ( (self->spawnflags&1) )
02457         {
02458                 self->NPC_type = "alora_dual";
02459         }
02460         else
02461         {
02462                 self->NPC_type = "alora";
02463         }
02464 
02465         SP_NPC_spawner( self );
02466 }

void SP_NPC_Bartender gentity_t self  ) 
 

Definition at line 2816 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

02817 {
02818         self->NPC_type = "Bartender";
02819 
02820         SP_NPC_spawner( self );
02821 }

void SP_NPC_BespinCop gentity_t self  ) 
 

Definition at line 3332 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, Q_irand(), and SP_NPC_spawner().

03333 {
03334         if ( !self->NPC_type )
03335         {
03336                 if ( !Q_irand( 0, 1 ) )
03337                 {
03338                         self->NPC_type = "BespinCop";
03339                 }
03340                 else
03341                 {
03342                         self->NPC_type = "BespinCop2";
03343                 }
03344         }
03345 
03346         SP_NPC_spawner( self );
03347 }

void SP_NPC_Cultist gentity_t self  ) 
 

Definition at line 2673 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, NULL, Q_irand(), SP_NPC_Cultist_Saber(), SP_NPC_spawner(), and gentity_s::spawnflags.

02674 {
02675         if ( !self->NPC_type )
02676         {
02677                 if ( (self->spawnflags&1) )
02678                 {
02679                         self->NPC_type = NULL;
02680                         self->spawnflags = 0;//fast, no throw
02681                         switch ( Q_irand( 0, 2 ) )
02682                         {
02683                         case 0://medium
02684                                 self->spawnflags |= 1;
02685                                 break;
02686                         case 1://strong
02687                                 self->spawnflags |= 2;
02688                                 break;
02689                         case 2://all
02690                                 self->spawnflags |= 4;
02691                                 break;
02692                         }
02693                         if ( Q_irand( 0, 1 ) )
02694                         {//throw
02695                                 self->spawnflags |= 8;
02696                         }
02697                         SP_NPC_Cultist_Saber( self );
02698                         return;
02699                 }
02700                 else if ( (self->spawnflags&2) )
02701                 {
02702                         self->NPC_type = "cultist_grip";
02703                 }
02704                 else if ( (self->spawnflags&4) )
02705                 {
02706                         self->NPC_type = "cultist_lightning";
02707                 }
02708                 else if ( (self->spawnflags&8) )
02709                 {
02710                         self->NPC_type = "cultist_drain";
02711                 }
02712                 else
02713                 {
02714                         self->NPC_type = "cultist";
02715                 }
02716         }
02717         
02718         SP_NPC_spawner( self );
02719 }

void SP_NPC_Cultist_Commando gentity_t self  ) 
 

Definition at line 2731 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

02732 {
02733         if ( !self->NPC_type )
02734         {
02735                 self->NPC_type = "cultistcommando";
02736         }
02737         SP_NPC_spawner( self );
02738 }

void SP_NPC_Cultist_Destroyer gentity_t self  ) 
 

Definition at line 2749 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

02750 {
02751         self->NPC_type = "cultist";//"cultist_explode";
02752         SP_NPC_spawner( self );
02753 }

void SP_NPC_Cultist_Saber gentity_t self  ) 
 

Definition at line 2536 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

Referenced by SP_NPC_Cultist().

02537 {
02538         if ( !self->NPC_type )
02539         {
02540                 if ( (self->spawnflags&1) )
02541                 {
02542                         if ( (self->spawnflags&8) )
02543                         {
02544                                 self->NPC_type = "cultist_saber_med_throw";
02545                         }
02546                         else
02547                         {
02548                                 self->NPC_type = "cultist_saber_med";
02549                         }
02550                 }
02551                 else if ( (self->spawnflags&2) )
02552                 {
02553                         if ( (self->spawnflags&8) )
02554                         {
02555                                 self->NPC_type = "cultist_saber_strong_throw";
02556                         }
02557                         else
02558                         {
02559                                 self->NPC_type = "cultist_saber_strong";
02560                         }
02561                 }
02562                 else if ( (self->spawnflags&2) )
02563                 {
02564                         if ( (self->spawnflags&8) )
02565                         {
02566                                 self->NPC_type = "cultist_saber_all_throw";
02567                         }
02568                         else
02569                         {
02570                                 self->NPC_type = "cultist_saber_all";
02571                         }
02572                 }
02573                 else
02574                 {
02575                         if ( (self->spawnflags&8) )
02576                         {
02577                                 self->NPC_type = "cultist_saber_throw";
02578                         }
02579                         else
02580                         {
02581                                 self->NPC_type = "cultist_saber";
02582                         }
02583                 }
02584         }
02585         
02586         SP_NPC_spawner( self );
02587 }

void SP_NPC_Cultist_Saber_Powers gentity_t self  ) 
 

Definition at line 2605 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

02606 {
02607         if ( !self->NPC_type )
02608         {
02609                 if ( (self->spawnflags&1) )
02610                 {
02611                         if ( (self->spawnflags&8) )
02612                         {
02613                                 self->NPC_type = "cultist_saber_med_throw2";
02614                         }
02615                         else
02616                         {
02617                                 self->NPC_type = "cultist_saber_med2";
02618                         }
02619                 }
02620                 else if ( (self->spawnflags&2) )
02621                 {
02622                         if ( (self->spawnflags&8) )
02623                         {
02624                                 self->NPC_type = "cultist_saber_strong_throw2";
02625                         }
02626                         else
02627                         {
02628                                 self->NPC_type = "cultist_saber_strong2";
02629                         }
02630                 }
02631                 else if ( (self->spawnflags&2) )
02632                 {
02633                         if ( (self->spawnflags&8) )
02634                         {
02635                                 self->NPC_type = "cultist_saber_all_throw2";
02636                         }
02637                         else
02638                         {
02639                                 self->NPC_type = "cultist_saber_all2";
02640                         }
02641                 }
02642                 else
02643                 {
02644                         if ( (self->spawnflags&8) )
02645                         {
02646                                 self->NPC_type = "cultist_saber_throw";
02647                         }
02648                         else
02649                         {
02650                                 self->NPC_type = "cultist_saber2";
02651                         }
02652                 }
02653         }
02654         
02655         SP_NPC_spawner( self );
02656 }

void SP_NPC_Desann gentity_t self  ) 
 

Definition at line 2800 of file NPC_spawn.c.

References CLASS_DESANN, gentity_t, gentity_s::NPC_type, NULL, SP_NPC_spawner(), and WP_SetSaberModel().

02801 {
02802         self->NPC_type = "Desann";
02803 
02804         WP_SetSaberModel( NULL, CLASS_DESANN );
02805 
02806         SP_NPC_spawner( self );
02807 }

void SP_NPC_Droid_ATST gentity_t self  ) 
 

Definition at line 3668 of file NPC_spawn.c.

References gentity_t, NPC_ATST_Precache(), gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

03669 {
03670         if ( (self->spawnflags&1) )
03671         {
03672                 self->NPC_type = "atst_vehicle";
03673         }
03674         else
03675         {
03676                 self->NPC_type = "atst";
03677         }
03678 
03679         SP_NPC_spawner( self );
03680 
03681         NPC_ATST_Precache();
03682 }

void SP_NPC_Droid_Gonk gentity_t self  ) 
 

Definition at line 3749 of file NPC_spawn.c.

References gentity_t, NPC_Gonk_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03750 {
03751         self->NPC_type = "gonk";
03752 
03753         SP_NPC_spawner( self );
03754 
03755         //precache the Gonk sounds
03756         NPC_Gonk_Precache();
03757 }

void SP_NPC_Droid_Interrogator gentity_t self  ) 
 

Definition at line 3596 of file NPC_spawn.c.

References gentity_t, NPC_Interrogator_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03597 {
03598         self->NPC_type = "interrogator";
03599 
03600         SP_NPC_spawner( self );
03601 
03602         NPC_Interrogator_Precache(self);
03603 }

void SP_NPC_Droid_Mark1 gentity_t self  ) 
 

Definition at line 3633 of file NPC_spawn.c.

References gentity_t, NPC_Mark1_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03634 {
03635         self->NPC_type = "mark1";
03636 
03637         SP_NPC_spawner( self );
03638 
03639         NPC_Mark1_Precache();
03640 }

void SP_NPC_Droid_Mark2 gentity_t self  ) 
 

Definition at line 3652 of file NPC_spawn.c.

References gentity_t, NPC_Mark2_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03653 {
03654         self->NPC_type = "mark2";
03655 
03656         SP_NPC_spawner( self );
03657 
03658         NPC_Mark2_Precache();
03659 }

void SP_NPC_Droid_Mouse gentity_t self  ) 
 

Definition at line 3770 of file NPC_spawn.c.

References gentity_t, NPC_Mouse_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03771 {
03772         self->NPC_type = "mouse";
03773 
03774         SP_NPC_spawner( self );
03775 
03776         //precache the Mouse sounds
03777         NPC_Mouse_Precache();
03778 
03779 }

void SP_NPC_Droid_Probe gentity_t self  ) 
 

Definition at line 3614 of file NPC_spawn.c.

References gentity_t, NPC_Probe_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03615 {
03616         self->NPC_type = "probe";
03617 
03618         SP_NPC_spawner( self );
03619 
03620         NPC_Probe_Precache();
03621 }

void SP_NPC_Droid_Protocol gentity_t self  ) 
 

Definition at line 3845 of file NPC_spawn.c.

References gentity_t, NPC_Protocol_Precache(), gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

03846 {
03847         if ( self->spawnflags&1 )
03848         {//imperial skin
03849                 self->NPC_type = "protocol_imp";
03850         }
03851         else
03852         {
03853                 self->NPC_type = "protocol";
03854         }
03855 
03856         SP_NPC_spawner( self );
03857         NPC_Protocol_Precache();
03858 }

void SP_NPC_Droid_R2D2 gentity_t self  ) 
 

Definition at line 3792 of file NPC_spawn.c.

References gentity_t, NPC_R2D2_Precache(), gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

03793 {
03794         if ( self->spawnflags&1 )
03795         {//imperial skin
03796                 self->NPC_type = "r2d2_imp";
03797         }
03798         else
03799         {
03800                 self->NPC_type = "r2d2";
03801         }
03802 
03803         SP_NPC_spawner( self );
03804 
03805         NPC_R2D2_Precache();
03806 }

void SP_NPC_Droid_R5D2 gentity_t self  ) 
 

Definition at line 3820 of file NPC_spawn.c.

References gentity_t, NPC_R5D2_Precache(), gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

03821 {
03822         if ( self->spawnflags&1 )
03823         {//imperial skin
03824                 self->NPC_type = "r5d2_imp";
03825         }
03826         else
03827         {
03828                 self->NPC_type = "r5d2";
03829         }
03830 
03831         SP_NPC_spawner( self );
03832 
03833         NPC_R5D2_Precache();
03834 }

void SP_NPC_Droid_Remote gentity_t self  ) 
 

Definition at line 3693 of file NPC_spawn.c.

References gentity_t, NPC_Remote_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03694 {
03695         self->NPC_type = "remote";
03696 
03697         SP_NPC_spawner( self );
03698 
03699         NPC_Remote_Precache();
03700 }

void SP_NPC_Droid_Seeker gentity_t self  ) 
 

Definition at line 3711 of file NPC_spawn.c.

References gentity_t, NPC_Seeker_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03712 {
03713         self->NPC_type = "seeker";
03714 
03715         SP_NPC_spawner( self );
03716 
03717         NPC_Seeker_Precache();
03718 }

void SP_NPC_Droid_Sentry gentity_t self  ) 
 

Definition at line 3729 of file NPC_spawn.c.

References gentity_t, NPC_Sentry_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03730 {
03731         self->NPC_type = "sentry";
03732 
03733         SP_NPC_spawner( self );
03734 
03735         NPC_Sentry_Precache();
03736 }

void SP_NPC_Galak gentity_t self  ) 
 

Definition at line 2778 of file NPC_spawn.c.

References gentity_t, NPC_GalakMech_Precache(), gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

02779 {
02780         if ( self->spawnflags & 1 )
02781         {
02782                 self->NPC_type = "Galak_Mech";
02783                 NPC_GalakMech_Precache();
02784         }
02785         else
02786         {
02787                 self->NPC_type = "Galak";
02788         }
02789 
02790         SP_NPC_spawner( self );
02791 }

void SP_NPC_Gran gentity_t self  ) 
 

Definition at line 3078 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, Q_irand(), SP_NPC_spawner(), and gentity_s::spawnflags.

03079 {
03080         if ( !self->NPC_type )
03081         {
03082                 if ( self->spawnflags & 1 )
03083                 {
03084                         self->NPC_type = "granshooter";
03085                 }
03086                 else if ( self->spawnflags & 2 )
03087                 {
03088                         self->NPC_type = "granboxer";
03089                 }
03090                 else
03091                 {
03092                         if ( Q_irand( 0, 1 ) )
03093                         {
03094                                 self->NPC_type = "gran";
03095                         }
03096                         else
03097                         {
03098                                 self->NPC_type = "gran2";
03099                         }
03100                 }
03101         }
03102 
03103         SP_NPC_spawner( self );
03104 }

void SP_NPC_Imperial gentity_t self  ) 
 

Definition at line 3261 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

03262 {
03263         if ( !self->NPC_type )
03264         {
03265                 if ( self->spawnflags & 1 )
03266                 {
03267                         self->NPC_type = "ImpOfficer";
03268                 }
03269                 else if ( self->spawnflags & 2 )
03270                 {
03271                         self->NPC_type = "ImpCommander";
03272                 }
03273                 else
03274                 {
03275                         self->NPC_type = "Imperial";
03276                 }
03277         }
03278 
03279         /*
03280         if ( self->message )
03281         {//may drop a key, precache the key model and pickup sound
03282                 G_SoundIndex( "sound/weapons/key_pkup.wav" );
03283                 if ( !Q_stricmp( "goodie", self->message ) )
03284                 {
03285                         RegisterItem( FindItemForInventory( INV_GOODIE_KEY ) );
03286                 }
03287                 else
03288                 {
03289                         RegisterItem( FindItemForInventory( INV_SECURITY_KEY ) );
03290                 }
03291         }
03292         */
03293         //rwwFIXMEFIXME: Allow goodie keys
03294         SP_NPC_spawner( self );
03295 }

void SP_NPC_ImpWorker gentity_t self  ) 
 

Definition at line 3304 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, Q_irand(), and SP_NPC_spawner().

03305 {
03306         if ( !self->NPC_type )
03307         {
03308                 if ( !Q_irand( 0, 2 ) )
03309                 {
03310                         self->NPC_type = "ImpWorker";
03311                 }
03312                 else if ( Q_irand( 0, 1 ) )
03313                 {
03314                         self->NPC_type = "ImpWorker2";
03315                 }
03316                 else
03317                 {
03318                         self->NPC_type = "ImpWorker3";
03319                 }
03320         }
03321 
03322         SP_NPC_spawner( self );
03323 }

void SP_NPC_Jan gentity_t self  ) 
 

Definition at line 2362 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

02363 {
02364         self->NPC_type = "Jan";
02365 
02366         SP_NPC_spawner( self );
02367 }

void SP_NPC_Jawa gentity_t self  ) 
 

Definition at line 3050 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

03051 {
03052         if ( !self->NPC_type )
03053         {
03054                 if ( (self->spawnflags&1) )
03055                 {
03056                         self->NPC_type = "jawa_armed";
03057                 }
03058                 else
03059                 {
03060                         self->NPC_type = "jawa";
03061                 }
03062         }
03063 
03064         SP_NPC_spawner( self );
03065 }

void SP_NPC_Jedi gentity_t self  ) 
 

Definition at line 2851 of file NPC_spawn.c.

References CLASS_JEDI, gentity_t, gentity_s::NPC_type, NULL, Q_irand(), SP_NPC_spawner(), gentity_s::spawnflags, and WP_SetSaberModel().

02852 {
02853         if(!self->NPC_type)
02854         {
02855                 if ( self->spawnflags & 1 )
02856                 {
02857                         self->NPC_type = "jeditrainer";
02858                 }
02859                 else 
02860                 {
02861                         /*
02862                         if ( !Q_irand( 0, 2 ) )
02863                         {
02864                                 self->NPC_type = "JediF";
02865                         }
02866                         else 
02867                         */if ( Q_irand( 0, 1 ) )
02868                         {
02869                                 self->NPC_type = "Jedi";
02870                         }
02871                         else
02872                         {
02873                                 self->NPC_type = "Jedi2";
02874                         }
02875                 }
02876         }
02877 
02878         WP_SetSaberModel( NULL, CLASS_JEDI );
02879 
02880         SP_NPC_spawner( self );
02881 }

void SP_NPC_Kyle gentity_t self  ) 
 

Definition at line 2332 of file NPC_spawn.c.

References CLASS_KYLE, gentity_t, gentity_s::NPC_type, NULL, SP_NPC_spawner(), and WP_SetSaberModel().

02333 {
02334         self->NPC_type = "Kyle";
02335 
02336         WP_SetSaberModel( NULL, CLASS_KYLE );
02337 
02338         SP_NPC_spawner( self );
02339 }

void SP_NPC_Lando gentity_t self  ) 
 

Definition at line 2348 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

02349 {
02350         self->NPC_type = "Lando";
02351 
02352         SP_NPC_spawner( self );
02353 }

void SP_NPC_Luke gentity_t self  ) 
 

Definition at line 2376 of file NPC_spawn.c.

References CLASS_LUKE, gentity_t, gentity_s::NPC_type, NULL, SP_NPC_spawner(), and WP_SetSaberModel().

02377 {
02378         self->NPC_type = "Luke";
02379 
02380         WP_SetSaberModel( NULL, CLASS_LUKE );
02381 
02382         SP_NPC_spawner( self );
02383 }

void SP_NPC_MineMonster gentity_t self  ) 
 

Definition at line 3475 of file NPC_spawn.c.

References gentity_t, NPC_MineMonster_Precache(), gentity_s::NPC_type, and SP_NPC_spawner().

03476 {
03477         self->NPC_type = "minemonster";
03478 
03479         SP_NPC_spawner( self );
03480         NPC_MineMonster_Precache();
03481 }

void SP_NPC_MonMothma gentity_t self  ) 
 

Definition at line 2392 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

02393 {
02394         self->NPC_type = "MonMothma";
02395 
02396         SP_NPC_spawner( self );
02397 }

void SP_NPC_Monster_Claw gentity_t self  ) 
 

Definition at line 3490 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03491 {
03492         self->NPC_type = "Claw";
03493 
03494         SP_NPC_spawner( self );
03495 }

void SP_NPC_Monster_Fish gentity_t self  ) 
 

Definition at line 3546 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03547 {
03548         self->NPC_type = "Fish";
03549 
03550         SP_NPC_spawner( self );
03551 }

void SP_NPC_Monster_Flier2 gentity_t self  ) 
 

Definition at line 3518 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03519 {
03520         self->NPC_type = "Flier2";
03521 
03522         SP_NPC_spawner( self );
03523 }

void SP_NPC_Monster_Glider gentity_t self  ) 
 

Definition at line 3504 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03505 {
03506         self->NPC_type = "Glider";
03507 
03508         SP_NPC_spawner( self );
03509 }

void SP_NPC_Monster_Howler gentity_t self  ) 
 

Definition at line 3461 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03462 {
03463         self->NPC_type = "howler";
03464 
03465         SP_NPC_spawner( self );
03466 }

void SP_NPC_Monster_Lizard gentity_t self  ) 
 

Definition at line 3532 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03533 {
03534         self->NPC_type = "Lizard";
03535 
03536         SP_NPC_spawner( self );
03537 }

void SP_NPC_Monster_Murjj gentity_t self  ) 
 

Definition at line 3433 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03434 {
03435         self->NPC_type = "Murjj";
03436 
03437         SP_NPC_spawner( self );
03438 }

void SP_NPC_Monster_Rancor gentity_t self  ) 
 

Definition at line 3578 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03579 {
03580         self->NPC_type = "rancor";
03581 
03582         SP_NPC_spawner( self );
03583 }

void SP_NPC_Monster_Swamp gentity_t self  ) 
 

Definition at line 3447 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03448 {
03449         self->NPC_type = "Swamp";
03450 
03451         SP_NPC_spawner( self );
03452 }

void SP_NPC_Monster_Wampa gentity_t self  ) 
 

Definition at line 3562 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, NPC_Wampa_Precache(), and SP_NPC_spawner().

03563 {
03564         self->NPC_type = "wampa";
03565 
03566         NPC_Wampa_Precache();
03567 
03568         SP_NPC_spawner( self );
03569 }

void SP_NPC_MorganKatarn gentity_t self  ) 
 

Definition at line 2830 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

02831 {
02832         self->NPC_type = "MorganKatarn";
02833 
02834         SP_NPC_spawner( self );
02835 }

void SP_NPC_Noghri gentity_t self  ) 
 

Definition at line 3211 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03212 {
03213         if ( !self->NPC_type )
03214         {
03215                 self->NPC_type = "noghri";
03216         }
03217 
03218         SP_NPC_spawner( self );
03219 }

void SP_NPC_Prisoner gentity_t self  ) 
 

Definition at line 2890 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, Q_irand(), and SP_NPC_spawner().

02891 {
02892         if(!self->NPC_type)
02893         {
02894                 if ( Q_irand( 0, 1 ) )
02895                 {
02896                         self->NPC_type = "Prisoner";
02897                 }
02898                 else
02899                 {
02900                         self->NPC_type = "Prisoner2";
02901                 }
02902         }
02903 
02904         SP_NPC_spawner( self );
02905 }

void SP_NPC_Rebel gentity_t self  ) 
 

Definition at line 2914 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, Q_irand(), and SP_NPC_spawner().

02915 {
02916         if(!self->NPC_type)
02917         {
02918                 if ( Q_irand( 0, 1 ) )
02919                 {
02920                         self->NPC_type = "Rebel";
02921                 }
02922                 else
02923                 {
02924                         self->NPC_type = "Rebel2";
02925                 }
02926         }
02927 
02928         SP_NPC_spawner( self );
02929 }

void SP_NPC_Reborn gentity_t self  ) 
 

Definition at line 3366 of file NPC_spawn.c.

References CLASS_REBORN, gentity_t, gentity_s::NPC_type, NULL, SP_NPC_spawner(), gentity_s::spawnflags, and WP_SetSaberModel().

03367 {
03368         if ( !self->NPC_type )
03369         {
03370                 if ( self->spawnflags & 1 )
03371                 {
03372                         self->NPC_type = "rebornforceuser";
03373                 }
03374                 else if ( self->spawnflags & 2 )
03375                 {
03376                         self->NPC_type = "rebornfencer";
03377                 }
03378                 else if ( self->spawnflags & 4 )
03379                 {
03380                         self->NPC_type = "rebornacrobat";
03381                 }
03382                 else if ( self->spawnflags & 8 )
03383                 {
03384                         self->NPC_type = "rebornboss";
03385                 }
03386                 else
03387                 {
03388                         self->NPC_type = "reborn";
03389                 }
03390         }
03391         
03392         WP_SetSaberModel( NULL, CLASS_REBORN );
03393         SP_NPC_spawner( self );
03394 }

void SP_NPC_Reborn_New gentity_t self  ) 
 

Definition at line 2481 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

02482 {
02483         if ( !self->NPC_type )
02484         {
02485                 if ( (self->spawnflags&4) )
02486                 {//weaker guys
02487                         if ( (self->spawnflags&1) )
02488                         {
02489                                 self->NPC_type = "reborn_dual2";
02490                         }
02491                         else if ( (self->spawnflags&2) )
02492                         {
02493                                 self->NPC_type = "reborn_staff2";
02494                         }
02495                         else
02496                         {
02497                                 self->NPC_type = "reborn_new2";
02498                         }
02499                 }
02500                 else
02501                 {
02502                         if ( (self->spawnflags&1) )
02503                         {
02504                                 self->NPC_type = "reborn_dual";
02505                         }
02506                         else if ( (self->spawnflags&2) )
02507                         {
02508                                 self->NPC_type = "reborn_staff";
02509                         }
02510                         else
02511                         {
02512                                 self->NPC_type = "reborn_new";
02513                         }
02514                 }
02515         }
02516         
02517         SP_NPC_spawner( self );
02518 }

void SP_NPC_Reelo gentity_t self  ) 
 

Definition at line 2762 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

02763 {
02764         self->NPC_type = "Reelo";
02765 
02766         SP_NPC_spawner( self );
02767 }

void SP_NPC_Rodian gentity_t self  ) 
 

Definition at line 3115 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

03116 {
03117         if ( !self->NPC_type )
03118         {
03119                 if ( self->spawnflags&1 )
03120                 {
03121                         self->NPC_type = "rodian2";
03122                 }
03123                 else
03124                 {
03125                         self->NPC_type = "rodian";
03126                 }
03127         }
03128 
03129         SP_NPC_spawner( self );
03130 }

void SP_NPC_ShadowTrooper gentity_t self  ) 
 

Definition at line 3403 of file NPC_spawn.c.

References CLASS_SHADOWTROOPER, gentity_t, NPC_ShadowTrooper_Precache(), gentity_s::NPC_type, NULL, Q_irand(), SP_NPC_spawner(), and WP_SetSaberModel().

03404 {
03405         if(!self->NPC_type)
03406         {
03407                 if ( !Q_irand( 0, 1 ) )
03408                 {
03409                         self->NPC_type = "ShadowTrooper";
03410                 }
03411                 else
03412                 {
03413                         self->NPC_type = "ShadowTrooper2";
03414                 }
03415         }
03416         
03417         NPC_ShadowTrooper_Precache();
03418         WP_SetSaberModel( NULL, CLASS_SHADOWTROOPER );
03419 
03420         SP_NPC_spawner( self );
03421 }

void SP_NPC_Snowtrooper gentity_t self  ) 
 

Definition at line 2995 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

02996 {
02997         self->NPC_type = "snowtrooper";
02998 
02999         SP_NPC_spawner( self );
03000 }

void SP_NPC_spawner gentity_t self  ) 
 

Definition at line 1967 of file NPC_spawn.c.

References gentity_s::count, gentity_s::delay, gentity_s::fullName, g_allowNPC, G_FreeEntity(), G_SpawnInt(), gentity_t, vmCvar_t::integer, level, gentity_s::nextthink, NPC_Precache(), NPC_PrecacheAnimationCFG(), NPC_Spawn(), NPC_Spawn_Go(), gentity_s::NPC_type, qtrue, gentity_s::r, gentity_s::s, entityState_s::shouldtarget, START_TIME_REMOVE_ENTS, SVF_NO_BASIC_SOUNDS, SVF_NO_COMBAT_SOUNDS, SVF_NO_EXTRA_SOUNDS, entityShared_t::svFlags, gentity_s::targetname, gentity_s::think, level_locals_t::time, gentity_s::use, and gentity_s::wait.

Referenced by SP_NPC_Alora(), SP_NPC_Bartender(), SP_NPC_BespinCop(), SP_NPC_Cultist(), SP_NPC_Cultist_Commando(), SP_NPC_Cultist_Destroyer(), SP_NPC_Cultist_Saber(), SP_NPC_Cultist_Saber_Powers(), SP_NPC_Desann(), SP_NPC_Droid_ATST(), SP_NPC_Droid_Gonk(), SP_NPC_Droid_Interrogator(), SP_NPC_Droid_Mark1(), SP_NPC_Droid_Mark2(), SP_NPC_Droid_Mouse(), SP_NPC_Droid_Probe(), SP_NPC_Droid_Protocol(), SP_NPC_Droid_R2D2(), SP_NPC_Droid_R5D2(), SP_NPC_Droid_Remote(), SP_NPC_Droid_Seeker(), SP_NPC_Droid_Sentry(), SP_NPC_Galak(), SP_NPC_Gran(), SP_NPC_Imperial(), SP_NPC_ImpWorker(), SP_NPC_Jan(), SP_NPC_Jawa(), SP_NPC_Jedi(), SP_NPC_Kyle(), SP_NPC_Lando(), SP_NPC_Luke(), SP_NPC_MineMonster(), SP_NPC_MonMothma(), SP_NPC_Monster_Claw(), SP_NPC_Monster_Fish(), SP_NPC_Monster_Flier2(), SP_NPC_Monster_Glider(), SP_NPC_Monster_Howler(), SP_NPC_Monster_Lizard(), SP_NPC_Monster_Murjj(), SP_NPC_Monster_Rancor(), SP_NPC_Monster_Swamp(), SP_NPC_Monster_Wampa(), SP_NPC_MorganKatarn(), SP_NPC_Noghri(), SP_NPC_Prisoner(), SP_NPC_Rebel(), SP_NPC_Reborn(), SP_NPC_Reborn_New(), SP_NPC_Reelo(), SP_NPC_Rodian(), SP_NPC_ShadowTrooper(), SP_NPC_Snowtrooper(), SP_NPC_Stormtrooper(), SP_NPC_SwampTrooper(), SP_NPC_Tavion(), SP_NPC_Tavion_New(), SP_NPC_Tie_Pilot(), SP_NPC_Trandoshan(), SP_NPC_Tusken(), SP_NPC_Ugnaught(), and SP_NPC_Weequay().

01968 {
01969         int t;
01970 
01971         if (!g_allowNPC.integer)
01972         {
01973                 self->think = G_FreeEntity;
01974                 self->nextthink = level.time;
01975                 return;
01976         }
01977         if ( !self->fullName || !self->fullName[0] )
01978         {
01979                 //FIXME: make an index into an external string table for localization
01980                 self->fullName = "Humanoid Lifeform";
01981         }
01982 
01983         //register/precache the models needed for this NPC, not anymore
01984         //self->classname = "NPC_spawner";
01985 
01986         if(!self->count)
01987         {
01988                 self->count = 1;
01989         }
01990 
01991         {//Stop loading of certain extra sounds
01992                 static  int     garbage;
01993 
01994                 if ( G_SpawnInt( "noBasicSounds", "0", &garbage ) )
01995                 {
01996                         self->r.svFlags |= SVF_NO_BASIC_SOUNDS;
01997                 }
01998                 if ( G_SpawnInt( "noCombatSounds", "0", &garbage ) )
01999                 {
02000                         self->r.svFlags |= SVF_NO_COMBAT_SOUNDS;
02001                 }
02002                 if ( G_SpawnInt( "noExtraSounds", "0", &garbage ) )
02003                 {
02004                         self->r.svFlags |= SVF_NO_EXTRA_SOUNDS;
02005                 }
02006         }
02007 
02008         if ( !self->wait )
02009         {
02010                 self->wait = 500;
02011         }
02012         else
02013         {
02014                 self->wait *= 1000;//1 = 1 msec, 1000 = 1 sec
02015         }
02016 
02017         self->delay *= 1000;//1 = 1 msec, 1000 = 1 sec
02018 
02019         G_SpawnInt( "showhealth", "0", &t );
02020         if (t)
02021         {
02022                 self->s.shouldtarget = qtrue;
02023         }
02024         /*
02025         if ( self->delay > 0 )
02026         {
02027                 self->r.svFlags |= SVF_NPC_PRECACHE;
02028         }
02029         */
02030         //rwwFIXMEFIXME: support for this flag?
02031 
02032         //We have to load the animation.cfg now because spawnscripts are going to want to set anims and we need to know their length and if they're valid
02033         NPC_PrecacheAnimationCFG( self->NPC_type );
02034 
02035         //rww - can't cheat and do this on the client like in SP, so I'm doing this.
02036         NPC_Precache(self);
02037 
02038         if ( self->targetname )
02039         {//Wait for triggering
02040                 self->use = NPC_Spawn;
02041         //      self->r.svFlags |= SVF_NPC_PRECACHE;//FIXME: precache my weapons somehow?
02042 
02043                 //NPC_PrecacheModels( self->NPC_type );
02044         }
02045         else
02046         {
02047                 //NOTE: auto-spawners never check for shy spawning
02048                 //if ( spawning )
02049                 if (1) //just gonna always do this I suppose.
02050                 {//in entity spawn stage - map starting up
02051                         self->think = NPC_Spawn_Go;
02052                         self->nextthink = level.time + START_TIME_REMOVE_ENTS + 50;
02053                 }
02054                 else
02055                 {//else spawn right now
02056                         NPC_Spawn( self, self, self );
02057                 }
02058         }
02059 
02060         //FIXME: store cameraGroup somewhere else and apply to spawned NPCs' cameraGroup
02061         //Or just don't include NPC_spawners in cameraGroupings
02062 }

void SP_NPC_Stormtrooper gentity_t self  ) 
 

Definition at line 2949 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, Q_irand(), SP_NPC_spawner(), and gentity_s::spawnflags.

Referenced by SP_NPC_StormtrooperOfficer().

02950 {
02951         if ( self->spawnflags & 8 )
02952         {//rocketer
02953                 self->NPC_type = "rockettrooper";
02954         }
02955         else if ( self->spawnflags & 4 )
02956         {//alt-officer
02957                 self->NPC_type = "stofficeralt";
02958         }
02959         else if ( self->spawnflags & 2 )
02960         {//commander
02961                 self->NPC_type = "stcommander";
02962         }
02963         else if ( self->spawnflags & 1 )
02964         {//officer
02965                 self->NPC_type = "stofficer";
02966         }
02967         else
02968         {//regular trooper
02969                 if ( Q_irand( 0, 1 ) )
02970                 {
02971                         self->NPC_type = "StormTrooper";
02972                 }
02973                 else
02974                 {
02975                         self->NPC_type = "StormTrooper2";
02976                 }
02977         }
02978 
02979         SP_NPC_spawner( self );
02980 }

void SP_NPC_StormtrooperOfficer gentity_t self  ) 
 

Definition at line 2981 of file NPC_spawn.c.

References gentity_t, SP_NPC_Stormtrooper(), and gentity_s::spawnflags.

02982 {
02983         self->spawnflags |= 1;
02984         SP_NPC_Stormtrooper( self );
02985 }

void SP_NPC_SwampTrooper gentity_t self  ) 
 

Definition at line 3229 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

03230 {
03231         if ( !self->NPC_type )
03232         {
03233                 if ( self->spawnflags & 1 )
03234                 {
03235                         self->NPC_type = "SwampTrooper2";
03236                 }
03237                 else
03238                 {
03239                         self->NPC_type = "SwampTrooper";
03240                 }
03241         }
03242 
03243         SP_NPC_spawner( self );
03244 }

void SP_NPC_Tavion gentity_t self  ) 
 

Definition at line 2406 of file NPC_spawn.c.

References CLASS_TAVION, gentity_t, gentity_s::NPC_type, NULL, SP_NPC_spawner(), and WP_SetSaberModel().

02407 {
02408         self->NPC_type = "Tavion";
02409 
02410         WP_SetSaberModel( NULL, CLASS_TAVION );
02411 
02412         SP_NPC_spawner( self );
02413 }

void SP_NPC_Tavion_New gentity_t self  ) 
 

Definition at line 2426 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

02427 {
02428         if ( (self->spawnflags&1) )
02429         {
02430                 self->NPC_type = "tavion_scepter";
02431         }
02432         else if ( (self->spawnflags&2) )
02433         {
02434                 self->NPC_type = "tavion_sith_sword";
02435         }
02436         else
02437         {
02438                 self->NPC_type = "tavion_new";
02439         }
02440 
02441         SP_NPC_spawner( self );
02442 }

void SP_NPC_Tie_Pilot gentity_t self  ) 
 

Definition at line 3010 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03011 {
03012         self->NPC_type = "stormpilot";
03013 
03014         SP_NPC_spawner( self );
03015 }

void SP_NPC_Trandoshan gentity_t self  ) 
 

Definition at line 3170 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, and SP_NPC_spawner().

03171 {
03172         if ( !self->NPC_type )
03173         {
03174                 self->NPC_type = "Trandoshan";
03175         }
03176 
03177         SP_NPC_spawner( self );
03178 }

void SP_NPC_Tusken gentity_t self  ) 
 

Definition at line 3187 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, SP_NPC_spawner(), and gentity_s::spawnflags.

03188 {
03189         if ( !self->NPC_type )
03190         {
03191                 if ( (self->spawnflags&1) )
03192                 {
03193                         self->NPC_type = "tuskensniper";
03194                 }
03195                 else
03196                 {
03197                         self->NPC_type = "tusken";
03198                 }
03199         }
03200 
03201         SP_NPC_spawner( self );
03202 }

void SP_NPC_Ugnaught gentity_t self  ) 
 

Definition at line 3024 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, Q_irand(), and SP_NPC_spawner().

03025 {
03026         if ( !self->NPC_type )
03027         {
03028                 if ( Q_irand( 0, 1 ) )
03029                 {
03030                         self->NPC_type = "Ugnaught";
03031                 }
03032                 else
03033                 {
03034                         self->NPC_type = "Ugnaught2";
03035                 }
03036         }
03037 
03038         SP_NPC_spawner( self );
03039 }

void SP_NPC_Vehicle gentity_t self  ) 
 

Definition at line 2182 of file NPC_spawn.c.

References entityState_s::angles, ceil(), gentity_s::classname, gentity_s::delay, gentity_s::fly_sound_debounce_time, G_FreeEntity(), G_SetAngles(), G_SetOrigin(), G_SpawnFloat(), G_SpawnInt(), G_VehicleSpawn(), gentity_t, level, gentity_s::nextthink, gentity_s::NPC_type, NPC_VehiclePrecache(), NPC_VehicleSpawnUse(), entityState_s::origin, qtrue, gentity_s::s, entityState_s::shouldtarget, gentity_s::targetname, gentity_s::think, level_locals_t::time, gentity_s::use, and gentity_s::wait.

02183 {
02184         float dropTime;
02185         int             t;
02186         if ( !self->NPC_type )
02187         {
02188                 self->NPC_type = "swoop";
02189         }
02190 
02191         if ( !self->classname )
02192         {
02193                 self->classname = "NPC_Vehicle";
02194         }
02195 
02196         if ( !self->wait )
02197         {
02198                 self->wait = 500;
02199         }
02200         else
02201         {
02202                 self->wait *= 1000;//1 = 1 msec, 1000 = 1 sec
02203         }
02204         self->delay *= 1000;//1 = 1 msec, 1000 = 1 sec
02205 
02206         G_SetOrigin( self, self->s.origin );
02207         G_SetAngles( self, self->s.angles );
02208         G_SpawnFloat( "dropTime", "0", &dropTime );
02209         if ( dropTime )
02210         {
02211                 self->fly_sound_debounce_time = ceil(dropTime*1000.0);
02212         }
02213         
02214         G_SpawnInt( "showhealth", "0", &t );
02215         if (t)
02216         {
02217                 self->s.shouldtarget = qtrue;
02218         }
02219         //FIXME: PRECACHE!!!
02220 
02221         if ( self->targetname )
02222         {
02223                 if ( !NPC_VehiclePrecache( self ) )
02224                 {//FIXME: err msg?
02225                         G_FreeEntity( self );
02226                         return;
02227                 }
02228                 self->use = NPC_VehicleSpawnUse;
02229         }
02230         else
02231         {
02232                 if ( self->delay )
02233                 {
02234                         if ( !NPC_VehiclePrecache( self ) )
02235                         {//FIXME: err msg?
02236                                 G_FreeEntity( self );
02237                                 return;
02238                         }
02239                         self->think = G_VehicleSpawn;
02240                         self->nextthink = level.time + self->delay;
02241                 }
02242                 else
02243                 {
02244                         G_VehicleSpawn( self );
02245                 }
02246         }
02247 }

void SP_NPC_Weequay gentity_t self  ) 
 

Definition at line 3139 of file NPC_spawn.c.

References gentity_t, gentity_s::NPC_type, Q_irand(), and SP_NPC_spawner().

03140 {
03141         if ( !self->NPC_type )
03142         {
03143                 switch ( Q_irand( 0, 3 ) )
03144                 {
03145                 case 0:
03146                         self->NPC_type = "Weequay";
03147                         break;
03148                 case 1:
03149                         self->NPC_type = "Weequay2";
03150                         break;
03151                 case 2:
03152                         self->NPC_type = "Weequay3";
03153                         break;
03154                 case 3:
03155                         self->NPC_type = "Weequay4";
03156                         break;
03157                 }
03158         }
03159 
03160         SP_NPC_spawner( self );
03161 }

qboolean SpotWouldTelefrag2 gentity_t mover,
vec3_t  dest
 

Definition at line 554 of file g_client.c.

References entityShared_t::contents, g_entities, gentity_t, MAX_GENTITIES, entityShared_t::maxs, entityShared_t::mins, qboolean, qfalse, qtrue, gentity_s::r, trap_EntitiesInBox(), vec3_t, and VectorAdd.

Referenced by MoveOwner(), and SolidifyOwner().

00555 {
00556         int                     i, num;
00557         int                     touch[MAX_GENTITIES];
00558         gentity_t       *hit;
00559         vec3_t          mins, maxs;
00560 
00561         VectorAdd( dest, mover->r.mins, mins );
00562         VectorAdd( dest, mover->r.maxs, maxs );
00563         num = trap_EntitiesInBox( mins, maxs, touch, MAX_GENTITIES );
00564 
00565         for (i=0 ; i<num ; i++) 
00566         {
00567                 hit = &g_entities[touch[i]];
00568                 if ( hit == mover )
00569                 {
00570                         continue;
00571                 }
00572 
00573                 if ( hit->r.contents & mover->r.contents )
00574                 {
00575                         return qtrue;
00576                 }
00577         }
00578 
00579         return qfalse;
00580 }

void ST_ClearTimers gentity_t ent  ) 
 

Definition at line 88 of file NPC_AI_Stormtrooper.c.

References gentity_t, and TIMER_Set().

Referenced by NPC_SetMiscDefaultData().

00089 {
00090         TIMER_Set( ent, "chatter", 0 );
00091         TIMER_Set( ent, "duck", 0 );
00092         TIMER_Set( ent, "stand", 0 );
00093         TIMER_Set( ent, "shuffleTime", 0 );
00094         TIMER_Set( ent, "sleepTime", 0 );
00095         TIMER_Set( ent, "enemyLastVisible", 0 );
00096         TIMER_Set( ent, "roamTime", 0 );
00097         TIMER_Set( ent, "hideTime", 0 );
00098         TIMER_Set( ent, "attackDelay", 0 );     //FIXME: Slant for difficulty levels
00099         TIMER_Set( ent, "stick", 0 );
00100         TIMER_Set( ent, "scoutTime", 0 );
00101         TIMER_Set( ent, "flee", 0 );
00102         TIMER_Set( ent, "interrogating", 0 );
00103         TIMER_Set( ent, "verifyCP", 0 );
00104 }

void station_pain gentity_t self,
gentity_t attacker,
int  damage
 

team_t TranslateTeamName const char *  name  ) 
 

void TurretPain gentity_t self,
gentity_t attacker,
int  damage
 

Definition at line 11 of file g_turret.c.

References gentity_s::attackDebounceTime, gentity_s::client, gentity_s::enemy, G_ScaleNetHealth(), G_SetEnemy(), gentity_t, gentity_s::health, level, gentity_s::maxHealth, gentity_s::painDebounceTime, gclient_s::ps, random, gentity_s::target_ent, level_locals_t::time, playerState_s::weapon, and WP_DEMP2.

Referenced by turret_base_spawn_top(), and TurretBasePain().

00013 {
00014         if (self->target_ent)
00015         {
00016                 self->target_ent->health = self->health;
00017                 if (self->target_ent->maxHealth)
00018                 {
00019                         G_ScaleNetHealth(self->target_ent);
00020                 }
00021         }
00022 
00023         if ( attacker->client && attacker->client->ps.weapon == WP_DEMP2 )
00024         {
00025                 self->attackDebounceTime = level.time + 800 + random() * 500;
00026                 self->painDebounceTime = self->attackDebounceTime;
00027         }
00028         if ( !self->enemy )
00029         {//react to being hit
00030                 G_SetEnemy( self, attacker );
00031         }
00032 }

void Wampa_SetBolts gentity_t self  ) 
 

Definition at line 16 of file NPC_AI_Wampa.c.

References gentity_s::client, renderInfo_s::crotchBolt, renderInfo_s::footLBolt, renderInfo_s::footRBolt, gentity_t, gentity_s::ghoul2, renderInfo_s::handLBolt, renderInfo_s::handRBolt, renderInfo_s::headBolt, gclient_s::renderInfo, renderInfo_t, renderInfo_s::torsoBolt, and trap_G2API_AddBolt().

Referenced by NPC_SetMiscDefaultData().

00017 {
00018         if ( self && self->client )
00019         {
00020                 renderInfo_t *ri = &self->client->renderInfo;
00021                 ri->headBolt = trap_G2API_AddBolt(self->ghoul2, 0, "*head_eyes");
00022                 //ri->cervicalBolt = trap_G2API_AddBolt(self->ghoul2, 0, "neck_bone" );
00023                 //ri->chestBolt = trap_G2API_AddBolt(self->ghoul2, 0, "upper_spine");
00024                 //ri->gutBolt = trap_G2API_AddBolt(self->ghoul2, 0, "mid_spine");
00025                 ri->torsoBolt = trap_G2API_AddBolt(self->ghoul2, 0, "lower_spine");
00026                 ri->crotchBolt = trap_G2API_AddBolt(self->ghoul2, 0, "rear_bone");
00027                 //ri->elbowLBolt = trap_G2API_AddBolt(self->ghoul2, 0, "*l_arm_elbow");
00028                 //ri->elbowRBolt = trap_G2API_AddBolt(self->ghoul2, 0, "*r_arm_elbow");
00029                 ri->handLBolt = trap_G2API_AddBolt(self->ghoul2, 0, "*l_hand");
00030                 ri->handRBolt = trap_G2API_AddBolt(self->ghoul2, 0, "*r_hand");
00031                 //ri->kneeLBolt = trap_G2API_AddBolt(self->ghoul2, 0, "*hips_l_knee");
00032                 //ri->kneeRBolt = trap_G2API_AddBolt(self->ghoul2, 0, "*hips_r_knee");
00033                 ri->footLBolt = trap_G2API_AddBolt(self->ghoul2, 0, "*l_leg_foot");
00034                 ri->footRBolt = trap_G2API_AddBolt(self->ghoul2, 0, "*r_leg_foot");
00035         }
00036 }

int WP_SetSaberModel gclient_t client,
class_t  npcClass
 

Definition at line 90 of file NPC_spawn.c.

References gclient_t.

Referenced by SP_NPC_Desann(), SP_NPC_Jedi(), SP_NPC_Kyle(), SP_NPC_Luke(), SP_NPC_Reborn(), SP_NPC_ShadowTrooper(), and SP_NPC_Tavion().

00091 {
00092         //rwwFIXMEFIXME: Do something here, need to let the client know.
00093         return 1;
00094 }


Variable Documentation

gNPC_t* gNPCPtrs[MAX_GENTITIES]
 

Definition at line 1270 of file NPC_spawn.c.

Referenced by New_NPC_t().

qboolean showBBoxes = qfalse
 

Definition at line 4176 of file NPC_spawn.c.

char* TeamNames[TEAM_NUM_TEAMS]
 

Definition at line 21 of file NPC_spawn.c.

Referenced by NPC_Kill_f().

stringID_table_t TeamTable[]
 

Definition at line 4038 of file NPC_spawn.c.

Referenced by NPC_Kill_f(), NPC_ParseParms(), and NPC_Precache().