mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-17 11:30:09 +00:00
2D3D:: Archimedean no longer crashes after changing
This commit is contained in:
parent
2d79243ca2
commit
6a7c1438eb
@ -480,7 +480,7 @@ struct hrmap_archimedean : hrmap {
|
||||
}
|
||||
|
||||
if(euclid)
|
||||
alt = encodeId(pair_to_vec(int(T[0][2]), int(T[1][2])));
|
||||
alt = encodeId(pair_to_vec(int(T[0][GDIM]), int(T[1][GDIM])));
|
||||
|
||||
SDEBUG( println(hlog, "look for: ", alt, " / ", T * C0); )
|
||||
|
||||
@ -660,8 +660,8 @@ void connectHeptagons(heptspin hi, heptspin hs) {
|
||||
|
||||
// T and X are supposed to be equal -- move T so that it is closer to X
|
||||
void fixup_matrix(transmatrix& T, const transmatrix& X, ld step) {
|
||||
for(int i=0; i<3; i++)
|
||||
for(int j=0; j<3; j++)
|
||||
for(int i=0; i<MDIM; i++)
|
||||
for(int j=0; j<MDIM; j++)
|
||||
T[i][j] = (T[i][j] * (1-step) + X[i][j] * step);
|
||||
|
||||
/*
|
||||
@ -804,6 +804,13 @@ auto hook =
|
||||
addHook(hooks_args, 100, readArgs);
|
||||
#endif
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
auto hooksw = addHook(hooks_swapdim, 100, [] {
|
||||
for(auto& p: altmap) for(auto& pp: p.second) swapmatrix(pp.second);
|
||||
for(auto& p: archimedean_gmatrix) swapmatrix(p.second.second);
|
||||
});
|
||||
#endif
|
||||
|
||||
int archimedean_tiling::support_threecolor() {
|
||||
return (isize(faces) == 3 && invert[0] && invert[1] && invert[2] && faces[0] % 2 == 0 && faces[1] % 2 == 0 && faces[2] % 2 == 0) ? 2 :
|
||||
tilegroup[N*2] > 1 ? 1 :
|
||||
|
@ -1305,6 +1305,7 @@ void show3D() {
|
||||
geom3::camera = 0;
|
||||
if(pmodel == mdDisk) pmodel = mdPerspective;
|
||||
need_reset_geometry = true;
|
||||
callhooks(hooks_swapdim);
|
||||
}
|
||||
else {
|
||||
geom3::always3 = false;
|
||||
@ -1313,6 +1314,7 @@ void show3D() {
|
||||
geom3::camera = 1;
|
||||
if(pmodel == mdPerspective) pmodel = mdDisk;
|
||||
need_reset_geometry = true;
|
||||
callhooks(hooks_swapdim);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1929,6 +1931,7 @@ int read_config_args() {
|
||||
geom3::camera = 0;
|
||||
if(pmodel == mdDisk) pmodel = mdPerspective;
|
||||
need_reset_geometry = true;
|
||||
callhooks(hooks_swapdim);
|
||||
}
|
||||
else if(argis("-nohelp")) {
|
||||
PHASEFROM(2);
|
||||
|
@ -197,6 +197,8 @@ transmatrix xspinpush(ld dir, ld dist) {
|
||||
return spin(dir) * xpush(dist) * spin(-dir);
|
||||
}
|
||||
|
||||
purehookset hooks_swapdim;
|
||||
|
||||
namespace geom3 {
|
||||
|
||||
bool always3 = false;
|
||||
|
@ -6845,4 +6845,8 @@ bool inscreenrange(cell *c) {
|
||||
return heptdistance(viewcenter(), c) <= 8;
|
||||
}
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
auto hooksw = addHook(hooks_swapdim, 100, [] { clearAnimations(); gmatrix.clear(); gmatrix0.clear(); });
|
||||
#endif
|
||||
|
||||
}
|
||||
|
1
hyper.h
1
hyper.h
@ -2579,6 +2579,7 @@ template<class T, class U> int addHook(hookset<T>*& m, int prio, const U& hook)
|
||||
}
|
||||
|
||||
extern purehookset hooks_frame, hooks_stats, clearmemory, hooks_config, hooks_tests, hooks_removecells, hooks_initgame, hooks_calcparam, hooks_mainmenu, hooks_startmenu, hooks_markers;
|
||||
extern purehookset hooks_swapdim;
|
||||
|
||||
template<class T, class... U> void callhooks(hookset<T> *h, U... args) {
|
||||
if(h) for(auto& p: *h) p.second(args...);
|
||||
|
@ -354,6 +354,17 @@ transmatrix matrix4(ld a, ld b, ld c, ld d, ld e, ld f, ld g, ld h, ld i, ld j,
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
void swapmatrix(transmatrix& T) {
|
||||
for(int i=0; i<4; i++) swap(T[i][2], T[i][3]);
|
||||
for(int i=0; i<4; i++) swap(T[2][i], T[3][i]);
|
||||
if(DIM == 3) {
|
||||
for(int i=0; i<4; i++) T[i][0] = T[0][i] = 0;
|
||||
T[2][2] = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
transmatrix parabolic1(ld u) {
|
||||
if(euclid)
|
||||
return ypush(u);
|
||||
|
Loading…
x
Reference in New Issue
Block a user