Advertisement
dominus

Untitled

May 29th, 2025
639
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.67 KB | None | 0 0
  1. diff --git a/gamemgr/bggame.cc b/gamemgr/bggame.cc
  2. index 99ea0a8cf..d3e916414 100644
  3. --- a/gamemgr/bggame.cc
  4. +++ b/gamemgr/bggame.cc
  5. @@ -42,6 +42,7 @@
  6.  #include "mappatch.h"
  7.  #include "miscinf.h"
  8.  #include "modmgr.h"
  9. +#include "mouse.h"
  10.  #include "palette.h"
  11.  #include "shapeid.h"
  12.  #include "touchui.h"
  13. @@ -2182,6 +2183,13 @@ bool BG_Game::new_game(Vga_file& shapes) {
  14.     const int             menuy = topy + 110;
  15.     std::shared_ptr<Font> font  = fontManager.get_font("MENU_FONT");
  16.  
  17. +   IExultDataSource      mouse_data(MAINSHP_FLX, PATCH_MAINSHP, 19);
  18. +   newgame_mouse = new Mouse(gwin, mouse_data);
  19. +   Mouse::mouse  = newgame_mouse;
  20. +   if (newgame_mouse
  21. +       && !Mouse::use_touch_input) {    // If not primarily touch input
  22. +       newgame_mouse->show();    // Attempt to make the mouse visible initially
  23. +   }
  24.     Vga_file faces_vga;
  25.     // Need to know if SI is installed
  26.     const bool si_installed
  27. @@ -2242,6 +2250,7 @@ bool BG_Game::new_game(Vga_file& shapes) {
  28.     do {
  29.         Delay();
  30.         if (redraw) {
  31. +           Mouse::mouse->hide();
  32.             gwin->clear_screen();
  33.             sman->paint_shape(
  34.                     topx, topy, shapes.get_shape(0x2, 0), false,
  35. @@ -2282,8 +2291,13 @@ bool BG_Game::new_game(Vga_file& shapes) {
  36.             }
  37.             font->draw_text(
  38.                     ibuf, topx + 60, menuy + 10, disp_name, transto.data());
  39. +           Mouse::mouse->show();
  40.             gwin->get_win()->ShowFillGuardBand();
  41.             redraw = false;
  42. +       } else {
  43. +           if (Mouse::mouse && Mouse::mouse->is_onscreen()) {
  44. +               gwin->get_win()->ShowFillGuardBand();
  45. +           }
  46.         }
  47.         SDL_Renderer* renderer
  48.                 = SDL_GetRenderer(gwin->get_win()->get_screen_window());
  49. @@ -2292,6 +2306,18 @@ bool BG_Game::new_game(Vga_file& shapes) {
  50.             Uint16 keysym_unicode = 0;
  51.             bool   isTextInput    = false;
  52.             SDL_ConvertEventToRenderCoordinates(renderer, &event);
  53. +
  54. +           if (event.type == SDL_EVENT_MOUSE_MOTION) {
  55. +               int mx ;
  56. +               int my;
  57. +               gwin->get_win()->screen_to_game(
  58. +               event.motion.x, event.motion.y, gwin->get_fastmouse(), mx, my);
  59. +               Mouse::mouse->hide();
  60. +               Mouse::mouse->move(mx, my);
  61. +               Mouse::mouse_update = true;
  62. +               Mouse::mouse->show();
  63. +           }
  64. +
  65.             if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN
  66.                 || event.type == SDL_EVENT_MOUSE_BUTTON_UP) {
  67.                 const SDL_Rect rectName   = {topx + 10, menuy + 10, 130, 16};
  68. diff --git a/gamemgr/bggame.h b/gamemgr/bggame.h
  69. index 14938742b..8a4d1439a 100644
  70. --- a/gamemgr/bggame.h
  71. +++ b/gamemgr/bggame.h
  72. @@ -22,6 +22,7 @@
  73.  #include "game.h"
  74.  
  75.  struct File_spec;
  76. +class Mouse;
  77.  
  78.  class BG_Game : public Game {
  79.  public:
  80. @@ -55,6 +56,7 @@ class BG_Game : public Game {
  81.     void scene_guardian();
  82.     void scene_desk();
  83.     void scene_moongate();
  84. +   Mouse*              newgame_mouse;
  85.  };
  86.  
  87.  #endif
  88.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement