Advertisement
dominus

Untitled

Dec 19th, 2016
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.37 KB | None | 0 0
  1. diff --git a/data/bg/defaultkeys.txt b/data/bg/defaultkeys.txt
  2. index 6a6d7ed..c79f4b2 100644
  3. --- a/data/bg/defaultkeys.txt
  4. +++ b/data/bg/defaultkeys.txt
  5. @@ -1,5 +1,7 @@
  6.  # default key bindings
  7.  
  8. +Alt-KP+        scaleval_increase
  9. +Alt-KP-    scaleval_decrease
  10.  KP+        brighter
  11.  KP-        darker
  12.  Esc        close_or_menu
  13. diff --git a/data/si/defaultkeys.txt b/data/si/defaultkeys.txt
  14. index 7551be8..faf8fe6 100644
  15. --- a/data/si/defaultkeys.txt
  16. +++ b/data/si/defaultkeys.txt
  17. @@ -1,5 +1,7 @@
  18.  # default key bindings
  19.  
  20. +Alt-KP+        scaleval_increase
  21. +Alt-KP-    scaleval_decrease
  22.  KP+        brighter
  23.  KP-        darker
  24.  Esc        close_or_menu
  25. diff --git a/exult.cc b/exult.cc
  26. index 2519247..f7bd05e 100644
  27. --- a/exult.cc
  28. +++ b/exult.cc
  29. @@ -209,6 +209,9 @@ struct resolution {
  30.  };
  31.  int num_res = sizeof(res_list) / sizeof(struct resolution);
  32.  int current_res = 0;
  33. +#ifdef USE_EXULTSTUDIO
  34. +int current_scaleval = 1;
  35. +#endif
  36.  
  37.  #ifdef XWIN
  38.  #  ifdef __GNUC__
  39. @@ -243,6 +246,7 @@ static int Play();
  40.  static int Get_click(int &x, int &y, char *chr, bool drag_ok, Paintable *p, bool rotate_colors = false);
  41.  static int find_resolution(int w, int h, int s);
  42.  #ifdef USE_EXULTSTUDIO
  43. +static void set_scaleval(int new_scaleval);
  44.  static void Move_dragged_shape(int shape, int frame, int x, int y,
  45.                                 int prevx, int prevy, bool show);
  46.  static void Move_dragged_combo(int xtiles, int ytiles, int tiles_right,
  47. @@ -2229,6 +2233,52 @@ int find_resolution(int w, int h, int s) {
  48.     return res;
  49.  }
  50.  
  51. +#ifdef USE_EXULTSTUDIO
  52. +void increase_scaleval() {
  53. +   if (!cheat()) return;
  54. +  
  55. +   current_scaleval++;
  56. +   if (current_scaleval >= 9)
  57. +       current_scaleval = 1;
  58. +   set_scaleval(current_scaleval);
  59. +}
  60. +
  61. +void decrease_scaleval() {
  62. +   if (!cheat()) return;
  63. +
  64. +   current_scaleval--;
  65. +   if (current_scaleval < 1)
  66. +       current_scaleval = 8;
  67. +   set_scaleval(current_scaleval);
  68. +}
  69. +
  70. +void set_scaleval(int new_scaleval) {
  71. +   int scaler = gwin->get_win()->get_scaler();
  72. +  
  73. +   if (new_scaleval >= 1 && scaler == Image_window::point && cheat.in_map_editor()) {
  74. +       current_scaleval = new_scaleval;
  75. +       bool fullscreen = gwin->get_win()->is_fullscreen();
  76. +       bool share_settings;
  77. +       config->value("config/video/share_video_settings", share_settings, true);
  78. +       const string &vidStr = (fullscreen || share_settings) ?
  79. +                              "config/video" : "config/video/window";
  80. +       int resx, resy;
  81. +       config->value(vidStr + "/display/width", resx);
  82. +       config->value(vidStr + "/display/height", resy);
  83. +
  84. +       // for Studio zooming we set game area to auto, fill quality to point,
  85. +       // fill mode to fill and increase/decrease the scale value
  86. +       gwin->resized(resx,
  87. +                     resy,
  88. +                     fullscreen,
  89. +                     0, 0,
  90. +                     current_scaleval, scaler,
  91. +                     Image_window::Fill,
  92. +                     Image_window::point);
  93. +   }
  94. +}
  95. +#endif
  96. +
  97.  void make_screenshot(bool silent) {
  98.     // TODO: Maybe use <SAVEGAME>/exult%03i.pcx instead.
  99.     // Or maybe some form or "My Pictures" on Windows.
  100. diff --git a/exult.h b/exult.h
  101. index f3c879d..111f916 100644
  102. --- a/exult.h
  103. +++ b/exult.h
  104. @@ -66,6 +66,10 @@ extern void Wait_for_arrival(
  105.  );
  106.  
  107.  extern void change_gamma(bool down);
  108. +#ifdef USE_EXULTSTUDIO
  109. +extern void increase_scaleval();
  110. +extern void decrease_scaleval();
  111. +#endif
  112.  extern void setup_video(bool fullscreen, int setup_video_type,
  113.                          int resx = 0, int resy = 0, int gw = 0,
  114.                          int gh = 0, int scaleval = 0, int scaler = 0,
  115. diff --git a/keyactions.cc b/keyactions.cc
  116. index 9b4b4ec..ddb820f 100644
  117. --- a/keyactions.cc
  118. +++ b/keyactions.cc
  119. @@ -247,6 +247,20 @@ void ActionRepaint(int const *params) {
  120.     Game_window::get_instance()->paint();
  121.  }
  122.  
  123. +#ifdef USE_EXULTSTUDIO
  124. +//  { ActionScalevalIncrease, 0, "Increase scaleval", cheat_keys, NONE },
  125. +void ActionScalevalIncrease(int const *params) {
  126. +   ignore_unused_variable_warning(params);
  127. +   increase_scaleval();
  128. +}
  129. +
  130. +//  { ActionScalevalDecrease, 0, "Decrease scaleval", cheat_keys, NONE },
  131. +void ActionScalevalDecrease(int const *params) {
  132. +   ignore_unused_variable_warning(params);
  133. +   decrease_scaleval();
  134. +}
  135. +#endif
  136. +
  137.  //  { ActionBrighter, 0, "Increase brightness", normal_keys, NONE },
  138.  void ActionBrighter(int const *params) {
  139.     ignore_unused_variable_warning(params);
  140. diff --git a/keyactions.h b/keyactions.h
  141. index d275c24..ce16757 100644
  142. --- a/keyactions.h
  143. +++ b/keyactions.h
  144. @@ -38,6 +38,10 @@ void ActionKeyboardMode(int const *params);
  145.  
  146.  void ActionScreenshot(int const *params);
  147.  void ActionRepaint(int const *params);
  148. +#ifdef USE_EXULTSTUDIO
  149. +void ActionScalevalIncrease(int const *params);
  150. +void ActionScalevalDecrease(int const *params);
  151. +#endif
  152.  void ActionBrighter(int const *params);
  153.  void ActionDarker(int const *params);
  154.  void ActionFullscreen(int const *params);
  155. diff --git a/keys.cc b/keys.cc
  156. index df4799c..b33b090 100644
  157. --- a/keys.cc
  158. +++ b/keys.cc
  159. @@ -108,6 +108,16 @@ const struct Action {
  160.  #endif
  161.  
  162.     {
  163. +#ifdef USE_EXULTSTUDIO
  164. +       "SCALEVAL_INCREASE",
  165. +       ActionScalevalIncrease, 0, "Increase scaleval", Action::cheat_keys, NONE, true, true, true, false //mapedit_keys
  166. +   },
  167. +   {
  168. +       "SCALEVAL_DECREASE",
  169. +       ActionScalevalDecrease, 0, "Decrease scaleval", Action::cheat_keys, NONE, true, true, true, false
  170. +   },
  171. +   {
  172. +#endif
  173.         "BRIGHTER",
  174.         ActionBrighter, 0, "Increase brightness", Action::normal_keys, NONE, true, true, true, false
  175.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement