mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-21 10:22:49 +00:00
replaced hooks_startmenu and hooks_mainmenu with a general hooks_display_dialog
This commit is contained in:
parent
ca9a025e45
commit
8f8fb8a217
@ -371,7 +371,10 @@ EX namespace dialog {
|
|||||||
valuex = dcenter - fwidth / 2 + leftwidth + innerwidth + dfsize/2;
|
valuex = dcenter - fwidth / 2 + leftwidth + innerwidth + dfsize/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX purehookset hooks_display_dialog;
|
||||||
|
|
||||||
EX void display() {
|
EX void display() {
|
||||||
|
callhooks(hooks_display_dialog);
|
||||||
int N = items.size();
|
int N = items.size();
|
||||||
dfsize = vid.fsize;
|
dfsize = vid.fsize;
|
||||||
#if ISMOBILE || ISPANDORA
|
#if ISMOBILE || ISPANDORA
|
||||||
|
@ -7772,8 +7772,15 @@ EX vector< function<void()> > screens = { normalscreen };
|
|||||||
template<class T> void pushScreen(const T& x) { screens.push_back(x); }
|
template<class T> void pushScreen(const T& x) { screens.push_back(x); }
|
||||||
inline void popScreen() { if(isize(screens)>1) screens.pop_back(); }
|
inline void popScreen() { if(isize(screens)>1) screens.pop_back(); }
|
||||||
inline void popScreenAll() { while(isize(screens)>1) popScreen(); }
|
inline void popScreenAll() { while(isize(screens)>1) popScreen(); }
|
||||||
|
typedef void (*cfunction)();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
EX cfunction current_screen_cfunction() {
|
||||||
|
auto tgt = screens.back().target<cfunction>();
|
||||||
|
if(!tgt) return nullptr;
|
||||||
|
return *tgt;
|
||||||
|
}
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
namespace sm {
|
namespace sm {
|
||||||
static const int NORMAL = 1;
|
static const int NORMAL = 1;
|
||||||
|
@ -59,6 +59,12 @@ public:
|
|||||||
explicit operator bool() const noexcept {
|
explicit operator bool() const noexcept {
|
||||||
return ptr_ != nullptr;
|
return ptr_ != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T> T* target() {
|
||||||
|
auto ptr = dynamic_cast<function_state<T, R, Args...>*> (ptr_);
|
||||||
|
if(!ptr) return nullptr;
|
||||||
|
return &ptr->t_;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace hr
|
} // namespace hr
|
||||||
|
@ -206,8 +206,6 @@ EX void showOverview() {
|
|||||||
|
|
||||||
// -- main menu --
|
// -- main menu --
|
||||||
|
|
||||||
EX purehookset hooks_mainmenu;
|
|
||||||
|
|
||||||
EX void showMainMenu() {
|
EX void showMainMenu() {
|
||||||
gamescreen(2);
|
gamescreen(2);
|
||||||
|
|
||||||
@ -259,8 +257,6 @@ EX void showMainMenu() {
|
|||||||
dialog::addItem("SHARE", 's'-96);
|
dialog::addItem("SHARE", 's'-96);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
callhooks(hooks_mainmenu);
|
|
||||||
|
|
||||||
if(!canmove) q = "review the scene";
|
if(!canmove) q = "review the scene";
|
||||||
else if(turncount > 0) q = "continue game";
|
else if(turncount > 0) q = "continue game";
|
||||||
else q = "play the game!";
|
else q = "play the game!";
|
||||||
@ -643,8 +639,6 @@ EX bool showHalloween() {
|
|||||||
|
|
||||||
int daily_mode;
|
int daily_mode;
|
||||||
|
|
||||||
EX purehookset hooks_startmenu;
|
|
||||||
|
|
||||||
EX void showStartMenu() {
|
EX void showStartMenu() {
|
||||||
if(!daily_mode) {
|
if(!daily_mode) {
|
||||||
daily_mode = hrand(10) + 1;
|
daily_mode = hrand(10) + 1;
|
||||||
@ -743,8 +737,6 @@ EX void showStartMenu() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
callhooks(hooks_startmenu);
|
|
||||||
|
|
||||||
if(have_current_settings()) {
|
if(have_current_settings()) {
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
dialog::addBigItem(XLAT1("use current/saved settings"), SDLK_ESCAPE);
|
dialog::addBigItem(XLAT1("use current/saved settings"), SDLK_ESCAPE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user