mirror of
https://github.com/mattrberry/crab.git
synced 2025-02-04 08:46:04 +01:00
updated usage of enable bits
This commit is contained in:
parent
d864b27e35
commit
69c671730b
2 changed files with 11 additions and 19 deletions
|
@ -219,7 +219,7 @@ module GBA
|
|||
end
|
||||
|
||||
def render_sprites : Nil
|
||||
return unless @dispcnt.screen_display_obj
|
||||
return unless bit?(@dispcnt.value, 12)
|
||||
base = 0x10000_u32
|
||||
sprites = @oam.unsafe_slice_of(Sprite)
|
||||
sprites.each do |sprite|
|
||||
|
@ -312,15 +312,15 @@ module GBA
|
|||
# Returns a u16 representing the layer enable bits and a bool indicating whether effects are enabled.
|
||||
def get_enables(col : Int) : Tuple(UInt16, Bool)
|
||||
if @dispcnt.window_0_display && @win0h.x1 <= col < @win0h.x2 && @win0v.y1 <= @vcount < @win0v.y2 # win0
|
||||
{bits(@winin.value, 0..4), @winin.window_0_color_special_effect}
|
||||
{@winin.window_0_enable_bits, @winin.window_0_color_special_effect}
|
||||
elsif @dispcnt.window_1_display && @win1h.x1 <= col < @win1h.x2 && @win1v.y1 <= @vcount < @win1v.y2 # win1
|
||||
{bits(@winin.value, 8..12), @winin.window_1_color_special_effect}
|
||||
{@winin.window_1_enable_bits, @winin.window_1_color_special_effect}
|
||||
elsif @dispcnt.obj_window_display && @sprite_pixels[col].window # obj win
|
||||
{bits(@winout.value, 8..12), @winout.obj_window_color_special_effect}
|
||||
{@winout.obj_window_enable_bits, @winout.obj_window_color_special_effect}
|
||||
elsif @dispcnt.window_0_display || @dispcnt.window_1_display || @dispcnt.obj_window_display # winout
|
||||
{bits(@winout.value, 0..4), @winout.outside_color_special_effect}
|
||||
{@winout.outside_enable_bits, @winout.outside_color_special_effect}
|
||||
else # no windows
|
||||
{bits(@dispcnt.value, 8..12), true}
|
||||
{@dispcnt.default_enable_bits, true}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -144,11 +144,7 @@ module GBA
|
|||
bool hblank_interval_free # (1=Allow access to OAM during H-Blank)
|
||||
bool obj_mapping_1d # (0=Two dimensional, 1=One dimensional)
|
||||
bool forced_blank # (1=Allow access to VRAM,Palette,OAM)
|
||||
bool screen_display_bg0
|
||||
bool screen_display_bg1
|
||||
bool screen_display_bg2
|
||||
bool screen_display_bg3
|
||||
bool screen_display_obj
|
||||
num default_enable_bits, 5
|
||||
bool window_0_display
|
||||
bool window_1_display
|
||||
bool obj_window_display
|
||||
|
@ -221,24 +217,20 @@ module GBA
|
|||
|
||||
class WININ < BitField(UInt16)
|
||||
include Base16
|
||||
num window_0_enable_bits, 4
|
||||
bool window_0_obj_enable
|
||||
num window_0_enable_bits, 5
|
||||
bool window_0_color_special_effect
|
||||
num not_used_0, 2, read_only: true
|
||||
num window_1_enable_bits, 4
|
||||
bool window_1_obj_enable
|
||||
num window_1_enable_bits, 5
|
||||
bool window_1_color_special_effect
|
||||
num not_used_1, 2, read_only: true
|
||||
end
|
||||
|
||||
class WINOUT < BitField(UInt16)
|
||||
include Base16
|
||||
num outside_enable_bits, 4
|
||||
bool outside_obj_enable
|
||||
num outside_enable_bits, 5
|
||||
bool outside_color_special_effect
|
||||
num not_used_outside, 2, read_only: true
|
||||
num obj_window_enable_bits, 4
|
||||
bool obj_window_obj_enable
|
||||
num obj_window_enable_bits, 5
|
||||
bool obj_window_color_special_effect
|
||||
num not_used_obj, 2, read_only: true
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue