home *** CD-ROM | disk | FTP | other *** search
- /*
- ** ReRender.fred
- **
- ** $VER: ReRender.fred 1.1.0 (24.10.93)
- **
- ** This program can be run from an InvokeADPro list to convert images
- ** into the user-defined screen settings. This script assumes that the
- ** clips described below have already been defined from virtually any
- ** other FREDRenderers script (except, at this time, the RenderAsDCTV.fred
- ** script).
- **
- ** Clips Imported:
- ** FREDScreenType - Screen type to be used
- ** FREDRenderType - Number of colors to render
- ** FREDLockPalette - ~0 if locked palette wanted
- ** 0 if floating palette wanted
- ** defined in a SaveAs pre script
- ** FREDDither - Which dither to use
- ** FREDDitherAmt - Dither amount to be used
- **
- ** 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 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
-
-
- /*
- ** If the definition of PaletteFile should change for any reason, change it
- ** also in the SaveAs post script which cleans up the file if it is present.
- */
-
- PaletteFile = "T:TempPalette"
-
-
- /*
- ** Get the required clips.
- **
- ** See if FREDLockPalette was previously defined. It will be if we are
- ** making an ANIM, for example. Set it to false if FREDLockPalette was not
- ** found.
- */
-
- PaletteFlag = GETCLIP( "FREDLockPalette" )
- IF (PaletteFlag = "") THEN
- PaletteFlag = 0
-
- ScreenType = GETCLIP( "FREDScreenType" )
- IF (ScreenType = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDScreenType," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- RenderType = GETCLIP( "FREDRenderType" )
- IF (RenderType = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDRenderType," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- END
-
- DitherMode = GETCLIP( "FREDDither" )
- IF (DitherMode = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDDither," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- ELSE IF (DitherMode = 6) | (DitherMode = 7) | (DitherMode = 8) THEN DO
- DitherAmt = GETCLIP( "FREDDitherAmt" )
- IF (DitherAmt = "") THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Required clip, FREDDitherAmt," || NL ||,
- "is not specified."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- END
-
-
- /*
- ** See what type of data is loaded in ADPro/MorphPlus.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
- IF (RESULT ~= 0) THEN
- EXIT 10
-
-
- /*
- ** If this isn't the first call then we may have to load a predefined palette.
- */
-
- IF ((FirstCallSeq = 0) & (PaletteFlag ~= 0)) THEN DO
- PSTATUS "UNLOCKED"
- PLOAD PaletteFile
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Loading of temp palette failed." || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || PaletteFile
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- PSTATUS "LOCKED"
- END
-
-
- /*
- ** Do the conversion.
- */
-
- SCREEN_TYPE ScreenType
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Screen mode not supported." || NL || ADPRO_RESULT
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- RENDER_TYPE RenderType
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Render mode not supported." || NL || ADPRO_RESULT
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- DITHER DitherMode
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Dither mode not supported." || NL || ADPRO_RESULT
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- IF (DitherMode = 6) | (DitherMode = 7) | (DitherMode = 8) THEN DO
- DITHER_AMOUNT DitherAmt
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Dither amount not supported." || NL || ADPRO_RESULT
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- END
-
- EXECUTE
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Rendering into" || NL ||,
- RenderType || " color mode failed."
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- PSTATUS "UNLOCKED"
-
-
- /*
- ** If this IS first call and we want a locked palette, we need to save one.
- */
-
- IF ((FirstCallSeq ~= 0) & (PaletteFlag ~= 0)) THEN DO
- PSAVE PaletteFile
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Saving of temp palette failed." || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || PaletteFile
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- END
-
- EXIT 0
-