1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-19 11:44:48 +00:00

refactored the parameter (saver/setting) system

This commit is contained in:
Zeno Rogue 2024-05-26 20:22:29 +02:00
parent a80a73458a
commit 1c74774bfa
15 changed files with 657 additions and 778 deletions

View File

@ -445,6 +445,8 @@ EX hookset<int()> hooks_args;
EX map<string, pair<int, reaction_t>> *added_commands;
EX bool delayed_start;
EX namespace arg {
int read_added_commands() {
@ -477,6 +479,7 @@ EX namespace arg {
void read(int phase) {
curphase = phase;
callhooks(hooks_config);
dynamicval<bool> ds(delayed_start, true);
while(pos < isize(argument)) {
int r = callhandlers(1, hooks_args);
switch (r) {

1184
config.cpp

File diff suppressed because it is too large Load Diff

View File

@ -1368,12 +1368,12 @@ EX namespace dialog {
dialog::addBreak(50);
auto f = find_edit(!ptr ? nullptr : ne.intval ? (void*) ne.intval : (void*) ne.editwhat);
if(f)
dialog::addHelp(XLAT("Parameter names, e.g. '%1'", f->parameter_name));
dialog::addHelp(XLAT("Parameter names, e.g. '%1'", f->name));
else
dialog::addHelp(XLAT("Parameter names"));
dialog::addBreak(50);
for(auto& ap: anims::aps) {
dialog::addInfo(ap.par->parameter_name + " = " + ap.formula);
dialog::addInfo(ap.par->name + " = " + ap.formula);
}
#endif
dialog::addBreak(50);

View File

@ -756,19 +756,19 @@ EX namespace history {
history::includeHistory = false;
}) + addHook(hooks_configfile, 0, [] {
addsaver(autobandhistory, "include history"); // check!
param_f(lvspeed, "lvspeed", "lineview speed");
addsaver(extra_line_steps, "lineview extension");
param_b(autobandhistory, "include history"); // check!
param_f(lvspeed, parameter_names("lvspeed", "lineview speed"));
param_f(extra_line_steps, "lineview extension");
addsaver(bandhalf, "band width");
addsaver(bandsegment, "band segment");
addsaver(autoband, "automatic band");
addsaver(autobandhistory, "automatic band history");
addsaver(dospiral, "do spiral");
param_i(bandhalf, "band width");
param_i(bandsegment, "band segment");
param_b(autoband, "automatic band");
param_b(autobandhistory, "automatic band history");
param_b(dospiral, "do spiral");
#if CAP_SHOT && CAP_SDL
addsaver(band_format_auto, "band_format_auto");
addsaver(band_format_now, "band_format_now");
param_str(band_format_auto, "band_format_auto");
param_str(band_format_now, "band_format_now");
#endif
});

View File

@ -1181,7 +1181,7 @@ EX void add_options() {
}
auto a = addHook(hooks_configfile, 100, [] {
param_b(auto_eyelevel, "auto_eyelevel")
param_b(auto_eyelevel, "intra_eyelevel")
-> editable("keep eye level when walking enabled", 'L');
param_f(eye_level, "walk_eye_level")
-> editable(0, 5, .1, "walking eye level",

View File

@ -919,14 +919,14 @@ EX namespace models {
#endif
void add_model_config() {
addsaver(polygonal::SI, "polygon sides");
param_f(polygonal::STAR, "star", "polygon star factor");
addsaver(polygonal::deg, "polygonal degree");
param_i(polygonal::SI, "polygon sides");
param_f(polygonal::STAR, parameter_names("star", "polygon star factor"));
param_i(polygonal::deg, "polygonal degree");
addsaver(polygonal::maxcoef, "polynomial degree");
param_i(polygonal::maxcoef, "polynomial degree");
for(int i=0; i<polygonal::MSI; i++) {
addsaver(polygonal::coefr[i], "polynomial "+its(i)+".real");
addsaver(polygonal::coefi[i], "polynomial "+its(i)+".imag");
param_f(polygonal::coefr[i], "polynomial "+its(i)+".real");
param_f(polygonal::coefi[i], "polynomial "+its(i)+".imag");
}
auto setrot = [] {
@ -941,7 +941,7 @@ EX namespace models {
param_matrix(models::rotation.v3, "rotation3", 3)->editable("auto rotation in 3D", "", 'r')->set_extra(setrot);
param_i(models::do_rotate, "auto_rotation_mode", 1);
param_f(pconf.halfplane_scale, "hp", "halfplane scale", 1);
param_f(pconf.halfplane_scale, parameter_names("hp", "halfplane scale"), 1);
auto add_all = [&] (projection_configuration& p, string pp, string sp) {
@ -949,8 +949,8 @@ EX namespace models {
dynamicval<function<bool()>> ds(auto_restrict);
auto_restrict = [&p] { return &vpconf == &p; };
addsaverenum(p.model, pp+"used model", mdDisk);
if(&p.model == &pmodel) param_custom(pmodel, "projection|Poincare|Klein|half-plane|perspective", menuitem_projection, '1');
param_enum(p.model, parameter_names(pp+"used_model", pp+"used model"), mdDisk);
if(&p.model == &pmodel) param_custom_int(pmodel, "projection|Poincare|Klein|half-plane|perspective", menuitem_projection, '1');
param_matrix(p.mori().v2, pp+"mori", 2)
-> editable("model orientation", "", 'o');
@ -960,32 +960,32 @@ EX namespace models {
param_f(p.top_z, sp+"topz", 5)
-> editable(1, 20, .25, "maximum z coordinate to show", "maximum z coordinate to show", 'l');
param_f(p.model_transition, pp+"mtrans", sp+"model transition", 1)
param_f(p.model_transition, parameter_names(pp+"mtrans", sp+"model transition"), 1)
-> editable(0, 1, .1, "model transition",
"You can change this parameter for a transition from another model to this one.", 't');
param_f(p.rotational_nil, sp+"rotnil", 1);
param_f(p.clip_min, pp+"clipmin", sp+"clip-min", rug ? -100 : -1);
param_f(p.clip_max, pp+"clipmax", sp+"clip-max", rug ? +10 : +1);
param_f(p.clip_min, parameter_names(pp+"clipmin", sp+"clip-min"), rug ? -100 : -1);
param_f(p.clip_max, parameter_names(pp+"clipmax", sp+"clip-max"), rug ? +10 : +1);
param_f(p.euclid_to_sphere, pp+"ets", sp+"euclid to sphere projection", 1.5)
param_f(p.euclid_to_sphere, parameter_names(pp+"ets", sp+"euclid to sphere projection"), 1.5)
-> editable(1e-1, 10, .1, "ETS parameter", "Stereographic projection to a sphere. Choose the radius of the sphere.", 'l')
-> set_sets(dialog::scaleLog);
param_f(p.twopoint_param, pp+"twopoint", sp+"twopoint parameter", 1)
param_f(p.twopoint_param, parameter_names(pp+"twopoint", sp+"twopoint parameter"), 1)
-> editable(1e-3, 10, .1, "two-point parameter", "In two-point-based models, this parameter gives the distance from each of the two points to the center.", 'b')
-> set_sets(dialog::scaleLog);
param_f(p.axial_angle, pp+"axial", sp+"axial angle", 90)
param_f(p.axial_angle, parameter_names(pp+"axial", sp+"axial angle"), 90)
-> editable(1e-3, 10, .1, "angle between the axes", "In two-axe-based models, this parameter gives the angle between the two axes.", 'x')
-> set_sets(dialog::scaleLog);
param_f(p.fisheye_param, pp+"fisheye", sp+"fisheye parameter", 1)
param_f(p.fisheye_param, parameter_names(pp+"fisheye", sp+"fisheye parameter"), 1)
-> editable(1e-3, 10, .1, "fisheye parameter", "Size of the fish eye.", 'b')
-> set_sets(dialog::scaleLog);
param_f(p.fisheye_alpha, pp+"fishalpha", sp+"off-center parameter", 0)
param_f(p.fisheye_alpha, parameter_names(pp+"fishalpha", sp+"off-center parameter"), 0)
-> editable(1e-1, 10, .1, "off-center parameter",
"This projection is obtained by composing gnomonic projection and inverse stereographic projection. "
"This parameter changes the center of the first projection (0 = gnomonic, 1 = stereographic). Use a value closer to 1 "
@ -999,9 +999,9 @@ EX namespace models {
param_f(p.product_z_scale, pp+"zstretch")
-> editable(0.1, 10, 0.1, "product Z stretch", "", 'Z');
param_f(p.collignon_parameter, pp+"collignon", sp+"collignon-parameter", 1)
param_f(p.collignon_parameter, parameter_names(pp+"collignon", sp+"collignon-parameter"), 1)
-> editable(-1, 1, .1, "Collignon parameter", "", 'b')
-> modif([] (float_setting* f) {
-> modif([] (float_parameter* f) {
f->unit = vpconf.collignon_reflected ? " (r)" : "";
})
-> set_extra([&p] {
@ -1044,9 +1044,9 @@ EX namespace models {
param_b(p.dualfocus_autoscale, sp+"dualfocus_autoscale", 0)
-> editable("autoscale dual focus", 'A');
addsaver(p.formula, sp+"formula");
addsaverenum(p.basic_model, sp+"basic model");
addsaver(p.use_atan, sp+"use_atan");
param_str(p.formula, sp+"formula");
param_enum(p.basic_model, sp+"basic model");
param_b(p.use_atan, sp+"use_atan");
param_f(p.spiral_angle, sp+"sang")
-> editable(0, 360, 15, "spiral angle", "set to 90° for the ring projection", 'x')
@ -1062,11 +1062,13 @@ EX namespace models {
param_i(p.back_and_front, sp+"backandfront", 0);
auto projsaver = addsaver(p.alpha, sp+"projection", 1);
if(&p.model == &pmodel) {
auto proj = param_custom(p.alpha, sp+"projection", menuitem_projection_distance, 'p');
auto proj = param_custom_ld(p.alpha, sp+"projection", menuitem_projection_distance, 'p');
proj->help_text = "projection distance|Gans Klein Poincare orthographic stereographic";
proj->saver = projsaver;
p.alpha = 1;
}
else {
param_f(p.alpha, sp+"projection", 1);
}
param_matrix(p.cam(), pp+"cameraangle", 3)
@ -1093,16 +1095,16 @@ EX namespace models {
"(2) in hyperbolic geometry, with spiral angle being +90° or -90°\n"
"(3) in hyperbolic geometry, with other spiral angles (1 makes the bands fit exactly)";
param_f(p.sphere_spiral_multiplier, "sphere_spiral_multiplier")
param_f(p.sphere_spiral_multiplier, pp+"sphere_spiral_multiplier")
-> editable(0, 10, .1, "sphere spiral multiplier", help, 'M')->unit = "°";
param_f(p.right_spiral_multiplier, "right_spiral_multiplier")
param_f(p.right_spiral_multiplier, pp+"right_spiral_multiplier")
-> editable(0, 10, .1, "right spiral multiplier", help, 'M')->unit = "°";
param_f(p.any_spiral_multiplier, "any_spiral_multiplier")
param_f(p.any_spiral_multiplier, pp+"any_spiral_multiplier")
-> editable(0, 10, .1, "any spiral multiplier", help, 'M')->unit = "°";
param_f(p.spiral_cone, "spiral_cone")
param_f(p.spiral_cone, pp+"spiral_cone")
-> editable(0, 360, -45, "spiral cone", "", 'C')->unit = "°";
};

View File

@ -18,11 +18,11 @@ EX namespace multi {
static constexpr int MAXHAT = 4;
struct config {
char keyaction[SCANCODES];
char joyaction[MAXJOY][MAXBUTTON];
char axeaction[MAXJOY][MAXAXE];
char hataction[MAXJOY][MAXHAT][4];
int deadzoneval[MAXJOY][MAXAXE];
int keyaction[SCANCODES];
int joyaction[MAXJOY][MAXBUTTON];
int axeaction[MAXJOY][MAXAXE];
int hataction[MAXJOY][MAXHAT][4];
int deadzoneval[MAXJOY][MAXAXE];
};
#endif
@ -166,7 +166,7 @@ EX const char* axemodes3[4] = {
EX int centerplayer = -1;
char* axeconfigs[24]; int numaxeconfigs;
int* axeconfigs[24]; int numaxeconfigs;
int* dzconfigs[24];
string listkeys(config& scfg, int id) {
@ -608,18 +608,18 @@ EX bool notremapped(int sym) {
EX void sconfig_savers(config& scfg, string prefix) {
// unfortunately we cannot use key names here because SDL is not yet initialized
for(int i=0; i<SCANCODES; i++)
addsaver(scfg.keyaction[i], prefix + string("key:")+its(i));
param_i(scfg.keyaction[i], prefix + string("key:")+its(i));
for(int i=0; i<MAXJOY; i++) {
string pre = prefix + "joystick "+cts('A'+i);
for(int j=0; j<MAXBUTTON; j++)
addsaver(scfg.joyaction[i][j], pre+"-B"+its(j));
param_i(scfg.joyaction[i][j], pre+"-B"+its(j));
for(int j=0; j<MAXAXE; j++) {
addsaver(scfg.axeaction[i][j], pre+" axis "+its(j));
addsaver(scfg.deadzoneval[i][j], pre+" deadzone "+its(j));
param_i(scfg.axeaction[i][j], pre+" axis "+its(j));
param_i(scfg.deadzoneval[i][j], pre+" deadzone "+its(j));
}
for(int j=0; j<MAXHAT; j++) for(int k=0; k<4; k++) {
addsaver(scfg.hataction[i][j][k], pre+" hat "+its(j)+" "+"URDL"[k]);
param_i(scfg.hataction[i][j][k], pre+" hat "+its(j)+" "+"URDL"[k]);
}
}
}
@ -631,7 +631,7 @@ EX void clear_config(config& scfg) {
EX void initConfig() {
auto& scfg = scfg_default;
char* t = scfg.keyaction;
int* t = scfg.keyaction;
#if CAP_SDL2
@ -766,7 +766,7 @@ EX void initConfig() {
multi::scs[6].uicolor = 0xC0C0C0FF;
#if CAP_CONFIG
addsaver(multi::players, "mode-number of players");
param_i(multi::players, "mode-number of players")->be_non_editable();
param_b(multi::split_screen, "splitscreen", false)
->editable("split screen mode", 's');
param_b(multi::pvp_mode, "pvp_mode", false)
@ -777,9 +777,9 @@ EX void initConfig() {
->editable("self hits", 'h');
param_b(multi::two_focus, "two_focus", false)
->editable("auto-adjust dual-focus projections", 'f');
addsaver(alwaysuse, "use configured keys");
param_b(alwaysuse, "use configured keys");
for(int i=0; i<7; i++) addsaver(multi::scs[i], "player"+its(i));
for(int i=0; i<7; i++) paramset(multi::scs[i], "player"+its(i));
sconfig_savers(scfg, "");
#endif

View File

@ -3164,10 +3164,10 @@ void addconfig() {
param_f(hard_limit, "ray_hard_limit");
param_i(want_use, "ray_want_use");
param_f(exp_decay_poly, "ray_exp_decay_poly");
addsaver(max_iter_iso, "ray_max_iter_iso");
addsaver(max_iter_sol, "ray_max_iter_sol");
param_i(max_iter_iso, "ray_max_iter_iso");
param_i(max_iter_sol, "ray_max_iter_sol");
param_i(max_cells, "ray_max_cells");
addsaver(rays_generate, "ray_generate");
param_b(rays_generate, "ray_generate");
param_b(fixed_map, "ray_fixed_map");
param_i(max_wall_offset, "max_wall_offset");
param_i(max_celltype, "max_celltype");

View File

@ -45,7 +45,7 @@ namespace hr {
namespace ads_game {
void change_default_key(int key, int val) {
char* t = scfg_ads.keyaction;
int* t = scfg_ads.keyaction;
t[key] = val;
}
@ -213,7 +213,7 @@ auto shot_hooks =
+ 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');
param_f(ds_how_much_invincibility, "ads_invinc")
param_f(ds_how_much_invincibility, "ds_invinc")
-> editable(0, TAU, TAU/4, "dS invincibility time", "How long does the period of invincibility after crashing last, in absolute units.", 'i');
param_b(auto_angle, "ads_auto_angle")
-> editable("automatically rotate the projection", 'a');
@ -287,7 +287,7 @@ auto shot_hooks =
param_i(spacetime_qty, "ads_spacetime_qty")
-> editable(0, 100, 5, "step quantity in the spacetime display", "", 'q');
addsaver(ghost_color, "color:ghost");
param_color(ghost_color, "color:ghost", true);
rsrc_config();
});

View File

@ -82,7 +82,7 @@ void fire() {
bool handleKey(int sym, int uni) {
if(cmode & sm::NORMAL) {
char* t = scfg_ads.keyaction;
int* t = scfg_ads.keyaction;
if(t[sym] >= 16 && t[sym] < 32) return true;
if(sym == 'v') pushScreen(game_menu);
if(sym == SDLK_ESCAPE) pushScreen(game_menu);

View File

@ -2032,7 +2032,7 @@ int args() {
}
void change_default_key(int key, int val) {
char* t = scfg_bringris.keyaction;
int* t = scfg_bringris.keyaction;
t[key] = val;
}

View File

@ -248,7 +248,7 @@ void run() {
dialog::add_key_action(PSEUDOKEY_SIM, toggle_replay);
dialog::display();
char* t = scfg_nilrider.keyaction;
int* t = scfg_nilrider.keyaction;
for(int i=1; i<512; i++) {
auto& ka = dialog::key_actions;
if(t[i] == 16+5) ka[i] = ka[PSEUDOKEY_PAUSE];
@ -544,7 +544,7 @@ void main_menu() {
bool on;
void change_default_key(int key, int val) {
char* t = scfg_nilrider.keyaction;
int* t = scfg_nilrider.keyaction;
t[key] = val;
}
@ -585,7 +585,7 @@ local_parameter_set lps_nilrider("nilrider:");
void default_settings() {
lps_add(lps_nilrider, vid.cells_drawn_limit, 1);
lps_add(lps_nilrider, ccolor::plain.ctab, colortable{0});
lps_add(lps_nilrider, ccolor::plain.ctab[0], 0);
lps_add(lps_nilrider, smooth_scrolling, true);
lps_add(lps_nilrider, mapeditor::drawplayer, false);
lps_add(lps_nilrider, backcolor, 0xC0C0FFFF);
@ -611,10 +611,10 @@ void initialize() {
curlev->init();
param_enum(planning_mode, "nil_planning", "nil_planning", false)
param_enum(planning_mode, "nil_planning", false)
-> editable({{"manual", "control the unicycle manually"}, {"planning", "try to plan the optimal route!"}}, "game mode", 'p');
param_enum(stepped_display, "stepped_display", "stepped_display", false)
param_enum(stepped_display, "stepped_display", false)
-> editable({{"smooth", "ride on a smooth surface"}, {"blocky", "makes slopes more visible -- actual physics are not affected"}}, "game mode", 's');
param_i(nilrider_tempo, "nilrider_tempo");

View File

@ -245,12 +245,12 @@ auto ah = addHook(hooks_args, 0, read_args);
#endif
auto ah2 = addHook(hooks_configfile, 100, [] {
#if CAP_CONFIG
addsaver(shot::shotx, "shotx");
addsaver(shot::shoty, "shoty");
addsaverenum(shot::format, "shotsvg");
addsaver(shot::transparent, "shottransparent");
param_i(shot::shotx, "shotx");
param_i(shot::shoty, "shoty");
param_enum(shot::format, "shotsvg", shot::png);
param_b(shot::transparent, "shottransparent");
param_f(shot::gamma, "shotgamma");
addsaver(shot::caption, "shotcaption");
param_str(shot::caption, "shotcaption");
param_f(shot::fade, "shotfade");
#endif
});
@ -1181,27 +1181,27 @@ EX void moved() {
#if HDR
struct animated_parameter {
setting *par;
parameter *par;
string formula;
};
#endif
EX vector<animated_parameter> aps;
EX setting *find_param(void *x) {
EX parameter *find_param(void *x) {
for(auto& fs: params)
if(fs.second->affects(x))
return &*fs.second;
return nullptr;
}
EX void deanimate(setting *p) {
EX void deanimate(parameter *p) {
for(int i=0; i<isize(aps); i++)
if(aps[i].par == p)
aps.erase(aps.begin() + (i--));
}
EX void get_parameter_animation(setting *p, string &s) {
EX void get_parameter_animation(parameter *p, string &s) {
for(auto &ap: aps)
if(ap.par == p && ap.par->anim_unchanged())
s = ap.formula;
@ -1214,7 +1214,7 @@ EX void animate_parameter(ld &x, string f) {
aps.emplace_back(animated_parameter{par, f});
}
EX void animate_setting(setting *par, string f) {
EX void animate_parameter(parameter *par, string f) {
if(!par) { println(hlog, "parameter not animatable"); return; }
deanimate(par);
aps.emplace_back(animated_parameter{par, f});
@ -1759,15 +1759,15 @@ auto animhook = addHook(hooks_frame, 100, display_animation)
#endif
+ addHook(hooks_configfile, 100, [] {
#if CAP_CONFIG
param_f(anims::period, "aperiod", "animation period");
addsaver(anims::noframes, "animation frames");
param_f(anims::cycle_length, "acycle", "animation cycle length");
param_f(anims::parabolic_length, "aparabolic", "animation parabolic length")
param_f(anims::period, parameter_names("aperiod", "animation period"));
param_i(anims::noframes, "animation frames");
param_f(anims::cycle_length, parameter_names("acycle", "animation cycle length"));
param_f(anims::parabolic_length, parameter_names("aparabolic", "animation parabolic length"))
->editable(0, 10, 1, "cells to go", "", 'c');
param_matrix(anims::rug_angle, "arugangle", 3)
->editable("animation rug angle", "", 'C');
param_f(anims::circle_radius, "acradius", "animation circle radius");
param_f(anims::circle_spins, "acspins", "animation circle spins");
param_f(anims::circle_radius, parameter_names("acradius", "animation circle radius"));
param_f(anims::circle_spins, parameter_names("acspins", "animation circle spins"));
param_matrix(anims::rug_movement_angle, "rug forward movement angle", 3)
->editable("rug forward movement angle", "", 'b');
param_matrix(anims::movement_angle.v2, "movement_angle", 2)->editable("movement angle", "", 'm');
@ -1781,7 +1781,7 @@ auto animhook = addHook(hooks_frame, 100, display_animation)
param_b(wallopt, "wallopt");
param_b(clearup, "anim_clearup");
param_color(circle_display_color, "circle_display_color", true);
param_enum(anims::ma, "ma", "movement_animation", maNone)
param_enum(anims::ma, parameter_names("ma", "movement_animation"), maNone)
-> editable({{"none", ""}, {"translation", ""}, {"rotation", ""}, {"circle", ""}, {"parabolic", ""}, {"translation+rotation", ""}}, "movement animation", 'a')
-> set_reaction(ma_reaction);

View File

@ -1828,7 +1828,7 @@ EX void save_mode_to_file(const string& fname) {
if(custom_welcome != "") println(f, "CMSG ", custom_welcome);
for(auto& ap: allowed_params) {
auto& s = params[ap]->saver;
auto& s = params[ap];
if(s->dosave())
println(f, ap, "=", s->save());
}

View File

@ -972,7 +972,7 @@ void mousemovement() {
patterns::patterninfo si_save;
saverlist texturesavers;
paramlist texturesavers;
eVariation targetvariation;
eGeometry targetgeometry;
@ -983,49 +983,49 @@ string tes;
void init_textureconfig() {
#if CAP_CONFIG
texturesavers = std::move(savers);
texturesavers = std::move(params); params.clear();
for(int i=0; i<3; i++)
for(int j=0; j<3; j++)
addsaver(config.itt[i][j], "texturematrix_" + its(i) + its(j), i==j ? 1 : 0);
param_f(config.itt[i][j], "texturematrix_" + its(i) + its(j), i==j ? 1 : 0);
for(int i=0; i<3; i++)
for(int j=0; j<3; j++)
addsaver(View[i][j], "viewmatrix_" + its(i) + its(j), i==j ? 1 : 0);
param_f(View[i][j], "viewmatrix_" + its(i) + its(j), i==j ? 1 : 0);
addsaverenum(targetgeometry, "geometry", gNormal);
addsaver(tes, "tes", "");
addsaverenum(pmodel, "used model", mdDisk);
addsaver(vid.yshift, "Y shift", 0);
addsaver(pconf.yposition, "Y position", 0);
addsaver(pconf.xposition, "X position", 0);
addsaver((matrix_eq&)pconf.cam(), "camera angle");
addsaverenum(targetvariation, "bitruncated", eVariation::bitruncated);
param_enum(targetgeometry, "geometry", gNormal);
param_str(tes, "tes", "");
param_enum(pmodel, "used model", mdDisk);
param_f(vid.yshift, "Y shift", 0);
param_f(pconf.yposition, "Y position", 0);
param_f(pconf.xposition, "X position", 0);
param_matrix((matrix_eq&)pconf.cam(), "camera angle", 2);
param_enum(targetvariation, "bitruncated", eVariation::bitruncated);
// ... geometry parameters
addsaverenum(patterns::whichPattern, "pattern", patterns::PAT_TYPES);
addsaver(patterns::subpattern_flags, "pattern flags", 0);
param_enum(patterns::whichPattern, "pattern", patterns::PAT_TYPES);
param_i(patterns::subpattern_flags, "pattern flags", 0);
addsaver(si_save.id, "center type", 1);
addsaver(si_save.dir, "center direction", 0);
addsaver(si_save.reflect, "center reflection", false);
addsaver(config.data.twidth, "texture resolution", 2048);
addsaver(config.gsplits, "precision", 1);
param_i(si_save.id, "center type", 1);
param_i(si_save.dir, "center direction", 0);
param_b(si_save.reflect, "center reflection", false);
param_i(config.data.twidth, "texture resolution", 2048);
param_i(config.gsplits, "precision", 1);
addsaver(config.grid_color, "grid color", 0);
addsaver(config.color_alpha, "alpha color", 0);
addsaver(config.mesh_color, "mesh color", 0);
param_color(config.grid_color, "grid color", true, 0);
param_i(config.color_alpha, "alpha color", 0);
param_color(config.mesh_color, "mesh color", true, 0);
addsaver(pconf.alpha, "projection", 1);
addsaver(pconf.scale, "scale", 1);
addsaver(pconf.stretch, "stretch", 1);
addsaver(vid.binary_width, "binary-tiling-width", 1);
param_f(pconf.alpha, "projection", 1);
param_f(pconf.scale, "scale", 1);
param_f(pconf.stretch, "stretch", 1);
param_f(vid.binary_width, "binary-tiling-width", 1);
addsaver(config.texturename, "texture filename", "");
addsaver(config.texture_tuner, "texture tuning", "");
param_str(config.texturename, "texture filename", "");
param_str(config.texture_tuner, "texture tuning", "");
addsaver(csymbol, "symbol", "");
param_str(csymbol, "symbol", "");
swap(texturesavers, savers);
swap(texturesavers, params); texturesavers.clear();
#endif
}
@ -1059,8 +1059,8 @@ bool texture_config::save() {
if(arcm::in()) csymbol = arcm::current.symbol;
#endif
for(auto s: texturesavers) if(s->dosave())
fprintf(f, "%s=%s\n", s->name.c_str(), s->save().c_str());
for(auto s: texturesavers) if(s.second->dosave())
fprintf(f, "%s=%s\n", s.second->name.c_str(), s.second->save().c_str());
fclose(f);
#endif
@ -1073,10 +1073,10 @@ bool texture_config::load() {
FILE *f = fopen(configname.c_str(), "rt");
if(!f) return false;
swap(texturesavers, savers);
for(auto s: savers) s->reset();
swap(texturesavers, params);
for(auto s: params) s.second->reset();
loadNewConfig(f);
swap(texturesavers, savers);
swap(texturesavers, params);
fclose(f);
polygonal::solve();