(include "sci.sh")
(use "Main")
(use "rmnScript")
(use "SQRoom")
(use "RandCycle")
(use "Class_950_0")
(use "ForwardCounter")
(use "n958")
(use "StopWalk")
(use "Sound")
(use "Cycle")
(use "InvI")
(use "User")
(use "PicView")
(use "Obj")
(script 335)



(instance public rm335 of SQRoom
    (properties
        picture 335
    )

    (method (init)
        proc958_0(128 0 4 402 14 336 331 335 339)
        proc958_0(132 872 878)
        (tanks:init())
        (send global32:
            add(tanks theArea)
            eachElementDo(102)
            doit()
        )
        (switch (global12)
            (case 330
                (zondra:init())
                (thoreen:init())
                (guard:init())
                (oxyTank:init())
                (send gEgo:
                    init()
                    posn(110 158)
                )
                (self:setScript(strapScript))
            )
            (case 345
                (slug:
                    init()
                    setScript(roarScript)
                )
                (send gEgo:
                    init()
                    normal(0)
                    moveHead(0)
                )
                (slugHead:init())
                (tongue:init())
                (oxyTank:init())
                (self:setScript(slugScript))
            )
            (case 341
                (slug:init())
                (send gEgo:
                    init()
                    view(336)
                    posn(139 154)
                    loop(0)
                    cel(6)
                    normal(0)
                    moveHead(0)
                )
                (slugHead:
                    init()
                    z(1000)
                )
                (tongue:
                    init()
                    z(1000)
                )
                (oxyTank:init())
                (self:setScript(escapeScript))
            )
            (case 350
                (huggers:
                    init()
                    setScript(hugScript)
                )
                (slugHead:
                    init()
                    setLoop(3)
                    x(144)
                    y(91)
                )
                (sinkSFX:init())
                (heroSFX:init())
                (ripples:init())
                (send gEgo:dispose())
            )
            (default 
                (zondra:init())
                (thoreen:init())
                (guard:init())
                (oxyTank:init())
                (send gEgo:
                    init()
                    posn(110 158)
                )
                (self:setScript(strapScript))
            )
        )
        (super:init())
    )

)
(instance slugScript of rmnScript
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    view(336)
                    illegalBits(0)
                    setLoop(0)
                    setCel(6)
                    setPri(10)
                    posn(139 154)
                )
                (zondra:
                    init()
                    view(336)
                    posn(162 165)
                    setLoop(1)
                    setCel(0)
                )
                (thoreen:init())
                (guard:
                    init()
                    posn(189 140)
                    setLoop(0)
                    setCel(0)
                )
                (oxyTank:init())
                = cycles 1
            )
            (case 1
                (self:save1(proc0_12("\"AAAIIIIHHHH!!! It's a sea slug! Run, girls!\"" 67 2 10 28 global130 29 global155 30 1 70 315)))
                (guard:
                    view(335)
                    setLoop(1)
                    xStep(6)
                    yStep(3)
                    setCycle(Walk)
                    setMotion(MoveTo 300 115 self)
                )
                (zondra:
                    view(335)
                    setLoop(0)
                    setCycle(Walk)
                    illegalBits(0)
                    xStep(6)
                    yStep(3)
                    setMotion(MoveTo 13 108)
                )
                (thoreen:
                    view(335)
                    setLoop(2)
                    setCycle(Walk)
                    illegalBits(0)
                    xStep(6)
                    yStep(3)
                    setMotion(MoveTo 18 185)
                )
            )
            (case 2
                (self:restore())
                = cycles 7
            )
            (case 3
                (send global2:newRoom(350))
            )
        )
    )

)
(instance roarScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 3
            )
            (case 1
                (slugHead:
                    setPri(6)
                    setCycle(End self)
                )
            )
            (case 2
                (tongue:
                    setPri(7)
                    setCycle(ForwardCounter 5 self)
                )
            )
            (case 3
                (tongue:dispose())
                (slugHead:setCycle(Beg self))
                = cycles 1
            )
            (case 4
                (roarScript:dispose())
            )
        )
    )

)
(instance strapScript of rmnScript
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                = cycles 1
            )
            (case 1
                (send gLongSong:hold(2))
                (send gEgo:
                    illegalBits(0)
                    setPri(9)
                    setCycle(Walk)
                    setMotion(MoveTo 139 154)
                )
                (zondra:
                    setLoop(2)
                    setCycle(Walk)
                    setPri(7)
                    setMotion(MoveTo 162 165 self)
                )
                (guard:
                    setLoop(1)
                    setCycle(Walk)
                    setMotion(MoveTo 189 140 self)
                )
            )
            (case 2
                (zondra:
                    view(336)
                    setLoop(1)
                    setCel(0)
                )
            )
            (case 3
                (guard:
                    view(331)
                    loop(0)
                    cel(0)
                )
                = cycles 1
            )
            (case 4
                (self:save1(proc0_12("\"Sit down!\"" 67 2 10 28 global130 29 global155 30 1 70 315)))
                = seconds 2
            )
            (case 5
                (self:restore())
                = cycles 1
            )
            (case 6
                (send gEgo:
                    normal(0)
                    moveHead(0)
                    illegalBits(0)
                    view(336)
                    setPri(10)
                    setCycle(End self)
                )
            )
            (case 7
                (thoreen:
                    cycleSpeed(1)
                    setCycle(End)
                )
                (zondra:
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 8
                (send gEgo:
                    normal(1)
                    moveHead(1)
                )
                (send global2:newRoom(340))
            )
        )
    )

)
(instance escapeScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    posn(139 154)
                    setCycle(Beg self)
                )
            )
            (case 1
                (send gEgo:
                    view(402)
                    setPri(6)
                    normal(1)
                    setCycle(Walk)
                    setMotion(MoveTo 181 152 self)
                )
            )
            (case 2
                (slugHead:
                    z(0)
                    setLoop(2)
                )
                (tongue:
                    z(0)
                    setLoop(0)
                    setCycle(RandCycle)
                )
                = cycles 1
            )
            (case 3
                proc0_9(14)
                (send gEgo:
                    setCycle(StopWalk 14 self)
                    setLoop(3)
                )
                = cycles 1
            )
            (case 4
                proc0_3()
                (User:canControl(0))
                (send gIconBar:disable(0))
                = seconds 8
            )
            (case 5
                proc0_2()
                (self:setScript(slugBaitScript))
            )
        )
    )

)
(instance oxyTankScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    normal(0)
                    moveHead(0)
                    view(337)
                    setPri(12)
                    setLoop(3)
                    cel(0)
                    setCycle(End)
                )
                = cycles 3
            )
            (case 1
                (send gEgo:get(7))
                (oxyTank:dispose())
                proc0_11(47 5)
                = cycles 2
            )
            (case 2
                (Inv:
                    curIcon((send global9:at(7)))
                    hide()
                )
                (send global1:setCursor((send ((send global9:curIcon)):cursor) 1))
                = cycles 1
            )
            (case 3
                (self:setScript(slugBaitScript))
            )
        )
    )

)
(instance slugBaitScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (tongue:setCycle(0))
                (slugHead:
                    setLoop(2)
                    cel(0)
                )
                = cycles 1
            )
            (case 1
                (tongue:
                    setLoop(2)
                    setCel(0)
                    setCycle(End)
                )
                = cycles 4
            )
            (case 2
                (send gEgo:
                    normal(1)
                    moveHead(1)
                    dispose()
                )
                = cycles 1
            )
            (case 3
                proc0_7(4)
                (send global2:newRoom(350))
            )
        )
    )

)
(instance hugScript of rmnScript
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (ripples:setCycle(ForwardCounter 2))
                (slugHead:
                    setPri(3)
                    x(144)
                    y(91)
                    setMotion(MoveTo 144 130 self)
                )
                = cycles 3
            )
            (case 1
                (sinkSFX:play())
                (ripples:
                    setLoop(5)
                    setCel(0)
                    setCycle(End)
                )
            )
            (case 2
                (sinkSFX:dispose())
                (ripples:dispose())
                (slugHead:dispose())
                (heroSFX:play())
                = cycles 1
            )
            (case 3
                (self:save1(proc0_12("\"OUR HERO!!\"" 67 2 10 28 global130 29 global155 30 1 70 315)))
                = seconds 4
            )
            (case 5
                (zondra:
                    init()
                    view(339)
                    setLoop(1)
                    setCel(0)
                    setCycle(Walk)
                    x(2)
                    y(107)
                    xStep(6)
                    yStep(3)
                    setMotion(MoveTo 137 106 self)
                )
                (guard:
                    init()
                    view(339)
                    setLoop(2)
                    setCel(0)
                    setCycle(Walk)
                    x(318)
                    y(108)
                    xStep(6)
                    yStep(3)
                    setMotion(MoveTo 183 108)
                )
                (thoreen:
                    init()
                    view(339)
                    setLoop(3)
                    setCel(1)
                    setCycle(Walk)
                    x(0)
                    y(215)
                    xStep(6)
                    yStep(4)
                    illegalBits(0)
                    setMotion(MoveTo 130 120)
                )
            )
            (case 6
                (huggers:
                    setCel(1)
                    setCycle(End)
                )
                (zondra:dispose())
                (guard:dispose())
                = cycles 4
            )
            (case 7
                (thoreen:dispose())
                = cycles 20
            )
            (case 8
                (huggers:setCycle(CT 4 -1))
                = cycles 4
            )
            (case 9
                (thoreen:
                    init()
                    view(336)
                    setLoop(2)
                    setCel(0)
                    x(137)
                    y(116)
                )
                = cycles 1
            )
            (case 10
                (self:save1(proc0_12("\"Wasn't he great, girls?\"" 67 2 10 28 global150 29 global129 30 1 70 315)))
                = seconds 7
            )
            (case 12
                (self:save1(proc0_12("\"Well Rog...I guess we can call it even. Thank you for ridding our fortress of that slimy, awful, sea slug.\"" 67 2 20 28 proc0_18(global153 global152) 29 global129 30 1 70 315)))
                = seconds 10
            )
            (case 14
                (self:save1(proc0_12("\"I..uh..I know I can't blame you for backing out at the last minute. I guess I was a little overbearing. Sorry. Can we still be good friends?\"" 67 2 20 28 proc0_18(global153 global152) 29 global129 30 1 70 315)))
                = seconds 10
            )
            (case 16
                (self:save1(proc0_12("\"Well,... now wait a minute. Let's talk about this.\"" 67 2 10 28 global140 29 global129 30 1 70 315)))
                = seconds 10
            )
            (case 18
                (self:save1(proc0_12("\"No Roger - you were right. You don't need to spare my feelings. It just wasn't meant to be. It's better this way.\"" 67 2 20 28 proc0_18(global153 global152) 29 global129 30 1 70 315)))
                = seconds 10
            )
            (case 20
                (self:save1(proc0_12("\"Well girls, I feel like celebrating. LET'S GO SHOPPING!!!\"" 67 2 20 28 proc0_18(global153 global152) 29 global129 30 1 70 315)))
                (heroSFX:fade())
                = seconds 8
            )
            (case 22
                (send gEgo:view(0))
                (send global2:newRoom(355))
            )
            (default 
                (self:restore())
                = cycles 1
            )
        )
    )

)
(instance sinkSFX of Sound
    (properties
        number 872
    )
)
(instance heroSFX of Sound
    (properties
        number 878
        loop -1
        flags 1
    )
)
(instance zondra of Actor
    (properties
        x 100
        y 110
        description "Zondra"
        sightAngle 90
        lookStr "Boy! You don't know what you did to make her mad, but you sure hope you get a chance to smooth things over."
        view 331
        loop 2
        priority 6
        signal 16400
    )
)
(instance thoreen of Actor
    (properties
        x 124
        y 169
        description "Thoreen"
        sightAngle 90
        lookStr "Compassion and warmth are not words which come to mind when surveying this person."
        view 336
        loop 2
        priority 9
        signal 16400
    )
)
(instance guard of Actor
    (properties
        x 68
        y 134
        description "guard"
        sightAngle 90
        lookStr "The guard looks on coldly."
        view 331
        loop 1
        priority 6
        signal 16400
    )
)
(instance tanks of Feature
    (properties
        x 207
        y 141
        nsTop 129
        nsLeft 195
        nsBottom 154
        nsRight 219
        description "oxygen tanks."
        sightAngle 180
        lookStr "You see what look like highly pressurized oxygen tanks."
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                (if (== (send ((send global9:at(7))):owner) 335)
                    (send global2:setScript(oxyTankScript))
                )(else
                    (super:doVerb(param1))
                )
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance tongue of Prop
    (properties
        x 157
        y 88
        description "Slug tongue"
        lookStr "Yep, it's that nasty slug tongue again. Scary to think of what he can do with that thing, isn't it?"
        view 337
        priority 7
        signal 16400
    )
)
(instance slug of Prop
    (properties
        x 158
        y 96
        description "sea slug"
        sightAngle 180
        lookStr "This isn't your garden variety slug."
        view 342
        priority 5
        signal 16
    )
)
(instance slugHead of Actor
    (properties
        x 158
        y 96
        description "slug head"
        sightAngle 180
        lookStr "Red eyes glare back at you."
        view 342
        loop 2
        priority 6
        signal 16400
    )
)
(instance huggers of Prop
    (properties
        x 161
        y 109
        view 339
        priority 7
        signal 16400
    )
)
(instance ripples of Prop
    (properties
        x 143
        y 72
        view 342
        loop 4
    )
)
(instance oxyTank of Prop
    (properties
        x 204
        y 153
        description "oxygen tank"
        sightAngle 90
        lookStr "You see what seem to be pressurized oxygen tanks."
        view 336
        loop 3
        priority 11
        signal 16400
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                (if (== (send ((send global9:at(7))):owner) 335)
                    (send global2:setScript(oxyTankScript))
                )(else
                    (super:doVerb(param1))
                )
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance theArea of Feature
    (properties
        x 156
        y 10
        nsBottom 200
        nsRight 320
        description "sea cave"
        sightAngle 180
        lookStr "This place is like a brick ship house."
    )

    (method (doVerb param1)
        (asm
            lsp     param1
            pushi   #doVerb
            pushi   1
            lsp     param1
            super   Feature, 6
            toss    
            ret     
        )
    )

)
