Advertisement
dominus

Untitled

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