From 9c9b37f2fb49721d658876e26730cc044b9ca5b3 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 10 Feb 2025 19:01:23 +0100 Subject: [PATCH] rogueviz::ads:: main help, help for DS game --- rogueviz/ads/ads-game.cpp | 2 +- rogueviz/ads/control.cpp | 2 +- rogueviz/ads/ds-game.cpp | 12 ++++++++++++ rogueviz/ads/globals.cpp | 3 +++ rogueviz/ads/help.cpp | 14 +++++++++++++- 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/rogueviz/ads/ads-game.cpp b/rogueviz/ads/ads-game.cpp index 2548fc3f..64e0653d 100644 --- a/rogueviz/ads/ads-game.cpp +++ b/rogueviz/ads/ads-game.cpp @@ -89,7 +89,7 @@ void restart() { } void run_ads_game_hooks() { - rogueviz::rv_hook(hooks_global_mouseover, 100, ads_mouseover); + rogueviz::rv_hook(hooks_global_mouseover, 100, generate_mouseovers); rogueviz::rv_change(titlecolor, 0); rogueviz::rv_hook(hooks_frame, 100, view_ads_game); rogueviz::rv_hook(hooks_prestats, 100, display_rsrc); diff --git a/rogueviz/ads/control.cpp b/rogueviz/ads/control.cpp index db1fbae5..d50e1c4a 100644 --- a/rogueviz/ads/control.cpp +++ b/rogueviz/ads/control.cpp @@ -91,7 +91,7 @@ bool handleKey(int sym, int uni) { if(sym == 'v') pushScreen(game_menu); if(sym == SDLK_ESCAPE) pushScreen(game_menu); if(sym == SDLK_F1) { - if(help == "@") help = "help not known"; + if(help == "@") help = get_main_help(); gotoHelp(help); } return true; diff --git a/rogueviz/ads/ds-game.cpp b/rogueviz/ads/ds-game.cpp index 12497476..1f4f9ebc 100644 --- a/rogueviz/ads/ds-game.cpp +++ b/rogueviz/ads/ds-game.cpp @@ -501,6 +501,8 @@ bool invalid(cross_result& res) { void view_ds_game() { displayed.clear(); + mousetester = kleinize(unshift(mouseh)); + under_mouse.clear(); bool hv = hyperbolic; bool hvrel = among(pmodel, mdRelPerspective, mdRelOrthogonal); @@ -510,6 +512,8 @@ void view_ds_game() { copyright_shown = ""; if(!hv) draw_textures(); + bool only_main = false; + if(1) { for(auto& r: rocks) { auto& rock = *r; @@ -546,6 +550,12 @@ void view_ds_game() { vector circle_flat; for(auto c: rock.pts) circle_flat.push_back(c.h / (1 + c.h[2])); + + if(rock.type != oParticle && pointcrash(mousetester, rock.pts)) { + if(only_main) break; + if(&rock == main_rock) { under_mouse.clear(); only_main = true; } + under_mouse.push_back(&rock); + } ld area = 0; for(int i=0; i(titlecolor, 0xFFC000); } void run_ds_game() { diff --git a/rogueviz/ads/globals.cpp b/rogueviz/ads/globals.cpp index 3a540860..d511ccab 100644 --- a/rogueviz/ads/globals.cpp +++ b/rogueviz/ads/globals.cpp @@ -247,4 +247,7 @@ void save_to_hiscores(); void hiscore_menu(); void load_hiscores(); +string get_main_help(); +int generate_mouseovers(); + }} diff --git a/rogueviz/ads/help.cpp b/rogueviz/ads/help.cpp index cb5bbbce..b1323ee4 100644 --- a/rogueviz/ads/help.cpp +++ b/rogueviz/ads/help.cpp @@ -101,7 +101,7 @@ void explain_undermouse() { } } -int ads_mouseover() { +int generate_mouseovers() { titlecolor = 0xFFFFFF; if(!paused) { @@ -115,6 +115,7 @@ int ads_mouseover() { hyperpoint h1 = normalize(unshift(mouseh)); hybrid::in_actual([&] { + if(main_rock) return; h1[3] = h1[2]; h1[2] = 0; ads_point rel = ads_inverse(current * vctrV) * ads_point(h1, 0); cell *c = hybrid::get_at(vctr, 0); @@ -142,5 +143,16 @@ int ads_mouseover() { return 3; } +string get_main_help() { + if(main_rock) + return + "Keep close to the yellow star! The space is expanding, so if you go too far away from it, you will never be able to get back.\n\n" + "You have to avoid (or shoot) the white asteroids which are continuously thrown at you. In longer runs, you also need to catch items to replenish your resources.\n\n" + "Good luck!\n\nSee the Guided Tour for more explanation about how de Sitter spacetime used in this game works."; + else return + "Explore the world, shoot asteroids and enemies, collect treasures and resources. The more treasures you collect, the harder the game becomes. Good luck!\n\n" + "See the Guided Tour for more explanation about how anti-de Sitter spacetime used in this game works."; + } + } }