added ringbuffer routines.
[swftools.git] / src / swfc.c
index 23f632f..bc72efe 100644 (file)
@@ -856,7 +856,7 @@ void s_change(char*instance, parameters_t p2)
     p1 = i->parameters;
     
     allframes = currentframe - i->lastFrame - 1;
-    if(!allframes) {
+    if(allframes < 0) {
        warning(".change ignored. can only .put/.change an object once per frame.");
        return;
     }
@@ -1213,7 +1213,7 @@ int points_initialized = 0;
 
 SPOINT getPoint(SRECT r, char*name)
 {
-    int l;
+    int l=0;
     if(!strcmp(name, "center")) {
        SPOINT p;
        p.x = (r.xmin + r.xmax)/2;
@@ -1221,9 +1221,10 @@ SPOINT getPoint(SRECT r, char*name)
        return p;
     }
 
-    l = (int)dictionary_lookup(&points, name);
+    if(points_initialized)
+       l = (int)dictionary_lookup(&points, name);
     if(l==0) {
-       syntaxerror("Couldn't find point \"%s\".", name);
+       syntaxerror("Invalid point: \"%s\".", name);
     }
     l--;
     return *(SPOINT*)&mpoints.buffer[l];
@@ -1479,9 +1480,11 @@ static int c_frame(map_t*args)
 {
     char*framestr = lu(args, "n");
     int frame;
-    if(framestr[0]=='+') {
+    if(isRelative(framestr)) {
        frame = s_getframe();
-       frame += parseInt(framestr+1);
+       if(getSign(framestr)<0)
+           syntaxerror("relative frame expressions must be positive");
+       frame += parseInt(getOffset(framestr));
     }
     else {
        frame = parseInt(framestr);
@@ -1601,7 +1604,7 @@ static struct {
     char*arguments;
 } arguments[] =
 {{"swf", c_swf, "bbox=autocrop version=5 fps=50 name=!default! @compress=default"},
- {"frame", c_frame, "n=+1"},
+ {"frame", c_frame, "n=<plus>1"},
 
     // "import" type stuff
  {"shape", c_shape, "name filename"},