changeset 334:a9f1bd76a3e6 trunk

[svn] - apply_xform(): check for NULL vfield (broken scripts) - add tan(), asin(), acos(), atan(), log() to script engine.
author nenolod
date Tue, 05 Dec 2006 03:40:04 -0800
parents afc61c0efc05
children 015513ad27d2
files ChangeLog src/paranormal/libcalc/function.c src/paranormal/xform.c
diffstat 3 files changed, 39 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Dec 05 02:16:09 2006 -0800
+++ b/ChangeLog	Tue Dec 05 03:40:04 2006 -0800
@@ -1,3 +1,14 @@
+2006-12-05 10:16:09 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [730]
+  - add Trans / Movement implementation
+  
+  trunk/src/paranormal/builtins.c                          |    2 
+  trunk/src/paranormal/presets/Makefile                    |    2 
+  trunk/src/paranormal/presets/nenolod_-_transform_fun.pnv |   24 +++
+  trunk/src/paranormal/xform.c                             |  119 +++++++++++++++
+  4 files changed, 147 insertions(+)
+
+
 2006-12-05 09:07:41 +0000  Kiyoshi Aman <kiyoshi.aman@gmail.com>
   revision [728]
   Remove old-style is_our_file() where a new-style is_our_fd() exists
--- a/src/paranormal/libcalc/function.c	Tue Dec 05 02:16:09 2006 -0800
+++ b/src/paranormal/libcalc/function.c	Tue Dec 05 03:40:04 2006 -0800
@@ -33,6 +33,10 @@
 
 /* */
 
+static double f_log (ex_stack *stack) {
+  return log (pop (stack));
+}
+
 static double f_sin (ex_stack *stack) {
   return sin (pop (stack));
 }
@@ -41,6 +45,22 @@
   return cos (pop (stack));
 }
 
+static double f_tan (ex_stack *stack) {
+  return tan (pop (stack));
+}
+
+static double f_asin (ex_stack *stack) {
+  return asin (pop (stack));
+}
+
+static double f_acos (ex_stack *stack) {
+  return acos (pop (stack));
+}
+
+static double f_atan (ex_stack *stack) {
+  return atan (pop (stack));
+}
+
 static double f_if (ex_stack *stack) {
   double a = pop (stack);
   double b = pop (stack);
@@ -58,6 +78,11 @@
 static const func_t init[] = {
   { "sin", f_sin },
   { "cos", f_cos },
+  { "tan", f_tan },
+  { "asin", f_asin },
+  { "acos", f_acos },
+  { "atan", f_atan },
+  { "log", f_log },
   { "if", f_if },
   { "div", f_div }
 };
--- a/src/paranormal/xform.c	Tue Dec 05 02:16:09 2006 -0800
+++ b/src/paranormal/xform.c	Tue Dec 05 03:40:04 2006 -0800
@@ -63,6 +63,9 @@
   register guchar *destptr;
   register int color;
 
+  if (vfield == NULL)
+      return;
+
   for (i=0, v=vfield, destptr=pn_image_data->surface[1];
        i<pn_image_data->width*pn_image_data->height;
        i++, v++, destptr++)