mirror of
https://github.com/mattrberry/crab.git
synced 2025-01-30 20:34:45 +01:00
brightness effects for sprites, allows official bios to render properly
This commit is contained in:
parent
0e30f3558b
commit
08cc652722
1 changed files with 11 additions and 2 deletions
|
@ -304,8 +304,17 @@ class PPU
|
||||||
if sprite_pixel.priority == priority && sprite_pixel.palette > 0
|
if sprite_pixel.priority == priority && sprite_pixel.palette > 0
|
||||||
selected_color = (@pram + 0x200).to_unsafe.as(UInt16*)[sprite_pixel.palette]
|
selected_color = (@pram + 0x200).to_unsafe.as(UInt16*)[sprite_pixel.palette]
|
||||||
if top_color.nil? # todo: brightness for sprites
|
if top_color.nil? # todo: brightness for sprites
|
||||||
|
if !(sprite_pixel.blends || (@bldcnt.is_bg_target(4, target: 1) && effects))
|
||||||
|
return selected_color
|
||||||
|
elsif @bldcnt.color_special_effect == 1 # alpha blending
|
||||||
top_color = selected_color
|
top_color = selected_color
|
||||||
return top_color unless sprite_pixel.blends || (@bldcnt.is_bg_target(4, target: 1) && effects)
|
elsif @bldcnt.color_special_effect == 2 # brightness increase
|
||||||
|
bgr16 = BGR16.new(selected_color)
|
||||||
|
return (bgr16 + (BGR16.new(0xFFFF) - bgr16) * (Math.min(16, @bldy.evy_coefficient) / 16)).value
|
||||||
|
else # brightness decrease
|
||||||
|
bgr16 = BGR16.new(selected_color)
|
||||||
|
return (bgr16 - bgr16 * (Math.min(16, @bldy.evy_coefficient) / 16)).value
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if @bldcnt.is_bg_target(4, target: 2) || sprite_pixel.blends
|
if @bldcnt.is_bg_target(4, target: 2) || sprite_pixel.blends
|
||||||
color = BGR16.new(top_color) * (Math.min(16, @bldalpha.eva_coefficient) / 16) + BGR16.new(selected_color) * (Math.min(16, @bldalpha.evb_coefficient) / 16)
|
color = BGR16.new(top_color) * (Math.min(16, @bldalpha.eva_coefficient) / 16) + BGR16.new(selected_color) * (Math.min(16, @bldalpha.evb_coefficient) / 16)
|
||||||
|
|
Loading…
Add table
Reference in a new issue