Skip to content

Commit ee9770d

Browse files
committed
properly fill sounds into placeholder slots
1 parent 9d6c850 commit ee9770d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

code/gamesnd/gamesnd.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,26 @@ void gamesnd_parse_entry(game_snd *gs, bool &orig_no_create, SCP_vector<game_snd
10311031
error_display(0, "Duplicate sound name \"%s\" found!", name.c_str());
10321032
}
10331033
}
1034+
else if (lookupVector)
1035+
{
1036+
// see if there is an empty or placeholder sound that we can replace
1037+
int i = 0;
1038+
for (const auto& ii : *lookupVector)
1039+
{
1040+
if (gamesnd_is_placeholder(ii) && !is_reserved_index(i))
1041+
{
1042+
vectorIndex = i;
1043+
gs = &lookupVector->at(vectorIndex);
1044+
orig_no_create = true; // prevent sound from being appended in parse_sound_table
1045+
// (leave no_create as false because we are creating a new sound and we need all the fields to be filled out)
1046+
1047+
// a placeholder can have a single entry with an empty filename, so remove that if it exists
1048+
gs->sound_entries.clear();
1049+
break;
1050+
}
1051+
i++;
1052+
}
1053+
}
10341054

10351055
gs->name = std::move(name);
10361056
}

0 commit comments

Comments
 (0)