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 #include "../rfxswf.h"
26 int swf_ButtonSetRecord(TAG * t,U8 state,U16 id,U16 layer,MATRIX * m,CXFORM * cx)
32 if (swf_GetTagID(t)==ST_DEFINEBUTTON2) swf_SetCXForm(t,cx,1);
36 int swf_ButtonSetCondition(TAG * t,U16 condition)
37 { swf_SetU16(t,0); // dummy for Action Offset -> later set by ButtonPostProcess
38 swf_SetU16(t,condition);
42 int swf_ButtonSetFlags(TAG * t,U8 flags)
43 { if (swf_GetTagID(t)==ST_DEFINEBUTTON2)
45 swf_SetU16(t,0); // dummy for Action Offset -> later set by ButtonPostProcess
50 void swf_SetButtonOffset(TAG * t,U32 offsetpos)
51 { U32 now = swf_GetTagPos(t);
52 U16 diff = now-offsetpos;
53 swf_SetTagPos(t,offsetpos);
54 t->data[t->pos++] = (U8)(diff&0xff);
55 t->data[t->pos++] = (U8)(diff>>8);
59 int swf_ButtonPostProcess(TAG * t,int anz_action)
60 { if (swf_GetTagID(t)==ST_DEFINEBUTTON2)
64 oldTagPos = swf_GetTagPos(t);
66 // scan DefineButton2 Record
68 swf_GetU16(t); // Character ID
69 swf_GetU8(t); // Flags;
71 offsetpos = swf_GetTagPos(t); // first offset
74 while (swf_GetU8(t)) // state -> parse ButtonRecord
75 { swf_GetU16(t); // id
76 swf_GetU16(t); // layer
77 swf_GetMatrix(t,NULL); // matrix
78 swf_GetCXForm(t,NULL,1);// CXForm
81 swf_SetButtonOffset(t,offsetpos);
86 offsetpos = swf_GetTagPos(t); // offset
89 swf_GetU16(t); // condition
91 while ((a=swf_GetU8(t))) // skip action records
93 { U16 l = swf_GetU16(t);
94 swf_GetBlock(t,NULL,l);
98 if (--anz_action) swf_SetButtonOffset(t,offsetpos);
101 swf_SetTagPos(t,oldTagPos);