(include "sci.sh")
(use "Main")
(use "Blink")
(use "CueObj")
(use "Cycle")
(use "Sounds")
(use "View")
(use "Obj")
(script 109)


(local
    local0
    local1 = 65535

)
(class starCon of Rgn
    (properties
        script 0
        number 0
        modNum -1
        noun 0
        timer 0
        keep 0
        initialized 0
    )

    (method (init param1)
        (super:init(rest param1))
        (send gSQ5Narrator:y(20))
        (if (proc999_5(gModNum 121 125 122 123 117 115))
            (send gEgo:baseSetter(myBaseSetter))
        )(else
            (send gEgo:baseSetter(0))
        )
        (if (proc999_5(gModNum 115 117 119 121 122 123 125))
            (if (not proc999_5(gGModNum 115 117 119 121 122 123 125 135))
                (send gSq5Music1:
                    number(5)
                    setLoop(-1)
                    play()
                )
            )
        )(else
            (if (proc999_5(gGModNum 115 117 119 121 122 123 125))
                (send gSq5Music1:fade(0 10 5 1))
            )
        )
        (if (proc999_5(gModNum 121 122 123 125))
            (hallPeople:init())
            (bayFeature:
                init()
                setOnMeCheck(1 64)
            )
        )
    )


    (method (dispose param1)
        (send gSQ5Narrator:y(-1))
        (super:dispose(rest param1))
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                (
                (if (proc999_5(gModNum 121 122 123 125))
                    (send gTestMessager:say(3 1 0 (+ (= local1 (% ++local1 4)) 1) 0 109))
                )
 )
            )
            (case 18
                ((send gTestMessager:say(0 18 1 0 0 109))  )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )


    (method (newRoom param1)
        = keep proc999_5(param1 110 115 117 119 121 122 123 125 127 132 133 135 137 165 166 195)
        = initialized 0
        (if (proc999_5(gModNum 121 125 122 123))
            (hallPeople:dispose())
        )
        (super:newRoom(param1))
    )

)
(instance hallPeople of Prop
    (properties
        noun 2
        view 147
        signal 16384
    )

    (method (init)
        (switch (gModNum)
            (case 121
                ((self:
                    loop(0)
                    cel(0)
                    x(110)
                    y(146)
                    approachX(130)
                    approachY(151)
                )
 = local0 1  )
            )
            (case 122
                ((self:
                    loop(1)
                    cel(0)
                    x(127)
                    y(130)
                    approachX(131)
                    approachY(138)
                )
 = local0 2  )
            )
            (case 123
                ((self:
                    loop(3)
                    cel(0)
                    x(219)
                    y(135)
                    approachX(218)
                    approachY(142)
                )
 = local0 3 (super:init()) (self:
                    approachVerbs(4 24 2)
                    setScript(sHallPeople)
                )
  )
            )
            (case 125
                ((self:
                    loop(2)
                    cel(0)
                    x(105)
                    y(148)
                    approachX(126)
                    approachY(142)
                )
 = local0 4 )
            )
        )
        (if (proc0_1(1) and proc999_5(gModNum 121 122 125))
            (super:init())
            (self:
                approachVerbs(4 24 2)
                setScript(sHallPeople)
            )
        )
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 4
                ((send gTestMessager:say(noun param1 0 local0 0 109))  )
            )
            (case 1
                ((send gTestMessager:say(noun param1 0 local0 0 109))  )
            )
            (case 2
                ((send gTestMessager:say(noun param1 0 local0 0 109))  )
            )
            (case 24
                ((send gTestMessager:say(noun param1 0 local0 0 109))  )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance bayFeature of Feature
    (properties
        x 5
        y 5
        noun 1
        modNum 109
        onMeCheck 64
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 1
                ((send gTestMessager:say(1 1 0 (+ (= local1 (% ++local1 4)) 1) 0 109))  )
            )
            (case 18
                ((send gTestMessager:say(0 18 1 0 0 109))  )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance myBaseSetter of Code
    (properties)

    (method (doit param1)
        (var temp0, temp1, temp2, temp3)
        = temp0 (/ (- (send param1:nsBottom) (send param1:nsTop)) 20)
        = temp1 (/ (* CelWide((send param1:view) (send param1:loop) (send param1:cel)) (send param1:scaleX)) 140)
        = temp2 (- (send param1:x) (/ temp1 2))
        = temp3 (- (send param1:y) (/ temp0 2))
        (send param1:
            brLeft(temp2)
            brRight(+ temp2 temp1)
            brTop(temp3)
            brBottom(+ temp3 temp0)
        )
    )

)
(instance sHallPeople of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((hallPeople:setCycle(End self))  )
            )
            (case 1
                (= seconds Random(1 2)  )
            )
            (case 2
                ((hallPeople:setCycle(Beg self))  )
            )
            (case 3
                (= state -1 = seconds Random(4 7)  )
            )
            (case 4
                ((self:dispose()) )
            )
        )
    )

)
(instance public sTestTimer of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= seconds 300  )
            )
            (case 1
                ((send gTestMessager:say(4 0 2 1 self 109))  )
            )
            (case 2
                (= seconds 180  )
            )
            (case 3
                ((send gTestMessager:say(4 0 2 2 self 109))  )
            )
            (case 4
                (= seconds 60  )
            )
            (case 5
                ((send gTestMessager:say(4 0 2 3 self 109))  )
            )
            (case 6
                (= seconds 30  )
            )
            (case 7
                ((send gRoom:newRoom(195)) (self:dispose()) )
            )
        )
    )

)
(instance public sCrestTimer of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= seconds 300  )
            )
            (case 1
                ((send gTestMessager:say(4 0 3 1 self 109))  )
            )
            (case 2
                (= seconds 180  )
            )
            (case 3
                ((send gTestMessager:say(4 0 3 2 self 109))  )
            )
            (case 4
                (= seconds 60  )
            )
            (case 5
                ((send gTestMessager:say(4 0 3 3 self 109))  )
            )
            (case 6
                (= seconds 30  )
            )
            (case 7
                ((send gRoom:newRoom(195)) (self:dispose()) )
            )
        )
    )

)
(instance public sExitSouth of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gRoom:newRoom(register)) )
            )
        )
    )

)
(instance public sEnterSouth of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gEgo:
                    setPri(-1)
                    setLoop(3)
                    posn(160 160)
                    setMotion(MoveTo 160 140 self)
                )
  )
            )
            (case 1
                ((send gEgo:setLoop(-1)) (send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance public sEnterNorth of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gEgo:
                    setPri(0)
                    x(115)
                    y(105)
                    setMotion(MoveTo 143 107 self)
                )
  )
            )
            (case 1
                ((send gEgo:setMotion(MoveTo 147 112 self))  )
            )
            (case 2
                ((send gEgo:setPri(-1)) (send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance public sExitNorth of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gEgo:
                    setPri(0)
                    setMotion(MoveTo 115 105 self)
                )
  )
            )
            (case 1
                ((send gRoom:newRoom(register)) )
            )
        )
    )

)
(instance public cadetsTalker of Narrator
    (properties)

    (method (init param1)
        = font gFont
        = gSq5Win gNewSpeakWindow
        (switch (gModNum)
            (case 121
                ((send gSq5Win:
                    tailX(100)
                    tailY(90)
                    xOffset(0)
                )
  )
            )
            (case 122
                ((send gSq5Win:
                    tailX(110)
                    tailY(90)
                    xOffset(0)
                )
  )
            )
            (case 123
                ((send gSq5Win:
                    tailX(225)
                    tailY(90)
                    xOffset(1)
                )
  )
            )
            (case 125
                ((send gSq5Win:
                    tailX(104)
                    tailY(85)
                    xOffset(6)
                )
 )
            )
        )
        (super:init(rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
