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 ButtonSetRecord(TAG * t,U8 state,U16 id,U16 layer,MATRIX * m,CXFORM * cx)
24 int ButtonSetCondition(TAG * t,U16 condition)
25 { SetU16(t,0); // dummy for Action Offset -> later set by ButtonPostProcess
30 int ButtonSetFlags(TAG * t,U8 flags)
31 { if (GetTagID(t)==ST_DEFINEBUTTON2)
33 SetU16(t,0); // dummy for Action Offset -> later set by ButtonPostProcess
38 void SetButtonOffset(TAG * t,U32 offsetpos)
39 { U32 now = GetTagPos(t);
40 U16 diff = now-offsetpos;
41 SetTagPos(t,offsetpos);
42 t->data[t->pos++] = (U8)(diff&0xff);
43 t->data[t->pos++] = (U8)(diff>>8);
47 int ButtonPostProcess(TAG * t,int anz_action)
48 { if (GetTagID(t)==ST_DEFINEBUTTON2)
52 oldTagPos = GetTagPos(t);
54 // scan DefineButton2 Record
56 GetU16(t); // Character ID
59 offsetpos = GetTagPos(t); // first offset
62 while (GetU8(t)) // state -> parse ButtonRecord
65 GetMatrix(t,NULL); // matrix
69 SetButtonOffset(t,offsetpos);
74 offsetpos = GetTagPos(t); // offset
77 GetU16(t); // condition
79 while (a=GetU8(t)) // skip action records
86 if (--anz_action) SetButtonOffset(t,offsetpos);
89 SetTagPos(t,oldTagPos);