Skip to content

Commit

Permalink
Allow player input on same frame move route ends
Browse files Browse the repository at this point in the history
Create a parallel event: `SetMoveRoute: Player, Turn Left`

RPG_RT, you can still walk around. Before this fix the player
was stuck.

Fix: EasyRPG#579
Fix: EasyRPG#937
  • Loading branch information
fmatthew5876 committed Mar 12, 2019
1 parent 614b402 commit 99c71e6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/game_character.cpp
Expand Up @@ -145,9 +145,7 @@ void Game_Character::UpdateMovement() {
}

if (!IsMoveRouteOverwritten()) {
if (IsStopping() && !IsStopCountActive()) {
UpdateSelfMovement();
}
UpdateSelfMovement();
}

bool moved = false;
Expand Down
3 changes: 3 additions & 0 deletions src/game_event.cpp
Expand Up @@ -388,6 +388,9 @@ void Game_Event::UpdateSelfMovement() {
if (page == nullptr) {
return;
}
if (IsStopCountActive()) {
return;
}

switch (page->move_type) {
case RPG::EventPage::MoveType_random:
Expand Down
3 changes: 1 addition & 2 deletions src/game_player.cpp
Expand Up @@ -197,7 +197,7 @@ void Game_Player::UpdateScroll(int old_x, int old_y) {
}
}

void Game_Player::UpdatePlayerInput() {
void Game_Player::UpdateSelfMovement() {
if (!Game_Map::GetInterpreter().IsRunning() && !Game_Map::IsAnyEventStarting()) {
if (IsMovable()) {
const auto old_x = GetX();
Expand Down Expand Up @@ -246,7 +246,6 @@ void Game_Player::Update(bool process_movement) {
const auto old_sprite_x = GetSpriteX();
const auto old_sprite_y = GetSpriteY();

UpdatePlayerInput();
auto was_moving = !IsStopping();

if (process_movement) {
Expand Down
2 changes: 1 addition & 1 deletion src/game_player.h
Expand Up @@ -46,6 +46,7 @@ class Game_Player : public Game_Character {
void BeginMove() override;
void CancelMoveRoute() override;
int GetVehicleType() const override;
void UpdateSelfMovement() override;
/** @} */

bool IsTeleporting() const;
Expand Down Expand Up @@ -106,7 +107,6 @@ class Game_Player : public Game_Character {
bool teleporting = false;
int new_map_id = 0, new_x = 0, new_y = 0, new_direction = 0;

void UpdatePlayerInput();
void UpdateScroll(int prev_x, int prev_y);
void UpdatePan();
bool CheckTouchEvent();
Expand Down

0 comments on commit 99c71e6

Please sign in to comment.