mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 17:52:08 -10:00
Compare commits
78
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbbb4f96ac | ||
|
|
3b7ae521a9 | ||
|
|
54aaad33a3 | ||
|
|
cc80807f13 | ||
|
|
a351c7b721 | ||
|
|
1ebb04d419 | ||
|
|
d51e897ead | ||
|
|
06c355ddf0 | ||
|
|
8bb6f7f68e | ||
|
|
5b8176bb4b | ||
|
|
80cce2377c | ||
|
|
e0c9583a3b | ||
|
|
0cf3e4b408 | ||
|
|
d06b09dfd2 | ||
|
|
7151887f2e | ||
|
|
3fd955efe5 | ||
|
|
6c65202e9e | ||
|
|
2f2d33dae9 | ||
|
|
f2283dc4f3 | ||
|
|
b92dd314df | ||
|
|
cdbae474e0 | ||
|
|
c4eafa628f | ||
|
|
b8282cf074 | ||
|
|
8517ec180c | ||
|
|
1d345eb946 | ||
|
|
e981522f8a | ||
|
|
1ad8ae9b1c | ||
|
|
f67f6fb331 | ||
|
|
9627408f3a | ||
|
|
8f667bcfce | ||
|
|
6fff633d64 | ||
|
|
66c1c6b9d3 | ||
|
|
135e12df6a | ||
|
|
ff71992449 | ||
|
|
bd8a44c273 | ||
|
|
5f884aea5e | ||
|
|
c6adace344 | ||
|
|
27e6a4ca7a | ||
|
|
d516b8495e | ||
|
|
1f55d2499f | ||
|
|
8b72e3fb3b | ||
|
|
db9c33ce71 | ||
|
|
c3141364b2 | ||
|
|
c0730d572f | ||
|
|
dd0230d33b | ||
|
|
ab7663889e | ||
|
|
0461fe36c5 | ||
|
|
d09cfc624a | ||
|
|
1907fe08f8 | ||
|
|
4b11575f3f | ||
|
|
9c31fc6749 | ||
|
|
c6e3495605 | ||
|
|
4e06e5d033 | ||
|
|
a1d7d9a7d8 | ||
|
|
5591189a46 | ||
|
|
1e9d9326f7 | ||
|
|
76ce3e3a2b | ||
|
|
0f4d46a997 | ||
|
|
e151e54d9e | ||
|
|
f31301db4c | ||
|
|
930e50fa9d | ||
|
|
aad2cc2842 | ||
|
|
fba51c734f | ||
|
|
9d5a177d1a | ||
|
|
fcab17c9ea | ||
|
|
4ce7e50ad7 | ||
|
|
21cd34df25 | ||
|
|
ccfffdf5bd | ||
|
|
e18022b96a | ||
|
|
a68f03eedc | ||
|
|
e4a8b212ab | ||
|
|
d2d3585a8c | ||
|
|
1992c48b80 | ||
|
|
5aa587ad8d | ||
|
|
d30416cb51 | ||
|
|
0cf1863c22 | ||
|
|
991ca99a42 | ||
|
|
443d1671fb |
No files matched your search
+18
-25
@@ -189,12 +189,9 @@ AM_CXXFLAGS = @D_CFLAGS@ @FS2_CXXFLAGS@
|
||||
AM_LDFLAGS = @D_LDFLAGS@ @FS2_LDFLAGS@
|
||||
|
||||
noinst_LIBRARIES = libcode.a
|
||||
bin_PROGRAMS = @FS2_BINARY@
|
||||
noinst_PROGRAMS = @FS2_BINARY@
|
||||
|
||||
EXTRA_PROGRAMS = fs2_open_@PACKAGE_VERSION@ fs2_open_@PACKAGE_VERSION@_NOINF \
|
||||
fs2_open_@PACKAGE_VERSION@_DEBUG fs2_open_@PACKAGE_VERSION@_NOINF_DEBUG \
|
||||
wxFRED2_@PACKAGE_VERSION@ wxFRED2_@PACKAGE_VERSION@_NOINF \
|
||||
wxFRED2_@PACKAGE_VERSION@_DEBUG wxFRED2_@PACKAGE_VERSION@_NOINF_DEBUG
|
||||
EXTRA_PROGRAMS = fs2_open_r fs2_open_d wxFRED2_r wxFRED2_d fs2_open_INF_r fs2_open_INF_d wxFRED2_INF_r wxFRED2_INF_d
|
||||
|
||||
###############################################################################
|
||||
##
|
||||
@@ -482,8 +479,6 @@ FS2_SOURCES = \
|
||||
missionui/missionweaponchoice.h \
|
||||
missionui/redalert.cpp \
|
||||
missionui/redalert.h \
|
||||
mod_table/mod_table.cpp \
|
||||
mod_table/mod_table.h \
|
||||
model/model.h \
|
||||
model/modelanim.cpp \
|
||||
model/modelanim.h \
|
||||
@@ -586,8 +581,6 @@ FS2_SOURCES = \
|
||||
palman/palman.h \
|
||||
parse/encrypt.cpp \
|
||||
parse/encrypt.h \
|
||||
parse/generic_log.cpp \
|
||||
parse/generic_log.h \
|
||||
parse/lua.cpp \
|
||||
parse/lua.h \
|
||||
parse/parselo.cpp \
|
||||
@@ -798,22 +791,22 @@ FS2OPEN_SOURCES = \
|
||||
freespace2/levelpaging.cpp \
|
||||
freespace2/levelpaging.h
|
||||
|
||||
fs2_open_@PACKAGE_VERSION@_DEBUG_SOURCES = \
|
||||
fs2_open_d_SOURCES = \
|
||||
${FS2OPEN_SOURCES}
|
||||
|
||||
fs2_open_@PACKAGE_VERSION@_SOURCES = \
|
||||
fs2_open_r_SOURCES = \
|
||||
${FS2OPEN_SOURCES}
|
||||
|
||||
fs2_open_@PACKAGE_VERSION@_NOINF_DEBUG_SOURCES = \
|
||||
fs2_open_INF_d_SOURCES = \
|
||||
${FS2OPEN_SOURCES}
|
||||
|
||||
fs2_open_@PACKAGE_VERSION@_NOINF_SOURCES = \
|
||||
fs2_open_INF_r_SOURCES = \
|
||||
${FS2OPEN_SOURCES}
|
||||
|
||||
fs2_open_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a
|
||||
fs2_open_@PACKAGE_VERSION@_LDADD = libcode.a
|
||||
fs2_open_@PACKAGE_VERSION@_NOINF_DEBUG_LDADD = libcode.a
|
||||
fs2_open_@PACKAGE_VERSION@_NOINF_LDADD = libcode.a
|
||||
fs2_open_d_LDADD = libcode.a
|
||||
fs2_open_r_LDADD = libcode.a
|
||||
fs2_open_INF_d_LDADD = libcode.a
|
||||
fs2_open_INF_r_LDADD = libcode.a
|
||||
|
||||
##
|
||||
## End MAIN binary
|
||||
@@ -833,22 +826,22 @@ wxFRED_SOURCES = \
|
||||
wxfred2/wxfred_xrc.cpp \
|
||||
wxfred2/wxfred_xrc.h
|
||||
|
||||
wxFRED2_@PACKAGE_VERSION@_DEBUG_SOURCES = \
|
||||
wxFRED2_d_SOURCES = \
|
||||
${wxFRED_SOURCES}
|
||||
|
||||
wxFRED2_@PACKAGE_VERSION@_SOURCES = \
|
||||
wxFRED2_r_SOURCES = \
|
||||
${wxFRED_SOURCES}
|
||||
|
||||
wxFRED2_@PACKAGE_VERSION@_NOINF_DEBUG_SOURCES = \
|
||||
wxFRED2_INF_d_SOURCES = \
|
||||
${wxFRED_SOURCES}
|
||||
|
||||
wxFRED2_@PACKAGE_VERSION@_NOINF_SOURCES = \
|
||||
wxFRED2_INF_r_SOURCES = \
|
||||
${wxFRED_SOURCES}
|
||||
|
||||
wxFRED2_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a
|
||||
wxFRED2_@PACKAGE_VERSION@_LDADD = libcode.a
|
||||
wxFRED2_@PACKAGE_VERSION@_NOINF_DEBUG_LDADD = libcode.a
|
||||
wxFRED2_@PACKAGE_VERSION@_NOINF_LDADD = libcode.a
|
||||
wxFRED2_d_LDADD = libcode.a
|
||||
wxFRED2_r_LDADD = libcode.a
|
||||
wxFRED2_INF_d_LDADD = libcode.a
|
||||
wxFRED2_INF_r_LDADD = libcode.a
|
||||
|
||||
##
|
||||
## End wxFRED2 binary
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ void set_wingnum(int objnum, int wingnum)
|
||||
Ai_info[ai_index].wing = wingnum;
|
||||
}
|
||||
|
||||
char *ai_get_goal_target_name(const char *name, int *index)
|
||||
char *ai_get_goal_target_name(char *name, int *index)
|
||||
{
|
||||
Assert(name != NULL);
|
||||
Assert(index != NULL);
|
||||
|
||||
+1
-10
@@ -26,15 +26,6 @@ struct ship_info;
|
||||
|
||||
#define AI_DEFAULT_CLASS 3 // default AI class for new ships (Fred)
|
||||
|
||||
typedef struct ai_flag_name {
|
||||
int flag;
|
||||
char flag_name[TOKEN_LENGTH];
|
||||
int flag_list;
|
||||
} ai_flag_name;
|
||||
|
||||
#define MAX_AI_FLAG_NAMES 1
|
||||
extern ai_flag_name Ai_flag_names[];
|
||||
|
||||
#define AIF_FORMATION_WING (1 << 0) // Fly in formation as part of wing.
|
||||
#define AIF_AWAITING_REPAIR (1 << 1) // Awaiting a repair ship.
|
||||
#define AIF_BEING_REPAIRED (1 << 2) // Currently docked with repair ship.
|
||||
@@ -613,7 +604,7 @@ void ai_process( object * obj, int ai_index, float frametime );
|
||||
int get_wingnum(int objnum);
|
||||
|
||||
void set_wingnum(int objnum, int wingnum);
|
||||
char *ai_get_goal_target_name(const char *name, int *index);
|
||||
char *ai_get_goal_target_name(char *name, int *index);
|
||||
|
||||
extern void init_ai_system(void);
|
||||
extern void ai_attack_object(object *attacker, object *attacked, ship_subsys *ssp);
|
||||
|
||||
+31
-41
@@ -205,7 +205,7 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
if (optional_string("$AI Maybe Links Energy Weapons:"))
|
||||
parse_float_list(profile->link_energy_levels_maybe, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Missles Locked on Player:") || optional_string("$Max Missiles Locked on Player:"))
|
||||
if (optional_string("$Max Missles Locked on Player:"))
|
||||
parse_int_list(profile->max_allowed_player_homers, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Player Attackers:"))
|
||||
@@ -232,6 +232,9 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
profile->predict_position_delay[iLoop] = fl2f(temp_list[iLoop]);
|
||||
}
|
||||
|
||||
if (optional_string("$Player Shield Recharge Scale:"))
|
||||
parse_float_list(profile->shield_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Shield Manage Delay:") || optional_string("$AI Shield Manage Delays:"))
|
||||
parse_float_list(profile->shield_manage_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
@@ -247,6 +250,9 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
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);
|
||||
|
||||
if (optional_string("$AI Turn Time Scale:"))
|
||||
parse_float_list(profile->turn_time_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
@@ -308,9 +314,6 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
if (optional_string("$Stalemate Distance Threshold:"))
|
||||
parse_float_list(profile->stalemate_dist_thresh, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Shield Recharge Scale:"))
|
||||
parse_float_list(profile->shield_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Weapon Recharge Scale:"))
|
||||
parse_float_list(profile->weapon_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
@@ -431,7 +434,7 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
|
||||
set_flag(profile, "$no extra collision avoidance vs player:", AIPF2_NO_SPECIAL_PLAYER_AVOID, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$perform fewer checks for death screams:", AIPF2_PERFORM_FEWER_SCREAM_CHECKS, AIP_FLAG2);
|
||||
set_flag(profile, "$perform less checks for death screams:", AIPF2_PERFORM_LESS_SCREAM_CHECKS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$advanced turret fov edge checks:", AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS, AIP_FLAG2);
|
||||
|
||||
@@ -441,16 +444,12 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
|
||||
set_flag(profile, "$ai aims from ship center:", AIPF2_AI_AIMS_FROM_SHIP_CENTER, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$allow primary link at mission start:", AIPF2_ALLOW_PRIMARY_LINK_AT_START, AIP_FLAG2);
|
||||
set_flag(profile, "$allow primary link delay:", AIPF2_ALLOW_PRIMARY_LINK_DELAY, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$allow beams to damage bombs:", AIPF2_BEAMS_DAMAGE_WEAPONS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$disable weapon damage scaling for player:", AIPF2_PLAYER_WEAPON_SCALE_FIX, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$countermeasures affect aspect seekers:", AIPF2_ASPECT_LOCK_COUNTERMEASURE, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$ai guards specific ship in wing:", AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING, AIP_FLAG2);
|
||||
|
||||
profile->ai_path_mode = AI_PATH_MODE_NORMAL;
|
||||
if(optional_string("$ai path mode:"))
|
||||
{
|
||||
@@ -463,42 +462,33 @@ void parse_ai_profiles_tbl(char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Default weapon select effect:")) {
|
||||
char effect[NAME_LENGTH];
|
||||
stuff_string(effect, F_NAME, NAME_LENGTH);
|
||||
if (!stricmp(effect, "FS1"))
|
||||
Default_weapon_select_effect = 1;
|
||||
if (!stricmp(effect, "off"))
|
||||
Default_weapon_select_effect = 0;
|
||||
}
|
||||
|
||||
if (optional_string("$Default ship select effect:")) {
|
||||
char effect[NAME_LENGTH];
|
||||
stuff_string(effect, F_NAME, NAME_LENGTH);
|
||||
if (!stricmp(effect, "FS1"))
|
||||
Default_ship_select_effect = 1;
|
||||
if (!stricmp(effect, "off"))
|
||||
Default_ship_select_effect = 0;
|
||||
}
|
||||
|
||||
set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$fix ai path order bug:", AIPF2_FIX_AI_PATH_ORDER_BUG, AIP_FLAG2);
|
||||
|
||||
// ----------
|
||||
|
||||
// compatibility
|
||||
if (optional_string("$perform less checks for death screams:"))
|
||||
{
|
||||
mprintf(("Warning: \"$perform less checks for death screams\" flag is deprecated in favor of \"$perform fewer checks for death screams\"\n"));
|
||||
bool temp;
|
||||
stuff_boolean(&temp);
|
||||
if (temp)
|
||||
profile->flags2 |= AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
|
||||
else
|
||||
profile->flags2 &= ~AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
|
||||
}
|
||||
if (optional_string("$allow primary link delay:"))
|
||||
{
|
||||
mprintf(("Warning: \"$allow primary link delay\" flag is deprecated in favor of \"$allow primary link at mission start\"\n"));
|
||||
bool temp;
|
||||
stuff_boolean(&temp);
|
||||
if (temp)
|
||||
profile->flags2 &= ~AIPF2_ALLOW_PRIMARY_LINK_AT_START;
|
||||
else
|
||||
profile->flags2 |= AIPF2_ALLOW_PRIMARY_LINK_AT_START;
|
||||
}
|
||||
|
||||
|
||||
// if we've been through once already and are at the same place, force a move
|
||||
if ( saved_Mp && (saved_Mp == Mp) )
|
||||
{
|
||||
char tmp[60];
|
||||
memset(tmp, 0, 60);
|
||||
strncpy(tmp, Mp, 59);
|
||||
mprintf(("WARNING: Unrecognized parameter in ai_profiles: %s\n", tmp));
|
||||
char buf[60];
|
||||
memset(buf, 0, 60);
|
||||
strncpy(buf, Mp, 59);
|
||||
mprintf(("WARNING: Unrecognized parameter in ai_profiles: %s\n", buf));
|
||||
|
||||
Mp++;
|
||||
}
|
||||
|
||||
@@ -53,18 +53,15 @@
|
||||
// flags2
|
||||
#define AIPF2_TURRETS_IGNORE_TARGET_RADIUS (1 << 0)
|
||||
#define AIPF2_NO_SPECIAL_PLAYER_AVOID (1 << 1)
|
||||
#define AIPF2_PERFORM_FEWER_SCREAM_CHECKS (1 << 2)
|
||||
#define AIPF2_PERFORM_LESS_SCREAM_CHECKS (1 << 2)
|
||||
#define AIPF2_ALL_SHIPS_MANAGE_SHIELDS (1 << 3)
|
||||
#define AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS (1 << 4)
|
||||
#define AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV (1 << 5)
|
||||
#define AIPF2_AI_AIMS_FROM_SHIP_CENTER (1 << 6)
|
||||
#define AIPF2_ALLOW_PRIMARY_LINK_AT_START (1 << 7)
|
||||
#define AIPF2_ALLOW_PRIMARY_LINK_DELAY (1 << 7)
|
||||
#define AIPF2_BEAMS_DAMAGE_WEAPONS (1 << 8)
|
||||
#define AIPF2_PLAYER_WEAPON_SCALE_FIX (1 << 9)
|
||||
#define AIPF2_NO_WARP_CAMERA (1 << 10)
|
||||
#define AIPF2_ASPECT_LOCK_COUNTERMEASURE (1 << 11)
|
||||
#define AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING (1 << 12)
|
||||
#define AIPF2_FIX_AI_PATH_ORDER_BUG (1 << 13)
|
||||
|
||||
// AI Path types
|
||||
#define AI_PATH_MODE_NORMAL 0
|
||||
|
||||
+52
-54
@@ -20,7 +20,6 @@
|
||||
#include "mission/missionparse.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "ai/aigoals.h"
|
||||
|
||||
|
||||
|
||||
@@ -117,6 +116,8 @@ void ai_bpap(object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec,
|
||||
if (num_tries > octp->nverts)
|
||||
num_tries = octp->nverts;
|
||||
|
||||
int best_index = -1;
|
||||
|
||||
for (i=0; i<num_tries; i++) {
|
||||
int index;
|
||||
float dist, dot;
|
||||
@@ -141,6 +142,7 @@ void ai_bpap(object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec,
|
||||
|
||||
if (in_fov) {
|
||||
if (dist < nearest_dist) {
|
||||
best_index = index;
|
||||
nearest_dist = dist;
|
||||
best_point = result_point;
|
||||
*local_attack_point = rel_point;
|
||||
@@ -722,75 +724,71 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
|
||||
if (En_objp->phys_info.speed * dist_to_enemy < 5000.0f) // Don't select a bomb if enemy moving fast relative to distance
|
||||
priority1 = WIF_BOMB;
|
||||
|
||||
if (!(En_objp->flags & OF_PROTECTED) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
|
||||
if (!(En_objp->flags & OF_PROTECTED)) {
|
||||
//ai_select_secondary_weapon(Pl_objp, tswp, priority1, priority2); // Note, need to select to get weapon speed and lifetime
|
||||
if(aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) {
|
||||
priority1 = WIF_PUNCTURE;
|
||||
}
|
||||
|
||||
ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
|
||||
int current_bank = tswp->current_secondary_bank;
|
||||
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
|
||||
|
||||
if(!(En_objp->flags & OF_PROTECTED) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
|
||||
// If ship is protected and very low on hits, don't fire missiles.
|
||||
if ((current_bank > -1) && (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage))) {
|
||||
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
|
||||
if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
|
||||
}
|
||||
// If ship is protected and very low on hits, don't fire missiles.
|
||||
if ((current_bank > -1) && (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage))) {
|
||||
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
|
||||
if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
|
||||
}
|
||||
}
|
||||
|
||||
if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
|
||||
float firing_range;
|
||||
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
firing_range=swip->lssm_lock_range;
|
||||
else
|
||||
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
|
||||
// reduce firing range of secondaries in nebula
|
||||
extern int Nebula_sec_range;
|
||||
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
|
||||
firing_range *= 0.8f;
|
||||
}
|
||||
|
||||
if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
|
||||
float firing_range;
|
||||
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
firing_range=swip->lssm_lock_range;
|
||||
else
|
||||
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
|
||||
// reduce firing range of secondaries in nebula
|
||||
extern int Nebula_sec_range;
|
||||
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
|
||||
firing_range *= 0.8f;
|
||||
}
|
||||
float t = 0.25f; // default delay in seconds until next fire.
|
||||
|
||||
float t = 0.25f; // default delay in seconds until next fire.
|
||||
|
||||
if (dist_to_enemy < firing_range*1.0f) {
|
||||
if (dist_to_enemy < firing_range*1.0f) {
|
||||
|
||||
|
||||
//vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed);
|
||||
//if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) {
|
||||
if (ai_fire_secondary_weapon(Pl_objp)) {
|
||||
if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) {
|
||||
if (swip->burst_shots > swp->burst_counter[current_bank]) {
|
||||
t = swip->burst_delay;
|
||||
swp->burst_counter[current_bank]++;
|
||||
} else {
|
||||
t = swip->fire_wait;
|
||||
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
|
||||
swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
|
||||
} else {
|
||||
swp->burst_counter[current_bank] = 0;
|
||||
}
|
||||
}
|
||||
//vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed);
|
||||
//if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) {
|
||||
if (ai_fire_secondary_weapon(Pl_objp)) {
|
||||
if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) {
|
||||
if (swip->burst_shots > swp->burst_counter[current_bank]) {
|
||||
t = swip->burst_delay;
|
||||
swp->burst_counter[current_bank]++;
|
||||
} else {
|
||||
if (swip->burst_shots > swp->burst_counter[current_bank]) {
|
||||
t = set_secondary_fire_delay(aip, temp_shipp, swip, true);
|
||||
swp->burst_counter[current_bank]++;
|
||||
t = swip->fire_wait;
|
||||
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
|
||||
swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
|
||||
} else {
|
||||
t = set_secondary_fire_delay(aip, temp_shipp, swip, false);
|
||||
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
|
||||
swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
|
||||
} else {
|
||||
swp->burst_counter[current_bank] = 0;
|
||||
}
|
||||
swp->burst_counter[current_bank] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (swip->burst_shots > swp->burst_counter[current_bank]) {
|
||||
t = set_secondary_fire_delay(aip, temp_shipp, swip, true);
|
||||
swp->burst_counter[current_bank]++;
|
||||
} else {
|
||||
t = set_secondary_fire_delay(aip, temp_shipp, swip, false);
|
||||
if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
|
||||
swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
|
||||
} else {
|
||||
swp->burst_counter[current_bank] = 0;
|
||||
}
|
||||
}
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
|
||||
}
|
||||
//}
|
||||
}
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
|
||||
}
|
||||
//}
|
||||
}
|
||||
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+181
-144
@@ -32,7 +32,6 @@
|
||||
#include "ai/aigoals.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "mission/missionmessage.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "cmeasure/cmeasure.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "ship/afterburner.h"
|
||||
@@ -195,11 +194,6 @@ int AI_FrameCount = 0;
|
||||
int AI_watch_object = 0; // Debugging, object to spew debug info for.
|
||||
int Mission_all_attack = 0; // !0 means all teams attack all teams.
|
||||
|
||||
// Constant for flag, Name of flag, In flags or flags2
|
||||
ai_flag_name Ai_flag_names[] = {
|
||||
{AIF_NO_DYNAMIC, "no-dynamic", 1, },
|
||||
};
|
||||
|
||||
char *Skill_level_names(int level, int translate)
|
||||
{
|
||||
char *str = NULL;
|
||||
@@ -1039,12 +1033,16 @@ float compute_dots(object *objp, object *other_objp, float *to_dot, float *from_
|
||||
*/
|
||||
void update_ai_stealth_info_with_error(ai_info *aip)
|
||||
{
|
||||
object *ship;
|
||||
object *stealth_objp;
|
||||
|
||||
// make sure I am targeting a stealth ship
|
||||
Assert( is_object_stealth_ship(&Objects[aip->target_objnum]) );
|
||||
stealth_objp = &Objects[aip->target_objnum];
|
||||
|
||||
// my_ship
|
||||
ship = &Objects[Ships[aip->shipnum].objnum];
|
||||
|
||||
// if update is due to weapon fire, get exact stealth position
|
||||
aip->stealth_last_pos = stealth_objp->pos;
|
||||
aip->stealth_velocity = stealth_objp->phys_info.vel;
|
||||
@@ -1834,7 +1832,28 @@ int is_ignore_object(ai_info *aip, int objnum, int just_the_original = 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a ship with bounding box and a point, find the closest point on the bbox
|
||||
*/
|
||||
int get_nearest_bbox_point(object *ship_obj, vec3d *start, vec3d *box_pt)
|
||||
{
|
||||
vec3d temp, rf_start;
|
||||
polymodel *pm;
|
||||
pm = model_get(Ship_info[Ships[ship_obj->instance].ship_info_index].model_num);
|
||||
|
||||
// get start in ship rf
|
||||
vm_vec_sub(&temp, start, &ship_obj->pos);
|
||||
vm_vec_rotate(&rf_start, &temp, &ship_obj->orient);
|
||||
|
||||
// find box_pt
|
||||
int inside = project_point_onto_bbox(&pm->mins, &pm->maxs, &rf_start, &temp);
|
||||
|
||||
// get box_pt in world rf
|
||||
vm_vec_unrotate(box_pt, &temp, &ship_obj->orient);
|
||||
vm_vec_add2(box_pt, &ship_obj->pos);
|
||||
|
||||
return inside;
|
||||
}
|
||||
|
||||
|
||||
typedef struct eval_nearest_objnum {
|
||||
@@ -2029,11 +2048,14 @@ int find_nearby_threat(int objnum, int enemy_team_mask, float range, int *count)
|
||||
int nearest_objnum;
|
||||
float nearest_dist;
|
||||
object *objp;
|
||||
ai_info *aip;
|
||||
ship_obj *so;
|
||||
|
||||
nearest_objnum = -1;
|
||||
nearest_dist = range;
|
||||
|
||||
aip = &Ai_info[Ships[Objects[objnum].instance].ai_index];
|
||||
|
||||
*count = 0;
|
||||
|
||||
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
|
||||
@@ -3673,12 +3695,12 @@ float ai_path_0()
|
||||
{
|
||||
polymodel *pm;
|
||||
int num_paths, num_points;
|
||||
float dot, dist_to_goal, dist_to_next, dot_to_next;
|
||||
float dot, dist_to_goal, dist_to_next, speed, dot_to_next;
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
ai_info *aip;
|
||||
vec3d nvel_vec;
|
||||
float mag;
|
||||
float mag, prev_dot_to_goal;
|
||||
vec3d temp_vec, *slop_vec;
|
||||
object *gobjp;
|
||||
ship *gshipp;
|
||||
@@ -3753,6 +3775,8 @@ float ai_path_0()
|
||||
gcvp = *cvp;
|
||||
gnvp = *nvp;
|
||||
|
||||
speed = Pl_objp->phys_info.speed;
|
||||
|
||||
dist_to_goal = vm_vec_dist_quick(&Pl_objp->pos, &gcvp);
|
||||
dist_to_next = vm_vec_dist_quick(&Pl_objp->pos, &gnvp);
|
||||
// Can't use fvec, need to use velocity vector because we aren't necessarily
|
||||
@@ -3783,6 +3807,7 @@ float ai_path_0()
|
||||
|
||||
// Code to control speed is MUCH less forgiving in path following than in waypoint
|
||||
// following. Must be very close to path or might hit objects.
|
||||
prev_dot_to_goal = aip->prev_dot_to_goal;
|
||||
dot = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gcvp);
|
||||
dot_to_next = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gnvp);
|
||||
|
||||
@@ -3805,7 +3830,7 @@ float ai_path_0()
|
||||
min_dist_to_goal = MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius;
|
||||
|
||||
if ( (vm_vec_dist_quick(&Pl_objp->pos, &gcvp) < min_dist_to_goal) ||
|
||||
(((r >= 0.0f) && (r <= 1.0f)) && (vm_vec_dist_quick(&nearest_point, &gcvp) < (MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius)))) {
|
||||
((r >= 0.0f) && (r <= 1.0f)) && (vm_vec_dist_quick(&nearest_point, &gcvp) < (MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius))) {
|
||||
aip->path_cur += aip->path_dir;
|
||||
if (((aip->path_cur - aip->path_start) > (num_points+1)) || (aip->path_cur < aip->path_start)) {
|
||||
Assert(aip->mode != AIM_DOCK); // If docking, should never get this far, getting to last point handled outside ai_path()
|
||||
@@ -3824,12 +3849,12 @@ float ai_path_1()
|
||||
{
|
||||
polymodel *pm;
|
||||
int num_paths, num_points;
|
||||
float dot, dist_to_goal, dist_to_next, dot_to_next;
|
||||
float dot, dist_to_goal, dist_to_next, speed, dot_to_next;
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
ai_info *aip;
|
||||
vec3d nvel_vec;
|
||||
float mag;
|
||||
float mag, prev_dot_to_goal;
|
||||
object *gobjp;
|
||||
ship *gshipp;
|
||||
vec3d *pvp, *cvp, *nvp, next_vec, gpvp, gcvp, gnvp; // previous, current and next vertices in global coordinates.
|
||||
@@ -3894,6 +3919,8 @@ float ai_path_1()
|
||||
gcvp = *cvp;
|
||||
gnvp = *nvp;
|
||||
|
||||
speed = Pl_objp->phys_info.speed;
|
||||
|
||||
dist_to_goal = vm_vec_dist_quick(&Pl_objp->pos, &gcvp);
|
||||
dist_to_next = vm_vec_dist_quick(&Pl_objp->pos, &gnvp);
|
||||
|
||||
@@ -3938,6 +3965,7 @@ float ai_path_1()
|
||||
|
||||
// Code to control speed is MUCH less forgiving in path following than in waypoint
|
||||
// following. Must be very close to path or might hit objects.
|
||||
prev_dot_to_goal = aip->prev_dot_to_goal;
|
||||
dot = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gcvp);
|
||||
dot_to_next = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gnvp);
|
||||
|
||||
@@ -3979,7 +4007,7 @@ float ai_path_1()
|
||||
}
|
||||
|
||||
if ( (vm_vec_dist_quick(&Pl_objp->pos, &gcvp) < min_dist_to_goal) ||
|
||||
(((r >= 0.0f) && (r <= 1.0f)) && (vm_vec_dist_quick(&nearest_point, &gcvp) < (MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius)))) {
|
||||
((r >= 0.0f) && (r <= 1.0f)) && (vm_vec_dist_quick(&nearest_point, &gcvp) < (MIN_DIST_TO_WAYPOINT_GOAL + Pl_objp->radius))) {
|
||||
aip->path_cur += aip->path_dir;
|
||||
if (((aip->path_cur - aip->path_start) > (num_points+1)) || (aip->path_cur < aip->path_start)) {
|
||||
Assert(aip->mode != AIM_DOCK); // If docking, should never get this far, getting to last point handled outside ai_path()
|
||||
@@ -4153,7 +4181,7 @@ void ai_safety()
|
||||
// valid if Pl_done_p was not NULL and was set true by function.
|
||||
void ai_fly_to_target_position(vec3d* target_pos, bool* pl_done_p=NULL, bool* pl_treat_as_ship_p=NULL)
|
||||
{
|
||||
float dot, dist_to_goal;
|
||||
float dot, dist_to_goal, speed;
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
ai_info *aip;
|
||||
@@ -4181,6 +4209,8 @@ void ai_fly_to_target_position(vec3d* target_pos, bool* pl_done_p=NULL, bool* pl
|
||||
aip->mode = AIM_NONE;
|
||||
}
|
||||
|
||||
speed = Pl_objp->phys_info.speed;
|
||||
|
||||
dist_to_goal = vm_vec_dist_quick(&Pl_objp->pos, target_pos);
|
||||
|
||||
// Can't use fvec, need to use velocity vector because we aren't necessarily
|
||||
@@ -4754,12 +4784,11 @@ void evade_weapon()
|
||||
locked_weapon_objp = &Objects[aip->nearest_locked_object];
|
||||
}
|
||||
|
||||
if (aip->danger_weapon_objnum != -1) {
|
||||
if (aip->danger_weapon_objnum != -1)
|
||||
if (Objects[aip->danger_weapon_objnum].signature == aip->danger_weapon_signature)
|
||||
unlocked_weapon_objp = &Objects[aip->danger_weapon_objnum];
|
||||
else
|
||||
aip->danger_weapon_objnum = -1; // Signatures don't match, so no longer endangered.
|
||||
}
|
||||
|
||||
if (locked_weapon_objp != NULL) {
|
||||
if (unlocked_weapon_objp != NULL) {
|
||||
@@ -4821,7 +4850,7 @@ void evade_weapon()
|
||||
rdot = vm_vec_dot(&Pl_objp->orient.vec.rvec, &vec_from_enemy);
|
||||
udot = vm_vec_dot(&Pl_objp->orient.vec.uvec, &vec_from_enemy);
|
||||
|
||||
if (aip->ai_profile_flags & AIPF_ALLOW_VERTICAL_DODGE && fl_abs(udot) > fl_abs(rdot))
|
||||
if (aip->ai_profile_flags & AIPF_ALLOW_VERTICAL_DODGE && abs(udot) > abs(rdot))
|
||||
{
|
||||
if ((udot < -0.5f) || (udot > 0.5f))
|
||||
vm_vec_scale_add(&goal_point, &Pl_objp->pos, &Pl_objp->orient.vec.uvec, -200.0f);
|
||||
@@ -4859,7 +4888,7 @@ void slide_face_ship()
|
||||
return;
|
||||
|
||||
vec3d goal_pos;
|
||||
float dot_from_enemy;
|
||||
float dot_from_enemy, dot_to_enemy;
|
||||
vec3d vec_from_enemy, vec_to_goal;
|
||||
float dist;
|
||||
float up, right;
|
||||
@@ -4872,6 +4901,7 @@ void slide_face_ship()
|
||||
ai_turn_towards_vector(&En_objp->pos, Pl_objp, flFrametime, sip->srotation_time, NULL, NULL, 0.0f, 0);
|
||||
|
||||
dot_from_enemy = vm_vec_dot(&vec_from_enemy, &En_objp->orient.vec.fvec);
|
||||
dot_to_enemy = -vm_vec_dot(&vec_from_enemy, &Pl_objp->orient.vec.fvec);
|
||||
|
||||
if (vm_vec_dot(&vec_from_enemy, &En_objp->orient.vec.rvec) > 0.0f)
|
||||
right = 1.0f;
|
||||
@@ -5056,9 +5086,12 @@ int ai_select_primary_weapon_OLD(object *objp, object *other_objp, int flags)
|
||||
{
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
ship_weapon *swp = &shipp->weapons;
|
||||
ship_info *sip;
|
||||
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
|
||||
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
if (flags & WIF_PUNCTURE) {
|
||||
if (swp->current_primary_bank >= 0) {
|
||||
int bank_index;
|
||||
@@ -5130,6 +5163,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
// Pointer Set Up
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
ship_weapon *swp = &shipp->weapons;
|
||||
ship_info *sip;
|
||||
|
||||
// Debugging
|
||||
if (other_objp==NULL)
|
||||
@@ -5148,6 +5182,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
|
||||
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
|
||||
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
//made it so it only selects puncture weapons if the active goal is to disable something -Bobboau
|
||||
if ((flags & WIF_PUNCTURE) && (Ai_info[shipp->ai_index].goals[0].ai_mode & (AI_GOAL_DISARM_SHIP | AI_GOAL_DISABLE_SHIP)))
|
||||
{
|
||||
@@ -5381,7 +5416,7 @@ void set_primary_weapon_linkage(object *objp)
|
||||
}
|
||||
|
||||
// Don't want all ships always linking weapons at start, so asynchronize.
|
||||
if (!(The_mission.ai_profile->flags2 & AIPF2_ALLOW_PRIMARY_LINK_AT_START))
|
||||
if (The_mission.ai_profile->flags2 & AIPF2_ALLOW_PRIMARY_LINK_DELAY)
|
||||
{
|
||||
if (Missiontime < i2f(30))
|
||||
return;
|
||||
@@ -5459,11 +5494,12 @@ int ai_fire_primary_weapon(object *objp)
|
||||
{
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
ship_weapon *swp = &shipp->weapons;
|
||||
ship_info *enemy_sip;
|
||||
ship_info *sip, *enemy_sip;
|
||||
ai_info *aip;
|
||||
object *enemy_objp;
|
||||
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
aip = &Ai_info[shipp->ai_index];
|
||||
|
||||
@@ -5527,10 +5563,9 @@ int ai_fire_primary_weapon(object *objp)
|
||||
vm_vec_normalized_dir(&vecToTarget, &enemy_objp->pos, &objp->pos);
|
||||
float dotToTarget = vm_vec_dot(&vecToTarget, &objp->orient.vec.fvec);
|
||||
dotToTarget = pow(dotToTarget, 4); //This makes the dot a tiny bit more impactful (otherwise nearly always over 0.98 or so)
|
||||
float fof_spread_cooldown_factor = 1.0f - swp->primary_bank_fof_cooldown[swp->current_primary_bank];
|
||||
|
||||
//Combine factors
|
||||
float burstFireProb = ((0.6f * percentAmmoLeft) + (0.4f * distanceFactor)) * dotToTarget * aip->ai_primary_ammo_burst_mult * fof_spread_cooldown_factor;
|
||||
float burstFireProb = ((0.6f * percentAmmoLeft) + (0.4f * distanceFactor)) * dotToTarget * aip->ai_primary_ammo_burst_mult;
|
||||
|
||||
//Possibly change values every half-second
|
||||
if (static_randf((Missiontime + static_rand(aip->shipnum)) >> 15) > burstFireProb)
|
||||
@@ -5878,6 +5913,7 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2)
|
||||
{
|
||||
ship_weapon *swp;
|
||||
ship *shipp;
|
||||
ship_info *sip;
|
||||
int current_bank;
|
||||
int rval = 0;
|
||||
|
||||
@@ -5892,6 +5928,7 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2)
|
||||
swp = &shipp->weapons;
|
||||
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
// Select secondary weapon.
|
||||
current_bank = swp->current_secondary_bank; //ai_select_secondary_weapon(objp, swp, priority1, priority2);
|
||||
@@ -6649,8 +6686,10 @@ int will_collide_with_big_ship_all(object *objp, object *ignore_objp, vec3d *goa
|
||||
object *big_objp;
|
||||
int collision_obj_index = -1;
|
||||
float min_dist = 999999.9f;
|
||||
float collision_time = -1.0f;
|
||||
|
||||
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
|
||||
float time = 0.0f;
|
||||
big_objp = &Objects[so->objnum];
|
||||
|
||||
if (big_objp == ignore_objp)
|
||||
@@ -6667,6 +6706,7 @@ int will_collide_with_big_ship_all(object *objp, object *ignore_objp, vec3d *goa
|
||||
if (cur_dist < min_dist) {
|
||||
min_dist = cur_dist;
|
||||
*collision_point = cur_collision_point;
|
||||
collision_time = time;
|
||||
collision_obj_index = OBJ_INDEX(big_objp);
|
||||
}
|
||||
}
|
||||
@@ -7345,9 +7385,9 @@ void ai_set_guard_object(object *objp, object *other_objp)
|
||||
aip = &Ai_info[shipp->ai_index];
|
||||
aip->avoid_check_timestamp = timestamp(1);
|
||||
|
||||
// If ship to guard is in a wing, guard that whole wing, unless the appropriate flag has been set
|
||||
// If ship to guard is in a wing, guard that whole wing.
|
||||
ai_info *other_aip = &Ai_info[Ships[other_objp->instance].ai_index];
|
||||
if ((other_aip->wing != -1) && (other_aip->wing != aip->wing) && !(The_mission.ai_profile->flags2 & AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING)) {
|
||||
if ((other_aip->wing != -1) && (other_aip->wing != aip->wing)) {
|
||||
ai_set_guard_wing(objp, Ai_info[Ships[other_objp->instance].ai_index].wing);
|
||||
} else {
|
||||
|
||||
@@ -7415,9 +7455,9 @@ void update_aspect_lock_information(ai_info *aip, vec3d *vec_to_enemy, float dis
|
||||
float needed_dot = 0.9f - 0.5f * enemy_radius/(dist_to_enemy + enemy_radius); // Replaced MIN_TRACKABLE_DOT with 0.9f
|
||||
if (dot_to_enemy > needed_dot &&
|
||||
(wip->wi_flags & WIF_HOMING_ASPECT ||
|
||||
(wip->wi_flags & WIF_HOMING_JAVELIN &&
|
||||
wip->wi_flags & WIF_HOMING_JAVELIN &&
|
||||
(tshpp == NULL ||
|
||||
ship_get_closest_subsys_in_sight(tshpp, SUBSYSTEM_ENGINE, &aiobjp->pos))))) {
|
||||
ship_get_closest_subsys_in_sight(tshpp, SUBSYSTEM_ENGINE, &aiobjp->pos)))) {
|
||||
aip->aspect_locked_time += flFrametime;
|
||||
if (aip->aspect_locked_time >= wip->min_lock_time) {
|
||||
aip->aspect_locked_time = wip->min_lock_time;
|
||||
@@ -7639,7 +7679,7 @@ void ai_chase_big_circle_set_goal(vec3d *goal_pos, object *attack_objp, object *
|
||||
*/
|
||||
void ai_chase_big_get_separations(object *attack_objp, object *target_objp, vec3d *horz_vec_to_target, float *desired_separation, float *cur_separation)
|
||||
{
|
||||
float temp, r_target, r_attacker;
|
||||
float temp, r_target, r_attacker, h_attacker, h_target;
|
||||
float perp_dist;
|
||||
vec3d vec_to_target;
|
||||
|
||||
@@ -7650,11 +7690,13 @@ void ai_chase_big_get_separations(object *attack_objp, object *target_objp, vec3
|
||||
temp = MAX(pm->maxs.xyz.x, pm->maxs.xyz.y);
|
||||
r_attacker = MAX(-pm->mins.xyz.x, -pm->mins.xyz.y);
|
||||
r_attacker = MAX(temp, r_attacker);
|
||||
h_attacker = MAX(-pm->mins.xyz.z, pm->maxs.xyz.z);
|
||||
|
||||
// get radius of target (for rotations about forward)
|
||||
temp = MAX(pm->maxs.xyz.x, pm->maxs.xyz.y);
|
||||
r_target = MAX(-pm->mins.xyz.x, -pm->mins.xyz.y);
|
||||
r_target = MAX(temp, r_target);
|
||||
h_target = MAX(-pm->mins.xyz.z, pm->maxs.xyz.z);
|
||||
|
||||
// find separation between cylinders [if parallel]
|
||||
vm_vec_sub(&vec_to_target, &attack_objp->pos, &target_objp->pos);
|
||||
@@ -7673,7 +7715,7 @@ void ai_chase_big_get_separations(object *attack_objp, object *target_objp, vec3
|
||||
void ai_chase_big_parallel_set_goal(vec3d *goal_pos, object *attack_objp, object *target_objp, float *accel)
|
||||
{
|
||||
int opposing;
|
||||
float temp, r_target, r_attacker;
|
||||
float temp, r_target, r_attacker, h_attacker, h_target;
|
||||
float separation, optimal_separation;
|
||||
vec3d horz_vec_to_target;
|
||||
|
||||
@@ -7684,11 +7726,13 @@ void ai_chase_big_parallel_set_goal(vec3d *goal_pos, object *attack_objp, object
|
||||
temp = MAX(pm->maxs.xyz.x, pm->maxs.xyz.y);
|
||||
r_attacker = MAX(-pm->mins.xyz.x, -pm->mins.xyz.y);
|
||||
r_attacker = MAX(temp, r_attacker);
|
||||
h_attacker = MAX(-pm->mins.xyz.z, pm->maxs.xyz.z);
|
||||
|
||||
// get radius of target (for rotations about forward)
|
||||
temp = MAX(pm->maxs.xyz.x, pm->maxs.xyz.y);
|
||||
r_target = MAX(-pm->mins.xyz.x, -pm->mins.xyz.y);
|
||||
r_target = MAX(temp, r_target);
|
||||
h_target = MAX(-pm->mins.xyz.z, pm->maxs.xyz.z);
|
||||
|
||||
// are we opposing (only when other ship is not moving)
|
||||
opposing = ( vm_vec_dotprod(&attack_objp->orient.vec.fvec, &target_objp->orient.vec.fvec) < 0 );
|
||||
@@ -7799,8 +7843,10 @@ void ai_cruiser_chase()
|
||||
}
|
||||
|
||||
ship *eshipp;
|
||||
ship_info *esip;
|
||||
|
||||
eshipp = &Ships[En_objp->instance];
|
||||
esip = &Ship_info[eshipp->ship_info_index];
|
||||
|
||||
vec3d goal_pos;
|
||||
float turn_time = Ship_info[Ships[Pl_objp->instance].ship_info_index].srotation_time;
|
||||
@@ -8049,7 +8095,7 @@ void ai_chase()
|
||||
}
|
||||
|
||||
// Can only acquire lock on a target that isn't hidden from sensors
|
||||
if ( En_objp->type == OBJ_SHIP && !(Ships[En_objp->instance].flags & SF_HIDDEN_FROM_SENSORS) && !is_stealthy_ship ) {
|
||||
if ( !(Ships[En_objp->instance].flags & SF_HIDDEN_FROM_SENSORS) && !is_stealthy_ship ) {
|
||||
update_aspect_lock_information(aip, &real_vec_to_enemy, dist_to_enemy, En_objp->radius);
|
||||
} else {
|
||||
aip->current_target_is_locked = 0;
|
||||
@@ -8406,14 +8452,13 @@ void ai_chase()
|
||||
case SM_AVOID:
|
||||
if ((dot_to_enemy > -0.2f) && (dist_to_enemy / (dot_to_enemy + 0.3f) < 100.0f)) {
|
||||
aip->submode_start_time = Missiontime;
|
||||
} else if (Missiontime - aip->submode_start_time > i2f(1)/2) {
|
||||
} else if (Missiontime - aip->submode_start_time > i2f(1)/2)
|
||||
if (might_collide_with_ship(Pl_objp, En_objp, dot_to_enemy, dist_to_enemy, 3.0f)) {
|
||||
aip->submode_start_time = Missiontime;
|
||||
} else {
|
||||
aip->submode = SM_GET_BEHIND;
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -9140,7 +9185,7 @@ int num_ships_attacking(int target_objnum)
|
||||
ai_info *attacking_aip;
|
||||
ship_obj *so;
|
||||
int count = 0;
|
||||
int target_team = obj_team(&Objects[target_objnum]);
|
||||
int target_team = Ships[Objects[target_objnum].instance].team;
|
||||
|
||||
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) )
|
||||
{
|
||||
@@ -9151,6 +9196,7 @@ int num_ships_attacking(int target_objnum)
|
||||
attacking_aip = &Ai_info[Ships[attacking_objp->instance].ai_index];
|
||||
|
||||
// don't count instructor
|
||||
int is_training_mission();
|
||||
if (is_training_mission() && is_instructor(attacking_objp))
|
||||
continue; // Goober5000 10/06/2005 changed from break
|
||||
|
||||
@@ -9636,7 +9682,7 @@ void ai_big_guard()
|
||||
// how often to choose new desired_z
|
||||
// 1*(64) sec < 2000, 2*(64) < 2-4000 3*(64) > 4-8000, etc (Missiontime >> 22 is 64 sec intervals)
|
||||
int time_choose = int(floor(log(length * 0.001f) / log(2.0f)));
|
||||
float desired_z = min_z + length * static_randf( (Pl_objp-Objects) ^ (Missiontime >> (22 + time_choose)) );
|
||||
float desired_z = min_z + length * static_randf( Pl_objp-Objects ^ (Missiontime >> (22 + time_choose)) );
|
||||
|
||||
// get r from guard_ship
|
||||
float cur_guard_rad = vm_vec_dist(&Pl_objp->pos, &axis_pt);
|
||||
@@ -9752,7 +9798,8 @@ void ai_guard()
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
ai_info *aip = &Ai_info[shipp->ai_index];
|
||||
object *guard_objp;
|
||||
float dist_to_guardobj;
|
||||
ship *gshipp;
|
||||
float dist_to_guardobj, dot_to_guardobj;
|
||||
vec3d vec_to_guardobj;
|
||||
|
||||
if (aip->guard_objnum == -1) {
|
||||
@@ -9788,6 +9835,8 @@ void ai_guard()
|
||||
return;
|
||||
}
|
||||
|
||||
gshipp = &Ships[guard_objp->instance];
|
||||
|
||||
float objval;
|
||||
vec3d goal_point;
|
||||
vec3d rel_vec;
|
||||
@@ -9802,6 +9851,7 @@ void ai_guard()
|
||||
case AIS_GUARD_PATROL:
|
||||
// Stay near ship
|
||||
dist_to_guardobj = vm_vec_normalized_dir(&vec_to_guardobj, &guard_objp->pos, &Pl_objp->pos);
|
||||
dot_to_guardobj = vm_vec_dot(&Pl_objp->orient.vec.fvec, &vec_to_guardobj);
|
||||
|
||||
rel_vec = aip->guard_vec;
|
||||
vm_vec_add(&goal_point, &guard_objp->pos, &rel_vec);
|
||||
@@ -10056,12 +10106,14 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp,
|
||||
Int3(); // bogus type of repair info
|
||||
}
|
||||
|
||||
if (repair_objp){
|
||||
Ai_info[Ships[repair_objp->instance].ai_index].warp_out_timestamp = stamp;
|
||||
}
|
||||
|
||||
// repair_objp might be NULL is we are cleaning up this mode because of the support ship
|
||||
// getting killed.
|
||||
if ( repair_objp ) {
|
||||
Ai_info[Ships[repair_objp->instance].ai_index].warp_out_timestamp = stamp;
|
||||
aip = &Ai_info[Ships[repair_objp->instance].ai_index];
|
||||
|
||||
switch ( how ) {
|
||||
case REPAIR_INFO_ONWAY:
|
||||
Assert( repaired_objp != NULL );
|
||||
@@ -10165,6 +10217,13 @@ void ai_cleanup_dock_mode_subjective(object *objp)
|
||||
// if the object is in dock mode, force them to near last stage
|
||||
if ( (aip->mode == AIM_DOCK) && (aip->submode < AIS_UNDOCK_3) )
|
||||
{
|
||||
// get the active goal
|
||||
ai_goal *aigp;
|
||||
if (aip->active_goal >= 0)
|
||||
aigp = &aip->goals[aip->active_goal];
|
||||
else
|
||||
aigp = NULL;
|
||||
|
||||
// get the object being acted upon
|
||||
object *goal_objp;
|
||||
ship *goal_shipp;
|
||||
@@ -10573,7 +10632,6 @@ void ai_dock()
|
||||
case AIS_DOCK_4A:
|
||||
{
|
||||
if (aigp == NULL) { // Can happen for initially docked ships.
|
||||
// this now "just sits here" for docked ships
|
||||
ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] ); // do the default behavior
|
||||
} else {
|
||||
mission_log_add_entry(LOG_SHIP_DOCKED, shipp->ship_name, goal_shipp->ship_name);
|
||||
@@ -10714,9 +10772,11 @@ void ai_dock()
|
||||
case AIS_UNDOCK_2:
|
||||
{
|
||||
float dist;
|
||||
ai_info *other_aip;
|
||||
|
||||
// get pointer to docked object's aip to reset flags, etc
|
||||
Assert( aip->goal_objnum != -1 );
|
||||
other_aip = &Ai_info[goal_shipp->ai_index];
|
||||
|
||||
// Second stage of undocking.
|
||||
dist = dock_orient_and_approach(Pl_objp, docker_index, goal_objp, dockee_index, DOA_UNDOCK_2);
|
||||
@@ -10867,8 +10927,8 @@ void process_subobjects(int objnum)
|
||||
for ( pss = GET_FIRST(&shipp->subsys_list); pss !=END_OF_LIST(&shipp->subsys_list); pss = GET_NEXT(pss) ) {
|
||||
psub = pss->system_info;
|
||||
|
||||
// Don't process destroyed objects (but allow subobjects with hitpoints disabled -nuke) (but also process subobjects that are allowed to rotate)
|
||||
if (pss->max_hits > 0 && pss->current_hits <= 0.0f && !(psub->flags2 & MSS_FLAG2_DESTROYED_ROTATION))
|
||||
// Don't process destroyed objects (but allow subobjects with hitpoints disabled -nuke)
|
||||
if (pss->max_hits > 0 && pss->current_hits <= 0.0f )
|
||||
continue;
|
||||
|
||||
switch (psub->type) {
|
||||
@@ -10942,16 +11002,13 @@ void process_subobjects(int objnum)
|
||||
// Karajorma - if Player_use_ai is ever fixed to work on multiplayer it should be checked that any player ships
|
||||
// aren't under AI control here
|
||||
if ( (!(objp->flags & OF_PLAYER_SHIP) ) && (sip->flags & (SIF_FIGHTER | SIF_BOMBER)) && !(shipp->flags & SF_DYING) ) {
|
||||
// Goober5000 - don't do anything if docked
|
||||
if (!object_is_docked(objp)) {
|
||||
// AL: Only attack forever if not trying to depart to a docking bay. Need to have this in, since
|
||||
// a ship may get repaired... and it should still try to depart. Since docking bay departures
|
||||
// are not handled as goals, we don't want to leave the AIM_BAY_DEPART mode.
|
||||
if ( aip->mode != AIM_BAY_DEPART ) {
|
||||
ai_attack_object(objp, NULL, NULL); // Regardless of current mode, enter attack mode.
|
||||
aip->submode = SM_ATTACK_FOREVER; // Never leave attack submode, don't avoid, evade, etc.
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
// AL: Only attack forever if not trying to depart to a docking bay. Need to have this in, since
|
||||
// a ship may get repaired... and it should still try to depart. Since docking bay departures
|
||||
// are not handled as goals, we don't want to leave the AIM_BAY_DEPART mode.
|
||||
if ( aip->mode != AIM_BAY_DEPART ) {
|
||||
ai_attack_object(objp, NULL, NULL); // Regardless of current mode, enter attack mode.
|
||||
aip->submode = SM_ATTACK_FOREVER; // Never leave attack submode, don't avoid, evade, etc.
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11335,7 +11392,10 @@ int formation_is_leader_chaotic(object *objp)
|
||||
|
||||
Leader_chaos *= (1.0f - flFrametime*0.2f);
|
||||
|
||||
CLAMP(Leader_chaos, 0.0f, 1.7f);
|
||||
if (Leader_chaos < 0.0f)
|
||||
Leader_chaos = 0.0f;
|
||||
else if (Leader_chaos > 1.7f)
|
||||
Leader_chaos = 1.7f;
|
||||
|
||||
Chaos_frame = Framecount;
|
||||
}
|
||||
@@ -11464,14 +11524,6 @@ int ai_formation()
|
||||
}
|
||||
|
||||
if (aip->mode == AIM_WAYPOINTS) {
|
||||
|
||||
if (The_mission.ai_profile->flags2 & AIPF2_FIX_AI_PATH_ORDER_BUG){
|
||||
// skip if wing leader has no waypoint order or a different waypoint list
|
||||
if ((laip->mode != AIM_WAYPOINTS) || !(aip->wp_list == laip->wp_list)){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
aip->wp_list = laip->wp_list;
|
||||
aip->wp_index = laip->wp_index;
|
||||
aip->wp_flags = laip->wp_flags;
|
||||
@@ -11730,9 +11782,6 @@ void ai_maybe_launch_cmeasure(object *objp, ai_info *aip)
|
||||
if (!(sip->flags & (SIF_SMALL_SHIP | SIF_TRANSPORT)))
|
||||
return;
|
||||
|
||||
if (object_is_docked(objp))
|
||||
return;
|
||||
|
||||
if (!shipp->cmeasure_count)
|
||||
return;
|
||||
|
||||
@@ -11750,9 +11799,11 @@ void ai_maybe_launch_cmeasure(object *objp, ai_info *aip)
|
||||
if ((aip->nearest_locked_object != -1) && (Objects[aip->nearest_locked_object].type == OBJ_WEAPON)) {
|
||||
object *weapon_objp;
|
||||
weapon *weaponp;
|
||||
weapon_info *wip;
|
||||
|
||||
weapon_objp = &Objects[aip->nearest_locked_object];
|
||||
weaponp = &Weapons[weapon_objp->instance];
|
||||
wip = &Weapon_info[weaponp->weapon_info_index];
|
||||
|
||||
if ((dist = vm_vec_dist_quick(&objp->pos, &weapon_objp->pos)) < weapon_objp->phys_info.speed*2.0f) {
|
||||
|
||||
@@ -11803,10 +11854,7 @@ void ai_preprocess_ignore_objnum(object *objp, ai_info *aip)
|
||||
|
||||
if (is_ignore_object(aip, aip->goal_objnum))
|
||||
{
|
||||
// you can land and launch on a ship you're ignoring!
|
||||
if (aip->mode != AIM_BAY_EMERGE && aip->mode != AIM_BAY_DEPART) {
|
||||
aip->goal_objnum = -1;
|
||||
}
|
||||
aip->goal_objnum = -1;
|
||||
|
||||
// AL 12-11-97: If in STRAFE mode, we need to ensure that target_objnum is also
|
||||
// set to -1
|
||||
@@ -11883,15 +11931,18 @@ void ai_transfer_shield(object *objp, int quadrant_num)
|
||||
float transfer_delta;
|
||||
float max_quadrant_strength;
|
||||
|
||||
max_quadrant_strength = get_max_shield_quad(objp);
|
||||
if(objp->n_shield_segments == 1)
|
||||
return;
|
||||
|
||||
max_quadrant_strength = get_max_shield_quad(objp,quadrant_num);
|
||||
|
||||
transfer_amount = 0.0f;
|
||||
transfer_delta = (SHIELD_BALANCE_RATE/2) * max_quadrant_strength;
|
||||
|
||||
if (objp->shield_quadrant[quadrant_num] + (MAX_SHIELD_SECTIONS-1)*transfer_delta > max_quadrant_strength)
|
||||
transfer_delta = (max_quadrant_strength - objp->shield_quadrant[quadrant_num])/(MAX_SHIELD_SECTIONS-1);
|
||||
if (objp->shield_quadrant[quadrant_num] + (objp->n_shield_segments-1)*transfer_delta > max_quadrant_strength)
|
||||
transfer_delta = (max_quadrant_strength - objp->shield_quadrant[quadrant_num])/(objp->n_shield_segments-1);
|
||||
|
||||
for (i=0; i<MAX_SHIELD_SECTIONS; i++)
|
||||
for (i=0; i<objp->n_shield_segments; i++)
|
||||
if (i != quadrant_num) {
|
||||
if (objp->shield_quadrant[i] >= transfer_delta) {
|
||||
objp->shield_quadrant[i] -= transfer_delta;
|
||||
@@ -11912,21 +11963,25 @@ void ai_balance_shield(object *objp)
|
||||
float delta;
|
||||
|
||||
// if we are already at the max shield strength for all quads then just bail now
|
||||
if ( Ships[objp->instance].ship_max_shield_strength == shield_get_strength(objp) )
|
||||
if ( (Ships[objp->instance].ship_max_shield_strength == shield_get_strength(objp)) || (Ships[objp->instance].ship_max_shield_strength == 0.0f) )
|
||||
return;
|
||||
|
||||
if(objp->n_shield_segments == 1)
|
||||
return;
|
||||
|
||||
shield_strength_avg = shield_get_strength(objp)/MAX_SHIELD_SECTIONS;
|
||||
shield_strength_avg = shield_get_strength(objp)/objp->n_shield_segments;
|
||||
float shield_multiplier = shield_get_strength(objp) / Ships[objp->instance].ship_max_shield_strength;
|
||||
|
||||
delta = SHIELD_BALANCE_RATE * shield_strength_avg;
|
||||
|
||||
for (i=0; i<MAX_SHIELD_SECTIONS; i++) {
|
||||
for (i=0; i<objp->n_shield_segments; i++) {
|
||||
shield_strength_avg = Ships[objp->instance].ship_max_shield_segment[i] * shield_multiplier;
|
||||
if (objp->shield_quadrant[i] < shield_strength_avg) {
|
||||
// only do it the retail way if using smart shields (since that's a bigger thing) - taylor
|
||||
if (Ai_info[Ships[objp->instance].ai_index].ai_profile_flags & AIPF_SMART_SHIELD_MANAGEMENT)
|
||||
shield_add_strength(objp, delta);
|
||||
else
|
||||
objp->shield_quadrant[i] += delta/MAX_SHIELD_SECTIONS;
|
||||
objp->shield_quadrant[i] += delta/objp->n_shield_segments;
|
||||
|
||||
if (objp->shield_quadrant[i] > shield_strength_avg)
|
||||
objp->shield_quadrant[i] = shield_strength_avg;
|
||||
@@ -11936,7 +11991,7 @@ void ai_balance_shield(object *objp)
|
||||
if (Ai_info[Ships[objp->instance].ai_index].ai_profile_flags & AIPF_SMART_SHIELD_MANAGEMENT)
|
||||
shield_add_strength(objp, -delta);
|
||||
else
|
||||
objp->shield_quadrant[i] -= delta/MAX_SHIELD_SECTIONS;
|
||||
objp->shield_quadrant[i] -= delta/objp->n_shield_segments;
|
||||
|
||||
if (objp->shield_quadrant[i] < shield_strength_avg)
|
||||
objp->shield_quadrant[i] = shield_strength_avg;
|
||||
@@ -11974,7 +12029,7 @@ void ai_manage_shield(object *objp, ai_info *aip)
|
||||
aip->shield_manage_timestamp = timestamp((int) (delay * 1000.0f));
|
||||
|
||||
if (sip->flags & SIF_SMALL_SHIP || (aip->ai_profile_flags2 & AIPF2_ALL_SHIPS_MANAGE_SHIELDS)) {
|
||||
if (Missiontime - aip->last_hit_time < F1_0*10)
|
||||
if ((aip->last_hit_time != 0) && (Missiontime - aip->last_hit_time < F1_0*10))
|
||||
ai_transfer_shield(objp, aip->last_hit_quadrant);
|
||||
else
|
||||
ai_balance_shield(objp);
|
||||
@@ -11987,18 +12042,16 @@ void ai_manage_shield(object *objp, ai_info *aip)
|
||||
void ai_maybe_evade_locked_missile(object *objp, ai_info *aip)
|
||||
{
|
||||
ship *shipp;
|
||||
ship_info *sip;
|
||||
|
||||
shipp = &Ships[objp->instance];
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
// Only small ships evade an incoming missile. Why would a capital ship try to swerve?
|
||||
if (!(Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_SMALL_SHIP)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// don't evade missiles if you're docked
|
||||
if (object_is_docked(objp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aip->ai_flags & (AIF_NO_DYNAMIC | AIF_KAMIKAZE)) { // If not allowed to pursue dynamic objectives, don't evade. Dumb? Maybe change. -- MK, 3/15/98
|
||||
return;
|
||||
}
|
||||
@@ -12097,11 +12150,6 @@ void maybe_evade_dumbfire_weapon(ai_info *aip)
|
||||
return;
|
||||
}
|
||||
|
||||
// don't evade missiles if you're docked
|
||||
if (object_is_docked(Pl_objp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure in a mode in which we evade dumbfire weapons.
|
||||
switch (aip->mode) {
|
||||
case AIM_CHASE:
|
||||
@@ -12849,12 +12897,6 @@ int maybe_request_support(object *objp)
|
||||
if (!is_support_allowed(objp))
|
||||
return 0;
|
||||
|
||||
// Goober5000 - a ship that is currently docked shouldn't request repair.
|
||||
// This is to prevent support ships being summoned for a ship that is getting
|
||||
// towed away by other means.
|
||||
if (object_is_docked(objp))
|
||||
return 0;
|
||||
|
||||
// Compute a desire value.
|
||||
// Desire of 0 means no reason to request support.
|
||||
// 1 is slight, 2 more, etc. Maximum is around 20. Anything larger than 3 is pretty strong.
|
||||
@@ -13140,8 +13182,7 @@ void ai_announce_ship_dying(object *dying_objp)
|
||||
object *A = &Objects[so->objnum];
|
||||
Assert(A->type == OBJ_SHIP);
|
||||
|
||||
// Goober5000 - the disallow is now handled uniformly in the ai_avoid_shockwave function
|
||||
/*if (Ship_info[Ships[A->instance].ship_info_index].flags & (SIF_SMALL_SHIP | SIF_FREIGHTER | SIF_TRANSPORT))*/ {
|
||||
if (Ship_info[Ships[A->instance].ship_info_index].flags & (SIF_SMALL_SHIP | SIF_FREIGHTER | SIF_TRANSPORT)) {
|
||||
ai_info *aip = &Ai_info[Ships[A->instance].ai_index];
|
||||
|
||||
// AL 1-5-98: only avoid shockwave if not docked or repairing
|
||||
@@ -13340,8 +13381,7 @@ int ai_avoid_shockwave(object *objp, ai_info *aip)
|
||||
vec3d safe_pos;
|
||||
|
||||
// BIG|HUGE do not respond to shockwaves
|
||||
// Goober5000 - let's treat shockwave response the same way whether from weapon or ship
|
||||
if (!(Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_AVOID_SHOCKWAVE))) {
|
||||
if (Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) {
|
||||
// don't come here again
|
||||
aip->ai_flags &= ~AIF_AVOID_SHOCKWAVE;
|
||||
return 0;
|
||||
@@ -14192,42 +14232,42 @@ void ai_set_default_behavior(object *obj, int classnum)
|
||||
|
||||
void ai_do_default_behavior(object *obj)
|
||||
{
|
||||
ai_info *aip;
|
||||
int ship_flags;
|
||||
|
||||
Assert(obj != NULL);
|
||||
Assert(obj->instance != -1);
|
||||
Assert(Ships[obj->instance].ai_index != -1);
|
||||
|
||||
ai_info *aip = &Ai_info[Ships[obj->instance].ai_index];
|
||||
int si_flags = Ship_info[Ships[obj->instance].ship_info_index].flags;
|
||||
aip = &Ai_info[Ships[obj->instance].ai_index];
|
||||
|
||||
// default behavior in most cases (especially if we're docked) is to just stay put
|
||||
aip->mode = AIM_NONE;
|
||||
ship_flags = Ship_info[Ships[obj->instance].ship_info_index].flags;
|
||||
if (!is_instructor(obj) && (ship_flags & (SIF_FIGHTER | SIF_BOMBER)))
|
||||
{
|
||||
int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
|
||||
set_target_objnum(aip, enemy_objnum);
|
||||
aip->mode = AIM_CHASE;
|
||||
aip->submode = SM_ATTACK;
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
else if (ship_flags & (SIF_SUPPORT))
|
||||
{
|
||||
aip->mode = AIM_SAFETY;
|
||||
aip->submode = AISS_1;
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->ai_flags &= ~(AIF_REPAIRING);
|
||||
}
|
||||
else if ( ship_flags & SIF_SENTRYGUN )
|
||||
{
|
||||
aip->mode = AIM_SENTRYGUN;
|
||||
}
|
||||
else
|
||||
{
|
||||
aip->mode = AIM_NONE;
|
||||
}
|
||||
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->active_goal = AI_GOAL_NONE;
|
||||
|
||||
// if we're not docked, we may modify the behavior a bit
|
||||
if (!object_is_docked(obj))
|
||||
{
|
||||
// fighters automatically chase things
|
||||
if (!is_instructor(obj) && (si_flags & (SIF_FIGHTER | SIF_BOMBER)))
|
||||
{
|
||||
int enemy_objnum = find_enemy(OBJ_INDEX(obj), 1000.0f, The_mission.ai_profile->max_attackers[Game_skill_level]);
|
||||
set_target_objnum(aip, enemy_objnum);
|
||||
aip->mode = AIM_CHASE;
|
||||
aip->submode = SM_ATTACK;
|
||||
}
|
||||
// support ships automatically keep a safe distance
|
||||
else if (si_flags & SIF_SUPPORT)
|
||||
{
|
||||
aip->mode = AIM_SAFETY;
|
||||
aip->submode = AISS_1;
|
||||
aip->ai_flags &= ~(AIF_REPAIRING);
|
||||
}
|
||||
// sentry guns... do their thing
|
||||
else if (si_flags & SIF_SENTRYGUN)
|
||||
{
|
||||
aip->mode = AIM_SENTRYGUN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define FRIENDLY_DAMAGE_THRESHOLD 50.0f // Display a message at this threshold. Note, this gets scaled by Skill_level
|
||||
@@ -14623,24 +14663,23 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_
|
||||
|
||||
// Hit by a protected ship, don't attack it.
|
||||
if (objp_hitter->flags & OF_PROTECTED) {
|
||||
if (!object_is_docked(objp_ship)) {
|
||||
if ((Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) && (aip->target_objnum == -1)) {
|
||||
if (aip->mode == AIM_CHASE) {
|
||||
if (aip->submode != SM_EVADE_WEAPON) {
|
||||
aip->mode = AIM_CHASE;
|
||||
aip->submode = SM_EVADE_WEAPON;
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
} else if (aip->mode != AIM_EVADE_WEAPON) {
|
||||
aip->active_goal = AI_ACTIVE_GOAL_DYNAMIC;
|
||||
aip->previous_mode = aip->mode;
|
||||
aip->previous_submode = aip->submode;
|
||||
aip->mode = AIM_EVADE_WEAPON;
|
||||
aip->submode = -1;
|
||||
if ((Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) && (aip->target_objnum == -1)) {
|
||||
if (aip->mode == AIM_CHASE) {
|
||||
if (aip->submode != SM_EVADE_WEAPON) {
|
||||
aip->mode = AIM_CHASE;
|
||||
aip->submode = SM_EVADE_WEAPON;
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->mode_time = timestamp(MAX_EVADE_TIME); // Evade for up to five seconds.
|
||||
}
|
||||
} else if (aip->mode != AIM_EVADE_WEAPON) {
|
||||
aip->active_goal = AI_ACTIVE_GOAL_DYNAMIC;
|
||||
aip->previous_mode = aip->mode;
|
||||
aip->previous_submode = aip->submode;
|
||||
aip->mode = AIM_EVADE_WEAPON;
|
||||
aip->submode = -1;
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->mode_time = timestamp(MAX_EVADE_TIME); // Evade for up to five seconds.
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -14719,12 +14758,10 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_
|
||||
// If the hitter object is the ignore object, don't attack it.
|
||||
ship_info *sip = &Ship_info[shipp->ship_info_index];
|
||||
if ((is_ignore_object(aip, objp_hitter-Objects)) && (sip->flags & (SIF_BOMBER | SIF_FIGHTER))) {
|
||||
if (!object_is_docked(objp_ship)) {
|
||||
if (aip->mode == AIM_NONE) {
|
||||
aip->mode = AIM_CHASE; // This will cause the ship to move, if not attack.
|
||||
aip->submode = SM_EVADE;
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
if (aip->mode == AIM_NONE) {
|
||||
aip->mode = AIM_CHASE; // This will cause the ship to move, if not attack.
|
||||
aip->submode = SM_EVADE;
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+45
-30
@@ -131,9 +131,18 @@ char *Ai_goal_text(int goal)
|
||||
}
|
||||
|
||||
// function to maybe add the form on my wing goal for a player's starting wing. Called when a player wing arrives.
|
||||
// Goober5000 - made more generic
|
||||
void ai_maybe_add_form_goal( wing *wingp )
|
||||
{
|
||||
int j;
|
||||
char *wing_leader;
|
||||
|
||||
// if the wing leader isn't available (ie, dead/departed) then go ahead and bail now
|
||||
if (wingp->ship_index[wingp->special_ship] < 0)
|
||||
return;
|
||||
|
||||
// Goober5000 - the wing leader is now not necessarily the player
|
||||
wing_leader = Ships[wingp->ship_index[wingp->special_ship]].ship_name;
|
||||
|
||||
// iterate through the ship_index list of this wing and check for orders. We will do
|
||||
// this for all ships in the wing instead of on a wing only basis in case some ships
|
||||
@@ -143,15 +152,20 @@ void ai_maybe_add_form_goal( wing *wingp )
|
||||
|
||||
Assert( wingp->ship_index[j] != -1 ); // get Allender
|
||||
|
||||
// don't process wing leader
|
||||
if (j == wingp->special_ship)
|
||||
continue;
|
||||
|
||||
aip = &Ai_info[Ships[wingp->ship_index[j]].ai_index];
|
||||
|
||||
// don't process Player_ship
|
||||
if ( aip == Player_ai )
|
||||
continue;
|
||||
|
||||
// it is sufficient enough to check the first goal entry to see if it has a valid goal
|
||||
if ( aip->goals[0].ai_mode == AI_GOAL_NONE ) {
|
||||
// need to add a form on my wing goal here. Ships are always forming on the player's wing.
|
||||
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Player_ship->ship_name, aip );
|
||||
// need to add a form on my wing goal here
|
||||
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, wing_leader, aip );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,28 +173,38 @@ void ai_maybe_add_form_goal( wing *wingp )
|
||||
void ai_post_process_mission()
|
||||
{
|
||||
object *objp;
|
||||
int i;
|
||||
|
||||
/*
|
||||
// Goober5000 - considering that this is also done in parse_wing_create_ships,
|
||||
// it's redundant (and possibly premature for some wings) here
|
||||
|
||||
// Check ships in player starting wings. Those ships should follow these rules:
|
||||
// (1) if they have no orders, they should get a form on my wing order
|
||||
// (2) if they have an order, they are free to act on it.
|
||||
//
|
||||
// So basically, we are checking for (1)
|
||||
if ( !Fred_running ) {
|
||||
// MK, 5/9/98: Used to iterate through MAX_STARTING_WINGS, but this was too many ships forming on player.
|
||||
// Goober5000 - MK originally iterated on only the first wing; now we iterate on only the player wing
|
||||
// because the player wing may not be first
|
||||
for ( i = 0; i < MAX_STARTING_WINGS; i++ ) {
|
||||
if ( Starting_wings[i] == Player_ship->wingnum ) {
|
||||
wing *wingp;
|
||||
if ( !Fred_running )
|
||||
{
|
||||
int i;
|
||||
|
||||
wingp = &Wings[Starting_wings[i]];
|
||||
|
||||
ai_maybe_add_form_goal( wingp );
|
||||
|
||||
}
|
||||
// Goober5000 - make all wings form on their respective leaders
|
||||
for ( i = 0; i < Num_wings; i++ )
|
||||
{
|
||||
ai_maybe_add_form_goal( &Wings[i] );
|
||||
}
|
||||
|
||||
// for ( i = 0; i < 1; i++ ) { // MK, 5/9/98: Used to iterate through MAX_STARTING_WINGS, but this was too many ships forming on player.
|
||||
// if ( Starting_wings[i] != -1 ) {
|
||||
// wing *wingp;
|
||||
//
|
||||
// wingp = &Wings[Starting_wings[i]];
|
||||
//
|
||||
// ai_maybe_add_form_goal( wingp );
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
*/
|
||||
|
||||
// for every valid ship object, call process_mission_orders to be sure that ships start the
|
||||
// mission following the orders in the mission file right away instead of waiting N seconds
|
||||
@@ -1446,13 +1470,8 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
// for this goal to be valid).
|
||||
Assert ( aigp->ai_submode >= 0 );
|
||||
ssp = ship_get_indexed_subsys( &Ships[sindex], aigp->ai_submode );
|
||||
if (ssp != NULL) {
|
||||
status = mission_log_get_time( LOG_SHIP_SUBSYS_DESTROYED, aigp->target_name, ssp->system_info->subobj_name, NULL );
|
||||
} else {
|
||||
// not supposed to ever happen, but could if there is a mismatch between the table and model subsystems
|
||||
nprintf(("AI", "Couldn't find subsystem %d for ship %s\n", aigp->ai_submode, Ships[sindex].ship_name));
|
||||
status = 0;
|
||||
}
|
||||
status = mission_log_get_time( LOG_SHIP_SUBSYS_DESTROYED, aigp->target_name, ssp->system_info->subobj_name, NULL );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1479,17 +1498,13 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
// checking departure and destroyed. In multiplayer, since ships can respawn,
|
||||
// they get log entries for being destroyed even though they have respawned.
|
||||
sindex = ship_name_lookup( aigp->target_name );
|
||||
if ( sindex < 0 ) {
|
||||
if ( sindex == -1 ) {
|
||||
status = mission_log_get_time( LOG_SHIP_DEPARTED, aigp->target_name, NULL, NULL);
|
||||
if ( !status ) {
|
||||
status = mission_log_get_time( LOG_SHIP_DESTROYED, aigp->target_name, NULL, NULL);
|
||||
if ( !status ) {
|
||||
status = mission_log_get_time( LOG_SELF_DESTRUCTED, aigp->target_name, NULL, NULL);
|
||||
}
|
||||
if ( status )
|
||||
return_val = AI_GOAL_NOT_ACHIEVABLE;
|
||||
}
|
||||
|
||||
if ( status )
|
||||
return_val = AI_GOAL_NOT_ACHIEVABLE;
|
||||
} else {
|
||||
status = 0;
|
||||
}
|
||||
@@ -2273,7 +2288,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
|
||||
}
|
||||
|
||||
void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, const char *new_name)
|
||||
void ai_update_goal_references(ai_goal *goals, int type, char *old_name, char *new_name)
|
||||
{
|
||||
int i, mode, flag, dummy;
|
||||
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ extern void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip );
|
||||
extern void ai_mission_goal_complete( ai_info *aip );
|
||||
extern void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp );
|
||||
|
||||
extern void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, const char *new_name);
|
||||
extern void ai_update_goal_references(ai_goal *goals, int type, char *old_name, char *new_name);
|
||||
extern int query_referenced_in_ai_goals(ai_goal *goals, int type, char *name);
|
||||
extern char *ai_add_dock_name(char *str);
|
||||
|
||||
|
||||
+86
-192
@@ -87,17 +87,8 @@ typedef struct eval_enemy_obj_struct {
|
||||
int nearest_objnum;
|
||||
} eval_enemy_obj_struct;
|
||||
|
||||
/**
|
||||
* Is object in turret field of view?
|
||||
*
|
||||
* @param objp Pointer to object to test
|
||||
* @param ss Ship turret subsystem to test from
|
||||
* @param tvec Turret initial vector
|
||||
* @param tpos Turret initial position
|
||||
* @param dist Distance from turret to center point of object
|
||||
*
|
||||
* @return 1 if objp is in fov of the specified turret. Otherwise return 0.
|
||||
*/
|
||||
// return 1 if objp is in fov of the specified turret, tp. Otherwise return 0.
|
||||
// dist = distance from turret to center point of object
|
||||
int object_in_turret_fov(object *objp, ship_subsys *ss, vec3d *tvec, vec3d *tpos, float dist)
|
||||
{
|
||||
vec3d v2e;
|
||||
@@ -211,14 +202,7 @@ bool is_object_radius_in_turret_fov(object *objp, ship_subsys *ss, vec3d *tvec,
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is bomb headed towards given ship?
|
||||
*
|
||||
* @param bomb_objp Bomb specified
|
||||
* @param ship_objp Ship specified
|
||||
*
|
||||
* @return 1 if bomb_objp is headed towards ship_objp
|
||||
*/
|
||||
// return 1 if bomb_objp is headed towards ship_objp
|
||||
int bomb_headed_towards_ship(object *bomb_objp, object *ship_objp)
|
||||
{
|
||||
float dot;
|
||||
@@ -237,12 +221,10 @@ int bomb_headed_towards_ship(object *bomb_objp, object *ship_objp)
|
||||
// Set active weapon for turret
|
||||
//This really isn't needed...but whatever -WMC
|
||||
|
||||
/**
|
||||
* Returns the best weapon on turret for target
|
||||
*
|
||||
* @note All non-negative return values are expressed in what I like to call "widx"s.
|
||||
* @return -1 if unable to find a weapon for the target at all.
|
||||
*/
|
||||
//Returns the best weapon on turret for target
|
||||
//Note that all non-negative return values are expressed in
|
||||
//what I like to call "widx"s.
|
||||
//Returns -1 if unable to find a weapon for the target at all.
|
||||
int turret_select_best_weapon(ship_subsys *turret, object *target)
|
||||
{
|
||||
//TODO: Fill this out with extraodinary gun-picking algorithms
|
||||
@@ -254,11 +236,8 @@ int turret_select_best_weapon(ship_subsys *turret, object *target)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if all weapons in swp have the specified flag
|
||||
*
|
||||
* @note doesn't work for WIF2
|
||||
*/
|
||||
//doesn't work for WIF2
|
||||
//Returns true if all weapons in swp have the specified flag
|
||||
bool all_turret_weapons_have_flags(ship_weapon *swp, int flags)
|
||||
{
|
||||
int i;
|
||||
@@ -276,11 +255,6 @@ bool all_turret_weapons_have_flags(ship_weapon *swp, int flags)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if all weapons in swp have the specified flag
|
||||
*
|
||||
* @note does work for WIF2, but not WIF
|
||||
*/
|
||||
bool all_turret_weapons_have_flags2(ship_weapon *swp, int flags)
|
||||
{
|
||||
int i;
|
||||
@@ -298,11 +272,7 @@ bool all_turret_weapons_have_flags2(ship_weapon *swp, int flags)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any of the weapons in swp have flags
|
||||
*
|
||||
* @note doesn't work for WIF2
|
||||
*/
|
||||
//Returns true if any of the weapons in swp have flags
|
||||
bool turret_weapon_has_flags(ship_weapon *swp, int flags)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -313,18 +283,15 @@ bool turret_weapon_has_flags(ship_weapon *swp, int flags)
|
||||
}
|
||||
for(i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if(Weapon_info[swp->secondary_bank_weapons[i]].wi_flags & flags)
|
||||
if(Weapon_info[swp->primary_bank_weapons[i]].wi_flags & flags)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any of the weapons in swp have flags
|
||||
*
|
||||
* @note does work for WIF2, but not WIF
|
||||
*/
|
||||
//does work for WIF2, but not WIF
|
||||
//Returns true if any of the weapons in swp have flags
|
||||
bool turret_weapon_has_flags2(ship_weapon *swp, int flags)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -335,19 +302,16 @@ bool turret_weapon_has_flags2(ship_weapon *swp, int flags)
|
||||
}
|
||||
for(i = 0; i < swp->num_secondary_banks; i++)
|
||||
{
|
||||
if(Weapon_info[swp->secondary_bank_weapons[i]].wi_flags2 & flags)
|
||||
if(Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & flags)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any of the weapons in swp have the subtype specified
|
||||
*
|
||||
* @note It might be a little faster to optimize based on WP_LASER should only appear in primaries
|
||||
* and WP_MISSILE in secondaries. but in the interest of future coding I leave it like this.
|
||||
*/
|
||||
//It might be a little faster to optimize based on WP_LASER should only appear in primaries
|
||||
//and WP_MISSILE in secondaries. but in the interest of future coding I leave it like this.
|
||||
//Returns true if any of the weapons in swp have the subtype specified
|
||||
bool turret_weapon_has_subtype(ship_weapon *swp, int subtype)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -365,11 +329,8 @@ bool turret_weapon_has_subtype(ship_weapon *swp, int subtype)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use for getting a Weapon_info pointer, given a turret and a turret weapon indice
|
||||
*
|
||||
* @return a pointer to the Weapon_info for weapon_num
|
||||
*/
|
||||
//Use for getting a Weapon_info pointer, given a turret and a turret weapon indice
|
||||
//Returns a pointer to the Weapon_info for weapon_num
|
||||
weapon_info *get_turret_weapon_wip(ship_weapon *swp, int weapon_num)
|
||||
{
|
||||
Assert(weapon_num < MAX_SHIP_WEAPONS);
|
||||
@@ -392,11 +353,8 @@ int get_turret_weapon_next_fire_stamp(ship_weapon *swp, int weapon_num)
|
||||
return swp->next_primary_fire_stamp[weapon_num];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the longest-ranged weapon on a turret
|
||||
*
|
||||
* @todo This function is kinda slow
|
||||
*/
|
||||
//This function is kinda slow
|
||||
//Returns the longest-ranged weapon on a turret
|
||||
float longest_turret_weapon_range(ship_weapon *swp)
|
||||
{
|
||||
float longest_range_so_far = 0.0f;
|
||||
@@ -430,14 +388,10 @@ float longest_turret_weapon_range(ship_weapon *swp)
|
||||
return longest_range_so_far;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is valid turret target?
|
||||
*
|
||||
* @param objp Object that turret is considering as an enemy
|
||||
* @param turret_parent Object of ship that turret sits on
|
||||
*
|
||||
* @return !0 if objp can be considered for a turret target, 0 otherwise
|
||||
*/
|
||||
// return !0 if objp can be considered for a turret target, 0 otherwise
|
||||
// input: objp => object that turret is considering as an enemy
|
||||
// turret_parent => object of ship that turret sits on
|
||||
// turret => turret pointer
|
||||
int valid_turret_enemy(object *objp, object *turret_parent)
|
||||
{
|
||||
if ( objp == turret_parent ) {
|
||||
@@ -697,8 +651,8 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
if (objp->flags & OF_PLAYER_SHIP) {
|
||||
max_turrets = The_mission.ai_profile->max_turret_ownage_player[Game_skill_level];
|
||||
}
|
||||
// Apply the per-turret limit for small targets, if there is one and this is a small target
|
||||
if (ss->turret_max_target_ownage != -1 && (Ship_info[shipp->ship_info_index].flags & (SIF_SMALL_SHIP))) {
|
||||
// Apply the per-turret limit, if there is one
|
||||
if (ss->turret_max_target_ownage != -1) {
|
||||
max_turrets = MIN(max_turrets, ss->system_info->turret_max_target_ownage);
|
||||
}
|
||||
if (num_att_turrets > max_turrets) {
|
||||
@@ -758,11 +712,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
|
||||
} // end asteroid selection
|
||||
}
|
||||
|
||||
/**
|
||||
* Is target beam valid?
|
||||
*
|
||||
* @return 0 only if objnum is beam protected and turret is beam turret
|
||||
*/
|
||||
// return 0 only if objnum is beam protected and turret is beam turret
|
||||
int is_target_beam_valid(ship_weapon *swp, object *objp)
|
||||
{
|
||||
// check if turret has beam weapon
|
||||
@@ -781,23 +731,15 @@ int is_target_beam_valid(ship_weapon *swp, object *objp)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an object and an enemy team, return the index of the nearest enemy object.
|
||||
*
|
||||
* @param turret_parent_objnum Parent objnum for the turret
|
||||
* @param turret_subsys Pointer to system_info for the turret subsystem
|
||||
* @param enemy_team_mask OR'ed TEAM_ flags for the enemy of the turret parent ship
|
||||
* @param tpos Position of turret (world coords)
|
||||
* @param tvec Forward vector of turret (world coords)
|
||||
* @param current_enemy Objnum of current turret target
|
||||
* @param big_only_flag
|
||||
* @param small_only_flag
|
||||
* @param tagged_only_flag
|
||||
* @param beam_flag
|
||||
* @param flak_flag
|
||||
* @param laser_flag
|
||||
* @param missile_flag
|
||||
*/
|
||||
// Given an object and an enemy team, return the index of the nearest enemy object.
|
||||
//
|
||||
// input:
|
||||
// turret_parent_objnum => parent objnum for the turret
|
||||
// turret_subsys => pointer to system_info for the turret subsystem
|
||||
// enemy_team_mask => OR'ed TEAM_ flags for the enemy of the turret parent ship
|
||||
// tpos => position of turret (world coords)
|
||||
// tvec => forward vector of turret (world coords)
|
||||
// current_enemy => objnum of current turret target
|
||||
int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subsys, int enemy_team_mask, vec3d *tpos, vec3d *tvec, int current_enemy, bool big_only_flag, bool small_only_flag, bool tagged_only_flag, bool beam_flag, bool flak_flag, bool laser_flag, bool missile_flag)
|
||||
{
|
||||
//float weapon_travel_dist;
|
||||
@@ -1099,20 +1041,22 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
|
||||
int Use_parent_target = 0;
|
||||
DCF_BOOL(use_parent_target, Use_parent_target)
|
||||
|
||||
/**
|
||||
* Return objnum if enemy found, else return -1;
|
||||
*
|
||||
* @param turret_subsys Pointer to turret subsystem
|
||||
* @param objnum Parent objnum for the turret
|
||||
* @param tpos Position of turret (world coords)
|
||||
* @param tvec Forward vector of turret (world coords)
|
||||
* @param current_enemy Objnum of current turret target
|
||||
*/
|
||||
// -------------------------------------------------------------------
|
||||
// Return objnum if enemy found, else return -1;
|
||||
//
|
||||
// input:
|
||||
// turret_subsys => pointer to turret subsystem
|
||||
// objnum => parent objnum for the turret
|
||||
// tpos => position of turret (world coords)
|
||||
// tvec => forward vector of turret (world coords)
|
||||
// current_enemy => objnum of current turret target
|
||||
int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d *tvec, int current_enemy)
|
||||
{
|
||||
int enemy_team_mask, enemy_objnum;
|
||||
model_subsystem *tp;
|
||||
ship_info *sip;
|
||||
|
||||
tp = turret_subsys->system_info;
|
||||
enemy_team_mask = iff_get_attackee_mask(obj_team(&Objects[objnum]));
|
||||
|
||||
bool big_only_flag = all_turret_weapons_have_flags(&turret_subsys->weapons, WIF_HUGE);
|
||||
@@ -1211,19 +1155,10 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given an object and a turret on that object, return the global position and forward vector
|
||||
* of the turret.
|
||||
*
|
||||
* @param objp Pointer to object
|
||||
* @param tp Turrent model system on that object
|
||||
* @param gpos [Output] Global absolute position of gun firing point
|
||||
* @param gvec [Output] Global vector
|
||||
*
|
||||
* @note The gun normal is the unrotated gun normal, (the center of the FOV cone), not
|
||||
* the actual gun normal given using the current turret heading. But it _is_ rotated into the model's orientation
|
||||
* in global space.
|
||||
*/
|
||||
// Given an object and a turret on that object, return the global position and forward vector
|
||||
// of the turret. The gun normal is the unrotated gun normal, (the center of the FOV cone), not
|
||||
// the actual gun normal given using the current turret heading. But it _is_ rotated into the model's orientation
|
||||
// in global space.
|
||||
void ship_get_global_turret_info(object *objp, model_subsystem *tp, vec3d *gpos, vec3d *gvec)
|
||||
{
|
||||
// vm_vec_unrotate(gpos, &tp->turret_avg_firing_point, &objp->orient);
|
||||
@@ -1232,20 +1167,13 @@ void ship_get_global_turret_info(object *objp, model_subsystem *tp, vec3d *gpos,
|
||||
vm_vec_unrotate(gvec, &tp->turret_norm, &objp->orient);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an object and a turret on that object, return the actual firing point of the gun and its normal.
|
||||
*
|
||||
* @note This uses the current turret angles. We are keeping track of which
|
||||
* gun to fire next in the ship specific info for this turret subobject. Use this info
|
||||
* to determine which position to fire from next.
|
||||
*
|
||||
* @param objp Pointer to object
|
||||
* @param ssp Pointer to turret subsystem
|
||||
* @param gpos Absolute position of gun firing point
|
||||
* @param gvec Vector from *gpos to *targetp
|
||||
* @param use_angles Use current angles
|
||||
* @param targetp Pointer to target object
|
||||
*/
|
||||
// Given an object and a turret on that object, return the actual firing point of the gun
|
||||
// and its normal. This uses the current turret angles. We are keeping track of which
|
||||
// gun to fire next in the ship specific info for this turret subobject. Use this info
|
||||
// to determine which position to fire from next.
|
||||
// Stuffs:
|
||||
// *gpos: absolute position of gun firing point
|
||||
// *gvec: vector fro *gpos to *targetp
|
||||
void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, int use_angles, vec3d *targetp)
|
||||
{
|
||||
vec3d * gun_pos;
|
||||
@@ -1271,9 +1199,7 @@ void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos
|
||||
// per firingpoint based changes go here for turrets
|
||||
}
|
||||
|
||||
/**
|
||||
* Update turret aiming data based on max turret aim update delay
|
||||
*/
|
||||
//Update turret aiming data based on max turret aim update delay
|
||||
void turret_ai_update_aim(ai_info *aip, object *En_Objp, ship_subsys *ss)
|
||||
{
|
||||
if (Missiontime >= ss->next_aim_pos_time)
|
||||
@@ -1290,15 +1216,11 @@ void turret_ai_update_aim(ai_info *aip, object *En_Objp, ship_subsys *ss)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rotate a turret towards an enemy.
|
||||
*
|
||||
* Some obscure model thing only John Slagel knows about.
|
||||
* Sets predicted enemy position.
|
||||
* If the turret (*ss) has a subsystem targeted, the subsystem is used as the predicted point.
|
||||
*
|
||||
* @return TRUE if caller should use angles in subsequent rotations.
|
||||
*/
|
||||
// Rotate a turret towards an enemy.
|
||||
// Return TRUE if caller should use angles in subsequent rotations.
|
||||
// Some obscure model thing only John Slagel knows about.
|
||||
// Sets predicted enemy position.
|
||||
// If the turret (*ss) has a subsystem targeted, the subsystem is used as the predicted point.
|
||||
int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object *objp, object *lep, vec3d *predicted_enemy_pos, vec3d *gvec)
|
||||
{
|
||||
int ret_val = 0;
|
||||
@@ -1400,11 +1322,8 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if subsystem *enemy_subsysp is hittable from objp.
|
||||
*
|
||||
* @return Dot product of vector from point abs_gunposp to *enemy_subsysp, if hittable
|
||||
*/
|
||||
// Determine if subsystem *enemy_subsysp is hittable from objp.
|
||||
// If so, return dot product of vector from point abs_gunposp to *enemy_subsysp
|
||||
float aifft_compute_turret_dot(object *objp, object *enemy_objp, vec3d *abs_gunposp, ship_subsys *turret_subsysp, ship_subsys *enemy_subsysp)
|
||||
{
|
||||
float dot_out;
|
||||
@@ -1455,12 +1374,9 @@ DCF(mf, "")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pick a subsystem to attack on enemy_objp.
|
||||
* Only pick one if enemy_objp is a big ship or a capital ship.
|
||||
*
|
||||
* @return Dot product from turret to subsystem in *dot_out
|
||||
*/
|
||||
// Pick a subsystem to attack on enemy_objp.
|
||||
// Only pick one if enemy_objp is a big ship or a capital ship.
|
||||
// Returns dot product from turret to subsystem in *dot_out
|
||||
ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *enemy_objp, float *dot_out)
|
||||
{
|
||||
ship *eshipp, *shipp;
|
||||
@@ -1562,9 +1478,7 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en
|
||||
return best_subsysp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return !0 if the specified target should scan for a new target, otherwise return 0
|
||||
*/
|
||||
// return !0 if the specified target should scan for a new target, otherwise return 0
|
||||
int turret_should_pick_new_target(ship_subsys *turret)
|
||||
{
|
||||
// int target_type;
|
||||
@@ -1587,9 +1501,7 @@ int turret_should_pick_new_target(ship_subsys *turret)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the next fire timestamp for a turret, based on weapon type and ai class
|
||||
*/
|
||||
// Set the next fire timestamp for a turret, based on weapon type and ai class
|
||||
void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsys *turret, ai_info *aip)
|
||||
{
|
||||
Assert(weapon_num < MAX_SHIP_WEAPONS);
|
||||
@@ -1666,9 +1578,7 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
|
||||
(*fs_dest) = timestamp((int)wait);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide if a turret should launch an aspect seeking missile
|
||||
*/
|
||||
// Decide if a turret should launch an aspect seeking missile
|
||||
int turret_should_fire_aspect(ship_subsys *turret, weapon_info *wip, bool in_sight)
|
||||
{
|
||||
if ( in_sight && (turret->turret_time_enemy_in_range >= MIN(wip->min_lock_time,AICODE_TURRET_MAX_TIME_IN_RANGE)) ) {
|
||||
@@ -1678,9 +1588,7 @@ int turret_should_fire_aspect(ship_subsys *turret, weapon_info *wip, bool in_sig
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update how long current target has been in this turrets range
|
||||
*/
|
||||
// Update how long current target has been in this turrets range
|
||||
void turret_update_enemy_in_range(ship_subsys *turret, float seconds)
|
||||
{
|
||||
turret->turret_time_enemy_in_range += seconds;
|
||||
@@ -1694,9 +1602,7 @@ void turret_update_enemy_in_range(ship_subsys *turret, float seconds)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire a weapon from a turret
|
||||
*/
|
||||
// Fire a weapon from a turret
|
||||
bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum, vec3d *turret_pos, vec3d *turret_fvec, vec3d *predicted_pos = NULL, float flak_range_override = 100.0f)
|
||||
{
|
||||
matrix turret_orient;
|
||||
@@ -1781,10 +1687,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
fire_info.beam_info_override = NULL;
|
||||
fire_info.shooter = &Objects[parent_objnum];
|
||||
fire_info.target = &Objects[turret->turret_enemy_objnum];
|
||||
if (wip->wi_flags2 & WIF2_ANTISUBSYSBEAM)
|
||||
fire_info.target_subsys = turret->targeted_subsys;
|
||||
else
|
||||
fire_info.target_subsys = NULL;
|
||||
fire_info.target_subsys = NULL;
|
||||
fire_info.turret = turret;
|
||||
|
||||
// fire a beam weapon
|
||||
@@ -1808,26 +1711,25 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
// so we need to get the position info separately for each shot
|
||||
ship_get_global_turret_gun_info(&Objects[parent_objnum], turret, turret_pos, turret_fvec, 1, NULL);
|
||||
|
||||
weapon_objnum = weapon_create( turret_pos, &turret_orient, turret_weapon_class, parent_objnum, -1, 1, 0,0.0f, turret);
|
||||
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];
|
||||
wip=&Weapon_info[wp->weapon_info_index];
|
||||
|
||||
parent_ship->last_fired_turret = turret;
|
||||
turret->last_fired_weapon_info_index = wp->weapon_info_index;
|
||||
|
||||
Script_system.SetHookObjects(3, "Ship", &Objects[parent_objnum], "Weapon", objp, "Target", &Objects[turret->turret_enemy_objnum]);
|
||||
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[parent_objnum]);
|
||||
|
||||
//nprintf(("AI", "Turret_time_enemy_in_range = %7.3f\n", ss->turret_time_enemy_in_range));
|
||||
if (weapon_objnum != -1) {
|
||||
parent_ship->last_fired_turret = turret;
|
||||
turret->last_fired_weapon_info_index = wp->weapon_info_index;
|
||||
|
||||
wp->target_num = turret->turret_enemy_objnum;
|
||||
// AL 1-6-97: Store pointer to turret subsystem
|
||||
wp->turret_subsys = turret;
|
||||
|
||||
Script_system.SetHookObjects(3, "Ship", &Objects[parent_objnum], "Weapon", objp, "Target", &Objects[turret->turret_enemy_objnum]);
|
||||
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[parent_objnum]);
|
||||
|
||||
// if the gun is a flak gun
|
||||
if(wip->wi_flags & WIF_FLAK){
|
||||
// show a muzzle flash
|
||||
@@ -1886,9 +1788,6 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
|
||||
}
|
||||
|
||||
turret->flags |= SSF_HAS_FIRED; //set has fired flag for scriptng - nuke
|
||||
|
||||
//Fire animation stuff
|
||||
model_anim_start_type(turret, TRIGGER_TYPE_TURRET_FIRED, ANIMATION_SUBTYPE_ALL, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1928,7 +1827,7 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
vm_vector_2_matrix(&turret_orient, &turret_fvec, NULL, NULL);
|
||||
|
||||
// create weapon and homing info
|
||||
weapon_objnum = weapon_create(&turret_pos, &turret_orient, tsi->weapon_class, tsi->parent_objnum, -1, 1, 0, 0.0f, tsi->turret);
|
||||
weapon_objnum = weapon_create(&turret_pos, &turret_orient, tsi->weapon_class, tsi->parent_objnum, -1, 1);
|
||||
weapon_set_tracking_info(weapon_objnum, tsi->parent_objnum, tsi->target_objnum, 1, tsi->target_subsys);
|
||||
|
||||
// do other cool stuff if weapon is created.
|
||||
@@ -1959,10 +1858,7 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
|
||||
int Num_ai_firing = 0;
|
||||
int Num_find_turret_enemy = 0;
|
||||
int Num_turrets_fired = 0;
|
||||
|
||||
/**
|
||||
* Given a turret tp and its parent parent_objnum, fire from the turret at its enemy.
|
||||
*/
|
||||
// Given a turret tp and its parent parent_objnum, fire from the turret at its enemy.
|
||||
extern int Nebula_sec_range;
|
||||
void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
{
|
||||
@@ -2264,13 +2160,11 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
if (objnum >= 0 && is_target_beam_valid(&ss->weapons, &Objects[objnum])) {
|
||||
if (ss->turret_enemy_objnum == -1) {
|
||||
ss->turret_enemy_objnum = objnum;
|
||||
ss->targeted_subsys = NULL; // Turret has retargeted; reset subsystem - Valathil for Mantis #2652
|
||||
ss->turret_enemy_sig = Objects[objnum].signature;
|
||||
// why return?
|
||||
return;
|
||||
} else {
|
||||
ss->turret_enemy_objnum = objnum;
|
||||
ss->targeted_subsys = NULL; // Turret has retargeted; reset subsystem - Valathil for Mantis #2652
|
||||
ss->turret_enemy_sig = Objects[objnum].signature;
|
||||
}
|
||||
} else {
|
||||
@@ -2397,7 +2291,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
|
||||
// if the weapon is a flak gun, add some jitter to its aim so it fires in a "cone"
|
||||
// to make a cool visual effect and make them less lethal
|
||||
if(wip->wi_flags & WIF_FLAK){
|
||||
flak_jitter_aim(&tv2e, dist_to_enemy, ship_get_subsystem_strength(shipp, SUBSYSTEM_WEAPONS), wip);
|
||||
flak_jitter_aim(&tv2e, dist_to_enemy, ship_get_subsystem_strength(shipp, SUBSYSTEM_WEAPONS));
|
||||
}
|
||||
|
||||
// Fire if:
|
||||
|
||||
@@ -472,7 +472,7 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
|
||||
if ( instance->last_bitmap != -1 ){
|
||||
bm_release(instance->last_bitmap);
|
||||
}
|
||||
bitmap_id = bm_create(bpp, instance->parent->width, instance->parent->height, instance->frame, bitmap_flags);
|
||||
bitmap_id = bm_create(16, instance->parent->width, instance->parent->height, instance->frame, bitmap_flags);
|
||||
}
|
||||
|
||||
if ( bitmap_id == -1 ) {
|
||||
@@ -968,9 +968,6 @@ void anim_display_info(char *real_filename)
|
||||
// read the keyframe frame nums and offsets
|
||||
key_frame_nums = (int*)vm_malloc(sizeof(int)*A.num_keys);
|
||||
Assert(key_frame_nums != NULL);
|
||||
if (key_frame_nums == NULL)
|
||||
return;
|
||||
|
||||
for ( i = 0; i < A.num_keys; i++ ) {
|
||||
key_frame_nums[i] = 0;
|
||||
cfread(&key_frame_nums[i], 2, 1, fp);
|
||||
@@ -1003,7 +1000,7 @@ void anim_display_info(char *real_filename)
|
||||
printf("FPS: %d\n", A.fps);
|
||||
|
||||
#ifndef NDEBUG
|
||||
printf("Transparent RGB: (%u,%u,%u)\n", A.xparent_r, A.xparent_g, A.xparent_b);
|
||||
printf("Transparent RGB: (%d,%d,%d)\n", A.xparent_r, A.xparent_g, A.xparent_b);
|
||||
#endif
|
||||
|
||||
printf("ac version: %d\n", A.version);
|
||||
|
||||
+64
-123
@@ -435,7 +435,6 @@ void asteroid_sub_create(object *parent_objp, int asteroid_type, vec3d *relvec)
|
||||
*/
|
||||
void asteroid_load(int asteroid_info_index, int asteroid_subtype)
|
||||
{
|
||||
int i;
|
||||
asteroid_info *asip;
|
||||
|
||||
Assert( asteroid_info_index < (int)Asteroid_info.size() );
|
||||
@@ -452,25 +451,13 @@ void asteroid_load(int asteroid_info_index, int asteroid_subtype)
|
||||
|
||||
asip->model_num[asteroid_subtype] = model_load( asip->pof_files[asteroid_subtype], 0, NULL );
|
||||
|
||||
if (asip->model_num[asteroid_subtype] >= 0)
|
||||
{
|
||||
polymodel *pm = asip->modelp[asteroid_subtype] = model_get(asip->model_num[asteroid_subtype]);
|
||||
if (asip->model_num[asteroid_subtype] > -1) {
|
||||
asip->modelp[asteroid_subtype] = model_get(asip->model_num[asteroid_subtype]);
|
||||
|
||||
if ( asip->num_detail_levels != pm->n_detail_levels )
|
||||
{
|
||||
if ( !Is_standalone )
|
||||
{
|
||||
// just log to file for standalone servers
|
||||
Warning(LOCATION, "For asteroid '%s', detail level\nmismatch (POF needs %d)", asip->name, pm->n_detail_levels );
|
||||
}
|
||||
else
|
||||
{
|
||||
nprintf(("Warning", "For asteroid '%s', detail level mismatch (POF needs %d)", asip->name, pm->n_detail_levels));
|
||||
}
|
||||
}
|
||||
// Stuff detail level distances.
|
||||
for ( i=0; i<pm->n_detail_levels; i++ )
|
||||
pm->detail_depth[i] = (i < asip->num_detail_levels) ? i2fl(asip->detail_distance[i]) : 0.0f;
|
||||
for (int i = 0; i < asip->num_detail_levels; i++) {
|
||||
asip->modelp[asteroid_subtype]->detail_depth[i] = i2fl(asip->detail_distance[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1161,8 +1148,10 @@ void asteroid_render(object * obj)
|
||||
{
|
||||
if (Asteroids_enabled) {
|
||||
int num;
|
||||
polymodel *pm;
|
||||
asteroid *asp;
|
||||
|
||||
pm = NULL;
|
||||
num = obj->instance;
|
||||
|
||||
Assert((num >= 0) && (num < MAX_ASTEROIDS));
|
||||
@@ -1808,6 +1797,8 @@ void asteroid_parse_section(asteroid_info *asip)
|
||||
stuff_string(asip->pof_files[2], F_NAME, MAX_FILENAME_LEN);
|
||||
}
|
||||
|
||||
asip->num_detail_levels = 0;
|
||||
|
||||
required_string("$Detail distance:");
|
||||
asip->num_detail_levels = stuff_int_list(asip->detail_distance, MAX_ASTEROID_DETAIL_LEVELS, RAW_INTEGER_TYPE);
|
||||
|
||||
@@ -1873,35 +1864,13 @@ void asteroid_parse_section(asteroid_info *asip)
|
||||
}
|
||||
|
||||
/**
|
||||
Read in data from asteroid.tbl into Asteroid_info[] array.
|
||||
|
||||
After this function is completes, the Asteroid_info[] array will
|
||||
contain exactly three asteroids per species plus exactly three
|
||||
generic asteroids. These three asteroids are a set
|
||||
of small, medium, and large asteroids in that exact order.
|
||||
|
||||
If asteroid.tbl contains too many or too few asteroids as per
|
||||
the rules above this function will abort the engine with an
|
||||
error message stating the number expected and it will write
|
||||
to the debug.log how everything was parsed.
|
||||
|
||||
Note that by saying "asteroid" this code is talking about
|
||||
the asteroids and the debris that make up asteroid fields
|
||||
and debris fields. Which means that these debris have nothing
|
||||
to do with the debris of ships that explode, however these
|
||||
are the same debris and asteroids that get flung at a ship
|
||||
that is being protected.
|
||||
*/
|
||||
* Read in data from asteroid.tbl into Asteroid_info[] array
|
||||
*/
|
||||
void asteroid_parse_tbl()
|
||||
{
|
||||
char impact_ani_file[MAX_FILENAME_LEN];
|
||||
int rval;
|
||||
|
||||
// How did we get here without having any species defined?
|
||||
Assertion(Species_info.size() > 0,
|
||||
"Cannot parse asteroids/debris if there "
|
||||
"are no species for them to belong to."
|
||||
);
|
||||
int *asteroid_tally = NULL;
|
||||
int i, rval;
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
@@ -1917,97 +1886,44 @@ void asteroid_parse_tbl()
|
||||
|
||||
required_string("#Asteroid Types");
|
||||
|
||||
int tally = 0;
|
||||
int max_asteroids =
|
||||
NUM_DEBRIS_SIZES + Species_info.size() * NUM_DEBRIS_SIZES;
|
||||
asteroid_tally = new int[Species_info.size() + 1];
|
||||
|
||||
#ifndef NDEBUG
|
||||
SCP_vector<SCP_string> parsed_asteroids;
|
||||
#endif
|
||||
memset(asteroid_tally, 0, sizeof(int) * (Species_info.size()+1));
|
||||
|
||||
// parse and tally each asteroid
|
||||
while (required_string_either("#End","$Name:"))
|
||||
{
|
||||
asteroid_info new_asteroid;
|
||||
|
||||
for (i = 0; i < NUM_DEBRIS_POFS; i++)
|
||||
new_asteroid.model_num[i] = -1;
|
||||
|
||||
asteroid_parse_section( &new_asteroid );
|
||||
|
||||
int species = tally / NUM_DEBRIS_SIZES;
|
||||
if (tally >= max_asteroids)
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
// Bump the warning count in release so they get something
|
||||
// even if the message never gets displayed.
|
||||
Warning(LOCATION, "Ignoring extra asteroid/debris");
|
||||
#else
|
||||
SCP_string msg("Ignoring extra asteroid/debris '");
|
||||
msg.append(new_asteroid.name);
|
||||
msg.append("'\n");
|
||||
Warning(LOCATION,msg.c_str());
|
||||
parsed_asteroids.push_back(msg);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
SCP_string msg;
|
||||
msg.append("Parsing asteroid: '");
|
||||
msg.append(new_asteroid.name);
|
||||
msg.append("' as a '");
|
||||
msg.append((species == 0)?"generic":Species_info[species-1].species_name);
|
||||
msg.append("'");
|
||||
switch(tally % NUM_DEBRIS_SIZES) {
|
||||
case ASTEROID_TYPE_SMALL:
|
||||
msg.append(" small\n");
|
||||
break;
|
||||
case ASTEROID_TYPE_MEDIUM:
|
||||
msg.append(" medium\n");
|
||||
break;
|
||||
case ASTEROID_TYPE_LARGE:
|
||||
msg.append(" large\n");
|
||||
break;
|
||||
default:
|
||||
Error(LOCATION, "Get a coder! Math has broken!\n"
|
||||
"Important numbers:\n"
|
||||
"\ttally: %d\n"
|
||||
"\tNUM_DEBRIS_SIZES: %d\n",
|
||||
tally, NUM_DEBRIS_SIZES
|
||||
);
|
||||
msg.append(" unknown\n");
|
||||
}
|
||||
parsed_asteroids.push_back(msg);
|
||||
#endif
|
||||
Asteroid_info.push_back(new_asteroid);
|
||||
}
|
||||
tally++;
|
||||
}
|
||||
required_string("#End");
|
||||
Assert( Species_info.size() );
|
||||
// sanity check for debris type sizes
|
||||
for (i = (int)Species_info.size(); i >= 0; i--) {
|
||||
// must remain in proper order
|
||||
// 0 - generic debris types
|
||||
// > 0 - species specific debris types
|
||||
if ( (i == 0) || stristr(new_asteroid.name, Species_info[i-1].species_name) ) {
|
||||
Assert( asteroid_tally[i] < NUM_DEBRIS_SIZES );
|
||||
|
||||
if (tally != max_asteroids)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
for(SCP_vector<SCP_string>::iterator iter = parsed_asteroids.begin();
|
||||
iter != parsed_asteroids.end(); ++iter)
|
||||
{
|
||||
mprintf(("Asteroid.tbl as parsed:\n"));
|
||||
mprintf((iter->c_str()));
|
||||
if ( asteroid_tally[i] >= NUM_DEBRIS_SIZES ) {
|
||||
// too many sizes specified, don't increment Num_debris_types and we'll overwrite
|
||||
// the current entry with the next
|
||||
break;
|
||||
}
|
||||
|
||||
// we're safe to continue
|
||||
asteroid_tally[i]++;
|
||||
Asteroid_info.push_back( new_asteroid );
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Error(LOCATION,
|
||||
"Found %d asteroids/debris when %d expected\n\n"
|
||||
"<Number expected> = <Number of species> * %d + %d generic asteroids\n"
|
||||
"%d = %d*%d + %d\n\n"
|
||||
#ifdef NDEBUG
|
||||
"Run a debug build to see a list of all parsed asteroids\n",
|
||||
#else
|
||||
"See the debug.log for a listing of all parsed asteroids\n",
|
||||
#endif
|
||||
tally, max_asteroids,
|
||||
NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES,
|
||||
max_asteroids, Species_info.size(), NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES
|
||||
);
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
|
||||
Asteroid_impact_explosion_ani = -1;
|
||||
required_string("$Impact Explosion:");
|
||||
stuff_string(impact_ani_file, F_NAME, MAX_FILENAME_LEN);
|
||||
@@ -2022,6 +1938,31 @@ void asteroid_parse_tbl()
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
|
||||
// check for any missing info
|
||||
char *errormsg = new char[75 + (Species_info.size() * (NAME_LENGTH))];
|
||||
bool species_missing = false;
|
||||
strcpy(errormsg, "The following species are missing debris types in asteroids.tbl:\n");
|
||||
for (i = 0; i < (int)Species_info.size(); i++)
|
||||
{
|
||||
int idx = (i+1); // offset from generic asteroids at 0..NUM_DEBRIS_SIZES
|
||||
|
||||
if (asteroid_tally[idx] < NUM_DEBRIS_SIZES)
|
||||
{
|
||||
strcat(errormsg, Species_info[i].species_name);
|
||||
strcat(errormsg, "\n");
|
||||
species_missing = true;
|
||||
}
|
||||
}
|
||||
strcat(errormsg, "\0");
|
||||
|
||||
if (species_missing)
|
||||
{
|
||||
Error(LOCATION, errormsg);
|
||||
}
|
||||
|
||||
delete[] asteroid_tally;
|
||||
delete[] errormsg;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,8 +52,7 @@ typedef struct asteroid_split_info {
|
||||
int max;
|
||||
} asteroid_split_info;
|
||||
|
||||
class asteroid_info {
|
||||
public:
|
||||
typedef struct asteroid_info {
|
||||
char name[NAME_LENGTH]; // name for the asteroid
|
||||
char pof_files[NUM_DEBRIS_POFS][MAX_FILENAME_LEN]; // POF files to load/associate with ship
|
||||
int num_detail_levels; // number of detail levels for this ship
|
||||
@@ -78,13 +77,13 @@ public:
|
||||
damage( 0 ), blast( 0 ), initial_asteroid_strength( 0 ),
|
||||
fireball_radius_multiplier( -1 )
|
||||
{
|
||||
name[ 0 ] = 0;
|
||||
name[ 0 ] = NULL;
|
||||
memset( pof_files, 0, sizeof( pof_files ) );
|
||||
memset( detail_distance, 0, sizeof( detail_distance ) );
|
||||
memset( modelp, 0, sizeof( modelp ) );
|
||||
memset( model_num, -1, sizeof( model_num ) );
|
||||
memset( model_num, 0, sizeof( model_num ) );
|
||||
}
|
||||
};
|
||||
} asteroid_info;
|
||||
|
||||
|
||||
#define AF_USED (1<<0) // Set means used.
|
||||
|
||||
@@ -984,7 +984,6 @@ camera* nav_get_set_camera()
|
||||
return nav_camera.getCamera();
|
||||
}
|
||||
|
||||
extern int Cmdline_old_collision_sys;
|
||||
void nav_warp(bool prewarp=false)
|
||||
{
|
||||
/* ok... find our end distance - norm1 is still a unit vector in the
|
||||
@@ -1039,11 +1038,8 @@ void nav_warp(bool prewarp=false)
|
||||
}
|
||||
|
||||
// retime all collision pairs
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
obj_all_collisions_retime();
|
||||
} else {
|
||||
obj_collide_retime_cached_pairs();
|
||||
}
|
||||
obj_all_collisions_retime();
|
||||
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
@@ -1336,7 +1332,7 @@ int FindNav(char *Nav)
|
||||
{
|
||||
for (int i = 0; i < MAX_NAVPOINTS; i++)
|
||||
{
|
||||
if (!stricmp(Navs[i].m_NavName, Nav))
|
||||
if (!stricmp(Navs[i].NavName, Nav))
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -1401,7 +1397,7 @@ bool AddNav_Ship(char *Nav, char *TargetName, int flags)
|
||||
// Create the NavPoint struct
|
||||
NavPoint tnav;
|
||||
|
||||
strncpy(tnav.m_NavName, Nav, 32);
|
||||
strncpy(tnav.NavName, Nav, 32);
|
||||
tnav.flags = NP_SHIP | flags;
|
||||
|
||||
Assert(!(tnav.flags & NP_WAYPOINT));
|
||||
@@ -1447,7 +1443,7 @@ bool AddNav_Waypoint(char *Nav, char *WP_Path, int node, int flags)
|
||||
// Create the NavPoint struct
|
||||
NavPoint tnav;
|
||||
|
||||
strncpy(tnav.m_NavName, Nav, TOKEN_LENGTH);
|
||||
strncpy(tnav.NavName, Nav, 32);
|
||||
tnav.flags = NP_WAYPOINT | flags;
|
||||
|
||||
Assert(!(tnav.flags & NP_SHIP));
|
||||
@@ -1570,23 +1566,7 @@ bool Nav_UnSet_Visited(char *Nav)
|
||||
return Nav_UnSet_Flag(Nav, NP_VISITED);
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Selects a navpoint by name.
|
||||
void SelectNav(char *Nav)
|
||||
{
|
||||
for (int i = 0; i < MAX_NAVPOINTS; i++)
|
||||
{
|
||||
if (!stricmp(Navs[i].m_NavName, Nav))
|
||||
if (!(Nav_Get_Flags(Nav) & NP_HIDDEN || Nav_Get_Flags(Nav) & NP_NOACCESS)) CurrentNav = i;
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Deselects any navpoint selected.
|
||||
void DeselectNav()
|
||||
{
|
||||
CurrentNav = 0;
|
||||
}
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
struct NavPoint
|
||||
{
|
||||
char m_NavName[32];
|
||||
char NavName[32];
|
||||
int flags;
|
||||
|
||||
void *target_obj;
|
||||
@@ -112,12 +112,6 @@ void parse_autopilot_table(char *filename);
|
||||
// Finds a Nav point by name
|
||||
int FindNav(char *Nav);
|
||||
|
||||
// Selects a Nav point by name
|
||||
void SelectNav(char *Nav);
|
||||
|
||||
// Deselects any navpoint selected.
|
||||
void DeselectNav();
|
||||
|
||||
// Set A Nav point to "ZERO"
|
||||
void ZeroNav(int i);
|
||||
|
||||
|
||||
+17
-53
@@ -36,7 +36,6 @@
|
||||
#include "pngutils/pngutils.h"
|
||||
#include "jpgutils/jpgutils.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "network/multiutil.h"
|
||||
|
||||
#define BMPMAN_INTERNAL
|
||||
#include "bmpman/bm_internal.h"
|
||||
@@ -54,7 +53,6 @@ int SPECMAP = -1;
|
||||
int ENVMAP = -1;
|
||||
int NORMMAP = -1;
|
||||
int HEIGHTMAP = -1;
|
||||
int MISCMAP = -1;
|
||||
|
||||
bitmap_entry bm_bitmaps[MAX_BITMAPS];
|
||||
|
||||
@@ -636,37 +634,6 @@ int bm_load_duplicate(char *filename)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to reload a different bitmap into an existing slot.
|
||||
* This should only be used if you are certain the new picture has the same type, dimensions etc.
|
||||
*
|
||||
* @return negative if the given handle doesn't exist, the filename was empty or the slot is still locked
|
||||
* @return the bitmap_handle on success
|
||||
*/
|
||||
int bm_reload(int bitmap_handle, char* filename)
|
||||
{
|
||||
if ( !bm_inited )
|
||||
bm_init();
|
||||
|
||||
// if no file was passed then get out now
|
||||
if ( (filename == NULL) || (strlen(filename) <= 0) )
|
||||
return -1;
|
||||
|
||||
int bitmapnum = bitmap_handle % MAX_BITMAPS;
|
||||
|
||||
if ( bm_bitmaps[bitmapnum].type == BM_TYPE_NONE )
|
||||
return -1;
|
||||
|
||||
if ( bm_bitmaps[bitmapnum].ref_count )
|
||||
{
|
||||
nprintf(("BmpMan", "Trying to reload a bitmap that is still locked. Filename: %s, ref_count: %d", bm_bitmaps[bitmapnum].filename, bm_bitmaps[bitmapnum].ref_count));
|
||||
return -1;
|
||||
}
|
||||
|
||||
strncpy(bm_bitmaps[bitmapnum].filename, filename, MAX_FILENAME_LEN);
|
||||
return bitmap_handle;
|
||||
}
|
||||
|
||||
DCF(bm_frag,"Shows BmpMan fragmentation")
|
||||
{
|
||||
if ( Dc_command ) {
|
||||
@@ -1649,7 +1616,7 @@ MONITOR( SizeBitmapPage )
|
||||
*
|
||||
* Only lock a bitmap when you need it! This will convert it into the appropriate format also.
|
||||
*/
|
||||
bitmap * bm_lock( int handle, ubyte bpp, ubyte flags, bool nodebug)
|
||||
bitmap * bm_lock( int handle, ubyte bpp, ubyte flags )
|
||||
{
|
||||
bitmap *bmp;
|
||||
bitmap_entry *be;
|
||||
@@ -1709,7 +1676,7 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags, bool nodebug)
|
||||
#endif
|
||||
|
||||
// read the file data
|
||||
if ( gr_bm_lock( be->filename, handle, bitmapnum, bpp, flags, nodebug ) == -1 ) {
|
||||
if ( gr_bm_lock( be->filename, handle, bitmapnum, bpp, flags ) == -1 ) {
|
||||
// oops, this isn't good - reset and return NULL
|
||||
bm_unlock( bitmapnum );
|
||||
bm_unload( bitmapnum );
|
||||
@@ -1920,11 +1887,10 @@ int bm_release(int handle, int clear_render_targets)
|
||||
*
|
||||
* @param handle index into ::bm_bitmaps ( index returned from bm_load() or bm_create() )
|
||||
* @param clear_render_targets Whether to release a render target
|
||||
* @param nodebug Exclude certain debug messages
|
||||
*
|
||||
* @return 1 on successful release, 0 otherwise
|
||||
*/
|
||||
int bm_unload( int handle, int clear_render_targets, bool nodebug )
|
||||
int bm_unload( int handle, int clear_render_targets )
|
||||
{
|
||||
bitmap_entry *be;
|
||||
bitmap *bmp;
|
||||
@@ -1946,7 +1912,7 @@ int bm_unload( int handle, int clear_render_targets, bool nodebug )
|
||||
Assert( be->handle == handle ); // INVALID BITMAP HANDLE!
|
||||
|
||||
// If it is locked, cannot free it.
|
||||
if (be->ref_count != 0 && !nodebug) {
|
||||
if (be->ref_count != 0) {
|
||||
nprintf(("BmpMan", "Tried to unload %s that has a lock count of %d.. not unloading\n", be->filename, be->ref_count));
|
||||
return 0;
|
||||
}
|
||||
@@ -1958,7 +1924,7 @@ int bm_unload( int handle, int clear_render_targets, bool nodebug )
|
||||
if ( be->load_count > 0 )
|
||||
be->load_count--;
|
||||
|
||||
if ( be->load_count != 0 && !nodebug) {
|
||||
if ( be->load_count != 0 ) {
|
||||
nprintf(("BmpMan", "Tried to unload %s that has a load count of %d.. not unloading\n", be->filename, be->load_count + 1));
|
||||
return 0;
|
||||
}
|
||||
@@ -1974,13 +1940,11 @@ int bm_unload( int handle, int clear_render_targets, bool nodebug )
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < bm_bitmaps[first].info.ani.num_frames; i++) {
|
||||
if(!nodebug)
|
||||
nprintf(("BmpMan", "Unloading %s frame %d. %dx%dx%d\n", be->filename, i, bmp->w, bmp->h, bmp->bpp));
|
||||
nprintf(("BmpMan", "Unloading %s frame %d. %dx%dx%d\n", be->filename, i, bmp->w, bmp->h, bmp->bpp));
|
||||
bm_free_data(first+i); // clears flags, bbp, data, etc
|
||||
}
|
||||
} else {
|
||||
if(!nodebug)
|
||||
nprintf(("BmpMan", "Unloading %s. %dx%dx%d\n", be->filename, bmp->w, bmp->h, bmp->bpp));
|
||||
nprintf(("BmpMan", "Unloading %s. %dx%dx%d\n", be->filename, bmp->w, bmp->h, bmp->bpp));
|
||||
bm_free_data(n); // clears flags, bbp, data, etc
|
||||
}
|
||||
|
||||
@@ -2253,6 +2217,7 @@ void bm_page_in_start()
|
||||
gr_bm_page_in_start();
|
||||
}
|
||||
|
||||
extern int Multi_ping_timestamp;
|
||||
extern void multi_ping_send_all();
|
||||
|
||||
void bm_page_in_stop()
|
||||
@@ -2285,7 +2250,15 @@ void bm_page_in_stop()
|
||||
|
||||
n++;
|
||||
|
||||
multi_send_anti_timeout_ping();
|
||||
// send out a ping if we are multi so that psnet2 doesn't kill us off for a long load
|
||||
// NOTE that we can't use the timestamp*() functions here since they won't increment
|
||||
// during this loading process
|
||||
if (Game_mode & GM_MULTIPLAYER) {
|
||||
if ( (Multi_ping_timestamp == -1) || (Multi_ping_timestamp <= timer_get_milliseconds()) ) {
|
||||
multi_ping_send_all();
|
||||
Multi_ping_timestamp = timer_get_milliseconds() + 10000; // timeout is 10 seconds between pings
|
||||
}
|
||||
}
|
||||
|
||||
if ( (bm_bitmaps[i].info.ani.first_frame == 0) || (bm_bitmaps[i].info.ani.first_frame == i) ) {
|
||||
#ifndef NDEBUG
|
||||
@@ -2838,23 +2811,14 @@ int bm_set_render_target(int handle, int face)
|
||||
//if we are moving from the back buffer to a texture save whatever the current settings are
|
||||
gr_screen.save_max_w = gr_screen.max_w;
|
||||
gr_screen.save_max_h = gr_screen.max_h;
|
||||
|
||||
gr_screen.save_max_w_unscaled = gr_screen.max_w_unscaled;
|
||||
gr_screen.save_max_h_unscaled = gr_screen.max_h_unscaled;
|
||||
}
|
||||
|
||||
if (n < 0) {
|
||||
gr_screen.max_w = gr_screen.save_max_w;
|
||||
gr_screen.max_h = gr_screen.save_max_h;
|
||||
|
||||
gr_screen.max_w_unscaled = gr_screen.save_max_w_unscaled;
|
||||
gr_screen.max_h_unscaled = gr_screen.save_max_h_unscaled;
|
||||
} else {
|
||||
gr_screen.max_w = bm_bitmaps[n].bm.w;
|
||||
gr_screen.max_h = bm_bitmaps[n].bm.h;
|
||||
|
||||
gr_screen.max_w_unscaled = bm_bitmaps[n].bm.w;
|
||||
gr_screen.max_h_unscaled = bm_bitmaps[n].bm.h;
|
||||
}
|
||||
|
||||
gr_screen.rendering_to_face = face;
|
||||
|
||||
@@ -109,7 +109,7 @@ int bm_create( int bpp, int w, int h, void *data = NULL, int flags = 0);
|
||||
// Frees up a bitmap's data, but bitmap number 'n' can
|
||||
// still be used, it will just have to be paged in next
|
||||
// time it is locked.
|
||||
int bm_unload( int n, int clear_render_targets = 0, bool nodebug = false);
|
||||
int bm_unload( int n, int clear_render_targets = 0 );
|
||||
|
||||
// like bm_unload() except that it's safe to use to free data without worrying about
|
||||
// load_count so it's safe to use in relation to bm_release() and in gr_*_texture functions
|
||||
@@ -133,7 +133,7 @@ extern int bm_load_either(char *filename, int *nframes = NULL, int *fps = NULL,
|
||||
// that can be accessed until you call bm_unlock. Only lock
|
||||
// a bitmap when you need it! This will convert it into the
|
||||
// appropriate format also.
|
||||
extern bitmap * bm_lock( int bitmapnum, ubyte bpp, ubyte flags, bool nodebug = false);
|
||||
extern bitmap * bm_lock( int bitmapnum, ubyte bpp, ubyte flags );
|
||||
|
||||
// The signature is a field that gets filled in with
|
||||
// a unique signature for each bitmap. The signature for each bitmap
|
||||
@@ -172,9 +172,6 @@ void bm_gfx_get_pixel( int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *
|
||||
// nnew = number of bytes of bitmaps locked this frame that weren't locked last frame
|
||||
void bm_get_frame_usage(int *ntotal, int *nnew);
|
||||
|
||||
// Reload a different image into an existing bmpman slot
|
||||
int bm_reload(int bitmap_handle, char* filename);
|
||||
|
||||
/*
|
||||
* Example on using bm_create
|
||||
*
|
||||
@@ -270,7 +267,6 @@ extern int SPECMAP; //this holds a reference to a map that is for specular mappi
|
||||
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
|
||||
extern int MISCMAP; // Utility map, to be utilized for various things shader authors can come up with
|
||||
|
||||
int bm_is_compressed(int num);
|
||||
int bm_get_tcache_type(int num);
|
||||
@@ -284,5 +280,4 @@ int bm_make_render_target( int width, int height, int flags );
|
||||
int bm_is_render_target(int bitmap_id);
|
||||
int bm_set_render_target(int handle, int face = -1);
|
||||
|
||||
int bm_load_and_parse_eff(char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type);
|
||||
#endif
|
||||
+11
-124
@@ -10,8 +10,6 @@
|
||||
#include "playerman/player.h" //player_get_padlock_orient
|
||||
#include "ship/ship.h" //compute_slew_matrix
|
||||
#include "graphics/font.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
#include "globalincs/linklist.h"
|
||||
|
||||
//*************************IMPORTANT GLOBALS*************************
|
||||
float VIEWER_ZOOM_DEFAULT = 0.75f; // Default viewer zoom, 0.625 as per multi-lateral agreement on 3/24/97
|
||||
@@ -111,27 +109,6 @@ void camera::set_object_host(object *objp, int n_object_host_submodel)
|
||||
|
||||
object_host = object_h(objp);
|
||||
object_host_submodel = n_object_host_submodel;
|
||||
set_custom_position_function(NULL);
|
||||
set_custom_orientation_function(NULL);
|
||||
if(n_object_host_submodel > 0)
|
||||
{
|
||||
if(objp->type == OBJ_SHIP)
|
||||
{
|
||||
ship_subsys* ssp = GET_FIRST(&Ships[objp->instance].subsys_list);
|
||||
while ( ssp != END_OF_LIST( &Ships[objp->instance].subsys_list ) )
|
||||
{
|
||||
if(ssp->system_info->subobj_num == n_object_host_submodel)
|
||||
{
|
||||
if(ssp->system_info->type == SUBSYSTEM_TURRET)
|
||||
{
|
||||
set_custom_position_function(get_turret_cam_pos);
|
||||
set_custom_orientation_function(get_turret_cam_orient);
|
||||
}
|
||||
}
|
||||
ssp = GET_NEXT( ssp );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void camera::set_object_target(object *objp, int n_object_target_submodel)
|
||||
@@ -163,8 +140,6 @@ void camera::set_custom_orientation_function(void (*n_func_custom_orientation)(c
|
||||
|
||||
void camera::set_position(vec3d *in_position, float in_translation_time, float in_translation_acceleration_time, float in_translation_deceleration_time, float in_end_velocity)
|
||||
{
|
||||
if (in_position == NULL)
|
||||
return;
|
||||
if(in_translation_time == 0.0f && in_translation_acceleration_time == 0.0f && in_translation_deceleration_time == 0.0f)
|
||||
{
|
||||
c_pos = *in_position;
|
||||
@@ -198,9 +173,6 @@ void camera::set_translation_velocity(vec3d *in_velocity, float in_acceleration_
|
||||
|
||||
void camera::set_rotation(matrix *in_orientation, float in_rotation_time, float in_rotation_acceleration_time, float in_rotation_deceleration_time)
|
||||
{
|
||||
if (in_orientation == NULL)
|
||||
return;
|
||||
|
||||
if(in_rotation_time == 0.0f && in_rotation_acceleration_time == 0.0f && in_rotation_deceleration_time == 0.0f)
|
||||
{
|
||||
c_ori = *in_orientation;
|
||||
@@ -298,14 +270,11 @@ float camera::get_fov()
|
||||
return c_fov;
|
||||
}
|
||||
|
||||
eye* get_submodel_eye(polymodel *pm, int submodel_num);
|
||||
void camera::get_info(vec3d *position, matrix *orientation)
|
||||
{
|
||||
if(position == NULL && orientation == NULL)
|
||||
return;
|
||||
|
||||
eye* eyep = NULL;
|
||||
vec3d host_normal;
|
||||
|
||||
//POSITION
|
||||
if(!(flags & CAM_STATIONARY_POS) || object_host.IsValid())
|
||||
{
|
||||
@@ -334,18 +303,7 @@ void camera::get_info(vec3d *position, matrix *orientation)
|
||||
}
|
||||
else
|
||||
{
|
||||
eyep = get_submodel_eye(pm, object_host_submodel);
|
||||
if(eyep)
|
||||
{
|
||||
vec3d c_pos_in;
|
||||
find_submodel_instance_point_normal( &c_pos_in, &host_normal, objp, eyep->parent, &eyep->pnt, &eyep->norm);
|
||||
vm_vec_unrotate(&c_pos, &c_pos_in, &objp->orient);
|
||||
vm_vec_add2(&c_pos, &objp->pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
model_find_world_point( &c_pos, &pt, pm->id, object_host_submodel, &objp->orient, &objp->pos );
|
||||
}
|
||||
model_find_world_point( &c_pos, &pt, pm->id, object_host_submodel, &objp->orient, &objp->pos );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -354,7 +312,7 @@ void camera::get_info(vec3d *position, matrix *orientation)
|
||||
}
|
||||
|
||||
//Do custom position stuff, if needed
|
||||
if(func_custom_position != NULL && !eyep)
|
||||
if(func_custom_position != NULL)
|
||||
{
|
||||
func_custom_position(this, &c_pos);
|
||||
}
|
||||
@@ -366,7 +324,6 @@ void camera::get_info(vec3d *position, matrix *orientation)
|
||||
//ORIENTATION
|
||||
if(orientation != NULL)
|
||||
{
|
||||
bool target_set = false;
|
||||
if(!(flags & CAM_STATIONARY_ORI) || object_target.IsValid() || object_host.IsValid())
|
||||
{
|
||||
if(object_target.IsValid())
|
||||
@@ -396,19 +353,10 @@ void camera::get_info(vec3d *position, matrix *orientation)
|
||||
vec3d targetvec;
|
||||
vm_vec_normalized_dir(&targetvec, &target_pos, &c_pos);
|
||||
vm_vector_2_matrix(&c_ori, &targetvec, NULL, NULL);
|
||||
target_set = true;
|
||||
}
|
||||
else if(object_host.IsValid())
|
||||
{
|
||||
if(eyep)
|
||||
{
|
||||
vm_vector_2_matrix(&c_ori, &host_normal, vm_vec_same(&host_normal, &object_host.objp->orient.vec.uvec)?NULL:&object_host.objp->orient.vec.uvec, NULL);
|
||||
target_set = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
c_ori = object_host.objp->orient;
|
||||
}
|
||||
c_ori = object_host.objp->orient;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -428,7 +376,7 @@ void camera::get_info(vec3d *position, matrix *orientation)
|
||||
vm_orthogonalize_matrix(&c_ori);
|
||||
}
|
||||
//Do custom orientation stuff, if needed
|
||||
if(func_custom_orientation != NULL && !target_set)
|
||||
if(func_custom_orientation != NULL)
|
||||
{
|
||||
func_custom_orientation(this, &c_ori);
|
||||
}
|
||||
@@ -982,15 +930,12 @@ bool cam_set_camera(camid cid)
|
||||
Viewer_mode |= VM_FREECAMERA;
|
||||
Current_camera = cid;
|
||||
|
||||
if (!Cutscene_camera_displays_hud)
|
||||
if(!Camera_hud_draw_saved)
|
||||
{
|
||||
if(!Camera_hud_draw_saved)
|
||||
{
|
||||
Camera_hud_draw_value = hud_get_draw();
|
||||
Camera_hud_draw_saved = true;
|
||||
}
|
||||
hud_set_draw(0);
|
||||
Camera_hud_draw_value = hud_get_draw();
|
||||
Camera_hud_draw_saved = true;
|
||||
}
|
||||
hud_set_draw(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -998,11 +943,8 @@ void cam_reset_camera()
|
||||
{
|
||||
Viewer_mode &= ~VM_FREECAMERA;
|
||||
|
||||
if (!Cutscene_camera_displays_hud)
|
||||
{
|
||||
hud_set_draw(Camera_hud_draw_value);
|
||||
Camera_hud_draw_saved = false;
|
||||
}
|
||||
hud_set_draw(Camera_hud_draw_value);
|
||||
Camera_hud_draw_saved = false;
|
||||
}
|
||||
|
||||
void subtitles_close()
|
||||
@@ -1028,59 +970,4 @@ void subtitles_do_frame_post_shaded(float frametime)
|
||||
if ( sub->is_post_shaded( ) )
|
||||
sub->do_frame(frametime);
|
||||
}
|
||||
}
|
||||
|
||||
vec3d normal_cache;
|
||||
|
||||
void get_turret_cam_pos(camera *cam, vec3d *pos)
|
||||
{
|
||||
object_h obj(cam->get_object_host());
|
||||
if(!obj.IsValid())
|
||||
return;
|
||||
ship* shipp = &Ships[cam->get_object_host()->instance];
|
||||
ship_subsys* ssp = GET_FIRST(&shipp->subsys_list);
|
||||
while ( ssp != END_OF_LIST( &shipp->subsys_list ) )
|
||||
{
|
||||
if(ssp->system_info->subobj_num == cam->get_object_host_submodel())
|
||||
{
|
||||
ship_get_global_turret_gun_info(cam->get_object_host(), ssp, pos, &normal_cache, 1, NULL);
|
||||
vec3d offset = vmd_zero_vector;
|
||||
offset.xyz.x = 0.0001f;
|
||||
vm_vec_add2(pos, &offset); // prevent beam turrets from crashing with a nullvec
|
||||
break;
|
||||
}
|
||||
ssp = GET_NEXT( ssp );
|
||||
}
|
||||
}
|
||||
|
||||
void get_turret_cam_orient(camera *cam, matrix *ori)
|
||||
{
|
||||
object_h obj(cam->get_object_host());
|
||||
if(!obj.IsValid())
|
||||
return;
|
||||
vm_vector_2_matrix(ori, &normal_cache, vm_vec_same(&normal_cache, &cam->get_object_host()->orient.vec.uvec)?NULL:&cam->get_object_host()->orient.vec.uvec, NULL);
|
||||
}
|
||||
|
||||
eye* get_submodel_eye(polymodel *pm, int submodel_num)
|
||||
{
|
||||
if(pm->n_view_positions > 0)
|
||||
{
|
||||
for(int i = 0; i < pm->n_view_positions; ++i)
|
||||
{
|
||||
if(pm->view_positions[i].parent == submodel_num)
|
||||
{
|
||||
return &pm->view_positions[i];
|
||||
}
|
||||
int sm = pm->submodel[submodel_num].first_child;
|
||||
while(sm > 0) //look for eyepoints attached to children, important for turret arms
|
||||
{
|
||||
if(pm->view_positions[i].parent == sm)
|
||||
{
|
||||
return &pm->view_positions[i];
|
||||
}
|
||||
sm = pm->submodel[sm].next_sibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -168,9 +168,6 @@ camid cam_get_camera(uint index);
|
||||
camid cam_get_current();
|
||||
uint cam_get_num();
|
||||
|
||||
void get_turret_cam_pos(camera *cam, vec3d *pos);
|
||||
void get_turret_cam_orient(camera *cam, matrix *ori);
|
||||
|
||||
void subtitles_close();
|
||||
void subtitles_do_frame(float frametime);
|
||||
void subtitles_do_frame_post_shaded(float frametime);
|
||||
|
||||
@@ -1730,8 +1730,7 @@ int cf_chksum_pack(char *filename, uint *chk_long, bool full)
|
||||
else {
|
||||
CLAMP(max_size, 0, safe_size);
|
||||
|
||||
Assertion(max_size > header_offset,
|
||||
"max_size (%d) > header_offset in packfile %s", max_size, filename);
|
||||
Assert( max_size > header_offset );
|
||||
max_size -= header_offset;
|
||||
|
||||
fseek(fp, -(max_size), SEEK_END);
|
||||
|
||||
+37
-49
@@ -818,25 +818,18 @@ void cf_free_secondary_filelist()
|
||||
Num_files = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for a file.
|
||||
*
|
||||
* @note Follows all rules and precedence and searches CD's and pack files.
|
||||
*
|
||||
* @param filespec Filename & extension
|
||||
* @param pathtype See CF_TYPE_ defines in CFILE.H
|
||||
* @param max_out Maximum string length that should be stuffed into pack_filename
|
||||
* @param pack_filename OUTPUT: Absolute path and filename of this file. Could be a packfile or the actual file.
|
||||
* @param size OUTPUT: File size
|
||||
* @param offset OUTPUT: Offset into pack file. 0 if not a packfile.
|
||||
* @param localize Undertake localization
|
||||
*
|
||||
* @return If not found returns 0.
|
||||
*/
|
||||
// Searches for a file. Follows all rules and precedence and searches
|
||||
// CD's and pack files.
|
||||
// Input: filespace - Filename & extension
|
||||
// pathtype - See CF_TYPE_ defines in CFILE.H
|
||||
// max_out - Maximum string length that should be stuffed into pack_filename
|
||||
// Output: pack_filename - Absolute path and filename of this file. Could be a packfile or the actual file.
|
||||
// size - File size
|
||||
// offset - Offset into pack file. 0 if not a packfile.
|
||||
// Returns: If not found returns 0.
|
||||
int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
|
||||
{
|
||||
int i;
|
||||
uint ui;
|
||||
uint i;
|
||||
int cfs_slow_search = 0;
|
||||
char longname[MAX_PATH_LEN];
|
||||
|
||||
@@ -881,7 +874,7 @@ int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack
|
||||
if ( CF_TYPE_SPECIFIED(pathtype) ) {
|
||||
search_order[num_search_dirs++] = pathtype;
|
||||
} else {
|
||||
for (i = CF_TYPE_ROOT; i < CF_MAX_PATH_TYPES; i++) {
|
||||
for (int i = CF_TYPE_ROOT; i < CF_MAX_PATH_TYPES; i++) {
|
||||
if (i != pathtype)
|
||||
search_order[num_search_dirs++] = i;
|
||||
}
|
||||
@@ -890,8 +883,8 @@ int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack
|
||||
memset( longname, 0, sizeof(longname) );
|
||||
|
||||
|
||||
for (ui=0; ui<num_search_dirs; ui++ ) {
|
||||
switch (search_order[ui])
|
||||
for (i=0; i<num_search_dirs; i++ ) {
|
||||
switch (search_order[i])
|
||||
{
|
||||
case CF_TYPE_ROOT:
|
||||
case CF_TYPE_DATA:
|
||||
@@ -910,7 +903,7 @@ int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack
|
||||
}
|
||||
|
||||
if (cfs_slow_search) {
|
||||
cf_create_default_path_string( longname, sizeof(longname)-1, search_order[ui], filespec, localize );
|
||||
cf_create_default_path_string( longname, sizeof(longname)-1, search_order[i], filespec, localize );
|
||||
|
||||
#if defined _WIN32
|
||||
findhandle = _findfirst(longname, &findstruct);
|
||||
@@ -951,8 +944,9 @@ int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack
|
||||
}
|
||||
|
||||
// Search the pak files and CD-ROM.
|
||||
for (ui = 0; ui < Num_files; ui++ ) {
|
||||
cf_file *f = cf_get_file(ui);
|
||||
|
||||
for (i = 0; i < Num_files; i++ ) {
|
||||
cf_file *f = cf_get_file(i);
|
||||
|
||||
// only search paths we're supposed to...
|
||||
if ( (pathtype != CF_TYPE_ANY) && (pathtype != f->pathtype_index) )
|
||||
@@ -1026,28 +1020,22 @@ int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack
|
||||
// -- from parselo.cpp --
|
||||
extern char *stristr(const char *str, const char *substr);
|
||||
|
||||
/**
|
||||
* Searches for a file.
|
||||
*
|
||||
* @note Follows all rules and precedence and searches CD's and pack files. Searches all locations in order for first filename using filter list.
|
||||
* @note This function is exponentially slow, so don't use it unless truely needed
|
||||
*
|
||||
* @param filename Filename & extension
|
||||
* @param ext_num Number of extensions to look for
|
||||
* @param ext_list Extension filter list
|
||||
* @param pathtype See CF_TYPE_ defines in CFILE.H
|
||||
* @param max_out Maximum string length that should be stuffed into pack_filename
|
||||
* @param pack_filename OUTPUT: Absolute path and filename of this file. Could be a packfile or the actual file.
|
||||
* @param size OUTPUT: File size
|
||||
* @param offset OUTPUT: Offset into pack file. 0 if not a packfile.
|
||||
* @param localize Undertake localization
|
||||
*
|
||||
* @return If not found returns -1, else returns offset into ext_list.
|
||||
*/
|
||||
// Searches for a file. Follows all rules and precedence and searches
|
||||
// CD's and pack files. Searches all locations in order for first filename using filter list.
|
||||
// Input: filename - Filename & extension
|
||||
// ext_num - number of extensions to look for
|
||||
// ext_list - extension filter list
|
||||
// pathtype - See CF_TYPE_ defines in CFILE.H
|
||||
// max_out - Maximum string length that should be stuffed into pack_filename
|
||||
// Output: pack_filename - Absolute path and filename of this file. Could be a packfile or the actual file.
|
||||
// size - File size
|
||||
// offset - Offset into pack file. 0 if not a packfile.
|
||||
// Returns: If not found returns -1, else returns offset into ext_list.
|
||||
// (NOTE: This function is exponentially slow, so don't use it unless truely needed!!)
|
||||
int cf_find_file_location_ext( char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
|
||||
{
|
||||
int cur_ext, i;
|
||||
uint ui;
|
||||
uint i;
|
||||
int cur_ext;
|
||||
int cfs_slow_search = 0;
|
||||
char longname[MAX_PATH_LEN];
|
||||
char filespec[MAX_FILENAME_LEN];
|
||||
@@ -1081,7 +1069,7 @@ int cf_find_file_location_ext( char *filename, const int ext_num, const char **e
|
||||
if ( CF_TYPE_SPECIFIED(pathtype) ) {
|
||||
search_order[num_search_dirs++] = pathtype;
|
||||
} else {
|
||||
for (i = CF_TYPE_ROOT; i < CF_MAX_PATH_TYPES; i++)
|
||||
for (int i = CF_TYPE_ROOT; i < CF_MAX_PATH_TYPES; i++)
|
||||
search_order[num_search_dirs++] = i;
|
||||
}
|
||||
|
||||
@@ -1091,14 +1079,14 @@ int cf_find_file_location_ext( char *filename, const int ext_num, const char **e
|
||||
// strip any existing extension
|
||||
strncpy(filespec, filename, MAX_FILENAME_LEN-1);
|
||||
|
||||
for (ui = 0; ui < num_search_dirs; ui++) {
|
||||
for (i = 0; i < num_search_dirs; i++) {
|
||||
// always hit the disk if we are looking in only one path
|
||||
if (num_search_dirs == 1) {
|
||||
cfs_slow_search = 1;
|
||||
}
|
||||
// otherwise hit based on a directory type
|
||||
else {
|
||||
switch (search_order[ui])
|
||||
switch (search_order[i])
|
||||
{
|
||||
case CF_TYPE_ROOT:
|
||||
case CF_TYPE_DATA:
|
||||
@@ -1125,7 +1113,7 @@ int cf_find_file_location_ext( char *filename, const int ext_num, const char **e
|
||||
|
||||
strcat_s( filespec, ext_list[cur_ext] );
|
||||
|
||||
cf_create_default_path_string( longname, sizeof(longname)-1, search_order[ui], filespec, localize );
|
||||
cf_create_default_path_string( longname, sizeof(longname)-1, search_order[i], filespec, localize );
|
||||
|
||||
#if defined _WIN32
|
||||
findhandle = _findfirst(longname, &findstruct);
|
||||
@@ -1188,8 +1176,8 @@ int cf_find_file_location_ext( char *filename, const int ext_num, const char **e
|
||||
file_list_index.reserve( MIN(ext_num * 4, (int)Num_files) );
|
||||
|
||||
// next, run though and pick out base matches
|
||||
for (ui = 0; ui < Num_files; ui++) {
|
||||
cf_file *f = cf_get_file(ui);
|
||||
for (i = 0; i < Num_files; i++) {
|
||||
cf_file *f = cf_get_file(i);
|
||||
|
||||
// ... only search paths that we're supposed to
|
||||
if ( (num_search_dirs == 1) && (pathtype != f->pathtype_index) )
|
||||
|
||||
+39
-108
@@ -113,19 +113,20 @@ typedef struct
|
||||
// Please group them by type, ie graphics, gameplay etc, maximum 20 different types
|
||||
Flag exe_params[] =
|
||||
{
|
||||
{ "-nospec", "Disable specular", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-spec", },
|
||||
{ "-noglow", "Disable glow maps", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-glow", },
|
||||
{ "-noenv", "Disable environment maps", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-env", },
|
||||
{ "-spec", "Enable specular", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-spec", },
|
||||
{ "-glow", "Enable glow maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-glow", },
|
||||
{ "-env", "Enable environment maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-env", },
|
||||
{ "-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", },
|
||||
{ "-nonormal", "Disable normal maps", true, 0, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-normal" },
|
||||
{ "-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_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dshockwave" },
|
||||
{ "-post_process", "Enable post processing", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-post_process" },
|
||||
{ "-soft_particles", "Enable soft particles", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-soft_particles" },
|
||||
{ "-fxaa", "Enable FXAA anti-aliasing", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fxaa" },
|
||||
{ "-nolightshafts", "Disable lightshafts", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
|
||||
{ "-flightshaftsoff", "Force Lightshafts off", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
|
||||
|
||||
{ "-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", },
|
||||
{ "-cache_bitmaps", "Cache bitmaps between missions", true, 0, EASY_DEFAULT_MEM, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-cache_bitmaps", },
|
||||
|
||||
@@ -171,7 +172,6 @@ Flag exe_params[] =
|
||||
{ "-disable_di_mouse", "Don't use DirectInput for mouse control", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
#endif
|
||||
{ "-use_gldrawelements","Don't use glDrawRangeElements", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
{ "-old_collision", "Use old collision detection system", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
|
||||
|
||||
{ "-ingame_join", "Allow in-game joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
|
||||
{ "-voicer", "Enable voice recognition", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-voicer", },
|
||||
@@ -256,16 +256,16 @@ cmdline_parm ogl_spec_arg("-ogl_spec", NULL); // Cmdline_ogl_spec
|
||||
cmdline_parm spec_static_arg("-spec_static", NULL);
|
||||
cmdline_parm spec_point_arg("-spec_point", NULL);
|
||||
cmdline_parm spec_tube_arg("-spec_tube", NULL);
|
||||
cmdline_parm ambient_factor_arg("-ambient_factor", NULL); // Cmdline_ambient_factor
|
||||
cmdline_parm env("-noenv", NULL); // Cmdline_env
|
||||
cmdline_parm ambient_factor_arg("-ambient_factor", NULL); // Cmdline_ambient_factor
|
||||
cmdline_parm env("-env", NULL); // Cmdline_env
|
||||
cmdline_parm missile_lighting_arg("-missile_lighting", NULL); // Cmdline_missile_lighting
|
||||
cmdline_parm glow_arg("-noglow", NULL); // Cmdline_glow -- use Bobs glow code
|
||||
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
|
||||
cmdline_parm noscalevid_arg("-noscalevid", NULL); // Cmdline_noscalevid -- disable video scaling that fits to window
|
||||
cmdline_parm spec_arg("-nospec", NULL); // Cmdline_spec --
|
||||
cmdline_parm glow_arg("-glow", NULL); // Cmdline_glow -- use Bobs glow code
|
||||
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
|
||||
cmdline_parm noscalevid_arg("-noscalevid", NULL); // Cmdline_noscalevid -- disable video scaling that fits to window
|
||||
cmdline_parm spec_arg("-spec", NULL); // Cmdline_spec -- use specular highlighting -Sticks
|
||||
cmdline_parm noemissive_arg("-no_emissive_light", NULL); // Cmdline_no_emissive -- don't use emissive light in OGL
|
||||
cmdline_parm normal_arg("-nonormal", NULL); // Cmdline_normal -- disable normal mapping
|
||||
cmdline_parm height_arg("-noheight", NULL); // Cmdline_height -- enable support for parallax mapping
|
||||
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 softparticles_arg("-soft_particles", NULL);
|
||||
cmdline_parm postprocess_arg("-post_process", NULL);
|
||||
@@ -273,22 +273,22 @@ cmdline_parm bloom_intensity_arg("-bloom_intensity", NULL);
|
||||
cmdline_parm fxaa_arg("-fxaa", NULL);
|
||||
cmdline_parm fxaa_preset_arg("-fxaa_preset", NULL);
|
||||
cmdline_parm fb_explosions_arg("-fb_explosions", NULL);
|
||||
cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL);
|
||||
cmdline_parm flightshaftsoff_arg("-flightshaftsoff", NULL);
|
||||
|
||||
float Cmdline_clip_dist = Default_min_draw_distance;
|
||||
float Cmdline_fov = 0.75f;
|
||||
float Cmdline_ogl_spec = 80.0f;
|
||||
int Cmdline_ambient_factor = 128;
|
||||
int Cmdline_env = 1;
|
||||
int Cmdline_env = 0;
|
||||
int Cmdline_mipmap = 0;
|
||||
int Cmdline_missile_lighting = 0;
|
||||
int Cmdline_glow = 1;
|
||||
int Cmdline_glow = 0;
|
||||
int Cmdline_nomotiondebris = 0;
|
||||
int Cmdline_noscalevid = 0;
|
||||
int Cmdline_spec = 1;
|
||||
int Cmdline_spec = 0;
|
||||
int Cmdline_no_emissive = 0;
|
||||
int Cmdline_normal = 1;
|
||||
int Cmdline_height = 1;
|
||||
int Cmdline_normal = 0;
|
||||
int Cmdline_height = 0;
|
||||
int Cmdline_enable_3d_shockwave = 0;
|
||||
int Cmdline_softparticles = 0;
|
||||
int Cmdline_postprocess = 0;
|
||||
@@ -301,10 +301,12 @@ extern bool ls_force_off;
|
||||
|
||||
// Game Speed related
|
||||
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL); // Cmdline_cache_bitmaps
|
||||
cmdline_parm img2dds_arg("-img2dds", NULL); // Cmdline_img2dds
|
||||
cmdline_parm no_fpscap("-no_fps_capping", NULL); // Cmdline_NoFPSCap
|
||||
cmdline_parm no_vsync_arg("-no_vsync", NULL); // Cmdline_no_vsync
|
||||
|
||||
int Cmdline_cache_bitmaps = 0; // caching of bitmaps between missions (faster loads, can hit swap on reload with <512 Meg RAM though) - taylor
|
||||
int Cmdline_img2dds = 0;
|
||||
int Cmdline_NoFPSCap = 0; // Disable FPS capping - kazan
|
||||
int Cmdline_no_vsync = 0;
|
||||
|
||||
@@ -397,7 +399,6 @@ char* Cmdline_keyboard_layout = NULL;
|
||||
|
||||
// Developer/Testing related
|
||||
cmdline_parm start_mission_arg("-start_mission", NULL); // Cmdline_start_mission
|
||||
cmdline_parm old_collision_system("-old_collision", NULL); // Cmdline_new_collision
|
||||
cmdline_parm dis_collisions("-dis_collisions", NULL); // Cmdline_dis_collisions
|
||||
cmdline_parm dis_weapons("-dis_weapons", NULL); // Cmdline_dis_weapons
|
||||
cmdline_parm noparseerrors_arg("-noparseerrors", NULL); // Cmdline_noparseerrors -- turns off parsing errors -C
|
||||
@@ -420,7 +421,6 @@ cmdline_parm no_grab("-nograb", NULL); // Cmdline_no_grab
|
||||
cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL); //Cmdline_reparse_mainhall
|
||||
|
||||
char *Cmdline_start_mission = NULL;
|
||||
int Cmdline_old_collision_sys = 0;
|
||||
int Cmdline_dis_collisions = 0;
|
||||
int Cmdline_dis_weapons = 0;
|
||||
int Cmdline_noparseerrors = 0;
|
||||
@@ -445,20 +445,7 @@ cmdline_parm get_flags_arg("-get_flags", NULL);
|
||||
cmdline_parm output_sexp_arg("-output_sexps", NULL); //WMC - outputs all SEXPs to sexps.html
|
||||
cmdline_parm output_scripting_arg("-output_scripting", NULL); //WMC
|
||||
|
||||
// Deprecated flags - CommanderDJ
|
||||
cmdline_parm deprecated_spec_arg("-spec", NULL);
|
||||
cmdline_parm deprecated_glow_arg("-glow", NULL);
|
||||
cmdline_parm deprecated_normal_arg("-normal", NULL);
|
||||
cmdline_parm deprecated_env_arg("-env", NULL);
|
||||
cmdline_parm deprecated_tbp_arg("-tbp", NULL);
|
||||
cmdline_parm deprecated_jpgtga_arg("-jpgtga", NULL);
|
||||
|
||||
int Cmdline_deprecated_spec = 0;
|
||||
int Cmdline_deprecated_glow = 0;
|
||||
int Cmdline_deprecated_normal = 0;
|
||||
int Cmdline_deprecated_env = 0;
|
||||
int Cmdline_deprecated_tbp = 0;
|
||||
int Cmdline_deprecated_jpgtga = 0;
|
||||
|
||||
#ifndef NDEBUG
|
||||
// NOTE: this assumes that os_init() has already been called but isn't a fatal error if it hasn't
|
||||
@@ -466,6 +453,7 @@ void cmdline_debug_print_cmdline()
|
||||
{
|
||||
cmdline_parm *parmp;
|
||||
int found = 0;
|
||||
|
||||
mprintf(("Passed cmdline options:"));
|
||||
|
||||
for (parmp = GET_FIRST(&Parm_list); parmp !=END_OF_LIST(&Parm_list); parmp = GET_NEXT(parmp) ) {
|
||||
@@ -483,37 +471,6 @@ void cmdline_debug_print_cmdline()
|
||||
mprintf(("\n <none>"));
|
||||
|
||||
mprintf(("\n"));
|
||||
|
||||
//Print log messages about any deprecated flags we found - CommanderDJ
|
||||
if(Cmdline_deprecated_spec == 1)
|
||||
{
|
||||
mprintf(("Deprecated flag '-spec' found. Please remove from your cmdline.\n"));
|
||||
}
|
||||
|
||||
if(Cmdline_deprecated_glow == 1)
|
||||
{
|
||||
mprintf(("Deprecated flag '-glow' found. Please remove from your cmdline.\n"));
|
||||
}
|
||||
|
||||
if(Cmdline_deprecated_normal == 1)
|
||||
{
|
||||
mprintf(("Deprecated flag '-normal' found. Please remove from your cmdline.\n"));
|
||||
}
|
||||
|
||||
if(Cmdline_deprecated_env == 1)
|
||||
{
|
||||
mprintf(("Deprecated flag '-env' found. Please remove from your cmdline.\n"));
|
||||
}
|
||||
|
||||
if(Cmdline_deprecated_tbp == 1)
|
||||
{
|
||||
mprintf(("Deprecated flag '-tbp' found. Please remove from your cmdline.\n"));
|
||||
}
|
||||
|
||||
if(Cmdline_deprecated_jpgtga == 1)
|
||||
{
|
||||
mprintf(("Deprecated flag '-jpgtga' found. Please remove from your cmdline.\n"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1270,7 +1227,7 @@ bool SetCmdlineParams()
|
||||
|
||||
if ( spec_arg.found() )
|
||||
{
|
||||
Cmdline_spec = 0;
|
||||
Cmdline_spec = 1;
|
||||
}
|
||||
|
||||
if ( htl_arg.found() )
|
||||
@@ -1296,11 +1253,12 @@ bool SetCmdlineParams()
|
||||
#endif
|
||||
|
||||
if ( normal_arg.found() ) {
|
||||
Cmdline_normal = 0;
|
||||
}
|
||||
Cmdline_normal = 1;
|
||||
|
||||
if ( height_arg.found() ) {
|
||||
Cmdline_height = 0;
|
||||
// height maps are only used if normal maps are
|
||||
if ( height_arg.found() ) {
|
||||
Cmdline_height = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( noglsl_arg.found() ) {
|
||||
@@ -1325,8 +1283,11 @@ bool SetCmdlineParams()
|
||||
Cmdline_no_di_mouse = 1;
|
||||
}
|
||||
|
||||
if ( img2dds_arg.found() )
|
||||
Cmdline_img2dds = 1;
|
||||
|
||||
if ( glow_arg.found() )
|
||||
Cmdline_glow = 0;
|
||||
Cmdline_glow = 1;
|
||||
|
||||
if ( query_speech_arg.found() )
|
||||
Cmdline_query_speech = 1;
|
||||
@@ -1423,7 +1384,7 @@ bool SetCmdlineParams()
|
||||
}
|
||||
|
||||
if ( env.found() ) {
|
||||
Cmdline_env = 0;
|
||||
Cmdline_env = 1;
|
||||
}
|
||||
|
||||
if ( ballistic_gauge.found() ) {
|
||||
@@ -1434,9 +1395,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_cache_bitmaps = 1;
|
||||
}
|
||||
|
||||
if(old_collision_system.found())
|
||||
Cmdline_old_collision_sys = 1;
|
||||
|
||||
if(dis_collisions.found())
|
||||
Cmdline_dis_collisions = 1;
|
||||
|
||||
@@ -1458,7 +1416,11 @@ bool SetCmdlineParams()
|
||||
if ( ogl_spec_arg.found() ) {
|
||||
Cmdline_ogl_spec = ogl_spec_arg.get_float();
|
||||
|
||||
CLAMP(Cmdline_ogl_spec, 0.0f, 128.0f);
|
||||
if ( Cmdline_ogl_spec < 0.0f )
|
||||
Cmdline_ogl_spec = 0.0f;
|
||||
|
||||
if ( Cmdline_ogl_spec > 128.0f )
|
||||
Cmdline_ogl_spec = 128.0f;
|
||||
}
|
||||
|
||||
if ( rearm_timer_arg.found() )
|
||||
@@ -1519,37 +1481,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_reparse_mainhall = 1;
|
||||
}
|
||||
|
||||
//Deprecated flags - CommanderDJ
|
||||
if( deprecated_spec_arg.found() )
|
||||
{
|
||||
Cmdline_deprecated_spec = 1;
|
||||
}
|
||||
|
||||
if( deprecated_glow_arg.found() )
|
||||
{
|
||||
Cmdline_deprecated_glow = 1;
|
||||
}
|
||||
|
||||
if( deprecated_normal_arg.found() )
|
||||
{
|
||||
Cmdline_deprecated_normal = 1;
|
||||
}
|
||||
|
||||
if( deprecated_env_arg.found() )
|
||||
{
|
||||
Cmdline_deprecated_env = 1;
|
||||
}
|
||||
|
||||
if( deprecated_tbp_arg.found() )
|
||||
{
|
||||
Cmdline_deprecated_tbp = 1;
|
||||
}
|
||||
|
||||
if( deprecated_jpgtga_arg.found() )
|
||||
{
|
||||
Cmdline_deprecated_jpgtga = 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ extern bool Cmdline_fb_explosions;
|
||||
|
||||
// Game Speed related
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
extern int Cmdline_img2dds;
|
||||
extern int Cmdline_NoFPSCap;
|
||||
extern int Cmdline_no_vsync;
|
||||
|
||||
@@ -130,7 +131,6 @@ extern char* Cmdline_keyboard_layout;
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
extern int Cmdline_old_collision_sys;
|
||||
extern int Cmdline_dis_collisions;
|
||||
extern int Cmdline_dis_weapons;
|
||||
extern int Cmdline_noparseerrors;
|
||||
|
||||
@@ -387,7 +387,7 @@ int control_config_detect_axis()
|
||||
|
||||
void control_config_conflict_check()
|
||||
{
|
||||
int i, j, shift = -1, alt = -1;
|
||||
int i, j, a, b, c, shift = -1, alt = -1;
|
||||
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
Conflicts[i].key = Conflicts[i].joy = -1;
|
||||
@@ -410,16 +410,11 @@ void control_config_conflict_check()
|
||||
|
||||
for (i=0; i<CCFG_MAX-1; i++) {
|
||||
for (j=i+1; j<CCFG_MAX; j++) {
|
||||
if ((Control_config[i].key_id >= 0) && (Control_config[i].key_id == Control_config[j].key_id)) {
|
||||
// If one of the conflicting keys is disabled, then this silently clears
|
||||
// the disabled key to prevent the conflict; a conflict is recorded only
|
||||
// if both keys are enabled
|
||||
|
||||
if (Control_config[i].disabled)
|
||||
Control_config[i].key_id = (short) -1;
|
||||
else if (Control_config[j].disabled)
|
||||
Control_config[j].key_id = (short) -1;
|
||||
else {
|
||||
if (Control_config[i].key_id >= 0) {
|
||||
c = 0;
|
||||
a = Control_config[i].key_id;
|
||||
b = Control_config[j].key_id;
|
||||
if (a == b) {
|
||||
Conflicts[i].key = j;
|
||||
Conflicts[j].key = i;
|
||||
Conflicts_tabs[ Control_config[i].tab ] = 1;
|
||||
@@ -428,18 +423,10 @@ void control_config_conflict_check()
|
||||
}
|
||||
|
||||
if ((Control_config[i].joy_id >= 0) && (Control_config[i].joy_id == Control_config[j].joy_id)) {
|
||||
// Same as above
|
||||
|
||||
if (Control_config[i].disabled)
|
||||
Control_config[i].joy_id = (short) -1;
|
||||
else if (Control_config[j].disabled)
|
||||
Control_config[j].joy_id = (short) -1;
|
||||
else {
|
||||
Conflicts[i].joy = j;
|
||||
Conflicts[j].joy = i;
|
||||
Conflicts_tabs[ Control_config[i].tab ] = 1;
|
||||
Conflicts_tabs[ Control_config[j].tab ] = 1;
|
||||
}
|
||||
Conflicts[i].joy = j;
|
||||
Conflicts[j].joy = i;
|
||||
Conflicts_tabs[ Control_config[i].tab ] = 1;
|
||||
Conflicts_tabs[ Control_config[j].tab ] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -467,7 +454,7 @@ void control_config_list_prepare()
|
||||
|
||||
Num_cc_lines = y = z = 0;
|
||||
while (z < CCFG_MAX) {
|
||||
if (Control_config[z].tab == Tab && !Control_config[z].disabled) {
|
||||
if (Control_config[z].tab == Tab) {
|
||||
k = Control_config[z].key_id;
|
||||
j = Control_config[z].joy_id;
|
||||
|
||||
@@ -1623,8 +1610,8 @@ void control_config_do_frame(float frametime)
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
if (Control_config[i].joy_id == j) {
|
||||
z = i;
|
||||
for (size_t buttonid=0; buttonid<NUM_BUTTONS; buttonid++){
|
||||
CC_Buttons[gr_screen.res][buttonid].button.reset();
|
||||
for (j=0; j<NUM_BUTTONS; j++){
|
||||
CC_Buttons[gr_screen.res][j].button.reset();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2113,7 +2100,7 @@ void control_check_indicate()
|
||||
Control_check_count = 0;
|
||||
}
|
||||
|
||||
int check_control_used(int id, int key)
|
||||
int check_control(int id, int key)
|
||||
{
|
||||
int z, mask;
|
||||
static int last_key = 0;
|
||||
@@ -2130,9 +2117,6 @@ int check_control_used(int id, int key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Control_config[id].disabled)
|
||||
return 0;
|
||||
|
||||
if (Control_config[id].type == CC_TYPE_CONTINUOUS) {
|
||||
if (joy_down(Control_config[id].joy_id) || joy_down_count(Control_config[id].joy_id, 1)) {
|
||||
control_used(id);
|
||||
@@ -2168,8 +2152,10 @@ int check_control_used(int id, int key)
|
||||
z &= KEY_MASK;
|
||||
|
||||
if (keyd_pressed[z] || key_down_count(z)) {
|
||||
control_used(id);
|
||||
return 1;
|
||||
if ( !hud_squadmsg_read_key(z) ) {
|
||||
control_used(id);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2185,24 +2171,6 @@ int check_control_used(int id, int key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for check_control_used. Allows the game to ignore the key if told to do so by the ignore-key SEXP.
|
||||
*/
|
||||
int check_control(int id, int key)
|
||||
{
|
||||
if (check_control_used(id, key)) {
|
||||
if (Ignored_keys[id]) {
|
||||
if (Ignored_keys[id] > 0) {
|
||||
Ignored_keys[id]--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get heading, pitch, bank, throttle abs. and throttle rel. values.
|
||||
void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,6 @@ 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
|
||||
bool disabled; // whether this action should be available at all
|
||||
} config_item;
|
||||
|
||||
/**
|
||||
|
||||
@@ -163,10 +163,10 @@ config_item Control_config[CCFG_MAX + 1] = {
|
||||
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber" },
|
||||
|
||||
// multiplayer messaging keys
|
||||
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All" },
|
||||
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly" },
|
||||
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile" },
|
||||
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target" },
|
||||
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, true, "(Multiplayer) Observer Zoom to Target"},
|
||||
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, true, "Increase Time Compression" },
|
||||
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, true, "Decrease Time Compression" },
|
||||
@@ -533,9 +533,6 @@ void control_config_common_load_overrides();
|
||||
// initialize common control config stuff - call at game startup after localization has been initialized
|
||||
void control_config_common_init()
|
||||
{
|
||||
for (int i=0; i<CCFG_MAX; i++)
|
||||
Control_config[i].disabled = false;
|
||||
|
||||
control_config_common_load_overrides();
|
||||
if(Lcl_gr){
|
||||
Scan_code_text = Scan_code_text_german;
|
||||
@@ -628,9 +625,6 @@ void control_config_common_load_overrides()
|
||||
if (optional_string("$Type:"))
|
||||
{stuff_string(szTempBuffer, F_NAME, iBufferLength);
|
||||
r_ccConfig.type = (char)mEnumNameToVal[szTempBuffer];}
|
||||
|
||||
if (optional_string("+Disable"))
|
||||
r_ccConfig.disabled = true;
|
||||
|
||||
// Nerf the buffer now.
|
||||
szTempBuffer[0] = '\0';
|
||||
|
||||
@@ -320,7 +320,7 @@ void cutscenes_screen_play()
|
||||
char str[256];
|
||||
|
||||
if (Cmdline_nomovies)
|
||||
strcpy_s(str, XSTR("Movies are currently disabled.", -1));
|
||||
sprintf(str, XSTR("Movies are currently disabled.", -1));
|
||||
else
|
||||
sprintf(str, XSTR("Unable to play movie %s.", 204), Cutscenes[which_cutscene].name);
|
||||
|
||||
|
||||
@@ -127,7 +127,6 @@ bool movie_play(char *name)
|
||||
} else {
|
||||
// uh-oh, movie is invalid... Abory, Retry, Fail?
|
||||
mprintf(("MOVIE ERROR: Found invalid movie! (%s)\n", name));
|
||||
Mouse_hidden--; // show the mouse cursor!
|
||||
return false;
|
||||
}
|
||||
} else if (rc == MOVIE_MVE) {
|
||||
@@ -144,7 +143,6 @@ bool movie_play(char *name)
|
||||
} else {
|
||||
// uh-oh, movie is invalid... Abory, Retry, Fail?
|
||||
mprintf(("MOVIE ERROR: Found invalid movie! (%s)\n", name));
|
||||
Mouse_hidden--; // show the mouse cursor!
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+24
-44
@@ -21,6 +21,7 @@
|
||||
#include "sound/sound.h"
|
||||
#include "sound/openal.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
//#include "sound/audiostr.h"
|
||||
|
||||
|
||||
extern int Cmdline_noscalevid;
|
||||
@@ -66,13 +67,12 @@ void *g_vBuffers = NULL;
|
||||
void *g_vBackBuf1, *g_vBackBuf2;
|
||||
ushort *pixelbuf = NULL;
|
||||
static GLuint GLtex = 0;
|
||||
static GLfloat gl_screenYH = 0;
|
||||
static GLfloat gl_screenXW = 0;
|
||||
static GLint gl_screenYH = 0;
|
||||
static GLint gl_screenXW = 0;
|
||||
static GLfloat gl_screenU = 0;
|
||||
static GLfloat gl_screenV = 0;
|
||||
static GLfloat glVertices[4][4] = {{0}};
|
||||
static int g_screenWidth, g_screenHeight;
|
||||
static float g_screenX, g_screenY;
|
||||
static int g_screenX, g_screenY;
|
||||
static int g_truecolor = 0;
|
||||
static ubyte g_palette[768];
|
||||
static ubyte *g_pCurMap = NULL;
|
||||
@@ -305,7 +305,7 @@ void mve_audio_play()
|
||||
// call this in shutdown to stop and close audio
|
||||
static void mve_audio_stop()
|
||||
{
|
||||
if (!audiobuf_created || mas == NULL) {
|
||||
if (!audiobuf_created) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -479,12 +479,12 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
}
|
||||
|
||||
if (mve_scale_video) {
|
||||
g_screenX = ((ceil((gr_screen.max_w / scale_by) - 0.5f) - g_width) / 2);
|
||||
g_screenY = ((ceil((gr_screen.max_h / scale_by) - 0.5f) - g_height) / 2);
|
||||
g_screenX = ((fl2i(gr_screen.max_w / scale_by + 0.5f) - g_width) / 2);
|
||||
g_screenY = ((fl2i(gr_screen.max_h / scale_by + 0.5f) - g_height) / 2);
|
||||
} else {
|
||||
// centers on 1024x768, fills on 640x480
|
||||
g_screenX = ((float)(gr_screen.max_w - g_width) / 2.0f);
|
||||
g_screenY = ((float)(gr_screen.max_h - g_height) / 2.0f);
|
||||
g_screenX = ((gr_screen.max_w - g_width) / 2);
|
||||
g_screenY = ((gr_screen.max_h - g_height) / 2);
|
||||
}
|
||||
|
||||
// set additional values for screen width/height and UV coords
|
||||
@@ -495,35 +495,6 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
gl_screenU = i2fl(g_width) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_height) / i2fl(hp2);
|
||||
}
|
||||
|
||||
glVertices[0][0] = g_screenX;
|
||||
glVertices[0][1] = g_screenY;
|
||||
glVertices[0][2] = 0;
|
||||
glVertices[0][3] = 0;
|
||||
|
||||
glVertices[1][0] = g_screenX;
|
||||
glVertices[1][1] = gl_screenYH;
|
||||
glVertices[1][2] = 0;
|
||||
glVertices[1][3] = gl_screenV;
|
||||
|
||||
glVertices[2][0] = gl_screenXW;
|
||||
glVertices[2][1] = g_screenY;
|
||||
glVertices[2][2] = gl_screenU;
|
||||
glVertices[2][3] = 0;
|
||||
|
||||
glVertices[3][0] = gl_screenXW;
|
||||
glVertices[3][1] = gl_screenYH;
|
||||
glVertices[3][2] = gl_screenU;
|
||||
glVertices[3][3] = gl_screenV;
|
||||
|
||||
GL_state.Array.BindArrayBuffer(0);
|
||||
|
||||
GL_state.Array.EnableClientVertex();
|
||||
GL_state.Array.VertexPointer(2, GL_FLOAT, sizeof(glVertices[0]), glVertices);
|
||||
|
||||
GL_state.Array.SetActiveClientUnit(0);
|
||||
GL_state.Array.EnableClientTexture();
|
||||
GL_state.Array.TexPointer(2, GL_FLOAT, sizeof(glVertices[0]), &(glVertices[0][2]));
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -609,12 +580,24 @@ void mve_video_display()
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(g_screenX, g_screenY);
|
||||
|
||||
glTexCoord2f(0, gl_screenV);
|
||||
glVertex2i(g_screenX, gl_screenYH);
|
||||
|
||||
glTexCoord2f(gl_screenU, gl_screenV);
|
||||
glVertex2i(gl_screenXW, gl_screenYH);
|
||||
|
||||
glTexCoord2f(gl_screenU, 0);
|
||||
glVertex2i(gl_screenXW, g_screenY);
|
||||
glEnd();
|
||||
} else {
|
||||
// DDOI - This is probably really fricking slow
|
||||
int bitmap = bm_create (16, g_screenWidth, g_screenHeight, pixelbuf, 0);
|
||||
gr_set_bitmap (bitmap);
|
||||
gr_bitmap ((int)g_screenX, (int)g_screenY, true);
|
||||
gr_bitmap (g_screenX, g_screenY, true);
|
||||
bm_release (bitmap);
|
||||
}
|
||||
|
||||
@@ -700,7 +683,7 @@ int mve_video_init(ubyte *data)
|
||||
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
|
||||
|
||||
// set our color so that we can make sure that it's correct
|
||||
GL_state.Color(255, 255, 255, 255);
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
memset(g_palette, 0, 768);
|
||||
@@ -797,9 +780,6 @@ void mve_play(MVESTREAM *mve)
|
||||
void mve_shutdown()
|
||||
{
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
GL_state.Array.DisableClientVertex();
|
||||
GL_state.Array.DisableClientTexture();
|
||||
|
||||
if (mve_scale_video) {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
+13
-35
@@ -50,7 +50,6 @@ static GLint gl_screenYH = 0;
|
||||
static GLint gl_screenXW = 0;
|
||||
static GLfloat gl_screenU = 0;
|
||||
static GLfloat gl_screenV = 0;
|
||||
static GLfloat glVertices[4][4] = {{0}};
|
||||
|
||||
// video externs from API graphics functions
|
||||
extern void opengl_tcache_get_adjusted_texture_size(int w_in, int h_in, int *w_out, int *h_out);
|
||||
@@ -496,7 +495,7 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
}
|
||||
|
||||
// set our color so that we can make sure that it's correct
|
||||
GL_state.Color(255, 255, 255, 255);
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
if(!use_shaders) {
|
||||
@@ -536,35 +535,6 @@ static void OGG_video_init(theora_info *tinfo)
|
||||
vglUniform1iARB( vglGetUniformLocationARB(shader_id, "utex"), 1 );
|
||||
vglUniform1iARB( vglGetUniformLocationARB(shader_id, "vtex"), 2 );
|
||||
}
|
||||
|
||||
glVertices[0][0] = (GLfloat)g_screenX;
|
||||
glVertices[0][1] = (GLfloat)g_screenY;
|
||||
glVertices[0][2] = 0.0f;
|
||||
glVertices[0][3] = 0.0f;
|
||||
|
||||
glVertices[1][0] = (GLfloat)g_screenX;
|
||||
glVertices[1][1] = (GLfloat)gl_screenYH;
|
||||
glVertices[1][2] = 0.0f;
|
||||
glVertices[1][3] = gl_screenV;
|
||||
|
||||
glVertices[2][0] = (GLfloat)gl_screenXW;
|
||||
glVertices[2][1] = (GLfloat)g_screenY;
|
||||
glVertices[2][2] = gl_screenU;
|
||||
glVertices[2][3] = 0.0f;
|
||||
|
||||
glVertices[3][0] = (GLfloat)gl_screenXW;
|
||||
glVertices[3][1] = (GLfloat)gl_screenYH;
|
||||
glVertices[3][2] = gl_screenU;
|
||||
glVertices[3][3] = gl_screenV;
|
||||
|
||||
GL_state.Array.BindArrayBuffer(0);
|
||||
|
||||
GL_state.Array.EnableClientVertex();
|
||||
GL_state.Array.VertexPointer(2, GL_FLOAT, sizeof(glVertices[0]), glVertices);
|
||||
|
||||
GL_state.Array.SetActiveClientUnit(0);
|
||||
GL_state.Array.EnableClientTexture();
|
||||
GL_state.Array.TexPointer(2, GL_FLOAT, sizeof(glVertices[0]), &(glVertices[0][2]));
|
||||
}
|
||||
if(!use_shaders && tinfo->frame_height > 450) {
|
||||
mprintf(("VIDEO: No shader support and hd video is beeing played this can get choppy."));
|
||||
@@ -579,9 +549,6 @@ static void OGG_video_close()
|
||||
}
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
GL_state.Array.DisableClientVertex();
|
||||
GL_state.Array.DisableClientTexture();
|
||||
|
||||
if (scale_video) {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
@@ -713,8 +680,19 @@ static void OGG_video_draw(theora_state *tstate)
|
||||
} else {
|
||||
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_screenWidth, g_screenHeight, GL_BGR, GL_UNSIGNED_BYTE, pixelbuf);
|
||||
}
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(g_screenX, g_screenY);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glTexCoord2f(0, gl_screenV);
|
||||
glVertex2i(g_screenX, gl_screenYH);
|
||||
|
||||
glTexCoord2f(gl_screenU, gl_screenV);
|
||||
glVertex2i(gl_screenXW, gl_screenYH);
|
||||
|
||||
glTexCoord2f(gl_screenU, 0);
|
||||
glVertex2i(gl_screenXW, g_screenY);
|
||||
glEnd();
|
||||
}
|
||||
Mouse_hidden = 1;
|
||||
gr_flip();
|
||||
|
||||
+7
-19
@@ -28,7 +28,7 @@
|
||||
#include "network/multimsgs.h"
|
||||
#include "network/multiutil.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
|
||||
#define MAX_LIFE 10.0f
|
||||
#define MIN_RADIUS_FOR_PERSISTANT_DEBRIS 50 // ship radius at which debris from it becomes persistant
|
||||
@@ -163,9 +163,7 @@ void debris_render(object * obj)
|
||||
Assert(db->flags & DEBRIS_USED);
|
||||
|
||||
texture_info *tbase = NULL;
|
||||
|
||||
model_clear_instance( db->model_num );
|
||||
|
||||
|
||||
// Swap in a different texture depending on the species
|
||||
if (db->species >= 0)
|
||||
{
|
||||
@@ -179,6 +177,8 @@ void debris_render(object * obj)
|
||||
}
|
||||
}
|
||||
|
||||
model_clear_instance( db->model_num );
|
||||
|
||||
// Only render electrical arcs if within 500m of the eye (for a 10m piece)
|
||||
if ( vm_vec_dist_quick( &obj->pos, &Eye_position ) < obj->radius*50.0f ) {
|
||||
for (i=0; i<MAX_DEBRIS_ARCS; i++ ) {
|
||||
@@ -324,14 +324,8 @@ void debris_process_post(object * obj, float frame_time)
|
||||
int n, n_arcs = ((rand()>>5) % 3)+1; // Create 1-3 sparks
|
||||
|
||||
vec3d v1, v2, v3, v4;
|
||||
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v3, &v4 );
|
||||
} else {
|
||||
submodel_get_two_random_points_better( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
submodel_get_two_random_points_better( db->model_num, db->submodel_num, &v3, &v4 );
|
||||
}
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v3, &v4 );
|
||||
|
||||
n = 0;
|
||||
|
||||
@@ -406,13 +400,7 @@ void debris_process_post(object * obj, float frame_time)
|
||||
int mr = myrand();
|
||||
if ( mr < RAND_MAX/5 ) {
|
||||
vec3d v1, v2;
|
||||
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
} else {
|
||||
submodel_get_two_random_points_better( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
}
|
||||
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
db->arc_pts[i][mr % 2] = v1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ static char* GetFilePart(char *source)
|
||||
//
|
||||
// --------------------
|
||||
|
||||
SCP_string safe_string;
|
||||
extern char safe_string[512];
|
||||
|
||||
// Entry point into the main exception handling routine. This routine is put into an except()
|
||||
// statment at the beginning of a thread and is called anytime that there is a program exception
|
||||
@@ -494,8 +494,8 @@ int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message)
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (!safe_string.empty())
|
||||
hprintf(LogFile, "Last safe point: %s\r\n", safe_string.c_str());
|
||||
if (safe_string[0])
|
||||
hprintf(LogFile, "Last safe point: %s\r\n", safe_string);
|
||||
#endif
|
||||
|
||||
RecordModuleList(LogFile);
|
||||
@@ -509,4 +509,4 @@ int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message)
|
||||
}
|
||||
|
||||
#endif // _WIN32
|
||||
#endif
|
||||
#endif
|
||||
@@ -69,4 +69,4 @@ int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message);
|
||||
|
||||
|
||||
#endif // __EXCEPTION_HANDLER_H
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "trackirpublic.h"
|
||||
|
||||
/* The TrackIR Interface */
|
||||
TrackIRDLL gTirDll_TrackIR;
|
||||
TrackIRDLL gTirDll_TrackIR;
|
||||
@@ -378,11 +378,13 @@ void fireball_render(object * obj)
|
||||
int num;
|
||||
vertex p;
|
||||
fireball *fb;
|
||||
|
||||
fireball_info *fd;
|
||||
|
||||
MONITOR_INC( NumFireballsRend, 1 );
|
||||
|
||||
num = obj->instance;
|
||||
fb = &Fireballs[num];
|
||||
fd = &Fireball_info[fb->fireball_info_index];
|
||||
|
||||
if ( Fireballs[num].current_bitmap < 0 )
|
||||
return;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
struct object;
|
||||
struct ship_info;
|
||||
class asteroid_info;
|
||||
struct asteroid_info;
|
||||
|
||||
// values correspond to the fireball render types
|
||||
#define FIREBALL_MEDIUM_EXPLOSION 0
|
||||
|
||||
@@ -37,6 +37,7 @@ bg_bitmap_dlg::bg_bitmap_dlg(CWnd* pParent) : CDialog(bg_bitmap_dlg::IDD, pParen
|
||||
{
|
||||
//{{AFX_DATA_INIT(bg_bitmap_dlg)
|
||||
m_neb_intensity = _T("");
|
||||
m_skybox_model = _T("");
|
||||
m_envmap = _T("");
|
||||
m_nebula_color = -1;
|
||||
m_nebula_index = -1;
|
||||
@@ -64,11 +65,6 @@ bg_bitmap_dlg::bg_bitmap_dlg(CWnd* pParent) : CDialog(bg_bitmap_dlg::IDD, pParen
|
||||
b_scale_x = 1.0f; b_scale_y = 1.0f;
|
||||
b_div_x = 1; b_div_y = 1;
|
||||
b_index = -1;
|
||||
|
||||
m_skybox_model = _T("");
|
||||
m_skybox_pitch = 0;
|
||||
m_skybox_bank = 0;
|
||||
m_skybox_heading = 0;
|
||||
m_sky_flag_1 = The_mission.skybox_flags & MR_NO_LIGHTING ? 1 : 0;
|
||||
m_sky_flag_2 = The_mission.skybox_flags & MR_ALL_XPARENT ? 1 : 0;
|
||||
m_sky_flag_3 = The_mission.skybox_flags & MR_NO_ZBUFFER ? 1 : 0;
|
||||
@@ -126,12 +122,6 @@ void bg_bitmap_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Text(pDX, IDC_SBITMAP_DIV_Y, b_div_y);
|
||||
DDV_MinMaxInt(pDX, b_div_y, 1, 5);
|
||||
DDX_Text(pDX, IDC_SKYBOX_FNAME, m_skybox_model);
|
||||
DDX_Text(pDX, IDC_SKYBOX_P, m_skybox_pitch);
|
||||
DDV_MinMaxInt(pDX, m_skybox_pitch, 0, 359);
|
||||
DDX_Text(pDX, IDC_SKYBOX_B, m_skybox_bank);
|
||||
DDV_MinMaxInt(pDX, m_skybox_bank, 0, 359);
|
||||
DDX_Text(pDX, IDC_SKYBOX_H, m_skybox_heading);
|
||||
DDV_MinMaxInt(pDX, m_skybox_heading, 0, 359);
|
||||
DDX_Text(pDX, IDC_ENVMAP, m_envmap);
|
||||
DDX_Check(pDX, IDC_SKY_FLAG_NO_LIGHTING, m_sky_flag_1);
|
||||
DDX_Check(pDX, IDC_SKY_FLAG_XPARENT, m_sky_flag_2);
|
||||
@@ -180,12 +170,6 @@ BEGIN_MESSAGE_MAP(bg_bitmap_dlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_SWAP_BACKGROUND, OnSwapBackground)
|
||||
ON_CBN_SELCHANGE(IDC_BACKGROUND_NUM, OnBackgroundDropdownChange)
|
||||
ON_BN_CLICKED(IDC_SKYBOX_MODEL, OnSkyboxBrowse)
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SKYBOX_P_SPIN, OnDeltaposSkyboxPSpin)
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SKYBOX_B_SPIN, OnDeltaposSkyboxBSpin)
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SKYBOX_H_SPIN, OnDeltaposSkyboxHSpin)
|
||||
ON_EN_KILLFOCUS(IDC_SKYBOX_P, OnKillfocusSkyboxP)
|
||||
ON_EN_KILLFOCUS(IDC_SKYBOX_B, OnKillfocusSkyboxB)
|
||||
ON_EN_KILLFOCUS(IDC_SKYBOX_H, OnKillfocusSkyboxH)
|
||||
ON_BN_CLICKED(IDC_ENVMAP_BROWSE, OnEnvmapBrowse)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
@@ -227,12 +211,6 @@ void bg_bitmap_dlg::create()
|
||||
m_skybox_model = _T(The_mission.skybox_model);
|
||||
m_envmap = _T(The_mission.envmap_name);
|
||||
|
||||
angles skybox_angles;
|
||||
vm_extract_angles_matrix(&skybox_angles, &The_mission.skybox_orientation);
|
||||
m_skybox_pitch = (int) fl_degrees(skybox_angles.p);
|
||||
m_skybox_bank = (int) fl_degrees(skybox_angles.b);
|
||||
m_skybox_heading = (int) fl_degrees(skybox_angles.h);
|
||||
|
||||
for(i=0; i<MAX_NEB2_BITMAPS; i++){
|
||||
if(strlen(Neb2_bitmap_filenames[i]) > 0){ //-V805
|
||||
((CComboBox*)GetDlgItem(IDC_NEB2_TEXTURE))->AddString(Neb2_bitmap_filenames[i]);
|
||||
@@ -261,7 +239,7 @@ void bg_bitmap_dlg::create()
|
||||
if(Neb2_awacs < 0.0f){
|
||||
m_neb_intensity = CString("3000");
|
||||
} else {
|
||||
char whee[25] = "";
|
||||
char whee[255] = "";
|
||||
m_neb_intensity = CString(itoa((int)Neb2_awacs, whee, 10));
|
||||
}
|
||||
|
||||
@@ -424,14 +402,9 @@ void bg_bitmap_dlg::OnClose()
|
||||
string_copy(The_mission.skybox_model, m_skybox_model, NAME_LENGTH, 1);
|
||||
string_copy(The_mission.envmap_name, m_envmap, NAME_LENGTH, 1);
|
||||
|
||||
angles skybox_angles;
|
||||
skybox_angles.p = fl_radians(m_skybox_pitch);
|
||||
skybox_angles.b = fl_radians(m_skybox_bank);
|
||||
skybox_angles.h = fl_radians(m_skybox_heading);
|
||||
vm_angles_2_matrix(&The_mission.skybox_orientation, &skybox_angles);
|
||||
|
||||
//store the skybox flags
|
||||
The_mission.skybox_flags = 0;
|
||||
|
||||
if(m_sky_flag_1) {
|
||||
The_mission.skybox_flags |= MR_NO_LIGHTING;
|
||||
}
|
||||
@@ -1206,51 +1179,6 @@ void bg_bitmap_dlg::OnKillfocusSun1Scale()
|
||||
OnSunChange();
|
||||
}
|
||||
|
||||
void bg_bitmap_dlg::OnDeltaposSkyboxPSpin(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
|
||||
|
||||
get_data_spinner(pNMUpDown, IDC_SKYBOX_P, &m_skybox_pitch, 0, 359);
|
||||
OnOrientationChange();
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void bg_bitmap_dlg::OnDeltaposSkyboxBSpin(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
|
||||
|
||||
get_data_spinner(pNMUpDown, IDC_SKYBOX_B, &m_skybox_bank, 0, 359);
|
||||
OnOrientationChange();
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void bg_bitmap_dlg::OnDeltaposSkyboxHSpin(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
|
||||
|
||||
get_data_spinner(pNMUpDown, IDC_SKYBOX_H, &m_skybox_heading, 0, 359);
|
||||
OnOrientationChange();
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void bg_bitmap_dlg::OnKillfocusSkyboxP()
|
||||
{
|
||||
get_data_int(IDC_SKYBOX_P, &m_skybox_pitch, 0, 359);
|
||||
OnOrientationChange();
|
||||
}
|
||||
|
||||
void bg_bitmap_dlg::OnKillfocusSkyboxB()
|
||||
{
|
||||
get_data_int(IDC_SKYBOX_B, &m_skybox_bank, 0, 359);
|
||||
OnOrientationChange();
|
||||
}
|
||||
|
||||
void bg_bitmap_dlg::OnKillfocusSkyboxH()
|
||||
{
|
||||
get_data_int(IDC_SKYBOX_H, &m_skybox_heading, 0, 359);
|
||||
OnOrientationChange();
|
||||
}
|
||||
|
||||
|
||||
extern void parse_one_background(background_t *background);
|
||||
|
||||
@@ -1418,17 +1346,6 @@ void bg_bitmap_dlg::OnSkyboxBrowse()
|
||||
stars_set_background_model( (char*)(LPCTSTR)m_skybox_model, NULL );
|
||||
}
|
||||
|
||||
void bg_bitmap_dlg::OnOrientationChange()
|
||||
{
|
||||
angles temp_angles;
|
||||
matrix temp_orient;
|
||||
temp_angles.p = fl_radians(m_skybox_pitch);
|
||||
temp_angles.b = fl_radians(m_skybox_bank);
|
||||
temp_angles.h = fl_radians(m_skybox_heading);
|
||||
vm_angles_2_matrix(&temp_orient, &temp_angles);
|
||||
stars_set_background_orientation( &temp_orient );
|
||||
}
|
||||
|
||||
void bg_bitmap_dlg::OnEnvmapBrowse()
|
||||
{
|
||||
CString filename;
|
||||
|
||||
@@ -35,9 +35,7 @@ public:
|
||||
void get_data_spinner(NM_UPDOWN* pUD, int id, int *var, int min, int max);
|
||||
void get_data_int(int id, int *var, int min, int max);
|
||||
void get_data_float(int id, float *var, float max, float min);
|
||||
|
||||
afx_msg void OnClose();
|
||||
|
||||
|
||||
bg_bitmap_dlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
@@ -87,9 +85,6 @@ public:
|
||||
int m_sky_flag_6;
|
||||
CString m_skybox_model;
|
||||
CString m_envmap;
|
||||
int m_skybox_pitch;
|
||||
int m_skybox_bank;
|
||||
int m_skybox_heading;
|
||||
float m_neb_near_multi;
|
||||
float m_neb_far_multi;
|
||||
//}}AFX_DATA
|
||||
@@ -110,10 +105,9 @@ protected:
|
||||
int get_swap_background();
|
||||
void reinitialize_lists();
|
||||
|
||||
void OnOrientationChange();
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(bg_bitmap_dlg)
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnCancel();
|
||||
afx_msg void OnOK();
|
||||
afx_msg void OnSelchangeNebcolor();
|
||||
@@ -149,12 +143,6 @@ protected:
|
||||
afx_msg void OnSwapBackground();
|
||||
afx_msg void OnBackgroundDropdownChange();
|
||||
afx_msg void OnSkyboxBrowse();
|
||||
afx_msg void OnDeltaposSkyboxPSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnDeltaposSkyboxBSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnDeltaposSkyboxHSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnKillfocusSkyboxP();
|
||||
afx_msg void OnKillfocusSkyboxB();
|
||||
afx_msg void OnKillfocusSkyboxH();
|
||||
afx_msg void OnEnvmapBrowse();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
@@ -111,6 +111,7 @@ void briefing_editor_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_FLIP_ICON, m_flipicon);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
DDV_MaxChars(pDX, m_text, MAX_BRIEF_LEN - 1);
|
||||
DDV_MaxChars(pDX, m_voice, MAX_FILENAME_LEN - 1);
|
||||
DDV_MaxChars(pDX, m_icon_label, MAX_LABEL_LEN - 1);
|
||||
DDV_MaxChars(pDX, m_icon_text, MAX_ICON_TEXT_LEN - 1);
|
||||
@@ -301,8 +302,7 @@ void briefing_editor_dlg::restore_editor_state()
|
||||
|
||||
void briefing_editor_dlg::update_data(int update)
|
||||
{
|
||||
char buf[MAX_LABEL_LEN], buf2[MAX_ICON_TEXT_LEN];
|
||||
SCP_string buf3;
|
||||
char buf[MAX_LABEL_LEN], buf2[MAX_ICON_TEXT_LEN], buf3[MAX_BRIEF_LEN];
|
||||
int i, j, l, lines, count, enable = TRUE, valid = 0, invalid = 0;
|
||||
object *objp;
|
||||
brief_stage *ptr = NULL;
|
||||
@@ -317,12 +317,12 @@ void briefing_editor_dlg::update_data(int update)
|
||||
strcpy_s(The_mission.substitute_briefing_music_name, m_substitute_briefing_music);
|
||||
if (m_last_stage >= 0) {
|
||||
ptr = &Briefing->stages[m_last_stage];
|
||||
deconvert_multiline_string(buf3, m_text);
|
||||
lcl_fred_replace_stuff(buf3);
|
||||
if (ptr->text != buf3)
|
||||
deconvert_multiline_string(buf3, m_text, MAX_BRIEF_LEN);
|
||||
lcl_fred_replace_stuff(buf3, MAX_BRIEF_LEN);
|
||||
if (stricmp(ptr->new_text, buf3))
|
||||
set_modified();
|
||||
|
||||
ptr->text = buf3;
|
||||
strcpy(ptr->new_text, buf3);
|
||||
MODIFY(ptr->camera_time, atoi(m_time));
|
||||
string_copy(ptr->voice, m_voice, MAX_FILENAME_LEN, 1);
|
||||
i = ptr->flags;
|
||||
@@ -489,7 +489,7 @@ void briefing_editor_dlg::update_data(int update)
|
||||
if ((m_cur_stage >= 0) && (m_cur_stage < Briefing->num_stages)) {
|
||||
ptr = &Briefing->stages[m_cur_stage];
|
||||
m_stage_title.Format("Stage %d of %d", m_cur_stage + 1, Briefing->num_stages);
|
||||
convert_multiline_string(m_text, ptr->text);
|
||||
m_text = convert_multiline_string(ptr->new_text);
|
||||
m_time.Format("%d", ptr->camera_time);
|
||||
m_voice = ptr->voice;
|
||||
m_cut_prev = (ptr->flags & BS_BACKWARD_CUT) ? 1 : 0;
|
||||
@@ -852,7 +852,7 @@ void briefing_editor_dlg::OnInsertStage()
|
||||
void briefing_editor_dlg::copy_stage(int from, int to)
|
||||
{
|
||||
if ((from < 0) || (from >= Briefing->num_stages)) {
|
||||
Briefing->stages[to].text = "<Text here>";
|
||||
strcpy(Briefing->stages[to].new_text, "<Text here>");
|
||||
strcpy_s(Briefing->stages[to].voice, "none.wav");
|
||||
Briefing->stages[to].camera_pos = view_pos;
|
||||
Briefing->stages[to].camera_orient = view_orient;
|
||||
@@ -863,7 +863,7 @@ void briefing_editor_dlg::copy_stage(int from, int to)
|
||||
}
|
||||
|
||||
// Copy all the data in the stage structure.
|
||||
Briefing->stages[to].text = Briefing->stages[from].text;
|
||||
strcpy( Briefing->stages[to].new_text, Briefing->stages[from].new_text );
|
||||
strcpy_s( Briefing->stages[to].voice, Briefing->stages[from].voice );
|
||||
Briefing->stages[to].camera_pos = Briefing->stages[from].camera_pos;
|
||||
Briefing->stages[to].camera_orient = Briefing->stages[from].camera_orient;
|
||||
@@ -916,7 +916,7 @@ void briefing_editor_dlg::OnMakeIcon()
|
||||
iconp = &Briefing->stages[m_cur_stage].icons[m_cur_icon];
|
||||
ship = waypoint = -1;
|
||||
team = 0;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
|
||||
vm_vec_make(&min, 9e19f, 9e19f, 9e19f);
|
||||
vm_vec_make(&max, -9e19f, -9e19f, -9e19f);
|
||||
@@ -948,7 +948,7 @@ void briefing_editor_dlg::OnMakeIcon()
|
||||
|
||||
case OBJ_JUMP_NODE:
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == ptr)
|
||||
if(jnp->get_obj() == ptr)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -997,7 +997,7 @@ void briefing_editor_dlg::OnMakeIcon()
|
||||
name = wp_list->get_name();
|
||||
}
|
||||
else if (jnp != Jump_nodes.end())
|
||||
name = jnp->GetName();
|
||||
name = jnp->get_name_ptr();
|
||||
else
|
||||
return;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ void campaign_editor::load_campaign()
|
||||
load_tree(0);
|
||||
|
||||
if (!strlen(Campaign.filename))
|
||||
strcpy_s(Campaign.filename, Default_campaign_file_name);
|
||||
strcpy_s(Campaign.filename, BUILTIN_CAMPAIGN);
|
||||
|
||||
if (mission_campaign_load(Campaign.filename, NULL, 0)) {
|
||||
MessageBox("Couldn't open Campaign file!", "Error");
|
||||
@@ -218,7 +218,7 @@ void campaign_editor::initialize( int init_files )
|
||||
m_num_players.Format("%d", Campaign.num_players);
|
||||
|
||||
if (Campaign.desc) {
|
||||
convert_multiline_string(m_desc, Campaign.desc);
|
||||
m_desc = convert_multiline_string(Campaign.desc);
|
||||
} else {
|
||||
m_desc = _T("");
|
||||
}
|
||||
@@ -707,21 +707,21 @@ void campaign_editor::update_loop_desc_window()
|
||||
|
||||
// set new text
|
||||
if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_branch_txt && enable_branch_desc_window) {
|
||||
convert_multiline_string(m_branch_desc, Links[Cur_campaign_link].mission_branch_txt);
|
||||
m_branch_desc = convert_multiline_string(Links[Cur_campaign_link].mission_branch_txt);
|
||||
} else {
|
||||
m_branch_desc = _T("");
|
||||
}
|
||||
|
||||
// set new text
|
||||
if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_branch_brief_anim && enable_branch_desc_window) {
|
||||
convert_multiline_string(m_branch_brief_anim, Links[Cur_campaign_link].mission_branch_brief_anim);
|
||||
m_branch_brief_anim = convert_multiline_string(Links[Cur_campaign_link].mission_branch_brief_anim);
|
||||
} else {
|
||||
m_branch_brief_anim = _T("");
|
||||
}
|
||||
|
||||
// set new text
|
||||
if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_branch_brief_sound && enable_branch_desc_window) {
|
||||
convert_multiline_string(m_branch_brief_sound, Links[Cur_campaign_link].mission_branch_brief_sound);
|
||||
m_branch_brief_sound = convert_multiline_string(Links[Cur_campaign_link].mission_branch_brief_sound);
|
||||
} else {
|
||||
m_branch_brief_sound = _T("");
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ void campaign_tree_view::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
read_mission_goal_list(Cur_campaign_mission);
|
||||
|
||||
if (Campaign.missions[Cur_campaign_mission].notes) {
|
||||
convert_multiline_string(str, Campaign.missions[Cur_campaign_mission].notes);
|
||||
str = convert_multiline_string(Campaign.missions[Cur_campaign_mission].notes);
|
||||
box = (CEdit *) Campaign_tree_formp->GetDlgItem(IDC_HELP_BOX);
|
||||
if (box)
|
||||
box->SetWindowText(str);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "MissionSave.h"
|
||||
#include "InitialShips.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "parse/parselo.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
@@ -374,9 +373,9 @@ int campaign_tree_wnd::error_checker()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int campaign_tree_wnd::error(const char *msg, ...)
|
||||
int campaign_tree_wnd::error(char *msg, ...)
|
||||
{
|
||||
SCP_string buf;
|
||||
char buf[2048];
|
||||
va_list args;
|
||||
|
||||
g_err++;
|
||||
@@ -384,16 +383,15 @@ int campaign_tree_wnd::error(const char *msg, ...)
|
||||
vsprintf(buf, msg, args);
|
||||
va_end(args);
|
||||
|
||||
nprintf(("Error", buf.c_str()));
|
||||
if (MessageBox(buf.c_str(), "Error", MB_OKCANCEL | MB_ICONEXCLAMATION) == IDOK)
|
||||
if (MessageBox(buf, "Error", MB_OKCANCEL | MB_ICONEXCLAMATION) == IDOK)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int campaign_tree_wnd::internal_error(const char *msg, ...)
|
||||
int campaign_tree_wnd::internal_error(char *msg, ...)
|
||||
{
|
||||
SCP_string buf, buf2;
|
||||
char buf[2048], buf2[2048];
|
||||
va_list args;
|
||||
|
||||
g_err++;
|
||||
@@ -402,10 +400,9 @@ int campaign_tree_wnd::internal_error(const char *msg, ...)
|
||||
va_end(args);
|
||||
|
||||
sprintf(buf2, "%s\n\nThis is an internal error. Please let Hoffoss\n"
|
||||
"know about this so he can fix it. Click cancel to debug.", buf.c_str());
|
||||
"know about this so he can fix it. Click cancel to debug.", buf);
|
||||
|
||||
nprintf(("Error", buf.c_str()));
|
||||
if (MessageBox(buf2.c_str(), "Internal Error", MB_OKCANCEL | MB_ICONEXCLAMATION) == IDCANCEL)
|
||||
if (MessageBox(buf2, "Internal Error", MB_OKCANCEL | MB_ICONEXCLAMATION) == IDCANCEL)
|
||||
Int3(); // drop to debugger so the problem can be analyzed.
|
||||
|
||||
return -1;
|
||||
@@ -413,7 +410,7 @@ int campaign_tree_wnd::internal_error(const char *msg, ...)
|
||||
|
||||
int campaign_tree_wnd::fred_check_sexp(int sexp, int type, char *msg, ...)
|
||||
{
|
||||
SCP_string buf, sexp_buf, error_buf;
|
||||
char buf[512], buf2[2048], buf3[MAX_EVENT_SIZE];
|
||||
int err = 0, z, faulty_node;
|
||||
va_list args;
|
||||
|
||||
@@ -428,17 +425,17 @@ int campaign_tree_wnd::fred_check_sexp(int sexp, int type, char *msg, ...)
|
||||
if (!z)
|
||||
return 0;
|
||||
|
||||
convert_sexp_to_string(sexp_buf, sexp, SEXP_ERROR_CHECK_MODE);
|
||||
truncate_message_lines(sexp_buf, 30);
|
||||
sprintf(error_buf, "Error in %s: %s\n\nIn sexpression: %s\n\n(Error appears to be: %s)", buf.c_str(), sexp_error_message(z), sexp_buf.c_str(), Sexp_nodes[faulty_node].text);
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE, MAX_EVENT_SIZE);
|
||||
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);
|
||||
|
||||
if (z < 0 && z > -100)
|
||||
err = 1;
|
||||
|
||||
if (err)
|
||||
return internal_error(error_buf.c_str());
|
||||
return internal_error(buf3);
|
||||
|
||||
if (error(error_buf.c_str()))
|
||||
if (error(buf3))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -27,8 +27,8 @@ public:
|
||||
public:
|
||||
int error_checker();
|
||||
int fred_check_sexp(int sexp, int type, char *msg, ...);
|
||||
int error(const char *msg, ...);
|
||||
int internal_error(const char *msg, ...);
|
||||
int error(char *msg, ...);
|
||||
int internal_error(char *msg, ...);
|
||||
int save_modified();
|
||||
|
||||
// Overrides
|
||||
|
||||
+14
-9
@@ -47,6 +47,7 @@ void cmd_brief_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Text(pDX, IDC_WAVE_FILENAME, m_wave_filename);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
DDV_MaxChars(pDX, m_text, CMD_BRIEF_TEXT_MAX - 1);
|
||||
DDV_MaxChars(pDX, m_ani_filename, MAX_FILENAME_LEN - 1);
|
||||
DDV_MaxChars(pDX, m_wave_filename, MAX_FILENAME_LEN - 1);
|
||||
}
|
||||
@@ -90,13 +91,16 @@ void cmd_brief_dlg::update_data(int update)
|
||||
|
||||
// save previously editing data before we load over it.
|
||||
if (last_cmd_brief && m_last_stage >= 0 && m_last_stage < last_cmd_brief->num_stages) {
|
||||
cmd_brief_stage *last_stage = &last_cmd_brief->stage[m_last_stage];
|
||||
char buf[CMD_BRIEF_TEXT_MAX];
|
||||
|
||||
deconvert_multiline_string(last_stage->text, m_text);
|
||||
lcl_fred_replace_stuff(last_stage->text);
|
||||
if (last_cmd_brief->stage[m_last_stage].text)
|
||||
free(last_cmd_brief->stage[m_last_stage].text);
|
||||
|
||||
string_copy(last_stage->ani_filename, m_ani_filename, MAX_FILENAME_LEN);
|
||||
string_copy(last_stage->wave_filename, m_wave_filename, MAX_FILENAME_LEN);
|
||||
deconvert_multiline_string(buf, m_text, CMD_BRIEF_TEXT_MAX);
|
||||
lcl_fred_replace_stuff(buf, CMD_BRIEF_TEXT_MAX);
|
||||
last_cmd_brief->stage[m_last_stage].text = strdup(buf);
|
||||
string_copy(last_cmd_brief->stage[m_last_stage].ani_filename, m_ani_filename, MAX_FILENAME_LEN);
|
||||
string_copy(last_cmd_brief->stage[m_last_stage].wave_filename, m_wave_filename, MAX_FILENAME_LEN);
|
||||
}
|
||||
|
||||
// load data of new stage into dialog
|
||||
@@ -105,7 +109,7 @@ void cmd_brief_dlg::update_data(int update)
|
||||
m_cur_stage = 0;
|
||||
|
||||
m_stage_title.Format("Stage %d of %d", m_cur_stage + 1, Cur_cmd_brief->num_stages);
|
||||
convert_multiline_string(m_text, Cur_cmd_brief->stage[m_cur_stage].text);
|
||||
m_text = convert_multiline_string(Cur_cmd_brief->stage[m_cur_stage].text);
|
||||
m_ani_filename = Cur_cmd_brief->stage[m_cur_stage].ani_filename;
|
||||
m_wave_filename = Cur_cmd_brief->stage[m_cur_stage].wave_filename;
|
||||
enable = TRUE;
|
||||
@@ -239,7 +243,8 @@ void cmd_brief_dlg::OnDeleteStage()
|
||||
z = m_cur_stage;
|
||||
m_cur_stage = -1;
|
||||
update_data(1);
|
||||
Cur_cmd_brief->stage[z].text = "";
|
||||
if (Cur_cmd_brief->stage[z].text)
|
||||
free(Cur_cmd_brief->stage[z].text);
|
||||
|
||||
for (i=z+1; i<Cur_cmd_brief->num_stages; i++)
|
||||
Cur_cmd_brief->stage[i-1] = Cur_cmd_brief->stage[i];
|
||||
@@ -257,14 +262,14 @@ void cmd_brief_dlg::OnDeleteStage()
|
||||
void cmd_brief_dlg::copy_stage(int from, int to)
|
||||
{
|
||||
if ((from < 0) || (from >= Cur_cmd_brief->num_stages)) {
|
||||
Cur_cmd_brief->stage[to].text = "<Text here>";
|
||||
Cur_cmd_brief->stage[to].text = strdup("<Text here>");
|
||||
strcpy_s(Cur_cmd_brief->stage[to].ani_filename, "<default>");
|
||||
strcpy_s(Cur_cmd_brief->stage[to].wave_filename, "none");
|
||||
return;
|
||||
}
|
||||
|
||||
Cur_cmd_brief->stage[to] = Cur_cmd_brief->stage[from];
|
||||
Cur_cmd_brief->stage[to].text = Cur_cmd_brief->stage[from].text;
|
||||
Cur_cmd_brief->stage[to].text = strdup(Cur_cmd_brief->stage[from].text);
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnBrowseAni()
|
||||
|
||||
@@ -119,7 +119,7 @@ void create_wing_dlg::OnOK()
|
||||
}
|
||||
}
|
||||
|
||||
if (find_matching_waypoint_list((LPCSTR) m_name) != NULL)
|
||||
if (find_matching_waypoint_list(const_cast<char *>((const char *) m_name)) != NULL)
|
||||
{
|
||||
MessageBox("This wing name is already being used by a waypoint path");
|
||||
return;
|
||||
|
||||
@@ -67,7 +67,9 @@ void debriefing_editor_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_CBIndex(pDX, IDC_FAILED_MISSION_TRACK, m_debriefFail_music);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
DDV_MaxChars(pDX, m_text, MAX_BRIEF_LEN - 1);
|
||||
DDV_MaxChars(pDX, m_voice, MAX_FILENAME_LEN - 1);
|
||||
DDV_MaxChars(pDX, m_rec_text, MAX_RECOMMENDATION_LEN - 1);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(debriefing_editor_dlg, CDialog)
|
||||
@@ -202,10 +204,10 @@ void debriefing_editor_dlg::update_data(int update)
|
||||
free_sexp2(ptr->formula);
|
||||
|
||||
ptr->formula = m_tree.save_tree();
|
||||
deconvert_multiline_string(ptr->text, m_text);
|
||||
lcl_fred_replace_stuff(ptr->text);
|
||||
deconvert_multiline_string(ptr->recommendation_text, m_rec_text);
|
||||
lcl_fred_replace_stuff(ptr->recommendation_text);
|
||||
deconvert_multiline_string(ptr->new_text, m_text, MAX_DEBRIEF_LEN);
|
||||
lcl_fred_replace_stuff(ptr->new_text, MAX_DEBRIEF_LEN);
|
||||
deconvert_multiline_string(ptr->new_recommendation_text, m_rec_text, MAX_RECOMMENDATION_LEN);
|
||||
lcl_fred_replace_stuff(ptr->new_recommendation_text,MAX_RECOMMENDATION_LEN);
|
||||
string_copy(ptr->voice, m_voice, MAX_FILENAME_LEN);
|
||||
}
|
||||
|
||||
@@ -214,8 +216,8 @@ void debriefing_editor_dlg::update_data(int update)
|
||||
ptr = &Debriefing->stages[m_cur_stage];
|
||||
m_stage_title.Format("Stage %d of %d", m_cur_stage + 1, Debriefing->num_stages);
|
||||
m_tree.load_tree(ptr->formula);
|
||||
convert_multiline_string(m_text, ptr->text);
|
||||
convert_multiline_string(m_rec_text, ptr->recommendation_text);
|
||||
m_text = convert_multiline_string(ptr->new_text);
|
||||
m_rec_text = convert_multiline_string(ptr->new_recommendation_text);
|
||||
m_voice = ptr->voice;
|
||||
enable = TRUE;
|
||||
|
||||
@@ -385,20 +387,21 @@ void debriefing_editor_dlg::OnInsertStage()
|
||||
void debriefing_editor_dlg::copy_stage(int from, int to, int clear_formula)
|
||||
{
|
||||
if ((from < 0) || (from >= Debriefing->num_stages)) {
|
||||
Debriefing->stages[to].text = "<Text here>";
|
||||
strcpy(Debriefing->stages[to].new_text, "<Text here>");
|
||||
strcpy_s(Debriefing->stages[to].voice, "none.wav");
|
||||
Debriefing->stages[to].formula = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (clear_formula)
|
||||
Debriefing->stages[to].formula = -1;
|
||||
else
|
||||
Debriefing->stages[to].formula = Debriefing->stages[from].formula;
|
||||
|
||||
Debriefing->stages[to].text = Debriefing->stages[from].text;
|
||||
strcpy( Debriefing->stages[to].new_text, Debriefing->stages[from].new_text );
|
||||
strcpy_s( Debriefing->stages[to].voice, Debriefing->stages[from].voice );
|
||||
Debriefing->stages[to].recommendation_text = Debriefing->stages[from].recommendation_text;
|
||||
strcpy( Debriefing->stages[to].new_recommendation_text, Debriefing->stages[from].new_recommendation_text );
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnRclickTree(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
|
||||
@@ -401,9 +401,9 @@ void DumpStats::get_object_stats(CString &buffer)
|
||||
// Jumpnodes
|
||||
buffer += "\r\nJUMPNODES\r\n";
|
||||
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
temp.Format("\tJumpnode: %s\r\n", jnp->GetName());
|
||||
temp.Format("\tJumpnode: %s\r\n", jnp->get_name_ptr());
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,14 +59,6 @@ event_editor::event_editor(CWnd* pParent /*=NULL*/)
|
||||
modified = 0;
|
||||
select_sexp_node = -1;
|
||||
m_wave_id = -1;
|
||||
m_log_true = 0;
|
||||
m_log_false = 0;
|
||||
m_log_always_true = 0;
|
||||
m_log_always_false = 0;
|
||||
m_log_1st_repeat = 0;
|
||||
m_log_last_repeat = 0;
|
||||
m_log_1st_trigger = 0;
|
||||
m_log_last_trigger = 0;
|
||||
}
|
||||
|
||||
void event_editor::DoDataExchange(CDataExchange* pDX)
|
||||
@@ -88,14 +80,6 @@ void event_editor::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_CBIndex(pDX, IDC_PERSONA_NAME, m_persona);
|
||||
DDX_CBString(pDX, IDC_WAVE_FILENAME, m_wave_filename);
|
||||
DDX_LBIndex(pDX, IDC_MESSAGE_LIST, m_cur_msg);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_TRUE, m_log_true);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_FALSE, m_log_false);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_ALWAYS_TRUE, m_log_always_true);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_ALWAYS_FALSE, m_log_always_false);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_1ST_REPEAT, m_log_1st_repeat);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_LAST_REPEAT, m_log_last_repeat);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_1ST_TRIGGER, m_log_1st_trigger);
|
||||
DDX_Check(pDX, IDC_MISSION_LOG_LAST_TRIGGER, m_log_last_trigger);
|
||||
|
||||
|
||||
// m_team == -1 maps to 2
|
||||
@@ -435,8 +419,6 @@ int event_editor::query_modified()
|
||||
return 1;
|
||||
if (advanced_stricmp(m_events[i].objective_key_text, Mission_events[i].objective_key_text))
|
||||
return 1;
|
||||
if (m_events[i].mission_log_flags != Mission_events[i].mission_log_flags)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (m_cur_msg < 0)
|
||||
@@ -528,7 +510,6 @@ void event_editor::OnOk()
|
||||
Mission_events[i].formula = m_event_tree.save_tree(m_events[i].formula);
|
||||
Mission_events[i].objective_text = m_events[i].objective_text;
|
||||
Mission_events[i].objective_key_text = m_events[i].objective_key_text;
|
||||
Mission_events[i].mission_log_flags = m_events[i].mission_log_flags;
|
||||
}
|
||||
|
||||
// now update all sexp references
|
||||
@@ -736,7 +717,6 @@ void event_editor::reset_event(int num, HTREEITEM after)
|
||||
m_events[num].objective_text = NULL;
|
||||
m_events[num].objective_key_text = NULL;
|
||||
m_events[num].team = -1;
|
||||
m_events[num].mission_log_flags = 0;
|
||||
m_sig[num] = -1;
|
||||
|
||||
m_event_tree.item_index = -1;
|
||||
@@ -894,26 +874,6 @@ void event_editor::save_event(int e)
|
||||
}
|
||||
}
|
||||
|
||||
// handle event log flags
|
||||
m_events[e].mission_log_flags = 0;
|
||||
if (m_log_true)
|
||||
m_events[e].mission_log_flags |= MLF_SEXP_TRUE;
|
||||
if (m_log_false)
|
||||
m_events[e].mission_log_flags |= MLF_SEXP_FALSE;
|
||||
if (m_log_always_true)
|
||||
m_events[e].mission_log_flags |= MLF_SEXP_KNOWN_TRUE;
|
||||
if (m_log_always_false)
|
||||
m_events[e].mission_log_flags |= MLF_SEXP_KNOWN_FALSE;
|
||||
if (m_log_1st_repeat)
|
||||
m_events[e].mission_log_flags |= MLF_FIRST_REPEAT_ONLY;
|
||||
if (m_log_last_repeat)
|
||||
m_events[e].mission_log_flags |= MLF_LAST_REPEAT_ONLY;
|
||||
if (m_log_1st_trigger)
|
||||
m_events[e].mission_log_flags |= MLF_FIRST_TRIGGER_ONLY;
|
||||
if (m_log_last_trigger)
|
||||
m_events[e].mission_log_flags |= MLF_LAST_TRIGGER_ONLY;
|
||||
|
||||
|
||||
// Search for item to update
|
||||
HTREEITEM h = m_event_tree.GetRootItem();
|
||||
while (h) {
|
||||
@@ -1035,48 +995,6 @@ void event_editor::update_cur_event()
|
||||
GetDlgItem(IDC_EVENT_TEAM)->EnableWindow(TRUE);
|
||||
}
|
||||
|
||||
// handle event log flags
|
||||
if (m_events[cur_event].mission_log_flags & MLF_SEXP_TRUE) {
|
||||
m_log_true = TRUE;
|
||||
}else {
|
||||
m_log_true = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_SEXP_FALSE) {
|
||||
m_log_false = TRUE;
|
||||
}else {
|
||||
m_log_false = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_SEXP_KNOWN_TRUE) {
|
||||
m_log_always_true = TRUE;
|
||||
}else {
|
||||
m_log_always_true = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_SEXP_KNOWN_FALSE) {
|
||||
m_log_always_false = TRUE;
|
||||
}else {
|
||||
m_log_always_false = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_FIRST_REPEAT_ONLY) {
|
||||
m_log_1st_repeat = TRUE;
|
||||
}else {
|
||||
m_log_1st_repeat = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_LAST_REPEAT_ONLY) {
|
||||
m_log_last_repeat = TRUE;
|
||||
}else {
|
||||
m_log_last_repeat = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_FIRST_TRIGGER_ONLY) {
|
||||
m_log_1st_trigger = TRUE;
|
||||
}else {
|
||||
m_log_1st_trigger = FALSE;
|
||||
}
|
||||
if (m_events[cur_event].mission_log_flags & MLF_LAST_TRIGGER_ONLY) {
|
||||
m_log_last_trigger = TRUE;
|
||||
}else {
|
||||
m_log_last_trigger = FALSE;
|
||||
}
|
||||
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
@@ -1336,7 +1254,7 @@ void event_editor::OnBrowseAvi()
|
||||
|
||||
z = cfile_push_chdir(CF_TYPE_INTERFACE);
|
||||
CFileDialog dlg(TRUE, "ani", m_avi_filename, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
|
||||
"Ani Files (*.ani)|*.ani|Eff Files (*.eff)|*.eff|Avi Files (*.avi)|*.avi|Both (*.ani, *.avi)|*.ani;*.avi||");
|
||||
"Ani Files (*.ani)|*.ani|Avi Files (*.avi)|*.avi|Both (*.ani, *.avi)|*.ani;*.avi||");
|
||||
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
m_avi_filename = dlg.GetFileName();
|
||||
|
||||
@@ -71,14 +71,6 @@ public:
|
||||
int m_team;
|
||||
int m_message_team;
|
||||
int m_last_message_node;
|
||||
int m_log_true;
|
||||
int m_log_false;
|
||||
int m_log_always_true;
|
||||
int m_log_always_false;
|
||||
int m_log_1st_repeat;
|
||||
int m_log_last_repeat;
|
||||
int m_log_1st_trigger;
|
||||
int m_log_last_trigger;
|
||||
//}}AFX_DATA
|
||||
|
||||
CBitmap m_play_bm;
|
||||
|
||||
+74
-95
@@ -165,8 +165,8 @@ BEGIN
|
||||
POPUP "Save &Format"
|
||||
BEGIN
|
||||
MENUITEM "FS2 Open", 33069, CHECKED
|
||||
MENUITEM "FS2 Open (Compatibility)", 33092
|
||||
MENUITEM "FS2 Retail", 33070
|
||||
MENUITEM "Here Be Dragons", 33092
|
||||
END
|
||||
POPUP "&Import"
|
||||
BEGIN
|
||||
@@ -404,6 +404,8 @@ BEGIN
|
||||
MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY
|
||||
MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Add Paste", ID_EDIT_PASTE_SPECIAL, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "Add Operator"
|
||||
BEGIN
|
||||
MENUITEM "placeholder", ID_PLACEHOLDER, GRAYED
|
||||
@@ -415,8 +417,6 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Add Paste", ID_EDIT_PASTE_SPECIAL, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "Insert Operator"
|
||||
BEGIN
|
||||
MENUITEM "placeholder", ID_PLACEHOLDER, GRAYED
|
||||
@@ -624,7 +624,7 @@ CAPTION "About FRED2"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,10,17,20,20,SS_REALSIZEIMAGE
|
||||
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.6.16 RC1 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
|
||||
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.6.13 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
|
||||
LTEXT "Copyright © 1999 Volition, Inc. All Rights Reserved",IDC_STATIC,39,17,164,8
|
||||
DEFPUSHBUTTON "OK",IDOK,229,7,48,14,WS_GROUP
|
||||
LTEXT """Fred2 is the omega of all giant unwieldy pieces of code. Its big, its horrifying, and it just doesn't care. View it at your own risk."" - Dave Baranec",IDC_STATIC,39,62,238,20
|
||||
@@ -1234,7 +1234,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Mission Event Edit"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "Tree1",IDC_EVENT_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,196,343,WS_EX_CLIENTEDGE
|
||||
CONTROL "Tree1",IDC_EVENT_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,196,236,WS_EX_CLIENTEDGE
|
||||
PUSHBUTTON "New Event",IDC_BUTTON_NEW_EVENT,207,7,50,14,0,WS_EX_STATICEDGE,HIDC_BUTTON_NEW_EVENT
|
||||
PUSHBUTTON "Insert Event",IDC_INSERT,207,24,50,14,0,WS_EX_STATICEDGE
|
||||
PUSHBUTTON "Delete Event",IDC_DELETE,207,41,50,14,0,WS_EX_STATICEDGE
|
||||
@@ -1245,9 +1245,9 @@ BEGIN
|
||||
CONTROL "Chained",IDC_CHAINED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,231,42,10
|
||||
LTEXT "Chain Delay",IDC_STATIC,210,244,39,8
|
||||
EDITTEXT IDC_CHAIN_DELAY,210,255,45,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_OBJ_TEXT,86,354,117,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_OBJ_KEY_TEXT,86,370,117,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_HELP_BOX,211,298,219,126,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL,WS_EX_TRANSPARENT
|
||||
EDITTEXT IDC_OBJ_TEXT,86,246,117,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_OBJ_KEY_TEXT,86,262,117,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_HELP_BOX,7,298,423,126,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL,WS_EX_TRANSPARENT
|
||||
PUSHBUTTON "New Msg",IDC_NEW_MSG,229,59,50,14,0,WS_EX_STATICEDGE
|
||||
PUSHBUTTON "Delete Msg",IDC_DELETE_MSG,229,77,50,14,0,WS_EX_STATICEDGE
|
||||
LISTBOX IDC_MESSAGE_LIST,285,17,145,74,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
@@ -1266,8 +1266,8 @@ BEGIN
|
||||
LTEXT "Repeat Count",IDC_STATIC,210,98,45,8
|
||||
LTEXT "Interval time",IDC_STATIC,210,154,45,8
|
||||
LTEXT "Score",IDC_STATIC,210,186,45,8
|
||||
LTEXT "Directive text",IDC_STATIC,37,356,44,8
|
||||
LTEXT "Directive keypress text",IDC_STATIC,7,372,74,8
|
||||
LTEXT "Directive text",IDC_STATIC,37,249,44,8
|
||||
LTEXT "Directive keypress text",IDC_STATIC,7,265,74,8
|
||||
LTEXT "Message Text",IDC_STATIC,261,114,48,8
|
||||
LTEXT "Name",IDC_STATIC,261,97,20,8
|
||||
LTEXT "Messages",IDC_STATIC,335,7,35,8
|
||||
@@ -1277,21 +1277,12 @@ BEGIN
|
||||
GROUPBOX "Message Properties",IDC_STATIC,261,183,169,80
|
||||
LTEXT "Team",IDC_STATIC,279,245,20,8
|
||||
LTEXT "(multiplayer TvT only)",IDC_STATIC,353,246,68,8
|
||||
EDITTEXT IDC_MINI_HELP_BOX,209,283,221,14,ES_MULTILINE | ES_READONLY,WS_EX_DLGMODALFRAME | WS_EX_TRANSPARENT
|
||||
EDITTEXT IDC_MINI_HELP_BOX,7,283,423,14,ES_MULTILINE | ES_READONLY,WS_EX_DLGMODALFRAME | WS_EX_TRANSPARENT
|
||||
EDITTEXT IDC_TRIGGER_COUNT,210,137,45,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "Trigger Count",IDC_STATIC,210,126,44,8
|
||||
CONTROL "True",IDC_MISSION_LOG_TRUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,397,31,10
|
||||
CONTROL "False",IDC_MISSION_LOG_FALSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,410,33,10
|
||||
CONTROL "First Repeat",IDC_MISSION_LOG_1ST_REPEAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,397,54,10
|
||||
CONTROL "Last Repeat",IDC_MISSION_LOG_LAST_REPEAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,97,410,55,10
|
||||
CONTROL "First Trigger",IDC_MISSION_LOG_1ST_TRIGGER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,397,53,10
|
||||
CONTROL "Last Trigger",IDC_MISSION_LOG_LAST_TRIGGER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,410,53,10
|
||||
CONTROL "Always True",IDC_MISSION_LOG_ALWAYS_TRUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,397,55,10
|
||||
CONTROL "Always False",IDC_MISSION_LOG_ALWAYS_FALSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,410,57,10
|
||||
LTEXT "Log These States To The Event.log",IDC_STATIC,37,386,114,8
|
||||
END
|
||||
|
||||
IDD_BG_BITMAP DIALOGEX 0, 0, 431, 402
|
||||
IDD_BG_BITMAP DIALOGEX 0, 0, 431, 354
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Background Editor"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
@@ -1321,33 +1312,33 @@ BEGIN
|
||||
EDITTEXT IDC_SUN1_H,349,87,23,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "Spin2",IDC_SUN1_H_SPIN,"msctls_updown32",UDS_ARROWKEYS,373,87,11,14
|
||||
EDITTEXT IDC_SUN1_SCALE,362,105,23,14,ES_AUTOHSCROLL
|
||||
CONTROL "Full Nebula",IDC_FULLNEB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,186,62,10
|
||||
EDITTEXT IDC_NEB2_INTENSITY,68,201,63,12,ES_AUTOHSCROLL
|
||||
COMBOBOX IDC_NEB2_TEXTURE,68,217,63,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_NEB2_LIGHTNING,68,232,63,91,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Toggle ship trails",IDC_NEB_TOGGLE_TRAILS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,249,123,10
|
||||
CONTROL "Check1",IDC_POOF0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,192,62,10
|
||||
CONTROL "Check2",IDC_POOF1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,202,62,10
|
||||
CONTROL "Check3",IDC_POOF2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,211,62,10
|
||||
CONTROL "Check4",IDC_POOF3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,220,62,10
|
||||
CONTROL "Check5",IDC_POOF4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,229,62,10
|
||||
CONTROL "Check6",IDC_POOF5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,238,62,10
|
||||
COMBOBOX IDC_NEBPATTERN,42,333,61,108,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_NEBCOLOR,42,349,61,108,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
EDITTEXT IDC_PITCH,166,316,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_BANK,166,333,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_HEADING,166,350,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,227,336,178,15
|
||||
CONTROL "Takes place inside Subspace",IDC_SUBSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,356,109,10
|
||||
LTEXT "Pattern:",IDC_STATIC,14,335,26,8
|
||||
LTEXT "Color:",IDC_STATIC,15,351,23,8
|
||||
LTEXT "Pitch",IDC_STATIC,145,319,17,8
|
||||
GROUPBOX "Nebula",IDC_STATIC,5,172,210,127
|
||||
LTEXT "Bank",IDC_STATIC,144,336,18,8
|
||||
LTEXT "Heading",IDC_STATIC,134,353,28,8
|
||||
LTEXT "Number of stars:",IDC_STATIC,227,325,52,8
|
||||
LTEXT "Static",IDC_TOTAL,283,325,43,8
|
||||
GROUPBOX "Misc",IDC_STATIC,220,314,206,79
|
||||
CONTROL "Full Nebula",IDC_FULLNEB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,183,62,10
|
||||
EDITTEXT IDC_NEB2_INTENSITY,68,202,63,12,ES_AUTOHSCROLL
|
||||
COMBOBOX IDC_NEB2_TEXTURE,68,218,63,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_NEB2_LIGHTNING,68,233,63,91,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Toggle ship trails",IDC_NEB_TOGGLE_TRAILS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,251,123,10
|
||||
CONTROL "Check1",IDC_POOF0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,189,62,10
|
||||
CONTROL "Check2",IDC_POOF1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,199,62,10
|
||||
CONTROL "Check3",IDC_POOF2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,208,62,10
|
||||
CONTROL "Check4",IDC_POOF3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,217,62,10
|
||||
CONTROL "Check5",IDC_POOF4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,226,62,10
|
||||
CONTROL "Check6",IDC_POOF5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,235,62,10
|
||||
COMBOBOX IDC_NEBPATTERN,42,272,61,108,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_NEBCOLOR,42,288,61,108,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
EDITTEXT IDC_PITCH,166,252,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_BANK,166,269,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
EDITTEXT IDC_HEADING,166,286,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,227,233,178,15
|
||||
CONTROL "Takes place inside Subspace",IDC_SUBSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,253,109,10
|
||||
LTEXT "Pattern:",IDC_STATIC,14,274,26,8
|
||||
LTEXT "Color:",IDC_STATIC,15,290,23,8
|
||||
LTEXT "Pitch",IDC_STATIC,145,255,17,8
|
||||
GROUPBOX "Nebula",IDC_STATIC,5,167,210,179
|
||||
LTEXT "Bank",IDC_STATIC,144,272,18,8
|
||||
LTEXT "Heading",IDC_STATIC,134,289,28,8
|
||||
LTEXT "Number of stars:",IDC_STATIC,227,222,52,8
|
||||
LTEXT "Static",IDC_TOTAL,283,222,43,8
|
||||
GROUPBOX "Misc",IDC_STATIC,220,215,206,131
|
||||
GROUPBOX "Suns",IDC_STATIC,220,23,206,124
|
||||
GROUPBOX "Bitmaps",IDC_STATIC,5,23,210,145
|
||||
LTEXT "Scale",IDC_STATIC,340,108,19,8
|
||||
@@ -1358,47 +1349,37 @@ BEGIN
|
||||
LTEXT "P",IDC_STATIC,125,61,8,8
|
||||
LTEXT "B",IDC_STATIC,125,77,8,8
|
||||
LTEXT "H",IDC_STATIC,125,93,8,8
|
||||
LTEXT "Range:",IDC_STATIC,14,201,24,8
|
||||
LTEXT "Pattern:",IDC_STATIC,14,216,26,8
|
||||
LTEXT "Poofs",IDC_STATIC,142,180,19,8
|
||||
LTEXT "Range:",IDC_STATIC,14,202,24,8
|
||||
LTEXT "Pattern:",IDC_STATIC,14,217,26,8
|
||||
LTEXT "Poofs",IDC_STATIC,142,177,19,8
|
||||
LTEXT "# divisions (x/y)",IDC_STATIC,144,139,50,8
|
||||
LTEXT "Lightning Storm",IDC_STATIC,14,233,50,8
|
||||
EDITTEXT IDC_SKYBOX_FNAME,311,232,108,14,ES_AUTOHSCROLL
|
||||
CONTROL "Slider2",IDC_AMBIENT_R_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,229,164,144,15
|
||||
CONTROL "Slider3",IDC_AMBIENT_G_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,229,180,144,15
|
||||
CONTROL "Slider4",IDC_AMBIENT_B_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,229,196,144,15
|
||||
LTEXT "Static",IDC_AMBIENT_R_TEXT,379,166,42,8
|
||||
LTEXT "Static",IDC_AMBIENT_G_TEXT,379,182,42,8
|
||||
LTEXT "Static",IDC_AMBIENT_B_TEXT,379,198,42,8
|
||||
GROUPBOX "Ambient light",IDC_STATIC,220,152,206,62
|
||||
LTEXT "Lightning Storm",IDC_STATIC,14,234,50,8
|
||||
EDITTEXT IDC_SKYBOX_FNAME,311,268,107,14,ES_AUTOHSCROLL
|
||||
CONTROL "Slider2",IDC_AMBIENT_R_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,229,161,144,15
|
||||
CONTROL "Slider3",IDC_AMBIENT_G_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,229,177,144,15
|
||||
CONTROL "Slider4",IDC_AMBIENT_B_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,229,193,144,15
|
||||
LTEXT "Static",IDC_AMBIENT_R_TEXT,379,163,42,8
|
||||
LTEXT "Static",IDC_AMBIENT_G_TEXT,379,179,42,8
|
||||
LTEXT "Static",IDC_AMBIENT_B_TEXT,379,195,42,8
|
||||
GROUPBOX "Ambient light",IDC_STATIC,220,149,206,62
|
||||
PUSHBUTTON "Import...",IDC_IMPORT_BACKGROUND,103,7,41,14
|
||||
COMBOBOX IDC_BACKGROUND_NUM,14,8,83,265,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_BACKGROUND_SWAP_NUM,343,8,83,265,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Swap With",IDC_SWAP_BACKGROUND,293,7,41,14
|
||||
EDITTEXT IDC_ENVMAP,311,373,107,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Environment Map",IDC_ENVMAP_BROWSE,227,373,81,14
|
||||
PUSHBUTTON "Skybox Model",IDC_SKYBOX_MODEL,227,232,79,14
|
||||
CONTROL "No Lighting",IDC_SKY_FLAG_NO_LIGHTING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,277,52,10
|
||||
CONTROL "Transparent",IDC_SKY_FLAG_XPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,297,277,54,10
|
||||
CONTROL "Force clamp",IDC_SKY_FLAG_CLAMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,351,277,54,10
|
||||
CONTROL "No Z-Buffer",IDC_SKY_FLAG_NO_ZBUFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,290,53,10
|
||||
CONTROL "No Cull",IDC_SKY_FLAG_NO_CULL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,297,290,39,10
|
||||
LTEXT "Fog Near Multiplier",IDC_STATIC,14,266,58,8
|
||||
LTEXT "Fog Far Multiplier",IDC_STATIC,14,281,53,8
|
||||
EDITTEXT IDC_NEB_NEAR_MULTIPLIER,72,264,25,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_NEB_FAR_MULTIPLIER,72,279,25,14,ES_AUTOHSCROLL
|
||||
CONTROL "No Glowmaps",IDC_SKY_FLAG_NO_GLOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,351,290,60,10
|
||||
GROUPBOX "Skybox",IDC_STATIC,220,219,206,91
|
||||
EDITTEXT IDC_SKYBOX_P,237,253,23,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SKYBOX_P_SPIN,"msctls_updown32",UDS_ARROWKEYS,262,253,11,14
|
||||
EDITTEXT IDC_SKYBOX_B,295,253,23,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SKYBOX_B_SPIN,"msctls_updown32",UDS_ARROWKEYS,320,253,11,14
|
||||
EDITTEXT IDC_SKYBOX_H,351,252,23,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SKYBOX_H_SPIN,"msctls_updown32",UDS_ARROWKEYS,376,252,11,14
|
||||
LTEXT "P",IDC_STATIC,227,256,8,8
|
||||
LTEXT "B",IDC_STATIC,285,256,8,8
|
||||
LTEXT "H",IDC_STATIC,341,255,8,8
|
||||
GROUPBOX "Old Nebula",IDC_STATIC,5,306,210,64
|
||||
EDITTEXT IDC_ENVMAP,311,324,107,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Environment Map",IDC_ENVMAP_BROWSE,228,324,78,14
|
||||
PUSHBUTTON "Skybox Model",IDC_SKYBOX_MODEL,228,268,78,14
|
||||
CONTROL "No Lighting",IDC_SKY_FLAG_NO_LIGHTING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,296,52,10
|
||||
CONTROL "Transparent",IDC_SKY_FLAG_XPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,297,296,54,10
|
||||
CONTROL "Force clamp",IDC_SKY_FLAG_CLAMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,351,296,54,10
|
||||
CONTROL "No Z-Buffer",IDC_SKY_FLAG_NO_ZBUFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,309,53,10
|
||||
CONTROL "No Cull",IDC_SKY_FLAG_NO_CULL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,297,309,39,10
|
||||
LTEXT "Fog Near Multiplier",IDC_STATIC,14,304,58,8
|
||||
LTEXT "Fog Far Multiplier",IDC_STATIC,14,319,53,8
|
||||
EDITTEXT IDC_NEB_NEAR_MULTIPLIER,72,302,25,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_NEB_FAR_MULTIPLIER,72,317,25,14,ES_AUTOHSCROLL
|
||||
CONTROL "No Glowmaps",IDC_SKY_FLAG_NO_GLOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,351,309,60,10
|
||||
GROUPBOX "Skybox Flags",IDC_STATIC,231,285,185,36
|
||||
END
|
||||
|
||||
IDD_REINFORCEMENT_EDITOR DIALOGEX 0, 0, 183, 119
|
||||
@@ -1450,7 +1431,7 @@ BEGIN
|
||||
LTEXT "Please specify a name for this\nnew wing",IDC_STATIC,7,7,99,18
|
||||
END
|
||||
|
||||
IDD_INITIAL_STATUS DIALOGEX 0, 0, 197, 335
|
||||
IDD_INITIAL_STATUS DIALOGEX 0, 0, 197, 311
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Initial Status Editor"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
@@ -1486,8 +1467,6 @@ BEGIN
|
||||
CONTROL "Afterburner Locked",IDC_AFTERBURNER_LOCKED,"Button",BS_3STATE | WS_TABSTOP,93,101,83,10
|
||||
CONTROL "Force Shields On",IDC_FORCE_SHIELDS,"Button",BS_3STATE | WS_TABSTOP,86,43,84,8
|
||||
CONTROL "Weapon Locked",IDC_WEAPONS_LOCKED,"Button",BS_3STATE | WS_TABSTOP,93,79,69,10
|
||||
COMBOBOX IDC_TEAMSELECT,87,306,88,93,CBS_DROPDOWNLIST | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Team Color Setting:",IDC_STATIC,16,308,66,8
|
||||
END
|
||||
|
||||
IDD_ASTEROID_EDITOR DIALOG 0, 0, 376, 210
|
||||
@@ -1692,7 +1671,7 @@ BEGIN
|
||||
LTEXT "Stage 1 of 9",IDC_STAGE_TITLE,7,10,53,8
|
||||
LTEXT "Usage Formula",IDC_STATIC,7,43,48,8
|
||||
LTEXT "Recommendation Text",IDC_STATIC,135,96,72,8
|
||||
GROUPBOX "Debriefing Music",IDC_STATIC,7,175,260,45
|
||||
GROUPBOX "Debriefing Music",IDC_STATIC,7,175,260,45
|
||||
LTEXT "Success Music",IDC_STATIC,15,187,53,8
|
||||
COMBOBOX IDC_SUCCESSFUL_MISSION_TRACK,12,195,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Average Music",IDC_STATIC,100,187,53,8
|
||||
@@ -2095,8 +2074,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,6,16,9482
|
||||
PRODUCTVERSION 3,6,16,9482
|
||||
FILEVERSION 3,6,13,0
|
||||
PRODUCTVERSION 3,6,13,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -2113,12 +2092,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Volition Inc."
|
||||
VALUE "FileDescription", "Fred 2 Open"
|
||||
VALUE "FileVersion", "3.6.16.9482"
|
||||
VALUE "FileVersion", "3.6.13.0000"
|
||||
VALUE "InternalName", "Fred 2 Open"
|
||||
VALUE "LegalCopyright", "Copyright © 1998"
|
||||
VALUE "OriginalFilename", "fred2.exe"
|
||||
VALUE "ProductName", "Fred 2 Open"
|
||||
VALUE "ProductVersion", "3.6.16 RC1"
|
||||
VALUE "ProductVersion", "3.6.13"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
@@ -2269,7 +2248,7 @@ BEGIN
|
||||
VERTGUIDE, 215
|
||||
VERTGUIDE, 220
|
||||
VERTGUIDE, 426
|
||||
BOTTOMMARGIN, 393
|
||||
BOTTOMMARGIN, 346
|
||||
HORZGUIDE, 126
|
||||
HORZGUIDE, 132
|
||||
END
|
||||
@@ -2311,7 +2290,7 @@ BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 190
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 328
|
||||
BOTTOMMARGIN, 304
|
||||
END
|
||||
|
||||
IDD_ASTEROID_EDITOR, DIALOG
|
||||
@@ -2689,7 +2668,7 @@ IDC_CURSOR2 CURSOR "res\\cursor2.cur"
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "FRED2_OPEN 3.6.16 RC1 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
|
||||
IDR_MAINFRAME "FRED2_OPEN 3.6.13 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
||||
@@ -496,8 +496,6 @@ int CFREDDoc::load_mission(char *pathname, int flags)
|
||||
set_modified(0);
|
||||
stars_post_level_init();
|
||||
|
||||
recreate_dialogs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -631,7 +629,6 @@ void CFREDDoc::editor_init_mission()
|
||||
{
|
||||
reset_mission();
|
||||
SetModifiedFlag(FALSE);
|
||||
recreate_dialogs();
|
||||
}
|
||||
/*
|
||||
void CFREDDoc::OnFileNew()
|
||||
@@ -1012,7 +1009,6 @@ void CFREDDoc::OnFileImportFSM()
|
||||
create_new_mission();
|
||||
|
||||
MessageBox(NULL, "Import complete. Please check the destination folder to verify all missions were imported successfully.", "Status", MB_OK);
|
||||
recreate_dialogs();
|
||||
}
|
||||
|
||||
void restore_default_weapons(char *ships_tbl);
|
||||
@@ -1097,26 +1093,3 @@ void CFREDDoc::OnFileImportWeapons()
|
||||
if (!Fred_view_wnd->global_error_check())
|
||||
Fred_view_wnd->MessageBox("Weapon loadouts successfully imported with no errors.", "Woohoo!");
|
||||
}
|
||||
|
||||
void CFREDDoc::recreate_dialogs()
|
||||
{
|
||||
if(Briefing_dialog)
|
||||
{
|
||||
Briefing_dialog->OnCancel();
|
||||
Briefing_dialog = new briefing_editor_dlg;
|
||||
Briefing_dialog->create();
|
||||
Briefing_dialog->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0,
|
||||
SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
||||
Briefing_dialog->ShowWindow(SW_RESTORE);
|
||||
}
|
||||
|
||||
if(Bg_bitmap_dialog)
|
||||
{
|
||||
Bg_bitmap_dialog->OnClose();
|
||||
Bg_bitmap_dialog = new bg_bitmap_dlg;
|
||||
Bg_bitmap_dialog->create();
|
||||
Bg_bitmap_dialog->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0,
|
||||
SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
||||
Bg_bitmap_dialog->ShowWindow(SW_RESTORE);
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,6 @@ private:
|
||||
int save_briefing_info(FILE *fp);
|
||||
int save_plot_info(FILE *fp);
|
||||
int save_mission_info(FILE *FP);
|
||||
void recreate_dialogs();
|
||||
};
|
||||
|
||||
extern int Local_modified;
|
||||
|
||||
+11
-33
@@ -65,7 +65,6 @@ static char THIS_FILE[] = __FILE__;
|
||||
#define MAX_FRAMETIME (F1_0/4) // Frametime gets saturated at this.
|
||||
#define MIN_FRAMETIME (F1_0/120)
|
||||
#define LOLLIPOP_SIZE 2.5f
|
||||
#define CONVERT_DEGREES 57.29578f // conversion factor from radians to degrees
|
||||
|
||||
const float FRED_DEFAULT_HTL_FOV = 0.485f;
|
||||
const float FRED_BRIEFING_HTL_FOV = 0.325f;
|
||||
@@ -79,7 +78,7 @@ int Editing_mode = 1;
|
||||
int Control_mode = 0;
|
||||
int last_x=0, last_y=0;
|
||||
int Show_grid = 1;
|
||||
int Show_outlines = 0;
|
||||
int Show_outlines = 1;
|
||||
int Show_stars = 1;
|
||||
int Show_grid_positions = 1;
|
||||
int Show_coordinates = 0;
|
||||
@@ -140,8 +139,8 @@ color colour_yellow;
|
||||
|
||||
void fred_enable_htl()
|
||||
{
|
||||
if (!Briefing_dialog) gr_set_proj_matrix( (4.0f/9.0f) * PI * FRED_DEFAULT_HTL_FOV, gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
|
||||
if (Briefing_dialog) gr_set_proj_matrix( (4.0f/9.0f) * PI * FRED_BRIEFING_HTL_FOV, gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
|
||||
if (!Briefing_dialog) gr_set_proj_matrix( (4.0f/9.0f) * 3.14159f * FRED_DEFAULT_HTL_FOV, gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
|
||||
if (Briefing_dialog) gr_set_proj_matrix( (4.0f/9.0f) * 3.14159f * FRED_BRIEFING_HTL_FOV, gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
|
||||
gr_set_view_matrix(&Eye_position, &Eye_matrix);
|
||||
}
|
||||
|
||||
@@ -735,7 +734,7 @@ void render_one_model_nohtl(object *objp)
|
||||
Fred_outline = FRED_COLOUR_YELLOW;
|
||||
|
||||
else if ((objp->type == OBJ_SHIP) && Show_outlines) {
|
||||
color *iff_color = iff_get_color_by_team_and_object(Ships[objp->instance].team, -1, 1, objp);
|
||||
color *iff_color = iff_get_color_by_team_and_object(Ships[objp->instance].team, -1, true, objp);
|
||||
|
||||
Fred_outline = (iff_color->red << 16) | (iff_color->green << 8) | (iff_color->blue);
|
||||
|
||||
@@ -783,7 +782,7 @@ void render_one_model_nohtl(object *objp)
|
||||
if (!Show_ships)
|
||||
return;
|
||||
|
||||
color *iff_color = iff_get_color_by_team_and_object(Ships[objp->instance].team, -1, 1, objp);
|
||||
color *iff_color = iff_get_color_by_team_and_object(Ships[objp->instance].team, -1, true, objp);
|
||||
|
||||
r = iff_color->red;
|
||||
g = iff_color->green;
|
||||
@@ -864,7 +863,7 @@ void render_one_model_htl(object *objp)
|
||||
Fred_outline = FRED_COLOUR_YELLOW;
|
||||
|
||||
else if ((objp->type == OBJ_SHIP) && Show_outlines) {
|
||||
color *iff_color = iff_get_color_by_team_and_object(Ships[objp->instance].team, -1, 1, objp);
|
||||
color *iff_color = iff_get_color_by_team_and_object(Ships[objp->instance].team, -1, true, objp);
|
||||
|
||||
Fred_outline = (iff_color->red << 16) | (iff_color->green << 8) | (iff_color->blue);
|
||||
|
||||
@@ -906,7 +905,7 @@ void render_one_model_htl(object *objp)
|
||||
|
||||
if (Fred_outline) {
|
||||
model_set_outline_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
|
||||
j |= MR_SHOW_OUTLINE_HTL;
|
||||
j |= MR_SHOW_OUTLINE;
|
||||
}
|
||||
|
||||
g3_done_instance(0);
|
||||
@@ -920,7 +919,7 @@ void render_one_model_htl(object *objp)
|
||||
return;
|
||||
}
|
||||
|
||||
color *iff_color = iff_get_color_by_team_and_object(Ships[objp->instance].team, -1, 1, objp);
|
||||
color *iff_color = iff_get_color_by_team_and_object(Ships[objp->instance].team, -1, true, objp);
|
||||
|
||||
r = iff_color->red;
|
||||
g = iff_color->green;
|
||||
@@ -1448,7 +1447,7 @@ void render_frame()
|
||||
int x, y, w, h, inst;
|
||||
vec3d pos;
|
||||
vertex v;
|
||||
angles a, a_deg; //a is in rads, a_deg is in degrees
|
||||
angles a;
|
||||
|
||||
g3_end_frame(); // ** Accounted for
|
||||
|
||||
@@ -1531,14 +1530,9 @@ void render_frame()
|
||||
inst = Objects[Cursor_over].instance;
|
||||
if ((Objects[Cursor_over].type == OBJ_SHIP) || (Objects[Cursor_over].type == OBJ_START)) {
|
||||
vm_extract_angles_matrix(&a, &Objects[Cursor_over].orient);
|
||||
|
||||
a_deg.h = a.h * CONVERT_DEGREES; // convert angles to more readable degrees
|
||||
a_deg.p = a.p * CONVERT_DEGREES;
|
||||
a_deg.b = a.b * CONVERT_DEGREES;
|
||||
|
||||
sprintf(buf, "%s\n%s\n( %.1f , %.1f , %.1f ) \nHeading: %.2f\nPitch: %.2f\nBank: %.2f",
|
||||
Ships[inst].ship_name, Ship_info[Ships[inst].ship_info_index].short_name,
|
||||
pos.xyz.x, pos.xyz.y, pos.xyz.z, a_deg.h, a_deg.p, a_deg.b);
|
||||
pos.xyz.x, pos.xyz.y, pos.xyz.z, a.h, a.p, a.b);
|
||||
|
||||
} else if (Objects[Cursor_over].type == OBJ_WAYPOINT) {
|
||||
int idx;
|
||||
@@ -1922,13 +1916,7 @@ int select_object(int cx, int cy)
|
||||
if (Briefing_dialog) {
|
||||
best = Briefing_dialog->check_mouse_hit(cx, cy);
|
||||
if (best >= 0)
|
||||
{
|
||||
if(Selection_lock && !(Objects[best].flags & OF_MARKED))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return best;
|
||||
}
|
||||
}
|
||||
|
||||
/* gr_reset_clip();
|
||||
@@ -1963,13 +1951,8 @@ int select_object(int cx, int cy)
|
||||
}
|
||||
|
||||
if (best >= 0)
|
||||
{
|
||||
if(Selection_lock && !(Objects[best].flags & OF_MARKED))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list))
|
||||
{
|
||||
@@ -1988,11 +1971,6 @@ int select_object(int cx, int cy)
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
|
||||
if(Selection_lock && !(Objects[best].flags & OF_MARKED))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
|
||||
+13
-42
@@ -89,7 +89,7 @@ int Show_sexp_help = 1;
|
||||
int Show_ships = 1;
|
||||
int Show_starts = 1;
|
||||
int Show_ship_info = 1;
|
||||
int Show_ship_models = 1;
|
||||
int Show_ship_models = 0;
|
||||
int Show_compass = 1;
|
||||
int Show_dock_points = 0;
|
||||
int Show_paths_fred = 0;
|
||||
@@ -1394,7 +1394,7 @@ void CFREDView::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
|
||||
CMenu menu;
|
||||
int objnum;
|
||||
CPoint local = point;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
|
||||
if (button_down) {
|
||||
cancel_drag();
|
||||
@@ -1422,10 +1422,10 @@ void CFREDView::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
|
||||
else if (Objects[objnum].type == OBJ_JUMP_NODE) {
|
||||
id = ID_EDITORS_WAYPOINT;
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == &Objects[objnum])
|
||||
if(jnp->get_obj() == &Objects[objnum])
|
||||
break;
|
||||
}
|
||||
str.Format("Edit %s", jnp->GetName());
|
||||
str.Format("Edit %s", jnp->get_name_ptr());
|
||||
|
||||
} else if (Objects[objnum].type == OBJ_WAYPOINT) {
|
||||
int idx;
|
||||
@@ -2195,35 +2195,6 @@ void CFREDView::OnUpdateZoomSelected(CCmdUI* pCmdUI)
|
||||
|
||||
void CFREDView::OnFormWing()
|
||||
{
|
||||
object *ptr = GET_FIRST(&obj_used_list);
|
||||
bool found = false;
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (( (ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START) ) && (ptr->flags & OF_MARKED)) {
|
||||
if(Ships[ptr->instance].flags & SF_REINFORCEMENT) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
|
||||
if(found) {
|
||||
int ok = MessageBox("Some of the ships you selected to create a wing are marked as reinforcements. Press Ok to clear the flag on all selected ships. Press Cancel to not create the wing.", "Reinforcement conflict", MB_ICONEXCLAMATION | MB_OKCANCEL);
|
||||
if(ok == IDOK) {
|
||||
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)) {
|
||||
set_reinforcement(Ships[ptr->instance].ship_name, 0);
|
||||
}
|
||||
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!create_wing())
|
||||
FREDDoc_ptr->autosave("form wing");
|
||||
}
|
||||
@@ -3261,7 +3232,7 @@ int CFREDView::global_error_check_player_wings(int multi)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CFREDView::error(const char *msg, ...)
|
||||
int CFREDView::error(char *msg, ...)
|
||||
{
|
||||
char buf[2048];
|
||||
va_list args;
|
||||
@@ -3277,7 +3248,7 @@ int CFREDView::error(const char *msg, ...)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CFREDView::internal_error(const char *msg, ...)
|
||||
int CFREDView::internal_error(char *msg, ...)
|
||||
{
|
||||
char buf[2048];
|
||||
va_list args;
|
||||
@@ -3304,9 +3275,9 @@ int CFREDView::internal_error(const char *msg, ...)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CFREDView::fred_check_sexp(int sexp, int type, const char *msg, ...)
|
||||
int CFREDView::fred_check_sexp(int sexp, int type, char *msg, ...)
|
||||
{
|
||||
SCP_string buf, sexp_buf, error_buf;
|
||||
char buf[512], buf2[2048], buf3[MAX_EVENT_SIZE];
|
||||
int err = 0, z, faulty_node;
|
||||
va_list args;
|
||||
|
||||
@@ -3321,17 +3292,17 @@ int CFREDView::fred_check_sexp(int sexp, int type, const char *msg, ...)
|
||||
if (!z)
|
||||
return 0;
|
||||
|
||||
convert_sexp_to_string(sexp_buf, sexp, SEXP_ERROR_CHECK_MODE);
|
||||
truncate_message_lines(sexp_buf, 30);
|
||||
sprintf(error_buf, "Error in %s: %s\n\nIn sexpression: %s\n\n(Error appears to be: %s)", buf.c_str(), sexp_error_message(z), sexp_buf.c_str(), Sexp_nodes[faulty_node].text);
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE, MAX_EVENT_SIZE);
|
||||
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);
|
||||
|
||||
if (z < 0 && z > -100)
|
||||
err = 1;
|
||||
|
||||
if (err)
|
||||
return internal_error(error_buf.c_str());
|
||||
return internal_error(buf3);
|
||||
|
||||
if (error(error_buf.c_str()))
|
||||
if (error(buf3))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -45,9 +45,9 @@ protected: // create from serialization only
|
||||
public:
|
||||
|
||||
int global_error_check_mixed_player_wing(int w);
|
||||
int fred_check_sexp(int sexp, int type, const char *msg, ...);
|
||||
int internal_error(const char *msg, ...);
|
||||
int error(const char *msg, ...);
|
||||
int fred_check_sexp(int sexp, int type, char *msg, ...);
|
||||
int internal_error(char *msg, ...);
|
||||
int error(char *msg, ...);
|
||||
int global_error_check();
|
||||
void place_background_bitmap(vec3d v);
|
||||
void cycle_constraint();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "InitialStatus.h"
|
||||
#include "Management.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "object/objectdock.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -81,7 +80,6 @@ void initial_status::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Control(pDX, IDC_VELOCITY_SPIN, m_velocity_spin);
|
||||
DDX_Control(pDX, IDC_SHIELDS_SPIN, m_shields_spin);
|
||||
DDX_Control(pDX, IDC_DAMAGE_SPIN, m_damage_spin);
|
||||
DDX_Control(pDX, IDC_TEAMSELECT, m_team_color_setting);
|
||||
DDX_Text(pDX, IDC_DAMAGE, m_damage);
|
||||
DDV_MinMaxInt(pDX, m_damage, 0, 100);
|
||||
DDX_Check(pDX, IDC_HAS_SHIELDS, m_has_shields);
|
||||
@@ -145,7 +143,7 @@ BOOL initial_status::OnInitDialog()
|
||||
int z, vflag, sflag, hflag;
|
||||
ship_subsys *ptr;
|
||||
CString str;
|
||||
object *objp = NULL;
|
||||
object *objp;
|
||||
|
||||
m_ship = cur_ship;
|
||||
if (m_ship == -1) {
|
||||
@@ -378,33 +376,6 @@ BOOL initial_status::OnInitDialog()
|
||||
if (hflag)
|
||||
GetDlgItem(IDC_HULL)->SetWindowText("");
|
||||
|
||||
if (objp != NULL) {
|
||||
if (objp->type == OBJ_SHIP || objp->type == OBJ_START) {
|
||||
ship* shipp = &Ships[objp->instance];
|
||||
int i = 0;
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].uses_team_colors) {
|
||||
//Add a "None" entry at the beginning to allow simple deselection of colours
|
||||
int t = m_team_color_setting.AddString("None");
|
||||
m_team_color_setting.SetItemData(t, i);
|
||||
++i;
|
||||
|
||||
for (SCP_vector<SCP_string>::iterator tni = Team_Names.begin(); tni != Team_Names.end(); ++tni) {
|
||||
int z = m_team_color_setting.AddString(tni->c_str());
|
||||
if (!stricmp(tni->c_str(), shipp->team_name.c_str())) {
|
||||
m_team_color_setting.SetCurSel(i);
|
||||
}
|
||||
m_team_color_setting.SetItemData(z, i);
|
||||
i++;
|
||||
|
||||
}
|
||||
m_team_color_setting.EnableWindow();
|
||||
} else {
|
||||
m_team_color_setting.EnableWindow(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -537,10 +508,6 @@ void initial_status::OnOK()
|
||||
Ships[m_ship].flags2 &= ~SF2_AFTERBURNER_LOCKED;
|
||||
}
|
||||
|
||||
if (m_team_color_setting.IsWindowEnabled() && m_team_color_setting.GetCurSel() > 0)
|
||||
Ships[m_ship].team_name = Team_Names[m_team_color_setting.GetCurSel() - 1];
|
||||
else
|
||||
Ships[m_ship].team_name = "None";
|
||||
|
||||
update_docking_info();
|
||||
|
||||
@@ -1012,7 +979,7 @@ void initial_status::undock(object *objp1, object *objp2)
|
||||
ship_num = get_ship_from_obj(OBJ_INDEX(objp1));
|
||||
other_ship_num = get_ship_from_obj(OBJ_INDEX(objp2));
|
||||
|
||||
if (ship_class_compare(Ships[ship_num].ship_info_index, Ships[other_ship_num].ship_info_index) <= 0)
|
||||
if (ship_class_compare(Ships[ship_num].ship_info_index, Ships[other_ship_num].ship_info_index) > 0)
|
||||
vm_vec_scale_add2(&objp2->pos, &v, objp2->radius * 2.0f);
|
||||
else
|
||||
vm_vec_scale_add2(&objp1->pos, &v, objp1->radius * -2.0f);
|
||||
@@ -1044,6 +1011,51 @@ void initial_status::undock(object *objp1, object *objp2)
|
||||
|
||||
// ----- the following are not contained in the class because of apparent scope issues -----
|
||||
|
||||
// NOTE - in both retail and SCP, the dock "leader" is defined as the only guy in his
|
||||
// group with a non-false arrival cue
|
||||
void initial_status_mark_dock_leader_helper(object *objp, dock_function_info *infop)
|
||||
{
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
|
||||
// all ships except the leader should have a locked false arrival cue
|
||||
if (shipp->arrival_cue != Locked_sexp_false)
|
||||
{
|
||||
object *existing_leader;
|
||||
|
||||
// increment number of leaders found
|
||||
infop->maintained_variables.int_value++;
|
||||
|
||||
// see if we already found a leader
|
||||
existing_leader = infop->maintained_variables.objp_value;
|
||||
if (existing_leader != NULL)
|
||||
{
|
||||
ship *leader_shipp = &Ships[existing_leader->instance];
|
||||
|
||||
// keep existing leader if he has a higher priority than us
|
||||
if (ship_class_compare(shipp->ship_info_index, leader_shipp->ship_info_index) < 0)
|
||||
{
|
||||
// set my arrival cue to false
|
||||
reset_arrival_to_false(SHIP_INDEX(shipp), true);
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise, unmark the existing leader and set his arrival cue to false
|
||||
leader_shipp->flags &= ~SF_DOCK_LEADER;
|
||||
reset_arrival_to_false(SHIP_INDEX(leader_shipp), true);
|
||||
}
|
||||
|
||||
// mark and save me as the leader
|
||||
shipp->flags |= SF_DOCK_LEADER;
|
||||
infop->maintained_variables.objp_value = objp;
|
||||
}
|
||||
}
|
||||
|
||||
// self-explanatory, really
|
||||
void initial_status_unmark_dock_handled_flag(object *objp, dock_function_info *infop)
|
||||
{
|
||||
objp->flags &= ~OF_DOCKED_ALREADY_HANDLED;
|
||||
}
|
||||
|
||||
bool set_cue_to_false(int *cue)
|
||||
{
|
||||
// if the cue is not false, make it false. Be sure to set all ship editor dialog functions
|
||||
@@ -1051,13 +1063,11 @@ bool set_cue_to_false(int *cue)
|
||||
if (*cue != Locked_sexp_false)
|
||||
{
|
||||
Ship_editor_dialog.update_data(1);
|
||||
Wing_editor_dialog.update_data(1);
|
||||
|
||||
free_sexp2(*cue);
|
||||
*cue = Locked_sexp_false;
|
||||
|
||||
Ship_editor_dialog.initialize_data(1);
|
||||
Wing_editor_dialog.initialize_data(1);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1095,63 +1105,6 @@ void reset_arrival_to_false(int shipnum, bool reset_wing)
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE - in both retail and SCP, the dock "leader" is defined as the only guy in his
|
||||
// group with a non-false arrival cue
|
||||
void initial_status_mark_dock_leader_helper(object *objp, dock_function_info *infop)
|
||||
{
|
||||
ship *shipp = &Ships[objp->instance];
|
||||
int cue_to_check;
|
||||
|
||||
// if this guy is part of a wing, he uses his wing's arrival cue
|
||||
if (shipp->wingnum >= 0)
|
||||
{
|
||||
cue_to_check = Wings[shipp->wingnum].arrival_cue;
|
||||
}
|
||||
// check the ship's arrival cue
|
||||
else
|
||||
{
|
||||
cue_to_check = shipp->arrival_cue;
|
||||
}
|
||||
|
||||
// all ships except the leader should have a locked false arrival cue
|
||||
if (cue_to_check != Locked_sexp_false)
|
||||
{
|
||||
object *existing_leader;
|
||||
|
||||
// increment number of leaders found
|
||||
infop->maintained_variables.int_value++;
|
||||
|
||||
// see if we already found a leader
|
||||
existing_leader = infop->maintained_variables.objp_value;
|
||||
if (existing_leader != NULL)
|
||||
{
|
||||
ship *leader_shipp = &Ships[existing_leader->instance];
|
||||
|
||||
// keep existing leader if he has a higher priority than us
|
||||
if (ship_class_compare(shipp->ship_info_index, leader_shipp->ship_info_index) >= 0)
|
||||
{
|
||||
// set my arrival cue to false
|
||||
reset_arrival_to_false(SHIP_INDEX(shipp), true);
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise, unmark the existing leader and set his arrival cue to false
|
||||
leader_shipp->flags &= ~SF_DOCK_LEADER;
|
||||
reset_arrival_to_false(SHIP_INDEX(leader_shipp), true);
|
||||
}
|
||||
|
||||
// mark and save me as the leader
|
||||
shipp->flags |= SF_DOCK_LEADER;
|
||||
infop->maintained_variables.objp_value = objp;
|
||||
}
|
||||
}
|
||||
|
||||
// self-explanatory, really
|
||||
void initial_status_unmark_dock_handled_flag(object *objp, dock_function_info *infop)
|
||||
{
|
||||
objp->flags &= ~OF_DOCKED_ALREADY_HANDLED;
|
||||
}
|
||||
|
||||
void initial_status::OnPrimariesLocked()
|
||||
{
|
||||
if (m_primaries_locked == 1)
|
||||
|
||||
@@ -58,7 +58,6 @@ public:
|
||||
int m_secondaries_locked;
|
||||
int m_turrets_locked;
|
||||
int m_afterburner_locked;
|
||||
CComboBox m_team_color_setting;
|
||||
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
+77
-54
@@ -20,7 +20,6 @@
|
||||
#include "ship/ship.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "globalincs/version.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "mission/missionmessage.h"
|
||||
#include "mission/missiongoals.h"
|
||||
@@ -133,10 +132,9 @@ int query_ship_name_duplicate(int ship);
|
||||
char *reg_read_string( char *section, char *name, char *default_value );
|
||||
|
||||
extern int Nmodel_num;
|
||||
extern matrix Nmodel_orient;
|
||||
extern int Nmodel_bitmap;
|
||||
|
||||
void string_copy(char *dest, const CString &src, int max_len, int modify)
|
||||
void string_copy(char *dest, CString &src, int max_len, int modify)
|
||||
{
|
||||
int len;
|
||||
|
||||
@@ -152,43 +150,75 @@ void string_copy(char *dest, const CString &src, int max_len, int modify)
|
||||
dest[len] = 0;
|
||||
}
|
||||
|
||||
void string_copy(SCP_string &dest, const CString &src, int modify)
|
||||
{
|
||||
if (modify)
|
||||
if (strcmp(src, dest.c_str()))
|
||||
set_modified();
|
||||
|
||||
dest = src;
|
||||
}
|
||||
|
||||
// converts a multiline string (one with newlines in it) into a windows format multiline
|
||||
// string (newlines changed to '\r\n').
|
||||
void convert_multiline_string(CString &dest, const SCP_string &src)
|
||||
CString convert_multiline_string(char *src)
|
||||
{
|
||||
dest = src.c_str();
|
||||
dest.Replace("\n", "\r\n");
|
||||
}
|
||||
char *ptr, buf[256];
|
||||
int i;
|
||||
static CString str;
|
||||
|
||||
// converts a multiline string (one with newlines in it) into a windows format multiline
|
||||
// string (newlines changed to '\r\n').
|
||||
void convert_multiline_string(CString &dest, const char *src)
|
||||
{
|
||||
dest = src;
|
||||
dest.Replace("\n", "\r\n");
|
||||
str = _T("");
|
||||
while ((ptr = strchr(src, '\n'))!=NULL) {
|
||||
i = ptr - src;
|
||||
while (i > 250) {
|
||||
strncpy(buf, src, 250);
|
||||
buf[250] = 0;
|
||||
str += buf;
|
||||
src += 250;
|
||||
i -= 250;
|
||||
}
|
||||
|
||||
if (i)
|
||||
strncpy(buf, src, i);
|
||||
|
||||
buf[i] = 0;
|
||||
str += buf;
|
||||
str += "\r\n";
|
||||
src = ptr + 1;
|
||||
}
|
||||
|
||||
i = strlen(src);
|
||||
if (i)
|
||||
str += src;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// Converts a windows format multiline CString back into a normal multiline string.
|
||||
void deconvert_multiline_string(char *dest, const CString &str, int max_len)
|
||||
void deconvert_multiline_string(char *buf, CString &str, int max_len)
|
||||
{
|
||||
strncpy_s(dest, max_len, (LPCTSTR) str, max_len);
|
||||
replace_all(dest, "\r\n", "\n", max_len);
|
||||
}
|
||||
char *ptr = buf;
|
||||
int i, j;
|
||||
CString str2;
|
||||
|
||||
// ditto for SCP_string
|
||||
void deconvert_multiline_string(SCP_string &dest, const CString &str)
|
||||
{
|
||||
dest = str;
|
||||
replace_all(dest, "\r\n", "\n");
|
||||
Assert(max_len > 1);
|
||||
Assert(ptr!=NULL);
|
||||
max_len -= 2;
|
||||
while ((i = str.Find("\r\n")) >= 0) {
|
||||
for (j=0; j<i; j++)
|
||||
if (max_len) {
|
||||
*ptr++ = str[j];
|
||||
max_len--;
|
||||
}
|
||||
|
||||
*ptr++ = '\n';
|
||||
str2 = str.Mid(i + 2);
|
||||
str = str2;
|
||||
}
|
||||
|
||||
i = str.GetLength();
|
||||
for (j=0; j<i; j++)
|
||||
if (max_len) {
|
||||
*ptr++ = str[j];
|
||||
max_len--;
|
||||
}
|
||||
|
||||
// removed 10/29/98 by DB
|
||||
// this was generating an extra newline - why?
|
||||
//if (*(ptr - 1) != '\n')
|
||||
// *ptr++ = '\n';
|
||||
*ptr = 0;
|
||||
}
|
||||
|
||||
// medal_stuff Medals[NUM_MEDALS];
|
||||
@@ -402,10 +432,6 @@ bool fred_init()
|
||||
Voice_export_selection = 0;
|
||||
|
||||
hud_init_comm_orders(); // Goober5000
|
||||
|
||||
if (!new_alpha_colors_init()) {
|
||||
old_alpha_colors_init();
|
||||
}
|
||||
|
||||
gamesnd_parse_soundstbl(); // needs to be loaded after species stuff but before interface/weapon/ship stuff - taylor
|
||||
mission_brief_common_init();
|
||||
@@ -724,8 +750,8 @@ int create_object(vec3d *pos, int waypoint_instance)
|
||||
obj = create_player(Player_starts, pos, NULL, Default_player_model);
|
||||
|
||||
} else if (cur_model_index == Id_select_type_jump_node) {
|
||||
CJumpNode* jnp = new CJumpNode(pos);
|
||||
obj = jnp->GetSCPObjectNumber();
|
||||
jump_node* jnp = new jump_node(pos);
|
||||
obj = jnp->get_objnum();
|
||||
Jump_nodes.push_back(*jnp);
|
||||
} else if(Ship_info[cur_model_index].flags & SIF_NO_FRED){
|
||||
obj = -1;
|
||||
@@ -896,8 +922,7 @@ void clear_mission()
|
||||
Team_data[i].ship_list[count] = j;
|
||||
strcpy_s(Team_data[i].ship_list_variables[count], "");
|
||||
Team_data[i].ship_count[count] = 5;
|
||||
strcpy_s(Team_data[i].ship_count_variables[count], "");
|
||||
count++;
|
||||
strcpy_s(Team_data[i].ship_count_variables[count++], "");
|
||||
}
|
||||
}
|
||||
Team_data[i].num_ship_choices = count;
|
||||
@@ -912,10 +937,8 @@ void clear_mission()
|
||||
}
|
||||
Team_data[i].weaponry_pool[count] = j;
|
||||
strcpy_s(Team_data[i].weaponry_pool_variable[count], "");
|
||||
strcpy_s(Team_data[i].weaponry_amount_variable[count], "");
|
||||
count++;
|
||||
}
|
||||
Team_data[i].weapon_required[j] = false;
|
||||
strcpy_s(Team_data[i].weaponry_amount_variable[count++], "");
|
||||
}
|
||||
}
|
||||
Team_data[i].num_weapon_choices = count;
|
||||
}
|
||||
@@ -960,8 +983,8 @@ void clear_mission()
|
||||
}
|
||||
|
||||
Nmodel_flags = DEFAULT_NMODEL_FLAGS;
|
||||
The_mission.skybox_flags = DEFAULT_NMODEL_FLAGS;
|
||||
Nmodel_num = -1;
|
||||
vm_set_identity(&Nmodel_orient);
|
||||
Nmodel_bitmap = -1;
|
||||
|
||||
The_mission.contrail_threshold = CONTRAIL_THRESHOLD_DEFAULT;
|
||||
@@ -988,9 +1011,7 @@ void clear_mission()
|
||||
strcpy_s(The_mission.loading_screen[GR_640],"");
|
||||
strcpy_s(The_mission.loading_screen[GR_1024],"");
|
||||
strcpy_s(The_mission.skybox_model, "");
|
||||
vm_set_identity(&The_mission.skybox_orientation);
|
||||
strcpy_s(The_mission.envmap_name, "");
|
||||
The_mission.skybox_flags = DEFAULT_NMODEL_FLAGS;
|
||||
|
||||
// no sound environment
|
||||
The_mission.sound_environment.id = -1;
|
||||
@@ -1237,7 +1258,7 @@ int common_object_delete(int obj)
|
||||
char msg[255], *name;
|
||||
int i, z, r, type;
|
||||
object *objp;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
|
||||
type = Objects[obj].type;
|
||||
if (type == OBJ_START) {
|
||||
@@ -1359,7 +1380,7 @@ int common_object_delete(int obj)
|
||||
|
||||
} else if (type == OBJ_JUMP_NODE) {
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == &Objects[obj])
|
||||
if(jnp->get_obj() == &Objects[obj])
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1646,14 +1667,14 @@ void generate_ship_popup_menu(CMenu *mptr, int first_id, int state, int filter)
|
||||
// Alternate string lookup function, taking a CString instead. The reason that it's here,
|
||||
// instead of parselo.cpp, is because the class CString require an include of windows.h,
|
||||
// which everyone wants to avoid including in any freespace header files. So..
|
||||
int string_lookup(const CString &str1, char *strlist[], int max)
|
||||
int string_lookup(CString str1, char *strlist[], int max)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<max; i++) {
|
||||
Assert(strlen(strlist[i]));
|
||||
|
||||
if (!stricmp((LPCTSTR) str1, strlist[i])){
|
||||
if (!stricmp(str1, strlist[i])){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -1956,7 +1977,7 @@ int get_ship_from_obj(object *objp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ai_update_goal_references(int type, const char *old_name, const char *new_name)
|
||||
void ai_update_goal_references(int type, char *old_name, char *new_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -2448,9 +2469,11 @@ void generate_weaponry_usage_list(int team, int *arr)
|
||||
}
|
||||
}
|
||||
|
||||
CJumpNode *jumpnode_get_by_name(const CString& name)
|
||||
jump_node *jumpnode_get_by_name(CString& name)
|
||||
{
|
||||
CJumpNode *jnp = jumpnode_get_by_name((LPCTSTR) name);
|
||||
jump_node *jnp = jumpnode_get_by_name(name.GetBuffer(name.GetLength()));
|
||||
name.ReleaseBuffer();
|
||||
|
||||
return jnp;
|
||||
}
|
||||
|
||||
@@ -2637,7 +2660,7 @@ void stuff_special_arrival_anchor_name(char *buf, int anchor_num, int retail_for
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
void update_texture_replacements(const char *old_name, const char *new_name)
|
||||
void update_texture_replacements(char *old_name, char *new_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
+7
-11
@@ -62,13 +62,9 @@ extern bool Show_iff[];
|
||||
|
||||
extern CCriticalSection CS_cur_object_index;
|
||||
|
||||
void string_copy(char *dest, const CString &src, int max_len, int modify = 0);
|
||||
void string_copy(SCP_string &dest, const CString &src, int modify = 0);
|
||||
void convert_multiline_string(CString &dest, const SCP_string &src);
|
||||
void convert_multiline_string(CString &dest, const char *src);
|
||||
void deconvert_multiline_string(char *dest, const CString &str, int max_len);
|
||||
void deconvert_multiline_string(SCP_string &dest, const CString &str);
|
||||
|
||||
void string_copy(char *dest, CString &src, int max_len, int modify = 0);
|
||||
CString convert_multiline_string(char *src);
|
||||
void deconvert_multiline_string(char *buf, CString &str, int max_len);
|
||||
bool fred_init();
|
||||
void set_physics_controls();
|
||||
int dup_object(object *objp);
|
||||
@@ -98,7 +94,7 @@ void unmark_all();
|
||||
void clear_menu(CMenu *ptr);
|
||||
void generate_wing_popup_menu(CMenu *mptr, int first_id, int state);
|
||||
void generate_ship_popup_menu(CMenu *mptr, int first_id, int state, int filter = 0);
|
||||
int string_lookup(const CString &str1, char *strlist[], int max);
|
||||
int string_lookup(CString str1, char *strlist[], int max);
|
||||
int update_dialog_boxes();
|
||||
void set_cur_wing(int wing);
|
||||
int gray_menu_tree(CMenu *base);
|
||||
@@ -113,7 +109,7 @@ void correct_marking();
|
||||
int get_ship_from_obj(int obj);
|
||||
int get_ship_from_obj(object *objp);
|
||||
void set_valid_dock_points(int ship, int type, CComboBox *box);
|
||||
void ai_update_goal_references(int type, const char *old_name, const char *new_name);
|
||||
void ai_update_goal_references(int type, char *old_name, char *new_name);
|
||||
int query_referenced_in_ai_goals(int type, char *name);
|
||||
int advanced_stricmp(char *one, char *two);
|
||||
int reference_handler(char *name, int type, int obj);
|
||||
@@ -128,7 +124,7 @@ void generate_weaponry_usage_list(int team, int *arr);
|
||||
void generate_weaponry_usage_list(int *arr, int wing);
|
||||
void generate_ship_usage_list(int *arr, int wing);
|
||||
|
||||
CJumpNode *jumpnode_get_by_name(const CString& name);
|
||||
jump_node *jumpnode_get_by_name(CString& name);
|
||||
|
||||
// function and defines to use when adding ships to combo boxes
|
||||
#define SHIPS_2_COMBO_SPECIAL (1<<0)
|
||||
@@ -142,6 +138,6 @@ 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(const char *old_name, const char *new_name);
|
||||
extern void update_texture_replacements(char *old_name, char *new_name);
|
||||
|
||||
#endif
|
||||
@@ -357,9 +357,8 @@ void CMessageEditorDlg::OnUpdateName()
|
||||
|
||||
int CMessageEditorDlg::update(int num)
|
||||
{
|
||||
char *ptr;
|
||||
char *ptr, buf[MAX_EVENT_SIZE];
|
||||
int i, node, fnode;
|
||||
CString buf;
|
||||
CListBox *list;
|
||||
|
||||
UpdateData(TRUE);
|
||||
@@ -444,9 +443,9 @@ int CMessageEditorDlg::update(int num)
|
||||
ptr = (char *) (LPCTSTR) m_message_name;
|
||||
node = alloc_sexp(ptr, SEXP_ATOM, SEXP_ATOM_STRING, -1, -1);
|
||||
((CComboBox *) GetDlgItem(IDC_PRIORITY))->GetLBText(m_priority, buf);
|
||||
node = alloc_sexp((char *) (LPCTSTR) buf, SEXP_ATOM, SEXP_ATOM_STRING, -1, node);
|
||||
node = alloc_sexp(buf, SEXP_ATOM, SEXP_ATOM_STRING, -1, node);
|
||||
((CComboBox *) GetDlgItem(IDC_SENDER))->GetLBText(m_sender, buf);
|
||||
node = alloc_sexp((char *) (LPCTSTR) buf, SEXP_ATOM, SEXP_ATOM_STRING, -1, node);
|
||||
node = alloc_sexp(buf, SEXP_ATOM, SEXP_ATOM_STRING, -1, node);
|
||||
node = alloc_sexp("send-message", SEXP_ATOM, SEXP_ATOM_OPERATOR, -1, node);
|
||||
node = alloc_sexp("", SEXP_LIST, SEXP_ATOM_LIST, node, -1);
|
||||
node = alloc_sexp("", SEXP_LIST, SEXP_ATOM_LIST, fnode, node);
|
||||
|
||||
@@ -415,10 +415,8 @@ BOOL CMissionNotesDlg::OnInitDialog()
|
||||
m_designer_name_orig = m_designer_name = _T(The_mission.author);
|
||||
m_created = _T(The_mission.created);
|
||||
m_modified = _T(The_mission.modified);
|
||||
convert_multiline_string(m_mission_notes_orig, The_mission.notes);
|
||||
convert_multiline_string(m_mission_notes, The_mission.notes);
|
||||
convert_multiline_string(m_mission_desc_orig, The_mission.mission_desc);
|
||||
convert_multiline_string(m_mission_desc, The_mission.mission_desc);
|
||||
m_mission_notes_orig = m_mission_notes = convert_multiline_string(The_mission.notes);
|
||||
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;
|
||||
@@ -632,12 +630,11 @@ void CMissionNotesDlg::OnSquadLogo()
|
||||
}
|
||||
}
|
||||
|
||||
char *Load_screen_ext = "Image Files (*.dds, *.pcx, *.jpg, *.jpeg, *.tga, *.png)|*.dds;*.pcx;*.jpg;*.jpeg;*.tga;*.png|"
|
||||
char *Load_screen_ext = "Image Files (*.dds, *.pcx, *.jpg, *.jpeg, *.tga)|*.dds;*.pcx;*.jpg;*.jpeg;*.tga|"
|
||||
"DDS Files (*.dds)|*.dds|"
|
||||
"PCX Files (*.pcx)|*.pcx|"
|
||||
"JPG Files (*.jpg; *.jpeg)|*.jpg;*.jpeg|"
|
||||
"TGA Files (*.tga)|*.tga|"
|
||||
"PNG Files (*.png)|*.png|"
|
||||
"All Files (*.*)|*.*|"
|
||||
"|";
|
||||
|
||||
|
||||
+117
-220
@@ -46,19 +46,12 @@
|
||||
#include "globalincs/version.h"
|
||||
#include "sound/sound.h"
|
||||
#include "sound/ds.h"
|
||||
#include "math/vecmat.h"
|
||||
|
||||
|
||||
void CFred_mission_save::convert_special_tags_to_retail(char *text, int max_len)
|
||||
{
|
||||
replace_all(text, "$quote", "''", max_len);
|
||||
replace_all(text, "$semicolon", ",", max_len);
|
||||
}
|
||||
|
||||
void CFred_mission_save::convert_special_tags_to_retail(SCP_string &text)
|
||||
{
|
||||
replace_all(text, "$quote", "''");
|
||||
replace_all(text, "$semicolon", ",");
|
||||
replace_all(Mp, "$quote", "''", max_len);
|
||||
replace_all(Mp, "$semicolon", ",", max_len);
|
||||
}
|
||||
|
||||
// Goober5000 - convert $quote and $semicolon to '' and ,
|
||||
@@ -74,19 +67,19 @@ void CFred_mission_save::convert_special_tags_to_retail()
|
||||
// command briefing
|
||||
for (stage = 0; stage < Cmd_briefs[team].num_stages; stage++)
|
||||
{
|
||||
convert_special_tags_to_retail(Cmd_briefs[team].stage[stage].text);
|
||||
convert_special_tags_to_retail(Cmd_briefs[team].stage[stage].text, CMD_BRIEF_TEXT_MAX);
|
||||
}
|
||||
|
||||
// briefing
|
||||
for (stage = 0; stage < Briefings[team].num_stages; stage++)
|
||||
{
|
||||
convert_special_tags_to_retail(Briefings[team].stages[stage].text);
|
||||
convert_special_tags_to_retail(Briefings[team].stages[stage].new_text, MAX_BRIEF_LEN);
|
||||
}
|
||||
|
||||
// debriefing
|
||||
for (stage = 0; stage < Debriefings[team].num_stages; stage++)
|
||||
{
|
||||
convert_special_tags_to_retail(Debriefings[team].stages[stage].text);
|
||||
convert_special_tags_to_retail(Debriefings[team].stages[stage].new_text, MAX_DEBRIEF_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +323,7 @@ int CFred_mission_save::save_mission_info()
|
||||
#endif
|
||||
|
||||
if ( optional_string_fred("+Game Type Flags:")){
|
||||
parse_comments(1);
|
||||
parse_comments(2);
|
||||
} else {
|
||||
fout("\n+Game Type Flags:");
|
||||
}
|
||||
@@ -338,7 +331,7 @@ int CFred_mission_save::save_mission_info()
|
||||
fout(" %d", The_mission.game_type);
|
||||
|
||||
if (optional_string_fred("+Flags:")){
|
||||
parse_comments(1);
|
||||
parse_comments(2);
|
||||
} else {
|
||||
fout("\n+Flags:");
|
||||
}
|
||||
@@ -420,7 +413,7 @@ int CFred_mission_save::save_mission_info()
|
||||
}
|
||||
|
||||
if ( optional_string_fred("+Disallow Support:")){
|
||||
parse_comments(1);
|
||||
parse_comments(2);
|
||||
} else {
|
||||
fout("\n+Disallow Support:");
|
||||
}
|
||||
@@ -431,14 +424,14 @@ int CFred_mission_save::save_mission_info()
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL)
|
||||
{
|
||||
if ( optional_string_fred("+Hull Repair Ceiling:")) {
|
||||
parse_comments(1);
|
||||
parse_comments(2);
|
||||
} else {
|
||||
fout("\n+Hull Repair Ceiling:");
|
||||
}
|
||||
fout(" %f", The_mission.support_ships.max_hull_repair_val);
|
||||
|
||||
if ( optional_string_fred("+Subsystem Repair Ceiling:")) {
|
||||
parse_comments(1);
|
||||
parse_comments(2);
|
||||
} else {
|
||||
fout("\n+Subsystem Repair Ceiling:");
|
||||
}
|
||||
@@ -573,21 +566,6 @@ int CFred_mission_save::save_mission_info()
|
||||
bypass_comment(";;FSO 3.6.0;; $Skybox Model:");
|
||||
}
|
||||
|
||||
// orientation?
|
||||
if ((strlen(The_mission.skybox_model) > 0) && !vm_matrix_same(&vmd_identity_matrix, &The_mission.skybox_orientation)) {
|
||||
if (optional_string_fred("+Skybox Orientation:")) {
|
||||
parse_comments(1);
|
||||
save_matrix(The_mission.skybox_orientation);
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.14;;");
|
||||
fout_version("\n+Skybox Orientation:");
|
||||
save_matrix(The_mission.skybox_orientation);
|
||||
fso_comment_pop();
|
||||
}
|
||||
} else {
|
||||
bypass_comment(";;FSO 3.6.14;; +Skybox Orientation:");
|
||||
}
|
||||
|
||||
// are skybox flags in use?
|
||||
if (The_mission.skybox_flags != DEFAULT_NMODEL_FLAGS) {
|
||||
//char out_str[4096];
|
||||
@@ -599,7 +577,8 @@ int CFred_mission_save::save_mission_info()
|
||||
fout_version("\n+Skybox Flags: %d", The_mission.skybox_flags);
|
||||
fso_comment_pop();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bypass_comment(";;FSO 3.6.11;; +Skybox Flags:");
|
||||
}
|
||||
|
||||
@@ -700,8 +679,8 @@ int CFred_mission_save::save_plot_info()
|
||||
|
||||
int CFred_mission_save::save_cutscenes()
|
||||
{
|
||||
char type[NAME_LENGTH];
|
||||
SCP_string sexp_out;
|
||||
char type[NAME_LENGTH];
|
||||
char out[MULTITEXT_LENGTH];
|
||||
|
||||
// Let's just assume it has them for now -
|
||||
if (!(The_mission.cutscenes.empty()) ) {
|
||||
@@ -731,10 +710,7 @@ int CFred_mission_save::save_cutscenes()
|
||||
break;
|
||||
case MOVIE_PRE_DEBRIEF:
|
||||
strcpy_s(type, "$Debriefing Cutscene:");
|
||||
break;
|
||||
case MOVIE_END_CAMPAIGN:
|
||||
strcpy_s(type, "$Campaign End Cutscene:");
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
Int3();
|
||||
continue;
|
||||
@@ -750,15 +726,15 @@ int CFred_mission_save::save_cutscenes()
|
||||
|
||||
required_string_fred("+formula:");
|
||||
parse_comments();
|
||||
convert_sexp_to_string(sexp_out, The_mission.cutscenes[i].formula, SEXP_SAVE_MODE);
|
||||
fout(" %s", sexp_out.c_str());
|
||||
convert_sexp_to_string(The_mission.cutscenes[i].formula, out, SEXP_SAVE_MODE, MAX_EVENT_SIZE);
|
||||
fout(" %s", out);
|
||||
}
|
||||
}
|
||||
required_string_fred("#end");
|
||||
parse_comments();
|
||||
}
|
||||
else {
|
||||
MessageBox(NULL, "Warning: This mission contains cutscene data, but you are saving in the retail mission format. This information will be lost", "Incompatibility with retail mission format", MB_OK);
|
||||
MessageBox(NULL, "Warning: This mission contains cutscene data, but you are saving in the retail mission format. This infomration will be lost", "Incompatibility with retail mission format", MB_OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -823,7 +799,7 @@ int CFred_mission_save::save_cmd_brief()
|
||||
parse_comments(2);
|
||||
|
||||
// XSTR
|
||||
fout_ext("\n", "%s", Cur_cmd_brief->stage[stage].text.c_str());
|
||||
fout_ext("\n", "%s", Cur_cmd_brief->stage[stage].text);
|
||||
|
||||
required_string_fred("$end_multi_text", "$Stage Text:");
|
||||
parse_comments();
|
||||
@@ -859,7 +835,7 @@ int CFred_mission_save::save_cmd_briefs()
|
||||
int CFred_mission_save::save_briefing()
|
||||
{
|
||||
int i,j,k, nb;
|
||||
SCP_string sexp_out;
|
||||
char out[MAX_EVENT_SIZE];
|
||||
brief_stage *bs;
|
||||
brief_icon *bi;
|
||||
|
||||
@@ -886,7 +862,8 @@ int CFred_mission_save::save_briefing()
|
||||
parse_comments();
|
||||
|
||||
// XSTR
|
||||
fout_ext("\n", "%s", bs->text.c_str());
|
||||
sprintf(out,"%s", bs->new_text);
|
||||
fout_ext("\n", out);
|
||||
|
||||
required_string_fred("$end_multi_text", "$start_stage");
|
||||
parse_comments();
|
||||
@@ -938,8 +915,8 @@ int CFred_mission_save::save_briefing()
|
||||
|
||||
required_string_fred("$Formula:");
|
||||
parse_comments();
|
||||
convert_sexp_to_string(sexp_out, bs->formula, SEXP_SAVE_MODE);
|
||||
fout(" %s", sexp_out.c_str());
|
||||
convert_sexp_to_string(bs->formula, out, SEXP_SAVE_MODE, MAX_EVENT_SIZE);
|
||||
fout(" %s", out);
|
||||
|
||||
for ( j = 0; j < bs->num_icons; j++ ) {
|
||||
bi = &bs->icons[j];
|
||||
@@ -1027,7 +1004,7 @@ int CFred_mission_save::save_briefing()
|
||||
int CFred_mission_save::save_debriefing()
|
||||
{
|
||||
int j, i;
|
||||
SCP_string sexp_out;
|
||||
char out[MAX_EVENT_SIZE];
|
||||
|
||||
for ( j = 0; j < Num_teams; j++ ) {
|
||||
|
||||
@@ -1043,13 +1020,13 @@ int CFred_mission_save::save_debriefing()
|
||||
for (i=0; i<Debriefing->num_stages; i++) {
|
||||
required_string_fred("$Formula:");
|
||||
parse_comments(2);
|
||||
convert_sexp_to_string(sexp_out, Debriefing->stages[i].formula, SEXP_SAVE_MODE);
|
||||
fout(" %s", sexp_out.c_str());
|
||||
convert_sexp_to_string(Debriefing->stages[i].formula, out, SEXP_SAVE_MODE, MAX_EVENT_SIZE);
|
||||
fout(" %s", out);
|
||||
|
||||
// XSTR
|
||||
required_string_fred("$Multi text");
|
||||
parse_comments();
|
||||
fout_ext("\n ", "%s", Debriefing->stages[i].text.c_str());
|
||||
fout_ext("\n ", "%s", Debriefing->stages[i].new_text);
|
||||
|
||||
required_string_fred("$end_multi_text");
|
||||
parse_comments();
|
||||
@@ -1065,7 +1042,7 @@ int CFred_mission_save::save_debriefing()
|
||||
// XSTR
|
||||
required_string_fred("$Recommendation text:");
|
||||
parse_comments();
|
||||
fout_ext("\n ", "%s", Debriefing->stages[i].recommendation_text.c_str());
|
||||
fout_ext("\n ", "%s", Debriefing->stages[i].new_recommendation_text);
|
||||
|
||||
required_string_fred("$end_multi_text");
|
||||
parse_comments();
|
||||
@@ -1280,32 +1257,6 @@ int CFred_mission_save::save_players()
|
||||
|
||||
fout(")");
|
||||
|
||||
// Goober5000 - mjn.mixael's required weapon feature
|
||||
bool uses_required_weapon = false;
|
||||
for (j=0; j<MAX_WEAPON_TYPES; j++)
|
||||
{
|
||||
if (Team_data[i].weapon_required[j])
|
||||
{
|
||||
uses_required_weapon = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (uses_required_weapon)
|
||||
{
|
||||
if (optional_string_fred("+Required for mission:", "$Starting Shipname:"))
|
||||
parse_comments(2);
|
||||
else
|
||||
fout("\n+Required for mission:");
|
||||
|
||||
fout(" (");
|
||||
for (j=0; j<MAX_WEAPON_TYPES; j++)
|
||||
{
|
||||
if (Team_data[i].weapon_required[j])
|
||||
fout(" \"%s\"", Weapon_info[j].name);
|
||||
}
|
||||
fout(" )");
|
||||
}
|
||||
|
||||
fso_comment_pop();
|
||||
}
|
||||
|
||||
@@ -1350,7 +1301,7 @@ void CFred_mission_save::save_single_dock_instance(ship *shipp, dock_instance *d
|
||||
|
||||
int CFred_mission_save::save_objects()
|
||||
{
|
||||
SCP_string sexp_out;
|
||||
char out[MAX_EVENT_SIZE];
|
||||
int i, j, k, z;
|
||||
ai_info *aip;
|
||||
object *objp;
|
||||
@@ -1418,12 +1369,6 @@ int CFred_mission_save::save_objects()
|
||||
parse_comments();
|
||||
fout(" %s", Iff_info[shipp->team].iff_name);
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].uses_team_colors) {
|
||||
required_string_fred("$Team Color Setting:");
|
||||
parse_comments();
|
||||
fout(" %s", shipp->team_name.c_str());
|
||||
}
|
||||
|
||||
required_string_fred("$Location:");
|
||||
parse_comments();
|
||||
save_vector(Objects[shipp->objnum].pos);
|
||||
@@ -1545,8 +1490,8 @@ int CFred_mission_save::save_objects()
|
||||
|
||||
required_string_fred("$Arrival Cue:");
|
||||
parse_comments();
|
||||
convert_sexp_to_string(sexp_out, shipp->arrival_cue, SEXP_SAVE_MODE);
|
||||
fout(" %s", sexp_out.c_str());
|
||||
convert_sexp_to_string(shipp->arrival_cue, out, SEXP_SAVE_MODE, MAX_EVENT_SIZE);
|
||||
fout(" %s", out);
|
||||
|
||||
required_string_fred("$Departure Location:");
|
||||
parse_comments();
|
||||
@@ -1601,8 +1546,8 @@ int CFred_mission_save::save_objects()
|
||||
|
||||
required_string_fred("$Departure Cue:");
|
||||
parse_comments();
|
||||
convert_sexp_to_string(sexp_out, shipp->departure_cue, SEXP_SAVE_MODE);
|
||||
fout(" %s", sexp_out.c_str());
|
||||
convert_sexp_to_string(shipp->departure_cue, out, SEXP_SAVE_MODE, MAX_EVENT_SIZE);
|
||||
fout(" %s", out);
|
||||
|
||||
required_string_fred("$Determination:");
|
||||
parse_comments();
|
||||
@@ -2129,13 +2074,8 @@ int CFred_mission_save::save_common_object_data(object *objp, ship *shipp)
|
||||
fout("\n+Primary Banks:");
|
||||
|
||||
fout(" ( ");
|
||||
for (j=0; j<wp->num_primary_banks; j++) {
|
||||
if (wp->primary_bank_weapons[j] != -1) { // Just in case someone has set a weapon bank to empty
|
||||
fout("\"%s\" ", Weapon_info[wp->primary_bank_weapons[j]].name);
|
||||
} else {
|
||||
fout("\"\" ");
|
||||
}
|
||||
}
|
||||
for (j=0; j<wp->num_primary_banks; j++)
|
||||
fout("\"%s\" ", Weapon_info[wp->primary_bank_weapons[j]].name);
|
||||
|
||||
fout(")");
|
||||
}
|
||||
@@ -2153,13 +2093,8 @@ int CFred_mission_save::save_common_object_data(object *objp, ship *shipp)
|
||||
fout("\n+Secondary Banks:");
|
||||
|
||||
fout(" ( ");
|
||||
for (j=0; j<wp->num_secondary_banks; j++) {
|
||||
if (wp->secondary_bank_weapons[j] != -1) {
|
||||
fout("\"%s\" ", Weapon_info[wp->secondary_bank_weapons[j]].name);
|
||||
} else {
|
||||
fout("\"\" ");
|
||||
}
|
||||
}
|
||||
for (j=0; j<wp->num_secondary_banks; j++)
|
||||
fout("\"%s\" ", Weapon_info[wp->secondary_bank_weapons[j]].name);
|
||||
|
||||
fout(")");
|
||||
}
|
||||
@@ -2244,7 +2179,7 @@ int CFred_mission_save::save_common_object_data(object *objp, ship *shipp)
|
||||
|
||||
int CFred_mission_save::save_wings()
|
||||
{
|
||||
SCP_string sexp_out;
|
||||
char out[MAX_EVENT_SIZE];
|
||||
int i, j, z, ship, count = 0;
|
||||
|
||||
fred_parse_flag = 0;
|
||||
@@ -2364,8 +2299,8 @@ int CFred_mission_save::save_wings()
|
||||
|
||||
required_string_fred("$Arrival Cue:");
|
||||
parse_comments();
|
||||
convert_sexp_to_string(sexp_out, Wings[i].arrival_cue, SEXP_SAVE_MODE);
|
||||
fout(" %s", sexp_out.c_str());
|
||||
convert_sexp_to_string(Wings[i].arrival_cue, out, SEXP_SAVE_MODE, MAX_EVENT_SIZE);
|
||||
fout(" %s", out);
|
||||
|
||||
required_string_fred("$Departure Location:");
|
||||
parse_comments();
|
||||
@@ -2420,8 +2355,8 @@ int CFred_mission_save::save_wings()
|
||||
|
||||
required_string_fred("$Departure Cue:");
|
||||
parse_comments();
|
||||
convert_sexp_to_string(sexp_out, Wings[i].departure_cue, SEXP_SAVE_MODE);
|
||||
fout(" %s", sexp_out.c_str());
|
||||
convert_sexp_to_string(Wings[i].departure_cue, out, SEXP_SAVE_MODE, MAX_EVENT_SIZE);
|
||||
fout(" %s", out);
|
||||
|
||||
required_string_fred("$Ships:");
|
||||
parse_comments();
|
||||
@@ -2500,7 +2435,7 @@ int CFred_mission_save::save_wings()
|
||||
|
||||
int CFred_mission_save::save_goals()
|
||||
{
|
||||
SCP_string sexp_out;
|
||||
char out[MAX_EVENT_SIZE];
|
||||
int i;
|
||||
|
||||
fred_parse_flag = 0;
|
||||
@@ -2537,8 +2472,8 @@ int CFred_mission_save::save_goals()
|
||||
|
||||
required_string_fred("$Formula:");
|
||||
parse_comments();
|
||||
convert_sexp_to_string(sexp_out, Mission_goals[i].formula, SEXP_SAVE_MODE);
|
||||
fout(" %s", sexp_out.c_str());
|
||||
convert_sexp_to_string(Mission_goals[i].formula, out, SEXP_SAVE_MODE, MAX_EVENT_SIZE);
|
||||
fout(" %s", out);
|
||||
|
||||
if ( Mission_goals[i].type & INVALID_GOAL ) {
|
||||
if (optional_string_fred("+Invalid", "$Type:"))
|
||||
@@ -2587,37 +2522,37 @@ int CFred_mission_save::save_waypoints()
|
||||
parse_comments(2);
|
||||
fout("\t\t;! %d lists total\n", Waypoint_lists.size());
|
||||
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp)
|
||||
{
|
||||
required_string_fred("$Jump Node:", "$Jump Node Name:");
|
||||
parse_comments(2);
|
||||
save_vector(jnp->GetSCPObject()->pos);
|
||||
save_vector(jnp->get_obj()->pos);
|
||||
|
||||
required_string_fred("$Jump Node Name:", "$Jump Node:");
|
||||
parse_comments();
|
||||
fout(" %s", jnp->GetName());
|
||||
fout(" %s", jnp->get_name_ptr());
|
||||
|
||||
if(jnp->IsSpecialModel())
|
||||
if(jnp->is_special_model())
|
||||
{
|
||||
if ( optional_string_fred("+Model File:", "$Jump Node:"))
|
||||
parse_comments();
|
||||
else
|
||||
fout("\n+Model File:");
|
||||
|
||||
int model = jnp->GetModelNumber();
|
||||
int model = jnp->get_modelnum();
|
||||
polymodel *pm = model_get(model);
|
||||
fout(" %s", pm->filename );
|
||||
}
|
||||
|
||||
if(jnp->IsColored())
|
||||
if(jnp->is_colored())
|
||||
{
|
||||
if ( optional_string_fred("+Alphacolor:", "$Jump Node:"))
|
||||
parse_comments();
|
||||
else
|
||||
fout("\n+Alphacolor:");
|
||||
|
||||
color jn_color = jnp->GetColor();
|
||||
color jn_color = jnp->get_color();
|
||||
fout(" %u %u %u %u", jn_color.red, jn_color.green, jn_color.blue, jn_color.alpha );
|
||||
}
|
||||
|
||||
@@ -2625,12 +2560,12 @@ int CFred_mission_save::save_waypoints()
|
||||
if(hidden_is_there)
|
||||
parse_comments();
|
||||
|
||||
if(hidden_is_there || jnp->IsHidden())
|
||||
if(hidden_is_there || jnp->is_hidden())
|
||||
{
|
||||
if(!hidden_is_there)
|
||||
fout("\n+Hidden:");
|
||||
|
||||
if(jnp->IsHidden())
|
||||
if(jnp->is_hidden())
|
||||
fout(" %s", "true");
|
||||
else
|
||||
fout(" %s", "false");
|
||||
@@ -2939,7 +2874,7 @@ void CFred_mission_save::parse_comments(int newlines)
|
||||
|
||||
int CFred_mission_save::fout_version(char *format, ...)
|
||||
{
|
||||
SCP_string str_scp;
|
||||
char str[16384];
|
||||
char *ch = NULL;
|
||||
va_list args;
|
||||
|
||||
@@ -2950,31 +2885,33 @@ int CFred_mission_save::fout_version(char *format, ...)
|
||||
// output the version first thing, but skip the special case where we use
|
||||
// fout_version() for multiline value strings (typically indicated by an initial space)
|
||||
if ( (Format_fs2_open == FSO_FORMAT_COMPATIBILITY_MODE) && (*format != ' ') && !fso_ver_comment.empty() ) {
|
||||
int len = 0;
|
||||
while (*format == '\n') {
|
||||
str_scp.append(1, *format);
|
||||
str[len++] = '\n';
|
||||
format++;
|
||||
}
|
||||
|
||||
str_scp.append(fso_ver_comment.back().c_str());
|
||||
str_scp.append(" ");
|
||||
str[len] = '\0';
|
||||
|
||||
cfputs(const_cast<char*>(str_scp.c_str()), fp);
|
||||
strcat_s(str, fso_ver_comment.back().c_str());
|
||||
strcat_s(str, " ");
|
||||
|
||||
str_scp = "";
|
||||
cfputs(str, fp);
|
||||
|
||||
memset(str, 0, sizeof(str));
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(str_scp, format, args);
|
||||
vsprintf(str, format, args);
|
||||
va_end(args);
|
||||
|
||||
char *str_c = vm_strdup(str_scp.c_str());
|
||||
Assert(strlen(str) < 16384);
|
||||
|
||||
// this could be a multi-line string, so we've got to handle it all properly
|
||||
if ( (Format_fs2_open == FSO_FORMAT_COMPATIBILITY_MODE) && !fso_ver_comment.empty() ) {
|
||||
bool first_line = true;
|
||||
char *str_p = str_c;
|
||||
char *str_p = str;
|
||||
|
||||
ch = strchr(str_c, '\n');
|
||||
ch = strchr(str, '\n');
|
||||
|
||||
// if we have something, and it's not just at the end, then process it specially
|
||||
if ( (ch != NULL) && (*(ch+1) != '\0') ) {
|
||||
@@ -2985,7 +2922,7 @@ int CFred_mission_save::fout_version(char *format, ...)
|
||||
if (first_line) {
|
||||
first_line = false;
|
||||
} else {
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs((char*)fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(" ", fp);
|
||||
}
|
||||
|
||||
@@ -2997,7 +2934,7 @@ int CFred_mission_save::fout_version(char *format, ...)
|
||||
if (first_line) {
|
||||
first_line = false;
|
||||
} else {
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs((char*)fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(" ", fp);
|
||||
}
|
||||
|
||||
@@ -3011,43 +2948,42 @@ int CFred_mission_save::fout_version(char *format, ...)
|
||||
|
||||
// be sure to account for any ending elements too
|
||||
if ( strlen(str_p) ) {
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs((char*)fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(" ", fp);
|
||||
cfputs(str_p, fp);
|
||||
}
|
||||
|
||||
vm_free(str_c);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
cfputs(str_c, fp);
|
||||
cfputs(str, fp);
|
||||
|
||||
vm_free(str_c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CFred_mission_save::fout(char *format, ...)
|
||||
{
|
||||
SCP_string str;
|
||||
char str[16384];
|
||||
va_list args;
|
||||
|
||||
if (err) {
|
||||
if (err){
|
||||
return err;
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(str, format, args);
|
||||
va_end(args);
|
||||
Assert(strlen(str) < 16384);
|
||||
|
||||
cfputs(const_cast<char*>(str.c_str()), fp);
|
||||
cfputs(str, fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
|
||||
{
|
||||
SCP_string str_scp;
|
||||
SCP_string str_out_scp;
|
||||
char str[16384];
|
||||
char str_out[16384] = "";
|
||||
va_list args;
|
||||
int str_id;
|
||||
|
||||
@@ -3056,45 +2992,37 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(str_scp, format, args);
|
||||
vsprintf(str, format, args);
|
||||
va_end(args);
|
||||
Assert(strlen(str) < 16384);
|
||||
|
||||
memset(str_out, 0, sizeof(str_out));
|
||||
|
||||
if (pre_str) {
|
||||
str_out_scp = pre_str;
|
||||
strcpy_s(str_out, pre_str);
|
||||
}
|
||||
|
||||
// lookup the string in the hash table
|
||||
str_id = fhash_string_exists(str_scp.c_str());
|
||||
str_id = fhash_string_exists(str);
|
||||
|
||||
// doesn't exist, so assign it an ID of -1 and stick it in the table
|
||||
if (str_id <= -2) {
|
||||
str_out_scp += " XSTR(\"";
|
||||
str_out_scp += str_scp;
|
||||
str_out_scp += "\", -1)";
|
||||
sprintf(str_out+strlen(str_out), " XSTR(\"%s\", -1)", str);
|
||||
|
||||
// add the string to the table
|
||||
fhash_add_str(str_scp.c_str(), -1);
|
||||
fhash_add_str(str, -1);
|
||||
}
|
||||
// _does_ exist, so just write it out as it is
|
||||
else {
|
||||
char buf[10];
|
||||
sprintf(buf, "%d", str_id);
|
||||
|
||||
str_out_scp += " XSTR(\"";
|
||||
str_out_scp += str_scp;
|
||||
str_out_scp += "\", ";
|
||||
str_out_scp += buf;
|
||||
str_out_scp += ")";
|
||||
sprintf(str_out+strlen(str_out), " XSTR(\"%s\", %d)", str, str_id);
|
||||
}
|
||||
|
||||
char *str_out_c = vm_strdup(str_out_scp.c_str());
|
||||
|
||||
// this could be a multi-line string, so we've got to handle it all properly
|
||||
if ( !fso_ver_comment.empty() ) {
|
||||
bool first_line = true;
|
||||
char *str_p = str_out_c;
|
||||
char *str_p = str_out;
|
||||
|
||||
char *ch = strchr(str_out_c, '\n');
|
||||
char *ch = strchr(str_out, '\n');
|
||||
|
||||
// if we have something, and it's not just at the end, then process it specially
|
||||
if ( (ch != NULL) && (*(ch+1) != '\0') ) {
|
||||
@@ -3105,7 +3033,7 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
|
||||
if (first_line) {
|
||||
first_line = false;
|
||||
} else {
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs((char*)fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(" ", fp);
|
||||
}
|
||||
|
||||
@@ -3117,7 +3045,7 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
|
||||
if (first_line) {
|
||||
first_line = false;
|
||||
} else {
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs((char*)fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(" ", fp);
|
||||
}
|
||||
|
||||
@@ -3131,19 +3059,17 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
|
||||
|
||||
// be sure to account for any ending elements too
|
||||
if ( strlen(str_p) ) {
|
||||
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
|
||||
cfputs((char*)fso_ver_comment.back().c_str(), fp);
|
||||
cfputs(" ", fp);
|
||||
cfputs(str_p, fp);
|
||||
}
|
||||
|
||||
vm_free(str_out_c);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
cfputs(str_out_c, fp);
|
||||
cfputs(str_out, fp);
|
||||
|
||||
vm_free(str_out_c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3296,8 +3222,8 @@ void CFred_mission_save::save_ai_goals(ai_goal *goalp, int ship)
|
||||
|
||||
int CFred_mission_save::save_events()
|
||||
{
|
||||
SCP_string sexp_out;
|
||||
int i, j, add_flag;
|
||||
char out[MAX_EVENT_SIZE];
|
||||
int i;
|
||||
|
||||
fred_parse_flag = 0;
|
||||
required_string_fred("#Events");
|
||||
@@ -3308,8 +3234,8 @@ int CFred_mission_save::save_events()
|
||||
required_string_either_fred("$Formula:", "#Goals");
|
||||
required_string_fred("$Formula:");
|
||||
parse_comments(i ? 2 : 1);
|
||||
convert_sexp_to_string(sexp_out, Mission_events[i].formula, SEXP_SAVE_MODE);
|
||||
fout(" %s", sexp_out.c_str());
|
||||
convert_sexp_to_string(Mission_events[i].formula, out, SEXP_SAVE_MODE, MAX_EVENT_SIZE);
|
||||
fout(" %s", out);
|
||||
|
||||
if (*Mission_events[i].name) {
|
||||
if (optional_string_fred("+Name:", "$Formula:")){
|
||||
@@ -3327,13 +3253,7 @@ int CFred_mission_save::save_events()
|
||||
fout("\n+Repeat Count:");
|
||||
}
|
||||
|
||||
// if we have a trigger count but no repeat count, we want the event to loop until it has triggered enough times
|
||||
if ( Mission_events[i].repeat_count == 1 && Mission_events[i].trigger_count != 1) {
|
||||
fout(" -1");
|
||||
}
|
||||
else {
|
||||
fout(" %d", Mission_events[i].repeat_count);
|
||||
}
|
||||
fout(" %d", Mission_events[i].repeat_count);
|
||||
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL && Mission_events[i].trigger_count != 1 ) {
|
||||
if ( optional_string_fred("+Trigger Count:", "$Formula:")){
|
||||
@@ -3406,24 +3326,6 @@ int CFred_mission_save::save_events()
|
||||
fout(" %d", Mission_events[i].team);
|
||||
}
|
||||
|
||||
if (Format_fs2_open != FSO_FORMAT_RETAIL && Mission_events[i].mission_log_flags != 0 ) {
|
||||
if ( optional_string_fred("+Event Log Flags: (", "$Formula:")){
|
||||
parse_comments();
|
||||
} else {
|
||||
fso_comment_push(";;FSO 3.6.11;;");
|
||||
fout_version("\n+Event Log Flags: (");
|
||||
fso_comment_pop();
|
||||
}
|
||||
|
||||
for (j = 0; j < MAX_MISSION_EVENT_LOG_FLAGS ; j++) {
|
||||
add_flag = 1 << j;
|
||||
if (Mission_events[i].mission_log_flags & add_flag ) {
|
||||
fout(" \"%s\"", Mission_event_log_flags[j]);
|
||||
}
|
||||
}
|
||||
fout(" )");
|
||||
}
|
||||
|
||||
fso_comment_pop();
|
||||
}
|
||||
|
||||
@@ -3866,13 +3768,9 @@ void CFred_mission_save::save_turret_info(ship_subsys *ptr, int ship)
|
||||
fout("\n+Primary Banks:");
|
||||
|
||||
fout(" ( ");
|
||||
for (i=0; i<wp->num_primary_banks; i++) {
|
||||
if (wp->primary_bank_weapons[i] != -1) { // Just in case someone has set a weapon bank to empty
|
||||
fout("\"%s\" ", Weapon_info[wp->primary_bank_weapons[i]].name);
|
||||
} else {
|
||||
fout("\"\" ");
|
||||
}
|
||||
}
|
||||
for (i=0; i<wp->num_primary_banks; i++)
|
||||
fout("\"%s\" ", Weapon_info[wp->primary_bank_weapons[i]].name);
|
||||
|
||||
fout(")");
|
||||
}
|
||||
|
||||
@@ -3889,13 +3787,9 @@ void CFred_mission_save::save_turret_info(ship_subsys *ptr, int ship)
|
||||
fout("\n+Secondary Banks:");
|
||||
|
||||
fout(" ( ");
|
||||
for (i=0; i<wp->num_secondary_banks; i++) {
|
||||
if (wp->secondary_bank_weapons[i] != -1) {
|
||||
fout("\"%s\" ", Weapon_info[wp->secondary_bank_weapons[i]].name);
|
||||
} else {
|
||||
fout("\"\" ");
|
||||
}
|
||||
}
|
||||
for (i=0; i<wp->num_secondary_banks; i++)
|
||||
fout("\"%s\" ", Weapon_info[wp->secondary_bank_weapons[i]].name);
|
||||
|
||||
fout(")");
|
||||
}
|
||||
|
||||
@@ -4170,21 +4064,24 @@ int CFred_mission_save::save_campaign_file(char *pathname)
|
||||
|
||||
void CFred_mission_save::save_campaign_sexp(int node, int link_num)
|
||||
{
|
||||
SCP_string sexp_out;
|
||||
char out[MAX_EVENT_SIZE];
|
||||
|
||||
Sexp_string = out;
|
||||
*out = 0;
|
||||
Assert(node >= 0);
|
||||
|
||||
// if the link num is -1, then this is a end-of-campaign location
|
||||
if ( link_num != -1 ) {
|
||||
if (build_sexp_string(sexp_out, node, 2, SEXP_SAVE_MODE)) {
|
||||
fout(" (\n %s\n ( next-mission \"%s\" )\n )\n", sexp_out.c_str(), Campaign.missions[link_num].name);
|
||||
if (build_sexp_string(node, 2, SEXP_SAVE_MODE, MAX_EVENT_SIZE)) {
|
||||
fout(" (\n %s\n ( next-mission \"%s\" )\n )\n", out, Campaign.missions[link_num].name);
|
||||
} else {
|
||||
fout(" ( %s( next-mission \"%s\" ) )\n", sexp_out.c_str(), Campaign.missions[link_num].name);
|
||||
fout(" ( %s( next-mission \"%s\" ) )\n", out, Campaign.missions[link_num].name);
|
||||
}
|
||||
} else {
|
||||
if (build_sexp_string(sexp_out, node, 2, SEXP_SAVE_MODE)) {
|
||||
fout(" (\n %s\n ( end-of-campaign )\n )\n", sexp_out.c_str());
|
||||
if (build_sexp_string(node, 2, SEXP_SAVE_MODE, MAX_EVENT_SIZE)) {
|
||||
fout(" (\n %s\n ( end-of-campaign )\n )\n", out);
|
||||
} else {
|
||||
fout(" ( %s( end-of-campaign ) )\n", sexp_out.c_str());
|
||||
fout(" ( %s( end-of-campaign ) )\n", out );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4192,11 +4089,11 @@ void CFred_mission_save::save_campaign_sexp(int node, int link_num)
|
||||
void CFred_mission_save::fso_comment_push(char *ver)
|
||||
{
|
||||
if ( fso_ver_comment.empty() ) {
|
||||
fso_ver_comment.push_back( SCP_string(ver) );
|
||||
fso_ver_comment.push_back( std::string(ver) );
|
||||
return;
|
||||
}
|
||||
|
||||
SCP_string before = fso_ver_comment.back();
|
||||
std::string before = fso_ver_comment.back();
|
||||
|
||||
int major, minor, build, revis;
|
||||
int in_major, in_minor, in_build, in_revis;
|
||||
@@ -4219,7 +4116,7 @@ void CFred_mission_save::fso_comment_push(char *ver)
|
||||
// the push'd version is older than our current version, so just push a copy of the previous version
|
||||
fso_ver_comment.push_back( before );
|
||||
} else {
|
||||
fso_ver_comment.push_back( SCP_string(ver) );
|
||||
fso_ver_comment.push_back( std::string(ver) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
class CFred_mission_save {
|
||||
private:
|
||||
char *raw_ptr;
|
||||
SCP_vector<SCP_string> fso_ver_comment;
|
||||
std::vector<std::string> fso_ver_comment;
|
||||
int err;
|
||||
CFILE *fp;
|
||||
|
||||
@@ -59,7 +59,6 @@ private:
|
||||
void save_single_dock_instance(ship *shipp, dock_instance *dock_ptr);
|
||||
|
||||
void convert_special_tags_to_retail(char *text, int max_len);
|
||||
void convert_special_tags_to_retail(SCP_string &text);
|
||||
void convert_special_tags_to_retail();
|
||||
|
||||
public:
|
||||
|
||||
@@ -272,7 +272,7 @@ BOOL reinforcement_select::OnInitDialog()
|
||||
box = (CListBox *) GetDlgItem(IDC_LIST);
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if (ptr->type == OBJ_SHIP && Ships[ptr->instance].wingnum < 0) {
|
||||
if (ptr->type == OBJ_SHIP) {
|
||||
z = box->AddString(Ships[ptr->instance].ship_name);
|
||||
box->SetItemData(z, OBJ_INDEX(ptr));
|
||||
}
|
||||
|
||||
+1
-17
@@ -643,7 +643,6 @@
|
||||
#define IDC_NEB2_TEXTURE 1244
|
||||
#define IDC_SHIP_ALT 1244
|
||||
#define IDC_SET_FROM_VARIABLES 1244
|
||||
#define IDC_TEAMSELECT 1244
|
||||
#define IDC_COMBO4 1245
|
||||
#define IDC_BEHAVIOR2 1245
|
||||
#define IDC_PRIORITY 1245
|
||||
@@ -812,7 +811,6 @@
|
||||
#define IDC_ABBREV_DEBRIEFING 1347
|
||||
#define IDC_TVT_WING_NAME_2 1347
|
||||
#define IDC_SPECIAL_DEATHROLL_TIME 1347
|
||||
#define IDC_SKYBOX_B 1347
|
||||
#define IDC_SHIELDS 1348
|
||||
#define IDC_ABBREV_MISSION 1348
|
||||
#define IDC_SQUADRON_WING_NAME_5 1348
|
||||
@@ -1006,7 +1004,6 @@
|
||||
#define IDC_SBITMAP_SCALE_X 1519
|
||||
#define IDC_SUN1_P 1520
|
||||
#define IDC_SUN1_SCALE_SPIN 1521
|
||||
#define IDC_SKYBOX_H 1521
|
||||
#define IDC_SUN1_P_SPIN 1522
|
||||
#define IDC_SUN1_B_SPIN 1523
|
||||
#define IDC_SUN1_H_SPIN 1524
|
||||
@@ -1030,16 +1027,11 @@
|
||||
#define IDC_SBITMAP_DIV_Y 1537
|
||||
#define IDC_STATS_TEXT 1537
|
||||
#define IDC_SUBTYPE1 1538
|
||||
#define IDC_SKYBOX_P 1538
|
||||
#define IDC_SUBTYPE2 1539
|
||||
#define IDC_SPECIAL_WARPIN 1539
|
||||
#define IDC_SKYBOX_P_SPIN 1539
|
||||
#define IDC_SUBTYPE3 1540
|
||||
#define IDC_LOOP_BRIEF_ANIM 1540
|
||||
#define IDC_SKYBOX_B_SPIN 1540
|
||||
#define IDC_LOOP_BRIEF_SOUND 1541
|
||||
#define IDC_SBITMAP_H_SPIN2 1541
|
||||
#define IDC_SKYBOX_H_SPIN 1541
|
||||
#define IDC_SPECS_TOGGLE_TRAILS 1542
|
||||
#define IDC_SUPPORT_REPAIR 1543
|
||||
#define IDC_SUPPORT_REPAIRS_HULL 1543
|
||||
@@ -1162,14 +1154,6 @@
|
||||
#define IDC_NEB_NEAR_MULTIPLIER 1632
|
||||
#define IDC_EDIT6 1633
|
||||
#define IDC_NEB_FAR_MULTIPLIER 1634
|
||||
#define IDC_MISSION_LOG_TRUE 1635
|
||||
#define IDC_MISSION_LOG_FALSE 1636
|
||||
#define IDC_MISSION_LOG_ALWAYS_TRUE 1637
|
||||
#define IDC_MISSION_LOG_ALWAYS_FALSE 1638
|
||||
#define IDC_MISSION_LOG_1ST_REPEAT 1639
|
||||
#define IDC_MISSION_LOG_LAST_REPEAT 1640
|
||||
#define IDC_MISSION_LOG_1ST_TRIGGER 1641
|
||||
#define IDC_MISSION_LOG_LAST_TRIGGER 1642
|
||||
#define ID_FILE_MISSIONNOTES 32771
|
||||
#define ID_DUPLICATE 32774
|
||||
#define ID_VIEW_ROTATE 32775
|
||||
@@ -1463,7 +1447,7 @@
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 320
|
||||
#define _APS_NEXT_COMMAND_VALUE 33098
|
||||
#define _APS_NEXT_CONTROL_VALUE 1643
|
||||
#define _APS_NEXT_CONTROL_VALUE 1635
|
||||
#define _APS_NEXT_SYMED_VALUE 105
|
||||
#endif
|
||||
#endif
|
||||
+10
-86
@@ -45,7 +45,6 @@
|
||||
#include "graphics/gropenglshader.h"
|
||||
#include "graphics/gropenglpostprocessing.h"
|
||||
#include "sound/ds.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
|
||||
#define TREE_NODE_INCREMENT 100
|
||||
|
||||
@@ -2117,7 +2116,7 @@ void sexp_list_item::add_data(char *str, int t)
|
||||
// add a node to end of list, allocating memory for the text
|
||||
// Defaults: t = SEXPT_STRING
|
||||
//
|
||||
void sexp_list_item::add_data_dup(const char *str, int t)
|
||||
void sexp_list_item::add_data_dup(char *str, int t)
|
||||
{
|
||||
sexp_list_item *item, *ptr;
|
||||
|
||||
@@ -2642,7 +2641,6 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
case OPF_HUD_GAUGE:
|
||||
case OPF_SHIP_EFFECT:
|
||||
case OPF_ANIMATION_TYPE:
|
||||
case OPF_SHIP_FLAG:
|
||||
return 1;
|
||||
|
||||
case OPF_SHIP:
|
||||
@@ -2760,15 +2758,6 @@ int sexp_tree::query_default_argument_available(int op, int i)
|
||||
else
|
||||
return 0;
|
||||
|
||||
case OPF_MISSION_MOOD:
|
||||
if (Builtin_moods.empty())
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
||||
case OPF_TEAM_COLOR:
|
||||
return 1;
|
||||
|
||||
default:
|
||||
Int3();
|
||||
|
||||
@@ -3888,11 +3877,7 @@ void sexp_tree::update_help(HTREEITEM h)
|
||||
return;
|
||||
}
|
||||
|
||||
if (SEXPT_TYPE(tree_nodes[i].type) == SEXPT_OPERATOR)
|
||||
{
|
||||
mini_help_box->SetWindowText("");
|
||||
}
|
||||
else
|
||||
if (SEXPT_TYPE(tree_nodes[i].type) != SEXPT_OPERATOR)
|
||||
{
|
||||
z = tree_nodes[i].parent;
|
||||
if (z < 0) {
|
||||
@@ -3940,14 +3925,6 @@ void sexp_tree::update_help(HTREEITEM h)
|
||||
sprintf(searchstr, "%d:", sibling_place);
|
||||
loc = strstr(helpstr, searchstr);
|
||||
}
|
||||
if(loc == NULL)
|
||||
{
|
||||
loc = strstr(helpstr, "Rest:");
|
||||
}
|
||||
if(loc == NULL)
|
||||
{
|
||||
loc = strstr(helpstr, "All:");
|
||||
}
|
||||
|
||||
if(loc != NULL)
|
||||
{
|
||||
@@ -4408,18 +4385,6 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
|
||||
list = get_listing_opf_ship_effect();
|
||||
break;
|
||||
|
||||
case OPF_MISSION_MOOD:
|
||||
list = get_listing_opf_mission_moods();
|
||||
break;
|
||||
|
||||
case OPF_SHIP_FLAG:
|
||||
list = get_listing_opf_ship_flags();
|
||||
break;
|
||||
|
||||
case OPF_TEAM_COLOR:
|
||||
list = get_listing_opf_team_colors();
|
||||
break;
|
||||
|
||||
default:
|
||||
Int3(); // unknown OPF code
|
||||
list = NULL;
|
||||
@@ -5248,7 +5213,7 @@ sexp_list_item *sexp_tree::get_listing_opf_persona()
|
||||
|
||||
for (i = 0; i < Num_personas; i++) {
|
||||
if (Personas[i].flags & PERSONA_FLAG_WINGMAN) {
|
||||
head.add_data(Personas[i].name);
|
||||
head.add_data (Personas[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5305,7 +5270,9 @@ sexp_list_item *sexp_tree::get_listing_opf_sound_environment()
|
||||
|
||||
head.add_data(SEXP_NONE_STRING);
|
||||
for (int i = 0; i < (int)EFX_presets.size(); i++) {
|
||||
head.add_data_dup(EFX_presets[i].name.c_str());
|
||||
// ugh
|
||||
char *text = const_cast<char*>(EFX_presets[i].name.c_str());
|
||||
head.add_data_dup(text);
|
||||
}
|
||||
|
||||
return head.next;
|
||||
@@ -5511,7 +5478,7 @@ sexp_list_item *sexp_tree::get_listing_opf_keypress()
|
||||
sexp_list_item head;
|
||||
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
if (Control_config[i].key_default > 0 && !Control_config[i].disabled) {
|
||||
if (Control_config[i].key_default > 0) {
|
||||
head.add_data_dup(textify_scancode(Control_config[i].key_default));
|
||||
}
|
||||
}
|
||||
@@ -5720,9 +5687,9 @@ sexp_list_item *sexp_tree::get_listing_opf_jump_nodes()
|
||||
{
|
||||
sexp_list_item head;
|
||||
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
head.add_data( jnp->GetName());
|
||||
head.add_data( jnp->get_name_ptr());
|
||||
}
|
||||
|
||||
return head.next;
|
||||
@@ -5824,7 +5791,7 @@ sexp_list_item *sexp_tree::get_listing_opf_post_effect()
|
||||
SCP_vector<SCP_string> ppe_names;
|
||||
get_post_process_effect_names(ppe_names);
|
||||
for (i=0; i < ppe_names.size(); i++) {
|
||||
head.add_data_dup(ppe_names[i].c_str());
|
||||
head.add_data_dup(const_cast<char*>(ppe_names[i].c_str()));
|
||||
}
|
||||
head.add_data_dup("lightshafts");
|
||||
|
||||
@@ -5892,49 +5859,6 @@ sexp_list_item *sexp_tree::get_listing_opf_weapon_banks()
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_mission_moods()
|
||||
{
|
||||
sexp_list_item head;
|
||||
for (SCP_vector<SCP_string>::iterator iter = Builtin_moods.begin(); iter != Builtin_moods.end(); ++iter) {
|
||||
head.add_data_dup(iter->c_str());
|
||||
}
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_ship_flags()
|
||||
{
|
||||
int i;
|
||||
sexp_list_item head;
|
||||
// object flags
|
||||
for ( i = 0; i < MAX_OBJECT_FLAG_NAMES; i++) {
|
||||
head.add_data_dup(Object_flag_names[i].flag_name);
|
||||
}
|
||||
// ship flags
|
||||
for ( i = 0; i < MAX_SHIP_FLAG_NAMES; i++) {
|
||||
head.add_data_dup(Ship_flag_names[i].flag_name);
|
||||
}
|
||||
// ai flags
|
||||
for ( i = 0; i < MAX_AI_FLAG_NAMES; i++) {
|
||||
head.add_data_dup(Ai_flag_names[i].flag_name);
|
||||
}
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
sexp_list_item *sexp_tree::get_listing_opf_team_colors()
|
||||
{
|
||||
sexp_list_item head;
|
||||
head.add_data("None");
|
||||
for (SCP_map<SCP_string, team_color>::iterator tcolor = Team_Colors.begin(); tcolor != Team_Colors.end(); ++tcolor) {
|
||||
head.add_data_dup(tcolor->first.c_str());
|
||||
}
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Deletes sexp_variable from sexp_tree.
|
||||
// resets tree to not include given variable, and resets text and type
|
||||
void sexp_tree::delete_sexp_tree_variable(const char *var_name)
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
void set_data_dup(char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void add_op(int op_num);
|
||||
void add_data(char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void add_data_dup(const char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void add_data_dup(char *str, int t = (SEXPT_STRING | SEXPT_VALID));
|
||||
void add_list(sexp_list_item *list);
|
||||
void destroy();
|
||||
};
|
||||
@@ -267,9 +267,6 @@ public:
|
||||
sexp_list_item *get_listing_opf_hud_gauge();
|
||||
sexp_list_item *get_listing_opf_ship_effect();
|
||||
sexp_list_item *get_listing_opf_animation_type();
|
||||
sexp_list_item *get_listing_opf_mission_moods();
|
||||
sexp_list_item *get_listing_opf_ship_flags();
|
||||
sexp_list_item *get_listing_opf_team_colors();
|
||||
|
||||
int m_mode;
|
||||
int item_index;
|
||||
|
||||
@@ -1108,7 +1108,7 @@ int CShipEditorDlg::update_data(int redraw)
|
||||
}
|
||||
}
|
||||
|
||||
if (find_matching_waypoint_list((LPCSTR) m_ship_name) != NULL)
|
||||
if (find_matching_waypoint_list(const_cast<char*>((const char *) m_ship_name)) != NULL)
|
||||
{
|
||||
if (bypass_errors)
|
||||
return 0;
|
||||
@@ -2087,35 +2087,19 @@ void CShipEditorDlg::ship_alt_name_close(int base_ship)
|
||||
return;
|
||||
}
|
||||
|
||||
// see if we have something besides "none" selected
|
||||
ptr->GetWindowText(cstr);
|
||||
cstr.Trim();
|
||||
if(cstr == CString("<none>")){
|
||||
// zero the entry
|
||||
strcpy_s(Fred_alt_names[base_ship], "");
|
||||
return;
|
||||
}
|
||||
p = cstr.GetBuffer(0);
|
||||
if(p == NULL){
|
||||
return;
|
||||
}
|
||||
strcpy_s(str, p);
|
||||
|
||||
// do we have an empty string or "none" selected?
|
||||
if(!*str || !stricmp(str, "<none>")) {
|
||||
// if we currently have an entry, remove it -- but only if it's unused
|
||||
if (*Fred_alt_names[base_ship]) {
|
||||
bool used = false;
|
||||
for (int i = 0; i < MAX_SHIPS; ++i) {
|
||||
if (i != base_ship && !strcmp(Fred_alt_names[i], Fred_alt_names[base_ship])) {
|
||||
used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!used) {
|
||||
mission_parse_remove_alt(Fred_alt_names[base_ship]);
|
||||
}
|
||||
|
||||
// zero the entry
|
||||
strcpy_s(Fred_alt_names[base_ship], "");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise see if it already exists
|
||||
if(mission_parse_lookup_alt(str) >= 0){
|
||||
strcpy_s(Fred_alt_names[base_ship], str);
|
||||
@@ -2186,35 +2170,19 @@ void CShipEditorDlg::ship_callsign_close(int base_ship)
|
||||
return;
|
||||
}
|
||||
|
||||
// see if we have something besides "none" selected
|
||||
ptr->GetWindowText(cstr);
|
||||
cstr.Trim();
|
||||
if(cstr == CString("<none>")){
|
||||
// zero the entry
|
||||
strcpy_s(Fred_callsigns[base_ship], "");
|
||||
return;
|
||||
}
|
||||
p = cstr.GetBuffer(0);
|
||||
if(p == NULL){
|
||||
return;
|
||||
}
|
||||
strcpy_s(str, p);
|
||||
|
||||
// do we have an empty string or "none" selected?
|
||||
if(!*str || !stricmp(str, "<none>")) {
|
||||
// if we currently have an entry, remove it -- but only if it's unused
|
||||
if (*Fred_callsigns[base_ship]) {
|
||||
bool used = false;
|
||||
for (int i = 0; i < MAX_SHIPS; ++i) {
|
||||
if (i != base_ship && !strcmp(Fred_callsigns[i], Fred_callsigns[base_ship])) {
|
||||
used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!used) {
|
||||
mission_parse_remove_callsign(Fred_callsigns[base_ship]);
|
||||
}
|
||||
|
||||
// zero the entry
|
||||
strcpy_s(Fred_callsigns[base_ship], "");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise see if it already exists
|
||||
if(mission_parse_lookup_callsign(str) >= 0){
|
||||
strcpy_s(Fred_callsigns[base_ship], str);
|
||||
@@ -2309,12 +2277,6 @@ void CShipEditorDlg::OnRestrictArrival()
|
||||
CComboBox *box;
|
||||
restrict_paths dlg;
|
||||
|
||||
if (multi_edit)
|
||||
{
|
||||
MessageBox("Please select only one ship.", "Too many ships selected");
|
||||
return;
|
||||
}
|
||||
|
||||
// grab stuff from GUI
|
||||
UpdateData(TRUE);
|
||||
|
||||
@@ -2353,12 +2315,6 @@ void CShipEditorDlg::OnRestrictDeparture()
|
||||
CComboBox *box;
|
||||
restrict_paths dlg;
|
||||
|
||||
if (multi_edit)
|
||||
{
|
||||
MessageBox("Please select only one ship.", "Too many ships selected");
|
||||
return;
|
||||
}
|
||||
|
||||
// grab stuff from GUI
|
||||
UpdateData(TRUE);
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ BOOL ship_flags_dlg::OnInitDialog()
|
||||
}
|
||||
|
||||
// flags that enable/disable according to whether this isn't a player
|
||||
GetDlgItem(IDC_REINFORCEMENT)->EnableWindow(p_enable && !ship_in_wing);
|
||||
GetDlgItem(IDC_REINFORCEMENT)->EnableWindow(p_enable);
|
||||
GetDlgItem(IDC_CARGO_KNOWN)->EnableWindow(p_enable);
|
||||
GetDlgItem(IDC_DESTROY_CHECK)->EnableWindow(p_enable);
|
||||
GetDlgItem(IDC_DESTROY_VALUE)->EnableWindow(p_enable);
|
||||
@@ -419,20 +419,7 @@ void ship_flags_dlg::update_ship(int shipnum)
|
||||
object *objp = &Objects[shipp->objnum];
|
||||
|
||||
if (m_reinforcement.GetCheck() != 2)
|
||||
{
|
||||
//Check if we're trying to add more and we've got too many.
|
||||
if( (Num_reinforcements >= MAX_REINFORCEMENTS) && (m_reinforcement.GetCheck() == 1))
|
||||
{
|
||||
char error_message[256];
|
||||
sprintf(error_message, "Too many reinforcements; could not add ship '%s' to reinforcement list!", shipp->ship_name);
|
||||
MessageBox(error_message);
|
||||
}
|
||||
//Otherwise, just update as normal.
|
||||
else
|
||||
{
|
||||
set_reinforcement(shipp->ship_name, m_reinforcement.GetCheck());
|
||||
}
|
||||
}
|
||||
set_reinforcement(shipp->ship_name, m_reinforcement.GetCheck());
|
||||
|
||||
switch (m_cargo_known.GetCheck()) {
|
||||
case 1:
|
||||
|
||||
@@ -75,13 +75,9 @@ void CShipTexturesDlg::OnOK()
|
||||
// make sure we have a texture
|
||||
if (strlen(new_texture_name[i]))
|
||||
{
|
||||
// allow invisible textures without doing a file check
|
||||
if (!stricmp(new_texture_name[i], "invisible"))
|
||||
continue;
|
||||
|
||||
// try loading the texture (bmpman should take care of eventually unloading it)
|
||||
// try loading it (bmpman should take care of eventually unloading them)
|
||||
temp_bmp = bm_load( new_texture_name[i] );
|
||||
|
||||
|
||||
// if PCX not found, look for ANI
|
||||
if (temp_bmp < 0)
|
||||
{
|
||||
|
||||
@@ -389,7 +389,7 @@ void VoiceActingManager::OnGenerateFileNames()
|
||||
|
||||
// notify user that we are done and how many filenames were changed
|
||||
char message[128] = { '\0' };
|
||||
snprintf(message, sizeof(message), "File name generation complete. Modified %u messages.", modified_filenames);
|
||||
snprintf(message, sizeof(message), "File name generation complete. Modified %d messages.", modified_filenames);
|
||||
MessageBox(message, "Woohoo!");
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ void VoiceActingManager::OnGenerateScript()
|
||||
|
||||
cmd_brief_stage *stage = &Cmd_briefs[0].stage[i];
|
||||
entry.Replace("$filename", stage->wave_filename);
|
||||
entry.Replace("$message", stage->text.c_str());
|
||||
entry.Replace("$message", stage->text);
|
||||
entry.Replace("$persona", "<no persona specified>");
|
||||
entry.Replace("$sender", "<no sender specified>");
|
||||
|
||||
@@ -447,7 +447,7 @@ void VoiceActingManager::OnGenerateScript()
|
||||
|
||||
brief_stage *stage = &Briefings[0].stages[i];
|
||||
entry.Replace("$filename", stage->voice);
|
||||
entry.Replace("$message", stage->text.c_str());
|
||||
entry.Replace("$message", stage->new_text);
|
||||
entry.Replace("$persona", "<no persona specified>");
|
||||
entry.Replace("$sender", "<no sender specified>");
|
||||
|
||||
@@ -466,7 +466,7 @@ void VoiceActingManager::OnGenerateScript()
|
||||
|
||||
debrief_stage *stage = &Debriefings[0].stages[i];
|
||||
entry.Replace("$filename", stage->voice);
|
||||
entry.Replace("$message", stage->text.c_str());
|
||||
entry.Replace("$message", stage->new_text);
|
||||
entry.Replace("$persona", "<no persona specified>");
|
||||
entry.Replace("$sender", "<no sender specified>");
|
||||
|
||||
@@ -711,14 +711,15 @@ void VoiceActingManager::OnChangeNoReplace()
|
||||
|
||||
int VoiceActingManager::fout(char *format, ...)
|
||||
{
|
||||
SCP_string str;
|
||||
char str[16384];
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(str, format, args);
|
||||
va_end(args);
|
||||
Assert(strlen(str) < 16384);
|
||||
|
||||
cfputs(const_cast<char*>(str.c_str()), fp);
|
||||
cfputs(str, fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void waypoint_path_dlg::OnInitMenu(CMenu* pMenu)
|
||||
{
|
||||
int i;
|
||||
SCP_list<waypoint_list>::iterator ii;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
CMenu *m;
|
||||
|
||||
m = pMenu->GetSubMenu(0);
|
||||
@@ -85,8 +85,8 @@ void waypoint_path_dlg::OnInitMenu(CMenu* pMenu)
|
||||
|
||||
i = 0;
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
m->AppendMenu(MF_ENABLED | MF_STRING, ID_JUMP_NODE_MENU + i, jnp->GetName());
|
||||
if (jnp->GetSCPObjectNumber() == cur_object_index) {
|
||||
m->AppendMenu(MF_ENABLED | MF_STRING, ID_JUMP_NODE_MENU + i, jnp->get_name_ptr());
|
||||
if (jnp->get_objnum() == cur_object_index) {
|
||||
m->CheckMenuItem(ID_JUMP_NODE_MENU + i, MF_BYCOMMAND | MF_CHECKED);
|
||||
}
|
||||
i++;
|
||||
@@ -123,7 +123,7 @@ void waypoint_path_dlg::OnClose()
|
||||
void waypoint_path_dlg::initialize_data(int full_update)
|
||||
{
|
||||
int enable = TRUE;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
|
||||
if (!GetSafeHwnd())
|
||||
return;
|
||||
@@ -138,11 +138,11 @@ void waypoint_path_dlg::initialize_data(int full_update)
|
||||
|
||||
} else if (Objects[cur_object_index].type == OBJ_JUMP_NODE) {
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == &Objects[cur_object_index])
|
||||
if(jnp->get_obj() == &Objects[cur_object_index])
|
||||
break;
|
||||
}
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
m_name = _T(jnp->get_name_ptr());
|
||||
|
||||
} else {
|
||||
m_name = _T("");
|
||||
@@ -157,11 +157,10 @@ void waypoint_path_dlg::initialize_data(int full_update)
|
||||
|
||||
int waypoint_path_dlg::update_data(int redraw)
|
||||
{
|
||||
const char *str;
|
||||
char old_name[255];
|
||||
char *str, old_name[255];
|
||||
int i, z;
|
||||
object *ptr;
|
||||
SCP_list<CJumpNode>::iterator jnp;
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
|
||||
if (!GetSafeHwnd())
|
||||
return 0;
|
||||
@@ -312,7 +311,7 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
|
||||
} else if (Objects[cur_object_index].type == OBJ_JUMP_NODE) {
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
if(jnp->GetSCPObject() == &Objects[cur_object_index])
|
||||
if(jnp->get_obj() == &Objects[cur_object_index])
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -329,7 +328,7 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
m_name = _T(jnp->get_name_ptr());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
@@ -348,7 +347,7 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
m_name = _T(jnp->get_name_ptr());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
@@ -368,7 +367,7 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
m_name = _T(jnp->get_name_ptr());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
@@ -385,12 +384,12 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
m_name = _T(jnp->get_name_ptr());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (find_matching_waypoint_list((LPCSTR) m_name) != NULL)
|
||||
if (find_matching_waypoint_list(const_cast<char *>((const char *) m_name)) != NULL)
|
||||
{
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
@@ -402,7 +401,7 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
m_name = _T(jnp->get_name_ptr());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
@@ -417,11 +416,11 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
m_name = _T(jnp->get_name_ptr());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
CJumpNode* found = jumpnode_get_by_name(m_name);
|
||||
jump_node* found = jumpnode_get_by_name(m_name);
|
||||
if(found != NULL && &(*jnp) != found)
|
||||
{
|
||||
if (bypass_errors)
|
||||
@@ -434,14 +433,14 @@ int waypoint_path_dlg::update_data(int redraw)
|
||||
if (z == IDCANCEL)
|
||||
return -1;
|
||||
|
||||
m_name = _T(jnp->GetName());
|
||||
m_name = _T(jnp->get_name_ptr());
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
strcpy_s(old_name, jnp->GetName());
|
||||
jnp->SetName((LPCSTR) m_name);
|
||||
strcpy_s(old_name, jnp->get_name_ptr());
|
||||
jnp->set_name(const_cast<char *>((const char *) m_name));
|
||||
|
||||
str = (LPCTSTR) m_name;
|
||||
str = (char *) (LPCTSTR) m_name;
|
||||
if (strcmp(old_name, str)) {
|
||||
update_sexp_references(old_name, str);
|
||||
}
|
||||
|
||||
+1
-5
@@ -229,7 +229,7 @@ int create_wing()
|
||||
leader = cur_object_index;
|
||||
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)) {
|
||||
count++;
|
||||
i = -1;
|
||||
switch (ptr->type) {
|
||||
@@ -306,14 +306,10 @@ int create_wing()
|
||||
Wings[wing].arrival_location = Wings[wing].departure_location = 0;
|
||||
Wings[wing].arrival_distance = 0;
|
||||
Wings[wing].arrival_anchor = -1;
|
||||
Wings[wing].arrival_delay = 0;
|
||||
Wings[wing].arrival_cue = Locked_sexp_true;
|
||||
Wings[wing].departure_delay = 0;
|
||||
Wings[wing].departure_cue = Locked_sexp_false;
|
||||
Wings[wing].hotkey = -1;
|
||||
Wings[wing].flags = 0;
|
||||
Wings[wing].wave_delay_min = 0;
|
||||
Wings[wing].wave_delay_max = 0;
|
||||
|
||||
for (i=0; i<MAX_AI_GOALS; i++) {
|
||||
Wings[wing].ai_goals[i].ai_mode = AI_GOAL_NONE;
|
||||
|
||||
@@ -625,7 +625,7 @@ int wing_editor::update_data(int redraw)
|
||||
}
|
||||
}
|
||||
|
||||
if (find_matching_waypoint_list((LPCSTR) m_wing_name) != NULL)
|
||||
if (find_matching_waypoint_list(const_cast<char *>((const char *) m_wing_name)) != NULL)
|
||||
{
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
@@ -701,28 +701,7 @@ int wing_editor::update_data(int redraw)
|
||||
Update_window = 1;
|
||||
}
|
||||
|
||||
//Check if we're trying to add more and we've got too many.
|
||||
if( (Num_reinforcements >= MAX_REINFORCEMENTS) && (m_reinforcement == 1))
|
||||
{
|
||||
if (bypass_errors)
|
||||
return 1;
|
||||
|
||||
bypass_errors = 1;
|
||||
|
||||
char error_message[256];
|
||||
sprintf(error_message, "Too many reinforcements; could not add wing '%s' to reinforcement list!", str);
|
||||
MessageBox(error_message, "Error", MB_ICONEXCLAMATION | MB_OK);
|
||||
|
||||
//clear the flag
|
||||
m_reinforcement = 0;
|
||||
UpdateData(FALSE);
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
//Otherwise, just update as normal.
|
||||
else if (set_reinforcement(str, m_reinforcement) == 1)
|
||||
{
|
||||
if (set_reinforcement(str, m_reinforcement) == 1) {
|
||||
free_sexp2(Wings[cur_wing].arrival_cue);
|
||||
Wings[cur_wing].arrival_cue = Locked_sexp_false;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "cutscene/movie.h"
|
||||
#include "debris/debris.h"
|
||||
#include "exceptionhandler/exceptionhandler.h"
|
||||
#include "external_dll/trackirpublic.h" // header file for the TrackIR routines (Swifty)
|
||||
#include "fireball/fireballs.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "freespace2/freespaceresource.h"
|
||||
@@ -45,6 +44,7 @@
|
||||
#include "gamesnd/eventmusic.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "globalincs/version.h"
|
||||
#include "globalincs/mspdb_callstack.h"
|
||||
#include "graphics/font.h"
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "io/key.h"
|
||||
#include "io/mouse.h"
|
||||
#include "io/timer.h"
|
||||
#include "external_dll/trackirpublic.h" // header file for the TrackIR routines (Swifty)
|
||||
#include "jumpnode/jumpnode.h"
|
||||
#include "lab/lab.h"
|
||||
#include "lab/wmcgui.h" //So that GUI_System can be initialized
|
||||
@@ -97,7 +98,6 @@
|
||||
#include "missionui/missionshipchoice.h"
|
||||
#include "missionui/missionweaponchoice.h"
|
||||
#include "missionui/redalert.h"
|
||||
#include "mod_table/mod_table.h"
|
||||
#include "nebula/neb.h"
|
||||
#include "nebula/neblightning.h"
|
||||
#include "network/multi.h"
|
||||
@@ -122,7 +122,6 @@
|
||||
#include "osapi/osapi.h"
|
||||
#include "osapi/osregistry.h"
|
||||
#include "parse/encrypt.h"
|
||||
#include "parse/generic_log.h"
|
||||
#include "parse/lua.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "parse/scripting.h"
|
||||
@@ -465,7 +464,7 @@ void game_do_training_checks();
|
||||
void game_shutdown(void);
|
||||
void game_show_event_debug(float frametime);
|
||||
void game_event_debug_init();
|
||||
void game_frame(bool paused = false);
|
||||
void game_frame(int paused = false);
|
||||
void demo_upsell_show_screens();
|
||||
void game_start_subspace_ambient_sound();
|
||||
void game_stop_subspace_ambient_sound();
|
||||
@@ -842,6 +841,7 @@ void game_flash_diminish(float frametime)
|
||||
|
||||
if ( Use_palette_flash ) {
|
||||
int r,g,b;
|
||||
static int o_r=0, o_g=0, o_b=0;
|
||||
|
||||
// Change the 200 to change the color range of colors.
|
||||
r = fl2i( Game_flash_red*128.0f );
|
||||
@@ -866,6 +866,10 @@ void game_flash_diminish(float frametime)
|
||||
|
||||
if ( (r!=0) || (g!=0) || (b!=0) ) {
|
||||
gr_flash( r, g, b );
|
||||
|
||||
o_r = r;
|
||||
o_g = g;
|
||||
o_b = b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -909,7 +913,6 @@ void game_level_close()
|
||||
ship_clear_cockpit_displays();
|
||||
hud_level_close();
|
||||
model_instance_free_all();
|
||||
batch_render_close();
|
||||
|
||||
// be sure to not only reset the time but the lock as well
|
||||
set_time_compression(1.0f, 0.0f);
|
||||
@@ -1058,7 +1061,7 @@ void game_level_init(int seed)
|
||||
Game_no_clear = 0;
|
||||
|
||||
// campaign wasn't ended
|
||||
Campaign_ending_via_supernova = 0;
|
||||
Campaign_ended_in_mission = 0;
|
||||
|
||||
Env_cubemap_drawn = false;
|
||||
|
||||
@@ -1241,7 +1244,8 @@ void game_loading_callback_init()
|
||||
if (Game_loading_background < 0)
|
||||
Game_loading_background = bm_load(Game_loading_bground_fname[gr_screen.res]);
|
||||
|
||||
generic_anim_init(&Game_loading_ani, Game_loading_ani_fname[gr_screen.res]);
|
||||
strcpy_s(Game_loading_ani.filename, Game_loading_ani_fname[gr_screen.res]);
|
||||
generic_anim_init(&Game_loading_ani, Game_loading_ani.filename);
|
||||
generic_anim_load(&Game_loading_ani);
|
||||
Assertion( Game_loading_ani.num_frames > 0, "Load Screen animation %s not found, or corrupted. Needs to be an animation with at least 1 frame.", Game_loading_ani.filename );
|
||||
|
||||
@@ -1681,6 +1685,29 @@ DCF(gamma,"Sets Gamma factor")
|
||||
}
|
||||
}
|
||||
|
||||
void run_launcher()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const char *launcher_link = "explorer.exe \"http://www.randomtiger.pwp.blueyonder.co.uk/freespace/Launcher5.rar\"";
|
||||
|
||||
int download = MessageBox((HWND)os_get_window(),
|
||||
"Run the fs2_open launcher to fix your problem. "
|
||||
"Would you like to download the latest version of the launcher? "
|
||||
"You must have at least version 5.0 to run fs2_open versions above 3.6.",
|
||||
"Question", MB_YESNO | MB_ICONQUESTION);
|
||||
|
||||
if(download == IDYES)
|
||||
{
|
||||
// Someone should change this to the offical link
|
||||
WinExec(launcher_link, SW_SHOW);
|
||||
return;
|
||||
}
|
||||
|
||||
// This now crashes the launcher since fs2_open is still open
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef APPLE_APP
|
||||
char full_path[1024];
|
||||
#endif
|
||||
@@ -1828,6 +1855,7 @@ void game_init()
|
||||
ShowCursor(TRUE);
|
||||
ShowWindow((HWND)os_get_window(),SW_MINIMIZE);
|
||||
MessageBox( NULL, "Error intializing graphics!", "Error", MB_OK|MB_TASKMODAL|MB_SETFOREGROUND );
|
||||
run_launcher();
|
||||
#elif defined(SCP_UNIX)
|
||||
fprintf(stderr, "Error initializing graphics!");
|
||||
|
||||
@@ -1861,8 +1889,6 @@ void game_init()
|
||||
ptr = os_config_read_string(NULL, NOX("GammaD3D"), NOX("1.0"));
|
||||
FreeSpace_gamma = (float)atof(ptr);
|
||||
|
||||
mod_table_init(); // load in all the mod dependent settings
|
||||
|
||||
script_init(); //WMC
|
||||
|
||||
gr_font_init(); // loads up all fonts
|
||||
@@ -1948,10 +1974,6 @@ void game_init()
|
||||
|
||||
multi_init();
|
||||
|
||||
// start up the mission logfile
|
||||
logfile_init(LOGFILE_EVENT_LOG);
|
||||
log_string(LOGFILE_EVENT_LOG,"FS2_Open Mission Log - Opened \n\n", 1);
|
||||
|
||||
// standalone's don't use the joystick and it seems to sometimes cause them to not get shutdown properly
|
||||
if(!Is_standalone){
|
||||
joy_init();
|
||||
@@ -1962,12 +1984,6 @@ void game_init()
|
||||
|
||||
event_music_init();
|
||||
|
||||
// initialize alpha colors
|
||||
// CommanderDJ: try with colors.tbl first, then use the old way if that doesn't work
|
||||
if (!new_alpha_colors_init()) {
|
||||
old_alpha_colors_init();
|
||||
}
|
||||
|
||||
obj_init();
|
||||
mflash_game_init();
|
||||
armor_init();
|
||||
@@ -2003,6 +2019,12 @@ void game_init()
|
||||
|
||||
load_animating_pointer(NOX("cursor"), 0, 0);
|
||||
|
||||
// initialize alpha colors
|
||||
// CommanderDJ: try with colors.tbl first, then use the old way if that doesn't work
|
||||
if (!new_alpha_colors_init()) {
|
||||
old_alpha_colors_init();
|
||||
}
|
||||
|
||||
if(!Cmdline_reparse_mainhall)
|
||||
{
|
||||
main_hall_read_table();
|
||||
@@ -3670,7 +3692,7 @@ void game_render_frame( camid cid )
|
||||
if(draw_viewer_last && Viewer_obj)
|
||||
{
|
||||
gr_post_process_save_zbuffer();
|
||||
ship_render_show_ship_cockpit(Viewer_obj);
|
||||
ship_render(Viewer_obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -4056,7 +4078,7 @@ void game_simulation_frame()
|
||||
obj_snd_do_frame(); // update the object-linked persistant sounds
|
||||
|
||||
game_maybe_update_sound_environment();
|
||||
snd_update_listener(&Eye_position, &Player_obj->phys_info.vel, &Eye_matrix);
|
||||
snd_update_listener(&View_position, &Player_obj->phys_info.vel, &Player_obj->orient);
|
||||
|
||||
// AL: debug code used for testing ambient subspace sound (ie when enabling subspace through debug console)
|
||||
#ifndef NDEBUG
|
||||
@@ -4311,7 +4333,7 @@ void game_render_post_frame()
|
||||
#define DEBUG_GET_TIME(x)
|
||||
#endif
|
||||
|
||||
void game_frame(bool paused)
|
||||
void game_frame(int paused)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
fix total_time1, total_time2;
|
||||
@@ -4322,6 +4344,9 @@ void game_frame(bool paused)
|
||||
#endif
|
||||
int actually_playing;
|
||||
|
||||
//vec3d eye_pos;
|
||||
//matrix eye_orient;
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (Framerate_delay) {
|
||||
int start_time = timer_get_milliseconds();
|
||||
@@ -4481,10 +4506,6 @@ void game_frame(bool paused)
|
||||
}
|
||||
}
|
||||
|
||||
// Goober5000 - check if we should red-alert
|
||||
// (this is approximately where the red_alert_check_status() function tree began in the pre-HUD-overhaul code)
|
||||
red_alert_maybe_move_to_next_mission();
|
||||
|
||||
DEBUG_GET_TIME( render3_time2 )
|
||||
DEBUG_GET_TIME( render2_time1 )
|
||||
|
||||
@@ -4646,7 +4667,9 @@ void lock_time_compression(bool is_locked)
|
||||
|
||||
void change_time_compression(float multiplier)
|
||||
{
|
||||
fix modified = fl2f( f2fl(Game_time_compression) * multiplier );
|
||||
fix modified = F1_0;
|
||||
|
||||
modified = fl2f( f2fl(Game_time_compression) * multiplier );
|
||||
|
||||
Desired_time_compression = Game_time_compression = modified;
|
||||
Time_compression_change_rate = 0;
|
||||
@@ -5148,14 +5171,7 @@ void game_process_event( int current_state, int event )
|
||||
break;
|
||||
|
||||
case GS_EVENT_DEBRIEF:
|
||||
// did we end the campaign in the main freespace 2 single player campaign?
|
||||
// (specifically, did we successfully jump out when the supernova was in progress
|
||||
// and the campaign was ending?)
|
||||
if (Campaign_ending_via_supernova && (Game_mode & GM_CAMPAIGN_MODE)/* && !stricmp(Campaign.filename, "freespace2")*/) {
|
||||
gameseq_post_event(GS_EVENT_END_CAMPAIGN);
|
||||
} else {
|
||||
gameseq_set_state(GS_STATE_DEBRIEF);
|
||||
}
|
||||
gameseq_set_state(GS_STATE_DEBRIEF);
|
||||
break;
|
||||
|
||||
case GS_EVENT_SHIP_SELECTION:
|
||||
@@ -6141,9 +6157,7 @@ void game_enter_state( int old_state, int new_state )
|
||||
//Set the current hud
|
||||
set_current_hud();
|
||||
|
||||
if ( !Is_standalone ) {
|
||||
ship_init_cockpit_displays(Player_ship);
|
||||
}
|
||||
ship_init_cockpit_displays(Player_ship);
|
||||
|
||||
Game_mode |= GM_IN_MISSION;
|
||||
|
||||
@@ -7324,17 +7338,11 @@ void game_shutdown(void)
|
||||
mission_parse_close(); // clear out any extra memory that may be in use by mission parsing
|
||||
multi_voice_close(); // close down multiplayer voice (including freeing buffers, etc)
|
||||
multi_log_close();
|
||||
logfile_close(LOGFILE_EVENT_LOG); // close down the mission log
|
||||
#ifdef MULTI_USE_LAG
|
||||
multi_lag_close();
|
||||
#endif
|
||||
fs2netd_close();
|
||||
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
obj_pairs_close(); // free memory from object collision pairs
|
||||
} else {
|
||||
obj_reset_colliders();
|
||||
}
|
||||
obj_pairs_close(); // free memory from object collision pairs
|
||||
stars_close(); // clean out anything used by stars code
|
||||
|
||||
// the menu close functions will unload the bitmaps if they were displayed during the game
|
||||
@@ -8264,6 +8272,9 @@ int init_cdrom()
|
||||
int i, rval;
|
||||
|
||||
//scan for CD, etc.
|
||||
|
||||
rval = 1;
|
||||
|
||||
i = find_freespace_cd();
|
||||
|
||||
rval = set_cdrom_path(i);
|
||||
@@ -8295,10 +8306,11 @@ int game_cd_changed()
|
||||
Last_cd_label_found = found;
|
||||
if ( found ) {
|
||||
mprintf(( "CD '%s' was inserted\n", label ));
|
||||
changed = 1;
|
||||
} else {
|
||||
mprintf(( "CD '%s' was removed\n", Last_cd_label ));
|
||||
changed = 1;
|
||||
}
|
||||
changed = 1;
|
||||
} else {
|
||||
if ( Last_cd_label_found ) {
|
||||
if ( !stricmp( Last_cd_label, label )) {
|
||||
|
||||
@@ -336,8 +336,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,6,16,9482
|
||||
PRODUCTVERSION 3,6,16,9482
|
||||
FILEVERSION 3,6,13,0000
|
||||
PRODUCTVERSION 3,6,13,0000
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -354,12 +354,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Volition Inc."
|
||||
VALUE "FileDescription", "FreeSpace 2 Open"
|
||||
VALUE "FileVersion", "3.6.16.9482"
|
||||
VALUE "FileVersion", "3.6.13.0000"
|
||||
VALUE "InternalName", "FreeSpace 2 Open"
|
||||
VALUE "LegalCopyright", "Copyright © 1998"
|
||||
VALUE "OriginalFilename", "fs2.exe"
|
||||
VALUE "ProductName", "FreeSpace 2 Open"
|
||||
VALUE "ProductVersion", "3.6.16 RC1"
|
||||
VALUE "ProductVersion", "3.6.13"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -433,19 +433,8 @@ bool fs2netd_login()
|
||||
}
|
||||
|
||||
ml_printf("FS2NetD ERROR: Login %s/%s is invalid!", user, passwd);
|
||||
|
||||
if (strlen(user) == 0) {
|
||||
strcpy_s(error_str, "Login failed! No username supplied. Go to options -> multi options and add one");
|
||||
strcpy_s(std_error_str, "Login failed! No username!");
|
||||
}
|
||||
else if (strlen(passwd) == 0) {
|
||||
strcpy_s(error_str, "Login failed! No password supplied. Go to options -> multi options and add one");
|
||||
strcpy_s(std_error_str, "Login failed! No password!");
|
||||
}
|
||||
else {
|
||||
strcpy_s(error_str, "Login failed!");
|
||||
strcpy_s(std_error_str, "Login failed!");
|
||||
}
|
||||
strcpy_s(error_str, "Login failed!");
|
||||
strcpy_s(std_error_str, "Login failed!");
|
||||
retval = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "missionui/missionscreencommon.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "weapon/beam.h"
|
||||
#include "sound/audiostr.h"
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ char *gameplay_help_control_text(int id, char *buf)
|
||||
ci = &Control_config[id];
|
||||
|
||||
if ( ci->key_id >= 0 ) {
|
||||
strcpy(buf, textify_scancode(ci->key_id));
|
||||
sprintf(buf, textify_scancode(ci->key_id));
|
||||
has_key=1;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void gameplay_help_blit_control_line(int x, int y, int id)
|
||||
buf[0] = 0;
|
||||
|
||||
if ( ci->key_id >= 0 ) {
|
||||
strcpy_s(buf, textify_scancode(ci->key_id));
|
||||
sprintf(buf, textify_scancode(ci->key_id));
|
||||
has_key=1;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ void gameplay_help_goto_next_screen()
|
||||
void gameplay_help_leave()
|
||||
{
|
||||
// unpause all game sounds
|
||||
weapon_unpause_sounds();
|
||||
beam_unpause_sounds();
|
||||
audiostream_unpause_all();
|
||||
|
||||
gameseq_post_event(GS_EVENT_PREVIOUS_STATE);
|
||||
@@ -789,7 +789,7 @@ void gameplay_help_do_frame(float frametime)
|
||||
}
|
||||
|
||||
// make sure game sounds are paused
|
||||
weapon_pause_sounds();
|
||||
beam_pause_sounds();
|
||||
audiostream_pause_all();
|
||||
|
||||
k = Ui_window.process() & ~KEY_DEBUGGED;
|
||||
|
||||
@@ -1686,7 +1686,7 @@ int hostile_ships_to_arrive()
|
||||
void event_music_get_info(char *outbuf)
|
||||
{
|
||||
if ( Event_music_enabled == FALSE || Event_music_level_inited == FALSE || Current_pattern == -1 ) {
|
||||
strcpy(outbuf,XSTR( "Event music is not playing", 213));
|
||||
sprintf(outbuf,XSTR( "Event music is not playing", 213));
|
||||
}
|
||||
else {
|
||||
sprintf(outbuf,XSTR( "soundtrack: %s [%s]", 214), Soundtracks[Current_soundtrack_num].name, Pattern_info[Current_pattern].pattern_desc);
|
||||
@@ -1752,7 +1752,7 @@ void event_music_get_soundtrack_name(char *outbuf)
|
||||
strcpy(outbuf, XSTR( "Event music is not playing", 213));
|
||||
}
|
||||
else {
|
||||
strcpy(outbuf, Soundtracks[Current_soundtrack_num].name);
|
||||
sprintf(outbuf, Soundtracks[Current_soundtrack_num].name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+297
-514
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "localization/localize.h"
|
||||
@@ -28,122 +28,87 @@ void gamesnd_play_iface(int n)
|
||||
Snds_iface_handle[n] = snd_play(&Snds_iface[n]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to search for a given game_snd with the specified name
|
||||
* in the passed vector
|
||||
*
|
||||
* @param name Name to search for
|
||||
* @param sounds Vector to seach in
|
||||
*
|
||||
*/
|
||||
int gamesnd_lookup_name(const char* name, const SCP_vector<game_snd>& sounds)
|
||||
//WMC - now ignores file extension.
|
||||
int gamesnd_get_by_name(char* name)
|
||||
{
|
||||
//if we get passed -1, don't bother trying to look it up.
|
||||
if (name == NULL || *name == 0 || !strcmp(name, "-1"))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
Assert( sounds.size() <= INT_MAX );
|
||||
|
||||
Assert( Snds.size() <= INT_MAX );
|
||||
int i = 0;
|
||||
|
||||
for(SCP_vector<game_snd>::const_iterator snd = sounds.begin(); snd != sounds.end(); ++snd)
|
||||
for(SCP_vector<game_snd>::iterator snd = Snds.begin(); snd != Snds.end(); ++snd)
|
||||
{
|
||||
if (!snd->name.compare(name))
|
||||
char *p = strrchr( snd->filename, '.' );
|
||||
if(p == NULL)
|
||||
{
|
||||
if(!stricmp(snd->filename, name))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
else if(!strnicmp(snd->filename, name, p-snd->filename))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//WMC - now ignores file extension.
|
||||
int gamesnd_get_by_name(const char* name)
|
||||
{
|
||||
Assert( Snds.size() <= INT_MAX );
|
||||
|
||||
int index = gamesnd_lookup_name(name, Snds);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
int i = 0;
|
||||
for(SCP_vector<game_snd>::iterator snd = Snds.begin(); snd != Snds.end(); ++snd)
|
||||
{
|
||||
char *p = strrchr( snd->filename, '.' );
|
||||
if(p == NULL)
|
||||
{
|
||||
if(!stricmp(snd->filename, name))
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(!strnicmp(snd->filename, name, p-snd->filename))
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
int gamesnd_get_by_iface_name(const char* name)
|
||||
int gamesnd_get_by_iface_name(char* name)
|
||||
{
|
||||
Assert( Snds_iface.size() <= INT_MAX );
|
||||
Assert( Snds_iface.size() == Snds_iface_handle.size() );
|
||||
|
||||
int index = gamesnd_lookup_name(name, Snds_iface);
|
||||
|
||||
if (index < 0)
|
||||
int i = 0;
|
||||
for(SCP_vector<game_snd>::iterator snd = Snds_iface.begin(); snd != Snds_iface.end(); ++snd)
|
||||
{
|
||||
int i = 0;
|
||||
for(SCP_vector<game_snd>::iterator snd = Snds_iface.begin(); snd != Snds_iface.end(); ++snd)
|
||||
char *p = strrchr( snd->filename, '.' );
|
||||
if(p == NULL)
|
||||
{
|
||||
char *p = strrchr( snd->filename, '.' );
|
||||
if(p == NULL)
|
||||
if(!stricmp(snd->filename, name))
|
||||
{
|
||||
if(!stricmp(snd->filename, name))
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
else if(!strnicmp(snd->filename, name, p-snd->filename))
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
else if(!strnicmp(snd->filename, name, p-snd->filename))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return index;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int gamesnd_get_by_tbl_index(int index)
|
||||
{
|
||||
char temp[11];
|
||||
sprintf(temp, "%i", index);
|
||||
|
||||
return gamesnd_lookup_name(temp, Snds);
|
||||
//if we get passed -1, don't bother trying to look it up.
|
||||
if (index == -1)
|
||||
return -1;
|
||||
Assert( Snds.size() <= INT_MAX );
|
||||
int i = 0;
|
||||
for(SCP_vector<game_snd>::iterator snd = Snds.begin(); snd != Snds.end(); ++snd) {
|
||||
if ( snd->sig == index )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int gamesnd_get_by_iface_tbl_index(int index)
|
||||
{
|
||||
//if we get passed -1, don't bother trying to look it up.
|
||||
if (index == -1)
|
||||
return -1;
|
||||
Assert( Snds_iface.size() <= INT_MAX );
|
||||
Assert( Snds_iface.size() == Snds_iface_handle.size() );
|
||||
|
||||
char temp[11];
|
||||
sprintf(temp, "%i", index);
|
||||
|
||||
return gamesnd_lookup_name(temp, Snds_iface);
|
||||
int i = 0;
|
||||
for(SCP_vector<game_snd>::iterator snd = Snds_iface.begin(); snd != Snds_iface.end(); ++snd) {
|
||||
if ( snd->sig == index )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +121,7 @@ int gamesnd_get_by_iface_tbl_index(int index)
|
||||
* @param flags See the parse_sound_flags enum
|
||||
*
|
||||
*/
|
||||
void parse_sound_core(const char* tag, int *idx_dest, const char* object_name, const char* buf, parse_sound_flags flags)
|
||||
void parse_sound_core(char* tag, int *idx_dest, char* object_name, char* buf, parse_sound_flags flags)
|
||||
{
|
||||
int idx;
|
||||
|
||||
@@ -169,8 +134,18 @@ void parse_sound_core(const char* tag, int *idx_dest, const char* object_name, c
|
||||
{
|
||||
(*idx_dest) = idx;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(flags & PARSE_SOUND_INTERFACE_SOUND)
|
||||
idx = gamesnd_get_by_iface_tbl_index(atoi(buf));
|
||||
else
|
||||
idx = gamesnd_get_by_tbl_index(atoi(buf));
|
||||
|
||||
size_t size_to_check = 0;
|
||||
if (idx != -1)
|
||||
(*idx_dest) = idx;
|
||||
}
|
||||
|
||||
int size_to_check = 0;
|
||||
|
||||
if(flags & PARSE_SOUND_INTERFACE_SOUND)
|
||||
{
|
||||
@@ -204,7 +179,7 @@ void parse_sound_core(const char* tag, int *idx_dest, const char* object_name, c
|
||||
* @param flags See the parse_sound_flags enum
|
||||
*
|
||||
*/
|
||||
void parse_sound(const char* tag, int *idx_dest, const char* object_name, parse_sound_flags flags)
|
||||
void parse_sound(char* tag, int *idx_dest, char* object_name, parse_sound_flags flags)
|
||||
{
|
||||
if(optional_string(tag))
|
||||
{
|
||||
@@ -227,7 +202,7 @@ void parse_sound(const char* tag, int *idx_dest, const char* object_name, parse_
|
||||
* @param flags See the parse_sound_flags enum
|
||||
*
|
||||
*/
|
||||
void parse_sound_list(const char* tag, SCP_vector<int>& destination, const char* object_name, parse_sound_flags flags)
|
||||
void parse_sound_list(char* tag, SCP_vector<int>& destination, char* object_name, parse_sound_flags flags)
|
||||
{
|
||||
if(optional_string(tag))
|
||||
{
|
||||
@@ -240,13 +215,13 @@ void parse_sound_list(const char* tag, SCP_vector<int>& destination, const char*
|
||||
}
|
||||
|
||||
//now read the rest of the entries on the line
|
||||
for(size_t i=0; !check_for_eoln(); i++)
|
||||
for(int i=0;!check_for_eoln();i++)
|
||||
{
|
||||
char buf[MAX_FILENAME_LEN];
|
||||
stuff_string_white(buf, MAX_FILENAME_LEN);
|
||||
|
||||
//we do this conditionally to avoid adding needless entries when reparsing
|
||||
if(destination.size() <= i)
|
||||
if(destination.size() <= (unsigned)i)
|
||||
{
|
||||
destination.push_back(-1);
|
||||
}
|
||||
@@ -349,458 +324,266 @@ void gamesnd_unload_interface_sounds()
|
||||
}
|
||||
}
|
||||
|
||||
void parse_gamesnd_old(game_snd* gs)
|
||||
/**
|
||||
* Parse a sound effect line
|
||||
*/
|
||||
void gamesnd_parse_line(game_snd *gs, char *tag)
|
||||
{
|
||||
int is_3d;
|
||||
int temp;
|
||||
|
||||
required_string(tag);
|
||||
stuff_int(&gs->sig);
|
||||
stuff_string(gs->filename, F_NAME, MAX_FILENAME_LEN, ",");
|
||||
|
||||
if (!stricmp(gs->filename, NOX("empty")))
|
||||
{
|
||||
if ( !stricmp(gs->filename,NOX("empty")) ) {
|
||||
gs->filename[0] = 0;
|
||||
advance_to_eoln(NULL);
|
||||
return;
|
||||
}
|
||||
Mp++;
|
||||
|
||||
stuff_int(&temp);
|
||||
|
||||
if (temp > 0)
|
||||
{
|
||||
gs->preload = true;
|
||||
}
|
||||
|
||||
stuff_int(&gs->preload);
|
||||
stuff_float(&gs->default_volume);
|
||||
|
||||
stuff_int(&is_3d);
|
||||
|
||||
if (is_3d)
|
||||
{
|
||||
if ( is_3d ) {
|
||||
gs->flags |= GAME_SND_USE_DS3D;
|
||||
stuff_int(&gs->min);
|
||||
stuff_int(&gs->max);
|
||||
}
|
||||
else
|
||||
{
|
||||
// silly retail, not abiding by its own format...
|
||||
if (!stricmp(gs->filename, "l_hit.wav") || !stricmp(gs->filename, "m_hit.wav"))
|
||||
{
|
||||
ignore_gray_space();
|
||||
if (stuff_int_optional(&temp, true) == 2)
|
||||
{
|
||||
mprintf(("Dutifully ignoring the extra sound values for retail sound %s, '%s'...\n", gs->name.c_str(), gs->filename));
|
||||
ignore_gray_space();
|
||||
stuff_int_optional(&temp, true);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
gs->min = 0;
|
||||
gs->max = 0;
|
||||
}
|
||||
|
||||
// check for extra values per Mantis #2408
|
||||
ignore_gray_space();
|
||||
if (stuff_int_optional(&temp, true) == 2)
|
||||
{
|
||||
Warning(LOCATION, "Unexpected extra value %d found for sound '%s' (filename '%s')! Check the format of the sounds.tbl (or .tbm) entry.", temp, gs->name.c_str(), gs->filename);
|
||||
}
|
||||
|
||||
advance_to_eoln(NULL);
|
||||
}
|
||||
|
||||
void parse_gamesnd_new(game_snd* gs)
|
||||
{
|
||||
// New extended format found
|
||||
stuff_string(gs->filename, F_NAME, MAX_FILENAME_LEN);
|
||||
|
||||
if (!stricmp(gs->filename, NOX("empty")))
|
||||
{
|
||||
gs->filename[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
required_string("+Preload:");
|
||||
|
||||
stuff_boolean(&gs->preload);
|
||||
|
||||
required_string("+Volume:");
|
||||
|
||||
stuff_float(&gs->default_volume);
|
||||
|
||||
if (optional_string("+3D Sound:"))
|
||||
{
|
||||
gs->flags |= GAME_SND_USE_DS3D;
|
||||
required_string("+Attenuation start:");
|
||||
|
||||
stuff_int(&gs->min);
|
||||
|
||||
required_string("+Attenuation end:");
|
||||
|
||||
stuff_int(&gs->max);
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->min = 0;
|
||||
gs->max = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void gamesnd_parse_entry(game_snd *gs, bool no_create, SCP_vector<game_snd> *lookupVector)
|
||||
{
|
||||
SCP_string name;
|
||||
|
||||
stuff_string(name, F_NAME, "\t \n");
|
||||
|
||||
if (!no_create)
|
||||
{
|
||||
if (lookupVector != NULL)
|
||||
{
|
||||
if (gamesnd_lookup_name(name.c_str(), *lookupVector) >= 0)
|
||||
{
|
||||
Warning(LOCATION, "Duplicate sound name \"%s\" found!", name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
gs->name = name;
|
||||
}
|
||||
else
|
||||
{
|
||||
int vectorIndex = gamesnd_lookup_name(name.c_str(), *lookupVector);
|
||||
|
||||
if (vectorIndex < 0)
|
||||
{
|
||||
Warning(LOCATION, "No existing sound entry with name \"%s\" found!", name.c_str());
|
||||
no_create = false;
|
||||
gs->name = name;
|
||||
}
|
||||
else
|
||||
{
|
||||
gs = &lookupVector->at(vectorIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("+Filename:"))
|
||||
{
|
||||
parse_gamesnd_new(gs);
|
||||
}
|
||||
else
|
||||
{
|
||||
parse_gamesnd_old(gs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a sound effect entry by requiring the given tag at the beginning.
|
||||
*
|
||||
* @param gs The game_snd instance to fill in
|
||||
* @param tag The tag that's required before an entry
|
||||
* @param lookupVector If non-NULL used to look up @c +nocreate entries
|
||||
*
|
||||
* @return @c true when a new entry has been parsed and should be added to the list of known
|
||||
* entries. @c false otherwise, for example in case of @c +nocreate
|
||||
*/
|
||||
bool gamesnd_parse_line(game_snd *gs, const char *tag, SCP_vector<game_snd> *lookupVector = NULL)
|
||||
{
|
||||
Assertion(gs != NULL, "Invalid game_snd pointer passed to gamesnd_parse_line!");
|
||||
|
||||
required_string(const_cast<char*>(tag));
|
||||
|
||||
bool no_create = false;
|
||||
|
||||
if (lookupVector != NULL)
|
||||
{
|
||||
if(optional_string("+nocreate"))
|
||||
{
|
||||
no_create = true;
|
||||
}
|
||||
}
|
||||
|
||||
gamesnd_parse_entry(gs, no_create, lookupVector);
|
||||
|
||||
return !no_create;
|
||||
}
|
||||
|
||||
void parse_sound_environments()
|
||||
{
|
||||
char name[65] = { '\0' };
|
||||
char template_name[65] = { '\0' };
|
||||
EFXREVERBPROPERTIES *props;
|
||||
|
||||
while (required_string_either("#Sound Environments End", "$Name:"))
|
||||
{
|
||||
required_string("$Name:");
|
||||
stuff_string(name, F_NAME, sizeof(name)-1);
|
||||
|
||||
if (optional_string("$Template:"))
|
||||
{
|
||||
stuff_string(template_name, F_NAME, sizeof(template_name)-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
template_name[0] = '\0';
|
||||
}
|
||||
|
||||
ds_eax_get_prop(&props, name, template_name);
|
||||
|
||||
if (optional_string("+Density:"))
|
||||
{
|
||||
stuff_float(&props->flDensity);
|
||||
CLAMP(props->flDensity, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Diffusion:"))
|
||||
{
|
||||
stuff_float(&props->flDiffusion);
|
||||
CLAMP(props->flDiffusion, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Gain:"))
|
||||
{
|
||||
stuff_float(&props->flGain);
|
||||
CLAMP(props->flGain, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Gain HF:"))
|
||||
{
|
||||
stuff_float(&props->flGainHF);
|
||||
CLAMP(props->flGainHF, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Gain LF:"))
|
||||
{
|
||||
stuff_float(&props->flGainLF);
|
||||
CLAMP(props->flGainLF, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Decay Time:"))
|
||||
{
|
||||
stuff_float(&props->flDecayTime);
|
||||
CLAMP(props->flDecayTime, 0.01f, 20.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Decay HF Ratio:"))
|
||||
{
|
||||
stuff_float(&props->flDecayHFRatio);
|
||||
CLAMP(props->flDecayHFRatio, 0.1f, 20.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Decay LF Ratio:"))
|
||||
{
|
||||
stuff_float(&props->flDecayLFRatio);
|
||||
CLAMP(props->flDecayLFRatio, 0.1f, 20.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Reflections Gain:"))
|
||||
{
|
||||
stuff_float(&props->flReflectionsGain);
|
||||
CLAMP(props->flReflectionsGain, 0.0f, 3.16f);
|
||||
}
|
||||
|
||||
if (optional_string("+Reflections Delay:"))
|
||||
{
|
||||
stuff_float(&props->flReflectionsDelay);
|
||||
CLAMP(props->flReflectionsDelay, 0.0f, 0.3f);
|
||||
}
|
||||
|
||||
if (optional_string("+Reflections Pan:"))
|
||||
{
|
||||
stuff_float_list(props->flReflectionsPan, 3);
|
||||
CLAMP(props->flReflectionsPan[0], 0.0f, 1.0f);
|
||||
CLAMP(props->flReflectionsPan[1], 0.0f, 1.0f);
|
||||
CLAMP(props->flReflectionsPan[2], 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Late Reverb Gain:"))
|
||||
{
|
||||
stuff_float(&props->flLateReverbGain);
|
||||
CLAMP(props->flLateReverbGain, 0.0f, 10.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Late Reverb Delay:"))
|
||||
{
|
||||
stuff_float(&props->flLateReverbDelay);
|
||||
CLAMP(props->flLateReverbDelay, 0.0f, 0.1f);
|
||||
}
|
||||
|
||||
if (optional_string("+Late Reverb Pan:"))
|
||||
{
|
||||
stuff_float_list(props->flLateReverbPan, 3);
|
||||
CLAMP(props->flLateReverbPan[0], 0.0f, 1.0f);
|
||||
CLAMP(props->flLateReverbPan[1], 0.0f, 1.0f);
|
||||
CLAMP(props->flLateReverbPan[2], 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Echo Time:"))
|
||||
{
|
||||
stuff_float(&props->flEchoTime);
|
||||
CLAMP(props->flEchoTime, 0.075f, 0.25f);
|
||||
}
|
||||
|
||||
if (optional_string("+Echo Depth:"))
|
||||
{
|
||||
stuff_float(&props->flEchoDepth);
|
||||
CLAMP(props->flEchoDepth, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Modulation Time:"))
|
||||
{
|
||||
stuff_float(&props->flModulationTime);
|
||||
CLAMP(props->flModulationTime, 0.004f, 4.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Modulation Depth:"))
|
||||
{
|
||||
stuff_float(&props->flModulationDepth);
|
||||
CLAMP(props->flModulationDepth, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+HF Reference:"))
|
||||
{
|
||||
stuff_float(&props->flHFReference);
|
||||
CLAMP(props->flHFReference, 1000.0f, 20000.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+LF Reference:"))
|
||||
{
|
||||
stuff_float(&props->flLFReference);
|
||||
CLAMP(props->flLFReference, 20.0f, 1000.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Room Rolloff Factor:"))
|
||||
{
|
||||
stuff_float(&props->flRoomRolloffFactor);
|
||||
CLAMP(props->flRoomRolloffFactor, 0.0f, 10.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Air Absorption Gain HF:"))
|
||||
{
|
||||
stuff_float(&props->flAirAbsorptionGainHF);
|
||||
CLAMP(props->flAirAbsorptionGainHF, 0.892f, 1.0f);
|
||||
}
|
||||
|
||||
if (optional_string("+Decay HF Limit:"))
|
||||
{
|
||||
stuff_int(&props->iDecayHFLimit);
|
||||
CLAMP(props->iDecayHFLimit, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Sound Environments End");
|
||||
}
|
||||
|
||||
static SCP_vector<species_info> missingFlybySounds;
|
||||
|
||||
void parse_sound_table(char* filename)
|
||||
{
|
||||
int rval;
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
|
||||
return;
|
||||
}
|
||||
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// Parse the gameplay sounds section
|
||||
if (optional_string("#Game Sounds Start"))
|
||||
{
|
||||
while (!check_for_string("#Game Sounds End"))
|
||||
{
|
||||
game_snd tempSound;
|
||||
if (gamesnd_parse_line(&tempSound, "$Name:", &Snds))
|
||||
{
|
||||
Snds.push_back(game_snd(tempSound));
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Game Sounds End");
|
||||
}
|
||||
|
||||
// Parse the interface sounds section
|
||||
if (optional_string("#Interface Sounds Start"))
|
||||
{
|
||||
while (!check_for_string("#Interface Sounds End"))
|
||||
{
|
||||
game_snd tempSound;
|
||||
if (gamesnd_parse_line( &tempSound, "$Name:", &Snds_iface))
|
||||
{
|
||||
Snds_iface.push_back(game_snd(tempSound));
|
||||
Snds_iface_handle.push_back(-1);
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Interface Sounds End");
|
||||
}
|
||||
|
||||
// parse flyby sound section
|
||||
if (optional_string("#Flyby Sounds Start"))
|
||||
{
|
||||
char species_name_tag[NAME_LENGTH + 2];
|
||||
int sanity_check = 0;
|
||||
size_t i;
|
||||
|
||||
while (!check_for_string("#Flyby Sounds End") && (sanity_check <= (int)Species_info.size()))
|
||||
{
|
||||
for (i = 0; i < Species_info.size(); i++)
|
||||
{
|
||||
species_info *species = &Species_info[i];
|
||||
|
||||
sprintf(species_name_tag, "$%s:", species->species_name);
|
||||
|
||||
if (check_for_string(species_name_tag))
|
||||
{
|
||||
gamesnd_parse_line(&species->snd_flyby_fighter, species_name_tag);
|
||||
gamesnd_parse_line(&species->snd_flyby_bomber, species_name_tag);
|
||||
sanity_check--;
|
||||
}
|
||||
else
|
||||
{
|
||||
sanity_check++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Flyby Sounds End");
|
||||
}
|
||||
|
||||
if (optional_string("#Sound Environments Start"))
|
||||
{
|
||||
parse_sound_environments();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the sounds.tbl file, and load the specified sounds.
|
||||
*/
|
||||
void gamesnd_parse_soundstbl()
|
||||
{
|
||||
int rval;
|
||||
size_t i;
|
||||
char cstrtemp[NAME_LENGTH+3];
|
||||
char *missing_species_names = NULL;
|
||||
ubyte *missing_species = NULL;
|
||||
int sanity_check = 0;
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
parse_sound_table("sounds.tbl");
|
||||
if ((rval = setjmp(parse_abort)) != 0) {
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "sounds.tbl", rval));
|
||||
lcl_ext_close();
|
||||
return;
|
||||
}
|
||||
|
||||
parse_modular_table("*-snd.tbm", parse_sound_table);
|
||||
read_file_text("sounds.tbl", CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
|
||||
// Parse the gameplay sounds section
|
||||
required_string("#Game Sounds Start");
|
||||
while (required_string_either("#Game Sounds End","$Name:")) {
|
||||
game_snd tempSound;
|
||||
gamesnd_parse_line( &tempSound, "$Name:" );
|
||||
Snds.push_back(game_snd(tempSound));
|
||||
}
|
||||
required_string("#Game Sounds End");
|
||||
|
||||
// Parse the interface sounds section
|
||||
required_string("#Interface Sounds Start");
|
||||
while (required_string_either("#Interface Sounds End","$Name:")) {
|
||||
game_snd tempSound;
|
||||
gamesnd_parse_line( &tempSound, "$Name:");
|
||||
|
||||
Snds_iface.push_back(game_snd(tempSound));
|
||||
Snds_iface_handle.push_back(-1);
|
||||
}
|
||||
required_string("#Interface Sounds End");
|
||||
|
||||
// parse flyby sound section
|
||||
required_string("#Flyby Sounds Start");
|
||||
|
||||
missing_species_names = new char[Species_info.size() * (NAME_LENGTH+2)];
|
||||
missing_species = new ubyte[Species_info.size()];
|
||||
|
||||
memset( missing_species_names, 0, Species_info.size() * (NAME_LENGTH+2) );
|
||||
memset( missing_species, 1, Species_info.size() ); // assume they are all missing
|
||||
|
||||
while ( !check_for_string("#Flyby Sounds End") && (sanity_check <= (int)Species_info.size()) )
|
||||
{
|
||||
for (i = 0; i < Species_info.size(); i++) {
|
||||
species_info *species = &Species_info[i];
|
||||
|
||||
sprintf(cstrtemp, "$%s:", species->species_name);
|
||||
|
||||
if ( check_for_string(cstrtemp) ) {
|
||||
gamesnd_parse_line(&species->snd_flyby_fighter, cstrtemp);
|
||||
gamesnd_parse_line(&species->snd_flyby_bomber, cstrtemp);
|
||||
missing_species[i] = 0;
|
||||
sanity_check--;
|
||||
} else {
|
||||
sanity_check++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we are missing any species then report it
|
||||
for (i = 0; i < Species_info.size(); i++) {
|
||||
if ( missing_species[i] ) {
|
||||
strcat(missing_species_names, Species_info[i].species_name);
|
||||
strcat(missing_species_names, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
if ( strlen(missing_species_names) ) {
|
||||
Error( LOCATION, "The following species are missing flyby sounds in sounds.tbl:\n%s", missing_species_names );
|
||||
}
|
||||
|
||||
delete[] missing_species_names;
|
||||
delete[] missing_species;
|
||||
|
||||
required_string("#Flyby Sounds End");
|
||||
|
||||
if ( optional_string("#Sound Environments Start") ) {
|
||||
char name[65] = { '\0' };
|
||||
char template_name[65] = { '\0' };
|
||||
EFXREVERBPROPERTIES *props;
|
||||
|
||||
while ( required_string_either("#Sound Environments End", "$Name:") ) {
|
||||
required_string("$Name:");
|
||||
stuff_string(name, F_NAME, sizeof(name)-1);
|
||||
|
||||
if ( optional_string("$Template:") ) {
|
||||
stuff_string(template_name, F_NAME, sizeof(template_name)-1);
|
||||
} else {
|
||||
template_name[0] = '\0';
|
||||
}
|
||||
|
||||
ds_eax_get_prop(&props, name, template_name);
|
||||
|
||||
if ( optional_string("+Density:") ) {
|
||||
stuff_float(&props->flDensity);
|
||||
CLAMP(props->flDensity, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Diffusion:") ) {
|
||||
stuff_float(&props->flDiffusion);
|
||||
CLAMP(props->flDiffusion, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Gain:") ) {
|
||||
stuff_float(&props->flGain);
|
||||
CLAMP(props->flGain, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Gain HF:") ) {
|
||||
stuff_float(&props->flGainHF);
|
||||
CLAMP(props->flGainHF, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Gain LF:") ) {
|
||||
stuff_float(&props->flGainLF);
|
||||
CLAMP(props->flGainLF, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Decay Time:") ) {
|
||||
stuff_float(&props->flDecayTime);
|
||||
CLAMP(props->flDecayTime, 0.01f, 20.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Decay HF Ratio:") ) {
|
||||
stuff_float(&props->flDecayHFRatio);
|
||||
CLAMP(props->flDecayHFRatio, 0.1f, 20.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Decay LF Ratio:") ) {
|
||||
stuff_float(&props->flDecayLFRatio);
|
||||
CLAMP(props->flDecayLFRatio, 0.1f, 20.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Reflections Gain:") ) {
|
||||
stuff_float(&props->flReflectionsGain);
|
||||
CLAMP(props->flReflectionsGain, 0.0f, 3.16f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Reflections Delay:") ) {
|
||||
stuff_float(&props->flReflectionsDelay);
|
||||
CLAMP(props->flReflectionsDelay, 0.0f, 0.3f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Reflections Pan:") ) {
|
||||
stuff_float_list(props->flReflectionsPan, 3);
|
||||
CLAMP(props->flReflectionsPan[0], 0.0f, 1.0f);
|
||||
CLAMP(props->flReflectionsPan[1], 0.0f, 1.0f);
|
||||
CLAMP(props->flReflectionsPan[2], 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Late Reverb Gain:") ) {
|
||||
stuff_float(&props->flLateReverbGain);
|
||||
CLAMP(props->flLateReverbGain, 0.0f, 10.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Late Reverb Delay:") ) {
|
||||
stuff_float(&props->flLateReverbDelay);
|
||||
CLAMP(props->flLateReverbDelay, 0.0f, 0.1f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Late Reverb Pan:") ) {
|
||||
stuff_float_list(props->flLateReverbPan, 3);
|
||||
CLAMP(props->flLateReverbPan[0], 0.0f, 1.0f);
|
||||
CLAMP(props->flLateReverbPan[1], 0.0f, 1.0f);
|
||||
CLAMP(props->flLateReverbPan[2], 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Echo Time:") ) {
|
||||
stuff_float(&props->flEchoTime);
|
||||
CLAMP(props->flEchoTime, 0.075f, 0.25f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Echo Depth:") ) {
|
||||
stuff_float(&props->flEchoDepth);
|
||||
CLAMP(props->flEchoDepth, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Modulation Time:") ) {
|
||||
stuff_float(&props->flModulationTime);
|
||||
CLAMP(props->flModulationTime, 0.004f, 4.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Modulation Depth:") ) {
|
||||
stuff_float(&props->flModulationDepth);
|
||||
CLAMP(props->flModulationDepth, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+HF Reference:") ) {
|
||||
stuff_float(&props->flHFReference);
|
||||
CLAMP(props->flHFReference, 1000.0f, 20000.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+LF Reference:") ) {
|
||||
stuff_float(&props->flLFReference);
|
||||
CLAMP(props->flLFReference, 20.0f, 1000.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Room Rolloff Factor:") ) {
|
||||
stuff_float(&props->flRoomRolloffFactor);
|
||||
CLAMP(props->flRoomRolloffFactor, 0.0f, 10.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Air Absorption Gain HF:") ) {
|
||||
stuff_float(&props->flAirAbsorptionGainHF);
|
||||
CLAMP(props->flAirAbsorptionGainHF, 0.892f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Decay HF Limit:") ) {
|
||||
stuff_int(&props->iDecayHFLimit);
|
||||
CLAMP(props->iDecayHFLimit, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Sound Environments End");
|
||||
}
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
|
||||
// if we are missing any species then report
|
||||
if (missingFlybySounds.size() > 0)
|
||||
{
|
||||
SCP_string errorString;
|
||||
for (size_t i = 0; i < missingFlybySounds.size(); i++)
|
||||
{
|
||||
errorString.append(missingFlybySounds[i].species_name);
|
||||
errorString.append("\n");
|
||||
}
|
||||
|
||||
Error(LOCATION, "The following species are missing flyby sounds in sounds.tbl:\n%s", errorString.c_str());
|
||||
}
|
||||
|
||||
missingFlybySounds.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,8 +27,8 @@ void gamesnd_load_gameplay_sounds();
|
||||
void gamesnd_unload_gameplay_sounds();
|
||||
void gamesnd_play_iface(int n);
|
||||
void gamesnd_play_error_beep();
|
||||
int gamesnd_get_by_name(const char* name);
|
||||
int gamesnd_get_by_iface_name(const char* name);
|
||||
int gamesnd_get_by_name(char* name);
|
||||
int gamesnd_get_by_iface_name(char* name);
|
||||
int gamesnd_get_by_tbl_index(int index);
|
||||
int gamesnd_get_by_iface_tbl_index(int index);
|
||||
|
||||
@@ -43,8 +43,8 @@ enum parse_sound_flags
|
||||
|
||||
//This should handle NO_SOUND just fine since it doesn't directly access lowlevel code
|
||||
//Does all parsing for a sound
|
||||
void parse_sound(const char* tag, int* idx_dest, const char* object_name, parse_sound_flags = PARSE_SOUND_GENERAL_SOUND);
|
||||
void parse_sound_list(const char* tag, SCP_vector<int>& destination, const char* object_name, parse_sound_flags = PARSE_SOUND_GENERAL_SOUND);
|
||||
void parse_sound(char* tag, int* idx_dest, char* object_name, parse_sound_flags = PARSE_SOUND_GENERAL_SOUND);
|
||||
void parse_sound_list(char* tag, SCP_vector<int>& destination, char* object_name, parse_sound_flags = PARSE_SOUND_GENERAL_SOUND);
|
||||
|
||||
// this is a callback, so it needs to be a real function
|
||||
void common_play_highlight_sound();
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
#include "globalincs/def_files.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
|
||||
SCP_map<SCP_string, team_color> Team_Colors;
|
||||
SCP_vector<SCP_string> Team_Names;
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// ALPHA DEFINES/VARS
|
||||
//
|
||||
@@ -141,28 +138,28 @@ int new_alpha_colors_init()
|
||||
};
|
||||
|
||||
int rgba_defaults[TOTAL_COLORS][4] = {
|
||||
{93, 93, 128, 255},
|
||||
{185, 185, 255, 255},
|
||||
{0, 120, 0, 255},
|
||||
{50, 190, 50, 255},
|
||||
{0, 0, 0, 255},
|
||||
{65, 65, 65, 255},
|
||||
{160, 160, 160, 255},
|
||||
{105, 105, 105, 255},
|
||||
{255, 255, 255 ,255},
|
||||
{160, 144, 160, 255},
|
||||
{192, 104, 192, 255},
|
||||
{80, 6, 6, 255},
|
||||
{126, 6, 6, 255},
|
||||
{200, 0, 0, 255},
|
||||
{185, 150, 150, 255},
|
||||
{230, 190, 190, 255},
|
||||
{255, 255, 122, 255},
|
||||
{255, 255, 0, 255},
|
||||
{161, 184, 161, 255},
|
||||
{190, 228, 190, 255},
|
||||
{184, 161, 161, 255},
|
||||
{228, 190, 190, 255}
|
||||
93, 93, 128, 255,
|
||||
185, 185, 255, 255,
|
||||
0, 120, 0, 255,
|
||||
50, 190, 50, 255,
|
||||
0, 0, 0, 255,
|
||||
65, 65, 65, 255,
|
||||
160, 160, 160, 255,
|
||||
105, 105, 105, 255,
|
||||
255, 255, 255 ,255,
|
||||
160, 144, 160, 255,
|
||||
192, 104, 192, 255,
|
||||
80, 6, 6, 255,
|
||||
126, 6, 6, 255,
|
||||
200, 0, 0, 255,
|
||||
185, 150, 150, 255,
|
||||
230, 190, 190, 255,
|
||||
255, 255, 122, 255,
|
||||
255, 255, 0, 255,
|
||||
161, 184, 161, 255,
|
||||
190, 228, 190, 255,
|
||||
184, 161, 161, 255,
|
||||
228, 190, 190, 255
|
||||
};
|
||||
|
||||
// now for each color, check if it's corresponding string is there
|
||||
@@ -193,50 +190,11 @@ int new_alpha_colors_init()
|
||||
gr_init_alphacolor(colors[i], rgba_defaults[i][0], rgba_defaults[i][1], rgba_defaults[i][2], rgba_defaults[i][3]);
|
||||
}
|
||||
required_string("#End");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Team coloring
|
||||
if (optional_string("#Team Colors")) {
|
||||
|
||||
while (required_string_either("#End", "$Team Name:")) {
|
||||
required_string("$Team Name:"); // required to move the parse pointer forward
|
||||
char temp[NAME_LENGTH];
|
||||
SCP_string temp2;
|
||||
team_color temp_color;
|
||||
|
||||
stuff_string(temp, F_NAME, NAME_LENGTH);
|
||||
temp2 = SCP_string(temp);
|
||||
|
||||
if (required_string("$Team Stripe Color:")) {
|
||||
int rgb[3];
|
||||
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CLAMP(rgb[i], 0, 255);
|
||||
}
|
||||
|
||||
temp_color.stripe.r = rgb[0] / 255.0f;
|
||||
temp_color.stripe.g = rgb[1] / 255.0f;
|
||||
temp_color.stripe.b = rgb[2] / 255.0f;
|
||||
}
|
||||
|
||||
if (required_string("$Team Base Color:")) {
|
||||
int rgb[3];
|
||||
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CLAMP(rgb[i], 0, 255);
|
||||
}
|
||||
|
||||
temp_color.base.r = rgb[0] / 255.0f;
|
||||
temp_color.base.g = rgb[1] / 255.0f;
|
||||
temp_color.base.b = rgb[2] / 255.0f;
|
||||
}
|
||||
|
||||
Team_Colors[temp2] = temp_color;
|
||||
Team_Names.push_back(temp2);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
// if we get here, then something's wrong with the table
|
||||
return 0;
|
||||
}
|
||||
|
||||
// initialize all alpha colors (call at startup)
|
||||
|
||||
@@ -54,10 +54,6 @@ extern color Color_ui_light_pink, Color_ui_pink;
|
||||
#define NETPLAYER_COLORS 20
|
||||
extern color *Color_netplayer[NETPLAYER_COLORS];
|
||||
|
||||
// Team colors
|
||||
extern SCP_map<SCP_string, team_color> Team_Colors;
|
||||
extern SCP_vector<SCP_string> Team_Names;
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// ALPHA FUNCTIONS
|
||||
//
|
||||
|
||||
@@ -6,4 +6,4 @@ void random_shuffle(int *first, int *last);
|
||||
template <class RandomNumberGenerator>
|
||||
void random_shuffle(int *first, int *last, RandomNumberGenerator& custom_rand);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+17
-162
@@ -27,7 +27,6 @@ extern char *Default_ai_profiles_table;
|
||||
extern char *Default_autopilot_table;
|
||||
extern char *Default_fonts_table;
|
||||
extern char *Default_controlconfig_table;
|
||||
extern char *Default_mod_table;
|
||||
extern char *Default_post_processing_table;
|
||||
extern char* Default_main_vertex_shader;
|
||||
extern char* Default_main_fragment_shader;
|
||||
@@ -56,7 +55,6 @@ def_file Default_files[] =
|
||||
{ "autopilot.tbl", Default_autopilot_table },
|
||||
{ "fonts.tbl", Default_fonts_table },
|
||||
{ "controlconfigdefaults.tbl", Default_controlconfig_table },
|
||||
{ "game_settings.tbl", Default_mod_table},
|
||||
{ "post_processing.tbl", Default_post_processing_table},
|
||||
{ "main-f.sdr", Default_main_fragment_shader},
|
||||
{ "main-v.sdr", Default_main_vertex_shader},
|
||||
@@ -100,69 +98,6 @@ char *defaults_get_file(char *filename)
|
||||
// Please note that the {\n\}s should be removed from the end of each line
|
||||
// if you intend to use this to format your own table.
|
||||
|
||||
char *Default_mod_table = "\
|
||||
;; Mod.tbl should be used for settings which affect the entire mod and \n\
|
||||
;; only very rarely need to be changed (if ever). \n\
|
||||
\n\
|
||||
#CAMPAIGN SETTINGS \n\
|
||||
\n\
|
||||
;; Sets default campaign file the game will look for with new pilots \n\
|
||||
$Default Campaign File Name: FreeSpace2 \n\
|
||||
\n\
|
||||
\n\
|
||||
#HUD SETTINGS \n\
|
||||
\n\
|
||||
;; Sets the delay before a directive will appear on the screen (ms) \n\
|
||||
$Directive Wait Time: 3000 \n\
|
||||
\n\
|
||||
;; If set, shows the HUD during in-game cutscenes \n\
|
||||
$Cutscene camera displays HUD: NO \n\
|
||||
\n\
|
||||
;; If set, uses the colors of the ANI instead of the colors of the HUD \n\
|
||||
$Full color head animations: NO \n\
|
||||
\n\
|
||||
\n\
|
||||
#SEXP SETTINGS \n\
|
||||
\n\
|
||||
;; When set, this makes the argument SEXPs loop through all the SEXPs \n\
|
||||
;; before it moves on to the next argument. Default behaviour is the \n\
|
||||
;; exact opposite, each SEXP is called for all arguments. \n\
|
||||
$Loop SEXPs Then Arguments: NO \n\
|
||||
\n\
|
||||
;; When set, this makes the event chaining behavior act as people \n\
|
||||
;; expected it to be in Mantis #82. \n\
|
||||
$Use Alternate Chaining Behavior: NO \n\
|
||||
\n\
|
||||
\n\
|
||||
#GRAPHICS SETTINGS \n\
|
||||
\n\
|
||||
;; When set, this enables the loading of external shader files \n\
|
||||
$Enable external shaders: NO \n\
|
||||
\n\
|
||||
\n\
|
||||
#OTHER SETTINGS \n\
|
||||
\n\
|
||||
;; If not set, a hit to a turret's barrels will not count as a hit to \n\
|
||||
;; the turret unless it is also within the turret base's radius. \n\
|
||||
$Fixed Turret Collisions: NO \n\
|
||||
\n""\
|
||||
;; If not set, hits will damage nearest subsystem first, rather than the\n\
|
||||
;; impacted physical subsystem first. \n\
|
||||
$Damage Impacted Subsystem First: NO \n\
|
||||
\n\
|
||||
;; used when no ani is specified or ship_select_3d is active \n\
|
||||
$Default ship select effect: FS2 \n\
|
||||
\n\
|
||||
;; used when no ani is specified or weapon_select_3d is active \n\
|
||||
$Default weapon select effect: FS2 \n\
|
||||
\n\
|
||||
;; Enable weapons to inherit their parent object's collision group setting \n\
|
||||
$Weapons inherit parent collision group: NO \n\
|
||||
\n\
|
||||
#END \n\
|
||||
";
|
||||
|
||||
|
||||
char *Default_species_table = "\
|
||||
\n\
|
||||
#SPECIES DEFS \n\
|
||||
@@ -844,7 +779,7 @@ $AI Maybe Links Energy Weapons: 90, 60, 40, 20, 10 \n\
|
||||
\n\
|
||||
;; maximum number of missiles allowed to be homing in on a player at a \n\
|
||||
;; given time (single-player only; no restriction in multiplayer) \n\
|
||||
$Max Missiles Locked on Player: 2, 3, 4, 7, 99 \n\
|
||||
$Max Missles Locked on Player: 2, 3, 4, 7, 99 \n\
|
||||
\n\
|
||||
;; maximum number of ships allowed to be attacking the player at a \n\
|
||||
;; given time (single-player only; no restriction in multiplayer) \n\
|
||||
@@ -907,8 +842,7 @@ $Stalemate Time Threshold: 0, 0, 0, 0, 0 \n\
|
||||
;; for a dogfight stalemate \n\
|
||||
$Stalemate Distance Threshold: 0, 0, 0, 0, 0 \n\
|
||||
\n\
|
||||
;; Sets the factor applied to the speed at which the player's shields \n\
|
||||
;; recharge \n\
|
||||
;; factor applied to the speed at which the player's shields recharge \n\
|
||||
$Player Shield Recharge Scale: 4, 2, 1.5, 1.25, 1 \n\
|
||||
\n\
|
||||
;; factor applied to the speed at which the player's weapons recharge \n\
|
||||
@@ -1046,7 +980,7 @@ $score assists based on damage caused: NO \n\
|
||||
$allow event and goal scoring in multiplayer: NO \n\
|
||||
\n\
|
||||
;; if set, the AI will properly link primaries according to \n\
|
||||
;; specified percentages of energy levels, instead of retail behavior \n\
|
||||
;; specified percentages of energy levels instead of retail behavior \n\
|
||||
;; where it mistakenly linked according to absolute energy levels \n\
|
||||
$fix linked primary weapon decision bug: NO \n\
|
||||
\n\
|
||||
@@ -1070,7 +1004,7 @@ $multi allow empty primaries: NO \n\
|
||||
;; allow a player to commit into a multiplayer game without secondaries \n\
|
||||
$multi allow empty secondaries: NO \n\
|
||||
\n\
|
||||
;; if set, allows turrets target other weapons than bombs assuming \n\
|
||||
;; if set, allows turrets target other weapons that bombs assuming \n\
|
||||
;; it is within allowed target priorities \n\
|
||||
$allow turrets target weapons freely: NO \n\
|
||||
\n\
|
||||
@@ -1081,33 +1015,17 @@ $use only single fov for turrets: NO \n\
|
||||
;; allow AI ships to dodge weapons vertically as well as horizontally \n\
|
||||
$allow vertical dodge: NO \n\
|
||||
\n""\
|
||||
;; If set makes beam turrets use same FOV rules as other weapons do. \n\
|
||||
;; Prevents beam from a turret from following the target beyond the \n\
|
||||
;; turret's FOV. \n\
|
||||
$force beam turrets to use normal fov: NO \n\
|
||||
\n\
|
||||
;; Fixes a bug where AI class is not properly set if set in the mission \n\
|
||||
;; This should be YES if you want anything in AI.tbl to mean anything \n\
|
||||
$fix AI class bug: NO \n\
|
||||
\n\
|
||||
;; TBD \n\
|
||||
$turrets ignore targets radius in range checks: NO \n\
|
||||
\n\
|
||||
;; If set, the AI will NOT make extra effort to avoid ramming the player\n\
|
||||
;; during dogfights. This results in more aggressive AI. \n\
|
||||
$no extra collision avoidance vs player: NO \n\
|
||||
\n\
|
||||
;; If set, the game will not check if the dying ship is a player's \n\
|
||||
;; wingman, or if the maximum number of screams have been played, or \n\
|
||||
;; even if the dying ship is on the player's team before making it give \n\
|
||||
;; a death scream \n\
|
||||
$perform fewer checks for death screams: NO \n\
|
||||
\n\
|
||||
;; TBD \n\
|
||||
$advanced turret fov edge checks: NO \n\
|
||||
\n\
|
||||
;; TBD \n\
|
||||
$require turrets to have target in fov: NO \n\
|
||||
;; If set, the game will check if the dying ship is a player's wingman, \n\
|
||||
;; before making it give a death scream \n\
|
||||
$perform less checks for death screams: NO \n\
|
||||
\n\
|
||||
;; If set, allows shield management for all ships \n\
|
||||
;; (including capships). \n\
|
||||
@@ -1116,30 +1034,14 @@ $all ships manage shields: NO \n\
|
||||
;; If set, ai aims using ship center instead of first gunpoint \n\
|
||||
$ai aims from ship center: NO \n\
|
||||
\n\
|
||||
;; If set, allows AI fighters to link their weapons at the beginning of \n\
|
||||
;; a mission instead of imposing a delay of 30s to 120s \n\
|
||||
$allow primary link at mission start: NO \n\
|
||||
;; If set, prevents fighters from linking their weapons in the first \n\
|
||||
;; few minutes of the mission \n\
|
||||
$allow primary link delay: YES \n\
|
||||
\n\
|
||||
;; If set, prevents beams from instantly killing all weapons from first \n\
|
||||
;; hit, instead allows weapon hitpoints to be used instead \n\
|
||||
$allow beams to damage bombs: NO \n\
|
||||
\n\
|
||||
;; TBD \n\
|
||||
$disable weapon damage scaling for player: NO \n\
|
||||
\n\
|
||||
;; TBD \n\
|
||||
$countermeasures affect aspect seekers: NO \n\
|
||||
\n\
|
||||
;; TBD \n\
|
||||
$ai path mode: normal \n""\
|
||||
\n\
|
||||
;; TBD \n\
|
||||
$no warp camera: NO \n\
|
||||
\n\
|
||||
;; If set, this flag overrides the retail behavior whereby a ship \n\
|
||||
;; assigned to guard a ship in a wing will instead guard the entire wing\n\
|
||||
$ai guards specific ship in wing: NO \n\
|
||||
\n\
|
||||
#End \n\
|
||||
";
|
||||
|
||||
@@ -1302,25 +1204,16 @@ char* Default_main_vertex_shader =
|
||||
"#ifdef FLAG_FOG\n"
|
||||
"varying float fogDist;\n"
|
||||
"#endif\n"
|
||||
"#ifdef FLAG_THRUSTER\n"
|
||||
"uniform float thruster_scale;\n"
|
||||
"#endif\n"
|
||||
"varying vec4 position;\n"
|
||||
"varying vec3 lNormal;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;\n"
|
||||
" vec4 vertex = gl_Vertex;\n"
|
||||
" #ifdef FLAG_THRUSTER\n"
|
||||
" if(vertex.z < -1.5) {\n"
|
||||
" vertex.z *= thruster_scale;\n"
|
||||
" }\n"
|
||||
" #endif\n"
|
||||
" gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vertex;\n"
|
||||
" gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;\n"
|
||||
" gl_FrontColor = gl_Color;\n"
|
||||
" gl_FrontSecondaryColor = vec4(0.0, 0.0, 0.0, 1.0);\n"
|
||||
" // Transform the normal into eye space and normalize the result.\n"
|
||||
" position = gl_ModelViewMatrix * vertex;\n"
|
||||
" position = gl_ModelViewMatrix * gl_Vertex;\n"
|
||||
" vec3 normal = normalize(gl_NormalMatrix * gl_Normal);\n"
|
||||
" lNormal = normal;\n"
|
||||
" #ifdef FLAG_NORMAL_MAP\n"
|
||||
@@ -1338,7 +1231,10 @@ char* Default_main_vertex_shader =
|
||||
" #ifdef FLAG_FOG\n"
|
||||
" fogDist = clamp((gl_Position.z - gl_Fog.start) * 0.75 * gl_Fog.scale, 0.0, 1.0);\n"
|
||||
" #endif\n"
|
||||
" gl_ClipVertex = (gl_ModelViewMatrix * vertex);\n"
|
||||
" #ifdef __GLSL_CG_DATA_TYPES\n"
|
||||
" // Check necessary for ATI specific behavior\n"
|
||||
" gl_ClipVertex = (gl_ModelViewMatrix * gl_Vertex);\n"
|
||||
" #endif\n"
|
||||
"}";
|
||||
|
||||
char *Default_main_fragment_shader =
|
||||
@@ -1347,10 +1243,6 @@ char *Default_main_fragment_shader =
|
||||
"#endif\n"
|
||||
"#ifdef FLAG_DIFFUSE_MAP\n"
|
||||
"uniform sampler2D sBasemap;\n"
|
||||
"uniform int desaturate;\n"
|
||||
"uniform float desaturate_r;\n"
|
||||
"uniform float desaturate_g;\n"
|
||||
"uniform float desaturate_b;\n"
|
||||
"#endif\n"
|
||||
"#ifdef FLAG_GLOW_MAP\n"
|
||||
"uniform sampler2D sGlowmap;\n"
|
||||
@@ -1377,14 +1269,6 @@ char *Default_main_fragment_shader =
|
||||
"uniform float vpwidth;\n"
|
||||
"uniform float vpheight;\n"
|
||||
"#endif\n"
|
||||
"#ifdef FLAG_TEAMCOLOR\n"
|
||||
"uniform vec3 base_color;\n"
|
||||
"uniform vec3 stripe_color;\n"
|
||||
"vec2 teamMask = vec2(0.0, 0.0);\n"
|
||||
"#endif\n"
|
||||
"#ifdef FLAG_MISC_MAP\n"
|
||||
"uniform sampler2D sMiscmap;\n"
|
||||
"#endif\n"
|
||||
"varying vec4 position;\n"
|
||||
"varying vec3 lNormal;\n"
|
||||
"#if SHADER_MODEL == 2\n"
|
||||
@@ -1411,12 +1295,6 @@ char *Default_main_fragment_shader =
|
||||
" #ifdef FLAG_SPEC_MAP\n"
|
||||
" vec4 specColour = texture2D(sSpecmap, texCoord);\n"
|
||||
" #endif\n"
|
||||
" #ifdef FLAG_MISC_MAP\n"
|
||||
" #ifdef FLAG_TEAMCOLOR\n"
|
||||
" vec2 teamMask = vec2(0.0, 0.0);\n"
|
||||
" teamMask = texture2D(sMiscmap, texCoord).rg;\n"
|
||||
" #endif\n"
|
||||
" #endif\n"
|
||||
" #ifdef FLAG_LIGHT\n"
|
||||
" #ifdef FLAG_NORMAL_MAP\n"
|
||||
" // Normal map - convert from DXT5nm\n"
|
||||
@@ -1513,11 +1391,6 @@ char *Default_main_fragment_shader =
|
||||
" #else\n"
|
||||
" vec4 baseColor = gl_Color;\n"
|
||||
" #endif\n"
|
||||
" #ifdef FLAG_TEAMCOLOR\n"
|
||||
" vec3 base = base_color - vec3(0.5);\n"
|
||||
" vec3 stripe = stripe_color - vec3(0.5);\n"
|
||||
" baseColor.rgb += (base * teamMask.x) + (stripe * teamMask.y);\n"
|
||||
" #endif\n"
|
||||
" vec4 fragmentColor;\n"
|
||||
" fragmentColor.rgb = baseColor.rgb * max(lightAmbientDiffuse.rgb * AMBIENT_LIGHT_BOOST, gl_LightModel.ambient.rgb - 0.425);\n"
|
||||
" fragmentColor.a = baseColor.a;\n"
|
||||
@@ -1568,15 +1441,6 @@ char *Default_main_fragment_shader =
|
||||
" #endif\n"
|
||||
" }\n"
|
||||
" #else\n"
|
||||
" #ifdef FLAG_DIFFUSE_MAP\n"
|
||||
" if(desaturate == 1) {\n"
|
||||
" float intensity = 0.0;\n"
|
||||
" intensity = (fragmentColor.r + fragmentColor.g + fragmentColor.b)/3.0;\n"
|
||||
" float alpha = fragmentColor.a;\n"
|
||||
" fragmentColor = vec4(desaturate_r, desaturate_g, desaturate_b, 1.0) * intensity;\n"
|
||||
" fragmentColor.a = alpha;\n"
|
||||
" }\n"
|
||||
" #endif\n"
|
||||
" gl_FragColor = fragmentColor;\n"
|
||||
" #endif\n"
|
||||
"}";
|
||||
@@ -2302,17 +2166,9 @@ char* Default_fxaa_prepass_shader =
|
||||
char* Default_particle_vertex_shader =
|
||||
"attribute float radius_in;\n"
|
||||
"varying float radius;\n"
|
||||
"#ifdef FLAG_DISTORTION\n"
|
||||
"attribute float offset_in;\n"
|
||||
"varying float offset_out;\n"
|
||||
"uniform float use_offset;\n"
|
||||
"#endif\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" radius = radius_in;\n"
|
||||
" #ifdef FLAG_DISTORTION\n"
|
||||
" offset_out = offset_in * use_offset;\n"
|
||||
" #endif\n"
|
||||
" gl_TexCoord[0] = gl_MultiTexCoord0;\n"
|
||||
" gl_Position = ftransform();\n"
|
||||
" gl_FrontColor = gl_Color;\n"
|
||||
@@ -2334,7 +2190,6 @@ char* Default_particle_fragment_shader =
|
||||
"#ifdef FLAG_DISTORTION\n"
|
||||
"uniform sampler2D distMap;\n"
|
||||
"uniform sampler2D frameBuffer;\n"
|
||||
"varying float offset_out;\n"
|
||||
"#endif\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
@@ -2360,7 +2215,7 @@ char* Default_particle_fragment_shader =
|
||||
" #else\n"
|
||||
" vec2 depthCoord = vec2(gl_FragCoord.x / window_width, gl_FragCoord.y / window_height);\n"
|
||||
" vec4 fragmentColor = texture2D(baseMap, gl_TexCoord[0].xy)*gl_Color.a;\n"
|
||||
" vec2 distortion = texture2D(distMap, gl_TexCoord[0].xy+vec2(0.0, offset_out)).rg;\n"
|
||||
" vec2 distortion = texture2D(distMap, gl_TexCoord[0].xy).rg;\n"
|
||||
" float alpha = clamp(dot(fragmentColor.rgb,vec3(0.3333))*10.0,0.0,1.0);\n"
|
||||
" distortion = ((distortion - 0.5) * 0.01) * alpha;\n"
|
||||
" gl_FragColor = texture2D(frameBuffer,depthCoord+distortion);\n"
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
#define MAX_SHIPS 400 // max number of ship instances there can be.DTP; bumped from 200 to 400
|
||||
#define SHIPS_LIMIT 400 // what MAX_SHIPS will be at release time (for error checking in debug mode); dtp Bumped from 200 to 400
|
||||
|
||||
// from missionparse.h and then redefined to the same value in sexp.h
|
||||
#define TOKEN_LENGTH 32
|
||||
// ****************************************************************
|
||||
// DO NOT CHANGE THIS - IT WILL LIKELY BREAK FREESPACE2 PXO SUPPORT
|
||||
// TALK TO DAVE B FIRST
|
||||
@@ -71,7 +69,7 @@
|
||||
#define MAX_COMPLETE_ESCORT_LIST 20
|
||||
|
||||
// from weapon.h
|
||||
#define MAX_WEAPONS 2000
|
||||
#define MAX_WEAPONS 700
|
||||
|
||||
#ifdef INF_BUILD
|
||||
#define MAX_WEAPON_TYPES 300
|
||||
@@ -97,7 +95,7 @@
|
||||
extern int Num_medals;
|
||||
|
||||
// object.h
|
||||
#define MAX_OBJECTS 3500
|
||||
#define MAX_OBJECTS 2000
|
||||
|
||||
// from lighting.cpp
|
||||
#define MAX_LIGHTS 256
|
||||
|
||||
@@ -73,4 +73,4 @@ extern DWORD WINAPI SCP_mspdbcs_DumpStackThread( LPVOID pv );
|
||||
extern void SCP_mspdbcs_Initialise( );
|
||||
extern void SCP_mspdbcs_Cleanup( );
|
||||
|
||||
#endif // _MSPDB_CALLSTACK_H_INCLUDED_
|
||||
#endif // _MSPDB_CALLSTACK_H_INCLUDED_
|
||||
@@ -159,13 +159,6 @@ typedef struct vertex {
|
||||
ubyte pad[2]; // pad structure to be 4 byte aligned.
|
||||
} vertex;
|
||||
|
||||
typedef struct effect_vertex {
|
||||
vec3d position;
|
||||
uv_pair tex_coord;
|
||||
float radius;
|
||||
ubyte r, g, b, a;
|
||||
} effect_vertex;
|
||||
|
||||
//def_list
|
||||
typedef struct flag_def_list {
|
||||
char *name;
|
||||
@@ -213,46 +206,28 @@ extern int Global_error_count;
|
||||
// Disabling this functionality is dangerous, crazy values can run rampent unchecked and the longer its disabled
|
||||
// the more likely you are to have problems getting it working again.
|
||||
#if defined(NDEBUG)
|
||||
# define Assert(expr) do { ASSUME(expr); } while (0)
|
||||
# define Assert(x) do { ASSUME(x); } while (0)
|
||||
# ifndef _MSC_VER // non MS compilers
|
||||
# define Assertion(expr, msg, ...) do {} while (0)
|
||||
# define Assertion(x, y, ...) do {} while (0)
|
||||
# else
|
||||
# if _MSC_VER >= 1400 // VC 2005 or greater
|
||||
# define Assertion(expr, msg, ...) do { ASSUME(expr); } while (0)
|
||||
# define Assertion(x, y, ...) do { ASSUME(x); } while (0)
|
||||
# else
|
||||
# define Assertion(expr, msg) do {} while (0)
|
||||
# define Assertion(x, y) do {} while (0)
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
void gr_activate(int);
|
||||
# define Assert(expr) do {\
|
||||
if (!(expr)) {\
|
||||
WinAssert(#expr,__FILE__,__LINE__);\
|
||||
}\
|
||||
ASSUME( expr );\
|
||||
} while (0)
|
||||
# define Assert(x) do { if (!(x)){ WinAssert(#x,__FILE__,__LINE__); } ASSUME( x ); } while (0)
|
||||
|
||||
// Assertion can only use its proper fuctionality in compilers that support variadic macro
|
||||
# ifndef _MSC_VER // non MS compilers
|
||||
# define Assertion(expr, msg, ...) do {\
|
||||
if (!(expr)) {\
|
||||
WinAssert(#expr,__FILE__,__LINE__, msg , ##__VA_ARGS__ );\
|
||||
}\
|
||||
} while (0)
|
||||
# define Assertion(x, y, ...) do { if (!(x)){ WinAssert(#x,__FILE__,__LINE__, y , ##__VA_ARGS__ ); } } while (0)
|
||||
# else
|
||||
# if _MSC_VER >= 1400 // VC 2005 or greater
|
||||
# define Assertion(expr, msg, ...) do {\
|
||||
if (!(expr)) {\
|
||||
WinAssert(#expr,__FILE__,__LINE__, msg, __VA_ARGS__ );\
|
||||
}\
|
||||
ASSUME(expr);\
|
||||
} while (0)
|
||||
# else // older MSVC compilers
|
||||
# define Assertion(expr, msg) do {\
|
||||
if (!(expr)) {\
|
||||
WinAssert(#expr,__FILE__,__LINE__);\
|
||||
}\
|
||||
} while (0)
|
||||
# define Assertion(x, y, ...) do { if (!(x)){ WinAssert(#x,__FILE__,__LINE__, y, __VA_ARGS__ ); } ASSUME(x); } while (0)
|
||||
# else // everything else
|
||||
# define Assertion(x, y) do { if (!(x)){ WinAssert(#x,__FILE__,__LINE__); } } while (0)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -252,4 +252,4 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -72,10 +72,8 @@ bool Specmap_override = false;
|
||||
bool Normalmap_override = false;
|
||||
bool Heightmap_override = false;
|
||||
bool Glowpoint_override = false;
|
||||
bool Glowpoint_use_depth_buffer = true;
|
||||
bool GLSL_override = false;
|
||||
bool PostProcessing_override = false;
|
||||
bool Teamcolor_override = false;
|
||||
|
||||
// Values used for noise for thruster animations
|
||||
float Noise[NOISE_NUM_FRAMES] = {
|
||||
@@ -420,13 +418,13 @@ detail_levels Detail_defaults[NUM_DEFAULT_DETAIL_LEVELS] = {
|
||||
{ // Medium
|
||||
1, // setting
|
||||
// ===== Analogs (0-MAX_DETAIL_LEVEL) ====
|
||||
2, // nebula_detail; // 0=lowest detail, MAX_DETAIL_LEVEL=highest detail
|
||||
2, // detail_distance; // 0=lowest MAX_DETAIL_LEVEL=highest
|
||||
2, // hardware_textures; // 0=max culling, MAX_DETAIL_LEVEL=no culling
|
||||
1, // nebula_detail; // 0=lowest detail, MAX_DETAIL_LEVEL=highest detail
|
||||
1, // detail_distance; // 0=lowest MAX_DETAIL_LEVEL=highest
|
||||
1, // hardware_textures; // 0=max culling, MAX_DETAIL_LEVEL=no culling
|
||||
2, // num_small_debris; // 0=min number, MAX_DETAIL_LEVEL=max number
|
||||
2, // num_particles; // 0=min number, MAX_DETAIL_LEVEL=max number
|
||||
2, // num_stars; // 0=min number, MAX_DETAIL_LEVEL=max number
|
||||
2, // shield_effects; // 0=min, MAX_DETAIL_LEVEL=max
|
||||
1, // shield_effects; // 0=min, MAX_DETAIL_LEVEL=max
|
||||
3, // lighting; // 0=min, MAX_DETAIL_LEVEL=max
|
||||
|
||||
// ==== Booleans ====
|
||||
@@ -438,7 +436,7 @@ detail_levels Detail_defaults[NUM_DEFAULT_DETAIL_LEVELS] = {
|
||||
2, // setting
|
||||
// ===== Analogs (0-MAX_DETAIL_LEVEL) ====
|
||||
2, // nebula_detail; // 0=lowest detail, MAX_DETAIL_LEVEL=highest detail
|
||||
2, // detail_distance; // 0=lowest MAX_DETAIL_LEVEL=highest
|
||||
3, // detail_distance; // 0=lowest MAX_DETAIL_LEVEL=highest
|
||||
3, // hardware_textures; // 0=max culling, MAX_DETAIL_LEVEL=no culling
|
||||
3, // num_small_debris; // 0=min number, MAX_DETAIL_LEVEL=max number
|
||||
3, // num_particles; // 0=min number, MAX_DETAIL_LEVEL=max number
|
||||
@@ -458,7 +456,7 @@ detail_levels Detail_defaults[NUM_DEFAULT_DETAIL_LEVELS] = {
|
||||
3, // detail_distance; // 0=lowest MAX_DETAIL_LEVEL=highest
|
||||
4, // hardware_textures; // 0=max culling, MAX_DETAIL_LEVEL=no culling
|
||||
4, // num_small_debris; // 0=min number, MAX_DETAIL_LEVEL=max number
|
||||
4, // num_particles; // 0=min number, MAX_DETAIL_LEVEL=max number
|
||||
3, // num_particles; // 0=min number, MAX_DETAIL_LEVEL=max number
|
||||
4, // num_stars; // 0=min number, MAX_DETAIL_LEVEL=max number
|
||||
4, // shield_effects; // 0=min, MAX_DETAIL_LEVEL=max
|
||||
4, // lighting; // 0=min, MAX_DETAIL_LEVEL=max
|
||||
|
||||
@@ -139,10 +139,8 @@ extern bool Specmap_override;
|
||||
extern bool Normalmap_override;
|
||||
extern bool Heightmap_override;
|
||||
extern bool Glowpoint_override;
|
||||
extern bool Glowpoint_use_depth_buffer;
|
||||
extern bool GLSL_override;
|
||||
extern bool PostProcessing_override;
|
||||
extern bool Teamcolor_override;
|
||||
|
||||
// game skill levels
|
||||
#define NUM_SKILL_LEVELS 5
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
|
||||
#define FS_VERSION_MAJOR 3 // major version
|
||||
#define FS_VERSION_MINOR 6 // increase by 1 for minor revs
|
||||
#define FS_VERSION_BUILD 16 // bugfix release
|
||||
#define FS_VERSION_REVIS 9482 // SVN revision
|
||||
#define FS_VERSION_BUILD 13 // bugfix release
|
||||
#define FS_VERSION_REVIS 0000 // SVN revision
|
||||
|
||||
#define VERSION_LOC_FNAME "version.nfo"
|
||||
#define MOTD_LOC_FNAME "motd.txt"
|
||||
|
||||
@@ -9,22 +9,6 @@
|
||||
#include <string>
|
||||
#include <queue>
|
||||
|
||||
#if defined __GNUC__
|
||||
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#if GCC_VERSION >= 40300
|
||||
#include <tr1/unordered_map>
|
||||
#define SCP_hash_map std::tr1::unordered_map
|
||||
#elif GCC_VERSION < 40300 || __clang__
|
||||
#include <ext/hash_map>
|
||||
#define SCP_hash_map __gnu_cxx::hash_map
|
||||
#endif // GCC_VERSION || __clang__
|
||||
#endif // __GNUC__
|
||||
|
||||
#if ! defined __GNUC__
|
||||
#include <hash_map>
|
||||
#define SCP_hash_map stdext::hash_map
|
||||
#endif // ! defined __GNUC__
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400 || !defined(_MSC_VER)
|
||||
|
||||
#define DESTROY( type, p ) (p)->~type( )
|
||||
@@ -135,7 +119,9 @@ bool operator!=(const SCP_vm_allocator<T1>&, const SCP_vm_allocator<T2>&) throw(
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#define SCP_string std::string
|
||||
#define SCP_stringstream std::stringstream
|
||||
#define SCP_map std::map
|
||||
@@ -146,4 +132,4 @@ bool operator!=(const SCP_vm_allocator<T1>&, const SCP_vm_allocator<T2>&) throw(
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _VMALLOCATOR_H_INCLUDED_
|
||||
#endif // _VMALLOCATOR_H_INCLUDED_
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "parse/lua.h"
|
||||
#include "parse/parselo.h"
|
||||
|
||||
#if defined( SHOW_CALL_STACK ) && defined( PDB_DEBUGGING )
|
||||
# include "globalincs/mspdb_callstack.h"
|
||||
@@ -45,8 +44,6 @@ bool Messagebox_active = false;
|
||||
int Global_warning_count = 0;
|
||||
int Global_error_count = 0;
|
||||
|
||||
const int Messagebox_lines = 30;
|
||||
|
||||
#ifndef _ASSERT
|
||||
#ifndef _DEBUG
|
||||
#define _ASSERT(expr) ((void)0)
|
||||
@@ -79,11 +76,6 @@ public :
|
||||
void Printf( const char* format, ... ) ;
|
||||
void SetWindowText( HWND hWnd ) const ;
|
||||
char buffer[ BUFFER_SIZE ] ;
|
||||
|
||||
void Append(const char* text);
|
||||
void Truncate(size_t size);
|
||||
void TruncateLines(int num_allowed_lines);
|
||||
size_t Size() const;
|
||||
private :
|
||||
char* current ;
|
||||
} ;
|
||||
@@ -102,53 +94,6 @@ void DumpBuffer :: Clear()
|
||||
}
|
||||
|
||||
|
||||
void DumpBuffer :: Append(const char* text)
|
||||
{
|
||||
strcat_s(buffer, text);
|
||||
}
|
||||
|
||||
|
||||
void DumpBuffer :: Truncate(size_t size)
|
||||
{
|
||||
if (size >= strlen(buffer))
|
||||
return;
|
||||
|
||||
buffer[size] = 0;
|
||||
}
|
||||
|
||||
|
||||
// adapted from parselo
|
||||
void DumpBuffer :: TruncateLines(int num_allowed_lines)
|
||||
{
|
||||
Assert(num_allowed_lines > 0);
|
||||
char *find_from = buffer;
|
||||
char *lastch = find_from + strlen(buffer) - 6;
|
||||
|
||||
while (find_from < lastch)
|
||||
{
|
||||
if (num_allowed_lines <= 0)
|
||||
{
|
||||
*find_from = 0;
|
||||
strcat_s(buffer, "[...]");
|
||||
break;
|
||||
}
|
||||
|
||||
char *p = strchr(find_from, '\n');
|
||||
if (p == NULL)
|
||||
break;
|
||||
|
||||
num_allowed_lines--;
|
||||
find_from = p + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
size_t DumpBuffer :: Size() const
|
||||
{
|
||||
return strlen(buffer);
|
||||
}
|
||||
|
||||
|
||||
void DumpBuffer :: Printf( const char* format, ... )
|
||||
{
|
||||
// protect against obvious buffer overflow
|
||||
@@ -932,9 +877,6 @@ void _cdecl WinAssert(char * text, char * filename, int linenum )
|
||||
/* Copy to the clipboard */
|
||||
dump_text_to_clipboard( assertString.c_str( ) );
|
||||
|
||||
// truncate text
|
||||
truncate_message_lines(assertString, Messagebox_lines);
|
||||
|
||||
assertString += "\n[ This info is in the clipboard so you can paste it somewhere now ]\n";
|
||||
assertString += "\n\nUse Ok to break into Debugger, Cancel to exit.\n";
|
||||
val = MessageBox( NULL, assertString.c_str( ), "Assertion Failed!", MB_OKCANCEL | flags );
|
||||
@@ -946,9 +888,6 @@ void _cdecl WinAssert(char * text, char * filename, int linenum )
|
||||
DumpCallsStack( dumpBuffer ) ;
|
||||
dump_text_to_clipboard(dumpBuffer.buffer);
|
||||
|
||||
// truncate text
|
||||
dumpBuffer.TruncateLines(Messagebox_lines);
|
||||
|
||||
dumpBuffer.Printf( "\r\n[ This info is in the clipboard so you can paste it somewhere now ]\r\n" );
|
||||
dumpBuffer.Printf( "\r\n\r\nUse Ok to break into Debugger, Cancel to exit.\r\n");
|
||||
|
||||
@@ -1003,9 +942,6 @@ void _cdecl WinAssert(char * text, char * filename, int linenum, const char * fo
|
||||
/* Copy to the clipboard */
|
||||
dump_text_to_clipboard( assertString.c_str( ) );
|
||||
|
||||
// truncate text
|
||||
truncate_message_lines(assertString, Messagebox_lines);
|
||||
|
||||
assertString += "\n[ This info is in the clipboard so you can paste it somewhere now ]\n";
|
||||
assertString += "\n\nUse Ok to break into Debugger, Cancel to exit.\n";
|
||||
val = MessageBox( NULL, assertString.c_str( ), "Assertion Failed!", MB_OKCANCEL | flags );
|
||||
@@ -1017,9 +953,6 @@ void _cdecl WinAssert(char * text, char * filename, int linenum, const char * fo
|
||||
DumpCallsStack( dumpBuffer ) ;
|
||||
dump_text_to_clipboard(dumpBuffer.buffer);
|
||||
|
||||
// truncate text
|
||||
dumpBuffer.TruncateLines(Messagebox_lines);
|
||||
|
||||
dumpBuffer.Printf( "\r\n[ This info is in the clipboard so you can paste it somewhere now ]\r\n" );
|
||||
dumpBuffer.Printf( "\r\n\r\nUse Ok to break into Debugger, Cancel to exit.\r\n");
|
||||
|
||||
@@ -1123,35 +1056,12 @@ void LuaError(struct lua_State *L, char *format, ...)
|
||||
|
||||
AssertText2[0] = '\0';
|
||||
dumpBuffer.Printf(Separator);
|
||||
|
||||
// Get the stack via the debug.traceback() function
|
||||
lua_getglobal(L, LUA_DBLIBNAME);
|
||||
|
||||
if (!lua_isnil(L, -1))
|
||||
{
|
||||
dumpBuffer.Printf( "\r\n" );
|
||||
lua_getfield(L, -1, "traceback");
|
||||
lua_remove(L, -2);
|
||||
|
||||
if (lua_pcall(L, 0, 1, 0) != 0)
|
||||
dumpBuffer.Printf("Error while retrieving stack: %s", lua_tostring(L, -1));
|
||||
else
|
||||
dumpBuffer.Printf(lua_tostring(L, -1));
|
||||
|
||||
lua_pop(L, 1);
|
||||
dumpBuffer.Printf("LUA Stack:\r\n");
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (debug_stack[i][0] != '\0')
|
||||
dumpBuffer.Printf("\t%s\r\n", debug_stack[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the debug library is nil then fall back to the default debug stack
|
||||
dumpBuffer.Printf("LUA Stack:\r\n");
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (debug_stack[i][0] != '\0')
|
||||
dumpBuffer.Printf("\t%s\r\n", debug_stack[i]);
|
||||
}
|
||||
}
|
||||
dumpBuffer.Printf( "\r\n" );
|
||||
|
||||
dumpBuffer.Printf(Separator);
|
||||
ade_stackdump(L, AssertText2);
|
||||
dumpBuffer.Printf( AssertText2 );
|
||||
@@ -1160,9 +1070,6 @@ void LuaError(struct lua_State *L, char *format, ...)
|
||||
|
||||
dump_text_to_clipboard(dumpBuffer.buffer);
|
||||
|
||||
// truncate text
|
||||
dumpBuffer.TruncateLines(Messagebox_lines);
|
||||
|
||||
dumpBuffer.Printf( "\r\n[ This info is in the clipboard so you can paste it somewhere now ]\r\n" );
|
||||
dumpBuffer.Printf( "\r\n\r\nUse Yes to break into Debugger, No to continue.\r\nand Cancel to Quit");
|
||||
|
||||
@@ -1211,9 +1118,6 @@ void _cdecl Error( const char * filename, int line, const char * format, ... )
|
||||
/* Copy to the clipboard */
|
||||
dump_text_to_clipboard( assertString.c_str( ) );
|
||||
|
||||
// truncate text
|
||||
truncate_message_lines(assertString, Messagebox_lines);
|
||||
|
||||
assertString += "\n[ This info is in the clipboard so you can paste it somewhere now ]\n";
|
||||
assertString += "\n\nUse Ok to break into Debugger, Cancel to exit.\n";
|
||||
val = MessageBox( NULL, assertString.c_str( ), "Error!", flags | MB_DEFBUTTON2 | MB_OKCANCEL );
|
||||
@@ -1225,9 +1129,6 @@ void _cdecl Error( const char * filename, int line, const char * format, ... )
|
||||
DumpCallsStack( dumpBuffer ) ;
|
||||
dump_text_to_clipboard(dumpBuffer.buffer);
|
||||
|
||||
// truncate text
|
||||
dumpBuffer.TruncateLines(Messagebox_lines);
|
||||
|
||||
dumpBuffer.Printf( "\r\n[ This info is in the clipboard so you can paste it somewhere now ]\r\n" );
|
||||
dumpBuffer.Printf( "\r\n\r\nUse Ok to break into Debugger, Cancel exits.\r\n");
|
||||
|
||||
@@ -1333,9 +1234,6 @@ void _cdecl Warning( char *filename, int line, const char *format, ... )
|
||||
/* Copy to the clipboard */
|
||||
dump_text_to_clipboard( assertString.c_str( ) );
|
||||
|
||||
// truncate text
|
||||
truncate_message_lines(assertString, Messagebox_lines);
|
||||
|
||||
assertString += "\n[ This info is in the clipboard so you can paste it somewhere now ]\n";
|
||||
assertString += "\n\nUse Yes to break into Debugger, No to continue.\nand Cancel to Quit\n";
|
||||
result = MessageBox( NULL, assertString.c_str( ), "Warning!", MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONWARNING | flags );
|
||||
@@ -1350,9 +1248,6 @@ void _cdecl Warning( char *filename, int line, const char *format, ... )
|
||||
DumpCallsStack( dumpBuffer ) ;
|
||||
dump_text_to_clipboard(dumpBuffer.buffer);
|
||||
|
||||
// truncate text
|
||||
dumpBuffer.TruncateLines(Messagebox_lines);
|
||||
|
||||
dumpBuffer.Printf( "\r\n[ This info is in the clipboard so you can paste it somewhere now ]\r\n" );
|
||||
dumpBuffer.Printf("\r\n\r\nUse Yes to break into Debugger, No to continue.\r\nand Cancel to Quit");
|
||||
|
||||
|
||||
+2
-29
@@ -71,12 +71,6 @@ int gr_zbuffering = 0;
|
||||
int gr_zbuffering_mode = 0;
|
||||
int gr_global_zbuffering = 0;
|
||||
|
||||
// stencil buffer stuff
|
||||
int gr_stencil_mode = 0;
|
||||
|
||||
// alpha mask stuff
|
||||
int gr_alpha_test = 0;
|
||||
|
||||
// Default clipping distances
|
||||
const float Default_min_draw_distance = 1.0f;
|
||||
const float Default_max_draw_distance = 1e10;
|
||||
@@ -92,8 +86,6 @@ static float Gr_unsize_X = 1.0f, Gr_unsize_Y = 1.0f;
|
||||
float Gr_save_resize_X = 1.0f, Gr_save_resize_Y = 1.0f;
|
||||
float Gr_save_unsize_X = 1.0f, Gr_save_unsize_Y = 1.0f;
|
||||
|
||||
bool Save_custom_screen_size;
|
||||
|
||||
void gr_set_screen_scale(int w, int h)
|
||||
{
|
||||
Gr_resize_X = (float)gr_screen.max_w / (float)w;
|
||||
@@ -101,10 +93,6 @@ void gr_set_screen_scale(int w, int h)
|
||||
|
||||
Gr_unsize_X = (float)w / (float)gr_screen.max_w;
|
||||
Gr_unsize_Y = (float)h / (float)gr_screen.max_h;
|
||||
|
||||
Save_custom_screen_size = gr_screen.custom_size;
|
||||
|
||||
gr_screen.custom_size = true;
|
||||
}
|
||||
|
||||
void gr_set_screen_scale(int w, int h, int max_w, int max_h)
|
||||
@@ -114,10 +102,6 @@ void gr_set_screen_scale(int w, int h, int max_w, int max_h)
|
||||
|
||||
Gr_unsize_X = (float)w / (float)max_w;
|
||||
Gr_unsize_Y = (float)h / (float)max_h;
|
||||
|
||||
Save_custom_screen_size = gr_screen.custom_size;
|
||||
|
||||
gr_screen.custom_size = true;
|
||||
}
|
||||
|
||||
void gr_reset_screen_scale()
|
||||
@@ -127,8 +111,6 @@ void gr_reset_screen_scale()
|
||||
|
||||
Gr_unsize_X = Gr_save_unsize_X;
|
||||
Gr_unsize_Y = Gr_save_unsize_Y;
|
||||
|
||||
gr_screen.custom_size = Save_custom_screen_size;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,7 +259,7 @@ DCF(gr,"Changes graphics mode")
|
||||
dc_printf( "The options can be:\n" );
|
||||
dc_printf( "Macros: A=software win32 window (obsolete)\n" );
|
||||
dc_printf( " B=software directdraw fullscreen (obsolete)\n" );
|
||||
dc_printf( " G=Glide (obsolete)\n" );
|
||||
dc_printf( " G=Glide\n" );
|
||||
dc_printf( " O=OpenGL\n" );
|
||||
Dc_status = 0; // don't print status if help is printed. Too messy.
|
||||
}
|
||||
@@ -395,9 +377,6 @@ void gr_screen_resize(int width, int height)
|
||||
gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
|
||||
}
|
||||
|
||||
gr_screen.save_max_w_unscaled = gr_screen.max_w_unscaled;
|
||||
gr_screen.save_max_h_unscaled = gr_screen.max_h_unscaled;
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
extern void opengl_setup_viewport();
|
||||
opengl_setup_viewport();
|
||||
@@ -468,9 +447,6 @@ static bool gr_init_sub(int mode, int width, int height, int depth)
|
||||
gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
|
||||
}
|
||||
|
||||
gr_screen.save_max_w_unscaled = gr_screen.max_w_unscaled;
|
||||
gr_screen.save_max_h_unscaled = gr_screen.max_h_unscaled;
|
||||
|
||||
#ifdef WIN32
|
||||
// FRED doesn't need this
|
||||
if ( !Fred_running && !Is_standalone ) {
|
||||
@@ -1395,10 +1371,7 @@ void poly_list::make_index_buffer(SCP_vector<int> &vertex_list)
|
||||
// using vm_malloc() here rather than 'new' so we get the extra out-of-memory check
|
||||
nverts_good = (ubyte *) vm_malloc(n_verts);
|
||||
|
||||
Assert( nverts_good != NULL );
|
||||
if ( nverts_good == NULL )
|
||||
return;
|
||||
|
||||
Assert( nverts_good != NULL );
|
||||
memset( nverts_good, 0, n_verts );
|
||||
|
||||
vertex_list.reserve(n_verts);
|
||||
|
||||
+7
-128
@@ -27,28 +27,6 @@ extern int Gr_inited;
|
||||
extern int gr_zbuffering, gr_zbuffering_mode;
|
||||
extern int gr_global_zbuffering;
|
||||
|
||||
// Shader flags
|
||||
#define SDR_FLAG_LIGHT (1<<0)
|
||||
#define SDR_FLAG_FOG (1<<1)
|
||||
#define SDR_FLAG_DIFFUSE_MAP (1<<2)
|
||||
#define SDR_FLAG_GLOW_MAP (1<<3)
|
||||
#define SDR_FLAG_SPEC_MAP (1<<4)
|
||||
#define SDR_FLAG_NORMAL_MAP (1<<5)
|
||||
#define SDR_FLAG_HEIGHT_MAP (1<<6)
|
||||
#define SDR_FLAG_ENV_MAP (1<<7)
|
||||
#define SDR_FLAG_ANIMATED (1<<8)
|
||||
#define SDR_FLAG_SOFT_QUAD (1<<9)
|
||||
#define SDR_FLAG_DISTORTION (1<<10)
|
||||
#define SDR_FLAG_MISC_MAP (1<<11)
|
||||
#define SDR_FLAG_TEAMCOLOR (1<<12)
|
||||
#define SDR_FLAG_THRUSTER (1<<13)
|
||||
|
||||
// stencil buffering stuff
|
||||
extern int gr_stencil_mode;
|
||||
|
||||
// alpha test
|
||||
extern int gr_alpha_test;
|
||||
|
||||
/**
|
||||
* This is a structure used by the shader to keep track
|
||||
* of the values you want to use in the shade primitive.
|
||||
@@ -79,17 +57,6 @@ typedef struct color {
|
||||
int magic;
|
||||
} color;
|
||||
|
||||
// Used by the team coloring code
|
||||
typedef struct team_color {
|
||||
struct {
|
||||
float r, g, b;
|
||||
} base;
|
||||
struct {
|
||||
float r, g, b;
|
||||
} stripe;
|
||||
} team_color;
|
||||
|
||||
|
||||
|
||||
typedef struct tsb_t {
|
||||
vec3d tangent;
|
||||
@@ -142,12 +109,7 @@ struct buffer_data {
|
||||
|
||||
size_t index_offset;
|
||||
|
||||
const uint *get_index() const
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
uint i_first, i_last;
|
||||
uint *index;
|
||||
|
||||
void release()
|
||||
{
|
||||
@@ -157,26 +119,10 @@ struct buffer_data {
|
||||
}
|
||||
}
|
||||
|
||||
void assign(int i, uint j)
|
||||
buffer_data() :
|
||||
flags(0), texture(-1), n_verts(0), index_offset(0), index(NULL)
|
||||
{
|
||||
const_cast<uint *>(index)[i] = j;
|
||||
if (i_first > i_last)
|
||||
i_first = i_last = j;
|
||||
else if (i_first > j)
|
||||
i_first = j;
|
||||
else if (i_last < j)
|
||||
i_last = j;
|
||||
}
|
||||
|
||||
buffer_data(int n_vrts) :
|
||||
flags(0), texture(-1), n_verts(n_vrts), index_offset(0),
|
||||
i_first(1), i_last(0)
|
||||
{
|
||||
index = new(std::nothrow) uint[n_verts];
|
||||
}
|
||||
|
||||
private:
|
||||
uint *index;
|
||||
};
|
||||
|
||||
struct vertex_buffer {
|
||||
@@ -236,7 +182,6 @@ typedef struct screen {
|
||||
int max_w, max_h; // Width and height
|
||||
int max_w_unscaled, max_h_unscaled; // Width and height, should be 1024x768 or 640x480 in non-standard resolutions
|
||||
int save_max_w, save_max_h; // Width and height
|
||||
int save_max_w_unscaled, save_max_h_unscaled;
|
||||
int res; // GR_640 or GR_1024
|
||||
int mode; // What mode gr_init was called with.
|
||||
float aspect, clip_aspect; // Aspect ratio, aspect of clip_width/clip_height
|
||||
@@ -311,7 +256,7 @@ typedef struct screen {
|
||||
void (*gf_aabitmap)(int x, int y, bool resize, bool mirror);
|
||||
void (*gf_aabitmap_ex)(int x, int y, int w, int h, int sx, int sy, bool resize, bool mirror);
|
||||
|
||||
void (*gf_string)(int x, int y, const char * text,bool resize);
|
||||
void (*gf_string)(int x, int y, char * text,bool resize);
|
||||
|
||||
// Draw a gradient line... x1,y1 is bright, x2,y2 is transparent.
|
||||
void (*gf_gradient)(int x1, int y1, int x2, int y2, bool resize);
|
||||
@@ -362,14 +307,6 @@ typedef struct screen {
|
||||
|
||||
// Clears the zbuffer. If use_zbuffer is FALSE, then zbuffering mode is ignored and zbuffer is always off.
|
||||
void (*gf_zbuffer_clear)(int use_zbuffer);
|
||||
|
||||
// Set the stencil buffer mode. Returns previous mode
|
||||
int (*gf_stencil_set)(int mode);
|
||||
|
||||
// Clears the stencil buffer.
|
||||
void (*gf_stencil_clear)();
|
||||
|
||||
int (*gf_alpha_mask_set)(int mode, float alpha);
|
||||
|
||||
// Saves screen. Returns an id you pass to restore and free.
|
||||
int (*gf_save_screen)();
|
||||
@@ -407,9 +344,6 @@ typedef struct screen {
|
||||
// poly culling
|
||||
int (*gf_set_cull)(int cull);
|
||||
|
||||
// color buffer writes
|
||||
int (*gf_set_color_buffer)(int mode);
|
||||
|
||||
// cross fade
|
||||
void (*gf_cross_fade)(int bmap1, int bmap2, int x1, int y1, int x2, int y2, float pct);
|
||||
|
||||
@@ -428,7 +362,7 @@ typedef struct screen {
|
||||
int (*gf_bm_load)(ubyte type, int n, char *filename, CFILE *img_cfp, int *w, int *h, int *bpp, ubyte *c_type, int *mm_lvl, int *size);
|
||||
void (*gf_bm_init)(int n);
|
||||
void (*gf_bm_page_in_start)();
|
||||
int (*gf_bm_lock)(char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags, bool nodebug);
|
||||
int (*gf_bm_lock)(char *filename, int handle, int bitmapnum, ubyte bpp, ubyte flags);
|
||||
|
||||
int (*gf_bm_make_render_target)(int n, int *width, int *height, ubyte *bpp, int *mm_lvl, int flags );
|
||||
int (*gf_bm_set_render_target)(int n, int face);
|
||||
@@ -446,12 +380,6 @@ typedef struct screen {
|
||||
void (*gf_set_buffer)(int);
|
||||
void (*gf_render_buffer)(int, const vertex_buffer*, int, int);
|
||||
|
||||
int (*gf_create_stream_buffer)();
|
||||
void (*gf_update_stream_buffer)(int buffer, effect_vertex *buffer_data, uint size);
|
||||
void (*gf_render_stream_buffer)(int offset, int n_verts, int flags);
|
||||
void (*gf_render_stream_buffer_start)(int buffer_id);
|
||||
void (*gf_render_stream_buffer_end)();
|
||||
|
||||
int (*gf_make_flat_buffer)(poly_list*);
|
||||
int (*gf_make_line_buffer)(line_list*);
|
||||
|
||||
@@ -506,16 +434,6 @@ typedef struct screen {
|
||||
|
||||
void (*gf_line_htl)(vec3d *start, vec3d* end);
|
||||
void (*gf_sphere_htl)(float rad);
|
||||
|
||||
int (*gf_maybe_create_shader)(int flags);
|
||||
|
||||
void (*gf_flush_data_states)();
|
||||
|
||||
void (*gf_set_team_color)(const SCP_string &team, const SCP_string &secondaryteam, fix timestamp, int fadetime);
|
||||
void (*gf_enable_team_color)();
|
||||
void (*gf_disable_team_color)();
|
||||
|
||||
void (*gf_update_texture)(int bitmap_handle, int bpp, ubyte* data, int width, int height);
|
||||
} screen;
|
||||
|
||||
// handy macro
|
||||
@@ -551,10 +469,6 @@ extern screen gr_screen;
|
||||
#define GR_ZBUFF_READ (1<<1)
|
||||
#define GR_ZBUFF_FULL (GR_ZBUFF_WRITE|GR_ZBUFF_READ)
|
||||
|
||||
#define GR_STENCIL_NONE 0
|
||||
#define GR_STENCIL_READ 1
|
||||
#define GR_STENCIL_WRITE 2
|
||||
|
||||
void gr_set_screen_scale(int x, int y);
|
||||
void gr_set_screen_scale(int x, int y, int max_x, int max_y);
|
||||
void gr_reset_screen_scale();
|
||||
@@ -571,12 +485,7 @@ extern void _cdecl gr_printf( int x, int y, char * format, ... );
|
||||
extern void _cdecl gr_printf_no_resize( int x, int y, char * format, ... );
|
||||
|
||||
// Returns the size of the string in pixels in w and h
|
||||
extern void gr_get_string_size( int *w, int *h, const char * text, int len = 9999 );
|
||||
|
||||
__inline void gr_get_string_size( int *w, int *h, char * text, int len = 9999 )
|
||||
{
|
||||
gr_get_string_size(w, h, const_cast<const char*>(text), len);
|
||||
}
|
||||
extern void gr_get_string_size( int *w, int *h, char * text, int len = 9999 );
|
||||
|
||||
// Returns the height of the current font
|
||||
extern int gr_get_font_height();
|
||||
@@ -637,14 +546,9 @@ __inline void gr_bitmap_ex(int x, int y, int w, int h, int sx, int sy, bool resi
|
||||
void gr_rect(int x, int y, int w, int h, bool resize = true);
|
||||
void gr_shade(int x, int y, int w, int h, bool resize = true);
|
||||
|
||||
__inline void gr_string(int x, int y, const char* string, bool resize = true)
|
||||
{
|
||||
(*gr_screen.gf_string)(x,y,string,resize);
|
||||
}
|
||||
|
||||
__inline void gr_string(int x, int y, char* string, bool resize = true)
|
||||
{
|
||||
(*gr_screen.gf_string)(x,y,const_cast<char*>(string),resize);
|
||||
(*gr_screen.gf_string)(x,y,string,resize);
|
||||
}
|
||||
|
||||
__inline void gr_circle(int xc, int yc, int d, bool resize = true)
|
||||
@@ -684,11 +588,6 @@ __inline void gr_gradient(int x1, int y1, int x2, int y2, bool resize = true)
|
||||
#define gr_zbuffer_set GR_CALL(gr_screen.gf_zbuffer_set)
|
||||
#define gr_zbuffer_clear GR_CALL(gr_screen.gf_zbuffer_clear)
|
||||
|
||||
#define gr_stencil_set GR_CALL(gr_screen.gf_stencil_set)
|
||||
#define gr_stencil_clear GR_CALL(gr_screen.gf_stencil_clear)
|
||||
|
||||
#define gr_alpha_mask_set GR_CALL(gr_screen.gf_alpha_mask_set)
|
||||
|
||||
#define gr_save_screen GR_CALL(gr_screen.gf_save_screen)
|
||||
#define gr_restore_screen GR_CALL(gr_screen.gf_restore_screen)
|
||||
#define gr_free_screen GR_CALL(gr_screen.gf_free_screen)
|
||||
@@ -707,7 +606,6 @@ __inline void gr_fog_set(int fog_mode, int r, int g, int b, float fog_near = -1.
|
||||
}
|
||||
|
||||
#define gr_set_cull GR_CALL(gr_screen.gf_set_cull)
|
||||
#define gr_set_color_buffer GR_CALL(gr_screen.gf_set_color_buffer)
|
||||
|
||||
#define gr_cross_fade GR_CALL(gr_screen.gf_cross_fade)
|
||||
|
||||
@@ -754,12 +652,6 @@ __inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi
|
||||
(*gr_screen.gf_render_buffer)(start, bufferp, texi, flags);
|
||||
}
|
||||
|
||||
#define gr_create_stream_buffer GR_CALL(*gr_screen.gf_create_stream_buffer)
|
||||
#define gr_update_stream_buffer GR_CALL(*gr_screen.gf_update_stream_buffer)
|
||||
#define gr_render_stream_buffer GR_CALL(*gr_screen.gf_render_stream_buffer)
|
||||
#define gr_render_stream_buffer_start GR_CALL(*gr_screen.gf_render_stream_buffer_start)
|
||||
#define gr_render_stream_buffer_end GR_CALL(*gr_screen.gf_render_stream_buffer_end)
|
||||
|
||||
#define gr_set_buffer GR_CALL(*gr_screen.gf_set_buffer)
|
||||
|
||||
#define gr_make_flat_buffer GR_CALL(*gr_screen.gf_make_flat_buffer)
|
||||
@@ -814,15 +706,6 @@ __inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi
|
||||
#define gr_line_htl GR_CALL(*gr_screen.gf_line_htl)
|
||||
#define gr_sphere_htl GR_CALL(*gr_screen.gf_sphere_htl)
|
||||
|
||||
#define gr_maybe_create_shader GR_CALL(*gr_screen.gf_maybe_create_shader)
|
||||
|
||||
#define gr_flush_data_states GR_CALL(*gr_screen.gf_flush_data_states)
|
||||
|
||||
#define gr_set_team_color GR_CALL(*gr_screen.gf_set_team_color)
|
||||
#define gr_disable_team_color GR_CALL(*gr_screen.gf_disable_team_color)
|
||||
|
||||
#define gr_update_texture GR_CALL(*gr_screen.gf_update_texture)
|
||||
|
||||
// color functions
|
||||
void gr_get_color( int *r, int *g, int b );
|
||||
void gr_init_color(color *c, int r, int g, int b);
|
||||
@@ -840,10 +723,6 @@ void gr_bitmap_uv(int _x, int _y, int _w, int _h, float _u0, float _v0, float _u
|
||||
void gr_bitmap_list(bitmap_2d_list* list, int n_bm, bool allow_scaling);
|
||||
void gr_bitmap_list(bitmap_rect_list* list, int n_bm, bool allow_scaling);
|
||||
|
||||
// texture update functions
|
||||
ubyte* gr_opengl_get_texture_update_pointer(int bitmap_handle);
|
||||
void gr_opengl_update_texture(int bitmap_handle, int bpp, ubyte* data, int width, int height);
|
||||
|
||||
// special function for drawing polylines. this function is specifically intended for
|
||||
// polylines where each section is no more than 90 degrees away from a previous section.
|
||||
// Moreover, it is _really_ intended for use with 45 degree angles.
|
||||
|
||||
@@ -110,7 +110,7 @@ int get_char_width(ubyte c1,ubyte c2,int *width,int *spacing)
|
||||
}
|
||||
|
||||
// NOTE: this returns an unscaled size for non-standard resolutions
|
||||
int get_centered_x(const char *s)
|
||||
int get_centered_x(char *s)
|
||||
{
|
||||
int w,w2,s2;
|
||||
|
||||
@@ -140,17 +140,15 @@ void gr_char_centered(int x, int y, char chr)
|
||||
gr_string(x - w / 2, y, str);
|
||||
}
|
||||
|
||||
void gr_print_timestamp(int x, int y, fix timestamp)
|
||||
void gr_print_timestamp(int x, int y, int timestamp)
|
||||
{
|
||||
char h[2], m[3], s[3];
|
||||
int w, c;
|
||||
|
||||
int time = (int)f2fl(timestamp); // convert to seconds
|
||||
|
||||
// format the time information into strings
|
||||
sprintf(h, "%.1d", (time / 3600));
|
||||
sprintf(m, "%.2d", (time / 60) % 60);
|
||||
sprintf(s, "%.2d", time % 60);
|
||||
sprintf(h, "%.1d", (timestamp / 3600000) % 10);
|
||||
sprintf(m, "%.2d", (timestamp / 60000) % 60);
|
||||
sprintf(s, "%.2d", (timestamp / 1000) % 60);
|
||||
|
||||
gr_get_string_size(&w, NULL, "0");
|
||||
gr_get_string_size(&c, NULL, ":");
|
||||
@@ -179,7 +177,7 @@ int gr_get_font_height()
|
||||
}
|
||||
}
|
||||
|
||||
void gr_get_string_size(int *w1, int *h1, const char *text, int len)
|
||||
void gr_get_string_size(int *w1, int *h1, char *text, int len)
|
||||
{
|
||||
int longest_width;
|
||||
int width,spacing;
|
||||
|
||||
@@ -72,13 +72,13 @@ extern int gr_get_current_fontnum();
|
||||
extern int gr_get_fontnum(char *filename);
|
||||
extern void gr_set_font(int fontnum);
|
||||
|
||||
void gr_print_timestamp(int x, int y, fix timestamp);
|
||||
void gr_print_timestamp(int x, int y, int timestamp);
|
||||
char *gr_force_fit_string(char *str, int max_str, int max_width);
|
||||
void gr_font_init();
|
||||
void gr_font_close();
|
||||
|
||||
extern font *Current_font;
|
||||
extern int get_char_width(ubyte c1,ubyte c2,int *width,int *spacing);
|
||||
extern int get_centered_x(const char *s);
|
||||
extern int get_centered_x(char *s);
|
||||
|
||||
#endif
|
||||
+30
-90
@@ -21,7 +21,7 @@
|
||||
#define ANI_BPP_CHECK (ga->ani.bg_type == BM_TYPE_PCX) ? 16 : 32
|
||||
|
||||
// Goober5000
|
||||
int generic_anim_init_and_stream(generic_anim *anim, const char *anim_filename, ubyte bg_type, bool attempt_hi_res)
|
||||
int generic_anim_init_and_stream(generic_anim *anim, char *anim_filename, ubyte bg_type, bool attempt_hi_res)
|
||||
{
|
||||
int stream_result = -1;
|
||||
char filename[NAME_LENGTH];
|
||||
@@ -69,18 +69,15 @@ int generic_anim_init_and_stream(generic_anim *anim, const char *anim_filename,
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
void generic_anim_init(generic_anim *ga)
|
||||
void generic_anim_init(generic_anim *ga, char *filename)
|
||||
{
|
||||
generic_anim_init(ga, NULL);
|
||||
}
|
||||
//memset(ga, 0, sizeof(ga)); //this makes the mission load screen crash :(
|
||||
if (filename == NULL) {
|
||||
ga->filename[0] = '\0';
|
||||
} else {
|
||||
strncpy(ga->filename, filename, MAX_FILENAME_LEN - 1);
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
void generic_anim_init(generic_anim *ga, const char *filename)
|
||||
{
|
||||
if (filename != NULL)
|
||||
strcpy_s(ga->filename, filename);
|
||||
else
|
||||
memset(ga->filename, 0, MAX_FILENAME_LEN);
|
||||
ga->first_frame = -1;
|
||||
ga->num_frames = 0;
|
||||
ga->keyframe = 0;
|
||||
@@ -102,18 +99,17 @@ void generic_anim_init(generic_anim *ga, const char *filename)
|
||||
ga->height = 0;
|
||||
ga->width = 0;
|
||||
ga->bitmap_id = -1;
|
||||
ga->use_hud_color = false;
|
||||
}
|
||||
|
||||
// CommanderDJ - same as generic_anim_init, just with an SCP_string
|
||||
/**
|
||||
* CommanderDJ - same as generic_anim_init, just with an SCP_string
|
||||
*/
|
||||
void generic_anim_init(generic_anim *ga, const SCP_string& filename)
|
||||
{
|
||||
generic_anim_init(ga);
|
||||
filename.copy(ga->filename, MAX_FILENAME_LEN - 1);
|
||||
generic_anim_init(ga, const_cast<char*> (filename.c_str()));
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
void generic_bitmap_init(generic_bitmap *gb, const char *filename)
|
||||
void generic_bitmap_init(generic_bitmap *gb, char *filename)
|
||||
{
|
||||
if (filename == NULL) {
|
||||
gb->filename[0] = '\0';
|
||||
@@ -185,8 +181,6 @@ int generic_anim_stream(generic_anim *ga)
|
||||
//TODO: add streaming EFF
|
||||
if(ga->type == BM_TYPE_ANI) {
|
||||
bpp = ANI_BPP_CHECK;
|
||||
if(ga->use_hud_color)
|
||||
bpp = 8;
|
||||
ga->ani.animation = anim_load(ga->filename, CF_TYPE_ANY, 0);
|
||||
ga->ani.instance = init_anim_instance(ga->ani.animation, bpp);
|
||||
|
||||
@@ -200,7 +194,7 @@ int generic_anim_stream(generic_anim *ga)
|
||||
ga->height = ga->ani.animation->height;
|
||||
ga->width = ga->ani.animation->width;
|
||||
ga->buffer = ga->ani.instance->frame;
|
||||
ga->bitmap_id = bm_create(bpp, ga->width, ga->height, ga->buffer, (bpp==8)?BMP_AABITMAP:0);
|
||||
ga->bitmap_id = bm_create(bpp, ga->width, ga->height, ga->buffer, 0);
|
||||
ga->ani.instance->last_bitmap = -1;
|
||||
|
||||
ga->ani.instance->file_offset = ga->ani.animation->file_offset;
|
||||
@@ -209,24 +203,8 @@ int generic_anim_stream(generic_anim *ga)
|
||||
ga->previous_frame = -1;
|
||||
}
|
||||
else {
|
||||
bpp = 32;
|
||||
if(ga->use_hud_color)
|
||||
bpp = 8;
|
||||
bm_load_and_parse_eff(ga->filename, CF_TYPE_ANY, &ga->num_frames, &anim_fps, &ga->keyframe, 0);
|
||||
char *p = strrchr( ga->filename, '.' );
|
||||
if ( p )
|
||||
*p = 0;
|
||||
char frame_name[32];
|
||||
snprintf(frame_name, 32, "%s_0000", ga->filename);
|
||||
ga->bitmap_id = bm_load(frame_name);
|
||||
if(ga->bitmap_id < 0) {
|
||||
mprintf(("Cannot find first frame for eff streaming. eff Filename: %s", ga->filename));
|
||||
return -1;
|
||||
}
|
||||
snprintf(frame_name, 32, "%s_0001", ga->filename);
|
||||
ga->eff.next_frame = bm_load(frame_name);
|
||||
bm_get_info(ga->bitmap_id, &ga->width, &ga->height);
|
||||
ga->previous_frame = 0;
|
||||
//placeholder until we get eff streaming working
|
||||
return generic_anim_load(ga);
|
||||
}
|
||||
|
||||
// keyframe info
|
||||
@@ -253,6 +231,9 @@ int generic_anim_stream(generic_anim *ga)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// EFF not handled yet; code shouldn't get here anyway per above block
|
||||
}
|
||||
|
||||
ga->streaming = 1;
|
||||
|
||||
@@ -285,12 +266,6 @@ void generic_anim_unload(generic_anim *ga)
|
||||
anim_free(ga->ani.animation);
|
||||
free_anim_instance(ga->ani.instance);
|
||||
}
|
||||
if(ga->type == BM_TYPE_EFF) {
|
||||
if(ga->eff.next_frame >= 0)
|
||||
bm_release(ga->eff.next_frame);
|
||||
if(ga->bitmap_id >= 0)
|
||||
bm_release(ga->bitmap_id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//trying to release the first frame will release ALL frames
|
||||
@@ -304,43 +279,11 @@ void generic_anim_unload(generic_anim *ga)
|
||||
}
|
||||
|
||||
//for timer debug, #define TIMER
|
||||
void generic_render_eff_stream(generic_anim *ga)
|
||||
{
|
||||
if(ga->current_frame == ga->previous_frame)
|
||||
return;
|
||||
ubyte bpp = 32;
|
||||
if(ga->use_hud_color)
|
||||
bpp = 8;
|
||||
#ifdef TIMER
|
||||
int start_time = timer_get_fixed_seconds();
|
||||
#endif
|
||||
|
||||
#ifdef TIMER
|
||||
mprintf(("=========================\n"));
|
||||
mprintf(("frame: %d\n", ga->current_frame));
|
||||
#endif
|
||||
char frame_name[32];
|
||||
snprintf(frame_name, 32, "%s_%.4d", ga->filename, ga->current_frame);
|
||||
if(bm_reload(ga->eff.next_frame, frame_name) == ga->eff.next_frame)
|
||||
{
|
||||
bitmap* next_frame_bmp = bm_lock(ga->eff.next_frame, bpp, (bpp==8)?BMP_AABITMAP:BMP_TEX_NONCOMP, true);
|
||||
if(next_frame_bmp->data)
|
||||
gr_update_texture(ga->bitmap_id, bpp, (ubyte*)next_frame_bmp->data, ga->width, ga->height);
|
||||
bm_unlock(ga->eff.next_frame);
|
||||
bm_unload(ga->eff.next_frame, 0, true);
|
||||
}
|
||||
#ifdef TIMER
|
||||
mprintf(("end: %d\n", timer_get_fixed_seconds() - start_time));
|
||||
mprintf(("=========================\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void generic_render_ani_stream(generic_anim *ga)
|
||||
{
|
||||
int i;
|
||||
int bpp = ANI_BPP_CHECK;
|
||||
if(ga->use_hud_color)
|
||||
bpp = 8;
|
||||
|
||||
#ifdef TIMER
|
||||
int start_time = timer_get_fixed_seconds();
|
||||
#endif
|
||||
@@ -364,10 +307,10 @@ void generic_render_ani_stream(generic_anim *ga)
|
||||
ga->ani.instance->data = ga->ani.animation->data + ga->ani.animation->keys[ga->current_frame].offset;
|
||||
}
|
||||
if(ga->ani.animation->flags & ANF_STREAMED) {
|
||||
ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
|
||||
ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, 0, bpp);
|
||||
}
|
||||
else {
|
||||
ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
|
||||
ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, 0, bpp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -395,18 +338,20 @@ void generic_render_ani_stream(generic_anim *ga)
|
||||
#endif
|
||||
for(i = ga->previous_frame + 1; i <= ga->current_frame; i++) {
|
||||
if(ga->ani.animation->flags & ANF_STREAMED) {
|
||||
ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
|
||||
ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, 0, bpp);
|
||||
}
|
||||
else {
|
||||
ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
|
||||
ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, 0, bpp);
|
||||
}
|
||||
}
|
||||
}
|
||||
// always go back to screen format
|
||||
BM_SELECT_SCREEN_FORMAT();
|
||||
//we need to use this because performance is worse if we flush the gfx card buffer
|
||||
|
||||
gr_update_texture(ga->bitmap_id, bpp, ga->buffer, ga->width, ga->height);
|
||||
if ( ga->ani.instance->last_bitmap != -1 ){
|
||||
bm_release(ga->ani.instance->last_bitmap);
|
||||
}
|
||||
ga->bitmap_id = bm_create(bpp, ga->width, ga->height, ga->buffer, 0);
|
||||
|
||||
//in case we want to check that the frame is actually changing
|
||||
//mprintf(("frame crc = %08X\n", cf_add_chksum_long(0, ga->buffer, ga->width * ga->height * (bpp >> 3))));
|
||||
@@ -453,7 +398,7 @@ void generic_anim_render(generic_anim *ga, float frametime, int x, int y)
|
||||
if(ga->direction & GENERIC_ANIM_DIRECTION_NOLOOP) {
|
||||
ga->anim_time = ga->total_time - 0.001f; //stop on last frame when playing - if it's equal we jump to the first frame
|
||||
}
|
||||
if(!ga->done_playing){
|
||||
else if(!ga->done_playing){
|
||||
//we've played this at least once
|
||||
ga->done_playing = 1;
|
||||
}
|
||||
@@ -477,8 +422,6 @@ void generic_anim_render(generic_anim *ga, float frametime, int x, int y)
|
||||
//TODO: add EFF streaming
|
||||
if(ga->type == BM_TYPE_ANI) {
|
||||
generic_render_ani_stream(ga);
|
||||
} else {
|
||||
generic_render_eff_stream(ga);
|
||||
}
|
||||
gr_set_bitmap(ga->bitmap_id);
|
||||
}
|
||||
@@ -486,9 +429,6 @@ void generic_anim_render(generic_anim *ga, float frametime, int x, int y)
|
||||
gr_set_bitmap(ga->first_frame + ga->current_frame);
|
||||
}
|
||||
ga->previous_frame = ga->current_frame;
|
||||
if(ga->use_hud_color)
|
||||
gr_aabitmap(x,y);
|
||||
else
|
||||
gr_bitmap(x,y);
|
||||
gr_bitmap(x, y);
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,9 @@ typedef struct generic_anim {
|
||||
anim_instance *instance;
|
||||
unsigned char bg_type; //to store background type to avoid messed up colours
|
||||
} ani;
|
||||
//reserved for eff streaming
|
||||
struct {
|
||||
int next_frame;
|
||||
//
|
||||
} eff;
|
||||
};
|
||||
ubyte type;
|
||||
@@ -43,7 +44,6 @@ typedef struct generic_anim {
|
||||
int height;
|
||||
int width;
|
||||
int bitmap_id;
|
||||
bool use_hud_color;
|
||||
} generic_anim;
|
||||
|
||||
// Goober5000
|
||||
@@ -52,11 +52,10 @@ typedef struct generic_bitmap {
|
||||
int bitmap_id;
|
||||
} generic_bitmap;
|
||||
|
||||
int generic_anim_init_and_stream(generic_anim *anim, const char *anim_filename, ubyte bg_type, bool attempt_hi_res);
|
||||
void generic_anim_init(generic_anim *ga);
|
||||
void generic_anim_init(generic_anim *ga, const char *filename);
|
||||
int generic_anim_init_and_stream(generic_anim *anim, char *anim_filename, ubyte bg_type, bool attempt_hi_res);
|
||||
void generic_anim_init(generic_anim *ga, char *filename = NULL);
|
||||
void generic_anim_init(generic_anim *ga, const SCP_string& filename);
|
||||
void generic_bitmap_init(generic_bitmap *gb, const char *filename = NULL);
|
||||
void generic_bitmap_init(generic_bitmap *gb, char *filename = NULL);
|
||||
int generic_anim_load(generic_anim *ga);
|
||||
int generic_anim_stream(generic_anim *ga);
|
||||
int generic_bitmap_load(generic_bitmap *gb);
|
||||
|
||||
Loaded 100 of 388 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user