From adc9560c57569c0ed432d94c929c9a423ef63679 Mon Sep 17 00:00:00 2001 From: Yaman Date: Fri, 26 Dec 2014 09:05:37 -0500 Subject: [PATCH 1/6] Added player direction to debug info screen --- src/game.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index 5d53c67d2..ed2121cf0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3999,9 +3999,26 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, } if (flags.show_debug) { + + int yaw = wrapDegrees_0_360(cam.camera_yaw); + const char* player_direction; + if (yaw >= 315 or yaw < 45) { + player_direction = "positive Z"; + } + else if (yaw >= 45 and yaw < 135) { + player_direction = "negative X"; + } + else if (yaw >= 135 and yaw < 225) { + player_direction = "negative Z"; + } + else if (yaw >= 225 and yaw < 315) { + player_direction = "positive X"; + } + std::ostringstream os(std::ios_base::binary); os << std::setprecision(1) << std::fixed - << "(" << (player_position.X / BS) + << "Facing towards " << player_direction + << " (" << (player_position.X / BS) << ", " << (player_position.Y / BS) << ", " << (player_position.Z / BS) << ") (yaw=" << (wrapDegrees_0_360(cam.camera_yaw)) From 9bf2ce6d287f5c85e6f43f85a8c1b7560cd8f5c5 Mon Sep 17 00:00:00 2001 From: Yaman Date: Fri, 26 Dec 2014 18:11:58 -0500 Subject: [PATCH 2/6] Changed display of player direction --- src/game.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index ed2121cf0..b1971c3f3 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -4003,25 +4003,25 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, int yaw = wrapDegrees_0_360(cam.camera_yaw); const char* player_direction; if (yaw >= 315 or yaw < 45) { - player_direction = "positive Z"; + player_direction = "+Z"; } else if (yaw >= 45 and yaw < 135) { - player_direction = "negative X"; + player_direction = "-X"; } else if (yaw >= 135 and yaw < 225) { - player_direction = "negative Z"; + player_direction = "-Z"; } else if (yaw >= 225 and yaw < 315) { - player_direction = "positive X"; + player_direction = "+X"; } std::ostringstream os(std::ios_base::binary); os << std::setprecision(1) << std::fixed - << "Facing towards " << player_direction - << " (" << (player_position.X / BS) + << "(" << (player_position.X / BS) << ", " << (player_position.Y / BS) << ", " << (player_position.Z / BS) - << ") (yaw=" << (wrapDegrees_0_360(cam.camera_yaw)) + << ") (facedir=" < Date: Fri, 26 Dec 2014 22:41:56 -0500 Subject: [PATCH 3/6] Added suggestions of Zeno- --- src/game.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index b1971c3f3..fc28a96ec 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -4002,10 +4002,8 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, int yaw = wrapDegrees_0_360(cam.camera_yaw); const char* player_direction; - if (yaw >= 315 or yaw < 45) { - player_direction = "+Z"; - } - else if (yaw >= 45 and yaw < 135) { + + if (yaw >= 45 and yaw < 135) { player_direction = "-X"; } else if (yaw >= 135 and yaw < 225) { @@ -4014,6 +4012,9 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, else if (yaw >= 225 and yaw < 315) { player_direction = "+X"; } + else { + player_direction = "+Z"; + } std::ostringstream os(std::ios_base::binary); os << std::setprecision(1) << std::fixed @@ -4021,7 +4022,7 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, << ", " << (player_position.Y / BS) << ", " << (player_position.Z / BS) << ") (facedir=" < Date: Fri, 26 Dec 2014 23:36:28 -0500 Subject: [PATCH 4/6] Changed Directions to North, South, etc... --- src/game.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index fc28a96ec..6d75729c5 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -4004,16 +4004,16 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, const char* player_direction; if (yaw >= 45 and yaw < 135) { - player_direction = "-X"; + player_direction = "West"; } else if (yaw >= 135 and yaw < 225) { - player_direction = "-Z"; + player_direction = "South"; } else if (yaw >= 225 and yaw < 315) { - player_direction = "+X"; + player_direction = "East"; } else { - player_direction = "+Z"; + player_direction = "North"; } std::ostringstream os(std::ios_base::binary); From d283f7505cbfbec7ae7408f3eeed508c80fb3ef4 Mon Sep 17 00:00:00 2001 From: Yaman Date: Sat, 27 Dec 2014 10:17:45 -0500 Subject: [PATCH 5/6] Changed Directions to North(+Z), etc... --- src/game.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 6d75729c5..6efbe75f9 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -4004,16 +4004,16 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, const char* player_direction; if (yaw >= 45 and yaw < 135) { - player_direction = "West"; + player_direction = "West(-X)"; } else if (yaw >= 135 and yaw < 225) { - player_direction = "South"; + player_direction = "South(-Z)"; } else if (yaw >= 225 and yaw < 315) { - player_direction = "East"; + player_direction = "East(+X)"; } else { - player_direction = "North"; + player_direction = "North(+Z)"; } std::ostringstream os(std::ios_base::binary); From d80c443c103c34ffee40ffdb3023fa6eb49b657a Mon Sep 17 00:00:00 2001 From: Yaman Date: Sun, 28 Dec 2014 12:11:55 -0500 Subject: [PATCH 6/6] Changed to && operator --- src/game.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 6efbe75f9..bfed00d2b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -4003,13 +4003,13 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, int yaw = wrapDegrees_0_360(cam.camera_yaw); const char* player_direction; - if (yaw >= 45 and yaw < 135) { + if (yaw >= 45 && yaw < 135) { player_direction = "West(-X)"; } - else if (yaw >= 135 and yaw < 225) { + else if (yaw >= 135 && yaw < 225) { player_direction = "South(-Z)"; } - else if (yaw >= 225 and yaw < 315) { + else if (yaw >= 225 && yaw < 315) { player_direction = "East(+X)"; } else {