-- leave me
-- cur_level_num = 0
-- frame counter
ticker = 0
actor_unique_id = 1
multiple_colour_name = ""
use_multiple_colour = 0
colour_tables = { 1.0, 90.0, -60.0 }
use_byebye_respawn = 0
set_strike_game_type = 0
set_num_stages = 6

setter = 0
function fool( a, b, c )
if setter == 0 then
	setglobal( b, c )
else
	write( b, " ", a, "\n")
end
end


dofile("actor_table.lua")


exp_no_align = 0
exp_align = 1

health_chunk_regain	= 1
health_damagable = 2
health_damagable_check_parent = 3
health_no_damage_check_parent_and_drop = 4


_ACTOR = {}

function _ACTOR:setposn( x, y, z )
	self[ci_posn_x] = x
	self[ci_posn_y] = y
	self[ci_posn_z] = z
end

function _ACTOR:setanimdelay( anim_delay )
	self[ci_anim_delay] = anim_delay
end

function _ACTOR:setall( x, y, z, angle, size, hueshift, launch_delay, diff_num, stage_num, path_name )
	self[ci_posn_x] = x
	self[ci_posn_y] = y
	self[ci_posn_z] = z
	self[ci_angle] = angle
	self[ci_model_size] = size
	self[ci_hue_shift] = hueshift
	self[ci_launch_delay] = launch_delay
	self[ci_diff_num] = diff_num
	self[ci_stage_num] = stage_num
--	c_print( "a", x, "b", y, "c", z, "d", angle, "e", size, "f", hueshift, "g", launch_delay, "h", diff_num, "i", stage_num )
	if path_name ~= nil then
		self[ci_path_name] = path_name
	end
end

function _ACTOR:launch()
	c_launch_new_actor( self )
end

function ACTOR_PreLaunch( actor_code, unique_name )
	local n = {}

	actor_unique_id = actor_unique_id + 1

	n[ci_actor_name]		= actor_code
	if unique_name == nil then
		n[ci_unique_name]		= ""
	else
		n[ci_unique_name]		= unique_name
	end
	n[ci_path_name]			= ""

	n[ci_model_size]		= 0.0
	n[ci_posn_x]			= 0.0
	n[ci_posn_y]			= 0.0
	n[ci_posn_z]			= 0.0
	n[ci_angle]				= 0.0
	n[ci_anim_delay]		= 0.0
	n[ci_hue_shift]			= 0.0
	n[ci_launch_delay]		= 0.0

	n.setposn				= _ACTOR.setposn
	n.setanimdelay			= _ACTOR.setanimdelay
	n.setall				= _ACTOR.setall
	n.launch				= _ACTOR.launch

	return n
end


function ACTOR_preload()
	local actor = {}

--	c_change_bitmap( "", "" )

-- use as template
	actor[cp_actor_name]			= ""
	actor[cp_model_dir]				= ""
	actor[cp_model_name]			= ""

	actor[cp_actor_type]			= cat_beastie
	actor[cp_hit_delay]				= 0.01
	actor[cp_mutate_hit_delay]		= 0.01
	actor[cp_move_type]				= 0
	actor[cp_weight]				= 0.0
	actor[cp_hit_power]				= 0.0
	actor[cp_i_collide_with_beasties]	= 0
	actor[cp_these_collide_with_me]		= 0
	actor[cp_i_avoid_these_beasties]	= 0
	actor[cp_in_beastie_count]		= 1
	actor[cp_extra_collision_type]	= 0.0

	-- movement
	actor[cp_move_speed_min]		= 0.0
	actor[cp_move_speed_max]		= 0.0
	actor[cp_move_acceleration]		= 0.0
	actor[cp_move_deceleration]		= 0.0
	actor[cp_move_inertia_accn]		= 0.0
	actor[cp_move_inertia_decn]		= 0.0

	actor[cp_repel_dist]			= 0.0
	actor[cp_target_stop_dist]		= 0.0
	actor[cp_target_delay_min]		= 0.01
	actor[cp_target_delay_max]		= 0.05

	actor[cp_turn_lock_angle_inner]		= 360.0
	actor[cp_turn_lock_angle_outer]		= 360.0
	actor[cp_turn_speed_still]			= 0.0
	actor[cp_turn_acceleration_still]	= 0.0
	actor[cp_turn_inertia_still]		= 0.0
	actor[cp_turn_speed_moving]			= 0.0
	actor[cp_turn_acceleration_moving]	= 0.0
	actor[cp_turn_inertia_moving]		= 0.0
	actor[cp_turn_speed_aiming]			= 0.0

	actor[cp_add_eyes]				= 0.0

	actor[cp_launch_scale_min]		= 100.0
	actor[cp_launch_scale_max]		= 100.0
	actor[cp_launch_hue_shift]		= 0.0

	actor[cp_bullet_spray_angle]	= 0.0
	actor[cp_player_bullet_rate]	= 0.0

	actor[cp_random_offset_x]		= 0.0
	actor[cp_random_offset_z]		= 0.0

	actor[cp_random_trajectory_offset]				= 0.0
	actor[cp_random_trajectory_offset_delay_min]	= 0.0
	actor[cp_random_trajectory_offset_delay_max]	= 0.0

	actor[cp_fence_bounce_percent]	= 50.0
	actor[cp_max_explosion_speed]	= 0.0

	actor[cp_rolly_polly_multiply]	= 0.0

	actor[cp_score]					= 0
	actor[cp_egg_count]				= 0
	actor[cp_basket_number]			= 0
	actor[cp_random_byebye_speed]	= 0
	actor[cp_exp_to_start]			= 0

	actor[cp_spring_multiply]		= 0.0
	actor[cp_basket_catch_time]		= 0.0

	actor[cp_difficulty_adjust_speed]	= 100.0

	actor[cp_spin_speed_min]		= 0.0
	actor[cp_spin_speed_max]		= 0.0
	actor[cp_spin_inertia]			= 0.0

	actor[cp_i_am_repelled_by]		= 0

	actor[cp_add_to_launcher]		= 0
	actor[cp_add_gate]				= 0

	actor[cp_launch_anim_delay]		= 0.0
	actor[cp_material_hardness]		= 0
	actor[cp_max_path_stop_dist]	= 0.0
	actor[cp_remove_between_stage]	= 0
	actor[cp_water_stickyness]		= 0.0
	actor[cp_incoming_arrow]		= 0
	actor[cp_bruise_fruit]			= 0
	actor[cp_check_in_pen]			= 0
	actor[cp_track_beastie_dist]	= 0.0
	actor[cp_lasso_tail]			= 0
	actor[cp_alight_time]			= 0.0

	actor[cp_move_target]			= "none"
-- use as template

	return actor
end


w_gun_type			= 2
w_gun_bone_name		= 3
w_shaft_bone_name	= 4
w_fire_anim_name	= 5
w_aim_anim_name		= 6
w_flare_exp_name	= 7
w_flare_exp_scale	= 8
w_aim_delay			= 9
w_bullet_scale		= 10
w_barrel_offset		= 11
w_no_shoot_dist		= 12
w_no_shoot_angle	= 13
w_recoil_angle		= 14
w_recoil_dist		= 15
w_reload_random		= 16

function WEAPON_preload( actor_code )
	local n = {}

	n[ci_actor_name]		= actor_code
	n[w_gun_type]			= "no_bone_aim"
	n[w_gun_bone_name]		= ""
	n[w_shaft_bone_name]	= ""
	n[w_fire_anim_name]		= ""
	n[w_aim_anim_name]		= ""
	n[w_flare_exp_name]		= ""
	n[w_flare_exp_scale]	= 100.0
	n[w_aim_delay]			= 1.0
	n[w_bullet_scale]		= 100.0
	n[w_barrel_offset]		= 0.0
	n[w_no_shoot_dist]		= 9.0
	n[w_no_shoot_angle]		= 0.0
	n[w_recoil_angle]		= 0.0
	n[w_recoil_dist]		= 0.0
	n[w_reload_random]		= 0.0

	return n
end

function WEAPON_add( n, seq )
	c_add_a_weapon( n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14], n[15], n[16], seq )
end


function dofile_lua( filename )
	local isloaded = c_is_model_preloaded( filename )
--	c_print( filename, isloaded )
	if isloaded ~= 0 then
		local filename_lua = format( "%s.lua", filename )
		multiple_colour_name = ""
		use_multiple_colour = 0
		dofile( filename_lua )

		if use_multiple_colour ~= 0 then
			multiple_colour_name = "r"
			use_multiple_colour = 1
			dofile( filename_lua )

			if use_multiple_colour > 1 then
				multiple_colour_name = "y"
				use_multiple_colour = 2
				dofile( filename_lua )

			end
		end
	end
	multiple_colour_name = ""
	use_multiple_colour = 0
end

-- leave me

