home *** CD-ROM | disk | FTP | other *** search
- on navButtonInit
- global navBtnList, flashTimeList, gFlashTime, currentFlashState
- setNavButtonDetect(0)
- set navBtnList to [#Light: 40, #Back: 41, #MainMenu: 42, #quit: 43]
- set navFlashTimeList to []
- set flashTimeList to []
- set currentFlashState to []
- set gFlashTime to 0.5 * 60
- repeat with i = 1 to count(navBtnList)
- add(flashTimeList, 0)
- add(currentFlashState, 0)
- end repeat
- setHandCursor(navBtnList)
- end
-
- on navButtonClicked
- global navBtnList, gCurrentTopicIndex
- if not navButtonDetect() then
- return 0
- end if
- setNavButtonDetect(0)
- if buttonClicked(navBtnList, #MainMenu) then
- returnToMainMenu()
- else
- if buttonClicked(navBtnList, #Back) then
- if label(0) <> label("P_MainMenu") then
- setTopic("P_MainMenu")
- gotoTopic(theCurrentTopic())
- end if
- else
- if buttonClicked(navBtnList, #quit) then
- quitProgram()
- else
- if buttonClicked(navBtnList, #Light) then
- flashHotSpots()
- end if
- end if
- end if
- end if
- end
-
- on setNavBtnFlash btn1, btn2, btn3, btn4
- global flashTimeList, navBtnList
- repeat with i = 1 to count(navBtnList)
- set theBtn to getPropAt(navBtnList, i)
- setAt(flashTimeList, i, 0)
- set sNum to getAt(navBtnList, i)
- set theButton to getPropAt(navBtnList, i)
- set newCast to string(theButton) & "_B1"
- setAt(currentFlashState, i, 0)
- puppetSprite(sNum, 1)
- set the castNum of sprite sNum to the number of cast newCast
- repeat with j = 1 to the paramCount
- if theBtn = param(j) then
- setAt(flashTimeList, i, 1)
- end if
- end repeat
- end repeat
- end
-
- on clearNavBtnFlash
- global flashTimeList, navBtnList
- repeat with i = 1 to count(navBtnList)
- set sNum to getAt(navBtnList, i)
- puppetSprite(sNum, 0)
- setAt(flashTimeList, i, 0)
- end repeat
- end
-
- on navButtonFlash
- global flashTimeList, currentFlashState, gFlashTime, navBtnList
- set currentTime to the ticks
- repeat with i = 1 to count(navBtnList)
- set sNum to getAt(navBtnList, i)
- set theButton to getPropAt(navBtnList, i)
- if getAt(flashTimeList, i) = 0 then
- puppetSprite(sNum, 0)
- next repeat
- end if
- if (currentTime - getAt(flashTimeList, i)) > gFlashTime then
- if getAt(currentFlashState, i) = 0 then
- set newCast to string(theButton) & "_B3"
- setAt(currentFlashState, i, 1)
- else
- set newCast to string(theButton) & "_B1"
- setAt(currentFlashState, i, 0)
- end if
- setAt(flashTimeList, i, currentTime)
- puppetSprite(sNum, 1)
- set the castNum of sprite sNum to the number of cast newCast
- updateStage()
- end if
- end repeat
- end
-
- on navButtonFlash2 buttonSymbol
- global flashTimeList, currentFlashState, gFlashTime
- set spriteNum to getaProp(navBtnList, buttonSymbol)
- set index to findPos(navBtnList, buttonSymbol)
- if spriteNum <= 0 then
- debug("Error inside navButtonFlash. Invalid sprite channel.")
- else
- if index <= 0 then
- debug("Error inside navButtonFlash. Invalid index.")
- else
- set currentTime to the ticks
- if (currentTime - getAt(flashTimeList, index)) > gFlashTime then
- if getAt(currentFlashState, index) = 0 then
- set newCast to string(buttonSymbol) & "_B3"
- setAt(currentFlashState, index, 1)
- else
- set newCast to string(buttonSymbol) & "_B1"
- setAt(currentFlashState, index, 0)
- end if
- setAt(flashTimeList, index, currentTime)
- puppetSprite(spriteNum, 1)
- set the castNum of sprite spriteNum to the number of cast newCast
- updateStage()
- end if
- end if
- end if
- end
-
- on setNavButtonDetect theState
- global gNavButtonDetect
- set gNavButtonDetect to theState
- end
-
- on navButtonDetect
- global gNavButtonDetect
- return gNavButtonDetect
- end
-
- on nextTopic
- global topicList, gCurrentTopicIndex
- set gCurrentTopicIndex to gCurrentTopicIndex + 1
- if gCurrentTopicIndex > count(topicList) then
- set gCurrentTopicIndex to gCurrentTopicIndex - 1
- beep()
- return 0
- else
- gotoTopic(gCurrentTopicIndex)
- return 1
- end if
- end
-
- on priorTopic
- global topicList, gCurrentTopicIndex
- set gCurrentTopicIndex to gCurrentTopicIndex - 1
- if gCurrentTopicIndex < 1 then
- set gCurrentTopicIndex to 1
- beep()
- return 0
- end if
- gotoTopic(gCurrentTopicIndex)
- return 1
- end
-
- on gotoTopic theIndex
- global topicList
- if (theIndex > count(topicList)) or (theIndex < 1) then
- alert("Invalid list index inside 'gotoTopic' ")
- else
- go(label(getAt(topicList, theIndex)))
- end if
- end
-
- on setTopic topicName
- global gCurrentTopicIndex, topicList
- set topicIndex to getPos(topicList, topicName)
- if topicIndex > 0 then
- set gCurrentTopicIndex to topicIndex
- return 1
- else
- return 0
- end if
- end
-
- on theCurrentTopic
- global gCurrentTopicIndex
- return gCurrentTopicIndex
- end
-
- on returnToMainMenu
- global gMoviePlaying
- if gMoviePlaying then
- if label("MainMenuReturn") > 0 then
- unPuppetSprites(40, 43)
- go("MainMenuReturn")
- else
- play done
- end if
- else
- nothing()
- end if
- end
-
- on theCurrentTopicName
- global topicList, gCurrentTopicIndex
- return getAt(topicList, gCurrentTopicIndex)
- end
-
- on quitProgram
- playThesound("DEM32.AIF")
- openDialog("quitDialog")
- end
-