-
Notifications
You must be signed in to change notification settings - Fork 217
Visual Fixes #3434
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
base: master
Are you sure you want to change the base?
Visual Fixes #3434
Conversation
…reground interpreter has been processed (Fix EasyRPG#2432 / EasyRPG#2932)
…'t be shown when screen shaking is applied (Fix EasyRPG#2607)
…n might create unnecessarily expensive copy
…ter the resource has been moved
… not scrolling horizontally
|
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 |
|
Only want to check the screenshake fix, the rest looks good to me |
|
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: Even for the "in-bounds" areas the parallax is rendered black while shaking. |
|
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
left a comment
There was a problem hiding this 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)
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.