home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / ADPro251-3.DMS / ADPro251-3.adf / FREDScripts.lha / FREDOperators / VerticalScroll.fred < prev   
Encoding:
Text File  |  1994-01-31  |  3.2 KB  |  162 lines

  1. /*
  2. ** VerticalScroll.fred
  3. **
  4. ** $VER: VerticalScroll.fred 1.2.0 (23.10.93)
  5. **
  6. ** This program can be run from an InvokeADPro list to rotate the current
  7. ** frame by the previously defined amount.
  8. **
  9. ** Clips Imported:
  10. **    FREDNumberOfFrames    -    Total frames selected
  11. **    FREDYPosition        -    Current Y Position of the frame
  12. **    FREDYIncrement        -    Y Increment per frame
  13. **    FREDYDirection        -    ~0 if movement is to the right
  14. **                    0 if to the left
  15. **    FREDRollWrap        -    ~0 if image should wrap around
  16. **                    0 if not
  17. **
  18. ** Clips Exported:
  19. **    FREDYPosition        -    Current Y Position of the frame
  20. **
  21. ** NOTE: Clip names are case sensitive.
  22. **
  23. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  24. ** ADPro v2.5.0 (or higher).
  25. **
  26. ** Copyright © 1993 ASDG, Incorporated
  27. ** All Rights Reserved
  28. */
  29.  
  30.  
  31. ADDRESS "ADPro"
  32. OPTIONS RESULTS
  33.  
  34. PARSE ARG FrameNum FrameFName Length LoadFlag FirstCallSeq FirstCallCell
  35.  
  36. NL = '0A'X
  37. SQ = '27'X
  38. DQ = '22'X
  39. TRUE  = 1
  40. FALSE = 0
  41.  
  42.  
  43. /*
  44. ** Get the required clips.  Error if any are missing.
  45. */
  46.  
  47. IF (FirstCallSeq ~= 0) THEN DO
  48.     NumberOfFrames = GETCLIP( "FREDNumberOfFrames" )
  49.     IF (NumberOfFrames = "") THEN DO
  50.         ADPRO_TO_FRONT
  51.         OKAY1 "Required clip, FREDNumberOfFrames," || NL ||,
  52.             "is not specified."
  53.         SCREEN_TO_FRONT "FRED"
  54.         EXIT 10
  55.     END
  56.  
  57.     YDirection = GETCLIP( "FREDYDirection" )
  58.     IF (YDirection = "") THEN DO
  59.         ADPRO_TO_FRONT
  60.         OKAY1 "Required clip, FREDYDirection," || NL ||,
  61.             "is not specified."
  62.         SCREEN_TO_FRONT "FRED"
  63.         EXIT 10
  64.     END
  65. END
  66.  
  67. YPosition = GETCLIP( "FREDYPosition" )
  68. IF (YPosition = "") THEN DO
  69.     ADPRO_TO_FRONT
  70.     OKAY1 "Required clip, FREDYPosition," || NL ||,
  71.         "is not specified."
  72.     SCREEN_TO_FRONT "FRED"
  73.     EXIT 10
  74. END
  75.  
  76. YIncrement = GETCLIP( "FREDYIncrement" )
  77. IF (YIncrement = "") THEN DO
  78.     ADPRO_TO_FRONT
  79.     OKAY1 "Required clip, FREDYIncrement," || NL ||,
  80.         "is not specified."
  81.     SCREEN_TO_FRONT "FRED"
  82.     EXIT 10
  83. END
  84.  
  85. RollWrap = GETCLIP( "FREDRollWrap" )
  86. IF (RollWrap = "") THEN DO
  87.     ADPRO_TO_FRONT
  88.     OKAY1 "Specified clip, FREDRollWrap," || NL ||,
  89.         "is not specified."
  90.     SCREEN_TO_FRONT "FRED"
  91.     EXIT 10
  92. END
  93.  
  94.  
  95. /*
  96. ** See what type of data is loaded in ADPro/MorphPlus.
  97. */
  98.  
  99. CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
  100. IF (RESULT ~= 0) THEN
  101.     EXIT 10
  102.  
  103.  
  104. /*
  105. ** Do the Roll operation, incrementing the current Y position (and
  106. ** adjusting the y offset to be used) with each iteration.
  107. */
  108.  
  109. IF (FirstCallSeq ~= 0) THEN DO
  110.     YSIZE
  111.     ImageHeight = ADPRO_RESULT
  112.  
  113.     YIncrement = TRUNC( (2 * ImageHeight - 2) / (NumberOfFrames - 1) )
  114.     IF (YDirection = 0) THEN DO
  115.         YPosition = ImageHeight - 1
  116.         YIncrement = -YIncrement
  117.     END
  118.     ELSE
  119.         YPosition = 1 - ImageHeight
  120.  
  121.     SETCLIP( "FREDYPosition", YPosition )
  122.     SETCLIP( "FREDYIncrement", YIncrement )
  123. END
  124.  
  125. IF (YPosition ~= 0) THEN DO
  126.     IF (YPosition < 0) THEN DO
  127.         YOffset = -YPosition
  128.         DirectionString = "UP"
  129.     END
  130.     ELSE DO
  131.         YOffset = YPosition
  132.         DirectionString = "DOWN"
  133.     END
  134.  
  135.     IF (RollWrap ~= 0) THEN
  136.         WrapString = "WRAP"
  137.     ELSE
  138.         WrapString = "NO_WRAP"
  139.  
  140.     OPERATOR "ROLL" DirectionString YOffset WrapString
  141.  
  142.     IF (RC ~= 0) THEN DO
  143.         Why = ADPRO_RESULT
  144.         ADPRO_TO_FRONT
  145.         OKAY1 "The operator ROLL" || NL ||,
  146.             "failed to execute." || NL ||,
  147.             Why
  148.         SCREEN_TO_FRONT "FRED"
  149.         EXIT 10
  150.  
  151.     END
  152. END
  153.  
  154.  
  155. /*
  156. ** Update the clips.
  157. */
  158.  
  159. SETCLIP( "FREDYPosition", YPosition + YIncrement )
  160.  
  161. EXIT 0
  162.