(include "sci.sh")
(use "Main")
(use "CueObj")
(use "ScaleTo")
(use "Cycle")
(use "Sounds")
(use "View")
(use "Obj")
(script 800)


(local
    local0[171] = (2 1 0 3 4 4 0 0 0 5 1 0 1 10 1 1 65535 8 1 1 65535 8 1 1 1 8 1 1 1 14 1 1 65535 9 1 1 65530 5 1 2 65529 0 1 3 65524 65535 1 3 65526 1 1 3 65524 1 1 3 65529 65535 1 3 65531 65530 0 0 0 65529 3 1 1 65531 3 1 65535 65527 3 1 1 65525 3 1 65535 65526 3 1 1 65531 3 1 1 65531 3 1 65535 65532 3 1 65535 65531 3 1 5 65531 2 2 9 0 2 3 9 1 2 3 10 65535 2 3 15 1 2 3 5 65535 2 3 2 1 2 3 65437 65437 2 )
    local171
    local172
    local173
    local174 = 1
    local175 = 1
    local176
    local177
    local178

)
(procedure (localproc_0112)
    (var LaserBeamX, LaserBeamY, LaserBeamX_2, LaserBeamY_2, temp4)
    (switch (local0[+ (* local171 4) 3])
        (case 0
            (= LaserBeamX (- (LaserBeam:x) 3) = LaserBeamX_2 (+ (LaserBeam:x) 3) = LaserBeamY (+ (LaserBeam:y) 3) = LaserBeamY_2 (- (LaserBeam:y) 3)  )
        )
        (case 1
            (= LaserBeamY (LaserBeam:y) = LaserBeamY_2 (LaserBeam:y) = LaserBeamX (- (LaserBeam:x) 3) = LaserBeamX_2 (+ (LaserBeam:x) 3)  )
        )
        (case 2
            (= LaserBeamX (- (LaserBeam:x) 3) = LaserBeamX_2 (+ (LaserBeam:x) 3) = LaserBeamY (- (LaserBeam:y) 3) = LaserBeamY_2 (+ (LaserBeam:y) 3)  )
        )
        (case 3
            (= LaserBeamX (LaserBeam:x) = LaserBeamX_2 (LaserBeam:x) = LaserBeamY (- (LaserBeam:y) 3) = LaserBeamY_2 (+ (LaserBeam:y) 3) )
        )
    )
    Graph(4 LaserBeamY LaserBeamX LaserBeamY_2 LaserBeamX_2 -1 8 -1)
    = LaserBeamX (LaserBeam:x)
    = LaserBeamY (LaserBeam:y)
    = LaserBeamX_2 (LaserBeam:x)
    Graph(4 LaserBeamY LaserBeamX = LaserBeamY_2 (LaserBeam:y) LaserBeamX_2 -1 8 -1)
)


(procedure (localproc_024d)
    = local173 local0[(* local171 4)]
    = local172 local0[(+ (* local171 4) 1)]
    = local175 
        (if (< local173 0)
            -1
        )(else
            1
        )
    = local174 
        (if (< local172 0)
            -1
        )(else
            1
        )
    = local173 Abs(local173)
    = local172 Abs(local172)
    return == ++local171 32
)


(procedure (localproc_0298)
    return 
        (if (not local172 and not local173)
            return localproc_034d()
        )(else
            (if (local172)
                --local172
                (LaserBeam:y((+ (LaserBeam:y) local174)))
            )
            (if (local173)
                --local173
                (LaserBeam:x((+ (LaserBeam:x) local175)))
            )
            localproc_0068((LaserBeam:x) (LaserBeam:y))
            return 0
        )
)


(procedure (localproc_02f4)
    (send gSQ5:handsOn())
    (send gSq5IconBar:disable(0 3 4))
)


(instance public rm800 of Rm
    (properties
        noun 4
        picture 49
    )

    (method (init param1)
        (doorSwitch:
            init()
            stopUpd()
        )
        (light:
            init()
            stopUpd()
        )
        (super:init(rest param1))
        Load(rsVIEW 699)
        Load(rsPIC 49)
        (RingThatHideBurn:init())
        (InsideWallPiece:
            init()
            stopUpd()
        )
        (tDoor:init())
        (bDoor:init())
        (goliathHullF:
            init()
            setOnMeCheck(26505)
        )
        (if (not (send gEgo:has(7)))
            (send gTestMessager:say(6 0 0 0))
            proc0_9(51)
        )(else
            localproc_02f4()
        )
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 30
                (
                (if ((send gCast:contains(tDoor)))
                    (send gTestMessager:say(noun 30 2 0))
                )(else
                    (send gRoom:setScript(cutTheHole))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance cutTheHole of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) = local176 1 proc0_10(197 100) localproc_024d() (GunInHand:
                    init()
                    setStep(10 10)
                    setMotion(MoveTo 129 76 self)
                )
  )
            )
            (case 1
                ((send gSq5Music2:
                    number(606)
                    loop(-1)
                    play()
                )
 Load(rsPIC 49) (LaserBeam:init()) = local176 0 = cycles 1  )
            )
            (case 2
                (
                (if (not localproc_0298())
                    localproc_0112()
                    --state
                )
 = ticks 1  )
            )
            (case 3
                ((send gSq5Music2:stop()) = local176 1 (send gRoom:drawPic((send gRoom:picture) 100)) (LaserBeam:dispose()) (RingThatHideBurn:dispose()) (GunInHand:setMotion(MoveTo 60 86)) (InsideWallPiece:
                    setScale(ScaleTo 125)
                    setStep(10 10)
                    setMotion(MoveTo 159 82 self)
                )
  )
            )
            (case 4
                ((InsideWallPiece:setMotion(MoveTo 159 160 self))  )
            )
            (case 5
                ((send gSq5Music2:
                    number(517)
                    loop(1)
                    play()
                )
 (GunInHand:dispose()) (InsideWallPiece:dispose()) (send gEgo:put(7)) (send gTestMessager:say(5 0 0 0 self))  )
            )
            (case 6
                (
                (if (not proc0_1(68))
                    (send gSq5Music1:
                        number(20)
                        loop(-1)
                        play()
                    )
                )
 = seconds 2  )
            )
            (case 7
                (
                (if (not proc0_1(68))
                    = next youDie
                    (self:dispose())
                )(else
                    proc0_10(196 50)
                    (send gRoom:newRoom(1000))
                )
 )
            )
        )
    )

)
(instance youDie of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= seconds 4  )
            )
            (case 1
                ((goon1:
                    init()
                    setMotion(MoveTo 142 109 self)
                )
  )
            )
            (case 2
                ((goon2:
                    init()
                    setMotion(MoveTo 137 79 self)
                )
  )
            )
            (case 3
                ((goon3:
                    init()
                    setMotion(MoveTo 180 71 self)
                )
  )
            )
            (case 4
                ((send gSq5Music1:fade(0 10 5 self))  )
            )
            (case 5
                (proc0_9(32) )
            )
        )
    )

)
(instance openDoor of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (light:setCycle(End)) (doorSwitch:setCycle(End)) (send gSq5Music2:
                    number(106)
                    loop(1)
                    play()
                )
 (tDoor:setMotion(MoveTo (tDoor:x) 65486 self)) (bDoor:setMotion(MoveTo (bDoor:x) 153 self))  )
            )
            (case 1
                ( )
            )
            (case 2
                ((doorSwitch:stopUpd()) (light:stopUpd()) (tDoor:dispose()) (bDoor:dispose()) localproc_02f4() (self:dispose()) )
            )
        )
    )

)
(instance RingThatHideBurn of View
    (properties
        x 121
        y 48
        noun 2
        view 699
        loop 4
        priority 7
        signal 16400
    )

    (method (doVerb param1)
        (if ((send gCast:contains(tDoor)))
            (tDoor:doVerb(rest param1))
        )(else
            (goliathHullF:doVerb(rest param1))
        )
    )

)
(instance LaserBeam of Actor
    (properties
        x 181
        y 50
        yStep 3
        view 699
        cel 1
        priority 13
        signal 26640
        moveSpeed 5
    )

    (method (init param1)
        (super:init(rest param1))
        (FireBall:
            init()
            setCycle(Fwd)
        )
    )


    (method (dispose param1)
        (FireBall:dispose())
        (super:dispose(rest param1))
    )

)
(instance FireBall of Prop
    (properties
        x 190
        y 55
        view 699
        loop 2
        cel 1
        priority 15
        signal 26640
        cycleSpeed 4
    )

    (method (doit param1)
        (self:
            x((LaserBeam:x))
            y((LaserBeam:y))
        )
        (super:doit(rest param1))
    )

)
(instance InsideWallPiece of Actor
    (properties
        x 159
        y 85
        noun 2
        yStep 40
        view 699
        loop 6
        priority 6
        signal 26640
        xStep 10
        moveSpeed 0
    )

    (method (doVerb param1 param2)
        (if ((send gCast:contains(tDoor)))
            (tDoor:doVerb(param1 rest param2))
        )(else
            (goliathHullF:doVerb(param1 rest param2))
        )
    )

)
(instance GunInHand of Actor
    (properties
        x 61
        y 96
        yStep 10
        view 699
        priority 14
        signal 26640
        xStep 10
        moveSpeed 0
    )

    (method (doit param1)
        (if (not local176)
            (self:
                x(- (LaserBeam:x) 52)
                y(+ (LaserBeam:y) 26)
            )
        )
        (super:doit(rest param1))
    )

)
(instance tDoor of Actor
    (properties
        x 98
        y 23
        noun 3
        yStep 5
        view 699
        loop 5
        cel 1
        priority 8
        signal 26640
        xStep 10
        moveSpeed 0
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 30
                ((send gTestMessager:say(noun param1 2 0))  )
            )
            (case 4
                ((send gTestMessager:say(noun param1 0 0))  )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance bDoor of Actor
    (properties
        x 98
        y 92
        noun 3
        yStep 5
        view 699
        loop 5
        priority 8
        signal 26640
        xStep 10
        moveSpeed 0
    )

    (method (doVerb param1)
        (tDoor:doVerb(rest param1))
    )

)
(instance goon1 of Actor
    (properties
        x 117
        y 130
        view 699
        loop 1
        priority 6
        signal 26640
        moveSpeed 12
    )
)
(instance goon2 of Actor
    (properties
        x 115
        y 79
        view 699
        loop 1
        cel 1
        signal 26640
        moveSpeed 12
    )
)
(instance goon3 of Actor
    (properties
        x 203
        y 71
        view 699
        loop 1
        cel 2
        signal 26640
        moveSpeed 12
    )
)
(instance doorSwitch of Prop
    (properties
        x 234
        y 77
        noun 1
        view 699
        loop 7
        priority 15
        signal 16
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 30
                ((send gTestMessager:say(noun param1 0 0))  )
            )
            (case 4
                (
                (if (not local178)
                    = local178 1
                    (send gRoom:setScript(openDoor))
                )(else
                    (send gTestMessager:say(noun param1 1 0))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance light of Prop
    (properties
        x 132
        y 7
        view 699
        loop 8
        priority 15
        signal 16
    )
)
(instance goliathHullF of Feature
    (properties
        x 158
        y 2
        noun 2
        nsTop 42
        nsLeft 112
        nsBottom 143
        nsRight 204
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 30
                (
                (if ((send gCast:contains(tDoor)))
                    (send gTestMessager:say(noun 30 2 0))
                )(else
                    (send gRoom:setScript(cutTheHole))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
