mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 18:31:26 -10:00
Compare commits
102
Commits
swifty
...
top_secret
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00d7cd8a17 | ||
|
|
33f47d53c7 | ||
|
|
db2e20e59a | ||
|
|
67e89bdd8d | ||
|
|
c0e55de8f0 | ||
|
|
0d2c96ba09 | ||
|
|
02e76c00e9 | ||
|
|
7b8c035320 | ||
|
|
d41fa67715 | ||
|
|
7cfdf27b78 | ||
|
|
5cc6f5e4fd | ||
|
|
4b66b6e42c | ||
|
|
8edeb00886 | ||
|
|
c01b067c1a | ||
|
|
9940f9a752 | ||
|
|
9d75c04e99 | ||
|
|
56c1699aee | ||
|
|
a9e043f156 | ||
|
|
2296b885b5 | ||
|
|
36f1acb0ae | ||
|
|
add696869b | ||
|
|
a6066d79a9 | ||
|
|
bbeba26c70 | ||
|
|
b59580e84c | ||
|
|
a992f0687c | ||
|
|
5d5b377ad8 | ||
|
|
a971f3d768 | ||
|
|
5e943b843c | ||
|
|
67a5d89d47 | ||
|
|
f80dcd4a87 | ||
|
|
96d93607dd | ||
|
|
03d0b66214 | ||
|
|
719eb41cd8 | ||
|
|
f37ff6da68 | ||
|
|
3005e447d3 | ||
|
|
1dbe105933 | ||
|
|
04cac71fe9 | ||
|
|
4bee746897 | ||
|
|
4b34460f06 | ||
|
|
af574dacff | ||
|
|
e101736d8f | ||
|
|
f06ef36ca6 | ||
|
|
1491795451 | ||
|
|
0a17554c4f | ||
|
|
b287ecfef9 | ||
|
|
a7bac8679c | ||
|
|
f72d0a4cd5 | ||
|
|
d3e750edf7 | ||
|
|
7f9df9c09e | ||
|
|
89d7a512af | ||
|
|
61af589c21 | ||
|
|
270734b6f3 | ||
|
|
5704dce248 | ||
|
|
f993f7ced1 | ||
|
|
04436d634f | ||
|
|
e63505510b | ||
|
|
c5e3600bef | ||
|
|
acdc56272b | ||
|
|
7a44b33152 | ||
|
|
ec2542fa1e | ||
|
|
1eb544da58 | ||
|
|
71ba95081c | ||
|
|
b01b4a1778 | ||
|
|
e46ba43891 | ||
|
|
e2c5ff679c | ||
|
|
132ba60085 | ||
|
|
fdb7de88da | ||
|
|
44886e1ba5 | ||
|
|
63b9efeb3a | ||
|
|
e702ce2267 | ||
|
|
de0c889d10 | ||
|
|
e2fbbb5e19 | ||
|
|
27f58de890 | ||
|
|
c07d555346 | ||
|
|
2f635ad879 | ||
|
|
10d6940145 | ||
|
|
c6b8d515a4 | ||
|
|
34c61a7caa | ||
|
|
39d5580651 | ||
|
|
0d75839a9d | ||
|
|
35ac7d6afa | ||
|
|
b48b7f76ac | ||
|
|
a2afa2b67a | ||
|
|
0889d77f9f | ||
|
|
b72514fbaa | ||
|
|
475853afa3 | ||
|
|
047ae70637 | ||
|
|
2e58278eba | ||
|
|
26f33cba24 | ||
|
|
7846af6c24 | ||
|
|
aa0c39cb7d | ||
|
|
63909095f5 | ||
|
|
e537b1e133 | ||
|
|
09602a9ffa | ||
|
|
f7ebd3c636 | ||
|
|
52fb26169c | ||
|
|
ff7f028e0e | ||
|
|
1362e16c4c | ||
|
|
4178c4b65c | ||
|
|
f59fd543c9 | ||
|
|
0dddfbca74 | ||
|
|
0c025d96f6 |
No files matched your search
+2
-2
@@ -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
|
||||
|
||||
+32
-41
@@ -283,6 +283,10 @@ 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 \
|
||||
@@ -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
|
||||
|
||||
@@ -205,12 +205,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 +439,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 {
|
||||
|
||||
@@ -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,10 @@ 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);
|
||||
|
||||
// if we've been through once already and are at the same place, force a move
|
||||
if ( saved_Mp && (saved_Mp == Mp) )
|
||||
Mp++;
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
|
||||
// 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 MAX_AI_PROFILES 5
|
||||
|
||||
@@ -93,9 +95,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 +128,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;
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1431,7 +1431,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;
|
||||
}
|
||||
|
||||
+181
-80
@@ -78,7 +78,7 @@
|
||||
|
||||
#define NEXT_REARM_TIMESTAMP (60*1000) // Ships will re-request rearm, typically, after this long.
|
||||
|
||||
#define CIRCLE_STRAFE_DIST 250.0f //Maximum distance for circle strafe behavior.
|
||||
#define CIRCLE_STRAFE_MAX_DIST 300.0f //Maximum distance for circle strafe behavior.
|
||||
|
||||
// AIM_CHASE submode defines
|
||||
// SM_STEALTH_FIND
|
||||
@@ -548,13 +548,17 @@ void init_ai_class(ai_class *aicp)
|
||||
aicp->ai_glide_attack_percent[i] = FLT_MIN;
|
||||
aicp->ai_circle_strafe_percent[i] = FLT_MIN;
|
||||
aicp->ai_glide_strafe_percent[i] = FLT_MIN;
|
||||
aicp->ai_random_sidethrust_percent[i] = FLT_MIN;
|
||||
aicp->ai_stalemate_time_thresh[i] = FLT_MIN;
|
||||
aicp->ai_stalemate_dist_thresh[i] = FLT_MIN;
|
||||
aicp->ai_chance_to_use_missiles_on_plr[i] = INT_MIN;
|
||||
aicp->ai_max_aim_update_delay[i] = FLT_MIN;
|
||||
aicp->ai_turret_max_aim_update_delay[i] = FLT_MIN;
|
||||
}
|
||||
aicp->ai_profile_flags = 0;
|
||||
aicp->ai_profile_flags_set = 0;
|
||||
aicp->ai_profile_flags2 = 0;
|
||||
aicp->ai_profile_flags2_set = 0;
|
||||
|
||||
//AI Class autoscale overrides
|
||||
//INT_MIN and FLT_MIM represent the "not set" state
|
||||
@@ -568,21 +572,25 @@ void init_ai_class(ai_class *aicp)
|
||||
aicp->ai_class_autoscale = true; //Retail behavior is to do the stupid autoscaling
|
||||
}
|
||||
|
||||
void set_aic_flag(ai_class *aicp, char *name, int flag)
|
||||
void set_aic_flag(ai_class *aicp, char *name, int flag, int type)
|
||||
{
|
||||
int* flags = (type == AIP_FLAG) ? &(aicp->ai_profile_flags) : &(aicp->ai_profile_flags2);
|
||||
int* set = (type == AIP_FLAG) ? &(aicp->ai_profile_flags_set) : &(aicp->ai_profile_flags2_set);
|
||||
|
||||
if (optional_string(name))
|
||||
{
|
||||
bool val;
|
||||
stuff_boolean(&val);
|
||||
|
||||
if (val)
|
||||
aicp->ai_profile_flags |= flag;
|
||||
*flags |= flag;
|
||||
else
|
||||
aicp->ai_profile_flags &= ~flag;
|
||||
*flags &= ~flag;
|
||||
|
||||
aicp->ai_profile_flags_set |= flag;
|
||||
*set |= flag;
|
||||
}
|
||||
aicp->ai_profile_flags_set &= ~flag;
|
||||
else
|
||||
*set &= ~flag;
|
||||
}
|
||||
|
||||
void parse_ai_class()
|
||||
@@ -673,14 +681,50 @@ void parse_ai_class()
|
||||
if (optional_string("$AI Turn Time Scale:"))
|
||||
parse_float_list(aicp->ai_turn_time_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Glide Attack Percent:"))
|
||||
if (optional_string("$Glide Attack Percent:")) {
|
||||
parse_float_list(aicp->ai_glide_attack_percent, NUM_SKILL_LEVELS);
|
||||
for (int i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (aicp->ai_glide_attack_percent[i] < 0.0f || aicp->ai_glide_attack_percent[i] > 100.0f) {
|
||||
aicp->ai_glide_attack_percent[i] = 0.0f;
|
||||
Warning(LOCATION, "$Glide Attack Percent should be between 0 and 100.0 (read %f). Setting to 0.", aicp->ai_glide_attack_percent[i]);
|
||||
}
|
||||
aicp->ai_glide_attack_percent[i] /= 100.0;
|
||||
}
|
||||
|
||||
if (optional_string("$Circle Strafe Percent:"))
|
||||
}
|
||||
|
||||
if (optional_string("$Circle Strafe Percent:")) {
|
||||
parse_float_list(aicp->ai_circle_strafe_percent, NUM_SKILL_LEVELS);
|
||||
for (int i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (aicp->ai_circle_strafe_percent[i] < 0.0f || aicp->ai_circle_strafe_percent[i] > 100.0f) {
|
||||
aicp->ai_circle_strafe_percent[i] = 0.0f;
|
||||
Warning(LOCATION, "$Circle Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", aicp->ai_circle_strafe_percent[i]);
|
||||
}
|
||||
aicp->ai_circle_strafe_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Glide Strafe Percent:"))
|
||||
if (optional_string("$Glide Strafe Percent:")) {
|
||||
parse_float_list(aicp->ai_glide_strafe_percent, NUM_SKILL_LEVELS);
|
||||
for (int i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (aicp->ai_glide_strafe_percent[i] < 0.0f || aicp->ai_glide_strafe_percent[i] > 100.0f) {
|
||||
aicp->ai_glide_strafe_percent[i] = 0.0f;
|
||||
Warning(LOCATION, "$Glide Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", aicp->ai_glide_strafe_percent[i]);
|
||||
}
|
||||
aicp->ai_glide_strafe_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Random Sidethrust Percent:")) {
|
||||
parse_float_list(aicp->ai_random_sidethrust_percent, NUM_SKILL_LEVELS);
|
||||
for (int i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (aicp->ai_random_sidethrust_percent[i] < 0.0f || aicp->ai_random_sidethrust_percent[i] > 100.0f) {
|
||||
aicp->ai_random_sidethrust_percent[i] = 0.0f;
|
||||
Warning(LOCATION, "$Random Sidethrust Percent should be between 0 and 100.0 (read %f). Setting to 0.", aicp->ai_random_sidethrust_percent[i]);
|
||||
}
|
||||
aicp->ai_random_sidethrust_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Stalemate Time Threshold:"))
|
||||
parse_float_list(aicp->ai_stalemate_time_thresh, NUM_SKILL_LEVELS);
|
||||
@@ -694,29 +738,34 @@ void parse_ai_class()
|
||||
if (optional_string("$Max Aim Update Delay:"))
|
||||
parse_float_list(aicp->ai_max_aim_update_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
set_aic_flag(aicp, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS);
|
||||
if (optional_string("$Turret Max Aim Update Delay:"))
|
||||
parse_float_list(aicp->ai_turret_max_aim_update_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
set_aic_flag(aicp, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION);
|
||||
set_aic_flag(aicp, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$smart secondary weapon selection:", AIPF_SMART_SECONDARY_WEAPON_SELECTION);
|
||||
set_aic_flag(aicp, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT);
|
||||
set_aic_flag(aicp, "$smart secondary weapon selection:", AIPF_SMART_SECONDARY_WEAPON_SELECTION, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT);
|
||||
set_aic_flag(aicp, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE);
|
||||
set_aic_flag(aicp, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS);
|
||||
set_aic_flag(aicp, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$don't insert random turret fire delay:", AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY);
|
||||
set_aic_flag(aicp, "$don't insert random turret fire delay:", AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE);
|
||||
set_aic_flag(aicp, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS);
|
||||
set_aic_flag(aicp, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$allow turrets target weapons freely:", AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY);
|
||||
set_aic_flag(aicp, "$allow turrets target weapons freely:", AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$allow vertical dodge:", AIPF_ALLOW_VERTICAL_DODGE);
|
||||
set_aic_flag(aicp, "$allow vertical dodge:", AIPF_ALLOW_VERTICAL_DODGE, AIP_FLAG);
|
||||
|
||||
set_aic_flag(aicp, "$no extra collision avoidance vs player:", AIPF2_NO_SPECIAL_PLAYER_AVOID, AIP_FLAG2);
|
||||
}
|
||||
|
||||
void reset_ai_class_names()
|
||||
@@ -2846,6 +2895,14 @@ void create_model_exit_path(object *pl_objp, object *mobjp, int path_num, int co
|
||||
model_path *mp;
|
||||
pnode *ppfp_start = Ppfp;
|
||||
|
||||
Assert(path_num >= 0);
|
||||
|
||||
// Do garbage collection if necessary.
|
||||
if (Ppfp-Path_points + 64 > MAX_PATH_POINTS) {
|
||||
garbage_collect_path_points();
|
||||
ppfp_start = Ppfp;
|
||||
}
|
||||
|
||||
aip->path_start = Ppfp - Path_points;
|
||||
Assert(path_num < pm->n_paths);
|
||||
|
||||
@@ -5066,17 +5123,15 @@ void evade_ship()
|
||||
} else
|
||||
accelerate_ship(aip, (float) (Game_skill_level+2) / (NUM_SKILL_LEVELS+1));
|
||||
|
||||
if (ai_maybe_fire_afterburner(Pl_objp, aip)){
|
||||
if ((Missiontime - aip->submode_start_time > F1_0/2) && (sip->afterburner_fuel_capacity > 0.0f)) {
|
||||
float percent_left = 100.0f * shipp->afterburner_fuel / sip->afterburner_fuel_capacity;
|
||||
if (percent_left > 30.0f + ((Pl_objp-Objects) & 0x0f)) {
|
||||
afterburners_start(Pl_objp);
|
||||
|
||||
if (aip->ai_profile_flags & AIPF_SMART_AFTERBURNER_MANAGEMENT) {
|
||||
aip->afterburner_stop_time = (fix) (Missiontime + F1_0 + static_randf(Pl_objp-Objects) * F1_0 / 4);
|
||||
} else {
|
||||
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(Pl_objp-Objects)/4;
|
||||
}
|
||||
if ((Missiontime - aip->submode_start_time > F1_0/2) && (sip->afterburner_fuel_capacity > 0.0f)) {
|
||||
float percent_left = 100.0f * shipp->afterburner_fuel / sip->afterburner_fuel_capacity;
|
||||
if (percent_left > 30.0f + ((Pl_objp-Objects) & 0x0f)) {
|
||||
afterburners_start(Pl_objp);
|
||||
|
||||
if (aip->ai_profile_flags & AIPF_SMART_AFTERBURNER_MANAGEMENT) {
|
||||
aip->afterburner_stop_time = (fix) (Missiontime + F1_0 + static_randf(Pl_objp-Objects) * F1_0 / 4);
|
||||
} else {
|
||||
aip->afterburner_stop_time = Missiontime + F1_0 + static_rand(Pl_objp-Objects)/4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6481,7 +6536,7 @@ void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, vec3d *e
|
||||
|
||||
// Make it take longer for enemies to get player's allies in range based on skill level.
|
||||
// but don't bias team v. team missions
|
||||
if ( !((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)) )
|
||||
if ( !(MULTI_TEAM) )
|
||||
{
|
||||
if (iff_x_attacks_y(shipp->team, Player_ship->team))
|
||||
range_time += The_mission.ai_profile->in_range_time[Game_skill_level];
|
||||
@@ -6661,9 +6716,28 @@ int ai_near_full_strength(object *objp)
|
||||
{
|
||||
return (get_hull_pct(objp) > 0.9f) || (get_shield_pct(objp) > 0.8f);
|
||||
}
|
||||
|
||||
void do_random_sidethrust(ai_info *aip, ship_info *sip)
|
||||
{
|
||||
//Sidethrust vector is initially based on the velocity vector representing the ship's current sideways motion.
|
||||
vec2d side_vec;
|
||||
//Length to hold circle strafe is random (1-3) + slide accel time, changes every 4 seconds
|
||||
int strafeHoldDirAmount = (int)(sip->slide_accel) + static_rand_range((Missiontime + static_rand(aip->shipnum)) >> 18, 1, 3);
|
||||
//Get a random float using some of the more significant chunks of the missiontime as a seed (>>16 means it changes every second)
|
||||
//This means that we get the same random values for a little bit.
|
||||
//Using static_rand(shipnum) as a crude hash function to make sure that the seed is different for each ship and direction
|
||||
//The *2 ensures that y and x stay separate.
|
||||
side_vec.x = static_randf_range((((Missiontime + static_rand(aip->shipnum)) >> 16) / strafeHoldDirAmount) , -1.0f, 1.0f);
|
||||
side_vec.y = static_randf_range((((Missiontime + static_rand(aip->shipnum)) >> 16) / strafeHoldDirAmount) * 2, -1.0f, 1.0f);
|
||||
//Scale it up so that the longest dimension is length 1.0. This ensures we are always getting as much use out of sidethrust as possible.
|
||||
vm_vec_boxscale(&side_vec, 1.0f);
|
||||
|
||||
AI_ci.sideways = side_vec.x;
|
||||
AI_ci.vertical = side_vec.y;
|
||||
}
|
||||
|
||||
// Set acceleration while in attack mode.
|
||||
void attack_set_accel(ai_info *aip, float dist_to_enemy, float dot_to_enemy, float dot_from_enemy)
|
||||
void attack_set_accel(ai_info *aip, ship_info *sip, float dist_to_enemy, float dot_to_enemy, float dot_from_enemy)
|
||||
{
|
||||
float speed_ratio;
|
||||
|
||||
@@ -6695,23 +6769,19 @@ void attack_set_accel(ai_info *aip, float dist_to_enemy, float dot_to_enemy, flo
|
||||
//Circle Strafe: We try to maintain a constant distance from the target while using sidethrust to move in a circle
|
||||
//around the target
|
||||
if (aip->submode == AIS_CHASE_CIRCLESTRAFE) {
|
||||
accelerate_ship(aip, 0.0f); //Just maintain current distance
|
||||
//If glide is available, use it (smooths things out a bit)
|
||||
if (sip->can_glide == true)
|
||||
Pl_objp->phys_info.flags |= PF_GLIDING;
|
||||
|
||||
//Sidethrust vector is initially based on the velocity vector representing the ship's current sideways motion.
|
||||
vec2d side_vec;
|
||||
//NOTE: Leaving this hardcoded for now, but it might be good to make it configurable at some point.
|
||||
int strafeHoldDirAmount = 3;
|
||||
//Get a random float using some of the more significant chunks of the missiontime as a seed (>>16 means it changes every second)
|
||||
//This means that we get the same random values for a little bit.
|
||||
//Using static_rand(shipnum) as a crude hash function to make sure that the seed is different for each ship and direction
|
||||
//The *2 ensures that y and x stay separate.
|
||||
side_vec.x = static_randf_range((((Missiontime + static_rand(aip->shipnum)) >> 16) / strafeHoldDirAmount) , -1.0f, 1.0f);
|
||||
side_vec.y = static_randf_range((((Missiontime + static_rand(aip->shipnum)) >> 16) / strafeHoldDirAmount) * 2, -1.0f, 1.0f);
|
||||
//Scale it up so that the longest dimension is length 1.0. This ensures we are always getting as much use out of sidethrust as possible.
|
||||
vm_vec_boxscale(&side_vec, 1.0f);
|
||||
//Try to maintain a distance between 50% and 75% of maximum circle strafe distance
|
||||
if (dist_to_enemy <= CIRCLE_STRAFE_MAX_DIST * .5)
|
||||
accelerate_ship(aip, -1.0f);
|
||||
else if (dist_to_enemy >= CIRCLE_STRAFE_MAX_DIST * 0.75)
|
||||
accelerate_ship(aip, 1.0f);
|
||||
else
|
||||
accelerate_ship(aip, 0.0f);
|
||||
|
||||
AI_ci.sideways = side_vec.x;
|
||||
AI_ci.vertical = side_vec.y;
|
||||
do_random_sidethrust(aip, sip);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7117,7 +7187,7 @@ void ai_stealth_find()
|
||||
|
||||
dot_from_enemy = -vm_vec_dotprod(&vec_to_enemy, &En_objp->orient.vec.fvec);
|
||||
|
||||
attack_set_accel(aip, dist_to_enemy, dot_to_enemy, dot_from_enemy);
|
||||
attack_set_accel(aip, sip, dist_to_enemy, dot_to_enemy, dot_from_enemy);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -7258,7 +7328,7 @@ void ai_chase_attack(ai_info *aip, ship_info *sip, vec3d *predicted_enemy_pos, f
|
||||
float dot_to_enemy, dot_from_enemy; //, time_to_hit;
|
||||
float bank_override = 0.0f;
|
||||
|
||||
if (avoid_player(Pl_objp, predicted_enemy_pos))
|
||||
if (!(aip->ai_profile_flags2 & AIPF2_NO_SPECIAL_PLAYER_AVOID) && avoid_player(Pl_objp, predicted_enemy_pos))
|
||||
return;
|
||||
|
||||
compute_dots(Pl_objp, En_objp, &dot_to_enemy, &dot_from_enemy);
|
||||
@@ -7302,7 +7372,7 @@ void ai_chase_attack(ai_info *aip, ship_info *sip, vec3d *predicted_enemy_pos, f
|
||||
ai_turn_towards_vector(&new_pos, Pl_objp, flFrametime, sip->srotation_time, NULL, rel_pos, bank_override, 0);
|
||||
}
|
||||
|
||||
attack_set_accel(aip, dist_to_enemy, dot_to_enemy, dot_from_enemy);
|
||||
attack_set_accel(aip, sip, dist_to_enemy, dot_to_enemy, dot_from_enemy);
|
||||
}
|
||||
|
||||
// EVADE_SQUIGGLE submode handler for chase mode.
|
||||
@@ -8420,6 +8490,21 @@ void ai_chase()
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
|
||||
//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 == SM_ATTACK ||
|
||||
aip->submode == SM_SUPER_ATTACK ||
|
||||
aip->submode == SM_EVADE_SQUIGGLE ||
|
||||
aip->submode == SM_EVADE ||
|
||||
aip->submode == SM_GET_AWAY)
|
||||
{
|
||||
//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, sip);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Maybe choose a new submode.
|
||||
//
|
||||
@@ -8491,8 +8576,9 @@ void ai_chase()
|
||||
aip->submode = SM_STEALTH_FIND;
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->submode_parm0 = SM_SF_AHEAD;
|
||||
} else if (dist_to_enemy < CIRCLE_STRAFE_DIST + En_objp->radius &&
|
||||
(En_objp->phys_info.speed < MAX(sip->max_vel.xyz.x, sip->max_vel.xyz.y) * 1.5f) &&
|
||||
} else if (dist_to_enemy < CIRCLE_STRAFE_MAX_DIST + En_objp->radius &&
|
||||
(En_objp->phys_info.speed < MAX(sip->max_vel.xyz.x, sip->max_vel.xyz.y)) &&
|
||||
(dot_to_enemy > 0.33) &&
|
||||
(static_randf((Missiontime + static_rand(aip->shipnum)) >> 19) < aip->ai_circle_strafe_percent)) {
|
||||
aip->submode = AIS_CHASE_CIRCLESTRAFE;
|
||||
aip->submode_start_time = Missiontime;
|
||||
@@ -8606,8 +8692,9 @@ void ai_chase()
|
||||
aip->submode = SM_STEALTH_FIND;
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->submode_parm0 = SM_SF_AHEAD;
|
||||
} else if (dist_to_enemy < CIRCLE_STRAFE_DIST + En_objp->radius &&
|
||||
(En_objp->phys_info.speed < MAX(sip->max_vel.xyz.x, sip->max_vel.xyz.y) * 1.5f) &&
|
||||
} else if (dist_to_enemy < CIRCLE_STRAFE_MAX_DIST + En_objp->radius &&
|
||||
(En_objp->phys_info.speed < MAX(sip->max_vel.xyz.x, sip->max_vel.xyz.y)) &&
|
||||
(dot_to_enemy > 0.33) &&
|
||||
(static_randf((Missiontime + static_rand(aip->shipnum)) >> 19) < aip->ai_circle_strafe_percent)) {
|
||||
aip->submode = AIS_CHASE_CIRCLESTRAFE;
|
||||
aip->submode_start_time = Missiontime;
|
||||
@@ -8616,7 +8703,7 @@ void ai_chase()
|
||||
aip->ai_flags &= ~AIF_ATTACK_SLOWLY; // Just in case, clear here.
|
||||
|
||||
float get_away_chance = (aip->ai_get_away_chance == FLT_MIN)
|
||||
? (aip->ai_class + Game_skill_level)/(Num_ai_classes + NUM_SKILL_LEVELS)
|
||||
? (float)(aip->ai_class + Game_skill_level)/(Num_ai_classes + NUM_SKILL_LEVELS)
|
||||
: aip->ai_get_away_chance;
|
||||
|
||||
switch (myrand() % 5) {
|
||||
@@ -8758,7 +8845,10 @@ void ai_chase()
|
||||
break;
|
||||
|
||||
case AIS_CHASE_CIRCLESTRAFE:
|
||||
if ((dist_to_enemy > CIRCLE_STRAFE_DIST + En_objp->radius) || (Missiontime - aip->submode_start_time > i2f(4))) {
|
||||
//Break out of circle strafe if the target is too far, moving too fast, or we've been doing this for a while
|
||||
if ((dist_to_enemy > CIRCLE_STRAFE_MAX_DIST + En_objp->radius) ||
|
||||
(Missiontime - aip->submode_start_time > i2f(8)) ||
|
||||
(En_objp->phys_info.speed > MAX(sip->max_vel.xyz.x, sip->max_vel.xyz.y) * 1.5)) {
|
||||
aip->submode = SM_ATTACK;
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->last_attack_time = Missiontime;
|
||||
@@ -8857,7 +8947,7 @@ void ai_chase()
|
||||
else
|
||||
{
|
||||
float secondary_range_mult = (aip->ai_secondary_range_mult == FLT_MIN)
|
||||
? (Game_skill_level + 1 + (3 * aip->ai_class/(Num_ai_classes - 1)))/NUM_SKILL_LEVELS
|
||||
? (float)(Game_skill_level + 1 + (3 * aip->ai_class/(Num_ai_classes - 1)))/NUM_SKILL_LEVELS
|
||||
: aip->ai_secondary_range_mult;
|
||||
|
||||
firing_range = MIN((swip->max_speed * swip->lifetime * secondary_range_mult), swip->weapon_range);
|
||||
@@ -12141,7 +12231,7 @@ void ai_maybe_launch_cmeasure(object *objp, ai_info *aip)
|
||||
// For ships on player's team, have constant, average chance to fire.
|
||||
// For enemies, increasing chance with higher skill level.
|
||||
if (shipp->team == Player_ship->team)
|
||||
fire_chance = The_mission.ai_profile->cmeasure_fire_chance[NUM_SKILL_LEVELS/2] * Ai_classes[aip->ai_class].ai_cmeasure_fire_chance[NUM_SKILL_LEVELS/2];
|
||||
fire_chance = Ai_classes[aip->ai_class].ai_cmeasure_fire_chance[NUM_SKILL_LEVELS/2];
|
||||
else
|
||||
fire_chance = aip->ai_cmeasure_fire_chance;
|
||||
|
||||
@@ -12359,7 +12449,7 @@ void ai_manage_shield(object *objp, ai_info *aip)
|
||||
}
|
||||
else
|
||||
{
|
||||
delay = The_mission.ai_profile->shield_manage_delay[NUM_SKILL_LEVELS/2] * Ai_classes[aip->ai_class].ai_shield_manage_delay[NUM_SKILL_LEVELS/2];
|
||||
delay = Ai_classes[aip->ai_class].ai_shield_manage_delay[NUM_SKILL_LEVELS/2];
|
||||
}
|
||||
|
||||
// Scale between 1x and 3x based on ai_class (SUSHI: only if autoscale is on)
|
||||
@@ -13849,7 +13939,7 @@ int ai_avoid_shockwave(object *objp, ai_info *aip)
|
||||
else {
|
||||
accelerate_ship(aip, 1.0f + dot_to_goal);
|
||||
if (dot_to_goal > 0.2f) {
|
||||
if (ai_maybe_fire_afterburner(Pl_objp, aip) && !(objp->phys_info.flags & PF_AFTERBURNER_ON )) {
|
||||
if (!(objp->phys_info.flags & PF_AFTERBURNER_ON )) {
|
||||
afterburners_start(objp);
|
||||
aip->afterburner_stop_time = Missiontime + 2*F1_0;
|
||||
}
|
||||
@@ -14617,6 +14707,28 @@ void init_ai_system()
|
||||
|
||||
}
|
||||
|
||||
int combine_flags(int base_flags, int override_flags, int override_set)
|
||||
{
|
||||
int result = 0;
|
||||
//Scan through every bit in the flag int
|
||||
for (int i = 0; i < 31; i++)
|
||||
{
|
||||
int flag = (1 << i);
|
||||
//If this flag is marked in the override as set, copy it from the override
|
||||
if (override_set & flag)
|
||||
{
|
||||
if (override_flags & flag)
|
||||
result |= flag;
|
||||
}
|
||||
else //Otherwise, copy it from the base flag
|
||||
{
|
||||
if (base_flags & flag)
|
||||
result |= flag;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//Sets the ai_info stuff based on what is in the ai class and the current ai profile
|
||||
//Stuff in the ai class will override what is in the ai profile, but only if it is set.
|
||||
//Unset per-difficulty-level values are marked with FLT_MIN or INT_MIN
|
||||
@@ -14672,6 +14784,8 @@ void init_aip_from_class_and_profile(ai_info *aip, ai_class *aicp, ai_profile_t
|
||||
profile->circle_strafe_percent[Game_skill_level] : aicp->ai_circle_strafe_percent[Game_skill_level];
|
||||
aip->ai_glide_strafe_percent = (aicp->ai_glide_strafe_percent[Game_skill_level] == FLT_MIN) ?
|
||||
profile->glide_strafe_percent[Game_skill_level] : aicp->ai_glide_strafe_percent[Game_skill_level];
|
||||
aip->ai_random_sidethrust_percent = (aicp->ai_random_sidethrust_percent[Game_skill_level] == FLT_MIN) ?
|
||||
profile->random_sidethrust_percent[Game_skill_level] : aicp->ai_random_sidethrust_percent[Game_skill_level];
|
||||
aip->ai_stalemate_time_thresh = (aicp->ai_stalemate_time_thresh[Game_skill_level] == FLT_MIN) ?
|
||||
profile->stalemate_time_thresh[Game_skill_level] : aicp->ai_stalemate_time_thresh[Game_skill_level];
|
||||
aip->ai_stalemate_dist_thresh = (aicp->ai_stalemate_dist_thresh[Game_skill_level] == FLT_MIN) ?
|
||||
@@ -14680,25 +14794,12 @@ void init_aip_from_class_and_profile(ai_info *aip, ai_class *aicp, ai_profile_t
|
||||
profile->chance_to_use_missiles_on_plr[Game_skill_level] : aicp->ai_chance_to_use_missiles_on_plr[Game_skill_level];
|
||||
aip->ai_max_aim_update_delay = (aicp->ai_max_aim_update_delay[Game_skill_level] == FLT_MIN) ?
|
||||
profile->max_aim_update_delay[Game_skill_level] : aicp->ai_max_aim_update_delay[Game_skill_level];
|
||||
aip->ai_turret_max_aim_update_delay = (aicp->ai_turret_max_aim_update_delay[Game_skill_level] == FLT_MIN) ?
|
||||
profile->turret_max_aim_update_delay[Game_skill_level] : aicp->ai_turret_max_aim_update_delay[Game_skill_level];
|
||||
|
||||
//Set flags (these act as overrides if set)
|
||||
aip->ai_profile_flags = 0;
|
||||
//Scan through every bit in the flag int
|
||||
for (int i = 0; i < 31; i++)
|
||||
{
|
||||
int flag = (1 << i);
|
||||
//If this flag is marked in the AI class as set, copy it from the class
|
||||
if (aicp->ai_profile_flags_set & flag)
|
||||
{
|
||||
if (aicp->ai_profile_flags & flag)
|
||||
aip->ai_profile_flags |= flag;
|
||||
}
|
||||
else //Otherwise, copy it from the AI profile
|
||||
{
|
||||
if (profile->flags & flag)
|
||||
aip->ai_profile_flags |= flag;
|
||||
}
|
||||
}
|
||||
//Combine AI profile and AI class flags
|
||||
aip->ai_profile_flags = combine_flags(profile->flags, aicp->ai_profile_flags, aicp->ai_profile_flags_set);
|
||||
aip->ai_profile_flags2 = combine_flags(profile->flags2, aicp->ai_profile_flags2, aicp->ai_profile_flags2_set);
|
||||
}
|
||||
|
||||
void ai_set_default_behavior(object *obj, int classnum)
|
||||
|
||||
+27
-5
@@ -1008,9 +1008,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 +1060,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) {
|
||||
@@ -1317,7 +1339,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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
+46
-15
@@ -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,7 @@ enum
|
||||
|
||||
#define BUILD_CAP_OPENAL (1<<0)
|
||||
#define BUILD_CAP_NO_D3D (1<<1)
|
||||
#define BUILD_CAP_NEW_SND (1<<2)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -163,6 +165,7 @@ 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", "", },
|
||||
|
||||
{ "-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", "", },
|
||||
@@ -333,11 +336,9 @@ 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 +367,7 @@ 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
|
||||
|
||||
int Cmdline_d3d_lesstmem = 0;
|
||||
int Cmdline_load_all_weapons = 0;
|
||||
@@ -378,6 +380,7 @@ 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;
|
||||
|
||||
// Developer/Testing related
|
||||
cmdline_parm start_mission_arg("-start_mission", NULL); // Cmdline_start_mission
|
||||
@@ -385,6 +388,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
|
||||
@@ -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;
|
||||
@@ -800,6 +805,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 +830,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 +854,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 +878,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,6 +914,11 @@ bool SetCmdlineParams()
|
||||
Cmdline_FRED2_htl = 1;
|
||||
}*/
|
||||
|
||||
if (extra_warn_arg.found())
|
||||
{
|
||||
Cmdline_extra_warn = 1;
|
||||
}
|
||||
|
||||
if (timerbar_arg.found()) {
|
||||
Cmdline_timerbar = 1;
|
||||
}
|
||||
@@ -1137,7 +1165,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() ) {
|
||||
@@ -1290,10 +1323,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);
|
||||
}
|
||||
@@ -1338,11 +1371,6 @@ bool SetCmdlineParams()
|
||||
Cmdline_ballistic_gauge = 1;
|
||||
}
|
||||
|
||||
if (wcsaga.found())
|
||||
{
|
||||
Cmdline_wcsaga = 1;
|
||||
}
|
||||
|
||||
if ( cache_bitmaps_arg.found() ) {
|
||||
Cmdline_cache_bitmaps = 1;
|
||||
}
|
||||
@@ -1390,6 +1418,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 +1486,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();
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,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)
|
||||
@@ -127,6 +126,7 @@ 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;
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
@@ -134,6 +134,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;
|
||||
|
||||
@@ -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);
|
||||
@@ -468,7 +464,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);
|
||||
@@ -514,7 +509,7 @@ void cutscenes_screen_init()
|
||||
|
||||
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 +528,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;
|
||||
|
||||
@@ -578,7 +572,7 @@ void cutscenes_screen_do_frame()
|
||||
{
|
||||
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++;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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__
|
||||
@@ -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 {
|
||||
|
||||
@@ -668,3 +668,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() {}
|
||||
+42
-3
@@ -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 |
|
||||
@@ -2554,6 +2556,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"
|
||||
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 +3003,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
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -143,6 +144,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 +727,13 @@ void CMissionNotesDlg::OnCustomWingNames()
|
||||
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
void CMissionNotesDlg::OnSoundEnvironment()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
|
||||
SoundEnvironment dlg;
|
||||
dlg.DoModal();
|
||||
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
@@ -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,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;
|
||||
}
|
||||
|
||||
|
||||
+15
-4
@@ -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,13 @@
|
||||
#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 ID_FILE_MISSIONNOTES 32771
|
||||
#define ID_DUPLICATE 32774
|
||||
#define ID_VIEW_ROTATE 32775
|
||||
@@ -1419,9 +1430,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 1628
|
||||
#define _APS_NEXT_SYMED_VALUE 105
|
||||
#endif
|
||||
#endif
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "iff_defs/iff_defs.h"
|
||||
#include "mission/missionmessage.h"
|
||||
#include "graphics/gropenglshader.h"
|
||||
#include "sound/ds.h"
|
||||
|
||||
#define TREE_NODE_INCREMENT 100
|
||||
|
||||
@@ -2656,6 +2657,9 @@ 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:
|
||||
return 1;
|
||||
|
||||
case OPF_SHIP:
|
||||
@@ -4353,6 +4357,18 @@ 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;
|
||||
|
||||
default:
|
||||
Int3(); // unknown OPF code
|
||||
list = NULL;
|
||||
@@ -5194,6 +5210,30 @@ 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 < 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_waypoint_path()
|
||||
{
|
||||
int i;
|
||||
@@ -5614,7 +5654,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++)
|
||||
{
|
||||
@@ -5683,6 +5723,14 @@ 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;
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
@@ -257,6 +257,9 @@ 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();
|
||||
|
||||
int m_mode;
|
||||
int item_index;
|
||||
|
||||
@@ -1321,7 +1321,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 +1331,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 +1343,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)
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
// 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
|
||||
#define new DEBUG_NEW
|
||||
#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();
|
||||
}
|
||||
}
|
||||
@@ -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_)
|
||||
@@ -778,7 +778,7 @@ void wing_editor::update_data_safe()
|
||||
MODIFY(Wings[cur_wing].wave_delay_max, m_arrival_delay_max);
|
||||
MODIFY(Wings[cur_wing].arrival_distance, m_arrival_dist);
|
||||
if (m_arrival_target >= 0) {
|
||||
i = ((CComboBox *) GetDlgItem(IDC_ARRIVAL_TARGET)) -> GetItemData(m_arrival_target);
|
||||
i = ((CComboBox *) GetDlgItem(IDC_ARRIVAL_TARGET))->GetItemData(m_arrival_target);
|
||||
MODIFY(Wings[cur_wing].arrival_anchor, i);
|
||||
|
||||
// when arriving near or in front of a ship, be sure that we are far enough away from it!!!
|
||||
@@ -788,7 +788,7 @@ void wing_editor::update_data_safe()
|
||||
if (!bypass_errors) {
|
||||
sprintf(buf, "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[i].objnum].radius) );
|
||||
"Recommended distance is %d meters.\r\n", d, (int)(2.0f * Objects[Ships[i].objnum].radius) );
|
||||
|
||||
MessageBox(buf);
|
||||
}
|
||||
@@ -802,9 +802,10 @@ void wing_editor::update_data_safe()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i = ((CComboBox*)GetDlgItem(IDC_DEPARTURE_TARGET))->GetItemData(m_departure_target);
|
||||
MODIFY(Wings[cur_wing].departure_anchor, i);
|
||||
if (m_departure_target >= 0) {
|
||||
i = ((CComboBox *) GetDlgItem(IDC_DEPARTURE_TARGET))->GetItemData(m_departure_target);
|
||||
MODIFY(Wings[cur_wing].departure_anchor, i);
|
||||
}
|
||||
|
||||
MODIFY(Wings[cur_wing].departure_delay, m_departure_delay);
|
||||
hotkey = m_hotkey - 1;
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
#include "ship/shipfx.h"
|
||||
#include "ship/shiphit.h"
|
||||
#include "sound/audiostr.h"
|
||||
#include "sound/ds.h"
|
||||
#include "sound/fsspeech.h"
|
||||
#include "sound/sound.h"
|
||||
#include "sound/voicerec.h"
|
||||
@@ -601,7 +602,7 @@ float Game_shudder_intensity = 0.0f; // should be between 0.0 and 100.0
|
||||
|
||||
// EAX stuff
|
||||
sound_env Game_sound_env;
|
||||
sound_env Game_default_sound_env = {SND_ENV_BATHROOM, 0.2F,0.2F,1.0F};
|
||||
sound_env Game_default_sound_env = { EAX_ENVIRONMENT_BATHROOM, 0.2f, 0.2f, 1.0f };
|
||||
int Game_sound_env_update_timestamp;
|
||||
|
||||
|
||||
@@ -994,6 +995,10 @@ void game_level_close()
|
||||
subtitles_close();
|
||||
trail_level_close();
|
||||
|
||||
// be sure to not only reset the time but the lock as well
|
||||
set_time_compression(1.0f, 0.0f);
|
||||
lock_time_compression(false);
|
||||
|
||||
audiostream_unpause_all();
|
||||
Game_paused = 0;
|
||||
|
||||
@@ -1446,7 +1451,14 @@ void game_assign_sound_environment()
|
||||
}
|
||||
*/
|
||||
|
||||
Game_sound_env = Game_default_sound_env;
|
||||
if (The_mission.sound_environment.id >= 0) {
|
||||
Game_sound_env = The_mission.sound_environment;
|
||||
} else if (SND_ENV_DEFAULT > 0) {
|
||||
sound_env_get(&Game_sound_env, SND_ENV_DEFAULT);
|
||||
} else {
|
||||
Game_sound_env = Game_default_sound_env;
|
||||
}
|
||||
|
||||
Game_sound_env_update_timestamp = timestamp(1);
|
||||
}
|
||||
|
||||
@@ -2025,47 +2037,8 @@ void game_init()
|
||||
// SOUND INIT START
|
||||
/////////////////////////////
|
||||
|
||||
int use_a3d = 0;
|
||||
int use_eax = 0;
|
||||
|
||||
#ifndef USE_OPENAL
|
||||
ptr = os_config_read_string(NULL, NOX("Soundcard"), NULL);
|
||||
mprintf(("soundcard = %s\n", ptr ? ptr : "<nothing>"));
|
||||
if (ptr) {
|
||||
if (!stricmp(ptr, NOX("no sound"))) {
|
||||
Cmdline_freespace_no_sound = 1;
|
||||
Cmdline_freespace_no_music = 1;
|
||||
|
||||
} else if (!stricmp(ptr, NOX("Aureal A3D"))) {
|
||||
use_a3d = 1;
|
||||
} else if (!stricmp(ptr, NOX("EAX"))) {
|
||||
use_eax = 1;
|
||||
}
|
||||
}
|
||||
#ifndef SCP_UNIX
|
||||
else
|
||||
{
|
||||
run_launcher();
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
#else // USE_OPENAL
|
||||
ptr = os_config_read_string(NULL, NOX("SoundDeviceOAL"), NULL);
|
||||
if (ptr) {
|
||||
if ( !stricmp(ptr, NOX("no sound")) ) {
|
||||
mprintf(("Sound is disabled!\n"));
|
||||
|
||||
Cmdline_freespace_no_sound = 1;
|
||||
Cmdline_freespace_no_music = 1;
|
||||
}
|
||||
}
|
||||
#endif // !USE_OPENAL
|
||||
|
||||
if (!Is_standalone)
|
||||
{
|
||||
UserSampleRate = (ushort) os_config_read_uint(NULL, "SoundSampleRate", 44100);
|
||||
UserSampleBits = (ushort) os_config_read_uint(NULL, "SoundSampleBits", 16);
|
||||
snd_init(use_a3d, use_eax, UserSampleRate, UserSampleBits);
|
||||
if ( !Is_standalone ) {
|
||||
snd_init();
|
||||
}
|
||||
|
||||
if(fsspeech_init() == false) {
|
||||
@@ -2552,10 +2525,6 @@ void game_show_framerate()
|
||||
|
||||
gr_printf( sx, sy, NOX("S-SRAM: %d KB\n"), Snd_sram/1024 ); // mem used to store game sound
|
||||
sy += dy;
|
||||
#ifndef USE_OPENAL
|
||||
gr_printf( sx, sy, NOX("S-HRAM: %d KB\n"), Snd_hram/1024 ); // mem used to store game sound
|
||||
sy += dy;
|
||||
#endif
|
||||
|
||||
{
|
||||
extern int GL_textures_in;
|
||||
@@ -3052,7 +3021,7 @@ extern void render_shields();
|
||||
|
||||
void player_repair_frame(float frametime)
|
||||
{
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if(MULTIPLAYER_MASTER){
|
||||
int idx;
|
||||
for(idx=0;idx<MAX_PLAYERS;idx++){
|
||||
net_player *np;
|
||||
@@ -3937,8 +3906,7 @@ void game_render_frame( camid cid )
|
||||
|
||||
bool draw_viewer_last = false;
|
||||
obj_render_all(obj_render, &draw_viewer_last);
|
||||
|
||||
//mflash_render_all(); // render all muzzle flashes
|
||||
|
||||
// Why do we not show the shield effect in these modes? Seems ok.
|
||||
//if (!(Viewer_mode & (VM_EXTERNAL | VM_SLEWED | VM_CHASE | VM_DEAD_VIEW))) {
|
||||
render_shields();
|
||||
@@ -4198,7 +4166,7 @@ void game_simulation_frame()
|
||||
}
|
||||
|
||||
// blow ships up in multiplayer dogfight
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT) && (f2fl(Missiontime) >= 2.0f) && !dogfight_blown){
|
||||
if( MULTIPLAYER_MASTER && (Net_player != NULL) && (Netgame.type_flags & NG_TYPE_DOGFIGHT) && (f2fl(Missiontime) >= 2.0f) && !dogfight_blown){
|
||||
// blow up all non-player ships
|
||||
ship_obj *moveup = GET_FIRST(&Ship_obj_list);
|
||||
ship *shipp;
|
||||
@@ -4278,7 +4246,7 @@ void game_simulation_frame()
|
||||
}
|
||||
|
||||
// evaluate mission departures and arrivals before we process all objects.
|
||||
if ( !(Game_mode & GM_MULTIPLAYER) || ((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && !multi_endgame_ending()) ) {
|
||||
if ( !(Game_mode & GM_MULTIPLAYER) || (MULTIPLAYER_MASTER && !multi_endgame_ending()) ) {
|
||||
|
||||
// we don't want to evaluate mission stuff when any ingame joiner in multiplayer is receiving
|
||||
// ships/wing packets.
|
||||
@@ -4308,7 +4276,7 @@ void game_simulation_frame()
|
||||
}
|
||||
|
||||
// do all interpolation now
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) && !multi_endgame_ending() && !(Netgame.flags & NG_FLAG_SERVER_LOST)) {
|
||||
if ( MULTIPLAYER_CLIENT && !multi_endgame_ending() && !(Netgame.flags & NG_FLAG_SERVER_LOST)) {
|
||||
// client side processing of warping in effect stages
|
||||
multi_do_client_warp(flFrametime);
|
||||
|
||||
@@ -4348,9 +4316,6 @@ void game_simulation_frame()
|
||||
// Move missile trails
|
||||
trail_move_all(flFrametime);
|
||||
|
||||
// process muzzle flashes
|
||||
mflash_process_all();
|
||||
|
||||
// Flash the gun flashes
|
||||
shipfx_flash_do_frame(flFrametime);
|
||||
|
||||
@@ -4721,7 +4686,7 @@ void game_frame(int paused)
|
||||
}
|
||||
|
||||
// if we're not the master, we may have to send the server-critical ship status button_info bits
|
||||
if ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) && !(Net_player->flags & NETINFO_FLAG_OBSERVER)){
|
||||
if (MULTIPLAYER_CLIENT && !(Net_player->flags & NETINFO_FLAG_OBSERVER)){
|
||||
multi_maybe_send_ship_status();
|
||||
}
|
||||
}
|
||||
@@ -6132,7 +6097,6 @@ void game_leave_state( int old_state, int new_state )
|
||||
}
|
||||
|
||||
freespace_stop_mission();
|
||||
set_time_compression(1.0f);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -6376,8 +6340,6 @@ void game_enter_state( int old_state, int new_state )
|
||||
Net_player->flags &= ~NETINFO_FLAG_DO_NETWORKING;
|
||||
}
|
||||
|
||||
set_time_compression(1.0f);
|
||||
|
||||
// remove any multiplayer flags from the game mode
|
||||
Game_mode &= ~(GM_MULTIPLAYER);
|
||||
|
||||
@@ -6424,8 +6386,6 @@ void game_enter_state( int old_state, int new_state )
|
||||
break;
|
||||
}
|
||||
|
||||
set_time_compression(1.0f);
|
||||
|
||||
// maybe play a movie before the mission
|
||||
mission_campaign_maybe_play_movie(CAMPAIGN_MOVIE_PRE_MISSION);
|
||||
|
||||
@@ -6539,6 +6499,19 @@ void game_enter_state( int old_state, int new_state )
|
||||
//Game_time_compression = F1_0;
|
||||
}
|
||||
|
||||
/* game could be comming from a restart (rather than first start)
|
||||
so make sure that we zero the hud gauge overrides (Sexp_hud_*)
|
||||
\sa sexp_hud_display_gauge*/
|
||||
if ( (old_state == GS_STATE_GAME_PLAY)
|
||||
|| (old_state == GS_STATE_BRIEFING)
|
||||
|| (old_state == GS_STATE_DEBRIEF)
|
||||
|| (old_state == GS_STATE_SHIP_SELECT)
|
||||
|| (old_state == GS_STATE_WEAPON_SELECT)
|
||||
|| (old_state == GS_STATE_RED_ALERT) )
|
||||
{
|
||||
Sexp_hud_display_warpout = 0;
|
||||
}
|
||||
|
||||
// coming from the gameplay state or the main menu, we might need to load the mission
|
||||
if ( (Game_mode & GM_NORMAL) && ((old_state == GS_STATE_MAIN_MENU) || (old_state == GS_STATE_GAME_PLAY) || (old_state == GS_STATE_DEATH_BLEW_UP)) ) {
|
||||
if ( !game_start_mission() ) // this should put us into a new state.
|
||||
@@ -6616,15 +6589,14 @@ void mouse_force_pos(int x, int y);
|
||||
}
|
||||
|
||||
// under certain circumstances, the server should reset the object update rate limiting stuff
|
||||
if( ((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)) &&
|
||||
((old_state == GS_STATE_MULTI_PAUSED) || (old_state == GS_STATE_MULTI_MISSION_SYNC)) ){
|
||||
if( MULTIPLAYER_MASTER && ((old_state == GS_STATE_MULTI_PAUSED) || (old_state == GS_STATE_MULTI_MISSION_SYNC)) ){
|
||||
|
||||
// reinitialize the rate limiting system for all clients
|
||||
multi_oo_rate_init_all();
|
||||
}
|
||||
|
||||
// multiplayer clients should always re-initialize their control info rate limiting system
|
||||
if((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if(MULTIPLAYER_CLIENT){
|
||||
multi_oo_rate_init_all();
|
||||
}
|
||||
|
||||
@@ -6776,9 +6748,7 @@ void mouse_force_pos(int x, int y);
|
||||
// JAS: Used to do all paging here!!!!
|
||||
|
||||
Net_player->state = NETPLAYER_STATE_WAITING;
|
||||
send_netplayer_update_packet();
|
||||
Missiontime = 0;
|
||||
set_time_compression(1.0f);
|
||||
send_netplayer_update_packet();
|
||||
break;
|
||||
case MULTI_SYNC_INGAME:
|
||||
multi_sync_init();
|
||||
|
||||
@@ -1371,7 +1371,8 @@ void parse_menumusic()
|
||||
if ( cf_exists_full_ext(Spooled_music[idx].filename, CF_TYPE_MUSIC, NUM_EXT, exts) )
|
||||
Spooled_music[idx].flags |= SMF_VALID;
|
||||
|
||||
Num_music_files++;
|
||||
if (!nocreate)
|
||||
Num_music_files++;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "localization/localize.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "sound/ds.h"
|
||||
|
||||
|
||||
int Num_game_sounds = 0;
|
||||
@@ -316,6 +317,146 @@ void gamesnd_parse_soundstbl()
|
||||
|
||||
required_string("#Flyby Sounds End");
|
||||
|
||||
if ( optional_string("#Sound Environments Start") ) {
|
||||
char name[65] = { '\0' };
|
||||
char template_name[65] = { '\0' };
|
||||
EFXREVERBPROPERTIES *props;
|
||||
|
||||
while ( required_string_either("#Sound Environments End", "$Name:") ) {
|
||||
required_string("$Name:");
|
||||
stuff_string(name, F_NAME, sizeof(name)-1);
|
||||
|
||||
if ( optional_string("$Template:") ) {
|
||||
stuff_string(template_name, F_NAME, sizeof(template_name)-1);
|
||||
} else {
|
||||
template_name[0] = '\0';
|
||||
}
|
||||
|
||||
ds_eax_get_prop(&props, name, template_name);
|
||||
|
||||
if ( optional_string("+Density:") ) {
|
||||
stuff_float(&props->flDensity);
|
||||
CLAMP(props->flDensity, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Diffusion:") ) {
|
||||
stuff_float(&props->flDiffusion);
|
||||
CLAMP(props->flDiffusion, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Gain:") ) {
|
||||
stuff_float(&props->flGain);
|
||||
CLAMP(props->flGain, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Gain HF:") ) {
|
||||
stuff_float(&props->flGainHF);
|
||||
CLAMP(props->flGainHF, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Gain LF:") ) {
|
||||
stuff_float(&props->flGainLF);
|
||||
CLAMP(props->flGainLF, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Decay Time:") ) {
|
||||
stuff_float(&props->flDecayTime);
|
||||
CLAMP(props->flDecayTime, 0.01f, 20.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Decay HF Ratio:") ) {
|
||||
stuff_float(&props->flDecayHFRatio);
|
||||
CLAMP(props->flDecayHFRatio, 0.1f, 20.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Decay LF Ratio:") ) {
|
||||
stuff_float(&props->flDecayLFRatio);
|
||||
CLAMP(props->flDecayLFRatio, 0.1f, 20.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Reflections Gain:") ) {
|
||||
stuff_float(&props->flReflectionsGain);
|
||||
CLAMP(props->flReflectionsGain, 0.0f, 3.16f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Reflections Delay:") ) {
|
||||
stuff_float(&props->flReflectionsDelay);
|
||||
CLAMP(props->flReflectionsDelay, 0.0f, 0.3f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Reflections Pan:") ) {
|
||||
stuff_float_list(props->flReflectionsPan, 3);
|
||||
CLAMP(props->flReflectionsPan[0], 0.0f, 1.0f);
|
||||
CLAMP(props->flReflectionsPan[1], 0.0f, 1.0f);
|
||||
CLAMP(props->flReflectionsPan[2], 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Late Reverb Gain:") ) {
|
||||
stuff_float(&props->flLateReverbGain);
|
||||
CLAMP(props->flLateReverbGain, 0.0f, 10.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Late Reverb Delay:") ) {
|
||||
stuff_float(&props->flLateReverbDelay);
|
||||
CLAMP(props->flLateReverbDelay, 0.0f, 0.1f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Late Reverb Pan:") ) {
|
||||
stuff_float_list(props->flLateReverbPan, 3);
|
||||
CLAMP(props->flLateReverbPan[0], 0.0f, 1.0f);
|
||||
CLAMP(props->flLateReverbPan[1], 0.0f, 1.0f);
|
||||
CLAMP(props->flLateReverbPan[2], 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Echo Time:") ) {
|
||||
stuff_float(&props->flEchoTime);
|
||||
CLAMP(props->flEchoTime, 0.075f, 0.25f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Echo Depth:") ) {
|
||||
stuff_float(&props->flEchoDepth);
|
||||
CLAMP(props->flEchoDepth, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Modulation Time:") ) {
|
||||
stuff_float(&props->flModulationTime);
|
||||
CLAMP(props->flModulationTime, 0.004f, 4.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Modulation Depth:") ) {
|
||||
stuff_float(&props->flModulationDepth);
|
||||
CLAMP(props->flModulationDepth, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+HF Reference:") ) {
|
||||
stuff_float(&props->flHFReference);
|
||||
CLAMP(props->flHFReference, 1000.0f, 20000.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+LF Reference:") ) {
|
||||
stuff_float(&props->flLFReference);
|
||||
CLAMP(props->flLFReference, 20.0f, 1000.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Room Rolloff Factor:") ) {
|
||||
stuff_float(&props->flRoomRolloffFactor);
|
||||
CLAMP(props->flRoomRolloffFactor, 0.0f, 10.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Air Absorption Gain HF:") ) {
|
||||
stuff_float(&props->flAirAbsorptionGainHF);
|
||||
CLAMP(props->flAirAbsorptionGainHF, 0.892f, 1.0f);
|
||||
}
|
||||
|
||||
if ( optional_string("+Decay HF Limit:") ) {
|
||||
stuff_int(&props->iDecayHFLimit);
|
||||
CLAMP(props->iDecayHFLimit, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#Sound Environments End");
|
||||
}
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
@@ -798,6 +798,10 @@ $Circle Strafe Percent: 0, 0, 0, 0, 0 \n\
|
||||
;; capital ships when it is an option. \n""\
|
||||
$Glide Strafe Percent: 0, 0, 0, 0, 0 \n\
|
||||
\n\
|
||||
;; Percentage of the time where AI ships will randomly sidethrust in a \n\
|
||||
;; dogfight. \n\
|
||||
$Random Sidethrust Percent: 0, 0, 0, 0, 0 \n\
|
||||
\n\
|
||||
;; The amount of time required for the AI to detect \n\
|
||||
;; (and try to break) dogfight stalemate. \n\
|
||||
$Stalemate Time Threshold: 0, 0, 0, 0, 0 \n\
|
||||
@@ -848,6 +852,10 @@ $Chance AI Has to Fire Missiles at Player: 0, 1, 2, 3, 4 \n\
|
||||
;; aim. Applies for small ships vs small ships \n\
|
||||
$Max Aim Update Delay: 0, 0, 0, 0, 0 \n\
|
||||
\n\
|
||||
;; The maximum amount of delay allowed before turret AI will update its \n\
|
||||
;; aim. Applies for turrets vs small ships \n\
|
||||
$Turret Max Aim Update Delay: 0, 0, 0, 0, 0 \n\
|
||||
\n\
|
||||
;; General AI-related flags. These were previously all lumped together \n\
|
||||
;; under the New AI mission flag. \n\
|
||||
\n\
|
||||
@@ -964,11 +972,24 @@ $use only single fov for turrets: NO \n\
|
||||
\n\
|
||||
;; allow AI ships to dodge weapons vertically as well as horizontally \n\
|
||||
$allow vertical dodge: NO \n\
|
||||
\n""\
|
||||
;; a disam or disable goal will protect a ship globally and purge \n\
|
||||
;; standing attack orders globally. If set to NO, only the ship/wing \n\
|
||||
;; given the order to disarm or disable will be affected. \n\
|
||||
$disarm or disable cause global ai goal effects: YES \n\
|
||||
\n\
|
||||
;; Fixes a bug where AI class is not properly set if set in the mission \n\
|
||||
;; This should be YES if you want anything in AI.tbl to mean anything \n\
|
||||
$fix AI class bug: NO \n\
|
||||
\n\
|
||||
;; If set, the AI will NOT make extra effort to avoid ramming the player\n\
|
||||
;; during dogfights. This results in more aggressive AI. \n\
|
||||
$no extra collision avoidance vs player: NO \n\
|
||||
\n\
|
||||
;; If set, the game will check if the dying ship is a player's wingman, \n\
|
||||
;; before making it give a death scream \n\
|
||||
$perform less checks for death screams: NO \n\
|
||||
\n\
|
||||
#End \n\
|
||||
";
|
||||
|
||||
|
||||
@@ -123,5 +123,7 @@ extern int Num_medals;
|
||||
// from lighting.cpp
|
||||
#define MAX_LIGHTS 256
|
||||
|
||||
// from weapon.h (and beam.h)
|
||||
#define MAX_BEAM_SECTIONS 5
|
||||
|
||||
#endif // _GLOBALS_H
|
||||
@@ -180,6 +180,7 @@ void _cdecl WinAssert(char * text, char * filename, int linenum, const char * fo
|
||||
extern void LuaError(struct lua_State *L, char *format=NULL, ...);
|
||||
extern void _cdecl Error( const char * filename, int line, const char * format, ... );
|
||||
extern void _cdecl Warning( char * filename, int line, const char * format, ... );
|
||||
extern void _cdecl WarningEx( char *filename, int line, const char *format, ... );
|
||||
|
||||
extern int Global_warning_count;
|
||||
extern int Global_error_count;
|
||||
|
||||
@@ -1164,6 +1164,20 @@ void _cdecl Error( const char * filename, int line, const char * format, ... )
|
||||
Messagebox_active = false;
|
||||
}
|
||||
|
||||
void _cdecl WarningEx( char *filename, int line, const char *format, ... )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if (Cmdline_extra_warn) {
|
||||
char msg[sizeof(AssertText1)];
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsprintf(msg, format, args);
|
||||
va_end(args);
|
||||
Warning(filename, line, msg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void _cdecl Warning( char *filename, int line, const char *format, ... )
|
||||
{
|
||||
Global_warning_count++;
|
||||
|
||||
@@ -317,7 +317,7 @@ void generic_anim_render(generic_anim *ga, float frametime, int x, int y)
|
||||
if((ga->direction & GENERIC_ANIM_DIRECTION_PAUSED) == 0) {
|
||||
if(ga->direction & GENERIC_ANIM_DIRECTION_BACKWARDS) {
|
||||
//keep going forwards if we're in a keyframe loop
|
||||
if(ga->keyframe && (ga->anim_time > keytime)) {
|
||||
if(ga->keyframe && (ga->anim_time >= keytime)) {
|
||||
ga->anim_time += frametime;
|
||||
if(ga->anim_time >= ga->total_time) {
|
||||
ga->anim_time = keytime - 0.001f;
|
||||
@@ -327,11 +327,11 @@ void generic_anim_render(generic_anim *ga, float frametime, int x, int y)
|
||||
else {
|
||||
//playing backwards
|
||||
ga->anim_time -= frametime;
|
||||
if((ga->direction & GENERIC_ANIM_DIRECTION_NOLOOP) && ga->anim_time < 0.0) {
|
||||
if((ga->direction & GENERIC_ANIM_DIRECTION_NOLOOP) && ga->anim_time <= 0.0) {
|
||||
ga->anim_time = 0; //stop on first frame when playing in reverse
|
||||
}
|
||||
else {
|
||||
while(ga->anim_time < 0.0)
|
||||
while(ga->anim_time <= 0.0)
|
||||
ga->anim_time += ga->total_time; //make sure we're always positive, so we can go back to the end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -699,10 +699,6 @@ opengl::post_shader *shader_manager::apply_post_shader() {
|
||||
}
|
||||
|
||||
opengl::post_shader *shader_manager::apply_post_shader(int flags) {
|
||||
if ( !flags ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// check if shader is already loaded
|
||||
SCP_map<int, post_shader*>::iterator itr = post_shaders.find(flags);
|
||||
if (itr != post_shaders.end())
|
||||
|
||||
+19
-4
@@ -1200,7 +1200,7 @@ void hud_render_multi_ping()
|
||||
}
|
||||
|
||||
// if we're in multiplayer mode, display our ping time to the server
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_CLIENT && (Net_player != NULL)){
|
||||
char ping_str[50];
|
||||
memset(ping_str,0,50);
|
||||
|
||||
@@ -1788,7 +1788,10 @@ void hud_show_damage_popup()
|
||||
n_firstline++;
|
||||
gr_string(sx, sy, n_firstline);
|
||||
} else {
|
||||
gr_string(sx, sy, hud_targetbox_truncate_subsys_name(hud_subsys_list[best_index].name));
|
||||
char temp_name[NAME_LENGTH];
|
||||
strcpy(temp_name, hud_subsys_list[best_index].name);
|
||||
hud_targetbox_truncate_subsys_name(temp_name);
|
||||
gr_string(sx, sy, temp_name);
|
||||
}
|
||||
|
||||
sprintf(buf, XSTR( "%d%%", 219), best_str);
|
||||
@@ -2686,7 +2689,7 @@ void hud_add_objective_messsage(int type, int status)
|
||||
Objective_display.goal_status=status;
|
||||
|
||||
// if this is a multiplayer tvt game
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM) && (Net_player != NULL)){
|
||||
if(MULTI_TEAM && (Net_player != NULL)){
|
||||
mission_goal_fetch_num_resolved(type, &Objective_display.goal_nresolved, &Objective_display.goal_ntotal, Net_player->p_info.team);
|
||||
} else {
|
||||
mission_goal_fetch_num_resolved(type, &Objective_display.goal_nresolved, &Objective_display.goal_ntotal);
|
||||
@@ -2700,7 +2703,12 @@ void hud_maybe_display_subspace_notify()
|
||||
{
|
||||
int warp_aborted = 0;
|
||||
// maybe make gauge active
|
||||
if ( (Player->control_mode == PCM_WARPOUT_STAGE1) || (Player->control_mode == PCM_WARPOUT_STAGE2) || (Player->control_mode == PCM_WARPOUT_STAGE3) ) {
|
||||
if ( (Player->control_mode == PCM_WARPOUT_STAGE1)
|
||||
|| (Player->control_mode == PCM_WARPOUT_STAGE2)
|
||||
|| (Player->control_mode == PCM_WARPOUT_STAGE3)
|
||||
|| (Sexp_hud_display_warpout > 0)
|
||||
)
|
||||
{
|
||||
if (!hud_subspace_notify_active()) {
|
||||
// keep sound from being played 1e06 times
|
||||
hud_start_subspace_notify();
|
||||
@@ -2717,6 +2725,13 @@ void hud_maybe_display_subspace_notify()
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Sexp_hud_display_warpout > 1 ) {
|
||||
if ( Sexp_hud_display_warpout < timestamp()) {
|
||||
Sexp_hud_display_warpout = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Objective_display_gauge.first_frame < 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
+10
-10
@@ -199,7 +199,7 @@ int escort_compare_func(const void *e1, const void *e2)
|
||||
escort2 = (escort_info*) e2;
|
||||
|
||||
// multiplayer dogfight
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){
|
||||
if(MULTI_DOGFIGHT){
|
||||
int n1, n2;
|
||||
|
||||
n1 = find_player_id(escort1->np_id);
|
||||
@@ -246,7 +246,7 @@ void hud_create_complete_escort_list(escort_info *escorts, int *num_escorts)
|
||||
int idx;
|
||||
|
||||
// multiplayer dogfight
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){
|
||||
if(MULTI_DOGFIGHT){
|
||||
for(idx=0; idx<MAX_PLAYERS; idx++){
|
||||
// break out of the loop when we have reached our max
|
||||
if ( *num_escorts == MAX_COMPLETE_ESCORT_LIST ) {
|
||||
@@ -397,7 +397,7 @@ void merge_escort_lists(escort_info *complete_escorts, int num_complete_escorts)
|
||||
}
|
||||
|
||||
// copy for Escort_ships to complete_escorts to retain hit_info
|
||||
if(!((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT))) {
|
||||
if(!MULTI_DOGFIGHT) {
|
||||
for (i=0; i<top_complete_escorts; i++) {
|
||||
for (j=0; j<Num_escort_ships; j++) {
|
||||
if (Escort_ships[j].obj_signature == complete_escorts[i].obj_signature) {
|
||||
@@ -477,7 +477,7 @@ void hud_escort_cull_list()
|
||||
int np_index;
|
||||
|
||||
// multiplayer dogfight
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){
|
||||
if(MULTI_DOGFIGHT){
|
||||
for ( i = 0; i < Num_escort_ships; i++ ) {
|
||||
np_index = find_player_id(Escort_ships[i].np_id);
|
||||
|
||||
@@ -514,7 +514,7 @@ int hud_escort_set_gauge_color(int index, int team)
|
||||
shi = &Escort_ships[index].hit_info;
|
||||
|
||||
// multiplayer dogfight
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT))
|
||||
if(MULTI_DOGFIGHT)
|
||||
{
|
||||
hud_set_gauge_color(HUD_ESCORT_VIEW);
|
||||
return 0;
|
||||
@@ -614,7 +614,7 @@ void hud_escort_show_icon_dogfight(int x, int y, int index)
|
||||
// draw the shield icon and integrity for the escort ship
|
||||
void hud_escort_show_icon(int x, int y, int index)
|
||||
{
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT) && index <= 2)
|
||||
if(MULTI_DOGFIGHT && index <= 2)
|
||||
{
|
||||
hud_escort_show_icon_dogfight(x, y, index);
|
||||
return;
|
||||
@@ -739,7 +739,7 @@ void hud_display_escort()
|
||||
GR_AABITMAP(Escort_gauges[2].first_frame, Escort_coords[gr_screen.res][3][0], Escort_coords[gr_screen.res][Num_escort_ships][1]);
|
||||
|
||||
// multiplayer dogfight
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){
|
||||
if(MULTI_DOGFIGHT){
|
||||
// draw the escort ship data
|
||||
for ( i = 0; i < Num_escort_ships; i++ ) {
|
||||
// oops. only show top 3
|
||||
@@ -845,7 +845,7 @@ void hud_add_remove_ship_escort(int objnum, int supress_feedback)
|
||||
int in_escort, i;
|
||||
|
||||
// no ships on the escort list in multiplayer dogfight
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){
|
||||
if(MULTI_DOGFIGHT){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -882,7 +882,7 @@ void hud_remove_ship_from_escort(int objnum)
|
||||
int in_escort, i;
|
||||
|
||||
// no ships on the escort list in multiplayer dogfight
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){
|
||||
if(MULTI_DOGFIGHT){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -913,7 +913,7 @@ void hud_escort_ship_hit(object *objp, int quadrant)
|
||||
shield_hit_info *shi;
|
||||
|
||||
// no ships on the escort list in multiplayer dogfight
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){
|
||||
if(MULTI_DOGFIGHT){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ int hud_abort_lock()
|
||||
if ((Player_ship->team == target_team) && (!iff_x_attacks_y(Player_ship->team, target_team)))
|
||||
{
|
||||
// if we're in multiplayer dogfight, ignore this
|
||||
if(!((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT))) {
|
||||
if(!MULTI_DOGFIGHT) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,6 +391,7 @@ hud_info* parse_ship_start()
|
||||
|
||||
if(ship_index == -1)
|
||||
{
|
||||
WarningEx(LOCATION, "\"$Ship:\" name \"%s\" not found.", shipname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -491,6 +492,9 @@ void parse_custom_gauge()
|
||||
{
|
||||
stuff_string(buffer, F_NAME, NAME_LENGTH);
|
||||
cg->parent = hud_get_gauge(buffer);
|
||||
if (cg->parent == NULL) {
|
||||
WarningEx(LOCATION, "\"+Parent:\" HUD gauge \"%s\" not found!", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
Num_gauge_types++;
|
||||
|
||||
+14
-4
@@ -585,7 +585,12 @@ void hud_show_reticle_weapons()
|
||||
// threat exists, and draw flashing frames.
|
||||
void hud_show_lock_threat()
|
||||
{
|
||||
int frame_offset;
|
||||
int frame_offset, num_frames;
|
||||
|
||||
//Let's find out how many frames our ani has, and adjust accordingly
|
||||
num_frames = Reticle_gauges[RETICLE_LOCK_WARN].num_frames;
|
||||
//We need at least two frames here
|
||||
Assert( num_frames >= 2 );
|
||||
|
||||
if ( Player->threat_flags & (THREAT_LOCK | THREAT_ATTEMPT_LOCK) ) {
|
||||
if ( timestamp_elapsed(Threat_lock_timer) ) {
|
||||
@@ -595,7 +600,7 @@ void hud_show_lock_threat()
|
||||
Threat_lock_timer = timestamp(THREAT_LOCK_FLASH);
|
||||
}
|
||||
Threat_lock_frame++;
|
||||
if ( Threat_lock_frame > 2 ) {
|
||||
if ( Threat_lock_frame > (num_frames - 1) ) { //The first frame being the default "off" setting, we need to cycle through all the other frames
|
||||
Threat_lock_frame = 1;
|
||||
}
|
||||
if ( (Threat_lock_frame == 2) && (Player->threat_flags & THREAT_ATTEMPT_LOCK ) ) {
|
||||
@@ -633,13 +638,18 @@ void hud_show_lock_threat()
|
||||
// threat exists, and draw flashing frames.
|
||||
void hud_show_dumbfire_threat()
|
||||
{
|
||||
int frame_offset;
|
||||
int frame_offset, num_frames;
|
||||
|
||||
//Check how many frames the ani actually has
|
||||
num_frames = Reticle_gauges[RETICLE_LASER_WARN].num_frames;
|
||||
//We need at least two frames here
|
||||
Assert( num_frames >= 2 );
|
||||
|
||||
if ( Player->threat_flags & THREAT_DUMBFIRE ) {
|
||||
if ( timestamp_elapsed(Threat_dumbfire_timer) ) {
|
||||
Threat_dumbfire_timer = timestamp(THREAT_DUMBFIRE_FLASH);
|
||||
Threat_dumbfire_frame++;
|
||||
if ( Threat_dumbfire_frame > 2 ) {
|
||||
if ( Threat_dumbfire_frame > (num_frames - 1) ) { //The first frame being the default "off" setting, we need to cycle through all the other frames
|
||||
Threat_dumbfire_frame = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-12
@@ -1072,7 +1072,7 @@ void hud_squadmsg_send_to_all_fighters( int command, int player_num )
|
||||
}
|
||||
|
||||
// check for multiplayer mode
|
||||
if((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)) {
|
||||
if(MULTIPLAYER_CLIENT) {
|
||||
send_player_order_packet(SQUAD_MSG_ALL, 0, command);
|
||||
return;
|
||||
}
|
||||
@@ -1229,7 +1229,7 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
}
|
||||
|
||||
// check for multiplayer mode
|
||||
if((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if(MULTIPLAYER_CLIENT){
|
||||
send_player_order_packet(SQUAD_MSG_SHIP, shipnum, command);
|
||||
return 0;
|
||||
}
|
||||
@@ -1391,9 +1391,9 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
ai_submode = SM_ATTACK;
|
||||
// if no enemies present, use the affirmative, instead of engaging enemies message
|
||||
if ( hud_squadmsg_enemies_present() )
|
||||
message = MESSAGE_YESSIR;
|
||||
else
|
||||
message = MESSAGE_ENGAGE;
|
||||
else
|
||||
message = MESSAGE_YESSIR;
|
||||
target_shipname = NULL;
|
||||
break;
|
||||
|
||||
@@ -1405,7 +1405,7 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
|
||||
// the following are support ship options!!!
|
||||
case REARM_REPAIR_ME_ITEM:
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (player_num != -1) ){
|
||||
if( MULTIPLAYER_MASTER && (player_num != -1) ){
|
||||
hud_squadmsg_repair_rearm(0,&Objects[Net_players[player_num].m_player->objnum]);
|
||||
} else {
|
||||
hud_squadmsg_repair_rearm(0); // note we return right away. repair/rearm code handles messaging, etc
|
||||
@@ -1416,7 +1416,7 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message,
|
||||
return 0;
|
||||
|
||||
case ABORT_REARM_REPAIR_ITEM:
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (player_num != -1) ){
|
||||
if( MULTIPLAYER_MASTER && (player_num != -1) ){
|
||||
hud_squadmsg_repair_rearm_abort(0,&Objects[Net_players[player_num].m_player->objnum]);
|
||||
} else {
|
||||
hud_squadmsg_repair_rearm_abort(0); // note we return right away. repair/rearm code handles messaging, etc
|
||||
@@ -1511,7 +1511,7 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message,
|
||||
}
|
||||
|
||||
// check for multiplayer mode
|
||||
if((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if(MULTIPLAYER_CLIENT){
|
||||
send_player_order_packet(SQUAD_MSG_WING, wingnum,command);
|
||||
return 0;
|
||||
}
|
||||
@@ -1642,10 +1642,11 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message,
|
||||
case ENGAGE_ENEMY_ITEM:
|
||||
ai_mode = AI_GOAL_CHASE_ANY;
|
||||
ai_submode = SM_ATTACK;
|
||||
// if no enemies present, use the affirmative, instead of engaging enemies message
|
||||
if ( hud_squadmsg_enemies_present() )
|
||||
message = MESSAGE_YESSIR;
|
||||
else
|
||||
message = MESSAGE_ENGAGE;
|
||||
else
|
||||
message = MESSAGE_YESSIR;
|
||||
target_shipname = NULL;
|
||||
break;
|
||||
|
||||
@@ -2467,7 +2468,7 @@ int hud_squadmsg_do_frame( )
|
||||
hud_set_gauge_color(HUD_MESSAGE_BOX);
|
||||
|
||||
// check for multiplayer mode - this is really a special case checker for support ship requesting and aborting
|
||||
if((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) && (Squad_msg_mode == SM_MODE_REPAIR_REARM || Squad_msg_mode == SM_MODE_REPAIR_REARM_ABORT)){
|
||||
if(MULTIPLAYER_CLIENT && (Squad_msg_mode == SM_MODE_REPAIR_REARM || Squad_msg_mode == SM_MODE_REPAIR_REARM_ABORT)){
|
||||
char *subsys_name;
|
||||
// int who_to_sig;
|
||||
ushort net_sig;
|
||||
@@ -2527,7 +2528,7 @@ int hud_squadmsg_do_frame( )
|
||||
break;
|
||||
|
||||
case SM_MODE_REPAIR_REARM:
|
||||
//if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (addr != NULL)){
|
||||
//if( MULTIPLAYER_MASTER && (addr != NULL)){
|
||||
// hud_squadmsg_repair_rearm(1,&Objects[Net_players[player_num].player->objnum]);
|
||||
//} else {
|
||||
hud_squadmsg_repair_rearm(1); // note we return right away. repair/rearm code handles messaging, etc
|
||||
@@ -2535,7 +2536,7 @@ int hud_squadmsg_do_frame( )
|
||||
break;
|
||||
|
||||
case SM_MODE_REPAIR_REARM_ABORT:
|
||||
//if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (addr != NULL)){
|
||||
//if( MULTIPLAYER_MASTER && (addr != NULL)){
|
||||
// hud_squadmsg_repair_rearm_abort(1,&Objects[Net_players[player_num].player->objnum]);
|
||||
//} else {
|
||||
hud_squadmsg_repair_rearm_abort(1); // note we return right away. repair/rearm code handles messaging, etc
|
||||
|
||||
@@ -196,7 +196,7 @@ static int Last_ts; // holds last target status.
|
||||
void hud_blit_target_integrity(int disabled,int force_obj_num = -1);
|
||||
|
||||
// cut down long subsystem names to a more manageable length
|
||||
char *hud_targetbox_truncate_subsys_name(char *outstr)
|
||||
void hud_targetbox_truncate_subsys_name(char *outstr)
|
||||
{
|
||||
if(Lcl_gr){
|
||||
if ( strstr(outstr, "communication") ) {
|
||||
@@ -244,17 +244,15 @@ char *hud_targetbox_truncate_subsys_name(char *outstr)
|
||||
} else if ( strstr(outstr, "laser") || strstr(outstr, "turret") || strstr(outstr, "missile") ) {
|
||||
strcpy(outstr, "tourelle");
|
||||
}
|
||||
} else {
|
||||
if ( strstr(outstr, XSTR( "communication", 333))) {
|
||||
strcpy( outstr, XSTR( "comm", 334) );
|
||||
} else if ( strstr(outstr, XSTR( "navigation", 335))) {
|
||||
strcpy( outstr, XSTR( "nav", 336) );
|
||||
} else if (!stricmp(outstr, "Gas Collector")) {
|
||||
} else {
|
||||
if (strstr(outstr, XSTR("communication", 333))) {
|
||||
strcpy(outstr, XSTR("comm", 334));
|
||||
} else if (strstr(outstr, XSTR("navigation", 335))) {
|
||||
strcpy(outstr, XSTR("nav", 336));
|
||||
} else if (strstr(outstr, "gas collector")) {
|
||||
strcpy(outstr, "collector");
|
||||
}
|
||||
}
|
||||
|
||||
return outstr;
|
||||
}
|
||||
|
||||
//swich through the valid targetbox modes
|
||||
|
||||
@@ -72,7 +72,7 @@ void hud_render_target_weapon(object *target_objp);
|
||||
void hud_update_cargo_scan_sound();
|
||||
void hud_cargo_scan_update(object *targetp, float frametime);
|
||||
|
||||
char *hud_targetbox_truncate_subsys_name(char *outstr);
|
||||
void hud_targetbox_truncate_subsys_name(char *outstr);
|
||||
|
||||
//swich through the valid targetbox modes
|
||||
void hud_targetbox_switch_wireframe_mode();
|
||||
|
||||
@@ -331,6 +331,12 @@ int joy_ff_create_effects()
|
||||
void joy_ff_stop_effects()
|
||||
{
|
||||
joy_ff_afterburn_off();
|
||||
|
||||
if (pDeathroll1)
|
||||
pDeathroll1->Stop();
|
||||
|
||||
if (pDeathroll2)
|
||||
pDeathroll2->Stop();
|
||||
}
|
||||
|
||||
void joy_ff_mission_init(vec3d v)
|
||||
|
||||
+12
-12
@@ -1758,7 +1758,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
Assert(n >= 0);
|
||||
|
||||
// multiplayer clients should leave critical button bits alone and pass them to the server instead
|
||||
if ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)) {
|
||||
if (MULTIPLAYER_CLIENT) {
|
||||
// if this flag is set, we should apply the button itself (came from the server)
|
||||
if (!Multi_button_info_ok){
|
||||
return 0;
|
||||
@@ -1807,7 +1807,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
}
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) ) {
|
||||
if ( MULTIPLAYER_MASTER ) {
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,shipp);
|
||||
}
|
||||
@@ -1828,7 +1828,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
}
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) ) {
|
||||
if ( MULTIPLAYER_MASTER ) {
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,shipp);
|
||||
}
|
||||
@@ -1848,7 +1848,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
}
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_MASTER ){
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,shipp);
|
||||
}
|
||||
@@ -1885,7 +1885,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
}
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_MASTER ){
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,&Ships[objp->instance]);
|
||||
}
|
||||
@@ -1898,7 +1898,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
increase_recharge_rate(objp, WEAPONS);
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_MASTER ){
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,&Ships[objp->instance]);
|
||||
}
|
||||
@@ -1911,7 +1911,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
decrease_recharge_rate(objp, WEAPONS);
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_MASTER ){
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,&Ships[objp->instance]);
|
||||
}
|
||||
@@ -1924,7 +1924,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
increase_recharge_rate(objp, SHIELDS);
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_MASTER ){
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,&Ships[objp->instance]);
|
||||
}
|
||||
@@ -1937,7 +1937,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
decrease_recharge_rate(objp, SHIELDS);
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_MASTER ){
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,&Ships[objp->instance]);
|
||||
}
|
||||
@@ -1950,7 +1950,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
increase_recharge_rate(objp, ENGINES);
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_MASTER ){
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,&Ships[objp->instance]);
|
||||
}
|
||||
@@ -1963,7 +1963,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
decrease_recharge_rate(objp, ENGINES);
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_MASTER ){
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,&Ships[objp->instance]);
|
||||
}
|
||||
@@ -1979,7 +1979,7 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
snd_play( &Snds[SND_ENERGY_TRANS] );
|
||||
|
||||
// multiplayer server should maintain bank/link status here
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_MASTER ){
|
||||
Assert(npl != NULL);
|
||||
multi_server_update_player_weapons(npl,&Ships[objp->instance]);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#define LAB_FLAG_SHOW_DEBRIS (1<<2) // render debris instead of normal LOD
|
||||
#define LAB_FLAG_SUBMODEL_ROTATE (1<<3) // do rotation for any rotating ship subobjects
|
||||
#define LAB_FLAG_LIGHTNING_ARCS (1<<4) // show damage lightning
|
||||
#define LAB_FLAG_FULLY_LOAD (1<<5) // use create_ship() to test the ships
|
||||
|
||||
// modes
|
||||
#define LAB_MODE_NONE 0 // not showing anything
|
||||
@@ -1607,6 +1608,7 @@ void labviewer_make_render_options_window(Button *caller)
|
||||
// add all of the flags that we want/need...
|
||||
|
||||
// viewer flags
|
||||
ADD_RENDER_FLAG("Test Load Ships", Lab_viewer_flags, LAB_FLAG_FULLY_LOAD);
|
||||
ADD_RENDER_FLAG("Disable Model Rotation", Lab_viewer_flags, LAB_FLAG_NO_ROTATION);
|
||||
ADD_RENDER_FLAG("Show Insignia", Lab_viewer_flags, LAB_FLAG_SHOW_INSIGNIA);
|
||||
ADD_RENDER_FLAG("Show Damage Lightning", Lab_viewer_flags, LAB_FLAG_LIGHTNING_ARCS);
|
||||
@@ -1838,6 +1840,16 @@ void labviewer_change_ship_lod(Tree* caller)
|
||||
int ship_index = (int)(caller->GetSelectedItem()->GetParentItem()->GetData());
|
||||
Assert( ship_index >= 0 );
|
||||
|
||||
// Genghis - Attempt to create and then immediately delete the selected ship type.
|
||||
// This causes the full error-handling to kick-in, making the Lab viewer a more
|
||||
// useful tool for checking model errors.
|
||||
if (Lab_viewer_flags & LAB_FLAG_FULLY_LOAD)
|
||||
{
|
||||
The_mission.ai_profile = &Ai_profiles[Default_ai_profile];
|
||||
int test_idx = ship_create(&vmd_identity_matrix, &vmd_zero_vector, ship_index);
|
||||
obj_delete(test_idx);
|
||||
}
|
||||
|
||||
Lab_last_selected_ship = Lab_selected_index;
|
||||
|
||||
labviewer_change_model(Ship_info[ship_index].pof_file, caller->GetSelectedItem()->GetData(), ship_index);
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Created by Ian "Goober5000" Warfield for the FreeSpace2 Source Code Project.
|
||||
* You may not sell or otherwise commercially exploit the source or things you
|
||||
* create based on the source.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _BIT_ARRAY_H
|
||||
#define _BIT_ARRAY_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
|
||||
// the following four functions are adapted from http://www.codeproject.com/cpp/BitArray.asp; their explanation
|
||||
// is as follows:
|
||||
/*
|
||||
* The Bit Array structure provides a compacted arrays of Booleans, with one bit for each Boolean value.
|
||||
* A 0 (1) bit corresponds to the Boolean value false (true), respectively. We can look at a stream of bytes
|
||||
* as a stream of bits; each byte contains 8 bits, so any n bytes hold n*8 bits. And the operation to
|
||||
* manipulate this stream or bit array is so easy, just read or change the bit's state or make any Boolean
|
||||
* operation on the whole bits array, like ‘AND’, ‘OR’, or ‘XOR’.
|
||||
*
|
||||
* As each byte contains 8 bits, we need to divide the bit number by 8 to reach the byte that holds the bit.
|
||||
* Then, we can seek to the right bit in the reached byte by the remainder of dividing the bit number by 8.
|
||||
* So to read or change the bit state, the operations will be like that.
|
||||
*
|
||||
* Note that to divide by 8, we need only to shift right by 3 (>>3), and to get the remainder of dividing
|
||||
* by 8, we need only to AND with 7 (&7).
|
||||
*/
|
||||
|
||||
// returns bit state (0 or 1)
|
||||
#define get_bit(array, bitnum) ((((ubyte *) array)[(bitnum) >> 3] >> ((bitnum) & 7)) & 1)
|
||||
|
||||
// sets bit to 1
|
||||
#define set_bit(array, bitnum) (((ubyte *) array)[(bitnum) >> 3] |= (1 << ((bitnum) & 7)))
|
||||
|
||||
// clears bit to 0
|
||||
#define clear_bit(array, bitnum) (((ubyte *) array)[(bitnum) >> 3] &= ~(1 << ((bitnum) & 7)))
|
||||
|
||||
// toggles bit (xor)
|
||||
#define toggle_bit(array, bitnum) (((ubyte *) array)[(bitnum) >> 3] ^= (1 << ((bitnum) & 7)))
|
||||
|
||||
|
||||
// calculate number of bytes from number of bits
|
||||
#define calculate_num_bytes(num_bits) ((num_bits >> 3) + 1)
|
||||
|
||||
|
||||
#endif // _BIT_ARRAY_H
|
||||
@@ -1843,7 +1843,7 @@ void options_multi_vox_do()
|
||||
// attempt to get a playback handle
|
||||
handle = multi_voice_test_get_playback_buffer();
|
||||
if(handle != -1){
|
||||
Om_vox_playback_handle = rtvoice_play_uncompressed(handle, Om_vox_comp_buffer, Om_vox_voice_comp_size);
|
||||
Om_vox_playback_handle = rtvoice_play(handle, Om_vox_comp_buffer, Om_vox_voice_comp_size);
|
||||
|
||||
// mark us as playing back
|
||||
Om_vox_test_status = OM_VOX_TEST_PLAYBACK;
|
||||
@@ -1864,7 +1864,7 @@ void options_multi_vox_do()
|
||||
|
||||
case OM_VOX_TEST_PLAYBACK:
|
||||
// if we were playing a sound back, but now the sound is done
|
||||
if((Om_vox_playback_handle != -1) && (ds_get_play_position(ds_get_channel(Om_vox_playback_handle)) >= (DWORD)Om_vox_voice_comp_size)){
|
||||
if ( (Om_vox_playback_handle != -1) && !ds_is_channel_playing(ds_get_channel(Om_vox_playback_handle)) ) {
|
||||
// flush all playing sounds safely
|
||||
rtvoice_stop_playback_all();
|
||||
|
||||
@@ -2319,27 +2319,24 @@ void options_multi_unselect()
|
||||
}
|
||||
|
||||
// set voice sound buffer for display
|
||||
void options_multi_set_voice_data(unsigned char *sound_buf,int buf_size,unsigned char *comp_buf, int comp_size, int uncomp_size, double gain)
|
||||
void options_multi_set_voice_data(unsigned char *sound_buf, int buf_size, double gain)
|
||||
{
|
||||
// copy the buffer to the vox tab data
|
||||
if(buf_size > OM_VOX_BUF_SIZE){
|
||||
memcpy(Om_vox_voice_buffer,sound_buf,OM_VOX_BUF_SIZE);
|
||||
Om_vox_voice_buffer_size = OM_VOX_BUF_SIZE;
|
||||
} else {
|
||||
memcpy(Om_vox_voice_buffer,sound_buf,buf_size);
|
||||
Om_vox_voice_buffer_size = buf_size;
|
||||
if ( (sound_buf == NULL) || (buf_size <= 0) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// copy the buffer to the vox tab data
|
||||
Om_vox_voice_buffer_size = MIN(buf_size, OM_VOX_BUF_SIZE);
|
||||
memcpy(Om_vox_voice_buffer, sound_buf, Om_vox_voice_buffer_size);
|
||||
|
||||
// copy and uncompress the compressed buffer
|
||||
if(Om_vox_voice_comp_size == -1){
|
||||
Om_vox_voice_comp_size = 0;
|
||||
}
|
||||
// if we can fit it, decompress this data
|
||||
if((Om_vox_voice_comp_size + uncomp_size) < OM_VOX_COMP_SIZE){
|
||||
// uncompress the data
|
||||
rtvoice_uncompress(comp_buf, comp_size, gain, Om_vox_comp_buffer + Om_vox_voice_comp_size, uncomp_size);
|
||||
|
||||
Om_vox_voice_comp_size += uncomp_size;
|
||||
if ( (Om_vox_voice_comp_size + buf_size) < OM_VOX_COMP_SIZE ) {
|
||||
memcpy(Om_vox_comp_buffer + Om_vox_voice_comp_size, sound_buf, buf_size);
|
||||
Om_vox_voice_comp_size += buf_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void options_multi_unselect();
|
||||
int options_multi_background_bitmap();
|
||||
|
||||
// set voice sound buffer for display
|
||||
void options_multi_set_voice_data(unsigned char *sound_buf,int buf_size,unsigned char *comp_buf, int comp_size, int uncomp_size, double gain);
|
||||
void options_multi_set_voice_data(unsigned char *sound_buf, int buf_size, double gain);
|
||||
|
||||
// process and blit any voice waveform if necessary
|
||||
void options_multi_vox_process_waveform();
|
||||
|
||||
@@ -250,8 +250,6 @@ static int Palette_bmp;
|
||||
//static int ShipWin02;
|
||||
//static int ShipWin03;
|
||||
//static int ShipWin04;
|
||||
//static ubyte Palette[768];
|
||||
//static char Palette_name[128]; // not used now - taylor
|
||||
|
||||
static int Ships_loaded = 0;
|
||||
static int Weapons_loaded = 0;
|
||||
|
||||
@@ -172,7 +172,6 @@ static int Brief_stage_highlight_sound_handle = -1;
|
||||
// used for scrolling briefing text ( if necessary )
|
||||
int Num_brief_text_lines[MAX_TEXT_STREAMS];
|
||||
int Top_brief_text_line;
|
||||
static char Brief_text[MAX_BRIEF_LINES][MAX_BRIEF_LINE_LEN];
|
||||
|
||||
// Used to support drawing colored text for the briefing. Gets complicates since we
|
||||
// need to be able to draw one character at a time as well when the briefing text
|
||||
|
||||
@@ -188,7 +188,7 @@ void mission_log_add_entry(int type, char *pname, char *sname, int info_index)
|
||||
|
||||
// multiplayer clients don't use this function to add log entries -- they will get
|
||||
// all their info from the host
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ){
|
||||
if ( MULTIPLAYER_CLIENT ){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ void mission_log_add_entry(int type, char *pname, char *sname, int info_index)
|
||||
entry->timestamp = Missiontime;
|
||||
|
||||
// if in multiplayer and I am the master, send this log entry to everyone
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) ){
|
||||
if ( MULTIPLAYER_MASTER ){
|
||||
send_mission_log_packet( last_entry );
|
||||
}
|
||||
|
||||
|
||||
@@ -264,12 +264,16 @@ void persona_parse()
|
||||
}
|
||||
}
|
||||
|
||||
if ( i == MAX_PERSONA_TYPES )
|
||||
WarningEx(LOCATION, "Unknown persona type in messages.tbl -- %s\n", type );
|
||||
|
||||
char cstrtemp[NAME_LENGTH];
|
||||
if ( optional_string("+") )
|
||||
{
|
||||
int j;
|
||||
stuff_string(cstrtemp, F_NAME, NAME_LENGTH);
|
||||
|
||||
for (int j = 0; j < (int)Species_info.size(); j++)
|
||||
for (j = 0; j < (int)Species_info.size(); j++)
|
||||
{
|
||||
if (!strcmp(cstrtemp, Species_info[j].species_name))
|
||||
{
|
||||
@@ -277,12 +281,11 @@ void persona_parse()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( j == (int)Species_info.size() )
|
||||
WarningEx(LOCATION, "Unknown species in messages.tbl -- %s\n", cstrtemp );
|
||||
}
|
||||
|
||||
if ( i == MAX_PERSONA_TYPES )
|
||||
Error(LOCATION, "Unknown persona type in messages.tbl -- %s\n", type );
|
||||
|
||||
|
||||
Num_personas++;
|
||||
}
|
||||
|
||||
@@ -349,8 +352,8 @@ void message_parse(bool importing_from_fsm)
|
||||
mt = -1;
|
||||
}
|
||||
|
||||
// only bother with filters if multiplayer and TvT
|
||||
if(Fred_running || ((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)) ){
|
||||
// only bother with filters in-game if multiplayer and TvT
|
||||
if(Fred_running || (MULTI_TEAM) ){
|
||||
msg.multi_team = mt;
|
||||
}
|
||||
}
|
||||
@@ -367,6 +370,9 @@ void message_parse(bool importing_from_fsm)
|
||||
if ( optional_string("+Persona:") ) {
|
||||
stuff_string(persona_name, F_NAME, NAME_LENGTH);
|
||||
msg.persona_index = message_persona_name_lookup( persona_name );
|
||||
|
||||
if ( msg.persona_index == -1 )
|
||||
WarningEx(LOCATION, "Unknown persona in message %s in messages.tbl -- %s\n", msg.name, persona_name );
|
||||
}
|
||||
|
||||
if ( !Fred_running)
|
||||
|
||||
@@ -69,6 +69,8 @@
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "popup/popup.h"
|
||||
#include "popup/popupdead.h"
|
||||
#include "sound/sound.h"
|
||||
#include "sound/ds.h"
|
||||
|
||||
LOCAL struct {
|
||||
char docker[NAME_LENGTH];
|
||||
@@ -711,6 +713,8 @@ void parse_mission_info(mission *pm, bool basic = false)
|
||||
|
||||
if (index >= 0)
|
||||
The_mission.ai_profile = &Ai_profiles[index];
|
||||
else
|
||||
WarningEx(LOCATION, "Mission: %s\nUnknown AI profile %s!", pm->name, temp );
|
||||
}
|
||||
|
||||
Assert( The_mission.ai_profile != NULL );
|
||||
@@ -718,6 +722,32 @@ void parse_mission_info(mission *pm, bool basic = false)
|
||||
// Kazan - player use AI at start?
|
||||
if (pm->flags & MISSION_FLAG_PLAYER_START_AI)
|
||||
Player_use_ai = 1;
|
||||
|
||||
pm->sound_environment.id = -1;
|
||||
if (optional_string("$Sound Environment:")) {
|
||||
char preset[65] = { '\0' };
|
||||
stuff_string(preset, F_NAME, sizeof(preset)-1);
|
||||
|
||||
int preset_id = ds_eax_get_preset_id(preset);
|
||||
|
||||
if (preset_id >= 0) {
|
||||
sound_env_get(&pm->sound_environment, preset_id);
|
||||
}
|
||||
|
||||
// NOTE: values will be clamped properly when the effect is actually set
|
||||
|
||||
if (optional_string("+Volume:")) {
|
||||
stuff_float(&pm->sound_environment.volume);
|
||||
}
|
||||
|
||||
if (optional_string("+Damping:")) {
|
||||
stuff_float(&pm->sound_environment.damping);
|
||||
}
|
||||
|
||||
if (optional_string("+Decay Time:")) {
|
||||
stuff_float(&pm->sound_environment.decay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void parse_player_info(mission *pm)
|
||||
@@ -787,7 +817,7 @@ void parse_player_info2(mission *pm)
|
||||
for (i=0; i<total; i += 4) {
|
||||
// in a campaign, see if the player is allowed the ships or not. Remove them from the
|
||||
// pool if they are not allowed
|
||||
if (Game_mode & GM_CAMPAIGN_MODE || ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER))) {
|
||||
if (Game_mode & GM_CAMPAIGN_MODE || (MULTIPLAYER_CLIENT)) {
|
||||
if ( !Campaign.ships_allowed[list[i]] )
|
||||
continue;
|
||||
}
|
||||
@@ -806,9 +836,12 @@ void parse_player_info2(mission *pm)
|
||||
if (optional_string("+Default_ship:")) {
|
||||
stuff_string(str, F_NAME, NAME_LENGTH);
|
||||
ptr->default_ship = ship_info_lookup(str);
|
||||
if (-1 == ptr->default_ship) {
|
||||
WarningEx(LOCATION, "Mission: %s\nUnknown default ship %s! Defaulting to %s.", pm->name, str, Ship_info[ptr->ship_list[0]].name );
|
||||
}
|
||||
// see if the player's default ship is an allowable ship (campaign only). If not, then what
|
||||
// do we do? choose the first allowable one?
|
||||
if (Game_mode & GM_CAMPAIGN_MODE || ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER))) {
|
||||
if (Game_mode & GM_CAMPAIGN_MODE || (MULTIPLAYER_CLIENT)) {
|
||||
if ( !(Campaign.ships_allowed[ptr->default_ship]) ) {
|
||||
for (i = 0; i < MAX_SHIP_CLASSES; i++ ) {
|
||||
if ( Campaign.ships_allowed[ptr->default_ship] ) {
|
||||
@@ -834,7 +867,7 @@ void parse_player_info2(mission *pm)
|
||||
for (i = 0; i < total; i += 4) {
|
||||
// in a campaign, see if the player is allowed the weapons or not. Remove them from the
|
||||
// pool if they are not allowed
|
||||
if (Game_mode & GM_CAMPAIGN_MODE || ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER))) {
|
||||
if (Game_mode & GM_CAMPAIGN_MODE || (MULTIPLAYER_CLIENT)) {
|
||||
if ( !Campaign.weapons_allowed[list2[i]] ) {
|
||||
continue;
|
||||
}
|
||||
@@ -1782,7 +1815,7 @@ int parse_create_object_sub(p_object *p_objp)
|
||||
shipp->respawn_priority = p_objp->respawn_priority;
|
||||
|
||||
// if this is a multiplayer dogfight game, and its from a player wing, make it team traitor
|
||||
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT) && (p_objp->wingnum >= 0))
|
||||
if (MULTI_DOGFIGHT && (p_objp->wingnum >= 0))
|
||||
{
|
||||
for (i = 0; i < MAX_STARTING_WINGS; i++)
|
||||
{
|
||||
@@ -2497,7 +2530,7 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
|
||||
}
|
||||
|
||||
// if this is a multiplayer dogfight mission, skip support ships
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT) && (Ship_info[p_objp->ship_class].flags & SIF_SUPPORT))
|
||||
if(MULTI_DOGFIGHT && (Ship_info[p_objp->ship_class].flags & SIF_SUPPORT))
|
||||
return 0;
|
||||
|
||||
// optional alternate name type
|
||||
@@ -2509,9 +2542,8 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
|
||||
|
||||
// try and find the alternate name
|
||||
p_objp->alt_type_index = (char)mission_parse_lookup_alt(name);
|
||||
Assert(p_objp->alt_type_index >= 0);
|
||||
if(p_objp->alt_type_index < 0)
|
||||
mprintf(("Error looking up alternate ship type name!\n"));
|
||||
WarningEx(LOCATION, "Mission %s\nError looking up alternate ship type name %s!\n", pm->name, name);
|
||||
else
|
||||
mprintf(("Using alternate ship type name: %s\n", name));
|
||||
}
|
||||
@@ -2525,9 +2557,8 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
|
||||
|
||||
// try and find the callsign
|
||||
p_objp->callsign_index = (char)mission_parse_lookup_callsign(name);
|
||||
Assert(p_objp->callsign_index >= 0);
|
||||
if(p_objp->callsign_index < 0)
|
||||
mprintf(("Error looking up callsign!\n"));
|
||||
WarningEx(LOCATION, "Mission %s\nError looking up callsign %s!\n", pm->name, name);
|
||||
else
|
||||
mprintf(("Using callsign: %s\n", name));
|
||||
}
|
||||
@@ -3162,6 +3193,9 @@ void parse_common_object_data(p_object *objp)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Genghis: used later for subsystem checking
|
||||
ship_info* sip = &Ship_info[objp->ship_class];
|
||||
|
||||
// set some defaults..
|
||||
objp->initial_velocity = 0;
|
||||
objp->initial_hull = 100;
|
||||
@@ -3185,6 +3219,17 @@ void parse_common_object_data(p_object *objp)
|
||||
objp->subsys_count++;
|
||||
stuff_string(Subsys_status[i].name, F_NAME, NAME_LENGTH);
|
||||
|
||||
// Genghis: check that the subsystem name makes sense for this ship type
|
||||
if (stricmp("Pilot", Subsys_status[i].name))
|
||||
{
|
||||
int j;
|
||||
for (j=0; j < sip->n_subsystems; ++j)
|
||||
if (!stricmp(sip->subsystems[j].subobj_name, Subsys_status[i].name))
|
||||
break;
|
||||
if (j == sip->n_subsystems)
|
||||
Warning(LOCATION, "Ship \"%s\", class \"%s\"\nUnknown subsystem \"%s\" found in mission!", objp->name, sip->name, Subsys_status[i].name);
|
||||
}
|
||||
|
||||
if (optional_string("$Damage:"))
|
||||
stuff_float(&Subsys_status[i].percent);
|
||||
|
||||
@@ -3193,9 +3238,15 @@ void parse_common_object_data(p_object *objp)
|
||||
char cargo_name[NAME_LENGTH];
|
||||
stuff_string(cargo_name, F_NAME, NAME_LENGTH);
|
||||
int index = string_lookup(cargo_name, Cargo_names, Num_cargo, "cargo", 0);
|
||||
if (index == -1 && (Num_cargo < MAX_CARGO)) {
|
||||
index = Num_cargo;
|
||||
strcpy(Cargo_names[Num_cargo++], cargo_name);
|
||||
if (index == -1) {
|
||||
if (Num_cargo < MAX_CARGO) {
|
||||
index = Num_cargo;
|
||||
strcpy(Cargo_names[Num_cargo++], cargo_name);
|
||||
}
|
||||
else {
|
||||
WarningEx(LOCATION, "Maximum number of cargo names (%d) exceeded, defaulting to Nothing!", MAX_CARGO);
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
Subsys_status[i].subsys_cargo_name = index;
|
||||
}
|
||||
@@ -3801,7 +3852,7 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, int force, int spec
|
||||
}
|
||||
|
||||
// flag ship with SF_FROM_PLAYER_WING if a member of player starting wings
|
||||
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM))
|
||||
if (MULTI_TEAM)
|
||||
{
|
||||
// different for tvt -- Goober5000
|
||||
for (j = 0; j < MAX_TVT_WINGS; j++)
|
||||
@@ -4887,6 +4938,9 @@ void parse_bitmaps(mission *pm)
|
||||
}
|
||||
}
|
||||
|
||||
if (z == NUM_NEBULAS)
|
||||
WarningEx(LOCATION, "Mission %s\nUnknown nebula %s!", pm->name, str);
|
||||
|
||||
if (optional_string("+Color:")) {
|
||||
stuff_string(str, F_NAME, MAX_FILENAME_LEN);
|
||||
for (z=0; z<NUM_NEBULA_COLORS; z++){
|
||||
@@ -4897,6 +4951,9 @@ void parse_bitmaps(mission *pm)
|
||||
}
|
||||
}
|
||||
|
||||
if (z == NUM_NEBULA_COLORS)
|
||||
WarningEx(LOCATION, "Mission %s\nUnknown nebula color %s!", pm->name, str);
|
||||
|
||||
if (optional_string("+Pitch:")){
|
||||
stuff_int(&Nebula_pitch);
|
||||
} else {
|
||||
@@ -5283,7 +5340,7 @@ void post_process_mission()
|
||||
}
|
||||
|
||||
// when TVT, hack starting wings to be team wings
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
|
||||
if(MULTI_TEAM){
|
||||
Assert(MAX_TVT_WINGS <= MAX_STARTING_WINGS);
|
||||
for (i=0; i<MAX_STARTING_WINGS; i++)
|
||||
{
|
||||
@@ -6354,7 +6411,7 @@ void mission_eval_arrivals()
|
||||
// before checking arrivals, check to see if we should play a message concerning arrivals
|
||||
// of other wings. We use the timestamps to delay the arrival message slightly for
|
||||
// better effect
|
||||
if (timestamp_valid(Arrival_message_delay_timestamp) && timestamp_elapsed(Arrival_message_delay_timestamp) && !((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)))
|
||||
if (timestamp_valid(Arrival_message_delay_timestamp) && timestamp_elapsed(Arrival_message_delay_timestamp) && !MULTI_TEAM)
|
||||
{
|
||||
int rship, use_terran_cmd;
|
||||
|
||||
@@ -6462,7 +6519,7 @@ void mission_eval_arrivals()
|
||||
continue;
|
||||
|
||||
// multiplayer team vs. team
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM))
|
||||
if(MULTI_TEAM)
|
||||
{
|
||||
// send a hostile wing arrived message
|
||||
rship = wingp->ship_index[wingp->special_ship];
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "model/model.h"
|
||||
#include "object/object.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "sound/sound.h"
|
||||
|
||||
//WMC - This should be here
|
||||
#define FS_MISSION_FILE_EXT NOX(".fs2")
|
||||
@@ -146,6 +147,7 @@ typedef struct mission {
|
||||
int skybox_flags;
|
||||
int contrail_threshold;
|
||||
int ambient_light_level;
|
||||
sound_env sound_environment;
|
||||
|
||||
// Goober5000
|
||||
int command_persona;
|
||||
@@ -187,6 +189,7 @@ typedef struct mission {
|
||||
skybox_flags = 0;
|
||||
contrail_threshold = 0;
|
||||
ambient_light_level = 0;
|
||||
sound_environment.id = -1;
|
||||
command_persona = 0;
|
||||
command_sender[ 0 ] = '\0';
|
||||
event_music_name[ 0 ] = '\0';
|
||||
|
||||
@@ -211,7 +211,7 @@ void training_obj_display()
|
||||
}
|
||||
|
||||
// if this is a multiplayer tvt game, and this is event is not for my team, don't display it
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM) && (Net_player != NULL)){
|
||||
if(MULTI_TEAM && (Net_player != NULL)){
|
||||
if((Mission_events[z].team != -1) && (Net_player->p_info.team != Mission_events[z].team)){
|
||||
continue;
|
||||
}
|
||||
@@ -373,7 +373,7 @@ void sort_training_objectives()
|
||||
event_status = mission_get_event_status(TRAINING_OBJ_LINES_MASK(i));
|
||||
|
||||
// if this is a multiplayer tvt game, and this is event is for another team, don't touch it
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM) && (Net_player != NULL)){
|
||||
if(MULTI_TEAM && (Net_player != NULL)){
|
||||
if((Mission_events[TRAINING_OBJ_LINES_MASK(i)].team != -1) && (Net_player->p_info.team != Mission_events[TRAINING_OBJ_LINES_MASK(i)].team)){
|
||||
continue ;
|
||||
}
|
||||
@@ -409,7 +409,7 @@ void sort_training_objectives()
|
||||
event_status = mission_get_event_status(TRAINING_OBJ_LINES_MASK(i));
|
||||
|
||||
// if this is a multiplayer tvt game, and this is event is for another team, it can be bumped
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM) && (Net_player != NULL)){
|
||||
if(MULTI_TEAM && (Net_player != NULL)){
|
||||
if((Mission_events[TRAINING_OBJ_LINES_MASK(i)].team != -1) && (Net_player->p_info.team != Mission_events[TRAINING_OBJ_LINES_MASK(i)].team)){
|
||||
Training_obj_lines[i] |= TRAINING_OBJ_STATUS_KNOWN;
|
||||
continue ;
|
||||
@@ -785,6 +785,8 @@ void message_training_setup(int m, int length, char *special_message)
|
||||
training_process_message(Training_buf);
|
||||
Training_num_lines = split_str(Training_buf, TRAINING_LINE_WIDTH, Training_line_sizes, Training_lines, MAX_TRAINING_MESSAGE_LINES);
|
||||
|
||||
Assert( Training_num_lines >= 0 );
|
||||
|
||||
if (message_play_training_voice(Messages[m].wave_info.index) < 0) {
|
||||
if (length > 0)
|
||||
Training_message_timestamp = timestamp(length * 1000);
|
||||
@@ -853,20 +855,25 @@ void message_training_queue(char *text, int timestamp, int length)
|
||||
|
||||
// Goober5000 - removes current message from the queue
|
||||
void message_training_remove_from_queue(int idx)
|
||||
{
|
||||
Training_message_queue[idx].length = -1;
|
||||
Training_message_queue[idx].num = -1;
|
||||
Training_message_queue[idx].timestamp = -1;
|
||||
|
||||
{
|
||||
// we're overwriting all messages with the next message, but to
|
||||
// avoid memory leaks, we should free the special message entry
|
||||
if (Training_message_queue[idx].special_message != NULL)
|
||||
{
|
||||
vm_free(Training_message_queue[idx].special_message);
|
||||
Training_message_queue[idx].special_message = NULL;
|
||||
}
|
||||
|
||||
// replace current message with the one above it, etc.
|
||||
for (int j=idx+1; j<Training_message_queue_count; j++)
|
||||
Training_message_queue[j - 1] = Training_message_queue[j];
|
||||
|
||||
// delete the topmost message
|
||||
Training_message_queue_count--;
|
||||
Training_message_queue[Training_message_queue_count].length = -1;
|
||||
Training_message_queue[Training_message_queue_count].num = -1;
|
||||
Training_message_queue[Training_message_queue_count].timestamp = -1;
|
||||
Training_message_queue[Training_message_queue_count].special_message = NULL; // not a memory leak because we copied the pointer
|
||||
}
|
||||
|
||||
// check the training message queue to see if we should play a new message yet or not.
|
||||
@@ -917,20 +924,18 @@ void message_training_display()
|
||||
return;
|
||||
}
|
||||
|
||||
// next two lines moved to message_training_setup() - taylor
|
||||
// training_process_message(Training_buf);
|
||||
// Training_num_lines = split_str(Training_buf, TRAINING_LINE_WIDTH, Training_line_sizes, Training_lines, MAX_TRAINING_MESSAGE_LINES);
|
||||
|
||||
Assert(Training_num_lines > 0);
|
||||
for (i=0; i<Training_num_lines; i++) {
|
||||
Training_lines[i][Training_line_sizes[i]] = 0;
|
||||
drop_leading_white_space(Training_lines[i]);
|
||||
}
|
||||
// the code that preps the training message and counts the number of lines
|
||||
// has been moved to message_training_setup()
|
||||
|
||||
if (Training_num_lines <= 0){
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0; i<Training_num_lines; i++) {
|
||||
Training_lines[i][Training_line_sizes[i]] = 0;
|
||||
drop_leading_white_space(Training_lines[i]);
|
||||
}
|
||||
|
||||
height = gr_get_font_height();
|
||||
gr_set_shader(&Training_msg_glass);
|
||||
gr_shade(Training_message_window_coords[gr_screen.res][0], Training_message_window_coords[gr_screen.res][1], TRAINING_MESSAGE_WINDOW_WIDTH, Training_num_lines * height + height);
|
||||
|
||||
@@ -55,10 +55,10 @@ int Fiction_viewer_text_coordinates[NUM_FVW_SETTINGS][GR_NUM_RESOLUTIONS][4] =
|
||||
// standard FS2-style interface
|
||||
{
|
||||
{ // GR_640
|
||||
37, 37, 547, 375
|
||||
17, 37, 588, 344
|
||||
},
|
||||
{ // GR_1024
|
||||
60, 60, 875, 599
|
||||
25, 48, 944, 576
|
||||
}
|
||||
},
|
||||
// WCS-style interface
|
||||
@@ -85,14 +85,15 @@ ui_button_info Fiction_viewer_buttons[NUM_FVW_SETTINGS][GR_NUM_RESOLUTIONS][NUM_
|
||||
// standard FS2-style interface
|
||||
{
|
||||
{ // GR_640
|
||||
ui_button_info("fvw_accept_", 570, 424, 69, 55, FVW_BUTTON_ACCEPT),
|
||||
ui_button_info("fvw_up_", 591, 49, 26, 35, FVW_BUTTON_SCROLL_UP),
|
||||
ui_button_info("fvw_down_", 591, 362, 26, 35, FVW_BUTTON_SCROLL_DOWN),
|
||||
ui_button_info("fvw_accept_", 571, 425, 69, 55, FVW_BUTTON_ACCEPT),
|
||||
ui_button_info("fvw_up_", 614, 14, 25, 31, FVW_BUTTON_SCROLL_UP),
|
||||
ui_button_info("fvw_down_", 614, 370, 25, 31, FVW_BUTTON_SCROLL_DOWN),
|
||||
// Filename x y width height
|
||||
},
|
||||
{ // GR_1024
|
||||
ui_button_info("2_fvw_accept_", 913, 680, 110, 87, FVW_BUTTON_ACCEPT),
|
||||
ui_button_info("2_fvw_up_", 945, 79, 42, 56, FVW_BUTTON_SCROLL_UP),
|
||||
ui_button_info("2_fvw_down_", 945, 580, 42, 56, FVW_BUTTON_SCROLL_DOWN),
|
||||
ui_button_info("2_fvw_accept_", 918, 688, 99, 77, FVW_BUTTON_ACCEPT),
|
||||
ui_button_info("2_fvw_up_", 981, 16, 40, 50, FVW_BUTTON_SCROLL_UP),
|
||||
ui_button_info("2_fvw_down_", 981, 606, 40, 50, FVW_BUTTON_SCROLL_DOWN),
|
||||
}
|
||||
},
|
||||
// WCS-style interface
|
||||
@@ -129,10 +130,10 @@ int Fiction_viewer_slider_coordinates[NUM_FVW_SETTINGS][GR_NUM_RESOLUTIONS][4] =
|
||||
// standard FS2-style interface
|
||||
{
|
||||
{ // GR_640
|
||||
594, 84, 18, 280
|
||||
618, 48, 18, 320 //Initial position x, initial position y, width, height of the slider column
|
||||
},
|
||||
{ // GR_1024
|
||||
951, 135, 28, 446
|
||||
988, 70, 28, 532
|
||||
}
|
||||
},
|
||||
// WCS-style interface
|
||||
@@ -402,7 +403,7 @@ void fiction_viewer_do_frame(float frametime)
|
||||
{
|
||||
// can be scrolled down
|
||||
int more_txt_x = Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][0] + (Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][2]/2) - 10;
|
||||
int more_txt_y = Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][1] + Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][3] - 2; // located below text, centered
|
||||
int more_txt_y = Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][1] + Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][3]; // located below text, centered
|
||||
|
||||
gr_get_string_size(&w, &h, XSTR("more", 1469), strlen(XSTR("more", 1469)));
|
||||
gr_set_color_fast(&Color_black);
|
||||
|
||||
@@ -877,7 +877,7 @@ void brief_init()
|
||||
}
|
||||
|
||||
// get a pointer to the appropriate briefing structure
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
|
||||
if(MULTI_TEAM){
|
||||
Briefing = &Briefings[Net_player->p_info.team];
|
||||
} else {
|
||||
Briefing = &Briefings[0];
|
||||
@@ -1302,8 +1302,7 @@ int brief_setup_closeup(brief_icon *bi)
|
||||
end_string_at_first_hash_symbol(Closeup_icon->closeup_label);
|
||||
|
||||
// Goober5000 - wcsaga doesn't want this
|
||||
if (!Cmdline_wcsaga && sip->flags & (SIF_SMALL_SHIP|SIF_BIG_SHIP|SIF_HUGE_SHIP|SIF_SENTRYGUN))
|
||||
{
|
||||
if (Ship_types[sip->class_type].hud_bools & STI_HUD_NO_CLASS_DISPLAY ) {
|
||||
strcat_s(Closeup_icon->closeup_label, XSTR( " class", 434));
|
||||
}
|
||||
|
||||
|
||||
@@ -195,13 +195,9 @@ static generic_anim Cur_Anim;
|
||||
static char *Cur_anim_filename = "~~~~";
|
||||
static int anim_done = 0;
|
||||
|
||||
static int Last_anim_frame_num;
|
||||
|
||||
static int Cmd_brief_last_voice;
|
||||
static int Cmd_brief_paused = 0;
|
||||
//static int Palette_bmp = -1;
|
||||
static ubyte Palette[768];
|
||||
//static char Palette_name[128];
|
||||
|
||||
static int Uses_scroll_buttons = 0;
|
||||
|
||||
|
||||
@@ -713,7 +713,7 @@ void debrief_set_multi_clients( int stage_count, int active_stages[] )
|
||||
int i;
|
||||
|
||||
// set up the right briefing for this guy
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
|
||||
if(MULTI_TEAM){
|
||||
Debriefing = &Debriefings[Net_player->p_info.team];
|
||||
} else {
|
||||
Debriefing = &Debriefings[0];
|
||||
@@ -2002,7 +2002,7 @@ void debrief_init()
|
||||
Campaign.loop_mission = CAMPAIGN_LOOP_MISSION_UNINITIALIZED;
|
||||
|
||||
// set up the right briefing for this guy
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
|
||||
if(MULTI_TEAM){
|
||||
Debriefing = &Debriefings[Net_player->p_info.team];
|
||||
} else {
|
||||
Debriefing = &Debriefings[0];
|
||||
@@ -2634,15 +2634,6 @@ void debrief_do_frame(float frametime)
|
||||
|
||||
gr_flip();
|
||||
|
||||
// don't let dude skip 3-09. hack.
|
||||
if(Game_mode & GM_CAMPAIGN_MODE){
|
||||
if((Campaign.current_mission >= 0) && (Campaign.current_mission < MAX_CAMPAIGN_MISSIONS)){
|
||||
if ((Campaign.missions[Campaign.current_mission].name != NULL) && !stricmp(Campaign.missions[Campaign.current_mission].name, "sm3-09.fs2")) {
|
||||
Debrief_skip_popup_already_shown = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// maybe show skip mission popup
|
||||
if ( Must_replay_mission && (!Debrief_skip_popup_already_shown) && (Player->show_skip_popup) && (Game_mode & GM_NORMAL) && (Game_mode & GM_CAMPAIGN_MODE) && (Player->failures_this_session >= PLAYER_MISSION_FAILURE_LIMIT) && !(Game_mode & GM_MULTIPLAYER)) {
|
||||
int popup_choice = popup(0, 3, XSTR("Do Not Skip This Mission", 1473),
|
||||
|
||||
@@ -1481,7 +1481,7 @@ void ship_select_do(float frametime)
|
||||
//////////////////////////////////
|
||||
// Render and draw the 3D model //
|
||||
//////////////////////////////////
|
||||
if( Cmdline_ship_choice_3d || ((Ss_icons != NULL) && (Selected_ss_class >= 0) && (Ss_icons[Selected_ss_class].ss_anim.num_frames > 0)) )
|
||||
if( Cmdline_ship_choice_3d || ( (Selected_ss_class >= 0) && (Ss_icons[Selected_ss_class].ss_anim.num_frames == 0)) )
|
||||
{
|
||||
// check we have a valid ship class selected
|
||||
if ( (Selected_ss_class >= 0) && (ShipSelectModelNum >= 0) )
|
||||
@@ -1713,6 +1713,12 @@ void start_ship_animation(int ship_class, int play_sound)
|
||||
return;
|
||||
}
|
||||
|
||||
//Unload Anim if one was playing
|
||||
if(Ship_anim_class > 0 && Ss_icons[Ship_anim_class].ss_anim.num_frames > 0) {
|
||||
generic_anim_unload(&Ss_icons[Ship_anim_class].ss_anim);
|
||||
Ship_anim_class = -1;
|
||||
}
|
||||
|
||||
// Load the necessary model file
|
||||
ShipSelectModelNum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
|
||||
@@ -1733,6 +1739,12 @@ void start_ship_animation(int ship_class, int play_sound)
|
||||
|
||||
ss_icon = &Ss_icons[ship_class];
|
||||
|
||||
//If there was a model loaded for the previous ship, unload it
|
||||
if (ShipSelectModelNum >= 0 ) {
|
||||
model_unload(ShipSelectModelNum);
|
||||
ShipSelectModelNum = -1;
|
||||
}
|
||||
|
||||
//unload the previous anim
|
||||
if(Ship_anim_class > 0 && Ss_icons[Ship_anim_class].ss_anim.num_frames > 0)
|
||||
generic_anim_unload(&Ss_icons[Ship_anim_class].ss_anim);
|
||||
@@ -1764,7 +1776,6 @@ void start_ship_animation(int ship_class, int play_sound)
|
||||
// if ( play_sound ) {
|
||||
gamesnd_play_iface(SND_SHIP_ICON_CHANGE);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
void ss_unload_all_anims()
|
||||
@@ -3008,7 +3019,7 @@ void ship_select_init_team_data(int team_num)
|
||||
// determine how many wings we should be checking for
|
||||
Wss_num_wings = 0;
|
||||
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
|
||||
if(MULTI_TEAM){
|
||||
// now setup wings for easy reference
|
||||
ss_init_wing_info(0,team_num);
|
||||
} else {
|
||||
@@ -3034,7 +3045,7 @@ void ship_select_common_init()
|
||||
// initialize team critical data for all teams
|
||||
int idx;
|
||||
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
|
||||
if(MULTI_TEAM){
|
||||
// initialize for all teams in the game
|
||||
for(idx=0;idx<MULTI_TS_MAX_TVT_TEAMS;idx++){
|
||||
ship_select_init_team_data(idx);
|
||||
|
||||
@@ -1076,7 +1076,7 @@ int eval_weapon_flag_for_game_type(int weapon_flags)
|
||||
int rval = 0;
|
||||
|
||||
#if !defined FS2_DEMO
|
||||
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)) {
|
||||
if (MULTI_DOGFIGHT) {
|
||||
if (weapon_flags & DOGFIGHT_WEAPON)
|
||||
rval = 1;
|
||||
}
|
||||
@@ -1946,7 +1946,7 @@ void weapon_select_common_init()
|
||||
{
|
||||
int idx;
|
||||
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
|
||||
if(MULTI_TEAM){
|
||||
// initialize for all teams
|
||||
for(idx=0;idx<MULTI_TS_MAX_TVT_TEAMS;idx++){
|
||||
weapon_select_init_team(idx);
|
||||
@@ -3979,7 +3979,7 @@ int wl_drop(int from_bank,int from_list,int to_bank,int to_list, int ship_slot,
|
||||
|
||||
common_flash_button_init();
|
||||
if ( !(Game_mode & GM_MULTIPLAYER) || MULTIPLAYER_HOST ) {
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
|
||||
if(MULTI_TEAM){
|
||||
// set the global pointers to the right pools
|
||||
common_set_team_pointers(pl->p_info.team);
|
||||
}
|
||||
@@ -3989,7 +3989,7 @@ int wl_drop(int from_bank,int from_list,int to_bank,int to_list, int ship_slot,
|
||||
update = wl_apply(mode, from_bank, from_list, to_bank, to_list, ship_slot, player_index, dont_play_sound);
|
||||
}
|
||||
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)){
|
||||
if(MULTI_TEAM){
|
||||
// set the global pointers to the right pools
|
||||
common_set_team_pointers(Net_player->p_info.team);
|
||||
}
|
||||
|
||||
@@ -315,6 +315,7 @@ typedef struct bsp_info {
|
||||
bool nocollide_this_only; //SUSHI: Like no_collisions, but not recursive. For the "replacement" collision model scheme.
|
||||
bool collide_invisible; //SUSHI: If set, this submodel should allow collisions for invisible textures. For the "replacement" collision model scheme.
|
||||
bool force_turret_normal; //Wanderer: Sets the turret uvec to override any input of for turret normal.
|
||||
char lod_name[MAX_NAME_LEN]; //FUBAR: Name to be used for LOD naming comparison to preserve compatibility with older tables. Only used on LOD0
|
||||
|
||||
float dumb_turn_rate;
|
||||
|
||||
@@ -350,6 +351,7 @@ typedef struct bsp_info {
|
||||
dumb_turn_rate = 0.f;
|
||||
bsp_data = NULL;
|
||||
rad = 0.f;
|
||||
lod_name[ 0 ] = '\0';
|
||||
|
||||
/* Compound types */
|
||||
memset( live_debris, 0, sizeof( live_debris ) );
|
||||
|
||||
@@ -100,7 +100,7 @@ void triggered_rotation::start(queued_animation *q)
|
||||
if (q->accel.a1d[axis] == 0.0f)
|
||||
slow_angle.a1d[axis] = end_angle.a1d[axis];
|
||||
else
|
||||
slow_angle.a1d[axis] = end_angle.a1d[axis] - (((q->vel.a1d[axis] * q->vel.a1d[axis]) / (2.0f * q->accel.a1d[axis])) * direction.a1d[axis]);
|
||||
slow_angle.a1d[axis] = end_angle.a1d[axis] + (((q->vel.a1d[axis] * q->vel.a1d[axis]) / (2.0f * q->accel.a1d[axis])) * direction.a1d[axis]);
|
||||
}
|
||||
|
||||
nprintf(("ModelAnim", "Dir=[%f, %f, %f], End=[%f, %f, %f], Vel=[%f, %f, %f], Accel=[%f, %f, %f], Slow=[%f, %f, %f]\n", direction.a1d[0], direction.a1d[1], direction.a1d[2],
|
||||
@@ -421,7 +421,7 @@ void model_anim_submodel_trigger_rotate(model_subsystem *psub, ship_subsys *ss)
|
||||
}
|
||||
|
||||
// if we've over shot the angle, this shouldn't happen but it might if odd values are given
|
||||
if ( (trigger->current_ang.a1d[i] * trigger->direction.a1d[i]) > (trigger->end_angle.a1d[i] * trigger->direction.a1d[i]) ) {
|
||||
if ( (trigger->current_ang.a1d[i] * trigger->direction.a1d[i]) >= (trigger->end_angle.a1d[i] * trigger->direction.a1d[i]) ) {
|
||||
trigger->current_ang.a1d[i] = trigger->end_angle.a1d[i];
|
||||
trigger->current_vel.a1d[i] = 0.0f;
|
||||
not_moving_count++;
|
||||
@@ -654,6 +654,7 @@ int model_anim_get_time_type(ship_subsys *pss, int animation_type, int subtype)
|
||||
int pad = real_time - psub->triggers[i].end;
|
||||
|
||||
for (int a = 0; a < 3; a++) {
|
||||
/*
|
||||
float direction = pss->trigger.direction.a1d[a];
|
||||
|
||||
// if it's in the final slowdown phase then it really isn't _that_ bad
|
||||
@@ -687,8 +688,29 @@ int model_anim_get_time_type(ship_subsys *pss, int animation_type, int subtype)
|
||||
ani_time = a_time;
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Wanderer Way -- START
|
||||
// end_angle = S(2)
|
||||
triggered_rotation tr = pss->trigger;
|
||||
float end_angle = (tr.current_ang.a1d[a] + (((tr.rot_vel.a1d[a]*tr.rot_vel.a1d[a]) - (tr.current_vel.a1d[a]*tr.current_vel.a1d[a])) / (2*tr.rot_accel.a1d[a])));
|
||||
|
||||
if (end_angle > tr.slow_angle.a1d[a]) {
|
||||
//T(total) = (2V(maximum) - V(initial))/a + (S(turnpoint) - S(initial) + (V(initial)^2 - V(maximum)^2)/2a) / V(maximum)
|
||||
a_time = fl2i(((((2*tr.rot_vel.a1d[a]) - tr.current_ang.a1d[a])/tr.rot_accel.a1d[a]) + tr.slow_angle.a1d[a] - tr.current_ang.a1d[a] + (((tr.current_vel.a1d[a]*tr.current_vel.a1d[a]) - (tr.rot_vel.a1d[a]*tr.rot_vel.a1d[a])) / (2*tr.rot_accel.a1d[a])))*1000.0f);
|
||||
if (ani_time < a_time)
|
||||
ani_time = a_time;
|
||||
} else {
|
||||
//T(total) = 2 * sqrt((S(final) - S(initial))/a - ( (V(initial)/a)^2 ) / 2 ) - V(initial)/a
|
||||
a_time = fl2i((2 * fl_sqrt(((tr.end_angle.a1d[a] - tr.current_ang.a1d[a])/tr.rot_accel.a1d[a]) - ((tr.current_vel.a1d[a] * tr.current_vel.a1d[a]) / (tr.rot_accel.a1d[a] * tr.rot_accel.a1d[a])) / 2) - (tr.current_vel.a1d[a] / tr.rot_accel.a1d[a]))*1000.0f);
|
||||
if (ani_time < a_time)
|
||||
ani_time = a_time;
|
||||
}
|
||||
|
||||
// Wanderer Way -- END
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (ani_time)
|
||||
ani_time += pad;
|
||||
} else {
|
||||
|
||||
@@ -1335,6 +1335,9 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
|
||||
else
|
||||
pm->submodel[n].gun_rotation = false;
|
||||
|
||||
if ( (p = strstr(props, "$lod0_name")) != NULL)
|
||||
get_user_prop_value(p+10, pm->submodel[n].lod_name);
|
||||
|
||||
if ( (p = strstr(props, "$detail_box:")) != NULL ) {
|
||||
p += 12;
|
||||
while (*p == ' ') p++;
|
||||
@@ -1502,6 +1505,13 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
|
||||
else
|
||||
pm->submodel[n].is_thruster=0;
|
||||
|
||||
// Genghis: if we have a thruster and none of the collision
|
||||
// properties were provided, then set "nocollide_this_only".
|
||||
if (pm->submodel[n].is_thruster && !(pm->submodel[n].no_collisions) && !(pm->submodel[n].nocollide_this_only) && !(pm->submodel[n].collide_invisible) )
|
||||
{
|
||||
pm->submodel[n].nocollide_this_only = true;
|
||||
}
|
||||
|
||||
if ( strstr( pm->submodel[n].name, "-destroyed") )
|
||||
pm->submodel[n].is_damaged=1;
|
||||
else
|
||||
@@ -2483,7 +2493,14 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, in
|
||||
}
|
||||
|
||||
sm1->num_details = 0;
|
||||
l1 = strlen(sm1->name);
|
||||
// If a backward compatibility LOD name is declared use it
|
||||
if (strlen(sm1->lod_name) != 0) {
|
||||
l1=strlen(sm1->lod_name);
|
||||
}
|
||||
// otherwise use the name for LOD comparision
|
||||
else {
|
||||
l1 = strlen(sm1->name);
|
||||
}
|
||||
|
||||
for (j=0; j<pm->num_debris_objects;j++ ) {
|
||||
if ( i == pm->debris_objects[j] ) {
|
||||
@@ -2508,19 +2525,36 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, in
|
||||
}
|
||||
|
||||
// if sm2 is a detail of sm1 and sm1 is a high detail, then add it to sm1's list
|
||||
if ((int)strlen(sm2->name)!=l1) continue;
|
||||
if ((int)strlen(sm2->name)!=l1) continue;
|
||||
|
||||
int ndiff = 0;
|
||||
int first_diff = 0;
|
||||
for ( k=0; k<l1; k++) {
|
||||
if (sm1->name[k] != sm2->name[k] ) {
|
||||
if (ndiff==0) first_diff = k;
|
||||
ndiff++;
|
||||
// If a backward compatibility LOD name is declared use it
|
||||
if (strlen(sm1->lod_name) != 0) {
|
||||
if (sm1->lod_name[k] != sm2->name[k] ) {
|
||||
if (ndiff==0) first_diff = k;
|
||||
ndiff++;
|
||||
}
|
||||
}
|
||||
// otherwise do the standard LOD comparision
|
||||
else {
|
||||
if (sm1->name[k] != sm2->name[k] ) {
|
||||
if (ndiff==0) first_diff = k;
|
||||
ndiff++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ndiff==1) { // They only differ by one character!
|
||||
int dl1, dl2;
|
||||
dl1 = tolower(sm1->name[first_diff]) - 'a';
|
||||
// If a backward compatibility LOD name is declared use it
|
||||
if (strlen(sm1->lod_name) != 0) {
|
||||
dl1 = tolower(sm1->lod_name[first_diff]) - 'a';
|
||||
}
|
||||
// otherwise do the standard LOD comparision
|
||||
else {
|
||||
dl1 = tolower(sm1->name[first_diff]) - 'a';
|
||||
}
|
||||
dl2 = tolower(sm2->name[first_diff]) - 'a';
|
||||
|
||||
if ( (dl1<0) || (dl2<0) || (dl1>=MAX_MODEL_DETAIL_LEVELS) || (dl2>=MAX_MODEL_DETAIL_LEVELS) ) continue; // invalid detail levels
|
||||
@@ -2529,7 +2563,7 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, in
|
||||
dl2--; // Start from 1 up...
|
||||
if (dl2 >= sm1->num_details ) sm1->num_details = dl2+1;
|
||||
sm1->details[dl2] = j;
|
||||
//mprintf(( "Submodel '%s' is detail level %d of '%s'\n", sm2->name, dl2, sm1->name ));
|
||||
mprintf(( "Submodel '%s' is detail level %d of '%s'\n", sm2->name, dl2 + 1, sm1->name ));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2784,11 +2818,13 @@ float submodel_get_radius( int modelnum, int submodelnum )
|
||||
|
||||
polymodel * model_get(int model_num)
|
||||
{
|
||||
Assert( model_num > -1 );
|
||||
Assert( model_num >= 0 );
|
||||
if ( model_num < 0 )
|
||||
return NULL;
|
||||
|
||||
int num = model_num % MAX_POLYGON_MODELS;
|
||||
|
||||
Assert( num > -1 );
|
||||
Assert( num >= 0 );
|
||||
Assert( num < MAX_POLYGON_MODELS );
|
||||
Assert( Polygon_models[num] );
|
||||
Assert( Polygon_models[num]->id == model_num );
|
||||
|
||||
@@ -279,6 +279,9 @@ void neb2_init()
|
||||
if(Neb2_bitmap_count < MAX_NEB2_BITMAPS){
|
||||
strcpy_s(Neb2_bitmap_filenames[Neb2_bitmap_count++], name);
|
||||
}
|
||||
else {
|
||||
WarningEx(LOCATION, "nebula.tbl\nExceeded maximum number of nebulas (%d)!\nSkipping %s.", MAX_NEB2_BITMAPS, name);
|
||||
}
|
||||
}
|
||||
|
||||
// poofs
|
||||
@@ -291,6 +294,9 @@ void neb2_init()
|
||||
if(Neb2_poof_count < MAX_NEB2_POOFS){
|
||||
strcpy_s(Neb2_poof_filenames[Neb2_poof_count++], name);
|
||||
}
|
||||
else {
|
||||
WarningEx(LOCATION, "nebula.tbl\nExceeded maximum number of nebula poofs (%d)!\nSkipping %s.", MAX_NEB2_POOFS, name);
|
||||
}
|
||||
}
|
||||
|
||||
//Distance
|
||||
|
||||
+37
-36
@@ -99,7 +99,7 @@ struct player;
|
||||
#define IPX_PORT_LENGTH 2 // length of the port field for an IPX address
|
||||
|
||||
// netgame defines
|
||||
#define RESPAWN_ANARCHY (0xffffffff)// respawn setting for an "anarchy" style game
|
||||
// #define RESPAWN_ANARCHY (0xffffffff)// respawn setting for an "anarchy" style game
|
||||
#define MP_SINGLE 0 // not playing a campaign - single mission
|
||||
#define MP_CAMPAIGN 1 // playing a campaign
|
||||
|
||||
@@ -290,15 +290,15 @@ extern int Om_tracker_flag;
|
||||
|
||||
// join request denial codes
|
||||
#define JOIN_DENY_JR_STATE 0 // join request is rejected because the game is not in the proper state
|
||||
#define JOIN_DENY_JR_TRACKER_INVAL 1 // join request is rejected because the game is an MT game and the passed player info is invalid
|
||||
#define JOIN_DENY_JR_PASSWD 2 // join request is rejected because the game is password protected and the password sent is incorrect
|
||||
#define JOIN_DENY_JR_CLOSED 3 // join request is rejected because the game is closed and is currently ingame
|
||||
#define JOIN_DENY_JR_RANK_HIGH 4 // join request is rejected because the game is rank based and the passed rank is too high
|
||||
#define JOIN_DENY_JR_TRACKER_INVAL 1 // join request is rejected because the game is an MT game and the passed player info is invalid
|
||||
#define JOIN_DENY_JR_PASSWD 2 // join request is rejected because the game is password protected and the password sent is incorrect
|
||||
#define JOIN_DENY_JR_CLOSED 3 // join request is rejected because the game is closed and is currently ingame
|
||||
#define JOIN_DENY_JR_RANK_HIGH 4 // join request is rejected because the game is rank based and the passed rank is too high
|
||||
#define JOIN_DENY_JR_RANK_LOW 5 // join request is rejected because the game is rank based and the passed rank is too low
|
||||
#define JOIN_DENY_JR_DUP 6 // join request is denied because there is an exiting netplayer with matching characteristics
|
||||
#define JOIN_DENY_JR_FULL 7 // join request is denied because the game is full
|
||||
#define JOIN_DENY_JR_TEMP_CLOSED 8 // join request is denied because the _forming_ netgame has been toggled closed
|
||||
#define JOIN_DENY_JR_BANNED 9 // join request is denied because the player has been banned for the duration of the game
|
||||
#define JOIN_DENY_JR_BANNED 9 // join request is denied because the player has been banned for the duration of the game
|
||||
#define JOIN_DENY_JR_NOOBS 10 // join request is denied because observers are not allowed
|
||||
#define JOIN_DENY_JR_INGAME_JOIN 11 // join request is denied because someone else is already ingame joining
|
||||
#define JOIN_DENY_JR_BAD_VERSION 12 // incompatible version types
|
||||
@@ -313,7 +313,7 @@ extern int Om_tracker_flag;
|
||||
#define REPAIR_INFO_ABORT 0x5 // server to client - client has aborted a rearm/repair
|
||||
#define REPAIR_INFO_BROKEN 0x6 // server to client - client is breaking repair -- might be reestablished
|
||||
#define REPAIR_INFO_WARP_ADD 0x7 // server to client - add client onto list of people for arriving support ship
|
||||
#define REPAIR_INFO_WARP_REMOVE 0x8 // server to client - remove client from list of people for arriving support ship
|
||||
#define REPAIR_INFO_WARP_REMOVE 0x8 // server to client - remove client from list of people for arriving support ship
|
||||
#define REPAIR_INFO_ONWAY 0x9 // server to client - repair ship on way
|
||||
#define REPAIR_INFO_KILLED 0xa // server to client - repair ship was killed on way to rearm player
|
||||
#define REPAIR_INFO_COMPLETE 0xb // server to client - repair of your ship is complete
|
||||
@@ -322,7 +322,7 @@ extern int Om_tracker_flag;
|
||||
#define DEBRIS_UPDATE_UPDATE 0x1 // update a piece
|
||||
#define DEBRIS_UPDATE_REMOVE 0x2 // remove a piece of debris
|
||||
#define DEBRIS_UPDATE_NUKE 0x3 // blow up a piece of debris
|
||||
#define DEBRIS_UPDATE_CREATE_HULL 0x4 // create a piece of debris
|
||||
#define DEBRIS_UPDATE_CREATE_HULL 0x4 // create a piece of debris
|
||||
|
||||
// weapon select/ship select update packets
|
||||
#define WSS_WEAPON_SELECT 0x1 // ship select stuff
|
||||
@@ -336,7 +336,7 @@ extern int Om_tracker_flag;
|
||||
|
||||
// accept player data codes
|
||||
#define APD_NEXT 0 // there is still more player data
|
||||
#define APD_END_PACKET 1 // end of this packet
|
||||
#define APD_END_PACKET 1 // end of this packet
|
||||
#define APD_END_DATA 2 // end of the data
|
||||
|
||||
// ingame ship request codes
|
||||
@@ -357,18 +357,18 @@ extern int Om_tracker_flag;
|
||||
// asteroid stuff
|
||||
#define ASTEROID_CREATE 0x1 // create an asteroid
|
||||
#define ASTEROID_THROW 0x2 // throw an asteroid
|
||||
#define ASTEROID_HIT 0x3 // asteroid hit occured
|
||||
#define ASTEROID_HIT 0x3 // asteroid hit occured
|
||||
|
||||
// commands for squadmate messages
|
||||
#define SQUAD_MSG_SHIP 0x1
|
||||
#define SQUAD_MSG_WING 0x2
|
||||
#define SQUAD_MSG_ALL 0x3
|
||||
#define SQUAD_MSG_REINFORCEMENT 0x4
|
||||
#define SQUAD_MSG_REINFORCEMENT 0x4
|
||||
|
||||
// SW_STD_QUERY codes
|
||||
#define SW_STD_START 0x1 // from host to standalone saying "query the tracker"
|
||||
#define SW_STD_OK 0x2 // from standalone to host - "everything is cool"
|
||||
#define SW_STD_BAD 0x3 // from standalone to host - "everything is bad"
|
||||
#define SW_STD_BAD 0x3 // from standalone to host - "everything is bad"
|
||||
|
||||
// stats block packet
|
||||
#define STATS_MISSION 0 // all stats for the mission (except kills), for one player
|
||||
@@ -578,6 +578,7 @@ typedef struct server_item {
|
||||
#define JOIN_FLAG_AS_OBSERVER (1<<0) // wants to join as an aboserver
|
||||
#define JOIN_FLAG_HAS_CD (1<<1) // currently has a CD in the drive
|
||||
#define JOIN_FLAG_HAXOR (1<<2) // if the player has hacked data
|
||||
|
||||
typedef struct join_request {
|
||||
char passwd[MAX_PASSWD_LEN+1]; // password for a password protected game
|
||||
char callsign[CALLSIGN_LEN+1]; // player's callsign
|
||||
@@ -613,33 +614,33 @@ typedef struct network_buffer {
|
||||
#define NETINFO_FLAG_MT_FAILED (1<<3) // all attempts to connect have failed
|
||||
#define NETINFO_FLAG_MT_STARTUP (1<<4) // the initial state (ie, we haven't tried anything yet)
|
||||
#define NETINFO_FLAG_GAME_HOST (1<<5) // I'm the host
|
||||
#define NETINFO_FLAG_INGAME_JOIN (1<<6) // means he is still in the process of joining ingame
|
||||
#define NETINFO_FLAG_OBSERVER (1<<7) // means he's an observer
|
||||
#define NETINFO_FLAG_INGAME_JOIN (1<<6) // means he is still in the process of joining ingame
|
||||
#define NETINFO_FLAG_OBSERVER (1<<7) // means he's an observer
|
||||
#define NETINFO_FLAG_OBS_PLAYER (1<<8) // means he's an observer, but he was formerly a player (should show his stats)
|
||||
#define NETINFO_FLAG_LIMBO (1<<9) // (client side) means he has to choose whether to be an observer or quit (no more respawns)
|
||||
#define NETINFO_FLAG_LIMBO (1<<9) // (client side) means he has to choose whether to be an observer or quit (no more respawns)
|
||||
#define NETINFO_FLAG_MISSION_OK (1<<10) // this client's mission has been verified
|
||||
#define NETINFO_FLAG_RESPAWNING (1<<11) // so that we wait on a keypress, or other user input before respawning
|
||||
#define NETINFO_FLAG_DO_NETWORKING (1<<12) // set when we can send/receive data
|
||||
#define NETINFO_FLAG_TEAM_LOCKED (1<<13) // if this is set, only the host can modify the team settings for this player
|
||||
#define NETINFO_FLAG_TEAM_LOCKED (1<<13) // if this is set, only the host can modify the team settings for this player
|
||||
#define NETINFO_FLAG_TEAM_CAPTAIN (1<<14) // this player is the captain of his team
|
||||
#define NETINFO_FLAG_KICKED (1<<15) // this player was kicked
|
||||
#define NETINFO_FLAG_ACCEPT_INGAME (1<<16) // accepted ingame
|
||||
#define NETINFO_FLAG_ACCEPT_HOST (1<<17) // accetped as host
|
||||
#define NETINFO_FLAG_ACCEPT_HOST (1<<17) // accetped as host
|
||||
#define NETINFO_FLAG_ACCEPT_OBSERVER (1<<18) // accepted as observer
|
||||
#define NETINFO_FLAG_ACCEPT_CLIENT (1<<19) // accepted as client
|
||||
#define NETINFO_FLAG_WARPING_OUT (1<<20) // clients keep track of this for themselves to know if they should be leaving
|
||||
#define NETINFO_FLAG_WARPING_OUT (1<<20) // clients keep track of this for themselves to know if they should be leaving
|
||||
#define NETINFO_FLAG_HAS_CD (1<<21) // the player has a CD in the drive
|
||||
#define NETINFO_FLAG_RELIABLE_CONNECTED (1<<22) // reliable socket is now active
|
||||
#define NETINFO_FLAG_RELIABLE_CONNECTED (1<<22) // reliable socket is now active
|
||||
#define NETINFO_FLAG_MT_GET_FAILED (1<<23) // set during MT stats update process indicating we didn't properly get his stats
|
||||
#define NETINFO_FLAG_MT_SEND_FAILED (1<<24) // set during MT stats update process indicating we didn't properly send his stats
|
||||
#define NETINFO_FLAG_MT_DONE (1<<25) // set when a player has been processed for stats (fail, succeed, or otherwise)
|
||||
#define NETINFO_FLAG_HAXOR (1<<26) // the player has some form of hacked client data
|
||||
#define NETINFO_FLAG_MT_DONE (1<<25) // set when a player has been processed for stats (fail, succeed, or otherwise)
|
||||
#define NETINFO_FLAG_HAXOR (1<<26) // the player has some form of hacked client data
|
||||
|
||||
#define NETPLAYER_IS_OBSERVER(player) (player->flags & (NETINFO_FLAG_OBSERVER|NETINFO_FLAG_OBS_PLAYER))
|
||||
#define NETPLAYER_IS_DEAD(player) (player->flags & (NETINFO_FLAG_LIMBO|NETINFO_FLAG_RESPAWNING))
|
||||
|
||||
// netgame modes
|
||||
#define NG_MODE_OPEN 1 // an open game
|
||||
#define NG_MODE_OPEN 1 // an open game
|
||||
#define NG_MODE_CLOSED 2 // a closed game
|
||||
#define NG_MODE_PASSWORD 3 // a password protected game
|
||||
#define NG_MODE_RESTRICTED 4 // a restricted game
|
||||
@@ -650,16 +651,16 @@ typedef struct network_buffer {
|
||||
#define NG_FLAG_TEMP_CLOSED (1<<0) // a forming netgame is temporarily closed (should not be checked otherwise)
|
||||
#define NG_FLAG_SERVER_LOST (1<<1) // client has temporarily lost contact with the server
|
||||
#define NG_FLAG_INGAME_JOINING (1<<2) // someone is ingame joining.
|
||||
#define NG_FLAG_INGAME_JOINING_CRITICAL (1<<3) // someone is ingame joining and at the critical point where we cannot do certain things.
|
||||
#define NG_FLAG_INGAME_JOINING_CRITICAL (1<<3) // someone is ingame joining and at the critical point where we cannot do certain things.
|
||||
#define NG_FLAG_STORED_MT_STATS (1<<4) // stored tracker stats in the debriefing already
|
||||
#define NG_FLAG_HACKED_SHIPS_TBL (1<<5) // set when the server is playing with a hacked ships.tbl (only needed to notify hosts playing on a standalone)
|
||||
#define NG_FLAG_HACKED_SHIPS_TBL (1<<5) // set when the server is playing with a hacked ships.tbl (only needed to notify hosts playing on a standalone)
|
||||
#define NG_FLAG_HACKED_WEAPONS_TBL (1<<6) // set when the server is playing with a hacked weapons.tbl (only needed to notify hosts playing on a standalone)
|
||||
|
||||
// netgame type flags
|
||||
#define NG_TYPE_COOP (1<<0) // cooperative mode
|
||||
#define NG_TYPE_COOP (1<<0) // cooperative mode
|
||||
#define NG_TYPE_TVT (1<<1) // team vs. team mode
|
||||
#define NG_TYPE_SW (1<<2) // squad war
|
||||
#define NG_TYPE_TEAM ( NG_TYPE_TVT | NG_TYPE_SW )
|
||||
#define NG_TYPE_TEAM ( NG_TYPE_TVT | NG_TYPE_SW )
|
||||
#define NG_TYPE_DOGFIGHT (1<<3) // plain old dogfight mode
|
||||
|
||||
// some quick macros for the above
|
||||
@@ -674,32 +675,32 @@ typedef struct network_buffer {
|
||||
|
||||
// state defines for netgame states
|
||||
#define NETGAME_STATE_FORMING 1 // players are joining, host is selecting missions, etc
|
||||
#define NETGAME_STATE_BRIEFING 2 // players are reading the mission briefing
|
||||
#define NETGAME_STATE_BRIEFING 2 // players are reading the mission briefing
|
||||
#define NETGAME_STATE_IN_MISSION 3 // the mission itself is being played
|
||||
#define NETGAME_STATE_SERVER_TRANSFER 4 // server status is being transferred from one computer to another
|
||||
#define NETGAME_STATE_SERVER_TRANSFER 4 // server status is being transferred from one computer to another
|
||||
#define NETGAME_STATE_PAUSED 5 // the netgame is paused
|
||||
#define NETGAME_STATE_DEBRIEF 6 // the debriefing screen
|
||||
#define NETGAME_STATE_MISSION_SYNC 7 // client/server data sync screens before and after the briefing stage
|
||||
#define NETGAME_STATE_MISSION_SYNC 7 // client/server data sync screens before and after the briefing stage
|
||||
#define NETGAME_STATE_ENDGAME 8 // game is moving from gameplay to the debriefing state
|
||||
#define NETGAME_STATE_STD_HOST_SETUP 9 // the host is on the setup netgame screen for the standalone server
|
||||
#define NETGAME_STATE_STD_HOST_SETUP 9 // the host is on the setup netgame screen for the standalone server
|
||||
#define NETGAME_STATE_HOST_SETUP 10 // the host is on the setup netgame screen _non_ standalone
|
||||
|
||||
// state defines for netplayer states
|
||||
#define NETPLAYER_STATE_JOINING 0 // joining the netgame
|
||||
#define NETPLAYER_STATE_JOINED 1 // has joined and opened a reliable socket connection
|
||||
#define NETPLAYER_STATE_MISSION_LOADING 2 // in the process of loading the mission
|
||||
#define NETPLAYER_STATE_MISSION_LOADING 2 // in the process of loading the mission
|
||||
#define NETPLAYER_STATE_MISSION_LOADED 3 // mission loaded
|
||||
#define NETPLAYER_STATE_BRIEFING 4 // in the briefing
|
||||
#define NETPLAYER_STATE_BRIEFING 4 // in the briefing
|
||||
#define NETPLAYER_STATE_SHIP_SELECT 5 // in the ship selection screen
|
||||
#define NETPLAYER_STATE_WEAPON_SELECT 6 // in the weapon selection screen
|
||||
#define NETPLAYER_STATE_DATA_LOAD 7 // loading specific data (textures, etc)
|
||||
#define NETPLAYER_STATE_WAITING 8 // waiting to do something (like enter the mission)
|
||||
#define NETPLAYER_STATE_SLOT_ACK 9 // got player ship slot packets
|
||||
#define NETPLAYER_STATE_SLOT_ACK 9 // got player ship slot packets
|
||||
#define NETPLAYER_STATE_IN_MISSION 10 // in the mission itself
|
||||
#define NETPLAYER_STATE_INGAME_SHIPS 11 // player is receiving ingame join ship data
|
||||
#define NETPLAYER_STATE_INGAME_WINGS 12 // player is receiving ingame join wing data
|
||||
#define NETPLAYER_STATE_INGAME_RPTS 13 // player is receiving ingame join respawn data
|
||||
#define NETPLAYER_STATE_INGAME_SHIP_SELECT 14 // player is in the ship select screen for ingame join
|
||||
#define NETPLAYER_STATE_INGAME_SHIP_SELECT 14 // player is in the ship select screen for ingame join
|
||||
#define NETPLAYER_STATE_DEBRIEF 15 // player is in the debrief state (screen)
|
||||
#define NETPLAYER_STATE_MISSION_SYNC 16 // player is in the mission sync screen
|
||||
#define NETPLAYER_STATE_STD_HOST_SETUP 17 // the host is on the setup netgame screen for the standalone server
|
||||
@@ -708,8 +709,8 @@ typedef struct network_buffer {
|
||||
#define NETPLAYER_STATE_SLOTS_ACK 20 // the player has received wss slots data (ingame join only)
|
||||
#define NETPLAYER_STATE_POST_DATA_ACK 21 // the player has received the post briefing data block
|
||||
#define NETPLAYER_STATE_WSS_ACK 22 // have received weapon slot information
|
||||
#define NETPLAYER_STATE_FLAG_ACK 23 // the player has received his flag change information
|
||||
#define NETPLAYER_STATE_MT_STATS 24 // the server is in the process of requesting or updating stats from the MT
|
||||
#define NETPLAYER_STATE_FLAG_ACK 23 // the player has received his flag change information
|
||||
#define NETPLAYER_STATE_MT_STATS 24 // the server is in the process of requesting or updating stats from the MT
|
||||
#define NETPLAYER_STATE_MISSION_XFER 25 // the player is in the process of receiving a mission file
|
||||
#define NETPLAYER_STATE_INGAME_STUFF 26 // received ingame "stuff" happens just before ship selection
|
||||
#define NETPLAYER_STATE_DEBRIEF_ACCEPT 27 // the player has hit the accept button in the debrief and is good to go
|
||||
|
||||
@@ -195,7 +195,7 @@ void multi_respawn_player_leave(net_player *pl)
|
||||
}
|
||||
|
||||
// dogfight mode
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){
|
||||
if(MULTI_DOGFIGHT){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1065,7 +1065,7 @@ void multi_voice_player_send_stream()
|
||||
ubyte data[MAX_PACKET_SIZE],code,*rbuf,msg_mode,chunk_index;
|
||||
ushort chunk_size,uc_size;
|
||||
int packet_size = 0;
|
||||
int sound_size,size_sent,uncompressed_size,target_index,max_chunk_size;
|
||||
int sound_size,size_sent,target_index,max_chunk_size;
|
||||
float gain;
|
||||
double d_gain;
|
||||
|
||||
@@ -1073,7 +1073,7 @@ void multi_voice_player_send_stream()
|
||||
Assert(Multi_voice_can_record);
|
||||
|
||||
// get the data
|
||||
rtvoice_get_data((unsigned char**)&Multi_voice_record_buffer,&sound_size,&uncompressed_size,&d_gain, NULL, NULL);
|
||||
rtvoice_get_data((unsigned char**)&Multi_voice_record_buffer, &sound_size, &d_gain);
|
||||
gain = (float)d_gain;
|
||||
|
||||
msg_mode = (ubyte)Multi_voice_send_mode;
|
||||
@@ -1117,8 +1117,8 @@ void multi_voice_player_send_stream()
|
||||
// add the current stream id#
|
||||
ADD_DATA(Multi_voice_stream_id);
|
||||
|
||||
Assert(uncompressed_size < MULTI_VOICE_MAX_BUFFER_SIZE);
|
||||
uc_size = (ushort)uncompressed_size;
|
||||
Assert(sound_size < MULTI_VOICE_MAX_BUFFER_SIZE);
|
||||
uc_size = (ushort)sound_size;
|
||||
ADD_USHORT(uc_size);
|
||||
|
||||
// add the chunk index
|
||||
@@ -1478,7 +1478,7 @@ int multi_voice_max_chunk_size(int msg_mode)
|
||||
// process the "next" chunk of standalone valid sound data from the rtvoice system
|
||||
void multi_voice_process_next_chunk()
|
||||
{
|
||||
int sound_size,uncompressed_size;
|
||||
int sound_size;
|
||||
float gain;
|
||||
double d_gain;
|
||||
voice_stream *str;
|
||||
@@ -1487,7 +1487,7 @@ void multi_voice_process_next_chunk()
|
||||
Assert(Multi_voice_can_record);
|
||||
|
||||
// get the data
|
||||
rtvoice_get_data((unsigned char**)&Multi_voice_record_buffer,&sound_size,&uncompressed_size,&d_gain, NULL, NULL);
|
||||
rtvoice_get_data((unsigned char**)&Multi_voice_record_buffer, &sound_size, &d_gain);
|
||||
gain = (float)d_gain;
|
||||
|
||||
// if we've reached the max # of packets for this stream, bail
|
||||
@@ -1524,7 +1524,7 @@ void multi_voice_process_next_chunk()
|
||||
memcpy(str->accum_buffer[Multi_voice_current_stream_index],Multi_voice_record_buffer,sound_size);
|
||||
str->stream_from = Net_player->player_id;
|
||||
str->accum_buffer_flags[Multi_voice_current_stream_index] = 1;
|
||||
str->accum_buffer_usize[Multi_voice_current_stream_index] = (ushort)uncompressed_size;
|
||||
str->accum_buffer_usize[Multi_voice_current_stream_index] = (ushort)sound_size;
|
||||
str->accum_buffer_csize[Multi_voice_current_stream_index] = (ushort)sound_size;
|
||||
str->accum_buffer_gain[Multi_voice_current_stream_index] = d_gain;
|
||||
|
||||
@@ -1945,7 +1945,7 @@ void multi_voice_alg_play_window(int stream_index)
|
||||
}
|
||||
|
||||
// now call the rtvoice playback functions
|
||||
Multi_voice_stream[stream_index].stream_snd_handle = rtvoice_play_uncompressed(Multi_voice_stream[stream_index].stream_rtvoice_handle,(unsigned char*)Multi_voice_playback_buffer,buffer_offset);
|
||||
Multi_voice_stream[stream_index].stream_snd_handle = rtvoice_play(Multi_voice_stream[stream_index].stream_rtvoice_handle,(unsigned char*)Multi_voice_playback_buffer,buffer_offset);
|
||||
Multi_voice_stream[stream_index].stream_start_time = timer_get_fixed_seconds();
|
||||
}
|
||||
|
||||
@@ -2041,8 +2041,8 @@ int Multi_voice_test_packet_tossed = 0;
|
||||
// process the next chunk of voice data
|
||||
void multi_voice_test_process_next_chunk()
|
||||
{
|
||||
unsigned char *outbuf,*outbuf_raw;
|
||||
int compressed_size,uncompressed_size,raw_size;
|
||||
unsigned char *outbuf;
|
||||
int size;
|
||||
double gain;
|
||||
|
||||
// if the test recording stamp is -1, we should stop
|
||||
@@ -2063,17 +2063,17 @@ void multi_voice_test_process_next_chunk()
|
||||
}
|
||||
|
||||
// otherwise get the compressed and uncompressed data and do something interesting with it
|
||||
rtvoice_get_data(&outbuf,&compressed_size,&uncompressed_size,&gain,&outbuf_raw,&raw_size);
|
||||
rtvoice_get_data(&outbuf, &size, &gain);
|
||||
|
||||
// determine whether the packet would have been dropped
|
||||
if(compressed_size > multi_voice_max_chunk_size(MULTI_MSG_ALL)){
|
||||
if (size > multi_voice_max_chunk_size(MULTI_MSG_ALL)) {
|
||||
Multi_voice_test_packet_tossed = 1;
|
||||
} else {
|
||||
Multi_voice_test_packet_tossed = 0;
|
||||
}
|
||||
|
||||
// send the raw output buffer to the voice options screen
|
||||
options_multi_set_voice_data(outbuf_raw,raw_size,outbuf,compressed_size,uncompressed_size,gain);
|
||||
options_multi_set_voice_data(outbuf, size, gain);
|
||||
}
|
||||
|
||||
// start recording voice locally for playback testing
|
||||
|
||||
@@ -3347,7 +3347,7 @@ void send_mission_log_packet( int num )
|
||||
int sindex;
|
||||
log_entry *entry;
|
||||
|
||||
Assert ( (Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) );
|
||||
Assert ( MULTIPLAYER_MASTER );
|
||||
|
||||
// get the data from the log
|
||||
entry = &log_entries[num];
|
||||
@@ -3375,7 +3375,7 @@ void process_mission_log_packet( ubyte *data, header *hinfo )
|
||||
char pname[NAME_LENGTH], sname[NAME_LENGTH];
|
||||
fix timestamp;
|
||||
|
||||
Assert ( (Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) );
|
||||
Assert ( MULTIPLAYER_CLIENT );
|
||||
|
||||
offset = HEADER_LENGTH;
|
||||
GET_DATA(type);
|
||||
|
||||
@@ -753,12 +753,14 @@ int weapon_will_never_hit( object *obj_weapon, object *other, obj_pair * current
|
||||
|
||||
float max_vel_weapon, max_vel_other;
|
||||
|
||||
max_vel_weapon = wp->weapon_max_vel;
|
||||
|
||||
if ((wp->lssm_stage==5))
|
||||
{
|
||||
//SUSHI: Fix bug where additive weapon velocity screws up collisions
|
||||
//Assumes that weapons which don't home don't change speed, which is currently the case.
|
||||
if (!(wip->wi_flags & WIF_TURNS))
|
||||
max_vel_weapon = obj_weapon->phys_info.speed;
|
||||
else if ((wp->lssm_stage==5))
|
||||
max_vel_weapon = wip->lssm_stage5_vel;
|
||||
}
|
||||
else
|
||||
max_vel_weapon = wp->weapon_max_vel;
|
||||
|
||||
max_vel_other = other->phys_info.max_vel.xyz.z;
|
||||
if (max_vel_other < 10.0f) {
|
||||
|
||||
@@ -790,6 +790,8 @@ void obj_move_call_physics(object *objp, float frametime)
|
||||
int points = pm->missile_banks[i].num_slots;
|
||||
int missles_left = shipp->weapons.secondary_bank_ammo[i];
|
||||
int next_point = shipp->weapons.secondary_next_slot[i];
|
||||
float fire_wait = Weapon_info[shipp->weapons.secondary_bank_weapons[i]].fire_wait;
|
||||
float reload_time = (fire_wait == 0.0f) ? 1.0f : 1.0f / fire_wait;
|
||||
|
||||
//ok so...we want to move up missles but only if there is a missle there to be moved up
|
||||
//there is a missle behind next_point, and how ever many missles there are left after that
|
||||
@@ -799,7 +801,7 @@ void obj_move_call_physics(object *objp, float frametime)
|
||||
for (int k = next_point; k < next_point+missles_left; k ++) {
|
||||
float &s_pct = shipp->secondary_point_reload_pct[i][k % points];
|
||||
if (s_pct < 1.0)
|
||||
s_pct += shipp->reload_time[i] * frametime;
|
||||
s_pct += reload_time * frametime;
|
||||
if (s_pct > 1.0)
|
||||
s_pct = 1.0f;
|
||||
}
|
||||
@@ -808,7 +810,7 @@ void obj_move_call_physics(object *objp, float frametime)
|
||||
for (int k = 0; k < points; k++) {
|
||||
float &s_pct = shipp->secondary_point_reload_pct[i][k];
|
||||
if (s_pct < 1.0)
|
||||
s_pct += shipp->reload_time[i] * frametime;
|
||||
s_pct += reload_time * frametime;
|
||||
if (s_pct > 1.0)
|
||||
s_pct = 1.0f;
|
||||
}
|
||||
@@ -1927,7 +1929,6 @@ void object_set_gliding(object *objp, bool enable)
|
||||
|
||||
if(enable) {
|
||||
objp->phys_info.flags |= PF_GLIDING;
|
||||
objp->phys_info.glide_saved_vel = Player_obj->phys_info.vel;
|
||||
} else {
|
||||
objp->phys_info.flags &= ~PF_GLIDING;
|
||||
vm_vec_rotate(&objp->phys_info.prev_ramp_vel, &objp->phys_info.vel, &objp->orient); //Backslash
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "object/objectdock.h"
|
||||
#include "object/object.h"
|
||||
#include "math/bitarray.h"
|
||||
#include "ship/ship.h"
|
||||
#include "math/vecmat.h"
|
||||
#include "mission/missionparse.h"
|
||||
@@ -18,7 +19,7 @@
|
||||
|
||||
// helper prototypes
|
||||
|
||||
void dock_evaluate_tree(object *objp, dock_function_info *infop, void (*function)(object *, dock_function_info *), bool *visited_bitstring);
|
||||
void dock_evaluate_tree(object *objp, dock_function_info *infop, void (*function)(object *, dock_function_info *), ubyte *visited_bitstring);
|
||||
void dock_move_docked_children_tree(object *objp, object *parent_objp);
|
||||
void dock_count_total_docked_objects_helper(object *objp, dock_function_info *infop);
|
||||
void dock_check_find_docked_object_helper(object *objp, dock_function_info *infop);
|
||||
@@ -329,10 +330,10 @@ void dock_evaluate_all_docked_objects(object *objp, dock_function_info *infop, v
|
||||
else
|
||||
{
|
||||
// create a bit array to mark the objects we check
|
||||
bool *visited_bitstring = (bool *) malloc( Num_objects * sizeof( bool ) );
|
||||
ubyte *visited_bitstring = (ubyte *) malloc(calculate_num_bytes(Num_objects));
|
||||
|
||||
// clear it
|
||||
memset(visited_bitstring, 0, Num_objects * sizeof( bool ) );
|
||||
memset(visited_bitstring, 0, calculate_num_bytes(Num_objects));
|
||||
|
||||
// start evaluating the tree
|
||||
dock_evaluate_tree(objp, infop, function, visited_bitstring);
|
||||
@@ -343,14 +344,14 @@ void dock_evaluate_all_docked_objects(object *objp, dock_function_info *infop, v
|
||||
}
|
||||
}
|
||||
|
||||
void dock_evaluate_tree(object *objp, dock_function_info *infop, void (*function)(object *, dock_function_info *), bool *visited_bitstring)
|
||||
void dock_evaluate_tree(object *objp, dock_function_info *infop, void (*function)(object *, dock_function_info *), ubyte *visited_bitstring)
|
||||
{
|
||||
// make sure we haven't visited this object already
|
||||
if ( visited_bitstring[ OBJ_INDEX(objp) ] )
|
||||
if (get_bit(visited_bitstring, OBJ_INDEX(objp)))
|
||||
return;
|
||||
|
||||
// mark as visited
|
||||
visited_bitstring[ OBJ_INDEX(objp) ] = true;
|
||||
set_bit(visited_bitstring, OBJ_INDEX(objp));
|
||||
|
||||
// call the function for this object, and return if instructed
|
||||
function(objp, infop);
|
||||
|
||||
@@ -49,7 +49,9 @@ void shield_add_strength(object *objp, float delta)
|
||||
if (delta == 0.0f)
|
||||
return;
|
||||
|
||||
if (!(Ai_info[Ships[objp->instance].ai_index].ai_profile_flags & AIPF_SMART_SHIELD_MANAGEMENT))
|
||||
|
||||
if (!(Ai_info[Ships[objp->instance].ai_index].ai_profile_flags & AIPF_SMART_SHIELD_MANAGEMENT)
|
||||
|| delta <= 0.0f) //SUSHI: We don't want smart shield management for negative delta
|
||||
{
|
||||
for (int i = 0; i < MAX_SHIELD_SECTIONS; i++)
|
||||
shield_add_quad(objp, i, delta / MAX_SHIELD_SECTIONS);
|
||||
|
||||
+23
-55
@@ -585,19 +585,9 @@ void obj_snd_do_frame()
|
||||
} // end switch
|
||||
|
||||
if ( go_ahead_flag ) {
|
||||
if ( ds_using_ds3d() ) {
|
||||
osp->instance = snd_play_3d(gs, &source_pos, &View_position, add_distance, &objp->phys_info.vel, 1, 1.0f, SND_PRIORITY_TRIPLE_INSTANCE);
|
||||
if ( osp->instance != -1 ) {
|
||||
Num_obj_sounds_playing++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
snd_get_3d_vol_and_pan(gs, &source_pos, &osp->vol, &osp->pan, add_distance);
|
||||
osp->instance = snd_play_looping( gs, osp->pan, 0, 0, (osp->vol*speed_vol_multiplier*rot_vol_mult)/gs->default_volume, SND_PRIORITY_TRIPLE_INSTANCE );
|
||||
if ( osp->instance != -1 ) {
|
||||
osp->freq = snd_get_pitch(osp->instance);
|
||||
Num_obj_sounds_playing++;
|
||||
}
|
||||
osp->instance = snd_play_3d(gs, &source_pos, &View_position, add_distance, &objp->phys_info.vel, 1, 1.0f, SND_PRIORITY_TRIPLE_INSTANCE);
|
||||
if ( osp->instance != -1 ) {
|
||||
Num_obj_sounds_playing++;
|
||||
}
|
||||
}
|
||||
Assert(Num_obj_sounds_playing <= MAX_OBJ_SOUNDS_PLAYING);
|
||||
@@ -630,51 +620,29 @@ void obj_snd_do_frame()
|
||||
sp = &Ships[objp->instance];
|
||||
|
||||
|
||||
if (ds_using_ds3d()) {
|
||||
channel = ds_get_channel(osp->instance);
|
||||
// for DirectSound3D sounds, re-establish the maximum speed based on the
|
||||
// speed_vol_multiplier
|
||||
if ( sp == NULL || ( (sp != NULL) && (sp->flags & SF_ENGINES_ON) ) ) {
|
||||
snd_set_volume( osp->instance, gs->default_volume*speed_vol_multiplier*rot_vol_mult );
|
||||
}
|
||||
else {
|
||||
// engine sound is disabled
|
||||
snd_set_volume( osp->instance, 0.0f );
|
||||
}
|
||||
|
||||
vec3d *vel=NULL;
|
||||
vel = &objp->phys_info.vel;
|
||||
|
||||
// Don't play doppler effect for cruisers or capitals
|
||||
if ( sp ) {
|
||||
if ( ship_get_SIF(sp) & (SIF_BIG_SHIP | SIF_HUGE_SHIP) ) {
|
||||
vel=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ds3d_update_buffer(channel, i2fl(gs->min), i2fl(gs->max), &source_pos, vel);
|
||||
snd_get_3d_vol_and_pan(gs, &source_pos, &osp->vol, &osp->pan, add_distance);
|
||||
channel = ds_get_channel(osp->instance);
|
||||
// for DirectSound3D sounds, re-establish the maximum speed based on the
|
||||
// speed_vol_multiplier
|
||||
if ( sp == NULL || ( (sp != NULL) && (sp->flags & SF_ENGINES_ON) ) ) {
|
||||
snd_set_volume( osp->instance, gs->default_volume*speed_vol_multiplier*rot_vol_mult );
|
||||
}
|
||||
else {
|
||||
if ( sp == NULL || (sp != NULL && (sp->flags & SF_ENGINES_ON) ) ) {
|
||||
snd_get_3d_vol_and_pan(gs, &source_pos, &osp->vol, &osp->pan, add_distance);
|
||||
snd_set_volume( osp->instance, osp->vol*speed_vol_multiplier*rot_vol_mult );
|
||||
snd_set_pan( osp->instance, osp->pan );
|
||||
// Don't play doppler effect for cruisers or capitals
|
||||
if ( objp->type == OBJ_SHIP && Doppler_enabled == TRUE ) {
|
||||
if ( !(ship_get_SIF(sp) & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
|
||||
int new_freq;
|
||||
// calc doppler effect
|
||||
new_freq = obj_snd_get_freq(osp->freq, objp, observer_obj, &source_pos);
|
||||
if ( abs(new_freq - osp->freq) > OBJSND_CHANGE_FREQUENCY_THRESHOLD ) {
|
||||
snd_set_pitch( osp->instance, new_freq);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
snd_set_volume( osp->instance, 0.0f );
|
||||
// engine sound is disabled
|
||||
snd_set_volume( osp->instance, 0.0f );
|
||||
}
|
||||
|
||||
vec3d *vel=NULL;
|
||||
vel = &objp->phys_info.vel;
|
||||
|
||||
// Don't play doppler effect for cruisers or capitals
|
||||
if ( sp ) {
|
||||
if ( ship_get_SIF(sp) & (SIF_BIG_SHIP | SIF_HUGE_SHIP) ) {
|
||||
vel=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ds3d_update_buffer(channel, i2fl(gs->min), i2fl(gs->max), &source_pos, vel);
|
||||
snd_get_3d_vol_and_pan(gs, &source_pos, &osp->vol, &osp->pan, add_distance);
|
||||
} // end for
|
||||
|
||||
// see if we want to play a flyby sound
|
||||
|
||||
@@ -9,13 +9,14 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "object/parseobjectdock.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "math/bitarray.h"
|
||||
|
||||
|
||||
|
||||
|
||||
// helper prototypes
|
||||
|
||||
void dock_evaluate_tree(p_object *objp, p_dock_function_info *infop, void (*function)(p_object *, p_dock_function_info *), bool *visited_bitstring);
|
||||
void dock_evaluate_tree(p_object *objp, p_dock_function_info *infop, void (*function)(p_object *, p_dock_function_info *), ubyte *visited_bitstring);
|
||||
void dock_dock_docked_children_tree(p_object *objp, p_object *parent_objp);
|
||||
|
||||
|
||||
@@ -114,10 +115,10 @@ void dock_evaluate_all_docked_objects(p_object *objp, p_dock_function_info *info
|
||||
else
|
||||
{
|
||||
// create a bit array to mark the objects we check
|
||||
bool *visited_bitstring = (bool *) malloc( Parse_objects.size() * sizeof(bool) );
|
||||
ubyte *visited_bitstring = (ubyte *) malloc(calculate_num_bytes(Parse_objects.size()));
|
||||
|
||||
// clear it
|
||||
memset(visited_bitstring, 0, Parse_objects.size() * sizeof(bool) );
|
||||
memset(visited_bitstring, 0, calculate_num_bytes(Parse_objects.size()));
|
||||
|
||||
// start evaluating the tree
|
||||
dock_evaluate_tree(objp, infop, function, visited_bitstring);
|
||||
@@ -128,14 +129,14 @@ void dock_evaluate_all_docked_objects(p_object *objp, p_dock_function_info *info
|
||||
}
|
||||
}
|
||||
|
||||
void dock_evaluate_tree(p_object *objp, p_dock_function_info *infop, void (*function)(p_object *, p_dock_function_info *), bool *visited_bitstring)
|
||||
void dock_evaluate_tree(p_object *objp, p_dock_function_info *infop, void (*function)(p_object *, p_dock_function_info *), ubyte *visited_bitstring)
|
||||
{
|
||||
// make sure we haven't visited this object already
|
||||
if ( visited_bitstring[ POBJ_INDEX(objp)] )
|
||||
if (get_bit(visited_bitstring, POBJ_INDEX(objp)))
|
||||
return;
|
||||
|
||||
// mark as visited
|
||||
visited_bitstring[ POBJ_INDEX(objp) ] = true;
|
||||
set_bit(visited_bitstring, POBJ_INDEX(objp));
|
||||
|
||||
// call the function for this object, and return if instructed
|
||||
function(objp, infop);
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "sound/audiostr.h"
|
||||
#include "sound/ds.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "weapon/beam.h"
|
||||
|
||||
//*************************Lua globals*************************
|
||||
SCP_vector<ade_table_entry> Ade_table_entries;
|
||||
@@ -3725,6 +3726,18 @@ ADE_FUNC(isValid, l_Weaponclass, NULL, "Detects whether handle is valid", "boole
|
||||
return ADE_RETURN_TRUE;
|
||||
}
|
||||
|
||||
ADE_FUNC(getWeaponClassIndex, l_Weaponclass, NULL, "Gets the index valus of the weapon class", "number", "index value of the weapon class")
|
||||
{
|
||||
int idx;
|
||||
if(!ade_get_args(L, "o", l_Weaponclass.Get(&idx)))
|
||||
return ade_set_args(L, "i", -1);
|
||||
|
||||
if(idx < 0 || idx >= Num_weapon_types)
|
||||
return ade_set_args(L, "i", -1);
|
||||
|
||||
return ade_set_args(L, "i", idx);
|
||||
}
|
||||
|
||||
//**********HANDLE: Eyepoint
|
||||
struct eye_h
|
||||
{
|
||||
@@ -4734,6 +4747,18 @@ ADE_FUNC(isModelLoaded, l_Shipclass, "[boolean Load = false]", "Checks if the mo
|
||||
return ADE_RETURN_FALSE;
|
||||
}
|
||||
|
||||
ADE_FUNC(getShipClassIndex, l_Shipclass, NULL, "Gets the index valus of the ship class", "number", "index value of the ship class")
|
||||
{
|
||||
int idx;
|
||||
if(!ade_get_args(L, "o", l_Shipclass.Get(&idx)))
|
||||
return ade_set_args(L, "i", -1);
|
||||
|
||||
if(idx < 0 || idx >= Num_ship_classes)
|
||||
return ade_set_args(L, "i", -1);
|
||||
|
||||
return ade_set_args(L, "i", idx);
|
||||
}
|
||||
|
||||
//**********HANDLE: Waypoint
|
||||
ade_obj<object_h> l_Waypoint("waypoint", "waypoint handle", &l_Object);
|
||||
|
||||
@@ -6935,6 +6960,312 @@ ADE_VIRTVAR(Team, l_Weapon, "team", "Weapon's team", "team", "Weapon team, or in
|
||||
return ade_set_args(L, "o", l_Team.Set(wp->team));
|
||||
}
|
||||
|
||||
ADE_FUNC(isArmed, l_Weapon, "[boolean Hit target]", "Checks if the weapon is armed.", "boolean", "boolean value of the weapon arming status")
|
||||
{
|
||||
object_h *oh = NULL;
|
||||
bool hit_target = false;
|
||||
if(!ade_get_args(L, "o|b", l_Weapon.GetPtr(&oh), &hit_target))
|
||||
return ADE_RETURN_FALSE;
|
||||
|
||||
if(!oh->IsValid())
|
||||
return ADE_RETURN_FALSE;
|
||||
|
||||
weapon *wp = &Weapons[oh->objp->instance];
|
||||
|
||||
if(weapon_armed(wp, hit_target))
|
||||
return ADE_RETURN_TRUE;
|
||||
|
||||
return ADE_RETURN_FALSE;
|
||||
}
|
||||
|
||||
//**********HANDLE: Beam
|
||||
ade_obj<object_h> l_Beam("beam", "Beam handle", &l_Object);
|
||||
|
||||
ADE_VIRTVAR(Class, l_Beam, "weaponclass", "Weapon's class", "weaponclass", "Weapon class, or invalid weaponclass handle if beam handle is invalid")
|
||||
{
|
||||
object_h *oh=NULL;
|
||||
int nc=-1;
|
||||
if(!ade_get_args(L, "o|o", l_Beam.GetPtr(&oh), l_Weaponclass.Get(&nc)))
|
||||
return ade_set_error(L, "o", l_Weaponclass.Set(-1));
|
||||
|
||||
if(!oh->IsValid())
|
||||
return ade_set_error(L, "o", l_Weaponclass.Set(-1));
|
||||
|
||||
beam *bp = &Beams[oh->objp->instance];
|
||||
|
||||
if(ADE_SETTING_VAR && nc > -1) {
|
||||
bp->weapon_info_index = nc;
|
||||
}
|
||||
|
||||
return ade_set_args(L, "o", l_Weaponclass.Set(bp->weapon_info_index));
|
||||
}
|
||||
|
||||
ADE_VIRTVAR(LastShot, l_Beam, "vector", "End point of the beam", "vector", "vector or null vector if beam handle is not valid")
|
||||
{
|
||||
object_h *oh=NULL;
|
||||
vec3d *vec3;
|
||||
if(!ade_get_args(L, "o|o", l_Beam.GetPtr(&oh), l_Vector.GetPtr(&vec3)))
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
if(!oh->IsValid())
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
beam *bp = &Beams[oh->objp->instance];
|
||||
|
||||
if(ADE_SETTING_VAR) {
|
||||
bp->last_shot = *vec3;
|
||||
}
|
||||
|
||||
return ade_set_args(L, "o", l_Vector.Set(bp->last_shot));
|
||||
}
|
||||
|
||||
ADE_VIRTVAR(LastStart, l_Beam, "vector", "Start point of the beam", "vector", "vector or null vector if beam handle is not valid")
|
||||
{
|
||||
object_h *oh=NULL;
|
||||
vec3d *v3;
|
||||
if(!ade_get_args(L, "o|o", l_Beam.GetPtr(&oh), l_Vector.GetPtr(&v3)))
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
if(!oh->IsValid())
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
beam *bp = &Beams[oh->objp->instance];
|
||||
|
||||
if(ADE_SETTING_VAR) {
|
||||
bp->last_start = *v3;
|
||||
}
|
||||
|
||||
return ade_set_args(L, "o", l_Vector.Set(bp->last_start));
|
||||
}
|
||||
|
||||
ADE_VIRTVAR(Target, l_Beam, "object", "Target of beam. Value may also be a deriviative of the 'object' class, such as 'ship'.", "object", "Beam target, or invalid object handle if beam handle is invalid")
|
||||
{
|
||||
object_h *objh;
|
||||
object_h *newh;
|
||||
if(!ade_get_args(L, "o|o", l_Beam.GetPtr(&objh), l_Object.GetPtr(&newh)))
|
||||
return ade_set_error(L, "o", l_Object.Set(object_h()));
|
||||
|
||||
if(!objh->IsValid())
|
||||
return ade_set_error(L, "o", l_Object.Set(object_h()));
|
||||
|
||||
beam *bp = NULL;
|
||||
if(objh->objp->instance > -1)
|
||||
bp = &Beams[objh->objp->instance];
|
||||
else
|
||||
return ade_set_error(L, "o", l_Object.Set(object_h()));
|
||||
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
if(newh != NULL && newh->IsValid())
|
||||
{
|
||||
if(bp->target_sig != newh->sig)
|
||||
{
|
||||
bp->target = newh->objp;
|
||||
bp->target_sig = newh->sig;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bp->target = NULL;
|
||||
bp->target_sig = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ade_set_object_with_breed(L, OBJ_INDEX(bp->target));
|
||||
}
|
||||
|
||||
ADE_VIRTVAR(TargetSubsystem, l_Beam, "subsystem", "Subsystem that beam is targeting.", "subsystem", "Target subsystem, or invalid subsystem handle if beam handle is invalid")
|
||||
{
|
||||
object_h *objh;
|
||||
ship_subsys_h *newh;
|
||||
if(!ade_get_args(L, "o|o", l_Beam.GetPtr(&objh), l_Subsystem.GetPtr(&newh)))
|
||||
return ade_set_error(L, "o", l_Subsystem.Set(ship_subsys_h()));
|
||||
|
||||
if(!objh->IsValid())
|
||||
return ade_set_error(L, "o", l_Subsystem.Set(ship_subsys_h()));
|
||||
|
||||
beam *bp = NULL;
|
||||
if(objh->objp->instance > -1)
|
||||
bp = &Beams[objh->objp->instance];
|
||||
else
|
||||
return ade_set_error(L, "o", l_Subsystem.Set(ship_subsys_h()));
|
||||
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
if(newh != NULL && newh->IsValid())
|
||||
{
|
||||
if(bp->target_sig != newh->sig)
|
||||
{
|
||||
bp->target = newh->objp;
|
||||
bp->target_subsys = newh->ss;
|
||||
bp->target_sig = newh->sig;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bp->target = NULL;
|
||||
bp->target_subsys = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return ade_set_args(L, "o", l_Subsystem.Set(ship_subsys_h(bp->target, bp->target_subsys)));
|
||||
}
|
||||
|
||||
ADE_VIRTVAR(ParentShip, l_Beam, "object", "Parent of the beam.", "object", "Beam parent, or invalid object handle if beam handle is invalid")
|
||||
{
|
||||
object_h *objh;
|
||||
object_h *newh;
|
||||
if(!ade_get_args(L, "o|o", l_Beam.GetPtr(&objh), l_Object.GetPtr(&newh)))
|
||||
return ade_set_error(L, "o", l_Object.Set(object_h()));
|
||||
|
||||
if(!objh->IsValid())
|
||||
return ade_set_error(L, "o", l_Object.Set(object_h()));
|
||||
|
||||
beam *bp = NULL;
|
||||
if(objh->objp->instance > -1)
|
||||
bp = &Beams[objh->objp->instance];
|
||||
else
|
||||
return ade_set_error(L, "o", l_Object.Set(object_h()));
|
||||
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
if(newh != NULL && newh->IsValid())
|
||||
{
|
||||
if(bp->sig != newh->sig)
|
||||
{
|
||||
bp->objp = newh->objp;
|
||||
bp->sig = newh->sig;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bp->objp = NULL;
|
||||
bp->sig = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ade_set_object_with_breed(L, OBJ_INDEX(bp->objp));
|
||||
}
|
||||
|
||||
ADE_VIRTVAR(ParentSubsystem, l_Beam, "subsystem", "Subsystem that beam is fired from.", "subsystem", "Parent subsystem, or invalid subsystem handle if beam handle is invalid")
|
||||
{
|
||||
object_h *objh;
|
||||
ship_subsys_h *newh;
|
||||
if(!ade_get_args(L, "o|o", l_Beam.GetPtr(&objh), l_Subsystem.GetPtr(&newh)))
|
||||
return ade_set_error(L, "o", l_Subsystem.Set(ship_subsys_h()));
|
||||
|
||||
if(!objh->IsValid())
|
||||
return ade_set_error(L, "o", l_Subsystem.Set(ship_subsys_h()));
|
||||
|
||||
beam *bp = NULL;
|
||||
if(objh->objp->instance > -1)
|
||||
bp = &Beams[objh->objp->instance];
|
||||
else
|
||||
return ade_set_error(L, "o", l_Subsystem.Set(ship_subsys_h()));
|
||||
|
||||
if(ADE_SETTING_VAR)
|
||||
{
|
||||
if(newh != NULL && newh->IsValid())
|
||||
{
|
||||
if(bp->sig != newh->sig)
|
||||
{
|
||||
bp->objp = newh->objp;
|
||||
bp->subsys = newh->ss;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bp->objp = NULL;
|
||||
bp->subsys = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return ade_set_args(L, "o", l_Subsystem.Set(ship_subsys_h(bp->objp, bp->subsys)));
|
||||
}
|
||||
|
||||
ADE_FUNC(getCollisionCount, l_Beam, NULL, "Get the number of collisions in frame.", "number", "Number of beam collisions")
|
||||
{
|
||||
object_h *objh;
|
||||
if(!ade_get_args(L, "o", l_Beam.GetPtr(&objh)))
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
beam *bp = NULL;
|
||||
if(objh->objp->instance > -1)
|
||||
bp = &Beams[objh->objp->instance];
|
||||
else
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
return ade_set_args(L, "i", bp->f_collision_count);
|
||||
}
|
||||
|
||||
ADE_FUNC(getCollisionPosition, l_Beam, "number", "Get the position of the defined collision.", "vector", "World vector")
|
||||
{
|
||||
object_h *objh;
|
||||
int idx;
|
||||
if(!ade_get_args(L, "oi", l_Beam.GetPtr(&objh), &idx))
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
// convert from Lua to C
|
||||
idx--;
|
||||
if ((idx >= 10) || (idx < 0))
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
beam *bp = NULL;
|
||||
if(objh->objp->instance > -1)
|
||||
bp = &Beams[objh->objp->instance];
|
||||
else
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
// so we have valid beam and valid indexer
|
||||
return ade_set_args(L, "o", l_Vector.Set(bp->f_collisions[idx].cinfo.hit_point_world));
|
||||
}
|
||||
|
||||
ADE_FUNC(getCollisionObject, l_Beam, "number", "Get the target of the defined collision.", "object", "Object the beam collided with")
|
||||
{
|
||||
object_h *objh;
|
||||
int idx;
|
||||
if(!ade_get_args(L, "oi", l_Beam.GetPtr(&objh), &idx))
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
// convert from Lua to C
|
||||
idx--;
|
||||
if ((idx >= 10) || (idx < 0))
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
beam *bp = NULL;
|
||||
if(objh->objp->instance > -1)
|
||||
bp = &Beams[objh->objp->instance];
|
||||
else
|
||||
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
|
||||
|
||||
// so we have valid beam and valid indexer
|
||||
return ade_set_object_with_breed(L, bp->f_collisions[idx].c_objnum);
|
||||
}
|
||||
|
||||
ADE_FUNC(isExitCollision, l_Beam, "number", "Checks if the defined collision was exit collision.", "boolean", "True if the collision was exit collision, false if entry, nil otherwise")
|
||||
{
|
||||
object_h *objh;
|
||||
int idx;
|
||||
if(!ade_get_args(L, "oi", l_Beam.GetPtr(&objh), &idx))
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
// convert from Lua to C
|
||||
idx--;
|
||||
if ((idx >= 10) || (idx < 0))
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
beam *bp = NULL;
|
||||
if(objh->objp->instance > -1)
|
||||
bp = &Beams[objh->objp->instance];
|
||||
else
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
// so we have valid beam and valid indexer
|
||||
if (bp->f_collisions[idx].is_exit_collision)
|
||||
return ADE_RETURN_TRUE;
|
||||
|
||||
return ADE_RETURN_FALSE;
|
||||
}
|
||||
|
||||
//**********HANDLE: Wing
|
||||
ade_obj<int> l_Wing("wing", "Wing handle");
|
||||
@@ -10252,6 +10583,37 @@ ADE_FUNC(__len, l_Mission_Weapons, NULL, "Number of weapon objects in mission. N
|
||||
return ade_set_args(L, "i", Num_weapons);
|
||||
}
|
||||
|
||||
//****SUBLIBRARY: Mission/Beams
|
||||
ade_lib l_Mission_Beams("Beams", &l_Mission, NULL, NULL);
|
||||
|
||||
ADE_INDEXER(l_Mission_Beams, "number Index", "Gets handle to a beam object in the mission.", "beam", "Beam handle, or invalid beam handle if index is invalid")
|
||||
{
|
||||
int idx;
|
||||
if(!ade_get_args(L, "*i", &idx))
|
||||
return ade_set_error(L, "o", l_Beam.Set(object_h()));
|
||||
|
||||
//Remember, Lua indices start at 0.
|
||||
int count=1;
|
||||
|
||||
for(int i = 0; i < MAX_BEAMS; i++)
|
||||
{
|
||||
if (Beams[i].weapon_info_index < 0 || Beams[i].objnum < 0 || Objects[Beams[i].objnum].type != OBJ_BEAM)
|
||||
continue;
|
||||
|
||||
if(count == idx) {
|
||||
return ade_set_args(L, "o", l_Beam.Set(object_h(&Objects[Beams[i].objnum])));
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return ade_set_error(L, "o", l_Beam.Set(object_h()));
|
||||
}
|
||||
ADE_FUNC(__len, l_Mission_Beams, NULL, "Number of beam objects in mission. Note that this is only accurate for one frame.", "number", "Number of beam objects in mission")
|
||||
{
|
||||
return ade_set_args(L, "i", Beam_count);
|
||||
}
|
||||
|
||||
//****SUBLIBRARY: Mission/Wings
|
||||
ade_lib l_Mission_Wings("Wings", &l_Mission, NULL, NULL);
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ flag_def_list Script_actions[] =
|
||||
{"On Warp Out", CHA_WARPOUT, 0},
|
||||
{"On Death", CHA_DEATH, 0},
|
||||
{"On Mission End", CHA_MISSIONEND, 0},
|
||||
{"On Weapon Delete", CHA_ONWEAPONDELETE, 0},
|
||||
};
|
||||
|
||||
int Num_script_actions = sizeof(Script_actions)/sizeof(flag_def_list);
|
||||
|
||||
@@ -60,6 +60,7 @@ struct image_desc
|
||||
#define CHA_KEYRELEASED 18
|
||||
#define CHA_ONSTATESTART 19
|
||||
#define CHA_ONSTATEEND 20
|
||||
#define CHA_ONWEAPONDELETE 21
|
||||
|
||||
|
||||
struct script_condition
|
||||
|
||||
+477
-55
@@ -61,6 +61,7 @@
|
||||
#include "weapon/shockwave.h"
|
||||
#include "weapon/emp.h"
|
||||
#include "sound/audiostr.h"
|
||||
#include "sound/ds.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "hud/hudparse.h"
|
||||
#include "starfield/starfield.h"
|
||||
@@ -120,8 +121,11 @@ sexp_oper Operators[] = {
|
||||
{ "or", OP_OR, 2, INT_MAX, },
|
||||
{ "not", OP_NOT, 1, 1, },
|
||||
{ "=", OP_EQUALS, 2, INT_MAX, },
|
||||
{ "!=", OP_NOT_EQUAL, 2, INT_MAX, }, // Goober5000
|
||||
{ ">", OP_GREATER_THAN, 2, INT_MAX, },
|
||||
{ ">=", OP_GREATER_OR_EQUAL, 2, INT_MAX, }, // Goober5000
|
||||
{ "<", OP_LESS_THAN, 2, INT_MAX, },
|
||||
{ "<=", OP_LESS_OR_EQUAL, 2, INT_MAX, }, // Goober5000
|
||||
{ "string-equals", OP_STRING_EQUALS, 2, INT_MAX, },
|
||||
{ "string-greater-than", OP_STRING_GREATER_THAN, 2, INT_MAX, },
|
||||
{ "string-less-than", OP_STRING_LESS_THAN, 2, INT_MAX, },
|
||||
@@ -244,6 +248,7 @@ sexp_oper Operators[] = {
|
||||
{ "time-wing-arrived", OP_TIME_WING_ARRIVED, 1, 1, },
|
||||
{ "time-wing-departed", OP_TIME_WING_DEPARTED, 1, 1, },
|
||||
{ "mission-time", OP_MISSION_TIME, 0, 0, },
|
||||
{ "mission-time-msecs", OP_MISSION_TIME_MSECS, 0, 0, }, // Goober5000
|
||||
{ "time-docked", OP_TIME_DOCKED, 3, 3, },
|
||||
{ "time-undocked", OP_TIME_UNDOCKED, 3, 3, },
|
||||
|
||||
@@ -259,7 +264,9 @@ sexp_oper Operators[] = {
|
||||
{ "number-of", OP_NUMBER_OF, 2, INT_MAX, }, // Goober5000
|
||||
{ "in-sequence", OP_IN_SEQUENCE, 1, INT_MAX, }, // Karajorma
|
||||
{ "invalidate-argument", OP_INVALIDATE_ARGUMENT, 1, INT_MAX, }, // Goober5000
|
||||
{ "invalidate-all-arguments", OP_INVALIDATE_ALL_ARGUMENTS, 0, 0, }, // Karajorma
|
||||
{ "validate-argument", OP_VALIDATE_ARGUMENT, 1, INT_MAX, }, // Karajorma
|
||||
{ "validate-all-arguments", OP_VALIDATE_ALL_ARGUMENTS, 0, 0, }, // Karajorma
|
||||
{ "do-for-valid-arguments", OP_DO_FOR_VALID_ARGUMENTS, 1, INT_MAX, }, // Karajorma
|
||||
|
||||
{ "send-message-list", OP_SEND_MESSAGE_LIST, 4, INT_MAX },
|
||||
@@ -376,7 +383,7 @@ sexp_oper Operators[] = {
|
||||
|
||||
|
||||
{ "red-alert", OP_RED_ALERT, 0, 0 },
|
||||
{ "end-mission", OP_END_MISSION, 0, 0 }, //-Sesquipedalian
|
||||
{ "end-mission", OP_END_MISSION, 0, 1 }, //-Sesquipedalian
|
||||
{ "force-jump", OP_FORCE_JUMP, 0, 0 }, // Goober5000
|
||||
{ "next-mission", OP_NEXT_MISSION, 1, 1 },
|
||||
{ "end-campaign", OP_END_CAMPAIGN, 0, 0 },
|
||||
@@ -425,8 +432,10 @@ sexp_oper Operators[] = {
|
||||
|
||||
{ "change-soundtrack", OP_CHANGE_SOUNDTRACK, 1, 1 }, // Goober5000
|
||||
{ "play-sound-from-table", OP_PLAY_SOUND_FROM_TABLE, 4, 4 }, // Goober5000
|
||||
{ "play-sound-from-file", OP_PLAY_SOUND_FROM_FILE, 1, 2 }, // Goober5000
|
||||
{ "play-sound-from-file", OP_PLAY_SOUND_FROM_FILE, 1, 3 }, // Goober5000
|
||||
{ "close-sound-from-file", OP_CLOSE_SOUND_FROM_FILE, 1, 1 }, // Goober5000
|
||||
{ "set-sound-environment", OP_SET_SOUND_ENVIRONMENT, 1, INT_MAX }, // Taylor
|
||||
{ "update-sound-environment", OP_UPDATE_SOUND_ENVIRONMENT, 2, INT_MAX }, // Taylor
|
||||
|
||||
{ "modify-variable", OP_MODIFY_VARIABLE, 2, 2, },
|
||||
{ "variable-array-get", OP_GET_VARIABLE_BY_INDEX, 1, 1, },
|
||||
@@ -459,6 +468,7 @@ sexp_oper Operators[] = {
|
||||
|
||||
//background and nebula sexps
|
||||
{ "mission-set-nebula", OP_MISSION_SET_NEBULA, 1, 1 }, //-Sesquipedalian
|
||||
{ "mission-set-subspace", OP_MISSION_SET_SUBSPACE, 1, 1 },
|
||||
{ "add-background-bitmap", OP_ADD_BACKGROUND_BITMAP, 9, 9 }, // phreak
|
||||
{ "remove-background-bitmap", OP_REMOVE_BACKGROUND_BITMAP, 1, 1 }, // phreak
|
||||
{ "add-sun-bitmap", OP_ADD_SUN_BITMAP, 6, 6 }, // phreak
|
||||
@@ -476,6 +486,7 @@ sexp_oper Operators[] = {
|
||||
{ "hud-set-frame", OP_HUD_SET_FRAME, 2, 2 }, //WMCoolmon
|
||||
{ "hud-set-color", OP_HUD_SET_COLOR, 4, 4 }, //WMCoolmon
|
||||
{ "hud-set-max-targeting-range", OP_HUD_SET_MAX_TARGETING_RANGE, 1, 1 }, // Goober5000
|
||||
{ "hud-display-gauge", OP_HUD_DISPLAY_GAUGE, 2, 2 },
|
||||
|
||||
/* made obsolete by Goober5000
|
||||
{ "error", OP_INT3, 0, 0 },
|
||||
@@ -679,6 +690,14 @@ int Players_mlocked_timestamp;
|
||||
int Sexp_music_handle = -1;
|
||||
void sexp_stop_music(int fade = 1);
|
||||
|
||||
// for sound environments - Goober5000/Taylor
|
||||
#define SSEO_VOLUME 0
|
||||
#define SSEO_DECAY_TIME 1
|
||||
#define SSEO_DAMPING 2
|
||||
int sexp_sound_environment_option_lookup(char *text);
|
||||
char *Sound_environment_option[] = { "volume", "decay time", "damping" };
|
||||
int Num_sound_environment_options = 3;
|
||||
|
||||
int get_sexp(char *token);
|
||||
void build_extended_sexp_string(int cur_node, int level, int mode, int max_len);
|
||||
void update_sexp_references(char *old_name, char *new_name, int format, int node);
|
||||
@@ -702,6 +721,8 @@ arg_item Sexp_applicable_argument_list;
|
||||
bool is_blank_argument_op(int op_const);
|
||||
bool is_blank_of_op(int op_const);
|
||||
|
||||
int get_handler_for_x_of_operator(int node);
|
||||
|
||||
//Karajorma
|
||||
int get_generic_subsys(char *subsy_name);
|
||||
bool ship_class_unchanged(int ship_index);
|
||||
@@ -714,6 +735,9 @@ void multi_sexp_modify_variable();
|
||||
player * get_player_from_ship_node(int node, bool test_respawns = false);
|
||||
ship * sexp_get_ship_from_node(int node);
|
||||
|
||||
// hud-display-gauge magic values
|
||||
#define SEXP_HUD_GAUGE_WARPOUT "warpout"
|
||||
|
||||
// Goober5000 - arg_item class stuff, borrowed from sexp_list_item class stuff -------------
|
||||
void arg_item::add_data(char *str)
|
||||
{
|
||||
@@ -2395,6 +2419,26 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
|
||||
}
|
||||
break;
|
||||
|
||||
case OPF_SOUND_ENVIRONMENT:
|
||||
if (type2 != SEXP_ATOM_STRING) {
|
||||
return SEXP_CHECK_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
if (stricmp(CTEXT(node), SEXP_NONE_STRING) && ds_eax_get_preset_id(CTEXT(node)) < 0) {
|
||||
return SEXP_CHECK_INVALID_SOUND_ENVIRONMENT;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPF_SOUND_ENVIRONMENT_OPTION:
|
||||
if (type2 != SEXP_ATOM_STRING) {
|
||||
return SEXP_CHECK_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
if (sexp_sound_environment_option_lookup(CTEXT(node)) < 0) {
|
||||
return SEXP_CHECK_INVALID_SOUND_ENVIRONMENT_OPTION;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPF_KEYPRESS:
|
||||
if (type2 != SEXP_ATOM_STRING)
|
||||
return SEXP_CHECK_TYPE_MISMATCH;
|
||||
@@ -2578,24 +2622,26 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
|
||||
break;
|
||||
|
||||
case OPF_BACKGROUND_BITMAP:
|
||||
break;
|
||||
|
||||
case OPF_SUN_BITMAP:
|
||||
break;
|
||||
|
||||
case OPF_NEBULA_STORM_TYPE:
|
||||
break;
|
||||
|
||||
case OPF_NEBULA_POOF:
|
||||
break;
|
||||
|
||||
case OPF_POST_EFFECT:
|
||||
if (type2 != SEXP_ATOM_STRING)
|
||||
{
|
||||
if (type2 != SEXP_ATOM_STRING) {
|
||||
return SEXP_CHECK_TYPE_MISMATCH;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPF_HUD_ELEMENT:
|
||||
if (type2 != SEXP_ATOM_STRING) {
|
||||
return SEXP_CHECK_TYPE_MISMATCH;
|
||||
} else {
|
||||
char *gauge = CTEXT(node);
|
||||
if ( strcmp(SEXP_HUD_GAUGE_WARPOUT, gauge) == 0 ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SEXP_CHECK_INVALID_HUD_ELEMENT;
|
||||
|
||||
default:
|
||||
Error(LOCATION, "Unhandled argument format");
|
||||
//Int3(); // currently unhandled argument format (so add it now)
|
||||
@@ -2885,6 +2931,10 @@ int get_sexp(char *token)
|
||||
Nebula_sexp_used = true;
|
||||
Dynamic_environment = true;
|
||||
break;
|
||||
|
||||
case OP_MISSION_SET_SUBSPACE:
|
||||
Dynamic_environment = true;
|
||||
break;
|
||||
|
||||
case OP_WARP_EFFECT:
|
||||
// type of warp is argument #11
|
||||
@@ -3849,13 +3899,29 @@ int sexp_number_compare(int n, int op)
|
||||
if (first_number != current_number) return SEXP_FALSE;
|
||||
break;
|
||||
|
||||
case OP_NOT_EQUAL:
|
||||
if (first_number == current_number) return SEXP_FALSE;
|
||||
break;
|
||||
|
||||
case OP_GREATER_THAN:
|
||||
if (first_number <= current_number) return SEXP_FALSE;
|
||||
break;
|
||||
|
||||
case OP_GREATER_OR_EQUAL:
|
||||
if (first_number < current_number) return SEXP_FALSE;
|
||||
break;
|
||||
|
||||
case OP_LESS_THAN:
|
||||
if (first_number >= current_number) return SEXP_FALSE;
|
||||
break;
|
||||
|
||||
case OP_LESS_OR_EQUAL:
|
||||
if (first_number > current_number) return SEXP_FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
Warning(LOCATION, "Unhandled comparison case! Operator = ", op);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4734,6 +4800,12 @@ int sexp_mission_time()
|
||||
return f2i(Missiontime);
|
||||
}
|
||||
|
||||
// next function returns the time into the mission, in milliseconds
|
||||
int sexp_mission_time_msecs()
|
||||
{
|
||||
return f2i(Missiontime * 1000);
|
||||
}
|
||||
|
||||
// returns percent of length of distance to special warpout plane
|
||||
int sexp_special_warp_dist( int n)
|
||||
{
|
||||
@@ -4929,6 +5001,7 @@ void sexp_set_energy_pct (int node, int op_num)
|
||||
|
||||
sindex = ship_name_lookup( shipname );
|
||||
if ( sindex == -1 ){ // hmm.. if true, must not have arrived yet
|
||||
node = CDR(node);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7617,25 +7690,38 @@ int eval_in_sequence(int arg_handler_node, int condition_node)
|
||||
return val;
|
||||
}
|
||||
|
||||
void sexp_change_all_argument_validity(int n, bool invalidate)
|
||||
{
|
||||
int arg_handler, arg_n;
|
||||
|
||||
arg_handler = get_handler_for_x_of_operator(n);
|
||||
|
||||
while (n != -1)
|
||||
{
|
||||
arg_n = CDR(arg_handler);
|
||||
while (arg_n != -1) {
|
||||
if (invalidate) {
|
||||
Sexp_nodes[arg_n].flags &= ~SNF_ARGUMENT_VALID;
|
||||
}
|
||||
else {
|
||||
Sexp_nodes[arg_n].flags |= SNF_ARGUMENT_VALID;
|
||||
}
|
||||
// iterate
|
||||
arg_n = CDR(arg_n);
|
||||
}
|
||||
|
||||
// iterate
|
||||
n = CDR(n);
|
||||
}
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
void sexp_change_argument_validity(int n, bool invalidate)
|
||||
{
|
||||
int conditional, arg_handler, arg_n;
|
||||
int arg_handler, arg_n;
|
||||
bool toggled;
|
||||
|
||||
conditional = n;
|
||||
do {
|
||||
// find the conditional sexp
|
||||
conditional = find_parent_operator(conditional);
|
||||
if (conditional == -1)
|
||||
return;
|
||||
}
|
||||
while (!is_blank_argument_op(get_operator_const(CTEXT(conditional))));
|
||||
|
||||
// get the first op of the parent, which should be a *_of operator
|
||||
arg_handler = CADR(conditional);
|
||||
if (!is_blank_of_op(get_operator_const(CTEXT(arg_handler))))
|
||||
return;
|
||||
arg_handler = get_handler_for_x_of_operator(n);
|
||||
|
||||
// loop through arguments
|
||||
while (n != -1)
|
||||
@@ -7697,6 +7783,34 @@ void sexp_change_argument_validity(int n, bool invalidate)
|
||||
}
|
||||
}
|
||||
|
||||
int get_handler_for_x_of_operator(int n)
|
||||
{
|
||||
int conditional, arg_handler;
|
||||
|
||||
if (n < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
conditional = n;
|
||||
do {
|
||||
// find the conditional sexp
|
||||
conditional = find_parent_operator(conditional);
|
||||
if (conditional == -1) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
while (!is_blank_argument_op(get_operator_const(CTEXT(conditional))));
|
||||
|
||||
// get the first op of the parent, which should be a *_of operator
|
||||
arg_handler = CADR(conditional);
|
||||
if (!is_blank_of_op(get_operator_const(CTEXT(arg_handler)))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return arg_handler;
|
||||
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
bool is_blank_argument_op(int op_const)
|
||||
{
|
||||
@@ -7792,7 +7906,7 @@ void sexp_ingame_ship_change_iff(ship *shipp, int new_team)
|
||||
shipp->team = new_team;
|
||||
|
||||
// send a network packet if we need to
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (shipp->objnum >= 0))
|
||||
if( MULTIPLAYER_MASTER && (Net_player != NULL) && (shipp->objnum >= 0))
|
||||
send_change_iff_packet(Objects[shipp->objnum].net_signature, new_team);
|
||||
}
|
||||
|
||||
@@ -7862,7 +7976,7 @@ void sexp_ingame_ship_change_iff_color(ship *shipp, int observer_team, int obser
|
||||
shipp->ship_iff_color[observer_team][observed_team] = alternate_iff_color;
|
||||
|
||||
// Like the rest of the change_iff_color functions copied with minor alterations from earlier change_iff functions.
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (shipp->objnum >= 0))
|
||||
if( MULTIPLAYER_MASTER && (Net_player != NULL) && (shipp->objnum >= 0))
|
||||
send_change_iff_color_packet(Objects[shipp->objnum].net_signature, observer_team, observed_team, alternate_iff_color);
|
||||
}
|
||||
|
||||
@@ -8118,7 +8232,7 @@ void sexp_change_ai_class(int n)
|
||||
ship_subsystem_set_new_ai_class(ship_num, CTEXT(n), new_ai_class);
|
||||
|
||||
// send a network packet if we need to
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (Ships[ship_num].objnum >= 0))
|
||||
if( MULTIPLAYER_MASTER && (Net_player != NULL) && (Ships[ship_num].objnum >= 0))
|
||||
{
|
||||
send_change_ai_class_packet(Objects[Ships[ship_num].objnum].net_signature, CTEXT(n), new_ai_class);
|
||||
}
|
||||
@@ -8130,7 +8244,7 @@ void sexp_change_ai_class(int n)
|
||||
ship_set_new_ai_class(ship_num, new_ai_class);
|
||||
|
||||
// send a network packet if we need to
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (Ships[ship_num].objnum >= 0))
|
||||
if( MULTIPLAYER_MASTER && (Net_player != NULL) && (Ships[ship_num].objnum >= 0))
|
||||
{
|
||||
send_change_ai_class_packet(Objects[Ships[ship_num].objnum].net_signature, NULL, new_ai_class);
|
||||
}
|
||||
@@ -8353,6 +8467,19 @@ void sexp_hud_set_max_targeting_range(int n)
|
||||
Hud_max_targeting_range = 0;
|
||||
}
|
||||
|
||||
/* Make sure that the Sexp_hud_display_* get added to the game_state
|
||||
transitions in freespace.cpp (game_enter_state()). */
|
||||
int Sexp_hud_display_warpout = 0;
|
||||
|
||||
void sexp_hud_display_gauge(int n) {
|
||||
int show_for = eval_num(n);
|
||||
char* gauge = CTEXT(CDR(n));
|
||||
|
||||
if ( stricmp(SEXP_HUD_GAUGE_WARPOUT, gauge) == 0 ) {
|
||||
Sexp_hud_display_warpout = (show_for > 1)? timestamp(show_for) : (show_for);
|
||||
}
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
// trigger whether player uses the game AI for stuff
|
||||
void sexp_player_use_ai(int flag)
|
||||
@@ -8414,7 +8541,7 @@ void sexp_music_close()
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
void sexp_load_music(char* fname)
|
||||
void sexp_load_music(char* fname, int type = -1)
|
||||
{
|
||||
if ( Cmdline_freespace_no_music ) {
|
||||
return;
|
||||
@@ -8425,9 +8552,14 @@ void sexp_load_music(char* fname)
|
||||
sexp_stop_music();
|
||||
}
|
||||
|
||||
if ( type < 0 )
|
||||
{
|
||||
type = ASF_MENUMUSIC;
|
||||
}
|
||||
|
||||
if ( fname )
|
||||
{
|
||||
Sexp_music_handle = audiostream_open( fname, ASF_MENUMUSIC );
|
||||
Sexp_music_handle = audiostream_open( fname, type );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8462,7 +8594,9 @@ void sexp_play_sound_from_table(int n)
|
||||
|
||||
|
||||
// play sound effect ---------------------------
|
||||
snd_play_3d( &Snds[sound_index], &origin, &View_position, 0.0f, NULL, 0, 1.0f, SND_PRIORITY_MUST_PLAY );
|
||||
if (sound_index >= 0) {
|
||||
snd_play_3d( &Snds[sound_index], &origin, &View_position, 0.0f, NULL, 0, 1.0f, SND_PRIORITY_MUST_PLAY );
|
||||
}
|
||||
|
||||
if (MULTIPLAYER_MASTER) {
|
||||
multi_start_packet();
|
||||
@@ -8515,9 +8649,22 @@ void multi_sexp_close_sound_from_file()
|
||||
void sexp_play_sound_from_file(int n)
|
||||
{
|
||||
int loop = 0;
|
||||
int soundfx = 0;
|
||||
int type = ASF_MENUMUSIC;
|
||||
|
||||
// third option, but needed when loading music -
|
||||
soundfx = CDDR(n);
|
||||
|
||||
if (soundfx >= 0) {
|
||||
soundfx = eval_sexp(soundfx);
|
||||
|
||||
if (soundfx > 0) {
|
||||
type = ASF_SOUNDFX;
|
||||
}
|
||||
}
|
||||
|
||||
// load sound file -----------------------------
|
||||
sexp_load_music(CTEXT(n));
|
||||
sexp_load_music(CTEXT(n), type);
|
||||
|
||||
if (MULTIPLAYER_MASTER) {
|
||||
multi_start_packet();
|
||||
@@ -8551,6 +8698,94 @@ void multi_sexp_play_sound_from_file()
|
||||
sexp_start_music(loop);
|
||||
}
|
||||
|
||||
int sexp_sound_environment_option_lookup(char *text)
|
||||
{
|
||||
int i;
|
||||
|
||||
Assert(text != NULL);
|
||||
if (text == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < Num_sound_environment_options; i++) {
|
||||
if (!strcmp(text, Sound_environment_option[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Taylor
|
||||
void sexp_set_sound_environment(int node)
|
||||
{
|
||||
int n;
|
||||
sound_env env;
|
||||
int preset_id = -1;
|
||||
|
||||
char *preset = CTEXT(node);
|
||||
|
||||
if ( preset && !stricmp(preset, SEXP_NONE_STRING) ) {
|
||||
sound_env_disable();
|
||||
return;
|
||||
}
|
||||
|
||||
preset_id = ds_eax_get_preset_id( preset );
|
||||
|
||||
if (preset_id < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fill in defaults for this preset, in case we don't set everything
|
||||
if ( sound_env_get(&env, preset_id) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
n = CDR(node);
|
||||
|
||||
while (n >= 0) {
|
||||
int option = sexp_sound_environment_option_lookup(CTEXT(n));
|
||||
|
||||
float val = (float)eval_num(CDR(n)) / 1000.0f;
|
||||
|
||||
if ( option == SSEO_VOLUME ) {
|
||||
env.volume = val;
|
||||
} else if ( option == SSEO_DECAY_TIME ) {
|
||||
env.decay = val;
|
||||
} else if ( option == SSEO_DAMPING ) {
|
||||
env.damping = val;
|
||||
}
|
||||
|
||||
// move to next option
|
||||
n = CDDR(n);
|
||||
}
|
||||
|
||||
sound_env_set(&env);
|
||||
}
|
||||
|
||||
// Taylor
|
||||
void sexp_update_sound_environment(int node)
|
||||
{
|
||||
int n = node;
|
||||
|
||||
while (n >= 0) {
|
||||
int option = sexp_sound_environment_option_lookup(CTEXT(n));
|
||||
|
||||
float val = (float)eval_num(CDR(n)) / 1000.0f;
|
||||
|
||||
if ( option == SSEO_VOLUME ) {
|
||||
ds_eax_set_volume(val);
|
||||
} else if ( option == SSEO_DECAY_TIME ) {
|
||||
ds_eax_set_decay_time(val);
|
||||
} else if ( option == SSEO_DAMPING ) {
|
||||
ds_eax_set_damping(val);
|
||||
}
|
||||
|
||||
// move to next option
|
||||
n = CDDR(n);
|
||||
}
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
void sexp_explosion_effect(int n)
|
||||
/* From the SEXP help...
|
||||
@@ -8566,7 +8801,7 @@ void sexp_explosion_effect(int n)
|
||||
"\t7: Inner radius to apply damage (if 0, explosion will not be visible)\r\n"
|
||||
"\t8: Outer radius to apply damage (if 0, explosion will not be visible)\r\n"
|
||||
"\t9: Shockwave speed (if 0, there will be no shockwave)\r\n"
|
||||
"\t10: Type (0 = medium, 1 = large1, 2 = large2)\r\n"
|
||||
"\t10: Type (0 = medium, 1 = large1, 2 = large2)\r\n" (otherwise use the index in fireball.tbl - FUBAR)
|
||||
"\t11: Sound (index into sounds.tbl)\r\n"
|
||||
"\t12: EMP intensity (optional)\r\n"
|
||||
"\t13: EMP duration in seconds (optional)" },
|
||||
@@ -8618,11 +8853,13 @@ void sexp_explosion_effect(int n)
|
||||
{
|
||||
fireball_type = FIREBALL_EXPLOSION_LARGE2;
|
||||
}
|
||||
else
|
||||
{
|
||||
else if (eval_num(n) >= Num_fireball_types) {
|
||||
Warning(LOCATION, "explosion-effect type is out of range; quitting the explosion...\n");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
fireball_type = eval_num(n);
|
||||
}
|
||||
n = CDR(n);
|
||||
|
||||
sound_index = eval_num(n);
|
||||
@@ -8644,7 +8881,10 @@ void sexp_explosion_effect(int n)
|
||||
|
||||
|
||||
// play sound effect ---------------------------
|
||||
snd_play_3d( &Snds[sound_index], &origin, &View_position, 0.0f, NULL, 0, 1.0f, SND_PRIORITY_MUST_PLAY );
|
||||
if (sound_index >= 0)
|
||||
{
|
||||
snd_play_3d( &Snds[sound_index], &origin, &View_position, 0.0f, NULL, 0, 1.0f, SND_PRIORITY_MUST_PLAY );
|
||||
}
|
||||
|
||||
|
||||
// create the fireball -------------------------
|
||||
@@ -9793,6 +10033,29 @@ void sexp_mission_set_nebula(int n)
|
||||
stars_set_nebula(eval_num(n) > 0);
|
||||
}
|
||||
|
||||
/* freespace.cpp does not have these availiable externally, and we must call
|
||||
them so that the main simulation loop does not have to constantly check for
|
||||
Game_subspace_effect so that it could turn on the subspace sounds.
|
||||
|
||||
Because these are in freespace.cpp there are also stubs of these functions
|
||||
in fred.cpp as it does not deal with the game loop (obviously) but still
|
||||
links against code.lib. */
|
||||
extern void game_start_subspace_ambient_sound();
|
||||
extern void game_stop_subspace_ambient_sound();
|
||||
|
||||
void sexp_mission_set_subspace(int n)
|
||||
{
|
||||
if (eval_num(n) > 0) {
|
||||
The_mission.flags |= MISSION_FLAG_SUBSPACE;
|
||||
Game_subspace_effect = 1;
|
||||
game_start_subspace_ambient_sound();
|
||||
} else {
|
||||
The_mission.flags &= ~MISSION_FLAG_SUBSPACE;
|
||||
Game_subspace_effect = 0;
|
||||
game_stop_subspace_ambient_sound();
|
||||
}
|
||||
}
|
||||
|
||||
void sexp_add_background_bitmap(int n)
|
||||
{
|
||||
int sexp_var;
|
||||
@@ -9996,6 +10259,17 @@ void sexp_nebula_toggle_poof(int n)
|
||||
// sexpression to end the mission! Fixed by EdrickV, implemented by Sesquipedalian
|
||||
void sexp_end_mission(int n)
|
||||
{
|
||||
int ignore_player_mortality = 1;
|
||||
|
||||
if (n != -1) {
|
||||
ignore_player_mortality = is_sexp_true(n);
|
||||
}
|
||||
|
||||
// if the player is dead we may want to let the death screen handle things
|
||||
if (!ignore_player_mortality && (Player_ship->flags && SF_DYING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
send_debrief_event();
|
||||
|
||||
// Karajorma - callback all the clients here.
|
||||
@@ -15162,7 +15436,7 @@ int sexp_return_player_data(int node, int type)
|
||||
|
||||
case OP_RESPAWNS_LEFT:
|
||||
// Dogfight missions have no respawn limit
|
||||
if ((Game_mode & GM_MULTIPLAYER) && !(Netgame.type_flags & NG_TYPE_DOGFIGHT)) {
|
||||
if (MULTI_NOT_DOGFIGHT) {
|
||||
if ( Net_players[np_index].flags & NETINFO_FLAG_RESPAWNING) {
|
||||
// since the player hasn't actually respawned yet he hasn't used up a number or spawns equal to his deaths
|
||||
// so add an extra life back.
|
||||
@@ -16744,9 +17018,12 @@ int eval_sexp(int cur_node, int referenced_node)
|
||||
sexp_val = sexp_and_in_sequence(node);
|
||||
break;
|
||||
|
||||
case OP_EQUALS:
|
||||
case OP_GREATER_THAN:
|
||||
case OP_LESS_THAN:
|
||||
case OP_EQUALS:
|
||||
case OP_NOT_EQUAL:
|
||||
case OP_GREATER_OR_EQUAL:
|
||||
case OP_LESS_OR_EQUAL:
|
||||
sexp_val = sexp_number_compare( node, op_num );
|
||||
break;
|
||||
|
||||
@@ -16942,6 +17219,10 @@ int eval_sexp(int cur_node, int referenced_node)
|
||||
sexp_val = sexp_mission_time();
|
||||
break;
|
||||
|
||||
case OP_MISSION_TIME_MSECS:
|
||||
sexp_val = sexp_mission_time_msecs();
|
||||
break;
|
||||
|
||||
case OP_TIME_DOCKED:
|
||||
sexp_val = sexp_time_docked(node);
|
||||
break;
|
||||
@@ -17112,6 +17393,13 @@ int eval_sexp(int cur_node, int referenced_node)
|
||||
sexp_val = eval_in_sequence( cur_node, referenced_node );
|
||||
break;
|
||||
|
||||
// Karajorma
|
||||
case OP_INVALIDATE_ALL_ARGUMENTS:
|
||||
case OP_VALIDATE_ALL_ARGUMENTS:
|
||||
sexp_change_all_argument_validity(cur_node, (op_num == OP_INVALIDATE_ALL_ARGUMENTS));
|
||||
sexp_val = SEXP_TRUE;
|
||||
break;
|
||||
|
||||
// Goober5000
|
||||
case OP_INVALIDATE_ARGUMENT:
|
||||
case OP_VALIDATE_ARGUMENT:
|
||||
@@ -17320,6 +17608,16 @@ int eval_sexp(int cur_node, int referenced_node)
|
||||
sexp_val = SEXP_TRUE;
|
||||
break;
|
||||
|
||||
case OP_SET_SOUND_ENVIRONMENT:
|
||||
sexp_set_sound_environment(node);
|
||||
sexp_val = SEXP_TRUE;
|
||||
break;
|
||||
|
||||
case OP_UPDATE_SOUND_ENVIRONMENT:
|
||||
sexp_update_sound_environment(node);
|
||||
sexp_val = SEXP_TRUE;
|
||||
break;
|
||||
|
||||
case OP_HUD_DISABLE:
|
||||
sexp_hud_disable(node);
|
||||
sexp_val = SEXP_TRUE;
|
||||
@@ -17360,6 +17658,11 @@ int eval_sexp(int cur_node, int referenced_node)
|
||||
sexp_val = SEXP_TRUE;
|
||||
break;
|
||||
|
||||
case OP_HUD_DISPLAY_GAUGE:
|
||||
sexp_hud_display_gauge(node);
|
||||
sexp_val = SEXP_TRUE;
|
||||
break;
|
||||
|
||||
// Goober5000
|
||||
case OP_PLAYER_USE_AI:
|
||||
case OP_PLAYER_NOT_USE_AI:
|
||||
@@ -17491,6 +17794,11 @@ int eval_sexp(int cur_node, int referenced_node)
|
||||
sexp_val = SEXP_TRUE;
|
||||
break;
|
||||
|
||||
case OP_MISSION_SET_SUBSPACE:
|
||||
sexp_mission_set_subspace(node);
|
||||
sexp_val = SEXP_TRUE;
|
||||
break;
|
||||
|
||||
case OP_ADD_BACKGROUND_BITMAP:
|
||||
sexp_add_background_bitmap(node);
|
||||
sexp_val = SEXP_TRUE;
|
||||
@@ -18684,6 +18992,9 @@ int query_operator_return_type(int op)
|
||||
case OP_EQUALS:
|
||||
case OP_GREATER_THAN:
|
||||
case OP_LESS_THAN:
|
||||
case OP_NOT_EQUAL:
|
||||
case OP_GREATER_OR_EQUAL:
|
||||
case OP_LESS_OR_EQUAL:
|
||||
case OP_STRING_EQUALS:
|
||||
case OP_STRING_GREATER_THAN:
|
||||
case OP_STRING_LESS_THAN:
|
||||
@@ -18796,6 +19107,7 @@ int query_operator_return_type(int op)
|
||||
case OP_TIME_WING_ARRIVED:
|
||||
case OP_TIME_WING_DEPARTED:
|
||||
case OP_MISSION_TIME:
|
||||
case OP_MISSION_TIME_MSECS:
|
||||
case OP_TIME_DOCKED:
|
||||
case OP_TIME_UNDOCKED:
|
||||
case OP_AFTERBURNER_LEFT:
|
||||
@@ -18842,6 +19154,8 @@ int query_operator_return_type(int op)
|
||||
case OP_EVERY_TIME_ARGUMENT:
|
||||
case OP_INVALIDATE_ARGUMENT:
|
||||
case OP_VALIDATE_ARGUMENT:
|
||||
case OP_INVALIDATE_ALL_ARGUMENTS:
|
||||
case OP_VALIDATE_ALL_ARGUMENTS:
|
||||
case OP_DO_FOR_VALID_ARGUMENTS:
|
||||
case OP_CHANGE_IFF:
|
||||
case OP_CHANGE_AI_CLASS:
|
||||
@@ -18973,6 +19287,8 @@ int query_operator_return_type(int op)
|
||||
case OP_PLAY_SOUND_FROM_FILE:
|
||||
case OP_CLOSE_SOUND_FROM_FILE:
|
||||
case OP_PLAY_SOUND_FROM_TABLE:
|
||||
case OP_SET_SOUND_ENVIRONMENT:
|
||||
case OP_UPDATE_SOUND_ENVIRONMENT:
|
||||
case OP_EXPLOSION_EFFECT:
|
||||
case OP_WARP_EFFECT:
|
||||
case OP_SET_OBJECT_POSITION:
|
||||
@@ -19081,6 +19397,8 @@ int query_operator_return_type(int op)
|
||||
case OP_SET_POST_EFFECT:
|
||||
case OP_CHANGE_IFF_COLOR:
|
||||
case OP_REMOVE_WEAPONS:
|
||||
case OP_MISSION_SET_SUBSPACE:
|
||||
case OP_HUD_DISPLAY_GAUGE:
|
||||
return OPR_NULL;
|
||||
|
||||
case OP_AI_CHASE:
|
||||
@@ -19148,6 +19466,7 @@ int query_operator_argument_type(int op, int argnum)
|
||||
case OP_TRUE:
|
||||
case OP_FALSE:
|
||||
case OP_MISSION_TIME:
|
||||
case OP_MISSION_TIME_MSECS:
|
||||
/* case OP_INT3: */
|
||||
case OP_NOP:
|
||||
case OP_WAYPOINT_MISSED:
|
||||
@@ -19159,6 +19478,8 @@ int query_operator_argument_type(int op, int argnum)
|
||||
case OP_END_MISSION:
|
||||
case OP_FORCE_JUMP:
|
||||
case OP_RESET_ORDERS:
|
||||
case OP_INVALIDATE_ALL_ARGUMENTS:
|
||||
case OP_VALIDATE_ALL_ARGUMENTS:
|
||||
return OPF_NONE;
|
||||
|
||||
case OP_AND:
|
||||
@@ -19175,6 +19496,9 @@ int query_operator_argument_type(int op, int argnum)
|
||||
case OP_EQUALS:
|
||||
case OP_GREATER_THAN:
|
||||
case OP_LESS_THAN:
|
||||
case OP_NOT_EQUAL:
|
||||
case OP_GREATER_OR_EQUAL:
|
||||
case OP_LESS_OR_EQUAL:
|
||||
case OP_RAND:
|
||||
case OP_RAND_MULTIPLE:
|
||||
case OP_ABS:
|
||||
@@ -19197,6 +19521,7 @@ int query_operator_argument_type(int op, int argnum)
|
||||
case OP_TEAM_SCORE:
|
||||
case OP_HUD_SET_MAX_TARGETING_RANGE:
|
||||
case OP_MISSION_SET_NEBULA: //WMC
|
||||
case OP_MISSION_SET_SUBSPACE:
|
||||
return OPF_POSITIVE;
|
||||
|
||||
case OP_AI_WARP: // this operator is obsolete
|
||||
@@ -19710,6 +20035,24 @@ int query_operator_argument_type(int op, int argnum)
|
||||
case OP_CLOSE_SOUND_FROM_FILE:
|
||||
return OPF_BOOL;
|
||||
|
||||
case OP_SET_SOUND_ENVIRONMENT:
|
||||
if (argnum == 0)
|
||||
return OPF_SOUND_ENVIRONMENT;
|
||||
|
||||
// fall through
|
||||
argnum--;
|
||||
|
||||
case OP_UPDATE_SOUND_ENVIRONMENT:
|
||||
{
|
||||
// every two, the value repeats
|
||||
int a_mod = argnum % 2;
|
||||
|
||||
if (a_mod == 0)
|
||||
return OPF_SOUND_ENVIRONMENT_OPTION;
|
||||
else
|
||||
return OPF_POSITIVE;
|
||||
}
|
||||
|
||||
case OP_HUD_DISABLE:
|
||||
case OP_HUD_DISABLE_EXCEPT_MESSAGES:
|
||||
return OPF_POSITIVE;
|
||||
@@ -19755,10 +20098,9 @@ int query_operator_argument_type(int op, int argnum)
|
||||
return OPF_MESSAGE;
|
||||
|
||||
case OP_SEND_MESSAGE_LIST:
|
||||
int a_mod;
|
||||
|
||||
{
|
||||
// every four, the value repeats
|
||||
a_mod = argnum % 4;
|
||||
int a_mod = argnum % 4;
|
||||
|
||||
// who from
|
||||
if(a_mod == 0)
|
||||
@@ -19769,6 +20111,7 @@ int query_operator_argument_type(int op, int argnum)
|
||||
return OPF_MESSAGE;
|
||||
else if(a_mod == 3)
|
||||
return OPF_POSITIVE;
|
||||
}
|
||||
|
||||
case OP_TRAINING_MSG:
|
||||
if (argnum < 2)
|
||||
@@ -20619,6 +20962,13 @@ int query_operator_argument_type(int op, int argnum)
|
||||
return OPF_POSITIVE;
|
||||
else return OPF_SHIP_WING;
|
||||
|
||||
case OP_HUD_DISPLAY_GAUGE:
|
||||
if ( argnum == 0 ) {
|
||||
return OPF_POSITIVE;
|
||||
} else {
|
||||
return OPF_HUD_ELEMENT;
|
||||
}
|
||||
|
||||
default:
|
||||
Int3();
|
||||
}
|
||||
@@ -21065,6 +21415,15 @@ char *sexp_error_message(int num)
|
||||
|
||||
case SEXP_CHECK_INVALID_FONT:
|
||||
return "Invalid font";
|
||||
|
||||
case SEXP_CHECK_INVALID_HUD_ELEMENT:
|
||||
return "Invalid hud element magic name";
|
||||
|
||||
case SEXP_CHECK_INVALID_SOUND_ENVIRONMENT:
|
||||
return "Invalid sound environment";
|
||||
|
||||
case SEXP_CHECK_INVALID_SOUND_ENVIRONMENT_OPTION:
|
||||
return "Invalid sound environment option";
|
||||
}
|
||||
|
||||
sprintf(Sexp_error_text, "Sexp error code %d", num);
|
||||
@@ -21843,6 +22202,8 @@ int get_subcategory(int sexp_id)
|
||||
case OP_PLAY_SOUND_FROM_TABLE:
|
||||
case OP_PLAY_SOUND_FROM_FILE:
|
||||
case OP_CLOSE_SOUND_FROM_FILE:
|
||||
case OP_SET_SOUND_ENVIRONMENT:
|
||||
case OP_UPDATE_SOUND_ENVIRONMENT:
|
||||
return CHANGE_SUBCATEGORY_MUSIC_AND_SOUND;
|
||||
|
||||
case OP_ADD_REMOVE_ESCORT:
|
||||
@@ -21880,6 +22241,7 @@ int get_subcategory(int sexp_id)
|
||||
case OP_NEBULA_TOGGLE_POOF:
|
||||
case OP_SET_AMBIENT_LIGHT:
|
||||
case OP_SET_POST_EFFECT:
|
||||
case OP_MISSION_SET_SUBSPACE:
|
||||
return CHANGE_SUBCATEGORY_BACKGROUND_AND_NEBULA;
|
||||
|
||||
case OP_HUD_DISABLE:
|
||||
@@ -21890,6 +22252,7 @@ int get_subcategory(int sexp_id)
|
||||
case OP_HUD_SET_FRAME:
|
||||
case OP_HUD_SET_COLOR:
|
||||
case OP_HUD_SET_MAX_TARGETING_RANGE:
|
||||
case OP_HUD_DISPLAY_GAUGE:
|
||||
return CHANGE_SUBCATEGORY_HUD;
|
||||
|
||||
case OP_CUTSCENES_SET_CUTSCENE_BARS:
|
||||
@@ -22196,11 +22559,23 @@ sexp_help_struct Sexp_help[] = {
|
||||
"Returns a boolean value. Takes 2 or more numeric arguments." },
|
||||
|
||||
{ OP_GREATER_THAN, "Greater Than (Boolean operator)\r\n"
|
||||
"\tTrue if the first argument is greater than the second argument.\r\n\r\n"
|
||||
"\tTrue if the first argument is greater than the subsequent argument(s).\r\n\r\n"
|
||||
"Returns a boolean value. Takes 2 numeric arguments." },
|
||||
|
||||
{ OP_LESS_THAN, "Less Than (Boolean operator)\r\n"
|
||||
"\tTrue if the first argument is less than the second argument.\r\n\r\n"
|
||||
"\tTrue if the first argument is less than the subsequent argument(s).\r\n\r\n"
|
||||
"Returns a boolean value. Takes 2 numeric arguments." },
|
||||
|
||||
{ OP_NOT_EQUAL, "Not Equal To (Boolean operator)\r\n"
|
||||
"\tIs true if the first argument is not equal to any of the subsequent arguments.\r\n\r\n"
|
||||
"Returns a boolean value. Takes 2 or more numeric arguments." },
|
||||
|
||||
{ OP_GREATER_OR_EQUAL, "Greater Than Or Equal To (Boolean operator)\r\n"
|
||||
"\tTrue if the first argument is greater than or equal to the subsequent argument(s).\r\n\r\n"
|
||||
"Returns a boolean value. Takes 2 numeric arguments." },
|
||||
|
||||
{ OP_LESS_OR_EQUAL, "Less Than Or Equal To (Boolean operator)\r\n"
|
||||
"\tTrue if the first argument is less than or equal to the subsequent argument(s).\r\n\r\n"
|
||||
"Returns a boolean value. Takes 2 numeric arguments." },
|
||||
|
||||
// Goober5000
|
||||
@@ -22469,7 +22844,11 @@ sexp_help_struct Sexp_help[] = {
|
||||
|
||||
{ OP_MISSION_TIME, "Mission time (Time operator)\r\n"
|
||||
"\tReturns the current time into the mission.\r\n\r\n"
|
||||
"Returns a numeric value." },
|
||||
"Returns a numeric value. Takes no arguments." },
|
||||
|
||||
{ OP_MISSION_TIME_MSECS, "Mission time, in milliseconds (Time operator)\r\n"
|
||||
"\tReturns the current time into the mission, in milliseconds. Useful for more fine-grained timing than possible with normal second-based sexps. (Tip: when an event occurs, assign the result of mission-time-msecs to a variable. Then, in another event, wait until mission-time-msecs is greater than the value of that variable plus some delay amount. This second event should be chained or coupled with additional conditions so that it doesn't accidentally fire on an uninitialized variable!)\r\n\r\n"
|
||||
"Returns a numeric value. Takes no arguments." },
|
||||
|
||||
{ OP_TIME_DOCKED, "Time docked (Time operator)\r\n"
|
||||
"\tReturns the time the specified ships docked.\r\n\r\n"
|
||||
@@ -22682,6 +23061,17 @@ sexp_help_struct Sexp_help[] = {
|
||||
"Takes 1 or more arguments...\r\n"
|
||||
"\tAll:\tThe argument to restore to the preceding argument list." },
|
||||
|
||||
// Karajorma
|
||||
{ OP_INVALIDATE_ALL_ARGUMENTS, "Invalidate-all-arguments (Conditional operator)\r\n"
|
||||
"\tRemoves all argument from future consideration as " SEXP_ARGUMENT_STRING " special data items.\r\n"
|
||||
"Takes no arguments." },
|
||||
|
||||
// Karajorma
|
||||
{ OP_VALIDATE_ALL_ARGUMENTS, "Validate-all-arguments (Conditional operator)\r\n"
|
||||
"\tRestores all arguments for future consideration as " SEXP_ARGUMENT_STRING " special data items.\r\n"
|
||||
"\tIf the argument hasn't been previously invalidated, it will do nothing.\r\n"
|
||||
"Takes no arguments." },
|
||||
|
||||
// Goober5000 - added wing capability
|
||||
{ OP_CHANGE_IFF, "Change IFF (Action operator)\r\n"
|
||||
"\tSets the specified ship(s) or wing(s) to the specified team.\r\n"
|
||||
@@ -22914,9 +23304,10 @@ sexp_help_struct Sexp_help[] = {
|
||||
// Goober5000
|
||||
{ OP_PLAY_SOUND_FROM_FILE, "play-sound-from-file\r\n"
|
||||
"\tPlays a sound, such as a music soundtrack, from a file. Important: Only one sound at a time can be played with this sexp!\r\n"
|
||||
"Takes 1 or 2 arguments...\r\n"
|
||||
"Takes 1 to 3 arguments...\r\n"
|
||||
"\t1: Sound (file name)\r\n"
|
||||
"\t2: Enter a non-zero number to loop. default is off (optional)."
|
||||
"\t2: Enter a non-zero number to loop. default is off (optional).\r\n"
|
||||
"\t3: Enter a non-zero number to use environment effects. default is off (optional)."
|
||||
},
|
||||
|
||||
// Goober5000
|
||||
@@ -22924,6 +23315,23 @@ sexp_help_struct Sexp_help[] = {
|
||||
"\tCloses the currently playing sound started by play-sound-from-file, if there is any. Takes 1 argument...\r\n"
|
||||
"\t1: Fade (default is true)" },
|
||||
|
||||
// Taylor
|
||||
{ OP_SET_SOUND_ENVIRONMENT, "set-sound-environment\r\n"
|
||||
"Sets the EAX environment for all sound effects. Optionally sets one or more parameters specific to the environment. Takes 1 or more arguments...\r\n"
|
||||
"\t1:\tSound environment name (a value of \"" SEXP_NONE_STRING "\" will disable the effects)\r\n"
|
||||
"\t2:\tEnvironment option (optional)\r\n"
|
||||
"\t3:\tEnvironment value x 1000, e.g. 10 is 0.01 (optional)\r\n"
|
||||
"Use Add-Data to specify additional environment options in repeating option-value pairs, just like Send-Message-List can have additional messages in source-priority-message-delay groups.\r\n\r\n"
|
||||
"IMPORTANT: each additional option in the list MUST HAVE two entries; any option without the two proper fields will be ignored, as will any successive options." },
|
||||
|
||||
// Taylor
|
||||
{ OP_UPDATE_SOUND_ENVIRONMENT, "update-sound-environment\r\n"
|
||||
"Updates the current EAX environment with new values. Takes 2 or more arguments...\r\n"
|
||||
"\t1:\tEnvironment option\r\n"
|
||||
"\t2:\tEnvironment value x 1000, e.g. 10 is 0.01\r\n"
|
||||
"Use Add-Data to specify additional environment options in repeating option-value pairs, just like Send-Message-List can have additional messages in source-priority-message-delay groups.\r\n\r\n"
|
||||
"IMPORTANT: Each additional option in the list MUST HAVE two entries; any option without the two proper fields will be ignored, as will any successive options." },
|
||||
|
||||
// Goober5000
|
||||
{ OP_EXPLOSION_EFFECT, "explosion-effect\r\n"
|
||||
"\tCauses an explosion at a given origin, with the given parameters. "
|
||||
@@ -22937,7 +23345,8 @@ sexp_help_struct Sexp_help[] = {
|
||||
"\t7: Inner radius to apply damage (if 0, explosion will not be visible)\r\n"
|
||||
"\t8: Outer radius to apply damage (if 0, explosion will not be visible)\r\n"
|
||||
"\t9: Shockwave speed (if 0, there will be no shockwave)\r\n"
|
||||
"\t10: Type (0 = medium, 1 = large1, 2 = large2)\r\n"
|
||||
"\t10: Type - For backward compatibility 0 = medium, 1 = large1 (4th in table), 2 = large2 (5th in table)\r\n"
|
||||
" 3 or greater link to respctive entry in fireball.tbl\r\n"
|
||||
"\t11: Sound (index into sounds.tbl)\r\n"
|
||||
"\t12: EMP intensity (optional)\r\n"
|
||||
"\t13: EMP duration in seconds (optional)" },
|
||||
@@ -23631,10 +24040,15 @@ sexp_help_struct Sexp_help[] = {
|
||||
"\tTakes1 argument...\r\n"
|
||||
"\t1:\t0 for nebula off, 1 for nebula on" },
|
||||
|
||||
{ OP_MISSION_SET_SUBSPACE, "mission-set-subspace\r\n"
|
||||
"\tTurns subspace on/off\r\n"
|
||||
"\tTakes 1 argument...\r\n"
|
||||
"\r1:\t0 for subspace off, 1 for subspace on" },
|
||||
|
||||
//-Sesquipedalian
|
||||
{ OP_END_MISSION, "end-mission\r\n"
|
||||
"\tEnds the mission as if the player had engaged his subspace drive, but without him doing so. Dumps the player back into a normal debriefing. Does not invoke red-alert status.\r\n"
|
||||
"Takes no arguments." },
|
||||
"\t1:\t(optional)End Mission even if the player is dead (defaults to true)" },
|
||||
|
||||
// Goober5000
|
||||
{ OP_FORCE_JUMP, "force-jump\r\n"
|
||||
@@ -23908,15 +24322,15 @@ sexp_help_struct Sexp_help[] = {
|
||||
"\t2: Range, in meters\r\n" },
|
||||
|
||||
{ OP_SEND_MESSAGE_LIST, "send-message-list\r\n"
|
||||
"\tSends a series of delayed messages. All times are accumulated"
|
||||
"\tSends a series of delayed messages. All times are accumulated.\r\n"
|
||||
"\t1:\tName of who the message is from.\r\n"
|
||||
"\t2:\tPriority of message (\"Low\", \"Normal\" or \"High\").\r\n"
|
||||
"\t3:\tName of message (from message editor).\r\n"
|
||||
"\t4:\tDelay from previous message in list (if any) in ms\r\n"
|
||||
"Use Add-Data for multiple messages"
|
||||
"IMPORTANT : each additional message in the list MUST HAVE 4 entries;\r\n"
|
||||
"any message without the 4 proper fields will be ignored, as will any\r\n"
|
||||
"successive messages"},
|
||||
"Use Add-Data for multiple messages.\r\n\r\n"
|
||||
"IMPORTANT: Each additional message in the list MUST HAVE four entries; "
|
||||
"any message without the four proper fields will be ignored, as will any "
|
||||
"successive messages."},
|
||||
|
||||
{ OP_CAP_WAYPOINT_SPEED, "cap-waypoint-speed\r\n"
|
||||
"\tSets the maximum speed of a ship while flying waypoints.\r\n"
|
||||
@@ -24379,6 +24793,14 @@ sexp_help_struct Sexp_help[] = {
|
||||
"\1: Maximum targeting distance (0 for infinite)\r\n"
|
||||
},
|
||||
|
||||
{ OP_HUD_DISPLAY_GAUGE, "hud-display-gauge <milliseconds> <gauge>\r\n"
|
||||
"\tCauses specified hud gauge to appear or disappear for so many milliseconds. Takes 1 argument...\r\n"
|
||||
"\t1: Number of milliseconds that the warpout gauge should appear on the HUD."
|
||||
" 0 will immediately cause the gauge to disappear.\r\n"
|
||||
"\t2: Name of HUD element. Must be one of:\r\n"
|
||||
"\t\t" SEXP_HUD_GAUGE_WARPOUT " - the \"Subspace drive active\" box that appears above the viewscreen.\r\n"
|
||||
},
|
||||
|
||||
// Goober5000
|
||||
{ OP_PLAYER_USE_AI, "player-use-ai\r\n"
|
||||
"\tCauses the player's ship to be controlled by the FreeSpace AI. Takes 0 arguments.\r\n"
|
||||
|
||||
+33
-3
@@ -114,6 +114,9 @@ struct ship;
|
||||
#define OPF_TARGET_PRIORITIES 68 // FUBAR - Target priority groups
|
||||
#define OPF_ARMOR_TYPES 69 // FUBAR - Armor type or <none>
|
||||
#define OPF_FONT 70 // Goober5000 - a FreeSpace font
|
||||
#define OPF_HUD_ELEMENT 71 // A magic name of a specific HUD element
|
||||
#define OPF_SOUND_ENVIRONMENT 72 // Goober5000 - one of EFX_presets, per Taylor
|
||||
#define OPF_SOUND_ENVIRONMENT_OPTION 73 // Goober5000 - one of Taylor's options
|
||||
|
||||
// Operand return types
|
||||
#define OPR_NUMBER 1 // returns number
|
||||
@@ -227,6 +230,9 @@ struct ship;
|
||||
#define OP_STRING_EQUALS (0x000a | OP_CATEGORY_LOGICAL)
|
||||
#define OP_STRING_GREATER_THAN (0x000b | OP_CATEGORY_LOGICAL)
|
||||
#define OP_STRING_LESS_THAN (0x000c | OP_CATEGORY_LOGICAL)
|
||||
#define OP_NOT_EQUAL (0x000d | OP_CATEGORY_LOGICAL) // Goober5000
|
||||
#define OP_GREATER_OR_EQUAL (0x000e | OP_CATEGORY_LOGICAL) // Goober5000
|
||||
#define OP_LESS_OR_EQUAL (0x000f | OP_CATEGORY_LOGICAL) // Goober5000
|
||||
|
||||
#define OP_GOAL_INCOMPLETE (0x0000 | OP_CATEGORY_GOAL_EVENT | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_GOAL_TRUE_DELAY (0x0001 | OP_CATEGORY_GOAL_EVENT | OP_NONCAMPAIGN_FLAG)
|
||||
@@ -264,8 +270,9 @@ struct ship;
|
||||
#define OP_TIME_WING_ARRIVED (0x0004 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_TIME_WING_DEPARTED (0x0005 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_MISSION_TIME (0x0006 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_TIME_DOCKED (0x0007 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_TIME_UNDOCKED (0x0008 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_MISSION_TIME_MSECS (0x0007 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG) // Goober5000
|
||||
#define OP_TIME_DOCKED (0x0008 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_TIME_UNDOCKED (0x0009 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG)
|
||||
|
||||
#define OP_SHIELDS_LEFT (0x0000 | OP_CATEGORY_STATUS | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_HITS_LEFT (0x0001 | OP_CATEGORY_STATUS | OP_NONCAMPAIGN_FLAG)
|
||||
@@ -347,6 +354,8 @@ struct ship;
|
||||
#define OP_IN_SEQUENCE (0x000a | OP_CATEGORY_CONDITIONAL) // Karajorma
|
||||
#define OP_VALIDATE_ARGUMENT (0x000b | OP_CATEGORY_CONDITIONAL) // Karajorma
|
||||
#define OP_DO_FOR_VALID_ARGUMENTS (0x000c | OP_CATEGORY_CONDITIONAL) // Karajorma
|
||||
#define OP_INVALIDATE_ALL_ARGUMENTS (0x000d | OP_CATEGORY_CONDITIONAL) // Karajorma
|
||||
#define OP_VALIDATE_ALL_ARGUMENTS (0x000e | OP_CATEGORY_CONDITIONAL) // Karajorma
|
||||
|
||||
|
||||
// sexpressions with side-effects
|
||||
@@ -575,6 +584,10 @@ struct ship;
|
||||
#define OP_SET_ARMOR_TYPE (0x00d2 | OP_CATEGORY_CHANGE | OP_NONCAMPAIGN_FLAG) // FUBAR
|
||||
#define OP_CUTSCENES_SHOW_SUBTITLE_TEXT (0x00d3 | OP_CATEGORY_CHANGE | OP_NONCAMPAIGN_FLAG) // Goober5000
|
||||
#define OP_CUTSCENES_SHOW_SUBTITLE_IMAGE (0x00d4 | OP_CATEGORY_CHANGE | OP_NONCAMPAIGN_FLAG) // Goober5000
|
||||
#define OP_MISSION_SET_SUBSPACE (0x00d5 | OP_CATEGORY_CHANGE | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_HUD_DISPLAY_GAUGE (0x00d6 | OP_CATEGORY_CHANGE | OP_NONCAMPAIGN_FLAG)
|
||||
#define OP_SET_SOUND_ENVIRONMENT (0x00d7 | OP_CATEGORY_CHANGE | OP_NONCAMPAIGN_FLAG) // Taylor
|
||||
#define OP_UPDATE_SOUND_ENVIRONMENT (0x00d8 | OP_CATEGORY_CHANGE | OP_NONCAMPAIGN_FLAG) // Taylor
|
||||
|
||||
/* made obsolete by Goober5000
|
||||
// debugging sexpressions
|
||||
@@ -840,6 +853,9 @@ char *CTEXT(int n);
|
||||
#define SEXP_CHECK_INVALID_VARIABLE_TYPE -140
|
||||
#define SEXP_CHECK_INVALID_SUBSYS_TYPE -141
|
||||
#define SEXP_CHECK_INVALID_FONT -142
|
||||
#define SEXP_CHECK_INVALID_HUD_ELEMENT -143
|
||||
#define SEXP_CHECK_INVALID_SOUND_ENVIRONMENT -144
|
||||
#define SEXP_CHECK_INVALID_SOUND_ENVIRONMENT_OPTION -145
|
||||
|
||||
#define TRAINING_CONTEXT_SPEED (1<<0)
|
||||
#define TRAINING_CONTEXT_FLY_PATH (1<<1)
|
||||
@@ -1039,7 +1055,21 @@ extern int Num_submenus;
|
||||
//Outputs sexp.html file
|
||||
bool output_sexps(char *filepath);
|
||||
|
||||
|
||||
void multi_sexp_eval();
|
||||
|
||||
// Goober5000/Taylor
|
||||
extern int Num_sound_environment_options;
|
||||
extern char *Sound_environment_option[];
|
||||
|
||||
/** Global state variables for the hud-display-gauge sexp.
|
||||
They all should be named Sexp_hud_display_*;
|
||||
They all should follow the following symantics for the value of the
|
||||
variable:
|
||||
=0 don't show
|
||||
=1 show until canceled
|
||||
>1 timestamp when gauge should stop showing (set zero when expired)
|
||||
\sa sexp_hud_display_warpout
|
||||
*/
|
||||
extern int Sexp_hud_display_warpout;
|
||||
|
||||
#endif
|
||||
+17
-13
@@ -687,7 +687,20 @@ void physics_read_flying_controls( matrix * orient, physics_info * pi, control_i
|
||||
if ( pi->flags & PF_REDUCED_DAMP ) {
|
||||
ramp_time_const *= reduced_damp_ramp_time_expansion;
|
||||
}
|
||||
pi->prev_ramp_vel.xyz.z = velocity_ramp( pi->prev_ramp_vel.xyz.z, goal_vel.xyz.z, ramp_time_const, sim_time);
|
||||
pi->prev_ramp_vel.xyz.z = velocity_ramp(pi->prev_ramp_vel.xyz.z, goal_vel.xyz.z, ramp_time_const, sim_time);
|
||||
|
||||
//Deternine the current dynamic glide cap, and ramp to it
|
||||
//This is outside the normal "glide" block since we want the cap to adjust whether or not the ship is in glide mode
|
||||
float dynamic_glide_cap_goal = 0.0;
|
||||
if (pi->flags & PF_AFTERBURNER_ON) {
|
||||
dynamic_glide_cap_goal = ( goal_vel.xyz.z >= 0.0f ) ? pi->afterburner_max_vel.xyz.z : pi->afterburner_max_reverse_vel;
|
||||
}
|
||||
else {
|
||||
//Use the maximum value in X, Y, and Z (including overclocking)
|
||||
dynamic_glide_cap_goal = MAX(MAX(pi->max_vel.xyz.x,pi->max_vel.xyz.y), pi->max_vel.xyz.z);
|
||||
}
|
||||
pi->cur_glide_cap = velocity_ramp(pi->cur_glide_cap, dynamic_glide_cap_goal, ramp_time_const, sim_time);
|
||||
|
||||
|
||||
if ( pi->flags & PF_GLIDING ) {
|
||||
pi->desired_vel = pi->vel;
|
||||
@@ -699,19 +712,10 @@ void physics_read_flying_controls( matrix * orient, physics_info * pi, control_i
|
||||
|
||||
//Having pi->glide_cap == 0 means we're using a dynamic glide cap
|
||||
float curGlideCap = 0.0f;
|
||||
if (pi->glide_cap == 0.0f) {
|
||||
//For dynamic glide capping, normal flight and afterburner have separate glide caps
|
||||
if (pi->flags & PF_AFTERBURNER_ON) {
|
||||
curGlideCap = pi->afterburner_max_vel.xyz.z;
|
||||
}
|
||||
else {
|
||||
//Take the maximum value in X, Y, and Z (including overclocking)
|
||||
curGlideCap = MAX(MAX(pi->max_vel.xyz.x,pi->max_vel.xyz.y), pi->max_vel.xyz.z);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (pi->glide_cap == 0.0f)
|
||||
curGlideCap = pi->cur_glide_cap;
|
||||
else
|
||||
curGlideCap = pi->glide_cap;
|
||||
}
|
||||
|
||||
//If we're near the (positive) glide cap, decay velocity where we aren't thrusting
|
||||
//This is a hack, but makes the flight feel a lot smoother
|
||||
|
||||
@@ -85,8 +85,8 @@ typedef struct physics_info {
|
||||
int shockwave_decay; // timestamp used to control how long ship affected after hit by shockwave
|
||||
int reduced_damp_decay; // timestamp used to control how long ship ship has reduced damp physics
|
||||
|
||||
vec3d glide_saved_vel; //WMC - the key variable for gliding. Saves the orientation that velocity will be applied on.
|
||||
float glide_cap; //Backslash - for 'newtonian'-style gliding, the cap on velocity (so that something can't accelerate to ridiculous speeds... unless allowed to)
|
||||
float cur_glide_cap; //SUSHI: Used for dynamic glide cap, so we can use the ramping function on the glide cap
|
||||
float glide_accel_mult; //SUSHI: The acceleration multiplier for glide mode. A value < 0 means use glide ramping instead
|
||||
bool use_newtonian_damp; //SUSHI: Whether or not to use newtonian dampening
|
||||
float afterburner_max_reverse_vel; //SparK: This is the reverse afterburners top speed vector
|
||||
|
||||
@@ -87,7 +87,9 @@ void chase_angles_to_value(angles *ap, angles *bp, int scale)
|
||||
if ((ap->p == bp->p) && (ap->h == bp->h))
|
||||
return;
|
||||
|
||||
sk = 1.0f - scale*flFrametime;
|
||||
sk = 1.0f - scale*flRealframetime;
|
||||
|
||||
CLAMP(sk, 0.0f, 1.0f);
|
||||
|
||||
delta.p = ap->p - bp->p;
|
||||
delta.h = ap->h - bp->h;
|
||||
@@ -629,7 +631,11 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
|
||||
if (!(Objects[Player->objnum].phys_info.flags & PF_GLIDING)) {
|
||||
//pmax_speed = Ship_info[Ships[Player_obj->instance].ship_info_index].max_speed;
|
||||
pmax_speed = Ships[Player_obj->instance].current_max_speed;
|
||||
ci->forward_cruise_percent = (tspeed / pmax_speed) * 100.0f;
|
||||
if (pmax_speed > 0.0f) {
|
||||
ci->forward_cruise_percent = (tspeed / pmax_speed) * 100.0f;
|
||||
} else {
|
||||
ci->forward_cruise_percent = 0.0f;
|
||||
}
|
||||
override_analog_throttle = 1;
|
||||
//if ( ci->forward_cruise_percent > 100.0f )
|
||||
//HUD_printf ("Cannot travel that fast. Setting throttle to full.");
|
||||
@@ -757,7 +763,7 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
|
||||
ci->fire_secondary_count++;
|
||||
|
||||
// if we're a multiplayer client, set our accum bits now
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)){
|
||||
if( MULTIPLAYER_CLIENT && (Net_player != NULL)){
|
||||
Net_player->s_info.accum_buttons |= OOC_FIRE_SECONDARY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,29 +412,10 @@ int popupdead_do_frame(float frametime)
|
||||
{
|
||||
int k, choice;
|
||||
|
||||
/*
|
||||
if (Popupdead_skip_active) {
|
||||
// do the skip mission popup, and thats all
|
||||
if (popupdead_skip_do_frame() == 1) {
|
||||
return 2; // fake the "go to briefing" choice
|
||||
} else {
|
||||
return -1; // fake no choice
|
||||
}
|
||||
}
|
||||
*/
|
||||
if ( !Popupdead_active ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// don't let dude skip 3-09. hack.
|
||||
if(Game_mode & GM_CAMPAIGN_MODE){
|
||||
if((Campaign.current_mission >= 0) && (Campaign.current_mission < MAX_CAMPAIGN_MISSIONS)){
|
||||
if ((Campaign.missions[Campaign.current_mission].name != NULL) && !stricmp(Campaign.missions[Campaign.current_mission].name, "sm3-09.fs2")) {
|
||||
Popupdead_skip_already_shown = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// maybe show skip mission popup
|
||||
if ((!Popupdead_skip_already_shown) && (Player->show_skip_popup) && (Game_mode & GM_NORMAL) && (Game_mode & GM_CAMPAIGN_MODE) && (Player->failures_this_session >= PLAYER_MISSION_FAILURE_LIMIT)) {
|
||||
int popup_choice = popup(0, 3, XSTR("Do Not Skip This Mission", 1473),
|
||||
|
||||
@@ -87,13 +87,6 @@ void afterburners_start(object *objp)
|
||||
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes );
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
// When the ship has no afterburner, leave without doing anything.
|
||||
// Caller should have tested ship equipment before deciding to start afterburners.
|
||||
if ( !(sip->flags & SIF_AFTERBURNER) ) {
|
||||
nprintf(("Warning","Ship type %s does not have afterburner capability\n", sip->name));
|
||||
return;
|
||||
}
|
||||
|
||||
// bail if afterburners are locked
|
||||
if (shipp->flags2 & SF2_AFTERBURNER_LOCKED) {
|
||||
return;
|
||||
@@ -121,6 +114,10 @@ void afterburners_start(object *objp)
|
||||
if (objp->phys_info.flags & PF_BOOSTER_ON)
|
||||
return;
|
||||
|
||||
if ( !(sip->flags & SIF_AFTERBURNER) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if there is enough afterburner fuel
|
||||
if ( (shipp->afterburner_fuel < MIN_AFTERBURNER_FUEL_TO_ENGAGE) && !MULTIPLAYER_CLIENT ) {
|
||||
if ( objp == Player_obj ) {
|
||||
|
||||
+167
-94
@@ -1170,6 +1170,8 @@ int parse_ship_values(ship_info* sip, bool isTemplate, bool first_time, bool rep
|
||||
|
||||
if (valid)
|
||||
strcpy_s(sip->cockpit_pof_file, temp);
|
||||
else
|
||||
WarningEx(LOCATION, "Ship %s\nCockpit POF file \"%s\" invalid!", sip->name, temp);
|
||||
}
|
||||
if(optional_string( "+Cockpit offset:" ))
|
||||
{
|
||||
@@ -1192,6 +1194,8 @@ int parse_ship_values(ship_info* sip, bool isTemplate, bool first_time, bool rep
|
||||
|
||||
if (valid)
|
||||
strcpy_s(sip->pof_file, temp);
|
||||
else
|
||||
WarningEx(LOCATION, "Ship %s\nPOF file \"%s\" invalid!", sip->name, temp);
|
||||
}
|
||||
|
||||
// ship class texture replacement - Goober5000 and taylor
|
||||
@@ -1253,6 +1257,8 @@ int parse_ship_values(ship_info* sip, bool isTemplate, bool first_time, bool rep
|
||||
|
||||
if (valid)
|
||||
strcpy_s(sip->pof_file_hud, temp);
|
||||
else
|
||||
WarningEx(LOCATION, "Ship \"%s\" POF target file \"%s\" invalid!", sip->name, temp);
|
||||
}
|
||||
|
||||
// optional hud target LOD if not using special hud model
|
||||
@@ -2591,6 +2597,12 @@ strcpy_s(parse_error_text, temp_error);
|
||||
iff_data[0] = iff_lookup(iff_1);
|
||||
iff_data[1] = iff_lookup(iff_2);
|
||||
|
||||
if (iff_data[0] == -1)
|
||||
WarningEx(LOCATION, "Ship %s\nIFF colour seen by \"%s\" invalid!", sip->name, iff_1);
|
||||
|
||||
if (iff_data[1] == -1)
|
||||
WarningEx(LOCATION, "Ship %s\nIFF colour when IFF is \"%s\" invalid!", sip->name, iff_2);
|
||||
|
||||
// Set the color
|
||||
required_string("+As Color:");
|
||||
stuff_int_list(iff_color_data, 3, RAW_INTEGER_TYPE);
|
||||
@@ -2608,8 +2620,8 @@ strcpy_s(parse_error_text, temp_error);
|
||||
override_strings = true;
|
||||
}
|
||||
|
||||
for(i = 0; i < num_groups; i++) {
|
||||
for(j = 0; j < num_strings; j++) {
|
||||
for(j = 0; j < num_strings; j++) {
|
||||
for(i = 0; i < num_groups; i++) {
|
||||
if ( !stricmp(target_group_strings[j].c_str(), Ai_tp_list[i].name) ) {
|
||||
//so now the string from the list above as well as the ai priority group name match
|
||||
//clear it if override has been set
|
||||
@@ -2621,10 +2633,16 @@ strcpy_s(parse_error_text, temp_error);
|
||||
//find the index number of the current ship info type
|
||||
if (Ship_info[k].name == sip->name) {
|
||||
Ai_tp_list[i].ship_class.push_back(k);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// found something, try next string
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == num_groups) {
|
||||
Warning(LOCATION,"Unidentified priority group '%s' set for ship class '%s'\n", target_group_strings[j].c_str(), sip->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2769,6 +2787,9 @@ strcpy_s(parse_error_text, temp_error);
|
||||
if(optional_string("$Armor Type:")) {
|
||||
stuff_string(buf, F_NAME, SHIP_MULTITEXT_LENGTH);
|
||||
sp->armor_type_idx = armor_type_get_idx(buf);
|
||||
|
||||
if (sp->armor_type_idx == -1)
|
||||
WarningEx(LOCATION, "Ship %s, subsystem %s\nInvalid armor type %s!", sip->name, sp->subobj_name, buf);
|
||||
}
|
||||
|
||||
// Get default primary bank weapons
|
||||
@@ -2804,6 +2825,9 @@ strcpy_s(parse_error_text, temp_error);
|
||||
stuff_string(name_tmp, F_NAME, sizeof(name_tmp));
|
||||
// get and set index
|
||||
sp->engine_wash_pointer = get_engine_wash_pointer(name_tmp);
|
||||
|
||||
if(sp->engine_wash_pointer == NULL)
|
||||
Warning(LOCATION,"Invalid engine wash name %s specified for subsystem %s in ship class %s", name_tmp, sp->subobj_name, sip->name);
|
||||
}
|
||||
|
||||
parse_sound("$AliveSnd:", &sp->alive_snd, sp->subobj_name);
|
||||
@@ -2876,8 +2900,12 @@ strcpy_s(parse_error_text, temp_error);
|
||||
if ( !stricmp(Ai_tp_list[j].name, tgt_priorities[i].c_str())) {
|
||||
sp->target_priority[i] = j;
|
||||
sp->num_target_priorities++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == num_groups) {
|
||||
Warning(LOCATION, "Unidentified target priority '%s' set for\nsubsystem '%s' in ship class '%s'.", tgt_priorities[i].c_str(), sp->subobj_name, sip->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3207,8 +3235,8 @@ void parse_ship_type()
|
||||
override_strings = true;
|
||||
}
|
||||
|
||||
for(i = 0; i < num_groups; i++) {
|
||||
for(j = 0; j < num_strings; j++) {
|
||||
for(j = 0; j < num_strings; j++) {
|
||||
for(i = 0; i < num_groups; i++) {
|
||||
if ( !stricmp(target_group_strings[j].c_str(), Ai_tp_list[i].name) ) {
|
||||
//so now the string from the list above as well as the ai priority group name match
|
||||
//clear it if override has been set
|
||||
@@ -3218,8 +3246,12 @@ void parse_ship_type()
|
||||
}
|
||||
//find the index number of the current ship info type
|
||||
Ai_tp_list[i].ship_type.push_back(ship_type_name_lookup(name_buf));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == num_groups) {
|
||||
Warning(LOCATION,"Unidentified priority group '%s' set for objecttype '%s'\n", target_group_strings[j].c_str(), stp->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3283,6 +3315,10 @@ void parse_ship_type()
|
||||
stuff_boolean_flag(&stp->weapon_bools, STI_WEAP_NO_HUGE_IMPACT_EFF);
|
||||
}
|
||||
|
||||
if(optional_string("$Don't display class in briefing:")) {
|
||||
stuff_boolean_flag(&stp->hud_bools, STI_HUD_NO_CLASS_DISPLAY);
|
||||
}
|
||||
|
||||
if(optional_string("$Fog:"))
|
||||
{
|
||||
if(optional_string("+Start dist:")) {
|
||||
@@ -3631,6 +3667,24 @@ void ship_parse_post_cleanup()
|
||||
sip->flags2 |= SIF2_GENERATE_HUD_ICON;
|
||||
}
|
||||
}
|
||||
|
||||
// check also target groups here
|
||||
int n_tgt_groups = Ai_tp_list.size();
|
||||
|
||||
if (n_tgt_groups > 0) {
|
||||
for(i = 0; i < n_tgt_groups; i++) {
|
||||
if (!(Ai_tp_list[i].obj_flags || Ai_tp_list[i].sif_flags || Ai_tp_list[i].sif2_flags || Ai_tp_list[i].wif2_flags || Ai_tp_list[i].wif_flags)) {
|
||||
//had none of these, check next
|
||||
if ((Ai_tp_list[i].obj_type == -1)) {
|
||||
//didn't have this one
|
||||
if (!(Ai_tp_list[i].ship_class.size() || Ai_tp_list[i].ship_type.size() || Ai_tp_list[i].weapon_class.size())) {
|
||||
// had nothing - time to issue a warning
|
||||
Warning(LOCATION, "Target priority group '%s' had no targeting rules issued for it.\n", Ai_tp_list[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called once at the beginning of the game to parse ships.tbl and stuff the Ship_info[]
|
||||
@@ -3999,6 +4053,7 @@ void physics_ship_init(object *objp)
|
||||
if ( (pi->max_vel.xyz.x > 0.000001f) || (pi->max_vel.xyz.y > 0.000001f) )
|
||||
pi->flags |= PF_SLIDE_ENABLED;
|
||||
|
||||
pi->cur_glide_cap = pi->max_vel.xyz.z; //Init dynamic glide cap stuff to the max vel.
|
||||
if ( sinfo->glide_cap > 0.000001f || sinfo->glide_cap < -0.000001f ) //Backslash
|
||||
pi->glide_cap = sinfo->glide_cap;
|
||||
else
|
||||
@@ -4511,13 +4566,6 @@ void ship_set(int ship_index, int objnum, int ship_type)
|
||||
shipp->secondary_point_reload_pct[i][k] = 1.0f;
|
||||
}
|
||||
}
|
||||
for(i = 0; i<MAX_SHIP_SECONDARY_BANKS; i++){
|
||||
if(Weapon_info[swp->secondary_bank_weapons[i]].fire_wait == 0.0){
|
||||
shipp->reload_time[i] = 1.0f;
|
||||
}else{
|
||||
shipp->reload_time[i] = 1.0f/Weapon_info[swp->secondary_bank_weapons[i]].fire_wait;
|
||||
}
|
||||
}
|
||||
for(i = 0; i<MAX_SHIP_PRIMARY_BANKS; i++){
|
||||
shipp->primary_rotate_rate[i] = 0.0f;
|
||||
shipp->primary_rotate_ang[i] = 0.0f;
|
||||
@@ -4845,6 +4893,8 @@ int subsys_set(int objnum, int ignore_subsys_info)
|
||||
ship_system->weapons.current_primary_bank = -1;
|
||||
ship_system->weapons.current_secondary_bank = -1;
|
||||
|
||||
ship_system->next_aim_pos_time = 0;
|
||||
|
||||
// Make turret flag checks and warnings
|
||||
|
||||
|
||||
@@ -5573,23 +5623,29 @@ void ship_render(object * obj)
|
||||
|
||||
bank = &(model_get(sip->model_num))->missile_banks[i];
|
||||
|
||||
num_secondaries_rendered = 0;
|
||||
|
||||
for(k = 0; k < bank->num_slots; k++)
|
||||
{
|
||||
secondary_weapon_pos = bank->pnt[k];
|
||||
|
||||
if (num_secondaries_rendered >= shipp->weapons.secondary_bank_ammo[i])
|
||||
break;
|
||||
|
||||
if(shipp->secondary_point_reload_pct[i][k] <= 0.0)
|
||||
continue;
|
||||
if (Weapon_info[swp->secondary_bank_weapons[i]].wi_flags2 & WIF2_EXTERNAL_WEAPON_LNCH) {
|
||||
for(k = 0; k < bank->num_slots; k++) {
|
||||
model_render(Weapon_info[swp->primary_bank_weapons[i]].external_model_num, &vmd_identity_matrix, &bank->pnt[k], render_flags);
|
||||
}
|
||||
} else {
|
||||
num_secondaries_rendered = 0;
|
||||
|
||||
num_secondaries_rendered++;
|
||||
|
||||
vm_vec_scale_add2(&secondary_weapon_pos, &vmd_z_vector, -(1.0f-shipp->secondary_point_reload_pct[i][k]) * model_get(Weapon_info[swp->secondary_bank_weapons[i]].external_model_num)->rad);
|
||||
for(k = 0; k < bank->num_slots; k++)
|
||||
{
|
||||
secondary_weapon_pos = bank->pnt[k];
|
||||
|
||||
model_render(Weapon_info[swp->secondary_bank_weapons[i]].external_model_num, &vmd_identity_matrix, &secondary_weapon_pos, render_flags);
|
||||
if (num_secondaries_rendered >= shipp->weapons.secondary_bank_ammo[i])
|
||||
break;
|
||||
|
||||
if(shipp->secondary_point_reload_pct[i][k] <= 0.0)
|
||||
continue;
|
||||
|
||||
num_secondaries_rendered++;
|
||||
|
||||
vm_vec_scale_add2(&secondary_weapon_pos, &vmd_z_vector, -(1.0f-shipp->secondary_point_reload_pct[i][k]) * model_get(Weapon_info[swp->secondary_bank_weapons[i]].external_model_num)->rad);
|
||||
|
||||
model_render(Weapon_info[swp->secondary_bank_weapons[i]].external_model_num, &vmd_identity_matrix, &secondary_weapon_pos, render_flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
g3_done_instance(true);
|
||||
@@ -7500,7 +7556,7 @@ void ship_process_post(object * obj, float frametime)
|
||||
// Do AI.
|
||||
|
||||
// for multiplayer people. return here if in multiplay and not the host
|
||||
if ( (Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ) {
|
||||
if ( MULTIPLAYER_CLIENT ) {
|
||||
model_anim_handle_multiplayer( &Ships[num] );
|
||||
return;
|
||||
}
|
||||
@@ -8168,6 +8224,7 @@ void ship_model_change(int n, int ship_type)
|
||||
//
|
||||
void change_ship_type(int n, int ship_type, int by_sexp)
|
||||
{
|
||||
int i;
|
||||
ship_info *sip;
|
||||
ship_info *sip_orig;
|
||||
ship *sp;
|
||||
@@ -8332,7 +8389,6 @@ void change_ship_type(int n, int ship_type, int by_sexp)
|
||||
|
||||
// above removed by Goober5000 in favor of new ship_set_new_ai_class function :)
|
||||
ship_set_new_ai_class(n, sip->ai_class);
|
||||
model_anim_set_initial_states(sp);
|
||||
|
||||
//======================================================
|
||||
|
||||
@@ -8388,15 +8444,7 @@ void change_ship_type(int n, int ship_type, int by_sexp)
|
||||
swp->current_secondary_bank = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Goober5000 (4/17/2005) - I'm commenting this out for the time being; it looks like a whole bunch of unneeded
|
||||
code. It should be (and probably is) handled elsewhere, like ship_set or ship_create or something. Contact
|
||||
me if you want to discuss this.
|
||||
|
||||
ship_weapon *swp;
|
||||
swp = &sp->weapons;
|
||||
int i;
|
||||
|
||||
// Bobboau's animation fixup
|
||||
for( i = 0; i<MAX_SHIP_PRIMARY_BANKS;i++){
|
||||
swp->primary_animation_position[i] = false;
|
||||
}
|
||||
@@ -8404,15 +8452,6 @@ void change_ship_type(int n, int ship_type, int by_sexp)
|
||||
swp->secondary_animation_position[i] = false;
|
||||
}
|
||||
model_anim_set_initial_states(sp);
|
||||
|
||||
for(i = 0; i<MAX_SHIP_SECONDARY_BANKS; i++){
|
||||
if(Weapon_info[swp->secondary_bank_weapons[i]].fire_wait == 0.0){
|
||||
sp->reload_time[i] = 1.0f;
|
||||
}else{
|
||||
sp->reload_time[i] = 1.0f/Weapon_info[swp->secondary_bank_weapons[i]].fire_wait;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -9219,6 +9258,14 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
|
||||
//mprintf(("I am going to fire a weapon %d times, from %d points, the last point fired was %d, and that will be point %d\n",numtimes,points,shipp->last_fired_point[bank_to_fire],shipp->last_fired_point[bank_to_fire]%num_slots));
|
||||
for ( w = 0; w < numtimes; w++ ) {
|
||||
polymodel *weapon_model = NULL;
|
||||
if(winfo_p->external_model_num >= 0)
|
||||
weapon_model = model_get(winfo_p->external_model_num);
|
||||
|
||||
if (weapon_model)
|
||||
if ((weapon_model->n_guns <= swp->external_model_fp_counter[bank_to_fire]) || (swp->external_model_fp_counter[bank_to_fire] < 0))
|
||||
swp->external_model_fp_counter[bank_to_fire] = 0;
|
||||
|
||||
for ( j = 0; j < points; j++ ) {
|
||||
int pt; //point
|
||||
if (winfo_p->wi_flags2 & WIF2_CYCLE){
|
||||
@@ -9232,19 +9279,21 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
}
|
||||
|
||||
int sub_shots = 1;
|
||||
polymodel *weapon_model = NULL;
|
||||
if(winfo_p->external_model_num >= 0){
|
||||
weapon_model = model_get(winfo_p->external_model_num);
|
||||
// Use 0 instead of bank_to_fire as index when checking the number of external weapon model firingpoints
|
||||
if (weapon_model->n_guns)
|
||||
// Use 0 instead of bank_to_fire as index when checking the number of external weapon model firingpoints
|
||||
if (weapon_model && weapon_model->n_guns)
|
||||
if (!(winfo_p->wi_flags2 & WIF2_EXTERNAL_WEAPON_FP))
|
||||
sub_shots = weapon_model->gun_banks[0].num_slots;
|
||||
}
|
||||
|
||||
for(int s = 0; s<sub_shots; s++){
|
||||
pnt = pm->gun_banks[bank_to_fire].pnt[pt];
|
||||
// Use 0 instead of bank_to_fire as index to external weapon model firingpoints
|
||||
if (weapon_model && weapon_model->n_guns)
|
||||
vm_vec_add2(&pnt, &weapon_model->gun_banks[0].pnt[s]);
|
||||
if (weapon_model && weapon_model->n_guns) {
|
||||
if (winfo_p->wi_flags2 & WIF2_EXTERNAL_WEAPON_FP) {
|
||||
vm_vec_add2(&pnt, &weapon_model->gun_banks[0].pnt[swp->external_model_fp_counter[bank_to_fire]]);
|
||||
} else {
|
||||
vm_vec_add2(&pnt, &weapon_model->gun_banks[0].pnt[s]);
|
||||
}
|
||||
}
|
||||
|
||||
vm_vec_unrotate(&gun_point, &pnt, &obj->orient);
|
||||
vm_vec_add(&firing_pos, &gun_point, &obj->pos);
|
||||
@@ -9271,6 +9320,9 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
}
|
||||
|
||||
target_velocity_vec = Objects[aip->target_objnum].phys_info.vel;
|
||||
if (The_mission.ai_profile->flags & AIPF_USE_ADDITIVE_WEAPON_VELOCITY)
|
||||
vm_vec_sub2(&target_velocity_vec, &obj->phys_info.vel);
|
||||
|
||||
dist_to_target = vm_vec_dist_quick(&target_position, &firing_pos);
|
||||
time_to_target = 0.0f;
|
||||
|
||||
@@ -9436,6 +9488,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
|
||||
shipp->last_fired_point[bank_to_fire] = (shipp->last_fired_point[bank_to_fire] + 1) % num_slots;
|
||||
}
|
||||
}
|
||||
swp->external_model_fp_counter[bank_to_fire]++;
|
||||
// shipp->last_fired_point[bank_to_fire] = (shipp->last_fired_point[bank_to_fire] + 1) % num_slots;
|
||||
}
|
||||
}
|
||||
@@ -10045,6 +10098,24 @@ int ship_fire_secondary( object *obj, int allow_swarm )
|
||||
}
|
||||
shipp->secondary_point_reload_pct[bank][pnt_index] = 0.0f;
|
||||
pnt = pm->missile_banks[bank].pnt[pnt_index++];
|
||||
|
||||
polymodel *weapon_model = NULL;
|
||||
if(wip->external_model_num >= 0){
|
||||
weapon_model = model_get(wip->external_model_num);
|
||||
}
|
||||
|
||||
if (weapon_model && weapon_model->n_guns) {
|
||||
int external_bank = bank + MAX_SHIP_PRIMARY_BANKS;
|
||||
if (wip->wi_flags2 & WIF2_EXTERNAL_WEAPON_FP) {
|
||||
if ((weapon_model->n_guns <= swp->external_model_fp_counter[external_bank]) || (swp->external_model_fp_counter[external_bank] < 0))
|
||||
swp->external_model_fp_counter[external_bank] = 0;
|
||||
vm_vec_add2(&pnt, &weapon_model->gun_banks[0].pnt[swp->external_model_fp_counter[external_bank]]);
|
||||
swp->external_model_fp_counter[external_bank]++;
|
||||
} else {
|
||||
// make it use the 0 index slot
|
||||
vm_vec_add2(&pnt, &weapon_model->gun_banks[0].pnt[0]);
|
||||
}
|
||||
}
|
||||
vm_vec_unrotate(&missile_point, &pnt, &obj->orient);
|
||||
vm_vec_add(&firing_pos, &missile_point, &obj->pos);
|
||||
|
||||
@@ -13146,7 +13217,7 @@ char *ship_return_orders(char *outbuf, ship *sp)
|
||||
ai_info *aip;
|
||||
ai_goal *aigp;
|
||||
char *order_text;
|
||||
char temp_name[256];
|
||||
char ship_name[NAME_LENGTH];
|
||||
|
||||
Assert(sp->ai_index >= 0);
|
||||
aip = &Ai_info[sp->ai_index];
|
||||
@@ -13164,8 +13235,8 @@ char *ship_return_orders(char *outbuf, ship *sp)
|
||||
strcpy(outbuf, order_text);
|
||||
|
||||
if ( aigp->ship_name ) {
|
||||
strcpy_s(temp_name, aigp->ship_name);
|
||||
end_string_at_first_hash_symbol(temp_name);
|
||||
strcpy_s(ship_name, aigp->ship_name);
|
||||
end_string_at_first_hash_symbol(ship_name);
|
||||
}
|
||||
switch (aigp->ai_mode ) {
|
||||
|
||||
@@ -13173,7 +13244,7 @@ char *ship_return_orders(char *outbuf, ship *sp)
|
||||
case AI_GOAL_GUARD_WING:
|
||||
case AI_GOAL_CHASE_WING:
|
||||
if ( aigp->ship_name ) {
|
||||
strcat(outbuf, temp_name);
|
||||
strcat(outbuf, ship_name);
|
||||
strcat(outbuf, XSTR( "'s Wing", 494));
|
||||
} else {
|
||||
strcpy(outbuf, XSTR( "no orders", 495));
|
||||
@@ -13189,17 +13260,18 @@ char *ship_return_orders(char *outbuf, ship *sp)
|
||||
case AI_GOAL_EVADE_SHIP:
|
||||
case AI_GOAL_REARM_REPAIR:
|
||||
if ( aigp->ship_name ) {
|
||||
strcat(outbuf, temp_name);
|
||||
strcat(outbuf, ship_name);
|
||||
} else {
|
||||
strcpy(outbuf, XSTR( "no orders", 495));
|
||||
}
|
||||
break;
|
||||
|
||||
case AI_GOAL_DESTROY_SUBSYSTEM: {
|
||||
char name[NAME_LENGTH];
|
||||
if ( aip->targeted_subsys != NULL ) {
|
||||
sprintf(outbuf, XSTR( "atk %s %s", 496), temp_name, hud_targetbox_truncate_subsys_name(aip->targeted_subsys->system_info->subobj_name));
|
||||
strcat(outbuf, name); //what is this for?
|
||||
char subsys_name[NAME_LENGTH];
|
||||
strcpy(subsys_name, aip->targeted_subsys->system_info->subobj_name);
|
||||
hud_targetbox_truncate_subsys_name(subsys_name);
|
||||
sprintf(outbuf, XSTR( "atk %s %s", 496), ship_name, subsys_name);
|
||||
} else {
|
||||
strcpy(outbuf, XSTR( "no orders", 495) );
|
||||
}
|
||||
@@ -13495,7 +13567,7 @@ warn_player_done:
|
||||
int ship_index;
|
||||
|
||||
// multiplayer tvt - this is client side.
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM) && (Net_player != NULL)){
|
||||
if(MULTI_TEAM && (Net_player != NULL)){
|
||||
ship_index = ship_get_random_player_wing_ship( SHIP_GET_UNSILENCED, 0.0f, -1, 0, Net_player->p_info.team );
|
||||
} else {
|
||||
ship_index = ship_get_random_player_wing_ship( SHIP_GET_UNSILENCED );
|
||||
@@ -13670,7 +13742,7 @@ void ship_maybe_ask_for_help(ship *sp)
|
||||
return;
|
||||
|
||||
// determine team filter if TvT
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM))
|
||||
if(MULTI_TEAM)
|
||||
multi_team_filter = sp->team;
|
||||
|
||||
// handle awacs ship as a special case
|
||||
@@ -13732,7 +13804,6 @@ void ship_maybe_lament()
|
||||
#define PLAYER_MAX_SCREAMS 10
|
||||
|
||||
// play a death scream for a ship
|
||||
extern int Cmdline_wcsaga;
|
||||
void ship_scream(ship *sp)
|
||||
{
|
||||
int multi_team_filter = -1;
|
||||
@@ -13742,7 +13813,7 @@ void ship_scream(ship *sp)
|
||||
return;
|
||||
|
||||
// multiplayer tvt
|
||||
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM))
|
||||
if (MULTI_TEAM)
|
||||
multi_team_filter = sp->team;
|
||||
|
||||
// Bail if the ship is silenced
|
||||
@@ -13753,10 +13824,7 @@ void ship_scream(ship *sp)
|
||||
|
||||
message_send_builtin_to_player(MESSAGE_WINGMAN_SCREAM, sp, MESSAGE_PRIORITY_HIGH, MESSAGE_TIME_IMMEDIATE, 0, 0, -1, multi_team_filter);
|
||||
Player->allow_scream_timestamp = timestamp(PLAYER_SCREAM_INTERVAL);
|
||||
|
||||
// Goober5000
|
||||
if (!Cmdline_wcsaga || Player_ship->team == sp->team)
|
||||
Player->scream_count++;
|
||||
Player->scream_count++;
|
||||
|
||||
sp->flags |= SF_SHIP_HAS_SCREAMED;
|
||||
|
||||
@@ -13768,7 +13836,6 @@ void ship_scream(ship *sp)
|
||||
// ship has just died, maybe play a scream.
|
||||
//
|
||||
// NOTE: this is only called for ships that are not the player ship
|
||||
extern int Cmdline_wcsaga;
|
||||
void ship_maybe_scream(ship *sp)
|
||||
{
|
||||
// bail if screaming is disabled
|
||||
@@ -13778,28 +13845,21 @@ void ship_maybe_scream(ship *sp)
|
||||
// if screaming is enabled, skip all checks
|
||||
if (!(sp->flags2 & SF2_ALWAYS_DEATH_SCREAM))
|
||||
{
|
||||
// for WCSaga, only do a subset of the checks
|
||||
if (Cmdline_wcsaga)
|
||||
{
|
||||
// only scream 50% of the time
|
||||
if (rand() & 1)
|
||||
return;
|
||||
// only scream 50% of the time
|
||||
if (rand() & 1)
|
||||
return;
|
||||
|
||||
// check if enough time has elapsed since last scream; if not, leave
|
||||
if (!timestamp_elapsed(Player->allow_scream_timestamp))
|
||||
return;
|
||||
}
|
||||
// otherwise do all checks
|
||||
else
|
||||
// check if enough time has elapsed since last scream; if not, leave
|
||||
if (!timestamp_elapsed(Player->allow_scream_timestamp))
|
||||
return;
|
||||
|
||||
// for WCSaga, only do a subset of the checks
|
||||
if (!(The_mission.ai_profile->flags2 & AIPF2_PERFORM_LESS_SCREAM_CHECKS))
|
||||
{
|
||||
// bail if this ship isn't from the player wing
|
||||
if (!(sp->flags & SF_FROM_PLAYER_WING))
|
||||
return;
|
||||
|
||||
// only scream 50% of the time
|
||||
if (rand() & 1)
|
||||
return;
|
||||
|
||||
// first check if the player has reached the maximum number of screams for a mission
|
||||
if (Player->scream_count >= PLAYER_MAX_SCREAMS)
|
||||
return;
|
||||
@@ -13807,10 +13867,6 @@ void ship_maybe_scream(ship *sp)
|
||||
// if on different teams (i.e. team v. team games in multiplayer), no scream
|
||||
if (Player_ship->team != sp->team)
|
||||
return;
|
||||
|
||||
// check if enough time has elapsed since last scream; if not, leave
|
||||
if (!timestamp_elapsed(Player->allow_scream_timestamp))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13869,7 +13925,7 @@ void ship_maybe_tell_about_low_ammo(ship *sp)
|
||||
if (swp->primary_bank_ammo[i] / swp->primary_bank_start_ammo[i] < 0.3f)
|
||||
{
|
||||
// multiplayer tvt
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM)) {
|
||||
if(MULTI_TEAM) {
|
||||
multi_team_filter = sp->team;
|
||||
}
|
||||
|
||||
@@ -13961,7 +14017,7 @@ void ship_maybe_tell_about_rearm(ship *sp)
|
||||
int multi_team_filter = -1;
|
||||
|
||||
// multiplayer tvt
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM))
|
||||
if(MULTI_TEAM)
|
||||
multi_team_filter = sp->team;
|
||||
|
||||
|
||||
@@ -15486,7 +15542,7 @@ int ship_starting_wing_lookup(char *wing_name)
|
||||
int ship_squadron_wing_lookup(char *wing_name)
|
||||
{
|
||||
// TvT uses a different set of wing names from everything else
|
||||
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM))
|
||||
if (MULTI_TEAM)
|
||||
{
|
||||
for (int i = 0; i < MAX_TVT_WINGS; i++)
|
||||
{
|
||||
@@ -16064,8 +16120,12 @@ void parse_ai_target_priorities()
|
||||
for(j = 0; j < MAX_WEAPON_TYPES ; j++) {
|
||||
if ( !stricmp(Weapon_info[j].name, temp_strings[i].c_str()) ) {
|
||||
temp_priority.weapon_class.push_back(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == MAX_WEAPON_TYPES) {
|
||||
Warning(LOCATION, "Unidentified weapon class '%s' set for target priority group '%s'\n", temp_strings[i].c_str(), temp_priority.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16077,8 +16137,12 @@ void parse_ai_target_priorities()
|
||||
for (j = 0; j < num_ai_tgt_obj_flags; j++) {
|
||||
if ( !stricmp(ai_tgt_obj_flags[j].name, temp_strings[i].c_str()) ) {
|
||||
temp_priority.obj_flags |= ai_tgt_obj_flags[j].def;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == num_ai_tgt_obj_flags) {
|
||||
Warning(LOCATION, "Unidentified object flag '%s' set for target priority group '%s'\n", temp_strings[i].c_str(), temp_priority.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16094,8 +16158,12 @@ void parse_ai_target_priorities()
|
||||
} else {
|
||||
temp_priority.sif2_flags |= ai_tgt_ship_flags[j].def;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == num_ai_tgt_ship_flags) {
|
||||
Warning(LOCATION, "Unidentified ship class flag '%s' set for target priority group '%s'\n", temp_strings[i].c_str(), temp_priority.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16111,8 +16179,12 @@ void parse_ai_target_priorities()
|
||||
} else {
|
||||
temp_priority.wif2_flags |= ai_tgt_weapon_flags[j].def;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == num_ai_tgt_weapon_flags) {
|
||||
Warning(LOCATION, "Unidentified weapon class flag '%s' set for target priority group '%s'\n", temp_strings[i].c_str(), temp_priority.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16135,6 +16207,7 @@ ai_target_priority init_ai_target_priorities()
|
||||
temp_priority.ship_class.clear();
|
||||
temp_priority.ship_type.clear();
|
||||
temp_priority.sif_flags = 0;
|
||||
temp_priority.sif2_flags = 0;
|
||||
temp_priority.weapon_class.clear();
|
||||
temp_priority.wif2_flags = 0;
|
||||
temp_priority.wif_flags = 0;
|
||||
|
||||
+8
-1
@@ -141,6 +141,7 @@ typedef struct ship_weapon {
|
||||
int secondary_animation_done_time[MAX_SHIP_SECONDARY_BANKS];
|
||||
|
||||
int burst_counter[MAX_SHIP_PRIMARY_BANKS + MAX_SHIP_SECONDARY_BANKS];
|
||||
int external_model_fp_counter[MAX_SHIP_PRIMARY_BANKS + MAX_SHIP_SECONDARY_BANKS];
|
||||
} ship_weapon;
|
||||
|
||||
//**************************************************************
|
||||
@@ -302,6 +303,12 @@ typedef struct ship_subsys {
|
||||
// target priority setting for turrets
|
||||
int target_priority[32];
|
||||
int num_target_priorities;
|
||||
|
||||
//SUSHI: Fields for max_turret_aim_update_delay
|
||||
//Only used when targeting small ships
|
||||
fix next_aim_pos_time;
|
||||
vec3d last_aim_enemy_pos;
|
||||
vec3d last_aim_enemy_vel;
|
||||
} ship_subsys;
|
||||
|
||||
// structure for subsystems which tells us the total count of a particular type of subsystem (i.e.
|
||||
@@ -671,7 +678,6 @@ typedef struct ship {
|
||||
int bay_doors_parent_shipnum; // our parent ship, what we are entering/leaving
|
||||
|
||||
float secondary_point_reload_pct[MAX_SHIP_SECONDARY_BANKS][MAX_SLOTS]; //after fireing a secondary it takes some time for that secondary weapon to reload, this is how far along in that proces it is (from 0 to 1)
|
||||
float reload_time[MAX_SHIP_SECONDARY_BANKS]; //how many seconds it will take for any point in a bank to reload
|
||||
float primary_rotate_rate[MAX_SHIP_PRIMARY_BANKS];
|
||||
float primary_rotate_ang[MAX_SHIP_PRIMARY_BANKS];
|
||||
|
||||
@@ -851,6 +857,7 @@ typedef struct thruster_particles {
|
||||
#define STI_HUD_HOTKEY_ON_LIST (1<<0)
|
||||
#define STI_HUD_TARGET_AS_THREAT (1<<1)
|
||||
#define STI_HUD_SHOW_ATTACK_DIRECTION (1<<2)
|
||||
#define STI_HUD_NO_CLASS_DISPLAY (1<<3)
|
||||
|
||||
#define STI_SHIP_SCANNABLE (1<<0)
|
||||
#define STI_SHIP_WARP_PUSHES (1<<1)
|
||||
|
||||
@@ -2120,7 +2120,7 @@ static void ship_do_damage(object *ship_obj, object *other_obj, vec3d *hitpos, f
|
||||
|
||||
// DB - removed 1/12/99 - scoring code properly bails if MULTIPLAYER_CLIENT
|
||||
// in multiplayer, if I am not the host, get out of this function here!!
|
||||
//if ( (Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ) {
|
||||
//if ( MULTIPLAYER_CLIENT ) {
|
||||
//return;
|
||||
//}
|
||||
|
||||
@@ -2285,7 +2285,7 @@ void ship_apply_local_damage(object *ship_obj, object *other_obj, vec3d *hitpos,
|
||||
|
||||
// If got hit by a weapon, tell the AI so it can react. Only do this line in single player,
|
||||
// or if I am the master in a multiplayer game
|
||||
if ( other_obj->type == OBJ_WEAPON && ( !(Game_mode & GM_MULTIPLAYER) || ((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)) )) {
|
||||
if ( other_obj->type == OBJ_WEAPON && ( !(Game_mode & GM_MULTIPLAYER) || MULTIPLAYER_MASTER )) {
|
||||
// If weapon hits ship on same team and that ship not targeted and parent of weapon not player,
|
||||
// don't do damage.
|
||||
// Ie, player can always do damage. AI can only damage team if that ship is targeted.
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
***********************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef USE_OPENAL // to end of file...
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NONEWWAVE
|
||||
#include <windows.h>
|
||||
@@ -51,6 +47,8 @@ typedef struct ADPCM_FMT_T {
|
||||
uint samples_left_in_block;
|
||||
int nibble_state;
|
||||
ubyte nibble;
|
||||
|
||||
ushort dest_bps;
|
||||
} adpcm_fmt_t;
|
||||
|
||||
typedef struct acm_stream_t {
|
||||
@@ -62,8 +60,7 @@ typedef struct acm_stream_t {
|
||||
|
||||
// similar to BIAL_IF_MACRO in SDL_sound
|
||||
#define IF_ERR(a, b) if (a) { mprintf(("ACM ERROR, line %d...\n", __LINE__)); return b; }
|
||||
|
||||
static int ACM_inited = 0;
|
||||
#define IF_ERR2(a, b) if (a) { mprintf(("ACM ERROR, line %d...\n", __LINE__)); b; }
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -189,7 +186,7 @@ static void do_adpcm_nibble(ubyte nib, ADPCMBLOCKHEADER *header, int lPredSamp)
|
||||
|
||||
header->iDelta = delta;
|
||||
header->iSamp2 = header->iSamp1;
|
||||
header->iSamp1 = lNewSamp;
|
||||
header->iSamp1 = (short)lNewSamp;
|
||||
}
|
||||
|
||||
static int decode_adpcm_sample_frame(HMMIO rw, adpcm_fmt_t *fmt)
|
||||
@@ -222,20 +219,46 @@ static int decode_adpcm_sample_frame(HMMIO rw, adpcm_fmt_t *fmt)
|
||||
|
||||
static void put_adpcm_sample_frame1(ubyte *_buf, adpcm_fmt_t *fmt)
|
||||
{
|
||||
short *buf = (short *)_buf;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < fmt->adpcm.wav.nChannels; i++)
|
||||
*buf++ = fmt->header[i].iSamp1;
|
||||
|
||||
if (fmt->dest_bps == 16) {
|
||||
short *buf = (short *)_buf;
|
||||
|
||||
for (i = 0; i < fmt->adpcm.wav.nChannels; i++) {
|
||||
*buf++ = fmt->header[i].iSamp1;
|
||||
}
|
||||
} else {
|
||||
Assert( fmt->dest_bps == 8 );
|
||||
|
||||
for (i = 0; i < fmt->adpcm.wav.nChannels; i++) {
|
||||
int i_val = (int)(fmt->header[i].iSamp1 / 255) + 128;
|
||||
CLAMP(i_val, 0, 255);
|
||||
|
||||
*_buf++ = (ubyte)i_val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void put_adpcm_sample_frame2(ubyte *_buf, adpcm_fmt_t *fmt)
|
||||
{
|
||||
short *buf = (short *)_buf;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < fmt->adpcm.wav.nChannels; i++)
|
||||
*buf++ = fmt->header[i].iSamp2;
|
||||
if (fmt->dest_bps == 16) {
|
||||
short *buf = (short *)_buf;
|
||||
|
||||
for (i = 0; i < fmt->adpcm.wav.nChannels; i++) {
|
||||
*buf++ = fmt->header[i].iSamp2;
|
||||
}
|
||||
} else {
|
||||
Assert( fmt->dest_bps == 8 );
|
||||
|
||||
for (i = 0; i < fmt->adpcm.wav.nChannels; i++) {
|
||||
int i_val = (int)(fmt->header[i].iSamp2 / 255) + 128;
|
||||
CLAMP(i_val, 0, 255);
|
||||
|
||||
*_buf++ = (ubyte)i_val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint read_sample_fmt_adpcm(ubyte *data, HMMIO rw, adpcm_fmt_t *fmt)
|
||||
@@ -320,12 +343,17 @@ static void adpcm_memory_free(adpcm_fmt_t *fmt)
|
||||
//
|
||||
int ACM_convert_ADPCM_to_PCM(WAVEFORMATEX *pwfxSrc, ubyte *src, int src_len, ubyte **dest, int max_dest_bytes, int *dest_len, unsigned int *src_bytes_used, unsigned short dest_bps)
|
||||
{
|
||||
Assert( pwfxSrc != NULL );
|
||||
Assert( pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM );
|
||||
Assert( src != NULL );
|
||||
Assert( src_len > 0 );
|
||||
Assert( dest_len != NULL );
|
||||
|
||||
if (pwfxSrc == NULL) {
|
||||
Int3();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Assert( pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM );
|
||||
|
||||
MMIOINFO IOhdr, IOrw;
|
||||
|
||||
memset( &IOhdr, 0, sizeof(MMIOINFO) );
|
||||
@@ -343,56 +371,58 @@ int ACM_convert_ADPCM_to_PCM(WAVEFORMATEX *pwfxSrc, ubyte *src, int src_len, uby
|
||||
HMMIO rw = mmioOpen( NULL, &IOrw, MMIO_READ );
|
||||
uint rc;
|
||||
uint new_size = 0;
|
||||
|
||||
if ( ACM_inited == 0 ) {
|
||||
rc = ACM_init();
|
||||
if ( rc != 0 )
|
||||
return -1;
|
||||
}
|
||||
|
||||
// estimate size of uncompressed data
|
||||
// uncompressed data has: channels=pfwxScr->nChannels, bitPerSample=destbits
|
||||
// compressed data has: channels=pfwxScr->nChannels, bitPerSample=pwfxSrc->wBitsPerSample
|
||||
new_size = ( src_len * dest_bps ) / pwfxSrc->wBitsPerSample;
|
||||
new_size *= 2;//buffer must be large enough for all data
|
||||
|
||||
// DO NOT free() here, *estimated size*
|
||||
if ( *dest == NULL ) {
|
||||
*dest = (ubyte *)vm_malloc(new_size);
|
||||
|
||||
IF_ERR(*dest == NULL, -1);
|
||||
|
||||
memset(*dest, 0x00, new_size); // silence (for 16 bits/sec which will be our output)
|
||||
}
|
||||
int left_over = 0;
|
||||
int i;
|
||||
|
||||
adpcm_fmt_t *fmt = (adpcm_fmt_t *)vm_malloc(sizeof(adpcm_fmt_t));
|
||||
IF_ERR(fmt == NULL, -1);
|
||||
memset(fmt, '\0', sizeof(adpcm_fmt_t));
|
||||
|
||||
// wav header info (WAVEFORMATEX)
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.wFormatTag), -1);
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.nChannels), -1);
|
||||
IF_ERR(!read_dword(hdr, &fmt->adpcm.wav.nSamplesPerSec), -1);
|
||||
IF_ERR(!read_dword(hdr, &fmt->adpcm.wav.nAvgBytesPerSec), -1);
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.nBlockAlign), -1);
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.wBitsPerSample), -1);
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.cbSize), -1);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.wFormatTag), goto Error);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.nChannels), goto Error);
|
||||
IF_ERR2(!read_dword(hdr, &fmt->adpcm.wav.nSamplesPerSec), goto Error);
|
||||
IF_ERR2(!read_dword(hdr, &fmt->adpcm.wav.nAvgBytesPerSec), goto Error);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.nBlockAlign), goto Error);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.wBitsPerSample), goto Error);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.cbSize), goto Error);
|
||||
// adpcm specific header info
|
||||
IF_ERR(!read_word_s(hdr, &fmt->adpcm.wSamplesPerBlock), -1);
|
||||
IF_ERR(!read_word_s(hdr, &fmt->adpcm.wNumCoef), -1);
|
||||
IF_ERR2(!read_word_s(hdr, &fmt->adpcm.wSamplesPerBlock), goto Error);
|
||||
IF_ERR2(!read_word_s(hdr, &fmt->adpcm.wNumCoef), goto Error);
|
||||
|
||||
// allocate memory for COEF struct and fill it
|
||||
fmt->adpcm.aCoef = (ADPCMCOEFSET *)vm_malloc(sizeof(ADPCMCOEFSET) * fmt->adpcm.wNumCoef);
|
||||
IF_ERR(fmt->adpcm.aCoef == NULL, -1);
|
||||
IF_ERR2(fmt->adpcm.aCoef == NULL, goto Error);
|
||||
|
||||
for (int i=0; i<fmt->adpcm.wNumCoef; i++) {
|
||||
IF_ERR(!read_short(hdr, &fmt->adpcm.aCoef[i].iCoef1), -1);
|
||||
IF_ERR(!read_short(hdr, &fmt->adpcm.aCoef[i].iCoef2), -1);
|
||||
for (i = 0; i < fmt->adpcm.wNumCoef; i++) {
|
||||
IF_ERR2(!read_short(hdr, &fmt->adpcm.aCoef[i].iCoef1), goto Error);
|
||||
IF_ERR2(!read_short(hdr, &fmt->adpcm.aCoef[i].iCoef2), goto Error);
|
||||
}
|
||||
|
||||
// allocate memory for the ADPCM block header that's to be filled later
|
||||
fmt->header = (ADPCMBLOCKHEADER *)vm_malloc(sizeof(ADPCMBLOCKHEADER) * fmt->adpcm.wav.nChannels);
|
||||
IF_ERR(fmt->header == NULL, -1);
|
||||
IF_ERR2(fmt->header == NULL, goto Error);
|
||||
|
||||
// estimate size of uncompressed data
|
||||
// uncompressed data has: channels=pfwxScr->nChannels, bitPerSample=destbits
|
||||
// compressed data has: channels=pfwxScr->nChannels, bitPerSample=pwfxSrc->wBitsPerSample
|
||||
new_size = (src_len / fmt->adpcm.wav.nBlockAlign) * fmt->adpcm.wSamplesPerBlock * (dest_bps / 8);
|
||||
|
||||
// DO NOT free() here, *estimated size*
|
||||
if ( *dest == NULL ) {
|
||||
*dest = (ubyte *)vm_malloc(new_size);
|
||||
|
||||
if (*dest == NULL) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
// silence
|
||||
if (dest_bps == 8) {
|
||||
memset(*dest, 0x80, new_size);
|
||||
} else {
|
||||
memset(*dest, 0x00, new_size);
|
||||
}
|
||||
}
|
||||
|
||||
// buffer to estimated size since we have to process the whole thing at once
|
||||
fmt->buffer_size = new_size;
|
||||
@@ -405,16 +435,11 @@ int ACM_convert_ADPCM_to_PCM(WAVEFORMATEX *pwfxSrc, ubyte *src, int src_len, uby
|
||||
|
||||
// sanity check, should always be 4
|
||||
if (fmt->adpcm.wav.wBitsPerSample != 4) {
|
||||
adpcm_memory_free(fmt);
|
||||
|
||||
// cleanup mmio stuff
|
||||
mmioClose( rw, 0 );
|
||||
mmioClose( hdr, 0 );
|
||||
|
||||
return -1;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
fmt->sample_frame_size = ((dest_bps / 8) * pwfxSrc->nChannels);
|
||||
fmt->dest_bps = (ushort)dest_bps;
|
||||
|
||||
if ( !max_dest_bytes ) {
|
||||
max_dest_bytes = new_size;
|
||||
@@ -423,7 +448,7 @@ int ACM_convert_ADPCM_to_PCM(WAVEFORMATEX *pwfxSrc, ubyte *src, int src_len, uby
|
||||
// convert to PCM
|
||||
rc = read_sample_fmt_adpcm(*dest, rw, fmt);
|
||||
|
||||
int left_over = (src_len - fmt->bytes_processed);
|
||||
left_over = (src_len - fmt->bytes_processed);
|
||||
|
||||
if ( (left_over > 0) && (left_over < fmt->adpcm.wav.nBlockAlign) ) {
|
||||
// hmm, we have some left over, probably a crappy file. just add in the
|
||||
@@ -435,8 +460,13 @@ int ACM_convert_ADPCM_to_PCM(WAVEFORMATEX *pwfxSrc, ubyte *src, int src_len, uby
|
||||
}
|
||||
|
||||
// send back actual sizes
|
||||
*dest_len = rc;
|
||||
*src_bytes_used = fmt->bytes_processed;
|
||||
if (dest_len) {
|
||||
*dest_len = rc;
|
||||
}
|
||||
|
||||
if (src_bytes_used) {
|
||||
*src_bytes_used = fmt->bytes_processed;
|
||||
}
|
||||
|
||||
// cleanup
|
||||
adpcm_memory_free(fmt);
|
||||
@@ -446,14 +476,32 @@ int ACM_convert_ADPCM_to_PCM(WAVEFORMATEX *pwfxSrc, ubyte *src, int src_len, uby
|
||||
mmioClose( hdr, 0 );
|
||||
|
||||
return 0;
|
||||
|
||||
Error:
|
||||
// cleanup
|
||||
if (fmt) {
|
||||
adpcm_memory_free(fmt);
|
||||
}
|
||||
|
||||
mmioClose( rw, 0 );
|
||||
mmioClose( hdr, 0 );
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ACM_stream_open(WAVEFORMATEX *pwfxSrc, WAVEFORMATEX *pwfxDest, void **stream, int dest_bps)
|
||||
{
|
||||
Assert( pwfxSrc != NULL );
|
||||
Assert( pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM );
|
||||
Assert( stream != NULL );
|
||||
|
||||
if (pwfxSrc == NULL) {
|
||||
Int3();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Assert( pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM );
|
||||
|
||||
int i;
|
||||
acm_stream_t *str = NULL;
|
||||
MMIOINFO IOhdr;
|
||||
|
||||
memset( &IOhdr, 0, sizeof(MMIOINFO) );
|
||||
@@ -463,42 +511,35 @@ int ACM_stream_open(WAVEFORMATEX *pwfxSrc, WAVEFORMATEX *pwfxDest, void **stream
|
||||
IOhdr.cchBuffer = (sizeof(WAVEFORMATEX) + pwfxSrc->cbSize);
|
||||
|
||||
HMMIO hdr = mmioOpen( NULL, &IOhdr, MMIO_READ );
|
||||
uint rc;
|
||||
|
||||
if ( ACM_inited == 0 ) {
|
||||
rc = ACM_init();
|
||||
if ( rc != 0 )
|
||||
return -1;
|
||||
}
|
||||
|
||||
adpcm_fmt_t *fmt = (adpcm_fmt_t *)vm_malloc(sizeof(adpcm_fmt_t));
|
||||
IF_ERR(fmt == NULL, -1);
|
||||
IF_ERR2(fmt == NULL, goto Error);
|
||||
memset(fmt, '\0', sizeof(adpcm_fmt_t));
|
||||
|
||||
// wav header info (WAVEFORMATEX)
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.wFormatTag), -1);
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.nChannels), -1);
|
||||
IF_ERR(!read_dword(hdr, &fmt->adpcm.wav.nSamplesPerSec), -1);
|
||||
IF_ERR(!read_dword(hdr, &fmt->adpcm.wav.nAvgBytesPerSec), -1);
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.nBlockAlign), -1);
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.wBitsPerSample), -1);
|
||||
IF_ERR(!read_word(hdr, &fmt->adpcm.wav.cbSize), -1);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.wFormatTag), goto Error);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.nChannels), goto Error);
|
||||
IF_ERR2(!read_dword(hdr, &fmt->adpcm.wav.nSamplesPerSec), goto Error);
|
||||
IF_ERR2(!read_dword(hdr, &fmt->adpcm.wav.nAvgBytesPerSec), goto Error);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.nBlockAlign), goto Error);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.wBitsPerSample), goto Error);
|
||||
IF_ERR2(!read_word(hdr, &fmt->adpcm.wav.cbSize), goto Error);
|
||||
// adpcm specific header info
|
||||
IF_ERR(!read_word_s(hdr, &fmt->adpcm.wSamplesPerBlock), -1);
|
||||
IF_ERR(!read_word_s(hdr, &fmt->adpcm.wNumCoef), -1);
|
||||
IF_ERR2(!read_word_s(hdr, &fmt->adpcm.wSamplesPerBlock), goto Error);
|
||||
IF_ERR2(!read_word_s(hdr, &fmt->adpcm.wNumCoef), goto Error);
|
||||
|
||||
// allocate memory for COEF struct and fill it
|
||||
fmt->adpcm.aCoef = (ADPCMCOEFSET *)vm_malloc(sizeof(ADPCMCOEFSET) * fmt->adpcm.wNumCoef);
|
||||
IF_ERR(fmt->adpcm.aCoef == NULL, -1);
|
||||
IF_ERR2(fmt->adpcm.aCoef == NULL, goto Error);
|
||||
|
||||
for (int i=0; i<fmt->adpcm.wNumCoef; i++) {
|
||||
IF_ERR(!read_short(hdr, &fmt->adpcm.aCoef[i].iCoef1), -1);
|
||||
IF_ERR(!read_short(hdr, &fmt->adpcm.aCoef[i].iCoef2), -1);
|
||||
for (i = 0; i < fmt->adpcm.wNumCoef; i++) {
|
||||
IF_ERR2(!read_short(hdr, &fmt->adpcm.aCoef[i].iCoef1), goto Error);
|
||||
IF_ERR2(!read_short(hdr, &fmt->adpcm.aCoef[i].iCoef2), goto Error);
|
||||
}
|
||||
|
||||
// allocate memory for the ADPCM block header that's to be filled later
|
||||
fmt->header = (ADPCMBLOCKHEADER *)vm_malloc(sizeof(ADPCMBLOCKHEADER) * fmt->adpcm.wav.nChannels);
|
||||
IF_ERR(fmt->header == NULL, -1);
|
||||
IF_ERR2(fmt->header == NULL, goto Error);
|
||||
|
||||
// sanity check, should always be 4
|
||||
if (fmt->adpcm.wav.wBitsPerSample != 4) {
|
||||
@@ -509,23 +550,44 @@ int ACM_stream_open(WAVEFORMATEX *pwfxSrc, WAVEFORMATEX *pwfxDest, void **stream
|
||||
}
|
||||
|
||||
fmt->sample_frame_size = dest_bps/8*pwfxSrc->nChannels;
|
||||
fmt->dest_bps = (ushort)dest_bps;
|
||||
|
||||
acm_stream_t *str = (acm_stream_t *)vm_malloc(sizeof(acm_stream_t));
|
||||
IF_ERR(str == NULL, -1);
|
||||
str = (acm_stream_t *)vm_malloc(sizeof(acm_stream_t));
|
||||
IF_ERR2(str == NULL, goto Error);
|
||||
str->fmt = fmt;
|
||||
str->dest_bps = dest_bps;
|
||||
str->dest_bps = (ushort)dest_bps;
|
||||
str->src_bps = pwfxSrc->wBitsPerSample;
|
||||
*stream = str;
|
||||
|
||||
if (stream) {
|
||||
*stream = str;
|
||||
}
|
||||
|
||||
// close the io stream
|
||||
mmioClose( hdr, 0 );
|
||||
|
||||
return 0;
|
||||
|
||||
Error:
|
||||
if (fmt) {
|
||||
adpcm_memory_free(fmt);
|
||||
}
|
||||
|
||||
if (str) {
|
||||
vm_free(str);
|
||||
}
|
||||
|
||||
mmioClose( hdr, 0 );
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ACM_stream_close(void *stream)
|
||||
{
|
||||
Assert(stream != NULL);
|
||||
if (stream == NULL) {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
|
||||
acm_stream_t *str = (acm_stream_t *)stream;
|
||||
adpcm_memory_free(str->fmt);
|
||||
vm_free(str);
|
||||
@@ -535,7 +597,11 @@ int ACM_stream_close(void *stream)
|
||||
|
||||
int ACM_query_source_size(void *stream, int dest_len)
|
||||
{
|
||||
Assert(stream != NULL);
|
||||
if (stream == NULL) {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
|
||||
acm_stream_t *str = (acm_stream_t *)stream;
|
||||
|
||||
// estimate size of compressed data
|
||||
@@ -546,7 +612,11 @@ int ACM_query_source_size(void *stream, int dest_len)
|
||||
|
||||
int ACM_query_dest_size(void *stream, int src_len)
|
||||
{
|
||||
Assert(stream != NULL);
|
||||
if (stream == NULL) {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
|
||||
acm_stream_t *str = (acm_stream_t *)stream;
|
||||
|
||||
// estimate size of uncompressed data
|
||||
@@ -557,11 +627,15 @@ int ACM_query_dest_size(void *stream, int src_len)
|
||||
|
||||
int ACM_convert(void *stream, ubyte *src, int src_len, ubyte *dest, int max_dest_bytes, unsigned int *dest_len, unsigned int *src_bytes_used)
|
||||
{
|
||||
Assert( stream != NULL );
|
||||
Assert( src != NULL );
|
||||
Assert( src_len > 0 );
|
||||
Assert( dest_len != NULL );
|
||||
|
||||
if (stream == NULL) {
|
||||
Int3();
|
||||
return 0;
|
||||
}
|
||||
|
||||
acm_stream_t *str = (acm_stream_t *)stream;
|
||||
uint rc;
|
||||
MMIOINFO IOrw;
|
||||
@@ -583,38 +657,15 @@ int ACM_convert(void *stream, ubyte *src, int src_len, ubyte *dest, int max_dest
|
||||
rc = read_sample_fmt_adpcm(dest, rw, str->fmt);
|
||||
|
||||
// send back actual sizes
|
||||
*dest_len = rc;
|
||||
*src_bytes_used = str->fmt->bytes_processed;
|
||||
if (dest_len) {
|
||||
*dest_len = rc;
|
||||
}
|
||||
|
||||
if (src_bytes_used) {
|
||||
*src_bytes_used = str->fmt->bytes_processed;
|
||||
}
|
||||
|
||||
mmioClose( rw, 0 );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ACM_init() - decoding should always work
|
||||
int ACM_init()
|
||||
{
|
||||
if ( ACM_inited == 1 )
|
||||
return 0;
|
||||
|
||||
ACM_inited = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// close out
|
||||
void ACM_close()
|
||||
{
|
||||
if ( ACM_inited == 0 )
|
||||
return;
|
||||
|
||||
ACM_inited = 0;
|
||||
}
|
||||
|
||||
// Query if the ACM system is initialized
|
||||
int ACM_is_inited()
|
||||
{
|
||||
return ACM_inited;
|
||||
}
|
||||
|
||||
#endif // USE_OPENAL
|
||||
@@ -16,17 +16,9 @@
|
||||
#include "mm/mmreg.h"
|
||||
#endif
|
||||
|
||||
#ifndef USE_OPENAL
|
||||
#include "mm/msacm.h"
|
||||
#endif
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
int ACM_convert_ADPCM_to_PCM(WAVEFORMATEX *pwfxSrc, ubyte *src, int src_len, ubyte **dest, int max_dest_bytes, int *dest_len, unsigned int *src_bytes_used, unsigned short dest_bps=16);
|
||||
int ACM_init();
|
||||
void ACM_close();
|
||||
int ACM_is_inited();
|
||||
|
||||
|
||||
int ACM_stream_open(WAVEFORMATEX *pwfxSrc, WAVEFORMATEX *pwfxDest, void **stream, int dest_bps=16);
|
||||
int ACM_stream_close(void *stream);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+1224
-1132
File diff suppressed because it is too large.
Load diff
+15
-13
@@ -8,24 +8,26 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include "directx/vdsound.h"
|
||||
|
||||
#ifndef __CHANNEL_H__
|
||||
#define __CHANNEL_H__
|
||||
|
||||
typedef struct channel
|
||||
{
|
||||
int sig; // uniquely identifies the sound playing on the channel
|
||||
int snd_id; // identifies which kind of sound is playing
|
||||
LPDIRECTSOUNDBUFFER pdsb; // pointer to the secondary buffer that was duplicated
|
||||
LPDIRECTSOUND3DBUFFER pds3db; // 3D interface, only used if sound buffer created with CTRL3D flag
|
||||
int looping; // flag to indicate that the sound is looping
|
||||
int vol; // in DirectSound units
|
||||
int priority; // implementation dependant priority
|
||||
bool is_voice_msg;
|
||||
DWORD last_position;
|
||||
int sig; // uniquely identifies the sound playing on the channel
|
||||
int snd_id; // identifies which kind of sound is playing
|
||||
ALuint source_id; // OpenAL source id
|
||||
int sid; // currently bound sound buffer index (-1 if none)
|
||||
int looping; // flag to indicate that the sound is looping
|
||||
float vol; // in linear scale
|
||||
int priority; // implementation dependant priority
|
||||
unsigned int last_position;
|
||||
bool is_voice_msg;
|
||||
|
||||
channel() :
|
||||
sig(-1), snd_id(-1), source_id(0), sid(-1), looping(0), vol(1.0f),
|
||||
priority(0), last_position(0), is_voice_msg(false)
|
||||
{
|
||||
}
|
||||
} channel;
|
||||
|
||||
|
||||
|
||||
Loaded 100 of 204 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user