-- Siegfried Fennig 04.01.2003 Rev. 0
enigma.ConserveLevel=FALSE                  -- \dh\

levelw = 20
levelh = 13

create_world(levelw, levelh)
draw_border("st-rock5")
fill_floor("fl-rough", 0,0, level_width,level_height)

oxyd (18, 1)
oxyd ( 1,11)
fakeoxyd(18,11)

draw_stones( "st-rock5", { 1, 9}, {1,0}, 8)
draw_stones( "st-rock5", {10, 9}, {1,0}, 2)
draw_stones( "st-rock5", {13, 9}, {1,0}, 3)
draw_stones( "st-rock5", {17, 9}, {1,0}, 2)
draw_stones( "st-rock5", { 9, 1}, {0,1},10)

set_item("it-coin",10, 3,{value=1})
set_item("it-coin",10, 4,{value=1})
set_item("it-coin",10, 5,{value=1})
set_item("it-coin",10, 6,{value=1})
set_item("it-coin",10, 7,{value=1})

set_stone("st-coinslot",12, 3, {action="callback", target="ms1"})
set_stone("st-coinslot",14, 3, {action="callback", target="ms2"})
set_stone("st-coinslot",16, 3, {action="callback", target="ms3"})
set_stone("st-coinslot",12, 5, {action="callback", target="ms4"})
set_stone("st-coinslot",14, 5, {action="callback", target="ms5"})
set_stone("st-coinslot",16, 5, {action="callback", target="ms6"})
set_stone("st-coinslot",12, 7, {action="callback", target="ms7"})
set_stone("st-coinslot",14, 7, {action="callback", target="ms8"})
set_stone("st-coinslot",16, 7, {action="callback", target="ms9"})
set_stone("st-coinslot",16, 9, {action="openclose", target="door1"})
set_stone("st-door",12, 9, {name="door1", type="h"})
set_stone("st-coinslot",10,10, {action="onoff", target="laser1"})

set_attrib (mirrorp ( 3, 3, 1, 0,1), "name", "mirror01")
set_attrib (mirrorp ( 5, 3, 1, 0,1), "name", "mirror02")
set_attrib (mirrorp ( 7, 3, 1, 0,1), "name", "mirror03")
set_attrib (mirrorp ( 3, 5, 1, 0,1), "name", "mirror04")
set_attrib (mirrorp ( 5, 5, 1, 0,1), "name", "mirror05")
set_attrib (mirrorp ( 7, 5, 1, 0,1), "name", "mirror06")
set_attrib (mirrorp ( 3, 7, 1, 0,1), "name", "mirror07")
set_attrib (mirrorp ( 5, 7, 1, 0,1), "name", "mirror08")
set_attrib (mirrorp ( 7, 7, 1, 0,1), "name", "mirror09")
set_attrib (mirrorp ( 7, 1, 1, 0,1), "name", "mirror10")

set_stone( "st-timer", 0, 0, {action="callback", target="t_h1"})
set_stone( "st-timer",19, 0, {action="callback", target="t_h2"})

set_attrib(laser(  1, 3, FALSE, EAST), "name", "laser1")
set_stone( "st-laserswitch", 1, 1, {action="open", target="door2"})
set_stone("st-door", 9,11, {name="door2", type="v"})

function ms1()
       mir1=enigma.GetNamedObject("mirror01")
       enigma.SendMessage(mir1, "trigger", nil)
end

function ms2()
       mir1=enigma.GetNamedObject("mirror02")
       enigma.SendMessage(mir1, "trigger", nil)
end

function ms3()
       mir1=enigma.GetNamedObject("mirror03")
       enigma.SendMessage(mir1, "trigger", nil)
end

function ms4()
       mir1=enigma.GetNamedObject("mirror04")
       enigma.SendMessage(mir1, "trigger", nil)
end

function ms5()
       mir1=enigma.GetNamedObject("mirror05")
       enigma.SendMessage(mir1, "trigger", nil)
end

function ms6()
       mir1=enigma.GetNamedObject("mirror06")
       enigma.SendMessage(mir1, "trigger", nil)
end

function ms7()
       mir1=enigma.GetNamedObject("mirror07")
       enigma.SendMessage(mir1, "trigger", nil)
end

function ms8()
       mir1=enigma.GetNamedObject("mirror08")
       enigma.SendMessage(mir1, "trigger", nil)
end

function ms9()
       mir1=enigma.GetNamedObject("mirror09")
       enigma.SendMessage(mir1, "trigger", nil)
end

timer = 0

function t_h1()
       mir1=enigma.GetNamedObject("mirror01")
       mir2=enigma.GetNamedObject("mirror02")
       mir3=enigma.GetNamedObject("mirror03")
       mir4=enigma.GetNamedObject("mirror04")
       mir5=enigma.GetNamedObject("mirror05")
       mir6=enigma.GetNamedObject("mirror06")
       mir7=enigma.GetNamedObject("mirror07")
       mir8=enigma.GetNamedObject("mirror08")
    if timer == 1 then
       enigma.SendMessage(mir1, "turn", nil)
       enigma.SendMessage(mir2, "turn", nil)
       enigma.SendMessage(mir3, "turn", nil)
       enigma.SendMessage(mir4, "turn", nil)
       enigma.SendMessage(mir5, "turn", nil)
       enigma.SendMessage(mir6, "turn", nil)
       enigma.SendMessage(mir7, "turn", nil)
       enigma.SendMessage(mir8, "turn", nil)
    end
end

function t_h2()
       mir1=enigma.GetNamedObject("mirror09")
       mir2=enigma.GetNamedObject("mirror10")
        if timer == 1 then
       enigma.SendMessage(mir1, "turn", nil)
       enigma.SendMessage(mir2, "turn", nil)
    end
    timer = timer + 1
    if timer ==  2 then
        timer = 0
    end
end

set_actor("ac-blackball",18.5, 8.5, {player=0})
