1
0

milk2_img.ini 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. /*
  2. NOTE: AS OF MilkDrop v1.04, the functionality of the 'burn' variable
  3. has changed. See below.
  4. NOTES/TIPS
  5. -sprites range from 00-99
  6. -'img=' line is mandatory. File types currently supported (as of v1.04):
  7. JPG
  8. PNG
  9. BMP
  10. TGA
  11. DDS
  12. PPM
  13. DIB
  14. -valid filenames are:
  15. relative: img=billy.jpg (loads winamp\plugins\milkdrop2\billy.jpg)
  16. img=..\billy.jpg (loads winamp\plugins\billy.jpg)
  17. img=images\billy.jpg (loads winamp\plugins\milkdrop2\images\billy.jpg)
  18. absolute: img=c:\blah\billy.jpg
  19. NOT ok: img=c:billy.jpg -must specify path
  20. NOT ok: img=\billy.jpg -must specify drive
  21. -textures can be as large as 2048x2048 and do not have to be square.
  22. -texture dims in memory will be next power of 2 higher for w, h.
  23. ex: 500x60 texture will be stored in memory as a 512x64 texture.
  24. -big textures can take up a lot of video memory and seriously
  25. drop the frame rate; recommend sprites be no larger than 512x512.
  26. 256x256 is even more preferable.
  27. -if there isn't enough video memory for the texture, it will downsample
  28. the texture (to as low as 16x16 pixels) trying to fit it into video
  29. memory.
  30. -IMPORTANT: to terminate a sprite from within its own code, set the
  31. 'done' variable to a nonzero value (such as 1). For example,
  32. "done=above(frame,500);" would make the sprite auto-self-terminate
  33. after 500 frames. To make this framerate-independent, based it on
  34. 'time' or 'frame/fps' (they are equivalent).
  35. -there is currently a maximum of 16 sprites that can be on the screen
  36. at one time.
  37. -the sprite manager supports instancing, so if you load two sprites
  38. that access the same image on disk, only one texture will exist
  39. in video memory.
  40. -the sprite manager frees textures immediately when all the sprites
  41. using that texture (all instances) expire or finish.
  42. -all of the mathematical functions available for milkdrop's per-frame
  43. and per-pixel equations are available here for doing funky things
  44. with the sprites; see milkdrop_preset_authoring.html for a complete
  45. list of all the functions available.
  46. -you can define your own variables in the init_ code just by setting
  47. them to some value (like in the per-frame or per-pixel code of a
  48. milkdrop preset). You can then access this value later in the
  49. per-frame (regular) sprite code. If you change its value, the
  50. change will be remembered from frame to frame. Also, if you
  51. change the value of a built-in (read/write) variable, this change
  52. will also be remembered from frame to frame.
  53. READ-ONLY VARIABLES
  54. -------------------
  55. time
  56. the amount of time that has elapsed since the sprite
  57. was launched (in seconds).
  58. frame
  59. the # of frames that have elapsed since the sprite
  60. was launched.
  61. fps
  62. the current fps (frames-per-second) the MilkDrop is running at.
  63. progress
  64. the progress (0=start .. 1=end) through the current MilkDrop preset.
  65. bass, mid, treb
  66. the relative amount of each audio band being heard this frame.
  67. 1 is normal; a number less than one (say, 0.5 .. 1) means
  68. the band is quiet; and a number greater than one (say, 1..2)
  69. means the band is loud.
  70. bass_att, mid_att, treb_att
  71. the same, but attenuated to be relative to the average band levels
  72. over a longer period of time (i.e. more heavily attenuated/damped).
  73. READ/WRITE VARIABLES
  74. --------------------
  75. x,y
  76. the x and y position of the sprite's center on the screen.
  77. x is 0 at the left, 1 at the right; y is 0 at the top, 1 at the bottom.
  78. r,g,b
  79. the red, green, and blue color brightness of the sprite. 0..1.
  80. a
  81. the opacity (alpha) of the sprite. 0=transparent, 1=opaque.
  82. note that the effect of this variable depends on the blendmode
  83. (see below), and that sometimes, due to the blendmode, the value
  84. of 'a' has no effect.
  85. sx, sy
  86. the size (stretching) of the sprite, in the X and Y directions.
  87. if these are both 1, then the image will be scaled up just large
  88. enough so that no part of it goes off the screen. If these are
  89. both 0.5, the image will be half that size; 2, and it's doubled.
  90. If sx and sy are not equal, the image will be stretched
  91. appropriately.
  92. rot
  93. the angle of rotation, in radians, of the sprite. The unit circle
  94. goes from 0 to PI*2 (6.28) radians. At zero radians there is no
  95. rotation; PI/2 is like a 90-degree counter-clockwise rotation;
  96. PI, 180 degrees; PI*3/2, 270 degrees; and PI*2 radians (the same
  97. as zero radians): 0 degrees.
  98. blendmode
  99. determines the manner in which the sprite image is blended onto
  100. the screen.
  101. 0=blend: the image is multiplied by (r,g,b) and then blended,
  102. where 'a' decides the amount to blend.
  103. 1=decal: the image is multiplied by (r*a,g*a,b*a) and then pasted
  104. onto the background, with no transparency. 'a' values
  105. below 1 will modulate the color of the sprite, making
  106. it darker.
  107. 2=additive: the image is multipled by (r*a,g*a,b*a) and then added
  108. onto the background, making it brighter. Again, 'a' values
  109. below 1 will make the sprite darker.
  110. 3=srccolor: the amount to blend each pixel with the background
  111. is equal to the inverse of the pixel's color. White texels
  112. in the sprite will be fully drawn, while black texels will
  113. be transparent; in-between texels will be blended partially
  114. based on their brightness. Requires hardware support.
  115. The alpha value ('a') has no effect when this blendmode
  116. is set; the alpha value is taken from the R,G,B color in
  117. the image at evert point.
  118. 4=colorkey:
  119. pixels that match the color specified in the colorkey are
  120. drawn transparently, and all other pixels are drawn opaquely,
  121. much like a television bluescreen. When using this blendmode,
  122. a line like the following is required to be present in the
  123. sprite:
  124. colorkey=0x000000
  125. where the value is some 24-bit hexadecimal color. The first
  126. two digits are 00 through FF hexadecimal (0-255 decimal)
  127. and are the red value; the third and fourth digits are the
  128. green value; and the last two digits are the blue value.
  129. So, 0x000000 makes black the see-through color; 0xFFFFFF
  130. makes white pixels transparent; 0x0000FF makes blue pixels
  131. transparent; and so on.
  132. When the blendmode is not 4, the colorkey setting will have
  133. no effect.
  134. When blendmode is 4, the alpha value ('a') still works, too;
  135. it simply modulates the overall opacity of the sprite.
  136. NOTE that this effect does not work on all video cards, and
  137. also tends to hiccup when running in 16-bit color. Try it
  138. in 32-bit color for best chances for it to work.
  139. NOTE that prior to MilkDrop v1.04, this feature worked
  140. slightly differently; there was a range of color key values
  141. (and you specified 'colorkey_lo' and 'colorkey_hi')
  142. instead of just one single colorkey value ('colorkey').
  143. My apologies for any confusion this change might cause.
  144. flipx
  145. if nonzero, the sprite will be flipped horizontally.
  146. flipy
  147. if nonzero, the sprite will be flipped vertically.
  148. repeatx
  149. the number of times to repeat the texture over the surface of the
  150. sprite, in the x direction. A value of 1 is the default; a value of
  151. 2 will cause the texture to tile twice in the x direction; and so on.
  152. **NOTE that if the width or height of the source image is not a
  153. power of two (16,32,64,128,256,512,1024,2048) then repeating the
  154. image could cause strange bands to appear (on some poorly-written
  155. display drivers or older video cards). If using repeating, pre-
  156. stretch the source image to be a power of 2 to alleviate this
  157. problem.**
  158. repeaty
  159. like repeatx, but in the y-direction.
  160. done
  161. set this to some nonzero value to make the sprite self-terminate.
  162. frees up resources associated with the sprite.
  163. burn
  164. if set to a nonzero value, then the sprite will burn into MilkDrop's
  165. background and become part of the animation. If set to zero, there
  166. will be no burn-in. You can set this to 1 for a long time to make
  167. cool trails of the sprite, or you can set it to 1 just on the last frame
  168. (at the same time that you set 'done' to 1), to make the sprite burn into
  169. the background and die off, much like song titles and custom messages do.
  170. ( NOTE: prior to v1.04, 'burn' only worked on the last frame, when done
  171. was set to 1. With v1.04 and later, 'burn' works on any frame. )
  172. /end of critical info
  173. */
  174. [img00]
  175. // testing color keying... this is probably best with TGA's (exact colors), not JPG's.
  176. img=textures\kaite.jpg
  177. colorkey=0xFFFFFF
  178. init_1=blendmode = 4;
  179. code_1=rot = time*0.27;
  180. code_2=new_scale = 0.75 + 0.1*sin(time*0.6);
  181. code_3=sx = new_scale;
  182. code_4=sy = new_scale;
  183. code_5=r=0.5+sin(time*0.9);
  184. code_6=a=0.5+sin(time*1.3);
  185. [img01]
  186. // this tests the 'done' function, and burns into the screen @ the end
  187. img=textures\heart.jpg
  188. init_1=blendmode = 3;
  189. init_2=x = 1;
  190. init_3=orig_y = 0.5;
  191. code_1=time_to_reset = below(x,-0.5);
  192. code_2=x = x*(1-time_to_reset) + time_to_reset*(1.5 + 0.01*rand(100) + 1);
  193. code_3=orig_y = orig_y*(1-time_to_reset) + time_to_reset*(0.3 + 0.4*0.01*rand(100));
  194. code_4=sx = sx*(1-time_to_reset) + time_to_reset*(0.25 + 0.4*0.01*rand(100));
  195. code_5=sy = sx;
  196. code_6=x = x - 0.008 + 0.0033*sin(time*1.371);
  197. code_7=y = orig_y + 0.12*sin(time*1.9);
  198. code_8=done=above(frame,80);
  199. code_9=burn=done; // burn into screen @ end
  200. [img02]
  201. // this burns into the screen *every frame*
  202. img=textures\cells.jpg
  203. init_1=blendmode = 3;
  204. init_2=x = 1;
  205. init_3=orig_y = 0.5;
  206. code_1=time_to_reset = below(x,-0.5);
  207. code_2=x = x*(1-time_to_reset) + time_to_reset*(1.5 + 0.01*rand(100) + 1);
  208. code_3=orig_y = orig_y*(1-time_to_reset) + time_to_reset*(0.3 + 0.4*0.01*rand(100));
  209. code_4=sx = sx*(1-time_to_reset) + time_to_reset*(0.25 + 0.4*0.01*rand(100));
  210. code_5=sy = sx;
  211. code_6=x = x - 0.008 + 0.0033*sin(time*1.371);
  212. code_7=y = orig_y + 0.12*sin(time*1.9);
  213. code_8=done=above(frame,80);
  214. code_9=burn=1; // burn into screen every frame
  215. [img03]
  216. // for testing: show a large (nova2) or large+skinny (nova3) texture
  217. img=textures\smalltiled_lizard_scales.jpg
  218. init_1=blendmode = 2;
  219. code_1=rot = time*0.27;
  220. code_2=new_scale = 1.0 + 0.1*sin(time*0.6);
  221. code_3=sx = new_scale;
  222. code_4=sy = new_scale;
  223. code_5=new_alpha = min(0.9,max(0.2, 2*max(bass-.05,bass_att)-1.1 ));
  224. code_6=a = a*0.83 + 0.17*new_alpha;
  225. [img04]
  226. desc="cool: an 'osapien' drifts across the screen every so often."
  227. img=textures\smalltiled_electric_nebula.jpg
  228. init_1=blendmode = 3;
  229. init_2=x = -100;
  230. init_3=orig_y = 0.5;
  231. code_1=time_to_reset = below(x,-0.5);
  232. code_2=x = x*(1-time_to_reset) + time_to_reset*(1.5 + 0.01*rand(100) + 3);
  233. code_3=orig_y = orig_y*(1-time_to_reset) + time_to_reset*(0.3 + 0.4*0.01*rand(100));
  234. code_4=sx = sx*(1-time_to_reset) + time_to_reset*(0.25 + 0.4*0.01*rand(100));
  235. code_5=sy = sx;
  236. code_6=x = x - 0.008 + 0.0033*sin(time*1.371);
  237. code_7=y = orig_y + 0.12*sin(time*1.9);
  238. [img10]
  239. img=textures\manyfish.jpg
  240. init_1=blendmode = 3;
  241. code_1=rot = time*0.27;
  242. code_2=new_scale = 0.9 + 0.2*sin(time*0.6);
  243. code_3=sx = new_scale;
  244. code_4=sy = new_scale;
  245. code_5=new_alpha = min(0.9,max(0.2, 2*max(bass-.05,bass_att)-1.1 ));
  246. code_6=a = 1;//a*0.9 + 0.1*new_alpha;
  247. [img11]
  248. img=textures\onefish.jpg
  249. init_1=blendmode = 3;
  250. code_1=rot = -time*0.2;
  251. code_2=new_scale = 0.7 + 0.2*sin(time*0.6);
  252. code_3=sx = new_scale;
  253. code_4=sy = new_scale;
  254. code_5=new_alpha = .4*min(0.9,max(0.2, 2*max(treb-.05,treb_att)-1.1 ));
  255. code_6=a = a*0.03 + 0.10*new_alpha;