/* ** ReRender.fred ** ** $VER: ReRender.fred 1.1.1 (12.4.94) ** ** 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 ** FREDDither - Which dither to use ** FREDDitherAmt - Dither amount to be used ** FREDLockPalette - 2 to lock to a specific palette ** 1 to lock to the current palette ** 0 to leave the palette unlocked ** ** 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-1994 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 PaletteFile = "T:TempRenderPalette" /* ** 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 is the first call and we've specified to render with the first frame's ** palette, save it. */ IF ((FirstCallSeq ~= 0) & (PaletteFlag = 1)) THEN DO PSAVE PaletteFile IF (RC ~= 0) THEN DO ADPRO_TO_FRONT OKAY1 "Could not save first frame's palette." SCREEN_TO_FRONT "FRED" EXIT 10 END PSTATUS "LOCKED" END /* ** If this isn't the first call then we may have to load a predefined palette. */ IF (PaletteFlag ~= 0) THEN DO PSTATUS "UNLOCKED" PLOAD PaletteFile IF (RC ~= 0) THEN DO ADPRO_TO_FRONT OKAY1 "Loading of render 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" EXIT 0