function E0090()
    MNA()CMU("CS_MeltdownBeta")FAI(0)
end
function E0091()
    MNA()CMU("CS_MeltdownBeta")FAI(1)
end
function E0092()
    MNA()CMU("CS_MeltdownBeta")FAI(2)
end
function E0093()
    MNA()CMU("CS_MeltdownBeta")FAI(3)
end
function E0094()
    MNA()CMU("CS_MeltdownBeta")FAI(4)
end

function GoDarkPath()
    PRI()FAO(1)TRA("CS_darkpath","E0093",4,15)
end

function GoJenkaHouseAround()
    PRI()FAO(3)TRA("CS_jenka_house_around","E0091",32,20)
end

function Santa1()
    KEY()
    MS3("I'll wait until you get through")
    CAT("\nbefore going in.")NOD()
end

function Santa1SetFlag()
    Santa1()
end

function DarkMazeWaitForPlayer1()
    KEY()
    DNP("DarkMazeWaitForPlayer1")
    FLP("DarkMazeWaitForPlayer1")
    FLS("DarkMazeWaitForPlayer2")
    SNP("sys_trigger_v_allplayer",12,16,0,"mainLayer","DarkMazeWaitForPlayer2")
    DNP("CannotBack")
    ANP("LocalCamera1",0,1)--关闭局部相机
    MM0(PLY())SLR(PLY())WAI(16)
    FAO(2)
    --玩家1切换为杰克
    if(MCN(0) ~= "CS_mychar_jack") then
        SWP()
    end
    MOV(69,27,MCI("CS_mychar_jack"))
    MOV(73,27,MCI("CS_mychar_santa"))
    HMC(MCI("CS_mychar_santa"))--隐藏桑塔
    SNP("CS_santa_animate",73,27,0,"mainLayer","Santa1")--桑塔
    CNP("Santa1","Santa1SetFlag")
    SLR(0)
    FOM(0)
    FAI(0)
    WAI(16)
    FON("LocalCamera1",16)
    WAI(32)
    if(not FLJ("DarkMazePuzzle")) then
        FAC("jack_normal")MS3("This room is filled with huge rocks.")
        CAT("\nIt's hard to pass through.")NOD()
        CAT("\nUntil I solve it and get through,")
        CAT("\nSanta, please stay where you are.")NOD()CLR()
        FAC()CAT("\nGood idea.")NOD()CLR()
        FOM()
        CAT("Oh, by the way,")
        CAT("\nThis machine to my left seems to")
        CAT("\nreset this place.")NOD()
        CAT("\nIf you get stuck,")
        CAT("\nI can help you reset it.")NOD()CLR()
        FAC("jack_normal")CAT("\nI'll leave it to you then.")NOD()CLR()
        FAC()CAT("\nNo problem.")NOD()CLR()
    end
    --添加关卡重置技能
    AMC("levelreset_get")
    MS3("\n[Level Reset] has been added to your skill bar.")NOD()CLO()
    --如果是双玩家模式
    if(GOP() == 2) then
        --再加入一个杰克让玩家2控制
        CGP("CS_mychar_jack_p1","CS_mychar_jack_p2")
        SPL(1,"CS_mychar_jack_p2")
        P2A(false)--禁止玩家2使用AI切换
    else
        --玩家2置为NULL
        SGP("null",73,27,0,"CS_mychar_null_p2")
        SPL(1,"CS_mychar_null_p2")
    end
    ANP("LocalCamera1",0,0)--启动局部相机
    WAI(1)
    AMC("set_levelreset_pos")--保存重置关卡的坐标
end

function DarkMazeWaitForPlayer2()
    PRI()
    DNP("DarkMazeWaitForPlayer2")
    FLP("DarkMazeWaitForPlayer2")
    FAO(2)
    --删除桑塔动画
    DNP("Santa1")
    DNP("Santa1SetFlag")
    --如果是双玩家模式
    if(GOP() == 2) then
        --删除第二个杰克
        DGP("CS_mychar_jack_p2")
    else
        --删除玩家2的NULL
        DGP("CS_mychar_null_p2")
    end
    --玩家2恢复桑塔控制
    SPL(1,"CS_mychar_santa_p2")
    --移动和显示桑塔
    MOV(12,17,MCI("CS_mychar_santa"))
    SMC(MCI("CS_mychar_santa"))
    P2A()--启用玩家2使用AI切换
    --移动杰克
    MOV(10,17,MCI("CS_mychar_jack"))
    SLR(1,MCI("CS_mychar_jack"))
    if(not FLJ("DarkMazePuzzle")) then
        FAC("jack_normal")MS3("Santa, I'm coming over.")NOD()
        CAT("\nI'll use this machine to teleport")
        CAT("\nyou here now.")NOD()CLR()
        FAC()CAT("\nGot it.")NOD()CLO()
        FLP("DarkMazePuzzle")
    end
    KEY()
    WAI(32)
    RST("enemy","spike","trap")--重新生成含有这些名称的实体
    SOU("YNJOk")
    WAI(32)
    MM0()
    --移除关卡重置技能
    AMC("levelreset_lose")
    MS3("\n[Level Reset] function has been unbound.")NOD()CLO()
    --放置阻拦器
    SNP("sys_trigger_v_allplayer",15,16,0,"mainLayer","CannotBack")
    --可以从入口再次通过
    FLS("DarkMazeWaitForPlayer1")
    SNP("sys_trigger_v_allplayer",70,26,0,"mainLayer","DarkMazeWaitForPlayer1")
    FAI(0)
end

function CannotBack()
    KEY()
    MYB(1,PLY())WAS()
    FAC("jack_normal")MS3("\nIt's better not to go that way.")NOD()
end

--生命胶囊
function PathLifeCapsule4()
    PRI()SOU("CS_022_chest_open")CMU("CS_Fanfale2")DNP("PathLifeCapsule4")FLP("PathLifeCapsule4")
    MS4("Obtained =LIFE CAPSULE=!")WAI(160)NOD()RMU()
    MLP(5)
    CAT("\nMaximum health increased by 5!")NOD()
end