diff --git a/pal_from_spr.p8 b/pal_from_spr.p8 index b5bbf18..beb3214 100644 --- a/pal_from_spr.p8 +++ b/pal_from_spr.p8 @@ -16,6 +16,34 @@ function _init() scy = 0 dcx = 0 dcy = 0 + + init_box_pals() + init_row_pals() +end + +function init_box_pals() + box_pals = {} + for x=0,box_cols do + local pal_col = {} + for y=0,box_rows do + pal_col[y] = load_box_palette(1+x+16*(y\2)+(0.5*y%2)) + end + box_pals[x] = pal_col + end +end + +function init_row_pals() + row_pals = {} + for x=0,row_cols do + local pal_col = {} + for y=0,row_rows do + pal_col[y] = load_row_palette( + 8+16*x, + 16+2*y + ) + end + row_pals[x] = pal_col + end end function _update() @@ -41,6 +69,9 @@ end function _draw() cls() draw_hud() + local pals = (mode == "boxes") and box_pals or row_pals + pals[scx][scy]:do_both(0) + pals[dcx][dcy]:do_both(1) draw_bars() end