From 8fcabb0fde14dd73215946ff43047b6d4f8b15aa Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 17 Nov 2024 14:19:10 +0100 Subject: [PATCH] rogueviz:: intra-demos now use the new quickkey system --- rogueviz/intra-demos.cpp | 114 ++++++++++++++------------------------- 1 file changed, 40 insertions(+), 74 deletions(-) diff --git a/rogueviz/intra-demos.cpp b/rogueviz/intra-demos.cpp index 04aed4d1..92e74300 100644 --- a/rogueviz/intra-demos.cpp +++ b/rogueviz/intra-demos.cpp @@ -452,80 +452,45 @@ void create_intra_sol() { map starter; -bool vr_keys(int sym, int uni) { +void vrqm_ext() { if(intra::in && !starter.count(intra::current)) starter[intra::current] = cwt.at; - const Uint8 *keystate = SDL12_GetKeyState(NULL); - #if CAP_SDL2 - if(keystate[SDL_SCANCODE_LALT] || keystate[SDL_SCANCODE_RALT]) - #else - if(keystate[SDLK_LALT] || keystate[SDLK_RALT]) - #endif - { - if(sym == 'e' && intra::in) { - println(hlog, "intra::current = ", intra::current); - intra::switch_to(2); - if(starter.count(intra::current)) cwt.at = centerover = starter[intra::current]; - fullcenter(); - View = cspin90(0, 1); - playermoved = false; - walking::handle(); - return true; - } - if(sym == 'h' && intra::in) { - intra::switch_to(0); - if(starter.count(intra::current)) cwt.at = centerover = starter[intra::current]; - fullcenter(); - View = cspin90(0, 1); - playermoved = false; - walking::handle(); - return true; - } - if(sym == 's' && intra::in) { - intra::switch_to(6); - if(starter.count(intra::current)) cwt.at = centerover = starter[intra::current]; - fullcenter(); - View = cspin90(0, 1); - playermoved = false; - walking::handle(); - return true; - } - if(sym == ',') { - camera_speed *= 1.2; - println(hlog, "camera_speed set to ", camera_speed); - return true; - } - if(sym == '.') { - camera_speed /= 1.2; - println(hlog, "camera_speed set to ", camera_speed); - return true; - } - #if CAP_VR - if(sym == 'a') { - vrhr::absolute_unit_in_meters *= 1.2; - walking::eye_level *= 1.2; - println(hlog, "vr absolute unit set to ", vrhr::absolute_unit_in_meters); - return true; - } - if(sym == 'z') { - vrhr::absolute_unit_in_meters /= 1.2; - walking::eye_level /= 1.2; - println(hlog, "vr absolute unit set to ", vrhr::absolute_unit_in_meters); - return true; - } - #endif - if(sym == 'w') { - walking::switch_walking(); - println(hlog, "walking set to ", ONOFF(walking::on)); - return true; - } - #if CAP_VR - if(sym == 'x') { - vrhr::always_show_hud = false; - return true; - } - #endif - } - return false; + dialog::addItem("move to Euclidean", 'e'); + dialog::add_action([] { + println(hlog, "intra::current = ", intra::current); + intra::switch_to(2); + if(starter.count(intra::current)) cwt.at = centerover = starter[intra::current]; + fullcenter(); + View = cspin90(0, 1); + playermoved = false; + walking::handle(); + }); + dialog::addItem("move to hyperbolic", 'h'); + dialog::add_action([] { + intra::switch_to(0); + if(starter.count(intra::current)) cwt.at = centerover = starter[intra::current]; + fullcenter(); + View = cspin90(0, 1); + playermoved = false; + walking::handle(); + }); + dialog::addItem("move to spherical", 's'); + dialog::add_action([] { + intra::switch_to(6); + if(starter.count(intra::current)) cwt.at = centerover = starter[intra::current]; + fullcenter(); + View = cspin90(0, 1); + playermoved = false; + walking::handle(); + }); + dialog::addItem("move to Solv", 'y'); + dialog::add_action([] { + intra::switch_to(3); + if(starter.count(intra::current)) cwt.at = centerover = starter[intra::current]; + fullcenter(); + View = cspin90(0, 1); + playermoved = false; + walking::handle(); + }); } // all generators will add to the current scene @@ -551,6 +516,7 @@ auto hooks = // generate Sol with floors to the current scene, runs autimatically + arg::add3("-intra-sol", create_intra_sol) //+ arg::add3("-intra-more", create_intra_more); ++ arg::add3("-fnkeys-portals", [] { rogueviz::rv_hook(vrhr::vr_quickmenu_extensions, 101, vrqm_ext); }) + arg::add3("-intra-demo-floors", [] { walking::colors_of_floors = { 0xFFFF40, 0xD0D000, @@ -582,7 +548,7 @@ auto hooks = slide_backup(vrhr::cscr, vrhr::eCompScreen::eyes); ) starter.clear(); - rogueviz::rv_hook(hooks_handleKey, 101, vr_keys); + rogueviz::rv_hook(vrhr::vr_quickmenu_extensions, 101, vrqm_ext); popScreenAll(); resetGL(); };