(version 2)
(include "sci.sh")
(exports
    0 rm300
)
(use "Main")
(use "FPRoom")
(use "Blink")
(use "Scaler")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "StopWalk")
(use "Cycle")
(use "View")
(use "Obj")
(script 300)


(local
    local0
    local1
    gEgoMoveSpeed
    local3

)
(instance public rm300 of FPRoom
    (properties
        noun 1
        picture 300
        style $000a
        east 310
        south 220
    )

    (method (init)
        (send gEgo:
            init()
            setScale(Scaler 75 48 182 41)
            normalize()
        )
        (switch (gGNumber)
            (case east
                = style 11
                (send gGame:handsOn())
            )
            (case south
                (send gEgo:x(44))
                (send gGame:handsOn())
            )
            (case 680
                (send gGame:handsOn())
            )
            (case 540
                (srini:
                    init()
                    stopUpd()
                    setScale(Scaler 75 48 182 41)
                    approachVerbs(4 2)
                )
                (send global2:setScript(sAfterPractice))
            )
            (default 
                (send gEgo:
                    x(44)
                    y(184)
                )
                (send gGame:handsOn())
            )
        )
        (super:init())
        (if (== global119 14)
            0
        )(else
            (if (== gGNumber 540)
                (send gGameMusic1:
                    number(185)
                    loop(-1)
                    play()
                )
            )(else
                (send gGameMusic2:
                    number(2300)
                    loop(-1)
                    play()
                )
            )
        )
        (if (<= (send gEgo:y) 80)
            proc0_3(50)
            (send global2:addObstacle(
                (if ((>= global119 13) and proc0_2(97))
(                    = local1 (send ((Polygon:new())):
                            type(2)
                            init(319 189 0 189 0 0 319 0 319 41 301 41 268 26 292 13 287 10 252 27 233 22 242 16 210 12 160 35 178 43 186 38 201 40 206 49 203 53 282 90 319 80)
                            yourself()
                        )
)                )(else
                    (if ((>= global119 11) and (<= global119 13))
(                        = local0 (send ((Polygon:new())):
                                type(2)
                                init(319 189 0 189 0 0 319 0 319 41 301 41 268 26 292 13 287 10 252 27 233 22 242 16 210 12 160 35 172 40 215 20 261 32 213 60 282 90 319 80)
                                yourself()
                            )
)                    )(else
(                        = local0 (send ((Polygon:new())):
                                type(2)
                                init(319 189 0 189 0 0 319 0 319 41 301 41 268 26 292 13 287 10 252 27 233 22 242 16 210 12 160 35 282 90 319 80)
                                yourself()
                            )
)                    )
                )
 (send ((Polygon:new())):
                    type(2)
                    init(191 33 216 22 228 27 203 39)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(310 55 282 75 265 65 289 47)
                    yourself()
                )
))
        )(else
            (send global2:addObstacle(
                (if (((>= global119 17) and (<= global119 18)) or (== gGNumber 540))
                    (send ((Polygon:new())):
                        type(2)
                        init(279 128 174 73 174 68 152 60 136 62 138 69 170 81 176 88 159 90 141 92 87 87 70 94 83 106 73 113 51 111 38 119 72 134 0 189 0 0 319 0 319 102)
                        yourself()
                    )
                )(else
                    (send ((Polygon:new())):
                        type(2)
                        init(277 123 174 73 176 69 151 59 136 60 136 66 170 81 171 86 159 90 139 90 124 90 87 87 40 105 41 124 72 134 0 189 0 0 319 0 319 102)
                        yourself()
                    )
                )
 (send ((Polygon:new())):
                    type(2)
                    init(319 171 319 189 61 189 138 129)
                    yourself()
                )
))
            proc0_4(50)
        )
        (outhouseDoor:
            init()
            approachVerbs(
                (if (proc0_2(50))
                    0
                )(else
                    4
                )
)
            stopUpd()
        )
        (tree:
            init()
            setOnMeCheck(1 8)
        )
        (bottomBuilding:
            init()
            setOnMeCheck(1 16)
        )
        (hangman:
            init()
            setOnMeCheck(1 32)
        )
        (eastBuilding:
            init()
            setOnMeCheck(1 64)
        )
        (buildingSign:
            init()
            setOnMeCheck(1 128)
        )
        (outhouse:
            init()
            setOnMeCheck(1 256)
        )
        (westBuilding:
            init()
            setOnMeCheck(1 512)
        )
        (fencePosts:
            init()
            setOnMeCheck(1 1024)
        )
        (angelPost:
            init()
            setOnMeCheck(1 1024)
        )
        (desert:
            init()
            setOnMeCheck(1 -32768)
        )
        (boulder:
            init()
            setOnMeCheck(1 8192)
        )
        (graveYard:
            init()
            setOnMeCheck(1 16384)
        )
        (cactus:
            init()
            setOnMeCheck(1 64)
        )
        (stone1:
            init()
            setOnMeCheck(1 2)
        )
        (stone2:
            init()
            setOnMeCheck(1 4)
        )
        (stone3:
            init()
            setOnMeCheck(1 8)
        )
        (stone4:
            init()
            setOnMeCheck(1 16)
        )
        (stone5:
            init()
            setOnMeCheck(1 32)
        )
        (stone6:
            init()
            setOnMeCheck(1 64)
        )
        (stone7:
            init()
            setOnMeCheck(1 128)
        )
        (stone8:
            init()
            setOnMeCheck(1 256)
        )
        (fence:
            init()
            setOnMeCheck(1 4)
            approachVerbs(
                (if (proc0_2(50))
                    0
                )(else
                    34
                )
)
        )
        (noose:
            init()
            cycleSpeed(13)
            setScript(sNooseSwings)
        )
        (if (<= global119 10)
            (emptyGrave:
                init()
                addToPic()
            )
        )(else
            (if ((>= global119 11) and (<= global119 13))
                (digger:
                    init()
                    setCycle(Fwd)
                )
                = local3 1
            )(else
                (if ((> global119 13) and (<= global119 19))
                    (if (proc0_2(97))
                        (dirtPile:
                            init()
                            stopUpd()
                            approachVerbs(4 63)
                        )
                    )(else
                        (filledGrave:
                            init()
                            stopUpd()
                            approachVerbs(4 63)
                        )
                    )
                )(else
                    (if (>= global119 20)
                        (filledGrave:
                            init()
                            stopUpd()
                            approachVerbs(4)
                        )
                    )
                )
            )
        )
        (if ((>= global119 17) and (<= global119 18))
            (srini:
                init()
                stopUpd()
                setScale(Scaler 75 48 182 41)
                approachVerbs(
                    (if (proc0_2(50))
                        0
                    )(else
                        4
                        2
                    )
)
            )
        )
        (if (proc0_2(52))
            (dummyCredits:
                init()
                setScript(ScriptID(32 0))
            )
        )
    )


    (method (dispose)
        (if (== global119 14)
            0
        )(else
            (if (== gGNumber 540)
                (send gGameMusic1:fade())
            )(else
                (send gGameMusic2:fade())
            )
        )
        DisposeScript(32)
        (super:dispose())
    )

)
(instance sOuthouseGag of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (doorSound:
                    number(2146)
                    play()
                )
                (outhouseDoor:setCycle(End self))
            )
            (case 1
                (send gEgo:setMotion(MoveTo 14 139 self))
            )
            (case 2
                = ticks 70
            )
            (case 3
                (send gEgo:setMotion(MoveTo 28 138 self))
            )
            (case 4
                (send gEgo:setMotion(MoveTo 55 144 self))
            )
            (case 5
                (send gEgo:setMotion(MoveTo 41 158 self))
            )
            (case 6
                proc0_5(gEgo outhouseDoor)
                = cycles 10
            )
            (case 7
                (send gFpMessager:say(34 0 0 0 self))
            )
            (case 8
                (doorSound:
                    number(2147)
                    play()
                )
                (outhouseDoor:setCycle(Beg self))
            )
            (case 9
                (outhouseDoor:stopUpd())
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sNooseSwings of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds Random(5 20)
            )
            (case 1
                (noose:setCycle(Fwd))
                = seconds Random(1 5)
            )
            (case 2
                (noose:setCycle(CT 0 1 self))
            )
            (case 3
                (noose:stopUpd())
                (self:changeState(0))
            )
        )
    )

)
(instance sAfterPractice of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_5(gEgo srini)
                = cycles 10
            )
            (case 1
                (send gFpMessager:say(19 0 0 0 self))
            )
            (case 2
                (send gGame:
                    handsOn()
                    setCursor(0 1)
                )
                (self:dispose())
            )
        )
    )

)
(instance sFreddyDigsGrave of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (== (send gEgo:cel) 3)
            (graveDigger:play())
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                (Narrator:modeless(1))
                = cycles 1
            )
            (case 1
                (send gEgo:
                    view(303)
                    loop(1)
                    cel(0)
                    x(203)
                    y(39)
                    setPri(2)
                    cycleSpeed(12)
                    scaleSignal(0)
                    setCycle(Fwd)
                )
                (send gGame:points(2 131))
                (send gFpMessager:say(11 63 0 0 self))
            )
            (case 2
                (Narrator:modeless(0))
                proc0_15(1 4 self)
            )
            (case 3
                (send ((send global2:obstacles)):delete(local0))
                (send local0:dispose())
                = local1 (send ((Polygon:new())):
                        type(2)
                        init(319 189 0 189 0 0 319 0 319 41 301 41 268 26 292 13 287 10 252 27 233 22 242 16 210 12 160 35 178 43 186 38 201 40 206 49 203 53 282 90 319 80)
                        yourself()
                    )
                (send global2:addObstacle(local1))
                proc0_3(62)
                proc0_3(97)
                (dirtPile:
                    init()
                    stopUpd()
                    approachVerbs(4)
                )
                (filledGrave:dispose())
                = cycles 1
            )
            (case 4
                (send gEgo:
                    cycleSpeed(gEgoMoveSpeed)
                    moveSpeed(gEgoMoveSpeed)
                    scaleSignal(1)
                    normalize()
                    setHeading(135)
                )
                = cycles 15
            )
            (case 5
                proc0_15(0 4 self)
            )
            (case 6
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sFreddyFillsGrave of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (== (send gEgo:cel) 3)
            (graveDigger:play())
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                (Narrator:modeless(1))
                = cycles 1
            )
            (case 1
                (send gEgo:
                    view(303)
                    loop(0)
                    cel(0)
                    x(203)
                    y(39)
                    cycleSpeed(12)
                    scaleSignal(0)
                    setCycle(Fwd)
                )
                (send gFpMessager:say(14 63 0 0 self))
            )
            (case 2
                (Narrator:modeless(0))
                proc0_15(1 4 self)
            )
            (case 3
                proc0_4(97)
                (filledGrave:
                    init()
                    stopUpd()
                    approachVerbs(63 4)
                )
                (dirtPile:dispose())
                (openGrave:dispose())
                (send ((send global2:obstacles)):delete(local1))
                (send local1:dispose())
                = local0 (send ((Polygon:new())):
                        type(2)
                        init(319 189 0 189 0 0 319 0 319 41 301 41 268 26 292 13 287 10 252 27 233 22 242 16 210 12 160 35 282 90 319 80)
                        yourself()
                    )
                (send global2:addObstacle(local0))
                = cycles 1
            )
            (case 4
                (send gEgo:
                    cycleSpeed(gEgoMoveSpeed)
                    moveSpeed(gEgoMoveSpeed)
                    scaleSignal(1)
                    normalize()
                    setHeading(135)
                )
                = cycles 15
            )
            (case 5
                proc0_15(0 4 self)
            )
            (case 6
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sJumpIntoGrave of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                proc958_0(132 2112)
                (send gEgo:
                    view(304)
                    loop(0)
                    cel(0)
                    x(216)
                    y(36)
                    cycleSpeed(10)
                    scaleSignal(0)
                    setCycle(CT 6 1 self)
                )
            )
            (case 1
                (doorSound:
                    number(2112)
                    play()
                )
                (send gEgo:setCycle(End self))
            )
            (case 2
                (send gEgo:hide())
                = cycles 10
            )
            (case 3
                (send gEgo:get(-1 14))
                (send gFpMessager:say(14 4 5 0 self))
            )
            (case 4
                (send gGame:points(5))
                (if ((send gEgo:has(31)))
                    (send gEgo:put(31))
                    (send gFpMessager:say(14 62 5 0 self))
                )(else
                    = cycles 1
                )
            )
            (case 5
                (send gEgo:
                    view(304)
                    loop(1)
                    cel(0)
                    x(220)
                    y(38)
                    show()
                    setCycle(End self)
                )
            )
            (case 6
                (send gEgo:
                    view(800)
                    x(206)
                    y(39)
                    cycleSpeed(gEgoMoveSpeed)
                    moveSpeed(gEgoMoveSpeed)
                    setCycle(StopWalk -1)
                    scaleSignal(1)
                    setHeading(135)
                )
                = cycles 15
            )
            (case 7
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance srini of Actor
    (properties
        x 67
        y 107
        noun 17
        approachX 90
        approachY 108
        view 801
        loop 4
        cel 4
        signal $4001
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 2
                (if (proc0_2(50))
                    (send gFpMessager:say(noun 2 2))
                )(else
                    (if (== global119 19)
                        (send gFpMessager:say(noun 2 8))
                    )(else
                        (super:doVerb(theVerb rest param2))
                    )
                )
            )
            (case 1
                (if (== global119 19)
                    (send gFpMessager:say(noun 2 8))
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance digger of Prop
    (properties
        x 211
        y 46
        noun 12
        view 301
        cel 2
        signal $5000
    )

    (method (doit)
        (super:doit())
        (if (local3 and (== (self:cel) 3))
            (graveDigger:play(self))
            = local3 0
        )
    )


    (method (cue)
        = local3 1
    )

)
(instance dirtPile of View
    (properties
        x 175
        y 48
        noun 13
        approachX 202
        approachY 41
        view 302
        signal $5001
    )

    (method (init)
        (super:init())
        (openGrave:
            init()
            approachVerbs(1 4 9)
            setOnMeCheck(1 8192)
        )
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (not proc0_2(50))
                    (send gFpMessager:say(noun theVerb 2))
                )(else
                    (if (not proc0_2(73))
                        proc0_3(73)
                        (send gEgo:get(8 dirtPile 1))
                        (send gGame:points(1 150))
                    )(else
                        (if (proc0_2(73))
                            (send gFpMessager:say(noun theVerb 3))
                        )(else
                            (super:doVerb(4 rest param2))
                        )
                    )
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance shovel of View
    (properties
        x 224
        y 40
        z 13
        noun 10
        approachX 211
        approachY 41
        view 301
        loop 1
        priority 3
        signal $4011
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (proc0_2(50))
                    (send gEgo:get(51 shovel 2 self))
                    (send gGame:points(1 129))
                )(else
                    (send gFpMessager:say(noun theVerb 6))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance filledGrave of View
    (properties
        x 225
        y 39
        noun 11
        approachX 203
        approachY 39
        view 305
        signal $5001
    )

    (method (init)
        (super:init())
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(224 56 208 47 204 42 242 27 266 35)
                yourself()
            )
))
        (if (not (send gEgo:has(51)) and (< global120 4))
            (shovel:
                init()
                stopUpd()
                approachVerbs(4)
            )
        )
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (not proc0_2(50))
                    (send gFpMessager:say(noun theVerb 6))
                )(else
                    (if (proc0_2(62) and not proc0_2(73))
                        proc0_3(73)
                        (send gEgo:get(8 dirtPile 1))
                        (send gGame:points(1 150))
                    )(else
                        (if (proc0_2(73))
                            (send gFpMessager:say(noun theVerb 3))
                        )(else
                            (super:doVerb(4 rest param2))
                        )
                    )
                )
            )
            (case 63
                (if (proc0_2(50))
                    (send gEgo:setScript(sFreddyDigsGrave))
                )(else
                    (send gFpMessager:say(noun theVerb 6))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance outhouseDoor of Prop
    (properties
        x 22
        y 151
        noun 18
        approachX 41
        approachY 158
        view 300
        priority 12
        signal $5010
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (proc0_2(50))
                    (send gFpMessager:say(noun 4 2))
                )(else
                    (send gEgo:setScript(sOuthouseGag))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance noose of Prop
    (properties
        x 124
        y 155
        noun 15
        view 126
        priority 15
        signal $0010
    )
)
(instance dummyCredits of Prop
    (properties
        x -10
        y -10
        view 996
    )
)
(instance emptyGrave of View
    (properties
        x 205
        y 14
        noun 30
        view 305
        loop 1
        signal $4000
    )

    (method (init)
        (super:init())
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(259 32 254 42 228 32 237 26)
                yourself()
            )
))
    )

)
(instance fence of Feature
    (properties
        x 82
        y 91
        noun 16
        approachX 82
        approachY 91
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 34
                (if (proc0_2(50))
                    (send gFpMessager:say(noun 34 2))
                )(else
                    (if (proc0_2(54) and (== global119 17))
                        (send global2:newRoom(540))
                    )(else
                        (send gFpMessager:say(noun 34 1))
                    )
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance tree of Feature
    (properties
        x 258
        y 121
        noun 2
    )
)
(instance bottomBuilding of Feature
    (properties
        x 200
        y 154
        noun 3
    )
)
(instance hangman of Feature
    (properties
        x 157
        y 165
        z 10
        noun 4
    )
)
(instance eastBuilding of Feature
    (properties
        x 295
        y 163
        noun 5
    )
)
(instance buildingSign of Feature
    (properties
        x 78
        y 157
        noun 7
    )
)
(instance outhouse of Feature
    (properties
        x 19
        y 124
        noun 8
    )
)
(instance westBuilding of Feature
    (properties
        x 3
        y 143
        noun 6
    )
)
(instance fencePosts of Feature
    (properties
        x 250
        y 63
        noun 9
    )
)
(instance boulder of Feature
    (properties
        x 250
        y 63
        noun 20
        nsLeft 13
        nsBottom 61
        nsRight 129
    )
)
(instance desert of Feature
    (properties
        x 250
        y 63
        noun 21
    )
)
(instance graveYard of Feature
    (properties
        x 250
        y 1
        noun 30
    )
)
(instance openGrave of Feature
    (properties
        x 250
        y 63
        noun 14
        approachX 203
        approachY 39
    )

    (method (init)
        (super:init())
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(224 56 208 47 204 42 242 27 266 35)
                yourself()
            )
))
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (proc0_2(50))
                    (if ((send gEgo:has(14)))
                        (send gFpMessager:say(noun theVerb 4))
                    )(else
                        (send gEgo:setScript(sJumpIntoGrave))
                    )
                )(else
                    (send gFpMessager:say(noun theVerb 6))
                )
            )
            (case 63
                (if (proc0_2(50))
                    (send gEgo:setScript(sFreddyFillsGrave))
                )(else
                    (send gFpMessager:say(noun theVerb 6))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance stone1 of Feature
    (properties
        x 187
        y 195
        z 185
        noun 22
        nsTop 6
        nsLeft 178
        nsBottom 20
        nsRight 196
    )
)
(instance stone2 of Feature
    (properties
        x 212
        y 195
        z 185
        noun 23
        nsTop 11
        nsLeft 202
        nsBottom 28
        nsRight 223
    )
)
(instance stone3 of Feature
    (properties
        x 244
        y 196
        z 170
        noun 24
        nsTop 14
        nsLeft 232
        nsBottom 39
        nsRight 256
    )
)
(instance stone4 of Feature
    (properties
        x 293
        y 193
        z 150
        noun 25
        nsTop 35
        nsLeft 285
        nsBottom 52
        nsRight 301
    )
)
(instance stone5 of Feature
    (properties
        x 304
        y 195
        z 180
        noun 26
        nsTop 8
        nsLeft 297
        nsBottom 22
        nsRight 312
    )
)
(instance stone6 of Feature
    (properties
        x 273
        y 195
        z 190
        noun 27
        nsLeft 268
        nsBottom 11
        nsRight 278
    )
)
(instance stone7 of Feature
    (properties
        x 257
        y 194
        z 180
        noun 28
        nsTop 7
        nsLeft 251
        nsBottom 19
        nsRight 263
    )
)
(instance stone8 of Feature
    (properties
        x 235
        y 197
        z 190
        noun 29
        nsTop 2
        nsLeft 228
        nsBottom 12
        nsRight 243
    )
)
(instance cactus of Feature
    (properties
        x 135
        y 173
        z 140
        noun 32
        nsTop 12
        nsLeft 108
        nsBottom 54
        nsRight 163
    )
)
(instance angelPost of Feature
    (properties
        x 273
        y 77
        noun 33
        nsTop 32
        nsLeft 256
        nsBottom 122
        nsRight 291
    )
)
(instance graveDigger of FPSound
    (properties
        flags $0001
        number 2301
    )
)
(instance doorSound of FPSound
    (properties
        flags $0001
    )
)
