X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fcombine.c;h=ebe89be25a183536d0dbdc3c6d474d429450a7f9;hb=d9896f66fc840720e59e7e90c94baadbc47bde94;hp=727f858d3bfb600d5c906b27e8719167eec38851;hpb=efe9cc12012cb4711840cbb7aa053dd28bd2ebff;p=swftools.git diff --git a/src/combine.c b/src/combine.c index 727f858..ebe89be 100644 --- a/src/combine.c +++ b/src/combine.c @@ -20,6 +20,7 @@ // * readers should be object-oriented static char* slavename; +static int slaveid; static char* tag_placeobject2_name (struct swf_tag* tag) { @@ -157,8 +158,15 @@ void write_sprite_defines(struct writer_t*w) * Anyway we can't throw it out, so we just pass it * through. */ + writer_write(w, tag->fulldata, tag->fulllength); break; } + case TAGID_JPEGTABLES: + /* according to the flash specs, there may only + be one JPEGTABLES tag per swf. This is maybe + a big FIXME */ + writer_write(w, tag->fulldata, tag->fulllength); + break; case TAGID_EXPORTASSETS: logf(" deliberately ignoring EXPORTASSETS tag"); break; @@ -198,12 +206,6 @@ void write_sprite(struct writer_t*w, int spriteid, int replaceddefine) startpos = (u8*)writer_getpos(w); - if (spriteid<0) - { - logf(" Didn't find anything named %s in file. No substitutions will occur.", slavename); - spriteid = get_free_id(); - } - logf (" sprite id is %d", spriteid); tmp = spriteid; writer_write(w, &tmp, 2); @@ -333,6 +335,11 @@ uchar * combine(uchar*masterdata, int masterlength, char*_slavename, uchar*slave char master_flash = 0; char slave_flash = 0; slavename = _slavename; + if(slavename[0] == '#') + { + slaveid = atoi(&slavename[1]); + slavename = 0; + } logf(" move x (%d)", config.movex); logf(" move y (%d)", config.movey); @@ -410,7 +417,8 @@ uchar * combine(uchar*masterdata, int masterlength, char*_slavename, uchar*slave else logf(" tagid %02x places object %d (no name)", tag, id); - if (name && !strcmp(name,slavename)) { + if ((name && slavename && !strcmp(name,slavename)) || + (!slavename && id==slaveid)) { if(id>=0) { spriteid = id; logf(" Slave file attached to object %d.", id); @@ -420,6 +428,17 @@ uchar * combine(uchar*masterdata, int masterlength, char*_slavename, uchar*slave } while(master.tags[pos++].id != 0); + if (spriteid<0) + { + if(slavename) { + if(strcmp(slavename,"!!dummy!!")) + logf(" Didn't find anything named %s in file. No substitutions will occur.", slavename); + } + else + logf(" Didn't find id %d in file. No substitutions will occur.", slaveid); + spriteid = get_free_id(); + } + swf_relocate (slavedata, slavelength, masterids); read_swf(&slave, slavedata, slavelength);