Skip to content

Commit fa621b6

Browse files
committed
Add function to find looping ambient sounds by sfx_id
1 parent d2314a2 commit fa621b6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

prboom2/src/dsda/ambient.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ typedef struct {
4343
std::unordered_map<std::string, named_sfx_t> name_to_sfx;
4444
std::unordered_map<int, ambient_sfx_t> id_to_ambient_sfx;
4545

46+
dboolean dsda_IsLoopingAmbientSFX(int sfx_id) {
47+
for (auto &amb_sfx : id_to_ambient_sfx) {
48+
if (amb_sfx.second.sfx_id == sfx_id && amb_sfx.second.min_tics < 0)
49+
return true;
50+
}
51+
52+
return false;
53+
}
54+
4655
static ambient_sfx_t* dsda_AmbientSFX(int id) {
4756
return id_to_ambient_sfx[id].sfx_id ? &id_to_ambient_sfx[id] : NULL;
4857
}

prboom2/src/dsda/ambient.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ typedef struct {
4040
int wait_tics;
4141
} ambient_source_t;
4242

43+
dboolean dsda_IsLoopingAmbientSFX(int sfx_id);
4344
void dsda_UpdateAmbientSource(ambient_source_t* source);
4445
void dsda_SpawnAmbientSource(mobj_t* mobj);
4546
void dsda_LoadAmbientSndInfo(void);

0 commit comments

Comments
 (0)