/* ** VerticalScroll.fred ** ** $VER: VerticalScroll.fred 1.2.0 (23.10.93) ** ** This program can be run from an InvokeADPro list to rotate the current ** frame by the previously defined amount. ** ** Clips Imported: ** FREDNumberOfFrames - Total frames selected ** FREDYPosition - Current Y Position of the frame ** FREDYIncrement - Y Increment per frame ** FREDYDirection - ~0 if movement is to the right ** 0 if to the left ** FREDRollWrap - ~0 if image should wrap around ** 0 if not ** ** Clips Exported: ** FREDYPosition - Current Y 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 © 1993 Elastic Reality, Inc. ** 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 YDirection = GETCLIP( "FREDYDirection" ) IF (YDirection = "") THEN DO ADPRO_TO_FRONT OKAY1 "Required clip, FREDYDirection," || NL ||, "is not specified." SCREEN_TO_FRONT "FRED" EXIT 10 END END YPosition = GETCLIP( "FREDYPosition" ) IF (YPosition = "") THEN DO ADPRO_TO_FRONT OKAY1 "Required clip, FREDYPosition," || NL ||, "is not specified." SCREEN_TO_FRONT "FRED" EXIT 10 END YIncrement = GETCLIP( "FREDYIncrement" ) IF (YIncrement = "") THEN DO ADPRO_TO_FRONT OKAY1 "Required clip, FREDYIncrement," || NL ||, "is not specified." SCREEN_TO_FRONT "FRED" EXIT 10 END RollWrap = GETCLIP( "FREDRollWrap" ) IF (RollWrap = "") THEN DO ADPRO_TO_FRONT OKAY1 "Specified 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 Y position (and ** adjusting the y offset to be used) with each iteration. */ IF (FirstCallSeq ~= 0) THEN DO YSIZE ImageHeight = ADPRO_RESULT YIncrement = TRUNC( (2 * ImageHeight - 2) / (NumberOfFrames - 1) ) IF (YDirection = 0) THEN DO YPosition = ImageHeight - 1 YIncrement = -YIncrement END ELSE YPosition = 1 - ImageHeight SETCLIP( "FREDYPosition", YPosition ) SETCLIP( "FREDYIncrement", YIncrement ) END IF (YPosition ~= 0) THEN DO IF (YPosition < 0) THEN DO YOffset = -YPosition DirectionString = "UP" END ELSE DO YOffset = YPosition DirectionString = "DOWN" END IF (RollWrap ~= 0) THEN WrapString = "WRAP" ELSE WrapString = "NO_WRAP" OPERATOR "ROLL" DirectionString YOffset WrapString IF (RC ~= 0) THEN DO Why = ADPRO_RESULT ADPRO_TO_FRONT OKAY1 "The operator ROLL" || NL ||, "failed to execute." || NL ||, Why SCREEN_TO_FRONT "FRED" EXIT 10 END END /* ** Update the clips. */ SETCLIP( "FREDYPosition", YPosition + YIncrement ) EXIT 0