mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-12 10:20:32 +00:00
auto-change-scale functionality
This commit is contained in:
parent
b7c15e0978
commit
11a059eb60
@ -100,9 +100,24 @@ void run_ads_game_std() {
|
|||||||
showstartmenu = false;
|
showstartmenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void change_scale(ld s) {
|
||||||
|
scale *= s;
|
||||||
|
rock_density /= (s * s);
|
||||||
|
rock_max_rapidity *= s;
|
||||||
|
simspeed *= s;
|
||||||
|
pconf.scale /= s;
|
||||||
|
how_much_invincibility *= s;
|
||||||
|
max_pdata.oxygen *= s;
|
||||||
|
tank_pdata.oxygen *= s;
|
||||||
|
crash_particle_life *= s;
|
||||||
|
fuel_particle_life *= s;
|
||||||
|
}
|
||||||
|
|
||||||
auto shot_hooks =
|
auto shot_hooks =
|
||||||
arg::add3("-ads-game1", run_ads_game)
|
arg::add3("-ads-game1", run_ads_game)
|
||||||
+ arg::add3("-ads-game", run_ads_game_std)
|
+ arg::add3("-ads-game", run_ads_game_std)
|
||||||
|
+ arg::add3("-ads-scale", [] { arg::shift(); ld s = arg::argf(); change_scale(s); })
|
||||||
|
+ arg::add3("-ads-restart", restart)
|
||||||
+ addHook(hooks_configfile, 100, [] {
|
+ addHook(hooks_configfile, 100, [] {
|
||||||
param_f(how_much_invincibility, "ads_invinc")
|
param_f(how_much_invincibility, "ads_invinc")
|
||||||
-> editable(0, TAU, TAU/4, "invincibility time", "How long does the period of invincibility after crashing last, in absolute units.", 'i');
|
-> editable(0, TAU, TAU/4, "invincibility time", "How long does the period of invincibility after crashing last, in absolute units.", 'i');
|
||||||
|
@ -58,6 +58,7 @@ const char *tformat = "%.2f";
|
|||||||
|
|
||||||
void game_menu();
|
void game_menu();
|
||||||
void restart();
|
void restart();
|
||||||
|
void change_scale(ld s);
|
||||||
|
|
||||||
/** all the missiles and objects currently displayed */
|
/** all the missiles and objects currently displayed */
|
||||||
vector<struct ads_object*> displayed;
|
vector<struct ads_object*> displayed;
|
||||||
|
@ -2,6 +2,12 @@ namespace hr {
|
|||||||
|
|
||||||
namespace ads_game {
|
namespace ads_game {
|
||||||
|
|
||||||
|
void adjust_for_scale() {
|
||||||
|
if(scale < 0.3) max_gen_per_frame = 1, draw_per_frame = 30, missile_rapidity = 1;
|
||||||
|
else if(scale < 0.8) max_gen_per_frame = 2, draw_per_frame = 100, missile_rapidity = 1;
|
||||||
|
else max_gen_per_frame = 3, draw_per_frame = 1000, missile_rapidity = 3;
|
||||||
|
}
|
||||||
|
|
||||||
void edit_difficulty() {
|
void edit_difficulty() {
|
||||||
cmode = sm::SIDE | sm::MAYDARK;
|
cmode = sm::SIDE | sm::MAYDARK;
|
||||||
gamescreen();
|
gamescreen();
|
||||||
@ -12,6 +18,7 @@ void edit_difficulty() {
|
|||||||
add_edit(how_much_invincibility);
|
add_edit(how_much_invincibility);
|
||||||
add_edit(rock_max_rapidity);
|
add_edit(rock_max_rapidity);
|
||||||
add_edit(rock_density);
|
add_edit(rock_density);
|
||||||
|
add_edit(scale);
|
||||||
|
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
add_edit(max_gen_per_frame);
|
add_edit(max_gen_per_frame);
|
||||||
@ -21,6 +28,18 @@ void edit_difficulty() {
|
|||||||
edit_rsrc();
|
edit_rsrc();
|
||||||
|
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
|
dialog::addItem(XLAT("scale everything :2"), '!');
|
||||||
|
dialog::add_action([] {
|
||||||
|
change_scale(1/2.);
|
||||||
|
adjust_for_scale();
|
||||||
|
restart();
|
||||||
|
});
|
||||||
|
dialog::addItem(XLAT("scale everything *2"), '@');
|
||||||
|
dialog::add_action([] {
|
||||||
|
change_scale(2.);
|
||||||
|
adjust_for_scale();
|
||||||
|
restart();
|
||||||
|
});
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user