5 Extension module for the rfxswf library.
6 Part of the swftools package.
8 Copyright (c) 2000, 2001 Rainer Böhme <rfxswf@reflex-studio.de>
10 This file is distributed under the GPL, see file COPYING for details
14 int swf_ButtonSetRecord(TAG * t,U8 state,U16 id,U16 layer,MATRIX * m,CXFORM * cx)
20 if (swf_GetTagID(t)==ST_DEFINEBUTTON2) swf_SetCXForm(t,cx,0);
24 int swf_ButtonSetCondition(TAG * t,U16 condition)
25 { swf_SetU16(t,0); // dummy for Action Offset -> later set by ButtonPostProcess
26 swf_SetU16(t,condition);
30 int swf_ButtonSetFlags(TAG * t,U8 flags)
31 { if (swf_GetTagID(t)==ST_DEFINEBUTTON2)
33 swf_SetU16(t,0); // dummy for Action Offset -> later set by ButtonPostProcess
38 void swf_SetButtonOffset(TAG * t,U32 offsetpos)
39 { U32 now = swf_GetTagPos(t);
40 U16 diff = now-offsetpos;
41 swf_SetTagPos(t,offsetpos);
42 t->data[t->pos++] = (U8)(diff&0xff);
43 t->data[t->pos++] = (U8)(diff>>8);
47 int swf_ButtonPostProcess(TAG * t,int anz_action)
48 { if (swf_GetTagID(t)==ST_DEFINEBUTTON2)
52 oldTagPos = swf_GetTagPos(t);
54 // scan DefineButton2 Record
56 swf_GetU16(t); // Character ID
57 swf_GetU8(t); // Flags;
59 offsetpos = swf_GetTagPos(t); // first offset
62 while (swf_GetU8(t)) // state -> parse ButtonRecord
63 { swf_GetU16(t); // id
64 swf_GetU16(t); // layer
65 swf_GetMatrix(t,NULL); // matrix
66 swf_GetCXForm(t,NULL,0);// CXForm
69 swf_SetButtonOffset(t,offsetpos);
74 offsetpos = swf_GetTagPos(t); // offset
77 swf_GetU16(t); // condition
79 while ((a=swf_GetU8(t))) // skip action records
81 { U16 l = swf_GetU16(t);
82 swf_GetBlock(t,NULL,l);
86 if (--anz_action) swf_SetButtonOffset(t,offsetpos);
89 swf_SetTagPos(t,oldTagPos);