(version 2)
(include "sci.sh")
(exports
    0 rm102
)
(use "Main")
(use "GloryWindow")
(use "TellerIcon")
(use "Blink")
(use "CueObj")
(use "GameControls")
(use "Game")
(use "User")
(use "Obj")
(script 102)


(local
    local0[4] = (0 -2 -3 999 )
    local4[6] = (0 4 5 6 7 999 )
    local10[5] = (0 -8 -9 -10 999 )
    local15[6] = (0 11 12 13 14 999 )
    local21[6] = (0 15 16 17 18 999 )
    local27[5] = (0 19 20 -21 999 )
    local32[7] = (0 25 26 28 23 24 999 )
    local39[8] = (0 -2 -3 -8 -9 -10 -21 999 )
    local47[8]

)
(instance public rm102 of Rm
    (properties
        picture 130
    )

    (method (init param1)
        (User:canInput(1))
        (send gGame:setCursor(999))
        (super:init(rest param1))
        = local47[0] @local0
        = local47[1] @local4
        = local47[2] @local10
        = local47[3] @local15
        = local47[4] @local21
        = local47[5] @local27
        = local47[6] @local32
        (Narrator:talkWidth(250))
        (infoTeller:init(info @local0 @local47 @local39))
        (info:init())
        Animate((send gGQg3KDHandler:elements) 0)
        (infoTeller:doVerb(2))
    )

)
(instance infoTeller of Teller
    (properties)

    (method (respond)
        = query (self:showDialog())
        (if ((<> query -999) and iconValue)
            = query iconValue
        )
        (if (== query -999)
            return (send global2:newRoom(130))
        )(else
            (if (== query 999)
                (self:doParent())
                return 0
            )(else
                (if ((< query 0) and not (self:doChild(query)))
                    return 1
                )
            )
        )
        = query Abs(query)
        (send gQg3Messager:say((send client:noun) 5 query 0 self))
        return 1
    )


    (method (doDialog param1)
        (var temp0, temp1, temp2, temp3, newInfoIcon, temp5, temp6, temp7, temp8, newList, temp10, temp11, temp12, temp13, temp14, temp15[30])
        = temp3 0
        = temp0 param1[temp3]
        = temp5 5
        = temp8 0
        = newInfoIcon 0
        = newList (List:new())
        (send (= theControls (GameControls:new())):window((send ((GloryWindow:new())):
                top(40)
                left(85)
                bottom(140)
                right(235)
                priority(15)
                yourself()
            )
))
        (if (proc999_5(curArray @local0 @local10))
            = temp5 (+ temp5 15)
        )
        = temp2 1
        (while (<> proc999_6(curArray temp2) 999)
            = temp6 1
            = temp3 1
            (while (temp6 and (< temp3 paramTotal))
                (if ((== proc999_6(curArray temp2) param1[temp3]) and not param1[(+ temp3 1)])
                    = temp6 0
                )
                = temp3 (+ temp3 2)
            )
            (if (temp6)
                = temp7 proc999_6(curArray temp2)
                = temp14 (self:getSeqNum(Abs(temp7)))
                = temp13 Message(2 gClientModNum (send client:noun) 2 Abs(temp7) temp14)
                (if (not temp13)
                    break
                )
                = temp1 Memory(2 temp13)
                (send newList:add(temp1))
                Message(0 gClientModNum (send client:noun) 2 Abs(temp7) temp14 temp1)
                = newInfoIcon (infoIcon:new())
                (send newInfoIcon:
                    myHandle(temp1)
                    value(temp7)
                    nsTop(temp5)
                    myTeller(self)
                )
                (if (<> client gOwner)
                    (send newInfoIcon:notEgo(1))
                )
                (send theControls:add(newInfoIcon))
                ++temp8
                = temp5 (+ temp5 15)
            )
            ++temp2
        )
        (if (not IsObject(newInfoIcon))
            (send ((send theControls:window)):dispose())
            (send theControls:dispose())
            (send newList:dispose())
            return -999
        )
        = newInfoIcon (infoIcon:new())
        (if (not temp0)
            Message(0 23 0 0 2 1 @temp15)
            (send newInfoIcon:
                myHandle(@temp15)
                value(999)
                nsTop(temp5)
                myTeller(self)
            )
        )(else
            Message(0 23 0 0 3 1 @temp15)
            (send newInfoIcon:
                myHandle(@temp15)
                value(-999)
                nsTop(temp5)
                myTeller(self)
            )
        )
        (send theControls:add(newInfoIcon))
        (send ((send theControls:window)):
            top(- 60 (* 7 temp8))
            bottom(- (+ temp5 80) (* 7 temp8))
        )
        (send theControls:
            init()
            show()
            dispose()
        )
        = temp10 FirstNode((send newList:elements))
        (while (temp10)
            = temp11 NextNode(temp10)
            = temp12 NodeValue(temp10)
            (if (not temp12)
                break
            )
            Memory(3 temp12)
            = temp10 temp11
        )
        return (send newList:dispose())
    )


    (method (doChild param1)
        return 
            (switch (param1)
                (case -2
                    (super:doChild(param1))
                    (self:cue())
                    return 0
                )
                (case -3
                    (super:doChild(param1))
                    (self:cue())
                    return 0
                )
                (case -8
                    (super:doChild(param1))
                    (self:cue())
                    return 0
                )
                (case -9
                    (super:doChild(param1))
                    (self:cue())
                    return 0
                )
                (case -10
                    (super:doChild(param1))
                    (self:cue())
                    return 0
                )
                (case -21
                    (super:doChild(param1))
                    (self:cue())
                    return 0
                )
                (default 
                    return 1
                )
            )
    )


    (method (cue)
        (self:doVerb(2))
    )

)
(instance info of Feature
    (properties
        x 160
        y 100
        noun 1
        nsBottom 199
        nsRight 319
    )
)
(instance infoIcon of TellerIcon
    (properties)

    (method (show)
        (var temp0[15])
        (if (notEgo)
            (if (== (infoTeller:curArray) @local0)
                Message(0 102 1 2 1 1 @temp0)
                Display(@temp0 100 15 5 102 17)
            )(else
                (if (== (infoTeller:curArray) @local10)
                    Message(0 102 1 2 22 1 @temp0)
                    Display(@temp0 100 15 5 102 17)
                )
            )
        )
        = nsRight 80
        = nsBottom (+ nsTop 15)
        DrawCel(view loop cel nsLeft nsTop -1)
        Display(myHandle 100 20 + nsTop 3 102 17)
        (if (& signal $0004)
            (self:mask())
        )
        (if (gPseudoMouse and (send gPseudoMouse:respondsTo(#stop)))
            (send gPseudoMouse:stop())
        )
    )

)
