Back to index

supertuxkart  0.5+dfsg1
projectile_manager.hpp
Go to the documentation of this file.
00001 //  $Id: projectile_manager.hpp 2111 2008-05-31 07:04:30Z cosmosninja $
00002 //
00003 //  SuperTuxKart - a fun racing game with go-kart
00004 //  Copyright (C) 2006 Joerg Henrichs
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 #ifndef HEADER_PROJECTILEMANAGER_H
00021 #define HEADER_PROJECTILEMANAGER_H
00022 
00023 #include <vector>
00024 #include <plib/ssg.h>
00025 #include "flyable.hpp"
00026 #include "collectable_manager.hpp"
00027 
00028 class Kart;
00029 class Explosion;
00030 
00031 class ProjectileManager
00032 {
00033 private:
00034     typedef std::vector<Flyable*> Projectiles;
00035     typedef std::vector<Explosion* > Explosions;
00036 
00037     // The list of all active projectiles, i.e. projectiles
00038     // which are currently moving on the track
00039     Projectiles      m_active_projectiles;
00040 
00041     // All active explosions, i.e. explosions which are currently
00042     // being shown
00043     Explosions       m_active_explosions;
00044 
00045     ssgSelector*     m_explosion_model;
00046     bool             m_something_was_hit;
00047     bool             m_explosion_ended;
00048 
00049 public:
00050     ProjectileManager() {m_something_was_hit=false;};
00051     ~ProjectileManager() {};
00052     void             explode          () {m_something_was_hit=true;}
00053     void             FinishedExplosion() {m_explosion_ended =true;}
00054     ssgSelector*     getExplosionModel()
00055     {
00056         return (ssgSelector*)m_explosion_model->clone();
00057     }
00058     int              getProjectileId  (const std::string ident);
00059     void             loadData         ();
00060     void             cleanup          ();
00061     void             update           (float dt);
00062     Flyable*         newProjectile    (Kart *kart, CollectableType type);
00063     Explosion*       newExplosion     (sgCoord *coord);
00064     void             Deactivate       (Flyable *p) {}
00065     void             removeTextures   ();
00066 };
00067 
00068 extern ProjectileManager *projectile_manager;
00069 
00070 #endif
00071 
00072 /* EOF */