Back to index

supertuxkart  0.5+dfsg1
player_kart.hpp
Go to the documentation of this file.
00001 //  $Id: player_kart.hpp 2111 2008-05-31 07:04:30Z cosmosninja $
00002 //
00003 //  SuperTuxKart - a fun racing game with go-kart
00004 //  Copyright (C) 2004-2005 Steve Baker <sjbaker1@airmail.net>
00005 //  Copyright (C) 2006 Joerg Henrichs, Steve Baker
00006 //
00007 //  This program is free software; you can redistribute it and/or
00008 //  modify it under the terms of the GNU General Public License
00009 //  as published by the Free Software Foundation; either version 2
00010 //  of the License, or (at your option) any later version.
00011 //
00012 //  This program is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU General Public License for more details.
00016 //
00017 //  You should have received a copy of the GNU General Public License
00018 //  along with this program; if not, write to the Free Software
00019 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021 
00022 #ifndef HEADER_PLAYERKART_H
00023 #define HEADER_PLAYERKART_H
00024 
00025 #include "kart.hpp"
00026 #include "player.hpp"
00027 
00028 class Player;
00029 class Camera;
00030 
00033 class PlayerKart : public Kart
00034 {
00035 private:
00036     int m_steer_val, m_steer_val_l, m_steer_val_r, m_accel_val;
00037 
00038     Player *m_player;
00039     float   m_penalty_time;
00040     float   m_time_last_crash_sound;
00041     Camera *m_camera;
00042 
00043     void steer(float, int);
00044 public:
00045     PlayerKart(const std::string& kart_name,
00046                int position, Player *_player,
00047                sgCoord init_pos, int player_index);
00048 
00049     int     earlyStartPenalty () {return m_penalty_time>0; }
00050     Player* getPlayer         () {return m_player;        }
00051     void    update            (float);
00052     void    addMessages       ();
00053     void    action            (KartAction action, int value);
00054     void    crashed           ();
00055     void    handleZipper      ();
00056     void    collectedHerring  (Herring* herring);
00057     virtual void setPosition  (int p);
00058 
00059     int     isPlayerKart      () const {return 1;}
00060     Camera* getCamera         () {return m_camera;}
00061 
00062     void    reset();
00063 };
00064 
00065 #endif
00066 
00067 /* EOF */