pre-initialize palettes for blip. costs tokens, saves time
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user