changeset 366:7d8a357fdff4 trunk

[svn] - speed up dyntrans a little
author nenolod
date Mon, 11 Dec 2006 22:56:12 -0800
parents b6916d136a12
children 1dcf9f67b066
files ChangeLog src/paranormal/xform.c
diffstat 2 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 11 22:16:54 2006 -0800
+++ b/ChangeLog	Mon Dec 11 22:56:12 2006 -0800
@@ -1,3 +1,11 @@
+2006-12-12 06:16:54 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [800]
+  - add support for polar coordinates.
+  
+  trunk/src/paranormal/xform.c |  131 +++++++++++++++++++++++++------------------
+  1 file changed, 79 insertions(+), 52 deletions(-)
+
+
 2006-12-11 14:07:12 +0000  William Pitcock <nenolod@nenolod.net>
   revision [796]
   - make scrobbler behave better
--- a/src/paranormal/xform.c	Mon Dec 11 22:16:54 2006 -0800
+++ b/src/paranormal/xform.c	Mon Dec 11 22:56:12 2006 -0800
@@ -619,6 +619,8 @@
 {
   { "init_script", "The formula to evaluate on init.",
     OPT_TYPE_STRING, { sval: "" } },
+  { "beat_script", "The formula to evaluate on each beat.",
+    OPT_TYPE_STRING, { sval: "" } },
   { "frame_script", "The formula to evaluate on each frame.",
     OPT_TYPE_STRING, { sval: "" } },
   { "point_script", "The formula to evaluate.",
@@ -632,6 +634,7 @@
   int width, height;                 /* Previous width and height. */
   expression_t *expr_init;
   expression_t *expr_frame;
+  expression_t *expr_beat;
   expression_t *expr_point;
   symbol_dict_t *dict;
   struct xform_vector *vfield;
@@ -724,14 +727,20 @@
    df = dict_variable(d->dict, "d");
 
    /* run the on-frame script. */
-   if (d->expr_frame != NULL)
-     expr_execute(d->expr_frame, d->dict);
+   if (d->expr_frame != NULL || (d->expr_beat != NULL && pn_is_new_beat()))
+     {
+       if (d->expr_beat != NULL && pn_is_new_beat())
+         expr_execute(d->expr_beat, d->dict);
 
-   for (j = 0; j < pn_image_data->height; j++)
-     for (i = 0; i < pn_image_data->width; i++)
-       {
-         transform_func(d->vfield, i, j, d->expr_point, d->dict);
-       }
+       if (d->expr_frame != NULL)
+         expr_execute(d->expr_frame, d->dict);
+
+       for (j = 0; j < pn_image_data->height; j++)
+         for (i = 0; i < pn_image_data->width; i++)
+           {
+             transform_func(d->vfield, i, j, d->expr_point, d->dict);
+           }
+     }
 
   apply_xform (d->vfield);
   pn_swap_surfaces ();