function E0090()
    InitRoom()FAI(0)
end
function E0091()
    InitRoom()FAI(1)
end
function E0092()
    InitRoom()FAI(2)
end
function E0093()
    InitRoom()FAI(3)
end
function E0094()
    InitRoom()FAI(4)
end

function InitRoom()
    MNA()
    if(FLJ("KingBack")) then
        CMU("CS_Quiet")
    else
        CMU("CS_Mura")
    end
end

--去集会场
function Door_GoKingHouse()
    PRI()MM0()SOU("CS_011_door")ANP("Door_GoKingHouse",0,1)FAO(0)TRA("CS_king_house","E0092",14,15)
end
--路牌【集会场】
function Sign_KingHouse()
    PRI()
    TUR()MS4("\n")CAT("-Assembly Hall-",2)NOD()
end

--去多隆子家
function Door_GoTorokoHouse()
    if(FLJ("JackSantaGo")) then
        PRI()MM0()SOU("CS_011_door")ANP("Door_GoTorokoHouse",0,1)FAO(0)TRA("CS_toroko_house","E0092",15,16)
    else
        if(FLJ("ThreeDaysLater")) then
            PRI()
            MS4("Jack said not to be seen")
            CAT("\nby others when leaving the village.")NOD()
            CAT("\nWe'd better get going quickly...")NOD()
        elseif(FLJ("GoTorokoHome")) then
            PRI()MM0()SOU("CS_011_door")ANP("Door_GoTorokoHouse",0,1)FAO(0)TRA("CS_toroko_house","AskEveryoneWhereMahinWent",15,16)
        elseif(FLJ("AskedToroko")) then
            PRI()
            MS4("They said Mahin will be back in a few days.")NOD()
            CAT("\nNo need to bother the girls...")NOD()
        else
            PRI()MM0()SOU("CS_011_door")ANP("Door_GoTorokoHouse",0,1)FAO(0)TRA("CS_toroko_house","E0092",15,16)
        end
    end
end
--路牌【多隆子和数的家】
function Sign_TorokoHouse()
    PRI()
    TUR()MS4("\n")CAT("-Toroko and Sue's House-",2)NOD()
end

--去渔屋
function Door_GoKanpaHouse()
    PRI()MM0()SOU("CS_011_door")ANP("Door_GoKanpaHouse",0,1)FAO(0)TRA("CS_kanpa_house","E0092",14,14)
end
--路牌【渔屋】
function Sign_KanpaHouse()
    PRI()
    TUR()MS4("\n")CAT("-Fisherman's Hut-",2)NOD()
end

--去桑塔家
function Door_GoSantaHouse()
    if(FLJ("JackSantaGo")) then
        PRI()MM0()SOU("CS_011_door")ANP("Door_GoSantaHouse",0,1)FAO(0)TRA("CS_santa_house","E0092",18,14)
    else
        PRI()
        MS4("\nThe door is locked.")NOD()
    end
end
--路牌【桑塔和怡可的家】
function Sign_SantaHouse()
    PRI()
    TUR()MS4("\n")CAT("-Santa and Chako's House-",2)NOD()
end

--去酒吧
function Door_GoBar()
    if(FLJ("KingBack")) then
        PRI()MM0()SOU("CS_011_door")ANP("Door_GoBar",0,1)FAO(0)TRA("CS_bar2","E0092",28,14)
    elseif(FLJ("JackSantaGo")) then
        PRI()MM0()SOU("CS_011_door")ANP("Door_GoBar",0,1)FAO(0)TRA("CS_bar","E0092",28,14)
    else
        PRI()
        MS4("\nNot open yet.")NOD()
    end
end

--去村子外围
function GoVillageAround()
    if(FLJ("ThreeDaysLater")) then
        PRI()FAO(1)TRA("CS_village_around","E0093",1,12,1,12)
    elseif(FLJ("GoTorokoHome") or FLJ("AskedToroko")) then
        --不让玩家出村子
        KEY()
        MYB(1,PLY())WAS()
        MS4("\nIt's almost dark, better not venture out.")NOD()
    end
end

--宝箱（地图系统）
function Chest_MapSystem()
    if(FLJ("Chest_MapSystem")) then
        Chest_MapSystem_Opened()
    else
        PRI()
        FLP("Chest_MapSystem")
        ITP("MapSystem")
        SOU("CS_022_chest_open")
        ANP("Chest_MapSystem",0,1)
        MS4("Opened the chest.")NOD()CLR()
        GIT("MapSystem")
        SOU("CS_038_get_item")
        CMU("CS_Fanfale1")
        CAT("\nGot the =MAP SYSTEM=.")WAI(160)NOD()RMU()CLR()
        Chest_MapSystem_Opened()
    end
end

--晾衣架
function DryingRack1()
    PRI()
    MS4("An empty clothes rack.")NOD()
end

function Chest_MapSystem_Opened()
    if(FLJ("KingBack")) then
        PRI()
        MS4("\nIt's empty...")NOD()CLR()
        FAC("king_normal")MS4("So the map system")
        CAT("\nhas already been taken...")NOD()
    else
        PRI()
        MS4("\nSomething's written here...")NOD()CLR()
        TUR()CAT("If you need to leave, ")
        CAT("\ntake this with you no matter what.")
        CAT("\n")CAT("—King",1)NOD()
        if(FLJ("JackSantaGo")) then
            if(ITJ("MapSystem") == false) then
                TUR(false)
                CLR()FAC("jack_normal")MS4("The Map System is no longer inside,")NOD()
                CAT("\nperhaps it's been moved elsewhere...")NOD()
                if(FLJ("FindMapSystem") == false) then
                    FLP("FindMapSystem")
                end
            end
        end
    end
end

function SueAndTorokoToGo()
    KEY()
    CMU("CS_Mura")
    SNP("CS_sue_animate",43,8,0,"mainLayer","Sue1")--数
    SNP("CS_toroko_animate",42,8,1,"mainLayer","Toroko1")--多隆子
    ANP("Toroko1","normal",1)
    FAI(0)
    WAI(32)
    FAC("sue_normal")MSG("\nToroko, are you ready?")NOD()CLR()
    FAC("toroko_><")CAT("\nMmm...")NOD()CLR()
    ANP("Sue1","angry")
    FAC("sue_normal")CAT("Then let's hurry while") 
    CAT("\nJack is still asleep!")NOD()CLR()CLO()
    WAI(32)
    FAO(0)
    TRA("CS_village_around","SueAndTorokoLookForCat",58,13)
end

function TorokoHasBeenCaptured()
    KEY()
    CMU("CS_Escape")
    SNP("CS_toroko_animate",59,12,0,"mainLayer","Toroko1")--多隆子
    ANP("Toroko1","run_max_speed",0)
    SNP("CS_bubble_catcher",60,12,0,"mainLayer","Bubble1")--泡泡
    ANP("Bubble1","set_target")
    ANP("Bubble1","Toroko1")
    SNP("CS_chako_animate",29,14,0,"mainLayer","Chako1")--怡可
    ANP("Chako1","back")
    ANP("DryingRack1",0,1)
    FAI(1)
    WAI(64)
    SOU("CS_021_bubble")
    DNP("Toroko1")
    ANP("Bubble1","caught_toroko")
    ANP("Bubble1","turn",1)
    WAI(32)
    FAC("toroko_><")TUR()MSG("\nBig sis Chako!!")WAI(32)
    ANP("Chako1","normal",1)
    WAI(48)CLO()
    SNP("CS_sparkitem",0,0,0,"mainLayer","SparkItem1")--项链
    MNP("SparkItem1","Bubble1")
    WAI(32)
    ANP("Chako1","walk",1)
    WAI(32)
    WAI(32)
    WAI(32)
    ANP("Chako1","normal",1)
    WAI(32)
    ANP("Chako1","look_up")
    PMU(2)
    WAI(60)
    FAO(0)
    TRA("CS_king_house","ChakoWakeJackUp",14,15)
end

function TorokoNecklace()
    PRI()
    MS4("\nThis is Toroko's pendant...")NOD()CLR()
    ITP("TorokoNecklace")
    GIT("TorokoNecklace")
    SOU("CS_038_get_item")
    DNP("TorokoNecklace")
    FLS("TorokoNecklace")
    CMU("CS_Fanfale1")
    CAT("\nObtained =TOROKO'S PENDANT=")WAI(160)NOD()
    RMU()
end

function SoapComing()
    KEY()
    HMC()
    CMU("CS_Dr")
    FAI(0)
    SNP("CS_soapwalker_animate",58,-1,0,"mainLayer","SoapWalker1")
    ANP("SoapWalker1",1010,0)
    WAI(128)
    SNP("CS_puu_animate",50,-1,0,"mainLayer","Puu1")
    ANP("Puu1",1010,0)
    WAI(128)
    FAC("soapwalker_normal")MS3("Not cool, bro. Can't you land")
    CAT("\nquietly like me?")NOD()
    CAT("\nYou're scaring away all") 
    CAT("\nour prey.")NOD()CLR()
    FAC("puu_normal")CAT("Sorry.")NOD()CLR()
    FAC("soapwalker_normal")CAT("I can't wait to see")
    CAT("\ntheir adorable little faces.")NOD()CLR()
    FAC("puu_normal")CAT("I'll search this area,") 
    CAT("\nyou take that one.")NOD()CLR()
    FAC("soapwalker_normal")CAT("\nThat's the plan~")NOD()CLO()
    FAO(2)
    TRA("CS_santa_house","HideInBasement",18,14)
end

function SoapSearch()
    KEY()
    SNP("CS_soapwalker_animate",12,15,0,"mainLayer","SoapWalker1")
    ANP("SoapWalker1","walk",1)
    FAI(0)
    WAI(32)
    SOU("CS_011_door")ANP("Door_GoKingHouse",0,1)
    WAI(32)
    ANP("SoapWalker1","look_down",1)
    SNP("CS_puu_animate",23,14,0,"mainLayer","Puu1")
    WAI(16)
    ANP("SoapWalker1","normal",1)
    WAI(16)
    SOU("CS_011_door")ANP("Door_GoKingHouse",0,0)
    WAI(16)
    FAC("soapwalker_normal")MS3("\nFound anything?")NOD()CLR()
    FAC("puu_normal")CAT("No,")NOD()CAT("not a single one.")
    CAT("\nMust be because") 
    CAT("\nI came hunting yesterday")NOD()
    CAT("\nand scared them all off...")NOD()CLR()
    FAC("soapwalker_normal")CAT("You should've called me") 
    CAT("\nto join you yesterday...")NOD()CLO()
    ANP("Puu1","normal",1)
    WAI(32)
    FAC("puu_normal")MS3("Well, three should be enough")
    CAT("\nto satisfy the Gaudis, at least.")NOD()CLR()
    ANP("SoapWalker1","look_normal",1)
    FAC("soapwalker_normal")CAT("No way, three isn't nearly enough...")NOD()
    CAT("\nThat fish you lost was worth way")
    CAT("\nmore than these three...")NOD()
    CAT("\nWe need at least seven to ")
    CAT("\nmake up for your mistake.")NOD()CLR()
    CAT("Better figure something out before")
    CAT("\nour boss discovers") 
    CAT("\nthe fish is missing...")NOD()CLO()
    WAI(64)
    ANP("Puu1","normal",0)
    WAI(32)
    FAC("puu_normal")MS3("If only we could interrogate")
    CAT("\nthem about the fish,")NOD()CLR()
    ANP("SoapWalker1","look_down",1)
    FAC("soapwalker_normal")CAT("\nthink you understand Mimiga language?")NOD()CLR()
    FAC("puu_normal")MS3("No idea, but I've got a") 
    CAT("\nbad feeling about this.。")NOD()CLR()
    FAC("soapwalker_normal")CAT("Afraid the boss will find out today")
    CAT("\nand turn you into a fish?")NOD()CLR()
    ANP("Puu1","normal",1)
    ANP("SoapWalker1","look_normal",1)
    FAC("puu_normal")CAT("Stop it.") 
    CAT("\nLet's just head back for now.")NOD()CLR()
    FAC("soapwalker_normal")CAT("\nYeah...")NOD()CLO()
    PMU(1)
    ANP("Puu1","walk",1)
    WAI(16)
    ANP("SoapWalker1","walk",1)
    WAI(64)
    ANP("Puu1","normal",1)
    WAI(16)
    ANP("Puu1","leave",1)
    ANP("SoapWalker1","normal",1)
    WAI(128)
    ANP("SoapWalker1","normal",0)
    WAI(64)
    FAO(2)
    TRA("CS_santa_house","ChakoObserve",18,14)
end

function ChakoGoKingHouseGetFood()
    KEY()
    FAI(0)
    WAI(32)
    SOU("CS_011_door")ANP("Door_GoSantaHouse",0,1)
    WAI(16)
    SNP("CS_chako_animate",14,15,1,"mainLayer","Chako1")
    WAI(16)
    SOU("CS_011_door")ANP("Door_GoSantaHouse",0,0)
    WAI(32)
    ANP("Chako1","normal",0)
    WAI(32)
    ANP("Chako1","normal",1)
    WAI(32)
    FAC("chako_normal")MS3("Looks like they're really gone.")NOD()
    CAT("\nI should hurry and grab it.")NOD()CLO()
    FON("Chako1")
    WAI(32)
    ANP("Chako1","walk",1)
    WAI(64)
    SNP("CS_soapwalker_animate",28,-1,0,"mainLayer","SoapWalker1")
    ANP("SoapWalker1",1060,0)
    ANP("SoapWalker1","look_down",0)
    WAI(80)
    ANP("Chako1","normal",1)
    WAI(32)
    FAC("soapwalker_normal")MS3("Oh, there's a cutie here after all.")NOD()
    CAT("\nLooking closer,") 
    CAT("\nseems like quite the beauty too.")NOD()
    CAT("\nGood thing I didn't leave right away.")NOD()CLO()
    WAI(16)
    ANP("Chako1","back",1)
    SOU("CS_011_door")ANP("Door_GoKingHouse",0,1)
    WAI(16)
    DNP("Chako1")
    WAI(16)
    SOU("CS_011_door")ANP("Door_GoKingHouse",0,0)
    WAI(32)
    FAC("soapwalker_angry")MS3("\nHey! Don't act like I don't exist!")NOD()CLO()
    FAO(2)
    FOM()
    TRA("CS_king_house","ChakoHidden",14,15)
end

function ChakoGetCaught()
    KEY()
    SNP("CS_soapwalker_animate",21,14,1,"mainLayer","SoapWalker1")
    ANP("SoapWalker1","look_down",1)
    FON("Door_GoKingHouse",0)
    FAI(0)
    WAI(32)
    SOU("CS_011_door")ANP("Door_GoKingHouse",0,1)
    WAI(16)
    SNP("CS_chako_animate",23,14,1,"mainLayer","Chako1")
    WAI(16)
    SOU("CS_011_door")ANP("Door_GoKingHouse",0,0)
    WAI(16)
    ANP("Chako1","walk",1)
    WAI(32)
    ANP("Chako1","normal",0)
    WAI(32)
    MS3("\n.")WAI(8)CAT(".")WAI(8)CAT(".")WAI(8)CAT(".")WAI(8)CAT(".")WAI(8)CAT(".")NOD()CLO()
    WAI(32)
    FAC("soapwalker_normal")MS3("So you didn't flee...")NOD()
    CAT("\nAren't you afraid of me?")NOD()CLR()
    FAC("chako_normal")CAT("here's nothing frightening") 
    CAT("\nabout this.")NOD()CLR()
    FAC("soapwalker_normal")CAT("\n.")WAI(8)CAT(".")WAI(8)CAT(".")WAI(8)CAT(".")WAI(8)CAT(".")WAI(8)CAT(".")WAI(8)NOD()CLO()
    ANP("SoapWalker1","walk",1)
    WAI(32)
    WAI(8)
    ANP("Chako1","look_up",0)
    ANP("SoapWalker1","look_bottom",1)
    WAI(8)
    ANP("SoapWalker1","normal",1)
    WAI(16)
    ANP("SoapWalker1","catch_chako",0)
    DNP("Chako1")
    WAI(8)
    ANP("SoapWalker1","catch_chako",1)
    WAI(8)
    ANP("SoapWalker1","catch_chako",2)
    WAI(16)
    FAC("soapwalker_normal")MS3("\nHow about now?")NOD()CLR()
    ANP("SoapWalker1","catch_chako",3)
    FAC("chako_normal")CAT("\nI'm not afraid.")NOD()CLR()
    ANP("SoapWalker1","catch_chako",4)
    FAC("soapwalker_normal")CAT("Fine then. Time to")
    CAT("\nprepare for takeoff.")NOD()CLO()
    ANP("SoapWalker1","catch_chako",5)
    WAI(8)
    ANP("SoapWalker1","catch_chako",6)
    WAI(32)
    ANP("SoapWalker1","catch_chako",7)
    WAI(96)
    FAO(0)TRA("CS_sea_entrance","FallIntoSea",20,0)
end

function KingBack()
    KEY()
    SNP("sys_trigger_h_player1",32,14,1,"mainLayer","Camera1")
    FON("Camera1",1)
    SLR(0,0)
    AMC("walk")
    CMU("CS_Quiet")
    FAI(2)
    WAI(8*16-4)
    AMC("normal")
    WAI(32)
    AMC("normal",1)
    WAI(64)
    AMC("normal",0)
    WAI(32)
    FAC("king_normal")MS3("\nIt feels so quiet here.")NOD()CLO()
    AMC("back")
    WAI(32)
    SOU("CS_011_door")ANP("Door_GoKingHouse",0,1)FAO(0)TRA("CS_king_house","KingBack",14,15)
end

function KingLeaveBar()
    KEY()
    HMC(0)
    FAI(2)
    WAI(32)
    SOU("CS_011_door")ANP("Door_GoBar",0,1)
    WAI(32)
    SMC(0)
    WAI(32)
    SOU("CS_011_door")ANP("Door_GoBar",0,0)
    WAI(16)
    FAC("king_normal")MS3("Damn it,")NOD()
    CAT("\nNot a single person") 
    CAT("\naround after all...")NOD()CLO()
    WAI(32)
    AMC("walk",1)
    WAI(8*16)
    AMC("normal",1)
    CMU("XXXX")
    SOU("CS_011_door")ANP("Door_GoSantaHouse",0,1)
    WAI(16)
    SNP("CS_colon_animate",14,15,0,"mainLayer","Colon1")
    WAI(32)
    MS3("\nSo Chief King really did come back!")NOD()CLR()
    FAC("king_normal")CAT("Where did you all come from...?")NOD()
    CAT("\nDon't tell me everyone's") 
    CAT("\nplaying hide-and-seek with me.")NOD()CLR()
    FAC()CAT("\nThat's not it!")NOD()CLR()
    FAC("king_normal")CAT("\nSo what exactly happened...?")NOD()CLO()
    WAI(32)
    FAO(0)
    TRA("CS_santa_house","KingAndColon",25,14)
end