Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1009fbd144 | ||
|
|
7158aca5a0 |
No files matched your search
@@ -211,9 +211,6 @@ FS2_SOURCES = \
|
||||
ai/aiturret.cpp \
|
||||
ai/ai_profiles.cpp \
|
||||
ai/ai_profiles.h \
|
||||
ai/aimodular.h \
|
||||
ai/aimodular.cpp \
|
||||
ai/newai/newai.cpp \
|
||||
anim/animplay.cpp \
|
||||
anim/animplay.h \
|
||||
anim/packunpack.cpp \
|
||||
@@ -309,10 +306,16 @@ FS2_SOURCES = \
|
||||
graphics/gropengl.h \
|
||||
graphics/gropenglbmpman.cpp \
|
||||
graphics/gropenglbmpman.h \
|
||||
graphics/gropengldraw.cpp \
|
||||
graphics/gropengldraw.h \
|
||||
graphics/gropenglextension.cpp \
|
||||
graphics/gropenglextension.h \
|
||||
graphics/gropengllight.cpp \
|
||||
graphics/gropengllight.h \
|
||||
graphics/gropenglshader.cpp \
|
||||
graphics/gropenglshader.h \
|
||||
graphics/gropenglstate.cpp \
|
||||
graphics/gropenglstate.h \
|
||||
graphics/gropengltexture.cpp \
|
||||
graphics/gropengltexture.h \
|
||||
graphics/gropengltnl.cpp \
|
||||
@@ -321,6 +324,7 @@ FS2_SOURCES = \
|
||||
graphics/grstub.h \
|
||||
graphics/line.h \
|
||||
graphics/tmapper.h \
|
||||
graphics/textureset.cpp \
|
||||
hud/hud.cpp \
|
||||
hud/hud.h \
|
||||
hud/hudartillery.cpp \
|
||||
@@ -365,6 +369,9 @@ FS2_SOURCES = \
|
||||
inetfile/chttpget.h \
|
||||
inetfile/inetgetfile.cpp \
|
||||
inetfile/inetgetfile.h \
|
||||
io/joy.cpp \
|
||||
io/joy.h \
|
||||
io/joy_ff.h \
|
||||
io/key.cpp \
|
||||
io/key.h \
|
||||
io/keycontrol.cpp \
|
||||
@@ -678,10 +685,8 @@ FS2_SOURCES = \
|
||||
## joystic support sources
|
||||
if FS2_OS_WIN32
|
||||
JOY_SOURCES = \
|
||||
io/joy.cpp \
|
||||
io/joy.h \
|
||||
io/joy-win.cpp \
|
||||
io/joy_ff.cpp \
|
||||
io/joy_ff.h \
|
||||
io/sw_error.hpp \
|
||||
io/sw_force.h \
|
||||
io/sw_guid.hpp \
|
||||
@@ -690,9 +695,7 @@ endif
|
||||
|
||||
if FS2_OS_UNIX
|
||||
JOY_SOURCES = \
|
||||
io/joy.h \
|
||||
io/joy_ff.h \
|
||||
io/joy-unix.cpp
|
||||
io/joy-sdl.cpp
|
||||
endif
|
||||
|
||||
## sound support sources
|
||||
@@ -825,8 +828,6 @@ fs2_open_r_SOURCES = \
|
||||
|
||||
fs2_open_d_LDADD = libcode.a ../libjpeg/libjpeg.a ../lua/liblua.a
|
||||
fs2_open_r_LDADD = libcode.a ../libjpeg/libjpeg.a ../lua/liblua.a
|
||||
fs2_open_d_LDFLAGS = -rdynamic
|
||||
fs2_open_r_LDFLAGS = -rdynamic
|
||||
|
||||
##
|
||||
## End MAIN binary
|
||||
|
||||
@@ -235,10 +235,6 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
// 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"))
|
||||
{
|
||||
strcpy(profile->ai_module, "retail");
|
||||
if (optional_string("$AI Module:"))
|
||||
stuff_string(profile->ai_module, F_NAME, NAME_LENGTH);
|
||||
|
||||
if (optional_string("$Player Afterburner Recharge Scale:"))
|
||||
parse_float_list(profile->afterburner_recharge_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
@@ -314,12 +310,6 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
if (optional_string("$Player Weapon Recharge Scale:"))
|
||||
parse_float_list(profile->weapon_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Turret Target Ownage:"))
|
||||
parse_int_list(profile->max_turret_ownage_target, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Turret Player Ownage:"))
|
||||
parse_int_list(profile->max_turret_ownage_player, 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, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION);
|
||||
|
||||
@@ -80,8 +80,6 @@
|
||||
typedef struct ai_profile_t {
|
||||
|
||||
char profile_name[NAME_LENGTH];
|
||||
|
||||
char ai_module[NAME_LENGTH];
|
||||
|
||||
int flags;
|
||||
|
||||
@@ -117,10 +115,6 @@ typedef struct ai_profile_t {
|
||||
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS];
|
||||
float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS];
|
||||
|
||||
// Maximum turrets of one ship allowed to shoot the same target
|
||||
int max_turret_ownage_target[NUM_SKILL_LEVELS];
|
||||
int max_turret_ownage_player[NUM_SKILL_LEVELS];
|
||||
|
||||
} ai_profile_t;
|
||||
|
||||
|
||||
|
||||
@@ -482,141 +482,13 @@ extern int model_which_octant_distant_many( vec3d *pnt, int model_num,matrix *mo
|
||||
extern void compute_desired_rvec(vec3d *rvec, vec3d *goal_pos, vec3d *cur_pos);
|
||||
extern void big_ship_collide_recover_start(object *objp, object *big_objp, vec3d *collide_pos, vec3d *collision_normal);
|
||||
|
||||
// FF 14-06-07
|
||||
// AI Big Table Wrapper
|
||||
|
||||
struct aibig_call_table *aibig_table = &AIBigDefaultTable;
|
||||
|
||||
void ai_big_evade_ship ()
|
||||
{
|
||||
aibig_table->ai_big_evade_ship();
|
||||
}
|
||||
|
||||
void ai_big_chase_attack (ai_info *aip, ship_info *sip, vec3d *enemy_pos, float dist_to_enemy, int modelnum)
|
||||
{
|
||||
aibig_table->ai_big_chase_attack(aip, sip, enemy_pos, dist_to_enemy, modelnum);
|
||||
}
|
||||
|
||||
void ai_big_avoid_ship ()
|
||||
{
|
||||
aibig_table->ai_big_avoid_ship();
|
||||
}
|
||||
|
||||
int ai_big_maybe_follow_subsys_path (int do_dot_check)
|
||||
{
|
||||
return aibig_table->ai_big_maybe_follow_subsys_path(do_dot_check);
|
||||
}
|
||||
|
||||
void ai_bpap (object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec, vec3d *attack_point, vec3d *local_attack_point, float fov, float weapon_travel_dist, vec3d *surface_normal)
|
||||
{
|
||||
aibig_table->ai_bpap(objp, attacker_objp_pos, attacker_objp_fvec, attack_point, local_attack_point, fov, weapon_travel_dist, surface_normal);
|
||||
}
|
||||
|
||||
void ai_big_pick_attack_point_turret (object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float fov, float weapon_travel_dist)
|
||||
{
|
||||
aibig_table->ai_big_pick_attack_point_turret(objp, ssp, gpos, gvec, attack_point, fov, weapon_travel_dist);
|
||||
}
|
||||
|
||||
void ai_big_pick_attack_point (object *objp, object *attacker_objp, vec3d *attack_point, float fov)
|
||||
{
|
||||
aibig_table->ai_big_pick_attack_point(objp, attacker_objp, attack_point, fov);
|
||||
}
|
||||
|
||||
void ai_big_subsys_path_cleanup (ai_info *aip)
|
||||
{
|
||||
aibig_table->ai_big_subsys_path_cleanup(aip);
|
||||
}
|
||||
|
||||
int ai_big_maybe_start_strafe (ai_info *aip, ship_info *sip)
|
||||
{
|
||||
return aibig_table->ai_big_maybe_start_strafe(aip, sip);
|
||||
}
|
||||
|
||||
void ai_big_chase_ct ()
|
||||
{
|
||||
aibig_table->ai_big_chase_ct();
|
||||
}
|
||||
|
||||
void ai_big_maybe_fire_weapons (float dist_to_enemy, float dot_to_enemy, vec3d *firing_pos, vec3d *enemy_pos, vec3d *enemy_vel)
|
||||
{
|
||||
aibig_table->ai_big_maybe_fire_weapons(dist_to_enemy, dot_to_enemy, firing_pos, enemy_pos, enemy_vel);
|
||||
}
|
||||
|
||||
void ai_big_switch_to_chase_mode (ai_info *aip)
|
||||
{
|
||||
aibig_table->ai_big_switch_to_chase_mode(aip);
|
||||
}
|
||||
|
||||
int ai_big_strafe_maybe_retreat (float dist, vec3d *target_pos)
|
||||
{
|
||||
return aibig_table->ai_big_strafe_maybe_retreat(dist, target_pos);
|
||||
}
|
||||
|
||||
void ai_big_chase ()
|
||||
{
|
||||
aibig_table->ai_big_chase();
|
||||
}
|
||||
|
||||
void ai_big_ship (object *objp)
|
||||
{
|
||||
aibig_table->ai_big_ship(objp);
|
||||
}
|
||||
|
||||
void ai_big_attack_get_data (vec3d *enemy_pos, float *dist_to_enemy, float *dot_to_enemy)
|
||||
{
|
||||
aibig_table->ai_big_attack_get_data(enemy_pos, dist_to_enemy, dot_to_enemy);
|
||||
}
|
||||
|
||||
void ai_big_strafe_attack ()
|
||||
{
|
||||
aibig_table->ai_big_strafe_attack();
|
||||
}
|
||||
|
||||
void ai_big_strafe_avoid ()
|
||||
{
|
||||
aibig_table->ai_big_strafe_avoid();
|
||||
}
|
||||
|
||||
void ai_big_strafe_retreat1 ()
|
||||
{
|
||||
aibig_table->ai_big_strafe_retreat1();
|
||||
}
|
||||
|
||||
void ai_big_strafe_retreat2 ()
|
||||
{
|
||||
aibig_table->ai_big_strafe_retreat2();
|
||||
}
|
||||
|
||||
void ai_big_strafe_position ()
|
||||
{
|
||||
aibig_table->ai_big_strafe_position();
|
||||
}
|
||||
|
||||
void ai_big_strafe ()
|
||||
{
|
||||
aibig_table->ai_big_strafe();
|
||||
}
|
||||
|
||||
int ai_big_maybe_enter_strafe_mode (object *pl_objp, int weapon_objnum, int consider_target_only)
|
||||
{
|
||||
return aibig_table->ai_big_maybe_enter_strafe_mode(pl_objp, weapon_objnum, consider_target_only);
|
||||
}
|
||||
|
||||
void ai_big_strafe_maybe_attack_turret (object *ship_objp, object *weapon_objp)
|
||||
{
|
||||
aibig_table->ai_big_strafe_maybe_attack_turret(ship_objp, weapon_objp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// AI Big Default implementation
|
||||
|
||||
// Called by ai_big_pick_attack_point.
|
||||
// Generates a random attack point.
|
||||
// If truly_random flag set (haha), then generate a pretty random number. Otherwise, generate a static rand which
|
||||
// tends to not change from frame to frame.
|
||||
// Try four times and choose nearest point to increase chance of getting a good point.
|
||||
void aibig_ai_bpap(object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec, vec3d *attack_point, vec3d *local_attack_point, float fov, float weapon_travel_dist, vec3d *surface_normal)
|
||||
void ai_bpap(object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec, vec3d *attack_point, vec3d *local_attack_point, float fov, float weapon_travel_dist, vec3d *surface_normal)
|
||||
{
|
||||
float nearest_dist;
|
||||
vec3d result_point, best_point;
|
||||
@@ -735,7 +607,7 @@ done_1:
|
||||
//
|
||||
// Note: Default value for fov is 1.0f 1.0f means don't use fov parameter.
|
||||
// If fov != 1.0f, try up to four times to find a point that's in the field of view.
|
||||
void aibig_ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float fov, float weapon_travel_dist)
|
||||
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float fov, float weapon_travel_dist)
|
||||
{
|
||||
if (!timestamp_elapsed(ssp->turret_pick_big_attack_point_timestamp)) {
|
||||
vec3d result_point;
|
||||
@@ -755,7 +627,7 @@ void aibig_ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d
|
||||
// Note: Default value for fov is 1.0f 1.0f means don't use fov parameter.
|
||||
// If fov != 1.0f, try up to four times to find a point that's in the field of view.
|
||||
// Note, attacker_objp can be a ship or a weapon.
|
||||
void aibig_ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov)
|
||||
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov)
|
||||
{
|
||||
Assert(objp->instance > -1);
|
||||
Assert(objp->type == OBJ_SHIP);
|
||||
@@ -824,7 +696,7 @@ void aibig_ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *
|
||||
}
|
||||
|
||||
// Handler for SM_EVADE submode ( called from ai_big_chase() )
|
||||
void aibig_ai_big_evade_ship()
|
||||
void ai_big_evade_ship()
|
||||
{
|
||||
vec3d player_pos, enemy_pos;
|
||||
float dist;
|
||||
@@ -872,13 +744,13 @@ void aibig_ai_big_evade_ship()
|
||||
}
|
||||
|
||||
// Handler for SM_AVOID submode ( called from ai_big_chase() )
|
||||
void aibig_ai_big_avoid_ship()
|
||||
void ai_big_avoid_ship()
|
||||
{
|
||||
ai_big_evade_ship();
|
||||
}
|
||||
|
||||
// reset path following information
|
||||
void aibig_ai_big_subsys_path_cleanup(ai_info *aip)
|
||||
void ai_big_subsys_path_cleanup(ai_info *aip)
|
||||
{
|
||||
if ( aip->ai_flags & AIF_ON_SUBSYS_PATH ) {
|
||||
aip->ai_flags &= ~AIF_ON_SUBSYS_PATH;
|
||||
@@ -893,7 +765,7 @@ void aibig_ai_big_subsys_path_cleanup(ai_info *aip)
|
||||
// input: do_dot_check => default value 0, flag to indicate whether check should be done to ensure
|
||||
// subsystem is within certain field of view. We don't want to check fov when
|
||||
// strafing, since ship is weaving to avoid turret fire
|
||||
int aibig_ai_big_maybe_follow_subsys_path(int do_dot_check)
|
||||
int ai_big_maybe_follow_subsys_path(int do_dot_check)
|
||||
{
|
||||
ai_info *aip;
|
||||
float dot = 1.0f, min_dot;
|
||||
@@ -1027,7 +899,7 @@ int aibig_ai_big_maybe_follow_subsys_path(int do_dot_check)
|
||||
// 0 => ship should not change ai mode, no fighter/bomber threats are near
|
||||
//
|
||||
// NOTE: uses SCAN_FIGHTERS_INTERVAL and ENTER_STRAFE_THREAT_DIST_SQUARED which are defined in AiBig.h
|
||||
int aibig_ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
|
||||
int ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
|
||||
{
|
||||
// if moving slowly (or stopped), and SIF_SMALL_SHIP, then enter STRAFE mode if enemy fighter/bombers
|
||||
// are near
|
||||
@@ -1062,7 +934,7 @@ int aibig_ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
|
||||
}
|
||||
|
||||
// ATTACK submode handler for chase mode.
|
||||
void aibig_ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float dist_to_enemy, int modelnum)
|
||||
void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float dist_to_enemy, int modelnum)
|
||||
{
|
||||
int start_bank;
|
||||
float dot_to_enemy, time_to_hit;
|
||||
@@ -1179,7 +1051,7 @@ void aibig_ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, f
|
||||
}
|
||||
|
||||
// Handler for submode SM_CONTINUOUS_TURN
|
||||
void aibig_ai_big_chase_ct()
|
||||
void ai_big_chase_ct()
|
||||
{
|
||||
ai_chase_ct();
|
||||
}
|
||||
@@ -1196,7 +1068,7 @@ extern void maybe_cheat_fire_synaptic(object *objp, ai_info *aip);
|
||||
// dist_to_enemy => distance (in m) to attack point on current target
|
||||
// dot_to_enemy => dot product between fvec of Pl_objp and vector from Pl_objp to attack point
|
||||
//
|
||||
void aibig_ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *firing_pos, vec3d *enemy_pos, vec3d *enemy_vel)
|
||||
void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *firing_pos, vec3d *enemy_pos, vec3d *enemy_vel)
|
||||
{
|
||||
ai_info *aip;
|
||||
ship_weapon *swp;
|
||||
@@ -1301,7 +1173,7 @@ void aibig_ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, ve
|
||||
}
|
||||
|
||||
// switch ai ship into chase mode
|
||||
void aibig_ai_big_switch_to_chase_mode(ai_info *aip)
|
||||
void ai_big_switch_to_chase_mode(ai_info *aip)
|
||||
{
|
||||
aip->previous_mode = aip->mode;
|
||||
aip->mode = AIM_CHASE;
|
||||
@@ -1312,7 +1184,7 @@ void aibig_ai_big_switch_to_chase_mode(ai_info *aip)
|
||||
extern int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos);
|
||||
|
||||
// Make object Pl_objp chase object En_objp, which is a big ship, not a small ship.
|
||||
void aibig_ai_big_chase()
|
||||
void ai_big_chase()
|
||||
{
|
||||
float dist_to_enemy, dot_to_enemy;
|
||||
vec3d player_pos, enemy_pos, vec_to_enemy;
|
||||
@@ -1602,7 +1474,7 @@ void aibig_ai_big_chase()
|
||||
aip->time_enemy_in_range *= (1.0f - flFrametime);
|
||||
}
|
||||
|
||||
void aibig_ai_big_ship(object *objp)
|
||||
void ai_big_ship(object *objp)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
@@ -1613,7 +1485,7 @@ void aibig_ai_big_ship(object *objp)
|
||||
// dist => distance from Pl_objp front to attack point
|
||||
// dot => dot of Pl_objp fvec and vector to attack point
|
||||
// fire_pos => world pos from which firing
|
||||
void aibig_ai_big_attack_get_data(vec3d *enemy_pos, float *dist_to_enemy, float *dot_to_enemy)
|
||||
void ai_big_attack_get_data(vec3d *enemy_pos, float *dist_to_enemy, float *dot_to_enemy)
|
||||
{
|
||||
vec3d player_pos, vec_to_enemy, predicted_enemy_pos;
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
@@ -1672,7 +1544,7 @@ void aibig_ai_big_attack_get_data(vec3d *enemy_pos, float *dist_to_enemy, float
|
||||
|
||||
// check to see if Pl_objp has gotten too close to attacking point.. if so, break off by entering
|
||||
// AIS_STRAFE_RETREAT
|
||||
int aibig_ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos)
|
||||
int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos)
|
||||
{
|
||||
ai_info *aip;
|
||||
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
|
||||
@@ -1729,7 +1601,7 @@ int aibig_ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos)
|
||||
}
|
||||
|
||||
// attack directly to the turret and fire weapons
|
||||
void aibig_ai_big_strafe_attack()
|
||||
void ai_big_strafe_attack()
|
||||
{
|
||||
ai_info *aip;
|
||||
vec3d target_pos;
|
||||
@@ -1832,7 +1704,7 @@ void aibig_ai_big_strafe_attack()
|
||||
}
|
||||
|
||||
// pick a new attack point when entering this state, and keep using it
|
||||
void aibig_ai_big_strafe_avoid()
|
||||
void ai_big_strafe_avoid()
|
||||
{
|
||||
ai_info *aip;
|
||||
vec3d target_pos;
|
||||
@@ -1858,7 +1730,7 @@ void aibig_ai_big_strafe_avoid()
|
||||
}
|
||||
|
||||
// move towards aip->goal_point in an evasive manner
|
||||
void aibig_ai_big_strafe_retreat1()
|
||||
void ai_big_strafe_retreat1()
|
||||
{
|
||||
float dist;
|
||||
ai_info *aip;
|
||||
@@ -1904,7 +1776,7 @@ void aibig_ai_big_strafe_retreat1()
|
||||
accelerate_ship(aip, 1.0f);
|
||||
}
|
||||
|
||||
void aibig_ai_big_strafe_retreat2()
|
||||
void ai_big_strafe_retreat2()
|
||||
{
|
||||
float dist;
|
||||
ai_info *aip;
|
||||
@@ -1943,7 +1815,7 @@ void aibig_ai_big_strafe_retreat2()
|
||||
}
|
||||
|
||||
// reposition self to begin another strafing run
|
||||
void aibig_ai_big_strafe_position()
|
||||
void ai_big_strafe_position()
|
||||
{
|
||||
ai_info *aip;
|
||||
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
|
||||
@@ -1961,7 +1833,7 @@ void aibig_ai_big_strafe_position()
|
||||
// #define AIS_STRAFE_RETREAT1 204 // fly away from attack point (on an avoid vector)
|
||||
// #define AIS_STRAFE_POSITION 205 // re-position to resume strafing attack
|
||||
//
|
||||
void aibig_ai_big_strafe()
|
||||
void ai_big_strafe()
|
||||
{
|
||||
ai_info *aip;
|
||||
|
||||
@@ -2011,7 +1883,7 @@ void aibig_ai_big_strafe()
|
||||
//
|
||||
// Check if weapon_objnum was fired by Pl_objp's target, and whether Pl_objp's target is a big ship, if
|
||||
// so, enter AIM_STRAFE
|
||||
int aibig_ai_big_maybe_enter_strafe_mode(object *pl_objp, int weapon_objnum, int consider_target_only)
|
||||
int ai_big_maybe_enter_strafe_mode(object *pl_objp, int weapon_objnum, int consider_target_only)
|
||||
{
|
||||
ai_info *aip;
|
||||
ship_info *sip;
|
||||
@@ -2085,7 +1957,7 @@ int aibig_ai_big_maybe_enter_strafe_mode(object *pl_objp, int weapon_objnum, int
|
||||
// Consider attacking a turret, if a turret actually fired the weapon
|
||||
// input: ship_objp => ship that will attack the turret
|
||||
// weapon_objp =>
|
||||
void aibig_ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp)
|
||||
void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp)
|
||||
{
|
||||
ai_info *aip;
|
||||
object *parent_objp;
|
||||
@@ -2134,30 +2006,3 @@ void aibig_ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_o
|
||||
// attack the turret
|
||||
set_targeted_subsys(aip, Weapons[weapon_objp->instance].turret_subsys, OBJ_INDEX(parent_objp));
|
||||
}
|
||||
|
||||
struct aibig_call_table AIBigDefaultTable = {
|
||||
aibig_ai_big_evade_ship,
|
||||
aibig_ai_big_chase_attack,
|
||||
aibig_ai_big_avoid_ship,
|
||||
aibig_ai_big_maybe_follow_subsys_path,
|
||||
aibig_ai_bpap,
|
||||
aibig_ai_big_pick_attack_point_turret,
|
||||
aibig_ai_big_pick_attack_point,
|
||||
aibig_ai_big_subsys_path_cleanup,
|
||||
aibig_ai_big_maybe_start_strafe,
|
||||
aibig_ai_big_chase_ct,
|
||||
aibig_ai_big_maybe_fire_weapons,
|
||||
aibig_ai_big_switch_to_chase_mode,
|
||||
aibig_ai_big_strafe_maybe_retreat,
|
||||
aibig_ai_big_chase,
|
||||
aibig_ai_big_ship,
|
||||
aibig_ai_big_attack_get_data,
|
||||
aibig_ai_big_strafe_attack,
|
||||
aibig_ai_big_strafe_avoid,
|
||||
aibig_ai_big_strafe_retreat1,
|
||||
aibig_ai_big_strafe_retreat2,
|
||||
aibig_ai_big_strafe_position,
|
||||
aibig_ai_big_strafe,
|
||||
aibig_ai_big_maybe_enter_strafe_mode,
|
||||
aibig_ai_big_strafe_maybe_attack_turret
|
||||
};
|
||||
@@ -102,43 +102,6 @@ void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp);
|
||||
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov=1.0f);
|
||||
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float weapon_travel_dist, float fov=1.0f);
|
||||
|
||||
// AI Big Table Wrapper
|
||||
|
||||
#include "ship/ship.h"
|
||||
|
||||
struct aibig_call_table
|
||||
{
|
||||
void (*ai_big_evade_ship) ();
|
||||
void (*ai_big_chase_attack) (ai_info *aip, ship_info *sip, vec3d *enemy_pos, float dist_to_enemy, int modelnum);
|
||||
void (*ai_big_avoid_ship) ();
|
||||
int (*ai_big_maybe_follow_subsys_path) (int do_dot_check=1);
|
||||
void (*ai_bpap) (object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec, vec3d *attack_point, vec3d *local_attack_point, float fov, float weapon_travel_dist, vec3d *surface_normal);
|
||||
void (*ai_big_pick_attack_point_turret) (object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float fov, float weapon_travel_dist);
|
||||
void (*ai_big_pick_attack_point) (object *objp, object *attacker_objp, vec3d *attack_point, float fov);
|
||||
void (*ai_big_subsys_path_cleanup) (ai_info *aip);
|
||||
int (*ai_big_maybe_start_strafe) (ai_info *aip, ship_info *sip);
|
||||
void (*ai_big_chase_ct) ();
|
||||
void (*ai_big_maybe_fire_weapons) (float dist_to_enemy, float dot_to_enemy, vec3d *firing_pos, vec3d *enemy_pos, vec3d *enemy_vel);
|
||||
void (*ai_big_switch_to_chase_mode) (ai_info *aip);
|
||||
int (*ai_big_strafe_maybe_retreat) (float dist, vec3d *target_pos);
|
||||
void (*ai_big_chase) ();
|
||||
void (*ai_big_ship) (object *objp);
|
||||
void (*ai_big_attack_get_data) (vec3d *enemy_pos, float *dist_to_enemy, float *dot_to_enemy);
|
||||
void (*ai_big_strafe_attack) ();
|
||||
void (*ai_big_strafe_avoid) ();
|
||||
void (*ai_big_strafe_retreat1) ();
|
||||
void (*ai_big_strafe_retreat2) ();
|
||||
void (*ai_big_strafe_position) ();
|
||||
void (*ai_big_strafe) ();
|
||||
int (*ai_big_maybe_enter_strafe_mode) (object *pl_objp, int weapon_objnum, int consider_target_only);
|
||||
void (*ai_big_strafe_maybe_attack_turret) (object *ship_objp, object *weapon_objp);
|
||||
};
|
||||
|
||||
// Set new pointer to override ai_big* function calls
|
||||
// possibly copying the old function calls first
|
||||
|
||||
extern struct aibig_call_table *aibig_table;
|
||||
|
||||
extern struct aibig_call_table AIBigDefaultTable;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -772,176 +772,11 @@ ai_goal_list Ai_goal_names[] =
|
||||
|
||||
int Num_ai_goals = sizeof(Ai_goal_names) / sizeof(ai_goal_list);
|
||||
|
||||
// FF 04-06-07
|
||||
// AI Goal Table Wrapper
|
||||
|
||||
struct aigoal_call_table *aigoal_table = &AIGoalDefaultTable;
|
||||
|
||||
char* Ai_goal_text (int goal)
|
||||
{
|
||||
return aigoal_table->Ai_goal_text(goal);
|
||||
}
|
||||
|
||||
void ai_maybe_add_form_goal (wing *wingp)
|
||||
{
|
||||
aigoal_table->ai_maybe_add_form_goal(wingp);
|
||||
}
|
||||
|
||||
void ai_post_process_mission ()
|
||||
{
|
||||
aigoal_table->ai_post_process_mission();
|
||||
}
|
||||
|
||||
int ai_query_goal_valid (int ship, int ai_goal)
|
||||
{
|
||||
return aigoal_table->ai_query_goal_valid(ship, ai_goal);
|
||||
}
|
||||
|
||||
void ai_remove_ship_goal (ai_info *aip, int index)
|
||||
{
|
||||
aigoal_table->ai_remove_ship_goal(aip, index);
|
||||
}
|
||||
|
||||
void ai_clear_ship_goals (ai_info *aip)
|
||||
{
|
||||
aigoal_table->ai_clear_ship_goals(aip);
|
||||
}
|
||||
|
||||
void ai_clear_wing_goals (int wingnum)
|
||||
{
|
||||
aigoal_table->ai_clear_wing_goals(wingnum);
|
||||
}
|
||||
|
||||
void ai_mission_wing_goal_complete (int wingnum, ai_goal *remove_goalp)
|
||||
{
|
||||
aigoal_table->ai_mission_wing_goal_complete(wingnum, remove_goalp);
|
||||
}
|
||||
|
||||
void ai_mission_goal_complete (ai_info *aip)
|
||||
{
|
||||
aigoal_table->ai_mission_goal_complete(aip);
|
||||
}
|
||||
|
||||
int ai_get_subsystem_type (char *subsystem)
|
||||
{
|
||||
return aigoal_table->ai_get_subsystem_type(subsystem);
|
||||
}
|
||||
|
||||
void ai_goal_purge_invalid_goals (ai_goal *aigp, ai_goal *goal_list)
|
||||
{
|
||||
aigoal_table->ai_goal_purge_invalid_goals(aigp, goal_list);
|
||||
}
|
||||
|
||||
void ai_goal_purge_all_invalid_goals (ai_goal *aigp)
|
||||
{
|
||||
aigoal_table->ai_goal_purge_all_invalid_goals(aigp);
|
||||
}
|
||||
|
||||
int ai_goal_find_dockpoint (int shipnum, int dock_type)
|
||||
{
|
||||
return aigoal_table->ai_goal_find_dockpoint(shipnum, dock_type);
|
||||
}
|
||||
|
||||
void ai_goal_fixup_dockpoints (ai_info *aip, ai_goal *aigp)
|
||||
{
|
||||
aigoal_table->ai_goal_fixup_dockpoints(aip, aigp);
|
||||
}
|
||||
|
||||
void ai_add_goal_sub_player (int type, int mode, int submode, char *shipname, ai_goal *aigp)
|
||||
{
|
||||
aigoal_table->ai_add_goal_sub_player(type, mode, submode, shipname, aigp);
|
||||
}
|
||||
|
||||
int ai_goal_find_empty_slot (ai_goal *goals, int active_goal)
|
||||
{
|
||||
return aigoal_table->ai_goal_find_empty_slot(goals, active_goal);
|
||||
}
|
||||
|
||||
void ai_add_ship_goal_player (int type, int mode, int submode, char *shipname, ai_info *aip)
|
||||
{
|
||||
aigoal_table->ai_add_ship_goal_player(type, mode, submode, shipname, aip);
|
||||
}
|
||||
|
||||
void ai_add_wing_goal_player (int type, int mode, int submode, char *shipname, int wingnum)
|
||||
{
|
||||
aigoal_table->ai_add_wing_goal_player(type, mode, submode, shipname, wingnum);
|
||||
}
|
||||
|
||||
void ai_add_goal_sub_sexp (int sexp, int type, ai_goal *aigp, char *actor_name)
|
||||
{
|
||||
aigoal_table->ai_add_goal_sub_sexp(sexp, type, aigp, actor_name);
|
||||
}
|
||||
|
||||
void ai_add_ship_goal_sexp (int sexp, int type, ai_info *aip)
|
||||
{
|
||||
aigoal_table->ai_add_ship_goal_sexp(sexp, type, aip);
|
||||
}
|
||||
|
||||
void ai_add_wing_goal_sexp (int sexp, int type, int wingnum)
|
||||
{
|
||||
aigoal_table->ai_add_wing_goal_sexp(sexp, type, wingnum);
|
||||
}
|
||||
|
||||
void ai_add_goal_ship_internal (ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate)
|
||||
{
|
||||
aigoal_table->ai_add_goal_ship_internal(aip, goal_type, name, docker_point, dockee_point, immediate);
|
||||
}
|
||||
|
||||
void ai_add_goal_wing_internal (wing *wingp, int goal_type, char *name, int immediate)
|
||||
{
|
||||
aigoal_table->ai_add_goal_wing_internal(wingp, goal_type, name, immediate);
|
||||
}
|
||||
|
||||
void ai_copy_mission_wing_goal (ai_goal *aigp, ai_info *aip)
|
||||
{
|
||||
aigoal_table->ai_copy_mission_wing_goal(aigp, aip);
|
||||
}
|
||||
|
||||
int ai_mission_goal_achievable (int objnum, ai_goal *aigp)
|
||||
{
|
||||
return aigoal_table->ai_mission_goal_achievable(objnum, aigp);
|
||||
}
|
||||
|
||||
int ai_goal_priority_compare (const void *a, const void *b)
|
||||
{
|
||||
return aigoal_table->ai_goal_priority_compare(a, b);
|
||||
}
|
||||
|
||||
void prioritize_goals (int objnum, ai_info *aip)
|
||||
{
|
||||
aigoal_table->prioritize_goals(objnum, aip);
|
||||
}
|
||||
|
||||
void validate_mission_goals (int objnum, ai_info *aip)
|
||||
{
|
||||
aigoal_table->validate_mission_goals(objnum, aip);
|
||||
}
|
||||
|
||||
void ai_process_mission_orders (int objnum, ai_info *aip)
|
||||
{
|
||||
aigoal_table->ai_process_mission_orders(objnum, aip);
|
||||
}
|
||||
|
||||
void ai_update_goal_references (ai_goal *goals, int type, char *old_name, char *new_name)
|
||||
{
|
||||
aigoal_table->ai_update_goal_references(goals, type, old_name, new_name);
|
||||
}
|
||||
|
||||
int query_referenced_in_ai_goals (ai_goal *goals, int type, char *name)
|
||||
{
|
||||
return aigoal_table->query_referenced_in_ai_goals(goals, type, name);
|
||||
}
|
||||
|
||||
char* ai_add_dock_name (char *str)
|
||||
{
|
||||
return aigoal_table->ai_add_dock_name(str);
|
||||
}
|
||||
|
||||
// AL 11-17-97: A text description of the AI goals. This is used for printing out on the
|
||||
// HUD what a ship's current orders are. If the AI goal doesn't correspond to something that
|
||||
// ought to be printable, then NULL is used.
|
||||
// JAS: Converted to a function in order to externalize the strings
|
||||
char *aigoal_Ai_goal_text(int goal)
|
||||
char *Ai_goal_text(int goal)
|
||||
{
|
||||
switch(goal) {
|
||||
case 1:
|
||||
@@ -980,7 +815,7 @@ char *aigoal_Ai_goal_text(int goal)
|
||||
|
||||
// function to maybe add the form on my wing goal for a player's starting wing. Called when a player wing arrives.
|
||||
// Goober5000 - made more generic
|
||||
void aigoal_ai_maybe_add_form_goal( wing *wingp )
|
||||
void ai_maybe_add_form_goal( wing *wingp )
|
||||
{
|
||||
int j;
|
||||
char *wing_leader;
|
||||
@@ -1018,7 +853,7 @@ void aigoal_ai_maybe_add_form_goal( wing *wingp )
|
||||
}
|
||||
}
|
||||
|
||||
void aigoal_ai_post_process_mission()
|
||||
void ai_post_process_mission()
|
||||
{
|
||||
object *objp;
|
||||
|
||||
@@ -1072,7 +907,7 @@ void aigoal_ai_post_process_mission()
|
||||
}
|
||||
|
||||
// function which determines is a goal is valid for a particular type of ship
|
||||
int aigoal_ai_query_goal_valid( int ship, int ai_goal )
|
||||
int ai_query_goal_valid( int ship, int ai_goal )
|
||||
{
|
||||
int accepted;
|
||||
|
||||
@@ -1095,7 +930,7 @@ int aigoal_ai_query_goal_valid( int ship, int ai_goal )
|
||||
}
|
||||
|
||||
// remove an ai goal from it's list. Uses the active_goal member as the goal to remove
|
||||
void aigoal_ai_remove_ship_goal( ai_info *aip, int index )
|
||||
void ai_remove_ship_goal( ai_info *aip, int index )
|
||||
{
|
||||
// only need to set the ai_mode for the particular goal to AI_GOAL_NONE
|
||||
// reset ai mode to default behavior. Might get changed next time through
|
||||
@@ -1115,7 +950,7 @@ void aigoal_ai_remove_ship_goal( ai_info *aip, int index )
|
||||
//ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] );
|
||||
}
|
||||
|
||||
void aigoal_ai_clear_ship_goals( ai_info *aip )
|
||||
void ai_clear_ship_goals( ai_info *aip )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1134,7 +969,7 @@ void aigoal_ai_clear_ship_goals( ai_info *aip )
|
||||
}
|
||||
}
|
||||
|
||||
void aigoal_ai_clear_wing_goals( int wingnum )
|
||||
void ai_clear_wing_goals( int wingnum )
|
||||
{
|
||||
int i;
|
||||
wing *wingp = &Wings[wingnum];
|
||||
@@ -1164,7 +999,7 @@ void aigoal_ai_clear_wing_goals( int wingnum )
|
||||
// structure of the goal to be removed. This process is slightly tricky since some member of the wing
|
||||
// might be pursuing a different goal. We will have to compare based on mode, submode, priority,
|
||||
// and name.. This routine is only currently called from waypoint code!!!
|
||||
void aigoal_ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp )
|
||||
void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp )
|
||||
{
|
||||
int mode, submode, priority, i;
|
||||
char *name;
|
||||
@@ -1224,7 +1059,7 @@ void aigoal_ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp )
|
||||
// routine which is called with an ai object complete it's goal. Do some action
|
||||
// based on the goal what was just completed
|
||||
|
||||
void aigoal_ai_mission_goal_complete( ai_info *aip )
|
||||
void ai_mission_goal_complete( ai_info *aip )
|
||||
{
|
||||
// if the active goal is dynamic or none, just return. (AI_GOAL_NONE is probably an error, but
|
||||
// I don't think that this is a problem)
|
||||
@@ -1236,7 +1071,7 @@ void aigoal_ai_mission_goal_complete( ai_info *aip )
|
||||
|
||||
}
|
||||
|
||||
int aigoal_ai_get_subsystem_type( char *subsystem )
|
||||
int ai_get_subsystem_type( char *subsystem )
|
||||
{
|
||||
if ( strstr(subsystem, "engine") ) {
|
||||
return SUBSYSTEM_ENGINE;
|
||||
@@ -1272,7 +1107,7 @@ int aigoal_ai_get_subsystem_type( char *subsystem )
|
||||
// which are destroy, etc, should get removed. goal list is the list of goals to purge. It is
|
||||
// always MAX_AI_GOALS in length. This function will only get called when the goal which causes
|
||||
// purging becomes valid.
|
||||
void aigoal_ai_goal_purge_invalid_goals( ai_goal *aigp, ai_goal *goal_list )
|
||||
void ai_goal_purge_invalid_goals( ai_goal *aigp, ai_goal *goal_list )
|
||||
{
|
||||
int i;
|
||||
ai_goal *purge_goal;
|
||||
@@ -1338,7 +1173,7 @@ void aigoal_ai_goal_purge_invalid_goals( ai_goal *aigp, ai_goal *goal_list )
|
||||
}
|
||||
|
||||
// function to purge the goals of *all* ships in the game based on the incoming goal structure
|
||||
void aigoal_ai_goal_purge_all_invalid_goals(ai_goal *aigp)
|
||||
void ai_goal_purge_all_invalid_goals(ai_goal *aigp)
|
||||
{
|
||||
int i;
|
||||
ship_obj *sop;
|
||||
@@ -1361,7 +1196,7 @@ void aigoal_ai_goal_purge_all_invalid_goals(ai_goal *aigp)
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
int aigoal_ai_goal_find_dockpoint(int shipnum, int dock_type)
|
||||
int ai_goal_find_dockpoint(int shipnum, int dock_type)
|
||||
{
|
||||
int dock_index = -1;
|
||||
int loop_count = 0;
|
||||
@@ -1412,7 +1247,7 @@ int aigoal_ai_goal_find_dockpoint(int shipnum, int dock_type)
|
||||
// passed are the pointer to goal we are working with. aip if the ai_info pointer
|
||||
// of the ship with the order. aigp is a pointer to the goal (of aip) of which we are
|
||||
// fixing up the docking points
|
||||
void aigoal_ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
|
||||
void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
|
||||
{
|
||||
int shipnum, docker_index, dockee_index;
|
||||
|
||||
@@ -1483,7 +1318,7 @@ void aigoal_ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
|
||||
// from the mission goals (i.e. those goals which come from events) in that we don't
|
||||
// use sexpressions for goals from the player...so we enumerate all the parameters
|
||||
|
||||
void aigoal_ai_add_goal_sub_player(int type, int mode, int submode, char *shipname, ai_goal *aigp )
|
||||
void ai_add_goal_sub_player(int type, int mode, int submode, char *shipname, ai_goal *aigp )
|
||||
{
|
||||
Assert ( (type == AIG_TYPE_PLAYER_WING) || (type == AIG_TYPE_PLAYER_SHIP) );
|
||||
|
||||
@@ -1524,7 +1359,7 @@ void aigoal_ai_add_goal_sub_player(int type, int mode, int submode, char *shipna
|
||||
// friendlies want to rearm at the same time. The support ship forgets what it's doing and flies
|
||||
// off to repair somebody while still docked. I reproduced this with retail, so it's not a bug in
|
||||
// my new docking code. :)
|
||||
int aigoal_ai_goal_find_empty_slot( ai_goal *goals, int active_goal )
|
||||
int ai_goal_find_empty_slot( ai_goal *goals, int active_goal )
|
||||
{
|
||||
int gindex, oldest_index;
|
||||
|
||||
@@ -1554,7 +1389,7 @@ int aigoal_ai_goal_find_empty_slot( ai_goal *goals, int active_goal )
|
||||
// is issued to ship or wing (from player), mode is AI_GOAL_*. submode is the submode the
|
||||
// ship should go into. shipname is the object of the action. aip is the ai_info pointer
|
||||
// of the ship receiving the order
|
||||
void aigoal_ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip )
|
||||
void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip )
|
||||
{
|
||||
int empty_index;
|
||||
ai_goal *aigp;
|
||||
@@ -1580,7 +1415,7 @@ void aigoal_ai_add_ship_goal_player( int type, int mode, int submode, char *ship
|
||||
|
||||
// adds a goal from the player to the given wing (which in turn will add it to the proper
|
||||
// ships in the wing
|
||||
void aigoal_ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, int wingnum )
|
||||
void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, int wingnum )
|
||||
{
|
||||
int i, empty_index;
|
||||
wing *wingp = &Wings[wingnum];
|
||||
@@ -1604,7 +1439,7 @@ void aigoal_ai_add_wing_goal_player( int type, int mode, int submode, char *ship
|
||||
|
||||
|
||||
// common routine to add a sexpression mission goal to the appropriate goal structure.
|
||||
void aigoal_ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
|
||||
void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
|
||||
{
|
||||
int node, dummy, op;
|
||||
char *text;
|
||||
@@ -1795,7 +1630,7 @@ void aigoal_ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor
|
||||
|
||||
// adds an ai goal for an individual ship
|
||||
// type determines who has issues this ship a goal (i.e. the player/mission event/etc)
|
||||
void aigoal_ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip )
|
||||
void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip )
|
||||
{
|
||||
int gindex;
|
||||
|
||||
@@ -1804,7 +1639,7 @@ void aigoal_ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip )
|
||||
}
|
||||
|
||||
// code to add ai goals to wings.
|
||||
void aigoal_ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
|
||||
void ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
|
||||
{
|
||||
int i;
|
||||
wing *wingp = &Wings[wingnum];
|
||||
@@ -1838,7 +1673,7 @@ void aigoal_ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
|
||||
// this name can be a shipname or a wingname)
|
||||
// docker_point and dockee_point are used for the AI_GOAL_DOCK command to tell two ships where to dock
|
||||
// immediate means to process this order right away
|
||||
void aigoal_ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate )
|
||||
void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate )
|
||||
{
|
||||
int gindex;
|
||||
ai_goal *aigp;
|
||||
@@ -1918,7 +1753,7 @@ void aigoal_ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name,
|
||||
// across waves of the wing so we merely need to add the goal to each ship in the wing. Certain
|
||||
// goal are simply not valid for wings (like dock, undock). Immediate parameter gets passed to add_ship_goal
|
||||
// to say whether or not we should process this goal right away
|
||||
void aigoal_ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate )
|
||||
void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1934,7 +1769,7 @@ void aigoal_ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, i
|
||||
}
|
||||
|
||||
// this function copies goals from a wing to an ai_info * from a ship.
|
||||
void aigoal_ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip )
|
||||
void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip )
|
||||
{
|
||||
int j;
|
||||
|
||||
@@ -1955,7 +1790,7 @@ void aigoal_ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip )
|
||||
// function to determine if an ai goal is achieveable or not. Will return
|
||||
// one of the AI_GOAL_* values. Also determines is a goal was successful.
|
||||
|
||||
int aigoal_ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
{
|
||||
int status;
|
||||
char *ai_shipname;
|
||||
@@ -2434,7 +2269,7 @@ int aigoal_ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
|
||||
// Compare function for sorting ai_goals based on priority.
|
||||
// Return values set to sort array in _decreasing_ order.
|
||||
int aigoal_ai_goal_priority_compare(const void *a, const void *b)
|
||||
int ai_goal_priority_compare(const void *a, const void *b)
|
||||
{
|
||||
ai_goal *ga, *gb;
|
||||
|
||||
@@ -2483,7 +2318,7 @@ int aigoal_ai_goal_priority_compare(const void *a, const void *b)
|
||||
// Then sort on time for goals of equivalent priority.
|
||||
// objnum The object number to act upon. Redundant with *aip.
|
||||
// *aip The AI info to act upon. Goals are stored at aip->goals
|
||||
void aigoal_prioritize_goals(int objnum, ai_info *aip)
|
||||
void prioritize_goals(int objnum, ai_info *aip)
|
||||
{
|
||||
// First sort based on priority field.
|
||||
insertion_sort(aip->goals, MAX_AI_GOALS, sizeof(ai_goal), ai_goal_priority_compare);
|
||||
@@ -2493,7 +2328,7 @@ void aigoal_prioritize_goals(int objnum, ai_info *aip)
|
||||
// Remove obsolete goals.
|
||||
// objnum Object of interest. Redundant with *aip.
|
||||
// *aip contains goals at aip->goals.
|
||||
void aigoal_validate_mission_goals(int objnum, ai_info *aip)
|
||||
void validate_mission_goals(int objnum, ai_info *aip)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -2568,7 +2403,7 @@ extern char *Mode_text[MAX_AI_BEHAVIORS];
|
||||
// code to process ai "orders". Orders include those determined from the mission file and those
|
||||
// given by the player to a ship that is under his control. This function gets called for every
|
||||
// AI object every N seconds through the ai loop.
|
||||
void aigoal_ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
{
|
||||
object *objp = &Objects[objnum];
|
||||
object *other_obj;
|
||||
@@ -2889,7 +2724,7 @@ void aigoal_ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
|
||||
}
|
||||
|
||||
void aigoal_ai_update_goal_references(ai_goal *goals, int type, char *old_name, char *new_name)
|
||||
void ai_update_goal_references(ai_goal *goals, int type, char *old_name, char *new_name)
|
||||
{
|
||||
int i, mode, flag, dummy;
|
||||
|
||||
@@ -2956,7 +2791,7 @@ void aigoal_ai_update_goal_references(ai_goal *goals, int type, char *old_name,
|
||||
}
|
||||
}
|
||||
|
||||
int aigoal_query_referenced_in_ai_goals(ai_goal *goals, int type, char *name)
|
||||
int query_referenced_in_ai_goals(ai_goal *goals, int type, char *name)
|
||||
{
|
||||
int i, mode, flag;
|
||||
|
||||
@@ -3021,7 +2856,7 @@ int aigoal_query_referenced_in_ai_goals(ai_goal *goals, int type, char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *aigoal_ai_add_dock_name(char *str)
|
||||
char *ai_add_dock_name(char *str)
|
||||
{
|
||||
char *ptr;
|
||||
int i;
|
||||
@@ -3036,39 +2871,3 @@ char *aigoal_ai_add_dock_name(char *str)
|
||||
strcpy(ptr, str);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
struct aigoal_call_table AIGoalDefaultTable = {
|
||||
aigoal_Ai_goal_text,
|
||||
aigoal_ai_maybe_add_form_goal,
|
||||
aigoal_ai_post_process_mission,
|
||||
aigoal_ai_query_goal_valid,
|
||||
aigoal_ai_remove_ship_goal,
|
||||
aigoal_ai_clear_ship_goals,
|
||||
aigoal_ai_clear_wing_goals,
|
||||
aigoal_ai_mission_wing_goal_complete,
|
||||
aigoal_ai_mission_goal_complete,
|
||||
aigoal_ai_get_subsystem_type,
|
||||
aigoal_ai_goal_purge_invalid_goals,
|
||||
aigoal_ai_goal_purge_all_invalid_goals,
|
||||
aigoal_ai_goal_find_dockpoint,
|
||||
aigoal_ai_goal_fixup_dockpoints,
|
||||
aigoal_ai_add_goal_sub_player,
|
||||
aigoal_ai_goal_find_empty_slot,
|
||||
aigoal_ai_add_ship_goal_player,
|
||||
aigoal_ai_add_wing_goal_player,
|
||||
aigoal_ai_add_goal_sub_sexp,
|
||||
aigoal_ai_add_ship_goal_sexp,
|
||||
aigoal_ai_add_wing_goal_sexp,
|
||||
aigoal_ai_add_goal_ship_internal,
|
||||
aigoal_ai_add_goal_wing_internal,
|
||||
aigoal_ai_copy_mission_wing_goal,
|
||||
aigoal_ai_mission_goal_achievable,
|
||||
aigoal_ai_goal_priority_compare,
|
||||
aigoal_prioritize_goals,
|
||||
aigoal_validate_mission_goals,
|
||||
aigoal_ai_process_mission_orders,
|
||||
aigoal_ai_update_goal_references,
|
||||
aigoal_query_referenced_in_ai_goals,
|
||||
aigoal_ai_add_dock_name
|
||||
};
|
||||
@@ -292,48 +292,4 @@ extern int ai_query_goal_valid( int ship, int ai_goal );
|
||||
extern void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate = 1 );
|
||||
extern void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate = 1 );
|
||||
|
||||
// AI Goal Table Wrapper
|
||||
struct aigoal_call_table
|
||||
{
|
||||
char* (*Ai_goal_text) (int goal);
|
||||
void (*ai_maybe_add_form_goal) (wing *wingp);
|
||||
void (*ai_post_process_mission) ();
|
||||
int (*ai_query_goal_valid) (int ship, int ai_goal);
|
||||
void (*ai_remove_ship_goal) (ai_info *aip, int index);
|
||||
void (*ai_clear_ship_goals) (ai_info *aip);
|
||||
void (*ai_clear_wing_goals) (int wingnum);
|
||||
void (*ai_mission_wing_goal_complete) (int wingnum, ai_goal *remove_goalp);
|
||||
void (*ai_mission_goal_complete) (ai_info *aip);
|
||||
int (*ai_get_subsystem_type) (char *subsystem);
|
||||
void (*ai_goal_purge_invalid_goals) (ai_goal *aigp, ai_goal *goal_list);
|
||||
void (*ai_goal_purge_all_invalid_goals) (ai_goal *aigp);
|
||||
int (*ai_goal_find_dockpoint) (int shipnum, int dock_type);
|
||||
void (*ai_goal_fixup_dockpoints) (ai_info *aip, ai_goal *aigp);
|
||||
void (*ai_add_goal_sub_player) (int type, int mode, int submode, char *shipname, ai_goal *aigp);
|
||||
int (*ai_goal_find_empty_slot) (ai_goal *goals, int active_goal);
|
||||
void (*ai_add_ship_goal_player) (int type, int mode, int submode, char *shipname, ai_info *aip);
|
||||
void (*ai_add_wing_goal_player) (int type, int mode, int submode, char *shipname, int wingnum);
|
||||
void (*ai_add_goal_sub_sexp) (int sexp, int type, ai_goal *aigp, char *actor_name);
|
||||
void (*ai_add_ship_goal_sexp) (int sexp, int type, ai_info *aip);
|
||||
void (*ai_add_wing_goal_sexp) (int sexp, int type, int wingnum);
|
||||
void (*ai_add_goal_ship_internal) (ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate);
|
||||
void (*ai_add_goal_wing_internal) (wing *wingp, int goal_type, char *name, int immediate);
|
||||
void (*ai_copy_mission_wing_goal) (ai_goal *aigp, ai_info *aip);
|
||||
int (*ai_mission_goal_achievable) (int objnum, ai_goal *aigp);
|
||||
int (*ai_goal_priority_compare) (const void *a, const void *b);
|
||||
void (*prioritize_goals) (int objnum, ai_info *aip);
|
||||
void (*validate_mission_goals) (int objnum, ai_info *aip);
|
||||
void (*ai_process_mission_orders) (int objnum, ai_info *aip);
|
||||
void (*ai_update_goal_references) (ai_goal *goals, int type, char *old_name, char *new_name);
|
||||
int (*query_referenced_in_ai_goals) (ai_goal *goals, int type, char *name);
|
||||
char* (*ai_add_dock_name) (char *str);
|
||||
};
|
||||
|
||||
// Set new pointer to override ai_goal* function calls
|
||||
// possibly copying the old function calls first
|
||||
|
||||
extern struct aigoal_call_table *aigoal_table;
|
||||
|
||||
extern struct aigoal_call_table AIGoalDefaultTable;
|
||||
|
||||
#endif
|
||||
@@ -10,22 +10,6 @@
|
||||
#ifndef _AIINTERNAL_H
|
||||
#define _AIINTERNAL_H
|
||||
|
||||
#include "weapon/weapon.h"
|
||||
#include "weapon/swarm.h"
|
||||
#include "object/objectdock.h"
|
||||
|
||||
typedef struct eval_nearest_objnum {
|
||||
int objnum;
|
||||
object *trial_objp;
|
||||
int enemy_team_mask;
|
||||
int enemy_wing;
|
||||
float range;
|
||||
int max_attackers;
|
||||
int nearest_objnum;
|
||||
float nearest_dist;
|
||||
int check_danger_weapon_objnum;
|
||||
} eval_nearest_objnum;
|
||||
|
||||
//Returns true if the specified object is a stealth ship, false if not
|
||||
bool is_object_stealth_ship(object* objp);
|
||||
|
||||
@@ -44,243 +28,4 @@ int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip);
|
||||
//Does all the stuff needed to aim and fire a turret.
|
||||
void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum);
|
||||
|
||||
// AI Turret Table Wrapper
|
||||
|
||||
struct eval_enemy_obj_struct;
|
||||
|
||||
struct aiturret_call_table
|
||||
{
|
||||
int (*turret_select_best_weapon) (ship_subsys *turret, object *target);
|
||||
int (*valid_turret_enemy) (object *objp, object *turret_parent);
|
||||
void (*evaluate_obj_as_target) (object *objp, eval_enemy_obj_struct *eeo);
|
||||
int (*get_nearest_turret_objnum) (int turret_parent_objnum, ship_subsys *turret_subsys, int enemy_team_mask, vec3d *tpos, vec3d *tvec, int current_enemy, bool big_only_flag, bool small_only_flag, bool tagged_only_flag, bool beam_flag);
|
||||
int (*find_turret_enemy) (ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d *tvec, int current_enemy, float fov);
|
||||
int (*turret_should_pick_new_target) (ship_subsys *turret);
|
||||
void (*turret_set_next_fire_timestamp) (int weapon_num, weapon_info *wip, ship_subsys *turret, ai_info *aip);
|
||||
int (*turret_should_fire_aspect) (ship_subsys *turret, float dot, weapon_info *wip);
|
||||
bool (*turret_fire_weapon) (int weapon_num, ship_subsys *turret, int parent_objnum, vec3d *turret_pos, vec3d *turret_fvec, vec3d *predicted_pos, float flak_range_override);
|
||||
void (*turret_swarm_fire_from_turret) (turret_swarm_info *tsi);
|
||||
void (*ai_fire_from_turret) (ship *shipp, ship_subsys *ss, int parent_objnum);
|
||||
};
|
||||
|
||||
// Set new pointer to override ai_goal* function calls
|
||||
// possibly copying the old function calls first
|
||||
|
||||
extern struct aiturret_call_table *aiturret_table;
|
||||
|
||||
extern struct aiturret_call_table AITurretDefaultTable;
|
||||
|
||||
// AI Code Table Wrapper
|
||||
struct aicode_call_table
|
||||
{
|
||||
void (*ai_set_rearm_status) (int team, int time);
|
||||
int (*ai_good_time_to_rearm) (object *objp);
|
||||
void (*ai_good_secondary_time) (int team, int weapon_index, int max_fire_count, char *shipname);
|
||||
int (*is_preferred_weapon) (int weapon_num, object *firer_objp, object *target_objp);
|
||||
void (*ai_init_secondary_info) ();
|
||||
void (*free_ai_stuff) ();
|
||||
void (*parse_ai_class) ();
|
||||
void (*reset_ai_class_names) ();
|
||||
void (*parse_aitbl) ();
|
||||
void (*ai_init) ();
|
||||
void (*ai_level_init) ();
|
||||
int (*ai_is_stealth_visible) (object *viewer_objp, object *stealth_objp);
|
||||
void (*update_ai_stealth_info_with_error) (ai_info *aip);
|
||||
void (*ai_update_danger_weapon) (int attacked_objnum, int weapon_objnum);
|
||||
void (*ai_turn_towards_vector) (vec3d *dest, object *objp, float frametime, float turn_time, vec3d *slide_vec, vec3d *rel_pos, float bank_override, int flags, vec3d *rvec, int sexp_flags);
|
||||
void (*init_ship_info) ();
|
||||
int (*set_target_objnum) (ai_info *aip, int objnum);
|
||||
ship_subsys* (*set_targeted_subsys) (ai_info *aip, ship_subsys *new_subsys, int parent_objnum);
|
||||
void (*ai_object_init) (object *obj, int ai_index);
|
||||
void (*adjust_accel_for_docking) (ai_info *aip);
|
||||
void (*accelerate_ship) (ai_info *aip, float accel);
|
||||
void (*change_acceleration) (ai_info *aip, float delta_accel);
|
||||
void (*set_accel_for_target_speed) (object *objp, float tspeed);
|
||||
void (*turn_towards_point) (object *objp, vec3d *point, vec3d *slide_vec, float bank_override);
|
||||
void (*turn_away_from_point) (object *objp, vec3d *point, float bank_override);
|
||||
float (*turn_towards_tangent) (object *objp, vec3d *point, float radius);
|
||||
float (*turn_toward_tangent_with_axis) (object *objp, object *center_objp, float radius);
|
||||
int (*object_is_targetable) (object *target, ship *viewer);
|
||||
int (*num_enemies_attacking) (int objnum);
|
||||
float (*get_wing_lowest_max_speed) (object *objp);
|
||||
int (*is_ignore_object_sub) (int *ignore_objnum, int *ignore_signature, int objnum);
|
||||
int (*find_ignore_new_object_index) (ai_info *aip, int objnum);
|
||||
int (*is_ignore_object) (ai_info *aip, int objnum, int just_the_original=0);
|
||||
int (*get_nearest_bbox_point) (object *ship_obj, vec3d *start, vec3d *box_pt);
|
||||
void (*evaluate_object_as_nearest_objnum) (eval_nearest_objnum *eno);
|
||||
int (*get_nearest_objnum) (int objnum, int enemy_team_mask, int enemy_wing, float range, int max_attackers);
|
||||
int (*find_nearby_threat) (int objnum, int enemy_team_mask, float range, int *count);
|
||||
int (*num_turrets_attacking) (object *turret_parent, int target_objnum);
|
||||
int (*get_enemy_timestamp) ();
|
||||
int (*find_enemy) (int objnum, float range, int max_attackers);
|
||||
void (*ai_set_goal_maybe_abort_dock) (object *objp, ai_info *aip);
|
||||
void (*force_avoid_player_check) (object *objp, ai_info *aip);
|
||||
void (*ai_attack_object) (object *attacker, object *attacked, int priority, ship_subsys *ssp);
|
||||
void (*ai_attack_wing) (object *attacker, int wingnum, int priority);
|
||||
void (*ai_evade_object) (object *evader, object *evaded, int priority);
|
||||
int (*compact_ignore_new_objects) (ai_info *aip, int force=0);
|
||||
void (*ai_ignore_object) (object *ignorer, object *ignored, int priority, int ignore_new);
|
||||
void (*ai_ignore_wing) (object *ignorer, int wingnum, int priority);
|
||||
void (*create_model_path) (object *pl_objp, object *mobjp, int path_num, int subsys_path);
|
||||
void (*create_model_exit_path) (object *pl_objp, object *mobjp, int path_num, int count);
|
||||
void (*ai_find_path) (object *pl_objp, int objnum, int path_num, int exit_flag, int subsys_path);
|
||||
int (*maybe_avoid_player) (object *objp, vec3d *goal_pos);
|
||||
void (*ai_stay_still) (object *still_objp, vec3d *view_pos);
|
||||
void (*ai_do_objects_docked_stuff) (object *docker, int docker_point, object *dockee, int dockee_point);
|
||||
void (*ai_do_objects_undocked_stuff) (object *docker, object *dockee);
|
||||
void (*ai_dock_with_object) (object *docker, int docker_index, object *dockee, int dockee_index, int priority, int dock_type);
|
||||
void (*ai_start_fly_to_ship) (object *objp, int shipnum);
|
||||
void (*ai_start_waypoints) (object *objp, int waypoint_list_index, int wp_flags);
|
||||
void (*ai_do_stay_near) (object *objp, object *other_objp, float dist);
|
||||
void (*ai_do_safety) (object *objp);
|
||||
void (*ai_form_on_wing) (object *objp, object *goal_objp);
|
||||
int (*ai_formation_object_get_slotnum) (int objnum, object *objp);
|
||||
float (*compute_time_to_enemy) (float dist_to_enemy, object *pobjp, object *eobjp);
|
||||
void (*ai_set_positions) (object *pl_objp, object *en_objp, ai_info *aip, vec3d *player_pos, vec3d *enemy_pos);
|
||||
float (*maybe_recreate_path) (object *objp, ai_info *aip, int force_recreate_flag, int override_hash=0);
|
||||
void (*set_accel_for_docking) (object *objp, ai_info *aip, float dot, float dot_to_next, float dist_to_next, float dist_to_goal, ship_info *sip);
|
||||
float (*ai_path) ();
|
||||
void (*ai_safety_pick_spot) (object *objp);
|
||||
float (*ai_safety_goto_spot) (object *objp);
|
||||
void (*ai_safety_circle_spot) (object *objp);
|
||||
void (*ai_safety) ();
|
||||
void (*ai_fly_to_ship) ();
|
||||
void (*ai_waypoints) ();
|
||||
void (*avoid_ship) ();
|
||||
int (*maybe_resume_previous_mode) (object *objp, ai_info *aip);
|
||||
int (*ai_maybe_fire_afterburner) (object *objp, ai_info *aip);
|
||||
void (*maybe_afterburner_after_ship_hit) (object *objp, ai_info *aip, object *en_objp);
|
||||
int (*is_instructor) (object *objp);
|
||||
void (*evade_weapon) ();
|
||||
void (*slide_face_ship) ();
|
||||
void (*evade_ship) ();
|
||||
void (*ai_evade) ();
|
||||
int (*ai_select_primary_weapon_OLD) (object *objp, object *other_objp, int flags);
|
||||
int (*ai_select_primary_weapon) (object *objp, object *other_objp, int flags);
|
||||
void (*set_primary_weapon_linkage) (object *objp);
|
||||
int (*ai_fire_primary_weapon) (object *objp);
|
||||
void (*ai_select_secondary_weapon) (object *objp, ship_weapon *swp, int priority1=-1, int priority2=-1);
|
||||
void (*ai_maybe_announce_shockwave_weapon) (object *firing_objp, int weapon_index);
|
||||
int (*check_ok_to_fire) (int objnum, int target_objnum, weapon_info *wip);
|
||||
int (*ai_fire_secondary_weapon) (object *objp, int priority1, int priority2);
|
||||
void (*set_predicted_enemy_pos_turret) (vec3d *predicted_enemy_pos, vec3d *gun_pos, object *pobjp, vec3d *enemy_pos, vec3d *enemy_vel, float weapon_speed, float time_enemy_in_range);
|
||||
void (*set_predicted_enemy_pos) (vec3d *predicted_enemy_pos, object *pobjp, object *eobjp, ai_info *aip);
|
||||
void (*ai_chase_ct) ();
|
||||
void (*ai_chase_eb) (ai_info *aip, ship_info *sip, vec3d *predicted_enemy_pos, float dist_to_enemy);
|
||||
float (*ai_endangered_time) (object *ship_objp, object *weapon_objp);
|
||||
float (*ai_endangered_by_weapon) (ai_info *aip);
|
||||
int (*ai_near_full_strength) (object *objp);
|
||||
void (*attack_set_accel) (ai_info *aip, float dist_to_enemy, float dot_to_enemy, float dot_from_enemy);
|
||||
void (*get_behind_ship) (ai_info *aip, ship_info *sip, float dist_to_enemy);
|
||||
int (*avoid_player) (object *objp, vec3d *goal_pos);
|
||||
int (*maybe_avoid_big_ship) (object *objp, object *ignore_objp, ai_info *aip, vec3d *goal_point, float delta_time);
|
||||
void (*ai_stealth_find) ();
|
||||
void (*ai_stealth_sweep) ();
|
||||
void (*ai_chase_attack) (ai_info *aip, ship_info *sip, vec3d *predicted_enemy_pos, float dist_to_enemy, int modelnum);
|
||||
void (*ai_chase_es) (ai_info *aip, ship_info *sip);
|
||||
void (*ai_chase_ga) (ai_info *aip, ship_info *sip);
|
||||
int (*ai_set_attack_subsystem) (object *objp, int subnum);
|
||||
void (*ai_set_guard_vec) (object *objp, object *guard_objp);
|
||||
void (*ai_set_guard_wing) (object *objp, int wingnum);
|
||||
void (*ai_set_evade_object) (object *objp, object *other_objp);
|
||||
void (*ai_set_guard_object) (object *objp, object *other_objp);
|
||||
void (*update_aspect_lock_information) (ai_info *aip, vec3d *vec_to_enemy, float dist_to_enemy, float enemy_radius);
|
||||
void (*ai_chase_fly_away) (object *objp, ai_info *aip);
|
||||
int (*has_preferred_secondary) (object *objp, object *en_objp, ship_weapon *swp);
|
||||
void (*ai_choose_secondary_weapon) (object *objp, ai_info *aip, object *en_objp);
|
||||
float (*set_secondary_fire_delay) (ai_info *aip, ship *shipp, weapon_info *swip);
|
||||
void (*ai_chase_big_approach_set_goal) (vec3d *goal_pos, object *attack_objp, object *target_objp, float *accel);
|
||||
void (*ai_chase_big_circle_set_goal) (vec3d *goal_pos, object *attack_objp, object *target_objp, float *accel);
|
||||
void (*ai_chase_big_get_separations) (object *attack_objp, object *target_objp, vec3d *horz_vec_to_target, float *desired_separation, float *cur_separation);
|
||||
void (*ai_chase_big_parallel_set_goal) (vec3d *goal_pos, object *attack_objp, object *target_objp, float *accel);
|
||||
void (*ai_cruiser_chase_set_goal_pos) (vec3d *goal_pos, object *pl_objp, object *en_objp);
|
||||
int (*maybe_hack_cruiser_chase_abort) ();
|
||||
void (*ai_cruiser_chase) ();
|
||||
void (*ai_chase) ();
|
||||
int (*num_ships_attacking) (int target_objnum);
|
||||
void (*remove_farthest_attacker) (int objnum);
|
||||
int (*ai_maybe_limit_attackers) (int attacked_objnum);
|
||||
void (*guard_object_was_hit) (object *guard_objp, object *hitter_objp);
|
||||
void (*maybe_update_guard_object) (object *hit_objp, object *hitter_objp);
|
||||
int (*ai_guard_find_nearby_bomb) (object *guarding_objp, object *guarded_objp);
|
||||
void (*ai_guard_find_nearby_ship) (object *guarding_objp, object *guarded_objp);
|
||||
void (*ai_guard_find_nearby_asteroid) (object *guarding_objp, object *guarded_objp);
|
||||
void (*ai_guard_find_nearby_object) ();
|
||||
void (*ai_big_guard) ();
|
||||
void (*ai_guard) ();
|
||||
void (*ai_do_objects_repairing_stuff) (object *repaired_objp, object *repair_objp, int how);
|
||||
void (*ai_cleanup_dock_mode_subjective) (object *objp);
|
||||
void (*ai_cleanup_dock_mode_objective) (object *objp);
|
||||
void (*ai_cleanup_rearm_mode) (object *objp);
|
||||
void (*ai_still) ();
|
||||
void (*ai_stay_near) ();
|
||||
int (*maybe_dock_obstructed) (object *cur_objp, object *goal_objp, int big_only_flag);
|
||||
void (*ai_dock) ();
|
||||
void (*process_subobjects) (int objnum);
|
||||
void (*ai_fly_in_formation) (int wingnum);
|
||||
void (*ai_disband_formation) (int wingnum);
|
||||
int (*formation_is_leader_chaotic) (object *objp);
|
||||
void (*ai_most_massive_object_of_its_wing_of_all_docked_objects_helper) (object *objp, dock_function_info *infop);
|
||||
int (*ai_formation) ();
|
||||
void (*ai_do_repair_frame) (object *objp, ai_info *aip, float frametime);
|
||||
void (*call_doa) (object *child, object *parent);
|
||||
void (*ai_maybe_launch_cmeasure) (object *objp, ai_info *aip);
|
||||
void (*ai_preprocess_ignore_objnum) (object *objp, ai_info *aip);
|
||||
void (*ai_chase_circle) (object *objp);
|
||||
void (*ai_transfer_shield) (object *objp, int quadrant_num);
|
||||
void (*ai_balance_shield) (object *objp);
|
||||
void (*ai_manage_shield) (object *objp, ai_info *aip);
|
||||
void (*ai_maybe_evade_locked_missile) (object *objp, ai_info *aip);
|
||||
void (*maybe_evade_dumbfire_weapon) (ai_info *aip);
|
||||
int (*ai_acquire_emerge_path) (object *pl_objp, int parent_objnum, int allowed_path_mask, vec3d *pos, vec3d *fvec);
|
||||
void (*ai_emerge_bay_path_cleanup) (ai_info *aip);
|
||||
void (*ai_bay_emerge) ();
|
||||
int (*ai_find_closest_depart_path) (ai_info *aip, polymodel *pm, int allowed_path_mask);
|
||||
int (*ai_acquire_depart_path) (object *pl_objp, int parent_objnum, int allowed_path_mask);
|
||||
void (*ai_bay_depart) ();
|
||||
void (*ai_sentrygun) ();
|
||||
void (*ai_execute_behavior) (ai_info *aip);
|
||||
int (*maybe_request_support) (object *objp);
|
||||
void (*ai_set_mode_warp_out) (object *objp, ai_info *aip);
|
||||
void (*ai_maybe_depart) (object *objp);
|
||||
void (*ai_warp_out) (object *objp);
|
||||
void (*ai_announce_ship_dying) (object *dying_objp);
|
||||
int (*aas_1) (object *objp, ai_info *aip, vec3d *safe_pos);
|
||||
int (*ai_avoid_shockwave) (object *objp, ai_info *aip);
|
||||
int (*ai_await_repair_frame) (object *objp, ai_info *aip);
|
||||
void (*ai_maybe_self_destruct) (object *objp, ai_info *aip);
|
||||
int (*ai_need_new_target) (object *pl_objp, int target_objnum);
|
||||
int (*maybe_big_ship_collide_recover_frame) (object *objp, ai_info *aip);
|
||||
void (*validate_mode_submode) (ai_info *aip);
|
||||
void (*ai_frame) (int objnum);
|
||||
void (*ai_process) (object *obj, int ai_index, float frametime);
|
||||
void (*init_ai_object) (int objnum);
|
||||
void (*init_ai_objects) ();
|
||||
void (*init_ai_system) ();
|
||||
void (*ai_set_default_behavior) (object *obj, int classnum);
|
||||
void (*ai_do_default_behavior) (object *obj);
|
||||
void (*process_friendly_hit_message) (int message, object *objp);
|
||||
void (*maybe_process_friendly_hit) (object *objp_hitter, object *objp_hit, object *objp_weapon);
|
||||
void (*maybe_set_dynamic_chase) (ai_info *aip, int hitter_objnum);
|
||||
void (*big_ship_collide_recover_start) (object *objp, object *big_objp, vec3d *collide_pos, vec3d *collision_normal);
|
||||
void (*ai_update_lethality) (object *ship_obj, object *other_obj, float damage);
|
||||
void (*ai_ship_hit) (object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_quadrant, vec3d *hit_normal);
|
||||
void (*ai_ship_destroy) (int shipnum, int method);
|
||||
void (*ai_deathroll_start) (object *dying_objp);
|
||||
int (*ai_abort_rearm_request) (object *requester_objp);
|
||||
void (*ai_add_rearm_goal) (object *requester_objp, object *support_objp);
|
||||
int (*ai_issue_rearm_request) (object *requester_objp);
|
||||
void (*ai_rearm_repair) (object *objp, int docker_index, object *goal_objp, int dockee_index, int priority);
|
||||
void (*cheat_fire_synaptic) (object *objp, ship *shipp, ai_info *aip);
|
||||
void (*maybe_cheat_fire_synaptic) (object *objp, ai_info *aip);
|
||||
};
|
||||
|
||||
|
||||
// Set new pointer to override ai_code* function calls
|
||||
// possibly copying the old function calls first
|
||||
|
||||
extern struct aicode_call_table *aicode_table;
|
||||
|
||||
extern struct aicode_call_table AICodeDefaultTable;
|
||||
|
||||
#endif
|
||||
@@ -1,185 +0,0 @@
|
||||
/**
|
||||
* @file aimodular.cpp
|
||||
* @brief Modular loading of new AI code based on name in AI Profile.
|
||||
*
|
||||
* The ai_module_init function should be called by ai_init.
|
||||
*
|
||||
* @author Fabian Franz <[email protected]>
|
||||
*
|
||||
*/
|
||||
#include "ai/aibig.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "ai/aiinternal.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <Windows.h>
|
||||
/** @brief Wrapper for the dlopen functions for Windows */
|
||||
#define dlopen(x,y) ((x==NULL)?GetModuleHandle(x):LoadLibrary(x))
|
||||
#define dlsym GetProcAddress
|
||||
#define dlclose FreeLibrary
|
||||
static HINSTANCE handle = NULL; /**< @brief Handle for the loaded library */
|
||||
|
||||
#else
|
||||
|
||||
#include <dlfcn.h>
|
||||
static void* handle = NULL; /**< @brief Handle for the loaded library */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @brief ai_module_init_function prototype */
|
||||
typedef void (*ai_module_init_function)(void);
|
||||
|
||||
void ai_module_dlclose(void);
|
||||
|
||||
/**
|
||||
* @brief Fallback function to load new AI from same process image.
|
||||
*
|
||||
* This function is used if no dynamic library with the name can be found
|
||||
* or it does not contain the correct symbol.
|
||||
*
|
||||
* @param func_name The symbol to look for in handle
|
||||
* @return Returns 0 on success and -1,-2 on errors
|
||||
*
|
||||
*/
|
||||
int ai_module_dlopen_process(char* func_name)
|
||||
{
|
||||
ai_module_init_function ai_module_init_func;
|
||||
|
||||
// Maybe close handle first
|
||||
ai_module_dlclose();
|
||||
|
||||
handle = dlopen(NULL, RTLD_NOW);
|
||||
|
||||
if (handle == NULL)
|
||||
return -1;
|
||||
|
||||
ai_module_init_func=(ai_module_init_function)dlsym(handle, func_name);
|
||||
|
||||
#ifdef _WIN32
|
||||
// Under WIN32 GetModuleHandle is not
|
||||
// incrementing the reference counter
|
||||
// so we need to "free" the handle directly
|
||||
|
||||
handle=NULL;
|
||||
#endif
|
||||
|
||||
if (ai_module_init_func == NULL)
|
||||
return -2;
|
||||
|
||||
ai_module_init_func();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Loads new AI from dynamic library
|
||||
*
|
||||
* This function looks for dllname.dll or dllname.so
|
||||
* tries to load it into memory and if it finds the
|
||||
* dllname_ai_module_init function it starts it.
|
||||
*
|
||||
* If it does not find the library or symbol it falls
|
||||
* back to ai_module_dlopen_process.
|
||||
*
|
||||
* @param dllname The name of the library to load
|
||||
* @return Returns 0 on success and -1,-2 on errors
|
||||
*
|
||||
*/
|
||||
|
||||
int ai_module_dlopen(char* dllname)
|
||||
{
|
||||
char buf[PATH_MAX+1];
|
||||
char init_func_name[PATH_MAX+1];
|
||||
ai_module_init_function ai_module_init_func;
|
||||
|
||||
#ifdef _WIN32
|
||||
snprintf(buf, PATH_MAX, "%s.dll", dllname);
|
||||
#else
|
||||
snprintf(buf, PATH_MAX, "%s.so", dllname);
|
||||
#endif
|
||||
snprintf(init_func_name, PATH_MAX, "%s_ai_module_init", dllname);
|
||||
|
||||
handle = dlopen(buf, RTLD_NOW);
|
||||
|
||||
if (handle == NULL)
|
||||
return ai_module_dlopen_process(init_func_name);
|
||||
|
||||
ai_module_init_func=(ai_module_init_function)dlsym(handle, init_func_name);
|
||||
|
||||
if (ai_module_init_func == NULL)
|
||||
return ai_module_dlopen_process(init_func_name);
|
||||
|
||||
ai_module_init_func();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Closes the library handle
|
||||
*
|
||||
* This function closes the library handle.
|
||||
*
|
||||
*/
|
||||
void ai_module_dlclose(void)
|
||||
{
|
||||
if (handle != NULL)
|
||||
{
|
||||
dlclose(handle);
|
||||
handle=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inits or resets the AI code tables
|
||||
*
|
||||
* This function first resets the AI code tables,
|
||||
* then closes any open libraries from before.
|
||||
*
|
||||
* Then it ooks if the ai_module is not "retail"
|
||||
* and if that is the case it loads a library with this name.
|
||||
*
|
||||
*/
|
||||
void ai_module_init(void)
|
||||
{
|
||||
// First Reset values
|
||||
aibig_table = &AIBigDefaultTable;
|
||||
aicode_table = &AICodeDefaultTable;
|
||||
aigoal_table = &AIGoalDefaultTable;
|
||||
aiturret_table = &AITurretDefaultTable;
|
||||
|
||||
ai_module_dlclose();
|
||||
|
||||
if (The_mission.ai_profile == NULL)
|
||||
return;
|
||||
|
||||
if (strncmp(The_mission.ai_profile->ai_module, "retail", 6) != 0)
|
||||
{
|
||||
if (ai_module_dlopen(The_mission.ai_profile->ai_module) != 0)
|
||||
{
|
||||
char err[1024];
|
||||
|
||||
snprintf(err, sizeof(err), "AI_module_init(%s) failed: %s\n", The_mission.ai_profile->ai_module, dlerror());
|
||||
|
||||
mprintf(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void newai_ai_module_init(void);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Dummy function
|
||||
*
|
||||
* This dummy functions calls all AI implementations
|
||||
* that should be statically included.
|
||||
*
|
||||
*/
|
||||
void ai_module_dummy()
|
||||
{
|
||||
newai_ai_module_init();
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef _AIMODULAR_H
|
||||
#define _AIMODULAR_H
|
||||
|
||||
void ai_module_init(void);
|
||||
|
||||
#endif
|
||||
@@ -65,7 +65,7 @@
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.31 2006/01/13 03:30:59 Goober5000
|
||||
* übercommit of custom IFF stuff :)
|
||||
* �bercommit of custom IFF stuff :)
|
||||
*
|
||||
* Revision 1.30 2006/01/11 21:15:15 wmcoolmon
|
||||
* Somewhat better turret comments
|
||||
@@ -233,69 +233,6 @@ typedef struct eval_enemy_obj_struct {
|
||||
int nearest_objnum;
|
||||
} eval_enemy_obj_struct;
|
||||
|
||||
// FF 17-06-07
|
||||
// AI Turret Table Wrapper
|
||||
|
||||
struct aiturret_call_table *aiturret_table = &AITurretDefaultTable;
|
||||
|
||||
int turret_select_best_weapon (ship_subsys *turret, object *target)
|
||||
{
|
||||
return aiturret_table->turret_select_best_weapon(turret, target);
|
||||
}
|
||||
|
||||
int valid_turret_enemy (object *objp, object *turret_parent)
|
||||
{
|
||||
return aiturret_table->valid_turret_enemy(objp, turret_parent);
|
||||
}
|
||||
|
||||
void evaluate_obj_as_target (object *objp, eval_enemy_obj_struct *eeo)
|
||||
{
|
||||
aiturret_table->evaluate_obj_as_target(objp, eeo);
|
||||
}
|
||||
|
||||
int get_nearest_turret_objnum (int turret_parent_objnum, ship_subsys *turret_subsys, int enemy_team_mask, vec3d *tpos, vec3d *tvec, int current_enemy, bool big_only_flag, bool small_only_flag, bool tagged_only_flag, bool beam_flag)
|
||||
{
|
||||
return aiturret_table->get_nearest_turret_objnum(turret_parent_objnum, turret_subsys, enemy_team_mask, tpos, tvec, current_enemy, big_only_flag, small_only_flag, tagged_only_flag, beam_flag);
|
||||
}
|
||||
|
||||
int find_turret_enemy (ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d *tvec, int current_enemy, float fov)
|
||||
{
|
||||
return aiturret_table->find_turret_enemy(turret_subsys, objnum, tpos, tvec, current_enemy, fov);
|
||||
}
|
||||
|
||||
int turret_should_pick_new_target (ship_subsys *turret)
|
||||
{
|
||||
return aiturret_table->turret_should_pick_new_target(turret);
|
||||
}
|
||||
|
||||
void turret_set_next_fire_timestamp (int weapon_num, weapon_info *wip, ship_subsys *turret, ai_info *aip)
|
||||
{
|
||||
aiturret_table->turret_set_next_fire_timestamp(weapon_num, wip, turret, aip);
|
||||
}
|
||||
|
||||
int turret_should_fire_aspect (ship_subsys *turret, float dot, weapon_info *wip)
|
||||
{
|
||||
return aiturret_table->turret_should_fire_aspect(turret, dot, wip);
|
||||
}
|
||||
|
||||
bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum, vec3d *turret_pos, vec3d *turret_fvec, vec3d *predicted_pos = NULL, float flak_range_override = 100.0f)
|
||||
{
|
||||
return aiturret_table->turret_fire_weapon(weapon_num, turret, parent_objnum, turret_pos, turret_fvec, predicted_pos, flak_range_override);
|
||||
}
|
||||
|
||||
void turret_swarm_fire_from_turret (turret_swarm_info *tsi)
|
||||
{
|
||||
aiturret_table->turret_swarm_fire_from_turret(tsi);
|
||||
}
|
||||
|
||||
void ai_fire_from_turret (ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
{
|
||||
aiturret_table->ai_fire_from_turret(shipp, ss, parent_objnum);
|
||||
}
|
||||
|
||||
|
||||
// AI Turret default implementation
|
||||
|
||||
// return 1 if objp is in fov of the specified turret, tp. Otherwise return 0.
|
||||
// dist = distance from turret to center point of object
|
||||
int object_in_turret_fov(object *objp, model_subsystem *tp, vec3d *tvec, vec3d *tpos, float dist)
|
||||
@@ -337,7 +274,7 @@ int bomb_headed_towards_ship(object *bomb_objp, object *ship_objp)
|
||||
//Note that all non-negative return values are expressed in
|
||||
//what I like to call "widx"s.
|
||||
//Returns -1 if unable to find a weapon for the target at all.
|
||||
int aiturret_turret_select_best_weapon(ship_subsys *turret, object *target)
|
||||
int turret_select_best_weapon(ship_subsys *turret, object *target)
|
||||
{
|
||||
//TODO: Fill this out with extraodinary gun-picking algorithms
|
||||
if(turret->weapons.num_primary_banks > 0)
|
||||
@@ -504,7 +441,7 @@ float longest_turret_weapon_range(ship_weapon *swp)
|
||||
// input: objp => object that turret is considering as an enemy
|
||||
// turret_parent => object index for ship that turret sits on
|
||||
// turret => turret pointer
|
||||
int aiturret_valid_turret_enemy(object *objp, object *turret_parent)
|
||||
int valid_turret_enemy(object *objp, object *turret_parent)
|
||||
{
|
||||
if ( objp == turret_parent ) {
|
||||
return 0;
|
||||
@@ -568,7 +505,7 @@ int aiturret_valid_turret_enemy(object *objp, object *turret_parent)
|
||||
}
|
||||
|
||||
extern int Player_attacking_enabled;
|
||||
void aiturret_evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
{
|
||||
object *turret_parent_obj = &Objects[eeo->turret_parent_objnum];
|
||||
ship *shipp;
|
||||
@@ -695,11 +632,7 @@ void aiturret_evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
dist *= (1.0f + 0.1f*num_att_turrets);
|
||||
|
||||
// return if we're over the cap
|
||||
// int max_turrets = 3 + Game_skill_level * Game_skill_level;
|
||||
int max_turrets = The_mission.ai_profile->max_turret_ownage_target[Game_skill_level];
|
||||
if (objp->flags & OF_PLAYER_SHIP) {
|
||||
max_turrets = The_mission.ai_profile->max_turret_ownage_player[Game_skill_level];
|
||||
}
|
||||
int max_turrets = 3 + Game_skill_level * Game_skill_level;
|
||||
if (num_att_turrets > max_turrets) {
|
||||
return;
|
||||
}
|
||||
@@ -779,7 +712,7 @@ int is_target_beam_valid(ship_weapon *swp, object *objp)
|
||||
// tpos => position of turret (world coords)
|
||||
// tvec => forward vector of turret (world coords)
|
||||
// current_enemy => objnum of current turret target
|
||||
int aiturret_get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subsys, int enemy_team_mask, vec3d *tpos, vec3d *tvec, int current_enemy, bool big_only_flag, bool small_only_flag, bool tagged_only_flag, bool beam_flag)
|
||||
int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subsys, int enemy_team_mask, vec3d *tpos, vec3d *tvec, int current_enemy, bool big_only_flag, bool small_only_flag, bool tagged_only_flag, bool beam_flag)
|
||||
{
|
||||
//float weapon_travel_dist;
|
||||
int weapon_system_ok;
|
||||
@@ -920,7 +853,7 @@ DCF_BOOL(use_parent_target, Use_parent_target)
|
||||
// tpos => position of turret (world coords)
|
||||
// tvec => forward vector of turret (world coords)
|
||||
// current_enemy => objnum of current turret target
|
||||
int aiturret_find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d *tvec, int current_enemy, float fov)
|
||||
int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d *tvec, int current_enemy, float fov)
|
||||
{
|
||||
int enemy_team_mask, enemy_objnum;
|
||||
model_subsystem *tp;
|
||||
@@ -1196,7 +1129,7 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en
|
||||
return best_subsysp;
|
||||
|
||||
// Make sure big or huge ship *actually* has subsystems (ie, knossos)
|
||||
if (esip->n_subsystems == 0) {
|
||||
if ( esip->subsystems.empty() ) {
|
||||
return best_subsysp;
|
||||
}
|
||||
|
||||
@@ -1264,7 +1197,7 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en
|
||||
}
|
||||
|
||||
// return !0 if the specified target should scan for a new target, otherwise return 0
|
||||
int aiturret_turret_should_pick_new_target(ship_subsys *turret)
|
||||
int turret_should_pick_new_target(ship_subsys *turret)
|
||||
{
|
||||
// int target_type;
|
||||
|
||||
@@ -1287,7 +1220,7 @@ int aiturret_turret_should_pick_new_target(ship_subsys *turret)
|
||||
}
|
||||
|
||||
// Set the next fire timestamp for a turret, based on weapon type and ai class
|
||||
void aiturret_turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsys *turret, ai_info *aip)
|
||||
void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsys *turret, ai_info *aip)
|
||||
{
|
||||
Assert(weapon_num < MAX_SHIP_WEAPONS);
|
||||
float wait = wip->fire_wait * 1000.0f;
|
||||
@@ -1343,7 +1276,7 @@ void aiturret_turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, s
|
||||
}
|
||||
|
||||
// Decide if a turret should launch an aspect seeking missile
|
||||
int aiturret_turret_should_fire_aspect(ship_subsys *turret, float dot, weapon_info *wip)
|
||||
int turret_should_fire_aspect(ship_subsys *turret, float dot, weapon_info *wip)
|
||||
{
|
||||
if ( (dot > AICODE_TURRET_DUMBFIRE_ANGLE) && (turret->turret_time_enemy_in_range >= MIN(wip->min_lock_time,AICODE_TURRET_MAX_TIME_IN_RANGE)) ) {
|
||||
return 1;
|
||||
@@ -1367,7 +1300,7 @@ void turret_update_enemy_in_range(ship_subsys *turret, float seconds)
|
||||
}
|
||||
|
||||
// Fire a weapon from a turret
|
||||
bool aiturret_turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum, vec3d *turret_pos, vec3d *turret_fvec, vec3d *predicted_pos = NULL, float flak_range_override = 100.0f)
|
||||
bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum, vec3d *turret_pos, vec3d *turret_fvec, vec3d *predicted_pos = NULL, float flak_range_override = 100.0f)
|
||||
{
|
||||
matrix turret_orient;
|
||||
int weapon_objnum;
|
||||
@@ -1418,6 +1351,11 @@ bool aiturret_turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent
|
||||
// fire a beam weapon
|
||||
beam_fire(&fire_info);
|
||||
|
||||
if (parent_ship->cloak_stage == 2) {
|
||||
beam_weapon_info *bip=&wip->b_info;
|
||||
shipfx_start_cloak(parent_ship,bip->beam_warmup + bip->beam_warmdown + (int)(bip->beam_life*1000.0f) + 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// don't fire swam, but set up swarm info instead
|
||||
@@ -1428,14 +1366,12 @@ bool aiturret_turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent
|
||||
}
|
||||
// now do anything else
|
||||
else {
|
||||
for (int i=0; i < wip->shots; i++)
|
||||
{
|
||||
for (int i = 0; i < wip->shots; i++) {
|
||||
weapon_objnum = weapon_create( turret_pos, &turret_orient, turret_weapon_class, parent_objnum, -1, 1);
|
||||
weapon_set_tracking_info(weapon_objnum, parent_objnum, turret->turret_enemy_objnum, 1, turret->targeted_subsys);
|
||||
|
||||
|
||||
objp=&Objects[weapon_objnum];
|
||||
wp=&Weapons[objp->instance];
|
||||
objp = &Objects[weapon_objnum];
|
||||
wp = &Weapons[objp->instance];
|
||||
|
||||
//nprintf(("AI", "Turret_time_enemy_in_range = %7.3f\n", ss->turret_time_enemy_in_range));
|
||||
if (weapon_objnum != -1) {
|
||||
@@ -1444,7 +1380,7 @@ bool aiturret_turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent
|
||||
wp->turret_subsys = turret;
|
||||
|
||||
// if the gun is a flak gun
|
||||
if(wip->wi_flags & WIF_FLAK){
|
||||
if (wip->wi_flags & WIF_FLAK) {
|
||||
// show a muzzle flash
|
||||
flak_muzzle_flash(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, turret_weapon_class);
|
||||
|
||||
@@ -1463,6 +1399,10 @@ bool aiturret_turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent
|
||||
} else if(wip->muzzle_flash > -1) {
|
||||
mflash_create(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, Weapon_info[turret_weapon_class].muzzle_flash);
|
||||
}
|
||||
// otherwise just do mflash if the weapon has it
|
||||
else if (wip->muzzle_flash >= 0) {
|
||||
mflash_create(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, wip->muzzle_flash);
|
||||
}
|
||||
|
||||
// in multiplayer (and the master), then send a turret fired packet.
|
||||
if ( MULTIPLAYER_MASTER && (weapon_objnum != -1) ) {
|
||||
@@ -1484,6 +1424,11 @@ bool aiturret_turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((parent_ship->cloak_stage > 0) && (parent_ship->cloak_stage < 3))
|
||||
{
|
||||
shipfx_start_cloak(parent_ship,500);
|
||||
}
|
||||
}
|
||||
|
||||
// reset any animations if we need to
|
||||
@@ -1502,8 +1447,8 @@ bool aiturret_turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent
|
||||
return true;
|
||||
}
|
||||
|
||||
//void aiturret_turret_swarm_fire_from_turret(ship_subsys *turret, int parent_objnum, int target_objnum, ship_subsys *target_subsys)
|
||||
void aiturret_turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
//void turret_swarm_fire_from_turret(ship_subsys *turret, int parent_objnum, int target_objnum, ship_subsys *target_subsys)
|
||||
void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
{
|
||||
int weapon_objnum;
|
||||
matrix turret_orient;
|
||||
@@ -1542,6 +1487,11 @@ void aiturret_turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
Weapons[Objects[weapon_objnum].instance].turret_subsys = tsi->turret;
|
||||
Weapons[Objects[weapon_objnum].instance].target_num = tsi->turret->turret_enemy_objnum;
|
||||
|
||||
// muzzle flash?
|
||||
if (Weapon_info[tsi->weapon_class].muzzle_flash >= 0) {
|
||||
mflash_create(&turret_pos, &turret_fvec, &Objects[tsi->parent_objnum].phys_info, Weapon_info[tsi->weapon_class].muzzle_flash);
|
||||
}
|
||||
|
||||
// maybe sound
|
||||
if ( Weapon_info[tsi->weapon_class].launch_snd != -1 ) {
|
||||
// Don't play turret firing sound if turret sits on player ship... it gets annoying.
|
||||
@@ -1549,8 +1499,7 @@ void aiturret_turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
snd_play_3d( &Snds[Weapon_info[tsi->weapon_class].launch_snd], &turret_pos, &View_position );
|
||||
}
|
||||
}
|
||||
if(Weapon_info[tsi->weapon_class].muzzle_flash > -1)
|
||||
mflash_create(&turret_pos, &turret_fvec, &Objects[tsi->parent_objnum].phys_info, Weapon_info[tsi->weapon_class].muzzle_flash);
|
||||
|
||||
// in multiplayer (and the master), then send a turret fired packet.
|
||||
if ( MULTIPLAYER_MASTER && (weapon_objnum != -1) ) {
|
||||
int subsys_index;
|
||||
@@ -1567,7 +1516,7 @@ int Num_find_turret_enemy = 0;
|
||||
int Num_turrets_fired = 0;
|
||||
// Given a turret tp and its parent parent_objnum, fire from the turret at its enemy.
|
||||
extern int Nebula_sec_range;
|
||||
void aiturret_ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
{
|
||||
float weapon_firing_range;
|
||||
|
||||
@@ -1637,7 +1586,7 @@ void aiturret_ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnu
|
||||
// (NOTE: this will probably get changed by other parts of the code (swarming, beams, etc) to be
|
||||
// a more accurate time, but we need to give it a long enough time for the other parts of the code
|
||||
// to change the timestamp before it gets acted upon - taylor)
|
||||
ss->turret_animation_done_time = timestamp(1000);
|
||||
ss->turret_animation_done_time = timestamp(200);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@@ -1693,10 +1642,6 @@ void aiturret_ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnu
|
||||
int secnum = 0;
|
||||
for(i = 0; i < (MAX_SHIP_WEAPONS); i++)
|
||||
{
|
||||
//WMC - Only fire more than once if we have multiple guns flag set.
|
||||
if(num_valid > 0 && !(tp->flags & MSS_FLAG_USE_MULTIPLE_GUNS))
|
||||
break;
|
||||
|
||||
if(i < MAX_SHIP_PRIMARY_BANKS)
|
||||
{
|
||||
if(i >= swp->num_primary_banks)
|
||||
@@ -1964,25 +1909,6 @@ void aiturret_ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnu
|
||||
}
|
||||
}
|
||||
|
||||
if ( ok_to_fire && (tp->flags & MSS_FLAG_TURRET_HULL_CHECK) ) {
|
||||
int model_num = Ship_info[shipp->ship_info_index].model_num;
|
||||
mc_info hull_check;
|
||||
vec3d end;
|
||||
|
||||
vm_vec_scale_add(&end, &gpos, &gvec, model_get_radius(model_num));
|
||||
|
||||
hull_check.model_num = model_num;
|
||||
hull_check.orient = &objp->orient;
|
||||
hull_check.pos = &objp->pos;
|
||||
hull_check.p0 = &gpos;
|
||||
hull_check.p1 = &end;
|
||||
hull_check.flags = MC_CHECK_MODEL | MC_CHECK_RAY;
|
||||
|
||||
if ( model_collide(&hull_check) ) {
|
||||
ok_to_fire = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ok_to_fire )
|
||||
{
|
||||
something_was_ok_to_fire = true;
|
||||
@@ -2038,17 +1964,3 @@ void aiturret_ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnu
|
||||
ss->turret_time_enemy_in_range = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
struct aiturret_call_table AITurretDefaultTable = {
|
||||
aiturret_turret_select_best_weapon,
|
||||
aiturret_valid_turret_enemy,
|
||||
aiturret_evaluate_obj_as_target,
|
||||
aiturret_get_nearest_turret_objnum,
|
||||
aiturret_find_turret_enemy,
|
||||
aiturret_turret_should_pick_new_target,
|
||||
aiturret_turret_set_next_fire_timestamp,
|
||||
aiturret_turret_should_fire_aspect,
|
||||
aiturret_turret_fire_weapon,
|
||||
aiturret_turret_swarm_fire_from_turret,
|
||||
aiturret_ai_fire_from_turret
|
||||
};
|
||||
@@ -1,122 +0,0 @@
|
||||
#include "ai/aibig.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "ai/aiinternal.h"
|
||||
|
||||
struct aicode_call_table AICodeNewAITable;
|
||||
|
||||
#include "iff_defs/iff_defs.h"
|
||||
|
||||
#define DEPARTURE_HULL_PERCENT 0.3 // Departure if 15% to 30% hull strength left
|
||||
|
||||
void newai_ai_maybe_depart(object* objp_ship)
|
||||
{
|
||||
ship *shipp = &Ships[objp_ship->instance];
|
||||
|
||||
// Coward mode:
|
||||
//
|
||||
// Depart if:
|
||||
// * not player and
|
||||
// * same team as player and player not traitor and
|
||||
// * fighter or bomber
|
||||
// * hull multiplied with random value below critical
|
||||
|
||||
if (objp_ship->flags & OF_PLAYER_SHIP)
|
||||
return;
|
||||
|
||||
// make sure player is on their team and not a traitor
|
||||
if ((Player_ship->team != shipp->team) || (Player_ship->team == Iff_traitor))
|
||||
return;
|
||||
|
||||
if ((Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER|SIF_BOMBER)) == 0)
|
||||
return;
|
||||
|
||||
if (objp_ship->hull_strength*(frand()+1) < DEPARTURE_HULL_PERCENT * shipp->ship_max_hull_strength)
|
||||
mission_do_departure(objp_ship);
|
||||
}
|
||||
|
||||
// Object *objp_ship was hit by either weapon *objp_weapon or collided into by ship hit_objp at point *hitpos.
|
||||
void newai_aicode_ai_ship_hit (object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_quadrant, vec3d *hit_normal)
|
||||
{
|
||||
// Call the default implementation
|
||||
AICodeDefaultTable.ai_ship_hit(objp_ship, hit_objp, hitpos, shield_quadrant, hit_normal);
|
||||
|
||||
if (hit_objp->parent >= 0)
|
||||
{
|
||||
object *objp_hitter = &Objects[hit_objp->parent];
|
||||
|
||||
if ( objp_hitter->type == OBJ_SHIP )
|
||||
{
|
||||
ship *shipp_hitter = &Ships[objp_hitter->instance];
|
||||
ship *shipp_hit = &Ships[objp_ship->instance];
|
||||
|
||||
fprintf(stderr, "Ship %s hit %s\n", shipp_hitter->ship_name, shipp_hit->ship_name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
newai_ai_maybe_depart(objp_ship);
|
||||
}
|
||||
|
||||
|
||||
void newai_aicode_maybe_process_friendly_hit(object *objp_hitter, object *objp_hit, object *objp_weapon)
|
||||
{
|
||||
AICodeDefaultTable.maybe_process_friendly_hit(objp_hitter, objp_hit, objp_weapon);
|
||||
|
||||
if (obj_team(objp_hitter) == obj_team(objp_hit))
|
||||
{
|
||||
if ( objp_hitter->type != OBJ_SHIP )
|
||||
return;
|
||||
|
||||
ship *shipp_hitter = &Ships[objp_hitter->instance];
|
||||
ship *shipp_hit = &Ships[objp_hit->instance];
|
||||
|
||||
fprintf(stderr, "Ship %s friendly hit %s\n", shipp_hitter->ship_name, shipp_hit->ship_name);
|
||||
}
|
||||
}
|
||||
|
||||
int newai_aicode_ai_fire_primary_weapon(object *objp)
|
||||
{
|
||||
int fired = AICodeDefaultTable.ai_fire_primary_weapon(objp);
|
||||
|
||||
if (fired)
|
||||
{
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
fprintf(stderr, "Ship %s fired primary weapon\n", shipp->ship_name);
|
||||
}
|
||||
}
|
||||
|
||||
void newai_aicode_init_ship_info()
|
||||
{
|
||||
static int called=0;
|
||||
if (called == 0)
|
||||
{
|
||||
fprintf(stderr, "Init ship info was called\n");
|
||||
called=1;
|
||||
}
|
||||
AICodeDefaultTable.init_ship_info();
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void newai_ai_module_init();
|
||||
}
|
||||
|
||||
void newai_ai_module_init()
|
||||
{
|
||||
|
||||
#ifdef PACKAGE_NAME
|
||||
fprintf(stderr, "ai_module_init() called\n");
|
||||
#else
|
||||
fprintf(stderr, "ai_module_init() modular called\n");
|
||||
#endif
|
||||
|
||||
// First make a copy
|
||||
memcpy(&AICodeNewAITable, &AICodeDefaultTable, sizeof(AICodeNewAITable));
|
||||
|
||||
// Now set up our overridden functions
|
||||
|
||||
aicode_table = &AICodeNewAITable;
|
||||
aicode_table->init_ship_info=newai_aicode_init_ship_info;
|
||||
aicode_table->ai_ship_hit=newai_aicode_ai_ship_hit;
|
||||
//aicode_table->ai_fire_primary_weapon=newai_aicode_ai_fire_primary_weapon;
|
||||
//aicode_table->maybe_process_friendly_hit=newai_aicode_maybe_process_friendly_hit;
|
||||
}
|
||||
@@ -106,7 +106,7 @@
|
||||
* Cleaned up some more texture stuff enabled console debug for D3D.
|
||||
*
|
||||
* Revision 2.1.2.2 2002/09/28 22:13:42 randomtiger
|
||||
* Sorted out some bits and pieces. The background nebula blends now which is nice. – RT
|
||||
* Sorted out some bits and pieces. The background nebula blends now which is nice. � RT
|
||||
*
|
||||
* Revision 2.1.2.1 2002/09/24 18:56:40 randomtiger
|
||||
* DX8 branch commit
|
||||
|
||||
@@ -942,7 +942,7 @@ int unpack_pixel_count(anim_instance *ai, ubyte *data, ubyte pix, int count = 0,
|
||||
anim *a = ai->parent;
|
||||
int pixel_size = (bpp / 8);
|
||||
ubyte r, g, b;
|
||||
Assert(a);
|
||||
Assert(a);
|
||||
|
||||
// if this is an aabitmap, don't run through the palette
|
||||
if(aabitmap){
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.33 2006/01/13 03:30:59 Goober5000
|
||||
* übercommit of custom IFF stuff :)
|
||||
* übercommit of custom IFF stuff :)
|
||||
*
|
||||
* Revision 2.32 2005/11/21 02:43:30 Goober5000
|
||||
* change from "setting" to "profile"; this way makes more sense
|
||||
@@ -1244,32 +1244,31 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
|
||||
// only wrap if player won't see asteroid disappear/reverse direction
|
||||
dist = vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
|
||||
dot = vm_vec_dot(&Eye_matrix.vec.fvec, &vec_to_asteroid);
|
||||
|
||||
if ((dot < 0.7f) || (dist > 3000.0f)) {
|
||||
|
||||
if ( (dot < 0.7f) || (dist > asfieldp->bound_rad) ) {
|
||||
if (Num_asteroids > MAX_ASTEROIDS-10) {
|
||||
objp->flags |= OF_SHOULD_BE_DEAD;
|
||||
} else {
|
||||
// check to ensure player won't see asteroid appear either
|
||||
asteroid_wrap_pos(objp, asfieldp);
|
||||
Asteroids[objp->instance].target_objnum = -1;
|
||||
|
||||
vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
|
||||
|
||||
dist = vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
|
||||
dot = vm_vec_dot(&Eye_matrix.vec.fvec, &vec_to_asteroid);
|
||||
dist = vm_vec_dist_quick(&objp->pos, &Eye_position);
|
||||
|
||||
if (( dot > 0.7f) && (dist < 3000.0f)) {
|
||||
if ( (dot > 0.7f) && (dist < (asfieldp->bound_rad * 1.3f)) ) {
|
||||
// player would see asteroid pop out other side, so reverse velocity instead of wrapping
|
||||
objp->pos = old_asteroid_pos;
|
||||
vm_vec_copy_scale(&objp->phys_info.vel, &old_vel, -1.0f);
|
||||
objp->phys_info.desired_vel = objp->phys_info.vel;
|
||||
Asteroids[objp->instance].target_objnum = -1;
|
||||
}
|
||||
|
||||
|
||||
// update last pos (after vel is known)
|
||||
vm_vec_scale_add(&objp->last_pos, &objp->pos, &objp->phys_info.vel, -flFrametime);
|
||||
|
||||
|
||||
asteroid_update_collide(objp);
|
||||
|
||||
|
||||
if ( MULTIPLAYER_MASTER )
|
||||
send_asteroid_throw( objp );
|
||||
}
|
||||
@@ -2454,7 +2453,7 @@ void asteroid_page_in()
|
||||
|
||||
// Page in textures
|
||||
for (j=0; j<asip->modelp[k]->n_textures; j++ ) {
|
||||
int bitmap_num = asip->modelp[k]->maps[j].base_map.original_texture;
|
||||
int bitmap_num = asip->modelp[k]->maps[j].base_map.texture;
|
||||
|
||||
if ( bitmap_num > -1 ) {
|
||||
bm_page_in_texture( bitmap_num );
|
||||
|
||||
@@ -264,6 +264,7 @@ typedef enum {
|
||||
typedef struct asteroid_field {
|
||||
vec3d min_bound; // Minimum range of field.
|
||||
vec3d max_bound; // Maximum range of field.
|
||||
float bound_rad;
|
||||
int has_inner_bound;
|
||||
vec3d inner_min_bound;
|
||||
vec3d inner_max_bound;
|
||||
|
||||
@@ -99,8 +99,8 @@
|
||||
#define BM_TYPE_CUBEMAP_DXT3 13 // 32-bit cubemap (compressed cubemap surface)
|
||||
#define BM_TYPE_CUBEMAP_DXT5 14 // 32-bit cubemap (compressed cubemap surface)
|
||||
// special types ( used in: bm_bitmaps[i].type )
|
||||
#define BM_TYPE_RENDER_TARGET_STATIC 16 // 24/32 bit setup internally as a static render target
|
||||
#define BM_TYPE_RENDER_TARGET_DYNAMIC 17 // 24/32 bit setup internally as a dynamic render target
|
||||
#define BM_TYPE_RENDER_TARGET_STATIC 15 // 24/32 bit setup internally as a static render target
|
||||
#define BM_TYPE_RENDER_TARGET_DYNAMIC 16 // 24/32 bit setup internally as a dynamic render target
|
||||
|
||||
|
||||
/// Moved from cpp file ///////////////////
|
||||
|
||||
@@ -957,7 +957,8 @@ extern int Cmdline_cache_bitmaps;
|
||||
int GLOWMAP = -1;
|
||||
int SPECMAP = -1;
|
||||
int ENVMAP = -1;
|
||||
int BUMPMAP = -1;
|
||||
int NORMMAP = -1;
|
||||
int HEIGHTMAP = -1;
|
||||
|
||||
bitmap_entry bm_bitmaps[MAX_BITMAPS];
|
||||
|
||||
@@ -1950,7 +1951,7 @@ uint bm_get_signature( int handle )
|
||||
}
|
||||
|
||||
extern int palman_is_nondarkening(int r,int g, int b);
|
||||
static void bm_convert_format( int bitmapnum, bitmap *bmp, ubyte bpp, ubyte flags )
|
||||
static void bm_convert_format( bitmap *bmp, ubyte flags )
|
||||
{
|
||||
int idx;
|
||||
|
||||
@@ -1981,35 +1982,6 @@ static void bm_convert_format( int bitmapnum, bitmap *bmp, ubyte bpp, ubyte flag
|
||||
}
|
||||
}
|
||||
|
||||
// basically, map the bitmap into the current palette. used to be done for all pcx's, now just for
|
||||
// Fred, since its the only thing that uses the software tmapper
|
||||
void bm_swizzle_8bit_for_fred(bitmap_entry *be, bitmap *bmp, ubyte *data, ubyte *palette)
|
||||
{
|
||||
/* 2004/10/17 - taylor - no longer needed since FRED is OGL now
|
||||
int pcx_xparent_index = -1;
|
||||
int i;
|
||||
int r, g, b;
|
||||
ubyte palxlat[256];
|
||||
|
||||
for (i=0; i<256; i++ ) {
|
||||
r = palette[i*3];
|
||||
g = palette[i*3+1];
|
||||
b = palette[i*3+2];
|
||||
if ( g == 255 && r == 0 && b == 0 ) {
|
||||
palxlat[i] = 255;
|
||||
pcx_xparent_index = i;
|
||||
} else {
|
||||
palxlat[i] = (ubyte)(palette_find( r, g, b ));
|
||||
}
|
||||
}
|
||||
for (i=0; i<bmp->w * bmp->h; i++ ) {
|
||||
ubyte c = palxlat[data[i]];
|
||||
data[i] = c;
|
||||
}
|
||||
be->palette_checksum = gr_palette_checksum;
|
||||
*/
|
||||
}
|
||||
|
||||
void bm_lock_pcx( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags )
|
||||
{
|
||||
ubyte *data;
|
||||
@@ -2051,7 +2023,7 @@ void bm_lock_pcx( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
|
||||
|
||||
bmp->flags = 0;
|
||||
|
||||
bm_convert_format( bitmapnum, bmp, bpp, flags );
|
||||
bm_convert_format( bmp, flags );
|
||||
}
|
||||
|
||||
void bm_lock_ani( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags )
|
||||
@@ -2167,7 +2139,7 @@ void bm_lock_ani( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
|
||||
memcpy(dptr, sptr, size);
|
||||
}
|
||||
|
||||
bm_convert_format( first_frame+i, bm, bpp, flags );
|
||||
bm_convert_format( bm, flags );
|
||||
|
||||
// Skip a frame
|
||||
if ( (i < nframes-1) && can_drop_frames ) {
|
||||
@@ -2241,7 +2213,7 @@ void bm_lock_user( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, uby
|
||||
// Error( LOCATION, "Unhandled user bitmap conversion from %d to %d bpp", be->info.user.bpp, bmp->bpp );
|
||||
}
|
||||
|
||||
bm_convert_format( bitmapnum, bmp, bpp, flags );
|
||||
bm_convert_format( bmp, flags );
|
||||
}
|
||||
|
||||
void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags )
|
||||
@@ -2303,7 +2275,7 @@ void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
|
||||
|
||||
bmp->flags = 0;
|
||||
|
||||
bm_convert_format( bitmapnum, bmp, bpp, flags );
|
||||
bm_convert_format( bmp, flags );
|
||||
}
|
||||
|
||||
//lock a dds file
|
||||
@@ -2451,7 +2423,7 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags )
|
||||
if (flags & BMP_AABITMAP) {
|
||||
Assert( bpp == 8 );
|
||||
} else if ((flags & BMP_TEX_NONCOMP) && (!(flags & BMP_TEX_COMP))) {
|
||||
Assert( bpp >= 16 ); // cheating but bpp passed isn't what we normally end up with
|
||||
// Assert( bpp >= 16 ); // cheating but bpp passed isn't what we normally end up with
|
||||
} else if ((flags & BMP_TEX_DXT1) || (flags & BMP_TEX_DXT3) || (flags & BMP_TEX_DXT5)){
|
||||
Assert( bpp >= 16 ); // cheating but bpp passed isn't what we normally end up with
|
||||
} else if (flags & BMP_TEX_CUBEMAP) {
|
||||
@@ -2606,7 +2578,7 @@ int bm_release(int handle, int clear_render_targets)
|
||||
|
||||
Assert( be->handle == handle ); // INVALID BITMAP HANDLE
|
||||
|
||||
if ( !clear_render_targets && (be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC) ) {
|
||||
if ( !clear_render_targets && ((be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
|
||||
nprintf(("BmpMan", "Tried to release a render target!\n"));
|
||||
return 0;
|
||||
}
|
||||
@@ -2771,10 +2743,6 @@ int bm_unload_fast( int handle, int clear_render_targets )
|
||||
be = &bm_bitmaps[n];
|
||||
bmp = &be->bm;
|
||||
|
||||
if ( !clear_render_targets && ((be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( be->type == BM_TYPE_NONE ) {
|
||||
return -1; // Already been released
|
||||
}
|
||||
@@ -2783,6 +2751,10 @@ int bm_unload_fast( int handle, int clear_render_targets )
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( !clear_render_targets && ((be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// If it is locked, cannot free it.
|
||||
if (be->ref_count != 0) {
|
||||
nprintf(("BmpMan", "Tried to unload_fast %s that has a lock count of %d.. not unloading\n", be->filename, be->ref_count));
|
||||
@@ -3033,9 +3005,6 @@ void bm_page_in_stop()
|
||||
if ( !gr_preload(bm_bitmaps[i].handle, (bm_bitmaps[i].preloaded==2)) ) {
|
||||
mprintf(( "Out of VRAM. Done preloading.\n" ));
|
||||
bm_preloading = 0;
|
||||
} else {
|
||||
// it's loaded into API memory now so dump the system version of the data
|
||||
bm_free_data_fast(i);
|
||||
}
|
||||
} else {
|
||||
bm_lock( bm_bitmaps[i].handle, (bm_bitmaps[i].used_flags == BMP_AABITMAP) ? 8 : 16, bm_bitmaps[i].used_flags );
|
||||
@@ -3123,6 +3092,7 @@ int bm_get_cache_slot( int bitmap_id, int separate_ani_frames )
|
||||
{
|
||||
int n = bitmap_id % MAX_BITMAPS;
|
||||
|
||||
Assert( n >= 0 );
|
||||
Assert( bm_bitmaps[n].handle == bitmap_id ); // INVALID BITMAP HANDLE
|
||||
|
||||
bitmap_entry *be = &bm_bitmaps[n];
|
||||
@@ -3276,6 +3246,8 @@ void bm_get_filename(int bitmapnum, char *filename)
|
||||
{
|
||||
int n = bitmapnum % MAX_BITMAPS;
|
||||
|
||||
Assert( n >= 0 );
|
||||
|
||||
// return filename
|
||||
strcpy(filename, bm_bitmaps[n].filename);
|
||||
}
|
||||
@@ -3286,16 +3258,19 @@ int bm_is_compressed(int num)
|
||||
int n = num % MAX_BITMAPS;
|
||||
ubyte type = BM_TYPE_NONE;
|
||||
|
||||
//duh
|
||||
if (!Use_compressed_textures)
|
||||
// duh
|
||||
if ( !Use_compressed_textures ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Assert(num == bm_bitmaps[n].handle);
|
||||
Assert( n >= 0 );
|
||||
Assert( num == bm_bitmaps[n].handle );
|
||||
|
||||
type = bm_bitmaps[n].comp_type;
|
||||
|
||||
switch (type) {
|
||||
case BM_TYPE_NONE:
|
||||
case BM_TYPE_DDS:
|
||||
return 0;
|
||||
|
||||
case BM_TYPE_DXT1:
|
||||
@@ -3324,7 +3299,7 @@ int bm_has_alpha_channel(int handle)
|
||||
{
|
||||
int n = handle % MAX_BITMAPS;
|
||||
|
||||
Assert( (n >= 0) && (n < MAX_BITMAPS) );
|
||||
Assert( n >= 0 );
|
||||
Assert( handle == bm_bitmaps[n].handle );
|
||||
|
||||
// assume that PCX never has a real alpha channel (it may be 32-bit, but without any alpha)
|
||||
@@ -3339,11 +3314,24 @@ int bm_has_alpha_channel(int handle)
|
||||
// for is TCACHE_TYPE_SECTIONED - taylor
|
||||
int bm_get_tcache_type(int num)
|
||||
{
|
||||
if ( bm_is_compressed(num) )
|
||||
if ( bm_is_compressed(num) ) {
|
||||
return TCACHE_TYPE_COMPRESSED;
|
||||
}
|
||||
|
||||
// if ( bm_is_render_target(num) )
|
||||
// if ( bm_is_render_target(num) ) {
|
||||
// return TCACHE_TYPE_RENDER_TARGET;
|
||||
// }
|
||||
|
||||
int n = num % MAX_BITMAPS;
|
||||
|
||||
Assert( n >= 0 );
|
||||
Assert( num == bm_bitmaps[n].handle );
|
||||
|
||||
/* switch ( bm_bitmaps[n].comp_type ) {
|
||||
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
|
||||
return TCACHE_TYPE_NORMAL;
|
||||
}
|
||||
@@ -3352,6 +3340,7 @@ int bm_get_size(int num)
|
||||
{
|
||||
int n = num % MAX_BITMAPS;
|
||||
|
||||
Assert( n >= 0 );
|
||||
Assert(num == bm_bitmaps[n].handle);
|
||||
|
||||
return bm_bitmaps[n].mem_taken;
|
||||
@@ -3361,10 +3350,12 @@ int bm_get_num_mipmaps(int num)
|
||||
{
|
||||
int n = num % MAX_BITMAPS;
|
||||
|
||||
Assert( n >= 0 );
|
||||
Assert( num == bm_bitmaps[n].handle );
|
||||
|
||||
if (bm_bitmaps[n].num_mipmaps == 0)
|
||||
if (bm_bitmaps[n].num_mipmaps == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return bm_bitmaps[n].num_mipmaps;
|
||||
}
|
||||
@@ -3382,6 +3373,7 @@ int bm_convert_color_index_to_BGR(int num, ubyte **out_data)
|
||||
|
||||
|
||||
Assert( out_data != NULL );
|
||||
Assert( n >= 0 );
|
||||
Assert( num == bm_bitmaps[n].handle );
|
||||
|
||||
if ( num != bm_bitmaps[n].handle )
|
||||
@@ -3560,9 +3552,14 @@ int bm_is_render_target(int bitmap_id)
|
||||
{
|
||||
int n = bitmap_id % MAX_BITMAPS;
|
||||
|
||||
Assert(bitmap_id == bm_bitmaps[n].handle);
|
||||
Assert( n >= 0 );
|
||||
Assert( bitmap_id == bm_bitmaps[n].handle );
|
||||
|
||||
return ( (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_STATIC) || (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_DYNAMIC) );
|
||||
if ( !((bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_STATIC) || (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return bm_bitmaps[n].type;
|
||||
}
|
||||
|
||||
int bm_set_render_target(int handle, int face)
|
||||
@@ -3599,6 +3596,11 @@ int bm_set_render_target(int handle, int face)
|
||||
|
||||
gr_reset_clip();
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
extern void opengl_setup_viewport();
|
||||
opengl_setup_viewport();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -691,10 +691,11 @@ void bm_set_components_argb_d3d_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *
|
||||
// get the rgba components of a pixel, any of the parameters can be NULL
|
||||
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
extern int GLOWMAP; //this holds a reference to a map that is a fully lit version of its index -Bobboau
|
||||
extern int SPECMAP; //this holds a reference to a map that is for specular mapping -Bobboau
|
||||
extern int ENVMAP; //this holds a reference to a map that is for environment mapping -Bobboau
|
||||
extern int BUMPMAP; //blah blah bumpmapping
|
||||
extern int GLOWMAP; // this holds a reference to a map that is a fully lit version of its index -Bobboau
|
||||
extern int SPECMAP; // this holds a reference to a map that is for specular mapping -Bobboau
|
||||
extern int ENVMAP; // this holds a reference to a map that is for environment mapping -Bobboau
|
||||
extern int NORMMAP; // normal mapping
|
||||
extern int HEIGHTMAP; // height map for normal mapping
|
||||
|
||||
int bm_is_compressed(int num);
|
||||
int bm_get_tcache_type(int num);
|
||||
|
||||
@@ -402,11 +402,19 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, float in_display_t
|
||||
th = h;
|
||||
}
|
||||
|
||||
// gr_resize_screen_pos(&tw, &th);
|
||||
|
||||
//Center it?
|
||||
if(center_x)
|
||||
image_pos[0] = (gr_screen.max_w - tw)/2;
|
||||
{
|
||||
image_pos[0] = (gr_screen.max_w_unscaled - tw)/2;
|
||||
gr_resize_screen_pos(&image_pos[0], NULL);
|
||||
}
|
||||
if(center_y)
|
||||
image_pos[1] = (gr_screen.max_h - th)/2;
|
||||
{
|
||||
image_pos[1] = (gr_screen.max_h_unscaled - th)/2;
|
||||
gr_resize_screen_pos(NULL, &image_pos[1]);
|
||||
}
|
||||
}
|
||||
if(in_x_pos < 0 && !center_x)
|
||||
image_pos[0] += gr_screen.max_w + in_x_pos;
|
||||
@@ -418,30 +426,18 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, float in_display_t
|
||||
else if(!center_y)
|
||||
image_pos[1] += in_y_pos;
|
||||
|
||||
|
||||
text_pos[0] = image_pos[0];
|
||||
|
||||
if(image_id != -1)
|
||||
{
|
||||
text_pos[0] = image_pos[0] + w; //Still set from bm_get_info call
|
||||
if (!center_x)
|
||||
{
|
||||
deltax = text_pos[0] / 1024.0f; //MikeStar;
|
||||
text_pos[0] = gr_screen.max_w * deltax; //MikeStar;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text_pos[0] = image_pos[0];
|
||||
if (!center_x)
|
||||
{
|
||||
deltax = text_pos[0] / 1024.0f; //MikeStar;
|
||||
text_pos[0] = gr_screen.max_w * deltax; //MikeStar;
|
||||
}
|
||||
}
|
||||
text_pos[0] += w; //Still set from bm_get_info call
|
||||
|
||||
// deltax = text_pos[0] / i2fl(gr_screen.max_w_unscaled); //MikeStar;
|
||||
// text_pos[0] = gr_screen.max_w * deltax; //MikeStar;
|
||||
|
||||
text_pos[1] = image_pos[1];
|
||||
if (!center_y)
|
||||
{
|
||||
deltay = text_pos[1] / 768.0f; //MikeStar;
|
||||
text_pos[1] = gr_screen.max_h * deltay; //MikeStar;
|
||||
}
|
||||
// deltay = text_pos[1] / i2fl(gr_screen.max_h_unscaled); //MikeStar;
|
||||
// text_pos[1] = gr_screen.max_h * deltay; //MikeStar;
|
||||
|
||||
time_displayed = 0.0f;
|
||||
time_displayed_end = 2.0f*fade_time + display_time;
|
||||
|
||||
@@ -419,14 +419,14 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
|
||||
{ CF_TYPE_MOVIES, "data" DIR_SEPARATOR_STR "movies", ".mve .msb .ogg", CF_TYPE_DATA },
|
||||
{ CF_TYPE_INTERFACE, "data" DIR_SEPARATOR_STR "interface", ".pcx .ani .dds .tga .eff", CF_TYPE_DATA },
|
||||
{ CF_TYPE_FONT, "data" DIR_SEPARATOR_STR "fonts", ".vf .ttf", CF_TYPE_DATA },
|
||||
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .eff .pcx .neb .tga .jpg .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .eff .pcx .neb .tga .jpg .dds .sdr", CF_TYPE_DATA },
|
||||
{ CF_TYPE_HUD, "data" DIR_SEPARATOR_STR "hud", ".ani .pcx .tga .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_PLAYERS, "data" DIR_SEPARATOR_STR "players", ".hcf", CF_TYPE_DATA },
|
||||
{ CF_TYPE_PLAYER_IMAGES, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "images", ".pcx .dds", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_SQUAD_IMAGES, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "squads", ".pcx .dds", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_SINGLE_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "single", ".pl2 .cs2 .plr .csg .css", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_MULTI_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "multi", ".plr", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx", CF_TYPE_DATA }, //clr=cached color
|
||||
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx .tsb", CF_TYPE_DATA }, //clr=cached color
|
||||
{ CF_TYPE_MULTI_CACHE, "data" DIR_SEPARATOR_STR "multidata", ".pcx .dds .fs2 .txt", CF_TYPE_DATA },
|
||||
{ CF_TYPE_MISSIONS, "data" DIR_SEPARATOR_STR "missions", ".fs2 .fc2 .ntl .ssv", CF_TYPE_DATA },
|
||||
{ CF_TYPE_CONFIG, "data" DIR_SEPARATOR_STR "config", ".cfg", CF_TYPE_DATA },
|
||||
@@ -2022,6 +2022,7 @@ int cf_chksum_pack(char *filename, uint *chk_long, bool full)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// get the 2 byte checksum of the passed filename - return 0 if operation failed, 1 if succeeded
|
||||
int cf_chksum_short(char *filename, ushort *chksum, int max_size, int cf_type)
|
||||
{
|
||||
|
||||
@@ -321,7 +321,7 @@ int cfread_lua_number(double *buf, CFILE *cfile)
|
||||
Assert( !cb->data );
|
||||
Assert(cb->fp != NULL);
|
||||
|
||||
long orig_pos = ftell(cb->fp);
|
||||
int orig_pos = ftell(cb->fp);
|
||||
int items_read = fscanf(cb->fp, LUA_NUMBER_SCAN, buf);
|
||||
cb->raw_position += ftell(cb->fp)-orig_pos;
|
||||
|
||||
|
||||
@@ -1660,10 +1660,8 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
if (find_handle != -1) {
|
||||
do {
|
||||
if (num_files >= max)
|
||||
break;
|
||||
|
||||
if ( strlen(find.name) >= MAX_FILENAME_LEN )
|
||||
continue;
|
||||
break;
|
||||
|
||||
if (!(find.attrib & _A_SUBDIR)) {
|
||||
if ( !Get_file_list_filter || (*Get_file_list_filter)(find.name) ) {
|
||||
@@ -1701,10 +1699,6 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
if (num_files >= max)
|
||||
break;
|
||||
|
||||
if ( strlen(dir->d_name) >= MAX_FILENAME_LEN ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fnmatch(filter, dir->d_name, 0) != 0)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -162,8 +162,8 @@ void pack_file( char *filespec, char *filename, int filesize, _fs_time_t time_wr
|
||||
}
|
||||
|
||||
if ( strlen(filename) > 31 ) {
|
||||
printf( "Filename '%s' too long! Skipping...\n", filename );
|
||||
return;
|
||||
printf( "Filename '%s' too long\n", filename );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset( path, 0, sizeof(path) );
|
||||
@@ -255,7 +255,7 @@ void pack_directory( char * filespec)
|
||||
find_handle = _findfirst( tmp1, &find );
|
||||
if( find_handle != -1 ) {
|
||||
if ( find.attrib & _A_SUBDIR ) {
|
||||
if (strcmp( "..", find.name) && strcmp( ".", find.name) && strcmp( ".svn", find.name)) {
|
||||
if (strcmp( "..", find.name) && strcmp( ".", find.name)) {
|
||||
strcpy( tmp, filespec );
|
||||
strcat( tmp, "\\" );
|
||||
strcat( tmp, find.name );
|
||||
@@ -267,7 +267,7 @@ void pack_directory( char * filespec)
|
||||
|
||||
while( !_findnext( find_handle, &find ) ) {
|
||||
if ( find.attrib & _A_SUBDIR ) {
|
||||
if (strcmp( "..", find.name) && strcmp( ".", find.name) && strcmp( ".svn", find.name)) {
|
||||
if (strcmp( "..", find.name) && strcmp( ".", find.name)) {
|
||||
strcpy( tmp, filespec );
|
||||
strcat( tmp, "\\" );
|
||||
strcat( tmp, find.name );
|
||||
@@ -300,10 +300,6 @@ void pack_directory( char * filespec)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( (strcmp(dir->d_name, ".svn") == 0) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (S_ISDIR(buf.st_mode)) {
|
||||
strcpy( tmp, filespec );
|
||||
strcat( tmp, "/" );
|
||||
|
||||
@@ -990,9 +990,9 @@ Flag exe_params[] =
|
||||
{ "-env", "Enable environment maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-env", },
|
||||
{ "-mipmap", "Enable mipmapping", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mipmap", },
|
||||
{ "-nomotiondebris", "Disable motion debris", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomotiondebris",},
|
||||
{ "-2d_poof", "Stops fog intersect hull", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-2d_poof", },
|
||||
{ "-noscalevid", "Disable scale-to-window for movies", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noscalevid", },
|
||||
{ "-missile_lighting", "Apply Lighting to Missiles" , true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missile_lighting", },
|
||||
{ "-missile_lighting", "Apply Lighting to Missiles", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missile_lighting", },
|
||||
{ "-normal", "Enable normal maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-normal" },
|
||||
|
||||
{ "-img2dds", "Compress non-compressed images", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-img2dds", },
|
||||
{ "-no_vsync", "Disable vertical sync", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_vsync", },
|
||||
@@ -1035,8 +1035,8 @@ Flag exe_params[] =
|
||||
{ "-noibx", "Don't use cached index buffers (IBX)", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noibx", },
|
||||
{ "-loadallweps", "Load all weapons, even those not used", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-loadallweps", },
|
||||
{ "-disable_fbo", "Disable OpenGL RenderTargets", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-no_glsl", "Disable GLSL (shader) support", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
|
||||
{ "-alpha_env", "Use specular alpha for env mapping", true, 0, EASY_DEFAULT_MEM, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-alpha_env", },
|
||||
{ "-ingame_join", "Allows ingame joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
|
||||
{ "-voicer", "Voice recognition", true, 0, EASY_DEFAULT, "Experimental", "", },
|
||||
|
||||
@@ -1057,6 +1057,7 @@ Flag exe_params[] =
|
||||
{ "-output_scripting", "Outputs scripting to scripting.html", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-output_scripting", },
|
||||
{ "-save_render_target", "Save render targets to file", true, 0, EASY_DEFAULT, "Dev Tool", "", },
|
||||
{ "-debug_window", "Display debug window", true, 0, EASY_DEFAULT, "Dev Tool", "", },
|
||||
{ "-verify_vps", "Spew VP crcs to vp_crcs.txt", true, 0, EASY_DEFAULT, "Dev Tool", "", },
|
||||
#ifdef SCP_UNIX
|
||||
{ "-nograb", "Don't grab mouse/keyboard in a window", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nograb", },
|
||||
#endif
|
||||
@@ -1118,36 +1119,36 @@ cmdline_parm ogl_spec_arg("-ogl_spec", NULL); // Cmdline_ogl_spec
|
||||
cmdline_parm spec_static_arg("-spec_static", NULL);
|
||||
cmdline_parm spec_point_arg("-spec_point", NULL);
|
||||
cmdline_parm spec_tube_arg("-spec_tube", NULL);
|
||||
cmdline_parm poof_2d_arg("-2d_poof", NULL); // Cmdline_2d_poof
|
||||
cmdline_parm alpha_env("-alpha_env", NULL); // Cmdline_alpha_env
|
||||
cmdline_parm ambient_factor_arg("-ambient_factor", NULL); // Cmdline_ambient_factor
|
||||
cmdline_parm cell_arg("-cell", NULL); // Cmdline_cell
|
||||
cmdline_parm decals("-decals", NULL); // Cmdline_decals
|
||||
cmdline_parm env("-env", NULL); // Cmdline_env
|
||||
cmdline_parm mipmap_arg("-mipmap", NULL); // Cmdline_mipmap
|
||||
cmdline_parm missile_lighting_arg("-missile_lighting", NULL); // Cmdline_missile_lighting
|
||||
cmdline_parm glow_arg("-glow", NULL); // Cmdline_noglow -- use Bobs glow code
|
||||
cmdline_parm glow_arg("-glow", NULL); // Cmdline_glow -- use Bobs glow code
|
||||
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
|
||||
cmdline_parm noscalevid_arg("-noscalevid", NULL); // Cmdline_noscalevid -- disable video scaling that fits to window
|
||||
cmdline_parm spec_arg("-spec", NULL); // Cmdline_nospec -- use specular highlighting -Sticks
|
||||
cmdline_parm spec_arg("-spec", NULL); // Cmdline_spec -- use specular highlighting -Sticks
|
||||
cmdline_parm noemissive_arg("-no_emissive_light", NULL); // Cmdline_no_emissive -- don't use emissive light in OGL
|
||||
cmdline_parm normal_arg("-normal", NULL); // Cmdline_normal -- enable normal mapping
|
||||
cmdline_parm height_arg("-height", NULL); // Cmdline_height -- enable support for parallax mapping
|
||||
|
||||
float Cmdline_clip_dist = Default_min_draw_distance;
|
||||
float Cmdline_fov = 0.75f;
|
||||
float Cmdline_ogl_spec = 80.0f;
|
||||
int Cmdline_2d_poof = 0;
|
||||
int Cmdline_alpha_env = 0;
|
||||
int Cmdline_ambient_factor = 128;
|
||||
int Cmdline_cell = 0;
|
||||
int Cmdline_decals = 0;
|
||||
int Cmdline_env = 0;
|
||||
int Cmdline_mipmap = 0;
|
||||
int Cmdline_missile_lighting = 0;
|
||||
int Cmdline_noglow = 1;
|
||||
int Cmdline_glow = 0;
|
||||
int Cmdline_nomotiondebris = 0;
|
||||
int Cmdline_noscalevid = 0;
|
||||
int Cmdline_nospec = 1;
|
||||
int Cmdline_spec = 0;
|
||||
int Cmdline_no_emissive = 0;
|
||||
int Cmdline_normal = 0;
|
||||
int Cmdline_height = 0;
|
||||
|
||||
// Game Speed related
|
||||
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL); // Cmdline_cache_bitmaps
|
||||
@@ -1219,7 +1220,6 @@ int Cmdline_objupd = 3; // client object updates on LAN by default
|
||||
|
||||
// Troubleshooting
|
||||
cmdline_parm d3d_lesstmem_arg("-d3d_bad_tsys", NULL); // Cmdline_d3d_lesstmem
|
||||
//cmdline_parm fred2_htl_arg("-fredhtl", NULL); // Cmdline_FRED2_htl
|
||||
cmdline_parm loadallweapons_arg("-loadallweps", NULL); // Cmdline_load_all_weapons
|
||||
cmdline_parm htl_arg("-nohtl", NULL); // Cmdline_nohtl -- don't use HT&L
|
||||
cmdline_parm noibx_arg("-noibx", NULL); // Cmdline_noibx
|
||||
@@ -1228,10 +1228,9 @@ cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL); // Cmdline_no_set_gamma
|
||||
cmdline_parm no_vbo_arg("-novbo", NULL); // Cmdline_novbo
|
||||
cmdline_parm safeloading_arg("-safeloading", NULL); // Cmdline_safeloading -- Uses old loading method -C
|
||||
cmdline_parm no_fbo_arg("-disable_fbo", NULL); // Cmdline_no_fbo
|
||||
cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps
|
||||
cmdline_parm noglsl_arg("-no_glsl", NULL); // Cmdline_noglsl -- disable GLSL support in OpenGL
|
||||
|
||||
int Cmdline_d3d_lesstmem = 0;
|
||||
//int Cmdline_FRED2_htl = 0; // turn HTL on in fred - Kazan
|
||||
int Cmdline_load_all_weapons = 0;
|
||||
int Cmdline_nohtl = 0;
|
||||
int Cmdline_noibx = 0;
|
||||
@@ -1240,7 +1239,7 @@ int Cmdline_no_set_gamma = 0;
|
||||
int Cmdline_novbo = 0; // turn off OGL VBO support, troubleshooting
|
||||
int Cmdline_safeloading = 0;
|
||||
int Cmdline_no_fbo = 0;
|
||||
int Cmdline_verify_vps = 0;
|
||||
int Cmdline_noglsl = 0;
|
||||
|
||||
// Developer/Testing related
|
||||
cmdline_parm start_mission_arg("-start_mission", NULL); // Cmdline_start_mission
|
||||
@@ -1257,15 +1256,17 @@ cmdline_parm save_render_targets_arg("-save_render_target", NULL); // Cmdline_sa
|
||||
cmdline_parm debug_window_arg("-debug_window", NULL); // Cmdline_debug_window
|
||||
cmdline_parm window_arg("-window", NULL); // Cmdline_window
|
||||
cmdline_parm res_arg("-res", NULL); // Cmdline_lores
|
||||
cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps -- spew VP crcs to vp_crcs.txt
|
||||
#ifdef SCP_UNIX
|
||||
cmdline_parm no_grab("-nograb", NULL); // Cmdline_no_grab
|
||||
#endif
|
||||
cmdline_parm dev_nofail("-dev_nofail", NULL); // Cmdline_dev_nofail
|
||||
|
||||
char *Cmdline_start_mission = NULL;
|
||||
int Cmdline_dis_collisions = 0;
|
||||
int Cmdline_dis_weapons = 0;
|
||||
int Cmdline_noparseerrors = 0;
|
||||
int Cmdline_nowarn = 0; // turn warnings off in FRED
|
||||
int Cmdline_nowarn = 1; // turn warnings off in FRED
|
||||
int Cmdline_show_mem_usage = 0;
|
||||
int Cmdline_show_pos = 0;
|
||||
int Cmdline_show_stats = 0;
|
||||
@@ -1273,10 +1274,12 @@ int Cmdline_timerbar = 0;
|
||||
int Cmdline_save_render_targets = 0;
|
||||
int Cmdline_debug_window = 0;
|
||||
int Cmdline_window = 0;
|
||||
char *Cmdline_res = 0;
|
||||
int Cmdline_verify_vps = 0;
|
||||
char *Cmdline_res = NULL;
|
||||
#ifdef SCP_UNIX
|
||||
int Cmdline_no_grab = 0;
|
||||
#endif
|
||||
int Cmdline_dev_nofail = 0;
|
||||
|
||||
// Other
|
||||
cmdline_parm get_flags_arg("-get_flags", NULL);
|
||||
@@ -1284,7 +1287,6 @@ cmdline_parm output_sexp_arg("-output_sexps", NULL); //WMC - outputs all SEXPs t
|
||||
cmdline_parm output_scripting_arg("-output_scripting", NULL); //WMC
|
||||
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
// NOTE: this assumes that os_init() has already been called but isn't a fatal error if it hasn't
|
||||
void cmdline_debug_print_cmdline()
|
||||
@@ -1553,7 +1555,7 @@ void os_init_cmdline(char *cmdline)
|
||||
|
||||
// if the file exists, get a single line, and deal with it
|
||||
if ( fp ) {
|
||||
char buf[1024], *p;
|
||||
char buf[1024], *p = NULL;
|
||||
|
||||
fgets(buf, 1024, fp);
|
||||
|
||||
@@ -1747,34 +1749,30 @@ char *cmdline_parm::str()
|
||||
|
||||
// external entry point into this modules
|
||||
|
||||
|
||||
bool SetCmdlineParams()
|
||||
// Sets externed variables used for communication cmdline information
|
||||
{
|
||||
if ( dev_nofail.found() ) {
|
||||
Cmdline_dev_nofail = 1;
|
||||
}
|
||||
|
||||
//getcwd(FreeSpace_Directory, 256); // set the directory to our fs2 root
|
||||
if (no_fpscap.found())
|
||||
{
|
||||
if ( no_fpscap.found() ) {
|
||||
Cmdline_NoFPSCap = 1;
|
||||
}
|
||||
|
||||
if(loadallweapons_arg.found())
|
||||
{
|
||||
if ( loadallweapons_arg.found() ) {
|
||||
Cmdline_load_all_weapons = 1;
|
||||
}
|
||||
|
||||
if(poof_2d_arg.found())
|
||||
{
|
||||
Cmdline_2d_poof = 1;
|
||||
}
|
||||
|
||||
if(voice_recognition_arg.found())
|
||||
{
|
||||
if ( voice_recognition_arg.found() ) {
|
||||
Cmdline_voice_recognition = 1;
|
||||
}
|
||||
|
||||
if (nowarn_arg.found())
|
||||
{
|
||||
if ( nowarn_arg.found() ) {
|
||||
Cmdline_nowarn = 1;
|
||||
}
|
||||
|
||||
/* karajorma - let's just use -nohtl instead
|
||||
if (fred2_htl_arg.found())
|
||||
{
|
||||
@@ -1804,26 +1802,22 @@ bool SetCmdlineParams()
|
||||
}
|
||||
|
||||
// is this a standalone server??
|
||||
if (standalone_arg.found()) {
|
||||
if ( standalone_arg.found() )
|
||||
Is_standalone = 1;
|
||||
}
|
||||
|
||||
// object update control
|
||||
if(objupd_arg.found()){
|
||||
if ( objupd_arg.found() ) {
|
||||
Cmdline_objupd = objupd_arg.get_int();
|
||||
|
||||
if (Cmdline_objupd < 0)
|
||||
{
|
||||
Cmdline_objupd = 0;
|
||||
}
|
||||
|
||||
if (Cmdline_objupd > 3)
|
||||
{
|
||||
Cmdline_objupd = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if(mpnoreturn_arg.found()) {
|
||||
if ( mpnoreturn_arg.found() )
|
||||
Cmdline_mpnoreturn = 1;
|
||||
}
|
||||
|
||||
// run with no sound
|
||||
if ( nosound_arg.found() ) {
|
||||
@@ -1991,13 +1985,11 @@ bool SetCmdlineParams()
|
||||
}
|
||||
|
||||
|
||||
if (fps_arg.found())
|
||||
{
|
||||
if ( fps_arg.found() ) {
|
||||
Show_framerate = 1;
|
||||
}
|
||||
|
||||
if(pos_arg.found())
|
||||
{
|
||||
if ( pos_arg.found() ) {
|
||||
Cmdline_show_pos = 1;
|
||||
}
|
||||
|
||||
@@ -2009,11 +2001,11 @@ bool SetCmdlineParams()
|
||||
Cmdline_nomotiondebris = 1;
|
||||
}
|
||||
|
||||
if( mipmap_arg.found() ) {
|
||||
if ( mipmap_arg.found() ) {
|
||||
Cmdline_mipmap = 1;
|
||||
}
|
||||
|
||||
if( stats_arg.found() ) {
|
||||
if ( stats_arg.found() ) {
|
||||
Cmdline_show_stats = 1;
|
||||
}
|
||||
|
||||
@@ -2021,7 +2013,7 @@ bool SetCmdlineParams()
|
||||
Viewer_zoom = VIEWER_ZOOM_DEFAULT = Cmdline_fov = fov_arg.get_float();
|
||||
}
|
||||
|
||||
if( clip_dist_arg.found() ) {
|
||||
if ( clip_dist_arg.found() ) {
|
||||
Min_draw_distance = Cmdline_clip_dist = clip_dist_arg.get_float();
|
||||
}
|
||||
|
||||
@@ -2069,49 +2061,59 @@ bool SetCmdlineParams()
|
||||
}
|
||||
|
||||
if ( spec_arg.found() )
|
||||
{
|
||||
Cmdline_nospec = 0;
|
||||
}
|
||||
Cmdline_spec = 1;
|
||||
|
||||
if ( htl_arg.found() )
|
||||
{
|
||||
Cmdline_nohtl = 1;
|
||||
}
|
||||
|
||||
if( no_set_gamma_arg.found() )
|
||||
{
|
||||
if ( no_set_gamma_arg.found() )
|
||||
Cmdline_no_set_gamma = 1;
|
||||
}
|
||||
|
||||
if(no_vsync_arg.found() )
|
||||
{
|
||||
if ( no_vsync_arg.found() )
|
||||
Cmdline_no_vsync = 1;
|
||||
}
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
// no key/mouse grab
|
||||
if(no_grab.found()){
|
||||
if ( no_grab.found() )
|
||||
Cmdline_no_grab = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( img2dds_arg.found() )
|
||||
if ( img2dds_arg.found() ) {
|
||||
Cmdline_img2dds = 1;
|
||||
}
|
||||
|
||||
if ( glow_arg.found() )
|
||||
Cmdline_noglow = 0;
|
||||
if ( glow_arg.found() ) {
|
||||
Cmdline_glow = 1;
|
||||
}
|
||||
|
||||
if ( query_speech_arg.found() )
|
||||
if ( query_speech_arg.found() ) {
|
||||
Cmdline_query_speech = 1;
|
||||
}
|
||||
|
||||
if ( ship_choice_3d_arg.found() )
|
||||
if ( ship_choice_3d_arg.found() ) {
|
||||
Cmdline_ship_choice_3d = 1;
|
||||
}
|
||||
|
||||
if ( show_mem_usage_arg.found() )
|
||||
if ( show_mem_usage_arg.found() ) {
|
||||
Cmdline_show_mem_usage = 1;
|
||||
}
|
||||
|
||||
if (ingamejoin_arg.found() )
|
||||
if (ingamejoin_arg.found() ) {
|
||||
Cmdline_ingamejoin = 1;
|
||||
}
|
||||
|
||||
if ( normal_arg.found() ) {
|
||||
Cmdline_normal = 1;
|
||||
|
||||
// height maps are only used if normal maps are
|
||||
if ( height_arg.found() ) {
|
||||
Cmdline_height = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( noglsl_arg.found() ) {
|
||||
Cmdline_noglsl = 1;
|
||||
}
|
||||
|
||||
if ( start_mission_arg.found() ) {
|
||||
Cmdline_start_mission = start_mission_arg.str();
|
||||
@@ -2256,28 +2258,19 @@ bool SetCmdlineParams()
|
||||
return false;
|
||||
}
|
||||
|
||||
Cmdline_d3d_lesstmem = !d3d_lesstmem_arg.found();
|
||||
if ( d3d_lesstmem_arg.found() )
|
||||
Cmdline_d3d_lesstmem = 1;
|
||||
|
||||
if ( no_vbo_arg.found() )
|
||||
{
|
||||
Cmdline_novbo = 1;
|
||||
}
|
||||
|
||||
if ( snd_preload_arg.found() )
|
||||
{
|
||||
Cmdline_snd_preload = 1;
|
||||
}
|
||||
|
||||
if ( alpha_env.found() ) {
|
||||
Cmdline_alpha_env = 1;
|
||||
}
|
||||
|
||||
if ( env.found() ) {
|
||||
if ( env.found() )
|
||||
Cmdline_env = 1;
|
||||
}
|
||||
|
||||
if ( decals.found() ) {
|
||||
|
||||
#ifdef WIN32
|
||||
MessageBox(NULL, "Decals have been disabled in builds after May 4, 2006. Please remove the \"-decals\" command line from the launcher to prevent this message from appearing the the future.", "", MB_OK | MB_ICONINFORMATION);
|
||||
#endif
|
||||
@@ -2299,20 +2292,17 @@ bool SetCmdlineParams()
|
||||
if(dis_collisions.found())
|
||||
Cmdline_dis_collisions = 1;
|
||||
|
||||
if(dis_weapons.found())
|
||||
if ( dis_weapons.found() )
|
||||
Cmdline_dis_weapons = 1;
|
||||
|
||||
if ( noibx_arg.found() ) {
|
||||
if ( noibx_arg.found() )
|
||||
Cmdline_noibx = 1;
|
||||
}
|
||||
|
||||
if ( no_fbo_arg.found() ) {
|
||||
if ( no_fbo_arg.found() )
|
||||
Cmdline_no_fbo = 1;
|
||||
}
|
||||
|
||||
if ( noemissive_arg.found() ) {
|
||||
if ( noemissive_arg.found() )
|
||||
Cmdline_no_emissive = 1;
|
||||
}
|
||||
|
||||
if ( ogl_spec_arg.found() ) {
|
||||
Cmdline_ogl_spec = ogl_spec_arg.get_float();
|
||||
|
||||
@@ -650,18 +650,19 @@ extern float Cmdline_ogl_spec;
|
||||
extern float static_light_factor;
|
||||
extern float static_point_factor;
|
||||
extern float static_tube_factor;
|
||||
extern int Cmdline_2d_poof;
|
||||
extern int Cmdline_alpha_env;
|
||||
extern int Cmdline_ambient_factor;
|
||||
extern int Cmdline_cell;
|
||||
extern int Cmdline_decals;
|
||||
extern int Cmdline_env;
|
||||
extern int Cmdline_mipmap;
|
||||
extern int Cmdline_missile_lighting;
|
||||
extern int Cmdline_noglow;
|
||||
extern int Cmdline_glow;
|
||||
extern int Cmdline_nomotiondebris;
|
||||
extern int Cmdline_noscalevid; // disables fit-to-window for movies - taylor
|
||||
extern int Cmdline_nospec;
|
||||
extern int Cmdline_spec;
|
||||
extern int Cmdline_normal;
|
||||
extern int Cmdline_glsl;
|
||||
extern int Cmdline_height;
|
||||
|
||||
// Game Speed related
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
@@ -702,7 +703,6 @@ extern int Cmdline_objupd;
|
||||
|
||||
// Troubleshooting
|
||||
extern int Cmdline_d3d_lesstmem;
|
||||
extern int Cmdline_FRED2_htl;
|
||||
extern int Cmdline_load_all_weapons;
|
||||
extern int Cmdline_nohtl;
|
||||
extern int Cmdline_noibx;
|
||||
@@ -711,7 +711,7 @@ extern int Cmdline_no_set_gamma;
|
||||
extern int Cmdline_novbo;
|
||||
extern int Cmdline_safeloading;
|
||||
extern int Cmdline_no_fbo;
|
||||
extern int Cmdline_verify_vps;
|
||||
extern int Cmdline_noglsl;
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
@@ -725,6 +725,7 @@ extern int Cmdline_show_stats;
|
||||
extern int Cmdline_timerbar;
|
||||
extern int Cmdline_save_render_targets;
|
||||
extern int Cmdline_debug_window;
|
||||
extern int Cmdline_verify_vps;
|
||||
#ifdef SCP_UNIX
|
||||
extern int Cmdline_no_grab;
|
||||
#endif
|
||||
|
||||
@@ -354,6 +354,8 @@ typedef struct config_item {
|
||||
short key_id; // actual key bound to action
|
||||
short joy_id; // joystick button bound to action
|
||||
int used; // has control been used yet in mission? If so, this is the timestamp
|
||||
|
||||
// config_item() : key_default(-1), joy_default(-1), tab(-1), hasXSTR(false), text(""), type(CC_TYPE_TRIGGER), key_id(-1), joy_id(-1), used(-1) {}
|
||||
} config_item;
|
||||
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -703,7 +703,7 @@ char *Joy_button_text_french[] = {
|
||||
"Bouton 13", "Bouton 14", "Bouton 15", "Bouton 16", "Bouton 17", "Bouton 18",
|
||||
"Bouton 19", "Bouton 20", "Bouton 21", "Bouton 22", "Bouton 23", "Bouton 24",
|
||||
"Bouton 25", "Bouton 26", "Bouton 27", "Bouton 28", "Bouton 29", "Bouton 30",
|
||||
"Bouton 31", "Bouton 32", "Chapeau Arrière", "Chapeau Avant", "Chapeau Gauche", "Chapeau Droite"
|
||||
"Bouton 31", "Bouton 32", "Chapeau Arri�re", "Chapeau Avant", "Chapeau Gauche", "Chapeau Droite"
|
||||
};
|
||||
|
||||
// This is the text that is displayed on the screen for the keys a player selects
|
||||
|
||||
@@ -560,7 +560,6 @@ void cutscenes_screen_play()
|
||||
// full_name = cf_add_ext(name, NOX(".mve"));
|
||||
|
||||
main_hall_stop_music();
|
||||
main_hall_stop_ambient();
|
||||
int rval = movie_play(name);
|
||||
main_hall_start_music();
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
#include "cutscene/cutscenes.h" // cutscene_mark_viewable()
|
||||
#include "cutscene/mvelib.h"
|
||||
#include "cutscene/oggplayer.h"
|
||||
#include "menuui/mainhallmenu.h"
|
||||
|
||||
extern int Game_mode;
|
||||
|
||||
@@ -195,6 +196,9 @@ bool movie_play(char *name)
|
||||
return false;
|
||||
}
|
||||
|
||||
// kill all background sounds
|
||||
main_hall_pause();
|
||||
|
||||
// clear the screen and hide the mouse cursor
|
||||
Mouse_hidden++;
|
||||
gr_reset_clip();
|
||||
@@ -247,8 +251,9 @@ bool movie_play(char *name)
|
||||
}
|
||||
}
|
||||
|
||||
// show the mouse cursor again
|
||||
// show the mouse cursor again, and unpause the mainhall music
|
||||
Mouse_hidden--;
|
||||
main_hall_unpause();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropenglstate.h"
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cutscene/mvelib.h"
|
||||
@@ -529,7 +530,7 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
gl_screenYH = g_screenY + g_height;
|
||||
gl_screenXW = g_screenX + g_width;
|
||||
|
||||
if (GL_texture_target == GL_TEXTURE_RECTANGLE_ARB) {
|
||||
if (GL_state.Texture.GetTarget() == GL_TEXTURE_RECTANGLE_ARB) {
|
||||
gl_screenU = (GLfloat)g_width;
|
||||
gl_screenV = (GLfloat)g_height;
|
||||
} else {
|
||||
@@ -620,9 +621,7 @@ void mve_video_display()
|
||||
}
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
glBindTexture(GL_texture_target, GLtex);
|
||||
|
||||
glTexSubImage2D(GL_texture_target, 0, 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);
|
||||
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
@@ -709,25 +708,22 @@ int mve_video_init(ubyte *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// disable everything but what we need
|
||||
opengl_switch_arb(-1, 0);
|
||||
opengl_switch_arb(0, 1);
|
||||
|
||||
gr_set_lighting(false, false);
|
||||
|
||||
glBindTexture(GL_texture_target, GLtex);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
GL_state.Texture.DisableAll();
|
||||
|
||||
GL_state.Texture.SetActiveUnit(0);
|
||||
GL_state.Texture.SetTarget(GL_texture_target);
|
||||
GL_state.Texture.Enable(GLtex);
|
||||
|
||||
GL_state.SetTextureSource(TEXTURE_SOURCE_DECAL);
|
||||
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
|
||||
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
|
||||
|
||||
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
|
||||
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
|
||||
|
||||
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
|
||||
glTexImage2D(GL_texture_target, 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
|
||||
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
|
||||
|
||||
// set our color so that we can make sure that it's correct
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
@@ -836,12 +832,10 @@ void mve_shutdown()
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glBindTexture(GL_texture_target, 0);
|
||||
GL_state.Texture.Disable();
|
||||
GL_state.Texture.Delete(GLtex);
|
||||
glDeleteTextures(1, &GLtex);
|
||||
GLtex = 0;
|
||||
|
||||
opengl_switch_arb(-1, 0);
|
||||
opengl_set_texture_target();
|
||||
}
|
||||
|
||||
if (pixelbuf != NULL) {
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropenglshader.h"
|
||||
#include "graphics/gropenglstate.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "io/key.h"
|
||||
#include "osapi/osapi.h"
|
||||
@@ -360,16 +362,6 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
g_screenHeight = tinfo->frame_height;
|
||||
|
||||
|
||||
pixelbuf = (ubyte *) vm_malloc_q(g_screenWidth * g_screenHeight * 3);
|
||||
|
||||
if (pixelbuf == NULL) {
|
||||
nprintf(("MOVIE", "ERROR: Can't allocate memory for pixelbuf"));
|
||||
video_inited = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
memset( pixelbuf, 0, g_screenWidth * g_screenHeight * 3 );
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
// set the appropriate texture target
|
||||
if ( Is_Extension_Enabled(OGL_ARB_TEXTURE_RECTANGLE) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_NON_POWER_OF_TWO) )
|
||||
@@ -387,22 +379,22 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
return;
|
||||
}
|
||||
|
||||
// disable everything but what we need
|
||||
opengl_switch_arb(-1, 0);
|
||||
opengl_switch_arb(0, 1);
|
||||
|
||||
gr_set_lighting(false, false);
|
||||
|
||||
glBindTexture(GL_texture_target, GLtex);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
GL_state.Texture.DisableAll();
|
||||
|
||||
GL_state.Texture.SetActiveUnit(0);
|
||||
GL_state.Texture.SetTarget(GL_texture_target);
|
||||
GL_state.Texture.Enable(GLtex);
|
||||
|
||||
GL_state.SetTextureSource(TEXTURE_SOURCE_DECAL);
|
||||
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
|
||||
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
|
||||
|
||||
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
|
||||
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
|
||||
|
||||
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
|
||||
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB8, wp2, hp2, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
float screen_ratio = (float)gr_screen.max_w / (float)gr_screen.max_h;
|
||||
float movie_ratio = (float)g_screenWidth / (float)g_screenHeight;
|
||||
@@ -422,17 +414,19 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
scale_video = 1;
|
||||
}
|
||||
|
||||
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
|
||||
glTexImage2D(GL_texture_target, 0, GL_RGB8, wp2, hp2, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
// set our color so that we can make sure that it's correct
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
#ifndef NO_DIRECT3D
|
||||
else if (gr_screen.mode == GR_DIRECT3D) {
|
||||
// TODO: is there a fast way to do frames in D3D too?
|
||||
|
||||
pixelbuf = (ubyte *) vm_malloc_q(g_screenWidth * g_screenHeight * 3);
|
||||
|
||||
if (pixelbuf == NULL) {
|
||||
nprintf(("MOVIE", "ERROR: Can't allocate memory for pixelbuf"));
|
||||
video_inited = 1;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
memset( pixelbuf, 0, g_screenWidth * g_screenHeight * 3 );
|
||||
|
||||
if (scale_video) {
|
||||
g_screenX = ((fl2i(gr_screen.max_w / scale_by + 0.5f) - g_screenWidth) / 2);
|
||||
@@ -448,7 +442,7 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
gl_screenYH = g_screenY + g_screenHeight;
|
||||
gl_screenXW = g_screenX + g_screenWidth;
|
||||
|
||||
if (GL_texture_target == GL_TEXTURE_RECTANGLE_ARB) {
|
||||
if (GL_state.Texture.GetTarget() == GL_TEXTURE_RECTANGLE_ARB) {
|
||||
gl_screenU = (GLfloat)wp2;
|
||||
gl_screenV = (GLfloat)hp2;
|
||||
} else {
|
||||
@@ -462,8 +456,9 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
|
||||
static void OGG_video_close()
|
||||
{
|
||||
if (!video_inited)
|
||||
if ( !video_inited ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
if (scale_video) {
|
||||
@@ -471,15 +466,13 @@ static void OGG_video_close()
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
opengl_switch_arb(-1, 0);
|
||||
|
||||
glBindTexture(GL_texture_target, 0);
|
||||
GL_state.Texture.Disable();
|
||||
GL_state.Texture.Delete(GLtex);
|
||||
glDeleteTextures(1, &GLtex);
|
||||
GLtex = 0;
|
||||
|
||||
opengl_set_texture_target();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
GLtex = 0;
|
||||
}
|
||||
|
||||
if (pixelbuf != NULL) {
|
||||
@@ -578,9 +571,7 @@ static void OGG_video_draw(theora_state *tstate)
|
||||
convert_YUV_to_RGB(&yuv);
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
glBindTexture(GL_texture_target, GLtex);
|
||||
|
||||
glTexSubImage2D(GL_texture_target, 0, 0, 0, g_screenWidth, g_screenHeight, GL_BGR, GL_UNSIGNED_BYTE, pixelbuf);
|
||||
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_screenWidth, g_screenHeight, GL_BGR, GL_UNSIGNED_BYTE, pixelbuf);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
@@ -595,8 +586,6 @@ static void OGG_video_draw(theora_state *tstate)
|
||||
glTexCoord2f(gl_screenU, 0);
|
||||
glVertex2i(gl_screenXW, g_screenY);
|
||||
glEnd();
|
||||
} else {
|
||||
// TODO: FIXME!!!
|
||||
}
|
||||
|
||||
gr_flip();
|
||||
@@ -801,7 +790,7 @@ THEORAFILE *theora_open(char *filename)
|
||||
if ( ogg_sync_pageout(&movie->osyncstate, &movie->opage) > 0 ) {
|
||||
OGG_queue_page(movie); // demux into the appropriate stream
|
||||
} else {
|
||||
int ret = OGG_buffer_data(movie); // someone needs more data
|
||||
ret = OGG_buffer_data(movie); // someone needs more data
|
||||
|
||||
if ( ret == 0 ) {
|
||||
mprintf(("Theora ERROR: End of file while searching for codec headers in '%s'!\n", lower_name));
|
||||
@@ -851,6 +840,10 @@ void theora_play(THEORAFILE *movie)
|
||||
if ( (movie == NULL) || !movie->theora_p )
|
||||
return;
|
||||
|
||||
// only OGL is supported
|
||||
if (gr_screen.mode != GR_OPENGL)
|
||||
return;
|
||||
|
||||
// open audio
|
||||
if (movie->vorbis_p)
|
||||
OGG_audio_init(&movie->vinfo);
|
||||
|
||||
@@ -47,7 +47,7 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
|
||||
// make sure there is an extension
|
||||
strcpy(real_name, filename);
|
||||
char *p = strchr(real_name, '.');
|
||||
if (p) { *p=0; }
|
||||
if (p) { *p = 0; }
|
||||
strcat(real_name, ".dds");
|
||||
|
||||
// try to open the file
|
||||
@@ -79,8 +79,9 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
|
||||
dds_header.dwMipMapCount = cfread_uint(ddsfile);
|
||||
|
||||
// skip over the crap we don't care about
|
||||
for (i = 0; i < 11; i++)
|
||||
for (i = 0; i < 11; i++) {
|
||||
trash = cfread_uint(ddsfile);
|
||||
}
|
||||
|
||||
dds_header.ddpfPixelFormat.dwSize = cfread_uint(ddsfile);
|
||||
dds_header.ddpfPixelFormat.dwFlags = cfread_uint(ddsfile);
|
||||
@@ -95,11 +96,13 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
|
||||
dds_header.ddsCaps.dwCaps2 = cfread_uint(ddsfile);
|
||||
|
||||
// sanity
|
||||
if (dds_header.dwDepth == 0)
|
||||
if (dds_header.dwDepth == 0) {
|
||||
dds_header.dwDepth = 1;
|
||||
}
|
||||
|
||||
if (dds_header.dwMipMapCount < 1)
|
||||
if (dds_header.dwMipMapCount < 1) {
|
||||
dds_header.dwMipMapCount = 1;
|
||||
}
|
||||
|
||||
d_width = dds_header.dwWidth;
|
||||
d_height = dds_header.dwHeight;
|
||||
@@ -122,11 +125,13 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
|
||||
d_width /= 2;
|
||||
d_height /= 2;
|
||||
|
||||
if (d_width <= 0)
|
||||
if (d_width <= 0) {
|
||||
d_width = 1;
|
||||
}
|
||||
|
||||
if (d_height <= 0)
|
||||
if (d_height <= 0) {
|
||||
d_height = 1;
|
||||
}
|
||||
|
||||
// size of data block (4x4)
|
||||
d_size += ((d_width + 3) / 4) * ((d_height + 3) / 4) * ((dds_header.ddpfPixelFormat.dwFourCC == FOURCC_DXT1) ? 8 : 16);
|
||||
@@ -189,14 +194,17 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
|
||||
d_height /= 2;
|
||||
d_depth /= 2;
|
||||
|
||||
if (d_width < 1)
|
||||
if (d_width < 1) {
|
||||
d_width = 1;
|
||||
}
|
||||
|
||||
if (d_height < 1)
|
||||
if (d_height < 1) {
|
||||
d_height = 1;
|
||||
}
|
||||
|
||||
if (d_depth < 1)
|
||||
if (d_depth < 1) {
|
||||
d_depth = 1;
|
||||
}
|
||||
|
||||
d_size += d_width * d_height * d_depth * (dds_header.ddpfPixelFormat.dwRGBBitCount / 8);
|
||||
}
|
||||
@@ -240,20 +248,25 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
|
||||
}
|
||||
|
||||
// stuff important info
|
||||
if (bpp)
|
||||
if (bpp) {
|
||||
*bpp = bits;
|
||||
}
|
||||
|
||||
if (compression_type)
|
||||
if (compression_type) {
|
||||
*compression_type = ct;
|
||||
}
|
||||
|
||||
if (width)
|
||||
if (width) {
|
||||
*width = dds_header.dwWidth;
|
||||
}
|
||||
|
||||
if (height)
|
||||
if (height) {
|
||||
*height = dds_header.dwHeight;
|
||||
}
|
||||
|
||||
if (levels)
|
||||
if (levels) {
|
||||
*levels = dds_header.dwMipMapCount;
|
||||
}
|
||||
|
||||
if (palette && (bits == 8)) {
|
||||
cfseek(ddsfile, DDS_OFFSET, CF_SEEK_SET);
|
||||
|
||||
@@ -46,17 +46,19 @@
|
||||
// DDS format stuff ...
|
||||
#define DDSD_LINEARSIZE 0x00080000
|
||||
#define DDSD_PITCH 0x00000008
|
||||
#define DDSD_PIXELFORMAT 0x00001000
|
||||
#define DDSD_WIDTH 0x00000004
|
||||
#define DDSD_HEIGHT 0x00000002
|
||||
#define DDSD_CAPS 0x00000001
|
||||
#define DDSD_MIPMAPCOUNT 0x00020000
|
||||
|
||||
#define DDPF_ALPHAPIXELS 0x00000001
|
||||
#define DDPF_FOURCC 0x00000004
|
||||
#define DDPF_PALETTEINDEXED4 0x00000008
|
||||
#define DDPF_PALETTEINDEXEDTO8 0x00000010
|
||||
#define DDPF_PALETTEINDEXED8 0x00000020
|
||||
#define DDPF_RGB 0x00000040
|
||||
#define DDSD_PIXELFORMAT 0x00001000
|
||||
#define DDSD_WIDTH 0x00000004
|
||||
#define DDSD_HEIGHT 0x00000002
|
||||
#define DDSD_CAPS 0x00000001
|
||||
#define DDSD_MIPMAPCOUNT 0x00020000
|
||||
#define DDPF_LUMINANCE 0x00020000
|
||||
|
||||
#define DDSCAPS_COMPLEX 0x00000008
|
||||
#define DDSCAPS_PRIMARYSURFACE 0x00000200
|
||||
|
||||
@@ -440,6 +440,7 @@ void debris_init()
|
||||
void debris_page_in()
|
||||
{
|
||||
uint i;
|
||||
char loader_name[64];
|
||||
|
||||
Debris_model = model_load( NOX("debris01.pof"), 0, NULL );
|
||||
if (Debris_model >= 0) {
|
||||
@@ -450,21 +451,22 @@ void debris_page_in()
|
||||
|
||||
Debris_vaporize_model = model_load( NOX("debris02.pof"), 0, NULL );
|
||||
|
||||
for (i=0; i<Species_info.size(); i++ )
|
||||
{
|
||||
for (i = 0; i < Species_info.size(); i++) {
|
||||
species_info *species = &Species_info[i];
|
||||
|
||||
nprintf(( "Paging", "Paging in debris texture '%s'\n", species->debris_texture.filename));
|
||||
if ( strlen(species->species_name) && (species->debris_texture.base_map.texture < 0) ) {
|
||||
memset(loader_name, 0, sizeof(loader_name));
|
||||
snprintf(loader_name, sizeof(loader_name) - 1, "Species: %s\n", species->species_name);
|
||||
|
||||
species->debris_texture.bitmap_id = bm_load(species->debris_texture.filename);
|
||||
if (species->debris_texture.bitmap_id < 0)
|
||||
{
|
||||
Warning( LOCATION, "Couldn't load species %s debris\ntexture, '%s'\n", species->species_name, species->debris_texture.filename);
|
||||
model_load_texture(&species->debris_texture, species->debris_texture_name, loader_name);
|
||||
|
||||
bm_page_in_texture(species->debris_texture.base_map.texture);
|
||||
bm_page_in_texture(species->debris_texture.glow_map.texture);
|
||||
bm_page_in_texture(species->debris_texture.spec_map.texture);
|
||||
bm_page_in_texture(species->debris_texture.norm_map.texture);
|
||||
bm_page_in_texture(species->debris_texture.height_map.texture);
|
||||
}
|
||||
|
||||
bm_page_in_texture(species->debris_texture.bitmap_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MONITOR(NumSmallDebrisRend)
|
||||
@@ -476,12 +478,12 @@ MONITOR(NumHullDebrisRend)
|
||||
//
|
||||
void debris_render(object * obj)
|
||||
{
|
||||
int i, num, swapped;
|
||||
int i, num;
|
||||
polymodel *pm;
|
||||
debris *db;
|
||||
texture_map swapped_tex;
|
||||
bool swapped = false;
|
||||
|
||||
|
||||
swapped = -1;
|
||||
pm = NULL;
|
||||
num = obj->instance;
|
||||
|
||||
@@ -491,13 +493,13 @@ void debris_render(object * obj)
|
||||
Assert(db->flags & DEBRIS_USED);
|
||||
|
||||
// Swap in a different texture depending on the species
|
||||
if (db->species >= 0)
|
||||
{
|
||||
if (db->species >= 0) {
|
||||
pm = model_get( db->model_num );
|
||||
|
||||
if ( pm && (pm->n_textures == 1) ) {
|
||||
swapped = pm->maps[0].base_map.texture;
|
||||
pm->maps[0].base_map.texture = Species_info[db->species].debris_texture.bitmap_id;
|
||||
memcpy(&swapped_tex, &pm->maps[0], sizeof(texture_map));
|
||||
memcpy(&pm->maps[0], &Species_info[db->species].debris_texture, sizeof(texture_map));
|
||||
swapped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,8 +522,8 @@ void debris_render(object * obj)
|
||||
submodel_render( db->model_num, db->submodel_num, &obj->orient, &obj->pos, MR_NO_LIGHTING );
|
||||
}
|
||||
|
||||
if ((swapped!=-1) && pm) {
|
||||
pm->maps[0].base_map.texture = swapped;
|
||||
if (swapped) {
|
||||
memcpy(&pm->maps[0], &swapped_tex, sizeof(texture_map));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -835,11 +837,11 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
// Create Debris piece n!
|
||||
if ( hull_flag ) {
|
||||
if (rand() < RAND_MAX/6) // Make some pieces blow up shortly after explosion.
|
||||
db->lifeleft = 2.0f * ((float) myrand()/(float) RAND_MAX) + 0.5f;
|
||||
db->lifeleft = 2.0f * (myrand() * RAND_MAX_1f) + 0.5f;
|
||||
else
|
||||
db->lifeleft = -1.0f; // large hull pieces stay around forever
|
||||
} else {
|
||||
db->lifeleft = (i2fl(myrand())/i2fl(RAND_MAX))*2.0f+0.1f;
|
||||
db->lifeleft = (myrand() * RAND_MAX_1f)*2.0f+0.1f;
|
||||
}
|
||||
|
||||
// increase lifetime for vaporized debris
|
||||
@@ -1396,6 +1398,7 @@ void calc_debris_physics_properties( physics_info *pi, vec3d *mins, vec3d *maxs
|
||||
|
||||
// John, with new bspgen, just set pi->mass = mass
|
||||
mass = 0.12f * dx * dy * dz;
|
||||
|
||||
pi->mass = (float) pow(mass, 0.6666667f) * 4.65f;
|
||||
|
||||
pi->I_body_inv.vec.rvec.xyz.x = 12.0f / (pi->mass * (dy*dy + dz*dz));
|
||||
|
||||
@@ -647,7 +647,7 @@ void dc_printf(char *format, ...)
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(tmp, format, args);
|
||||
vsnprintf(tmp, sizeof(tmp)-1, format, args);
|
||||
va_end(args);
|
||||
|
||||
char *p = tmp;
|
||||
|
||||
@@ -1497,3 +1497,17 @@ void fireball_get_color(int idx, float *red, float *green, float *blue)
|
||||
*green = fbi->exp_color[1];
|
||||
*blue = fbi->exp_color[2];
|
||||
}
|
||||
|
||||
int fireball_get_type(object *obj)
|
||||
{
|
||||
int num, objnum;
|
||||
fireball *fb;
|
||||
|
||||
num = obj->instance;
|
||||
objnum = OBJ_INDEX(obj);
|
||||
Assert( Fireballs[num].objnum == objnum );
|
||||
|
||||
fb = &Fireballs[num];
|
||||
|
||||
return fb->fireball_info_index;
|
||||
}
|
||||
@@ -297,14 +297,15 @@ float fireball_lifeleft( object *obj );
|
||||
// Returns life left of a fireball in percent
|
||||
float fireball_lifeleft_percent( object *obj );
|
||||
|
||||
// returns the type of fileball (the FIREBALL_* types)
|
||||
int fireball_get_type(object *obj);
|
||||
|
||||
// returns the lighting color (in [0...1] range) to use for explosion
|
||||
void fireball_get_color(int idx, float *red, float *green, float *blue);
|
||||
|
||||
// internal function to draw warp grid.
|
||||
extern void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d = 0 );
|
||||
|
||||
extern int Warp_model;
|
||||
|
||||
// Goober5000
|
||||
extern int Knossos_warp_ani_used;
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
vm_vec_scale_add2( &vecs[3], &orient->vec.rvec, -radius );
|
||||
vm_vec_scale_add2( &vecs[3], &orient->vec.fvec, Grid_depth );
|
||||
|
||||
// vm_vec_scale_add( &vecs[4], ¢er, &orient->vec.fvec, -Grid_depth );
|
||||
// vm_vec_scale_add( &vecs[4], ¢er, &orient->vec.fvec, -Grid_depth );
|
||||
vecs[4] = center;
|
||||
|
||||
verts[0].u = 0.01f; verts[0].v = 0.01f;
|
||||
|
||||
@@ -374,7 +374,7 @@ void bg_bitmap_dlg::create()
|
||||
box->AddString(Nebula_colors[i]);
|
||||
}
|
||||
|
||||
m_slider.SetRange(0, MAX_STARS);
|
||||
m_slider.SetRange(100, MAX_STARS);
|
||||
m_slider.SetPos(Num_stars);
|
||||
sprintf(buf, "%d", Num_stars);
|
||||
GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
|
||||
@@ -1384,18 +1384,15 @@ void bg_bitmap_dlg::OnImportBackground()
|
||||
Mp = saved_mp;
|
||||
|
||||
// pick one (if count is 0, it's retail with just one background)
|
||||
if (count > 0)
|
||||
if (count > 1)
|
||||
{
|
||||
int i, which = 0;
|
||||
int i, which;
|
||||
|
||||
if (count > 1)
|
||||
{
|
||||
BackgroundChooser dlg(count);
|
||||
if (dlg.DoModal() == IDCANCEL)
|
||||
return;
|
||||
BackgroundChooser dlg(count);
|
||||
if (dlg.DoModal() == IDCANCEL)
|
||||
return;
|
||||
|
||||
which = dlg.GetChosenBackground();
|
||||
}
|
||||
which = dlg.GetChosenBackground();
|
||||
|
||||
for (i = 0; i < which + 1; i++)
|
||||
skip_to_string("$Bitmap List:");
|
||||
|
||||
@@ -90,26 +90,21 @@ IDB_CHAINED_DIRECTIVE BITMAP MOVEABLE PURE "res\\chained_directive.bmp"
|
||||
IDB_GREEN_DOT BITMAP MOVEABLE PURE "res\\green_do.bmp"
|
||||
IDB_BLACK_DOT BITMAP MOVEABLE PURE "res\\black_do.bmp"
|
||||
IDB_VARIABLE BITMAP MOVEABLE PURE "res\\variable.bmp"
|
||||
IDB_DATA_12 BITMAP MOVEABLE PURE "res\\data12.bmp"
|
||||
IDB_DATA_02 BITMAP MOVEABLE PURE "res\\data02.bmp"
|
||||
IDB_DATA_03 BITMAP MOVEABLE PURE "res\\data03.bmp"
|
||||
IDB_DATA_04 BITMAP MOVEABLE PURE "res\\data04.bmp"
|
||||
IDB_DATA_05 BITMAP MOVEABLE PURE "res\\data05.bmp"
|
||||
IDB_DATA_00 BITMAP MOVEABLE PURE "res\\data00.bmp"
|
||||
IDB_DATA_06 BITMAP MOVEABLE PURE "res\\data06.bmp"
|
||||
IDB_DATA_07 BITMAP MOVEABLE PURE "res\\data07.bmp"
|
||||
IDB_DATA_08 BITMAP MOVEABLE PURE "res\\data08.bmp"
|
||||
IDB_DATA_09 BITMAP MOVEABLE PURE "res\\data09.bmp"
|
||||
IDB_DATA_10 BITMAP MOVEABLE PURE "res\\data10.bmp"
|
||||
IDB_DATA_11 BITMAP MOVEABLE PURE "res\\data11.bmp"
|
||||
IDB_DATA_01 BITMAP MOVEABLE PURE "res\\data01.bmp"
|
||||
IDB_DATA_15 BITMAP MOVEABLE PURE "res\\data15.bmp"
|
||||
IDB_DATA_20 BITMAP MOVEABLE PURE "res\\data20.bmp"
|
||||
IDB_DATA_25 BITMAP MOVEABLE PURE "res\\data25.bmp"
|
||||
IDB_DATA_30 BITMAP MOVEABLE PURE "res\\data30.bmp"
|
||||
IDB_DATA_35 BITMAP MOVEABLE PURE "res\\data35.bmp"
|
||||
IDB_DATA_40 BITMAP MOVEABLE PURE "res\\data40.bmp"
|
||||
IDB_DATA_45 BITMAP MOVEABLE PURE "res\\data45.bmp"
|
||||
IDB_DATA_50 BITMAP MOVEABLE PURE "res\\data50.bmp"
|
||||
IDB_DATA_55 BITMAP MOVEABLE PURE "res\\data55.bmp"
|
||||
IDB_DATA_60 BITMAP MOVEABLE PURE "res\\data60.bmp"
|
||||
IDB_DATA_65 BITMAP MOVEABLE PURE "res\\data65.bmp"
|
||||
IDB_DATA_70 BITMAP MOVEABLE PURE "res\\data70.bmp"
|
||||
IDB_DATA_75 BITMAP MOVEABLE PURE "res\\data75.bmp"
|
||||
IDB_DATA_80 BITMAP MOVEABLE PURE "res\\data80.bmp"
|
||||
IDB_DATA_85 BITMAP MOVEABLE PURE "res\\data85.bmp"
|
||||
IDB_DATA_90 BITMAP MOVEABLE PURE "res\\data90.bmp"
|
||||
IDB_DATA_95 BITMAP MOVEABLE PURE "res\\data95.bmp"
|
||||
IDB_DATA_14 BITMAP MOVEABLE PURE "res\\data14.bmp"
|
||||
IDB_DATA_13 BITMAP MOVEABLE PURE "res\\data13.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -878,19 +873,13 @@ BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,355,184,50,14
|
||||
END
|
||||
|
||||
IDD_MISSION_NOTES DIALOG DISCARDABLE 0, 0, 479, 327
|
||||
IDD_MISSION_NOTES DIALOGEX 0, 0, 464, 324
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Mission Specs"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
RTEXT "Title",IDC_STATIC,7,10,29,8
|
||||
EDITTEXT IDC_MISSION_TITLE,41,7,109,14,ES_AUTOHSCROLL
|
||||
RTEXT "Designer",IDC_STATIC,7,25,29,8
|
||||
EDITTEXT IDC_DESIGNER_NAME,41,23,109,14,ES_AUTOHSCROLL
|
||||
RTEXT "Created:",IDC_STATIC,23,42,28,8
|
||||
LTEXT "xx/xx/xx",IDC_CREATED,57,42,91,8
|
||||
RTEXT "Last Modified:",IDC_STATIC,7,51,45,8
|
||||
LTEXT "xx/xx/xx",IDC_MODIFIED,57,51,92,8
|
||||
CONTROL "Single Player",IDC_SINGLE,"Button",BS_AUTORADIOBUTTON |
|
||||
WS_GROUP,7,63,57,10
|
||||
CONTROL "Multi Player",IDC_MULTI,"Button",BS_AUTORADIOBUTTON,7,
|
||||
@@ -903,100 +892,100 @@ BEGIN
|
||||
BS_AUTORADIOBUTTON,76,72,66,10
|
||||
CONTROL "Dogfight",IDC_DOGFIGHT,"Button",BS_AUTORADIOBUTTON,76,
|
||||
81,43,10
|
||||
LTEXT "Max Respawns",IDC_STATIC,8,97,52,8
|
||||
EDITTEXT IDC_RESPAWNS,86,94,50,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_RESPAWNS,92,94,50,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "Spin1",IDC_RESPAWN_SPIN,"msctls_updown32",
|
||||
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
|
||||
UDS_ARROWKEYS,136,94,11,14
|
||||
PUSHBUTTON "Custom Wing Names",IDC_CUSTOM_WING_NAMES,10,115,128,14
|
||||
GROUPBOX "Squadron Reassign",IDC_STATIC,2,136,148,44
|
||||
LTEXT "Name",IDC_STATIC,14,147,28,8
|
||||
EDITTEXT IDC_SQUAD_NAME,48,147,98,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Logo",IDC_SQUAD_LOGO_BUTTON,8,161,31,14
|
||||
EDITTEXT IDC_SQUAD_LOGO,48,161,98,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
GROUPBOX "Loading Screen",IDC_STATIC,2,185,148,46
|
||||
PUSHBUTTON "640x480",IDC_LOADING_SCREEN_BUTTON640,7,197,40,14
|
||||
EDITTEXT IDC_LOADING_SCREEN640,47,197,97,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "1024x768",IDC_LOADING_SCREEN_BUTTON1024,7,213,40,16
|
||||
EDITTEXT IDC_LOADING_SCREEN1024,47,213,97,16,ES_AUTOHSCROLL
|
||||
GROUPBOX "Support Ships",IDC_STATIC,160,6,152,71
|
||||
CONTROL "Disallow Support Ships",IDC_SUPPORT_ALLOWED,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,164,16,95,10
|
||||
CONTROL "Support Ships Repair Hull",IDC_SUPPORT_REPAIRS_HULL,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,164,27,123,10
|
||||
LTEXT "Hull Repair Ceiling",IDC_STATIC,164,43,60,8
|
||||
EDITTEXT IDC_MAX_HULL_REPAIR_VAL,244,41,49,14,ES_AUTOHSCROLL
|
||||
LTEXT "%",IDC_STATIC,298,46,8,8
|
||||
LTEXT "Subsytem Repair Ceiling",IDC_STATIC,164,64,75,8
|
||||
EDITTEXT IDC_MAX_SUBSYS_REPAIR_VAL,244,59,49,14,ES_AUTOHSCROLL
|
||||
LTEXT "%",IDC_STATIC,298,60,8,8
|
||||
GROUPBOX "Ship Trails",IDC_STATIC,160,81,154,41
|
||||
CONTROL "Toggle (off in nebula; on elsewhere)",
|
||||
IDC_SPECS_TOGGLE_TRAILS,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,162,92,141,10
|
||||
CONTROL "Minimium speed to display",IDC_CONTRAIL_THRESHOLD_CHECK,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,103,93,10
|
||||
EDITTEXT IDC_CONTRAIL_THRESHOLD,262,102,48,14,ES_READONLY
|
||||
GROUPBOX "Built-in Command Messages",IDC_STATIC,158,131,154,46
|
||||
LTEXT "Sender",IDC_STATIC,165,145,40,8
|
||||
COMBOBOX IDC_COMMAND_SENDER,209,143,99,140,CBS_DROPDOWN |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Persona",IDC_STATIC,165,161,40,8
|
||||
COMBOBOX IDC_COMMAND_PERSONA,209,160,99,140,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
GROUPBOX "Mission Music",IDC_STATIC,157,188,154,47
|
||||
LTEXT "Default",IDC_STATIC,161,200,40,8
|
||||
COMBOBOX IDC_EVENT_MUSIC,207,199,99,140,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "If music pack is present",IDC_STATIC,161,213,43,16
|
||||
COMBOBOX IDC_SUBSTITUTE_EVENT_MUSIC,207,215,99,140,CBS_DROPDOWN |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
GROUPBOX "Flags",IDC_STATIC,321,20,154,198
|
||||
UDS_ARROWKEYS,142,94,11,14
|
||||
PUSHBUTTON "Custom Wing Names",IDC_CUSTOM_WING_NAMES,13,115,136,14
|
||||
EDITTEXT IDC_SQUAD_NAME,356,124,98,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Logo",IDC_SQUAD_LOGO_BUTTON,316,139,31,14
|
||||
EDITTEXT IDC_SQUAD_LOGO,356,139,98,14,ES_AUTOHSCROLL |
|
||||
ES_READONLY
|
||||
PUSHBUTTON "640x480",IDC_LOADING_SCREEN_BUTTON640,317,284,40,14
|
||||
EDITTEXT IDC_LOADING_SCREEN640,357,284,97,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "1024x768",IDC_LOADING_SCREEN_BUTTON1024,317,300,40,16
|
||||
EDITTEXT IDC_LOADING_SCREEN1024,357,300,97,16,ES_AUTOHSCROLL
|
||||
CONTROL "All Teams at War",IDC_FULL_WAR,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,326,31,72,10
|
||||
WS_TABSTOP,165,22,72,10
|
||||
CONTROL "Red Alert Mission",IDC_RED_ALERT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,326,41,78,10
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,165,33,78,10
|
||||
CONTROL "Scramble Mission",IDC_SCRAMBLE,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,326,51,72,10
|
||||
WS_TABSTOP,165,42,72,10
|
||||
CONTROL "No Briefing",IDC_NO_BRIEFING,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,165,52,72,10
|
||||
CONTROL "No Debriefing",IDC_NO_DEBRIEFING,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,165,62,72,10
|
||||
CONTROL "Disallow Promotions/Badges",IDC_NO_PROMOTION,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,326,61,106,10
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,165,73,106,10
|
||||
CONTROL "Disable Built-in Messages",IDC_DISABLE_BUILTIN_MSGS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,71,123,10
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,82,123,10
|
||||
CONTROL "Disable Built-in Command Messages",
|
||||
IDC_DISABLE_BUILTIN_COMMAND_MSGS,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,326,81,129,10
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,165,92,129,10
|
||||
CONTROL "No Traitor",IDC_NO_TRAITOR,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,326,91,123,10
|
||||
WS_TABSTOP,165,102,123,10
|
||||
CONTROL "All Ships Beam-Freed By Default",
|
||||
IDC_BEAM_FREE_ALL_BY_DEFAULT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,326,101,123,10
|
||||
WS_TABSTOP,304,38,123,10
|
||||
CONTROL "Allow Daisy-Chained Docking",IDC_ALLOW_DOCK_TREES,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,111,123,10
|
||||
CONTROL "No Briefing",IDC_NO_BRIEFING,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,326,121,72,10
|
||||
CONTROL "No Debriefing",IDC_NO_DEBRIEFING,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,326,131,72,10
|
||||
CONTROL "Use Autopilot Cinematics",IDC_USE_AUTOPILOT_CINEMATICS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,141,123,10
|
||||
CONTROL "Deactivate Hardcoded Autopilot",
|
||||
IDC_DEACTIVATE_AUTOPILOT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,326,151,123,10
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,304,47,123,10
|
||||
CONTROL "Disallow Support Ships",IDC_SUPPORT_ALLOWED,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,309,168,95,10
|
||||
CONTROL "Support Ships Repair Hull",IDC_SUPPORT_REPAIRS_HULL,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,179,123,10
|
||||
EDITTEXT IDC_MAX_HULL_REPAIR_VAL,389,193,59,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_MAX_SUBSYS_REPAIR_VAL,389,211,59,14,ES_AUTOHSCROLL
|
||||
CONTROL "Toggle (off in nebula; on elsewhere)",
|
||||
IDC_SPECS_TOGGLE_TRAILS,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,309,242,141,10
|
||||
CONTROL "Minimium speed to display",IDC_CONTRAIL_THRESHOLD_CHECK,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,253,93,10
|
||||
EDITTEXT IDC_CONTRAIL_THRESHOLD,411,252,48,14,ES_READONLY
|
||||
COMBOBOX IDC_AI_PROFILE,59,134,93,140,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_EVENT_MUSIC,211,134,93,140,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_SUBSTITUTE_EVENT_MUSIC,211,150,93,140,CBS_DROPDOWN |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
EDITTEXT IDC_MISSION_DESC,0,182,299,57,ES_MULTILINE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
EDITTEXT IDC_MISSION_NOTES,1,254,297,57,ES_MULTILINE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
DEFPUSHBUTTON "OK",IDOK,347,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,403,7,50,14
|
||||
LTEXT "Max Respawns",IDC_STATIC,8,97,52,8
|
||||
RTEXT "Title",IDC_STATIC,7,10,29,8
|
||||
RTEXT "Designer Notes",IDC_STATIC,1,243,50,8
|
||||
LTEXT "xx/xx/xx",IDC_MODIFIED,57,51,101,8
|
||||
RTEXT "Designer",IDC_STATIC,7,25,29,8
|
||||
RTEXT "Created:",IDC_STATIC,23,42,28,8
|
||||
LTEXT "xx/xx/xx",IDC_CREATED,57,42,103,8
|
||||
RTEXT "Last Modified:",IDC_STATIC,7,51,45,8
|
||||
LTEXT "Mission Description",IDC_STATIC,0,170,62,8
|
||||
LTEXT "Music",IDC_STATIC,153,137,32,8
|
||||
GROUPBOX "Squadron Reassign",IDC_STATIC,310,114,150,44
|
||||
LTEXT "Name",IDC_STATIC,322,125,28,8
|
||||
GROUPBOX "Loading Screen",IDC_STATIC,309,274,151,46
|
||||
GROUPBOX "Support Ships",IDC_STATIC,305,158,154,71
|
||||
LTEXT "Hull Repair Ceiling",IDC_STATIC,309,195,60,8
|
||||
LTEXT "Subsytem Repair Ceiling",IDC_STATIC,309,216,75,8
|
||||
LTEXT "%",IDC_STATIC,452,196,8,8
|
||||
LTEXT "%",IDC_STATIC,452,210,8,8
|
||||
GROUPBOX "Ship Trails",IDC_STATIC,306,231,154,41
|
||||
LTEXT "Substitute Music",IDC_STATIC,153,153,52,8
|
||||
LTEXT "AI Profile",IDC_STATIC,1,137,32,8
|
||||
CONTROL "Player Starts under AI Control (NO MULTI)",
|
||||
IDC_PLAYER_START_AI,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,326,161,146,10
|
||||
WS_TABSTOP,3,153,149,10
|
||||
CONTROL "Use Autopilot Cinematics",IDC_USE_AUTOPILOT_CINEMATICS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,304,58,123,10
|
||||
CONTROL "2D Mission",IDC_2D_MISSION,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,326,171,123,10
|
||||
LTEXT "AI Profile",IDC_STATIC,320,229,32,8
|
||||
COMBOBOX IDC_AI_PROFILE,378,226,93,140,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Mission Description",IDC_STATIC,4,238,62,8
|
||||
EDITTEXT IDC_MISSION_DESC,4,250,471,29,ES_MULTILINE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
RTEXT "Designer Notes",IDC_STATIC,2,284,50,8
|
||||
EDITTEXT IDC_MISSION_NOTES,3,294,472,29,ES_MULTILINE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
DEFPUSHBUTTON "OK",IDOK,368,0,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,424,0,50,14
|
||||
WS_TABSTOP,304,70,123,10
|
||||
CONTROL "Deactivate Hardcoded Autopilot",
|
||||
IDC_DEACTIVATE_AUTOPILOT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,304,81,123,10
|
||||
LTEXT "Retail Flags:",IDC_STATIC,167,7,40,8
|
||||
LTEXT "FS2 Open Flags",IDC_STATIC,304,25,52,8
|
||||
END
|
||||
|
||||
IDD_PREFERENCES DIALOG DISCARDABLE 0, 0, 333, 81
|
||||
@@ -1928,11 +1917,11 @@ BEGIN
|
||||
ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
|
||||
END
|
||||
|
||||
IDD_BRIEFING_EDITOR DIALOGEX 0, 0, 258, 417
|
||||
IDD_BRIEFING_EDITOR DIALOGEX 0, 0, 258, 407
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Briefing Editor"
|
||||
MENU IDR_PLAYER_EDIT_MENU
|
||||
FONT 8, "MS Sans Serif"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
PUSHBUTTON "Prev",IDC_PREV,147,7,23,14,0,WS_EX_STATICEDGE
|
||||
PUSHBUTTON "Next",IDC_NEXT,173,7,23,14,0,WS_EX_STATICEDGE
|
||||
@@ -1954,58 +1943,57 @@ BEGIN
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,38,69,10
|
||||
CONTROL "Cut to previous stage",IDC_CUT_PREV,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,47,83,10
|
||||
EDITTEXT IDC_TEXT,7,72,244,40,ES_MULTILINE | ES_AUTOVSCROLL |
|
||||
EDITTEXT IDC_TEXT,7,75,244,40,ES_MULTILINE | ES_AUTOVSCROLL |
|
||||
ES_WANTRETURN
|
||||
EDITTEXT IDC_VOICE,63,115,83,13,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse",IDC_BROWSE,150,115,42,14,0,WS_EX_STATICEDGE
|
||||
PUSHBUTTON "IDB_PLAY",IDC_PLAY,194,115,13,14,BS_BITMAP,
|
||||
EDITTEXT IDC_VOICE,63,118,83,13,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse",IDC_BROWSE,150,118,42,14,0,WS_EX_STATICEDGE
|
||||
PUSHBUTTON "IDB_PLAY",IDC_PLAY,194,118,13,14,BS_BITMAP,
|
||||
WS_EX_TRANSPARENT | WS_EX_STATICEDGE
|
||||
COMBOBOX IDC_BRIEFING_MUSIC,70,142,83,135,CBS_DROPDOWNLIST |
|
||||
COMBOBOX IDC_BRIEFING_MUSIC,63,134,83,135,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_SUBSTITUTE_BRIEFING_MUSIC,70,159,83,135,CBS_DROPDOWN |
|
||||
COMBOBOX IDC_SUBSTITUTE_BRIEFING_MUSIC,63,151,83,135,CBS_DROPDOWN |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Tree1",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS |
|
||||
TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS |
|
||||
WS_BORDER | WS_TABSTOP,7,190,244,71,WS_EX_CLIENTEDGE
|
||||
WS_BORDER | WS_TABSTOP,7,181,244,71,WS_EX_CLIENTEDGE
|
||||
CONTROL "Draw lines between marked icons",IDC_LINES,"Button",
|
||||
BS_3STATE | WS_TABSTOP,129,264,122,10
|
||||
EDITTEXT IDC_ICON_LABEL,51,288,75,14,ES_AUTOHSCROLL
|
||||
COMBOBOX IDC_ICON_IMAGE,52,304,75,135,CBS_DROPDOWNLIST |
|
||||
BS_3STATE | WS_TABSTOP,129,255,122,10
|
||||
EDITTEXT IDC_ICON_LABEL,51,277,75,14,ES_AUTOHSCROLL
|
||||
COMBOBOX IDC_ICON_IMAGE,52,293,75,135,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_SHIP_TYPE,52,320,75,145,CBS_DROPDOWNLIST |
|
||||
COMBOBOX IDC_SHIP_TYPE,52,309,75,145,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_TEAM,52,336,75,84,CBS_DROPDOWNLIST | WS_VSCROLL |
|
||||
COMBOBOX IDC_TEAM,52,325,75,84,CBS_DROPDOWNLIST | WS_VSCROLL |
|
||||
WS_TABSTOP
|
||||
EDITTEXT IDC_ID,151,284,30,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_ID,151,273,30,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "Highlight",IDC_HILIGHT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,135,302,43,10
|
||||
WS_TABSTOP,135,291,43,10
|
||||
CONTROL "Change locally",IDC_LOCAL,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,135,319,62,10
|
||||
WS_TABSTOP,135,308,62,10
|
||||
CONTROL "Flip Icon",IDC_FLIP_ICON,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,136,335,43,10
|
||||
PUSHBUTTON "Make Icon",IDC_MAKE_ICON,197,283,50,14,0,
|
||||
WS_TABSTOP,136,324,43,10
|
||||
PUSHBUTTON "Make Icon",IDC_MAKE_ICON,197,272,50,14,0,
|
||||
WS_EX_STATICEDGE
|
||||
PUSHBUTTON "Delete Icon",IDC_DELETE_ICON,197,300,50,14,0,
|
||||
PUSHBUTTON "Delete Icon",IDC_DELETE_ICON,197,289,50,14,0,
|
||||
WS_EX_STATICEDGE
|
||||
PUSHBUTTON "Propagate",IDC_PROPAGATE_ICONS,197,317,50,14,0,
|
||||
PUSHBUTTON "Propagate",IDC_PROPAGATE_ICONS,197,306,50,14,0,
|
||||
WS_EX_STATICEDGE
|
||||
EDITTEXT IDC_ICON_TEXT,14,363,230,40,ES_MULTILINE |
|
||||
EDITTEXT IDC_ICON_TEXT,14,352,230,40,ES_MULTILINE |
|
||||
ES_AUTOVSCROLL | ES_WANTRETURN
|
||||
LTEXT "Stage 1 of 9",IDC_STAGE_TITLE,7,7,53,8
|
||||
GROUPBOX "Current Icon Info",IDC_STATIC,7,274,244,136
|
||||
LTEXT "Label",IDC_STATIC,13,291,18,8
|
||||
LTEXT "Icon image",IDC_STATIC,13,307,36,8
|
||||
LTEXT "Text",IDC_STATIC,7,62,15,8
|
||||
GROUPBOX "Current Icon Info",IDC_STATIC,7,264,244,136
|
||||
LTEXT "Label",IDC_STATIC,13,280,18,8
|
||||
LTEXT "Icon image",IDC_STATIC,13,296,36,8
|
||||
LTEXT "Text",IDC_STATIC,7,65,15,8
|
||||
LTEXT "Camera Transition Time (ms)",IDC_STATIC,7,25,90,8
|
||||
LTEXT "Voice Wave File",IDC_STATIC,7,117,53,8
|
||||
LTEXT "Text",IDC_STATIC,14,352,15,8
|
||||
LTEXT "Team",IDC_STATIC,13,339,19,8
|
||||
LTEXT "Ship Type",IDC_STATIC,13,323,33,8
|
||||
LTEXT "ID",IDC_STATIC,137,286,8,8
|
||||
LTEXT "Default",IDC_STATIC,14,144,24,8
|
||||
LTEXT "Usage Formula",IDC_STATIC,7,180,48,8
|
||||
LTEXT "If music pack is present",IDC_STATIC,14,157,44,17
|
||||
GROUPBOX "Briefing Music",IDC_STATIC,7,132,150,44
|
||||
LTEXT "Voice Wave File",IDC_STATIC,7,120,53,8
|
||||
LTEXT "Text",IDC_STATIC,14,341,15,8
|
||||
LTEXT "Team",IDC_STATIC,13,328,19,8
|
||||
LTEXT "Ship Type",IDC_STATIC,13,312,33,8
|
||||
LTEXT "ID",IDC_STATIC,137,275,8,8
|
||||
LTEXT "Briefing Music",IDC_STATIC,7,137,45,8
|
||||
LTEXT "Usage Formula",IDC_STATIC,7,171,48,8
|
||||
LTEXT "Substitute Music",IDC_STATIC,7,154,53,8
|
||||
END
|
||||
|
||||
IDD_IGNORE_ORDERS DIALOG DISCARDABLE 0, 0, 120, 217
|
||||
@@ -2568,8 +2556,8 @@ BEGIN
|
||||
|
||||
IDD_MISSION_NOTES, DIALOG
|
||||
BEGIN
|
||||
RIGHTMARGIN, 475
|
||||
BOTTOMMARGIN, 323
|
||||
RIGHTMARGIN, 460
|
||||
BOTTOMMARGIN, 320
|
||||
END
|
||||
|
||||
IDD_PREFERENCES, DIALOG
|
||||
@@ -2743,7 +2731,7 @@ BEGIN
|
||||
RIGHTMARGIN, 251
|
||||
VERTGUIDE, 136
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 410
|
||||
BOTTOMMARGIN, 400
|
||||
END
|
||||
|
||||
IDD_IGNORE_ORDERS, DIALOG
|
||||
|
||||
@@ -2342,16 +2342,23 @@ void inc_mission_time()
|
||||
fix thistime;
|
||||
|
||||
thistime = timer_get_fixed_seconds();
|
||||
if (!lasttime)
|
||||
if ( !lasttime ) {
|
||||
Frametime = F1_0 / 30;
|
||||
else
|
||||
} else {
|
||||
Frametime = thistime - lasttime;
|
||||
}
|
||||
|
||||
if (Frametime > MAX_FRAMETIME)
|
||||
if (Frametime > MAX_FRAMETIME) {
|
||||
Frametime = MAX_FRAMETIME;
|
||||
} else if (Frametime < MIN_FRAMETIME) {
|
||||
if ( !Cmdline_NoFPSCap ) {
|
||||
thistime = MIN_FRAMETIME - Frametime;
|
||||
Sleep( DWORD(f2fl(thistime) * 1000.0f) );
|
||||
thistime = timer_get_fixed_seconds();
|
||||
}
|
||||
|
||||
if (Frametime < MIN_FRAMETIME)
|
||||
Frametime = MIN_FRAMETIME;
|
||||
}
|
||||
|
||||
Missiontime += Frametime;
|
||||
lasttime = thistime;
|
||||
|
||||
@@ -505,7 +505,7 @@ char **Builtin_mission_names;
|
||||
char *Game_current_mission_filename;
|
||||
CFILE *Working_demo;
|
||||
struct beam_info;
|
||||
bool cube_map_drawen=false;
|
||||
bool Env_cubemap_drawn = false;
|
||||
int Multi_ping_timestamp = -1;
|
||||
int Sun_drew = 0;
|
||||
int Networking_disabled = 0;
|
||||
|
||||
@@ -1828,17 +1828,8 @@ void CFREDView::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
CView::OnSize(nType, cx, cy);
|
||||
|
||||
if(cy > 0)
|
||||
{
|
||||
gr_init_res(GR_640,GR_OPENGL, cx,cy);
|
||||
|
||||
glViewport(0, 0, cx, cy);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, gr_screen.max_w, gr_screen.max_h,0, 0.0, 1.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
if (cy > 0) {
|
||||
gr_screen_resize(cx, cy);
|
||||
RedrawWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,12 +902,12 @@ bool fred_init()
|
||||
snd_init(0, 0, 44100, 16);
|
||||
|
||||
// Not ready for this yet
|
||||
// Cmdline_nospec = 1;
|
||||
// Cmdline_noglow = 1;
|
||||
// Cmdline_spec = 0;
|
||||
// Cmdline_glow = 0;
|
||||
Cmdline_window = 1;
|
||||
DBUGFILE_OUTPUT_0("About to gr_init");
|
||||
|
||||
gr_init(GR_640, GR_OPENGL, 32, 640, 480);
|
||||
gr_init(GR_OPENGL, 640, 480, 32);
|
||||
|
||||
Mouse_hidden = 1;
|
||||
|
||||
@@ -1572,10 +1572,6 @@ void clear_mission()
|
||||
|
||||
The_mission.contrail_threshold = CONTRAIL_THRESHOLD_DEFAULT;
|
||||
|
||||
// Goober5000
|
||||
The_mission.command_persona = Default_command_persona;
|
||||
strcpy(The_mission.command_sender, DEFAULT_COMMAND);
|
||||
|
||||
// Goober5000: reset ALL mission flags, not just nebula!
|
||||
The_mission.flags = 0;
|
||||
The_mission.support_ships.max_support_ships = -1; // negative means infinite
|
||||
|
||||
@@ -266,7 +266,6 @@
|
||||
#include "gamesnd/eventmusic.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "mission/missionmessage.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
@@ -298,8 +297,6 @@ CMissionNotesDlg::CMissionNotesDlg(CWnd* pParent /*=NULL*/) : CDialog(CMissionNo
|
||||
m_ai_profile = -1;
|
||||
m_event_music = -1;
|
||||
m_substitute_event_music = _T("");
|
||||
m_command_persona = -1;
|
||||
m_command_sender = _T("");
|
||||
m_full_war = FALSE;
|
||||
m_red_alert = FALSE;
|
||||
m_scramble = FALSE;
|
||||
@@ -344,8 +341,6 @@ void CMissionNotesDlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_CBIndex(pDX, IDC_AI_PROFILE, m_ai_profile);
|
||||
DDX_CBIndex(pDX, IDC_EVENT_MUSIC, m_event_music);
|
||||
DDX_Text(pDX, IDC_SUBSTITUTE_EVENT_MUSIC, m_substitute_event_music);
|
||||
DDX_CBIndex(pDX, IDC_COMMAND_PERSONA, m_command_persona);
|
||||
DDX_Text(pDX, IDC_COMMAND_SENDER, m_command_sender);
|
||||
DDX_Check(pDX, IDC_FULL_WAR, m_full_war);
|
||||
DDX_Check(pDX, IDC_RED_ALERT, m_red_alert);
|
||||
DDX_Check(pDX, IDC_SCRAMBLE, m_scramble);
|
||||
@@ -614,12 +609,6 @@ void CMissionNotesDlg::OnOK()
|
||||
MODIFY(Current_soundtrack_num, m_event_music - 1);
|
||||
strcpy(The_mission.substitute_event_music_name, m_substitute_event_music);
|
||||
|
||||
MODIFY(The_mission.command_persona, ((CComboBox *) GetDlgItem(IDC_COMMAND_PERSONA))->GetItemData(m_command_persona));
|
||||
if (m_command_sender.GetAt(0) == '#')
|
||||
strcpy(The_mission.command_sender, m_command_sender.Mid(1));
|
||||
else
|
||||
strcpy(The_mission.command_sender, m_command_sender);
|
||||
|
||||
MODIFY(Mission_all_attack, m_full_war);
|
||||
if (query_modified()){
|
||||
set_modified();
|
||||
@@ -644,7 +633,7 @@ void CMissionNotesDlg::OnCancel()
|
||||
|
||||
BOOL CMissionNotesDlg::OnInitDialog()
|
||||
{
|
||||
int i, box_index = 0, mission_command_persona_box_index = -1;
|
||||
int i;
|
||||
CComboBox *box;
|
||||
CEdit *edit;
|
||||
|
||||
@@ -661,7 +650,6 @@ BOOL CMissionNotesDlg::OnInitDialog()
|
||||
m_mission_desc_orig = m_mission_desc = convert_multiline_string(The_mission.mission_desc);
|
||||
m_red_alert = (The_mission.flags & MISSION_FLAG_RED_ALERT) ? 1 : 0;
|
||||
m_scramble = (The_mission.flags & MISSION_FLAG_SCRAMBLE) ? 1 : 0;
|
||||
m_full_war = Mission_all_attack;
|
||||
m_daisy_chained_docking = (The_mission.flags & MISSION_FLAG_ALLOW_DOCK_TREES) ? 1 : 0;
|
||||
m_disallow_support = (The_mission.support_ships.max_support_ships == 0) ? 1 : 0;
|
||||
m_no_promotion = (The_mission.flags & MISSION_FLAG_NO_PROMOTION) ? 1 : 0;
|
||||
@@ -700,25 +688,6 @@ BOOL CMissionNotesDlg::OnInitDialog()
|
||||
box->AddString(Soundtracks[i].name);
|
||||
}
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_COMMAND_PERSONA);
|
||||
for (i=0; i<Num_personas; i++){
|
||||
if (Personas[i].flags & PERSONA_FLAG_COMMAND){
|
||||
box->AddString(Personas[i].name);
|
||||
box->SetItemData(box_index, i);
|
||||
if (i == The_mission.command_persona)
|
||||
mission_command_persona_box_index = box_index;
|
||||
box_index++;
|
||||
}
|
||||
}
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_COMMAND_SENDER);
|
||||
box->AddString(DEFAULT_COMMAND);
|
||||
for (i=0; i<MAX_SHIPS; i++){
|
||||
if (Ships[i].objnum >= 0)
|
||||
if (Ship_info[Ships[i].ship_info_index].flags & SIF_HUGE_SHIP)
|
||||
box->AddString(Ships[i].ship_name);
|
||||
}
|
||||
|
||||
// squad info
|
||||
if(strlen(The_mission.squad_name) > 0){
|
||||
m_squad_name = _T(The_mission.squad_name);
|
||||
@@ -730,12 +699,9 @@ BOOL CMissionNotesDlg::OnInitDialog()
|
||||
|
||||
m_type = The_mission.game_type;
|
||||
m_ai_profile = (The_mission.ai_profile - Ai_profiles);
|
||||
|
||||
m_event_music = Current_soundtrack_num + 1;
|
||||
m_substitute_event_music = The_mission.substitute_event_music_name;
|
||||
|
||||
m_command_persona = mission_command_persona_box_index;
|
||||
m_command_sender = The_mission.command_sender;
|
||||
m_full_war = Mission_all_attack;
|
||||
|
||||
// set up the game type checkboxes accoring to m_type
|
||||
if ( m_type & MISSION_TYPE_SINGLE ){
|
||||
|
||||
@@ -211,8 +211,6 @@ public:
|
||||
int m_ai_profile;
|
||||
int m_event_music;
|
||||
CString m_substitute_event_music;
|
||||
int m_command_persona;
|
||||
CString m_command_sender;
|
||||
BOOL m_full_war;
|
||||
BOOL m_red_alert;
|
||||
BOOL m_scramble;
|
||||
|
||||
@@ -141,15 +141,11 @@
|
||||
#include "ship/ship.h"
|
||||
#include "object/waypoint.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define BACKUP_DEPTH 9
|
||||
|
||||
class CFred_mission_save {
|
||||
private:
|
||||
char *raw_ptr;
|
||||
std::vector<std::string> fso_ver_comment;
|
||||
int err;
|
||||
CFILE *fp;
|
||||
|
||||
@@ -187,18 +183,15 @@ public:
|
||||
int save_reinforcements();
|
||||
void save_ai_goals(ai_goal *goalp, int ship);
|
||||
int fout(char *format, ...);
|
||||
int fout_version(char *format, ...);
|
||||
int fout_ext(char *pre_str, char *format, ...);
|
||||
int fout_ext(char *format, ...);
|
||||
void parse_comments(int = 1);
|
||||
CFred_mission_save() : err(0), raw_ptr(Mission_text_raw) { }
|
||||
int save_mission_file(char *pathname);
|
||||
int autosave_mission_file(char *pathname);
|
||||
int save_campaign_file(char *pathname);
|
||||
|
||||
void fso_comment_push(char *ver);
|
||||
void fso_comment_pop(bool pop_all = false);
|
||||
|
||||
// Goober5000
|
||||
int fout_and_bypass(char *format, ...);
|
||||
void bypass_comment(char *comment);
|
||||
};
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 822 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 206 B |
@@ -1,6 +1,6 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by FRED.rc
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by fred.rc
|
||||
//
|
||||
#define IDC_SAVE_DEFAULT_PREFS 3
|
||||
#define ID_DELETE_VARIABLE 3
|
||||
@@ -101,26 +101,21 @@
|
||||
#define IDD_CUSTOM_WING_NAMES 267
|
||||
#define IDD_RESTRICT_PATHS 270
|
||||
#define IDD_BACKGROUND_CHOOSER 272
|
||||
#define IDB_DATA_02 274
|
||||
#define IDB_DATA_03 275
|
||||
#define IDB_DATA_04 276
|
||||
#define IDB_DATA_05 277
|
||||
#define IDB_DATA_06 278
|
||||
#define IDB_DATA_07 279
|
||||
#define IDB_DATA_08 280
|
||||
#define IDB_DATA_09 281
|
||||
#define IDB_DATA_01 285
|
||||
#define IDB_DATA_10 286
|
||||
#define IDB_DATA_15 296
|
||||
#define IDB_DATA_00 297
|
||||
#define IDB_DATA_20 300
|
||||
#define IDB_DATA_25 301
|
||||
#define IDB_DATA_30 302
|
||||
#define IDB_DATA_35 303
|
||||
#define IDB_DATA_40 304
|
||||
#define IDB_DATA_45 305
|
||||
#define IDB_DATA_50 306
|
||||
#define IDB_DATA_55 307
|
||||
#define IDB_DATA_60 308
|
||||
#define IDB_DATA_65 309
|
||||
#define IDB_DATA_70 310
|
||||
#define IDB_DATA_75 311
|
||||
#define IDB_DATA_80 312
|
||||
#define IDB_DATA_85 313
|
||||
#define IDB_DATA_90 314
|
||||
#define IDB_DATA_95 315
|
||||
#define IDB_DATA_11 287
|
||||
#define IDB_DATA_12 288
|
||||
#define IDB_DATA_15 289
|
||||
#define IDB_DATA_14 290
|
||||
#define IDB_DATA_13 291
|
||||
#define IDC_SHIP_CLASS 1003
|
||||
#define IDC_SHIP_WING 1004
|
||||
#define IDC_SOUND_CLIP_NAME 1007
|
||||
@@ -578,8 +573,6 @@
|
||||
#define IDC_LIST3 1208
|
||||
#define IDC_FILELIST 1208
|
||||
#define IDC_YES_MESSAGE_LIST 1208
|
||||
#define IDC_COMMAND_SENDER 1209
|
||||
#define IDC_COMMAND_PERSONA 1210
|
||||
#define IDC_FILTER_WAYPOINTS 1211
|
||||
#define IDC_FILTER_STARTS 1212
|
||||
#define IDC_FILTER_SHIPS 1213
|
||||
@@ -1369,7 +1362,7 @@
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 316
|
||||
#define _APS_NEXT_RESOURCE_VALUE 292
|
||||
#define _APS_NEXT_COMMAND_VALUE 33091
|
||||
#define _APS_NEXT_CONTROL_VALUE 1595
|
||||
#define _APS_NEXT_SYMED_VALUE 105
|
||||
|
||||
@@ -820,7 +820,6 @@
|
||||
#include "weapon/weapon.h"
|
||||
#include "hud/hudartillery.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "mission/missionmessage.h"
|
||||
|
||||
#define TREE_NODE_INCREMENT 100
|
||||
|
||||
@@ -3140,7 +3139,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
case OPF_SUBSYSTEM:
|
||||
case OPF_AWACS_SUBSYSTEM:
|
||||
case OPF_ROTATING_SUBSYSTEM:
|
||||
case OPF_SUBSYS_OR_GENERIC:
|
||||
str = "<name of subsystem>";
|
||||
break;
|
||||
|
||||
@@ -3193,10 +3191,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
str = "<any data>";
|
||||
break;
|
||||
|
||||
case OPF_PERSONA:
|
||||
str = "<persona name>";
|
||||
break;
|
||||
|
||||
default:
|
||||
str = "<new default required!>";
|
||||
break;
|
||||
@@ -3265,7 +3259,6 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
case OPF_SKYBOX_MODEL_NAME:
|
||||
case OPF_SHIP_OR_NONE:
|
||||
case OPF_SUBSYSTEM_OR_NONE:
|
||||
case OPF_SUBSYS_OR_GENERIC:
|
||||
case OPF_BACKGROUND_BITMAP:
|
||||
case OPF_SUN_BITMAP:
|
||||
case OPF_NEBULA_STORM_TYPE:
|
||||
@@ -3295,12 +3288,6 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
|
||||
return 0;
|
||||
|
||||
case OPF_PERSONA:
|
||||
if (Num_personas)
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
|
||||
case OPF_POINT:
|
||||
case OPF_WAYPOINT_PATH:
|
||||
if (Num_waypoint_lists)
|
||||
@@ -4254,26 +4241,21 @@ void sexp_tree::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
}
|
||||
|
||||
const static UINT Numbered_data_bitmaps[] = {
|
||||
IDB_DATA_00,
|
||||
IDB_DATA_01,
|
||||
IDB_DATA_02,
|
||||
IDB_DATA_03,
|
||||
IDB_DATA_04,
|
||||
IDB_DATA_05,
|
||||
IDB_DATA_06,
|
||||
IDB_DATA_07,
|
||||
IDB_DATA_08,
|
||||
IDB_DATA_09,
|
||||
IDB_DATA_10,
|
||||
IDB_DATA_11,
|
||||
IDB_DATA_12,
|
||||
IDB_DATA_13,
|
||||
IDB_DATA_14,
|
||||
IDB_DATA_15,
|
||||
IDB_DATA_20,
|
||||
IDB_DATA_25,
|
||||
IDB_DATA_30,
|
||||
IDB_DATA_35,
|
||||
IDB_DATA_40,
|
||||
IDB_DATA_45,
|
||||
IDB_DATA_50,
|
||||
IDB_DATA_55,
|
||||
IDB_DATA_60,
|
||||
IDB_DATA_65,
|
||||
IDB_DATA_70,
|
||||
IDB_DATA_75,
|
||||
IDB_DATA_80,
|
||||
IDB_DATA_85,
|
||||
IDB_DATA_90,
|
||||
IDB_DATA_95
|
||||
};
|
||||
|
||||
void sexp_tree::setup(CEdit *ptr)
|
||||
@@ -4834,10 +4816,6 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
|
||||
list = get_listing_opf_subsystem_or_none(parent_node, arg_index);
|
||||
break;
|
||||
|
||||
case OPF_SUBSYS_OR_GENERIC:
|
||||
list = get_listing_opf_subsys_or_generic(parent_node, arg_index);
|
||||
break;
|
||||
|
||||
case OPF_JUMP_NODE_NAME:
|
||||
list = get_listing_opf_jump_nodes();
|
||||
break;
|
||||
@@ -4878,10 +4856,6 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
|
||||
list = get_listing_opf_turret_target_order();
|
||||
break;
|
||||
|
||||
case OPF_PERSONA:
|
||||
list = get_listing_opf_persona();
|
||||
break;
|
||||
|
||||
default:
|
||||
Int3(); // unknown OPF code
|
||||
list = NULL;
|
||||
@@ -4892,12 +4866,15 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
|
||||
// every-time-argument... meaning if either w_arg or e_arg is >= 1, we can continue
|
||||
w_arg = find_ancestral_argument_number(OP_WHEN_ARGUMENT, current_node);
|
||||
e_arg = find_ancestral_argument_number(OP_EVERY_TIME_ARGUMENT, current_node);
|
||||
if (w_arg < 1 && e_arg < 1 /* && the same for any future _ARGUMENT sexps */ ) {
|
||||
if (w_arg < 1 && e_arg < 1 /* && the same for any future _ARGUMENT sexps */ )
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
// also skip for OPF_NULL, because it takes no data (though it can take plenty of operators)
|
||||
if (opf == OPF_NULL) {
|
||||
// also skip if the list is empty, and *also* skip for OPF_NULL, because
|
||||
// it takes no data (though it can take plenty of operators)
|
||||
if (list == NULL || opf == OPF_NULL)
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -4969,25 +4946,15 @@ int sexp_tree::find_ancestral_argument_number(int parent_op, int child_node)
|
||||
*/
|
||||
int sexp_tree::get_data_image(int node)
|
||||
{
|
||||
int count = get_sibling_place(node) + 1;
|
||||
int count = get_sibling_place(node);
|
||||
|
||||
if (count <= 0) {
|
||||
if(count < 0)
|
||||
return BITMAP_DATA;
|
||||
}
|
||||
|
||||
if (count % 5) {
|
||||
if(count > NUM_BITMAP_NUMBERED_DATA)
|
||||
return BITMAP_DATA;
|
||||
}
|
||||
|
||||
int idx = (count % 100) / 5;
|
||||
|
||||
int num = sizeof(Numbered_data_bitmaps)/sizeof(UINT);
|
||||
|
||||
if (idx > num) {
|
||||
return BITMAP_DATA;
|
||||
}
|
||||
|
||||
return BITMAP_NUMBERED_DATA + idx;
|
||||
return BITMAP_NUMBERED_DATA + count;
|
||||
}
|
||||
|
||||
int sexp_tree::get_sibling_place(int node)
|
||||
@@ -5584,20 +5551,6 @@ sexp_list_item *sexp_tree::get_listing_opf_message()
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_persona()
|
||||
{
|
||||
int i;
|
||||
sexp_list_item head;
|
||||
|
||||
for (i = 0; i < Num_personas; i++) {
|
||||
if (Personas[i].flags & PERSONA_FLAG_WINGMAN) {
|
||||
head.add_data (Personas[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_who_from()
|
||||
{
|
||||
object *ptr;
|
||||
@@ -5936,17 +5889,6 @@ sexp_list_item *sexp_tree::get_listing_opf_subsystem_or_none(int parent_node, in
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_subsys_or_generic(int parent_node, int arg_index)
|
||||
{
|
||||
sexp_list_item head;
|
||||
|
||||
head.add_data(SEXP_ALL_ENGINES_STRING);
|
||||
head.add_data(SEXP_ALL_TURRETS_STRING);
|
||||
head.add_list(get_listing_opf_subsystem(parent_node, arg_index));
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_jump_nodes()
|
||||
{
|
||||
sexp_list_item head;
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#define BITMAP_BLUE_DOT BITMAP_ROOT
|
||||
#define BITMAP_RED_DOT BITMAP_ROOT_DIRECTIVE
|
||||
#define BITMAP_NUMBERED_DATA 9
|
||||
#define NUM_BITMAP_NUMBERED_DATA 15
|
||||
//Therefore NEXT DEFINE should be 9+12 or 21
|
||||
|
||||
|
||||
@@ -246,9 +247,7 @@ public:
|
||||
sexp_list_item *get_listing_opf_flexible_argument();
|
||||
sexp_list_item *get_listing_opf_ship_or_none();
|
||||
sexp_list_item *get_listing_opf_subsystem_or_none(int parent_node, int arg_index);
|
||||
sexp_list_item *get_listing_opf_subsys_or_generic(int parent_node, int arg_index);
|
||||
sexp_list_item *get_listing_opf_turret_target_order();
|
||||
sexp_list_item *get_listing_opf_persona();
|
||||
// ---------------------------------------------------------
|
||||
|
||||
int m_mode;
|
||||
|
||||
@@ -132,7 +132,6 @@ BOOL ShipSpecialDamage::OnInitDialog()
|
||||
m_special_exp_enabled = TRUE;
|
||||
}
|
||||
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// maybe gray out lots of stuff
|
||||
@@ -164,25 +163,6 @@ void ShipSpecialDamage::OnOK()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
|
||||
object *objp;
|
||||
|
||||
objp = GET_FIRST(&obj_used_list);
|
||||
while (objp != END_OF_LIST(&obj_used_list)) {
|
||||
if ((objp->type == OBJ_START) || (objp->type == OBJ_SHIP)) {
|
||||
if (objp->flags & OF_MARKED)
|
||||
update_ship(objp->instance);
|
||||
}
|
||||
|
||||
objp = GET_NEXT(objp);
|
||||
}
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void ShipSpecialDamage::update_ship(int shipnum)
|
||||
{
|
||||
ship *shipp = &Ships[shipnum];
|
||||
|
||||
// TODO: Add extra validation here
|
||||
if (m_special_exp_enabled) {
|
||||
|
||||
@@ -193,17 +173,17 @@ void ShipSpecialDamage::update_ship(int shipnum)
|
||||
return;
|
||||
}
|
||||
|
||||
if (shipp->special_exp_index == -1) {
|
||||
if (Ships[m_ship_num].special_exp_index == -1) {
|
||||
// get free sexp_variables
|
||||
start = sexp_variable_allocate_block(shipp->ship_name, SEXP_VARIABLE_BLOCK | SEXP_VARIABLE_BLOCK_EXP);
|
||||
start = sexp_variable_allocate_block(Ships[m_ship_num].ship_name, SEXP_VARIABLE_BLOCK | SEXP_VARIABLE_BLOCK_EXP);
|
||||
if (start == -1) {
|
||||
MessageBox("Unable to allocate storage, try deleting Sexp variables");
|
||||
return;
|
||||
} else {
|
||||
shipp->special_exp_index = start;
|
||||
Ships[m_ship_num].special_exp_index = start;
|
||||
}
|
||||
} else {
|
||||
start = shipp->special_exp_index;
|
||||
start = Ships[m_ship_num].special_exp_index;
|
||||
}
|
||||
// set to update
|
||||
set_modified();
|
||||
@@ -217,16 +197,17 @@ void ShipSpecialDamage::update_ship(int shipnum)
|
||||
sprintf(Sexp_variables[start+SHOCK_SPEED].text, "%d", m_shock_speed);
|
||||
|
||||
} else {
|
||||
if (shipp->special_exp_index != -1) {
|
||||
if (Ships[m_ship_num].special_exp_index != -1) {
|
||||
// set to update
|
||||
set_modified();
|
||||
|
||||
// free block
|
||||
sexp_variable_block_free(shipp->ship_name, Ships[m_ship_num].special_exp_index, SEXP_VARIABLE_BLOCK |SEXP_VARIABLE_BLOCK_EXP);
|
||||
sexp_variable_block_free(Ships[m_ship_num].ship_name, Ships[m_ship_num].special_exp_index, SEXP_VARIABLE_BLOCK |SEXP_VARIABLE_BLOCK_EXP);
|
||||
|
||||
// set index to no exp block
|
||||
shipp->special_exp_index = -1;
|
||||
Ships[m_ship_num].special_exp_index = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
@@ -24,7 +24,6 @@ class ShipSpecialDamage : public CDialog
|
||||
// Construction
|
||||
public:
|
||||
ShipSpecialDamage(CWnd* pParent = NULL); // standard constructor
|
||||
void update_ship(int ship);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(ShipSpecialDamage)
|
||||
|
||||
@@ -181,7 +181,7 @@ BOOL CShipTexturesDlg::OnInitDialog()
|
||||
for (i=0; i<pm->n_textures; i++)
|
||||
{
|
||||
// get texture file name
|
||||
bm_get_filename(pm->maps[i].base_map.original_texture, texture_file);
|
||||
strcpy(texture_file, pm->original_maps[i].filename);
|
||||
|
||||
// skip blank textures
|
||||
if (!strlen(texture_file))
|
||||
@@ -379,7 +379,6 @@ void CShipTexturesDlg::swap_strings(char *str1, char *str2)
|
||||
|
||||
texture_replace *CShipTexturesDlg::texture_set(texture_replace *dest, const texture_replace *src)
|
||||
{
|
||||
dest->new_texture_id = src->new_texture_id;
|
||||
strcpy(dest->ship_name, src->ship_name);
|
||||
strcpy(dest->old_texture, src->old_texture);
|
||||
strcpy(dest->new_texture, src->new_texture);
|
||||
|
||||
@@ -124,7 +124,7 @@ BOOL starfield_editor::OnInitDialog()
|
||||
CDialog::OnInitDialog();
|
||||
theApp.init_window(&Starfield_wnd_data, this);
|
||||
|
||||
m_slider.SetRange(0, MAX_STARS);
|
||||
m_slider.SetRange(100, MAX_STARS);
|
||||
m_slider.SetPos(Num_stars);
|
||||
sprintf(buf, "%d", Num_stars);
|
||||
GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
|
||||
|
||||
@@ -1792,7 +1792,6 @@
|
||||
#include "mission/missioncampaign.h"
|
||||
#include "mission/missiongoals.h"
|
||||
#include "mission/missionhotkey.h"
|
||||
//#include "mission/missionlist.h"
|
||||
#include "mission/missionload.h"
|
||||
#include "mission/missionlog.h"
|
||||
#include "mission/missionmessage.h"
|
||||
@@ -1833,7 +1832,6 @@
|
||||
#include "osapi/osregistry.h"
|
||||
#include "parse/encrypt.h"
|
||||
#include "parse/lua.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "parse/scripting.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "particle/particle.h"
|
||||
@@ -1900,11 +1898,11 @@ extern int Om_tracker_flag; // needed for FS2OpenPXO config
|
||||
// This function is defined in code\network\multiutil.cpp so will be linked from multiutil.obj
|
||||
// it's required fro the -missioncrcs command line option - Kazan
|
||||
void multi_spew_pxo_checksums(int max_files, char *outfile);
|
||||
void fs2netd_spew_table_checksums(char *outfile);
|
||||
void multi_spew_table_checksums(int max_files, char *outfile);
|
||||
|
||||
extern bool frame_rate_display;
|
||||
|
||||
bool cube_map_drawen = false;
|
||||
bool Env_cubemap_drawn = false;
|
||||
|
||||
void game_reset_view_clip();
|
||||
void game_reset_shade_frame();
|
||||
@@ -2695,7 +2693,6 @@ void game_level_close()
|
||||
mission_event_shutdown();
|
||||
asteroid_level_close();
|
||||
jumpnode_level_close();
|
||||
// model_cache_reset(); // Reset/free all the model caching stuff
|
||||
flak_level_close(); // unload flak stuff
|
||||
neb2_level_close(); // shutdown gaseous nebula stuff
|
||||
ct_level_close();
|
||||
@@ -2705,9 +2702,22 @@ void game_level_close()
|
||||
cameras_close();
|
||||
subtitles_close();
|
||||
trail_level_close();
|
||||
mission_parse_level_close();
|
||||
|
||||
batch_reset();
|
||||
|
||||
audiostream_unpause_all();
|
||||
Game_paused = 0;
|
||||
|
||||
if (gr_screen.envmap_render_target >= 0) {
|
||||
if ( bm_release(gr_screen.envmap_render_target, 1) ) {
|
||||
gr_screen.envmap_render_target = -1;
|
||||
}
|
||||
}
|
||||
|
||||
gr_set_ambient_light(120, 120, 120);
|
||||
|
||||
ENVMAP = Default_env_map;
|
||||
}
|
||||
|
||||
uint load_gl_init;
|
||||
@@ -2846,7 +2856,7 @@ void game_level_init(int seed)
|
||||
// campaign wasn't ended
|
||||
Campaign_ended_in_mission = 0;
|
||||
|
||||
cube_map_drawen = false;
|
||||
Env_cubemap_drawn = false;
|
||||
|
||||
load_gl_init = time(NULL) - load_gl_init;
|
||||
|
||||
@@ -3217,6 +3227,9 @@ void game_post_level_init()
|
||||
// Stuff which gets called after mission is loaded. Because player isn't created until
|
||||
// after mission loads, some things must get initted after the level loads
|
||||
|
||||
extern void game_environment_map_gen();
|
||||
game_environment_map_gen();
|
||||
|
||||
model_level_post_init();
|
||||
|
||||
HUD_init();
|
||||
@@ -3259,6 +3272,8 @@ int game_start_mission()
|
||||
{
|
||||
mprintf(( "=================== STARTING LEVEL LOAD ==================\n" ));
|
||||
|
||||
int s1 = timer_get_milliseconds();
|
||||
|
||||
get_mission_info(Game_current_mission_filename, &The_mission, false);
|
||||
|
||||
if ( !(Game_mode & GM_STANDALONE_SERVER) )
|
||||
@@ -3336,6 +3351,10 @@ int game_start_mission()
|
||||
|
||||
bm_print_bitmaps();
|
||||
|
||||
int e1 = timer_get_milliseconds();
|
||||
|
||||
printf("Level load took %f seconds.\n", (e1 - s1) / 1000.0f );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3634,12 +3653,18 @@ void game_init()
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef FS_VERSION_IDENT
|
||||
mprintf(("FreeSpace version: %i.%i.%i (%s)\n", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD, FS_VERSION_IDENT));
|
||||
#else
|
||||
mprintf(("FreeSpace version: %i.%i.%i\n", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD));
|
||||
#endif
|
||||
|
||||
extern void cmdline_debug_print_cmdline();
|
||||
cmdline_debug_print_cmdline();
|
||||
#endif
|
||||
|
||||
memset(whee, 0, sizeof(whee));
|
||||
|
||||
#ifdef APPLE_APP
|
||||
// some OSX hackery to drop us out of the APP the binary is run from
|
||||
char *c = NULL;
|
||||
@@ -3672,10 +3697,11 @@ void game_init()
|
||||
|
||||
if (Is_standalone) {
|
||||
// force off some cmdlines if they are on
|
||||
Cmdline_nospec = 1;
|
||||
Cmdline_noglow = 1;
|
||||
Cmdline_spec = 0;
|
||||
Cmdline_glow = 0;
|
||||
Cmdline_env = 0;
|
||||
Cmdline_3dwarp = 0;
|
||||
Cmdline_normal = 0;
|
||||
|
||||
// now init the standalone server code
|
||||
std_init_standalone();
|
||||
@@ -3776,92 +3802,27 @@ void game_init()
|
||||
// SOUND INIT END
|
||||
/////////////////////////////
|
||||
|
||||
// check for hi res pack file
|
||||
int has_sparky_hi = cf_exists_full("2_ChoosePilot-m.pcx", CF_TYPE_ANY);
|
||||
|
||||
|
||||
if (!Is_standalone) {
|
||||
int width = 640, height = 480, cdepth = 16, res = GR_640, mode = GR_OPENGL;
|
||||
char Device_init_error[512];
|
||||
bool is_640x480 = true; // default to 640x480 res
|
||||
|
||||
|
||||
// We cannot continue without this, quit, but try to help the user out first
|
||||
ptr = os_config_read_string(NULL, NOX("VideocardFs2open"), NULL);
|
||||
|
||||
// if we don't have a config string then construct one, using OpenGL 640x480 16-bit as the default
|
||||
if (ptr == NULL) {
|
||||
char Default_video_settings[] = "OGL -(640x480)x16 bit";
|
||||
ptr = &Default_video_settings[0];
|
||||
}
|
||||
|
||||
if(Cmdline_res != NULL) {
|
||||
char Cmdline_video_settings[128];
|
||||
sprintf(Cmdline_video_settings, "OGL -(%s)x16 bit", Cmdline_res);
|
||||
ptr = &Cmdline_video_settings[0];
|
||||
}
|
||||
|
||||
Assert( ptr != NULL );
|
||||
|
||||
// OpenGL should be default
|
||||
mode = GR_OPENGL;
|
||||
|
||||
#ifndef NO_DIRECT3D
|
||||
if ( !strncmp(ptr, NOX("D3D8"), 4) )
|
||||
mode = GR_DIRECT3D;
|
||||
#endif
|
||||
|
||||
// NOTE: The "ptr+5" is to skip over the initial "????-" in the video string.
|
||||
// If the format of that string changes you'll have to change this too!!!
|
||||
if ( sscanf(ptr+5, "(%dx%d)x%d ", &width, &height, &cdepth) != 3 ) {
|
||||
strcpy(Device_init_error, "Can't understand 'VideocardFs2open' registry entry!");
|
||||
goto VidInitError;
|
||||
}
|
||||
|
||||
// if we are less than 1024x768 res then stay at low-res, otherwise bump it
|
||||
is_640x480 = ( (width < 1024) && (height < 768) );
|
||||
|
||||
res = (!is_640x480 && has_sparky_hi) ? GR_1024 : GR_640;
|
||||
|
||||
#ifdef WIN32
|
||||
// for Windows, we need to do this just before the gr_init() call
|
||||
extern void win32_create_window(int width, int height);
|
||||
win32_create_window( width, height );
|
||||
#endif
|
||||
|
||||
gr_init(res, mode, cdepth, width, height);
|
||||
|
||||
VidInitError:
|
||||
extern int Gr_inited;
|
||||
if (!Gr_inited) {
|
||||
if ( gr_init() == false ) {
|
||||
#ifdef _WIN32
|
||||
ClipCursor(NULL);
|
||||
ShowCursor(TRUE);
|
||||
ShowWindow((HWND)os_get_window(),SW_MINIMIZE);
|
||||
MessageBox( NULL, Device_init_error, "Error intializing graphics", MB_OK|MB_TASKMODAL|MB_SETFOREGROUND );
|
||||
run_launcher();
|
||||
ClipCursor(NULL);
|
||||
ShowCursor(TRUE);
|
||||
ShowWindow((HWND)os_get_window(),SW_MINIMIZE);
|
||||
MessageBox( NULL, "Error intializing graphics!", "Error", MB_OK|MB_TASKMODAL|MB_SETFOREGROUND );
|
||||
run_launcher();
|
||||
#elif defined(SCP_UNIX)
|
||||
fprintf(stderr, "Error initializing graphics: %s\n\n", Device_init_error);
|
||||
|
||||
// the default entry should have been created already if it didn't exist, so if we're here then
|
||||
// the current value is invalid and we need to replace it
|
||||
os_config_write_string(NULL, NOX("VideocardFs2open"), NOX("OGL -(640x480)x16 bit"));
|
||||
|
||||
// courtesy
|
||||
fprintf(stderr, "The default video entry is now in place. Please try running the game again...\n");
|
||||
fprintf(stderr, "(edit ~/.fs2_open/fs2_open.ini to change from default resolution)\n");
|
||||
#endif
|
||||
exit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// we are standalone (ie, server mode)
|
||||
else {
|
||||
gr_init(GR_640, GR_STUB, 16, 640, 480);
|
||||
}
|
||||
fprintf(stderr, "Error initializing graphics!");
|
||||
|
||||
// this has to be set after gr_init() is done on *nix
|
||||
os_set_title(Osreg_title);
|
||||
// the default entry should have been created already if it didn't exist, so if we're here then
|
||||
// the current value is invalid and we need to replace it
|
||||
os_config_write_string(NULL, NOX("VideocardFs2open"), NOX("OGL -(1024x768)x16 bit"));
|
||||
|
||||
// courtesy
|
||||
fprintf(stderr, "The default video entry is now in place. Please try running the game again...\n");
|
||||
fprintf(stderr, "(edit ~/.fs2_open/fs2_open.ini to change from default resolution)\n");
|
||||
#endif
|
||||
exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Karajorma - Moved here from the sound init code cause otherwise windows complains
|
||||
#ifdef FS2_VOICER
|
||||
@@ -4169,18 +4130,20 @@ void game_show_framerate()
|
||||
#endif
|
||||
|
||||
|
||||
if (Show_framerate && HUD_draw) {
|
||||
if (Show_framerate) {
|
||||
gr_set_color_fast(&HUD_color_debug);
|
||||
|
||||
if (frametotal != 0.0f)
|
||||
if (frametotal != 0.0f) {
|
||||
gr_printf( 20, 100, "FPS: %0.1f", Framerate );
|
||||
else
|
||||
} else {
|
||||
gr_string( 20, 100, "FPS: ?" );
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
if ( Debug_dump_frames )
|
||||
if (Debug_dump_frames) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// possibly show control checking info
|
||||
@@ -4191,7 +4154,7 @@ void game_show_framerate()
|
||||
// MONITOR_INC(BmpNew, bitmaps_new_this_frame);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (Cmdline_show_stats && HUD_draw) {
|
||||
if (Cmdline_show_stats) {
|
||||
char mem_buffer[50];
|
||||
|
||||
#ifndef NO_DIRECT3D
|
||||
@@ -4205,10 +4168,11 @@ void game_show_framerate()
|
||||
GlobalMemoryStatus(&mem_stats);
|
||||
|
||||
// on win2k+, it should be == -1 if >4gig (indicates wrap around)
|
||||
if ( ((int)Mem_starttime_phys == -1) || ((int)mem_stats.dwAvailPhys == -1) )
|
||||
if ( ((int)Mem_starttime_phys == -1) || ((int)mem_stats.dwAvailPhys == -1) ) {
|
||||
sprintf(mem_buffer, "Using Physical: *** (>4G)");
|
||||
else
|
||||
} else {
|
||||
sprintf(mem_buffer,"Using Physical: %d Meg",(Mem_starttime_phys - mem_stats.dwAvailPhys)/1024/1024);
|
||||
}
|
||||
|
||||
gr_string( 20, 120, mem_buffer);
|
||||
sprintf(mem_buffer,"Using Pagefile: %d Meg",(Mem_starttime_pagefile - mem_stats.dwAvailPageFile)/1024/1024);
|
||||
@@ -4216,10 +4180,11 @@ void game_show_framerate()
|
||||
sprintf(mem_buffer,"Using Virtual: %d Meg",(Mem_starttime_virtual - mem_stats.dwAvailVirtual)/1024/1024);
|
||||
gr_string( 20, 140, mem_buffer);
|
||||
|
||||
if ( ((int)mem_stats.dwAvailPhys == -1) || ((int)mem_stats.dwTotalPhys == -1) )
|
||||
if ( ((int)mem_stats.dwAvailPhys == -1) || ((int)mem_stats.dwTotalPhys == -1) ) {
|
||||
sprintf(mem_buffer, "Physical Free: *** / *** (>4G)");
|
||||
else
|
||||
} else {
|
||||
sprintf(mem_buffer,"Physical Free: %d / %d Meg",mem_stats.dwAvailPhys/1024/1024, mem_stats.dwTotalPhys/1024/1024);
|
||||
}
|
||||
|
||||
gr_string( 20, 160, mem_buffer);
|
||||
sprintf(mem_buffer,"Pagefile Free: %d / %d Meg",mem_stats.dwAvailPageFile/1024/1024, mem_stats.dwTotalPageFile/1024/1024);
|
||||
@@ -4230,8 +4195,7 @@ void game_show_framerate()
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
if ( Show_cpu == 1 ) {
|
||||
|
||||
if (Show_cpu == 1) {
|
||||
int sx,sy,dy;
|
||||
sx = 530;
|
||||
sy = 15;
|
||||
@@ -4262,7 +4226,6 @@ void game_show_framerate()
|
||||
sy += dy;
|
||||
|
||||
{
|
||||
|
||||
extern int Num_pairs; // Number of object pairs that were checked.
|
||||
gr_printf( sx, sy, NOX("PAIRS: %d"), Num_pairs );
|
||||
sy += dy;
|
||||
@@ -4271,13 +4234,12 @@ void game_show_framerate()
|
||||
gr_printf( sx, sy, NOX("FVI: %d"), Num_pairs_checked );
|
||||
sy += dy;
|
||||
Num_pairs_checked = 0;
|
||||
|
||||
}
|
||||
|
||||
gr_printf( sx, sy, NOX("Snds: %d"), snd_num_playing() );
|
||||
sy += dy;
|
||||
|
||||
if ( Timing_total > 0.01f ) {
|
||||
if (Timing_total > 0.01f) {
|
||||
gr_printf( sx, sy, NOX("CLEAR: %.0f%%"), Timing_clear*100.0f/Timing_total );
|
||||
sy += dy;
|
||||
gr_printf( sx, sy, NOX("REND2D: %.0f%%"), Timing_render2*100.0f/Timing_total );
|
||||
@@ -4291,8 +4253,7 @@ void game_show_framerate()
|
||||
}
|
||||
}
|
||||
|
||||
if ( Show_mem ) {
|
||||
|
||||
if (Show_mem) {
|
||||
int sx,sy,dy;
|
||||
sx = (gr_screen.res == GR_1024) ? 870 : 530;
|
||||
sy = 15;
|
||||
@@ -4323,7 +4284,7 @@ void game_show_framerate()
|
||||
#endif
|
||||
|
||||
#ifndef NO_DIRECT3D
|
||||
if ( gr_screen.mode == GR_DIRECT3D ) {
|
||||
if (gr_screen.mode == GR_DIRECT3D) {
|
||||
extern int D3D_textures_in;
|
||||
gr_printf( sx, sy, NOX("VRAM: %d KB\n"), (D3D_textures_in)/1024 );
|
||||
sy += dy;
|
||||
@@ -4338,7 +4299,7 @@ void game_show_framerate()
|
||||
}
|
||||
|
||||
|
||||
if ( Show_player_pos ) {
|
||||
if (Show_player_pos) {
|
||||
int sx, sy;
|
||||
sx = 320;
|
||||
sy = 100;
|
||||
@@ -4395,7 +4356,7 @@ void game_show_framerate()
|
||||
|
||||
void game_show_eye_pos(vec3d *eye_pos, matrix* eye_orient)
|
||||
{
|
||||
if ( !Cmdline_show_pos && HUD_draw )
|
||||
if(!Cmdline_show_pos)
|
||||
return;
|
||||
|
||||
//Do stuff
|
||||
@@ -4977,17 +4938,19 @@ void say_view_target()
|
||||
if (!(Game_mode & GM_DEAD_DIED) && ((Game_mode & (GM_DEAD_BLEW_UP)) || ((Last_view_target != NULL) && (Last_view_target != view_target)))) {
|
||||
if (view_target != Player_obj){
|
||||
|
||||
char view_target_name[128] = "";
|
||||
char *view_target_name = NULL;
|
||||
switch(Objects[Player_ai->target_objnum].type) {
|
||||
case OBJ_SHIP:
|
||||
strcpy(view_target_name, Ships[Objects[Player_ai->target_objnum].instance].ship_name);
|
||||
view_target_name = Ships[Objects[Player_ai->target_objnum].instance].ship_name;
|
||||
break;
|
||||
case OBJ_WEAPON:
|
||||
strcpy(view_target_name, Weapon_info[Weapons[Objects[Player_ai->target_objnum].instance].weapon_info_index].name);
|
||||
view_target_name = Weapon_info[Weapons[Objects[Player_ai->target_objnum].instance].weapon_info_index].name;
|
||||
Viewer_mode &= ~VM_OTHER_SHIP;
|
||||
break;
|
||||
case OBJ_JUMP_NODE: {
|
||||
strcpy(view_target_name, XSTR( "jump node", 184));
|
||||
char jump_node_name[128];
|
||||
strcpy(jump_node_name, XSTR( "jump node", 184));
|
||||
view_target_name = jump_node_name;
|
||||
Viewer_mode &= ~VM_OTHER_SHIP;
|
||||
break;
|
||||
}
|
||||
@@ -4997,7 +4960,6 @@ void say_view_target()
|
||||
break;
|
||||
}
|
||||
|
||||
end_string_at_first_hash_symbol(view_target_name);
|
||||
if ( view_target_name ) {
|
||||
HUD_fixed_printf(0.0f, XSTR( "Viewing %s%s\n", 185), (Viewer_mode & VM_OTHER_SHIP) ? XSTR( "from ", 186) : "", view_target_name);
|
||||
Show_viewing_from_self = 1;
|
||||
@@ -5052,7 +5014,7 @@ float get_shake(float intensity, int decay_time, int max_decay_time)
|
||||
{
|
||||
int r = myrand();
|
||||
|
||||
float shake = intensity * (float) (r-RAND_MAX_2)/RAND_MAX;
|
||||
float shake = intensity * (float)(r-RAND_MAX_2) * RAND_MAX_1f;
|
||||
|
||||
if (decay_time >= 0) {
|
||||
Assert(max_decay_time > 0);
|
||||
@@ -5136,7 +5098,7 @@ vec3d Dead_player_last_vel = { { { 1.0f, 1.0f, 1.0f } } };
|
||||
extern float View_zoom;
|
||||
inline void render_environment(int i, vec3d *eye_pos, matrix *new_orient, float new_zoom)
|
||||
{
|
||||
bm_set_render_target( (Game_subspace_effect) ? gr_screen.dynamic_environment_map : gr_screen.static_environment_map, i);
|
||||
bm_set_render_target(gr_screen.envmap_render_target, i);
|
||||
|
||||
gr_clear();
|
||||
|
||||
@@ -5167,14 +5129,14 @@ void setup_environment_mapping(vec3d *eye_pos, matrix *eye_orient)
|
||||
|
||||
// prefer the mission specified envmap over the static-generated envmap, but
|
||||
// the dynamic envmap should always get preference if in a subspace mission
|
||||
if ( !Game_subspace_effect && strlen(The_mission.envmap_name) ) {
|
||||
if ( !Dynamic_environment && strlen(The_mission.envmap_name) ) {
|
||||
ENVMAP = bm_load(The_mission.envmap_name);
|
||||
|
||||
if (ENVMAP >= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (Game_subspace_effect && (gr_screen.dynamic_environment_map < 0)) || (!Game_subspace_effect && (gr_screen.static_environment_map < 0)) ) {
|
||||
if (gr_screen.envmap_render_target < 0) {
|
||||
if (ENVMAP >= 0)
|
||||
return;
|
||||
|
||||
@@ -5190,7 +5152,7 @@ void setup_environment_mapping(vec3d *eye_pos, matrix *eye_orient)
|
||||
return;
|
||||
}
|
||||
|
||||
ENVMAP = (Game_subspace_effect) ? gr_screen.dynamic_environment_map : gr_screen.static_environment_map;
|
||||
ENVMAP = gr_screen.envmap_render_target;
|
||||
|
||||
/*
|
||||
Envmap matrix setup -- left-handed
|
||||
@@ -5259,6 +5221,37 @@ void setup_environment_mapping(vec3d *eye_pos, matrix *eye_orient)
|
||||
g3_set_view_matrix( eye_pos, eye_orient, old_zoom );
|
||||
}
|
||||
|
||||
// setup the render target ready for this mission's environment map
|
||||
void game_environment_map_gen()
|
||||
{
|
||||
const int size = 512;
|
||||
int gen_flags = (BMP_FLAG_RENDER_TARGET_STATIC | BMP_FLAG_CUBEMAP);
|
||||
|
||||
if ( !Cmdline_env ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gr_screen.envmap_render_target >= 0) {
|
||||
if ( !bm_release(gr_screen.envmap_render_target, 1) ) {
|
||||
Int3();
|
||||
}
|
||||
|
||||
gr_screen.envmap_render_target = -1;
|
||||
}
|
||||
|
||||
if ( Dynamic_environment || (The_mission.flags & MISSION_FLAG_SUBSPACE) ) {
|
||||
Dynamic_environment = true;
|
||||
gen_flags &= ~BMP_FLAG_RENDER_TARGET_STATIC;
|
||||
gen_flags |= BMP_FLAG_RENDER_TARGET_DYNAMIC;
|
||||
}
|
||||
// bail if we are going to be static, and have an envmap specified already
|
||||
else if ( strlen(The_mission.envmap_name) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
gr_screen.envmap_render_target = bm_make_render_target(size, size, gen_flags);
|
||||
}
|
||||
|
||||
int Scripting_didnt_draw_hud = 1;
|
||||
|
||||
// Set eye_pos and eye_orient based on view mode.
|
||||
@@ -5584,9 +5577,12 @@ void game_render_frame( vec3d *eye_pos, matrix *eye_orient )
|
||||
}
|
||||
|
||||
// this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
|
||||
if ( Cmdline_env && (!cube_map_drawen || Game_subspace_effect) ) {
|
||||
if ( Cmdline_env && !Env_cubemap_drawn ) {
|
||||
setup_environment_mapping(eye_pos, eye_orient);
|
||||
cube_map_drawen = true;
|
||||
|
||||
if ( !Dynamic_environment ) {
|
||||
Env_cubemap_drawn = true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DYN_CLIP_DIST
|
||||
@@ -6423,7 +6419,7 @@ void game_frame(int paused)
|
||||
popupdead_start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_GET_TIME( render3_time2 )
|
||||
DEBUG_GET_TIME( render2_time1 )
|
||||
@@ -7940,7 +7936,7 @@ void game_leave_state( int old_state, int new_state )
|
||||
}
|
||||
break;
|
||||
|
||||
case GS_STATE_MULTI_MISSION_SYNC:
|
||||
case GS_STATE_MULTI_MISSION_SYNC:
|
||||
common_select_close();
|
||||
|
||||
// if we're moving into the options menu we don't need to do anything else
|
||||
@@ -7992,7 +7988,7 @@ void game_leave_state( int old_state, int new_state )
|
||||
multi_ingame_select_close();
|
||||
break;
|
||||
|
||||
case GS_STATE_INITIAL_PLAYER_SELECT:
|
||||
case GS_STATE_INITIAL_PLAYER_SELECT:
|
||||
player_select_close();
|
||||
break;
|
||||
|
||||
@@ -8055,6 +8051,7 @@ void game_enter_state( int old_state, int new_state )
|
||||
#if defined(PRESS_TOUR_BUILD) || defined(PD_BUILD)
|
||||
mht_init();
|
||||
#else
|
||||
Assert( Player != NULL );
|
||||
main_hall_init(Player->main_hall);
|
||||
#endif
|
||||
break;
|
||||
@@ -9019,6 +9016,7 @@ DCF(pofspew, "")
|
||||
game_spew_pof_info();
|
||||
}
|
||||
|
||||
|
||||
// returns:
|
||||
// 0 on an error
|
||||
// 1 on a clean exit
|
||||
@@ -9104,7 +9102,7 @@ int game_main(char *cmdline)
|
||||
multi_spew_pxo_checksums(1024, "mission_crcs.txt");
|
||||
|
||||
if (Cmdline_spew_table_crcs) {
|
||||
fs2netd_spew_table_checksums("table_crcs.txt");
|
||||
multi_spew_table_checksums(50, "table_crcs.txt");
|
||||
}
|
||||
|
||||
game_shutdown();
|
||||
@@ -9113,7 +9111,7 @@ int game_main(char *cmdline)
|
||||
|
||||
|
||||
if (Cmdline_spew_table_crcs) {
|
||||
fs2netd_spew_table_checksums("table_crcs.txt");
|
||||
multi_spew_table_checksums(50, "table_crcs.txt");
|
||||
game_shutdown();
|
||||
return 0;
|
||||
}
|
||||
@@ -9263,7 +9261,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
DBUGFILE_INIT();
|
||||
|
||||
// create user's directory
|
||||
// create user's directory
|
||||
memset(userdir, 0, sizeof(userdir));
|
||||
snprintf(userdir, MAX_PATH - 1, "%s/%s/", detect_home(), Osreg_user_dir);
|
||||
_mkdir(userdir);
|
||||
|
||||
@@ -9567,12 +9566,15 @@ void game_render_mouse(float frametime)
|
||||
am = &Animating_mouse;
|
||||
if ( am->first_frame != -1 ) {
|
||||
mouse_get_pos(&mx, &my);
|
||||
|
||||
am->elapsed_time += frametime;
|
||||
am->current_frame = fl2i( ( am->elapsed_time / am->time ) * (am->num_frames-1) );
|
||||
|
||||
if ( am->current_frame >= am->num_frames ) {
|
||||
am->current_frame = 0;
|
||||
am->elapsed_time = 0.0f;
|
||||
}
|
||||
|
||||
gr_set_cursor_bitmap(am->first_frame + am->current_frame);
|
||||
}
|
||||
}
|
||||
@@ -9857,13 +9859,11 @@ void Time_model( int modelnum )
|
||||
int i;
|
||||
for (i=0; i<pm->n_textures; i++ ) {
|
||||
char filename[1024];
|
||||
ubyte pal[768];
|
||||
|
||||
int bmp_num = pm->maps[i].base_map.original_texture;
|
||||
int bmp_num = pm->maps[i].base_map.texture;
|
||||
if ( bmp_num > -1 ) {
|
||||
bm_get_palette(pm->maps[i].base_map.original_texture, pal, filename );
|
||||
int w,h;
|
||||
bm_get_info( pm->maps[i].base_map.original_texture,&w, &h );
|
||||
int w, h;
|
||||
bm_get_info( pm->maps[i].base_map.texture, &w, &h );
|
||||
|
||||
|
||||
if ( (w > 512) || (h > 512) ) {
|
||||
@@ -10064,27 +10064,16 @@ void get_version_string(char *str, int max_size)
|
||||
Assert( max_size > 6 );
|
||||
|
||||
if ( FS_VERSION_BUILD == 0 ) {
|
||||
sprintf(str,"FreeSpace 2 Open v%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR);
|
||||
sprintf(str, "FreeSpace 2 Open v%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR);
|
||||
} else {
|
||||
sprintf(str,"FreeSpace 2 Open v%d.%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD );
|
||||
sprintf(str, "FreeSpace 2 Open v%d.%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD );
|
||||
}
|
||||
|
||||
/*
|
||||
// Goober5000 - although this is cool, it's a bit redundant
|
||||
|
||||
// append the CVS "release" version in the $Name variable, but
|
||||
// only do this if it's been tagged
|
||||
int rcs_name_len = strlen(RCS_Name);
|
||||
if (rcs_name_len > 11)
|
||||
{
|
||||
char buffer[100];
|
||||
strcpy(buffer, RCS_Name + 7);
|
||||
buffer[rcs_name_len-9] = 0;
|
||||
|
||||
SAFE_STRCAT( str, " ", max_size );
|
||||
SAFE_STRCAT( str, buffer, max_size );
|
||||
}
|
||||
*/
|
||||
#ifdef FS_VERSION_IDENT
|
||||
SAFE_STRCAT( str, " (", max_size );
|
||||
SAFE_STRCAT( str, FS_VERSION_IDENT, max_size );
|
||||
SAFE_STRCAT( str, ")", max_size );
|
||||
#endif
|
||||
|
||||
#ifdef INF_BUILD
|
||||
SAFE_STRCAT( str, " Inferno", max_size );
|
||||
@@ -10098,6 +10087,7 @@ void get_version_string(char *str, int max_size)
|
||||
SAFE_STRCAT( str, " Debug", max_size );
|
||||
#endif
|
||||
|
||||
/* This is obsolete now, so don't bother - taylor
|
||||
// Lets get some more info in here
|
||||
switch(gr_screen.mode)
|
||||
{
|
||||
@@ -10108,7 +10098,7 @@ void get_version_string(char *str, int max_size)
|
||||
case GR_OPENGL:
|
||||
SAFE_STRCAT( str, " OpenGL", max_size );
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (Cmdline_nohtl)
|
||||
SAFE_STRCAT( str, " non-HT&L", max_size );
|
||||
@@ -10374,16 +10364,6 @@ void demo_upsell_next_screen()
|
||||
} else {
|
||||
Demo_upsell_show_next_bitmap_time = timer_get_milliseconds() + DEMO_UPSELL_SCREEN_DELAY;
|
||||
}
|
||||
|
||||
/*
|
||||
if ( Demo_upsell_screen_number < NUM_DEMO_UPSELL_SCREENS ) {
|
||||
if ( Demo_upsell_bitmap_filenames[gr_screen.res][Demo_upsell_screen_number] >= 0 ) {
|
||||
#ifndef HARDWARE_ONLY
|
||||
palette_use_bm_palette(Demo_upsell_bitmaps[gr_screen.res][Demo_upsell_screen_number]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void demo_upsell_load_bitmaps()
|
||||
@@ -11221,7 +11201,6 @@ int game_hacked_data()
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if ( Om_tracker_flag && !(Hacked_data_check_ready) ) {
|
||||
// this may fail the first time or two
|
||||
if ( (rc = fs2netd_update_valid_tables()) != -1 ) {
|
||||
@@ -11236,7 +11215,6 @@ int game_hacked_data()
|
||||
Hacked_data = true;
|
||||
}
|
||||
|
||||
|
||||
return (int)Hacked_data;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,7 @@
|
||||
#include "graphics/font.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "network/multi_options.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
|
||||
#ifdef WIN32
|
||||
//#include <windows.h>
|
||||
@@ -105,25 +104,25 @@ char Multi_fs_tracker_filter[MAX_PATH] = "";
|
||||
|
||||
void fs2netd_options_config_init()
|
||||
{
|
||||
if ( !strlen(Multi_options_g.game_tracker_ip) ) {
|
||||
// if ( !strlen(Multi_options_g.game_tracker_ip) ) {
|
||||
ml_printf("FS2NetD MSG: Address for game tracker not specified, using default instead (%s).", FS2NETD_DEFAULT_SERVER);
|
||||
strncpy( Multi_options_g.game_tracker_ip, FS2NETD_DEFAULT_SERVER, MULTI_OPTIONS_STRING_LEN );
|
||||
}
|
||||
// }
|
||||
|
||||
if ( !strlen(Multi_options_g.user_tracker_ip) ) {
|
||||
// if ( !strlen(Multi_options_g.user_tracker_ip) ) {
|
||||
ml_printf("FS2NetD MSG: Address for user tracker not specified, using default instead (%s).", FS2NETD_DEFAULT_SERVER);
|
||||
strncpy( Multi_options_g.user_tracker_ip, FS2NETD_DEFAULT_SERVER, MULTI_OPTIONS_STRING_LEN );
|
||||
}
|
||||
// }
|
||||
|
||||
if ( !strlen(Multi_options_g.tracker_port) ) {
|
||||
// if ( !strlen(Multi_options_g.tracker_port) ) {
|
||||
ml_printf("FS2NetD MSG: Port for game/user trackers not specified, using default instead (%u).", FS2NETD_DEFAULT_PORT);
|
||||
strncpy( Multi_options_g.tracker_port, FS2NETD_DEFAULT_PORT, STD_NAME_LEN );
|
||||
}
|
||||
// }
|
||||
|
||||
if ( !strlen(Multi_options_g.pxo_ip) ) {
|
||||
// if ( !strlen(Multi_options_g.pxo_ip) ) {
|
||||
ml_printf("FS2NetD MSG: Address for chat server not specified, using default instead (%s).", FS2NETD_DEFAULT_CHAT_SERVER);
|
||||
strncpy( Multi_options_g.pxo_ip, FS2NETD_DEFAULT_CHAT_SERVER, MULTI_OPTIONS_STRING_LEN );
|
||||
}
|
||||
// }
|
||||
|
||||
if ( !strlen(Multi_options_g.pxo_banner_url) ) {
|
||||
ml_printf("FS2NetD MSG: URL for banners not specified, using default instead (%s).", FS2NETD_DEFAULT_BANNER_URL);
|
||||
@@ -394,6 +393,7 @@ void fs2netd_do_frame()
|
||||
ubyte pid = 0;
|
||||
int itemp;
|
||||
static fix NextPing = -1;
|
||||
static fix NextHolePunch = -1;
|
||||
static fix GotPong = -1;
|
||||
bool reset = false;
|
||||
|
||||
@@ -427,6 +427,7 @@ void fs2netd_do_frame()
|
||||
PXO_SID = -1;
|
||||
|
||||
NextHeartBeat = -1;
|
||||
NextHolePunch = -1;
|
||||
NextPing = -1;
|
||||
GotPong = -1;
|
||||
|
||||
@@ -472,6 +473,7 @@ void fs2netd_do_frame()
|
||||
PXO_SID = -1;
|
||||
|
||||
NextHeartBeat = -1;
|
||||
NextHolePunch = -1;
|
||||
NextPing = -1;
|
||||
GotPong = -1;
|
||||
|
||||
@@ -496,6 +498,49 @@ void fs2netd_do_frame()
|
||||
|
||||
// handle server heart beats
|
||||
fs2netd_server_send_heartbeat();
|
||||
/*
|
||||
// send out UDP hole punch updates
|
||||
// we only do this sparingly however, with the updates being sent:
|
||||
// - every 15 seconds when at the lobby or game start screens
|
||||
// - and a simple refresh every 5 minutes otherwise
|
||||
if ( (NextHolePunch == -1) || (timer_get_fixed_seconds() >= NextHolePunch) ) {
|
||||
int hp_timeout = 300;
|
||||
|
||||
switch ( gameseq_get_state() ) {
|
||||
case GS_STATE_MULTI_JOIN_GAME:
|
||||
case GS_STATE_MULTI_START_GAME:
|
||||
case GS_STATE_PXO:
|
||||
case GS_STATE_PXO_HELP:
|
||||
hp_timeout = 15;
|
||||
break;
|
||||
}
|
||||
|
||||
NextHolePunch = timer_get_fixed_seconds() + (hp_timeout * F1_0);
|
||||
|
||||
|
||||
UDP_hole_punch_data *cur = Net_player->hole_punch_data;
|
||||
|
||||
while (cur != NULL) {
|
||||
if (cur->state == UDP_HOLE_PUNCH_STATE_DONE) {
|
||||
UDP_hole_punch_data *prev = Net_player->hole_punch_data;
|
||||
|
||||
while (prev->next != cur) {
|
||||
prev = prev->next;
|
||||
}
|
||||
|
||||
cur = prev->next = cur->next;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
send_udp_hole_punch(cur->ip, cur->port, cur->state);
|
||||
|
||||
ml_printf("FS2NetD Info: Sent UDP hole punch to '%s'", cur->ip);
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Check for GWall messages - ping replies, etc
|
||||
if ( (rc = FS2NetD_GetData(buffer, sizeof(buffer))) != -1 ) {
|
||||
@@ -605,8 +650,6 @@ void fs2netd_do_frame()
|
||||
Logged_in = false;
|
||||
PXO_SID = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
@@ -769,99 +812,6 @@ int fs2netd_load_servers()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char Chk_mission_name[NAME_LENGTH+1];
|
||||
static uint Chk_mission_crc = 0;
|
||||
|
||||
int fs2netd_check_mission_do()
|
||||
{
|
||||
if (timeout == -1) {
|
||||
timeout = timer_get_fixed_seconds() + (15 * F1_0);
|
||||
}
|
||||
|
||||
// if timeout passes then bail on stats failure
|
||||
if ( timer_get_fixed_seconds() > timeout ) {
|
||||
timeout = -1;
|
||||
return 4;
|
||||
}
|
||||
|
||||
int rescode = FS2NetD_CheckSingleMission(Chk_mission_name, Chk_mission_crc, do_full_packet);
|
||||
|
||||
do_full_packet = 0;
|
||||
|
||||
if (rescode) {
|
||||
timeout = -1;
|
||||
return rescode;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool fs2netd_check_mission(char *mission_name)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
// don't bother with this if we aren't on FS2NetD
|
||||
if ( !Om_tracker_flag ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( !(Game_mode & GM_MULTIPLAYER) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( !Is_connected ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
strcpy(Chk_mission_name, mission_name);
|
||||
cf_chksum_long(Chk_mission_name, &Chk_mission_crc);
|
||||
|
||||
do_full_packet = 1;
|
||||
|
||||
In_process = true;
|
||||
|
||||
if (Is_standalone) {
|
||||
do { rc = fs2netd_check_mission_do(); } while (!rc);
|
||||
} else {
|
||||
rc = popup_till_condition(fs2netd_check_mission_do, XSTR("&Cancel", 779), XSTR("Sending stats...", -1));
|
||||
}
|
||||
|
||||
In_process = false;
|
||||
|
||||
switch (rc) {
|
||||
// operation canceled, or invalid
|
||||
case 0:
|
||||
return false;
|
||||
|
||||
// successful, but invalid
|
||||
case 1:
|
||||
return false;
|
||||
|
||||
// successful and valid
|
||||
case 2:
|
||||
return true;
|
||||
|
||||
// failed to send request packet
|
||||
case 3:
|
||||
if ( !Is_standalone ) {
|
||||
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR("Server request failed!", -1));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
// it timed out
|
||||
case 4:
|
||||
if ( !Is_standalone ) {
|
||||
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR("Server request timed out!", -1));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void fs2netd_debrief_init()
|
||||
{
|
||||
if ( !(Game_mode & GM_MULTIPLAYER) ) {
|
||||
@@ -877,7 +827,12 @@ void fs2netd_debrief_init()
|
||||
}
|
||||
|
||||
|
||||
bool mValidStatus = fs2netd_check_mission(Netgame.mission_name);
|
||||
uint CurrentMissionChsum;
|
||||
bool mValidStatus = false;
|
||||
|
||||
cf_chksum_long(Netgame.mission_name, &CurrentMissionChsum);
|
||||
|
||||
mValidStatus = FS2NetD_CheckSingleMission(Netgame.mission_name, CurrentMissionChsum);
|
||||
|
||||
if ( ((multi_num_players() > 1) || (Multi_num_players_at_start > 1)) && !game_hacked_data() && mValidStatus ) {
|
||||
// verify that we are logged in before doing anything else
|
||||
@@ -1418,15 +1373,12 @@ int fs2netd_get_pilot_info(const char *callsign, player *out_plr, bool first_cal
|
||||
strncpy( new_plr.callsign, callsign, CALLSIGN_LEN );
|
||||
|
||||
memset( out_plr, 0, sizeof(player) );
|
||||
|
||||
timeout = timer_get_fixed_seconds() + (30 * F1_0);
|
||||
}
|
||||
|
||||
int rc = FS2NetD_GetPlayerData(-2, callsign, &new_plr, false, (int)first_call );
|
||||
|
||||
// some sort of failure
|
||||
if (rc > 0) {
|
||||
timeout = -1;
|
||||
return -2;
|
||||
}
|
||||
|
||||
@@ -1434,12 +1386,6 @@ int fs2netd_get_pilot_info(const char *callsign, player *out_plr, bool first_cal
|
||||
memcpy( out_plr, &new_plr, sizeof(player) );
|
||||
}
|
||||
|
||||
// if timeout passes then bail on failure
|
||||
if ( timer_get_fixed_seconds() > timeout ) {
|
||||
timeout = -1;
|
||||
return -2;
|
||||
}
|
||||
|
||||
// we should only be returning -1 (processing) or 0 (got data successfully)
|
||||
return rc;
|
||||
}
|
||||
@@ -1493,50 +1439,81 @@ void fs2netd_update_game_count(char *chan_name)
|
||||
FS2NetD_GameCountUpdate(chan_name);
|
||||
}
|
||||
|
||||
void fs2netd_spew_table_checksums(char *outfile)
|
||||
|
||||
void fs2netd_udp_hole_punch()
|
||||
{
|
||||
char full_name[MAX_PATH_LEN];
|
||||
int count, idx;
|
||||
FILE *out = NULL;
|
||||
char modname[128];
|
||||
time_t my_time = 0;
|
||||
|
||||
if ( Table_valid_status.empty() ) {
|
||||
/* // don't bother with this if we aren't on FS2NetD
|
||||
if ( !Om_tracker_flag ) {
|
||||
return;
|
||||
}
|
||||
|
||||
cf_create_default_path_string(full_name, sizeof(full_name) - 1, CF_TYPE_ROOT, outfile);
|
||||
|
||||
// open the outfile
|
||||
out = fopen(full_name, "wt");
|
||||
|
||||
if (out == NULL) {
|
||||
if ( !Is_connected ) {
|
||||
return;
|
||||
}
|
||||
|
||||
memset( modname, 0, sizeof(modname) );
|
||||
strcpy( modname, Cmdline_spew_table_crcs );
|
||||
server_item *cur = Game_server_head;
|
||||
char ip[16];
|
||||
int i = 0;
|
||||
|
||||
my_time = time(NULL);
|
||||
|
||||
fprintf(out, "-- Table CRCs generated on %s \n", ctime(&my_time));
|
||||
// give them a second to respond normally.
|
||||
fix end_time = timer_get_fixed_seconds() + F1_0;
|
||||
|
||||
fprintf(out, "LOCK TABLES `fstables` WRITE;\n");
|
||||
fprintf(out, "INSERT INTO `fstables` VALUES ");
|
||||
while ( timer_get_fixed_seconds() <= end_time ) {
|
||||
multi_do_frame();
|
||||
}
|
||||
|
||||
count = (int)Table_valid_status.size();
|
||||
|
||||
// do all the checksums
|
||||
for (idx = 0; idx < count; idx++) {
|
||||
if (idx == 0) {
|
||||
fprintf(out, "('%s',%u,'%s')", Table_valid_status[idx].name, Table_valid_status[idx].crc32, modname);
|
||||
} else {
|
||||
fprintf(out, ",('%s',%u,'%s')", Table_valid_status[idx].name, Table_valid_status[idx].crc32, modname);
|
||||
do {
|
||||
i++;
|
||||
cur = cur->next;
|
||||
} while (cur != Game_server_head);
|
||||
|
||||
|
||||
// if everyone is counted then just bail
|
||||
if (i == Active_game_count) {
|
||||
ml_printf("FS2NetD Info: (UDP hole-punch) All servers responding.");
|
||||
return;
|
||||
}
|
||||
|
||||
// check every server.
|
||||
do {
|
||||
bool has_responded = false;
|
||||
|
||||
// this is only for TCP connections (which should always be the case for us anyway)
|
||||
if (cur->server_addr.type != NET_TCP) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(out, ";\n");
|
||||
fprintf(out, "UNLOCK TABLES;\n");
|
||||
// see if this server has responded normally.
|
||||
if ( Active_game_count > 0 ) {
|
||||
active_game *agcur = Active_game_head;
|
||||
|
||||
fclose(out);
|
||||
do {
|
||||
// Check if they're equal.
|
||||
if ( (agcur->server_addr.port == cur->server_addr.port) &&
|
||||
memcmp(agcur->server_addr.addr, cur->server_addr.addr, 4) )
|
||||
{
|
||||
has_responded = true;
|
||||
break;
|
||||
}
|
||||
|
||||
agcur = agcur->next;
|
||||
} while (agcur != Active_game_head);
|
||||
}
|
||||
|
||||
if (has_responded) {
|
||||
cur = cur->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
memset(ip, 0, sizeof(ip));
|
||||
psnet_addr_to_string(ip, &cur->server_addr);
|
||||
|
||||
ml_printf("FS2NetD Info: (UDP hole-punch) Requesting response from %s", ip);
|
||||
|
||||
FS2NetD_UDPHolePunch(ip);
|
||||
|
||||
cur = cur->next;
|
||||
} while (cur != Game_server_head);*/
|
||||
}
|
||||
|
||||
@@ -65,4 +65,6 @@ void fs2netd_add_table_validation(char *tblname);
|
||||
void fs2netd_update_chat_channel();
|
||||
void fs2netd_update_game_count(char *chan_name);
|
||||
|
||||
void fs2netd_udp_hole_punch();
|
||||
|
||||
#endif // _FS2NETD_CLIENT_H
|
||||
@@ -101,6 +101,7 @@
|
||||
#define PCKT_CHAT_CHAN_COUNT_REPLY 0x19
|
||||
#define PCKT_SLIST_HB_2 0x1a
|
||||
#define PCKT_SLIST_DISCONNECT 0x1b
|
||||
#define PCKT_UDP_HOLE_PUNCH_RQST 0x1c
|
||||
|
||||
|
||||
//***********************************************************************************************************************
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
extern std::vector<crc_valid_status> Table_valid_status;
|
||||
|
||||
|
||||
int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout)
|
||||
bool FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout)
|
||||
{
|
||||
int rc, buffer_size, buffer_offset;
|
||||
bool my_packet = false;
|
||||
@@ -197,7 +197,7 @@ int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout)
|
||||
DONE_PACKET();
|
||||
|
||||
if ( FS2NetD_SendData(buffer, buffer_size) == -1 )
|
||||
return 3;
|
||||
return false;
|
||||
|
||||
|
||||
Recieve_Only:
|
||||
@@ -207,12 +207,12 @@ Recieve_Only:
|
||||
|
||||
if ( (rc = FS2NetD_GetData(buffer, sizeof(buffer))) != -1 ) {
|
||||
if (rc < BASE_PACKET_SIZE)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
VRFY_PACKET2( PCKT_MCHECK_REPLY );
|
||||
|
||||
if (!my_packet)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
PXO_GET_DATA( status );
|
||||
Assert( (status == 0) || (status == 1) );
|
||||
@@ -220,11 +220,9 @@ Recieve_Only:
|
||||
// anything beyond 'true' is considered a failure of some kind
|
||||
if (status > 1)
|
||||
status = 0;
|
||||
|
||||
return status+1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (status == 1);
|
||||
}
|
||||
|
||||
int FS2NetD_SendPlayerData(int SID, const char *player_name, const char *user, player *pl, int timeout)
|
||||
@@ -1027,3 +1025,23 @@ void FS2NetD_GameCountUpdate(char *chan_name)
|
||||
FS2NetD_SendData(buffer, buffer_size);
|
||||
}
|
||||
|
||||
void FS2NetD_UDPHolePunch(char *ip_string)
|
||||
{
|
||||
int buffer_size;
|
||||
char buffer[BASE_PACKET_SIZE+40];
|
||||
|
||||
Assert( ip_string );
|
||||
|
||||
// Clear any old dead crap data
|
||||
FS2NetD_IgnorePackets();
|
||||
|
||||
// (fs2open_ping)
|
||||
INIT_PACKET( PCKT_UDP_HOLE_PUNCH_RQST );
|
||||
|
||||
PXO_ADD_STRING( ip_string );
|
||||
|
||||
DONE_PACKET();
|
||||
|
||||
FS2NetD_SendData(buffer, buffer_size);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ struct netgame_info;
|
||||
|
||||
int FS2NetD_SendPlayerData(int SID, const char* player_name, const char* user, player *pl, int timeout = 15);
|
||||
int FS2NetD_GetPlayerData(int SID, const char* player_name, player *pl, bool CanCreate = false, int timeout = 15);
|
||||
int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout = 15);
|
||||
bool FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout = 15);
|
||||
int FS2NetD_CheckValidSID(int SID);
|
||||
int FS2NetD_GetServerList(int timeout = 15);
|
||||
void FS2NetD_Ping();
|
||||
@@ -107,6 +107,7 @@ void FS2NetD_Pong(int tstamp);
|
||||
int FS2NetD_ValidateTableList(int timeout = 30);
|
||||
void FS2NetD_ChatChannelUpdate(char *chan_name);
|
||||
void FS2NetD_GameCountUpdate(char *chan_name);
|
||||
void FS2NetD_UDPHolePunch(char *ip_string);
|
||||
fs2open_banmask *FS2NetD_GetBanList(int *numBanMasks, int timeout = 15);
|
||||
|
||||
// longer timeouts - mySQL operations
|
||||
|
||||
@@ -771,14 +771,6 @@ $Player Shield Recharge Scale: 4, 2, 1.5, 1.25, 1 \n\
|
||||
;; factor applied to the speed at which the player's weapons recharge \n\
|
||||
$Player Weapon Recharge Scale: 10, 4, 2.5, 2, 1.5 \n\
|
||||
\n\
|
||||
;; maximum number of turrets on one ship allowed to be attacking a \n\
|
||||
;; target at a given time \n\
|
||||
$Max Turret Target Ownage: 3, 4, 7, 12, 19 \n\
|
||||
\n\
|
||||
;; maximum number of turrets on one ship allowed to be attacking the \n\
|
||||
;; player at a given time \n\
|
||||
$Max Turret Player Ownage: 3, 4, 7, 12, 19 \n\
|
||||
\n\
|
||||
\n\
|
||||
;; General AI-related flags. These were previously all lumped together \n\
|
||||
;; under the New AI mission flag. \n\
|
||||
|
||||
@@ -511,8 +511,6 @@ typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
|
||||
|
||||
#define HARDWARE_ONLY
|
||||
|
||||
//Stucture to store clipping codes in a word
|
||||
typedef struct ccodes {
|
||||
ubyte cc_or, cc_and; //or is low byte, and is high byte
|
||||
@@ -525,29 +523,14 @@ typedef struct vec3d {
|
||||
struct {
|
||||
float x,y,z;
|
||||
} xyz;
|
||||
|
||||
float a1d[3];
|
||||
};
|
||||
inline void operator= (vertex&vert);
|
||||
inline void set_screen_vert(vertex&vert);
|
||||
|
||||
inline void operator= (vertex &vert);
|
||||
inline void set_screen_vert(vertex &vert);
|
||||
} vec3d;
|
||||
|
||||
/*
|
||||
// A vector referenced as an array
|
||||
typedef struct vectora {
|
||||
float xyz[3];
|
||||
} vectora;
|
||||
|
||||
|
||||
typedef struct vec2d {
|
||||
float i,j;
|
||||
} vec2d;
|
||||
|
||||
// Used for some 2d primitives, like gr_poly
|
||||
typedef struct vert2df {
|
||||
float x, y;
|
||||
} vert2df;
|
||||
*/
|
||||
|
||||
typedef struct angles {
|
||||
float p, b, h;
|
||||
} angles_t;
|
||||
@@ -557,38 +540,41 @@ typedef struct matrix {
|
||||
struct {
|
||||
vec3d rvec, uvec, fvec;
|
||||
} vec;
|
||||
|
||||
float a2d[3][3];
|
||||
float a1d[9];
|
||||
};
|
||||
} matrix;
|
||||
|
||||
typedef struct uv_pair {
|
||||
float u,v;
|
||||
float u, v;
|
||||
} uv_pair;
|
||||
|
||||
// Used to store rotated points for mines.
|
||||
// Has flag to indicate if projected.
|
||||
typedef struct vertex {
|
||||
float x, y, z; // world space position
|
||||
float sx, sy, sw; // screen space position (sw == 1/z)
|
||||
float u, v, u2, v2, u3, v3, u4, v4; // texture position
|
||||
vec3d real_pos; // _real_ world position
|
||||
ubyte spec_a, spec_r, spec_b, spec_g; //specular highlights -Bobboau
|
||||
ubyte r, g, b, a; // color. Use b for darkening;
|
||||
ubyte codes; // what sides of view pyramid this point is on/off. 0 = Inside view pyramid.
|
||||
ubyte flags; // Projection flags. Indicates whether it is projected or not or if projection overflowed.
|
||||
ubyte pad[2]; // pad structure to be 4 byte aligned.
|
||||
void operator=(vec3d&vec){
|
||||
memcpy(&x,&vec, sizeof(vec3d));
|
||||
}
|
||||
float x, y, z; // world space position
|
||||
float sx, sy, sw; // screen space position (sw == 1/z)
|
||||
float u, v; //, u2, v2, u3, v3, u4, v4; // texture position
|
||||
vec3d real_pos; // _real_ world position
|
||||
ubyte spec_a, spec_r, spec_b, spec_g; //specular highlights -Bobboau
|
||||
ubyte r, g, b, a; // color. Use b for darkening;
|
||||
ubyte codes; // what sides of view pyramid this point is on/off. 0 = Inside view pyramid.
|
||||
ubyte flags; // Projection flags. Indicates whether it is projected or not or if projection overflowed.
|
||||
ubyte pad[2]; // pad structure to be 4 byte aligned.
|
||||
|
||||
void operator= (vec3d &vec) { memcpy(&x, &vec, sizeof(vec3d)); }
|
||||
} vertex;
|
||||
|
||||
inline void vec3d::operator= (vertex&vert){
|
||||
memcpy(this,&vert.x,sizeof(vec3d));
|
||||
inline void vec3d::operator= (vertex &vert)
|
||||
{
|
||||
memcpy(this, &vert.x, sizeof(vec3d));
|
||||
}
|
||||
|
||||
//set the vector to the vertex screen position
|
||||
inline void vec3d::set_screen_vert(vertex&vert){
|
||||
memcpy(this,&vert.sx,sizeof(vec3d));
|
||||
inline void vec3d::set_screen_vert(vertex &vert)
|
||||
{
|
||||
memcpy(this, &vert.sx, sizeof(vec3d));
|
||||
}
|
||||
|
||||
//def_list
|
||||
@@ -684,6 +670,7 @@ const float PI2 = (PI*2.0f);
|
||||
// half values
|
||||
const float PI_2 = (PI/2.0f);
|
||||
const int RAND_MAX_2 = (RAND_MAX/2);
|
||||
const float RAND_MAX_1f = (1.0f / RAND_MAX);
|
||||
|
||||
#define ANG_TO_RAD(x) ((x)*PI/180)
|
||||
|
||||
|
||||
@@ -290,11 +290,15 @@ int Interface_last_tick = -1; // last timer tick on flip
|
||||
char Processing_filename[MAX_PATH_LEN];
|
||||
#endif
|
||||
|
||||
// If true, then we are using Direct3D hardware. This is used for game type stuff
|
||||
// that changes when you're using hardware.
|
||||
int D3D_enabled = 0;
|
||||
// for OGL
|
||||
int OGL_enabled = 0;
|
||||
// override states to skip rendering of certain elements, but without disabling them completely
|
||||
bool Basemap_override = false;
|
||||
bool Envmap_override = false;
|
||||
bool Specmap_override = false;
|
||||
bool Normalmap_override = false;
|
||||
bool Heightmap_override = false;
|
||||
bool Glowpoint_override = false;
|
||||
bool GLSL_override = false;
|
||||
|
||||
|
||||
// Values used for noise for thruster animations
|
||||
float Noise[NOISE_NUM_FRAMES] = {
|
||||
|
||||
@@ -366,12 +366,15 @@ extern int Interface_last_tick; // last timer tick on flip
|
||||
// Noise numbers go from 0 to 1.0
|
||||
extern float Noise[NOISE_NUM_FRAMES];
|
||||
|
||||
// override states to skip rendering of certain elements, but without disabling them completely
|
||||
extern bool Basemap_override;
|
||||
extern bool Envmap_override;
|
||||
extern bool Specmap_override;
|
||||
extern bool Normalmap_override;
|
||||
extern bool Heightmap_override;
|
||||
extern bool Glowpoint_override;
|
||||
extern bool GLSL_override;
|
||||
|
||||
// If true, then we are using Direct3D hardware. This is used for game type stuff
|
||||
// that changes when you're using hardware.
|
||||
extern int D3D_enabled;
|
||||
// for OGL
|
||||
extern int OGL_enabled;
|
||||
|
||||
// game skill levels
|
||||
#define NUM_SKILL_LEVELS 5
|
||||
|
||||
@@ -169,9 +169,10 @@
|
||||
// the first version is 3.0 :-)
|
||||
// Major.Minor.Bugfix
|
||||
|
||||
#define FS_VERSION_MAJOR 3 // major version
|
||||
#define FS_VERSION_MINOR 6 // increase by 1 for minor revs
|
||||
#define FS_VERSION_BUILD 10 // bugfix release
|
||||
#define FS_VERSION_MAJOR 3 // major version
|
||||
#define FS_VERSION_MINOR 6 // increase by 1 for minor revs
|
||||
#define FS_VERSION_BUILD 10 // bugfix release
|
||||
#define FS_VERSION_IDENT NOX("Xt-0314") // special build release identifier, must be a string (don't define unless it's supposed to be used!!)
|
||||
|
||||
#define VERSION_LOC_FNAME "version.nfo"
|
||||
#define MOTD_LOC_FNAME "motd.txt"
|
||||
|
||||