1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

arg:: shift_arg_formula used instead of argf

This commit is contained in:
Zeno Rogue 2018-11-09 14:26:31 +01:00
parent a6b8d4f79a
commit 549d86b15d
12 changed files with 55 additions and 53 deletions

View File

@ -211,7 +211,7 @@ namespace binary {
auto bt_config = addHook(hooks_args, 0, [] () { auto bt_config = addHook(hooks_args, 0, [] () {
using namespace arg; using namespace arg;
if(argis("-btwidth")) { if(argis("-btwidth")) {
shift(); vid.binary_width = argf(); shift_arg_formula(vid.binary_width);
need_reset_geometry = true; need_reset_geometry = true;
return 0; return 0;
} }

View File

@ -1642,7 +1642,7 @@ int read_config_args() {
PHASEFROM(2); shift(); dialog::dialogcolor = arghex(); PHASEFROM(2); shift(); dialog::dialogcolor = arghex();
} }
else if(argis("-aa")) { PHASEFROM(2); shift(); vid.antialias = argi(); } else if(argis("-aa")) { PHASEFROM(2); shift(); vid.antialias = argi(); }
else if(argis("-lw")) { PHASEFROM(2); shift(); vid.linewidth = argf(); } else if(argis("-lw")) { PHASEFROM(2); shift_arg_formula(vid.linewidth); }
else if(argis("-wm")) { PHASEFROM(2); shift(); vid.wallmode = argi(); } else if(argis("-wm")) { PHASEFROM(2); shift(); vid.wallmode = argi(); }
else if(argis("-mm")) { PHASEFROM(2); shift(); vid.monmode = argi(); } else if(argis("-mm")) { PHASEFROM(2); shift(); vid.monmode = argi(); }

View File

@ -974,10 +974,10 @@ namespace conformal {
if(0) ; if(0) ;
else if(argis("-els")) { else if(argis("-els")) {
shift(); conformal::extra_line_steps = argf(); shift_arg_formula(conformal::extra_line_steps);
} }
else if(argis("-stretch")) { else if(argis("-stretch")) {
PHASEFROM(2); shift(); vid.stretch = argf(); PHASEFROM(2); shift_arg_formula(vid.stretch);
} }
else if(argis("-PM")) { else if(argis("-PM")) {
PHASEFROM(2); shift(); pmodel = eModel(argi()); PHASEFROM(2); shift(); pmodel = eModel(argi());
@ -988,37 +988,37 @@ namespace conformal {
} }
else if(argis("-ballangle")) { else if(argis("-ballangle")) {
PHASEFROM(2); PHASEFROM(2);
shift(); vid.ballangle = argf(); shift_arg_formula(vid.ballangle);
} }
else if(argis("-topz")) { else if(argis("-topz")) {
PHASEFROM(2); PHASEFROM(2);
shift(); conformal::top_z = argf(); shift_arg_formula(conformal::top_z);
} }
else if(argis("-hp")) { else if(argis("-hp")) {
PHASEFROM(2); PHASEFROM(2);
shift(); conformal::halfplane_scale = argf(); shift_arg_formula(conformal::halfplane_scale);
} }
else if(argis("-mori")) { else if(argis("-mori")) {
PHASEFROM(2); PHASEFROM(2);
shift(); conformal::model_orientation = argf(); shift_arg_formula(conformal::model_orientation);
} }
else if(argis("-mtrans")) { else if(argis("-mtrans")) {
PHASEFROM(2); PHASEFROM(2);
shift(); conformal::model_transition = argf(); shift_arg_formula(conformal::model_transition);
} }
else if(argis("-sang")) { else if(argis("-sang")) {
PHASEFROM(2); PHASEFROM(2);
shift(); conformal::spiral_angle = argf(); shift_arg_formula(conformal::spiral_angle);
} }
else if(argis("-mob")) { else if(argis("-mob")) {
PHASEFROM(2); PHASEFROM(2);
shift(); vid.skiprope = argf(); shift_arg_formula(vid.skiprope);
} }
else if(argis("-zoom")) { else if(argis("-zoom")) {
PHASEFROM(2); shift(); vid.scale = argf(); PHASEFROM(2); shift_arg_formula(vid.scale);
} }
else if(argis("-alpha")) { else if(argis("-alpha")) {
PHASEFROM(2); shift(); vid.alpha = argf(); PHASEFROM(2); shift_arg_formula(vid.alpha);
} }
else return 1; else return 1;
return 0; return 0;

View File

@ -527,15 +527,15 @@ int read_cheat_args() {
} }
else if(argis("-we")) { else if(argis("-we")) {
PHASEFROM(2); PHASEFROM(2);
shift(); whatever = argf(); resetGeometry(); shift_arg_formula(whatever); resetGeometry();
} }
else if(argis("-wei")) { else if(argis("-wei")) {
PHASEFROM(2); PHASEFROM(2);
shift(); whateveri = argf(); resetGeometry(); shift(); whateveri = argi(); resetGeometry();
} }
else if(argis("-wei2")) { else if(argis("-wei2")) {
PHASEFROM(2); PHASEFROM(2);
shift(); whateveri2 = argf(); resetGeometry(); shift(); whateveri2 = argi(); resetGeometry();
} }
else if(argis("-W3")) { else if(argis("-W3")) {
shift(); top_land = readland(args()); cheat(); shift(); top_land = readland(args()); cheat();
@ -563,7 +563,7 @@ int read_cheat_args() {
else if(argis("-smart")) { else if(argis("-smart")) {
PHASEFROM(2); cheat(); PHASEFROM(2); cheat();
vid.use_smart_range = 2; vid.use_smart_range = 2;
shift(); vid.smart_range_detail = argf(); shift_arg_formula(vid.smart_range_detail);
} }
else if(argis("-smartlimit")) { else if(argis("-smartlimit")) {
PHASEFROM(2); PHASEFROM(2);

View File

@ -2068,6 +2068,8 @@ namespace arg {
bool argis(const string& s); bool argis(const string& s);
unsigned arghex(); unsigned arghex();
inline void shift_arg_formula(ld& x) { shift(); x = argf(); }
void init(int _argc, char **_argv); void init(int _argc, char **_argv);
extern int curphase; extern int curphase;

View File

@ -1012,7 +1012,7 @@ int readArgs() {
} }
else if(argis("-irrdens")) { else if(argis("-irrdens")) {
PHASE(2); PHASE(2);
shift(); density = argf(); shift_arg_formula(density);
} }
else if(argis("-irrload")) { else if(argis("-irrload")) {
PHASE(3); PHASE(3);

View File

@ -222,9 +222,9 @@ int readArgs() {
shift(); funmode = argi(); shift(); funmode = argi();
shift(); color1 = arghex(); shift(); color1 = arghex();
shift(); color2 = arghex(); shift(); color2 = arghex();
shift(); widthfactor = argf(); shift_arg_formula(widthfactor);
shift(); label_scale = argf(); shift_arg_formula(label_scale);
shift(); label_dist = argf(); shift_arg_formula(label_dist);
} }
else return 1; else return 1;
return 0; return 0;

View File

@ -1353,10 +1353,10 @@ int readArgs() {
shift(); qpct = argi(); shift(); qpct = argi();
} }
else if(argis("-sompower")) { else if(argis("-sompower")) {
shift(); ttpower = argf(); shift_arg_formula(ttpower);
} }
else if(argis("-somparam")) { else if(argis("-somparam")) {
shift(); (gaussian ? distmul : dispersion_end_at) = argf(); shift_arg_formula((gaussian ? distmul : dispersion_end_at));
if(dispersion_end_at <= 1) { if(dispersion_end_at <= 1) {
fprintf(stderr, "Dispersion parameter illegal\n"); fprintf(stderr, "Dispersion parameter illegal\n");
dispersion_end_at = 1.5; dispersion_end_at = 1.5;
@ -1372,7 +1372,7 @@ int readArgs() {
} }
else if(argis("-somlearn")) { else if(argis("-somlearn")) {
// this one can be changed at any moment // this one can be changed at any moment
shift(); learning_factor = argf(); shift_arg_formula(learning_factor);
} }
else if(argis("-somrun")) { else if(argis("-somrun")) {

View File

@ -1624,16 +1624,16 @@ int readArgs() {
// (1) configure edge weights // (1) configure edge weights
else if(argis("-edgepower")) { else if(argis("-edgepower")) {
shift(); sag::edgepower = argf(); shift_arg_formula(sag::edgepower);
shift(); sag::edgemul = argf(); shift_arg_formula(sag::edgemul);
} }
// (1) configure temperature (high, low) // (1) configure temperature (high, low)
else if(argis("-sagtemp")) { else if(argis("-sagtemp")) {
shift(); sag::hightemp = argf(); shift(); sag::hightemp = argi();
shift(); sag::lowtemp = argf(); shift(); sag::lowtemp = argi();
} }
else if(argis("-sagmin")) { else if(argis("-sagmin")) {
shift(); default_edgetype.visible_from = argf(); shift_arg_formula(default_edgetype.visible_from);
} }
// (2) read the edge data // (2) read the edge data
else if(argis("-sagpar")) { else if(argis("-sagpar")) {
@ -1743,13 +1743,13 @@ int readArgs() {
shift(); part(default_edgetype.color, 0) = 255 * pow(.5, argf()); shift(); part(default_edgetype.color, 0) = 255 * pow(.5, argf());
} }
else if(argis("-cshift")) { else if(argis("-cshift")) {
shift(); collatz::cshift = argf(); shift_arg_formula(collatz::cshift);
} }
else if(argis("-rvwarp")) { else if(argis("-rvwarp")) {
patterns::whichShape = '8'; patterns::whichShape = '8';
} }
else if(argis("-lq")) { else if(argis("-lq")) {
shift(); linequality = argf(); shift_arg_formula(linequality);
} }
#if CAP_RVSLIDES #if CAP_RVSLIDES
else if(argis("-rvpres")) { else if(argis("-rvpres")) {

10
rug.cpp
View File

@ -1877,7 +1877,7 @@ int rugArgs() {
if(0) ; if(0) ;
else if(argis("-rugmodelscale")) { else if(argis("-rugmodelscale")) {
shift(); modelscale = argf(); shift_arg_formula(modelscale);
} }
else if(argis("-ruggeo")) { else if(argis("-ruggeo")) {
@ -1893,7 +1893,7 @@ int rugArgs() {
} }
else if(argis("-rugdist")) { else if(argis("-rugdist")) {
shift(); model_distance = argf(); shift_arg_formula(model_distance);
} }
else if(argis("-ruglate")) { else if(argis("-ruglate")) {
@ -1906,7 +1906,7 @@ int rugArgs() {
} }
else if(argis("-rugauto")) { else if(argis("-rugauto")) {
shift(); ruggo = argf(); shift_arg_formula(ruggo);
} }
else if(argis("-rugorth")) { else if(argis("-rugorth")) {
@ -1914,7 +1914,7 @@ int rugArgs() {
} }
else if(argis("-rugerr")) { else if(argis("-rugerr")) {
shift(); err_zero = argf(); shift_arg_formula(err_zero);
} }
else if(argis("-rugtsize")) { else if(argis("-rugtsize")) {
@ -1940,7 +1940,7 @@ int rugArgs() {
} }
else if(argis("-anticusp")) { else if(argis("-anticusp")) {
shift(); anticusp_factor = argf(); shift_arg_formula(anticusp_factor);
} }
else return 1; else return 1;

View File

@ -192,7 +192,7 @@ int read_args() {
// (this is helpful with Inkscape's PDF+TeX output feature; define \myfont yourself) // (this is helpful with Inkscape's PDF+TeX output feature; define \myfont yourself)
} }
else if(argis("-svggamma")) { else if(argis("-svggamma")) {
shift(); svg::gamma = argf(); shift_arg_formula(svg::gamma);
} }
else if(argis("-svgshot")) { else if(argis("-svgshot")) {
PHASE(3); shift(); start_game(); PHASE(3); shift(); start_game();
@ -792,7 +792,7 @@ int readArgs() {
if(paramstate >= 2) anim_param = 1; if(paramstate >= 2) anim_param = 1;
} }
else if(argis("-animperiod")) { else if(argis("-animperiod")) {
PHASE(2); shift(); period = argf(); PHASE(2); shift_arg_formula(period);
} }
else if(argis("-animrecord")) { else if(argis("-animrecord")) {
PHASE(3); shift(); noframes = argi(); PHASE(3); shift(); noframes = argi();
@ -804,36 +804,36 @@ int readArgs() {
rotation_center_h = viewctr; rotation_center_h = viewctr;
rotation_center_c = cwt.at; rotation_center_c = cwt.at;
rotation_center_View = View; rotation_center_View = View;
shift(); circle_spins = argf(); shift_arg_formula(circle_spins);
shift(); circle_radius = argf(); shift_arg_formula(circle_radius);
shift(); circle_display_color = arghex(); shift(); circle_display_color = arghex();
} }
else if(argis("-animmove")) { else if(argis("-animmove")) {
ma = maTranslation; ma = maTranslation;
shift(); cycle_length = argf(); shift_arg_formula(cycle_length);
shift(); shift_angle = argf(); shift_arg_formula(shift_angle);
shift(); movement_angle = argf(); shift_arg_formula(movement_angle);
} }
else if(argis("-animpar")) { else if(argis("-animpar")) {
ma = maParabolic; ma = maParabolic;
shift(); parabolic_length = argf(); shift_arg_formula(parabolic_length);
shift(); shift_angle = argf(); shift_arg_formula(shift_angle);
shift(); movement_angle = argf(); shift_arg_formula(movement_angle);
} }
else if(argis("-animrot")) { else if(argis("-animrot")) {
ma = maRotation; ma = maRotation;
} }
else if(argis("-animrug")) { else if(argis("-animrug")) {
shift(); rug_rotation1 = argf(); shift_arg_formula(rug_rotation1);
shift(); rug_angle = argf(); shift_arg_formula(rug_angle);
shift(); rug_rotation2 = argf(); shift_arg_formula(rug_rotation2);
} }
else if(argis("-animenv")) { else if(argis("-animenv")) {
shift(); env_ocean = argf(); shift_arg_formula(env_ocean);
shift(); env_volcano = argf(); shift_arg_formula(env_volcano);
} }
else if(argis("-animball")) { else if(argis("-animball")) {
shift(); ballangle_rotation = argf(); shift_arg_formula(ballangle_rotation);
} }
else if(argis("-animj")) { else if(argis("-animj")) {
shift(); joukowsky_anim = true; shift(); joukowsky_anim = true;

View File

@ -1523,7 +1523,7 @@ int textureArgs() {
} }
else if(argis("-txp")) { else if(argis("-txp")) {
shift(); config.gsplits = argf(); shift(); config.gsplits = argi();
} }
else if(argis("-txc")) { else if(argis("-txc")) {