X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfbutton.c;h=40684aa7e74bd655d7e3717b2ac42f2110fe7e85;hb=879d0eec420fe0fd5ddcd56c8fe62b82a6744edd;hp=9a4cc39f38e802fb0b1766d8e0ca973517f27f7f;hpb=3e61040c568974514196f1927be48978e46d1058;p=swftools.git diff --git a/lib/modules/swfbutton.c b/lib/modules/swfbutton.c index 9a4cc39..40684aa 100644 --- a/lib/modules/swfbutton.c +++ b/lib/modules/swfbutton.c @@ -21,6 +21,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "../rfxswf.h" + int swf_ButtonSetRecord(TAG * t,U8 state,U16 id,U16 layer,MATRIX * m,CXFORM * cx) { swf_SetU8(t,state); @@ -100,3 +102,47 @@ int swf_ButtonPostProcess(TAG * t,int anz_action) } return 0; } + +ActionTAG* swf_Button1GetAction(TAG*tag) +{ + swf_GetU16(tag); //button id + while(1) + { + U8 flags = swf_GetU8(tag); + if(!flags) + break; + swf_GetU16(tag); //char + swf_GetU16(tag); //layer + swf_ResetReadBits(tag); + swf_GetMatrix(tag, NULL); + } + return swf_ActionGet(tag); +} + +ActionTAG* swf_Button2GetAction(TAG*tag) +{ + swf_GetU16(tag); //button id + swf_GetU8(tag); //flag + U16 offset = swf_GetU16(tag); //offset + swf_SetTagPos(tag, offset); + swf_GetU16(tag); // next offset + swf_GetU16(tag); // condition + + /* notice: this only returns the *first* action block. + For the current appliances, this is enough. + */ + return swf_ActionGet(tag); +} + +ActionTAG* swf_ButtonGetAction(TAG*t) +{ + if(t->id == ST_DEFINEBUTTON) { + return swf_Button1GetAction(t); + } else if(t->id == ST_DEFINEBUTTON2) { + return swf_Button2GetAction(t); + } else { + fprintf(stderr, "error in buttongetaction: not a button tag\n"); + return 0; + } +} +