00001 #ifndef _SWF_H_
00002 #define _SWF_H_
00003
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include <string.h>
00007 #include <setjmp.h>
00008 #include <assert.h>
00009 #include <limits.h>
00010
00011 #ifdef DUMP
00012 #include "bitstream.h"
00013 #endif
00014
00015 #include "flash.h"
00016
00017 extern int debug;
00018
00019
00020 typedef unsigned long U32, *P_U32, **PP_U32;
00021 typedef signed long S32, *P_S32, **PP_S32;
00022 typedef unsigned short U16, *P_U16, **PP_U16;
00023 typedef signed short S16, *P_S16, **PP_S16;
00024 typedef unsigned char U8, *P_U8, **PP_U8;
00025 typedef signed char S8, *P_S8, **PP_S8;
00026 typedef signed long SFIXED, *P_SFIXED;
00027 typedef signed long SCOORD, *P_SCOORD;
00028 typedef unsigned long BOOL;
00029
00030 #define ZOOM(v,f) ((v)/(f))
00031
00032 #include "matrix.h"
00033 #include "cxform.h"
00034 #include "rect.h"
00035
00036 #include <sys/time.h>
00037 #define ST struct timeval t1,t2;
00038 #define START gettimeofday(&t1,0)
00039 #define STOP(msg) gettimeofday(&t2,0); printf("%s Delta = %d ms\n", msg, (t2.tv_sec-t1.tv_sec)*1000+(t2.tv_usec-t1.tv_usec)/1000); fflush(stdout);
00040
00041
00042 enum {
00043 soundHasInPoint = 0x01,
00044 soundHasOutPoint = 0x02,
00045 soundHasLoops = 0x04,
00046 soundHasEnvelope = 0x08
00047
00048
00049 };
00050
00051
00052 enum SounfFlags {
00053 soundIsStereo = 0x01,
00054 soundIs16bit = 0x02,
00055 soundIsADPCMCompressed = 0x10
00056 };
00057
00058
00059 enum ButtonState {
00060 stateHitTest = 0x08,
00061 stateDown = 0x04,
00062 stateOver = 0x02,
00063 stateUp = 0x01
00064 };
00065
00066
00067 enum Action {
00068
00069 ActionRefresh = 0x00,
00070 ActionPlaySound = 0x01,
00071
00072 ActionGotoFrame = 0x81,
00073 ActionGetURL = 0x83,
00074 ActionNextFrame = 0x04,
00075 ActionPrevFrame = 0x05,
00076 ActionPlay = 0x06,
00077 ActionStop = 0x07,
00078 ActionToggleQuality = 0x08,
00079 ActionStopSounds = 0x09,
00080 ActionWaitForFrame = 0x8a,
00081 ActionSetTarget = 0x8b,
00082 ActionGoToLabel = 0x8c
00083 };
00084
00085 class Sound;
00086
00087 struct ActionRecord {
00088 Action action;
00089
00090
00091 long frameIndex;
00092
00093
00094 char *url;
00095 char *target;
00096
00097
00098 char *frameLabel;
00099
00100
00101 long skipCount;
00102
00103
00104 Sound *sound;
00105
00106 struct ActionRecord *next;
00107
00108 ActionRecord() {
00109 frameLabel = 0;
00110 url = 0;
00111 target = 0;
00112 sound = 0;
00113 };
00114
00115 ~ActionRecord() {
00116 if (frameLabel) free(frameLabel);
00117 if (url) free(url);
00118 if (target) free(target);
00119 };
00120 };
00121
00122 enum FontFlags {
00123 fontUnicode = 0x20,
00124 fontShiftJIS = 0x10,
00125 fontANSI = 0x08,
00126 fontItalic = 0x04,
00127 fontBold = 0x02,
00128 fontWideCodes = 0x01
00129 };
00130
00131 enum TextFlags {
00132 isTextControl = 0x80,
00133
00134 textIsLarge = 0x70,
00135 textHasFont = 0x08,
00136 textHasColor = 0x04,
00137 textHasYOffset= 0x02,
00138 textHasXOffset= 0x01
00139 };
00140
00141 #ifndef NULL
00142 #define NULL 0
00143 #endif
00144
00145
00146 enum
00147 {
00148 stagEnd = 0,
00149 stagShowFrame = 1,
00150 stagDefineShape = 2,
00151 stagFreeCharacter = 3,
00152 stagPlaceObject = 4,
00153 stagRemoveObject = 5,
00154 stagDefineBits = 6,
00155 stagDefineButton = 7,
00156 stagJPEGTables = 8,
00157 stagSetBackgroundColor = 9,
00158 stagDefineFont = 10,
00159 stagDefineText = 11,
00160 stagDoAction = 12,
00161 stagDefineFontInfo = 13,
00162 stagDefineSound = 14,
00163 stagStartSound = 15,
00164 stagStopSound = 16,
00165 stagDefineButtonSound = 17,
00166 stagSoundStreamHead = 18,
00167 stagSoundStreamBlock = 19,
00168 stagDefineBitsLossless = 20,
00169 stagDefineBitsJPEG2 = 21,
00170 stagDefineShape2 = 22,
00171 stagDefineButtonCxform = 23,
00172 stagProtect = 24,
00173
00174
00175 stagPlaceObject2 = 26,
00176 stagRemoveObject2 = 28,
00177 stagDefineShape3 = 32,
00178 stagDefineText2 = 33,
00179 stagDefineButton2 = 34,
00180 stagDefineBitsJPEG3 = 35,
00181 stagDefineBitsLossless2 = 36,
00182 stagDefineSprite = 39,
00183 stagNameCharacter = 40,
00184 stagFrameLabel = 43,
00185 stagSoundStreamHead2 = 45,
00186 stagDefineMorphShape = 46,
00187 stagDefineFont2 = 48,
00188
00189 notEnoughData = 0xffff,
00190 };
00191
00192 #ifndef false
00193 #define false 0
00194 #endif
00195 #ifndef true
00196 #define true 1
00197 #endif
00198
00199 extern int shape_size,shape_nb,shaperecord_size,shaperecord_nb,style_size,style_nb;
00200
00201 typedef void (*ScanLineFunc)(void *id, long y, long start, long end);
00202
00203 class Bitmap;
00204 struct FlashMovie;
00205
00206 extern "C" {
00207 #include "jpeglib.h"
00208 };
00209 extern "C" {
00210
00211 #include "../src/3rdparty/zlib/zlib.h"
00212 };
00213
00214 #include "graphic.h"
00215 #include "character.h"
00216 #include "bitmap.h"
00217 #include "shape.h"
00218 #include "displaylist.h"
00219 #include "sound.h"
00220 #include "button.h"
00221 #include "font.h"
00222 #include "text.h"
00223 #include "adpcm.h"
00224 #include "program.h"
00225 #include "sprite.h"
00226 #include "script.h"
00227 #include "movie.h"
00228
00229 #endif