home *** CD-ROM | disk | FTP | other *** search
Wrap
/* Program to use ADPro to make a fade from one looping anim or still image to another. Best results if palette is not locked. Uses current screen type and colour range. */ /* Op5 or Op8 select added 21/10/93 */ /* Written by Don Cox. Copyright. Not Public Domain */ trace r options results address "ADPro" lformat "UNIVERSAL" lformat1 = "UNIVERSAL" /* for changing if file is an anim */ lformat2 = "UNIVERSAL" still1 = 1 still2 = 1 sformat "ANIM" render_type colours = ADPro_result screen_type stype = ADPro_result gamma gammasetting = ADPro_result getfile '"Select first file ..."' if rc~=0 then do okay1 "No file selected" exit end filename1 = ADPro_result call open("input",filename1,"R") filetype = right(readch("input",12),4) if filetype = "ANIM" then do lformat1 = "ANIM" still1 = 0 end call close("input") getnumber '"How many frames of this one?"' 32 1 1400 if rc~=0 then do okay1 "User aborted program" exit end frames1 = ADPro_result getfile '"Select second file ..."' if rc~=0 then do okay1 "No file selected" exit end filename2 = ADPro_result call open("input",filename2,"R") filetype = right(readch("input",12),4) if filetype = "ANIM" then do lformat2 = "ANIM" still2 = 0 end call close("input") getnumber '"How many frames of this one?"' 32 1 1400 if rc~=0 then do okay1 "User aborted program" exit end frames2 = ADPro_result getnumber '"How many frames of fade?"' 32 1 1400 if rc~=0 then do okay1 "User aborted program" exit end fadeframes = ADPro_result if fadeframes>frames1 then fadeframes = frames1 if fadeframes>frames2 then fadeframes = frames2 totalframes = frames1+frames2-fadeframes startsecond = frames1-fadeframes+1 mixincrement = trunc(100/fadeframes) getfile '"Select destination anim..."' "ADPro:" '"test.anim"' if rc~=0 then do okay1 "No file selected" exit end filename3 = ADPro_result getnumber '"Output width (pixels)"' 320 16 1400 if rc~=0 then do okay1 "User aborted program" exit end width = ADPro_result getnumber '"Output height (pixels)"' 256 16 1024 if rc~=0 then do okay1 "User aborted program" exit end height = ADPro_result /* okay2 "Adjust Dynamic Range?" dyrange = rc */ okay2 "Broadcast limit?" brlimit = rc okay2 "OpCode 8 anim?" Op8 = rc animformat = "BYTE" if Op8~=0 then animformat = "LONG" framecount1 = 1 framecount2 = 1 fadeframe = 1 still3 = still1 /* store the value */ do i = 1 to (startsecond-1) load_type "REPLACE" lformat lformat1 /* set load type for file */ if still1 = 0 then do /* load new anim frames */ load filename1 "FRAME" framecount1 if rc ~=0 then do /* run out of frames? */ framecount1 = 3 /* loop the anim; if your anims are non-looping, this should be 1 not 3. */ load filename1 "FRAME" framecount1 if rc ~=0 then leave i /* real dud load */ end abs_scale width height render_type colours /* number of colours */ screen_type stype /* PAL/NTSC, overscan, etc */ if brlimit ~=0 then operator "BROADCAST_LIMIT" "PAL" "DEFAULT_LIM" gamma gammasetting execute end if still1 = 1 then do /* still picture */ load filename1 still1 = 3 /* no more loads needed */ abs_scale width height render_type colours /* number of colours */ screen_type stype /* PAL/NTSC, overscan, etc */ if brlimit ~=0 then operator "BROADCAST_LIMIT" "PAL" "DEFAULT_LIM" gamma gammasetting execute end save filename3 "IMAGE" "APPEND" "SMALLER" animformat /* LONG gives Anim-8 format */ if rc~=0 then do okay1 '"Trouble saving file "filename3' exit end framecount1 = framecount1+1 end /* pre-fade section */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ still1 = still3 /* restore value */ do i = startsecond to frames1 /* fading section */ load_type "REPLACE" lformat lformat2 if still2 = 0 then do load filename2 "FRAME" framecount2 if rc ~=0 then do /* run out of frames? */ framecount2 = 3 /* loop the anim, or repeat still */ load filename2 "FRAME" framecount2 if rc ~=0 then leave i /* real dud load */ end end else load filename2 abs_scale width height testvalue = rc sformat "IFF" /* save it for a moment */ save "adpro:temp.pic" "RAW" if rc~=0 then do okay1 '"Trouble saving temporary file."' exit end sformat "ANIM" load_type "REPLACE" lformat lformat1 if still1 = 0 then do load filename1 "FRAME" framecount1 /* anim */ if rc ~=0 then do /* run out of frames? */ framecount1 = 3 /* loop the anim, or repeat still */ load filename1 "FRAME" framecount1 if rc ~=0 then leave i /* real dud load */ end end else load filename1 /* still */ abs_scale width height testvalue = rc mix = mixincrement*fadeframe if mix>100 then mix = 100 load_type "COMPOSE" /* now bring back the other picture */ loader "IFF" "adpro:temp.pic" 0 0 mix render_type colours /* number of colours */ screen_type stype /* PAL/NTSC, overscan, etc */ if brlimit ~=0 then operator "BROADCAST_LIMIT" "PAL" "DEFAULT_LIM" gamma gammasetting execute save filename3 "IMAGE" "APPEND" "SMALLER" animformat /* LONG gives Anim-8 format */ if rc~=0 then do okay1 '"Trouble saving file "filename3' exit end framecount2 = framecount2+1 framecount1 = framecount1+1 fadeframe = fadeframe+1 end /* fade section */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ lformat lformat2 load_type "REPLACE" do i = frames1+1 to totalframes /* section after fade */ if still2 = 0 then do load filename2 "FRAME" framecount2 if rc ~=0 then do /* run out of frames? */ framecount2 = 3 /* loop the anim, or repeat still */ load filename2 "FRAME" framecount2 if rc ~=0 then leave i /* real dud load */ end abs_scale width height render_type colours /* number of colours */ screen_type stype /* PAL/NTSC, overscan, etc */ if brlimit ~=0 then operator "BROADCAST_LIMIT" "PAL" "DEFAULT_LIM" gamma gammasetting execute end /* still2 = 0 */ if still2 = 1 then do /* still picture */ load filename2 still2 = 3 /* no more loads needed */ abs_scale width height render_type colours /* number of colours */ screen_type stype /* PAL/NTSC, overscan, etc */ if brlimit ~=0 then operator "BROADCAST_LIMIT" "PAL" "DEFAULT_LIM" gamma gammasetting execute end save filename3 "IMAGE" "APPEND" "SMALLER" animformat /* LONG gives Anim-8 format */ if rc~=0 then do okay1 '"Trouble saving file "filename3' exit end framecount2 = framecount2+1 end /* section after fade */ save filename3 "IMAGE" "WRAPUP" /* looping closedown */ lformat "UNIVERSAL" address command "delete >nil: ADPro:temp.pic" exit end