mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
ads-game:: 'pick the game' screen, also dS restarts correctly
This commit is contained in:
parent
ef7050aed2
commit
b0ae2774a1
@ -1,3 +1,24 @@
|
||||
/* Main file of Relative Hell. */
|
||||
/* Best run with -ads-menu; more detailed options are available too */
|
||||
|
||||
#ifdef RELHELL
|
||||
|
||||
#define CUSTOM_CAPTION "Relative Hell 0.9"
|
||||
#define MAXMDIM 4
|
||||
#define CAP_INV 0
|
||||
#define CAP_COMPLEX2 0
|
||||
#define CAP_EDIT 0
|
||||
#define CAP_BT 0
|
||||
#define CAP_SOLV 0
|
||||
#define CAP_THREAD 0
|
||||
#define CAP_FILES 1
|
||||
#define CAP_CONFIG 1
|
||||
#define CAP_CRYSTAL 0
|
||||
#define CAP_ARCM 0
|
||||
#define CAP_HISTORY 0
|
||||
#define CAP_STARTANIM 0
|
||||
#endif
|
||||
|
||||
#include "../rogueviz.h"
|
||||
|
||||
#include "math.cpp"
|
||||
@ -59,8 +80,6 @@ void restart() {
|
||||
|
||||
void run_ads_game() {
|
||||
|
||||
set_default_keys();
|
||||
|
||||
if(!sl2) set_geometry(gRotSpace);
|
||||
if(hybrid::csteps) {
|
||||
stop_game();
|
||||
@ -92,14 +111,19 @@ void run_ads_game() {
|
||||
pmodel = mdDisk;
|
||||
cwt.at = centerover = currentmap->gamestart();
|
||||
|
||||
rogueviz::rv_change(nohelp, true);
|
||||
rogueviz::rv_change(nomenukey, true);
|
||||
rogueviz::rv_change(nomap, true);
|
||||
rogueviz::rv_change(no_find_player, true);
|
||||
|
||||
restart();
|
||||
}
|
||||
|
||||
void set_config() {
|
||||
set_default_keys();
|
||||
|
||||
nohelp = true;
|
||||
nomenukey = true;
|
||||
nomap = true;
|
||||
no_find_player = true;
|
||||
showstartmenu = false;
|
||||
}
|
||||
|
||||
void run_ads_game_std() {
|
||||
set_geometry(gNormal);
|
||||
set_variation(eVariation::pure);
|
||||
@ -123,6 +147,8 @@ void change_scale(ld s) {
|
||||
auto shot_hooks =
|
||||
arg::add3("-ads-game1", run_ads_game)
|
||||
+ arg::add3("-ads-game", run_ads_game_std)
|
||||
+ arg::add3("-ads-zero", set_config)
|
||||
+ arg::add3("-ads-menu", [] { set_config(); pushScreen(pick_the_game); })
|
||||
+ arg::add3("-ads-scale", [] { arg::shift(); ld s = arg::argf(); change_scale(s); })
|
||||
+ arg::add3("-ads-restart", restart)
|
||||
+ addHook(hooks_configfile, 100, [] {
|
||||
@ -199,5 +225,15 @@ auto shot_hooks =
|
||||
rsrc_config();
|
||||
});
|
||||
|
||||
#ifdef RELHELL
|
||||
auto hook1=
|
||||
addHook(hooks_config, 100, [] {
|
||||
set_config();
|
||||
if(arg::curphase == 1)
|
||||
conffile = "relhell.ini";
|
||||
if(arg::curphase == 3) pushScreen(pick_the_game);
|
||||
});
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -213,12 +213,10 @@ auto future_shown = 2 * TAU;
|
||||
|
||||
void init_ds_game() {
|
||||
|
||||
init_textures();
|
||||
pick_textures();
|
||||
|
||||
dynamicval<eGeometry> g(geometry, gSpace435);
|
||||
|
||||
rockgen.cshift = 0;
|
||||
rsrcgen.cshift = 0;
|
||||
|
||||
/* create the main rock first */
|
||||
main_rock = rockgen.add(Id);
|
||||
@ -575,14 +573,9 @@ void view_ds_game() {
|
||||
}
|
||||
}
|
||||
|
||||
void run_ds_game() {
|
||||
void ds_restart() {
|
||||
|
||||
set_default_keys();
|
||||
init_ds_game();
|
||||
|
||||
rogueviz::rv_hook(hooks_frame, 100, view_ds_game);
|
||||
rogueviz::rv_hook(shmup::hooks_turn, 0, ds_turn);
|
||||
rogueviz::rv_hook(hooks_prestats, 100, display_rsrc);
|
||||
main_rock = nullptr;
|
||||
|
||||
if(true) {
|
||||
dynamicval<eGeometry> g(geometry, gSpace435);
|
||||
@ -591,13 +584,29 @@ void run_ds_game() {
|
||||
}
|
||||
|
||||
ship_pt = 0;
|
||||
init_rsrc();
|
||||
|
||||
rogueviz::rv_change(nohelp, true);
|
||||
rogueviz::rv_change(nomenukey, true);
|
||||
rogueviz::rv_change(nomap, true);
|
||||
rogueviz::rv_change(no_find_player, true);
|
||||
rogueviz::rv_change(showstartmenu, false);
|
||||
rocks.clear();
|
||||
history.clear();
|
||||
init_ds_game();
|
||||
reset_textures();
|
||||
pick_textures();
|
||||
init_rsrc();
|
||||
}
|
||||
|
||||
void run_ds_game() {
|
||||
|
||||
stop_game();
|
||||
set_geometry(gSphere);
|
||||
start_game();
|
||||
|
||||
init_textures();
|
||||
pick_textures();
|
||||
|
||||
ds_restart();
|
||||
|
||||
rogueviz::rv_hook(hooks_frame, 100, view_ds_game);
|
||||
rogueviz::rv_hook(shmup::hooks_turn, 0, ds_turn);
|
||||
rogueviz::rv_hook(hooks_prestats, 100, display_rsrc);
|
||||
rogueviz::rv_hook(hooks_handleKey, 0, handleKey);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,10 @@ struct texture_to_use {
|
||||
|
||||
vector<texture_to_use> textures_to_use;
|
||||
|
||||
void reset_textures() {
|
||||
textures_to_use.clear();
|
||||
}
|
||||
|
||||
void init_textures() {
|
||||
earth_textures.clear();
|
||||
string dir = "ds-images/";
|
||||
|
@ -117,4 +117,9 @@ int talpha = 32;
|
||||
void init_textures();
|
||||
void pick_textures();
|
||||
void draw_textures();
|
||||
void reset_textures();
|
||||
|
||||
void ds_restart();
|
||||
void run_ads_game_std();
|
||||
void run_ds_game();
|
||||
}}
|
||||
|
@ -131,4 +131,33 @@ void game_menu() {
|
||||
dialog::display();
|
||||
}
|
||||
|
||||
void pick_the_game() {
|
||||
cmode = sm::NOSCR;
|
||||
clearMessages();
|
||||
gamescreen();
|
||||
|
||||
dialog::init(XLAT("Relative Hell"), 0xC02020, 200, 0);
|
||||
dialog::addInfo(XLAT("abandon all hope of going faster than light"));
|
||||
dialog::addBreak(200);
|
||||
|
||||
dialog::addBigItem("anti-de Sitter space", '1');
|
||||
dialog::add_action([] { popScreen(); run_ads_game_std(); clearMessages(); });
|
||||
dialog::addInfo(XLAT("shoot asteroids, mine resources, collect gold"));
|
||||
|
||||
dialog::addBreak(100);
|
||||
|
||||
dialog::addBigItem("de Sitter space", '2');
|
||||
dialog::add_action([] { popScreen(); run_ds_game(); clearMessages(); });
|
||||
dialog::addInfo(XLAT("avoid energy balls, but do not let the main star run away!"));
|
||||
|
||||
dialog::addBreak(100);
|
||||
|
||||
dialog::addItem("not now", '3');
|
||||
dialog::add_action([] { quitmainloop = true; });
|
||||
|
||||
dialog::display();
|
||||
/* do not let the user exit this dialog */
|
||||
keyhandler = [] (int a, int b) { dialog::handleNavigation(a,b); };
|
||||
}
|
||||
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user