scriptplayer.h

00001 /*--License:
00002         Lilith 3D Engine
00003         Copyright Lee Thomason (Grinning Lizard Software) 2002-2004
00004         www.grinninglizard.com/lilith
00005 
00006         This program is free software; you can redistribute it and/or
00007         modify it under the terms of the GNU General Public License
00008         as published by the Free Software Foundation; either version 2
00009         of the License, or (at your option) any later version.
00010 
00011         This program is distributed in the hope that it will be useful,
00012         but WITHOUT ANY WARRANTY; without even the implied warranty of
00013         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014         GNU General Public License for more details.
00015 
00016         You should have received a copy of the GNU General Public License
00017         along with this program; if not, write to the Free Software
00018         Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020         The full text of the license can be found in license.txt
00021 */
00022 
00023 #ifndef L3_SCRIPTPLAYER_INCLUDED
00024 #define L3_SCRIPTPLAYER_INCLUDED
00025 
00026 #include "lilith3d.h"
00027 #include "terrainmorph.h"
00028 
00029 namespace lilith3d
00030 {
00031 class BuildingMesh;
00032 class WalkingMob;
00033 
00059 class Script : public   CameraListener,
00060                                                 VolcanoMorphListener,
00061                                                 PitMorphListener,
00062                                                 BridgeMorphListener,
00063                                                 FlattenMorphListener
00064 {
00065   public:
00066         Script( Lilith3D* );
00067         virtual ~Script();
00068 
00070         void Run( const char* fname, const char* act, bool record );
00071         
00072         virtual void CameraEvent( Camera* camera )
00073         {
00074                 if ( waiting == WAIT_CAMERA )
00075                         if ( record )
00076                                 waiting = WAIT_RECORD;
00077                         else
00078                                 waiting = WAIT_NONE;
00079                 
00080                 //camera->SetCameraListener( 0 );
00081                 camera->publish.RemoveListener( this );
00082         }
00083 
00084         virtual void VolcanoGrow( VolcanoMorph* volcano, int x, int y, float newAltitude )      {}
00085         virtual void VolcanoDone( VolcanoMorph* volcano, int x, int y, float finalAltitude )    {
00086                 if ( waiting == WAIT_VOLCANO )
00087                         waiting = WAIT_NONE;
00088         }
00089 
00090         virtual void PitSink( PitMorph* pit, int x, int y, float newAltitude )                          {}
00091         virtual void PitDone( PitMorph* pit, int x, int y, float finalAltitude ) 
00092         {
00093                 if ( waiting == WAIT_PIT )
00094                         waiting = WAIT_NONE;
00095         }
00096 
00097         virtual void BridgeDone( BridgeMorph* bridge ) 
00098         {
00099                 if ( waiting == WAIT_BRIDGE )
00100                         waiting = WAIT_NONE;
00101         }
00102         virtual void FlattenDone( FlattenMorph* flatten ) {
00103                 if ( waiting == WAIT_FLATTEN )
00104                         waiting = WAIT_NONE;
00105         }
00106 
00107   private:
00108         Lilith3D* lilith;
00109 
00110         enum
00111         {
00112                 WAIT_NONE,
00113                 WAIT_TIME,
00114                 WAIT_CAMERA,
00115                 WAIT_VOLCANO,
00116                 WAIT_PIT,
00117                 WAIT_BRIDGE,
00118                 WAIT_FLATTEN,
00119                 WAIT_RECORD,
00120         };
00121         int  waiting;
00122         bool record;
00123         
00124         std::map< std::string, lilith3d::BuildingMesh* > buildingMap;
00125         std::map< std::string, lilith3d::WalkingMob* >   walkingMap;
00126 };
00127 };      //namespace lilith3d
00128 
00129 #endif
00130 

Generated on Fri Mar 23 19:36:22 2007 for Lilith3D by  doxygen 1.5.1-p1