Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1009fbd144 | ||
|
|
7158aca5a0 |
No files matched your search
@@ -324,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 \
|
||||
@@ -368,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 \
|
||||
@@ -681,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 \
|
||||
@@ -693,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
|
||||
|
||||
@@ -779,11 +779,11 @@ void set_wingnum(int objnum, int wingnum);
|
||||
char *ai_get_goal_ship_name(char *name, int *index);
|
||||
|
||||
extern void init_ai_system(void);
|
||||
extern void ai_attack_object(object *attacker, object *attacked, ship_subsys *ssp);
|
||||
extern void ai_evade_object(object *evader, object *evaded);
|
||||
extern void ai_ignore_object(object *ignorer, object *ignored, int ignore_new);
|
||||
extern void ai_attack_object(object *attacker, object *attacked, int priority, ship_subsys *ssp);
|
||||
extern void ai_evade_object(object *evader, object *evaded, int priority);
|
||||
extern void ai_ignore_object(object *ignorer, object *ignored, int priority, int ignore_new);
|
||||
extern void ai_ignore_wing(object *ignorer, int wingnum, int priority);
|
||||
extern void ai_dock_with_object(object *docker, int docker_index, object *dockee, int dockee_index, int dock_type);
|
||||
extern void ai_dock_with_object(object *docker, int docker_index, object *dockee, int dockee_index, int priority, int dock_type);
|
||||
extern void ai_stay_still(object *still_objp, vec3d *view_pos);
|
||||
extern void ai_set_default_behavior(object *obj, int classnum);
|
||||
extern void ai_do_default_behavior(object *obj);
|
||||
@@ -811,7 +811,7 @@ extern void ai_set_guard_object(object *objp, object *other_objp);
|
||||
extern void ai_set_evade_object(object *objp, object *other_objp);
|
||||
extern void ai_set_guard_wing(object *objp, int wingnum);
|
||||
extern void ai_warp_out(object *objp, vec3d *vp);
|
||||
extern void ai_attack_wing(object *attacker, int wingnum);
|
||||
extern void ai_attack_wing(object *attacker, int wingnum, int priority);
|
||||
extern void ai_deathroll_start(object *ship_obj);
|
||||
extern void ai_fly_in_formation(int wing_num); // Force wing to fly in formation.
|
||||
extern void ai_disband_formation(int wing_num); // Force wing to disband formation flying.
|
||||
@@ -819,7 +819,7 @@ extern int set_target_objnum(ai_info *aip, int objnum);
|
||||
extern void ai_form_on_wing(object *objp, object *goal_objp);
|
||||
extern void ai_do_stay_near(object *objp, object *other_obj, float dist);
|
||||
extern ship_subsys *set_targeted_subsys(ai_info *aip, ship_subsys *new_subsys, int parent_objnum);
|
||||
extern void ai_rearm_repair( object *objp, int docker_index, object *goal_objp, int dockee_index );
|
||||
extern void ai_rearm_repair( object *objp, int docker_index, object *goal_objp, int dockee_index, int priority );
|
||||
extern void ai_add_rearm_goal( object *requester_objp, object *support_objp );
|
||||
extern void create_model_path(object *pl_objp, object *mobjp, int path_num, int subsys_path=0);
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
if (filename == NULL)
|
||||
read_file_text_from_array(defaults_get_file("ai_profiles.tbl"));
|
||||
else
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
read_file_text(filename);
|
||||
|
||||
reset_parse();
|
||||
|
||||
@@ -301,12 +301,6 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
if (optional_string("$Hostile AI Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Friendly AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_friendly, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Hostile AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
|
||||
parse_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
@@ -316,21 +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);
|
||||
|
||||
if (optional_string("$Percentage Required For Kill Scale:"))
|
||||
parse_float_list(profile->kill_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Required For Assist Scale:"))
|
||||
parse_float_list(profile->assist_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Awarded For Capship Assist:"))
|
||||
parse_float_list(profile->assist_award_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS);
|
||||
|
||||
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION);
|
||||
@@ -339,8 +318,6 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
|
||||
set_flag(profile, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT);
|
||||
|
||||
set_flag(profile, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT);
|
||||
|
||||
set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE);
|
||||
|
||||
set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS);
|
||||
@@ -363,26 +340,6 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
|
||||
set_flag(profile, "$use newtonian dampening:", AIPF_USE_NEWTONIAN_DAMPENING);
|
||||
|
||||
set_flag(profile, "$include beams for kills and assists:", AIPF_INCLUDE_BEAMS_IN_STAT_CALCS);
|
||||
|
||||
set_flag(profile, "$score kills based on damage caused:", AIPF_KILL_SCORING_SCALES_WITH_DAMAGE);
|
||||
|
||||
set_flag(profile, "$score assists based on damage caused:", AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE);
|
||||
|
||||
set_flag(profile, "$allow event and goal scoring in multiplayer:", AIPF_ALLOW_MULTI_EVENT_SCORING);
|
||||
|
||||
set_flag(profile, "$fix linked primary weapon decision bug:", AIPF_FIX_LINKED_PRIMARY_BUG);
|
||||
|
||||
set_flag(profile, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE);
|
||||
|
||||
set_flag(profile, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS);
|
||||
|
||||
set_flag(profile, "$fix heat seekers homing on stealth ships bug:", AIPF_FIX_HEAT_SEEKER_STEALTH_BUG);
|
||||
|
||||
set_flag(profile, "$multi allow empty primaries:", AIPF_MULTI_ALLOW_EMPTY_PRIMARIES);
|
||||
|
||||
set_flag(profile, "$multi allow empty secondaries:", AIPF_MULTI_ALLOW_EMPTY_SECONDARIES);
|
||||
|
||||
// if we've been through once already and are at the same place, force a move
|
||||
if ( saved_Mp && (saved_Mp == Mp) )
|
||||
Mp++;
|
||||
@@ -429,8 +386,6 @@ void ai_profiles_init()
|
||||
if (temp >= 0)
|
||||
Default_ai_profile = temp;
|
||||
|
||||
Ai_profiles[Default_ai_profile].flags |= AIPF_SMART_SECONDARY_WEAPON_SELECTION;
|
||||
|
||||
Ai_profiles_initted = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,17 +73,6 @@
|
||||
#define AIPF_DISABLE_WEAPON_DAMAGE_SCALING (1 << 12)
|
||||
#define AIPF_USE_ADDITIVE_WEAPON_VELOCITY (1 << 13)
|
||||
#define AIPF_USE_NEWTONIAN_DAMPENING (1 << 14)
|
||||
#define AIPF_INCLUDE_BEAMS_IN_STAT_CALCS (1 << 15)
|
||||
#define AIPF_KILL_SCORING_SCALES_WITH_DAMAGE (1 << 16)
|
||||
#define AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE (1 << 17)
|
||||
#define AIPF_ALLOW_MULTI_EVENT_SCORING (1 << 18)
|
||||
#define AIPF_SMART_AFTERBURNER_MANAGEMENT (1 << 19)
|
||||
#define AIPF_FIX_LINKED_PRIMARY_BUG (1 << 20)
|
||||
#define AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE (1 << 21)
|
||||
#define AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS (1 << 22)
|
||||
#define AIPF_FIX_HEAT_SEEKER_STEALTH_BUG (1 << 23)
|
||||
#define AIPF_MULTI_ALLOW_EMPTY_PRIMARIES (1 << 24)
|
||||
#define AIPF_MULTI_ALLOW_EMPTY_SECONDARIES (1 << 25)
|
||||
|
||||
|
||||
#define MAX_AI_PROFILES 5
|
||||
@@ -126,21 +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];
|
||||
|
||||
// Multiplicative secondary delay factors for increasing skill levels.
|
||||
float ship_fire_secondary_delay_scale_hostile[NUM_SKILL_LEVELS];
|
||||
float ship_fire_secondary_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];
|
||||
|
||||
// percentage of damage caused required for a kill/assist
|
||||
float kill_percentage_scale[NUM_SKILL_LEVELS];
|
||||
float assist_percentage_scale[NUM_SKILL_LEVELS];
|
||||
|
||||
// percentage of the capships score given to other team mates on a kill
|
||||
float assist_award_percentage_scale[NUM_SKILL_LEVELS];
|
||||
|
||||
} ai_profile_t;
|
||||
|
||||
|
||||
|
||||
@@ -722,8 +722,6 @@
|
||||
#define PLAYER_PRIORITY_WING 95
|
||||
#define PLAYER_PRIORITY_SUPPORT_LOW 10
|
||||
|
||||
#define MAX_GOAL_PRIORITY 200
|
||||
|
||||
// define for which goals cause other goals to get purged
|
||||
// Goober5000 - okay, this seems really stupid. If any ship in the mission is assigned a goal
|
||||
// in PURGE_GOALS_ALL_SHIPS, *every* other ship will have certain goals purged. So I added
|
||||
@@ -1349,10 +1347,6 @@ void ai_add_goal_sub_player(int type, int mode, int submode, char *shipname, ai_
|
||||
if ( (mode == AI_GOAL_STAY_NEAR_SHIP) || (mode == AI_GOAL_KEEP_SAFE_DISTANCE) )
|
||||
aigp->priority = PLAYER_PRIORITY_SUPPORT_LOW;
|
||||
|
||||
// Goober5000 - same with form-on-wing, since it's a type of staying near
|
||||
else if ( mode == AI_GOAL_FORM_ON_WING )
|
||||
aigp->priority = PLAYER_PRIORITY_SUPPORT_LOW;
|
||||
|
||||
else if ( aigp->type == AIG_TYPE_PLAYER_WING )
|
||||
aigp->priority = PLAYER_PRIORITY_WING; // player wing goals not as high as ship goals
|
||||
else
|
||||
@@ -1391,68 +1385,6 @@ int ai_goal_find_empty_slot( ai_goal *goals, int active_goal )
|
||||
return oldest_index;
|
||||
}
|
||||
|
||||
int ai_goal_num(ai_goal *goals)
|
||||
{
|
||||
int gindex = 0;
|
||||
int num_goals = 0;
|
||||
for(gindex = 0; gindex < MAX_AI_GOALS; gindex++)
|
||||
{
|
||||
if(goals[gindex].ai_mode != AI_GOAL_NONE)
|
||||
num_goals++;
|
||||
}
|
||||
|
||||
return num_goals;
|
||||
}
|
||||
|
||||
|
||||
void ai_add_goal_sub_scripting(int type, int mode, int submode, int priority, char *shipname, ai_goal *aigp )
|
||||
{
|
||||
Assert ( (type == AIG_TYPE_PLAYER_WING) || (type == AIG_TYPE_PLAYER_SHIP) );
|
||||
|
||||
aigp->time = Missiontime;
|
||||
aigp->type = type; // from player for sure -- could be to ship or to wing
|
||||
aigp->ai_mode = mode; // major mode for this goal
|
||||
aigp->ai_submode = submode; // could mean different things depending on mode
|
||||
|
||||
if ( mode == AI_GOAL_WARP )
|
||||
aigp->wp_index = submode;
|
||||
|
||||
if ( mode == AI_GOAL_CHASE_WEAPON ) {
|
||||
aigp->wp_index = submode; // submode contains the instance of the weapon
|
||||
aigp->weapon_signature = Objects[Weapons[submode].objnum].signature;
|
||||
}
|
||||
|
||||
if ( shipname != NULL )
|
||||
aigp->ship_name = ai_get_goal_ship_name( shipname, &aigp->ship_name_index );
|
||||
else
|
||||
aigp->ship_name = NULL;
|
||||
|
||||
aigp->priority = priority;
|
||||
}
|
||||
|
||||
void ai_add_ship_goal_scripting(int mode, int submode, int priority, char *shipname, ai_info *aip)
|
||||
{
|
||||
int empty_index;
|
||||
ai_goal *aigp;
|
||||
|
||||
empty_index = ai_goal_find_empty_slot(aip->goals, aip->active_goal);
|
||||
aigp = &aip->goals[empty_index];
|
||||
|
||||
//WMC - hack to get docking setup correctly
|
||||
if ( mode == AI_GOAL_DOCK ) {
|
||||
aigp->docker.name = Ships[aip->shipnum].ship_name;
|
||||
aigp->dockee.name = shipname;
|
||||
aigp->flags &= ~AIGF_DOCK_INDEXES_VALID;
|
||||
}
|
||||
ai_add_goal_sub_scripting(AIG_TYPE_PLAYER_SHIP, mode, submode, priority, shipname, aigp);
|
||||
|
||||
if ( (mode == AI_GOAL_REARM_REPAIR) || ((mode == AI_GOAL_DOCK) && (submode == AIS_DOCK_0)) ) {
|
||||
ai_goal_fixup_dockpoints( aip, aigp );
|
||||
}
|
||||
|
||||
aigp->signature = Ai_goal_signature++;
|
||||
}
|
||||
|
||||
// adds a goal from a player to the given ship's ai_info structure. 'type' tells us if 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
|
||||
@@ -1678,9 +1610,9 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
|
||||
Int3(); // get ALLENDER -- invalid ai-goal specified for ai object!!!!
|
||||
}
|
||||
|
||||
if ( aigp->priority > MAX_GOAL_PRIORITY ) {
|
||||
nprintf (("AI", "bashing sexpression priority of goal %s from %d to %d.\n", text, aigp->priority, MAX_GOAL_PRIORITY));
|
||||
aigp->priority = MAX_GOAL_PRIORITY;
|
||||
if ( aigp->priority >= PLAYER_PRIORITY_MIN ) {
|
||||
nprintf (("AI", "bashing sexpression priority of goal %s from %d to %d.\n", text, aigp->priority, PLAYER_PRIORITY_MIN-1));
|
||||
aigp->priority = PLAYER_PRIORITY_MIN-1;
|
||||
}
|
||||
|
||||
// Goober5000 - since none of the goals act on the actor,
|
||||
@@ -1782,7 +1714,7 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int doc
|
||||
|
||||
case AI_GOAL_UNDOCK:
|
||||
aigp->ship_name = name;
|
||||
aigp->priority = MAX_GOAL_PRIORITY;
|
||||
aigp->priority = 100;
|
||||
aigp->ai_mode = AI_GOAL_UNDOCK;
|
||||
aigp->ai_submode = AIS_UNDOCK_0;
|
||||
break;
|
||||
@@ -1842,15 +1774,11 @@ void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip )
|
||||
int j;
|
||||
|
||||
for ( j = 0; j < MAX_AI_GOALS; j++ ) {
|
||||
if ( aip->goals[j].ai_mode == AI_GOAL_NONE ) {
|
||||
aip->goals[j] = *aigp;
|
||||
if ( aip->goals[j].ai_mode == AI_GOAL_NONE )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j >= MAX_AI_GOALS) {
|
||||
mprintf(("Unable to assign wing goal to ship %s; the ship goals are already filled to capacity", Ships[aip->shipnum].ship_name));
|
||||
}
|
||||
Assert ( j < MAX_AI_GOALS );
|
||||
aip->goals[j] = *aigp;
|
||||
}
|
||||
|
||||
|
||||
@@ -2243,7 +2171,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
Assert( sindex != -1 ); // should be true because of above status
|
||||
ignored = &Objects[Ships[sindex].objnum];
|
||||
|
||||
ai_ignore_object(objp, ignored, (aigp->ai_mode == AI_GOAL_IGNORE_NEW));
|
||||
ai_ignore_object(objp, ignored, 100, (aigp->ai_mode == AI_GOAL_IGNORE_NEW));
|
||||
|
||||
return AI_GOAL_SATISFIED;
|
||||
}
|
||||
@@ -2562,13 +2490,13 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
|
||||
// Mike -- debug code!
|
||||
// If a ship has a subobject on it, attack that instead of the main ship!
|
||||
ai_attack_object( objp, other_obj, NULL);
|
||||
ai_attack_object( objp, other_obj, current_goal->priority, NULL);
|
||||
break;
|
||||
|
||||
case AI_GOAL_CHASE_WEAPON:
|
||||
Assert( Weapons[current_goal->wp_index].objnum != -1 );
|
||||
other_obj = &Objects[Weapons[current_goal->wp_index].objnum];
|
||||
ai_attack_object( objp, other_obj, NULL );
|
||||
ai_attack_object( objp, other_obj, current_goal->priority, NULL );
|
||||
break;
|
||||
|
||||
case AI_GOAL_GUARD:
|
||||
@@ -2617,7 +2545,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
// be sure that we have indices for docking points here! If we ever had names, they should
|
||||
// get fixed up in goal_achievable so that the points can be checked there for validity
|
||||
Assert (current_goal->flags & AIGF_DOCK_INDEXES_VALID);
|
||||
ai_dock_with_object( objp, current_goal->docker.index, other_obj, current_goal->dockee.index, AIDO_DOCK );
|
||||
ai_dock_with_object( objp, current_goal->docker.index, other_obj, current_goal->dockee.index, current_goal->priority, AIDO_DOCK );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2680,7 +2608,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
}
|
||||
|
||||
// passing 0, 0 is okay because the undock code will figure out where to undock from
|
||||
ai_dock_with_object( objp, 0, other_obj, 0, AIDO_UNDOCK );
|
||||
ai_dock_with_object( objp, 0, other_obj, 0, current_goal->priority, AIDO_UNDOCK );
|
||||
break;
|
||||
|
||||
|
||||
@@ -2694,7 +2622,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
shipnum = ship_name_lookup( current_goal->ship_name );
|
||||
Assert( shipnum >= 0 );
|
||||
other_obj = &Objects[Ships[shipnum].objnum];
|
||||
ai_attack_object( objp, other_obj, NULL);
|
||||
ai_attack_object( objp, other_obj, current_goal->priority, NULL);
|
||||
ai_set_attack_subsystem( objp, current_goal->ai_submode ); // submode stored the subsystem type
|
||||
if (current_goal->ai_mode != AI_GOAL_DESTROY_SUBSYSTEM) {
|
||||
if (aip->target_objnum != -1) {
|
||||
@@ -2712,11 +2640,11 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
case AI_GOAL_CHASE_WING:
|
||||
wingnum = wing_name_lookup( current_goal->ship_name );
|
||||
Assert( wingnum >= 0 );
|
||||
ai_attack_wing(objp, wingnum);
|
||||
ai_attack_wing(objp, wingnum, current_goal->priority);
|
||||
break;
|
||||
|
||||
case AI_GOAL_CHASE_ANY:
|
||||
ai_attack_object( objp, NULL, NULL );
|
||||
ai_attack_object( objp, NULL, current_goal->priority, NULL );
|
||||
break;
|
||||
|
||||
case AI_GOAL_WARP: {
|
||||
@@ -2731,7 +2659,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
shipnum = ship_name_lookup( current_goal->ship_name );
|
||||
Assert( shipnum >= 0 );
|
||||
other_obj = &Objects[Ships[shipnum].objnum];
|
||||
ai_evade_object( objp, other_obj);
|
||||
ai_evade_object( objp, other_obj, current_goal->priority );
|
||||
break;
|
||||
|
||||
case AI_GOAL_STAY_STILL:
|
||||
@@ -2786,7 +2714,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
shipnum = ship_name_lookup( current_goal->ship_name );
|
||||
Assert( shipnum >= 0 );
|
||||
other_obj = &Objects[Ships[shipnum].objnum];
|
||||
ai_rearm_repair( objp, current_goal->docker.index, other_obj, current_goal->dockee.index );
|
||||
ai_rearm_repair( objp, current_goal->docker.index, other_obj, current_goal->dockee.index, current_goal->priority );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -263,10 +263,7 @@ extern void ai_post_process_mission();
|
||||
extern void ai_maybe_add_form_goal( wing *wingp );
|
||||
extern void ai_process_mission_orders( int objnum, ai_info *aip );
|
||||
|
||||
extern int ai_goal_num(ai_goal *goals);
|
||||
|
||||
// adds goals to ships/wing through sexpressions
|
||||
extern void ai_add_ship_goal_scripting(int mode, int submode, int priority, char *shipname, ai_info *aip);
|
||||
extern void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip );
|
||||
extern void ai_add_wing_goal_sexp( int sexp, int type, int wingnum );
|
||||
extern void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp );
|
||||
|
||||
@@ -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
|
||||
@@ -178,9 +178,6 @@
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "weapon/muzzleflash.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
// How close a turret has to be point at its target before it
|
||||
// can fire. If the dot of the gun normal and the vector from gun
|
||||
// to target is greater than this, the turret fires. The smaller
|
||||
@@ -600,13 +597,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
|
||||
// check if object is a bomb attacking the turret parent
|
||||
// check if bomb is homing on the turret parent ship
|
||||
bool check_weapon = true;
|
||||
|
||||
if ((The_mission.ai_profile->flags & AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE) && (dist > eeo->weapon_travel_dist)) {
|
||||
check_weapon = false;
|
||||
}
|
||||
|
||||
if ((objp->type == OBJ_WEAPON) && check_weapon) {
|
||||
if (objp->type == OBJ_WEAPON) {
|
||||
if ( Weapons[objp->instance].homing_object == &Objects[eeo->turret_parent_objnum] ) {
|
||||
if ( dist < eeo->nearest_homing_bomb_dist ) {
|
||||
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, tp, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
|
||||
@@ -641,11 +632,7 @@ void 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;
|
||||
}
|
||||
@@ -842,18 +829,15 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
objp = &Objects[ao->objnum];
|
||||
evaluate_obj_as_target(objp, &eeo);
|
||||
}
|
||||
|
||||
if (eeo.nearest_objnum != -1) {
|
||||
return eeo.nearest_objnum;
|
||||
}
|
||||
}
|
||||
break;
|
||||
return eeo.nearest_objnum; // lowest priority is the closest enemy objnum
|
||||
|
||||
default:
|
||||
Int3(); //Means invalid number passed.
|
||||
}
|
||||
}
|
||||
|
||||
//prevent warning of all control paths not returning a value
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1090,20 +1074,7 @@ float aifft_compute_turret_dot(object *objp, object *enemy_objp, vec3d *abs_gunp
|
||||
vec3d turret_norm;
|
||||
|
||||
vm_vec_rotate(&turret_norm, &turret_subsysp->system_info->turret_norm, &objp->orient);
|
||||
float dot_return = vm_vec_dot(&turret_norm, &vector_out);
|
||||
|
||||
if (The_mission.ai_profile->flags & AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS) {
|
||||
if (dot_return > turret_subsysp->system_info->turret_fov) {
|
||||
// target is in sight and in fov
|
||||
return dot_return;
|
||||
} else {
|
||||
// target is in sight but is not in turret's fov
|
||||
return -1.0f;
|
||||
}
|
||||
} else {
|
||||
// target is in sight and we dont care if its in turret's fov or not
|
||||
return dot_return;
|
||||
}
|
||||
return vm_vec_dot(&turret_norm, &vector_out);
|
||||
} else
|
||||
return -1.0f;
|
||||
|
||||
@@ -1158,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;
|
||||
}
|
||||
|
||||
@@ -1210,18 +1181,11 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en
|
||||
}
|
||||
int offset = (int)frand_range(0.0f, (float)(aifft_list_size % stride));
|
||||
int idx;
|
||||
float dot_fov_modifier = 0.0f;
|
||||
|
||||
if (The_mission.ai_profile->flags & AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS) {
|
||||
if (ssp->system_info->turret_fov < 0)
|
||||
dot_fov_modifier = ssp->system_info->turret_fov;
|
||||
}
|
||||
|
||||
for(idx=offset; idx<aifft_list_size; idx+=stride){
|
||||
dot = aifft_compute_turret_dot(objp, enemy_objp, &abs_gun_pos, ssp, aifft_list[idx]);
|
||||
|
||||
if ((dot - dot_fov_modifier)* aifft_rank[idx] > best_dot) {
|
||||
best_dot = (dot - dot_fov_modifier)*aifft_rank[idx];
|
||||
if (dot* aifft_rank[idx] > best_dot) {
|
||||
best_dot = dot*aifft_rank[idx];
|
||||
best_subsysp = aifft_list[idx];
|
||||
}
|
||||
}
|
||||
@@ -1387,24 +1351,27 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
// 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
|
||||
else if ((wip->wi_flags & WIF_SWARM) || (wip->wi_flags & WIF_CORKSCREW)) {
|
||||
else if (wip->wi_flags & WIF_SWARM) {
|
||||
turret_swarm_set_up_info(parent_objnum, turret, wip);
|
||||
|
||||
return true;
|
||||
}
|
||||
// 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) {
|
||||
@@ -1413,7 +1380,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
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);
|
||||
|
||||
@@ -1432,6 +1399,10 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
} 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) ) {
|
||||
@@ -1453,6 +1424,11 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((parent_ship->cloak_stage > 0) && (parent_ship->cloak_stage < 3))
|
||||
{
|
||||
shipfx_start_cloak(parent_ship,500);
|
||||
}
|
||||
}
|
||||
|
||||
// reset any animations if we need to
|
||||
@@ -1488,7 +1464,7 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
tsi->turret->turret_next_fire_pos++;
|
||||
|
||||
//check if this really is a swarm. If not, how the hell did it get here?
|
||||
Assert((Weapon_info[tsi->weapon_class].wi_flags & WIF_SWARM) || (Weapon_info[tsi->weapon_class].wi_flags & WIF_CORKSCREW));
|
||||
Assert(Weapon_info[tsi->weapon_class].wi_flags & WIF_SWARM);
|
||||
|
||||
|
||||
// *If it's a non-homer, then use the last fire direction instead of turret orientation to fix inaccuracy
|
||||
@@ -1511,6 +1487,11 @@ void 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.
|
||||
@@ -1518,8 +1499,7 @@ void 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;
|
||||
@@ -1606,7 +1586,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
// (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;
|
||||
}
|
||||
@@ -1662,10 +1642,6 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
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)
|
||||
@@ -1862,20 +1838,18 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
vec3d tv2e; //so flak can get their jitter without screwing up other guns
|
||||
|
||||
if (dot > tp->turret_fov ) {
|
||||
// We're ready to fire... now get down to specifics, like where is the
|
||||
// actual gun point and normal, not just the one for whole turret.
|
||||
ship_get_global_turret_gun_info(&Objects[parent_objnum], ss, &gpos, &gvec, use_angles, &predicted_enemy_pos);
|
||||
ss->turret_next_fire_pos++;
|
||||
|
||||
// Fire in the direction the turret is facing, not right at the target regardless of turret dir.
|
||||
vm_vec_sub(&v2e, &predicted_enemy_pos, &gpos);
|
||||
dist_to_enemy = vm_vec_normalize(&v2e);
|
||||
dot = vm_vec_dot(&v2e, &gvec);
|
||||
|
||||
for(i = 0; i < num_valid; i++)
|
||||
{
|
||||
// We're ready to fire... now get down to specifics, like where is the
|
||||
// actual gun point and normal, not just the one for whole turret.
|
||||
// moved here as if there are two weapons with indentical fire stamps
|
||||
// they would have shared the fire point.
|
||||
ship_get_global_turret_gun_info(&Objects[parent_objnum], ss, &gpos, &gvec, use_angles, &predicted_enemy_pos);
|
||||
|
||||
// Fire in the direction the turret is facing, not right at the target regardless of turret dir.
|
||||
vm_vec_sub(&v2e, &predicted_enemy_pos, &gpos);
|
||||
dist_to_enemy = vm_vec_normalize(&v2e);
|
||||
dot = vm_vec_dot(&v2e, &gvec);
|
||||
|
||||
wip = get_turret_weapon_wip(&ss->weapons, valid_weapons[i]);
|
||||
tv2e = v2e;
|
||||
|
||||
@@ -1935,25 +1909,6 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -1962,8 +1917,6 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
//Pass along which gun we are using
|
||||
turret_fire_weapon(valid_weapons[i], ss, parent_objnum, &gpos, &tv2e, &predicted_enemy_pos);
|
||||
}
|
||||
// moved this here so we increment the fire pos only after we have fired and not during it
|
||||
ss->turret_next_fire_pos++;
|
||||
}
|
||||
|
||||
if(!something_was_ok_to_fire)
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -1626,7 +1625,7 @@ float asteroid_create_explosion(object *objp)
|
||||
|
||||
fireball_scale_multiplier = asteroid_get_fireball_scale_multiplier(objp->instance);
|
||||
|
||||
fireball_objnum = fireball_create( &objp->pos, FIREBALL_ASTEROID, FIREBALL_LARGE_EXPLOSION, OBJ_INDEX(objp), objp->radius*fireball_scale_multiplier, 0, &objp->phys_info.vel );
|
||||
fireball_objnum = fireball_create( &objp->pos, FIREBALL_ASTEROID, OBJ_INDEX(objp), objp->radius*fireball_scale_multiplier, 0, &objp->phys_info.vel );
|
||||
if ( fireball_objnum > -1 ) {
|
||||
explosion_life = fireball_lifeleft(&Objects[fireball_objnum]);
|
||||
} else {
|
||||
@@ -2164,7 +2163,7 @@ void asteroid_parse_tbl()
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text("asteroid.tbl", CF_TYPE_TABLES);
|
||||
read_file_text("asteroid.tbl");
|
||||
reset_parse();
|
||||
|
||||
required_string("#Asteroid Types");
|
||||
@@ -2454,7 +2453,11 @@ void asteroid_page_in()
|
||||
|
||||
// Page in textures
|
||||
for (j=0; j<asip->modelp[k]->n_textures; j++ ) {
|
||||
asip->modelp[k]->maps[j].PageIn();
|
||||
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;
|
||||
|
||||
@@ -1004,7 +1004,8 @@ void EndAutoPilot()
|
||||
{
|
||||
Cutscene_bar_flags &= ~CUB_CUTSCENE;
|
||||
}
|
||||
cam_reset_camera();
|
||||
Viewer_mode &= ~VM_FREECAMERA;
|
||||
hud_set_draw(1);
|
||||
CinematicStarted = false;
|
||||
}
|
||||
|
||||
@@ -1101,17 +1102,13 @@ void EndAutoPilot()
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
camera* nav_get_set_camera()
|
||||
void camera_face(vec3d &loc)
|
||||
{
|
||||
static camid nav_camera;
|
||||
if(!nav_camera.isValid())
|
||||
{
|
||||
nav_camera = cam_create("Nav camera");
|
||||
}
|
||||
|
||||
cam_set_camera(nav_camera);
|
||||
|
||||
return nav_camera.getCamera();
|
||||
vec3d destvec;
|
||||
matrix cam_orient;
|
||||
vm_vec_sub(&destvec, &loc, Free_camera->get_position());
|
||||
vm_vector_2_matrix(&cam_orient, &destvec, &Player_obj->orient.vec.uvec, &Player_obj->orient.vec.rvec);
|
||||
Free_camera->set_rotation(&cam_orient, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
void nav_warp(bool prewarp=false)
|
||||
@@ -1166,13 +1163,11 @@ void NavSystem_Do()
|
||||
{
|
||||
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
|
||||
{
|
||||
camera *cam = nav_get_set_camera();
|
||||
if (CinematicStarted)
|
||||
{
|
||||
// update our cinematic and possibly perform warp
|
||||
//if (!CameraMoving)
|
||||
if(cam != NULL)
|
||||
cam->set_rotation_facing(&Player_obj->pos);
|
||||
camera_face(Player_obj->pos);
|
||||
|
||||
if (timestamp() >= MoveCamera && !CameraMoving && vm_vec_mag(&cameraTarget) > 0.0f)
|
||||
{
|
||||
@@ -1196,14 +1191,12 @@ void NavSystem_Do()
|
||||
Cutscene_bar_flags |= CUB_CUTSCENE;
|
||||
Cutscene_bar_flags &= ~CUB_GRADUAL;
|
||||
}
|
||||
Viewer_mode |= VM_FREECAMERA;
|
||||
hud_set_draw(0);
|
||||
nav_warp(true);
|
||||
|
||||
if(cam != NULL)
|
||||
{
|
||||
cam->set_position(&cameraPos);
|
||||
cam->set_rotation_facing(&Player_obj->pos);
|
||||
}
|
||||
|
||||
Free_camera->set_position(&cameraPos);
|
||||
camera_face(Player_obj->pos);
|
||||
CinematicStarted = true;
|
||||
}
|
||||
}
|
||||
@@ -1377,7 +1370,7 @@ void parse_autopilot_table(char *filename)
|
||||
if (filename == NULL)
|
||||
read_file_text_from_array(defaults_get_file("autopilot.tbl"));
|
||||
else
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
read_file_text(filename);
|
||||
|
||||
reset_parse();
|
||||
|
||||
|
||||
@@ -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 ///////////////////
|
||||
|
||||
@@ -1383,6 +1383,10 @@ int bm_load( char *real_filename )
|
||||
if ( !bm_inited )
|
||||
bm_init();
|
||||
|
||||
// nice little trick for keeping standalone memory usage way low - always return a bogus bitmap
|
||||
if (Game_mode & GM_STANDALONE_SERVER)
|
||||
strcpy(filename,"test128");
|
||||
|
||||
// if no file was passed then get out now
|
||||
if ( (real_filename == NULL) || (strlen(real_filename) <= 0) )
|
||||
return -1;
|
||||
@@ -1397,13 +1401,6 @@ int bm_load( char *real_filename )
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
// If we are standalone server keep replacing the 'right_bracket' (right side help bracket) as the filename
|
||||
// should keep the game happy while loading only single pcx file which the needs to be present in any case
|
||||
if (Is_standalone) {
|
||||
char standalone_filename[MAX_FILENAME_LEN] = "right_bracket";
|
||||
strcpy(filename,standalone_filename);
|
||||
}
|
||||
|
||||
// safety catch for strcat...
|
||||
// MAX_FILENAME_LEN-5 == '.' plus 3 letter ext plus NULL terminator
|
||||
if (strlen(filename) > MAX_FILENAME_LEN-5) {
|
||||
@@ -1688,13 +1685,6 @@ int bm_load_animation( char *real_filename, int *nframes, int *fps, int can_drop
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
// If we are standalone server keep replacing the 'cursorweb' (mouse cursor) as the filename
|
||||
// should keep the game happy while loading only single ani file which the needs to be present in any case
|
||||
if (Is_standalone) {
|
||||
char standalone_filename[MAX_FILENAME_LEN] = "cursorweb";
|
||||
strcpy(filename,standalone_filename);
|
||||
}
|
||||
|
||||
// safety catch for strcat...
|
||||
// MAX_FILENAME_LEN-5 == '.' plus 3 letter ext plus NULL terminator
|
||||
if (strlen(filename) > MAX_FILENAME_LEN-5) {
|
||||
@@ -1961,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;
|
||||
|
||||
@@ -1992,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;
|
||||
@@ -2062,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 )
|
||||
@@ -2178,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 ) {
|
||||
@@ -2252,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 )
|
||||
@@ -2314,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
|
||||
@@ -2462,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) {
|
||||
@@ -2617,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;
|
||||
}
|
||||
@@ -2782,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
|
||||
}
|
||||
@@ -2794,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));
|
||||
@@ -3131,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];
|
||||
@@ -3282,14 +3244,10 @@ void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a)
|
||||
// get filename
|
||||
void bm_get_filename(int bitmapnum, char *filename)
|
||||
{
|
||||
if(!bm_is_valid(bitmapnum))
|
||||
{
|
||||
strcpy(filename, "");
|
||||
return;
|
||||
}
|
||||
|
||||
int n = bitmapnum % MAX_BITMAPS;
|
||||
|
||||
Assert( n >= 0 );
|
||||
|
||||
// return filename
|
||||
strcpy(filename, bm_bitmaps[n].filename);
|
||||
}
|
||||
@@ -3300,11 +3258,13 @@ 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;
|
||||
|
||||
@@ -3339,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)
|
||||
@@ -3354,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;
|
||||
}
|
||||
@@ -3367,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;
|
||||
@@ -3376,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;
|
||||
}
|
||||
@@ -3397,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 )
|
||||
@@ -3575,7 +3552,8 @@ 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 );
|
||||
|
||||
if ( !((bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_STATIC) || (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
|
||||
return 0;
|
||||
|
||||
@@ -691,9 +691,9 @@ 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 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
|
||||
|
||||
|
||||
@@ -5,121 +5,50 @@
|
||||
#include "graphics/2d.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h"
|
||||
#include "physics/physics.h" //for avd
|
||||
#include "object/object.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define CAM_STATIONARY_FOV (1<<0)
|
||||
#define CAM_STATIONARY_ORI (1<<1)
|
||||
#define CAM_STATIONARY_POS (1<<2)
|
||||
#define CAM_DEFAULT_FLAGS 0
|
||||
|
||||
class camera
|
||||
{
|
||||
friend class avd_camera;
|
||||
protected:
|
||||
private:
|
||||
char name[NAME_LENGTH];
|
||||
int sig;
|
||||
int flags;
|
||||
|
||||
object_h object_host;
|
||||
int object_host_submodel;
|
||||
vec3d position;
|
||||
vec3d *desired_position; //NULL unless we're trying to move somewhere
|
||||
vec3d translation_velocity;
|
||||
vec3d translation_vel_limit;
|
||||
vec3d translation_acc_limit;
|
||||
|
||||
object_h object_target;
|
||||
int object_target_submodel;
|
||||
|
||||
void (*func_custom_position)(camera *cam, vec3d *pos);
|
||||
void (*func_custom_orientation)(camera *cam, matrix *ori);
|
||||
|
||||
avd_movement fov;
|
||||
|
||||
avd_movement pos_x;
|
||||
avd_movement pos_y;
|
||||
avd_movement pos_z;
|
||||
|
||||
//avd_movement ori_p;
|
||||
//avd_movement ori_b;
|
||||
//avd_movement ori_h;
|
||||
//avd_movement ori_progress;
|
||||
//matrix ori_initial;
|
||||
//matrix ori_final;
|
||||
avd_movement ori[9];
|
||||
|
||||
//Cache stuff
|
||||
float c_fov;
|
||||
vec3d c_pos;
|
||||
matrix c_ori;
|
||||
matrix orientation;
|
||||
matrix *desired_orientation; //NULL unless we're trying to point somewhere
|
||||
vec3d rotation_rate;
|
||||
vec3d rotation_vel_limit;
|
||||
vec3d rotation_acc_limit;
|
||||
public:
|
||||
camera(char *in_name=NULL, int in_signature=-1);
|
||||
camera(char *in_name=NULL);
|
||||
~camera();
|
||||
void clear();
|
||||
void reset();
|
||||
|
||||
//Set
|
||||
//Set'
|
||||
void set_name(char *in_name);
|
||||
|
||||
void set_object_host(object *objp, int n_object_host_submodel = -1);
|
||||
void set_object_target(object *objp, int n_object_target_submodel = -1);
|
||||
|
||||
void set_custom_position_function(void (*n_func_custom_position)(camera *cam, vec3d *pos));
|
||||
void set_custom_orientation_function(void (*n_func_custom_orientation)(camera *cam, matrix *ori));
|
||||
|
||||
void set_fov(float in_fov, float in_fov_time = 0.0f, float in_fov_acceleration_time = 0.0f, float in_deceleration_time = 0.0f);
|
||||
|
||||
void set_position(vec3d *in_position = NULL, float in_translation_time = 0.0f, float in_translation_acceleration_time = 0.0f, float in_translation_deceleration_time = 0.0f, float in_end_velocity = 0.0f);
|
||||
void set_translation_velocity(vec3d *in_velocity, float in_acceleration_time = 0.0f);
|
||||
|
||||
void set_rotation(matrix *in_orientation = NULL, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation(angles *in_angles, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation_facing(vec3d *in_target, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation_velocity(angles *in_rotation_rate, float in_acceleration_time = 0.0f);
|
||||
void set_position(vec3d *in_position = NULL, float in_translation_time = 0.0f, float in_translation_acceleration_time = 0.0f);
|
||||
void set_translation_velocity(vec3d *in_velocity);
|
||||
void set_rotation(matrix *in_orientation = NULL, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
|
||||
void set_rotation(angles *in_angles, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
|
||||
void set_rotation_facing(vec3d *in_target, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
|
||||
void set_rotation_velocity(vec3d *in_rotation_rate);
|
||||
|
||||
//Get
|
||||
//These return values should never ever be changed, I do this in the interest of speed.
|
||||
char *get_name() {return name;}
|
||||
int get_signature() {return sig;}
|
||||
object *get_object_host();
|
||||
int get_object_host_submodel();
|
||||
object *get_object_target();
|
||||
int get_object_target_submodel();
|
||||
float get_fov();
|
||||
void get_info(vec3d *position, matrix *orientation);
|
||||
|
||||
//Is
|
||||
bool is_empty(){return sig < 0;}
|
||||
vec3d *get_position() {return &position;}
|
||||
matrix *get_orientation() {return &orientation;}
|
||||
|
||||
//Do
|
||||
void do_frame(float in_frametime);
|
||||
};
|
||||
|
||||
class warp_camera
|
||||
{
|
||||
private:
|
||||
float c_time;
|
||||
float c_damping;
|
||||
|
||||
vec3d c_vel;
|
||||
vec3d c_desired_vel;
|
||||
|
||||
vec3d c_pos;
|
||||
matrix c_ori;
|
||||
public:
|
||||
warp_camera();
|
||||
warp_camera(object *objp);
|
||||
void reset();
|
||||
|
||||
void set_position(vec3d *in_pos);
|
||||
void set_rotation(matrix *in_ori);
|
||||
void set_velocity(vec3d *in_vel, bool instantaneous);
|
||||
|
||||
void do_frame(float in_frametime);
|
||||
|
||||
void get_info(vec3d *position, matrix *orientation);
|
||||
};
|
||||
|
||||
extern warp_camera Warp_camera;
|
||||
|
||||
class subtitle
|
||||
{
|
||||
private:
|
||||
@@ -155,22 +84,16 @@ public:
|
||||
|
||||
//Some global stuff
|
||||
extern std::vector<subtitle> Subtitles;
|
||||
extern float VIEWER_ZOOM_DEFAULT;
|
||||
extern float Sexp_fov;
|
||||
extern std::vector<camera> Cameras;
|
||||
//Preset cameras
|
||||
extern camera* Free_camera;
|
||||
extern camera* Current_camera;
|
||||
|
||||
//Helpful functions
|
||||
void cam_init();
|
||||
void cam_close();
|
||||
void cam_do_frame(float frametime);
|
||||
camid cam_create(char *n_name=NULL, vec3d *n_pos=NULL, matrix *n_ori=NULL, object *n_object=NULL, int n_submodel_parent=-1);
|
||||
camid cam_create(char *n_name, vec3d *n_pos, vec3d *n_norm, object *n_object=NULL, int n_submodel_parent=-1);
|
||||
void cam_delete(camid cid);
|
||||
bool cam_set_camera(camid cid);
|
||||
void cam_reset_camera();
|
||||
camid cam_lookup(char *name);
|
||||
camid cam_get_camera(uint index);
|
||||
camid cam_get_current();
|
||||
uint cam_get_num();
|
||||
void cameras_init();
|
||||
void cameras_close();
|
||||
void cameras_do_frame(float frametime);
|
||||
int cameras_lookup(char *name);
|
||||
|
||||
void subtitles_init();
|
||||
void subtitles_close();
|
||||
|
||||
@@ -417,7 +417,7 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
|
||||
{ CF_TYPE_VOICE_TRAINING, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "training", ".wav .ogg", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_MUSIC, "data" DIR_SEPARATOR_STR "music", ".wav .ogg", CF_TYPE_DATA },
|
||||
{ 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 .jpg", 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 .sdr", CF_TYPE_DATA },
|
||||
{ CF_TYPE_HUD, "data" DIR_SEPARATOR_STR "hud", ".ani .pcx .tga .dds", CF_TYPE_DATA },
|
||||
@@ -426,7 +426,7 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
|
||||
{ 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 .tsb", 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 },
|
||||
@@ -627,13 +627,15 @@ int cfile_push_chdir(int type)
|
||||
cf_create_default_path_string( dir, sizeof(dir)-1, type, NULL );
|
||||
|
||||
#ifdef _WIN32
|
||||
char *colon_pos = strchr(dir, ':');
|
||||
_strlwr(dir);
|
||||
|
||||
if (colon_pos) {
|
||||
if (!cfile_chdrive( tolower(*(colon_pos - 1)) - 'a' + 1, 1))
|
||||
char *Drive = strchr(dir, ':');
|
||||
|
||||
if (Drive) {
|
||||
if (!cfile_chdrive( *(Drive - 1) - 'a' + 1, 1))
|
||||
return 1;
|
||||
|
||||
Path = colon_pos+1;
|
||||
Path = Drive+1;
|
||||
} else
|
||||
#endif // _WIN32
|
||||
{
|
||||
@@ -647,9 +649,7 @@ int cfile_push_chdir(int type)
|
||||
// This chdir might get a critical error!
|
||||
e = _chdir( Path );
|
||||
if (e) {
|
||||
#ifdef _WIN32
|
||||
cfile_chdrive( tolower(OriginalDirectory[0]) - 'a' + 1, 1 );
|
||||
#endif // _WIN32
|
||||
cfile_chdrive( OriginalDirectory[0] - 'a' + 1, 1 );
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -667,12 +667,14 @@ int cfile_chdir(char *dir)
|
||||
_getcwd(OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN-1);
|
||||
|
||||
#ifdef _WIN32
|
||||
char *colon_pos = strchr(dir, ':');
|
||||
if (colon_pos) {
|
||||
if (!cfile_chdrive( tolower(*(colon_pos - 1)) - 'a' + 1, 1))
|
||||
_strlwr(dir);
|
||||
|
||||
char *Drive = strchr(dir, ':');
|
||||
if (Drive) {
|
||||
if (!cfile_chdrive( *(Drive - 1) - 'a' + 1, 1))
|
||||
return 1;
|
||||
|
||||
Path = colon_pos+1;
|
||||
Path = Drive+1;
|
||||
} else
|
||||
#endif // _WIN32
|
||||
{
|
||||
@@ -686,9 +688,7 @@ int cfile_chdir(char *dir)
|
||||
// This chdir might get a critical error!
|
||||
e = _chdir( Path );
|
||||
if (e) {
|
||||
#ifdef _WIN32
|
||||
cfile_chdrive( tolower(OriginalDirectory[0]) - 'a' + 1, 1 );
|
||||
#endif // _WIN32
|
||||
cfile_chdrive( OriginalDirectory[0] - 'a' + 1, 1 );
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -1005,7 +1005,7 @@ CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize
|
||||
// If in write mode, just try to open the file straight off
|
||||
// the harddisk. No fancy packfile stuff here!
|
||||
|
||||
if ( strchr(mode,'w') || strchr(mode,'+') || strchr(mode,'a') ) {
|
||||
if ( strchr(mode,'w') ) {
|
||||
// For write-only files, require a full path or a path type
|
||||
#ifdef SCP_UNIX
|
||||
if ( strpbrk(file_path, "/") ) {
|
||||
@@ -1026,41 +1026,8 @@ CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize
|
||||
Assert( !(type & CFILE_MEMORY_MAPPED) );
|
||||
|
||||
// JOHN: TODO, you should create the path if it doesn't exist.
|
||||
|
||||
//WMC - For some godawful reason, fread does not return the correct number of bytes read
|
||||
//in text mode, which messes up FS2_Open's raw_position indicator in fgets. As a consequence, you
|
||||
//_must_ open files that are gonna be read in binary mode.
|
||||
|
||||
char happy_mode[8];
|
||||
if(strcspn(mode, "ra+") != strlen(mode) && (strchr(mode, 't') || !strchr(mode, 'b')))
|
||||
{
|
||||
//*****BEGIN PROCESSING OF MODE*****
|
||||
//Copies all 'mode' characters over, except for t, and adds b if needed.
|
||||
unsigned int max = sizeof(happy_mode) - 2; //space for null and 'b'
|
||||
bool need_b = true;
|
||||
unsigned int i;
|
||||
for( i = 0; i < strlen(mode); i++)
|
||||
{
|
||||
if(i > max)
|
||||
break;
|
||||
|
||||
if(mode[i] != 't')
|
||||
happy_mode[i] = mode[i];
|
||||
|
||||
if(mode[i] == 'b')
|
||||
need_b = false;
|
||||
}
|
||||
happy_mode[i] = '\0';
|
||||
if(need_b)
|
||||
strcat(happy_mode, "b");
|
||||
//*****END PROCESSING OF MODE*****
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(happy_mode, mode);
|
||||
}
|
||||
|
||||
FILE *fp = fopen(longname, happy_mode);
|
||||
|
||||
FILE *fp = fopen(longname, mode);
|
||||
if (fp) {
|
||||
return cf_open_fill_cfblock(fp, dir_type);
|
||||
}
|
||||
@@ -1305,25 +1272,6 @@ int cfclose( CFILE * cfile )
|
||||
return result;
|
||||
}
|
||||
|
||||
int cf_is_valid(CFILE *cfile)
|
||||
{
|
||||
//Was a valid pointer passed?
|
||||
if(cfile == NULL)
|
||||
return 0;
|
||||
|
||||
//Does it have a valid ID?
|
||||
if(cfile->id < 0 || cfile->id >= MAX_CFILE_BLOCKS)
|
||||
return 0;
|
||||
|
||||
//Is it used?
|
||||
Cfile_block *cb = &Cfile_block_list[cfile->id];
|
||||
if(cb->type != CFILE_BLOCK_USED && (cb->fp != NULL || cb->data != NULL))
|
||||
return 0;
|
||||
|
||||
//It's good, as near as we can tell.
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1352,10 +1300,7 @@ CFILE *cf_open_fill_cfblock(FILE *fp, int type)
|
||||
cfbp->fp = fp;
|
||||
cfbp->dir_type = type;
|
||||
|
||||
int pos = ftell(fp);
|
||||
if(pos == -1L)
|
||||
pos = 0;
|
||||
cf_init_lowlevel_read_code(cfp,0,filelength(fileno(fp)), 0 );
|
||||
cf_init_lowlevel_read_code(cfp,0,filelength(fileno(fp)) );
|
||||
|
||||
return cfp;
|
||||
}
|
||||
@@ -1389,7 +1334,7 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
|
||||
cfbp->fp = fp;
|
||||
cfbp->dir_type = type;
|
||||
|
||||
cf_init_lowlevel_read_code(cfp,offset, size, 0 );
|
||||
cf_init_lowlevel_read_code(cfp,offset, size );
|
||||
|
||||
return cfp;
|
||||
}
|
||||
@@ -1431,7 +1376,7 @@ CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
|
||||
#endif
|
||||
cfbp->dir_type = type;
|
||||
|
||||
cf_init_lowlevel_read_code(cfp, 0, 0, 0 );
|
||||
cf_init_lowlevel_read_code(cfp,0 , 0 );
|
||||
#if defined _WIN32
|
||||
cfbp->hMapFile = CreateFileMapping(cfbp->hInFile, NULL, PAGE_READONLY, 0, 0, NULL);
|
||||
if (cfbp->hMapFile == NULL) {
|
||||
@@ -1757,36 +1702,23 @@ int cfilelength( CFILE * cfile )
|
||||
//
|
||||
int cfwrite(void *buf, int elsize, int nelem, CFILE *cfile)
|
||||
{
|
||||
if(!cf_is_valid(cfile))
|
||||
return 0;
|
||||
Assert(cfile != NULL);
|
||||
Assert(buf != NULL);
|
||||
Assert(elsize > 0);
|
||||
Assert(nelem > 0);
|
||||
|
||||
if(buf == NULL || elsize == 0 || nelem == 0)
|
||||
return 0;
|
||||
|
||||
Cfile_block *cb = &Cfile_block_list[cfile->id];
|
||||
|
||||
if(cb->lib_offset != 0)
|
||||
{
|
||||
Error(LOCATION, "Attempt to write to a VP file (unsupported)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(cb->data != NULL)
|
||||
{
|
||||
Warning(LOCATION, "Writing is not supported for mem-mapped files");
|
||||
return EOF;
|
||||
}
|
||||
Cfile_block *cb;
|
||||
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
|
||||
cb = &Cfile_block_list[cfile->id];
|
||||
|
||||
int result = 0;
|
||||
|
||||
result = fwrite(buf, elsize, nelem, cb->fp);
|
||||
// cfwrite() not supported for memory-mapped files
|
||||
Assert( !cb->data );
|
||||
|
||||
//WMC - update filesize and position
|
||||
if(result > 0)
|
||||
{
|
||||
cb->size = filelength(fileno(cb->fp));
|
||||
cb->raw_position += result;
|
||||
}
|
||||
Assert(cb->fp != NULL);
|
||||
Assert(cb->lib_offset == 0 );
|
||||
result = fwrite(buf, elsize, nelem, cb->fp);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1799,74 +1731,19 @@ int cfwrite(void *buf, int elsize, int nelem, CFILE *cfile)
|
||||
//
|
||||
int cfputc(int c, CFILE *cfile)
|
||||
{
|
||||
if(!cf_is_valid(cfile))
|
||||
return EOF;
|
||||
int result;
|
||||
|
||||
Cfile_block *cb = &Cfile_block_list[cfile->id];
|
||||
Assert(cfile != NULL);
|
||||
Cfile_block *cb;
|
||||
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
|
||||
cb = &Cfile_block_list[cfile->id];
|
||||
|
||||
if(cb->lib_offset != 0)
|
||||
{
|
||||
Error(LOCATION, "Attempt to write character to a VP file (unsupported)");
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if(cb->data != NULL)
|
||||
{
|
||||
Warning(LOCATION, "Writing is not supported for mem-mapped files");
|
||||
return EOF;
|
||||
}
|
||||
|
||||
// writing not supported for memory-mapped files
|
||||
result = 0;
|
||||
// cfputc() not supported for memory-mapped files
|
||||
Assert( !cb->data );
|
||||
|
||||
int result = fputc(c, cb->fp);
|
||||
|
||||
//WMC - update filesize and position
|
||||
if(result != EOF)
|
||||
{
|
||||
cb->size = filelength(fileno(cb->fp));
|
||||
cb->raw_position += 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// cfputs() writes a string to a file
|
||||
//
|
||||
// returns: success ==> non-negative value
|
||||
// error ==> EOF
|
||||
//
|
||||
int cfputs(char *str, CFILE *cfile)
|
||||
{
|
||||
if(!cf_is_valid(cfile))
|
||||
return EOF;
|
||||
|
||||
if(str == NULL)
|
||||
return EOF;
|
||||
|
||||
Cfile_block *cb = &Cfile_block_list[cfile->id];
|
||||
|
||||
if(cb->lib_offset != 0)
|
||||
{
|
||||
Error(LOCATION, "Attempt to write character to a VP file (unsupported)");
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if(cb->data != NULL)
|
||||
{
|
||||
Warning(LOCATION, "Writing is not supported for mem-mapped files");
|
||||
return EOF;
|
||||
}
|
||||
|
||||
int result = fputs(str, cb->fp);
|
||||
|
||||
//WMC - update filesize and position
|
||||
if(result != EOF)
|
||||
{
|
||||
cb->size = filelength(fileno(cb->fp));
|
||||
cb->raw_position += strlen(str);
|
||||
}
|
||||
Assert(cb->fp != NULL);
|
||||
result = fputc(c, cb->fp);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1879,6 +1756,8 @@ int cfputs(char *str, CFILE *cfile)
|
||||
//
|
||||
int cfgetc(CFILE *cfile)
|
||||
{
|
||||
Assert(cfile != NULL);
|
||||
|
||||
char tmp;
|
||||
|
||||
int result = cfread(&tmp, 1, 1, cfile );
|
||||
@@ -1916,7 +1795,7 @@ char *cfgets(char *buf, int n, CFILE *cfile)
|
||||
int ret = cfread( &tmp_c, 1, 1, cfile );
|
||||
if ( ret != 1 ) {
|
||||
*buf = 0;
|
||||
if ( buf > t ) {
|
||||
if ( buf > t ) {
|
||||
return t;
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -1932,6 +1811,31 @@ char *cfgets(char *buf, int n, CFILE *cfile)
|
||||
return t;
|
||||
}
|
||||
|
||||
// cfputs() writes a string to a file
|
||||
//
|
||||
// returns: success ==> non-negative value
|
||||
// error ==> EOF
|
||||
//
|
||||
int cfputs(char *str, CFILE *cfile)
|
||||
{
|
||||
Assert(cfile != NULL);
|
||||
Assert(str != NULL);
|
||||
|
||||
Cfile_block *cb;
|
||||
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
|
||||
cb = &Cfile_block_list[cfile->id];
|
||||
|
||||
int result;
|
||||
|
||||
result = 0;
|
||||
// cfputs() not supported for memory-mapped files
|
||||
Assert( !cb->data );
|
||||
Assert(cb->fp != NULL);
|
||||
result = fputs(str, cb->fp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// 16 and 32 bit checksum stuff ----------------------------------------------------------
|
||||
|
||||
@@ -2118,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)
|
||||
{
|
||||
@@ -2234,11 +2139,5 @@ int cflush(CFILE *cfile)
|
||||
Assert( !cb->data );
|
||||
|
||||
Assert(cb->fp != NULL);
|
||||
|
||||
int result = fflush(cb->fp);
|
||||
|
||||
//WMC - update filesize
|
||||
cb->size = filelength(fileno(cb->fp));
|
||||
|
||||
return result;
|
||||
return fflush(cb->fp);
|
||||
}
|
||||
@@ -574,9 +574,6 @@ CFILE *ctmpfile();
|
||||
// Closes the file
|
||||
int cfclose(CFILE *cfile);
|
||||
|
||||
//Checks if the given handle is valid
|
||||
int cf_is_valid(CFILE *cfile);
|
||||
|
||||
// Returns size of file...
|
||||
int cfilelength(CFILE *fp);
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
|
||||
// Called once to setup the low-level reading code.
|
||||
|
||||
void cf_init_lowlevel_read_code( CFILE * cfile, int lib_offset, int size, int pos )
|
||||
void cf_init_lowlevel_read_code( CFILE * cfile, int offset, int size )
|
||||
{
|
||||
Assert(cfile != NULL);
|
||||
|
||||
@@ -127,8 +127,8 @@ void cf_init_lowlevel_read_code( CFILE * cfile, int lib_offset, int size, int po
|
||||
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
|
||||
cb = &Cfile_block_list[cfile->id];
|
||||
|
||||
cb->lib_offset = lib_offset;
|
||||
cb->raw_position = pos;
|
||||
cb->lib_offset = offset;
|
||||
cb->raw_position = 0;
|
||||
cb->size = size;
|
||||
|
||||
if ( cb->fp ) {
|
||||
@@ -268,22 +268,22 @@ int cfseek( CFILE *cfile, int offset, int where )
|
||||
//
|
||||
int cfread(void *buf, int elsize, int nelem, CFILE *cfile)
|
||||
{
|
||||
if(!cf_is_valid(cfile))
|
||||
return 0;
|
||||
Assert(cfile != NULL);
|
||||
Assert(buf != NULL);
|
||||
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
|
||||
|
||||
Cfile_block *cb;
|
||||
cb = &Cfile_block_list[cfile->id];
|
||||
|
||||
// cfread() not supported for memory-mapped files
|
||||
Assert( !cb->data );
|
||||
Assert(cb->fp != NULL);
|
||||
|
||||
int size = elsize*nelem;
|
||||
|
||||
if(buf == NULL || size <= 0)
|
||||
return 0;
|
||||
|
||||
Cfile_block *cb = &Cfile_block_list[cfile->id];
|
||||
|
||||
// cfread() not supported for memory-mapped files
|
||||
if(cb->data != NULL)
|
||||
{
|
||||
Warning(LOCATION, "Writing is not supported for mem-mapped files");
|
||||
return 0;
|
||||
}
|
||||
Assert(nelem > 0);
|
||||
Assert(elsize > 0);
|
||||
Assert(size > 0);
|
||||
|
||||
if ( (cb->raw_position+size) > cb->size ) {
|
||||
size = cb->size - cb->raw_position;
|
||||
@@ -310,22 +310,18 @@ int cfread(void *buf, int elsize, int nelem, CFILE *cfile)
|
||||
|
||||
int cfread_lua_number(double *buf, CFILE *cfile)
|
||||
{
|
||||
if(!cf_is_valid(cfile))
|
||||
return 0;
|
||||
Assert(cfile != NULL);
|
||||
Assert(buf != NULL);
|
||||
Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS);
|
||||
|
||||
if(buf == NULL)
|
||||
return 0;
|
||||
|
||||
Cfile_block *cb = &Cfile_block_list[cfile->id];
|
||||
Cfile_block *cb;
|
||||
cb = &Cfile_block_list[cfile->id];
|
||||
|
||||
// cfread() not supported for memory-mapped files
|
||||
if(cb->data != NULL)
|
||||
{
|
||||
Warning(LOCATION, "Writing is not supported for mem-mapped files");
|
||||
return 0;
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
@@ -90,6 +90,6 @@ extern Cfile_block Cfile_block_list[MAX_CFILE_BLOCKS];
|
||||
extern CFILE Cfile_list[MAX_CFILE_BLOCKS];
|
||||
|
||||
// Called once to setup the low-level reading code.
|
||||
void cf_init_lowlevel_read_code( CFILE * cfile, int lib_offset, int size, int pos );
|
||||
void cf_init_lowlevel_read_code( CFILE * cfile, int offset, int size );
|
||||
|
||||
#endif
|
||||
@@ -1660,14 +1660,9 @@ 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 (strcmp(strstr(filter, "."), strstr(find.name,".")) != 0)
|
||||
continue;
|
||||
|
||||
if ( strlen(find.name) >= MAX_FILENAME_LEN )
|
||||
continue;
|
||||
|
||||
if (!(find.attrib & _A_SUBDIR)) {
|
||||
if ( !Get_file_list_filter || (*Get_file_list_filter)(find.name) ) {
|
||||
ptr = strrchr(find.name, '.');
|
||||
@@ -1704,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;
|
||||
|
||||
@@ -1869,9 +1860,6 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
break;
|
||||
|
||||
if (!(find.attrib & _A_SUBDIR)) {
|
||||
|
||||
if (strcmp(strstr(filter, "."), strstr(find.name,".")) != 0)
|
||||
continue;
|
||||
|
||||
if ( strlen(find.name) >= MAX_FILENAME_LEN )
|
||||
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, "/" );
|
||||
|
||||
@@ -881,7 +881,6 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include "camera/camera.h" //VIEWER_ZOOM_DEFAULT
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
@@ -929,6 +928,9 @@ public:
|
||||
static cmdline_parm Parm_list(NULL, NULL);
|
||||
static int Parm_list_inited = 0;
|
||||
|
||||
|
||||
extern float VIEWER_ZOOM_DEFAULT;
|
||||
extern float Viewer_zoom;
|
||||
extern int Show_framerate; // from freespace.cpp
|
||||
|
||||
|
||||
@@ -989,9 +991,8 @@ Flag exe_params[] =
|
||||
{ "-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",},
|
||||
{ "-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" },
|
||||
{ "-3dshockwave", "Enable 3D shockwaves", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dshockwave" },
|
||||
|
||||
{ "-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", },
|
||||
@@ -1004,7 +1005,6 @@ Flag exe_params[] =
|
||||
{ "-ballistic_gauge", "Enable the analog ballistic ammo gauge", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ballistic_gauge", },
|
||||
|
||||
{ "-ship_choice_3d", "Use models for ship selection", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ship_choice_3d", },
|
||||
{ "-weapon_choice_3d", "Use models for weapon selection", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-weapon_choice_3d", },
|
||||
{ "-3dwarp", "Enable 3d warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dwarp", },
|
||||
{ "-warp_flash", "Enable flash upon warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-warp_flash", },
|
||||
{ "-no_ap_interrupt", "Disable interrupting autopilot", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_ap_interrupt", },
|
||||
@@ -1036,7 +1036,6 @@ Flag exe_params[] =
|
||||
{ "-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", "", },
|
||||
{ "-ati_swap", "Fix Color issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://scp.indiegames.us/mantis/view.php?id=1669", },
|
||||
|
||||
{ "-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", "", },
|
||||
@@ -1133,13 +1132,10 @@ cmdline_parm spec_arg("-spec", NULL); // Cmdline_spec -- use specular highli
|
||||
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
|
||||
cmdline_parm enable_3d_shockwave_arg("-3dshockwave", NULL);
|
||||
cmdline_parm glow_factor_arg("-glow_factor", NULL); // Multiplier factor for glowmaps.
|
||||
|
||||
float Cmdline_clip_dist = Default_min_draw_distance;
|
||||
float Cmdline_fov = 0.75f;
|
||||
float Cmdline_ogl_spec = 80.0f;
|
||||
float Cmdline_glow_factor = 1.0f;
|
||||
int Cmdline_ambient_factor = 128;
|
||||
int Cmdline_cell = 0;
|
||||
int Cmdline_decals = 0;
|
||||
@@ -1153,7 +1149,6 @@ int Cmdline_spec = 0;
|
||||
int Cmdline_no_emissive = 0;
|
||||
int Cmdline_normal = 0;
|
||||
int Cmdline_height = 0;
|
||||
int Cmdline_enable_3d_shockwave = 0;
|
||||
|
||||
// Game Speed related
|
||||
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL); // Cmdline_cache_bitmaps
|
||||
@@ -1182,13 +1177,11 @@ int Cmdline_targetinfo = 0;
|
||||
// Gameplay related
|
||||
cmdline_parm use_3dwarp("-3dwarp", NULL); // Cmdline_3dwarp
|
||||
cmdline_parm ship_choice_3d_arg("-ship_choice_3d", NULL); // Cmdline_ship_choice_3d
|
||||
cmdline_parm weapon_choice_3d_arg("-weapon_choice_3d", NULL); // Cmdline_weapon_choice_3d
|
||||
cmdline_parm use_warp_flash("-warp_flash", NULL); // Cmdline_warp_flash
|
||||
cmdline_parm allow_autpilot_interrupt("-no_ap_interrupt", NULL); // Cmdline_warp_flash
|
||||
|
||||
int Cmdline_3dwarp = 0;
|
||||
int Cmdline_ship_choice_3d = 0;
|
||||
int Cmdline_weapon_choice_3d = 0;
|
||||
int Cmdline_warp_flash = 0;
|
||||
int Cmdline_autopilot_interruptable = 1;
|
||||
|
||||
@@ -1236,7 +1229,6 @@ 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 noglsl_arg("-no_glsl", NULL); // Cmdline_noglsl -- disable GLSL support in OpenGL
|
||||
cmdline_parm atiswap_arg("-ati_swap", NULL); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
|
||||
|
||||
int Cmdline_d3d_lesstmem = 0;
|
||||
int Cmdline_load_all_weapons = 0;
|
||||
@@ -1248,7 +1240,6 @@ int Cmdline_novbo = 0; // turn off OGL VBO support, troubleshooting
|
||||
int Cmdline_safeloading = 0;
|
||||
int Cmdline_no_fbo = 0;
|
||||
int Cmdline_noglsl = 0;
|
||||
int Cmdline_ati_color_swap = 0;
|
||||
|
||||
// Developer/Testing related
|
||||
cmdline_parm start_mission_arg("-start_mission", NULL); // Cmdline_start_mission
|
||||
@@ -1269,12 +1260,13 @@ cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps -- spew
|
||||
#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;
|
||||
@@ -1282,11 +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);
|
||||
@@ -1294,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()
|
||||
@@ -1563,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);
|
||||
|
||||
@@ -1660,6 +1652,48 @@ int cmdline_parm::found()
|
||||
return name_found;
|
||||
}
|
||||
|
||||
void output_sexp_html(int sexp_idx, FILE *fp)
|
||||
{
|
||||
if(sexp_idx < 0 || sexp_idx > Num_operators)
|
||||
return;
|
||||
|
||||
bool printed=false;
|
||||
|
||||
for(int i = 0; i < Num_sexp_help; i++)
|
||||
{
|
||||
if(Sexp_help[i].id == Operators[sexp_idx].value)
|
||||
{
|
||||
char* new_buf = new char[2*strlen(Sexp_help[i].help)];
|
||||
char* dest_ptr = new_buf;
|
||||
char* curr_ptr = Sexp_help[i].help;
|
||||
char* end_ptr = curr_ptr + strlen(Sexp_help[i].help);
|
||||
while(curr_ptr < end_ptr)
|
||||
{
|
||||
if(*curr_ptr == '\n')
|
||||
{
|
||||
strcpy(dest_ptr, "\n<br>");
|
||||
dest_ptr+=5;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dest_ptr++ = *curr_ptr;
|
||||
}
|
||||
curr_ptr++;
|
||||
}
|
||||
*dest_ptr = '\0';
|
||||
|
||||
fprintf(fp, "<dt><b>%s</b></dt>\n<dd>%s</dd>\n", Operators[sexp_idx].text, new_buf);
|
||||
delete[] new_buf;
|
||||
|
||||
printed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!printed)
|
||||
fprintf(fp, "<dt><b>%s</b></dt>\n<dd>Min arguments: %d, Max arguments: %d</dd>\n", Operators[sexp_idx].text, Operators[sexp_idx].min, Operators[sexp_idx].max);
|
||||
}
|
||||
|
||||
|
||||
// returns - the interger representation for the parameter arguement
|
||||
int cmdline_parm::get_int()
|
||||
{
|
||||
@@ -1715,29 +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(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())
|
||||
{
|
||||
@@ -1767,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() ) {
|
||||
@@ -1954,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;
|
||||
}
|
||||
|
||||
@@ -1972,19 +2001,19 @@ 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;
|
||||
}
|
||||
|
||||
if ( fov_arg.found() ) {
|
||||
VIEWER_ZOOM_DEFAULT = Cmdline_fov = fov_arg.get_float();
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -1993,15 +2022,11 @@ bool SetCmdlineParams()
|
||||
Cmdline_orb_radar = 1;
|
||||
}
|
||||
|
||||
// TBP warp effects -Et1
|
||||
// Chief1983 - Add 3d shockwave, ship choice 3d and weapon choice 3d if TBP is checked
|
||||
if( tbp.found() )
|
||||
{
|
||||
Cmdline_tbp = 1;
|
||||
Cmdline_enable_3d_shockwave = 1;
|
||||
Cmdline_ship_choice_3d = 1;
|
||||
Cmdline_weapon_choice_3d = 1;
|
||||
}
|
||||
// TBP warp effects -Et1
|
||||
if( tbp.found() )
|
||||
{
|
||||
Cmdline_tbp = 1;
|
||||
}
|
||||
|
||||
if ( use_3dwarp.found() ) {
|
||||
Cmdline_3dwarp = 1;
|
||||
@@ -2036,32 +2061,47 @@ bool SetCmdlineParams()
|
||||
}
|
||||
|
||||
if ( spec_arg.found() )
|
||||
{
|
||||
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() ) {
|
||||
Cmdline_img2dds = 1;
|
||||
}
|
||||
|
||||
if ( glow_arg.found() ) {
|
||||
Cmdline_glow = 1;
|
||||
}
|
||||
|
||||
if ( query_speech_arg.found() ) {
|
||||
Cmdline_query_speech = 1;
|
||||
}
|
||||
|
||||
if ( ship_choice_3d_arg.found() ) {
|
||||
Cmdline_ship_choice_3d = 1;
|
||||
}
|
||||
|
||||
if ( show_mem_usage_arg.found() ) {
|
||||
Cmdline_show_mem_usage = 1;
|
||||
}
|
||||
|
||||
if (ingamejoin_arg.found() ) {
|
||||
Cmdline_ingamejoin = 1;
|
||||
}
|
||||
|
||||
if ( normal_arg.found() ) {
|
||||
Cmdline_normal = 1;
|
||||
|
||||
@@ -2075,27 +2115,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_noglsl = 1;
|
||||
}
|
||||
|
||||
if ( img2dds_arg.found() )
|
||||
Cmdline_img2dds = 1;
|
||||
|
||||
if ( glow_arg.found() )
|
||||
Cmdline_glow = 1;
|
||||
|
||||
if ( query_speech_arg.found() )
|
||||
Cmdline_query_speech = 1;
|
||||
|
||||
if ( ship_choice_3d_arg.found() )
|
||||
Cmdline_ship_choice_3d = 1;
|
||||
|
||||
if ( weapon_choice_3d_arg.found() )
|
||||
Cmdline_weapon_choice_3d = 1;
|
||||
|
||||
if ( show_mem_usage_arg.found() )
|
||||
Cmdline_show_mem_usage = 1;
|
||||
|
||||
if (ingamejoin_arg.found() )
|
||||
Cmdline_ingamejoin = 1;
|
||||
|
||||
if ( start_mission_arg.found() ) {
|
||||
Cmdline_start_mission = start_mission_arg.str();
|
||||
}
|
||||
@@ -2153,27 +2172,105 @@ bool SetCmdlineParams()
|
||||
Output_scripting_meta = true;
|
||||
|
||||
if (output_sexp_arg.found() ) {
|
||||
output_sexps("sexps.html");
|
||||
extern int Num_op_menus;
|
||||
extern int Num_submenus;
|
||||
|
||||
FILE *fp = fopen("sexps.html","w");
|
||||
|
||||
if(fp == NULL)
|
||||
{
|
||||
MessageBox(NULL,"Error creating SEXP operator list", "Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Header
|
||||
fprintf(fp, "<html>\n<head>\n\t<title>SEXP Output: %d.%d.%d</title>\n</head>\n", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD);
|
||||
fputs("<body>", fp);
|
||||
fprintf(fp,"\t<h1>Sexp Output - Build %d.%d.%d</h1>\n", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD);
|
||||
|
||||
std::vector<int> done_sexp_ids;
|
||||
int x,y,z;
|
||||
|
||||
//Output an overview
|
||||
fputs("<dl>", fp);
|
||||
for(x = 0; x < Num_op_menus; x++)
|
||||
{
|
||||
fprintf(fp, "<dt><a href=\"#%d\">%s</a></dt>", (op_menu[x].id & OP_CATEGORY_MASK), op_menu[x].name);
|
||||
for(y = 0; y < Num_submenus; y++)
|
||||
{
|
||||
if(((op_submenu[y].id & OP_CATEGORY_MASK) == op_menu[x].id))
|
||||
{
|
||||
fprintf(fp, "<dd><a href=\"#%d\">%s</a></dd>", op_submenu[y].id & (OP_CATEGORY_MASK | SUBCATEGORY_MASK), op_submenu[y].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
fputs("</dl>", fp);
|
||||
|
||||
//Output the full descriptions
|
||||
fputs("<dl>", fp);
|
||||
for(x = 0; x < Num_op_menus; x++)
|
||||
{
|
||||
fprintf(fp, "<dt id=\"%d\"><h2>%s</h2></dt>\n", (op_menu[x].id & OP_CATEGORY_MASK), op_menu[x].name);
|
||||
fputs("<dd>", fp);
|
||||
fputs("<dl>", fp);
|
||||
for(y = 0; y < Num_submenus; y++)
|
||||
{
|
||||
if(((op_submenu[y].id & OP_CATEGORY_MASK) == op_menu[x].id))
|
||||
{
|
||||
fprintf(fp, "<dt id=\"%d\"><h3>%s</h3></dt>\n", op_submenu[y].id & (OP_CATEGORY_MASK | SUBCATEGORY_MASK), op_submenu[y].name);
|
||||
fputs("<dd>", fp);
|
||||
fputs("<dl>", fp);
|
||||
for(z = 0; z < Num_operators; z++)
|
||||
{
|
||||
if(((Operators[z].value & OP_CATEGORY_MASK) == op_menu[x].id)
|
||||
&& (get_subcategory(Operators[z].value) != -1)
|
||||
&& (get_subcategory(Operators[z].value) == op_submenu[y].id))
|
||||
{
|
||||
output_sexp_html(z, fp);
|
||||
}
|
||||
}
|
||||
fputs("</dl>", fp);
|
||||
fputs("</dd>", fp);
|
||||
}
|
||||
}
|
||||
for(z = 0; z < Num_operators; z++)
|
||||
{
|
||||
if(((Operators[z].value & OP_CATEGORY_MASK) == op_menu[x].id)
|
||||
&& (get_subcategory(Operators[z].value) == -1))
|
||||
{
|
||||
output_sexp_html(z, fp);
|
||||
}
|
||||
}
|
||||
fputs("</dl>", fp);
|
||||
fputs("</dd>", fp);
|
||||
}
|
||||
for(z = 0; z < Num_operators; z++)
|
||||
{
|
||||
if(!(Operators[z].value & OP_CATEGORY_MASK))
|
||||
{
|
||||
output_sexp_html(z, fp);
|
||||
}
|
||||
}
|
||||
fputs("</dl>", fp);
|
||||
fputs("</body>\n</html>\n", fp);
|
||||
|
||||
fclose(fp);
|
||||
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 ( 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
|
||||
@@ -2195,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();
|
||||
@@ -2220,16 +2314,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_ogl_spec = 128.0f;
|
||||
}
|
||||
|
||||
if ( glow_factor_arg.found() )
|
||||
{
|
||||
Cmdline_glow_factor = glow_factor_arg.get_float();
|
||||
|
||||
if (Cmdline_glow_factor < 0.0f)
|
||||
{
|
||||
Cmdline_glow_factor = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if ( rearm_timer_arg.found() )
|
||||
Cmdline_rearm_timer = 1;
|
||||
|
||||
@@ -2245,16 +2329,6 @@ bool SetCmdlineParams()
|
||||
if ( verify_vps_arg.found() )
|
||||
Cmdline_verify_vps = 1;
|
||||
|
||||
if ( atiswap_arg.found() )
|
||||
{
|
||||
Cmdline_ati_color_swap = 1;
|
||||
}
|
||||
|
||||
if ( enable_3d_shockwave_arg.found() )
|
||||
{
|
||||
Cmdline_enable_3d_shockwave = 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -647,7 +647,6 @@ extern double specular_exponent_value;
|
||||
extern float Cmdline_clip_dist;
|
||||
extern float Cmdline_fov;
|
||||
extern float Cmdline_ogl_spec;
|
||||
extern float Cmdline_glow_factor;
|
||||
extern float static_light_factor;
|
||||
extern float static_point_factor;
|
||||
extern float static_tube_factor;
|
||||
@@ -662,8 +661,8 @@ extern int Cmdline_nomotiondebris;
|
||||
extern int Cmdline_noscalevid; // disables fit-to-window for movies - taylor
|
||||
extern int Cmdline_spec;
|
||||
extern int Cmdline_normal;
|
||||
extern int Cmdline_glsl;
|
||||
extern int Cmdline_height;
|
||||
extern int Cmdline_enable_3d_shockwave;
|
||||
|
||||
// Game Speed related
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
@@ -681,7 +680,6 @@ extern int Cmdline_targetinfo;
|
||||
// Gameplay related
|
||||
extern int Cmdline_3dwarp;
|
||||
extern int Cmdline_ship_choice_3d;
|
||||
extern int Cmdline_weapon_choice_3d;
|
||||
extern int Cmdline_warp_flash;
|
||||
extern int Cmdline_autopilot_interruptable;
|
||||
|
||||
@@ -714,7 +712,6 @@ extern int Cmdline_novbo;
|
||||
extern int Cmdline_safeloading;
|
||||
extern int Cmdline_no_fbo;
|
||||
extern int Cmdline_noglsl;
|
||||
extern int Cmdline_ati_color_swap;
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
|
||||
@@ -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
|
||||
@@ -887,10 +887,8 @@ char *textify_scancode(int code)
|
||||
if (code < 0)
|
||||
return "None";
|
||||
|
||||
int keycode = code & KEY_MASK;
|
||||
|
||||
*text = 0;
|
||||
if (code & KEY_ALTED && !(keycode == KEY_LALT || keycode == KEY_RALT)) {
|
||||
if (code & KEY_ALTED) {
|
||||
if(Lcl_gr){
|
||||
strcat(text, "Alt-");
|
||||
} else if(Lcl_fr){
|
||||
@@ -900,7 +898,7 @@ char *textify_scancode(int code)
|
||||
}
|
||||
}
|
||||
|
||||
if (code & KEY_SHIFTED && !(keycode == KEY_LSHIFT || keycode == KEY_RSHIFT)) {
|
||||
if (code & KEY_SHIFTED) {
|
||||
if(Lcl_gr){
|
||||
strcat(text, "Shift-");
|
||||
} else if(Lcl_fr){
|
||||
@@ -910,7 +908,7 @@ char *textify_scancode(int code)
|
||||
}
|
||||
}
|
||||
|
||||
strcat(text, Scan_code_text[keycode]);
|
||||
strcat(text, Scan_code_text[code & KEY_MASK]);
|
||||
return text;
|
||||
}
|
||||
//XSTR:ON
|
||||
|
||||
@@ -267,23 +267,15 @@ char *Cutscene_mask_name[GR_NUM_RESOLUTIONS] = {
|
||||
"2_ViewFootage-m"
|
||||
};
|
||||
|
||||
using std::vector;
|
||||
|
||||
size_t Num_cutscenes;
|
||||
int Num_cutscenes;
|
||||
int Cutscenes_viewable;
|
||||
int Description_index;
|
||||
vector<cutscene_info> Cutscenes;
|
||||
cutscene_info Cutscenes[MAX_CUTSCENES];
|
||||
|
||||
//extern int All_movies_enabled; // If set, all movies may be viewed. Keyed off cheat code.
|
||||
void cutscene_close()
|
||||
{
|
||||
for(size_t i = 0; i < Num_cutscenes; i++)
|
||||
{
|
||||
if(Cutscenes[i].description)
|
||||
{
|
||||
vm_free(Cutscenes[i].description);
|
||||
}
|
||||
}
|
||||
void cutscene_close(){
|
||||
for(int i = 0; i<MAX_CUTSCENES; i++)
|
||||
if(Cutscenes[i].description)vm_free(Cutscenes[i].description);
|
||||
}
|
||||
|
||||
// initialization stuff for cutscenes
|
||||
@@ -292,7 +284,6 @@ void cutscene_init()
|
||||
atexit(cutscene_close);
|
||||
char buf[MULTITEXT_LENGTH];
|
||||
int rval;
|
||||
cutscene_info cutinfo;
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
@@ -303,35 +294,28 @@ void cutscene_init()
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text("cutscenes.tbl", CF_TYPE_TABLES);
|
||||
read_file_text("cutscenes.tbl");
|
||||
reset_parse();
|
||||
|
||||
// parse in all the cutscenes
|
||||
Num_cutscenes = 0;
|
||||
skip_to_string("#Cutscenes");
|
||||
ignore_white_space();
|
||||
|
||||
while ( required_string_either("#End", "$Filename:") )
|
||||
{
|
||||
memset(&cutinfo, 0, sizeof(cutscene_info));
|
||||
|
||||
while ( required_string_either("#End", "$Filename:") ) {
|
||||
Assert ( Num_cutscenes < MAX_CUTSCENES );
|
||||
required_string("$Filename:");
|
||||
stuff_string( cutinfo.filename, F_PATHNAME, MAX_FILENAME_LEN );
|
||||
|
||||
stuff_string( Cutscenes[Num_cutscenes].filename, F_PATHNAME, MAX_FILENAME_LEN );
|
||||
required_string("$Name:");
|
||||
stuff_string( cutinfo.name, F_NAME, NAME_LENGTH );
|
||||
|
||||
stuff_string( Cutscenes[Num_cutscenes].name, F_NAME, NAME_LENGTH );
|
||||
required_string("$Description:");
|
||||
stuff_string(buf, F_MULTITEXT, sizeof(buf));
|
||||
drop_white_space(buf);
|
||||
compact_multitext_string(buf);
|
||||
cutinfo.description = vm_strdup(buf);
|
||||
|
||||
Cutscenes[Num_cutscenes].description = vm_strdup(buf);
|
||||
required_string("$cd:");
|
||||
stuff_int( &cutinfo.cd );
|
||||
stuff_int( &Cutscenes[Num_cutscenes].cd );
|
||||
|
||||
Cutscenes.push_back(cutinfo);
|
||||
Num_cutscenes++;
|
||||
Num_cutscenes++;
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
@@ -349,7 +333,7 @@ int cutscenes_get_cd_num( char *filename )
|
||||
#if defined(OEM_BUILD)
|
||||
return 0; // only 1 cd for OEM
|
||||
#else
|
||||
size_t i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Num_cutscenes; i++ ) {
|
||||
if ( !stricmp(Cutscenes[i].filename, filename) ) {
|
||||
@@ -364,7 +348,7 @@ int cutscenes_get_cd_num( char *filename )
|
||||
// marks a cutscene as viewable
|
||||
void cutscene_mark_viewable(char *filename)
|
||||
{
|
||||
size_t i;
|
||||
int i;
|
||||
char cut_file[MAX_FILENAME_LEN];
|
||||
char file[MAX_FILENAME_LEN];
|
||||
|
||||
@@ -406,7 +390,7 @@ void cutscene_mark_viewable(char *filename)
|
||||
#define EXIT_BUTTON 7
|
||||
|
||||
static int Num_files;
|
||||
static vector<int> Cutscene_list;
|
||||
static int Cutscene_list[MAX_CUTSCENES];
|
||||
//static int Stats_scroll_offset; // not used - taylor
|
||||
static int Selected_line = 0; // line that is currently selected for binding
|
||||
static int Scroll_offset;
|
||||
@@ -576,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();
|
||||
|
||||
@@ -702,7 +685,6 @@ int cutscenes_screen_button_pressed(int n)
|
||||
void cutscenes_screen_init()
|
||||
{
|
||||
int i;
|
||||
size_t j;
|
||||
ui_button_info *b;
|
||||
|
||||
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
|
||||
@@ -747,10 +729,9 @@ void cutscenes_screen_init()
|
||||
// Cutscenes_viewable = 0xffffffff; // Cheat code enables all movies.
|
||||
|
||||
Num_files = 0;
|
||||
Cutscene_list.clear();
|
||||
for ( j = 0; j < Num_cutscenes; j++ ) {
|
||||
if ( Cutscenes_viewable & (1<<j) ) {
|
||||
Cutscene_list.push_back((int)j);
|
||||
for ( i = 0; i < Num_cutscenes; i++ ) {
|
||||
if ( Cutscenes_viewable & (1<<i) ) {
|
||||
Cutscene_list[Num_files] = i;
|
||||
Num_files++;
|
||||
}
|
||||
}
|
||||
@@ -767,7 +748,6 @@ void cutscenes_screen_close()
|
||||
void cutscenes_screen_do_frame()
|
||||
{
|
||||
int i, k, y, z;
|
||||
size_t t;
|
||||
int font_height = gr_get_font_height();
|
||||
int select_tease_line = -1;
|
||||
|
||||
@@ -811,9 +791,8 @@ void cutscenes_screen_do_frame()
|
||||
case KEY_CTRLED | KEY_SHIFTED | KEY_S:
|
||||
{
|
||||
Num_files = 0;
|
||||
Cutscene_list.clear();
|
||||
for (t = 0; t < Num_cutscenes; t++) {
|
||||
Cutscene_list.push_back((int)t);
|
||||
for (i = 0; i < Num_cutscenes; i++) {
|
||||
Cutscene_list[Num_files] = i;
|
||||
Num_files++;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,8 @@
|
||||
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include <vector>
|
||||
|
||||
#define MAX_CUTSCENES 10
|
||||
|
||||
// this cutscene is always available.
|
||||
#define INTRO_CUTSCENE_FLAG (1<<0)
|
||||
@@ -78,8 +79,8 @@ typedef struct cutscene_info
|
||||
int cd;
|
||||
} cutscene_info;
|
||||
|
||||
extern std::vector<cutscene_info> Cutscenes;
|
||||
extern size_t Num_cutscenes;
|
||||
extern cutscene_info Cutscenes[MAX_CUTSCENES];
|
||||
extern int Num_cutscenes;
|
||||
extern int Cutscenes_viewable;
|
||||
|
||||
// initializa table data
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -530,8 +530,13 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
gl_screenYH = g_screenY + g_height;
|
||||
gl_screenXW = g_screenX + g_width;
|
||||
|
||||
gl_screenU = i2fl(g_width) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_height) / i2fl(hp2);
|
||||
if (GL_state.Texture.GetTarget() == GL_TEXTURE_RECTANGLE_ARB) {
|
||||
gl_screenU = (GLfloat)g_width;
|
||||
gl_screenV = (GLfloat)g_height;
|
||||
} else {
|
||||
gl_screenU = i2fl(g_width) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_height) / i2fl(hp2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,7 +692,10 @@ int mve_video_init(ubyte *data)
|
||||
memset(pixelbuf, 0, g_screenWidth * g_screenHeight * 2);
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
opengl_set_texture_target(GL_TEXTURE_2D);
|
||||
// set the appropriate texture target
|
||||
if ( Is_Extension_Enabled(OGL_ARB_TEXTURE_RECTANGLE) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_NON_POWER_OF_TWO) )
|
||||
opengl_set_texture_target( GL_TEXTURE_RECTANGLE_ARB );
|
||||
|
||||
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
|
||||
|
||||
glGenTextures(1, &GLtex);
|
||||
|
||||
@@ -363,7 +363,10 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
opengl_set_texture_target(GL_TEXTURE_2D);
|
||||
// set the appropriate texture target
|
||||
if ( Is_Extension_Enabled(OGL_ARB_TEXTURE_RECTANGLE) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_NON_POWER_OF_TWO) )
|
||||
opengl_set_texture_target( GL_TEXTURE_RECTANGLE_ARB );
|
||||
|
||||
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
|
||||
|
||||
glGenTextures(1, &GLtex);
|
||||
@@ -439,8 +442,13 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
gl_screenYH = g_screenY + g_screenHeight;
|
||||
gl_screenXW = g_screenX + g_screenWidth;
|
||||
|
||||
gl_screenU = i2fl(g_screenWidth) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_screenHeight) / i2fl(hp2);
|
||||
if (GL_state.Texture.GetTarget() == GL_TEXTURE_RECTANGLE_ARB) {
|
||||
gl_screenU = (GLfloat)wp2;
|
||||
gl_screenV = (GLfloat)hp2;
|
||||
} else {
|
||||
gl_screenU = i2fl(g_screenWidth) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_screenHeight) / i2fl(hp2);
|
||||
}
|
||||
}
|
||||
|
||||
video_inited = 1;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -346,7 +346,6 @@
|
||||
#include "io/timer.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "ship/ship.h"
|
||||
#include "ship/shipfx.h"
|
||||
#include "radar/radarsetup.h"
|
||||
#include "network/multi.h"
|
||||
#include "network/multimsgs.h"
|
||||
@@ -395,11 +394,8 @@ static void debris_start_death_roll(object *debris_obj, debris *debris_p)
|
||||
if( MULTIPLAYER_MASTER )
|
||||
send_debris_update_packet(debris_obj,DEBRIS_UPDATE_NUKE);
|
||||
|
||||
int fireball_type = fireball_ship_explosion_type(&Ship_info[debris_p->ship_info_index]);
|
||||
if(fireball_type < 0) {
|
||||
fireball_type = FIREBALL_EXPLOSION_LARGE1 + rand()%FIREBALL_NUM_LARGE_EXPLOSIONS;
|
||||
}
|
||||
fireball_create( &debris_obj->pos, fireball_type, FIREBALL_LARGE_EXPLOSION, OBJ_INDEX(debris_obj), debris_obj->radius*1.75f);
|
||||
int fireball_type = FIREBALL_EXPLOSION_LARGE1 + rand()%FIREBALL_NUM_LARGE_EXPLOSIONS;
|
||||
fireball_create( &debris_obj->pos, fireball_type, OBJ_INDEX(debris_obj), debris_obj->radius*1.75f);
|
||||
|
||||
// only play debris destroy sound if hull piece and it has been around for at least 2 seconds
|
||||
if ( Missiontime > debris_p->time_started + 2*F1_0 ) {
|
||||
@@ -444,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) {
|
||||
@@ -454,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)
|
||||
@@ -480,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;
|
||||
|
||||
@@ -494,18 +492,14 @@ void debris_render(object * obj)
|
||||
|
||||
Assert(db->flags & DEBRIS_USED);
|
||||
|
||||
texture_info *tbase = NULL;
|
||||
|
||||
// Swap in a different texture depending on the species
|
||||
if (db->species >= 0)
|
||||
{
|
||||
if (db->species >= 0) {
|
||||
pm = model_get( db->model_num );
|
||||
|
||||
//WMC - Someday, we should have glowing debris.
|
||||
if ( pm != NULL && (pm->n_textures == 1) ) {
|
||||
tbase = &pm->maps[0].textures[TM_BASE_TYPE];
|
||||
swapped = tbase->GetTexture();
|
||||
tbase->SetTexture(Species_info[db->species].debris_texture.bitmap_id);
|
||||
if ( pm && (pm->n_textures == 1) ) {
|
||||
memcpy(&swapped_tex, &pm->maps[0], sizeof(texture_map));
|
||||
memcpy(&pm->maps[0], &Species_info[db->species].debris_texture, sizeof(texture_map));
|
||||
swapped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,8 +522,8 @@ void debris_render(object * obj)
|
||||
submodel_render( db->model_num, db->submodel_num, &obj->orient, &obj->pos, MR_NO_LIGHTING );
|
||||
}
|
||||
|
||||
if (tbase != NULL && (swapped!=-1) && pm) {
|
||||
tbase->SetTexture(swapped);
|
||||
if (swapped) {
|
||||
memcpy(&pm->maps[0], &swapped_tex, sizeof(texture_map));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,7 +572,7 @@ void maybe_delete_debris(debris *db)
|
||||
{
|
||||
object *objp;
|
||||
|
||||
if (timestamp_elapsed(db->next_distance_check) && timestamp_elapsed(db->must_survive_until)) {
|
||||
if (timestamp_elapsed(db->next_distance_check)) {
|
||||
if (!(Game_mode & GM_MULTIPLAYER)) { // In single player game, just check against player.
|
||||
if (vm_vec_dist_quick(&Player_obj->pos, &Objects[db->objnum].pos) > MAX_DEBRIS_DIST)
|
||||
db->lifeleft = 0.1f;
|
||||
@@ -795,15 +789,12 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
debris *db;
|
||||
polymodel *pm;
|
||||
int vaporize;
|
||||
physics_info *pi = NULL;
|
||||
ship_info *sip = NULL;
|
||||
|
||||
parent_objnum = OBJ_INDEX(source_obj);
|
||||
|
||||
Assert( (source_obj->type == OBJ_SHIP ) || (source_obj->type == OBJ_GHOST));
|
||||
Assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS );
|
||||
shipp = &Ships[source_obj->instance];
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
vaporize = (shipp->flags &SF_VAPORIZE);
|
||||
|
||||
if ( !hull_flag ) {
|
||||
@@ -843,45 +834,14 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
|
||||
db = &Debris[n];
|
||||
|
||||
//WMC - We must survive until now, at least.
|
||||
db->must_survive_until = timestamp();
|
||||
|
||||
if(hull_flag && sip->debris_min_lifetime >= 0.0f && sip->debris_max_lifetime >= 0.0f)
|
||||
{
|
||||
db->lifeleft = (( sip->debris_max_lifetime - sip->debris_min_lifetime ) * frand()) + sip->debris_min_lifetime;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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;
|
||||
else
|
||||
db->lifeleft = -1.0f; // large hull pieces stay around forever
|
||||
} else {
|
||||
db->lifeleft = (i2fl(myrand())/i2fl(RAND_MAX))*2.0f+0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
//WMC - Oh noes, we may need to change lifeleft
|
||||
if(hull_flag)
|
||||
{
|
||||
if(sip->debris_min_lifetime >= 0.0f && sip->debris_max_lifetime >= 0.0f)
|
||||
{
|
||||
db->must_survive_until = timestamp(fl2i(sip->debris_min_lifetime * 1000.0f));
|
||||
db->lifeleft = (( sip->debris_max_lifetime - sip->debris_min_lifetime ) * frand()) + sip->debris_min_lifetime;
|
||||
}
|
||||
else if(sip->debris_min_lifetime >= 0.0f)
|
||||
{
|
||||
db->must_survive_until = timestamp(fl2i(sip->debris_min_lifetime * 1000.0f));
|
||||
if(db->lifeleft < sip->debris_min_lifetime)
|
||||
db->lifeleft = sip->debris_min_lifetime;
|
||||
}
|
||||
else if(sip->debris_max_lifetime >= 0.0f)
|
||||
{
|
||||
if(db->lifeleft > sip->debris_max_lifetime)
|
||||
db->lifeleft = sip->debris_max_lifetime;
|
||||
}
|
||||
// Create Debris piece n!
|
||||
if ( hull_flag ) {
|
||||
if (rand() < RAND_MAX/6) // Make some pieces blow up shortly after explosion.
|
||||
db->lifeleft = 2.0f * (myrand() * RAND_MAX_1f) + 0.5f;
|
||||
else
|
||||
db->lifeleft = -1.0f; // large hull pieces stay around forever
|
||||
} else {
|
||||
db->lifeleft = (myrand() * RAND_MAX_1f)*2.0f+0.1f;
|
||||
}
|
||||
|
||||
// increase lifetime for vaporized debris
|
||||
@@ -898,7 +858,6 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
db->time_started = Missiontime;
|
||||
db->species = Ship_info[shipp->ship_info_index].species;
|
||||
db->next_distance_check = (myrand() % 2000) + 4*DEBRIS_DISTANCE_CHECK_TIME;
|
||||
db->parent_alt_name = shipp->alt_type_index;
|
||||
|
||||
for (i=0; i<MAX_DEBRIS_ARCS; i++ ) {
|
||||
db->arc_timestamp[i] = timestamp(-1);
|
||||
@@ -946,7 +905,6 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
db->objnum = objnum;
|
||||
|
||||
obj = &Objects[objnum];
|
||||
pi = &obj->phys_info;
|
||||
|
||||
// assign the network signature. The signature will be 0 for non-hull pieces, but since that
|
||||
// is our invalid signature, it should be okay.
|
||||
@@ -1028,6 +986,44 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
vm_vec_add (&obj->phys_info.vel, &radial_vel, &source_obj->phys_info.vel);
|
||||
vm_vec_add2(&obj->phys_info.vel, &vel_from_rotvel);
|
||||
|
||||
#ifdef DEBRIS_SPEED_DEBUG
|
||||
// check that debris is not created with too high a velocity
|
||||
if (hull_flag)
|
||||
{
|
||||
int ship_type = Ship_info[Ships[source_obj->instance].ship_info_index].class_type;
|
||||
if(ship_type > -1)
|
||||
{
|
||||
if(vm_vec_mag_squared(&obj->phys_info.vel) > Ship_types[ship_type].debris_max_speed) {
|
||||
float scale = Ship_types[ship_type].debris_max_speed / vm_vec_mag(&obj->phys_info.vel);
|
||||
vm_vec_scale(&obj->phys_info.vel, scale);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (ship_info_flag & (SIF_SMALL_SHIP | SIF_NOT_FLYABLE | SIF_HARMLESS))
|
||||
{
|
||||
if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_SMALL_DEBRIS*MAX_SPEED_SMALL_DEBRIS) {
|
||||
float scale = MAX_SPEED_SMALL_DEBRIS / vm_vec_mag(&obj->phys_info.vel);
|
||||
vm_vec_scale(&obj->phys_info.vel, scale);
|
||||
}
|
||||
} else if (ship_info_flag & SIF_BIG_SHIP) {
|
||||
if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_BIG_DEBRIS*MAX_SPEED_BIG_DEBRIS) {
|
||||
float scale = MAX_SPEED_BIG_DEBRIS / vm_vec_mag(&obj->phys_info.vel);
|
||||
vm_vec_scale(&obj->phys_info.vel, scale);
|
||||
}
|
||||
} else if (ship_info_flag & SIF_HUGE_SHIP) {
|
||||
if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_CAPITAL_DEBRIS*MAX_SPEED_CAPITAL_DEBRIS) {
|
||||
float scale = MAX_SPEED_CAPITAL_DEBRIS / vm_vec_mag(&obj->phys_info.vel);
|
||||
vm_vec_scale(&obj->phys_info.vel, scale);
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning(LOCATION, "Ship does not have a type!");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// vm_vec_scale_add(&obj->phys_info.vel, &radial_vel, &source_obj->phys_info.vel, frand()/2.0f + 0.5f);
|
||||
// nprintf(("Andsager","object vel from rotvel: %0.2f, %0.2f, %0.2f\n",vel_from_rotvel.x, vel_from_rotvel.y, vel_from_rotvel.z));
|
||||
|
||||
@@ -1041,31 +1037,26 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
|
||||
vm_vec_rand_vec_quick(&rotvel);
|
||||
vm_vec_scale(&rotvel, scale);
|
||||
|
||||
pi->flags |= PF_DEAD_DAMP;
|
||||
pi->rotvel = rotvel;
|
||||
obj->phys_info.flags |= PF_DEAD_DAMP;
|
||||
obj->phys_info.rotvel = rotvel;
|
||||
check_rotvel_limit( &obj->phys_info );
|
||||
|
||||
// check that debris is not created with too high a velocity
|
||||
if (hull_flag)
|
||||
{
|
||||
shipfx_debris_limit_speed(db, shipp);
|
||||
}
|
||||
|
||||
// blow out his reverse thrusters. Or drag, same thing.
|
||||
pi->rotdamp = 10000.0f;
|
||||
pi->side_slip_time_const = 10000.0f;
|
||||
pi->flags |= (PF_REDUCED_DAMP | PF_DEAD_DAMP); // set damping equal for all axis and not changable
|
||||
obj->phys_info.rotdamp = 10000.0f;
|
||||
obj->phys_info.side_slip_time_const = 10000.0f;
|
||||
obj->phys_info.flags |= (PF_REDUCED_DAMP | PF_DEAD_DAMP); // set damping equal for all axis and not changable
|
||||
|
||||
vm_vec_zero(&pi->max_vel); // make so he can't turn on his own VOLITION anymore.
|
||||
vm_vec_zero(&pi->max_rotvel); // make so he can't change speed on his own VOLITION anymore.
|
||||
vm_vec_zero(&obj->phys_info.max_vel); // make so he can't turn on his own VOLITION anymore.
|
||||
vm_vec_zero(&obj->phys_info.max_rotvel); // make so he can't change speed on his own VOLITION anymore.
|
||||
|
||||
|
||||
// ensure vel is valid
|
||||
Assert( !vm_is_vec_nan(&obj->phys_info.vel) );
|
||||
|
||||
// if ( hull_flag ) {
|
||||
// vm_vec_zero(&pi->vel);
|
||||
// vm_vec_zero(&pi->rotvel);
|
||||
// vm_vec_zero(&obj->phys_info.vel);
|
||||
// vm_vec_zero(&obj->phys_info.rotvel);
|
||||
// }
|
||||
|
||||
return obj;
|
||||
@@ -1407,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));
|
||||
|
||||
@@ -173,7 +173,6 @@ typedef struct debris {
|
||||
int team; // Team of the ship where the debris came from
|
||||
int objnum; // What object this is linked to
|
||||
float lifeleft; // When 0 or less object dies
|
||||
int must_survive_until; //WMC - timestamp of earliest point that it can be murthered.
|
||||
int model_num; // What model this uses
|
||||
int submodel_num; // What submodel this uses
|
||||
int next_fireball; // When to start a fireball
|
||||
@@ -187,7 +186,6 @@ typedef struct debris {
|
||||
vec3d arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
|
||||
int arc_timestamp[MAX_DEBRIS_ARCS]; // When this times out, the spark goes away. -1 is not used
|
||||
int arc_frequency; // Starts at 0, gets bigger
|
||||
char parent_alt_name;
|
||||
|
||||
} debris;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -514,12 +514,8 @@ fireball Fireballs[MAX_FIREBALLS];
|
||||
|
||||
fireball_info Fireball_info[MAX_FIREBALL_TYPES];
|
||||
|
||||
int fireball_used[MAX_FIREBALL_TYPES];
|
||||
|
||||
int Num_fireballs = 0;
|
||||
|
||||
int Num_fireball_types = 0;
|
||||
|
||||
int fireballs_inited = 0;
|
||||
|
||||
int Warp_glow_bitmap = -1;
|
||||
@@ -542,9 +538,7 @@ void fireball_play_warphole_open_sound(int ship_class, fireball *fb)
|
||||
|
||||
sound_index = SND_WARP_IN;
|
||||
|
||||
if(fb->warp_open_sound_index > -1) {
|
||||
sound_index = fb->warp_open_sound_index;
|
||||
} else if((ship_class >= 0) && (ship_class < Num_ship_classes)){
|
||||
if((ship_class >= 0) && (ship_class < Num_ship_classes)){
|
||||
if ( Ship_info[ship_class].flags & SIF_HUGE_SHIP ) {
|
||||
sound_index = SND_CAPITAL_WARP_IN;
|
||||
fb->flags |= FBF_WARP_CAPITAL_SIZE;
|
||||
@@ -553,6 +547,10 @@ void fireball_play_warphole_open_sound(int ship_class, fireball *fb)
|
||||
fb->flags |= FBF_WARP_CRUISER_SIZE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sound_index = fb->warp_open_sound_index;
|
||||
}
|
||||
|
||||
snd_play_3d(&Snds[sound_index], &fireball_objp->pos, &Eye_position, fireball_objp->radius, NULL, 0, 1.0f, SND_PRIORITY_DOUBLE_INSTANCE, NULL, range_multiplier); // play warp sound effect
|
||||
}
|
||||
@@ -568,10 +566,10 @@ void fireball_play_warphole_close_sound(fireball *fb)
|
||||
|
||||
sound_index = SND_WARP_OUT;
|
||||
|
||||
if ( fb->warp_close_sound_index > -1 ) {
|
||||
sound_index = fb->warp_close_sound_index;
|
||||
} else if ( fb->flags & FBF_WARP_CAPITAL_SIZE ) {
|
||||
if ( fb->flags & FBF_WARP_CAPITAL_SIZE ) {
|
||||
sound_index = SND_CAPITAL_WARP_OUT;
|
||||
} else if ( fb->flags & FBF_WARP_VIA_SEXP ) {
|
||||
sound_index = fb->warp_close_sound_index;
|
||||
} else {
|
||||
// AL 27-3-98: Decided that warphole closing is only required for capital ship sized warp effects.
|
||||
return;
|
||||
@@ -596,14 +594,14 @@ static void fireball_set_default_color(int idx)
|
||||
Fireball_info[idx].exp_color[2] = 0.125f;
|
||||
break;
|
||||
|
||||
case FIREBALL_WARP:
|
||||
case FIREBALL_WARP_EFFECT:
|
||||
Fireball_info[idx].exp_color[0] = 0.75f;
|
||||
Fireball_info[idx].exp_color[1] = 0.75f;
|
||||
Fireball_info[idx].exp_color[2] = 1.0f;
|
||||
break;
|
||||
|
||||
|
||||
case FIREBALL_KNOSSOS:
|
||||
case FIREBALL_KNOSSOS_EFFECT:
|
||||
Fireball_info[idx].exp_color[0] = 0.75f;
|
||||
Fireball_info[idx].exp_color[1] = 1.0f;
|
||||
Fireball_info[idx].exp_color[2] = 0.75f;
|
||||
@@ -633,7 +631,7 @@ void parse_fireball_tbl(char *filename)
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
read_file_text(filename);
|
||||
reset_parse();
|
||||
|
||||
required_string("#Start");
|
||||
@@ -652,18 +650,16 @@ void parse_fireball_tbl(char *filename)
|
||||
if (optional_string("+Explosion_Medium")) {
|
||||
lod_check.override = FIREBALL_EXPLOSION_MEDIUM;
|
||||
} else if (optional_string("+Warp_Effect")) {
|
||||
lod_check.override = FIREBALL_WARP;
|
||||
lod_check.override = FIREBALL_WARP_EFFECT;
|
||||
} else if (optional_string("+Knossos_Effect")) {
|
||||
lod_check.override = FIREBALL_KNOSSOS;
|
||||
lod_check.override = FIREBALL_KNOSSOS_EFFECT;
|
||||
} else if (optional_string("+Asteroid")) {
|
||||
lod_check.override = FIREBALL_ASTEROID;
|
||||
} else if (optional_string("+Explosion_Large1")) {
|
||||
lod_check.override = FIREBALL_EXPLOSION_LARGE1;
|
||||
} else if (optional_string("+Explosion_Large2")){
|
||||
lod_check.override = FIREBALL_EXPLOSION_LARGE2;
|
||||
} else {
|
||||
required_string("+Custom_Fireball");
|
||||
stuff_int(&lod_check.override);
|
||||
required_string("+Explosion_Large2");
|
||||
lod_check.override = FIREBALL_EXPLOSION_LARGE2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -725,7 +721,6 @@ void fireball_parse_tbl()
|
||||
if ( (i < MAX_FIREBALL_TYPES) && (LOD_checker[i].override < 0) ) {
|
||||
strcpy( Fireball_info[i].lod[0].filename, LOD_checker[i].filename );
|
||||
Fireball_info[i].lod_count = LOD_checker[i].num_lods;
|
||||
Num_fireball_types++;
|
||||
|
||||
if (LOD_color[i].alpha == 255) {
|
||||
Fireball_info[i].exp_color[0] = (LOD_color[i].red / 255.0f);
|
||||
@@ -741,7 +736,7 @@ void fireball_parse_tbl()
|
||||
// this handles (and should only have to handle) TBM related entries
|
||||
for (i = 0; i < (int)LOD_checker.size(); i++) {
|
||||
// try entry replacement
|
||||
if ( (LOD_checker[i].override >= 0) && (LOD_checker[i].override < Num_fireball_types) ) {
|
||||
if ( (LOD_checker[i].override >= 0) && (LOD_checker[i].override < MAX_FIREBALL_TYPES) ) {
|
||||
strcpy( Fireball_info[LOD_checker[i].override].lod[0].filename, LOD_checker[i].filename );
|
||||
Fireball_info[LOD_checker[i].override].lod_count = LOD_checker[i].num_lods;
|
||||
|
||||
@@ -756,7 +751,7 @@ void fireball_parse_tbl()
|
||||
}
|
||||
|
||||
// fill in extra LOD filenames
|
||||
for (i = 0; i < Num_fireball_types; i++) {
|
||||
for (i = 0; i < MAX_FIREBALL_TYPES; i++) {
|
||||
for (j = 1; j < Fireball_info[i].lod_count; j++) {
|
||||
sprintf( Fireball_info[i].lod[j].filename, "%s_%d", Fireball_info[i].lod[0].filename, j);
|
||||
}
|
||||
@@ -772,12 +767,12 @@ void fireball_load_data()
|
||||
int i, idx;
|
||||
fireball_info *fd;
|
||||
|
||||
for ( i = 0; i < Num_fireball_types; i++ ) {
|
||||
for ( i = 0; i < MAX_FIREBALL_TYPES; i++ ) {
|
||||
fd = &Fireball_info[i];
|
||||
|
||||
for(idx=0; idx<fd->lod_count; idx++){
|
||||
// we won't use a warp effect lod greater than MAX_WARP_LOD so don't load it either
|
||||
if ( (i == FIREBALL_WARP) && (idx > MAX_WARP_LOD) )
|
||||
if ( (i == FIREBALL_WARP_EFFECT) && (idx > MAX_WARP_LOD) )
|
||||
continue;
|
||||
|
||||
fd->lod[idx].bitmap_id = bm_load_animation( fd->lod[idx].filename, &fd->lod[idx].num_frames, &fd->lod[idx].fps, 1 );
|
||||
@@ -873,20 +868,29 @@ void fireball_render(object * obj)
|
||||
g3_transfer_vertex(&p, &obj->pos);
|
||||
}
|
||||
|
||||
switch( fb->fireball_render_type ) {
|
||||
|
||||
case FIREBALL_MEDIUM_EXPLOSION:
|
||||
switch( fb->fireball_info_index ) {
|
||||
|
||||
case FIREBALL_EXPLOSION_MEDIUM:
|
||||
gr_set_bitmap(Fireballs[num].current_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.3f );
|
||||
g3_draw_bitmap(&p, fb->orient, obj->radius, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT );
|
||||
break;
|
||||
|
||||
case FIREBALL_LARGE_EXPLOSION:
|
||||
case FIREBALL_EXPLOSION_LARGE1:
|
||||
case FIREBALL_EXPLOSION_LARGE2:
|
||||
// case FIREBALL_EXPLOSION_LARGE3:
|
||||
/*
|
||||
if (!tcache_hit(Fireballs[num].current_bitmap)) {
|
||||
// if we're over 200k exp vram upload this frame, change to lower lod
|
||||
}*/
|
||||
|
||||
case FIREBALL_ASTEROID:
|
||||
// Make the big explosions rotate with the viewer.
|
||||
gr_set_bitmap(Fireballs[num].current_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.3f );
|
||||
g3_draw_rotated_bitmap(&p, (i2fl(fb->orient)*PI)/180.0f, obj->radius, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT);
|
||||
break;
|
||||
|
||||
case FIREBALL_WARP_EFFECT: {
|
||||
case FIREBALL_WARP_EFFECT:
|
||||
case FIREBALL_KNOSSOS_EFFECT: {
|
||||
|
||||
float percent_life = fb->time_elapsed / fb->total_time;
|
||||
|
||||
@@ -978,7 +982,7 @@ void fireball_set_framenum(int num)
|
||||
return;
|
||||
}
|
||||
|
||||
if ( fb->fireball_render_type == FIREBALL_WARP_EFFECT ) {
|
||||
if ( fb->fireball_info_index == FIREBALL_WARP_EFFECT || fb->fireball_info_index == FIREBALL_KNOSSOS_EFFECT ) {
|
||||
float total_time = i2fl(fl->num_frames) / fl->fps; // in seconds
|
||||
|
||||
framenum = fl2i(fb->time_elapsed * fl->num_frames / total_time + 0.5);
|
||||
@@ -1021,10 +1025,10 @@ int fireball_is_perishable(object * obj)
|
||||
|
||||
fb = &Fireballs[num];
|
||||
|
||||
if ( fb->fireball_render_type == FIREBALL_MEDIUM_EXPLOSION )
|
||||
if ( fb->fireball_info_index == FIREBALL_EXPLOSION_MEDIUM )
|
||||
return 1;
|
||||
|
||||
if ( !(fb->fireball_render_type == FIREBALL_WARP_EFFECT) ) {
|
||||
if ( !((fb->fireball_info_index == FIREBALL_WARP_EFFECT) || (fb->fireball_info_index == FIREBALL_KNOSSOS_EFFECT)) ) {
|
||||
if ( !(obj->flags & OF_WAS_RENDERED)) {
|
||||
return 1;
|
||||
}
|
||||
@@ -1087,7 +1091,7 @@ int fireball_is_warp(object * obj)
|
||||
|
||||
fb = &Fireballs[num];
|
||||
|
||||
if ( fb->fireball_render_type == FIREBALL_WARP_EFFECT)
|
||||
if ( fb->fireball_info_index == FIREBALL_WARP_EFFECT || fb->fireball_info_index == FIREBALL_KNOSSOS_EFFECT)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
@@ -1099,7 +1103,7 @@ void fireball_maybe_play_warp_close_sound(fireball *fb)
|
||||
float life_left;
|
||||
|
||||
// If not a warphole fireball, do a quick out
|
||||
if ( !(fb->fireball_render_type == FIREBALL_WARP_EFFECT)) {
|
||||
if ( !(fb->fireball_info_index == FIREBALL_WARP_EFFECT || fb->fireball_info_index == FIREBALL_KNOSSOS_EFFECT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1190,13 +1194,14 @@ int fireball_get_lod(vec3d *pos, fireball_info *fd, float size)
|
||||
}
|
||||
|
||||
// start the frame
|
||||
extern float Viewer_zoom;
|
||||
extern int G3_count;
|
||||
|
||||
if(!G3_count){
|
||||
g3_start_frame(1);
|
||||
must_stop = 1;
|
||||
}
|
||||
g3_set_view_matrix(&Eye_position, &Eye_matrix, Eye_fov);
|
||||
g3_set_view_matrix(&Eye_position, &Eye_matrix, Viewer_zoom);
|
||||
|
||||
// get extents of the rotated bitmap
|
||||
g3_rotate_vertex(&v, pos);
|
||||
@@ -1257,7 +1262,7 @@ int fireball_get_lod(vec3d *pos, fireball_info *fd, float size)
|
||||
}
|
||||
|
||||
// Create a fireball, return object index.
|
||||
int fireball_create( vec3d * pos, int fireball_type, int render_type, int parent_obj, float size, int reverse, vec3d *velocity, float warp_lifetime, int ship_class, matrix *orient_override, int low_res, int extra_flags, int warp_open_sound, int warp_close_sound)
|
||||
int fireball_create( vec3d * pos, int fireball_type, int parent_obj, float size, int reverse, vec3d *velocity, float warp_lifetime, int ship_class, matrix *orient_override, int low_res, int extra_flags, int warp_open_sound, int warp_close_sound)
|
||||
{
|
||||
int n, objnum, fb_lod;
|
||||
object *obj;
|
||||
@@ -1266,7 +1271,7 @@ int fireball_create( vec3d * pos, int fireball_type, int render_type, int parent
|
||||
fireball_lod *fl;
|
||||
|
||||
Assert( fireball_type > -1 );
|
||||
Assert( fireball_type < Num_fireball_types );
|
||||
Assert( fireball_type < MAX_FIREBALL_TYPES );
|
||||
|
||||
fd = &Fireball_info[fireball_type];
|
||||
|
||||
@@ -1275,7 +1280,7 @@ int fireball_create( vec3d * pos, int fireball_type, int render_type, int parent
|
||||
return -1;
|
||||
|
||||
if ( !(Game_detail_flags & DETAIL_FLAG_FIREBALLS) ) {
|
||||
if ( !((fireball_type == FIREBALL_WARP) || (fireball_type == FIREBALL_KNOSSOS)) ) {
|
||||
if ( !((fireball_type == FIREBALL_WARP_EFFECT) || (fireball_type == FIREBALL_KNOSSOS_EFFECT)) ) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1319,7 +1324,7 @@ int fireball_create( vec3d * pos, int fireball_type, int render_type, int parent
|
||||
}
|
||||
|
||||
// if this is a warpout fireball, never go higher than LOD 1
|
||||
if(fireball_type == FIREBALL_WARP){
|
||||
if(fireball_type == FIREBALL_WARP_EFFECT){
|
||||
/*
|
||||
if(fb_lod > 1){
|
||||
fb_lod = 1;
|
||||
@@ -1356,22 +1361,25 @@ int fireball_create( vec3d * pos, int fireball_type, int render_type, int parent
|
||||
obj = &Objects[objnum];
|
||||
|
||||
fb->fireball_info_index = fireball_type;
|
||||
fb->fireball_render_type = render_type;
|
||||
fb->time_elapsed = 0.0f;
|
||||
fb->objnum = objnum;
|
||||
fb->current_bitmap = -1;
|
||||
|
||||
switch( fb->fireball_render_type ) {
|
||||
switch( fb->fireball_info_index ) {
|
||||
|
||||
case FIREBALL_MEDIUM_EXPLOSION:
|
||||
case FIREBALL_EXPLOSION_MEDIUM:
|
||||
fb->orient = (myrand()>>8) & 7; // 0 - 7
|
||||
break;
|
||||
|
||||
case FIREBALL_LARGE_EXPLOSION:
|
||||
case FIREBALL_EXPLOSION_LARGE1:
|
||||
case FIREBALL_EXPLOSION_LARGE2:
|
||||
// case FIREBALL_EXPLOSION_LARGE3:
|
||||
case FIREBALL_ASTEROID:
|
||||
fb->orient = (myrand()>>8) % 360; // 0 - 359
|
||||
break;
|
||||
|
||||
case FIREBALL_WARP_EFFECT:
|
||||
case FIREBALL_KNOSSOS_EFFECT:
|
||||
// Play sound effect for warp hole opening up
|
||||
fireball_play_warphole_open_sound(ship_class, fb);
|
||||
|
||||
@@ -1391,7 +1399,7 @@ int fireball_create( vec3d * pos, int fireball_type, int render_type, int parent
|
||||
break;
|
||||
}
|
||||
|
||||
if ( fb->fireball_render_type == FIREBALL_WARP_EFFECT ) {
|
||||
if ( fb->fireball_info_index == FIREBALL_WARP_EFFECT || fb->fireball_info_index == FIREBALL_KNOSSOS_EFFECT ) {
|
||||
Assert( warp_lifetime > 4.0f ); // Warp lifetime must be at least 4 seconds!
|
||||
fb->total_time = warp_lifetime; // in seconds
|
||||
} else {
|
||||
@@ -1448,22 +1456,20 @@ void fireballs_page_in()
|
||||
{
|
||||
int i, idx;
|
||||
fireball_info *fd;
|
||||
|
||||
for ( i = 0; i < MAX_FIREBALL_TYPES ; i++ ) {
|
||||
fd = &Fireball_info[i];
|
||||
|
||||
for ( i = 0; i < Num_fireball_types; i++ ) {
|
||||
if((i < NUM_DEFAULT_FIREBALLS) || fireball_used[i]){
|
||||
fd = &Fireball_info[i];
|
||||
// if this is a Knossos ani, only load if Knossos_warp_ani_used is true
|
||||
if ( (i == FIREBALL_KNOSSOS_EFFECT) && !Knossos_warp_ani_used)
|
||||
continue;
|
||||
|
||||
// if this is a Knossos ani, only load if Knossos_warp_ani_used is true
|
||||
if ( (i == FIREBALL_KNOSSOS) && !Knossos_warp_ani_used)
|
||||
for(idx=0; idx<fd->lod_count; idx++) {
|
||||
// we won't use a warp effect lod greater than MAX_WARP_LOD so don't load it either
|
||||
if ( (i == FIREBALL_WARP_EFFECT) && (idx > MAX_WARP_LOD) )
|
||||
continue;
|
||||
|
||||
for(idx=0; idx<fd->lod_count; idx++) {
|
||||
// we won't use a warp effect lod greater than MAX_WARP_LOD so don't load it either
|
||||
if ( (i == FIREBALL_WARP) && (idx > MAX_WARP_LOD) )
|
||||
continue;
|
||||
|
||||
bm_page_in_texture( fd->lod[idx].bitmap_id, fd->lod[idx].num_frames );
|
||||
}
|
||||
bm_page_in_texture( fd->lod[idx].bitmap_id, fd->lod[idx].num_frames );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1475,7 +1481,7 @@ void fireball_get_color(int idx, float *red, float *green, float *blue)
|
||||
{
|
||||
Assert( red && blue && green );
|
||||
|
||||
if ( (idx < 0) || (idx >= Num_fireball_types) ) {
|
||||
if ( (idx < 0) || (idx >= MAX_FIREBALL_TYPES) ) {
|
||||
Int3();
|
||||
|
||||
*red = 1.0f;
|
||||
@@ -1492,23 +1498,16 @@ void fireball_get_color(int idx, float *red, float *green, float *blue)
|
||||
*blue = fbi->exp_color[2];
|
||||
}
|
||||
|
||||
int fireball_ship_explosion_type(ship_info *sip)
|
||||
int fireball_get_type(object *obj)
|
||||
{
|
||||
Assert( sip != NULL );
|
||||
int num, objnum;
|
||||
fireball *fb;
|
||||
|
||||
int index = -1;
|
||||
int ship_fireballs = (int)sip->explosion_bitmap_anims.size();
|
||||
int objecttype_fireballs = -1;
|
||||
num = obj->instance;
|
||||
objnum = OBJ_INDEX(obj);
|
||||
Assert( Fireballs[num].objnum == objnum );
|
||||
|
||||
if (sip->class_type >= 0) {
|
||||
objecttype_fireballs = (int)Ship_types[sip->class_type].explosion_bitmap_anims.size();
|
||||
}
|
||||
fb = &Fireballs[num];
|
||||
|
||||
if(ship_fireballs > 0){
|
||||
index = sip->explosion_bitmap_anims[rand()%ship_fireballs];
|
||||
} else if(objecttype_fireballs > 0){
|
||||
index = Ship_types[sip->class_type].explosion_bitmap_anims[rand()%objecttype_fireballs];
|
||||
}
|
||||
|
||||
return index;
|
||||
return fb->fireball_info_index;
|
||||
}
|
||||
@@ -222,28 +222,19 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
struct object;
|
||||
struct ship_info;
|
||||
|
||||
// values correspond to the fireball render types
|
||||
#define FIREBALL_MEDIUM_EXPLOSION 0
|
||||
#define FIREBALL_LARGE_EXPLOSION 1
|
||||
#define FIREBALL_WARP_EFFECT 2
|
||||
|
||||
// these values correspond to the fireball.tbl default entries
|
||||
// these values correspond to the fireball.tbl entries
|
||||
#define FIREBALL_EXPLOSION_MEDIUM 0 // Used for the 4 little explosions before a ship explodes
|
||||
#define FIREBALL_WARP 1 // Used for the warp in / warp out effect
|
||||
#define FIREBALL_KNOSSOS 2 // Used for the KNOSSOS warp in / warp out effect
|
||||
#define FIREBALL_WARP_EFFECT 1 // Used for the warp in / warp out effect
|
||||
#define FIREBALL_KNOSSOS_EFFECT 2 // Used for the KNOSSOS warp in / warp out effect
|
||||
#define FIREBALL_ASTEROID 3
|
||||
#define FIREBALL_EXPLOSION_LARGE1 4 // Used for the big explosion when a ship breaks into pieces
|
||||
#define FIREBALL_EXPLOSION_LARGE2 5 // Used for the big explosion when a ship breaks into pieces
|
||||
|
||||
#define MAX_FIREBALL_TYPES 32 // The maximum number of fireballs that can be defined
|
||||
#define NUM_DEFAULT_FIREBALLS 6
|
||||
// #define FIREBALL_EXPLOSION_LARGE3 6 // Used for the big explosion when a ship breaks into pieces
|
||||
#define MAX_FIREBALL_TYPES 6 // How many types there are
|
||||
|
||||
#define FIREBALL_NUM_LARGE_EXPLOSIONS 2
|
||||
|
||||
extern int fireball_used[MAX_FIREBALL_TYPES];
|
||||
|
||||
// all this moved here by Goober5000 because it makes more sense in the H file
|
||||
typedef struct fireball_lod {
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
@@ -268,7 +259,6 @@ typedef struct fireball_info {
|
||||
typedef struct fireball {
|
||||
int objnum; // If -1 this object is unused
|
||||
int fireball_info_index; // Index into Fireball_info array
|
||||
int fireball_render_type;
|
||||
int current_bitmap;
|
||||
int orient; // For fireballs, which orientation. For warps, 0 is warpin, 1 is warpout
|
||||
int flags; // see #define FBF_*
|
||||
@@ -289,7 +279,7 @@ void fireball_process_post(object * obj, float frame_time);
|
||||
// reversed is for warp_in/out effects
|
||||
// Velocity: If not NULL, the fireball will move at a constant velocity.
|
||||
// warp_lifetime: If warp_lifetime > 0.0f then makes the explosion loop so it lasts this long. Only works for warp effect
|
||||
int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_obj, float size, int reversed=0, vec3d *velocity=NULL, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=NULL, int low_res=0, int extra_flags=0, int warp_open_sound=-1, int warp_close_sound=-1);
|
||||
int fireball_create(vec3d *pos, int fireball_type, int parent_obj, float size, int reversed=0, vec3d *velocity=NULL, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=NULL, int low_res=0, int extra_flags=0, int warp_open_sound=0, int warp_close_sound=0);
|
||||
void fireball_render_plane(int plane);
|
||||
void fireball_close();
|
||||
void fireball_level_close();
|
||||
@@ -307,17 +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);
|
||||
|
||||
// returns the index of the fireball bitmap for this ship. -1 if there is none.
|
||||
int fireball_ship_explosion_type(ship_info *sip);
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
|
||||
if (Warp_glow_bitmap >= 0) {
|
||||
float r = radius;
|
||||
bool render_it = true;
|
||||
bool render_it = (Cmdline_warp_flash == 1);
|
||||
|
||||
#define OUT_PERCENT1 0.80f
|
||||
#define OUT_PERCENT2 0.90f
|
||||
@@ -326,15 +326,12 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
#define IN_PERCENT1 0.10f
|
||||
#define IN_PERCENT2 0.20f
|
||||
|
||||
if (Cmdline_warp_flash)
|
||||
{
|
||||
if ( (life_percent >= IN_PERCENT1) && (life_percent < IN_PERCENT2) ) {
|
||||
r *= (life_percent - IN_PERCENT1) / (IN_PERCENT2 - IN_PERCENT1);
|
||||
//render_it = true;
|
||||
} else if ( (life_percent >= OUT_PERCENT1) && (life_percent < OUT_PERCENT2) ) {
|
||||
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2 - OUT_PERCENT1);
|
||||
//render_it = true;
|
||||
}
|
||||
if ( (life_percent >= IN_PERCENT1) && (life_percent < IN_PERCENT2) ) {
|
||||
r *= (life_percent - IN_PERCENT1) / (IN_PERCENT2 - IN_PERCENT1);
|
||||
render_it = true;
|
||||
} else if ( (life_percent >= OUT_PERCENT1) && (life_percent < OUT_PERCENT2) ) {
|
||||
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2 - OUT_PERCENT1);
|
||||
render_it = true;
|
||||
}
|
||||
|
||||
if (render_it) {
|
||||
@@ -395,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;
|
||||
@@ -426,7 +423,7 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
|
||||
gr_set_cull(cull);
|
||||
}
|
||||
|
||||
if (Warp_ball_bitmap > -1 && Cmdline_warp_flash == 1) {
|
||||
if (Warp_ball_bitmap > -1) {
|
||||
flash_ball warp_ball(20, .1f,.25f, &vmd_z_vector, &vmd_zero_vector, 4.0f, 0.5f);
|
||||
float adg = (2.0f * life_percent) - 1.0f;
|
||||
float pct = (powf(adg, 4.0f) - powf(adg, 128.0f)) * 4.0f;
|
||||
|
||||
@@ -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:");
|
||||
|
||||
@@ -564,18 +564,6 @@ void briefing_editor_dlg::update_data(int update)
|
||||
break;
|
||||
}
|
||||
|
||||
//WMC - Safeguard against broken lines
|
||||
i = ptr->num_lines;
|
||||
while(i--)
|
||||
{
|
||||
if(ptr->lines[i].start_icon < 0 || ptr->lines[i].end_icon < 0 || ptr->lines[i].start_icon >= ptr->num_icons || ptr->lines[i].end_icon >= ptr->num_icons)
|
||||
{
|
||||
ptr->num_lines--;
|
||||
for(l = i; l < ptr->num_lines; l++)
|
||||
ptr->lines[l] = ptr->lines[l+1];
|
||||
}
|
||||
}
|
||||
|
||||
if (m_last_icon >= 0) {
|
||||
valid = (m_id != ptr->icons[m_last_icon].id);
|
||||
if (m_id >= 0) {
|
||||
@@ -1591,4 +1579,4 @@ void briefing_editor_dlg::OnFlipIcon()
|
||||
// Briefing->stages[m_cur_stage].icons[m_cur_icon].flags &= ~BI_MIRROR_ICON;
|
||||
update_data(1);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -48,14 +48,13 @@ void campaign_filelist_box::initialize()
|
||||
{
|
||||
int i, z, num_files;
|
||||
char *mission_filenames[2000];
|
||||
char mission_filenames_arr[2000][MAX_FILENAME_LEN];
|
||||
mission a_mission;
|
||||
|
||||
ResetContent();
|
||||
|
||||
extern int Skip_packfile_search;
|
||||
Skip_packfile_search = 1;
|
||||
num_files = cf_get_file_list_preallocated(2000, mission_filenames_arr, mission_filenames, CF_TYPE_MISSIONS, "*.fs2");
|
||||
num_files = cf_get_file_list(2000, mission_filenames, CF_TYPE_MISSIONS, "*.fs2");
|
||||
Skip_packfile_search = 0;
|
||||
|
||||
i=0;
|
||||
|
||||
@@ -561,7 +561,7 @@ int campaign_tree_wnd::fred_check_sexp(int sexp, int type, char *msg, ...)
|
||||
if (!z)
|
||||
return 0;
|
||||
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE, 2048);
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE);
|
||||
sprintf(buf3, "Error in %s: %s\n\nIn sexpression: %s\n\n(Error appears to be: %s)",
|
||||
buf, sexp_error_message(z), buf2, Sexp_nodes[faulty_node].text);
|
||||
|
||||
|
||||
@@ -311,6 +311,7 @@ int Update_window = 1;
|
||||
HCURSOR h_cursor_move, h_cursor_rotate;
|
||||
|
||||
// Goober5000 - needed to restore compatibility with the changes in fs2_open
|
||||
float VIEWER_ZOOM_DEFAULT = 0.75f;
|
||||
int Show_cpu = 0;
|
||||
|
||||
CWnd *Prev_window;
|
||||
|
||||
@@ -656,7 +656,6 @@ int CFREDDoc::autoload()
|
||||
|
||||
cf_create_default_path_string(name, sizeof(name) - 1, CF_TYPE_MISSIONS);
|
||||
SAFE_STRCAT(name, MISSION_BACKUP_NAME, (sizeof(name) - 1));
|
||||
strcpy(backup_name, name);
|
||||
SAFE_STRCAT(name, ".002", (sizeof(name) - 1));
|
||||
fp = fopen(name, "r");
|
||||
if (!fp)
|
||||
@@ -670,6 +669,7 @@ int CFREDDoc::autoload()
|
||||
r = load_mission(name);
|
||||
Update_window = 1;
|
||||
|
||||
strcpy(backup_name, MISSION_BACKUP_NAME);
|
||||
len = strlen(backup_name);
|
||||
strcat(backup_name, ".001");
|
||||
cf_delete(backup_name, CF_TYPE_MISSIONS);
|
||||
@@ -771,7 +771,6 @@ int CFREDDoc::load_mission(char *pathname, int flags)
|
||||
if (stricmp(name, old_name)) { // need to fix name
|
||||
update_sexp_references(old_name, name);
|
||||
ai_update_goal_references(REF_TYPE_SHIP, old_name, name);
|
||||
update_texture_replacements(old_name, name);
|
||||
for (k=0; k<Num_reinforcements; k++)
|
||||
if (!stricmp(old_name, Reinforcements[k].name)) {
|
||||
Assert(strlen(name) < NAME_LENGTH);
|
||||
@@ -809,24 +808,15 @@ int CFREDDoc::load_mission(char *pathname, int flags)
|
||||
palette_load_table(name);
|
||||
#endif
|
||||
|
||||
// go through all ships and translate their callsign and alternate name indices
|
||||
// go through all ships and translate their alternate name indices
|
||||
objp = GET_FIRST(&obj_used_list);
|
||||
while (objp != END_OF_LIST(&obj_used_list)) {
|
||||
// if this is a ship, check it, and mark its possible alternate name down in the auxiliary array
|
||||
if (((objp->type == OBJ_SHIP) || (objp->type == OBJ_START)) && (objp->instance >= 0)) {
|
||||
if (Ships[objp->instance].alt_type_index >= 0) {
|
||||
mission_parse_lookup_alt_index(Ships[objp->instance].alt_type_index, Fred_alt_names[objp->instance]);
|
||||
if(((objp->type == OBJ_SHIP) || (objp->type == OBJ_START)) && (objp->instance >= 0) && (Ships[objp->instance].alt_type_index >= 0)){
|
||||
mission_parse_lookup_alt_index(Ships[objp->instance].alt_type_index, Fred_alt_names[objp->instance]);
|
||||
|
||||
// also zero it
|
||||
Ships[objp->instance].alt_type_index = -1;
|
||||
}
|
||||
|
||||
if (Ships[objp->instance].callsign_index >= 0) {
|
||||
mission_parse_lookup_callsign_index(Ships[objp->instance].callsign_index, Fred_callsigns[objp->instance]);
|
||||
|
||||
// also zero it
|
||||
Ships[objp->instance].callsign_index = -1;
|
||||
}
|
||||
// also zero it
|
||||
Ships[objp->instance].alt_type_index = -1;
|
||||
}
|
||||
|
||||
objp = GET_NEXT(objp);
|
||||
@@ -1216,7 +1206,7 @@ void CFREDDoc::OnFileImportFSM()
|
||||
*ch = '\0';
|
||||
|
||||
// estimate the mission path for FS1
|
||||
if ((ch = stristr(fs1_mission_path, "FreeSpace2")) != NULL)
|
||||
if ((ch = stristr(fs1_mission_path, "FreeSpace2")) >= 0)
|
||||
{
|
||||
strcpy(ch, "FreeSpace\\Data\\Missions");
|
||||
}
|
||||
@@ -1372,7 +1362,7 @@ void CFREDDoc::OnFileImportWeapons()
|
||||
|
||||
// set initial path
|
||||
strcpy(temp, Fred_exe_dir);
|
||||
if ((ch = stristr(temp, "FreeSpace2")) != NULL)
|
||||
if ((ch = stristr(temp, "FreeSpace2")) >= 0)
|
||||
{
|
||||
strcpy(ch, "FreeSpace\\Data\\Tables");
|
||||
dlg.m_ofn.lpstrInitialDir = temp;
|
||||
|
||||
@@ -1075,9 +1075,9 @@ void render_one_model_nohtl(object *objp)
|
||||
{
|
||||
if (Fred_outline) {
|
||||
model_set_outline_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j | MR_SHOW_OUTLINE, -1, -1, Ships[z].ship_replacement_textures);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j | MR_SHOW_OUTLINE, -1, -1, Ships[z].replacement_textures);
|
||||
} else {
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].ship_replacement_textures);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].replacement_textures);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,7 +1216,7 @@ void render_one_model_htl(object *objp)
|
||||
}
|
||||
|
||||
g3_done_instance(0);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].ship_replacement_textures);
|
||||
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].replacement_textures);
|
||||
} else {
|
||||
int r = 0, g = 0, b = 0;
|
||||
|
||||
|
||||
@@ -651,9 +651,11 @@ int game_cd_changed(void) {return 0;}
|
||||
|
||||
int Interface_framerate;
|
||||
void game_set_view_clip(){}
|
||||
float Viewer_zoom;
|
||||
|
||||
int Warpout_forced = 0;
|
||||
float Warpout_time;
|
||||
vec3d Camera_pos;
|
||||
vec3d Dead_player_last_vel;
|
||||
int game_start_mission(){return 0;}
|
||||
int Game_weapons_tbl_valid;
|
||||
@@ -714,8 +716,8 @@ fix game_get_overall_frametime() { return 0; }
|
||||
//WMC
|
||||
void game_level_init(int seed){}
|
||||
void game_post_level_init(){}
|
||||
camid game_render_frame_setup(){return camid();}
|
||||
void game_render_frame(camid cid){}
|
||||
void game_render_frame_setup(vec3d *eye_pos, matrix *eye_orient){}
|
||||
void game_render_frame(vec3d *eye_pos, matrix *eye_orient){}
|
||||
void game_simulation_frame(){}
|
||||
void game_update_missiontime(){}
|
||||
void game_render_post_frame(){}
|
||||
@@ -928,8 +928,6 @@ BEGIN_MESSAGE_MAP(CFREDView, CView)
|
||||
ON_UPDATE_COMMAND_UI(ID_SHOW_DOCK_POINTS, OnUpdateShowDockPoints)
|
||||
ON_COMMAND(ID_FORMAT_FS2_OPEN, OnFormatFs2Open)
|
||||
ON_UPDATE_COMMAND_UI(ID_FORMAT_FS2_OPEN, OnUpdateFormatFs2Open)
|
||||
ON_COMMAND(ID_FORMAT_FS2_OPEN_COMP, OnFormatFs2OpenComp)
|
||||
ON_UPDATE_COMMAND_UI(ID_FORMAT_FS2_OPEN_COMP, OnUpdateFormatFs2OpenComp)
|
||||
ON_COMMAND(ID_FORMAT_FS2_RETAIL, OnFormatFs2Retail)
|
||||
ON_UPDATE_COMMAND_UI(ID_FORMAT_FS2_RETAIL, OnUpdateFormatFs2Retail)
|
||||
ON_COMMAND(ID_FORMAT_FS1_RETAIL, OnFormatFs1Retail)
|
||||
@@ -3520,7 +3518,7 @@ int CFREDView::global_error_check()
|
||||
if ( j == 0 ) {
|
||||
default_orders = orders;
|
||||
} else if ( default_orders != orders ) {
|
||||
if (error("%s and %s will accept different orders. All ships in a wing must accept the same Player Orders.", Ships[Wings[i].ship_index[j]].ship_name, Ships[Wings[i].ship_index[0]].ship_name ) ){
|
||||
if (error("Wing %s has ships with different player orders which\nare ignored. They must all be the same", Wings[i].name ) ){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -3877,7 +3875,7 @@ int CFREDView::fred_check_sexp(int sexp, int type, char *msg, ...)
|
||||
if (!z)
|
||||
return 0;
|
||||
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE, 2048);
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE);
|
||||
sprintf(buf3, "Error in %s: %s\n\nIn sexpression: %s\n(Error appears to be: %s)",
|
||||
buf, sexp_error_message(z), buf2, Sexp_nodes[faulty_node].text);
|
||||
|
||||
@@ -4321,27 +4319,6 @@ void CFREDView::OnRunFreeSpace()
|
||||
si.cbReserved2 = 0;
|
||||
si.lpReserved2 = NULL;
|
||||
|
||||
// get the filename of the app and replace FRED2_Open with FS2_Open
|
||||
std::string processed_name(AfxGetApp()->m_pszExeName);
|
||||
std::string::size_type fred_index = processed_name.find("fred2_open", 0);
|
||||
// capitalisation!
|
||||
if (fred_index == std::string::npos) {
|
||||
fred_index = processed_name.find("Fred2_Open", 0);
|
||||
}
|
||||
|
||||
if (fred_index != std::string::npos) {
|
||||
// delete the fred2_open and add FS2_Open in its place
|
||||
processed_name.erase(fred_index, 10);
|
||||
processed_name.insert(fred_index, "FS2_Open");
|
||||
processed_name.append(".exe");
|
||||
|
||||
//try to start FS2_open
|
||||
r = CreateProcess(processed_name.c_str(), NULL, NULL, NULL, FALSE, 0, NULL, "./", &si, &pi);
|
||||
if (r) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
r = CreateProcess("start_fs2.bat", NULL, NULL, NULL, FALSE, 0, NULL, "./", &si, &pi);
|
||||
|
||||
if (!r) {
|
||||
@@ -5097,7 +5074,7 @@ void CFREDView::OnDumpStats()
|
||||
|
||||
void CFREDView::OnFormatFs2Open()
|
||||
{
|
||||
Format_fs2_open = FSO_FORMAT_STANDARD;
|
||||
Format_fs2_open = 1;
|
||||
Format_fs2_retail = 0;
|
||||
Format_fs1_retail = 0;
|
||||
|
||||
@@ -5107,22 +5084,7 @@ void CFREDView::OnFormatFs2Open()
|
||||
|
||||
void CFREDView::OnUpdateFormatFs2Open(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->SetCheck(Format_fs2_open == FSO_FORMAT_STANDARD);
|
||||
}
|
||||
|
||||
void CFREDView::OnFormatFs2OpenComp()
|
||||
{
|
||||
Format_fs2_open = FSO_FORMAT_COMPATIBILITY_MODE;
|
||||
Format_fs2_retail = 0;
|
||||
Format_fs1_retail = 0;
|
||||
|
||||
theApp.write_ini_file();
|
||||
Update_window = 1;
|
||||
}
|
||||
|
||||
void CFREDView::OnUpdateFormatFs2OpenComp(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->SetCheck(Format_fs2_open == FSO_FORMAT_COMPATIBILITY_MODE);
|
||||
pCmdUI->SetCheck(Format_fs2_open);
|
||||
}
|
||||
|
||||
void CFREDView::OnFormatFs2Retail()
|
||||
|
||||
@@ -546,8 +546,6 @@ protected:
|
||||
afx_msg void OnUpdateShowDockPoints(CCmdUI* pCmdUI);
|
||||
afx_msg void OnFormatFs2Open();
|
||||
afx_msg void OnUpdateFormatFs2Open(CCmdUI* pCmdUI);
|
||||
afx_msg void OnFormatFs2OpenComp();
|
||||
afx_msg void OnUpdateFormatFs2OpenComp(CCmdUI* pCmdUI);
|
||||
afx_msg void OnFormatFs2Retail();
|
||||
afx_msg void OnUpdateFormatFs2Retail(CCmdUI* pCmdUI);
|
||||
afx_msg void OnFormatFs1Retail();
|
||||
@@ -614,9 +612,6 @@ extern int Hide_ship_cues, Hide_wing_cues;
|
||||
extern Marking_box marking_box;
|
||||
extern object_orient_pos rotation_backup[MAX_OBJECTS];
|
||||
|
||||
#define FSO_FORMAT_STANDARD 1
|
||||
#define FSO_FORMAT_COMPATIBILITY_MODE 2
|
||||
|
||||
// Goober5000 (currently, FS1 retail not implemented)
|
||||
extern int Format_fs2_open;
|
||||
extern int Format_fs2_retail;
|
||||
|
||||
@@ -774,7 +774,7 @@ void initial_status::dock(object *objp, int dockpoint, object *other_objp, int o
|
||||
dock_function_info dfi;
|
||||
|
||||
// do the docking (do it in reverse so that the current object stays put)
|
||||
ai_dock_with_object(other_objp, other_dockpoint, objp, dockpoint, AIDO_DOCK_NOW);
|
||||
ai_dock_with_object(other_objp, other_dockpoint, objp, dockpoint, 89, AIDO_DOCK_NOW);
|
||||
|
||||
// unmark the handled flag in preparation for the next step
|
||||
dock_evaluate_all_docked_objects(objp, &dfi, initial_status_unmark_dock_handled_flag);
|
||||
|
||||
@@ -609,7 +609,6 @@ char Fred_exe_dir[512] = "";
|
||||
char Fred_base_dir[512] = "";
|
||||
|
||||
char Fred_alt_names[MAX_SHIPS][NAME_LENGTH+1];
|
||||
char Fred_callsigns[MAX_SHIPS][NAME_LENGTH+1];
|
||||
|
||||
// object numbers for ships in a wing.
|
||||
int wing_objects[MAX_WINGS][MAX_SHIPS_PER_WING];
|
||||
@@ -805,7 +804,7 @@ void parse_medal_tbl()
|
||||
void fred_close()
|
||||
{
|
||||
if (Fred_texture_replacements != NULL) {
|
||||
delete[] Fred_texture_replacements;
|
||||
vm_free(Fred_texture_replacements);
|
||||
Fred_texture_replacements = NULL;
|
||||
}
|
||||
}
|
||||
@@ -903,8 +902,8 @@ 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");
|
||||
|
||||
@@ -928,8 +927,7 @@ bool fred_init()
|
||||
species_init(); // Kazan
|
||||
|
||||
// for fred specific replacement texture stuff
|
||||
//Fred_texture_replacements = (texture_replace*) vm_malloc( sizeof(texture_replace) * MAX_SHIPS * MAX_REPLACEMENT_TEXTURES );
|
||||
Fred_texture_replacements = new texture_replace[MAX_SHIPS*MAX_REPLACEMENT_TEXTURES];
|
||||
Fred_texture_replacements = (texture_replace*) vm_malloc( sizeof(texture_replace) * MAX_SHIPS * MAX_MODEL_TEXTURES );
|
||||
atexit(fred_close);
|
||||
|
||||
// Goober5000
|
||||
@@ -1502,10 +1500,9 @@ void clear_mission()
|
||||
Player_starts = 0;
|
||||
Num_teams = 1;
|
||||
|
||||
// reset alternate name & callsign stuff
|
||||
// reset alternate name stuff
|
||||
for(i=0; i<MAX_SHIPS; i++){
|
||||
strcpy(Fred_alt_names[i], "");
|
||||
strcpy(Fred_callsigns[i], "");
|
||||
}
|
||||
|
||||
// set up the default ship types for all teams. For now, this is the same class
|
||||
@@ -1575,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
|
||||
@@ -2438,7 +2431,6 @@ int rename_ship(int ship, char *name)
|
||||
|
||||
update_sexp_references(Ships[ship].ship_name, name);
|
||||
ai_update_goal_references(REF_TYPE_SHIP, Ships[ship].ship_name, name);
|
||||
update_texture_replacements(Ships[ship].ship_name, name);
|
||||
for (i=0; i<Num_reinforcements; i++)
|
||||
if (!stricmp(Ships[ship].ship_name, Reinforcements[i].name)) {
|
||||
strcpy(Reinforcements[i].name, name);
|
||||
@@ -2459,7 +2451,6 @@ int invalidate_references(char *name, int type)
|
||||
sprintf(new_name, "<%s>", name);
|
||||
update_sexp_references(name, new_name);
|
||||
ai_update_goal_references(type, name, new_name);
|
||||
update_texture_replacements(name, new_name);
|
||||
for (i=0; i<Num_reinforcements; i++)
|
||||
if (!stricmp(name, Reinforcements[i].name)) {
|
||||
strcpy(Reinforcements[i].name, new_name);
|
||||
@@ -3216,15 +3207,3 @@ void stuff_special_arrival_anchor_name(char *buf, int anchor_num, int retail_for
|
||||
// get name
|
||||
stuff_special_arrival_anchor_name(buf, iff_index, restrict_to_players, retail_format);
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
void update_texture_replacements(char *old_name, char *new_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Fred_num_texture_replacements; i++)
|
||||
{
|
||||
if (!stricmp(Fred_texture_replacements[i].ship_name, old_name))
|
||||
strcpy(Fred_texture_replacements[i].ship_name, new_name);
|
||||
}
|
||||
}
|
||||
@@ -324,9 +324,8 @@ extern int Fred_font;
|
||||
extern ai_goal_list Ai_goal_list[];
|
||||
extern int Ai_goal_list_size;
|
||||
|
||||
// alternate ship name and callsign stuff
|
||||
// alternate ship name stuff
|
||||
extern char Fred_alt_names[MAX_SHIPS][NAME_LENGTH+1];
|
||||
extern char Fred_callsigns[MAX_SHIPS][NAME_LENGTH+1];
|
||||
|
||||
extern int wing_objects[MAX_WINGS][MAX_SHIPS_PER_WING];
|
||||
|
||||
@@ -424,6 +423,5 @@ extern int wing_is_player_wing(int wing);
|
||||
extern void update_custom_wing_indexes();
|
||||
extern void stuff_special_arrival_anchor_name(char *buf, int iff_index, int restrict_to_players, int retail_format);
|
||||
extern void stuff_special_arrival_anchor_name(char *buf, int anchor_num, int retail_format);
|
||||
extern void update_texture_replacements(char *old_name, char *new_name);
|
||||
|
||||
#endif
|
||||
@@ -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);
|
||||
@@ -563,9 +558,9 @@ void CMissionNotesDlg::OnOK()
|
||||
|
||||
// set debriefing
|
||||
if ( m_no_debriefing ) {
|
||||
The_mission.flags |= MISSION_FLAG_TOGGLE_DEBRIEFING;
|
||||
The_mission.flags |= MISSION_FLAG_NO_DEBRIEFING;
|
||||
} else {
|
||||
The_mission.flags &= ~MISSION_FLAG_TOGGLE_DEBRIEFING;
|
||||
The_mission.flags &= ~MISSION_FLAG_NO_DEBRIEFING;
|
||||
}
|
||||
|
||||
// set autopilot cinematics
|
||||
@@ -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;
|
||||
@@ -673,7 +661,7 @@ BOOL CMissionNotesDlg::OnInitDialog()
|
||||
m_beam_free_all_by_default = (The_mission.flags & MISSION_FLAG_BEAM_FREE_ALL_BY_DEFAULT) ? 1 : 0;
|
||||
m_player_start_using_ai = (The_mission.flags & MISSION_FLAG_PLAYER_START_AI) ? 1 : 0;
|
||||
m_no_briefing = (The_mission.flags & MISSION_FLAG_NO_BRIEFING) ? 1 : 0;
|
||||
m_no_debriefing = (The_mission.flags & MISSION_FLAG_TOGGLE_DEBRIEFING) ? 1 : 0;
|
||||
m_no_debriefing = (The_mission.flags & MISSION_FLAG_NO_DEBRIEFING) ? 1 : 0;
|
||||
m_autpilot_cinematics = (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS) ? 1 : 0;
|
||||
m_2d_mission = (The_mission.flags & MISSION_FLAG_2D_MISSION) ? 1 : 0;
|
||||
m_no_autpilot = (The_mission.flags & MISSION_FLAG_DEACTIVATE_AP) ? 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 ){
|
||||
@@ -838,12 +804,8 @@ void CMissionNotesDlg::set_types()
|
||||
|
||||
void CMissionNotesDlg::OnSquadLogo()
|
||||
{
|
||||
CString pcx_filename;
|
||||
int z;
|
||||
char *Logo_ext = "Image Files (*.dds, *.pcx)|*.dds;*.pcx|"
|
||||
"DDS Files (*.dds)|*.dds|"
|
||||
"PCX Files (*.pcx)|*.pcx|"
|
||||
"All Files (*.*)|*.*|"
|
||||
"|";
|
||||
|
||||
//phreak 05/05/2003
|
||||
//this needs to be here or else the data in the mission notes dialog will revert
|
||||
@@ -852,7 +814,7 @@ void CMissionNotesDlg::OnSquadLogo()
|
||||
|
||||
// get list of squad images
|
||||
z = cfile_push_chdir(CF_TYPE_SQUAD_IMAGES);
|
||||
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Logo_ext);
|
||||
CFileDialog dlg(TRUE, "pcx", pcx_filename, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, "Pcx Files (*.pcx)|*.pcx");
|
||||
|
||||
// if we have a result
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
@@ -868,23 +830,24 @@ void CMissionNotesDlg::OnSquadLogo()
|
||||
}
|
||||
}
|
||||
|
||||
char *Load_screen_ext = "Image Files (*.dds, *.pcx, *.jpg, *.jpeg, *.tga)|*.dds;*.pcx;*.jpg;*.jpeg;*.tga|"
|
||||
char *Load_screen_ext = "Image Files (*.dds, *.pcx, *.jpg, *.tga)|*.dds;*.pcx;*.jpg;*.tga|"
|
||||
"DDS Files (*.dds)|*.dds|"
|
||||
"PCX Files (*.pcx)|*.pcx|"
|
||||
"JPG Files (*.jpg; *.jpeg)|*.jpg;*.jpeg|"
|
||||
"JPG Files (*.jpg)|*.jpg|"
|
||||
"TGA Files (*.tga)|*.tga|"
|
||||
"All Files (*.*)|*.*|"
|
||||
"|";
|
||||
|
||||
void CMissionNotesDlg::OnLoad1024()
|
||||
{
|
||||
CString filename;
|
||||
int z;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
// get list of
|
||||
z = cfile_push_chdir(CF_TYPE_DATA);
|
||||
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Load_screen_ext);
|
||||
CFileDialog dlg(TRUE, NULL, filename, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Load_screen_ext);
|
||||
|
||||
// if we have a result
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
@@ -902,13 +865,14 @@ void CMissionNotesDlg::OnLoad1024()
|
||||
|
||||
void CMissionNotesDlg::OnLoad640()
|
||||
{
|
||||
CString filename;
|
||||
int z;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
// get list of
|
||||
z = cfile_push_chdir(CF_TYPE_DATA);
|
||||
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Load_screen_ext);
|
||||
CFileDialog dlg(TRUE, NULL, filename, OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, Load_screen_ext);
|
||||
|
||||
// if we have a result
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ BOOL CModifyVariableDlg::OnInitDialog()
|
||||
|
||||
// initialize list -- Box is set to *not* sort
|
||||
for (i=0; i<MAX_SEXP_VARIABLES; i++) {
|
||||
if ((Sexp_variables[i].type & SEXP_VARIABLE_SET) && !(Sexp_variables[i].type & SEXP_VARIABLE_BLOCK)){
|
||||
if (Sexp_variables[i].type & SEXP_VARIABLE_SET) {
|
||||
box_index = cbox->AddString(Sexp_variables[i].variable_name);
|
||||
|
||||
// check no error
|
||||
|
||||
|
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
|
||||
@@ -633,7 +626,6 @@
|
||||
#define IDC_OBJECT3 1246
|
||||
#define IDC_MISSILE1 1246
|
||||
#define IDC_MESSAGE_TEAM 1246
|
||||
#define IDC_SHIP_CALLSIGN 1246
|
||||
#define IDC_COMBO6 1247
|
||||
#define IDC_BEHAVIOR3 1247
|
||||
#define IDC_MISSILE2 1247
|
||||
@@ -770,7 +762,6 @@
|
||||
#define IDC_LOADING_SCREEN1024 1344
|
||||
#define IDC_ABBREV_CAMPAIGN 1344
|
||||
#define IDC_TVT_WING_NAME_1 1344
|
||||
#define IDC_ASSIST_SCORE 1344
|
||||
#define IDC_EDIT4 1345
|
||||
#define IDC_AMMO4 1345
|
||||
#define IDC_VOICE 1345
|
||||
@@ -1084,7 +1075,6 @@
|
||||
#define IDC_SKYBOX_MODEL 1592
|
||||
#define IDC_ALT_AS_CALLSIGN 1593
|
||||
#define IDC_DEACTIVATE_AUTOPILOT 1594
|
||||
#define IDC_HIDE_SHIP_NAME 1594
|
||||
#define ID_FILE_MISSIONNOTES 32771
|
||||
#define ID_DUPLICATE 32774
|
||||
#define ID_VIEW_ROTATE 32775
|
||||
@@ -1362,8 +1352,6 @@
|
||||
#define ID_SHOW_IFF_7 33088
|
||||
#define ID_SHOW_IFF_8 33089
|
||||
#define ID_VIEW_FULL_DETAIL 33090
|
||||
#define ID_SAVEFORMAT_FS2OPEN 33091
|
||||
#define ID_FORMAT_FS2_OPEN_COMP 33092
|
||||
#define ID_INDICATOR_MODE 59142
|
||||
#define ID_INDICATOR_LEFT 59143
|
||||
#define ID_INDICATOR_RIGHT 59144
|
||||
@@ -1374,8 +1362,8 @@
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 317
|
||||
#define _APS_NEXT_COMMAND_VALUE 33093
|
||||
#define _APS_NEXT_RESOURCE_VALUE 292
|
||||
#define _APS_NEXT_COMMAND_VALUE 33091
|
||||
#define _APS_NEXT_CONTROL_VALUE 1595
|
||||
#define _APS_NEXT_SYMED_VALUE 105
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1543,11 +1542,6 @@ void sexp_tree::right_clicked(int mode)
|
||||
|
||||
for (int idx=0; idx<max_sexp_vars; idx++) {
|
||||
if (Sexp_variables[idx].type & SEXP_VARIABLE_SET) {
|
||||
// skip block variables
|
||||
if (Sexp_variables[idx].type & SEXP_VARIABLE_BLOCK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
UINT flag = MF_STRING | MF_GRAYED;
|
||||
// maybe gray flag MF_GRAYED
|
||||
|
||||
@@ -2216,7 +2210,7 @@ char *sexp_tree::match_closest_operator(char *str, int node)
|
||||
return str;
|
||||
|
||||
// determine which argument we are of the parent
|
||||
arg_num = find_argument_number(z, node);
|
||||
arg_num = find_argument_number(z, tree_nodes[z].child);
|
||||
|
||||
opf = query_operator_argument_type(op, arg_num); // check argument type at this position
|
||||
opr = query_operator_return_type(op);
|
||||
@@ -2404,7 +2398,8 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
Int3(); // unknown type
|
||||
}
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
// verify type in tree is same as type in Sexp_variables array
|
||||
if (type & SEXPT_NUMBER) {
|
||||
Assert(Sexp_variables[var_idx].type & SEXP_VARIABLE_NUMBER);
|
||||
@@ -3077,14 +3072,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
sprintf(str, "%d", temp);
|
||||
item->set_data_dup(str, (SEXPT_NUMBER | SEXPT_VALID));
|
||||
}
|
||||
else if ((Operators[op].value == OP_MODIFY_VARIABLE)) {
|
||||
if (get_modify_variable_type(index) == OPF_NUMBER) {
|
||||
item->set_data("0", (SEXPT_NUMBER | SEXPT_VALID));
|
||||
}
|
||||
else {
|
||||
item->set_data("<any data>", (SEXPT_STRING | SEXPT_VALID));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item->set_data("0", (SEXPT_NUMBER | SEXPT_VALID));
|
||||
@@ -3132,13 +3119,8 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
|
||||
str = "<name of ship here>";
|
||||
break;
|
||||
|
||||
case OPF_ORDER_RECIPIENT:
|
||||
str = "<all fighters>";
|
||||
break;
|
||||
|
||||
case OPF_SHIP_OR_NONE:
|
||||
case OPF_SUBSYSTEM_OR_NONE:
|
||||
case OPF_SHIP_WING_POINT_OR_NONE:
|
||||
str = SEXP_NONE_STRING;
|
||||
break;
|
||||
|
||||
@@ -3157,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;
|
||||
|
||||
@@ -3210,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;
|
||||
@@ -3282,8 +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_SHIP_WING_POINT_OR_NONE:
|
||||
case OPF_SUBSYS_OR_GENERIC:
|
||||
case OPF_BACKGROUND_BITMAP:
|
||||
case OPF_SUN_BITMAP:
|
||||
case OPF_NEBULA_STORM_TYPE:
|
||||
@@ -3292,21 +3267,10 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
return 1;
|
||||
|
||||
case OPF_SHIP:
|
||||
case OPF_SHIP_NOT_PLAYER:
|
||||
case OPF_SHIP_WING:
|
||||
case OPF_SHIP_POINT:
|
||||
case OPF_SHIP_WING_POINT:
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (ptr->type == OBJ_SHIP || ptr->type == OBJ_START)
|
||||
return 1;
|
||||
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
case OPF_SHIP_NOT_PLAYER:
|
||||
case OPF_ORDER_RECIPIENT:
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (ptr->type == OBJ_SHIP)
|
||||
@@ -3324,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)
|
||||
@@ -3857,45 +3815,16 @@ void sexp_tree::verify_and_fix_arguments(int node)
|
||||
char *text_ptr;
|
||||
char default_variable_text[TOKEN_LENGTH];
|
||||
if (tree_nodes[item_index].type & SEXPT_VARIABLE) {
|
||||
// special case for SEXPs which can modify a variable
|
||||
if ( (!stricmp(Operators[op].text, "modify-variable")) ||
|
||||
((!stricmp(Operators[op].text, "add-background-bitmap")) && (arg_num == 8)) ||
|
||||
((!stricmp(Operators[op].text, "add-sun-bitmap")) && (arg_num == 5)) ){
|
||||
// special case for modify-variable
|
||||
if ( !stricmp(Operators[op].text, "modify-variable") ||
|
||||
!stricmp(Operators[op].text, "add-background-bitmap") ||
|
||||
!stricmp(Operators[op].text, "add-sun-bitmap")) {
|
||||
// make text_ptr to start - before '('
|
||||
get_variable_name_from_sexp_tree_node_text(tree_nodes[item_index].text, default_variable_text);
|
||||
text_ptr = default_variable_text;
|
||||
} else {
|
||||
// only the type needs checking for variables. It's up the to the FREDder to ensure the value is valid
|
||||
get_variable_name_from_sexp_tree_node_text(tree_nodes[item_index].text, default_variable_text);
|
||||
int sexp_var_index = get_index_sexp_variable_name(default_variable_text);
|
||||
bool types_match = false;
|
||||
Assert(sexp_var_index != -1);
|
||||
|
||||
switch (type) {
|
||||
case OPF_NUMBER:
|
||||
case OPF_POSITIVE:
|
||||
if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_NUMBER) {
|
||||
types_match = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_STRING) {
|
||||
types_match = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (types_match) {
|
||||
// on to the next argument
|
||||
item_index = tree_nodes[item_index].next;
|
||||
arg_num++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
// shouldn't really be getting here unless someone has been hacking the mission in a text editor
|
||||
get_variable_default_text_from_variable_text(tree_nodes[item_index].text, default_variable_text);
|
||||
text_ptr = default_variable_text;
|
||||
}
|
||||
get_variable_default_text_from_variable_text(tree_nodes[item_index].text, default_variable_text);
|
||||
text_ptr = default_variable_text;
|
||||
}
|
||||
} else {
|
||||
text_ptr = tree_nodes[item_index].text;
|
||||
@@ -4312,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)
|
||||
@@ -4828,14 +4752,6 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
|
||||
list = get_listing_opf_ship_wing_point();
|
||||
break;
|
||||
|
||||
case OPF_SHIP_WING_POINT_OR_NONE:
|
||||
list = get_listing_opf_ship_wing_point_or_none();
|
||||
break;
|
||||
|
||||
case OPF_ORDER_RECIPIENT:
|
||||
list = get_listing_opf_order_recipient();
|
||||
break;
|
||||
|
||||
case OPF_SHIP_TYPE:
|
||||
list = get_listing_opf_ship_type();
|
||||
break;
|
||||
@@ -4900,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;
|
||||
@@ -4944,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;
|
||||
@@ -4958,24 +4866,23 @@ 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;
|
||||
}
|
||||
|
||||
// the special item is a string and should not be added for numeric lists
|
||||
if (opf != OPF_NUMBER && opf != OPF_POSITIVE) {
|
||||
head.add_data(SEXP_ARGUMENT_STRING);
|
||||
}
|
||||
|
||||
if (list != NULL) {
|
||||
// append other list
|
||||
head.add_list(list);
|
||||
}
|
||||
// add special item
|
||||
head.add_data(SEXP_ARGUMENT_STRING);
|
||||
|
||||
// append other list
|
||||
head.add_list(list);
|
||||
|
||||
// return listing
|
||||
return head.next;
|
||||
@@ -5039,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)
|
||||
@@ -5322,15 +5219,6 @@ sexp_list_item *sexp_tree::get_listing_opf_subsystem(int parent_node, int arg_in
|
||||
child = tree_nodes[child].next;
|
||||
break;
|
||||
|
||||
// this sexp checks the subsystem of the *fourth entry* on the list
|
||||
case OP_QUERY_ORDERS:
|
||||
child = tree_nodes[child].next;
|
||||
Assert(child >= 0);
|
||||
child = tree_nodes[child].next;
|
||||
Assert(child >= 0);
|
||||
child = tree_nodes[child].next;
|
||||
break;
|
||||
|
||||
// this sexp checks the subsystem of the *ninth entry* on the list
|
||||
case OP_WEAPON_CREATE:
|
||||
// iterate to the next field eight times
|
||||
@@ -5588,13 +5476,7 @@ sexp_list_item *sexp_tree::get_listing_opf_ai_goal(int parent_node)
|
||||
head.add_op(i);
|
||||
}
|
||||
}
|
||||
// when dealing with the special argument add them all. It's up to the FREDder to ensure invalid orders aren't given
|
||||
} else if (!strcmp(tree_nodes[child].text, SEXP_ARGUMENT_STRING)) {
|
||||
for (i=0; i<Num_operators; i++) {
|
||||
if (query_operator_return_type(i) == OPR_AI_GOAL) {
|
||||
head.add_op(i);
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
return NULL; // no valid ship or wing to check against, make nothing available
|
||||
}
|
||||
@@ -5669,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;
|
||||
@@ -5752,16 +5620,6 @@ sexp_list_item *sexp_tree::get_listing_opf_ship_wing_point()
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_ship_wing_point_or_none()
|
||||
{
|
||||
sexp_list_item head;
|
||||
|
||||
head.add_data(SEXP_NONE_STRING);
|
||||
head.add_list(get_listing_opf_ship_wing_point());
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_mission_name()
|
||||
{
|
||||
int i;
|
||||
@@ -5819,17 +5677,6 @@ sexp_list_item *sexp_tree::get_listing_opf_ship_wing()
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_order_recipient()
|
||||
{
|
||||
sexp_list_item head;
|
||||
|
||||
head.add_data("<all fighters>");
|
||||
|
||||
head.add_list(get_listing_opf_ship());
|
||||
head.add_list(get_listing_opf_wing());
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_ship_type()
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -6042,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;
|
||||
@@ -6093,7 +5929,7 @@ sexp_list_item *sexp_tree::get_listing_opf_background_bitmap()
|
||||
sexp_list_item head;
|
||||
int i;
|
||||
|
||||
for (i=0; i < stars_get_num_entries(false, true); i++)
|
||||
for (i=0; i < stars_get_num_bitmaps(); i++)
|
||||
{
|
||||
head.add_data( (char*)stars_get_name_FRED(i, false) );
|
||||
}
|
||||
@@ -6106,7 +5942,7 @@ sexp_list_item *sexp_tree::get_listing_opf_sun_bitmap()
|
||||
sexp_list_item head;
|
||||
int i;
|
||||
|
||||
for (i=0; i < stars_get_num_entries(true, true); i++)
|
||||
for (i=0; i < stars_get_num_suns(); i++)
|
||||
{
|
||||
head.add_data( (char*)stars_get_name_FRED(i, true) );
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -209,11 +210,9 @@ public:
|
||||
sexp_list_item *get_listing_opf_waypoint_path();
|
||||
sexp_list_item *get_listing_opf_ship_point();
|
||||
sexp_list_item *get_listing_opf_ship_wing_point();
|
||||
sexp_list_item *get_listing_opf_ship_wing_point_or_none();
|
||||
sexp_list_item *get_listing_opf_mission_name();
|
||||
sexp_list_item *get_listing_opf_goal_name(int parent_node);
|
||||
sexp_list_item *get_listing_opf_ship_wing();
|
||||
sexp_list_item *get_listing_opf_order_recipient();
|
||||
sexp_list_item *get_listing_opf_ship_type();
|
||||
sexp_list_item *get_listing_opf_keypress();
|
||||
sexp_list_item *get_listing_opf_event_name(int parent_node);
|
||||
@@ -248,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;
|
||||
|
||||
@@ -519,9 +519,6 @@ void CShipEditorDlg::DoDataExchange(CDataExchange* pDX)
|
||||
|
||||
GetDlgItem(IDC_SCORE)->GetWindowText(str);
|
||||
m_score.init(atoi(str));
|
||||
|
||||
GetDlgItem(IDC_ASSIST_SCORE)->GetWindowText(str);
|
||||
m_assist_score.init(atoi(str));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,7 +632,6 @@ BOOL CShipEditorDlg::Create()
|
||||
}
|
||||
|
||||
m_score.setup(IDC_SCORE, this);
|
||||
m_assist_score.setup(IDC_ASSIST_SCORE, this);
|
||||
m_arrival_dist.setup(IDC_ARRIVAL_DISTANCE, this);
|
||||
m_arrival_delay.setup(IDC_ARRIVAL_DELAY, this);
|
||||
m_departure_delay.setup(IDC_DEPARTURE_DELAY, this);
|
||||
@@ -910,7 +906,6 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
m_cargo1 = Cargo_names[cargo];
|
||||
m_hotkey = Ships[i].hotkey + 1;
|
||||
m_score.init(Ships[i].score);
|
||||
m_assist_score.init((int)(Ships[i].assist_score_pct*100));
|
||||
|
||||
m_persona = Ships[i].persona_index + 1;
|
||||
|
||||
@@ -944,7 +939,6 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
}
|
||||
|
||||
m_score.set(Ships[i].score);
|
||||
m_assist_score.set((int)(Ships[i].assist_score_pct*100));
|
||||
|
||||
if (Ships[i].hotkey != m_hotkey - 1){
|
||||
m_hotkey = -1;
|
||||
@@ -1049,7 +1043,6 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
m_cargo1 = _T("");
|
||||
m_hotkey = 0;
|
||||
m_score.blank(); // cause control to be blank
|
||||
m_assist_score.blank();
|
||||
m_arrival_location = -1;
|
||||
m_departure_location = -1;
|
||||
m_arrival_delay.blank();
|
||||
@@ -1134,7 +1127,6 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
}
|
||||
|
||||
m_score.display();
|
||||
m_assist_score.display();
|
||||
m_arrival_dist.display();
|
||||
m_arrival_delay.display();
|
||||
m_departure_delay.display();
|
||||
@@ -1258,7 +1250,6 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
GetDlgItem(IDC_DELETE_SHIP)->EnableWindow(enable);
|
||||
GetDlgItem(IDC_SHIP_RESET)->EnableWindow(enable);
|
||||
GetDlgItem(IDC_SCORE)->EnableWindow(enable);
|
||||
GetDlgItem(IDC_ASSIST_SCORE)->EnableWindow(enable);
|
||||
|
||||
//#ifndef NDEBUG
|
||||
GetDlgItem(IDC_SHIP_TBL)->EnableWindow(m_ship_class >= 0);
|
||||
@@ -1301,13 +1292,11 @@ void CShipEditorDlg::initialize_data(int full_update)
|
||||
SetWindowText("Edit Ship");
|
||||
}
|
||||
|
||||
// setup alternate name and callsign stuff
|
||||
// setup alternate name stuff
|
||||
if(player_ship >= 0){
|
||||
ship_alt_name_init(player_ship);
|
||||
ship_callsign_init(player_ship);
|
||||
} else {
|
||||
ship_alt_name_init(single_ship);
|
||||
ship_callsign_init(single_ship);
|
||||
}
|
||||
|
||||
modified = 0;
|
||||
@@ -1454,7 +1443,6 @@ int CShipEditorDlg::update_data(int redraw)
|
||||
if (stricmp(old_name, str)) {
|
||||
update_sexp_references(old_name, str);
|
||||
ai_update_goal_references(REF_TYPE_SHIP, old_name, str);
|
||||
update_texture_replacements(old_name, str);
|
||||
for (i=0; i<Num_reinforcements; i++)
|
||||
if (!stricmp(old_name, Reinforcements[i].name)) {
|
||||
Assert(strlen(str) < NAME_LENGTH);
|
||||
@@ -1500,7 +1488,6 @@ int CShipEditorDlg::update_ship(int ship)
|
||||
// THIS DIALOG IS THE SOME OF THE WORST CODE I HAVE EVER SEEN IN MY ENTIRE LIFE.
|
||||
// IT TOOK A RIDICULOUSLY LONG AMOUNT OF TIME TO ADD 2 FUNCTIONS. OMG
|
||||
ship_alt_name_close(ship);
|
||||
ship_callsign_close(ship);
|
||||
|
||||
if ((Ships[ship].ship_info_index != m_ship_class) && (m_ship_class != -1)) {
|
||||
change_ship_type(ship, m_ship_class);
|
||||
@@ -1531,20 +1518,6 @@ int CShipEditorDlg::update_ship(int ship)
|
||||
}
|
||||
|
||||
m_score.save(&Ships[ship].score);
|
||||
int temp_assist;
|
||||
m_assist_score.save(&temp_assist);
|
||||
Ships[ship].assist_score_pct = ((float)temp_assist)/100;
|
||||
// value must be a percentage
|
||||
if (Ships[ship].assist_score_pct < 0) {
|
||||
Ships[ship].assist_score_pct = 0;
|
||||
MessageBox("Assist Percentage too low. Set to 0. No score will be granted for an assist");
|
||||
}
|
||||
else if (Ships[ship].assist_score_pct > 1) {
|
||||
Ships[ship].assist_score_pct = 1;
|
||||
MessageBox("Assist Percentage too high. Set to 1. Assists well score as many points as a kill");
|
||||
|
||||
}
|
||||
|
||||
if (m_arrival_location != -1)
|
||||
MODIFY(Ships[ship].arrival_location, m_arrival_location);
|
||||
if (m_departure_location != -1)
|
||||
@@ -2348,6 +2321,7 @@ void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
if(cstr == CString("<none>")){
|
||||
// zero the entry
|
||||
strcpy(Fred_alt_names[base_ship], "");
|
||||
|
||||
return;
|
||||
}
|
||||
p = cstr.GetBuffer(0);
|
||||
@@ -2359,12 +2333,14 @@ void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
// otherwise see if it already exists
|
||||
if(mission_parse_lookup_alt(str) >= 0){
|
||||
strcpy(Fred_alt_names[base_ship], str);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise try and add it
|
||||
if(mission_parse_add_alt(str) >= 0){
|
||||
strcpy(Fred_alt_names[base_ship], str);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2373,90 +2349,6 @@ void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
MessageBox("Couldn't add new alternate type name. Already using too many!");
|
||||
}
|
||||
|
||||
// callsign stuff
|
||||
void CShipEditorDlg::ship_callsign_init(int base_ship)
|
||||
{
|
||||
int idx;
|
||||
CComboBox *ptr = (CComboBox*)GetDlgItem(IDC_SHIP_CALLSIGN);
|
||||
if(ptr == NULL){
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
// multi-edit. bah
|
||||
if(multi_edit){
|
||||
GetDlgItem(IDC_SHIP_CALLSIGN)->EnableWindow(FALSE);
|
||||
return;
|
||||
}
|
||||
GetDlgItem(IDC_SHIP_CALLSIGN)->EnableWindow(TRUE);
|
||||
|
||||
// reset the combobox and add all relevant strings
|
||||
ptr->ResetContent();
|
||||
ptr->AddString("<none>");
|
||||
for(idx=0; idx<Mission_callsign_count; idx++){
|
||||
ptr->AddString(Mission_callsigns[idx]);
|
||||
}
|
||||
|
||||
// "none"
|
||||
if(base_ship < 0){
|
||||
ptr->SetCurSel(0);
|
||||
}
|
||||
|
||||
// otherwise look his stuff up
|
||||
if(strlen(Fred_callsigns[base_ship])){
|
||||
ptr->SelectString(0, Fred_callsigns[base_ship]);
|
||||
} else {
|
||||
ptr->SetCurSel(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CShipEditorDlg::ship_callsign_close(int base_ship)
|
||||
{
|
||||
CString cstr;
|
||||
char str[NAME_LENGTH+2] = "";
|
||||
char *p;
|
||||
CComboBox *ptr = (CComboBox*)GetDlgItem(IDC_SHIP_CALLSIGN);
|
||||
|
||||
if(multi_edit){
|
||||
return;
|
||||
}
|
||||
|
||||
if(ptr == NULL){
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
// see if we have something besides "none" selected
|
||||
ptr->GetWindowText(cstr);
|
||||
if(cstr == CString("<none>")){
|
||||
// zero the entry
|
||||
strcpy(Fred_callsigns[base_ship], "");
|
||||
return;
|
||||
}
|
||||
p = cstr.GetBuffer(0);
|
||||
if(p == NULL){
|
||||
return;
|
||||
}
|
||||
strcpy(str, p);
|
||||
|
||||
// otherwise see if it already exists
|
||||
if(mission_parse_lookup_callsign(str) >= 0){
|
||||
strcpy(Fred_callsigns[base_ship], str);
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise try and add it
|
||||
if(mission_parse_add_callsign(str) >= 0){
|
||||
strcpy(Fred_callsigns[base_ship], str);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// bad - couldn't add
|
||||
strcpy(Fred_callsigns[base_ship], "");
|
||||
MessageBox("Couldn't add new callsign. Already using too many!");
|
||||
}
|
||||
|
||||
void CShipEditorDlg::OnTextures()
|
||||
{
|
||||
CShipTexturesDlg dlg_textures;
|
||||
|
||||
@@ -211,10 +211,6 @@ public:
|
||||
void ship_alt_name_init(int base_ship);
|
||||
void ship_alt_name_close(int base_ship);
|
||||
|
||||
// callsign stuff
|
||||
void ship_callsign_init(int base_ship);
|
||||
void ship_callsign_close(int base_ship);
|
||||
|
||||
BOOL Create();
|
||||
|
||||
// Dialog Data
|
||||
@@ -242,7 +238,6 @@ public:
|
||||
BOOL m_update_departure;
|
||||
numeric_edit_control m_destroy_value;
|
||||
numeric_edit_control m_score;
|
||||
numeric_edit_control m_assist_score;
|
||||
numeric_edit_control m_arrival_dist;
|
||||
numeric_edit_control m_kdamage;
|
||||
int m_arrival_target;
|
||||
|
||||
@@ -68,7 +68,7 @@ void ship_flags_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Control(pDX, IDC_FRIENDLY_STEALTH_INVISIBLE, m_friendly_stealth_invisible);
|
||||
DDX_Control(pDX, IDC_NAV_CARRY, m_nav_carry);
|
||||
DDX_Control(pDX, IDC_NAV_NEEDSLINK, m_nav_needslink);
|
||||
DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name);
|
||||
DDX_Control(pDX, IDC_ALT_AS_CALLSIGN, m_alt_as_callsign);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
if (pDX->m_bSaveAndValidate) { // get dialog control values
|
||||
@@ -124,7 +124,7 @@ BEGIN_MESSAGE_MAP(ship_flags_dlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_FRIENDLY_STEALTH_INVISIBLE, OnFriendlyStealthInvisible)
|
||||
ON_BN_CLICKED(IDC_NAV_CARRY, OnNavCarry)
|
||||
ON_BN_CLICKED(IDC_NAV_NEEDSLINK, OnNavNeedslink)
|
||||
ON_BN_CLICKED(IDC_HIDE_SHIP_NAME, OnHideShipName)
|
||||
ON_BN_CLICKED(IDC_ALT_AS_CALLSIGN, OnAltAsCallsign)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
@@ -145,7 +145,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0;
|
||||
int special_warp = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0;
|
||||
int no_death_scream = 0, always_death_scream = 0;
|
||||
int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0;
|
||||
int nav_carry = 0, nav_needslink = 0, alt_as_callsign = 0;
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
bool ship_in_wing = false;
|
||||
@@ -184,7 +184,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
friendly_stealth_invisible = (shipp->flags2 & SF2_FRIENDLY_STEALTH_INVIS) ? 1 : 0;
|
||||
nav_carry = (shipp->flags2 & SF2_NAVPOINT_CARRY) ? 1 : 0;
|
||||
nav_needslink = (shipp->flags2 & SF2_NAVPOINT_NEEDSLINK) ? 1 : 0;
|
||||
hide_ship_name = (shipp->flags2 & SF2_HIDE_SHIP_NAME) ? 1 : 0;
|
||||
alt_as_callsign = (shipp->flags2 & SF2_USE_ALT_NAME_AS_CALLSIGN) ? 1 : 0;
|
||||
|
||||
destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0;
|
||||
m_destroy_value.init(shipp->final_death_time);
|
||||
@@ -236,7 +236,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
friendly_stealth_invisible = tristate_set(shipp->flags2 & SF2_FRIENDLY_STEALTH_INVIS, friendly_stealth_invisible);
|
||||
nav_carry = tristate_set(shipp->flags2 & SF2_NAVPOINT_CARRY, nav_carry);
|
||||
nav_needslink = tristate_set(shipp->flags2 & SF2_NAVPOINT_NEEDSLINK, nav_needslink);
|
||||
hide_ship_name = tristate_set(shipp->flags2 & SF2_HIDE_SHIP_NAME, hide_ship_name);
|
||||
alt_as_callsign = tristate_set(shipp->flags2 & SF2_USE_ALT_NAME_AS_CALLSIGN, alt_as_callsign);
|
||||
|
||||
// check the final death time and set the internal variable according to whether or not
|
||||
// the final_death_time is set. Also, the value in the edit box must be set if all the
|
||||
@@ -302,7 +302,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
m_friendly_stealth_invisible.SetCheck(friendly_stealth_invisible);
|
||||
m_nav_carry.SetCheck(nav_carry);
|
||||
m_nav_needslink.SetCheck(nav_needslink);
|
||||
m_hide_ship_name.SetCheck(hide_ship_name);
|
||||
m_alt_as_callsign.SetCheck(alt_as_callsign);
|
||||
|
||||
m_kdamage.setup(IDC_KDAMAGE, this);
|
||||
m_destroy_value.setup(IDC_DESTROY_VALUE, this);
|
||||
@@ -779,19 +779,19 @@ void ship_flags_dlg::update_ship(int shipnum)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_hide_ship_name.GetCheck()) {
|
||||
switch (m_alt_as_callsign.GetCheck()) {
|
||||
case 1:
|
||||
if ( !(shipp->flags2 & SF2_HIDE_SHIP_NAME) )
|
||||
if ( !(shipp->flags2 & SF2_USE_ALT_NAME_AS_CALLSIGN) )
|
||||
set_modified();
|
||||
|
||||
shipp->flags2 |= SF2_HIDE_SHIP_NAME;
|
||||
shipp->flags2 |= SF2_USE_ALT_NAME_AS_CALLSIGN;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if ( shipp->flags2 & SF2_HIDE_SHIP_NAME )
|
||||
if ( shipp->flags2 & SF2_USE_ALT_NAME_AS_CALLSIGN )
|
||||
set_modified();
|
||||
|
||||
shipp->flags2 &= ~SF2_HIDE_SHIP_NAME;
|
||||
shipp->flags2 &= ~SF2_USE_ALT_NAME_AS_CALLSIGN;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1148,11 +1148,11 @@ void ship_flags_dlg::OnNavNeedslink()
|
||||
}
|
||||
}
|
||||
|
||||
void ship_flags_dlg::OnHideShipName()
|
||||
void ship_flags_dlg::OnAltAsCallsign()
|
||||
{
|
||||
if (m_hide_ship_name.GetCheck() == 1) {
|
||||
m_hide_ship_name.SetCheck(0);
|
||||
if (m_alt_as_callsign.GetCheck() == 1) {
|
||||
m_alt_as_callsign.SetCheck(0);
|
||||
} else {
|
||||
m_hide_ship_name.SetCheck(1);
|
||||
m_alt_as_callsign.SetCheck(1);
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
CButton m_friendly_stealth_invisible;
|
||||
CButton m_nav_carry;
|
||||
CButton m_nav_needslink;
|
||||
CButton m_hide_ship_name;
|
||||
CButton m_alt_as_callsign;
|
||||
CSpinButtonCtrl m_destroy_spin;
|
||||
numeric_edit_control m_kdamage;
|
||||
numeric_edit_control m_destroy_value;
|
||||
@@ -109,7 +109,6 @@ protected:
|
||||
afx_msg void OnNavCarry();
|
||||
afx_msg void OnNavNeedslink();
|
||||
afx_msg void OnAltAsCallsign();
|
||||
afx_msg void OnHideShipName();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
|
||||
@@ -299,25 +299,25 @@ void ShipGoalsDlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_CBIndex(pDX, IDC_OBJECT10, m_object[9]);
|
||||
|
||||
DDX_Text(pDX, IDC_PRIORITY1, m_priority[0]);
|
||||
DDV_MinMaxInt(pDX, m_priority[0], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[0], 0, 89);
|
||||
DDX_Text(pDX, IDC_PRIORITY2, m_priority[1]);
|
||||
DDV_MinMaxInt(pDX, m_priority[1], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[1], 0, 89);
|
||||
DDX_Text(pDX, IDC_PRIORITY3, m_priority[2]);
|
||||
DDV_MinMaxInt(pDX, m_priority[2], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[2], 0, 89);
|
||||
DDX_Text(pDX, IDC_PRIORITY4, m_priority[3]);
|
||||
DDV_MinMaxInt(pDX, m_priority[3], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[3], 0, 89);
|
||||
DDX_Text(pDX, IDC_PRIORITY5, m_priority[4]);
|
||||
DDV_MinMaxInt(pDX, m_priority[4], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[4], 0, 89);
|
||||
DDX_Text(pDX, IDC_PRIORITY6, m_priority[5]);
|
||||
DDV_MinMaxInt(pDX, m_priority[5], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[5], 0, 89);
|
||||
DDX_Text(pDX, IDC_PRIORITY7, m_priority[6]);
|
||||
DDV_MinMaxInt(pDX, m_priority[6], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[6], 0, 89);
|
||||
DDX_Text(pDX, IDC_PRIORITY8, m_priority[7]);
|
||||
DDV_MinMaxInt(pDX, m_priority[7], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[7], 0, 89);
|
||||
DDX_Text(pDX, IDC_PRIORITY9, m_priority[8]);
|
||||
DDV_MinMaxInt(pDX, m_priority[8], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[8], 0, 89);
|
||||
DDX_Text(pDX, IDC_PRIORITY10, m_priority[9]);
|
||||
DDV_MinMaxInt(pDX, m_priority[9], 0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
DDV_MinMaxInt(pDX, m_priority[9], 0, 89);
|
||||
|
||||
DDX_CBIndex(pDX, IDC_SUBSYSTEM1, m_subsys[0]);
|
||||
DDX_CBIndex(pDX, IDC_SUBSYSTEM2, m_subsys[1]);
|
||||
@@ -464,7 +464,7 @@ BOOL ShipGoalsDlg::OnInitDialog()
|
||||
} else { // editing orders for all marked ships
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)){
|
||||
if ((ptr->type == OBJ_SHIP) && (ptr->flags & OF_MARKED)){
|
||||
for (i=0; i<Ai_goal_list_size; i++){
|
||||
if (!ai_query_goal_valid(ptr->instance, Ai_goal_list[i].def)){
|
||||
valid[i] = 0;
|
||||
@@ -541,17 +541,17 @@ BOOL ShipGoalsDlg::OnInitDialog()
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// restrict spin controls to a range of 0 - MAX_EDITOR_GOAL_PRIORITY
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN1)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN2)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN3)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN4)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN5)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN6)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN7)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN8)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN9)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN10)) -> SetRange(0, MAX_EDITOR_GOAL_PRIORITY);
|
||||
// restrict spin controls to a range of 0 - 89
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN1)) -> SetRange(0, 89);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN2)) -> SetRange(0, 89);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN3)) -> SetRange(0, 89);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN4)) -> SetRange(0, 89);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN5)) -> SetRange(0, 89);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN6)) -> SetRange(0, 89);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN7)) -> SetRange(0, 89);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN8)) -> SetRange(0, 89);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN9)) -> SetRange(0, 89);
|
||||
((CSpinButtonCtrl *) GetDlgItem(IDC_SPIN10)) -> SetRange(0, 89);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -568,7 +568,7 @@ void ShipGoalsDlg::initialize_multi()
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
|
||||
if ((ptr->type == OBJ_SHIP) && (ptr->flags & OF_MARKED)) {
|
||||
initialize(Ai_info[Ships[ptr->instance].ai_index].goals, ptr->instance);
|
||||
if (!flag) {
|
||||
flag = 1;
|
||||
@@ -637,7 +637,7 @@ void ShipGoalsDlg::initialize(ai_goal *goals, int ship)
|
||||
mode = goalp[item].ai_mode;
|
||||
}
|
||||
|
||||
if (m_priority[item] < 0 || m_priority[item] > MAX_EDITOR_GOAL_PRIORITY){
|
||||
if (m_priority[item] < 0 || m_priority[item] > 89){
|
||||
m_priority[item] = 50;
|
||||
}
|
||||
|
||||
@@ -862,7 +862,7 @@ void ShipGoalsDlg::set_item(int item, int init)
|
||||
case AI_GOAL_STAY_STILL:
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if ((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) {
|
||||
if (ptr->type == OBJ_SHIP || ptr->type == OBJ_START) {
|
||||
inst = ptr->instance;
|
||||
if (ptr->type == OBJ_SHIP)
|
||||
t = TYPE_SHIP;
|
||||
@@ -1044,7 +1044,7 @@ void ShipGoalsDlg::update()
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
|
||||
if ((ptr->type == OBJ_SHIP) && (ptr->flags & OF_MARKED)) {
|
||||
goalp = Ai_info[Ships[ptr->instance].ai_index].goals;
|
||||
for (i=0; i<ED_MAX_GOALS; i++)
|
||||
update_item(i, 1);
|
||||
@@ -1055,7 +1055,7 @@ void ShipGoalsDlg::update()
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
|
||||
if ((ptr->type == OBJ_SHIP) && (ptr->flags & OF_MARKED)) {
|
||||
self_ship = ptr->instance;
|
||||
goalp = Ai_info[Ships[self_ship].ai_index].goals;
|
||||
verify_orders(self_ship);
|
||||
|
||||