palette loaders
This commit is contained in:
parent
fd1966e3f3
commit
0933918406
@ -200,6 +200,39 @@ function palette:compile_palt()
|
|||||||
self.cpl_tr = bits
|
self.cpl_tr = bits
|
||||||
return bits
|
return bits
|
||||||
end
|
end
|
||||||
|
-->8
|
||||||
|
-- load palettes
|
||||||
|
|
||||||
|
function load_box_palette(sidx)
|
||||||
|
local sint,sfrac=sidx\1,sidx%1
|
||||||
|
local x0,y0=sint%16*8,sint\16*8+sfrac*8\1
|
||||||
|
local c0ls,tr={},{}
|
||||||
|
for i=0,15 do
|
||||||
|
local x,y=x0+i%4,y0+i\4
|
||||||
|
local c,f= sget(x,y),sget(x+4,y)
|
||||||
|
if (f&0x1 ~= 0) c += 128
|
||||||
|
if (f&0x2 ~= 0) tr[i]=true
|
||||||
|
if (f&0x4 ~= 0) tr[i]=false
|
||||||
|
if (f&0x8 == 0) cols[i] = c
|
||||||
|
end
|
||||||
|
local ret=palette.new{cols=cols,tr=tr}
|
||||||
|
ret:compile_palt()
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
function load_row_palette(sx, sy)
|
||||||
|
local cols,tr={},{}
|
||||||
|
for i=0,15 do
|
||||||
|
local c,f = sget(sx+i,sy),sget(sx+i,sy+1)
|
||||||
|
if (f&0x1 ~= 0) c += 128
|
||||||
|
if (f&0x2 ~= 0) tr[i]=true
|
||||||
|
if (f&0x4 ~= 0) tr[i]=false
|
||||||
|
if (f&0x8 == 0) cols[i] = c
|
||||||
|
end
|
||||||
|
local ret=palette.new{cols=cols,tr=tr}
|
||||||
|
ret:compile_palt()
|
||||||
|
return ret
|
||||||
|
end
|
||||||
__gfx__
|
__gfx__
|
||||||
00000000012300000123555501230000012355550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000012300000123555501230000012355550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000456700004567555545670000456755550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000456700004567555545670000456755550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
Loading…
Reference in New Issue
Block a user