SuperTuxKart
local_player_controller.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2004-2015 Steve Baker <sjbaker1@airmail.net>
4 // Copyright (C) 2006-2015 Joerg Henrichs, Steve Baker
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 3
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 
20 
21 #ifndef HEADER_LOCAL_PLAYER_CONTROLLER_HPP
22 #define HEADER_LOCAL_PLAYER_CONTROLLER_HPP
23 
24 #include "karts/controller/player_controller.hpp"
25 #include <memory>
26 
27 class AbstractKart;
28 class ParticleEmitter;
29 class SFXBase;
30 class SFXBuffer;
31 
38 {
39 private:
40 
43 
44  bool m_sound_schedule;
45  bool m_has_started;
46  bool m_is_above_nitro_target;
47 
48  std::unique_ptr<ParticleEmitter> m_sky_particles_emitter;
49 
53 
54  HandicapLevel m_handicap;
55 
56  SFXBase *m_wee_sound;
57  SFXBuffer *m_bzzt_sound;
58  SFXBuffer *m_ugh_sound;
59  SFXBuffer *m_grab_sound;
60  SFXBuffer *m_full_sound;
61  SFXBuffer *m_unfull_sound;
62 
63 
64  virtual void steer(int, int) OVERRIDE;
65  virtual void displayPenaltyWarning() OVERRIDE;
66  void nitroNotFullSound();
67 
68 public:
70  const int local_player_id,
71  HandicapLevel h);
73  void update (int ticks) OVERRIDE;
74  bool action (PlayerAction action, int value,
75  bool dry_run=false) OVERRIDE;
76  void initParticleEmitter();
77  virtual void handleZipper (bool play_sound) OVERRIDE;
78  void collectedItem (const ItemState &item,
79  float previous_energy=0) OVERRIDE;
80  virtual void setPosition (int p) OVERRIDE;
81  virtual void reset () OVERRIDE;
82  virtual void finishedRace (float time) OVERRIDE;
83  virtual void resetInputState () OVERRIDE;
84  virtual bool canGetAchievements() const OVERRIDE;
85 
86  // ------------------------------------------------------------------------
87  virtual bool isPlayerController() const OVERRIDE {return true;}
88  // ------------------------------------------------------------------------
89  virtual bool isLocalPlayerController() const OVERRIDE {return true;}
90  // ------------------------------------------------------------------------
92  core::stringw getName(bool include_handicap_string = true) const OVERRIDE;
93 
94 }; // LocalPlayerController
95 
96 #endif
PlayerKart manages control events from the player and moves them to the Kart.
Definition: local_player_controller.hpp:37
HandicapLevel
Handicap per player.
Definition: remote_kart_info.hpp:39
Represents a player that is currently playing.
Definition: state_manager.hpp:75
virtual void displayPenaltyWarning() OVERRIDE
Displays a penalty warning for player controlled karts.
Definition: local_player_controller.cpp:294
virtual bool canGetAchievements() const OVERRIDE
Returns true if the player of this controller can collect achievements.
Definition: local_player_controller.cpp:423
PlayerAction
types of input events / what actions the players can do
Definition: input.hpp:116
virtual void handleZipper(bool play_sound) OVERRIDE
Called when a kart hits or uses a zipper.
Definition: local_player_controller.cpp:349
virtual void reset() OVERRIDE
Resets the player kart for a new or restarted race.
Definition: local_player_controller.cpp:123
The buffer (data) for one kind of sound effects.
Definition: sfx_buffer.hpp:45
void update(int ticks) OVERRIDE
Updates the player kart, called once each timestep.
Definition: local_player_controller.cpp:234
bool action(PlayerAction action, int value, bool dry_run=false) OVERRIDE
This function interprets a kart action and value, and set the corresponding entries in the kart contr...
Definition: local_player_controller.cpp:158
virtual void setPosition(int p) OVERRIDE
Called just before the kart position is changed.
Definition: local_player_controller.cpp:314
virtual void finishedRace(float time) OVERRIDE
Called when a kart finishes race.
Definition: local_player_controller.cpp:340
manages smoke particle effects
Definition: particle_emitter.hpp:41
virtual bool isPlayerController() const OVERRIDE
This function checks if this player is not an AI, i.e.
Definition: local_player_controller.hpp:87
void collectedItem(const ItemState &item, float previous_energy=0) OVERRIDE
Called when a kart hits an item.
Definition: local_player_controller.cpp:375
core::stringw getName(bool include_handicap_string=true) const OVERRIDE
Returns the name of the player profile.
Definition: local_player_controller.cpp:430
int m_camera_index
The index of the camera attached to the kart for this controller.
Definition: local_player_controller.hpp:52
StateManager::ActivePlayer * m_player
Stores the active player data structure.
Definition: local_player_controller.hpp:42
virtual bool isLocalPlayerController() const OVERRIDE
This function checks if this is a local player.
Definition: local_player_controller.hpp:89
virtual void steer(int, int) OVERRIDE
Handles steering for a player kart.
Definition: local_player_controller.cpp:212
The base class for sound effects.
Definition: sfx_base.hpp:42
void nitroNotFullSound()
If the nitro level has gone under the nitro goal, play a bad effect sound.
Definition: local_player_controller.cpp:410
Contains the state information of an item, i.e.
Definition: item.hpp:52
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:61
Definition: player_controller.hpp:27
virtual void resetInputState() OVERRIDE
Resets the state of control keys.
Definition: local_player_controller.cpp:135