/******************************************************************************
 SCI Template Game
 By Brian Provinciano
 ******************************************************************************
 titlescreen.sc
 Contains the title screen room.
 ******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 801)
/******************************************************************************/
(use "main")
(use "game")
(use "menubar")
(use "obj")
(use "cycle")
(use "user")
(use "controls")
(use "feature")
(local
ready
)
/******************************************************************************/
(instance public TitleScreen of Rm
	(properties
		picture 8
	)
	(method (init)
        // Set up the title screen
		ProgramControl()

		(send gGame:setSpeed(1))
		(SL:disable())
		(TheMenuBar:hide())

		(super:init())
		(self:setScript(RoomScript))

		(send gEgo:
			init()
			hide()
         )


          (send gTheMusic:
			prevSignal(0)
			stop()
			number(985) //8
			loop(1)
			play()
		)

      DoSound(sndVOLUME 2)
        /**************************************************
         * Add the rest of your initialization stuff here *
         **************************************************/
     = gTimeSeconds	0
     SaveSpeed(4)

 )
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)

         (method (handleEvent pEvent)
        (super:handleEvent(pEvent))
        (if( not (send pEvent:claimed) )
			(if( (== (send pEvent:type) evKEYBOARD) and (== (send pEvent:message) KEY_1) )
                      (send gRoom:newRoom(976))
               )
             			(if( (== (send pEvent:type) evKEYBOARD) and (== (send pEvent:message) KEY_2) )
                             (send gRoom:newRoom(802))

             )
             			(if( (== (send pEvent:type) evKEYBOARD) and (== (send pEvent:message) KEY_3) )
                       (send gGame:restore())
             )
          //(send gRoom:newRoom(976))
               )
          (if( not (send pEvent:claimed) )
         (if(not (& (send pEvent:modifiers) emRIGHT_BUTTON))

    (if(> (send pEvent:x) 86 and (if(< (send pEvent:x) 123)))
    (if(< (send pEvent:y) 180 and (if(> (send pEvent:y) 167)))
(send gRoom:newRoom(976))

    )
    )
        (if(> (send pEvent:x) 137 and (if(< (send pEvent:x) 173)))
    (if(< (send pEvent:y) 182 and (if(> (send pEvent:y) 167)))

      (send gRoom:newRoom(802))
     )
     )
           (if(> (send pEvent:x) 187 and (if(< (send pEvent:x) 223)))
    (if(< (send pEvent:y) 180 and (if(> (send pEvent:y) 167)))
       (send gGame:restore())
       return
     )
     )
      )

                    )
                    )
(method (changeState newState)
= state newState
  (switch (state)
    (case 0
   //(send gGame:setSpeed(4))
 = cycles 1
    )
    (case 1
      (aFun: cel(0) init() cycleSpeed(1) posn(157 125) setCycle(End RoomScript))
    )
    (case 2
    (aFun2: cel(0) init() cycleSpeed(1) setCycle(End RoomScript))
     )
         (case 3
         
      Wait(100)
      (aFun2: loop(2) cycleSpeed(0) setCycle(End))
      (aFun: dispose())
      (aEig: init() setCycle(End RoomScript))
          )
       (case 4
       (aEig2: init() setCycle(End RoomScript))
       )
       (case 5
       (aE: init() setMotion(MoveTo 120 180 RoomScript))

      )
      (case 6
  (aEig: hide())
   (aEig2: hide())
(aPlay: init())
      (aIntro: init())
      (aLoad: init())
       = gTimeSeconds 0
         DrawPic(8)
       DrawPic(800)
       = ready TRUE
        (send gTheMusic:
			stop()
			number(401)
			loop(1)
			play()
		)
  Display("Ver 1.0" dsCOORD 280 184 dsFONT 998 dsCOLOR 9)
  
  )





    
    )
    )

)

 (instance aFun of Act
 (properties
 view 400
 x 157
 y 0
 cel 0
 ))
  (instance aFun2 of Act
 (properties
 view 400
 x 157
 y 160
 loop 1
 ))

 (instance aE of Act
 (properties
 view 300
 x 1
 y 180
 ))
   (instance aEig of Act
 (properties
 view 113
 x 111
 y 88
 cel 0
 ))
    (instance aEig2 of Act
 (properties
 view 112
 x 193
 y 114
 cel 0
 ))
(instance aPlay of Prop
 (properties
 view 97
 x 105
 y 180
 ))
      (instance aIntro of Prop
 (properties
 view 97
 cel 2
 x 155
 y 180
 ))
      (instance aLoad of Prop
 (properties
 view 97
 cel 1
 x 205
 y 180
 ))



