home *** CD-ROM | disk | FTP | other *** search
- /** Reduce amplitude of a wave with DUST(© '94 A.Maschke)
- **
- ** $VER: 1.4 AmpRedReq (10.01.1995 Wolfgang Loske)
- **
- ** Read manual for more information
- ** Bitte Anleitung für mehr Informationen lesen
- **
- **/
-
- CALL AddLib('rexxsupport.library',0,-30,0)
- CALL AddLib('rexxreqtools.library',0,-30,0)
-
- /**
- ** Initialize some colors, change if you want
- ** Ein paar Farben anmelden, ändern wie gewünscht
- **/
- csi='9b'x;slant=csi'3m';bold=csi'1m';norm=csi'0m';black=csi'31m'
- white=csi'32m';blue=csi'33m';LF = '0a'x
-
- /** Get commandline argument ## Argument der Kommandozeile holen
- **This Proggi has no options :-))))
- **/
- FRAMES_B = "0"
- FRAMES_W = "24"
- FRAMES_A = "0"
- DEST = "RAM:"
- ROOT = "obj."
- TITLE = "AmpRed2d Requester"
- FONT = "rt_font=thin609.font/8"
- /* Check for configuration */
- if ~open(PATH,"env:DUST",R) then do
- call rtezrequest("Could not open ENV:DUST to get your path to the executables !"LF||,
- "Please refer to the manual for installation instructions","Bummer",TITLE,FONT)
- exit
- end
- else
- PATH=readln(PATH)
-
- X= rtezrequest("We have the following defaults."LF||,
- "If you want to enter new values, answer the question with N."LF||,
- "If you only want to change one particular value, accept"LF||,
- "the other by pressing return. You will be asked again afterwards!","Yo!|EXIT",TITLE,FONT)
- if X = 0 then call EXIT
-
- BACK1:
- FRAMES = FRAMES_B + FRAMES_W + FRAMES_A
- ANSWER= rtezrequest("QUESTION:"LF||LF||,
- "You want "||FRAMES||" frames for the animation ?"LF||,
- "You want "||FRAMES_B||" frames befor the wave ?"LF||,
- "You want "||FRAMES_W||" frames for the wave itself ?"LF||,
- "You want "||FRAMES_A||" frames after the wave ?"LF||,
- "You want the files stored in "||DEST||" ?"LF||,
- "You want the sequence to have "||ROOT||" as the root name ?"LF||LF||,
- "Is this right ?","Yes|EXIT|No",TITLE,FONT)
- Select
- when ANSWER = "1" then NOP
- when ANSWER = "2" then call EXIT
- when ANSWER = "0" then SETUP = 1
- otherwise
- do
- say "Only "bold"Y"norm", "bold"N"norm" or just Return are valid answers"
- call BACK1
- end
- end
-
- if SETUP = 1 then do
- FRAMES_B=rtgetlong(FRAMES_B,"How many frames do you want before the wave ?",TITLE,"Yep !",FONT "rtgl_min=0")
- if FRAMES_B = "" then FRAMES_B = "0"
- FRAMES_W=rtgetlong(FRAMES_W,"How many frames do you want for the wave itself ?",TITLE,"Yep !",FONT "rtgl_min=1")
- if FRAMES_W = "" then FRAMES_W = "24"
- FRAMES_A=rtgetlong(FRAMES_A,"How many frames do you want after the wave ?",TITLE,"Yep !",FONT "rtgl_min=0")
- if FRAMES_A = "" then FRAMES_A = "0"
- DEST=rtfilerequest(DEST,,TITLE,"Yep !",FONT "rtfi_flags=freqf_nofiles")
- if DEST = "" then DEST = "ram:"
- ROOT=rtgetstring(ROOT,"Please give rootname of the resulting animation sequence !",
- ,TITLE,"Yep !",FONT)
- if ROOT = "" then ROOT = "obj."
- SETUP = 0
- call BACK1
- end
-
- SOURCE:
- CUR = pragma("Directory")
- SOURCE=rtfilerequest(CUR,,"Select SOURCE object !","Yo!",FONT)
- Select
- when SOURCE = "" then do
- X= rtezrequest("No source given. Please enter again !","Bummer|EXIT",TITLE,FONT)
- if X=0 then call exit
- else call SOURCE
- end
- when ~exists(SOURCE) then do
- call rtezrequest("Object does not exist !!! Please enter again !","Bummer|EXIT",TITLE,FONT)
- if X=0 then call exit
- else call SOURCE
- call SOURCE
- end
- otherwise
- end
-
- /** Wave parameters **/
- OBJID=1;DESTID=2;AMPLITUDE_S=12;AMPLITUDE_E=0
- AMPLITUDE_S= rtgetlong(AMPLITUDE_S, "This is the starting amplitude value !"LF||,
- "This value will be divided by "||FRAMES_W||" to reduce the amplitude"LF||,
- "of your wave continously to your chosen end amplitude value, which"LF||,
- "defaults to 0"||LF||"Enter new value, if you want",TITLE,"Yep|EXIT",FONT)
- if RTRESULT = 0 then call exit
- AMPLITUDE_E= rtgetlong(AMPLITUDE_E, "This is the end amplitude value !"LF||,
- "The value of your starting amplitude, which currently is "||AMPLITUDE_S||LF||,
- "will be divided by "||FRAMES_W||" to reduce the amplitude"LF||,
- "of your wave continously to the value entered here"LF||,
- "Enter new value, if you want",TITLE,"Yep|EXIT",FONT)
- if RTRESULT = 0 then call exit
-
- SKIP=(AMPLITUDE_S - AMPLITUDE_E)/FRAMES_W
- X=rtezrequest("Your amplitude will be reduced by "||SKIP||" per frame"LF||,
- "If you, for any reason, think this is not a good value, you may change"LF||,
- "your starting amplitude in the following requester","Gotcha !|EXIT",TITLE,FONT)
- if X=0 then call exit
-
- TYPE=T;AMPLITUDE=AMPLITUDE_S;WAVELENGTH=24;SOURCEX=0; SOURCEY=0; DAMPING=1.0;PHASE=60
- WAVE.1 = "wave2dframe("OBJID","FRAMES",$,"DESTID","TYPE","AMPLITUDE","WAVELENGTH","SOURCEX","SOURCEY","DAMPING","PHASE")"
-
- X= rtezrequest("We have the following predefined values for this wave !"LF||,
- "You will now be shown these predefinded parameters in the following order:"LF||,
- "TYPE,AMPLITUDE,WAVELENGTH,SOURCEX,SOURCEY,DAMPING and PHASE"LF||,
- "If you want to change one or more , you have to type the new"LF||,
- "values _EXACTLY_ in this order seperated by spaces"LF||,
- "i.e.: l 13 20 10 14 1.1 -45","Gotcha !|EXIT",TITLE,FONT)
- if X=0 then call exit
-
- VALUES = rtgetstring(TYPE AMPLITUDE WAVELENGTH SOURCEX SOURCEY,
- DAMPING PHASE ,LF||,
- "Type Amplitude Wavelength SourceX SourceY Damping Phase"LF||,
- center(TYPE,5) center(AMPLITUDE,9) center(WAVELENGTH,12),
- center(SOURCEX,8) center(SOURCEY,9) center(DAMPING,8) center(PHASE,6)LF||,
- "Press Return to accept or enter new values",TITLE,"Wow !",FONT)
- if VALUES = "" then
- WAVE.1 = WAVE.1
- else do
- parse var VALUES TYPE AMPLITUDE WAVELENGTH SOURCEX SOURCEY DAMPING PHASE
- wave.1="wave2dframe("OBJID","FRAMES",$,"DESTID","TYPE","AMPLITUDE","WAVELENGTH","SOURCEX","SOURCEY","DAMPING","PHASE")"
- end
-
- LOAD = "load("OBJID","SOURCE")"
- COPY = "copy("DESTID","OBJID")"
- SAVE = "save("DESTID","DEST||ROOT||"%)"
-
- call open(FILE,"t:SCRIPT",W)
- call writeln(FILE, LOAD)
- if FRAMES_B >0 then
- do i=1 to FRAMES_B
- NULL = "000"
- if i > 9 then NULL = "00"
- if i > 99 then NULL = "0"
- if i > 999 then NULL = ""
- call writeln(FILE, "save("OBJID","DEST||ROOT||NULL||i")")
- end
- do i=FRAMES_B + 1 to FRAMES_B + FRAMES_W
- if i > FRAMES_B + 1 then AMPLITUDE = AMPLITUDE_S - SKIP
- wave.i="wave2dframe("OBJID","FRAMES","i","DESTID","TYPE","AMPLITUDE","WAVELENGTH","SOURCEX","SOURCEY","DAMPING","PHASE")"
- call writeln(FILE,WAVE.i)
- NULL = "000"
- if i > 9 then NULL = "00"
- if i > 99 then NULL = "0"
- if i > 999 then NULL = ""
- call writeln(FILE, "save("DESTID","DEST||ROOT||NULL||i")")
- AMPLITUDE_S = AMPLITUDE
- END
- if FRAMES_A >0 then
- do i= FRAMES_B + FRAMES_W + 1 to FRAMES_B + FRAMES_W + FRAMES_A
- if AMPLITUDE_E ~= 0 then do
- wave.i="wave2dframe("OBJID","FRAMES","i","DESTID","TYPE","AMPLITUDE","WAVELENGTH","SOURCEX","SOURCEY","DAMPING","PHASE")"
- call writeln(FILE,WAVE.i)
- NULL = "000"
- if i > 9 then NULL = "00"
- if i > 99 then NULL = "0"
- if i > 999 then NULL = ""
- call writeln(FILE, "save("DESTID","DEST||ROOT||NULL||i")")
- end
- else do
- NULL = "000"
- if i > 9 then NULL = "00"
- if i > 99 then NULL = "0"
- if i > 999 then NULL = ""
- call writeln(FILE, "save("OBJID","DEST||ROOT||NULL||i")")
- end
- end
- call close(FILE)
-
- X= rtezrequest("Calling Dust in the background."LF||,
- "Objects will be created and saved in the path you've chosen."LF||,
- "Please be patient, this may take a while !"LF||LF||,
- "If you interupt now, you have the basic script for DUST in T: !",
- ,"Nice !|EXIT",TITLE,FONT )
- if X=0 then call EXIT
- DUST = PATH||"dust >nil: t:script"
- call open(FILE,"t:SCRIPT",A)
- call writeln(FILE,"exit")
- call close(FILE)
- call pragma("S",30000)
- address command DUST
-
- CALL rtezrequest("Objects saved !"LF||LF||"Thanks for using AmpRed","Nice !",
- ,TITLE,FONT "rtez_flags=ezreqf_centertext")
- exit
-
- EXIT:
- CALL rtezrequest("Program aborted by user request !"LF||LF||"Thanks for using AmpRed",
- ,"Nice !",TITLE,FONT "rtez_flags=ezreqf_centertext")
- exit
-