From 522436ba96b0186cc4b3d44f425985260e66a7f4 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 8 Aug 2023 12:05:18 +0200 Subject: [PATCH] ads:: more solid lps use --- rogueviz/ads/ads-game.cpp | 32 +++++++++++++++++++++++++++++++- rogueviz/ads/ds-game.cpp | 6 +++++- rogueviz/ads/globals.cpp | 2 +- rogueviz/ads/views.cpp | 19 ++++--------------- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/rogueviz/ads/ads-game.cpp b/rogueviz/ads/ads-game.cpp index 5a1b131c..42f97178 100644 --- a/rogueviz/ads/ads-game.cpp +++ b/rogueviz/ads/ads-game.cpp @@ -128,15 +128,26 @@ void run_ads_game() { cwt.at = centerover = currentmap->gamestart(); restart(); + + rogueviz::on_cleanup_or_next([] { + switch_spacetime_to(true); + }); } local_parameter_set lps_relhell("relhell:"); +local_parameter_set lps_relhell_space("relhell:space:", &lps_relhell); +local_parameter_set lps_relhell_ds_spacetime("relhell:ds:", &lps_relhell); +local_parameter_set lps_relhell_ads_spacetime("relhell:ads:", &lps_relhell); +local_parameter_set lps_relhell_ds_spacetime_klein("relhell:ads:klein:", &lps_relhell_ds_spacetime); +local_parameter_set lps_relhell_ds_spacetime_pers("relhell:ads:pers:", &lps_relhell_ds_spacetime); + void default_settings() { set_default_keys(); - lps_add_enum(lps_relhell, nohelp, 1); + lps_add(lps_relhell, nohelp, 1); lps_add(lps_relhell, nomenukey, true); + lps_add(lps_relhell, nomap, true); lps_add(lps_relhell, no_find_player, true); lps_add(lps_relhell, showstartmenu, false); lps_add(lps_relhell, mapeditor::drawplayer, false); @@ -145,6 +156,24 @@ void default_settings() { lps_add(lps_relhell, vid.axes3, false); lps_add(lps_relhell, patterns::whichCanvas, 'r'); lps_add(lps_relhell, patterns::rwalls, 0); + lps_add(lps_relhell, vid.fov, 150.); + + lps_add(lps_relhell_ds_spacetime_klein, pmodel, mdDisk); + + lps_add(lps_relhell_ds_spacetime_klein, pconf.alpha, 0.); + lps_add(lps_relhell_ds_spacetime_pers, pmodel, mdPerspective); + lps_add(lps_relhell_ds_spacetime, vid.grid, true); + lps_add(lps_relhell_ds_spacetime, stdgridcolor, 0xFFFFFFFF); + lps_add(lps_relhell_ds_spacetime, models::desitter_projections, true); + + lps_add(lps_relhell_space, pmodel, mdDisk); + lps_add(lps_relhell_space, pconf.scale, .95); + + lps_add(lps_relhell_ads_spacetime, pmodel, mdRelPerspective); + lps_add(lps_relhell_ads_spacetime, nonisotropic_weird_transforms, true); + lps_add(lps_relhell_ads_spacetime, vid.grid, false); + lps_add(lps_relhell_ads_spacetime, slr::range_xy, 2.); + lps_add(lps_relhell_ads_spacetime, slr::range_z, 2.); } void set_config() { @@ -156,6 +185,7 @@ void run_ads_game_std() { set_config(); set_geometry(gNormal); set_variation(eVariation::pure); + lps_enable(&lps_relhell_space); run_ads_game(); showstartmenu = false; } diff --git a/rogueviz/ads/ds-game.cpp b/rogueviz/ads/ds-game.cpp index e6975c8a..626faed2 100644 --- a/rogueviz/ads/ds-game.cpp +++ b/rogueviz/ads/ds-game.cpp @@ -735,10 +735,14 @@ void run_ds_game() { rogueviz::rv_hook(hooks_prestats, 100, display_rsrc); rogueviz::rv_hook(hooks_handleKey, 0, handleKey); rogueviz::rv_hook(anims::hooks_anim, 100, replay_animation); + + rogueviz::on_cleanup_or_next([] { + main_rock = nullptr; + }); } void run_ds_game_std() { - lps_enable(&lps_relhell); + lps_enable(&lps_relhell_space); enable_canvas(); run_ds_game(); } diff --git a/rogueviz/ads/globals.cpp b/rogueviz/ads/globals.cpp index 094eb44b..9cd626a8 100644 --- a/rogueviz/ads/globals.cpp +++ b/rogueviz/ads/globals.cpp @@ -113,7 +113,7 @@ ads_object *main_rock; extern string copyright_shown; -extern local_parameter_set lps_relhell; +extern local_parameter_set lps_relhell, lps_relhell_space, lps_relhell_ads_spacetime, lps_relhell_ds_spacetime_pers, lps_relhell_ds_spacetime_klein; int XSCALE = 48; int YSCALE = 48; diff --git a/rogueviz/ads/views.cpp b/rogueviz/ads/views.cpp index 695eef8b..19b1541f 100644 --- a/rogueviz/ads/views.cpp +++ b/rogueviz/ads/views.cpp @@ -45,27 +45,22 @@ void switch_spacetime() { geometry = gSpace435; variation = eVariation::pure; swap(currentmap, map_hyp); - pmodel = hv_klein ? mdDisk : mdPerspective; - if(hv_klein) pconf.alpha = 0; check_cgi(); cgi.require_basics(); cgi.use_count++; - vid.grid = true; stdgridcolor = 0xFFFFFFFF; initcells(); initgame(); - vid.fov = 150; - models::desitter_projections = true; + lps_enable(&(hv_klein ? lps_relhell_ds_spacetime_klein : lps_relhell_ds_spacetime_pers)); } else if(hyperbolic) { geometry = gSphere; variation = eVariation::bitruncated; swap(currentmap, map_hyp); - pmodel = mdDisk; - pconf.scale = .95; check_cgi(); + lps_enable(&lps_relhell_space); } } @@ -75,22 +70,16 @@ void switch_spacetime() { cgi.use_count++; if(hyperbolic) { hybrid::switch_to_actual(); - pmodel = mdRelPerspective; hyperpoint res; - nonisotropic_weird_transforms = true; NLP = Id; Duality = Id; for(int a=0; a<4; a++) for(int b=0; b<4; b++) Duality[a][b] = (a^2) == b; - vid.fov = 150; - vid.grid = false; - slr::range_xy = 2; - slr::range_z = 2; + lps_enable(&lps_relhell_ads_spacetime); } else if(mhybrid) { hybrid::switch_to_underlying(); - pmodel = mdDisk; - pconf.scale = .95; + lps_enable(&lps_relhell_space); } cgi.use_count++; }