00001 #ifndef __B_PUBLIC_H__
00002 #define __B_PUBLIC_H__
00003
00004 #include "ai.h"
00005
00006 #define NPCAI_CHECK_WEAPON 0x00000001
00007 #define NPCAI_BURST_WEAPON 0x00000002
00008 #define NPCAI_MOVING 0x00000004
00009 #define NPCAI_TOUCHED_GOAL 0x00000008
00010 #define NPCAI_PUSHED 0x00000010
00011 #define NPCAI_NO_COLL_AVOID 0x00000020
00012 #define NPCAI_BLOCKED 0x00000040
00013 #define NPCAI_OFF_PATH 0x00000100
00014 #define NPCAI_IN_SQUADPOINT 0x00000200
00015 #define NPCAI_STRAIGHT_TO_DESTPOS 0x00000400
00016 #define NPCAI_NO_SLOWDOWN 0x00001000
00017 #define NPCAI_LOST 0x00002000 //Can't nav to his goal
00018 #define NPCAI_SHIELDS 0x00004000 //Has shields, borg can adapt
00019 #define NPCAI_GREET_ALLIES 0x00008000 //Say hi to nearby allies
00020 #define NPCAI_FORM_TELE_NAV 0x00010000 //Tells formation people to use nav info to get to
00021 #define NPCAI_ENROUTE_TO_HOMEWP 0x00020000 //Lets us know to run our lostenemyscript when we get to homeWp
00022 #define NPCAI_MATCHPLAYERWEAPON 0x00040000 //Match the player's weapon except when it changes during cinematics
00023 #define NPCAI_DIE_ON_IMPACT 0x00100000 //Next time you crashland, die!
00024 #define NPCAI_CUSTOM_GRAVITY 0x00200000 //Don't use g_gravity, I fly!
00025
00026
00027 #define SCF_CROUCHED 0x00000001 //Force ucmd.upmove to be -127
00028 #define SCF_WALKING 0x00000002 //Force BUTTON_WALKING to be pressed
00029 #define SCF_MORELIGHT 0x00000004 //NPC will have a minlight of 96
00030 #define SCF_LEAN_RIGHT 0x00000008 //Force rightmove+BUTTON_USE
00031 #define SCF_LEAN_LEFT 0x00000010 //Force leftmove+BUTTON_USE
00032 #define SCF_RUNNING 0x00000020 //Takes off walking button, overrides SCF_WALKING
00033 #define SCF_ALT_FIRE 0x00000040 //Force to use alt-fire when firing
00034 #define SCF_NO_RESPONSE 0x00000080 //NPC will not do generic responses to being used
00035 #define SCF_FFDEATH 0x00000100 //Just tells player_die to run the friendly fire deathscript
00036 #define SCF_NO_COMBAT_TALK 0x00000200 //NPC will not use their generic combat chatter stuff
00037 #define SCF_CHASE_ENEMIES 0x00000400 //NPC chase enemies - FIXME: right now this is synonymous with using combat points... should it be?
00038 #define SCF_LOOK_FOR_ENEMIES 0x00000800 //NPC be on the lookout for enemies
00039 #define SCF_FACE_MOVE_DIR 0x00001000 //NPC face direction it's moving - FIXME: not really implemented right now
00040 #define SCF_IGNORE_ALERTS 0x00002000 //NPC ignore alert events
00041 #define SCF_DONT_FIRE 0x00004000 //NPC won't shoot
00042 #define SCF_DONT_FLEE 0x00008000 //NPC never flees
00043 #define SCF_FORCED_MARCH 0x00010000 //NPC that the player must aim at to make him walk
00044 #define SCF_NO_GROUPS 0x00020000 //NPC cannot alert groups or be part of a group
00045 #define SCF_FIRE_WEAPON 0x00040000 //NPC will fire his (her) weapon
00046 #define SCF_NO_MIND_TRICK 0x00080000 //Not succeptible to mind tricks
00047 #define SCF_USE_CP_NEAREST 0x00100000 //Will use combat point close to it, not next to player or try and flank player
00048 #define SCF_NO_FORCE 0x00200000 //Not succeptible to force powers
00049 #define SCF_NO_FALLTODEATH 0x00400000 //NPC will not scream and tumble and fall to hit death over large drops
00050 #define SCF_NO_ACROBATICS 0x00800000 //Jedi won't jump, roll or cartwheel
00051 #define SCF_USE_SUBTITLES 0x01000000 //Regardless of subtitle setting, this NPC will display subtitles when it speaks lines
00052 #define SCF_NO_ALERT_TALK 0x02000000 //Will not say alert sounds, but still can be woken up by alerts
00053
00054
00055
00056
00057
00058 #define AID_IDLE 0x00000000 //Nothing is happening
00059 #define AID_ACQUIRED 0x00000001 //A target has been found
00060 #define AID_LOST 0x00000002 //Alert, but no target is in sight
00061 #define AID_CONFUSED 0x00000004 //Is unable to come up with a course of action
00062 #define AID_LOSTPATH 0x00000008 //Cannot make a valid movement due to lack of connections
00063
00064
00065
00066
00067
00068 typedef enum {VIS_UNKNOWN, VIS_NOT, VIS_PVS, VIS_360, VIS_FOV, VIS_SHOOT} visibility_t;
00069 typedef enum {SPOT_ORIGIN, SPOT_CHEST, SPOT_HEAD, SPOT_HEAD_LEAN, SPOT_WEAPON, SPOT_LEGS, SPOT_GROUND} spot_t;
00070
00071 typedef enum
00072 {
00073 LM_ENT = 0,
00074 LM_INTEREST
00075 } lookMode_t;
00076
00077 typedef enum
00078 {
00079 JS_WAITING = 0,
00080 JS_FACING,
00081 JS_CROUCHING,
00082 JS_JUMPING,
00083 JS_LANDING
00084 } jumpState_t;
00085
00086 typedef struct gNPCstats_e
00087 {
00088
00089 int aggression;
00090 int aim;
00091 float earshot;
00092 int evasion;
00093 int hfov;
00094 int intelligence;
00095 int move;
00096 int reactions;
00097 float shootDistance;
00098 int vfov;
00099 float vigilance;
00100 float visrange;
00101
00102 int runSpeed;
00103 int walkSpeed;
00104 float yawSpeed;
00105 int health;
00106 int acceleration;
00107 } gNPCstats_t;
00108
00109
00110
00111
00112
00113 #define MAX_ENEMY_POS_LAG 2400
00114 #define ENEMY_POS_LAG_INTERVAL 100
00115 #define ENEMY_POS_LAG_STEPS (MAX_ENEMY_POS_LAG/ENEMY_POS_LAG_INTERVAL)
00116 typedef struct
00117 {
00118
00119 int timeOfDeath;
00120 gentity_t *touchedByPlayer;
00121
00122 visibility_t enemyLastVisibility;
00123
00124 int aimTime;
00125 float desiredYaw;
00126 float desiredPitch;
00127 float lockedDesiredYaw;
00128 float lockedDesiredPitch;
00129 gentity_t *aimingBeam;
00130
00131 vec3_t enemyLastSeenLocation;
00132 int enemyLastSeenTime;
00133 vec3_t enemyLastHeardLocation;
00134 int enemyLastHeardTime;
00135 int lastAlertID;
00136
00137 int eFlags;
00138 int aiFlags;
00139
00140 int currentAmmo;
00141 int shotTime;
00142 int burstCount;
00143 int burstMin;
00144 int burstMean;
00145 int burstMax;
00146 int burstSpacing;
00147 int attackHold;
00148 int attackHoldTime;
00149 vec3_t shootAngles;
00150
00151
00152 rank_t rank;
00153
00154
00155 bState_t behaviorState;
00156 bState_t defaultBehavior;
00157 bState_t tempBehavior;
00158
00159 qboolean ignorePain;
00160
00161 int duckDebounceTime;
00162 int walkDebounceTime;
00163 int enemyCheckDebounceTime;
00164 int investigateDebounceTime;
00165 int investigateCount;
00166 vec3_t investigateGoal;
00167 int investigateSoundDebounceTime;
00168 int greetingDebounceTime;
00169 gentity_t *eventOwner;
00170
00171
00172 gentity_t *coverTarg;
00173 jumpState_t jumpState;
00174 float followDist;
00175
00176
00177 gentity_t *tempGoal;
00178 gentity_t *goalEntity;
00179 gentity_t *lastGoalEntity;
00180 gentity_t *eventualGoal;
00181 gentity_t *captureGoal;
00182 gentity_t *defendEnt;
00183 gentity_t *greetEnt;
00184 int goalTime;
00185 qboolean straightToGoal;
00186 float distToGoal;
00187 int navTime;
00188 int blockingEntNum;
00189 int blockedSpeechDebounceTime;
00190 int lastSideStepSide;
00191 int sideStepHoldTime;
00192 int homeWp;
00193 AIGroupInfo_t *group;
00194
00195 vec3_t lastPathAngles;
00196
00197
00198 gNPCstats_t stats;
00199 int aimErrorDebounceTime;
00200 float lastAimErrorYaw;
00201 float lastAimErrorPitch;
00202 vec3_t aimOfs;
00203 int currentAim;
00204 int currentAggression;
00205
00206
00207 int scriptFlags;
00208
00209
00210 int desiredSpeed;
00211 int currentSpeed;
00212 char last_forwardmove;
00213 char last_rightmove;
00214 vec3_t lastClearOrigin;
00215 int consecutiveBlockedMoves;
00216 int blockedDebounceTime;
00217 int shoveCount;
00218 vec3_t blockedDest;
00219
00220
00221 int combatPoint;
00222 int lastFailedCombatPoint;
00223 int movementSpeech;
00224 float movementSpeechChance;
00225
00226
00227 int nextBStateThink;
00228 usercmd_t last_ucmd;
00229
00230
00231
00232
00233 qboolean combatMove;
00234 int goalRadius;
00235
00236
00237
00238
00239
00240
00241
00242 int pauseTime;
00243 int standTime;
00244
00245 int localState;
00246 int squadState;
00247
00248
00249
00250
00251 int confusionTime;
00252 int charmedTime;
00253 int controlledTime;
00254 int surrenderTime;
00255
00256
00257 vec3_t enemyLaggedPos[ENEMY_POS_LAG_STEPS];
00258
00259 gentity_t *watchTarget;
00260
00261 int ffireCount;
00262 int ffireDebounce;
00263 int ffireFadeDebounce;
00264 } gNPC_t;
00265
00266 void G_SquadPathsInit(void);
00267 void NPC_InitGame( void );
00268 void G_LoadBoltOns( void );
00269 void Svcmd_NPC_f( void );
00270 void NAV_DebugShowWaypoints (void);
00271 void NAV_DebugShowBoxes (void);
00272 void NAV_DebugShowSquadPaths (void);
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355 #endif