mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
removed the tohex parameter
This commit is contained in:
parent
decd30164d
commit
012d833f50
2
cell.cpp
2
cell.cpp
@ -1107,7 +1107,7 @@ EX vector<cell*> build_shortest_path(cell *c1, cell *c2) {
|
|||||||
ld step = hdist0(h) / steps;
|
ld step = hdist0(h) / steps;
|
||||||
for(int i=0; i< steps; i++) {
|
for(int i=0; i< steps; i++) {
|
||||||
T1 = T1 * xpush(step);
|
T1 = T1 * xpush(step);
|
||||||
virtualRebase(x, T1, true);
|
virtualRebase(x, T1);
|
||||||
println(hlog, "x = ", x, "p length = ", isize(p), " dist = ", hdist0(tC0(T1)), " dist from end = ", hdist(tC0(T1), tC0(calc_relative_matrix(c2, x, C0))));
|
println(hlog, "x = ", x, "p length = ", isize(p), " dist = ", hdist0(tC0(T1)), " dist from end = ", hdist(tC0(T1), tC0(calc_relative_matrix(c2, x, C0))));
|
||||||
while(x != p.back()) {
|
while(x != p.back()) {
|
||||||
forCellCM(c, p.back())
|
forCellCM(c, p.back())
|
||||||
|
@ -243,12 +243,13 @@ void virtualRebase_cell(cell*& base, T& at, const U& check) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class U>
|
template<class T, class U>
|
||||||
void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
|
void virtualRebase(cell*& base, T& at, const U& check) {
|
||||||
|
|
||||||
if(prod) {
|
if(prod) {
|
||||||
auto w = hybrid::get_where(base);
|
auto w = hybrid::get_where(base);
|
||||||
auto d = product_decompose(check(at)).first;
|
auto d = product_decompose(check(at)).first;
|
||||||
at = mscale(at, -d);
|
at = mscale(at, -d);
|
||||||
hybrid::in_underlying_map([&] { virtualRebase(w.first, at, tohex, check); });
|
hybrid::in_underlying_map([&] { virtualRebase(w.first, at, check); });
|
||||||
if(d > cgi.plevel / 2) { w.second++; d -= cgi.plevel; }
|
if(d > cgi.plevel / 2) { w.second++; d -= cgi.plevel; }
|
||||||
if(d < -cgi.plevel / 2) { w.second--; d += cgi.plevel; }
|
if(d < -cgi.plevel / 2) { w.second--; d += cgi.plevel; }
|
||||||
at = mscale(at, +d);
|
at = mscale(at, +d);
|
||||||
@ -283,13 +284,13 @@ void virtualRebase(cell*& base, T& at, bool tohex, const U& check) {
|
|||||||
virtualRebase_cell(base, at, check);
|
virtualRebase_cell(base, at, check);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void virtualRebase(cell*& base, transmatrix& at, bool tohex) {
|
EX void virtualRebase(cell*& base, transmatrix& at) {
|
||||||
virtualRebase(base, at, tohex, tC0);
|
virtualRebase(base, at, tC0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void virtualRebase(cell*& base, hyperpoint& h, bool tohex) {
|
EX void virtualRebase(cell*& base, hyperpoint& h) {
|
||||||
// we perform fixing in check, so that it works with larger range
|
// we perform fixing in check, so that it works with larger range
|
||||||
virtualRebase(base, h, tohex, [] (const hyperpoint& h) {
|
virtualRebase(base, h, [] (const hyperpoint& h) {
|
||||||
if(hyperbolic && GDIM == 2) return hpxy(h[0], h[1]);
|
if(hyperbolic && GDIM == 2) return hpxy(h[0], h[1]);
|
||||||
if(hyperbolic && GDIM == 3) return hpxy3(h[0], h[1], h[2]);
|
if(hyperbolic && GDIM == 3) return hpxy3(h[0], h[1], h[2]);
|
||||||
return h;
|
return h;
|
||||||
|
@ -4226,7 +4226,7 @@ EX ld wall_radar(cell *c, transmatrix T, transmatrix LPe, ld max) {
|
|||||||
ld fixed_yshift = 0;
|
ld fixed_yshift = 0;
|
||||||
for(int i=0; i<20; i++) {
|
for(int i=0; i<20; i++) {
|
||||||
T = parallel_transport(T, ori, ztangent(-step));
|
T = parallel_transport(T, ori, ztangent(-step));
|
||||||
virtualRebase(c, T, true);
|
virtualRebase(c, T);
|
||||||
color_t col;
|
color_t col;
|
||||||
if(isWall3(c, col) || (WDIM == 2 && GDIM == 3 && tC0(T)[2] > cgi.FLOOR)) {
|
if(isWall3(c, col) || (WDIM == 2 && GDIM == 3 && tC0(T)[2] > cgi.FLOOR)) {
|
||||||
T = parallel_transport(T, ori, ztangent(step));
|
T = parallel_transport(T, ori, ztangent(step));
|
||||||
|
@ -1435,7 +1435,7 @@ EX void optimizeview() {
|
|||||||
if(dual::split(optimizeview)) return;
|
if(dual::split(optimizeview)) return;
|
||||||
|
|
||||||
transmatrix iView = inverse(View);
|
transmatrix iView = inverse(View);
|
||||||
virtualRebase(centerover, iView, true);
|
virtualRebase(centerover, iView);
|
||||||
View = inverse(iView);
|
View = inverse(iView);
|
||||||
|
|
||||||
println(hlog, "centerover = ", centerover);
|
println(hlog, "centerover = ", centerover);
|
||||||
|
@ -125,7 +125,7 @@ void set_relmatrices(cellinfo& ci) {
|
|||||||
|
|
||||||
void rebase(cellinfo& ci) {
|
void rebase(cellinfo& ci) {
|
||||||
cell *cx = ci.owner;
|
cell *cx = ci.owner;
|
||||||
virtualRebase(ci.owner, ci.p, false);
|
virtualRebase(ci.owner, ci.p);
|
||||||
if(ci.owner != cx) {
|
if(ci.owner != cx) {
|
||||||
printf("rebased %p to %p\n", cx, ci.owner);
|
printf("rebased %p to %p\n", cx, ci.owner);
|
||||||
set_relmatrices(ci);
|
set_relmatrices(ci);
|
||||||
@ -173,7 +173,7 @@ void bitruncate() {
|
|||||||
s.neid.push_back(next);
|
s.neid.push_back(next);
|
||||||
s.neid.push_back(-1);
|
s.neid.push_back(-1);
|
||||||
s.generation = bitruncations_performed + 1;
|
s.generation = bitruncations_performed + 1;
|
||||||
virtualRebase(s.owner, s.p, false);
|
virtualRebase(s.owner, s.p);
|
||||||
set_relmatrices(s);
|
set_relmatrices(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -579,21 +579,21 @@ EX void generate_track() {
|
|||||||
if(WDIM == 2 && !bounded_track) for(a=0; a<10; a += .1) {
|
if(WDIM == 2 && !bounded_track) for(a=0; a<10; a += .1) {
|
||||||
hyperpoint h = straight * parabolic1(a) * C0;
|
hyperpoint h = straight * parabolic1(a) * C0;
|
||||||
cell *at = s;
|
cell *at = s;
|
||||||
virtualRebase(at, h, true);
|
virtualRebase(at, h);
|
||||||
if(!rti_id.count(at) || get_info(at).from_track >= TWIDTH) break;
|
if(!rti_id.count(at) || get_info(at).from_track >= TWIDTH) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(WDIM == 2 && !bounded_track) for(ld cleaner=0; cleaner<a*.75; cleaner += .2) for(int dir=-1; dir<=1; dir+=2) {
|
if(WDIM == 2 && !bounded_track) for(ld cleaner=0; cleaner<a*.75; cleaner += .2) for(int dir=-1; dir<=1; dir+=2) {
|
||||||
transmatrix T = straight * parabolic1(cleaner * dir);
|
transmatrix T = straight * parabolic1(cleaner * dir);
|
||||||
cell *at = s;
|
cell *at = s;
|
||||||
virtualRebase(at, T, true);
|
virtualRebase(at, T);
|
||||||
get_info(at).from_start = 0;
|
get_info(at).from_start = 0;
|
||||||
for(ld u=0; u<50; u++) {
|
for(ld u=0; u<50; u++) {
|
||||||
if(at->wall != waBarrier)
|
if(at->wall != waBarrier)
|
||||||
makeEmpty(at);
|
makeEmpty(at);
|
||||||
killMonster(at, moNone, 0);
|
killMonster(at, moNone, 0);
|
||||||
T = T * xpush(.1);
|
T = T * xpush(.1);
|
||||||
virtualRebase(at, T, true);
|
virtualRebase(at, T);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ EX void generate_track() {
|
|||||||
for(const transmatrix& t: forbidden) if(hdist(t*C0, who->at * C0) < 10. / (j+10)) ok = false;
|
for(const transmatrix& t: forbidden) if(hdist(t*C0, who->at * C0) < 10. / (j+10)) ok = false;
|
||||||
if(ok) break;
|
if(ok) break;
|
||||||
}
|
}
|
||||||
virtualRebase(who, true);
|
virtualRebase(who);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bounded_track) track.back()->wall = waCloud;
|
if(bounded_track) track.back()->wall = waCloud;
|
||||||
|
@ -820,7 +820,7 @@ EX void cast() {
|
|||||||
if(nonisotropic) T = NLP * T;
|
if(nonisotropic) T = NLP * T;
|
||||||
T = inverse(T);
|
T = inverse(T);
|
||||||
|
|
||||||
virtualRebase(cs, T, true);
|
virtualRebase(cs, T);
|
||||||
|
|
||||||
if(true) {
|
if(true) {
|
||||||
manual_celllister cl;
|
manual_celllister cl;
|
||||||
|
10
shmup.cpp
10
shmup.cpp
@ -151,7 +151,7 @@ cell *monster::findbase(const transmatrix& T, int maxsteps) {
|
|||||||
if(isVirtual) {
|
if(isVirtual) {
|
||||||
cell *c = base;
|
cell *c = base;
|
||||||
auto cT = T;
|
auto cT = T;
|
||||||
virtualRebase(c, cT, true);
|
virtualRebase(c, cT);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
else return findbaseAround(T, base, maxsteps);
|
else return findbaseAround(T, base, maxsteps);
|
||||||
@ -169,14 +169,14 @@ void fix_to_2(transmatrix& T) {
|
|||||||
void monster::rebasePat(const transmatrix& new_pat, cell *c2) {
|
void monster::rebasePat(const transmatrix& new_pat, cell *c2) {
|
||||||
if(isVirtual) {
|
if(isVirtual) {
|
||||||
at = new_pat;
|
at = new_pat;
|
||||||
virtualRebase(this, true);
|
virtualRebase(this);
|
||||||
fix_to_2(at);
|
fix_to_2(at);
|
||||||
pat = at;
|
pat = at;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(quotient) {
|
if(quotient) {
|
||||||
at = inverse(gmatrix[base]) * new_pat;
|
at = inverse(gmatrix[base]) * new_pat;
|
||||||
virtualRebase(this, true);
|
virtualRebase(this);
|
||||||
fix_to_2(at);
|
fix_to_2(at);
|
||||||
if(base != c2) {
|
if(base != c2) {
|
||||||
auto T = calc_relative_matrix(c2, base, tC0(at));
|
auto T = calc_relative_matrix(c2, base, tC0(at));
|
||||||
@ -2812,8 +2812,8 @@ EX void destroyBoats(cell *c) {
|
|||||||
m->inBoat = false;
|
m->inBoat = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void virtualRebase(shmup::monster *m, bool tohex) {
|
EX void virtualRebase(shmup::monster *m) {
|
||||||
virtualRebase(m->base, m->at, tohex);
|
virtualRebase(m->base, m->at);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX hookset<bool(shmup::monster*, string&)> *hooks_describe;
|
EX hookset<bool(shmup::monster*, string&)> *hooks_describe;
|
||||||
|
Loading…
Reference in New Issue
Block a user