From 2f954d05387a7621b0378c95e46130a8e61fb506 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 22 Aug 2019 11:24:25 +0200 Subject: [PATCH] nicer handling of WDIM, GDIM, MDIM, sig --- classes.cpp | 122 ++++++++++++++++++++++++++--------------------- classes.h | 16 ++++++- config.cpp | 1 + floorshapes.cpp | 2 + geometry.cpp | 22 +++++++++ hud.cpp | 1 + hyper.h | 11 ++--- hyperpoint.cpp | 2 +- mapeditor.cpp | 2 +- nonisotropic.cpp | 3 ++ 10 files changed, 117 insertions(+), 65 deletions(-) diff --git a/classes.cpp b/classes.cpp index b86335cc..fad22cc3 100644 --- a/classes.cpp +++ b/classes.cpp @@ -515,63 +515,75 @@ static const flagtype qsSMALLBF = qsSMALLB | qsFIELD; static const flagtype qsSMALLBE = qsSMALLB | qELLIPTIC; static const flagtype qsBP = qBINARY | qPENROSE; +geometryinfo1 giEuclid2 = { gcEuclid, 2, 2, 3, {1,1, 0,0 } }; +geometryinfo1 giHyperb2 = { gcHyperbolic, 2, 2, 3, {1,1,-1,0 } }; +geometryinfo1 giSphere2 = { gcSphere, 2, 2, 3, {1,1,+1,0 } }; + +geometryinfo1 giEuclid3 = { gcEuclid, 3, 3, 4, {1,1, 1,0 } }; +geometryinfo1 giHyperb3 = { gcHyperbolic, 3, 3, 4, {1,1, 1,-1} }; +geometryinfo1 giSphere3 = { gcSphere, 3, 3, 4, {1,1, 1,+1} }; + +geometryinfo1 giSol = { gcSol, 3, 3, 4, {1,1, 1,0 } }; +geometryinfo1 giNil = { gcNil, 3, 3, 4, {1,1, 1,0 } }; +geometryinfo1 giProduct = { /* will be filled in product::configure() */ }; + /** list of available geometries */ vector ginf = { - {"{7,3}", "none", "{7,3} (standard HyperRogue map)", "HR", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::bitruncated}, - {"{6,3}", "none", "{6,3} (euclidean Hex grid)", "euclid", 6, 3, 0, gcEuclid, 0, {{7, FORBIDDEN}}, eVariation::bitruncated}, - {"{5,3}", "none", "{5,3} (dodecahedron)", "sphere", 5, 3, qsSMALLB, gcSphere, 0, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, - {"{5,3}", "elliptic", "elliptic geometry in {5,3}", "elliptic", 5, 3, qsNONORE, gcSphere, 0, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, - {"{7,3}", "Zebra", "Zebra quotient", "Zebra", 7, 3, qsZEBRA, gcHyperbolic, 0x00400, {{7, 5}}, eVariation::bitruncated}, - {"{7,3}", "field", "field quotient", "field", 7, 3, qsFIELD, gcHyperbolic, 0x00200, {{7, 5}}, eVariation::bitruncated}, - {"{6,3}", "torus", "torus/Klein bottle/...", "torus", 6, 3, qsBQ, gcEuclid, 0x00600, {{7, 7}}, eVariation::bitruncated}, - {"{8,3}", "none", "{8,3} (like standard but with octagons)", "oct", 8, 3, 0, gcHyperbolic, 0x08000, {{6, 4}}, eVariation::bitruncated}, - {"{5,4}", "none", "{5,4} (four pentagons)", "4x5", 5, 4, 0, gcHyperbolic, 0x08200, {{6, 4}}, eVariation::bitruncated}, - {"{6,4}", "none", "{6,4} (four hexagons)", "4x6", 6, 4, 0, gcHyperbolic, 0x08400, {{5, 3}}, eVariation::bitruncated}, - {"{7,4}", "none", "{7,4} (four heptagons)", "4x7", 7, 4, 0, gcHyperbolic, 0x08600, {{4, 3}}, eVariation::bitruncated}, - {"{4,3}", "none", "{4,3} (cube)", "3x4", 4, 3, qsSMALLB, gcSphere, 0x10000, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, - {"{3,3}", "none", "{3,3} (tetrahedron)", "3x3", 3, 3, qsSMALLB, gcSphere, 0x10200, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, - {"{4,4}", "none", "{4,4} (Euclidean square grid)", "4x4", 4, 4, 0, gcEuclid, 0x10400, {{7, 7}}, eVariation::bitruncated}, - {"{4,3}", "elliptic", "elliptic geometry in {4,3}", "e3x4", 4, 3, qsNONORE, gcSphere, 0x10600, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, - {"{7,3}", "Klein", "Klein Quartic", "Klein", 7, 3, qsSMALL, gcHyperbolic, 0x18000, {{7, 5}}, eVariation::bitruncated}, - {"{8,3}", "Bolza", "Bolza Surface", "Bolza", 8, 3, qsDOCKS, gcHyperbolic, 0x18200, {{6, 4}}, eVariation::bitruncated}, - {"{8,3}", "Bolza2", "Bolza Surface x2", "Bolza2", 8, 3, qsDOCKS, gcHyperbolic, 0x18400, {{6, 4}}, eVariation::bitruncated}, - {"{7,3}", "minimal", "minimal quotient", "minimal", 7, 3, qsSMALLN, gcHyperbolic, 0x18600, {{7, 5}}, eVariation::bitruncated}, - {"binary","none", "variant of the binary tiling", "binary", 7, 3, qBINARY, gcHyperbolic, 0x48400, {{7, 5}}, eVariation::pure}, - {"Arch", "none", "Archimedean", "A", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::pure}, - {"{7,3}", "Macbeath", "Macbeath Surface", "Macbeath", 7, 3, qsSMALL, gcHyperbolic, 0x20000, {{7, 5}}, eVariation::bitruncated}, - {"{5,4}", "Bring", "Bring's Surface", "Bring", 5, 4, qsSMALL, gcHyperbolic, 0x20200, {{6, 4}}, eVariation::bitruncated}, - {"{12,3}","M3", "Schmutz's M(3)", "M3", 12, 3, qsSMALL, gcHyperbolic, 0x20400, {{4, 2}}, eVariation::bitruncated}, - {"{12,3}","M4", "Schmutz's M(4)", "M4", 12, 3, qsSMALL, gcHyperbolic, 0x20600, {{4, 2}}, eVariation::bitruncated}, - {"{6,4}", "Crystal", "dimensional crystal", "Crystal", 6, 4, qANYQ, gcHyperbolic, 0x28000, {{5, 3}}, eVariation::pure}, - {"{3,4}", "none", "{3,4} (octahedron)", "4x3", 3, 4, qsSMALLB, gcSphere, 0x28200, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, - {"bin{4,4}", "none", "{4,4} on horospheres", "bin44", 9, 3, qBINARY, gcHyperbolic, 0x30000, {{7, 3}}, eVariation::pure}, - {"{4,3,4}","none", "{4,3,4} cube tiling", "434", 6, 4, 0, gcEuclid, 0x30200, {{7, 5}}, eVariation::pure}, - {"{5,3,3}","none", "{5,3,3} 120-cell", "533", 12, 3, qsSMALLB, gcSphere, 0x30400, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{5,3,3}", "elliptic","{5,3,3} 120-cell (elliptic space)", "e533", 12, 3, qsSMALLBE, gcSphere, 0x30600, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"rh{4,3,4}","none", "rhombic dodecahedral honeycomb", "rh434", 12, 3, 0, gcEuclid, 0x31000, {{7, 5}}, eVariation::pure}, - {"2t{4,3,4}","none", "bitruncated cubic honeycomb", "2t434", 14, 3, 0, gcEuclid, 0x31200, {{7, 5}}, eVariation::pure}, - {"{5,3,4}","none", "{5,3,4} hyperbolic honeycomb", "534", 12, 4, 0, gcHyperbolic, 0x31400, {{7, 2}}, eVariation::pure}, - {"{4,3,5}","none", "{4,3,5} hyperbolic honeycomb", "435", 6, 5, 0, gcHyperbolic, 0x31600, {{7, 2}}, eVariation::pure}, - {"{3,3,3}","none", "{3,3,3} 5-cell", "333", 4, 3, qsSMALLB, gcSphere, 0x38000, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{3,3,4}","none", "{3,3,4} 16-cell", "334", 4, 4, qsSMALLB, gcSphere, 0x38200, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{3,3,4}","elliptic","{3,3,4} 16-cell (elliptic)", "e334", 4, 4, qsSMALLBE, gcSphere, 0x39200, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{4,3,3}","none", "{4,3,3} 8-cell", "433", 6, 4, qsSMALLB, gcSphere, 0x38400, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{4,3,3}","elliptic","{4,3,3} 8-cell (elliptic)", "e433", 6, 4, qsSMALLBE, gcSphere, 0x39400, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{3,4,3}","none", "{3,4,3} 24-cell", "343", 8, 3, qsSMALLB, gcSphere, 0x38600, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{3,4,3}","elliptic","{3,4,3} 24-cell (elliptic)", "e343", 8, 3, qsSMALLBE, gcSphere, 0x39600, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{3,3,5}","none", "{3,3,5} 600-cell", "335", 4, 3, qsSMALLB, gcSphere, 0x41000, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{3,3,5}","elliptic","{3,3,5} 600-cell (elliptic)", "e335", 4, 3, qsSMALLBE, gcSphere, 0x41200, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"bin{3,6}", "none", "{3,6} on horospheres", "bin36", 8, 3, qBINARY, gcHyperbolic, 0x40000, {{7, 3}}, eVariation::pure}, - {"bin-rect", "none", "rectangles on horospheres", "bin44/2", 7, 3, qBINARY, gcHyperbolic, 0x40200, {{7, 3}}, eVariation::pure}, - {"bin{6,3}", "none", "{6,3} on horospheres", "bin63", 14, 3, qBINARY, gcHyperbolic, 0x40400, {{7, 3}}, eVariation::pure}, - {"{4,3,5}","field", "{4,3,5} field quotient space", "f435", 6, 5, qsSMALLBF, gcHyperbolic, 0x40600, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"{5,3,4}","field", "{5,3,4} field quotient space", "f435", 12, 4, qsSMALLBF, gcHyperbolic, 0x40800, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, - {"binary4","none", "standard binary tiling", "binary4", 5, 3, qBINARY, gcHyperbolic, 0x41400, {{7, 5}}, eVariation::pure}, - {"sol", "none", "Solv geometry", "sol", 8, 3, qBINARY, gcSol, 0x41600, {{7, 5}}, eVariation::pure}, - {"kd2", "none", "kite-and-dart", "kd2", 4, 3, qPENROSE, gcEuclid, 0x48000, {{7, 7}}, eVariation::pure}, - {"kd3", "none", "kite-and-dart on horospheres", "kd3", 12, 3, qsBP, gcHyperbolic, 0x48200, {{7, 3}}, eVariation::pure}, - {"nil", "none", "Nil geometry", "nil", 8, 3, 0, gcNil, 0x48600, {{7, 5}}, eVariation::pure}, - {"product","none", "product space", "product", 7, 3, 0, gcProduct, 0x48400, {{7, 3}}, eVariation::pure}, + {"{7,3}", "none", "{7,3} (standard HyperRogue map)", "HR", 7, 3, 0, giHyperb2, 0, {{7, 5}}, eVariation::bitruncated}, + {"{6,3}", "none", "{6,3} (euclidean Hex grid)", "euclid", 6, 3, 0, giEuclid2, 0, {{7, FORBIDDEN}}, eVariation::bitruncated}, + {"{5,3}", "none", "{5,3} (dodecahedron)", "sphere", 5, 3, qsSMALLB, giSphere2, 0, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, + {"{5,3}", "elliptic", "elliptic geometry in {5,3}", "elliptic", 5, 3, qsNONORE, giSphere2, 0, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, + {"{7,3}", "Zebra", "Zebra quotient", "Zebra", 7, 3, qsZEBRA, giHyperb2, 0x00400, {{7, 5}}, eVariation::bitruncated}, + {"{7,3}", "field", "field quotient", "field", 7, 3, qsFIELD, giHyperb2, 0x00200, {{7, 5}}, eVariation::bitruncated}, + {"{6,3}", "torus", "torus/Klein bottle/...", "torus", 6, 3, qsBQ, giEuclid2, 0x00600, {{7, 7}}, eVariation::bitruncated}, + {"{8,3}", "none", "{8,3} (like standard but with octagons)", "oct", 8, 3, 0, giHyperb2, 0x08000, {{6, 4}}, eVariation::bitruncated}, + {"{5,4}", "none", "{5,4} (four pentagons)", "4x5", 5, 4, 0, giHyperb2, 0x08200, {{6, 4}}, eVariation::bitruncated}, + {"{6,4}", "none", "{6,4} (four hexagons)", "4x6", 6, 4, 0, giHyperb2, 0x08400, {{5, 3}}, eVariation::bitruncated}, + {"{7,4}", "none", "{7,4} (four heptagons)", "4x7", 7, 4, 0, giHyperb2, 0x08600, {{4, 3}}, eVariation::bitruncated}, + {"{4,3}", "none", "{4,3} (cube)", "3x4", 4, 3, qsSMALLB, giSphere2, 0x10000, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, + {"{3,3}", "none", "{3,3} (tetrahedron)", "3x3", 3, 3, qsSMALLB, giSphere2, 0x10200, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, + {"{4,4}", "none", "{4,4} (Euclidean square grid)", "4x4", 4, 4, 0, giEuclid2, 0x10400, {{7, 7}}, eVariation::bitruncated}, + {"{4,3}", "elliptic", "elliptic geometry in {4,3}", "e3x4", 4, 3, qsNONORE, giSphere2, 0x10600, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, + {"{7,3}", "Klein", "Klein Quartic", "Klein", 7, 3, qsSMALL, giHyperb2, 0x18000, {{7, 5}}, eVariation::bitruncated}, + {"{8,3}", "Bolza", "Bolza Surface", "Bolza", 8, 3, qsDOCKS, giHyperb2, 0x18200, {{6, 4}}, eVariation::bitruncated}, + {"{8,3}", "Bolza2", "Bolza Surface x2", "Bolza2", 8, 3, qsDOCKS, giHyperb2, 0x18400, {{6, 4}}, eVariation::bitruncated}, + {"{7,3}", "minimal", "minimal quotient", "minimal", 7, 3, qsSMALLN, giHyperb2, 0x18600, {{7, 5}}, eVariation::bitruncated}, + {"binary","none", "variant of the binary tiling", "binary", 7, 3, qBINARY, giHyperb2, 0x48400, {{7, 5}}, eVariation::pure}, + {"Arch", "none", "Archimedean", "A", 7, 3, 0, giHyperb2, 0, {{7, 5}}, eVariation::pure}, + {"{7,3}", "Macbeath", "Macbeath Surface", "Macbeath", 7, 3, qsSMALL, giHyperb2, 0x20000, {{7, 5}}, eVariation::bitruncated}, + {"{5,4}", "Bring", "Bring's Surface", "Bring", 5, 4, qsSMALL, giHyperb2, 0x20200, {{6, 4}}, eVariation::bitruncated}, + {"{12,3}","M3", "Schmutz's M(3)", "M3", 12, 3, qsSMALL, giHyperb2, 0x20400, {{4, 2}}, eVariation::bitruncated}, + {"{12,3}","M4", "Schmutz's M(4)", "M4", 12, 3, qsSMALL, giHyperb2, 0x20600, {{4, 2}}, eVariation::bitruncated}, + {"{6,4}", "Crystal", "dimensional crystal", "Crystal", 6, 4, qANYQ, giHyperb2, 0x28000, {{5, 3}}, eVariation::pure}, + {"{3,4}", "none", "{3,4} (octahedron)", "4x3", 3, 4, qsSMALLB, giSphere2, 0x28200, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, + {"bin{4,4}", "none", "{4,4} on horospheres", "bin44", 9, 3, qBINARY, giHyperb3, 0x30000, {{7, 3}}, eVariation::pure}, + {"{4,3,4}","none", "{4,3,4} cube tiling", "434", 6, 4, 0, giEuclid3, 0x30200, {{7, 5}}, eVariation::pure}, + {"{5,3,3}","none", "{5,3,3} 120-cell", "533", 12, 3, qsSMALLB, giSphere3, 0x30400, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{5,3,3}", "elliptic","{5,3,3} 120-cell (elliptic space)", "e533", 12, 3, qsSMALLBE, giSphere3, 0x30600, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"rh{4,3,4}","none", "rhombic dodecahedral honeycomb", "rh434", 12, 3, 0, giEuclid3, 0x31000, {{7, 5}}, eVariation::pure}, + {"2t{4,3,4}","none", "bitruncated cubic honeycomb", "2t434", 14, 3, 0, giEuclid3, 0x31200, {{7, 5}}, eVariation::pure}, + {"{5,3,4}","none", "{5,3,4} hyperbolic honeycomb", "534", 12, 4, 0, giHyperb3, 0x31400, {{7, 2}}, eVariation::pure}, + {"{4,3,5}","none", "{4,3,5} hyperbolic honeycomb", "435", 6, 5, 0, giHyperb3, 0x31600, {{7, 2}}, eVariation::pure}, + {"{3,3,3}","none", "{3,3,3} 5-cell", "333", 4, 3, qsSMALLB, giSphere3, 0x38000, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{3,3,4}","none", "{3,3,4} 16-cell", "334", 4, 4, qsSMALLB, giSphere3, 0x38200, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{3,3,4}","elliptic","{3,3,4} 16-cell (elliptic)", "e334", 4, 4, qsSMALLBE, giSphere3, 0x39200, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{4,3,3}","none", "{4,3,3} 8-cell", "433", 6, 4, qsSMALLB, giSphere3, 0x38400, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{4,3,3}","elliptic","{4,3,3} 8-cell (elliptic)", "e433", 6, 4, qsSMALLBE, giSphere3, 0x39400, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{3,4,3}","none", "{3,4,3} 24-cell", "343", 8, 3, qsSMALLB, giSphere3, 0x38600, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{3,4,3}","elliptic","{3,4,3} 24-cell (elliptic)", "e343", 8, 3, qsSMALLBE, giSphere3, 0x39600, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{3,3,5}","none", "{3,3,5} 600-cell", "335", 4, 3, qsSMALLB, giSphere3, 0x41000, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{3,3,5}","elliptic","{3,3,5} 600-cell (elliptic)", "e335", 4, 3, qsSMALLBE, giSphere3, 0x41200, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"bin{3,6}", "none", "{3,6} on horospheres", "bin36", 8, 3, qBINARY, giHyperb3, 0x40000, {{7, 3}}, eVariation::pure}, + {"bin-rect", "none", "rectangles on horospheres", "bin44/2", 7, 3, qBINARY, giHyperb3, 0x40200, {{7, 3}}, eVariation::pure}, + {"bin{6,3}", "none", "{6,3} on horospheres", "bin63", 14, 3, qBINARY, giHyperb3, 0x40400, {{7, 3}}, eVariation::pure}, + {"{4,3,5}","field", "{4,3,5} field quotient space", "f435", 6, 5, qsSMALLBF, giHyperb3, 0x40600, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"{5,3,4}","field", "{5,3,4} field quotient space", "f435", 12, 4, qsSMALLBF, giHyperb3, 0x40800, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, + {"binary4","none", "standard binary tiling", "binary4", 5, 3, qBINARY, giHyperb3, 0x41400, {{7, 5}}, eVariation::pure}, + {"sol", "none", "Solv geometry", "sol", 8, 3, qBINARY, giSol, 0x41600, {{7, 5}}, eVariation::pure}, + {"kd2", "none", "kite-and-dart", "kd2", 4, 3, qPENROSE, giEuclid2, 0x48000, {{7, 7}}, eVariation::pure}, + {"kd3", "none", "kite-and-dart on horospheres", "kd3", 12, 3, qsBP, giHyperb3, 0x48200, {{7, 3}}, eVariation::pure}, + {"nil", "none", "Nil geometry", "nil", 8, 3, 0, giNil, 0x48600, {{7, 5}}, eVariation::pure}, + {"product","none", "product space", "product", 7, 3, 0, giProduct, 0x48400, {{7, 3}}, eVariation::pure}, }; // bits: 9, 10, 15, 16, (reserved for later) 17, 18 diff --git a/classes.h b/classes.h index 9ba31d96..42d84d64 100644 --- a/classes.h +++ b/classes.h @@ -223,6 +223,20 @@ enum class eVariation { bitruncated, pure, goldberg, irregular, dual }; typedef flagtype modecode_t; +/** only the actual geometry */ +struct geometryinfo1 { + /** geometry class */ + eGeometryClass kind; + /** dimension of the gameplay (2 for crystal) */ + int gameplay_dimension; + /** dimension of the graphics, may be greater than gameplay_dimension with vid.always3 on */ + int graphical_dimension; + /** dimension of the homogeneous vector space used, usually graphical_dimension+1, but 3 in product */ + int homogeneous_dimension; + /** signature of the scalar product used */ + int sig[4]; + }; + struct geometryinfo { const char* tiling_name; const char* quotient_name; @@ -231,7 +245,7 @@ struct geometryinfo { int sides; int vertex; flagtype flags; - eGeometryClass cclass; + geometryinfo1 g; modecode_t xcode; std::array distlimit; // bitrunc, non-bitrunc eVariation default_variation; diff --git a/config.cpp b/config.cpp index efc0b3ed..1c14f137 100644 --- a/config.cpp +++ b/config.cpp @@ -779,6 +779,7 @@ EX void loadConfig() { DEBB(DF_INIT, ("Loaded configuration: %s\n", conffile)); } + geom3::apply_always3(); polygonal::solve(); check_cgi(); cgi.prepare_basics(); diff --git a/floorshapes.cpp b/floorshapes.cpp index 94542b6e..b02f90b2 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -1035,6 +1035,8 @@ EX void make_floor_textures() { dynamicval g(geometry, gEuclidSquare); dynamicval gm(pmodel, mdDisk); dynamicval va(variation, eVariation::pure); + dynamicval gie(ginf[geometry].g, giEuclid2); + dynamicval gih(ginf[gNormal].g, giHyperb2); dynamicval a3(vid.always3, false); dynamicval hq(inHighQual, true); dynamicval hd(darken, 0); diff --git a/geometry.cpp b/geometry.cpp index d44de350..e7422ac6 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -767,11 +767,31 @@ namespace geom3 { } EX namespace geom3 { + +EX void apply_always3() { + for(geometryinfo& gi: ginf) { + auto &g = gi.g; + if(vid.always3 && g.gameplay_dimension == 2 && g.graphical_dimension == 2) { + g.graphical_dimension++; + g.homogeneous_dimension++; + g.sig[3] = g.sig[2]; + g.sig[2] = g.sig[1]; + } + if(!vid.always3 && g.gameplay_dimension == 2 && g.graphical_dimension == 3) { + g.graphical_dimension--; + g.homogeneous_dimension--; + g.sig[1] = g.sig[2]; + g.sig[2] = g.sig[3]; + } + } + } + #if MAXMDIM >= 4 EX void switch_always3() { if(dual::split(switch_always3)) return; if(rug::rugged) rug::close(); vid.always3 = !vid.always3; + apply_always3(); swapmatrix(View); callhooks(hooks_swapdim); } @@ -806,6 +826,7 @@ EX void switch_always3() { View = inverse(models::rotmatrix()) * View; if(!vid.always3) { vid.always3 = true; + apply_always3(); ld ms = min(cgi.scalefactor, 1); vid.wall_height = 1.5 * ms; if(sphere) { @@ -827,6 +848,7 @@ EX void switch_always3() { } else { vid.always3 = false; + apply_always3(); vid.wall_height = .3; vid.human_wall_ratio = .7; vid.camera = 1; diff --git a/hud.cpp b/hud.cpp index 30672a74..8e450f49 100644 --- a/hud.cpp +++ b/hud.cpp @@ -390,6 +390,7 @@ EX void draw_radar(bool cornermode) { dynamicval g(geometry, gEuclid); dynamicval pm(pmodel, mdUnchanged); dynamicval ga(vid.always3, false); + dynamicval gi(ginf[gEuclid].g, giEuclid2); initquickqueue(); int rad = vid.radarsize; if(dual::state) rad /= 2; diff --git a/hyper.h b/hyper.h index 74558545..98f8ebdc 100644 --- a/hyper.h +++ b/hyper.h @@ -324,14 +324,11 @@ struct videopar { extern videopar vid; -#if MAXMDIM == 3 -#define WDIM 2 -#else -#define WDIM ((geometry >= gBinary3 && geometry != gBinary4 && geometry != gKiteDart2) ? 3 : 2) -#endif -#define GDIM (vid.always3 ? 3 : WDIM) -#define MDIM (prod ? 3 : GDIM+1) +#define WDIM ginf[geometry].g.gameplay_dimension +#define GDIM ginf[geometry].g.graphical_dimension +#define MDIM ginf[geometry].g.homogeneous_dimension #define LDIM (MDIM-1) +#define cclass g.kind #define self (*this) diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 9a41bb0e..b6faeb7c 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -171,7 +171,7 @@ ld inverse_tanh(ld x) { return log((1+x)/(1-x)) / 2; } */ EX ld squar(ld x) { return x*x; } -EX int sig(int z) { return prod ? PIU(sig(z)) : (sphere || sol || z a3(vid.always3, vid.always3); - if(f.vernum >= 0xA616) f.read(vid.always3); + if(f.vernum >= 0xA616) { f.read(vid.always3); geom3::apply_always3(); } if(f.vernum < 0xA61A) load_usershapes(f); diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 95455537..44e6c816 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -552,6 +552,7 @@ EX namespace product { EX geometry_information *underlying_cgip; void configure() { + if(vid.always3) { vid.always3 = false; geom3::apply_always3(); } check_cgi(); cgi.prepare_basics(); underlying = geometry; @@ -559,6 +560,8 @@ EX namespace product { geometry = gProduct; ginf[gProduct] = ginf[underlying]; ginf[gProduct].cclass = gcProduct; + ginf[gProduct].g.gameplay_dimension++; + ginf[gProduct].g.graphical_dimension++; } EX int current_view_level;