#include <string.h>
#include <memory.h>
#include <errno.h>
-#define logf logarithmf // logf is also used by ../lib/log.h
#include <math.h>
-#undef logf
#include "../config.h"
#include "../lib/rfxswf.h"
#include "../lib/log.h"
#include "../lib/args.h"
-#include "q.h"
+#include "../lib/q.h"
#include "parser.h"
#include "wav.h"
int f;
SWF swf;
SWFFONT* font;
- f = open(filename,O_RDONLY);
+ f = open(filename,O_RDONLY|O_BINARY);
if (f<0) {
warning("Couldn't open file \"%s\": %s", filename, strerror(errno));
font = (SWFFONT*)malloc(sizeof(SWFFONT));
}
int parseTwip(char*str)
{
- char*dot = strchr(str, '.');
+ char*dot;
+ int sign=1;
+ if(str[0]=='+' || str[0]=='-') {
+ if(str[0]=='-')
+ sign = -1;
+ str++;
+ }
+ dot = strchr(str, '.');
if(!dot) {
int l=strlen(str);
int t;
- return parseInt(str)*20;
+ return sign*parseInt(str)*20;
} else {
int l=strlen(++dot);
char*s;
l=2;
}
if(l==0)
- return atoi(str)*20;
+ return sign*atoi(str)*20;
if(l==1)
- return atoi(str)*20+atoi(dot)*2;
+ return sign*atoi(str)*20+atoi(dot)*2;
if(l==2)
- return atoi(str)*20+atoi(dot)/5;
+ return sign*atoi(str)*20+atoi(dot)/5;
}
return 0;
}
l--;
return *(SPOINT*)&mpoints.buffer[l];
}
+static int c_gradient(map_t*args)
+{
+ return 0;
+}
static int c_point(map_t*args)
{
char*name = lu(args, "name");
char*name = lu(args, "sound");
char*loop = lu(args, "loop");
char*nomultiple = lu(args, "nomultiple");
+ int nm = 0;
+ if(!strcmp(nomultiple, "nomultiple"))
+ nm = 1;
+ else
+ nm = parseInt(nomultiple);
- s_playsound(name, parseInt(loop), parseInt(nomultiple), 0);
+ s_playsound(name, parseInt(loop), nm, 0);
return 0;
}
{"font", c_font, "name filename"},
{"soundtrack", c_soundtrack, "filename"},
+ // generators of primitives
+
+ {"point", c_point, "name x=0 y=0"},
+ {"gradient", c_gradient, "name"},
+
// character generators
{"box", c_primitive, "name width height color=white line=1 @fill=none"},
{"circle", c_primitive, "name r color=white line=1 @fill=none"},
// virtual object placement
{"buttonput", c_buttonput, "<i> x=0 y=0 red=+0 green=+0 blue=+0 alpha=+0 luminance= scale= scalex=100% scaley=100% shear=0 rotate=0 above= below="},
{"texture", c_texture, "<i> x=0 y=0 scale= scalex=100% scaley=100% shear=0 rotate=0"},
- {"point", c_point, "name x=0 y=0"},
// commands which start a block
//startclip (see above)