1
0

r_interf.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. /*
  2. LICENSE
  3. -------
  4. Copyright 2005 Nullsoft, Inc.
  5. All rights reserved.
  6. Redistribution and use in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8. * Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. * Redistributions in binary form must reproduce the above copyright notice,
  11. this list of conditions and the following disclaimer in the documentation
  12. and/or other materials provided with the distribution.
  13. * Neither the name of Nullsoft nor the names of its contributors may be used to
  14. endorse or promote products derived from this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  16. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  18. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  21. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. #include <windows.h>
  25. #include <stdlib.h>
  26. #include <commctrl.h>
  27. #include <math.h>
  28. #include "resource.h"
  29. #include "r_defs.h"
  30. #include "../Agave/Language/api_language.h"
  31. #ifndef LASER
  32. #define MOD_NAME "Trans / Interferences"
  33. #define C_THISCLASS C_InterferencesClass
  34. class C_THISCLASS : public C_RBASE {
  35. protected:
  36. public:
  37. C_THISCLASS();
  38. virtual ~C_THISCLASS();
  39. float GET_FLOAT(unsigned char *data, int pos);
  40. void PUT_FLOAT(float f, unsigned char *data, int pos);
  41. virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h);
  42. virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_INTERFERENCES,desc,128):desc); }
  43. virtual HWND conf(HINSTANCE hInstance, HWND hwndParent);
  44. virtual void load_config(unsigned char *data, int len);
  45. virtual int save_config(unsigned char *data);
  46. int enabled;
  47. int nPoints;
  48. int distance;
  49. int alpha;
  50. int rotation;
  51. int rotationinc;
  52. int distance2;
  53. int alpha2;
  54. int rotationinc2;
  55. int rgb;
  56. int blend;
  57. int blendavg;
  58. float speed;
  59. int onbeat;
  60. float a;
  61. int _distance;
  62. int _alpha;
  63. int _rotationinc;
  64. int _rgb;
  65. float status;
  66. };
  67. #define PI 3.14159
  68. static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer
  69. static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful)
  70. C_THISCLASS::~C_THISCLASS()
  71. {
  72. }
  73. // configuration read/write
  74. C_THISCLASS::C_THISCLASS() // set up default configuration
  75. {
  76. enabled=1;
  77. nPoints = 2;
  78. distance=10;
  79. alpha=128;
  80. rotation=0;
  81. rotationinc=0;
  82. rgb=1;
  83. blendavg=0;
  84. blend=0;
  85. onbeat=1;
  86. distance2=32;
  87. rotationinc2=25;
  88. alpha2=192;
  89. status=2;
  90. speed = (float)0.2;
  91. a=(float)rotation/255*(float)PI*2;
  92. }
  93. void C_THISCLASS::PUT_FLOAT(float f, unsigned char *data, int pos)
  94. {
  95. int y = *(int *)&f;
  96. data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255;
  97. }
  98. float C_THISCLASS::GET_FLOAT(unsigned char *data, int pos)
  99. {
  100. int a = data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24);
  101. float f = *(float *)&a;
  102. return f;
  103. }
  104. #define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24))
  105. void C_THISCLASS::load_config(unsigned char *data, int len) // read configuration of max length "len" from data.
  106. {
  107. int pos=0;
  108. if (len-pos >= 4) { enabled=GET_INT(); pos+=4; }
  109. if (len-pos >= 4) { nPoints=GET_INT(); pos+=4; }
  110. if (len-pos >= 4) { rotation=GET_INT(); pos+=4; }
  111. if (len-pos >= 4) { distance=GET_INT(); pos+=4; }
  112. if (len-pos >= 4) { alpha=GET_INT(); pos+=4; }
  113. if (len-pos >= 4) { rotationinc=GET_INT(); pos+=4; }
  114. if (len-pos >= 4) { blend=GET_INT(); pos+=4; }
  115. if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; }
  116. if (len-pos >= 4) { distance2=GET_INT(); pos+=4; }
  117. if (len-pos >= 4) { alpha2=GET_INT(); pos+=4; }
  118. if (len-pos >= 4) { rotationinc2=GET_INT(); pos+=4; }
  119. if (len-pos >= 4) { rgb=GET_INT(); pos+=4; }
  120. if (len-pos >= 4) { onbeat=GET_INT(); pos+=4; }
  121. if (len-pos >= 4) { speed=GET_FLOAT(data, pos); pos+=4; }
  122. a=(float)rotation/255*(float)PI*2;
  123. status=(float)PI;
  124. }
  125. #define PUT_INT(y) data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255
  126. int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k.
  127. {
  128. int pos=0;
  129. PUT_INT(enabled); pos+=4;
  130. PUT_INT(nPoints); pos+=4;
  131. PUT_INT(rotation); pos+=4;
  132. PUT_INT(distance); pos+=4;
  133. PUT_INT(alpha); pos+=4;
  134. PUT_INT(rotationinc); pos+=4;
  135. PUT_INT(blend); pos+=4;
  136. PUT_INT(blendavg); pos+=4;
  137. PUT_INT(distance2); pos+=4;
  138. PUT_INT(alpha2); pos+=4;
  139. PUT_INT(rotationinc2); pos+=4;
  140. PUT_INT(rgb); pos+=4;
  141. PUT_INT(onbeat); pos+=4;
  142. PUT_FLOAT(speed, data, pos); pos+=4;
  143. return pos;
  144. }
  145. // render function
  146. // render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is
  147. // used when you want to do something that you'd otherwise need to make a copy of the framebuffer.
  148. // w and h are the width and height of the screen, in pixels.
  149. // isBeat is 1 if a beat has been detected.
  150. // visdata is in the format of [spectrum:0,wave:1][channel][band].
  151. #define MAX_POINTS 8
  152. int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h)
  153. {
  154. int pnts=nPoints;
  155. int x,y;
  156. int i;
  157. int mask=0;
  158. float s;
  159. if (isBeat&0x80000000) return 0;
  160. if (!enabled) return 0;
  161. if (pnts == 0) return 0;
  162. float angle=(float)(2*PI)/pnts;
  163. if (onbeat && isBeat)
  164. if (status >= PI)
  165. status=0;
  166. s = (float)sin(status);
  167. _rotationinc = rotationinc + (int)((float)(rotationinc2-rotationinc) * s);
  168. _alpha = alpha + (int)((float)(alpha2-alpha) * s);
  169. _distance = distance + (int)((float)(distance2-distance) * s);
  170. a=(float)rotation/255*(float)PI*2;
  171. int xpoints[MAX_POINTS],ypoints[MAX_POINTS];
  172. int minx=0, maxx=0;
  173. int miny=0, maxy=0;
  174. for (i=0;i<pnts;i++)
  175. {
  176. xpoints[i] = (int)(cos(a)*_distance);
  177. ypoints[i] = (int)(sin(a)*_distance);
  178. if (ypoints[i] > miny) miny=ypoints[i];
  179. if (-ypoints[i] > maxy) maxy=-ypoints[i];
  180. if (xpoints[i] > minx) minx=xpoints[i];
  181. if (-xpoints[i] > maxx) maxx=-xpoints[i];
  182. a += angle;
  183. }
  184. unsigned char *bt=g_blendtable[_alpha];
  185. int *outp=fbout;
  186. for (y = 0; y < h; y ++)
  187. {
  188. int yp=ypoints[i];
  189. int yoffs[MAX_POINTS];
  190. for (i = 0; i < pnts; i ++)
  191. {
  192. if (y >= ypoints[i] && y-ypoints[i] < h)
  193. yoffs[i]=(y-ypoints[i])*w;
  194. else yoffs[i]=-1;
  195. }
  196. if (rgb && (pnts==3 || pnts==6))
  197. {
  198. if (pnts == 3) for (x = 0; x < w; x ++)
  199. {
  200. int r=0,g=0,b=0;
  201. int xp;
  202. xp=x-xpoints[0];
  203. if (xp >= 0 && xp < w && yoffs[0]!=-1)
  204. {
  205. int pix=framebuffer[xp+yoffs[0]];
  206. r=bt[pix&0xff];
  207. }
  208. xp=x-xpoints[1];
  209. if (xp >= 0 && xp < w && yoffs[1]!=-1)
  210. {
  211. int pix=framebuffer[xp+yoffs[1]];
  212. g=bt[(pix>>8)&0xff];
  213. }
  214. xp=x-xpoints[2];
  215. if (xp >= 0 && xp < w && yoffs[2]!=-1)
  216. {
  217. int pix=framebuffer[xp+yoffs[2]];
  218. b=bt[(pix>>16)&0xff];
  219. }
  220. *outp++ = r|(g<<8)|(b<<16);
  221. }
  222. else for (x = 0; x < w; x ++)
  223. {
  224. int r=0,g=0,b=0;
  225. int xp;
  226. xp=x-xpoints[0];
  227. if (xp >= 0 && xp < w && yoffs[0]!=-1)
  228. {
  229. int pix=framebuffer[xp+yoffs[0]];
  230. r=bt[pix&0xff];
  231. }
  232. xp=x-xpoints[1];
  233. if (xp >= 0 && xp < w && yoffs[1]!=-1)
  234. {
  235. int pix=framebuffer[xp+yoffs[1]];
  236. g=bt[(pix>>8)&0xff];
  237. }
  238. xp=x-xpoints[2];
  239. if (xp >= 0 && xp < w && yoffs[2]!=-1)
  240. {
  241. int pix=framebuffer[xp+yoffs[2]];
  242. b=bt[(pix>>16)&0xff];
  243. }
  244. xp=x-xpoints[3];
  245. if (xp >= 0 && xp < w && yoffs[3]!=-1)
  246. {
  247. int pix=framebuffer[xp+yoffs[3]];
  248. r+=bt[pix&0xff];
  249. }
  250. xp=x-xpoints[4];
  251. if (xp >= 0 && xp < w && yoffs[4]!=-1)
  252. {
  253. int pix=framebuffer[xp+yoffs[4]];
  254. g+=bt[(pix>>8)&0xff];
  255. }
  256. xp=x-xpoints[5];
  257. if (xp >= 0 && xp < w && yoffs[5]!=-1)
  258. {
  259. int pix=framebuffer[xp+yoffs[5]];
  260. b+=bt[(pix>>16)&0xff];
  261. }
  262. if (r > 255) r=255;
  263. if (g > 255) g=255;
  264. if (b > 255) b=255;
  265. *outp++ = r|(g<<8)|(b<<16);
  266. }
  267. }
  268. else if (y > miny && y < h-maxy && minx+maxx < w) // no y clipping required
  269. {
  270. for (x = 0; x < minx; x ++)
  271. {
  272. int r=0,g=0,b=0;
  273. for (i = 0; i < pnts; i++)
  274. {
  275. int xp=x-xpoints[i];
  276. if (xp >= 0 && xp < w)
  277. {
  278. int pix=framebuffer[xp+yoffs[i]];
  279. r+=bt[pix&0xff];
  280. g+=bt[(pix>>8)&0xff];
  281. b+=bt[(pix>>16)&0xff];
  282. }
  283. }
  284. if (r > 255) r=255;
  285. if (g > 255) g=255;
  286. if (b > 255) b=255;
  287. *outp++ = r|(g<<8)|(b<<16);
  288. }
  289. int *lfb=framebuffer+x;
  290. for (; x < w-maxx; x ++)
  291. {
  292. int r=0,g=0,b=0;
  293. for (i = 0; i < pnts; i++)
  294. {
  295. int pix=lfb[yoffs[i]-xpoints[i]];
  296. r+=bt[pix&0xff];
  297. g+=bt[(pix>>8)&0xff];
  298. b+=bt[(pix>>16)&0xff];
  299. }
  300. if (r > 255) r=255;
  301. if (g > 255) g=255;
  302. if (b > 255) b=255;
  303. lfb++;
  304. *outp++ = r|(g<<8)|(b<<16);
  305. }
  306. for (; x < w; x ++)
  307. {
  308. int r=0,g=0,b=0;
  309. for (i = 0; i < pnts; i++)
  310. {
  311. int xp=x-xpoints[i];
  312. if (xp >= 0 && xp < w)
  313. {
  314. int pix=framebuffer[xp+yoffs[i]];
  315. r+=bt[pix&0xff];
  316. g+=bt[(pix>>8)&0xff];
  317. b+=bt[(pix>>16)&0xff];
  318. }
  319. }
  320. if (r > 255) r=255;
  321. if (g > 255) g=255;
  322. if (b > 255) b=255;
  323. *outp++ = r|(g<<8)|(b<<16);
  324. }
  325. }
  326. else for (x = 0; x < w; x ++)
  327. {
  328. int r=0,g=0,b=0;
  329. for (i = 0; i < pnts; i++)
  330. {
  331. int xp=x-xpoints[i];
  332. if (xp >= 0 && xp < w && yoffs[i]!=-1)
  333. {
  334. int pix=framebuffer[xp+yoffs[i]];
  335. r+=bt[pix&0xff];
  336. g+=bt[(pix>>8)&0xff];
  337. b+=bt[(pix>>16)&0xff];
  338. }
  339. }
  340. if (r > 255) r=255;
  341. if (g > 255) g=255;
  342. if (b > 255) b=255;
  343. *outp++ = r|(g<<8)|(b<<16);
  344. }
  345. }
  346. rotation+=_rotationinc;
  347. rotation=rotation>255 ? rotation-255 : rotation;
  348. rotation=rotation<-255 ? rotation+255 : rotation;
  349. status += speed;
  350. status=min(status, (float)PI);
  351. if (status<-PI) status = (float) PI;
  352. int *p = framebuffer;
  353. int *d = fbout;
  354. if (!blend && !blendavg) return 1;
  355. if (blendavg)
  356. {
  357. int i=w*h/4;
  358. while (i--)
  359. {
  360. p[0] = BLEND_AVG(p[0], d[0]);
  361. p[1] = BLEND_AVG(p[1], d[1]);
  362. p[2] = BLEND_AVG(p[2], d[2]);
  363. p[3] = BLEND_AVG(p[3], d[3]);
  364. p+=4;
  365. d+=4;
  366. }
  367. }
  368. else
  369. mmx_addblend_block(p,d,w*h);
  370. return 0;
  371. }
  372. // configuration dialog stuff
  373. static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam)
  374. {
  375. switch (uMsg)
  376. {
  377. case WM_INITDIALOG:
  378. SendDlgItemMessage(hwndDlg, IDC_NPOINTS, TBM_SETTICFREQ, 1, 0);
  379. SendDlgItemMessage(hwndDlg, IDC_NPOINTS, TBM_SETRANGE, TRUE, MAKELONG(0, 8));
  380. SendDlgItemMessage(hwndDlg, IDC_NPOINTS, TBM_SETPOS, TRUE, g_ConfigThis->nPoints);
  381. SendDlgItemMessage(hwndDlg, IDC_ALPHA, TBM_SETTICFREQ, 16, 0);
  382. SendDlgItemMessage(hwndDlg, IDC_ALPHA, TBM_SETRANGE, TRUE, MAKELONG(1, 255));
  383. SendDlgItemMessage(hwndDlg, IDC_ALPHA, TBM_SETPOS, TRUE, g_ConfigThis->alpha);
  384. SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETTICFREQ, 8, 0);
  385. SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETRANGE, TRUE, MAKELONG(1, 64));
  386. SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETPOS, TRUE, g_ConfigThis->distance);
  387. SendDlgItemMessage(hwndDlg, IDC_ROTATE, TBM_SETTICFREQ, 2, 0);
  388. SendDlgItemMessage(hwndDlg, IDC_ROTATE, TBM_SETRANGE, TRUE, MAKELONG(0, 64));
  389. SendDlgItemMessage(hwndDlg, IDC_ROTATE, TBM_SETPOS, TRUE, g_ConfigThis->rotationinc*-1+32);
  390. SendDlgItemMessage(hwndDlg, IDC_ALPHA2, TBM_SETTICFREQ, 16, 0);
  391. SendDlgItemMessage(hwndDlg, IDC_ALPHA2, TBM_SETRANGE, TRUE, MAKELONG(1, 255));
  392. SendDlgItemMessage(hwndDlg, IDC_ALPHA2, TBM_SETPOS, TRUE, g_ConfigThis->alpha2);
  393. SendDlgItemMessage(hwndDlg, IDC_DISTANCE2, TBM_SETTICFREQ, 8, 0);
  394. SendDlgItemMessage(hwndDlg, IDC_DISTANCE2, TBM_SETRANGE, TRUE, MAKELONG(1, 64));
  395. SendDlgItemMessage(hwndDlg, IDC_DISTANCE2, TBM_SETPOS, TRUE, g_ConfigThis->distance2);
  396. SendDlgItemMessage(hwndDlg, IDC_ROTATE2, TBM_SETTICFREQ, 2, 0);
  397. SendDlgItemMessage(hwndDlg, IDC_ROTATE2, TBM_SETRANGE, TRUE, MAKELONG(0, 64));
  398. SendDlgItemMessage(hwndDlg, IDC_ROTATE2, TBM_SETPOS, TRUE, g_ConfigThis->rotationinc2*-1+32);
  399. SendDlgItemMessage(hwndDlg, IDC_INITROT, TBM_SETTICFREQ, 16, 0);
  400. SendDlgItemMessage(hwndDlg, IDC_INITROT, TBM_SETRANGE, TRUE, MAKELONG(0, 255));
  401. SendDlgItemMessage(hwndDlg, IDC_INITROT, TBM_SETPOS, TRUE, 255-g_ConfigThis->rotation);
  402. SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETTICFREQ, 1000, 0);
  403. SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG(1, 128));
  404. SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, (int)(g_ConfigThis->speed*100));
  405. if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED);
  406. if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED);
  407. if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED);
  408. if (!g_ConfigThis->blend && !g_ConfigThis->blendavg)
  409. CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED);
  410. EnableWindow(GetDlgItem(hwndDlg, IDC_RGB), (g_ConfigThis->nPoints == 3 || g_ConfigThis->nPoints==6));
  411. CheckDlgButton(hwndDlg,IDC_RGB,g_ConfigThis->rgb ? BST_CHECKED: BST_UNCHECKED);
  412. CheckDlgButton(hwndDlg,IDC_ONBEAT,g_ConfigThis->onbeat ? BST_CHECKED: BST_UNCHECKED);
  413. return 1;
  414. case WM_COMMAND:
  415. if ((LOWORD(wParam) == IDC_CHECK1) ||
  416. (LOWORD(wParam) == IDC_RGB) ||
  417. (LOWORD(wParam) == IDC_ONBEAT) ||
  418. (LOWORD(wParam) == IDC_ADDITIVE) ||
  419. (LOWORD(wParam) == IDC_REPLACE) ||
  420. (LOWORD(wParam) == IDC_5050) )
  421. {
  422. g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0;
  423. g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0;
  424. g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0;
  425. g_ConfigThis->rgb=IsDlgButtonChecked(hwndDlg,IDC_RGB)?1:0;
  426. g_ConfigThis->onbeat=IsDlgButtonChecked(hwndDlg,IDC_ONBEAT)?1:0;
  427. }
  428. return 0;
  429. case WM_NOTIFY:
  430. if (LOWORD(wParam) == IDC_NPOINTS)
  431. {
  432. g_ConfigThis->nPoints = SendDlgItemMessage(hwndDlg, IDC_NPOINTS, TBM_GETPOS, 0, 0);
  433. EnableWindow(GetDlgItem(hwndDlg, IDC_RGB), (g_ConfigThis->nPoints == 3 || g_ConfigThis->nPoints==6));
  434. }
  435. if (LOWORD(wParam) == IDC_ALPHA)
  436. g_ConfigThis->alpha = SendDlgItemMessage(hwndDlg, IDC_ALPHA, TBM_GETPOS, 0, 0);
  437. if (LOWORD(wParam) == IDC_DISTANCE)
  438. g_ConfigThis->distance = SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_GETPOS, 0, 0);
  439. if (LOWORD(wParam) == IDC_ROTATE)
  440. g_ConfigThis->rotationinc= -1*(SendDlgItemMessage(hwndDlg, IDC_ROTATE, TBM_GETPOS, 0, 0)-32);
  441. if (LOWORD(wParam) == IDC_INITROT)
  442. g_ConfigThis->rotation = 255-SendDlgItemMessage(hwndDlg, IDC_INITROT, TBM_GETPOS, 0, 0);
  443. if (LOWORD(wParam) == IDC_SPEED)
  444. g_ConfigThis->speed = (float)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)/100;
  445. if (LOWORD(wParam) == IDC_ALPHA2)
  446. g_ConfigThis->alpha2 = SendDlgItemMessage(hwndDlg, IDC_ALPHA2, TBM_GETPOS, 0, 0);
  447. if (LOWORD(wParam) == IDC_DISTANCE2)
  448. g_ConfigThis->distance2 = SendDlgItemMessage(hwndDlg, IDC_DISTANCE2, TBM_GETPOS, 0, 0);
  449. if (LOWORD(wParam) == IDC_ROTATE2)
  450. g_ConfigThis->rotationinc2= -1*(SendDlgItemMessage(hwndDlg, IDC_ROTATE2, TBM_GETPOS, 0, 0)-32);
  451. return 0;
  452. }
  453. return 0;
  454. }
  455. HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible
  456. {
  457. g_ConfigThis = this;
  458. return WASABI_API_CREATEDIALOG(IDD_CFG_INTERF,hwndParent,g_DlgProc);
  459. }
  460. // export stuff
  461. C_RBASE *R_Interferences(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description
  462. {
  463. if (desc) { strcpy(desc,MOD_NAME); return NULL; }
  464. return (C_RBASE *) new C_THISCLASS();
  465. }
  466. #else
  467. C_RBASE *R_Interferences(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description
  468. {
  469. return NULL;
  470. }
  471. #endif