00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020 #ifndef _PROGRAM_H_
00021 #define _PROGRAM_H_
00022
00023 enum ControlType {
00024 ctrlPlaceObject,
00025 ctrlPlaceObject2,
00026 ctrlRemoveObject,
00027 ctrlRemoveObject2,
00028 ctrlDoAction,
00029 ctrlStartSound,
00030 ctrlStopSound,
00031 ctrlBackgroundColor
00032 };
00033
00034 enum PlaceFlags {
00035 placeIsMove = 0x01,
00036 placeHasCharacter = 0x02,
00037 placeHasMatrix = 0x04,
00038 placeHasColorXform = 0x08,
00039 placeHasRatio = 0x10,
00040 placeHasName = 0x20,
00041 placeHasClip = 0x40
00042 };
00043
00044 struct Control {
00045 ControlType type;
00046
00047
00048 Character *character;
00049 long depth;
00050
00051
00052 PlaceFlags flags;
00053 Matrix matrix;
00054 Cxform cxform;
00055 long ratio;
00056 long clipDepth;
00057 char *name;
00058
00059
00060 Color color;
00061
00062
00063 ActionRecord *actionRecords;
00064
00065 struct Control *next;
00066
00067
00068
00069
00070 void addActionRecord( ActionRecord *ar)
00071 {
00072 ar->next = 0;
00073
00074 if (actionRecords == 0) {
00075 actionRecords = ar;
00076 } else {
00077 ActionRecord *current;
00078
00079 for(current = actionRecords; current->next; current = current->next);
00080
00081 current->next = ar;
00082 }
00083 };
00084
00085 Control()
00086 {
00087 actionRecords = 0;
00088 cxform.aa = 1.0; cxform.ab = 0;
00089 cxform.ra = 1.0; cxform.rb = 0;
00090 cxform.ga = 1.0; cxform.gb = 0;
00091 cxform.ba = 1.0; cxform.bb = 0;
00092 ratio = 0;
00093 clipDepth = 0;
00094 name = 0;
00095 };
00096
00097 ~Control()
00098 {
00099 ActionRecord *ar,*del;
00100 for(ar = actionRecords; ar;)
00101 {
00102 del = ar;
00103 ar = ar->next;
00104 delete del;
00105 }
00106 if (name) {
00107 free(name);
00108 }
00109 };
00110 };
00111
00112 struct Frame {
00113 char *label;
00114 Control *controls;
00115 };
00116
00117 enum MovieStatus {
00118 MoviePaused,
00119 MoviePlay
00120 };
00121
00122 struct FlashMovie;
00123
00124 struct Program {
00125 DisplayList *dl;
00126
00127 Frame *frames;
00128 long nbFrames;
00129 long currentFrame;
00130 long loadingFrame;
00131 long totalFrames;
00132 long nextFrame;
00133 int movieWait;
00134 MovieStatus movieStatus;
00135 Sound *currentSound;
00136 long settings;
00137 FlashMovie *movie;
00138 long render;
00139
00140 Program(FlashMovie *movie,long n);
00141 ~Program();
00142
00143 void rewindMovie();
00144 void pauseMovie();
00145 void continueMovie();
00146 void nextStepMovie();
00147 void gotoFrame(GraphicDevice *gd, long f);
00148
00149 long processMovie(GraphicDevice *, SoundMixer *);
00150 long nestedMovie(GraphicDevice *, SoundMixer *, Matrix *, Cxform *);
00151 long runFrame(GraphicDevice *, SoundMixer *, long f, long action=1);
00152 long handleEvent(GraphicDevice *, SoundMixer *, FlashEvent *);
00153 long doAction(GraphicDevice *gd, ActionRecord *action, SoundMixer *);
00154 void setCurrentFrameLabel(char *label);
00155 void advanceFrame();
00156 void addControlInCurrentFrame(Control *ctrl);
00157 void setGetUrlMethod( void (*)(char *, char *, void *), void *);
00158 void modifySettings(long flags);
00159 long searchFrame(GraphicDevice *gd, char *, char *);
00160 void validateLoadingFrame();
00161 long getCurrentFrame();
00162 void setCurrentFrame(long);
00163
00164 Frame *getFrames();
00165 long getNbFrames();
00166
00167 DisplayList *getDisplayList();
00168
00169 #ifdef DUMP
00170 void dump(BitStream *bs);
00171 static void dumpActions(BitStream *bs, ActionRecord *actions);
00172 #endif
00173 };
00174
00175 DisplayListEntry *findFocus(DisplayList *dl);
00176 void setFlashTimer(struct timeval *tv, int time_ms);
00177 int checkFlashTimer(struct timeval *tv);
00178
00179 void loadNewSwf(FlashMovie *movie, char *url, int level);
00180
00181 void computeBBox(FlashMovie *movie, Rect *rect, DisplayListEntry *e);
00182
00183 long processMovie(FlashMovie *movie);
00184
00185 #endif