home *** CD-ROM | disk | FTP | other *** search
- /*
- ** HorizontalScroll.fred
- **
- ** $VER: HorizontalScroll.fred 1.2.0 (23.10.93)
- **
- ** This program can be run from an InvokeADPro list to horizontally scroll
- ** the image across the screen.
- **
- ** Clips Imported:
- ** FREDNumberOfFrames - Total frames selected
- ** FREDXPosition - Current X Position of the frame
- ** FREDXIncrement - X Increment per frame
- ** FREDXDirection - ~0 if movement is to the right
- ** 0 if to the left
- ** FREDRollWrap - ~0 if image should wrap around
- ** 0 if not
- **
- ** Clips Exported:
- ** FREDXPosition - Current X Position of the frame
- **
- ** NOTE: Clip names are case sensitive.
- **
- ** This script requires FRED v1.4.0 (or higher) to run. Also required is
- ** ADPro v2.5.0 (or higher).
- **
- ** Copyright © 1992-1993 ASDG, Incorporated
- ** All Rights Reserved
- */
-
-
- ADDRESS "ADPro"
- OPTIONS RESULTS
-
- PARSE ARG FrameNum FrameFName Length LoadFlag FirstCallSeq FirstCallCell
-
- NL = '0A'X
- SQ = '27'X
- DQ = '22'X
- TRUE = 1
- FALSE = 0
-
-
- /*
- ** Get the required clips. Error if any are missing.
- */
-
- IF (FirstCallSeq ~= 0) THEN DO
- NumberOfFrames = GETCLIP( "FREDNumberOfFrames" )
- IF (NumberOfFrames = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDNumberOfFrames," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- XDirection = GETCLIP( "FREDXDirection" )
- IF (XDirection = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDXDirection," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- END
-
- XPosition = GETCLIP( "FREDXPosition" )
- IF (XPosition = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDXPosition," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- XIncrement = GETCLIP( "FREDXIncrement" )
- IF (XIncrement = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDXIncrement," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- RollWrap = GETCLIP( "FREDRollWrap" )
- IF (RollWrap = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDRollWrap," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
-
- /*
- ** See what type of data is loaded in ADPro/MorphPlus.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
- IF (RESULT ~= 0) THEN
- EXIT 10
-
-
- /*
- ** Do the Roll operation, incrementing the current X position (and
- ** adjusting the x offset to be used) with each iteration.
- */
-
- IF (FirstCallSeq ~= 0) THEN DO
- XSIZE
- ImageWidth = ADPRO_RESULT
-
- XIncrement = TRUNC( (2 * ImageWidth - 2) / (NumberOfFrames - 1) )
- IF (XDirection = 0) THEN DO
- XPosition = ImageWidth - 1
- XIncrement = -XIncrement
- END
- ELSE
- XPosition = 1 - ImageWidth
-
- SETCLIP( "FREDXPosition", XPosition )
- SETCLIP( "FREDXIncrement", XIncrement )
- END
-
- IF (XPosition ~= 0) THEN DO
- IF (XPosition < 0) THEN DO
- XOffset = -XPosition
- DirectionString = "LEFT"
- END
- ELSE DO
- XOffset = XPosition
- DirectionString = "RIGHT"
- END
-
- IF (RollWrap ~= 0) THEN
- WrapString = "WRAP"
- ELSE
- WrapString = "NO_WRAP"
-
- OPERATOR "ROLL" DirectionString XOffset WrapString
-
- IF (RC ~= 0) THEN DO
- Why = ADPRO_RESULT
- ADPRO_TO_FRONT
- OKAY1 "The operator ROLL" || NL ||,
- "failed to execute." || NL ||,
- Why || NL ||,
- "Argument Information:" || NL ||,
- "Direction = " || DirectionString || NL ||,
- "XOffset = " || XOffset || NL ||,
- "Wrap = " || WrapString
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- END
-
-
- /*
- ** Update the clips.
- */
-
- SETCLIP( "FREDXPosition", XPosition + XIncrement )
-
- EXIT 0
-