mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
rogueviz:: tutorial, start/main menu, and welcome message done as hooks
This commit is contained in:
parent
d523ceabfd
commit
3a8293df27
2
help.cpp
2
help.cpp
@ -961,6 +961,7 @@ void gotoHelp(const string& h) {
|
|||||||
pushScreen(showHelp);
|
pushScreen(showHelp);
|
||||||
if(help == "@") {
|
if(help == "@") {
|
||||||
|
|
||||||
|
/*
|
||||||
#if CAP_ROGUEVIZ
|
#if CAP_ROGUEVIZ
|
||||||
if(rogueviz::on) {
|
if(rogueviz::on) {
|
||||||
help = rogueviz::makehelp();
|
help = rogueviz::makehelp();
|
||||||
@ -968,6 +969,7 @@ void gotoHelp(const string& h) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
#if CAP_RUG
|
#if CAP_RUG
|
||||||
if(rug::rugged) {
|
if(rug::rugged) {
|
||||||
|
4
hyper.h
4
hyper.h
@ -1888,6 +1888,7 @@ namespace tour {
|
|||||||
void list(slide*);
|
void list(slide*);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern hookset<void(int)> *hooks_slide;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2019,7 +2020,7 @@ template<class T, class U> int addHook(hookset<T>*& m, int prio, const U& hook)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern purehookset hooks_frame, hooks_stats, clearmemory, hooks_config, hooks_tests, hooks_removecells, hooks_initgame, hooks_calcparam;
|
extern purehookset hooks_frame, hooks_stats, clearmemory, hooks_config, hooks_tests, hooks_removecells, hooks_initgame, hooks_calcparam, hooks_mainmenu, hooks_startmenu;
|
||||||
|
|
||||||
template<class T, class... U> void callhooks(hookset<T> *h, U... args) {
|
template<class T, class... U> void callhooks(hookset<T> *h, U... args) {
|
||||||
if(h) for(auto& p: *h) p.second(args...);
|
if(h) for(auto& p: *h) p.second(args...);
|
||||||
@ -2039,6 +2040,7 @@ extern hookset<bool(int argc, char** argv)> *hooks_main;
|
|||||||
extern hookset<int()> *hooks_args;
|
extern hookset<int()> *hooks_args;
|
||||||
extern hookset<bool(cell*)> *hooks_mark;
|
extern hookset<bool(cell*)> *hooks_mark;
|
||||||
extern hookset<eLand(eLand)> *hooks_nextland;
|
extern hookset<eLand(eLand)> *hooks_nextland;
|
||||||
|
extern hookset<bool()> *hooks_welcome_message;
|
||||||
|
|
||||||
// hooks to extend HyperRogue with an external program
|
// hooks to extend HyperRogue with an external program
|
||||||
// start compilation from another file which defines EXTRA_..., includes
|
// start compilation from another file which defines EXTRA_..., includes
|
||||||
|
26
menus.cpp
26
menus.cpp
@ -183,6 +183,8 @@ void showOverview() {
|
|||||||
|
|
||||||
// -- main menu --
|
// -- main menu --
|
||||||
|
|
||||||
|
purehookset hooks_mainmenu;
|
||||||
|
|
||||||
void showMainMenu() {
|
void showMainMenu() {
|
||||||
gamescreen(2);
|
gamescreen(2);
|
||||||
|
|
||||||
@ -225,10 +227,6 @@ void showMainMenu() {
|
|||||||
if(inv::on)
|
if(inv::on)
|
||||||
dialog::addItem(XLAT("inventory"), 'i');
|
dialog::addItem(XLAT("inventory"), 'i');
|
||||||
|
|
||||||
#if CAP_ROGUEVIZ
|
|
||||||
dialog::addItem(XLAT("rogueviz menu"), 'u');
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ISMOBILE==1
|
#if ISMOBILE==1
|
||||||
#if CAP_ACHIEVE
|
#if CAP_ACHIEVE
|
||||||
dialog::addItem(XLAT("leaderboards/achievements"), '3');
|
dialog::addItem(XLAT("leaderboards/achievements"), '3');
|
||||||
@ -239,6 +237,8 @@ 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!";
|
||||||
@ -289,9 +289,6 @@ void showMainMenu() {
|
|||||||
pushScreen(leader::showMenu);
|
pushScreen(leader::showMenu);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if CAP_ROGUEVIZ
|
|
||||||
else if(uni == 'u') pushScreen(rogueviz::showMenu);
|
|
||||||
#endif
|
#endif
|
||||||
else if(doexiton(sym, uni)) {
|
else if(doexiton(sym, uni)) {
|
||||||
popScreenAll();
|
popScreenAll();
|
||||||
@ -586,6 +583,8 @@ bool showHalloween() {
|
|||||||
|
|
||||||
int daily_mode;
|
int daily_mode;
|
||||||
|
|
||||||
|
purehookset hooks_startmenu;
|
||||||
|
|
||||||
void showStartMenu() {
|
void showStartMenu() {
|
||||||
if(!daily_mode) {
|
if(!daily_mode) {
|
||||||
daily_mode = hrand(10) + 1;
|
daily_mode = hrand(10) + 1;
|
||||||
@ -682,11 +681,7 @@ void showStartMenu() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CAP_ROGUEVIZ && CAP_TOUR
|
callhooks(hooks_startmenu);
|
||||||
dialog::addBreak(100);
|
|
||||||
dialog::addBigItem(XLAT("RogueViz"), 'r');
|
|
||||||
dialog::addInfo(XLAT("see the visualizations"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(have_current_settings()) {
|
if(have_current_settings()) {
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
@ -793,13 +788,6 @@ void showStartMenu() {
|
|||||||
popScreenAll();
|
popScreenAll();
|
||||||
pushScreen(daily::showMenu);
|
pushScreen(daily::showMenu);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if CAP_ROGUEVIZ && CAP_TOUR
|
|
||||||
else if(uni == 'r') {
|
|
||||||
tour::slides = rogueviz::rvtour::rvslides;
|
|
||||||
popScreenAll();
|
|
||||||
tour::start();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
else if(sym == 'm') {
|
else if(sym == 'm') {
|
||||||
popScreen();
|
popScreen();
|
||||||
|
39
rogueviz.cpp
39
rogueviz.cpp
@ -2038,6 +2038,37 @@ slide rvslides[] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int rvtour_hooks =
|
||||||
|
addHook(hooks_startmenu, 100, [] () {
|
||||||
|
#if CAP_TOUR
|
||||||
|
dialog::addBreak(100);
|
||||||
|
dialog::addBigItem(XLAT("RogueViz"), 'r');
|
||||||
|
dialog::addInfo(XLAT("see the visualizations"));
|
||||||
|
#endif
|
||||||
|
dialog::add_action([] () {
|
||||||
|
tour::slides = rogueviz::rvtour::rvslides;
|
||||||
|
popScreenAll();
|
||||||
|
tour::start();
|
||||||
|
});
|
||||||
|
}) +
|
||||||
|
addHook(hooks_slide, 100, [] (int mode) {
|
||||||
|
if(currentslide == 0 && slides == default_slides) {
|
||||||
|
slidecommand = "RogueViz presentation";
|
||||||
|
if(mode == 1)
|
||||||
|
help +=
|
||||||
|
"\n\nYour version of HyperRogue is compiled with RogueViz. "
|
||||||
|
"Press '5' to switch to the RogueViz slides. Watching the "
|
||||||
|
"common HyperRogue tutorial first is useful too, "
|
||||||
|
"as an introduction to hyperbolic geometry.";
|
||||||
|
if(mode == 4) {
|
||||||
|
slides = rogueviz::rvtour::rvslides;
|
||||||
|
while(tour::on) restart_game(rg::tour);
|
||||||
|
tour::start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) +
|
||||||
|
0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto hooks =
|
auto hooks =
|
||||||
@ -2053,6 +2084,14 @@ auto hooks =
|
|||||||
addHook(shmup::hooks_describe, 100, describe_monster) +
|
addHook(shmup::hooks_describe, 100, describe_monster) +
|
||||||
addHook(shmup::hooks_turn, 100, turn) +
|
addHook(shmup::hooks_turn, 100, turn) +
|
||||||
addHook(shmup::hooks_kill, 100, activate) +
|
addHook(shmup::hooks_kill, 100, activate) +
|
||||||
|
addHook(hooks_mainmenu, 100, [] () {
|
||||||
|
dialog::addItem(XLAT("rogueviz menu"), 'u');
|
||||||
|
dialog::add_action([] () { pushScreen(rogueviz::showMenu); });
|
||||||
|
}) +
|
||||||
|
addHook(hooks_welcome_message, 100, [] () {
|
||||||
|
if(rogueviz::on) addMessage(XLAT("Welcome to RogueViz!"));
|
||||||
|
return rogueviz::on;
|
||||||
|
}) +
|
||||||
0;
|
0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,6 @@ namespace rogueviz {
|
|||||||
void describe(cell *c);
|
void describe(cell *c);
|
||||||
void drawExtra();
|
void drawExtra();
|
||||||
void close();
|
void close();
|
||||||
void showMenu();
|
|
||||||
string makehelp();
|
string makehelp();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
12
system.cpp
12
system.cpp
@ -38,8 +38,11 @@ bool do_use_special_land() {
|
|||||||
(peace::on || tactic::on || geometry || gp::on || randomPatternsMode || yendor::on);
|
(peace::on || tactic::on || geometry || gp::on || randomPatternsMode || yendor::on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hookset<bool()> *hooks_welcome_message;
|
||||||
|
|
||||||
void welcomeMessage() {
|
void welcomeMessage() {
|
||||||
if(tactic::trailer) return;
|
if(callhandlers(false, hooks_welcome_message)) return;
|
||||||
|
else if(tactic::trailer) return;
|
||||||
#if CAP_TOUR
|
#if CAP_TOUR
|
||||||
else if(tour::on) return; // displayed by tour
|
else if(tour::on) return; // displayed by tour
|
||||||
#endif
|
#endif
|
||||||
@ -67,13 +70,8 @@ void welcomeMessage() {
|
|||||||
addMessage(XLAT("Good luck in the elliptic plane!"));
|
addMessage(XLAT("Good luck in the elliptic plane!"));
|
||||||
else if(sphere)
|
else if(sphere)
|
||||||
addMessage(XLAT("Welcome to Spherogue!"));
|
addMessage(XLAT("Welcome to Spherogue!"));
|
||||||
#if CAP_ROGUEVIZ
|
else
|
||||||
else if(rogueviz::on)
|
|
||||||
addMessage(XLAT("Welcome to RogueViz!"));
|
|
||||||
#endif
|
|
||||||
else {
|
|
||||||
addMessage(XLAT("Welcome to HyperRogue!"));
|
addMessage(XLAT("Welcome to HyperRogue!"));
|
||||||
}
|
|
||||||
|
|
||||||
if(do_use_special_land() || firstland != laIce) if(!daily::on) {
|
if(do_use_special_land() || firstland != laIce) if(!daily::on) {
|
||||||
auto lv = land_validity(specialland);
|
auto lv = land_validity(specialland);
|
||||||
|
17
tour.cpp
17
tour.cpp
@ -48,6 +48,8 @@ function<bool(eLand)> showland;
|
|||||||
|
|
||||||
string slidecommand;
|
string slidecommand;
|
||||||
|
|
||||||
|
hookset<void(int)> *hooks_slide;
|
||||||
|
|
||||||
void presentation(presmode mode) {
|
void presentation(presmode mode) {
|
||||||
|
|
||||||
cheater = 0;
|
cheater = 0;
|
||||||
@ -62,6 +64,7 @@ void presentation(presmode mode) {
|
|||||||
SHOWLAND(true);
|
SHOWLAND(true);
|
||||||
|
|
||||||
slides[currentslide].action(mode);
|
slides[currentslide].action(mode);
|
||||||
|
callhooks(hooks_slide, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void slidehelp() {
|
void slidehelp() {
|
||||||
@ -363,20 +366,6 @@ slide default_slides[] = {
|
|||||||
else clearMessages();
|
else clearMessages();
|
||||||
}
|
}
|
||||||
SHOWLAND( l == laIce );
|
SHOWLAND( l == laIce );
|
||||||
#if CAP_ROGUEVIZ
|
|
||||||
slidecommand = "RogueViz presentation";
|
|
||||||
if(mode == 1)
|
|
||||||
help +=
|
|
||||||
"\n\nYour version of HyperRogue is compiled with RogueViz. "
|
|
||||||
"Press '5' to switch to the RogueViz slides. Watching the "
|
|
||||||
"common HyperRogue tutorial first is useful too, "
|
|
||||||
"as an introduction to hyperbolic geometry.";
|
|
||||||
if(mode == 4) {
|
|
||||||
slides = rogueviz::rvtour::rvslides;
|
|
||||||
while(tour::on) restart_game(rg::tour);
|
|
||||||
tour::start();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{"Basics of gameplay", 11, LEGAL_ANY,
|
{"Basics of gameplay", 11, LEGAL_ANY,
|
||||||
|
Loading…
Reference in New Issue
Block a user