mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
smartrange area-based
This commit is contained in:
parent
c932ae4399
commit
644d20cd89
@ -554,6 +554,7 @@ EX void initConfig() {
|
|||||||
addsaver(vid.use_smart_range, "smart-range", 0);
|
addsaver(vid.use_smart_range, "smart-range", 0);
|
||||||
addsaver(vid.smart_range_detail, "smart-range-detail", 8);
|
addsaver(vid.smart_range_detail, "smart-range-detail", 8);
|
||||||
addsaver(vid.smart_range_detail_3, "smart-range-detail", 30);
|
addsaver(vid.smart_range_detail_3, "smart-range-detail", 30);
|
||||||
|
addsaver(vid.smart_area_based, "smart-area-based", false);
|
||||||
addsaver(vid.cells_drawn_limit, "limit on cells drawn", 10000);
|
addsaver(vid.cells_drawn_limit, "limit on cells drawn", 10000);
|
||||||
addsaver(vid.cells_generated_limit, "limit on cells generated", 250);
|
addsaver(vid.cells_generated_limit, "limit on cells generated", 250);
|
||||||
|
|
||||||
@ -1004,6 +1005,9 @@ EX void edit_sightrange() {
|
|||||||
dialog::addSelItem(XLAT("game range bonus"), its(gamerange_bonus), 'S');
|
dialog::addSelItem(XLAT("game range bonus"), its(gamerange_bonus), 'S');
|
||||||
dialog::add_action([] () { gamerange_bonus = sightrange_bonus; doOvergenerate(); });
|
dialog::add_action([] () { gamerange_bonus = sightrange_bonus; doOvergenerate(); });
|
||||||
}
|
}
|
||||||
|
if(vid.use_smart_range && WDIM == 2) {
|
||||||
|
dialog::addBoolItem_action(XLAT("area-based range"), vid.smart_area_based, 'A');
|
||||||
|
}
|
||||||
if(!allowChangeRange() || !allowIncreasedSight()) {
|
if(!allowChangeRange() || !allowIncreasedSight()) {
|
||||||
dialog::addItem(XLAT("enable the cheat mode for additional options"), 'X');
|
dialog::addItem(XLAT("enable the cheat mode for additional options"), 'X');
|
||||||
dialog::add_action(enable_cheat);
|
dialog::add_action(enable_cheat);
|
||||||
|
@ -798,6 +798,10 @@ int read_cheat_args() {
|
|||||||
vid.use_smart_range = 2;
|
vid.use_smart_range = 2;
|
||||||
shift_arg_formula(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail);
|
shift_arg_formula(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail);
|
||||||
}
|
}
|
||||||
|
else if(argis("-smartarea")) {
|
||||||
|
PHASEFROM(2); cheat();
|
||||||
|
shift(); vid.smart_area_based = argi();
|
||||||
|
}
|
||||||
else if(argis("-smartn")) {
|
else if(argis("-smartn")) {
|
||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
vid.use_smart_range = 1;
|
vid.use_smart_range = 1;
|
||||||
|
1
hyper.h
1
hyper.h
@ -341,6 +341,7 @@ struct videopar {
|
|||||||
int use_smart_range; // 0 = distance-based, 1 = model-based, 2 = model-based and generate
|
int use_smart_range; // 0 = distance-based, 1 = model-based, 2 = model-based and generate
|
||||||
ld smart_range_detail;// minimum visible cell for modes 1 and 2
|
ld smart_range_detail;// minimum visible cell for modes 1 and 2
|
||||||
ld smart_range_detail_3;// minimum visible cell in 3D (for mode 2, there is no mode 1)
|
ld smart_range_detail_3;// minimum visible cell in 3D (for mode 2, there is no mode 1)
|
||||||
|
bool smart_area_based;// based on area or length?
|
||||||
int cells_drawn_limit;
|
int cells_drawn_limit;
|
||||||
int cells_generated_limit; // limit on cells generated per frame
|
int cells_generated_limit; // limit on cells generated per frame
|
||||||
|
|
||||||
|
@ -897,7 +897,7 @@ EX ld det3(const transmatrix& T) {
|
|||||||
/** determinant */
|
/** determinant */
|
||||||
EX ld det(const transmatrix& T) {
|
EX ld det(const transmatrix& T) {
|
||||||
if(GDIM == 2)
|
if(GDIM == 2)
|
||||||
retrun det3(T);
|
return det3(T);
|
||||||
else {
|
else {
|
||||||
ld det = 1;
|
ld det = 1;
|
||||||
transmatrix M = T;
|
transmatrix M = T;
|
||||||
|
13
hypgraph.cpp
13
hypgraph.cpp
@ -1168,18 +1168,29 @@ EX bool in_smart_range(const shiftmatrix& T) {
|
|||||||
|
|
||||||
ld epsilon = 0.01;
|
ld epsilon = 0.01;
|
||||||
|
|
||||||
|
transmatrix ar;
|
||||||
|
|
||||||
ld dx = 0, dy = 0, dz = 0, dh[MAXMDIM];
|
ld dx = 0, dy = 0, dz = 0, dh[MAXMDIM];
|
||||||
for(int i=0; i<GDIM; i++) {
|
for(int i=0; i<GDIM; i++) {
|
||||||
hyperpoint h2;
|
hyperpoint h2;
|
||||||
applymodel(T * cpush0(i, epsilon), h2);
|
applymodel(T * cpush0(i, epsilon), h2);
|
||||||
ld x1 = current_display->radius * abs(h2[0] - h1[0]) / epsilon;
|
ld x1 = current_display->radius * abs(h2[0] - h1[0]) / epsilon;
|
||||||
ld y1 = current_display->radius * abs(h2[1] - h1[1]) * pconf.stretch / epsilon;
|
ld y1 = current_display->radius * abs(h2[1] - h1[1]) * pconf.stretch / epsilon;
|
||||||
|
|
||||||
|
for(int j=0; j<GDIM; j++) ar[i][j] = current_display->radius * (h2[j]-h1[j]) / epsilon;
|
||||||
|
|
||||||
dx = max(dx, x1); dy = max(dy, y1);
|
dx = max(dx, x1); dy = max(dy, y1);
|
||||||
if(GDIM == 3) dz = max(dz, abs(h2[2] - h1[2]));
|
if(GDIM == 3) dz = max(dz, abs(h2[2] - h1[2]));
|
||||||
dh[i] = hypot(x1, y1);
|
dh[i] = hypot(x1, y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GDIM == 3) {
|
if(GDIM == 2 && vid.smart_area_based) {
|
||||||
|
ld area = det2(ar);
|
||||||
|
ld scale = sqrt(area) * cgi.scalefactor * hcrossf7;
|
||||||
|
if(scale <= vid.smart_range_detail) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(GDIM == 3) {
|
||||||
if(-h1[2] + 2 * dz < pconf.clip_min || -h1[2] - 2 * dz > pconf.clip_max) return false;
|
if(-h1[2] + 2 * dz < pconf.clip_min || -h1[2] - 2 * dz > pconf.clip_max) return false;
|
||||||
sort(dh, dh+GDIM);
|
sort(dh, dh+GDIM);
|
||||||
ld scale = sqrt(dh[1] * dh[2]) * cgi.scalefactor * hcrossf7;
|
ld scale = sqrt(dh[1] * dh[2]) * cgi.scalefactor * hcrossf7;
|
||||||
|
Loading…
Reference in New Issue
Block a user