forked from zenorogue/hyperrogue
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.cpp
More file actions
3258 lines (2808 loc) · 105 KB
/
config.cpp
File metadata and controls
3258 lines (2808 loc) · 105 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Hyperbolic Rogue -- configuration
// Copyright (C) 2017-2018 Zeno Rogue, see 'hyper.cpp' for details
/** \file config.cpp
* \brief Configuration -- initial settings, saving/loading ini files, menus, etc.
*/
#include "hyper.h"
namespace hr {
#if HDR
enum eCentering { face, edge, vertex };
#endif
EX eCentering centering;
EX function<bool()> auto_restrict;
EX void add_to_changed(struct setting *f);
EX bool return_false() { return false; }
#if HDR
struct supersaver {
string name;
virtual string save() = 0;
virtual void load(const string& s) = 0;
virtual bool dosave() = 0;
virtual void reset() = 0;
virtual bool affects(void* v) { return false; }
virtual void set_default() = 0;
virtual ~supersaver() = default;
};
typedef vector<shared_ptr<supersaver>> saverlist;
extern saverlist savers;
struct setting {
function<bool()> restrict;
string parameter_name;
string config_name;
string menu_item_name;
string help_text;
reaction_t reaction;
char default_key;
cld last_value;
bool is_editable;
virtual bool available() { if(restrict) return restrict(); return true; }
virtual bool affects(void *v) { return false; }
virtual void add_as_saver() {}
void show_edit_option() { show_edit_option(default_key); }
virtual void show_edit_option(char key) {
println(hlog, "default called!"); }
virtual string search_key() {
return parameter_name + "|" + config_name + "|" + menu_item_name + "|" + help_text;
}
virtual cld get_cld() = 0;
explicit setting() { restrict = auto_restrict; is_editable = false; }
virtual void check_change() {
cld val = get_cld();
if(val != last_value) {
last_value = val;
add_to_changed(this);
}
}
reaction_t sets;
setting *set_sets(const reaction_t& s) { sets = s; return this; }
setting *set_extra(const reaction_t& r);
setting *set_reaction(const reaction_t& r);
virtual ~setting() = default;
virtual void load_from(const string& s) {
println(hlog, "cannot load this parameter");
exit(1);
}
};
#endif
setting *setting::set_extra(const reaction_t& r) {
auto s = sets; set_sets([s, r] { if(s) s(); dialog::extra_options = r; }); return this;
}
setting *setting::set_reaction(const reaction_t& r) {
reaction = r; return this;
}
EX map<string, std::unique_ptr<setting>> params;
EX void show_edit_option_enum(char* value, const string& name, const vector<pair<string, string>>& options, char key, setting *s);
#if HDR
struct list_setting : setting {
virtual int get_value() = 0;
virtual void set_value(int i) = 0;
vector<pair<string, string> > options;
list_setting* editable(const vector<pair<string, string> >& o, string menu_item_name, char key) {
is_editable = true;
options = o;
this->menu_item_name = menu_item_name;
default_key = key;
return this;
}
void show_edit_option(char key) override;
};
template<class T> struct enum_setting : list_setting {
T *value;
T dft;
int get_value() override { return (int) *value; }
void set_value(int i) override { *value = (T) i; }
bool affects(void* v) override { return v == value; }
void add_as_saver() override;
cld get_cld() override { return get_value(); }
void load_from(const string& s) override {
*value = (T) parseint(s);
}
};
struct float_setting : public setting {
ld *value;
ld dft;
ld min_value, max_value, step;
string unit;
float_setting *editable(ld min_value, ld max_value, ld step, string menu_item_name, string help_text, char key) {
is_editable = true;
this->min_value = min_value;
this->max_value = max_value;
this->menu_item_name = menu_item_name;
this->help_text = help_text;
this->step = step;
default_key = key;
return this;
}
function<void(float_setting*)> modify_me;
float_setting *modif(const function<void(float_setting*)>& r) { modify_me = r; return this; }
void add_as_saver() override;
bool affects(void *v) override { return v == value; }
void show_edit_option(char key) override;
cld get_cld() override { return *value; }
void load_from(const string& s) override;
};
struct int_setting : public setting {
int *value;
int dft;
int min_value, max_value;
ld step;
void add_as_saver() override;
function<void(int_setting*)> modify_me;
int_setting *modif(const function<void(int_setting*)>& r) { modify_me = r; return this; }
bool affects(void *v) override { return v == value; }
void show_edit_option(char key) override;
cld get_cld() override { return *value; }
int_setting *editable(int min_value, int max_value, ld step, string menu_item_name, string help_text, char key) {
this->min_value = min_value;
this->max_value = max_value;
this->menu_item_name = menu_item_name;
this->help_text = help_text;
this->step = step;
default_key = key;
return this;
}
void load_from(const string& s) override {
*value = parseint(s);
}
};
struct bool_setting : public setting {
bool *value;
bool dft;
void add_as_saver() override;
reaction_t switcher;
bool_setting* editable(string cap, char key ) {
is_editable = true;
menu_item_name = cap; default_key = key; return this;
}
bool affects(void *v) override { return v == value; }
void show_edit_option(char key) override;
cld get_cld() override { return *value ? 1 : 0; }
void load_from(const string& s) override {
*value = parseint(s);
}
};
struct custom_setting : public setting {
function<void(char)> custom_viewer;
function<cld()> custom_value;
function<bool(void*)> custom_affect;
void show_edit_option(char key) override { custom_viewer(key); }
cld get_cld() override { return custom_value(); }
bool affects(void *v) override { return custom_affect(v); }
};
#if CAP_CONFIG
template<class T> struct dsaver : supersaver {
T& val;
T dft;
bool dosave() override { return val != dft; }
void reset() override { val = dft; }
explicit dsaver(T& val) : val(val) { }
bool affects(void* v) override { return v == &val; }
void set_default() override { dft = val; }
};
template<class T> struct saver : dsaver<T> {};
template<class T, class U, class V> void addsaver(T& i, U name, V dft) {
auto s = make_shared<saver<T>> (i);
s->dft = dft;
s->name = name;
savers.push_back(s);
}
template<class T> void addsaver(T& i, string name) {
addsaver(i, name, i);
}
template<class T> void removesaver(T& val) {
for(int i=0; i<isize(savers); i++)
if(savers[i]->affects(&val))
savers.erase(savers.begin() + i);
}
template<class T> void set_saver_default(T& val) {
for(auto sav: savers)
if(sav->affects(&val))
sav->set_default();
}
template<class T> struct saverenum : supersaver {
T& val;
T dft;
explicit saverenum(T& v) : val(v) { }
bool dosave() override { return val != dft; }
void reset() override { val = dft; }
string save() override { return its(int(val)); }
void load(const string& s) override { val = (T) atoi(s.c_str()); }
bool affects(void* v) override { return v == &val; }
void set_default() override { dft = val; }
};
template<class T, class U> void addsaverenum(T& i, U name, T dft) {
auto s = make_shared<saverenum<T>> (i);
s->dft = dft;
s->name = name;
savers.push_back(s);
}
template<class T, class U> void addsaverenum(T& i, U name) {
addsaverenum(i, name, i);
}
template<> struct saver<int> : dsaver<int> {
explicit saver(int& val) : dsaver<int>(val) { }
string save() override { return its(val); }
void load(const string& s) override { val = atoi(s.c_str()); }
};
template<> struct saver<char> : dsaver<char> {
explicit saver(char& val) : dsaver<char>(val) { }
string save() override { return its(val); }
void load(const string& s) override { val = atoi(s.c_str()); }
};
template<> struct saver<bool> : dsaver<bool> {
explicit saver(bool& val) : dsaver<bool>(val) { }
string save() override { return val ? "yes" : "no"; }
void load(const string& s) override { val = isize(s) && s[0] == 'y'; }
};
template<> struct saver<unsigned> : dsaver<unsigned> {
explicit saver(unsigned& val) : dsaver<unsigned>(val) { }
string save() override { return itsh(val); }
void load(const string& s) override { val = (unsigned) strtoll(s.c_str(), NULL, 16); }
};
template<> struct saver<string> : dsaver<string> {
explicit saver(string& val) : dsaver<string>(val) { }
string save() override { return val; }
void load(const string& s) override { val = s; }
};
template<> struct saver<ld> : dsaver<ld> {
explicit saver(ld& val) : dsaver<ld>(val) { }
string save() override { return fts(val, 10); }
void load(const string& s) override {
if(s == "0.0000000000e+000") ; // ignore!
else val = atof(s.c_str());
}
};
#endif
#endif
void float_setting::add_as_saver() {
#if CAP_CONFIG
addsaver(*value, config_name, dft);
#endif
}
void int_setting::add_as_saver() {
#if CAP_CONFIG
addsaver(*value, config_name, dft);
#endif
}
void bool_setting::add_as_saver() {
#if CAP_CONFIG
addsaver(*value, config_name, dft);
#endif
}
void float_setting::load_from(const string& s) {
anims::animate_parameter(*value, s, reaction);
}
void non_editable() {
dialog::addHelp("Warning: editing this value through this menu may not work correctly");
}
void float_setting::show_edit_option(char key) {
if(modify_me) modify_me(this);
dialog::addSelItem(XLAT(menu_item_name), fts(*value) + unit, key);
dialog::add_action([this] () {
add_to_changed(this);
dialog::editNumber(*value, min_value, max_value, step, dft, XLAT(menu_item_name), help_text);
if(sets) sets();
if(reaction) dialog::reaction = reaction;
if(!is_editable) dialog::extra_options = non_editable;
});
}
void int_setting::show_edit_option(char key) {
if(modify_me) modify_me(this);
dialog::addSelItem(XLAT(menu_item_name), its(*value), key);
dialog::add_action([this] () {
add_to_changed(this);
dialog::editNumber(*value, min_value, max_value, step, dft, XLAT(menu_item_name), help_text);
if(sets) sets();
if(reaction) dialog::reaction = reaction;
if(!is_editable) dialog::extra_options = non_editable;
});
}
void bool_setting::show_edit_option(char key) {
dialog::addBoolItem(XLAT(menu_item_name), *value, key);
dialog::add_action([this] () {
add_to_changed(this);
switcher(); if(sets) sets();
if(reaction) reaction();
});
}
EX float_setting *param_f(ld& val, const string p, const string s, ld dft) {
unique_ptr<float_setting> u ( new float_setting );
u->parameter_name = p;
u->config_name = s;
u->menu_item_name = s;
u->value = &val;
u->last_value = dft;
if(dft == 0) {
u->min_value = -100;
u->max_value = +100;
}
else {
u->min_value = 0;
u->max_value = 2 * dft;
}
u->step = dft / 10;
u->dft = dft;
val = dft;
u->add_as_saver();
auto f = &*u;
params[u->parameter_name] = std::move(u);
return f;
}
EX string param_esc(string s) {
string out;
for(char c: s)
if(c == ' ' || c == '-' || c == ':')
out += '_';
else
out += c;
return out;
}
EX int_setting *param_i(int& val, const string s, int dft) {
unique_ptr<int_setting> u ( new int_setting );
u->parameter_name = param_esc(s);
u->config_name = s;
u->menu_item_name = s;
u->value = &val;
u->last_value = dft;
u->dft = dft;
val = dft;
if(dft == 0) {
u->min_value = -100;
u->max_value = +100;
}
else {
u->min_value = 0;
u->max_value = 2 * dft;
}
u->add_as_saver();
auto f = &*u;
params[u->parameter_name] = std::move(u);
return f;
}
EX int_setting *param_i(int& val, const string s) { return param_i(val, s, val); }
EX bool_setting *param_b(bool& val, const string s, bool dft) {
unique_ptr<bool_setting> u ( new bool_setting );
u->parameter_name = param_esc(s);
u->config_name = s;
u->menu_item_name = s;
u->value = &val;
u->last_value = dft;
u->dft = dft;
u->switcher = [&val] { val = !val; };
val = dft;
u->add_as_saver();
auto f = &*u;
params[u->parameter_name] = std::move(u);
return f;
}
EX bool_setting *param_b(bool& val, const string s) { return param_b(val, s, val); }
#if HDR
template<class T> void enum_setting<T>::add_as_saver() {
#if CAP_CONFIG
addsaverenum(*value, config_name, dft);
#endif
}
template<class T> enum_setting<T> *param_enum(T& val, const string p, const string s, T dft) {
unique_ptr<enum_setting<T>> u ( new enum_setting<T> );
u->parameter_name = p;
u->config_name = s;
u->menu_item_name = s;
u->value = &val;
u->dft = dft;
val = dft;
u->last_value = u->get_cld();
u->add_as_saver();
auto f = &*u;
params[p] = std::move(u);
return f;
}
#endif
EX float_setting* param_f(ld& val, const string s) {
return param_f(val, param_esc(s), s, val);
}
EX float_setting* param_f(ld& val, const string p, const string s) {
return param_f(val, p, s, val);
}
EX float_setting* param_f(ld& val, const string s, ld dft) {
return param_f(val, param_esc(s), s, dft);
}
#if HDR
template<class T>
custom_setting* param_custom(T& val, const string& s, function<void(char)> menuitem, char key) {
unique_ptr<custom_setting> u ( new custom_setting );
u->parameter_name = param_esc(s);
u->config_name = s;
u->menu_item_name = s;
u->last_value = (int) val;
u->custom_viewer = menuitem;
u->custom_value = [&val] () { return (int) val; };
u->custom_affect = [&val] (void *v) { return &val == v; };
u->default_key = key;
u->is_editable = true;
auto f = &*u;
params[s] = std::move(u);
return f;
}
#endif
EX ld bounded_mine_percentage = 0.1;
EX int bounded_mine_quantity, bounded_mine_max;
EX const char *conffile = "hyperrogue.ini";
/* extra space if more geometries are added */
EX array<ld, gGUARD+64> sightranges;
EX videopar vid;
#define DEFAULT_WALLMODE (ISMOBILE ? 3 : 5)
#define DEFAULT_MONMODE (ISMOBILE ? 2 : 4)
EX void android_settings_changed() {
#if ISANDROID
settingsChanged = true;
#endif
}
extern color_t floorcolors[landtypes];
EX charstyle& getcs(int id IS(multi::cpid)) {
if(multi::players>1 && id >= 0 && id < multi::players)
return multi::scs[id];
else
return vid.cs;
}
struct charstyle_old {
int charid;
color_t skincolor, haircolor, dresscolor, swordcolor, dresscolor2, uicolor;
bool lefthanded;
};
EX void hread(hstream& hs, charstyle& cs) {
// before 0xA61A there was no eyecolor
if(hs.get_vernum() < 0xA61A) {
charstyle_old cso;
hread_raw(hs, cso);
cs.charid = cso.charid;
cs.skincolor = cso.skincolor;
cs.haircolor = cso.haircolor;
cs.dresscolor = cso.dresscolor;
cs.swordcolor = cs.eyecolor = cso.swordcolor;
if(cs.charid < 4) cs.eyecolor = 0;
cs.dresscolor2 = cso.dresscolor2;
cs.uicolor = cso.uicolor;
cs.lefthanded = cso.lefthanded;
}
else hread_raw(hs, cs);
}
EX void hwrite(hstream& hs, const charstyle& cs) {
hwrite_raw(hs, cs);
}
// void hread(hstream& hs, charstyle& cs) { hread_raw(hs, cs); }
// void hwrite(hstream& hs, const charstyle& cs) { hwrite_raw(hs, cs); }
EX string csnameid(int id) {
if(id == 0) return XLAT("male");
if(id == 1) return XLAT("female");
if(id == 2) return XLAT("Prince");
if(id == 3) return XLAT("Princess");
if(id == 4 || id == 5) return XLAT("cat");
if(id == 6 || id == 7) return XLAT("dog");
if(id == 8 || id == 9) return XLATN("Familiar");
return XLAT("none");
}
EX string csname(charstyle& cs) {
return csnameid(cs.charid);
}
EX int playergender() {
return (getcs().charid >= 0 && (getcs().charid&1)) ? GEN_F : GEN_M;
}
EX int princessgender() {
int g = playergender();
if(vid.samegender) return g;
return g == GEN_M ? GEN_F : GEN_M;
}
EX int default_language;
EX int lang() {
if(vid.language >= 0)
return vid.language;
return default_language;
}
EX bool autojoy = true;
#if CAP_CONFIG
saverlist savers;
#endif
#if !CAP_CONFIG
template<class T, class U, class V> void addsaver(T& i, U name, V dft) {
i = dft;
}
template<class T, class U> void addsaver(T& i, U name) {}
template<class T, class U> void addsaverenum(T& i, U name) {}
template<class T, class U> void addsaverenum(T& i, U name, T dft) { i = dft; }
#endif
EX void addsaver(charstyle& cs, string s) {
addsaver(cs.charid, s + ".charid");
addsaver(cs.skincolor, s + ".skincolor");
addsaver(cs.eyecolor, s + ".eyecolor");
addsaver(cs.haircolor, s + ".haircolor");
addsaver(cs.dresscolor, s + ".dresscolor");
addsaver(cs.swordcolor, s + ".swordcolor");
addsaver(cs.dresscolor2, s + ".dresscolor2");
addsaver(cs.uicolor, s + ".uicolor");
addsaver(cs.lefthanded, s + ".lefthanded");
}
// R:239, G:208, B:207
unsigned int skincolors[] = { 7, 0xD0D0D0FF, 0xEFD0C9FF, 0xC77A58FF, 0xA58869FF, 0x602010FF, 0xFFDCB1FF, 0xEDE4C8FF };
unsigned int haircolors[] = { 8, 0x686868FF, 0x8C684AFF, 0xF2E1AEFF, 0xB55239FF, 0xFFFFFFFF, 0x804000FF, 0x502810FF, 0x301800FF };
unsigned int dresscolors[] = { 6, 0xC00000FF, 0x00C000FF, 0x0000C0FF, 0xC0C000FF, 0xC0C0C0FF, 0x202020FF };
unsigned int dresscolors2[] = { 7, 0x8080FFC0, 0x80FF80C0, 0xFF8080C0, 0xFFFF80C0, 0xFF80FFC0, 0x80FFFFC0, 0xFFFFFF80 };
unsigned int swordcolors[] = { 6, 0xC0C0C0FF, 0xFFFFFFFF, 0xFFC0C0FF, 0xC0C0FFFF, 0x808080FF, 0x202020FF };
unsigned int eyecolors[] = { 4, 0x00C000FF, 0x0000C0FF, 0xC00000FF, 0xC0C000FF, 0x804010FF, 0x00C000FF };
EX void initcs(charstyle &cs) {
cs.charid = 0;
cs.skincolor = 0xD0D0D0FF;
cs.haircolor = 0x686868FF;
cs.dresscolor = 0xC00000FF;
cs.swordcolor = 0xD0D0D0FF;
cs.dresscolor2= 0x8080FFC0;
cs.uicolor = 0xFF0000FF;
cs.eyecolor = 0x603000FF;
cs.lefthanded = false;
}
EX void savecolortable(colortable& ct, string name) {
for(int i=0; i<isize(ct); i++)
addsaver(ct[i], "color:" + name + ":" + its(i));
}
EX purehookset hooks_configfile;
EX void initConfig() {
// basic config
param_i(vid.flashtime, "flashtime", 8);
param_enum(vid.msgleft, "message_style", "message style", 2)
-> editable({{"centered", ""}, {"left-aligned", ""}, {"line-broken", ""}}, "message style", 'a');
param_i(vid.msglimit, "message limit", 5);
param_i(vid.timeformat, "message log time format", 0);
param_b(resizable, "resizable", true)
-> editable("resizable window", 'r');
param_b(display_yasc_codes, "yasc", false)
-> editable("YASC codes", 'Y')
-> set_reaction([] {
addMessage(XLAT("YASC codes: Sides-Entity-Restrict-Threat-Wall"));
});
param_b(vid.relative_font, "relative_font", true)
-> editable("set relative font size", 'r')
-> set_reaction(compute_fsize);
param_i(vid.fontscale, "fontscale", 100)
-> editable(25, 400, 10, "font scale", "", 'b')
-> set_reaction(compute_fsize)
-> set_sets([] { dialog::bound_low(0); });
param_i(vid.abs_fsize, "fsize", 12)
-> editable(1, 72, 1, "font size", "", 'b')
-> set_reaction(compute_fsize)
-> set_sets([] { dialog::bound_low(0); });
param_i(vid.mobilecompasssize, "mobile compass size", 0); // ISMOBILE || ISPANDORA ? 30 : 0);
param_i(vid.radarsize, "radarsize size", 120);
addsaver(vid.radarrange, "radarrange", 2.5);
param_i(vid.axes, "movement help", 1);
param_b(vid.axes3, "movement help3", true);
param_i(vid.shifttarget, "shift-targetting", 2);
addsaver(vid.steamscore, "scores to Steam", 1);
initcs(vid.cs); addsaver(vid.cs, "single");
param_b(vid.samegender, "princess choice", false);
addsaver(vid.language, "language", -1);
param_b(vid.drawmousecircle, "mouse circle", ISMOBILE || ISPANDORA);
param_b(vid.revcontrol, "reverse control", false);
#if CAP_AUDIO
param_i(musicvolume, "music volume")
->editable(0, 128, 10, "background music volume", "", 'b')
->set_sets(sets_music_volume);
#endif
#if CAP_SDLAUDIO
addsaver(music_out_of_focus, "music out of focus", false);
#endif
#if CAP_AUDIO
param_i(effvolume, "sound effect volume")
->editable(0, 128, 10, "sound effects volume", "", 'e')
->set_sets(sets_sfx_volume);
#endif
param_enum(vid.faraway_highlight, "faraway_highlight", "highlight faraway monsters", tlNoThreat)
->editable({{"off", ""}, {"spam", ""}, {"normal monsters", ""}, {"high-threat monsters only", ""}}, "highlight faraway monsters", 'h');
param_i(vid.faraway_highlight_color, "faraway_highlight_color", 50)
-> editable(0, 100, 10, "faraway highlight color", "0 = monster color, 100 = red-light oscillation", 'c');
param_enum(glyphsortorder, "glyph_sort", "glyph sort order", glyphsortorder)
->editable({
{"first on top", ""},
{"first on bottom", ""},
{"last on top", ""},
{"last on bottom", ""},
{"by land", ""},
{"by number", ""}
}, "inventory/kill sorting", 'k');
// basic graphics
param_b(vid.wantGL, "usingGL", true)
->editable("openGL mode", 'o');
addsaver(vid.want_antialias, "antialias", AA_NOGL | AA_FONT | (ISWEB ? AA_MULTI : AA_LINES) | AA_VERSION);
addsaver(vid.fineline, "fineline", true);
param_f(vid.linewidth, "linewidth", 1);
addsaver(precise_width, "precisewidth", .5);
addsaver(perfect_linewidth, "perfect_linewidth", 1);
param_f(linepatterns::width, "lpwidth", "pattern-linewidth", 1);
addsaver(fat_edges, "fat-edges");
param_f(vid.sspeed, "sspeed", "scrollingspeed", 0);
param_f(vid.mspeed, "mspeed", "movement speed", 1);
addsaver(vid.aurastr, "aura strength", ISMOBILE ? 0 : 128);
addsaver(vid.aurasmoothen, "aura smoothen", 5);
param_enum(vid.graphglyph, "graphglyph", "graphical items/kills", 1)
-> editable({{"letters", ""}, {"auto", ""}, {"images", ""}}, "inventory/kill mode", 'd');
param_f(vid.binary_width, "bwidth", "binary-tiling-width", 1);
param_custom(vid.binary_width, "binary tiling width", menuitem_binary_width, 'v');
addsaver(vid.particles, "extra effects", 1);
param_i(vid.framelimit, "frame limit", 999);
#if !ISMOBWEB
param_b(vid.want_vsync, "vsync", true)
->editable("vsync", 'v');
#endif
param_b(vid.want_fullscreen, "fullscreen", false)
->editable("fullscreen mode", 'f');
param_b(vid.change_fullscr, "fullscreen_change", false)
->editable("use specific fullscreen resolution", 'g');
param_b(vid.relative_window_size, "window_relative", true)
->editable("specify relative window size", 'g');
param_custom(vid.xres, "xres", [] (char ch) {}, 0)->restrict = return_false;
param_custom(vid.yres, "yres", [] (char ch) {}, 0)->restrict = return_false;
param_i(vid.fullscreen_x, "fullscreen_x", 1280)
-> editable(640, 3840, 640, "fullscreen resolution to use (X)", "", 'x')
-> set_sets([] { dialog::bound_low(640); });
param_i(vid.fullscreen_y, "fullscreen_y", 1024)
-> editable(480, 2160, 480, "fullscreen resolution to use (Y)", "", 'x')
-> set_sets([] { dialog::bound_low(480); });
param_i(vid.window_x, "window_x", 1280)
-> editable(160, 3840, 160, "window resolution to use (X)", "", 'x')
-> set_sets([] { dialog::bound_low(160); });
param_i(vid.window_y, "window_y", 1024)
-> editable(120, 2160, 120, "window resolution to use (Y)", "", 'x')
-> set_sets([] { dialog::bound_low(120); });
param_f(vid.window_rel_x, "window_rel_x", .9)
-> editable(.1, 1, .1, "screen size percentage to use (X)", "", 'x')
-> set_sets([] { dialog::bound_low(.1); });
param_f(vid.window_rel_y, "window_rel_y", .9)
-> editable(.1, 1, .1, "screen size percentage to use (Y)", "", 'x')
-> set_sets([] { dialog::bound_low(.1); });
param_b(vid.darkhepta, "mark heptagons", false);
for(auto& lp: linepatterns::patterns) {
addsaver(lp->color, "lpcolor-" + lp->lpname);
addsaver(lp->multiplier, "lpwidth-" + lp->lpname);
}
// special graphics
addsaver(vid.monmode, "monster display mode", DEFAULT_MONMODE);
addsaver(vid.wallmode, "wall display mode", DEFAULT_WALLMODE);
addsaver(vid.highlightmode, "highlightmode");
addsaver(vid.always3, "3D always", false);
addsaver(memory_saving_mode, "memory_saving_mode", (ISMOBILE || ISPANDORA || ISWEB) ? 1 : 0);
param_i(reserve_limit, "memory_reserve", 128);
addsaver(show_memory_warning, "show_memory_warning");
addsaver(rug::renderonce, "rug-renderonce");
addsaver(rug::rendernogl, "rug-rendernogl");
addsaver(rug::texturesize, "rug-texturesize");
#if CAP_RUG
param_f(rug::model_distance, "rug_model_distance", "rug-model-distance");
#endif
param_b(vid.backeffects, "background particle effects", (ISMOBILE || ISPANDORA) ? false : true);
// control
param_i(vid.joyvalue, "vid.joyvalue", 4800);
param_i(vid.joyvalue2, "vid.joyvalue2", 5600);
param_i(vid.joysmooth, "vid.joysmooth", 200);
param_i(vid.joypanthreshold, "vid.joypanthreshold", 2500);
param_f(vid.joypanspeed, "vid.joypanspeed", ISPANDORA ? 0.0001 : 0);
addsaver(autojoy, "autojoy");
vid.killreduction = 0;
param_b(vid.skipstart, "skip the start menu", false);
param_b(vid.quickmouse, "quick mouse", !ISPANDORA);
// colors
param_f(crosshair_size, "size:crosshair");
addsaver(crosshair_color, "color:crosshair");
addsaver(backcolor, "color:background");
addsaver(forecolor, "color:foreground");
addsaver(bordcolor, "color:borders");
addsaver(ringcolor, "color:ring");
param_f(vid.multiplier_ring, "mring", "mult:ring", 1);
addsaver(modelcolor, "color:model");
addsaver(periodcolor, "color:period");
addsaver(stdgridcolor, "color:stdgrid");
param_f(vid.multiplier_grid, "mgrid", "mult:grid", 1);
addsaver(dialog::dialogcolor, "color:dialog");
for(auto& p: colortables)
savecolortable(p.second, s0+"canvas"+p.first);
savecolortable(distcolors, "distance");
savecolortable(minecolors, "mines");
#if CAP_COMPLEX2
savecolortable(brownian::colors, "color:brown");
#endif
for(int i=0; i<motypes; i++)
addsaver(minf[i].color, "color:monster:" + its(i));
for(int i=0; i<ittypes; i++)
addsaver(iinf[i].color, "color:item:" + its(i));
for(int i=0; i<landtypes; i++)
addsaver(floorcolors[i], "color:land:" + its(i));
for(int i=0; i<walltypes; i++)
addsaver(winf[i].color, "color:wall:" + its(i));
// modes
addsaverenum(geometry, "mode-geometry");
addsaver(shmup::on, "mode-shmup", false);
addsaver(hardcore, "mode-hardcore", false);
addsaverenum(land_structure, "mode-chaos");
#if CAP_INV
addsaver(inv::on, "mode-Orb Strategy");
#endif
addsaverenum(variation, "mode-variation", eVariation::bitruncated);
addsaver(peace::on, "mode-peace");
addsaver(peace::otherpuzzles, "mode-peace-submode");
addsaverenum(specialland, "land for special modes");
addsaver(viewdists, "expansion mode");
param_f(backbrightness, "back", "brightness behind sphere");
param_f(vid.ipd, "ipd", "interpupilar-distance", 0.05);
param_f(vid.lr_eyewidth, "lr", "eyewidth-lr", 0.5);
param_f(vid.anaglyph_eyewidth, "anaglyph", "eyewidth-anaglyph", 0.1);
param_f(vid.fov, "fov", "field-of-vision", 90);
addsaver(vid.desaturate, "desaturate", 0);
param_enum(vid.stereo_mode, "stereo_mode", "stereo-mode", vid.stereo_mode)
->editable({{"OFF", ""}, {"anaglyph", ""}, {"side-by-side", ""}
#if CAP_ODS
, {"ODS", ""}
#endif
}, "stereo mode", 'm');
param_f(vid.plevel_factor, "plevel_factor", 0.7);
#if CAP_GP
addsaver(gp::param.first, "goldberg-x", gp::param.first);
addsaver(gp::param.second, "goldberg-y", gp::param.second);
#endif
param_b(nohud, "no-hud", false);
param_b(nofps, "no-fps", false);
#if CAP_IRR
addsaver(irr::density, "irregular-density", 2);
addsaver(irr::cellcount, "irregular-cellcount", 150);
addsaver(irr::quality, "irregular-quality", .2);
addsaver(irr::place_attempts, "irregular-place", 10);
addsaver(irr::rearrange_max_attempts, "irregular-rearrange-max", 50);
addsaver(irr::rearrange_less, "irregular-rearrangeless", 10);
#endif
param_i(vid.linequality, "line quality", 0);
#if CAP_FILES && CAP_SHOT && CAP_ANIMATIONS
addsaver(anims::animfile, "animation file format");
#endif
#if CAP_RUG
addsaver(rug::move_on_touch, "rug move on touch");
#endif
#if CAP_CRYSTAL
param_f(crystal::compass_probability, "cprob", "compass-probability");
addsaver(crystal::view_coordinates, "crystal-coordinates");
#endif
#if CAP_TEXTURE
param_b(texture::texture_aura, "texture-aura", false);
#endif
addsaver(vid.use_smart_range, "smart-range", 0);
param_f(vid.smart_range_detail, "smart-range-detail", 8)
->editable(1, 50, 1, "minimum visible cell in pixels", "", 'd');
param_f(vid.smart_range_detail_3, "smart-range-detail-3", 30)
->editable(1, 50, 1, "minimum visible cell in pixels", "", 'd');
param_b(vid.smart_area_based, "smart-area-based", false);
param_i(vid.cells_drawn_limit, "limit on cells drawn", 10000);
param_i(vid.cells_generated_limit, "limit on cells generated", 250);
#if CAP_SOLV
addsaver(sn::solrange_xy, "solrange-xy");
addsaver(sn::solrange_z, "solrange-z");
#endif
addsaver(slr::steps, "slr-steps");
addsaver(slr::range_xy, "slr-range-xy");
#if CAP_ARCM
addsaver(arcm::current.symbol, "arcm-symbol", "4^5");
#endif
addsaverenum(hybrid::underlying, "product-underlying");
for(int i=0; i<isize(ginf); i++) {
if(ginf[i].flags & qELLIPTIC)
sightranges[i] = M_PI;
else if(ginf[i].cclass == gcSphere)
sightranges[i] = 2 * M_PI;
else if(ginf[i].cclass == gcEuclid)
sightranges[i] = 10;
else if(ginf[i].cclass == gcSL2)
sightranges[i] = 4.5;
else if(ginf[i].cclass == gcHyperbolic && ginf[i].g.gameplay_dimension == 2)
sightranges[i] = 4.5;
else
sightranges[i] = 5;
sightranges[gArchimedean] = 10;
if(i < gBinary3) addsaver(sightranges[i], "sight-g" + its(i));
}
ld bonus = 0;
ld emul = 1;
param_b(dialog::onscreen_keyboard, "onscreen_keyboard")
->editable("onscreen keyboard", 'k');
param_b(context_fog, "coolfog");
addsaver(sightranges[gBinary3], "sight-binary3", 3.1 + bonus);
addsaver(sightranges[gCubeTiling], "sight-cubes", 10);
addsaver(sightranges[gCell120], "sight-120cell", 2 * M_PI);
addsaver(sightranges[gECell120], "sight-120cell-elliptic", M_PI);
addsaver(sightranges[gRhombic3], "sight-rhombic", 10.5 * emul);
addsaver(sightranges[gBitrunc3], "sight-bitrunc", 12 * emul);
addsaver(sightranges[gSpace534], "sight-534", 4 + bonus);
addsaver(sightranges[gSpace435], "sight-435", 3.8 + bonus);
addsaver(sightranges[gCell5], "sight-5cell", 2 * M_PI);
addsaver(sightranges[gCell8], "sight-8cell", 2 * M_PI);
addsaver(sightranges[gECell8], "sight-8cell-elliptic", M_PI);
addsaver(sightranges[gCell16], "sight-16cell", 2 * M_PI);
addsaver(sightranges[gECell16], "sight-16cell-elliptic", M_PI);
addsaver(sightranges[gCell24], "sight-24cell", 2 * M_PI);
addsaver(sightranges[gECell24], "sight-24cell-elliptic", M_PI);
addsaver(sightranges[gCell600], "sight-600cell", 2 * M_PI);
addsaver(sightranges[gECell600], "sight-600cell-elliptic", M_PI);
addsaver(sightranges[gHoroTris], "sight-horotris", 2.9 + bonus);
addsaver(sightranges[gHoroRec], "sight-hororec", 2.2 + bonus);
addsaver(sightranges[gHoroHex], "sight-horohex", 2.75 + bonus);
addsaver(sightranges[gKiteDart3], "sight-kd3", 2.25 + bonus);
addsaver(sightranges[gField435], "sight-field435", 4 + bonus);
addsaver(sightranges[gField534], "sight-field534", 3.8 + bonus);
addsaver(sightranges[gSol], "sight-sol");
addsaver(sightranges[gNil], "sight-nil", 6.5 + bonus);
addsaver(sightranges[gNIH], "sight-nih");
addsaver(sightranges[gSolN], "sight-solnih");
addsaver(sightranges[gCrystal344], "sight-crystal344", 2.5); /* assume raycasting */
addsaver(sightranges[gSpace344], "sight-344", 4.5);
addsaver(sightranges[gSpace336], "sight-336", 4);
param_b(vid.sloppy_3d, "sloppy3d", true);
param_i(vid.texture_step, "wall-quality", 4);
param_b(smooth_scrolling, "smooth-scrolling", false);
addsaver(mouseaim_sensitivity, "mouseaim_sensitivity", 0.01);