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

Fixup loading SFX & PALEFFECT preview #359

Merged
merged 11 commits into from
Jul 22, 2024

Conversation

jonko0493
Copy link
Member

@jonko0493 jonko0493 commented Jul 17, 2024

So basically, I was frustrated trying to add an SFX to a scene and realized through debugging that my assumption that SFX are all loaded in at once via the SDAT groups on a per-scene basis was wrong. In actuality, here is the "play sound" chunk of the SND_PLAY command's routine:

if ( startStopMode == SFX_START )
{
  crossfadeDupe = parameters->crossfadeDupe;
  loadSoundIfLessThanZero = crossfadeDupe < 0;
  if ( crossfadeDupe < 0 )
    loadSoundIfLessThanZero = parameters->crossfadeTime < 0;
  if ( loadSoundIfLessThanZero )
  {
    snd_loadSound(parameters->soundIndex);
    volume = parameters->volume;
    if ( volume < 100 )
      snd_play(parameters->soundIndex, volume, 6);
  }
  else
  {
    sndIndex = parameters->soundIndex;
    volume_1 = parameters->volume;
    if ( crossfadeDupe < 0 )
      snd_play(sndIndex, volume_1, parameters->crossfadeTime);
    else
      snd_play(sndIndex, volume_1, crossfadeDupe);
  }
}

As you can see, it does a little dance with the two crossfade parameters: if both of them are less than zero, it loads the sound into memory. Otherwise, it does its crossfading stuff.

This PR reflects this new information and adds a checkbox for loading new SFX in. It also makes that checkbox turned on by default when adding commands and adds a little functionality to disable the crossfade numeric stepper when it's checked.

This PR also fixes up BG_PALEFFECT's preview (so that it applies to the background) and also adjusts the sepia filter to look closer to what it looks like in-game.

@jonko0493 jonko0493 self-assigned this Jul 17, 2024
@jonko0493 jonko0493 changed the title Fixup loading SFX Fixup loading SFX & PALEFFECT preview Jul 17, 2024
Copy link
Member

@WiIIiam278 WiIIiam278 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice :)

@jonko0493 jonko0493 merged commit 2c9c9f3 into haroohie-club:main Jul 22, 2024
4 checks passed
@jonko0493 jonko0493 deleted the LoadSfxFix branch July 22, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants