/* v0.9 2/24/93 Just Starting, but the program is pretty much */
/* done, in my head. */
/* v0.95 2/25/93 The script is done and (semi-)functional, but */
/* it's bumping into bugs. Needs a little */
/* polishing. */
/* v1.0 2/25/93 Finally done and fairly stable. Consult */
/* documentation for more info. */
/* v1.0a 2/25/93 Fixed version number in startup requestor. */
/* Fixed Method number in one of these goofy */
/* REMARK thingies. Nothing that matters. */
/* v1.0b 2/26/93 Corrected some spelling errors in the */
/* documentation. */
/* v1.1 2/26/93 Vastly icreased speed. By optimizing the */
/* diffusion and smoothing process. Now uses Blur */
/* DrawMode instead of Smooth to avoid the cross- */
/* hatch look. Then Uses Smooth DrawMode for top */
/* scanline to repair Blur's sloppiness. Only one */
/* or two Smooth passes are really all you'll ever */
/* need now. */
/* Also, the flames seem to look better now. */
/* v1.1b 2/26/93 Now only performs diffuse and blur operations */
/* from upper-left corner to brush-size + 25 */
/* pixels. */
/* v1.1c 2/27/93 Now only performs diffuse and blur operations */
/* from upper-left of brush to lower-left of brush */
/* MUCH faster. */
/* v1.1d 2/27/93 Speeded it up a bit more. I don't think I can */
/* squeeze much more speed out of this thing! */
/* v1.1e 2/28/93 Do you want to go FASTER??! :) I did it again. */
/* It's turbo-charged, especially for Hi-Res work. */
/* I also changed the sample images. I think it */
/* makes a bit of a better animation now. */
/* v1.1f 3/2/93 Fixed some bad syntax. Thanks for the */
/* correction Martin! */
/* v1.2 3/6/93 By request, I added another 'method.' Be */
/* sure to browse the documentation for a full */
/* explanation of how this works. */
/* v1.2b 4/11/93 Fixed AskString requestors to be friendly with */
/* OpalPaint v2.3 and higher */
/* v1.5 9/3/94 Upgraded requestors to take full advantage of */
/* OpalPaint v2.3's new Customizable requestors. */
/* Added Savable Default file feature */
/* Added Custom Flame colour-set feature. */
/* Added ability to visually preview your flame */
/* colour-set. */
/* Added ability to disable blur passes. Why? */
/* HeckifIKnow! */
/* v1.5b Added lables for hottest to coolest colours in */
/* the "Custom" flame colour settings area. */
/* See documentation for more information */
/* Initialization of variables. Don't touch unless you know what
you are doing. */
ROOT = 'pic.'
ZERO = '0'
Options Results
Address 'OpalPaint_Rexx'
Call Panic()
Call VersionCheck()
Call ConfirmFlaminator()
Call AskMethod()
Call AskColour()
Call AskFlamePrefs()
/* Get BackgroundSource pathname */
If Method < 2 Then Do
Call GetDefaults()
PathNameDef = BkgndSrcPathDef
ReqTitle = 'Enter the pathname of your BACKGROUND source image(s)'
ReqHail = 'Get BACKGROUND animation PATH'
Call PathNameGetter()
BkgndSrcPathDef = PathNameDef
BackGroundSource = PathName
Call SaveDefaults()
End
If Method = 0 Then Call CheckDirForFiles()
/* Get FlameSource pathname */
Call GetDefaults()
PathNameDef = FlameSrcPathDef
ReqTitle = 'Enter the pathname of your FLAME source image(s)'
ReqHail = 'Get FLAME animation PATH'
Call PathNameGetter()
FlameSrcPathDef = PathNameDef
FlameSource = PathName
Call SaveDefaults()
If FlameSource = BackgroundSource Then Do
Okay 'FATAL ERROR! The FLAME source images can NOT be in\nthe same drawer as the BACKGROUND source images.\nPlease make sure you are REALLY ready to launch this script.\nRead the documentation for more info. Exiting...'
Exit
End
Call GetFlameNumbers()
/* Get Destination pathname for Method 0 or 2 */
If Method ~= 1 Then Do
Call GetDefaults()
PathNameDef = DestPathDef
ReqTitle = 'Enter pathname for FLAMED DESTINATION images.'
ReqHail = 'Get DESTINATION animation PATH'
Call PathNameGetter()
DestPathDef = PathNameDef
FlameDest = PathName
Call SaveDefaults()
If FlameDest = BackgroundSource Then Do
Okay 'FATAL ERROR! The FLAMED destination images can NOT be in\nthe same drawer as the BACKGROUND source images.\nPlease make sure you are REALLY ready to launch this script.\nRead the documentation for more info. Exiting...'
Exit
End
End
If Method = 1 Then Do
Call AskOverwrite()
If Overwrite = 0 Then Do
Call GetDefaults()
PathNameDef = DestPathDef
ReqTitle = 'Enter pathname for FLAMED DESTINATION images.'
ReqHail = 'Get DESTINATION animation PATH'
Call PathNameGetter()
DestPathDef = PathNameDef
FlameDest = PathName
Call SaveDefaults()
If FlameDest = BackgroundSource Then Do
Okay 'FATAL ERROR! The FLAMED destination images can NOT be in\nthe same drawer as the BACKGROUND source images.\nPlease make sure you are REALLY ready to launch this script.\nRead the documentation for more info. Exiting...'
Exit
End
End
End
If Method = 2 Then Do
Finder = Exists('Ram:Method2/')
If Finder = 0 Then Do
Address COMMAND
'Makedir ram:Method2'
End
BackgroundSource = 'Ram:Method2'
Address 'OpalPaint_Rexx'
Save BackgroundSource || '/pic.0001'
Method = 0
End
/* Here we go!! I'll take it from here. */
Address 'OpalPaint_Rexx'
Okay 'Here we go.'
Call Panic()
Do A = StartFrame to EndFrame
/* Get IFF Variables */
Iff = Root || Zero || Zero || Zero || A
If A < 10000 & A > 999 Then Iff = Root || A
If A < 1000 & A > 99 Then Iff = Root || Zero || A
If A < 100 & A > 9 Then Iff = Root || Zero || Zero || A
/* Search for next FLAME frame and load*/
DisplayStatus 'Find ' || A
Finder = Exists(FlameSource || Iff)
If Finder = 1 Then Do
Load Flamesource || Iff
PageSize
Parse Var Result X2 Y2
/* Set pots */
SetPot 1 0 0 0
SetPot 2 255 255 255
SetPot 3 FlameCol1
SetPot 4 FlameCol2
SetPot 5 FlameCol3
SetPot 6 FlameCol4
SetPot 7 1 1 1
DisplayStatus 'Initialze'
Trans 0
Texture 0
FillMode SOLID
SetDrawMode 1
SmoothPaper
ActiveNozzle 1
MaskSten 0
ColSten 1
/* Check for special brightness code */
If Method = 0 Then Do
DisplayStatus 'Code Check'
MethodCode = 1
ReadPixel 0 0
Parse Var Result R G B
If R > 0 Then MethodCode = 1
ReadPixel 1 0
Parse Var Result R G B
If R > 0 Then MethodCode = 2
ReadPixel 2 0
Parse Var Result R G B
If R > 0 Then MethodCode = 3
ReadPixel 3 0
Parse Var Result R G B
If R > 0 Then MethodCode = 4
ReadPixel 4 0
Parse Var Result R G B
If R > 0 Then MethodCode = 5
End
/* Cleanup corner */
ActivePot 1
'StenEnable DISABLE'
Line 0 0 5 0
/* Turn on Stencil to fix white to 255 255 255 */
DisplayStatus 'Fix White'
SetColSten 1 0 0 0 0 0 0 0
EnableColEntry 1 1
StenEnable 0
ActivePot 2
FreeHand 0 0
LastPoint 0 0
'StenEnable ENABLE'
RectCut 0 0 X2 Y2
'StenEnable DISABLE'
Handle 0 0
ColourSource 'PAINTPOT'
PutBrush 0 0
ColourSource 'MULTICOLOUR'
BrushSize
parse var Result BX2 BY2
/* Pick up White flame image */
ActiveNozzle 1
NozzleSize 1 1
ActivePot 1
FreeHand 0 0
LastPoint 0 0
'StenEnable ENABLE'
DisplayStatus 'Get Brush'
ActiveBrush 2
RectCut 0 0 BX2 BY2
Handle 0 0
/*Get upper-left Brush Sizer */
BrushSize
parse var Result BX1 BY1
BX1 = BX2 - BX1
BY1 = BY2 - BY1
BX1 = BX1 - (FlameSize + 7)
BY1 = BY1 - (FlameSize + 7)
If BX1 < 0 Then BX1 = 0
If BY1 < 0 Then BY1 = 0
BX2 = BX2 + (FlameSize + 7)
BY2 = BY2 + (FlameSize + 7)
If BX2 > X2 Then BX2 = X2
If BY2 > Y2 Then BY2 = Y2
'StenEnable DISABLE'
/* Clean up corner again */
ActivePot 1
ActiveNozzle 1
NozzleSize 0 0
FreeHand 0 0
LastPoint 0 0
Point BX1 BY1
FreeHand BX1 BY1
LastPoint BX1 BY1
/* Diffuse White flame image */
If DiffuseBool = 1 Then Do
DisplayStatus 'Diffuse 1'
SetSpare 1 Diffuse
SetDrawMode 19 FlameSize
SetDrawMode 19 FlameSize
SolidRect BX1 BY1 BX2 BY2
End
/* Add 'Handle Dot' */
'StenEnable DISABLE'
DisplayStatus 'Handle Dot'
SetDrawMode 1
ActivePot 7
ActiveNozzle 1
NozzleSize 1 1
Point BX1 BY1
FreeHand BX1 BY1
LastPoint BX1 BY1
/* Pick up White flame image */
'StenEnable ENABLE'
DisplayStatus 'Get Brush'
ActiveBrush 1
RectCut BX1 BY1 X2 Y2
Handle 0 0
'StenEnable DISABLE'
ActiveNozzle 1
NozzleSize 1 1
Point BX1 BY1
FreeHand BX1 BY1
LastPoint BX1 BY1
/* Outline Brush with flame colours */
ActiveBrush 1
ActivePot 3
NotBusy
Key 'o'
ActivePot 4
Key 'o'
Key 'o'
ActivePot 5
Key 'o'
Key 'o'
ActivePot 6
Key 'o'
Busy
/* Stamp coloured brush down */
DisplayStatus 'stamping'
Handle 6 6
'StenEnable DISABLE'
ColourSource 'MULTICOLOUR'
PutBrush BX1 BY1
/* Cleanup corner */
ActivePot 1
'StenEnable DISABLE'
NewBX1 = BX1 - 6
If NewBX1 < 0 Then NewBX1 = 0
NewBY1 = BY1 - 6
If NewBY1 < 0 Then NewBY1 = 0
SolidRect NewBX1 NewBY1 (BX1 + 6) (BY1 + 6)
/* Diffuse Coloured flame image */
If DiffuseBool = 1 Then Do
DisplayStatus 'Diffuse 2'
SetDrawMode 19 FlameSize
SetDrawMode 19 FlameSize
SolidRect BX1 BY1 BX2 BY2
End
/* Blur image */
If BlurValue > 0 Then Do
ActivePot 1
ActiveNozzle 1
NozzleSize 1 1
SetSpare 1 Blur
SetDrawMode 19 100
SetDrawMode 19 100
Do Smoothy = 1 to BlurValue
SolidRect BX1 BY1 BX2 BY2
End
SetDrawMode 16 100
SetDrawMode 16 100
Do SmoothyB = 1 to 4
Line NewBX1 0 BX2 0
End
End
/* Repair Handle Dot */
SetDrawMode 1
ActivePot 7
Point BX1 BY1
FreeHand BX1 BY1
LastPoint BX1 BY1
/* Pick up finished flame brush! */
ActiveBrush 1
RectCut BX1 BY1 BX2 BY2
Handle 0 0
/* Method 0 */
If Method = 0 Then Do
If MethodCode = 1 Then Do
Load BackgroundSource || 'pic.0001'
End
If MethodCode = 2 Then Do
Finder = Exists(BackgroundSource || 'pic.0002')
If Finder = 0 Then Load BackgroundSource || 'pic.0001'
If Finder = 1 Then Load BackgroundSource || 'pic.0002'
End
If MethodCode = 3 Then Do
Finder = Exists(BackgroundSource || '/pic.0003')
If Finder = 0 Then Load BackgroundSource || 'pic.0001'
If Finder = 1 Then Load BackgroundSource || 'pic.0003'
End
If MethodCode = 4 Then Do
Finder = Exists(BackgroundSource || '/pic.0004')
If Finder = 0 Then Load BackgroundSource || 'pic.0001'
If Finder = 1 Then Load BackgroundSource || 'pic.0004'
End
If MethodCode = 5 Then Do
Finder = Exists(BackgroundSource || '/pic.0005')
If Finder = 0 Then Load BackgroundSource || 'pic.0001'
If Finder = 1 Then Load BackgroundSource || 'pic.0005'
End
End
/* Method 1 */
If Method = 1 Then Do
Finder = Exists(BackgroundSource || Iff)
If Finder = 0 Then Do
Okay 'FATAL ERROR! Background source image is missing!\nSorry, gotta exit.'
Exit
End
Load BackGroundSource || Iff
End
/* Add Fire to image */
SetDrawMode 2 100
ActiveBrush 1
Handle 0 0
Do Loopsy = 1 to FlameIntensity
Putbrush BX1 BY1
End
Refresh
/* Save composited image for Method 0 */
If Method = 0 Then Do
Save FlameDest || Iff
End
/* Save composited image for Method 1 */
If Method = 1 Then Do
If Overwrite = 0 Then Do
Save FlameDest || Iff
End
If Overwrite = 1 Then Do
Save BackgroundSource || Iff
End
End
End
End
/*All Done! */
Okay 'Operation Complete! Go animate it and impress your friends!\n\nThink this script is cool?\nCheck out Part And Particle or the Video Panel Machine!\nCall Carmen at (619) 573-0285 for more info.'
Exit
VersionCheck:
/* Check to make sure user has at least OpalPaint v2.3 */
Version
Parse Var Result VerThingy ' ' OpalName ' ' VersionNum ' ' DateNum
If Left(VersionNum,3) < 2.3 Then Do
AskBool 'It appears that you are using OpalPaint v' || VersionNum || '\n\nFLAMINATOR v1.5 requires OpalPaint v2.3 or higher\n\nShall I continue?'
If Result = 0 Then Do
Okay 'Exiting...'
Exit
End
End
Return
ConfirmFlaminator:
Address 'OpalPaint_Rexx'
ReqBuild '420 130 " "'
AddBox '10 10 400 110'
AddBox '15 15 5 5 Raised'
AddBox '-20 15 5 5 Raised'
AddBox '15 -20 5 5 Raised'
AddBox '-20 -20 5 5 Raised'
AddBox '47 -53 106 31'
AddBox '-153 -53 106 31'
AddHeading 'CenterX 20 "Flaminator v1.5b"'
AddHeading 'CenterX 35 "an Arexx script for OpalPaint v2.3 or higher"'
AddHeading 'CenterX 45 "by Carmen Rizzolo"'
AddGadget 'Button YesButton 50 -25 Medium "Continue"'