///////////////////////////////////////////////////////////// // Flash Plugin and Player // Copyright (C) 1998,1999 Olivier Debon // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // Author : Olivier Debon // #include "swf.h" #define NOTHING 0x0 #define WAKEUP 0x1 #define GOTO 0x2 #define REFRESH 0x4 #ifdef RCSID static char *rcsid = "$Id: program.cc,v 1.1 2003/09/08 19:41:59 jasonk Exp $"; #endif #define PRINT 0 int debug = 0; Program::Program(FlashMovie *movie, long n) { long f; this->movie = movie; totalFrames = 0; dl = new DisplayList(movie); if (dl == NULL) return; frames = new Frame[n]; if (frames == NULL) { delete dl; return; } nbFrames = 0; totalFrames = n; currentFrame = 0; loadingFrame = 0; movieWait = 1; nextFrame = currentFrame; for(f = 0; f < n; f++) { frames[f].controls = 0; frames[f].label = NULL; } movieStatus = MoviePlay; settings = 0; } Program::~Program() { int i; Control *ctrl, *ctrl1; delete dl; if (frames != NULL) { for(i=0;i ctrl = frames[i].controls; if (frames[i].label) free(frames[i].label); while (ctrl != NULL) { ctrl1 = ctrl->next; ctrl->next = NULL; delete ctrl; ctrl = ctrl1; } } delete[] frames; } } void Program::validateLoadingFrame() { nbFrames = loadingFrame; loadingFrame++; movieWait = 0; } Frame * Program::getFrames() { return frames; } long Program::getNbFrames() { return nbFrames; } DisplayList * Program::getDisplayList() { return dl; } long Program::getCurrentFrame() { return currentFrame; } void Program::setCurrentFrame(long n) { currentFrame = n; nextFrame = n; //refresh = 1; } void Program::gotoFrame(GraphicDevice *gd, long frame) { long f; //printf("GotoFrame %d (Current = %d)\n", frame, currentFrame); dl->clearList(); for(f=0; f runFrame(gd, 0, f, 0); } } long Program::runFrame(GraphicDevice *gd, SoundMixer *sm, long f, long action) { Control *ctrl; Character *character; Matrix *matrix; Cxform *cxform; long status = NOTHING; long update = 0; char *name; #if PRINT&1 if (action) printf("Prog %x (dl=%x): Frame N