Skip to content

Commit

Permalink
All Games|Menu: Disable selection of episodes whose start map is missing
Browse files Browse the repository at this point in the history
With the shareware game modes, the "buy the full game prompt" will be
displayed. Otherwise, disable the relevant button on the episode menu
and log a warning for the mod author.
  • Loading branch information
danij-deng committed Jul 24, 2014
1 parent b08c463 commit 59052b7
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions doomsday/plugins/common/src/hu_menu.cpp
Expand Up @@ -3071,23 +3071,35 @@ void Hu_MenuInitEpisodePage()
btn->setHelpInfo(helpInfo);
}

#if __JDOOM__ || __JHERETIC__
de::Uri startMap(info.gets("startMap"), RC_NULL);
if(
#if __JHERETIC__
gameMode == heretic_shareware
#else // __JDOOM__
gameMode == doom_shareware
#endif
&& startMap.path() != "E1M1")
if(P_MapExists(startMap.compose().toUtf8().constData()))
{
btn->actions[Widget::MNA_ACTIVEOUT].callback = Hu_MenuActivateNotSharewareEpisode;
btn->actions[Widget::MNA_ACTIVEOUT].callback = Hu_MenuSelectEpisode;
btn->setData(String::fromStdString(it->first));
}
else
#endif
{
btn->actions[Widget::MNA_ACTIVEOUT].callback = Hu_MenuSelectEpisode;
btn->setData(String::fromStdString(it->first));
#if __JDOOM__ || __JHERETIC__
// In shareware display a prompt to buy the full game.
if(
#if __JHERETIC__
gameMode == heretic_shareware
#else // __JDOOM__
gameMode == doom_shareware
#endif
&& startMap.path() != "E1M1")
{
btn->actions[Widget::MNA_ACTIVEOUT].callback = Hu_MenuActivateNotSharewareEpisode;
}
else
#endif
{
// Disable this selection and log a warning for the mod author.
btn->setFlags(FO_SET, MNF_DISABLED);
LOG_RES_WARNING("Failed to locate the starting map \"%s\" for episode '%s'."
" This episode will not be selectable from the menu")
<< startMap << String::fromStdString(it->first);
}
}

btn->actions[Widget::MNA_FOCUS].callback = Hu_MenuDefaultFocusAction;
Expand Down

0 comments on commit 59052b7

Please sign in to comment.