1
0

r_bump.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  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 <vfw.h>
  27. #include <commctrl.h>
  28. #include <stdio.h>
  29. #include "resource.h"
  30. #include "r_defs.h"
  31. #include "r_stack.h"
  32. #include "avs_eelif.h"
  33. #include "../Agave/Language/api_language.h"
  34. #ifndef LASER
  35. #define MOD_NAME "Trans / Bump"
  36. #define C_THISCLASS C_BumpClass
  37. class C_THISCLASS : public C_RBASE {
  38. protected:
  39. public:
  40. C_THISCLASS();
  41. float GET_FLOAT(unsigned char *data, int pos);
  42. void PUT_FLOAT(float f, unsigned char *data, int pos);
  43. void InitializeStars(int Start);
  44. void CreateStar(int A);
  45. virtual ~C_THISCLASS();
  46. virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h);
  47. virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_BUMP,desc,128):desc); }
  48. virtual HWND conf(HINSTANCE hInstance, HWND hwndParent);
  49. virtual void load_config(unsigned char *data, int len);
  50. virtual int save_config(unsigned char *data);
  51. int __inline depthof(int c, int i);
  52. int enabled;
  53. int depth;
  54. int depth2;
  55. int onbeat;
  56. int durFrames;
  57. int thisDepth;
  58. int blend;
  59. int blendavg;
  60. int nF;
  61. NSEEL_CODEHANDLE codeHandle;
  62. NSEEL_CODEHANDLE codeHandleBeat;
  63. NSEEL_CODEHANDLE codeHandleInit;
  64. double *var_x;
  65. double *var_y;
  66. double *var_isBeat;
  67. double *var_isLongBeat;
  68. double *var_bi;
  69. RString code1,code2,code3;
  70. int need_recompile;
  71. int showlight;
  72. int initted;
  73. int invert;
  74. NSEEL_VMCTX AVS_EEL_CONTEXTNAME;
  75. int oldstyle;
  76. int buffern;
  77. CRITICAL_SECTION rcs;
  78. };
  79. static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer
  80. static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful)
  81. C_THISCLASS::~C_THISCLASS()
  82. {
  83. freeCode(codeHandle);
  84. freeCode(codeHandleBeat);
  85. freeCode(codeHandleInit);
  86. DeleteCriticalSection(&rcs);
  87. AVS_EEL_QUITINST();
  88. }
  89. // configuration read/write
  90. C_THISCLASS::C_THISCLASS() // set up default configuration
  91. {
  92. AVS_EEL_INITINST();
  93. InitializeCriticalSection(&rcs);
  94. buffern=0;
  95. oldstyle=0;
  96. invert=0;
  97. enabled=1;
  98. onbeat = 0;
  99. durFrames = 15;
  100. depth=30;
  101. depth2=100;
  102. nF=0;
  103. showlight=0;
  104. thisDepth=depth;
  105. blend = 0;
  106. blendavg = 0;
  107. code1.assign("x=0.5+cos(t)*0.3;\r\ny=0.5+sin(t)*0.3;\r\nt=t+0.1;");
  108. code2.assign("");
  109. code3.assign("t=0;");
  110. codeHandle=0;
  111. codeHandleBeat=0;
  112. codeHandleInit=0;
  113. var_bi=0;
  114. initted=0;
  115. need_recompile=1;
  116. }
  117. #define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24))
  118. void C_THISCLASS::load_config(unsigned char *data, int len)
  119. {
  120. int pos=0;
  121. if (len-pos >= 4) { enabled=GET_INT(); pos+=4; }
  122. if (len-pos >= 4) { onbeat=GET_INT(); pos+=4; }
  123. if (len-pos >= 4) { durFrames=GET_INT(); pos+=4; }
  124. if (len-pos >= 4) { depth=GET_INT(); pos+=4; }
  125. if (len-pos >= 4) { depth2=GET_INT(); pos+=4; }
  126. if (len-pos >= 4) { blend=GET_INT(); pos+=4; }
  127. if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; }
  128. load_string(code1,data,pos,len);
  129. load_string(code2,data,pos,len);
  130. load_string(code3,data,pos,len);
  131. if (len-pos >= 4) { showlight=GET_INT(); pos+=4; }
  132. if (len-pos >= 4) { invert=GET_INT(); pos+=4; }
  133. if (len-pos >= 4) { oldstyle=GET_INT(); pos+=4; } else oldstyle=1;
  134. if (len-pos >= 4) { buffern=GET_INT(); pos+=4; }
  135. thisDepth=depth;
  136. nF=0;
  137. need_recompile=1;
  138. }
  139. #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
  140. int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k.
  141. {
  142. int pos=0;
  143. PUT_INT(enabled); pos+=4;
  144. PUT_INT(onbeat); pos+=4;
  145. PUT_INT(durFrames); pos+=4;
  146. PUT_INT(depth); pos+=4;
  147. PUT_INT(depth2); pos+=4;
  148. PUT_INT(blend); pos+=4;
  149. PUT_INT(blendavg); pos+=4;
  150. save_string(data, pos, code1);
  151. save_string(data, pos, code2);
  152. save_string(data, pos, code3);
  153. PUT_INT(showlight); pos+=4;
  154. PUT_INT(invert); pos+=4;
  155. PUT_INT(oldstyle); pos+=4;
  156. PUT_INT(buffern); pos+=4;
  157. return pos;
  158. }
  159. int __inline C_THISCLASS::depthof(int c, int i)
  160. {
  161. int r= max(max((c & 0xFF), ((c & 0xFF00)>>8)), (c & 0xFF0000)>>16);
  162. return i ? 255 - r : r;
  163. }
  164. static int __inline setdepth(int l, int c)
  165. {
  166. int r;
  167. r=min((c&0xFF)+l, 254);
  168. r|=min(((c&0xFF00))+(l<<8),254<<8);
  169. r|=min(((c&0xFF0000))+(l<<16),254<<16);
  170. return r;
  171. }
  172. static int __inline setdepth0(int c)
  173. {
  174. int r;
  175. r=min((c&0xFF), 254);
  176. r|=min(((c&0xFF00)),254<<8);
  177. r|=min(((c&0xFF0000)),254<<16);
  178. return r;
  179. }
  180. // render function
  181. // render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is
  182. // used when you want to do something that you'd otherwise need to make a copy of the framebuffer.
  183. // w and h are the width and height of the screen, in pixels.
  184. // isBeat is 1 if a beat has been detected.
  185. // visdata is in the format of [spectrum:0,wave:1][channel][band].
  186. #define abs(x) (( x ) >= 0 ? ( x ) : - ( x ))
  187. int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h)
  188. {
  189. int cx,cy;
  190. int curbuf;
  191. if (!enabled) return 0;
  192. if (need_recompile)
  193. {
  194. EnterCriticalSection(&rcs);
  195. if (!var_bi || g_reset_vars_on_recompile)
  196. {
  197. clearVars();
  198. var_x = registerVar("x");
  199. var_y = registerVar("y");
  200. var_isBeat = registerVar("isbeat");
  201. var_isLongBeat = registerVar("islbeat");
  202. var_bi = registerVar("bi");
  203. *var_bi = 1.0;
  204. initted=0;
  205. }
  206. need_recompile=0;
  207. freeCode(codeHandle);
  208. freeCode(codeHandleBeat);
  209. freeCode(codeHandleInit);
  210. codeHandle = compileCode(code1.get());
  211. codeHandleBeat = compileCode(code2.get());
  212. codeHandleInit = compileCode(code3.get());
  213. LeaveCriticalSection(&rcs);
  214. }
  215. if (isBeat&0x80000000) return 0;
  216. int *depthbuffer = !buffern ? framebuffer : (int *)getGlobalBuffer(w,h,buffern-1,0);
  217. if (!depthbuffer) return 0;
  218. curbuf = (depthbuffer==framebuffer);
  219. if (!initted)
  220. {
  221. executeCode(codeHandleInit,visdata);
  222. initted=1;
  223. }
  224. executeCode(codeHandle,visdata);
  225. if (isBeat) executeCode(codeHandleBeat,visdata);
  226. if (isBeat)
  227. *var_isBeat=-1;
  228. else
  229. *var_isBeat=1;
  230. if (nF)
  231. *var_isLongBeat=-1;
  232. else
  233. *var_isLongBeat=1;
  234. if (onbeat && isBeat)
  235. {
  236. thisDepth=depth2;
  237. nF = durFrames;
  238. }
  239. else if (!nF) thisDepth = depth;
  240. memset(fbout, 0, w*h*4); // previous effects may have left fbout in a mess
  241. if (oldstyle)
  242. {
  243. cx = (int)(*var_x/100.0*w);
  244. cy = (int)(*var_y/100.0*h);
  245. }
  246. else
  247. {
  248. cx = (int)(*var_x*w);
  249. cy = (int)(*var_y*h);
  250. }
  251. cx = max(0, min(w, cx));
  252. cy = max(0, min(h, cy));
  253. if (showlight) fbout[cx+cy*w]=0xFFFFFF;
  254. if (var_bi)
  255. {
  256. *var_bi = min(max(*var_bi, 0), 1);
  257. thisDepth = (int)(thisDepth * *var_bi);
  258. }
  259. int thisDepth_scaled=(thisDepth<<8)/100;
  260. depthbuffer += w+1;
  261. framebuffer += w+1;
  262. fbout += w+1;
  263. int ly=1-cy;
  264. int i=h-2;
  265. while (i--)
  266. {
  267. int j=w-2;
  268. int lx=1-cx;
  269. if (blend)
  270. {
  271. while (j--)
  272. {
  273. int m1,p1,mw,pw;
  274. m1=depthbuffer[-1];
  275. p1=depthbuffer[1];
  276. mw=depthbuffer[-w];
  277. pw=depthbuffer[w];
  278. if (!curbuf || (curbuf && (m1||p1||mw||pw)))
  279. {
  280. int coul1,coul2;
  281. coul1=depthof(p1, invert)-depthof(m1, invert)-lx;
  282. coul2=depthof(pw, invert)-depthof(mw, invert)-ly;
  283. coul1=127-abs(coul1);
  284. coul2=127-abs(coul2);
  285. if (coul1<=0||coul2<=0)
  286. coul1=setdepth0(framebuffer[0]);
  287. else
  288. coul1=setdepth((coul1*coul2*thisDepth_scaled)>>(8+6), framebuffer[0]);
  289. fbout[0]=BLEND(framebuffer[0], coul1);
  290. }
  291. depthbuffer++;
  292. framebuffer++;
  293. fbout++;
  294. lx++;
  295. }
  296. }
  297. else if (blendavg)
  298. {
  299. while (j--)
  300. {
  301. int m1,p1,mw,pw;
  302. m1=depthbuffer[-1];
  303. p1=depthbuffer[1];
  304. mw=depthbuffer[-w];
  305. pw=depthbuffer[w];
  306. if (!curbuf || (curbuf && (m1||p1||mw||pw)))
  307. {
  308. int coul1,coul2;
  309. coul1=depthof(p1, invert)-depthof(m1, invert)-lx;
  310. coul2=depthof(pw, invert)-depthof(mw, invert)-ly;
  311. coul1=127-abs(coul1);
  312. coul2=127-abs(coul2);
  313. if (coul1<=0||coul2<=0)
  314. coul1=setdepth0(framebuffer[0]);
  315. else
  316. coul1=setdepth((coul1*coul2*thisDepth_scaled)>>(8+6), framebuffer[0]);
  317. fbout[0]=BLEND_AVG(framebuffer[0], coul1);
  318. }
  319. depthbuffer++;
  320. framebuffer++;
  321. fbout++;
  322. lx++;
  323. }
  324. }
  325. else
  326. {
  327. while (j--)
  328. {
  329. int m1,p1,mw,pw;
  330. m1=depthbuffer[-1];
  331. p1=depthbuffer[1];
  332. mw=depthbuffer[-w];
  333. pw=depthbuffer[w];
  334. if (!curbuf || (curbuf && (m1||p1||mw||pw)))
  335. {
  336. int coul1,coul2;
  337. coul1=depthof(p1, invert)-depthof(m1, invert)-lx;
  338. coul2=depthof(pw, invert)-depthof(mw, invert)-ly;
  339. coul1=127-abs(coul1);
  340. coul2=127-abs(coul2);
  341. if (coul1<=0||coul2<=0)
  342. coul1=setdepth0(framebuffer[0]);
  343. else
  344. coul1=setdepth((coul1*coul2*thisDepth_scaled)>>(8+6), framebuffer[0]);
  345. fbout[0]=coul1;
  346. }
  347. depthbuffer++;
  348. framebuffer++;
  349. fbout++;
  350. lx++;
  351. }
  352. }
  353. depthbuffer+=2;
  354. framebuffer+=2;
  355. fbout+=2;
  356. ly++;
  357. }
  358. if (nF)
  359. {
  360. nF--;
  361. if (nF)
  362. {
  363. int a = abs(depth - depth2) / durFrames;
  364. thisDepth += a * (depth2 > depth ? -1 : 1);
  365. }
  366. }
  367. return 1;
  368. }
  369. // configuration dialog stuff
  370. static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam)
  371. {
  372. switch (uMsg)
  373. {
  374. case WM_INITDIALOG:
  375. SetDlgItemText(hwndDlg, IDC_CODE1, g_ConfigThis->code1.get());
  376. SetDlgItemText(hwndDlg, IDC_CODE2, g_ConfigThis->code2.get());
  377. SetDlgItemText(hwndDlg, IDC_CODE3, g_ConfigThis->code3.get());
  378. SendDlgItemMessage(hwndDlg, IDC_DEPTH, TBM_SETTICFREQ, 10, 0);
  379. SendDlgItemMessage(hwndDlg, IDC_DEPTH, TBM_SETRANGE, TRUE, MAKELONG(1, 100));
  380. SendDlgItemMessage(hwndDlg, IDC_DEPTH, TBM_SETPOS, TRUE, g_ConfigThis->depth);
  381. SendDlgItemMessage(hwndDlg, IDC_DEPTH2, TBM_SETTICFREQ, 10, 0);
  382. SendDlgItemMessage(hwndDlg, IDC_DEPTH2, TBM_SETRANGE, TRUE, MAKELONG(1, 100));
  383. SendDlgItemMessage(hwndDlg, IDC_DEPTH2, TBM_SETPOS, TRUE, g_ConfigThis->depth2);
  384. SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_SETTICFREQ, 10, 0);
  385. SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_SETRANGE, TRUE, MAKELONG(1, 100));
  386. SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_SETPOS, TRUE, g_ConfigThis->durFrames);
  387. if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED);
  388. if (g_ConfigThis->invert) CheckDlgButton(hwndDlg,IDC_INVERTDEPTH,BST_CHECKED);
  389. if (g_ConfigThis->onbeat) CheckDlgButton(hwndDlg,IDC_ONBEAT,BST_CHECKED);
  390. if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED);
  391. if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED);
  392. if (g_ConfigThis->showlight) CheckDlgButton(hwndDlg,IDC_DOT,BST_CHECKED);
  393. if (!g_ConfigThis->blend && !g_ConfigThis->blendavg)
  394. CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED);
  395. SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRING(IDS_CURRENT));
  396. {
  397. int i=0;
  398. char txt[64];
  399. for (i=0;i<NBUF;i++)
  400. {
  401. wsprintf(txt, WASABI_API_LNGSTRING(IDS_BUFFER_X), i+1);
  402. SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)txt);
  403. }
  404. }
  405. SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_SETCURSEL, (WPARAM) g_ConfigThis->buffern, 0);
  406. return 1;
  407. case WM_NOTIFY:
  408. {
  409. if (LOWORD(wParam) == IDC_DEPTH)
  410. g_ConfigThis->depth = SendDlgItemMessage(hwndDlg, IDC_DEPTH, TBM_GETPOS, 0, 0);
  411. if (LOWORD(wParam) == IDC_DEPTH2)
  412. g_ConfigThis->depth2 = SendDlgItemMessage(hwndDlg, IDC_DEPTH2, TBM_GETPOS, 0, 0);
  413. if (LOWORD(wParam) == IDC_BEATDUR)
  414. g_ConfigThis->durFrames = SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_GETPOS, 0, 0);
  415. }
  416. return 0;
  417. case WM_COMMAND:
  418. if (LOWORD(wParam) == IDC_HELPBTN)
  419. {
  420. /* char text[4096];
  421. WASABI_API_LNGSTRING_BUF(IDS_BUMP_LIGHT_POSITION,text,4096);
  422. int titlelen = lstrlen(text)+1;
  423. lstrcpyn(text+titlelen,GetTextResource(IDR_BUMP_LIGHT_POSITION),4095-titlelen);
  424. */
  425. char *text="Bump Light Position\0"
  426. "How to use the custom light position evaluator:\r\n"
  427. " * Init code will be executed each time the window size is changed\r\n"
  428. " or when the effect loads\r\n"
  429. " * Frame code is executed before rendering a new frame\r\n"
  430. " * Beat code is executed when a beat is detected\r\n"
  431. "\r\n"
  432. "Predefined variables:\r\n"
  433. " x : Light x position, ranges from 0 (left) to 1 (right) (0.5 = center)\r\n"
  434. " y : Light y position, ranges from 0 (top) to 1 (bottom) (0.5 = center)\r\n"
  435. " isBeat : 1 if no beat, -1 if beat (weird, but old)\r\n"
  436. " isLBeat: same as isBeat but persists according to 'shorter/longer' settings\r\n"
  437. " (usable only with OnBeat checked)\r\n"
  438. " bi: Bump intensity, ranges from 0 (flat) to 1 (max specified bump, default)\r\n"
  439. " You may also use temporary variables accross code segments\r\n"
  440. "\r\n"
  441. "Some examples:\r\n"
  442. " Circular move\r\n"
  443. " Init : t=0\r\n"
  444. " Frame: x=0.5+cos(t)*0.3; y=0.5+sin(t)*0.3; t=t+0.1;\r\n"
  445. " Nice motion:\r\n"
  446. " Init : t=0;u=0\r\n"
  447. " Frame: x=0.5+cos(t)*0.3; y=0.5+cos(u)*0.3; t=t+0.1; u=u+0.012;\r\n"
  448. ;
  449. compilerfunctionlist(hwndDlg,text);
  450. return 0;
  451. }
  452. if ((LOWORD(wParam) == IDC_CHECK1) ||
  453. (LOWORD(wParam) == IDC_ONBEAT) ||
  454. (LOWORD(wParam) == IDC_ADDITIVE) ||
  455. (LOWORD(wParam) == IDC_REPLACE) ||
  456. (LOWORD(wParam) == IDC_DOT) ||
  457. (LOWORD(wParam) == IDC_INVERTDEPTH) ||
  458. (LOWORD(wParam) == IDC_5050) )
  459. {
  460. g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0;
  461. g_ConfigThis->onbeat=IsDlgButtonChecked(hwndDlg,IDC_ONBEAT)?1:0;
  462. g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0;
  463. g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0;
  464. g_ConfigThis->showlight=IsDlgButtonChecked(hwndDlg,IDC_DOT)?1:0;
  465. g_ConfigThis->invert=IsDlgButtonChecked(hwndDlg,IDC_INVERTDEPTH)?1:0;
  466. }
  467. if (LOWORD(wParam) == IDC_CODE1 && HIWORD(wParam) == EN_CHANGE)
  468. {
  469. EnterCriticalSection(&g_ConfigThis->rcs);
  470. g_ConfigThis->code1.get_from_dlgitem(hwndDlg,IDC_CODE1);
  471. g_ConfigThis->need_recompile=1;
  472. LeaveCriticalSection(&g_ConfigThis->rcs);
  473. }
  474. if (LOWORD(wParam) == IDC_CODE2 && HIWORD(wParam) == EN_CHANGE)
  475. {
  476. EnterCriticalSection(&g_ConfigThis->rcs);
  477. g_ConfigThis->code2.get_from_dlgitem(hwndDlg,IDC_CODE2);
  478. g_ConfigThis->need_recompile=1;
  479. LeaveCriticalSection(&g_ConfigThis->rcs);
  480. }
  481. if (LOWORD(wParam) == IDC_CODE3 && HIWORD(wParam) == EN_CHANGE)
  482. {
  483. EnterCriticalSection(&g_ConfigThis->rcs);
  484. g_ConfigThis->code3.get_from_dlgitem(hwndDlg,IDC_CODE3);
  485. g_ConfigThis->need_recompile=1;
  486. g_ConfigThis->initted=0;
  487. LeaveCriticalSection(&g_ConfigThis->rcs);
  488. }
  489. if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMBO1) // handle clicks to combo box
  490. g_ConfigThis->buffern = SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_GETCURSEL, 0, 0);
  491. return 0;
  492. }
  493. return 0;
  494. }
  495. HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible
  496. {
  497. g_ConfigThis = this;
  498. return WASABI_API_CREATEDIALOG(IDD_CFG_BUMP,hwndParent,g_DlgProc);
  499. }
  500. // export stuff
  501. C_RBASE *R_Bump(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description
  502. {
  503. if (desc) { strcpy(desc,MOD_NAME); return NULL; }
  504. return (C_RBASE *) new C_THISCLASS();
  505. }
  506. #else
  507. C_RBASE *R_Bump(char *desc) { return NULL; }
  508. #endif