-
Notifications
You must be signed in to change notification settings - Fork 199
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
Additive and substractive picture support #1068
Comments
Looks like thie Enhancement has unlikely conflicts with existing games (is file ending based, .xxx.png). And is fast because is only required once on load. Related pixman ops: |
Can @gadesx explain why the pictures are displayed with 50% transparency and faded out in RPG_RT? EasyRPG starts with 100% transparency and the editor shows it the same way. |
Looks DynRPG specific, doesn't happen when I replace the RPG_RT m( |
Last year @elsemieni tried to implement this feature but had some differences in behavior (layering, etc.) that could require diving deeper to match existing RPG_RT patches, however looks great to start with: ff64fd8 |
Maniac patch has also support for some of the blend modes |
Fixed by #2628 Because this is powered by Pixman it also supports 32 bit PNGs with Alpha channel properly |
Pixman doesn't support the (odd) subtract blend mode though. |
yeah it only supports "Difference". Defined as |
Potential patch: diff --git a/src/sprite.cpp b/src/sprite.cpp
index 16203e9fc..377c03819 100644
--- a/src/sprite.cpp
+++ b/src/sprite.cpp
@@ -114,11 +114,43 @@ BitmapRef Sprite::Refresh(Rect& rect) {
}
void Sprite::SetBitmap(BitmapRef const& nbitmap) {
+ if (nbitmap == bitmap) {
+ return;
+ }
+
bitmap = nbitmap;
if (!bitmap) {
src_rect = Rect();
} else {
src_rect = bitmap->GetRect();
+
+ // EasyRPG Extension: Set the Blend Mode based on the filename, e.g. ".add.png" for "Additive"
+ SetBlendType(0);
+ StringView filename = bitmap->GetFilename();
+ if (filename.size() >= 8 && filename[filename.size() - 4] == '.' && filename[filename.size() - 8] == '.') {
+ filename = filename.substr(filename.size() - 7, 3);
+ constexpr std::array<std::pair<StringView, Bitmap::BlendMode>, 13> exts = {{
+ {"add", Bitmap::BlendMode::Additive},
+ {"clb", Bitmap::BlendMode::ColorBurn},
+ {"cld", Bitmap::BlendMode::ColorDodge},
+ {"dif", Bitmap::BlendMode::Difference},
+ {"drk", Bitmap::BlendMode::Darken},
+ {"exc", Bitmap::BlendMode::Exclusion},
+ {"hlg", Bitmap::BlendMode::HardLight},
+ {"lgh", Bitmap::BlendMode::Lighten},
+ {"mul", Bitmap::BlendMode::Multiply},
+ {"ove", Bitmap::BlendMode::Overlay},
+ {"sat", Bitmap::BlendMode::Saturate},
+ {"slg", Bitmap::BlendMode::SoftLight},
+ {"xor", Bitmap::BlendMode::XOR}
+ }};
+ auto it = std::lower_bound(exts.begin(), exts.end(), filename, [](const auto& e, const auto& fname) {
+ return e.first < fname;
+ });
+ if (it != exts.end() && it->first == filename) {
+ SetBlendType((int)it->second);
+ }
+ }
}
src_rect_effect = src_rect;
diff --git a/src/sprite_picture.cpp b/src/sprite_picture.cpp
index 58f094132..8c005c371 100644
--- a/src/sprite_picture.cpp
+++ b/src/sprite_picture.cpp
@@ -144,7 +144,9 @@ void Sprite_Picture::Draw(Bitmap& dst) {
SetFlipX(data.easyrpg_flip_horizontal);
SetFlipY(data.easyrpg_flip_vertical);
- SetBlendType(data.easyrpg_blend_mode);
+ if (static_cast<Bitmap::BlendMode>(data.easyrpg_blend_mode) != Bitmap::BlendMode::Default) {
+ SetBlendType(data.easyrpg_blend_mode);
+ }
Sprite::Draw(dst);
}
-- |
With RPG Maker XP & Vx ace there was an added to
show pictures additives and substractives.
In Rpg maker 2003 with dynrpg there's a plugin that support it:
https://rpgmaker.net/engines/rt2k3/utilities/11/
Actual comparison of a light in player using alpha channel (that looks like similar to the own rpg maker pictures with transparency) and additive light of blending plugin with dynrpg

The text was updated successfully, but these errors were encountered: