FS2_Open
Open source remastering of the Freespace 2 engine
ai_profiles.cpp
Go to the documentation of this file.
1 /*
2  * Created by Ian "Goober5000" Warfield for the FreeSpace2 Source Code Project.
3  * You may not sell or otherwise commercially exploit the source or things you
4  * create based on the source.
5  */
6 
7 
8 
9 
10 #include "ai/ai_profiles.h"
11 #include "globalincs/def_files.h"
12 #include "globalincs/pstypes.h"
13 #include "localization/localize.h"
14 #include "parse/parselo.h"
15 #include "ship/ship.h"
16 #include "weapon/weapon.h"
17 
18 
19 // global stuff
23 
24 // local to this file
25 static int Ai_profiles_initted = 0;
26 static char Default_profile_name[NAME_LENGTH];
27 
28 
29 // utility
30 void set_flag(ai_profile_t *profile, char *name, int flag, int type)
31 {
32  if (optional_string(name))
33  {
34  bool val;
35  stuff_boolean(&val);
36 
37  if (type == AIP_FLAG) {
38  if (val)
39  profile->flags |= flag;
40  else
41  profile->flags &= ~flag;
42  } else {
43  if (val)
44  profile->flags2 |= flag;
45  else
46  profile->flags2 &= ~flag;
47  }
48  }
49 }
50 
51 char *AI_path_types[] = {
52  "normal",
53  "alt1",
54 };
55 
56 int Num_ai_path_types = sizeof(AI_path_types)/sizeof(char*);
57 
59 {
60  int i;
61  for(i = 0; i < Num_ai_path_types; i++)
62  {
63  if(!stricmp(AI_path_types[i], p))
64  return i;
65  }
66 
67  return -1;
68 }
69 
71 {
72  int i;
73  char profile_name[NAME_LENGTH];
74  ai_profile_t dummy_profile;
75  char *saved_Mp = NULL;
76  char buf[NAME_LENGTH];
77 
78  try
79  {
80  if (filename == NULL)
81  read_file_text_from_array(defaults_get_file("ai_profiles.tbl"));
82  else
83  read_file_text(filename, CF_TYPE_TABLES);
84 
85  reset_parse();
86 
87 
88  // start parsing
89  required_string("#AI Profiles");
90 
91  // new default?
92  if (optional_string("$Default Profile:"))
93  stuff_string(Default_profile_name, F_NAME, NAME_LENGTH);
94 
95  // begin reading data
96  while (required_string_either("#End", "$Profile Name:"))
97  {
98  ai_profile_t *profile = &dummy_profile;
99  ai_profile_t *previous_profile = NULL;
100  bool no_create = false;
101 
102  // get the name
103  required_string("$Profile Name:");
104  stuff_string(profile_name, F_NAME, NAME_LENGTH);
105 
106  // see if it exists
107  for (i = 0; i < Num_ai_profiles; i++)
108  {
109  if (!stricmp(Ai_profiles[i].profile_name, profile_name))
110  {
111  previous_profile = &Ai_profiles[i];
112  break;
113  }
114  }
115 
116  // modular table stuff
117  if (optional_string("+nocreate"))
118  {
119  no_create = true;
120 
121  // use the previous one if possible,
122  // otherwise continue to use the dummy one
123  if (previous_profile != NULL)
124  profile = previous_profile;
125  }
126  else
127  {
128  // don't create multiple profiles with the same name
129  if (previous_profile != NULL)
130  {
131  Warning(LOCATION, "An ai profile named '%s' already exists! The new one will not be created.\n", profile_name);
132  }
133  else
134  {
135  // make sure we're under the limit
136  if (Num_ai_profiles >= MAX_AI_PROFILES)
137  {
138  Warning(LOCATION, "Too many profiles in ai_profiles.tbl! Max is %d.\n", MAX_AI_PROFILES - 1); // -1 because one is built-in
139  skip_to_string("#End", NULL);
140  break;
141  }
142 
143  profile = &Ai_profiles[Num_ai_profiles];
144  Num_ai_profiles++;
145  }
146  }
147 
148  // initialize profile if we're not building from a previously parsed one
149  if (!no_create)
150  {
151  // base profile, so zero it out
152  if (profile == &Ai_profiles[0])
153  {
154  memset(profile, 0, sizeof(ai_profile_t));
155  }
156  // brand new profile, so set it to the base defaults
157  else
158  {
159  memcpy(profile, &Ai_profiles[0], sizeof(ai_profile_t));
160  }
161  }
162 
163  // set the name
164  strcpy_s(profile->profile_name, profile_name);
165 
166 
167  // fill in any and all settings; they're all optional and can be in any order
168  while (!check_for_string("$Profile Name:") && !check_for_string("#End"))
169  {
170  if (optional_string("$Player Afterburner Recharge Scale:"))
172 
173  if (optional_string("$Max Beam Friendly Fire Damage:"))
175 
176  if (optional_string("$Player Countermeasure Life Scale:"))
178 
179  if (optional_string("$AI Countermeasure Firing Chance:"))
181 
182  if (optional_string("$AI In Range Time:"))
184 
185  if (optional_string("$AI Always Links Ammo Weapons:"))
187 
188  if (optional_string("$AI Maybe Links Ammo Weapons:"))
190 
191  if (optional_string("$Primary Ammo Burst Multiplier:"))
193 
194  if (optional_string("$AI Always Links Energy Weapons:"))
196 
197  if (optional_string("$AI Maybe Links Energy Weapons:"))
199 
200  if (optional_string("$Max Missles Locked on Player:") || optional_string("$Max Missiles Locked on Player:"))
202 
203  if (optional_string("$Max Player Attackers:"))
205 
206  if (optional_string("$Max Incoming Asteroids:"))
208 
209  if (optional_string("$Player Damage Factor:") || optional_string("$AI Damage Reduction to Player Hull:"))
211 
212  if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
214 
215  // represented in fractions of F1_0
216  if (optional_string("$Predict Position Delay:"))
217  {
218  int iLoop;
219  float temp_list[NUM_SKILL_LEVELS];
220 
222 
223  for (iLoop = 0; iLoop < NUM_SKILL_LEVELS; iLoop++)
224  profile->predict_position_delay[iLoop] = fl2f(temp_list[iLoop]);
225  }
226 
227  if (optional_string("$AI Shield Manage Delay:") || optional_string("$AI Shield Manage Delays:"))
229 
230  if (optional_string("$Friendly AI Fire Delay Scale:"))
232 
233  if (optional_string("$Hostile AI Fire Delay Scale:"))
235 
236  if (optional_string("$Friendly AI Secondary Fire Delay Scale:"))
238 
239  if (optional_string("$Hostile AI Secondary Fire Delay Scale:"))
241 
242  if (optional_string("$AI Turn Time Scale:"))
244 
245  if (optional_string("$Glide Attack Percent:")) {
247  //Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
248  //While we're at it, verify the range
249  for (i = 0; i < NUM_SKILL_LEVELS; i++) {
250  if (profile->glide_attack_percent[i] < 0.0f || profile->glide_attack_percent[i] > 100.0f) {
251  Warning(LOCATION, "$Glide Attack Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_attack_percent[i]);
252  profile->glide_attack_percent[i] = 0.0f;
253  }
254  profile->glide_attack_percent[i] /= 100.0;
255  }
256  }
257 
258  if (optional_string("$Circle Strafe Percent:")) {
260  //Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
261  //While we're at it, verify the range
262  for (i = 0; i < NUM_SKILL_LEVELS; i++) {
263  if (profile->circle_strafe_percent[i] < 0.0f || profile->circle_strafe_percent[i] > 100.0f) {
264  Warning(LOCATION, "$Circle Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->circle_strafe_percent[i]);
265  profile->circle_strafe_percent[i] = 0.0f;
266  }
267  profile->circle_strafe_percent[i] /= 100.0;
268  }
269  }
270 
271  if (optional_string("$Glide Strafe Percent:")) {
273  //Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
274  //While we're at it, verify the range
275  for (i = 0; i < NUM_SKILL_LEVELS; i++) {
276  if (profile->glide_strafe_percent[i] < 0.0f || profile->glide_strafe_percent[i] > 100.0f) {
277  Warning(LOCATION, "$Glide Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_strafe_percent[i]);
278  profile->glide_strafe_percent[i] = 0.0f;
279  }
280  profile->glide_strafe_percent[i] /= 100.0;
281  }
282  }
283 
284  if (optional_string("$Random Sidethrust Percent:")) {
286  //Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
287  //While we're at it, verify the range
288  for (i = 0; i < NUM_SKILL_LEVELS; i++) {
289  if (profile->random_sidethrust_percent[i] < 0.0f || profile->random_sidethrust_percent[i] > 100.0f) {
290  Warning(LOCATION, "$Random Sidethrust Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->random_sidethrust_percent[i]);
291  profile->random_sidethrust_percent[i] = 0.0f;
292  }
293  profile->random_sidethrust_percent[i] /= 100.0;
294  }
295  }
296 
297  if (optional_string("$Stalemate Time Threshold:"))
299 
300  if (optional_string("$Stalemate Distance Threshold:"))
302 
303  if (optional_string("$Player Shield Recharge Scale:"))
305 
306  if (optional_string("$Player Weapon Recharge Scale:"))
308 
309  if (optional_string("$Max Turret Target Ownage:"))
311 
312  if (optional_string("$Max Turret Player Ownage:"))
314 
315  if (optional_string("$Percentage Required For Kill Scale:"))
317 
318  if (optional_string("$Percentage Required For Assist Scale:"))
320 
321  if (optional_string("$Percentage Awarded For Capship Assist:"))
323 
324  if (optional_string("$Repair Penalty:"))
326 
327  if (optional_string("$Delay Before Allowing Bombs to Be Shot Down:"))
329 
330  if (optional_string("$Chance AI Has to Fire Missiles at Player:"))
332 
333  if (optional_string("$Max Aim Update Delay:"))
335 
336  if (optional_string("$Turret Max Aim Update Delay:"))
338 
339  if (optional_string("$Player Autoaim FOV:"))
340  {
341  float fov_list[NUM_SKILL_LEVELS];
343  for (i = 0; i < NUM_SKILL_LEVELS; i++)
344  {
345  //Enforce range
346  if (fov_list[i] < 0.0f || fov_list[i] >= 360.0f)
347  {
348  Warning(LOCATION, "$Player Autoaim FOV should be >= 0 and < 360.0 (read %f). Setting to 0.", fov_list[i]);
349  fov_list[i] = 0.0f;
350  }
351 
352  //Convert units
353  profile->player_autoaim_fov[i] = fov_list[i] * PI / 180.0f;
354  }
355  }
356 
357  if (optional_string("$Detail Distance Multiplier:"))
359 
360  set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS, AIP_FLAG);
361 
362  set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION, AIP_FLAG);
363 
364  set_flag(profile, "$smart secondary weapon selection:", AIPF_SMART_SECONDARY_WEAPON_SELECTION, AIP_FLAG);
365 
366  set_flag(profile, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT, AIP_FLAG);
367 
368  set_flag(profile, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT, AIP_FLAG);
369 
370  set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE, AIP_FLAG);
371 
372  set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS, AIP_FLAG);
373 
374  set_flag(profile, "$don't insert random turret fire delay:", AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY, AIP_FLAG);
375 
376  set_flag(profile, "$hack improve non-homing swarm turret fire accuracy:", AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY, AIP_FLAG);
377 
378  set_flag(profile, "$shockwaves damage small ship subsystems:", AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS, AIP_FLAG);
379 
380  set_flag(profile, "$navigation subsystem governs warpout capability:", AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP, AIP_FLAG);
381 
382  set_flag(profile, "$ignore lower bound for minimum speed of docked ship:", AIPF_NO_MIN_DOCK_SPEED_CAP, AIP_FLAG);
383 
384  set_flag(profile, "$disable linked fire penalty:", AIPF_DISABLE_LINKED_FIRE_PENALTY, AIP_FLAG);
385 
386  set_flag(profile, "$disable weapon damage scaling:", AIPF_DISABLE_WEAPON_DAMAGE_SCALING, AIP_FLAG);
387 
388  set_flag(profile, "$use additive weapon velocity:", AIPF_USE_ADDITIVE_WEAPON_VELOCITY, AIP_FLAG);
389 
390  set_flag(profile, "$use newtonian dampening:", AIPF_USE_NEWTONIAN_DAMPENING, AIP_FLAG);
391 
392  set_flag(profile, "$include beams for kills and assists:", AIPF_INCLUDE_BEAMS_IN_STAT_CALCS, AIP_FLAG);
393 
394  set_flag(profile, "$score kills based on damage caused:", AIPF_KILL_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
395 
396  set_flag(profile, "$score assists based on damage caused:", AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
397 
398  set_flag(profile, "$allow event and goal scoring in multiplayer:", AIPF_ALLOW_MULTI_EVENT_SCORING, AIP_FLAG);
399 
400  set_flag(profile, "$fix linked primary weapon decision bug:", AIPF_FIX_LINKED_PRIMARY_BUG, AIP_FLAG);
401 
402  set_flag(profile, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE, AIP_FLAG);
403 
404  set_flag(profile, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS, AIP_FLAG);
405 
406  set_flag(profile, "$fix heat seekers homing on stealth ships bug:", AIPF_FIX_HEAT_SEEKER_STEALTH_BUG, AIP_FLAG);
407 
408  set_flag(profile, "$multi allow empty primaries:", AIPF_MULTI_ALLOW_EMPTY_PRIMARIES, AIP_FLAG);
409 
410  set_flag(profile, "$multi allow empty secondaries:", AIPF_MULTI_ALLOW_EMPTY_SECONDARIES, AIP_FLAG);
411 
412  set_flag(profile, "$allow turrets target weapons freely:", AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY, AIP_FLAG);
413 
414  set_flag(profile, "$use only single fov for turrets:", AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS, AIP_FLAG);
415 
416  set_flag(profile, "$allow vertical dodge:", AIPF_ALLOW_VERTICAL_DODGE, AIP_FLAG);
417 
418  set_flag(profile, "$force beam turrets to use normal fov:", AIPF_FORCE_BEAM_TURRET_FOV, AIP_FLAG);
419 
420  set_flag(profile, "$fix ai class bug:", AIPF_FIX_AI_CLASS_BUG, AIP_FLAG);
421 
422  set_flag(profile, "$turrets ignore targets radius in range checks:", AIPF2_TURRETS_IGNORE_TARGET_RADIUS, AIP_FLAG2);
423 
424  set_flag(profile, "$no extra collision avoidance vs player:", AIPF2_NO_SPECIAL_PLAYER_AVOID, AIP_FLAG2);
425 
426  set_flag(profile, "$perform fewer checks for death screams:", AIPF2_PERFORM_FEWER_SCREAM_CHECKS, AIP_FLAG2);
427 
428  set_flag(profile, "$advanced turret fov edge checks:", AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS, AIP_FLAG2);
429 
430  set_flag(profile, "$require turrets to have target in fov:", AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV, AIP_FLAG2);
431 
432  set_flag(profile, "$all ships manage shields:", AIPF2_ALL_SHIPS_MANAGE_SHIELDS, AIP_FLAG2);
433 
434  set_flag(profile, "$ai aims from ship center:", AIPF2_AI_AIMS_FROM_SHIP_CENTER, AIP_FLAG2);
435 
436  set_flag(profile, "$allow primary link at mission start:", AIPF2_ALLOW_PRIMARY_LINK_AT_START, AIP_FLAG2);
437 
438  set_flag(profile, "$allow beams to damage bombs:", AIPF2_BEAMS_DAMAGE_WEAPONS, AIP_FLAG2);
439 
440  set_flag(profile, "$disable weapon damage scaling for player:", AIPF2_PLAYER_WEAPON_SCALE_FIX, AIP_FLAG2);
441 
442  set_flag(profile, "$countermeasures affect aspect seekers:", AIPF2_ASPECT_LOCK_COUNTERMEASURE, AIP_FLAG2);
443 
444  set_flag(profile, "$ai guards specific ship in wing:", AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING, AIP_FLAG2);
445 
447  if (optional_string("$ai path mode:"))
448  {
450  int j = ai_path_type_match(buf);
451  if (j >= 0) {
452  profile->ai_path_mode = j;
453  }
454  else {
455  Warning(LOCATION, "Invalid ai path mode '%s' specified", buf);
456  }
457  }
458 
459  set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
460 
461  set_flag(profile, "$fix ai path order bug:", AIPF2_FIX_AI_PATH_ORDER_BUG, AIP_FLAG2);
462 
463  set_flag(profile, "$strict turret-tagged-only targeting:", AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING, AIP_FLAG2);
464 
465  set_flag(profile, "$aspect bomb invulnerability fix:", AIPF2_ASPECT_INVULNERABILITY_FIX, AIP_FLAG2);
466 
467  set_flag(profile, "$glide decay requires thrust:", AIPF2_GLIDE_DECAY_REQUIRES_THRUST, AIP_FLAG2);
468 
469  profile->bay_arrive_speed_mult = 1.0f;
470  profile->bay_depart_speed_mult = 1.0f;
471  if (optional_string("$bay arrive speed multiplier:")) {
473  }
474  if (optional_string("$bay depart speed multiplier:")) {
476  }
477 
478  // ----------
479 
480  // compatibility
481  if (optional_string("$perform less checks for death screams:"))
482  {
483  mprintf(("Warning: \"$perform less checks for death screams\" flag is deprecated in favor of \"$perform fewer checks for death screams\"\n"));
484  bool temp;
485  stuff_boolean(&temp);
486  if (temp)
488  else
490  }
491  if (optional_string("$allow primary link delay:"))
492  {
493  mprintf(("Warning: \"$allow primary link delay\" flag is deprecated in favor of \"$allow primary link at mission start\"\n"));
494  bool temp;
495  stuff_boolean(&temp);
496  if (temp)
498  else
500  }
501 
502 
503  // if we've been through once already and are at the same place, force a move
504  if (saved_Mp && (saved_Mp == Mp))
505  {
506  char tmp[60];
507  memset(tmp, 0, 60);
508  strncpy(tmp, Mp, 59);
509  mprintf(("WARNING: Unrecognized parameter in ai_profiles: %s\n", tmp));
510 
511  Mp++;
512  }
513 
514  // find next valid option
516  saved_Mp = Mp;
517  }
518  }
519 
520  required_string("#End");
521  }
522  catch (const parse::ParseException& e)
523  {
524  mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", (filename) ? filename : "<default ai_profiles.tbl>", e.what()));
525  return;
526  }
527 
528  // add tbl/tbm to multiplayer validation list
529  extern void fs2netd_add_table_validation(const char *tblname);
531 }
532 
534 {
535  int temp;
536 
537  if (Ai_profiles_initted)
538  return;
539 
540  Num_ai_profiles = 0;
541  Default_ai_profile = 0;
542  Default_profile_name[0] = '\0';
543 
544  // init retail entry first
545  parse_ai_profiles_tbl(NULL);
546 
547  // now parse the supplied table (if any)
548  if (cf_exists_full("ai_profiles.tbl", CF_TYPE_TABLES))
549  parse_ai_profiles_tbl("ai_profiles.tbl");
550 
551  // parse any modular tables
553 
554  // set default if specified
555  temp = ai_profile_lookup(Default_profile_name);
556  if (temp >= 0)
558 
559  Ai_profiles_initted = 1;
560 }
561 
563 {
564  for (int i = 0; i < Num_ai_profiles; i++)
565  if (!stricmp(name, Ai_profiles[i].profile_name))
566  return i;
567 
568  return -1;
569 }
int chance_to_use_missiles_on_plr[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:147
int i
Definition: multi_pxo.cpp:466
#define AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP
Definition: ai_profiles.h:30
float beam_friendly_damage_cap[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:111
#define AIPF_FIX_LINKED_PRIMARY_BUG
Definition: ai_profiles.h:41
#define AIPF2_TURRETS_IGNORE_TARGET_RADIUS
Definition: ai_profiles.h:54
float glide_strafe_percent[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:115
int check_for_string(const char *pstr)
Definition: parselo.cpp:517
void fs2netd_add_table_validation(const char *tblname)
float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:124
#define AIPF2_BEAMS_DAMAGE_WEAPONS
Definition: ai_profiles.h:62
#define AIPF_SMART_SECONDARY_WEAPON_SELECTION
Definition: ai_profiles.h:24
float stalemate_time_thresh[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:117
#define AIPF2_ASPECT_INVULNERABILITY_FIX
Definition: ai_profiles.h:69
float turn_time_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:112
void parse_int_list(int *ilist, int size)
Definition: parselo.cpp:4194
#define AI_PATH_MODE_NORMAL
Definition: ai_profiles.h:73
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
void set_flag(ai_profile_t *profile, char *name, int flag, int type)
Definition: ai_profiles.cpp:30
#define mprintf(args)
Definition: pstypes.h:238
#define NUM_SKILL_LEVELS
Definition: systemvars.h:150
float player_autoaim_fov[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:150
float link_energy_levels_always[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:94
#define AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS
Definition: ai_profiles.h:43
float bay_arrive_speed_mult
Definition: ai_profiles.h:158
#define AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING
Definition: ai_profiles.h:68
float bay_depart_speed_mult
Definition: ai_profiles.h:159
float link_ammo_levels_maybe[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:99
GLclampf f
Definition: Glext.h:7097
const char * defaults_get_file(const char *filename)
Definition: def_files.cpp:103
float assist_award_percentage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:139
#define AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS
Definition: ai_profiles.h:58
#define AIPF2_PERFORM_FEWER_SCREAM_CHECKS
Definition: ai_profiles.h:56
char * AI_path_types[]
Definition: ai_profiles.cpp:51
#define AIPF_USE_ADDITIVE_WEAPON_VELOCITY
Definition: ai_profiles.h:34
int required_string_either(char *str1, char *str2)
Checks for one of two required strings.
Definition: parselo.cpp:673
#define AIPF_KILL_SCORING_SCALES_WITH_DAMAGE
Definition: ai_profiles.h:37
#define AIP_FLAG2
Definition: ai_profiles.h:18
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: Glext.h:7308
#define AIPF2_ASPECT_LOCK_COUNTERMEASURE
Definition: ai_profiles.h:65
float ship_fire_secondary_delay_scale_friendly[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:128
#define AIPF2_NO_WARP_CAMERA
Definition: ai_profiles.h:64
GLenum type
Definition: Gl.h:1492
void stuff_float(float *f)
Definition: parselo.cpp:2328
#define AIPF_ALLOW_VERTICAL_DODGE
Definition: ai_profiles.h:49
#define AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS
Definition: ai_profiles.h:26
#define AIP_FLAG
Definition: ai_profiles.h:17
#define AIPF_NO_MIN_DOCK_SPEED_CAP
Definition: ai_profiles.h:31
#define AIPF_DISABLE_WEAPON_DAMAGE_SCALING
Definition: ai_profiles.h:33
float subsys_damage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:110
int Num_ai_path_types
Definition: ai_profiles.cpp:56
#define AIPF_FIX_AI_CLASS_BUG
Definition: ai_profiles.h:51
int repair_penalty[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:142
#define AIPF_INCLUDE_BEAMS_IN_STAT_CALCS
Definition: ai_profiles.h:36
#define AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE
Definition: ai_profiles.h:42
void parse_ai_profiles_tbl(const char *filename)
Definition: ai_profiles.cpp:70
int Num_ai_profiles
Definition: ai_profiles.cpp:20
#define AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV
Definition: ai_profiles.h:59
#define AIPF2_PLAYER_WEAPON_SCALE_FIX
Definition: ai_profiles.h:63
#define AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE
Definition: ai_profiles.h:25
void parse_float_list(float *plist, int size)
Definition: parselo.cpp:4182
#define AIPF_DISABLE_LINKED_FIRE_PENALTY
Definition: ai_profiles.h:32
int cf_exists_full(const char *filename, int dir_type)
Definition: cfile.cpp:527
char * filename
#define AIPF2_FIX_AI_PATH_ORDER_BUG
Definition: ai_profiles.h:67
#define AIPF2_ALL_SHIPS_MANAGE_SHIELDS
Definition: ai_profiles.h:57
#define AIPF2_NO_SPECIAL_PLAYER_AVOID
Definition: ai_profiles.h:55
float delay_bomb_arm_timer[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:144
float primary_ammo_burst_mult[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:100
void stuff_string(char *outstr, int type, int len, char *terminators)
Definition: parselo.cpp:1189
ai_profile_t Ai_profiles[MAX_AI_PROFILES]
Definition: ai_profiles.cpp:22
#define CF_TYPE_TABLES
Definition: cfile.h:50
#define AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY
Definition: ai_profiles.h:27
float cmeasure_life_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:103
#define AIPF_MULTI_ALLOW_EMPTY_SECONDARIES
Definition: ai_profiles.h:46
int required_string(const char *pstr)
Definition: parselo.cpp:468
#define AIPF2_AI_AIMS_FROM_SHIP_CENTER
Definition: ai_profiles.h:60
int optional_string(const char *pstr)
Definition: parselo.cpp:539
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
Definition: parselo.cpp:1995
int skip_to_start_of_string_either(char *pstr1, char *pstr2, char *end)
Definition: parselo.cpp:433
int max_allowed_player_homers[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:87
#define MAX_AI_PROFILES
Definition: ai_profiles.h:76
#define AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS
Definition: ai_profiles.h:22
float player_damage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:108
int max_attackers[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:88
char profile_name[NAME_LENGTH]
Definition: ai_profiles.h:80
#define AIPF_FIX_HEAT_SEEKER_STEALTH_BUG
Definition: ai_profiles.h:44
float weapon_energy_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:105
float afterburner_recharge_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:107
void read_file_text_from_array(const char *array, char *processed_text, char *raw_text)
Definition: parselo.cpp:2022
void stuff_boolean(int *i, bool a_to_eol)
Definition: parselo.cpp:2519
#define AIPF_SMART_AFTERBURNER_MANAGEMENT
Definition: ai_profiles.h:40
int max_incoming_asteroids[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:86
float detail_distance_mult[MAX_DETAIL_LEVEL+1]
Definition: ai_profiles.h:152
void reset_parse(char *text)
Definition: parselo.cpp:3305
float max_aim_update_delay[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:119
GLuint const GLchar * name
Definition: Glext.h:5608
#define AIPF_ALLOW_MULTI_EVENT_SCORING
Definition: ai_profiles.h:39
int ai_path_type_match(char *p)
Definition: ai_profiles.cpp:58
GLuint GLfloat * val
Definition: Glext.h:6741
#define AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE
Definition: ai_profiles.h:38
float turret_max_aim_update_delay[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:120
#define AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY
Definition: ai_profiles.h:47
float circle_strafe_percent[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:114
#define AIPF_SMART_PRIMARY_WEAPON_SELECTION
Definition: ai_profiles.h:23
float in_range_time[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:90
#define AIPF2_GLIDE_DECAY_REQUIRES_THRUST
Definition: ai_profiles.h:70
#define NAME_LENGTH
Definition: globals.h:15
int Default_ai_profile
Definition: ai_profiles.cpp:21
#define AIPF_USE_NEWTONIAN_DAMPENING
Definition: ai_profiles.h:35
float ship_fire_secondary_delay_scale_hostile[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:127
float link_ammo_levels_always[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:98
void ai_profiles_init()
float glide_attack_percent[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:113
fix predict_position_delay[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:89
GLfloat GLfloat p
Definition: Glext.h:8373
#define AIPF2_ALLOW_PRIMARY_LINK_AT_START
Definition: ai_profiles.h:61
#define F_NAME
Definition: parselo.h:34
#define LOCATION
Definition: pstypes.h:245
float cmeasure_fire_chance[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:104
#define AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY
Definition: ai_profiles.h:28
int ai_profile_lookup(char *name)
#define PI
Definition: pstypes.h:303
float shield_energy_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:106
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:123
float kill_percentage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:135
int parse_modular_table(const char *name_check, void(*parse_callback)(const char *filename), int path_type, int sort_type)
Definition: parselo.cpp:4205
float shield_manage_delay[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:91
int temp
Definition: lua.cpp:4996
#define AIPF_MULTI_ALLOW_EMPTY_PRIMARIES
Definition: ai_profiles.h:45
#define AIPF_SMART_SHIELD_MANAGEMENT
Definition: ai_profiles.h:21
float random_sidethrust_percent[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:116
#define AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING
Definition: ai_profiles.h:66
int max_turret_ownage_target[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:131
int max_turret_ownage_player[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:132
float assist_percentage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:136
#define stricmp(s1, s2)
Definition: config.h:271
char * Mp
Definition: parselo.cpp:48
#define AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS
Definition: ai_profiles.h:29
float stalemate_dist_thresh[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:118
float link_energy_levels_maybe[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:95
int skip_to_string(char *pstr, char *end)
Definition: parselo.cpp:375
#define AIPF_FORCE_BEAM_TURRET_FOV
Definition: ai_profiles.h:50
#define fl2f(fl)
Definition: floating.h:38
#define AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS
Definition: ai_profiles.h:48
#define strcpy_s(...)
Definition: safe_strings.h:67