Skip to content

Commit

Permalink
fix(zc): sfx accidentally disabled in save select screen
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Sep 7, 2023
1 parent 3583e94 commit 5fef068
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/zc/title.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ void titlescreen(int32_t lsave)
int32_t q=Quit;

Quit=0;
Playing=Paused=false;
Playing=Paused=GameLoaded=false;
FFCore.kb_typing_mode = false;
FFCore.skip_ending_credits = 0;

Expand Down
8 changes: 4 additions & 4 deletions src/zc/zc_sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7129,7 +7129,7 @@ int32_t onSound()
zcmusic_set_volume(zcmusic, emusic_volume);

int32_t temp_volume = sfx_volume;
if (!get_qr(qr_OLD_SCRIPT_VOLUME))
if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME))
temp_volume = (sfx_volume * FFCore.usr_sfx_volume) / 10000 / 100;
for(int32_t i=0; i<WAV_COUNT; ++i)
{
Expand Down Expand Up @@ -8293,7 +8293,7 @@ bool try_zcmusic(char *filename, int32_t track, int32_t midi, int32_t fadeoutfra

zcmusic=newzcmusic;
int32_t temp_volume = emusic_volume;
if (!get_qr(qr_OLD_SCRIPT_VOLUME))
if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME))
temp_volume = (emusic_volume * FFCore.usr_music_volume) / 10000 / 100;
temp_volume = (temp_volume * zcmusic->fadevolume) / 10000;
zcmusic_play(zcmusic, temp_volume);
Expand Down Expand Up @@ -8636,7 +8636,7 @@ bool sfx_init(int32_t index)
}

int32_t temp_volume = sfx_volume;
if (!get_qr(qr_OLD_SCRIPT_VOLUME))
if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME))
temp_volume = (sfx_volume * FFCore.usr_sfx_volume) / 10000 / 100;
voice_set_volume(sfx_voice[index], temp_volume);
}
Expand Down Expand Up @@ -8701,7 +8701,7 @@ void sfx(int32_t index,int32_t pan,bool loop, bool restart, int32_t vol, int32_t

// Only used by ZScript currently
int32_t temp_volume = (sfx_volume * vol) / 10000 / 100;
if (!get_qr(qr_OLD_SCRIPT_VOLUME))
if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME))
temp_volume = (temp_volume * FFCore.usr_sfx_volume) / 10000 / 100;
voice_set_volume(sfx_voice[index], temp_volume);

Expand Down
3 changes: 3 additions & 0 deletions src/zc/zelda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ bool Throttlefps = true, MenuOpen = false, ClickToFreeze=false, Paused=false, Sa
double aspect_ratio = 0.75;
int window_min_width = 320, window_min_height = 240;
bool Playing, FrameSkip=false, TransLayers = true,clearConsoleOnLoad = true,clearConsoleOnReload = true;
bool GameLoaded = false;
bool __debug=false,debug_enabled = false;
bool refreshpal,blockpath = false,loaded_guys= false,freeze_guys= false,
loaded_enemies= false,drawguys= false,details=false,watch= false;
Expand Down Expand Up @@ -1672,6 +1673,7 @@ int32_t init_game()
if(clearConsoleOnLoad)
clearConsole();
new_subscreen_active = nullptr;
GameLoaded = true;

// Various things use the frame counter to do random stuff (ex: runDrunkRNG).
// We only bother setting it to 0 here so that recordings will play back the
Expand Down Expand Up @@ -2357,6 +2359,7 @@ int32_t init_game()
int32_t cont_game()
{
replay_step_comment("cont_game");
GameLoaded = true;
timeExitAllGenscript(GENSCR_ST_CONTINUE);
throwGenScriptEvent(GENSCR_EVENT_CONTINUE);
// introclk=intropos=msgclk=msgpos=dmapmsgclk=0;
Expand Down
1 change: 1 addition & 0 deletions src/zc/zelda.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ extern bool blockmoving;
extern bool Throttlefps, MenuOpen, ClickToFreeze, Paused, Saving, Advance, ShowFPS, Showpal,
Playing, FrameSkip, TransLayers, clearConsoleOnLoad, clearConsoleOnReload, disableClickToFreeze,
SaveDragResize, DragAspect, SaveWinPos, scaleForceInteger, stretchGame;
extern bool GameLoaded;
extern int32_t LastWidth, LastHeight;
extern bool refreshpal,blockpath,__debug,loaded_guys,freeze_guys;
extern bool loaded_enemies,drawguys,details,debug_enabled,watch;
Expand Down

0 comments on commit 5fef068

Please sign in to comment.