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 program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
24 int swf_ButtonSetRecord(TAG * t,U8 state,U16 id,U16 layer,MATRIX * m,CXFORM * cx)
30 if (swf_GetTagID(t)==ST_DEFINEBUTTON2) swf_SetCXForm(t,cx,1);
34 int swf_ButtonSetCondition(TAG * t,U16 condition)
35 { swf_SetU16(t,0); // dummy for Action Offset -> later set by ButtonPostProcess
36 swf_SetU16(t,condition);
40 int swf_ButtonSetFlags(TAG * t,U8 flags)
41 { if (swf_GetTagID(t)==ST_DEFINEBUTTON2)
43 swf_SetU16(t,0); // dummy for Action Offset -> later set by ButtonPostProcess
48 void swf_SetButtonOffset(TAG * t,U32 offsetpos)
49 { U32 now = swf_GetTagPos(t);
50 U16 diff = now-offsetpos;
51 swf_SetTagPos(t,offsetpos);
52 t->data[t->pos++] = (U8)(diff&0xff);
53 t->data[t->pos++] = (U8)(diff>>8);
57 int swf_ButtonPostProcess(TAG * t,int anz_action)
58 { if (swf_GetTagID(t)==ST_DEFINEBUTTON2)
62 oldTagPos = swf_GetTagPos(t);
64 // scan DefineButton2 Record
66 swf_GetU16(t); // Character ID
67 swf_GetU8(t); // Flags;
69 offsetpos = swf_GetTagPos(t); // first offset
72 while (swf_GetU8(t)) // state -> parse ButtonRecord
73 { swf_GetU16(t); // id
74 swf_GetU16(t); // layer
75 swf_GetMatrix(t,NULL); // matrix
76 swf_GetCXForm(t,NULL,1);// CXForm
79 swf_SetButtonOffset(t,offsetpos);
84 offsetpos = swf_GetTagPos(t); // offset
87 swf_GetU16(t); // condition
89 while ((a=swf_GetU8(t))) // skip action records
91 { U16 l = swf_GetU16(t);
92 swf_GetBlock(t,NULL,l);
96 if (--anz_action) swf_SetButtonOffset(t,offsetpos);
99 swf_SetTagPos(t,oldTagPos);