Skip to content

Commit 04dc4a1

Browse files
grorpsfan5
authored andcommitted
Fix TouchScreenGUI ignoring server-sent pitch changes
1 parent 47e557b commit 04dc4a1

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/client/game.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2617,7 +2617,7 @@ void Game::updateCameraOrientation(CameraOrientation *cam, float dtime)
26172617
#ifdef HAVE_TOUCHSCREENGUI
26182618
if (g_touchscreengui) {
26192619
cam->camera_yaw += g_touchscreengui->getYawChange();
2620-
cam->camera_pitch = g_touchscreengui->getPitch();
2620+
cam->camera_pitch += g_touchscreengui->getPitchChange();
26212621
} else {
26222622
#endif
26232623
v2s32 center(driver->getScreenSize().Width / 2, driver->getScreenSize().Height / 2);

src/gui/touchscreengui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
832832
const double d = g_settings->getFloat("touchscreen_sensitivity", 0.001f, 10.0f) * 3.0f;
833833

834834
m_camera_yaw_change -= dir_free.X * d;
835-
m_camera_pitch = MYMIN(MYMAX(m_camera_pitch + (dir_free.Y * d), -180.0f), 180.0f);
835+
m_camera_pitch_change += dir_free.Y * d;
836836

837837
// update shootline
838838
// no need to update (X, Y) when using crosshair since the shootline is not used

src/gui/touchscreengui.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ class TouchScreenGUI
171171
return res;
172172
}
173173

174-
double getPitch() { return m_camera_pitch; }
174+
double getPitchChange() {
175+
double res = m_camera_pitch_change;
176+
m_camera_pitch_change = 0;
177+
return res;
178+
}
175179

176180
/**
177181
* Returns a line which describes what the player is pointing at.
@@ -213,7 +217,7 @@ class TouchScreenGUI
213217

214218
// value in degree
215219
double m_camera_yaw_change = 0.0;
216-
double m_camera_pitch = 0.0;
220+
double m_camera_pitch_change = 0.0;
217221

218222
/**
219223
* A line starting at the camera and pointing towards the selected object.

0 commit comments

Comments
 (0)