Dithering-style fade

Higher performance, allows free use of other palettes, frees up compressed space.
This commit is contained in:
Kistaro Windrider 2023-09-30 19:15:22 -07:00
parent fb95085bd9
commit f3ac1f492c
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -247,6 +247,7 @@ function updategame()
end
function _draw()
fillp(0)
drawgame()
if (state == game) fadelvl = -45
if (state == win) dropshadow("win",50,61,11)
@ -254,37 +255,14 @@ function _draw()
fadescreen()
end
fadetable=csv[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1,1,129,129,129,129,129,129,129,129,0,0,0,0,0
2,2,2,130,130,130,130,130,128,128,128,128,128,0,0
3,3,3,131,131,131,131,129,129,129,129,129,0,0,0
4,4,132,132,132,132,132,132,130,128,128,128,128,0,0
5,5,133,133,133,133,130,130,128,128,128,128,128,0,0
6,6,134,13,13,13,141,5,5,5,133,130,128,128,0
7,6,6,6,134,134,134,134,5,5,5,133,130,128,0
8,8,136,136,136,136,132,132,132,130,128,128,128,128,0
9,9,9,4,4,4,4,132,132,132,128,128,128,128,0
10,10,138,138,138,4,4,4,132,132,133,128,128,128,0
11,139,139,139,139,3,3,3,3,129,129,129,0,0,0
12,12,12,140,140,140,140,131,131,131,1,129,129,129,0
13,13,141,141,5,5,5,133,133,130,129,129,128,128,0
14,14,14,134,134,141,141,2,2,133,130,130,128,128,0
15,143,143,134,134,134,134,5,5,5,133,133,128,128,0]]
fadetable = split"0,1.5,1025.5,1029.5,1285.5,1413.5,9605.5,9637.5,-23130.5,-23066.5,-18970.5,-18954.5,-2570.5,-2568.5,-520.5,-8.5,-0.5"
function fadescreen()
fadelvl += 0.25
if fadelvl < 0 then
pal()
return
end
local i = flr(fadelvl)
for c=0,15 do
if i+1>=16 then
pal(c,0,1)
else
pal(c,fadetable[c+1][i+1],1)
end
end
if (fadelvl < 1) return
local i = min(flr(fadelvl), #fadetable)
fillp(fadetable[#fadetable+1-i])
rectfill(0,0,128,128,0)
end
-- puke emits a verbose string
@ -333,8 +311,8 @@ function pukeboard(item)
end
function drawgame()
cls()
clip(0,0,112,128)
rectfill(0,0,112,128,0)
for slist in all{intangibles_bg, pbullets, pships, eships, ebullets, intangibles_fg} do
slist:draw()
end