gpu: Fix blending problems for light/darken

This issue rised in Pokemon Emerald main menu, where all the menu items
are highlighted and not just the selected one.


Former-commit-id: 503652ad5d8fccb37603a1c5df670632e02b2f14
This commit is contained in:
Michel Heily 2020-04-30 08:41:57 +03:00
parent ecd916cae3
commit 08bda05d52

View file

@ -200,23 +200,21 @@ impl Gpu {
if !(top_layer_flags.contains_render_layer(&layers[0]) || obj_sfx) {
break 'blend;
}
if layers.len() > 1 && !(bot_layer_flags.contains_render_layer(&layers[1])) {
break 'blend;
}
let mut blend_mode = self.bldcnt.mode();
// push another backdrop layer in case there is only 1 layer
// unsafe { layers.push_unchecked(RenderLayer::backdrop(backdrop_color)); }
// if this is object alpha blending, ensure that the bottom layer contains a color to blend with
if obj_sfx && layers.len() > 1 && bot_layer_flags.contains_render_layer(&layers[1])
{
blend_mode = BldMode::BldAlpha;
}
let blend_mode = if obj_sfx && layers.len() > 1 && bot_layer_flags.contains_render_layer(&layers[1]) {
BldMode::BldAlpha
} else {
self.bldcnt.mode()
};
match blend_mode {
BldMode::BldAlpha => {
let bot_pixel = if layers.len() > 1 {
if !(bot_layer_flags.contains_render_layer(&layers[1])) {
break 'blend;
}
layers[1].pixel //self.layer_to_pixel(x, y, &layers[1])
} else {
backdrop_color