Skip to content

Commit

Permalink
Merge pull request scp-fs2open#6352 from Goober5000/allow_explicitly_…
Browse files Browse the repository at this point in the history
…empty_sounds

allow explicitly empty sounds
  • Loading branch information
Goober5000 authored Sep 18, 2024
2 parents 461c628 + b596fa3 commit 56fc5b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/gamesnd/gamesnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ void parse_gamesnd_old(game_snd* gs)
{
entry.filename[0] = 0;
advance_to_eoln(nullptr);
gs->flags |= GAME_SND_NOT_VALID;
gs->flags |= (GAME_SND_NOT_VALID | GAME_SND_EXPLICITLY_EMPTY);
return;
}
Mp++;
Expand Down Expand Up @@ -883,7 +883,7 @@ void parse_gamesnd_new(game_snd* gs, bool no_create)
if (!stricmp(name, NOX("empty")) || !stricmp(name, NOX("none")))
{
entry->filename[0] = 0;
gs->flags |= GAME_SND_NOT_VALID;
gs->flags |= (GAME_SND_NOT_VALID | GAME_SND_EXPLICITLY_EMPTY);
return;
}

Expand Down Expand Up @@ -965,7 +965,7 @@ void parse_gamesnd_new(game_snd* gs, bool no_create)

bool gamesnd_is_placeholder(const game_snd& gs)
{
return gs.sound_entries.empty() || gs.sound_entries[0].filename[0] == '\0';
return (gs.sound_entries.empty() || gs.sound_entries[0].filename[0] == '\0') && !(gs.flags & GAME_SND_EXPLICITLY_EMPTY);
}

void gamesnd_parse_entry(game_snd *gs, bool &orig_no_create, SCP_vector<game_snd> *lookupVector, size_t lookupVectorMaxIndexableSize, bool (*is_reserved_index)(int))
Expand Down
1 change: 1 addition & 0 deletions code/sound/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define GAME_SND_NOT_VALID (1<<2)
#define GAME_SND_PRELOAD (1<<3) //!< preload sound (ie read from disk before mission starts)
#define GAME_SND_RETAIL_STYLE (1<<4)
#define GAME_SND_EXPLICITLY_EMPTY (1<<5) // a sound that has been parsed as empty

// Priorities that can be passed to snd_play() functions to limit how many concurrent sounds of a
// given type are played.
Expand Down

0 comments on commit 56fc5b4

Please sign in to comment.