csvify some large tables

Steal the csv and usplit routines from Extreme Tetrom. Not yet using usplit.
This commit is contained in:
Kistaro Windrider 2023-09-12 23:35:27 -07:00
parent 44bc904ec2
commit 43e6160dbc
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -11,6 +11,16 @@ lose = 3
debug = {}
function usplit(str)
return unpack(split(str))
end
function csv(s)
local ret=split(s,"\n")
for i,v in ipairs(ret) do
ret[i] = type(v) == "string" and split(v) or {v} end
return ret
end
function _init()
init_bullet_mt()
init_powerup_mt()
@ -25,14 +35,11 @@ end
-- health gradients for 1..5 hp
-- exactly, then all "more".
hpcols_lut = {
{36},
{34, 136},
{34, 130, 136},
{34, 34, 130, 136},
{34, 34, 34, 130, 136},
{34, 34, 34, 130, 130, 136}
}
hpcols_lut = csv[[36
34, 136
34, 130, 136
34, 34, 130, 136
34, 34, 130, 130, 136]]
-- call after any change to maxhp
-- configures health gradient
@ -176,24 +183,22 @@ function _draw()
fadescreen()
end
local fadetable={
{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=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]]
function fadescreen()
fadelvl += 0.25