24 static const int NUM_RETAIL_GAMEPLAY_SOUNDS = 192;
236 if (i < NUM_RETAIL_GAMEPLAY_SOUNDS)
238 it->enhanced_sound_data.priority= Default_sound_priorities[
i].
priority;
242 it->enhanced_sound_data.priority= default_enhanced_sound_data.
priority;
246 if (it->enhanced_sound_data.limit < 1)
248 if (i < NUM_RETAIL_GAMEPLAY_SOUNDS)
250 it->enhanced_sound_data.limit = Default_sound_priorities[
i].
limit;
254 it->enhanced_sound_data.limit= default_enhanced_sound_data.
limit;
262 if (Snds_iface_handle[n] >= 0)
265 Snds_iface_handle[
n] =
snd_play(&Snds_iface[n]);
279 if (name == NULL || *name == 0 || !strcmp(name,
"-1"))
284 Assert( sounds.size() <= INT_MAX );
290 if (!snd->name.compare(name))
303 Assert( Snds.size() <= INT_MAX );
312 char *
p = strrchr( snd->filename,
'.' );
315 if(!
stricmp(snd->filename, name))
321 else if(!
strnicmp(snd->filename, name, p-snd->filename))
336 Assert( Snds_iface.size() <= INT_MAX );
337 Assert( Snds_iface.size() == Snds_iface_handle.size() );
346 char *
p = strrchr( snd->filename,
'.' );
349 if(!
stricmp(snd->filename, name))
355 else if(!
strnicmp(snd->filename, name, p-snd->filename))
378 Assert( Snds_iface.size() == Snds_iface_handle.size() );
410 size_t size_to_check = 0;
412 if(flags & PARSE_SOUND_INTERFACE_SOUND)
414 size_to_check = Snds_iface.size();
415 Assert( Snds_iface.size() == Snds_iface_handle.size() );
419 size_to_check = Snds.size();
422 Assert( size_to_check <= INT_MAX );
425 if((*idx_dest) < -1 || (*idx_dest) >= (
int)size_to_check)
428 Warning(
LOCATION,
"%s sound index out of range on '%s'. Must be between 0 and " SIZE_T_ARG ". Forcing to -1 (Nonexistent sound).\n",
429 tag, object_name, size_to_check);
487 if(destination.size() <=
i)
489 destination.push_back(-1);
496 if(!(flags & PARSE_SOUND_SCP_SOUND_LIST) && (destination.size() != (unsigned)check))
498 mprintf((
"%s in '%s' has " SIZE_T_ARG " entries. This does not match entered size of %i.", tag, object_name, destination.size(), check));
515 Assert( Snds.size() <= INT_MAX );
517 if (
gs->filename[0] != 0 &&
strnicmp(
gs->filename,
NOX(
"none.wav"), 4) ) {
519 game_busy(
NOX(
"** preloading common game sounds **") );
534 Assert( Snds.size() <= INT_MAX );
536 if (
gs->filename[0] != 0 &&
strnicmp(
gs->filename,
NOX(
"none.wav"), 4) ) {
537 if ( !
gs->preload ) {
550 Assert( Snds.size() <= INT_MAX );
552 if (
gs->id != -1 ) {
567 Assert( Snds_iface.size() < INT_MAX );
569 if ( si->filename[0] != 0 &&
strnicmp(si->filename,
NOX(
"none.wav"), 4) ) {
580 Assert( Snds_iface.size() < INT_MAX );
582 if ( si->id != -1 ) {
630 int temp_min, temp_max;
638 mprintf((
"Dutifully converting retail sound %s, '%s' to a 3D sound...\n", gs->
name.c_str(), gs->
filename));
653 Warning(
LOCATION,
"Unexpected extra value %d found for sound '%s' (filename '%s')! Check the format of the sounds.tbl (or .tbm) entry.", temp, gs->
name.c_str(), gs->
filename);
661 Assertion(priority_str != NULL,
"convert_to_enhanced_priority given null priority_str!");
663 if (!
stricmp(priority_str,
"Must Play"))
667 else if (!
stricmp(priority_str,
"High"))
671 else if (!
stricmp(priority_str,
"Medium-High"))
675 else if (!
stricmp(priority_str,
"Medium"))
679 else if (!
stricmp(priority_str,
"Medium-Low"))
683 else if (!
stricmp(priority_str,
"Low"))
689 error_display(1,
"Unknown enhanced sound priority: %s\n", priority_str);
725 error_display(1,
"'<same>' is only allowed if +nocreate was specified!");
780 error_display(1,
"Invalid enhanced sound limit: %d\n", temp_limit);
793 if (lookupVector != NULL)
809 Warning(
LOCATION,
"No existing sound entry with name \"%s\" found!", name.c_str());
815 gs = &lookupVector->at(vectorIndex);
841 Assertion(gs != NULL,
"Invalid game_snd pointer passed to gamesnd_parse_line!");
845 bool no_create =
false;
847 if (lookupVector != NULL)
862 char name[65] = {
'\0' };
863 char template_name[65] = {
'\0' };
877 template_name[0] =
'\0';
1045 Snds.push_back(
game_snd(tempSound));
1060 Snds_iface.push_back(
game_snd(tempSound));
1061 Snds_iface_handle.push_back(-1);
1072 int sanity_check = 0;
1106 mprintf((
"TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
1123 if (missingFlybySounds.size() > 0)
1126 for (
size_t i = 0;
i < missingFlybySounds.size();
i++)
1128 errorString.append(missingFlybySounds[
i].species_name);
1129 errorString.append(
"\n");
1132 Error(
LOCATION,
"The following species are missing flyby sounds in sounds.tbl:\n%s", errorString.c_str());
1135 missingFlybySounds.clear();
1145 Snds_iface_handle.clear();
void advance_to_eoln(char *more_terminators)
int check_for_string(const char *pstr)
EnhancedSoundPriority convert_to_enhanced_priority(const char *priority_str)
float flReflectionsPan[3]
LOCAL state_stack gs[GS_STACK_SIZE]
void gamesnd_parse_soundstbl()
int stuff_int_optional(int *i, bool raw)
SCP_vector< game_snd > Snds
int gamesnd_get_by_tbl_index(int index)
void gamesnd_unload_gameplay_sounds()
int snd_load(game_snd *gs, int allow_hardware_load)
user_over (mouse over a control)
bool preload
preload sound (ie read from disk before mission starts)
char * object_name(int obj)
void parse_sound_core(const char *tag, int *idx_dest, const char *object_name, const char *buf, parse_sound_flags flags)
int min
distance at which sound will stop getting louder
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
general failure sound for any event
int gamesnd_get_by_name(const char *name)
void parse_gamesnd_new(game_snd *gs, bool no_create)
#define Assertion(expr, msg,...)
game_snd snd_flyby_bomber
game_snd snd_flyby_fighter
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
int required_string_either(char *str1, char *str2)
Checks for one of two required strings.
GLenum GLuint GLenum GLsizei const GLchar * buf
void gamesnd_parse_entry(game_snd *gs, bool no_create, SCP_vector< game_snd > *lookupVector)
void stuff_float(float *f)
char filename[MAX_FILENAME_LEN]
#define CLAMP(x, min, max)
void game_busy(const char *filename=NULL)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
void parse_sound(const char *tag, int *idx_dest, const char *object_name, parse_sound_flags flags)
void gamesnd_unload_interface_sounds()
void gamesnd_load_interface_sounds()
#define strnicmp(s1, s2, n)
void stuff_string(char *outstr, int type, int len, char *terminators)
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
float flRoomRolloffFactor
int required_string(const char *pstr)
int snd_play(game_snd *gs, float pan, float vol_scale, int priority, bool is_voice_msg)
int optional_string(const char *pstr)
bool required_string_no_create(const char *token, bool no_create)
EnhancedSoundData enhanced_sound_data
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
void gamesnd_load_gameplay_sounds()
void parse_sound_table(const char *filename)
bool gamesnd_parse_line(game_snd *gs, const char *tag, SCP_vector< game_snd > *lookupVector=NULL)
SCP_vector< game_snd > Snds_iface
void stuff_boolean(int *i, bool a_to_eol)
int max
distance at which sound is inaudible
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
Parse the list of sounds SCP style (just indexes and/or files names, no count first) ...
void gamesnd_preload_common_sounds()
SCP_string name
The name of the sound.
void reset_parse(char *text)
GLuint const GLchar * name
int gamesnd_get_by_iface_name(const char *name)
void parse_gamesnd_old(game_snd *gs)
int ds_eax_get_prop(EFXREVERBPROPERTIES **props, const char *name, const char *template_name)
const unsigned int SND_ENHANCED_MAX_LIMIT
#define GAME_SND_USE_DS3D
void parse_sound_environments()
Search for sound in the interface part of sounds.tbl.
void common_play_highlight_sound()
char species_name[NAME_LENGTH]
void gamesnd_play_error_beep()
SCP_vector< species_info > Species_info
void error_display(int error_level, char *format,...)
int parse_modular_table(const char *name_check, void(*parse_callback)(const char *filename), int path_type, int sort_type)
float flAirAbsorptionGainHF
SCP_vector< int > Snds_iface_handle
void stuff_string_white(char *outstr, int len)
void gamesnd_play_iface(int n)
int stuff_float_list(float *flp, int max_floats)
void parse_sound_list(const char *tag, SCP_vector< int > &destination, const char *object_name, parse_sound_flags flags)
float default_volume
range: 0.0 -> 1.0
void gamesnd_add_retail_default_enhanced_sound_data()
int gamesnd_lookup_name(const char *name, const SCP_vector< game_snd > &sounds)
int gamesnd_get_by_iface_tbl_index(int index)