}
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;
+ }
+}
+
#define ST_FILEATTRIBUTES 69 /* version 8 (required)- */
#define ST_PLACEOBJECT3 70 /* version 8 */
#define ST_IMPORTASSETS2 71 /* version 8 */
+#define ST_RAWABC 72 /* version 9, used by flex */
#define ST_DEFINEFONTALIGNZONES 73 /* version 8 */
#define ST_CSMTEXTSETTINGS 74 /* version 8 */
#define ST_DEFINEFONT3 75 /* version 8 */
char* swf_TagGetName(TAG*tag);
void swf_DumpFont(SWFFONT * font);
-// swfbutton.c
-
-// Button States
-
-#define BS_HIT 0x08
-#define BS_DOWN 0x04
-#define BS_OVER 0x02
-#define BS_UP 0x01
-
-// Button Conditions
-
-/* missing: IDLE_OUTDOWN
- OUTDOWN_OVERUP
- OVERUP_OUTDOWN
-*/
-#define BC_OVERDOWN_IDLE 0x0100
-#define BC_IDLE_OVERDOWN 0x0080
-#define BC_OUTDOWN_IDLE 0x0040
-#define BC_OUTDOWN_OVERDOWN 0x0020
-#define BC_OVERDOWN_OUTDOWN 0x0010
-#define BC_OVERDOWN_OVERUP 0x0008
-#define BC_OVERUP_OVERDOWN 0x0004
-#define BC_OVERUP_IDLE 0x0002
-#define BC_IDLE_OVERUP 0x0001
-
-#define BC_KEY(c) (c<<9)
-
-#define BC_CURSORLEFT 0x0200
-#define BC_CURSORRIGHT 0x0400
-#define BC_POS1 0x0600
-#define BC_END 0x0800
-#define BC_INSERT 0x0a00
-#define BC_DELETE 0x0c00
-#define BC_CLEAR 0x0e00
-#define BC_BACKSPACE 0x1000
-#define BC_ENTER 0x1a00
-#define BC_CURSORUP 0x1c00
-#define BC_CURSORDOWN 0x1e00
-#define BC_PAGEUP 0x2000
-#define BC_PAGEDOWN 0x2200
-#define BC_TAB 0x2400
-#define BC_ESCAPE 0x3600
-#define BC_SPACE 0x4000
-
-/* these are probably only valid with linux:
- Ctrl-A 0x0200
- Ctrl-X 0x3000
- Ctrl-Y 0x3200
- Ctrl-Z 0x3400
- Escape/Ctrl-[ 0x3600
- Ctrl-\ 0x3800
- Ctrl-] 0x3a00
- Ctrl-^ 0x3c00
- Ctrl-/ 0x3e00
- */
-
-/* everything above 0x4000 is standard ascii:
- 0x4000 ' ' 0x4200 '!' 0x4600 '#' 0x4800 '$' 0x4a00 '%' 0x4c00 '&' ...
- 0x6000 '0' ... 0x7200 '9'
- 0x8000 '@'
- 0x8200 'A' ... 0xb400 'Z'
- ...
- 0xfc00 '~'
- */
-
-// Button Flag
-
-#define BF_TRACKMENU 0x01
-
-int swf_ButtonSetRecord(TAG * t,U8 state,U16 id,U16 layer,MATRIX * m,CXFORM * cx);
-int swf_ButtonSetCondition(TAG * t,U16 condition); // for DefineButton2
-int swf_ButtonSetFlags(TAG * t,U8 flags); // necessary for DefineButton2
-int swf_ButtonPostProcess(TAG * t,int anz_action); // Set all offsets in DefineButton2-Tags (how many conditions to process)
-
// swfbits.c
int swf_ImageHasAlpha(RGBA*img, int width, int height);
void swf_WriteABC(TAG*tag, void*code);
void swf_AddButtonLinks(SWF*swf, char stop_each_frame);
-// swfscripts.c
-
-void AVM2_InsertStops(SWF*swf);
-
// swfaction.c
typedef struct _ActionTAG
// using action/actioncompiler.h:
ActionTAG* swf_ActionCompile(const char* source, int version);
+#define ACTION__GOTOFRAME 0x81
+#define ACTION__GETURL 0x83
ActionTAG* action_End(ActionTAG*atag);
ActionTAG* action_NextFrame(ActionTAG*atag);
ActionTAG* action_PreviousFrame(ActionTAG*atag);
void swf_SetVideoStreamMover(TAG*tag, VIDEOSTREAM*s, signed char* movex, signed char* movey, void** image, int quant);
void swf_VideoStreamClear(VIDEOSTREAM*stream);
+// swfbutton.c
+
+// Button States
+
+#define BS_HIT 0x08
+#define BS_DOWN 0x04
+#define BS_OVER 0x02
+#define BS_UP 0x01
+
+// Button Conditions
+
+/* missing: IDLE_OUTDOWN
+ OUTDOWN_OVERUP
+ OVERUP_OUTDOWN
+*/
+#define BC_OVERDOWN_IDLE 0x0100
+#define BC_IDLE_OVERDOWN 0x0080
+#define BC_OUTDOWN_IDLE 0x0040
+#define BC_OUTDOWN_OVERDOWN 0x0020
+#define BC_OVERDOWN_OUTDOWN 0x0010
+#define BC_OVERDOWN_OVERUP 0x0008
+#define BC_OVERUP_OVERDOWN 0x0004
+#define BC_OVERUP_IDLE 0x0002
+#define BC_IDLE_OVERUP 0x0001
+
+#define BC_KEY(c) (c<<9)
+
+#define BC_CURSORLEFT 0x0200
+#define BC_CURSORRIGHT 0x0400
+#define BC_POS1 0x0600
+#define BC_END 0x0800
+#define BC_INSERT 0x0a00
+#define BC_DELETE 0x0c00
+#define BC_CLEAR 0x0e00
+#define BC_BACKSPACE 0x1000
+#define BC_ENTER 0x1a00
+#define BC_CURSORUP 0x1c00
+#define BC_CURSORDOWN 0x1e00
+#define BC_PAGEUP 0x2000
+#define BC_PAGEDOWN 0x2200
+#define BC_TAB 0x2400
+#define BC_ESCAPE 0x3600
+#define BC_SPACE 0x4000
+
+/* these are probably only valid with linux:
+ Ctrl-A 0x0200
+ Ctrl-X 0x3000
+ Ctrl-Y 0x3200
+ Ctrl-Z 0x3400
+ Escape/Ctrl-[ 0x3600
+ Ctrl-\ 0x3800
+ Ctrl-] 0x3a00
+ Ctrl-^ 0x3c00
+ Ctrl-/ 0x3e00
+ */
+
+/* everything above 0x4000 is standard ascii:
+ 0x4000 ' ' 0x4200 '!' 0x4600 '#' 0x4800 '$' 0x4a00 '%' 0x4c00 '&' ...
+ 0x6000 '0' ... 0x7200 '9'
+ 0x8000 '@'
+ 0x8200 'A' ... 0xb400 'Z'
+ ...
+ 0xfc00 '~'
+ */
+
+// Button Flag
+
+#define BF_TRACKMENU 0x01
+
+int swf_ButtonSetRecord(TAG * t,U8 state,U16 id,U16 layer,MATRIX * m,CXFORM * cx);
+int swf_ButtonSetCondition(TAG * t,U16 condition); // for DefineButton2
+int swf_ButtonSetFlags(TAG * t,U8 flags); // necessary for DefineButton2
+int swf_ButtonPostProcess(TAG * t,int anz_action); // Set all offsets in DefineButton2-Tags (how many conditions to process)
+ActionTAG* swf_ButtonGetAction(TAG*t);
+
// swfrender.c
typedef struct RENDERBUF