From 029ff2677a69cc0438e7b3c8c96296ee9fa8b66b Mon Sep 17 00:00:00 2001 From: Matthew Fioravante Date: Sun, 24 Oct 2021 19:38:12 -0400 Subject: [PATCH] Add RPG_RT player direction scrolling logic --- src/game_player.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/game_player.cpp b/src/game_player.cpp index dbafd493ef..ebcd0a76fb 100644 --- a/src/game_player.cpp +++ b/src/game_player.cpp @@ -215,7 +215,23 @@ void Game_Player::UpdateScroll(int amount, bool was_jumping) { return; } - Game_Map::Scroll(sx * amount, sy * amount); + int move_sx = 0; + int move_sy = 0; + const auto d = GetDirection(); + if (sy < 0 && (d == Up || d == UpRight || d == UpLeft)) { + move_sy = sy; + } + if (sy > 0 && (d == Down || d == DownRight || d == DownLeft)) { + move_sy = sy; + } + if (sx > 0 && (d == Right || d == UpRight || d == DownRight)) { + move_sx = sx; + } + if (sx < 0 && (d == Left || d == UpLeft || d == DownLeft)) { + move_sx = sx; + } + + Game_Map::Scroll(move_sx * amount, move_sy * amount); } bool Game_Player::UpdateAirship() {