Mercurial > audlegacy-plugins
annotate src/paranormal/general.c @ 2168:3c9527d25346
fix a crash bug in mp4_is_our_file().
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Sat, 17 Nov 2007 03:41:41 +0900 |
parents | 56bb18dd3fdd |
children | a509498d76b9 |
rev | line source |
---|---|
1892
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
1 /* |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
2 * paranormal: iterated pipeline-driven visualization plugin |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
3 * Copyright (c) 2006, 2007 William Pitcock <nenolod@dereferenced.org> |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
4 * Portions copyright (c) 2001 Jamie Gennis <jgennis@mindspring.com> |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
5 * |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
8 * the Free Software Foundation; under version 2 of the License. |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
9 * |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
13 * GNU General Public License for more details. |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
14 * |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
18 */ |
3b034150d31e
Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents:
1177
diff
changeset
|
19 |
149
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
20 /* FIXME: what to name this file? */ |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
21 |
1943
56bb18dd3fdd
paranormal: CONFIG_H removal
William Pitcock <nenolod@atheme.org>
parents:
1892
diff
changeset
|
22 #include <config.h> |
149
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
23 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
24 #include "paranormal.h" |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
25 #include "actuators.h" |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
26 #include "pn_utils.h" |
1177
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
27 #include "libcalc/calc.h" |
149
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
28 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
29 /* **************** general_fade **************** */ |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
30 static struct pn_actuator_option_desc general_fade_opts[] = |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
31 { |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
32 { "amount", "The amount by which the color index of each " |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
33 "pixel should be decreased by each frame (MAX 255)", |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
34 OPT_TYPE_INT, { ival: 3 } }, |
175 | 35 { NULL } |
149
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
36 }; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
37 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
38 static void |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
39 general_fade_exec (const struct pn_actuator_option *opts, |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
40 gpointer data) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
41 { |
177 | 42 int amt = opts[0].val.ival > 255 || opts[0].val.ival < 0 ? 3 : opts[0].val.ival; |
149
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
43 int i, j; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
44 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
45 for (j=0; j<pn_image_data->height; j++) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
46 for (i=0; i<pn_image_data->width; i++) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
47 pn_image_data->surface[0][PN_IMG_INDEX (i, j)] = |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
48 CAPLO (pn_image_data->surface[0][PN_IMG_INDEX (i, j)] |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
49 - amt, 0); |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
50 } |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
51 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
52 struct pn_actuator_desc builtin_general_fade = |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
53 { |
155
adf9f4b26039
[svn] - user-friendly names (UI side unimplemented still)
nenolod
parents:
149
diff
changeset
|
54 "general_fade", "Fade-out", "Decreases the color index of each pixel", |
149
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
55 0, general_fade_opts, |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
56 NULL, NULL, general_fade_exec |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
57 }; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
58 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
59 /* **************** general_blur **************** */ |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
60 /* FIXME: add a variable radius */ |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
61 /* FIXME: SPEEEED */ |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
62 static void |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
63 general_blur_exec (const struct pn_actuator_option *opts, |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
64 gpointer data) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
65 { |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
66 int i,j; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
67 register guchar *srcptr = pn_image_data->surface[0]; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
68 register guchar *destptr = pn_image_data->surface[1]; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
69 register int sum; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
70 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
71 for (j=0; j<pn_image_data->height; j++) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
72 for (i=0; i<pn_image_data->width; i++) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
73 { |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
74 sum = *(srcptr)<<2; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
75 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
76 /* top */ |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
77 if (j > 0) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
78 { |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
79 sum += *(srcptr-pn_image_data->width)<<1; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
80 if (i > 0) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
81 sum += *(srcptr-pn_image_data->width-1); |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
82 if (i < pn_image_data->width-1) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
83 sum += *(srcptr-pn_image_data->width+1); |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
84 } |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
85 /* bottom */ |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
86 if (j < pn_image_data->height-1) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
87 { |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
88 sum += *(srcptr+pn_image_data->width)<<1; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
89 if (i > 0) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
90 sum += *(srcptr+pn_image_data->width-1); |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
91 if (i < pn_image_data->width-1) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
92 sum += *(srcptr+pn_image_data->width+1); |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
93 } |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
94 /* left */ |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
95 if (i > 0) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
96 sum += *(srcptr-1)<<1; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
97 /* right */ |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
98 if (i < pn_image_data->width-1) |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
99 sum += *(srcptr+1)<<1; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
100 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
101 *destptr++ = (guchar)(sum >> 4); |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
102 srcptr++; |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
103 } |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
104 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
105 pn_swap_surfaces (); |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
106 } |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
107 |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
108 struct pn_actuator_desc builtin_general_blur = |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
109 { |
155
adf9f4b26039
[svn] - user-friendly names (UI side unimplemented still)
nenolod
parents:
149
diff
changeset
|
110 "general_blur", "Blur", "A simple 1 pixel radius blur", |
149
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
111 0, NULL, |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
112 NULL, NULL, general_blur_exec |
fd9c0a5871ac
[svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff
changeset
|
113 }; |
174
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
114 |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
115 /* **************** general_mosaic **************** */ |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
116 /* FIXME: add a variable radius */ |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
117 /* FIXME: SPEEEED */ |
175 | 118 static struct pn_actuator_option_desc general_mosaic_opts[] = |
119 { | |
120 { "radius", "The pixel radius that should be used for the effect.", | |
121 OPT_TYPE_INT, { ival: 6 } }, | |
122 { NULL } | |
123 }; | |
124 | |
174
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
125 static void |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
126 general_mosaic_exec (const struct pn_actuator_option *opts, |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
127 gpointer data) |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
128 { |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
129 int i,j; |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
130 register guchar *srcptr = pn_image_data->surface[0]; |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
131 register guchar *destptr = pn_image_data->surface[1]; |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
132 register int sum; |
177 | 133 int radius = opts[0].val.ival > 255 || opts[0].val.ival < 0 ? 6 : opts[0].val.ival; |
174
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
134 |
175 | 135 for (j=0; j<pn_image_data->height; j += radius) |
136 for (i=0; i<pn_image_data->width; i += radius) | |
174
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
137 { |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
138 int ii = 0, jj = 0; |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
139 guchar bval = 0; |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
140 |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
141 /* find the brightest colour */ |
175 | 142 for (jj = 0; jj < radius && (j + jj < pn_image_data->height); jj++) |
143 for (ii = 0; ii < radius && (i + ii < pn_image_data->width); ii++) | |
174
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
144 { |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
145 guchar val = srcptr[PN_IMG_INDEX(i + ii, j + jj)]; |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
146 |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
147 if (val > bval) |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
148 bval = val; |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
149 } |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
150 |
175 | 151 for (jj = 0; jj < radius && (j + jj < pn_image_data->height); jj++) |
152 for (ii = 0; ii < radius && (i + ii < pn_image_data->width); ii++) | |
174
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
153 { |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
154 destptr[PN_IMG_INDEX(i + ii, j + jj)] = bval; |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
155 } |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
156 } |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
157 |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
158 pn_swap_surfaces (); |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
159 } |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
160 |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
161 struct pn_actuator_desc builtin_general_mosaic = |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
162 { |
176 | 163 "general_mosaic", "Mosaic", "A simple mosaic effect.", |
175 | 164 0, general_mosaic_opts, |
174
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
165 NULL, NULL, general_mosaic_exec |
3d98be3d74c2
[svn] - mosaic effect (in progress, custom size will be in the next commit)
nenolod
parents:
155
diff
changeset
|
166 }; |
177 | 167 |
168 /* **************** general_clear **************** */ | |
169 static void | |
170 general_clear_exec (const struct pn_actuator_option *opts, | |
171 gpointer data) | |
172 { | |
173 memset(pn_image_data->surface[0], '\0', | |
174 (pn_image_data->height * pn_image_data->width)); | |
175 } | |
176 | |
177 struct pn_actuator_desc builtin_general_clear = | |
178 { | |
179 "general_clear", "Clear Surface", "Clears the surface.", | |
180 0, NULL, | |
181 NULL, NULL, general_clear_exec | |
182 }; | |
183 | |
179
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
184 /* **************** general_noop **************** */ |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
185 static void |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
186 general_noop_exec (const struct pn_actuator_option *opts, |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
187 gpointer data) |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
188 { |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
189 return; |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
190 } |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
191 |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
192 struct pn_actuator_desc builtin_general_noop = |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
193 { |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
194 "general_noop", "Do Nothing", "Does absolutely nothing.", |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
195 0, NULL, |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
196 NULL, NULL, general_noop_exec |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
197 }; |
b44ab11a64c2
[svn] - NOOP instruction. What this does is basically takes a slot in a
nenolod
parents:
177
diff
changeset
|
198 |
181 | 199 /* **************** general_invert **************** */ |
200 static void | |
201 general_invert_exec (const struct pn_actuator_option *opts, | |
202 gpointer data) | |
203 { | |
204 int i, j; | |
205 | |
206 for (j=0; j < pn_image_data->height; j++) | |
207 for (i=0; i < pn_image_data->width; i++) | |
208 pn_image_data->surface[0][PN_IMG_INDEX (i, j)] = | |
209 255 - pn_image_data->surface[0][PN_IMG_INDEX (i, j)]; | |
210 } | |
211 | |
212 struct pn_actuator_desc builtin_general_invert = | |
213 { | |
214 "general_invert", "Value Invert", "Performs a value invert.", | |
215 0, NULL, | |
216 NULL, NULL, general_invert_exec | |
217 }; | |
218 | |
182
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
219 /* **************** general_replace **************** */ |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
220 static struct pn_actuator_option_desc general_replace_opts[] = |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
221 { |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
222 { "start", "The beginning colour value that should be replaced by the value of out.", |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
223 OPT_TYPE_INT, { ival: 250 } }, |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
224 { "end", "The ending colour value that should be replaced by the value of out.", |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
225 OPT_TYPE_INT, { ival: 255 } }, |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
226 { "out", "The colour value that in is replaced with.", |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
227 OPT_TYPE_INT, { ival: 0 } }, |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
228 { NULL } |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
229 }; |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
230 |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
231 static void |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
232 general_replace_exec (const struct pn_actuator_option *opts, |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
233 gpointer data) |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
234 { |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
235 register int i, j; |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
236 register guchar val; |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
237 guchar begin = opts[0].val.ival > 255 || opts[0].val.ival < 0 ? 250 : opts[0].val.ival; |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
238 guchar end = opts[1].val.ival > 255 || opts[1].val.ival < 0 ? 255 : opts[1].val.ival; |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
239 guchar out = opts[2].val.ival > 255 || opts[2].val.ival < 0 ? 0 : opts[2].val.ival; |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
240 |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
241 for (j=0; j < pn_image_data->height; j++) |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
242 for (i=0; i < pn_image_data->width; i++) |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
243 { |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
244 val = pn_image_data->surface[0][PN_IMG_INDEX (i, j)]; |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
245 if (val >= begin && val <= end) |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
246 pn_image_data->surface[0][PN_IMG_INDEX (i, j)] = out; |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
247 } |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
248 } |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
249 |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
250 struct pn_actuator_desc builtin_general_replace = |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
251 { |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
252 "general_replace", "Value Replace", "Performs a value replace on a range of values.", |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
253 0, general_replace_opts, |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
254 NULL, NULL, general_replace_exec |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
255 }; |
6048abdac7d1
[svn] - add value replace filter, replaces a range of values with a different value
nenolod
parents:
181
diff
changeset
|
256 |
271 | 257 /* **************** general_swap **************** */ |
258 static void | |
259 general_swap_exec (const struct pn_actuator_option *opts, | |
260 gpointer data) | |
261 { | |
262 pn_swap_surfaces (); | |
263 } | |
264 | |
265 struct pn_actuator_desc builtin_general_swap = | |
266 { | |
267 "general_swap", "Swap Surface", "Swaps the surface.", | |
268 0, NULL, | |
269 NULL, NULL, general_swap_exec | |
270 }; | |
272 | 271 |
272 /* **************** general_copy **************** */ | |
273 static void | |
274 general_copy_exec (const struct pn_actuator_option *opts, | |
275 gpointer data) | |
276 { | |
277 memcpy(pn_image_data->surface[1], pn_image_data->surface[0], | |
278 (pn_image_data->width * pn_image_data->height)); | |
279 } | |
280 | |
281 struct pn_actuator_desc builtin_general_copy = | |
282 { | |
283 "general_copy", "Copy Surface", "Copies the surface to the other surface.", | |
284 0, NULL, | |
285 NULL, NULL, general_copy_exec | |
286 }; | |
278 | 287 |
288 /* **************** general_flip **************** */ | |
289 static struct pn_actuator_option_desc general_flip_opts[] = | |
290 { | |
291 { "direction", "Negative is horizontal, positive is vertical.", | |
292 OPT_TYPE_INT, { ival: -1 } }, | |
293 { NULL } | |
294 }; | |
295 | |
296 static void | |
297 general_flip_exec (const struct pn_actuator_option *opts, | |
298 gpointer data) | |
299 { | |
300 gint x, y; | |
301 | |
302 if (opts[0].val.ival < 0) | |
303 { | |
304 for (y = 0; y < pn_image_data->height; y++) | |
305 for (x = 0; x < pn_image_data->width; x++) | |
306 { | |
307 pn_image_data->surface[1][PN_IMG_INDEX(pn_image_data->width - x, y)] = | |
308 pn_image_data->surface[0][PN_IMG_INDEX(x, y)]; | |
309 } | |
310 } | |
311 else | |
312 { | |
313 for (y = 0; y < pn_image_data->height; y++) | |
314 for (x = 0; x < pn_image_data->width; x++) | |
315 { | |
316 pn_image_data->surface[1][PN_IMG_INDEX(x, pn_image_data->height - y)] = | |
317 pn_image_data->surface[0][PN_IMG_INDEX(x, y)]; | |
318 } | |
319 } | |
320 | |
321 pn_swap_surfaces (); | |
322 } | |
323 | |
324 struct pn_actuator_desc builtin_general_flip = | |
325 { | |
326 "general_flip", "Flip Surface", "Flips the surface.", | |
327 0, general_flip_opts, | |
328 NULL, NULL, general_flip_exec | |
329 }; | |
1177
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
330 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
331 /* ***************** general_evaluate ***************** */ |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
332 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
333 static struct pn_actuator_option_desc general_evaluate_opts[] = |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
334 { |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
335 { "init_script", "Script to run on start.", OPT_TYPE_STRING, {sval: "global_reg0 = 27;"} }, |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
336 { "frame_script", "Script to run.", OPT_TYPE_STRING, {sval: "global_reg0 = global_reg0 + 1;"} }, |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
337 { NULL } |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
338 }; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
339 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
340 struct pn_evaluate_ctx |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
341 { |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
342 expression_t *expr_on_init, *expr_on_frame; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
343 symbol_dict_t *dict; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
344 gboolean reset; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
345 }; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
346 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
347 static void |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
348 general_evaluate_init(gpointer *data) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
349 { |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
350 *data = g_new0(struct pn_evaluate_ctx, 1); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
351 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
352 ((struct pn_evaluate_ctx *)*data)->reset = TRUE; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
353 } |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
354 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
355 static void |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
356 general_evaluate_cleanup(gpointer op_data) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
357 { |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
358 struct pn_evaluate_ctx *data = (struct pn_evaluate_ctx *) op_data; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
359 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
360 g_return_if_fail(data != NULL); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
361 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
362 if (data->expr_on_init) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
363 expr_free(data->expr_on_init); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
364 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
365 if (data->expr_on_frame) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
366 expr_free(data->expr_on_frame); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
367 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
368 if (data->dict) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
369 dict_free(data->dict); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
370 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
371 if (data) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
372 g_free(data); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
373 } |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
374 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
375 static void |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
376 general_evaluate_exec(const struct pn_actuator_option *opts, |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
377 gpointer op_data) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
378 { |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
379 struct pn_evaluate_ctx *data = (struct pn_evaluate_ctx *) op_data; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
380 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
381 if (data->reset) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
382 { |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
383 if (data->dict) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
384 dict_free(data->dict); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
385 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
386 data->dict = dict_new(); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
387 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
388 if (opts[0].val.sval != NULL); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
389 data->expr_on_init = expr_compile_string(opts[0].val.sval, data->dict); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
390 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
391 if (opts[1].val.sval != NULL); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
392 data->expr_on_frame = expr_compile_string(opts[1].val.sval, data->dict); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
393 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
394 if (data->expr_on_init != NULL) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
395 expr_execute(data->expr_on_init, data->dict); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
396 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
397 data->reset = FALSE; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
398 } |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
399 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
400 if (data->expr_on_frame != NULL) |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
401 expr_execute(data->expr_on_frame, data->dict); |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
402 } |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
403 |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
404 struct pn_actuator_desc builtin_general_evaluate = |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
405 { |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
406 "general_evaluate", "Evalulate VM Code", |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
407 "Evaluates arbitrary VM code. Does not draw anything.", |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
408 0, general_evaluate_opts, |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
409 general_evaluate_init, general_evaluate_cleanup, general_evaluate_exec |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
410 }; |
a7c98f237b03
[svn] - add general_evaluate which can run arbitrary VM code
nenolod
parents:
278
diff
changeset
|
411 |