pre-initialize palettes for blip. costs tokens, saves time

This commit is contained in:
Kistaro Windrider 2023-09-30 19:45:07 -07:00
parent cf1e1153a3
commit a4590821be
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -118,6 +118,7 @@ function linked_list:pop_front()
end
function _init()
init_blip_pals()
wipe_level()
primary_ship.main_gun = zap_gun.new()
load_level(example_level)
@ -1752,10 +1753,19 @@ end
mknew(blip_fx)
blip_pals = {}
function init_blip_pals()
for i=0,15 do
local pp = {[0]=0}
for j=1,15 do
pp[j] = i
end
blip_pals[i]=pp
end
end
function blip(obj, col, frames)
local p = {[0]=0}
obj.fx_pal = p
for i=1,15 do p[i]=col end
obj.fx_pal = blip_pals[col]
if (obj.___fx_pal_event) obj.___fx_pal_event:abort()
events:push_back(blip_fx.new{frames=frames, obj=obj})
end