mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-09 15:39:55 +00:00
ads:: split initialization functions into multiple, so that they are available in presentations
This commit is contained in:
parent
f6ce5a81e4
commit
a8ade534b9
@ -92,6 +92,15 @@ void restart() {
|
||||
ship_pt = 0;
|
||||
}
|
||||
|
||||
void run_ads_game_hooks() {
|
||||
rogueviz::rv_hook(hooks_frame, 100, view_ads_game);
|
||||
rogueviz::rv_hook(hooks_prestats, 100, display_rsrc);
|
||||
rogueviz::rv_hook(hooks_handleKey, 150, handleKey);
|
||||
rogueviz::rv_hook(hooks_drawcell, 0, ads_draw_cell);
|
||||
rogueviz::rv_hook(shmup::hooks_turn, 0, ads_turn);
|
||||
rogueviz::rv_hook(anims::hooks_anim, 100, replay_animation);
|
||||
}
|
||||
|
||||
void run_ads_game() {
|
||||
|
||||
if(!sl2) set_geometry(gTwistedProduct);
|
||||
@ -104,12 +113,7 @@ void run_ads_game() {
|
||||
|
||||
starting_point = hybrid::get_where(cwt.at).first;
|
||||
|
||||
rogueviz::rv_hook(hooks_frame, 100, view_ads_game);
|
||||
rogueviz::rv_hook(hooks_prestats, 100, display_rsrc);
|
||||
rogueviz::rv_hook(hooks_handleKey, 0, handleKey);
|
||||
rogueviz::rv_hook(hooks_drawcell, 0, ads_draw_cell);
|
||||
rogueviz::rv_hook(shmup::hooks_turn, 0, ads_turn);
|
||||
rogueviz::rv_hook(anims::hooks_anim, 100, replay_animation);
|
||||
run_ads_game_hooks();
|
||||
|
||||
cgi.use_count++;
|
||||
hybrid::in_underlying_geometry([] {
|
||||
@ -128,7 +132,9 @@ void run_ads_game() {
|
||||
cwt.at = centerover = currentmap->gamestart();
|
||||
|
||||
restart();
|
||||
}
|
||||
|
||||
void add_ads_cleanup() {
|
||||
rogueviz::on_cleanup_or_next([] {
|
||||
switch_spacetime_to(true);
|
||||
});
|
||||
@ -176,6 +182,27 @@ void default_settings() {
|
||||
lps_add(lps_relhell_ads_spacetime, slr::range_z, 2.);
|
||||
}
|
||||
|
||||
void gamedata(hr::gamedata* gd) {
|
||||
gd->store(history);
|
||||
gd->store(ci_at);
|
||||
gd->store(rocks);
|
||||
gd->store(main_rock);
|
||||
gd->store(ship_pt);
|
||||
gd->store(view_pt);
|
||||
gd->store(invincibility_pt);
|
||||
gd->store(current);
|
||||
gd->store(current_ship);
|
||||
gd->store(vctr);
|
||||
gd->store(new_vctr);
|
||||
gd->store(vctr_ship);
|
||||
gd->store(vctrV);
|
||||
gd->store(new_vctrV);
|
||||
gd->store(vctrV_ship);
|
||||
gd->store(ang);
|
||||
gd->store(paused);
|
||||
gd->store(pdata);
|
||||
}
|
||||
|
||||
void set_config() {
|
||||
lps_enable(&lps_relhell);
|
||||
enable_canvas();
|
||||
@ -210,6 +237,7 @@ auto shot_hooks =
|
||||
+ 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_gamedata, 500, gamedata)
|
||||
+ addHook(hooks_configfile, 100, [] {
|
||||
param_f(ads_how_much_invincibility, "ads_invinc")
|
||||
-> editable(0, TAU, TAU/4, "AdS invincibility time", "How long does the period of invincibility after crashing last, in absolute units.", 'i');
|
||||
|
@ -719,6 +719,14 @@ void ds_restart() {
|
||||
init_rsrc();
|
||||
}
|
||||
|
||||
void run_ds_game_hooks() {
|
||||
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, 150, handleKey);
|
||||
rogueviz::rv_hook(anims::hooks_anim, 100, replay_animation);
|
||||
}
|
||||
|
||||
void run_ds_game() {
|
||||
|
||||
stop_game();
|
||||
@ -730,12 +738,10 @@ void run_ds_game() {
|
||||
|
||||
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);
|
||||
rogueviz::rv_hook(anims::hooks_anim, 100, replay_animation);
|
||||
run_ds_game_hooks();
|
||||
}
|
||||
|
||||
void add_ds_cleanup() {
|
||||
rogueviz::on_cleanup_or_next([] {
|
||||
main_rock = nullptr;
|
||||
});
|
||||
|
@ -125,8 +125,10 @@ void reset_textures();
|
||||
|
||||
void ds_restart();
|
||||
void run_ads_game_std();
|
||||
void add_ads_cleanup();
|
||||
void run_ds_game();
|
||||
void run_ds_game_std();
|
||||
void add_ds_cleanup();
|
||||
|
||||
/** in the replay mode */
|
||||
bool rev_replay;
|
||||
|
@ -226,13 +226,13 @@ void pick_the_game() {
|
||||
dialog::addBreak(200);
|
||||
|
||||
dialog::addBigItem("anti-de Sitter space", '1');
|
||||
dialog::add_action([] { popScreen(); run_ads_game_std(); clearMessages(); });
|
||||
dialog::add_action([] { popScreen(); run_ads_game_std(); add_ads_cleanup(); 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_std(); clearMessages(); });
|
||||
dialog::add_action([] { popScreen(); run_ds_game_std(); add_ds_cleanup(); clearMessages(); });
|
||||
dialog::addInfo(XLAT("avoid energy balls, but do not let the main star run away!"));
|
||||
|
||||
dialog::addBreak(100);
|
||||
|
Loading…
Reference in New Issue
Block a user