00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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 };
00128
00129 #endif
00130