Advertisement
dominus

Untitled

Dec 18th, 2016
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.11 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..14944a8 100644
  27. --- a/exult.cc
  28. +++ b/exult.cc
  29. @@ -209,6 +209,7 @@ struct resolution {
  30.  };
  31.  int num_res = sizeof(res_list) / sizeof(struct resolution);
  32.  int current_res = 0;
  33. +int current_scaleval = 1;
  34.  
  35.  #ifdef XWIN
  36.  #  ifdef __GNUC__
  37. @@ -242,6 +243,7 @@ static void Init();
  38.  static int Play();
  39.  static int Get_click(int &x, int &y, char *chr, bool drag_ok, Paintable *p, bool rotate_colors = false);
  40.  static int find_resolution(int w, int h, int s);
  41. +static void set_scaleval(int new_scaleval);
  42.  #ifdef USE_EXULTSTUDIO
  43.  static void Move_dragged_shape(int shape, int frame, int x, int y,
  44.                                 int prevx, int prevy, bool show);
  45. @@ -2229,6 +2231,51 @@ int find_resolution(int w, int h, int s) {
  46.     return res;
  47.  }
  48.  
  49. +void increase_scaleval() {
  50. +   if (!cheat()) return;
  51. +  
  52. +   current_scaleval++;
  53. +   if (current_scaleval >= 9)
  54. +       current_scaleval = 1;
  55. +   set_scaleval(current_scaleval);
  56. +}
  57. +
  58. +void decrease_scaleval() {
  59. +   if (!cheat()) return;
  60. +
  61. +   current_scaleval--;
  62. +   if (current_scaleval < 1)
  63. +       current_scaleval = 1;
  64. +   set_scaleval(current_scaleval);
  65. +}
  66. +
  67. +void set_scaleval(int new_scaleval) {
  68. +   int scaler = gwin->get_win()->get_scaler();
  69. +  
  70. +   if (new_scaleval >= 1 && scaler == Image_window::point && cheat.in_map_editor()) {
  71. +       current_scaleval = new_scaleval;
  72. +       bool fullscreen = gwin->get_win()->is_fullscreen();
  73. +       bool share_settings;
  74. +       config->value("config/video/share_video_settings", share_settings, true);
  75. +       const string &vidStr = (fullscreen || share_settings) ?
  76. +                              "config/video" : "config/video/window";
  77. +       int gw, gh;
  78. +       config->value(vidStr + "/game/width", gw);
  79. +       config->value(vidStr + "/game/height", gh);
  80. +       int resx, resy;
  81. +       config->value(vidStr + "/display/width", resx);
  82. +       config->value(vidStr + "/display/height", resy);
  83. +
  84. +       gwin->resized(resx,
  85. +                     resy,
  86. +                     fullscreen,
  87. +                     gw, gh,
  88. +                     current_scaleval, scaler,
  89. +                     gwin->get_win()->get_fill_mode(),
  90. +                     gwin->get_win()->get_fill_scaler());
  91. +   }
  92. +}
  93. +
  94.  void make_screenshot(bool silent) {
  95.     // TODO: Maybe use <SAVEGAME>/exult%03i.pcx instead.
  96.     // Or maybe some form or "My Pictures" on Windows.
  97. diff --git a/exult.h b/exult.h
  98. index f3c879d..969c97e 100644
  99. --- a/exult.h
  100. +++ b/exult.h
  101. @@ -66,6 +66,8 @@ extern void Wait_for_arrival(
  102.  );
  103.  
  104.  extern void change_gamma(bool down);
  105. +extern void increase_scaleval();
  106. +extern void decrease_scaleval();
  107.  extern void setup_video(bool fullscreen, int setup_video_type,
  108.                          int resx = 0, int resy = 0, int gw = 0,
  109.                          int gh = 0, int scaleval = 0, int scaler = 0,
  110. diff --git a/keyactions.cc b/keyactions.cc
  111. index 9b4b4ec..ed113a2 100644
  112. --- a/keyactions.cc
  113. +++ b/keyactions.cc
  114. @@ -247,6 +247,18 @@ void ActionRepaint(int const *params) {
  115.     Game_window::get_instance()->paint();
  116.  }
  117.  
  118. +//  { ActionScalevalIncrease, 0, "Increase scaleval", cheat_keys, NONE },
  119. +void ActionScalevalIncrease(int const *params) {
  120. +   ignore_unused_variable_warning(params);
  121. +   increase_scaleval();
  122. +}
  123. +
  124. +//  { ActionScalevalDecrease, 0, "Decrease scaleval", cheat_keys, NONE },
  125. +void ActionScalevalDecrease(int const *params) {
  126. +   ignore_unused_variable_warning(params);
  127. +   decrease_scaleval();
  128. +}
  129. +
  130.  //  { ActionBrighter, 0, "Increase brightness", normal_keys, NONE },
  131.  void ActionBrighter(int const *params) {
  132.     ignore_unused_variable_warning(params);
  133. diff --git a/keyactions.h b/keyactions.h
  134. index d275c24..beeb8d3 100644
  135. --- a/keyactions.h
  136. +++ b/keyactions.h
  137. @@ -38,6 +38,8 @@ void ActionKeyboardMode(int const *params);
  138.  
  139.  void ActionScreenshot(int const *params);
  140.  void ActionRepaint(int const *params);
  141. +void ActionScalevalIncrease(int const *params);
  142. +void ActionScalevalDecrease(int const *params);
  143.  void ActionBrighter(int const *params);
  144.  void ActionDarker(int const *params);
  145.  void ActionFullscreen(int const *params);
  146. diff --git a/keys.cc b/keys.cc
  147. index df4799c..e2d4ce7 100644
  148. --- a/keys.cc
  149. +++ b/keys.cc
  150. @@ -108,6 +108,14 @@ const struct Action {
  151.  #endif
  152.  
  153.     {
  154. +       "SCALEVAL_INCREASE",
  155. +       ActionScalevalIncrease, 0, "Increase scaleval", Action::mapedit_keys, NONE, true, true, true, false
  156. +   },
  157. +   {
  158. +       "SCALEVAL_DECREASE",
  159. +       ActionScalevalDecrease, 0, "Decrease scaleval", Action::mapedit_keys, NONE, true, true, true, false
  160. +   },
  161. +   {
  162.         "BRIGHTER",
  163.         ActionBrighter, 0, "Increase brightness", Action::normal_keys, NONE, true, true, true, false
  164.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement