(version 2)
(include "sci.sh")
(exports
    0 rm630
)
(use "Main")
(use "FPRoom")
(use "Inset")
(use "Scaler")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "StopWalk")
(use "Cycle")
(use "View")
(use "Obj")
(script 630)


(local
    local0
    local1
    gEgoMoveSpeed
    local3
    local4
    local5

)
(instance public rm630 of FPRoom
    (properties
        noun 1
        style $0064
        south 610
    )

    (method (init)
        (if (proc0_2(58))
            (self:picture(780))
        )(else
            (self:picture(630))
        )
        (send gEgo:
            init()
            setScale(Scaler 105 84 155 108)
            normalize()
        )
        (switch (gGNumber)
            (case south
                (if (proc0_2(58))
                    proc0_4(44)
                    proc0_4(40)
                    proc0_4(42)
                    proc0_4(41)
                    proc0_4(43)
                    (send global2:setScript(sGetReady))
                )(else
                    (send global2:setScript(sEnterFromSouth))
                )
            )
            (case 680
                (send gGame:handsOn())
            )
            (case 26
                (if (proc0_2(80))
                    proc0_4(80)
                    (send gGame:handsOn())
                )(else
                    proc958_0(130 1814)
                    proc958_0(130 1800)
                    (send global2:setScript(sSepiaStart))
                )
            )
            (default 
                (if (proc0_2(58))
                    proc0_4(44)
                    proc0_4(40)
                    proc0_4(42)
                    proc0_4(41)
                    proc0_4(43)
                    (send global2:setScript(sGetReady))
                )(else
                    (if (== global119 14)
                        proc0_4(44)
                        proc0_4(40)
                        proc0_4(42)
                        proc0_4(41)
                        proc0_4(43)
                        (send global2:setScript(sCoarsegoldBurns))
                    )(else
                        (send gEgo:
                            x(140)
                            y(150)
                        )
                        (send gGame:handsOn())
                    )
                )
            )
        )
        (super:init())
        (if (== global119 14)
            0
        )(else
            (if (== gGNumber 26)
                0
            )(else
                (if (proc0_2(58))
                    (send gGameMusic1:
                        number(638)
                        loop(-1)
                        play()
                    )
                )(else
                    (send gGameMusic1:
                        number(630)
                        loop(-1)
                        play()
                    )
                )
            )
        )
        = local4 (send ((Polygon:new())):
                type(2)
                init(209 116 192 152 158 152 156 143 151 121 163 116)
                yourself()
            )
        (send global2:addObstacle(
            (if (proc0_2(43))
(                = local5 (send ((Polygon:new())):
                        type(2)
                        init(263 149 208 145 213 110 162 110 148 121 152 143 136 143 132 139 133 133 103 133 90 140 126 140 120 147 0 147 0 0 319 0 319 189 0 189 0 154 264 154)
                        yourself()
                    )
)            )(else
(                = local3 (send ((Polygon:new())):
                        type(2)
                        init(263 149 247 146 226 110 162 110 148 121 152 143 136 143 132 139 133 133 103 133 90 140 126 140 120 147 0 147 0 0 319 0 319 189 0 189 0 154 264 154)
                        yourself()
                    )
)            )
 local4 (send ((Polygon:new())):
                type(2)
                init(224 115 228 144 220 144 218 115)
                yourself()
            )
))
        (moose:
            init()
            setOnMeCheck(1 4)
        )
        (closet:
            init()
            setOnMeCheck(1 8)
        )
        (trunk:
            init()
            setOnMeCheck(1 16)
        )
        (bed:
            init()
            setOnMeCheck(1 32)
        )
        (photo:
            init()
            setOnMeCheck(1 64)
        )
        (lamp:
            init()
            setOnMeCheck(1 128)
        )
        (nightStand:
            init()
            setOnMeCheck(1 256)
        )
        (box:
            init()
            setOnMeCheck(1 1024)
        )
        (chair:
            init()
            setOnMeCheck(1 2048)
        )
        (dresser:
            init()
            setOnMeCheck(1 4096)
        )
        (bottles:
            init()
            setOnMeCheck(1 8192)
        )
        (stairs:
            init()
            setOnMeCheck(1 16384)
        )
        (moose1:
            init()
            setOnMeCheck(1 512)
        )
        (trunkLid:
            setCel(
                (if (proc0_2(44))
                    (trunkLid:lastCel())
                )(else
                    0
                )
)
            init()
            approachVerbs(4 1)
            stopUpd()
        )
        (nightDrawer:
            setCel(
                (if (proc0_2(40))
                    (nightDrawer:lastCel())
                )(else
                    0
                )
)
            init()
            approachVerbs(4 1)
            stopUpd()
        )
        (closetDoor:
            setCel(
                (if (proc0_2(42))
                    (closetDoor:lastCel())
                )(else
                    0
                )
)
            init()
            approachVerbs(4 1)
            stopUpd()
        )
        (closetDrawer:
            setCel(
                (if (proc0_2(41))
                    (closetDrawer:lastCel())
                )(else
                    0
                )
)
            init()
            approachVerbs(4 1)
            stopUpd()
        )
        (dresserDrawer:
            setCel(
                (if (proc0_2(43))
                    (dresserDrawer:lastCel())
                )(else
                    0
                )
)
            init()
            approachVerbs(4 1)
            stopUpd()
        )
        (if (proc0_2(58))
            (send gOldCast:eachElementDo(#hide))
        )
    )


    (method (doit)
        (super:doit())
        (if (local0 and (== PalVary(pvGET_CURRENT_STEP) 0))
            (sSepiaStart:cue())
            = local0 0
        )(else
            (if (local1 and (== PalVary(pvGET_CURRENT_STEP) 64))
                (sGetReady:cue())
                = local1 0
            )(else
                (if (script)
                )(else
                    (if (proc0_1(gEgo 2))
                        (send global2:setScript(sExitToSouth))
                    )(else
                        (if (proc0_1(gEgo 512) and (< (send gEgo:y) 130))
                            (send global2:setScript(sTopTrip))
                        )(else
                            (if (proc0_1(gEgo 512) and (> (send gEgo:y) 130))
                                (send global2:setScript(sBottomTrip))
                            )
                        )
                    )
                )
            )
        )
    )


    (method (dispose)
        (if ((<> global119 14) and (<> global119 19))
            (send gGameMusic1:fade())
        )
        (super:dispose())
    )

)
(instance sTopTrip of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                = cycles 1
            )
            (case 1
                (send gEgo:
                    view(
                        (if ((send gEgo:wearingGuns))
                            635
                        )(else
                            636
                        )
)
                    loop(2)
                    cel(0)
                    setSpeed(6)
                    setCycle(CT 3 1 self)
                )
            )
            (case 2
                (send gEgo:
                    setPri(9)
                    setCycle(End self)
                )
            )
            (case 3
                (send gEgo:
                    normalize()
                    y(147)
                    loop(2)
                    cel(2)
                    setMotion(MoveTo (send gEgo:x) 155 self)
                )
            )
            (case 4
                (send gEgo:
                    setSpeed(gEgoMoveSpeed)
                    setPri(-1)
                )
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sBottomTrip of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                = cycles 1
            )
            (case 1
                (send gEgo:
                    view(
                        (if ((send gEgo:wearingGuns))
                            635
                        )(else
                            636
                        )
)
                    loop(1)
                    cel(0)
                    setSpeed(6)
                    setCycle(CT 3 1 self)
                )
            )
            (case 2
                (send gEgo:
                    setPri(8)
                    setCycle(End self)
                )
            )
            (case 3
                (send gEgo:
                    normalize()
                    y(120)
                    loop(3)
                    cel(3)
                    setMotion(MoveTo (send gEgo:x) 115 self)
                )
            )
            (case 4
                (send gEgo:
                    setSpeed(gEgoMoveSpeed)
                    setPri(-1)
                )
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sEnterFromSouth of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    x(25)
                    y(189)
                    setPri(11)
                    setMotion(MoveTo 125 150 self)
                )
            )
            (case 1
                (send gEgo:setPri(-1))
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sExitToSouth of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (send gEgo:
                    setPri(11)
                    setLoop(1)
                    setMotion(MoveTo 25 189 self)
                )
            )
            (case 1
                (send global2:newRoom(610))
                (send gEgo:setPri(-1))
                (self:dispose())
            )
        )
    )

)
(instance sSepiaStart of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = local0 1
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                PalVary(pvINIT 630 0)
                (send gGame:setCursor(996))
                (send gIconBar:disable())
                (send gEgo:
                    view(633)
                    x(138)
                    y(87)
                    setLoop(1)
                    setCel(0)
                    cycleSpeed(12)
                    setCycle(0)
                    scaleSignal(0)
                )
                = cycles 1
            )
            (case 1
                PalVary(pvREVERSE 5 0 1)
            )
            (case 2
                (send gFpMessager:say(22 0 0 0 self))
            )
            (case 3
                (drawerSound:
                    number(2933)
                    play(self)
                )
            )
            (case 4
                (send gEgo:setCycle(End self))
            )
            (case 5
                (send gFpMessager:say(24 0 0 0 self))
            )
            (case 6
                (send gEgo:
                    setLoop(2)
                    setCel(0)
                    setCycle(End self)
                )
            )
            (case 7
                (send gEgo:
                    normalize()
                    x(148)
                    y(118)
                    loop(0)
                    cel(0)
                    setSpeed(gEgoMoveSpeed)
                    scaleSignal(1)
                )
                (send gGame:handsOn())
                (send gIconBar:enable())
                (self:dispose())
            )
        )
    )

)
(instance sCoarsegoldBurns of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                proc0_3(1)
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                = global119 14
                (send gEgo:put(28))
                (send gEgo:put(54))
                proc0_4(16)
                (send gEgo:
                    view(633)
                    x(141)
                    y(88)
                    setLoop(1)
                    setCel(0)
                    setCycle(0)
                    scaleSignal(0)
                    cycleSpeed(12)
                )
                (srini:
                    view(634)
                    x(157)
                    y(122)
                    setLoop(0)
                    setCel(0)
                    cycleSpeed(10)
                    setCycle(Fwd)
                    init()
                )
                (send gGameMusic1:
                    number(637)
                    loop(-1)
                    play()
                )
                (send (ScriptID(0 13)):setReal(ScriptID(0 13) 0 10))
                = cycles 1
            )
            (case 1
                proc0_9(1000 srini)
                = seconds 3
            )
            (case 2
                (srini:setCycle(End self))
            )
            (case 3
                (send gFpMessager:say(23 2 6 0 self))
            )
            (case 4
                (send gEgo:setCycle(End self))
            )
            (case 5
                (send gFpMessager:say(23 2 7 0 self))
            )
            (case 6
                (srini:
                    view(801)
                    setSpeed(4)
                    setCycle(StopWalk -1)
                    setMotion(MoveTo 230 114 self)
                )
            )
            (case 7
                (srini:setMotion(MoveTo 238 151 self))
            )
            (case 8
                (srini:setMotion(MoveTo 99 151 self))
            )
            (case 9
                (srini:setMotion(MoveTo 25 189 self))
            )
            (case 10
                (send gEgo:
                    setLoop(2)
                    setCel(0)
                    setCycle(End self)
                )
            )
            (case 11
                (send gEgo:
                    normalize()
                    x(149)
                    y(120)
                    cycleSpeed(gEgoMoveSpeed)
                    moveSpeed(gEgoMoveSpeed)
                    scaleSignal(1)
                    setHeading(90)
                )
                proc0_9(0)
                (send gGame:handsOn())
                (srini:dispose())
                (self:dispose())
            )
        )
    )

)
(instance sGetReady of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (send gEgo:
                    x(178)
                    y(121)
                    setHeading(90)
                    wearingGuns(1)
                    stopUpd()
                    normalize()
                    hide()
                )
                = cycles 1
            )
            (case 1
                = global120 4
                proc0_4(58)
                (send gGame:points(1))
                = cycles 10
            )
            (case 2
                proc0_9(26)
                (send gFpMessager:say(27 0 0 0 self))
            )
            (case 3
                (send gOldCast:eachElementDo(#show))
                (srini:
                    view(634)
                    loop(1)
                    x(199)
                    y(121)
                    cycleSpeed(13)
                    setScale(Scaler 105 84 155 108)
                    init()
                )
                (send global2:drawPic(630))
                = cycles 1
            )
            (case 4
                (srini:setCycle(End self))
            )
            (case 5
                (send gEgo:
                    show()
                    stopUpd()
                )
                (srini:
                    view(634)
                    setLoop(0)
                    setCel(8)
                    setCycle(End self)
                )
            )
            (case 6
                (srini:stopUpd())
                = cycles 5
            )
            (case 7
                (send gFpMessager:say(26 0 0 0 self))
            )
            (case 8
                (send gIconBar:disable())
                = local1 1
                PalVary(pvINIT 630 5)
            )
            (case 9
                proc0_15(1 0 self)
            )
            (case 10
                (send gOldCast:eachElementDo(#dispose))
                PalVary(pvUNINIT)
                = cycles 1
            )
            (case 11
                Palette(palSET_INTENSITY 0 256 0)
                (send global2:newRoom(26))
                (self:dispose())
            )
        )
    )

)
(instance sSkipCartoon of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_15(1 4 self)
            )
            (case 1
                (send gEgo:
                    normalize()
                    x(148)
                    y(118)
                    cycleSpeed(gEgoMoveSpeed)
                    moveSpeed(gEgoMoveSpeed)
                    scaleSignal(1)
                    setHeading(90)
                )
                (srini:dispose())
                = cycles 1
            )
            (case 2
                proc0_15(0 4 self)
            )
            (case 3
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance srini of Actor
    (properties
        x 209
        y 146
        view 801
        loop 4
        signal $4000
    )

    (method (cue)
        (send global2:setScript(sSkipCartoon))
    )

)
(instance trunkLid of Prop
    (properties
        x 83
        y 97
        noun 19
        approachX 104
        approachY 138
        view 630
        loop 2
        priority 6
        signal $4011
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (proc0_2(42))
                    (send gFpMessager:say(19 0 2))
                )(else
                    (if (proc0_2(44))
                        proc0_4(44)
                        (drawerSound:
                            number(2700)
                            play()
                        )
                        (self:setCycle(Beg self))
                    )(else
                        proc0_3(44)
                        (drawerSound:
                            number(2700)
                            play()
                        )
                        (self:setCycle(End self))
                    )
                )
            )
            (case 1
                (if ((not (send gEgo:has(10)) and proc0_2(44)) and (<> (send gEgo:wearingGuns) 1))
                    (send gEgo:stopUpd())
                    (send global2:setInset(inClothes))
                )(else
                    (if (proc0_2(44))
                        (send gFpMessager:say(noun 1 1))
                    )(else
                        (send gFpMessager:say(noun 1 0))
                    )
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )


    (method (cue)
        (self:stopUpd())
    )

)
(instance nightDrawer of Prop
    (properties
        x 169
        y 96
        noun 16
        approachX 161
        approachY 116
        view 632
        signal $4001
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (drawerSound:
                    number(2126)
                    play()
                )
                (if (proc0_2(40))
                    proc0_4(40)
                    (self:setCycle(Beg self))
                )(else
                    proc0_3(40)
                    (self:setCycle(End self))
                )
            )
            (case 1
                (if ((not (send gEgo:has(15)) and proc0_2(40)) and (<> (send gEgo:wearingGuns) 1))
                    (send gEgo:stopUpd())
                    (send global2:setInset(inKeyInset))
                )(else
                    (if (proc0_2(40))
                        (send gFpMessager:say(noun 1 1))
                    )(else
                        (send gFpMessager:say(noun 1 0))
                    )
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )


    (method (cue)
        (self:stopUpd())
    )

)
(instance closetDoor of Prop
    (properties
        x 62
        y 123
        noun 6
        approachX 104
        approachY 138
        view 630
        signal $4001
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (drawerSound:
                    number(2126)
                    play()
                )
                (if (proc0_2(42))
                    proc0_4(42)
                    (self:setCycle(Beg self))
                )(else
                    proc0_3(42)
                    (self:setCycle(End self))
                )
            )
            (case 1
                (if (proc0_2(42))
                    (send gFpMessager:say(noun 1 1))
                )(else
                    (send gFpMessager:say(noun 1 0))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )


    (method (cue)
        (self:stopUpd())
    )

)
(instance closetDrawer of Prop
    (properties
        x 45
        y 142
        noun 14
        approachX 104
        approachY 138
        view 630
        loop 1
        priority 8
        signal $4011
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (drawerSound:
                    number(2126)
                    play()
                )
                (if (proc0_2(41))
                    proc0_4(41)
                    (self:setCycle(Beg self))
                )(else
                    (self:setCycle(End))
                    proc0_3(41 self)
                )
            )
            (case 1
                (if (proc0_2(41))
                    (send gFpMessager:say(noun 1 1))
                )(else
                    (send gFpMessager:say(noun 1 0))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )


    (method (cue)
        (self:stopUpd())
    )

)
(instance dresserDrawer of Prop
    (properties
        x 248
        y 117
        noun 15
        approachX 207
        approachY 120
        view 631
        signal $4001
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (drawerSound:
                    number(2126)
                    play()
                )
                (if (proc0_2(43))
                    proc0_4(43)
                    (send ((send global2:obstacles)):delete(local5))
                    (send local5:dispose())
                    = local3 (send ((Polygon:new())):
                            type(2)
                            init(263 149 247 146 226 110 162 110 148 121 152 143 136 143 132 139 133 133 103 133 90 140 126 140 120 147 0 147 0 0 319 0 319 189 0 189 0 154 264 154)
                            yourself()
                        )
                    (send global2:addObstacle(local3))
                    (self:setCycle(Beg self))
                )(else
                    proc0_3(43)
                    (send ((send global2:obstacles)):delete(local3))
                    (send local3:dispose())
                    = local5 (send ((Polygon:new())):
                            type(2)
                            init(263 149 208 145 213 110 162 110 148 121 152 143 136 143 132 139 133 133 103 133 90 140 126 140 120 147 0 147 0 0 319 0 319 189 0 189 0 154 264 154)
                            yourself()
                        )
                    (send global2:addObstacle(local5))
                    (self:setCycle(End self))
                )
            )
            (case 1
                (if (proc0_2(43) and not proc0_2(106))
                    (send gEgo:stopUpd())
                    (send global2:setInset(inClaimCheck))
                )(else
                    (if (proc0_2(43))
                        (send gFpMessager:say(noun 1 1))
                    )(else
                        (send gFpMessager:say(noun 1 0))
                    )
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )


    (method (cue)
        (self:stopUpd())
    )

)
(instance moose of Feature
    (properties
        x 184
        y 124
        noun 2
    )
)
(instance closet of Feature
    (properties
        x 58
        y 100
        noun 4
    )
)
(instance trunk of Feature
    (properties
        x 101
        y 96
        noun 5
    )
)
(instance bed of Feature
    (properties
        x 131
        y 95
        noun 3
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (proc0_2(1))
                    (send gFpMessager:say(noun theVerb 4))
                )(else
                    (send gFpMessager:say(noun theVerb 3))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance photo of Feature
    (properties
        x 93
        y 68
        noun 13
    )
)
(instance lamp of Feature
    (properties
        x 177
        y 80
        noun 7
    )
)
(instance nightStand of Feature
    (properties
        x 177
        y 95
        noun 8
    )
)
(instance box of Feature
    (properties
        x 205
        y 90
        noun 9
    )
)
(instance chair of Feature
    (properties
        x 233
        y 90
        noun 10
    )
)
(instance dresser of Feature
    (properties
        x 259
        y 114
        noun 11
    )
)
(instance bottles of Feature
    (properties
        x 261
        y 83
        noun 12
    )
)
(instance stairs of Feature
    (properties
        x 12
        y 189
        noun 20
    )
)
(instance moose1 of Feature
    (properties
        x 184
        y 124
        noun 2
    )
)
(instance inClothes of Inset
    (properties
        view 630
        loop 3
        x 139
        y 68
        priority 15
        disposeNotOnMe 1
        noun 18
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (self:setScript(sInsetDispose))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance inKeyInset of Inset
    (properties
        view 632
        loop 1
        x 199
        y 62
        priority 15
        disposeNotOnMe 1
        noun 17
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (self:setScript(sInsetDispose))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance inClaimCheck of Inset
    (properties
        view 631
        loop 1
        x 248
        y 63
        priority 15
        disposeNotOnMe 1
        noun 21
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                proc0_3(106)
                (self:setScript(sInsetDispose))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance sInsetDispose of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (switch (client)
                    (case inClaimCheck
                        (send gEgo:get(7 inClaimCheck))
                        (send gGame:points(1))
                    )
                    (case inKeyInset
                        (send gEgo:get(15 inKeyInset))
                        (send gGame:points(1))
                    )
                    (case inClothes
                        (send gEgo:get(10 inClothes))
                        (send gGame:points(1))
                        (if ((((send gEgo:has(38)) and (send gEgo:has(52))) and (send gEgo:has(2))) and (send gEgo:has(44)))
                            proc0_3(58)
                        )
                    )
                )
                = cycles 5
            )
            (case 1
                (send client:dispose())
                (self:dispose())
            )
        )
    )

)
(instance drawerSound of FPSound
    (properties
        flags $0001
    )
)
