Skip to content

Conversation

@florianessl
Copy link
Member

@florianessl florianessl commented Jun 11, 2025

A few fixes for minor visual glitches in the EasyRPG Player.
(As well as some other fixes for warnings MSVC spat out)

#2432 / #2932 - Face state not emulated correctly for Message Processing in Parallel events because of the global state of game_system

I added another "hacky flag" in Window_Message (See the FIXME there..) to indicate that a text was pushed in the current frame & renamed an existing one ("close_finished_this_frame").
The initial creation of the window contents has been moved from "StartMessageProcessing" to the Update method. Restructuring the code this way allows us to delay this part of the setup, until the main interpreter scripts have been handled.

I modified Cherry's test project a bit, to also verify that the substitution of variables in the message contents behaves the same:
faceset-parallel.zip

It might make sense to combine all these boolean flags in Window_Message into some enum field (with descriptive names to improve readability), that describes the current state of the window & just remove the "FIXME" comment. Trying to restructure all the code as suggested there would be a major headache & just break other stuff along the way... 🤔

This should also fix some other MessageBox issues that are caused by race conditions between interpreter instances. Have to dig up the issue numbers..

#3412 - Incorrect positioning of timer overlay

I already went into detail in the comments of this issue.

#2607 - Parallax background graphics would be rendered on the outside area of the screen when ShakeScreen is applied

While a ShakeScreen effect is active, the area outside of the screen boundaries should not be drawn on.
EasyRPG uses a TiledBlit here, effectively repeating the bitmap everywhere. Could maybe be improved, but I just clear the overdrawn areas afterwards, to emulate RPG_RT behavior.

@Ghabry
Copy link
Member

Ghabry commented Jun 11, 2025

About the panorama clearing. There is already code that does the same for the wide-screen hack (for the same reason).

Maybe can be reused? https://github.com/EasyRPG/Player/blob/master/src/screen.cpp

@Ghabry
Copy link
Member

Ghabry commented Jun 29, 2025

Only want to check the screenshake fix, the rest looks good to me

@Ghabry
Copy link
Member

Ghabry commented Jun 29, 2025

The clearing code for the Plane also runs when the rendering is inside the bounds.

E.g. this code in "Test AB Blocks" in our TestGame:

@> Shake Screen: Start, 9, 1
@> Show Picture: 1, 320_240, (0,0), 100%, 0%, M6, B0, RGBS(100,100,100,100)
@> Change Parallax Back: Sky2

Even for the "in-bounds" areas the parallax is rendered black while shaking.

@Ghabry
Copy link
Member

Ghabry commented Jun 29, 2025

Solved the math:

diff --git a/src/plane.cpp b/src/plane.cpp
index 28b176457..d4c9806cd 100644
--- a/src/plane.cpp
+++ b/src/plane.cpp
@@ -84,20 +84,26 @@ void Plane::Draw(Bitmap& dst) {
 		dst_rect.x = bg_x;
 		dst_rect.width = bg_width;
 
+		if (Game_Map::GetDisplayX() / 16 + Player::screen_width > Game_Map::GetTilesX() * TILE_SIZE) {
+			// Do not draw out of bounds to the right
+			dst_rect.width -= (Game_Map::GetDisplayX() / 16 + Player::screen_width) - (Game_Map::GetTilesX() * TILE_SIZE);
+		}
+
 		// Correct the offset if the top-left corner moved.
 		offset_x = shake_x + bg_x;
 	}
 	src_y += shake_y;
 
 	dst.TiledBlit(src_x + offset_x, src_y, source->GetRect(), *source, dst_rect, 255);
+
 	if (!Game_Map::LoopHorizontal()) {
-		if (offset_x < 0) {
-			auto clear_rect = Rect(dst.GetRect().x, dst.GetRect().y, abs(offset_x), dst.GetRect().height);
+		// Clear out of bounds map area visible during shake
+		if (offset_x < 0 && src_x + offset_x < 0) {
+			auto clear_rect = Rect(dst.GetRect().x, dst.GetRect().y, -offset_x, dst.GetRect().height);
 			dst.ClearRect(clear_rect);
-		} else if (offset_x > 0) {
-			auto clear_rect = Rect(dst.GetRect().width - offset_x, dst.GetRect().y, offset_x, dst.GetRect().height);
+		} else if (dst_rect.width < Player::screen_width) {
+			auto clear_rect = Rect(dst_rect.width, dst.GetRect().y, Player::screen_width - dst_rect.width, dst.GetRect().height);
 			dst.ClearRect(clear_rect);
 		}
 	}
 }
-

@Ghabry Ghabry added this to the 0.8.2 milestone Jul 29, 2025
Copy link
Member

@Ghabry Ghabry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

manually applied my suggested patch due to author not responding (and to get this nice PR in)

@Ghabry Ghabry requested a review from fdelapena December 14, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants