diff --git a/archimedean.cpp b/archimedean.cpp index 621ee6b5..2e3d014f 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -754,6 +754,8 @@ void archimedean_tiling::parse() { } #if CAP_COMMANDLINE +void show(); + int readArgs() { using namespace arg; @@ -774,6 +776,8 @@ int readArgs() { } else if(argis("-dgeom")) debug_geometry = true; else if(argis("-dual")) { PHASEFROM(2); set_variation(eVariation::dual); } + else if(argis("-d:arcm")) + launch_dialog(show); else return 1; return 0; } diff --git a/commandline.cpp b/commandline.cpp index abde8085..bcfaaef0 100644 --- a/commandline.cpp +++ b/commandline.cpp @@ -79,8 +79,20 @@ namespace arg { exit(1); } + bool dialog_launched = false; + + void launch_dialog(const reaction_t& r) { + if(!dialog_launched) { + popScreenAll(); + showstartmenu = false; + dialog_launched = true; + } + if(r) pushScreen(r); + } + } + int arg::readCommon() { // first phase options diff --git a/config.cpp b/config.cpp index d910d8ee..d8e5882d 100644 --- a/config.cpp +++ b/config.cpp @@ -1655,12 +1655,10 @@ void selectLanguageScreen() { #if CAP_COMMANDLINE -int read_config_args() { +int read_color_args() { using namespace arg; - if(argis("-c")) { PHASE(1); shift(); conffile = argcs(); } -// change the configuration from the command line - else if(argis("-back")) { + if(argis("-back")) { PHASEFROM(2); shift(); backcolor = arghex(); } else if(argis("-fillmodel")) { @@ -1681,6 +1679,17 @@ int read_config_args() { else if(argis("-dialog")) { PHASEFROM(2); shift(); dialog::dialogcolor = arghex(); } + else if(argis("-d:color")) + launch_dialog(show_color_dialog); + else return 1; + return 0; + } + +int read_config_args() { + using namespace arg; + + if(argis("-c")) { PHASE(1); shift(); conffile = argcs(); } +// change the configuration from the command line else if(argis("-aa")) { PHASEFROM(2); shift(); vid.antialias = argi(); } else if(argis("-lw")) { PHASEFROM(2); shift_arg_formula(vid.linewidth); } else if(argis("-wm")) { PHASEFROM(2); shift(); vid.wallmode = argi(); } @@ -1740,6 +1749,24 @@ int read_config_args() { } TOGGLE('o', vid.usingGL, switchGL()) TOGGLE('f', vid.full, switchFullscreen()) + else if(argis("-d:sight")) { + PHASEFROM(2); launch_dialog(); edit_sightrange(); + } + else if(argis("-d:char")) { + PHASEFROM(2); launch_dialog(showCustomizeChar); + } + else if(argis("-d:3")) { + PHASEFROM(2); launch_dialog(show3D); + } + else if(argis("-d:stereo")) { + PHASEFROM(2); launch_dialog(showStereo); + } + else if(argis("-d:basic")) { + PHASEFROM(2); launch_dialog(showBasicConfig); + } + else if(argis("-d:graph")) { + PHASEFROM(2); launch_dialog(showGraphConfig); + } else return 1; return 0; } @@ -1764,7 +1791,7 @@ int read_gamemode_args() { return 0; } -auto ah_config = addHook(hooks_args, 0, read_config_args) + addHook(hooks_args, 0, read_gamemode_args); +auto ah_config = addHook(hooks_args, 0, read_config_args) + addHook(hooks_args, 0, read_gamemode_args) + addHook(hooks_args, 0, read_color_args); #endif unordered_map params = { diff --git a/conformal.cpp b/conformal.cpp index c6727535..58dcb971 100644 --- a/conformal.cpp +++ b/conformal.cpp @@ -628,6 +628,34 @@ namespace conformal { dialog::bound_up(isize(torus_zeros)-1); } + void edit_formula() { + if(pmodel != mdFormula) basic_model = pmodel; + dialog::edit_string(formula, "formula", + XLAT( + "This lets you specify the projection as a formula f. " + "The formula has access to the value 'z', which is a complex number corresponding to the x,y coordinates in the currently selected model; " + "the point z is mapped to f(z). You can also use the underlying coordinates ux, uy, uz." + ) + "\n\n" + parser_help() + ); + dialog::extra_options = [] () { + initquickqueue(); + queuereset(mdUnchanged, PPR::LINE); + for(int a=-1; a<=1; a++) { + curvepoint(hpxyz(-M_PI/2 * vid.radius, a*vid.radius, 0)); + curvepoint(hpxyz(+M_PI/2 * vid.radius, a*vid.radius, 0)); + queuecurve(forecolor, 0, PPR::LINE); + curvepoint(hpxyz(a*vid.radius, -M_PI/2*vid.radius, 0)); + curvepoint(hpxyz(a*vid.radius, +M_PI/2*vid.radius, 0)); + queuecurve(forecolor, 0, PPR::LINE); + } + queuereset(pmodel, PPR::LINE); + quickqueue(); + }; + dialog::reaction_final = [] () { + pmodel = mdFormula; + }; + } + void model_menu() { cmode = sm::SIDE | sm::MAYDARK | sm::CENTER; gamescreen(0); @@ -638,31 +666,7 @@ namespace conformal { dialog::addBoolItem(get_model_name(m), pmodel == m, "0123456789!@#$%^&*()" [m]); dialog::add_action([m] () { if(m == mdFormula) { - if(pmodel != m) basic_model = pmodel; - dialog::edit_string(formula, "formula", - XLAT( - "This lets you specify the projection as a formula f. " - "The formula has access to the value 'z', which is a complex number corresponding to the x,y coordinates in the currently selected model; " - "the point z is mapped to f(z). You can also use the underlying coordinates ux, uy, uz." - ) + "\n\n" + parser_help() - ); - dialog::extra_options = [] () { - initquickqueue(); - queuereset(mdUnchanged, PPR::LINE); - for(int a=-1; a<=1; a++) { - curvepoint(hpxyz(-M_PI/2 * vid.radius, a*vid.radius, 0)); - curvepoint(hpxyz(+M_PI/2 * vid.radius, a*vid.radius, 0)); - queuecurve(forecolor, 0, PPR::LINE); - curvepoint(hpxyz(a*vid.radius, -M_PI/2*vid.radius, 0)); - curvepoint(hpxyz(a*vid.radius, +M_PI/2*vid.radius, 0)); - queuecurve(forecolor, 0, PPR::LINE); - } - queuereset(pmodel, PPR::LINE); - quickqueue(); - }; - dialog::reaction_final = [] () { - pmodel = mdFormula; - }; + edit_formula(); return; } pmodel = m; @@ -1108,6 +1112,16 @@ namespace conformal { else if(argis("-alpha")) { PHASEFROM(2); shift_arg_formula(vid.alpha); } + else if(argis("-d:model")) + launch_dialog(model_menu); + else if(argis("-d:formula")) { + launch_dialog(); + edit_formula(); + } + else if(argis("-d:match")) { + launch_dialog(match_torus_period); + edit_formula(); + } else return 1; return 0; } diff --git a/geom-exp.cpp b/geom-exp.cpp index 1fd44516..376c9f17 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -93,8 +93,18 @@ void showQuotientConfig() { bool torus_bitrunc; +void prepare_torusconfig() { + torusconfig::newdy = torusconfig::dy; + torusconfig::newqty = torusconfig::qty; + torusconfig::newsdx = torusconfig::sdx; + torusconfig::newsdy = torusconfig::sdy; + torusconfig::newmode = torusconfig::torus_mode; + torus_bitrunc = PURE; + } + void showTorusConfig() { - cmode = sm::SIDE | sm::TORUSCONFIG; + cmode = sm::SIDE; + if(torus) cmode |= sm::TORUSCONFIG; gamescreen(2); dialog::init(XLAT("advanced configuration")); @@ -468,12 +478,7 @@ void showEuclideanMenu() { ewhichscreen ^= 3; else if(uni == '4') { if(torus) - torusconfig::newdy = torusconfig::dy, - torusconfig::newqty = torusconfig::qty, - torusconfig::newsdx = torusconfig::sdx, - torusconfig::newsdy = torusconfig::sdy, - torusconfig::newmode = torusconfig::torus_mode, - torus_bitrunc = PURE, + prepare_torusconfig(), pushScreen(showTorusConfig); else if(geometry == gFieldQuotient) pushScreen(showQuotientConfig); @@ -639,6 +644,14 @@ int read_geom_args() { cheat(); shift(); currfp.qpaths.push_back(args()); } + else if(argis("-d:quotient")) + launch_dialog(showQuotientConfig); + else if(argis("-d:torus")) { + launch_dialog(showTorusConfig); + prepare_torusconfig(); + } + else if(argis("-d:geom")) + launch_dialog(showEuclideanMenu); else return 1; return 0; } diff --git a/hyper.h b/hyper.h index f1fa44ce..c222b74f 100644 --- a/hyper.h +++ b/hyper.h @@ -2084,6 +2084,8 @@ namespace arg { void init(int _argc, char **_argv); + void launch_dialog(const reaction_t& r = reaction_t()); + extern int curphase; void phaseerror(int x); diff --git a/menus.cpp b/menus.cpp index 92ecbce0..7e9f63f1 100644 --- a/menus.cpp +++ b/menus.cpp @@ -901,4 +901,33 @@ void showMessageLog() { else if(doexiton(sym, uni)) popScreen(); }; } + +#if CAP_COMMANDLINE + +int read_menu_args() { + using namespace arg; + + if(argis("-d:over")) { + PHASEFROM(2); launch_dialog(showOverview); + } + else if(argis("-d:main")) { + PHASEFROM(2); launch_dialog(showMainMenu); + } + else if(argis("-d:display")) { + PHASEFROM(2); launch_dialog(showDisplayMode); + } + else if(argis("-d:mode")) { + PHASEFROM(2); launch_dialog(showChangeMode); + } + else if(argis("-d:shmup")) { + PHASEFROM(2); launch_dialog(shmup::showShmupConfig); + } + else return 1; + return 0; + } + +auto ah_menu = addHook(hooks_args, 0, read_menu_args); + +#endif + } diff --git a/pattern2.cpp b/pattern2.cpp index af077d81..2fe0b06a 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -2374,6 +2374,15 @@ int read_pattern_args() { stop_game_and_switch_mode(rg::nothing); } + else if(argis("-d:line")) + launch_dialog(linepatterns::showMenu); + + else if(argis("-d:reg")) + launch_dialog(patterns::showPrePattern); + + else if(argis("-d:pattern")) + launch_dialog(patterns::showPattern); + else return 1; return 0; } diff --git a/rug.cpp b/rug.cpp index 33a6e8ab..353b6028 100644 --- a/rug.cpp +++ b/rug.cpp @@ -1943,6 +1943,9 @@ int rugArgs() { shift_arg_formula(anticusp_factor); } + else if(argis("-d:rug")) + launch_dialog(show); + else return 1; return 0; } diff --git a/surface.cpp b/surface.cpp index 85521470..07662834 100644 --- a/surface.cpp +++ b/surface.cpp @@ -808,6 +808,9 @@ int surface_args() { run_shape(dsHyperboloid); } + else if(argis("-d:surface")) + launch_dialog(show_surfaces); + else return 1; return 0; }