gcc 2.95.3 fixes.
[swftools.git] / src / swfc.c
index c2de7de..9d9772a 100644 (file)
@@ -967,13 +967,16 @@ void s_quicktime(char*name, char*url)
 
 void s_edittext(char*name, char*fontname, int size, int width, int height, char*text, RGBA*color, int maxlength, char*variable, int flags)
 {
-    SWFFONT*font;
+    SWFFONT*font = 0;
     EditTextLayout layout;
     SRECT r;
 
-    font = dictionary_lookup(&fonts, fontname);
-    if(!font)
-       syntaxerror("font \"%s\" not known!", fontname);
+    if(fontname && *fontname) {
+       flags |= ET_USEOUTLINES;
+       font = dictionary_lookup(&fonts, fontname);
+       if(!font)
+           syntaxerror("font \"%s\" not known!", fontname);
+    }
     tag = swf_InsertTag(tag, ST_DEFINEEDITTEXT);
     swf_SetU16(tag, id);
     layout.align = 0;
@@ -985,7 +988,8 @@ void s_edittext(char*name, char*fontname, int size, int width, int height, char*
     r.ymin = 0;
     r.xmax = width;
     r.ymax = height;
-    swf_SetEditText(tag, flags|ET_USEOUTLINES, r, text, color, maxlength, font->id, size, &layout, variable);
+    
+    swf_SetEditText(tag, flags, r, text, color, maxlength, font?font->id:0, size, &layout, variable);
 
     s_addcharacter(name, id, tag, r);
     incrementid();
@@ -1102,6 +1106,7 @@ void s_sound(char*name, char*filename)
     sound_t* sound;
     U16*samples;
     int numsamples;
+    int t;
 
     if(!readWAV(filename, &wav)) {
        warning("Couldn't read wav file \"%s\"", filename);
@@ -1268,10 +1273,10 @@ void s_outline(char*name, char*format, char*source)
 int s_playsound(char*name, int loops, int nomultiple, int stop)
 {
     sound_t* sound;
+    SOUNDINFO info;
     if(!name)
        return 0;
     sound = dictionary_lookup(&sounds, name);
-    SOUNDINFO info;
     if(!sound)
        return 0;
 
@@ -1316,7 +1321,7 @@ void s_includeswf(char*name, char*filename)
     
     s = tag = swf_InsertTag(tag, ST_DEFINESPRITE);
     swf_SetU16(tag, id);
-    swf_SetU16(tag, 0);
+    swf_SetU16(tag, swf.frameCount);
 
     swf_Relocate(&swf, idmap);
 
@@ -2565,10 +2570,10 @@ static int c_action(map_t*args)
        s_action(text);
     } else {
        FILE*fi = fopen(filename, "rb");
-       if(!fi) 
-           syntaxerror("Couldn't find file %s: %s", filename, strerror(errno));
        int l;
        char*text;
+       if(!fi) 
+           syntaxerror("Couldn't find file %s: %s", filename, strerror(errno));
        fseek(fi, 0, SEEK_END);
        l = ftell(fi);
        fseek(fi, 0, SEEK_SET);
@@ -2615,7 +2620,7 @@ static struct {
 
  {"egon", c_egon, "name vertices color=white line=1 @fill=none"},
  {"text", c_text, "name text font size=100% color=white"},
- {"edittext", c_edittext, "name font size=100% width height text="" color=white maxlength=0 variable="" @password=0 @wordwrap=0 @multiline=0 @html=0 @noselect=0 @readonly=0 @border=0"},
+ {"edittext", c_edittext, "name font= size=100% width height text="" color=white maxlength=0 variable="" @password=0 @wordwrap=0 @multiline=0 @html=0 @noselect=0 @readonly=0 @border=0"},
  {"morphshape", c_morphshape, "name start end"},
  {"button", c_button, "name"},
     {"show", c_show,             "name x=0 y=0 red=+0 green=+0 blue=+0 alpha=+0 luminance= scale= scalex= scaley= pivot= pin= shear= rotate= ratio= above= below= as="},