Index: trunk/src/defs/class_id.h
===================================================================
--- trunk/src/defs/class_id.h	(revision 6589)
+++ trunk/src/defs/class_id.h	(revision 6600)
@@ -154,4 +154,5 @@
   CL_MULTI_PLAYER_WORLD         =    0x00000107,
   CL_MULTI_PLAYER_WORLD_DATA    =    0x00000108,
+  CL_MOVIE_LOADER               =    0x00000109,
 
   // WorldEntities (range from 0x00000200 to 0x000004ff)
Index: trunk/src/lib/graphics/importer/movie_player.cc
===================================================================
--- trunk/src/lib/graphics/importer/movie_player.cc	(revision 6589)
+++ trunk/src/lib/graphics/importer/movie_player.cc	(revision 6600)
@@ -49,6 +49,6 @@
 MoviePlayer::~MoviePlayer()
 {
-  delete material;
-  delete model;
+  //delete material;
+  //delete model;
 
   if (glIsTexture(texture))
@@ -81,5 +81,5 @@
   loading = false;
 
-  material = new Material;
+  /*material = new Material;
   material->setDiffuseMap("maps/radialTransparency.png");
 
@@ -90,4 +90,5 @@
   (new Light())->setAbsCoor(5.0, 10.0, 40.0);
   (new Light())->setAbsCoor(-10, -20, -100);
+  */
 }
 
@@ -195,5 +196,5 @@
       // Free the packet that was allocated by av_read_frame
       av_free_packet(&packet);
-      
+
       // Did we get a video frame?
       if(frame_finished)
@@ -248,5 +249,5 @@
 void MoviePlayer::skipFrame(int frames)
 {
-  
+
   while(frames != 0)
   {
@@ -259,5 +260,5 @@
       avcodec_decode_video(codec_context, frame, &frame_finished,
                             packet.data, packet.size);
-        
+
       // Did we get a video frame?
       if(frame_finished)
@@ -269,5 +270,5 @@
     av_free_packet(&packet);
   }
-  
+
   this->getNextFrame();
 
@@ -307,5 +308,5 @@
       return false;
     }
-    
+
     // go from the keyframe to the exact position
     codec_context->hurry_up = 1;
@@ -327,8 +328,8 @@
     } while(1);
     codec_context->hurry_up = 0;
-  
+
     this->frame_number = frames;
   }
-  
+
   return true;
 }
@@ -343,7 +344,7 @@
     status = PLAY;
     timer = 0;
-  
+
     this->gotoFrame(start_frame);
-  
+
     PRINTF(0)("start\n");
   }
@@ -380,5 +381,5 @@
   {
     timer += dt;
-    actual_frame = timer * fps + start_frame;
+    actual_frame = (int)(timer * fps + start_frame);
     if(actual_frame != frame_number)
     {
@@ -387,10 +388,10 @@
       else
         this->skipFrame(actual_frame - frame_number - 1);
-    }   
+    }
     //PRINTF(0)("frame_number: %i\n", frame_number);
   }
 }
 
-const void MoviePlayer::draw()
+/*const void MoviePlayer::draw()
 {
   material->select();
@@ -399,4 +400,9 @@
 
   LightManager::getInstance()->draw();
+}*/
+
+GLuint MoviePlayer::getTexture()
+{
+  return this->texture;
 }
 
Index: trunk/src/lib/graphics/importer/movie_player.h
===================================================================
--- trunk/src/lib/graphics/importer/movie_player.h	(revision 6589)
+++ trunk/src/lib/graphics/importer/movie_player.h	(revision 6600)
@@ -18,8 +18,8 @@
 #include "glincl.h"
 
-#include "light.h"
+//#include "light.h"
 #include "texture.h"
-#include "material.h"
-#include "primitive_model.h"
+//#include "material.h"
+//#include "primitive_model.h"
 
 // include base_object.h since all classes are derived from this one
@@ -29,6 +29,6 @@
 typedef enum MP_STATUS {
   PLAY,
-	PAUSE,
-	STOP
+        PAUSE,
+        STOP
 };
 
@@ -38,6 +38,6 @@
 private:
 
-  Model* model;
-  Material* material;
+  //Model* model;
+  //Material* material;
 
   AVFormatContext* format_context;
@@ -54,5 +54,5 @@
   int video_stream;
 
-  MP_STATUS status;	
+  MP_STATUS status;
   float timer;
   int start_frame;
@@ -61,5 +61,5 @@
   float fps;
   int duration;
-  bool loading;  
+  bool loading;
 
 public:
@@ -71,19 +71,20 @@
   bool loadMovie(const char* filename);
 
-	void start(float start_time);
-	void resume();
-	void pause();
-	void stop();
+        void start(float start_time);
+        void resume();
+        void pause();
+        void stop();
 
-	void tick(float dt);
-	const void draw();
+        void tick(float dt);
+        //const void draw();
+        GLuint getTexture();
 
-	void setFPS(float fps);
-	float getFPS();
-	const MP_STATUS getStatus();
+        void setFPS(float fps);
+        float getFPS();
+        const MP_STATUS getStatus();
   void printInformation();
 
 private:
-  
+
   void init();
   void getNextFrame();
Index: trunk/src/story_entities/Makefile.am
===================================================================
--- trunk/src/story_entities/Makefile.am	(revision 6589)
+++ trunk/src/story_entities/Makefile.am	(revision 6600)
@@ -11,5 +11,6 @@
 		story_entities/single_player_world_data.cc \
 		story_entities/multi_player_world.cc \
-		story_entities/multi_player_world_data.cc
+		story_entities/multi_player_world_data.cc \
+		story_entities/movie_loader.cc
 
 StoryEntities_HEADERS_ = \
@@ -23,3 +24,4 @@
 		story_entities/single_player_world_data.h \
 		story_entities/multi_player_world.h \
-		story_entities/multi_player_world_data.h
+		story_entities/multi_player_world_data.h \
+		story_entities/movie_loader.h
Index: trunk/src/story_entities/movie_loader.cc
===================================================================
--- trunk/src/story_entities/movie_loader.cc	(revision 6600)
+++ trunk/src/story_entities/movie_loader.cc	(revision 6600)
@@ -0,0 +1,151 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   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, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: David Hasenfratz, Stefan Lienhard
+   co-programmer:
+*/
+
+#include "movie_loader.h"
+
+#include "movie_player.h"
+#include "factory.h"
+#include "graphics_engine.h"
+#include "load_param.h"
+#include "resource_manager.h"
+
+
+using namespace std;
+
+CREATE_FACTORY(MovieLoader, CL_MOVIE_LOADER);
+
+MovieLoader::MovieLoader(const TiXmlElement* root)
+{
+  this->setClassID(CL_MOVIE_LOADER, "MovieLoader");
+
+  movie_player = new MoviePlayer();
+  this->loadParams(root);
+}
+
+MovieLoader::~MovieLoader()
+{
+  PRINTF(4)("Deleted MoviePlayer\n");
+}
+
+
+
+void MovieLoader::loadParams(const TiXmlElement* root)
+{
+  StoryEntity::loadParams(root);
+
+  LoadParam(root, "name", this, MovieLoader, loadMovie);
+}
+
+void MovieLoader::loadMovie(const char* filename)
+{
+  movie_player->loadMovie(filename);
+
+  PRINTF(0)("\nloaded Movie %s\n\n", filename);
+}
+
+
+ErrorMessage MovieLoader::init()
+{
+
+}
+
+
+ErrorMessage MovieLoader::loadData()
+{
+
+}
+
+
+ErrorMessage MovieLoader::unloadData()
+{
+
+}
+
+bool MovieLoader::start()
+{
+  PRINTF(0)("\nMovieLoader INFO:\n");
+  movie_player->printInformation();
+  PRINTF(0)("\n");
+
+  this->isRunning = true;
+
+  this->run();
+}
+
+bool MovieLoader::stop()
+{
+  this->isRunning = false;
+}
+
+bool MovieLoader::pause() { }
+bool MovieLoader::resume() { }
+
+void MovieLoader::run()
+{
+  // first timestamp for t = 0
+  this->lastFrame = SDL_GetTicks ();
+  this->movie_player->start(0);
+
+  while( this->isRunning)
+  {
+
+    this->tick();
+    this->draw();
+
+  }
+}
+
+void MovieLoader::draw() const
+{
+  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+
+  GraphicsEngine::enter2DMode();
+
+  glEnable(GL_TEXTURE_2D);
+  glBindTexture(GL_TEXTURE_2D, movie_player->getTexture());
+
+  glColor3f(1.0, 1.0, 1.0);
+
+  glBegin(GL_QUADS);
+    glTexCoord2f(1.0f, 0.0f); glVertex2f( 0, 0);
+    glTexCoord2f(1.0f, 1.0f); glVertex2f( 0, 100);
+    glTexCoord2f(0.0f, 1.0f); glVertex2f( 100, 100);
+    glTexCoord2f(0.0f, 0.0f); glVertex2f( 100, 0);
+  glEnd();
+
+  GraphicsEngine::leave2DMode();
+
+  SDL_GL_SwapBuffers();
+}
+
+
+void MovieLoader::tick()
+{
+  // get timestamp
+  currentFrame = SDL_GetTicks();
+
+  // calculate time difference in milliseconds (Uint32)
+  this->dt = currentFrame - this->lastFrame;
+  // calculate time difference in seconds (float)
+  this->dts = (float)this->dt / 1000.0f;
+
+  movie_player->tick(dts);
+
+  if (movie_player->getStatus() == STOP)
+    this->isRunning = false;
+
+  this->lastFrame = currentFrame;
+}
Index: trunk/src/story_entities/movie_loader.h
===================================================================
--- trunk/src/story_entities/movie_loader.h	(revision 6600)
+++ trunk/src/story_entities/movie_loader.h	(revision 6600)
@@ -0,0 +1,48 @@
+/*!
+ * @file movie_loader.h
+ *  loads a movie
+ */
+
+#ifndef _MOVIE_LOADER_H
+#define _MOVIE_LOADER_H
+
+
+#include "story_entity.h"
+
+class MoviePlayer;
+
+class MovieLoader : public StoryEntity
+{
+  private:
+    MoviePlayer* movie_player;
+
+    Uint32              lastFrame;
+    Uint32              currentFrame;
+    Uint32              dt;                           // time needed to calculate this frame (in milliSeconds)
+    float               dts;
+
+  public:
+    MovieLoader(const TiXmlElement* root);
+    virtual ~MovieLoader();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    /* functions from story-entity */
+    virtual ErrorMessage init();
+    virtual ErrorMessage loadData();
+    virtual ErrorMessage unloadData();
+
+    virtual bool start();
+    virtual bool stop();
+    virtual bool pause();
+    virtual bool resume();
+    virtual void run();
+
+  private:
+    void loadMovie(const char* filename);
+    void tick();
+    void draw() const;
+
+};
+
+#endif /* _MOVIE_LOADER_H */
Index: trunk/src/world_entities/movie_entity.cc
===================================================================
--- trunk/src/world_entities/movie_entity.cc	(revision 6589)
+++ trunk/src/world_entities/movie_entity.cc	(revision 6600)
@@ -19,5 +19,4 @@
 #include "load_param.h"
 #include "factory.h"
-#include "material.h"
 
 #include "network_game_manager.h"
@@ -36,7 +35,4 @@
 
   media_container = new MediaContainer();
-
-  this->material = new Material;
-  this->material->setDiffuseMap("maps/radialTransparency.png");
 
   axis = 0;
@@ -59,5 +55,4 @@
 MovieEntity::~MovieEntity ()
 {
-  delete this->material;
   delete this->media_container;
 }
@@ -139,6 +134,8 @@
   glDisable(GL_LIGHTING);
 
-  this->material->select();
+  glEnable(GL_TEXTURE_2D);
   glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter));
+
+  glColor3f(1.0, 1.0, 1.0);
 
   glBegin(GL_QUADS);
Index: trunk/src/world_entities/movie_entity.h
===================================================================
--- trunk/src/world_entities/movie_entity.h	(revision 6589)
+++ trunk/src/world_entities/movie_entity.h	(revision 6600)
@@ -11,5 +11,4 @@
 
 class MediaContainer;
-class Material;
 
 class MovieEntity : public WorldEntity
@@ -17,5 +16,4 @@
   private:
     MediaContainer* media_container;
-    Material* material;
 
     int counter;
