mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +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];
|
||||
if(levels && new_levellines_for[3]) {
|
||||
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, 0xFF0000FF, 0, -z - floor(-z), 4);
|
||||
}
|
||||
@ -337,7 +337,7 @@ void level::init() {
|
||||
for(int y=1; y<=4; y++) {
|
||||
auto l = new level(*this);
|
||||
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->sublevels = {};
|
||||
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) {
|
||||
return h[0] * h[1] / 2;
|
||||
}
|
||||
ld rot_plane(hyperpoint h) { return nilv::convert_bonus(h, nilv::nmSym, nilv::model_used); }
|
||||
|
||||
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) {
|
||||
return h[0] * h[1];
|
||||
return rot_plane(h) + h[0] * h[1] / 2;
|
||||
}
|
||||
|
||||
ld cycloid(ld x) {
|
||||
@ -79,8 +77,7 @@ ld cycloid_wave(ld x) {
|
||||
}
|
||||
|
||||
ld brachistochrone(hyperpoint h) {
|
||||
ld res = -cycloid_wave(h[0] / 63) * 63 + h[0] * h[1] + h[1] * h[1] / 5;
|
||||
return res;
|
||||
return long_x(h) - cycloid_wave(h[0] / 63) * 63 + h[1] * h[1] / 5;
|
||||
}
|
||||
|
||||
ld geodesics_0(hyperpoint h) {
|
||||
@ -613,7 +610,7 @@ struct complex_surface {
|
||||
hyperpoint cur;
|
||||
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 vpush(hyperpoint h) { h[0] = 0; h[2] = 0; return flatpush(h); }
|
||||
|
||||
@ -751,7 +748,7 @@ struct complex_surface {
|
||||
ld get(hyperpoint h) {
|
||||
int ax = int(floor(h[0] / 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;
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,6 @@ struct goal {
|
||||
|
||||
using surface_fun = std::function<ld(hyperpoint h)>;
|
||||
|
||||
ld heis_to_used_bonus(const hyperpoint&);
|
||||
|
||||
struct level {
|
||||
string name;
|
||||
char hotkey;
|
||||
@ -116,13 +114,12 @@ struct level {
|
||||
ld startx, starty;
|
||||
vector<level*> sublevels;
|
||||
ld scale;
|
||||
surface_fun surface_heisenberg;
|
||||
ld surface(hyperpoint h) { return surface_heisenberg(h) + heis_to_used_bonus(h); }
|
||||
surface_fun surface;
|
||||
|
||||
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) :
|
||||
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;
|
||||
|
||||
|
@ -2,23 +2,9 @@ namespace nilrider {
|
||||
|
||||
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 */
|
||||
EX hyperpoint sym_to_used(hyperpoint H) {
|
||||
if(nil) H[2] += sym_to_used_bonus(H);
|
||||
return H;
|
||||
}
|
||||
|
||||
/** convert Heisenberg to internal model */
|
||||
EX hyperpoint heis_to_used(hyperpoint H) {
|
||||
if(nil) H[2] += heis_to_used_bonus(H);
|
||||
if(nil) nilv::convert_ref(H, nilv::nmSym, nilv::model_used);
|
||||
return H;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user