Skip to content

Commit

Permalink
Fix F7 menu crash
Browse files Browse the repository at this point in the history
  • Loading branch information
andrikpowell committed Dec 7, 2024
1 parent 5976acf commit 2b38fc0
Showing 1 changed file with 78 additions and 77 deletions.
155 changes: 78 additions & 77 deletions prboom2/src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1189,81 +1189,6 @@ void M_Options(int choice)
M_SetupNextMenu(&OptionsDef);
}

/////////////////////////////
//
// M_QuitDOOM
//
int quitsounds[8] =
{
sfx_pldeth,
sfx_dmpain,
sfx_popain,
sfx_slop,
sfx_telept,
sfx_posit1,
sfx_posit3,
sfx_sgtatk
};

int quitsounds2[8] =
{
sfx_vilact,
sfx_getpow,
sfx_boscub,
sfx_slop,
sfx_skeswg,
sfx_kntdth,
sfx_bspact,
sfx_sgtatk
};

static void M_QuitResponse(dboolean affirmative)
{
if (!affirmative)
return;

if (!netgame // killough 12/98
&& !nosfxparm
&& dsda_IntConfig(dsda_config_quit_sounds))
{
int i;

if (gamemode == commercial)
S_StartVoidSound(quitsounds2[(gametic>>2)&7]);
else
S_StartVoidSound(quitsounds[(gametic>>2)&7]);

// wait till all sounds stopped or 3 seconds are over
i = 30;
while (i > 0) {
I_uSleep(100000); // CPhipps - don't thrash cpu in this loop
if (!I_AnySoundStillPlaying())
break;
i--;
}
}

//e6y: I_SafeExit instead of exit - prevent recursive exits
I_SafeExit(0); // killough
}

void M_QuitDOOM(int choice)
{
static char endstring[160];

// We pick index 0 which is language sensitive,
// or one at random, between 1 and maximum number.
// Ty 03/27/98 - externalized DOSY as a string s_DOSY that's in the sprintf
if (language != english)
sprintf(endstring,"%s\n\n%s",s_DOSY, *endmsg[0] );
else // killough 1/18/98: fix endgame message calculation:
sprintf(endstring,"%s\n\n%s", *endmsg[gametic%(NUM_QUITMESSAGES-1)+1], s_DOSY);

if (dsda_SkipQuitPrompt())
M_QuitResponse(true);
else
M_StartMessage(endstring,M_QuitResponse,true);
}

/////////////////////////////
//
Expand Down Expand Up @@ -3186,6 +3111,84 @@ setup_menu_t tas_settings[] = {
FINAL_ENTRY
};

/////////////////////////////
//
// M_QuitDOOM
//
int quitsounds[8] =
{
sfx_pldeth,
sfx_dmpain,
sfx_popain,
sfx_slop,
sfx_telept,
sfx_posit1,
sfx_posit3,
sfx_sgtatk
};

int quitsounds2[8] =
{
sfx_vilact,
sfx_getpow,
sfx_boscub,
sfx_slop,
sfx_skeswg,
sfx_kntdth,
sfx_bspact,
sfx_sgtatk
};

static void M_QuitResponse(dboolean affirmative)
{
if (!affirmative)
return;

if (!netgame // killough 12/98
&& !nosfxparm
&& dsda_IntConfig(dsda_config_quit_sounds))
{
int i;

if (gamemode == commercial)
S_StartVoidSound(quitsounds2[(gametic>>2)&7]);
else
S_StartVoidSound(quitsounds[(gametic>>2)&7]);

// wait till all sounds stopped or 3 seconds are over
i = 30;
while (i > 0) {
I_uSleep(100000); // CPhipps - don't thrash cpu in this loop
if (!I_AnySoundStillPlaying())
break;
i--;
}
}

//e6y: I_SafeExit instead of exit - prevent recursive exits
I_SafeExit(0); // killough
}

void M_QuitDOOM(int choice)
{
static char endstring[160];
setup_active = false;
currentMenu = NULL;

// We pick index 0 which is language sensitive,
// or one at random, between 1 and maximum number.
// Ty 03/27/98 - externalized DOSY as a string s_DOSY that's in the sprintf
if (language != english)
sprintf(endstring,"%s\n\n%s",s_DOSY, *endmsg[0] );
else // killough 1/18/98: fix endgame message calculation:
sprintf(endstring,"%s\n\n%s", *endmsg[gametic%(NUM_QUITMESSAGES-1)+1], s_DOSY);

if (dsda_SkipQuitPrompt())
M_QuitResponse(true);
else
M_StartMessage(endstring,M_QuitResponse,true);
}

// To (un)set fullscreen video after menu changes
void M_ChangeFullScreen(void)
{
Expand Down Expand Up @@ -6028,8 +6031,6 @@ void M_Ticker (void)

void M_StartMessage (const char* string,void* routine,dboolean input)
{
currentMenu = NULL;
setup_active = false;
messageLastMenuActive = menuactive;
messageToPrint = 1;
messageString = string;
Expand Down

0 comments on commit 2b38fc0

Please sign in to comment.