]> git.lizzy.rs Git - minetest.git/commitdiff
Add setting to mirror hands mirror_hands
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 23 Jul 2022 22:18:39 +0000 (00:18 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 23 Jul 2022 22:18:39 +0000 (00:18 +0200)
builtin/settingtypes.txt
minetest.conf.example
src/client/camera.cpp
src/defaultsettings.cpp
src/settings_translation_file.cpp

index caa6e4db3c1800d1c27ab287a0423e7d88c0f259..3ecad57fc95fd31e169b6b1ac92288ec6b94a841 100644 (file)
@@ -225,6 +225,9 @@ view_bobbing_amount (View bobbing factor) float 1.0 0.0 7.9
 #    For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
 fall_bobbing_amount (Fall bobbing factor) float 0.03 0.0 100.0
 
+#    Draw main hand on left side of screen, offhand on right side.
+mirror_hands (Mirror hands) bool false
+
 [**Camera]
 
 #   Camera 'near clipping plane' distance in nodes, between 0 and 0.25
index 2f153413a185698cd3d287ba80252e5f7ef2a042..a9a15e1334cd9352e5576b118f67eb8ab9aef11d 100644 (file)
 #    type: float min: 0 max: 100
 # fall_bobbing_amount = 0.03
 
+#    Draw main hand on left side of screen, offhand on right side.
+#    type: bool
+# mirror_hands = false
+
 ### Camera
 
 #    Camera 'near clipping plane' distance in nodes, between 0 and 0.25
index 5ca4e4908eeaee8c978dabb192b27070794fbdf2..3b4c2fad841ae771490b8a30fff7cc2e1f06ce71 100644 (file)
@@ -45,7 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #define WIELDMESH_AMPLITUDE_X 7.0f
 #define WIELDMESH_AMPLITUDE_Y 10.0f
 
-#define HANDS (int i = 0, s = +1; i <= 1; i++, s *= -1) // i is index, s is sign
+#define HANDS (int i = 0, s = +1; i <= +1; i++, s = -1, (void) s) // i is index, s is sign
 
 Camera::Camera(MapDrawControl &draw_control, Client *client, RenderingEngine *rendering_engine):
        m_draw_control(draw_control),
@@ -529,6 +529,9 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 tool_reload_ratio)
        m_player_light_color = player->light_color;
 
        for HANDS {
+               if (g_settings->getBool("mirror_hands"))
+                       s *= -1;
+
                // Position the wielded item
                //v3f wield_position = v3f(45, -35, 65);
                v3f wield_position = v3f(m_wieldmesh_offset.X, m_wieldmesh_offset.Y, 65);
index 22200071204e97043caee7a099dafa4efe6e8685..6320dc6d02ea1e4a6f409fc35ca4bdefea27c8fb 100644 (file)
@@ -207,6 +207,7 @@ void set_default_settings()
        settings->setDefault("enable_clouds", "true");
        settings->setDefault("view_bobbing_amount", "1.0");
        settings->setDefault("fall_bobbing_amount", "0.03");
+       settings->setDefault("mirror_hands", "false");
        settings->setDefault("enable_3d_clouds", "true");
        settings->setDefault("cloud_radius", "12");
        settings->setDefault("menu_clouds", "true");
index 03bb564fba995f1c762ea66624f82586b3f27920..ad0aaa9b1757de5e9d7eab81a54844b66d6fdd23 100644 (file)
@@ -86,6 +86,8 @@ fake_function() {
        gettext("Enable view bobbing and amount of view bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.");
        gettext("Fall bobbing factor");
        gettext("Multiplier for fall bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.");
+       gettext("Mirror hands");
+       gettext("Draw main hand on left side of screen, offhand on right side.");
        gettext("Camera");
        gettext("Near plane");
        gettext("Camera 'near clipping plane' distance in nodes, between 0 and 0.25\nOnly works on GLES platforms. Most users will not need to change this.\nIncreasing can reduce artifacting on weaker GPUs.\n0.1 = Default, 0.25 = Good value for weaker tablets.");