Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow explicitly empty sounds #6352

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions code/gamesnd/gamesnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,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 @@ -880,7 +880,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 @@ -962,7 +962,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
Loading