Compare commits

...
63 Commits
Author SHA1 Message Date
Swifty 3d680e1431 Merge with Trunk Revision 6640. 2010-10-19 22:49:15 +00:00
Swifty 3ef2dc8134 Unversioned files can go to hell. 2010-10-19 07:22:33 +00:00
Swifty dd2c182a60 Merge with Trunk Revision 6635. Prepped for Antipodes 7. 2010-10-19 07:14:36 +00:00
Swifty 7c5756996c Revision of animated cockpit readouts. Removed training_obj_display(). 2010-10-09 10:35:20 +00:00
Swifty e606278ce6 Update changes up to Trunk 6586 2010-10-09 10:09:48 +00:00
Swifty 182ed7f9c7 And while we're on targetbox bugs, Asteroid target status should now render in the proper place in non-GR rez. 2010-09-21 02:48:56 +00:00
Swifty 4870b2fc9e Targetbox cargo of target ship no longer carries over to the next selected non-ship target. 2010-09-21 02:45:50 +00:00
Swifty 586e514874 No more crashing when scanning subsystems. 2010-09-21 02:42:20 +00:00
Swifty 202bd88392 Revision 6473 2010-09-20 20:34:57 +00:00
Swifty 96e4fe4b6e Forgot to include options for Wing Names in Wingman Status. 2010-09-04 10:30:01 +00:00
Swifty 2e8a5a2692 Fixed Training Messages not playing when hud_disabled_except_messages() is on. Fixes War in Heaven's credits sequence. 2010-09-04 02:54:58 +00:00
Swifty 02c7fc1c89 Fixed Wingman Status gauge to properly allow changing of status bitmaps. 2010-09-02 05:30:48 +00:00
Swifty 74ac243ae1 Squished Int3() when using BSG radar. 2010-09-01 04:07:37 +00:00
Swifty 8609816c7c Project file updates. Adding bitarray.h and excluding debug info. 2010-09-01 01:55:46 +00:00
Swifty 15f365b09f I haz 6410 2010-09-01 01:53:27 +00:00
Swifty 9292ebf2c9 Fixed a bunch of stuff reported by swashmebuckle: wingman anis can now change, Integrity Bar Foreground Clip Height fixed, extra target data time inits fixed. 2010-08-31 23:50:15 +00:00
Swifty a04089e8a9 Making FUBAR's life easier; parts of wxFred slipped past WinMerge. 2010-08-28 05:41:09 +00:00
Swifty 6bc3f565dd +Radar: no longer forces standard radar and will defer to orb radar launcher flags. 2010-08-27 11:45:03 +00:00
Swifty b94023a86f omfg, HUD-specific, ship-specific, and gauge-specific fonts. 2010-08-27 11:34:38 +00:00
Swifty edc8b93a64 Up 2 d8 with 6385 2010-08-26 09:08:08 +00:00
Swifty 93381a2061 Go go gadget radar range! 2010-08-26 08:26:29 +00:00
Swifty 7c6c19a162 Targetbox bitmaps should listen now. 2010-08-26 08:17:31 +00:00
Swifty e399f53251 There are 6 wingmen dots, not 7. :| 2010-08-26 08:08:29 +00:00
Swifty e62b09cdfd Fix Weapon List parsing for "Secondary List Entry Background:" and "Secondary List Bottom Background Filename:" 2010-08-26 07:37:12 +00:00
Swifty 4c6ffd1650 Force parser to advance past $Reticle Style. Forgot to put FS1-style defaults for Weapon Energy. 2010-08-16 05:38:05 +00:00
Swifty 93fcc4b8db Various syntax corrections 2010-08-15 04:00:47 +00:00
Swifty d87ad46bd0 Minor change to Damage display syntax for the sake of consistency. 2010-08-15 01:05:49 +00:00
Swifty 3314903dda A shitload of table configuration fields for almost all individual gauges. Documentation pending. :\ 2010-08-14 23:49:35 +00:00
Swifty 045b7fc264 Adding initSlew method to the base HudGauge class. 2010-08-14 23:43:16 +00:00
Swifty c99704efe4 Removing a redundant property from Wingman Status. 2010-08-14 23:39:41 +00:00
Swifty 015b1a6309 Renaming a targetbox property to something that fits better. 2010-08-14 23:36:03 +00:00
Swifty 7871c4f146 Simplify and clarify some Escort display parameters. 2010-08-14 23:31:11 +00:00
Swifty ddc4d51999 hud_disabled_except_messages should work now, even if hud_disabled is on. 2010-08-13 10:44:39 +00:00
Swifty 7e3e0a9388 Tweaked the weapons display to better match retail positions. 2010-08-13 10:40:23 +00:00
Swifty 9f6d4533f8 Squished comm menu bug where menu would not be populated if no target is selected. Sorry this took so long, The_E. 2010-08-13 08:56:57 +00:00
Swifty 090ea8ad50 An additional tweak to the directives gauge. 2010-08-13 08:31:55 +00:00
Swifty fdf05d7e80 Simplifying the directives gauge. 2010-08-13 08:27:14 +00:00
Swifty dbc87e4241 Probably should get rid of these vars as well. 2010-08-13 08:19:57 +00:00
Swifty cbef6291cd Getting rid of Split Missile Triangles. 2010-08-13 08:16:35 +00:00
Swifty 5a2bd299c2 Huh. It turns out the correct behavior for Talking Heads is to play once and not loop. Yay for one line fixes. 2010-08-13 06:46:07 +00:00
Swifty 1daa233fe4 Updating XCode project files. 2010-08-11 23:19:25 +00:00
Swifty b03cbff4d1 No more disappearing or 1 micrometer-sized sub-object target brackets. 2010-08-11 19:36:42 +00:00
Swifty 773bf8b983 Bring this up to speed with r6354. 2010-08-11 19:31:30 +00:00
Swifty 9421ab2fba Warheads no longer show up as black on standard and orb radar. 2010-07-29 12:10:51 +00:00
Swifty 669ea48153 Message sender, remote detonation missile, homing missile, and selection set brackets should have the proper gradients now. 2010-07-29 03:42:58 +00:00
Swifty 4995f11472 I yet again forget to do something. Updating the Lua libraries. 2010-07-29 03:40:59 +00:00
Swifty 6b884151bc Sorry in advance for any conflicts with your project files. Forgot to unselect my project files. >_< 2010-07-25 14:36:24 +00:00
Swifty 4c91519648 Sync with Trunk 6325 2010-07-25 14:18:19 +00:00
Swifty e3c095684b Reported by Backslash. Fixed FS1 Weapon Linking gauge color and head view movements. 2010-07-17 02:13:10 +00:00
Swifty 591904644d This should fix the Int3() that appears when using the Orb Radar. 2010-07-16 02:48:17 +00:00
Swifty c4d8a64a74 Lead sight should work properly now. 2010-07-16 00:20:09 +00:00
Swifty 0b1ea699bb Sync with trunk 6250, including fix for Mantis 1888. 2010-06-22 05:18:14 +00:00
Swifty b88d75efb8 Forgot to add bitarray.h 2010-06-21 19:45:49 +00:00
Swifty 96ca7b1ffe Core files for BSG radar. 2010-06-21 10:00:09 +00:00
Swifty 563b113c68 Experimental Diaspora stuff. 2010-06-21 09:22:05 +00:00
Swifty 112c1c4dfe Sync with trunk 6238. 2010-06-21 08:38:02 +00:00
Swifty 77a63521e4 Fix Supernova gauge. 2010-06-17 09:02:42 +00:00
Swifty 6b3ee7cfb7 The_E: Fix cargo scanning for Target Box gauge. 2010-06-17 08:18:38 +00:00
Swifty 549c76c137 The_E: Include support for growing Wingman Status gauge dots to a different direction. 2010-06-17 08:14:14 +00:00
Swifty c185dab59c Forgot to include parse entrypoint for the Weapon Linking gauge. Fix Training Messages to render at the correct user-defined scale. 2010-06-11 03:42:26 +00:00
Swifty 60f201d1df Initial check in for new HUD code. 2010-06-10 05:29:57 +00:00
Swifty 225c8ece25 Merge with trunk r6199 2010-06-10 04:08:23 +00:00
Goober5000 75d680483a 2010-04-04 19:27:43 +00:00
392 changed files with 82283 additions and 49750 deletions

No files matched your search

+2 -2
View File
@@ -49,7 +49,7 @@ DIE=0
DIE=1
}
for AM in automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake; do
for AM in automake-1.11 automake-1.10 automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake; do
(check_version "$AM" 1 6 1) && {
AUTOMAKE="$AM"
break
@@ -67,7 +67,7 @@ fi
# if no automake, don't bother testing for aclocal
test -z "$AUTOMAKE" || {
for ACL in aclocal-1.9 aclocal-1.8 aclocal-1.7 aclocal-1.6 aclocal; do
for ACL in aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal-1.8 aclocal-1.7 aclocal-1.6 aclocal; do
(check_version "$ACL" 1 6 1) && {
ACLOCAL="$ACL"
break
+34 -43
View File
@@ -258,8 +258,6 @@ FS2_SOURCES = \
debugconsole/dbugfile.h \
debugconsole/timerbar.cpp \
debugconsole/timerbar.h \
decals/decals.cpp \
decals/decals.h \
demo/demo.cpp \
demo/demo.h \
exceptionhandler/exceptionhandler.cpp \
@@ -283,12 +281,18 @@ FS2_SOURCES = \
gamehelp/gameplayhelp.h \
gamesequence/gamesequence.cpp \
gamesequence/gamesequence.h \
gamesnd/eventmusic.cpp \
gamesnd/eventmusic.h \
gamesnd/gamesnd.cpp \
gamesnd/gamesnd.h \
globalincs/alphacolors.cpp \
globalincs/alphacolors.h \
globalincs/crypt.cpp \
globalincs/crypt.h \
globalincs/def_files.cpp \
globalincs/def_files.h \
globalincs/fsmemory.cpp \
globalincs/fsmemory.h \
globalincs/globals.h \
globalincs/linklist.h \
globalincs/pstypes.h \
@@ -572,6 +576,8 @@ FS2_SOURCES = \
object/object.h \
object/objectshield.cpp \
object/objectshield.h \
object/objectsnd.cpp \
object/objectsnd.h \
object/objectsort.cpp \
object/parseobjectdock.cpp \
object/parseobjectdock.h \
@@ -634,6 +640,30 @@ FS2_SOURCES = \
ship/shiphit.cpp \
ship/shiphit.h \
ship/subsysdamage.h \
sound/audiostr.cpp \
sound/audiostr.h \
sound/acm.cpp \
sound/acm.h \
sound/ds.cpp \
sound/ds.h \
sound/ds3d.cpp \
sound/ds3d.h \
sound/dscap.cpp \
sound/dscap.h \
sound/fsspeech.cpp \
sound/fsspeech.h \
sound/openal.cpp \
sound/openal.h \
sound/rtvoice.cpp \
sound/rtvoice.h \
sound/sound.cpp \
sound/sound.h \
sound/speech.cpp \
sound/speech.h \
sound/voicerec.cpp \
sound/voicerec.h \
sound/ogg/ogg.cpp \
sound/ogg/ogg.h \
species_defs/species_defs.cpp \
species_defs/species_defs.h \
starfield/nebula.cpp \
@@ -707,44 +737,6 @@ JOY_SOURCES = \
io/joy-unix.cpp
endif
## sound support sources
if FS2_SOUND
SOUND_SOURCES = \
gamesnd/eventmusic.cpp \
gamesnd/eventmusic.h \
gamesnd/gamesnd.cpp \
gamesnd/gamesnd.h \
object/objectsnd.cpp \
object/objectsnd.h \
sound/ogg/ogg.cpp \
sound/ogg/ogg.h \
sound/audiostr-openal.cpp \
sound/audiostr.cpp \
sound/audiostr.h \
sound/acm-openal.cpp \
sound/acm.h \
sound/ds.cpp \
sound/ds.h \
sound/ds3d.cpp \
sound/ds3d.h \
sound/dscap.cpp \
sound/dscap.h \
sound/rbaudio.cpp \
sound/rbaudio.h \
sound/rtvoice.cpp \
sound/rtvoice.h \
sound/sound.cpp \
sound/sound.h \
vcodec/codec1.cpp \
vcodec/codec1.h \
sound/fsspeech.cpp \
sound/fsspeech.h \
sound/speech.cpp \
sound/speech.h \
sound/voicerec.cpp \
sound/voicerec.h
endif
## Win32-specific sources
if FS2_OS_WIN32
WIN32_SOURCES = \
@@ -755,7 +747,6 @@ WIN32_SOURCES = \
directx/vdplay.h \
directx/vdplobby.h \
directx/vdsetup.h \
directx/vdsound.h \
directx/vdvp.h \
globalincs/windebug.cpp \
graphics/gl/GLAUX.H \
@@ -787,8 +778,8 @@ endif
## libcode.a
libcode_a_SOURCES = ${FS2_SOURCES} ${JOY_SOURCES} ${SOUND_SOURCES} \
${WIN32_SOURCES} ${UNIX_SOURCES}
libcode_a_SOURCES = ${FS2_SOURCES} ${JOY_SOURCES} ${WIN32_SOURCES} \
${UNIX_SOURCES}
##
## End CODE library
+1 -1
View File
@@ -88,7 +88,7 @@ char *ai_get_goal_ship_name(char *name, int *index)
}
Assert(Total_goal_ship_names < MAX_GOAL_SHIP_NAMES);
Assert(strlen(name) < NAME_LENGTH - 1);
Assertion(strlen(name) < NAME_LENGTH - 1, "Ship name %s is too long. Needs to be 31 characters or less.", name);
i = Total_goal_ship_names++;
strcpy_s(Goal_ship_names[i], name);
*index = i;
+13
View File
@@ -21,6 +21,7 @@
struct ship_weapon;
struct ship_subsys;
struct object;
struct ship_info;
#define AI_DEFAULT_CLASS 3 // default AI class for new ships (Fred)
@@ -205,12 +206,16 @@ typedef struct ai_class {
float ai_glide_attack_percent[NUM_SKILL_LEVELS];
float ai_circle_strafe_percent[NUM_SKILL_LEVELS];
float ai_glide_strafe_percent[NUM_SKILL_LEVELS];
float ai_random_sidethrust_percent[NUM_SKILL_LEVELS];
float ai_stalemate_time_thresh[NUM_SKILL_LEVELS];
float ai_stalemate_dist_thresh[NUM_SKILL_LEVELS];
int ai_chance_to_use_missiles_on_plr[NUM_SKILL_LEVELS];
float ai_max_aim_update_delay[NUM_SKILL_LEVELS];
float ai_turret_max_aim_update_delay[NUM_SKILL_LEVELS];
int ai_profile_flags; //Holds the state of flags that are set
int ai_profile_flags_set; //Holds which flags are set and which are just left alone
int ai_profile_flags2;
int ai_profile_flags2_set;
//SUSHI: These are optional overrides to an AI class to prevent the automatic scaling based on AI class index
int ai_aburn_use_factor[NUM_SKILL_LEVELS];
@@ -435,11 +440,14 @@ typedef struct ai_info {
float ai_glide_attack_percent;
float ai_circle_strafe_percent;
float ai_glide_strafe_percent;
float ai_random_sidethrust_percent;
float ai_stalemate_time_thresh;
float ai_stalemate_dist_thresh;
int ai_chance_to_use_missiles_on_plr;
float ai_max_aim_update_delay;
float ai_turret_max_aim_update_delay;
int ai_profile_flags; //Holds AI_Profiles flags (possibly overriden by AI class) that actually apply to AI
int ai_profile_flags2;
union {
@@ -632,6 +640,7 @@ extern ship_subsys *set_targeted_subsys(ai_info *aip, ship_subsys *new_subsys, i
extern void ai_rearm_repair( object *objp, int docker_index, object *goal_objp, int dockee_index );
extern void ai_add_rearm_goal( object *requester_objp, object *support_objp );
extern void create_model_path(object *pl_objp, object *mobjp, int path_num, int subsys_path=0);
extern int ai_find_goal_index( ai_goal* aigp, int mode, int submode = -1, int priority = -1 );
// Goober5000
extern void ai_do_safety(object *objp);
@@ -694,4 +703,8 @@ void init_aip_from_class_and_profile(ai_info *aip, ai_class *aicp, ai_profile_t
//SUSHI: Updating AI aim
void ai_update_aim(ai_info *aip, object* En_Objp);
//SUSHI: Random evasive sidethrust
void do_random_sidethrust(ai_info *aip, ship_info *sip);
#endif
+27 -1
View File
@@ -49,7 +49,6 @@ void set_flag(ai_profile_t *profile, char *name, int flag, int type)
void parse_ai_profiles_tbl(char *filename)
{
int i, rval;
bool no_create = false;
char profile_name[NAME_LENGTH];
ai_profile_t dummy_profile;
char *saved_Mp = NULL;
@@ -84,6 +83,7 @@ void parse_ai_profiles_tbl(char *filename)
{
ai_profile_t *profile = &dummy_profile;
ai_profile_t *previous_profile = NULL;
bool no_create = false;
// get the name
required_string("$Profile Name:");
@@ -273,6 +273,19 @@ void parse_ai_profiles_tbl(char *filename)
}
}
if (optional_string("$Random Sidethrust Percent:")) {
parse_float_list(profile->random_sidethrust_percent, NUM_SKILL_LEVELS);
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
//While we're at it, verify the range
for (int i = 0; i < NUM_SKILL_LEVELS; i++) {
if (profile->random_sidethrust_percent[i] < 0.0f || profile->random_sidethrust_percent[i] > 100.0f) {
profile->random_sidethrust_percent[i] = 0.0f;
Warning(LOCATION, "$Random Sidethrust Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->random_sidethrust_percent[i]);
}
profile->random_sidethrust_percent[i] /= 100.0;
}
}
if (optional_string("$Stalemate Time Threshold:"))
parse_float_list(profile->stalemate_time_thresh, NUM_SKILL_LEVELS);
@@ -309,6 +322,9 @@ void parse_ai_profiles_tbl(char *filename)
if (optional_string("$Max Aim Update Delay:"))
parse_float_list(profile->max_aim_update_delay, NUM_SKILL_LEVELS);
if (optional_string("$Turret Max Aim Update Delay:"))
parse_float_list(profile->turret_max_aim_update_delay, NUM_SKILL_LEVELS);
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS, AIP_FLAG);
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION, AIP_FLAG);
@@ -373,6 +389,16 @@ void parse_ai_profiles_tbl(char *filename)
set_flag(profile, "$turrets ignore targets radius in range checks:", AIPF2_TURRETS_IGNORE_TARGET_RADIUS, AIP_FLAG2);
set_flag(profile, "$no extra collision avoidance vs player:", AIPF2_NO_SPECIAL_PLAYER_AVOID, 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);
set_flag(profile, "$require turrets to have target in fov:", AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV, AIP_FLAG2);
set_flag(profile, "$all ships manage shields:", AIPF2_ALL_SHIPS_MANAGE_SHIELDS, AIP_FLAG2);
// if we've been through once already and are at the same place, force a move
if ( saved_Mp && (saved_Mp == Mp) )
Mp++;
+9
View File
@@ -52,6 +52,12 @@
// flags2
#define AIPF2_TURRETS_IGNORE_TARGET_RADIUS (1 << 0)
#define AIPF2_NO_SPECIAL_PLAYER_AVOID (1 << 1)
#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 MAX_AI_PROFILES 5
@@ -93,9 +99,11 @@ typedef struct ai_profile_t {
float glide_attack_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "glide attack" move
float circle_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "circle strafe" move
float glide_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use glide when strafing capships
float random_sidethrust_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to randomly use sidethrust while dogfihthing
float stalemate_time_thresh[NUM_SKILL_LEVELS]; // SUSHI: The amount of time required for the AI to detect (and try to break) dogfight stalemate
float stalemate_dist_thresh[NUM_SKILL_LEVELS]; // SUSHI: The maximum distance the AI and target must be within for a stalemate
float max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: The maximum delay before the AI updates their aim against small ships
float turret_max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: As above, but for turrets updating their aim
// Multiplicative delay factors for increasing skill levels.
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS];
@@ -124,6 +132,7 @@ typedef struct ai_profile_t {
// the chance (x/7) that ship is allowed to fire missiles at player ship.
int chance_to_use_missiles_on_plr[NUM_SKILL_LEVELS];
} ai_profile_t;
+23 -4
View File
@@ -376,7 +376,12 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
float dist;
pm = model_get( Ship_info[Ships[Pl_objp->instance].ship_info_index].model_num );
//Necessary sanity check
polymodel *pm_t;
pm_t = model_get(Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].model_num);
Assertion(aip->targeted_subsys->system_info->path_num <= pm_t->n_paths, "Invalid Path number %d for subsystem %s on ship %s (Model: %s)\n", aip->targeted_subsys->system_info->path_num, aip->targeted_subsys->system_info->name, Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].name, pm_t->filename );
if (aip->targeted_subsys->system_info->path_num > pm_t->n_paths)
return 0;
// If attacking a subsystem, ensure that we have an unobstructed line of sight... if not, then move
// towards path linked to subsystem
subsys_in_sight = 0; // assume Pl_objp doesn't have line of sight to subys
@@ -420,7 +425,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
aip->path_goal_dist = 5;
subsys_path_num = aip->targeted_subsys->system_info->path_num;
if ( (aip->path_start) == -1 || (aip->mp_index != subsys_path_num) ) {
if ( ((aip->path_start) == -1 || (aip->mp_index != subsys_path_num)) && subsys_path_num <= pm->n_paths ) {
// maybe create a new path
if ( subsys_path_num >= 0 ) {
Assert(aip->target_objnum >= 0);
@@ -694,7 +699,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
ship_weapon *tswp = &temp_shipp->weapons;
if ( tswp->num_primary_banks > 0 ) {
Assert(tswp->current_primary_bank < tswp->num_primary_banks);
Assertion(tswp->current_primary_bank < tswp->num_primary_banks, "AI tried to select primary bank %d. Might be a model error\n", tswp->current_primary_bank);
weapon_info *wip = &Weapon_info[tswp->primary_bank_weapons[tswp->current_primary_bank]];
if (dist_to_enemy < MIN((wip->max_speed * wip->lifetime), wip->weapon_range)){
@@ -1431,7 +1436,7 @@ void ai_big_strafe_glide_attack()
if (aip->submode_parm1 == 1) {
accelerate_ship(aip, 1.0f);
//Use afterburners if we have them and are pointed the right way
if (dot_to_goal > 0.99f && ai_maybe_fire_afterburner(Pl_objp, aip)) {
if (dot_to_goal > 0.99f) {
afterburners_start(Pl_objp);
aip->afterburner_stop_time = Missiontime + 3*F1_0;
}
@@ -1640,6 +1645,20 @@ void ai_big_strafe()
Int3(); // Illegal submode for AIM_STRAFE
break;
}
//Maybe apply random sidethrust, depending on the current submode
//The following are valid targets for random sidethrust (circle strafe uses it too, but that is handled separately)
if (aip->submode == AIS_STRAFE_ATTACK ||
aip->submode == AIS_STRAFE_AVOID ||
aip->submode == AIS_STRAFE_RETREAT1 ||
aip->submode == AIS_STRAFE_RETREAT2 ||
aip->submode == AIS_STRAFE_POSITION)
{
//Re-roll for random sidethrust every 2 seconds
if (static_randf((Missiontime + static_rand(aip->shipnum)) >> 17) < aip->ai_random_sidethrust_percent) {
do_random_sidethrust(aip, &Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index]);
}
}
}
// See if Pl_objp should enter strafe mode (This is called from maybe_evade_dumbfire_weapon(), and the
+384 -503
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1008,7 +1008,7 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
* Pass -1 in priority to ignore priority when searching
* Returns -1 if not found, or [0, MAX_AI_GOALS)
*/
int ai_find_goal_index( ai_goal* aigp, int mode, int submode = -1, int priority = -1 )
int ai_find_goal_index( ai_goal* aigp, int mode, int submode, int priority )
{
Assert( aigp != NULL );
for ( int i = 0; i < MAX_AI_GOALS; i++ )
+24 -24
View File
@@ -26,35 +26,35 @@ struct ai_goal;
// Fred. If the goal you add doesn't have a target (such as chase_any), then you don't have
// to worry about doing this. Also add it to list in Fred\Management.cpp, and let Hoffoss know!
// WMC - Oh and add them to Ai_goal_names plz. TY! :)
#define AI_GOAL_CHASE (1<<1)
#define AI_GOAL_DOCK (1<<2) // used for undocking as well
#define AI_GOAL_WAYPOINTS (1<<3)
#define AI_GOAL_WAYPOINTS_ONCE (1<<4)
#define AI_GOAL_WARP (1<<5)
#define AI_GOAL_DESTROY_SUBSYSTEM (1<<6)
#define AI_GOAL_FORM_ON_WING (1<<7)
#define AI_GOAL_UNDOCK (1<<8)
#define AI_GOAL_CHASE_WING (1<<9)
#define AI_GOAL_GUARD (1<<10)
#define AI_GOAL_DISABLE_SHIP (1<<11)
#define AI_GOAL_DISARM_SHIP (1<<12)
#define AI_GOAL_CHASE_ANY (1<<13)
#define AI_GOAL_IGNORE (1<<14)
#define AI_GOAL_GUARD_WING (1<<15)
#define AI_GOAL_EVADE_SHIP (1<<16)
#define AI_GOAL_CHASE (1<<1) // 0x00000002
#define AI_GOAL_DOCK (1<<2) // 0x00000004 // used for undocking as well
#define AI_GOAL_WAYPOINTS (1<<3) // 0x00000008
#define AI_GOAL_WAYPOINTS_ONCE (1<<4) // 0x00000010
#define AI_GOAL_WARP (1<<5) // 0x00000020
#define AI_GOAL_DESTROY_SUBSYSTEM (1<<6) // 0x00000040
#define AI_GOAL_FORM_ON_WING (1<<7) // 0x00000080
#define AI_GOAL_UNDOCK (1<<8) // 0x00000100
#define AI_GOAL_CHASE_WING (1<<9) // 0x00000200
#define AI_GOAL_GUARD (1<<10) // 0x00000400
#define AI_GOAL_DISABLE_SHIP (1<<11) // 0x00000800
#define AI_GOAL_DISARM_SHIP (1<<12) // 0x00001000
#define AI_GOAL_CHASE_ANY (1<<13) // 0x00002000
#define AI_GOAL_IGNORE (1<<14) // 0x00004000
#define AI_GOAL_GUARD_WING (1<<15) // 0x00008000
#define AI_GOAL_EVADE_SHIP (1<<16) // 0x00010000
// the next goals are for support ships only
#define AI_GOAL_STAY_NEAR_SHIP (1<<17)
#define AI_GOAL_KEEP_SAFE_DISTANCE (1<<18)
#define AI_GOAL_REARM_REPAIR (1<<19)
#define AI_GOAL_STAY_NEAR_SHIP (1<<17) // 0x00020000
#define AI_GOAL_KEEP_SAFE_DISTANCE (1<<18) // 0x00040000
#define AI_GOAL_REARM_REPAIR (1<<19) // 0x00080000
// resume regular goals
#define AI_GOAL_STAY_STILL (1<<20)
#define AI_GOAL_PLAY_DEAD (1<<21)
#define AI_GOAL_CHASE_WEAPON (1<<22)
#define AI_GOAL_STAY_STILL (1<<20) // 0x00100000
#define AI_GOAL_PLAY_DEAD (1<<21) // 0x00200000
#define AI_GOAL_CHASE_WEAPON (1<<22) // 0x00400000
#define AI_GOAL_FLY_TO_SHIP (1<<23) // kazan
#define AI_GOAL_IGNORE_NEW (1<<24) // Goober5000
#define AI_GOAL_FLY_TO_SHIP (1<<23) // 0x00800000
#define AI_GOAL_IGNORE_NEW (1<<24) // 0x01000000
// now the masks for ship types
+196 -19
View File
@@ -100,6 +100,101 @@ int object_in_turret_fov(object *objp, ship_subsys *ss, vec3d *tvec, vec3d *tpos
return 0;
}
bool is_object_radius_in_turret_fov(object *objp, ship_subsys *ss, vec3d *tvec, vec3d *tpos, vec3d *v2e, vec3d *predicted_pos, float distance)
{
float target_dist = distance;
if (distance == 0.0f)
target_dist = vm_vec_dist(predicted_pos,tpos);
if (object_in_turret_fov(objp, ss, tvec, tpos, target_dist + objp->radius)) {
// so the targeted spot in not in fov but the enemy + radius is
// lets align the darn gun and try shooting there
vec3d temp_vec;
float multiplier = 0;
model_subsystem *tp = ss->system_info;
// project v2e_from_turret to turret normal
// substract resultant vector from the temp_vec (v2e_from_turret)
// adjust z component as necessary
// calculate multiplier for the resultant vector
// use multiplier and the z component and compose a new vector
float dot = vm_vec_dot(v2e, tvec);
vm_vec_scale_add(&temp_vec, v2e, tvec, -dot);
if (IS_VEC_NULL_SQ_SAFE(&temp_vec)) {
// return false, target is perfectly aligned over or below the turret
// safe bet is to allow turret to reacquire better target
return false;
}
// normalize the vec, it needs to be done regardless
vm_vec_normalize(&temp_vec);
bool fix_elevation = false;
bool fix_base_rot = false;
if (dot < tp->turret_fov) {
dot = tp->turret_fov;
fix_elevation = true;
}
if (dot > tp->turret_max_fov) {
dot = tp->turret_max_fov;
fix_elevation = true;
}
if (tp->flags & MSS_FLAG_TURRET_ALT_MATH) {
vec3d temp_vec2;
vm_vec_rotate(&temp_vec2, &temp_vec, &ss->world_to_turret_matrix);
// now in turrets frame of reference
// check if math is actually possible
if (!((temp_vec2.xyz.x == 0) && (temp_vec2.xyz.y == 0))) {
float temp_z = temp_vec2.xyz.z;
temp_vec2.xyz.z = 0.0f;
// make sure null vecs wont happen
if (!IS_VEC_NULL_SQ_SAFE(&temp_vec2)) {
vm_vec_normalize(&temp_vec2);
// only do this if it actually is required
if (-temp_vec2.xyz.y < tp->turret_y_fov) {
float check_pos = 1;
fix_base_rot = true;
temp_vec2.xyz.y = -tp->turret_y_fov;
if (temp_vec2.xyz.x < 0)
check_pos = -1;
temp_vec2.xyz.x = check_pos * sqrtf(1 - (temp_vec2.xyz.y*temp_vec2.xyz.y));
// restore z component
float scaler = sqrtf(1 - (temp_z*temp_z));
vm_vec_scale(&temp_vec2,scaler);
temp_vec2.xyz.z = temp_z;
// back to world frame
vm_vec_unrotate(&temp_vec, &temp_vec2, &ss->world_to_turret_matrix);
}
}
}
}
if (fix_elevation || fix_base_rot) {
if (fix_elevation) {
multiplier = sqrtf(1 - (dot*dot));
// keep the temp_vec scaled with the tweaked vector
vm_vec_scale(&temp_vec, multiplier);
}
vm_vec_scale_add(v2e, &temp_vec, tvec, dot);
// and we are done with v2e...
vm_vec_scale_add(predicted_pos, tpos, v2e, target_dist);
// and we are done with predicted position
return true;
} else {
mprintf(("Warning: Function 'is_object_radius_in_turret_fov' was called\nwithout need to fix turret alignments\n"));
return false;
}
}
// outside of the expanded radii, unable to align, return false
return false;
}
// return 1 if bomb_objp is headed towards ship_objp
int bomb_headed_towards_ship(object *bomb_objp, object *ship_objp)
{
@@ -357,9 +452,10 @@ extern int Player_attacking_enabled;
void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
{
object *turret_parent_obj = &Objects[eeo->turret_parent_objnum];
ship *shipp;
ship *shipp;
ship_subsys *ss = eeo->turret_subsys;
float dist, dist_comp;
bool turret_has_no_target = false;
// Don't look for bombs when weapon system is not ok
if (objp->type == OBJ_WEAPON && !eeo->weapon_system_ok) {
@@ -476,7 +572,10 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
if ((objp->type == OBJ_WEAPON) && check_weapon) {
if ( Weapons[objp->instance].homing_object == &Objects[eeo->turret_parent_objnum] ) {
if ( dist_comp < eeo->nearest_homing_bomb_dist ) {
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
eeo->nearest_homing_bomb_dist = dist_comp;
eeo->nearest_homing_bomb_objnum = OBJ_INDEX(objp);
}
@@ -484,7 +583,10 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
// if not homing, check if bomb is flying towards ship
} else if ( bomb_headed_towards_ship(objp, &Objects[eeo->turret_parent_objnum]) ) {
if ( dist_comp < eeo->nearest_bomb_dist ) {
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
eeo->nearest_bomb_dist = dist_comp;
eeo->nearest_bomb_objnum = OBJ_INDEX(objp);
}
@@ -540,7 +642,10 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
// maybe update nearest attacker
if ( dist_comp < eeo->nearest_attacker_dist ) {
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
// nprintf(("AI", "Nearest enemy = %s, dist = %7.3f, dot = %6.3f, fov = %6.3f\n", Ships[objp->instance].ship_name, dist, vm_vec_dot(&v2e, tvec), tp->turret_fov));
eeo->nearest_attacker_dist = dist_comp;
eeo->nearest_attacker_objnum = OBJ_INDEX(objp);
@@ -555,7 +660,10 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
dist_comp *= 0.9f + (0.01f * asteroid_time_to_impact(objp));
if (dist_comp < eeo->nearest_dist ) {
if ( (eeo->current_enemy == -1) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
eeo->nearest_dist = dist_comp;
eeo->nearest_objnum = OBJ_INDEX(objp);
}
@@ -945,7 +1053,13 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
dist = vm_vec_normalized_dir(&v2e, &Objects[aip->target_objnum].pos, tpos);
in_fov = turret_fov_test(turret_subsys, tvec, &v2e);
// MODIFY FOR ATTACKING BIG SHIP
if (turret_subsys->flags & SSF_FOV_EDGE_CHECK) {
if (in_fov == false)
if (object_in_turret_fov(&Objects[aip->target_objnum], turret_subsys, tvec, tpos, dist + Objects[aip->target_objnum].radius))
in_fov = true;
}
// MODIFY FOR ATTACKING BIG SHIP
// dot += (0.5f * Objects[aip->target_objnum].radius / dist);
if (in_fov) {
return aip->target_objnum;
@@ -1008,9 +1122,28 @@ void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos
vm_vec_normalized_dir(gvec, targetp, gpos);
}
ship_model_stop(objp);
ship_model_stop(objp);
// per firingpoint based changes go here for turrets
}
//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)
{
ss->last_aim_enemy_pos = En_Objp->pos;
ss->last_aim_enemy_vel = En_Objp->phys_info.vel;
ss->next_aim_pos_time = Missiontime + fl2f(frand_range(0.0f, aip->ai_turret_max_aim_update_delay));
}
else
{
//Update the position based on the velocity (assume no velocity vector change)
vm_vec_scale_add2(&ss->last_aim_enemy_pos, &ss->last_aim_enemy_vel, flFrametime);
}
}
// 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.
@@ -1041,23 +1174,26 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
ship_get_global_turret_info(&Objects[parent_objnum], tp, &gun_pos, &gun_vec);
//Update "known" position and velocity of target. Only matters if max_aim_update_delay is set.
turret_ai_update_aim(&Ai_info[shipp->ai_index], &Objects[ss->turret_enemy_objnum], ss);
//Figure out what point on the ship we want to point the gun at, and store the global location
//in enemy_point.
vec3d enemy_point;
if ((ss->targeted_subsys != NULL) && !(ss->flags & SSF_NO_SS_TARGETING)) {
if (ss->turret_enemy_objnum != -1) {
vm_vec_unrotate(&enemy_point, &ss->targeted_subsys->system_info->pnt, &Objects[ss->turret_enemy_objnum].orient);
vm_vec_add2(&enemy_point, &Objects[ss->turret_enemy_objnum].pos);
vm_vec_add2(&enemy_point, &ss->last_aim_enemy_pos);
}
} else {
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
ai_big_pick_attack_point_turret(lep, ss, &gun_pos, &gun_vec, &enemy_point, tp->turret_fov, MIN(wip->max_speed * wip->lifetime, wip->weapon_range));
} else {
enemy_point = lep->pos;
enemy_point = ss->last_aim_enemy_pos;
}
}
target_moving_direction = lep->phys_info.vel;
target_moving_direction = ss->last_aim_enemy_vel;
//Try to guess where the enemy will be, and store that spot in predicted_enemy_pos
if (The_mission.ai_profile->flags & AIPF_USE_ADDITIVE_WEAPON_VELOCITY) {
@@ -1084,6 +1220,11 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
in_fov = turret_fov_test(ss, gvec, &v2e);
if (ss->flags & SSF_FOV_EDGE_CHECK) {
if (in_fov == false)
in_fov = is_object_radius_in_turret_fov(&Objects[ss->turret_enemy_objnum], ss, gvec, &gun_pos, &v2e, predicted_enemy_pos, 0.0f);
}
if (in_fov) {
ret_val = model_rotate_gun(Ship_info[shipp->ship_info_index].model_num,
tp, &Objects[parent_objnum].orient,
@@ -1317,7 +1458,7 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
{
// make side even for team vs. team
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)) {
if (MULTI_TEAM) {
// flak guns need to fire more rapidly
if (wip->wi_flags & WIF_FLAK) {
wait *= aip->ai_ship_fire_delay_scale_friendly * 0.5f;
@@ -1359,6 +1500,9 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
wait *= frand_range(0.9f, 1.1f);
}
if(turret->rof_scaler != 1.0f)
wait /= get_adjusted_turret_rof(turret);
(*fs_dest) = timestamp((int)wait);
}
@@ -1883,8 +2027,8 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
if(num_valid < 1)
ss->turret_enemy_objnum = -1;
// Maybe pick a new enemy.
if ( turret_should_pick_new_target(ss) ) {
// Maybe pick a new enemy, unless targeting has been taken over by scripting
if ( turret_should_pick_new_target(ss) && !ss->scripting_target_override) {
Num_find_turret_enemy++;
int objnum = find_turret_enemy(ss, parent_objnum, &gpos, &gvec, ss->turret_enemy_objnum);
//Assert(objnum < 0 || is_target_beam_valid(tp, objnum));
@@ -2119,6 +2263,12 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
turret_fire_weapon(valid_weapons[0], ss, parent_objnum, &gpos, &tv2e, &predicted_enemy_pos);
else
turret_fire_weapon(valid_weapons[i], ss, parent_objnum, &gpos, &tv2e, &predicted_enemy_pos);
} else {
// make sure salvo fire mode does not turn into autofire
if ((tp->flags & MSS_FLAG_TURRET_SALVO) && ((i + 1) == number_of_firings)) {
ai_info *parent_aip = &Ai_info[Ships[Objects[parent_objnum].instance].ai_index];
turret_set_next_fire_timestamp(valid_weapons[0], wip, ss, parent_aip);
}
}
// moved this here so we increment the fire pos only after we have fired and not during it
ss->turret_next_fire_pos++;
@@ -2178,7 +2328,7 @@ bool turret_std_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mo
{
model_subsystem *tp = ss->system_info;
float dot = vm_vec_dot(v2e, gvec);
if (((dot + size_mod) > tp->turret_fov) && ((dot - size_mod) <= tp->turret_max_fov))
if (((dot + size_mod) >= tp->turret_fov) && ((dot - size_mod) <= tp->turret_max_fov))
return true;
return false;
@@ -2188,17 +2338,19 @@ bool turret_adv_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mo
{
model_subsystem *tp = ss->system_info;
float dot = vm_vec_dot(v2e, gvec);
if (((dot + size_mod) > tp->turret_fov) && ((dot - size_mod) <= tp->turret_max_fov)) {
if (((dot + size_mod) >= tp->turret_fov) && ((dot - size_mod) <= tp->turret_max_fov)) {
vec3d of_dst;
vm_vec_rotate( &of_dst, v2e, &ss->world_to_turret_matrix );
vm_vec_normalize(&of_dst);
if ((of_dst.xyz.x == 0) && (of_dst.xyz.y == 0)) {
return true;
} else {
of_dst.xyz.z = 0;
// now we have 2d vector with lenght of 1 that points at the targets direction after being rotated to turrets FOR
if ((-of_dst.xyz.y + size_mod) > tp->turret_y_fov)
return true;
if (!IS_VEC_NULL_SQ_SAFE(&of_dst)) {
vm_vec_normalize(&of_dst);
// now we have 2d vector with lenght of 1 that points at the targets direction after being rotated to turrets FOR
if ((-of_dst.xyz.y + size_mod) >= tp->turret_y_fov)
return true;
}
}
}
return false;
@@ -2214,3 +2366,28 @@ bool turret_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mod)
return in_fov;
}
float get_adjusted_turret_rof(ship_subsys *ss)
{
float tempf = ss->rof_scaler;
// optional reset switch (negative value)
if (tempf < 0) {
ss->rof_scaler = 1.0f;
return 1.0f;
}
if (tempf == 0) {
// special case returning the number of firingpoints
ss->rof_scaler = (float) ss->system_info->turret_num_firing_points;
tempf = ss->rof_scaler;
// safety check to avoid div/0 issues
if (tempf == 0) {
ss->rof_scaler = 1.0f;
return 1.0f;
}
}
return tempf;
}
+18 -6
View File
@@ -112,11 +112,13 @@ MONITOR(NumANIPlayed)
// Setup an anim_play_struct for passing into anim_play(). Will fill in default values, which you
// can then change before calling anim_play().
//
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y)
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y, int base_w, int base_h)
{
aps->anim_info = a_info;
aps->x = x;
aps->y = y;
aps->base_w = base_w;
aps->base_h = base_h;
aps->start_at = 0;
aps->stop_at = a_info->total_frames - 1;
aps->screen_id = 0;
@@ -219,6 +221,14 @@ anim_instance *anim_play(anim_play_struct *aps)
instance->xlate_pal = 0;
}
if(aps->base_w < 0 || aps->base_h < 0) {
instance->base_w = gr_screen.max_w_unscaled;
instance->base_h = gr_screen.max_h_unscaled;
} else {
instance->base_w = aps->base_w;
instance->base_h = aps->base_h;
}
// determining the start_at frame is more complicated, since it must be a key-frame.
// Futhermore, need to subtract 1 from key-frame number, since frame number is always
// incremented the first time anim_show_next_frame() is called
@@ -521,6 +531,8 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
// determine x,y to display the bitmap at
if ( instance->world_pos == NULL ) {
gr_set_screen_scale(instance->base_w, instance->base_h);
gr_set_clip(0, 0, instance->base_w, instance->base_h, false);
if ( instance->aa_color == NULL ) {
gr_bitmap(instance->x, instance->y);
}
@@ -528,6 +540,8 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
gr_set_color_fast( (color*)instance->aa_color );
gr_aabitmap(instance->x, instance->y);
}
gr_reset_screen_scale();
gr_reset_clip();
}
else {
g3_rotate_vertex(&image_vertex,instance->world_pos);
@@ -1085,11 +1099,9 @@ void anim_reverse_direction(anim_instance *ai)
{
int temp;
if(!(ai->parent->flags & ANF_ALL_KEYFRAMES)){
// you're not allowed to call anim_reverse_direction(...) unless every frame is a keyframe!!!!
// The God of Delta-RLE demands it be thus.
Int3();
}
// you're not allowed to call anim_reverse_direction(...) unless every frame is a keyframe!!!!
// The God of Delta-RLE demands it be thus.
Assertion( ai->parent->flags & ANF_ALL_KEYFRAMES, "Ani was set to play backwards. In order to enable this, all frames of the animation MUST be keyframes.");
// flip the animation direction
if(ai->direction == ANIM_DIRECT_FORWARD){
+3 -1
View File
@@ -24,6 +24,8 @@ typedef struct {
anim *anim_info;
int x;
int y;
int base_w;
int base_h;
int start_at;
int stop_at;
int screen_id;
@@ -50,7 +52,7 @@ void anim_level_init();
void anim_level_close();
void anim_render_all(int screen_id, float frametime);
void anim_render_one(int screen_id, anim_instance *ani, float frametime);
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y);
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y, int max_x = -1, int max_y = -1);
anim_instance *anim_play(anim_play_struct *aps);
void anim_ignore_next_frametime();
int anim_stop_playing(anim_instance* anim_instance);
+1 -149
View File
@@ -168,154 +168,6 @@ ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap
return inst->frame;
}
// --------------------------------------------------------------------
// anim_get_frame()
//
// Get a bitmap id from the anim_instance for the specified frame_num
//
// input: *inst => pointer to anim instance
// frame_num => frame number to get (first frame is 0)
// xlate_pal => DEFAULT PARM (value 1): whether to translate the palette
// to the current game palette
//
int anim_get_frame(anim_instance *inst, int frame_num, int xlate_pal)
{
/*
int bm, bitmap_flags, key = 0, offset = 0;
int idx;
if ((frame_num < 0) || (frame_num >= inst->parent->total_frames)) // illegal frame number
return -1;
int need_reset = 0;
if ( anim_instance_is_streamed(inst) ) {
if ( inst->file_offset < 0 ) {
need_reset = 1;
}
} else {
if ( !inst->data ) {
need_reset = 1;
}
}
if (need_reset || (inst->frame_num >= inst->parent->total_frames)) { // reset to valid info
inst->data = inst->parent->data;
inst->file_offset = inst->parent->file_offset;
inst->frame_num = 0;
}
bitmap_flags = 0;
if (inst->parent->flags & ANF_XPARENT) {
// bitmap_flags = BMP_XPARENT;
bitmap_flags = 0;
}
if ( inst->frame_num == frame_num ) {
bm = bm_create(16, inst->parent->width, inst->parent->height, inst->frame, bitmap_flags);
bm_unload(bm);
return bm;
}
if (inst->parent->flags & ANF_XPARENT){
// bitmap_flags = BMP_XPARENT;
bitmap_flags = 0;
} else {
bitmap_flags = 0;
}
idx = 0;
key = 0;
while(idx < inst->parent->num_keys){
if (( (inst->parent->keys[idx].frame_num-1) <= frame_num) && ( (inst->parent->keys[idx].frame_num-1) > key)) { // find closest key
key = inst->parent->keys[idx].frame_num - 1;
offset = inst->parent->keys[idx].offset;
if ( key == frame_num )
break;
}
idx++;
}
if ( key == frame_num ) {
inst->frame_num = key;
if ( anim_instance_is_streamed(inst) ) {
inst->file_offset = inst->parent->file_offset + offset;
} else {
inst->data = inst->parent->data + offset;
}
anim_check_for_palette_change(inst);
if ( anim_instance_is_streamed(inst) ) {
if ( xlate_pal ){
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation);
} else {
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, NULL);
}
} else {
if ( xlate_pal ){
inst->data = unpack_frame(inst, inst->data, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation);
} else {
inst->data = unpack_frame(inst, inst->data, inst->frame, inst->parent->width*inst->parent->height, NULL);
}
}
goto create_bitmap;
}
if (key > inst->frame_num) // best key is closer than current position
{
inst->frame_num = key;
if ( anim_instance_is_streamed(inst) ) {
inst->file_offset = inst->parent->file_offset + offset;
} else {
inst->data = inst->parent->data + offset;
}
anim_check_for_palette_change(inst);
if ( anim_instance_is_streamed(inst) ) {
if ( xlate_pal )
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation);
else
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, NULL);
} else {
if ( xlate_pal )
inst->data = unpack_frame(inst, inst->data, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation);
else
inst->data = unpack_frame(inst, inst->data, inst->frame, inst->parent->width*inst->parent->height, NULL);
}
}
while (inst->frame_num != frame_num) {
anim_check_for_palette_change(inst);
if ( anim_instance_is_streamed(inst) ) {
if ( xlate_pal )
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation);
else
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, NULL);
} else {
if ( xlate_pal )
inst->data = unpack_frame(inst, inst->data, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation);
else
inst->data = unpack_frame(inst, inst->data, inst->frame, inst->parent->width*inst->parent->height, NULL);
}
inst->frame_num++;
}
create_bitmap:
bm = bm_create(16, inst->parent->width, inst->parent->height, inst->frame, bitmap_flags);
bm_unload(bm);
return bm;
*/
Int3();
return -1;
}
// frame = frame pixel data to pack
// save = memory to store packed data to
// size = number of bytes to pack
@@ -1173,7 +1025,7 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal
}
}
else {
// Int3(); // unknown packing method
// unknown packing method
return -1;
}
+1 -1
View File
@@ -71,6 +71,7 @@ typedef struct anim {
typedef struct anim_instance {
anim_instance *next, *prev;
int x,y; // coordinates anim is played at (top left corner of anim)
int base_w, base_h; // coordinate scale this anim is played in.
vec3d *world_pos; // world (x,y,z) position of explosion
float radius; // radius of image, needed for scaling
int frame_num; // current frame, or last frame if between frames (first frame is 0)
@@ -106,7 +107,6 @@ void anim_init();
anim_instance *init_anim_instance(anim *ptr, int bpp);
void free_anim_instance(anim_instance *inst);
int anim_get_next_frame(anim_instance *inst);
int anim_get_frame(anim_instance *inst, int frame_num, int xlate_pal=1);
ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp);
void anim_set_palette(anim *a);
void anim_check_for_palette_change(anim_instance *inst);
+5 -18
View File
@@ -1584,7 +1584,7 @@ void asteroid_update_collide_flag(object *asteroid_objp)
asp->collide_objsig = -1;
// multiplayer dogfight
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){
if(MULTI_DOGFIGHT){
return;
}
@@ -1935,23 +1935,10 @@ void asteroid_show_brackets()
g3_rotate_vertex(&asteroid_vertex,&asteroid_objp->pos);
g3_project_vertex(&asteroid_vertex);
if (!(asteroid_vertex.flags & PF_OVERFLOW)) {
gr_set_color_fast(iff_get_color(IFF_COLOR_SELECTION, 1));
hud_show_brackets(asteroid_objp, &asteroid_vertex);
if ( Cmdline_targetinfo ) {
hud_show_lead_indicator_quick(&asteroid_objp->pos, asteroid_objp);
}
}
// if asteroid is not on screen, draw an offscreen indicator
if ( hud_gauge_active(HUD_OFFSCREEN_INDICATOR) ) {
if (asteroid_vertex.codes != 0) {
float dist;
// dist = vm_vec_dist_quick(&Player_obj->pos, &asteroid_objp->pos);
dist = hud_find_target_distance( asteroid_objp, Player_obj );
gr_set_color_fast(iff_get_color(IFF_COLOR_SELECTION, 1));
hud_draw_offscreen_indicator(&asteroid_vertex, &asteroid_objp->pos, dist);
}
if ( Cmdline_targetinfo ) {
hud_target_add_display_list(asteroid_objp, &asteroid_vertex, &asteroid_objp->pos, 0, NULL, NULL, TARGET_DISPLAY_DIST | TARGET_DISPLAY_LEAD);
} else {
hud_target_add_display_list(asteroid_objp, &asteroid_vertex, &asteroid_objp->pos, 0, NULL, NULL, TARGET_DISPLAY_DIST);
}
}
}
+199 -142
View File
@@ -39,6 +39,7 @@ extern int Cmdline_autopilot_interruptable;
// Module variables
bool AutoPilotEngaged;
bool UseCutsceneBars;
bool LockWeaponsDuringAutopilot;
int CurrentNav;
float ramp_bias;
NavPoint Navs[MAX_NAVPOINTS];
@@ -55,6 +56,9 @@ bool CinematicStarted, CameraMoving;
vec3d cameraPos, cameraTarget;
std::map<int,int> autopilot_wings;
int AutopilotMinEnemyDistance;
int AutopilotMinAsteroidDistance;
// used for ramping time compression;
int start_dist;
@@ -149,12 +153,7 @@ char* NavPoint::GetInteralName()
}
// ********************************************************************************************
// Tell us if autopilot is allowed
// This needs:
// * Nav point selected
// * No enemies within X distance
// * Destination > 1,000 meters away
bool CanAutopilot(bool send_msg)
bool CanAutopilot(vec3d targetPos, bool send_msg)
{
if (CurrentNav == -1)
{
@@ -162,99 +161,69 @@ bool CanAutopilot(bool send_msg)
send_autopilot_msgID(NP_MSG_FAIL_NOSEL);
return false;
}
if (object_get_gliding(Player_obj))
{
if (send_msg)
send_autopilot_msgID(NP_MSG_FAIL_GLIDING);
return false;
}
// You cannot autopilot if you're within 1000 meters of your destination nav point
if (vm_vec_dist_quick(&Player_obj->pos, Navs[CurrentNav].GetPosition()) < 1000)
{
if (vm_vec_dist_quick(&targetPos, Navs[CurrentNav].GetPosition()) < 1000) {
if (send_msg)
send_autopilot_msgID(NP_MSG_FAIL_TOCLOSE);
return false;
}
// see if any hostiles are nearby
for (ship_obj *so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so))
{
object *other_objp = &Objects[so->objnum];
// attacks player?
if (iff_x_attacks_y(obj_team(other_objp), obj_team(Player_obj))
&& !(Ship_info[Ships[other_objp->instance].ship_info_index].flags & SIF_CARGO))
if ( AutopilotMinEnemyDistance > 0 ) {
// see if any hostiles are nearby
for (ship_obj *so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so))
{
// Cannot autopilot if enemy within 5,000 meters
if (vm_vec_dist_quick(&Player_obj->pos, &other_objp->pos) < 5000)
object *other_objp = &Objects[so->objnum];
// attacks player?
if (iff_x_attacks_y(obj_team(other_objp), obj_team(Player_obj))
&& !(Ship_info[Ships[other_objp->instance].ship_info_index].flags & SIF_CARGO)) // ignore cargo
{
if (send_msg)
send_autopilot_msgID(NP_MSG_FAIL_HOSTILES);
return false;
// Cannot autopilot if enemy within AutopilotMinEnemyDistance meters
if (vm_vec_dist_quick(&targetPos, &other_objp->pos) < AutopilotMinEnemyDistance) {
if (send_msg)
send_autopilot_msgID(NP_MSG_FAIL_HOSTILES);
return false;
}
}
}
}
//check for asteroids
for (int n=0; n<MAX_ASTEROIDS; n++)
{
// asteroid
if (Asteroids[n].flags & AF_USED)
{
// Cannot autopilot if asteroid within 1,000 meters
if (vm_vec_dist_quick(&Player_obj->pos, &Objects[Asteroids[n].objnum].pos) < 1000)
{
if (send_msg)
send_autopilot_msgID(NP_MSG_FAIL_HAZARD);
return false;
}
}
}
return true;
}
// ********************************************************************************************
// Tell us if autopilot is allowed at a certain position (only performs checks based on that position)
// This needs:
// * Nav point selected
// * No enemies within X distance
// * Destination > 1,000 meters away
bool CanAutopilotPos(vec3d targetPos)
{
// You cannot autopilot if you're within 1000 meters of your destination nav point
if (vm_vec_dist_quick(&targetPos, Navs[CurrentNav].GetPosition()) < 1000)
return false;
// see if any hostiles are nearby
for (ship_obj *so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so))
{
object *other_objp = &Objects[so->objnum];
// attacks player?
if (iff_x_attacks_y(obj_team(other_objp), obj_team(Player_obj))
&& !(Ship_info[Ships[other_objp->instance].ship_info_index].flags & SIF_CARGO)) // ignore cargo
{
// Cannot autopilot if enemy within 5,000 meters
if (vm_vec_dist_quick(&targetPos, &other_objp->pos) < 5000)
return false;
}
}
//check for asteroids
for (int n=0; n<MAX_ASTEROIDS; n++)
{
// asteroid
if (Asteroids[n].flags & AF_USED)
if ( AutopilotMinAsteroidDistance > 0 ) {
//check for asteroids
for (int n=0; n<MAX_ASTEROIDS; n++)
{
// Cannot autopilot if asteroid within 1,000 meters
if (vm_vec_dist_quick(&targetPos, &Objects[Asteroids[n].objnum].pos) < 1000)
return false;
// asteroid
if (Asteroids[n].flags & AF_USED)
{
// Cannot autopilot if asteroid within AutopilotMinAsteroidDistance meters
if (vm_vec_dist_quick(&targetPos, &Objects[Asteroids[n].objnum].pos) < AutopilotMinAsteroidDistance) {
if (send_msg)
send_autopilot_msgID(NP_MSG_FAIL_HAZARD);
return false;
}
}
}
}
// check for support ships
// cannot autopilot if support ship present
if ( ship_find_repair_ship(Player_obj) != NULL ) {
if (send_msg)
send_autopilot_msgID(NP_MSG_FAIL_SUPPORT_PRESENT);
return false;
}
return true;
}
extern object* Autopilot_flight_leader;
// ********************************************************************************************
// Engages autopilot
// This does:
@@ -263,13 +232,54 @@ bool CanAutopilotPos(vec3d targetPos)
// * Lock time compression -WMC
// * Tell AI to fly to targetted Nav Point (for all nav-status wings/ships)
// * Sets max waypoint speed to the best-speed of the slowest ship tagged
void StartAutopilot()
bool StartAutopilot()
{
// Check for support ship and dismiss it if it is not doing anything.
// If the support ship is doing something then tell the user such.
bool done = false;
while (!done) {
object* support_ship_op = ship_find_repair_ship(Player_obj);
if ( support_ship_op == NULL ) {
// no more
done = true;
break;
}
Assert( support_ship_op->type == OBJ_SHIP );
Assert( support_ship_op->instance >= 0 );
Assert( support_ship_op->instance < MAX_SHIPS );
Assert( Ships[support_ship_op->instance].ai_index != -1 );
ai_info* support_ship_aip = &(Ai_info[Ships[support_ship_op->instance].ai_index]);
// is support ship trying to rearm-repair
if ( ai_find_goal_index( support_ship_aip->goals, AI_GOAL_REARM_REPAIR ) == -1 ) {
// no, so tell it to depart
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_WARP, -1, NULL, support_ship_aip );
} else {
// yes
send_autopilot_msgID(NP_MSG_FAIL_SUPPORT_WORKING);
return false;
}
}
if (!CanAutopilot())
return;
return false;
AutoPilotEngaged = true;
// find the ship that is "leading" all of the ships when the player starts
// autopilot
// by default the ship that is leading the autopilot session the player's
// wing leader (if the player is the wing leader then it will be the
// player).
// TODO:implement a way to allow a FREDer to say a different ship is leader
Autopilot_flight_leader = get_wing_leader(Player_ship->wingnum);
if ( Autopilot_flight_leader == NULL ) {
// force player to be the leader if he doesn't have a wing
Autopilot_flight_leader = Player_obj;
}
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
LockAPConv = timestamp(); // lock convergence instantly
else
@@ -328,10 +338,20 @@ void StartAutopilot()
}
}
// damp speed_cap to 90% of actual -- to make sure ships stay in formation
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
speed_cap = 0.90f * speed_cap;
if ( speed_cap < 1.0f ) {
/* We need to deal with this so that incorrectly flagged ships will not
cause the engine to fail to limit all the ships speeds correctly. */
Warning(LOCATION, "Ship speed cap is way too small (%f)!\n"
"This is normally caused by a ship that has nav-carry-status set, but cannot move itself (like a Cargo container).\n"
"Speed cap has been set to 1.0 m/s.",
speed_cap);
speed_cap = 1.0f;
}
ramp_bias = speed_cap/50.0f;
// assign ship goals
@@ -397,10 +417,10 @@ void StartAutopilot()
vm_vector_2_matrix(&Objects[Ships[i].objnum].orient, &norm1, NULL, NULL);
}
// snap wings into formation them into formation
// snap wings into formation
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS && // only if using cinematics
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY) // only if in a wing
&& Player_obj != &Objects[Ships[i].objnum]) //only if not player object
&& Autopilot_flight_leader != &Objects[Ships[i].objnum]) //only if not flight leader's object
{
ai_info *aip = &Ai_info[Ships[i].ai_index];
int wingnum = aip->wing, wing_index = get_wing_index(&Objects[Ships[i].objnum], wingnum);
@@ -419,33 +439,34 @@ void StartAutopilot()
switch (wcount % 2)
{
case 1: // back-left
vm_vec_add(&perp, &zero, &Player_obj->orient.vec.rvec);
vm_vec_add(&perp, &zero, &Autopilot_flight_leader->orient.vec.rvec);
//vm_vec_sub(&perp, &perp, &Player_obj->orient.vec.fvec);
vm_vec_normalize(&perp);
vm_vec_scale(&perp, -166.0f*j); // 166m is supposedly the optimal range according to tolwyn
vm_vec_add(&goal_point, &Player_obj->pos, &perp);
vm_vec_add(&goal_point, &Autopilot_flight_leader->pos, &perp);
break;
default: //back-right
case 0:
vm_vec_add(&perp, &zero, &Player_obj->orient.vec.rvec);
vm_vec_add(&perp, &zero, &Autopilot_flight_leader->orient.vec.rvec);
//vm_vec_sub(&perp, &perp, &Player_obj->orient.vec.fvec);
vm_vec_normalize(&perp);
vm_vec_scale(&perp, 166.0f*j);
vm_vec_add(&goal_point, &Player_obj->pos, &perp);
vm_vec_add(&goal_point, &Autopilot_flight_leader->pos, &perp);
break;
}
autopilot_wings[wingnum] = wcount;
wcount++;
}
Objects[Ships[i].objnum].pos = goal_point;
if (vm_vec_dist_quick(&Player_obj->pos, &Objects[Ships[i].objnum].pos) > distance)
if (vm_vec_dist_quick(&Autopilot_flight_leader->pos, &Objects[Ships[i].objnum].pos) > distance)
{
distance = vm_vec_dist_quick(&Player_obj->pos, &Objects[Ships[i].objnum].pos);
distance = vm_vec_dist_quick(&Autopilot_flight_leader->pos, &Objects[Ships[i].objnum].pos);
}
}
// lock primary and secondary weapons
//Ships[i].flags2 |= (SF2_PRIMARIES_LOCKED | SF2_SECONDARIES_LOCKED);
if ( LockWeaponsDuringAutopilot )
Ships[i].flags2 |= (SF2_PRIMARIES_LOCKED | SF2_SECONDARIES_LOCKED);
// clear the ship goals and cap the waypoint speed
ai_clear_ship_goals(&Ai_info[Ships[i].ai_index]);
@@ -540,9 +561,9 @@ void StartAutopilot()
vec3d right, front, up, offset;
for (i = 0; i < (int)capIndexes.size(); i++)
{
vm_vec_add(&right, &Player_obj->orient.vec.rvec, &zero);
vm_vec_add(&front, &Player_obj->orient.vec.fvec, &zero);
vm_vec_add(&up, &Player_obj->orient.vec.uvec, &zero);
vm_vec_add(&right, &Autopilot_flight_leader->orient.vec.rvec, &zero);
vm_vec_add(&front, &Autopilot_flight_leader->orient.vec.fvec, &zero);
vm_vec_add(&up, &Autopilot_flight_leader->orient.vec.uvec, &zero);
vm_vec_add(&offset, &zero, &zero);
if (Ship_info[Ships[capIndexes[i]].ship_info_index].flags & (SIF_CAPITAL | SIF_SUPERCAP))
{
@@ -610,7 +631,7 @@ void StartAutopilot()
vm_vec_scale(&up, (1+((float)floor((float)capship_placed[1]/3))));
// move ourselves up and out of the way of the smaller ships
vm_vec_add(&perp, &Player_obj->orient.vec.uvec, &zero);
vm_vec_add(&perp, &Autopilot_flight_leader->orient.vec.uvec, &zero);
vm_vec_scale(&perp, capship_spreads[2]);
vm_vec_add(&up, &up, &perp);
@@ -665,7 +686,7 @@ void StartAutopilot()
vm_vec_scale(&front, 2*(1+((float)floor((float)capship_placed[2]/3))));
// move "out" by 166*(wcount-1) so we don't bump into fighters
vm_vec_add(&perp, &Player_obj->orient.vec.rvec, &zero);
vm_vec_add(&perp, &Autopilot_flight_leader->orient.vec.rvec, &zero);
vm_vec_scale(&perp, 166.0f*float(wcount-1));
if ( (capship_placed[2] % 2) == 0)
vm_vec_add(&right, &right, &perp);
@@ -687,16 +708,16 @@ void StartAutopilot()
// global scale the position by 50%
//vm_vec_scale(&offset, 1.5);
vm_vec_add(&Objects[Ships[capIndexes[i]].objnum].pos, &Player_obj->pos, &offset);
vm_vec_add(&Objects[Ships[capIndexes[i]].objnum].pos, &Autopilot_flight_leader->pos, &offset);
if (vm_vec_dist_quick(&Player_obj->pos, &Objects[Ships[i].objnum].pos) > distance)
if (vm_vec_dist_quick(&Autopilot_flight_leader->pos, &Objects[Ships[i].objnum].pos) > distance)
{
distance = vm_vec_dist_quick(&Player_obj->pos, &Objects[Ships[i].objnum].pos);
distance = vm_vec_dist_quick(&Autopilot_flight_leader->pos, &Objects[Ships[i].objnum].pos);
}
}
}
ftemp = floor(Player_obj->phys_info.max_vel.xyz.z/speed_cap);
ftemp = floor(Autopilot_flight_leader->phys_info.max_vel.xyz.z/speed_cap);
if (ftemp >= 2.0f && ftemp < 4.0f)
tc_factor = 2;
else if (ftemp >= 4.0f && ftemp < 8.0f)
@@ -708,11 +729,11 @@ void StartAutopilot()
tpos = *Navs[CurrentNav].GetPosition();
// determine distance toward nav at which camera will be
vm_vec_sub(&pos, &tpos, &Player_obj->pos);
vm_vec_sub(&pos, &tpos, &Autopilot_flight_leader->pos);
vm_vec_normalize(&pos); // pos is now a unit vector in the direction we will be moving the camera
//norm1 = pos;
vm_vec_scale(&pos, 5*speed_cap*tc_factor); // pos is now scaled by 5 times the speed (5 seconds ahead)
vm_vec_add(&pos, &pos, &Player_obj->pos); // pos is now 5*speed cap in front of player ship
vm_vec_add(&pos, &pos, &Autopilot_flight_leader->pos); // pos is now 5*speed cap in front of player ship
switch (myrand()%24)
// 8 different ways of getting perp points
@@ -723,74 +744,74 @@ void StartAutopilot()
case 9:
case 16:
if (capship_placed[0] == 0)
vm_vec_sub(&perp, &zero, &Player_obj->orient.vec.uvec);
vm_vec_sub(&perp, &zero, &Autopilot_flight_leader->orient.vec.uvec);
else
{ // become up-left
vm_vec_add(&perp, &zero, &Player_obj->orient.vec.uvec);
vm_vec_sub(&perp, &perp, &Player_obj->orient.vec.rvec);
vm_vec_add(&perp, &zero, &Autopilot_flight_leader->orient.vec.uvec);
vm_vec_sub(&perp, &perp, &Autopilot_flight_leader->orient.vec.rvec);
}
break;
case 2: // up
case 10:
case 23:
vm_vec_add(&perp, &perp, &Player_obj->orient.vec.uvec);
vm_vec_add(&perp, &perp, &Autopilot_flight_leader->orient.vec.uvec);
if (capshipPresent) // become up-right
vm_vec_add(&perp, &perp, &Player_obj->orient.vec.rvec);
vm_vec_add(&perp, &perp, &Autopilot_flight_leader->orient.vec.rvec);
break;
case 3: // left
case 11:
case 22:
vm_vec_sub(&perp, &zero, &Player_obj->orient.vec.rvec);
vm_vec_sub(&perp, &zero, &Autopilot_flight_leader->orient.vec.rvec);
break;
case 4: // up-left
case 12:
case 21:
vm_vec_sub(&perp, &zero, &Player_obj->orient.vec.rvec);
vm_vec_add(&perp, &perp, &Player_obj->orient.vec.uvec);
vm_vec_sub(&perp, &zero, &Autopilot_flight_leader->orient.vec.rvec);
vm_vec_add(&perp, &perp, &Autopilot_flight_leader->orient.vec.uvec);
break;
case 5: // up-right
case 13:
case 20:
vm_vec_add(&perp, &zero, &Player_obj->orient.vec.rvec);
vm_vec_add(&perp, &perp, &Player_obj->orient.vec.uvec);
vm_vec_add(&perp, &zero, &Autopilot_flight_leader->orient.vec.rvec);
vm_vec_add(&perp, &perp, &Autopilot_flight_leader->orient.vec.uvec);
break;
case 6: // down-left
case 14:
case 19:
vm_vec_sub(&perp, &zero, &Player_obj->orient.vec.rvec);
vm_vec_sub(&perp, &zero, &Autopilot_flight_leader->orient.vec.rvec);
if (capship_placed[0] < 2)
vm_vec_sub(&perp, &perp, &Player_obj->orient.vec.uvec);
vm_vec_sub(&perp, &perp, &Autopilot_flight_leader->orient.vec.uvec);
else
vm_vec_add(&perp, &perp, &Player_obj->orient.vec.uvec);
vm_vec_add(&perp, &perp, &Autopilot_flight_leader->orient.vec.uvec);
break;
case 7: // down-right
case 15:
case 18:
vm_vec_add(&perp, &zero, &Player_obj->orient.vec.rvec);
vm_vec_add(&perp, &zero, &Autopilot_flight_leader->orient.vec.rvec);
if (capship_placed[0] < 1)
vm_vec_sub(&perp, &perp, &Player_obj->orient.vec.uvec);
vm_vec_sub(&perp, &perp, &Autopilot_flight_leader->orient.vec.uvec);
else
vm_vec_add(&perp, &perp, &Player_obj->orient.vec.uvec);
vm_vec_add(&perp, &perp, &Autopilot_flight_leader->orient.vec.uvec);
break;
default:
case 0: // right
case 8:
case 17:
perp = Player_obj->orient.vec.rvec;
perp = Autopilot_flight_leader->orient.vec.rvec;
break;
}
vm_vec_normalize(&perp);
//vm_vec_scale(&perp, 2*radius+distance);
vm_vec_scale(&perp, Player_obj->radius+radius);
vm_vec_scale(&perp, Autopilot_flight_leader->radius+radius);
// randomly scale up/down by up to 20%
j = 20-myrand()%40; // [-20,20]
@@ -830,16 +851,8 @@ void StartAutopilot()
camMovingTime = int(4.5*float(tc_factor));
set_time_compression((float)tc_factor);
}
}
// ********************************************************************************************
// Checks if autopilot should automatically die
// Returns true if:
// * Targetted waypoint < 10,000 meters away
// * Enemy < 10,000 meters
bool Autopilot_AutoDiable()
{
return !CanAutopilot();
return true;
}
// ********************************************************************************************
@@ -852,6 +865,8 @@ void EndAutoPilot()
{
AutoPilotEngaged = false;
Autopilot_flight_leader = NULL;
set_time_compression(1);
lock_time_compression(false);
Player_use_ai = 0;
@@ -899,8 +914,10 @@ void EndAutoPilot()
)
{
//unlock their weaponry
//Ships[i].flags2 &= ~(SF2_PRIMARIES_LOCKED | SF2_SECONDARIES_LOCKED);
if ( LockWeaponsDuringAutopilot )
Ships[i].flags2 &= ~(SF2_PRIMARIES_LOCKED | SF2_SECONDARIES_LOCKED);
Ai_info[Ships[i].ai_index].waypoint_speed_cap = -1; // uncap their speed
Ai_info[Ships[i].ai_index].mode = AIM_NONE; // make AI re-evaluate current ship mode
for (j = 0; j < MAX_AI_GOALS; j++)
{
@@ -975,34 +992,54 @@ camera* nav_get_set_camera()
void nav_warp(bool prewarp=false)
{
// ok... find our end distance - norm1 is still a unit vector in the direction from the player to the navpoint
vec3d targetPos, tpos=Player_obj->pos, pos;
vm_vec_sub(&pos, Navs[CurrentNav].GetPosition(), &Player_obj->pos);
/* ok... find our end distance - norm1 is still a unit vector in the
direction from the flight leader to the navpoint */
vec3d targetPos, tpos=Autopilot_flight_leader->pos, pos, velocity;
/* calculate a vector that we can use to make a path from the flight
leader's location to the nav point */
vm_vec_sub(&pos, Navs[CurrentNav].GetPosition(), &Autopilot_flight_leader->pos);
vm_vec_normalize(&pos);
velocity = pos; // make a copy for later when we do setup veleocity vector
vm_vec_scale(&pos, 250.0f); // we move by increments of 250
while (CanAutopilotPos(tpos))
/* using the vector of the flight leaders's path, simulate moving the
flight along this path by checking the autopilot conditions as specific
intervals along the path*/
while (CanAutopilot(tpos))
{
vm_vec_add(&tpos, &tpos, &pos);
}
vm_vec_sub(&targetPos, &tpos, &Player_obj->pos); //targetPos is actually a projection in a the direction toward the nav
vm_vec_sub(&targetPos, &tpos, &Autopilot_flight_leader->pos);
/* targetPos is actually a vector that describes the exact 3D movement that
the flgith leader needs to execute to reach the location that the auto
pilot is to shut off */
// Check if we are actually just setting up for the cinimatic shot of the
// flight flying on autopilot. Only jump halfway. Also we also need to
// put the camera in the correct position to show the player this cinimatic
if (prewarp)
{
vm_vec_scale(&targetPos, 0.5);
vm_vec_add(&cameraPos, &cameraPos, &targetPos);
}
/* calcuate the speed that everyone is supposed to be going so that there
is no need for anyone to accelerate or decelerate (most obvious with
the player's fighter slowing down as it changes the camera pan speed). */
Assert( Ai_info[Ships[Autopilot_flight_leader->instance].ai_index].waypoint_speed_cap > 0 );
vm_vec_scale(&velocity, (float)Ai_info[Ships[Autopilot_flight_leader->instance].ai_index].waypoint_speed_cap);
// Find all ships that are supposed to autopilot with the player and move them
// to the cinimatic location or the final destination
for (int i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1 &&
(Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)
)
)
if (Ships[i].objnum != -1
&& (Ships[i].flags2 & SF2_NAVPOINT_CARRY
|| (Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)))
{
vm_vec_add(&Objects[Ships[i].objnum].pos, &Objects[Ships[i].objnum].pos, &targetPos);
Objects[Ships[i].objnum].phys_info.vel = velocity;
}
}
@@ -1041,7 +1078,7 @@ void NavSystem_Do()
}
if (timestamp() >= EndAPCinematic || Autopilot_AutoDiable())
if (timestamp() >= EndAPCinematic || !CanAutopilot())
{
nav_warp();
EndAutoPilot();
@@ -1060,7 +1097,7 @@ void NavSystem_Do()
if(cam != NULL)
{
cam->set_position(&cameraPos);
cam->set_rotation_facing(&Player_obj->pos);
cam->set_rotation_facing(&Autopilot_flight_leader->pos);
}
CinematicStarted = true;
@@ -1068,7 +1105,7 @@ void NavSystem_Do()
}
else
{
if (Autopilot_AutoDiable())
if (!CanAutopilot())
EndAutoPilot();
}
@@ -1141,7 +1178,10 @@ void NavSystem_Do()
}
}
// autopilot linking
/* Link in any ships that need to be linked in when the player gets close
enough. Always done by the player because: "making sure the AI fighters
are where they're supposed to be at all times is like herding cats" -Woolie Wool
*/
for (int i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1 && Ships[i].flags2 & SF2_NAVPOINT_NEEDSLINK)
@@ -1191,7 +1231,7 @@ void send_autopilot_msg(char *msg, char *snd)
// send/play
if (audio_handle != -1)
{
audiostream_play(audio_handle, Master_event_music_volume, 0);
audiostream_play(audio_handle, (Master_event_music_volume * aav_music_volume), 0);
}
if (strlen(msg) != 0 && strcmp(msg, "none"))
@@ -1247,6 +1287,21 @@ void parse_autopilot_table(char *filename)
required_string("$Link Distance:");
stuff_int(&NavLinkDistance);
if (optional_string("$Interrupt autopilot if enemy within distance:"))
stuff_int(&AutopilotMinEnemyDistance);
else
AutopilotMinEnemyDistance = 5000;
if (optional_string("$Interrupt autopilot if asteroid within distance:"))
stuff_int(&AutopilotMinAsteroidDistance);
else
AutopilotMinAsteroidDistance = 1000;
if (optional_string("$Lock Weapons During Autopilot:"))
stuff_boolean(&LockWeaponsDuringAutopilot);
else
LockWeaponsDuringAutopilot = false;
// optional no cutscene bars
if (optional_string("+No_Cutscene_Bars"))
UseCutsceneBars = false;
@@ -1255,7 +1310,9 @@ void parse_autopilot_table(char *filename)
Cmdline_autopilot_interruptable = 0;
// No Nav selected message
char *msg_tags[] = { "$No Nav Selected:", "$Gliding:", "$Too Close:", "$Hostiles:", "$Linked:", "$Hazard:" };
char *msg_tags[] = { "$No Nav Selected:", "$Gliding:",
"$Too Close:", "$Hostiles:", "$Linked:", "$Hazard:",
"$Support Present:", "$Support Working:" };
for (int i = 0; i < NP_NUM_MESSAGES; i++)
{
required_string(msg_tags[i]);
+17 -13
View File
@@ -8,6 +8,7 @@
#define _AUTOPILOT_H_
#include "globalincs/pstypes.h"
#include "object/object.h"
#include <map>
// milliseconds between updates
@@ -37,13 +38,15 @@ struct NavPoint
};
#define NP_NUM_MESSAGES 6
#define NP_MSG_FAIL_NOSEL 0
#define NP_MSG_FAIL_GLIDING 1
#define NP_MSG_FAIL_TOCLOSE 2
#define NP_MSG_FAIL_HOSTILES 3
#define NP_MSG_MISC_LINKED 4
#define NP_MSG_FAIL_HAZARD 5
#define NP_MSG_FAIL_SUPPORT_PRESENT 6
#define NP_MSG_FAIL_SUPPORT_WORKING 7
#define NP_NUM_MESSAGES 8
struct NavMessage
{
@@ -62,27 +65,28 @@ extern std::map<int,int> autopilot_wings;
bool Sel_NextNav();
// Tell us is autopilot is allow
// Tell us if autopilot is allowed
// This needs:
// * Nav point selected
// * No enemies within 5,000 meters
// * No enemies within AutopilotMinEnemyDistance meters
// * No asteroids within AutopilotMinAsteroidDistance meters
// * Destination > 1,000 meters away
bool CanAutopilot(bool send_msg=false);
bool CanAutopilotPos(vec3d targetPos);
// * Support ship not present or is actively leaving
bool CanAutopilot(vec3d targetPos, bool send_msg=false);
// Check if autopilot is allowed at player's current position
// See CanAutopilot(vec3d, bool) for more information
inline bool CanAutopilot(bool send_msg=false) { return CanAutopilot(Player_obj->pos, send_msg); }
// Engages autopilot
// This does:
// * Checks if Autopilot is allowed. See CanAutopilot() for conditions.
// * Control switched from player to AI
// * Time compression to 32x
// * Tell AI to fly to targetted Nav Point (for all nav-status wings/ships)
// * Sets max waypoint speed to the best-speed of the slowest ship tagged
void StartAutopilot();
// Checks if autopilot should automatically die
// Returns true if:
// * Targetted waypoint < 1,000 meters away
// * Enemy < 5,000 meters
bool Autopilot_AutoDiable();
// * Sets max waypoint speed to the best-speed of the slowest ship tagged
// Returns false if autopilot cannot be started. True otherwise.
bool StartAutopilot();
// Disengages autopilot
// this does:
+5 -11
View File
@@ -534,7 +534,7 @@ int bm_load( char *real_filename )
}
if (free_slot < 0) {
Int3();
Assertion(free_slot < 0, "Could not find free BMPMAN slot for bitmap: %s", real_filename);
goto Done;
}
@@ -1046,7 +1046,7 @@ int bm_get_info( int handle, int *w, int * h, ubyte * flags, int *nframes, int *
}
#endif
Assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE!
Assertion( bm_bitmaps[bitmapnum].handle == handle, "Invalid bitmap handle %d passed to bm_get_info().\nThis might be due to an invalid animation somewhere else.\n", handle ); // INVALID BITMAP HANDLE!
if ( (bm_bitmaps[bitmapnum].type == BM_TYPE_NONE) || (bm_bitmaps[bitmapnum].handle != handle) ) {
if (w) *w = 0;
@@ -1089,7 +1089,7 @@ unsigned int bm_get_signature(int handle)
if ( !bm_inited ) bm_init();
int bitmapnum = handle % MAX_BITMAPS;
Assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE
Assertion( bm_bitmaps[bitmapnum].handle == handle, "Invalid bitmap handle %d passed to bm_get_signature().\nThis might be due to an invalid animation somewhere else.\n", handle ); // INVALID BITMAP HANDLE!
return bm_bitmaps[bitmapnum].signature;
}
@@ -1100,7 +1100,7 @@ ubyte bm_get_type(int handle)
if ( !bm_inited ) bm_init();
int bitmapnum = handle % MAX_BITMAPS;
Assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE
Assertion( bm_bitmaps[bitmapnum].handle == handle, "Invalid bitmap handle %d passed to bm_get_type().\nThis might be due to an invalid animation somewhere else.\n", handle ); // INVALID BITMAP HANDLE!
return bm_bitmaps[bitmapnum].type;
}
@@ -1597,13 +1597,7 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags )
int bitmapnum = handle % MAX_BITMAPS;
#ifndef NDEBUG
if(bm_bitmaps[bitmapnum].handle != handle) {
mprintf(("bm_lock - %s: bm_bitmaps[%d].handle = %d, handle = %d\n", bm_bitmaps[bitmapnum].filename, bitmapnum, bm_bitmaps[bitmapnum].handle, handle));
}
#endif
Assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE
Assertion( bm_bitmaps[bitmapnum].handle == handle, "Invalid handle %d passed to bm_lock. This might be due to an animation elsewhere in the code being too short.\n", handle ); // INVALID BITMAP HANDLE
// flags &= (~BMP_RLE);
+8 -50
View File
@@ -78,7 +78,7 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
{ CF_TYPE_SQUAD_IMAGES, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "squads", ".pcx .png .dds", CF_TYPE_PLAYERS },
{ CF_TYPE_SINGLE_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "single", ".pl2 .cs2 .plr .csg .css", CF_TYPE_PLAYERS },
{ CF_TYPE_MULTI_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "multi", ".plr", CF_TYPE_PLAYERS },
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx .tsb", CF_TYPE_DATA }, //clr=cached color
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .bx", CF_TYPE_DATA }, //clr=cached color
{ CF_TYPE_MULTI_CACHE, "data" DIR_SEPARATOR_STR "multidata", ".pcx .png .dds .fs2 .txt", CF_TYPE_DATA },
{ CF_TYPE_MISSIONS, "data" DIR_SEPARATOR_STR "missions", ".fs2 .fc2 .ntl .ssv", CF_TYPE_DATA },
{ CF_TYPE_CONFIG, "data" DIR_SEPARATOR_STR "config", ".cfg", CF_TYPE_DATA },
@@ -147,9 +147,14 @@ int cfile_in_root_dir(char *exe_path)
token_count++;
tok = strtok(NULL, DIR_SEPARATOR_STR);
} while(tok != NULL);
// root directory if we have <= 1 slash
#ifdef SCP_UNIX
// /freespace works, / does not
if(token_count <= 1) {
#else
// C:/freespace works, C:/ does not
if(token_count <= 2){
#endif
return 1;
}
@@ -813,53 +818,6 @@ CFILE *cfopen_special(char *file_path, char *mode, const int size, const int off
// it's a normal file
return cf_open_fill_cfblock(fp, dir_type);
}
/* char longname[_MAX_PATH];
if ( !cfile_inited ) {
Int3();
return NULL;
}
//================================================
// Check that all the parameters make sense
Assert( file_path && strlen(file_path) );
Assert( mode != NULL );
if ( (ext_num <= 0) || (!ext_list) ) {
Int3();
return NULL;
}
// cfopen_ext() only supports reading files, not creating them
if ( strchr(mode, 'w') ) {
Int3();
return NULL;
}
//================================================
// Search for file on disk, on cdrom, or in a packfile
int offset, size;
char copy_file_path[MAX_PATH_LEN]; // FIX change in memory from cf_find_file_location
strcpy_s(copy_file_path, file_path);
if ( cf_find_file_location_ext(copy_file_path, ext_num, ext_list, dir_type, sizeof(longname) - 1, longname, &size, &offset, localize) ) {
// Fount it, now create a cfile out of it
FILE *fp = fopen( longname, "rb" );
if ( fp ) {
if ( offset ) {
// Found it in a pack file
return cf_open_packed_cfblock(fp, dir_type, offset, size );
} else {
// Found it in a normal file
return cf_open_fill_cfblock(fp, dir_type);
}
}
}
return NULL;*/
}
+1 -1
View File
@@ -1168,7 +1168,7 @@ int cf_find_file_location_ext( char *filename, const int ext_num, const char **e
int last_root_index = -1;
int last_path_index = -1;
file_list_index.reserve(Num_files);
file_list_index.reserve( MIN(ext_num * 4, Num_files) );
// next, run though and pick out base matches
for (i = 0; i < Num_files; i++) {
+74 -46
View File
@@ -50,6 +50,7 @@ public:
int get_int();
float get_float();
char *str();
bool check_if_args_is_valid();
};
static cmdline_parm Parm_list(NULL, NULL);
@@ -76,6 +77,9 @@ enum
#define BUILD_CAP_OPENAL (1<<0)
#define BUILD_CAP_NO_D3D (1<<1)
#define BUILD_CAP_NEW_SND (1<<2)
#define PARSE_COMMAND_LINE_STRING "-parse_cmdline_only"
typedef struct
{
@@ -134,8 +138,6 @@ Flag exe_params[] =
{ "-3dwarp", "Enable 3d warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dwarp", },
{ "-warp_flash", "Enable flash upon warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-warp_flash", },
{ "-no_ap_interrupt", "Disable interrupting autopilot", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_ap_interrupt", },
{ "-tbp", "Toggle features for The Babylon Project", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-tbp", }, // TBP warp effects -Et1
{ "-wcsaga", "Toggle features for Wing Commander Saga", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-wcsaga", },
{ "-snd_preload", "Preload mission game sounds", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-snd_preload", },
{ "-nosound", "Disable sound and music", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nosound", },
@@ -163,6 +165,8 @@ Flag exe_params[] =
{ "-disable_fbo", "Disable OpenGL RenderTargets", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-no_glsl", "Disable GLSL (shader) support", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-ati_swap", "Fix Color issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://scp.indiegames.us/mantis/view.php?id=1669", },
{ "-no_3d_sound", "Use only 2D/stereo for sound effects", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-disable_glsl_model","Don't use shaders for model rendering", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-ingame_join", "Allows ingame joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
{ "-voicer", "Voice recognition", true, 0, EASY_DEFAULT, "Experimental", "", },
@@ -172,7 +176,7 @@ Flag exe_params[] =
{ "-pos", "Show position of camera", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pos", },
{ "-window", "Run in window", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-window", },
{ "-fullscreen_window", "Run in fullscreen window", false, 0, EASY_DEFAULT, "Dev Tool", "", },
{ "-timerbar", "", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-timerbar", },
{ "-stats", "Show statistics", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stats", },
{ "-coords", "Show coordinates", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-coords", },
{ "-show_mem_usage", "Show memory usage", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-show_mem_usage", },
@@ -249,7 +253,6 @@ 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 cell_arg("-cell", NULL); // Cmdline_cell
cmdline_parm decals("-decals", NULL); // Cmdline_decals
cmdline_parm env("-env", NULL); // Cmdline_env
cmdline_parm mipmap_arg("-mipmap", NULL); // Cmdline_mipmap
cmdline_parm missile_lighting_arg("-missile_lighting", NULL); // Cmdline_missile_lighting
@@ -269,7 +272,6 @@ float Cmdline_fov = 0.75f;
float Cmdline_ogl_spec = 80.0f;
int Cmdline_ambient_factor = 128;
int Cmdline_cell = 0;
int Cmdline_decals = 0;
int Cmdline_env = 0;
int Cmdline_mipmap = 0;
int Cmdline_missile_lighting = 0;
@@ -332,12 +334,8 @@ int Cmdline_voice_recognition = 0;
// MOD related
cmdline_parm mod_arg("-mod", NULL, true); // Cmdline_mod -- DTP modsupport
cmdline_parm tbp("-tbp", NULL); // Cmdline_tbp -- TBP warp effects -Et1
cmdline_parm wcsaga("-wcsaga", NULL); // Cmdline_wcsaga
char *Cmdline_mod = NULL; //DTP for mod arguement
int Cmdline_tbp = 0;
int Cmdline_wcsaga = 0;
// Multiplayer/Network related
cmdline_parm almission_arg("-almission", NULL); // Cmdline_almission -- DTP for autoload Multi mission
@@ -366,6 +364,8 @@ cmdline_parm safeloading_arg("-safeloading", NULL); // Cmdline_safeloading -- U
cmdline_parm no_fbo_arg("-disable_fbo", NULL); // Cmdline_no_fbo
cmdline_parm noglsl_arg("-no_glsl", NULL); // Cmdline_noglsl -- disable GLSL support in OpenGL
cmdline_parm atiswap_arg("-ati_swap", NULL); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
cmdline_parm no3dsound_arg("-no_3d_sound", NULL); // Cmdline_no_3d_sound - Disable use of full 3D sounds
cmdline_parm no_glsl_models_arg("-disable_glsl_model", NULL); // Cmdline_no_glsl_model_rendering -- switches model rendering to fixed pipeline
int Cmdline_d3d_lesstmem = 0;
int Cmdline_load_all_weapons = 0;
@@ -378,6 +378,8 @@ int Cmdline_safeloading = 0;
int Cmdline_no_fbo = 0;
int Cmdline_noglsl = 0;
int Cmdline_ati_color_swap = 0;
int Cmdline_no_3d_sound = 0;
int Cmdline_no_glsl_model_rendering = 0;
// Developer/Testing related
cmdline_parm start_mission_arg("-start_mission", NULL); // Cmdline_start_mission
@@ -385,6 +387,7 @@ 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
cmdline_parm nowarn_arg("-no_warn", NULL); // Cmdline_nowarn
cmdline_parm extra_warn_arg("-extra_warn", NULL); // Cmdline_extra_warn
cmdline_parm fps_arg("-fps", NULL); // Cmdline_show_fps
cmdline_parm show_mem_usage_arg("-show_mem_usage", NULL); // Cmdline_show_mem_usage
cmdline_parm pos_arg("-pos", NULL); // Cmdline_show_pos
@@ -396,6 +399,7 @@ cmdline_parm window_arg("-window", NULL); // Cmdline_window
cmdline_parm fullscreen_window_arg("-fullscreen_window",NULL);
cmdline_parm res_arg("-res", NULL); // Cmdline_lores
cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps -- spew VP crcs to vp_crcs.txt
cmdline_parm parse_cmdline_only(PARSE_COMMAND_LINE_STRING, NULL);
#ifdef SCP_UNIX
cmdline_parm no_grab("-nograb", NULL); // Cmdline_no_grab
#endif
@@ -405,6 +409,7 @@ int Cmdline_dis_collisions = 0;
int Cmdline_dis_weapons = 0;
int Cmdline_noparseerrors = 0;
int Cmdline_nowarn = 0; // turn warnings off in FRED
int Cmdline_extra_warn = 0;
int Cmdline_show_mem_usage = 0;
int Cmdline_show_pos = 0;
int Cmdline_show_stats = 0;
@@ -603,8 +608,8 @@ void os_validate_parms(char *cmdline)
char *token;
int parm_found;
token = strtok(cmdline, seps);
while(token != NULL) {
token = strtok(cmdline, seps);
while(token != NULL) {
if (token[0] == '-') {
parm_found = 0;
@@ -677,6 +682,12 @@ void os_init_cmdline(char *cmdline)
{
FILE *fp;
bool parse_config = true;
if (strstr(cmdline, PARSE_COMMAND_LINE_STRING) != NULL) {
parse_config = false;
}
// read the cmdline.cfg file from the data folder, and pass the command line arguments to
// the the parse_parms and validate_parms line. Read these first so anything actually on
// the command line will take precedence
@@ -701,7 +712,7 @@ void os_init_cmdline(char *cmdline)
#endif
// if the file exists, get a single line, and deal with it
if ( fp ) {
if ( fp && parse_config ) {
char *buf, *p;
size_t len = filelength( fileno(fp) ) + 2;
@@ -800,6 +811,21 @@ cmdline_parm::~cmdline_parm()
#endif
}
// checks if the objects args variable is valid
// returns true if it is, shows an error box and returns false if not valid.
bool cmdline_parm::check_if_args_is_valid() {
if ( args == NULL ) {
Error(__FILE__, __LINE__,
"Command line flag passed that requires an argument, but the argument is missing!\r\n"
"The flag is '%s', make sure that you have an argument that follows it.\r\n"
"You may need to close your launcher and remove the flag manually from %s/data/cmdline_fso.cfg\r\n",
name, "<Freespace directory>");
return false;
} else {
return true;
}
}
// returns - true if the parameter exists on the command line, otherwise false
int cmdline_parm::found()
@@ -810,7 +836,8 @@ int cmdline_parm::found()
// returns - the interger representation for the parameter arguement
int cmdline_parm::get_int()
{
Assert(args);
check_if_args_is_valid();
int offset = 0;
if (stacks) {
@@ -833,7 +860,8 @@ int cmdline_parm::get_int()
// returns - the float representation for the parameter arguement
float cmdline_parm::get_float()
{
Assert(args!=NULL);
check_if_args_is_valid();
int offset = 0;
if (stacks) {
@@ -856,7 +884,8 @@ float cmdline_parm::get_float()
// returns - the string value for the parameter arguement
char *cmdline_parm::str()
{
Assert(args);
check_if_args_is_valid();
return args;
}
@@ -891,8 +920,15 @@ bool SetCmdlineParams()
Cmdline_FRED2_htl = 1;
}*/
if (extra_warn_arg.found())
{
Cmdline_extra_warn = 1;
}
if (timerbar_arg.found()) {
Cmdline_timerbar = 1;
#ifdef WIN32
MessageBox(NULL, "the timerbar has been disabled in builds after August 31, 2010. Please remove the \"-timerbar\" command line from the launcher to prevent this message from appearing the the future.", "", MB_OK | MB_ICONINFORMATION);
#endif
}
if ( missioncrcspew_arg.found() ) {
@@ -913,9 +949,11 @@ bool SetCmdlineParams()
}
}
// is this a standalone server??
if (standalone_arg.found()) {
Is_standalone = 1;
if (!Fred_running) { //There is no standalone FRED
// is this a standalone server??
if (standalone_arg.found()) {
Is_standalone = 1;
}
}
// object update control
@@ -1137,7 +1175,12 @@ bool SetCmdlineParams()
}
if ( fov_arg.found() ) {
VIEWER_ZOOM_DEFAULT = Cmdline_fov = fov_arg.get_float();
Cmdline_fov = fov_arg.get_float();
if (Cmdline_fov > 0.1) {
VIEWER_ZOOM_DEFAULT = Cmdline_fov;
} else {
VIEWER_ZOOM_DEFAULT = Cmdline_fov = 0.75f;
}
}
if( clip_dist_arg.found() ) {
@@ -1149,16 +1192,6 @@ bool SetCmdlineParams()
Cmdline_orb_radar = 1;
}
// TBP warp effects -Et1
// Chief1983 - Add 3d shockwave, ship choice 3d and weapon choice 3d if TBP is checked
if( tbp.found() )
{
Cmdline_tbp = 1;
Cmdline_enable_3d_shockwave = 1;
Cmdline_ship_choice_3d = 1;
Cmdline_weapon_choice_3d = 1;
}
if ( use_3dwarp.found() ) {
Cmdline_3dwarp = 1;
}
@@ -1231,6 +1264,10 @@ bool SetCmdlineParams()
Cmdline_noglsl = 1;
}
if (no_glsl_models_arg.found() ) {
Cmdline_no_glsl_model_rendering = 1;
}
if ( img2dds_arg.found() )
Cmdline_img2dds = 1;
@@ -1290,10 +1327,10 @@ bool SetCmdlineParams()
ubyte build_caps = 0;
/* portej05 defined this always */
build_caps |= BUILD_CAP_NO_D3D;
#ifdef USE_OPENAL
build_caps |= BUILD_CAP_OPENAL;
#endif
build_caps |= BUILD_CAP_NO_D3D;
build_caps |= BUILD_CAP_NEW_SND;
fwrite(&build_caps, 1, 1, fp);
}
@@ -1327,22 +1364,10 @@ bool SetCmdlineParams()
Cmdline_env = 1;
}
if ( decals.found() ) {
#ifdef WIN32
MessageBox(NULL, "Decals have been disabled in builds after May 4, 2006. Please remove the \"-decals\" command line from the launcher to prevent this message from appearing the the future.", "", MB_OK | MB_ICONINFORMATION);
#endif
}
if ( ballistic_gauge.found() ) {
Cmdline_ballistic_gauge = 1;
}
if (wcsaga.found())
{
Cmdline_wcsaga = 1;
}
if ( cache_bitmaps_arg.found() ) {
Cmdline_cache_bitmaps = 1;
}
@@ -1390,6 +1415,9 @@ bool SetCmdlineParams()
if ( verify_vps_arg.found() )
Cmdline_verify_vps = 1;
if ( no3dsound_arg.found() )
Cmdline_no_3d_sound = 1;
if ( atiswap_arg.found() )
{
Cmdline_ati_color_swap = 1;
@@ -1455,4 +1483,4 @@ int parse_cmdline(char *cmdline)
// If you're looking for the list of if (someparam.found()) { cmdline_someparam = something; } look above at this function
// I did this because of fred2_parse_cmdline()
return SetCmdlineParams();
}
}
+3 -4
View File
@@ -63,7 +63,6 @@ extern float static_point_factor;
extern float static_tube_factor;
extern int Cmdline_ambient_factor;
extern int Cmdline_cell;
extern int Cmdline_decals;
extern int Cmdline_env;
extern int Cmdline_mipmap;
extern int Cmdline_missile_lighting;
@@ -104,9 +103,6 @@ extern int Cmdline_voice_recognition;
// MOD related
extern char *Cmdline_mod; // DTP for mod support
extern int Cmdline_tbp;
extern int Cmdline_wcsaga;
// Multiplayer/Network related
extern char *Cmdline_almission; // DTP for autoload mission (for multi only)
extern int Cmdline_ingamejoin;
@@ -127,6 +123,8 @@ extern int Cmdline_safeloading;
extern int Cmdline_no_fbo;
extern int Cmdline_noglsl;
extern int Cmdline_ati_color_swap;
extern int Cmdline_no_3d_sound;
extern int Cmdline_no_glsl_model_rendering;
// Developer/Testing related
extern char *Cmdline_start_mission;
@@ -134,6 +132,7 @@ extern int Cmdline_dis_collisions;
extern int Cmdline_dis_weapons;
extern int Cmdline_noparseerrors;
extern int Cmdline_nowarn;
extern int Cmdline_extra_warn;
extern int Cmdline_show_mem_usage;
extern int Cmdline_show_pos;
extern int Cmdline_show_stats;
+12 -23
View File
@@ -35,7 +35,6 @@ char *Cutscene_mask_name[GR_NUM_RESOLUTIONS] = {
"2_ViewFootage-m"
};
size_t Num_cutscenes;
int Cutscenes_viewable;
int Description_index;
SCP_vector<cutscene_info> Cutscenes;
@@ -43,7 +42,7 @@ SCP_vector<cutscene_info> Cutscenes;
//extern int All_movies_enabled; // If set, all movies may be viewed. Keyed off cheat code.
void cutscene_close()
{
for(size_t i = 0; i < Num_cutscenes; i++)
for(size_t i = 0; i < Cutscenes.size(); i++)
{
if(Cutscenes[i].description)
{
@@ -73,7 +72,7 @@ void cutscene_init()
reset_parse();
// parse in all the cutscenes
Num_cutscenes = 0;
Cutscenes.clear();
skip_to_string("#Cutscenes");
ignore_white_space();
@@ -97,7 +96,6 @@ void cutscene_init()
stuff_int( &cutinfo.cd );
Cutscenes.push_back(cutinfo);
Num_cutscenes++;
}
required_string("#End");
@@ -115,9 +113,8 @@ int cutscenes_get_cd_num( char *filename )
#if defined(OEM_BUILD)
return 0; // only 1 cd for OEM
#else
size_t i;
for (i = 0; i < Num_cutscenes; i++ ) {
for (size_t i = 0; i < Cutscenes.size(); i++ ) {
if ( !stricmp(Cutscenes[i].filename, filename) ) {
return (Cutscenes[i].cd - 1);
}
@@ -130,7 +127,6 @@ int cutscenes_get_cd_num( char *filename )
// marks a cutscene as viewable
void cutscene_mark_viewable(char *filename)
{
size_t i;
char cut_file[MAX_FILENAME_LEN];
char file[MAX_FILENAME_LEN];
@@ -146,7 +142,7 @@ void cutscene_mark_viewable(char *filename)
// change to lower case
strlwr(file);
for (i = 0; i < Num_cutscenes; i++ ) {
for (size_t i = 0; i < Cutscenes.size(); i++ ) {
// change the cutscene file name to lower case
strcpy_s(cut_file, Cutscenes[i].filename);
strlwr(cut_file);
@@ -171,7 +167,6 @@ void cutscene_mark_viewable(char *filename)
#define PLAY_BUTTON 6
#define EXIT_BUTTON 7
static int Num_files;
static SCP_vector<int> Cutscene_list;
//static int Stats_scroll_offset; // not used - taylor
static int Selected_line = 0; // line that is currently selected for binding
@@ -335,7 +330,7 @@ void cutscenes_screen_play()
char name[MAX_FILENAME_LEN]; // *full_name
int which_cutscene;
Assert( (Selected_line >= 0) && (Selected_line < Num_files) );
Assert( (Selected_line >= 0) && (Selected_line < (int)Cutscene_list.size()) );
which_cutscene = Cutscene_list[Selected_line];
strcpy_s(name, Cutscenes[which_cutscene].filename );
@@ -376,7 +371,7 @@ void cutscenes_screen_scroll_line_down()
{
int h;
if (Selected_line < Num_files - 1) {
if (Selected_line < (int)Cutscene_list.size() - 1) {
Selected_line++;
gamesnd_play_iface(SND_SCROLL);
@@ -413,7 +408,7 @@ void cutscenes_screen_scroll_screen_down()
int h;
h = Cutscene_list_coords[gr_screen.res][3] / gr_get_font_height();
if (Scroll_offset + h < Num_files) {
if (Scroll_offset + h < (int)Cutscene_list.size()) {
Scroll_offset++;
if (Selected_line < Scroll_offset){
Selected_line = Scroll_offset;
@@ -468,7 +463,6 @@ int cutscenes_screen_button_pressed(int n)
void cutscenes_screen_init()
{
int i;
size_t j;
ui_button_info *b;
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
@@ -512,12 +506,10 @@ void cutscenes_screen_init()
// if (All_movies_enabled)
// Cutscenes_viewable = 0xffffffff; // Cheat code enables all movies.
Num_files = 0;
Cutscene_list.clear();
for ( j = 0; j < Num_cutscenes; j++ ) {
for (size_t j = 0; j < Cutscenes.size(); j++ ) {
if ( Cutscenes_viewable & (1<<j) ) {
Cutscene_list.push_back((int)j);
Num_files++;
}
}
}
@@ -533,7 +525,6 @@ void cutscenes_screen_close()
void cutscenes_screen_do_frame()
{
int i, k, y, z;
size_t t;
int font_height = gr_get_font_height();
int select_tease_line = -1;
@@ -576,11 +567,9 @@ void cutscenes_screen_do_frame()
// the "show-all" hotkey
case KEY_CTRLED | KEY_SHIFTED | KEY_S:
{
Num_files = 0;
Cutscene_list.clear();
for (t = 0; t < Num_cutscenes; t++) {
for (size_t t = 0; t < Cutscenes.size(); t++) {
Cutscene_list.push_back((int)t);
Num_files++;
}
break;
@@ -598,14 +587,14 @@ void cutscenes_screen_do_frame()
if (List_region.button_down()) {
List_region.get_mouse_pos(NULL, &y);
z = Scroll_offset + y / font_height;
if ((z >= 0) && (z < Num_files))
if ((z >= 0) && (z < (int)Cutscene_list.size()))
select_tease_line = z;
}
if (List_region.pressed()) {
List_region.get_mouse_pos(NULL, &y);
z = Scroll_offset + y / font_height;
if ((z >= 0) && (z < Num_files))
if ((z >= 0) && (z < (int)Cutscene_list.size()))
Selected_line = z;
}
@@ -630,7 +619,7 @@ void cutscenes_screen_do_frame()
y = 0;
z = Scroll_offset;
while (y + font_height <= Cutscene_list_coords[gr_screen.res][3]) {
if (z >= Num_files){
if (z >= (int)Cutscene_list.size()){
break;
}
-1
View File
@@ -27,7 +27,6 @@ typedef struct cutscene_info
} cutscene_info;
extern SCP_vector<cutscene_info> Cutscenes;
extern size_t Num_cutscenes;
extern int Cutscenes_viewable;
// initializa table data
-4
View File
@@ -1,7 +1,5 @@
#ifdef USE_OPENAL
static int audio_exp_table[256] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
@@ -57,5 +55,3 @@ void mveaudio_uncompress(short *buffer, unsigned char *data, int length)
sendWord(&buffer, nCurOffsets[1]);
processSwath(buffer, data, swath, nCurOffsets);
}
#endif
+5 -13
View File
@@ -19,7 +19,7 @@
#include "osapi/osapi.h"
#include "io/timer.h"
#include "sound/sound.h"
#include "sound/ds.h"
#include "sound/openal.h"
#include "bmpman/bmpman.h"
//#include "sound/audiostr.h"
@@ -45,7 +45,6 @@ static int mve_audio_canplay = 0;
static int mve_audio_compressed = 0;
static int audiobuf_created;
#ifdef USE_OPENAL
// struct for the audio stream information
typedef struct MVE_AUDIO_T {
ALenum format;
@@ -61,7 +60,6 @@ mve_audio_t *mas; // mve_audio_stream
// audio decompressor
extern void mveaudio_uncompress(short *buffer, unsigned char *data, int length);
#endif // USE_OPENAL
// video variables
int g_width, g_height;
@@ -227,7 +225,6 @@ void mve_audio_createbuf(ubyte minor, ubyte *data)
return;
}
#ifdef USE_OPENAL
int flags, desired_buffer, sample_rate;
mas = (mve_audio_t *) vm_malloc ( sizeof(mve_audio_t) );
@@ -278,7 +275,6 @@ void mve_audio_createbuf(ubyte minor, ubyte *data)
OpenAL_ErrorPrint( alSourcef(mas->source_id, AL_GAIN, 1.0f) );
memset(mas->audio_buffer, 0, MVE_AUDIO_BUFFERS * sizeof(ALuint));
#endif // USE_OPENAL
mve_audio_buffer_tail = 0;
@@ -289,7 +285,6 @@ void mve_audio_createbuf(ubyte minor, ubyte *data)
void mve_audio_play()
{
if (mve_audio_canplay) {
#ifdef USE_OPENAL
ALint status, bqueued;
OpenAL_ErrorCheck( alGetSourcei(mas->source_id, AL_SOURCE_STATE, &status), return );
@@ -301,7 +296,6 @@ void mve_audio_play()
if (status != AL_PLAYING && bqueued > 0) {
OpenAL_ErrorPrint( alSourcePlay(mas->source_id) );
}
#endif // USE_OPENAL
}
}
@@ -311,7 +305,6 @@ static void mve_audio_stop()
if (!audiobuf_created)
return;
#ifdef USE_OPENAL
ALint p = 0;
mve_audio_playing = 0;
@@ -332,7 +325,6 @@ static void mve_audio_stop()
vm_free(mas);
mas = NULL;
}
#endif // USE_OPENAL
}
int mve_audio_data(ubyte major, ubyte *data)
@@ -342,7 +334,6 @@ int mve_audio_data(ubyte major, ubyte *data)
int nsamp;
if (mve_audio_canplay) {
#ifdef USE_OPENAL
chan = mve_get_ushort(data + 2);
nsamp = mve_get_ushort(data + 4);
@@ -409,7 +400,6 @@ int mve_audio_data(ubyte major, ubyte *data)
mprintf(("MVE: Buffer overrun: Queue full\n"));
}
}
#endif // USE_OPENAL
}
return 1;
@@ -678,8 +668,10 @@ int mve_video_init(ubyte *data)
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
+5 -3
View File
@@ -20,7 +20,7 @@
#include "io/key.h"
#include "osapi/osapi.h"
#include "sound/sound.h"
#include "sound/ds.h"
#include "sound/openal.h"
#include "bmpman/bmpman.h"
#include "cutscene/oggplayer.h"
#include "io/timer.h"
@@ -360,8 +360,10 @@ static void OGG_video_init(theora_info *tinfo)
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB8, wp2, hp2, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
+1 -1
View File
@@ -42,7 +42,7 @@ typedef struct debris {
vec3d arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
int arc_timestamp[MAX_DEBRIS_ARCS]; // When this times out, the spark goes away. -1 is not used
int arc_frequency; // Starts at 0, gets bigger
char parent_alt_name;
int parent_alt_name;
float damage_mult;
} debris;
File diff suppressed because it is too large. Load diff
-129
View File
@@ -1,129 +0,0 @@
//header file for making decals-Bobboau
#ifndef _DECAL_H
#define _DECAL_H
#include "object/object.h"
#include "globalincs/pstypes.h"
//#include "ship/ship.h"
#ifdef ENABLE_DECALS
#define MAX_DECAL_POLY 40
#define MAX_DECAL_POLY_POINT 10
#define MAX_DECAL_DEFPOINTS 10000
#define MAX_DECAL_POINT 10
#define MAX_SHIP_DECALS 25
#define MAX_GLOBAL_DECAL_POLYS 11000
#define QUICKFIND_SUBDIVISION 100
#define QUICKFIND_SEGMENT_LENGTH (MAX_GLOBAL_DECAL_POLYS/QUICKFIND_SUBDIVISION)
#define MAX_GLOBAL_DECALS 5000
#define DP_EOF 0
#define DP_DEFPOINTS 1
#define DP_FLATPOLY 2
#define DP_TMAPPOLY 3
#define DP_SORTNORM 4
#define DP_BOUNDBOX 5
#endif // ENABLE_DECALS
struct decal;
struct decal_list;
struct decal_list_controle;
struct decal_poly{
vec3d norm[3];
vertex point[3];
decal_poly *next;
decal* parent;
int idx;
};
struct decal{
int n_poly;
int timestamp; //when this decal was created
int burn_time; //how long it takes for the glow texture to fade
int vertex_buffer_start; //were is the start of this decal's polys in the vertex buffer
decal_poly* poly;
decal_poly* add_poly();
decal_poly* get_last_poly();
void remove_last_poly();
decal_list_controle *parent;
};
struct decal_list{
decal dec;
decal_list *next;
};
struct decal_item{
decal_list dec;
bool used;
};
struct decal_list_controle{
int n_decals;
int buffer;
int texture;
int n_poly;
int burn_texture;
int glow_texture;
bool modifyed;
decal_list *d_list;
decal_list *end;
decal_list *add_new();
void trim();
void clear();
~decal_list_controle();
decal_list_controle();
};
struct decal_system{
decal_list_controle *decals;
int n_decal_textures;
bool decals_modified;
int max_decals;
decal_system():decals(NULL),n_decal_textures(0),decals_modified(false){};
};
//this is used to give all the data to the generation data to the functions that make them
struct decal_point{
vec3d pnt;
matrix orient;
float radius;
};
#ifdef ENABLE_DECALS
int decal_create(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture = -1, int glow_texture = -1, int burn_texture = -1, int burn_time = 1000);//makes the decal
int decal_create_simple(object * obj, decal_point *point, int texture);//makes a simple non-clipped decal
void decal_render_all(object * obj); //renders all decals
int decal_create_sub(void *model_ptr);
void clear_decals(decal_system *system);
void init_decals();
#else // ENABLE_DECALS
inline int decal_create(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture = -1, int glow_texture = -1, int burn_texture = -1, int burn_time = 1000)
{
return 0;
}
#define decal_create_simple(a, b, c) (0)
#define decal_render_all(a)
#define decal_create_sub(a) (0);
#define clear_decals(a)
#define init_decals()
#endif // ENABLE_DECALS
#endif // _DECAL_H
-864
View File
@@ -1,864 +0,0 @@
/*==========================================================================;
*
* Copyright (C) 1995,1996 Microsoft Corporation. All Rights Reserved.
*
* File: dsound.h
* Content: DirectSound include file
*
**************************************************************************/
#ifndef __DSOUND_INCLUDED__
#define __DSOUND_INCLUDED__
#include "directx/vd3dtypes.h"
#define COM_NO_WINDOWS_H
#include <objbase.h>
#define _FACDS 0x878
#define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code)
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000}
DEFINE_GUID(CLSID_DirectSound, 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
// DirectSound Capture Component GUID {B0210780-89CD-11d0-AF08-00A0C925CD16}
DEFINE_GUID(CLSID_DirectSoundCapture, 0xb0210780, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);
//
// Structures
//
#ifdef __cplusplus
// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined
struct IDirectSound;
struct IDirectSoundBuffer;
struct IDirectSound3DListener;
struct IDirectSound3DBuffer;
struct IDirectSoundCapture;
struct IDirectSoundCaptureBuffer;
struct IDirectSoundNotify;
#endif // __cplusplus
typedef struct IDirectSound *LPDIRECTSOUND;
typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER;
typedef struct IDirectSound3DListener *LPDIRECTSOUND3DLISTENER;
typedef struct IDirectSound3DBuffer *LPDIRECTSOUND3DBUFFER;
typedef struct IDirectSoundCapture *LPDIRECTSOUNDCAPTURE;
typedef struct IDirectSoundCaptureBuffer *LPDIRECTSOUNDCAPTUREBUFFER;
typedef struct IDirectSoundNotify *LPDIRECTSOUNDNOTIFY;
typedef struct _DSCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwMinSecondarySampleRate;
DWORD dwMaxSecondarySampleRate;
DWORD dwPrimaryBuffers;
DWORD dwMaxHwMixingAllBuffers;
DWORD dwMaxHwMixingStaticBuffers;
DWORD dwMaxHwMixingStreamingBuffers;
DWORD dwFreeHwMixingAllBuffers;
DWORD dwFreeHwMixingStaticBuffers;
DWORD dwFreeHwMixingStreamingBuffers;
DWORD dwMaxHw3DAllBuffers;
DWORD dwMaxHw3DStaticBuffers;
DWORD dwMaxHw3DStreamingBuffers;
DWORD dwFreeHw3DAllBuffers;
DWORD dwFreeHw3DStaticBuffers;
DWORD dwFreeHw3DStreamingBuffers;
DWORD dwTotalHwMemBytes;
DWORD dwFreeHwMemBytes;
DWORD dwMaxContigFreeHwMemBytes;
DWORD dwUnlockTransferRateHwBuffers;
DWORD dwPlayCpuOverheadSwBuffers;
DWORD dwReserved1;
DWORD dwReserved2;
} DSCAPS, *LPDSCAPS;
typedef const DSCAPS *LPCDSCAPS;
typedef struct _DSBCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwUnlockTransferRate;
DWORD dwPlayCpuOverhead;
} DSBCAPS, *LPDSBCAPS;
typedef const DSBCAPS *LPCDSBCAPS;
typedef struct _DSBUFFERDESC
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwReserved;
LPWAVEFORMATEX lpwfxFormat;
} DSBUFFERDESC, *LPDSBUFFERDESC;
typedef const DSBUFFERDESC *LPCDSBUFFERDESC;
typedef struct _DS3DBUFFER
{
DWORD dwSize;
D3DVECTOR vPosition;
D3DVECTOR vVelocity;
DWORD dwInsideConeAngle;
DWORD dwOutsideConeAngle;
D3DVECTOR vConeOrientation;
LONG lConeOutsideVolume;
D3DVALUE flMinDistance;
D3DVALUE flMaxDistance;
DWORD dwMode;
} DS3DBUFFER, *LPDS3DBUFFER;
typedef const DS3DBUFFER *LPCDS3DBUFFER;
typedef struct _DS3DLISTENER
{
DWORD dwSize;
D3DVECTOR vPosition;
D3DVECTOR vVelocity;
D3DVECTOR vOrientFront;
D3DVECTOR vOrientTop;
D3DVALUE flDistanceFactor;
D3DVALUE flRolloffFactor;
D3DVALUE flDopplerFactor;
} DS3DLISTENER, *LPDS3DLISTENER;
typedef const DS3DLISTENER *LPCDS3DLISTENER;
typedef struct _DSCCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwFormats;
DWORD dwChannels;
} DSCCAPS, *LPDSCCAPS;
typedef const DSCCAPS *LPCDSCCAPS;
typedef struct _DSCBUFFERDESC
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwReserved;
LPWAVEFORMATEX lpwfxFormat;
} DSCBUFFERDESC, *LPDSCBUFFERDESC;
typedef const DSCBUFFERDESC *LPCDSCBUFFERDESC;
typedef struct _DSCBCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
DWORD dwReserved;
} DSCBCAPS, *LPDSCBCAPS;
typedef const DSCBCAPS *LPCDSCBCAPS;
typedef struct _DSBPOSITIONNOTIFY
{
DWORD dwOffset;
HANDLE hEventNotify;
} DSBPOSITIONNOTIFY, *LPDSBPOSITIONNOTIFY;
typedef const DSBPOSITIONNOTIFY *LPCDSBPOSITIONNOTIFY;
//
// Compatibility typedefs
//
typedef LPDIRECTSOUND *LPLPDIRECTSOUND;
typedef LPDIRECTSOUNDBUFFER *LPLPDIRECTSOUNDBUFFER;
typedef LPDIRECTSOUND3DLISTENER *LPLPDIRECTSOUND3DLISTENER;
typedef LPDIRECTSOUND3DBUFFER *LPLPDIRECTSOUND3DBUFFER;
typedef LPDIRECTSOUNDCAPTURE *LPLPDIRECTSOUNDCAPTURE;
typedef LPDIRECTSOUNDCAPTUREBUFFER *LPLPDIRECTSOUNDCAPTUREBUFFER;
typedef LPDIRECTSOUNDNOTIFY *LPLPDIRECTSOUNDNOTIFY;
typedef LPVOID *LPLPVOID;
typedef const WAVEFORMATEX *LPCWAVEFORMATEX;
//
// DirectSound API
//
typedef BOOL (CALLBACK *LPDSENUMCALLBACKW)(LPGUID, LPCWSTR, LPCWSTR, LPVOID);
typedef BOOL (CALLBACK *LPDSENUMCALLBACKA)(LPGUID, LPCSTR, LPCSTR, LPVOID);
extern HRESULT WINAPI DirectSoundCreate(LPGUID, LPDIRECTSOUND *, LPUNKNOWN);
extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW, LPVOID);
extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA, LPVOID);
extern HRESULT WINAPI DirectSoundCaptureCreate(LPGUID, LPDIRECTSOUNDCAPTURE *, LPUNKNOWN);
extern HRESULT WINAPI DirectSoundCaptureEnumerateW(LPDSENUMCALLBACKW, LPVOID);
extern HRESULT WINAPI DirectSoundCaptureEnumerateA(LPDSENUMCALLBACKA, LPVOID);
#ifdef UNICODE
#define LPDSENUMCALLBACK LPDSENUMCALLBACKW
#define DirectSoundEnumerate DirectSoundEnumerateW
#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateW
#else // UNICODE
#define LPDSENUMCALLBACK LPDSENUMCALLBACKA
#define DirectSoundEnumerate DirectSoundEnumerateA
#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateA
#endif // UNICODE
//
// IDirectSound
//
DEFINE_GUID(IID_IDirectSound, 0x279AFA83, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60);
#undef INTERFACE
#define INTERFACE IDirectSound
DECLARE_INTERFACE_(IDirectSound, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSound methods
STDMETHOD(CreateSoundBuffer) (THIS_ LPCDSBUFFERDESC, LPDIRECTSOUNDBUFFER *, LPUNKNOWN) PURE;
STDMETHOD(GetCaps) (THIS_ LPDSCAPS) PURE;
STDMETHOD(DuplicateSoundBuffer) (THIS_ LPDIRECTSOUNDBUFFER, LPDIRECTSOUNDBUFFER *) PURE;
STDMETHOD(SetCooperativeLevel) (THIS_ HWND, DWORD) PURE;
STDMETHOD(Compact) (THIS) PURE;
STDMETHOD(GetSpeakerConfig) (THIS_ LPDWORD) PURE;
STDMETHOD(SetSpeakerConfig) (THIS_ DWORD) PURE;
STDMETHOD(Initialize) (THIS_ LPGUID) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSound_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSound_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c)
#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b)
#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b)
#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p)
#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a)
#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b)
#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSound_AddRef(p) (p)->AddRef()
#define IDirectSound_Release(p) (p)->Release()
#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->CreateSoundBuffer(a,b,c)
#define IDirectSound_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->DuplicateSoundBuffer(a,b)
#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b)
#define IDirectSound_Compact(p) (p)->Compact()
#define IDirectSound_GetSpeakerConfig(p,a) (p)->GetSpeakerConfig(a)
#define IDirectSound_SetSpeakerConfig(p,b) (p)->SetSpeakerConfig(b)
#define IDirectSound_Initialize(p,a) (p)->Initialize(a)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSoundBuffer
//
DEFINE_GUID(IID_IDirectSoundBuffer, 0x279AFA85, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60);
#undef INTERFACE
#define INTERFACE IDirectSoundBuffer
DECLARE_INTERFACE_(IDirectSoundBuffer, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundBuffer methods
STDMETHOD(GetCaps) (THIS_ LPDSBCAPS) PURE;
STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD, LPDWORD) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX, DWORD, LPDWORD) PURE;
STDMETHOD(GetVolume) (THIS_ LPLONG) PURE;
STDMETHOD(GetPan) (THIS_ LPLONG) PURE;
STDMETHOD(GetFrequency) (THIS_ LPDWORD) PURE;
STDMETHOD(GetStatus) (THIS_ LPDWORD) PURE;
STDMETHOD(Initialize) (THIS_ LPDIRECTSOUND, LPCDSBUFFERDESC) PURE;
STDMETHOD(Lock) (THIS_ DWORD, DWORD, LPVOID *, LPDWORD, LPVOID *, LPDWORD, DWORD) PURE;
STDMETHOD(Play) (THIS_ DWORD, DWORD, DWORD) PURE;
STDMETHOD(SetCurrentPosition) (THIS_ DWORD) PURE;
STDMETHOD(SetFormat) (THIS_ LPCWAVEFORMATEX) PURE;
STDMETHOD(SetVolume) (THIS_ LONG) PURE;
STDMETHOD(SetPan) (THIS_ LONG) PURE;
STDMETHOD(SetFrequency) (THIS_ DWORD) PURE;
STDMETHOD(Stop) (THIS) PURE;
STDMETHOD(Unlock) (THIS_ LPVOID, DWORD, LPVOID, DWORD) PURE;
STDMETHOD(Restore) (THIS) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundBuffer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b)
#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c)
#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a)
#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a)
#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a)
#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a)
#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b)
#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c)
#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a)
#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a)
#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a)
#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a)
#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a)
#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p)
#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d)
#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSoundBuffer_AddRef(p) (p)->AddRef()
#define IDirectSoundBuffer_Release(p) (p)->Release()
#define IDirectSoundBuffer_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b)
#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c)
#define IDirectSoundBuffer_GetVolume(p,a) (p)->GetVolume(a)
#define IDirectSoundBuffer_GetPan(p,a) (p)->GetPan(a)
#define IDirectSoundBuffer_GetFrequency(p,a) (p)->GetFrequency(a)
#define IDirectSoundBuffer_GetStatus(p,a) (p)->GetStatus(a)
#define IDirectSoundBuffer_Initialize(p,a,b) (p)->Initialize(a,b)
#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g)
#define IDirectSoundBuffer_Play(p,a,b,c) (p)->Play(a,b,c)
#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->SetCurrentPosition(a)
#define IDirectSoundBuffer_SetFormat(p,a) (p)->SetFormat(a)
#define IDirectSoundBuffer_SetVolume(p,a) (p)->SetVolume(a)
#define IDirectSoundBuffer_SetPan(p,a) (p)->SetPan(a)
#define IDirectSoundBuffer_SetFrequency(p,a) (p)->SetFrequency(a)
#define IDirectSoundBuffer_Stop(p) (p)->Stop()
#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d)
#define IDirectSoundBuffer_Restore(p) (p)->Restore()
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSound3DListener
//
DEFINE_GUID(IID_IDirectSound3DListener, 0x279AFA84, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60);
#undef INTERFACE
#define INTERFACE IDirectSound3DListener
DECLARE_INTERFACE_(IDirectSound3DListener, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSound3D methods
STDMETHOD(GetAllParameters) (THIS_ LPDS3DLISTENER) PURE;
STDMETHOD(GetDistanceFactor) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetDopplerFactor) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetOrientation) (THIS_ LPD3DVECTOR, LPD3DVECTOR) PURE;
STDMETHOD(GetPosition) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(GetRolloffFactor) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetVelocity) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(SetAllParameters) (THIS_ LPCDS3DLISTENER, DWORD) PURE;
STDMETHOD(SetDistanceFactor) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetDopplerFactor) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetOrientation) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(SetPosition) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(SetRolloffFactor) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetVelocity) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(CommitDeferredSettings) (THIS) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound3DListener_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSound3DListener_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSound3DListener_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSound3DListener_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->lpVtbl->GetDistanceFactor(p,a)
#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->lpVtbl->GetDopplerFactor(p,a)
#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->lpVtbl->GetOrientation(p,a,b)
#define IDirectSound3DListener_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a)
#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->lpVtbl->GetRolloffFactor(p,a)
#define IDirectSound3DListener_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a)
#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b)
#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->lpVtbl->SetDistanceFactor(p,a,b)
#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->lpVtbl->SetDopplerFactor(p,a,b)
#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g)
#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d)
#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->lpVtbl->SetRolloffFactor(p,a,b)
#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d)
#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->lpVtbl->CommitDeferredSettings(p)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound3DListener_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSound3DListener_AddRef(p) (p)->AddRef()
#define IDirectSound3DListener_Release(p) (p)->Release()
#define IDirectSound3DListener_GetAllParameters(p,a) (p)->GetAllParameters(a)
#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->GetDistanceFactor(a)
#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->GetDopplerFactor(a)
#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->GetOrientation(a,b)
#define IDirectSound3DListener_GetPosition(p,a) (p)->GetPosition(a)
#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->GetRolloffFactor(a)
#define IDirectSound3DListener_GetVelocity(p,a) (p)->GetVelocity(a)
#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b)
#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->SetDistanceFactor(a,b)
#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->SetDopplerFactor(a,b)
#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->SetOrientation(a,b,c,d,e,f,g)
#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d)
#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->SetRolloffFactor(a,b)
#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d)
#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->CommitDeferredSettings()
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSound3DBuffer
//
DEFINE_GUID(IID_IDirectSound3DBuffer, 0x279AFA86, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60);
#undef INTERFACE
#define INTERFACE IDirectSound3DBuffer
DECLARE_INTERFACE_(IDirectSound3DBuffer, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundBuffer3D methods
STDMETHOD(GetAllParameters) (THIS_ LPDS3DBUFFER) PURE;
STDMETHOD(GetConeAngles) (THIS_ LPDWORD, LPDWORD) PURE;
STDMETHOD(GetConeOrientation) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(GetConeOutsideVolume) (THIS_ LPLONG) PURE;
STDMETHOD(GetMaxDistance) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetMinDistance) (THIS_ LPD3DVALUE) PURE;
STDMETHOD(GetMode) (THIS_ LPDWORD) PURE;
STDMETHOD(GetPosition) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(GetVelocity) (THIS_ LPD3DVECTOR) PURE;
STDMETHOD(SetAllParameters) (THIS_ LPCDS3DBUFFER, DWORD) PURE;
STDMETHOD(SetConeAngles) (THIS_ DWORD, DWORD, DWORD) PURE;
STDMETHOD(SetConeOrientation) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(SetConeOutsideVolume) (THIS_ LONG, DWORD) PURE;
STDMETHOD(SetMaxDistance) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetMinDistance) (THIS_ D3DVALUE, DWORD) PURE;
STDMETHOD(SetMode) (THIS_ DWORD, DWORD) PURE;
STDMETHOD(SetPosition) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
STDMETHOD(SetVelocity) (THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound3DBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSound3DBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSound3DBuffer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->lpVtbl->GetConeAngles(p,a,b)
#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->lpVtbl->GetConeOrientation(p,a)
#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->lpVtbl->GetConeOutsideVolume(p,a)
#define IDirectSound3DBuffer_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a)
#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->lpVtbl->GetMinDistance(p,a)
#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->lpVtbl->GetMaxDistance(p,a)
#define IDirectSound3DBuffer_GetMode(p,a) (p)->lpVtbl->GetMode(p,a)
#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a)
#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b)
#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->lpVtbl->SetConeAngles(p,a,b,c)
#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->lpVtbl->SetConeOrientation(p,a,b,c,d)
#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->lpVtbl->SetConeOutsideVolume(p,a,b)
#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d)
#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->lpVtbl->SetMinDistance(p,a,b)
#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->lpVtbl->SetMaxDistance(p,a,b)
#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->lpVtbl->SetMode(p,a,b)
#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSound3DBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSound3DBuffer_AddRef(p) (p)->AddRef()
#define IDirectSound3DBuffer_Release(p) (p)->Release()
#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->GetAllParameters(a)
#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->GetConeAngles(a,b)
#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->GetConeOrientation(a)
#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->GetConeOutsideVolume(a)
#define IDirectSound3DBuffer_GetPosition(p,a) (p)->GetPosition(a)
#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->GetMinDistance(a)
#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->GetMaxDistance(a)
#define IDirectSound3DBuffer_GetMode(p,a) (p)->GetMode(a)
#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->GetVelocity(a)
#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b)
#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->SetConeAngles(a,b,c)
#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->SetConeOrientation(a,b,c,d)
#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->SetConeOutsideVolume(a,b)
#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d)
#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->SetMinDistance(a,b)
#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->SetMaxDistance(a,b)
#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->SetMode(a,b)
#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSoundCapture
//
DEFINE_GUID(IID_IDirectSoundCapture, 0xb0210781, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);
#undef INTERFACE
#define INTERFACE IDirectSoundCapture
DECLARE_INTERFACE_(IDirectSoundCapture, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundCapture methods
STDMETHOD(CreateCaptureBuffer) (THIS_ LPCDSCBUFFERDESC, LPDIRECTSOUNDCAPTUREBUFFER *, LPUNKNOWN) PURE;
STDMETHOD(GetCaps) (THIS_ LPDSCCAPS ) PURE;
STDMETHOD(Initialize) (THIS_ LPGUID) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundCapture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundCapture_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundCapture_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->lpVtbl->CreateCaptureBuffer(p,a,b,c)
#define IDirectSoundCapture_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSoundCapture_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundCapture_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSoundCapture_AddRef(p) (p)->AddRef()
#define IDirectSoundCapture_Release(p) (p)->Release()
#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->CreateCaptureBuffer(a,b,c)
#define IDirectSoundCapture_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectSoundCapture_Initialize(p,a) (p)->Initialize(a)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSoundCaptureBuffer
//
DEFINE_GUID(IID_IDirectSoundCaptureBuffer, 0xb0210782, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);
#undef INTERFACE
#define INTERFACE IDirectSoundCaptureBuffer
DECLARE_INTERFACE_(IDirectSoundCaptureBuffer, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundCaptureBuffer methods
STDMETHOD(GetCaps) (THIS_ LPDSCBCAPS ) PURE;
STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD, LPDWORD ) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE;
STDMETHOD(GetStatus) (THIS_ LPDWORD ) PURE;
STDMETHOD(Initialize) (THIS_ LPDIRECTSOUNDCAPTURE, LPCDSCBUFFERDESC) PURE;
STDMETHOD(Lock) (THIS_ DWORD, DWORD, LPVOID *, LPDWORD, LPVOID *, LPDWORD, DWORD) PURE;
STDMETHOD(Start) (THIS_ DWORD) PURE;
STDMETHOD(Stop) (THIS) PURE;
STDMETHOD(Unlock) (THIS_ LPVOID, DWORD, LPVOID, DWORD) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundCaptureBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundCaptureBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundCaptureBuffer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b)
#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c)
#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a)
#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b)
#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
#define IDirectSoundCaptureBuffer_Start(p,a) (p)->lpVtbl->Start(p,a)
#define IDirectSoundCaptureBuffer_Stop(p) (p)->lpVtbl->Stop(p)
#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundCaptureBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSoundCaptureBuffer_AddRef(p) (p)->AddRef()
#define IDirectSoundCaptureBuffer_Release(p) (p)->Release()
#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b)
#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c)
#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->GetStatus(a)
#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->Initialize(a,b)
#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g)
#define IDirectSoundCaptureBuffer_Start(p,a) (p)->Start(a)
#define IDirectSoundCaptureBuffer_Stop(p) (p)->Stop()
#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IDirectSoundNotify
//
DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16);
#undef INTERFACE
#define INTERFACE IDirectSoundNotify
DECLARE_INTERFACE_(IDirectSoundNotify, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IDirectSoundNotify methods
STDMETHOD(SetNotificationPositions) (THIS_ DWORD, LPCDSBPOSITIONNOTIFY) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundNotify_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectSoundNotify_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectSoundNotify_Release(p) (p)->lpVtbl->Release(p)
#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->lpVtbl->SetNotificationPositions(p,a,b)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectSoundNotify_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectSoundNotify_AddRef(p) (p)->AddRef()
#define IDirectSoundNotify_Release(p) (p)->Release()
#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->SetNotificationPositions(a,b)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
//
// IKsPropertySet
//
#ifndef _IKsPropertySet_
#define _IKsPropertySet_
#ifdef __cplusplus
// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined
struct IKsPropertySet;
#endif // __cplusplus
typedef struct IKsPropertySet *LPKSPROPERTYSET;
#define KSPROPERTY_SUPPORT_GET 0x00000001
#define KSPROPERTY_SUPPORT_SET 0x00000002
DEFINE_GUID(IID_IKsPropertySet, 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93);
#undef INTERFACE
#define INTERFACE IKsPropertySet
DECLARE_INTERFACE_(IKsPropertySet, IUnknown)
{
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// IKsPropertySet methods
STDMETHOD(Get) (THIS_ REFGUID, ULONG, LPVOID, ULONG, LPVOID, ULONG, PULONG) PURE;
STDMETHOD(Set) (THIS_ REFGUID, ULONG, LPVOID, ULONG, LPVOID, ULONG) PURE;
STDMETHOD(QuerySupport) (THIS_ REFGUID, ULONG, PULONG) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IKsPropertySet_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IKsPropertySet_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IKsPropertySet_Release(p) (p)->lpVtbl->Release(p)
#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->lpVtbl->Get(p,a,b,c,d,e,f,g)
#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->lpVtbl->Set(p,a,b,c,d,e,f)
#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->lpVtbl->QuerySupport(p,a,b,c)
#else // !defined(__cplusplus) || defined(CINTERFACE)
#define IKsPropertySet_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IKsPropertySet_AddRef(p) (p)->AddRef()
#define IKsPropertySet_Release(p) (p)->Release()
#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->Get(a,b,c,d,e,f,g)
#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->Set(a,b,c,d,e,f)
#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->QuerySupport(a,b,c)
#endif // !defined(__cplusplus) || defined(CINTERFACE)
#endif // _IKsPropertySet_
//
// Return Codes
//
#define DS_OK 0
// The call failed because resources (such as a priority level)
// were already being used by another caller.
#define DSERR_ALLOCATED MAKE_DSHRESULT(10)
// The control (vol,pan,etc.) requested by the caller is not available.
#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT(30)
// An invalid parameter was passed to the returning function
#define DSERR_INVALIDPARAM E_INVALIDARG
// This call is not valid for the current state of this object
#define DSERR_INVALIDCALL MAKE_DSHRESULT(50)
// An undetermined error occured inside the DirectSound subsystem
#define DSERR_GENERIC E_FAIL
// The caller does not have the priority level required for the function to
// succeed.
#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70)
// Not enough free memory is available to complete the operation
#define DSERR_OUTOFMEMORY E_OUTOFMEMORY
// The specified WAVE format is not supported
#define DSERR_BADFORMAT MAKE_DSHRESULT(100)
// The function called is not supported at this time
#define DSERR_UNSUPPORTED E_NOTIMPL
// No sound driver is available for use
#define DSERR_NODRIVER MAKE_DSHRESULT(120)
// This object is already initialized
#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT(130)
// This object does not support aggregation
#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION
// The buffer memory has been lost, and must be restored.
#define DSERR_BUFFERLOST MAKE_DSHRESULT(150)
// Another app has a higher priority level, preventing this call from
// succeeding.
#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT(160)
// This object has not been initialized
#define DSERR_UNINITIALIZED MAKE_DSHRESULT(170)
// The requested COM interface is not available
#define DSERR_NOINTERFACE E_NOINTERFACE
//
// Flags
//
#define DSCAPS_PRIMARYMONO 0x00000001
#define DSCAPS_PRIMARYSTEREO 0x00000002
#define DSCAPS_PRIMARY8BIT 0x00000004
#define DSCAPS_PRIMARY16BIT 0x00000008
#define DSCAPS_CONTINUOUSRATE 0x00000010
#define DSCAPS_EMULDRIVER 0x00000020
#define DSCAPS_CERTIFIED 0x00000040
#define DSCAPS_SECONDARYMONO 0x00000100
#define DSCAPS_SECONDARYSTEREO 0x00000200
#define DSCAPS_SECONDARY8BIT 0x00000400
#define DSCAPS_SECONDARY16BIT 0x00000800
#define DSBPLAY_LOOPING 0x00000001
#define DSBSTATUS_PLAYING 0x00000001
#define DSBSTATUS_BUFFERLOST 0x00000002
#define DSBSTATUS_LOOPING 0x00000004
#define DSBLOCK_FROMWRITECURSOR 0x00000001
#define DSBLOCK_ENTIREBUFFER 0x00000002
#define DSSCL_NORMAL 0x00000001
#define DSSCL_PRIORITY 0x00000002
#define DSSCL_EXCLUSIVE 0x00000003
#define DSSCL_WRITEPRIMARY 0x00000004
#define DS3DMODE_NORMAL 0x00000000
#define DS3DMODE_HEADRELATIVE 0x00000001
#define DS3DMODE_DISABLE 0x00000002
#define DS3D_IMMEDIATE 0x00000000
#define DS3D_DEFERRED 0x00000001
#define DS3D_MINDISTANCEFACTOR 0.0f
#define DS3D_MAXDISTANCEFACTOR 10.0f
#define DS3D_DEFAULTDISTANCEFACTOR 1.0f
#define DS3D_MINROLLOFFFACTOR 0.0f
#define DS3D_MAXROLLOFFFACTOR 10.0f
#define DS3D_DEFAULTROLLOFFFACTOR 1.0f
#define DS3D_MINDOPPLERFACTOR 0.0f
#define DS3D_MAXDOPPLERFACTOR 10.0f
#define DS3D_DEFAULTDOPPLERFACTOR 1.0f
#define DS3D_DEFAULTMINDISTANCE 1.0f
#define DS3D_DEFAULTMAXDISTANCE 1000000000.0f
#define DS3D_MINCONEANGLE 0
#define DS3D_MAXCONEANGLE 360
#define DS3D_DEFAULTCONEANGLE 360
#define DS3D_DEFAULTCONEOUTSIDEVOLUME 0
#define DSBCAPS_PRIMARYBUFFER 0x00000001
#define DSBCAPS_STATIC 0x00000002
#define DSBCAPS_LOCHARDWARE 0x00000004
#define DSBCAPS_LOCSOFTWARE 0x00000008
#define DSBCAPS_CTRL3D 0x00000010
#define DSBCAPS_CTRLFREQUENCY 0x00000020
#define DSBCAPS_CTRLPAN 0x00000040
#define DSBCAPS_CTRLVOLUME 0x00000080
#define DSBCAPS_CTRLPOSITIONNOTIFY 0x00000100
#define DSBCAPS_CTRLDEFAULT 0x000000E0
#define DSBCAPS_CTRLALL 0x000001F0
#define DSBCAPS_STICKYFOCUS 0x00004000
#define DSBCAPS_GLOBALFOCUS 0x00008000
#define DSBCAPS_GETCURRENTPOSITION2 0x00010000
#define DSBCAPS_MUTE3DATMAXDISTANCE 0x00020000
#define DSCBCAPS_WAVEMAPPED 0x80000000
#define DSSPEAKER_HEADPHONE 0x00000001
#define DSSPEAKER_MONO 0x00000002
#define DSSPEAKER_QUAD 0x00000003
#define DSSPEAKER_STEREO 0x00000004
#define DSSPEAKER_SURROUND 0x00000005
#define DSSPEAKER_GEOMETRY_MIN 0x00000005 // 5 degrees
#define DSSPEAKER_GEOMETRY_NARROW 0x0000000A // 10 degrees
#define DSSPEAKER_GEOMETRY_WIDE 0x00000014 // 20 degrees
#define DSSPEAKER_GEOMETRY_MAX 0x000000B4 // 180 degrees
#define DSSPEAKER_COMBINED(c, g) ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16))
#define DSSPEAKER_CONFIG(a) ((BYTE)(a))
#define DSSPEAKER_GEOMETRY(a) ((BYTE)(((DWORD)(a) >> 16) & 0x00FF))
#define DSCCAPS_EMULDRIVER 0x00000020
#define DSCBLOCK_ENTIREBUFFER 0x00000001
#define DSCBSTATUS_CAPTURING 0x00000001
#define DSCBSTATUS_LOOPING 0x00000002
#define DSCBSTART_LOOPING 0x00000001
#define DSBFREQUENCY_MIN 100
#define DSBFREQUENCY_MAX 100000
#define DSBFREQUENCY_ORIGINAL 0
#define DSBPAN_LEFT -10000
#define DSBPAN_CENTER 0
#define DSBPAN_RIGHT 10000
#define DSBVOLUME_MIN -10000
#define DSBVOLUME_MAX 0
#define DSBSIZE_MIN 4
#define DSBSIZE_MAX 0x0FFFFFFF
#define DSBPN_OFFSETSTOP 0xFFFFFFFF
#ifdef __cplusplus
};
#endif // __cplusplus
#endif // __DSOUND_INCLUDED__
+3 -1
View File
@@ -922,7 +922,9 @@ int fireball_create( vec3d * pos, int fireball_type, int render_type, int parent
}
if ( fb->fireball_render_type == FIREBALL_WARP_EFFECT ) {
Assert( warp_lifetime > 4.0f ); // Warp lifetime must be at least 4 seconds!
Assert( warp_lifetime >= 4.0f ); // Warp lifetime must be at least 4 seconds!
if ( warp_lifetime < 4.0f )
warp_lifetime = 4.0f;
fb->total_time = warp_lifetime; // in seconds
} else {
fb->total_time = i2fl(fl->num_frames) / fl->fps; // in seconds
+1
View File
@@ -36,6 +36,7 @@ struct ship_info;
#define FIREBALL_NUM_LARGE_EXPLOSIONS 2
extern int fireball_used[MAX_FIREBALL_TYPES];
extern int Num_fireball_types;
// all this moved here by Goober5000 because it makes more sense in the H file
typedef struct fireball_lod {
-1
View File
@@ -14,7 +14,6 @@
#include "ship/ship.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -8,7 +8,6 @@
#include "gamesnd/eventmusic.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -16,7 +16,6 @@
#include "parse/sexp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -15,7 +15,6 @@
#include "mission/missiongrid.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -19,7 +19,6 @@
#include "species_defs/species_defs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -7,7 +7,6 @@
#include "ship/ship.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -26,7 +26,6 @@
#include "mission/missionparse.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -30,7 +30,6 @@
#include "localization/localize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -23,7 +23,6 @@
#include "mission/missiongoals.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -19,7 +19,6 @@
#include "mission/missionparse.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -18,7 +18,6 @@
#include "mission/missionparse.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -22,7 +22,6 @@
#include "mission/missionparse.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -17,7 +17,6 @@
#include "localization/localize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -20,7 +20,6 @@
#include "iff_defs/iff_defs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -7,7 +7,6 @@
#include "ship/ship.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -20,7 +20,6 @@
#include "localization/localize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -14,7 +14,6 @@
#include "dialog1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -27,7 +27,6 @@
#include "weapon/weapon.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+11 -9
View File
@@ -22,7 +22,6 @@
#include "localization/localize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -82,15 +81,17 @@ void event_editor::DoDataExchange(CDataExchange* pDX)
DDX_CBString(pDX, IDC_WAVE_FILENAME, m_wave_filename);
DDX_LBIndex(pDX, IDC_MESSAGE_LIST, m_cur_msg);
// m_team == -1 maps to 2
if(m_team == -1){
m_team = 2;
m_team = MAX_TVT_TEAMS;
}
DDX_CBIndex(pDX, IDC_EVENT_TEAM, m_team);
// m_message_team == -1 maps to 2
if(m_message_team == -1){
m_message_team = 2;
m_message_team = MAX_TVT_TEAMS;
}
DDX_CBIndex(pDX, IDC_MESSAGE_TEAM, m_message_team);
//}}AFX_DATA_MAP
@@ -570,7 +571,7 @@ void event_editor::update_cur_message()
m_persona = 0;
}
if(m_messages[m_cur_msg].multi_team >= 2){
if(m_messages[m_cur_msg].multi_team >= MAX_TVT_TEAMS){
m_message_team = -1;
m_messages[m_cur_msg].multi_team = -1;
} else {
@@ -715,6 +716,7 @@ void event_editor::reset_event(int num, HTREEITEM after)
m_events[num].chain_delay = -1;
m_events[num].objective_text = NULL;
m_events[num].objective_key_text = NULL;
m_events[num].team = -1;
m_sig[num] = -1;
m_event_tree.item_index = -1;
@@ -1174,7 +1176,7 @@ int event_editor::save_message(int num)
// box list.
m_messages[num].persona_index = m_persona - 1;
if(m_message_team >= 2){
if(m_message_team >= MAX_TVT_TEAMS){
m_messages[num].multi_team = -1;
m_message_team = -1;
} else {
@@ -1409,8 +1411,8 @@ void event_editor::OnSelchangeTeam()
UpdateData(TRUE);
// team == 2, means no team
if(m_team == 2){
// If the team isn't valid mark it as such.
if((m_team >= MAX_TVT_TEAMS) || (m_team < -1) ){
m_team = -1;
}
@@ -1426,8 +1428,8 @@ void event_editor::OnSelchangeMessageTeam()
UpdateData(TRUE);
// team == 2, means no team
if(m_message_team == 2){
// If the team isn't valid mark it as such.
if((m_message_team>= MAX_TVT_TEAMS) || (m_message_team < -1) ) {
m_message_team = -1;
}
+42 -4
View File
@@ -28,6 +28,8 @@
#include "debugconsole/dbugfile.h"
#include "globalincs/mspdb_callstack.h"
#include "AFXADV.H"
#ifdef NDEBUG
#ifndef FRED
#error macro FRED is not defined when trying to build release Fred. Please define FRED macro in build settings in all Fred projects
@@ -35,7 +37,6 @@
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -80,12 +81,12 @@ window_data Mission_notes_wnd_data;
BEGIN_MESSAGE_MAP(CFREDApp, CWinApp)
//{{AFX_MSG_MAP(CFREDApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
@@ -125,7 +126,7 @@ BOOL CFREDApp::InitInstance()
// disable the debug memory stuff
_CrtSetDbgFlag(~(_CRTDBG_ALLOC_MEM_DF) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
// _CrtSetDbgFlag(~(_CRTDBG_ALLOC_MEM_DF) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
// Standard initialization
// If you are not using these features and wish to reduce the size
@@ -236,9 +237,23 @@ BOOL CFREDApp::InitInstance()
*str_end = '\0';
// Goober5000 - figure out where the FRED file dialog should go
if ((m_pRecentFileList != NULL) && (m_pRecentFileList->GetSize() > 0))
{
// use the most recently opened file to supply the default folder
m_sInitialDir = m_pRecentFileList->operator[](0); // lol syntax
}
else
{
// use FRED's own directory to search for missions
m_sInitialDir = Fred_base_dir;
m_sInitialDir += "\\data\\missions";
}
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
ParseCommandLine(cmdInfo);
m_nCmdShow = Main_wnd_data.p.showCmd;
@@ -309,6 +324,25 @@ void CFREDApp::OnAppAbout()
aboutDlg.DoModal();
}
// G5K - from http://www.experts-exchange.com/Programming/System/Windows__Programming/MFC/Q_20155824.html
void CFREDApp::OnFileOpen()
{
// use the initial dir the first time we prompt for a file
// name. after a successful open, the file name will be
// changed to be the empty string and the default dir
// will be supplied by the CFileDialog internal memory
if(!DoPromptFileName(m_sInitialDir, AFX_IDS_OPENFILE, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, TRUE, NULL))
{
// open cancelled
return;
}
AfxGetApp()->OpenDocumentFile(m_sInitialDir);
// if returns NULL, the user has already been alerted
// now erase the initial dir since we only want to use it once
m_sInitialDir.Empty();
}
/////////////////////////////////////////////////////////////////////////////
// CFREDApp commands
@@ -668,3 +702,7 @@ int CFREDApp::ExitInstance()
return CWinApp::ExitInstance();
}
// Empty functions to make fred link with the sexp_mission_set_subspace
void game_start_subspace_ambient_sound() {}
void game_stop_subspace_ambient_sound() {}
+2
View File
@@ -52,6 +52,7 @@ typedef struct window_data {
class CFREDApp : public CWinApp
{
int app_init;
CString m_sInitialDir;
public:
void record_window_data(window_data *wndd, CWnd *wnd);
@@ -75,6 +76,7 @@ public:
//{{AFX_MSG(CFREDApp)
afx_msg void OnAppAbout();
afx_msg void OnFileOpen();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
+50 -7
View File
@@ -878,10 +878,10 @@ BEGIN
IDC_STATIC,60,183,307,11
END
IDD_MISSION_NOTES DIALOGEX 0, 0, 479, 349
IDD_MISSION_NOTES DIALOG DISCARDABLE 0, 0, 479, 349
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Mission Specs"
FONT 8, "MS Sans Serif", 0, 0, 0x1
FONT 8, "MS Sans Serif"
BEGIN
RTEXT "Title",IDC_STATIC,7,10,29,8
EDITTEXT IDC_MISSION_TITLE,41,7,109,14,ES_AUTOHSCROLL
@@ -1003,6 +1003,8 @@ BEGIN
CONTROL "",IDC_MAX_RESPAWN_DELAY_SPIN,"msctls_updown32",
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
UDS_ARROWKEYS,136,112,11,14
PUSHBUTTON "Sound Environment",IDC_SOUND_ENVIRONMENT_BUTTON,158,244,
140,15
END
IDD_PREFERENCES DIALOG DISCARDABLE 0, 0, 333, 81
@@ -1527,7 +1529,7 @@ END
IDD_EVENT_EDITOR DIALOGEX 0, 0, 437, 431
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Mission Event Edit"
FONT 8, "MS Sans Serif"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "Tree1",IDC_EVENT_TREE,"SysTreeView32",TVS_HASBUTTONS |
TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS |
@@ -2455,17 +2457,18 @@ BEGIN
WS_TABSTOP
LTEXT "Example",IDC_LBL_EXAMPLE,17,158,31,10
EDITTEXT IDC_EXAMPLE,49,156,77,12,ES_AUTOHSCROLL | ES_READONLY
CONTROL "Don't replace existing file names",IDC_NO_REPLACE,
CONTROL "Include sender name in filename",IDC_INCLUDE_SENDER,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,175,112,10
PUSHBUTTON "Generate File Names",IDC_GENERATE_FILE_NAMES,12,190,120,
14
CONTROL "Don't replace existing file names",IDC_NO_REPLACE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,186,112,10
PUSHBUTTON "Generate File Names",IDC_GENERATE_FILE_NAMES,12,198,120,14
GROUPBOX "Script Options",IDC_SCRIPT_OPTIONS,143,7,257,204
GROUPBOX "Script Entry Format",IDC_ENTRY,149,17,246,76
EDITTEXT IDC_ENTRY_FORMAT,154,28,109,56,ES_MULTILINE |
ES_AUTOHSCROLL | ES_WANTRETURN
LTEXT "$filename - name of the message file\r\n$message - text of the message\r\n$persona - persona of the sender\r\n$sender - name of the sender\r\n\r\nNote that $persona and $sender will only appear for the Message section.",
IDC_STATIC,270,28,120,58
GROUPBOX "Export",IDC_EXPORT,149,98,119,64
GROUPBOX "Export",IDC_EXPORT,149,98,119,83
CONTROL "Everything",IDC_EXPORT_EVERYTHING,"Button",
BS_AUTORADIOBUTTON,153,108,99,9
CONTROL "Just Command Briefings",IDC_EXPORT_COMMAND_BRIEFINGS,
@@ -2477,6 +2480,9 @@ BEGIN
CONTROL "Just Messages",IDC_EXPORT_MESSAGES,"Button",
BS_AUTORADIOBUTTON,153,148,99,9
PUSHBUTTON "Generate Script",IDC_GENERATE_SCRIPT,149,190,120,14
CONTROL "Group send-message-list messages before others",
IDC_GROUP_MESSAGES,"Button",BS_AUTOCHECKBOX | BS_TOP |
BS_MULTILINE | WS_TABSTOP,166,159,100,19
END
IDD_BRIEFING_PERSONAS DIALOG DISCARDABLE 0, 0, 320, 201
@@ -2554,6 +2560,32 @@ BEGIN
WS_VSCROLL | WS_TABSTOP
END
IDD_SOUND_ENVIRONMENT DIALOGEX 0, 0, 315, 89
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Sound Environment"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
COMBOBOX IDC_SOUND_ENVIRONMENT,75,9,117,30,CBS_DROPDOWN |
WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_SOUND_ENVIRONMENT_VOLUME,75,31,76,12,ES_AUTOHSCROLL
EDITTEXT IDC_SOUND_ENVIRONMENT_DAMPING,75,48,76,12,ES_AUTOHSCROLL
EDITTEXT IDC_SOUND_ENVIRONMENT_DECAY,75,64,76,12,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,258,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,258,24,50,14
LTEXT "Environment:",IDC_SOUND_ENVIRONMENT_LABEL,28,13,42,8
LTEXT "Volume:",IDC_SOUND_ENVIRONMENT_VOLUME_LABEL,42,35,26,8
LTEXT "Damping:",IDC_SOUND_ENVIRONENT_DAMPING_LABEL,37,52,31,8
LTEXT "Decay Time:",IDC_SOUND_ENVIRONMENT_DECAY_LABEL,27,68,41,
8
LTEXT "range: 0.0 .. 1.0",IDC_STATIC,157,32,55,8,WS_DISABLED
LTEXT "range: 0.1 .. 2.0",IDC_STATIC,157,50,55,8,WS_DISABLED
LTEXT "range: 0.1 .. 20.0",IDC_STATIC,157,66,62,11,WS_DISABLED
GROUPBOX "Preview",IDC_SOUND_ENVIRONMENT_TEST,229,50,79,32
PUSHBUTTON "Browse",IDC_BROWSE_WAVE,258,62,44,15
PUSHBUTTON "IDB_PLAY",IDC_PLAY,235,62,17,15,BS_BITMAP,
WS_EX_TRANSPARENT
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
@@ -2975,6 +3007,17 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 59
END
IDD_SOUND_ENVIRONMENT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 308
VERTGUIDE, 70
VERTGUIDE, 151
VERTGUIDE, 157
TOPMARGIN, 7
BOTTOMMARGIN, 82
END
END
#endif // APSTUDIO_INVOKED
+3 -4
View File
@@ -50,7 +50,6 @@
extern int Num_objects;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -427,7 +426,7 @@ int CFREDDoc::load_mission(char *pathname, int flags)
generate_weaponry_usage_list(i, used_pool);
for (j=0; j<Team_data[i].num_weapon_choices; j++) {
// The amount used in wings is always set by a static loadout entry so skip any that were set by Sexp variables
if ((Team_data[i].weaponry_pool_variable[j] == -1) && (Team_data[i].weaponry_amount_variable[j] == -1) ) {
if ( (!strlen(Team_data[i].weaponry_pool_variable[j])) && (!strlen(Team_data[i].weaponry_amount_variable[j])) ) {
// convert weaponry_pool to be extras available beyond the current ships weapons
Team_data[i].weaponry_count[j] -= used_pool[Team_data[i].weaponry_pool[j]];
if (Team_data[i].weaponry_count[j] < 0) {
@@ -446,8 +445,8 @@ int CFREDDoc::load_mission(char *pathname, int flags)
// add the weapon as a new entry
Team_data[i].weaponry_pool[Team_data[i].num_weapon_choices] = j;
Team_data[i].weaponry_count[Team_data[i].num_weapon_choices] = used_pool[j];
Team_data[i].weaponry_amount_variable[Team_data[i].num_weapon_choices] = -1;
Team_data[i].weaponry_pool_variable[Team_data[i].num_weapon_choices++] = -1;
strcpy_s(Team_data[i].weaponry_amount_variable[Team_data[i].num_weapon_choices], "");
strcpy_s(Team_data[i].weaponry_pool_variable[Team_data[i].num_weapon_choices++], "");
}
}
}
-1
View File
@@ -58,7 +58,6 @@ extern float flFrametime;
extern subsys_to_render Render_subsys;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -188,7 +188,6 @@ int Framerate_delay;
void game_start_time(){}
void game_stop_time(){}
int game_get_default_skill_level(){return 0;}
void game_load_palette(){}
float FreeSpace_gamma;
int set_cdrom_path(int){return 0;}
int find_freespace_cd(char*){return 0;}
-1
View File
@@ -65,7 +65,6 @@
#include "gl/glu.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -18,7 +18,6 @@
#include "editor.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -16,7 +16,6 @@
#include "globalincs/linklist.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -18,7 +18,6 @@
#include "weapon/weapon.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -19,7 +19,6 @@
#include "object/objectdock.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -26,7 +26,6 @@
#include "iff_defs/iff_defs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+12 -7
View File
@@ -324,8 +324,10 @@ bool fred_init()
timer_init();
Assert(strlen(Fred_exe_dir) > 0);
Assert(strlen(Fred_base_dir) > 0);
// sigh... this should enable proper reading of cmdline_fso.cfg - Goober5000
cfile_chdir(Fred_base_dir);
// this should enable mods - Kazan
fred2_parse_cmdline(__argc, __argv);
@@ -379,7 +381,7 @@ bool fred_init()
}
*/
snd_init(0, 0, 44100, 16);
snd_init();
// Not ready for this yet
// Cmdline_nospec = 1;
@@ -997,9 +999,9 @@ void clear_mission()
for ( j = 0; j < MAX_SHIP_CLASSES; j++ ) {
if (Ship_info[j].flags & SIF_DEFAULT_PLAYER_SHIP) {
Team_data[i].ship_list[count] = j;
Team_data[i].ship_list_variables[count] = -1;
strcpy_s(Team_data[i].ship_list_variables[count], "");
Team_data[i].ship_count[count] = 5;
Team_data[i].ship_count_variables[count++] = -1;
strcpy_s(Team_data[i].ship_count_variables[count++], "");
}
}
Team_data[i].num_ship_choices = count;
@@ -1013,8 +1015,8 @@ void clear_mission()
Team_data[i].weaponry_count[count] = 500;
}
Team_data[i].weaponry_pool[count] = j;
Team_data[i].weaponry_pool_variable[count] = -1;
Team_data[i].weaponry_amount_variable[count++] = -1;
strcpy_s(Team_data[i].weaponry_pool_variable[count], "");
strcpy_s(Team_data[i].weaponry_amount_variable[count++], "");
}
}
Team_data[i].num_weapon_choices = count;
@@ -1090,6 +1092,9 @@ void clear_mission()
strcpy_s(The_mission.skybox_model, "");
strcpy_s(The_mission.envmap_name, "");
// no sound environment
The_mission.sound_environment.id = -1;
ENVMAP = -1;
set_modified(FALSE);
@@ -2519,7 +2524,7 @@ void generate_weaponry_usage_list(int *arr, int wing)
j = swp->num_secondary_banks;
while (j--) {
if (swp->secondary_bank_weapons[j] >=0 && swp->secondary_bank_weapons[j] < MAX_WEAPON_TYPES) {
arr[swp->secondary_bank_weapons[j]] += int(ceil(swp->secondary_bank_ammo[j] * swp->secondary_bank_capacity[j] / 100 / (Weapon_info[swp->secondary_bank_weapons[j]].cargo_size + 0.5f)));
arr[swp->secondary_bank_weapons[j]] += (int) floor((swp->secondary_bank_ammo[j] * swp->secondary_bank_capacity[j] / 100.0f / Weapon_info[swp->secondary_bank_weapons[j]].cargo_size) + 0.5f);
}
}
}
-1
View File
@@ -19,7 +19,6 @@
#include "mission/missionmessage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -25,7 +25,6 @@
#define ID_REPLACE_WINGS 15000
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+12 -1
View File
@@ -14,6 +14,7 @@
#include "FREDDoc.h"
#include "MissionNotesDlg.h"
#include "CustomWingNames.h"
#include "soundenvironmentdlg.h"
#include "Management.h"
#include "gamesnd/eventmusic.h"
#include "cfile/cfile.h"
@@ -21,7 +22,6 @@
#include "mission/missionmessage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -143,6 +143,7 @@ BEGIN_MESSAGE_MAP(CMissionNotesDlg, CDialog)
ON_BN_CLICKED(IDC_LOADING_SCREEN_BUTTON1024, OnLoad1024)
ON_BN_CLICKED(IDC_CONTRAIL_THRESHOLD_CHECK, OnToggleContrailThreshold)
ON_BN_CLICKED(IDC_CUSTOM_WING_NAMES, OnCustomWingNames)
ON_BN_CLICKED(IDC_SOUND_ENVIRONMENT_BUTTON, OnSoundEnvironment)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -725,3 +726,13 @@ void CMissionNotesDlg::OnCustomWingNames()
UpdateData(FALSE);
}
void CMissionNotesDlg::OnSoundEnvironment()
{
UpdateData(TRUE);
SoundEnvironment dlg;
dlg.DoModal();
UpdateData(FALSE);
}
+1
View File
@@ -98,6 +98,7 @@ protected:
afx_msg void OnLoad1024();
afx_msg void OnToggleContrailThreshold();
afx_msg void OnCustomWingNames();
afx_msg void OnSoundEnvironment();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
+44 -13
View File
@@ -44,6 +44,8 @@
#include "iff_defs/iff_defs.h"
#include "missionui/fictionviewer.h"
#include "globalincs/version.h"
#include "sound/sound.h"
#include "sound/ds.h"
void CFred_mission_save::convert_special_tags_to_retail(char *text, int max_len)
@@ -589,6 +591,30 @@ int CFred_mission_save::save_mission_info()
fso_comment_pop();
}
// sound environment (EFX/EAX) - taylor
sound_env *m_env = &The_mission.sound_environment;
if ( (m_env->id >= 0) && (m_env->id < (int)EFX_presets.size()) ) {
EFXREVERBPROPERTIES *prop = &EFX_presets[m_env->id];
fso_comment_push(";;FSO 3.6.12;;");
fout_version("\n\n$Sound Environment: %s", prop->name.c_str());
if (m_env->volume != prop->flGain) {
fout_version("\n+Volume: %f", m_env->volume);
}
if (m_env->damping != prop->flDecayHFRatio) {
fout_version("\n+Damping: %f", m_env->damping);
}
if (m_env->decay != prop->flDecayTime) {
fout_version("\n+Decay Time: %f", m_env->decay);
}
fso_comment_pop();
}
return err;
}
@@ -1109,6 +1135,7 @@ int CFred_mission_save::save_variables()
int CFred_mission_save::save_players()
{
int i, j;
int var_idx;
int used_pool[MAX_WEAPON_TYPES];
// write out alternate name list
@@ -1153,20 +1180,22 @@ int CFred_mission_save::save_players()
for (j=0; j<Team_data[i].num_ship_choices; j++) {
// Check to see if a variable name should be written for the class rather than a number
if (Team_data[i].ship_list_variables[j] != -1) {
Assert (Team_data[i].ship_list_variables[j] > -1 && Team_data[i].ship_list_variables[j] < MAX_SEXP_VARIABLES);
if (strlen(Team_data[i].ship_list_variables[j])) {
var_idx = get_index_sexp_variable_name(Team_data[i].ship_list_variables[j]);
Assert (var_idx > -1 && var_idx < MAX_SEXP_VARIABLES);
fout("\t@%s\t", Sexp_variables[Team_data[i].ship_list_variables[j]].variable_name);
fout("\t@%s\t", Sexp_variables[var_idx].variable_name);
}
else {
fout("\t\"%s\"\t", Ship_info[Team_data[i].ship_list[j]].name);
}
// Now check if we should write a variable or a number for the amount of ships available
if (Team_data[i].ship_count_variables[j] != -1) {
Assert (Team_data[i].ship_count_variables[j] > -1 && Team_data[i].ship_count_variables[j] < MAX_SEXP_VARIABLES);
if (strlen(Team_data[i].ship_count_variables[j])) {
var_idx = get_index_sexp_variable_name(Team_data[i].ship_count_variables[j]);
Assert (var_idx > -1 && var_idx < MAX_SEXP_VARIABLES);
fout("@%s\n", Sexp_variables[Team_data[i].ship_count_variables[j]].variable_name);
fout("@%s\n", Sexp_variables[var_idx].variable_name);
}
else {
fout("%d\n", Team_data[i].ship_count[j]);
@@ -1185,10 +1214,11 @@ int CFred_mission_save::save_players()
generate_weaponry_usage_list(i, used_pool);
for (j=0; j<Team_data[i].num_weapon_choices; j++) {
// first output the weapon name or a variable that sets it
if (Team_data[i].weaponry_pool_variable[j] != -1) {
Assert (Team_data[i].weaponry_pool_variable[j] > -1 && Team_data[i].weaponry_pool_variable[j] < MAX_SEXP_VARIABLES);
if (strlen(Team_data[i].weaponry_pool_variable[j])) {
var_idx = get_index_sexp_variable_name(Team_data[i].weaponry_pool_variable[j]);
Assert (var_idx > -1 && var_idx < MAX_SEXP_VARIABLES);
fout("\t@%s\t", Sexp_variables[Team_data[i].weaponry_pool_variable[j]].variable_name);
fout("\t@%s\t", Sexp_variables[var_idx].variable_name);
}
else {
fout("\t\"%s\"\t", Weapon_info[Team_data[i].weaponry_pool[j]].name);
@@ -1197,13 +1227,14 @@ int CFred_mission_save::save_players()
// now output the amount of this weapon or a variable that sets it. If this weapon is in the used pool and isn't
// set by a variable we should add the amount of weapons used by the wings to it and zero the entry so we know
// that we have dealt with it
if (Team_data[i].weaponry_amount_variable[j] != -1) {
Assert (Team_data[i].weaponry_amount_variable[j] > -1 && Team_data[i].weaponry_amount_variable[j] < MAX_SEXP_VARIABLES);
if (strlen(Team_data[i].weaponry_amount_variable[j])) {
var_idx = get_index_sexp_variable_name(Team_data[i].weaponry_amount_variable[j]);
Assert (var_idx > -1 && var_idx < MAX_SEXP_VARIABLES);
fout ("@%s\n", Sexp_variables[Team_data[i].weaponry_amount_variable[j]].variable_name);
fout ("@%s\n", Sexp_variables[var_idx].variable_name);
}
else {
if (Team_data[i].weaponry_pool_variable[j] != -1) {
if (strlen(Team_data[i].weaponry_pool_variable[j])) {
fout ("%d\n", Team_data[i].weaponry_count[j]);
}
else {
-1
View File
@@ -16,7 +16,6 @@
#include "parse/sexp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -14,7 +14,6 @@
#include "OperatorArgTypeSelect.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -17,7 +17,6 @@
#include "FREDView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+46 -21
View File
@@ -19,7 +19,6 @@
#include "weapon/weapon.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -95,22 +94,32 @@ BOOL player_start_editor::OnInitDialog()
for(idx=0; idx<Team_data[i].num_ship_choices; idx++)
{
// do we have a variable for this entry? if we don't....
if (Team_data[i].ship_list_variables[idx] == -1)
if (!strlen(Team_data[i].ship_list_variables[idx]))
{
// This pool is set to hold the number of ships available at an index corresponding to the Ship_info array.
static_ship_pool[i][Team_data[i].ship_list[idx]] = Team_data[i].ship_count[idx];
// This pool is set to hold whether a ship at a Ship_info index has been set by a variable (and the
// variables index in Sexp_variables) if it has).
static_ship_variable_pool[i][Team_data[i].ship_list[idx]] = Team_data[i].ship_count_variables[idx];
if (strlen(Team_data[i].ship_count_variables[idx])) {
static_ship_variable_pool[i][Team_data[i].ship_list[idx]] = get_index_sexp_variable_name(Team_data[i].ship_count_variables[idx]);
}
else {
static_ship_variable_pool[i][Team_data[i].ship_list[idx]] = -1;
}
}
// if we do....
else
{
// This pool is set to hold the number of ships available at an index corresponding to the Sexp_variables array
dynamic_ship_pool[i][Team_data[i].ship_list_variables[idx]] = Team_data[i].ship_count[idx];
dynamic_ship_pool[i][get_index_sexp_variable_name(Team_data[i].ship_list_variables[idx])] = Team_data[i].ship_count[idx];
// This pool is set to hold whether a ship at a Ship_info index has been set by a variable (and the
// variables index in Sexp_variables) if it has).
dynamic_ship_variable_pool[i][Team_data[i].ship_list_variables[idx]] = Team_data[i].ship_count_variables[idx];
if (strlen(Team_data[i].ship_count_variables[idx])) {
dynamic_ship_variable_pool[i][get_index_sexp_variable_name(Team_data[i].ship_list_variables[idx])] = get_index_sexp_variable_name(Team_data[i].ship_count_variables[idx]);
}
else {
dynamic_ship_variable_pool[i][get_index_sexp_variable_name(Team_data[i].ship_list_variables[idx])] = -1;
}
}
}
}
@@ -125,16 +134,26 @@ BOOL player_start_editor::OnInitDialog()
for(idx=0; idx<Team_data[i].num_weapon_choices; idx++)
{
// do we have a variable for this entry?
if (Team_data[i].weaponry_pool_variable[idx] == -1)
if (!strlen(Team_data[i].weaponry_pool_variable[idx]))
{
static_weapon_pool[i][Team_data[i].weaponry_pool[idx]] = Team_data[i].weaponry_count[idx];
static_weapon_variable_pool[i][Team_data[i].weaponry_pool[idx]] = Team_data[i].weaponry_amount_variable[idx];
if (strlen(Team_data[i].weaponry_amount_variable[idx])) {
static_weapon_variable_pool[i][Team_data[i].weaponry_pool[idx]] = get_index_sexp_variable_name(Team_data[i].weaponry_amount_variable[idx]);
}
else {
static_weapon_variable_pool[i][Team_data[i].weaponry_pool[idx]] = -1;
}
}
// if we do....
else
{
dynamic_weapon_pool[i][Team_data[i].weaponry_pool_variable[idx]] = Team_data[i].weaponry_count[idx];
dynamic_weapon_variable_pool[i][Team_data[i].weaponry_pool_variable[idx]] = Team_data[i].weaponry_amount_variable[idx];
dynamic_weapon_pool[i][get_index_sexp_variable_name(Team_data[i].weaponry_pool_variable[idx])] = Team_data[i].weaponry_count[idx];
if (strlen(Team_data[i].weaponry_amount_variable[idx])) {
dynamic_weapon_variable_pool[i][get_index_sexp_variable_name(Team_data[i].weaponry_pool_variable[idx])] = get_index_sexp_variable_name(Team_data[i].weaponry_amount_variable[idx]);
}
else {
dynamic_weapon_variable_pool[i][get_index_sexp_variable_name(Team_data[i].weaponry_pool_variable[idx])] = -1;
}
}
}
}
@@ -760,18 +779,24 @@ void player_start_editor::OnOK()
// Copy the variable to Team_data
Team_data[i].ship_list_variables[num_choices] = idx;
if (idx != -1) {
Assert (idx < MAX_SEXP_VARIABLES);
strcpy_s(Team_data[i].ship_list_variables[num_choices], Sexp_variables[idx].variable_name);
}
else {
strcpy_s(Team_data[i].ship_list_variables[num_choices], "");
}
Team_data[i].ship_list[num_choices] = -1;
// Now we need to set the number of this type available
if (dynamic_ship_variable_pool[i][idx] == -1) {
Team_data[i].ship_count[num_choices] = dynamic_ship_pool[i][idx];
Team_data[i].ship_count_variables[num_choices] = -1;
strcpy_s(Team_data[i].ship_count_variables[num_choices], "");
}
else {
Assert (Sexp_variables[dynamic_ship_variable_pool[i][idx]].type & SEXP_VARIABLE_NUMBER);
Team_data[i].ship_count_variables[num_choices] = dynamic_ship_variable_pool[i][idx];
strcpy_s(Team_data[i].ship_count_variables[num_choices], Sexp_variables[dynamic_ship_variable_pool[i][idx]].variable_name);
Team_data[i].ship_count[num_choices] = atoi(Sexp_variables[dynamic_ship_variable_pool[i][idx]].text);
}
@@ -785,17 +810,17 @@ void player_start_editor::OnOK()
// if we have ships here
if(static_ship_pool[i][idx] > 0 || static_ship_variable_pool[i][idx] > -1) {
Team_data[i].ship_list[num_choices] = idx;
Team_data[i].ship_list_variables[num_choices] = -1;
strcpy_s(Team_data[i].ship_list_variables[num_choices], "");
// Now set the number of this class available
if (static_ship_variable_pool[i][idx] == -1) {
Team_data[i].ship_count[num_choices] = static_ship_pool[i][idx];
Team_data[i].ship_count_variables[num_choices] = -1;
strcpy_s(Team_data[i].ship_count_variables[num_choices], "");
}
else {
Assert (Sexp_variables[static_ship_variable_pool[i][idx]].type & SEXP_VARIABLE_NUMBER);
Team_data[i].ship_count_variables[num_choices] = static_ship_variable_pool[i][idx];
strcpy_s(Team_data[i].ship_count_variables[num_choices], Sexp_variables[static_ship_variable_pool[i][idx]].variable_name);
Team_data[i].ship_count[num_choices] = atoi(Sexp_variables[static_ship_variable_pool[i][idx]].text);
}
@@ -830,20 +855,20 @@ void player_start_editor::OnOK()
}
// Copy the variable to Team_data
Team_data[i].weaponry_pool_variable[num_choices] = idx;
strcpy_s(Team_data[i].weaponry_pool_variable[num_choices], Sexp_variables[idx].variable_name);
Team_data[i].weaponry_pool[num_choices] = -1;
// Now we need to set the number of this class available
if (dynamic_weapon_variable_pool[i][idx] == -1)
{
Team_data[i].weaponry_count[num_choices] = dynamic_weapon_pool[i][idx];
Team_data[i].weaponry_amount_variable[num_choices] = -1;
strcpy_s(Team_data[i].weaponry_amount_variable[num_choices], "");
}
else
{
Assert (Sexp_variables[dynamic_weapon_variable_pool[i][idx]].type & SEXP_VARIABLE_NUMBER);
Team_data[i].weaponry_amount_variable[num_choices] = dynamic_weapon_variable_pool[i][idx];
strcpy_s(Team_data[i].weaponry_amount_variable[num_choices], Sexp_variables[dynamic_weapon_variable_pool[i][idx]].variable_name);
Team_data[i].weaponry_count[num_choices] = atoi(Sexp_variables[dynamic_weapon_variable_pool[i][idx]].text);
}
@@ -859,19 +884,19 @@ void player_start_editor::OnOK()
if(static_weapon_pool[i][idx] > 0 || static_weapon_variable_pool[i][idx] > -1)
{
Team_data[i].weaponry_pool[num_choices] = idx;
Team_data[i].weaponry_pool_variable[num_choices] = -1;
strcpy_s(Team_data[i].weaponry_pool_variable[num_choices], "");
// Now set the number of this class available
if (static_weapon_variable_pool[i][idx] == -1)
{
Team_data[i].weaponry_count[num_choices] = static_weapon_pool[i][idx];
Team_data[i].weaponry_amount_variable[num_choices] = -1;
strcpy_s(Team_data[i].weaponry_amount_variable[num_choices], "");
}
else
{
Assert (Sexp_variables[static_weapon_variable_pool[i][idx]].type & SEXP_VARIABLE_NUMBER);
Team_data[i].weaponry_amount_variable[num_choices] = static_weapon_variable_pool[i][idx];
strcpy_s(Team_data[i].weaponry_amount_variable[num_choices], Sexp_variables[static_weapon_variable_pool[i][idx]].variable_name);
Team_data[i].weaponry_count[num_choices] = atoi(Sexp_variables[static_weapon_variable_pool[i][idx]].text);
}
-1
View File
@@ -16,7 +16,6 @@
#include "FREDView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -22,7 +22,6 @@
#define ID_WING_DATA 9000
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+17 -4
View File
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by fred.rc
// Microsoft Developer Studio generated include file.
// Used by FRED.rc
//
#define IDC_SAVE_DEFAULT_PREFS 3
#define ID_DELETE_VARIABLE 3
@@ -123,6 +123,7 @@
#define IDB_DATA_90 314
#define IDB_DATA_95 315
#define IDD_FICTION_VIEWER 318
#define IDD_SOUND_ENVIRONMENT 319
#define IDC_SHIP_CLASS 1003
#define IDC_SHIP_WING 1004
#define IDC_SOUND_CLIP_NAME 1007
@@ -531,6 +532,7 @@
#define IDC_ASCT1_CLASS_COMBO1 1188
#define IDC_SHIP_VARIABLES_COMBO 1188
#define IDC_SUFFIX 1188
#define IDC_SOUND_ENVIRONMENT 1188
#define IDC_CREATED 1189
#define IDC_DEPARTURE_TARGET 1189
#define IDC_SBITMAP 1189
@@ -777,6 +779,7 @@
#define IDC_SPECIAL_INNER_RAD 1343
#define IDC_SQUAD_LOGO 1343
#define IDC_SQUADRON_WING_NAME_1 1343
#define IDC_SOUND_ENVIRONMENT_DAMPING 1343
#define IDC_EDIT3 1344
#define IDC_AMMO3 1344
#define IDC_TIME 1344
@@ -790,6 +793,7 @@
#define IDC_ABBREV_CAMPAIGN 1344
#define IDC_TVT_WING_NAME_1 1344
#define IDC_ASSIST_SCORE 1344
#define IDC_SOUND_ENVIRONMENT_VOLUME 1344
#define IDC_EDIT4 1345
#define IDC_AMMO4 1345
#define IDC_VOICE 1345
@@ -1128,6 +1132,15 @@
#define IDC_STORY_FILE 1618
#define IDC_FONT_FILE 1619
#define IDC_FICTION_MUSIC 1620
#define IDC_SOUND_ENVIRONMENT_LABEL 1621
#define IDC_SOUND_ENVIRONMENT_VOLUME_LABEL 1622
#define IDC_SOUND_ENVIRONENT_DAMPING_LABEL 1623
#define IDC_SOUND_ENVIRONMENT_DECAY_LABEL 1624
#define IDC_SOUND_ENVIRONMENT_DECAY 1625
#define IDC_SOUND_ENVIRONMENT_BUTTON 1626
#define IDC_SOUND_ENVIRONMENT_TEST 1627
#define IDC_GROUP_MESSAGES 1628
#define IDC_INCLUDE_SENDER 1629
#define ID_FILE_MISSIONNOTES 32771
#define ID_DUPLICATE 32774
#define ID_VIEW_ROTATE 32775
@@ -1419,9 +1432,9 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 319
#define _APS_NEXT_RESOURCE_VALUE 320
#define _APS_NEXT_COMMAND_VALUE 33098
#define _APS_NEXT_CONTROL_VALUE 1621
#define _APS_NEXT_CONTROL_VALUE 1629
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
-1
View File
@@ -13,7 +13,6 @@
#include "model/model.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -6,7 +6,6 @@
#include "SetGlobalShipFlags.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+109 -11
View File
@@ -43,6 +43,8 @@
#include "iff_defs/iff_defs.h"
#include "mission/missionmessage.h"
#include "graphics/gropenglshader.h"
#include "graphics/gropenglpostprocessing.h"
#include "sound/ds.h"
#define TREE_NODE_INCREMENT 100
@@ -55,7 +57,6 @@
// note: stay below 0xe000 so we don't collide with MFC defines..
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -2575,6 +2576,11 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
case OPF_FONT:
str = Fonts[0].filename;
break;
case OPF_AUDIO_VOLUME_OPTION:
str = "Music";
break;
default:
str = "<new default required!>";
@@ -2656,6 +2662,12 @@ int sexp_tree::query_default_argument_available(int op, int i)
case OPF_TARGET_PRIORITIES:
case OPF_ARMOR_TYPES:
case OPF_FONT:
case OPF_HUD_ELEMENT:
case OPF_SOUND_ENVIRONMENT:
case OPF_SOUND_ENVIRONMENT_OPTION:
case OPF_EXPLOSION_OPTION:
case OPF_AUDIO_VOLUME_OPTION:
case OPF_WEAPON_BANK_NUMBER:
return 1;
case OPF_SHIP:
@@ -4353,6 +4365,30 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
list = get_listing_opf_font();
break;
case OPF_HUD_ELEMENT:
list = get_listing_opf_hud_elements();
break;
case OPF_SOUND_ENVIRONMENT:
list = get_listing_opf_sound_environment();
break;
case OPF_SOUND_ENVIRONMENT_OPTION:
list = get_listing_opf_sound_environment_option();
break;
case OPF_AUDIO_VOLUME_OPTION:
list = get_listing_opf_adjust_audio_volume();
break;
case OPF_EXPLOSION_OPTION:
list = get_listing_opf_explosion_option();
break;
case OPF_WEAPON_BANK_NUMBER:
list = get_listing_opf_weapon_banks();
break;
default:
Int3(); // unknown OPF code
list = NULL;
@@ -5194,6 +5230,50 @@ sexp_list_item *sexp_tree::get_listing_opf_priority()
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_sound_environment()
{
sexp_list_item head;
head.add_data(SEXP_NONE_STRING);
for (int i = 0; i < (int)EFX_presets.size(); i++) {
// ugh
char *text = const_cast<char*>(EFX_presets[i].name.c_str());
head.add_data(text);
}
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_sound_environment_option()
{
sexp_list_item head;
for (int i = 0; i < Num_sound_environment_options; i++)
head.add_data(Sound_environment_option[i]);
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_adjust_audio_volume()
{
sexp_list_item head;
for (int i = 0; i < Num_adjust_audio_options; i++)
head.add_data(Adjust_audio_options[i]);
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_explosion_option()
{
sexp_list_item head;
for (int i = 0; i < Num_explosion_options; i++)
head.add_data(Explosion_option[i]);
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_waypoint_path()
{
int i;
@@ -5424,7 +5504,7 @@ sexp_list_item *sexp_tree::get_listing_opf_string()
{
sexp_list_item head;
head.add_data("<any string>");
head.add_data(SEXP_ANY_STRING);
return head.next;
}
@@ -5614,7 +5694,7 @@ sexp_list_item *sexp_tree::get_listing_opf_nebula_storm_type()
sexp_list_item head;
int i;
head.add_data("none");
head.add_data(SEXP_NONE_STRING);
for (i=0; i < Num_storm_types; i++)
{
@@ -5652,9 +5732,11 @@ sexp_list_item *sexp_tree::get_listing_opf_post_effect()
{
unsigned int i;
sexp_list_item head;
SCP_vector<opengl::post_effect> &ppe_names = opengl::post_shader::get_effects();
for (i=0; i < ppe_names.size(); i++)
head.add_data(const_cast<char*>(ppe_names[i].name.c_str()));
SCP_vector<SCP_string> ppe_names;
get_post_process_effect_names(ppe_names);
for (i=0; i < ppe_names.size(); i++) {
head.add_data(const_cast<char*>(ppe_names[i].c_str()));
}
return head.next;
}
@@ -5683,6 +5765,22 @@ sexp_list_item *sexp_tree::get_listing_opf_armor_types()
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_hud_elements()
{
sexp_list_item head;
head.add_data("warpout");
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_weapon_banks()
{
sexp_list_item head;
head.add_data(SEXP_ALL_BANKS_STRING);
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)
@@ -5823,20 +5921,20 @@ int sexp_tree::get_loadout_variable_count(int var_index)
for (int i=0; i < MAX_TVT_TEAMS; i++) {
for(idx=0; idx<Team_data[i].num_ship_choices; idx++) {
if (var_index == Team_data[i].ship_list_variables[idx]) {
if (!strcmp(Team_data[i].ship_list_variables[idx], Sexp_variables[var_index].variable_name)) {
count++;
}
if (var_index == Team_data[i].ship_count_variables[idx]) {
count++;
if (!strcmp(Team_data[i].ship_count_variables[idx], Sexp_variables[var_index].variable_name)) {
count++;
}
}
for (idx=0; idx<Team_data[i].num_weapon_choices; idx++) {
if (var_index == Team_data[i].weaponry_pool_variable[idx]) {
if (!strcmp(Team_data[i].weaponry_pool_variable[idx], Sexp_variables[var_index].variable_name)) {
count++;
}
if (var_index == Team_data[i].weaponry_amount_variable[idx]) {
if (!strcmp(Team_data[i].weaponry_amount_variable[idx], Sexp_variables[var_index].variable_name)) {
count++;
}
}
+6
View File
@@ -257,6 +257,12 @@ public:
sexp_list_item *get_listing_opf_persona();
sexp_list_item *get_listing_opf_font();
sexp_list_item *get_listing_opf_post_effect();
sexp_list_item *get_listing_opf_hud_elements();
sexp_list_item *get_listing_opf_sound_environment();
sexp_list_item *get_listing_opf_sound_environment_option();
sexp_list_item *get_listing_opf_explosion_option();
sexp_list_item *get_listing_opf_adjust_audio_volume();
sexp_list_item *get_listing_opf_weapon_banks();
int m_mode;
int item_index;
-1
View File
@@ -17,7 +17,6 @@
#include "iff_defs/iff_defs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -22,7 +22,6 @@
#define ACTIVITY_WING 2
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -14,7 +14,6 @@
#include "ShipClassEditorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+6 -5
View File
@@ -47,7 +47,6 @@
#define NO_PERSONA_INDEX 999
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
@@ -1321,7 +1320,7 @@ int CShipEditorDlg::update_ship(int ship)
m_arrival_delay.save(&Ships[ship].arrival_delay);
m_departure_delay.save(&Ships[ship].departure_delay);
if (m_arrival_target >= 0) {
z = ((CComboBox *) GetDlgItem(IDC_ARRIVAL_TARGET)) -> GetItemData(m_arrival_target);
z = ((CComboBox *) GetDlgItem(IDC_ARRIVAL_TARGET))->GetItemData(m_arrival_target);
MODIFY(Ships[ship].arrival_anchor, z);
// if the arrival is not hyperspace or docking bay -- force arrival distance to be
@@ -1331,7 +1330,7 @@ int CShipEditorDlg::update_ship(int ship)
if ((Ships[ship].arrival_distance < d) && (Ships[ship].arrival_distance > -d)) {
str.Format("Ship must arrive at least %d meters away from target.\n"
"Value has been reset to this. Use with caution!\r\n"
"Reccomended distance is %d meters.\r\n", d, (int)(2.0f * Objects[Ships[ship].objnum].radius) );
"Recommended distance is %d meters.\r\n", d, (int)(2.0f * Objects[Ships[ship].objnum].radius) );
MessageBox(str);
if (Ships[ship].arrival_distance < 0)
@@ -1343,8 +1342,10 @@ int CShipEditorDlg::update_ship(int ship)
}
}
}
z = ((CComboBox *)GetDlgItem(IDC_DEPARTURE_TARGET))->GetItemData(m_departure_target);
MODIFY(Ships[ship].departure_anchor, z );
if (m_departure_target >= 0) {
z = ((CComboBox *) GetDlgItem(IDC_DEPARTURE_TARGET))->GetItemData(m_departure_target);
MODIFY(Ships[ship].departure_anchor, z );
}
}
if (m_hotkey != -1)
-1
View File
@@ -16,7 +16,6 @@
#include "globalincs/linklist.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -28,7 +28,6 @@
#define DATA_MASK 0x0fff
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -18,7 +18,6 @@
#include "FREDDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -9,7 +9,6 @@
#include "FREDDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -8,7 +8,6 @@
#include "bmpman/bmpman.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+246
View File
@@ -0,0 +1,246 @@
// soundenvironmentdlg.cpp : implementation file
//
#include "stdafx.h"
#include "fred.h"
#include "soundenvironmentdlg.h"
#include "sound/audiostr.h"
#include "sound/sound.h"
#include "sound/ds.h"
#include "cfile/cfile.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// SoundEnvironment dialog
SoundEnvironment::SoundEnvironment(CWnd* pParent /*=NULL*/)
: CDialog(SoundEnvironment::IDD, pParent)
{
//{{AFX_DATA_INIT(SoundEnvironment)
m_environment = -1;
m_damping = 0.0f;
m_decay_time = 0.0f;
m_volume = 0.0f;
m_wave_filename = _T("");
m_wave_id = -1;
//}}AFX_DATA_INIT
}
void SoundEnvironment::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SoundEnvironment)
DDX_CBIndex(pDX, IDC_SOUND_ENVIRONMENT, m_environment);
DDX_Text(pDX, IDC_SOUND_ENVIRONMENT_DAMPING, m_damping);
DDV_MinMaxFloat(pDX, m_damping, 0.1f, 2.0f);
DDX_Text(pDX, IDC_SOUND_ENVIRONMENT_DECAY, m_decay_time);
DDV_MinMaxFloat(pDX, m_decay_time, 0.1f, 20.0f);
DDX_Text(pDX, IDC_SOUND_ENVIRONMENT_VOLUME, m_volume);
DDV_MinMaxFloat(pDX, m_volume, 0.0f, 1.0f);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(SoundEnvironment, CDialog)
//{{AFX_MSG_MAP(SoundEnvironment)
ON_CBN_SELCHANGE(IDC_SOUND_ENVIRONMENT, OnSelChangeSoundEnvironment)
ON_BN_CLICKED(IDC_BROWSE_WAVE, OnBrowseWave)
ON_BN_CLICKED(IDC_PLAY, OnPlay)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// SoundEnvironment message handlers
BOOL SoundEnvironment::OnInitDialog()
{
m_play_bm.LoadBitmap(IDB_PLAY);
((CButton *) GetDlgItem(IDC_PLAY)) -> SetBitmap(m_play_bm);
// fill environment list ...
CComboBox *box = (CComboBox *) GetDlgItem(IDC_SOUND_ENVIRONMENT);
// add empty default string (for no environment set)
box->AddString("");
for (size_t i = 0; i < EFX_presets.size(); i++) {
box->AddString(EFX_presets[i].name.c_str());
}
// set values ...
sound_env *m_env = &The_mission.sound_environment;
// make sure we are set by default to mission values
if (m_env->id >= 0) {
m_environment = m_env->id + 1;
m_volume = m_env->volume;
m_damping = m_env->damping;
m_decay_time = m_env->decay;
// make it active
sound_env_set(m_env);
} else {
m_environment = 0;
m_volume = 0.0f;
m_damping = 0.1f;
m_decay_time = 0.1f;
sound_env_disable();
}
CDialog::OnInitDialog();
UpdateData(FALSE);
return TRUE;
}
void SoundEnvironment::OnOK()
{
UpdateData(TRUE);
sound_env *m_env = &The_mission.sound_environment;
int env_id = m_environment - 1;
// save anything if we need to
if (env_id >= 0) {
m_env->id = env_id;
m_env->volume = m_volume;
m_env->damping = m_damping;
m_env->decay = m_decay_time;
} else {
m_env->id = -1;
}
CDialog::OnOK();
}
void SoundEnvironment::OnCancel()
{
CDialog::OnCancel();
}
void SoundEnvironment::OnClose()
{
int z;
UpdateData(TRUE);
if (query_modified()) {
z = MessageBox("Do you want to keep your changes?", "Close", MB_ICONQUESTION | MB_YESNOCANCEL);
if (z == IDCANCEL) {
return;
}
if (z == IDYES) {
OnOK();
return;
}
}
CDialog::OnClose();
}
int SoundEnvironment::query_modified()
{
int env_id = m_environment - 1;
sound_env *m_env = &The_mission.sound_environment;
return ( (env_id != m_env->id) || (m_volume != m_env->volume) || (m_damping != m_env->damping)
|| (m_decay_time != m_env->decay) );
}
void SoundEnvironment::OnSelChangeSoundEnvironment()
{
UpdateData(TRUE);
int index = m_environment - 1;
if (index >= 0) {
m_volume = EFX_presets[index].flGain;
m_damping = EFX_presets[index].flDecayHFRatio;
m_decay_time = EFX_presets[index].flDecayTime;
} else {
m_volume = 0.0f;
m_damping = 0.1f;
m_decay_time = 0.1f;
}
UpdateData(FALSE);
}
BOOL SoundEnvironment::DestroyWindow()
{
sound_env_disable();
audiostream_close_file(m_wave_id, 0);
m_wave_id = -1;
m_play_bm.DeleteObject();
return CDialog::DestroyWindow();
}
void SoundEnvironment::OnPlay()
{
sound_env m_env;
if ( !sound_env_supported() ) {
MessageBox("Sound environment effects are not available! Unable to preview!", "Error", MB_OK | MB_ICONEXCLAMATION);
return;
}
if (m_wave_id < 0) {
OnBrowseWave();
return;
}
UpdateData(TRUE);
if (m_environment > 0) {
m_env.id = m_environment - 1;
m_env.volume = m_volume;
m_env.damping = m_damping;
m_env.decay = m_decay_time;
sound_env_set(&m_env);
}
audiostream_play(m_wave_id, 1.0f, 0);
}
void SoundEnvironment::OnBrowseWave()
{
int z;
if (m_wave_id >= 0) {
audiostream_close_file(m_wave_id, 0);
m_wave_id = -1;
}
UpdateData(TRUE);
m_wave_filename = _T("");
z = cfile_push_chdir(CF_TYPE_DATA);
CFileDialog dlg(TRUE, "wav", m_wave_filename, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
"Voice Files (*.ogg, *.wav)|*.ogg;*.wav|Ogg Vorbis Files (*.ogg)|*.ogg|Wave Files (*.wav)|*.wav||");
if (dlg.DoModal() == IDOK) {
m_wave_filename = dlg.GetFileName();
m_wave_id = audiostream_open((char *)(LPCSTR) m_wave_filename, ASF_SOUNDFX);
}
if ( !z ) {
cfile_pop_dir();
}
}
+63
View File
@@ -0,0 +1,63 @@
#if !defined(AFX_SOUNDENVIRONMENTDLG_H__C27DA258_9C66_4987_8D20_AEEB260644A8__INCLUDED_)
#define AFX_SOUNDENVIRONMENTDLG_H__C27DA258_9C66_4987_8D20_AEEB260644A8__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// soundenvironmentdlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// SoundEnvironment dialog
class SoundEnvironment : public CDialog
{
// Construction
public:
SoundEnvironment(CWnd* pParent = NULL); // standard constructor
int query_modified();
void OnOK();
void OnCancel();
// Dialog Data
//{{AFX_DATA(SoundEnvironment)
enum { IDD = IDD_SOUND_ENVIRONMENT };
int m_environment;
float m_damping;
float m_decay_time;
float m_volume;
CString m_wave_filename;
//}}AFX_DATA
CBitmap m_play_bm;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(SoundEnvironment)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(SoundEnvironment)
virtual BOOL OnInitDialog();
afx_msg void OnClose();
afx_msg void OnSelChangeSoundEnvironment();
afx_msg void OnBrowseWave();
afx_msg void OnPlay();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
int m_wave_id;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SOUNDENVIRONMENT_H__C27DA258_9C66_4987_8D20_AEEB260644A8__INCLUDED_)
-1
View File
@@ -16,7 +16,6 @@
#include "FREDDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -16,7 +16,6 @@
#include "cfile/cfile.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+317 -56
View File
@@ -2,22 +2,27 @@
//
#include "stdafx.h"
#include <string.h>
#include "fred.h"
#include "fred2/freddoc.h"
#include "VoiceActingManager.h"
#include "missionui/missioncmdbrief.h"
#include "mission/missionbriefcommon.h"
#include "mission/missionmessage.h"
#include "mission/missiongoals.h"
#include "hud/hudtarget.h"
#include "parse/sexp.h"
#include "iff_defs/iff_defs.h"
#include "mission/missiongoals.h"
#include <math.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define INVALID_MESSAGE ((MMessage*)0xFFFFFFFF)
// to keep track of data
char Voice_abbrev_briefing[NAME_LENGTH];
char Voice_abbrev_campaign[NAME_LENGTH];
@@ -28,6 +33,7 @@ char Voice_abbrev_mission[NAME_LENGTH];
bool Voice_no_replace_filenames;
char Voice_script_entry_format[NOTES_LENGTH];
int Voice_export_selection;
bool Voice_group_messages;
/////////////////////////////////////////////////////////////////////////////
@@ -44,6 +50,7 @@ VoiceActingManager::VoiceActingManager(CWnd* pParent /*=NULL*/)
m_abbrev_debriefing = _T("");
m_abbrev_message = _T("");
m_abbrev_mission = _T("");
m_use_sender_in_filename = FALSE;
m_example = _T("");
m_no_replace = FALSE;
m_script_entry_format = _T("");
@@ -52,6 +59,7 @@ VoiceActingManager::VoiceActingManager(CWnd* pParent /*=NULL*/)
m_export_briefings = FALSE;
m_export_debriefings = FALSE;
m_export_messages = FALSE;
m_group_messages = FALSE;
//}}AFX_DATA_INIT
}
@@ -68,12 +76,14 @@ void VoiceActingManager::DoDataExchange(CDataExchange* pDX)
DDX_Text(pDX, IDC_ABBREV_MISSION, m_abbrev_mission);
DDX_Text(pDX, IDC_EXAMPLE, m_example);
DDX_Check(pDX, IDC_NO_REPLACE, m_no_replace);
DDX_Check(pDX, IDC_INCLUDE_SENDER, m_use_sender_in_filename);
DDX_Text(pDX, IDC_ENTRY_FORMAT, m_script_entry_format);
DDX_Check(pDX, IDC_EXPORT_EVERYTHING, m_export_everything);
DDX_Check(pDX, IDC_EXPORT_COMMAND_BRIEFINGS, m_export_command_briefings);
DDX_Check(pDX, IDC_EXPORT_BRIEFINGS, m_export_briefings);
DDX_Check(pDX, IDC_EXPORT_DEBRIEFINGS, m_export_debriefings);
DDX_Check(pDX, IDC_EXPORT_MESSAGES, m_export_messages);
DDX_Check(pDX, IDC_GROUP_MESSAGES, m_group_messages);
//}}AFX_DATA_MAP
}
@@ -98,6 +108,12 @@ BEGIN_MESSAGE_MAP(VoiceActingManager, CDialog)
ON_BN_CLICKED(IDC_NO_REPLACE, OnChangeNoReplace)
ON_BN_CLICKED(IDC_GENERATE_FILE_NAMES, OnGenerateFileNames)
ON_BN_CLICKED(IDC_GENERATE_SCRIPT, OnGenerateScript)
ON_BN_CLICKED(IDC_EXPORT_EVERYTHING, OnExportEverything)
ON_BN_CLICKED(IDC_EXPORT_COMMAND_BRIEFINGS, OnExportCommandBriefings)
ON_BN_CLICKED(IDC_EXPORT_BRIEFINGS, OnExportBriefings)
ON_BN_CLICKED(IDC_EXPORT_DEBRIEFINGS, OnExportDebriefings)
ON_BN_CLICKED(IDC_EXPORT_MESSAGES, OnExportMessages)
ON_BN_CLICKED(IDC_INCLUDE_SENDER, OnBnClickedIncludeSender)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -133,6 +149,10 @@ BOOL VoiceActingManager::OnInitDialog()
m_export_messages = TRUE;
else
m_export_everything = TRUE;
m_group_messages = Voice_group_messages;
CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
button->EnableWindow(m_export_everything || m_export_messages);
UpdateData(FALSE);
@@ -150,7 +170,7 @@ void VoiceActingManager::OnClose()
strcpy_s(Voice_abbrev_debriefing, m_abbrev_debriefing);
strcpy_s(Voice_abbrev_message, m_abbrev_message);
strcpy_s(Voice_abbrev_mission, m_abbrev_mission);
Voice_no_replace_filenames = m_no_replace == TRUE ? true : false;
Voice_no_replace_filenames = (m_no_replace == TRUE) ? true : false;
// save data for script
strcpy_s(Voice_script_entry_format, m_script_entry_format);
@@ -164,6 +184,7 @@ void VoiceActingManager::OnClose()
Voice_export_selection = 4;
else
Voice_export_selection = 0;
Voice_group_messages = (m_group_messages == TRUE) ? true : false;
CDialog::OnClose();
}
@@ -213,10 +234,10 @@ void VoiceActingManager::build_example(CString section)
return;
}
m_example = generate_filename(section, 1, 2);
m_example = generate_filename(section, 1, 2, INVALID_MESSAGE);
}
CString VoiceActingManager::generate_filename(CString section, int number, int digits)
CString VoiceActingManager::generate_filename(CString section, int number, int digits, MMessage *message)
{
if (section == "")
return "none.wav";
@@ -241,9 +262,52 @@ CString VoiceActingManager::generate_filename(CString section, int number, int d
}
str = str + num;
const CString suffix = get_suffix();
// append sender name if supposed to and I have been passed a message
// to get the sender from
if ( message != NULL && m_use_sender_in_filename ) {
size_t allow_to_copy = NAME_LENGTH - suffix.GetLength() - str.GetLength();
char sender[NAME_LENGTH];
if ( message == INVALID_MESSAGE ) {
strcpy_s(sender, "Alpha 1");
} else {
get_valid_sender(sender, sizeof(sender), message);
}
// truncate sender to that we don't overflow filename
sender[allow_to_copy] = '\0';
size_t j;
for( j = 0; sender[j] != '\0'; j++ ) {
// lower case letter
sender[j] = (char)tolower(sender[j]);
// replace any non alpha numeric with a underscore
if ( !isalnum( sender[j] ) )
sender[j] = '_';
}
// flatten muliple underscores
j = 1;
while( sender[j] != '\0' ) {
if ( sender[j-1] == '_' && sender[j] == '_' ) {
size_t k;
for (k = j + 1; sender[k] != '\0'; k++ )
sender[k - 1] = sender[k];
sender[k - 1] = '\0';
} else {
// only increment on rounds when I am not moving the string down
j++;
}
}
str = str + sender;
}
// suffix
str = str + get_suffix();
Assert( str.GetLength() < NAME_LENGTH );
return str;
}
@@ -251,6 +315,7 @@ void VoiceActingManager::OnGenerateFileNames()
{
int i;
int digits;
size_t modified_filenames = 0;
// stuff data to variables
UpdateData(TRUE);
@@ -262,9 +327,10 @@ void VoiceActingManager::OnGenerateFileNames()
char *filename = Cmd_briefs[0].stage[i].wave_filename;
// generate only if we're replacing or if it has a replaceable name
if (!m_no_replace || !strlen(filename) || !strnicmp(filename, "none.wav", 4) || message_filename_is_generic(filename))
if (!m_no_replace || !strlen(filename) || message_filename_is_generic(filename))
{
strcpy(filename, LPCTSTR(generate_filename(m_abbrev_command_briefing, i + 1, digits)));
modified_filenames++;
}
}
@@ -275,9 +341,10 @@ void VoiceActingManager::OnGenerateFileNames()
char *filename = Briefings[0].stages[i].voice;
// generate only if we're replacing or if it has a replaceable name
if (!m_no_replace || !strlen(filename) || !strnicmp(filename, "none.wav", 4) || message_filename_is_generic(filename))
if (!m_no_replace || !strlen(filename) || message_filename_is_generic(filename))
{
strcpy(filename, LPCTSTR(generate_filename(m_abbrev_briefing, i + 1, digits)));
modified_filenames++;
}
}
@@ -288,9 +355,10 @@ void VoiceActingManager::OnGenerateFileNames()
char *filename = Debriefings[0].stages[i].voice;
// generate only if we're replacing or if it has a replaceable name
if (!m_no_replace || !strlen(filename) || !strnicmp(filename, "none.wav", 4) || message_filename_is_generic(filename))
if (!m_no_replace || !strlen(filename) || message_filename_is_generic(filename))
{
strcpy(filename, LPCTSTR(generate_filename(m_abbrev_debriefing, i + 1, digits)));
modified_filenames++;
}
}
@@ -299,21 +367,30 @@ void VoiceActingManager::OnGenerateFileNames()
for (i = 0; i < Num_messages - Num_builtin_messages; i++)
{
char *filename = Messages[i + Num_builtin_messages].wave_info.name;
MMessage *message = &Messages[i + Num_builtin_messages];
// generate only if we're replacing or if it has a replaceable name
if (!m_no_replace || !filename || !strlen(filename) || !strnicmp(filename, "none.wav", 4) || message_filename_is_generic(filename))
if (!m_no_replace || !strlen(filename) || !strlen(filename) || message_filename_is_generic(filename))
{
// free existing filename
if (filename != NULL)
free(filename);
// allocate new filename
Messages[i + Num_builtin_messages].wave_info.name = strdup(LPCTSTR(generate_filename(m_abbrev_message, i + 1, digits)));
Messages[i + Num_builtin_messages].wave_info.name = strdup(LPCTSTR(generate_filename(m_abbrev_message, i + 1, digits, message)));
modified_filenames++;
}
}
// notify
MessageBox("File name generation complete.", "Woohoo!");
if ( modified_filenames > 0 ) {
// Tell FRED that we actually modified something
set_modified(TRUE);
}
// 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 %d messages.", modified_filenames);
MessageBox(message, "Woohoo!");
}
void VoiceActingManager::OnGenerateScript()
@@ -402,56 +479,27 @@ void VoiceActingManager::OnGenerateScript()
{
fout("\n\nMessages\n--------\n\n");
for (i = 0; i < Num_messages - Num_builtin_messages; i++)
if (m_group_messages)
{
CString entry = m_script_entry_format;
entry.Replace("\r\n", "\n");
SCP_vector<int> message_indexes;
for (i = 0; i < Num_messages - Num_builtin_messages; i++)
message_indexes.push_back(i + Num_builtin_messages);
MMessage *message = &Messages[i + Num_builtin_messages];
group_message_indexes(message_indexes);
// replace file name
entry.Replace("$filename", message->wave_info.name);
// determine and replace persona
entry.Replace("$message", message->message);
if (message->persona_index >= 0)
entry.Replace("$persona", Personas[message->persona_index].name);
else
entry.Replace("$persona", "<none>");
// determine sender
char sender[NAME_LENGTH+1];
strcpy_s(sender, get_message_sender(message->name));
int shipnum = ship_name_lookup(sender);
if (shipnum >= 0)
for (i = 0; i < message_indexes.size(); i++)
{
ship *shipp = &Ships[shipnum];
// we may have to use the callsign
if (*Fred_callsigns[shipnum])
{
hud_stuff_ship_callsign(sender, shipp);
}
// account for hidden ship names
else if ( ((Iff_info[shipp->team].flags & IFFF_WING_NAME_HIDDEN) && (shipp->wingnum != -1)) || (shipp->flags2 & SF2_HIDE_SHIP_NAME) )
{
hud_stuff_ship_class(sender, shipp);
}
// use the regular sender text
else
{
end_string_at_first_hash_symbol(sender);
}
MMessage *message = &Messages[message_indexes[i]];
export_one_message(message);
}
}
else
{
for (i = 0; i < Num_messages - Num_builtin_messages; i++)
{
MMessage *message = &Messages[i + Num_builtin_messages];
export_one_message(message);
}
// replace sender (but print #Command as Command)
if (*sender == '#')
entry.Replace("$sender", &sender[1]);
else
entry.Replace("$sender", sender);
fout("%s\n\n\n", (char *) (LPCTSTR) entry);
}
}
@@ -461,6 +509,76 @@ void VoiceActingManager::OnGenerateScript()
MessageBox("Script generation complete.", "Woohoo!");
}
void VoiceActingManager::export_one_message(MMessage *message)
{
CString entry = m_script_entry_format;
entry.Replace("\r\n", "\n");
// replace file name
entry.Replace("$filename", message->wave_info.name);
// determine and replace persona
entry.Replace("$message", message->message);
if (message->persona_index >= 0)
entry.Replace("$persona", Personas[message->persona_index].name);
else
entry.Replace("$persona", "<none>");
// determine sender
char sender[NAME_LENGTH+1];
get_valid_sender(sender, sizeof(sender), message);
// replace sender (but print #Command as Command)
if (*sender == '#')
entry.Replace("$sender", &sender[1]);
else
entry.Replace("$sender", sender);
fout("%s\n\n\n", (char *) (LPCTSTR) entry);
}
/** Passed sender string will have either have the senders name
or '<none>'*/
void VoiceActingManager::get_valid_sender(char *sender, size_t sender_size, MMessage *message) {
Assert( sender != NULL );
Assert( message != NULL );
strncpy(sender, get_message_sender(message->name), sender_size);
// strip hash if present
if ( sender[0] == '#' ) {
size_t i = 1;
for(; sender[i] != '\0'; i++ ) {
sender[i-1] = sender[i];
}
sender[i-1] = '\0';
}
int shipnum = ship_name_lookup(sender, 1); // The player's ship is valid for this search.
if (shipnum >= 0)
{
ship *shipp = &Ships[shipnum];
// we may have to use the callsign
if (*Fred_callsigns[shipnum])
{
hud_stuff_ship_callsign(sender, shipp);
}
// account for hidden ship names
else if ( ((Iff_info[shipp->team].flags & IFFF_WING_NAME_HIDDEN) && (shipp->wingnum != -1)) || (shipp->flags2 & SF2_HIDE_SHIP_NAME) )
{
hud_stuff_ship_class(sender, shipp);
}
// use the regular sender text
else
{
end_string_at_first_hash_symbol(sender);
}
}
}
void VoiceActingManager::OnSetfocusAbbrevBriefing()
{
UpdateData(TRUE);
@@ -667,3 +785,146 @@ char *VoiceActingManager::get_message_sender(char *message)
return "<none>";
}
void VoiceActingManager::group_message_indexes(SCP_vector<int> &message_indexes)
{
int i;
#ifndef NDEBUG
int initial_size = message_indexes.size();
#endif
SCP_vector<int> temp_message_indexes = message_indexes;
message_indexes.clear();
// add all messages found in send-message-list or send-random-message node trees
for (i = 0; i < Num_mission_events; i++)
{
mission_event *event = &Mission_events[i];
group_message_indexes_in_tree(event->formula, temp_message_indexes, message_indexes);
}
// add remaining messages
for (i = 0; i < temp_message_indexes.size(); i++)
message_indexes.push_back(temp_message_indexes[i]);
#ifndef NDEBUG
if (initial_size > message_indexes.size())
{
Warning(LOCATION, "Initial size is greater than size after sorting!");
}
else if (initial_size < message_indexes.size())
{
Warning(LOCATION, "Initial size is less than size after sorting!");
}
#endif
}
void VoiceActingManager::group_message_indexes_in_tree(int node, SCP_vector<int> &source_list, SCP_vector<int> &destination_list)
{
int i, op, n;
if (node < 0)
return;
if (Sexp_nodes[node].type == SEXP_NOT_USED)
return;
// stuff
op = get_operator_const(Sexp_nodes[node].text);
n = CDR(node);
if (op == OP_SEND_MESSAGE_LIST)
{
// check the argument list
while (n != -1)
{
// the third argument is a message
char *message_name = Sexp_nodes[CDDR(n)].text;
// check source messages
for (i = 0; i < source_list.size(); i++)
{
if (!strcmp(message_name, Messages[source_list[i]].name))
{
// move it from source to destination
destination_list.push_back(source_list[i]);
source_list.erase(source_list.begin() + i);
break;
}
}
// iterate along the list
n = CDDDDR(n);
}
}
else if (op == OP_SEND_RANDOM_MESSAGE)
{
// check the argument list
n = CDDR(n);
while (n != -1)
{
// each argument from this point on is a message
char *message_name = Sexp_nodes[n].text;
// check source messages
for (i = 0; i < source_list.size(); i++)
{
if (!strcmp(message_name, Messages[source_list[i]].name))
{
// move it from source to destination
destination_list.push_back(source_list[i]);
source_list.erase(source_list.begin() + i);
break;
}
}
// iterate along the list
n = CDR(n);
}
}
// iterate on first element
group_message_indexes_in_tree(CAR(node), source_list, destination_list);
// iterate on rest of elements
group_message_indexes_in_tree(CDR(node), source_list, destination_list);
}
void VoiceActingManager::OnExportEverything()
{
CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
button->EnableWindow(TRUE);
}
void VoiceActingManager::OnExportCommandBriefings()
{
CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
button->EnableWindow(FALSE);
}
void VoiceActingManager::OnExportBriefings()
{
CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
button->EnableWindow(FALSE);
}
void VoiceActingManager::OnExportDebriefings()
{
CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
button->EnableWindow(FALSE);
}
void VoiceActingManager::OnExportMessages()
{
CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
button->EnableWindow(TRUE);
}
void VoiceActingManager::OnBnClickedIncludeSender()
{
UpdateData(TRUE);
build_example();
UpdateData(FALSE);
}
+15 -1
View File
@@ -7,6 +7,8 @@
// VoiceActingManager.h : header file
//
#include "mission/missionmessage.h"
/////////////////////////////////////////////////////////////////////////////
// VoiceActingManager dialog
@@ -25,6 +27,7 @@ public:
CString m_abbrev_debriefing;
CString m_abbrev_message;
CString m_abbrev_mission;
BOOL m_use_sender_in_filename;
CString m_example;
BOOL m_no_replace;
CString m_script_entry_format;
@@ -33,6 +36,7 @@ public:
BOOL m_export_briefings;
BOOL m_export_debriefings;
BOOL m_export_messages;
BOOL m_group_messages;
//}}AFX_DATA
@@ -50,8 +54,12 @@ protected:
int calc_digits(int size);
void build_example();
void build_example(CString section);
CString generate_filename(CString section, int number, int digits);
CString generate_filename(CString section, int number, int digits, MMessage *message=NULL);
char *get_message_sender(char *message);
void export_one_message(MMessage *message);
void get_valid_sender(char *sender, size_t sender_size, MMessage *message);
void group_message_indexes(SCP_vector<int> &message_indexes);
void group_message_indexes_in_tree(int node, SCP_vector<int> &source_list, SCP_vector<int> &destination_list);
CFILE *fp;
int fout(char *format, ...);
@@ -77,6 +85,12 @@ protected:
afx_msg void OnChangeNoReplace();
afx_msg void OnGenerateFileNames();
afx_msg void OnGenerateScript();
afx_msg void OnExportEverything();
afx_msg void OnExportCommandBriefings();
afx_msg void OnExportBriefings();
afx_msg void OnExportDebriefings();
afx_msg void OnExportMessages();
afx_msg void OnBnClickedIncludeSender();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
-1
View File
@@ -27,7 +27,6 @@
#define ID_WAYPOINT_MENU 9000
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -20,7 +20,6 @@
#define BLANK_FIELD -99
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
-1
View File
@@ -30,7 +30,6 @@
#define MULTI_WING 999999
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
Loaded 100 of 392 files, more files were not shown because too many files have changed in this diff. Show more