home *** CD-ROM | disk | FTP | other *** search
- on initNavMovies
- global NavPlayer1, Player2
- if objectp(NavPlayer1) then
- NavPlayer1(mdispose)
- end if
- set NavPlayer1 to navMoviePlayer(mnew)
- end
-
- on openNavMovie theNavMoviePlayer, movieChannel
- theNavMoviePlayer(mLoadMovie, movieChannel)
- end
-
- factory navMoviePlayer
- method mnew
- instance startMovie, startMovie, startMovie, startMovie, startMovie, startMovie, startMovie, startMovie, startMovie, startMovie, startMovie, startMovie, startMovie, nmSprite, nmCast, nmRows, nmColumns, nmDirectionality, nmLoopSize, nmTScale, nmHCenter, nmVCenter, nmDeadZone, nmMaxZone, nmDelayScale, nmCurrRow, nmCurrColumn
-
- method mLoadMovie aNavMovieSprite
- set nmSprite to aNavMovieSprite
- set nmCast to the castNum of sprite nmSprite
- me(mSetUp)
-
- method mSetUp
- me(mReadParms)
- me(mSetPlayerParms)
- me(mGotoRowColumn, integer((nmRows / 2) + 0.5), integer((nmColumns / 2) + 0.5))
- set the movieRate of sprite nmSprite to 0
-
- method mReadParms
- set nmRows to 0
- set nmColumns to 0
- set nmDirectionality to 0
- set nmLoopSize to 1
- set parmList to the name of cast the castNum of sprite nmSprite
- delete item 1 of parmList
- repeat with i = 1 to the number of items in parmList
- set aParm to item i of parmList
- set parmTag to char 1 of aParm
- delete char 1 of aParm
- if parmTag = "r" then
- set nmRows to aParm
- next repeat
- end if
- if parmTag = "c" then
- set nmColumns to aParm
- next repeat
- end if
- if parmTag = "d" then
- set nmDirectionality to aParm
- next repeat
- end if
- if parmTag = "l" then
- set nmLoopSize to aParm
- end if
- end repeat
-
- method mSetPlayerParms
- set nmHCenter to the locH of sprite nmSprite
- set nmVCenter to the locV of sprite nmSprite
- set nmTScale to integer(the duration of cast nmCast / (nmRows * nmColumns))
- set nmDeadZone to 30
- set nmMaxZone to integer(the height of sprite nmSprite / 2)
- set nmDelayScale to integer(nmMaxZone * nmMaxZone / 30)
-
- method mGotoRowColumn theRow, theColumn
- set nmCurrRow to theRow
- set nmCurrColumn to theColumn
- set currFrame to integer(((nmCurrRow - 1) * nmColumns) + nmCurrColumn)
- set the movieTime of sprite nmSprite to integer(currFrame - 1) * nmTScale
- updateStage()
-
- method mJoystickController
- repeat while the mouseDown
- if rollOver(nmSprite) then
- set nextRow to nmCurrRow
- set nextColumn to nmCurrColumn
- set joyDH to the mouseH - nmHCenter
- set joyDV to the mouseV - nmVCenter
- set cursorNum to me(mJoyCursor, joyDH, joyDV)
- set cursorName to me(mJoyCursorName, cursorNum)
- if cursorName contains "S" then
- if nextRow < nmRows then
- set nextRow to nextRow + 1
- else
- set nextRow to nextRow + 0
- end if
- else
- if cursorName contains "N" then
- if nextRow > 1 then
- set nextRow to nextRow - 1
- else
- set nextRow to nextRow + 0
- end if
- end if
- end if
- if cursorName contains "E" then
- if nextColumn < nmColumns then
- set nextColumn to nextColumn + 1
- else
- set nextColumn to 1
- end if
- else
- if cursorName contains "W" then
- if nextColumn > 1 then
- set nextColumn to nextColumn - 1
- else
- set nextColumn to nmColumns
- end if
- end if
- end if
- cursor(cursorNum + 1100)
- if cursorName <> EMPTY then
- me(mGotoRowColumn, nextRow, nextColumn)
- set navDelay to integer(((nmMaxZone * nmMaxZone) - (joyDH * joyDH) - (joyDV * joyDV)) / nmDelayScale)
- if navDelay > 0 then
- startTimer()
- repeat while the timer < navDelay
- end repeat
- end if
- end if
- next repeat
- end if
- when mouseDown then nothing
- cursor(0)
- end repeat
- cursor(0)
-
- method mJoyCursor joyDH, joyDV
- if joyDV > nmDeadZone then
- if joyDH < -nmDeadZone then
- set cursorNum to 6
- else
- if joyDH > nmDeadZone then
- set cursorNum to 7
- else
- set cursorNum to 2
- end if
- end if
- else
- if joyDV < -nmDeadZone then
- if joyDH < -nmDeadZone then
- set cursorNum to 5
- else
- if joyDH > nmDeadZone then
- set cursorNum to 4
- else
- set cursorNum to 3
- end if
- end if
- else
- if joyDH < -nmDeadZone then
- set cursorNum to 1
- else
- if joyDH > nmDeadZone then
- set cursorNum to 0
- else
- set cursorNum to 8
- end if
- end if
- end if
- end if
- return cursorNum
-
- method mJoyCursorName cursorNum
- return item cursorNum + 1 of "E,W,S,N,NE,NW,SW,SE,"
-
- method mShowNavCursor theCursorH, theCursorV
- if the mouseCast = -1 then
- cursor(-1)
- else
- if rollOver(nmSprite) then
- set theCursorNum to me(mJoyCursor, theCursorH - nmHCenter, theCursorV - nmVCenter)
- cursor(1110 + theCursorNum)
- end if
- end if
-