change from "setting" to "profile"; this way makes more sense

--Goober5000
This commit is contained in:
Goober5000 committed 2005-11-21 02:43:37 +00:00
1 parent 7354f81ebd
commit b33caf6f45
17 files changed
+557 -91

No files matched your search

+315
View File
@@ -0,0 +1,315 @@
/*
* ai_profiles.cpp
*
* Created by Ian "Goober5000" Warfield for the Freespace2 Source Code Project.
* You may not sell or otherwise commercially exploit the source or things you
* create based on the source.
*/
/*
* $Logfile: /Freespace2/code/ai/ai_profiles.cpp $
* $Revision: 1.1 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* $Log: not supported by cvs2svn $
*/
#include "ai/ai_profiles.h"
#include "cfile/cfile.h"
#include "parse/parselo.h"
int Num_ai_profiles;
int Default_ai_profile;
ai_profile_t Ai_profiles[MAX_AI_PROFILES];
// utility
void skill_level_array_copy(int dest[], int src[])
{
memcpy(dest, src, NUM_SKILL_LEVELS * sizeof(int));
}
// utility
void skill_level_array_copy(fix dest[], fix src[])
{
memcpy(dest, src, NUM_SKILL_LEVELS * sizeof(fix));
}
// utility
void skill_level_array_copy(float dest[], float src[])
{
memcpy(dest, src, NUM_SKILL_LEVELS * sizeof(float));
}
// utility
void set_flag(ai_profile_t *profile, char *name, int flag)
{
if (optional_string(name))
{
bool val;
stuff_boolean(&val);
if (val)
profile->flags |= flag;
else
profile->flags &= ~flag;
}
}
// This function initializes the given profile with the default data.
// We need to do it this way instead of through a default table because
// 1) the default profiles always need to be available; and 2) the
// other profiles inherit their unspecified options from this profile,
// which means it must be initialized before any others.
void init_profile_to_default(ai_profile_t *profile)
{
strcpy(profile->profile_name, "FS2 RETAIL");
profile->flags = 0;
int max_incoming_asteroids[NUM_SKILL_LEVELS] = {3, 4, 5, 7, 10};
skill_level_array_copy(profile->max_incoming_asteroids, max_incoming_asteroids);
int max_allowed_player_homers[NUM_SKILL_LEVELS] = {2, 3, 4, 7, 99};
skill_level_array_copy(profile->max_allowed_player_homers, max_allowed_player_homers);
int max_attackers[NUM_SKILL_LEVELS] = {2, 3, 4, 5, 99};
skill_level_array_copy(profile->max_attackers, max_attackers);
fix predict_position_delay[NUM_SKILL_LEVELS] = {2*F1_0, 3*F1_0/2, 4*F1_0/3, F1_0/2, 0};
skill_level_array_copy(profile->predict_position_delay, predict_position_delay);
float cmeasure_life_scale[NUM_SKILL_LEVELS] = {3.0f, 2.0f, 1.5f, 1.25f, 1.0f};
skill_level_array_copy(profile->cmeasure_life_scale, cmeasure_life_scale);
float weapon_energy_scale[NUM_SKILL_LEVELS] = {10.0f, 4.0f, 2.5f, 2.0f, 1.5f};
skill_level_array_copy(profile->weapon_energy_scale, weapon_energy_scale);
float shield_energy_scale[NUM_SKILL_LEVELS] = {4.0f, 2.0f, 1.5f, 1.25f, 1.0f};
skill_level_array_copy(profile->shield_energy_scale, shield_energy_scale);
float afterburner_recharge_scale[NUM_SKILL_LEVELS] = {5.0f, 3.0f, 2.0f, 1.5f, 1.0f};
skill_level_array_copy(profile->afterburner_recharge_scale, afterburner_recharge_scale);
float player_damage_scale[NUM_SKILL_LEVELS] = {0.25f, 0.5f, 0.65f, 0.85f, 1.0f};
skill_level_array_copy(profile->player_damage_scale, player_damage_scale);
float subsys_damage_scale[NUM_SKILL_LEVELS] = {0.2f, 0.4f, 0.6f, 0.8f, 1.0f};
skill_level_array_copy(profile->subsys_damage_scale, subsys_damage_scale);
float beam_friendly_damage_cap[NUM_SKILL_LEVELS] = { 0.0f, 5.0f, 10.0f, 20.0f, 30.0f };
skill_level_array_copy(profile->beam_friendly_damage_cap, beam_friendly_damage_cap);
float turn_time_scale[NUM_SKILL_LEVELS] = {3.0f, 2.2f, 1.6f, 1.3f, 1.0f};
skill_level_array_copy(profile->turn_time_scale, turn_time_scale);
float link_energy_levels_always[NUM_SKILL_LEVELS] = {100.0f, 80.0f, 60.0f, 40.0f, 20.0f};
skill_level_array_copy(profile->link_energy_levels_always, link_energy_levels_always);
float link_energy_levels_maybe[NUM_SKILL_LEVELS] = {90.0f, 60.0f, 40.0f, 20.0f, 10.0f};
skill_level_array_copy(profile->link_energy_levels_maybe, link_energy_levels_maybe);
float link_ammo_levels_always[NUM_SKILL_LEVELS] = {95.0f, 80.0f, 60.0f, 40.0f, 20.0f};
skill_level_array_copy(profile->link_ammo_levels_always, link_ammo_levels_always);
float link_ammo_levels_maybe[NUM_SKILL_LEVELS] = {90.0f, 60.0f, 40.0f, 20.0f, 10.0f};
skill_level_array_copy(profile->link_ammo_levels_maybe, link_ammo_levels_maybe);
float in_range_time[NUM_SKILL_LEVELS] = {2.0f, 1.4f, 0.75f, 0.0f, -1.0f};
skill_level_array_copy(profile->in_range_time, in_range_time);
float cmeasure_fire_chance[NUM_SKILL_LEVELS] = {0.2f, 0.3f, 0.5f, 0.9f, 1.1f};
skill_level_array_copy(profile->cmeasure_fire_chance, cmeasure_fire_chance);
float shield_manage_delay[NUM_SKILL_LEVELS] = {5.0f, 4.0f, 2.5f, 1.2f, 0.1f};
skill_level_array_copy(profile->shield_manage_delay, shield_manage_delay);
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS] = {4.0f, 2.5f, 1.75f, 1.25f, 1.0f};
skill_level_array_copy(profile->ship_fire_delay_scale_hostile, ship_fire_delay_scale_hostile);
float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS] = {2.0f, 1.4f, 1.25f, 1.1f, 1.0f};
skill_level_array_copy(profile->ship_fire_delay_scale_friendly, ship_fire_delay_scale_friendly);
}
// This function parses the data from ai_profiles.tbl
void ai_profiles_init()
{
char default_profile_name[NAME_LENGTH];
// init retail entry first
init_profile_to_default(&Ai_profiles[0]);
Default_ai_profile = 0;
Num_ai_profiles = 1;
// Goober5000 - check for table file
CFILE *sdt = cfopen("ai_profiles.tbl", "rb");
int table_exists = (sdt != NULL);
if (table_exists)
cfclose(sdt);
// Goober5000 - if table doesn't exist, just use the defaults
if (table_exists)
{
read_file_text("ai_profiles.tbl");
}
else
{
nprintf(("No ai_profiles.tbl found; using defaults."));
return;
}
reset_parse();
required_string("#AI Profiles");
// different default?
if (optional_string("$Default Profile:"))
stuff_string(default_profile_name, F_NAME, NULL, NAME_LENGTH);
else
default_profile_name[0] = '\0';
// begin reading data
while (required_string_either("#End","$Profile Name:"))
{
ai_profile_t *profile;
// make sure we're under the limit
if (Num_ai_profiles >= MAX_AI_PROFILES)
{
Warning(LOCATION, "Too many profiles in ai_profiles.tbl! Max is %d.\n", MAX_AI_PROFILES-1);
skip_to_string("#End", NULL);
break;
}
profile = &Ai_profiles[Num_ai_profiles];
Num_ai_profiles++;
// initialize
memcpy(profile, &Ai_profiles[0], sizeof(ai_profile_t));
// get the name
required_string("$Profile Name:");
stuff_string(profile->profile_name, F_NAME, NULL, NAME_LENGTH);
// fill in any and all settings; they're all optional and can be in any order
while (!check_for_string("$Profile Name:") && !check_for_string("#End"))
{
if (optional_string("$Player Afterburner Recharge Scale:"))
stuff_float_list(profile->afterburner_recharge_scale, NUM_SKILL_LEVELS);
if (optional_string("$Max Beam Friendly Fire Damage:"))
stuff_float_list(profile->beam_friendly_damage_cap, NUM_SKILL_LEVELS);
if (optional_string("$Player Countermeasure Life Scale:"))
stuff_float_list(profile->cmeasure_life_scale, NUM_SKILL_LEVELS);
if (optional_string("$AI Countermeasure Firing Chance:"))
stuff_float_list(profile->cmeasure_fire_chance, NUM_SKILL_LEVELS);
if (optional_string("$AI In Range Time:"))
stuff_float_list(profile->in_range_time, NUM_SKILL_LEVELS);
if (optional_string("$AI Always Links Ammo Weapons:"))
stuff_float_list(profile->link_ammo_levels_always, NUM_SKILL_LEVELS);
if (optional_string("$AI Maybe Links Ammo Weapons:"))
stuff_float_list(profile->link_ammo_levels_maybe, NUM_SKILL_LEVELS);
if (optional_string("$AI Always Links Energy Weapons:"))
stuff_float_list(profile->link_energy_levels_always, NUM_SKILL_LEVELS);
if (optional_string("$AI Maybe Links Energy Weapons:"))
stuff_float_list(profile->link_energy_levels_maybe, NUM_SKILL_LEVELS);
if (optional_string("$Max Missles Locked on Player:"))
stuff_int_list(profile->max_allowed_player_homers, NUM_SKILL_LEVELS);
if (optional_string("$Max Player Attackers:"))
stuff_int_list(profile->max_attackers, NUM_SKILL_LEVELS);
if (optional_string("$Max Incoming Asteroids:"))
stuff_int_list(profile->max_incoming_asteroids, NUM_SKILL_LEVELS);
if (optional_string("$Player Damage Factor:") || optional_string("$AI Damage Reduction to Player Hull:"))
stuff_float_list(profile->player_damage_scale, NUM_SKILL_LEVELS);
// represented in fractions of F1_0
if (optional_string("$Predict Position Delay:"))
{
int i;
float temp_list[NUM_SKILL_LEVELS];
stuff_float_list(temp_list, NUM_SKILL_LEVELS);
for (i = 0; i < NUM_SKILL_LEVELS; i++)
profile->predict_position_delay[i] = (long) (temp_list[i] * F1_0);
}
if (optional_string("$Player Shield Recharge Scale:"))
stuff_float_list(profile->shield_energy_scale, NUM_SKILL_LEVELS);
if (optional_string("$AI Shield Manage Delay:") || optional_string("$AI Shield Manage Delays:"))
stuff_float_list(profile->shield_manage_delay, NUM_SKILL_LEVELS);
if (optional_string("$Friendly AI Fire Delay Scale:"))
stuff_float_list(profile->ship_fire_delay_scale_friendly, NUM_SKILL_LEVELS);
if (optional_string("$Hostile AI Fire Delay Scale:"))
stuff_float_list(profile->ship_fire_delay_scale_hostile, NUM_SKILL_LEVELS);
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
stuff_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
if (optional_string("$AI Turn Time Scale:"))
stuff_float_list(profile->turn_time_scale, NUM_SKILL_LEVELS);
if (optional_string("$Player Weapon Recharge Scale:"))
stuff_float_list(profile->weapon_energy_scale, NUM_SKILL_LEVELS);
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS);
set_flag(profile, "$ai-chase allows rearm:", AIPF_AI_CHASE_ALLOWS_REARM);
set_flag(profile, "$ai-chase disables dynamic targeting temporarily:", AIPF_AI_CHASE_DISABLES_DYNAMIC_TARGETING_TEMPORARILY);
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION);
set_flag(profile, "$smart secondary weapon selection:", AIPF_SMART_SECONDARY_WEAPON_SELECTION);
set_flag(profile, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT);
set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE);
set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS);
set_flag(profile, "$don't insert random turret fire delay:", AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY);
set_flag(profile, "$hack improve non-homing swarm turret fire accuracy:", AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY);
set_flag(profile, "$shockwaves damage small ship subsystems:", AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS);
// find next valid option
skip_to_start_of_string_either("$", "#");
}
}
required_string("#End");
// set default if specified
int temp = ai_profile_lookup(default_profile_name);
if (temp >= 0)
Default_ai_profile = temp;
}
int ai_profile_lookup(char *name)
{
for (int i = 0; i < Num_ai_profiles; i++)
if (!stricmp(name, Ai_profiles[i].profile_name))
return i;
return -1;
}
+92
View File
@@ -0,0 +1,92 @@
/*
* ai_profiles.h
*
* Created by Ian "Goober5000" Warfield for the Freespace2 Source Code Project.
* You may not sell or otherwise commercially exploit the source or things you
* create based on the source.
*/
/*
* $Logfile: /Freespace2/code/ai/ai_profiles.h $
* $Revision: 1.1 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* $Log: not supported by cvs2svn $
*/
#ifndef _AI_PROFILES_H_
#define _AI_PROFILES_H_
#include "globalincs/pstypes.h"
#include "globalincs/globals.h"
#include "globalincs/systemvars.h"
// flags
#define AIPF_SMART_SHIELD_MANAGEMENT (1 << 0)
#define AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS (1 << 1)
#define AIPF_AI_CHASE_DISABLES_DYNAMIC_TARGETING_TEMPORARILY (1 << 2)
#define AIPF_AI_CHASE_ALLOWS_REARM (1 << 3)
#define AIPF_SMART_PRIMARY_WEAPON_SELECTION (1 << 4)
#define AIPF_SMART_SECONDARY_WEAPON_SELECTION (1 << 5)
#define AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE (1 << 6)
#define AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS (1 << 7)
#define AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY (1 << 8)
#define AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY (1 << 9)
#define AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS (1 << 10)
#define MAX_AI_PROFILES 5
typedef struct ai_profile_t {
char profile_name[NAME_LENGTH];
int flags;
// difficulty-related values
int max_incoming_asteroids[NUM_SKILL_LEVELS]; // max number of asteroids thrown at friendlies
int max_allowed_player_homers[NUM_SKILL_LEVELS]; // max number of simultaneous homing weapons on player
int max_attackers[NUM_SKILL_LEVELS]; // max number of ships that can attack a ship
fix predict_position_delay[NUM_SKILL_LEVELS]; // how long until AI predicts a ship position
float in_range_time[NUM_SKILL_LEVELS]; // seconds to add to time it takes to get enemy in range (only for player's enemies)
float shield_manage_delay[NUM_SKILL_LEVELS]; // how long before AI manages shields (note that the player's team always uses the average skill's delay)
// AI ships link primaries if energy levels greater than these percents
float link_energy_levels_always[NUM_SKILL_LEVELS]; // always link
float link_energy_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low
// AI ships link primaries if ammunition levels greater than these percents
float link_ammo_levels_always[NUM_SKILL_LEVELS]; // always link
float link_ammo_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low
// difficulty-related scales
float cmeasure_life_scale[NUM_SKILL_LEVELS]; // life of countermeasures
float cmeasure_fire_chance[NUM_SKILL_LEVELS]; // chance a countermeasure will be fired based on skill level (also scaled by ai_class)
float weapon_energy_scale[NUM_SKILL_LEVELS]; // weapon energy available
float shield_energy_scale[NUM_SKILL_LEVELS]; // shield energy available
float afterburner_recharge_scale[NUM_SKILL_LEVELS]; // speed of afterburner recharge
float player_damage_scale[NUM_SKILL_LEVELS]; // damage applied to the player
float subsys_damage_scale[NUM_SKILL_LEVELS]; // damage applied to a player subsystem
float beam_friendly_damage_cap[NUM_SKILL_LEVELS]; // damage cap values for friendly beam fire
float turn_time_scale[NUM_SKILL_LEVELS]; // speed at which enemy ships turn
// Multiplicative delay factors for increasing skill levels.
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS];
float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS];
} ai_profile_t;
extern int Num_ai_profiles;
extern int Default_ai_profile;
extern ai_profile_t Ai_profiles[MAX_AI_PROFILES];
void ai_profiles_init();
int ai_profile_lookup(char *name);
#endif
+8 -4
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Ship/AiBig.cpp $
* $Revision: 1.9 $
* $Date: 2005-11-21 00:46:05 $
* $Revision: 1.10 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* C module for AI code related to large ships
*
* $Log: not supported by cvs2svn $
* Revision 1.9 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 1.8 2005/10/22 22:22:41 Goober5000
* rolled back UnknownPlayer's commit
* --Goober5000
@@ -1234,7 +1238,7 @@ void ai_big_chase()
} else if (En_objp->flags & OF_PROTECTED) { // If protected and we're not attacking a subsystem, stop attacking!
update_aspect_lock_information(aip, &vec_to_enemy, dist_to_enemy - En_objp->radius, En_objp->radius);
aip->target_objnum = -1;
if (find_enemy(Pl_objp-Objects, MAX_ENEMY_DISTANCE, The_mission.ai_options->max_attackers[Game_skill_level]) == -1) {
if (find_enemy(Pl_objp-Objects, MAX_ENEMY_DISTANCE, The_mission.ai_profile->max_attackers[Game_skill_level]) == -1) {
ai_do_default_behavior(Pl_objp);
return;
}
@@ -1969,7 +1973,7 @@ void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp)
// the ai will not always go after different ships firing beams at them.
// Approx 1/4 chance we'll go after the other ship's beam.
bool attack_turret_on_different_ship = (The_mission.ai_options->flags & AIOF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS)
bool attack_turret_on_different_ship = (The_mission.ai_profile->flags & AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS)
&& (Weapon_info[weapon_objp->instance].wi_flags & WIF_BEAM) && (frand()*100 < 25.0f);
// unless we're making an exception, we should only attack a turret if it sits on the current target
+32 -28
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Ship/AiCode.cpp $
* $Revision: 1.42 $
* $Date: 2005-11-21 00:46:05 $
* $Revision: 1.43 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* AI code that does interesting stuff
*
* $Log: not supported by cvs2svn $
* Revision 1.42 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 1.41 2005/11/08 01:03:59 wmcoolmon
* More warnings instead of Int3s/Asserts, better Lua scripting, weapons_expl.tbl is no longer needed nor read, added "$Disarmed ImpactSnd:", fire-beam fix
*
@@ -1982,7 +1986,7 @@ void ai_turn_towards_vector(vec3d *dest, object *objp, float frametime, float tu
if (!(flags & AITTV_FAST) && !(sexp_flags & AITTV_VIA_SEXP) ){
if (objp->type == OBJ_SHIP){
if (Ships[objp->instance].team != Ships[Player_obj->instance].team){
turn_time *= The_mission.ai_options->turn_time_scale[Game_skill_level];
turn_time *= The_mission.ai_profile->turn_time_scale[Game_skill_level];
}
}
}
@@ -3191,11 +3195,11 @@ void ai_attack_object(object *attacker, object *attacked, int priority, ship_sub
if (aip->target_objnum >= 0)
{
// allow the rearm timestamp to eventually expire
if (The_mission.ai_options->flags & AIOF_AI_CHASE_ALLOWS_REARM)
if (The_mission.ai_profile->flags & AIPF_AI_CHASE_ALLOWS_REARM)
ai_set_goal_maybe_abort_dock(attacker, aip);
// keep target for a short time
if (The_mission.ai_options->flags & AIOF_AI_CHASE_DISABLES_DYNAMIC_TARGETING_TEMPORARILY)
if (The_mission.ai_profile->flags & AIPF_AI_CHASE_DISABLES_DYNAMIC_TARGETING_TEMPORARILY)
aip->ok_to_target_timestamp = timestamp(DELAY_TARGET_TIME); // No dynamic targeting for 7 seconds.
}
@@ -4308,7 +4312,7 @@ void ai_set_positions(object *pl_objp, object *en_objp, ai_info *aip, vec3d *pla
} else {
*enemy_pos = en_objp->pos;
aip->next_predict_pos_time = Missiontime + The_mission.ai_options->predict_position_delay[Game_skill_level];
aip->next_predict_pos_time = Missiontime + The_mission.ai_profile->predict_position_delay[Game_skill_level];
aip->last_predicted_enemy_pos = *enemy_pos;
}
@@ -6055,7 +6059,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
}
//not using the new AI, use the old version of this function instead.
if (!(The_mission.ai_options->flags & AIOF_SMART_PRIMARY_WEAPON_SELECTION))
if (!(The_mission.ai_profile->flags & AIPF_SMART_PRIMARY_WEAPON_SELECTION))
{
return ai_select_primary_weapon_OLD(objp, other_objp, flags);
}
@@ -6299,9 +6303,9 @@ void set_primary_weapon_linkage(object *objp)
}
// regular lasers
if (shipp->weapon_energy > The_mission.ai_options->link_energy_levels_always[Game_skill_level]) {
if (shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_always[Game_skill_level]) {
shipp->flags |= SF_PRIMARY_LINKED;
} else if (shipp->weapon_energy > The_mission.ai_options->link_energy_levels_maybe[Game_skill_level]) {
} else if (shipp->weapon_energy > The_mission.ai_profile->link_energy_levels_maybe[Game_skill_level]) {
if (objp->hull_strength < shipp->ship_max_hull_strength/3.0f)
shipp->flags |= SF_PRIMARY_LINKED;
}
@@ -6332,11 +6336,11 @@ void set_primary_weapon_linkage(object *objp)
ammo_pct = float (current_ammo) / float (total_ammo) * 100.0f;
// link according to defined levels
if (ammo_pct > The_mission.ai_options->link_ammo_levels_always[Game_skill_level])
if (ammo_pct > The_mission.ai_profile->link_ammo_levels_always[Game_skill_level])
{
shipp->flags |= SF_PRIMARY_LINKED;
}
else if (ammo_pct > The_mission.ai_options->link_ammo_levels_maybe[Game_skill_level])
else if (ammo_pct > The_mission.ai_profile->link_ammo_levels_maybe[Game_skill_level])
{
if (objp->hull_strength < shipp->ship_max_hull_strength/3.0f)
{
@@ -6543,7 +6547,7 @@ void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 =
}
#endif
if ((The_mission.ai_options->flags & AIOF_SMART_SECONDARY_WEAPON_SELECTION) && (priority1 == 0))
if ((The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (priority1 == 0))
ignore_mask |= WIF_HOMING;
// Stuff weapon_bank_list with bank index of available weapons.
@@ -6564,7 +6568,7 @@ void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 =
}
}
if ((The_mission.ai_options->flags & AIOF_SMART_SECONDARY_WEAPON_SELECTION) && (priority2 == 0))
if ((The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (priority2 == 0))
ignore_mask |= WIF_HOMING;
// If didn't find anything above, then pick any secondary weapon.
@@ -6596,7 +6600,7 @@ void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 =
weapon_info *wip=&Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]];
// phreak -- rapid dumbfire? let it rip!
if ((The_mission.ai_options->flags & AIOF_ALLOW_RAPID_SECONDARY_DUMBFIRE) && !(wip->wi_flags & WIF_HOMING) && (wip->fire_wait < .5f))
if ((The_mission.ai_profile->flags & AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE) && !(wip->wi_flags & WIF_HOMING) && (wip->fire_wait < .5f))
{
aip->ai_flags |= AIF_UNLOAD_SECONDARIES;
}
@@ -6716,7 +6720,7 @@ int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip)
int swarmers = 0;
if (wip->wi_flags & WIF_SWARM)
swarmers = 2; // Note, always want to be able to fire swarmers if no currently incident homers.
if (The_mission.ai_options->max_allowed_player_homers[Game_skill_level] < num_homers + swarmers) {
if (The_mission.ai_profile->max_allowed_player_homers[Game_skill_level] < num_homers + swarmers) {
return 0;
}
} else if (num_homers > 3) {
@@ -7062,7 +7066,7 @@ void set_predicted_enemy_pos_turret(vec3d *predicted_enemy_pos, vec3d *gun_pos,
// Make it take longer for enemies to get player's allies in range based on skill level.
if (Ships[pobjp->instance].team != Ships[Player_obj->instance].team)
range_time += The_mission.ai_options->in_range_time[Game_skill_level];
range_time += The_mission.ai_profile->in_range_time[Game_skill_level];
//nprintf(("AI", "time enemy in range = %7.3f\n", aip->time_enemy_in_range));
@@ -7118,7 +7122,7 @@ void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, object *
// but don't bias team v. team missions
if ( !((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)) ) {
if (Ships[pobjp->instance].team != Ships[Player_obj->instance].team) {
range_time += The_mission.ai_options->in_range_time[Game_skill_level];
range_time += The_mission.ai_profile->in_range_time[Game_skill_level];
}
}
//nprintf(("AI", "time enemy in range = %7.3f\n", aip->time_enemy_in_range));
@@ -8333,7 +8337,7 @@ void ai_choose_secondary_weapon(object *objp, ai_info *aip, object *en_objp)
if (is_big_ship)
{
priority1 = WIF_HUGE;
priority2 = (The_mission.ai_options->flags & AIOF_SMART_SECONDARY_WEAPON_SELECTION) ? WIF_BOMBER_PLUS : WIF_HOMING;
priority2 = (The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) ? WIF_BOMBER_PLUS : WIF_HOMING;
}
else if ( (esip != NULL) && (esip->flags & SIF_BOMBER) )
{
@@ -8345,7 +8349,7 @@ void ai_choose_secondary_weapon(object *objp, ai_info *aip, object *en_objp)
priority1 = WIF_PUNCTURE;
priority2 = WIF_HOMING;
}
else if ((The_mission.ai_options->flags & AIOF_SMART_SECONDARY_WEAPON_SELECTION) && (en_objp->type == OBJ_ASTEROID)) //prefer dumbfires if its an asteroid
else if ((The_mission.ai_profile->flags & AIPF_SMART_SECONDARY_WEAPON_SELECTION) && (en_objp->type == OBJ_ASTEROID)) //prefer dumbfires if its an asteroid
{
priority1 = 0;
priority2 = 0;
@@ -9892,10 +9896,10 @@ int ai_maybe_limit_attackers(int attacked_objnum)
int num_attacking;
num_attacking = num_ships_attacking(attacked_objnum);
if (num_attacking == The_mission.ai_options->max_attackers[Game_skill_level]) {
if (num_attacking == The_mission.ai_profile->max_attackers[Game_skill_level]) {
remove_farthest_attacker(attacked_objnum);
rval=0;
} else if (num_attacking > The_mission.ai_options->max_attackers[Game_skill_level]) {
} else if (num_attacking > The_mission.ai_profile->max_attackers[Game_skill_level]) {
rval=1;
}
//nprintf(("AI", "Num attacking player = %i\n", num_attacking));
@@ -12352,9 +12356,9 @@ void ai_maybe_launch_cmeasure(object *objp, ai_info *aip)
// For ships on player's team, have constant, average chance to fire.
// For enemies, increasing chance with higher skill level.
if (shipp->team == Player_ship->team)
fire_chance = The_mission.ai_options->cmeasure_fire_chance[NUM_SKILL_LEVELS/2];
fire_chance = The_mission.ai_profile->cmeasure_fire_chance[NUM_SKILL_LEVELS/2];
else
fire_chance = The_mission.ai_options->cmeasure_fire_chance[Game_skill_level];
fire_chance = The_mission.ai_profile->cmeasure_fire_chance[Game_skill_level];
// Decrease chance to fire at lower ai class.
fire_chance *= (float) aip->ai_class/Num_ai_classes;
@@ -12548,11 +12552,11 @@ void ai_manage_shield(object *objp, ai_info *aip)
// Ships on player's team are treated as if Skill_level is average.
if (Ships[objp->instance].team != Player_ship->team)
{
delay = The_mission.ai_options->shield_manage_delay[Game_skill_level];
delay = The_mission.ai_profile->shield_manage_delay[Game_skill_level];
}
else
{
delay = The_mission.ai_options->shield_manage_delay[NUM_SKILL_LEVELS/2];
delay = The_mission.ai_profile->shield_manage_delay[NUM_SKILL_LEVELS/2];
}
// Scale between 1x and 3x based on ai_class
@@ -14314,7 +14318,7 @@ void ai_frame(int objnum)
} else if (aip->resume_goal_time == -1) {
// AL 12-9-97: Don't allow cargo and navbuoys to set their aip->target_objnum
if ( !(Ship_info[shipp->ship_info_index].flags & SIF_HARMLESS) ) {
target_objnum = find_enemy(objnum, MAX_ENEMY_DISTANCE, The_mission.ai_options->max_attackers[Game_skill_level]); // Attack up to 25K units away.
target_objnum = find_enemy(objnum, MAX_ENEMY_DISTANCE, The_mission.ai_profile->max_attackers[Game_skill_level]); // Attack up to 25K units away.
if (target_objnum != -1) {
if (aip->target_objnum != target_objnum)
aip->aspect_locked_time = 0.0f;
@@ -14378,7 +14382,7 @@ void ai_frame(int objnum)
if ((aip->resume_goal_time > 0) && (aip->resume_goal_time < Missiontime)) {
aip->active_goal = AI_GOAL_NONE;
aip->resume_goal_time = -1;
target_objnum = find_enemy(objnum, 2000.0f, The_mission.ai_options->max_attackers[Game_skill_level]);
target_objnum = find_enemy(objnum, 2000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
if (target_objnum != -1) {
if (aip->target_objnum != target_objnum) {
aip->aspect_locked_time = 0.0f;
@@ -14770,7 +14774,7 @@ void ai_do_default_behavior(object *obj)
ship_flags = Ship_info[Ships[obj->instance].ship_info_index].flags;
if (!is_instructor(obj) && (ship_flags & (SIF_FIGHTER | SIF_BOMBER)))
{
int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_options->max_attackers[Game_skill_level]);
int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
set_target_objnum(aip, enemy_objnum);
aip->mode = AIM_CHASE;
aip->submode = SM_ATTACK;
+16 -12
View File
@@ -1,12 +1,16 @@
/*
* $Logfile: /Freespace2/code/ai/aiturret.cpp $
* $Revision: 1.25 $
* $Date: 2005-11-21 00:46:05 $
* $Revision: 1.26 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* Functions for AI control of turrets
*
* $Log: not supported by cvs2svn $
* Revision 1.25 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 1.24 2005/10/30 06:44:56 wmcoolmon
* Codebase commit - nebula.tbl, scripting, new dinky explosion/shockwave stuff, moving muzzle flashes
*
@@ -630,7 +634,7 @@ int get_nearest_enemy_objnum(int turret_parent_objnum, ship_subsys *turret_subsy
eeo.nearest_objnum = -1;
//don't fire anti capital ship turrets at bombs.
if ( !((The_mission.ai_options->flags & AIOF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS) && (big_flag)) )
if ( !((The_mission.ai_profile->flags & AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS) && (big_flag)) )
{
// Missile_obj_list
for( mo = GET_FIRST(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) {
@@ -1054,32 +1058,32 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)) {
// flak guns need to fire more rapidly
if (wip->wi_flags & WIF_FLAK) {
wait *= The_mission.ai_options->ship_fire_delay_scale_friendly[Game_skill_level] * 0.5f;
wait *= The_mission.ai_profile->ship_fire_delay_scale_friendly[Game_skill_level] * 0.5f;
wait += (Num_ai_classes - aip->ai_class - 1) * 40.0f;
} else {
wait *= The_mission.ai_options->ship_fire_delay_scale_friendly[Game_skill_level];
wait *= The_mission.ai_profile->ship_fire_delay_scale_friendly[Game_skill_level];
wait += (Num_ai_classes - aip->ai_class - 1) * 100.0f;
}
} else {
// flak guns need to fire more rapidly
if (wip->wi_flags & WIF_FLAK) {
if (Ships[aip->shipnum].team == TEAM_FRIENDLY) {
wait *= The_mission.ai_options->ship_fire_delay_scale_friendly[Game_skill_level] * 0.5f;
wait *= The_mission.ai_profile->ship_fire_delay_scale_friendly[Game_skill_level] * 0.5f;
} else {
wait *= The_mission.ai_options->ship_fire_delay_scale_hostile[Game_skill_level] * 0.5f;
wait *= The_mission.ai_profile->ship_fire_delay_scale_hostile[Game_skill_level] * 0.5f;
}
wait += (Num_ai_classes - aip->ai_class - 1) * 40.0f;
} else if (wip->wi_flags & WIF_HUGE) {
// make huge weapons fire independently of team
wait *= The_mission.ai_options->ship_fire_delay_scale_friendly[Game_skill_level];
wait *= The_mission.ai_profile->ship_fire_delay_scale_friendly[Game_skill_level];
wait += (Num_ai_classes - aip->ai_class - 1) * 100.0f;
} else {
// give team friendly an advantage
if (Ships[aip->shipnum].team == TEAM_FRIENDLY) {
wait *= The_mission.ai_options->ship_fire_delay_scale_friendly[Game_skill_level];
wait *= The_mission.ai_profile->ship_fire_delay_scale_friendly[Game_skill_level];
} else {
wait *= The_mission.ai_options->ship_fire_delay_scale_hostile[Game_skill_level];
wait *= The_mission.ai_profile->ship_fire_delay_scale_hostile[Game_skill_level];
}
wait += (Num_ai_classes - aip->ai_class - 1) * 100.0f;
}
@@ -1232,7 +1236,7 @@ void turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
}
}
//Not useful -WMC
else if (!(The_mission.ai_options->flags & AIOF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY))
else if (!(The_mission.ai_profile->flags & AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY))
{
float wait = 1000.0f * frand_range(0.9f, 1.1f);
turret->turret_next_fire_stamp = timestamp((int) wait);
@@ -1261,7 +1265,7 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
// *If it's a non-homer, then use the last fire direction instead of turret orientation to fix inaccuracy
// problems with non-homing swarm weapons -Et1
if( (The_mission.ai_options->flags & AIOF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY) && !( Weapon_info[tsi->weapon_class].wi_flags & WIF_HOMING ) )
if( (The_mission.ai_profile->flags & AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY) && !( Weapon_info[tsi->weapon_class].wi_flags & WIF_HOMING ) )
{
turret_fvec = tsi->turret->turret_last_fire_direction;
}
+7 -3
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Asteroid/Asteroid.cpp $
* $Revision: 2.31 $
* $Date: 2005-11-21 00:46:05 $
* $Revision: 2.32 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* C module for asteroid code
*
* $Log: not supported by cvs2svn $
* Revision 2.31 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.30 2005/10/11 12:24:04 taylor
* little cleaner since the two sets weren't needed
*
@@ -1102,7 +1106,7 @@ void maybe_throw_asteroid(int count)
nprintf(("AI", "Incoming asteroids: %i\n", count));
if (count > The_mission.ai_options->max_incoming_asteroids[Game_skill_level])
if (count > The_mission.ai_profile->max_incoming_asteroids[Game_skill_level])
return;
Next_asteroid_throw = timestamp(1000 + 1200 * count/(Game_skill_level+1));
+7 -3
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/CMeasure/CMeasure.cpp $
* $Revision: 2.7 $
* $Date: 2005-11-21 00:46:06 $
* $Revision: 2.8 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* Counter measures. Created by Mike Kulas, May 12, 1997.
*
* $Log: not supported by cvs2svn $
* Revision 2.7 2005/11/21 00:46:06 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.6 2005/04/05 05:53:15 taylor
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
*
@@ -424,7 +428,7 @@ int cmeasure_create( object * source_obj, vec3d * pos, int cm_type, int rand_val
cmp->lifeleft = static_randf(arand) * (cmeasurep->life_max - cmeasurep->life_min) / cmeasurep->life_min;
if (source_obj->flags & OF_PLAYER_SHIP){
cmp->lifeleft *= The_mission.ai_options->cmeasure_life_scale[Game_skill_level];
cmp->lifeleft *= The_mission.ai_profile->cmeasure_life_scale[Game_skill_level];
}
cmp->lifeleft = cmeasurep->life_min + cmp->lifeleft * (cmeasurep->life_max - cmeasurep->life_min);
+7 -3
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Freespace2/FreeSpace.cpp $
* $Revision: 2.196 $
* $Date: 2005-11-21 00:46:06 $
* $Revision: 2.197 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* Freespace main body
*
* $Log: not supported by cvs2svn $
* Revision 2.196 2005/11/21 00:46:06 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.195 2005/11/17 02:29:21 taylor
* pretty sure my brain wasn't working that day
*
@@ -3554,7 +3558,7 @@ void game_init()
armor_init();
weapon_init();
ai_init();
ai_settings_init(); // Goober5000
ai_profiles_init(); // Goober5000
ship_init(); // read in ships.tbl
player_init();
+8 -4
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDets.cpp $
* $Revision: 2.17 $
* $Date: 2005-11-21 00:46:12 $
* $Revision: 2.18 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* C file that contains code to manage and display the Energy Transfer System (ETS)
*
* $Log: not supported by cvs2svn $
* Revision 2.17 2005/11/21 00:46:12 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.16 2005/04/15 11:41:27 taylor
* stupid <expletive-delete> terminal, I <expletive-deleted> <expletive-deleted>!!!
*
@@ -385,7 +389,7 @@ void update_ets(object* objp, float fl_frametime)
// update weapon energy
max_new_weapon_energy = fl_frametime * MAX_WEAPON_REGEN_PER_SECOND * max_g;
if ( objp->flags & OF_PLAYER_SHIP ) {
ship_p->weapon_energy += Energy_levels[ship_p->weapon_recharge_index] * max_new_weapon_energy * The_mission.ai_options->weapon_energy_scale[Game_skill_level];
ship_p->weapon_energy += Energy_levels[ship_p->weapon_recharge_index] * max_new_weapon_energy * The_mission.ai_profile->weapon_energy_scale[Game_skill_level];
} else {
ship_p->weapon_energy += Energy_levels[ship_p->weapon_recharge_index] * max_new_weapon_energy;
}
@@ -397,7 +401,7 @@ void update_ets(object* objp, float fl_frametime)
float shield_delta;
max_new_shield_energy = fl_frametime * MAX_SHIELD_REGEN_PER_SECOND * max_s;
if ( objp->flags & OF_PLAYER_SHIP ) {
shield_delta = Energy_levels[ship_p->shield_recharge_index] * max_new_shield_energy * The_mission.ai_options->shield_energy_scale[Game_skill_level];
shield_delta = Energy_levels[ship_p->shield_recharge_index] * max_new_shield_energy * The_mission.ai_profile->shield_energy_scale[Game_skill_level];
} else {
shield_delta = Energy_levels[ship_p->shield_recharge_index] * max_new_shield_energy;
}
+12 -9
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionParse.cpp $
* $Revision: 2.126 $
* $Date: 2005-11-21 00:46:12 $
* $Revision: 2.127 $
* $Date: 2005-11-21 02:43:37 $
* $Author: Goober5000 $
*
* main upper level code for parsing stuff
*
* $Log: not supported by cvs2svn $
* Revision 2.126 2005/11/21 00:46:12 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.125 2005/11/18 07:53:27 Goober5000
* made arrival invalidation more efficient
* (probably only a small speedup, but meh)
@@ -899,7 +903,6 @@
#include "network/multi_respawn.h"
#include "network/multi_endgame.h"
#include "object/parseobjectdock.h"
#include "ai/ai_settings.h"
@@ -1493,17 +1496,17 @@ void parse_mission_info(mission *pm)
}
// Goober5000 - AI on a per-mission basis
The_mission.ai_options = &Ai_settings[Default_ai_setting];
if (optional_string("$AI Setting:"))
The_mission.ai_profile = &Ai_profiles[Default_ai_profile];
if (optional_string("$AI Profile:"))
{
int setting;
int index;
char temp[NAME_LENGTH];
stuff_string(temp, F_NAME, NULL);
setting = ai_setting_lookup(temp);
index = ai_profile_lookup(temp);
if (setting >= 0)
The_mission.ai_options = &Ai_settings[setting];
if (index >= 0)
The_mission.ai_profile = &Ai_profiles[index];
}
}
+8 -4
View File
@@ -9,13 +9,17 @@
/*
* $Source: /cvs/cvsroot/fs2open/fs2_open/code/mission/missionparse.h,v $
* $Revision: 2.72 $
* $Revision: 2.73 $
* $Author: Goober5000 $
* $Date: 2005-11-21 00:46:12 $
* $Date: 2005-11-21 02:43:37 $
*
* main header file for parsing code
*
* $Log: not supported by cvs2svn $
* Revision 2.72 2005/11/21 00:46:12 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.71 2005/10/29 22:09:29 Goober5000
* multiple ship docking implemented for initially docked ships
* --Goober5000
@@ -473,7 +477,7 @@
#include <setjmp.h>
#include "ai/ai.h"
#include "ai/ai_settings.h"
#include "ai/ai_profiles.h"
#include "model/model.h"
#include "object/object.h"
#include "graphics/2d.h"
@@ -579,7 +583,7 @@ typedef struct mission {
int contrail_threshold;
int ambient_light_level;
ai_setting *ai_options;
ai_profile_t *ai_profile;
} mission;
// cargo defines
+7 -3
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Object/Object.cpp $
* $Revision: 2.51 $
* $Date: 2005-11-21 00:46:12 $
* $Revision: 2.52 $
* $Date: 2005-11-21 02:43:37 $
* $Author: Goober5000 $
*
* Code to manage objects
*
* $Log: not supported by cvs2svn $
* Revision 2.51 2005/11/21 00:46:12 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.50 2005/11/05 08:39:10 wmcoolmon
* Forgot the breathalyzer
*
@@ -901,7 +905,7 @@ void add_shield_strength(object *objp, float delta)
section_max = get_max_shield_quad(objp);
if (!(The_mission.ai_options->flags & AIOF_SMART_SHIELD_MANAGEMENT))
if (!(The_mission.ai_profile->flags & AIPF_SMART_SHIELD_MANAGEMENT))
{
for (i=0; i<MAX_SHIELD_SECTIONS; i++) {
objp->shield_quadrant[i] += delta/MAX_SHIELD_SECTIONS;
+7 -3
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Ship/Afterburner.cpp $
* $Revision: 2.18 $
* $Date: 2005-11-21 00:46:05 $
* $Revision: 2.19 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* C file for managing the afterburners
*
* $Log: not supported by cvs2svn $
* Revision 2.18 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.17 2005/10/10 17:21:10 taylor
* remove NO_NETWORK
*
@@ -404,7 +408,7 @@ void afterburners_update(object *objp, float fl_frametime)
if ( shipp->afterburner_fuel < sip->afterburner_fuel_capacity ) {
float recharge_scale;
recharge_scale = Energy_levels[shipp->engine_recharge_index] * 2.0f * The_mission.ai_options->afterburner_recharge_scale[Game_skill_level];
recharge_scale = Energy_levels[shipp->engine_recharge_index] * 2.0f * The_mission.ai_profile->afterburner_recharge_scale[Game_skill_level];
shipp->afterburner_fuel += (sip->afterburner_recover_rate * fl_frametime * recharge_scale);
if ( shipp->afterburner_fuel > sip->afterburner_fuel_capacity){
+8 -4
View File
@@ -10,13 +10,17 @@
/*
* $Logfile: /Freespace2/code/Ship/Ship.cpp $
* $Revision: 2.265 $
* $Date: 2005-11-21 00:46:05 $
* $Revision: 2.266 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* Ship (and other object) handling functions
*
* $Log: not supported by cvs2svn $
* Revision 2.265 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.264 2005/11/17 20:52:02 taylor
* fix for thruster glows (affecting TBP mainly but OC as well):
* - thruster glows should always come from ship entry rather than species (it will be initted by the species entry at first)
@@ -8560,9 +8564,9 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
float next_fire_delay = (float) winfo_p->fire_wait * 1000.0f;
if (!(obj->flags & OF_PLAYER_SHIP) ) {
if (shipp->team == Ships[Player_obj->instance].team){
next_fire_delay *= The_mission.ai_options->ship_fire_delay_scale_friendly[Game_skill_level];
next_fire_delay *= The_mission.ai_profile->ship_fire_delay_scale_friendly[Game_skill_level];
} else {
next_fire_delay *= The_mission.ai_options->ship_fire_delay_scale_hostile[Game_skill_level];
next_fire_delay *= The_mission.ai_profile->ship_fire_delay_scale_hostile[Game_skill_level];
}
}
+10 -6
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Ship/ShipHit.cpp $
* $Revision: 2.56 $
* $Date: 2005-11-21 01:53:57 $
* $Revision: 2.57 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* Code to deal with a ship getting hit by something, be it a missile, dog, or ship.
*
* $Log: not supported by cvs2svn $
* Revision 2.56 2005/11/21 01:53:57 Goober5000
* add a flag to re-enable shockwaves damaging subsystems (from FS1)
* --Goober5000
*
* Revision 2.55 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
@@ -1032,7 +1036,7 @@ float do_subobj_hit_stuff(object *ship_obj, object *other_obj, vec3d *hitpos, fl
{
// MK, 9/2/99. Shockwaves do zero subsystem damage on small ships.
// Goober5000 - added back in via flag
if ((Ship_info[ship_p->ship_info_index].flags & (SIF_SMALL_SHIP)) && !(The_mission.ai_options->flags & AIOF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS))
if ((Ship_info[ship_p->ship_info_index].flags & (SIF_SMALL_SHIP)) && !(The_mission.ai_profile->flags & AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS))
return damage;
else {
damage_left = Shockwaves[other_obj->instance].damage/4.0f;
@@ -1157,7 +1161,7 @@ float do_subobj_hit_stuff(object *ship_obj, object *other_obj, vec3d *hitpos, fl
if (damage_to_apply > 0.1f && !(MULTIPLAYER_CLIENT) && !(Game_mode & GM_DEMO_PLAYBACK)) {
// Decrease damage to subsystems to player ships.
if (ship_obj->flags & OF_PLAYER_SHIP){
damage_to_apply *= The_mission.ai_options->subsys_damage_scale[Game_skill_level];
damage_to_apply *= The_mission.ai_profile->subsys_damage_scale[Game_skill_level];
}
// Goober5000 - subsys guardian
@@ -2372,8 +2376,8 @@ static void ship_do_damage(object *ship_obj, object *other_obj, vec3d *hitpos, f
else {
// Do a little "skill" balancing for the player in single player and coop multiplayer
if (ship_obj->flags & OF_PLAYER_SHIP) {
damage *= The_mission.ai_options->player_damage_scale[Game_skill_level];
subsystem_damage *= The_mission.ai_options->player_damage_scale[Game_skill_level];
damage *= The_mission.ai_profile->player_damage_scale[Game_skill_level];
subsystem_damage *= The_mission.ai_profile->player_damage_scale[Game_skill_level];
}
}
}
+8 -4
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Weapon/Beam.cpp $
* $Revision: 2.61 $
* $Date: 2005-11-21 00:46:05 $
* $Revision: 2.62 $
* $Date: 2005-11-21 02:43:30 $
* $Author: Goober5000 $
*
* all sorts of cool stuff about ships
*
* $Log: not supported by cvs2svn $
* Revision 2.61 2005/11/21 00:46:05 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.60 2005/11/08 01:04:02 wmcoolmon
* More warnings instead of Int3s/Asserts, better Lua scripting, weapons_expl.tbl is no longer needed nor read, added "$Disarmed ImpactSnd:", fire-beam fix
*
@@ -3548,8 +3552,8 @@ float beam_get_ship_damage(beam *b, object *objp)
//-- Goober5000
// same team. yikes
if((b->team == Ships[objp->instance].team) && (Weapon_info[b->weapon_info_index].damage > The_mission.ai_options->beam_friendly_damage_cap[Game_skill_level])){
return The_mission.ai_options->beam_friendly_damage_cap[Game_skill_level] * attenuation;
if((b->team == Ships[objp->instance].team) && (Weapon_info[b->weapon_info_index].damage > The_mission.ai_profile->beam_friendly_damage_cap[Game_skill_level])){
return The_mission.ai_profile->beam_friendly_damage_cap[Game_skill_level] * attenuation;
}
// normal damage
+5 -1
View File
@@ -12,6 +12,10 @@
* <insert description of file here>
*
* $Log: not supported by cvs2svn $
* Revision 2.147 2005/11/21 00:46:06 Goober5000
* add ai_settings.tbl
* --Goober5000
*
* Revision 2.146 2005/11/16 21:27:31 taylor
* don't try to apply a shockwave force if there is no actual force to apply, avoids needless math and fixes a NULL vec3d warning
*
@@ -3845,7 +3849,7 @@ void find_homing_object(object *weapon_objp, int num)
// For co-op, it's probably also OK.
if (!( Game_mode & GM_MULTIPLAYER )) {
int num_homers = compute_num_homing_objects(objp);
if (The_mission.ai_options->max_allowed_player_homers[Game_skill_level] < num_homers)
if (The_mission.ai_profile->max_allowed_player_homers[Game_skill_level] < num_homers)
continue;
}
}