git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
the flash player expects us to set *all* components to 0 if a color
[swftools.git]
/
src
/
swfc.c
diff --git
a/src/swfc.c
b/src/swfc.c
index
131c794
..
db5ae8b
100644
(file)
--- a/
src/swfc.c
+++ b/
src/swfc.c
@@
-715,7
+715,7
@@
int s_getframe()
return currentframe+1;
}
return currentframe+1;
}
-void s_frame(int nr, int cut, char*name)
+void s_frame(int nr, int cut, char*name, char anchor)
{
int t;
TAG*now = tag;
{
int t;
TAG*now = tag;
@@
-729,13
+729,15
@@
void s_frame(int nr, int cut, char*name)
if(t==nr-1 && name && *name) {
tag = swf_InsertTag(tag, ST_FRAMELABEL);
swf_SetString(tag, name);
if(t==nr-1 && name && *name) {
tag = swf_InsertTag(tag, ST_FRAMELABEL);
swf_SetString(tag, name);
- swf_SetU8(tag, 1); //make this an anchor
+ if(anchor)
+ swf_SetU8(tag, 1); //make this an anchor
}
}
}
}
- if(nr == 0 && currentframe == 0 && name) {
+ if(nr == 0 && currentframe == 0 && name && *name) {
tag = swf_InsertTag(tag, ST_FRAMELABEL);
swf_SetString(tag, name);
tag = swf_InsertTag(tag, ST_FRAMELABEL);
swf_SetString(tag, name);
- swf_SetU8(tag, 1); //make this an anchor
+ if(anchor)
+ swf_SetU8(tag, 1); //make this an anchor
}
if(cut) {
}
if(cut) {
@@
-1114,6
+1116,8
@@
void s_texture(char*name, char*object, int x, int y, float scalex, float scaley,
parameters_t p;
FILLSTYLE*fs = &texture->fs;
parameters_t p;
FILLSTYLE*fs = &texture->fs;
+ memset(&p, 0, sizeof(parameters_t));
+
if(bitmap) {
fs->type = FILL_TILED;
fs->id_bitmap = bitmap->id;
if(bitmap) {
fs->type = FILL_TILED;
fs->id_bitmap = bitmap->id;
@@
-1209,7
+1213,7
@@
void s_sound(char*name, char*filename)
unsigned blocksize = 1152;
int is_mp3 = 0;
unsigned blocksize = 1152;
int is_mp3 = 0;
- if(wav_read(filename, &wav)) {
+ if(wav_read(&wav, filename)) {
int t;
wav_convert2mono(&wav, &wav2, 44100);
samples = (U16*)wav2.data;
int t;
wav_convert2mono(&wav, &wav2, 44100);
samples = (U16*)wav2.data;
@@
-1262,7
+1266,15
@@
void s_sound(char*name, char*filename)
{
swf_SetSoundDefine(tag, samples, numsamples);
}
{
swf_SetSoundDefine(tag, samples, numsamples);
}
-
+
+ tag = swf_InsertTag(tag, ST_NAMECHARACTER);
+ swf_SetU16(tag, id);
+ swf_SetString(tag, name);
+ tag = swf_InsertTag(tag, ST_EXPORTASSETS);
+ swf_SetU16(tag, 1);
+ swf_SetU16(tag, id);
+ swf_SetString(tag, name);
+
sound = (sound_t*)malloc(sizeof(sound_t)); /* mem leak */
sound->tag = tag;
sound->id = id;
sound = (sound_t*)malloc(sizeof(sound_t)); /* mem leak */
sound->tag = tag;
sound->id = id;
@@
-1382,7
+1394,7
@@
int s_swf3action(char*name, char*action)
ActionTAG* a = 0;
instance_t* object = 0;
if(name)
ActionTAG* a = 0;
instance_t* object = 0;
if(name)
- dictionary_lookup(&instances, name);
+ object = (instance_t*)dictionary_lookup(&instances, name);
if(!object && name && *name) {
/* we have a name, but couldn't find it. Abort. */
return 0;
if(!object && name && *name) {
/* we have a name, but couldn't find it. Abort. */
return 0;
@@
-1799,8
+1811,10
@@
int parseTwip(char*str)
int t;
return sign*parseInt(str)*20;
} else {
int t;
return sign*parseInt(str)*20;
} else {
- int l=strlen(++dot);
+ char* old = strdup(str);
+ int l=strlen(dot+1);
char*s;
char*s;
+ *dot++ = 0;
for(s=str;s<dot-1;s++)
if(*s<'0' || *s>'9')
syntaxerror("Not a coordinate: \"%s\"", str);
for(s=str;s<dot-1;s++)
if(*s<'0' || *s>'9')
syntaxerror("Not a coordinate: \"%s\"", str);
@@
-1809,10
+1823,12
@@
int parseTwip(char*str)
syntaxerror("Not a coordinate: \"%s\"", str);
}
if(l>2 || (l==2 && (dot[1]!='0' && dot[1]!='5'))) {
syntaxerror("Not a coordinate: \"%s\"", str);
}
if(l>2 || (l==2 && (dot[1]!='0' && dot[1]!='5'))) {
- warning("precision loss: %s converted to twip: %s", str, dot);
+ dot[1] = ((dot[1]-0x30)/5)*5 + 0x30;
dot[2] = 0;
l=2;
dot[2] = 0;
l=2;
+ warning("precision loss: %s converted to twip: %s.%s", old, str, dot);
}
}
+ free(old);
if(l==0)
return sign*atoi(str)*20;
if(l==1)
if(l==0)
return sign*atoi(str)*20;
if(l==1)
@@
-2488,7
+2504,14
@@
static int c_frame(map_t*args)
{
char*framestr = lu(args, "n");
char*cutstr = lu(args, "cut");
{
char*framestr = lu(args, "n");
char*cutstr = lu(args, "cut");
+
char*name = lu(args, "name");
char*name = lu(args, "name");
+ char*anchor = lu(args, "anchor");
+ char buf[40];
+
+ if(!strcmp(anchor, "anchor") && !*name)
+ name = framestr;
+
int frame;
int cut = 0;
if(strcmp(cutstr, "no"))
int frame;
int cut = 0;
if(strcmp(cutstr, "no"))
@@
-2505,7
+2528,7
@@
static int c_frame(map_t*args)
&& !(frame==1 && s_getframe()==frame)) // equality is o.k. for frame 0
syntaxerror("frame expression must be >%d (is:%s)", s_getframe(), framestr);
}
&& !(frame==1 && s_getframe()==frame)) // equality is o.k. for frame 0
syntaxerror("frame expression must be >%d (is:%s)", s_getframe(), framestr);
}
- s_frame(frame, cut, name);
+ s_frame(frame, cut, name, !strcmp(anchor, "anchor"));
return 0;
}
static int c_primitive(map_t*args)
return 0;
}
static int c_primitive(map_t*args)
@@
-2870,7
+2893,7
@@
static struct {
char*arguments;
} arguments[] =
{{"flash", c_flash, "bbox=autocrop background=black version=6 fps=50 name= filename= @compress=default"},
char*arguments;
} arguments[] =
{{"flash", c_flash, "bbox=autocrop background=black version=6 fps=50 name= filename= @compress=default"},
- {"frame", c_frame, "n=<plus>1 name= @cut=no"},
+ {"frame", c_frame, "n=<plus>1 name= @cut=no @anchor=no"},
// "import" type stuff
{"swf", c_swf, "name filename"},
{"shape", c_swf, "name filename"},
// "import" type stuff
{"swf", c_swf, "name filename"},
{"shape", c_swf, "name filename"},