mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
nilrider:: surface now simply returns a value in the current model
This commit is contained in:
parent
7a0501af3d
commit
bc2681fb1b
@ -54,7 +54,7 @@ void level::init_textures() {
|
|||||||
col = bcols[c];
|
col = bcols[c];
|
||||||
if(levels && new_levellines_for[3]) {
|
if(levels && new_levellines_for[3]) {
|
||||||
hyperpoint h = T * mappt(x, y, texture_density);
|
hyperpoint h = T * mappt(x, y, texture_density);
|
||||||
ld z = h[2] - sym_to_used_bonus(h);
|
ld z = h[2] - nilv::convert_bonus(h, nilv::nmSym, nilv::model_used);
|
||||||
if(z > 0) col = gradient(col, 0xFFFF0000, 0, z - floor(z), 4);
|
if(z > 0) col = gradient(col, 0xFFFF0000, 0, z - floor(z), 4);
|
||||||
if(z < 0) col = gradient(col, 0xFF0000FF, 0, -z - floor(-z), 4);
|
if(z < 0) col = gradient(col, 0xFF0000FF, 0, -z - floor(-z), 4);
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ void level::init() {
|
|||||||
for(int y=1; y<=4; y++) {
|
for(int y=1; y<=4; y++) {
|
||||||
auto l = new level(*this);
|
auto l = new level(*this);
|
||||||
l->name = l->name + "#" + its(y);
|
l->name = l->name + "#" + its(y);
|
||||||
l->surface_heisenberg = [y] (hyperpoint h) { return rot_plane(h) - 3 * y; };
|
l->surface = [y] (hyperpoint h) { return rot_plane(h) - 3 * y; };
|
||||||
l->map_tiles[1][1] = '*';
|
l->map_tiles[1][1] = '*';
|
||||||
l->sublevels = {};
|
l->sublevels = {};
|
||||||
sublevels.push_back(l);
|
sublevels.push_back(l);
|
||||||
|
@ -44,18 +44,16 @@ goalchecker fullstop_check(ld time_limit, ld rev_limit) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ld f_heisenberg0(hyperpoint h) { return 0; }
|
ld f_heisenberg0(hyperpoint h) { return nilv::convert_bonus(h, nilv::nmHeis, nilv::model_used); }
|
||||||
|
|
||||||
ld rot_plane(hyperpoint h) {
|
ld rot_plane(hyperpoint h) { return nilv::convert_bonus(h, nilv::nmSym, nilv::model_used); }
|
||||||
return h[0] * h[1] / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
ld f_rot_well(hyperpoint h) {
|
ld f_rot_well(hyperpoint h) {
|
||||||
return h[0] * h[1] / 2 + h[0] * h[0] + h[1] * h[1];
|
return rot_plane(h) + h[0] * h[0] + h[1] * h[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
ld long_x(hyperpoint h) {
|
ld long_x(hyperpoint h) {
|
||||||
return h[0] * h[1];
|
return rot_plane(h) + h[0] * h[1] / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ld cycloid(ld x) {
|
ld cycloid(ld x) {
|
||||||
@ -79,8 +77,7 @@ ld cycloid_wave(ld x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ld brachistochrone(hyperpoint h) {
|
ld brachistochrone(hyperpoint h) {
|
||||||
ld res = -cycloid_wave(h[0] / 63) * 63 + h[0] * h[1] + h[1] * h[1] / 5;
|
return long_x(h) - cycloid_wave(h[0] / 63) * 63 + h[1] * h[1] / 5;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ld geodesics_0(hyperpoint h) {
|
ld geodesics_0(hyperpoint h) {
|
||||||
@ -613,7 +610,7 @@ struct complex_surface {
|
|||||||
hyperpoint cur;
|
hyperpoint cur;
|
||||||
map<pair<int, int>, surface_fun> blocks;
|
map<pair<int, int>, surface_fun> blocks;
|
||||||
|
|
||||||
static transmatrix flatpush(hyperpoint h) { return rgpushxto0(point31(h[0], h[1], 0)); }
|
static transmatrix flatpush(hyperpoint h) { return rgpushxto0(nilv::convert(point31(h[0], h[1], 0), nilv::nmSym, nilv::model_used)); }
|
||||||
static transmatrix hpush(hyperpoint h) { h[1] = 0; h[2] = 0; return flatpush(h); }
|
static transmatrix hpush(hyperpoint h) { h[1] = 0; h[2] = 0; return flatpush(h); }
|
||||||
static transmatrix vpush(hyperpoint h) { h[0] = 0; h[2] = 0; return flatpush(h); }
|
static transmatrix vpush(hyperpoint h) { h[0] = 0; h[2] = 0; return flatpush(h); }
|
||||||
|
|
||||||
@ -751,7 +748,7 @@ struct complex_surface {
|
|||||||
ld get(hyperpoint h) {
|
ld get(hyperpoint h) {
|
||||||
int ax = int(floor(h[0] / 4));
|
int ax = int(floor(h[0] / 4));
|
||||||
int ay = int(floor(h[1] / 4));
|
int ay = int(floor(h[1] / 4));
|
||||||
if(blocks.count({ax, ay})) return blocks[{ax, ay}] (h) + h[0] * h[1] / 2;
|
if(blocks.count({ax, ay})) return blocks[{ax, ay}] (h);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,8 +104,6 @@ struct goal {
|
|||||||
|
|
||||||
using surface_fun = std::function<ld(hyperpoint h)>;
|
using surface_fun = std::function<ld(hyperpoint h)>;
|
||||||
|
|
||||||
ld heis_to_used_bonus(const hyperpoint&);
|
|
||||||
|
|
||||||
struct level {
|
struct level {
|
||||||
string name;
|
string name;
|
||||||
char hotkey;
|
char hotkey;
|
||||||
@ -116,13 +114,12 @@ struct level {
|
|||||||
ld startx, starty;
|
ld startx, starty;
|
||||||
vector<level*> sublevels;
|
vector<level*> sublevels;
|
||||||
ld scale;
|
ld scale;
|
||||||
surface_fun surface_heisenberg;
|
surface_fun surface;
|
||||||
ld surface(hyperpoint h) { return surface_heisenberg(h) + heis_to_used_bonus(h); }
|
|
||||||
|
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
|
||||||
level(string name, char hotkey, flagtype flags, string longdesc, ld minx, ld miny, ld maxx, ld maxy, const vector<string>& mt, ld sx, ld sy, const vector<level*> subs, const std::function<ld(hyperpoint h)>& surf, vector<goal> g) :
|
level(string name, char hotkey, flagtype flags, string longdesc, ld minx, ld miny, ld maxx, ld maxy, const vector<string>& mt, ld sx, ld sy, const vector<level*> subs, const std::function<ld(hyperpoint h)>& surf, vector<goal> g) :
|
||||||
name(name), hotkey(hotkey), longdesc(longdesc), flags(flags), minx(minx), miny(miny), maxx(maxx), maxy(maxy), map_tiles(mt), startx(sx), starty(sy), sublevels(subs), surface_heisenberg(surf), goals(g) { initialized = false; }
|
name(name), hotkey(hotkey), longdesc(longdesc), flags(flags), minx(minx), miny(miny), maxx(maxx), maxy(maxy), map_tiles(mt), startx(sx), starty(sy), sublevels(subs), surface(surf), goals(g) { initialized = false; }
|
||||||
|
|
||||||
ld real_minx, real_miny, real_maxx, real_maxy;
|
ld real_minx, real_miny, real_maxx, real_maxy;
|
||||||
|
|
||||||
|
@ -2,23 +2,9 @@ namespace nilrider {
|
|||||||
|
|
||||||
ld timestamp::energy_in_squares() { return vel * vel / (2 * gravity); }
|
ld timestamp::energy_in_squares() { return vel * vel / (2 * gravity); }
|
||||||
|
|
||||||
EX ld sym_to_used_bonus(const hyperpoint& H) {
|
|
||||||
return nilv::sym_to_heis_bonus(H) * (nilv::model_used - nilv::nmSym);
|
|
||||||
}
|
|
||||||
|
|
||||||
EX ld heis_to_used_bonus(const hyperpoint& H) {
|
|
||||||
return nilv::sym_to_heis_bonus(H) * (nilv::model_used - nilv::nmHeis);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** convert rotationally symmetric to internal model */
|
/** convert rotationally symmetric to internal model */
|
||||||
EX hyperpoint sym_to_used(hyperpoint H) {
|
EX hyperpoint sym_to_used(hyperpoint H) {
|
||||||
if(nil) H[2] += sym_to_used_bonus(H);
|
if(nil) nilv::convert_ref(H, nilv::nmSym, nilv::model_used);
|
||||||
return H;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** convert Heisenberg to internal model */
|
|
||||||
EX hyperpoint heis_to_used(hyperpoint H) {
|
|
||||||
if(nil) H[2] += heis_to_used_bonus(H);
|
|
||||||
return H;
|
return H;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user