Skip to content

Commit bbad836

Browse files
committed
FACT: Pull fadeInMs assignment out of handle_instance_limit
1 parent 031207d commit bbad836

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/FACT_internal.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ static bool get_active_variation_index(FACTCue *cue, uint16_t *index)
525525
}
526526

527527
/* Returns false if the behaviour is FAIL. */
528-
static bool handle_instance_limit(FACTCue *cue, FACTAudioCategory *category, uint16_t *fade_in_ms)
528+
static bool handle_instance_limit(FACTCue *cue, FACTAudioCategory *category)
529529
{
530530
const FACTAudioEngine *engine = cue->parentBank->parentEngine;
531531
float quietest_volume = FACTVOLUME_MAX;
@@ -579,14 +579,6 @@ static bool handle_instance_limit(FACTCue *cue, FACTAudioCategory *category, uin
579579

580580
if (replaced)
581581
{
582-
if (category != NULL)
583-
{
584-
*fade_in_ms = category->fadeInMS;
585-
}
586-
else
587-
{
588-
*fade_in_ms = 0;
589-
}
590582
if (replaced->playingSound != NULL)
591583
{
592584
if (category != NULL)
@@ -839,17 +831,19 @@ bool play_sound(FACTCue *cue)
839831

840832
if (cue->data->instanceCount >= cue->data->instanceLimit)
841833
{
842-
if (!handle_instance_limit(cue, NULL, &fade_in_ms))
834+
if (!handle_instance_limit(cue, NULL))
843835
return false;
836+
fade_in_ms = cue->data->fadeInMS;
844837
}
845838

846839
if (sound->sound->category != FACTCATEGORY_INVALID)
847840
{
848841
FACTAudioCategory *category = &cue->parentBank->parentEngine->categories[sound->sound->category];
849842
if (category->instanceCount >= category->instanceLimit)
850843
{
851-
if (!handle_instance_limit(cue, category, &fade_in_ms))
844+
if (!handle_instance_limit(cue, category))
852845
return false;
846+
fade_in_ms = category->fadeInMS;
853847
}
854848

855849
++category->instanceCount;

0 commit comments

Comments
 (0)