Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events glitch when crossing looping map borders #1216

Closed
carstene1ns opened this Issue Jul 7, 2017 · 7 comments

Comments

Projects
None yet
5 participants
@carstene1ns
Copy link
Member

carstene1ns commented Jul 7, 2017

Bug reported by @20kdc, testcase: https://20kdc.duckdns.org/Synth.zip

Related: #716, fixed with 689fd80.
Proposed patch, reverting to old behaviour when the map is 20 tiles wide:

diff --git a/src/game_character.cpp b/src/game_character.cpp
index 21a0d5f1..7424bcd0 100644
--- a/src/game_character.cpp
+++ b/src/game_character.cpp
@@ -131,7 +131,7 @@ void Game_Character::MoveTo(int x, int y) {
 int Game_Character::GetScreenX() const {
 	int x = GetRealX() / TILE_SIZE - Game_Map::GetDisplayX() / TILE_SIZE + (TILE_SIZE / 2);
 
-	if (Game_Map::LoopHorizontal() && (x <= -TILE_SIZE / 2 || x > 0)) {
+	if (Game_Map::LoopHorizontal() && (x <= -TILE_SIZE / 2 || x > 0 || Game_Map::GetWidth() == 20)) {
 		int map_width = Game_Map::GetWidth() * TILE_SIZE;
 		x = (x + map_width) % map_width;
 	}

Same likely applies for the other border on 15 tile high maps.

@20kdc

This comment has been minimized.

Copy link
Contributor

20kdc commented Jul 7, 2017

This looks like it would still only show one instance of the event, though. On RPG_RT I can see two copies of the event at the same time. It would probably be easier to demonstrate with a larger event.

@carstene1ns

This comment has been minimized.

Copy link
Member Author

carstene1ns commented Jul 7, 2017

I used your testcase with RPG_RT and did not see two events at the same time while moving. Needed to stop the movement in the middle (by clicking outside of the RPG_RT window) to see it^^'.

@20kdc

This comment has been minimized.

Copy link
Contributor

20kdc commented Jul 7, 2017

...huh. Confusing. Will attempt to get screenshots.

@20kdc

This comment has been minimized.

Copy link
Contributor

20kdc commented Jul 7, 2017

screenshot from 2017-07-07 16-43-36
From the RPG_RT in the Ib English Translation at: http://www.vgperson.com/games/ib.htm (The bug doesn't actually affect Ib to my knowledge, it's just a copy of RPG_RT on-hand)

@carstene1ns

This comment has been minimized.

Copy link
Member Author

carstene1ns commented Jul 7, 2017

The problem is that our drawing code only draws every event once and on one position. It draws the event's sprite and cuts off everything not on the screen. So, as long as the position is not changed, it will either stay on the left or right side.
When we change the drawing code to handle this corner case and split up the drawing in two places when the event is partly not on the screen and the map is 20 tiles wide and looping, this might work.

carstene1ns added a commit to carstene1ns/easyrpg-player that referenced this issue Oct 9, 2017

Improve Event display on small looping map borders
(When the map is 20 tiles wide, the Events disappear too soon when
reaching the map border. Related: EasyRPG#1216, EasyRPG#716)

@carstene1ns carstene1ns removed this from the 0.5.3 milestone Oct 14, 2017

@Albeleon

This comment has been minimized.

Copy link
Member

Albeleon commented Jul 14, 2018

#1401 The commit "Create Sprite Loop Duplicate graphics with the right Z position. " solves this issue.

@carstene1ns

This comment has been minimized.

Copy link
Member Author

carstene1ns commented Dec 4, 2018

via #1510:

fmatthew5876:

Create a 20x15 map which loops vertically. Place an event on the map with a charset sprite.

Play the game walk up until the event is on the top row of the map.

screen

The left is RPG_RT, right is Player

This bug exists horizontally for wide sprites also.

Ghabry:

There is already a patch for this: d11a906

But that one has multiple design issues e.g. the new Create and Destroy clone methods, don't think you need them.

Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Dec 8, 2018

Correctly render sprites on looping maps by emitting "clones" which a…
…re duplicated a X, Y and XY depending on the map panning.

Fix EasyRPG#1216

Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Dec 9, 2018

Correctly render sprites on looping maps by emitting "clones" which a…
…re duplicated a X, Y and XY depending on the map panning.

Fix EasyRPG#1216

Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Dec 9, 2018

Correctly render sprites on looping maps by emitting "clones" which a…
…re duplicated a X, Y and XY depending on the map panning.

Fix EasyRPG#1216

Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Dec 12, 2018

Correctly render sprites on looping maps by emitting "clones" which a…
…re duplicated a X, Y and XY depending on the map panning.

Fix EasyRPG#1216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.