From 9c501642c56b6200fabddc92f85797a35513fdc3 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 12 Jun 2018 21:16:52 +0200 Subject: [PATCH] added the Banach-Tarski vis to the RogueViz presentation --- changelog.txt | 17 ++++++++++++++++ rogueviz-banachtarski.cpp | 42 ++++++++++++++++++++++++++------------- rogueviz-kohonen.cpp | 18 +++++++++-------- rogueviz.cpp | 34 +++++++++++++++++++++++++++++++ rogueviz.h | 8 ++++++++ 5 files changed, 97 insertions(+), 22 deletions(-) diff --git a/changelog.txt b/changelog.txt index 7b1656f1..7d93d1c8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2468,3 +2468,20 @@ non-game: 2018.05.27 01:21 Update 10.4a: - Strange Challenge should exit correctly. - rules are described better in other geometries + +2018.06.12 XX:XX Update 10.4b: +- Orb of Love does not give the 30$$$ bonus in the Strange Challenge -- this is now made clearer (the displayed score no longer includes this 30$$$, and a help text for Orb of Love is added). +- a flat torus can be embedded in S^3 -- HyperRogue now knows about this when rendering torus in the Hypersian Rug mode in the spherical native geometry +- it was possible to get another chance in the Strange Challenge by pressing ESC in specific circumstances -- this should be fixed. +- fixed some issues with adjacency taken into account incorrectly with Hedgehogs/Flailguards/Pikemen and Warp/halfvines +- orb of Horns, and other cases caring about opposite cells, should now work correctly in nonstandard geometries +- marked Orb of Lava as useless in the Haunted Woods +- fixed the Earth Elementals falling/dying in Red Rock Valley +- Orb of Recall no longer creates holes in the Yendorian Forest +- fixed a bug which caused forgetting the PTM game when 'reseting special modes' +- added the 'Banach-Tarski-like' visualization to RogueViz +- faster drawing of convex shapes in the online version +- translation updated, fixed some player gender directives in Russian +- torus rendering no longer creates darker areas because of the side difference +- fixed the non-3D display of rock formations in Goldberg geometries +- Hunter dogs (guarding/regrouping) and sometimes Ice Wolves no longer count as a different kill type (not counted in total kills) diff --git a/rogueviz-banachtarski.cpp b/rogueviz-banachtarski.cpp index 928dd3a6..ecbc9a5c 100644 --- a/rogueviz-banachtarski.cpp +++ b/rogueviz-banachtarski.cpp @@ -313,6 +313,8 @@ void bantar_frame() { stereo::set_projection(0); vector subscr[4]; + + compute_graphical_distance(); const int tmax = 2000; int t = ticks % (5*tmax); @@ -396,7 +398,7 @@ void bantar_frame() { drawrec(viewctr, hsOrigin, cview()); if(0) for(auto p: parent) if(gmatrix.count(p.first) && gmatrix.count(p.second) && infos[p.first].gid == i && infos[p.second].gid == i) queueline(tC0(gmatrix[p.first]), tC0(gmatrix[p.second]), 0xFFFFFFFF, 2); - subscr[i] = ptds; + subscr[i] = move(ptds); } map>> xptds; @@ -426,15 +428,23 @@ void bantar_frame() { void bantar_anim() { vid.aurastr = 0; - while(!quitmainloop) { - ticks = SDL_GetTicks(); + bool breakanim = false; + int t = SDL_GetTicks(); + drawthemap(); + while(!breakanim) { + ticks = SDL_GetTicks() - t; bantar_frame(); SDL_GL_SwapBuffers(); SDL_Event ev; - while(SDL_PollEvent(&ev)) handle_event(ev); + while(SDL_PollEvent(&ev)) + if(ev.type == SDL_KEYDOWN || ev.type == SDL_MOUSEBUTTONDOWN) + breakanim = true; } + mapeditor::drawplayer = true; + vid.xposition = vid.yposition = 0; + vid.scale = 1; } bool bmap; @@ -465,6 +475,19 @@ void init_bantar() { start_game(); } } + +void init_bantar_map() { + bmap = true; + ForInfos { + int hsh = 0x202047; + for(int w: cci.second.way) hsh = (11301 * hsh + w * 37121) & 0x7F7F7F; + cci.second.c->landparam = hsh; + cci.second.c->land = laCanvas; + cci.second.c->wall = waNone; + cci.second.c->item = itNone; + cci.second.c->monst = moNone; + } + } int readArgs() { using namespace arg; @@ -496,16 +519,7 @@ int readArgs() { } else if(argis("-bantar_map")) { init_bantar(); - bmap = true; - ForInfos { - int hsh = 0x202047; - for(int w: cci.second.way) hsh = (11301 * hsh + w * 37121) & 0x7F7F7F; - cci.second.c->landparam = hsh; - cci.second.c->land = laCanvas; - cci.second.c->wall = waNone; - cci.second.c->item = itNone; - cci.second.c->monst = moNone; - } + init_bantar_map(); } else if(argis("-btry")) { shift(); notry = argi(); diff --git a/rogueviz-kohonen.cpp b/rogueviz-kohonen.cpp index 256186f2..afb284d8 100644 --- a/rogueviz-kohonen.cpp +++ b/rogueviz-kohonen.cpp @@ -1123,12 +1123,14 @@ auto hooks = addHook(hooks_args, 100, readArgs); #endif auto hooks2 = addHook(hooks_frame, 50, levelline::draw); -} +}} + +namespace rogueviz { + void mark(cell *c) { + using namespace kohonen; + if(kind == kKohonen && inited >= 1) { + distfrom = getNeuronSlow(c); + coloring(); + } + }} -void rogueviz::mark(cell *c) { - using namespace kohonen; - if(kind == kKohonen && inited >= 1) { - distfrom = getNeuronSlow(c); - coloring(); - } - }} diff --git a/rogueviz.cpp b/rogueviz.cpp index 9ce6cfba..5ecb97a7 100644 --- a/rogueviz.cpp +++ b/rogueviz.cpp @@ -1802,6 +1802,40 @@ slide rvslides[] = { slidecommand = "staircase menu"; if(mode == 4) pushScreen(staircase::showMenu); }}, + {"Banach-Tarski-like", 62, LEGAL_NONE, + "Banach-Tarski-like decomposition. Break a hyperbolic plane into two hyperbolic planes.\n\n" + "Press '5' to show the decomposition. Press any key to stop.\n\n" + "You will see a map of the decomposition. Press '5' again to return.", + + [] (presmode mode) { + slidecommand = "staircase menu"; + if(mode == 3) { + while(gamestack::pushed()) pop_game(); + banachtarski::bmap = false; + banachtarski::on = false; + } + if(mode == 4) { + if(!banachtarski::on) { + bool b = mapeditor::drawplayer; + specialland = cwt.c->land; + push_game(); + banachtarski::init_bantar(); + airmap.clear(); + dynamicval vs(sightrange_bonus, 3); + dynamicval vg(genrange_bonus, 3); + doOvergenerate(); + banachtarski::bantar_anim(); + quitmainloop = false; + mapeditor::drawplayer = b; + banachtarski::init_bantar_map(); + } + else if(banachtarski::on && banachtarski::bmap) { + banachtarski::bmap = false; + banachtarski::on = false; + pop_game(); + } + } + }}, {"THE END", 99, LEGAL_ANY | FINALSLIDE, "Press '5' to leave the presentation.", [] (presmode mode) { diff --git a/rogueviz.h b/rogueviz.h index 1419f446..a2a9d400 100644 --- a/rogueviz.h +++ b/rogueviz.h @@ -87,5 +87,13 @@ namespace rogueviz { void showMenu(); void make_staircase(); } + + namespace banachtarski { + extern bool on; + void init_bantar(); + void bantar_anim(); + extern bool bmap; + extern void init_bantar_map(); + } }