+void printhandlerflags(U16 handlerflags)
+{
+ if(handlerflags&1) printf("[on load]");
+ if(handlerflags&2) printf("[enter frame]");
+ if(handlerflags&4) printf("[unload]");
+ if(handlerflags&8) printf("[mouse move]");
+ if(handlerflags&16) printf("[mouse down]");
+ if(handlerflags&32) printf("[mouse up]");
+ if(handlerflags&64) printf("[key down]");
+ if(handlerflags&128) printf("[key up]");
+ if(handlerflags&256) printf("[data]");
+ if(handlerflags&0xfe00) printf("[???]");
+}
+void handlePlaceObject2(TAG*tag, char*prefix)
+{
+ U8 flags = swf_GetU8(tag);
+ MATRIX m;
+ CXFORM cx;
+ char pstr[3][160];
+ int ppos[3] = {0,0,0};
+ swf_GetU16(tag); //depth
+ //flags&1: move
+ if(flags&2) swf_GetU16(tag); //id
+ if(flags&4) {
+ swf_GetMatrix(tag,&m);
+ if(placements) {
+ ppos[0] += sprintf(pstr[0], "| Matrix ");
+ ppos[1] += sprintf(pstr[1], "| %5.3f %5.3f %6.2f ", m.sx/65536.0, m.r1/65536.0, m.tx/20.0);
+ ppos[2] += sprintf(pstr[2], "| %5.3f %5.3f %6.2f ", m.r0/65536.0, m.sy/65536.0, m.ty/20.0);
+ }
+ }
+ if(flags&8) {
+ swf_GetCXForm(tag, &cx, 1);
+ if(placements) {
+ ppos[0] += sprintf(pstr[0]+ppos[0], "| CXForm r g b a ");
+ ppos[1] += sprintf(pstr[1]+ppos[1], "| mul %4.1f %4.1f %4.1f %4.1f ", cx.r0/256.0, cx.g0/256.0, cx.b0/256.0, cx.a0/256.0);
+ ppos[2] += sprintf(pstr[2]+ppos[2], "| add %4d %4d %4d %4d ", cx.r1, cx.g1, cx.b1, cx.a1);
+ }
+ }
+ if(flags&16) {
+ U16 ratio = swf_GetU16(tag); //ratio
+ if(placements) {
+ ppos[0] += sprintf(pstr[0]+ppos[0], "| Ratio ");
+ ppos[1] += sprintf(pstr[1]+ppos[1], "| %-5d ", ratio);
+ ppos[2] += sprintf(pstr[2]+ppos[2], "| ");
+ }
+ }
+ if(flags&64) {
+ U16 clip = swf_GetU16(tag); //clip
+ if(placements) {
+ ppos[0] += sprintf(pstr[0]+ppos[0], "| Clip ");
+ ppos[1] += sprintf(pstr[1]+ppos[1], "| %-5d ", clip);
+ ppos[2] += sprintf(pstr[2]+ppos[2], "| ");
+ }
+ }
+ if(flags&32) { while(swf_GetU8(tag)); }
+ if(placements && ppos[0]) {
+ printf("\n");
+ printf("%s %s\n", prefix, pstr[0]);
+ printf("%s %s\n", prefix, pstr[1]);
+ printf("%s %s", prefix, pstr[2]);
+ }
+ if(flags&128) {
+ if (action) {
+ U16 unknown;
+ U32 globalflags;
+ U32 handlerflags;
+ char is32 = 0;
+ printf("\n");
+ unknown = swf_GetU16(tag);
+ globalflags = swf_GetU16(tag);
+ if(unknown) {
+ printf("Unknown parameter field not zero: %04x\n", unknown);
+ return;
+ }
+ printf("global flags: %04x\n", globalflags);
+ handlerflags = swf_GetU16(tag);
+ if(!handlerflags) {
+ handlerflags = swf_GetU32(tag);
+ is32 = 1;
+ }
+ while(handlerflags) {
+ int length;
+ int t;
+ ActionTAG*a;
+
+ globalflags &= ~handlerflags;
+ printf("%s flags %08x ",prefix, handlerflags);
+ printhandlerflags(handlerflags);
+ length = swf_GetU32(tag);
+ printf(", %d bytes actioncode\n",length);
+ a = swf_ActionGet(tag);
+ swf_DumpActions(a,prefix);
+ swf_ActionFree(a);
+
+ handlerflags = is32?swf_GetU32(tag):swf_GetU16(tag);
+ }
+ if(globalflags) // should go to sterr.
+ printf("ERROR: unsatisfied handlerflags: %02x\n", globalflags);
+ } else {
+ printf(" has action code\n");
+ }
+ } else printf("\n");
+}
+
+void handlePlaceObject(TAG*tag, char*prefix)
+{
+ /*TODO*/
+}